@weasel-js/ui 0.5.1 → 0.7.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.
- package/dist/chunks/ActionBar-CiKvEvXi.js +63 -0
- package/dist/chunks/ActionBar-CiKvEvXi.js.map +1 -0
- package/dist/chunks/ActionsBar-CzU6Of3B.js +94 -0
- package/dist/chunks/ActionsBar-CzU6Of3B.js.map +1 -0
- package/dist/chunks/Badge-DU8ihE7Z.js +2942 -0
- package/dist/chunks/Badge-DU8ihE7Z.js.map +1 -0
- package/dist/chunks/Button-9QNIYugK.js +87 -0
- package/dist/chunks/Button-9QNIYugK.js.map +1 -0
- package/dist/chunks/Callout-Dt0kBIls.js +114 -0
- package/dist/chunks/Callout-Dt0kBIls.js.map +1 -0
- package/dist/chunks/Checkbox-CtK8H_OQ.js +47 -0
- package/dist/chunks/Checkbox-CtK8H_OQ.js.map +1 -0
- package/dist/chunks/ColorField-sGLnThpB.js +60 -0
- package/dist/chunks/ColorField-sGLnThpB.js.map +1 -0
- package/dist/chunks/ComboBox-pH8aDEL2.js +88 -0
- package/dist/chunks/ComboBox-pH8aDEL2.js.map +1 -0
- package/dist/chunks/CurveEditor-DrORWShU.js +786 -0
- package/dist/chunks/CurveEditor-DrORWShU.js.map +1 -0
- package/dist/chunks/DataGrid-mUq38k0Q.js +186 -0
- package/dist/chunks/DataGrid-mUq38k0Q.js.map +1 -0
- package/dist/chunks/Dialog-CQymDCAl.js +58 -0
- package/dist/chunks/Dialog-CQymDCAl.js.map +1 -0
- package/dist/chunks/Field-BHSu2F3E.js +31 -0
- package/dist/chunks/Field-BHSu2F3E.js.map +1 -0
- package/dist/chunks/Input-D_Xzgr2b.js +55 -0
- package/dist/chunks/Input-D_Xzgr2b.js.map +1 -0
- package/dist/chunks/Keycaps-B9dJMYx_.js +397 -0
- package/dist/chunks/Keycaps-B9dJMYx_.js.map +1 -0
- package/dist/chunks/NumberField-BQmELz32.js +59 -0
- package/dist/chunks/NumberField-BQmELz32.js.map +1 -0
- package/dist/chunks/OptionsBar-CHOP_CiW.js +98 -0
- package/dist/chunks/OptionsBar-CHOP_CiW.js.map +1 -0
- package/dist/chunks/Plot2D-CEnhzodm.js +168 -0
- package/dist/chunks/Plot2D-CEnhzodm.js.map +1 -0
- package/dist/chunks/PointPlotter-D528sBdT.js +16 -0
- package/dist/chunks/PointPlotter-D528sBdT.js.map +1 -0
- package/dist/chunks/Powerline-C8rddbbK.js +36 -0
- package/dist/chunks/Powerline-C8rddbbK.js.map +1 -0
- package/dist/chunks/Prefs-snBejOzK.js +238 -0
- package/dist/chunks/Prefs-snBejOzK.js.map +1 -0
- package/dist/chunks/RadioGroup-Ci-I9NEx.js +49 -0
- package/dist/chunks/RadioGroup-Ci-I9NEx.js.map +1 -0
- package/dist/chunks/RangeSlider-CW-edtNx.js +52 -0
- package/dist/chunks/RangeSlider-CW-edtNx.js.map +1 -0
- package/dist/chunks/Select-l7pAkVEG.js +97 -0
- package/dist/chunks/Select-l7pAkVEG.js.map +1 -0
- package/dist/chunks/SelectionPanel-CMglTgEf.js +303 -0
- package/dist/chunks/SelectionPanel-CMglTgEf.js.map +1 -0
- package/dist/chunks/Sidebar-BFcBx8QV.js +26 -0
- package/dist/chunks/Sidebar-BFcBx8QV.js.map +1 -0
- package/dist/chunks/SidebarPanel-CRnSlvee.js +59 -0
- package/dist/chunks/SidebarPanel-CRnSlvee.js.map +1 -0
- package/dist/chunks/Slider-sUJGgmKR.js +221 -0
- package/dist/chunks/Slider-sUJGgmKR.js.map +1 -0
- package/dist/chunks/Switch-DxJLMYki.js +27 -0
- package/dist/chunks/Switch-DxJLMYki.js.map +1 -0
- package/dist/chunks/Tabs-DelDecks.js +41 -0
- package/dist/chunks/Tabs-DelDecks.js.map +1 -0
- package/dist/chunks/Toast-Bw3XQxmV.js +128 -0
- package/dist/chunks/Toast-Bw3XQxmV.js.map +1 -0
- package/dist/chunks/ToggleBar-Defj6Asn.js +129 -0
- package/dist/chunks/ToggleBar-Defj6Asn.js.map +1 -0
- package/dist/chunks/ToolButton-Dk_uJf7N.js +53 -0
- package/dist/chunks/ToolButton-Dk_uJf7N.js.map +1 -0
- package/dist/chunks/ToolGroup-D8-qdtuw.js +25 -0
- package/dist/chunks/ToolGroup-D8-qdtuw.js.map +1 -0
- package/dist/chunks/ToolOptionsBar-ChiL-HVA.js +27 -0
- package/dist/chunks/ToolOptionsBar-ChiL-HVA.js.map +1 -0
- package/dist/chunks/ToolPalette-xKHzPKYf.js +117 -0
- package/dist/chunks/ToolPalette-xKHzPKYf.js.map +1 -0
- package/dist/chunks/Tooltip-Clgn4trm.js +39 -0
- package/dist/chunks/Tooltip-Clgn4trm.js.map +1 -0
- package/dist/chunks/keyGlyph-BDH5fqkO.js +22 -0
- package/dist/chunks/keyGlyph-BDH5fqkO.js.map +1 -0
- package/dist/components/ActionBar/index.js +2 -0
- package/dist/components/ActionsBar/index.js +2 -0
- package/dist/components/Badge/index.js +2 -0
- package/dist/components/Button/index.js +2 -0
- package/dist/components/Callout/index.js +2 -0
- package/dist/components/Checkbox/index.js +2 -0
- package/dist/components/ColorField/index.js +2 -0
- package/dist/components/ComboBox/index.js +2 -0
- package/dist/components/CurveEditor/index.js +2 -0
- package/dist/components/DataGrid/index.js +2 -0
- package/dist/components/Dialog/index.js +2 -0
- package/dist/components/Field/index.js +2 -0
- package/dist/components/Input/index.js +2 -0
- package/dist/components/Keycaps/index.js +3 -0
- package/dist/components/NumberField/index.js +2 -0
- package/dist/components/OptionsBar/index.js +2 -0
- package/dist/components/Plot2D/index.js +2 -0
- package/dist/components/PointPlotter/index.js +2 -0
- package/dist/components/Powerline/index.js +3 -0
- package/dist/components/Prefs/index.js +2 -0
- package/dist/components/RadioGroup/index.js +2 -0
- package/dist/components/RangeSlider/index.js +2 -0
- package/dist/components/Select/index.js +2 -0
- package/dist/components/SelectionPanel/SelectionPanel.d.ts.map +1 -1
- package/dist/components/SelectionPanel/index.d.ts +1 -1
- package/dist/components/SelectionPanel/index.d.ts.map +1 -1
- package/dist/components/SelectionPanel/index.js +2 -0
- package/dist/components/SelectionPanel/model.d.ts +13 -11
- package/dist/components/SelectionPanel/model.d.ts.map +1 -1
- package/dist/components/Sidebar/index.js +2 -0
- package/dist/components/SidebarPanel/index.js +2 -0
- package/dist/components/Slider/index.js +2 -0
- package/dist/components/Switch/index.js +2 -0
- package/dist/components/Tabs/index.js +2 -0
- package/dist/components/Toast/index.js +2 -0
- package/dist/components/ToggleBar/ToggleBar.d.ts +17 -0
- package/dist/components/ToggleBar/ToggleBar.d.ts.map +1 -1
- package/dist/components/ToggleBar/index.js +2 -0
- package/dist/components/ToolButton/index.js +2 -0
- package/dist/components/ToolGroup/index.js +2 -0
- package/dist/components/ToolOptionsBar/ToolOptionsBar.d.ts +44 -0
- package/dist/components/ToolOptionsBar/ToolOptionsBar.d.ts.map +1 -0
- package/dist/components/ToolOptionsBar/index.d.ts +3 -0
- package/dist/components/ToolOptionsBar/index.d.ts.map +1 -0
- package/dist/components/ToolOptionsBar/index.js +2 -0
- package/dist/components/ToolPalette/index.js +2 -0
- package/dist/components/Tooltip/index.js +2 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +50 -6749
- package/dist/index.js.map +1 -1
- package/dist/style.css +1 -1
- package/package.json +8 -4
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { Label as e, Slider as t, SliderOutput as n, SliderThumb as r, SliderTrack as i } from "react-aria-components";
|
|
2
|
+
import { Fragment as a, jsx as o, jsxs as s } from "react/jsx-runtime";
|
|
3
|
+
var c = {
|
|
4
|
+
slider: "_slider_3o71w_1",
|
|
5
|
+
head: "_head_3o71w_17",
|
|
6
|
+
label: "_label_3o71w_24",
|
|
7
|
+
output: "_output_3o71w_30",
|
|
8
|
+
track: "_track_3o71w_36",
|
|
9
|
+
fill: "_fill_3o71w_50",
|
|
10
|
+
thumb: "_thumb_3o71w_59"
|
|
11
|
+
};
|
|
12
|
+
//#endregion
|
|
13
|
+
//#region src/components/RangeSlider/RangeSlider.tsx
|
|
14
|
+
function l(l) {
|
|
15
|
+
let { label: u, showOutput: d, formatOutput: f, className: p, ...m } = l, h = d ?? u !== void 0;
|
|
16
|
+
return /* @__PURE__ */ s(t, {
|
|
17
|
+
...m,
|
|
18
|
+
className: [c.slider, p].filter(Boolean).join(" "),
|
|
19
|
+
children: [(u !== void 0 || h) && /* @__PURE__ */ s("div", {
|
|
20
|
+
className: c.head,
|
|
21
|
+
children: [u !== void 0 && /* @__PURE__ */ o(e, {
|
|
22
|
+
className: c.label,
|
|
23
|
+
children: u
|
|
24
|
+
}), h && /* @__PURE__ */ o(n, {
|
|
25
|
+
className: c.output,
|
|
26
|
+
children: ({ state: e }) => {
|
|
27
|
+
let t = e.values.length === 1 ? e.values[0] : e.values;
|
|
28
|
+
return f ? f(t) : Array.isArray(t) ? t.join(" – ") : String(t);
|
|
29
|
+
}
|
|
30
|
+
})]
|
|
31
|
+
}), /* @__PURE__ */ o(i, {
|
|
32
|
+
className: c.track,
|
|
33
|
+
children: ({ state: e }) => {
|
|
34
|
+
let t = e.values.length > 1 ? e.getThumbPercent(0) * 100 : 0, n = e.getThumbPercent(e.values.length - 1) * 100;
|
|
35
|
+
return /* @__PURE__ */ s(a, { children: [/* @__PURE__ */ o("div", {
|
|
36
|
+
className: c.fill,
|
|
37
|
+
style: {
|
|
38
|
+
left: `${t}%`,
|
|
39
|
+
right: `${100 - n}%`
|
|
40
|
+
}
|
|
41
|
+
}), e.values.map((e, t) => /* @__PURE__ */ o(r, {
|
|
42
|
+
index: t,
|
|
43
|
+
className: c.thumb
|
|
44
|
+
}, t))] });
|
|
45
|
+
}
|
|
46
|
+
})]
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
//#endregion
|
|
50
|
+
export { l as t };
|
|
51
|
+
|
|
52
|
+
//# sourceMappingURL=RangeSlider-CW-edtNx.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RangeSlider-CW-edtNx.js","names":[],"sources":["../../src/components/RangeSlider/RangeSlider.module.css","../../src/components/RangeSlider/RangeSlider.tsx"],"sourcesContent":[".slider {\n display: flex;\n flex-direction: column;\n width: 100%;\n gap: 4px;\n font-family: var(--wzl-font-ui);\n color: var(--wzl-fg);\n}\n\n.slider[data-orientation=\"vertical\"] {\n flex-direction: row;\n align-items: stretch;\n width: 28px;\n height: 160px;\n}\n\n.head {\n display: flex;\n align-items: baseline;\n justify-content: space-between;\n gap: 8px;\n}\n\n.label {\n font-size: 12px;\n font-weight: 500;\n color: var(--wzl-fg);\n}\n\n.output {\n font-size: 12px;\n color: var(--wzl-fg-subtle);\n font-variant-numeric: tabular-nums;\n}\n\n.track {\n position: relative;\n height: 6px;\n min-width: 80px;\n background: var(--wzl-track-bg);\n border: 1px solid var(--wzl-track-border);\n border-radius: 3px;\n}\n\n.slider[data-orientation=\"vertical\"] .track {\n width: 6px;\n height: 100%;\n}\n\n.fill {\n position: absolute;\n top: 0;\n bottom: 0;\n left: 0;\n background: var(--wzl-accent-strong);\n border-radius: 3px;\n}\n\n.thumb {\n width: 14px;\n height: 14px;\n background: var(--wzl-thumb-fill);\n border: 1px solid var(--wzl-thumb-border);\n border-radius: 50%;\n cursor: ew-resize;\n outline: none;\n transition: box-shadow var(--wzl-motion-fast);\n}\n\n.slider[data-orientation=\"vertical\"] .thumb {\n cursor: ns-resize;\n}\n\n.thumb[data-focus-visible] {\n box-shadow: 0 0 0 2px var(--wzl-focus-ring);\n}\n\n.thumb[data-dragging] {\n background: var(--wzl-accent-strong);\n}\n\n.slider[data-disabled] {\n opacity: 0.5;\n cursor: not-allowed;\n}\n","import type { ReactNode } from 'react';\nimport {\n Slider as RACSlider,\n SliderOutput,\n SliderTrack,\n SliderThumb,\n Label,\n type SliderProps as RACSliderProps,\n} from 'react-aria-components';\nimport s from './RangeSlider.module.css';\n\nexport type RangeSliderProps = Omit<RACSliderProps, 'children' | 'className'> & {\n label?: ReactNode;\n /** Show the current value next to the label. Defaults to true when a\n * label is supplied. */\n showOutput?: boolean;\n /** Format the rendered value(s). Useful for units (`v => `${v}%``). */\n formatOutput?: (v: number | number[]) => ReactNode;\n className?: string;\n};\n\n/**\n * Linear range slider on React Aria. Single-value by default; pass an array\n * to `value` / `defaultValue` for multi-thumb. Distinct from the kit's\n * canvas-scrub `Slider`, which is shaped for tool-canvas interactions.\n */\nexport function RangeSlider(props: RangeSliderProps) {\n const { label, showOutput, formatOutput, className, ...rest } = props;\n const wantOutput = showOutput ?? label !== undefined;\n return (\n <RACSlider {...rest} className={[s.slider, className].filter(Boolean).join(' ')}>\n {(label !== undefined || wantOutput) && (\n <div className={s.head}>\n {label !== undefined && <Label className={s.label}>{label}</Label>}\n {wantOutput && (\n <SliderOutput className={s.output}>\n {({ state }) => {\n const v = state.values.length === 1 ? state.values[0] : state.values;\n return formatOutput ? formatOutput(v) : Array.isArray(v) ? v.join(' – ') : String(v);\n }}\n </SliderOutput>\n )}\n </div>\n )}\n <SliderTrack className={s.track}>\n {({ state }) => {\n // Single-thumb: fill from start to thumb. Multi-thumb: fill\n // between adjacent thumbs (simplest = between first and last).\n const fillStart = state.values.length > 1 ? state.getThumbPercent(0) * 100 : 0;\n const fillEnd = state.getThumbPercent(state.values.length - 1) * 100;\n return (\n <>\n <div\n className={s.fill}\n style={{ left: `${fillStart}%`, right: `${100 - fillEnd}%` }}\n />\n {state.values.map((_, i) => (\n <SliderThumb key={i} index={i} className={s.thumb} />\n ))}\n </>\n );\n }}\n </SliderTrack>\n </RACSlider>\n );\n}\n"],"mappings":";;;;;;;;;;;;;AC0BA,SAAgB,EAAY,GAAyB;CACnD,IAAM,EAAE,UAAO,eAAY,iBAAc,cAAW,GAAG,MAAS,GAC1D,IAAa,KAAc,MAAU,KAAA;CAC3C,OACE,kBAAC,GAAD;EAAW,GAAI;EAAM,WAAW,CAAC,EAAE,QAAQ,EAAU,CAAC,OAAO,QAAQ,CAAC,KAAK,IAAI;YAA/E,EACI,MAAU,KAAA,KAAa,MACvB,kBAAC,OAAD;GAAK,WAAW,EAAE;aAAlB,CACG,MAAU,KAAA,KAAa,kBAAC,GAAD;IAAO,WAAW,EAAE;cAAQ;IAAc,CAAA,EACjE,KACC,kBAAC,GAAD;IAAc,WAAW,EAAE;eACvB,EAAE,eAAY;KACd,IAAM,IAAI,EAAM,OAAO,WAAW,IAAI,EAAM,OAAO,KAAK,EAAM;KAC9D,OAAO,IAAe,EAAa,EAAE,GAAG,MAAM,QAAQ,EAAE,GAAG,EAAE,KAAK,MAAM,GAAG,OAAO,EAAE;;IAEzE,CAAA,CAEb;MAER,kBAAC,GAAD;GAAa,WAAW,EAAE;cACtB,EAAE,eAAY;IAGd,IAAM,IAAY,EAAM,OAAO,SAAS,IAAI,EAAM,gBAAgB,EAAE,GAAG,MAAM,GACvE,IAAU,EAAM,gBAAgB,EAAM,OAAO,SAAS,EAAE,GAAG;IACjE,OACE,kBAAA,GAAA,EAAA,UAAA,CACE,kBAAC,OAAD;KACE,WAAW,EAAE;KACb,OAAO;MAAE,MAAM,GAAG,EAAU;MAAI,OAAO,GAAG,MAAM,EAAQ;MAAI;KAC5D,CAAA,EACD,EAAM,OAAO,KAAK,GAAG,MACpB,kBAAC,GAAD;KAAqB,OAAO;KAAG,WAAW,EAAE;KAAS,EAAnC,EAAmC,CACrD,CACD,EAAA,CAAA;;GAGK,CAAA,CACJ"}
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
import { n as e } from "./Field-BHSu2F3E.js";
|
|
2
|
+
import { Button as t, FieldError as n, Label as r, ListBox as i, ListBoxItem as a, Popover as o, Select as s, SelectValue as c, Text as l } from "react-aria-components";
|
|
3
|
+
import { jsx as u, jsxs as d } from "react/jsx-runtime";
|
|
4
|
+
var f = {
|
|
5
|
+
field: "_field_u92mg_1",
|
|
6
|
+
trigger: "_trigger_u92mg_9",
|
|
7
|
+
value: "_value_u92mg_41",
|
|
8
|
+
chevron: "_chevron_u92mg_54",
|
|
9
|
+
popover: "_popover_u92mg_61",
|
|
10
|
+
listbox: "_listbox_u92mg_67",
|
|
11
|
+
option: "_option_u92mg_80",
|
|
12
|
+
check: "_check_u92mg_105"
|
|
13
|
+
};
|
|
14
|
+
//#endregion
|
|
15
|
+
//#region src/components/Select/Select.tsx
|
|
16
|
+
function p(a) {
|
|
17
|
+
let { label: p, description: h, errorMessage: g, placeholder: _, options: v, children: y, selectedKey: b, defaultSelectedKey: x, onSelectionChange: S, className: C, ...w } = a;
|
|
18
|
+
return /* @__PURE__ */ d(s, {
|
|
19
|
+
...w,
|
|
20
|
+
selectedKey: b ?? void 0,
|
|
21
|
+
defaultSelectedKey: x,
|
|
22
|
+
onSelectionChange: S ? (e) => S(e) : void 0,
|
|
23
|
+
className: [
|
|
24
|
+
f.field,
|
|
25
|
+
e.root,
|
|
26
|
+
C
|
|
27
|
+
].filter(Boolean).join(" "),
|
|
28
|
+
children: [
|
|
29
|
+
p !== void 0 && /* @__PURE__ */ u(r, {
|
|
30
|
+
className: e.label,
|
|
31
|
+
children: p
|
|
32
|
+
}),
|
|
33
|
+
/* @__PURE__ */ d(t, {
|
|
34
|
+
className: f.trigger,
|
|
35
|
+
children: [/* @__PURE__ */ u(c, {
|
|
36
|
+
className: f.value,
|
|
37
|
+
children: ({ defaultChildren: e, isPlaceholder: t }) => t ? _ ?? e : e
|
|
38
|
+
}), /* @__PURE__ */ u("svg", {
|
|
39
|
+
className: f.chevron,
|
|
40
|
+
viewBox: "0 0 10 10",
|
|
41
|
+
"aria-hidden": "true",
|
|
42
|
+
children: /* @__PURE__ */ u("path", {
|
|
43
|
+
d: "M2 4 L5 7 L8 4",
|
|
44
|
+
fill: "none",
|
|
45
|
+
stroke: "currentColor",
|
|
46
|
+
strokeWidth: "1.5",
|
|
47
|
+
strokeLinecap: "round",
|
|
48
|
+
strokeLinejoin: "round"
|
|
49
|
+
})
|
|
50
|
+
})]
|
|
51
|
+
}),
|
|
52
|
+
h !== void 0 && /* @__PURE__ */ u(l, {
|
|
53
|
+
slot: "description",
|
|
54
|
+
className: e.hint,
|
|
55
|
+
children: h
|
|
56
|
+
}),
|
|
57
|
+
/* @__PURE__ */ u(n, {
|
|
58
|
+
className: e.error,
|
|
59
|
+
children: g
|
|
60
|
+
}),
|
|
61
|
+
/* @__PURE__ */ u(o, {
|
|
62
|
+
className: f.popover,
|
|
63
|
+
children: /* @__PURE__ */ u(i, {
|
|
64
|
+
className: f.listbox,
|
|
65
|
+
children: v === void 0 ? y : v.map((e) => /* @__PURE__ */ u(m, {
|
|
66
|
+
id: e.value,
|
|
67
|
+
isDisabled: e.isDisabled,
|
|
68
|
+
children: e.label
|
|
69
|
+
}, String(e.value)))
|
|
70
|
+
})
|
|
71
|
+
})
|
|
72
|
+
]
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
function m({ children: e, className: t, ...n }) {
|
|
76
|
+
return /* @__PURE__ */ d(a, {
|
|
77
|
+
...n,
|
|
78
|
+
className: [f.option, t].filter(Boolean).join(" "),
|
|
79
|
+
children: [/* @__PURE__ */ u("svg", {
|
|
80
|
+
className: f.check,
|
|
81
|
+
viewBox: "0 0 10 10",
|
|
82
|
+
"aria-hidden": "true",
|
|
83
|
+
children: /* @__PURE__ */ u("polyline", {
|
|
84
|
+
points: "1.5,5 4,7.5 8.5,3",
|
|
85
|
+
fill: "none",
|
|
86
|
+
stroke: "currentColor",
|
|
87
|
+
strokeWidth: "1.6",
|
|
88
|
+
strokeLinecap: "round",
|
|
89
|
+
strokeLinejoin: "round"
|
|
90
|
+
})
|
|
91
|
+
}), e]
|
|
92
|
+
});
|
|
93
|
+
}
|
|
94
|
+
//#endregion
|
|
95
|
+
export { m as n, p as t };
|
|
96
|
+
|
|
97
|
+
//# sourceMappingURL=Select-l7pAkVEG.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Select-l7pAkVEG.js","names":[],"sources":["../../src/components/Select/Select.module.css","../../src/components/Select/Select.tsx"],"sourcesContent":[".field {\n display: flex;\n flex-direction: column;\n width: 100%;\n min-width: 0;\n gap: 4px;\n}\n\n.trigger {\n display: flex;\n width: 100%;\n align-items: center;\n gap: 6px;\n height: 24px;\n padding: 0 6px 0 10px;\n background: var(--wzl-input-bg);\n border: 1px solid var(--wzl-border);\n border-radius: var(--wzl-radius-sm);\n color: var(--wzl-fg);\n font-family: var(--wzl-font-ui);\n font-size: 13px;\n line-height: 1;\n cursor: pointer;\n transition: border-color var(--wzl-motion-fast), box-shadow var(--wzl-motion-fast);\n}\n\n.trigger[data-focus-visible] {\n border-color: var(--wzl-focus-ring);\n box-shadow: 0 0 0 1px var(--wzl-focus-ring);\n}\n\n.field[data-invalid] .trigger {\n border-color: var(--wzl-danger, #ff5b5b);\n}\n\n.trigger[data-disabled] {\n opacity: 0.5;\n cursor: not-allowed;\n}\n\n.value {\n flex: 1;\n min-width: 0;\n text-align: left;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n}\n\n.value[data-placeholder] {\n color: var(--wzl-fg-subtle);\n}\n\n.chevron {\n width: 10px;\n height: 10px;\n color: var(--wzl-fg-muted);\n flex: 0 0 auto;\n}\n\n.popover {\n min-width: var(--trigger-width);\n max-height: inherit;\n outline: none;\n}\n\n.listbox {\n background: var(--wzl-surface-raised);\n border: 1px solid var(--wzl-border);\n border-radius: var(--wzl-radius-md);\n box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);\n padding: 4px;\n max-height: 280px;\n overflow: auto;\n outline: none;\n font-family: var(--wzl-font-ui);\n font-size: 13px;\n}\n\n.option {\n display: flex;\n align-items: center;\n gap: 8px;\n padding: 4px 8px;\n border-radius: 3px;\n cursor: pointer;\n color: var(--wzl-fg);\n outline: none;\n}\n\n.option[data-focused] {\n background: color-mix(in srgb, var(--wzl-fg) 10%, transparent);\n}\n\n.option[data-selected] {\n color: var(--wzl-fg);\n font-weight: 500;\n}\n\n.option[data-disabled] {\n opacity: 0.4;\n cursor: not-allowed;\n}\n\n.check {\n width: 10px;\n height: 10px;\n flex: 0 0 auto;\n opacity: 0;\n}\n\n.option[data-selected] .check {\n opacity: 1;\n}\n","import type { ReactNode } from 'react';\nimport {\n Select as RACSelect,\n Label,\n Button as RACButton,\n SelectValue,\n Popover as RACPopover,\n ListBox as RACListBox,\n ListBoxItem as RACListBoxItem,\n Text,\n FieldError,\n type SelectProps as RACSelectProps,\n type ListBoxItemProps as RACListBoxItemProps,\n type ValidationResult,\n} from 'react-aria-components';\nimport { fieldClasses } from '../Field/Field';\nimport s from './Select.module.css';\n\nexport type SelectOption = {\n value: string;\n label: ReactNode;\n isDisabled?: boolean;\n};\n\ntype Key = string | number;\n\nexport type SelectProps<T extends Key = string> = Omit<RACSelectProps<object>, 'children' | 'className' | 'selectedKey' | 'defaultSelectedKey' | 'onSelectionChange'> & {\n label?: ReactNode;\n description?: ReactNode;\n errorMessage?: ReactNode | ((v: ValidationResult) => ReactNode);\n placeholder?: string;\n /** Either pass `options` for a quick render, or `children` for full control. */\n options?: ReadonlyArray<SelectOption & { value: T }>;\n children?: ReactNode;\n selectedKey?: T | null;\n defaultSelectedKey?: T;\n onSelectionChange?: (key: T) => void;\n className?: string;\n};\n\n/**\n * Form select wrapping React Aria's Select. Pass either `options` for a\n * quick declarative render or `children` of `<SelectItem>` for control over\n * each row.\n *\n * The selection key type is parameterized so consumers with a string-literal\n * union for `value` (e.g. `'r' | 'g' | 'b'`) get a typed `onSelectionChange`.\n */\nexport function Select<T extends Key = string>(props: SelectProps<T>) {\n const {\n label,\n description,\n errorMessage,\n placeholder,\n options,\n children,\n selectedKey,\n defaultSelectedKey,\n onSelectionChange,\n className,\n ...rest\n } = props;\n\n return (\n <RACSelect\n {...rest}\n selectedKey={selectedKey ?? undefined}\n defaultSelectedKey={defaultSelectedKey}\n onSelectionChange={onSelectionChange ? (k) => onSelectionChange(k as T) : undefined}\n className={[s.field, fieldClasses.root, className].filter(Boolean).join(' ')}\n >\n {label !== undefined && <Label className={fieldClasses.label}>{label}</Label>}\n <RACButton className={s.trigger}>\n <SelectValue className={s.value}>\n {({ defaultChildren, isPlaceholder }) =>\n isPlaceholder ? (placeholder ?? defaultChildren) : defaultChildren\n }\n </SelectValue>\n <svg className={s.chevron} viewBox=\"0 0 10 10\" aria-hidden=\"true\">\n <path d=\"M2 4 L5 7 L8 4\" fill=\"none\" stroke=\"currentColor\" strokeWidth=\"1.5\" strokeLinecap=\"round\" strokeLinejoin=\"round\" />\n </svg>\n </RACButton>\n {description !== undefined && (\n <Text slot=\"description\" className={fieldClasses.hint}>\n {description}\n </Text>\n )}\n <FieldError className={fieldClasses.error}>{errorMessage}</FieldError>\n <RACPopover className={s.popover}>\n <RACListBox className={s.listbox}>\n {options !== undefined\n ? options.map((o) => (\n <SelectItem key={String(o.value)} id={o.value} isDisabled={o.isDisabled}>\n {o.label}\n </SelectItem>\n ))\n : children}\n </RACListBox>\n </RACPopover>\n </RACSelect>\n );\n}\n\nexport type SelectItemProps = Omit<RACListBoxItemProps, 'className' | 'children'> & {\n children?: ReactNode;\n className?: string;\n};\n\nexport function SelectItem({ children, className, ...rest }: SelectItemProps) {\n return (\n <RACListBoxItem {...rest} className={[s.option, className].filter(Boolean).join(' ')}>\n <svg className={s.check} viewBox=\"0 0 10 10\" aria-hidden=\"true\">\n <polyline points=\"1.5,5 4,7.5 8.5,3\" fill=\"none\" stroke=\"currentColor\" strokeWidth=\"1.6\" strokeLinecap=\"round\" strokeLinejoin=\"round\" />\n </svg>\n {children}\n </RACListBoxItem>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;ACgDA,SAAgB,EAA+B,GAAuB;CACpE,IAAM,EACJ,UACA,gBACA,iBACA,gBACA,YACA,aACA,gBACA,uBACA,sBACA,cACA,GAAG,MACD;CAEJ,OACE,kBAAC,GAAD;EACE,GAAI;EACJ,aAAa,KAAe,KAAA;EACR;EACpB,mBAAmB,KAAqB,MAAM,EAAkB,EAAO,GAAG,KAAA;EAC1E,WAAW;GAAC,EAAE;GAAO,EAAa;GAAM;GAAU,CAAC,OA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|
1
|
+
import { t as e } from "./ColorField-sGLnThpB.js";
|
|
2
|
+
import { t } from "./Input-D_Xzgr2b.js";
|
|
3
|
+
import { t as n } from "./NumberField-BQmELz32.js";
|
|
4
|
+
import { t as r } from "./Select-l7pAkVEG.js";
|
|
5
|
+
import { t as i } from "./Switch-DxJLMYki.js";
|
|
6
|
+
import { Fragment as a, useState as o, useSyncExternalStore as s } from "react";
|
|
7
|
+
import { MIXED as c, asNodeId as l } from "@weasel-js/core";
|
|
8
|
+
import { Fragment as u, jsx as d, jsxs as f } from "react/jsx-runtime";
|
|
9
|
+
//#region src/components/SelectionPanel/model.ts
|
|
10
|
+
function p(e, t) {
|
|
11
|
+
if (e.kind === "container") return "group";
|
|
12
|
+
for (let n of t) if (n.matches(e.data)) return n.name;
|
|
13
|
+
return "unknown";
|
|
14
|
+
}
|
|
15
|
+
function m(e) {
|
|
16
|
+
return !("kind" in e);
|
|
17
|
+
}
|
|
18
|
+
function h(e) {
|
|
19
|
+
let t = [], n = [], r = (e, t) => {
|
|
20
|
+
for (let [n, i] of Object.entries(e.children)) m(i) ? r(i, t) : t.push({
|
|
21
|
+
path: n,
|
|
22
|
+
leaf: i
|
|
23
|
+
});
|
|
24
|
+
};
|
|
25
|
+
for (let [i, a] of Object.entries(e.children)) if (m(a)) {
|
|
26
|
+
let e = [];
|
|
27
|
+
r(a, e), t.push({
|
|
28
|
+
key: i,
|
|
29
|
+
name: a.name,
|
|
30
|
+
rows: g(e)
|
|
31
|
+
});
|
|
32
|
+
} else n.push({
|
|
33
|
+
path: i,
|
|
34
|
+
leaf: a
|
|
35
|
+
});
|
|
36
|
+
return n.length > 0 && t.unshift({
|
|
37
|
+
key: "",
|
|
38
|
+
name: "",
|
|
39
|
+
rows: g(n)
|
|
40
|
+
}), t;
|
|
41
|
+
}
|
|
42
|
+
function g(e) {
|
|
43
|
+
let t = [];
|
|
44
|
+
for (let n of e) {
|
|
45
|
+
let e = n.leaf.pair, r = t[t.length - 1];
|
|
46
|
+
e !== void 0 && r !== void 0 && r.label === e ? r.leaves.push(n) : t.push({
|
|
47
|
+
label: e ?? n.leaf.name,
|
|
48
|
+
leaves: [n]
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
return t;
|
|
52
|
+
}
|
|
53
|
+
function _(e, t) {
|
|
54
|
+
let n = [...new Set(e)];
|
|
55
|
+
if (n.length === 0) return [];
|
|
56
|
+
let r = new Map(t.map((e) => [e.name, e])), i = n.map((e) => r.get(e)?.schema);
|
|
57
|
+
if (i.some((e) => e === void 0)) return [];
|
|
58
|
+
let [a, ...o] = i, s = h(a);
|
|
59
|
+
if (o.length === 0) return s;
|
|
60
|
+
let c = (e) => `${e.path}\0${e.leaf.kind}`, l = o.map((e) => new Set(h(e).flatMap((e) => e.rows).flatMap((e) => e.leaves).map(c))), u = (e) => l.every((t) => t.has(c(e)));
|
|
61
|
+
return s.map((e) => ({
|
|
62
|
+
...e,
|
|
63
|
+
rows: e.rows.map((e) => ({
|
|
64
|
+
...e,
|
|
65
|
+
leaves: e.leaves.filter(u)
|
|
66
|
+
})).filter((e) => e.leaves.length > 0)
|
|
67
|
+
})).filter((e) => e.rows.length > 0);
|
|
68
|
+
}
|
|
69
|
+
function v(e, t) {
|
|
70
|
+
let n = t.split(".");
|
|
71
|
+
if (n.length < 2) return;
|
|
72
|
+
let r = n[0], i = r === "pose" ? e.pose : r === "data" ? e.data : void 0;
|
|
73
|
+
for (let e = 1; e < n.length; e++) {
|
|
74
|
+
if (typeof i != "object" || !i) return;
|
|
75
|
+
i = i[n[e]];
|
|
76
|
+
}
|
|
77
|
+
return i;
|
|
78
|
+
}
|
|
79
|
+
function y(e, t, n) {
|
|
80
|
+
let [r, ...i] = t;
|
|
81
|
+
if (i.length === 0) return Array.isArray(e) ? Object.assign([...e], { [r]: n }) : {
|
|
82
|
+
...e,
|
|
83
|
+
[r]: n
|
|
84
|
+
};
|
|
85
|
+
let a = e[r], o = y(Array.isArray(a) ? [...a] : typeof a == "object" && a ? { ...a } : {}, i, n);
|
|
86
|
+
return Array.isArray(e) ? Object.assign([...e], { [r]: o }) : {
|
|
87
|
+
...e,
|
|
88
|
+
[r]: o
|
|
89
|
+
};
|
|
90
|
+
}
|
|
91
|
+
function b(e, t) {
|
|
92
|
+
let n, r = !0;
|
|
93
|
+
for (let i of e) {
|
|
94
|
+
let e = v(i, t);
|
|
95
|
+
if (r) n = e, r = !1;
|
|
96
|
+
else if (!Object.is(e, n)) return c;
|
|
97
|
+
}
|
|
98
|
+
return n;
|
|
99
|
+
}
|
|
100
|
+
function x(e) {
|
|
101
|
+
let t = /* @__PURE__ */ new Map();
|
|
102
|
+
for (let n of e) t.set(n, (t.get(n) ?? 0) + 1);
|
|
103
|
+
return [...t.entries()].map(([e, t]) => t > 1 ? `${e} ×${t}` : e).join(" · ");
|
|
104
|
+
}
|
|
105
|
+
var S = {
|
|
106
|
+
root: "_root_nbai7_1",
|
|
107
|
+
header: "_header_nbai7_8",
|
|
108
|
+
kind: "_kind_nbai7_16",
|
|
109
|
+
breakdown: "_breakdown_nbai7_21",
|
|
110
|
+
section: "_section_nbai7_26",
|
|
111
|
+
sectionTitle: "_sectionTitle_nbai7_35",
|
|
112
|
+
row: "_row_nbai7_44",
|
|
113
|
+
rowLabel: "_rowLabel_nbai7_52",
|
|
114
|
+
rowControls: "_rowControls_nbai7_56",
|
|
115
|
+
number: "_number_nbai7_68",
|
|
116
|
+
select: "_select_nbai7_69",
|
|
117
|
+
unitSuffix: "_unitSuffix_nbai7_73",
|
|
118
|
+
mixedSwitch: "_mixedSwitch_nbai7_79",
|
|
119
|
+
unrenderable: "_unrenderable_nbai7_83"
|
|
120
|
+
}, C = (e) => e.length === 0 ? e : e[0].toUpperCase() + e.slice(1);
|
|
121
|
+
function w(e) {
|
|
122
|
+
let { scene: t, selection: n, properties: r, routing: i, renderers: o, kindLabel: c = C, emptyState: m = null, className: h } = e;
|
|
123
|
+
s(t.subscribe, t.getVersion, t.getVersion);
|
|
124
|
+
let g = n.current.map((e) => t.get(l(e))).filter((e) => e != null), v = g.map((e) => p(e, i)), b = _(v, r);
|
|
125
|
+
if (g.length === 0) return /* @__PURE__ */ d("div", {
|
|
126
|
+
className: [S.root, h].filter(Boolean).join(" "),
|
|
127
|
+
children: m
|
|
128
|
+
});
|
|
129
|
+
let w = (e, r) => {
|
|
130
|
+
let [i, ...a] = e.path.split(".");
|
|
131
|
+
if (a.length === 0) return;
|
|
132
|
+
let o = n.current.map(l);
|
|
133
|
+
t.batch(`Edit ${e.leaf.name}`, () => {
|
|
134
|
+
for (let e of o) {
|
|
135
|
+
let n = t.get(e);
|
|
136
|
+
n && (i === "pose" ? t.setPose(e, y(n.pose, a, r)) : i === "data" && t.update(e, { data: y(n.data, a, r) }));
|
|
137
|
+
}
|
|
138
|
+
});
|
|
139
|
+
};
|
|
140
|
+
return /* @__PURE__ */ f("div", {
|
|
141
|
+
className: [S.root, h].filter(Boolean).join(" "),
|
|
142
|
+
children: [/* @__PURE__ */ d("header", {
|
|
143
|
+
className: S.header,
|
|
144
|
+
children: g.length === 1 ? /* @__PURE__ */ d("span", {
|
|
145
|
+
className: S.kind,
|
|
146
|
+
children: c(v[0])
|
|
147
|
+
}) : /* @__PURE__ */ f(u, { children: [/* @__PURE__ */ f("span", {
|
|
148
|
+
className: S.kind,
|
|
149
|
+
children: [g.length, " selected"]
|
|
150
|
+
}), /* @__PURE__ */ d("span", {
|
|
151
|
+
className: S.breakdown,
|
|
152
|
+
children: x(v)
|
|
153
|
+
})] })
|
|
154
|
+
}), b.map((e) => {
|
|
155
|
+
let t = e.rows.map((e) => ({
|
|
156
|
+
row: e,
|
|
157
|
+
controls: e.leaves.map((t) => ({
|
|
158
|
+
panelLeaf: t,
|
|
159
|
+
content: T(t, e.leaves.length > 1 ? `${e.label} ${t.leaf.name}` : t.leaf.name, g, o, w)
|
|
160
|
+
})).filter((e) => e.content != null)
|
|
161
|
+
})).filter(({ controls: e }) => e.length > 0);
|
|
162
|
+
return t.length === 0 ? null : /* @__PURE__ */ f("section", {
|
|
163
|
+
className: S.section,
|
|
164
|
+
children: [e.name !== "" && /* @__PURE__ */ d("h3", {
|
|
165
|
+
className: S.sectionTitle,
|
|
166
|
+
children: e.name
|
|
167
|
+
}), t.map(({ row: e, controls: t }) => /* @__PURE__ */ f("div", {
|
|
168
|
+
className: S.row,
|
|
169
|
+
children: [/* @__PURE__ */ d("span", {
|
|
170
|
+
className: S.rowLabel,
|
|
171
|
+
title: e.leaves[0].leaf.description,
|
|
172
|
+
children: e.label
|
|
173
|
+
}), /* @__PURE__ */ d("span", {
|
|
174
|
+
className: S.rowControls,
|
|
175
|
+
children: t.map(({ panelLeaf: e, content: t }) => /* @__PURE__ */ d(a, { children: t }, e.path))
|
|
176
|
+
})]
|
|
177
|
+
}, e.leaves[0].path))]
|
|
178
|
+
}, e.key);
|
|
179
|
+
})]
|
|
180
|
+
});
|
|
181
|
+
}
|
|
182
|
+
function T(e, t, n, r, i) {
|
|
183
|
+
let { path: a, leaf: o } = e, s = b(n, a), l = s === c, u = {
|
|
184
|
+
path: a,
|
|
185
|
+
pref: o,
|
|
186
|
+
value: l ? void 0 : s,
|
|
187
|
+
mixed: l,
|
|
188
|
+
setValue: (t) => i(e, t)
|
|
189
|
+
}, d = r?.[a] ?? r?.[o.kind];
|
|
190
|
+
return d ? d(u) : D(u, t);
|
|
191
|
+
}
|
|
192
|
+
function E(e) {
|
|
193
|
+
if (typeof e != "object" || !e) return;
|
|
194
|
+
let t = e;
|
|
195
|
+
if (!(t.fill !== void 0 && t.fill !== "solid")) return typeof t.color == "string" ? t.color : void 0;
|
|
196
|
+
}
|
|
197
|
+
function D(t, a) {
|
|
198
|
+
let { pref: o, value: s, mixed: c, setValue: l } = t;
|
|
199
|
+
switch (o.kind) {
|
|
200
|
+
case "number": {
|
|
201
|
+
let e = o, t = typeof s == "number" && Number.isFinite(s) ? s : void 0, r = t === void 0 ? NaN : e.unit ? e.unit.toDisplay(t) : t, i = /* @__PURE__ */ d(n, {
|
|
202
|
+
className: S.number,
|
|
203
|
+
value: c || t === void 0 ? NaN : r,
|
|
204
|
+
placeholder: c ? "Mixed" : void 0,
|
|
205
|
+
minValue: e.min,
|
|
206
|
+
maxValue: e.max,
|
|
207
|
+
step: e.step ?? 1,
|
|
208
|
+
hideSteppers: !0,
|
|
209
|
+
"aria-label": a,
|
|
210
|
+
onChange: (t) => {
|
|
211
|
+
Number.isNaN(t) || l(e.unit ? e.unit.fromDisplay(t) : t);
|
|
212
|
+
}
|
|
213
|
+
});
|
|
214
|
+
return e.unit?.suffix === void 0 ? i : /* @__PURE__ */ f(u, { children: [i, /* @__PURE__ */ d("span", {
|
|
215
|
+
className: S.unitSuffix,
|
|
216
|
+
"aria-hidden": "true",
|
|
217
|
+
children: e.unit.suffix
|
|
218
|
+
})] });
|
|
219
|
+
}
|
|
220
|
+
case "string": return /* @__PURE__ */ d(O, {
|
|
221
|
+
text: c ? void 0 : typeof s == "string" ? s : "",
|
|
222
|
+
placeholder: c ? "Mixed" : void 0,
|
|
223
|
+
ariaLabel: a,
|
|
224
|
+
onCommit: l
|
|
225
|
+
});
|
|
226
|
+
case "boolean": {
|
|
227
|
+
let e = /* @__PURE__ */ d(i, {
|
|
228
|
+
isSelected: !!s,
|
|
229
|
+
onChange: l,
|
|
230
|
+
"aria-label": a
|
|
231
|
+
});
|
|
232
|
+
return c ? /* @__PURE__ */ d("span", {
|
|
233
|
+
className: S.mixedSwitch,
|
|
234
|
+
title: "Mixed",
|
|
235
|
+
children: e
|
|
236
|
+
}) : e;
|
|
237
|
+
}
|
|
238
|
+
case "enum": {
|
|
239
|
+
let e = o;
|
|
240
|
+
return /* @__PURE__ */ d(r, {
|
|
241
|
+
className: S.select,
|
|
242
|
+
options: e.options.map((e) => ({
|
|
243
|
+
value: e.value,
|
|
244
|
+
label: e.label
|
|
245
|
+
})),
|
|
246
|
+
selectedKey: c ? null : typeof s == "string" ? s : e.default,
|
|
247
|
+
placeholder: c ? "Mixed" : void 0,
|
|
248
|
+
onSelectionChange: l,
|
|
249
|
+
"aria-label": a
|
|
250
|
+
});
|
|
251
|
+
}
|
|
252
|
+
case "color": {
|
|
253
|
+
let t = o;
|
|
254
|
+
return /* @__PURE__ */ d(e, {
|
|
255
|
+
value: c ? void 0 : typeof s == "string" ? s : t.default,
|
|
256
|
+
mixed: c,
|
|
257
|
+
alpha: t.alpha,
|
|
258
|
+
onChange: l,
|
|
259
|
+
"aria-label": a
|
|
260
|
+
});
|
|
261
|
+
}
|
|
262
|
+
case "paint": {
|
|
263
|
+
let t = o, n = E(s) ?? (c ? void 0 : E(t.default));
|
|
264
|
+
return /* @__PURE__ */ d(e, {
|
|
265
|
+
value: c ? void 0 : n,
|
|
266
|
+
mixed: c || s !== void 0 && E(s) === void 0,
|
|
267
|
+
alpha: t.alpha,
|
|
268
|
+
onChange: (e) => l({
|
|
269
|
+
fill: "solid",
|
|
270
|
+
color: e
|
|
271
|
+
}),
|
|
272
|
+
"aria-label": a
|
|
273
|
+
});
|
|
274
|
+
}
|
|
275
|
+
default: return /* @__PURE__ */ f("span", {
|
|
276
|
+
className: S.unrenderable,
|
|
277
|
+
children: [
|
|
278
|
+
"(",
|
|
279
|
+
o.kind,
|
|
280
|
+
": no renderer)"
|
|
281
|
+
]
|
|
282
|
+
});
|
|
283
|
+
}
|
|
284
|
+
}
|
|
285
|
+
function O({ text: e, placeholder: n, ariaLabel: r, onCommit: i }) {
|
|
286
|
+
let [a, s] = o(null);
|
|
287
|
+
return /* @__PURE__ */ d(t, {
|
|
288
|
+
value: a ?? e ?? "",
|
|
289
|
+
placeholder: n,
|
|
290
|
+
"aria-label": r,
|
|
291
|
+
onChange: s,
|
|
292
|
+
onBlur: () => {
|
|
293
|
+
a !== null && a !== e && i(a), s(null);
|
|
294
|
+
},
|
|
295
|
+
onKeyDown: (e) => {
|
|
296
|
+
e.key === "Enter" && e.target.blur();
|
|
297
|
+
}
|
|
298
|
+
});
|
|
299
|
+
}
|
|
300
|
+
//#endregion
|
|
301
|
+
export { _ as a, y as c, p as i, c as n, x as o, b as r, v as s, w as t };
|
|
302
|
+
|
|
303
|
+
//# sourceMappingURL=SelectionPanel-CMglTgEf.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SelectionPanel-CMglTgEf.js","names":[],"sources":["../../src/components/SelectionPanel/model.ts","../../src/components/SelectionPanel/SelectionPanel.module.css","../../src/components/SelectionPanel/SelectionPanel.tsx"],"sourcesContent":["// Pure selection→panel derivations for SelectionPanel. Kept free of\n// React so intersection/aggregation semantics are unit-testable.\n//\n// Path convention (see core `NodePropertiesEntry`): a leaf's OWN KEY in\n// the schema is its node path — a dotted path of any depth rooted at\n// `pose` or `data` (`pose.x`, `data.fill`, `data.style.fontSize`). Group\n// keys are organizational only.\n\nimport {\n MIXED,\n type Mixed,\n type NodePropertiesEntry,\n type NodeRoutingEntry,\n type SceneNode,\n type ToolPrefGroup,\n type ToolPrefLeaf,\n} from '@weasel-js/core';\n\n// Re-exported under its existing public name here: the kit-wide \"these\n// values disagree\" sentinel (`@weasel-js/core`'s `MIXED`) also covers\n// multi-node aggregation, so this panel doesn't get its own symbol.\nexport { MIXED };\nexport type { Mixed };\n\nexport type AnyNode = SceneNode<unknown, string, unknown>;\n\nexport interface PanelLeaf {\n /** Dotted node path — the leaf's key in the schema. */\n path: string;\n leaf: ToolPrefLeaf;\n}\n\nexport interface PanelRow {\n label: string;\n leaves: PanelLeaf[];\n}\n\nexport interface PanelSection {\n key: string;\n name: string;\n rows: PanelRow[];\n}\n\n/** Derive a node's kind: containers are `'group'`; leaves classify their\n * `data` through the routing entries (first match wins, `'unknown'`\n * otherwise) — same semantics as core's `NodeRouting.classify`. */\nexport function classifyKind(\n node: AnyNode,\n routing: readonly NodeRoutingEntry[],\n): string {\n if (node.kind === 'container') return 'group';\n for (const entry of routing) {\n if (entry.matches(node.data)) return entry.name;\n }\n return 'unknown';\n}\n\nfunction isGroup(n: ToolPrefLeaf | ToolPrefGroup): n is ToolPrefGroup {\n return !('kind' in n);\n}\n\n/** Flatten a schema to sections of leaves. Nested groups fold into their\n * top-level section; top-level leaves get an untitled leading section. */\nfunction flatten(schema: ToolPrefGroup): PanelSection[] {\n const sections: PanelSection[] = [];\n const untitled: PanelLeaf[] = [];\n\n const collect = (group: ToolPrefGroup, into: PanelLeaf[]): void => {\n for (const [key, child] of Object.entries(group.children)) {\n if (isGroup(child)) collect(child, into);\n else into.push({ path: key, leaf: child });\n }\n };\n\n for (const [key, child] of Object.entries(schema.children)) {\n if (isGroup(child)) {\n const leaves: PanelLeaf[] = [];\n collect(child, leaves);\n sections.push({ key, name: child.name, rows: pairRows(leaves) });\n } else {\n untitled.push({ path: key, leaf: child });\n }\n }\n if (untitled.length > 0) {\n sections.unshift({ key: '', name: '', rows: pairRows(untitled) });\n }\n return sections;\n}\n\n/** Merge consecutive leaves sharing a `pair` id into one labeled row. */\nfunction pairRows(leaves: readonly PanelLeaf[]): PanelRow[] {\n const rows: PanelRow[] = [];\n for (const item of leaves) {\n const pair = item.leaf.pair;\n const prev = rows[rows.length - 1];\n if (pair !== undefined && prev !== undefined && prev.label === pair) {\n prev.leaves.push(item);\n } else {\n rows.push({ label: pair ?? item.leaf.name, leaves: [item] });\n }\n }\n return rows;\n}\n\n/**\n * The schema the panel shows for a set of kinds: one kind → its full\n * schema; several → the intersection by (path, leaf kind), shaped by the\n * first kind's section/row layout. Kinds without a registered schema\n * contribute nothing, so their presence collapses the intersection.\n */\nexport function effectiveSections(\n kinds: readonly string[],\n entries: readonly NodePropertiesEntry[],\n): PanelSection[] {\n const uniq = [...new Set(kinds)];\n if (uniq.length === 0) return [];\n const byName = new Map(entries.map((e) => [e.name, e]));\n const schemas = uniq.map((k) => byName.get(k)?.schema);\n if (schemas.some((s) => s === undefined)) return [];\n const [first, ...rest] = schemas as ToolPrefGroup[];\n\n const flatFirst = flatten(first);\n if (rest.length === 0) return flatFirst;\n\n // '\\0' delimiter: path and kind strings are unconstrained, so a\n // printable separator could collide with real content.\n const leafKey = (l: PanelLeaf): string => `${l.path}\\0${l.leaf.kind}`;\n const restKeys = rest.map(\n (schema) =>\n new Set(\n flatten(schema)\n .flatMap((s) => s.rows)\n .flatMap((r) => r.leaves)\n .map(leafKey),\n ),\n );\n const keep = (l: PanelLeaf): boolean =>\n restKeys.every((set) => set.has(leafKey(l)));\n\n return flatFirst\n .map((section) => ({\n ...section,\n rows: section.rows\n .map((row) => ({ ...row, leaves: row.leaves.filter(keep) }))\n .filter((row) => row.leaves.length > 0),\n }))\n .filter((section) => section.rows.length > 0);\n}\n\n/** Read a node value at a dotted path of any depth (`pose.x`,\n * `data.style.fontSize`, `data.style.fill.color`). Returns `undefined` if\n * the path is dotless (mirrors `commit`'s no-op on a malformed schema\n * key) or if any intermediate segment is missing or not an object. */\nexport function nodeValueAt(node: AnyNode, path: string): unknown {\n const segments = path.split('.');\n if (segments.length < 2) return undefined;\n const head = segments[0];\n let cursor: unknown = head === 'pose' ? node.pose : head === 'data' ? node.data : undefined;\n for (let i = 1; i < segments.length; i++) {\n if (cursor == null || typeof cursor !== 'object') return undefined;\n cursor = (cursor as Record<string, unknown>)[segments[i]];\n }\n return cursor;\n}\n\n/** Immutably set `value` at a dotted path within `root`, cloning each level\n * on the way down so React sees new object identities. Arrays stay arrays\n * (an array intermediate is shallow-copied, not flattened into `{0: ...}`)\n * — this is the write-side twin of `nodeValueAt`, so a schema author who\n * gets a working read gets a working write. */\nexport function setAtPath(root: object, segments: readonly string[], value: unknown): object {\n const [head, ...rest] = segments;\n if (rest.length === 0) {\n return Array.isArray(root)\n ? Object.assign([...root], { [head]: value })\n : { ...root, [head]: value };\n }\n const child = (root as Record<string, unknown>)[head];\n const childObj = Array.isArray(child)\n ? [...child]\n : child != null && typeof child === 'object'\n ? { ...child }\n : {};\n const nested = setAtPath(childObj, rest, value);\n return Array.isArray(root)\n ? Object.assign([...root], { [head]: nested })\n : { ...root, [head]: nested };\n}\n\n/** Aggregate a path across nodes: the shared value, or `MIXED`. */\nexport function aggregateValue(\n nodes: readonly AnyNode[],\n path: string,\n): unknown | Mixed {\n let value: unknown;\n let first = true;\n for (const node of nodes) {\n const v = nodeValueAt(node, path);\n if (first) {\n value = v;\n first = false;\n } else if (!Object.is(v, value)) {\n return MIXED;\n }\n }\n return value;\n}\n\n/** `'rect ×2 · text'` — kinds in first-seen order with counts. */\nexport function kindBreakdown(kinds: readonly string[]): string {\n const counts = new Map<string, number>();\n for (const k of kinds) counts.set(k, (counts.get(k) ?? 0) + 1);\n return [...counts.entries()]\n .map(([k, n]) => (n > 1 ? `${k} ×${n}` : k))\n .join(' · ');\n}\n",".root {\n display: flex;\n flex-direction: column;\n font-size: 12px;\n color: var(--wzl-text);\n}\n\n.header {\n display: flex;\n align-items: baseline;\n gap: 8px;\n padding: 8px 10px;\n border-block-end: 1px solid var(--wzl-border);\n}\n\n.kind {\n font-weight: 600;\n font-size: 13px;\n}\n\n.breakdown {\n font-size: 11px;\n opacity: 0.6;\n}\n\n.section {\n padding: 6px 10px 8px;\n border-block-end: 1px solid var(--wzl-border);\n}\n\n.section:last-child {\n border-block-end: none;\n}\n\n.sectionTitle {\n margin: 0 0 6px;\n font-size: 10px;\n font-weight: 600;\n text-transform: uppercase;\n letter-spacing: 0.06em;\n opacity: 0.55;\n}\n\n.row {\n display: grid;\n grid-template-columns: 64px 1fr;\n gap: 6px;\n align-items: center;\n margin-block-end: 5px;\n}\n\n.rowLabel {\n opacity: 0.75;\n}\n\n.rowControls {\n display: flex;\n gap: 6px;\n align-items: center;\n min-inline-size: 0;\n}\n\n.rowControls > * {\n flex: 1;\n min-inline-size: 0;\n}\n\n.number :global(input),\n.select {\n font-size: 11px;\n}\n\n.unitSuffix {\n flex: none;\n font-size: 11px;\n opacity: 0.6;\n}\n\n.mixedSwitch {\n opacity: 0.55;\n}\n\n.unrenderable {\n font-size: 11px;\n opacity: 0.5;\n font-style: italic;\n}\n","import { Fragment, useState, useSyncExternalStore, type ReactNode } from 'react';\nimport {\n asNodeId,\n type NodePropertiesEntry,\n type NodeRoutingEntry,\n type Scene,\n type SelectionApi,\n type ToolPrefColor,\n type ToolPrefEnum,\n type ToolPrefLeaf,\n type ToolPrefNumber,\n type ToolPrefPaint,\n} from '@weasel-js/core';\nimport { ColorField } from '../ColorField';\nimport { Input } from '../Input';\nimport { NumberField } from '../NumberField';\nimport { Select } from '../Select';\nimport { Switch } from '../Switch';\nimport {\n MIXED,\n aggregateValue,\n classifyKind,\n effectiveSections,\n kindBreakdown,\n setAtPath,\n type AnyNode,\n type PanelLeaf,\n} from './model';\nimport s from './SelectionPanel.module.css';\n\nexport interface PropertyRenderContext {\n /** Dotted node path of the leaf (`pose.x`, `data.fill`). */\n path: string;\n /** The schema leaf. App renderers narrow it to their own kind shape. */\n pref: ToolPrefLeaf;\n /** Aggregated value across the selection; `undefined` when mixed. */\n value: unknown;\n /** True when selected nodes disagree at this path. */\n mixed: boolean;\n /** Commit a value — fans out to every selected node in one undo step. */\n setValue: (value: unknown) => void;\n}\n\nexport type PropertyRenderer = (ctx: PropertyRenderContext) => ReactNode;\n\nexport interface SelectionPanelProps<TData, TLayer extends string, TPose> {\n /** The scene handle (`useScene`). The panel subscribes itself, so it\n * re-renders on scene mutations regardless of parent renders. */\n scene: Scene<TData, TLayer, TPose>;\n /** Selection handle (`useSelection`). Only `current` is read. */\n selection: Pick<SelectionApi, 'current'>;\n /** Properties-trait entries, e.g. core's `defaultNodeProperties` /\n * `inferredNodeProperties` (+ consumer extras). Memoize or hoist. */\n properties: readonly NodePropertiesEntry[];\n /** Routing-trait classifiers used to derive each node's kind — pass\n * the same list the canvas uses. Memoize or hoist. */\n routing: readonly NodeRoutingEntry[];\n /** Control overrides / app-defined kinds (PrefsForm-style). Keys are\n * leaf paths (`data.fill`, checked first) or leaf kinds (`color`).\n * A renderer returning `null` collapses its leaf (and the row, when\n * every leaf in it collapses). */\n renderers?: Record<string, PropertyRenderer>;\n /** Kind → header label. Default: capitalized kind name. */\n kindLabel?: (kind: string) => string;\n /** Rendered when the selection is empty. */\n emptyState?: ReactNode;\n className?: string;\n}\n\nconst defaultKindLabel = (kind: string): string =>\n kind.length === 0 ? kind : kind[0].toUpperCase() + kind.slice(1);\n\n/**\n * Pre-baked selection properties panel. Shows the selected nodes' kind\n * and the properties-trait schema for that kind; multi-selections show\n * the intersection of the kinds' schemas with per-field Mixed state.\n * Edits commit as one labeled `scene.batch` fan-out per gesture.\n */\nexport function SelectionPanel<TData, TLayer extends string, TPose>(\n props: SelectionPanelProps<TData, TLayer, TPose>,\n) {\n const {\n scene,\n selection,\n properties,\n routing,\n renderers,\n kindLabel = defaultKindLabel,\n emptyState = null,\n className,\n } = props;\n\n useSyncExternalStore(scene.subscribe, scene.getVersion, scene.getVersion);\n\n const nodes = selection.current\n .map((id) => scene.get(asNodeId(id)))\n .filter((n): n is NonNullable<typeof n> => n != null) as readonly AnyNode[];\n\n const kinds = nodes.map((n) => classifyKind(n, routing));\n const sections = effectiveSections(kinds, properties);\n\n if (nodes.length === 0) {\n return <div className={[s.root, className].filter(Boolean).join(' ')}>{emptyState}</div>;\n }\n\n const commit = (leaf: PanelLeaf, value: unknown): void => {\n const [head, ...rest] = leaf.path.split('.');\n if (rest.length === 0) return;\n const ids = selection.current.map(asNodeId);\n scene.batch(`Edit ${leaf.leaf.name}`, () => {\n for (const id of ids) {\n const node = scene.get(id);\n if (!node) continue;\n // `setAtPath` spreads plain objects/arrays down the schema path;\n // consumer `pose`/`data` are assumed plain-object-shaped along\n // that path (a class instance's prototype would be dropped by\n // the spread) — the `as TPose`/`as TData` casts below rely on it.\n if (head === 'pose') {\n scene.setPose(id, setAtPath(node.pose as object, rest, value) as TPose);\n } else if (head === 'data') {\n scene.update(id, { data: setAtPath(node.data as object, rest, value) as TData });\n }\n }\n });\n };\n\n return (\n <div className={[s.root, className].filter(Boolean).join(' ')}>\n <header className={s.header}>\n {nodes.length === 1 ? (\n <span className={s.kind}>{kindLabel(kinds[0])}</span>\n ) : (\n <>\n <span className={s.kind}>{nodes.length} selected</span>\n <span className={s.breakdown}>{kindBreakdown(kinds)}</span>\n </>\n )}\n </header>\n {sections.map((section) => {\n // Render controls before emitting row chrome so a null-rendering\n // leaf (custom renderer opting out) collapses its cell — and the\n // whole row / section when nothing survives. PrefsForm precedent.\n const rows = section.rows\n .map((row) => {\n const controls = row.leaves\n .map((panelLeaf) => ({\n panelLeaf,\n content: renderLeafControl(\n panelLeaf,\n row.leaves.length > 1\n ? `${row.label} ${panelLeaf.leaf.name}`\n : panelLeaf.leaf.name,\n nodes,\n renderers,\n commit,\n ),\n }))\n .filter((c) => c.content != null);\n return { row, controls };\n })\n .filter(({ controls }) => controls.length > 0);\n if (rows.length === 0) return null;\n return (\n <section key={section.key} className={s.section}>\n {section.name !== '' && <h3 className={s.sectionTitle}>{section.name}</h3>}\n {rows.map(({ row, controls }) => (\n <div key={row.leaves[0].path} className={s.row}>\n <span className={s.rowLabel} title={row.leaves[0].leaf.description}>\n {row.label}\n </span>\n <span className={s.rowControls}>\n {controls.map(({ panelLeaf, content }) => (\n <Fragment key={panelLeaf.path}>{content}</Fragment>\n ))}\n </span>\n </div>\n ))}\n </section>\n );\n })}\n </div>\n );\n}\n\nfunction renderLeafControl(\n panelLeaf: PanelLeaf,\n ariaLabel: string,\n nodes: readonly AnyNode[],\n renderers: Record<string, PropertyRenderer> | undefined,\n commit: (leaf: PanelLeaf, value: unknown) => void,\n): ReactNode {\n const { path, leaf } = panelLeaf;\n const aggregated = aggregateValue(nodes, path);\n const mixed = aggregated === MIXED;\n const value = mixed ? undefined : aggregated;\n\n const ctx: PropertyRenderContext = {\n path,\n pref: leaf,\n value,\n mixed,\n setValue: (v) => commit(panelLeaf, v),\n };\n\n const custom = renderers?.[path] ?? renderers?.[leaf.kind];\n if (custom) return custom(ctx);\n return renderBuiltin(ctx, ariaLabel);\n}\n\n/** The color of a solid `FillStyle`, or `undefined` for anything else —\n * including a value that isn't a paint at all. `fill` is optional on the\n * solid member of the union, so the tag alone can't decide it. */\nfunction solidColorOf(value: unknown): string | undefined {\n if (typeof value !== 'object' || value === null) return undefined;\n const paint = value as { fill?: string; color?: unknown };\n if (paint.fill !== undefined && paint.fill !== 'solid') return undefined;\n return typeof paint.color === 'string' ? paint.color : undefined;\n}\n\nfunction renderBuiltin(ctx: PropertyRenderContext, ariaLabel: string): ReactNode {\n const { pref, value, mixed, setValue } = ctx;\n switch (pref.kind) {\n case 'number': {\n const p = pref as ToolPrefNumber;\n const stored = typeof value === 'number' && Number.isFinite(value) ? value : undefined;\n const display = stored !== undefined ? (p.unit ? p.unit.toDisplay(stored) : stored) : NaN;\n const field = (\n <NumberField\n className={s.number}\n value={mixed || stored === undefined ? NaN : display}\n placeholder={mixed ? 'Mixed' : undefined}\n minValue={p.min}\n maxValue={p.max}\n step={p.step ?? 1}\n hideSteppers\n aria-label={ariaLabel}\n onChange={(n) => {\n if (Number.isNaN(n)) return;\n setValue(p.unit ? p.unit.fromDisplay(n) : n);\n }}\n />\n );\n if (p.unit?.suffix === undefined) return field;\n return (\n <>\n {field}\n <span className={s.unitSuffix} aria-hidden=\"true\">\n {p.unit.suffix}\n </span>\n </>\n );\n }\n case 'string': {\n return (\n <DraftInput\n text={mixed ? undefined : typeof value === 'string' ? value : ''}\n placeholder={mixed ? 'Mixed' : undefined}\n ariaLabel={ariaLabel}\n onCommit={setValue}\n />\n );\n }\n case 'boolean': {\n const control = (\n <Switch isSelected={Boolean(value)} onChange={setValue} aria-label={ariaLabel} />\n );\n // Switch has no indeterminate state; a reduced-opacity wrapper with\n // a title is the cheap honest cue for a mixed selection.\n if (!mixed) return control;\n return (\n <span className={s.mixedSwitch} title=\"Mixed\">\n {control}\n </span>\n );\n }\n case 'enum': {\n const p = pref as ToolPrefEnum;\n return (\n <Select<string>\n className={s.select}\n options={p.options.map((o) => ({ value: o.value, label: o.label }))}\n selectedKey={mixed ? null : typeof value === 'string' ? value : p.default}\n placeholder={mixed ? 'Mixed' : undefined}\n onSelectionChange={setValue}\n aria-label={ariaLabel}\n />\n );\n }\n case 'color': {\n const p = pref as ToolPrefColor;\n return (\n <ColorField\n value={mixed ? undefined : typeof value === 'string' ? value : p.default}\n mixed={mixed}\n alpha={p.alpha}\n onChange={setValue}\n aria-label={ariaLabel}\n />\n );\n }\n case 'paint': {\n // The value is a whole `FillStyle`. A solid one has a color to show; a\n // pattern or gradient does not, and showing the control's default there\n // would claim a color the shape doesn't have. It gets the same\n // indeterminate chip a genuinely mixed selection gets — in both cases\n // the honest statement is \"there is no single color here\".\n const p = pref as ToolPrefPaint;\n const solid = solidColorOf(value) ?? (mixed ? undefined : solidColorOf(p.default));\n return (\n <ColorField\n value={mixed ? undefined : solid}\n mixed={mixed || (value !== undefined && solidColorOf(value) === undefined)}\n alpha={p.alpha}\n // Write the whole union member. Setting a `color` key on the\n // existing paint would leave a `{ fill: 'linear-gradient', stops,\n // color }` hybrid that every structural `'color' in paint` check\n // downstream reads as solid.\n onChange={(color) => setValue({ fill: 'solid', color })}\n aria-label={ariaLabel}\n />\n );\n }\n default:\n return <span className={s.unrenderable}>({pref.kind}: no renderer)</span>;\n }\n}\n\n/** Text input with commit-on-blur/Enter semantics — live-per-keystroke\n * writes would emit one undo step per character. */\nfunction DraftInput({\n text,\n placeholder,\n ariaLabel,\n onCommit,\n}: {\n text: string | undefined;\n placeholder?: string;\n ariaLabel: string;\n onCommit: (v: string) => void;\n}) {\n const [draft, setDraft] = useState<string | null>(null);\n return (\n <Input\n value={draft ?? text ?? ''}\n placeholder={placeholder}\n aria-label={ariaLabel}\n onChange={setDraft}\n onBlur={() => {\n if (draft !== null && draft !== text) onCommit(draft);\n setDraft(null);\n }}\n onKeyDown={(e) => {\n if (e.key === 'Enter') (e.target as HTMLInputElement).blur();\n }}\n />\n );\n}\n"],"mappings":";;;;;;;;;AA8CA,SAAgB,EACd,GACA,GACQ;CACR,IAAI,EAAK,SAAS,aAAa,OAAO;CACtC,KAAK,IAAM,KAAS,GAClB,IAAI,EAAM,QAAQ,EAAK,KAAK,EAAE,OAAO,EAAM;CAE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"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { jsx as e } from "react/jsx-runtime";
|
|
2
|
+
var t = {
|
|
3
|
+
sidebar: "_sidebar_ftf90_1",
|
|
4
|
+
left: "_left_ftf90_9",
|
|
5
|
+
right: "_right_ftf90_12"
|
|
6
|
+
};
|
|
7
|
+
//#endregion
|
|
8
|
+
//#region src/components/Sidebar/Sidebar.tsx
|
|
9
|
+
function n(n) {
|
|
10
|
+
let { side: r, ariaLabel: i, children: a, className: o, style: s } = n;
|
|
11
|
+
return /* @__PURE__ */ e("aside", {
|
|
12
|
+
className: [
|
|
13
|
+
t.sidebar,
|
|
14
|
+
r === "left" && t.left,
|
|
15
|
+
r === "right" && t.right,
|
|
16
|
+
o
|
|
17
|
+
].filter(Boolean).join(" "),
|
|
18
|
+
"aria-label": i,
|
|
19
|
+
style: s,
|
|
20
|
+
children: a
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
//#endregion
|
|
24
|
+
export { n as t };
|
|
25
|
+
|
|
26
|
+
//# sourceMappingURL=Sidebar-BFcBx8QV.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Sidebar-BFcBx8QV.js","names":[],"sources":["../../src/components/Sidebar/Sidebar.module.css","../../src/components/Sidebar/Sidebar.tsx"],"sourcesContent":[".sidebar {\n display: flex;\n flex-direction: column;\n gap: 4px;\n background: var(--wzl-panel-bg);\n color: var(--wzl-text);\n}\n\n.sidebar.left {\n border-right: 1px solid var(--wzl-panel-border);\n}\n.sidebar.right {\n border-left: 1px solid var(--wzl-panel-border);\n}\n","import type { CSSProperties, ReactNode } from 'react';\nimport s from './Sidebar.module.css';\n\nexport interface SidebarProps {\n /**\n * Edge the sidebar docks to. Adds a class hook (`s.left` / `s.right`)\n * so consumers can target either edge for borders, shadows, etc.\n * Purely cosmetic — layout is the parent's job.\n */\n side?: 'left' | 'right';\n /**\n * Accessible label — rendered onto the `<aside>`. Without it, screen\n * readers fall back to \"complementary landmark,\" which is fine for\n * apps with a single sidebar but ambiguous when there's both a left\n * and a right.\n */\n ariaLabel?: string;\n children?: ReactNode;\n className?: string;\n /** Inline style — useful for width-as-custom-property handles or any\n * other one-off CSS property the consumer wants to set dynamically. */\n style?: CSSProperties;\n}\n\n/**\n * Generic sidebar shell — `<aside>` with column layout and token-driven\n * surface treatment. Width, sticky positioning, and resize handles stay\n * the consumer's concern (every app has its own layout grid); the kit\n * just provides the chrome.\n *\n * Pair with `<SidebarPanel>` for collapsible sections.\n */\nexport function Sidebar(props: SidebarProps) {\n const { side, ariaLabel, children, className, style } = props;\n const cls = [s.sidebar, side === 'left' && s.left, side === 'right' && s.right, className]\n .filter(Boolean).join(' ');\n return (\n <aside className={cls} aria-label={ariaLabel} style={style}>\n {children}\n </aside>\n );\n}\n"],"mappings":";;;;;;;;ACgCA,SAAgB,EAAQ,GAAqB;CAC3C,IAAM,EAAE,SAAM,cAAW,aAAU,cAAW,aAAU;CAGxD,OACE,kBAAC,SAAD;EAAO,WAHG;GAAC,EAAE;GAAS,MAAS,UAAU,EAAE;GAAM,MAAS,WAAW,EAAE;GAAO;GAAU,CACvF,OAAO,QAAQ,CAAC,KAAK,IAEJ;EAAK,cAAY;EAAkB;EAClD;EACK,CAAA"}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { n as e, t } from "./Tooltip-Clgn4trm.js";
|
|
2
|
+
import { Focusable as n } from "react-aria-components";
|
|
3
|
+
import { jsx as r, jsxs as i } from "react/jsx-runtime";
|
|
4
|
+
var a = {
|
|
5
|
+
panel: "_panel_ox7l9_1",
|
|
6
|
+
title: "_title_ox7l9_7",
|
|
7
|
+
titleRow: "_titleRow_ox7l9_15",
|
|
8
|
+
titleButton: "_titleButton_ox7l9_23",
|
|
9
|
+
chevron: "_chevron_ox7l9_40",
|
|
10
|
+
chevronCollapsed: "_chevronCollapsed_ox7l9_47",
|
|
11
|
+
hideButton: "_hideButton_ox7l9_51",
|
|
12
|
+
collapsed: "_collapsed_ox7l9_64",
|
|
13
|
+
body: "_body_ox7l9_68"
|
|
14
|
+
};
|
|
15
|
+
//#endregion
|
|
16
|
+
//#region src/components/SidebarPanel/SidebarPanel.tsx
|
|
17
|
+
function o(o) {
|
|
18
|
+
let { title: s, collapsed: c, onToggleCollapse: l, onHide: u, children: d, className: f } = o, p = [
|
|
19
|
+
a.panel,
|
|
20
|
+
c && a.collapsed,
|
|
21
|
+
f
|
|
22
|
+
].filter(Boolean).join(" "), m = l !== void 0;
|
|
23
|
+
return /* @__PURE__ */ i("div", {
|
|
24
|
+
className: p,
|
|
25
|
+
children: [s !== void 0 && /* @__PURE__ */ i("div", {
|
|
26
|
+
className: a.titleRow,
|
|
27
|
+
children: [m ? /* @__PURE__ */ i("button", {
|
|
28
|
+
type: "button",
|
|
29
|
+
className: a.titleButton,
|
|
30
|
+
onClick: l,
|
|
31
|
+
"aria-expanded": !c,
|
|
32
|
+
children: [/* @__PURE__ */ r("span", {
|
|
33
|
+
className: [a.chevron, c && a.chevronCollapsed].filter(Boolean).join(" "),
|
|
34
|
+
"aria-hidden": "true",
|
|
35
|
+
children: "▾"
|
|
36
|
+
}), /* @__PURE__ */ r("span", {
|
|
37
|
+
className: a.title,
|
|
38
|
+
children: s
|
|
39
|
+
})]
|
|
40
|
+
}) : /* @__PURE__ */ r("span", {
|
|
41
|
+
className: a.title,
|
|
42
|
+
children: s
|
|
43
|
+
}), u !== void 0 && /* @__PURE__ */ i(e, { children: [/* @__PURE__ */ r(n, { children: /* @__PURE__ */ r("button", {
|
|
44
|
+
type: "button",
|
|
45
|
+
className: a.hideButton,
|
|
46
|
+
onClick: u,
|
|
47
|
+
"aria-label": "Hide panel",
|
|
48
|
+
children: "×"
|
|
49
|
+
}) }), /* @__PURE__ */ r(t, { children: "Hide panel" })] })]
|
|
50
|
+
}), !c && /* @__PURE__ */ r("div", {
|
|
51
|
+
className: a.body,
|
|
52
|
+
children: d
|
|
53
|
+
})]
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
//#endregion
|
|
57
|
+
export { o as t };
|
|
58
|
+
|
|
59
|
+
//# sourceMappingURL=SidebarPanel-CRnSlvee.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SidebarPanel-CRnSlvee.js","names":[],"sources":["../../src/components/SidebarPanel/SidebarPanel.module.css","../../src/components/SidebarPanel/SidebarPanel.tsx"],"sourcesContent":[".panel {\n padding: 8px;\n background: var(--wzl-panel-bg);\n color: var(--wzl-text);\n}\n\n.title {\n font-size: 11px;\n font-weight: 600;\n text-transform: uppercase;\n letter-spacing: 0.05em;\n color: var(--wzl-text-muted);\n}\n\n.titleRow {\n display: flex;\n align-items: center;\n justify-content: space-between;\n margin-bottom: 4px;\n padding: 0;\n}\n\n.titleButton {\n display: inline-flex;\n align-items: center;\n gap: 4px;\n flex: 1 1 auto;\n background: transparent;\n border: 0;\n padding: 4px 8px;\n cursor: pointer;\n color: inherit;\n font: inherit;\n text-align: left;\n}\n.titleButton:hover {\n color: var(--wzl-text);\n}\n\n.chevron {\n display: inline-block;\n font-size: 10px;\n line-height: 1;\n color: var(--wzl-text-muted);\n transition: transform var(--wzl-motion-fast) ease;\n}\n.chevronCollapsed {\n transform: rotate(-90deg);\n}\n\n.hideButton {\n background: transparent;\n border: 0;\n padding: 0 6px;\n font-size: 14px;\n line-height: 1;\n color: var(--wzl-text-muted);\n cursor: pointer;\n}\n.hideButton:hover {\n color: var(--wzl-text);\n}\n\n.panel.collapsed {\n padding-bottom: 4px;\n}\n\n.body {\n padding: 0 4px;\n}\n","import type { ReactNode } from 'react';\nimport { Focusable } from 'react-aria-components';\nimport { Tooltip, TooltipTrigger } from '../Tooltip';\nimport s from './SidebarPanel.module.css';\n\nexport interface SidebarPanelProps {\n /** Title rendered in the panel's header row. */\n title?: ReactNode;\n /**\n * Collapsed state — when true, only the header paints; the body is\n * omitted. Caller owns the state (typically via prefs) and flips it\n * back via `onToggleCollapse`.\n */\n collapsed?: boolean;\n /**\n * Click handler for the title row. When provided, the header renders\n * as a button (chevron + label) and acts as the collapse toggle.\n * When omitted, the title is static text and the panel can't collapse.\n */\n onToggleCollapse?(): void;\n /**\n * Optional close handler — when provided, the header gains a `×`\n * button on the trailing edge. Caller flips its \"hidden\" state and\n * conditionally unmounts the panel from the parent.\n */\n onHide?(): void;\n children?: ReactNode;\n className?: string;\n}\n\n/**\n * Generic collapsible panel section for sidebars. Pure presentation —\n * caller manages `collapsed`/`hidden` state externally (the pattern is\n * to drive it from app prefs so the Preferences modal and inline\n * chevrons toggle the same map).\n *\n * Pair with `<Sidebar>` for the docked column layout.\n */\nexport function SidebarPanel(props: SidebarPanelProps) {\n const { title, collapsed, onToggleCollapse, onHide, children, className } = props;\n const cls = [s.panel, collapsed && s.collapsed, className].filter(Boolean).join(' ');\n const headerInteractive = onToggleCollapse !== undefined;\n return (\n <div className={cls}>\n {title !== undefined && (\n <div className={s.titleRow}>\n {headerInteractive ? (\n <button\n type=\"button\"\n className={s.titleButton}\n onClick={onToggleCollapse}\n aria-expanded={!collapsed}\n >\n <span className={[s.chevron, collapsed && s.chevronCollapsed].filter(Boolean).join(' ')} aria-hidden=\"true\">▾</span>\n <span className={s.title}>{title}</span>\n </button>\n ) : (\n <span className={s.title}>{title}</span>\n )}\n {onHide !== undefined && (\n <TooltipTrigger>\n <Focusable>\n <button\n type=\"button\"\n className={s.hideButton}\n onClick={onHide}\n aria-label=\"Hide panel\"\n >\n ×\n </button>\n </Focusable>\n <Tooltip>Hide panel</Tooltip>\n </TooltipTrigger>\n )}\n </div>\n )}\n {!collapsed && <div className={s.body}>{children}</div>}\n </div>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;ACsCA,SAAgB,EAAa,GAA0B;CACrD,IAAM,EAAE,UAAO,cAAW,qBAAkB,WAAQ,aAAU,iBAAc,GACtE,IAAM;EAAC,EAAE;EAAO,KAAa,EAAE;EAAW;EAAU,CAAC,OAAO,QAAQ,CAAC,KAAK,IAAI,EAC9E,IAAoB,MAAqB,KAAA;CAC/C,OACE,kBAAC,OAAD;EAAK,WAAW;YAAhB,CACG,MAAU,KAAA,KACT,kBAAC,OAAD;GAAK,WAAW,EAAE;aAAlB,CACG,IACC,kBAAC,UAAD;IACE,MAAK;IACL,WAAW,EAAE;IACb,SAAS;IACT,iBAAe,CAAC;cAJlB,CAME,kBAAC,QAAD;KAAM,WAAW,CAAC,EAAE,SAAS,KAAa,EAAE,iBAAiB,CAAC,OAAO,QAAQ,CAAC,KAAK,IAAI;KAAE,eAAY;eAAO;KAAQ,CAAA,EACpH,kBAAC,QAAD;KAAM,WAAW,EAAE;eAAQ;KAAa,CAAA,CACjC;QAET,kBAAC,QAAD;IAAM,WAAW,EAAE;cAAQ;IAAa,CAAA,EAEzC,MAAW,KAAA,KACV,kBAAC,GAAD,EAAA,UAAA,CACE,kBAAC,GAAD,EAAA,UACE,kBAAC,UAAD;IACE,MAAK;IACL,WAAW,EAAE;IACb,SAAS;IACT,cAAW;cACZ;IAEQ,CAAA,EACC,CAAA,EACZ,kBAAC,GAAD,EAAA,UAAS,cAAoB,CAAA,CACd,EAAA,CAAA,CAEf;MAEP,CAAC,KAAa,kBAAC,OAAD;GAAK,WAAW,EAAE;GAAO;GAAe,CAAA,CACnD"}
|