@plitzi/sdk-style 0.33.1 → 0.34.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 +25 -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/dist/models/SelectorForm/SelectorForm.mjs +1 -1
- package/package.json +26 -9
|
@@ -1,37 +1,37 @@
|
|
|
1
1
|
import e from "../StyleInspectorContext.mjs";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
2
|
+
import { use as t, useMemo as n } from "react";
|
|
3
|
+
import { get as r, pick as i } from "@plitzi/plitzi-ui/helpers";
|
|
4
4
|
import { baseDefaultValue as a } from "@plitzi/sdk-shared";
|
|
5
5
|
import { VARIABLE_REGEX as o } from "@plitzi/sdk-shared/schema/schemaConstants";
|
|
6
6
|
//#region src/components/StyleInspector/hooks/useInspectorValues.ts
|
|
7
7
|
var s = ({ keys: s, skipContext: c = !1, context: l = {}, asValue: u = !1, defaultValues: d, strictMode: f = !1, replaceTokens: p = !1 }) => {
|
|
8
8
|
let { inheritData: m, bindingData: h, variables: g, getValues: _ } = {};
|
|
9
|
-
c ? {inheritData: m, bindingData: h, variables: g, getValues: _} = l : {inheritData: m, bindingData: h, variables: g, getValues: _} =
|
|
10
|
-
let v = _(), y =
|
|
9
|
+
c ? {inheritData: m, bindingData: h, variables: g, getValues: _} = l : {inheritData: m, bindingData: h, variables: g, getValues: _} = t(e);
|
|
10
|
+
let v = _(), y = n(() => !!s && !u && Object.keys(m).filter((e) => s.includes(e) || s.length === 0).length > 0, [
|
|
11
11
|
s,
|
|
12
12
|
m,
|
|
13
13
|
u
|
|
14
|
-
]), b =
|
|
14
|
+
]), b = n(() => !!s && !u && Object.keys(h).filter((e) => s.includes(e) || s.length === 0).length > 0, [
|
|
15
15
|
s,
|
|
16
16
|
h,
|
|
17
17
|
u
|
|
18
|
-
]), x =
|
|
18
|
+
]), x = n(() => !!s && !u && Object.keys(i(v, s)).filter((e) => typeof v[e] == "string" && o.test(v[e])).length > 0, [
|
|
19
19
|
s,
|
|
20
20
|
v,
|
|
21
21
|
u
|
|
22
|
-
]), S =
|
|
22
|
+
]), S = n(() => s ? s.length > 0 ? !u && Object.keys(i(v, s)).length > 0 : !u && Object.keys(v).length > 0 : !1, [
|
|
23
23
|
s,
|
|
24
24
|
u,
|
|
25
25
|
v
|
|
26
|
-
]), C =
|
|
26
|
+
]), C = n(() => {
|
|
27
27
|
let e = {};
|
|
28
28
|
if (!s) return e;
|
|
29
|
-
let
|
|
30
|
-
return s.forEach((
|
|
29
|
+
let t = new RegExp(o, "g");
|
|
30
|
+
return s.forEach((n) => {
|
|
31
31
|
let i;
|
|
32
|
-
i = f ?
|
|
33
|
-
i = i.replace(e[0],
|
|
34
|
-
}), e[
|
|
32
|
+
i = f ? r(v, n, r(d ?? {}, n)) : r(v, n, r(h, n, r(m, `${n}.0.value`, r(d ?? {}, n, a[n])))), p && typeof i == "string" && o.test(i) && [...i.matchAll(t)].forEach((e) => {
|
|
33
|
+
i = i.replace(e[0], r(g, e[1] ? e[1] : e[2], e[0]));
|
|
34
|
+
}), e[n] = i;
|
|
35
35
|
}), e;
|
|
36
36
|
}, [
|
|
37
37
|
s,
|
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { emptyObject as
|
|
4
|
-
import {
|
|
1
|
+
import { useMemo as e } from "react";
|
|
2
|
+
import { useCommonStore as t } from "@plitzi/sdk-shared/store";
|
|
3
|
+
import { emptyObject as n } from "@plitzi/sdk-shared/helpers/utils";
|
|
4
|
+
import { get as r, set as i } from "@plitzi/plitzi-ui/helpers";
|
|
5
5
|
//#region src/components/StyleInspector/hooks/useStyleBinding.ts
|
|
6
6
|
var a = ({ element: a }) => {
|
|
7
|
-
let [o =
|
|
8
|
-
return
|
|
9
|
-
let
|
|
10
|
-
if (!a) return
|
|
11
|
-
let { definition: { bindings:
|
|
12
|
-
return
|
|
13
|
-
|
|
14
|
-
}),
|
|
7
|
+
let [o = n] = t("runtime.sources");
|
|
8
|
+
return e(() => {
|
|
9
|
+
let e = {};
|
|
10
|
+
if (!a) return e;
|
|
11
|
+
let { definition: { bindings: t } } = a;
|
|
12
|
+
return t?.style && t.style.forEach((t) => {
|
|
13
|
+
r(o, t.source) !== void 0 && t.enabled && i(e, t.to, r(o, t.source));
|
|
14
|
+
}), e;
|
|
15
15
|
}, [o, a]);
|
|
16
16
|
};
|
|
17
17
|
//#endregion
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import e from "../../../helpers/calculateInheriting.mjs";
|
|
2
2
|
import { use as t, useMemo as n } from "react";
|
|
3
|
-
import r from "@plitzi/sdk-shared/
|
|
4
|
-
import
|
|
3
|
+
import { useBuilderStore as r } from "@plitzi/sdk-shared/store";
|
|
4
|
+
import i from "@plitzi/sdk-shared/elements/ComponentContext";
|
|
5
5
|
//#region src/components/StyleInspector/hooks/useStyleInherit.ts
|
|
6
6
|
var a = ({ element: a, componentType: o, componentSubType: s, selector: c, styleSelector: l = "base", styleState: u, styleVariant: d }) => {
|
|
7
|
-
let [[f, p]] =
|
|
7
|
+
let [[f, p]] = r(["schema.flat", "style.platform"]), { componentDefinitions: m } = t(i);
|
|
8
8
|
return n(() => {
|
|
9
9
|
let t = [], n = [], r = (a?.definition.styleSelectors[l] ?? "").split(" ");
|
|
10
10
|
return c && r.length > 1 && t.push(c), e(a, o, f, p, m.current, {
|
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
import e from "./StyleSelectorTag.mjs";
|
|
2
2
|
import t from "../../models/SelectorForm/index.mjs";
|
|
3
3
|
import { memo as n, use as r, useCallback as i, useMemo as a, useState as o } from "react";
|
|
4
|
-
import {
|
|
5
|
-
import l from "
|
|
4
|
+
import { produce as s } from "immer";
|
|
5
|
+
import { jsx as c, jsxs as l } from "react/jsx-runtime";
|
|
6
6
|
import u from "@plitzi/plitzi-ui/Button";
|
|
7
|
-
import d from "@plitzi/
|
|
8
|
-
import
|
|
9
|
-
import h from "@plitzi/plitzi-ui/
|
|
10
|
-
import g from "@plitzi/plitzi-ui/
|
|
11
|
-
import
|
|
7
|
+
import d from "@plitzi/plitzi-ui/Modal";
|
|
8
|
+
import f from "@plitzi/sdk-shared/elements/ComponentContext";
|
|
9
|
+
import { get as p, isEmpty as m, set as h } from "@plitzi/plitzi-ui/helpers/lodash";
|
|
10
|
+
import g from "@plitzi/plitzi-ui/hooks/useDisclosure";
|
|
11
|
+
import _ from "@plitzi/plitzi-ui/Input";
|
|
12
12
|
import v from "@plitzi/sdk-shared/builder/contexts/BuilderContext";
|
|
13
13
|
var y = n(({ displayMode: n, flatList: y, selectors: b, selected: x, onSelect: S }) => {
|
|
14
|
-
let C = a(() => Object.values(b ?? {}), [b]), [w, T] = o(""), [E, D] = o([]), { builderHandler: O } = r(v), { components: k } = r(
|
|
14
|
+
let C = a(() => Object.values(b ?? {}), [b]), [w, T] = o(""), [E, D] = o([]), { builderHandler: O } = r(v), { components: k } = r(f), A = a(() => C.filter((e) => !!e.componentType).map((e) => e.componentType), [C]), j = a(() => {
|
|
15
15
|
let e = C;
|
|
16
|
-
return
|
|
16
|
+
return m(w) || (e = C.filter((e) => e.name.toLowerCase().includes(w.toLowerCase()))), e.sort((e, t) => {
|
|
17
17
|
let n = Number(e.type === "element"), r = Number(t.type === "element");
|
|
18
18
|
return n === r ? e.name.localeCompare(t.name) : r - n;
|
|
19
19
|
});
|
|
@@ -33,16 +33,16 @@ var y = n(({ displayMode: n, flatList: y, selectors: b, selected: x, onSelect: S
|
|
|
33
33
|
});
|
|
34
34
|
}
|
|
35
35
|
}
|
|
36
|
-
}, [O, n]), [P, F, I, L] =
|
|
36
|
+
}, [O, n]), [P, F, I, L] = g({
|
|
37
37
|
id: "add-selector",
|
|
38
38
|
onClose: N
|
|
39
39
|
}), R = i((e) => {
|
|
40
40
|
S?.((t) => t?.name === e ? void 0 : C.find((t) => t.name === e));
|
|
41
|
-
}, [S, C]), z = i((e, t) => t ? Object.values(
|
|
41
|
+
}, [S, C]), z = i((e, t) => t ? Object.values(p(e, "definition.styleSelectors", {})).find((e) => (t.includes(":") && (t = p(t.split(":"), "0", t)), e && t && e.split(" ").includes(t))) : [], []), B = i((e, t, r) => {
|
|
42
42
|
if (!t || !r || r.length === 0) return;
|
|
43
|
-
let i = new Set(r), a = y.filter((e) => r.some((t) => z(e, t))).map((e) =>
|
|
43
|
+
let i = new Set(r), a = y.filter((e) => r.some((t) => z(e, t))).map((e) => s(e, (t) => {
|
|
44
44
|
Object.keys(e.definition.styleSelectors).forEach((e) => {
|
|
45
|
-
i.has(
|
|
45
|
+
i.has(p(t, `definition.styleSelectors.${e}`, "")) && h(t, `definition.styleSelectors.${e}`, "");
|
|
46
46
|
});
|
|
47
47
|
}));
|
|
48
48
|
a.length > 0 && O("schemaUpdateElements", a), O("styleRemoveSelectors", n, r), D((e) => e.filter((e) => !i.has(e))), S?.((e) => e && i.has(e.name) ? void 0 : e);
|
|
@@ -52,7 +52,7 @@ var y = n(({ displayMode: n, flatList: y, selectors: b, selected: x, onSelect: S
|
|
|
52
52
|
z,
|
|
53
53
|
y,
|
|
54
54
|
S
|
|
55
|
-
]), [V, H, U, W, , G] =
|
|
55
|
+
]), [V, H, U, W, , G] = g({
|
|
56
56
|
id: "delete-selector",
|
|
57
57
|
onClose: B
|
|
58
58
|
}), K = i((e) => U(void 0, [e]), [U]), q = i((e) => D((t) => t.includes(e) ? t.filter((t) => t !== e) : [...t, e]), []), J = i(() => D([]), []), Y = i(() => U(void 0, E), [U, E]), X = Array.isArray(G) ? G.length : 0, Z = a(() => j.reduce((e, t) => ({
|
|
@@ -63,52 +63,52 @@ var y = n(({ displayMode: n, flatList: y, selectors: b, selected: x, onSelect: S
|
|
|
63
63
|
y,
|
|
64
64
|
z
|
|
65
65
|
]), Q = i(() => void W(void 0, !1), [W]), $ = i(() => void W(void 0, !0), [W]);
|
|
66
|
-
return /* @__PURE__ */
|
|
66
|
+
return /* @__PURE__ */ l("div", {
|
|
67
67
|
className: "flex max-w-[350px] grow basis-0 flex-col gap-2 overflow-auto border-r border-gray-300 pt-2 pr-2 dark:border-zinc-700",
|
|
68
68
|
children: [
|
|
69
|
-
/* @__PURE__ */
|
|
69
|
+
/* @__PURE__ */ l(u, {
|
|
70
70
|
intent: "primary",
|
|
71
71
|
size: "sm",
|
|
72
72
|
className: "w-full",
|
|
73
73
|
iconPlacement: "before",
|
|
74
74
|
onClick: I,
|
|
75
|
-
children: [/* @__PURE__ */
|
|
75
|
+
children: [/* @__PURE__ */ c(u.Icon, {
|
|
76
76
|
icon: "fas fa-tint",
|
|
77
77
|
size: "md",
|
|
78
78
|
className: "text-base"
|
|
79
79
|
}), "New Selector"]
|
|
80
80
|
}),
|
|
81
|
-
/* @__PURE__ */
|
|
81
|
+
/* @__PURE__ */ c(_, {
|
|
82
82
|
placeholder: "Search Selector",
|
|
83
83
|
value: w,
|
|
84
84
|
onChange: M,
|
|
85
85
|
size: "xs"
|
|
86
86
|
}),
|
|
87
|
-
E.length > 0 && /* @__PURE__ */
|
|
87
|
+
E.length > 0 && /* @__PURE__ */ l("div", {
|
|
88
88
|
className: "bg-secondary-50 dark:bg-secondary-900/30 flex items-center justify-between gap-2 rounded-sm px-2 py-1",
|
|
89
|
-
children: [/* @__PURE__ */
|
|
89
|
+
children: [/* @__PURE__ */ l("span", {
|
|
90
90
|
className: "text-xs text-zinc-600 dark:text-zinc-300",
|
|
91
91
|
children: [E.length, " selected"]
|
|
92
|
-
}), /* @__PURE__ */
|
|
92
|
+
}), /* @__PURE__ */ l("div", {
|
|
93
93
|
className: "flex gap-1",
|
|
94
|
-
children: [/* @__PURE__ */
|
|
94
|
+
children: [/* @__PURE__ */ c(u, {
|
|
95
95
|
size: "xs",
|
|
96
96
|
onClick: J,
|
|
97
97
|
children: "Clear"
|
|
98
|
-
}), /* @__PURE__ */
|
|
98
|
+
}), /* @__PURE__ */ l(u, {
|
|
99
99
|
intent: "danger",
|
|
100
100
|
size: "xs",
|
|
101
101
|
iconPlacement: "before",
|
|
102
102
|
onClick: Y,
|
|
103
|
-
children: [/* @__PURE__ */
|
|
103
|
+
children: [/* @__PURE__ */ c(u.Icon, { icon: "fas fa-trash" }), "Delete"]
|
|
104
104
|
})]
|
|
105
105
|
})]
|
|
106
106
|
}),
|
|
107
|
-
/* @__PURE__ */
|
|
107
|
+
/* @__PURE__ */ c("div", {
|
|
108
108
|
className: "flex grow basis-0 flex-col overflow-y-auto",
|
|
109
109
|
children: j.map((t) => {
|
|
110
110
|
let { name: n, type: r } = t;
|
|
111
|
-
return /* @__PURE__ */
|
|
111
|
+
return /* @__PURE__ */ c(e, {
|
|
112
112
|
id: n,
|
|
113
113
|
active: n === x,
|
|
114
114
|
checked: E.includes(n),
|
|
@@ -121,36 +121,36 @@ var y = n(({ displayMode: n, flatList: y, selectors: b, selected: x, onSelect: S
|
|
|
121
121
|
}, n);
|
|
122
122
|
})
|
|
123
123
|
}),
|
|
124
|
-
/* @__PURE__ */
|
|
124
|
+
/* @__PURE__ */ l(d, {
|
|
125
125
|
id: P,
|
|
126
126
|
open: F,
|
|
127
127
|
onClose: L,
|
|
128
128
|
size: "sm",
|
|
129
|
-
children: [/* @__PURE__ */
|
|
129
|
+
children: [/* @__PURE__ */ c(d.Header, { children: /* @__PURE__ */ c("h4", { children: "Add Selector" }) }), /* @__PURE__ */ c(d.Body, { children: /* @__PURE__ */ c(t, {
|
|
130
130
|
componentsNotAvailables: A,
|
|
131
131
|
components: k.current,
|
|
132
132
|
onSubmit: L,
|
|
133
133
|
onClose: L
|
|
134
134
|
}) })]
|
|
135
135
|
}),
|
|
136
|
-
/* @__PURE__ */
|
|
136
|
+
/* @__PURE__ */ l(d, {
|
|
137
137
|
id: V,
|
|
138
138
|
open: H,
|
|
139
139
|
onClose: W,
|
|
140
140
|
children: [
|
|
141
|
-
/* @__PURE__ */
|
|
142
|
-
/* @__PURE__ */
|
|
141
|
+
/* @__PURE__ */ c(d.Header, { children: /* @__PURE__ */ c("h4", { children: "Remove Selector" }) }),
|
|
142
|
+
/* @__PURE__ */ l(d.Body, { children: [X > 1 && /* @__PURE__ */ l("h4", { children: [
|
|
143
143
|
"Do you want to remove these ",
|
|
144
144
|
X,
|
|
145
145
|
" items ?"
|
|
146
|
-
] }), X <= 1 && /* @__PURE__ */
|
|
147
|
-
/* @__PURE__ */
|
|
146
|
+
] }), X <= 1 && /* @__PURE__ */ c("h4", { children: "Do you want to remove this item ?" })] }),
|
|
147
|
+
/* @__PURE__ */ l(d.Footer, {
|
|
148
148
|
justify: "end",
|
|
149
|
-
children: [/* @__PURE__ */
|
|
149
|
+
children: [/* @__PURE__ */ c(u, {
|
|
150
150
|
onClick: Q,
|
|
151
151
|
size: "sm",
|
|
152
152
|
children: "Cancel"
|
|
153
|
-
}), /* @__PURE__ */
|
|
153
|
+
}), /* @__PURE__ */ c(u, {
|
|
154
154
|
onClick: $,
|
|
155
155
|
size: "sm",
|
|
156
156
|
children: "Submit"
|
|
@@ -1,31 +1,31 @@
|
|
|
1
1
|
import e from "./ManagerSelector.mjs";
|
|
2
2
|
import t from "../StyleInspector/index.mjs";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import c from "
|
|
7
|
-
import
|
|
3
|
+
import { use as n, useMemo as r, useState as i } from "react";
|
|
4
|
+
import { useBuilderStore as a } from "@plitzi/sdk-shared/store";
|
|
5
|
+
import { get as o } from "@plitzi/plitzi-ui/helpers";
|
|
6
|
+
import { jsx as s, jsxs as c } from "react/jsx-runtime";
|
|
7
|
+
import l from "@plitzi/sdk-shared/elements/ComponentContext";
|
|
8
8
|
//#region src/components/StyleManager/StyleManager.tsx
|
|
9
9
|
var u = () => {
|
|
10
|
-
let { componentDefinitions: u } =
|
|
10
|
+
let { componentDefinitions: u } = n(l), [d, f] = i(void 0), [[p, m]] = a(["schema.flat", "displayMode"]), [h] = a(`style.platform.${m}`), g = r(() => Object.values(p), [p]), _ = r(() => d?.type === "element" ? Object.keys(o(u.current, `${d.componentType}.definition.styleSelectors`, {})) : ["base"], [u, d]), v = r(() => d?.type === "element" ? Object.keys(o(u.current, `${d.componentType}.defaultStyle.subTypes`, {})) : [], [u, d]), y = r(() => {
|
|
11
11
|
if (d) return d.type === "element" && _.length > 1 ? _.reduce((e, t) => ({
|
|
12
12
|
...e,
|
|
13
13
|
[t]: d.componentType
|
|
14
14
|
}), {}) : { base: d.name };
|
|
15
15
|
}, [d, _]);
|
|
16
|
-
return /* @__PURE__ */
|
|
16
|
+
return /* @__PURE__ */ s("div", {
|
|
17
17
|
className: "flex h-full grow flex-col overflow-auto",
|
|
18
|
-
children: /* @__PURE__ */
|
|
18
|
+
children: /* @__PURE__ */ c("div", {
|
|
19
19
|
className: "flex grow overflow-auto",
|
|
20
|
-
children: [/* @__PURE__ */
|
|
20
|
+
children: [/* @__PURE__ */ s(e, {
|
|
21
21
|
displayMode: m,
|
|
22
22
|
selectors: h,
|
|
23
23
|
flatList: g,
|
|
24
24
|
selected: d?.name,
|
|
25
25
|
onSelect: f
|
|
26
|
-
}), /* @__PURE__ */
|
|
26
|
+
}), /* @__PURE__ */ c("div", {
|
|
27
27
|
className: "flex grow basis-0 flex-col overflow-auto",
|
|
28
|
-
children: [d && /* @__PURE__ */
|
|
28
|
+
children: [d && /* @__PURE__ */ s(t, {
|
|
29
29
|
mode: "manager",
|
|
30
30
|
displayMode: m,
|
|
31
31
|
selectors: h,
|
|
@@ -35,7 +35,7 @@ var u = () => {
|
|
|
35
35
|
allowStyleSelector: d.type === "element",
|
|
36
36
|
componentType: d.componentType,
|
|
37
37
|
value: d.name
|
|
38
|
-
}), !d && /* @__PURE__ */
|
|
38
|
+
}), !d && /* @__PURE__ */ s("div", {
|
|
39
39
|
className: "m-3 rounded-sm border-2 border-dashed border-gray-300 p-3 text-center text-zinc-500 select-none dark:border-zinc-600 dark:text-zinc-400",
|
|
40
40
|
children: "No selector or element selected. Click on one to select it."
|
|
41
41
|
})]
|
|
@@ -1,51 +1,51 @@
|
|
|
1
1
|
import e from "../Selector/SelectorItem/index.mjs";
|
|
2
|
-
import t from "
|
|
3
|
-
import {
|
|
4
|
-
import
|
|
5
|
-
import o from "
|
|
2
|
+
import { memo as t, useCallback as n } from "react";
|
|
3
|
+
import { jsx as r, jsxs as i } from "react/jsx-runtime";
|
|
4
|
+
import a from "@plitzi/plitzi-ui/Button";
|
|
5
|
+
import o from "clsx";
|
|
6
6
|
import s from "@plitzi/plitzi-ui/Checkbox";
|
|
7
|
-
var c =
|
|
8
|
-
let g =
|
|
9
|
-
e.stopPropagation(),
|
|
10
|
-
}, [
|
|
11
|
-
return /* @__PURE__ */
|
|
12
|
-
className:
|
|
7
|
+
var c = t(({ id: t, label: c = "Selector", active: l = !1, checked: u = !1, elementsCount: d = 0, type: f = "class", onSelect: p, onDelete: m, onToggleCheck: h }) => {
|
|
8
|
+
let g = n(() => p?.(t), [t, p]), _ = n((e) => {
|
|
9
|
+
e.stopPropagation(), t && m?.(t);
|
|
10
|
+
}, [t, m]), v = n(() => h?.(t), [t, h]), y = n((e) => e.stopPropagation(), []);
|
|
11
|
+
return /* @__PURE__ */ i("div", {
|
|
12
|
+
className: o("group flex cursor-pointer items-center justify-between gap-2 border-t border-gray-300 p-1 dark:border-zinc-700", {
|
|
13
13
|
"hover:bg-gray-100 dark:hover:bg-zinc-700/60": !l && !u,
|
|
14
14
|
"bg-gray-200 dark:bg-zinc-700": l,
|
|
15
15
|
"bg-secondary-50 dark:bg-secondary-900/30": u && !l
|
|
16
16
|
}),
|
|
17
17
|
onClick: g,
|
|
18
|
-
children: [/* @__PURE__ */
|
|
18
|
+
children: [/* @__PURE__ */ i("div", {
|
|
19
19
|
className: "flex min-w-0 items-center gap-2",
|
|
20
|
-
children: [/* @__PURE__ */
|
|
20
|
+
children: [/* @__PURE__ */ r("div", {
|
|
21
21
|
className: "flex items-center",
|
|
22
|
-
children: /* @__PURE__ */
|
|
22
|
+
children: /* @__PURE__ */ r(s, {
|
|
23
23
|
size: "xs",
|
|
24
24
|
checked: u,
|
|
25
25
|
onChange: v,
|
|
26
26
|
onClick: y
|
|
27
27
|
})
|
|
28
|
-
}), /* @__PURE__ */
|
|
28
|
+
}), /* @__PURE__ */ r(e, {
|
|
29
29
|
editable: !1,
|
|
30
30
|
selector: c,
|
|
31
31
|
type: f,
|
|
32
32
|
active: !0,
|
|
33
33
|
readOnly: !0
|
|
34
34
|
})]
|
|
35
|
-
}), /* @__PURE__ */
|
|
35
|
+
}), /* @__PURE__ */ i("div", {
|
|
36
36
|
className: "flex",
|
|
37
|
-
children: [/* @__PURE__ */
|
|
38
|
-
className:
|
|
37
|
+
children: [/* @__PURE__ */ r("div", {
|
|
38
|
+
className: o("mr-1", {
|
|
39
39
|
flex: l,
|
|
40
40
|
"hidden group-hover:flex": !l
|
|
41
41
|
}),
|
|
42
|
-
children: /* @__PURE__ */
|
|
42
|
+
children: /* @__PURE__ */ r(a, {
|
|
43
43
|
intent: "danger",
|
|
44
44
|
size: "xs",
|
|
45
45
|
onClick: _,
|
|
46
|
-
children: /* @__PURE__ */
|
|
46
|
+
children: /* @__PURE__ */ r(a.Icon, { icon: "fas fa-trash" })
|
|
47
47
|
})
|
|
48
|
-
}), d > 0 && /* @__PURE__ */
|
|
48
|
+
}), d > 0 && /* @__PURE__ */ r("div", {
|
|
49
49
|
className: "bg-secondary-400 flex items-center justify-center rounded-sm px-1.5 py-1 text-xs text-white",
|
|
50
50
|
children: d
|
|
51
51
|
})]
|
|
@@ -96,7 +96,7 @@ var r = (e, t) => {
|
|
|
96
96
|
for (let r of b) {
|
|
97
97
|
let s = e?.definition.parentId === r.id, c = r.id !== e?.id, l = i(r, r.definition.type === o ? o : void 0, n, p, v);
|
|
98
98
|
!g && !c && !m && !h && Object.keys(l).length && (l = l.filter((e) => e.type === "element"));
|
|
99
|
-
for (let e of l) _.includes(e.name)
|
|
99
|
+
for (let e of l) (!_.includes(e.name) || c) && y.tree.push({
|
|
100
100
|
name: e.name,
|
|
101
101
|
displayMode: t,
|
|
102
102
|
attributes: e.attributes,
|
|
@@ -118,7 +118,7 @@ var r = (e, t) => {
|
|
|
118
118
|
let S = {};
|
|
119
119
|
for (let e of y.tree) {
|
|
120
120
|
let r = s(e, p, m, h);
|
|
121
|
-
if (
|
|
121
|
+
if (r && Object.keys(r).length && ((e.isAncestor || e.isDefault && e.componentType !== o) && (r = t(r, n)), Object.keys(r).length)) for (let t of Object.keys(r)) S[t] || (S[t] = []), S[t].push({
|
|
122
122
|
key: e.name,
|
|
123
123
|
value: r[t],
|
|
124
124
|
displayMode: e.displayMode
|
|
@@ -32,7 +32,7 @@ var e = (e, t, n = !1) => n ? t : `${e}:${t};`, t = (e) => {
|
|
|
32
32
|
let c = {
|
|
33
33
|
variables: {},
|
|
34
34
|
value: ""
|
|
35
|
-
}, l = a.
|
|
35
|
+
}, l = a.replace(/\s*;\s*$/, "").match(/[a-z-]+\((?:[^()]+|\([^()]*\))*\)|[^\s]+/gi);
|
|
36
36
|
if (!o && l && l.length > 1) return l.forEach((n) => {
|
|
37
37
|
let r = i(e, t, n, !0, s);
|
|
38
38
|
c.variables = {
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { SpaceFont } from '@plitzi/sdk-shared';
|
|
2
|
+
/**
|
|
3
|
+
* What this space can name: the families it declared, over the system stacks that are always available.
|
|
4
|
+
*
|
|
5
|
+
* Read from the store rather than passed down, because the picker is four components below whoever holds the style
|
|
6
|
+
* document — the prop that was meant to carry them existed for years and no call site ever filled it, so every
|
|
7
|
+
* space was offered the same hard-coded eighteen names whatever it had actually installed.
|
|
8
|
+
*/
|
|
9
|
+
declare const useSpaceFonts: () => SpaceFont[];
|
|
10
|
+
export default useSpaceFonts;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { useMemo as e } from "react";
|
|
2
|
+
import { useCommonStore as t } from "@plitzi/sdk-shared/store";
|
|
3
|
+
import { availableFonts as n } from "@plitzi/sdk-shared/style";
|
|
4
|
+
//#region src/hooks/useSpaceFonts.ts
|
|
5
|
+
var r = [], i = () => {
|
|
6
|
+
let [i = r] = t("style.fonts");
|
|
7
|
+
return e(() => n(i), [i]);
|
|
8
|
+
};
|
|
9
|
+
//#endregion
|
|
10
|
+
export { i as default };
|
package/dist/index.mjs
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import e
|
|
2
|
-
import n from "./
|
|
3
|
-
import
|
|
4
|
-
import o from "./
|
|
5
|
-
import s from "./
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
import f from "./
|
|
10
|
-
import
|
|
11
|
-
import m from "./
|
|
12
|
-
import h,
|
|
13
|
-
import _ from "./
|
|
14
|
-
import v from "./
|
|
15
|
-
import y from "./
|
|
16
|
-
export {
|
|
1
|
+
import e from "./StyleContext.mjs";
|
|
2
|
+
import { generateCache as t, makeSelector as n, selectorToString as r } from "./StyleHelper.mjs";
|
|
3
|
+
import i, { processSelectors as a } from "./helpers/processSelector.mjs";
|
|
4
|
+
import o from "./StyleMap/index.mjs";
|
|
5
|
+
import s, { StyleActions as c } from "./StyleReducer.mjs";
|
|
6
|
+
import l from "./BuilderStyleContextProvider.mjs";
|
|
7
|
+
import u from "./SdkStyleContextProvider.mjs";
|
|
8
|
+
import d from "./StyleAdvanceEditor.mjs";
|
|
9
|
+
import f from "./helpers/calculateInheriting.mjs";
|
|
10
|
+
import p from "./helpers/generateStyleSelector.mjs";
|
|
11
|
+
import m from "./helpers/processCssTokens.mjs";
|
|
12
|
+
import { cssToSelectors as h, getReadOnlyRangesFromContent as g } from "./helpers/formatCssFromSelector.mjs";
|
|
13
|
+
import { helpers_exports as _ } from "./helpers/index.mjs";
|
|
14
|
+
import v from "./components/StyleInspector/index.mjs";
|
|
15
|
+
import { components_exports as y } from "./components/index.mjs";
|
|
16
|
+
export { l as BuilderStyleContextProvider, u as SdkStyleContextProvider, c as StyleActions, d as StyleAdvanceEditor, e as StyleContext, v as StyleInspector, o as StyleMap, s as StyleReducer, f as calculateInheriting, y as components, h as cssToSelectors, t as generateCache, p as generateStyleSelector, g as getReadOnlyRangesFromContent, _ as helpers, n as makeSelector, m as processCssTokens, i as processSelector, a as processSelectors, r as selectorToString };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { useCallback as e, useMemo as t } from "react";
|
|
2
2
|
import { jsx as n, jsxs as r } from "react/jsx-runtime";
|
|
3
3
|
import i from "@plitzi/plitzi-ui/Button";
|
|
4
|
-
import { capitalize as a } from "@plitzi/plitzi-ui/helpers/lodash
|
|
4
|
+
import { capitalize as a } from "@plitzi/plitzi-ui/helpers/lodash";
|
|
5
5
|
import o, { useForm as s, useFormWatch as c } from "@plitzi/plitzi-ui/Form";
|
|
6
6
|
import { z as l } from "zod";
|
|
7
7
|
//#region src/models/SelectorForm/SelectorForm.tsx
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@plitzi/sdk-style",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.34.0",
|
|
4
4
|
"license": "AGPL-3.0",
|
|
5
5
|
"files": [
|
|
6
6
|
"dist"
|
|
@@ -414,6 +414,10 @@
|
|
|
414
414
|
"types": "./dist/components/StyleInspector/categories/Effects/BoxShadow/BoxShadowItem.d.ts",
|
|
415
415
|
"import": "./dist/components/StyleInspector/categories/Effects/BoxShadow/BoxShadowItem.mjs"
|
|
416
416
|
},
|
|
417
|
+
"./components/StyleInspector/categories/Effects/BoxShadow/helpers": {
|
|
418
|
+
"types": "./dist/components/StyleInspector/categories/Effects/BoxShadow/helpers.d.ts",
|
|
419
|
+
"import": "./dist/components/StyleInspector/categories/Effects/BoxShadow/helpers.mjs"
|
|
420
|
+
},
|
|
417
421
|
"./components/StyleInspector/categories/Effects/BoxShadow/index": {
|
|
418
422
|
"types": "./dist/components/StyleInspector/categories/Effects/BoxShadow/index.d.ts",
|
|
419
423
|
"import": "./dist/components/StyleInspector/categories/Effects/BoxShadow/index.mjs"
|
|
@@ -831,6 +835,7 @@
|
|
|
831
835
|
"import": "./dist/helpers/calculateInheriting.mjs"
|
|
832
836
|
},
|
|
833
837
|
"./helpers/formatCssFromSelector": {
|
|
838
|
+
"types": "./dist/helpers/formatCssFromSelector.d.ts",
|
|
834
839
|
"import": "./dist/helpers/formatCssFromSelector.mjs"
|
|
835
840
|
},
|
|
836
841
|
"./helpers/generateStyleSelector": {
|
|
@@ -861,6 +866,18 @@
|
|
|
861
866
|
"types": "./dist/helpers/processSelectorVariables.d.ts",
|
|
862
867
|
"import": "./dist/helpers/processSelectorVariables.mjs"
|
|
863
868
|
},
|
|
869
|
+
"./hooks": {
|
|
870
|
+
"types": "./dist/hooks/index.d.ts",
|
|
871
|
+
"import": "./dist/hooks/index.mjs"
|
|
872
|
+
},
|
|
873
|
+
"./hooks/index": {
|
|
874
|
+
"types": "./dist/hooks/index.d.ts",
|
|
875
|
+
"import": "./dist/hooks/index.mjs"
|
|
876
|
+
},
|
|
877
|
+
"./hooks/useSpaceFonts": {
|
|
878
|
+
"types": "./dist/hooks/useSpaceFonts.d.ts",
|
|
879
|
+
"import": "./dist/hooks/useSpaceFonts.mjs"
|
|
880
|
+
},
|
|
864
881
|
"./index": {
|
|
865
882
|
"types": "./dist/index.d.ts",
|
|
866
883
|
"import": "./dist/index.mjs"
|
|
@@ -891,19 +908,19 @@
|
|
|
891
908
|
"build:prod": "vite build && node ../sdk-shared/scripts/generate-exports.mjs"
|
|
892
909
|
},
|
|
893
910
|
"dependencies": {
|
|
894
|
-
"@plitzi/plitzi-ui": "^1.6.
|
|
895
|
-
"@plitzi/sdk-plugins": "0.
|
|
896
|
-
"@plitzi/sdk-shared": "0.
|
|
897
|
-
"@plitzi/sdk-variables": "0.
|
|
911
|
+
"@plitzi/plitzi-ui": "^1.6.21",
|
|
912
|
+
"@plitzi/sdk-plugins": "0.34.0",
|
|
913
|
+
"@plitzi/sdk-shared": "0.34.0",
|
|
914
|
+
"@plitzi/sdk-variables": "0.34.0",
|
|
898
915
|
"clsx": "^2.1.1",
|
|
899
|
-
"immer": "^11.1.
|
|
916
|
+
"immer": "^11.1.18",
|
|
900
917
|
"prop-types": "^15.8.1",
|
|
901
|
-
"zod": "^4.4
|
|
918
|
+
"zod": "^4.6.4"
|
|
902
919
|
},
|
|
903
920
|
"devDependencies": {
|
|
904
921
|
"eslint": "^9.39.5",
|
|
905
922
|
"typescript": "^6.0.3",
|
|
906
|
-
"vite": "^8.
|
|
907
|
-
"vitest": "^
|
|
923
|
+
"vite": "^8.3.0",
|
|
924
|
+
"vitest": "^5.0.0"
|
|
908
925
|
}
|
|
909
926
|
}
|