@plitzi/sdk-style 0.38.10 → 0.38.11

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 (149) hide show
  1. package/CHANGELOG.md +180 -0
  2. package/dist/components/InputEasing/InputEasingButton.mjs +1 -1
  3. package/dist/components/InputEasing/InputEasingList.mjs +5 -5
  4. package/dist/components/Selector/Selector.mjs +2 -1
  5. package/dist/components/Selector/SelectorItem/ItemOptions.mjs +45 -41
  6. package/dist/components/Selector/SelectorItem/SelectorItem.mjs +4 -4
  7. package/dist/components/Selector/SelectorItem/helpers.d.ts +2 -0
  8. package/dist/components/Selector/SelectorItem/helpers.mjs +4 -0
  9. package/dist/components/StyleInspector/Inspector.mjs +185 -171
  10. package/dist/components/StyleInspector/InspectorSearchContext.d.ts +3 -0
  11. package/dist/components/StyleInspector/InspectorSearchContext.mjs +6 -0
  12. package/dist/components/StyleInspector/StyleInspector.mjs +154 -128
  13. package/dist/components/StyleInspector/categories/Background/Background.mjs +82 -114
  14. package/dist/components/StyleInspector/categories/Background/components/BackgroundAttachment/BackgroundAttachment.d.ts +8 -0
  15. package/dist/components/StyleInspector/categories/Background/components/BackgroundAttachment/BackgroundAttachment.mjs +53 -0
  16. package/dist/components/StyleInspector/categories/Background/components/BackgroundAttachment/index.d.ts +3 -0
  17. package/dist/components/StyleInspector/categories/Background/components/BackgroundAttachment/index.mjs +5 -0
  18. package/dist/components/StyleInspector/categories/Background/components/BackgroundLayer/BackgroundLayer.mjs +159 -153
  19. package/dist/components/StyleInspector/categories/Background/components/BackgroundLayer/helpers.d.ts +11 -0
  20. package/dist/components/StyleInspector/categories/Background/components/BackgroundLayer/helpers.mjs +45 -0
  21. package/dist/components/StyleInspector/categories/Background/components/BackgroundPosition/BackgroundPosition.mjs +26 -23
  22. package/dist/components/StyleInspector/categories/Background/components/BackgroundSize/BackgroundSize.mjs +65 -56
  23. package/dist/components/StyleInspector/categories/Background/components/BackgroundSize/helpers.d.ts +4 -0
  24. package/dist/components/StyleInspector/categories/Background/components/BackgroundSize/helpers.mjs +8 -0
  25. package/dist/components/StyleInspector/categories/Background/components/BackgroundTile/BackgroundTile.mjs +28 -27
  26. package/dist/components/StyleInspector/categories/Background/components/GradientStopBar/GradientPreviewBar.d.ts +4 -2
  27. package/dist/components/StyleInspector/categories/Background/components/GradientStopBar/GradientPreviewBar.mjs +19 -18
  28. package/dist/components/StyleInspector/categories/Background/components/GradientStopBar/GradientStopBar.d.ts +4 -0
  29. package/dist/components/StyleInspector/categories/Background/components/GradientStopBar/GradientStopBar.mjs +48 -80
  30. package/dist/components/StyleInspector/categories/Background/components/GradientStopBar/GradientStopEditor.d.ts +5 -3
  31. package/dist/components/StyleInspector/categories/Background/components/GradientStopBar/GradientStopEditor.mjs +51 -41
  32. package/dist/components/StyleInspector/categories/Background/components/GradientStopBar/GradientStopHandle.d.ts +5 -1
  33. package/dist/components/StyleInspector/categories/Background/components/GradientStopBar/GradientStopHandle.mjs +54 -32
  34. package/dist/components/StyleInspector/categories/Background/components/GradientStopBar/GradientStopTrack.d.ts +3 -1
  35. package/dist/components/StyleInspector/categories/Background/components/GradientStopBar/GradientStopTrack.mjs +14 -13
  36. package/dist/components/StyleInspector/categories/Background/components/GradientStopBar/helpers.d.ts +8 -0
  37. package/dist/components/StyleInspector/categories/Background/components/GradientStopBar/helpers.mjs +8 -0
  38. package/dist/components/StyleInspector/categories/Background/components/LayerGroup/LayerGroup.d.ts +8 -0
  39. package/dist/components/StyleInspector/categories/Background/components/LayerGroup/LayerGroup.mjs +11 -0
  40. package/dist/components/StyleInspector/categories/Background/components/LayerGroup/index.d.ts +3 -0
  41. package/dist/components/StyleInspector/categories/Background/components/LayerGroup/index.mjs +5 -0
  42. package/dist/components/StyleInspector/categories/Background/helpers/backgroundParser.d.ts +21 -7
  43. package/dist/components/StyleInspector/categories/Background/helpers/backgroundParser.mjs +114 -113
  44. package/dist/components/StyleInspector/categories/Background/helpers/layerValues.d.ts +8 -0
  45. package/dist/components/StyleInspector/categories/Background/helpers/layerValues.mjs +11 -0
  46. package/dist/components/StyleInspector/categories/Background/modes/ConicGradientMode.mjs +52 -87
  47. package/dist/components/StyleInspector/categories/Background/modes/ImageMode.mjs +16 -77
  48. package/dist/components/StyleInspector/categories/Background/modes/LinearGradientMode.mjs +19 -62
  49. package/dist/components/StyleInspector/categories/Background/modes/RadialGradientMode.mjs +79 -97
  50. package/dist/components/StyleInspector/categories/Background/modes/RawMode.d.ts +8 -0
  51. package/dist/components/StyleInspector/categories/Background/modes/RawMode.mjs +22 -0
  52. package/dist/components/StyleInspector/categories/Background/modes/helpers.d.ts +19 -0
  53. package/dist/components/StyleInspector/categories/Background/modes/helpers.mjs +54 -0
  54. package/dist/components/StyleInspector/categories/Border/Border.mjs +26 -43
  55. package/dist/components/StyleInspector/categories/Border/BorderPlacements.mjs +60 -51
  56. package/dist/components/StyleInspector/categories/Display/Display.mjs +32 -49
  57. package/dist/components/StyleInspector/categories/DisplayFlexChild/DisplayFlexChild.mjs +33 -38
  58. package/dist/components/StyleInspector/categories/Effects/BoxShadow/BoxShadow.mjs +21 -33
  59. package/dist/components/StyleInspector/categories/Effects/Effects.mjs +131 -154
  60. package/dist/components/StyleInspector/categories/Effects/Filters/Filter.mjs +23 -31
  61. package/dist/components/StyleInspector/categories/Effects/Filters/FilterItem.d.ts +9 -5
  62. package/dist/components/StyleInspector/categories/Effects/Filters/FilterItem.mjs +57 -124
  63. package/dist/components/StyleInspector/categories/Effects/Filters/helpers.d.ts +25 -0
  64. package/dist/components/StyleInspector/categories/Effects/Filters/helpers.mjs +87 -0
  65. package/dist/components/StyleInspector/categories/Effects/Transform/Transform.mjs +18 -28
  66. package/dist/components/StyleInspector/categories/Effects/Transform/TransformItem.d.ts +1 -2
  67. package/dist/components/StyleInspector/categories/Effects/Transform/TransformItem.mjs +52 -76
  68. package/dist/components/StyleInspector/categories/Effects/Transform/transformFunctions.d.ts +5 -0
  69. package/dist/components/StyleInspector/categories/Effects/Transform/transformFunctions.mjs +8 -2
  70. package/dist/components/StyleInspector/categories/Effects/Transition/Transition.mjs +21 -37
  71. package/dist/components/StyleInspector/categories/Effects/Transition/TransitionEasing.d.ts +10 -0
  72. package/dist/components/StyleInspector/categories/Effects/Transition/TransitionEasing.mjs +92 -0
  73. package/dist/components/StyleInspector/categories/Effects/Transition/TransitionItem.d.ts +4 -4
  74. package/dist/components/StyleInspector/categories/Effects/Transition/TransitionItem.mjs +78 -359
  75. package/dist/components/StyleInspector/categories/Effects/Transition/helpers.d.ts +39 -0
  76. package/dist/components/StyleInspector/categories/Effects/Transition/helpers.mjs +268 -0
  77. package/dist/components/StyleInspector/categories/List/List.mjs +39 -38
  78. package/dist/components/StyleInspector/categories/ListItem/ListItem.mjs +29 -29
  79. package/dist/components/StyleInspector/categories/Others/Others.mjs +66 -88
  80. package/dist/components/StyleInspector/categories/Position/Position.mjs +67 -75
  81. package/dist/components/StyleInspector/categories/RawStyle/RawStyle.mjs +19 -18
  82. package/dist/components/StyleInspector/categories/Size/Size.mjs +68 -88
  83. package/dist/components/StyleInspector/categories/Spacing/Spacing.mjs +18 -27
  84. package/dist/components/StyleInspector/categories/Spacing/SpacingMargin.mjs +2 -2
  85. package/dist/components/StyleInspector/categories/Spacing/SpacingPadding.mjs +4 -3
  86. package/dist/components/StyleInspector/categories/Typography/Typography.mjs +88 -98
  87. package/dist/components/StyleInspector/categories/Typography/TypographyFont.mjs +1 -1
  88. package/dist/components/StyleInspector/categories/Typography/TypographyStyle.mjs +1 -1
  89. package/dist/components/StyleInspector/categories/Typography/TypographyTextShadow.mjs +26 -39
  90. package/dist/components/StyleInspector/categories/Variables/Variables.mjs +38 -37
  91. package/dist/components/StyleInspector/categoryKeys.d.ts +45 -0
  92. package/dist/components/StyleInspector/categoryKeys.mjs +220 -0
  93. package/dist/components/StyleInspector/components/CategoryContainer/CategoryContainer.mjs +43 -38
  94. package/dist/components/StyleInspector/components/CategoryOption/categoryTypes/OptionIconGroup.mjs +2 -1
  95. package/dist/components/StyleInspector/components/CategorySection/CategorySection.mjs +30 -15
  96. package/dist/components/StyleInspector/components/ColorSwatch/ColorSwatch.d.ts +8 -0
  97. package/dist/components/StyleInspector/components/ColorSwatch/ColorSwatch.mjs +23 -0
  98. package/dist/components/StyleInspector/components/ColorSwatch/helpers.d.ts +3 -0
  99. package/dist/components/StyleInspector/components/ColorSwatch/helpers.mjs +9 -0
  100. package/dist/components/StyleInspector/components/ColorSwatch/index.d.ts +3 -0
  101. package/dist/components/StyleInspector/components/ColorSwatch/index.mjs +5 -0
  102. package/dist/components/StyleInspector/components/InspectorDots/InspectorDots.d.ts +1 -0
  103. package/dist/components/StyleInspector/components/InspectorDots/InspectorDots.mjs +11 -11
  104. package/dist/components/StyleInspector/components/InspectorFooter/InspectorFooter.d.ts +11 -0
  105. package/dist/components/StyleInspector/components/InspectorFooter/InspectorFooter.mjs +38 -0
  106. package/dist/components/StyleInspector/components/InspectorFooter/helpers.d.ts +2 -0
  107. package/dist/components/StyleInspector/components/InspectorFooter/helpers.mjs +11 -0
  108. package/dist/components/StyleInspector/components/InspectorFooter/index.d.ts +3 -0
  109. package/dist/components/StyleInspector/components/InspectorFooter/index.mjs +5 -0
  110. package/dist/components/StyleInspector/components/InspectorLabel/InspectorLabel.mjs +34 -31
  111. package/dist/components/StyleInspector/components/InspectorLabel/helpers.d.ts +17 -0
  112. package/dist/components/StyleInspector/components/InspectorLabel/helpers.mjs +16 -0
  113. package/dist/components/StyleInspector/components/InspectorSearch/InspectorSearch.d.ts +7 -0
  114. package/dist/components/StyleInspector/components/InspectorSearch/InspectorSearch.mjs +24 -0
  115. package/dist/components/StyleInspector/components/InspectorSearch/index.d.ts +3 -0
  116. package/dist/components/StyleInspector/components/InspectorSearch/index.mjs +5 -0
  117. package/dist/components/StyleInspector/components/ShadowItem/ShadowItem.d.ts +9 -0
  118. package/dist/components/StyleInspector/components/ShadowItem/ShadowItem.mjs +110 -0
  119. package/dist/components/StyleInspector/components/ShadowItem/index.d.ts +3 -0
  120. package/dist/components/StyleInspector/components/ShadowItem/index.mjs +5 -0
  121. package/dist/components/StyleInspector/components/TargetSummary/TargetSummary.d.ts +7 -0
  122. package/dist/components/StyleInspector/components/TargetSummary/TargetSummary.mjs +24 -0
  123. package/dist/components/StyleInspector/components/TargetSummary/index.d.ts +3 -0
  124. package/dist/components/StyleInspector/components/TargetSummary/index.mjs +5 -0
  125. package/dist/components/StyleInspector/components/ValueList/ValueList.d.ts +12 -0
  126. package/dist/components/StyleInspector/components/ValueList/ValueList.mjs +25 -0
  127. package/dist/components/StyleInspector/components/ValueList/index.d.ts +3 -0
  128. package/dist/components/StyleInspector/components/ValueList/index.mjs +5 -0
  129. package/dist/components/StyleInspector/components/ValueListItem/ValueListItem.d.ts +16 -0
  130. package/dist/components/StyleInspector/components/ValueListItem/ValueListItem.mjs +71 -0
  131. package/dist/components/StyleInspector/components/ValueListItem/index.d.ts +3 -0
  132. package/dist/components/StyleInspector/components/ValueListItem/index.mjs +5 -0
  133. package/dist/components/StyleInspector/cssValues.d.ts +15 -0
  134. package/dist/components/StyleInspector/cssValues.mjs +27 -0
  135. package/dist/components/StyleInspector/helpers.d.ts +17 -1
  136. package/dist/components/StyleInspector/helpers.mjs +9 -2
  137. package/dist/components/StyleInspector/hooks/useInspectorValues.mjs +42 -45
  138. package/dist/components/StyleInspector/search.d.ts +11 -0
  139. package/dist/components/StyleInspector/search.mjs +14 -0
  140. package/dist/components/StyleInspector/shadowValue.d.ts +20 -0
  141. package/dist/components/StyleInspector/shadowValue.mjs +36 -0
  142. package/dist/components/StyleManager/StyleSelectorTag.mjs +1 -1
  143. package/package.json +185 -17
  144. package/dist/components/StyleInspector/categories/Effects/BoxShadow/BoxShadowItem.d.ts +0 -8
  145. package/dist/components/StyleInspector/categories/Effects/BoxShadow/BoxShadowItem.mjs +0 -132
  146. package/dist/components/StyleInspector/categories/Effects/BoxShadow/helpers.d.ts +0 -2
  147. package/dist/components/StyleInspector/categories/Effects/BoxShadow/helpers.mjs +0 -18
  148. package/dist/components/StyleInspector/categories/Typography/TypographyTextShadowItem.d.ts +0 -8
  149. package/dist/components/StyleInspector/categories/Typography/TypographyTextShadowItem.mjs +0 -83
