@chamn/engine 0.0.41 → 0.0.42

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.
Files changed (129) hide show
  1. package/dist/Engine.module.scss.d.ts +5 -0
  2. package/dist/component/CSSEditor/index.d.ts +16 -0
  3. package/dist/component/CSSEditor/style.module.scss.d.ts +6 -0
  4. package/dist/component/CSSPropertiesEditor/cssProperties.d.ts +898 -0
  5. package/dist/component/CSSPropertiesEditor/index.d.ts +21 -0
  6. package/dist/component/CSSPropertiesEditor/signleProperty.d.ts +25 -0
  7. package/dist/component/CSSPropertiesEditor/style.module.scss.d.ts +17 -0
  8. package/dist/component/CSSPropertiesVariableBindEditor/SingleProperty.d.ts +24 -0
  9. package/dist/component/CSSPropertiesVariableBindEditor/cssProperties.d.ts +898 -0
  10. package/dist/component/CSSPropertiesVariableBindEditor/index.d.ts +19 -0
  11. package/dist/component/CSSPropertiesVariableBindEditor/style.module.scss.d.ts +16 -0
  12. package/dist/component/CSSSizeInput/index.d.ts +39 -0
  13. package/dist/component/CSSSizeInput/style.module.scss.d.ts +10 -0
  14. package/dist/component/CSSUIPanel/BackgroundInput/index.d.ts +10 -0
  15. package/dist/component/CSSUIPanel/BorderInput/index.d.ts +10 -0
  16. package/dist/component/CSSUIPanel/DimensionInput/index.d.ts +11 -0
  17. package/dist/component/CSSUIPanel/FontInput/index.d.ts +10 -0
  18. package/dist/component/CSSUIPanel/MarginAndPaddingInput/index.d.ts +11 -0
  19. package/dist/component/CSSUIPanel/ShadowInput/index.d.ts +10 -0
  20. package/dist/component/CSSUIPanel/index.d.ts +9 -0
  21. package/dist/component/CSSUIPanel/style.module.scss.d.ts +11 -0
  22. package/dist/component/CSSUIPanel/type.d.ts +3 -0
  23. package/dist/component/ClassNameEditor/index.d.ts +10 -0
  24. package/dist/component/CustomSchemaForm/components/Form/Field/index.d.ts +12 -0
  25. package/dist/component/CustomSchemaForm/components/Form/Field/style.module.scss.d.ts +8 -0
  26. package/dist/component/CustomSchemaForm/components/Form/context.d.ts +12 -0
  27. package/dist/component/CustomSchemaForm/components/Form/index.d.ts +19 -0
  28. package/dist/component/CustomSchemaForm/components/SetterSwitcher/index.d.ts +14 -0
  29. package/dist/component/CustomSchemaForm/components/SetterSwitcher/style.module.scss.d.ts +7 -0
  30. package/dist/component/CustomSchemaForm/components/Setters/AntDColorSetter/index.d.ts +2 -0
  31. package/dist/component/CustomSchemaForm/components/Setters/ArraySetter/ArrayItem.d.ts +11 -0
  32. package/dist/component/CustomSchemaForm/components/Setters/ArraySetter/SortItemOrderModal.d.ts +10 -0
  33. package/dist/component/CustomSchemaForm/components/Setters/ArraySetter/index.d.ts +14 -0
  34. package/dist/component/CustomSchemaForm/components/Setters/ArraySetter/style.module.scss.d.ts +7 -0
  35. package/dist/component/CustomSchemaForm/components/Setters/BooleanSetter/index.d.ts +7 -0
  36. package/dist/component/CustomSchemaForm/components/Setters/CSSSizeSetter/index.d.ts +3 -0
  37. package/dist/component/CustomSchemaForm/components/Setters/CSSValueSetter/index.d.ts +6 -0
  38. package/dist/component/CustomSchemaForm/components/Setters/CSSValueSetter/style.module.scss.d.ts +6 -0
  39. package/dist/component/CustomSchemaForm/components/Setters/ColorSetter/index.d.ts +2 -0
  40. package/dist/component/CustomSchemaForm/components/Setters/ExpressionSetter/index.d.ts +10 -0
  41. package/dist/component/CustomSchemaForm/components/Setters/FunctionSetter/index.d.ts +2 -0
  42. package/dist/component/CustomSchemaForm/components/Setters/JSONSetter/index.d.ts +2 -0
  43. package/dist/component/CustomSchemaForm/components/Setters/NumberSetter/index.d.ts +3 -0
  44. package/dist/component/CustomSchemaForm/components/Setters/RadioGroupSetter/index.d.ts +2 -0
  45. package/dist/component/CustomSchemaForm/components/Setters/SelectSetter/index.d.ts +3 -0
  46. package/dist/component/CustomSchemaForm/components/Setters/ShapeSetter/index.d.ts +8 -0
  47. package/dist/component/CustomSchemaForm/components/Setters/SliderSetter/index.d.ts +3 -0
  48. package/dist/component/CustomSchemaForm/components/Setters/StringSetter/index.d.ts +3 -0
  49. package/dist/component/CustomSchemaForm/components/Setters/TextAreaSetter/index.d.ts +3 -0
  50. package/dist/component/CustomSchemaForm/components/Setters/index.d.ts +4 -0
  51. package/dist/component/CustomSchemaForm/components/Setters/type.d.ts +20 -0
  52. package/dist/component/CustomSchemaForm/context.d.ts +15 -0
  53. package/dist/component/CustomSchemaForm/index.d.ts +22 -0
  54. package/dist/component/CustomSchemaForm/style.module.scss.d.ts +11 -0
  55. package/dist/component/CustomSchemaForm/utils.d.ts +2 -0
  56. package/dist/component/InputNumberPlus/index.d.ts +9 -0
  57. package/dist/component/InputNumberPlus/style.module.scss.d.ts +6 -0
  58. package/dist/component/MonacoEditor/index.d.ts +14 -0
  59. package/dist/component/Workbench/index.d.ts +72 -0
  60. package/dist/component/Workbench/style.module.scss.d.ts +26 -0
  61. package/dist/config/colorPickerColorList.d.ts +4 -0
  62. package/dist/core/assetPackagesListManage.d.ts +8 -0
  63. package/dist/core/pluginManager.d.ts +63 -0
  64. package/dist/i18n/en_US/index.d.ts +5 -0
  65. package/dist/i18n/index.d.ts +6 -0
  66. package/dist/i18n/zh_CN/index.d.ts +5 -0
  67. package/dist/index.d.ts +57 -0
  68. package/dist/index.js +2 -2
  69. package/dist/index.js.map +1 -1
  70. package/dist/index.mjs +3 -2
  71. package/dist/index.mjs.map +1 -1
  72. package/dist/material/innerMaterial.d.ts +2 -0
  73. package/dist/plugins/AdvancePanel/index.d.ts +10 -0
  74. package/dist/plugins/AdvancePanel/style.module.scss.d.ts +7 -0
  75. package/dist/plugins/ComponentLibrary/components/DragItem/index.d.ts +12 -0
  76. package/dist/plugins/ComponentLibrary/components/DragItem/style.module.scss.d.ts +9 -0
  77. package/dist/plugins/ComponentLibrary/components/ListView/index.d.ts +9 -0
  78. package/dist/plugins/ComponentLibrary/components/ListView/style.module.scss.d.ts +12 -0
  79. package/dist/plugins/ComponentLibrary/index.d.ts +3 -0
  80. package/dist/plugins/ComponentLibrary/localize/en_US/index.d.ts +1 -0
  81. package/dist/plugins/ComponentLibrary/localize/index.d.ts +2 -0
  82. package/dist/plugins/ComponentLibrary/localize/zh_CN/index.d.ts +1 -0
  83. package/dist/plugins/ComponentLibrary/style.module.scss.d.ts +11 -0
  84. package/dist/plugins/ComponentLibrary/util.d.ts +1 -0
  85. package/dist/plugins/ComponentStatePanel/index.d.ts +10 -0
  86. package/dist/plugins/Designer/components/Canvas/advanceCustomHook.d.ts +45 -0
  87. package/dist/plugins/Designer/components/Canvas/index.d.ts +63 -0
  88. package/dist/plugins/Designer/components/Canvas/style.module.scss.d.ts +5 -0
  89. package/dist/plugins/Designer/components/DefaultSelectToolBar/index.d.ts +16 -0
  90. package/dist/plugins/Designer/components/DefaultSelectToolBar/style.module.scss.d.ts +11 -0
  91. package/dist/plugins/Designer/components/GhostView/index.d.ts +5 -0
  92. package/dist/plugins/Designer/config.d.ts +1 -0
  93. package/dist/plugins/Designer/index.d.ts +2 -0
  94. package/dist/plugins/Designer/localize/en_US/index.d.ts +1 -0
  95. package/dist/plugins/Designer/localize/index.d.ts +2 -0
  96. package/dist/plugins/Designer/localize/zh_CN/index.d.ts +1 -0
  97. package/dist/plugins/Designer/type.d.ts +26 -0
  98. package/dist/plugins/Designer/util.d.ts +2 -0
  99. package/dist/plugins/DisplaySourceSchema/index.d.ts +9 -0
  100. package/dist/plugins/GlobalStatePanel/index.d.ts +3 -0
  101. package/dist/plugins/GlobalStatePanel/localize/en_US/index.d.ts +1 -0
  102. package/dist/plugins/GlobalStatePanel/localize/index.d.ts +2 -0
  103. package/dist/plugins/GlobalStatePanel/localize/zh_CN/index.d.ts +1 -0
  104. package/dist/plugins/GlobalStatePanel/style.module.scss.d.ts +5 -0
  105. package/dist/plugins/History/index.d.ts +2 -0
  106. package/dist/plugins/History/type.d.ts +12 -0
  107. package/dist/plugins/OutlineTree/components/TreeView/context.d.ts +30 -0
  108. package/dist/plugins/OutlineTree/components/TreeView/dataStruct.d.ts +21 -0
  109. package/dist/plugins/OutlineTree/components/TreeView/index.d.ts +33 -0
  110. package/dist/plugins/OutlineTree/components/TreeView/style.module.scss.d.ts +16 -0
  111. package/dist/plugins/OutlineTree/components/TreeView/treeNode.d.ts +11 -0
  112. package/dist/plugins/OutlineTree/index.d.ts +3 -0
  113. package/dist/plugins/OutlineTree/localize/en_US/index.d.ts +1 -0
  114. package/dist/plugins/OutlineTree/localize/index.d.ts +2 -0
  115. package/dist/plugins/OutlineTree/localize/zh_CN/index.d.ts +1 -0
  116. package/dist/plugins/OutlineTree/util.d.ts +14 -0
  117. package/dist/plugins/PropertyPanel/index.d.ts +9 -0
  118. package/dist/plugins/PropertyPanel/style.module.scss.d.ts +10 -0
  119. package/dist/plugins/RightPanel/index.d.ts +2 -0
  120. package/dist/plugins/RightPanel/style.module.scss.d.ts +10 -0
  121. package/dist/plugins/RightPanel/view.d.ts +39 -0
  122. package/dist/plugins/VisualPanelPlus/index.d.ts +4 -0
  123. package/dist/plugins/VisualPanelPlus/style.module.scss.d.ts +10 -0
  124. package/dist/plugins/index.d.ts +9 -0
  125. package/dist/utils/css.d.ts +40 -0
  126. package/dist/utils/defaultEngineConfig.d.ts +13 -0
  127. package/dist/utils/index.d.ts +12 -0
  128. package/dist/utils/logger.d.ts +1 -0
  129. package/package.json +7 -7
