@formily-design/react 1.0.0 → 1.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (172) hide show
  1. package/esm/panels/styles.less +14 -0
  2. package/lib/panels/styles.less +14 -0
  3. package/package.json +4 -4
  4. package/copy.ts +0 -6
  5. package/dist/designable.react.umd.production.css +0 -1
  6. package/dist/designable.react.umd.production.js +0 -6
  7. package/dist/designable.react.umd.production.min.css +0 -1
  8. package/dist/designable.react.umd.production.min.js +0 -3769
  9. package/rollup.config.js +0 -3
  10. package/src/containers/Designer.tsx +0 -50
  11. package/src/containers/Layout.tsx +0 -50
  12. package/src/containers/Simulator.tsx +0 -30
  13. package/src/containers/Viewport.tsx +0 -69
  14. package/src/containers/Workbench.tsx +0 -15
  15. package/src/containers/Workspace.tsx +0 -41
  16. package/src/containers/index.ts +0 -7
  17. package/src/containers/styles.less +0 -19
  18. package/src/context.ts +0 -17
  19. package/src/hooks/index.ts +0 -25
  20. package/src/hooks/useComponents.ts +0 -3
  21. package/src/hooks/useCursor.ts +0 -6
  22. package/src/hooks/useDesigner.ts +0 -19
  23. package/src/hooks/useHistory.ts +0 -6
  24. package/src/hooks/useHover.ts +0 -6
  25. package/src/hooks/useLayout.ts +0 -11
  26. package/src/hooks/useMoveHelper.ts +0 -6
  27. package/src/hooks/useNodeIdProps.ts +0 -11
  28. package/src/hooks/useOperation.ts +0 -6
  29. package/src/hooks/useOutline.ts +0 -6
  30. package/src/hooks/usePosition.ts +0 -5
  31. package/src/hooks/usePrefix.ts +0 -5
  32. package/src/hooks/useRegistry.ts +0 -6
  33. package/src/hooks/useScreen.ts +0 -5
  34. package/src/hooks/useSelected.ts +0 -6
  35. package/src/hooks/useSelectedNode.ts +0 -14
  36. package/src/hooks/useSelection.ts +0 -6
  37. package/src/hooks/useTheme.ts +0 -5
  38. package/src/hooks/useTransformHelper.ts +0 -6
  39. package/src/hooks/useTree.ts +0 -6
  40. package/src/hooks/useTreeNode.ts +0 -6
  41. package/src/hooks/useValidNodeOffsetRect.ts +0 -48
  42. package/src/hooks/useViewport.ts +0 -6
  43. package/src/hooks/useWorkbench.ts +0 -6
  44. package/src/hooks/useWorkspace.ts +0 -16
  45. package/src/icons/actions.tsx +0 -138
  46. package/src/icons/add.tsx +0 -8
  47. package/src/icons/animations.tsx +0 -325
  48. package/src/icons/boolean.tsx +0 -7
  49. package/src/icons/clone.tsx +0 -9
  50. package/src/icons/close.tsx +0 -7
  51. package/src/icons/code.tsx +0 -5
  52. package/src/icons/command.tsx +0 -8
  53. package/src/icons/component.tsx +0 -5
  54. package/src/icons/container.tsx +0 -8
  55. package/src/icons/corner.tsx +0 -26
  56. package/src/icons/delete.tsx +0 -9
  57. package/src/icons/design.tsx +0 -7
  58. package/src/icons/display.tsx +0 -17
  59. package/src/icons/dragmove.tsx +0 -10
  60. package/src/icons/expand.tsx +0 -5
  61. package/src/icons/expression.tsx +0 -5
  62. package/src/icons/eyes.tsx +0 -15
  63. package/src/icons/flex.tsx +0 -85
  64. package/src/icons/flip.tsx +0 -5
  65. package/src/icons/focus.tsx +0 -5
  66. package/src/icons/font.tsx +0 -61
  67. package/src/icons/formula.tsx +0 -5
  68. package/src/icons/freemove.tsx +0 -10
  69. package/src/icons/help.tsx +0 -8
  70. package/src/icons/hidden.tsx +0 -5
  71. package/src/icons/history.tsx +0 -7
  72. package/src/icons/image.tsx +0 -9
  73. package/src/icons/index.ts +0 -53
  74. package/src/icons/json.tsx +0 -5
  75. package/src/icons/logo.tsx +0 -5
  76. package/src/icons/menu.tsx +0 -7
  77. package/src/icons/mobile.tsx +0 -8
  78. package/src/icons/move.tsx +0 -5
  79. package/src/icons/number.tsx +0 -7
  80. package/src/icons/outline.tsx +0 -5
  81. package/src/icons/page.tsx +0 -9
  82. package/src/icons/pc.tsx +0 -7
  83. package/src/icons/play.tsx +0 -8
  84. package/src/icons/position.tsx +0 -30
  85. package/src/icons/pushpin.tsx +0 -29
  86. package/src/icons/recover.tsx +0 -5
  87. package/src/icons/redo.tsx +0 -5
  88. package/src/icons/remove.tsx +0 -5
  89. package/src/icons/responsive.tsx +0 -9
  90. package/src/icons/return.tsx +0 -5
  91. package/src/icons/selection.tsx +0 -5
  92. package/src/icons/setting.tsx +0 -5
  93. package/src/icons/shadow.tsx +0 -20
  94. package/src/icons/shift.tsx +0 -5
  95. package/src/icons/sources.tsx +0 -3377
  96. package/src/icons/text.tsx +0 -13
  97. package/src/icons/undo.tsx +0 -7
  98. package/src/icons/upload.tsx +0 -8
  99. package/src/index.ts +0 -9
  100. package/src/locales/global.ts +0 -16
  101. package/src/locales/icons.ts +0 -132
  102. package/src/locales/index.ts +0 -7
  103. package/src/locales/operations.ts +0 -50
  104. package/src/locales/panels.ts +0 -26
  105. package/src/panels/CompositePanel.tsx +0 -195
  106. package/src/panels/SettingsPanel.tsx +0 -85
  107. package/src/panels/StudioPanel.tsx +0 -54
  108. package/src/panels/ToolbarPanel.tsx +0 -19
  109. package/src/panels/ViewPanel.tsx +0 -62
  110. package/src/panels/ViewportPanel.tsx +0 -10
  111. package/src/panels/WorkspacePanel.tsx +0 -31
  112. package/src/panels/index.ts +0 -8
  113. package/src/panels/styles.less +0 -331
  114. package/src/simulators/MobileSimulator/body.tsx +0 -78
  115. package/src/simulators/MobileSimulator/index.tsx +0 -21
  116. package/src/simulators/MobileSimulator/styles.less +0 -29
  117. package/src/simulators/PCSimulator/index.tsx +0 -17
  118. package/src/simulators/PCSimulator/styles.less +0 -11
  119. package/src/simulators/ResponsiveSimulator/handle.tsx +0 -29
  120. package/src/simulators/ResponsiveSimulator/index.tsx +0 -193
  121. package/src/simulators/ResponsiveSimulator/styles.less +0 -56
  122. package/src/simulators/index.tsx +0 -3
  123. package/src/theme.less +0 -224
  124. package/src/types.ts +0 -41
  125. package/src/variables.less +0 -1
  126. package/src/widgets/AuxToolWidget/Copy.tsx +0 -28
  127. package/src/widgets/AuxToolWidget/Cover.tsx +0 -76
  128. package/src/widgets/AuxToolWidget/DashedBox.tsx +0 -55
  129. package/src/widgets/AuxToolWidget/Delete.tsx +0 -29
  130. package/src/widgets/AuxToolWidget/DragHandler.tsx +0 -29
  131. package/src/widgets/AuxToolWidget/FreeSelection.tsx +0 -53
  132. package/src/widgets/AuxToolWidget/Helpers.tsx +0 -116
  133. package/src/widgets/AuxToolWidget/Insertion.tsx +0 -80
  134. package/src/widgets/AuxToolWidget/ResizeHandler.tsx +0 -35
  135. package/src/widgets/AuxToolWidget/Selection.tsx +0 -85
  136. package/src/widgets/AuxToolWidget/Selector.tsx +0 -125
  137. package/src/widgets/AuxToolWidget/SnapLine.tsx +0 -40
  138. package/src/widgets/AuxToolWidget/SpaceBlock.tsx +0 -112
  139. package/src/widgets/AuxToolWidget/TranslateHandler.tsx +0 -29
  140. package/src/widgets/AuxToolWidget/index.tsx +0 -40
  141. package/src/widgets/AuxToolWidget/styles.less +0 -383
  142. package/src/widgets/ComponentTreeWidget/index.tsx +0 -99
  143. package/src/widgets/ComponentTreeWidget/styles.less +0 -6
  144. package/src/widgets/DesignerToolsWidget/index.tsx +0 -206
  145. package/src/widgets/DesignerToolsWidget/styles.less +0 -29
  146. package/src/widgets/DroppableWidget/index.tsx +0 -63
  147. package/src/widgets/DroppableWidget/styles.less +0 -11
  148. package/src/widgets/EmptyWidget/index.tsx +0 -58
  149. package/src/widgets/EmptyWidget/styles.less +0 -27
  150. package/src/widgets/GhostWidget/index.tsx +0 -47
  151. package/src/widgets/GhostWidget/styles.less +0 -20
  152. package/src/widgets/HistoryWidget/index.tsx +0 -42
  153. package/src/widgets/HistoryWidget/styles.less +0 -23
  154. package/src/widgets/IconWidget/index.tsx +0 -152
  155. package/src/widgets/IconWidget/styles.less +0 -17
  156. package/src/widgets/NodeActionsWidget/index.tsx +0 -56
  157. package/src/widgets/NodeActionsWidget/styles.less +0 -51
  158. package/src/widgets/NodePathWidget/index.tsx +0 -57
  159. package/src/widgets/NodePathWidget/styles.less +0 -16
  160. package/src/widgets/NodeTitleWidget/index.tsx +0 -20
  161. package/src/widgets/OutlineWidget/Insertion.tsx +0 -63
  162. package/src/widgets/OutlineWidget/OutlineNode.tsx +0 -198
  163. package/src/widgets/OutlineWidget/context.ts +0 -9
  164. package/src/widgets/OutlineWidget/index.tsx +0 -66
  165. package/src/widgets/OutlineWidget/styles.less +0 -195
  166. package/src/widgets/ResourceWidget/index.tsx +0 -110
  167. package/src/widgets/ResourceWidget/styles.less +0 -87
  168. package/src/widgets/TextWidget/index.tsx +0 -43
  169. package/src/widgets/ViewToolsWidget/index.tsx +0 -72
  170. package/src/widgets/index.ts +0 -15
  171. package/tsconfig.build.json +0 -10
  172. package/tsconfig.json +0 -5
