@chamn/engine 0.0.10 → 0.0.12

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 (205) hide show
  1. package/dist/component/CustomSchemaForm/components/Form/context.d.ts +2 -0
  2. package/dist/component/CustomSchemaForm/components/Form/index.d.ts +1 -0
  3. package/dist/component/CustomSchemaForm/components/SetterSwitcher/index.d.ts +2 -0
  4. package/dist/component/CustomSchemaForm/index.d.ts +3 -0
  5. package/dist/component/Workbench/index.d.ts +4 -0
  6. package/dist/core/pluginManager.d.ts +5 -0
  7. package/dist/index.d.ts +1 -0
  8. package/dist/index.js +197 -0
  9. package/dist/index.js.map +1 -0
  10. package/dist/{index.es.js → index.mjs} +3849 -3814
  11. package/dist/index.mjs.map +1 -0
  12. package/dist/material/innerMaterial.d.ts +1 -1
  13. package/dist/plugins/RightPanel/view.d.ts +4 -0
  14. package/package.json +12 -9
  15. package/.eslintignore +0 -1
  16. package/.eslintrc.js +0 -36
  17. package/.prettierrc.json +0 -7
  18. package/.storybook/main.js +0 -24
  19. package/.storybook/preview.js +0 -9
  20. package/CHANGELOG.md +0 -54
  21. package/__tests__/demo.test.ts +0 -3
  22. package/build.config.js +0 -88
  23. package/dist/index.cjs.js +0 -197
  24. package/dist/index.cjs.js.map +0 -1
  25. package/dist/index.es.js.map +0 -1
  26. package/index.html +0 -16
  27. package/jest.config.js +0 -196
  28. package/public/Engine.module.scss.d.ts +0 -5
  29. package/public/_dev_/render.d.ts +0 -2
  30. package/public/component/CSSEditor/style.module.scss.d.ts +0 -6
  31. package/public/component/CSSPropertiesEditor/style.module.scss.d.ts +0 -15
  32. package/public/component/CSSPropertiesVariableBindEditor/style.module.scss.d.ts +0 -15
  33. package/public/component/CustomSchemaForm/components/Form/Field/style.module.scss.d.ts +0 -8
  34. package/public/component/CustomSchemaForm/components/SetterSwitcher/style.module.scss.d.ts +0 -7
  35. package/public/component/CustomSchemaForm/components/Setters/ArraySetter/style.module.scss.d.ts +0 -7
  36. package/public/component/CustomSchemaForm/components/Setters/CSSValueSetter/style.module.scss.d.ts +0 -6
  37. package/public/component/CustomSchemaForm/style.module.scss.d.ts +0 -11
  38. package/public/component/Workbench/style.module.scss.d.ts +0 -25
  39. package/public/plugins/AdvancePanel/style.module.scss.d.ts +0 -7
  40. package/public/plugins/ComponentLibrary/components/DragItem/style.module.scss.d.ts +0 -9
  41. package/public/plugins/ComponentLibrary/components/ListView/style.module.scss.d.ts +0 -12
  42. package/public/plugins/ComponentLibrary/style.module.scss.d.ts +0 -11
  43. package/public/plugins/Designer/components/DefaultSelectToolBar/style.module.scss.d.ts +0 -11
  44. package/public/plugins/Designer/style.module.scss.d.ts +0 -5
  45. package/public/plugins/GlobalStatePanel/style.module.scss.d.ts +0 -5
  46. package/public/plugins/OutlineTree/components/TreeView/style.module.scss.d.ts +0 -16
  47. package/public/plugins/PropertyPanel/style.module.scss.d.ts +0 -10
  48. package/public/plugins/RightPanel/style.module.scss.d.ts +0 -10
  49. package/public/plugins/VisualPanelPlus/style.module.scss.d.ts +0 -10
  50. package/public/render.umd.js +0 -42
  51. package/public/render.umd.js.map +0 -1
  52. package/src/Engine.module.scss +0 -10
  53. package/src/Engine.module.scss.d.ts +0 -5
  54. package/src/_dev_/index.css +0 -22
  55. package/src/_dev_/index.tsx +0 -5
  56. package/src/_dev_/page/Editor/index.tsx +0 -198
  57. package/src/_dev_/page/Editor/indexCustom.tsx +0 -274
  58. package/src/_dev_/page/Preview/index.tsx +0 -56
  59. package/src/_dev_/render.ts +0 -3
  60. package/src/_dev_/router.tsx +0 -14
  61. package/src/assets/react.svg +0 -4
  62. package/src/assets/styles/mixin.scss +0 -15
  63. package/src/component/CSSEditor/index.tsx +0 -247
  64. package/src/component/CSSEditor/style.module.scss +0 -22
  65. package/src/component/CSSEditor/style.module.scss.d.ts +0 -6
  66. package/src/component/CSSPropertiesEditor/cssProperties.ts +0 -1062
  67. package/src/component/CSSPropertiesEditor/index.tsx +0 -389
  68. package/src/component/CSSPropertiesEditor/style.module.scss +0 -46
  69. package/src/component/CSSPropertiesEditor/style.module.scss.d.ts +0 -15
  70. package/src/component/CSSPropertiesEditor/util.ts +0 -19
  71. package/src/component/CSSPropertiesVariableBindEditor/cssProperties.ts +0 -782
  72. package/src/component/CSSPropertiesVariableBindEditor/index.tsx +0 -366
  73. package/src/component/CSSPropertiesVariableBindEditor/style.module.scss +0 -48
  74. package/src/component/CSSPropertiesVariableBindEditor/style.module.scss.d.ts +0 -15
  75. package/src/component/CSSPropertiesVariableBindEditor/util.ts +0 -19
  76. package/src/component/ClassNameEditor/index.tsx +0 -91
  77. package/src/component/ClassNameEditor/style.module.scss +0 -0
  78. package/src/component/CustomSchemaForm/components/Form/Field/index.tsx +0 -81
  79. package/src/component/CustomSchemaForm/components/Form/Field/style.module.scss +0 -32
  80. package/src/component/CustomSchemaForm/components/Form/Field/style.module.scss.d.ts +0 -8
  81. package/src/component/CustomSchemaForm/components/Form/context.ts +0 -23
  82. package/src/component/CustomSchemaForm/components/Form/index.tsx +0 -71
  83. package/src/component/CustomSchemaForm/components/SetterSwitcher/index.tsx +0 -273
  84. package/src/component/CustomSchemaForm/components/SetterSwitcher/style.module.scss +0 -16
  85. package/src/component/CustomSchemaForm/components/SetterSwitcher/style.module.scss.d.ts +0 -7
  86. package/src/component/CustomSchemaForm/components/Setters/ArraySetter/ArrayItem.tsx +0 -55
  87. package/src/component/CustomSchemaForm/components/Setters/ArraySetter/SortItemOrderModal.tsx +0 -160
  88. package/src/component/CustomSchemaForm/components/Setters/ArraySetter/index.tsx +0 -129
  89. package/src/component/CustomSchemaForm/components/Setters/ArraySetter/style.module.scss +0 -22
  90. package/src/component/CustomSchemaForm/components/Setters/ArraySetter/style.module.scss.d.ts +0 -7
  91. package/src/component/CustomSchemaForm/components/Setters/BooleanSetter/index.tsx +0 -32
  92. package/src/component/CustomSchemaForm/components/Setters/CSSValueSetter/index.tsx +0 -78
  93. package/src/component/CustomSchemaForm/components/Setters/CSSValueSetter/style.module.scss +0 -7
  94. package/src/component/CustomSchemaForm/components/Setters/CSSValueSetter/style.module.scss.d.ts +0 -6
  95. package/src/component/CustomSchemaForm/components/Setters/ExpressionSetter/index.tsx +0 -47
  96. package/src/component/CustomSchemaForm/components/Setters/FunctionSetter/defaultDts.ts +0 -28
  97. package/src/component/CustomSchemaForm/components/Setters/FunctionSetter/index.tsx +0 -93
  98. package/src/component/CustomSchemaForm/components/Setters/JSONSetter/index.tsx +0 -80
  99. package/src/component/CustomSchemaForm/components/Setters/NumberSetter/index.tsx +0 -34
  100. package/src/component/CustomSchemaForm/components/Setters/SelectSetter/index.tsx +0 -35
  101. package/src/component/CustomSchemaForm/components/Setters/ShapeSetter/index.tsx +0 -65
  102. package/src/component/CustomSchemaForm/components/Setters/StringSetter/index.tsx +0 -30
  103. package/src/component/CustomSchemaForm/components/Setters/TextAreaSetter/index.tsx +0 -31
  104. package/src/component/CustomSchemaForm/components/Setters/index.ts +0 -26
  105. package/src/component/CustomSchemaForm/components/Setters/type.ts +0 -18
  106. package/src/component/CustomSchemaForm/context.ts +0 -20
  107. package/src/component/CustomSchemaForm/index.tsx +0 -93
  108. package/src/component/CustomSchemaForm/style.module.scss +0 -15
  109. package/src/component/CustomSchemaForm/style.module.scss.d.ts +0 -11
  110. package/src/component/CustomSchemaForm/utils.ts +0 -13
  111. package/src/component/MonacoEditor/index.tsx +0 -81
  112. package/src/component/Workbench/index.tsx +0 -329
  113. package/src/component/Workbench/style.module.scss +0 -159
  114. package/src/component/Workbench/style.module.scss.d.ts +0 -25
  115. package/src/core/pluginManager.ts +0 -151
  116. package/src/i18n/en_US/index.ts +0 -5
  117. package/src/i18n/index.ts +0 -39
  118. package/src/i18n/zh_CN/index.ts +0 -5
  119. package/src/index.tsx +0 -150
  120. package/src/material/innerMaterial.ts +0 -343
  121. package/src/plugins/AdvancePanel/index.tsx +0 -191
  122. package/src/plugins/AdvancePanel/style.module.scss +0 -8
  123. package/src/plugins/AdvancePanel/style.module.scss.d.ts +0 -7
  124. package/src/plugins/ComponentLibrary/components/DragItem/index.tsx +0 -65
  125. package/src/plugins/ComponentLibrary/components/DragItem/style.module.scss +0 -58
  126. package/src/plugins/ComponentLibrary/components/DragItem/style.module.scss.d.ts +0 -9
  127. package/src/plugins/ComponentLibrary/components/ListView/index.tsx +0 -50
  128. package/src/plugins/ComponentLibrary/components/ListView/style.module.scss +0 -27
  129. package/src/plugins/ComponentLibrary/components/ListView/style.module.scss.d.ts +0 -12
  130. package/src/plugins/ComponentLibrary/index.tsx +0 -184
  131. package/src/plugins/ComponentLibrary/localize/en_US/index.ts +0 -3
  132. package/src/plugins/ComponentLibrary/localize/index.ts +0 -3
  133. package/src/plugins/ComponentLibrary/localize/zh_CN/index.ts +0 -3
  134. package/src/plugins/ComponentLibrary/style.module.scss +0 -31
  135. package/src/plugins/ComponentLibrary/style.module.scss.d.ts +0 -11
  136. package/src/plugins/ComponentLibrary/util.ts +0 -14
  137. package/src/plugins/ComponentStatePanel/index.tsx +0 -59
  138. package/src/plugins/Designer/components/DefaultSelectToolBar/index.tsx +0 -94
  139. package/src/plugins/Designer/components/DefaultSelectToolBar/style.module.scss +0 -59
  140. package/src/plugins/Designer/components/DefaultSelectToolBar/style.module.scss.d.ts +0 -11
  141. package/src/plugins/Designer/components/GhostView/index.tsx +0 -18
  142. package/src/plugins/Designer/config.ts +0 -1
  143. package/src/plugins/Designer/index.tsx +0 -61
  144. package/src/plugins/Designer/localize/en_US/index.ts +0 -3
  145. package/src/plugins/Designer/localize/index.ts +0 -3
  146. package/src/plugins/Designer/localize/zh_CN/index.ts +0 -3
  147. package/src/plugins/Designer/style.module.scss +0 -10
  148. package/src/plugins/Designer/style.module.scss.d.ts +0 -5
  149. package/src/plugins/Designer/util.ts +0 -18
  150. package/src/plugins/Designer/view.tsx +0 -225
  151. package/src/plugins/DisplaySourceSchema/index.tsx +0 -76
  152. package/src/plugins/GlobalStatePanel/index.tsx +0 -96
  153. package/src/plugins/GlobalStatePanel/localize/en_US/index.ts +0 -3
  154. package/src/plugins/GlobalStatePanel/localize/index.ts +0 -3
  155. package/src/plugins/GlobalStatePanel/localize/zh_CN/index.ts +0 -3
  156. package/src/plugins/GlobalStatePanel/style.module.scss +0 -8
  157. package/src/plugins/GlobalStatePanel/style.module.scss.d.ts +0 -5
  158. package/src/plugins/History/index.tsx +0 -110
  159. package/src/plugins/OutlineTree/components/TreeView/context.ts +0 -43
  160. package/src/plugins/OutlineTree/components/TreeView/dataStruct.ts +0 -58
  161. package/src/plugins/OutlineTree/components/TreeView/index.tsx +0 -376
  162. package/src/plugins/OutlineTree/components/TreeView/style.module.scss +0 -93
  163. package/src/plugins/OutlineTree/components/TreeView/style.module.scss.d.ts +0 -16
  164. package/src/plugins/OutlineTree/components/TreeView/treeNode.tsx +0 -271
  165. package/src/plugins/OutlineTree/index.tsx +0 -39
  166. package/src/plugins/OutlineTree/localize/en_US/index.ts +0 -3
  167. package/src/plugins/OutlineTree/localize/index.ts +0 -3
  168. package/src/plugins/OutlineTree/localize/zh_CN/index.ts +0 -3
  169. package/src/plugins/OutlineTree/util.tsx +0 -302
  170. package/src/plugins/PropertyPanel/index.tsx +0 -63
  171. package/src/plugins/PropertyPanel/style.module.scss +0 -12
  172. package/src/plugins/PropertyPanel/style.module.scss.d.ts +0 -10
  173. package/src/plugins/PropertyPanel/utils.ts +0 -13
  174. package/src/plugins/RightPanel/index.tsx +0 -30
  175. package/src/plugins/RightPanel/style.module.scss +0 -16
  176. package/src/plugins/RightPanel/style.module.scss.d.ts +0 -10
  177. package/src/plugins/RightPanel/view.tsx +0 -177
  178. package/src/plugins/VisualPanel/index.tsx +0 -185
  179. package/src/plugins/VisualPanel/style.module.scss +0 -17
  180. package/src/plugins/VisualPanelPlus/index.tsx +0 -103
  181. package/src/plugins/VisualPanelPlus/style.module.scss +0 -20
  182. package/src/plugins/VisualPanelPlus/style.module.scss.d.ts +0 -10
  183. package/src/plugins/index.tsx +0 -26
  184. package/src/stories/Button.jsx +0 -50
  185. package/src/stories/Button.stories.jsx +0 -40
  186. package/src/stories/Introduction.stories.mdx +0 -194
  187. package/src/stories/assets/code-brackets.svg +0 -1
  188. package/src/stories/assets/colors.svg +0 -1
  189. package/src/stories/assets/comments.svg +0 -1
  190. package/src/stories/assets/direction.svg +0 -1
  191. package/src/stories/assets/flow.svg +0 -1
  192. package/src/stories/assets/plugin.svg +0 -1
  193. package/src/stories/assets/repo.svg +0 -1
  194. package/src/stories/assets/stackalt.svg +0 -1
  195. package/src/stories/button.css +0 -30
  196. package/src/stories/plugins/CSSEditor.stories.tsx +0 -75
  197. package/src/stories/plugins/VisualPanelPlus.stories.tsx +0 -74
  198. package/src/style.d.ts +0 -2
  199. package/src/typing.d.ts +0 -9
  200. package/src/utils/css.ts +0 -88
  201. package/src/utils/defaultEngineConfig.tsx +0 -55
  202. package/src/utils/index.ts +0 -12
  203. package/src/utils/logger.ts +0 -4
  204. package/src/vite-env.d.ts +0 -1
  205. package/tsconfig.json +0 -32
