Skip to content

Commit 3a4316f

Browse files
committed
feat: init common definitions for molecule
1 parent 2f2b7dd commit 3a4316f

13 files changed

+158
-0
lines changed

src/common/className.ts

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
import { APP_PREFIX } from '@/common/const';
2+
3+
/**
4+
* This function help you prefix a css class name, default is molecule.
5+
* Example: prefixClaName('test') will return 'molecule-test',
6+
* prefixClaName('test', 'c') will return 'c-test'
7+
* @param name Default class name
8+
* @param prefix The prefix of class name you want to append
9+
*/
10+
export function prefixClaName(name: string, prefix: string = APP_PREFIX) {
11+
return name ? `${prefix}-${name}` : '';
12+
}

src/common/component.ts

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
export abstract class MoleculeComponent {
2+
private _id: string | undefined = undefined;
3+
constructor(id: string) {
4+
this._id = id;
5+
}
6+
7+
getId() {
8+
return this._id;
9+
}
10+
}

src/common/const.ts

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
/**
2+
* Default App prefix
3+
*/
4+
export const APP_PREFIX = 'molecule';
5+
6+
export default {
7+
app: {
8+
prefix: 'molecule',
9+
},
10+
};

src/common/editor.ts

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
export interface IEditor {
2+
value: string;
3+
}

src/common/enums.ts

Whitespace-only changes.

src/common/extension.ts

+59
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
/**
2+
* Defines extension types
3+
*/
4+
export enum IExtensionType {
5+
Theme = 'themes',
6+
Normal = 'normal',
7+
Languages = 'languages',
8+
Settings = 'settings',
9+
Locals = 'locals',
10+
Menus = 'menus',
11+
Commands = 'commands',
12+
Workbench = 'workbench'
13+
}
14+
15+
export interface IContribute extends Object{
16+
[IExtensionType.Theme]: {
17+
18+
}
19+
}
20+
21+
/**
22+
* The interface of extension,
23+
* there need every extension to implement this interface
24+
*/
25+
export interface IExtension extends Object {
26+
/**
27+
* The name of extension
28+
*/
29+
name: string;
30+
/**
31+
* The display name of extension
32+
*/
33+
displayName: string;
34+
/**
35+
* The version of extension
36+
*/
37+
version: string;
38+
/**
39+
* The categories of extension
40+
*/
41+
categories: IExtensionType[],
42+
/**
43+
* The main file path of extension
44+
* Extension system will load the extension by this file
45+
*/
46+
contributes: IContribute,
47+
/**
48+
* The entry of extension
49+
*/
50+
main: string,
51+
/**
52+
* The description of extension
53+
*/
54+
description: string,
55+
/**
56+
* Whether disable current extension, the extension default status is enable
57+
*/
58+
disable: boolean;
59+
}

src/common/keybinding.ts

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
export interface IKeybinding {
2+
3+
}

src/common/localization.ts

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
export interface ILocalization {
2+
3+
}

src/common/molecule.ts

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
import { IExtension } from './extension';
2+
import { IWorkbench } from './workbench';
3+
import { ITheme } from './theme';
4+
import { ISettings } from './settings';
5+
import { IKeybinding } from './keybinding';
6+
7+
export interface IMolecule {
8+
workbench: IWorkbench;
9+
theme: ITheme;
10+
settings: ISettings;
11+
extension: IExtension;
12+
keybinding: IKeybinding;
13+
};
14+
15+
// export abstract class Molecule {
16+
17+
// }
18+

src/common/settings.ts

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
export interface ISettings {
2+
3+
}

src/common/style.ts

Whitespace-only changes.

src/common/theme.ts

+32
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
2+
export interface ThemeColor extends Object {
3+
id: string;
4+
}
5+
6+
interface TokenColor extends Object {
7+
name?: string;
8+
scope: string | string[];
9+
settings: object;
10+
}
11+
12+
export interface ITheme {
13+
/**
14+
* The id of component, theme will be applied by this ID
15+
*/
16+
id: string;
17+
name: string;
18+
colors: ThemeColor;
19+
tokenColors: TokenColor[];
20+
/**
21+
* The semanticTokenColors mappings as well as the semanticHighlighting setting allow to enhance the highlighting in the editor
22+
* More info visit: https://code.visualstudio.com/api/language-extensions/semantic-highlight-guide
23+
*/
24+
semanticHighlighting: boolean;
25+
}
26+
27+
/**
28+
* File icons for Molecule
29+
*/
30+
export interface IFileIcon {
31+
32+
}

src/common/workbench.ts

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
import { IEditor } from './editor';
2+
3+
export interface IWorkbench {
4+
editor: IEditor;
5+
}

0 commit comments

Comments
 (0)