@weasel-js/ui 1.7.3 → 1.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (155) hide show
  1. package/dist/chunks/{Callout-BUn0dP_S.js → Callout-DpTO3fkb.js} +10 -10
  2. package/dist/chunks/Callout-DpTO3fkb.js.map +1 -0
  3. package/dist/chunks/{Checkbox-DFn-x0JO.js → Checkbox-d4IfhiXh.js} +2 -2
  4. package/dist/chunks/{Checkbox-DFn-x0JO.js.map → Checkbox-d4IfhiXh.js.map} +1 -1
  5. package/dist/chunks/{CloseButton-BmNmRVtb.js → CloseButton-wb7Or5Eg.js} +2 -2
  6. package/dist/chunks/{CloseButton-BmNmRVtb.js.map → CloseButton-wb7Or5Eg.js.map} +1 -1
  7. package/dist/chunks/{ColorModeControl-DaVJ-SyX.js → ColorModeControl-DET6Itwq.js} +3 -3
  8. package/dist/chunks/{ColorModeControl-DaVJ-SyX.js.map → ColorModeControl-DET6Itwq.js.map} +1 -1
  9. package/dist/chunks/{DataGrid-CmHJe57v.js → DataGrid-B6IS9vUk.js} +2 -2
  10. package/dist/chunks/{DataGrid-CmHJe57v.js.map → DataGrid-B6IS9vUk.js.map} +1 -1
  11. package/dist/chunks/{DetentSlider-DNTAk8xP.js → DetentSlider-D40V8Oma.js} +2 -2
  12. package/dist/chunks/{DetentSlider-DNTAk8xP.js.map → DetentSlider-D40V8Oma.js.map} +1 -1
  13. package/dist/chunks/{Dialog-DKfsk5VN.js → Dialog-h-5MeYpu.js} +9 -9
  14. package/dist/chunks/{Dialog-DKfsk5VN.js.map → Dialog-h-5MeYpu.js.map} +1 -1
  15. package/dist/chunks/{Disclosure-Ch2KxYuB.js → Disclosure-CpWt87nO.js} +7 -7
  16. package/dist/chunks/{Disclosure-Ch2KxYuB.js.map → Disclosure-CpWt87nO.js.map} +1 -1
  17. package/dist/chunks/FitLabel-BzZGkWfL.js +76 -0
  18. package/dist/chunks/FitLabel-BzZGkWfL.js.map +1 -0
  19. package/dist/chunks/{GradientEditor-DD2OjQtn.js → GradientEditor-vz771M-N.js} +4 -4
  20. package/dist/chunks/{GradientEditor-DD2OjQtn.js.map → GradientEditor-vz771M-N.js.map} +1 -1
  21. package/dist/chunks/{Icon--B1ME-6c.js → Icon-DPRUIo3G.js} +4 -1
  22. package/dist/chunks/Icon-DPRUIo3G.js.map +1 -0
  23. package/dist/chunks/{Jog-BrkzdGV2.js → Jog-TE6QI9i1.js} +3 -3
  24. package/dist/chunks/{Jog-BrkzdGV2.js.map → Jog-TE6QI9i1.js.map} +1 -1
  25. package/dist/chunks/{LayerList-BqeWFuGc.js → LayerList-BXTAjK-4.js} +6 -6
  26. package/dist/chunks/{LayerList-BqeWFuGc.js.map → LayerList-BXTAjK-4.js.map} +1 -1
  27. package/dist/chunks/{ListEditor-OQDzG4A5.js → ListEditor-DGtwj99m.js} +2 -2
  28. package/dist/chunks/{ListEditor-OQDzG4A5.js.map → ListEditor-DGtwj99m.js.map} +1 -1
  29. package/dist/chunks/{MeshEditor-DWpvg8H6.js → MeshEditor-8CRsu-Td.js} +2 -2
  30. package/dist/chunks/{MeshEditor-DWpvg8H6.js.map → MeshEditor-8CRsu-Td.js.map} +1 -1
  31. package/dist/chunks/{NumberField-DS0WSiin.js → NumberField-BXFrOi5M.js} +8 -5
  32. package/dist/chunks/{NumberField-DS0WSiin.js.map → NumberField-BXFrOi5M.js.map} +1 -1
  33. package/dist/chunks/{PaintField-BdmQM53v.js → PaintField-DX4uYlF9.js} +2 -2
  34. package/dist/chunks/{PaintField-BdmQM53v.js.map → PaintField-DX4uYlF9.js.map} +1 -1
  35. package/dist/chunks/{PaintInput-DaQMeBsI.js → PaintInput-CWyOJXUM.js} +5 -5
  36. package/dist/chunks/{PaintInput-DaQMeBsI.js.map → PaintInput-CWyOJXUM.js.map} +1 -1
  37. package/dist/chunks/{PatternPicker-B3HcMZWg.js → PatternPicker-0j51aDJ3.js} +9 -9
  38. package/dist/chunks/PatternPicker-0j51aDJ3.js.map +1 -0
  39. package/dist/chunks/{Prefs-BnVEyfWO.js → Prefs-gbjYqvSD.js} +41 -41
  40. package/dist/chunks/Prefs-gbjYqvSD.js.map +1 -0
  41. package/dist/chunks/{Properties-BoG2MMHR.js → Properties-BbNuMiic.js} +4 -4
  42. package/dist/chunks/{Properties-BoG2MMHR.js.map → Properties-BbNuMiic.js.map} +1 -1
  43. package/dist/chunks/PropertyField-CWUtNK1w.js +751 -0
  44. package/dist/chunks/PropertyField-CWUtNK1w.js.map +1 -0
  45. package/dist/chunks/{SelectionPanel-COZ6z9_P.js → SelectionPanel-BpUqP75b.js} +2 -2
  46. package/dist/chunks/{SelectionPanel-COZ6z9_P.js.map → SelectionPanel-BpUqP75b.js.map} +1 -1
  47. package/dist/chunks/{SidebarPanel-AXQ0jRDx.js → SidebarPanel--dJ-k9-V.js} +3 -3
  48. package/dist/chunks/{SidebarPanel-AXQ0jRDx.js.map → SidebarPanel--dJ-k9-V.js.map} +1 -1
  49. package/dist/chunks/Slider-CHBQ8uUC.js +439 -0
  50. package/dist/chunks/Slider-CHBQ8uUC.js.map +1 -0
  51. package/dist/chunks/{SwatchGrid-9ZPiDmxd.js → SwatchGrid-DxK9e_IV.js} +3 -3
  52. package/dist/chunks/SwatchGrid-DxK9e_IV.js.map +1 -0
  53. package/dist/chunks/{SwatchStrip-Bi9iPLoh.js → SwatchStrip-BY6A511W.js} +2 -2
  54. package/dist/chunks/{SwatchStrip-Bi9iPLoh.js.map → SwatchStrip-BY6A511W.js.map} +1 -1
  55. package/dist/chunks/{ThemeSwitcher-DiBmMh_B.js → ThemeSwitcher-tnATkIo1.js} +2 -2
  56. package/dist/chunks/{ThemeSwitcher-DiBmMh_B.js.map → ThemeSwitcher-tnATkIo1.js.map} +1 -1
  57. package/dist/chunks/{Timeline-sMCH2fah.js → Timeline-FlLUm8nd.js} +4 -4
  58. package/dist/chunks/{Timeline-sMCH2fah.js.map → Timeline-FlLUm8nd.js.map} +1 -1
  59. package/dist/chunks/{Toast-C3ozq11V.js → Toast-CuHkT0x0.js} +2 -2
  60. package/dist/chunks/{Toast-C3ozq11V.js.map → Toast-CuHkT0x0.js.map} +1 -1
  61. package/dist/chunks/ToggleBar-BZ4Gk1IU.js +84 -0
  62. package/dist/chunks/ToggleBar-BZ4Gk1IU.js.map +1 -0
  63. package/dist/chunks/{TokenPanel-WtKGY2Db.js → TokenPanel-DongdiZM.js} +23 -23
  64. package/dist/chunks/{TokenPanel-WtKGY2Db.js.map → TokenPanel-DongdiZM.js.map} +1 -1
  65. package/dist/chunks/ToolOptionsBar-wTPJFfOn.js +94 -0
  66. package/dist/chunks/ToolOptionsBar-wTPJFfOn.js.map +1 -0
  67. package/dist/chunks/{Tree-Cc8lIzgM.js → Tree-hzIbj2q1.js} +2 -2
  68. package/dist/chunks/{Tree-Cc8lIzgM.js.map → Tree-hzIbj2q1.js.map} +1 -1
  69. package/dist/chunks/checkbox.module-Dcx8ILgR.js +5 -0
  70. package/dist/chunks/checkbox.module-Dcx8ILgR.js.map +1 -0
  71. package/dist/chunks/{icons-Dr2-r30x.js → icons-CofIOTiI.js} +2 -2
  72. package/dist/chunks/{icons-Dr2-r30x.js.map → icons-CofIOTiI.js.map} +1 -1
  73. package/dist/chunks/{model-B6zuQg6b.js → model-qQj8Ny9w.js} +134 -133
  74. package/dist/chunks/model-qQj8Ny9w.js.map +1 -0
  75. package/dist/chunks/{prefField-BE_Ytr2H.js → prefField-CCm_nzlM.js} +81 -75
  76. package/dist/chunks/prefField-CCm_nzlM.js.map +1 -0
  77. package/dist/components/Callout/index.js +1 -1
  78. package/dist/components/Checkbox/index.js +1 -1
  79. package/dist/components/CloseButton/index.js +1 -1
  80. package/dist/components/ColorModeControl/index.js +1 -1
  81. package/dist/components/DataGrid/index.js +1 -1
  82. package/dist/components/DetentSlider/index.js +1 -1
  83. package/dist/components/Dialog/index.js +1 -1
  84. package/dist/components/Disclosure/index.js +1 -1
  85. package/dist/components/FitLabel/FitLabel.d.ts +41 -0
  86. package/dist/components/FitLabel/FitLabel.d.ts.map +1 -0
  87. package/dist/components/FitLabel/index.d.ts +3 -0
  88. package/dist/components/FitLabel/index.d.ts.map +1 -0
  89. package/dist/components/FitLabel/index.js +2 -0
  90. package/dist/components/GradientEditor/index.js +1 -1
  91. package/dist/components/InlineRange/InlineRange.d.ts +1 -1
  92. package/dist/components/Jog/index.js +1 -1
  93. package/dist/components/LayerList/index.js +1 -1
  94. package/dist/components/ListEditor/index.js +1 -1
  95. package/dist/components/MeshEditor/index.js +1 -1
  96. package/dist/components/NumberField/UnitField.d.ts.map +1 -1
  97. package/dist/components/NumberField/index.js +1 -1
  98. package/dist/components/PaintField/index.js +1 -1
  99. package/dist/components/PaintInput/index.js +1 -1
  100. package/dist/components/PatternPicker/index.js +1 -1
  101. package/dist/components/Prefs/index.js +2 -2
  102. package/dist/components/Prefs/prefField.d.ts.map +1 -1
  103. package/dist/components/Properties/NumberControls.d.ts +16 -0
  104. package/dist/components/Properties/NumberControls.d.ts.map +1 -0
  105. package/dist/components/Properties/PropertyField.d.ts +18 -8
  106. package/dist/components/Properties/PropertyField.d.ts.map +1 -1
  107. package/dist/components/Properties/index.js +2 -2
  108. package/dist/components/SelectionPanel/index.js +2 -2
  109. package/dist/components/SelectionPanel/renderLeaf.d.ts.map +1 -1
  110. package/dist/components/SidebarPanel/index.js +1 -1
  111. package/dist/components/Slider/Slider.d.ts +6 -0
  112. package/dist/components/Slider/Slider.d.ts.map +1 -1
  113. package/dist/components/Slider/index.js +1 -1
  114. package/dist/components/SwatchGrid/index.js +1 -1
  115. package/dist/components/SwatchStrip/index.js +1 -1
  116. package/dist/components/ThemeSwitcher/index.js +1 -1
  117. package/dist/components/Timeline/index.js +1 -1
  118. package/dist/components/Toast/index.js +1 -1
  119. package/dist/components/ToggleBar/ToggleBar.d.ts.map +1 -1
  120. package/dist/components/ToggleBar/index.js +1 -1
  121. package/dist/components/TokenPanel/index.js +1 -1
  122. package/dist/components/ToolOptionsBar/ToolOptionsBar.d.ts +1 -1
  123. package/dist/components/ToolOptionsBar/ToolOptionsBar.d.ts.map +1 -1
  124. package/dist/components/ToolOptionsBar/index.js +1 -1
  125. package/dist/components/Tree/index.js +1 -1
  126. package/dist/components/stanceCss.d.ts +6 -0
  127. package/dist/components/stanceCss.d.ts.map +1 -1
  128. package/dist/components/stanceSurfaces.d.ts.map +1 -1
  129. package/dist/endless.d.ts +7 -0
  130. package/dist/endless.d.ts.map +1 -0
  131. package/dist/icons/paths.d.ts +2 -0
  132. package/dist/icons/paths.d.ts.map +1 -1
  133. package/dist/index.d.ts +1 -0
  134. package/dist/index.d.ts.map +1 -1
  135. package/dist/index.js +72 -70
  136. package/dist/index.js.map +1 -1
  137. package/dist/style.css +1 -1
  138. package/package.json +9 -9
  139. package/dist/chunks/Callout-BUn0dP_S.js.map +0 -1
  140. package/dist/chunks/Icon--B1ME-6c.js.map +0 -1
  141. package/dist/chunks/PatternPicker-B3HcMZWg.js.map +0 -1
  142. package/dist/chunks/Prefs-BnVEyfWO.js.map +0 -1
  143. package/dist/chunks/PropertyField-PMrqBA0n.js +0 -743
  144. package/dist/chunks/PropertyField-PMrqBA0n.js.map +0 -1
  145. package/dist/chunks/Slider-DSrlMEq8.js +0 -389
  146. package/dist/chunks/Slider-DSrlMEq8.js.map +0 -1
  147. package/dist/chunks/SwatchGrid-9ZPiDmxd.js.map +0 -1
  148. package/dist/chunks/ToggleBar-Z2jZiguF.js +0 -80
  149. package/dist/chunks/ToggleBar-Z2jZiguF.js.map +0 -1
  150. package/dist/chunks/ToolOptionsBar-BJKwnemU.js +0 -88
  151. package/dist/chunks/ToolOptionsBar-BJKwnemU.js.map +0 -1
  152. package/dist/chunks/checkbox.module-DLQV9tMX.js +0 -5
  153. package/dist/chunks/checkbox.module-DLQV9tMX.js.map +0 -1
  154. package/dist/chunks/model-B6zuQg6b.js.map +0 -1
  155. package/dist/chunks/prefField-BE_Ytr2H.js.map +0 -1