@@ -1,9 +1,11 @@
1
1
  import React from 'react';
2
+ import { CSetter } from '../Setters/type';
2
3
  export type ContextState = Record<string, any>;
3
4
  export type CFormContextData = {
4
5
  formName: string;
5
6
  formState: ContextState;
6
7
  conditionConfig: Record<string, (state: ContextState) => boolean>;
8
+ customSetterMap?: Record<string, CSetter>;
7
9
  updateContext: (newState: ContextState) => void;
8
10
  updateConditionConfig: (name: string, cb: (state: ContextState) => boolean) => void;
9
11
  };
@@ -5,6 +5,7 @@ export type CFormProps = {
5
5
  name: string;
6
6
  children?: ReactNode | ReactNode[];
7
7
  initialValue?: Record<string, any>;
8
+ customSetterMap: CFormContextData['customSetterMap'];
8
9
  onValueChange?: (formData: Record<string, any>) => void;
9
10
  };
10
11
  export declare class CForm extends React.Component<CFormProps, CFormContextData> {
@@ -1,8 +1,10 @@
1
1
  import React from 'react';
2
2
  import { SetterObjType } from '@chamn/model';
3
3
  import { CFieldProps } from '../Form/Field';
4
+ import { CSetter } from '../Setters/type';
4
5
  export type SetterSwitcherProps = {
5
6
  setters: SetterObjType[];
7
+ customSetterMap?: Record<string, CSetter>;
6
8
  keyPaths: string[];
7
9
  prefix?: React.ReactNode;
8
10
  suffix?: React.ReactNode;
@@ -2,6 +2,7 @@ import React from 'react';
2
2
  import { CMaterialPropsType } from '@chamn/model';
3
3
  import { CForm } from './components/Form';
4
4
  import { CPluginCtx } from '../../core/pluginManager';
5
+ import { CFormContextData } from './components/Form/context';
5
6
  export type CustomSchemaFormInstance = CForm;
6
7
  export type CustomSchemaFormProps = {
7
8
  pluginCtx?: CPluginCtx;
@@ -9,9 +10,11 @@ export type CustomSchemaFormProps = {
9
10
  properties: CMaterialPropsType<any>;
10
11
  onValueChange?: (val: any) => void;
11
12
  onSetterChange: (keyPaths: string[], setterName: string) => void;
13
+ /** 存储每个字段上次使用的 setter */
12
14
  defaultSetterConfig: Record<string, {
13
15
  name: string;
14
16
  setter: string;
15
17
  }>;
18
+ customSetterMap?: CFormContextData['customSetterMap'];
16
19
  };
17
20
  export declare const CustomSchemaForm: React.ForwardRefExoticComponent<CustomSchemaFormProps & React.RefAttributes<CForm>>;
@@ -30,6 +30,7 @@ type WorkbenchStateType = {
30
30
  bodyView: React.ReactNode | null;
31
31
  rightView: React.ReactNode | null;
32
32
  topToolBarView: React.ReactNode | null;
33
+ subTopToolBarView: React.ReactNode | null;
33
34
  };
34
35
  export type WorkbenchPropsType = {
35
36
  emitter: Emitter<any>;
@@ -39,6 +40,8 @@ export declare class Workbench extends React.Component<WorkbenchPropsType, Workb
39
40
  leftPanelContentRef: React.RefObject<HTMLDivElement>;
40
41
  constructor(props: WorkbenchPropsType);
41
42
  addLeftPanel: (panel: PanelItem) => void;
43
+ /** 替换对应的 panel */
44
+ replaceLeftPanel: (panelName: string, newPanel: PanelItem) => void;
42
45
  openLeftPanel: (currentActiveLeftPanel?: string) => Promise<void>;
43
46
  closeLeftPanel: () => Promise<void>;
44
47
  toggleLeftPanel: () => void;
@@ -48,6 +51,7 @@ export declare class Workbench extends React.Component<WorkbenchPropsType, Workb
48
51
  replaceBodyView: (newView: React.ReactNode) => void;
49
52
  replaceRightView: (newView: React.ReactNode) => void;
50
53
  replaceTopBarView: (newView: React.ReactNode) => void;
54
+ replaceSubTopBarView: (newView: React.ReactNode) => void;
51
55
  toggleRightPanel: () => void;
52
56
  onLeftBoxResizeStop: ResizeCallback;
53
57
  onGlobalClick: (e: MouseEvent) => void;
@@ -7,6 +7,9 @@ export type PluginObj = {
7
7
  name: string;
8
8
  init: (ctx: CPluginCtx) => Promise<void>;
9
9
  destroy: (ctx: CPluginCtx) => Promise<void>;
10
+ /** 用于暴露给外部重载插件 */
11
+ reload?: (ctx: CPluginCtx) => Promise<void>;
12
+ /** 插件暴露给外部可以调用的方法 */
10
13
  exports: (ctx: CPluginCtx) => any;
11
14
  meta: {
12
15
  engine: {
@@ -25,6 +28,7 @@ type PluginManagerOptions = {
25
28
  };
26
29
  export type CPluginCtx<C = any> = {
27
30
  globalEmitter: Emitter<any>;
31
+ /** 当前插件外部传入的配置 **/
28
32
  config: C;
29
33
  pluginManager: PluginManager;
30
34
  pluginReadyOk: () => void;
@@ -46,6 +50,7 @@ export declare class PluginManager {
46
50
  engine: Engine;
47
51
  customPluginHooks: Record<string, CustomPluginHook[]>;
48
52
  constructor({ getWorkbench, emitter, pageModel, i18n, assets, engine }: PluginManagerOptions);
53
+ /** 自定义插件, 可以修改插件的配置 */
49
54
  customPlugin: (pluginName: string, customPluginHook: CustomPluginHook) => void;
50
55
  createPluginCtx: () => CPluginCtx<any>;
51
56
  add(plugin: CPlugin): Promise<void>;
package/dist/index.d.ts CHANGED
@@ -41,3 +41,4 @@ export declare class Engine extends React.Component<EngineProps> {
41
41
  export * as plugins from './plugins';
42
42
  export * from '@chamn/layout';
43
43
  export * from './material/innerMaterial';
44
+ export * from './component/CustomSchemaForm/components/Setters/type';