@chamn/engine 0.0.9 → 0.0.11

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 (277) hide show
  1. package/dist/component/CSSEditor/index.d.ts +16 -0
  2. package/dist/component/CSSPropertiesEditor/cssProperties.d.ts +898 -0
  3. package/dist/component/CSSPropertiesEditor/index.d.ts +43 -0
  4. package/dist/component/CSSPropertiesEditor/util.d.ts +1 -0
  5. package/dist/component/CSSPropertiesVariableBindEditor/cssProperties.d.ts +898 -0
  6. package/dist/component/CSSPropertiesVariableBindEditor/index.d.ts +37 -0
  7. package/dist/component/CSSPropertiesVariableBindEditor/util.d.ts +1 -0
  8. package/dist/component/ClassNameEditor/index.d.ts +16 -0
  9. package/dist/component/CustomSchemaForm/components/Form/Field/index.d.ts +11 -0
  10. package/dist/component/CustomSchemaForm/components/Form/context.d.ts +12 -0
  11. package/dist/component/CustomSchemaForm/components/Form/index.d.ts +18 -0
  12. package/dist/component/CustomSchemaForm/components/SetterSwitcher/index.d.ts +14 -0
  13. package/dist/component/CustomSchemaForm/components/Setters/ArraySetter/ArrayItem.d.ts +11 -0
  14. package/dist/component/CustomSchemaForm/components/Setters/ArraySetter/SortItemOrderModal.d.ts +10 -0
  15. package/dist/component/CustomSchemaForm/components/Setters/ArraySetter/index.d.ts +14 -0
  16. package/dist/component/CustomSchemaForm/components/Setters/BooleanSetter/index.d.ts +5 -0
  17. package/dist/component/CustomSchemaForm/components/Setters/CSSValueSetter/index.d.ts +6 -0
  18. package/dist/component/CustomSchemaForm/components/Setters/ExpressionSetter/index.d.ts +8 -0
  19. package/dist/component/CustomSchemaForm/components/Setters/FunctionSetter/defaultDts.d.ts +1 -0
  20. package/dist/component/CustomSchemaForm/components/Setters/FunctionSetter/index.d.ts +2 -0
  21. package/dist/component/CustomSchemaForm/components/Setters/JSONSetter/index.d.ts +2 -0
  22. package/dist/component/CustomSchemaForm/components/Setters/NumberSetter/index.d.ts +3 -0
  23. package/dist/component/CustomSchemaForm/components/Setters/SelectSetter/index.d.ts +3 -0
  24. package/dist/component/CustomSchemaForm/components/Setters/ShapeSetter/index.d.ts +8 -0
  25. package/dist/component/CustomSchemaForm/components/Setters/StringSetter/index.d.ts +3 -0
  26. package/dist/component/CustomSchemaForm/components/Setters/TextAreaSetter/index.d.ts +3 -0
  27. package/dist/component/CustomSchemaForm/components/Setters/index.d.ts +3 -0
  28. package/dist/component/CustomSchemaForm/components/Setters/type.d.ts +19 -0
  29. package/dist/component/CustomSchemaForm/context.d.ts +15 -0
  30. package/dist/component/CustomSchemaForm/index.d.ts +20 -0
  31. package/dist/component/CustomSchemaForm/utils.d.ts +2 -0
  32. package/dist/component/MonacoEditor/index.d.ts +15 -0
  33. package/dist/component/Workbench/index.d.ts +61 -0
  34. package/dist/core/pluginManager.d.ts +61 -0
  35. package/dist/i18n/en_US/index.d.ts +5 -0
  36. package/dist/i18n/index.d.ts +6 -0
  37. package/dist/i18n/zh_CN/index.d.ts +5 -0
  38. package/dist/index.d.ts +44 -0
  39. package/dist/index.js +197 -0
  40. package/dist/index.js.map +1 -0
  41. package/dist/{index.es.js → index.mjs} +6867 -6541
  42. package/dist/index.mjs.map +1 -0
  43. package/dist/material/innerMaterial.d.ts +2 -0
  44. package/dist/plugins/AdvancePanel/index.d.ts +10 -0
  45. package/dist/plugins/ComponentLibrary/components/DragItem/index.d.ts +12 -0
  46. package/dist/plugins/ComponentLibrary/components/ListView/index.d.ts +9 -0
  47. package/dist/plugins/ComponentLibrary/index.d.ts +3 -0
  48. package/dist/plugins/ComponentLibrary/localize/en_US/index.d.ts +1 -0
  49. package/dist/plugins/ComponentLibrary/localize/index.d.ts +2 -0
  50. package/dist/plugins/ComponentLibrary/localize/zh_CN/index.d.ts +1 -0
  51. package/dist/plugins/ComponentLibrary/util.d.ts +1 -0
  52. package/dist/plugins/ComponentStatePanel/index.d.ts +10 -0
  53. package/dist/plugins/Designer/components/DefaultSelectToolBar/index.d.ts +10 -0
  54. package/dist/plugins/Designer/components/GhostView/index.d.ts +5 -0
  55. package/dist/plugins/Designer/config.d.ts +1 -0
  56. package/dist/plugins/Designer/index.d.ts +15 -0
  57. package/dist/plugins/Designer/localize/en_US/index.d.ts +1 -0
  58. package/dist/plugins/Designer/localize/index.d.ts +2 -0
  59. package/dist/plugins/Designer/localize/zh_CN/index.d.ts +1 -0
  60. package/dist/plugins/Designer/util.d.ts +2 -0
  61. package/dist/plugins/Designer/view.d.ts +30 -0
  62. package/dist/plugins/DisplaySourceSchema/index.d.ts +9 -0
  63. package/dist/plugins/GlobalStatePanel/index.d.ts +3 -0
  64. package/dist/plugins/GlobalStatePanel/localize/en_US/index.d.ts +1 -0
  65. package/dist/plugins/GlobalStatePanel/localize/index.d.ts +2 -0
  66. package/dist/plugins/GlobalStatePanel/localize/zh_CN/index.d.ts +1 -0
  67. package/dist/plugins/History/index.d.ts +2 -0
  68. package/dist/plugins/OutlineTree/components/TreeView/context.d.ts +30 -0
  69. package/dist/plugins/OutlineTree/components/TreeView/dataStruct.d.ts +21 -0
  70. package/dist/plugins/OutlineTree/components/TreeView/index.d.ts +34 -0
  71. package/dist/plugins/OutlineTree/components/TreeView/treeNode.d.ts +9 -0
  72. package/dist/plugins/OutlineTree/index.d.ts +3 -0
  73. package/dist/plugins/OutlineTree/localize/en_US/index.d.ts +1 -0
  74. package/dist/plugins/OutlineTree/localize/index.d.ts +2 -0
  75. package/dist/plugins/OutlineTree/localize/zh_CN/index.d.ts +1 -0
  76. package/dist/plugins/OutlineTree/util.d.ts +15 -0
  77. package/dist/plugins/PropertyPanel/index.d.ts +9 -0
  78. package/dist/plugins/RightPanel/index.d.ts +2 -0
  79. package/dist/plugins/RightPanel/view.d.ts +38 -0
  80. package/dist/plugins/VisualPanelPlus/index.d.ts +9 -0
  81. package/dist/plugins/index.d.ts +9 -0
  82. package/dist/utils/css.d.ts +19 -0
  83. package/dist/utils/defaultEngineConfig.d.ts +5 -0
  84. package/dist/utils/index.d.ts +6 -0
  85. package/dist/utils/logger.d.ts +1 -0
  86. package/package.json +12 -9
  87. package/.eslintignore +0 -1
  88. package/.eslintrc.js +0 -36
  89. package/.prettierrc.json +0 -7
  90. package/.storybook/main.js +0 -24
  91. package/.storybook/preview.js +0 -9
  92. package/CHANGELOG.md +0 -50
  93. package/__tests__/demo.test.ts +0 -3
  94. package/build.config.js +0 -88
  95. package/dist/index.cjs.js +0 -197
  96. package/dist/index.cjs.js.map +0 -1
  97. package/dist/index.es.js.map +0 -1
  98. package/index.html +0 -16
  99. package/jest.config.js +0 -196
  100. package/public/_dev_/render.d.ts +0 -2
  101. package/public/render.umd.js +0 -42
  102. package/public/render.umd.js.map +0 -1
  103. package/src/Engine.module.scss +0 -10
  104. package/src/Engine.module.scss.d.ts +0 -5
  105. package/src/_dev_/index.css +0 -22
  106. package/src/_dev_/index.tsx +0 -5
  107. package/src/_dev_/page/Editor/index.tsx +0 -198
  108. package/src/_dev_/page/Editor/indexCustom.tsx +0 -274
  109. package/src/_dev_/page/Preview/index.tsx +0 -56
  110. package/src/_dev_/render.ts +0 -3
  111. package/src/_dev_/router.tsx +0 -14
  112. package/src/assets/react.svg +0 -4
  113. package/src/assets/styles/mixin.scss +0 -15
  114. package/src/component/CSSEditor/index.tsx +0 -247
  115. package/src/component/CSSEditor/style.module.scss +0 -22
  116. package/src/component/CSSEditor/style.module.scss.d.ts +0 -6
  117. package/src/component/CSSPropertiesEditor/cssProperties.ts +0 -1062
  118. package/src/component/CSSPropertiesEditor/index.tsx +0 -389
  119. package/src/component/CSSPropertiesEditor/style.module.scss +0 -46
  120. package/src/component/CSSPropertiesEditor/style.module.scss.d.ts +0 -15
  121. package/src/component/CSSPropertiesEditor/util.ts +0 -19
  122. package/src/component/CSSPropertiesVariableBindEditor/cssProperties.ts +0 -782
  123. package/src/component/CSSPropertiesVariableBindEditor/index.tsx +0 -366
  124. package/src/component/CSSPropertiesVariableBindEditor/style.module.scss +0 -48
  125. package/src/component/CSSPropertiesVariableBindEditor/style.module.scss.d.ts +0 -15
  126. package/src/component/CSSPropertiesVariableBindEditor/util.ts +0 -19
  127. package/src/component/ClassNameEditor/index.tsx +0 -91
  128. package/src/component/ClassNameEditor/style.module.scss +0 -0
  129. package/src/component/CustomSchemaForm/components/Form/Field/index.tsx +0 -81
  130. package/src/component/CustomSchemaForm/components/Form/Field/style.module.scss +0 -32
  131. package/src/component/CustomSchemaForm/components/Form/Field/style.module.scss.d.ts +0 -8
  132. package/src/component/CustomSchemaForm/components/Form/context.ts +0 -23
  133. package/src/component/CustomSchemaForm/components/Form/index.tsx +0 -71
  134. package/src/component/CustomSchemaForm/components/SetterSwitcher/index.tsx +0 -273
  135. package/src/component/CustomSchemaForm/components/SetterSwitcher/style.module.scss +0 -16
  136. package/src/component/CustomSchemaForm/components/SetterSwitcher/style.module.scss.d.ts +0 -7
  137. package/src/component/CustomSchemaForm/components/Setters/ArraySetter/ArrayItem.tsx +0 -55
  138. package/src/component/CustomSchemaForm/components/Setters/ArraySetter/SortItemOrderModal.tsx +0 -160
  139. package/src/component/CustomSchemaForm/components/Setters/ArraySetter/index.tsx +0 -129
  140. package/src/component/CustomSchemaForm/components/Setters/ArraySetter/style.module.scss +0 -22
  141. package/src/component/CustomSchemaForm/components/Setters/ArraySetter/style.module.scss.d.ts +0 -7
  142. package/src/component/CustomSchemaForm/components/Setters/BooleanSetter/index.tsx +0 -32
  143. package/src/component/CustomSchemaForm/components/Setters/CSSValueSetter/index.tsx +0 -78
  144. package/src/component/CustomSchemaForm/components/Setters/CSSValueSetter/style.module.scss +0 -7
  145. package/src/component/CustomSchemaForm/components/Setters/CSSValueSetter/style.module.scss.d.ts +0 -6
  146. package/src/component/CustomSchemaForm/components/Setters/ExpressionSetter/index.tsx +0 -47
  147. package/src/component/CustomSchemaForm/components/Setters/FunctionSetter/defaultDts.ts +0 -28
  148. package/src/component/CustomSchemaForm/components/Setters/FunctionSetter/index.tsx +0 -93
  149. package/src/component/CustomSchemaForm/components/Setters/JSONSetter/index.tsx +0 -80
  150. package/src/component/CustomSchemaForm/components/Setters/NumberSetter/index.tsx +0 -34
  151. package/src/component/CustomSchemaForm/components/Setters/SelectSetter/index.tsx +0 -35
  152. package/src/component/CustomSchemaForm/components/Setters/ShapeSetter/index.tsx +0 -65
  153. package/src/component/CustomSchemaForm/components/Setters/StringSetter/index.tsx +0 -30
  154. package/src/component/CustomSchemaForm/components/Setters/TextAreaSetter/index.tsx +0 -31
  155. package/src/component/CustomSchemaForm/components/Setters/index.ts +0 -26
  156. package/src/component/CustomSchemaForm/components/Setters/type.ts +0 -18
  157. package/src/component/CustomSchemaForm/context.ts +0 -20
  158. package/src/component/CustomSchemaForm/index.tsx +0 -93
  159. package/src/component/CustomSchemaForm/style.module.scss +0 -15
  160. package/src/component/CustomSchemaForm/style.module.scss.d.ts +0 -11
  161. package/src/component/CustomSchemaForm/utils.ts +0 -13
  162. package/src/component/MonacoEditor/index.tsx +0 -81
  163. package/src/component/Workbench/index.tsx +0 -329
  164. package/src/component/Workbench/style.module.scss +0 -159
  165. package/src/component/Workbench/style.module.scss.d.ts +0 -25
  166. package/src/core/pluginManager.ts +0 -151
  167. package/src/i18n/en_US/index.ts +0 -5
  168. package/src/i18n/index.ts +0 -39
  169. package/src/i18n/zh_CN/index.ts +0 -5
  170. package/src/index.tsx +0 -150
  171. package/src/material/innerMaterial.ts +0 -343
  172. package/src/plugins/AdvancePanel/index.tsx +0 -191
  173. package/src/plugins/AdvancePanel/style.module.scss +0 -8
  174. package/src/plugins/AdvancePanel/style.module.scss.d.ts +0 -7
  175. package/src/plugins/ComponentLibrary/components/DragItem/index.tsx +0 -65
  176. package/src/plugins/ComponentLibrary/components/DragItem/style.module.scss +0 -58
  177. package/src/plugins/ComponentLibrary/components/DragItem/style.module.scss.d.ts +0 -9
  178. package/src/plugins/ComponentLibrary/components/ListView/index.tsx +0 -50
  179. package/src/plugins/ComponentLibrary/components/ListView/style.module.scss +0 -27
  180. package/src/plugins/ComponentLibrary/components/ListView/style.module.scss.d.ts +0 -12
  181. package/src/plugins/ComponentLibrary/index.tsx +0 -184
  182. package/src/plugins/ComponentLibrary/localize/en_US/index.ts +0 -3
  183. package/src/plugins/ComponentLibrary/localize/index.ts +0 -3
  184. package/src/plugins/ComponentLibrary/localize/zh_CN/index.ts +0 -3
  185. package/src/plugins/ComponentLibrary/style.module.scss +0 -31
  186. package/src/plugins/ComponentLibrary/style.module.scss.d.ts +0 -11
  187. package/src/plugins/ComponentLibrary/util.ts +0 -14
  188. package/src/plugins/ComponentStatePanel/index.tsx +0 -59
  189. package/src/plugins/Designer/components/DefaultSelectToolBar/index.tsx +0 -94
  190. package/src/plugins/Designer/components/DefaultSelectToolBar/style.module.scss +0 -59
  191. package/src/plugins/Designer/components/DefaultSelectToolBar/style.module.scss.d.ts +0 -11
  192. package/src/plugins/Designer/components/GhostView/index.tsx +0 -18
  193. package/src/plugins/Designer/config.ts +0 -1
  194. package/src/plugins/Designer/index.tsx +0 -61
  195. package/src/plugins/Designer/localize/en_US/index.ts +0 -3
  196. package/src/plugins/Designer/localize/index.ts +0 -3
  197. package/src/plugins/Designer/localize/zh_CN/index.ts +0 -3
  198. package/src/plugins/Designer/style.module.scss +0 -10
  199. package/src/plugins/Designer/style.module.scss.d.ts +0 -5
  200. package/src/plugins/Designer/util.ts +0 -18
  201. package/src/plugins/Designer/view.tsx +0 -225
  202. package/src/plugins/DisplaySourceSchema/index.tsx +0 -76
  203. package/src/plugins/GlobalStatePanel/index.tsx +0 -96
  204. package/src/plugins/GlobalStatePanel/localize/en_US/index.ts +0 -3
  205. package/src/plugins/GlobalStatePanel/localize/index.ts +0 -3
  206. package/src/plugins/GlobalStatePanel/localize/zh_CN/index.ts +0 -3
  207. package/src/plugins/GlobalStatePanel/style.module.scss +0 -8
  208. package/src/plugins/GlobalStatePanel/style.module.scss.d.ts +0 -5
  209. package/src/plugins/History/index.tsx +0 -110
  210. package/src/plugins/OutlineTree/components/TreeView/context.ts +0 -43
  211. package/src/plugins/OutlineTree/components/TreeView/dataStruct.ts +0 -58
  212. package/src/plugins/OutlineTree/components/TreeView/index.tsx +0 -376
  213. package/src/plugins/OutlineTree/components/TreeView/style.module.scss +0 -93
  214. package/src/plugins/OutlineTree/components/TreeView/style.module.scss.d.ts +0 -16
  215. package/src/plugins/OutlineTree/components/TreeView/treeNode.tsx +0 -271
  216. package/src/plugins/OutlineTree/index.tsx +0 -39
  217. package/src/plugins/OutlineTree/localize/en_US/index.ts +0 -3
  218. package/src/plugins/OutlineTree/localize/index.ts +0 -3
  219. package/src/plugins/OutlineTree/localize/zh_CN/index.ts +0 -3
  220. package/src/plugins/OutlineTree/util.tsx +0 -302
  221. package/src/plugins/PropertyPanel/index.tsx +0 -63
  222. package/src/plugins/PropertyPanel/style.module.scss +0 -12
  223. package/src/plugins/PropertyPanel/style.module.scss.d.ts +0 -10
  224. package/src/plugins/PropertyPanel/utils.ts +0 -13
  225. package/src/plugins/RightPanel/index.tsx +0 -30
  226. package/src/plugins/RightPanel/style.module.scss +0 -16
  227. package/src/plugins/RightPanel/style.module.scss.d.ts +0 -10
  228. package/src/plugins/RightPanel/view.tsx +0 -177
  229. package/src/plugins/VisualPanel/index.tsx +0 -185
  230. package/src/plugins/VisualPanel/style.module.scss +0 -17
  231. package/src/plugins/VisualPanelPlus/index.tsx +0 -103
  232. package/src/plugins/VisualPanelPlus/style.module.scss +0 -20
  233. package/src/plugins/VisualPanelPlus/style.module.scss.d.ts +0 -10
  234. package/src/plugins/index.tsx +0 -26
  235. package/src/stories/Button.jsx +0 -50
  236. package/src/stories/Button.stories.jsx +0 -40
  237. package/src/stories/Introduction.stories.mdx +0 -194
  238. package/src/stories/assets/code-brackets.svg +0 -1
  239. package/src/stories/assets/colors.svg +0 -1
  240. package/src/stories/assets/comments.svg +0 -1
  241. package/src/stories/assets/direction.svg +0 -1
  242. package/src/stories/assets/flow.svg +0 -1
  243. package/src/stories/assets/plugin.svg +0 -1
  244. package/src/stories/assets/repo.svg +0 -1
  245. package/src/stories/assets/stackalt.svg +0 -1
  246. package/src/stories/button.css +0 -30
  247. package/src/stories/plugins/CSSEditor.stories.tsx +0 -75
  248. package/src/stories/plugins/VisualPanelPlus.stories.tsx +0 -74
  249. package/src/style.d.ts +0 -2
  250. package/src/typing.d.ts +0 -9
  251. package/src/utils/css.ts +0 -88
  252. package/src/utils/defaultEngineConfig.tsx +0 -55
  253. package/src/utils/index.ts +0 -12
  254. package/src/utils/logger.ts +0 -4
  255. package/src/vite-env.d.ts +0 -1
  256. package/tsconfig.json +0 -32
  257. /package/{public → dist}/Engine.module.scss.d.ts +0 -0
  258. /package/{public → dist}/component/CSSEditor/style.module.scss.d.ts +0 -0
  259. /package/{public → dist}/component/CSSPropertiesEditor/style.module.scss.d.ts +0 -0
  260. /package/{public → dist}/component/CSSPropertiesVariableBindEditor/style.module.scss.d.ts +0 -0
  261. /package/{public → dist}/component/CustomSchemaForm/components/Form/Field/style.module.scss.d.ts +0 -0
  262. /package/{public → dist}/component/CustomSchemaForm/components/SetterSwitcher/style.module.scss.d.ts +0 -0
  263. /package/{public → dist}/component/CustomSchemaForm/components/Setters/ArraySetter/style.module.scss.d.ts +0 -0
  264. /package/{public → dist}/component/CustomSchemaForm/components/Setters/CSSValueSetter/style.module.scss.d.ts +0 -0
  265. /package/{public → dist}/component/CustomSchemaForm/style.module.scss.d.ts +0 -0
  266. /package/{public → dist}/component/Workbench/style.module.scss.d.ts +0 -0
  267. /package/{public → dist}/plugins/AdvancePanel/style.module.scss.d.ts +0 -0
  268. /package/{public → dist}/plugins/ComponentLibrary/components/DragItem/style.module.scss.d.ts +0 -0
  269. /package/{public → dist}/plugins/ComponentLibrary/components/ListView/style.module.scss.d.ts +0 -0
  270. /package/{public → dist}/plugins/ComponentLibrary/style.module.scss.d.ts +0 -0
  271. /package/{public → dist}/plugins/Designer/components/DefaultSelectToolBar/style.module.scss.d.ts +0 -0
  272. /package/{public → dist}/plugins/Designer/style.module.scss.d.ts +0 -0
  273. /package/{public → dist}/plugins/GlobalStatePanel/style.module.scss.d.ts +0 -0
  274. /package/{public → dist}/plugins/OutlineTree/components/TreeView/style.module.scss.d.ts +0 -0
  275. /package/{public → dist}/plugins/PropertyPanel/style.module.scss.d.ts +0 -0
  276. /package/{public → dist}/plugins/RightPanel/style.module.scss.d.ts +0 -0
  277. /package/{public → dist}/plugins/VisualPanelPlus/style.module.scss.d.ts +0 -0
