@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.
Files changed (58) hide show
  1. package/CHANGELOG.md +26 -0
  2. package/dist/BuilderStyleContextProvider.d.ts +11 -2
  3. package/dist/BuilderStyleContextProvider.mjs +76 -54
  4. package/dist/SdkStyleContextProvider.mjs +4 -4
  5. package/dist/StyleAdvanceEditor.mjs +30 -30
  6. package/dist/StyleMap/StyleMap.d.ts +14 -1
  7. package/dist/StyleMap/StyleMap.mjs +24 -2
  8. package/dist/StyleMap/helpers/isValueValid.mjs +1 -1
  9. package/dist/StyleReducer.d.ts +15 -4
  10. package/dist/StyleReducer.mjs +39 -18
  11. package/dist/components/InputEasing/InputEasing.mjs +21 -21
  12. package/dist/components/InputEasing/InputEasingButton.mjs +5 -5
  13. package/dist/components/InputEasing/InputEasingList.mjs +76 -76
  14. package/dist/components/Selector/Selector.mjs +29 -29
  15. package/dist/components/Selector/SelectorItem/ItemOptions.mjs +16 -16
  16. package/dist/components/Selector/SelectorItem/SelectorItem.mjs +10 -10
  17. package/dist/components/StyleInspector/Inspector.mjs +33 -33
  18. package/dist/components/StyleInspector/StyleInspector.mjs +45 -45
  19. package/dist/components/StyleInspector/StyleInspectorProvider.mjs +14 -14
  20. package/dist/components/StyleInspector/categories/Background/components/BackgroundLayer/BackgroundLayer.mjs +46 -46
  21. package/dist/components/StyleInspector/categories/Background/components/GradientStopBar/GradientStopBar.mjs +20 -20
  22. package/dist/components/StyleInspector/categories/Background/components/GradientStopBar/GradientStopHandle.mjs +11 -11
  23. package/dist/components/StyleInspector/categories/Border/BorderPlacements.mjs +20 -20
  24. package/dist/components/StyleInspector/categories/DisplayFlexChild/DisplayAlignSelf.mjs +12 -12
  25. package/dist/components/StyleInspector/categories/Effects/BoxShadow/BoxShadow.mjs +22 -21
  26. package/dist/components/StyleInspector/categories/Effects/BoxShadow/BoxShadowItem.mjs +66 -65
  27. package/dist/components/StyleInspector/categories/Effects/BoxShadow/helpers.d.ts +2 -0
  28. package/dist/components/StyleInspector/categories/Effects/BoxShadow/helpers.mjs +18 -0
  29. package/dist/components/StyleInspector/categories/Effects/Transition/TransitionItem.mjs +15 -15
  30. package/dist/components/StyleInspector/categories/RawStyle/RawStyle.mjs +16 -16
  31. package/dist/components/StyleInspector/categories/Spacing/SpacingEditor.mjs +12 -12
  32. package/dist/components/StyleInspector/categories/Spacing/SpacingNumber.mjs +5 -5
  33. package/dist/components/StyleInspector/categories/Typography/Typography.d.ts +1 -5
  34. package/dist/components/StyleInspector/categories/Typography/Typography.mjs +58 -57
  35. package/dist/components/StyleInspector/categories/Typography/TypographyConstants.d.ts +0 -4
  36. package/dist/components/StyleInspector/categories/Typography/TypographyConstants.mjs +2 -160
  37. package/dist/components/StyleInspector/categories/Typography/TypographyFont.d.ts +1 -4
  38. package/dist/components/StyleInspector/categories/Typography/TypographyFont.mjs +24 -17
  39. package/dist/components/StyleInspector/components/CategoryContainer/CategoryContainer.mjs +15 -15
  40. package/dist/components/StyleInspector/components/CategoryOption/categoryTypes/OptionIconGroup.mjs +17 -17
  41. package/dist/components/StyleInspector/components/CategoryOption/categoryTypes/OptionMetricInput.mjs +8 -8
  42. package/dist/components/StyleInspector/components/CategoryOption/categoryTypes/OptionSelect.mjs +4 -4
  43. package/dist/components/StyleInspector/components/InspectorLabel/InspectorLabel.mjs +13 -13
  44. package/dist/components/StyleInspector/hooks/useInspectorValues.mjs +13 -13
  45. package/dist/components/StyleInspector/hooks/useStyleBinding.mjs +12 -12
  46. package/dist/components/StyleInspector/hooks/useStyleInherit.mjs +3 -3
  47. package/dist/components/StyleManager/ManagerSelector.mjs +35 -35
  48. package/dist/components/StyleManager/StyleManager.mjs +12 -12
  49. package/dist/components/StyleManager/StyleSelectorTag.mjs +20 -20
  50. package/dist/helpers/calculateInheriting.mjs +2 -2
  51. package/dist/helpers/generateStyleSelector.mjs +1 -1
  52. package/dist/helpers/processSelectorAttributes.mjs +1 -1
  53. package/dist/hooks/index.d.ts +2 -0
  54. package/dist/hooks/index.mjs +2 -0
  55. package/dist/hooks/useSpaceFonts.d.ts +10 -0
  56. package/dist/hooks/useSpaceFonts.mjs +10 -0
  57. package/dist/index.mjs +16 -16
  58. package/package.json +26 -9