@@ -0,0 +1,751 @@
1
+ import { t as e } from "./dlog-F0I8KsIW.js";
2
+ import { n as t, r as n } from "./Tooltip-C6eFCYxw.js";
3
+ import { t as r } from "./stance-BFQpS_fL.js";
4
+ import { n as i } from "./InlineRange-DPjIsJB3.js";
5
+ import { t as a } from "./ColorField-BwlelY26.js";
6
+ import { t as o } from "./Select-ouV8O6cp.js";
7
+ import { t as s } from "./FontFamilySelect-DEvMXyZd.js";
8
+ import { t as c } from "./FontWeightSelect-BLQ_LMJF.js";
9
+ import { t as l } from "./Input-D7SDKbST.js";
10
+ import { r as u } from "./Slider-CHBQ8uUC.js";
11
+ import { t as d } from "./ToggleBar-BZ4Gk1IU.js";
12
+ import { r as f, t as p } from "./FitLabel-BzZGkWfL.js";
13
+ import { n as m, t as h } from "./NumberField-BXFrOi5M.js";
14
+ import { t as g } from "./PaintInput-CWyOJXUM.js";
15
+ import { t as _ } from "./PaintField-DX4uYlF9.js";
16
+ import { n as v, t as y } from "./RadioGroup-B70_M-gT.js";
17
+ import { t as b } from "./Switch-CSYmcM8y.js";
18
+ import { t as x } from "./checkbox.module-Dcx8ILgR.js";
19
+ import { getAlpha01 as S, toHex8 as C, withAlpha01 as w } from "@weasel-js/core";
20
+ import { Fragment as T, jsx as E, jsxs as D } from "react/jsx-runtime";
21
+ import { createContext as O, forwardRef as k, useContext as ee, useEffect as A, useId as te, useLayoutEffect as ne, useRef as j, useState as M } from "react";
22
+ import { Focusable as re } from "react-aria-components";
23
+ import { decimal as ie, parseAs as ae, qty as N } from "@weasel-js/quantity";
24
+ var P = {
25
+ panel: "_panel_8l6g6_9",
26
+ list: "_list_8l6g6_3",
27
+ row: "_row_8l6g6_4",
28
+ group: "_group_8l6g6_4",
29
+ subpanel: "_subpanel_8l6g6_3",
30
+ card: "_card_8l6g6_37",
31
+ cardList: "_cardList_8l6g6_37",
32
+ readout: "_readout_8l6g6_42 _numeric_zns9n_4",
33
+ readoutInput: "_readoutInput_8l6g6_43 _numeric_zns9n_4",
34
+ panelTitle: "_panelTitle_8l6g6_72",
35
+ panelHeader: "_panelHeader_8l6g6_84",
36
+ panelActions: "_panelActions_8l6g6_97",
37
+ listPairs: "_listPairs_8l6g6_3",
38
+ rowColor: "_rowColor_8l6g6_4",
39
+ span: "_span_8l6g6_509",
40
+ listOneUp: "_listOneUp_8l6g6_517",
41
+ densityTight: "_densityTight_8l6g6_528",
42
+ densityNormal: "_densityNormal_8l6g6_540",
43
+ densityRoomy: "_densityRoomy_8l6g6_552",
44
+ alignStart: "_alignStart_8l6g6_578",
45
+ alignCenter: "_alignCenter_8l6g6_584",
46
+ alignEnd: "_alignEnd_8l6g6_590",
47
+ alignBaseline: "_alignBaseline_8l6g6_596",
48
+ rowInline: "_rowInline_8l6g6_627",
49
+ rowLabel: "_rowLabel_8l6g6_633",
50
+ rowBlock: "_rowBlock_8l6g6_658",
51
+ rowCheckbox: "_rowCheckbox_8l6g6_659",
52
+ readoutAfter: "_readoutAfter_8l6g6_678",
53
+ readoutText: "_readoutText_8l6g6_689 _numeric_zns9n_4",
54
+ help: "_help_8l6g6_703",
55
+ autoToggle: "_autoToggle_8l6g6_737",
56
+ readoutGroup: "_readoutGroup_8l6g6_684",
57
+ readoutUnit: "_readoutUnit_8l6g6_816",
58
+ fieldUnitGroup: "_fieldUnitGroup_8l6g6_841",
59
+ numberField: "_numberField_8l6g6_849",
60
+ colorField: "_colorField_8l6g6_902",
61
+ toggleBar: "_toggleBar_8l6g6_915",
62
+ textField: "_textField_8l6g6_933",
63
+ select: "_select_8l6g6_946",
64
+ dialogTrigger: "_dialogTrigger_8l6g6_1067",
65
+ dialogSummary: "_dialogSummary_8l6g6_1102",
66
+ dialogGlyph: "_dialogGlyph_8l6g6_1110",
67
+ dimmed: "_dimmed_8l6g6_1263",
68
+ cellReadout: "_cellReadout_8l6g6_1269",
69
+ textarea: "_textarea_8l6g6_1275",
70
+ groupHeadRow: "_groupHeadRow_8l6g6_1311",
71
+ groupTitle: "_groupTitle_8l6g6_1319",
72
+ groupLeading: "_groupLeading_8l6g6_1325",
73
+ groupActions: "_groupActions_8l6g6_1326",
74
+ note: "_note_8l6g6_1523",
75
+ groupTitleMid: "_groupTitleMid_8l6g6_1553",
76
+ groupTwisty: "_groupTwisty_8l6g6_1559",
77
+ groupBody: "_groupBody_8l6g6_4",
78
+ groupPairs: "_groupPairs_8l6g6_1588",
79
+ groupOneUp: "_groupOneUp_8l6g6_1601",
80
+ subpanelTitle: "_subpanelTitle_8l6g6_1741",
81
+ rowAuto: "_rowAuto_8l6g6_1778",
82
+ rowAutoInherited: "_rowAutoInherited_8l6g6_1788 _inherited_40bjp_4",
83
+ rowHint: "_rowHint_8l6g6_1793"
84
+ }, oe = {
85
+ tight: P.densityTight,
86
+ normal: P.densityNormal,
87
+ roomy: P.densityRoomy
88
+ }, se = {
89
+ start: P.alignStart,
90
+ center: P.alignCenter,
91
+ end: P.alignEnd,
92
+ baseline: P.alignBaseline
93
+ };
94
+ function F(e, { density: t, align: n }, r) {
95
+ return [
96
+ e,
97
+ t && oe[t],
98
+ n && se[n],
99
+ r
100
+ ].filter(Boolean).join(" ");
101
+ }
102
+ var I = O(!1);
103
+ function ce({ title: e, actions: t, selectable: n, children: i, className: a, density: o, align: s, stance: c, tone: l }) {
104
+ let u = ee(I), d = r({
105
+ stance: c,
106
+ tone: l
107
+ }), f = e != null && /* @__PURE__ */ E("h2", {
108
+ className: P.panelTitle,
109
+ children: e
110
+ });
111
+ return /* @__PURE__ */ D("div", {
112
+ className: F(P.panel, {
113
+ density: o,
114
+ align: s
115
+ }, a),
116
+ ...d,
117
+ "data-nested": u || void 0,
118
+ "data-selectable": (n ?? c === "debug") || void 0,
119
+ children: [t == null ? f : /* @__PURE__ */ D("div", {
120
+ className: P.panelHeader,
121
+ children: [f, /* @__PURE__ */ E("div", {
122
+ className: P.panelActions,
123
+ children: t
124
+ })]
125
+ }), /* @__PURE__ */ E(I.Provider, {
126
+ value: !0,
127
+ children: i
128
+ })]
129
+ });
130
+ }
131
+ var le = k(function({ children: e, className: t, pack: n = "auto-color", density: r, align: i }, a) {
132
+ let o = `${P.list}${n === "pairs" ? ` ${P.listPairs}` : n === "one-up" ? ` ${P.listOneUp}` : ""}`;
133
+ return /* @__PURE__ */ E("div", {
134
+ ref: a,
135
+ className: F(o, {
136
+ density: r,
137
+ align: i
138
+ }, t),
139
+ children: e
140
+ });
141
+ });
142
+ function ue({ children: e, className: t }) {
143
+ return /* @__PURE__ */ E("div", {
144
+ className: t ? `${P.span} ${t}` : P.span,
145
+ children: e
146
+ });
147
+ }
148
+ function de({ children: e, className: t }) {
149
+ return /* @__PURE__ */ E("p", {
150
+ className: t ? `${P.note} ${t}` : P.note,
151
+ children: e
152
+ });
153
+ }
154
+ function L({ label: e, readout: t, description: n, variant: r = "default", layout: i, span: a, children: o, htmlFor: s, group: c, className: l, density: u, align: d, auto: f, onAutoChange: p, autoControl: m = "hidden", hint: h }) {
155
+ let g = r === "color" ? P.rowColor : r === "checkbox" ? P.rowCheckbox : "", _ = r === "default" ? "block" : "inline", v = i ?? _, y = v === _ ? "" : v === "inline" ? P.rowInline : P.rowBlock, b = F([
156
+ P.row,
157
+ g,
158
+ y,
159
+ a && P.span,
160
+ f && (m === "dimmed" ? P.rowAutoInherited : P.rowAuto)
161
+ ].filter(Boolean).join(" "), {
162
+ density: u,
163
+ align: d
164
+ }, l), x = v === "inline" && t != null, S = j(null), C = j(null), w = fe(S, C, v === "inline"), T = /* @__PURE__ */ D("span", {
165
+ className: P.rowLabel,
166
+ ref: C,
167
+ children: [
168
+ p ? /* @__PURE__ */ E(pe, {
169
+ auto: f ?? !1,
170
+ label: e,
171
+ onChange: p
172
+ }) : e,
173
+ h != null && /* @__PURE__ */ E("span", {
174
+ className: P.rowHint,
175
+ children: h
176
+ }),
177
+ n ? /* @__PURE__ */ E(R, {
178
+ label: e,
179
+ description: n
180
+ }) : null,
181
+ t != null && !x && /* @__PURE__ */ E("em", {
182
+ className: P.readout,
183
+ children: t
184
+ })
185
+ ]
186
+ }), O = x ? /* @__PURE__ */ E("em", {
187
+ className: `${P.readout} ${P.readoutAfter}`,
188
+ children: t
189
+ }) : null, k = w ? { "data-multiline": "" } : {};
190
+ return c ? /* @__PURE__ */ D("div", {
191
+ className: b,
192
+ ref: S,
193
+ ...k,
194
+ children: [
195
+ T,
196
+ o,
197
+ O
198
+ ]
199
+ }) : /* @__PURE__ */ D("label", {
200
+ className: b,
201
+ htmlFor: s,
202
+ ref: S,
203
+ ...k,
204
+ children: [
205
+ T,
206
+ o,
207
+ O
208
+ ]
209
+ });
210
+ }
211
+ function fe(e, t, n) {
212
+ let [r, i] = M(!1);
213
+ return ne(() => {
214
+ let r = e.current, a = t.current;
215
+ if (!n || !r || !a || typeof ResizeObserver > "u") {
216
+ i(!1);
217
+ return;
218
+ }
219
+ let o = new ResizeObserver(() => {
220
+ let e = getComputedStyle(a), t = Number.parseFloat(e.lineHeight) || Number.parseFloat(e.fontSize) * 1.2, n = Number.parseFloat(getComputedStyle(r).minHeight) || t, o = a.getBoundingClientRect().height > t * 1.5, s = Array.from(r.children).some((e) => e !== a && e.getBoundingClientRect().height > n * 1.5);
221
+ i(o || s);
222
+ });
223
+ o.observe(r), o.observe(a);
224
+ for (let e of Array.from(r.children)) o.observe(e);
225
+ return () => o.disconnect();
226
+ }, [
227
+ e,
228
+ t,
229
+ n
230
+ ]), r;
231
+ }
232
+ function pe({ auto: e, label: t, onChange: n }) {
233
+ let r = typeof t == "string" ? t : "this setting", i = (t) => {
234
+ t.preventDefault(), t.stopPropagation(), n(!e);
235
+ };
236
+ return /* @__PURE__ */ E("span", {
237
+ role: "button",
238
+ tabIndex: 0,
239
+ className: P.autoToggle,
240
+ "aria-pressed": !e,
241
+ "aria-label": `Pin ${r}`,
242
+ onClick: i,
243
+ onKeyDown: (e) => {
244
+ (e.key === "Enter" || e.key === " ") && i(e);
245
+ },
246
+ onMouseDown: (e) => e.stopPropagation(),
247
+ children: t
248
+ });
249
+ }
250
+ function R({ label: e, description: r }) {
251
+ let i = typeof e == "string" ? e : "this setting";
252
+ return /* @__PURE__ */ D(n, { children: [/* @__PURE__ */ E(re, { children: /* @__PURE__ */ E("button", {
253
+ type: "button",
254
+ className: P.help,
255
+ "aria-label": `About ${i}`,
256
+ onClick: (e) => {
257
+ e.preventDefault(), e.stopPropagation();
258
+ },
259
+ onMouseDown: (e) => e.stopPropagation(),
260
+ children: "ⓘ"
261
+ }) }), /* @__PURE__ */ E(t, { children: r })] });
262
+ }
263
+ //#endregion
264
+ //#region src/components/Properties/NumberControls.tsx
265
+ function z(e) {
266
+ let [t, n] = M(), { onInput: r, onChange: i } = e;
267
+ return r ? {
268
+ ...e,
269
+ value: t ?? e.value,
270
+ onInput: (e) => {
271
+ n(e), r(e);
272
+ },
273
+ onChange: (e) => {
274
+ n(void 0), i(e);
275
+ }
276
+ } : e;
277
+ }
278
+ function me({ row: e, readout: t, control: n }) {
279
+ let r = z(n);
280
+ return /* @__PURE__ */ E(L, {
281
+ ...e,
282
+ readout: q(t) ?? /* @__PURE__ */ E(K, { ...r }),
283
+ children: /* @__PURE__ */ E(G, { ...r })
284
+ });
285
+ }
286
+ function he(e) {
287
+ let t = z(e);
288
+ return /* @__PURE__ */ D(T, { children: [/* @__PURE__ */ E(G, { ...t }), /* @__PURE__ */ E("span", {
289
+ className: P.cellReadout,
290
+ children: /* @__PURE__ */ E(K, { ...t })
291
+ })] });
292
+ }
293
+ function ge(e) {
294
+ let t = j(null), n = j(e);
295
+ return A(() => {
296
+ n.current = e;
297
+ }), A(() => {
298
+ let e = t.current;
299
+ if (!e) return;
300
+ let r = () => n.current?.(e.value);
301
+ return e.addEventListener("change", r), () => e.removeEventListener("change", r);
302
+ }, []), t;
303
+ }
304
+ function B(e, t) {
305
+ return e == null ? null : typeof e == "string" ? /* @__PURE__ */ E("span", {
306
+ className: t,
307
+ children: e
308
+ }) : e;
309
+ }
310
+ var V = () => {};
311
+ function _e(e) {
312
+ let t = H(e), n = /* @__PURE__ */ E(h, {
313
+ id: e.id,
314
+ className: e.className ? `${P.numberField} ${e.className}` : P.numberField,
315
+ value: t ? e.value : NaN,
316
+ placeholder: e.mixed ? "Mixed" : e.placeholder,
317
+ minValue: e.min,
318
+ maxValue: e.max,
319
+ step: e.step,
320
+ accepts: e.accepts,
321
+ display: e.display,
322
+ steppers: e.steppers,
323
+ "aria-label": e.name,
324
+ onInput: e.onInput ?? e.onChange,
325
+ onChange: e.onInput ? e.onChange : V
326
+ });
327
+ return e.unit == null || t && !Number.isFinite(e.value) ? n : /* @__PURE__ */ D("span", {
328
+ className: P.fieldUnitGroup,
329
+ children: [n, B(e.unit, P.readoutUnit)]
330
+ });
331
+ }
332
+ function H(e) {
333
+ return !e.mixed && typeof e.value == "number" && !Number.isNaN(e.value);
334
+ }
335
+ function U(e = 1) {
336
+ return ie({
337
+ places: e >= 1 ? 0 : Math.min(6, Math.max(0, Math.ceil(-Math.log10(e)))),
338
+ grouping: !1
339
+ });
340
+ }
341
+ function W(e) {
342
+ let t = e.min ?? 0, n = e.max ?? 100;
343
+ return {
344
+ min: t,
345
+ max: n,
346
+ step: e.step ?? 1,
347
+ settle: (r) => u(e.endless, 1) && r >= n ? Infinity : u(e.endless, -1) && r <= t ? -Infinity : Math.min(n, Math.max(t, r))
348
+ };
349
+ }
350
+ function G(t) {
351
+ let { min: n, max: r, step: a, settle: o } = W(t), s = t.onInput ?? t.onChange, c = t.onInput ? t.onChange : void 0, l = ge(c && ((e) => c(o(Number(e))))), u = H(t) ? Math.min(Math.max(t.value, n), r) : n;
352
+ return /* @__PURE__ */ E("input", {
353
+ ref: l,
354
+ type: "range",
355
+ id: t.id,
356
+ className: t.className ? `${i.range} ${t.className}` : i.range,
357
+ "aria-label": t.name,
358
+ tabIndex: -1,
359
+ min: n,
360
+ max: r,
361
+ step: a,
362
+ value: u,
363
+ disabled: t.mixed,
364
+ onChange: (n) => {
365
+ let r = o(Number(n.target.value));
366
+ e("property-panel", "slider", {
367
+ name: t.name,
368
+ value: r
369
+ }), s(r);
370
+ }
371
+ });
372
+ }
373
+ function K(e) {
374
+ let { min: t, max: n, step: r, settle: i } = W(e);
375
+ return H(e) ? /* @__PURE__ */ E(ve, {
376
+ name: e.name,
377
+ value: e.value,
378
+ min: t,
379
+ max: n,
380
+ step: r,
381
+ settle: i,
382
+ display: e.display ?? U(r),
383
+ format: e.format,
384
+ unit: e.unit,
385
+ onCommit: (t) => {
386
+ e.onInput?.(t), e.onChange(t);
387
+ }
388
+ }) : /* @__PURE__ */ E(T, { children: q("—") });
389
+ }
390
+ function q(e) {
391
+ return typeof e != "string" && typeof e != "number" ? e : /* @__PURE__ */ E("span", {
392
+ className: P.readoutGroup,
393
+ children: /* @__PURE__ */ E("span", {
394
+ className: P.readoutText,
395
+ children: e
396
+ })
397
+ });
398
+ }
399
+ function ve({ name: e, value: t, min: n, max: r, step: i, settle: a, display: o, format: s, unit: c, onCommit: l }) {
400
+ let [u, d] = M(null), f = (e) => s ? String(s(e)) : N(e, o).text, p = (e) => ae(e, o), h = u === null ? f(t) : u, g = { "--wzl-property-readout-fit": `${Math.max(f(a(n)).length, f(a(r)).length)}ch` }, _ = (e) => Math.min(r, Math.max(n, e)), v = () => {
401
+ if (u !== null) {
402
+ let e = p(u);
403
+ Number.isNaN(e) || l(a(e));
404
+ }
405
+ d(null);
406
+ };
407
+ return /* @__PURE__ */ D("span", {
408
+ className: P.readoutGroup,
409
+ children: [/* @__PURE__ */ E("input", {
410
+ type: "text",
411
+ role: "spinbutton",
412
+ "aria-label": e,
413
+ "aria-valuenow": _(t),
414
+ "aria-valuetext": s ? f(t) : N(t, o).spoken,
415
+ "aria-valuemin": n,
416
+ "aria-valuemax": r,
417
+ inputMode: "decimal",
418
+ className: P.readoutInput,
419
+ style: g,
420
+ value: h,
421
+ onFocus: (e) => {
422
+ d(f(t)), e.currentTarget.select();
423
+ },
424
+ onChange: (e) => d(e.target.value.replace(/-/g, "−")),
425
+ onBlur: v,
426
+ onClick: (e) => {
427
+ e.preventDefault(), e.stopPropagation(), e.currentTarget.focus();
428
+ },
429
+ onMouseDown: (e) => e.stopPropagation(),
430
+ onKeyDown: (e) => {
431
+ if (e.key === "Enter") v(), e.currentTarget.blur();
432
+ else if (e.key === "Escape") d(null), e.currentTarget.blur();
433
+ else {
434
+ let o = u === null ? t : p(u), s = m(e.key, _(Number.isNaN(o) ? t : o), {
435
+ step: i,
436
+ min: n,
437
+ max: r
438
+ });
439
+ if (s === null) return;
440
+ e.preventDefault(), l(a(s)), d(null);
441
+ }
442
+ }
443
+ }), Number.isFinite(t) && B(c, P.readoutUnit)]
444
+ });
445
+ }
446
+ //#endregion
447
+ //#region src/components/Properties/PropertyField.tsx
448
+ function ye(e) {
449
+ let { label: t, readout: n, description: r, layout: i, span: a, density: o, align: s, auto: c, onAutoChange: l, rowClassName: u, controlClassName: d, ...f } = e, p = te(), m = {
450
+ ...f,
451
+ name: f.name ?? Z(t),
452
+ className: d,
453
+ id: p
454
+ }, h = xe(m), g = {
455
+ label: t,
456
+ description: r,
457
+ layout: i,
458
+ span: a,
459
+ density: o,
460
+ align: s,
461
+ auto: c,
462
+ onAutoChange: l,
463
+ className: u,
464
+ variant: h.variant,
465
+ group: h.group,
466
+ htmlFor: h.group || m.kind === "font-family" || m.kind === "font-weight" ? void 0 : p
467
+ };
468
+ return m.kind === "number" && m.control === "slider" ? /* @__PURE__ */ E(me, {
469
+ row: g,
470
+ readout: n,
471
+ control: m
472
+ }) : /* @__PURE__ */ E(L, {
473
+ ...g,
474
+ readout: n,
475
+ children: /* @__PURE__ */ E(J, { ...m })
476
+ });
477
+ }
478
+ function be(e) {
479
+ let t = e;
480
+ return t.kind === "number" && t.control === "slider" ? /* @__PURE__ */ E(he, { ...t }) : /* @__PURE__ */ E(J, { ...t });
481
+ }
482
+ function xe(e) {
483
+ switch (e.kind) {
484
+ case "boolean": return {
485
+ variant: "checkbox",
486
+ group: e.control === "switch" || e.control === "toggle"
487
+ };
488
+ case "enum": return {
489
+ variant: "default",
490
+ group: e.control === "radio" || e.control === "toggle"
491
+ };
492
+ case "color": return {
493
+ variant: "color",
494
+ group: !1
495
+ };
496
+ case "paint": return {
497
+ variant: "default",
498
+ group: !0
499
+ };
500
+ default: return {
501
+ variant: "default",
502
+ group: !1
503
+ };
504
+ }
505
+ }
506
+ function J(e) {
507
+ switch (e.kind) {
508
+ case "boolean": return /* @__PURE__ */ E(X, { ...e });
509
+ case "number": return /* @__PURE__ */ E(_e, { ...e });
510
+ case "string": return /* @__PURE__ */ E(Ce, { ...e });
511
+ case "enum": return /* @__PURE__ */ E(we, { ...e });
512
+ case "color": return /* @__PURE__ */ E(Te, { ...e });
513
+ case "paint": return /* @__PURE__ */ E(Ee, { ...e });
514
+ case "font-family": return /* @__PURE__ */ E(s, {
515
+ className: e.className,
516
+ value: e.mixed ? void 0 : e.value,
517
+ mixed: e.mixed,
518
+ onChange: e.onChange,
519
+ weight: e.weight,
520
+ fontStyle: e.fontStyle,
521
+ "aria-label": e.name
522
+ });
523
+ case "font-weight": return /* @__PURE__ */ E(c, {
524
+ className: e.className,
525
+ value: e.mixed ? void 0 : e.value,
526
+ mixed: e.mixed,
527
+ family: e.family,
528
+ onChange: e.onChange,
529
+ "aria-label": e.name
530
+ });
531
+ default: throw Error(`PropertyControl: no control for kind "${e.kind}"`);
532
+ }
533
+ }
534
+ function Y({ mixed: e, unset: t, children: n }) {
535
+ return !e && !t ? /* @__PURE__ */ E(T, { children: n }) : /* @__PURE__ */ E("span", {
536
+ className: P.dimmed,
537
+ title: e ? "Mixed" : "Not set",
538
+ children: n
539
+ });
540
+ }
541
+ function X(e) {
542
+ let t = !e.mixed && e.value === !0, n = j(null);
543
+ return A(() => {
544
+ n.current && (n.current.indeterminate = e.mixed === !0);
545
+ }), e.control === "toggle" ? /* @__PURE__ */ E(d, {
546
+ mode: "multiple",
547
+ size: "sm",
548
+ variant: "flat",
549
+ className: e.className,
550
+ ariaLabel: e.name,
551
+ items: [{
552
+ value: "on",
553
+ label: e.glyph ?? /* @__PURE__ */ E(p, { forms: f(e.name, e.short) }),
554
+ ariaLabel: e.name
555
+ }],
556
+ value: t ? ["on"] : [],
557
+ mixedValues: e.mixed ? ["on"] : [],
558
+ onChange: (t) => e.onChange(t.includes("on"))
559
+ }) : e.control === "switch" ? /* @__PURE__ */ E(Y, {
560
+ mixed: e.mixed,
561
+ unset: e.unset,
562
+ children: /* @__PURE__ */ E(b, {
563
+ className: e.className,
564
+ isSelected: t,
565
+ onChange: e.onChange,
566
+ "aria-label": e.name
567
+ })
568
+ }) : /* @__PURE__ */ E(Y, {
569
+ unset: e.unset,
570
+ children: /* @__PURE__ */ E("input", {
571
+ ref: n,
572
+ id: e.id,
573
+ type: "checkbox",
574
+ className: e.className ? `${x.checkbox} ${e.className}` : x.checkbox,
575
+ "aria-label": e.name,
576
+ checked: t,
577
+ onChange: (t) => e.onChange(t.target.checked)
578
+ })
579
+ });
580
+ }
581
+ function Se(e) {
582
+ let [t, n] = M(null), r = e.mixed ? "" : e.value ?? "", i = e.onInput !== void 0;
583
+ return {
584
+ shown: t ?? r,
585
+ type: (t) => {
586
+ if (!i) {
587
+ e.onChange(t);
588
+ return;
589
+ }
590
+ n(t), e.onInput?.(t);
591
+ },
592
+ settle: () => {
593
+ t !== null && t !== r && e.onChange(t), n(null);
594
+ }
595
+ };
596
+ }
597
+ function Ce(e) {
598
+ let t = Se(e), n = e.mixed ? "Mixed" : e.placeholder;
599
+ return e.control === "textarea" ? /* @__PURE__ */ E("textarea", {
600
+ id: e.id,
601
+ className: e.className ? `${P.textarea} ${e.className}` : P.textarea,
602
+ "aria-label": e.name,
603
+ value: t.shown,
604
+ placeholder: n,
605
+ maxLength: e.maxLength,
606
+ rows: 3,
607
+ onChange: (e) => t.type(e.target.value),
608
+ onBlur: t.settle
609
+ }) : /* @__PURE__ */ E(l, {
610
+ id: e.id,
611
+ className: e.className ? `${P.textField} ${e.className}` : P.textField,
612
+ value: t.shown,
613
+ placeholder: n,
614
+ maxLength: e.maxLength,
615
+ "aria-label": e.name,
616
+ onChange: t.type,
617
+ onBlur: t.settle,
618
+ onKeyDown: (e) => {
619
+ e.key === "Enter" && e.target.blur();
620
+ }
621
+ });
622
+ }
623
+ function Z(e) {
624
+ return typeof e == "string" ? e : void 0;
625
+ }
626
+ function Q(e) {
627
+ return e.glyph === void 0 || e.glyph === null ? void 0 : e.label;
628
+ }
629
+ function we(t) {
630
+ let n = !t.mixed && t.options.some((e) => e.value === t.value) ? t.value : null;
631
+ if (t.control === "radio") return /* @__PURE__ */ E(v, {
632
+ className: t.className,
633
+ value: n,
634
+ onChange: t.onChange,
635
+ "aria-label": t.name,
636
+ children: t.options.map((e) => /* @__PURE__ */ E(y, {
637
+ value: e.value,
638
+ isDisabled: e.disabled,
639
+ children: e.label
640
+ }, e.value))
641
+ });
642
+ if (t.control === "toggle" && t.onClear) {
643
+ let { onClear: e } = t, r = n === null ? [] : [n];
644
+ return /* @__PURE__ */ E(d, {
645
+ mode: "multiple",
646
+ size: "sm",
647
+ variant: "flat",
648
+ className: t.className ? `${P.toggleBar} ${t.className}` : P.toggleBar,
649
+ ariaLabel: t.name,
650
+ items: t.options.map((e) => ({
651
+ value: e.value,
652
+ label: e.glyph ?? /* @__PURE__ */ E(p, { forms: f(e.label, e.short) }),
653
+ ariaLabel: Z(e.label),
654
+ tooltip: Q(e),
655
+ disabled: e.disabled
656
+ })),
657
+ value: r,
658
+ mixedValues: t.mixed ? t.options.map((e) => e.value) : [],
659
+ onChange: (n) => {
660
+ let i = n.find((e) => !r.includes(e));
661
+ i === void 0 ? e() : t.onChange(i);
662
+ }
663
+ });
664
+ }
665
+ return t.control === "toggle" ? /* @__PURE__ */ E(d, {
666
+ size: "sm",
667
+ variant: "flat",
668
+ className: t.className ? `${P.toggleBar} ${t.className}` : P.toggleBar,
669
+ ariaLabel: t.name,
670
+ items: t.options.map((e) => ({
671
+ value: e.value,
672
+ label: e.glyph ?? /* @__PURE__ */ E(p, { forms: f(e.label, e.short) }),
673
+ ariaLabel: Z(e.label),
674
+ tooltip: Q(e),
675
+ disabled: e.disabled
676
+ })),
677
+ value: n,
678
+ onChange: (e) => {
679
+ e !== null && t.onChange(e);
680
+ }
681
+ }) : /* @__PURE__ */ E(o, {
682
+ className: t.className ? `${P.select} ${t.className}` : P.select,
683
+ triggerId: t.id,
684
+ "aria-label": t.name,
685
+ placeholder: t.mixed ? "Mixed" : t.placeholder ?? (t.unset ? "—" : "Choose option…"),
686
+ selectedKey: n,
687
+ options: t.options.map((e) => ({
688
+ value: e.value,
689
+ label: e.label,
690
+ icon: e.glyph,
691
+ isDisabled: e.disabled
692
+ })),
693
+ onSelectionChange: (n) => {
694
+ e("property-panel", "select", {
695
+ name: t.name,
696
+ value: n
697
+ }), t.onChange(n);
698
+ }
699
+ });
700
+ }
701
+ function $(e) {
702
+ let t = C(e?.trim() ?? "");
703
+ return /^#[0-9a-f]{8}$/i.test(t) ? {
704
+ rgb: t.slice(0, 7).toLowerCase(),
705
+ alpha: S(t)
706
+ } : {
707
+ rgb: "#000000",
708
+ alpha: 1
709
+ };
710
+ }
711
+ function Te(e) {
712
+ let t = e.alpha !== void 0 && e.alpha !== !1, n = typeof e.alpha == "number", r = $(e.value), i = n ? e.alpha : r.alpha, o = (e, t) => (a) => {
713
+ if (!n) {
714
+ e(a);
715
+ return;
716
+ }
717
+ let o = $(a);
718
+ (o.rgb !== r.rgb || !t) && e(o.rgb);
719
+ let s = Math.round(o.alpha * 100) / 100;
720
+ s !== Math.round(i * 100) / 100 && t?.(s);
721
+ }, s = e.onInput !== void 0 || e.onAlphaInput !== void 0, c = o(e.onInput ?? e.onChange, e.onAlphaInput ?? e.onAlphaChange), l = s ? o(e.onChange, e.onAlphaChange) : V;
722
+ return /* @__PURE__ */ E(a, {
723
+ id: e.id,
724
+ className: e.className ? `${P.colorField} ${e.className}` : P.colorField,
725
+ value: e.mixed ? void 0 : t ? w(r.rgb, i) : e.value ?? "#000000",
726
+ mixed: e.mixed,
727
+ alpha: t,
728
+ alphaDisabled: e.alphaDisabled,
729
+ onInput: c,
730
+ onChange: l,
731
+ "aria-label": e.name
732
+ });
733
+ }
734
+ function Ee(e) {
735
+ let t = e.control === "inline" ? g : _;
736
+ return /* @__PURE__ */ E(t, {
737
+ className: e.className,
738
+ value: e.value,
739
+ mixed: e.mixed,
740
+ unset: e.unset,
741
+ kinds: e.kinds,
742
+ allowNone: e.allowNone,
743
+ onChange: e.onChange,
744
+ onInput: e.onInput,
745
+ "aria-label": e.name
746
+ });
747
+ }
748
+ //#endregion
749
+ export { le as a, L as c, P as d, R as i, ue as l, ye as n, de as o, U as r, ce as s, be as t, F as u };
750
+
751
+ //# sourceMappingURL=PropertyField-CWUtNK1w.js.map