@@ -1,193 +0,0 @@
1
- import React, { useRef } from 'react'
2
- import { observer } from '@formily/reactive-react'
3
- import {
4
- Engine,
5
- DragStartEvent,
6
- DragMoveEvent,
7
- DragStopEvent,
8
- CursorDragType,
9
- } from '@formily-design/core'
10
- import {
11
- calcSpeedFactor,
12
- createUniformSpeedAnimation,
13
- } from '@formily-design/shared'
14
- import { useScreen, useDesigner, usePrefix } from '../../hooks'
15
- import { IconWidget } from '../../widgets'
16
- import { ResizeHandle, ResizeHandleType } from './handle'
17
-
18
- import cls from 'classnames'
19
- import './styles.less'
20
-
21
- const useResizeEffect = (
22
- container: React.MutableRefObject<HTMLDivElement>,
23
- content: React.MutableRefObject<HTMLDivElement>,
24
- engine: Engine
25
- ) => {
26
- let status: ResizeHandleType = null
27
- let startX = 0
28
- let startY = 0
29
- let startWidth = 0
30
- let startHeight = 0
31
- let animationX = null
32
- let animationY = null
33
-
34
- const getStyle = (status: ResizeHandleType) => {
35
- if (status === ResizeHandleType.Resize) return 'nwse-resize'
36
- if (status === ResizeHandleType.ResizeHeight) return 'ns-resize'
37
- if (status === ResizeHandleType.ResizeWidth) return 'ew-resize'
38
- }
39
-
40
- const updateSize = (deltaX: number, deltaY: number) => {
41
- const containerRect = container.current?.getBoundingClientRect()
42
- if (status === ResizeHandleType.Resize) {
43
- engine.screen.setSize(startWidth + deltaX, startHeight + deltaY)
44
- container.current.scrollBy(
45
- containerRect.width + deltaX,
46
- containerRect.height + deltaY
47
- )
48
- } else if (status === ResizeHandleType.ResizeHeight) {
49
- engine.screen.setSize(startWidth, startHeight + deltaY)
50
- container.current.scrollBy(
51
- container.current.scrollLeft,
52
- containerRect.height + deltaY
53
- )
54
- } else if (status === ResizeHandleType.ResizeWidth) {
55
- engine.screen.setSize(startWidth + deltaX, startHeight)
56
- container.current.scrollBy(
57
- containerRect.width + deltaX,
58
- container.current.scrollTop
59
- )
60
- }
61
- }
62
-
63
- engine.subscribeTo(DragStartEvent, (e) => {
64
- if (!engine.workbench.currentWorkspace?.viewport) return
65
- const target = e.data.target as HTMLElement
66
- if (target?.closest(`*[${engine.props.screenResizeHandlerAttrName}]`)) {
67
- const rect = content.current?.getBoundingClientRect()
68
- if (!rect) return
69
- status = target.getAttribute(
70
- engine.props.screenResizeHandlerAttrName
71
- ) as ResizeHandleType
72
- engine.cursor.setStyle(getStyle(status))
73
- startX = e.data.topClientX
74
- startY = e.data.topClientY
75
- startWidth = rect.width
76
- startHeight = rect.height
77
- engine.cursor.setDragType(CursorDragType.Resize)
78
- }
79
- })
80
- engine.subscribeTo(DragMoveEvent, (e) => {
81
- if (!engine.workbench.currentWorkspace?.viewport) return
82
- if (!status) return
83
- const deltaX = e.data.topClientX - startX
84
- const deltaY = e.data.topClientY - startY
85
- const containerRect = container.current?.getBoundingClientRect()
86
- const distanceX = Math.floor(containerRect.right - e.data.topClientX)
87
- const distanceY = Math.floor(containerRect.bottom - e.data.topClientY)
88
- const factorX = calcSpeedFactor(distanceX, 10)
89
- const factorY = calcSpeedFactor(distanceY, 10)
90
- updateSize(deltaX, deltaY)
91
- if (distanceX <= 10) {
92
- if (!animationX) {
93
- animationX = createUniformSpeedAnimation(1000 * factorX, (delta) => {
94
- updateSize(deltaX + delta, deltaY)
95
- })
96
- }
97
- } else {
98
- if (animationX) {
99
- animationX = animationX()
100
- }
101
- }
102
-
103
- if (distanceY <= 10) {
104
- if (!animationY) {
105
- animationY = createUniformSpeedAnimation(300 * factorY, (delta) => {
106
- updateSize(deltaX, deltaY + delta)
107
- })
108
- }
109
- } else {
110
- if (animationY) {
111
- animationY = animationY()
112
- }
113
- }
114
- })
115
- engine.subscribeTo(DragStopEvent, () => {
116
- if (!status) return
117
- status = null
118
- engine.cursor.setStyle('')
119
- engine.cursor.setDragType(CursorDragType.Move)
120
- if (animationX) {
121
- animationX = animationX()
122
- }
123
- if (animationY) {
124
- animationY = animationY()
125
- }
126
- })
127
- }
128
-
129
- export interface IResponsiveSimulatorProps
130
- extends React.HTMLAttributes<HTMLDivElement> {
131
- className?: string
132
- style?: React.CSSProperties
133
- }
134
-
135
- export const ResponsiveSimulator: React.FC<IResponsiveSimulatorProps> =
136
- observer((props) => {
137
- const container = useRef<HTMLDivElement>()
138
- const content = useRef<HTMLDivElement>()
139
- const prefix = usePrefix('responsive-simulator')
140
- const screen = useScreen()
141
- useDesigner((engine) => {
142
- useResizeEffect(container, content, engine)
143
- })
144
- return (
145
- <div
146
- {...props}
147
- className={cls(prefix, props.className)}
148
- style={{
149
- height: '100%',
150
- width: '100%',
151
- minHeight: 100,
152
- position: 'relative',
153
- ...props.style,
154
- }}
155
- >
156
- <div
157
- ref={container}
158
- style={{
159
- position: 'absolute',
160
- top: 0,
161
- left: 0,
162
- height: '100%',
163
- width: '100%',
164
- overflow: 'overlay',
165
- }}
166
- >
167
- <div
168
- ref={content}
169
- style={{
170
- width: screen.width,
171
- height: screen.height,
172
- paddingRight: 15,
173
- paddingBottom: 15,
174
- position: 'relative',
175
- boxSizing: 'border-box',
176
- overflow: 'hidden',
177
- }}
178
- >
179
- {props.children}
180
- <ResizeHandle type={ResizeHandleType.Resize}>
181
- <IconWidget infer="DragMove" style={{ pointerEvents: 'none' }} />
182
- </ResizeHandle>
183
- <ResizeHandle type={ResizeHandleType.ResizeHeight}>
184
- <IconWidget infer="Menu" style={{ pointerEvents: 'none' }} />
185
- </ResizeHandle>
186
- <ResizeHandle type={ResizeHandleType.ResizeWidth}>
187
- <IconWidget infer="Menu" style={{ pointerEvents: 'none' }} />
188
- </ResizeHandle>
189
- </div>
190
- </div>
191
- </div>
192
- )
193
- })
@@ -1,56 +0,0 @@
1
- @import '../../variables.less';
2
-
3
- .@{prefix-cls}-responsive-simulator {
4
- background-color: var(--dn-responsive-simulator-bg-color);
5
- }
6
-
7
- .@{prefix-cls}-resize-handle {
8
- position: absolute;
9
- transition: 0.2s all ease-in-out;
10
- box-sizing: border-box;
11
- user-select: none;
12
- bottom: 0;
13
- z-index: 10;
14
- background: var(--dn-resize-handle-bg-color);
15
- color: var(--dn-resize-handle-color);
16
- display: flex;
17
- justify-content: center;
18
- align-items: center;
19
-
20
- &-RESIZE_WIDTH {
21
- top: 0;
22
- bottom: 15px;
23
- cursor: ew-resize;
24
-
25
- svg {
26
- transform-origin: center;
27
- transform: rotate(-90deg);
28
- }
29
- }
30
-
31
- &-RESIZE_HEIGHT {
32
- left: 0;
33
- right: 15px;
34
- cursor: ns-resize;
35
- }
36
-
37
- &-RESIZE {
38
- cursor: nwse-resize;
39
- }
40
-
41
- &-RESIZE_HEIGHT,
42
- &-RESIZE {
43
- height: 15px;
44
- }
45
-
46
- &-RESIZE_WIDTH,
47
- &-RESIZE {
48
- right: 0;
49
- width: 15px;
50
- }
51
-
52
- &:hover {
53
- background: var(--dn-resize-handle-hover-bg-color);
54
- color: var(--dn-resize-handle-hover-color);
55
- }
56
- }
@@ -1,3 +0,0 @@
1
- export * from './PCSimulator'
2
- export * from './MobileSimulator'
3
- export * from './ResponsiveSimulator'
package/src/theme.less DELETED
@@ -1,224 +0,0 @@
1
- @import './variables.less';
2
-
3
- :root {
4
- //品牌色
5
- --dn-brand-color: rgba(24, 144, 255, 1);
6
- --dn-brand-hovering: rgba(64, 169, 255, 1);
7
- --dn-brand-dragging: rgba(24, 144, 255, 0.26);
8
- --dn-brand-dropping: rgba(24, 144, 255, 0.34);
9
- --dn-brand-moving: rgba(24, 144, 255, 0.5);
10
- //白色调色版
11
- --dn-white: #fff;
12
- --dn-white-gray: #d9d9d9;
13
- --dn-white-gray-light: #eee;
14
- --dn-white-gray-lighter: #f0f0f0;
15
- --dn-white-gray-dark: #aaa;
16
- //灰色调色板
17
- --dn-gray: #333;
18
- --dn-gray-light: #444;
19
- --dn-gray-lighter: #666;
20
- --dn-gray-dark: #222;
21
- --dn-black: #1a1a1a;
22
- }
23
-
24
- .@{prefix-cls}-light {
25
- --dn-aux-cover-rect-dragging-color: var(--dn-brand-dragging);
26
- --dn-aux-cover-rect-dropping-color: var(--dn-brand-dropping);
27
- --dn-aux-free-selection-background-color: var(--dn-brand-color);
28
- --dn-aux-free-selection-border-color: var(--dn-brand-color);
29
- --dn-aux-insertion-color: var(--dn-brand-color);
30
- --dn-aux-dashed-box-color: var(--dn-brand-color);
31
- --dn-aux-dashed-box-title-color: var(--dn-gray);
32
- --dn-aux-selection-box-border-color: var(--dn-brand-color);
33
- --dn-aux-selection-box-color: var(--dn-gray);
34
- --dn-ghost-color: var(--dn-white);
35
- --dn-ghost-bg-color: var(--dn-brand-moving);
36
- --dn-outline-tree-bg-color: var(--dn-white);
37
- --dn-outline-tree-header-border-color: var(--dn-white-gray-light);
38
- --dn-outline-tree-color: var(--dn-gray);
39
- --dn-outline-tree-insertion-bg-color: var(--dn-brand-color);
40
- --dn-outline-tree-node-header-color: var(--dn-gray);
41
- --dn-outline-tree-node-hover-color: var(--dn-brand-color);
42
-
43
- --dn-toolbar-input-color: var(--dn-gray-dark);
44
- --dn-toolbar-input-bg-color: var(--dn-white);
45
- --dn-toolbar-input-border-color: var(--dn-white-gray-light);
46
- --dn-toolbar-input-hover-border-color: var(--dn-white-gray-light);
47
- --dn-toolbar-input-handler-bg-color: var(--dn-white);
48
-
49
- --dn-resize-handle-bg-color: var(--dn-white-gray-light);
50
- --dn-resize-handle-hover-bg-color: var(--dn-white-gray-lighter);
51
- --dn-resize-handle-color: var(--dn-gray-light);
52
- --dn-resize-handle-hover-color: var(--dn-white-lighter);
53
-
54
- --dn-mobile-simulator-bg-color: var(--dn-white-gray-light);
55
- --dn-mobile-simulator-body-bg-color: var(--dn-white);
56
- --dn-mobile-simulator-border-color: var(--dn-gray-dark);
57
- --dn-responsive-simulator-bg-color: var(--dn-white);
58
- --dn-pc-simulator-bg-color: var(--dn-white);
59
-
60
- --dn-aux-selector-btn-color: var(--dn-white);
61
- --dn-aux-selector-btn-bg-color: var(--dn-brand-color);
62
- --dn-aux-selector-btn-border-color: var(--dn-brand-color);
63
- --dn-aux-selector-btn-hover-color: var(--dn-white);
64
- --dn-aux-selector-btn-hover-bg-color: var(--dn-brand-hovering);
65
- --dn-aux-selector-btn-hover-border-color: var(--dn-brand-hovering);
66
- --dn-aux-selector-btn-active-color: var(--dn-white);
67
- --dn-aux-selector-btn-active-bg-color: var(--dn-brand-hovering);
68
- --dn-aux-selector-btn-active-border-color: var(--dn-brand-hovering);
69
-
70
- --dn-panel-border-color: var(--dn-white-gray);
71
- --dn-panel-active-bg-color: var(--dn-white-gray-light);
72
- --dn-resource-content-bg-color: var(--dn-white);
73
-
74
- --dn-composite-panel-tabs-bg-color: var(--dn-white);
75
- --dn-composite-panel-tabs-active-bg-color: var(--dn-white);
76
- --dn-composite-panel-highlight-bg-color: var(--dn-white-gray-light);
77
- --dn-composite-panel-tabs-color: var(--dn-gray-lighter);
78
- --dn-composite-panel-tabs-hover-color: var(--dn-brand-color);
79
- --dn-composite-panel-tabs-content-bg-color: var(--dn-white);
80
- --dn-composite-panel-tabs-header-color: var(--dn-gray-lighter);
81
-
82
- --dn-collapse-header-color: var(--dn-gray);
83
-
84
- --dn-resource-item-color: var(--dn-gray);
85
- --dn-resource-item-hover-border-color: var(--dn-brand-color);
86
- --dn-resource-item-hover-color: var(--dn-brand-color);
87
-
88
- --dn-main-panel-header-bg-color: var(--dn-white);
89
- --dn-workspace-panel-bg-color: var(--dn-white-gray-light);
90
-
91
- --dn-scrollbar-color: var(--dn-white-gray);
92
- --dn-scrollbar-hover-color: var(--white-dn-gray-lighter);
93
-
94
- --dn-empty-bg-color: var(--dn-white);
95
-
96
- --dn-droppable-bg-color: var(--dn-white-gray-lighter);
97
- --dn-droppable-border-color: var(--dn-white-gray-dark);
98
- --dn-droppable-color: var(--dn-gray-lighter);
99
- }
100
-
101
- .@{prefix-cls}-dark {
102
- --dn-aux-cover-rect-dragging-color: var(--dn-brand-dragging);
103
- --dn-aux-cover-rect-dropping-color: var(--dn-brand-dropping);
104
- --dn-aux-free-selection-background-color: var(--dn-brand-color);
105
- --dn-aux-free-selection-border-color: var(--dn-brand-color);
106
- --dn-aux-insertion-color: var(--dn-brand-color);
107
- --dn-aux-dashed-box-color: var(--dn-brand-color);
108
- --dn-aux-dashed-box-title-color: var(--dn-brand-color);
109
- --dn-aux-selection-box-border-color: var(--dn-brand-color);
110
- --dn-aux-selection-box-color: var(--dn-gray);
111
- --dn-ghost-color: var(--dn-white);
112
- --dn-ghost-bg-color: var(--dn-brand-moving);
113
- --dn-outline-tree-bg-color: var(--dn-gray-dark);
114
- --dn-outline-tree-header-border-color: var(--dn-gray);
115
- --dn-outline-tree-color: var(--dn-white-gray);
116
- --dn-outline-tree-insertion-bg-color: var(--dn-brand-color);
117
- --dn-outline-tree-node-header-color: var(--dn-white-gray);
118
- --dn-outline-tree-node-hover-color: var(--dn-white-gray);
119
-
120
- --dn-toolbar-input-color: var(--dn-white-gray);
121
- --dn-toolbar-input-bg-color: transparent;
122
- --dn-toolbar-input-border-color: var(--dn-gray-light);
123
- --dn-toolbar-input-hover-border-color: var(--dn-brand-color);
124
- --dn-toolbar-input-handler-bg-color: var(--dn-gray-light);
125
- --dn-resize-handle-bg-color: var(--dn-gray-light);
126
- --dn-resize-handle-hover-bg-color: var(--dn-gray-lighter);
127
- --dn-resize-handle-color: var(--dn-gray-lighter);
128
- --dn-resize-handle-hover-color: var(--dn-white-gray-dark);
129
-
130
- --dn-mobile-simulator-bg-color: var(--dn-black);
131
- --dn-mobile-simulator-body-bg-color: var(--dn-black);
132
- --dn-mobile-simulator-border-color: var(--dn-black);
133
- --dn-responsive-simulator-bg-color: var(--dn-black);
134
- --dn-pc-simulator-bg-color: var(--dn-black);
135
-
136
- --dn-aux-selector-btn-color: var(--dn-white);
137
- --dn-aux-selector-btn-bg-color: var(--dn-brand-color);
138
- --dn-aux-selector-btn-border-color: var(--dn-brand-color);
139
- --dn-aux-selector-btn-hover-color: var(--dn-white);
140
- --dn-aux-selector-btn-hover-bg-color: var(--dn-brand-hovering);
141
- --dn-aux-selector-btn-hover-border-color: var(--dn-brand-hovering);
142
- --dn-aux-selector-btn-active-color: var(--dn-white);
143
- --dn-aux-selector-btn-active-bg-color: var(--dn-brand-hovering);
144
- --dn-aux-selector-btn-active-border-color: var(--dn-brand-hovering);
145
-
146
- --dn-panel-border-color: var(--dn-gray-light);
147
- --dn-panel-active-bg-color: var(--dn-gray);
148
- --dn-resource-content-bg-color: var(--dn-gray-dark);
149
-
150
- --dn-composite-panel-tabs-bg-color: var(--dn-gray-dark);
151
- --dn-composite-panel-tabs-active-bg-color: var(--dn-gray-dark);
152
- --dn-composite-panel-highlight-bg-color: var(--dn-black);
153
- --dn-composite-panel-tabs-color: var(--dn-white-gray-dark);
154
- --dn-composite-panel-tabs-hover-color: var(--dn-brand-color);
155
- --dn-composite-panel-tabs-content-bg-color: var(--dn-gray-dark);
156
- --dn-composite-panel-tabs-header-color: var(--dn-white-gray);
157
-
158
- --dn-collapse-header-color: var(--dn-white-gray);
159
-
160
- --dn-resource-item-color: var(--dn-white-gray);
161
- --dn-resource-item-hover-color: var(--dn-brand-color);
162
-
163
- --dn-main-panel-header-bg-color: var(--dn-gray-dark);
164
- --dn-workspace-panel-bg-color: var(--dn-gray-dark);
165
-
166
- --dn-scrollbar-color: var(--dn-gray-light);
167
- --dn-scrollbar-hover-color: var(--dn-gray-lighter);
168
-
169
- --dn-empty-bg-color: var(--dn-gray-dark);
170
-
171
- --dn-droppable-bg-color: var(--dn-gray);
172
- --dn-droppable-border-color: var(--dn-gray-light);
173
- --dn-droppable-color: var(--dn-white);
174
- }
175
-
176
- .@{prefix-cls}-app {
177
- ::-webkit-scrollbar {
178
- width: 5px;
179
- height: 5px;
180
- }
181
-
182
- ::-webkit-scrollbar-thumb {
183
- background-color: var(--dn-scrollbar-color);
184
- border-radius: 0;
185
- transition: all 0.25s ease-in-out;
186
- }
187
-
188
- ::-webkit-scrollbar-thumb:hover {
189
- background-color: var(--dn-scrollbar-hover-color);
190
- }
191
-
192
- color: var(--dn-gray-dark);
193
- font-size: 14px;
194
- font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto,
195
- 'Helvetica Neue', Arial, 'Noto Sans', sans-serif, 'Apple Color Emoji',
196
- 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji';
197
- font-variant: tabular-nums;
198
- line-height: 1.5715;
199
- font-feature-settings: 'tnum';
200
-
201
- * {
202
- box-sizing: border-box;
203
- }
204
-
205
- *[contenteditable='true'] {
206
- min-width: 1px;
207
- min-height: 14px;
208
- cursor: text !important;
209
- outline: none !important;
210
- }
211
-
212
- *[data-content-editable]:not(*[contenteditable='true']) {
213
- &:empty::before {
214
- content: 'Please Input';
215
- display: block;
216
- opacity: 0.6;
217
- }
218
-
219
- &:hover {
220
- cursor: text !important;
221
- opacity: 0.8;
222
- }
223
- }
224
- }
package/src/types.ts DELETED
@@ -1,41 +0,0 @@
1
- import React from 'react'
2
- import { Engine, IResource, IBehavior } from '@formily-design/core'
3
-
4
- export interface IDesignerLayoutProps {
5
- children?: React.ReactNode
6
- prefixCls?: string
7
- theme?: 'dark' | 'light' | (string & {})
8
- variables?: Record<string, string>
9
- position?: 'fixed' | 'absolute' | 'relative'
10
- style?: React.CSSProperties
11
- className?: string
12
- }
13
- export interface IDesignerProps extends IDesignerLayoutProps {
14
- engine: Engine
15
- }
16
-
17
- export interface IDesignerComponents {
18
- [key: string]: DnFC<any> | DnComponent<any>
19
- }
20
-
21
- export interface IDesignerLayoutContext {
22
- theme?: 'dark' | 'light' | (string & {})
23
- prefixCls: string
24
- position: 'fixed' | 'absolute' | 'relative'
25
- }
26
-
27
- export interface IWorkspaceContext {
28
- id: string
29
- title?: string
30
- description?: string
31
- }
32
-
33
- export type DnFC<P = {}> = React.FC<P> & {
34
- Resource?: IResource[]
35
- Behavior?: IBehavior[]
36
- }
37
-
38
- export type DnComponent<P = {}> = React.ComponentType<P> & {
39
- Resource?: IResource[]
40
- Behavior?: IBehavior[]
41
- }
@@ -1 +0,0 @@
1
- @prefix-cls: ~'dn';
@@ -1,28 +0,0 @@
1
- import React from 'react'
2
- import { TreeNode } from '@formily-design/core'
3
- import { usePrefix } from '../../hooks'
4
- import { IconWidget } from '../IconWidget'
5
- import { Button } from 'antd'
6
- export interface ICopyProps {
7
- node: TreeNode
8
- style?: React.CSSProperties
9
- }
10
-
11
- export const Copy: React.FC<ICopyProps> = ({ node, style }) => {
12
- const prefix = usePrefix('aux-copy')
13
- if (node === node.root) return null
14
- return (
15
- <Button
16
- className={prefix}
17
- style={style}
18
- type="primary"
19
- onClick={() => {
20
- TreeNode.clone([node])
21
- }}
22
- >
23
- <IconWidget infer="Clone" />
24
- </Button>
25
- )
26
- }
27
-
28
- Copy.displayName = 'Copy'
@@ -1,76 +0,0 @@
1
- import React, { Fragment } from 'react'
2
- import {
3
- useViewport,
4
- useMoveHelper,
5
- useCursor,
6
- useValidNodeOffsetRect,
7
- usePrefix,
8
- } from '../../hooks'
9
- import { observer } from '@formily/reactive-react'
10
- import { CursorStatus, ClosestPosition, TreeNode } from '@formily-design/core'
11
- import cls from 'classnames'
12
- interface ICoverRectProps {
13
- node: TreeNode
14
- dragging?: boolean
15
- dropping?: boolean
16
- }
17
-
18
- const CoverRect: React.FC<ICoverRectProps> = (props) => {
19
- const prefix = usePrefix('aux-cover-rect')
20
- const rect = useValidNodeOffsetRect(props.node)
21
- const createCoverStyle = () => {
22
- const baseStyle: React.CSSProperties = {
23
- position: 'absolute',
24
- top: 0,
25
- left: 0,
26
- pointerEvents: 'none',
27
- }
28
- if (rect) {
29
- baseStyle.transform = `perspective(1px) translate3d(${rect.x}px,${rect.y}px,0)`
30
- baseStyle.height = rect.height
31
- baseStyle.width = rect.width
32
- }
33
- return baseStyle
34
- }
35
-
36
- return (
37
- <div
38
- className={cls(prefix, {
39
- dragging: props.dragging,
40
- dropping: props.dropping,
41
- })}
42
- style={createCoverStyle()}
43
- ></div>
44
- )
45
- }
46
-
47
- export const Cover = observer(() => {
48
- const viewportMoveHelper = useMoveHelper()
49
- const viewport = useViewport()
50
- const cursor = useCursor()
51
- const renderDropCover = () => {
52
- if (
53
- !viewportMoveHelper.closestNode ||
54
- !viewportMoveHelper.closestNode?.allowAppend(
55
- viewportMoveHelper.dragNodes
56
- ) ||
57
- viewportMoveHelper.viewportClosestDirection !== ClosestPosition.Inner
58
- )
59
- return null
60
- return <CoverRect node={viewportMoveHelper.closestNode} dropping />
61
- }
62
- if (cursor.status !== CursorStatus.Dragging) return null
63
-
64
- return (
65
- <Fragment>
66
- {viewportMoveHelper.dragNodes.map((node) => {
67
- if (!node) return
68
- if (!viewport.findElementById(node.id)) return
69
- return <CoverRect key={node.id} node={node} dragging />
70
- })}
71
- {renderDropCover()}
72
- </Fragment>
73
- )
74
- })
75
-
76
- Cover.displayName = 'Cover'
@@ -1,55 +0,0 @@
1
- import React from 'react'
2
- import {
3
- useHover,
4
- usePrefix,
5
- useValidNodeOffsetRect,
6
- useSelection,
7
- } from '../../hooks'
8
- import { observer } from '@formily/reactive-react'
9
-
10
- export const DashedBox = observer(() => {
11
- const hover = useHover()
12
- const prefix = usePrefix('aux-dashed-box')
13
- const selection = useSelection()
14
- const rect = useValidNodeOffsetRect(hover?.node)
15
- const createTipsStyle = () => {
16
- const baseStyle: React.CSSProperties = {
17
- top: 0,
18
- left: 0,
19
- pointerEvents: 'none',
20
- boxSizing: 'border-box',
21
- visibility: 'hidden',
22
- zIndex: 2,
23
- }
24
- if (rect) {
25
- baseStyle.transform = `perspective(1px) translate3d(${rect.x}px,${rect.y}px,0)`
26
- baseStyle.height = rect.height
27
- baseStyle.width = rect.width
28
- baseStyle.visibility = 'visible'
29
- }
30
- return baseStyle
31
- }
32
- if (!hover.node) return null
33
- if (hover.node.hidden) return null
34
- if (selection.selected.includes(hover.node.id)) return null
35
- return (
36
- <div className={prefix} style={createTipsStyle()}>
37
- <span
38
- className={prefix + '-title'}
39
- style={{
40
- position: 'absolute',
41
- bottom: '100%',
42
- left: 0,
43
- fontSize: 12,
44
- userSelect: 'none',
45
- fontWeight: 'lighter',
46
- whiteSpace: 'nowrap',
47
- }}
48
- >
49
- {hover?.node.getMessage('title')}
50
- </span>
51
- </div>
52
- )
53
- })
54
-
55
- DashedBox.displayName = 'DashedBox'