@zuzjs/ui 0.3.3 → 0.3.5
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/README.md +0 -0
- package/dist/hooks.js +89 -0
- package/dist/styles.css +37 -62
- package/dist/ui.js +679 -0
- package/jest.config.js +0 -0
- package/package.json +17 -18
- package/rollup.config.js +30 -47
- package/tsconfig.json +0 -0
- package/tsconfig.lib.json +0 -0
- package/tsconfig.spec.json +0 -0
- package/dist/index.js +0 -1879
- package/src/actions/addForm.tsx +0 -0
- package/src/actions/index.tsx +0 -29
- package/src/actions/redo.tsx +0 -1
- package/src/actions/reset.tsx +0 -1
- package/src/actions/undo.tsx +0 -1
- package/src/comps/app.tsx +0 -34
- package/src/comps/box.tsx +0 -28
- package/src/comps/button.tsx +0 -47
- package/src/comps/checkbox.tsx +0 -74
- package/src/comps/component.tsx +0 -32
- package/src/comps/contextmenu.tsx +0 -60
- package/src/comps/cover.tsx +0 -34
- package/src/comps/form.tsx +0 -89
- package/src/comps/heading.tsx +0 -31
- package/src/comps/icon.tsx +0 -36
- package/src/comps/image.tsx +0 -34
- package/src/comps/input.tsx +0 -224
- package/src/comps/masonry.tsx +0 -192
- package/src/comps/mediaplayer.tsx +0 -12
- package/src/comps/placeholder.tsx +0 -58
- package/src/comps/root.tsx +0 -32
- package/src/comps/select.tsx +0 -63
- package/src/comps/spacer.tsx +0 -20
- package/src/comps/spinner.tsx +0 -36
- package/src/comps/text.tsx +0 -27
- package/src/comps/toaster.tsx +0 -123
- package/src/comps/tweet.tsx +0 -48
- package/src/context/AppContext.tsx +0 -3
- package/src/context/AppProvider.tsx +0 -106
- package/src/context/_AppProvider.tsx +0 -116
- package/src/context/combineReducers.tsx +0 -47
- package/src/context/combineState.tsx +0 -14
- package/src/context/createSlice.tsx +0 -40
- package/src/context/index.tsx +0 -6
- package/src/context/reduceReducers.tsx +0 -6
- package/src/context/store/appbase.tsx +0 -19
- package/src/context/store/lang.tsx +0 -26
- package/src/context/store/theme.tsx +0 -54
- package/src/core/extractCurrentDesignState.tsx +0 -0
- package/src/core/index.ts +0 -431
- package/src/core/router.ts +0 -86
- package/src/core/styles.ts +0 -372
- package/src/hooks/index.tsx +0 -10
- package/src/hooks/useAppReducer.tsx +0 -40
- package/src/hooks/useChooseEffect.tsx +0 -6
- package/src/hooks/useContextMenu.tsx +0 -123
- package/src/hooks/useDevice.tsx +0 -168
- package/src/hooks/useDispatch.tsx +0 -37
- package/src/hooks/useImage.tsx +0 -84
- package/src/hooks/useLang.tsx +0 -9
- package/src/hooks/useMediaPlayer.tsx +0 -27
- package/src/hooks/useNavigator.tsx +0 -6
- package/src/hooks/useRender.tsx +0 -29
- package/src/hooks/useResizeObserver.tsx +0 -84
- package/src/hooks/useRouter.tsx +0 -45
- package/src/hooks/useSelector.tsx +0 -9
- package/src/hooks/useStore.tsx +0 -27
- package/src/hooks/useTheme.tsx +0 -9
- package/src/hooks/useToast.tsx +0 -11
- package/src/index.tsx +0 -33
- package/src/kit/Builder.tsx +0 -18
- package/src/kit/Component.tsx +0 -32
- package/src/kit/Header.tsx +0 -21
- package/src/scss/constants.scss +0 -4
- package/src/scss/mixins.scss +0 -3
- package/src/scss/props.scss +0 -70
- package/src/scss/style.scss +0 -133
package/src/core/styles.ts
DELETED
|
@@ -1,372 +0,0 @@
|
|
|
1
|
-
const cssProps : { [key: string] : any } = {
|
|
2
|
-
"ac": "align-content",
|
|
3
|
-
"alignContent": "align-content",
|
|
4
|
-
|
|
5
|
-
"aic": "aic",
|
|
6
|
-
"ais": "ais",
|
|
7
|
-
"aie": "aie",
|
|
8
|
-
"nous": "nous",
|
|
9
|
-
"nope": "nope",
|
|
10
|
-
"ai": "align-items",
|
|
11
|
-
"alignItems": "align-items",
|
|
12
|
-
|
|
13
|
-
"ass": "ass",
|
|
14
|
-
"asc": "asc",
|
|
15
|
-
"ase": "ase",
|
|
16
|
-
"alignSelf": "align-self",
|
|
17
|
-
"all": "all",
|
|
18
|
-
"animation": "animation",
|
|
19
|
-
"animationDelay": "animation-delay",
|
|
20
|
-
"animationDirection": "animation-direction",
|
|
21
|
-
"animationDuration": "animation-duration",
|
|
22
|
-
"animationFillMode": "animation-fill-mode",
|
|
23
|
-
"animationIterationCount": "animation-iteration-count",
|
|
24
|
-
"animationName": "animation-name",
|
|
25
|
-
"animationPlayState": "animation-play-state",
|
|
26
|
-
"animationTimingFunction": "animation-timing-function",
|
|
27
|
-
"backfaceVisibility": "backface-visibility",
|
|
28
|
-
"backgroundAttachment": "background-attachment",
|
|
29
|
-
"backgroundBlendMode": "background-blend-mode",
|
|
30
|
-
"backgroundClip": "background-clip",
|
|
31
|
-
|
|
32
|
-
"bg": "background",
|
|
33
|
-
"background": "background",
|
|
34
|
-
"bgc": "background-color",
|
|
35
|
-
"bgColor": "background-color",
|
|
36
|
-
"backgroundColor": "background-color",
|
|
37
|
-
|
|
38
|
-
"backgroundImage": "background-image",
|
|
39
|
-
"backgroundOrigin": "background-origin",
|
|
40
|
-
"backgroundPosition": "background-position",
|
|
41
|
-
"backgroundRepeat": "background-repeat",
|
|
42
|
-
"backgroundSize": "background-size",
|
|
43
|
-
"border": "border",
|
|
44
|
-
"borderBottom": "border-bottom",
|
|
45
|
-
"borderBottomColor": "border-bottom-color",
|
|
46
|
-
"borderBottomStyle": "border-bottom-style",
|
|
47
|
-
"borderBottomWidth": "border-bottom-width",
|
|
48
|
-
"borderCollapse": "border-collapse",
|
|
49
|
-
"borderColor": "border-color",
|
|
50
|
-
"borderImage": "border-image",
|
|
51
|
-
"borderImageOutset": "border-image-outset",
|
|
52
|
-
"borderImageRepeat": "border-image-repeat",
|
|
53
|
-
"borderImageSlice": "border-image-slice",
|
|
54
|
-
"borderImageSource": "border-image-source",
|
|
55
|
-
"borderImageWidth": "border-image-width",
|
|
56
|
-
"borderLeft": "border-left",
|
|
57
|
-
"borderLeftColor": "border-left-color",
|
|
58
|
-
"borderLeftStyle": "border-left-style",
|
|
59
|
-
"borderLeftWidth": "border-left-width",
|
|
60
|
-
|
|
61
|
-
//Radius
|
|
62
|
-
"r": "border-radius",
|
|
63
|
-
"br": "border-radius",
|
|
64
|
-
"borderRadius": "border-radius",
|
|
65
|
-
"brtl": "border-top-left-radius",
|
|
66
|
-
"borderTopLeftRadius": "border-top-left-radius",
|
|
67
|
-
"brtr": "border-top-right-radius",
|
|
68
|
-
"borderTopRightRadius": "border-top-right-radius",
|
|
69
|
-
"brbl": "border-bottom-left-radius",
|
|
70
|
-
"borderBottomLeftRadius": "border-bottom-left-radius",
|
|
71
|
-
"brbr": "border-bottom-right-radius",
|
|
72
|
-
"borderBottomRightRadius": "border-bottom-right-radius",
|
|
73
|
-
|
|
74
|
-
"borderRight": "border-right",
|
|
75
|
-
"borderRightColor": "border-right-color",
|
|
76
|
-
"borderRightStyle": "border-right-style",
|
|
77
|
-
"borderRightWidth": "border-right-width",
|
|
78
|
-
"borderSpacing": "border-spacing",
|
|
79
|
-
"borderStyle": "border-style",
|
|
80
|
-
"borderTop": "border-top",
|
|
81
|
-
"borderTopColor": "border-top-color",
|
|
82
|
-
|
|
83
|
-
"borderTopStyle": "border-top-style",
|
|
84
|
-
"borderTopWidth": "border-top-width",
|
|
85
|
-
"borderWidth": "border-width",
|
|
86
|
-
"bottom": "bottom",
|
|
87
|
-
"boxDecorationBreak": "box-decoration-break",
|
|
88
|
-
"boxShadow": "box-shadow",
|
|
89
|
-
"boxSizing": "box-sizing",
|
|
90
|
-
"captionSide": "caption-side",
|
|
91
|
-
"caretColor": "caret-color",
|
|
92
|
-
"@charset": "@charset",
|
|
93
|
-
"clear": "clear",
|
|
94
|
-
"clip": "clip",
|
|
95
|
-
"clipPath": "clip-path",
|
|
96
|
-
"color": "color",
|
|
97
|
-
"columnCount": "column-count",
|
|
98
|
-
"columnFill": "column-fill",
|
|
99
|
-
"columnGap": "column-gap",
|
|
100
|
-
"colGap": "column-gap",
|
|
101
|
-
"columnRule": "column-rule",
|
|
102
|
-
"columnRuleColor": "column-rule-color",
|
|
103
|
-
"columnRuleStyle": "column-rule-style",
|
|
104
|
-
"columnRuleWidth": "column-rule-width",
|
|
105
|
-
"columnSpan": "column-span",
|
|
106
|
-
"columnWidth": "column-width",
|
|
107
|
-
"colW": "column-width",
|
|
108
|
-
"columns": "columns",
|
|
109
|
-
"content": "content",
|
|
110
|
-
"counterIncrement": "counter-increment",
|
|
111
|
-
"counterReset": "counter-reset",
|
|
112
|
-
"cursor": "cursor",
|
|
113
|
-
"pointer": "pointer",
|
|
114
|
-
"direction": "direction",
|
|
115
|
-
"display": "display",
|
|
116
|
-
"emptyCells": "empty-cells",
|
|
117
|
-
"filter": "filter",
|
|
118
|
-
"flex": "flex",
|
|
119
|
-
"flexBasis": "flex-basis",
|
|
120
|
-
"dir": "flex-direction",
|
|
121
|
-
"flexDirection": "flex-direction",
|
|
122
|
-
"flexFlow": "flex-flow",
|
|
123
|
-
"flexGrow": "flex-grow",
|
|
124
|
-
"flexShrink": "flex-shrink",
|
|
125
|
-
"flexWrap": "flex-wrap",
|
|
126
|
-
"float": "float",
|
|
127
|
-
"font": "font",
|
|
128
|
-
"fontFamily": "font-family",
|
|
129
|
-
"fontKerning": "font-kerning",
|
|
130
|
-
"size": "font-size",
|
|
131
|
-
"fontSize": "font-size",
|
|
132
|
-
"fontSizeAdjust": "font-size-adjust",
|
|
133
|
-
"fontStretch": "font-stretch",
|
|
134
|
-
"fontStyle": "font-style",
|
|
135
|
-
"fontVariant": "font-variant",
|
|
136
|
-
"bold": "bold",
|
|
137
|
-
"fontWeight": "font-weight",
|
|
138
|
-
"gap" : "gap",
|
|
139
|
-
"grid": "grid",
|
|
140
|
-
"gridArea": "grid-area",
|
|
141
|
-
"gridAutoColumns": "grid-auto-columns",
|
|
142
|
-
"gridAutoFlow": "grid-auto-flow",
|
|
143
|
-
"gridAutoRows": "grid-auto-rows",
|
|
144
|
-
"gridColumn": "grid-column",
|
|
145
|
-
"gridColumnEnd": "grid-column-end",
|
|
146
|
-
"gridColumnGap": "grid-column-gap",
|
|
147
|
-
"gridColumnStart": "grid-column-start",
|
|
148
|
-
"gridGap": "grid-gap",
|
|
149
|
-
"gridRow": "grid-row",
|
|
150
|
-
"gridRowEnd": "grid-row-end",
|
|
151
|
-
"gridRowGap": "grid-row-gap",
|
|
152
|
-
"gridRowStart": "grid-row-start",
|
|
153
|
-
"gridTemplate": "grid-template",
|
|
154
|
-
"gridTemplateAreas": "grid-template-areas",
|
|
155
|
-
"gridTemplateColumns": "grid-template-columns",
|
|
156
|
-
"gridTemplateRows": "grid-template-rows",
|
|
157
|
-
"hangingPunctuation": "hanging-punctuation",
|
|
158
|
-
"hyphens": "hyphens",
|
|
159
|
-
"isolation": "isolation",
|
|
160
|
-
"jcc": "jcc",
|
|
161
|
-
"jcs": "jcs",
|
|
162
|
-
"jce": "jce",
|
|
163
|
-
"jc": "justify-content",
|
|
164
|
-
"justifyContent": "justify-content",
|
|
165
|
-
"left": "left",
|
|
166
|
-
"letterSpacing": "letter-spacing",
|
|
167
|
-
"lineHeight": "line-height",
|
|
168
|
-
"listStyle": "list-style",
|
|
169
|
-
"listStyleImage": "list-style-image",
|
|
170
|
-
"listStylePosition": "list-style-position",
|
|
171
|
-
"listStyleType": "list-style-type",
|
|
172
|
-
|
|
173
|
-
//Margin
|
|
174
|
-
"m": "margin",
|
|
175
|
-
"margin": "margin",
|
|
176
|
-
"mb": "margin-bottom",
|
|
177
|
-
"marginBottom": "margin-bottom",
|
|
178
|
-
"ml": "margin-left",
|
|
179
|
-
"marginLeft": "margin-left",
|
|
180
|
-
"mr": "margin-right",
|
|
181
|
-
"marginRight": "margin-right",
|
|
182
|
-
"mt": "margin-top",
|
|
183
|
-
"marginTop": "margin-top",
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
//Height
|
|
187
|
-
"h": "height",
|
|
188
|
-
"height": "height",
|
|
189
|
-
"minH": "min-height",
|
|
190
|
-
"minHeight": "min-height",
|
|
191
|
-
"maxH": "max-height",
|
|
192
|
-
"maxHeight": "max-height",
|
|
193
|
-
|
|
194
|
-
//Width
|
|
195
|
-
"w": "width",
|
|
196
|
-
"width": "width",
|
|
197
|
-
"minW": "min-width",
|
|
198
|
-
"minWidth": "min-width",
|
|
199
|
-
"maxW": "max-width",
|
|
200
|
-
"maxWidth": "max-width",
|
|
201
|
-
|
|
202
|
-
"mixBlendMode": "mix-blend-mode",
|
|
203
|
-
"objectFit": "object-fit",
|
|
204
|
-
"objectPosition": "object-position",
|
|
205
|
-
"opacity": "opacity",
|
|
206
|
-
"order": "order",
|
|
207
|
-
"outline": "outline",
|
|
208
|
-
"outlineColor": "outline-color",
|
|
209
|
-
"outlineOffset": "outline-offset",
|
|
210
|
-
"outlineStyle": "outline-style",
|
|
211
|
-
"outlineWidth": "outline-width",
|
|
212
|
-
"overflow": "overflow",
|
|
213
|
-
"overflowX": "overflow-x",
|
|
214
|
-
"overflowY": "overflow-y",
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
"p": "padding",
|
|
218
|
-
"padding": "padding",
|
|
219
|
-
"pb": "padding-bottom",
|
|
220
|
-
"paddingBottom": "padding-bottom",
|
|
221
|
-
"pl": "padding-left",
|
|
222
|
-
"paddingLeft": "padding-left",
|
|
223
|
-
"pr": "padding-right",
|
|
224
|
-
"paddingRight": "padding-right",
|
|
225
|
-
"pt": "padding-top",
|
|
226
|
-
"paddingTop": "padding-top",
|
|
227
|
-
|
|
228
|
-
"pageBreakAfter": "page-break-after",
|
|
229
|
-
"pageBreakBefore": "page-break-before",
|
|
230
|
-
"pageBreakInside": "page-break-inside",
|
|
231
|
-
"perspective": "perspective",
|
|
232
|
-
"perspectiveOrigin": "perspective-origin",
|
|
233
|
-
"pointerEvents": "pointer-events",
|
|
234
|
-
|
|
235
|
-
"rel":"rel",
|
|
236
|
-
"abs":"abs",
|
|
237
|
-
"fixed":"fixed",
|
|
238
|
-
"sticky":"sticky",
|
|
239
|
-
"pos": "position",
|
|
240
|
-
"position": "position",
|
|
241
|
-
|
|
242
|
-
"quotes": "quotes",
|
|
243
|
-
"resize": "resize",
|
|
244
|
-
"right": "right",
|
|
245
|
-
"scrollBehavior": "scroll-behavior",
|
|
246
|
-
"tabSize": "tab-size",
|
|
247
|
-
"tableLayout": "table-layout",
|
|
248
|
-
|
|
249
|
-
"align" : "text-align",
|
|
250
|
-
"textAlign": "text-align",
|
|
251
|
-
"textAlignLast": "text-align-last",
|
|
252
|
-
|
|
253
|
-
"tdh": "tdh", //text-decoration: underline on hover
|
|
254
|
-
"td": "text-decoration",
|
|
255
|
-
"textDecoration": "text-decoration",
|
|
256
|
-
"textDecorationColor": "text-decoration-color",
|
|
257
|
-
"textDecorationLine": "text-decoration-line",
|
|
258
|
-
"textDecorationStyle": "text-decoration-style",
|
|
259
|
-
"textIndent": "text-indent",
|
|
260
|
-
"textJustify": "text-justify",
|
|
261
|
-
"textOverflow": "text-overflow",
|
|
262
|
-
"textShadow": "text-shadow",
|
|
263
|
-
"textTransform": "text-transform",
|
|
264
|
-
"top": "top",
|
|
265
|
-
|
|
266
|
-
"transform": "transform",
|
|
267
|
-
"transform(2D)": "transform(2D)",
|
|
268
|
-
"transformOrigin(twoValue syntax)": "transform-origin(two-value syntax)",
|
|
269
|
-
"transformStyle": "transform-style",
|
|
270
|
-
"transition": "transition",
|
|
271
|
-
"transitionDelay": "transition-delay",
|
|
272
|
-
"transitionDuration": "transition-duration",
|
|
273
|
-
"transitionProperty": "transition-property",
|
|
274
|
-
"transitionTimingFunction": "transition-timing-function",
|
|
275
|
-
"unicodeBidi": "unicode-bidi",
|
|
276
|
-
"userSelect": "user-select",
|
|
277
|
-
"verticalAlign": "vertical-align",
|
|
278
|
-
"visibility": "visibility",
|
|
279
|
-
"weight" : "flex",
|
|
280
|
-
"whiteSpace": "white-space",
|
|
281
|
-
"ws": "white-space",
|
|
282
|
-
"wordBreak": "word-break",
|
|
283
|
-
"wordSpacing": "word-spacing",
|
|
284
|
-
"wrap": "wrap",
|
|
285
|
-
"textWrap": "textWrap",
|
|
286
|
-
"wordWrap": "word-wrap",
|
|
287
|
-
"writingMode": "writing-mode",
|
|
288
|
-
"zIndex": "z-index",
|
|
289
|
-
"backdropFilter": "backdrop-filter",
|
|
290
|
-
"bgFilter": "backdrop-filter",
|
|
291
|
-
|
|
292
|
-
//Custom
|
|
293
|
-
"anim" : "anim",
|
|
294
|
-
"fill" : "fill",
|
|
295
|
-
"abc" : "abc",
|
|
296
|
-
"fb" : "fb",
|
|
297
|
-
"ph" : "ph",
|
|
298
|
-
"pv" : "pv",
|
|
299
|
-
"mv" : "mv",
|
|
300
|
-
"mh" : "mh"
|
|
301
|
-
}
|
|
302
|
-
|
|
303
|
-
const cssPropsVals : { [key: string] : any } = {
|
|
304
|
-
//Colors
|
|
305
|
-
"primary" : 'var(--primary-color)',
|
|
306
|
-
"c" : "center",
|
|
307
|
-
//Flex Directions
|
|
308
|
-
"cols" : "column",
|
|
309
|
-
"colsr" : "column-reverse",
|
|
310
|
-
"rows" : "row",
|
|
311
|
-
"rowsr" : "row-reverse",
|
|
312
|
-
//Positions
|
|
313
|
-
"rel" : "relative",
|
|
314
|
-
"abs" : "absolute",
|
|
315
|
-
}
|
|
316
|
-
|
|
317
|
-
const cssPropsDirect : { [key : string] : any } = {
|
|
318
|
-
'rel' : 'position: relative;',
|
|
319
|
-
'fixed' : 'position: fixed;',
|
|
320
|
-
'abs' : 'position: absolute;',
|
|
321
|
-
'sticky' : 'position: sticky;',
|
|
322
|
-
'flex' : 'display: flex;',
|
|
323
|
-
'fwrap' : 'flex-wrap: wrap;',
|
|
324
|
-
'aic' : 'align-items: center;',
|
|
325
|
-
'ais' : 'align-items: flex-start;',
|
|
326
|
-
'aie' : 'align-items: flex-end;',
|
|
327
|
-
'ass' : 'align-self: flex-start;',
|
|
328
|
-
'asc' : 'align-self: center;',
|
|
329
|
-
'ase' : 'align-self: flex-end;',
|
|
330
|
-
'jcc' : 'justify-content: center;',
|
|
331
|
-
'jcs' : 'justify-content: flex-start;',
|
|
332
|
-
'jce' : 'justify-content: flex-end;',
|
|
333
|
-
'grid' : 'display: grid;',
|
|
334
|
-
'fill' : 'top: 0px;left: 0px;right: 0px;bottom: 0px;',
|
|
335
|
-
'abc' : 'top: 50%;left: 50%;transform: translate(-50%, -50%);',
|
|
336
|
-
'block' : 'display: block;',
|
|
337
|
-
'bold' : "font-weight: bold;",
|
|
338
|
-
'wrap' : "word-wrap: break-word;white-space: nowrap;overflow: hidden;text-overflow: ellipsis;max-width: 99%;",
|
|
339
|
-
'textWrap' : "word-wrap: break-word;white-space: nowrap;overflow: hidden;text-overflow: ellipsis;max-width: 99%;",
|
|
340
|
-
'pointer' : "cursor: pointer;",
|
|
341
|
-
'fb' : 'font-family: var(--primary-font-bold);',
|
|
342
|
-
'ph' : 'padding-left: __VALUE__;padding-right: __VALUE__;',
|
|
343
|
-
'pv' : 'padding-bottom: __VALUE__;padding-top: __VALUE__;',
|
|
344
|
-
'mv' : 'margin-bottom: __VALUE__;margin-top: __VALUE__;',
|
|
345
|
-
'mh' : 'margin-left: __VALUE__;margin-right: __VALUE__;',
|
|
346
|
-
'anim' : 'transition:all __VALUE__s linear 0s;',
|
|
347
|
-
'nous' : 'user-select: none;',
|
|
348
|
-
'nope' : 'pointer-events: none;',
|
|
349
|
-
'tdn' : 'text-decoration: none;',
|
|
350
|
-
}
|
|
351
|
-
|
|
352
|
-
const cssPropsIgnore : string[] = [
|
|
353
|
-
'weight', `opacity`
|
|
354
|
-
]
|
|
355
|
-
|
|
356
|
-
const _cssColors : string[] = [ `white`, `black`, `gray`, `red`, `orange`, `yellow`, `green`, `teal`, `blue`, `cyan`, `purple`, `pink`, `linkedin`, `facebook`, `messenger`, `whatsapp`, `twitter`, `telegram` ]
|
|
357
|
-
const _cssColorsRange : string[] = [ `50`, `100`, `200`, `300`, `400`, `500`, `600`, `700`, `800`, `900` ]
|
|
358
|
-
let cssColors : string[] = []
|
|
359
|
-
|
|
360
|
-
if(cssColors.length == 0){
|
|
361
|
-
_cssColors.map(c => {
|
|
362
|
-
_cssColorsRange.map(r => cssColors.push(`${c}.${r}`));
|
|
363
|
-
});
|
|
364
|
-
}
|
|
365
|
-
|
|
366
|
-
export {
|
|
367
|
-
cssPropsDirect,
|
|
368
|
-
cssProps,
|
|
369
|
-
cssPropsVals,
|
|
370
|
-
cssPropsIgnore,
|
|
371
|
-
cssColors
|
|
372
|
-
}
|
package/src/hooks/index.tsx
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
export { default as useTheme } from './useTheme'
|
|
2
|
-
export { default as useImage } from './useImage'
|
|
3
|
-
export { default as useStore } from './useStore'
|
|
4
|
-
export { default as useDispatch } from './useDispatch'
|
|
5
|
-
export { default as useResizeObserver } from './useResizeObserver'
|
|
6
|
-
export { default as useDevice } from './useDevice'
|
|
7
|
-
export { default as useToast } from './useToast'
|
|
8
|
-
export { default as useLang } from './useLang'
|
|
9
|
-
export { default as useContextMenu } from './useContextMenu'
|
|
10
|
-
export { default as useRender } from './useRender'
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import { useReducer } from 'react'
|
|
2
|
-
import { UNDO, REDO, RESET } from '../actions'
|
|
3
|
-
|
|
4
|
-
const useAppReducer = (reducer, inititalState : Object, passedConfig = {}) => {
|
|
5
|
-
|
|
6
|
-
const initialStateWithUndoRedo = {
|
|
7
|
-
...inititalState,
|
|
8
|
-
pastDesignStates: [],
|
|
9
|
-
futureDesignStates: [],
|
|
10
|
-
hasRedo: false,
|
|
11
|
-
hasUndo: false,
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
const undoRedoResetReducer = (state, action) => {
|
|
15
|
-
|
|
16
|
-
const newPresetState = reducer(state, action) || initialStateWithUndoRedo
|
|
17
|
-
|
|
18
|
-
if([UNDO,REDO,RESET].includes(action.type)){
|
|
19
|
-
return newPresetState;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
if(newPresetState.isDesignState){
|
|
23
|
-
|
|
24
|
-
const newState = {
|
|
25
|
-
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
return newState;
|
|
29
|
-
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
return newPresetState;
|
|
33
|
-
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
return useReducer(undoRedoResetReducer, initialStateWithUndoRedo)
|
|
37
|
-
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
export default useAppReducer;
|
|
@@ -1,123 +0,0 @@
|
|
|
1
|
-
import { SyntheticEvent, useEffect, useState, useRef } from "react"
|
|
2
|
-
import ReactDOM from 'react-dom/client'
|
|
3
|
-
import Box from '../comps/box'
|
|
4
|
-
import { getMousePosition } from "../core"
|
|
5
|
-
|
|
6
|
-
const Menu = ({ ID, hide, e, items, width }) => {
|
|
7
|
-
|
|
8
|
-
const nodeRef = useRef(null);
|
|
9
|
-
const [p, setP] = useState(getMousePosition(e as MouseEvent));
|
|
10
|
-
const [visible, setVisible] = useState(false);
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
const checkBoundaries = (x: number, y: number) => {
|
|
14
|
-
if (nodeRef.current) {
|
|
15
|
-
const { innerWidth, innerHeight } = window;
|
|
16
|
-
const { offsetWidth, offsetHeight } = nodeRef.current;
|
|
17
|
-
if(x + offsetWidth > innerWidth) x -= offsetWidth //x + offsetWidth - innerWidth;
|
|
18
|
-
if (y + offsetHeight > innerHeight) y -= offsetHeight;
|
|
19
|
-
}
|
|
20
|
-
setP({ x, y })
|
|
21
|
-
setVisible(true)
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
useEffect(() => {
|
|
25
|
-
checkBoundaries(p.x, p.y);
|
|
26
|
-
}, [e])
|
|
27
|
-
|
|
28
|
-
return (
|
|
29
|
-
<Box
|
|
30
|
-
bref={nodeRef}
|
|
31
|
-
flex dir={`cols`}
|
|
32
|
-
fixed
|
|
33
|
-
top={p.y}
|
|
34
|
-
left={p.x}
|
|
35
|
-
w={width || 220}
|
|
36
|
-
opacity={visible ? 1 : 0}
|
|
37
|
-
as={`zuz-contextmenu ${ID}`}>
|
|
38
|
-
{(items as Array<any>).map((m, i) => m.id == `line` ? <Box as={`line`} key={`line-${i}-${m.id}`} /> : <button
|
|
39
|
-
key={`cm-${i}-${m.id}`}
|
|
40
|
-
onClick={ev => {
|
|
41
|
-
if(m.onClick){
|
|
42
|
-
m.onClick(ev, m)
|
|
43
|
-
}else{
|
|
44
|
-
console.log(`No onClick eventFound`)
|
|
45
|
-
}
|
|
46
|
-
hide()
|
|
47
|
-
}}>{m.label}</button>)}
|
|
48
|
-
</Box>
|
|
49
|
-
)
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
const useContextMenu = (
|
|
53
|
-
contextID : string,
|
|
54
|
-
contextWidth: number,
|
|
55
|
-
contextToken = `____uchides`
|
|
56
|
-
) => {
|
|
57
|
-
|
|
58
|
-
const ID = `contextmenu-${contextID}`
|
|
59
|
-
const [visible, setVisible] = useState(false)
|
|
60
|
-
const [root, setRoot] = useState(null)
|
|
61
|
-
|
|
62
|
-
const el = (e : string) => window.document.createElement(e)
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
const createRoot = () => {
|
|
66
|
-
if(!window.document.querySelector(`#${ID}`)){
|
|
67
|
-
let div = el(`div`)
|
|
68
|
-
div.id = ID
|
|
69
|
-
window.document.body.appendChild(div)
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
const hideAll = () => {
|
|
74
|
-
if(window[contextToken]){
|
|
75
|
-
window[contextToken].map((h : Object) => h['ID'] != ID && h['fnc']())
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
const _hide = () => {
|
|
80
|
-
try{
|
|
81
|
-
root?.unmount()
|
|
82
|
-
document.querySelector(`#${ID}`).parentNode.removeChild(document.querySelector(`#${ID}`))
|
|
83
|
-
setRoot(null)
|
|
84
|
-
}catch(e){}
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
const hide = () => {
|
|
88
|
-
_hide()
|
|
89
|
-
hideAll()
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
const show = (e : MouseEvent, items : Array<any>) => {
|
|
93
|
-
e.preventDefault(); e.stopPropagation();
|
|
94
|
-
hideAll()
|
|
95
|
-
root.render(<Menu e={e} width={contextWidth || 220} items={items} ID={ID} hide={hide} />)
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
useEffect(() => {
|
|
99
|
-
createRoot()
|
|
100
|
-
if(!root) setRoot(ReactDOM.createRoot(document.getElementById(ID)))
|
|
101
|
-
}, [root])
|
|
102
|
-
|
|
103
|
-
useEffect(() => {
|
|
104
|
-
if(contextToken in window == false){
|
|
105
|
-
window[contextToken] = []
|
|
106
|
-
}
|
|
107
|
-
if(window[contextToken].findIndex(x => x.ID == ID) == -1){
|
|
108
|
-
window[contextToken].push({ ID: ID, fnc: _hide })
|
|
109
|
-
if(window[contextToken].length > document.querySelectorAll('div[id^="contextmenu-"]').length){
|
|
110
|
-
window[contextToken].shift()
|
|
111
|
-
}
|
|
112
|
-
}
|
|
113
|
-
}, [])
|
|
114
|
-
|
|
115
|
-
return {
|
|
116
|
-
show,
|
|
117
|
-
hide,
|
|
118
|
-
hideAll
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
export default useContextMenu
|