Skip to content

Commit

Permalink
feat: init common definitions for molecule
Browse files Browse the repository at this point in the history
  • Loading branch information
wewoor committed Sep 16, 2020
1 parent 2f2b7dd commit 3a4316f
Show file tree
Hide file tree
Showing 13 changed files with 158 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/common/className.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import { APP_PREFIX } from '@/common/const';

/**
* This function help you prefix a css class name, default is molecule.
* Example: prefixClaName('test') will return 'molecule-test',
* prefixClaName('test', 'c') will return 'c-test'
* @param name Default class name
* @param prefix The prefix of class name you want to append
*/
export function prefixClaName(name: string, prefix: string = APP_PREFIX) {
return name ? `${prefix}-${name}` : '';
}
10 changes: 10 additions & 0 deletions src/common/component.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
export abstract class MoleculeComponent {
private _id: string | undefined = undefined;
constructor(id: string) {
this._id = id;
}

getId() {
return this._id;
}
}
10 changes: 10 additions & 0 deletions src/common/const.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
/**
* Default App prefix
*/
export const APP_PREFIX = 'molecule';

export default {
app: {
prefix: 'molecule',
},
};
3 changes: 3 additions & 0 deletions src/common/editor.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export interface IEditor {
value: string;
}
Empty file added src/common/enums.ts
Empty file.
59 changes: 59 additions & 0 deletions src/common/extension.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
/**
* Defines extension types
*/
export enum IExtensionType {
Theme = 'themes',
Normal = 'normal',
Languages = 'languages',
Settings = 'settings',
Locals = 'locals',
Menus = 'menus',
Commands = 'commands',
Workbench = 'workbench'
}

export interface IContribute extends Object{
[IExtensionType.Theme]: {

}
}

/**
* The interface of extension,
* there need every extension to implement this interface
*/
export interface IExtension extends Object {
/**
* The name of extension
*/
name: string;
/**
* The display name of extension
*/
displayName: string;
/**
* The version of extension
*/
version: string;
/**
* The categories of extension
*/
categories: IExtensionType[],
/**
* The main file path of extension
* Extension system will load the extension by this file
*/
contributes: IContribute,
/**
* The entry of extension
*/
main: string,
/**
* The description of extension
*/
description: string,
/**
* Whether disable current extension, the extension default status is enable
*/
disable: boolean;
}
3 changes: 3 additions & 0 deletions src/common/keybinding.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export interface IKeybinding {

}
3 changes: 3 additions & 0 deletions src/common/localization.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export interface ILocalization {

}
18 changes: 18 additions & 0 deletions src/common/molecule.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import { IExtension } from './extension';
import { IWorkbench } from './workbench';
import { ITheme } from './theme';
import { ISettings } from './settings';
import { IKeybinding } from './keybinding';

export interface IMolecule {
workbench: IWorkbench;
theme: ITheme;
settings: ISettings;
extension: IExtension;
keybinding: IKeybinding;
};

// export abstract class Molecule {

// }

3 changes: 3 additions & 0 deletions src/common/settings.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export interface ISettings {

}
Empty file added src/common/style.ts
Empty file.
32 changes: 32 additions & 0 deletions src/common/theme.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@

export interface ThemeColor extends Object {
id: string;
}

interface TokenColor extends Object {
name?: string;
scope: string | string[];
settings: object;
}

export interface ITheme {
/**
* The id of component, theme will be applied by this ID
*/
id: string;
name: string;
colors: ThemeColor;
tokenColors: TokenColor[];
/**
* The semanticTokenColors mappings as well as the semanticHighlighting setting allow to enhance the highlighting in the editor
* More info visit: https://code.visualstudio.com/api/language-extensions/semantic-highlight-guide
*/
semanticHighlighting: boolean;
}

/**
* File icons for Molecule
*/
export interface IFileIcon {

}
5 changes: 5 additions & 0 deletions src/common/workbench.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import { IEditor } from './editor';

export interface IWorkbench {
editor: IEditor;
}

0 comments on commit 3a4316f

Please sign in to comment.