@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,50 +0,0 @@
1
- import React from 'react';
2
- import { SnippetsType } from '@chamn/model';
3
- import { Collapse } from 'antd';
4
- import { DragComponentItem } from '../DragItem';
5
- import styles from './style.module.scss';
6
- const { Panel } = Collapse;
7
-
8
- export type ListViewProps = {
9
- dataSource: {
10
- name: string;
11
- list: SnippetsType[];
12
- }[];
13
- };
14
- export const ListView = (props: ListViewProps) => {
15
- const { dataSource } = props;
16
- const defaultActiveKey = dataSource.map((el) => el.name || '');
17
- if (!dataSource.length) {
18
- return null;
19
- }
20
- return (
21
- <div className={styles.ListBox}>
22
- <Collapse style={{ width: '100%' }} defaultActiveKey={defaultActiveKey}>
23
- {dataSource.map((el) => {
24
- const category = el.name || '';
25
- const contentView = (
26
- <div className={styles.collapsePanel}>
27
- {el.list.map((it) => {
28
- return (
29
- <DragComponentItem
30
- id={it.id!}
31
- key={it.id!}
32
- name={it.title}
33
- icon={it.snapshot || it.snapshotText}
34
- iconText={it.snapshotText}
35
- description={it.description || ''}
36
- />
37
- );
38
- })}
39
- </div>
40
- );
41
- return (
42
- <Panel header={category} key={category}>
43
- {contentView}
44
- </Panel>
45
- );
46
- })}
47
- </Collapse>
48
- </div>
49
- );
50
- };
@@ -1,27 +0,0 @@
1
- .ListBox {
2
- display: flex;
3
- flex-wrap: wrap;
4
- :global {
5
- .ant-collapse .ant-collapse-content > .ant-collapse-content-box {
6
- padding: 0;
7
- }
8
- .ant-collapse {
9
- border: none;
10
- background-color: white;
11
- }
12
- .ant-collapse-header {
13
- padding: 10px 16px !important;
14
- }
15
- .ant-collapse-expand-icon {
16
- padding-inline-end: 0 !important;
17
- }
18
- .ant-collapse-item {
19
- border-color: $borderColor;
20
- }
21
- }
22
- }
23
-
24
- .collapsePanel {
25
- display: flex;
26
- flex-wrap: wrap;
27
- }
@@ -1,12 +0,0 @@
1
- import globalClassNames from '../../../../style.d';
2
- declare const classNames: typeof globalClassNames & {
3
- readonly ListBox: 'ListBox';
4
- readonly 'ant-collapse': 'ant-collapse';
5
- readonly 'ant-collapse-content': 'ant-collapse-content';
6
- readonly 'ant-collapse-content-box': 'ant-collapse-content-box';
7
- readonly 'ant-collapse-header': 'ant-collapse-header';
8
- readonly 'ant-collapse-expand-icon': 'ant-collapse-expand-icon';
9
- readonly 'ant-collapse-item': 'ant-collapse-item';
10
- readonly collapsePanel: 'collapsePanel';
11
- };
12
- export = classNames;
@@ -1,184 +0,0 @@
1
- import React from 'react';
2
- import { AppstoreAddOutlined } from '@ant-design/icons';
3
- import { LayoutDragAndDropExtraDataType, Sensor, SensorEventObjType } from '@chamn/layout';
4
- import { Tabs } from 'antd';
5
- import { CPlugin, CPluginCtx } from '../../core/pluginManager';
6
- import { DesignerExports } from '../Designer';
7
- import localize from './localize';
8
- import styles from './style.module.scss';
9
- import { withTranslation, WithTranslation } from 'react-i18next';
10
- import { ListView } from './components/ListView';
11
- import { getTargetMNodeKeyVal } from './util';
12
- import { DRAG_ITEM_KEY } from './components/DragItem';
13
- import { SnippetsCollection } from '@chamn/model';
14
- import { capitalize } from 'lodash-es';
15
-
16
- interface ComponentLibViewProps extends WithTranslation {
17
- pluginCtx: CPluginCtx;
18
- }
19
-
20
- export const PLUGIN_NAME = 'ComponentLib';
21
- const i18nNamespace = `plugin:${PLUGIN_NAME}`;
22
-
23
- const TabTitle = ({ children }: { children: any }) => {
24
- return <div className={styles.tabTitle}>{children}</div>;
25
- };
26
-
27
- type ComponentLibViewState = {
28
- componentsList: SnippetsCollection;
29
- };
30
- class ComponentLibView extends React.Component<ComponentLibViewProps, ComponentLibViewState> {
31
- containerRef: React.RefObject<HTMLDivElement>;
32
- disposeList: (() => void)[] = [];
33
- constructor(props: ComponentLibViewProps) {
34
- super(props);
35
- this.containerRef = React.createRef<HTMLDivElement>();
36
- this.state = {
37
- componentsList: [],
38
- };
39
- }
40
-
41
- leftPanelVisibleCb = async ({ visible, panelName }: { visible: boolean; panelName: string }) => {
42
- await this.props.pluginCtx.pluginManager.onPluginReadyOk('Designer');
43
- if (panelName === PLUGIN_NAME && visible) {
44
- this.registerDragEvent();
45
- }
46
- };
47
-
48
- async componentDidMount() {
49
- const { pluginCtx } = this.props;
50
- const { pageModel, i18n } = pluginCtx;
51
- const { materialsModel } = pageModel;
52
- await this.props.pluginCtx.pluginManager.onPluginReadyOk('Designer');
53
- this.registerDragEvent();
54
-
55
- Object.keys(localize).forEach((lng) => {
56
- i18n.addResourceBundle(lng, i18nNamespace, localize[lng], true, true);
57
- });
58
-
59
- i18n.update();
60
- const allSnippets = materialsModel.getAllSnippets();
61
- this.setState({
62
- componentsList: allSnippets,
63
- });
64
- }
65
-
66
- componentWillUnmount(): void {
67
- this.disposeList.map((el) => el());
68
- }
69
-
70
- registerDragEvent = async () => {
71
- const { containerRef } = this;
72
- const { pluginCtx } = this.props;
73
- const designerHandle = await pluginCtx.pluginManager.get('Designer');
74
-
75
- if (!designerHandle) {
76
- return;
77
- }
78
- if (!containerRef.current) {
79
- return;
80
- }
81
- const pageModel = pluginCtx.pageModel;
82
- const designerExports: DesignerExports = designerHandle.exports;
83
- const dnd = designerExports.getDnd();
84
- const boxSensor = new Sensor({
85
- name: 'ComponentListBox',
86
- container: containerRef.current,
87
- });
88
-
89
- boxSensor.setCanDrag((eventObj: SensorEventObjType) => {
90
- const targetDom = eventObj.event.target;
91
- if (!targetDom) {
92
- return;
93
- }
94
- const targetNodeId = getTargetMNodeKeyVal(targetDom as HTMLElement, DRAG_ITEM_KEY);
95
-
96
- if (!targetNodeId) {
97
- return;
98
- }
99
-
100
- const meta = pageModel.materialsModel.findSnippetById(targetNodeId);
101
- if (!meta) {
102
- return;
103
- }
104
- const newNode = pageModel?.createNode(meta.schema);
105
-
106
- this.props.pluginCtx.pluginManager.get('Designer').then((designerHandle) => {
107
- const designerExports: DesignerExports = designerHandle?.exports;
108
- designerExports.selectNode('');
109
- });
110
-
111
- return {
112
- ...eventObj,
113
- extraData: {
114
- type: 'NEW_ADD',
115
- startNode: newNode,
116
- } as LayoutDragAndDropExtraDataType,
117
- };
118
- });
119
- dnd.registerSensor(boxSensor);
120
-
121
- const dragStart = () => {
122
- const { getWorkbench } = this.props.pluginCtx;
123
- const workbench = getWorkbench();
124
- if (!workbench.state.leftBoxFixed) {
125
- workbench.closeLeftPanel();
126
- }
127
- };
128
-
129
- this.disposeList.push(() => {
130
- dnd.emitter.off('dragStart', dragStart);
131
- });
132
- dnd.emitter.on('dragStart', dragStart);
133
- };
134
-
135
- render(): React.ReactNode {
136
- const { componentsList } = this.state;
137
- const items = componentsList.map((el) => {
138
- return {
139
- label: <TabTitle>{capitalize(el.name)}</TabTitle>,
140
- key: el.name,
141
- children: <ListView dataSource={el.list} />,
142
- };
143
- });
144
- return (
145
- <div ref={this.containerRef} className={styles.container}>
146
- <Tabs
147
- defaultActiveKey="BaseComponent"
148
- items={items}
149
- style={{
150
- flex: 1,
151
- }}
152
- />
153
- </div>
154
- );
155
- }
156
- }
157
-
158
- export const ComponentLibPlugin: CPlugin = {
159
- name: PLUGIN_NAME,
160
- async init(ctx) {
161
- const ComponentLibViewWithLocalize = withTranslation(i18nNamespace)(ComponentLibView);
162
- const Title = withTranslation(i18nNamespace)(({ t }) => {
163
- return <>{t('pluginName')}</>;
164
- });
165
- const workbench = ctx.getWorkbench();
166
- workbench.addLeftPanel({
167
- title: <Title />,
168
- name: 'ComponentLib',
169
- icon: <AppstoreAddOutlined />,
170
- render: <ComponentLibViewWithLocalize pluginCtx={ctx} />,
171
- });
172
- },
173
- async destroy(ctx) {
174
- console.log('destroy', ctx);
175
- },
176
- exports: (ctx) => {
177
- return {};
178
- },
179
- meta: {
180
- engine: {
181
- version: '1.0.0',
182
- },
183
- },
184
- };
@@ -1,3 +0,0 @@
1
- export const en_US: Record<string, any> = {
2
- pluginName: 'Component Store',
3
- };
@@ -1,3 +0,0 @@
1
- import { zh_CN } from './zh_CN';
2
- import { en_US } from './en_US';
3
- export default { zh_CN, en_US } as Record<string, any>;
@@ -1,3 +0,0 @@
1
- export const zh_CN: Record<string, any> = {
2
- pluginName: '组件库',
3
- };
@@ -1,31 +0,0 @@
1
- .container {
2
- width: 100%;
3
- height: 100%;
4
- overflow: hidden;
5
- background-color: white;
6
- display: flex;
7
-
8
- :global {
9
- .ant-tabs .ant-tabs-tab + .ant-tabs-tab {
10
- margin-left: 12px;
11
- }
12
-
13
- .ant-tabs-content.ant-tabs-content-top {
14
- height: 100%;
15
- overflow: auto;
16
- }
17
- .ant-tabs-tab {
18
- padding: 6px 0;
19
- }
20
- .ant-tabs-nav {
21
- margin-bottom: 0;
22
- }
23
- }
24
- }
25
-
26
- .tabTitle {
27
- padding: 0 10px;
28
- font-size: 12px;
29
- font-weight: 400;
30
- text-rendering: optimizeLegibility;
31
- }
@@ -1,11 +0,0 @@
1
- import globalClassNames from '../../style.d';
2
- declare const classNames: typeof globalClassNames & {
3
- readonly container: 'container';
4
- readonly 'ant-tabs': 'ant-tabs';
5
- readonly 'ant-tabs-tab': 'ant-tabs-tab';
6
- readonly 'ant-tabs-content': 'ant-tabs-content';
7
- readonly 'ant-tabs-content-top': 'ant-tabs-content-top';
8
- readonly 'ant-tabs-nav': 'ant-tabs-nav';
9
- readonly tabTitle: 'tabTitle';
10
- };
11
- export = classNames;
@@ -1,14 +0,0 @@
1
- export const getTargetMNodeKeyVal = (
2
- dom: HTMLElement | null,
3
- key: string
4
- ): null | string => {
5
- if (!dom) {
6
- return null;
7
- }
8
- const val = dom.getAttribute(key);
9
- if (!val) {
10
- return getTargetMNodeKeyVal(dom.parentElement, key);
11
- } else {
12
- return val;
13
- }
14
- };
@@ -1,59 +0,0 @@
1
- import { useEffect, useRef } from 'react';
2
- import { CNode, CRootNode } from '@chamn/model';
3
- import { CPluginCtx } from '../../core/pluginManager';
4
- import { CRightPanelItem } from '../RightPanel/view';
5
- import { MonacoEditor, MonacoEditorInstance } from '../../component/MonacoEditor';
6
-
7
- export type ComponentStatePanelProps = {
8
- node: CNode | CRootNode;
9
- pluginCtx: CPluginCtx;
10
- };
11
-
12
- export const ComponentStatePanel = (props: ComponentStatePanelProps) => {
13
- const { node } = props;
14
- const nodeState = node.value.state || {};
15
- const editorRef = useRef<MonacoEditorInstance | null>(null);
16
- useEffect(() => {
17
- const currentState = node.value.state || {};
18
- editorRef?.current?.setValue(JSON.stringify(currentState, null, 2));
19
- }, [node]);
20
-
21
- const onValueChange = (newValStr: string) => {
22
- try {
23
- const newVal = JSON.parse(newValStr);
24
- node.value.state = newVal;
25
- node.updateValue();
26
- } catch (e) {
27
- console.warn(e);
28
- }
29
- };
30
-
31
- return (
32
- <>
33
- <MonacoEditor
34
- initialValue={JSON.stringify(nodeState, null, 2)}
35
- language={'json'}
36
- options={{
37
- automaticLayout: true,
38
- // lineDecorationsWidth: 0,
39
- tabSize: 2,
40
- minimap: { enabled: false },
41
- quickSuggestions: false,
42
- // lineNumbers: 'off',
43
- suggestOnTriggerCharacters: false,
44
- folding: false,
45
- }}
46
- onDidMount={(editor) => {
47
- editorRef.current = editor;
48
- }}
49
- onChange={onValueChange}
50
- />
51
- </>
52
- );
53
- };
54
-
55
- export const ComponentStatePanelConfig: CRightPanelItem = {
56
- key: 'State',
57
- name: 'State',
58
- view: ({ node, pluginCtx }) => <ComponentStatePanel node={node} pluginCtx={pluginCtx} />,
59
- };
@@ -1,94 +0,0 @@
1
- import React, { useState } from 'react';
2
- import { CopyOutlined, DeleteOutlined, EyeInvisibleOutlined } from '@ant-design/icons';
3
- import styles from './style.module.scss';
4
- import { CNode } from '@chamn/model';
5
- import clsx from 'clsx';
6
-
7
- export type DefaultSelectToolBarProps = {
8
- nodeList: CNode[];
9
- toSelectNode: (id: string) => void;
10
- toDelete: (id: string) => void;
11
- toCopy: (idd: string) => void;
12
- toHidden: (idd: string) => void;
13
- };
14
-
15
- const LayoutSelect = ({
16
- dataSource,
17
- children,
18
- onSelect,
19
- }: {
20
- dataSource: { key: string; label: string }[];
21
- children: React.ReactNode;
22
- onSelect: (key: string) => void;
23
- }) => {
24
- const [hover, setHover] = useState(false);
25
- return (
26
- <div className={styles.layoutSelectBox}>
27
- <div className={clsx([styles.hoverBox, hover && styles.hoverBoxActive])}>
28
- {dataSource.map((el) => {
29
- return (
30
- <div className={styles.hoverItem} key={el.key} onClick={() => onSelect(el.key)}>
31
- {el.label}
32
- </div>
33
- );
34
- })}
35
- </div>
36
- <div className={styles.placeholder} onMouseOver={() => setHover(true)} onMouseOut={() => setHover(false)}>
37
- {children}
38
- </div>
39
- </div>
40
- );
41
- };
42
-
43
- export const DefaultSelectToolBar = ({
44
- nodeList,
45
- toSelectNode,
46
- toDelete,
47
- toCopy,
48
- toHidden,
49
- }: DefaultSelectToolBarProps) => {
50
- const tempList = [...nodeList];
51
- const currentNode = tempList.shift();
52
- const parentNodeItems = tempList.map((el) => {
53
- const node = el;
54
- const nodeMeta = node.materialsModel.findByComponentName(node.value.componentName)?.value.title;
55
- const label = node.value.title || nodeMeta || node.value.componentName || '';
56
- return {
57
- key: el.id,
58
- label: label || 'Empty',
59
- };
60
- });
61
-
62
- const copyItem = (
63
- <div className={styles.item} onClick={() => toCopy(currentNode?.id || '')}>
64
- <CopyOutlined />
65
- </div>
66
- );
67
-
68
- const deleteItem = (
69
- <div className={styles.item} onClick={() => toDelete(currentNode?.id || '')}>
70
- <DeleteOutlined />
71
- </div>
72
- );
73
-
74
- const visibleItem = (
75
- <div className={styles.item} onClick={() => toHidden(currentNode?.id || '')}>
76
- <EyeInvisibleOutlined />
77
- </div>
78
- );
79
-
80
- const nodeLayout = (
81
- <LayoutSelect dataSource={parentNodeItems.reverse()} onSelect={toSelectNode}>
82
- <div>{currentNode?.value.title || currentNode?.material?.value.title || 'Empty'}</div>
83
- </LayoutSelect>
84
- );
85
-
86
- return (
87
- <div className={styles.toolBarBox}>
88
- {nodeLayout}
89
- {visibleItem}
90
- {copyItem}
91
- {deleteItem}
92
- </div>
93
- );
94
- };
@@ -1,59 +0,0 @@
1
- .toolBarBox {
2
- display: flex;
3
- margin-bottom: 3px;
4
- margin-right: -2px;
5
- pointer-events: all;
6
- float: right;
7
- }
8
-
9
- .item {
10
- background-color: $baseColor;
11
- color: white;
12
- padding: 2px 3px;
13
- font-size: 12px;
14
- overflow: hidden;
15
- margin-left: 1px;
16
- cursor: pointer;
17
- }
18
-
19
- .layoutSelectBox {
20
- position: relative;
21
- margin-right: 1px;
22
- height: 21px;
23
-
24
- .hoverBox {
25
- transition: all 0.3s;
26
- position: absolute;
27
- left: 0;
28
- top: 0;
29
- white-space: nowrap;
30
- opacity: 0;
31
- transform: translateY(-100%);
32
- pointer-events: none;
33
-
34
- &:hover,
35
- &.hoverBoxActive {
36
- opacity: 1;
37
- pointer-events: all;
38
- }
39
-
40
- .hoverItem {
41
- background-color: $baseColor;
42
- padding: 2px 3px;
43
- color: white;
44
- font-size: 12px;
45
- margin-bottom: 1px;
46
- cursor: pointer;
47
- }
48
- }
49
- .placeholder {
50
- overflow: hidden;
51
- text-overflow: ellipsis;
52
- white-space: nowrap;
53
- background-color: $baseColor;
54
- color: white;
55
- padding: 2px 5px;
56
- font-size: 12px;
57
- max-width: 100px;
58
- }
59
- }
@@ -1,11 +0,0 @@
1
- import globalClassNames from '../../../../style.d';
2
- declare const classNames: typeof globalClassNames & {
3
- readonly toolBarBox: 'toolBarBox';
4
- readonly item: 'item';
5
- readonly layoutSelectBox: 'layoutSelectBox';
6
- readonly hoverBox: 'hoverBox';
7
- readonly hoverBoxActive: 'hoverBoxActive';
8
- readonly hoverItem: 'hoverItem';
9
- readonly placeholder: 'placeholder';
10
- };
11
- export = classNames;
@@ -1,18 +0,0 @@
1
- import React from 'react';
2
- import { CNode, CRootNode } from '@chamn/model';
3
-
4
- export const GhostView = ({ node }: { node: CNode | CRootNode }) => {
5
- return (
6
- <div
7
- style={{
8
- backgroundColor: 'rgba(100,100,100)',
9
- padding: '3px 10px 3px 15px',
10
- borderRadius: '2px',
11
- opacity: 0.9,
12
- color: 'rgba(220,220,220)',
13
- }}
14
- >
15
- {node.value.componentName}
16
- </div>
17
- );
18
- };
@@ -1 +0,0 @@
1
- export const PLUGIN_NAME = 'Designer';
@@ -1,61 +0,0 @@
1
- import React from 'react';
2
- import { DragAndDrop } from '@chamn/layout';
3
- import '@chamn/layout/dist/style.css';
4
- import { CPlugin } from '../../core/pluginManager';
5
- import { PLUGIN_NAME } from './config';
6
- import { Designer } from './view';
7
- import { AssetPackage, CPage, CPageDataType } from '@chamn/model';
8
- import { RenderInstance } from '@chamn/render';
9
-
10
- export const DesignerPlugin: CPlugin = (ctx) => {
11
- const designerRef = React.createRef<Designer>();
12
- return {
13
- name: PLUGIN_NAME,
14
- async init(ctx) {
15
- const workbench = ctx.getWorkbench();
16
- workbench.replaceBodyView(<Designer ref={designerRef} pluginCtx={ctx} />);
17
- },
18
- async destroy(ctx) {
19
- console.log('destroy', ctx);
20
- },
21
- exports: () => {
22
- return {
23
- getDnd: () => {
24
- return designerRef.current?.layoutRef.current?.dnd;
25
- },
26
- selectNode: (nodeId) => {
27
- designerRef.current?.layoutRef.current?.selectNode(nodeId);
28
- },
29
- updatePage: (page: CPageDataType | CPage) => {
30
- designerRef.current?.layoutRef.current?.designRenderRef?.current?.rerender(page);
31
- },
32
- reload: ({ assets } = {}) => {
33
- designerRef.current?.reloadRender({ assets });
34
- },
35
- getComponentInstances: (id: string) => {
36
- return designerRef.current?.layoutRef.current?.designRenderRef.current?.getInstancesById(id) || [];
37
- },
38
- getDynamicComponentInstances: (id: string) => {
39
- const map =
40
- designerRef.current?.layoutRef.current?.designRenderRef.current?.renderRef.current
41
- ?.dynamicComponentInstanceMap;
42
- return map?.get(id) || [];
43
- },
44
- } as DesignerExports;
45
- },
46
- meta: {
47
- engine: {
48
- version: '1.0.0',
49
- },
50
- },
51
- };
52
- };
53
-
54
- export type DesignerExports = {
55
- reload: (params?: { assets?: AssetPackage[] }) => void;
56
- getDnd: () => DragAndDrop;
57
- selectNode: (nodeId: string) => void;
58
- updatePage: (page: CPageDataType) => void;
59
- getComponentInstances: (id: string) => RenderInstance[];
60
- getDynamicComponentInstances: (id: string) => RenderInstance;
61
- };
@@ -1,3 +0,0 @@
1
- export const en_US: Record<string, any> = {
2
- pluginName: 'Component Store',
3
- };
@@ -1,3 +0,0 @@
1
- import { zh_CN } from './zh_CN';
2
- import { en_US } from './en_US';
3
- export default { zh_CN, en_US } as Record<string, any>;
@@ -1,3 +0,0 @@
1
- export const zh_CN: Record<string, any> = {
2
- pluginName: '组件库',
3
- };
@@ -1,10 +0,0 @@
1
- .hoverTips {
2
- display: inline-block;
3
- color: $baseColor;
4
- opacity: 0.9;
5
- font-size: 12px;
6
- margin-bottom: 2px;
7
- background-color: white;
8
- padding: 1px 3px;
9
- border-radius: 2px;
10
- }