@plitzi/sdk-style 0.36.1 → 0.37.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/CHANGELOG.md +72 -0
- package/dist/StyleMap/StyleMap.d.ts +5 -21
- package/dist/StyleMap/helpers/isValueValid.d.ts +1 -0
- package/dist/StyleMap/helpers/isValueValid.mjs +3 -3
- package/dist/StyleMap/helpers/utils.d.ts +2 -2
- package/dist/StyleMap/helpers/utils.mjs +43 -28
- package/dist/StyleMap/methods/addSelector.d.ts +2 -7
- package/dist/StyleMap/methods/addSelector.mjs +4 -4
- package/dist/StyleMap/methods/updateSelector.d.ts +2 -5
- package/dist/StyleMap/methods/updateSelector.mjs +2 -2
- package/dist/StyleReducer.d.ts +3 -11
- package/dist/components/Selector/Selector.mjs +149 -125
- package/dist/components/Selector/SelectorHelper.d.ts +25 -0
- package/dist/components/Selector/SelectorHelper.mjs +43 -2
- package/dist/components/StyleInspector/Inspector.d.ts +2 -1
- package/dist/components/StyleInspector/Inspector.mjs +92 -87
- package/dist/components/StyleInspector/StyleInspector.mjs +240 -169
- package/dist/components/StyleInspector/StyleInspectorContext.d.ts +1 -0
- package/dist/components/StyleInspector/StyleInspectorProvider.d.ts +2 -1
- package/dist/components/StyleInspector/StyleInspectorProvider.mjs +37 -31
- package/dist/components/StyleInspector/categories/Others/Others.mjs +58 -48
- package/dist/components/StyleInspector/categories/Others/OthersScrollbar.d.ts +9 -0
- package/dist/components/StyleInspector/categories/Others/OthersScrollbar.mjs +36 -0
- package/dist/components/StyleInspector/categories/Typography/Typography.mjs +29 -45
- package/dist/components/StyleInspector/categories/Typography/TypographyFigures.d.ts +13 -0
- package/dist/components/StyleInspector/categories/Typography/TypographyFigures.mjs +61 -0
- package/dist/components/StyleInspector/components/AncestorRules/AncestorRuleChip.d.ts +10 -0
- package/dist/components/StyleInspector/components/AncestorRules/AncestorRuleChip.mjs +39 -0
- package/dist/components/StyleInspector/components/AncestorRules/AncestorRules.d.ts +14 -0
- package/dist/components/StyleInspector/components/AncestorRules/AncestorRules.mjs +36 -0
- package/dist/components/StyleInspector/components/AncestorRules/index.d.ts +3 -0
- package/dist/components/StyleInspector/components/AncestorRules/index.mjs +5 -0
- package/dist/components/StyleInspector/helpers.d.ts +36 -0
- package/dist/components/StyleInspector/helpers.mjs +54 -0
- package/dist/components/StyleInspector/hooks/useStyleInherit.d.ts +2 -1
- package/dist/components/StyleInspector/hooks/useStyleInherit.mjs +7 -5
- package/dist/components/StyleManager/ManagerSelector.d.ts +3 -2
- package/dist/components/StyleManager/ManagerSelector.mjs +114 -86
- package/dist/components/StyleManager/StyleManager.mjs +1 -0
- package/dist/components/StyleManager/StyleSelectorTag.d.ts +4 -1
- package/dist/components/StyleManager/StyleSelectorTag.mjs +36 -22
- package/dist/helpers/calculateInheriting.d.ts +1 -0
- package/dist/helpers/calculateInheriting.mjs +38 -28
- package/dist/helpers/processSelector.mjs +44 -21
- package/dist/helpers/processSelectorAttributes.d.ts +14 -6
- package/dist/helpers/processSelectorAttributes.mjs +38 -22
- package/package.json +18 -6
|
@@ -1,201 +1,272 @@
|
|
|
1
|
-
import e from "
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import h from "
|
|
10
|
-
import
|
|
11
|
-
import
|
|
12
|
-
import
|
|
1
|
+
import { STYLE_STATE_OPTIONS as e, ancestorClasses as t, ancestorConditions as n, ancestorOptions as r, ancestorRemovals as i, unusedAncestors as a } from "./helpers.mjs";
|
|
2
|
+
import o from "../Selector/index.mjs";
|
|
3
|
+
import ee from "./components/AncestorRules/index.mjs";
|
|
4
|
+
import te from "./Inspector.mjs";
|
|
5
|
+
import { use as ne, useCallback as s, useEffect as re, useMemo as c, useState as l } from "react";
|
|
6
|
+
import { useBuilderStore as ie, useBuilderStoreSync as u } from "@plitzi/sdk-shared/store";
|
|
7
|
+
import { get as d, pick as f, set as p } from "@plitzi/plitzi-ui/helpers";
|
|
8
|
+
import { produce as m } from "immer";
|
|
9
|
+
import { jsx as h, jsxs as g } from "react/jsx-runtime";
|
|
10
|
+
import { clsx as ae } from "clsx";
|
|
11
|
+
import oe from "@plitzi/sdk-shared/builder/contexts/BuilderContext";
|
|
12
|
+
import _ from "@plitzi/plitzi-ui/hooks/useDidUpdateEffect";
|
|
13
|
+
import v from "@plitzi/plitzi-ui/Select";
|
|
14
|
+
import y from "@plitzi/plitzi-ui/Select2";
|
|
13
15
|
//#region src/components/StyleInspector/StyleInspector.tsx
|
|
14
|
-
var
|
|
15
|
-
let [
|
|
16
|
-
|
|
17
|
-
let
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
16
|
+
var b = ({ displayMode: b, selectors: x, value: S, element: C, mode: w = "element", componentType: T, styleSelectors: E, styleSelectorsAvailables: D, componentSubTypesAvailables: O, allowStyleSelector: se = !0, allowStyleState: k = !0, allowStyleVariant: A = !0, onChange: j, onRemoveVariant: M }) => {
|
|
17
|
+
let [ce, N] = l(void 0), [P, F] = l("base"), [I, L] = l(void 0), [R, z] = l(void 0);
|
|
18
|
+
u("styleSelector", P, { enabled: w === "element" }), u("styleVariant", I, { enabled: w === "element" });
|
|
19
|
+
let [B, V] = l(void 0);
|
|
20
|
+
u("styleState", R, { enabled: w === "element" }), u("styleAncestor", B, { enabled: w === "element" });
|
|
21
|
+
let [[H, U]] = ie(["schema.flat", "style.platform"]), { builderHandler: W } = ne(oe), G = c(() => d(E, P, ""), [E, P]), le = c(() => Object.values(f(x ?? {}, C ? [C.definition.type, ...G.split(" ")] : G.split(" "))), [
|
|
22
|
+
x,
|
|
23
|
+
C,
|
|
24
|
+
G
|
|
25
|
+
]), K = c(() => S ? d(x, S) : void 0, [x, S]), q = K?.attributes[P]?.ancestors, J = c(() => w === "element" ? t(H, C) : Object.values(x ?? {}).filter((e) => e.type === "class" && e.name !== S).map((e) => e.name).sort((e, t) => e.localeCompare(t)), [
|
|
26
|
+
C,
|
|
27
|
+
H,
|
|
28
|
+
w,
|
|
29
|
+
x,
|
|
30
|
+
S
|
|
31
|
+
]), Y = c(() => r(J, q), [J, q]), X = c(() => n(q), [q]), Z = c(() => K ? a(H, K) : /* @__PURE__ */ new Set(), [H, K]), ue = c(() => {
|
|
32
|
+
let e = Object.keys(q ?? {}).length;
|
|
33
|
+
return e ? `When an ancestor is… (${e} set)` : "When an ancestor is…";
|
|
34
|
+
}, [q]), de = c(() => {
|
|
35
|
+
let e = K?.attributes[P], t = B ? [...Object.keys(x?.[B]?.attributes.base.variants ?? {}), ...Object.keys(e?.ancestors?.[B]?.variants ?? {})] : Object.keys(e?.variants ?? {});
|
|
36
|
+
return [...new Set(t)].map((e) => ({
|
|
37
|
+
label: e,
|
|
38
|
+
value: e
|
|
39
|
+
}));
|
|
40
|
+
}, [
|
|
41
|
+
K?.attributes,
|
|
42
|
+
x,
|
|
43
|
+
B,
|
|
44
|
+
P
|
|
45
|
+
]);
|
|
46
|
+
re(() => {
|
|
47
|
+
if (F("base"), w !== "element") return;
|
|
48
|
+
let e = d(E, "base", "").split(" "), t = e[e.length - 1];
|
|
49
|
+
j?.(t || ""), z(void 0), V(void 0), N(void 0);
|
|
50
|
+
}, [j, E]), _(() => {
|
|
51
|
+
if (w === "element") {
|
|
52
|
+
if (S !== C?.definition.type) {
|
|
53
|
+
let e = d(E, P, "").split(" ");
|
|
33
54
|
j?.(e[e.length - 1]);
|
|
34
55
|
}
|
|
35
|
-
|
|
56
|
+
z(void 0), L(void 0), V(void 0), N(void 0);
|
|
36
57
|
}
|
|
37
|
-
}, [
|
|
38
|
-
|
|
39
|
-
}, [
|
|
40
|
-
let
|
|
58
|
+
}, [P]), _(() => {
|
|
59
|
+
z(void 0), L(void 0), V(void 0), N(void 0);
|
|
60
|
+
}, [S]);
|
|
61
|
+
let fe = s((e, t, n) => {
|
|
41
62
|
if (t && !n) return;
|
|
42
63
|
let { name: r, type: i } = e;
|
|
43
|
-
!t && r !== "" && !
|
|
44
|
-
styleSelector:
|
|
45
|
-
componentType: i === "element" ?
|
|
46
|
-
}) : t && n && n.name !== r &&
|
|
47
|
-
styleSelector:
|
|
48
|
-
componentType: i === "element" ?
|
|
64
|
+
!t && r !== "" && !x?.[r] ? W("styleAddSelector", b, r, i, void 0, void 0, {
|
|
65
|
+
styleSelector: P,
|
|
66
|
+
componentType: i === "element" ? T : void 0
|
|
67
|
+
}) : t && n && n.name !== r && x?.[n.name] && !x[r] && W("styleAddSelector", b, r, i, void 0, d(x, `${n.name}.attributes.${P}.default`, {}), {
|
|
68
|
+
styleSelector: P,
|
|
69
|
+
componentType: i === "element" ? T : void 0
|
|
49
70
|
});
|
|
50
71
|
}, [
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
y,
|
|
72
|
+
W,
|
|
73
|
+
T,
|
|
54
74
|
b,
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
75
|
+
x,
|
|
76
|
+
P
|
|
77
|
+
]), pe = s((e) => {
|
|
78
|
+
if (!e || S && S === e.name) {
|
|
58
79
|
j?.(void 0);
|
|
59
80
|
return;
|
|
60
81
|
}
|
|
61
82
|
j?.(e.name);
|
|
62
|
-
}, [j,
|
|
63
|
-
|
|
64
|
-
|
|
83
|
+
}, [j, S]), me = s((e) => {
|
|
84
|
+
C && W("schemaUpdateElement", m(C, (t) => {
|
|
85
|
+
p(t, `definition.styleSelectors.${P}`, e);
|
|
65
86
|
}));
|
|
66
87
|
}, [
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
]),
|
|
71
|
-
|
|
72
|
-
}, [
|
|
73
|
-
|
|
74
|
-
}, []),
|
|
75
|
-
|
|
76
|
-
}, []),
|
|
77
|
-
|
|
78
|
-
styleSelector:
|
|
88
|
+
C,
|
|
89
|
+
W,
|
|
90
|
+
P
|
|
91
|
+
]), he = s((e) => {
|
|
92
|
+
W("styleRemoveSelector", b, e.name);
|
|
93
|
+
}, [W, b]), ge = s((e) => N(e), []), _e = s((e) => {
|
|
94
|
+
F(e);
|
|
95
|
+
}, []), ve = s((e) => z(e?.value), []), ye = s((e) => {
|
|
96
|
+
V(e?.value), z(void 0), L(void 0);
|
|
97
|
+
}, []), be = s((e) => {
|
|
98
|
+
e.value === B && (V(void 0), z(void 0), L(void 0)), K?.attributes[P]?.ancestors?.[e.value] && W("styleUpdateSelector", b, K.name, void 0, void 0, {
|
|
99
|
+
styleSelector: P,
|
|
100
|
+
styleAncestor: e.value,
|
|
101
|
+
componentType: K.componentType
|
|
102
|
+
});
|
|
103
|
+
}, [
|
|
104
|
+
W,
|
|
105
|
+
b,
|
|
106
|
+
K,
|
|
107
|
+
B,
|
|
108
|
+
P
|
|
109
|
+
]), xe = s((e) => {
|
|
110
|
+
V(e.ancestor), L(e.variant), z(e.state);
|
|
111
|
+
}, []), Q = s((e) => {
|
|
112
|
+
if (!K) return;
|
|
113
|
+
let { ancestor: t, state: n, variant: r } = e;
|
|
114
|
+
t === B && n === R && r === I && (z(void 0), L(void 0)), W("styleUpdateSelector", b, K.name, void 0, n || r ? void 0 : {}, {
|
|
115
|
+
styleSelector: P,
|
|
116
|
+
styleAncestor: t,
|
|
117
|
+
styleState: n,
|
|
118
|
+
styleVariant: r,
|
|
119
|
+
componentType: K.componentType
|
|
120
|
+
});
|
|
121
|
+
}, [
|
|
122
|
+
W,
|
|
123
|
+
b,
|
|
124
|
+
K,
|
|
125
|
+
B,
|
|
126
|
+
P,
|
|
127
|
+
R,
|
|
128
|
+
I
|
|
129
|
+
]), Se = s(() => {
|
|
130
|
+
if (K) {
|
|
131
|
+
B && Z.has(B) && (V(void 0), z(void 0), L(void 0));
|
|
132
|
+
for (let e of i(U, K.name, Z)) W("styleUpdateSelector", e.displayMode, K.name, void 0, void 0, {
|
|
133
|
+
styleSelector: e.styleSelector,
|
|
134
|
+
styleAncestor: e.styleAncestor,
|
|
135
|
+
componentType: K.componentType
|
|
136
|
+
});
|
|
137
|
+
}
|
|
138
|
+
}, [
|
|
139
|
+
W,
|
|
140
|
+
U,
|
|
141
|
+
K,
|
|
142
|
+
B,
|
|
143
|
+
Z
|
|
144
|
+
]), Ce = s((e) => {
|
|
145
|
+
L(e?.value);
|
|
146
|
+
}, []), we = s((e) => {
|
|
147
|
+
M?.(e.value), R && z(void 0), e.value === I && L(void 0), W("styleUpdateSelector", b, K?.name, void 0, void 0, {
|
|
148
|
+
styleSelector: P,
|
|
79
149
|
styleVariant: e.value,
|
|
80
|
-
|
|
81
|
-
componentType:
|
|
150
|
+
styleAncestor: B,
|
|
151
|
+
componentType: K?.componentType
|
|
82
152
|
});
|
|
83
153
|
}, [
|
|
84
|
-
|
|
85
|
-
|
|
154
|
+
W,
|
|
155
|
+
b,
|
|
86
156
|
M,
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
157
|
+
K?.componentType,
|
|
158
|
+
K?.name,
|
|
159
|
+
P,
|
|
160
|
+
R,
|
|
161
|
+
I,
|
|
162
|
+
B
|
|
163
|
+
]), $ = A || k || !!D?.length || !!O?.length;
|
|
164
|
+
return /* @__PURE__ */ g("div", {
|
|
94
165
|
className: "flex w-full grow flex-col gap-2",
|
|
95
|
-
children: [/* @__PURE__ */
|
|
166
|
+
children: [/* @__PURE__ */ g("div", {
|
|
96
167
|
className: "flex w-full flex-col gap-2 px-1",
|
|
97
|
-
children: [
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
value: N,
|
|
114
|
-
onChange: X,
|
|
115
|
-
children: D.map((e) => /* @__PURE__ */ f("option", {
|
|
116
|
-
value: e,
|
|
117
|
-
children: e
|
|
118
|
-
}, e))
|
|
119
|
-
}),
|
|
120
|
-
E && E.length > 1 && /* @__PURE__ */ f(_, {
|
|
121
|
-
className: "grow basis-0",
|
|
122
|
-
size: "xs",
|
|
123
|
-
onChange: Z,
|
|
124
|
-
value: F,
|
|
125
|
-
children: E.map((e) => /* @__PURE__ */ f("option", {
|
|
126
|
-
value: e,
|
|
127
|
-
children: e
|
|
128
|
-
}, e))
|
|
129
|
-
}),
|
|
130
|
-
A && /* @__PURE__ */ f("div", {
|
|
131
|
-
className: "grow basis-0",
|
|
132
|
-
children: /* @__PURE__ */ f(v, {
|
|
168
|
+
children: [
|
|
169
|
+
w === "element" && /* @__PURE__ */ h(o, {
|
|
170
|
+
className: "min-h-0 w-full",
|
|
171
|
+
value: G,
|
|
172
|
+
selectors: x,
|
|
173
|
+
selector: K,
|
|
174
|
+
componentType: T,
|
|
175
|
+
onAdd: fe,
|
|
176
|
+
onChange: me,
|
|
177
|
+
onRemove: he,
|
|
178
|
+
onSelectorSelected: pe
|
|
179
|
+
}),
|
|
180
|
+
$ && /* @__PURE__ */ g("div", {
|
|
181
|
+
className: ae("flex w-full items-center gap-2", { "mt-2": w === "manager" }),
|
|
182
|
+
children: [
|
|
183
|
+
!!O?.length && /* @__PURE__ */ h(v, {
|
|
133
184
|
className: "grow basis-0",
|
|
134
|
-
value: L,
|
|
135
|
-
options: G,
|
|
136
|
-
placeholder: "Variant",
|
|
137
185
|
size: "xs",
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
className: "grow basis-0",
|
|
147
|
-
children: /* @__PURE__ */ f(v, {
|
|
186
|
+
value: ce,
|
|
187
|
+
onChange: ge,
|
|
188
|
+
children: O.map((e) => /* @__PURE__ */ h("option", {
|
|
189
|
+
value: e,
|
|
190
|
+
children: e
|
|
191
|
+
}, e))
|
|
192
|
+
}),
|
|
193
|
+
se && D && D.length > 1 && /* @__PURE__ */ h(v, {
|
|
148
194
|
className: "grow basis-0",
|
|
149
|
-
value: z,
|
|
150
|
-
options: [
|
|
151
|
-
{
|
|
152
|
-
label: "Hover",
|
|
153
|
-
value: "hover"
|
|
154
|
-
},
|
|
155
|
-
{
|
|
156
|
-
label: "Focus",
|
|
157
|
-
value: "focus"
|
|
158
|
-
},
|
|
159
|
-
{
|
|
160
|
-
label: "Active",
|
|
161
|
-
value: "active"
|
|
162
|
-
},
|
|
163
|
-
{
|
|
164
|
-
label: "Disabled",
|
|
165
|
-
value: "disabled"
|
|
166
|
-
},
|
|
167
|
-
{
|
|
168
|
-
label: "checked",
|
|
169
|
-
value: "Checked"
|
|
170
|
-
},
|
|
171
|
-
{
|
|
172
|
-
label: "visited",
|
|
173
|
-
value: "Visited"
|
|
174
|
-
}
|
|
175
|
-
],
|
|
176
|
-
placeholder: "State",
|
|
177
195
|
size: "xs",
|
|
178
|
-
|
|
179
|
-
|
|
196
|
+
onChange: _e,
|
|
197
|
+
value: P,
|
|
198
|
+
children: D.map((e) => /* @__PURE__ */ h("option", {
|
|
199
|
+
value: e,
|
|
200
|
+
children: e
|
|
201
|
+
}, e))
|
|
202
|
+
}),
|
|
203
|
+
A && /* @__PURE__ */ h("div", {
|
|
204
|
+
className: "grow basis-0",
|
|
205
|
+
children: /* @__PURE__ */ h(y, {
|
|
206
|
+
className: "grow basis-0",
|
|
207
|
+
value: I,
|
|
208
|
+
options: de,
|
|
209
|
+
placeholder: "Variant",
|
|
210
|
+
size: "xs",
|
|
211
|
+
allowCreateOptions: !0,
|
|
212
|
+
allowRemoveOptions: !0,
|
|
213
|
+
clearable: !0,
|
|
214
|
+
onChange: Ce,
|
|
215
|
+
onRemove: we
|
|
216
|
+
})
|
|
217
|
+
}),
|
|
218
|
+
k && /* @__PURE__ */ h("div", {
|
|
219
|
+
className: "grow basis-0",
|
|
220
|
+
children: /* @__PURE__ */ h(y, {
|
|
221
|
+
className: "grow basis-0",
|
|
222
|
+
value: R,
|
|
223
|
+
options: e,
|
|
224
|
+
placeholder: "State",
|
|
225
|
+
size: "xs",
|
|
226
|
+
clearable: !0,
|
|
227
|
+
onChange: ve
|
|
228
|
+
})
|
|
180
229
|
})
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
230
|
+
]
|
|
231
|
+
}),
|
|
232
|
+
$ && k && !!Y.length && /* @__PURE__ */ h(y, {
|
|
233
|
+
className: "w-full",
|
|
234
|
+
value: B,
|
|
235
|
+
options: Y,
|
|
236
|
+
placeholder: ue,
|
|
237
|
+
size: "xs",
|
|
238
|
+
clearable: !0,
|
|
239
|
+
allowRemoveOptions: !0,
|
|
240
|
+
onChange: ye,
|
|
241
|
+
onRemove: be
|
|
242
|
+
}),
|
|
243
|
+
k && X.length > 0 && /* @__PURE__ */ h(ee, {
|
|
244
|
+
conditions: X,
|
|
245
|
+
unused: Z,
|
|
246
|
+
activeAncestor: B,
|
|
247
|
+
activeState: R,
|
|
248
|
+
activeVariant: I,
|
|
249
|
+
onSelect: xe,
|
|
250
|
+
onRemove: Q,
|
|
251
|
+
onRemoveUnused: Se
|
|
252
|
+
})
|
|
253
|
+
]
|
|
254
|
+
}), /* @__PURE__ */ h("div", {
|
|
185
255
|
className: "flex grow basis-0 flex-col overflow-auto border-t border-gray-300 dark:border-zinc-700",
|
|
186
|
-
children: /* @__PURE__ */
|
|
187
|
-
selectors:
|
|
188
|
-
componentType:
|
|
189
|
-
selector:
|
|
190
|
-
styleSelector:
|
|
191
|
-
styleState:
|
|
192
|
-
styleVariant:
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
256
|
+
children: /* @__PURE__ */ h(te, {
|
|
257
|
+
selectors: le,
|
|
258
|
+
componentType: T,
|
|
259
|
+
selector: K,
|
|
260
|
+
styleSelector: P,
|
|
261
|
+
styleState: R,
|
|
262
|
+
styleVariant: I,
|
|
263
|
+
styleAncestor: B,
|
|
264
|
+
element: C,
|
|
265
|
+
displayMode: b,
|
|
266
|
+
mode: w
|
|
196
267
|
})
|
|
197
268
|
})]
|
|
198
269
|
});
|
|
199
270
|
};
|
|
200
271
|
//#endregion
|
|
201
|
-
export {
|
|
272
|
+
export { b as default };
|
|
@@ -8,10 +8,11 @@ export type StyleInspectorProviderProps = {
|
|
|
8
8
|
styleSelector?: string;
|
|
9
9
|
styleState?: StyleState;
|
|
10
10
|
styleVariant?: string;
|
|
11
|
+
styleAncestor?: string;
|
|
11
12
|
element?: Element;
|
|
12
13
|
inheritData: InheritData;
|
|
13
14
|
displayMode: DisplayMode;
|
|
14
15
|
onChange?: (path?: StyleCategory, values?: StyleObject | StyleValue) => void;
|
|
15
16
|
};
|
|
16
|
-
declare const StyleInspectorProvider: ({ children, componentType, selector, styleSelector, styleState, styleVariant, element, inheritData, displayMode, onChange }: StyleInspectorProviderProps) => import("react").JSX.Element;
|
|
17
|
+
declare const StyleInspectorProvider: ({ children, componentType, selector, styleSelector, styleState, styleVariant, styleAncestor, element, inheritData, displayMode, onChange }: StyleInspectorProviderProps) => import("react").JSX.Element;
|
|
17
18
|
export default StyleInspectorProvider;
|
|
@@ -7,79 +7,85 @@ import { get as o, omit as s } from "@plitzi/plitzi-ui/helpers";
|
|
|
7
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
|
-
var u = ({ children: u, componentType: d, selector: f, styleSelector: p = "base", styleState: m, styleVariant: h,
|
|
11
|
-
let
|
|
10
|
+
var u = ({ children: u, componentType: d, selector: f, styleSelector: p = "base", styleState: m, styleVariant: h, styleAncestor: g, element: _, inheritData: v, displayMode: y, onChange: b }) => {
|
|
11
|
+
let x = t({ element: _ }), [S = a] = i("runtime.sources.variables"), C = n(() => {
|
|
12
12
|
let e;
|
|
13
13
|
if (f && p && f.attributes[p]) {
|
|
14
14
|
let t = f.attributes[p];
|
|
15
|
-
|
|
15
|
+
if (g) {
|
|
16
|
+
let n = t.ancestors?.[g], r = h ? n?.variants?.[h] : void 0, i = h ? r : n;
|
|
17
|
+
e = (m ? i?.states?.[m] : i?.default) ?? {};
|
|
18
|
+
} else e = m && h ? t.variants?.[h].states?.[m] ?? {} : h ? t.variants?.[h]?.default ?? {} : m ? t.states?.[m] ?? {} : t.default ?? {};
|
|
16
19
|
} else e = {};
|
|
17
20
|
return e;
|
|
18
21
|
}, [
|
|
19
22
|
f,
|
|
20
23
|
p,
|
|
21
24
|
m,
|
|
22
|
-
h
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
25
|
+
h,
|
|
26
|
+
g
|
|
27
|
+
]), w = n((e, t) => {
|
|
28
|
+
if (!(e && typeof t != "string" && typeof t != "number" && t !== void 0 || !e && typeof t != "object" && t !== void 0 || e && o(x, e))) {
|
|
29
|
+
if (!e && t && typeof t == "object" && (t = s(t, Object.keys(x))), !e && f && typeof t == "object") {
|
|
26
30
|
let e = {
|
|
27
|
-
...
|
|
31
|
+
...C(),
|
|
28
32
|
...t
|
|
29
33
|
};
|
|
30
34
|
Object.keys(e).forEach((t) => {
|
|
31
35
|
e[t] === void 0 && delete e[t];
|
|
32
36
|
}), t = e;
|
|
33
37
|
}
|
|
34
|
-
|
|
38
|
+
b?.(e, t);
|
|
35
39
|
}
|
|
36
40
|
}, [
|
|
41
|
+
x,
|
|
42
|
+
C,
|
|
37
43
|
b,
|
|
38
|
-
S,
|
|
39
|
-
y,
|
|
40
44
|
f
|
|
41
|
-
]),
|
|
45
|
+
]), T = n((e) => Array.isArray(e) ? e.reduce((e, t) => ({
|
|
42
46
|
...e,
|
|
43
47
|
[t]: o(l, t)
|
|
44
|
-
}), {}) : e ? o(l, e) : l, []),
|
|
48
|
+
}), {}) : e ? o(l, e) : l, []), E = n((e) => {
|
|
45
49
|
if (Array.isArray(e)) {
|
|
46
50
|
let t = e.reduce((e, t) => ({
|
|
47
51
|
...e,
|
|
48
52
|
[t]: void 0
|
|
49
53
|
}), {});
|
|
50
|
-
|
|
51
|
-
} else
|
|
52
|
-
}, [
|
|
54
|
+
w(void 0, t);
|
|
55
|
+
} else w(e);
|
|
56
|
+
}, [w]), D = r(() => ({
|
|
53
57
|
componentType: d,
|
|
54
58
|
selector: f,
|
|
55
59
|
styleSelector: p,
|
|
56
60
|
styleState: m,
|
|
57
61
|
styleVariant: h,
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
62
|
+
styleAncestor: g,
|
|
63
|
+
displayMode: y,
|
|
64
|
+
variables: S,
|
|
65
|
+
inheritData: v.style,
|
|
66
|
+
bindingData: x,
|
|
67
|
+
getValues: C,
|
|
68
|
+
setValue: w,
|
|
69
|
+
resetValue: E,
|
|
70
|
+
getDefaultValue: T
|
|
66
71
|
}), [
|
|
67
72
|
d,
|
|
68
73
|
f,
|
|
69
74
|
p,
|
|
70
75
|
m,
|
|
71
76
|
h,
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
_.style,
|
|
75
|
-
b,
|
|
77
|
+
g,
|
|
78
|
+
y,
|
|
76
79
|
S,
|
|
80
|
+
v.style,
|
|
81
|
+
x,
|
|
77
82
|
C,
|
|
78
|
-
|
|
79
|
-
|
|
83
|
+
w,
|
|
84
|
+
E,
|
|
85
|
+
T
|
|
80
86
|
]);
|
|
81
87
|
return /* @__PURE__ */ c(e, {
|
|
82
|
-
value:
|
|
88
|
+
value: D,
|
|
83
89
|
children: u
|
|
84
90
|
});
|
|
85
91
|
};
|