@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,172 +1,178 @@
1
- import e from "../../../../components/CategoryOption/index.mjs";
2
- import t from "../../../../components/CategorySection/index.mjs";
3
- import { serializeLayerImage as n } from "../../helpers/backgroundParser.mjs";
4
- import r from "../../modes/ConicGradientMode.mjs";
5
- import i from "../../modes/ImageMode.mjs";
6
- import a from "../../modes/LinearGradientMode.mjs";
7
- import o from "../../modes/RadialGradientMode.mjs";
8
- import { memo as s, useCallback as c, useMemo as l, useState as u } from "react";
9
- import { jsx as d, jsxs as f } from "react/jsx-runtime";
10
- import p from "clsx";
11
- import m from "@plitzi/plitzi-ui/Icon";
12
- import { nodeOf as h } from "@plitzi/sdk-shared/helpers/eventTarget";
13
- //#region src/components/StyleInspector/categories/Background/components/BackgroundLayer/BackgroundLayer.tsx
14
- var g = {
15
- none: "None",
16
- url: "Image",
17
- "linear-gradient": "Linear Gradient",
18
- "radial-gradient": "Radial Gradient",
19
- "conic-gradient": "Conic Gradient"
20
- }, _ = [
21
- {
22
- value: "border-box",
23
- label: "Border Box"
24
- },
25
- {
26
- value: "padding-box",
27
- label: "Padding Box"
28
- },
29
- {
30
- value: "content-box",
31
- label: "Content Box"
32
- }
33
- ], v = s(({ layer: s, index: v, expanded: y, onExpand: b, onChange: x, onRemove: S, onReorder: C }) => {
34
- let [w, T] = u(!1), E = l(() => n(s), [s]), D = c((e) => {
35
- let t = String(e);
36
- x({
37
- ...s,
38
- type: t
1
+ import { CLIP_OPTIONS as e, LAYER_TYPES as t, LAYER_TYPE_LABELS as n, isGradient as r, layerSummary as i } from "./helpers.mjs";
2
+ import { asText as a } from "../../../../cssValues.mjs";
3
+ import o from "../../../../components/CategoryOption/index.mjs";
4
+ import s from "../../../../components/CategorySection/index.mjs";
5
+ import c from "../../../../components/ColorSwatch/index.mjs";
6
+ import { serializeLayerImage as l } from "../../helpers/backgroundParser.mjs";
7
+ import u from "../../modes/ConicGradientMode.mjs";
8
+ import d from "../../modes/ImageMode.mjs";
9
+ import f from "../../modes/LinearGradientMode.mjs";
10
+ import p from "../../modes/RadialGradientMode.mjs";
11
+ import m from "../../modes/RawMode.mjs";
12
+ import h from "../BackgroundAttachment/index.mjs";
13
+ import g from "../BackgroundPosition/index.mjs";
14
+ import _ from "../BackgroundSize/index.mjs";
15
+ import v from "../BackgroundTile/index.mjs";
16
+ import y from "../LayerGroup/index.mjs";
17
+ import { memo as b, useCallback as x, useMemo as S, useState as C } from "react";
18
+ import { jsx as w, jsxs as T } from "react/jsx-runtime";
19
+ import E from "clsx";
20
+ import D from "@plitzi/plitzi-ui/Switch";
21
+ import { nodeOf as O } from "@plitzi/sdk-shared/helpers/eventTarget";
22
+ var k = b(({ layer: b, index: k, expanded: A, onExpand: j, onChange: M, onRemove: N, onReorder: P }) => {
23
+ let [F, I] = C(!1), L = S(() => l(b), [b]), R = x((e) => {
24
+ let n = t.find((t) => t === a(e));
25
+ n && M({
26
+ ...b,
27
+ type: n
39
28
  });
40
- }, [s, x]), O = c(() => b(s.id), [b, s.id]), k = c((e) => x({
41
- ...s,
42
- clip: String(e)
43
- }), [s, x]), A = c((e) => {
44
- e.dataTransfer.effectAllowed = "move", e.dataTransfer.setData("text/plain", String(v));
45
- }, [v]), j = c(() => {
46
- T(!1);
47
- }, []), M = c((e) => {
48
- e.preventDefault(), T(!0);
49
- }, []), N = c((e) => {
50
- e.currentTarget.contains(h(e.relatedTarget)) || T(!1);
51
- }, []), P = c((e) => {
52
- e.preventDefault(), T(!1);
29
+ }, [b, M]), z = x((e) => M({
30
+ ...b,
31
+ repeating: e.target.checked
32
+ }), [b, M]), B = x((e) => M({
33
+ ...b,
34
+ clip: a(e)
35
+ }), [b, M]), V = x(() => j(b.id), [j, b.id]), H = x((e) => {
36
+ e.target === e.currentTarget && (e.key === "Enter" || e.key === " ") && (e.preventDefault(), j(b.id));
37
+ }, [j, b.id]), U = x((e) => e.stopPropagation(), []), W = x((e) => {
38
+ e.stopPropagation(), N();
39
+ }, [N]), G = x((e) => {
40
+ e.dataTransfer.effectAllowed = "move", e.dataTransfer.setData("text/plain", String(k));
41
+ }, [k]), K = x(() => I(!1), []), q = x((e) => {
42
+ e.preventDefault(), I(!0);
43
+ }, []), J = x((e) => {
44
+ e.currentTarget.contains(O(e.relatedTarget)) || I(!1);
45
+ }, []), Y = x((e) => {
46
+ e.preventDefault(), I(!1);
53
47
  let t = parseInt(e.dataTransfer.getData("text/plain"), 10);
54
- isNaN(t) || C(t, v);
55
- }, [v, C]);
56
- return /* @__PURE__ */ f("div", {
57
- className: p("rounded-sm border transition-colors", {
58
- "border-blue-400 bg-blue-50 dark:border-blue-500 dark:bg-blue-900/20": w,
59
- "border-gray-200 dark:border-zinc-700": !w
48
+ isNaN(t) || P(t, k);
49
+ }, [k, P]), X = r(b.type), Z = b.type !== "none";
50
+ return /* @__PURE__ */ T("div", {
51
+ className: E("rounded-md border transition-colors duration-150", {
52
+ "border-primary-500 bg-primary-500/5 dark:border-primary-400 dark:bg-primary-400/10": F,
53
+ "border-primary-500/60 dark:border-primary-400/60": A && !F,
54
+ "border-gray-200 dark:border-zinc-700": !A && !F
60
55
  }),
61
- onDragOver: M,
62
- onDragLeave: N,
63
- onDrop: P,
64
- children: [/* @__PURE__ */ f("div", {
65
- className: "flex h-8 items-center gap-1 px-1",
56
+ onDragOver: q,
57
+ onDragLeave: J,
58
+ onDrop: Y,
59
+ children: [/* @__PURE__ */ T("div", {
60
+ className: "group flex h-8 cursor-pointer items-center gap-2 px-1.5 select-none",
61
+ role: "button",
62
+ tabIndex: 0,
63
+ "aria-expanded": A,
64
+ onClick: V,
65
+ onKeyDown: H,
66
66
  children: [
67
- /* @__PURE__ */ d("span", {
67
+ /* @__PURE__ */ w("span", {
68
68
  draggable: !0,
69
- className: "cursor-grab px-1 text-gray-400 hover:text-gray-600 active:cursor-grabbing dark:text-zinc-500 dark:hover:text-zinc-300",
70
- onDragStart: A,
71
- onDragEnd: j,
72
- children: /* @__PURE__ */ d(m, {
73
- icon: "fa-solid fa-grip-lines",
74
- size: "xs"
75
- })
76
- }),
77
- s.type !== "none" && /* @__PURE__ */ d("div", {
78
- className: "h-4 w-4 shrink-0 rounded-sm border border-gray-300 dark:border-zinc-600",
79
- style: { background: E }
69
+ className: "flex h-5 w-4 cursor-grab items-center justify-center text-zinc-400 hover:text-zinc-700 active:cursor-grabbing dark:text-zinc-500 dark:hover:text-zinc-200",
70
+ title: "Drag to reorder — the first layer is drawn on top",
71
+ onClick: U,
72
+ onDragStart: G,
73
+ onDragEnd: K,
74
+ children: /* @__PURE__ */ w("i", { className: "fa-solid fa-grip-vertical text-xs" })
80
75
  }),
81
- /* @__PURE__ */ d("span", {
82
- className: "flex-1 truncate text-xs text-gray-600 dark:text-zinc-400",
83
- children: g[s.type]
76
+ /* @__PURE__ */ w(c, {
77
+ className: "h-5 w-5",
78
+ value: L,
79
+ property: "background"
84
80
  }),
85
- /* @__PURE__ */ d("button", {
86
- type: "button",
87
- className: "cursor-pointer p-1 text-gray-400 hover:text-gray-600 dark:text-zinc-500 dark:hover:text-zinc-300",
88
- onClick: O,
89
- title: y ? "Collapse" : "Expand",
90
- children: /* @__PURE__ */ d(m, {
91
- icon: y ? "fa-solid fa-angle-up" : "fa-solid fa-angle-down",
92
- size: "xs"
93
- })
81
+ /* @__PURE__ */ w("span", {
82
+ className: "min-w-0 grow truncate text-xs text-zinc-700 dark:text-zinc-200",
83
+ title: i(b),
84
+ children: i(b)
94
85
  }),
95
- /* @__PURE__ */ d("button", {
86
+ /* @__PURE__ */ w("i", { className: E("fa-solid text-xs text-zinc-400 dark:text-zinc-500", {
87
+ "fa-angle-up": A,
88
+ "fa-angle-down": !A
89
+ }) }),
90
+ /* @__PURE__ */ w("button", {
96
91
  type: "button",
97
- className: "cursor-pointer p-1 text-gray-400 hover:text-red-500 dark:text-zinc-500 dark:hover:text-red-400",
98
- onClick: S,
92
+ className: "flex h-5 w-5 shrink-0 cursor-pointer items-center justify-center rounded text-zinc-400 hover:bg-red-500/10 hover:text-red-600 dark:text-zinc-500 dark:hover:text-red-400",
99
93
  title: "Remove layer",
100
- children: /* @__PURE__ */ d(m, {
101
- icon: "fas fa-times",
102
- size: "xs"
103
- })
94
+ "aria-label": "Remove layer",
95
+ onClick: W,
96
+ children: /* @__PURE__ */ w("i", { className: "fa-solid fa-xmark text-xs" })
104
97
  })
105
98
  ]
106
- }), y && /* @__PURE__ */ f("div", {
107
- className: "flex flex-col gap-2 border-t border-gray-200 p-2 dark:border-zinc-700",
108
- children: [
109
- /* @__PURE__ */ d(t, {
110
- label: "Type",
111
- children: /* @__PURE__ */ f(e, {
99
+ }), A && /* @__PURE__ */ T("div", {
100
+ className: "flex flex-col gap-4 border-t border-gray-200 p-2.5 dark:border-zinc-700",
101
+ children: [/* @__PURE__ */ T(y, {
102
+ title: X ? "Gradient" : n[b.type],
103
+ children: [
104
+ /* @__PURE__ */ w(o, {
105
+ label: "Type",
112
106
  type: "select",
113
- value: s.type,
114
- onChange: D,
115
- children: [
116
- /* @__PURE__ */ d("option", {
117
- value: "linear-gradient",
118
- children: "Linear Gradient"
119
- }),
120
- /* @__PURE__ */ d("option", {
121
- value: "radial-gradient",
122
- children: "Radial Gradient"
123
- }),
124
- /* @__PURE__ */ d("option", {
125
- value: "conic-gradient",
126
- children: "Conic Gradient"
127
- }),
128
- /* @__PURE__ */ d("option", {
129
- value: "url",
130
- children: "Image URL"
131
- }),
132
- /* @__PURE__ */ d("option", {
133
- value: "none",
134
- children: "None"
135
- })
136
- ]
107
+ value: b.type,
108
+ onChange: R,
109
+ children: t.map((e) => /* @__PURE__ */ w("option", {
110
+ value: e,
111
+ children: n[e]
112
+ }, e))
113
+ }),
114
+ b.type === "url" && /* @__PURE__ */ w(d, {
115
+ layer: b,
116
+ onChange: M
117
+ }),
118
+ b.type === "raw" && /* @__PURE__ */ w(m, {
119
+ layer: b,
120
+ onChange: M
121
+ }),
122
+ b.type === "linear-gradient" && /* @__PURE__ */ w(f, {
123
+ layer: b,
124
+ onChange: M
125
+ }),
126
+ b.type === "radial-gradient" && /* @__PURE__ */ w(p, {
127
+ layer: b,
128
+ onChange: M
129
+ }),
130
+ b.type === "conic-gradient" && /* @__PURE__ */ w(u, {
131
+ layer: b,
132
+ onChange: M
133
+ }),
134
+ X && /* @__PURE__ */ w(D, {
135
+ size: "xs",
136
+ label: "Repeat the gradient",
137
+ checked: b.repeating,
138
+ onChange: z
137
139
  })
138
- }),
139
- s.type === "url" && /* @__PURE__ */ d(i, {
140
- layer: s,
141
- onChange: x
142
- }),
143
- s.type === "linear-gradient" && /* @__PURE__ */ d(a, {
144
- layer: s,
145
- onChange: x
146
- }),
147
- s.type === "radial-gradient" && /* @__PURE__ */ d(o, {
148
- layer: s,
149
- onChange: x
150
- }),
151
- s.type === "conic-gradient" && /* @__PURE__ */ d(r, {
152
- layer: s,
153
- onChange: x
154
- }),
155
- s.type !== "none" && /* @__PURE__ */ d(t, {
156
- label: "Clip",
157
- children: /* @__PURE__ */ d(e, {
158
- type: "select",
159
- value: s.clip,
160
- onChange: k,
161
- children: _.map((e) => /* @__PURE__ */ d("option", {
162
- value: e.value,
163
- children: e.label
164
- }, e.value))
140
+ ]
141
+ }), Z && /* @__PURE__ */ T(y, {
142
+ title: "Placement",
143
+ children: [
144
+ /* @__PURE__ */ w(_, {
145
+ layer: b,
146
+ onChange: M
147
+ }),
148
+ /* @__PURE__ */ w(g, {
149
+ layer: b,
150
+ onChange: M
151
+ }),
152
+ /* @__PURE__ */ w(v, {
153
+ layer: b,
154
+ onChange: M
155
+ }),
156
+ /* @__PURE__ */ w(h, {
157
+ layer: b,
158
+ onChange: M
159
+ }),
160
+ /* @__PURE__ */ w(s, {
161
+ label: "Clip",
162
+ children: /* @__PURE__ */ w(o, {
163
+ type: "select",
164
+ value: b.clip,
165
+ onChange: B,
166
+ children: e.map((e) => /* @__PURE__ */ w("option", {
167
+ value: e.value,
168
+ children: e.label
169
+ }, e.value))
170
+ })
165
171
  })
166
- })
167
- ]
172
+ ]
173
+ })]
168
174
  })]
169
175
  });
170
176
  });
171
177
  //#endregion
172
- export { v as default };
178
+ export { k as default };
@@ -0,0 +1,11 @@
1
+ import { BackgroundLayer, BackgroundLayerType } from '../../helpers/backgroundParser';
2
+ export declare const LAYER_TYPE_LABELS: Record<BackgroundLayerType, string>;
3
+ /** The order the type picker lists them in. */
4
+ export declare const LAYER_TYPES: BackgroundLayerType[];
5
+ export declare const CLIP_OPTIONS: {
6
+ value: string;
7
+ label: string;
8
+ }[];
9
+ export declare const isGradient: (type: BackgroundLayerType) => boolean;
10
+ /** How a layer's row names it: what it is, and the one detail that tells two of a kind apart. */
11
+ export declare const layerSummary: (layer: BackgroundLayer) => string;
@@ -0,0 +1,45 @@
1
+ //#region src/components/StyleInspector/categories/Background/components/BackgroundLayer/helpers.ts
2
+ var e = {
3
+ none: "None",
4
+ url: "Image",
5
+ "linear-gradient": "Linear gradient",
6
+ "radial-gradient": "Radial gradient",
7
+ "conic-gradient": "Conic gradient",
8
+ raw: "Custom (CSS)"
9
+ }, t = [
10
+ "linear-gradient",
11
+ "radial-gradient",
12
+ "conic-gradient",
13
+ "url",
14
+ "raw",
15
+ "none"
16
+ ], n = [
17
+ {
18
+ value: "border-box",
19
+ label: "Border box"
20
+ },
21
+ {
22
+ value: "padding-box",
23
+ label: "Padding box"
24
+ },
25
+ {
26
+ value: "content-box",
27
+ label: "Content box"
28
+ },
29
+ {
30
+ value: "text",
31
+ label: "Text"
32
+ }
33
+ ], r = (e) => e === "linear-gradient" || e === "radial-gradient" || e === "conic-gradient", i = (e) => e.split(/[?#]/)[0].split("/").filter(Boolean).at(-1) ?? e, a = (t) => {
34
+ let n = `${t.repeating ? "Repeating " : ""}${e[t.type]}`;
35
+ switch (t.type) {
36
+ case "url": return t.url ? `${n} · ${i(t.url)}` : `${n} · no URL yet`;
37
+ case "raw": return `Custom · ${t.raw}`;
38
+ case "linear-gradient": return `${n} · ${t.angle || "to bottom"}`;
39
+ case "radial-gradient": return `${n} · ${t.radialShape}`;
40
+ case "conic-gradient": return `${n} · from ${t.conicAngle || "0deg"}`;
41
+ default: return n;
42
+ }
43
+ };
44
+ //#endregion
45
+ export { n as CLIP_OPTIONS, t as LAYER_TYPES, e as LAYER_TYPE_LABELS, r as isGradient, a as layerSummary };
@@ -1,39 +1,42 @@
1
- import e from "../../../../components/CategoryOption/index.mjs";
2
- import t from "../../../../components/CategorySection/index.mjs";
3
- import { useCallback as n } from "react";
4
- import { jsx as r, jsxs as i } from "react/jsx-runtime";
1
+ import { asText as e } from "../../../../cssValues.mjs";
2
+ import t from "../../../../components/CategoryOption/index.mjs";
3
+ import n from "../../../../components/CategorySection/index.mjs";
4
+ import { useCallback as r } from "react";
5
+ import { jsx as i, jsxs as a } from "react/jsx-runtime";
5
6
  //#region src/components/StyleInspector/categories/Background/components/BackgroundPosition/BackgroundPosition.tsx
6
- var a = [
7
+ var o = [
7
8
  "center",
8
9
  "top",
9
10
  "right",
10
11
  "bottom",
11
12
  "left",
12
13
  "auto"
13
- ], o = ({ layer: o, onChange: s }) => {
14
- let c = n((e) => s?.({
15
- ...o,
16
- positionX: String(e)
17
- }), [o, s]), l = n((e) => s?.({
18
- ...o,
19
- positionY: String(e)
20
- }), [o, s]);
21
- return /* @__PURE__ */ i(t, {
14
+ ], s = ({ layer: s, onChange: c }) => {
15
+ let l = r((t) => c?.({
16
+ ...s,
17
+ positionX: e(t)
18
+ }), [s, c]), u = r((t) => c?.({
19
+ ...s,
20
+ positionY: e(t)
21
+ }), [s, c]);
22
+ return /* @__PURE__ */ a(n, {
22
23
  label: "Position",
23
- children: [/* @__PURE__ */ r(e, {
24
+ children: [/* @__PURE__ */ i(t, {
24
25
  label: "X",
25
26
  type: "metric",
26
- value: o.positionX,
27
- allowedWords: a,
28
- onChange: c
29
- }), /* @__PURE__ */ r(e, {
27
+ value: s.positionX,
28
+ allowedWords: o,
29
+ min: -Infinity,
30
+ onChange: l
31
+ }), /* @__PURE__ */ i(t, {
30
32
  label: "Y",
31
33
  type: "metric",
32
- value: o.positionY,
33
- allowedWords: a,
34
- onChange: l
34
+ value: s.positionY,
35
+ allowedWords: o,
36
+ min: -Infinity,
37
+ onChange: u
35
38
  })]
36
39
  });
37
40
  };
38
41
  //#endregion
39
- export { o as default };
42
+ export { s as default };
@@ -1,86 +1,95 @@
1
- import e from "../../../../components/CategoryOption/index.mjs";
2
- import t from "../../../../components/CategorySection/index.mjs";
3
- import { useCallback as n, useMemo as r } from "react";
4
- import { Fragment as i, jsx as a, jsxs as o } from "react/jsx-runtime";
1
+ import { asText as e } from "../../../../cssValues.mjs";
2
+ import t from "../../../../components/CategoryOption/index.mjs";
3
+ import n from "../../../../components/CategorySection/index.mjs";
4
+ import { sizeParts as r, sizePreset as i } from "./helpers.mjs";
5
+ import { useCallback as a, useMemo as o } from "react";
6
+ import { Fragment as s, jsx as c, jsxs as l } from "react/jsx-runtime";
5
7
  //#region src/components/StyleInspector/categories/Background/components/BackgroundSize/BackgroundSize.tsx
6
- var s = ({ layer: s, onChange: c }) => {
7
- let l = s.size === "auto" || s.size.includes(" ") || /^\d/.test(s.size), u = r(() => s.size.includes(" ") ? s.size.split(" ") : ["auto", "auto"], [s.size]), d = n((e) => {
8
- let t = String(e);
9
- if (t === "cover" || t === "contain") c?.({
10
- ...s,
11
- size: t
12
- });
13
- else {
14
- let e = s.size;
15
- c?.({
16
- ...s,
17
- size: e === "cover" || e === "contain" ? "auto auto" : e
8
+ var u = ({ layer: u, onChange: d }) => {
9
+ let f = i(u.size), [p, m] = r(u.size), h = a((t) => {
10
+ let n = e(t);
11
+ if (n !== "custom") {
12
+ d?.({
13
+ ...u,
14
+ size: n
18
15
  });
16
+ return;
19
17
  }
20
- }, [s, c]), f = s.size === "cover" ? "cover" : s.size === "contain" ? "contain" : "auto", p = n((e) => c?.({
21
- ...s,
22
- size: `${String(e)} ${u[1] ?? "auto"}`
18
+ d?.({
19
+ ...u,
20
+ size: f === "custom" ? u.size : "auto"
21
+ });
22
+ }, [
23
+ u,
24
+ d,
25
+ f
26
+ ]), g = a((t) => d?.({
27
+ ...u,
28
+ size: `${e(t)} ${m}`
23
29
  }), [
24
- s,
25
- c,
26
- u
27
- ]), m = n((e) => c?.({
28
- ...s,
29
- size: `${u[0] ?? "auto"} ${String(e)}`
30
+ m,
31
+ u,
32
+ d
33
+ ]), _ = a((t) => d?.({
34
+ ...u,
35
+ size: `${p} ${e(t)}`
30
36
  }), [
31
- s,
32
- c,
33
- u
34
- ]), h = r(() => [
37
+ u,
38
+ d,
39
+ p
40
+ ]), v = o(() => [
35
41
  {
36
- value: "auto",
37
- icon: /* @__PURE__ */ a("div", {
38
- className: "px-1 text-xs select-none",
42
+ value: "custom",
43
+ icon: /* @__PURE__ */ c("span", {
44
+ className: "px-1.5 text-xs select-none",
39
45
  children: "Custom"
40
46
  }),
41
- description: "Custom dimensions",
42
- active: f === "auto",
47
+ description: "A width and a height of its own",
48
+ active: f === "custom",
43
49
  size: "custom"
44
50
  },
45
51
  {
46
52
  value: "cover",
47
- icon: /* @__PURE__ */ a("div", {
48
- className: "px-1 text-xs select-none",
53
+ icon: /* @__PURE__ */ c("span", {
54
+ className: "px-1.5 text-xs select-none",
49
55
  children: "Cover"
50
56
  }),
51
- description: "Cover the element",
57
+ description: "Fill the element, cropping what overflows",
52
58
  active: f === "cover",
53
59
  size: "custom"
54
60
  },
55
61
  {
56
62
  value: "contain",
57
- icon: /* @__PURE__ */ a("div", {
58
- className: "px-1 text-xs select-none",
63
+ icon: /* @__PURE__ */ c("span", {
64
+ className: "px-1.5 text-xs select-none",
59
65
  children: "Contain"
60
66
  }),
61
- description: "Fit inside the element",
67
+ description: "Fit inside the element, whole",
62
68
  active: f === "contain",
63
69
  size: "custom"
64
70
  }
65
71
  ], [f]);
66
- return /* @__PURE__ */ o(i, { children: [/* @__PURE__ */ a(t, {
72
+ return /* @__PURE__ */ l(s, { children: [/* @__PURE__ */ c(n, {
67
73
  label: "Size",
68
- children: /* @__PURE__ */ a(e, {
74
+ children: /* @__PURE__ */ c(t, {
69
75
  type: "iconGroup",
70
- items: h,
71
- onChange: d
76
+ items: v,
77
+ onChange: h
72
78
  })
73
- }), l && /* @__PURE__ */ o(t, { children: [/* @__PURE__ */ a(e, {
74
- label: "W",
75
- type: "metric",
76
- value: u[0],
77
- onChange: p
78
- }), /* @__PURE__ */ a(e, {
79
- label: "H",
80
- type: "metric",
81
- value: u[1],
82
- onChange: m
83
- })] })] });
79
+ }), f === "custom" && /* @__PURE__ */ l(n, {
80
+ label: "",
81
+ children: [/* @__PURE__ */ c(t, {
82
+ label: "Width",
83
+ type: "metric",
84
+ value: p,
85
+ onChange: g
86
+ }), /* @__PURE__ */ c(t, {
87
+ label: "Height",
88
+ type: "metric",
89
+ value: m,
90
+ onChange: _
91
+ })]
92
+ })] });
84
93
  };
85
94
  //#endregion
86
- export { s as default };
95
+ export { u as default };
@@ -0,0 +1,4 @@
1
+ /** Which of the three ways a size is written: one of the two keywords, or a width and a height. */
2
+ export declare const sizePreset: (size: string) => "cover" | "contain" | "custom";
3
+ /** A size as its width and its height. One value is the width, the height then follows the image (`auto`). */
4
+ export declare const sizeParts: (size: string) => [string, string];
@@ -0,0 +1,8 @@
1
+ //#region src/components/StyleInspector/categories/Background/components/BackgroundSize/helpers.ts
2
+ var e = (e) => e === "cover" || e === "contain" ? e : "custom", t = (t) => {
3
+ if (e(t) !== "custom") return ["auto", "auto"];
4
+ let [n = "auto", r = "auto"] = t.split(" ").filter(Boolean);
5
+ return [n, r];
6
+ };
7
+ //#endregion
8
+ export { t as sizeParts, e as sizePreset };