@formily-design/react 1.0.0
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.
- package/LICENSE.md +20 -0
- package/README.md +1 -0
- package/copy.ts +6 -0
- package/dist/designable.react.umd.production.css +1 -0
- package/dist/designable.react.umd.production.js +6 -0
- package/dist/designable.react.umd.production.min.css +1 -0
- package/dist/designable.react.umd.production.min.js +3769 -0
- package/esm/containers/Designer.d.ts +3 -0
- package/esm/containers/Designer.js +38 -0
- package/esm/containers/Layout.d.ts +3 -0
- package/esm/containers/Layout.js +32 -0
- package/esm/containers/Simulator.d.ts +3 -0
- package/esm/containers/Simulator.js +18 -0
- package/esm/containers/Viewport.d.ts +6 -0
- package/esm/containers/Viewport.js +49 -0
- package/esm/containers/Workbench.d.ts +4 -0
- package/esm/containers/Workbench.js +9 -0
- package/esm/containers/Workspace.d.ts +8 -0
- package/esm/containers/Workspace.js +26 -0
- package/esm/containers/index.d.ts +7 -0
- package/esm/containers/index.js +7 -0
- package/esm/containers/styles.less +19 -0
- package/esm/context.d.ts +7 -0
- package/esm/context.js +6 -0
- package/esm/hooks/index.d.ts +25 -0
- package/esm/hooks/index.js +25 -0
- package/esm/hooks/useComponents.d.ts +1 -0
- package/esm/hooks/useComponents.js +3 -0
- package/esm/hooks/useCursor.d.ts +1 -0
- package/esm/hooks/useCursor.js +5 -0
- package/esm/hooks/useDesigner.d.ts +5 -0
- package/esm/hooks/useDesigner.js +13 -0
- package/esm/hooks/useHistory.d.ts +1 -0
- package/esm/hooks/useHistory.js +5 -0
- package/esm/hooks/useHover.d.ts +1 -0
- package/esm/hooks/useHover.js +5 -0
- package/esm/hooks/useLayout.d.ts +2 -0
- package/esm/hooks/useLayout.js +7 -0
- package/esm/hooks/useMoveHelper.d.ts +1 -0
- package/esm/hooks/useMoveHelper.js +5 -0
- package/esm/hooks/useNodeIdProps.d.ts +4 -0
- package/esm/hooks/useNodeIdProps.js +9 -0
- package/esm/hooks/useOperation.d.ts +1 -0
- package/esm/hooks/useOperation.js +5 -0
- package/esm/hooks/useOutline.d.ts +1 -0
- package/esm/hooks/useOutline.js +5 -0
- package/esm/hooks/usePosition.d.ts +1 -0
- package/esm/hooks/usePosition.js +5 -0
- package/esm/hooks/usePrefix.d.ts +1 -0
- package/esm/hooks/usePrefix.js +5 -0
- package/esm/hooks/useRegistry.d.ts +2 -0
- package/esm/hooks/useRegistry.js +5 -0
- package/esm/hooks/useScreen.d.ts +1 -0
- package/esm/hooks/useScreen.js +4 -0
- package/esm/hooks/useSelected.d.ts +1 -0
- package/esm/hooks/useSelected.js +5 -0
- package/esm/hooks/useSelectedNode.d.ts +6 -0
- package/esm/hooks/useSelectedNode.js +13 -0
- package/esm/hooks/useSelection.d.ts +1 -0
- package/esm/hooks/useSelection.js +5 -0
- package/esm/hooks/useTheme.d.ts +1 -0
- package/esm/hooks/useTheme.js +5 -0
- package/esm/hooks/useTransformHelper.d.ts +1 -0
- package/esm/hooks/useTransformHelper.js +5 -0
- package/esm/hooks/useTree.d.ts +1 -0
- package/esm/hooks/useTree.js +5 -0
- package/esm/hooks/useTreeNode.d.ts +1 -0
- package/esm/hooks/useTreeNode.js +5 -0
- package/esm/hooks/useValidNodeOffsetRect.d.ts +2 -0
- package/esm/hooks/useValidNodeOffsetRect.js +37 -0
- package/esm/hooks/useViewport.d.ts +1 -0
- package/esm/hooks/useViewport.js +5 -0
- package/esm/hooks/useWorkbench.d.ts +1 -0
- package/esm/hooks/useWorkbench.js +5 -0
- package/esm/hooks/useWorkspace.d.ts +2 -0
- package/esm/hooks/useWorkspace.js +15 -0
- package/esm/icons/actions.d.ts +7 -0
- package/esm/icons/actions.js +28 -0
- package/esm/icons/add.d.ts +2 -0
- package/esm/icons/add.js +4 -0
- package/esm/icons/animations.d.ts +24 -0
- package/esm/icons/animations.js +323 -0
- package/esm/icons/boolean.d.ts +2 -0
- package/esm/icons/boolean.js +3 -0
- package/esm/icons/clone.d.ts +3 -0
- package/esm/icons/clone.js +3 -0
- package/esm/icons/close.d.ts +2 -0
- package/esm/icons/close.js +3 -0
- package/esm/icons/code.d.ts +2 -0
- package/esm/icons/code.js +2 -0
- package/esm/icons/command.d.ts +2 -0
- package/esm/icons/command.js +4 -0
- package/esm/icons/component.d.ts +2 -0
- package/esm/icons/component.js +2 -0
- package/esm/icons/container.d.ts +2 -0
- package/esm/icons/container.js +4 -0
- package/esm/icons/corner.d.ts +5 -0
- package/esm/icons/corner.js +5 -0
- package/esm/icons/delete.d.ts +2 -0
- package/esm/icons/delete.js +5 -0
- package/esm/icons/design.d.ts +2 -0
- package/esm/icons/design.js +3 -0
- package/esm/icons/display.d.ts +5 -0
- package/esm/icons/display.js +5 -0
- package/esm/icons/dragmove.d.ts +2 -0
- package/esm/icons/dragmove.js +3 -0
- package/esm/icons/expand.d.ts +2 -0
- package/esm/icons/expand.js +2 -0
- package/esm/icons/expression.d.ts +2 -0
- package/esm/icons/expression.js +2 -0
- package/esm/icons/eyes.d.ts +3 -0
- package/esm/icons/eyes.js +7 -0
- package/esm/icons/flex.d.ts +22 -0
- package/esm/icons/flex.js +22 -0
- package/esm/icons/flip.d.ts +2 -0
- package/esm/icons/flip.js +2 -0
- package/esm/icons/focus.d.ts +2 -0
- package/esm/icons/focus.js +2 -0
- package/esm/icons/font.d.ts +16 -0
- package/esm/icons/font.js +16 -0
- package/esm/icons/formula.d.ts +2 -0
- package/esm/icons/formula.js +2 -0
- package/esm/icons/freemove.d.ts +2 -0
- package/esm/icons/freemove.js +3 -0
- package/esm/icons/help.d.ts +2 -0
- package/esm/icons/help.js +4 -0
- package/esm/icons/hidden.d.ts +2 -0
- package/esm/icons/hidden.js +2 -0
- package/esm/icons/history.d.ts +2 -0
- package/esm/icons/history.js +3 -0
- package/esm/icons/image.d.ts +3 -0
- package/esm/icons/image.js +3 -0
- package/esm/icons/index.d.ts +53 -0
- package/esm/icons/index.js +53 -0
- package/esm/icons/json.d.ts +2 -0
- package/esm/icons/json.js +2 -0
- package/esm/icons/logo.d.ts +4 -0
- package/esm/icons/logo.js +4 -0
- package/esm/icons/menu.d.ts +2 -0
- package/esm/icons/menu.js +3 -0
- package/esm/icons/mobile.d.ts +2 -0
- package/esm/icons/mobile.js +4 -0
- package/esm/icons/move.d.ts +2 -0
- package/esm/icons/move.js +2 -0
- package/esm/icons/number.d.ts +2 -0
- package/esm/icons/number.js +3 -0
- package/esm/icons/outline.d.ts +2 -0
- package/esm/icons/outline.js +2 -0
- package/esm/icons/page.d.ts +2 -0
- package/esm/icons/page.js +5 -0
- package/esm/icons/pc.d.ts +2 -0
- package/esm/icons/pc.js +3 -0
- package/esm/icons/play.d.ts +2 -0
- package/esm/icons/play.js +2 -0
- package/esm/icons/position.d.ts +6 -0
- package/esm/icons/position.js +6 -0
- package/esm/icons/pushpin.d.ts +3 -0
- package/esm/icons/pushpin.js +5 -0
- package/esm/icons/recover.d.ts +2 -0
- package/esm/icons/recover.js +2 -0
- package/esm/icons/redo.d.ts +2 -0
- package/esm/icons/redo.js +2 -0
- package/esm/icons/remove.d.ts +2 -0
- package/esm/icons/remove.js +2 -0
- package/esm/icons/responsive.d.ts +2 -0
- package/esm/icons/responsive.js +5 -0
- package/esm/icons/return.d.ts +2 -0
- package/esm/icons/return.js +2 -0
- package/esm/icons/selection.d.ts +2 -0
- package/esm/icons/selection.js +2 -0
- package/esm/icons/setting.d.ts +2 -0
- package/esm/icons/setting.js +2 -0
- package/esm/icons/shadow.d.ts +5 -0
- package/esm/icons/shadow.js +5 -0
- package/esm/icons/shift.d.ts +2 -0
- package/esm/icons/shift.js +2 -0
- package/esm/icons/sources.d.ts +75 -0
- package/esm/icons/sources.js +544 -0
- package/esm/icons/text.d.ts +3 -0
- package/esm/icons/text.js +5 -0
- package/esm/icons/undo.d.ts +2 -0
- package/esm/icons/undo.js +3 -0
- package/esm/icons/upload.d.ts +2 -0
- package/esm/icons/upload.js +4 -0
- package/esm/index.d.ts +9 -0
- package/esm/index.js +9 -0
- package/esm/locales/global.d.ts +17 -0
- package/esm/locales/global.js +16 -0
- package/esm/locales/icons.d.ts +133 -0
- package/esm/locales/icons.js +132 -0
- package/esm/locales/index.d.ts +1 -0
- package/esm/locales/index.js +6 -0
- package/esm/locales/operations.d.ts +51 -0
- package/esm/locales/operations.js +50 -0
- package/esm/locales/panels.d.ts +27 -0
- package/esm/locales/panels.js +26 -0
- package/esm/panels/CompositePanel.d.ts +24 -0
- package/esm/panels/CompositePanel.js +112 -0
- package/esm/panels/SettingsPanel.d.ts +7 -0
- package/esm/panels/SettingsPanel.js +53 -0
- package/esm/panels/StudioPanel.d.ts +13 -0
- package/esm/panels/StudioPanel.js +21 -0
- package/esm/panels/ToolbarPanel.d.ts +3 -0
- package/esm/panels/ToolbarPanel.js +11 -0
- package/esm/panels/ViewPanel.d.ts +9 -0
- package/esm/panels/ViewPanel.js +41 -0
- package/esm/panels/ViewportPanel.d.ts +3 -0
- package/esm/panels/ViewportPanel.js +7 -0
- package/esm/panels/WorkspacePanel.d.ts +11 -0
- package/esm/panels/WorkspacePanel.js +14 -0
- package/esm/panels/index.d.ts +8 -0
- package/esm/panels/index.js +8 -0
- package/esm/panels/styles.less +331 -0
- package/esm/simulators/MobileSimulator/body.d.ts +4 -0
- package/esm/simulators/MobileSimulator/body.js +57 -0
- package/esm/simulators/MobileSimulator/index.d.ts +7 -0
- package/esm/simulators/MobileSimulator/index.js +11 -0
- package/esm/simulators/MobileSimulator/styles.less +29 -0
- package/esm/simulators/PCSimulator/index.d.ts +7 -0
- package/esm/simulators/PCSimulator/index.js +8 -0
- package/esm/simulators/PCSimulator/styles.less +11 -0
- package/esm/simulators/ResponsiveSimulator/handle.d.ts +11 -0
- package/esm/simulators/ResponsiveSimulator/handle.js +16 -0
- package/esm/simulators/ResponsiveSimulator/index.d.ts +7 -0
- package/esm/simulators/ResponsiveSimulator/index.js +152 -0
- package/esm/simulators/ResponsiveSimulator/styles.less +56 -0
- package/esm/simulators/index.d.ts +3 -0
- package/esm/simulators/index.js +3 -0
- package/esm/theme.less +224 -0
- package/esm/types.d.ts +35 -0
- package/esm/types.js +1 -0
- package/esm/variables.less +1 -0
- package/esm/widgets/AuxToolWidget/Copy.d.ts +7 -0
- package/esm/widgets/AuxToolWidget/Copy.js +15 -0
- package/esm/widgets/AuxToolWidget/Cover.d.ts +2 -0
- package/esm/widgets/AuxToolWidget/Cover.js +52 -0
- package/esm/widgets/AuxToolWidget/DashedBox.d.ts +2 -0
- package/esm/widgets/AuxToolWidget/DashedBox.js +43 -0
- package/esm/widgets/AuxToolWidget/Delete.d.ts +7 -0
- package/esm/widgets/AuxToolWidget/Delete.js +15 -0
- package/esm/widgets/AuxToolWidget/DragHandler.d.ts +7 -0
- package/esm/widgets/AuxToolWidget/DragHandler.js +17 -0
- package/esm/widgets/AuxToolWidget/FreeSelection.d.ts +2 -0
- package/esm/widgets/AuxToolWidget/FreeSelection.js +43 -0
- package/esm/widgets/AuxToolWidget/Helpers.d.ts +15 -0
- package/esm/widgets/AuxToolWidget/Helpers.js +82 -0
- package/esm/widgets/AuxToolWidget/Insertion.d.ts +2 -0
- package/esm/widgets/AuxToolWidget/Insertion.js +70 -0
- package/esm/widgets/AuxToolWidget/ResizeHandler.d.ts +6 -0
- package/esm/widgets/AuxToolWidget/ResizeHandler.js +27 -0
- package/esm/widgets/AuxToolWidget/Selection.d.ts +8 -0
- package/esm/widgets/AuxToolWidget/Selection.js +57 -0
- package/esm/widgets/AuxToolWidget/Selector.d.ts +7 -0
- package/esm/widgets/AuxToolWidget/Selector.js +84 -0
- package/esm/widgets/AuxToolWidget/SnapLine.d.ts +2 -0
- package/esm/widgets/AuxToolWidget/SnapLine.js +30 -0
- package/esm/widgets/AuxToolWidget/SpaceBlock.d.ts +2 -0
- package/esm/widgets/AuxToolWidget/SpaceBlock.js +66 -0
- package/esm/widgets/AuxToolWidget/TranslateHandler.d.ts +6 -0
- package/esm/widgets/AuxToolWidget/TranslateHandler.js +20 -0
- package/esm/widgets/AuxToolWidget/index.d.ts +6 -0
- package/esm/widgets/AuxToolWidget/index.js +34 -0
- package/esm/widgets/AuxToolWidget/styles.less +383 -0
- package/esm/widgets/ComponentTreeWidget/index.d.ts +15 -0
- package/esm/widgets/ComponentTreeWidget/index.js +73 -0
- package/esm/widgets/ComponentTreeWidget/styles.less +6 -0
- package/esm/widgets/DesignerToolsWidget/index.d.ts +10 -0
- package/esm/widgets/DesignerToolsWidget/index.js +109 -0
- package/esm/widgets/DesignerToolsWidget/styles.less +29 -0
- package/esm/widgets/DroppableWidget/index.d.ts +15 -0
- package/esm/widgets/DroppableWidget/index.js +20 -0
- package/esm/widgets/DroppableWidget/styles.less +11 -0
- package/esm/widgets/EmptyWidget/index.d.ts +7 -0
- package/esm/widgets/EmptyWidget/index.js +46 -0
- package/esm/widgets/EmptyWidget/styles.less +27 -0
- package/esm/widgets/GhostWidget/index.d.ts +3 -0
- package/esm/widgets/GhostWidget/index.js +33 -0
- package/esm/widgets/GhostWidget/styles.less +20 -0
- package/esm/widgets/HistoryWidget/index.d.ts +3 -0
- package/esm/widgets/HistoryWidget/index.js +28 -0
- package/esm/widgets/HistoryWidget/styles.less +23 -0
- package/esm/widgets/IconWidget/index.d.ts +23 -0
- package/esm/widgets/IconWidget/index.js +102 -0
- package/esm/widgets/IconWidget/styles.less +17 -0
- package/esm/widgets/NodeActionsWidget/index.d.ts +18 -0
- package/esm/widgets/NodeActionsWidget/index.js +25 -0
- package/esm/widgets/NodeActionsWidget/styles.less +51 -0
- package/esm/widgets/NodePathWidget/index.d.ts +7 -0
- package/esm/widgets/NodePathWidget/index.js +36 -0
- package/esm/widgets/NodePathWidget/styles.less +16 -0
- package/esm/widgets/NodeTitleWidget/index.d.ts +6 -0
- package/esm/widgets/NodeTitleWidget/index.js +13 -0
- package/esm/widgets/OutlineWidget/Insertion.d.ts +5 -0
- package/esm/widgets/OutlineWidget/Insertion.js +51 -0
- package/esm/widgets/OutlineWidget/OutlineNode.d.ts +10 -0
- package/esm/widgets/OutlineWidget/OutlineNode.js +139 -0
- package/esm/widgets/OutlineWidget/context.d.ts +8 -0
- package/esm/widgets/OutlineWidget/context.js +2 -0
- package/esm/widgets/OutlineWidget/index.d.ts +10 -0
- package/esm/widgets/OutlineWidget/index.js +42 -0
- package/esm/widgets/OutlineWidget/styles.less +195 -0
- package/esm/widgets/ResourceWidget/index.d.ts +12 -0
- package/esm/widgets/ResourceWidget/index.js +53 -0
- package/esm/widgets/ResourceWidget/styles.less +87 -0
- package/esm/widgets/TextWidget/index.d.ts +10 -0
- package/esm/widgets/TextWidget/index.js +32 -0
- package/esm/widgets/ViewToolsWidget/index.d.ts +8 -0
- package/esm/widgets/ViewToolsWidget/index.js +30 -0
- package/esm/widgets/index.d.ts +15 -0
- package/esm/widgets/index.js +15 -0
- package/lib/containers/Designer.d.ts +3 -0
- package/lib/containers/Designer.js +75 -0
- package/lib/containers/Layout.d.ts +3 -0
- package/lib/containers/Layout.js +72 -0
- package/lib/containers/Simulator.d.ts +3 -0
- package/lib/containers/Simulator.js +24 -0
- package/lib/containers/Viewport.d.ts +6 -0
- package/lib/containers/Viewport.js +89 -0
- package/lib/containers/Workbench.d.ts +4 -0
- package/lib/containers/Workbench.js +15 -0
- package/lib/containers/Workspace.d.ts +8 -0
- package/lib/containers/Workspace.js +63 -0
- package/lib/containers/index.d.ts +7 -0
- package/lib/containers/index.js +23 -0
- package/lib/containers/styles.less +19 -0
- package/lib/context.d.ts +7 -0
- package/lib/context.js +9 -0
- package/lib/hooks/index.d.ts +25 -0
- package/lib/hooks/index.js +41 -0
- package/lib/hooks/useComponents.d.ts +1 -0
- package/lib/hooks/useComponents.js +7 -0
- package/lib/hooks/useCursor.d.ts +1 -0
- package/lib/hooks/useCursor.js +9 -0
- package/lib/hooks/useDesigner.d.ts +5 -0
- package/lib/hooks/useDesigner.js +17 -0
- package/lib/hooks/useHistory.d.ts +1 -0
- package/lib/hooks/useHistory.js +9 -0
- package/lib/hooks/useHover.d.ts +1 -0
- package/lib/hooks/useHover.js +9 -0
- package/lib/hooks/useLayout.d.ts +2 -0
- package/lib/hooks/useLayout.js +11 -0
- package/lib/hooks/useMoveHelper.d.ts +1 -0
- package/lib/hooks/useMoveHelper.js +9 -0
- package/lib/hooks/useNodeIdProps.d.ts +4 -0
- package/lib/hooks/useNodeIdProps.js +13 -0
- package/lib/hooks/useOperation.d.ts +1 -0
- package/lib/hooks/useOperation.js +9 -0
- package/lib/hooks/useOutline.d.ts +1 -0
- package/lib/hooks/useOutline.js +9 -0
- package/lib/hooks/usePosition.d.ts +1 -0
- package/lib/hooks/usePosition.js +9 -0
- package/lib/hooks/usePrefix.d.ts +1 -0
- package/lib/hooks/usePrefix.js +9 -0
- package/lib/hooks/useRegistry.d.ts +2 -0
- package/lib/hooks/useRegistry.js +9 -0
- package/lib/hooks/useScreen.d.ts +1 -0
- package/lib/hooks/useScreen.js +8 -0
- package/lib/hooks/useSelected.d.ts +1 -0
- package/lib/hooks/useSelected.js +9 -0
- package/lib/hooks/useSelectedNode.d.ts +6 -0
- package/lib/hooks/useSelectedNode.js +17 -0
- package/lib/hooks/useSelection.d.ts +1 -0
- package/lib/hooks/useSelection.js +9 -0
- package/lib/hooks/useTheme.d.ts +1 -0
- package/lib/hooks/useTheme.js +9 -0
- package/lib/hooks/useTransformHelper.d.ts +1 -0
- package/lib/hooks/useTransformHelper.js +9 -0
- package/lib/hooks/useTree.d.ts +1 -0
- package/lib/hooks/useTree.js +9 -0
- package/lib/hooks/useTreeNode.d.ts +1 -0
- package/lib/hooks/useTreeNode.js +9 -0
- package/lib/hooks/useValidNodeOffsetRect.d.ts +2 -0
- package/lib/hooks/useValidNodeOffsetRect.js +41 -0
- package/lib/hooks/useViewport.d.ts +1 -0
- package/lib/hooks/useViewport.js +9 -0
- package/lib/hooks/useWorkbench.d.ts +1 -0
- package/lib/hooks/useWorkbench.js +9 -0
- package/lib/hooks/useWorkspace.d.ts +2 -0
- package/lib/hooks/useWorkspace.js +19 -0
- package/lib/icons/actions.d.ts +7 -0
- package/lib/icons/actions.js +34 -0
- package/lib/icons/add.d.ts +2 -0
- package/lib/icons/add.js +10 -0
- package/lib/icons/animations.d.ts +24 -0
- package/lib/icons/animations.js +326 -0
- package/lib/icons/boolean.d.ts +2 -0
- package/lib/icons/boolean.js +9 -0
- package/lib/icons/clone.d.ts +3 -0
- package/lib/icons/clone.js +9 -0
- package/lib/icons/close.d.ts +2 -0
- package/lib/icons/close.js +9 -0
- package/lib/icons/code.d.ts +2 -0
- package/lib/icons/code.js +8 -0
- package/lib/icons/command.d.ts +2 -0
- package/lib/icons/command.js +10 -0
- package/lib/icons/component.d.ts +2 -0
- package/lib/icons/component.js +8 -0
- package/lib/icons/container.d.ts +2 -0
- package/lib/icons/container.js +10 -0
- package/lib/icons/corner.d.ts +5 -0
- package/lib/icons/corner.js +11 -0
- package/lib/icons/delete.d.ts +2 -0
- package/lib/icons/delete.js +11 -0
- package/lib/icons/design.d.ts +2 -0
- package/lib/icons/design.js +9 -0
- package/lib/icons/display.d.ts +5 -0
- package/lib/icons/display.js +11 -0
- package/lib/icons/dragmove.d.ts +2 -0
- package/lib/icons/dragmove.js +9 -0
- package/lib/icons/expand.d.ts +2 -0
- package/lib/icons/expand.js +8 -0
- package/lib/icons/expression.d.ts +2 -0
- package/lib/icons/expression.js +8 -0
- package/lib/icons/eyes.d.ts +3 -0
- package/lib/icons/eyes.js +13 -0
- package/lib/icons/flex.d.ts +22 -0
- package/lib/icons/flex.js +28 -0
- package/lib/icons/flip.d.ts +2 -0
- package/lib/icons/flip.js +8 -0
- package/lib/icons/focus.d.ts +2 -0
- package/lib/icons/focus.js +8 -0
- package/lib/icons/font.d.ts +16 -0
- package/lib/icons/font.js +22 -0
- package/lib/icons/formula.d.ts +2 -0
- package/lib/icons/formula.js +8 -0
- package/lib/icons/freemove.d.ts +2 -0
- package/lib/icons/freemove.js +9 -0
- package/lib/icons/help.d.ts +2 -0
- package/lib/icons/help.js +10 -0
- package/lib/icons/hidden.d.ts +2 -0
- package/lib/icons/hidden.js +8 -0
- package/lib/icons/history.d.ts +2 -0
- package/lib/icons/history.js +9 -0
- package/lib/icons/image.d.ts +3 -0
- package/lib/icons/image.js +9 -0
- package/lib/icons/index.d.ts +53 -0
- package/lib/icons/index.js +69 -0
- package/lib/icons/json.d.ts +2 -0
- package/lib/icons/json.js +8 -0
- package/lib/icons/logo.d.ts +4 -0
- package/lib/icons/logo.js +7 -0
- package/lib/icons/menu.d.ts +2 -0
- package/lib/icons/menu.js +9 -0
- package/lib/icons/mobile.d.ts +2 -0
- package/lib/icons/mobile.js +10 -0
- package/lib/icons/move.d.ts +2 -0
- package/lib/icons/move.js +8 -0
- package/lib/icons/number.d.ts +2 -0
- package/lib/icons/number.js +9 -0
- package/lib/icons/outline.d.ts +2 -0
- package/lib/icons/outline.js +8 -0
- package/lib/icons/page.d.ts +2 -0
- package/lib/icons/page.js +11 -0
- package/lib/icons/pc.d.ts +2 -0
- package/lib/icons/pc.js +9 -0
- package/lib/icons/play.d.ts +2 -0
- package/lib/icons/play.js +8 -0
- package/lib/icons/position.d.ts +6 -0
- package/lib/icons/position.js +12 -0
- package/lib/icons/pushpin.d.ts +3 -0
- package/lib/icons/pushpin.js +11 -0
- package/lib/icons/recover.d.ts +2 -0
- package/lib/icons/recover.js +8 -0
- package/lib/icons/redo.d.ts +2 -0
- package/lib/icons/redo.js +8 -0
- package/lib/icons/remove.d.ts +2 -0
- package/lib/icons/remove.js +8 -0
- package/lib/icons/responsive.d.ts +2 -0
- package/lib/icons/responsive.js +11 -0
- package/lib/icons/return.d.ts +2 -0
- package/lib/icons/return.js +8 -0
- package/lib/icons/selection.d.ts +2 -0
- package/lib/icons/selection.js +8 -0
- package/lib/icons/setting.d.ts +2 -0
- package/lib/icons/setting.js +8 -0
- package/lib/icons/shadow.d.ts +5 -0
- package/lib/icons/shadow.js +11 -0
- package/lib/icons/shift.d.ts +2 -0
- package/lib/icons/shift.js +8 -0
- package/lib/icons/sources.d.ts +75 -0
- package/lib/icons/sources.js +551 -0
- package/lib/icons/text.d.ts +3 -0
- package/lib/icons/text.js +11 -0
- package/lib/icons/undo.d.ts +2 -0
- package/lib/icons/undo.js +9 -0
- package/lib/icons/upload.d.ts +2 -0
- package/lib/icons/upload.js +10 -0
- package/lib/index.d.ts +9 -0
- package/lib/index.js +25 -0
- package/lib/locales/global.d.ts +17 -0
- package/lib/locales/global.js +18 -0
- package/lib/locales/icons.d.ts +133 -0
- package/lib/locales/icons.js +134 -0
- package/lib/locales/index.d.ts +1 -0
- package/lib/locales/index.js +11 -0
- package/lib/locales/operations.d.ts +51 -0
- package/lib/locales/operations.js +52 -0
- package/lib/locales/panels.d.ts +27 -0
- package/lib/locales/panels.js +28 -0
- package/lib/panels/CompositePanel.d.ts +24 -0
- package/lib/panels/CompositePanel.js +152 -0
- package/lib/panels/SettingsPanel.d.ts +7 -0
- package/lib/panels/SettingsPanel.js +92 -0
- package/lib/panels/StudioPanel.d.ts +13 -0
- package/lib/panels/StudioPanel.js +28 -0
- package/lib/panels/ToolbarPanel.d.ts +3 -0
- package/lib/panels/ToolbarPanel.js +18 -0
- package/lib/panels/ViewPanel.d.ts +9 -0
- package/lib/panels/ViewPanel.js +77 -0
- package/lib/panels/ViewportPanel.d.ts +3 -0
- package/lib/panels/ViewportPanel.js +14 -0
- package/lib/panels/WorkspacePanel.d.ts +11 -0
- package/lib/panels/WorkspacePanel.js +21 -0
- package/lib/panels/index.d.ts +8 -0
- package/lib/panels/index.js +24 -0
- package/lib/panels/styles.less +331 -0
- package/lib/simulators/MobileSimulator/body.d.ts +4 -0
- package/lib/simulators/MobileSimulator/body.js +63 -0
- package/lib/simulators/MobileSimulator/index.d.ts +7 -0
- package/lib/simulators/MobileSimulator/index.js +18 -0
- package/lib/simulators/MobileSimulator/styles.less +29 -0
- package/lib/simulators/PCSimulator/index.d.ts +7 -0
- package/lib/simulators/PCSimulator/index.js +15 -0
- package/lib/simulators/PCSimulator/styles.less +11 -0
- package/lib/simulators/ResponsiveSimulator/handle.d.ts +11 -0
- package/lib/simulators/ResponsiveSimulator/handle.js +23 -0
- package/lib/simulators/ResponsiveSimulator/index.d.ts +7 -0
- package/lib/simulators/ResponsiveSimulator/index.js +191 -0
- package/lib/simulators/ResponsiveSimulator/styles.less +56 -0
- package/lib/simulators/index.d.ts +3 -0
- package/lib/simulators/index.js +19 -0
- package/lib/theme.less +224 -0
- package/lib/types.d.ts +35 -0
- package/lib/types.js +2 -0
- package/lib/variables.less +1 -0
- package/lib/widgets/AuxToolWidget/Copy.d.ts +7 -0
- package/lib/widgets/AuxToolWidget/Copy.js +22 -0
- package/lib/widgets/AuxToolWidget/Cover.d.ts +2 -0
- package/lib/widgets/AuxToolWidget/Cover.js +91 -0
- package/lib/widgets/AuxToolWidget/DashedBox.d.ts +2 -0
- package/lib/widgets/AuxToolWidget/DashedBox.js +49 -0
- package/lib/widgets/AuxToolWidget/Delete.d.ts +7 -0
- package/lib/widgets/AuxToolWidget/Delete.js +22 -0
- package/lib/widgets/AuxToolWidget/DragHandler.d.ts +7 -0
- package/lib/widgets/AuxToolWidget/DragHandler.js +23 -0
- package/lib/widgets/AuxToolWidget/FreeSelection.d.ts +2 -0
- package/lib/widgets/AuxToolWidget/FreeSelection.js +49 -0
- package/lib/widgets/AuxToolWidget/Helpers.d.ts +15 -0
- package/lib/widgets/AuxToolWidget/Helpers.js +122 -0
- package/lib/widgets/AuxToolWidget/Insertion.d.ts +2 -0
- package/lib/widgets/AuxToolWidget/Insertion.js +76 -0
- package/lib/widgets/AuxToolWidget/ResizeHandler.d.ts +6 -0
- package/lib/widgets/AuxToolWidget/ResizeHandler.js +34 -0
- package/lib/widgets/AuxToolWidget/Selection.d.ts +8 -0
- package/lib/widgets/AuxToolWidget/Selection.js +94 -0
- package/lib/widgets/AuxToolWidget/Selector.d.ts +7 -0
- package/lib/widgets/AuxToolWidget/Selector.js +120 -0
- package/lib/widgets/AuxToolWidget/SnapLine.d.ts +2 -0
- package/lib/widgets/AuxToolWidget/SnapLine.js +36 -0
- package/lib/widgets/AuxToolWidget/SpaceBlock.d.ts +2 -0
- package/lib/widgets/AuxToolWidget/SpaceBlock.js +102 -0
- package/lib/widgets/AuxToolWidget/TranslateHandler.d.ts +6 -0
- package/lib/widgets/AuxToolWidget/TranslateHandler.js +27 -0
- package/lib/widgets/AuxToolWidget/index.d.ts +6 -0
- package/lib/widgets/AuxToolWidget/index.js +71 -0
- package/lib/widgets/AuxToolWidget/styles.less +383 -0
- package/lib/widgets/ComponentTreeWidget/index.d.ts +15 -0
- package/lib/widgets/ComponentTreeWidget/index.js +112 -0
- package/lib/widgets/ComponentTreeWidget/styles.less +6 -0
- package/lib/widgets/DesignerToolsWidget/index.d.ts +10 -0
- package/lib/widgets/DesignerToolsWidget/index.js +148 -0
- package/lib/widgets/DesignerToolsWidget/styles.less +29 -0
- package/lib/widgets/DroppableWidget/index.d.ts +15 -0
- package/lib/widgets/DroppableWidget/index.js +26 -0
- package/lib/widgets/DroppableWidget/styles.less +11 -0
- package/lib/widgets/EmptyWidget/index.d.ts +7 -0
- package/lib/widgets/EmptyWidget/index.js +52 -0
- package/lib/widgets/EmptyWidget/styles.less +27 -0
- package/lib/widgets/GhostWidget/index.d.ts +3 -0
- package/lib/widgets/GhostWidget/index.js +69 -0
- package/lib/widgets/GhostWidget/styles.less +20 -0
- package/lib/widgets/HistoryWidget/index.d.ts +3 -0
- package/lib/widgets/HistoryWidget/index.js +34 -0
- package/lib/widgets/HistoryWidget/styles.less +23 -0
- package/lib/widgets/IconWidget/index.d.ts +23 -0
- package/lib/widgets/IconWidget/index.js +141 -0
- package/lib/widgets/IconWidget/styles.less +17 -0
- package/lib/widgets/NodeActionsWidget/index.d.ts +18 -0
- package/lib/widgets/NodeActionsWidget/index.js +31 -0
- package/lib/widgets/NodeActionsWidget/styles.less +51 -0
- package/lib/widgets/NodePathWidget/index.d.ts +7 -0
- package/lib/widgets/NodePathWidget/index.js +42 -0
- package/lib/widgets/NodePathWidget/styles.less +16 -0
- package/lib/widgets/NodeTitleWidget/index.d.ts +6 -0
- package/lib/widgets/NodeTitleWidget/index.js +49 -0
- package/lib/widgets/OutlineWidget/Insertion.d.ts +5 -0
- package/lib/widgets/OutlineWidget/Insertion.js +57 -0
- package/lib/widgets/OutlineWidget/OutlineNode.d.ts +10 -0
- package/lib/widgets/OutlineWidget/OutlineNode.js +178 -0
- package/lib/widgets/OutlineWidget/context.d.ts +8 -0
- package/lib/widgets/OutlineWidget/context.js +5 -0
- package/lib/widgets/OutlineWidget/index.d.ts +10 -0
- package/lib/widgets/OutlineWidget/index.js +81 -0
- package/lib/widgets/OutlineWidget/styles.less +195 -0
- package/lib/widgets/ResourceWidget/index.d.ts +12 -0
- package/lib/widgets/ResourceWidget/index.js +92 -0
- package/lib/widgets/ResourceWidget/styles.less +87 -0
- package/lib/widgets/TextWidget/index.d.ts +10 -0
- package/lib/widgets/TextWidget/index.js +68 -0
- package/lib/widgets/ViewToolsWidget/index.d.ts +8 -0
- package/lib/widgets/ViewToolsWidget/index.js +36 -0
- package/lib/widgets/index.d.ts +15 -0
- package/lib/widgets/index.js +31 -0
- package/package.json +45 -0
- package/rollup.config.js +3 -0
- package/src/containers/Designer.tsx +50 -0
- package/src/containers/Layout.tsx +50 -0
- package/src/containers/Simulator.tsx +30 -0
- package/src/containers/Viewport.tsx +69 -0
- package/src/containers/Workbench.tsx +15 -0
- package/src/containers/Workspace.tsx +41 -0
- package/src/containers/index.ts +7 -0
- package/src/containers/styles.less +19 -0
- package/src/context.ts +17 -0
- package/src/hooks/index.ts +25 -0
- package/src/hooks/useComponents.ts +3 -0
- package/src/hooks/useCursor.ts +6 -0
- package/src/hooks/useDesigner.ts +19 -0
- package/src/hooks/useHistory.ts +6 -0
- package/src/hooks/useHover.ts +6 -0
- package/src/hooks/useLayout.ts +11 -0
- package/src/hooks/useMoveHelper.ts +6 -0
- package/src/hooks/useNodeIdProps.ts +11 -0
- package/src/hooks/useOperation.ts +6 -0
- package/src/hooks/useOutline.ts +6 -0
- package/src/hooks/usePosition.ts +5 -0
- package/src/hooks/usePrefix.ts +5 -0
- package/src/hooks/useRegistry.ts +6 -0
- package/src/hooks/useScreen.ts +5 -0
- package/src/hooks/useSelected.ts +6 -0
- package/src/hooks/useSelectedNode.ts +14 -0
- package/src/hooks/useSelection.ts +6 -0
- package/src/hooks/useTheme.ts +5 -0
- package/src/hooks/useTransformHelper.ts +6 -0
- package/src/hooks/useTree.ts +6 -0
- package/src/hooks/useTreeNode.ts +6 -0
- package/src/hooks/useValidNodeOffsetRect.ts +48 -0
- package/src/hooks/useViewport.ts +6 -0
- package/src/hooks/useWorkbench.ts +6 -0
- package/src/hooks/useWorkspace.ts +16 -0
- package/src/icons/actions.tsx +138 -0
- package/src/icons/add.tsx +8 -0
- package/src/icons/animations.tsx +325 -0
- package/src/icons/boolean.tsx +7 -0
- package/src/icons/clone.tsx +9 -0
- package/src/icons/close.tsx +7 -0
- package/src/icons/code.tsx +5 -0
- package/src/icons/command.tsx +8 -0
- package/src/icons/component.tsx +5 -0
- package/src/icons/container.tsx +8 -0
- package/src/icons/corner.tsx +26 -0
- package/src/icons/delete.tsx +9 -0
- package/src/icons/design.tsx +7 -0
- package/src/icons/display.tsx +17 -0
- package/src/icons/dragmove.tsx +10 -0
- package/src/icons/expand.tsx +5 -0
- package/src/icons/expression.tsx +5 -0
- package/src/icons/eyes.tsx +15 -0
- package/src/icons/flex.tsx +85 -0
- package/src/icons/flip.tsx +5 -0
- package/src/icons/focus.tsx +5 -0
- package/src/icons/font.tsx +61 -0
- package/src/icons/formula.tsx +5 -0
- package/src/icons/freemove.tsx +10 -0
- package/src/icons/help.tsx +8 -0
- package/src/icons/hidden.tsx +5 -0
- package/src/icons/history.tsx +7 -0
- package/src/icons/image.tsx +9 -0
- package/src/icons/index.ts +53 -0
- package/src/icons/json.tsx +5 -0
- package/src/icons/logo.tsx +5 -0
- package/src/icons/menu.tsx +7 -0
- package/src/icons/mobile.tsx +8 -0
- package/src/icons/move.tsx +5 -0
- package/src/icons/number.tsx +7 -0
- package/src/icons/outline.tsx +5 -0
- package/src/icons/page.tsx +9 -0
- package/src/icons/pc.tsx +7 -0
- package/src/icons/play.tsx +8 -0
- package/src/icons/position.tsx +30 -0
- package/src/icons/pushpin.tsx +29 -0
- package/src/icons/recover.tsx +5 -0
- package/src/icons/redo.tsx +5 -0
- package/src/icons/remove.tsx +5 -0
- package/src/icons/responsive.tsx +9 -0
- package/src/icons/return.tsx +5 -0
- package/src/icons/selection.tsx +5 -0
- package/src/icons/setting.tsx +5 -0
- package/src/icons/shadow.tsx +20 -0
- package/src/icons/shift.tsx +5 -0
- package/src/icons/sources.tsx +3377 -0
- package/src/icons/text.tsx +13 -0
- package/src/icons/undo.tsx +7 -0
- package/src/icons/upload.tsx +8 -0
- package/src/index.ts +9 -0
- package/src/locales/global.ts +16 -0
- package/src/locales/icons.ts +132 -0
- package/src/locales/index.ts +7 -0
- package/src/locales/operations.ts +50 -0
- package/src/locales/panels.ts +26 -0
- package/src/panels/CompositePanel.tsx +195 -0
- package/src/panels/SettingsPanel.tsx +85 -0
- package/src/panels/StudioPanel.tsx +54 -0
- package/src/panels/ToolbarPanel.tsx +19 -0
- package/src/panels/ViewPanel.tsx +62 -0
- package/src/panels/ViewportPanel.tsx +10 -0
- package/src/panels/WorkspacePanel.tsx +31 -0
- package/src/panels/index.ts +8 -0
- package/src/panels/styles.less +331 -0
- package/src/simulators/MobileSimulator/body.tsx +78 -0
- package/src/simulators/MobileSimulator/index.tsx +21 -0
- package/src/simulators/MobileSimulator/styles.less +29 -0
- package/src/simulators/PCSimulator/index.tsx +17 -0
- package/src/simulators/PCSimulator/styles.less +11 -0
- package/src/simulators/ResponsiveSimulator/handle.tsx +29 -0
- package/src/simulators/ResponsiveSimulator/index.tsx +193 -0
- package/src/simulators/ResponsiveSimulator/styles.less +56 -0
- package/src/simulators/index.tsx +3 -0
- package/src/theme.less +224 -0
- package/src/types.ts +41 -0
- package/src/variables.less +1 -0
- package/src/widgets/AuxToolWidget/Copy.tsx +28 -0
- package/src/widgets/AuxToolWidget/Cover.tsx +76 -0
- package/src/widgets/AuxToolWidget/DashedBox.tsx +55 -0
- package/src/widgets/AuxToolWidget/Delete.tsx +29 -0
- package/src/widgets/AuxToolWidget/DragHandler.tsx +29 -0
- package/src/widgets/AuxToolWidget/FreeSelection.tsx +53 -0
- package/src/widgets/AuxToolWidget/Helpers.tsx +116 -0
- package/src/widgets/AuxToolWidget/Insertion.tsx +80 -0
- package/src/widgets/AuxToolWidget/ResizeHandler.tsx +35 -0
- package/src/widgets/AuxToolWidget/Selection.tsx +85 -0
- package/src/widgets/AuxToolWidget/Selector.tsx +125 -0
- package/src/widgets/AuxToolWidget/SnapLine.tsx +40 -0
- package/src/widgets/AuxToolWidget/SpaceBlock.tsx +112 -0
- package/src/widgets/AuxToolWidget/TranslateHandler.tsx +29 -0
- package/src/widgets/AuxToolWidget/index.tsx +40 -0
- package/src/widgets/AuxToolWidget/styles.less +383 -0
- package/src/widgets/ComponentTreeWidget/index.tsx +99 -0
- package/src/widgets/ComponentTreeWidget/styles.less +6 -0
- package/src/widgets/DesignerToolsWidget/index.tsx +206 -0
- package/src/widgets/DesignerToolsWidget/styles.less +29 -0
- package/src/widgets/DroppableWidget/index.tsx +63 -0
- package/src/widgets/DroppableWidget/styles.less +11 -0
- package/src/widgets/EmptyWidget/index.tsx +58 -0
- package/src/widgets/EmptyWidget/styles.less +27 -0
- package/src/widgets/GhostWidget/index.tsx +47 -0
- package/src/widgets/GhostWidget/styles.less +20 -0
- package/src/widgets/HistoryWidget/index.tsx +42 -0
- package/src/widgets/HistoryWidget/styles.less +23 -0
- package/src/widgets/IconWidget/index.tsx +152 -0
- package/src/widgets/IconWidget/styles.less +17 -0
- package/src/widgets/NodeActionsWidget/index.tsx +56 -0
- package/src/widgets/NodeActionsWidget/styles.less +51 -0
- package/src/widgets/NodePathWidget/index.tsx +57 -0
- package/src/widgets/NodePathWidget/styles.less +16 -0
- package/src/widgets/NodeTitleWidget/index.tsx +20 -0
- package/src/widgets/OutlineWidget/Insertion.tsx +63 -0
- package/src/widgets/OutlineWidget/OutlineNode.tsx +198 -0
- package/src/widgets/OutlineWidget/context.ts +9 -0
- package/src/widgets/OutlineWidget/index.tsx +66 -0
- package/src/widgets/OutlineWidget/styles.less +195 -0
- package/src/widgets/ResourceWidget/index.tsx +110 -0
- package/src/widgets/ResourceWidget/styles.less +87 -0
- package/src/widgets/TextWidget/index.tsx +43 -0
- package/src/widgets/ViewToolsWidget/index.tsx +72 -0
- package/src/widgets/index.ts +15 -0
- package/tsconfig.build.json +10 -0
- package/tsconfig.json +5 -0
package/package.json
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@formily-design/react",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"license": "MIT",
|
|
5
|
+
"main": "lib",
|
|
6
|
+
"types": "lib/index.d.ts",
|
|
7
|
+
"engines": {
|
|
8
|
+
"npm": ">=3.0.0"
|
|
9
|
+
},
|
|
10
|
+
"module": "esm",
|
|
11
|
+
"repository": {
|
|
12
|
+
"type": "git",
|
|
13
|
+
"url": "git+https://github.com/alibaba/designable.git"
|
|
14
|
+
},
|
|
15
|
+
"bugs": {
|
|
16
|
+
"url": "https://github.com/alibaba/designable/issues"
|
|
17
|
+
},
|
|
18
|
+
"homepage": "https://github.com/alibaba/designable#readme",
|
|
19
|
+
"scripts": {
|
|
20
|
+
"build": "rimraf -rf lib esm dist && npm run build:cjs && npm run build:esm && npm run build:umd && ts-node copy",
|
|
21
|
+
"build:cjs": "tsc --project tsconfig.build.json",
|
|
22
|
+
"build:esm": "tsc --project tsconfig.build.json --module es2015 --outDir esm",
|
|
23
|
+
"build:umd": "rollup --config --verbose",
|
|
24
|
+
"build:copy": "ts-node copy"
|
|
25
|
+
},
|
|
26
|
+
"devDependencies": {
|
|
27
|
+
"@formily/reactive": "^2.0.2",
|
|
28
|
+
"@formily/reactive-react": "^2.0.2"
|
|
29
|
+
},
|
|
30
|
+
"peerDependencies": {
|
|
31
|
+
"@formily/reactive": "^2.0.2",
|
|
32
|
+
"@formily/reactive-react": "^2.0.2",
|
|
33
|
+
"antd": "^5.29.3",
|
|
34
|
+
"react": "18.x || 17.x"
|
|
35
|
+
},
|
|
36
|
+
"dependencies": {
|
|
37
|
+
"@formily-design/core": "1.0.0",
|
|
38
|
+
"@formily-design/shared": "1.0.0",
|
|
39
|
+
"dateformat": "^4.5.1"
|
|
40
|
+
},
|
|
41
|
+
"publishConfig": {
|
|
42
|
+
"access": "public"
|
|
43
|
+
},
|
|
44
|
+
"gitHead": "f3496a519e4be3f14900ddbe44744ae482247047"
|
|
45
|
+
}
|
package/rollup.config.js
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import React, { useEffect, useRef } from 'react'
|
|
2
|
+
import { Engine, GlobalRegistry } from '@formily-design/core'
|
|
3
|
+
import { DesignerEngineContext } from '../context'
|
|
4
|
+
import { IDesignerProps } from '../types'
|
|
5
|
+
import { GhostWidget } from '../widgets'
|
|
6
|
+
import { useDesigner } from '../hooks'
|
|
7
|
+
import { Layout } from './Layout'
|
|
8
|
+
import * as icons from '../icons'
|
|
9
|
+
|
|
10
|
+
GlobalRegistry.registerDesignerIcons(icons)
|
|
11
|
+
|
|
12
|
+
export const Designer: React.FC<IDesignerProps> = (props) => {
|
|
13
|
+
const engine = useDesigner()
|
|
14
|
+
const ref = useRef<Engine>()
|
|
15
|
+
useEffect(() => {
|
|
16
|
+
if (props.engine) {
|
|
17
|
+
if (props.engine && ref.current) {
|
|
18
|
+
if (props.engine !== ref.current) {
|
|
19
|
+
ref.current.unmount()
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
props.engine.mount()
|
|
23
|
+
ref.current = props.engine
|
|
24
|
+
}
|
|
25
|
+
return () => {
|
|
26
|
+
if (props.engine) {
|
|
27
|
+
props.engine.unmount()
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
}, [props.engine])
|
|
31
|
+
|
|
32
|
+
if (engine)
|
|
33
|
+
throw new Error(
|
|
34
|
+
'There can only be one Designable Engine Context in the React Tree'
|
|
35
|
+
)
|
|
36
|
+
|
|
37
|
+
return (
|
|
38
|
+
<Layout {...props}>
|
|
39
|
+
<DesignerEngineContext.Provider value={props.engine}>
|
|
40
|
+
{props.children}
|
|
41
|
+
<GhostWidget />
|
|
42
|
+
</DesignerEngineContext.Provider>
|
|
43
|
+
</Layout>
|
|
44
|
+
)
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
Designer.defaultProps = {
|
|
48
|
+
prefixCls: 'dn-',
|
|
49
|
+
theme: 'light',
|
|
50
|
+
}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import React, { useContext, Fragment, useRef, useLayoutEffect } from 'react'
|
|
2
|
+
import { each } from '@formily-design/shared'
|
|
3
|
+
import { DesignerLayoutContext } from '../context'
|
|
4
|
+
import { IDesignerLayoutProps } from '../types'
|
|
5
|
+
import cls from 'classnames'
|
|
6
|
+
|
|
7
|
+
export const Layout: React.FC<IDesignerLayoutProps> = (props) => {
|
|
8
|
+
const layout = useContext(DesignerLayoutContext)
|
|
9
|
+
const ref = useRef<HTMLDivElement>()
|
|
10
|
+
useLayoutEffect(() => {
|
|
11
|
+
if (ref.current) {
|
|
12
|
+
each(props.variables, (value, key) => {
|
|
13
|
+
ref.current.style.setProperty(`--${key}`, value)
|
|
14
|
+
})
|
|
15
|
+
}
|
|
16
|
+
}, [])
|
|
17
|
+
|
|
18
|
+
if (layout) {
|
|
19
|
+
return <Fragment>{props.children}</Fragment>
|
|
20
|
+
}
|
|
21
|
+
return (
|
|
22
|
+
<div
|
|
23
|
+
ref={ref}
|
|
24
|
+
className={cls(
|
|
25
|
+
{
|
|
26
|
+
[`${props.prefixCls}app`]: true,
|
|
27
|
+
[`${props.prefixCls}${props.theme}`]: props.theme,
|
|
28
|
+
},
|
|
29
|
+
props.className
|
|
30
|
+
)}
|
|
31
|
+
style={props.style}
|
|
32
|
+
>
|
|
33
|
+
<DesignerLayoutContext.Provider
|
|
34
|
+
value={{
|
|
35
|
+
theme: props.theme,
|
|
36
|
+
prefixCls: props.prefixCls,
|
|
37
|
+
position: props.position,
|
|
38
|
+
}}
|
|
39
|
+
>
|
|
40
|
+
{props.children}
|
|
41
|
+
</DesignerLayoutContext.Provider>
|
|
42
|
+
</div>
|
|
43
|
+
)
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
Layout.defaultProps = {
|
|
47
|
+
theme: 'light',
|
|
48
|
+
prefixCls: 'dn-',
|
|
49
|
+
position: 'fixed',
|
|
50
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import { ScreenType } from '@formily-design/core'
|
|
3
|
+
import { requestIdle } from '@formily-design/shared'
|
|
4
|
+
import { observer } from '@formily/reactive-react'
|
|
5
|
+
import { useScreen } from '../hooks'
|
|
6
|
+
import {
|
|
7
|
+
MobileSimulator,
|
|
8
|
+
PCSimulator,
|
|
9
|
+
ResponsiveSimulator,
|
|
10
|
+
} from '../simulators'
|
|
11
|
+
|
|
12
|
+
export type ISimulatorProps = React.HTMLAttributes<HTMLDivElement>
|
|
13
|
+
|
|
14
|
+
export const Simulator: React.FC<ISimulatorProps> = observer(
|
|
15
|
+
(props: ISimulatorProps) => {
|
|
16
|
+
const screen = useScreen()
|
|
17
|
+
if (screen.type === ScreenType.PC)
|
|
18
|
+
return <PCSimulator {...props}>{props.children}</PCSimulator>
|
|
19
|
+
if (screen.type === ScreenType.Mobile)
|
|
20
|
+
return <MobileSimulator {...props}>{props.children}</MobileSimulator>
|
|
21
|
+
if (screen.type === ScreenType.Responsive)
|
|
22
|
+
return (
|
|
23
|
+
<ResponsiveSimulator {...props}>{props.children}</ResponsiveSimulator>
|
|
24
|
+
)
|
|
25
|
+
return <PCSimulator {...props}>{props.children}</PCSimulator>
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
scheduler: requestIdle,
|
|
29
|
+
}
|
|
30
|
+
)
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import React, { useLayoutEffect, useRef, useState } from 'react'
|
|
2
|
+
import { usePrefix, useViewport } from '../hooks'
|
|
3
|
+
import { AuxToolWidget, EmptyWidget } from '../widgets'
|
|
4
|
+
import { Viewport as ViewportType } from '@formily-design/core'
|
|
5
|
+
import { requestIdle, globalThisPolyfill } from '@formily-design/shared'
|
|
6
|
+
import cls from 'classnames'
|
|
7
|
+
export interface IViewportProps
|
|
8
|
+
extends Omit<React.HTMLAttributes<HTMLDivElement>, 'placeholder'> {
|
|
9
|
+
placeholder?: React.ReactNode
|
|
10
|
+
dragTipsDirection?: 'left' | 'right'
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export const Viewport: React.FC<IViewportProps> = ({
|
|
14
|
+
placeholder,
|
|
15
|
+
dragTipsDirection,
|
|
16
|
+
...props
|
|
17
|
+
}) => {
|
|
18
|
+
const [loaded, setLoaded] = useState(false)
|
|
19
|
+
const prefix = usePrefix('viewport')
|
|
20
|
+
const viewport = useViewport()
|
|
21
|
+
const ref = useRef<HTMLDivElement>()
|
|
22
|
+
const viewportRef = useRef<ViewportType>()
|
|
23
|
+
const isFrameRef = useRef(false)
|
|
24
|
+
useLayoutEffect(() => {
|
|
25
|
+
const frameElement = ref.current.querySelector('iframe')
|
|
26
|
+
if (!viewport) return
|
|
27
|
+
if (viewportRef.current && viewportRef.current !== viewport) {
|
|
28
|
+
viewportRef.current.onUnmount()
|
|
29
|
+
}
|
|
30
|
+
if (frameElement) {
|
|
31
|
+
frameElement.addEventListener('load', () => {
|
|
32
|
+
viewport.onMount(frameElement, frameElement.contentWindow)
|
|
33
|
+
requestIdle(() => {
|
|
34
|
+
isFrameRef.current = true
|
|
35
|
+
setLoaded(true)
|
|
36
|
+
})
|
|
37
|
+
})
|
|
38
|
+
} else {
|
|
39
|
+
viewport.onMount(ref.current, globalThisPolyfill)
|
|
40
|
+
requestIdle(() => {
|
|
41
|
+
isFrameRef.current = false
|
|
42
|
+
setLoaded(true)
|
|
43
|
+
})
|
|
44
|
+
}
|
|
45
|
+
viewportRef.current = viewport
|
|
46
|
+
return () => {
|
|
47
|
+
viewport.onUnmount()
|
|
48
|
+
}
|
|
49
|
+
}, [viewport])
|
|
50
|
+
|
|
51
|
+
return (
|
|
52
|
+
<div
|
|
53
|
+
{...props}
|
|
54
|
+
ref={ref}
|
|
55
|
+
className={cls(prefix, props.className)}
|
|
56
|
+
style={{
|
|
57
|
+
opacity: !loaded ? 0 : 1,
|
|
58
|
+
overflow: isFrameRef.current ? 'hidden' : 'overlay',
|
|
59
|
+
...props.style,
|
|
60
|
+
}}
|
|
61
|
+
>
|
|
62
|
+
{props.children}
|
|
63
|
+
<AuxToolWidget />
|
|
64
|
+
<EmptyWidget dragTipsDirection={dragTipsDirection}>
|
|
65
|
+
{placeholder}
|
|
66
|
+
</EmptyWidget>
|
|
67
|
+
</div>
|
|
68
|
+
)
|
|
69
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import { observer } from '@formily/reactive-react'
|
|
3
|
+
import { useWorkbench } from '../hooks'
|
|
4
|
+
import { Workspace } from './Workspace'
|
|
5
|
+
|
|
6
|
+
export const Workbench: React.FC<{ children?: React.ReactNode }> = observer(
|
|
7
|
+
(props) => {
|
|
8
|
+
const workbench = useWorkbench()
|
|
9
|
+
return (
|
|
10
|
+
<Workspace id={workbench.currentWorkspace?.id}>
|
|
11
|
+
{props.children}
|
|
12
|
+
</Workspace>
|
|
13
|
+
)
|
|
14
|
+
}
|
|
15
|
+
)
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import React, { useMemo, useRef, Fragment } from 'react'
|
|
2
|
+
import { useDesigner } from '../hooks'
|
|
3
|
+
import { WorkspaceContext } from '../context'
|
|
4
|
+
export interface IWorkspaceProps {
|
|
5
|
+
children?: React.ReactNode
|
|
6
|
+
id?: string
|
|
7
|
+
title?: string
|
|
8
|
+
description?: string
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export const Workspace: React.FC<IWorkspaceProps> = ({
|
|
12
|
+
id,
|
|
13
|
+
title,
|
|
14
|
+
description,
|
|
15
|
+
...props
|
|
16
|
+
}) => {
|
|
17
|
+
const oldId = useRef<string>()
|
|
18
|
+
const designer = useDesigner()
|
|
19
|
+
const workspace = useMemo(() => {
|
|
20
|
+
if (!designer) return
|
|
21
|
+
if (oldId.current && oldId.current !== id) {
|
|
22
|
+
const old = designer.workbench.findWorkspaceById(oldId.current)
|
|
23
|
+
if (old) old.viewport.detachEvents()
|
|
24
|
+
}
|
|
25
|
+
const workspace = {
|
|
26
|
+
id: id || 'index',
|
|
27
|
+
title,
|
|
28
|
+
description,
|
|
29
|
+
}
|
|
30
|
+
designer.workbench.ensureWorkspace(workspace)
|
|
31
|
+
oldId.current = workspace.id
|
|
32
|
+
return workspace
|
|
33
|
+
}, [id, designer])
|
|
34
|
+
return (
|
|
35
|
+
<Fragment>
|
|
36
|
+
<WorkspaceContext.Provider value={workspace}>
|
|
37
|
+
{props.children}
|
|
38
|
+
</WorkspaceContext.Provider>
|
|
39
|
+
</Fragment>
|
|
40
|
+
)
|
|
41
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
@import '../variables.less';
|
|
2
|
+
|
|
3
|
+
.@{prefix-cls}-viewport {
|
|
4
|
+
height: 100%;
|
|
5
|
+
width: 100%;
|
|
6
|
+
min-height: 100px;
|
|
7
|
+
position: relative;
|
|
8
|
+
outline: none;
|
|
9
|
+
box-sizing: border-box;
|
|
10
|
+
user-select: none;
|
|
11
|
+
overflow: overlay;
|
|
12
|
+
|
|
13
|
+
// & > * {
|
|
14
|
+
// width: fit-content;
|
|
15
|
+
// height: fit-content;
|
|
16
|
+
// min-width: 100%;
|
|
17
|
+
// min-height: 100%;
|
|
18
|
+
// }
|
|
19
|
+
}
|
package/src/context.ts
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { createContext } from 'react'
|
|
2
|
+
import { TreeNode, Engine } from '@formily-design/core'
|
|
3
|
+
import {
|
|
4
|
+
IDesignerLayoutContext,
|
|
5
|
+
IWorkspaceContext,
|
|
6
|
+
IDesignerComponents,
|
|
7
|
+
} from './types'
|
|
8
|
+
|
|
9
|
+
export const DesignerComponentsContext = createContext<IDesignerComponents>({})
|
|
10
|
+
|
|
11
|
+
export const DesignerLayoutContext = createContext<IDesignerLayoutContext>(null)
|
|
12
|
+
|
|
13
|
+
export const DesignerEngineContext = createContext<Engine>(null)
|
|
14
|
+
|
|
15
|
+
export const TreeNodeContext = createContext<TreeNode>(null)
|
|
16
|
+
|
|
17
|
+
export const WorkspaceContext = createContext<IWorkspaceContext>(null)
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
export * from './useDesigner'
|
|
2
|
+
export * from './useCursor'
|
|
3
|
+
export * from './useScreen'
|
|
4
|
+
export * from './useTree'
|
|
5
|
+
export * from './useTheme'
|
|
6
|
+
export * from './usePosition'
|
|
7
|
+
export * from './useTreeNode'
|
|
8
|
+
export * from './useHover'
|
|
9
|
+
export * from './useViewport'
|
|
10
|
+
export * from './useOutline'
|
|
11
|
+
export * from './useSelection'
|
|
12
|
+
export * from './useOperation'
|
|
13
|
+
export * from './useWorkbench'
|
|
14
|
+
export * from './useWorkspace'
|
|
15
|
+
export * from './useLayout'
|
|
16
|
+
export * from './useHistory'
|
|
17
|
+
export * from './usePrefix'
|
|
18
|
+
export * from './useRegistry'
|
|
19
|
+
export * from './useValidNodeOffsetRect'
|
|
20
|
+
export * from './useMoveHelper'
|
|
21
|
+
export * from './useNodeIdProps'
|
|
22
|
+
export * from './useTransformHelper'
|
|
23
|
+
export * from './useSelectedNode'
|
|
24
|
+
export * from './useSelected'
|
|
25
|
+
export * from './useComponents'
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { useContext, useEffect } from 'react'
|
|
2
|
+
import { Engine } from '@formily-design/core'
|
|
3
|
+
import { DesignerEngineContext } from '../context'
|
|
4
|
+
import { isFn, globalThisPolyfill } from '@formily-design/shared'
|
|
5
|
+
export interface IEffects {
|
|
6
|
+
(engine: Engine): void
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export const useDesigner = (effects?: IEffects): Engine => {
|
|
10
|
+
const designer: Engine =
|
|
11
|
+
globalThisPolyfill['__DESIGNABLE_ENGINE__'] ||
|
|
12
|
+
useContext(DesignerEngineContext)
|
|
13
|
+
useEffect(() => {
|
|
14
|
+
if (isFn(effects)) {
|
|
15
|
+
return effects(designer)
|
|
16
|
+
}
|
|
17
|
+
}, [])
|
|
18
|
+
return designer
|
|
19
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { useContext } from 'react'
|
|
2
|
+
import { DesignerLayoutContext } from '../context'
|
|
3
|
+
import { IDesignerLayoutContext } from '../types'
|
|
4
|
+
import { globalThisPolyfill } from '@formily-design/shared'
|
|
5
|
+
|
|
6
|
+
export const useLayout = (): IDesignerLayoutContext => {
|
|
7
|
+
return (
|
|
8
|
+
globalThisPolyfill['__DESIGNABLE_LAYOUT__'] ||
|
|
9
|
+
useContext(DesignerLayoutContext)
|
|
10
|
+
)
|
|
11
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { TreeNode } from '@formily-design/core'
|
|
2
|
+
import { useDesigner } from './useDesigner'
|
|
3
|
+
import { useTreeNode } from './useTreeNode'
|
|
4
|
+
|
|
5
|
+
export const useNodeIdProps = (node?: TreeNode) => {
|
|
6
|
+
const target = useTreeNode()
|
|
7
|
+
const designer = useDesigner()
|
|
8
|
+
return {
|
|
9
|
+
[designer.props.nodeIdAttrName]: node ? node.id : target.id,
|
|
10
|
+
}
|
|
11
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { useSelected } from './useSelected'
|
|
2
|
+
import { useTree } from './useTree'
|
|
3
|
+
|
|
4
|
+
export const useSelectedNode = (workspaceId?: string) => {
|
|
5
|
+
const selected = useSelected(workspaceId)
|
|
6
|
+
const tree = useTree(workspaceId)
|
|
7
|
+
return tree?.findById?.(selected[0])
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* @deprecated
|
|
12
|
+
* please use useSelectedNode
|
|
13
|
+
*/
|
|
14
|
+
export const useCurrentNode = useSelectedNode
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { useState, useEffect, useMemo, useCallback } from 'react'
|
|
2
|
+
import { TreeNode, CursorStatus, CursorDragType } from '@formily-design/core'
|
|
3
|
+
import { LayoutObserver } from '@formily-design/shared'
|
|
4
|
+
import { useViewport } from './useViewport'
|
|
5
|
+
import { useDesigner } from './useDesigner'
|
|
6
|
+
|
|
7
|
+
const isEqualRect = (rect1: DOMRect, rect2: DOMRect) => {
|
|
8
|
+
return (
|
|
9
|
+
rect1?.x === rect2?.x &&
|
|
10
|
+
rect1?.y === rect2?.y &&
|
|
11
|
+
rect1?.width === rect2?.width &&
|
|
12
|
+
rect1?.height === rect2?.height
|
|
13
|
+
)
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export const useValidNodeOffsetRect = (node: TreeNode) => {
|
|
17
|
+
const engine = useDesigner()
|
|
18
|
+
const viewport = useViewport()
|
|
19
|
+
const [, forceUpdate] = useState(null)
|
|
20
|
+
const rectRef = useMemo(
|
|
21
|
+
() => ({ current: viewport.getValidNodeOffsetRect(node) as any }),
|
|
22
|
+
[viewport]
|
|
23
|
+
)
|
|
24
|
+
|
|
25
|
+
const element = viewport.findElementById(node?.id)
|
|
26
|
+
|
|
27
|
+
const compute = useCallback(() => {
|
|
28
|
+
if (
|
|
29
|
+
engine.cursor.status !== CursorStatus.Normal &&
|
|
30
|
+
engine.cursor.dragType === CursorDragType.Move
|
|
31
|
+
)
|
|
32
|
+
return
|
|
33
|
+
const nextRect = viewport.getValidNodeOffsetRect(node) as any
|
|
34
|
+
if (!isEqualRect(rectRef.current, nextRect) && nextRect) {
|
|
35
|
+
rectRef.current = nextRect
|
|
36
|
+
forceUpdate([])
|
|
37
|
+
}
|
|
38
|
+
}, [viewport, node])
|
|
39
|
+
|
|
40
|
+
useEffect(() => {
|
|
41
|
+
const layoutObserver = new LayoutObserver(compute)
|
|
42
|
+
if (element) layoutObserver.observe(element)
|
|
43
|
+
return () => {
|
|
44
|
+
layoutObserver.disconnect()
|
|
45
|
+
}
|
|
46
|
+
}, [node, viewport, element])
|
|
47
|
+
return rectRef.current
|
|
48
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { useContext } from 'react'
|
|
2
|
+
import { useDesigner } from './useDesigner'
|
|
3
|
+
import { WorkspaceContext } from '../context'
|
|
4
|
+
import { Workspace } from '@formily-design/core'
|
|
5
|
+
import { globalThisPolyfill } from '@formily-design/shared'
|
|
6
|
+
|
|
7
|
+
export const useWorkspace = (id?: string): Workspace => {
|
|
8
|
+
const designer = useDesigner()
|
|
9
|
+
const workspaceId = id || useContext(WorkspaceContext)?.id
|
|
10
|
+
if (workspaceId) {
|
|
11
|
+
return designer.workbench.findWorkspaceById(workspaceId)
|
|
12
|
+
}
|
|
13
|
+
if (globalThisPolyfill['__DESIGNABLE_WORKSPACE__'])
|
|
14
|
+
return globalThisPolyfill['__DESIGNABLE_WORKSPACE__']
|
|
15
|
+
return designer.workbench.currentWorkspace
|
|
16
|
+
}
|