-
Notifications
You must be signed in to change notification settings - Fork 129
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: init common definitions for molecule
- Loading branch information
Showing
13 changed files
with
158 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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}` : ''; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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', | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
export interface IEditor { | ||
value: string; | ||
} |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
export interface IKeybinding { | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
export interface ILocalization { | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 { | ||
|
||
// } | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
export interface ISettings { | ||
|
||
} |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 { | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
import { IEditor } from './editor'; | ||
|
||
export interface IWorkbench { | ||
editor: IEditor; | ||
} |