@@ -0,0 +1,37 @@
1
+ /// <reference types="react" />
2
+ import { JSExpressionPropType } from '@chamn/model';
3
+ export type SinglePropertyEditorProps = {
4
+ value?: {
5
+ key: string;
6
+ value: JSExpressionPropType;
7
+ };
8
+ onValueChange: (value: {
9
+ key: string;
10
+ value: JSExpressionPropType;
11
+ }) => void;
12
+ onDelete?: () => void;
13
+ onCreate?: (value: {
14
+ key: string;
15
+ value: JSExpressionPropType;
16
+ }) => {
17
+ errorKey?: string[];
18
+ } | void;
19
+ mod?: 'create' | 'edit';
20
+ };
21
+ export type CSSPropertiesVariableBindEditorProps = {
22
+ initialValue?: {
23
+ key: string;
24
+ value: string;
25
+ }[];
26
+ onValueChange?: (val: {
27
+ key: string;
28
+ value: string;
29
+ }[]) => void;
30
+ };
31
+ export type CSSPropertiesVariableBindEditorRef = {
32
+ setValue: (val: {
33
+ key: string;
34
+ value: string;
35
+ }[]) => void;
36
+ };
37
+ export declare const CSSPropertiesVariableBindEditor: import("react").ForwardRefExoticComponent<CSSPropertiesVariableBindEditorProps & import("react").RefAttributes<CSSPropertiesVariableBindEditorRef>>;
@@ -0,0 +1 @@
1
+ export declare const getTextWidth: (text: string, fontSize?: number) => Promise<string>;
@@ -0,0 +1,16 @@
1
+ /// <reference types="react" />
2
+ import { ClassNameType } from '@chamn/model';
3
+ export type ClassNameEditorProps = {
4
+ initialValue?: {
5
+ key: string;
6
+ value: string;
7
+ }[];
8
+ onValueChange?: (val: ClassNameType[]) => void;
9
+ };
10
+ export type ClassNameEditorRef = {
11
+ setValue: (val: {
12
+ key: string;
13
+ value: string;
14
+ }[]) => void;
15
+ };
16
+ export declare const ClassNameEditor: import("react").ForwardRefExoticComponent<ClassNameEditorProps & import("react").RefAttributes<ClassNameEditorRef>>;
@@ -0,0 +1,11 @@
1
+ import React, { ReactNode } from 'react';
2
+ export type CFieldProps = {
3
+ children: React.ReactNode;
4
+ label?: string;
5
+ tips?: ReactNode | (() => ReactNode);
6
+ name: string;
7
+ condition?: (formState: Record<string, any>) => boolean;
8
+ onConditionValueChange?: (val: boolean) => void;
9
+ noStyle?: boolean;
10
+ };
11
+ export declare const CField: (props: CFieldProps) => JSX.Element | null;
@@ -0,0 +1,12 @@
1
+ import React from 'react';
2
+ import { CSetter } from '../Setters/type';
3
+ export type ContextState = Record<string, any>;
4
+ export type CFormContextData = {
5
+ formName: string;
6
+ formState: ContextState;
7
+ conditionConfig: Record<string, (state: ContextState) => boolean>;
8
+ customSetterMap?: Record<string, CSetter>;
9
+ updateContext: (newState: ContextState) => void;
10
+ updateConditionConfig: (name: string, cb: (state: ContextState) => boolean) => void;
11
+ };
12
+ export declare const CFormContext: React.Context<CFormContextData>;
@@ -0,0 +1,18 @@
1
+ import React from 'react';
2
+ import { ReactNode } from 'react';
3
+ import { CFormContextData, ContextState } from './context';
4
+ export type CFormProps = {
5
+ name: string;
6
+ children?: ReactNode | ReactNode[];
7
+ initialValue?: Record<string, any>;
8
+ customSetterMap: CFormContextData['customSetterMap'];
9
+ onValueChange?: (formData: Record<string, any>) => void;
10
+ };
11
+ export declare class CForm extends React.Component<CFormProps, CFormContextData> {
12
+ updateContext: (newState: ContextState) => void;
13
+ constructor(props: CFormProps);
14
+ getFieldsValue: () => Record<string, any>;
15
+ setFields: (state: Record<string, any>) => void;
16
+ formatValue: (data: Record<string, any>) => Record<string, any>;
17
+ render(): ReactNode;
18
+ }
@@ -0,0 +1,14 @@
1
+ import React from 'react';
2
+ import { SetterObjType } from '@chamn/model';
3
+ import { CFieldProps } from '../Form/Field';
4
+ import { CSetter } from '../Setters/type';
5
+ export type SetterSwitcherProps = {
6
+ setters: SetterObjType[];
7
+ customSetterMap?: Record<string, CSetter>;
8
+ keyPaths: string[];
9
+ prefix?: React.ReactNode;
10
+ suffix?: React.ReactNode;
11
+ style?: React.CSSProperties;
12
+ useField?: boolean;
13
+ } & Omit<CFieldProps, 'children'>;
14
+ export declare const SetterSwitcher: ({ setters, keyPaths, condition, useField, ...props }: SetterSwitcherProps) => JSX.Element;
@@ -0,0 +1,11 @@
1
+ import React from 'react';
2
+ import { SetterObjType } from '@chamn/model';
3
+ export declare function ArrayItem(props: {
4
+ index: number;
5
+ keyPaths: string[];
6
+ value: Record<string, any>;
7
+ setters: SetterObjType[];
8
+ style: React.CSSProperties;
9
+ onValueChange: (val: Record<string, any>) => void;
10
+ onDelete: () => void;
11
+ }): JSX.Element;
@@ -0,0 +1,10 @@
1
+ /// <reference types="react" />
2
+ import { ModalProps } from 'antd';
3
+ export type SortItemOrderProps = {
4
+ list: any[];
5
+ keyPaths: string[];
6
+ label: string;
7
+ sortLabelKey?: string;
8
+ onValueChange?: (newList: any[]) => void;
9
+ } & ModalProps;
10
+ export declare const SortItemOrderModal: ({ list, onValueChange, keyPaths, label, sortLabelKey, ...modalProps }: SortItemOrderProps) => JSX.Element;
@@ -0,0 +1,14 @@
1
+ /// <reference types="react" />
2
+ import { CSetterProps } from '../type';
3
+ import { SetterType } from '@chamn/model';
4
+ export type CArraySetterProps = {
5
+ item: {
6
+ setters: SetterType[];
7
+ initialValue?: any;
8
+ };
9
+ sortLabelKey?: string;
10
+ };
11
+ export declare const ArraySetter: {
12
+ ({ onValueChange, setterContext, item: { setters, initialValue }, sortLabelKey, ...props }: CSetterProps<CArraySetterProps>): JSX.Element;
13
+ setterName: string;
14
+ };
@@ -0,0 +1,5 @@
1
+ import { SwitchProps } from 'antd';
2
+ import { CSetter } from '../type';
3
+ type BooleanSetterProps = SwitchProps;
4
+ export declare const BooleanSetter: CSetter<BooleanSetterProps>;
5
+ export {};
@@ -0,0 +1,6 @@
1
+ import { CSetter } from '../type';
2
+ type CSSValueSetterProps = {
3
+ propertyKey: string;
4
+ };
5
+ export declare const CSSValueSetter: CSetter<CSSValueSetterProps>;
6
+ export {};
@@ -0,0 +1,8 @@
1
+ import { InputProps } from 'antd';
2
+ import { CSetter } from '../type';
3
+ export declare const ExpressionSetter: CSetter<InputProps & {
4
+ value: {
5
+ type: string;
6
+ value: string;
7
+ };
8
+ }>;
@@ -0,0 +1 @@
1
+ export declare const DefaultTslibSource = "\ntype ContextType = {\n /** \u6E32\u67D3\u51FD\u6570\u7684\u5165\u53E3\u53C2\u6570 */\n params?: Record<any, any>;\n /** \u5168\u5C40\u72B6\u6001 */\n globalState?: Record<any, any>;\n /** \u66F4\u65B0\u5168\u5C40\u72B6\u6001 */\n updateGlobalState?: (newState: any) => void;\n /** \u5F53\u524D\u8282\u70B9\u72B6\u6001 **/\n state?: Record<any, any>;\n /** \u5B58\u50A8\u5F53\u524D\u8282\u70B9\u7684\u6570\u636E\uFF0C\u4E0D\u5177\u6709\u54CD\u5E94\u6027 **/\n staticState?: Record<any, any>;\n /** \u66F4\u65B0\u5F53\u524D\u8282\u70B9\u72B6\u6001 */\n updateState?: (newState: any) => void;\n /** \u6240\u6709\u8282\u70B9\u7684\u7D22\u5F15 */\n refs?: RefManager;\n /** \u5FAA\u73AF\u6E32\u67D3\u4E2D\u7684\u5355\u4E2A\u5FAA\u73AF\u6570\u636E */\n loopData?: Record<any, any>;\n /** \u7528\u4E8E\u8BBF\u8BBF\u95EE\u548C\u7BA1\u7406\u9875\u9762\u88AB\u6CE8\u518C\u4E3A\u5168\u5C40\u7684\u5C40\u90E8 state */\n stateManager?: Record<string, {\n state: any,\n updateState: (newState: Record<string, any>) => void\n }>;\n};\n\n/** \u6E32\u67D3\u4E0A\u4E0B\u6587 */\ndeclare var $$context: ContextType;\n";
@@ -0,0 +1,2 @@
1
+ import { CSetter } from '../type';
2
+ export declare const FunctionSetter: CSetter<any>;
@@ -0,0 +1,2 @@
1
+ import { CSetter } from '../type';
2
+ export declare const JSONSetter: CSetter<any>;
@@ -0,0 +1,3 @@
1
+ import { InputNumberProps } from 'antd';
2
+ import { CSetter } from '../type';
3
+ export declare const NumberSetter: CSetter<InputNumberProps>;
@@ -0,0 +1,3 @@
1
+ import { SelectProps } from 'antd';
2
+ import { CSetter } from '../type';
3
+ export declare const SelectSetter: CSetter<SelectProps>;
@@ -0,0 +1,8 @@
1
+ import { CSetter } from '../type';
2
+ import { MaterialPropType } from '@chamn/model';
3
+ export type CShapeSetterProps = {
4
+ elements: MaterialPropType[];
5
+ initialValue?: Record<string, any>;
6
+ value: Record<string, any>;
7
+ };
8
+ export declare const ShapeSetter: CSetter<CShapeSetterProps>;
@@ -0,0 +1,3 @@
1
+ import { InputProps } from 'antd';
2
+ import { CSetter } from '../type';
3
+ export declare const StringSetter: CSetter<InputProps>;
@@ -0,0 +1,3 @@
1
+ import { CSetter } from '../type';
2
+ import { TextAreaProps } from 'antd/es/input';
3
+ export declare const TextAreaSetter: CSetter<TextAreaProps>;
@@ -0,0 +1,3 @@
1
+ import { CSetter } from './type';
2
+ declare const _default: Record<string, CSetter<any>>;
3
+ export default _default;
@@ -0,0 +1,19 @@
1
+ /// <reference types="react" />
2
+ import { CPluginCtx } from '../../../../core/pluginManager';
3
+ export type CSetter<T = any> = {
4
+ (props: CSetterProps<T>): JSX.Element;
5
+ setterName: string;
6
+ };
7
+ export type CSetterProps<T = {
8
+ _: any;
9
+ }> = {
10
+ onValueChange?: ((val: any) => void) | undefined;
11
+ value?: unknown;
12
+ setterContext: {
13
+ pluginCtx: CPluginCtx;
14
+ setCollapseHeaderExt?: (el: React.ReactNode) => void;
15
+ onSetterChange: (keyPaths: string[], setterName: string) => void;
16
+ keyPaths: string[];
17
+ label: string;
18
+ };
19
+ } & T;
@@ -0,0 +1,15 @@
1
+ import React, { Ref } from 'react';
2
+ import { CustomSchemaFormInstance } from '.';
3
+ import { CPluginCtx } from '../../core/pluginManager';
4
+ import { CForm } from './components/Form';
5
+ export type ContextState = Record<string, any>;
6
+ export type CCustomSchemaFormContextData = {
7
+ onSetterChange: (keyPaths: string[], setterName: string) => void;
8
+ defaultSetterConfig: Record<string, {
9
+ name: string;
10
+ setter: string;
11
+ }>;
12
+ formRef?: Ref<CustomSchemaFormInstance | CForm>;
13
+ pluginCtx?: CPluginCtx;
14
+ };
15
+ export declare const CCustomSchemaFormContext: React.Context<CCustomSchemaFormContextData>;
@@ -0,0 +1,20 @@
1
+ import React from 'react';
2
+ import { CMaterialPropsType } from '@chamn/model';
3
+ import { CForm } from './components/Form';
4
+ import { CPluginCtx } from '../../core/pluginManager';
5
+ import { CFormContextData } from './components/Form/context';
6
+ export type CustomSchemaFormInstance = CForm;
7
+ export type CustomSchemaFormProps = {
8
+ pluginCtx?: CPluginCtx;
9
+ initialValue: Record<string, any>;
10
+ properties: CMaterialPropsType<any>;
11
+ onValueChange?: (val: any) => void;
12
+ onSetterChange: (keyPaths: string[], setterName: string) => void;
13
+ /** 存储每个字段上次使用的 setter */
14
+ defaultSetterConfig: Record<string, {
15
+ name: string;
16
+ setter: string;
17
+ }>;
18
+ customSetterMap?: CFormContextData['customSetterMap'];
19
+ };
20
+ export declare const CustomSchemaForm: React.ForwardRefExoticComponent<CustomSchemaFormProps & React.RefAttributes<CForm>>;
@@ -0,0 +1,2 @@
1
+ import { SetterObjType, SetterType } from '@chamn/model';
2
+ export declare const getSetterList: <T extends string = "">(setters?: SetterType<T>[]) => SetterObjType<T>[];
@@ -0,0 +1,15 @@
1
+ /// <reference types="react" />
2
+ import * as monaco from 'monaco-editor';
3
+ import * as monacoEditor from 'monaco-editor/esm/vs/editor/editor.api';
4
+ export type MonacoEditorInstance = monacoEditor.editor.IStandaloneCodeEditor;
5
+ export type MonacoEditorProps = {
6
+ beforeMount?: (monaco: typeof monacoEditor) => void;
7
+ onDidMount?: (editor: MonacoEditorInstance) => void;
8
+ options?: monaco.editor.IStandaloneEditorConstructionOptions;
9
+ override?: monaco.editor.IEditorOverrideServices;
10
+ onChange?: (val: string, e: monaco.editor.IModelContentChangedEvent) => void;
11
+ onDidChangeMarkers?: (markers: monaco.editor.IMarker[]) => void;
12
+ initialValue?: string;
13
+ language?: 'json' | 'javascript' | 'typescript';
14
+ };
15
+ export declare const MonacoEditor: (props: MonacoEditorProps) => JSX.Element;
@@ -0,0 +1,61 @@
1
+ import React from 'react';
2
+ import { ResizeCallback } from 're-resizable';
3
+ import { Emitter } from 'mitt';
4
+ export interface PluginContext {
5
+ openPanel: () => void;
6
+ closePanel: () => void;
7
+ getPlugin: (pluginName: string) => any;
8
+ emitter: Emitter<any>;
9
+ }
10
+ type PanelItem = {
11
+ name: string;
12
+ title: string | React.ReactNode;
13
+ icon: React.ReactNode;
14
+ render: React.ReactNode;
15
+ };
16
+ type WorkbenchStateType = {
17
+ leftBoxVisible: boolean;
18
+ leftBoxSize: {
19
+ width: number;
20
+ height: number | string;
21
+ };
22
+ leftBoxFixed: boolean;
23
+ rightBoxSize: {
24
+ width: number;
25
+ height: number | string;
26
+ };
27
+ rightBoxVisible: boolean;
28
+ currentActiveLeftPanel: string;
29
+ leftPanels: PanelItem[];
30
+ bodyView: React.ReactNode | null;
31
+ rightView: React.ReactNode | null;
32
+ topToolBarView: React.ReactNode | null;
33
+ subTopToolbarBox: React.ReactNode | null;
34
+ };
35
+ export type WorkbenchPropsType = {
36
+ emitter: Emitter<any>;
37
+ };
38
+ export declare class Workbench extends React.Component<WorkbenchPropsType, WorkbenchStateType> {
39
+ emitter: Emitter<any>;
40
+ leftPanelContentRef: React.RefObject<HTMLDivElement>;
41
+ constructor(props: WorkbenchPropsType);
42
+ addLeftPanel: (panel: PanelItem) => void;
43
+ /** 替换对应的 panel */
44
+ replaceLeftPanel: (panelName: string, newPanel: PanelItem) => void;
45
+ openLeftPanel: (currentActiveLeftPanel?: string) => Promise<void>;
46
+ closeLeftPanel: () => Promise<void>;
47
+ toggleLeftPanel: () => void;
48
+ onPluginIconClick: (panel: PanelItem) => void;
49
+ openRightPanel: () => void;
50
+ closeRightPanel: () => void;
51
+ replaceBodyView: (newView: React.ReactNode) => void;
52
+ replaceRightView: (newView: React.ReactNode) => void;
53
+ replaceTopBarView: (newView: React.ReactNode) => void;
54
+ replaceSubTopBarView: (newView: React.ReactNode) => void;
55
+ toggleRightPanel: () => void;
56
+ onLeftBoxResizeStop: ResizeCallback;
57
+ onGlobalClick: (e: MouseEvent) => void;
58
+ componentDidMount(): void;
59
+ render(): JSX.Element;
60
+ }
61
+ export {};
@@ -0,0 +1,61 @@
1
+ import { Engine } from '../index';
2
+ import { AssetPackage, CPage } from '@chamn/model';
3
+ import { Emitter } from 'mitt';
4
+ import { Workbench } from '../component/Workbench';
5
+ import { CustomI18n } from '../i18n';
6
+ export type PluginObj = {
7
+ name: string;
8
+ init: (ctx: CPluginCtx) => Promise<void>;
9
+ destroy: (ctx: CPluginCtx) => Promise<void>;
10
+ /** 用于暴露给外部重载插件 */
11
+ reload?: (ctx: CPluginCtx) => Promise<void>;
12
+ /** 插件暴露给外部可以调用的方法 */
13
+ exports: (ctx: CPluginCtx) => any;
14
+ meta: {
15
+ engine: {
16
+ version: string;
17
+ };
18
+ };
19
+ };
20
+ export type CPlugin = PluginObj | ((ctx: CPluginCtx) => PluginObj);
21
+ type PluginManagerOptions = {
22
+ getWorkbench: () => Workbench;
23
+ emitter: Emitter<any>;
24
+ pageModel: CPage;
25
+ i18n: CustomI18n;
26
+ assets: AssetPackage[];
27
+ engine: Engine;
28
+ };
29
+ export type CPluginCtx<C = any> = {
30
+ globalEmitter: Emitter<any>;
31
+ /** 当前插件外部传入的配置 **/
32
+ config: C;
33
+ pluginManager: PluginManager;
34
+ pluginReadyOk: () => void;
35
+ } & PluginManagerOptions;
36
+ export type PluginInstance = {
37
+ ctx: CPluginCtx;
38
+ exports: any;
39
+ source: PluginObj;
40
+ ready: boolean;
41
+ };
42
+ export type CustomPluginHook = (pluginInstance: PluginInstance) => PluginInstance;
43
+ export declare class PluginManager {
44
+ plugins: Map<string, PluginInstance>;
45
+ emitter: Emitter<any>;
46
+ getWorkbench: () => Workbench;
47
+ pageModel: CPage;
48
+ i18n: CustomI18n;
49
+ assets: AssetPackage[];
50
+ engine: Engine;
51
+ customPluginHooks: Record<string, CustomPluginHook[]>;
52
+ constructor({ getWorkbench, emitter, pageModel, i18n, assets, engine }: PluginManagerOptions);
53
+ /** 自定义插件, 可以修改插件的配置 */
54
+ customPlugin: (pluginName: string, customPluginHook: CustomPluginHook) => void;
55
+ createPluginCtx: () => CPluginCtx<any>;
56
+ add(plugin: CPlugin): Promise<void>;
57
+ get(pluginName: string): Promise<PluginInstance | undefined>;
58
+ remove(name: string): Promise<void>;
59
+ onPluginReadyOk(pluginName: string, cb?: (pluginHandle: PluginInstance) => void): Promise<PluginInstance> | undefined;
60
+ }
61
+ 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,44 @@
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
+ export type EnginContext = {
7
+ pluginManager: PluginManager;
8
+ engine: Engine;
9
+ };
10
+ export type EngineProps = {
11
+ plugins: CPlugin[];
12
+ schema: CPageDataType;
13
+ material?: CMaterialType[];
14
+ assetPackagesList?: AssetPackage[];
15
+ beforePluginRun?: (options: {
16
+ pluginManager: PluginManager;
17
+ }) => void;
18
+ onReady?: (ctx: EnginContext) => void;
19
+ /** 渲染器 umd 格式 js 地址, 默认 ./render.umd.js */
20
+ renderJSUrl?: string;
21
+ };
22
+ export declare class Engine extends React.Component<EngineProps> {
23
+ currentSelectNode: CNode | CRootNode | null;
24
+ pluginManager: PluginManager;
25
+ workbenchRef: React.RefObject<Workbench>;
26
+ pageSchema: CPageDataType | undefined;
27
+ pageModel: CPage;
28
+ material: CMaterialType[] | undefined;
29
+ emitter: Emitter<any>;
30
+ constructor(props: EngineProps);
31
+ updateCurrentSelectNode(node: CNode | CRootNode): void;
32
+ componentDidMount(): Promise<void>;
33
+ getActiveNode(): CNode | CRootNode | null;
34
+ updatePage: (page: CPageDataType) => void;
35
+ updateDesignerAssets: (assets: AssetPackage[]) => void;
36
+ updateMaterial: (material: CMaterialType[]) => void;
37
+ refresh: () => void;
38
+ getWorkbench: () => Workbench | null;
39
+ render(): JSX.Element;
40
+ }
41
+ export * as plugins from './plugins';
42
+ export * from '@chamn/layout';
43
+ export * from './material/innerMaterial';
44
+ export * from './component/CustomSchemaForm/components/Setters/type';