From bc8b9f52258f278f409529adc6836146b55865b4 Mon Sep 17 00:00:00 2001 From: roymondchen Date: Thu, 17 Feb 2022 14:47:39 +0800 Subject: [PATCH] refactor: make it public --- .browserslistrc | 3 + .editorconfig | 7 + .eslintignore | 8 + .eslintrc.js | 63 + .gitignore | 24 + .husky/commit-msg | 4 + .husky/pre-commit | 4 + .husky/pre-push | 4 + CONTRIBUTING.md | 136 + LICENSE | 5432 ++++ README.md | 74 + babel.config.js | 3 + commitlint.config.js | 1 + jest.config.js | 15 + lerna.json | 24 + package-lock.json | 20777 ++++++++++++++++ package.json | 71 + packages/core/package.json | 38 + packages/core/src/App.ts | 208 + packages/core/src/Env.ts | 58 + packages/core/src/Node.ts | 67 + packages/core/src/Page.ts | 57 + packages/core/src/events.ts | 123 + packages/core/src/index.ts | 25 + packages/core/src/resetcss.css | 446 + packages/core/src/utils.ts | 55 + packages/core/src/vite-env.d.ts | 1 + packages/core/tsconfig.json | 9 + packages/core/vite.config.ts | 27 + packages/editor/.npmignore | 28 + packages/editor/package-lock.json | 282 + packages/editor/package.json | 57 + packages/editor/src/Editor.vue | 234 + packages/editor/src/components/Icon.vue | 29 + packages/editor/src/components/ToolButton.vue | 188 + packages/editor/src/fields/Code.vue | 35 + packages/editor/src/fields/CodeLink.vue | 81 + packages/editor/src/fields/UISelect.vue | 100 + packages/editor/src/index.ts | 63 + packages/editor/src/layouts/AddPageBox.vue | 41 + packages/editor/src/layouts/CodeEditor.vue | 188 + packages/editor/src/layouts/Framework.vue | 73 + packages/editor/src/layouts/NavMenu.vue | 37 + packages/editor/src/layouts/PropsPanel.vue | 81 + packages/editor/src/layouts/Resizer.vue | 61 + .../layouts/sidebar/ComponentListPanel.vue | 69 + .../editor/src/layouts/sidebar/LayerMenu.vue | 117 + .../editor/src/layouts/sidebar/LayerPanel.vue | 209 + .../editor/src/layouts/sidebar/Sidebar.vue | 86 + .../editor/src/layouts/workspace/PageBar.vue | 83 + .../editor/src/layouts/workspace/Stage.vue | 221 + .../src/layouts/workspace/ViewerMenu.vue | 110 + .../src/layouts/workspace/Workspace.vue | 98 + packages/editor/src/services/BaseService.ts | 138 + packages/editor/src/services/componentList.ts | 48 + packages/editor/src/services/editor.ts | 521 + packages/editor/src/services/events.ts | 82 + packages/editor/src/services/history.ts | 124 + packages/editor/src/services/props.ts | 110 + packages/editor/src/services/ui.ts | 101 + packages/editor/src/shims-vue.d.ts | 6 + packages/editor/src/theme/code-editor.scss | 7 + packages/editor/src/theme/common/var.scss | 13 + .../src/theme/component-list-panel.scss | 102 + packages/editor/src/theme/content-menu.scss | 39 + packages/editor/src/theme/framework.scss | 72 + packages/editor/src/theme/index.scss | 13 + packages/editor/src/theme/layer-panel.scss | 68 + packages/editor/src/theme/nav-menu.scss | 69 + packages/editor/src/theme/page-bar.scss | 31 + packages/editor/src/theme/props-panel.scss | 17 + packages/editor/src/theme/resizer.scss | 51 + packages/editor/src/theme/ruler.scss | 38 + packages/editor/src/theme/sidebar.scss | 97 + packages/editor/src/theme/stage.scss | 22 + packages/editor/src/theme/workspace.scss | 5 + packages/editor/src/type.ts | 236 + packages/editor/src/utils/compose.ts | 33 + packages/editor/src/utils/config.ts | 29 + packages/editor/src/utils/editor.ts | 244 + packages/editor/src/utils/index.ts | 22 + packages/editor/src/utils/logger.ts | 47 + packages/editor/src/utils/props.ts | 218 + packages/editor/src/utils/undo-redo.ts | 76 + packages/editor/src/vite-env.d.ts | 1 + packages/editor/tests/unit/Editor.spec.ts | 67 + .../tests/unit/components/ToolButton.spec.ts | 208 + .../tests/unit/layouts/codeEditor/App.spec.ts | 49 + .../unit/layouts/layerPanel/LayerMenu.spec.ts | 123 + .../unit/layouts/wordspace/PageBar.spec.ts | 73 + .../unit/layouts/wordspace/Stage.spec.ts | 64 + .../editor/tests/unit/services/editor.spec.ts | 449 + .../editor/tests/unit/services/events.spec.ts | 61 + .../editor/tests/unit/services/ui.spec.ts | 27 + .../editor/tests/unit/utils/editor.spec.ts | 210 + packages/editor/tests/unit/utils/form.spec.ts | 48 + .../editor/tests/unit/utils/undo-redo.spec.ts | 154 + packages/editor/tsconfig.json | 9 + packages/editor/vite.config.ts | 30 + packages/form/.npmignore | 28 + packages/form/package-lock.json | 282 + packages/form/package.json | 51 + packages/form/src/Form.vue | 188 + packages/form/src/FormDialog.vue | 163 + packages/form/src/containers/Container.vue | 263 + packages/form/src/containers/Fieldset.vue | 138 + packages/form/src/containers/GroupList.vue | 152 + .../form/src/containers/GroupListItem.vue | 159 + packages/form/src/containers/Panel.vue | 106 + packages/form/src/containers/Row.vue | 68 + packages/form/src/containers/Step.vue | 82 + packages/form/src/containers/Table.vue | 624 + packages/form/src/containers/Tabs.vue | 176 + packages/form/src/fields/Cascader.vue | 147 + packages/form/src/fields/Checkbox.vue | 67 + packages/form/src/fields/CheckboxGroup.vue | 44 + packages/form/src/fields/ColorPicker.vue | 38 + packages/form/src/fields/Date.vue | 51 + packages/form/src/fields/DateTime.vue | 59 + packages/form/src/fields/Daterange.vue | 75 + packages/form/src/fields/Display.vue | 34 + packages/form/src/fields/DynamicField.vue | 109 + packages/form/src/fields/Hidden.vue | 29 + packages/form/src/fields/Link.vue | 112 + packages/form/src/fields/Number.vue | 53 + packages/form/src/fields/RadioGroup.vue | 33 + packages/form/src/fields/Select.vue | 393 + packages/form/src/fields/Switch.vue | 65 + packages/form/src/fields/Text.vue | 134 + packages/form/src/fields/Textarea.vue | 62 + packages/form/src/fields/Time.vue | 48 + packages/form/src/index.ts | 127 + packages/form/src/schema.ts | 638 + packages/form/src/shims-vue.d.ts | 6 + packages/form/src/theme/date-time.scss | 7 + packages/form/src/theme/fieldset.scss | 24 + packages/form/src/theme/form-dialog.scss | 13 + packages/form/src/theme/form.scss | 30 + packages/form/src/theme/group-list.scss | 23 + packages/form/src/theme/index.scss | 9 + packages/form/src/theme/link.scss | 3 + packages/form/src/theme/panel.scss | 18 + packages/form/src/theme/select.scss | 3 + packages/form/src/theme/table.scss | 69 + packages/form/src/theme/tabs.scss | 25 + packages/form/src/utils/config.ts | 27 + packages/form/src/utils/containerProps.ts | 50 + packages/form/src/utils/createForm.ts | 25 + packages/form/src/utils/fieldProps.ts | 39 + packages/form/src/utils/form.ts | 266 + packages/form/src/utils/useAddField.ts | 40 + packages/form/src/vite-env.d.ts | 1 + packages/form/tests/unit/Form.spec.ts | 49 + .../form/tests/unit/containers/Tabs.spec.ts | 67 + .../form/tests/unit/fields/Checkbox.spec.ts | 104 + .../tests/unit/fields/CheckboxGroup.spec.ts | 139 + .../tests/unit/fields/ColorPicker.spec.ts | 82 + packages/form/tests/unit/fields/Date.spec.ts | 91 + .../form/tests/unit/fields/DateTime.spec.ts | 131 + .../form/tests/unit/fields/Daterange.spec.ts | 89 + .../form/tests/unit/fields/Display.spec.ts | 84 + .../form/tests/unit/fields/Hidden.spec.ts | 78 + packages/form/tests/unit/fields/Link.spec.ts | 180 + .../form/tests/unit/fields/Number.spec.ts | 127 + .../form/tests/unit/fields/RadioGroup.spec.ts | 134 + .../form/tests/unit/fields/Switch.spec.ts | 104 + packages/form/tests/unit/fields/Text.spec.ts | 321 + .../form/tests/unit/fields/Textarea.spec.ts | 65 + packages/form/tests/unit/fields/Time.spec.ts | 64 + packages/form/tests/unit/utils/config.spec.ts | 53 + .../form/tests/unit/utils/createForm.spec.ts | 32 + packages/form/tests/unit/utils/form.spec.ts | 306 + packages/form/tsconfig.json | 9 + packages/form/vite.config.ts | 27 + packages/schema/package.json | 12 + packages/schema/src/index.ts | 67 + packages/stage/.npmignore | 28 + packages/stage/package.json | 40 + packages/stage/src/StageCore.ts | 222 + packages/stage/src/StageDragResize.ts | 471 + packages/stage/src/StageMask.ts | 308 + packages/stage/src/StageRender.ts | 121 + packages/stage/src/const.ts | 23 + packages/stage/src/index.ts | 26 + packages/stage/src/logger.ts | 37 + packages/stage/src/types.ts | 121 + packages/stage/src/util.ts | 120 + packages/stage/tests/unit/util.spec.ts | 160 + packages/stage/tsconfig.json | 9 + packages/stage/vite.config.ts | 27 + packages/table/.npmignore | 28 + packages/table/package-lock.json | 277 + packages/table/package.json | 46 + packages/table/src/ActionsColumn.vue | 165 + packages/table/src/ExpandColumn.vue | 37 + packages/table/src/PopoverColumn.vue | 40 + packages/table/src/Table.vue | 224 + packages/table/src/TextColumn.vue | 77 + packages/table/src/index.ts | 33 + packages/table/src/schema.ts | 56 + packages/table/src/shims-vue.d.ts | 6 + packages/table/src/utils.ts | 37 + packages/table/src/vite-env.d.ts | 1 + packages/table/tsconfig.json | 9 + packages/table/vite.config.ts | 27 + packages/ui-react/package-lock.json | 76 + packages/ui-react/package.json | 25 + packages/ui-react/src/AppContent.ts | 23 + packages/ui-react/src/button/Button.tsx | 54 + packages/ui-react/src/button/formConfig.ts | 19 + packages/ui-react/src/button/index.ts | 24 + packages/ui-react/src/button/initValue.ts | 30 + packages/ui-react/src/container/Container.tsx | 65 + packages/ui-react/src/container/formConfig.ts | 19 + packages/ui-react/src/container/index.ts | 24 + packages/ui-react/src/container/initValue.ts | 25 + packages/ui-react/src/index.ts | 35 + packages/ui-react/src/page/Page.tsx | 41 + packages/ui-react/src/page/formConfig.ts | 19 + packages/ui-react/src/page/index.ts | 24 + packages/ui-react/src/page/initValue.ts | 19 + packages/ui-react/src/text/Text.tsx | 45 + packages/ui-react/src/text/formConfig.ts | 19 + packages/ui-react/src/text/index.ts | 24 + packages/ui-react/src/text/initValue.ts | 29 + packages/ui-react/src/useApp.ts | 63 + packages/ui-react/src/useCommonMethod.tsx | 26 + packages/ui-react/tsconfig.json | 24 + packages/ui-vue2/package-lock.json | 13 + packages/ui-vue2/package.json | 24 + packages/ui-vue2/src/Component.vue | 53 + packages/ui-vue2/src/button/Button.vue | 62 + packages/ui-vue2/src/button/formConfig.ts | 19 + packages/ui-vue2/src/button/index.ts | 24 + packages/ui-vue2/src/button/initValue.ts | 30 + packages/ui-vue2/src/container/Container.vue | 54 + packages/ui-vue2/src/container/formConfig.ts | 19 + packages/ui-vue2/src/container/index.ts | 24 + packages/ui-vue2/src/container/initValue.ts | 19 + packages/ui-vue2/src/index.ts | 33 + packages/ui-vue2/src/page/Page.vue | 30 + packages/ui-vue2/src/page/formConfig.ts | 19 + packages/ui-vue2/src/page/index.ts | 24 + packages/ui-vue2/src/page/initValue.ts | 19 + packages/ui-vue2/src/text/Text.vue | 66 + packages/ui-vue2/src/text/formConfig.ts | 19 + packages/ui-vue2/src/text/index.ts | 24 + packages/ui-vue2/src/text/initValue.ts | 29 + packages/ui-vue2/src/useApp.ts | 40 + packages/ui-vue2/src/useCommonMethod.ts | 31 + packages/ui-vue2/vite.config.ts | 54 + packages/ui/package-lock.json | 431 + packages/ui/package.json | 22 + packages/ui/src/Component.vue | 52 + packages/ui/src/button/index.ts | 24 + packages/ui/src/button/src/formConfig.ts | 24 + packages/ui/src/button/src/index.vue | 62 + packages/ui/src/button/src/initValue.ts | 30 + packages/ui/src/container/index.ts | 24 + packages/ui/src/container/src/Container.vue | 54 + packages/ui/src/container/src/formConfig.ts | 30 + packages/ui/src/container/src/initValue.ts | 25 + packages/ui/src/index.ts | 31 + packages/ui/src/page/index.ts | 24 + packages/ui/src/page/src/formConfig.ts | 40 + packages/ui/src/page/src/index.vue | 29 + packages/ui/src/page/src/initValue.ts | 25 + packages/ui/src/shims-vue.d.ts | 6 + packages/ui/src/text/index.ts | 24 + packages/ui/src/text/src/formConfig.ts | 29 + packages/ui/src/text/src/index.vue | 62 + packages/ui/src/text/src/initValue.ts | 29 + packages/ui/src/types.ts | 232 + packages/ui/src/useApp.ts | 40 + packages/ui/src/useCommonMethod.ts | 26 + packages/ui/src/vite-env.d.ts | 1 + packages/ui/tests/unit/button.spec.ts | 65 + packages/ui/tests/unit/text.spec.ts | 109 + packages/ui/tsconfig.json | 9 + packages/utils/.npmignore | 28 + packages/utils/package.json | 29 + packages/utils/src/index.ts | 184 + packages/utils/src/vite-env.d.ts | 1 + packages/utils/tests/unit/index.spec.ts | 286 + packages/utils/tsconfig.json | 9 + packages/utils/vite.config.ts | 45 + packages/vite-config.ts | 83 + playground/.gitignore | 1 + playground/README.md | 27 + playground/index.html | 13 + playground/package-lock.json | 276 + playground/package.json | 32 + playground/public/favicon.png | Bin 0 -> 8785 bytes playground/src/App.vue | 20 + playground/src/config.ts | 79 + playground/src/main.ts | 43 + playground/src/pages/Editor.vue | 198 + playground/src/pages/Form.vue | 352 + playground/src/pages/Table.vue | 35 + playground/src/polyfills.ts | 21 + playground/src/route.ts | 34 + playground/src/shims-vue.d.ts | 6 + playground/src/vite-env.d.ts | 1 + playground/tsconfig.json | 9 + playground/vite.config.ts | 79 + runtime/react/.gitignore | 4 + runtime/react/package-lock.json | 76 + runtime/react/package.json | 22 + runtime/react/page.html | 13 + runtime/react/playground.html | 29 + runtime/react/scripts/build.js | 22 + runtime/react/scripts/dev.js | 22 + runtime/react/scripts/units.js | 25 + runtime/react/src/page/App.css | 8 + runtime/react/src/page/App.tsx | 39 + runtime/react/src/page/main.tsx | 64 + runtime/react/src/playground/App.css | 15 + runtime/react/src/playground/App.tsx | 39 + runtime/react/src/playground/main.tsx | 116 + runtime/react/src/vite-env.d.ts | 1 + runtime/react/tsconfig.json | 24 + runtime/react/vite.config.ts | 59 + runtime/scripts/generateEntry.js | 416 + runtime/vue2/.gitignore | 4 + runtime/vue2/package-lock.json | 13 + runtime/vue2/package.json | 21 + runtime/vue2/page.html | 13 + runtime/vue2/playground.html | 30 + runtime/vue2/scripts/build.js | 22 + runtime/vue2/scripts/dev.js | 22 + runtime/vue2/scripts/units.js | 25 + runtime/vue2/src/index.d.ts | 28 + runtime/vue2/src/page/App.vue | 33 + runtime/vue2/src/page/main.ts | 59 + runtime/vue2/src/playground/App.vue | 143 + runtime/vue2/src/playground/main.ts | 41 + runtime/vue2/src/shims-vue.d.ts | 6 + runtime/vue2/src/utils/index.ts | 30 + runtime/vue2/src/utils/request.ts | 41 + runtime/vue2/src/vite-env.d.ts | 1 + runtime/vue2/vite.config.ts | 56 + runtime/vue3/.gitignore | 4 + runtime/vue3/package-lock.json | 185 + runtime/vue3/package.json | 27 + runtime/vue3/page.html | 13 + runtime/vue3/playground.html | 30 + runtime/vue3/scripts/build.js | 22 + runtime/vue3/scripts/dev.js | 22 + runtime/vue3/scripts/units.js | 25 + runtime/vue3/src/index.d.ts | 28 + runtime/vue3/src/page/App.vue | 33 + runtime/vue3/src/page/main.ts | 50 + runtime/vue3/src/playground/App.vue | 120 + runtime/vue3/src/playground/main.ts | 38 + runtime/vue3/src/shims-vue.d.ts | 6 + runtime/vue3/src/utils/index.ts | 30 + runtime/vue3/src/utils/request.ts | 42 + runtime/vue3/src/vite-env.d.ts | 1 + runtime/vue3/vite.config.ts | 60 + tsconfig.json | 36 + 360 files changed, 52539 insertions(+) create mode 100644 .browserslistrc create mode 100644 .editorconfig create mode 100644 .eslintignore create mode 100644 .eslintrc.js create mode 100644 .gitignore create mode 100755 .husky/commit-msg create mode 100755 .husky/pre-commit create mode 100755 .husky/pre-push create mode 100644 CONTRIBUTING.md create mode 100644 LICENSE create mode 100644 README.md create mode 100644 babel.config.js create mode 100644 commitlint.config.js create mode 100644 jest.config.js create mode 100644 lerna.json create mode 100644 package-lock.json create mode 100644 package.json create mode 100644 packages/core/package.json create mode 100644 packages/core/src/App.ts create mode 100644 packages/core/src/Env.ts create mode 100644 packages/core/src/Node.ts create mode 100644 packages/core/src/Page.ts create mode 100644 packages/core/src/events.ts create mode 100644 packages/core/src/index.ts create mode 100644 packages/core/src/resetcss.css create mode 100644 packages/core/src/utils.ts create mode 100644 packages/core/src/vite-env.d.ts create mode 100644 packages/core/tsconfig.json create mode 100644 packages/core/vite.config.ts create mode 100644 packages/editor/.npmignore create mode 100644 packages/editor/package-lock.json create mode 100644 packages/editor/package.json create mode 100644 packages/editor/src/Editor.vue create mode 100644 packages/editor/src/components/Icon.vue create mode 100644 packages/editor/src/components/ToolButton.vue create mode 100644 packages/editor/src/fields/Code.vue create mode 100644 packages/editor/src/fields/CodeLink.vue create mode 100644 packages/editor/src/fields/UISelect.vue create mode 100644 packages/editor/src/index.ts create mode 100644 packages/editor/src/layouts/AddPageBox.vue create mode 100644 packages/editor/src/layouts/CodeEditor.vue create mode 100644 packages/editor/src/layouts/Framework.vue create mode 100644 packages/editor/src/layouts/NavMenu.vue create mode 100644 packages/editor/src/layouts/PropsPanel.vue create mode 100644 packages/editor/src/layouts/Resizer.vue create mode 100644 packages/editor/src/layouts/sidebar/ComponentListPanel.vue create mode 100644 packages/editor/src/layouts/sidebar/LayerMenu.vue create mode 100644 packages/editor/src/layouts/sidebar/LayerPanel.vue create mode 100644 packages/editor/src/layouts/sidebar/Sidebar.vue create mode 100644 packages/editor/src/layouts/workspace/PageBar.vue create mode 100644 packages/editor/src/layouts/workspace/Stage.vue create mode 100644 packages/editor/src/layouts/workspace/ViewerMenu.vue create mode 100644 packages/editor/src/layouts/workspace/Workspace.vue create mode 100644 packages/editor/src/services/BaseService.ts create mode 100644 packages/editor/src/services/componentList.ts create mode 100644 packages/editor/src/services/editor.ts create mode 100644 packages/editor/src/services/events.ts create mode 100644 packages/editor/src/services/history.ts create mode 100644 packages/editor/src/services/props.ts create mode 100644 packages/editor/src/services/ui.ts create mode 100644 packages/editor/src/shims-vue.d.ts create mode 100644 packages/editor/src/theme/code-editor.scss create mode 100644 packages/editor/src/theme/common/var.scss create mode 100644 packages/editor/src/theme/component-list-panel.scss create mode 100644 packages/editor/src/theme/content-menu.scss create mode 100644 packages/editor/src/theme/framework.scss create mode 100644 packages/editor/src/theme/index.scss create mode 100644 packages/editor/src/theme/layer-panel.scss create mode 100644 packages/editor/src/theme/nav-menu.scss create mode 100644 packages/editor/src/theme/page-bar.scss create mode 100644 packages/editor/src/theme/props-panel.scss create mode 100644 packages/editor/src/theme/resizer.scss create mode 100644 packages/editor/src/theme/ruler.scss create mode 100644 packages/editor/src/theme/sidebar.scss create mode 100644 packages/editor/src/theme/stage.scss create mode 100644 packages/editor/src/theme/workspace.scss create mode 100644 packages/editor/src/type.ts create mode 100644 packages/editor/src/utils/compose.ts create mode 100644 packages/editor/src/utils/config.ts create mode 100644 packages/editor/src/utils/editor.ts create mode 100644 packages/editor/src/utils/index.ts create mode 100644 packages/editor/src/utils/logger.ts create mode 100644 packages/editor/src/utils/props.ts create mode 100644 packages/editor/src/utils/undo-redo.ts create mode 100644 packages/editor/src/vite-env.d.ts create mode 100644 packages/editor/tests/unit/Editor.spec.ts create mode 100644 packages/editor/tests/unit/components/ToolButton.spec.ts create mode 100644 packages/editor/tests/unit/layouts/codeEditor/App.spec.ts create mode 100644 packages/editor/tests/unit/layouts/layerPanel/LayerMenu.spec.ts create mode 100644 packages/editor/tests/unit/layouts/wordspace/PageBar.spec.ts create mode 100644 packages/editor/tests/unit/layouts/wordspace/Stage.spec.ts create mode 100644 packages/editor/tests/unit/services/editor.spec.ts create mode 100644 packages/editor/tests/unit/services/events.spec.ts create mode 100644 packages/editor/tests/unit/services/ui.spec.ts create mode 100644 packages/editor/tests/unit/utils/editor.spec.ts create mode 100644 packages/editor/tests/unit/utils/form.spec.ts create mode 100644 packages/editor/tests/unit/utils/undo-redo.spec.ts create mode 100644 packages/editor/tsconfig.json create mode 100644 packages/editor/vite.config.ts create mode 100644 packages/form/.npmignore create mode 100644 packages/form/package-lock.json create mode 100644 packages/form/package.json create mode 100644 packages/form/src/Form.vue create mode 100644 packages/form/src/FormDialog.vue create mode 100644 packages/form/src/containers/Container.vue create mode 100644 packages/form/src/containers/Fieldset.vue create mode 100644 packages/form/src/containers/GroupList.vue create mode 100644 packages/form/src/containers/GroupListItem.vue create mode 100644 packages/form/src/containers/Panel.vue create mode 100644 packages/form/src/containers/Row.vue create mode 100644 packages/form/src/containers/Step.vue create mode 100644 packages/form/src/containers/Table.vue create mode 100644 packages/form/src/containers/Tabs.vue create mode 100644 packages/form/src/fields/Cascader.vue create mode 100644 packages/form/src/fields/Checkbox.vue create mode 100644 packages/form/src/fields/CheckboxGroup.vue create mode 100644 packages/form/src/fields/ColorPicker.vue create mode 100644 packages/form/src/fields/Date.vue create mode 100644 packages/form/src/fields/DateTime.vue create mode 100644 packages/form/src/fields/Daterange.vue create mode 100644 packages/form/src/fields/Display.vue create mode 100644 packages/form/src/fields/DynamicField.vue create mode 100644 packages/form/src/fields/Hidden.vue create mode 100644 packages/form/src/fields/Link.vue create mode 100644 packages/form/src/fields/Number.vue create mode 100644 packages/form/src/fields/RadioGroup.vue create mode 100644 packages/form/src/fields/Select.vue create mode 100644 packages/form/src/fields/Switch.vue create mode 100644 packages/form/src/fields/Text.vue create mode 100644 packages/form/src/fields/Textarea.vue create mode 100644 packages/form/src/fields/Time.vue create mode 100644 packages/form/src/index.ts create mode 100644 packages/form/src/schema.ts create mode 100644 packages/form/src/shims-vue.d.ts create mode 100644 packages/form/src/theme/date-time.scss create mode 100644 packages/form/src/theme/fieldset.scss create mode 100644 packages/form/src/theme/form-dialog.scss create mode 100644 packages/form/src/theme/form.scss create mode 100644 packages/form/src/theme/group-list.scss create mode 100644 packages/form/src/theme/index.scss create mode 100644 packages/form/src/theme/link.scss create mode 100644 packages/form/src/theme/panel.scss create mode 100644 packages/form/src/theme/select.scss create mode 100644 packages/form/src/theme/table.scss create mode 100644 packages/form/src/theme/tabs.scss create mode 100644 packages/form/src/utils/config.ts create mode 100644 packages/form/src/utils/containerProps.ts create mode 100644 packages/form/src/utils/createForm.ts create mode 100644 packages/form/src/utils/fieldProps.ts create mode 100644 packages/form/src/utils/form.ts create mode 100644 packages/form/src/utils/useAddField.ts create mode 100644 packages/form/src/vite-env.d.ts create mode 100644 packages/form/tests/unit/Form.spec.ts create mode 100644 packages/form/tests/unit/containers/Tabs.spec.ts create mode 100644 packages/form/tests/unit/fields/Checkbox.spec.ts create mode 100644 packages/form/tests/unit/fields/CheckboxGroup.spec.ts create mode 100644 packages/form/tests/unit/fields/ColorPicker.spec.ts create mode 100644 packages/form/tests/unit/fields/Date.spec.ts create mode 100644 packages/form/tests/unit/fields/DateTime.spec.ts create mode 100644 packages/form/tests/unit/fields/Daterange.spec.ts create mode 100644 packages/form/tests/unit/fields/Display.spec.ts create mode 100644 packages/form/tests/unit/fields/Hidden.spec.ts create mode 100644 packages/form/tests/unit/fields/Link.spec.ts create mode 100644 packages/form/tests/unit/fields/Number.spec.ts create mode 100644 packages/form/tests/unit/fields/RadioGroup.spec.ts create mode 100644 packages/form/tests/unit/fields/Switch.spec.ts create mode 100644 packages/form/tests/unit/fields/Text.spec.ts create mode 100644 packages/form/tests/unit/fields/Textarea.spec.ts create mode 100644 packages/form/tests/unit/fields/Time.spec.ts create mode 100644 packages/form/tests/unit/utils/config.spec.ts create mode 100644 packages/form/tests/unit/utils/createForm.spec.ts create mode 100644 packages/form/tests/unit/utils/form.spec.ts create mode 100644 packages/form/tsconfig.json create mode 100644 packages/form/vite.config.ts create mode 100644 packages/schema/package.json create mode 100644 packages/schema/src/index.ts create mode 100644 packages/stage/.npmignore create mode 100644 packages/stage/package.json create mode 100644 packages/stage/src/StageCore.ts create mode 100644 packages/stage/src/StageDragResize.ts create mode 100644 packages/stage/src/StageMask.ts create mode 100644 packages/stage/src/StageRender.ts create mode 100644 packages/stage/src/const.ts create mode 100644 packages/stage/src/index.ts create mode 100644 packages/stage/src/logger.ts create mode 100644 packages/stage/src/types.ts create mode 100644 packages/stage/src/util.ts create mode 100644 packages/stage/tests/unit/util.spec.ts create mode 100644 packages/stage/tsconfig.json create mode 100644 packages/stage/vite.config.ts create mode 100644 packages/table/.npmignore create mode 100644 packages/table/package-lock.json create mode 100644 packages/table/package.json create mode 100644 packages/table/src/ActionsColumn.vue create mode 100644 packages/table/src/ExpandColumn.vue create mode 100644 packages/table/src/PopoverColumn.vue create mode 100644 packages/table/src/Table.vue create mode 100644 packages/table/src/TextColumn.vue create mode 100644 packages/table/src/index.ts create mode 100644 packages/table/src/schema.ts create mode 100644 packages/table/src/shims-vue.d.ts create mode 100644 packages/table/src/utils.ts create mode 100644 packages/table/src/vite-env.d.ts create mode 100644 packages/table/tsconfig.json create mode 100644 packages/table/vite.config.ts create mode 100644 packages/ui-react/package-lock.json create mode 100644 packages/ui-react/package.json create mode 100644 packages/ui-react/src/AppContent.ts create mode 100644 packages/ui-react/src/button/Button.tsx create mode 100644 packages/ui-react/src/button/formConfig.ts create mode 100644 packages/ui-react/src/button/index.ts create mode 100644 packages/ui-react/src/button/initValue.ts create mode 100644 packages/ui-react/src/container/Container.tsx create mode 100644 packages/ui-react/src/container/formConfig.ts create mode 100644 packages/ui-react/src/container/index.ts create mode 100644 packages/ui-react/src/container/initValue.ts create mode 100644 packages/ui-react/src/index.ts create mode 100644 packages/ui-react/src/page/Page.tsx create mode 100644 packages/ui-react/src/page/formConfig.ts create mode 100644 packages/ui-react/src/page/index.ts create mode 100644 packages/ui-react/src/page/initValue.ts create mode 100644 packages/ui-react/src/text/Text.tsx create mode 100644 packages/ui-react/src/text/formConfig.ts create mode 100644 packages/ui-react/src/text/index.ts create mode 100644 packages/ui-react/src/text/initValue.ts create mode 100644 packages/ui-react/src/useApp.ts create mode 100644 packages/ui-react/src/useCommonMethod.tsx create mode 100644 packages/ui-react/tsconfig.json create mode 100644 packages/ui-vue2/package-lock.json create mode 100644 packages/ui-vue2/package.json create mode 100644 packages/ui-vue2/src/Component.vue create mode 100644 packages/ui-vue2/src/button/Button.vue create mode 100644 packages/ui-vue2/src/button/formConfig.ts create mode 100644 packages/ui-vue2/src/button/index.ts create mode 100644 packages/ui-vue2/src/button/initValue.ts create mode 100644 packages/ui-vue2/src/container/Container.vue create mode 100644 packages/ui-vue2/src/container/formConfig.ts create mode 100644 packages/ui-vue2/src/container/index.ts create mode 100644 packages/ui-vue2/src/container/initValue.ts create mode 100644 packages/ui-vue2/src/index.ts create mode 100644 packages/ui-vue2/src/page/Page.vue create mode 100644 packages/ui-vue2/src/page/formConfig.ts create mode 100644 packages/ui-vue2/src/page/index.ts create mode 100644 packages/ui-vue2/src/page/initValue.ts create mode 100644 packages/ui-vue2/src/text/Text.vue create mode 100644 packages/ui-vue2/src/text/formConfig.ts create mode 100644 packages/ui-vue2/src/text/index.ts create mode 100644 packages/ui-vue2/src/text/initValue.ts create mode 100644 packages/ui-vue2/src/useApp.ts create mode 100644 packages/ui-vue2/src/useCommonMethod.ts create mode 100644 packages/ui-vue2/vite.config.ts create mode 100644 packages/ui/package-lock.json create mode 100644 packages/ui/package.json create mode 100644 packages/ui/src/Component.vue create mode 100644 packages/ui/src/button/index.ts create mode 100644 packages/ui/src/button/src/formConfig.ts create mode 100644 packages/ui/src/button/src/index.vue create mode 100644 packages/ui/src/button/src/initValue.ts create mode 100644 packages/ui/src/container/index.ts create mode 100644 packages/ui/src/container/src/Container.vue create mode 100644 packages/ui/src/container/src/formConfig.ts create mode 100644 packages/ui/src/container/src/initValue.ts create mode 100644 packages/ui/src/index.ts create mode 100644 packages/ui/src/page/index.ts create mode 100644 packages/ui/src/page/src/formConfig.ts create mode 100644 packages/ui/src/page/src/index.vue create mode 100644 packages/ui/src/page/src/initValue.ts create mode 100644 packages/ui/src/shims-vue.d.ts create mode 100644 packages/ui/src/text/index.ts create mode 100644 packages/ui/src/text/src/formConfig.ts create mode 100644 packages/ui/src/text/src/index.vue create mode 100644 packages/ui/src/text/src/initValue.ts create mode 100644 packages/ui/src/types.ts create mode 100644 packages/ui/src/useApp.ts create mode 100644 packages/ui/src/useCommonMethod.ts create mode 100644 packages/ui/src/vite-env.d.ts create mode 100644 packages/ui/tests/unit/button.spec.ts create mode 100644 packages/ui/tests/unit/text.spec.ts create mode 100644 packages/ui/tsconfig.json create mode 100644 packages/utils/.npmignore create mode 100644 packages/utils/package.json create mode 100644 packages/utils/src/index.ts create mode 100644 packages/utils/src/vite-env.d.ts create mode 100644 packages/utils/tests/unit/index.spec.ts create mode 100644 packages/utils/tsconfig.json create mode 100644 packages/utils/vite.config.ts create mode 100644 packages/vite-config.ts create mode 100644 playground/.gitignore create mode 100644 playground/README.md create mode 100644 playground/index.html create mode 100644 playground/package-lock.json create mode 100644 playground/package.json create mode 100644 playground/public/favicon.png create mode 100644 playground/src/App.vue create mode 100644 playground/src/config.ts create mode 100644 playground/src/main.ts create mode 100644 playground/src/pages/Editor.vue create mode 100644 playground/src/pages/Form.vue create mode 100644 playground/src/pages/Table.vue create mode 100644 playground/src/polyfills.ts create mode 100644 playground/src/route.ts create mode 100644 playground/src/shims-vue.d.ts create mode 100644 playground/src/vite-env.d.ts create mode 100644 playground/tsconfig.json create mode 100644 playground/vite.config.ts create mode 100644 runtime/react/.gitignore create mode 100644 runtime/react/package-lock.json create mode 100644 runtime/react/package.json create mode 100644 runtime/react/page.html create mode 100644 runtime/react/playground.html create mode 100644 runtime/react/scripts/build.js create mode 100644 runtime/react/scripts/dev.js create mode 100644 runtime/react/scripts/units.js create mode 100644 runtime/react/src/page/App.css create mode 100644 runtime/react/src/page/App.tsx create mode 100644 runtime/react/src/page/main.tsx create mode 100644 runtime/react/src/playground/App.css create mode 100644 runtime/react/src/playground/App.tsx create mode 100644 runtime/react/src/playground/main.tsx create mode 100644 runtime/react/src/vite-env.d.ts create mode 100644 runtime/react/tsconfig.json create mode 100644 runtime/react/vite.config.ts create mode 100644 runtime/scripts/generateEntry.js create mode 100644 runtime/vue2/.gitignore create mode 100644 runtime/vue2/package-lock.json create mode 100644 runtime/vue2/package.json create mode 100644 runtime/vue2/page.html create mode 100644 runtime/vue2/playground.html create mode 100644 runtime/vue2/scripts/build.js create mode 100644 runtime/vue2/scripts/dev.js create mode 100644 runtime/vue2/scripts/units.js create mode 100644 runtime/vue2/src/index.d.ts create mode 100644 runtime/vue2/src/page/App.vue create mode 100644 runtime/vue2/src/page/main.ts create mode 100644 runtime/vue2/src/playground/App.vue create mode 100644 runtime/vue2/src/playground/main.ts create mode 100644 runtime/vue2/src/shims-vue.d.ts create mode 100644 runtime/vue2/src/utils/index.ts create mode 100644 runtime/vue2/src/utils/request.ts create mode 100644 runtime/vue2/src/vite-env.d.ts create mode 100644 runtime/vue2/vite.config.ts create mode 100644 runtime/vue3/.gitignore create mode 100644 runtime/vue3/package-lock.json create mode 100644 runtime/vue3/package.json create mode 100644 runtime/vue3/page.html create mode 100644 runtime/vue3/playground.html create mode 100644 runtime/vue3/scripts/build.js create mode 100644 runtime/vue3/scripts/dev.js create mode 100644 runtime/vue3/scripts/units.js create mode 100644 runtime/vue3/src/index.d.ts create mode 100644 runtime/vue3/src/page/App.vue create mode 100644 runtime/vue3/src/page/main.ts create mode 100644 runtime/vue3/src/playground/App.vue create mode 100644 runtime/vue3/src/playground/main.ts create mode 100644 runtime/vue3/src/shims-vue.d.ts create mode 100644 runtime/vue3/src/utils/index.ts create mode 100644 runtime/vue3/src/utils/request.ts create mode 100644 runtime/vue3/src/vite-env.d.ts create mode 100644 runtime/vue3/vite.config.ts create mode 100644 tsconfig.json diff --git a/.browserslistrc b/.browserslistrc new file mode 100644 index 00000000..214388fe --- /dev/null +++ b/.browserslistrc @@ -0,0 +1,3 @@ +> 1% +last 2 versions +not dead diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 00000000..c24743d0 --- /dev/null +++ b/.editorconfig @@ -0,0 +1,7 @@ +[*.{js,jsx,ts,tsx,vue}] +indent_style = space +indent_size = 2 +end_of_line = lf +trim_trailing_whitespace = true +insert_final_newline = true +max_line_length = 100 diff --git a/.eslintignore b/.eslintignore new file mode 100644 index 00000000..9c8cf245 --- /dev/null +++ b/.eslintignore @@ -0,0 +1,8 @@ +dist +coverage +node_modules +dest + +comp-entry.ts +config-entry.ts +value-entry.ts \ No newline at end of file diff --git a/.eslintrc.js b/.eslintrc.js new file mode 100644 index 00000000..620fc9d3 --- /dev/null +++ b/.eslintrc.js @@ -0,0 +1,63 @@ +module.exports = { + env: { + node: true, + browser: true, + es2021: true, + }, + globals: { + describe: true, + it: true, + expect: true, + jest: true, + beforeEach: true, + }, + extends: [ + 'eslint-config-tencent', + 'eslint-config-tencent/ts', + 'plugin:vue/vue3-essential', + 'eslint-config-tencent/prettier', + ], + parser: 'vue-eslint-parser', + parserOptions: { + ecmaVersion: 12, + parser: '@typescript-eslint/parser', + extraFileExtensions: ['.vue'], + sourceType: 'module', + }, + plugins: [ + 'vue', + '@typescript-eslint', + 'simple-import-sort' + ], + ignorePatterns: ['.eslintrc.js'], + rules: { + 'vue/no-mutating-props': 'off', + 'no-param-reassign': 'off', + '@typescript-eslint/no-require-imports': 'off', + 'simple-import-sort/imports': [ + "error", { + groups: [ + ['./polyfills'], + // Node.js builtins. You could also generate this regex if you use a `.js` config. + // For example: `^(${require("module").builtinModules.join("|")})(/|$)` + [ + "^(assert|buffer|child_process|cluster|console|constants|crypto|dgram|dns|domain|events|fs|http|https|module|net|os|path|punycode|querystring|readline|repl|stream|string_decoder|sys|timers|tls|tty|url|util|vm|zlib|freelist|v8|process|async_hooks|http2|perf_hooks)(/.*|$)", + ], + // Packages. `react|vue` related packages come first. + ["^(react|vue|vite)", "^@?\\w"], + ["^(@tmagic)(/.*|$)"], + // Internal packages. + ["^(@|@editor)(/.*|$)"], + // Side effect imports. + ["^\\u0000"], + // Parent imports. Put `..` last. + ["^\\.\\.(?!/?$)", "^\\.\\./?$"], + // Other relative imports. Put same-folder imports and `.` last. + ["^\\./(?=.*/)(?!/?$)", "^\\.(?!/?$)", "^\\./?$"], + // Style imports. + ["^.+\\.s?css$"], + ], + } + ] + }, +}; diff --git a/.gitignore b/.gitignore new file mode 100644 index 00000000..fb9e2aa2 --- /dev/null +++ b/.gitignore @@ -0,0 +1,24 @@ +.DS_Store +node_modules +dist + +# local env files +.env.local +.env.*.local + +# Log files +npm-debug.log* +yarn-debug.log* +yarn-error.log* +pnpm-debug.log* + +# Editor directories and files +.idea +.vscode +*.suo +*.ntvs* +*.njsproj +*.sln +*.sw? + +coverage diff --git a/.husky/commit-msg b/.husky/commit-msg new file mode 100755 index 00000000..e8511eae --- /dev/null +++ b/.husky/commit-msg @@ -0,0 +1,4 @@ +#!/bin/sh +. "$(dirname "$0")/_/husky.sh" + +npx --no-install commitlint --edit $1 diff --git a/.husky/pre-commit b/.husky/pre-commit new file mode 100755 index 00000000..36af2198 --- /dev/null +++ b/.husky/pre-commit @@ -0,0 +1,4 @@ +#!/bin/sh +. "$(dirname "$0")/_/husky.sh" + +npx lint-staged diff --git a/.husky/pre-push b/.husky/pre-push new file mode 100755 index 00000000..449fcdee --- /dev/null +++ b/.husky/pre-push @@ -0,0 +1,4 @@ +#!/bin/sh +. "$(dirname "$0")/_/husky.sh" + +npm test diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 00000000..45f03895 --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,136 @@ +## Issue 提交 + +#### 对于贡献者 + +在提 issue 前请确保满足一下条件: + +- 必须是一个 bug 或者功能新增。 +- 已经在 issue 中搜索过,并且没有找到相似的 issue 或者解决方案。 + +## Pull request + +我们除了希望听到您的反馈和建议外,我们也希望您接受代码形式的直接帮助,对我们的 GitHub 发出 pull request 请求。 + +以下是具体步骤: + +#### Fork仓库 + +点击 `Fork` 按钮,将需要参与的项目仓库 fork 到自己的 Github 中。 + +#### Clone 已 fork 项目 + +在自己的 github 中,找到 fork 下来的项目,git clone 到本地。 + +```bash +$ git clone git@github.com:/tmagic-editor.git +``` + +#### 添加 tmagic-editor 仓库 + +将 fork 源仓库连接到本地仓库: + +```bash +$ git remote add +# 例如: +$ git remote add wepy git@github.com:Tencent/tmagic-editor.git +``` + +#### 保持与 tmagic-editor 仓库的同步 + +更新上游仓库: + +```bash +$ git pull --rebase +# 等同于以下两条命令 +$ git fetch +$ git rebase / +``` + +## Commit + +对于如何提交 git commit message,我们有非常精确的规则。我们希望所有的 commit message 更具可读性,这样在查看项目历史记录会变得容易,同时我们使用 commit message 生成 Changelog. + +本项目使用了 `@commitlint` 作为 commit lint 工具,并使用 [`@commitlint/config-angular`](https://www.npmjs.com/package/@commitlint/config-angular)作为基础规则,请使用下面任意一种方式提交你的 commit. + +- 全局安装 `npm install -g commitizen`,然后使用 `cz` 提交 +- 使用 `git commit -a` 提交,请注意 message 符合我们的要求 + +### 提交格式 + +每个 commit message 包括 **header**, **body** 和 **footer**. + +header 具有特殊的格式,包括 **type**, **scope** 和 **subject**, type 和 subject 是必须的,scope 是可选的。 + +```vim +(): + + + +