@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
@@ -0,0 +1,92 @@
1
+ import { easingGenerics as e } from "../../../../InputEasing/InputEasingHelper.mjs";
2
+ import t from "../../../../InputEasing/InputEasingList.mjs";
3
+ import n from "../../../../InputEasing/index.mjs";
4
+ import { asText as r } from "../../../cssValues.mjs";
5
+ import i from "../../../components/CategoryOption/index.mjs";
6
+ import { bezierCss as a, easingCss as o, easingCurve as s, easingOptions as c } from "./helpers.mjs";
7
+ import { useCallback as l, useEffect as u, useMemo as d, useState as f } from "react";
8
+ import { jsx as p, jsxs as m } from "react/jsx-runtime";
9
+ //#region src/components/StyleInspector/categories/Effects/Transition/TransitionEasing.tsx
10
+ var h = c(e), g = 1600, _ = ({ value: c, onChange: _ }) => {
11
+ let [v, y] = f(!1), [b, x] = f(!1), [S, C] = f(0), w = s(c, e), T = h.some((e) => e.value === c);
12
+ u(() => {
13
+ if (!b) {
14
+ C(0);
15
+ return;
16
+ }
17
+ let e = 0, t = performance.now(), n = (r) => {
18
+ C((r - t) % g / g), e = requestAnimationFrame(n);
19
+ };
20
+ return e = requestAnimationFrame(n), () => cancelAnimationFrame(e);
21
+ }, [b]);
22
+ let E = l((e) => _(r(e)), [_]), D = l((t) => _(o(t, e)), [_]), O = l((e) => {
23
+ let [t = 0, n = 0, r = 1, i = 1] = e;
24
+ _(a([
25
+ t,
26
+ n,
27
+ r,
28
+ i
29
+ ]));
30
+ }, [_]), k = l(() => y((e) => !e), []), A = l(() => x((e) => !e), []), j = d(() => `Custom — ${c}`, [c]);
31
+ return /* @__PURE__ */ m("div", {
32
+ className: "flex flex-col gap-2",
33
+ children: [
34
+ /* @__PURE__ */ m("div", {
35
+ className: "flex items-end gap-2",
36
+ children: [/* @__PURE__ */ p("div", {
37
+ className: "min-w-0 grow",
38
+ children: /* @__PURE__ */ m(i, {
39
+ label: "Easing",
40
+ type: "select",
41
+ value: c,
42
+ onChange: E,
43
+ children: [!T && /* @__PURE__ */ p("option", {
44
+ value: c,
45
+ children: j
46
+ }), h.map((e) => /* @__PURE__ */ p("option", {
47
+ value: e.value,
48
+ children: e.label
49
+ }, e.value))]
50
+ })
51
+ }), /* @__PURE__ */ p("button", {
52
+ type: "button",
53
+ className: "aria-pressed:border-primary-500 aria-pressed:text-primary-600 dark:aria-pressed:text-primary-300 flex h-7 w-7 shrink-0 cursor-pointer items-center justify-center rounded-md border border-gray-200 text-zinc-500 hover:text-zinc-900 dark:border-zinc-700 dark:text-zinc-400 dark:hover:text-zinc-100",
54
+ "aria-pressed": v,
55
+ title: v ? "Hide the curve" : "Edit the curve",
56
+ "aria-label": v ? "Hide the curve" : "Edit the curve",
57
+ onClick: k,
58
+ children: /* @__PURE__ */ p("i", { className: "fa-solid fa-bezier-curve text-xs" })
59
+ })]
60
+ }),
61
+ v && !w && /* @__PURE__ */ m("p", {
62
+ className: "m-0 text-[11px] text-zinc-500 dark:text-zinc-400",
63
+ children: [c, " is not a curve, so there is nothing to drag. Pick a preset to start from one."]
64
+ }),
65
+ v && w && /* @__PURE__ */ m("div", {
66
+ className: "flex flex-col items-center gap-2 rounded-md border border-gray-200 p-2 dark:border-zinc-700",
67
+ children: [
68
+ /* @__PURE__ */ p(n, {
69
+ value: w,
70
+ progress: S,
71
+ width: 200,
72
+ height: 200,
73
+ handleRadius: 6,
74
+ onChange: O
75
+ }),
76
+ /* @__PURE__ */ m("button", {
77
+ type: "button",
78
+ className: "flex cursor-pointer items-center gap-1.5 text-xs text-zinc-600 hover:text-zinc-900 dark:text-zinc-300 dark:hover:text-zinc-100",
79
+ onClick: A,
80
+ children: [/* @__PURE__ */ p("i", { className: b ? "fa-solid fa-pause" : "fa-solid fa-play" }), b ? "Pause preview" : "Preview"]
81
+ }),
82
+ /* @__PURE__ */ p(t, {
83
+ className: "w-full border-r-0",
84
+ onChange: D
85
+ })
86
+ ]
87
+ })
88
+ ]
89
+ });
90
+ };
91
+ //#endregion
92
+ export { _ as default };
@@ -1,8 +1,8 @@
1
- import { MouseEvent } from 'react';
2
1
  export type TransitionItemProps = {
3
- value?: string;
4
- onChange?: (value: string) => void;
5
- onRemove?: (e: MouseEvent) => void;
2
+ value: string;
3
+ onChange: (value: string) => void;
4
+ onRemove: () => void;
6
5
  };