@@ -1,37 +1,37 @@
1
1
  import e from "../StyleInspectorContext.mjs";
2
- import { get as t, pick as n } from "@plitzi/plitzi-ui/helpers";
3
- import { use as r, useMemo as i } from "react";
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: _} = r(e);
10
- let v = _(), y = i(() => !!s && !u && Object.keys(m).filter((e) => s.includes(e) || s.length === 0).length > 0, [
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 = i(() => !!s && !u && Object.keys(h).filter((e) => s.includes(e) || s.length === 0).length > 0, [
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 = i(() => !!s && !u && Object.keys(n(v, s)).filter((e) => typeof v[e] == "string" && o.test(v[e])).length > 0, [
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 = i(() => s ? s.length > 0 ? !u && Object.keys(n(v, s)).length > 0 : !u && Object.keys(v).length > 0 : !1, [
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 = i(() => {
26
+ ]), C = n(() => {
27
27
  let e = {};
28
28
  if (!s) return e;
29
- let n = new RegExp(o, "g");
30
- return s.forEach((r) => {
29
+ let t = new RegExp(o, "g");
30
+ return s.forEach((n) => {
31
31
  let i;
32
- i = f ? t(v, r, t(d ?? {}, r)) : t(v, r, t(h, r, t(m, `${r}.0.value`, t(d ?? {}, r, a[r])))), p && typeof i == "string" && o.test(i) && [...i.matchAll(n)].forEach((e) => {
33
- i = i.replace(e[0], t(g, e[1] ? e[1] : e[2], e[0]));
34
- }), e[r] = i;
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 { get as e, set as t } from "@plitzi/plitzi-ui/helpers";
2
- import { useMemo as n } from "react";
3
- import { emptyObject as r } from "@plitzi/sdk-shared/helpers/utils";
4
- import { useCommonStore as i } from "@plitzi/sdk-shared/store";
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 = r] = i("runtime.sources");
8
- return n(() => {
9
- let n = {};
10
- if (!a) return n;
11
- let { definition: { bindings: r } } = a;
12
- return r?.style && r.style.forEach((r) => {
13
- e(o, r.source) === void 0 || !r.enabled || t(n, r.to, e(o, r.source));
14
- }), n;
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/elements/ComponentContext";
4
- import { useBuilderStore as i } from "@plitzi/sdk-shared/store";
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]] = i(["schema.flat", "style.platform"]), { componentDefinitions: m } = t(r);
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 { jsx as s, jsxs as c } from "react/jsx-runtime";
5
- import l from "@plitzi/plitzi-ui/Modal";
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/sdk-shared/elements/ComponentContext";
8
- import { get as f, isEmpty as p, set as m } from "@plitzi/plitzi-ui/helpers/lodash";
9
- import h from "@plitzi/plitzi-ui/hooks/useDisclosure";
10
- import g from "@plitzi/plitzi-ui/Input";
11
- import { produce as _ } from "immer";
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(d), A = a(() => C.filter((e) => !!e.componentType).map((e) => e.componentType), [C]), j = a(() => {
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 p(w) || (e = C.filter((e) => e.name.toLowerCase().includes(w.toLowerCase()))), e.sort((e, t) => {
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] = h({
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(f(e, "definition.styleSelectors", {})).find((e) => (t.includes(":") && (t = f(t.split(":"), "0", t)), e && t && e.split(" ").includes(t))) : [], []), B = i((e, t, r) => {
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) => _(e, (t) => {
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(f(t, `definition.styleSelectors.${e}`, "")) && m(t, `definition.styleSelectors.${e}`, "");
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] = h({
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__ */ c("div", {
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__ */ c(u, {
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__ */ s(u.Icon, {
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__ */ s(g, {
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__ */ c("div", {
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__ */ c("span", {
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__ */ c("div", {
92
+ }), /* @__PURE__ */ l("div", {
93
93
  className: "flex gap-1",
94
- children: [/* @__PURE__ */ s(u, {
94
+ children: [/* @__PURE__ */ c(u, {
95
95
  size: "xs",
96
96
  onClick: J,
97
97
  children: "Clear"
98
- }), /* @__PURE__ */ c(u, {
98
+ }), /* @__PURE__ */ l(u, {
99
99
  intent: "danger",
100
100
  size: "xs",
101
101
  iconPlacement: "before",
102
102
  onClick: Y,
103
- children: [/* @__PURE__ */ s(u.Icon, { icon: "fas fa-trash" }), "Delete"]
103
+ children: [/* @__PURE__ */ c(u.Icon, { icon: "fas fa-trash" }), "Delete"]
104
104
  })]
105
105
  })]
106
106
  }),
107
- /* @__PURE__ */ s("div", {
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__ */ s(e, {
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__ */ c(l, {
124
+ /* @__PURE__ */ l(d, {
125
125
  id: P,
126
126
  open: F,
127
127
  onClose: L,
128
128
  size: "sm",
129
- children: [/* @__PURE__ */ s(l.Header, { children: /* @__PURE__ */ s("h4", { children: "Add Selector" }) }), /* @__PURE__ */ s(l.Body, { children: /* @__PURE__ */ s(t, {
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__ */ c(l, {
136
+ /* @__PURE__ */ l(d, {
137
137
  id: V,
138
138
  open: H,
139
139
  onClose: W,
140
140
  children: [
141
- /* @__PURE__ */ s(l.Header, { children: /* @__PURE__ */ s("h4", { children: "Remove Selector" }) }),
142
- /* @__PURE__ */ c(l.Body, { children: [X > 1 && /* @__PURE__ */ c("h4", { children: [
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__ */ s("h4", { children: "Do you want to remove this item ?" })] }),
147
- /* @__PURE__ */ c(l.Footer, {
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__ */ s(u, {
149
+ children: [/* @__PURE__ */ c(u, {
150
150
  onClick: Q,
151
151
  size: "sm",
152
152
  children: "Cancel"
153
- }), /* @__PURE__ */ s(u, {
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 { get as n } from "@plitzi/plitzi-ui/helpers";
4
- import { use as r, useMemo as i, useState as a } from "react";
5
- import { jsx as o, jsxs as s } from "react/jsx-runtime";
6
- import c from "@plitzi/sdk-shared/elements/ComponentContext";
7
- import { useBuilderStore as l } from "@plitzi/sdk-shared/store";
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 } = r(c), [d, f] = a(void 0), [[p, m]] = l(["schema.flat", "displayMode"]), [h] = l(`style.platform.${m}`), g = i(() => Object.values(p), [p]), _ = i(() => d?.type === "element" ? Object.keys(n(u.current, `${d.componentType}.definition.styleSelectors`, {})) : ["base"], [u, d]), v = i(() => d?.type === "element" ? Object.keys(n(u.current, `${d.componentType}.defaultStyle.subTypes`, {})) : [], [u, d]), y = i(() => {
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__ */ o("div", {
16
+ return /* @__PURE__ */ s("div", {
17
17
  className: "flex h-full grow flex-col overflow-auto",
18
- children: /* @__PURE__ */ s("div", {
18
+ children: /* @__PURE__ */ c("div", {
19
19
  className: "flex grow overflow-auto",
20
- children: [/* @__PURE__ */ o(e, {
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__ */ s("div", {
26
+ }), /* @__PURE__ */ c("div", {
27
27
  className: "flex grow basis-0 flex-col overflow-auto",
28
- children: [d && /* @__PURE__ */ o(t, {
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__ */ o("div", {
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 "clsx";
3
- import { memo as n, useCallback as r } from "react";
4
- import { jsx as i, jsxs as a } from "react/jsx-runtime";
5
- import o from "@plitzi/plitzi-ui/Button";
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 = n(({ id: n, label: c = "Selector", active: l = !1, checked: u = !1, elementsCount: d = 0, type: f = "class", onSelect: p, onDelete: m, onToggleCheck: h }) => {
8
- let g = r(() => p?.(n), [n, p]), _ = r((e) => {
9
- e.stopPropagation(), n && m?.(n);
10
- }, [n, m]), v = r(() => h?.(n), [n, h]), y = r((e) => e.stopPropagation(), []);
11
- return /* @__PURE__ */ a("div", {
12
- className: t("group flex cursor-pointer items-center justify-between gap-2 border-t border-gray-300 p-1 dark:border-zinc-700", {
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__ */ a("div", {
18
+ children: [/* @__PURE__ */ i("div", {
19
19
  className: "flex min-w-0 items-center gap-2",
20
- children: [/* @__PURE__ */ i("div", {
20
+ children: [/* @__PURE__ */ r("div", {
21
21
  className: "flex items-center",
22
- children: /* @__PURE__ */ i(s, {
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__ */ i(e, {
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__ */ a("div", {
35
+ }), /* @__PURE__ */ i("div", {
36
36
  className: "flex",
37
- children: [/* @__PURE__ */ i("div", {
38
- className: t("mr-1", {
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__ */ i(o, {
42
+ children: /* @__PURE__ */ r(a, {
43
43
  intent: "danger",
44
44
  size: "xs",
45
45
  onClick: _,
46
- children: /* @__PURE__ */ i(o.Icon, { icon: "fas fa-trash" })
46
+ children: /* @__PURE__ */ r(a.Icon, { icon: "fas fa-trash" })
47
47
  })
48
- }), d > 0 && /* @__PURE__ */ i("div", {
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) && !c || y.tree.push({
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 (!(!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({
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
@@ -1,7 +1,7 @@
1
1
  import e from "./processSelector.mjs";
2
2
  //#region src/helpers/generateStyleSelector.ts
3
3
  var t = (t = "", n = "class", r = {}, i) => {
4
- if (!(!t || typeof r != "object")) return {
4
+ if (t && typeof r == "object") return {
5
5
  name: t,
6
6
  type: n,
7
7
  attributes: r,
@@ -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.replaceAll(";", "").match(/[a-z-]+\((?:[^()]+|\([^()]*\))*\)|[^\s]+/gi);
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,2 @@
1
+ import { default as useSpaceFonts } from './useSpaceFonts';
2
+ export { useSpaceFonts };
@@ -0,0 +1,2 @@
1
+ import e from "./useSpaceFonts.mjs";
2
+ export { e as useSpaceFonts };
@@ -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, { processSelectors as t } from "./helpers/processSelector.mjs";
2
- import n from "./StyleMap/index.mjs";
3
- import { generateCache as r, makeSelector as i, selectorToString as a } from "./StyleHelper.mjs";
4
- import o from "./helpers/calculateInheriting.mjs";
5
- import s from "./helpers/generateStyleSelector.mjs";
6
- import c from "./helpers/processCssTokens.mjs";
7
- import { cssToSelectors as l, getReadOnlyRangesFromContent as u } from "./helpers/formatCssFromSelector.mjs";
8
- import { helpers_exports as d } from "./helpers/index.mjs";
9
- import f from "./components/StyleInspector/index.mjs";
10
- import { components_exports as p } from "./components/index.mjs";
11
- import m from "./StyleContext.mjs";
12
- import h, { StyleActions as g } from "./StyleReducer.mjs";
13
- import _ from "./BuilderStyleContextProvider.mjs";
14
- import v from "./SdkStyleContextProvider.mjs";
15
- import y from "./StyleAdvanceEditor.mjs";
16
- export { _ as BuilderStyleContextProvider, v as SdkStyleContextProvider, g as StyleActions, y as StyleAdvanceEditor, m as StyleContext, f as StyleInspector, n as StyleMap, h as StyleReducer, o as calculateInheriting, p as components, l as cssToSelectors, r as generateCache, s as generateStyleSelector, u as getReadOnlyRangesFromContent, d as helpers, i as makeSelector, c as processCssTokens, e as processSelector, t as processSelectors, a as selectorToString };
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 };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@plitzi/sdk-style",
3
- "version": "0.33.2",
3
+ "version": "0.34.1",
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.20",
895
- "@plitzi/sdk-plugins": "0.33.2",
896
- "@plitzi/sdk-shared": "0.33.2",
897
- "@plitzi/sdk-variables": "0.33.2",
911
+ "@plitzi/plitzi-ui": "^1.6.21",
912
+ "@plitzi/sdk-plugins": "0.34.1",
913
+ "@plitzi/sdk-shared": "0.34.1",
914
+ "@plitzi/sdk-variables": "0.34.1",
898
915
  "clsx": "^2.1.1",
899
- "immer": "^11.1.16",
916
+ "immer": "^11.1.18",
900
917
  "prop-types": "^15.8.1",
901
- "zod": "^4.4.3"
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.2.1",
907
- "vitest": "^4.1.10"
923
+ "vite": "^8.3.0",
924
+ "vitest": "^5.0.0"
908
925
  }
909
926
  }