@@ -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 topToolBarView: 'topToolBarView';
6
+ readonly bodyContent: 'bodyContent';
7
+ readonly leftBox: 'leftBox';
8
+ readonly pluginIconBar: 'pluginIconBar';
9
+ readonly pluginIconItem: 'pluginIconItem';
10
+ readonly active: 'active';
11
+ readonly pluginPanelBoxResizeBox: 'pluginPanelBoxResizeBox';
12
+ readonly pluginHeader: 'pluginHeader';
13
+ readonly pluginNameText: 'pluginNameText';
14
+ readonly closeBtn: 'closeBtn';
15
+ readonly fixedBtn: 'fixedBtn';
16
+ readonly pluginPanelBox: 'pluginPanelBox';
17
+ readonly rightResizeBox: 'rightResizeBox';
18
+ readonly arrowCursor: 'arrowCursor';
19
+ readonly rightBox: 'rightBox';
20
+ readonly centerBox: 'centerBox';
21
+ readonly subTopToolbarBox: 'subTopToolbarBox';
22
+ readonly canvasBox: 'canvasBox';
23
+ readonly scrollBox: 'scrollBox';
24
+ readonly customViewBox: 'customViewBox';
25
+ };
26
+ export = classNames;
@@ -0,0 +1,4 @@
1
+ export declare const DEFAULT_PRESET_COLORS: {
2
+ label: string;
3
+ colors: string[];
4
+ }[];
@@ -0,0 +1,8 @@
1
+ import { AssetPackage } from '@chamn/model';
2
+ export declare class AssetsPackageListManager {
3
+ private _assets;
4
+ constructor(assets: AssetPackage[]);
5
+ getList(): AssetPackage[];
6
+ setList(newAssets: AssetPackage[]): void;
7
+ }
8
+ export declare const getUniqueAssetsList: (tempList: AssetPackage[]) => AssetPackage[];
@@ -0,0 +1,63 @@
1
+ import { Engine } from '../index';
2
+ import { CPage } from '@chamn/model';
3
+ import { Emitter } from 'mitt';
4
+ import { Workbench } from '../component/Workbench';
5
+ import { CustomI18n } from '../i18n';
6
+ import { AssetsPackageListManager } from './assetPackagesListManage';
7
+ export type PluginObj<C, E = any> = {
8
+ name: string;
9
+ init: (ctx: CPluginCtx<C>) => Promise<void>;
10
+ destroy: (ctx: CPluginCtx<C>) => Promise<void>;
11
+ /** 用于暴露给外部重载插件 */
12
+ reload?: (ctx: CPluginCtx<C>) => Promise<void>;
13
+ /** 插件暴露给外部可以调用的方法 */
14
+ export: (ctx: CPluginCtx<C>) => E;
15
+ meta: {
16
+ engine: {
17
+ version: string;
18
+ };
19
+ };
20
+ };
21
+ export type CPlugin<C = Record<string, any>, E = any> = PluginObj<C, E> | ((ctx: CPluginCtx<C>) => PluginObj<C, E>);
22
+ type PluginManagerOptions = {
23
+ getWorkbench: () => Workbench;
24
+ emitter: Emitter<any>;
25
+ pageModel: CPage;
26
+ i18n: CustomI18n;
27
+ assetsPackageListManager: AssetsPackageListManager;
28
+ engine: Engine;
29
+ };
30
+ export type CPluginCtx<C = any> = {
31
+ name?: string;
32
+ globalEmitter: Emitter<any>;
33
+ /** 当前插件外部传入的配置 **/
34
+ config: C;
35
+ pluginManager: PluginManager;
36
+ pluginReadyOk: () => void;
37
+ } & PluginManagerOptions;
38
+ export type PluginInstance<C = any, E = any> = {
39
+ ctx: CPluginCtx<C>;
40
+ export: E;
41
+ source: PluginObj<C, E>;
42
+ ready: boolean;
43
+ };
44
+ export type CustomPluginHook<P extends PluginInstance<any, any> = any> = (pluginInstance: P) => P;
45
+ export declare class PluginManager {
46
+ plugins: Map<string, PluginInstance>;
47
+ emitter: Emitter<any>;
48
+ getWorkbench: () => Workbench;
49
+ pageModel: CPage;
50
+ i18n: CustomI18n;
51
+ assetsPackageListManager: AssetsPackageListManager;
52
+ engine: Engine;
53
+ customPluginHooks: Record<string, CustomPluginHook[]>;
54
+ constructor({ getWorkbench, emitter, pageModel, i18n, assetsPackageListManager, engine }: PluginManagerOptions);
55
+ /** 自定义插件, 可以修改插件的配置 */
56
+ customPlugin: <P extends PluginInstance<any, any>>(pluginName: string, customPluginHook: CustomPluginHook<P>) => void;
57
+ createPluginCtx: () => CPluginCtx<any>;
58
+ add(plugin: CPlugin): Promise<void>;
59
+ get<P extends PluginInstance<any, any>>(pluginName: string): Promise<P | undefined>;
60
+ remove(name: string): Promise<void>;
61
+ onPluginReadyOk(pluginName: string, cb?: (pluginHandle: PluginInstance) => void): Promise<PluginInstance<any, any>>;
62
+ }
63
+ export {};
@@ -0,0 +1,5 @@
1
+ export declare const en_US: {
2
+ translation: {
3
+ 'Welcome to React': string;
4
+ };
5
+ };
@@ -0,0 +1,6 @@
1
+ import i18n from 'i18next';
2
+ export type CustomI18n = typeof i18n & {
3
+ update: () => void;
4
+ };
5
+ declare const customI18n: CustomI18n;
6
+ export default customI18n;
@@ -0,0 +1,5 @@
1
+ export declare const zh_CN: {
2
+ translation: {
3
+ 'Welcome to React': string;
4
+ };
5
+ };
@@ -0,0 +1,57 @@
1
+ import React from 'react';
2
+ import { Workbench } from './component/Workbench';
3
+ import { CPlugin, PluginManager } from './core/pluginManager';
4
+ import { Emitter } from 'mitt';
5
+ import { AssetPackage, CMaterialType, CNode, CPage, CPageDataType, CRootNode } from '@chamn/model';
6
+ import { ComponentsType } from '@chamn/render';
7
+ import { AssetsPackageListManager } from './core/assetPackagesListManage';
8
+ export type EnginContext = {
9
+ pluginManager: PluginManager;
10
+ engine: Engine;
11
+ };
12
+ export type EngineProps = {
13
+ plugins: CPlugin[];
14
+ schema: CPageDataType;
15
+ material?: CMaterialType[];
16
+ components?: Record<string, any>;
17
+ assetPackagesList?: AssetPackage[];
18
+ beforePluginRun?: (options: {
19
+ pluginManager: PluginManager;
20
+ }) => void;
21
+ /** 所有的加插件加载完成 */
22
+ onReady?: (ctx: EnginContext) => void;
23
+ onMount?: (ctx: EnginContext) => void;
24
+ /** 渲染器 umd 格式 js 地址, 默认 ./render.umd.js */
25
+ renderJSUrl?: string;
26
+ style?: React.CSSProperties;
27
+ className?: string;
28
+ };
29
+ export declare class Engine extends React.Component<EngineProps> {
30
+ static version: string;
31
+ currentSelectNode: CNode | CRootNode | null;
32
+ pluginManager: PluginManager;
33
+ workbenchRef: React.RefObject<Workbench>;
34
+ pageSchema: CPageDataType | undefined;
35
+ pageModel: CPage;
36
+ material: CMaterialType[] | undefined;
37
+ emitter: Emitter<any>;
38
+ assetsPackageListManager: AssetsPackageListManager;
39
+ constructor(props: EngineProps);
40
+ updateCurrentSelectNode(node: CNode | CRootNode | null): void;
41
+ componentDidMount(): Promise<void>;
42
+ getActiveNode(): CNode | CRootNode | null;
43
+ updatePage: (page: CPageDataType) => void;
44
+ updateMaterials: (materials: CMaterialType[], assetPackagesList: AssetPackage[], options?: {
45
+ formatComponents?: ((componentMap: ComponentsType) => ComponentsType) | undefined;
46
+ } | undefined) => Promise<void>;
47
+ refresh: () => Promise<void>;
48
+ getWorkbench: () => Workbench | null;
49
+ render(): JSX.Element;
50
+ }
51
+ export * as plugins from './plugins';
52
+ export * from '@chamn/layout';
53
+ export * from './material/innerMaterial';
54
+ export * from './component/CustomSchemaForm/components/Setters/type';
55
+ export * from './utils/index';
56
+ /** 注册自定义 setter */
57
+ export { registerCustomSetter } from './component/CustomSchemaForm/components/Form';