6
+ /** One transition of the list. One the editor cannot read as parts — a token for it — is edited as written. */
7
7
  declare const TransitionItem: ({ value, onRemove, onChange }: TransitionItemProps) => import('react').JSX.Element;
8
8
  export default TransitionItem;
@@ -1,365 +1,84 @@
1
- import { easingGenerics as e } from "../../../../InputEasing/InputEasingHelper.mjs";
2
- import t from "../../../../InputEasing/InputEasingList.mjs";
3
- import n from "../../../../InputEasing/index.mjs";
4
- import r from "../../../components/InspectorLabel/index.mjs";
5
- import i from "../../../components/CategoryOption/index.mjs";
6
- import a from "../../../components/CategorySection/index.mjs";
7
- import { useCallback as o, useRef as s, useState as c } from "react";
8
- import { jsx as l, jsxs as u } from "react/jsx-runtime";
9
- import d from "@plitzi/plitzi-ui/ContainerFloating";
10
- import f from "@plitzi/plitzi-ui/Icon";
11
- import p from "@plitzi/plitzi-ui/Input";
12
- import m from "@plitzi/plitzi-ui/icons/EffectsTransitionEase";
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 { TRANSITION_PROPERTY_GROUPS as r, isListedProperty as i, parseTransition as a, serializeTransition as o, transitionSummary as s } from "./helpers.mjs";
5
+ import c from "./TransitionEasing.mjs";
6
+ import { useCallback as l, useRef as u } from "react";
7
+ import { Fragment as d, jsx as f, jsxs as p } from "react/jsx-runtime";
13
8
  //#region src/components/StyleInspector/categories/Effects/Transition/TransitionItem.tsx
