@weasel-js/ui 1.7.2 → 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-Bxj1N6bj.js → LayerList-BXTAjK-4.js} +6 -6
  26. package/dist/chunks/{LayerList-Bxj1N6bj.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-C4MZ28SX.js → Prefs-gbjYqvSD.js} +41 -41
  40. package/dist/chunks/Prefs-gbjYqvSD.js.map +1 -0
  41. package/dist/chunks/{Properties-DseN56WI.js → Properties-BbNuMiic.js} +4 -4
  42. package/dist/chunks/{Properties-DseN56WI.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-C3WzyaZV.js → SelectionPanel-BpUqP75b.js} +2 -2
  46. package/dist/chunks/{SelectionPanel-C3WzyaZV.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-qsAFK7_0.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-C4MZ28SX.js.map +0 -1
  143. package/dist/chunks/PropertyField-BbNqK8xr.js +0 -743
  144. package/dist/chunks/PropertyField-BbNqK8xr.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-CZTYPoC2.js +0 -88
  151. package/dist/chunks/ToolOptionsBar-CZTYPoC2.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-qsAFK7_0.js.map +0 -1
  155. package/dist/chunks/prefField-BE_Ytr2H.js.map +0 -1
@@ -1,743 +0,0 @@
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 { n as u, t as d } from "./NumberField-DS0WSiin.js";
11
- import { t as f } from "./ToggleBar-Z2jZiguF.js";
12
- import { t as p } from "./PaintInput-DaQMeBsI.js";
13
- import { t as m } from "./PaintField-BdmQM53v.js";
14
- import { n as h, t as g } from "./RadioGroup-B70_M-gT.js";
15
- import { t as _ } from "./Switch-CSYmcM8y.js";
16
- import { t as v } from "./checkbox.module-DLQV9tMX.js";
17
- import { getAlpha01 as y, toHex8 as b, withAlpha01 as x } from "@weasel-js/core";
18
- import { Fragment as S, jsx as C, jsxs as w } from "react/jsx-runtime";
19
- import { createContext as T, forwardRef as E, useContext as D, useEffect as O, useId as k, useLayoutEffect as ee, useRef as A, useState as j } from "react";
20
- import { Focusable as te } from "react-aria-components";
21
- import { decimal as ne, parseAs as re, qty as M } from "@weasel-js/quantity";
22
- var N = {
23
- panel: "_panel_hs84t_9",
24
- list: "_list_hs84t_3",
25
- row: "_row_hs84t_4",
26
- group: "_group_hs84t_4",
27
- subpanel: "_subpanel_hs84t_3",
28
- card: "_card_hs84t_37",
29
- cardList: "_cardList_hs84t_37",
30
- readout: "_readout_hs84t_42 _numeric_zns9n_4",
31
- readoutInput: "_readoutInput_hs84t_43 _numeric_zns9n_4",
32
- panelTitle: "_panelTitle_hs84t_72",
33
- panelHeader: "_panelHeader_hs84t_84",
34
- panelActions: "_panelActions_hs84t_97",
35
- listPairs: "_listPairs_hs84t_3",
36
- rowColor: "_rowColor_hs84t_4",
37
- span: "_span_hs84t_505",
38
- listOneUp: "_listOneUp_hs84t_513",
39
- densityTight: "_densityTight_hs84t_524",
40
- densityNormal: "_densityNormal_hs84t_536",
41
- densityRoomy: "_densityRoomy_hs84t_548",
42
- alignStart: "_alignStart_hs84t_574",
43
- alignCenter: "_alignCenter_hs84t_580",
44
- alignEnd: "_alignEnd_hs84t_586",
45
- alignBaseline: "_alignBaseline_hs84t_592",
46
- rowInline: "_rowInline_hs84t_623",
47
- rowLabel: "_rowLabel_hs84t_629",
48
- rowBlock: "_rowBlock_hs84t_654",
49
- rowCheckbox: "_rowCheckbox_hs84t_655",
50
- readoutAfter: "_readoutAfter_hs84t_674",
51
- readoutText: "_readoutText_hs84t_685 _numeric_zns9n_4",
52
- help: "_help_hs84t_699",
53
- autoToggle: "_autoToggle_hs84t_733",
54
- readoutGroup: "_readoutGroup_hs84t_680",
55
- readoutUnit: "_readoutUnit_hs84t_812",
56
- fieldUnitGroup: "_fieldUnitGroup_hs84t_837",
57
- numberField: "_numberField_hs84t_845",
58
- colorField: "_colorField_hs84t_898",
59
- toggleBar: "_toggleBar_hs84t_911",
60
- textField: "_textField_hs84t_929",
61
- select: "_select_hs84t_942",
62
- dialogTrigger: "_dialogTrigger_hs84t_1063",
63
- dialogSummary: "_dialogSummary_hs84t_1098",
64
- dialogGlyph: "_dialogGlyph_hs84t_1106",
65
- dimmed: "_dimmed_hs84t_1259",
66
- cellReadout: "_cellReadout_hs84t_1265",
67
- textarea: "_textarea_hs84t_1271",
68
- groupHeadRow: "_groupHeadRow_hs84t_1307",
69
- groupTitle: "_groupTitle_hs84t_1315",
70
- groupLeading: "_groupLeading_hs84t_1321",
71
- groupActions: "_groupActions_hs84t_1322",
72
- note: "_note_hs84t_1519",
73
- groupTitleMid: "_groupTitleMid_hs84t_1549",
74
- groupTwisty: "_groupTwisty_hs84t_1555",
75
- groupBody: "_groupBody_hs84t_4",
76
- groupPairs: "_groupPairs_hs84t_1584",
77
- groupOneUp: "_groupOneUp_hs84t_1597",
78
- subpanelTitle: "_subpanelTitle_hs84t_1737",
79
- rowAuto: "_rowAuto_hs84t_1774",
80
- rowAutoDimmed: "_rowAutoDimmed_hs84t_1784",
81
- rowHint: "_rowHint_hs84t_1789"
82
- }, P = {
83
- tight: N.densityTight,
84
- normal: N.densityNormal,
85
- roomy: N.densityRoomy
86
- }, ie = {
87
- start: N.alignStart,
88
- center: N.alignCenter,
89
- end: N.alignEnd,
90
- baseline: N.alignBaseline
91
- };
92
- function F(e, { density: t, align: n }, r) {
93
- return [
94
- e,
95
- t && P[t],
96
- n && ie[n],
97
- r
98
- ].filter(Boolean).join(" ");
99
- }
100
- var I = T(!1);
101
- function ae({ title: e, actions: t, selectable: n, children: i, className: a, density: o, align: s, stance: c, tone: l }) {
102
- let u = D(I), d = r({
103
- stance: c,
104
- tone: l
105
- }), f = e != null && /* @__PURE__ */ C("h2", {
106
- className: N.panelTitle,
107
- children: e
108
- });
109
- return /* @__PURE__ */ w("div", {
110
- className: F(N.panel, {
111
- density: o,
112
- align: s
113
- }, a),
114
- ...d,
115
- "data-nested": u || void 0,
116
- "data-selectable": (n ?? c === "debug") || void 0,
117
- children: [t == null ? f : /* @__PURE__ */ w("div", {
118
- className: N.panelHeader,
119
- children: [f, /* @__PURE__ */ C("div", {
120
- className: N.panelActions,
121
- children: t
122
- })]
123
- }), /* @__PURE__ */ C(I.Provider, {
124
- value: !0,
125
- children: i
126
- })]
127
- });
128
- }
129
- var oe = E(function({ children: e, className: t, pack: n = "auto-color", density: r, align: i }, a) {
130
- let o = `${N.list}${n === "pairs" ? ` ${N.listPairs}` : n === "one-up" ? ` ${N.listOneUp}` : ""}`;
131
- return /* @__PURE__ */ C("div", {
132
- ref: a,
133
- className: F(o, {
134
- density: r,
135
- align: i
136
- }, t),
137
- children: e
138
- });
139
- });
140
- function se({ children: e, className: t }) {
141
- return /* @__PURE__ */ C("div", {
142
- className: t ? `${N.span} ${t}` : N.span,
143
- children: e
144
- });
145
- }
146
- function ce({ children: e, className: t }) {
147
- return /* @__PURE__ */ C("p", {
148
- className: t ? `${N.note} ${t}` : N.note,
149
- children: e
150
- });
151
- }
152
- 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 }) {
153
- let g = r === "color" ? N.rowColor : r === "checkbox" ? N.rowCheckbox : "", _ = r === "default" ? "block" : "inline", v = i ?? _, y = v === _ ? "" : v === "inline" ? N.rowInline : N.rowBlock, b = F([
154
- N.row,
155
- g,
156
- y,
157
- a && N.span,
158
- f && (m === "dimmed" ? N.rowAutoDimmed : N.rowAuto)
159
- ].filter(Boolean).join(" "), {
160
- density: u,
161
- align: d
162
- }, l), x = v === "inline" && t != null, S = A(null), T = A(null), E = le(S, T, v === "inline"), D = /* @__PURE__ */ w("span", {
163
- className: N.rowLabel,
164
- ref: T,
165
- children: [
166
- p ? /* @__PURE__ */ C(ue, {
167
- auto: f ?? !1,
168
- label: e,
169
- onChange: p
170
- }) : e,
171
- h != null && /* @__PURE__ */ C("span", {
172
- className: N.rowHint,
173
- children: h
174
- }),
175
- n ? /* @__PURE__ */ C(R, {
176
- label: e,
177
- description: n
178
- }) : null,
179
- t != null && !x && /* @__PURE__ */ C("em", {
180
- className: N.readout,
181
- children: t
182
- })
183
- ]
184
- }), O = x ? /* @__PURE__ */ C("em", {
185
- className: `${N.readout} ${N.readoutAfter}`,
186
- children: t
187
- }) : null, k = E ? { "data-multiline": "" } : {};
188
- return c ? /* @__PURE__ */ w("div", {
189
- className: b,
190
- ref: S,
191
- ...k,
192
- children: [
193
- D,
194
- o,
195
- O
196
- ]
197
- }) : /* @__PURE__ */ w("label", {
198
- className: b,
199
- htmlFor: s,
200
- ref: S,
201
- ...k,
202
- children: [
203
- D,
204
- o,
205
- O
206
- ]
207
- });
208
- }
209
- function le(e, t, n) {
210
- let [r, i] = j(!1);
211
- return ee(() => {
212
- let r = e.current, a = t.current;
213
- if (!n || !r || !a || typeof ResizeObserver > "u") {
214
- i(!1);
215
- return;
216
- }
217
- let o = new ResizeObserver(() => {
218
- 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);
219
- i(o || s);
220
- });
221
- o.observe(r), o.observe(a);
222
- for (let e of Array.from(r.children)) o.observe(e);
223
- return () => o.disconnect();
224
- }, [
225
- e,
226
- t,
227
- n
228
- ]), r;
229
- }
230
- function ue({ auto: e, label: t, onChange: n }) {
231
- let r = typeof t == "string" ? t : "this setting", i = (t) => {
232
- t.preventDefault(), t.stopPropagation(), n(!e);
233
- };
234
- return /* @__PURE__ */ C("span", {
235
- role: "button",
236
- tabIndex: 0,
237
- className: N.autoToggle,
238
- "aria-pressed": !e,
239
- "aria-label": `Pin ${r}`,
240
- onClick: i,
241
- onKeyDown: (e) => {
242
- (e.key === "Enter" || e.key === " ") && i(e);
243
- },
244
- onMouseDown: (e) => e.stopPropagation(),
245
- children: t
246
- });
247
- }
248
- function R({ label: e, description: r }) {
249
- let i = typeof e == "string" ? e : "this setting";
250
- return /* @__PURE__ */ w(n, { children: [/* @__PURE__ */ C(te, { children: /* @__PURE__ */ C("button", {
251
- type: "button",
252
- className: N.help,
253
- "aria-label": `About ${i}`,
254
- onClick: (e) => {
255
- e.preventDefault(), e.stopPropagation();
256
- },
257
- onMouseDown: (e) => e.stopPropagation(),
258
- children: "ⓘ"
259
- }) }), /* @__PURE__ */ C(t, { children: r })] });
260
- }
261
- //#endregion
262
- //#region src/components/Properties/PropertyField.tsx
263
- function de(e) {
264
- 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 = k(), m = {
265
- ...f,
266
- name: f.name ?? X(t),
267
- className: d,
268
- id: p
269
- }, h = V(m), g = {
270
- label: t,
271
- description: r,
272
- layout: i,
273
- span: a,
274
- density: o,
275
- align: s,
276
- auto: c,
277
- onAutoChange: l,
278
- className: u,
279
- variant: h.variant,
280
- group: h.group,
281
- htmlFor: h.group || m.kind === "font-family" || m.kind === "font-weight" ? void 0 : p
282
- };
283
- return m.kind === "number" && m.control === "slider" ? /* @__PURE__ */ C(B, {
284
- row: g,
285
- readout: n,
286
- control: m
287
- }) : /* @__PURE__ */ C(L, {
288
- ...g,
289
- readout: n,
290
- children: /* @__PURE__ */ C(H, { ...m })
291
- });
292
- }
293
- function fe(e) {
294
- let t = e;
295
- return t.kind === "number" && t.control === "slider" ? /* @__PURE__ */ C(pe, { ...t }) : /* @__PURE__ */ C(H, { ...t });
296
- }
297
- function z(e) {
298
- let [t, n] = j(), { onInput: r, onChange: i } = e;
299
- return r ? {
300
- ...e,
301
- value: t ?? e.value,
302
- onInput: (e) => {
303
- n(e), r(e);
304
- },
305
- onChange: (e) => {
306
- n(void 0), i(e);
307
- }
308
- } : e;
309
- }
310
- function B({ row: e, readout: t, control: n }) {
311
- let r = z(n);
312
- return /* @__PURE__ */ C(L, {
313
- ...e,
314
- readout: Y(t) ?? /* @__PURE__ */ C(J, { ...r }),
315
- children: /* @__PURE__ */ C(q, { ...r })
316
- });
317
- }
318
- function pe(e) {
319
- let t = z(e);
320
- return /* @__PURE__ */ w(S, { children: [/* @__PURE__ */ C(q, { ...t }), /* @__PURE__ */ C("span", {
321
- className: N.cellReadout,
322
- children: /* @__PURE__ */ C(J, { ...t })
323
- })] });
324
- }
325
- function V(e) {
326
- switch (e.kind) {
327
- case "boolean": return {
328
- variant: "checkbox",
329
- group: e.control === "switch" || e.control === "toggle"
330
- };
331
- case "enum": return {
332
- variant: "default",
333
- group: e.control === "radio" || e.control === "toggle"
334
- };
335
- case "color": return {
336
- variant: "color",
337
- group: !1
338
- };
339
- case "paint": return {
340
- variant: "default",
341
- group: !0
342
- };
343
- default: return {
344
- variant: "default",
345
- group: !1
346
- };
347
- }
348
- }
349
- function H(e) {
350
- switch (e.kind) {
351
- case "boolean": return /* @__PURE__ */ C(me, { ...e });
352
- case "number": return /* @__PURE__ */ C(ge, { ...e });
353
- case "string": return /* @__PURE__ */ C(ye, { ...e });
354
- case "enum": return /* @__PURE__ */ C(be, { ...e });
355
- case "color": return /* @__PURE__ */ C(xe, { ...e });
356
- case "paint": return /* @__PURE__ */ C(Se, { ...e });
357
- case "font-family": return /* @__PURE__ */ C(s, {
358
- className: e.className,
359
- value: e.mixed ? void 0 : e.value,
360
- mixed: e.mixed,
361
- onChange: e.onChange,
362
- weight: e.weight,
363
- fontStyle: e.fontStyle,
364
- "aria-label": e.name
365
- });
366
- case "font-weight": return /* @__PURE__ */ C(c, {
367
- className: e.className,
368
- value: e.mixed ? void 0 : e.value,
369
- mixed: e.mixed,
370
- family: e.family,
371
- onChange: e.onChange,
372
- "aria-label": e.name
373
- });
374
- default: throw Error(`PropertyControl: no control for kind "${e.kind}"`);
375
- }
376
- }
377
- function U({ mixed: e, unset: t, children: n }) {
378
- return !e && !t ? /* @__PURE__ */ C(S, { children: n }) : /* @__PURE__ */ C("span", {
379
- className: N.dimmed,
380
- title: e ? "Mixed" : "Not set",
381
- children: n
382
- });
383
- }
384
- function me(e) {
385
- let t = !e.mixed && e.value === !0, n = A(null);
386
- return O(() => {
387
- n.current && (n.current.indeterminate = e.mixed === !0);
388
- }), e.control === "toggle" ? /* @__PURE__ */ C(f, {
389
- mode: "multiple",
390
- size: "sm",
391
- variant: "flat",
392
- className: e.className,
393
- ariaLabel: e.name,
394
- items: [{
395
- value: "on",
396
- label: e.glyph ?? e.name?.slice(0, 1),
397
- ariaLabel: e.name
398
- }],
399
- value: t ? ["on"] : [],
400
- mixedValues: e.mixed ? ["on"] : [],
401
- onChange: (t) => e.onChange(t.includes("on"))
402
- }) : e.control === "switch" ? /* @__PURE__ */ C(U, {
403
- mixed: e.mixed,
404
- unset: e.unset,
405
- children: /* @__PURE__ */ C(_, {
406
- className: e.className,
407
- isSelected: t,
408
- onChange: e.onChange,
409
- "aria-label": e.name
410
- })
411
- }) : /* @__PURE__ */ C(U, {
412
- unset: e.unset,
413
- children: /* @__PURE__ */ C("input", {
414
- ref: n,
415
- id: e.id,
416
- type: "checkbox",
417
- className: e.className ? `${v.checkbox} ${e.className}` : v.checkbox,
418
- "aria-label": e.name,
419
- checked: t,
420
- onChange: (t) => e.onChange(t.target.checked)
421
- })
422
- });
423
- }
424
- function he(e) {
425
- let t = A(null), n = A(e);
426
- return O(() => {
427
- n.current = e;
428
- }), O(() => {
429
- let e = t.current;
430
- if (!e) return;
431
- let r = () => n.current?.(e.value);
432
- return e.addEventListener("change", r), () => e.removeEventListener("change", r);
433
- }, []), t;
434
- }
435
- function W(e, t) {
436
- return e == null ? null : typeof e == "string" ? /* @__PURE__ */ C("span", {
437
- className: t,
438
- children: e
439
- }) : e;
440
- }
441
- var G = () => {};
442
- function ge(e) {
443
- let t = !e.mixed && typeof e.value == "number" && Number.isFinite(e.value), n = /* @__PURE__ */ C(d, {
444
- id: e.id,
445
- className: e.className ? `${N.numberField} ${e.className}` : N.numberField,
446
- value: t ? e.value : NaN,
447
- placeholder: e.mixed ? "Mixed" : e.placeholder,
448
- minValue: e.min,
449
- maxValue: e.max,
450
- step: e.step,
451
- accepts: e.accepts,
452
- display: e.display,
453
- steppers: e.steppers,
454
- "aria-label": e.name,
455
- onInput: e.onInput ?? e.onChange,
456
- onChange: e.onInput ? e.onChange : G
457
- });
458
- return e.unit == null ? n : /* @__PURE__ */ w("span", {
459
- className: N.fieldUnitGroup,
460
- children: [n, W(e.unit, N.readoutUnit)]
461
- });
462
- }
463
- function K(e) {
464
- return {
465
- min: e.min ?? 0,
466
- max: e.max ?? 100,
467
- step: e.step ?? 1
468
- };
469
- }
470
- function q(t) {
471
- let { min: n, max: r, step: a } = K(t), o = t.onInput ?? t.onChange, s = t.onInput ? t.onChange : void 0, c = he(s && ((e) => s(Number(e)))), l = !t.mixed && typeof t.value == "number" && Number.isFinite(t.value) ? Math.min(Math.max(t.value, n), r) : n;
472
- return /* @__PURE__ */ C("input", {
473
- ref: c,
474
- type: "range",
475
- id: t.id,
476
- className: t.className ? `${i.range} ${t.className}` : i.range,
477
- "aria-label": t.name,
478
- tabIndex: -1,
479
- min: n,
480
- max: r,
481
- step: a,
482
- value: l,
483
- disabled: t.mixed,
484
- onChange: (n) => {
485
- let r = Number(n.target.value);
486
- e("property-panel", "slider", {
487
- name: t.name,
488
- value: r
489
- }), o(r);
490
- }
491
- });
492
- }
493
- function J(e) {
494
- let { min: t, max: n, step: r } = K(e);
495
- if (e.mixed || typeof e.value != "number" || !Number.isFinite(e.value)) return /* @__PURE__ */ C(S, { children: Y("—") });
496
- let i = r >= 1 ? 0 : Math.min(6, Math.max(0, Math.ceil(-Math.log10(r)))), a = e.display ?? ne({
497
- places: i,
498
- grouping: !1
499
- });
500
- return /* @__PURE__ */ C(_e, {
501
- name: e.name,
502
- value: e.value,
503
- min: t,
504
- max: n,
505
- step: r,
506
- display: a,
507
- format: e.format,
508
- unit: e.unit,
509
- onCommit: (t) => {
510
- e.onInput?.(t), e.onChange(t);
511
- }
512
- });
513
- }
514
- function Y(e) {
515
- return typeof e != "string" && typeof e != "number" ? e : /* @__PURE__ */ C("span", {
516
- className: N.readoutGroup,
517
- children: /* @__PURE__ */ C("span", {
518
- className: N.readoutText,
519
- children: e
520
- })
521
- });
522
- }
523
- function _e({ name: e, value: t, min: n, max: r, step: i, display: a, format: o, unit: s, onCommit: c }) {
524
- let [l, d] = j(null), f = (e) => o ? String(o(e)) : M(e, a).text, p = (e) => re(e, a), m = l === null ? f(t) : l, h = { "--wzl-property-readout-fit": `${Math.max(f(n).length, f(r).length)}ch` }, g = () => {
525
- if (l !== null) {
526
- let e = p(l);
527
- Number.isFinite(e) && c(Math.min(r, Math.max(n, e)));
528
- }
529
- d(null);
530
- };
531
- return /* @__PURE__ */ w("span", {
532
- className: N.readoutGroup,
533
- children: [/* @__PURE__ */ C("input", {
534
- type: "text",
535
- role: "spinbutton",
536
- "aria-label": e,
537
- "aria-valuenow": t,
538
- "aria-valuetext": o ? f(t) : M(t, a).spoken,
539
- "aria-valuemin": n,
540
- "aria-valuemax": r,
541
- inputMode: "decimal",
542
- className: N.readoutInput,
543
- style: h,
544
- value: m,
545
- onFocus: (e) => {
546
- d(f(t)), e.currentTarget.select();
547
- },
548
- onChange: (e) => d(e.target.value.replace(/-/g, "−")),
549
- onBlur: g,
550
- onClick: (e) => {
551
- e.preventDefault(), e.stopPropagation(), e.currentTarget.focus();
552
- },
553
- onMouseDown: (e) => e.stopPropagation(),
554
- onKeyDown: (e) => {
555
- if (e.key === "Enter") g(), e.currentTarget.blur();
556
- else if (e.key === "Escape") d(null), e.currentTarget.blur();
557
- else {
558
- let a = l === null ? t : p(l), o = u(e.key, Number.isFinite(a) ? a : t, {
559
- step: i,
560
- min: n,
561
- max: r
562
- });
563
- if (o === null) return;
564
- e.preventDefault(), c(o), d(null);
565
- }
566
- }
567
- }), W(s, N.readoutUnit)]
568
- });
569
- }
570
- function ve(e) {
571
- let [t, n] = j(null), r = e.mixed ? "" : e.value ?? "", i = e.onInput !== void 0;
572
- return {
573
- shown: t ?? r,
574
- type: (t) => {
575
- if (!i) {
576
- e.onChange(t);
577
- return;
578
- }
579
- n(t), e.onInput?.(t);
580
- },
581
- settle: () => {
582
- t !== null && t !== r && e.onChange(t), n(null);
583
- }
584
- };
585
- }
586
- function ye(e) {
587
- let t = ve(e), n = e.mixed ? "Mixed" : e.placeholder;
588
- return e.control === "textarea" ? /* @__PURE__ */ C("textarea", {
589
- id: e.id,
590
- className: e.className ? `${N.textarea} ${e.className}` : N.textarea,
591
- "aria-label": e.name,
592
- value: t.shown,
593
- placeholder: n,
594
- maxLength: e.maxLength,
595
- rows: 3,
596
- onChange: (e) => t.type(e.target.value),
597
- onBlur: t.settle
598
- }) : /* @__PURE__ */ C(l, {
599
- id: e.id,
600
- className: e.className ? `${N.textField} ${e.className}` : N.textField,
601
- value: t.shown,
602
- placeholder: n,
603
- maxLength: e.maxLength,
604
- "aria-label": e.name,
605
- onChange: t.type,
606
- onBlur: t.settle,
607
- onKeyDown: (e) => {
608
- e.key === "Enter" && e.target.blur();
609
- }
610
- });
611
- }
612
- function X(e) {
613
- return typeof e == "string" ? e : void 0;
614
- }
615
- function Z(e) {
616
- return e == null || typeof e == "string" || typeof e == "number" ? void 0 : e;
617
- }
618
- function Q(e) {
619
- return e.glyph === void 0 || e.glyph === null ? void 0 : e.label;
620
- }
621
- function be(t) {
622
- let n = !t.mixed && t.options.some((e) => e.value === t.value) ? t.value : null;
623
- if (t.control === "radio") return /* @__PURE__ */ C(h, {
624
- className: t.className,
625
- value: n,
626
- onChange: t.onChange,
627
- "aria-label": t.name,
628
- children: t.options.map((e) => /* @__PURE__ */ C(g, {
629
- value: e.value,
630
- isDisabled: e.disabled,
631
- children: e.label
632
- }, e.value))
633
- });
634
- if (t.control === "toggle" && t.onClear) {
635
- let { onClear: e } = t, r = n === null ? [] : [n];
636
- return /* @__PURE__ */ C(f, {
637
- mode: "multiple",
638
- size: "sm",
639
- variant: "flat",
640
- className: t.className ? `${N.toggleBar} ${t.className}` : N.toggleBar,
641
- ariaLabel: t.name,
642
- items: t.options.map((e) => ({
643
- value: e.value,
644
- label: e.glyph ?? e.label,
645
- ariaLabel: X(e.label),
646
- tooltip: Q(e),
647
- disabled: e.disabled
648
- })),
649
- value: r,
650
- mixedValues: t.mixed ? t.options.map((e) => e.value) : [],
651
- onChange: (n) => {
652
- let i = n.find((e) => !r.includes(e));
653
- i === void 0 ? e() : t.onChange(i);
654
- }
655
- });
656
- }
657
- return t.control === "toggle" ? /* @__PURE__ */ C(f, {
658
- size: "sm",
659
- variant: "flat",
660
- className: t.className ? `${N.toggleBar} ${t.className}` : N.toggleBar,
661
- ariaLabel: t.name,
662
- items: t.options.map((e) => ({
663
- value: e.value,
664
- label: e.glyph ?? e.label,
665
- ariaLabel: X(e.label),
666
- tooltip: Q(e),
667
- disabled: e.disabled
668
- })),
669
- value: n,
670
- onChange: (e) => {
671
- e !== null && t.onChange(e);
672
- }
673
- }) : /* @__PURE__ */ C(o, {
674
- className: t.className ? `${N.select} ${t.className}` : N.select,
675
- triggerId: t.id,
676
- "aria-label": t.name,
677
- placeholder: t.mixed ? "Mixed" : t.placeholder ?? (t.unset ? "—" : "Choose option…"),
678
- selectedKey: n,
679
- options: t.options.map((e) => ({
680
- value: e.value,
681
- label: e.label,
682
- icon: Z(e.glyph),
683
- isDisabled: e.disabled
684
- })),
685
- onSelectionChange: (n) => {
686
- e("property-panel", "select", {
687
- name: t.name,
688
- value: n
689
- }), t.onChange(n);
690
- }
691
- });
692
- }
693
- function $(e) {
694
- let t = b(e?.trim() ?? "");
695
- return /^#[0-9a-f]{8}$/i.test(t) ? {
696
- rgb: t.slice(0, 7).toLowerCase(),
697
- alpha: y(t)
698
- } : {
699
- rgb: "#000000",
700
- alpha: 1
701
- };
702
- }
703
- function xe(e) {
704
- 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) => {
705
- if (!n) {
706
- e(a);
707
- return;
708
- }
709
- let o = $(a);
710
- (o.rgb !== r.rgb || !t) && e(o.rgb);
711
- let s = Math.round(o.alpha * 100) / 100;
712
- s !== Math.round(i * 100) / 100 && t?.(s);
713
- }, 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) : G;
714
- return /* @__PURE__ */ C(a, {
715
- id: e.id,
716
- className: e.className ? `${N.colorField} ${e.className}` : N.colorField,
717
- value: e.mixed ? void 0 : t ? x(r.rgb, i) : e.value ?? "#000000",
718
- mixed: e.mixed,
719
- alpha: t,
720
- alphaDisabled: e.alphaDisabled,
721
- onInput: c,
722
- onChange: l,
723
- "aria-label": e.name
724
- });
725
- }
726
- function Se(e) {
727
- let t = e.control === "inline" ? p : m;
728
- return /* @__PURE__ */ C(t, {
729
- className: e.className,
730
- value: e.value,
731
- mixed: e.mixed,
732
- unset: e.unset,
733
- kinds: e.kinds,
734
- allowNone: e.allowNone,
735
- onChange: e.onChange,
736
- onInput: e.onInput,
737
- "aria-label": e.name
738
- });
739
- }
740
- //#endregion
741
- export { oe as a, L as c, N as d, R as i, se as l, de as n, ce as o, Z as r, ae as s, fe as t, F as u };
742
-
743
- //# sourceMappingURL=PropertyField-BbNqK8xr.js.map