@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
@@ -1,10 +0,0 @@
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;
@@ -1,13 +0,0 @@
1
- import { SetterObjType, SetterType } from '@chamn/model';
2
-
3
- export const getSetterList = (setters: SetterType[] = []): SetterObjType[] => {
4
- return setters.map((setter) => {
5
- if (typeof setter === 'string') {
6
- return {
7
- componentName: setter as any,
8
- };
9
- } else {
10
- return setter;
11
- }
12
- });
13
- };
@@ -1,30 +0,0 @@
1
- import React from 'react';
2
- import { CPlugin } from '../../core/pluginManager';
3
- import { CRightPanelItem, RightPanel } from './view';
4
-
5
- const PLUGIN_NAME = 'RightPanel';
6
- export const RightPanelPlugin: CPlugin = (ctx) => {
7
- const uiHandle = React.createRef<RightPanel>();
8
- return {
9
- name: PLUGIN_NAME,
10
- async init(ctx) {
11
- const workbench = ctx.getWorkbench();
12
- workbench.replaceRightView(<RightPanel ref={uiHandle} pluginCtx={ctx} />);
13
- },
14
- async destroy(ctx) {
15
- console.log('destroy', ctx);
16
- },
17
- exports: (ctx) => {
18
- return {
19
- addPanel: (panel: CRightPanelItem) => {
20
- uiHandle?.current?.addPanel(panel);
21
- },
22
- };
23
- },
24
- meta: {
25
- engine: {
26
- version: '1.0.0',
27
- },
28
- },
29
- };
30
- };
@@ -1,16 +0,0 @@
1
- .rightPanelContainer {
2
- height: 100%;
3
- width: 100%;
4
- :global {
5
- .ant-tabs .ant-tabs-tab + .ant-tabs-tab {
6
- margin-left: 0;
7
- }
8
- .ant-tabs-content.ant-tabs-content-top {
9
- height: 100%;
10
- overflow: auto;
11
- }
12
- .ant-tabs .ant-tabs-tabpane {
13
- height: 100%;
14
- }
15
- }
16
- }
@@ -1,10 +0,0 @@
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;
@@ -1,177 +0,0 @@
1
- import { CNode, CRootNode } from '@chamn/model';
2
- import { Empty, Tabs } from 'antd';
3
- import React from 'react';
4
- import { CPluginCtx } from '../../core/pluginManager';
5
- import { PropertyPanelConfig } from '../PropertyPanel';
6
- import { ComponentStatePanelConfig } from '../ComponentStatePanel';
7
- import { AdvancePanelConfig } from '../AdvancePanel';
8
- import styles from './style.module.scss';
9
- import { VisualPanelPlusConfig } from '../VisualPanelPlus';
10
-
11
- export type RightPanelOptions = { node: CNode | CRootNode; pluginCtx: CPluginCtx };
12
-
13
- export type CRightPanelItem = {
14
- key: string;
15
- name: string | ((props: RightPanelOptions) => React.ReactNode);
16
- view: (props: RightPanelOptions) => React.ReactNode;
17
- show?: (options: RightPanelOptions) => boolean;
18
- };
19
-
20
- interface RightPanelProps {
21
- pluginCtx: CPluginCtx;
22
- }
23
-
24
- interface RightPanelState {
25
- node: CNode | CRootNode | null;
26
- activeKey: string;
27
- panels: CRightPanelItem[];
28
- displayPanels: CRightPanelItem[];
29
- }
30
-
31
- export class RightPanel extends React.Component<RightPanelProps, RightPanelState> {
32
- constructor(props: RightPanelProps) {
33
- super(props);
34
- this.state = {
35
- node: props.pluginCtx.engine.getActiveNode(),
36
- activeKey: 'Visual',
37
- panels: [
38
- // AdvancePanelConfig,
39
- PropertyPanelConfig,
40
- // VisualPanelConfig,
41
- VisualPanelPlusConfig,
42
- ComponentStatePanelConfig,
43
- // {
44
- // key: 'Actions',
45
- // name: 'Actions',
46
- // view: () => <>Actions</>,
47
- // },
48
- AdvancePanelConfig,
49
- ],
50
- displayPanels: [],
51
- };
52
- }
53
-
54
- addPanel = (panel: CRightPanelItem) => {
55
- const newPanels = [...this.state.panels, panel];
56
- this.setState({
57
- panels: newPanels,
58
- });
59
- this.updatePanels();
60
- };
61
-
62
- updatePanels = () => {
63
- const { pluginCtx } = this.props;
64
- const { node, panels } = this.state;
65
- const newPanels = panels;
66
- let val: {
67
- panels: CRightPanelItem[];
68
- displayPanels: CRightPanelItem[];
69
- } = { panels: [], displayPanels: [] };
70
- if (node) {
71
- const panelParams = { node: node, pluginCtx };
72
- const displayPanels = newPanels.filter((panel) => {
73
- if (panel.show === undefined) {
74
- return true;
75
- } else {
76
- return panel.show(panelParams);
77
- }
78
- });
79
- val = {
80
- panels: newPanels,
81
- displayPanels,
82
- };
83
- } else {
84
- val = {
85
- panels: newPanels,
86
- displayPanels: [],
87
- };
88
- }
89
- this.setState(val);
90
- return val;
91
- };
92
-
93
- onNodeChange = ({ node }: any) => {
94
- const { pluginCtx } = this.props;
95
- const { panels, activeKey } = this.state;
96
- const panelParams = { node: node, pluginCtx };
97
- const displayPanels = panels.filter((panel) => {
98
- if (panel.show === undefined) {
99
- return true;
100
- } else {
101
- return panel.show(panelParams);
102
- }
103
- });
104
- const firstPanelKey = displayPanels.find((_, index) => index === 0)?.key || '';
105
- const isExitsCurrent = displayPanels.find((el) => el.key === activeKey);
106
- if (!isExitsCurrent) {
107
- this.setState({
108
- activeKey: firstPanelKey,
109
- node,
110
- displayPanels,
111
- });
112
- } else {
113
- this.setState({
114
- node,
115
- displayPanels,
116
- });
117
- }
118
- };
119
-
120
- componentDidMount(): void {
121
- const { pluginCtx } = this.props;
122
- pluginCtx.globalEmitter.on('onSelectNodeChange', this.onNodeChange);
123
- pluginCtx.pageModel.emitter.on('*', () => {
124
- const currentSelectNode = pluginCtx.engine.getActiveNode();
125
- this.onNodeChange({ node: currentSelectNode });
126
- });
127
- const { displayPanels } = this.updatePanels();
128
- const firstPanelKey = displayPanels.find((_, index) => index === 0)?.key || '';
129
- const isExitsCurrent = displayPanels.find((el) => el.key === this.state.activeKey);
130
-
131
- if (!isExitsCurrent) {
132
- this.setState({
133
- activeKey: firstPanelKey,
134
- });
135
- }
136
- }
137
-
138
- render() {
139
- const { displayPanels, node, activeKey } = this.state;
140
- const { pluginCtx } = this.props;
141
- if (!node) {
142
- return (
143
- <div style={{ overflow: 'hidden' }}>
144
- <Empty image={Empty.PRESENTED_IMAGE_SIMPLE} description={'Please select a node from left view'} />
145
- </div>
146
- );
147
- }
148
- const panelParams = { node: node, pluginCtx };
149
-
150
- return (
151
- <div className={styles.rightPanelContainer}>
152
- <Tabs
153
- activeKey={activeKey}
154
- tabPosition="top"
155
- style={{
156
- flex: 1,
157
- height: '100%',
158
- }}
159
- onChange={(activeKey) => {
160
- this.setState({
161
- activeKey,
162
- });
163
- }}
164
- items={displayPanels.map((p) => {
165
- return {
166
- label: (
167
- <div style={{ padding: '0 10px' }}>{typeof p.name === 'string' ? p.name : p.name?.(panelParams)}</div>
168
- ),
169
- key: p.key,
170
- children: p.view(panelParams),
171
- };
172
- })}
173
- />
174
- </div>
175
- );
176
- }
177
- }
@@ -1,185 +0,0 @@
1
- import React, { useEffect, useMemo, useRef, useState } from 'react';
2
- import { CMaterialPropsType, CNode, CNodePropsTypeEnum, CProp, isExpression } from '@chamn/model';
3
- import { CPluginCtx } from '../../core/pluginManager';
4
- import { CRightPanelItem } from '../RightPanel/view';
5
-
6
- import styles from './style.module.scss';
7
- import { CSSPropertiesEditor, CSSPropertiesEditorRef } from '../../component/CSSPropertiesEditor';
8
- import { Collapse } from 'antd';
9
- import { CustomSchemaForm, CustomSchemaFormInstance } from '../../component/CustomSchemaForm';
10
-
11
- type styleArr = {
12
- key: string;
13
- value: any;
14
- }[];
15
-
16
- const CSSBindPropsSchema: CMaterialPropsType<'CSSValueSetter'> = [
17
- {
18
- name: 'css',
19
- title: 'CSS Variable Bind',
20
- valueType: 'array',
21
- setters: [
22
- {
23
- componentName: 'ArraySetter',
24
- props: {
25
- item: {
26
- setters: [
27
- {
28
- componentName: 'ShapeSetter',
29
- props: {
30
- elements: [
31
- {
32
- name: 'key',
33
- title: '属性',
34
- valueType: 'string',
35
- setters: ['StringSetter'],
36
- description: '',
37
- },
38
- {
39
- name: 'value',
40
- title: '置',
41
- valueType: 'string',
42
- setters: ['ExpressionSetter'],
43
- description: '',
44
- },
45
- ],
46
- collapse: false,
47
- },
48
- initialValue: {
49
- key: '',
50
- value: {
51
- type: CNodePropsTypeEnum.EXPRESSION,
52
- value: '',
53
- },
54
- },
55
- },
56
- ],
57
- initialValue: {
58
- key: '',
59
- value: {
60
- type: CNodePropsTypeEnum.EXPRESSION,
61
- value: '',
62
- },
63
- },
64
- },
65
- },
66
- initialValue: [],
67
- },
68
- ],
69
- },
70
- ];
71
-
72
- const formatProperty = (cssVal: Record<string, any>) => {
73
- const normalProperty: { key: string; value: string }[] = [];
74
- const expressionProperty: { key: string; value: any }[] = [];
75
- Object.keys(cssVal).forEach((key) => {
76
- const val = cssVal[key];
77
- if (isExpression(val)) {
78
- expressionProperty.push({
79
- key,
80
- value: val,
81
- });
82
- } else {
83
- normalProperty.push({
84
- key,
85
- value: val,
86
- });
87
- }
88
- });
89
- const res = {
90
- normalProperty,
91
- expressionProperty,
92
- };
93
- return res;
94
- };
95
-
96
- const styleArr2Obj = (val: styleArr) => {
97
- const res: Record<string, any> = {};
98
- val.forEach((item) => {
99
- res[item.key] = item.value;
100
- });
101
- return res;
102
- };
103
-
104
- export const VisualPanel = (props: { node: CNode; pluginCtx: CPluginCtx }) => {
105
- const formRef = useRef<CustomSchemaFormInstance>(null);
106
- const { node } = props;
107
- const cssEditorRef = useRef<CSSPropertiesEditorRef>(null);
108
- const [style, setStyle] = useState<Record<string, string>>({});
109
- const formatStyle = useMemo(() => {
110
- return formatProperty(style);
111
- }, [style]);
112
- useEffect(() => {
113
- const handel = () => {
114
- const newStyle = node.getPlainProps?.()['style'] || {};
115
- setStyle(newStyle);
116
- const { normalProperty, expressionProperty } = formatProperty(newStyle);
117
- cssEditorRef.current?.setValue(normalProperty);
118
- formRef.current?.setFields({
119
- css: expressionProperty,
120
- });
121
- };
122
- handel();
123
- node.emitter.on('onNodeChange', handel);
124
- () => {
125
- node.emitter.off('onNodeChange', handel);
126
- };
127
- }, [node]);
128
-
129
- const onUpdateStyle = (styleArr: styleArr) => {
130
- // merge style
131
- const newStyle = styleArr2Obj([...styleArr]);
132
- setStyle(newStyle);
133
- if (node.value.props.style) {
134
- node.value.props.style.updateValue(newStyle);
135
- } else {
136
- node.value.props.style = new CProp('style', newStyle, {
137
- parent: node,
138
- materials: node.materialsModel,
139
- });
140
- node.updateValue();
141
- }
142
- };
143
-
144
- return (
145
- <div className={styles.visualPanelBox}>
146
- <Collapse
147
- defaultActiveKey={['origin-css-edit']}
148
- bordered={false}
149
- style={{
150
- marginBottom: '10px',
151
- }}
152
- >
153
- <Collapse.Panel header={<span className={styles.header}>CSS Source</span>} key="origin-css-edit">
154
- <CSSPropertiesEditor
155
- key={node.id}
156
- ref={cssEditorRef}
157
- onValueChange={(val) => {
158
- onUpdateStyle([...val, ...formatStyle.expressionProperty]);
159
- }}
160
- initialValue={formatStyle.normalProperty}
161
- />
162
- </Collapse.Panel>
163
- </Collapse>
164
- <CustomSchemaForm
165
- pluginCtx={props.pluginCtx}
166
- key={node.id}
167
- defaultSetterConfig={node.value.configure.propsSetter || {}}
168
- // eslint-disable-next-line @typescript-eslint/no-empty-function
169
- onSetterChange={() => {}}
170
- properties={CSSBindPropsSchema}
171
- initialValue={formatStyle.expressionProperty}
172
- ref={formRef}
173
- onValueChange={(val) => {
174
- onUpdateStyle([...formatStyle.normalProperty, ...val.css]);
175
- }}
176
- />
177
- </div>
178
- );
179
- };
180
-
181
- export const VisualPanelConfig: CRightPanelItem = {
182
- key: 'Visual',
183
- name: 'Visual',
184
- view: ({ node, pluginCtx }) => <VisualPanel node={node} pluginCtx={pluginCtx} />,
185
- };
@@ -1,17 +0,0 @@
1
- .visualPanelBox {
2
- padding: 0 15px;
3
- :global {
4
- .ant-collapse > .ant-collapse-item:last-child > .ant-collapse-header {
5
- padding: 5px 5px 5px 10px;
6
- align-items: center;
7
- .ant-collapse-expand-icon {
8
- padding-inline-end: 4px;
9
- }
10
- }
11
- }
12
- .header {
13
- color: $fontColor;
14
- display: flex;
15
- font-size: 12px;
16
- }
17
- }
@@ -1,103 +0,0 @@
1
- import { useEffect, useMemo, useRef, useState } from 'react';
2
- import { CNode, CRootNode } from '@chamn/model';
3
- import { CPluginCtx } from '../../core/pluginManager';
4
- import { CRightPanelItem } from '../RightPanel/view';
5
-
6
- import styles from './style.module.scss';
7
- import { CSSPropertiesEditor, CSSPropertiesEditorRef } from '../../component/CSSPropertiesEditor';
8
- import {
9
- CSSPropertiesVariableBindEditor,
10
- CSSPropertiesVariableBindEditorRef,
11
- } from '../../component/CSSPropertiesVariableBindEditor';
12
- import { Collapse } from 'antd';
13
- import { ClassNameEditor } from '@/component/ClassNameEditor';
14
- import { CSSEditor, CSSEditorRef, CSSVal } from '@/component/CSSEditor';
15
- import { formatCSSProperty, formatCssToNodeVal, formatNodeValToEditor, StyleArr, styleArr2Obj } from '@/utils/css';
16
-
17
- export const VisualPanelPlus = (props: { node: CNode | CRootNode; pluginCtx: CPluginCtx }) => {
18
- const formRef = useRef<CSSPropertiesVariableBindEditorRef>(null);
19
- const node = props.pluginCtx.pageModel.getNode(props.node.id)!;
20
- const cssPropertyEditorRef = useRef<CSSPropertiesEditorRef>(null);
21
- const cssEditorRef = useRef<CSSEditorRef>(null);
22
- const [style, setStyle] = useState<Record<string, any>>({});
23
- const formatStyle = useMemo(() => {
24
- return formatCSSProperty(style);
25
- }, [style]);
26
-
27
- const lastNode = useRef<CNode | CRootNode>();
28
- useEffect(() => {
29
- const handel = () => {
30
- lastNode.current = node;
31
- const newStyle = node.value.style || {};
32
- setStyle(newStyle);
33
- const { normalProperty, expressionProperty } = formatCSSProperty(newStyle);
34
- cssPropertyEditorRef.current?.setValue(normalProperty);
35
- formRef.current?.setValue(expressionProperty);
36
- const fCss = formatNodeValToEditor(node.value.css);
37
- cssEditorRef.current?.setValue(fCss);
38
- };
39
- handel();
40
- node.emitter.on('onNodeChange', handel);
41
- node.emitter.on('onReloadPage', handel);
42
- () => {
43
- node.emitter.off('onNodeChange', handel);
44
- node.emitter.off('onReloadPage', handel);
45
- };
46
- }, [node]);
47
-
48
- const onUpdateStyle = (styleArr: StyleArr) => {
49
- // merge style
50
- const newStyle = styleArr2Obj([...styleArr]);
51
- setStyle(newStyle);
52
- node.value.style = newStyle;
53
- node.updateValue();
54
- };
55
-
56
- const onUpdateCss = (val: CSSVal) => {
57
- // class name 不能以数字开头,这里使用c_前缀
58
- node.value.css = formatCssToNodeVal(`c_${node.id}`, val);
59
- console.log(' node.value.css', node.value.css);
60
- node.updateValue();
61
- };
62
-
63
- return (
64
- <div className={styles.visualPanelBox}>
65
- <div
66
- style={{
67
- marginBottom: '10px',
68
- }}
69
- >
70
- <ClassNameEditor
71
- onValueChange={(newVal) => {
72
- node.value.classNames = newVal;
73
- node.updateValue();
74
- }}
75
- />
76
- </div>
77
- <Collapse
78
- defaultActiveKey={['origin-css-edit']}
79
- bordered={false}
80
- style={{
81
- marginBottom: '10px',
82
- }}
83
- >
84
- <Collapse.Panel header={<span className={styles.header}>Style Variable Bind</span>} key="origin-css-edit">
85
- <CSSPropertiesVariableBindEditor
86
- ref={formRef}
87
- initialValue={formatStyle.expressionProperty}
88
- onValueChange={(val) => {
89
- onUpdateStyle([...formatStyle.normalProperty, ...val]);
90
- }}
91
- />
92
- </Collapse.Panel>
93
- </Collapse>
94
- <CSSEditor handler={cssEditorRef} onValueChange={onUpdateCss} />
95
- </div>
96
- );
97
- };
98
-
99
- export const VisualPanelPlusConfig: CRightPanelItem = {
100
- key: 'VisualPanelPlus',
101
- name: 'VisualPanel',
102
- view: ({ node, pluginCtx }) => <VisualPanelPlus node={node} pluginCtx={pluginCtx} />,
103
- };
@@ -1,20 +0,0 @@
1
- .visualPanelBox {
2
- padding: 0 15px 300px;
3
-
4
- .header {
5
- color: $fontColor;
6
- display: flex;
7
- }
8
- }
9
-
10
- :global {
11
- .ant-collapse .ant-collapse-item .ant-collapse-header {
12
- padding: 5px 5px 5px 10px;
13
- align-items: center;
14
- color: $fontColor;
15
- font-size: 12px;
16
- .ant-collapse-expand-icon {
17
- padding-inline-end: 4px;
18
- }
19
- }
20
- }
@@ -1,10 +0,0 @@
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;
@@ -1,26 +0,0 @@
1
- import { CPlugin } from '../core/pluginManager';
2
- import { ComponentLibPlugin } from './ComponentLibrary';
3
- import { DesignerPlugin } from './Designer';
4
- import { OutlineTreePlugin } from './OutlineTree';
5
- import { RightPanelPlugin } from './RightPanel';
6
- import { GlobalStatePanelPlugin } from './GlobalStatePanel';
7
- import { DisplaySourceSchema } from './DisplaySourceSchema';
8
- import { HistoryPlugin } from './History';
9
-
10
- export const DEFAULT_PLUGIN_LIST: CPlugin[] = [
11
- DesignerPlugin,
12
- OutlineTreePlugin,
13
- ComponentLibPlugin,
14
- GlobalStatePanelPlugin,
15
- RightPanelPlugin,
16
- HistoryPlugin,
17
- ];
18
-
19
- export {
20
- DesignerPlugin,
21
- ComponentLibPlugin,
22
- RightPanelPlugin,
23
- GlobalStatePanelPlugin,
24
- HistoryPlugin,
25
- DisplaySourceSchema,
26
- };
@@ -1,50 +0,0 @@
1
- import React from 'react';
2
- import PropTypes from 'prop-types';
3
- import './button.css';
4
-
5
- /**
6
- * Primary UI component for user interaction
7
- */
8
- export const Button = ({ primary, backgroundColor, size, label, ...props }) => {
9
- const mode = primary ? 'storybook-button--primary' : 'storybook-button--secondary';
10
- return (
11
- <button
12
- type="button"
13
- className={['storybook-button', `storybook-button--${size}`, mode].join(' ')}
14
- style={backgroundColor && { backgroundColor }}
15
- {...props}
16
- >
17
- {label}
18
- </button>
19
- );
20
- };
21
-
22
- Button.propTypes = {
23
- /**
24
- * Is this the principal call to action on the page?
25
- */
26
- primary: PropTypes.bool,
27
- /**
28
- * What background color to use
29
- */
30
- backgroundColor: PropTypes.string,
31
- /**
32
- * How large should the button be?
33
- */
34
- size: PropTypes.oneOf(['small', 'medium', 'large']),
35
- /**
36
- * Button contents
37
- */
38
- label: PropTypes.string.isRequired,
39
- /**
40
- * Optional click handler
41
- */
42
- onClick: PropTypes.func,
43
- };
44
-
45
- Button.defaultProps = {
46
- backgroundColor: null,
47
- primary: false,
48
- size: 'medium',
49
- onClick: undefined,
50
- };