14
- var h = ({ value: h = "", onRemove: g, onChange: _ }) => {
15
- let [v, y] = c(0), [b, x] = c(void 0), S = () => {
16
- if (b) {
17
- clearInterval(b), x(void 0), y(0);
18
- return;
19
- }
20
- x(setInterval(() => {
21
- y((e) => (e + .005 <= 1 ? e += .005 : e = 0, e));
22
- }, 10));
23
- }, C = h.split(/ (?![^()]*\))/gim), { property: w = "opacity", duration: T = "0ms", easing: E = "ease", delay: D = "0ms" } = {};
24
- C.length === 4 && ([w, T, E, D] = C);
25
- let O = s({
26
- property: w,
27
- duration: T,
28
- easing: E,
29
- delay: D
30
- });
31
- O.current = {
32
- property: w,
33
- duration: T,
34
- easing: E,
35
- delay: D
36
- };
37
- let k = o((e) => (t) => {
38
- let n = { ...O.current };
39
- if (e === "easing" && t.includes(",")) {
40
- let r = t.split(",");
41
- n[e] = `cubic-bezier(${r[0]}, ${r[1]}, ${r[2]}, ${r[3]})`;
42
- } else n[e] = e === "easing" && Array.isArray(t) ? `cubic-bezier(${t[0]}, ${t[1]}, ${t[2]}, ${t[3]})` : t;
43
- let { duration: r, delay: i, property: a, easing: o } = n;
44
- _?.(`${a} ${r} ${o} ${i}`);
45
- }, [_]), A = o((e) => k("easing")(e), [k]), j = [];
46
- return j = E in e ? e[E] : E.match(/[0-9.]+/gim), /* @__PURE__ */ u(d, {
47
- className: "w-full",
48
- closeOnClick: !1,
49
- containerTopOffset: 5,
50
- children: [/* @__PURE__ */ u(d.Trigger, {
51
- 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",
52
- children: [/* @__PURE__ */ l("div", {
53
- className: "flex items-center",
54
- children: `${w} ${T} after ${D}`
55
- }), /* @__PURE__ */ l("div", {
56
- className: "flex",
57
- children: /* @__PURE__ */ l(f, {
58
- size: "xs",
59
- icon: "fas fa-trash-alt",
60
- onClick: g,
61
- intent: "danger",
62
- title: "Remove"
63
- })
64
- })]
65
- }), /* @__PURE__ */ l(d.Content, {
66
- className: "w-[260px]",
67
- children: /* @__PURE__ */ u("div", {
68
- className: "flex w-full flex-col gap-2 p-2",
69
- children: [
70
- /* @__PURE__ */ l(a, {
71
- label: "Property",
72
- children: /* @__PURE__ */ u(i, {
73
- onChange: k("property"),
74
- type: "select",
75
- value: w,
76
- children: [
77
- /* @__PURE__ */ u("optgroup", {
78
- label: "Common",
79
- children: [
80
- /* @__PURE__ */ l("option", {
81
- value: "opacity",
82
- children: "Opacity"
83
- }),
84
- /* @__PURE__ */ l("option", {
85
- value: "margin",
86
- children: "Margin"
87
- }),
88
- /* @__PURE__ */ l("option", {
89
- value: "padding",
90
- children: "Padding"
91
- }),
92
- /* @__PURE__ */ l("option", {
93
- value: "border",
94
- children: "Border"
95
- }),
96
- /* @__PURE__ */ l("option", {
97
- value: "transform",
98
- children: "Transform"
99
- }),
100
- /* @__PURE__ */ l("option", {
101
- value: "filter",
102
- children: "Filter"
103
- }),
104
- /* @__PURE__ */ l("option", {
105
- value: "flex",
106
- children: "Flex"
107
- })
108
- ]
109
- }),
110
- /* @__PURE__ */ u("optgroup", {
111
- label: "Background",
112
- children: [
113
- /* @__PURE__ */ l("option", {
114
- value: "background-color",
115
- children: "Background Color"
116
- }),
117
- /* @__PURE__ */ l("option", {
118
- value: "background-position",
119
- children: "Background Position"
120
- }),
121
- /* @__PURE__ */ l("option", {
122
- value: "text-shadow",
123
- children: "Text Shadow"
124
- }),
125
- /* @__PURE__ */ l("option", {
126
- value: "box-shadow",
127
- children: "Box Shadow"
128
- })
129
- ]
130
- }),
131
- /* @__PURE__ */ u("optgroup", {
132
- label: "Size",
133
- children: [
134
- /* @__PURE__ */ l("option", {
135
- value: "width",
136
- children: "Width"
137
- }),
138
- /* @__PURE__ */ l("option", {
139
- value: "height",
140
- children: "Height"
141
- }),
142
- /* @__PURE__ */ l("option", {
143
- value: "max-width",
144
- children: "Max Width"
145
- }),
146
- /* @__PURE__ */ l("option", {
147
- value: "max-height",
148
- children: "Max Height"
149
- }),
150
- /* @__PURE__ */ l("option", {
151
- value: "min-width",
152
- children: "Min Width"
153
- }),
154
- /* @__PURE__ */ l("option", {
155
- value: "min-height",
156
- children: "Min Height"
157
- })
158
- ]
159
- }),
160
- /* @__PURE__ */ u("optgroup", {
161
- label: "Borders",
162
- children: [
163
- /* @__PURE__ */ l("option", {
164
- value: "border-radius",
165
- children: "Border Radius"
166
- }),
167
- /* @__PURE__ */ l("option", {
168
- value: "border-color",
169
- children: "Border Color"
170
- }),
171
- /* @__PURE__ */ l("option", {
172
- value: "border-width",
173
- children: "Border Width"
174
- })
175
- ]
176
- }),
177
- /* @__PURE__ */ u("optgroup", {
178
- label: "Typography",
179
- children: [
180
- /* @__PURE__ */ l("option", {
181
- value: "font-color",
182
- children: "Font Color"
183
- }),
184
- /* @__PURE__ */ l("option", {
185
- value: "font-size",
186
- children: "Font Size"
187
- }),
188
- /* @__PURE__ */ l("option", {
189
- value: "line-height",
190
- children: "Line Height"
191
- }),
192
- /* @__PURE__ */ l("option", {
193
- value: "letter-spacing",
194
- children: "Letter Spacing"
195
- }),
196
- /* @__PURE__ */ l("option", {
197
- value: "text-indent",
198
- children: "Text Indent"
199
- }),
200
- /* @__PURE__ */ l("option", {
201
- value: "word-spacing",
202
- children: "Word Spacing"
203
- })
204
- ]
205
- }),
206
- /* @__PURE__ */ u("optgroup", {
207
- label: "Position",
208
- children: [
209
- /* @__PURE__ */ l("option", {
210
- value: "top",
211
- children: "Top"
212
- }),
213
- /* @__PURE__ */ l("option", {
214
- value: "left",
215
- children: "Left"
216
- }),
217
- /* @__PURE__ */ l("option", {
218
- value: "bottom",
219
- children: "Bottom"
220
- }),
221
- /* @__PURE__ */ l("option", {
222
- value: "right",
223
- children: "Right"
224
- }),
225
- /* @__PURE__ */ l("option", {
226
- value: "z-index",
227
- children: "Z Index"
228
- })
229
- ]
230
- }),
231
- /* @__PURE__ */ u("optgroup", {
232
- label: "Margin",
233
- children: [
234
- /* @__PURE__ */ l("option", {
235
- value: "margin-bottom",
236
- children: "Margin Bottom"
237
- }),
238
- /* @__PURE__ */ l("option", {
239
- value: "margin-left",
240
- children: "Margin Left"
241
- }),
242
- /* @__PURE__ */ l("option", {
243
- value: "margin-right",
244
- children: "Margin RIght"
245
- }),
246
- /* @__PURE__ */ l("option", {
247
- value: "margin-top",
248
- children: "Margin Top"
249
- })
250
- ]
251
- }),
252
- /* @__PURE__ */ u("optgroup", {
253
- label: "Padding",
254
- children: [
255
- /* @__PURE__ */ l("option", {
256
- value: "padding-bottom",
257
- children: "Padding Bottom"
258
- }),
259
- /* @__PURE__ */ l("option", {
260
- value: "padding-left",
261
- children: "Padding Left"
262
- }),
263
- /* @__PURE__ */ l("option", {
264
- value: "padding-right",
265
- children: "Padding Right"
266
- }),
267
- /* @__PURE__ */ l("option", {
268
- value: "padding-top",
269
- children: "Padding Top"
270
- })
271
- ]
272
- }),
273
- /* @__PURE__ */ u("optgroup", {
274
- label: "Flex",
275
- children: [
276
- /* @__PURE__ */ l("option", {
277
- value: "flex-grow",
278
- children: "Flex Grow"
279
- }),
280
- /* @__PURE__ */ l("option", {
281
- value: "flex-shrink",
282
- children: "Flex Shrink"
283
- }),
284
- /* @__PURE__ */ l("option", {
285
- value: "flex-basis",
286
- children: "Flex Basis"
287
- })
288
- ]
289
- }),
290
- /* @__PURE__ */ l("optgroup", {
291
- label: "Advanced",
292
- children: /* @__PURE__ */ l("option", {
293
- value: "all",
294
- children: "All Properties"
295
- })
296
- })
297
- ]
298
- })
299
- }),
300
- /* @__PURE__ */ u(a, { children: [/* @__PURE__ */ l(i, {
301
- label: "Duration",
302
- value: T,
303
- onChange: k("duration"),
304
- type: "metric",
305
- units: [{
306
- label: "MS",
307
- value: "ms"
308
- }],
309
- min: 0
310
- }), /* @__PURE__ */ l(i, {
311
- label: "Delay",
312
- value: D,
313
- onChange: k("delay"),
314
- type: "metric",
315
- units: [{
316
- label: "MS",
317
- value: "ms"
318
- }],
319
- min: 0
320
- })] }),
321
- /* @__PURE__ */ u(a, {
322
- label: "Easing",
323
- children: [/* @__PURE__ */ u(d, {
324
- containerLeftOffset: -92,
325
- containerTopOffset: 154,
326
- closeOnClick: !1,
327
- children: [/* @__PURE__ */ l(d.Trigger, { children: /* @__PURE__ */ l(f, {
328
- className: "rounded-sm border border-gray-300 p-0.5 dark:border-zinc-600",
329
- size: "xl",
330
- children: /* @__PURE__ */ l(m, {})
331
- }) }), /* @__PURE__ */ u(d.Content, {
332
- className: "flex h-[456px] w-[260px] flex-col items-center overflow-y-auto",
333
- children: [/* @__PURE__ */ l(t, {
334
- className: "w-[260px]",
335
- onChange: k("easing")
336
- }), /* @__PURE__ */ u("div", {
337
- className: "m-2 flex flex-col",
338
- children: [/* @__PURE__ */ u("div", {
339
- className: "flex",
340
- onClick: S,
341
- children: [/* @__PURE__ */ l(f, { icon: b ? "fas fa-pause" : "fas fa-play" }), /* @__PURE__ */ l(r, { children: b ? "Pause" : "Play" })]
342
- }), /* @__PURE__ */ l(n, {
343
- value: j,
344
- progress: v,
345
- height: 200,
346
- width: 200,
347
- handleRadius: 6
348
- })]
349
- })]
350
- })]
351
- }), /* @__PURE__ */ l(p, {
352
- className: "w-full grow",
353
- type: "text",
354
- size: "xs",
355
- value: j.toString(),
356
- readOnly: !0,
357
- onChange: A
358
- })]
9
+ var m = [{
10
+ label: "MS",
11
+ value: "ms"
12
+ }, {
13
+ label: "S",
14
+ value: "s"
15
+ }], h = ({ value: h, onRemove: g, onChange: _ }) => {
16
+ let v = a(h), y = u(v);
17
+ y.current = v;
18
+ let b = l((t) => (n) => {
19
+ let r = y.current;
20
+ r && _(o({
21
+ ...r,
22
+ [t]: e(n)
23
+ }));
24
+ }, [_]), x = l((e) => b("easing")(e), [b]), S = l((t) => _(e(t)), [_]), C = v ? s(v) : h;
25
+ return /* @__PURE__ */ p(n, {
26
+ summary: C,
27
+ title: "Transition",
28
+ removeLabel: "Remove transition",
29
+ onRemove: g,
30
+ children: [
31
+ !v && /* @__PURE__ */ p(d, { children: [/* @__PURE__ */ f(t, {
32
+ label: "Value",
33
+ type: "input",
34
+ value: h,
35
+ onChange: S
36
+ }), /* @__PURE__ */ f("p", {
37
+ className: "m-0 text-[11px] text-zinc-500 dark:text-zinc-400",
38
+ children: "Not a single transition the editor can split into parts (a token, for one), so it is edited as written."
39
+ })] }),
40
+ v && /* @__PURE__ */ p(t, {
41
+ label: "Property",
42
+ type: "select",
43
+ value: v.property,
44
+ onChange: b("property"),
45
+ children: [!i(v.property) && /* @__PURE__ */ f("optgroup", {
46
+ label: "Current",
47
+ children: /* @__PURE__ */ f("option", {
48
+ value: v.property,
49
+ children: v.property
359
50
  })
360
- ]
51
+ }), r.map((e) => /* @__PURE__ */ f("optgroup", {
52
+ label: e.label,
53
+ children: e.options.map((e) => /* @__PURE__ */ f("option", {
54
+ value: e.value,
55
+ children: e.label
56
+ }, e.value))
57
+ }, e.label))]
58
+ }),
59
+ v && /* @__PURE__ */ p("div", {
60
+ className: "grid grid-cols-2 gap-2",
61
+ children: [/* @__PURE__ */ f(t, {
62
+ label: "Duration",
63
+ type: "metric",
64
+ value: v.duration,
65
+ units: m,
66
+ min: 0,
67
+ onChange: b("duration")
68
+ }), /* @__PURE__ */ f(t, {
69
+ label: "Delay",
70
+ type: "metric",
71
+ value: v.delay,
72
+ units: m,
73
+ min: -Infinity,
74
+ onChange: b("delay")
75
+ })]
76
+ }),
77
+ v && /* @__PURE__ */ f(c, {
78
+ value: v.easing,
79
+ onChange: x
361
80
  })
362
- })]
81
+ ]
363
82
  });
364
83
  };
365
84
  //#endregion
@@ -0,0 +1,39 @@
1
+ /** One transition of a `transition` list, its parts named. */
2
+ export type TransitionValue = {
3
+ property: string;
4
+ duration: string;
5
+ easing: string;
6
+ delay: string;
7
+ };
8
+ export declare const DEFAULT_TRANSITION: TransitionValue;
9
+ /**
10
+ * A transition as CSS allows it to be written: the parts in any order, any of them left out — the first time is the
11
+ * duration and the second the delay, an easing keyword or function is the easing, and what is left is the property.
12
+ * Anything else (a token for the whole transition) answers `undefined` and is kept as text.
13
+ */
14
+ export declare const parseTransition: (value: string) => TransitionValue | undefined;
15
+ /** How a row names a transition: what it animates and for how long, and its delay when it has one. */
16
+ export declare const transitionSummary: ({ property, duration, delay }: TransitionValue) => string;
17
+ export declare const serializeTransition: ({ property, duration, easing, delay }: TransitionValue) => string;
18
+ type Bezier = [number, number, number, number];
19
+ export declare const bezierCss: ([x1, y1, x2, y2]: Bezier) => string;
20
+ /**
21
+ * An easing preset as CSS can read it. The presets' own names (`easeInQuad`) are not CSS — written as they were, they
22
+ * made the browser drop the whole `transition` — so only CSS's five keywords stay as words.
23
+ */
24
+ export declare const easingCss: (name: string, presets: Record<string, Bezier>) => string;
25
+ export type EasingOption = {
26
+ label: string;
27
+ value: string;
28
+ };
29
+ /** Every preset as the easing picker offers it: its name for a person, its value for the stylesheet. */
30
+ export declare const easingOptions: (presets: Record<string, Bezier>) => EasingOption[];
31
+ /** The curve an easing draws, for the editor — `undefined` for one that is not a curve (`steps(4)`). */
32
+ export declare const easingCurve: (easing: string, presets: Record<string, Bezier>) => Bezier | undefined;
33
+ /** The properties the picker offers, grouped. One a transition names that is not here is offered on its own. */
34
+ export declare const TRANSITION_PROPERTY_GROUPS: {
35
+ label: string;
36
+ options: EasingOption[];
37
+ }[];
38
+ export declare const isListedProperty: (property: string) => boolean;
39
+ export {};