@plitzi/sdk-style 0.33.2 → 0.34.1
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/CHANGELOG.md +26 -0
- package/dist/BuilderStyleContextProvider.d.ts +11 -2
- package/dist/BuilderStyleContextProvider.mjs +76 -54
- package/dist/SdkStyleContextProvider.mjs +4 -4
- package/dist/StyleAdvanceEditor.mjs +30 -30
- package/dist/StyleMap/StyleMap.d.ts +14 -1
- package/dist/StyleMap/StyleMap.mjs +24 -2
- package/dist/StyleMap/helpers/isValueValid.mjs +1 -1
- package/dist/StyleReducer.d.ts +15 -4
- package/dist/StyleReducer.mjs +39 -18
- package/dist/components/InputEasing/InputEasing.mjs +21 -21
- package/dist/components/InputEasing/InputEasingButton.mjs +5 -5
- package/dist/components/InputEasing/InputEasingList.mjs +76 -76
- package/dist/components/Selector/Selector.mjs +29 -29
- package/dist/components/Selector/SelectorItem/ItemOptions.mjs +16 -16
- package/dist/components/Selector/SelectorItem/SelectorItem.mjs +10 -10
- package/dist/components/StyleInspector/Inspector.mjs +33 -33
- package/dist/components/StyleInspector/StyleInspector.mjs +45 -45
- package/dist/components/StyleInspector/StyleInspectorProvider.mjs +14 -14
- package/dist/components/StyleInspector/categories/Background/components/BackgroundLayer/BackgroundLayer.mjs +46 -46
- package/dist/components/StyleInspector/categories/Background/components/GradientStopBar/GradientStopBar.mjs +20 -20
- package/dist/components/StyleInspector/categories/Background/components/GradientStopBar/GradientStopHandle.mjs +11 -11
- package/dist/components/StyleInspector/categories/Border/BorderPlacements.mjs +20 -20
- package/dist/components/StyleInspector/categories/DisplayFlexChild/DisplayAlignSelf.mjs +12 -12
- package/dist/components/StyleInspector/categories/Effects/BoxShadow/BoxShadow.mjs +22 -21
- package/dist/components/StyleInspector/categories/Effects/BoxShadow/BoxShadowItem.mjs +66 -65
- package/dist/components/StyleInspector/categories/Effects/BoxShadow/helpers.d.ts +2 -0
- package/dist/components/StyleInspector/categories/Effects/BoxShadow/helpers.mjs +18 -0
- package/dist/components/StyleInspector/categories/Effects/Transition/TransitionItem.mjs +15 -15
- package/dist/components/StyleInspector/categories/RawStyle/RawStyle.mjs +16 -16
- package/dist/components/StyleInspector/categories/Spacing/SpacingEditor.mjs +12 -12
- package/dist/components/StyleInspector/categories/Spacing/SpacingNumber.mjs +5 -5
- package/dist/components/StyleInspector/categories/Typography/Typography.d.ts +1 -5
- package/dist/components/StyleInspector/categories/Typography/Typography.mjs +58 -57
- package/dist/components/StyleInspector/categories/Typography/TypographyConstants.d.ts +0 -4
- package/dist/components/StyleInspector/categories/Typography/TypographyConstants.mjs +2 -160
- package/dist/components/StyleInspector/categories/Typography/TypographyFont.d.ts +1 -4
- package/dist/components/StyleInspector/categories/Typography/TypographyFont.mjs +24 -17
- package/dist/components/StyleInspector/components/CategoryContainer/CategoryContainer.mjs +15 -15
- package/dist/components/StyleInspector/components/CategoryOption/categoryTypes/OptionIconGroup.mjs +17 -17
- package/dist/components/StyleInspector/components/CategoryOption/categoryTypes/OptionMetricInput.mjs +8 -8
- package/dist/components/StyleInspector/components/CategoryOption/categoryTypes/OptionSelect.mjs +4 -4
- package/dist/components/StyleInspector/components/InspectorLabel/InspectorLabel.mjs +13 -13
- package/dist/components/StyleInspector/hooks/useInspectorValues.mjs +13 -13
- package/dist/components/StyleInspector/hooks/useStyleBinding.mjs +12 -12
- package/dist/components/StyleInspector/hooks/useStyleInherit.mjs +3 -3
- package/dist/components/StyleManager/ManagerSelector.mjs +35 -35
- package/dist/components/StyleManager/StyleManager.mjs +12 -12
- package/dist/components/StyleManager/StyleSelectorTag.mjs +20 -20
- package/dist/helpers/calculateInheriting.mjs +2 -2
- package/dist/helpers/generateStyleSelector.mjs +1 -1
- package/dist/helpers/processSelectorAttributes.mjs +1 -1
- package/dist/hooks/index.d.ts +2 -0
- package/dist/hooks/index.mjs +2 -0
- package/dist/hooks/useSpaceFonts.d.ts +10 -0
- package/dist/hooks/useSpaceFonts.mjs +10 -0
- package/dist/index.mjs +16 -16
- package/package.json +26 -9
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import e from "./StyleInspectorContext.mjs";
|
|
2
2
|
import t from "./hooks/useStyleBinding.mjs";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
3
|
+
import { useCallback as n, useMemo as r } from "react";
|
|
4
|
+
import { useCommonStore as i } from "@plitzi/sdk-shared/store";
|
|
5
|
+
import { emptyObject as a } from "@plitzi/sdk-shared/helpers/utils";
|
|
6
|
+
import { get as o, omit as s } from "@plitzi/plitzi-ui/helpers";
|
|
7
|
+
import { jsx as c } from "react/jsx-runtime";
|
|
8
8
|
import { baseDefaultValue as l } from "@plitzi/sdk-shared";
|
|
9
9
|
//#region src/components/StyleInspector/StyleInspectorProvider.tsx
|
|
10
10
|
var u = ({ children: u, componentType: d, selector: f, styleSelector: p = "base", styleState: m, styleVariant: h, element: g, inheritData: _, displayMode: v, onChange: y }) => {
|
|
11
|
-
let b = t({ element: g }), [x =
|
|
11
|
+
let b = t({ element: g }), [x = a] = i("runtime.sources.variables"), S = n(() => {
|
|
12
12
|
let e;
|
|
13
13
|
if (f && p && f.attributes[p]) {
|
|
14
14
|
let t = f.attributes[p];
|
|
@@ -20,9 +20,9 @@ var u = ({ children: u, componentType: d, selector: f, styleSelector: p = "base"
|
|
|
20
20
|
p,
|
|
21
21
|
m,
|
|
22
22
|
h
|
|
23
|
-
]), C =
|
|
24
|
-
if (!(e && typeof t != "string" && typeof t != "number" && t !== void 0 || !e && typeof t != "object" && t !== void 0 || e &&
|
|
25
|
-
if (!e && t && typeof t == "object" && (t =
|
|
23
|
+
]), C = n((e, t) => {
|
|
24
|
+
if (!(e && typeof t != "string" && typeof t != "number" && t !== void 0 || !e && typeof t != "object" && t !== void 0 || e && o(b, e))) {
|
|
25
|
+
if (!e && t && typeof t == "object" && (t = s(t, Object.keys(b))), !e && f && typeof t == "object") {
|
|
26
26
|
let e = {
|
|
27
27
|
...S(),
|
|
28
28
|
...t
|
|
@@ -38,10 +38,10 @@ var u = ({ children: u, componentType: d, selector: f, styleSelector: p = "base"
|
|
|
38
38
|
S,
|
|
39
39
|
y,
|
|
40
40
|
f
|
|
41
|
-
]), w =
|
|
41
|
+
]), w = n((e) => Array.isArray(e) ? e.reduce((e, t) => ({
|
|
42
42
|
...e,
|
|
43
|
-
[t]:
|
|
44
|
-
}), {}) : e ?
|
|
43
|
+
[t]: o(l, t)
|
|
44
|
+
}), {}) : e ? o(l, e) : l, []), T = n((e) => {
|
|
45
45
|
if (Array.isArray(e)) {
|
|
46
46
|
let t = e.reduce((e, t) => ({
|
|
47
47
|
...e,
|
|
@@ -49,7 +49,7 @@ var u = ({ children: u, componentType: d, selector: f, styleSelector: p = "base"
|
|
|
49
49
|
}), {});
|
|
50
50
|
C(void 0, t);
|
|
51
51
|
} else C(e);
|
|
52
|
-
}, [C]), E =
|
|
52
|
+
}, [C]), E = r(() => ({
|
|
53
53
|
componentType: d,
|
|
54
54
|
selector: f,
|
|
55
55
|
styleSelector: p,
|
|
@@ -78,7 +78,7 @@ var u = ({ children: u, componentType: d, selector: f, styleSelector: p = "base"
|
|
|
78
78
|
T,
|
|
79
79
|
w
|
|
80
80
|
]);
|
|
81
|
-
return /* @__PURE__ */
|
|
81
|
+
return /* @__PURE__ */ c(e, {
|
|
82
82
|
value: E,
|
|
83
83
|
children: u
|
|
84
84
|
});
|
|
@@ -5,9 +5,9 @@ import r from "../../modes/ConicGradientMode.mjs";
|
|
|
5
5
|
import i from "../../modes/ImageMode.mjs";
|
|
6
6
|
import a from "../../modes/LinearGradientMode.mjs";
|
|
7
7
|
import o from "../../modes/RadialGradientMode.mjs";
|
|
8
|
-
import s from "
|
|
9
|
-
import {
|
|
10
|
-
import
|
|
8
|
+
import { memo as s, useCallback as c, useMemo as l, useState as u } from "react";
|
|
9
|
+
import { jsx as d, jsxs as f } from "react/jsx-runtime";
|
|
10
|
+
import p from "clsx";
|
|
11
11
|
import m from "@plitzi/plitzi-ui/Icon";
|
|
12
12
|
//#region src/components/StyleInspector/categories/Background/components/BackgroundLayer/BackgroundLayer.tsx
|
|
13
13
|
var h = {
|
|
@@ -29,135 +29,135 @@ var h = {
|
|
|
29
29
|
value: "content-box",
|
|
30
30
|
label: "Content Box"
|
|
31
31
|
}
|
|
32
|
-
], _ =
|
|
33
|
-
let [C, w] =
|
|
32
|
+
], _ = s(({ layer: s, index: _, expanded: v, onExpand: y, onChange: b, onRemove: x, onReorder: S }) => {
|
|
33
|
+
let [C, w] = u(!1), T = l(() => n(s), [s]), E = c((e) => {
|
|
34
34
|
let t = String(e);
|
|
35
35
|
b({
|
|
36
|
-
...
|
|
36
|
+
...s,
|
|
37
37
|
type: t
|
|
38
38
|
});
|
|
39
|
-
}, [
|
|
40
|
-
...
|
|
39
|
+
}, [s, b]), D = c(() => y(s.id), [y, s.id]), O = c((e) => b({
|
|
40
|
+
...s,
|
|
41
41
|
clip: String(e)
|
|
42
|
-
}), [
|
|
42
|
+
}), [s, b]), k = c((e) => {
|
|
43
43
|
e.dataTransfer.effectAllowed = "move", e.dataTransfer.setData("text/plain", String(_));
|
|
44
|
-
}, [_]), A =
|
|
44
|
+
}, [_]), A = c(() => {
|
|
45
45
|
w(!1);
|
|
46
|
-
}, []), j =
|
|
46
|
+
}, []), j = c((e) => {
|
|
47
47
|
e.preventDefault(), w(!0);
|
|
48
|
-
}, []), M =
|
|
48
|
+
}, []), M = c((e) => {
|
|
49
49
|
e.currentTarget.contains(e.relatedTarget) || w(!1);
|
|
50
|
-
}, []), N =
|
|
50
|
+
}, []), N = c((e) => {
|
|
51
51
|
e.preventDefault(), w(!1);
|
|
52
52
|
let t = parseInt(e.dataTransfer.getData("text/plain"), 10);
|
|
53
53
|
isNaN(t) || S(t, _);
|
|
54
54
|
}, [_, S]);
|
|
55
|
-
return /* @__PURE__ */
|
|
56
|
-
className:
|
|
55
|
+
return /* @__PURE__ */ f("div", {
|
|
56
|
+
className: p("rounded-sm border transition-colors", {
|
|
57
57
|
"border-blue-400 bg-blue-50 dark:border-blue-500 dark:bg-blue-900/20": C,
|
|
58
58
|
"border-gray-200 dark:border-zinc-700": !C
|
|
59
59
|
}),
|
|
60
60
|
onDragOver: j,
|
|
61
61
|
onDragLeave: M,
|
|
62
62
|
onDrop: N,
|
|
63
|
-
children: [/* @__PURE__ */
|
|
63
|
+
children: [/* @__PURE__ */ f("div", {
|
|
64
64
|
className: "flex h-8 items-center gap-1 px-1",
|
|
65
65
|
children: [
|
|
66
|
-
/* @__PURE__ */
|
|
66
|
+
/* @__PURE__ */ d("span", {
|
|
67
67
|
draggable: !0,
|
|
68
68
|
className: "cursor-grab px-1 text-gray-400 hover:text-gray-600 active:cursor-grabbing dark:text-zinc-500 dark:hover:text-zinc-300",
|
|
69
69
|
onDragStart: k,
|
|
70
70
|
onDragEnd: A,
|
|
71
|
-
children: /* @__PURE__ */
|
|
71
|
+
children: /* @__PURE__ */ d(m, {
|
|
72
72
|
icon: "fa-solid fa-grip-lines",
|
|
73
73
|
size: "xs"
|
|
74
74
|
})
|
|
75
75
|
}),
|
|
76
|
-
|
|
76
|
+
s.type !== "none" && /* @__PURE__ */ d("div", {
|
|
77
77
|
className: "h-4 w-4 shrink-0 rounded-sm border border-gray-300 dark:border-zinc-600",
|
|
78
78
|
style: { background: T }
|
|
79
79
|
}),
|
|
80
|
-
/* @__PURE__ */
|
|
80
|
+
/* @__PURE__ */ d("span", {
|
|
81
81
|
className: "flex-1 truncate text-xs text-gray-600 dark:text-zinc-400",
|
|
82
|
-
children: h[
|
|
82
|
+
children: h[s.type]
|
|
83
83
|
}),
|
|
84
|
-
/* @__PURE__ */
|
|
84
|
+
/* @__PURE__ */ d("button", {
|
|
85
85
|
type: "button",
|
|
86
86
|
className: "cursor-pointer p-1 text-gray-400 hover:text-gray-600 dark:text-zinc-500 dark:hover:text-zinc-300",
|
|
87
87
|
onClick: D,
|
|
88
88
|
title: v ? "Collapse" : "Expand",
|
|
89
|
-
children: /* @__PURE__ */
|
|
89
|
+
children: /* @__PURE__ */ d(m, {
|
|
90
90
|
icon: v ? "fa-solid fa-angle-up" : "fa-solid fa-angle-down",
|
|
91
91
|
size: "xs"
|
|
92
92
|
})
|
|
93
93
|
}),
|
|
94
|
-
/* @__PURE__ */
|
|
94
|
+
/* @__PURE__ */ d("button", {
|
|
95
95
|
type: "button",
|
|
96
96
|
className: "cursor-pointer p-1 text-gray-400 hover:text-red-500 dark:text-zinc-500 dark:hover:text-red-400",
|
|
97
97
|
onClick: x,
|
|
98
98
|
title: "Remove layer",
|
|
99
|
-
children: /* @__PURE__ */
|
|
99
|
+
children: /* @__PURE__ */ d(m, {
|
|
100
100
|
icon: "fas fa-times",
|
|
101
101
|
size: "xs"
|
|
102
102
|
})
|
|
103
103
|
})
|
|
104
104
|
]
|
|
105
|
-
}), v && /* @__PURE__ */
|
|
105
|
+
}), v && /* @__PURE__ */ f("div", {
|
|
106
106
|
className: "flex flex-col gap-2 border-t border-gray-200 p-2 dark:border-zinc-700",
|
|
107
107
|
children: [
|
|
108
|
-
/* @__PURE__ */
|
|
108
|
+
/* @__PURE__ */ d(t, {
|
|
109
109
|
label: "Type",
|
|
110
|
-
children: /* @__PURE__ */
|
|
110
|
+
children: /* @__PURE__ */ f(e, {
|
|
111
111
|
type: "select",
|
|
112
|
-
value:
|
|
112
|
+
value: s.type,
|
|
113
113
|
onChange: E,
|
|
114
114
|
children: [
|
|
115
|
-
/* @__PURE__ */
|
|
115
|
+
/* @__PURE__ */ d("option", {
|
|
116
116
|
value: "linear-gradient",
|
|
117
117
|
children: "Linear Gradient"
|
|
118
118
|
}),
|
|
119
|
-
/* @__PURE__ */
|
|
119
|
+
/* @__PURE__ */ d("option", {
|
|
120
120
|
value: "radial-gradient",
|
|
121
121
|
children: "Radial Gradient"
|
|
122
122
|
}),
|
|
123
|
-
/* @__PURE__ */
|
|
123
|
+
/* @__PURE__ */ d("option", {
|
|
124
124
|
value: "conic-gradient",
|
|
125
125
|
children: "Conic Gradient"
|
|
126
126
|
}),
|
|
127
|
-
/* @__PURE__ */
|
|
127
|
+
/* @__PURE__ */ d("option", {
|
|
128
128
|
value: "url",
|
|
129
129
|
children: "Image URL"
|
|
130
130
|
}),
|
|
131
|
-
/* @__PURE__ */
|
|
131
|
+
/* @__PURE__ */ d("option", {
|
|
132
132
|
value: "none",
|
|
133
133
|
children: "None"
|
|
134
134
|
})
|
|
135
135
|
]
|
|
136
136
|
})
|
|
137
137
|
}),
|
|
138
|
-
|
|
139
|
-
layer:
|
|
138
|
+
s.type === "url" && /* @__PURE__ */ d(i, {
|
|
139
|
+
layer: s,
|
|
140
140
|
onChange: b
|
|
141
141
|
}),
|
|
142
|
-
|
|
143
|
-
layer:
|
|
142
|
+
s.type === "linear-gradient" && /* @__PURE__ */ d(a, {
|
|
143
|
+
layer: s,
|
|
144
144
|
onChange: b
|
|
145
145
|
}),
|
|
146
|
-
|
|
147
|
-
layer:
|
|
146
|
+
s.type === "radial-gradient" && /* @__PURE__ */ d(o, {
|
|
147
|
+
layer: s,
|
|
148
148
|
onChange: b
|
|
149
149
|
}),
|
|
150
|
-
|
|
151
|
-
layer:
|
|
150
|
+
s.type === "conic-gradient" && /* @__PURE__ */ d(r, {
|
|
151
|
+
layer: s,
|
|
152
152
|
onChange: b
|
|
153
153
|
}),
|
|
154
|
-
|
|
154
|
+
s.type !== "none" && /* @__PURE__ */ d(t, {
|
|
155
155
|
label: "Clip",
|
|
156
|
-
children: /* @__PURE__ */
|
|
156
|
+
children: /* @__PURE__ */ d(e, {
|
|
157
157
|
type: "select",
|
|
158
|
-
value:
|
|
158
|
+
value: s.clip,
|
|
159
159
|
onChange: O,
|
|
160
|
-
children: g.map((e) => /* @__PURE__ */
|
|
160
|
+
children: g.map((e) => /* @__PURE__ */ d("option", {
|
|
161
161
|
value: e.value,
|
|
162
162
|
children: e.label
|
|
163
163
|
}, e.value))
|
|
@@ -2,9 +2,9 @@ import { newStopId as e } from "../../helpers/backgroundParser.mjs";
|
|
|
2
2
|
import t from "./GradientPreviewBar.mjs";
|
|
3
3
|
import n from "./GradientStopEditor.mjs";
|
|
4
4
|
import r from "./GradientStopTrack.mjs";
|
|
5
|
-
import i from "
|
|
6
|
-
import {
|
|
7
|
-
import
|
|
5
|
+
import { useCallback as i, useMemo as a, useRef as o, useState as s } from "react";
|
|
6
|
+
import { jsx as c, jsxs as l } from "react/jsx-runtime";
|
|
7
|
+
import u from "clsx";
|
|
8
8
|
import d from "@plitzi/plitzi-ui/Icon";
|
|
9
9
|
//#region src/components/StyleInspector/categories/Background/components/GradientStopBar/GradientStopBar.tsx
|
|
10
10
|
function f(e) {
|
|
@@ -12,32 +12,32 @@ function f(e) {
|
|
|
12
12
|
return isNaN(t) ? 0 : Math.max(0, Math.min(100, t));
|
|
13
13
|
}
|
|
14
14
|
var p = ({ stops: p, onChange: m }) => {
|
|
15
|
-
let h =
|
|
15
|
+
let h = o(p);
|
|
16
16
|
h.current = p;
|
|
17
|
-
let [g, _] =
|
|
17
|
+
let [g, _] = s(p[0]?.id ?? ""), v = a(() => [...p].sort((e, t) => f(e.position) - f(t.position)), [p]), y = a(() => `linear-gradient(90deg, ${v.map((e) => e.position ? `${e.color} ${e.position}` : e.color).join(", ")})`, [v]), b = p.find((e) => e.id === g) ?? p[0], x = i((t) => {
|
|
18
18
|
let { left: n, width: r } = t.currentTarget.getBoundingClientRect(), i = Math.round(Math.max(0, Math.min(100, (t.clientX - n) / r * 100))), a = h.current, o = [...a].sort((e, t) => Math.abs(f(e.position) - i) - Math.abs(f(t.position) - i)).at(0), s = {
|
|
19
19
|
id: e(),
|
|
20
20
|
color: o?.color ?? "#808080",
|
|
21
21
|
position: `${i}%`
|
|
22
22
|
}, c = [...a, s].sort((e, t) => f(e.position) - f(t.position));
|
|
23
23
|
m?.(c), _(s.id);
|
|
24
|
-
}, [m]), S =
|
|
24
|
+
}, [m]), S = i((e) => {
|
|
25
25
|
b && m?.(h.current.map((t) => t.id === b.id ? {
|
|
26
26
|
...t,
|
|
27
27
|
color: e
|
|
28
28
|
} : t));
|
|
29
|
-
}, [m, b]), C =
|
|
29
|
+
}, [m, b]), C = i((e) => {
|
|
30
30
|
m?.(e.sort((e, t) => f(e.position) - f(t.position)));
|
|
31
|
-
}, [m]), w =
|
|
31
|
+
}, [m]), w = i((e) => {
|
|
32
32
|
b && m?.(h.current.map((t) => t.id === b.id ? {
|
|
33
33
|
...t,
|
|
34
34
|
position: String(e)
|
|
35
35
|
} : t).sort((e, t) => f(e.position) - f(t.position)));
|
|
36
|
-
}, [m, b]), T =
|
|
36
|
+
}, [m, b]), T = i(() => {
|
|
37
37
|
if (!b || h.current.length <= 2) return;
|
|
38
38
|
let e = h.current.filter((e) => e.id !== b.id);
|
|
39
39
|
m?.(e), _(e[0]?.id ?? "");
|
|
40
|
-
}, [m, b]), E =
|
|
40
|
+
}, [m, b]), E = i(() => {
|
|
41
41
|
let t = {
|
|
42
42
|
id: e(),
|
|
43
43
|
color: "#808080",
|
|
@@ -45,43 +45,43 @@ var p = ({ stops: p, onChange: m }) => {
|
|
|
45
45
|
}, n = [...h.current, t].sort((e, t) => f(e.position) - f(t.position));
|
|
46
46
|
m?.(n), _(t.id);
|
|
47
47
|
}, [m]);
|
|
48
|
-
return /* @__PURE__ */
|
|
48
|
+
return /* @__PURE__ */ l("div", {
|
|
49
49
|
className: "flex flex-col gap-2",
|
|
50
50
|
children: [
|
|
51
|
-
/* @__PURE__ */
|
|
51
|
+
/* @__PURE__ */ c(t, {
|
|
52
52
|
gradientCSS: y,
|
|
53
53
|
onClick: x
|
|
54
54
|
}),
|
|
55
|
-
/* @__PURE__ */
|
|
55
|
+
/* @__PURE__ */ c("div", {
|
|
56
56
|
className: "flex px-2",
|
|
57
|
-
children: /* @__PURE__ */
|
|
57
|
+
children: /* @__PURE__ */ c(r, {
|
|
58
58
|
stops: p,
|
|
59
59
|
selectedId: g,
|
|
60
60
|
onChange: C,
|
|
61
61
|
onSelect: _
|
|
62
62
|
})
|
|
63
63
|
}),
|
|
64
|
-
b && /* @__PURE__ */
|
|
64
|
+
b && /* @__PURE__ */ c(n, {
|
|
65
65
|
stop: b,
|
|
66
66
|
showRemove: p.length > 2,
|
|
67
67
|
onColorChange: S,
|
|
68
68
|
onPositionChange: w,
|
|
69
69
|
onRemove: T
|
|
70
70
|
}),
|
|
71
|
-
/* @__PURE__ */
|
|
71
|
+
/* @__PURE__ */ l("div", {
|
|
72
72
|
className: "flex flex-wrap gap-1",
|
|
73
|
-
children: [v.map((e) => /* @__PURE__ */
|
|
73
|
+
children: [v.map((e) => /* @__PURE__ */ c("button", {
|
|
74
74
|
type: "button",
|
|
75
|
-
className:
|
|
75
|
+
className: u("h-5 w-5 cursor-pointer rounded-sm border shadow-sm", g === e.id ? "border-blue-500 ring-1 ring-blue-300 dark:ring-blue-700" : "border-gray-300 hover:border-gray-400 dark:border-zinc-600"),
|
|
76
76
|
style: { backgroundColor: e.color },
|
|
77
77
|
onClick: () => _(e.id),
|
|
78
78
|
title: `${e.color} • ${e.position}`
|
|
79
|
-
}, e.id)), /* @__PURE__ */
|
|
79
|
+
}, e.id)), /* @__PURE__ */ c("button", {
|
|
80
80
|
type: "button",
|
|
81
81
|
className: "flex h-5 w-5 cursor-pointer items-center justify-center rounded-sm border border-dashed border-gray-300 text-gray-400 hover:border-blue-400 hover:text-blue-500 dark:border-zinc-600 dark:text-zinc-500",
|
|
82
82
|
title: "Add stop at 50%",
|
|
83
83
|
onClick: E,
|
|
84
|
-
children: /* @__PURE__ */
|
|
84
|
+
children: /* @__PURE__ */ c(d, {
|
|
85
85
|
icon: "fas fa-plus",
|
|
86
86
|
size: "xs"
|
|
87
87
|
})
|
|
@@ -1,23 +1,23 @@
|
|
|
1
1
|
import e from "../../helpers/normalizeLeft.mjs";
|
|
2
|
-
import t from "
|
|
3
|
-
import {
|
|
4
|
-
import
|
|
2
|
+
import { useCallback as t, useLayoutEffect as n, useMemo as r, useRef as i } from "react";
|
|
3
|
+
import { jsx as a } from "react/jsx-runtime";
|
|
4
|
+
import o from "clsx";
|
|
5
5
|
//#region src/components/StyleInspector/categories/Background/components/GradientStopBar/GradientStopHandle.tsx
|
|
6
6
|
var s = ({ stop: s, selected: c, trackRef: l, onPositionChange: u, onSelect: d }) => {
|
|
7
|
-
let f =
|
|
7
|
+
let f = i(null), p = i(!1), m = i(!1), h = r(() => e(s.position, (f.current?.parentNode)?.getBoundingClientRect().width ?? Infinity), [s.position]), g = t((e) => {
|
|
8
8
|
let t = l.current;
|
|
9
9
|
if (!t) return 0;
|
|
10
10
|
let { left: n, width: r } = t.getBoundingClientRect();
|
|
11
11
|
return Math.round(Math.max(0, Math.min(100, (e - n) / r * 100)));
|
|
12
12
|
}, [l]);
|
|
13
|
-
|
|
13
|
+
n(() => {
|
|
14
14
|
!p.current && f.current && (f.current.style.left = h);
|
|
15
15
|
}, [h]);
|
|
16
|
-
let _ =
|
|
16
|
+
let _ = t((e) => {
|
|
17
17
|
e.preventDefault(), m.current = !1, p.current = !0, f.current?.setPointerCapture(e.pointerId), d(s.id);
|
|
18
|
-
}, [d, s.id]), v =
|
|
19
|
-
|
|
20
|
-
}, [g]), y =
|
|
18
|
+
}, [d, s.id]), v = t((e) => {
|
|
19
|
+
p.current && f.current && (m.current = !0, f.current.style.left = `${g(e.clientX)}%`);
|
|
20
|
+
}, [g]), y = t((e) => {
|
|
21
21
|
if (p.current && (p.current = !1, m.current && f.current)) {
|
|
22
22
|
let t = g(e.clientX);
|
|
23
23
|
f.current.style.left = `${t}%`, u(s.id, t);
|
|
@@ -27,9 +27,9 @@ var s = ({ stop: s, selected: c, trackRef: l, onPositionChange: u, onSelect: d }
|
|
|
27
27
|
u,
|
|
28
28
|
s.id
|
|
29
29
|
]);
|
|
30
|
-
return /* @__PURE__ */
|
|
30
|
+
return /* @__PURE__ */ a("div", {
|
|
31
31
|
ref: f,
|
|
32
|
-
className:
|
|
32
|
+
className: o("absolute top-1/2 h-4 w-4 -translate-x-1/2 -translate-y-1/2 cursor-grab rounded-full border-2 shadow-sm", c ? "z-10 border-blue-500 ring-1 ring-blue-300 dark:ring-blue-700" : "z-0 border-white hover:border-gray-300 dark:border-zinc-500"),
|
|
33
33
|
style: {
|
|
34
34
|
left: h,
|
|
35
35
|
backgroundColor: s.color
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import e from "
|
|
2
|
-
import {
|
|
3
|
-
import
|
|
1
|
+
import { useCallback as e } from "react";
|
|
2
|
+
import { jsx as t, jsxs as n } from "react/jsx-runtime";
|
|
3
|
+
import r from "clsx";
|
|
4
4
|
import i from "@plitzi/plitzi-ui/Icon";
|
|
5
5
|
import a from "@plitzi/plitzi-ui/icons/BorderPlacementBottom";
|
|
6
6
|
import o from "@plitzi/plitzi-ui/icons/BorderPlacementCenter";
|
|
@@ -9,44 +9,44 @@ import c from "@plitzi/plitzi-ui/icons/BorderPlacementRight";
|
|
|
9
9
|
import l from "@plitzi/plitzi-ui/icons/BorderPlacementTop";
|
|
10
10
|
//#region src/components/StyleInspector/categories/Border/BorderPlacements.tsx
|
|
11
11
|
var u = ({ currentPlacement: u, setCurrentPlacement: d }) => {
|
|
12
|
-
let f =
|
|
13
|
-
return /* @__PURE__ */
|
|
12
|
+
let f = e((e) => () => d(e), [d]);
|
|
13
|
+
return /* @__PURE__ */ n("div", {
|
|
14
14
|
className: "mx-auto grid grid-cols-3 grid-rows-3 place-items-center gap-2",
|
|
15
15
|
children: [
|
|
16
|
-
/* @__PURE__ */
|
|
16
|
+
/* @__PURE__ */ t(i, {
|
|
17
17
|
size: "2xl",
|
|
18
|
-
className:
|
|
18
|
+
className: r("col-start-2 cursor-pointer rounded p-0.5", { "bg-primary-100": u === "top" }),
|
|
19
19
|
onClick: f("top"),
|
|
20
20
|
active: u === "top",
|
|
21
|
-
children: /* @__PURE__ */
|
|
21
|
+
children: /* @__PURE__ */ t(l, {})
|
|
22
22
|
}),
|
|
23
|
-
/* @__PURE__ */
|
|
23
|
+
/* @__PURE__ */ t(i, {
|
|
24
24
|
size: "2xl",
|
|
25
|
-
className:
|
|
25
|
+
className: r("row-start-2 cursor-pointer rounded p-0.5", { "bg-primary-100": u === "left" }),
|
|
26
26
|
onClick: f("left"),
|
|
27
27
|
active: u === "left",
|
|
28
|
-
children: /* @__PURE__ */
|
|
28
|
+
children: /* @__PURE__ */ t(s, {})
|
|
29
29
|
}),
|
|
30
|
-
/* @__PURE__ */
|
|
30
|
+
/* @__PURE__ */ t(i, {
|
|
31
31
|
size: "2xl",
|
|
32
|
-
className:
|
|
32
|
+
className: r("row-start-2 grid cursor-pointer grid-cols-3 rounded p-0.5", { "bg-primary-100": u === "all" }),
|
|
33
33
|
onClick: f("all"),
|
|
34
34
|
active: u === "all",
|
|
35
|
-
children: /* @__PURE__ */
|
|
35
|
+
children: /* @__PURE__ */ t(o, {})
|
|
36
36
|
}),
|
|
37
|
-
/* @__PURE__ */
|
|
37
|
+
/* @__PURE__ */ t(i, {
|
|
38
38
|
size: "2xl",
|
|
39
|
-
className:
|
|
39
|
+
className: r("row-start-2 cursor-pointer rounded p-0.5", { "bg-primary-100": u === "right" }),
|
|
40
40
|
onClick: f("right"),
|
|
41
41
|
active: u === "right",
|
|
42
|
-
children: /* @__PURE__ */
|
|
42
|
+
children: /* @__PURE__ */ t(c, {})
|
|
43
43
|
}),
|
|
44
|
-
/* @__PURE__ */
|
|
44
|
+
/* @__PURE__ */ t(i, {
|
|
45
45
|
size: "2xl",
|
|
46
|
-
className:
|
|
46
|
+
className: r("col-start-2 row-start-3 cursor-pointer rounded p-0.5", { "bg-primary-100": u === "bottom" }),
|
|
47
47
|
onClick: f("bottom"),
|
|
48
48
|
active: u === "bottom",
|
|
49
|
-
children: /* @__PURE__ */
|
|
49
|
+
children: /* @__PURE__ */ t(a, {})
|
|
50
50
|
})
|
|
51
51
|
]
|
|
52
52
|
});
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import e from "../../components/CategoryOption/index.mjs";
|
|
2
2
|
import t from "../../components/CategorySection/index.mjs";
|
|
3
|
-
import n from "
|
|
4
|
-
import {
|
|
5
|
-
import
|
|
3
|
+
import { useCallback as n, useMemo as r } from "react";
|
|
4
|
+
import { jsx as i } from "react/jsx-runtime";
|
|
5
|
+
import a from "clsx";
|
|
6
6
|
import o from "@plitzi/plitzi-ui/icons/XMark";
|
|
7
7
|
import s from "@plitzi/plitzi-ui/icons/AlignSelfBaselineRow";
|
|
8
8
|
import c from "@plitzi/plitzi-ui/icons/AlignSelfCenterRow";
|
|
@@ -11,48 +11,48 @@ import u from "@plitzi/plitzi-ui/icons/AlignSelfStartRow";
|
|
|
11
11
|
import d from "@plitzi/plitzi-ui/icons/AlignSelfStretchRow";
|
|
12
12
|
//#region src/components/StyleInspector/categories/DisplayFlexChild/DisplayAlignSelf.tsx
|
|
13
13
|
var f = ["align-self"], p = ({ value: p, isFlexVertical: m = !1, onChange: h }) => {
|
|
14
|
-
let g =
|
|
14
|
+
let g = n((e) => h?.("align-self", e), [h]), _ = r(() => [
|
|
15
15
|
{
|
|
16
16
|
value: "auto",
|
|
17
|
-
icon: /* @__PURE__ */
|
|
17
|
+
icon: /* @__PURE__ */ i(o, {}),
|
|
18
18
|
description: "Align Auto",
|
|
19
19
|
active: p === "auto"
|
|
20
20
|
},
|
|
21
21
|
{
|
|
22
22
|
value: "flex-start",
|
|
23
|
-
icon: /* @__PURE__ */
|
|
23
|
+
icon: /* @__PURE__ */ i(u, { className: a({ "-rotate-90": m }) }),
|
|
24
24
|
description: "Align Start",
|
|
25
25
|
active: p === "flex-start"
|
|
26
26
|
},
|
|
27
27
|
{
|
|
28
28
|
value: "center",
|
|
29
|
-
icon: /* @__PURE__ */
|
|
29
|
+
icon: /* @__PURE__ */ i(c, { className: a({ "-rotate-90": m }) }),
|
|
30
30
|
description: "Align Center",
|
|
31
31
|
active: p === "center"
|
|
32
32
|
},
|
|
33
33
|
{
|
|
34
34
|
value: "flex-end",
|
|
35
|
-
icon: /* @__PURE__ */
|
|
35
|
+
icon: /* @__PURE__ */ i(l, { className: a({ "-rotate-90": m }) }),
|
|
36
36
|
description: "Align End",
|
|
37
37
|
active: p === "flex-end"
|
|
38
38
|
},
|
|
39
39
|
{
|
|
40
40
|
value: "stretch",
|
|
41
|
-
icon: /* @__PURE__ */
|
|
41
|
+
icon: /* @__PURE__ */ i(d, { className: a({ "-rotate-90": m }) }),
|
|
42
42
|
description: "Align Stretch",
|
|
43
43
|
active: p === "stretch"
|
|
44
44
|
},
|
|
45
45
|
{
|
|
46
46
|
value: "baseline",
|
|
47
|
-
icon: /* @__PURE__ */
|
|
47
|
+
icon: /* @__PURE__ */ i(s, {}),
|
|
48
48
|
description: "Align Baseline",
|
|
49
49
|
active: p === "baseline"
|
|
50
50
|
}
|
|
51
51
|
], [m, p]);
|
|
52
|
-
return /* @__PURE__ */
|
|
52
|
+
return /* @__PURE__ */ i(t, {
|
|
53
53
|
label: "Align",
|
|
54
54
|
keys: f,
|
|
55
|
-
children: /* @__PURE__ */
|
|
55
|
+
children: /* @__PURE__ */ i(e, {
|
|
56
56
|
onChange: g,
|
|
57
57
|
type: "iconGroup",
|
|
58
58
|
items: _
|
|
@@ -1,37 +1,38 @@
|
|
|
1
1
|
import e from "../../../components/InspectorLabel/index.mjs";
|
|
2
|
-
import t from "./
|
|
3
|
-
import
|
|
4
|
-
import {
|
|
5
|
-
import o from "
|
|
2
|
+
import { splitByCommaOutsideParens as t } from "./helpers.mjs";
|
|
3
|
+
import n from "./BoxShadowItem.mjs";
|
|
4
|
+
import { useCallback as r } from "react";
|
|
5
|
+
import { Fragment as i, jsx as a, jsxs as o } from "react/jsx-runtime";
|
|
6
|
+
import s from "@plitzi/plitzi-ui/Icon";
|
|
6
7
|
//#region src/components/StyleInspector/categories/Effects/BoxShadow/BoxShadow.tsx
|
|
7
|
-
var
|
|
8
|
-
let
|
|
9
|
-
|
|
8
|
+
var c = ({ value: c = "", onChange: l }) => {
|
|
9
|
+
let u = [];
|
|
10
|
+
c && c !== "" && (u = t(c));
|
|
10
11
|
let d = (e) => (t) => {
|
|
11
|
-
t.stopPropagation(), t.preventDefault(), u.splice(e, 1), u.length > 0 ?
|
|
12
|
+
t.stopPropagation(), t.preventDefault(), u.splice(e, 1), u.length > 0 ? l?.(u.join(",")) : l?.("");
|
|
12
13
|
}, f = (e) => (t) => {
|
|
13
|
-
t !== u[e] && (u[e] = t,
|
|
14
|
-
}, p =
|
|
15
|
-
|
|
16
|
-
}, [
|
|
17
|
-
return /* @__PURE__ */
|
|
14
|
+
t !== u[e] && (u[e] = t, l?.(u.join(",")));
|
|
15
|
+
}, p = r(() => {
|
|
16
|
+
c ? l?.(`${c},1px 1px 3px 1px black`) : l?.("1px 1px 3px 1px black");
|
|
17
|
+
}, [c, l]);
|
|
18
|
+
return /* @__PURE__ */ o(i, { children: [/* @__PURE__ */ o("div", {
|
|
18
19
|
className: "flex items-center justify-between",
|
|
19
|
-
children: [/* @__PURE__ */
|
|
20
|
+
children: [/* @__PURE__ */ a(e, {
|
|
20
21
|
keyValue: ["box-shadow"],
|
|
21
22
|
children: "Box Shadow"
|
|
22
|
-
}), /* @__PURE__ */
|
|
23
|
+
}), /* @__PURE__ */ a(s, {
|
|
23
24
|
className: "cursor-pointer",
|
|
24
25
|
icon: "fas fa-plus",
|
|
25
26
|
onClick: p
|
|
26
27
|
})]
|
|
27
|
-
}), u.length > 0 && /* @__PURE__ */
|
|
28
|
+
}), u.length > 0 && /* @__PURE__ */ a("div", {
|
|
28
29
|
className: "flex flex-col gap-2",
|
|
29
|
-
children: u.map((e,
|
|
30
|
+
children: u.map((e, t) => /* @__PURE__ */ a(n, {
|
|
30
31
|
value: e.trim(),
|
|
31
|
-
onChange: f(
|
|
32
|
-
onRemove: d(
|
|
33
|
-
},
|
|
32
|
+
onChange: f(t),
|
|
33
|
+
onRemove: d(t)
|
|
34
|
+
}, t))
|
|
34
35
|
})] });
|
|
35
36
|
};
|
|
36
37
|
//#endregion
|
|
37
|
-
export {
|
|
38
|
+
export { c as default };
|