@chamn/engine 0.0.4 → 0.0.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.eslintrc.js +1 -0
- package/CHANGELOG.md +16 -0
- package/README.md +31 -0
- package/build.config.js +4 -3
- package/dist/Engine.module.scss.d.ts +5 -0
- package/dist/component/CSSEditor/index.d.ts +16 -0
- package/dist/component/CSSEditor/style.module.scss.d.ts +6 -0
- package/dist/component/CSSPropertiesEditor/cssProperties.d.ts +898 -0
- package/dist/component/CSSPropertiesEditor/index.d.ts +43 -0
- package/dist/component/CSSPropertiesEditor/style.module.scss.d.ts +15 -0
- package/dist/component/CSSPropertiesEditor/util.d.ts +1 -0
- package/dist/component/CSSPropertiesVariableBindEditor/cssProperties.d.ts +898 -0
- package/dist/component/CSSPropertiesVariableBindEditor/index.d.ts +37 -0
- package/dist/component/CSSPropertiesVariableBindEditor/style.module.scss.d.ts +15 -0
- package/dist/component/CSSPropertiesVariableBindEditor/util.d.ts +1 -0
- package/dist/component/ClassNameEditor/index.d.ts +16 -0
- package/dist/component/CustomSchemaForm/components/Form/Field/index.d.ts +11 -0
- package/dist/component/CustomSchemaForm/components/Form/Field/style.module.scss.d.ts +8 -0
- package/dist/component/CustomSchemaForm/components/Form/context.d.ts +10 -0
- package/dist/component/CustomSchemaForm/components/Form/index.d.ts +17 -0
- package/dist/component/CustomSchemaForm/components/SetterSwitcher/index.d.ts +12 -0
- package/dist/component/CustomSchemaForm/components/SetterSwitcher/style.module.scss.d.ts +7 -0
- package/dist/component/CustomSchemaForm/components/Setters/ArraySetter/ArrayItem.d.ts +11 -0
- package/dist/component/CustomSchemaForm/components/Setters/ArraySetter/SortItemOrderModal.d.ts +10 -0
- package/dist/component/CustomSchemaForm/components/Setters/ArraySetter/index.d.ts +14 -0
- package/dist/component/CustomSchemaForm/components/Setters/ArraySetter/style.module.scss.d.ts +7 -0
- package/dist/component/CustomSchemaForm/components/Setters/BooleanSetter/index.d.ts +5 -0
- package/dist/component/CustomSchemaForm/components/Setters/CSSValueSetter/index.d.ts +6 -0
- package/dist/component/CustomSchemaForm/components/Setters/CSSValueSetter/style.module.scss.d.ts +6 -0
- package/dist/component/CustomSchemaForm/components/Setters/ExpressionSetter/index.d.ts +8 -0
- package/dist/component/CustomSchemaForm/components/Setters/FunctionSetter/defaultDts.d.ts +1 -0
- package/dist/component/CustomSchemaForm/components/Setters/FunctionSetter/index.d.ts +2 -0
- package/dist/component/CustomSchemaForm/components/Setters/JSONSetter/index.d.ts +2 -0
- package/dist/component/CustomSchemaForm/components/Setters/NumberSetter/index.d.ts +3 -0
- package/dist/component/CustomSchemaForm/components/Setters/SelectSetter/index.d.ts +3 -0
- package/dist/component/CustomSchemaForm/components/Setters/ShapeSetter/index.d.ts +8 -0
- package/dist/component/CustomSchemaForm/components/Setters/StringSetter/index.d.ts +3 -0
- package/dist/component/CustomSchemaForm/components/Setters/TextAreaSetter/index.d.ts +3 -0
- package/dist/component/CustomSchemaForm/components/Setters/index.d.ts +3 -0
- package/dist/component/CustomSchemaForm/components/Setters/type.d.ts +19 -0
- package/dist/component/CustomSchemaForm/context.d.ts +15 -0
- package/dist/component/CustomSchemaForm/index.d.ts +17 -0
- package/dist/component/CustomSchemaForm/style.module.scss.d.ts +11 -0
- package/dist/component/CustomSchemaForm/utils.d.ts +2 -0
- package/dist/component/MonacoEditor/index.d.ts +15 -0
- package/dist/component/Workbench/style.module.scss.d.ts +26 -0
- package/dist/core/pluginManager.d.ts +1 -1
- package/dist/index.cjs.js +295 -39
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.d.ts +4 -2
- package/dist/index.es.js +44920 -9933
- package/dist/index.es.js.map +1 -1
- package/dist/material/innerMaterial.d.ts +2 -0
- package/dist/monacoeditorwork/css.worker.bundle.js +45072 -0
- package/dist/monacoeditorwork/editor.worker.bundle.js +8294 -0
- package/dist/monacoeditorwork/html.worker.bundle.js +24321 -0
- package/dist/monacoeditorwork/json.worker.bundle.js +15550 -0
- package/dist/monacoeditorwork/ts.worker.bundle.js +169967 -0
- package/dist/plugins/AdvancePanel/index.d.ts +10 -0
- package/dist/plugins/AdvancePanel/style.module.scss.d.ts +7 -0
- package/dist/plugins/ComponentLibrary/components/DragItem/index.d.ts +12 -0
- package/dist/plugins/ComponentLibrary/components/DragItem/style.module.scss.d.ts +9 -0
- package/dist/plugins/ComponentLibrary/components/ListView/index.d.ts +9 -0
- package/dist/plugins/ComponentLibrary/components/ListView/style.module.scss.d.ts +12 -0
- package/dist/plugins/ComponentLibrary/index.d.ts +3 -0
- package/dist/plugins/ComponentLibrary/localize/en_US/index.d.ts +1 -0
- package/dist/plugins/ComponentLibrary/localize/index.d.ts +2 -0
- package/dist/plugins/ComponentLibrary/localize/zh_CN/index.d.ts +1 -0
- package/dist/plugins/ComponentLibrary/style.module.scss.d.ts +11 -0
- package/dist/plugins/ComponentLibrary/util.d.ts +1 -0
- package/dist/plugins/ComponentStatePanel/index.d.ts +10 -0
- package/dist/plugins/Designer/components/DefaultSelectToolBar/index.d.ts +10 -0
- package/dist/plugins/Designer/components/DefaultSelectToolBar/style.module.scss.d.ts +11 -0
- package/dist/plugins/Designer/components/GhostView/index.d.ts +5 -0
- package/dist/plugins/Designer/config.d.ts +1 -0
- package/dist/plugins/Designer/index.d.ts +15 -0
- package/dist/plugins/Designer/localize/en_US/index.d.ts +1 -0
- package/dist/plugins/Designer/localize/index.d.ts +2 -0
- package/dist/plugins/Designer/localize/zh_CN/index.d.ts +1 -0
- package/dist/plugins/Designer/style.module.scss.d.ts +5 -0
- package/dist/plugins/Designer/util.d.ts +2 -0
- package/dist/plugins/Designer/view.d.ts +30 -0
- package/dist/plugins/DisplaySourceSchema/index.d.ts +9 -0
- package/dist/plugins/GlobalStatePanel/index.d.ts +3 -0
- package/dist/plugins/GlobalStatePanel/localize/en_US/index.d.ts +1 -0
- package/dist/plugins/GlobalStatePanel/localize/index.d.ts +2 -0
- package/dist/plugins/GlobalStatePanel/localize/zh_CN/index.d.ts +1 -0
- package/dist/plugins/GlobalStatePanel/style.module.scss.d.ts +5 -0
- package/dist/plugins/History/index.d.ts +2 -0
- package/dist/plugins/OutlineTree/components/TreeView/context.d.ts +30 -0
- package/dist/plugins/OutlineTree/components/TreeView/dataStruct.d.ts +21 -0
- package/dist/plugins/OutlineTree/components/TreeView/index.d.ts +34 -0
- package/dist/plugins/OutlineTree/components/TreeView/style.module.scss.d.ts +16 -0
- package/dist/plugins/OutlineTree/components/TreeView/treeNode.d.ts +9 -0
- package/dist/plugins/OutlineTree/index.d.ts +3 -0
- package/dist/plugins/OutlineTree/localize/en_US/index.d.ts +1 -0
- package/dist/plugins/OutlineTree/localize/index.d.ts +2 -0
- package/dist/plugins/OutlineTree/localize/zh_CN/index.d.ts +1 -0
- package/dist/plugins/OutlineTree/util.d.ts +15 -0
- package/dist/plugins/PropertyPanel/index.d.ts +9 -0
- package/dist/plugins/PropertyPanel/style.module.scss.d.ts +10 -0
- package/dist/plugins/RightPanel/index.d.ts +2 -0
- package/dist/plugins/RightPanel/style.module.scss.d.ts +10 -0
- package/dist/plugins/RightPanel/view.d.ts +34 -0
- package/dist/plugins/VisualPanelPlus/index.d.ts +9 -0
- package/dist/plugins/VisualPanelPlus/style.module.scss.d.ts +10 -0
- package/dist/plugins/index.d.ts +9 -0
- package/dist/style.css +1 -1
- package/dist/utils/css.d.ts +19 -0
- package/dist/utils/logger.d.ts +1 -0
- package/package.json +16 -8
- package/public/Engine.module.scss.d.ts +5 -0
- package/public/component/CSSEditor/style.module.scss.d.ts +6 -0
- package/public/component/CSSPropertiesEditor/style.module.scss.d.ts +15 -0
- package/public/component/CSSPropertiesVariableBindEditor/style.module.scss.d.ts +15 -0
- package/public/component/CustomSchemaForm/components/Form/Field/style.module.scss.d.ts +8 -0
- package/public/component/CustomSchemaForm/components/SetterSwitcher/style.module.scss.d.ts +7 -0
- package/public/component/CustomSchemaForm/components/Setters/ArraySetter/style.module.scss.d.ts +7 -0
- package/public/component/CustomSchemaForm/components/Setters/CSSValueSetter/style.module.scss.d.ts +6 -0
- package/public/component/CustomSchemaForm/style.module.scss.d.ts +11 -0
- package/public/component/Workbench/style.module.scss.d.ts +26 -0
- package/public/plugins/AdvancePanel/style.module.scss.d.ts +7 -0
- package/public/plugins/ComponentLibrary/components/DragItem/style.module.scss.d.ts +9 -0
- package/public/plugins/ComponentLibrary/components/ListView/style.module.scss.d.ts +12 -0
- package/public/plugins/ComponentLibrary/style.module.scss.d.ts +11 -0
- package/public/plugins/Designer/components/DefaultSelectToolBar/style.module.scss.d.ts +11 -0
- package/public/plugins/Designer/style.module.scss.d.ts +5 -0
- package/public/plugins/GlobalStatePanel/style.module.scss.d.ts +5 -0
- package/public/plugins/OutlineTree/components/TreeView/style.module.scss.d.ts +16 -0
- package/public/plugins/PropertyPanel/style.module.scss.d.ts +10 -0
- package/public/plugins/RightPanel/style.module.scss.d.ts +10 -0
- package/public/plugins/VisualPanelPlus/style.module.scss.d.ts +10 -0
- package/public/render.umd.js +14 -14
- package/public/render.umd.js.map +1 -1
- package/src/Engine.module.scss.d.ts +5 -0
- package/src/_dev_/page/Editor/index.tsx +1 -1
- package/src/component/CSSEditor/index.tsx +4 -5
- package/src/component/CSSEditor/style.module.scss.d.ts +6 -0
- package/src/component/CSSPropertiesEditor/index.tsx +1 -5
- package/src/component/CSSPropertiesEditor/style.module.scss.d.ts +15 -0
- package/src/component/CSSPropertiesVariableBindEditor/index.tsx +1 -1
- package/src/component/CSSPropertiesVariableBindEditor/style.module.scss.d.ts +15 -0
- package/src/component/CustomSchemaForm/components/Form/Field/style.module.scss.d.ts +8 -0
- package/src/component/CustomSchemaForm/components/SetterSwitcher/style.module.scss.d.ts +7 -0
- package/src/component/CustomSchemaForm/components/Setters/ArraySetter/style.module.scss.d.ts +7 -0
- package/src/component/CustomSchemaForm/components/Setters/CSSValueSetter/style.module.scss.d.ts +6 -0
- package/src/component/CustomSchemaForm/style.module.scss.d.ts +11 -0
- package/src/component/MonacoEditor/index.tsx +1 -41
- package/src/component/Workbench/style.module.scss.d.ts +26 -0
- package/src/core/pluginManager.ts +1 -1
- package/src/index.tsx +5 -2
- package/src/plugins/AdvancePanel/style.module.scss.d.ts +7 -0
- package/src/plugins/ComponentLibrary/components/DragItem/style.module.scss.d.ts +9 -0
- package/src/plugins/ComponentLibrary/components/ListView/index.tsx +0 -1
- package/src/plugins/ComponentLibrary/components/ListView/style.module.scss.d.ts +12 -0
- package/src/plugins/ComponentLibrary/style.module.scss.d.ts +11 -0
- package/src/plugins/Designer/components/DefaultSelectToolBar/style.module.scss.d.ts +11 -0
- package/src/plugins/Designer/style.module.scss.d.ts +5 -0
- package/src/plugins/DisplaySourceSchema/index.tsx +1 -1
- package/src/plugins/GlobalStatePanel/style.module.scss.d.ts +5 -0
- package/src/plugins/OutlineTree/components/TreeView/style.module.scss.d.ts +16 -0
- package/src/plugins/PropertyPanel/style.module.scss.d.ts +10 -0
- package/src/plugins/RightPanel/style.module.scss.d.ts +10 -0
- package/src/plugins/VisualPanelPlus/index.tsx +3 -19
- package/src/plugins/VisualPanelPlus/style.module.scss.d.ts +10 -0
- package/src/plugins/index.tsx +3 -1
- package/src/style.d.ts +2 -0
- package/src/typing.d.ts +5 -0
- package/dist/typing.d.ts +0 -4
- package/dist/vite-env.d.ts +0 -1
- package/public/typing.d.ts +0 -4
- package/public/vite-env.d.ts +0 -1
- package/src/component/MonacoEditor/index copy.tsx +0 -119
|
@@ -3,7 +3,7 @@ import { Button, message, Modal } from 'antd';
|
|
|
3
3
|
import React, { useCallback, useEffect, useState } from 'react';
|
|
4
4
|
import ReactDOM from 'react-dom';
|
|
5
5
|
import ReactDOMClient from 'react-dom/client';
|
|
6
|
-
import Engine,
|
|
6
|
+
import { Engine, EnginContext } from '../../..';
|
|
7
7
|
import '../../index.css';
|
|
8
8
|
import { DEFAULT_PLUGIN_LIST } from '../../../plugins';
|
|
9
9
|
import { DesignerExports } from '../../../plugins/Designer';
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { waitReactUpdate } from '@/utils';
|
|
2
2
|
import { formatCSSProperty, StyleArr, styleArr2Obj } from '@/utils/css';
|
|
3
3
|
import { MinusCircleOutlined, PlusOutlined } from '@ant-design/icons';
|
|
4
|
-
import { Card, Collapse, Dropdown,
|
|
4
|
+
import { Card, Collapse, Dropdown, Space } from 'antd';
|
|
5
5
|
import CheckableTag from 'antd/es/tag/CheckableTag';
|
|
6
|
-
import { MutableRefObject,
|
|
6
|
+
import { MutableRefObject, useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
|
7
7
|
import { CSSPropertiesEditor, CSSPropertiesEditorRef } from '../CSSPropertiesEditor';
|
|
8
8
|
import styles from './style.module.scss';
|
|
9
9
|
// state: 'normal' | 'hover' | 'active' | 'focus' | 'first' | 'last' | 'even' | 'odd';
|
|
@@ -139,7 +139,6 @@ export const CSSEditor = (props: CSSEditorProps) => {
|
|
|
139
139
|
|
|
140
140
|
const updateCssVal = useCallback(
|
|
141
141
|
(mediaKey: string, val: StyleArr) => {
|
|
142
|
-
console.log(cssVal, selectedStateTag, mediaKey, val);
|
|
143
142
|
const newVal = {
|
|
144
143
|
...cssVal,
|
|
145
144
|
[selectedStateTag]: {
|
|
@@ -220,7 +219,7 @@ export const CSSEditor = (props: CSSEditorProps) => {
|
|
|
220
219
|
marginBottom: '10px',
|
|
221
220
|
}}
|
|
222
221
|
>
|
|
223
|
-
<Collapse.Panel header={<span
|
|
222
|
+
<Collapse.Panel header={<span>Normal</span>} key="normal">
|
|
224
223
|
<CSSPropertiesEditor
|
|
225
224
|
ref={(ref) => {
|
|
226
225
|
cssPropertyRefMap.current['normal'] = ref;
|
|
@@ -231,7 +230,7 @@ export const CSSEditor = (props: CSSEditorProps) => {
|
|
|
231
230
|
</Collapse.Panel>
|
|
232
231
|
{mediaQueryList.map((el) => {
|
|
233
232
|
return (
|
|
234
|
-
<Collapse.Panel header={<span
|
|
233
|
+
<Collapse.Panel header={<span>{el.label}</span>} key={el.key}>
|
|
235
234
|
<CSSPropertiesEditor
|
|
236
235
|
ref={(ref) => {
|
|
237
236
|
cssPropertyRefMap.current[el.key] = ref;
|
|
@@ -181,11 +181,7 @@ export const SinglePropertyEditor = forwardRef<SinglePropertyEditorRef, SinglePr
|
|
|
181
181
|
style={{
|
|
182
182
|
width: `${keyInputWidth}px`,
|
|
183
183
|
}}
|
|
184
|
-
className={clsx([
|
|
185
|
-
styles.cssKeyLabel,
|
|
186
|
-
isCreate && styles.inputAuto,
|
|
187
|
-
isCreate && focusState.key && styles.active,
|
|
188
|
-
])}
|
|
184
|
+
className={clsx([isCreate && styles.inputAuto, isCreate && focusState.key && styles.active])}
|
|
189
185
|
onFocus={() => {
|
|
190
186
|
setFocusState({
|
|
191
187
|
key: true,
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import globalClassNames from '../../style.d';
|
|
2
|
+
declare const classNames: typeof globalClassNames & {
|
|
3
|
+
readonly cssFieldBox: 'cssFieldBox';
|
|
4
|
+
readonly 'ant-select-selector': 'ant-select-selector';
|
|
5
|
+
readonly 'ant-select-single': 'ant-select-single';
|
|
6
|
+
readonly 'ant-select-selection-search': 'ant-select-selection-search';
|
|
7
|
+
readonly 'ant-select-status-error': 'ant-select-status-error';
|
|
8
|
+
readonly inputAuto: 'inputAuto';
|
|
9
|
+
readonly active: 'active';
|
|
10
|
+
readonly cssBox: 'cssBox';
|
|
11
|
+
readonly 'ant-collapse-borderless': 'ant-collapse-borderless';
|
|
12
|
+
readonly 'ant-collapse-item': 'ant-collapse-item';
|
|
13
|
+
readonly 'ant-collapse-content-box': 'ant-collapse-content-box';
|
|
14
|
+
};
|
|
15
|
+
export = classNames;
|
|
@@ -160,7 +160,7 @@ const SinglePropertyEditor = forwardRef<SinglePropertyEditorRef, SinglePropertyE
|
|
|
160
160
|
style={{
|
|
161
161
|
width: `${keyInputWidth}px`,
|
|
162
162
|
}}
|
|
163
|
-
className={clsx([styles.inputBox
|
|
163
|
+
className={clsx([styles.inputBox])}
|
|
164
164
|
onFocus={() => {
|
|
165
165
|
setFocusState({
|
|
166
166
|
key: true,
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import globalClassNames from '../../style.d';
|
|
2
|
+
declare const classNames: typeof globalClassNames & {
|
|
3
|
+
readonly cssFieldBox: 'cssFieldBox';
|
|
4
|
+
readonly 'ant-select-selector': 'ant-select-selector';
|
|
5
|
+
readonly row: 'row';
|
|
6
|
+
readonly fieldLabel: 'fieldLabel';
|
|
7
|
+
readonly leftBox: 'leftBox';
|
|
8
|
+
readonly rightBox: 'rightBox';
|
|
9
|
+
readonly inputBox: 'inputBox';
|
|
10
|
+
readonly cssBox: 'cssBox';
|
|
11
|
+
readonly 'ant-collapse-borderless': 'ant-collapse-borderless';
|
|
12
|
+
readonly 'ant-collapse-item': 'ant-collapse-item';
|
|
13
|
+
readonly 'ant-collapse-content-box': 'ant-collapse-content-box';
|
|
14
|
+
};
|
|
15
|
+
export = classNames;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import globalClassNames from '../../style.d';
|
|
2
|
+
declare const classNames: typeof globalClassNames & {
|
|
3
|
+
readonly CFromRenderBox: 'CFromRenderBox';
|
|
4
|
+
readonly 'ant-collapse': 'ant-collapse';
|
|
5
|
+
readonly 'ant-collapse-content': 'ant-collapse-content';
|
|
6
|
+
readonly 'ant-collapse-content-box': 'ant-collapse-content-box';
|
|
7
|
+
readonly 'ant-collapse-item': 'ant-collapse-item';
|
|
8
|
+
readonly 'ant-collapse-header': 'ant-collapse-header';
|
|
9
|
+
readonly 'ant-collapse-expand-icon': 'ant-collapse-expand-icon';
|
|
10
|
+
};
|
|
11
|
+
export = classNames;
|
|
@@ -1,49 +1,9 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { useEffect } from 'react';
|
|
2
2
|
import * as monaco from 'monaco-editor';
|
|
3
3
|
|
|
4
|
-
// import 'monaco-editor/esm/vs/editor/standalone/browser/accessibilityHelp/accessibilityHelp.js';
|
|
5
|
-
// import 'monaco-editor/esm/vs/editor/standalone/browser/iPadShowKeyboard/iPadShowKeyboard.js';
|
|
6
|
-
// import 'monaco-editor/esm/vs/editor/standalone/browser/inspectTokens/inspectTokens.js';
|
|
7
|
-
// import 'monaco-editor/esm/vs/editor/standalone/browser/quickAccess/standaloneHelpQuickAccess.js';
|
|
8
|
-
// import 'monaco-editor/esm/vs/editor/standalone/browser/quickAccess/standaloneGotoLineQuickAccess.js';
|
|
9
|
-
// import 'monaco-editor/esm/vs/editor/standalone/browser/quickAccess/standaloneGotoSymbolQuickAccess.js';
|
|
10
|
-
// import 'monaco-editor/esm/vs/editor/standalone/browser/quickAccess/standaloneCommandsQuickAccess.js';
|
|
11
|
-
// import 'monaco-editor/esm/vs/editor/standalone/browser/referenceSearch/standaloneReferenceSearch.js';
|
|
12
|
-
|
|
13
|
-
// import 'monaco-editor/esm/vs/language/typescript/monaco.contribution';
|
|
14
|
-
// // import 'monaco-editor/esm/vs/language/typescript/monaco.contribution';
|
|
15
|
-
// // import 'monaco-editor/esm/vs/language/css/monaco.contribution';
|
|
16
|
-
// import 'monaco-editor/esm/vs/language/json/monaco.contribution';
|
|
17
|
-
// // import 'monaco-editor/esm/vs/language/html/monaco.contribution';
|
|
18
|
-
// // import 'monaco-editor/esm/vs/basic-languages/monaco.contribution';
|
|
19
|
-
// import 'monaco-editor/esm/vs/basic-languages/javascript/javascript.contribution';
|
|
20
|
-
|
|
21
|
-
import editorWorker from 'monaco-editor/esm/vs/editor/editor.worker?worker';
|
|
22
|
-
import jsonWorker from 'monaco-editor/esm/vs/language/json/json.worker?worker';
|
|
23
|
-
// import cssWorker from 'monaco-editor/esm/vs/language/css/css.worker?worker';
|
|
24
|
-
// import htmlWorker from 'monaco-editor/esm/vs/language/html/html.worker?worker';
|
|
25
|
-
import tsWorker from 'monaco-editor/esm/vs/language/typescript/ts.worker?worker';
|
|
26
4
|
import { useRef } from 'react';
|
|
27
5
|
import * as monacoEditor from 'monaco-editor/esm/vs/editor/editor.api';
|
|
28
6
|
|
|
29
|
-
self.MonacoEnvironment = {
|
|
30
|
-
getWorker(_, label) {
|
|
31
|
-
if (label === 'json') {
|
|
32
|
-
return new jsonWorker();
|
|
33
|
-
}
|
|
34
|
-
// if (label === 'css' || label === 'scss' || label === 'less') {
|
|
35
|
-
// return new cssWorker();
|
|
36
|
-
// }
|
|
37
|
-
// if (label === 'html' || label === 'handlebars' || label === 'razor') {
|
|
38
|
-
// return new htmlWorker();
|
|
39
|
-
// }
|
|
40
|
-
if (label === 'typescript' || label === 'javascript') {
|
|
41
|
-
return new tsWorker();
|
|
42
|
-
}
|
|
43
|
-
return new editorWorker();
|
|
44
|
-
},
|
|
45
|
-
};
|
|
46
|
-
|
|
47
7
|
export type MonacoEditorInstance = monacoEditor.editor.IStandaloneCodeEditor;
|
|
48
8
|
|
|
49
9
|
export type MonacoEditorProps = {
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import globalClassNames from '../../style.d';
|
|
2
|
+
declare const classNames: typeof globalClassNames & {
|
|
3
|
+
readonly workbenchContainer: 'workbenchContainer';
|
|
4
|
+
readonly topToolBarBox: 'topToolBarBox';
|
|
5
|
+
readonly logo: 'logo';
|
|
6
|
+
readonly topToolBarView: 'topToolBarView';
|
|
7
|
+
readonly bodyContent: 'bodyContent';
|
|
8
|
+
readonly leftBox: 'leftBox';
|
|
9
|
+
readonly pluginIconBar: 'pluginIconBar';
|
|
10
|
+
readonly pluginIconItem: 'pluginIconItem';
|
|
11
|
+
readonly active: 'active';
|
|
12
|
+
readonly pluginPanelBoxResizeBox: 'pluginPanelBoxResizeBox';
|
|
13
|
+
readonly pluginHeader: 'pluginHeader';
|
|
14
|
+
readonly pluginNameText: 'pluginNameText';
|
|
15
|
+
readonly closeBtn: 'closeBtn';
|
|
16
|
+
readonly fixedBtn: 'fixedBtn';
|
|
17
|
+
readonly pluginPanelBox: 'pluginPanelBox';
|
|
18
|
+
readonly rightResizeBox: 'rightResizeBox';
|
|
19
|
+
readonly arrowCursor: 'arrowCursor';
|
|
20
|
+
readonly rightBox: 'rightBox';
|
|
21
|
+
readonly centerBox: 'centerBox';
|
|
22
|
+
readonly subTopToolbarBox: 'subTopToolbarBox';
|
|
23
|
+
readonly canvasBox: 'canvasBox';
|
|
24
|
+
readonly scrollBox: 'scrollBox';
|
|
25
|
+
};
|
|
26
|
+
export = classNames;
|
package/src/index.tsx
CHANGED
|
@@ -21,7 +21,7 @@ export type EngineProps = {
|
|
|
21
21
|
onReady?: (ctx: EnginContext) => void;
|
|
22
22
|
};
|
|
23
23
|
|
|
24
|
-
class Engine extends React.Component<EngineProps> {
|
|
24
|
+
export class Engine extends React.Component<EngineProps> {
|
|
25
25
|
currentSelectNode: CNode | CRootNode | null;
|
|
26
26
|
|
|
27
27
|
pluginManager!: PluginManager;
|
|
@@ -136,4 +136,7 @@ class Engine extends React.Component<EngineProps> {
|
|
|
136
136
|
}
|
|
137
137
|
}
|
|
138
138
|
|
|
139
|
-
export
|
|
139
|
+
export * as plugins from './plugins';
|
|
140
|
+
export * from '@chamn/layout';
|
|
141
|
+
|
|
142
|
+
export * from './material/innerMaterial';
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import globalClassNames from '../../style.d';
|
|
2
|
+
declare const classNames: typeof globalClassNames & {
|
|
3
|
+
readonly advanceBox: 'advanceBox';
|
|
4
|
+
readonly 'ant-input-affix-wrapper': 'ant-input-affix-wrapper';
|
|
5
|
+
readonly 'ant-input-prefix': 'ant-input-prefix';
|
|
6
|
+
};
|
|
7
|
+
export = classNames;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import globalClassNames from '../../../../style.d';
|
|
2
|
+
declare const classNames: typeof globalClassNames & {
|
|
3
|
+
readonly square: 'square';
|
|
4
|
+
readonly componentItem: 'componentItem';
|
|
5
|
+
readonly iconImg: 'iconImg';
|
|
6
|
+
readonly iconBox: 'iconBox';
|
|
7
|
+
readonly iconText: 'iconText';
|
|
8
|
+
};
|
|
9
|
+
export = classNames;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import globalClassNames from '../../../../style.d';
|
|
2
|
+
declare const classNames: typeof globalClassNames & {
|
|
3
|
+
readonly ListBox: 'ListBox';
|
|
4
|
+
readonly 'ant-collapse': 'ant-collapse';
|
|
5
|
+
readonly 'ant-collapse-content': 'ant-collapse-content';
|
|
6
|
+
readonly 'ant-collapse-content-box': 'ant-collapse-content-box';
|
|
7
|
+
readonly 'ant-collapse-header': 'ant-collapse-header';
|
|
8
|
+
readonly 'ant-collapse-expand-icon': 'ant-collapse-expand-icon';
|
|
9
|
+
readonly 'ant-collapse-item': 'ant-collapse-item';
|
|
10
|
+
readonly collapsePanel: 'collapsePanel';
|
|
11
|
+
};
|
|
12
|
+
export = classNames;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import globalClassNames from '../../style.d';
|
|
2
|
+
declare const classNames: typeof globalClassNames & {
|
|
3
|
+
readonly container: 'container';
|
|
4
|
+
readonly 'ant-tabs': 'ant-tabs';
|
|
5
|
+
readonly 'ant-tabs-tab': 'ant-tabs-tab';
|
|
6
|
+
readonly 'ant-tabs-content': 'ant-tabs-content';
|
|
7
|
+
readonly 'ant-tabs-content-top': 'ant-tabs-content-top';
|
|
8
|
+
readonly 'ant-tabs-nav': 'ant-tabs-nav';
|
|
9
|
+
readonly tabTitle: 'tabTitle';
|
|
10
|
+
};
|
|
11
|
+
export = classNames;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import globalClassNames from '../../../../style.d';
|
|
2
|
+
declare const classNames: typeof globalClassNames & {
|
|
3
|
+
readonly toolBarBox: 'toolBarBox';
|
|
4
|
+
readonly item: 'item';
|
|
5
|
+
readonly layoutSelectBox: 'layoutSelectBox';
|
|
6
|
+
readonly hoverBox: 'hoverBox';
|
|
7
|
+
readonly hoverBoxActive: 'hoverBoxActive';
|
|
8
|
+
readonly hoverItem: 'hoverItem';
|
|
9
|
+
readonly placeholder: 'placeholder';
|
|
10
|
+
};
|
|
11
|
+
export = classNames;
|
|
@@ -3,7 +3,7 @@ import { Modal } from 'antd';
|
|
|
3
3
|
import { MonacoEditor, MonacoEditorInstance } from '../../component/MonacoEditor';
|
|
4
4
|
import { CPage } from '@chamn/model';
|
|
5
5
|
import { waitReactUpdate } from '../../utils';
|
|
6
|
-
import { EnginContext } from '../../
|
|
6
|
+
import { EnginContext } from '../../index';
|
|
7
7
|
import { DesignerExports } from '../Designer';
|
|
8
8
|
|
|
9
9
|
export type DisplaySourceSchemaProps = {
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import globalClassNames from '../../../../style.d';
|
|
2
|
+
declare const classNames: typeof globalClassNames & {
|
|
3
|
+
readonly contentBox: 'contentBox';
|
|
4
|
+
readonly nodeBox: 'nodeBox';
|
|
5
|
+
readonly toolbarBox: 'toolbarBox';
|
|
6
|
+
readonly iconItem: 'iconItem';
|
|
7
|
+
readonly nodeContent: 'nodeContent';
|
|
8
|
+
readonly selected: 'selected';
|
|
9
|
+
readonly nodeArrow: 'nodeArrow';
|
|
10
|
+
readonly expanded: 'expanded';
|
|
11
|
+
readonly nodeRenderView: 'nodeRenderView';
|
|
12
|
+
readonly nodeChildren: 'nodeChildren';
|
|
13
|
+
readonly dropAnchorLine: 'dropAnchorLine';
|
|
14
|
+
readonly arrowSpan: 'arrowSpan';
|
|
15
|
+
};
|
|
16
|
+
export = classNames;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import globalClassNames from '../../style.d';
|
|
2
|
+
declare const classNames: typeof globalClassNames & {
|
|
3
|
+
readonly CFromRenderBox: 'CFromRenderBox';
|
|
4
|
+
readonly 'ant-collapse': 'ant-collapse';
|
|
5
|
+
readonly 'ant-collapse-content': 'ant-collapse-content';
|
|
6
|
+
readonly 'ant-collapse-content-box': 'ant-collapse-content-box';
|
|
7
|
+
readonly 'ant-collapse-item': 'ant-collapse-item';
|
|
8
|
+
readonly 'ant-collapse-header': 'ant-collapse-header';
|
|
9
|
+
};
|
|
10
|
+
export = classNames;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import globalClassNames from '../../style.d';
|
|
2
|
+
declare const classNames: typeof globalClassNames & {
|
|
3
|
+
readonly rightPanelContainer: 'rightPanelContainer';
|
|
4
|
+
readonly 'ant-tabs': 'ant-tabs';
|
|
5
|
+
readonly 'ant-tabs-tab': 'ant-tabs-tab';
|
|
6
|
+
readonly 'ant-tabs-content': 'ant-tabs-content';
|
|
7
|
+
readonly 'ant-tabs-content-top': 'ant-tabs-content-top';
|
|
8
|
+
readonly 'ant-tabs-tabpane': 'ant-tabs-tabpane';
|
|
9
|
+
};
|
|
10
|
+
export = classNames;
|
|
@@ -54,7 +54,9 @@ export const VisualPanelPlus = (props: { node: CNode | CRootNode; pluginCtx: CPl
|
|
|
54
54
|
};
|
|
55
55
|
|
|
56
56
|
const onUpdateCss = (val: CSSVal) => {
|
|
57
|
-
|
|
57
|
+
// class name 不能以数字开头,这里使用c_前缀
|
|
58
|
+
node.value.css = formatCssToNodeVal(`c_${node.id}`, val);
|
|
59
|
+
console.log(' node.value.css', node.value.css);
|
|
58
60
|
node.updateValue();
|
|
59
61
|
};
|
|
60
62
|
|
|
@@ -72,24 +74,6 @@ export const VisualPanelPlus = (props: { node: CNode | CRootNode; pluginCtx: CPl
|
|
|
72
74
|
}}
|
|
73
75
|
/>
|
|
74
76
|
</div>
|
|
75
|
-
<Collapse
|
|
76
|
-
defaultActiveKey={['origin-css-edit']}
|
|
77
|
-
bordered={false}
|
|
78
|
-
style={{
|
|
79
|
-
marginBottom: '10px',
|
|
80
|
-
}}
|
|
81
|
-
>
|
|
82
|
-
<Collapse.Panel header={<span className={styles.header}>Style</span>} key="origin-css-edit">
|
|
83
|
-
<CSSPropertiesEditor
|
|
84
|
-
key={node.id}
|
|
85
|
-
ref={cssPropertyEditorRef}
|
|
86
|
-
onValueChange={(val) => {
|
|
87
|
-
onUpdateStyle([...val, ...formatStyle.expressionProperty]);
|
|
88
|
-
}}
|
|
89
|
-
initialValue={formatStyle.normalProperty}
|
|
90
|
-
/>
|
|
91
|
-
</Collapse.Panel>
|
|
92
|
-
</Collapse>
|
|
93
77
|
<Collapse
|
|
94
78
|
defaultActiveKey={['origin-css-edit']}
|
|
95
79
|
bordered={false}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import globalClassNames from '../../style.d';
|
|
2
|
+
declare const classNames: typeof globalClassNames & {
|
|
3
|
+
readonly visualPanelBox: 'visualPanelBox';
|
|
4
|
+
readonly header: 'header';
|
|
5
|
+
readonly 'ant-collapse': 'ant-collapse';
|
|
6
|
+
readonly 'ant-collapse-item': 'ant-collapse-item';
|
|
7
|
+
readonly 'ant-collapse-header': 'ant-collapse-header';
|
|
8
|
+
readonly 'ant-collapse-expand-icon': 'ant-collapse-expand-icon';
|
|
9
|
+
};
|
|
10
|
+
export = classNames;
|
package/src/plugins/index.tsx
CHANGED
|
@@ -4,6 +4,7 @@ import { DesignerPlugin } from './Designer';
|
|
|
4
4
|
import { OutlineTreePlugin } from './OutlineTree';
|
|
5
5
|
import { RightPanelPlugin } from './RightPanel';
|
|
6
6
|
import { GlobalStatePanelPlugin } from './GlobalStatePanel';
|
|
7
|
+
import { DisplaySourceSchema } from './DisplaySourceSchema';
|
|
7
8
|
import { HistoryPlugin } from './History';
|
|
8
9
|
|
|
9
10
|
export const DEFAULT_PLUGIN_LIST: CPlugin[] = [
|
|
@@ -15,10 +16,11 @@ export const DEFAULT_PLUGIN_LIST: CPlugin[] = [
|
|
|
15
16
|
HistoryPlugin,
|
|
16
17
|
];
|
|
17
18
|
|
|
18
|
-
export
|
|
19
|
+
export {
|
|
19
20
|
DesignerPlugin,
|
|
20
21
|
ComponentLibPlugin,
|
|
21
22
|
RightPanelPlugin,
|
|
22
23
|
GlobalStatePanelPlugin,
|
|
23
24
|
HistoryPlugin,
|
|
25
|
+
DisplaySourceSchema,
|
|
24
26
|
};
|
package/src/style.d.ts
ADDED
package/src/typing.d.ts
CHANGED
package/dist/typing.d.ts
DELETED
package/dist/vite-env.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
/// <reference types="vite/client" />
|
package/public/typing.d.ts
DELETED
package/public/vite-env.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
/// <reference types="vite/client" />
|
|
@@ -1,119 +0,0 @@
|
|
|
1
|
-
import React, { useEffect } from 'react';
|
|
2
|
-
import * as monaco from 'monaco-editor';
|
|
3
|
-
|
|
4
|
-
// import 'monaco-editor/esm/vs/editor/standalone/browser/accessibilityHelp/accessibilityHelp.js';
|
|
5
|
-
// import 'monaco-editor/esm/vs/editor/standalone/browser/iPadShowKeyboard/iPadShowKeyboard.js';
|
|
6
|
-
// import 'monaco-editor/esm/vs/editor/standalone/browser/inspectTokens/inspectTokens.js';
|
|
7
|
-
// import 'monaco-editor/esm/vs/editor/standalone/browser/quickAccess/standaloneHelpQuickAccess.js';
|
|
8
|
-
// import 'monaco-editor/esm/vs/editor/standalone/browser/quickAccess/standaloneGotoLineQuickAccess.js';
|
|
9
|
-
// import 'monaco-editor/esm/vs/editor/standalone/browser/quickAccess/standaloneGotoSymbolQuickAccess.js';
|
|
10
|
-
// import 'monaco-editor/esm/vs/editor/standalone/browser/quickAccess/standaloneCommandsQuickAccess.js';
|
|
11
|
-
// import 'monaco-editor/esm/vs/editor/standalone/browser/referenceSearch/standaloneReferenceSearch.js';
|
|
12
|
-
|
|
13
|
-
// import 'monaco-editor/esm/vs/language/typescript/monaco.contribution';
|
|
14
|
-
// // import 'monaco-editor/esm/vs/language/typescript/monaco.contribution';
|
|
15
|
-
// // import 'monaco-editor/esm/vs/language/css/monaco.contribution';
|
|
16
|
-
// import 'monaco-editor/esm/vs/language/json/monaco.contribution';
|
|
17
|
-
// // import 'monaco-editor/esm/vs/language/html/monaco.contribution';
|
|
18
|
-
// // import 'monaco-editor/esm/vs/basic-languages/monaco.contribution';
|
|
19
|
-
// import 'monaco-editor/esm/vs/basic-languages/javascript/javascript.contribution';
|
|
20
|
-
|
|
21
|
-
import editorWorker from 'monaco-editor/esm/vs/editor/editor.worker?worker';
|
|
22
|
-
import jsonWorker from 'monaco-editor/esm/vs/language/json/json.worker?worker';
|
|
23
|
-
// import cssWorker from 'monaco-editor/esm/vs/language/css/css.worker?worker';
|
|
24
|
-
// import htmlWorker from 'monaco-editor/esm/vs/language/html/html.worker?worker';
|
|
25
|
-
import tsWorker from 'monaco-editor/esm/vs/language/typescript/ts.worker?worker';
|
|
26
|
-
import { useRef } from 'react';
|
|
27
|
-
import * as monacoEditor from 'monaco-editor/esm/vs/editor/editor.api';
|
|
28
|
-
|
|
29
|
-
self.MonacoEnvironment = {
|
|
30
|
-
getWorker(_, label) {
|
|
31
|
-
if (label === 'json') {
|
|
32
|
-
return new jsonWorker();
|
|
33
|
-
}
|
|
34
|
-
// if (label === 'css' || label === 'scss' || label === 'less') {
|
|
35
|
-
// return new cssWorker();
|
|
36
|
-
// }
|
|
37
|
-
// if (label === 'html' || label === 'handlebars' || label === 'razor') {
|
|
38
|
-
// return new htmlWorker();
|
|
39
|
-
// }
|
|
40
|
-
if (label === 'typescript' || label === 'javascript') {
|
|
41
|
-
return new tsWorker();
|
|
42
|
-
}
|
|
43
|
-
return new editorWorker();
|
|
44
|
-
},
|
|
45
|
-
};
|
|
46
|
-
|
|
47
|
-
export type MonacoEditorInstance = monacoEditor.editor.IStandaloneCodeEditor;
|
|
48
|
-
|
|
49
|
-
export type MonacoEditorProps = {
|
|
50
|
-
beforeMount?: (monaco: typeof monacoEditor) => void;
|
|
51
|
-
onDidMount?: (editor: MonacoEditorInstance) => void;
|
|
52
|
-
options?: monaco.editor.IStandaloneEditorConstructionOptions;
|
|
53
|
-
override?: monaco.editor.IEditorOverrideServices;
|
|
54
|
-
onChange?: (val: string) => void;
|
|
55
|
-
onDidChangeMarkers?: (markers: monaco.editor.IMarker[]) => void;
|
|
56
|
-
initialValue?: string;
|
|
57
|
-
language?: 'json' | 'javascript' | 'typescript';
|
|
58
|
-
};
|
|
59
|
-
|
|
60
|
-
export const MonacoEditor = (props: MonacoEditorProps) => {
|
|
61
|
-
const editorDomRef = useRef<HTMLDivElement>(null);
|
|
62
|
-
const onChangeRef = useRef<MonacoEditorProps['onChange'] | undefined>();
|
|
63
|
-
onChangeRef.current = props.onChange;
|
|
64
|
-
const onDidChangeMarkersRef = useRef<MonacoEditorProps['onDidChangeMarkers'] | undefined>();
|
|
65
|
-
onDidChangeMarkersRef.current = props.onDidChangeMarkers;
|
|
66
|
-
const editorInstance = useRef<MonacoEditorInstance | null>(null);
|
|
67
|
-
|
|
68
|
-
useEffect(() => {
|
|
69
|
-
if (!editorDomRef.current) {
|
|
70
|
-
return;
|
|
71
|
-
}
|
|
72
|
-
props.beforeMount?.(monaco);
|
|
73
|
-
const editor = monaco.editor.create(
|
|
74
|
-
editorDomRef.current,
|
|
75
|
-
{
|
|
76
|
-
...(props.options || {}),
|
|
77
|
-
value: props.initialValue || props.options?.value,
|
|
78
|
-
language: props.language || props.options?.language,
|
|
79
|
-
},
|
|
80
|
-
{ ...(props.override || {}) }
|
|
81
|
-
);
|
|
82
|
-
|
|
83
|
-
editorInstance.current = editor;
|
|
84
|
-
props.onDidMount?.(editor);
|
|
85
|
-
const subscription = editor.getModel()?.onDidChangeContent(() => {
|
|
86
|
-
onChangeRef.current?.(editor.getValue());
|
|
87
|
-
});
|
|
88
|
-
|
|
89
|
-
monaco.editor.onDidChangeMarkers((uris) => {
|
|
90
|
-
const editorModel = editor.getModel();
|
|
91
|
-
if (!editorModel) {
|
|
92
|
-
return;
|
|
93
|
-
}
|
|
94
|
-
const editorUri = editorModel.uri;
|
|
95
|
-
const changeUri = uris.find((el) => el.path === editorUri.path);
|
|
96
|
-
if (changeUri) {
|
|
97
|
-
const res = monaco.editor.getModelMarkers({
|
|
98
|
-
resource: editorUri,
|
|
99
|
-
});
|
|
100
|
-
onDidChangeMarkersRef.current?.(res);
|
|
101
|
-
}
|
|
102
|
-
});
|
|
103
|
-
|
|
104
|
-
() => {
|
|
105
|
-
editor.dispose();
|
|
106
|
-
subscription?.dispose();
|
|
107
|
-
};
|
|
108
|
-
}, []);
|
|
109
|
-
|
|
110
|
-
return (
|
|
111
|
-
<div
|
|
112
|
-
style={{
|
|
113
|
-
width: '100%',
|
|
114
|
-
height: '100%',
|
|
115
|
-
}}
|
|
116
|
-
ref={editorDomRef}
|
|
117
|
-
></div>
|
|
118
|
-
);
|
|
119
|
-
};
|