@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
- .engineContainer {
2
- color: $fontColor;
3
- font-size: $fontSize;
4
- width: 100%;
5
- height: 100%;
6
- overflow: hidden;
7
- * {
8
- box-sizing: border-box;
9
- }
10
- }
@@ -1,5 +0,0 @@
1
- import globalClassNames from './style.d';
2
- declare const classNames: typeof globalClassNames & {
3
- readonly engineContainer: 'engineContainer';
4
- };
5
- export = classNames;
@@ -1,22 +0,0 @@
1
- html,
2
- body,
3
- #root {
4
- width: 100%;
5
- height: 100%;
6
- overflow: hidden;
7
- }
8
-
9
- body {
10
- margin: 0;
11
- padding: 0;
12
- }
13
-
14
- .logo {
15
- height: 100%;
16
- font-size: 20px;
17
- display: flex;
18
- align-items: center;
19
- margin-left: 20px;
20
- font-weight: bolder;
21
- margin-right: auto;
22
- }
@@ -1,5 +0,0 @@
1
- import ReactDOMClient from 'react-dom/client';
2
- import { RouterProvider } from 'react-router-dom';
3
- import { router } from './router';
4
-
5
- ReactDOMClient.createRoot(document.getElementById('root') as HTMLElement).render(<RouterProvider router={router} />);
@@ -1,198 +0,0 @@
1
- import { BasePage, Material } from '@chamn/demo-page';
2
- import { Button, message, Modal } from 'antd';
3
- import React, { useCallback, useEffect, useState } from 'react';
4
- import ReactDOM from 'react-dom';
5
- import ReactDOMClient from 'react-dom/client';
6
- import { Engine, EnginContext } from '../../..';
7
- import '../../index.css';
8
- import { DEFAULT_PLUGIN_LIST } from '../../../plugins';
9
- import { DesignerExports } from '../../../plugins/Designer';
10
- import { DisplaySourceSchema } from '../../../plugins/DisplaySourceSchema';
11
- import { InnerComponentMeta } from '../../../material/innerMaterial';
12
- import { RollbackOutlined } from '@ant-design/icons';
13
-
14
- const win = window as any;
15
- win.React = React;
16
- win.ReactDOM = ReactDOM;
17
- win.ReactDOMClient = ReactDOMClient;
18
-
19
- const assetPackagesList = [
20
- {
21
- package: '@chamn/mock-material',
22
- globalName: 'antd',
23
- resources: [
24
- {
25
- src: 'https://cdn.bootcdn.net/ajax/libs/antd/5.1.2/reset.css',
26
- },
27
- {
28
- src: 'https://cdn.bootcdn.net/ajax/libs/dayjs/1.11.7/dayjs.min.js',
29
- },
30
- {
31
- src: 'https://cdn.bootcdn.net/ajax/libs/antd/5.1.2/antd.js',
32
- },
33
- ],
34
- },
35
- ];
36
-
37
- export const App = () => {
38
- const [ready, setReady] = useState(false);
39
- const [page, setPage] = useState(BasePage);
40
-
41
- useEffect(() => {
42
- const localPage = localStorage.getItem('pageSchema');
43
- if (localPage) {
44
- setPage(JSON.parse(localPage));
45
- }
46
- setReady(true);
47
- }, []);
48
- const onReady = useCallback(async (ctx: EnginContext) => {
49
- const designer = await ctx.pluginManager.onPluginReadyOk('Designer');
50
- const reloadPage = async () => {
51
- setTimeout(() => {
52
- const designerExports = designer?.exports as DesignerExports;
53
- console.log('to reload');
54
- designerExports.reload();
55
- }, 0);
56
- };
57
-
58
- const workbench = ctx.engine.getWorkbench();
59
-
60
- workbench?.replaceTopBarView(
61
- <div
62
- style={{
63
- width: '100%',
64
- height: '100%',
65
- display: 'flex',
66
- alignItems: 'center',
67
- justifyContent: 'flex-end',
68
- paddingRight: '10px',
69
- }}
70
- >
71
- <div className="logo">Chameleon EG</div>
72
- <a target="_blank" href="https://hlerenow.github.io/chameleon/documents/" rel="noreferrer">
73
- <Button style={{ marginRight: '10px' }}>Documents </Button>
74
- </a>
75
- <a target="_blank" href="https://github.com/hlerenow/chameleon" rel="noreferrer">
76
- <Button style={{ marginRight: '10px' }}>Github </Button>
77
- </a>
78
-
79
- <Button
80
- style={{ marginRight: '10px' }}
81
- onClick={async () => {
82
- const res = await ctx.pluginManager.get('History');
83
- res?.exports.preStep();
84
- }}
85
- >
86
- <RollbackOutlined />
87
- </Button>
88
- <Button
89
- style={{ marginRight: '10px' }}
90
- onClick={async () => {
91
- const res = await ctx.pluginManager.get('History');
92
- res?.exports.nextStep();
93
- }}
94
- >
95
- <RollbackOutlined
96
- style={{
97
- transform: 'rotateY(180deg)',
98
- }}
99
- />
100
- </Button>
101
-
102
- <DisplaySourceSchema pageModel={ctx.engine.pageModel} engineCtx={ctx}>
103
- <Button style={{ marginRight: '10px' }}>Source Code</Button>
104
- </DisplaySourceSchema>
105
-
106
- <Button
107
- style={{ marginRight: '10px' }}
108
- onClick={() => {
109
- reloadPage();
110
- }}
111
- >
112
- Refresh Page
113
- </Button>
114
- <Button
115
- style={{ marginRight: '10px' }}
116
- onClick={() => {
117
- let src = '/#/preview';
118
- if (location.href.includes('hlerenow')) {
119
- src = '/chameleon/#/preview';
120
- }
121
-
122
- Modal.info({
123
- closable: true,
124
- icon: null,
125
- width: 'calc(100vw - 100px)',
126
- centered: true,
127
- title: (
128
- <div>
129
- Preview
130
- <Button
131
- size="small"
132
- style={{
133
- float: 'right',
134
- marginRight: '30px',
135
- }}
136
- onClick={() => {
137
- window.open(src);
138
- }}
139
- >
140
- Open in new window
141
- </Button>
142
- </div>
143
- ),
144
- content: (
145
- <div
146
- style={{
147
- width: '100%',
148
- height: 'calc(100vh - 200px)',
149
- }}
150
- >
151
- <iframe
152
- style={{
153
- border: '1px solid #e7e7e7',
154
- width: '100%',
155
- height: '100%',
156
- borderRadius: '4px',
157
- overflow: 'hidden',
158
- }}
159
- src={src}
160
- />
161
- </div>
162
- ),
163
- footer: null,
164
- });
165
- }}
166
- >
167
- Preview
168
- </Button>
169
- <Button
170
- type="primary"
171
- onClick={() => {
172
- const newPage = ctx.engine.pageModel.export();
173
- localStorage.setItem('pageSchema', JSON.stringify(newPage));
174
- message.success('Save successfully');
175
- }}
176
- >
177
- Save
178
- </Button>
179
- </div>
180
- );
181
- }, []);
182
-
183
- if (!ready) {
184
- return <>loading...</>;
185
- }
186
-
187
- return (
188
- <Engine
189
- plugins={DEFAULT_PLUGIN_LIST}
190
- schema={page as any}
191
- // 传入组件物料
192
- material={[...InnerComponentMeta, ...Material]}
193
- // 船队组件物料对应的 js 运行库,只能使用 umd 模式的 js
194
- assetPackagesList={assetPackagesList}
195
- onReady={onReady}
196
- />
197
- );
198
- };
@@ -1,274 +0,0 @@
1
- import { BasePage, BasePageBClient, EmptyPage, Material } from '@chamn/demo-page';
2
- import { Button, message, Modal } from 'antd';
3
- import React, { useCallback, useEffect, useState } from 'react';
4
- import ReactDOM from 'react-dom';
5
- import ReactDOMClient from 'react-dom/client';
6
- import { Engine, EnginContext } from '../../..';
7
- import '../../index.css';
8
- import { DEFAULT_PLUGIN_LIST } from '../../../plugins';
9
- import { DesignerExports } from '../../../plugins/Designer';
10
- import { DisplaySourceSchema } from '../../../plugins/DisplaySourceSchema';
11
- import { AssetPackage } from '@chamn/model';
12
- import { InnerComponentMeta } from '../../../material/innerMaterial';
13
- import { RollbackOutlined } from '@ant-design/icons';
14
- import { collectVariable, flatObject, LayoutPropsType } from '@chamn/layout';
15
-
16
- const win = window as any;
17
- win.React = React;
18
- win.ReactDOM = ReactDOM;
19
- win.ReactDOMClient = ReactDOMClient;
20
-
21
- const beforeInitRender: LayoutPropsType['beforeInitRender'] = async ({ iframe }) => {
22
- const subWin = iframe.getWindow();
23
- if (!subWin) {
24
- return;
25
- }
26
- subWin.React = React;
27
- (subWin as any).ReactDOM = ReactDOM;
28
- (subWin as any).ReactDOMClient = ReactDOMClient;
29
- };
30
-
31
- const customRender: LayoutPropsType['customRender'] = async ({
32
- iframe: iframeContainer,
33
- assets,
34
- page,
35
- pageModel,
36
- ready,
37
- }) => {
38
- await iframeContainer.injectJS('./render.umd.js');
39
- const iframeWindow = iframeContainer.getWindow()!;
40
- const iframeDoc = iframeContainer.getDocument()!;
41
- const IframeReact = iframeWindow.React!;
42
- const IframeReactDOM = iframeWindow.ReactDOMClient!;
43
- const CRender = iframeWindow.CRender!;
44
-
45
- // 注入组件物料资源
46
- const assetLoader = new CRender.AssetLoader(assets, {
47
- window: iframeContainer.getWindow()!,
48
- });
49
- assetLoader
50
- .onSuccess(() => {
51
- // 从子窗口获取物料对象
52
- const componentCollection = collectVariable(assets, iframeWindow);
53
- const components = flatObject(componentCollection);
54
-
55
- const App = IframeReact?.createElement(CRender.DesignRender, {
56
- adapter: CRender?.ReactAdapter,
57
- page: page,
58
- pageModel: pageModel,
59
- components,
60
- onMount: (designRenderInstance) => {
61
- ready(designRenderInstance);
62
- },
63
- });
64
-
65
- IframeReactDOM.createRoot(iframeDoc.getElementById('app')!).render(App);
66
- })
67
- .onError(() => {
68
- console.log('资源加载出粗');
69
- })
70
- .load();
71
- };
72
-
73
- const assets: AssetPackage[] = [
74
- {
75
- package: 'antd',
76
- globalName: 'antd',
77
- resources: [
78
- {
79
- src: 'https://cdn.bootcdn.net/ajax/libs/antd/5.1.2/reset.css',
80
- },
81
- {
82
- src: 'https://cdn.bootcdn.net/ajax/libs/dayjs/1.11.7/dayjs.min.js',
83
- },
84
- {
85
- src: 'https://cdn.bootcdn.net/ajax/libs/antd/5.1.2/antd.js',
86
- },
87
- ],
88
- },
89
- ];
90
-
91
- const assetPackagesList = [
92
- {
93
- package: '@chamn/mock-material',
94
- globalName: 'antd',
95
- resources: [
96
- {
97
- src: 'https://cdn.bootcdn.net/ajax/libs/antd/5.1.2/reset.css',
98
- },
99
- {
100
- src: 'https://cdn.bootcdn.net/ajax/libs/dayjs/1.11.7/dayjs.min.js',
101
- },
102
- {
103
- src: 'https://cdn.bootcdn.net/ajax/libs/antd/5.1.2/antd.js',
104
- },
105
- ],
106
- },
107
- ];
108
-
109
- export const App = () => {
110
- const [ready, setReady] = useState(false);
111
- const [page, setPage] = useState(BasePage);
112
-
113
- useEffect(() => {
114
- const localPage = localStorage.getItem('pageSchema');
115
- if (localPage) {
116
- setPage(JSON.parse(localPage));
117
- }
118
- setReady(true);
119
- }, []);
120
- const onReady = useCallback(async (ctx: EnginContext) => {
121
- const designer = await ctx.pluginManager.onPluginReadyOk('Designer');
122
- const reloadPage = async () => {
123
- setTimeout(() => {
124
- const designerExports = designer?.exports as DesignerExports;
125
- console.log('to reload');
126
- designerExports.reload({
127
- assets,
128
- });
129
- }, 0);
130
- };
131
-
132
- reloadPage();
133
-
134
- const workbench = ctx.engine.getWorkbench();
135
-
136
- workbench?.replaceTopBarView(
137
- <div
138
- style={{
139
- width: '100%',
140
- height: '100%',
141
- display: 'flex',
142
- alignItems: 'center',
143
- justifyContent: 'flex-end',
144
- paddingRight: '10px',
145
- }}
146
- >
147
- <a target="_blank" href="https://github.com/hlerenow/chameleon" rel="noreferrer">
148
- <Button style={{ marginRight: '10px' }}>Github </Button>
149
- </a>
150
-
151
- <Button
152
- style={{ marginRight: '10px' }}
153
- onClick={async () => {
154
- const res = await ctx.pluginManager.get('History');
155
- res?.exports.preStep();
156
- }}
157
- >
158
- <RollbackOutlined />
159
- </Button>
160
- <Button
161
- style={{ marginRight: '10px' }}
162
- onClick={async () => {
163
- const res = await ctx.pluginManager.get('History');
164
- res?.exports.nextStep();
165
- }}
166
- >
167
- <RollbackOutlined
168
- style={{
169
- transform: 'rotateY(180deg)',
170
- }}
171
- />
172
- </Button>
173
-
174
- <DisplaySourceSchema pageModel={ctx.engine.pageModel} engineCtx={ctx}>
175
- <Button style={{ marginRight: '10px' }}>Source Code</Button>
176
- </DisplaySourceSchema>
177
-
178
- <Button
179
- style={{ marginRight: '10px' }}
180
- onClick={() => {
181
- reloadPage();
182
- }}
183
- >
184
- Refresh Page
185
- </Button>
186
- <Button
187
- style={{ marginRight: '10px' }}
188
- onClick={() => {
189
- let src = '/#/preview';
190
- if (location.href.includes('hlerenow')) {
191
- src = '/chameleon/#/preview';
192
- }
193
-
194
- Modal.info({
195
- closable: true,
196
- icon: null,
197
- width: 'calc(100vw - 100px)',
198
- centered: true,
199
- title: (
200
- <div>
201
- Preview
202
- <Button
203
- size="small"
204
- style={{
205
- float: 'right',
206
- marginRight: '30px',
207
- }}
208
- onClick={() => {
209
- window.open(src);
210
- }}
211
- >
212
- Open in new window
213
- </Button>
214
- </div>
215
- ),
216
- content: (
217
- <div
218
- style={{
219
- width: '100%',
220
- height: 'calc(100vh - 200px)',
221
- }}
222
- >
223
- <iframe
224
- style={{
225
- border: '1px solid #e7e7e7',
226
- width: '100%',
227
- height: '100%',
228
- borderRadius: '4px',
229
- overflow: 'hidden',
230
- }}
231
- src={src}
232
- />
233
- </div>
234
- ),
235
- footer: null,
236
- });
237
- }}
238
- >
239
- Preview
240
- </Button>
241
- <Button
242
- type="primary"
243
- onClick={() => {
244
- const newPage = ctx.engine.pageModel.export();
245
- localStorage.setItem('pageSchema', JSON.stringify(newPage));
246
- message.success('Save successfully');
247
- }}
248
- >
249
- Save
250
- </Button>
251
- </div>
252
- );
253
- }, []);
254
-
255
- if (!ready) {
256
- return <>loading...</>;
257
- }
258
- return (
259
- <Engine
260
- plugins={DEFAULT_PLUGIN_LIST}
261
- schema={page as any}
262
- material={[...InnerComponentMeta, ...Material]}
263
- assetPackagesList={assetPackagesList}
264
- onReady={onReady}
265
- beforePluginRun={({ pluginManager }) => {
266
- pluginManager.customPlugin('Designer', (pluginInstance) => {
267
- pluginInstance.ctx.config.beforeInitRender = beforeInitRender;
268
- pluginInstance.ctx.config.customRender = customRender;
269
- return pluginInstance;
270
- });
271
- }}
272
- />
273
- );
274
- };
@@ -1,56 +0,0 @@
1
- import React from 'react';
2
- import { useEffect, useState } from 'react';
3
- import { ReactAdapter, Render, useRender, AssetLoader, collectVariable, flatObject } from '@chamn/render';
4
- import { AssetPackage, CPageDataType } from '@chamn/model';
5
-
6
- const loadAssets = async (assets: AssetPackage[]) => {
7
- // 注入组件物料资源
8
- const assetLoader = new AssetLoader(assets);
9
- try {
10
- await assetLoader.load();
11
- // 从子窗口获取物料对象
12
- const componentCollection = collectVariable(assets, window);
13
- const components = flatObject(componentCollection);
14
- return components;
15
- } catch (e) {
16
- return null;
17
- }
18
- };
19
-
20
- export const Preview = () => {
21
- const [page, setPage] = useState<CPageDataType>();
22
- const renderHandle = useRender();
23
- const [loading, setLoading] = useState(true);
24
- const [pageComponents, setPageComponents] = useState({});
25
- const loadPageAssets = async (assets: AssetPackage[]) => {
26
- const components = await loadAssets(assets);
27
- if (components) {
28
- setPageComponents(components);
29
- setLoading(false);
30
- }
31
- };
32
- useEffect(() => {
33
- const localPage = localStorage.getItem('pageSchema');
34
- if (localPage) {
35
- const page: CPageDataType = JSON.parse(localPage);
36
- setPage(page);
37
- loadPageAssets(page.assets || []);
38
- }
39
- }, []);
40
-
41
- if (loading) {
42
- return <>Not find page info on local, please ensure you save it on editor</>;
43
- }
44
- return (
45
- <div className="App" style={{ overflow: 'auto', height: '100%' }}>
46
- <Render
47
- page={page}
48
- components={{
49
- ...pageComponents,
50
- }}
51
- render={renderHandle}
52
- adapter={ReactAdapter}
53
- />
54
- </div>
55
- );
56
- };
@@ -1,3 +0,0 @@
1
- import * as CRender from '@chamn/render';
2
-
3
- export default CRender;
@@ -1,14 +0,0 @@
1
- import { createHashRouter } from 'react-router-dom';
2
- import { App } from './page/Editor';
3
- import { Preview } from './page/Preview';
4
-
5
- export const router: any = createHashRouter([
6
- {
7
- path: '/',
8
- element: <App />,
9
- },
10
- {
11
- path: '/preview',
12
- element: <Preview />,
13
- },
14
- ]);
@@ -1,4 +0,0 @@
1
- <svg xmlns="http://www.w3.org/2000/svg"
2
- xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" class="iconify iconify--logos" width="35.93" height="32" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 228">
3
- <path fill="#00D8FF" d="M210.483 73.824a171.49 171.49 0 0 0-8.24-2.597c.465-1.9.893-3.777 1.273-5.621c6.238-30.281 2.16-54.676-11.769-62.708c-13.355-7.7-35.196.329-57.254 19.526a171.23 171.23 0 0 0-6.375 5.848a155.866 155.866 0 0 0-4.241-3.917C100.759 3.829 77.587-4.822 63.673 3.233C50.33 10.957 46.379 33.89 51.995 62.588a170.974 170.974 0 0 0 1.892 8.48c-3.28.932-6.445 1.924-9.474 2.98C17.309 83.498 0 98.307 0 113.668c0 15.865 18.582 31.778 46.812 41.427a145.52 145.52 0 0 0 6.921 2.165a167.467 167.467 0 0 0-2.01 9.138c-5.354 28.2-1.173 50.591 12.134 58.266c13.744 7.926 36.812-.22 59.273-19.855a145.567 145.567 0 0 0 5.342-4.923a168.064 168.064 0 0 0 6.92 6.314c21.758 18.722 43.246 26.282 56.54 18.586c13.731-7.949 18.194-32.003 12.4-61.268a145.016 145.016 0 0 0-1.535-6.842c1.62-.48 3.21-.974 4.76-1.488c29.348-9.723 48.443-25.443 48.443-41.52c0-15.417-17.868-30.326-45.517-39.844Zm-6.365 70.984c-1.4.463-2.836.91-4.3 1.345c-3.24-10.257-7.612-21.163-12.963-32.432c5.106-11 9.31-21.767 12.459-31.957c2.619.758 5.16 1.557 7.61 2.4c23.69 8.156 38.14 20.213 38.14 29.504c0 9.896-15.606 22.743-40.946 31.14Zm-10.514 20.834c2.562 12.94 2.927 24.64 1.23 33.787c-1.524 8.219-4.59 13.698-8.382 15.893c-8.067 4.67-25.32-1.4-43.927-17.412a156.726 156.726 0 0 1-6.437-5.87c7.214-7.889 14.423-17.06 21.459-27.246c12.376-1.098 24.068-2.894 34.671-5.345a134.17 134.17 0 0 1 1.386 6.193ZM87.276 214.515c-7.882 2.783-14.16 2.863-17.955.675c-8.075-4.657-11.432-22.636-6.853-46.752a156.923 156.923 0 0 1 1.869-8.499c10.486 2.32 22.093 3.988 34.498 4.994c7.084 9.967 14.501 19.128 21.976 27.15a134.668 134.668 0 0 1-4.877 4.492c-9.933 8.682-19.886 14.842-28.658 17.94ZM50.35 144.747c-12.483-4.267-22.792-9.812-29.858-15.863c-6.35-5.437-9.555-10.836-9.555-15.216c0-9.322 13.897-21.212 37.076-29.293c2.813-.98 5.757-1.905 8.812-2.773c3.204 10.42 7.406 21.315 12.477 32.332c-5.137 11.18-9.399 22.249-12.634 32.792a134.718 134.718 0 0 1-6.318-1.979Zm12.378-84.26c-4.811-24.587-1.616-43.134 6.425-47.789c8.564-4.958 27.502 2.111 47.463 19.835a144.318 144.318 0 0 1 3.841 3.545c-7.438 7.987-14.787 17.08-21.808 26.988c-12.04 1.116-23.565 2.908-34.161 5.309a160.342 160.342 0 0 1-1.76-7.887Zm110.427 27.268a347.8 347.8 0 0 0-7.785-12.803c8.168 1.033 15.994 2.404 23.343 4.08c-2.206 7.072-4.956 14.465-8.193 22.045a381.151 381.151 0 0 0-7.365-13.322Zm-45.032-43.861c5.044 5.465 10.096 11.566 15.065 18.186a322.04 322.04 0 0 0-30.257-.006c4.974-6.559 10.069-12.652 15.192-18.18ZM82.802 87.83a323.167 323.167 0 0 0-7.227 13.238c-3.184-7.553-5.909-14.98-8.134-22.152c7.304-1.634 15.093-2.97 23.209-3.984a321.524 321.524 0 0 0-7.848 12.897Zm8.081 65.352c-8.385-.936-16.291-2.203-23.593-3.793c2.26-7.3 5.045-14.885 8.298-22.6a321.187 321.187 0 0 0 7.257 13.246c2.594 4.48 5.28 8.868 8.038 13.147Zm37.542 31.03c-5.184-5.592-10.354-11.779-15.403-18.433c4.902.192 9.899.29 14.978.29c5.218 0 10.376-.117 15.453-.343c-4.985 6.774-10.018 12.97-15.028 18.486Zm52.198-57.817c3.422 7.8 6.306 15.345 8.596 22.52c-7.422 1.694-15.436 3.058-23.88 4.071a382.417 382.417 0 0 0 7.859-13.026a347.403 347.403 0 0 0 7.425-13.565Zm-16.898 8.101a358.557 358.557 0 0 1-12.281 19.815a329.4 329.4 0 0 1-23.444.823c-7.967 0-15.716-.248-23.178-.732a310.202 310.202 0 0 1-12.513-19.846h.001a307.41 307.41 0 0 1-10.923-20.627a310.278 310.278 0 0 1 10.89-20.637l-.001.001a307.318 307.318 0 0 1 12.413-19.761c7.613-.576 15.42-.876 23.31-.876H128c7.926 0 15.743.303 23.354.883a329.357 329.357 0 0 1 12.335 19.695a358.489 358.489 0 0 1 11.036 20.54a329.472 329.472 0 0 1-11 20.722Zm22.56-122.124c8.572 4.944 11.906 24.881 6.52 51.026c-.344 1.668-.73 3.367-1.15 5.09c-10.622-2.452-22.155-4.275-34.23-5.408c-7.034-10.017-14.323-19.124-21.64-27.008a160.789 160.789 0 0 1 5.888-5.4c18.9-16.447 36.564-22.941 44.612-18.3ZM128 90.808c12.625 0 22.86 10.235 22.86 22.86s-10.235 22.86-22.86 22.86s-22.86-10.235-22.86-22.86s10.235-22.86 22.86-22.86Z"></path>
4
- </svg>
@@ -1,15 +0,0 @@
1
- @use 'sass:color';
2
- $baseColor: #1677ff;
3
- /* base style variables */
4
- $borderColor: rgb(233 233 233);
5
- $baseBackgroundColor: #edeff3;
6
- $fontSizeBigger: 16px;
7
- $fontSize: 14px;
8
- $fontSizeSmall: 12px;
9
-
10
- $fontColor: rgb(104, 104, 104);
11
-
12
- $hoverColor: rgba(22, 119, 255, 0.3);
13
- $textColor: $fontColor;
14
-
15
- $borderRadius: 2px;