@@ -1,130 +1,63 @@
1
- import e from "../../../components/CategoryOption/index.mjs";
2
- import t from "../../../components/CategorySection/index.mjs";
3
- import { useCallback as n, useMemo as r, useRef as i } from "react";
4
- import { jsx as a, jsxs as o } from "react/jsx-runtime";
5
- import s from "@plitzi/plitzi-ui/ContainerFloating";
6
- import c from "@plitzi/plitzi-ui/Icon";
1
+ import { asText as e } from "../../../cssValues.mjs";
2
+ import t from "../../../components/CategoryOption/index.mjs";
3
+ import n from "../../../components/ValueListItem/index.mjs";
4
+ import { FILTER_GROUPS as r, FILTER_SPECS as i, parseFilter as a, serializeFilter as o } from "./helpers.mjs";
5
+ import { useCallback as s, useRef as c } from "react";
6
+ import { Fragment as l, jsx as u, jsxs as d } from "react/jsx-runtime";
7
7
  //#region src/components/StyleInspector/categories/Effects/Filters/FilterItem.tsx
8
- var l = ({ value: l = "blur(5px)", onRemove: u, onChange: d }) => {
9
- let f = l.match(/[a-z-]+|[0-9.-]+(px|%|deg|)/gim), { propType: p = "blur", amount: m = "5px" } = {};
10
- f?.length === 2 && ([p, m] = f);
11
- let h = i({
12
- propType: p,
13
- amount: m
14
- });
15
- h.current = {
16
- propType: p,
17
- amount: m
18
- };
19
- let g = n((e) => (t) => {
20
- let n = { ...h.current };
21
- n[e] = t;
22
- let { propType: r } = n, { amount: i } = n;
23
- e === "propType" && h.current.amount !== t && (i = t === "blur" ? "5px" : t === "hue-rotate" ? "0deg" : "0.5"), d?.(`${r}(${i})`);
24
- }, [d]), _ = r(() => p === "hue-rotate" ? { units: [{
25
- label: "DEG",
26
- value: "deg"
27
- }] } : p === "blur" ? { units: [{
28
- label: "PX",
29
- value: "px"
30
- }] } : {
31
- units: void 0,
32
- max: 1,
33
- step: .1
34
- }, [p]);
35
- return /* @__PURE__ */ o(s, {
36
- className: "w-full",
37
- closeOnClick: !1,
38
- containerTopOffset: 5,
39
- children: [/* @__PURE__ */ o(s.Trigger, {
40
- className: "flex w-full cursor-pointer items-center justify-between rounded-sm border border-gray-300 bg-white px-2 py-0.5 select-none hover:bg-gray-100 dark:border-zinc-600 dark:bg-zinc-800 dark:hover:bg-zinc-700/60",
41
- children: [/* @__PURE__ */ a("div", {
42
- className: "flex items-center",
43
- children: /* @__PURE__ */ a("div", {
44
- className: "flex",
45
- children: l
46
- })
47
- }), /* @__PURE__ */ a("div", {
48
- className: "flex",
49
- children: /* @__PURE__ */ a(c, {
50
- size: "xs",
51
- icon: "fas fa-trash-alt",
52
- onClick: u,
53
- intent: "danger",
54
- title: "Remove"
55
- })
8
+ var f = Object.entries(i), p = ({ value: p, title: m, onRemove: h, onChange: g }) => {
9
+ let _ = a(p), v = c(_);
10
+ v.current = _;
11
+ let y = _ ? i[_.name] : void 0, b = s((t) => {
12
+ let n = e(t);
13
+ Object.hasOwn(i, n) && g(o({
14
+ name: n,
15
+ amount: i[n].default
16
+ }));
17
+ }, [g]), x = s((t) => {
18
+ v.current && g(o({
19
+ ...v.current,
20
+ amount: e(t)
21
+ }));
22
+ }, [g]), S = s((t) => g(e(t)), [g]);
23
+ return /* @__PURE__ */ d(n, {
24
+ summary: p,
25
+ title: m,
26
+ removeLabel: `Remove ${m.toLowerCase()}`,
27
+ onRemove: h,
28
+ children: [!_ && /* @__PURE__ */ d(l, { children: [/* @__PURE__ */ u(t, {
29
+ label: "Value",
30
+ type: "input",
31
+ value: p,
32
+ onChange: S
33
+ }), /* @__PURE__ */ u("p", {
34
+ className: "m-0 text-[11px] text-zinc-500 dark:text-zinc-400",
35
+ children: "A function the editor has no control for, so it is edited as written."
36
+ })] }), _ && y && /* @__PURE__ */ d("div", {
37
+ className: "grid grid-cols-2 gap-2",
38
+ children: [/* @__PURE__ */ u(t, {
39
+ label: "Function",
40
+ type: "select",
41
+ value: _.name,
42
+ onChange: b,
43
+ children: r.map((e) => /* @__PURE__ */ u("optgroup", {
44
+ label: e,
45
+ children: f.filter(([, t]) => t.group === e).map(([e, t]) => /* @__PURE__ */ u("option", {
46
+ value: e,
47
+ children: t.label
48
+ }, e))
49
+ }, e))
50
+ }), /* @__PURE__ */ u(t, {
51
+ label: "Amount",
52
+ type: "metric",
53
+ value: _.amount,
54
+ units: y.units,
55
+ step: y.step,
56
+ min: _.name === "hue-rotate" ? -Infinity : 0,
57
+ onChange: x
56
58
  })]
57
- }), /* @__PURE__ */ a(s.Content, {
58
- className: "w-[260px]",
59
- children: /* @__PURE__ */ a("div", {
60
- className: "flex w-full flex-col gap-2 p-2",
61
- children: /* @__PURE__ */ o(t, {
62
- label: "Type",
63
- children: [/* @__PURE__ */ o(e, {
64
- label: "Property",
65
- onChange: g("propType"),
66
- type: "select",
67
- value: p,
68
- children: [
69
- /* @__PURE__ */ a("optgroup", {
70
- label: "General",
71
- children: /* @__PURE__ */ a("option", {
72
- value: "blur",
73
- children: "Blur"
74
- })
75
- }),
76
- /* @__PURE__ */ o("optgroup", {
77
- label: "Color Adjustments",
78
- children: [
79
- /* @__PURE__ */ a("option", {
80
- value: "brightness",
81
- children: "Brightness"
82
- }),
83
- /* @__PURE__ */ a("option", {
84
- value: "contrast",
85
- children: "Contrast"
86
- }),
87
- /* @__PURE__ */ a("option", {
88
- value: "hue-rotate",
89
- children: "Hue Rotate"
90
- }),
91
- /* @__PURE__ */ a("option", {
92
- value: "saturate",
93
- children: "Saturation"
94
- })
95
- ]
96
- }),
97
- /* @__PURE__ */ o("optgroup", {
98
- label: "Color Effects",
99
- children: [
100
- /* @__PURE__ */ a("option", {
101
- value: "grayscale",
102
- children: "Grayscale"
103
- }),
104
- /* @__PURE__ */ a("option", {
105
- value: "invert",
106
- children: "Invert"
107
- }),
108
- /* @__PURE__ */ a("option", {
109
- value: "sepia",
110
- children: "Sepia"
111
- })
112
- ]
113
- })
114
- ]
115
- }), /* @__PURE__ */ a(e, {
116
- label: "Amount",
117
- value: m,
118
- onChange: g("amount"),
119
- type: "metric",
120
- units: _.units,
121
- step: _.step,
122
- max: _.max
123
- })]
124
- })
125
- })
126
59
  })]
127
60
  });
128
61
  };
129
62
  //#endregion
130
- export { l as default };
63
+ export { p as default };
@@ -0,0 +1,25 @@
1
+ /** One function of a `filter` / `backdrop-filter` list: its name and its argument as written. */
2
+ export type FilterValue = {
3
+ name: string;
4
+ amount: string;
5
+ };
6
+ export type FilterSpec = {
7
+ label: string;
8
+ group: 'General' | 'Color adjustments' | 'Color effects';
9
+ default: string;
10
+ /** Besides none: a proportion is written `0.5` or `50%`, and past 1 the browser clamps it where CSS says to. */
11
+ units: {
12
+ label: string;
13
+ value: string;
14
+ }[];
15
+ step: number;
16
+ };
17
+ /** The functions the editor has a control for: how the picker names them, where a new one starts, what it takes. */
18
+ export declare const FILTER_SPECS: Record<string, FilterSpec>;
19
+ export declare const FILTER_GROUPS: readonly ["General", "Color adjustments", "Color effects"];
20
+ /**
21
+ * A filter function the editor has a control for. Any other — `drop-shadow(…)`, `url(#svg-filter)`, a token — answers
22
+ * `undefined` and is kept as text.
23
+ */
24
+ export declare const parseFilter: (value: string) => FilterValue | undefined;
25
+ export declare const serializeFilter: ({ name, amount }: FilterValue) => string;
@@ -0,0 +1,87 @@
1
+ //#region src/components/StyleInspector/categories/Effects/Filters/helpers.ts
2
+ var e = [{
3
+ label: "%",
4
+ value: "%"
5
+ }], t = {
6
+ blur: {
7
+ label: "Blur",
8
+ group: "General",
9
+ default: "5px",
10
+ units: [{
11
+ label: "PX",
12
+ value: "px"
13
+ }],
14
+ step: 1
15
+ },
16
+ opacity: {
17
+ label: "Opacity",
18
+ group: "General",
19
+ default: "0.5",
20
+ units: e,
21
+ step: .1
22
+ },
23
+ brightness: {
24
+ label: "Brightness",
25
+ group: "Color adjustments",
26
+ default: "1",
27
+ units: e,
28
+ step: .1
29
+ },
30
+ contrast: {
31
+ label: "Contrast",
32
+ group: "Color adjustments",
33
+ default: "1",
34
+ units: e,
35
+ step: .1
36
+ },
37
+ "hue-rotate": {
38
+ label: "Hue rotate",
39
+ group: "Color adjustments",
40
+ default: "0deg",
41
+ units: [{
42
+ label: "DEG",
43
+ value: "deg"
44
+ }],
45
+ step: 1
46
+ },
47
+ saturate: {
48
+ label: "Saturation",
49
+ group: "Color adjustments",
50
+ default: "1",
51
+ units: e,
52
+ step: .1
53
+ },
54
+ grayscale: {
55
+ label: "Grayscale",
56
+ group: "Color effects",
57
+ default: "0.5",
58
+ units: e,
59
+ step: .1
60
+ },
61
+ invert: {
62
+ label: "Invert",
63
+ group: "Color effects",
64
+ default: "0.5",
65
+ units: e,
66
+ step: .1
67
+ },
68
+ sepia: {
69
+ label: "Sepia",
70
+ group: "Color effects",
71
+ default: "0.5",
72
+ units: e,
73
+ step: .1
74
+ }
75
+ }, n = [
76
+ "General",
77
+ "Color adjustments",
78
+ "Color effects"
79
+ ], r = /^([a-z-]+)\((.*)\)$/i, i = (e) => {
80
+ let n = r.exec(e.trim());
81
+ if (n && n[1].toLowerCase() in t) return {
82
+ name: n[1].toLowerCase(),
83
+ amount: n[2].trim()
84
+ };
85
+ }, a = ({ name: e, amount: t }) => `${e}(${t})`;
86
+ //#endregion
87
+ export { n as FILTER_GROUPS, t as FILTER_SPECS, i as parseFilter, a as serializeFilter };
@@ -1,36 +1,26 @@
1
- import e from "../../../components/InspectorLabel/index.mjs";
1
+ import e from "../../../components/ValueList/index.mjs";
2
2
  import { DEFAULT_FUNCTION as t, createFunctionValue as n, parseTransforms as r, serializeTransforms as i } from "./transformFunctions.mjs";
3
3
  import a from "./TransformItem.mjs";
4
4
  import { useCallback as o } from "react";
5
- import { Fragment as s, jsx as c, jsxs as l } from "react/jsx-runtime";
6
- import u from "@plitzi/plitzi-ui/Icon";
5
+ import { jsx as s } from "react/jsx-runtime";
7
6
  //#region src/components/StyleInspector/categories/Effects/Transform/Transform.tsx
8
- var d = ({ value: d, onChange: f }) => {
9
- let p = r(typeof d == "string" ? d : ""), m = o((e) => f?.(e.length > 0 ? i(e) : ""), [f]), h = (e) => (t) => {
10
- t.stopPropagation(), t.preventDefault(), m(p.filter((t, n) => n !== e));
11
- }, g = (e) => (t) => {
12
- m(p.map((n, r) => r === e ? t : n));
13
- }, _ = o(() => {
14
- m([...p, n(t)]);
15
- }, [m, p]);
16
- return /* @__PURE__ */ l(s, { children: [/* @__PURE__ */ l("div", {
17
- className: "flex justify-between",
18
- children: [/* @__PURE__ */ c(e, {
19
- keyValue: ["transform"],
20
- children: "2D & 3D Transforms"
21
- }), /* @__PURE__ */ c(u, {
22
- className: "cursor-pointer",
23
- icon: "fas fa-plus",
24
- onClick: _
25
- })]
26
- }), p.length > 0 && /* @__PURE__ */ c("div", {
27
- className: "flex flex-col gap-2",
28
- children: p.map((e, t) => /* @__PURE__ */ c(a, {
7
+ var c = ["transform"], l = ({ value: l, onChange: u }) => {
8
+ let d = r(typeof l == "string" ? l : ""), f = o((e) => u?.(e.length > 0 ? i(e) : ""), [u]), p = (e) => () => f(d.filter((t, n) => n !== e)), m = (e) => (t) => {
9
+ f(d.map((n, r) => r === e ? t : n));
10
+ }, h = o(() => {
11
+ f([...d, n(t)]);
12
+ }, [f, d]);
13
+ return /* @__PURE__ */ s(e, {
14
+ label: "2D & 3D Transforms",
15
+ keys: c,
16
+ addLabel: "Add transform",
17
+ onAdd: h,
18
+ children: d.length > 0 && d.map((e, t) => /* @__PURE__ */ s(a, {
29
19
  value: e,
30
- onChange: g(t),
31
- onRemove: h(t)
20
+ onChange: m(t),
21
+ onRemove: p(t)
32
22
  }, t))
33
- })] });
23
+ });
34
24
  };
35
25
  //#endregion
36
- export { d as default };
26
+ export { l as default };
@@ -1,9 +1,8 @@
1
1
  import { TransformFunctionValue } from './transformFunctions';
2
- import { MouseEvent } from 'react';
3
2
  export type TransformItemProps = {
4
3
  value: TransformFunctionValue;
5
4
  onChange?: (value: TransformFunctionValue) => void;
6
- onRemove?: (e: MouseEvent) => void;
5
+ onRemove: () => void;
7
6
  };
8
7
  declare const TransformItem: ({ value, onRemove, onChange }: TransformItemProps) => import('react').JSX.Element;
9
8
  export default TransformItem;
@@ -1,89 +1,65 @@
1
1
  import e from "../../../components/CategoryOption/index.mjs";
2
- import { TRANSFORM_FUNCTIONS as t, createFunctionValue as n, getFunctionSpec as r, serializeTransform as i, unitsForKind as a } from "./transformFunctions.mjs";
3
- import { useCallback as o, useMemo as s } from "react";
4
- import { jsx as c, jsxs as l } from "react/jsx-runtime";
5
- import u from "@plitzi/plitzi-ui/ContainerFloating";
6
- import d from "@plitzi/plitzi-ui/Icon";
2
+ import t from "../../../components/ValueListItem/index.mjs";
3
+ import { TRANSFORM_FUNCTION_GROUPS as n, createFunctionValue as r, getFunctionSpec as i, serializeTransform as a, unitsForKind as o } from "./transformFunctions.mjs";
4
+ import { useCallback as s, useMemo as c } from "react";
5
+ import { jsx as l, jsxs as u } from "react/jsx-runtime";
7
6
  //#region src/components/StyleInspector/categories/Effects/Transform/TransformItem.tsx
8
- var f = t.reduce((e, t) => {
9
- let n = e.find((e) => e.category === t.category);
10
- return n ? n.specs.push(t) : e.push({
11
- category: t.category,
12
- specs: [t]
13
- }), e;
14
- }, []), p = ({ value: t, onRemove: p, onChange: m }) => {
15
- let h = r(t.name), g = s(() => h ? h.args : t.args.map((e, t) => ({
7
+ var d = ({ value: d, onRemove: f, onChange: p }) => {
8
+ let m = i(d.name), h = c(() => m ? m.args : d.args.map((e, t) => ({
16
9
  label: `#${t + 1}`,
17
10
  kind: "length",
18
11
  default: "0px"
19
- })), [h, t.args]), _ = s(() => g.map((e, n) => t.args[n] ?? e.default), [g, t.args]), v = o((e) => m?.(n(e)), [m]), y = o((e) => (n) => {
20
- let r = g.map((r, i) => i === e ? n : t.args[i] ?? r.default);
21
- m?.({
22
- name: t.name,
23
- args: r
12
+ })), [m, d.args]), g = c(() => h.map((e, t) => d.args[t] ?? e.default), [h, d.args]), _ = s((e) => p?.(r(e)), [p]), v = s((e) => (t) => {
13
+ let n = h.map((n, r) => r === e ? t : d.args[r] ?? n.default);
14
+ p?.({
15
+ name: d.name,
16
+ args: n
24
17
  });
25
18
  }, [
26
- g,
27
- m,
28
- t.args,
29
- t.name
30
- ]), b = i({
31
- name: t.name,
32
- args: _
19
+ h,
20
+ p,
21
+ d.args,
22
+ d.name
23
+ ]), y = a({
24
+ name: d.name,
25
+ args: g
33
26
  });
34
- return /* @__PURE__ */ l(u, {
35
- className: "w-full min-w-0",
36
- closeOnClick: !1,
37
- containerTopOffset: 5,
38
- children: [/* @__PURE__ */ l(u.Trigger, {
39
- className: "flex w-full min-w-0 cursor-pointer items-center justify-between gap-1 rounded-sm border border-gray-300 bg-white px-2 py-0.5 select-none hover:bg-gray-100 dark:border-zinc-600 dark:bg-zinc-800 dark:hover:bg-zinc-700/60",
40
- children: [/* @__PURE__ */ c("div", {
41
- className: "min-w-0 truncate text-xs",
42
- children: b
43
- }), /* @__PURE__ */ c(d, {
44
- size: "xs",
45
- icon: "fas fa-trash-alt",
46
- onClick: p,
47
- intent: "danger",
48
- title: "Remove"
27
+ return /* @__PURE__ */ u(t, {
28
+ summary: y,
29
+ title: "Transform",
30
+ removeLabel: "Remove transform",
31
+ onRemove: f,
32
+ children: [/* @__PURE__ */ u(e, {
33
+ label: "Function",
34
+ value: d.name,
35
+ onChange: _,
36
+ type: "select",
37
+ children: [n.map((e) => /* @__PURE__ */ l("optgroup", {
38
+ label: e.category,
39
+ children: e.specs.map((e) => /* @__PURE__ */ l("option", {
40
+ value: e.name,
41
+ children: e.label
42
+ }, e.name))
43
+ }, e.category)), !m && /* @__PURE__ */ l("optgroup", {
44
+ label: "Other",
45
+ children: /* @__PURE__ */ l("option", {
46
+ value: d.name,
47
+ children: d.name
48
+ })
49
49
  })]
50
- }), /* @__PURE__ */ c(u.Content, {
51
- className: "w-[240px]",
52
- children: /* @__PURE__ */ l("div", {
53
- className: "flex w-full flex-col gap-2 p-2",
54
- children: [/* @__PURE__ */ l(e, {
55
- value: t.name,
56
- onChange: v,
57
- type: "select",
58
- children: [f.map((e) => /* @__PURE__ */ c("optgroup", {
59
- label: e.category,
60
- children: e.specs.map((e) => /* @__PURE__ */ c("option", {
61
- value: e.name,
62
- children: e.label
63
- }, e.name))
64
- }, e.category)), !h && /* @__PURE__ */ c("optgroup", {
65
- label: "Other",
66
- children: /* @__PURE__ */ c("option", {
67
- value: t.name,
68
- children: t.name
69
- })
70
- })]
71
- }), /* @__PURE__ */ c("div", {
72
- className: "flex flex-col gap-1.5",
73
- children: g.map((t, n) => /* @__PURE__ */ c(e, {
74
- label: t.label,
75
- value: _[n],
76
- onChange: y(n),
77
- type: "metric",
78
- direction: "row",
79
- units: a(t.kind),
80
- step: t.kind === "number" ? .1 : 1,
81
- min: -Infinity
82
- }, `${t.label}-${n}`))
83
- })]
84
- })
50
+ }), /* @__PURE__ */ l("div", {
51
+ className: "grid grid-cols-2 gap-2",
52
+ children: h.map((t, n) => /* @__PURE__ */ l(e, {
53
+ label: t.label,
54
+ value: g[n],
55
+ onChange: v(n),
56
+ type: "metric",
57
+ units: o(t.kind),
58
+ step: t.kind === "number" ? .1 : 1,
59
+ min: -Infinity
60
+ }, `${t.label}-${n}`))
85
61
  })]
86
62
  });
87
63
  };
88
64
  //#endregion
89
- export { p as default };
65
+ export { d as default };
@@ -25,3 +25,8 @@ export declare const parseTransforms: (value: string) => TransformFunctionValue[
25
25
  export declare const serializeTransform: ({ name, args }: TransformFunctionValue) => string;
26
26
  export declare const serializeTransforms: (transforms: TransformFunctionValue[]) => string;
27
27
  export declare const createFunctionValue: (name: string) => TransformFunctionValue;
28
+ /** The functions by category, in the order the picker lists them. */
29
+ export declare const TRANSFORM_FUNCTION_GROUPS: {
30
+ category: string;
31
+ specs: typeof TRANSFORM_FUNCTIONS;
32
+ }[];
@@ -186,6 +186,12 @@ var e = (e) => ({
186
186
  name: e,
187
187
  args: t ? t.args.map((e) => e.default) : ["0px"]
188
188
  };
189
- };
189
+ }, m = r.reduce((e, t) => {
190
+ let n = e.find((e) => e.category === t.category);
191
+ return n ? n.specs.push(t) : e.push({
192
+ category: t.category,
193
+ specs: [t]
194
+ }), e;
195
+ }, []);
190
196
  //#endregion
191
- export { i as DEFAULT_FUNCTION, r as TRANSFORM_FUNCTIONS, p as createFunctionValue, c as getFunctionSpec, u as parseTransforms, d as serializeTransform, f as serializeTransforms, o as unitsForKind };
197
+ export { i as DEFAULT_FUNCTION, r as TRANSFORM_FUNCTIONS, m as TRANSFORM_FUNCTION_GROUPS, p as createFunctionValue, c as getFunctionSpec, u as parseTransforms, d as serializeTransform, f as serializeTransforms, o as unitsForKind };
@@ -1,41 +1,25 @@
1
- import e from "../../../components/InspectorLabel/index.mjs";
2
- import t from "./TransitionItem.mjs";
3
- import { useCallback as n } from "react";
4
- import { Fragment as r, jsx as i, jsxs as a } from "react/jsx-runtime";
5
- import o from "@plitzi/plitzi-ui/Icon";
1
+ import { splitByCommaOutsideParens as e } from "../../../cssValues.mjs";
2
+ import t from "../../../components/ValueList/index.mjs";
3
+ import { DEFAULT_TRANSITION as n, serializeTransition as r } from "./helpers.mjs";
4
+ import i from "./TransitionItem.mjs";
5
+ import { useCallback as a } from "react";
6
+ import { jsx as o } from "react/jsx-runtime";
6
7
  //#region src/components/StyleInspector/categories/Effects/Transition/Transition.tsx
7
- var s = ({ value: s, onChange: c }) => {
8
- let l = [];
9
- s && s !== "" && (l = s.split(/,(?![^()]*\))/gim));
10
- let u = (e) => (t) => {
11
- t.stopPropagation(), t.preventDefault(), l.splice(e, 1), l.length > 0 ? c?.(l.join(",")) : c?.("");
12
- }, d = (e) => (t) => {
13
- t !== l[e] && (l[e] = t, c?.(l.join(",")));
14
- }, f = n(() => {
15
- l.length > 0 ? c?.(`${s},opacity 200ms ease 0ms`) : c?.("opacity 200ms ease 0ms");
16
- }, [
17
- c,
18
- l.length,
19
- s
20
- ]);
21
- return /* @__PURE__ */ a(r, { children: [/* @__PURE__ */ a("div", {
22
- className: "flex justify-between",
23
- children: [/* @__PURE__ */ i(e, {
24
- keyValue: ["transition"],
25
- children: "Transitions"
26
- }), /* @__PURE__ */ i(o, {
27
- className: "cursor-pointer",
28
- icon: "fas fa-plus",
29
- onClick: f
30
- })]
31
- }), l.length > 0 && /* @__PURE__ */ i("div", {
32
- className: "flex flex-col gap-2",
33
- children: l.map((e, n) => /* @__PURE__ */ i(t, {
8
+ var s = ["transition"], c = ({ value: c, onChange: l }) => {
9
+ let u = typeof c == "string" && c !== "" ? e(c).map((e) => e.trim()) : [], d = a((e) => l?.(e.length > 0 ? e.join(", ") : ""), [l]), f = (e) => () => d(u.filter((t, n) => n !== e)), p = (e) => (t) => {
10
+ t !== u[e] && d(u.map((n, r) => r === e ? t : n));
11
+ };
12
+ return /* @__PURE__ */ o(t, {
13
+ label: "Transitions",
14
+ keys: s,
15
+ addLabel: "Add transition",
16
+ onAdd: () => d([...u, r(n)]),
17
+ children: u.length > 0 && u.map((e, t) => /* @__PURE__ */ o(i, {
34
18
  value: e,
35
- onChange: d(n),
36
- onRemove: u(n)
37
- }, n))
38
- })] });
19
+ onChange: p(t),
20
+ onRemove: f(t)
21
+ }, t))
22
+ });
39
23
  };
40
24
  //#endregion
41
- export { s as default };
25
+ export { c as default };
@@ -0,0 +1,10 @@
1
+ export type TransitionEasingProps = {
2
+ value: string;
3
+ onChange: (easing: string) => void;
4
+ };
5
+ /**
6
+ * The easing of one transition: a picker of the named curves, and — opened from it — the curve itself, to drag into
7
+ * one of your own, with the presets drawn and a dot that runs along it.
8
+ */
9
+ declare const TransitionEasing: ({ value, onChange }: TransitionEasingProps) => import('react').JSX.Element;
10
+ export default TransitionEasing;