Skip to content

Commit 2196711

Browse files
committed
feat: add sidebar, theme layout and others core modules
1 parent b49531e commit 2196711

12 files changed

+206
-0
lines changed

src/core/activityBar.ts

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
// import { ReactType } from '@/typings';
2+
import * as React from 'react';
3+
4+
export interface IActivityBarData {
5+
id: string;
6+
name?: string;
7+
data?: any;
8+
// render?: <T>() => T;
9+
render?: () => any;
10+
}
11+
12+
export interface IActivityBar {
13+
readonly data: IActivityBarData[];
14+
onSelect: (key: string, item: IActivityBarData) => void;
15+
onClick: (event: React.MouseEvent, item: IActivityBarData) => void;
16+
push: (data: IActivityBarData) => void;
17+
remove: (index: number) => void;
18+
update: () => void;
19+
get: (id: string) => void;
20+
// render?: <T>() => T;
21+
render?: () => any;
22+
23+
}

src/core/editor.ts

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

src/core/extension.ts

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

src/core/iconTheme.ts

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
2+
/**
3+
* File icons for Molecule
4+
*/
5+
export interface IIconTheme {
6+
7+
}

src/core/keybinding.ts

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

src/core/layout.ts

Whitespace-only changes.

src/core/localization.ts

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

src/core/molecule.ts

+72
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
import { IActivityBar } from './activityBar';
2+
3+
export class Sidebar {}
4+
export class MenuBar {}
5+
export class Panel {}
6+
export class StatusBar {}
7+
export class Editor {}
8+
export class Layout {}
9+
export class Theme {}
10+
export class IconTheme {}
11+
export class Settings {}
12+
export class Local {}
13+
export class ShortcutKeys {}
14+
15+
export interface IMolecule {
16+
// sidebar: Sidebar;
17+
// menuBar: MenuBar;
18+
// statusBar: StatusBar;
19+
activityBar: IActivityBar;
20+
// panel: Panel;
21+
// editor: Editor;
22+
// layout: Layout;
23+
// theme: Theme;
24+
// iconTheme: IconTheme;
25+
// local: Local;
26+
// shortcutKeys: ShortcutKeys;
27+
}
28+
29+
export class Molecule {
30+
public sidebar: Sidebar;
31+
public menuBar: MenuBar;
32+
public statusBar: StatusBar;
33+
public activityBar: IActivityBar;
34+
public panel: Panel;
35+
public editor: Editor;
36+
public layout: Layout;
37+
public theme: Theme;
38+
public iconTheme: IconTheme;
39+
public settings: Settings;
40+
public local: Local;
41+
public shortcutKeys: ShortcutKeys;
42+
43+
constructor(
44+
sidebar: Sidebar,
45+
menuBar: MenuBar,
46+
statusBar: StatusBar,
47+
activityBar: IActivityBar,
48+
editor: Editor,
49+
panel: Panel,
50+
layout: Layout,
51+
theme: Theme,
52+
iconTheme: IconTheme,
53+
settings: Settings,
54+
local: Local,
55+
shortcutKeys: ShortcutKeys,
56+
) {
57+
this.sidebar = sidebar;
58+
this.menuBar = menuBar;
59+
this.statusBar = statusBar;
60+
this.activityBar = activityBar,
61+
this.panel = panel;
62+
this.editor = editor;
63+
this.layout = layout;
64+
this.theme = theme;
65+
this.iconTheme = iconTheme;
66+
this.settings = settings;
67+
this.local = local;
68+
this.shortcutKeys = shortcutKeys;
69+
}
70+
};
71+
72+
// TODO

src/core/settings.ts

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

src/core/sidebar.ts

Whitespace-only changes.

src/core/statusBar.ts

Whitespace-only changes.

src/core/theme.ts

+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
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
22+
* the semanticHighlighting setting
23+
* allow to enhance the highlighting in the editor
24+
* More info visit: https://code.visualstudio.com/api/language-extensions/semantic-highlight-guide
25+
*/
26+
semanticHighlighting: boolean;
27+
}

0 commit comments

Comments
 (0)