@weasel-js/ui 1.7.1 → 1.7.2

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 (164) hide show
  1. package/dist/chunks/{BandEditor-Dd0egAgE.js → BandEditor-B4jUAHQ8.js} +13 -13
  2. package/dist/chunks/BandEditor-B4jUAHQ8.js.map +1 -0
  3. package/dist/chunks/{ColorField-BLs9fbeq.js → ColorField-BwlelY26.js} +4 -4
  4. package/dist/chunks/ColorField-BwlelY26.js.map +1 -0
  5. package/dist/chunks/{ComboBox-CuTLRmUg.js → ComboBox-DKln_mOd.js} +11 -11
  6. package/dist/chunks/ComboBox-DKln_mOd.js.map +1 -0
  7. package/dist/chunks/{CurveEditor-jVBEqqdv.js → CurveEditor-0EE00D6s.js} +2 -2
  8. package/dist/chunks/{CurveEditor-jVBEqqdv.js.map → CurveEditor-0EE00D6s.js.map} +1 -1
  9. package/dist/chunks/{DataGrid-BklgBqS0.js → DataGrid-CmHJe57v.js} +22 -17
  10. package/dist/chunks/DataGrid-CmHJe57v.js.map +1 -0
  11. package/dist/chunks/DetailList-BpU50XVe.js +54 -0
  12. package/dist/chunks/DetailList-BpU50XVe.js.map +1 -0
  13. package/dist/chunks/{DetentSlider-Bh7EpMqT.js → DetentSlider-DNTAk8xP.js} +2 -2
  14. package/dist/chunks/{DetentSlider-Bh7EpMqT.js.map → DetentSlider-DNTAk8xP.js.map} +1 -1
  15. package/dist/chunks/{FallthroughDiagram-C7BUe8eU.js → FallthroughDiagram-CS1IhQaU.js} +14 -14
  16. package/dist/chunks/FallthroughDiagram-CS1IhQaU.js.map +1 -0
  17. package/dist/chunks/{Field-DsBlnFKf.js → Field-DiX_WByH.js} +2 -2
  18. package/dist/chunks/{Field-DsBlnFKf.js.map → Field-DiX_WByH.js.map} +1 -1
  19. package/dist/chunks/{FillStrokeSwatch-CgsYQgew.js → FillStrokeSwatch-C4h3rUFM.js} +2 -2
  20. package/dist/chunks/FillStrokeSwatch-C4h3rUFM.js.map +1 -0
  21. package/dist/chunks/{FontFamilySelect-CGJ5OIOy.js → FontFamilySelect-DEvMXyZd.js} +2 -2
  22. package/dist/chunks/{FontFamilySelect-CGJ5OIOy.js.map → FontFamilySelect-DEvMXyZd.js.map} +1 -1
  23. package/dist/chunks/{FontWeightSelect-RbcXYJPS.js → FontWeightSelect-BLQ_LMJF.js} +2 -2
  24. package/dist/chunks/{FontWeightSelect-RbcXYJPS.js.map → FontWeightSelect-BLQ_LMJF.js.map} +1 -1
  25. package/dist/chunks/{GradientEditor-DypXzMc-.js → GradientEditor-DD2OjQtn.js} +4 -4
  26. package/dist/chunks/{GradientEditor-DypXzMc-.js.map → GradientEditor-DD2OjQtn.js.map} +1 -1
  27. package/dist/chunks/{InlineRange-P01ABSzo.js → InlineRange-DPjIsJB3.js} +3 -3
  28. package/dist/chunks/InlineRange-DPjIsJB3.js.map +1 -0
  29. package/dist/chunks/{Input-CzwvCZs_.js → Input-D7SDKbST.js} +2 -2
  30. package/dist/chunks/{Input-CzwvCZs_.js.map → Input-D7SDKbST.js.map} +1 -1
  31. package/dist/chunks/{Jog-DfNUYejm.js → Jog-BrkzdGV2.js} +6 -6
  32. package/dist/chunks/Jog-BrkzdGV2.js.map +1 -0
  33. package/dist/chunks/{LayerList-CsDqwYh-.js → LayerList-Bxj1N6bj.js} +3 -3
  34. package/dist/chunks/{LayerList-CsDqwYh-.js.map → LayerList-Bxj1N6bj.js.map} +1 -1
  35. package/dist/chunks/{ListEditor-BnGzqERm.js → ListEditor-OQDzG4A5.js} +2 -2
  36. package/dist/chunks/{ListEditor-BnGzqERm.js.map → ListEditor-OQDzG4A5.js.map} +1 -1
  37. package/dist/chunks/{MenuButton-L9f5vido.js → MenuButton-TAFg88Lp.js} +2 -2
  38. package/dist/chunks/{MenuButton-L9f5vido.js.map → MenuButton-TAFg88Lp.js.map} +1 -1
  39. package/dist/chunks/{MeshEditor-GbqqiPk8.js → MeshEditor-DWpvg8H6.js} +2 -2
  40. package/dist/chunks/{MeshEditor-GbqqiPk8.js.map → MeshEditor-DWpvg8H6.js.map} +1 -1
  41. package/dist/chunks/{NumberField-DLXXgh48.js → NumberField-DS0WSiin.js} +7 -7
  42. package/dist/chunks/NumberField-DS0WSiin.js.map +1 -0
  43. package/dist/chunks/{PaintField-C0hoXc0Y.js → PaintField-BdmQM53v.js} +2 -2
  44. package/dist/chunks/{PaintField-C0hoXc0Y.js.map → PaintField-BdmQM53v.js.map} +1 -1
  45. package/dist/chunks/{PaintInput-jQRxM95Y.js → PaintInput-DaQMeBsI.js} +4 -4
  46. package/dist/chunks/{PaintInput-jQRxM95Y.js.map → PaintInput-DaQMeBsI.js.map} +1 -1
  47. package/dist/chunks/{PatternPicker-CaMYXzhF.js → PatternPicker-B3HcMZWg.js} +2 -2
  48. package/dist/chunks/{PatternPicker-CaMYXzhF.js.map → PatternPicker-B3HcMZWg.js.map} +1 -1
  49. package/dist/chunks/{Plot2D-BHNbgCAl.js → Plot2D-BrvQS0dh.js} +7 -7
  50. package/dist/chunks/Plot2D-BrvQS0dh.js.map +1 -0
  51. package/dist/chunks/{PointPlotter-BZ_vk6gV.js → PointPlotter-BBXpQ_QD.js} +2 -2
  52. package/dist/chunks/{PointPlotter-BZ_vk6gV.js.map → PointPlotter-BBXpQ_QD.js.map} +1 -1
  53. package/dist/chunks/{Prefs-CkyldX-e.js → Prefs-C4MZ28SX.js} +76 -66
  54. package/dist/chunks/Prefs-C4MZ28SX.js.map +1 -0
  55. package/dist/chunks/{Properties-D15c8NP-.js → Properties-DseN56WI.js} +24 -24
  56. package/dist/chunks/{Properties-D15c8NP-.js.map → Properties-DseN56WI.js.map} +1 -1
  57. package/dist/chunks/{PropertyField-CV_Gw57S.js → PropertyField-BbNqK8xr.js} +243 -186
  58. package/dist/chunks/PropertyField-BbNqK8xr.js.map +1 -0
  59. package/dist/chunks/{RadioGroup-4dbzqvGy.js → RadioGroup-B70_M-gT.js} +2 -2
  60. package/dist/chunks/{RadioGroup-4dbzqvGy.js.map → RadioGroup-B70_M-gT.js.map} +1 -1
  61. package/dist/chunks/{RangeSlider-BxokZViJ.js → RangeSlider-DO5TZVk7.js} +8 -8
  62. package/dist/chunks/RangeSlider-DO5TZVk7.js.map +1 -0
  63. package/dist/chunks/{Select-BppLsJTz.js → Select-ouV8O6cp.js} +19 -19
  64. package/dist/chunks/Select-ouV8O6cp.js.map +1 -0
  65. package/dist/chunks/{SelectionPanel-Cm1qu-ZX.js → SelectionPanel-C3WzyaZV.js} +2 -2
  66. package/dist/chunks/{SelectionPanel-Cm1qu-ZX.js.map → SelectionPanel-C3WzyaZV.js.map} +1 -1
  67. package/dist/chunks/{Slider-Cl5RCeZ7.js → Slider-DSrlMEq8.js} +19 -19
  68. package/dist/chunks/Slider-DSrlMEq8.js.map +1 -0
  69. package/dist/chunks/{StatusBar-Ca9Dvhhq.js → StatusBar-BEOfOX0D.js} +6 -6
  70. package/dist/chunks/StatusBar-BEOfOX0D.js.map +1 -0
  71. package/dist/chunks/{SwatchStrip-Cw0l8Om7.js → SwatchStrip-Bi9iPLoh.js} +2 -2
  72. package/dist/chunks/{SwatchStrip-Cw0l8Om7.js.map → SwatchStrip-Bi9iPLoh.js.map} +1 -1
  73. package/dist/chunks/{Timeline-pqnYk5cV.js → Timeline-sMCH2fah.js} +99 -84
  74. package/dist/chunks/Timeline-sMCH2fah.js.map +1 -0
  75. package/dist/chunks/{TokenPanel-DAkL6vwQ.js → TokenPanel-WtKGY2Db.js} +29 -29
  76. package/dist/chunks/TokenPanel-WtKGY2Db.js.map +1 -0
  77. package/dist/chunks/{ToolOptionsBar-COsTJ1cu.js → ToolOptionsBar-CZTYPoC2.js} +2 -2
  78. package/dist/chunks/{ToolOptionsBar-COsTJ1cu.js.map → ToolOptionsBar-CZTYPoC2.js.map} +1 -1
  79. package/dist/chunks/{createKeyframeLayer-BTa4LyJE.js → createKeyframeLayer-DSVf13Su.js} +2 -2
  80. package/dist/chunks/{createKeyframeLayer-BTa4LyJE.js.map → createKeyframeLayer-DSVf13Su.js.map} +1 -1
  81. package/dist/chunks/field.module-B27pWv0i.js +15 -0
  82. package/dist/chunks/{field.module-Bh7BTKMh.js.map → field.module-B27pWv0i.js.map} +1 -1
  83. package/dist/chunks/{model-B1-gMBIW.js → model-qsAFK7_0.js} +2 -2
  84. package/dist/chunks/{model-B1-gMBIW.js.map → model-qsAFK7_0.js.map} +1 -1
  85. package/dist/components/BandEditor/index.js +1 -1
  86. package/dist/components/ColorField/index.js +1 -1
  87. package/dist/components/ComboBox/index.js +1 -1
  88. package/dist/components/CurveEditor/index.js +2 -2
  89. package/dist/components/DataGrid/DataGrid.d.ts +3 -0
  90. package/dist/components/DataGrid/DataGrid.d.ts.map +1 -1
  91. package/dist/components/DataGrid/index.js +1 -1
  92. package/dist/components/DetailList/DetailList.d.ts +1 -1
  93. package/dist/components/DetailList/DetailList.d.ts.map +1 -1
  94. package/dist/components/DetailList/index.js +1 -1
  95. package/dist/components/DetentSlider/index.js +1 -1
  96. package/dist/components/FallthroughDiagram/index.js +1 -1
  97. package/dist/components/Field/index.js +1 -1
  98. package/dist/components/FillStrokeSwatch/FillStrokeSwatch.d.ts +5 -2
  99. package/dist/components/FillStrokeSwatch/FillStrokeSwatch.d.ts.map +1 -1
  100. package/dist/components/FillStrokeSwatch/index.js +1 -1
  101. package/dist/components/FontFamilySelect/index.js +1 -1
  102. package/dist/components/FontWeightSelect/index.js +1 -1
  103. package/dist/components/GradientEditor/index.js +1 -1
  104. package/dist/components/InlineRange/index.js +1 -1
  105. package/dist/components/Input/index.js +1 -1
  106. package/dist/components/Jog/index.js +1 -1
  107. package/dist/components/LayerList/index.js +1 -1
  108. package/dist/components/ListEditor/index.js +1 -1
  109. package/dist/components/MenuButton/index.js +1 -1
  110. package/dist/components/MeshEditor/index.js +1 -1
  111. package/dist/components/NumberField/index.js +1 -1
  112. package/dist/components/PaintField/index.js +1 -1
  113. package/dist/components/PaintInput/index.js +1 -1
  114. package/dist/components/PatternPicker/index.js +1 -1
  115. package/dist/components/Plot2D/index.js +1 -1
  116. package/dist/components/PointPlotter/index.js +1 -1
  117. package/dist/components/Prefs/PrefsForm.d.ts +14 -0
  118. package/dist/components/Prefs/PrefsForm.d.ts.map +1 -1
  119. package/dist/components/Prefs/PrefsRow.d.ts +4 -0
  120. package/dist/components/Prefs/PrefsRow.d.ts.map +1 -1
  121. package/dist/components/Prefs/index.js +1 -1
  122. package/dist/components/Properties/PropertyField.d.ts.map +1 -1
  123. package/dist/components/Properties/PropertyPanel.d.ts +18 -1
  124. package/dist/components/Properties/PropertyPanel.d.ts.map +1 -1
  125. package/dist/components/Properties/index.d.ts +2 -2
  126. package/dist/components/Properties/index.d.ts.map +1 -1
  127. package/dist/components/Properties/index.js +3 -3
  128. package/dist/components/RadioGroup/index.js +1 -1
  129. package/dist/components/RangeSlider/index.js +1 -1
  130. package/dist/components/Select/index.js +1 -1
  131. package/dist/components/SelectionPanel/index.js +2 -2
  132. package/dist/components/Slider/index.js +1 -1
  133. package/dist/components/StatusBar/StatusBar.d.ts +1 -1
  134. package/dist/components/StatusBar/index.js +1 -1
  135. package/dist/components/SwatchStrip/index.js +1 -1
  136. package/dist/components/Timeline/Transport.d.ts.map +1 -1
  137. package/dist/components/Timeline/index.js +1 -1
  138. package/dist/components/TokenPanel/index.js +1 -1
  139. package/dist/components/ToolOptionsBar/index.js +1 -1
  140. package/dist/index.js +75 -75
  141. package/dist/index.js.map +1 -1
  142. package/dist/style.css +1 -1
  143. package/package.json +9 -9
  144. package/dist/chunks/BandEditor-Dd0egAgE.js.map +0 -1
  145. package/dist/chunks/ColorField-BLs9fbeq.js.map +0 -1
  146. package/dist/chunks/ComboBox-CuTLRmUg.js.map +0 -1
  147. package/dist/chunks/DataGrid-BklgBqS0.js.map +0 -1
  148. package/dist/chunks/DetailList-DFtqdOJj.js +0 -52
  149. package/dist/chunks/DetailList-DFtqdOJj.js.map +0 -1
  150. package/dist/chunks/FallthroughDiagram-C7BUe8eU.js.map +0 -1
  151. package/dist/chunks/FillStrokeSwatch-CgsYQgew.js.map +0 -1
  152. package/dist/chunks/InlineRange-P01ABSzo.js.map +0 -1
  153. package/dist/chunks/Jog-DfNUYejm.js.map +0 -1
  154. package/dist/chunks/NumberField-DLXXgh48.js.map +0 -1
  155. package/dist/chunks/Plot2D-BHNbgCAl.js.map +0 -1
  156. package/dist/chunks/Prefs-CkyldX-e.js.map +0 -1
  157. package/dist/chunks/PropertyField-CV_Gw57S.js.map +0 -1
  158. package/dist/chunks/RangeSlider-BxokZViJ.js.map +0 -1
  159. package/dist/chunks/Select-BppLsJTz.js.map +0 -1
  160. package/dist/chunks/Slider-Cl5RCeZ7.js.map +0 -1
  161. package/dist/chunks/StatusBar-Ca9Dvhhq.js.map +0 -1
  162. package/dist/chunks/Timeline-pqnYk5cV.js.map +0 -1
  163. package/dist/chunks/TokenPanel-DAkL6vwQ.js.map +0 -1
  164. package/dist/chunks/field.module-Bh7BTKMh.js +0 -15
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Select-ouV8O6cp.js","names":["Select","RACSelect","f","s","RACButton","RACPopover","RACListBox","listbox","_Fragment","RACListBoxSection","RACListBoxItem","useOverlayPortal","TriggerTooltip","segmentTooltipContent","field_module_default","listbox_module_default","Select_module_default","isGroup","entry","Select$1","variant","rest","props","portalContainer","triggerRef","useRef","pressRef","nudge","setNudge","useState","NO_NUDGE","Select","onSelectionChange","k","width","indicator","orientation","className","anchor","label","Label","Button","triggerId","SelectValue","isPlaceholder","placeholder","defaultChildren","optionLabels","options","children","l","i","description","Text","FieldError","errorMessage","Popover","popup","portalProps","AlignOverTrigger","ListBox","SelectSection","renderOption","CLICK_MS","EDGE","BELOW","markerRef","passes","useLayoutEffect","trigger","popover","value","applied","onMeasure","align","toEnd","box","seat","row","shown","over","lowest","next","useEffect","doc","onUp","press","pastDragThreshold","CheckMark","SelectItem","o","Children","isValidElement","c","withIcon","g","icon","Fragment","ListBoxSection","title","Header","textValueOf","explicit","ListBoxItem","textValue"],"sources":["../../src/components/Select/Select.module.css","../../src/components/Select/Select.tsx"],"sourcesContent":["/* `orientation='row'`: the shared layout sets the trigger beside its label; a\n fit one keeps its own width there rather than the fill width below. */\n.row.fit .trigger { width: auto; }\n\n.trigger {\n display: flex;\n width: 100%;\n align-items: center;\n gap: var(--wzl-space-3);\n /* Hooks, each defaulting to what the frame already draws: the visible box is\n this button, not the root a consumer's `className` lands on, so a surface\n that has to restyle it sets these rather than reaching in here. Together\n they draw the bare look too, for a surface that wants it from context\n rather than from `variant`: a transparent fill, no padding, the chevron\n hidden, the value underlined and an outline for focus. */\n padding: var(--wzl-select-pad, 0 var(--wzl-space-3) 0 var(--wzl-space-5));\n --_frame-h: var(--wzl-select-h);\n --_frame-bg: var(--wzl-select-bg);\n --_frame-border: var(--wzl-select-border);\n --_frame-fg: var(--wzl-select-fg, var(--wzl-fg));\n --_frame-focus-border: var(--wzl-select-focus-border);\n --_frame-focus-shadow: var(--wzl-select-focus-shadow);\n --_frame-focus-outline: var(--wzl-select-focus-outline);\n cursor: pointer;\n}\n\n.trigger[data-focus-visible] {\n outline-offset: 2px;\n}\n\n.value {\n flex: 1;\n min-width: 0;\n text-align: var(--wzl-select-align, left);\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n /* The ellipsis needs `overflow: hidden`, which makes the line box a clip —\n the trigger's `line-height: 1` would cut this text's ascenders and\n descenders off. `normal` is the font's own leading, so it never can. */\n line-height: normal;\n /* The underline hook: none unless a surface or `indicator` turns it on. */\n text-decoration-line: var(--wzl-select-underline, none);\n text-decoration-style: dotted;\n text-decoration-thickness: 1px;\n text-decoration-color: var(--wzl-fg-subtle);\n text-underline-offset: 0.25em;\n transition: text-decoration-color var(--wzl-motion-fast);\n}\n\n.trigger:hover .value,\n.trigger[data-focus-visible] .value {\n text-decoration-style: solid;\n text-decoration-color: var(--wzl-fg-muted);\n}\n\n.select[data-open] .value {\n text-decoration-style: solid;\n text-decoration-color: var(--wzl-accent);\n}\n\n/* `variant='bare'`: no box. The focus ring moves to an outline, since there is no border to recolor. */\n.bare .trigger {\n padding: 0;\n background: transparent;\n border: var(--wzl-select-border, 1px solid transparent);\n}\n\n.bare .trigger[data-focus-visible] {\n border-color: transparent;\n box-shadow: none;\n outline: 1px solid var(--wzl-focus-ring);\n outline-offset: 2px;\n}\n\n.value[data-placeholder] {\n color: var(--wzl-fg-subtle);\n}\n\n.chevron {\n display: var(--wzl-select-chevron, block);\n width: 10px;\n height: 10px;\n color: var(--wzl-fg-muted);\n flex: 0 0 auto;\n}\n\n/* `indicator='underline'`: the value carries the affordance itself. A text\n decoration rather than a border, so it hugs the word and adds nothing to the\n box — the row's height and the value's width are the same either way. The\n rest of the underline's look sits on `.value`, shared with the hook. */\n.underlined .value {\n text-decoration-line: underline;\n}\n\n.value[data-placeholder] {\n text-decoration-color: var(--wzl-fg-subtle);\n}\n\n/* Nothing sits beside the value, so the row's gap and the padding kept for a\n caret are the value's to spend. */\n.underlined .trigger,\n.plain .trigger {\n gap: 0;\n}\n\n.bare.underlined .trigger,\n.bare.plain .trigger {\n padding: 0;\n}\n\n/* A list that hangs below its trigger takes the trigger's width, so the two\n read as one control. One that opens over it is already tied to the trigger\n by its selected row — widening it to match would only add blank rule beside\n the labels. `data-align` is set on exactly the ones that do. */\n.popover:not([data-align]) {\n min-width: var(--trigger-width);\n}\n\n.popover {\n max-height: inherit;\n outline: none;\n}\n\n.option {\n display: flex;\n align-items: center;\n gap: var(--wzl-space-4);\n padding: var(--wzl-space-2) var(--wzl-space-4);\n border-radius: var(--wzl-radius-sm);\n cursor: pointer;\n color: var(--wzl-fg);\n outline: none;\n}\n\n:is(.option, .section) + .section,\n.section + .option {\n margin-top: var(--wzl-space-2);\n padding-top: var(--wzl-space-2);\n border-top: 1px solid var(--wzl-line-subtle);\n}\n\n.sectionHeader {\n padding: var(--wzl-space-2) var(--wzl-space-4);\n font-size: var(--wzl-font-size-sm);\n font-weight: var(--wzl-font-weight-medium);\n color: var(--wzl-fg-subtle);\n}\n\n.optionLabel {\n min-width: 0;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n}\n\n.optionIcon {\n display: inline-flex;\n vertical-align: middle;\n margin-inline-end: var(--wzl-space-3);\n}\n\n.optionIcon > svg {\n display: block;\n}\n\n/* A trigger that sets its value against its end edge gets a list that does the\n same, so the row that opened over the value stays on top of it. */\n.popover[data-align='end'] .option {\n justify-content: flex-end;\n}\n\n.option[data-focused] {\n background: var(--wzl-surface-hover);\n}\n\n.option[data-selected] {\n color: var(--wzl-fg);\n font-weight: var(--wzl-font-weight-medium);\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\n.value .check {\n display: none;\n}\n\n/* `width='fit'`: a hidden stack of every option label shares the value's grid\n cell, so the trigger sizes to its widest option and never resizes on select. */\n.fit .trigger {\n display: grid;\n grid-template-columns: auto auto;\n}\n\n.fit.underlined .trigger,\n.fit.plain .trigger {\n grid-template-columns: auto;\n}\n\n.fit .value,\n.fit .sizer {\n grid-area: 1 / 1;\n}\n\n.fit .chevron {\n grid-area: 1 / 2;\n}\n\n.sizer {\n composes: sizer from '../sizer.module.css';\n}\n","import {\n Children,\n isValidElement,\n useEffect,\n useLayoutEffect,\n useRef,\n useState,\n type ReactNode,\n type RefObject,\n} 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 ListBoxSection as RACListBoxSection,\n Header,\n Text,\n FieldError,\n type SelectProps as RACSelectProps,\n type ListBoxItemProps as RACListBoxItemProps,\n type ValidationResult,\n} from 'react-aria-components';\nimport { pastDragThreshold } from '@weasel-js/core';\nimport type { FieldOrientation } from '../Field/Field';\nimport { useOverlayPortal, type OverlayPortalProps } from '../../overlays/portalHost';\nimport f from '../field.module.css';\nimport listbox from '../listbox.module.css';\nimport s from './Select.module.css';\nimport { TriggerTooltip, segmentTooltipContent, type SegmentTooltipFields } from '../segmentTooltip';\n\n/** One option in a {@link Select}'s `options` list. */\nexport type SelectOption = {\n value: string;\n label: ReactNode;\n isDisabled?: boolean;\n /** A glyph drawn before `label`, in the list and in the trigger. */\n icon?: ReactNode;\n /**\n * Plain-text form of `label`, for type-to-select and screen readers.\n * Only needed when `label` isn't a bare string — a label built from\n * elements has no text React Aria can read off it. A string label\n * supplies this itself.\n */\n textValue?: string;\n};\n\n/** A titled group of options in a {@link Select}'s `options` list. */\nexport type SelectOptionGroup<T extends Key = string> = {\n title: ReactNode;\n options: ReadonlyArray<SelectOption & { value: T }>;\n};\n\ntype Key = string | number;\n\nfunction isGroup<T extends Key>(\n entry: (SelectOption & { value: T }) | SelectOptionGroup<T>,\n): entry is SelectOptionGroup<T> {\n return 'options' in entry;\n}\n\n/** How a {@link Select} trigger signals that it opens a list. */\nexport type SelectIndicator = 'chevron' | 'underline' | 'none';\n\n/** Where a {@link Select}'s list opens relative to its trigger. */\nexport type SelectPopup = 'over' | 'below';\n\n/**\n * Props for {@link Select}, on top of React Aria's `Select` props, with the\n * selection key narrowed to the option value type.\n */\nexport type SelectProps<T extends Key = string> = Omit<RACSelectProps<object>, 'children' | 'className' | 'selectedKey' | 'defaultSelectedKey' | 'onSelectionChange'> & {\n label?: ReactNode;\n /**\n * `'stacked'` (the default) puts the label above the trigger; `'row'` sets it\n * beside the trigger at its own width, with any description or error on a\n * line below. Same vocabulary as {@link Field}'s `orientation`.\n */\n orientation?: FieldOrientation;\n description?: ReactNode;\n errorMessage?: ReactNode | ((v: ValidationResult) => ReactNode);\n placeholder?: string;\n /**\n * Either pass `options` for a quick render, or `children` for full control.\n * An entry with `title` and `options` of its own is a titled section.\n */\n options?: ReadonlyArray<(SelectOption & { value: T }) | SelectOptionGroup<T>>;\n children?: ReactNode;\n selectedKey?: T | null;\n defaultSelectedKey?: T;\n onSelectionChange?: (key: T) => void;\n /**\n * `'fill'` (the default) takes the width of whatever row the select sits in.\n * `'fit'` sizes the trigger to its widest option, so it neither swallows a\n * toolbar's slack nor changes width as the selection moves.\n */\n width?: 'fill' | 'fit';\n /** `'bare'` drops the box, for a select set in a row of other chrome such as a property row. */\n variant?: 'field' | 'bare';\n /**\n * How the trigger says it opens a list. `'chevron'` draws the caret beside\n * the value; `'underline'` marks the value itself, dotted at rest and solid\n * while it is pointed at or open; `'none'` says nothing. Unset takes the\n * variant's own: a boxed select shows the caret, a bare one — set in a row\n * where 10px of caret is a tenth of the value's width — underlines.\n */\n indicator?: SelectIndicator;\n /**\n * Where the list opens. `'over'` (the default) puts the selected row on the\n * trigger, its label in the trigger's own text column, so choosing what is\n * already chosen moves nothing; `'below'` hangs it under the trigger.\n */\n popup?: SelectPopup;\n /**\n * Id for the trigger button. React Aria puts a plain `id` on the wrapper,\n * which is not labelable, so an outer `<label for>` needs this to reach a\n * control the label can actually own.\n */\n triggerId?: string;\n className?: string;\n} & SegmentTooltipFields & OverlayPortalProps;\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; `<SelectSection>` (or an `options` entry with a `title`) groups\n * rows under a heading.\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 *\n * `shortcut` puts a kit tooltip on the trigger reading `Name (⌘K)`, named by\n * `aria-label` or a string `label`, as `Button` does; `tooltip` replaces that\n * text.\n */\nexport function Select<T extends Key = string>(props: SelectProps<T>) {\n const {\n label,\n orientation = 'stacked',\n description,\n errorMessage,\n placeholder,\n options,\n children,\n selectedKey,\n defaultSelectedKey,\n onSelectionChange,\n width = 'fill',\n variant = 'field',\n indicator = variant === 'bare' ? 'underline' : 'chevron',\n popup = 'over',\n triggerId,\n className,\n portalContainer,\n shortcut,\n tooltip,\n ...rest\n } = props;\n\n const { anchor, portalProps } = useOverlayPortal(portalContainer);\n const triggerRef = useRef<HTMLButtonElement>(null);\n const pressRef = useRef<Press | null>(null);\n const [nudge, setNudge] = useState(NO_NUDGE);\n\n return (\n <RACSelect\n {...rest}\n selectedKey={selectedKey}\n defaultSelectedKey={defaultSelectedKey}\n onSelectionChange={onSelectionChange ? (k) => onSelectionChange(k as T) : undefined}\n className={[\n f.field,\n f.control,\n s.select,\n width === 'fit' && `${f.fit} ${s.fit}`,\n variant === 'bare' && s.bare,\n indicator === 'underline' && s.underlined,\n indicator === 'none' && s.plain,\n orientation === 'row' && `${f.row} ${s.row}`,\n className,\n ]\n .filter(Boolean)\n .join(' ')}\n >\n {anchor}\n {label !== undefined && <Label className={f.label}>{label}</Label>}\n <TriggerTooltip\n content={segmentTooltipContent({ tooltip, shortcut, ariaLabel: rest['aria-label'], label })}\n disabled={rest.isDisabled}\n >\n <RACButton\n id={triggerId}\n ref={triggerRef}\n className={`${f.frame} ${s.trigger}`}\n onPointerDown={(e) => {\n pressRef.current = { x: e.clientX, y: e.clientY, at: performance.now() };\n }}\n >\n <SelectValue className={s.value}>\n {({ defaultChildren, isPlaceholder }) =>\n isPlaceholder ? (placeholder ?? defaultChildren) : defaultChildren\n }\n </SelectValue>\n {width === 'fit' && (\n <span className={s.sizer} aria-hidden=\"true\">\n {placeholder !== undefined && <span>{placeholder}</span>}\n {optionLabels(options, children).map((l, i) => (\n <span key={i}>{l}</span>\n ))}\n </span>\n )}\n {indicator === 'chevron' && (\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 )}\n </RACButton>\n </TriggerTooltip>\n {description !== undefined && (\n <Text slot=\"description\" className={`${f.hint} ${f.below}`}>\n {description}\n </Text>\n )}\n <FieldError className={`${f.error} ${f.below}`}>{errorMessage}</FieldError>\n {/* `data-weasel-overlay` marks DOM that belongs to this control but\n renders in a portal, outside the subtree the trigger sits in. Any\n consumer reasoning about \"did focus leave my component?\" via\n `closest()` gets the wrong answer without it — a text editor whose\n font menu lives here would end its session the moment the menu is\n clicked. */}\n <RACPopover\n className={s.popover}\n data-weasel-overlay=\"\"\n placement=\"bottom start\"\n offset={popup === 'over' ? nudge.offset : undefined}\n crossOffset={popup === 'over' ? nudge.crossOffset : undefined}\n shouldFlip={popup !== 'over'}\n {...portalProps}\n >\n {popup === 'over' && (\n <AlignOverTrigger\n triggerRef={triggerRef}\n pressRef={pressRef}\n applied={nudge}\n onMeasure={setNudge}\n />\n )}\n <RACListBox className={`${listbox.surface} ${listbox.list}`}>\n {options !== undefined\n ? options.map((entry, i) =>\n isGroup(entry) ? (\n <SelectSection key={`section-${i}`} title={entry.title}>\n {entry.options.map(renderOption)}\n </SelectSection>\n ) : (\n renderOption(entry)\n ),\n )\n : children}\n </RACListBox>\n </RACPopover>\n </RACSelect>\n );\n}\n\ntype Nudge = { offset: number; crossOffset: number };\n\n/** Where and when the pointer went down on the trigger. */\ntype Press = { x: number; y: number; at: number };\n\n/** How long a press may last and how far it may travel and still be a click. */\nconst CLICK_MS = 500;\n\nconst NO_NUDGE: Nudge = { offset: 0, crossOffset: 0 };\n\n/** The gap kept between a list and the viewport edge — React Aria's own\n * `containerPadding` default. */\nconst EDGE = 12;\n\n/** React Aria's own resting place for a popover: hanging under its trigger. */\nconst BELOW: Nudge = { offset: 8, crossOffset: 0 };\n\n/**\n * Lands the list so its selected row covers the trigger: same text column,\n * same line. The shift is handed back as the popover's own `offset` and\n * `crossOffset` rather than a transform, so React Aria keeps owning the\n * position and still holds the list inside the viewport.\n *\n * Measuring needs the list rendered, and the correction is applied by setting\n * state from a layout effect — React finishes that pass before the browser\n * paints, so the list is never seen at the uncorrected position.\n */\nfunction AlignOverTrigger({\n triggerRef,\n pressRef,\n applied,\n onMeasure,\n}: {\n triggerRef: RefObject<HTMLButtonElement | null>;\n pressRef: RefObject<Press | null>;\n applied: Nudge;\n onMeasure: (next: Nudge) => void;\n}) {\n // React Aria positions the popover but hands out no ref to it, so the\n // element is reached from inside: this marker's own parent.\n const markerRef = useRef<HTMLSpanElement>(null);\n // A measurement that settles takes two passes — one to place the list, one\n // to confirm. A cap is what keeps a list whose own placement changes its\n // measurement from renegotiating forever.\n const passes = useRef(0);\n useLayoutEffect(() => {\n const trigger = triggerRef.current;\n const popover = markerRef.current?.closest<HTMLElement>('[data-weasel-overlay]');\n if (!trigger || !popover || passes.current > 3) return;\n const value = trigger.querySelector(`.${s.value}`);\n // Nothing chosen yet, so there is no row that belongs over the trigger —\n // and putting an arbitrary one under the pointer arms it. A select showing\n // its placeholder hangs its list below, like any other dropdown.\n const label = popover.querySelector(`[data-selected] .${s.optionLabel}`);\n if (!value || !label) {\n if (applied.offset !== BELOW.offset || applied.crossOffset !== BELOW.crossOffset)\n onMeasure(BELOW);\n return;\n }\n\n // The trigger's own text alignment decides which edge the two labels are\n // matched on, and the list follows it so the selected row reads as the\n // trigger with the others unfolded around it.\n const align = getComputedStyle(trigger).getPropertyValue('--wzl-select-align').trim();\n const toEnd = align === 'right' || align === 'end';\n popover.dataset.align = toEnd ? 'end' : 'start';\n\n // Stated against each element's own box rather than measured as a gap to\n // close: React Aria repositions after this effect, so what is on screen\n // now is a frame behind, and a correction read off it would be applied to\n // a position that has already moved — the shift compounds every pass.\n // `bottom start` puts the list's top at the trigger's bottom and their\n // left edges together, so the two insets below are the whole story.\n const box = popover.getBoundingClientRect();\n const seat = trigger.getBoundingClientRect();\n const row = label.getBoundingClientRect();\n const shown = value.getBoundingClientRect();\n // React Aria holds the list inside the viewport across the trigger but not\n // along it, and `offset` moves it along: the selected row sits on the\n // trigger only as far as the rest of the list still fits on screen.\n const over = shown.top + shown.height / 2 - seat.top - (row.top + row.height / 2 - box.top) - seat.height;\n const viewHeight = trigger.ownerDocument.documentElement.clientHeight;\n const lowest = viewHeight - EDGE - box.height - seat.bottom;\n const next = {\n offset: Math.max(EDGE - seat.bottom, Math.min(over, lowest)),\n crossOffset: toEnd\n ? shown.right - seat.left - (row.right - box.left)\n : shown.left - seat.left - (row.left - box.left),\n };\n if (Math.abs(next.offset - applied.offset) < 0.5 && Math.abs(next.crossOffset - applied.crossOffset) < 0.5)\n return;\n passes.current += 1;\n onMeasure(next);\n });\n\n // The list covers the trigger, so the release that ends the click opening it\n // lands on a row — and a row selects on release, which shuts the list again\n // before it has been seen. A click is a press and a release in the same\n // place: that one is the opening gesture and belongs to the trigger, and the\n // list keeps every release after it. Press, hold, drag and release still\n // picks a row, which is the gesture a list over its trigger is for.\n useEffect(() => {\n const doc = triggerRef.current?.ownerDocument;\n if (!doc) return;\n const onUp = (e: PointerEvent) => {\n doc.removeEventListener('pointerup', onUp, true);\n const press = pressRef.current;\n if (!press || performance.now() - press.at > CLICK_MS) return;\n if (pastDragThreshold({ clientX: press.x, clientY: press.y }, e)) return;\n e.preventDefault();\n e.stopPropagation();\n };\n doc.addEventListener('pointerup', onUp, true);\n return () => doc.removeEventListener('pointerup', onUp, true);\n }, [triggerRef, pressRef]);\n\n return <span ref={markerRef} hidden />;\n}\n\n/* `SelectValue` copies the selected row into the trigger, mark included; the\n trigger hides it, so the `width='fit'` sizer leaves it out. */\nfunction CheckMark() {\n return (\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 );\n}\n\nfunction renderOption<T extends Key>(o: SelectOption & { value: T }) {\n return (\n <SelectItem key={String(o.value)} id={o.value} isDisabled={o.isDisabled} icon={o.icon} textValue={o.textValue}>\n {o.label}\n </SelectItem>\n );\n}\n\n/**\n * The labels a `width='fit'` trigger measures itself against. In the children\n * form the label sits one element deep, inside a `SelectItem`, or two inside a\n * `SelectSection`.\n */\nfunction optionLabels(\n options: ReadonlyArray<SelectOption | SelectOptionGroup<Key>> | undefined,\n children: ReactNode,\n): ReactNode[] {\n if (options !== undefined)\n return options.flatMap((o) =>\n 'options' in o ? o.options.map((g) => withIcon(g.icon, g.label)) : [withIcon(o.icon, o.label)],\n );\n return Children.toArray(children).flatMap((c) => {\n if (!isValidElement<{ children?: ReactNode; icon?: ReactNode }>(c)) return [c];\n return c.type === SelectSection\n ? optionLabels(undefined, c.props.children)\n : [withIcon(c.props.icon, c.props.children)];\n });\n}\n\n/** A label led by its icon, as a row draws it. */\nfunction withIcon(icon: ReactNode, label: ReactNode): ReactNode {\n if (icon === undefined || icon === null) return label;\n return (\n <>\n <span className={s.optionIcon} aria-hidden=\"true\">{icon}</span>\n {label}\n </>\n );\n}\n\n/** Props for {@link SelectSection}. */\nexport type SelectSectionProps = {\n /** Heading shown above the section's rows; it also names the group for\n * screen readers. */\n title?: ReactNode;\n children?: ReactNode;\n className?: string;\n};\n\n/** A titled group of `SelectItem` rows in a {@link Select}'s list. */\nexport function SelectSection({ title, children, className }: SelectSectionProps) {\n return (\n <RACListBoxSection className={[s.section, className].filter(Boolean).join(' ')}>\n {title !== undefined && <Header className={s.sectionHeader}>{title}</Header>}\n {children}\n </RACListBoxSection>\n );\n}\n\n/** Props for {@link SelectItem}, on top of React Aria's `ListBoxItem` props. */\nexport type SelectItemProps = Omit<RACListBoxItemProps, 'className' | 'children'> & {\n children?: ReactNode;\n /** A glyph drawn before the label, in the list and in the trigger. */\n icon?: ReactNode;\n className?: string;\n};\n\n/**\n * Every row renders a check mark beside its label, so from React Aria's\n * side the children are never plain text and it can't derive the string\n * type-to-select and screen readers need — it warns once per row. A string\n * label already *is* that string, so derive it rather than making every\n * call site restate it; anything richer has to say what it reads as.\n */\nfunction textValueOf(children: ReactNode, explicit: string | undefined): string | undefined {\n if (explicit !== undefined) return explicit;\n return typeof children === 'string' || typeof children === 'number'\n ? String(children)\n : undefined;\n}\n\n/**\n * One row in a {@link Select}'s list, with a leading check mark when\n * selected. A string child supplies its own `textValue`; anything richer must\n * pass one so type-to-select and screen readers have something to read.\n */\nexport function SelectItem({ children, icon, className, textValue, ...rest }: SelectItemProps) {\n return (\n <RACListBoxItem\n {...rest}\n textValue={textValueOf(children, textValue)}\n className={[s.option, className].filter(Boolean).join(' ')}\n >\n <CheckMark />\n {/* A box around the label, not just text: landing the list over its\n trigger means measuring where this row's label sits. */}\n <span className={s.optionLabel}>{withIcon(icon, children)}</span>\n </RACListBoxItem>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AC0DA,SAASiB,EACP,GAC+B;CAC/B,OAAO,aAAaC;AACtB;AA4EA,SAAgBlB,EAA+B,GAAuB;CACpE,IAAM,EACJ,UACA,iBAAc,WACd,gBACA,iBACA,gBACA,YACA,aACA,gBACA,uBACA,sBACA,WAAQ,QACR,aAAU,SACV,eAAYoB,MAAY,SAAS,cAAc,WAC/C,WAAQ,QACR,cACA,cACA,oBACA,aACA,YACA,GAAGC,MACDC,GAEE,EAAE,WAAQ,mBAAgBX,EAAiBY,CAAe,GAC1DC,IAAaC,EAA0B,IAAI,GAC3CC,IAAWD,EAAqB,IAAI,GACpC,CAACE,GAAOC,KAAYC,EAASC,CAAQ;CAE3C,OACE,kBAAC7B,GAAD;EACE,GAAIoB;EACS;EACO;EACpB,mBAAmBW,KAAqB,MAAMA,EAAkBC,CAAM,IAAI,KAAA;EAC1E,WAAW;GACT/B,EAAE;GACFA,EAAE;GACFC,EAAE;GACF+B,MAAU,SAAS,GAAGhC,EAAE,IAAI,GAAGC,EAAE;GACjCiB,MAAY,UAAUjB,EAAE;GACxBgC,MAAc,eAAehC,EAAE;GAC/BgC,MAAc,UAAUhC,EAAE;GAC1BiC,MAAgB,SAAS,GAAGlC,EAAE,IAAI,GAAGC,EAAE;GACvCkC;EACF,CAAC,CACE,OAAO,OAAO,CAAC,CACf,KAAK,GAAG;EAjBb,UAAA;GAmBGC;GACAC,MAAU,KAAA,KAAa,kBAACC,GAAD;IAAO,WAAWtC,EAAE;IAAQ,UA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AACpD,GAAD;EAAmB,WAAW,CAACN,EAAE,SAASkC,CAAS,CAAC,CAAC,OAAO,OAAO,CAAC,CAAC,KAAK,GAAG;EAA7E,UAAA,CACG8D,MAAU,KAAA,KAAa,kBAACC,GAAD;GAAQ,WAAWjG,EAAE;GAAgB,UAAAgG;EAAc,CAAA,GAC1ElD,CACgB;;AAEvB;AAiBA,SAASoD,EAAY,GAAqB,GAAkD;CAE1F,OADIC,MAAa,KAAA,IACV,OAAOrD,KAAa,YAAY,OAAOA,KAAa,WACvD,OAAOA,CAAQ,IACf,KAAA,IAH+BqD;AAIrC;AAOA,SAAgBb,EAAW,EAAE,aAAU,SAAM,cAAW,cAAW,GAAGpE,KAAyB;CAC7F,OACE,kBAACX,GAAD;EACE,GAAIW;EACJ,WAAWgF,EAAYpD,GAAUuD,CAAS;EAC1C,WAAW,CAACrG,EAAE,QAAQkC,CAAS,CAAC,CAAC,OAAO,OAAO,CAAC,CAAC,KAAK,GAAG;EAH3D,UAAA,CAKE,kBAACmD,GAAD,CAAY,CAAA,GAGZ,kBAAC,QAAD;GAAM,WAAWrF,EAAE;GAAc,UAAA2F,EAASE,GAAM/C,CAAQ;EAAQ,CAAA,CAClD;;AAEpB"}
@@ -1,4 +1,4 @@
1
- import { d as e, f as t, i as n, l as r, n as i, o as a, r as o, s, t as c, u as l } from "./model-B1-gMBIW.js";
1
+ import { d as e, f as t, i as n, l as r, n as i, o as a, r as o, s, t as c, u as l } from "./model-qsAFK7_0.js";
2
2
  import { asNodeId as u } from "@weasel-js/core";
3
3
  import { Fragment as d, jsx as f, jsxs as p } from "react/jsx-runtime";
4
4
  import { Fragment as m, useSyncExternalStore as h } from "react";
@@ -104,4 +104,4 @@ function v(e, t, n, r, a, o) {
104
104
  //#endregion
105
105
  export { _ as t };
106
106
 
107
- //# sourceMappingURL=SelectionPanel-Cm1qu-ZX.js.map
107
+ //# sourceMappingURL=SelectionPanel-C3WzyaZV.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"SelectionPanel-Cm1qu-ZX.js","names":["s","_Fragment","Fragment","renderCells","SelectionPanel_module_default","effectiveSections","setAtPath","aggregateValue","kindBreakdown","classifyKind","MIXED","renderBuiltin","Fragment$1","defaultKindLabel","kind","SelectionPanel","props","scene","nodes","selection","asNodeId","id","n","kinds","routing","selectionKey","sections","properties","className","emptyState","commit","head","rest","leaf","ids","node","value","next","nodeValueAt","kindLabel","Fragment","rows","section","row","leafCell","panelLeaf","renderers","controls","content","key","aggregated","path","mixed","ctx","v","fn","at","p","custom","ariaLabel"],"sources":["../../src/components/SelectionPanel/SelectionPanel.tsx"],"sourcesContent":["import { Fragment, useSyncExternalStore, type ReactNode } from 'react';\nimport {\n asNodeId,\n type NodePropertiesEntry,\n type NodeRoutingEntry,\n type Scene,\n type SelectionApi,\n} from '@weasel-js/core';\nimport {\n renderBuiltin,\n renderCells,\n type LeafCell,\n type PropertyRenderContext,\n type PropertyRenderer,\n} from './renderLeaf';\nimport {\n MIXED,\n aggregateValue,\n classifyKind,\n effectiveSections,\n kindBreakdown,\n nodeValueAt,\n setAtPath,\n type AnyNode,\n type PanelLeaf,\n} from './model';\nimport s from './SelectionPanel.module.css';\n\nexport type { PropertyRenderContext, PropertyRenderer } from './renderLeaf';\n\n/** Props for {@link SelectionPanel}. */\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 selectionKey = nodes.map((n) => n.id).join(',');\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 /** Writes, into every selected node, what `next` derives from the value\n * that node holds at the leaf's path. */\n const commit = (leaf: PanelLeaf, next: (prev: unknown) => 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 const value = next(nodeValueAt(node as AnyNode, leaf.path));\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 = renderCells(\n row.leaves.map((panelLeaf) =>\n leafCell(\n panelLeaf,\n row.leaves.length > 1\n ? `${row.label} ${panelLeaf.leaf.name}`\n : panelLeaf.leaf.name,\n nodes,\n renderers,\n commit,\n selectionKey,\n ),\n ),\n renderers,\n );\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 // A `block` leaf brings its own chrome — it spans the section\n // instead of sitting in a labeled row's control cell. Under a\n // headless section nothing else names it, so it heads itself;\n // an object leaf already renders its own heading.\n row.leaves.length === 1 && row.leaves[0].leaf.block ? (\n <div key={row.leaves[0].path}>\n {section.name === '' && row.leaves[0].leaf.kind !== 'object' && (\n <h4 className={s.sectionTitle} title={row.leaves[0].leaf.description}>\n {row.leaves[0].leaf.name}\n </h4>\n )}\n {controls[0].content}\n </div>\n ) : (\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(({ key, content }) => (\n <Fragment key={key}>{content}</Fragment>\n ))}\n </span>\n </div>\n )\n ))}\n </section>\n );\n })}\n </div>\n );\n}\n\n\nfunction leafCell(\n panelLeaf: PanelLeaf,\n ariaLabel: string,\n nodes: readonly AnyNode[],\n renderers: Record<string, PropertyRenderer> | undefined,\n commit: (leaf: PanelLeaf, next: (prev: unknown) => unknown) => void,\n selectionKey: string,\n): LeafCell {\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 unset: !mixed && aggregated === undefined,\n each: nodes.map((n) => nodeValueAt(n, path)),\n setValue: (v) => commit(panelLeaf, () => v),\n update: (fn) => commit(panelLeaf, fn),\n valueAt: (p) => {\n const at = aggregateValue(nodes, p);\n return at === MIXED ? { value: undefined, mixed: true } : { value: at, mixed: false };\n },\n selectionKey,\n };\n\n return {\n key: path,\n leaf,\n ctx,\n ariaLabel,\n render: () => {\n const custom = renderers?.[path] ?? renderers?.[leaf.kind];\n if (custom) return custom(ctx);\n return renderBuiltin(ctx, ariaLabel, renderers, selectionKey);\n },\n };\n}\n\n"],"mappings":";;;;;AAuDA,IAAMa,KAAoB,MACxBC,EAAK,WAAW,IAAIA,IAAOA,EAAK,EAAE,CAAC,YAAY,IAAIA,EAAK,MAAM,CAAC;AAQjE,SAAgBC,EACd,GACA;CACA,IAAM,EACJ,UACA,cACA,eACA,YACA,cACA,eAAYF,GACZ,gBAAa,MACb,iBACEG;CAEJ,EAAqBC,EAAM,WAAWA,EAAM,YAAYA,EAAM,UAAU;CAExE,IAAMC,IAAQC,EAAU,QACrB,KAAK,MAAOF,EAAM,IAAIG,EAASC,CAAE,CAAC,CAAC,CAAC,CACpC,QAAQ,MAAkCC,KAAK,IAAI,GAEhDC,IAAQL,EAAM,KAAK,MAAMT,EAAaa,GAAGE,CAAO,CAAC,GACjDC,IAAeP,EAAM,KAAK,MAAMI,EAAE,EAAE,CAAC,CAAC,KAAK,GAAG,GAC9CI,IAAWrB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pB,kBAAC7C,GAAD,EAAA,UAAqB8C,EAAkB,GAAxBC,CAAwB,CACxC;KACG,CAAA,CACH;IATK,GAAAN,EAAI,OAAO,EAAE,CAAC,IASnB,CAEN,CACM;GA7BK,GAAAD,EAAQ,GA6Bb;EAEb,CAAC,CACE;;AAET;AAGA,SAASE,EACP,GACA,GACA,GACA,GACA,GACA,GACU;CACV,IAAM,EAAE,SAAM,YAASC,GACjBK,IAAa3C,EAAeW,GAAOiC,CAAI,GACvCC,IAAQF,MAAexC,GAGvB2C,IAA6B;EACjC;EACA,MAAMpB;EACN,OALYmB,IAAQ,KAAA,IAAYF;EAMhC;EACA,OAAO,CAACE,KAASF,MAAe,KAAA;EAChC,MAAMhC,EAAM,KAAK,MAAMoB,EAAYhB,GAAG6B,CAAI,CAAC;EAC3C,WAAW,MAAMrB,EAAOe,SAAiBS,CAAC;EAC1C,SAAS,MAAOxB,EAAOe,GAAWU,CAAE;EACpC,UAAU,MAAM;GACd,IAAMC,IAAKjD,EAAeW,GAAOuC,CAAC;GAClC,OAAOD,MAAO9C,IAAQ;IAAE,OAAO,KAAA;IAAW,OAAO;GAAK,IAAI;IAAE,OAAO8C;IAAI,OAAO;GAAM;EACtF;EACA;CACF;CAEA,OAAO;EACL,KAAKL;EACL;EACA;EACA;EACA,cAAc;GACZ,IAAMO,IAASZ,IAAYK,MAASL,IAAYb,EAAK;GAErD,OADIyB,IAAeA,EAAOL,CAAG,IACtB1C,EAAc0C,GAAKM,GAAWb,GAAWrB,CAAY;EAC9D;CACF;AACF"}
1
+ {"version":3,"file":"SelectionPanel-C3WzyaZV.js","names":["s","_Fragment","Fragment","renderCells","SelectionPanel_module_default","effectiveSections","setAtPath","aggregateValue","kindBreakdown","classifyKind","MIXED","renderBuiltin","Fragment$1","defaultKindLabel","kind","SelectionPanel","props","scene","nodes","selection","asNodeId","id","n","kinds","routing","selectionKey","sections","properties","className","emptyState","commit","head","rest","leaf","ids","node","value","next","nodeValueAt","kindLabel","Fragment","rows","section","row","leafCell","panelLeaf","renderers","controls","content","key","aggregated","path","mixed","ctx","v","fn","at","p","custom","ariaLabel"],"sources":["../../src/components/SelectionPanel/SelectionPanel.tsx"],"sourcesContent":["import { Fragment, useSyncExternalStore, type ReactNode } from 'react';\nimport {\n asNodeId,\n type NodePropertiesEntry,\n type NodeRoutingEntry,\n type Scene,\n type SelectionApi,\n} from '@weasel-js/core';\nimport {\n renderBuiltin,\n renderCells,\n type LeafCell,\n type PropertyRenderContext,\n type PropertyRenderer,\n} from './renderLeaf';\nimport {\n MIXED,\n aggregateValue,\n classifyKind,\n effectiveSections,\n kindBreakdown,\n nodeValueAt,\n setAtPath,\n type AnyNode,\n type PanelLeaf,\n} from './model';\nimport s from './SelectionPanel.module.css';\n\nexport type { PropertyRenderContext, PropertyRenderer } from './renderLeaf';\n\n/** Props for {@link SelectionPanel}. */\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 selectionKey = nodes.map((n) => n.id).join(',');\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 /** Writes, into every selected node, what `next` derives from the value\n * that node holds at the leaf's path. */\n const commit = (leaf: PanelLeaf, next: (prev: unknown) => 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 const value = next(nodeValueAt(node as AnyNode, leaf.path));\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 = renderCells(\n row.leaves.map((panelLeaf) =>\n leafCell(\n panelLeaf,\n row.leaves.length > 1\n ? `${row.label} ${panelLeaf.leaf.name}`\n : panelLeaf.leaf.name,\n nodes,\n renderers,\n commit,\n selectionKey,\n ),\n ),\n renderers,\n );\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 // A `block` leaf brings its own chrome — it spans the section\n // instead of sitting in a labeled row's control cell. Under a\n // headless section nothing else names it, so it heads itself;\n // an object leaf already renders its own heading.\n row.leaves.length === 1 && row.leaves[0].leaf.block ? (\n <div key={row.leaves[0].path}>\n {section.name === '' && row.leaves[0].leaf.kind !== 'object' && (\n <h4 className={s.sectionTitle} title={row.leaves[0].leaf.description}>\n {row.leaves[0].leaf.name}\n </h4>\n )}\n {controls[0].content}\n </div>\n ) : (\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(({ key, content }) => (\n <Fragment key={key}>{content}</Fragment>\n ))}\n </span>\n </div>\n )\n ))}\n </section>\n );\n })}\n </div>\n );\n}\n\n\nfunction leafCell(\n panelLeaf: PanelLeaf,\n ariaLabel: string,\n nodes: readonly AnyNode[],\n renderers: Record<string, PropertyRenderer> | undefined,\n commit: (leaf: PanelLeaf, next: (prev: unknown) => unknown) => void,\n selectionKey: string,\n): LeafCell {\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 unset: !mixed && aggregated === undefined,\n each: nodes.map((n) => nodeValueAt(n, path)),\n setValue: (v) => commit(panelLeaf, () => v),\n update: (fn) => commit(panelLeaf, fn),\n valueAt: (p) => {\n const at = aggregateValue(nodes, p);\n return at === MIXED ? { value: undefined, mixed: true } : { value: at, mixed: false };\n },\n selectionKey,\n };\n\n return {\n key: path,\n leaf,\n ctx,\n ariaLabel,\n render: () => {\n const custom = renderers?.[path] ?? renderers?.[leaf.kind];\n if (custom) return custom(ctx);\n return renderBuiltin(ctx, ariaLabel, renderers, selectionKey);\n },\n };\n}\n\n"],"mappings":";;;;;AAuDA,IAAMa,KAAoB,MACxBC,EAAK,WAAW,IAAIA,IAAOA,EAAK,EAAE,CAAC,YAAY,IAAIA,EAAK,MAAM,CAAC;AAQjE,SAAgBC,EACd,GACA;CACA,IAAM,EACJ,UACA,cACA,eACA,YACA,cACA,eAAYF,GACZ,gBAAa,MACb,iBACEG;CAEJ,EAAqBC,EAAM,WAAWA,EAAM,YAAYA,EAAM,UAAU;CAExE,IAAMC,IAAQC,EAAU,QACrB,KAAK,MAAOF,EAAM,IAAIG,EAASC,CAAE,CAAC,CAAC,CAAC,CACpC,QAAQ,MAAkCC,KAAK,IAAI,GAEhDC,IAAQL,EAAM,KAAK,MAAMT,EAAaa,GAAGE,CAAO,CAAC,GACjDC,IAAeP,EAAM,KAAK,MAAMI,EAAE,EAAE,CAAC,CAAC,KAAK,GAAG,GAC9CI,IAAWrB,EAAkBkB,GAAOI,CAAU;CAEpD,IAAIT,EAAM,WAAW,GACnB,OAAO,kBAAC,OAAD;EAAK,WAAW,CAAClB,EAAE,MAAM4B,CAAS,CAAC,CAAC,OAAO,OAAO,CAAC,CAAC,KAAK,GAAG;EAAI,UAAAC;CAAgB,CAAA;CAKzF,IAAMC,KAAU,GAAiB,MAA2C;EAC1E,IAAM,CAACC,GAAM,GAAGC,KAAQ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jBK,IAAa3C,EAAeW,GAAOiC,CAAI,GACvCC,IAAQF,MAAexC,GAGvB2C,IAA6B;EACjC;EACA,MAAMpB;EACN,OALYmB,IAAQ,KAAA,IAAYF;EAMhC;EACA,OAAO,CAACE,KAASF,MAAe,KAAA;EAChC,MAAMhC,EAAM,KAAK,MAAMoB,EAAYhB,GAAG6B,CAAI,CAAC;EAC3C,WAAW,MAAMrB,EAAOe,SAAiBS,CAAC;EAC1C,SAAS,MAAOxB,EAAOe,GAAWU,CAAE;EACpC,UAAU,MAAM;GACd,IAAMC,IAAKjD,EAAeW,GAAOuC,CAAC;GAClC,OAAOD,MAAO9C,IAAQ;IAAE,OAAO,KAAA;IAAW,OAAO;GAAK,IAAI;IAAE,OAAO8C;IAAI,OAAO;GAAM;EACtF;EACA;CACF;CAEA,OAAO;EACL,KAAKL;EACL;EACA;EACA;EACA,cAAc;GACZ,IAAMO,IAASZ,IAAYK,MAASL,IAAYb,EAAK;GAErD,OADIyB,IAAeA,EAAOL,CAAG,IACtB1C,EAAc0C,GAAKM,GAAWb,GAAWrB,CAAY;EAC9D;CACF;AACF"}
@@ -3,24 +3,24 @@ import { jsx as t, jsxs as n } from "react/jsx-runtime";
3
3
  import { useCallback as r, useEffect as i, useMemo as a, useRef as o } from "react";
4
4
  import { decimal as s, qty as c } from "@weasel-js/quantity";
5
5
  var l = {
6
- root: "_root_1v34u_1",
7
- row: "_row_1v34u_12",
8
- track: "_track_1v34u_18",
9
- overhang: "_overhang_1v34u_32",
10
- rail: "_rail_1v34u_36",
11
- trackInner: "_trackInner_1v34u_29",
12
- thumb: "_thumb_1v34u_48",
13
- slim: "_slim_1v34u_81",
14
- thumbActive: "_thumbActive_1v34u_99",
15
- readoutsBelow: "_readoutsBelow_1v34u_107",
16
- readoutBelow: "_readoutBelow_1v34u_114",
17
- readoutInline: "_readoutInline_1v34u_122",
18
- notched: "_notched_1v34u_130",
19
- ticks: "_ticks_1v34u_149",
20
- tick: "_tick_1v34u_149",
21
- withStopLabels: "_withStopLabels_1v34u_170",
22
- stopLabels: "_stopLabels_1v34u_174",
23
- stopLabel: "_stopLabel_1v34u_174"
6
+ root: "_root_6k91g_1",
7
+ row: "_row_6k91g_12",
8
+ track: "_track_6k91g_18",
9
+ thumb: "_thumb_6k91g_35 _numeric_zns9n_4",
10
+ slim: "_slim_6k91g_46",
11
+ notched: "_notched_6k91g_47",
12
+ overhang: "_overhang_6k91g_51",
13
+ rail: "_rail_6k91g_55",
14
+ trackInner: "_trackInner_6k91g_29",
15
+ thumbActive: "_thumbActive_6k91g_120",
16
+ readoutsBelow: "_readoutsBelow_6k91g_128",
17
+ readoutBelow: "_readoutBelow_6k91g_135 _numeric_zns9n_4",
18
+ readoutInline: "_readoutInline_6k91g_146 _numeric_zns9n_4",
19
+ ticks: "_ticks_6k91g_176",
20
+ tick: "_tick_6k91g_176",
21
+ withStopLabels: "_withStopLabels_6k91g_197",
22
+ stopLabels: "_stopLabels_6k91g_201",
23
+ stopLabel: "_stopLabel_6k91g_201 _numeric_zns9n_4"
24
24
  };
25
25
  //#endregion
26
26
  //#region src/components/Slider/Slider.tsx
@@ -386,4 +386,4 @@ function S(s) {
386
386
  //#endregion
387
387
  export { S as t };
388
388
 
389
- //# sourceMappingURL=Slider-Cl5RCeZ7.js.map
389
+ //# sourceMappingURL=Slider-DSrlMEq8.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Slider-DSrlMEq8.js","names":["s","Slider_module_default","quantize","step","v","min","clamp","lo","hi","STOP_SNAP_PX","NO_CAPTURE","usableStops","stops","byValue","stop","s","max","seen","a","b","attract","f","toFraction","best","bestGap","tolerance","gap","stepStops","direction","first","count","i","defaultStep","clampOrdered","index","thumbs","resolveBounds","thumb","fallbackMin","fallbackMax","tuple","ctx","fractionToPosition","READOUT","decimal","Slider","props","stopList","useMemo","even","strict","trackRef","useRef","railRef","dragBufferRef","sessionRef","valueToFraction","useCallback","gaps","x","fractionToValue","c","valueAt","q","trackWidth","beginThumbDrag","buf","seed","t","droppedOff","openPointerSession","origin","down","rail","buffer","rect","ev","bLo","bHi","constraint","bandHeight","onInput","next","onChange","beginShiftAllDrag","startValues","dxFraction","anchorX","starts","df","dValue","allowedNeg","allowedPos","onThumbPointerDown","e","onThumbContextMenu","onTrackPointerDown","wantsMove","track","created","moved","onThumbKeyDown","stepSize","delta","stopDelta","snapTo","placement","renderReadout","display","slim","density","rootVars","trackHeight","labelMode","lastStop","labeledStops","stopLabelRow","rootClass","className","isNotched","customRender","cls","qty","ariaLabel"],"sources":["../../src/components/Slider/Slider.module.css","../../src/components/Slider/Slider.tsx"],"sourcesContent":[".root {\n /* The value span stops this far short of each end of the track. Half a\n * thumb puts an end thumb flush with the edge; `fractionToPosition` in\n * Slider.tsx is the same geometry for painters. */\n --rp-thumb-inset: calc(var(--rp-thumb-size, 14px) / 2);\n position: relative;\n user-select: none;\n -webkit-user-select: none;\n touch-action: none;\n}\n\n.row {\n display: flex;\n align-items: center;\n gap: var(--wzl-space-4);\n}\n\n.track {\n position: relative;\n flex: 1;\n min-width: 0;\n height: var(--rp-track-height, 24px);\n background: var(--wzl-surface-sunken);\n border: 1px solid var(--wzl-border);\n border-radius: var(--wzl-radius-sm);\n cursor: var(--rp-track-cursor, crosshair);\n /* No `overflow: hidden` here — thumbs at extreme values would get\n * clipped at the track edges. The gradient/track-paint clip is\n * applied to `.trackInner` instead, which lets thumbs spill freely. */\n}\n\n/* Invisible hit area past the track and each thumb. The thumbs come later in\n * the tree, so a thumb's slop wins where the two overlap. */\n.track::before,\n.thumb::before {\n content: '';\n position: absolute;\n /* Measured from the padding box, so each 1px border comes back out. */\n inset: calc(-1px - var(--wzl-slider-track-slop));\n}\n\n.thumb::before {\n inset: calc(-1px - var(--wzl-slider-thumb-slop));\n}\n\n.slim .thumb::before,\n.notched::before {\n inset: calc(-1 * var(--wzl-slider-thumb-slop));\n}\n\n.overhang {\n --rp-thumb-inset: 0px;\n}\n\n.rail {\n position: absolute;\n inset: 0 var(--rp-thumb-inset);\n}\n\n.trackInner {\n position: absolute;\n inset: 0;\n border-radius: var(--wzl-radius-sm);\n overflow: hidden;\n}\n\n.thumb {\n composes: numeric from '@weasel-js/theme/numeric.module.css';\n position: absolute;\n /* Thumb extends 2px above + below the track for grabbability + visual\n * weight. Track itself stays its natural height; the thumb just spills. */\n top: -2px;\n bottom: -2px;\n width: var(--rp-thumb-size, 14px);\n margin-left: calc(var(--rp-thumb-size, 14px) / -2);\n display: flex;\n align-items: center;\n justify-content: center;\n background: color-mix(in srgb, var(--wzl-fg-muted) 70%, transparent);\n border: 1px solid var(--wzl-border-strong);\n border-radius: var(--wzl-radius-sm);\n cursor: ew-resize;\n /* Frosted-glass over the (often colorful) track. Cheap on modern GPUs;\n * gracefully degrades to just the partial-alpha background on engines\n * without backdrop-filter support. */\n backdrop-filter: blur(3px);\n -webkit-backdrop-filter: blur(3px);\n /* Subtle raise — sells the \"thumb is on top of the track\" hierarchy. */\n box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);\n font-weight: var(--wzl-font-weight-medium);\n font-size: var(--wzl-font-size-xs);\n line-height: var(--wzl-leading-tight);\n color: var(--wzl-fg-inverse);\n /* White halo so labels stay legible over wildly varying gradient\n * backgrounds (e.g. labels 'T' / 'P' / 'B' over teal, hue 200° over\n * yellow-green, etc.). */\n text-shadow: 0 0 2px rgba(255, 255, 255, 0.7);\n}\n\n/* A slim slider's thumb is round and flush with the track, matching the\n property rows. The default thumb keeps its 2px spill and rounded-rect face. */\n.slim .thumb {\n top: 50%;\n bottom: auto;\n height: var(--rp-thumb-size);\n transform: translateY(-50%);\n border-radius: 50%;\n border: none;\n backdrop-filter: none;\n -webkit-backdrop-filter: none;\n box-shadow: none;\n background: color-mix(in srgb, var(--wzl-accent) var(--wzl-slider-thumb-mix), transparent);\n}\n\n.thumb:focus-visible {\n outline: 2px solid var(--wzl-accent);\n outline-offset: 1px;\n}\n\n.thumbActive {\n /* Visual marker for the dragging/focused thumb; subclass-overridable. */\n z-index: 1;\n}\n\n/* The row holds absolutely-positioned labels, so it has to state its own\n height: the text's, not the thumb's. It said 14px — the default thumb's\n size — which left 4px of dead space under the labels at either density. */\n.readoutsBelow {\n position: relative;\n margin-inline: var(--rp-thumb-inset);\n height: calc(var(--wzl-font-size-xs) * var(--wzl-leading-tight));\n margin-top: var(--wzl-space-2);\n}\n\n.readoutBelow {\n composes: numeric from '@weasel-js/theme/numeric.module.css';\n position: absolute;\n transform: translateX(-50%);\n font-weight: var(--wzl-font-weight-medium);\n font-size: var(--wzl-font-size-xs);\n line-height: var(--wzl-leading-tight);\n color: var(--wzl-fg-muted);\n white-space: nowrap;\n}\n\n.readoutInline {\n composes: numeric from '@weasel-js/theme/numeric.module.css';\n display: inline-block;\n margin-left: var(--wzl-space-4);\n font-weight: var(--wzl-font-weight-medium);\n font-size: var(--wzl-font-size-sm);\n line-height: var(--wzl-leading-tight);\n color: var(--wzl-fg-muted);\n vertical-align: middle;\n}\n\n.notched {\n background: var(--thumb-svg, none);\n background-size: 100% 100%;\n background-repeat: no-repeat;\n background-color: transparent;\n border: none;\n /* Notched thumbs need to disable the .thumb defaults that paint to\n * the bounding box: backdrop-filter and box-shadow both ignore the\n * SVG's polygon/notch and would render through the notch cutout.\n * Use filter: drop-shadow instead — it traces the actual rendered\n * alpha (i.e. the polygon shape including the cut). */\n backdrop-filter: none;\n -webkit-backdrop-filter: none;\n box-shadow: none;\n filter: drop-shadow(0 1px 1px rgba(0, 0, 0, 0.25));\n /* Default notched SVG (down-pointing pentagon, matches the perceptual-color experiment). */\n --thumb-svg: url(\"data:image/svg+xml;utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 14 30' preserveAspectRatio='none'%3E%3Cpolygon points='0,0 2.52,0 7,10.3 11.48,0 14,0 14,30 0,30' fill='rgba(255,255,255,0.62)' stroke='rgba(0,0,0,0.55)' stroke-width='0.75' stroke-linejoin='miter'/%3E%3C/svg%3E\");\n}\n\n.ticks {\n position: absolute;\n inset: 0;\n /* A mark must never eat the track click that adds a thumb, nor the\n * pointerdown that starts a drag through it. */\n pointer-events: none;\n}\n\n.tick {\n position: absolute;\n top: var(--rp-tick-inset, 20%);\n bottom: var(--rp-tick-inset, 20%);\n width: var(--rp-tick-width, 1px);\n margin-left: calc(var(--rp-tick-width, 1px) / -2);\n border-radius: var(--wzl-radius-pill);\n background: var(--rp-tick-color, var(--wzl-border-strong));\n}\n\n/* The labels hang below the track out of flow, so the row reserves their\n * height and anything after it — the below-thumb readouts — clears them.\n * Padding, not margin: a margin would collapse into whatever follows. */\n.withStopLabels .row {\n padding-bottom: calc(var(--wzl-space-xs) + var(--wzl-font-size-xs) * var(--wzl-leading-tight));\n}\n\n.stopLabels {\n position: absolute;\n left: 0;\n right: 0;\n top: calc(100% + var(--wzl-space-xs));\n height: calc(var(--wzl-font-size-xs) * var(--wzl-leading-tight));\n pointer-events: none;\n}\n\n.stopLabel {\n composes: numeric from '@weasel-js/theme/numeric.module.css';\n position: absolute;\n transform: translateX(-50%);\n white-space: nowrap;\n font-size: var(--wzl-font-size-xs);\n line-height: var(--wzl-leading-tight);\n color: var(--wzl-fg-subtle);\n}\n\n/* The end labels are pinned inside the track rather than centered on it, so a\n * wide one can't spill past the control and misalign whatever sits beside it. */\n.stopLabel[data-edge=\"start\"] {\n transform: none;\n}\n\n.stopLabel[data-edge=\"end\"] {\n transform: translateX(-100%);\n}\n\n.stopLabel[data-selected] {\n color: var(--wzl-fg);\n font-weight: var(--wzl-font-weight-medium);\n}\n","import { useCallback, useEffect, useMemo, useRef, type CSSProperties, type KeyboardEvent as ReactKeyboardEvent, type MouseEvent as ReactMouseEvent, type PointerEvent as ReactPointerEvent, type ReactElement, type ReactNode } from 'react';\nimport { openPointerSession, type PointerSession } from '@weasel-js/core';\nimport s from './Slider.module.css';\nimport { decimal, qty, type Display } from '@weasel-js/quantity';\n\n/**\n * Passed to a custom thumb renderer: the thumb box in CSS px, and whether\n * this thumb is the one being dragged.\n */\nexport type ThumbRenderCtx = {\n width: number;\n height: number;\n isActive: boolean;\n};\n\n/**\n * A thumb's appearance — one of the two built-in shapes, or a custom\n * renderer.\n */\nexport type ThumbShape =\n | 'round'\n | 'notched'\n | { render: (ctx: ThumbRenderCtx) => ReactNode };\n\n/**\n * One handle on a {@link Slider}. `bounds` narrows the range this particular\n * thumb may move within, either fixed or computed from the current thumb\n * list.\n */\nexport type Thumb = {\n value: number;\n label?: string;\n shape?: ThumbShape;\n bounds?: [number, number] | ((ctx: BoundsCtx) => [number, number]);\n /**\n * Spoken form of `value`, published as `aria-valuetext`. Required by ARIA\n * whenever `value` is not the quantity the user is choosing — an index into\n * a value list, a log-scaled position — since `aria-valuenow` alone then\n * announces a number that means nothing.\n */\n valueText?: string;\n};\n\n/**\n * Passed to a thumb's `bounds` function: the full thumb list and this thumb's\n * index in it, so a bound can be expressed relative to its neighbors.\n */\nexport type BoundsCtx = {\n thumbs: readonly Thumb[];\n index: number;\n};\n\n/**\n * Passed to `renderTrack`: the track's width in CSS px, a mapping from a\n * slider value to its 0..1 position along the value span, and the CSS\n * position (a `calc()` against the painted box's width) of a 0..1 fraction of\n * that span. A painter places everything that must line up with the thumbs\n * through `fractionToPosition`: under `thumbFit: 'inside'` the span stops half\n * a thumb short of each end of the track.\n */\nexport type TrackCtx = {\n trackWidth: number;\n valueToFraction: (v: number) => number;\n fractionToPosition: (f: number) => string;\n};\n\n/** A {@link Slider} stop that carries a label, drawn under the track at the stop. */\nexport type SliderStop = {\n value: number;\n label?: ReactNode;\n};\n\n/**\n * Props for {@link Slider}.\n *\n * `onInput` fires continuously through a drag; `onChange` fires once when it\n * ends and is the one to write to history.\n *\n * `stops` are attractors: a drag that passes within a few pixels of one lands\n * on it, and the arrow keys move stop to stop. `step` still quantizes the\n * values between them. Each one is drawn on the track as a mark; pass\n * `showStops: false` for a track whose own paint already reads as the stops.\n * A stop given as a {@link SliderStop} with a `label` gets that label drawn\n * under it; `stopLabels` narrows the row to the two ends or turns it off.\n *\n * `snap: 'strict'` makes every stop a detent the thumb must rest on: drags and\n * track presses land on the nearest one, and `step` no longer applies.\n * `spacing: 'even'` places the stops at equal intervals, runs the track from\n * the first stop to the last, and maps values linearly within each gap — so a\n * geometric list (0.25/0.5/1/2/4) gets usable room for every stop instead of\n * four crowded into the first fifth. Both need stops; with fewer than two,\n * `'even'` falls back to linear.\n *\n * `trackClick: 'move-nearest'` makes a press on bare track send the closest\n * thumb there, focus it, and continue as a drag. It is the default for a\n * single thumb. With several it defaults to `'none'`, because on a\n * multi-thumb editor a stray click would yank a stop the user was not aiming\n * at; `onAddThumb`, where it is set, keeps the track press.\n *\n * `constraint: 'ordered'` keeps thumbs from crossing each other. Supplying\n * `onAddThumb` makes a click on empty track create a thumb, and supplying\n * `onRemoveThumb` lets a right-click or a drag off the track remove one —\n * both callbacks can decline by returning `null`/`false`. `allowShiftAll`\n * makes shift-drag translate every thumb together.\n *\n * `thumbFit: 'inside'`, the default, runs the value span half a thumb short of\n * each end of the track, so a thumb at `min` or `max` sits flush with the\n * track's edge instead of hanging half over it — the layout a native range\n * input has. `'overhang'` runs the span edge to edge and centers an end thumb\n * on the edge.\n */\nexport type SliderProps<T extends Thumb = Thumb> = {\n thumbs: readonly T[];\n onInput: (next: T[]) => void;\n onChange?: (next: T[]) => void;\n min: number;\n max: number;\n step?: number;\n stops?: readonly (number | SliderStop)[];\n showStops?: boolean;\n stopLabels?: 'all' | 'ends' | 'none';\n snap?: 'magnetic' | 'strict';\n spacing?: 'linear' | 'even';\n trackClick?: 'none' | 'move-nearest';\n constraint?: 'free' | 'ordered';\n onAddThumb?: (atValue: number) => T | null;\n onRemoveThumb?: (index: number) => boolean;\n allowShiftAll?: boolean;\n renderTrack?: (ctx: TrackCtx) => ReactNode;\n thumbFit?: 'inside' | 'overhang';\n trackHeight?: number;\n /** `'slim'` drives the track and thumb from the kit's slider tokens, so a\n * Slider matches the property rows. `trackHeight` still wins if given. */\n density?: 'default' | 'slim';\n renderReadout?: (thumb: T, index: number) => ReactNode;\n /** How a thumb's value shows in the default readout and is spoken as its\n * `aria-valuetext` when the thumb gives no `valueText` of its own. Default:\n * three decimals shown, nothing spoken beyond `aria-valuenow`. */\n display?: Display;\n readoutPlacement?: 'none' | 'inline-after' | 'below-thumb';\n ariaLabel?: string;\n className?: string;\n};\n\nfunction quantize(v: number, step: number | undefined, min: number): number {\n if (step === undefined || step <= 0) return v;\n return Math.round((v - min) / step) * step + min;\n}\n\nfunction clamp(v: number, lo: number, hi: number): number {\n return Math.max(lo, Math.min(hi, v));\n}\n\n/** How close a drag has to come to a stop, in track pixels, to land on it. */\nconst STOP_SNAP_PX = 8;\n\n/** A custom `ThumbShape.render` may put interactive content inside the thumb,\n * and capture would retarget pointerup and kill the click on it. */\nconst NO_CAPTURE = { capture: false } as const;\n\n/** The stops that are actually reachable: inside the range, deduped, ascending.\n * A duplicate keeps the first label given for its value. */\nfunction usableStops(stops: SliderProps['stops'], min: number, max: number): SliderStop[] {\n if (!stops || stops.length === 0) return [];\n const byValue = new Map<number, SliderStop>();\n for (const stop of stops) {\n const s = typeof stop === 'number' ? { value: stop } : stop;\n if (s.value < min || s.value > max) continue;\n const seen = byValue.get(s.value);\n if (!seen || (seen.label === undefined && s.label !== undefined)) byValue.set(s.value, s);\n }\n return [...byValue.values()].sort((a, b) => a.value - b.value);\n}\n\n/** The stop nearest `v` along the track, or `v` itself when none lies within\n * `tolerance` (a track fraction). Measured on the track rather than in value\n * units so evenly spaced stops attract over the same distance. */\nfunction attract(v: number, stops: number[], tolerance: number, toFraction: (v: number) => number): number {\n const f = toFraction(v);\n let best = v;\n let bestGap = tolerance;\n for (const stop of stops) {\n const gap = Math.abs(toFraction(stop) - f);\n if (gap <= bestGap) {\n best = stop;\n bestGap = gap;\n }\n }\n return best;\n}\n\n/** The stop `count` places past `v` in `direction`, saturating at either end. */\nfunction stepStops(stops: number[], v: number, direction: 1 | -1, count: number): number {\n if (direction > 0) {\n const first = stops.findIndex(stop => stop > v);\n if (first === -1) return stops[stops.length - 1];\n return stops[Math.min(stops.length - 1, first + count - 1)];\n }\n let first = -1;\n for (let i = stops.length - 1; i >= 0; i--) {\n if (stops[i] < v) {\n first = i;\n break;\n }\n }\n if (first === -1) return stops[0];\n return stops[Math.max(0, first - (count - 1))];\n}\n\nfunction defaultStep(step: number | undefined, min: number, max: number): number {\n if (step !== undefined && step > 0) return step;\n return (max - min) / 100;\n}\n\n/** Keep a thumb inside its neighbors when `constraint` is `'ordered'`. */\nfunction clampOrdered(\n v: number,\n thumbs: readonly Thumb[],\n index: number,\n min: number,\n max: number,\n step: number | undefined,\n): number {\n const gap = step !== undefined && step > 0 ? step : (max - min) / 1000;\n const lower = index > 0 ? thumbs[index - 1].value + gap : min;\n const upper = index < thumbs.length - 1 ? thumbs[index + 1].value - gap : max;\n return clamp(v, lower, upper);\n}\n\nfunction resolveBounds(thumb: Thumb, ctx: BoundsCtx, fallbackMin: number, fallbackMax: number): [number, number] {\n if (!thumb.bounds) return [fallbackMin, fallbackMax];\n const tuple = typeof thumb.bounds === 'function' ? thumb.bounds(ctx) : thumb.bounds;\n return [tuple[0], tuple[1]];\n}\n\n/** Where fraction `f` of the value span falls in a box as wide as the track.\n * The rail element is laid out from the same `--rp-thumb-inset`. */\nfunction fractionToPosition(f: number): string {\n return `calc(var(--rp-thumb-inset) + ${f} * (100% - 2 * var(--rp-thumb-inset)))`;\n}\n\nconst READOUT = decimal({ places: 3 });\n\n/**\n * Multi-thumb slider over a shared track. The thumb list is fully controlled:\n * every change, live or committed, arrives as a whole new array.\n *\n * Thumbs are draggable, and arrow/Home/End move the focused thumb — those\n * keystrokes fire `onInput` and `onChange` together, since there is no\n * in-flight state to buffer.\n */\nexport function Slider<T extends Thumb = Thumb>(props: SliderProps<T>): ReactElement {\n const { thumbs, onInput, onChange, step, constraint, trackHeight, density, ariaLabel, className } = props;\n\n const stopList = useMemo(() => usableStops(props.stops, props.min, props.max), [props.stops, props.min, props.max]);\n const stops = useMemo(() => stopList.map(stop => stop.value), [stopList]);\n const even = props.spacing === 'even' && stops.length >= 2;\n const strict = props.snap === 'strict' && stops.length > 0;\n const min = even ? stops[0] : props.min;\n const max = even ? stops[stops.length - 1] : props.max;\n\n const trackRef = useRef<HTMLDivElement | null>(null);\n // The value span. Every pointer is measured against it, and thumbs, ticks\n // and stop labels are laid out inside it, so they agree by construction.\n const railRef = useRef<HTMLDivElement | null>(null);\n // In-flight thumb buffer during a drag; null when not dragging.\n const dragBufferRef = useRef<T[] | null>(null);\n const sessionRef = useRef<PointerSession | null>(null);\n\n useEffect(() => () => { sessionRef.current?.cancel(); }, []);\n\n const valueToFraction = useCallback(\n (v: number): number => {\n if (max === min) return 0;\n if (!even) return clamp((v - min) / (max - min), 0, 1);\n const gaps = stops.length - 1;\n const x = clamp(v, min, max);\n let i = 0;\n while (i < gaps - 1 && x > stops[i + 1]) i++;\n return (i + (x - stops[i]) / (stops[i + 1] - stops[i])) / gaps;\n },\n [min, max, even, stops],\n );\n\n const fractionToValue = useCallback(\n (f: number): number => {\n const c = clamp(f, 0, 1);\n if (!even) return min + c * (max - min);\n const gaps = stops.length - 1;\n const i = Math.min(gaps - 1, Math.floor(c * gaps));\n return stops[i] + (c * gaps - i) * (stops[i + 1] - stops[i]);\n },\n [min, max, even, stops],\n );\n\n /** The value a pointer at track fraction `f` chooses, before bounds. */\n const valueAt = useCallback(\n (f: number, trackWidth: number): number => {\n const v = fractionToValue(f);\n if (strict) return attract(v, stops, Infinity, valueToFraction);\n const q = clamp(quantize(v, step, min), min, max);\n return stops.length > 0 ? attract(q, stops, STOP_SNAP_PX / trackWidth, valueToFraction) : q;\n },\n [fractionToValue, valueToFraction, strict, stops, step, min, max],\n );\n\n // `seed` replaces the thumb list the drag starts from. A track press moves a\n // thumb before the drag begins, and without seeding, a release with no\n // movement would commit the stale buffer and undo that move.\n const beginThumbDrag = useCallback(\n (origin: Element, down: ReactPointerEvent, index: number, seed?: readonly T[]) => {\n sessionRef.current?.cancel();\n const buf: T[] = (seed ?? thumbs).map(t => ({ ...t }));\n dragBufferRef.current = buf;\n let droppedOff = false;\n\n const onMove = (ev: PointerEvent) => {\n const rail = railRef.current;\n const buffer = dragBufferRef.current;\n if (!rail || !buffer) return;\n const rect = rail.getBoundingClientRect();\n let v = valueAt((ev.clientX - rect.left) / rect.width, rect.width);\n\n const [bLo, bHi] = resolveBounds(buffer[index], { thumbs: buffer, index }, min, max);\n v = clamp(v, bLo, bHi);\n\n if (constraint === 'ordered') v = clampOrdered(v, buffer, index, min, max, step);\n\n // Drop-off detection: pointer exits the track vertically by more than trackHeight.\n const bandHeight = rect.height;\n if (props.onRemoveThumb) {\n if (ev.clientY < rect.top - bandHeight || ev.clientY > rect.bottom + bandHeight) {\n droppedOff = true;\n } else {\n droppedOff = false;\n }\n }\n\n buffer[index] = { ...buffer[index], value: v };\n onInput(buffer.map(t => ({ ...t })));\n };\n\n // A drag that ends without a release — cancelled pointer, lost capture,\n // an unmount — drops the buffer without committing.\n const onCancel = () => {\n sessionRef.current = null;\n dragBufferRef.current = null;\n };\n\n const onEnd = () => {\n sessionRef.current = null;\n const buffer = dragBufferRef.current;\n dragBufferRef.current = null;\n if (!buffer) return;\n\n if (droppedOff && props.onRemoveThumb) {\n const accepted = props.onRemoveThumb(index);\n if (accepted) {\n const next = buffer.filter((_, i) => i !== index).map(t => ({ ...t })) as T[];\n onInput(next);\n onChange?.(next);\n return;\n }\n }\n\n onChange?.(buffer.map(t => ({ ...t })));\n };\n\n sessionRef.current = openPointerSession(origin, down, { onMove, onEnd, onCancel }, NO_CAPTURE);\n },\n [thumbs, onInput, onChange, valueAt, min, max, step, constraint, props],\n );\n\n const beginShiftAllDrag = useCallback(\n (origin: Element, down: ReactPointerEvent, anchorX: number) => {\n sessionRef.current?.cancel();\n const buf: T[] = thumbs.map(t => ({ ...t }));\n const startValues = buf.map(t => t.value);\n dragBufferRef.current = buf;\n\n const onMove = (ev: PointerEvent) => {\n const rail = railRef.current;\n const buffer = dragBufferRef.current;\n if (!rail || !buffer) return;\n const rect = rail.getBoundingClientRect();\n const dxFraction = (ev.clientX - anchorX) / rect.width;\n // Evenly spaced gaps span different amounts of value, so equal value\n // offsets would pull the thumbs apart; move them by track distance.\n if (even) {\n const starts = startValues.map(valueToFraction);\n const df = clamp(dxFraction, -Math.min(...starts), 1 - Math.max(...starts));\n for (let i = 0; i < buffer.length; i++) {\n buffer[i] = { ...buffer[i], value: fractionToValue(starts[i] + df) };\n }\n onInput(buffer.map(t => ({ ...t })));\n return;\n }\n let dValue = dxFraction * (max - min);\n dValue = quantize(dValue, step, 0);\n\n // Clamp delta so no thumb leaves [min, max] (per-thumb bounds intentionally\n // not enforced — matches the experiment's hue-band shift-translate semantics).\n let allowedNeg = -Infinity;\n let allowedPos = Infinity;\n for (let i = 0; i < startValues.length; i++) {\n allowedNeg = Math.max(allowedNeg, min - startValues[i]);\n allowedPos = Math.min(allowedPos, max - startValues[i]);\n }\n dValue = clamp(dValue, allowedNeg, allowedPos);\n\n for (let i = 0; i < buffer.length; i++) {\n buffer[i] = { ...buffer[i], value: clamp(startValues[i] + dValue, min, max) };\n }\n onInput(buffer.map(t => ({ ...t })));\n };\n\n const onCancel = () => {\n sessionRef.current = null;\n dragBufferRef.current = null;\n };\n\n const onEnd = () => {\n sessionRef.current = null;\n const buffer = dragBufferRef.current;\n dragBufferRef.current = null;\n if (buffer) onChange?.(buffer.map(t => ({ ...t })));\n };\n\n sessionRef.current = openPointerSession(origin, down, { onMove, onEnd, onCancel }, NO_CAPTURE);\n },\n [thumbs, onInput, onChange, min, max, step, even, valueToFraction, fractionToValue],\n );\n\n const onThumbPointerDown = (index: number) => (e: ReactPointerEvent) => {\n // Only bail on explicit non-primary buttons (button > 0). jsdom's PointerEvent\n // leaves `button` undefined; treat that as primary so tests can drive drags.\n if (typeof e.button === 'number' && e.button > 0) return;\n // preventDefault below suppresses the focus the press would otherwise\n // give the thumb, and the arrow keys are on the thumb.\n (e.currentTarget as HTMLElement).focus?.();\n e.preventDefault();\n e.stopPropagation();\n const origin = e.currentTarget as HTMLElement;\n if (e.shiftKey && props.allowShiftAll) {\n beginShiftAllDrag(origin, e, e.clientX);\n } else {\n beginThumbDrag(origin, e, index);\n }\n };\n\n const onThumbContextMenu = (index: number) => (e: ReactMouseEvent) => {\n if (!props.onRemoveThumb) return;\n e.preventDefault();\n const accepted = props.onRemoveThumb(index);\n if (!accepted) return;\n const next = thumbs.filter((_, i) => i !== index).map(t => ({ ...t })) as T[];\n onInput(next);\n onChange?.(next);\n };\n\n const onTrackPointerDown = (e: ReactPointerEvent<HTMLDivElement>) => {\n if (typeof e.button === 'number' && e.button > 0) return;\n const trackClick = props.trackClick ?? (thumbs.length === 1 ? 'move-nearest' : 'none');\n const wantsMove = trackClick === 'move-nearest' && thumbs.length > 0;\n if (!props.onAddThumb && !wantsMove) return;\n // If the event originated on a thumb, the thumb's own handler ran first; this is a track click.\n if ((e.target as HTMLElement).closest(`.${s.thumb}`)) return;\n e.preventDefault();\n const track = trackRef.current;\n const rail = railRef.current;\n if (!track || !rail) return;\n const rect = rail.getBoundingClientRect();\n const v = valueAt((e.clientX - rect.left) / rect.width, rect.width);\n\n if (props.onAddThumb) {\n const created = props.onAddThumb(v);\n if (!created) return;\n const next = [...thumbs.map(t => ({ ...t })), created] as T[];\n onInput(next);\n onChange?.(next);\n return;\n }\n\n let index = 0;\n for (let i = 1; i < thumbs.length; i++) {\n if (Math.abs(thumbs[i].value - v) < Math.abs(thumbs[index].value - v)) index = i;\n }\n const next = thumbs.map(t => ({ ...t })) as T[];\n const [bLo, bHi] = resolveBounds(next[index], { thumbs: next, index }, min, max);\n let moved = clamp(v, bLo, bHi);\n if (constraint === 'ordered') moved = clampOrdered(moved, next, index, min, max, step);\n next[index] = { ...next[index], value: moved };\n onInput(next);\n // preventDefault above suppresses the focus the press would give; the arrow keys are on the thumb.\n track.querySelectorAll<HTMLElement>(`.${s.thumb}`)[index]?.focus();\n beginThumbDrag(track, e, index, next);\n };\n\n const onThumbKeyDown = (index: number) => (e: ReactKeyboardEvent) => {\n const stepSize = defaultStep(step, min, max);\n let delta = 0;\n // With stops, a keystroke moves by whole stops rather than by value.\n let stopDelta = 0;\n let snapTo: 'home' | 'end' | null = null;\n\n switch (e.key) {\n case 'ArrowRight':\n case 'ArrowUp':\n delta = e.shiftKey ? stepSize * 10 : stepSize;\n stopDelta = e.shiftKey ? 10 : 1;\n break;\n case 'ArrowLeft':\n case 'ArrowDown':\n delta = e.shiftKey ? -stepSize * 10 : -stepSize;\n stopDelta = e.shiftKey ? -10 : -1;\n break;\n case 'PageUp':\n delta = stepSize * 10;\n stopDelta = 10;\n break;\n case 'PageDown':\n delta = -stepSize * 10;\n stopDelta = -10;\n break;\n case 'Home':\n snapTo = 'home';\n break;\n case 'End':\n snapTo = 'end';\n break;\n default:\n return;\n }\n\n e.preventDefault();\n const next = thumbs.map(t => ({ ...t }));\n const [bLo, bHi] = resolveBounds(next[index], { thumbs: next, index }, min, max);\n const lo = Math.max(min, bLo);\n const hi = Math.min(max, bHi);\n let v: number;\n if (snapTo === 'home') v = lo;\n else if (snapTo === 'end') v = hi;\n else if (stops.length > 0) {\n v = stepStops(stops, next[index].value, stopDelta > 0 ? 1 : -1, Math.abs(stopDelta));\n } else {\n v = quantize(next[index].value + delta, step, min);\n }\n v = clamp(v, lo, hi);\n if (constraint === 'ordered') v = clampOrdered(v, next, index, lo, hi, step);\n next[index] = { ...next[index], value: v };\n onInput(next);\n onChange?.(next);\n };\n\n const placement = props.readoutPlacement ?? 'none';\n const renderReadout = props.renderReadout;\n const display = props.display;\n\n const slim = density === 'slim';\n const rootVars: Record<string, string> = {};\n if (slim) {\n rootVars['--rp-track-height'] = 'var(--wzl-slider-track-h)';\n rootVars['--rp-thumb-size'] = 'var(--wzl-slider-thumb-size)';\n }\n // An explicit trackHeight wins: a caller who named a number meant it.\n if (trackHeight !== undefined) rootVars['--rp-track-height'] = `${trackHeight}px`;\n\n const labelMode = props.stopLabels ?? 'all';\n const lastStop = stopList.length - 1;\n const labeledStops = labelMode === 'none'\n ? []\n : stopList\n .map((stop, i) => ({ stop, i }))\n .filter(({ stop, i }) => stop.label !== undefined && (labelMode === 'all' || i === 0 || i === lastStop));\n // Inside the track so it shares the track's width, not the row's — an inline\n // readout beside the track would otherwise shift every label off its stop.\n const stopLabelRow = labeledStops.length > 0 && (\n <div className={s.stopLabels} data-slider-stop-labels aria-hidden=\"true\">\n {labeledStops.map(({ stop, i }) => (\n <span\n key={stop.value}\n className={s.stopLabel}\n data-slider-stop-label\n data-selected={thumbs.some(t => t.value === stop.value) ? 'true' : undefined}\n data-edge={i === 0 ? 'start' : i === lastStop ? 'end' : undefined}\n style={{ left: `${valueToFraction(stop.value) * 100}%` }}\n >\n {stop.label}\n </span>\n ))}\n </div>\n );\n const rootClass = [s.root, slim && s.slim, props.thumbFit === 'overhang' && s.overhang, stopLabelRow && s.withStopLabels, className].filter(Boolean).join(' ');\n\n return (\n <div\n className={rootClass}\n style={Object.keys(rootVars).length > 0 ? (rootVars as CSSProperties) : undefined}\n >\n <div className={s.row}>\n <div className={s.track} ref={trackRef} onPointerDown={onTrackPointerDown}>\n {props.renderTrack && (\n <div className={s.trackInner}>\n {props.renderTrack({\n trackWidth: trackRef.current?.getBoundingClientRect().width ?? 0,\n valueToFraction,\n fractionToPosition,\n })}\n </div>\n )}\n <div className={s.rail} ref={railRef} data-slider-rail>\n {(props.showStops ?? true) && stops.length > 0 && (\n <div className={s.ticks} data-slider-ticks aria-hidden=\"true\">\n {stops.map(v => {\n const f = valueToFraction(v);\n return (\n <span\n key={v}\n className={s.tick}\n data-slider-tick\n data-fraction={String(f)}\n style={{ left: `${f * 100}%` }}\n />\n );\n })}\n </div>\n )}\n {stopLabelRow}\n {thumbs.map((thumb, i) => {\n const isNotched = thumb.shape === 'notched';\n const customRender = typeof thumb.shape === 'object' && thumb.shape !== null ? thumb.shape.render : null;\n const cls = `${s.thumb}${isNotched ? ` ${s.notched}` : ''}`;\n return (\n <div\n key={i}\n role=\"slider\"\n tabIndex={0}\n aria-orientation=\"horizontal\"\n aria-valuemin={min}\n aria-valuemax={max}\n aria-valuenow={thumb.value}\n aria-valuetext={thumb.valueText ?? (display ? qty(thumb.value, display).spoken : undefined)}\n aria-label={[ariaLabel, thumb.label].filter(Boolean).join(' ') || undefined}\n className={cls}\n style={{ left: `${valueToFraction(thumb.value) * 100}%` }}\n onPointerDown={onThumbPointerDown(i)}\n onKeyDown={onThumbKeyDown(i)}\n onContextMenu={onThumbContextMenu(i)}\n >\n {customRender ? customRender({ width: 14, height: 24, isActive: false }) : (thumb.label ?? '')}\n </div>\n );\n })}\n </div>\n </div>\n {placement === 'inline-after' && (\n <span data-readout=\"inline\" className={s.readoutInline}>\n {thumbs.map((t, i) => (\n <span key={i}>{i > 0 ? ' / ' : ''}{renderReadout ? renderReadout(t, i) : qty(t.value, display ?? READOUT).text}</span>\n ))}\n </span>\n )}\n </div>\n {placement === 'below-thumb' && (\n <div className={s.readoutsBelow}>\n {thumbs.map((t, i) => (\n <span\n key={i}\n data-readout=\"below\"\n className={s.readoutBelow}\n style={{ left: `${valueToFraction(t.value) * 100}%` }}\n >\n {renderReadout ? renderReadout(t, i) : qty(t.value, display ?? READOUT).text}\n </span>\n ))}\n </div>\n )}\n </div>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;ACgJA,SAASE,EAAS,GAAW,GAA0B,GAAqB;CAE1E,OADIC,MAAS,KAAA,KAAaA,KAAQ,IAAUC,IACrC,KAAK,OAAOA,IAAIC,KAAOF,CAAI,IAAIA,IAAOE;AAC/C;AAEA,SAASC,EAAM,GAAW,GAAY,GAAoB;CACxD,OAAO,KAAK,IAAIC,GAAI,KAAK,IAAIC,GAAIJ,CAAC,CAAC;AACrC;AAGA,IAAMK,IAAe,GAIfC,IAAa,EAAE,SAAS,GAAM;AAIpC,SAASC,EAAY,GAA6B,GAAa,GAA2B;CACxF,IAAI,CAACC,KAASA,EAAM,WAAW,GAAG,OAAO,CAAC;CAC1C,IAAMC,oBAAU,IAAI,IAAw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O,CAAC,CAAC,IAAW,EAAA,GAA1GZ,CAA0G,CACtH;GACG,CAAA,CAEH;EACJ,CAAA,GAAA2E,MAAc,iBACb,kBAAC,OAAD;GAAK,WAAW1G,EAAE;GACf,UAAAmC,EAAO,KAAK,GAAG,MACd,kBAAC,QAAD;IAEE,gBAAa;IACb,WAAWnC,EAAE;IACb,OAAO,EAAE,MAAM,GAAGwD,EAAgBY,EAAE,KAAK,IAAI,IAAI,GAAG;IAEnD,UAAAuC,IAAgBA,EAAcvC,GAAGrC,CAAC,IAAI2F,EAAItD,EAAE,OAAOwC,KAAWjE,CAAO,CAAC,CAAC;GACpE,GANCZ,CAMD,CACP;EACE,CAAA,CAEJ;;AAET"}
@@ -1,10 +1,10 @@
1
1
  import { jsx as e } from "react/jsx-runtime";
2
2
  var t = {
3
- bar: "_bar_k5dxw_1",
4
- item: "_item_k5dxw_14",
5
- muted: "_muted_k5dxw_18",
6
- hasTitle: "_hasTitle_k5dxw_23",
7
- spacer: "_spacer_k5dxw_27"
3
+ bar: "_bar_6xkzu_1 _numeric_zns9n_4",
4
+ item: "_item_6xkzu_14",
5
+ muted: "_muted_6xkzu_18",
6
+ hasTitle: "_hasTitle_6xkzu_22",
7
+ spacer: "_spacer_6xkzu_26"
8
8
  };
9
9
  //#endregion
10
10
  //#region src/components/StatusBar/StatusBar.tsx
@@ -38,4 +38,4 @@ function i() {
38
38
  //#endregion
39
39
  export { r as n, i as r, n as t };
40
40
 
41
- //# sourceMappingURL=StatusBar-Ca9Dvhhq.js.map
41
+ //# sourceMappingURL=StatusBar-BEOfOX0D.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"StatusBar-BEOfOX0D.js","names":["s","StatusBar_module_default","StatusBar","props","className","ariaLabel","StatusBarItem","cls","muted","title","StatusBarSpacer"],"sources":["../../src/components/StatusBar/StatusBar.module.css","../../src/components/StatusBar/StatusBar.tsx"],"sourcesContent":[".bar {\n composes: numeric from '@weasel-js/theme/numeric.module.css';\n display: flex;\n align-items: center;\n gap: var(--wzl-space-8);\n flex-shrink: 0;\n padding: var(--wzl-space-2) var(--wzl-space-6);\n font-size: var(--wzl-font-size-sm);\n color: var(--wzl-fg-muted);\n background: var(--wzl-surface);\n border-top: 1px solid var(--wzl-border);\n}\n\n.item {\n white-space: nowrap;\n}\n\n.muted {\n opacity: 0.6;\n}\n\n.hasTitle {\n cursor: help;\n}\n\n.spacer {\n margin-left: auto;\n}\n","import type { ReactNode } from 'react';\nimport s from './StatusBar.module.css';\n\n/** Props for {@link StatusBar}. */\nexport interface StatusBarProps {\n /**\n * Accessible label for the bar. Deliberately not a live region — a status\n * bar's readouts change on every pointer move (zoom, cursor position,\n * selection count), and announcing each one would make a screen reader\n * unusable. Screen-reader users reach the same facts through the controls\n * that own them.\n */\n ariaLabel?: string;\n children?: ReactNode;\n className?: string;\n}\n\n/**\n * The thin readout strip along the bottom of an editor window: monospace,\n * one row, items separated by a fixed gap, with an optional spacer that\n * pushes everything after it to the trailing edge.\n *\n * Pure presentation — it holds whatever the app puts in it. Compose with\n * `<StatusBarItem>` and `<StatusBarSpacer>`.\n */\nexport function StatusBar(props: StatusBarProps) {\n const { ariaLabel, children, className } = props;\n return (\n <footer className={[s.bar, className].filter(Boolean).join(' ')} aria-label={ariaLabel}>\n {children}\n </footer>\n );\n}\n\n/** Props for {@link StatusBarItem}. */\nexport interface StatusBarItemProps {\n /**\n * Hover text. Items that carry one also get a `help` cursor, so the\n * affordance is discoverable rather than hidden behind a hover delay.\n */\n title?: string;\n /**\n * Dim the item. For reference material that\n * shouldn't compete with live readouts — build stamps, hints, units.\n */\n muted?: boolean;\n children?: ReactNode;\n className?: string;\n}\n\n/** One readout in a `<StatusBar>`. */\nexport function StatusBarItem(props: StatusBarItemProps) {\n const { title, muted, children, className } = props;\n const cls = [s.item, muted && s.muted, title !== undefined && s.hasTitle, className]\n .filter(Boolean).join(' ');\n return <span className={cls} title={title}>{children}</span>;\n}\n\n/**\n * Splits a status bar into leading and trailing runs — everything after the\n * spacer is pushed to the trailing edge. Decorative, so it's hidden from the\n * accessibility tree.\n */\nexport function StatusBarSpacer() {\n return <span className={s.spacer} aria-hidden=\"true\" />;\n}\n"],"mappings":";;;;;;;;;;ACyBA,SAAgBE,EAAU,GAAuB;CAC/C,IAAM,EAAE,cAAW,aAAU,iBAAcC;CAC3C,OACE,kBAAC,UAAD;EAAQ,WAAW,CAACH,EAAE,KAAKI,CAAS,CAAC,CAAC,OAAO,OAAO,CAAC,CAAC,KAAK,GAAG;EAAG,cAAYC;EAC1E;CACK,CAAA;AAEZ;AAmBA,SAAgBC,EAAc,GAA2B;CACvD,IAAM,EAAE,UAAO,UAAO,aAAU,iBAAcH,GACxCI,IAAM;EAACP,EAAE;EAAMQ,KAASR,EAAE;EAAOS,MAAU,KAAA,KAAaT,EAAE;EAAUI;CAAS,CAAC,CACjF,OAAO,OAAO,CAAC,CAAC,KAAK,GAAG;CAC3B,OAAO,kBAAC,QAAD;EAAM,WAAWG;EAAY;EAAQ;CAAe,CAAA;AAC7D;AAOA,SAAgBG,IAAkB;CAChC,OAAO,kBAAC,QAAD;EAAM,WAAWV,EAAE;EAAQ,eAAY;CAAQ,CAAA;AACxD"}
@@ -1,5 +1,5 @@
1
1
  import { n as e, o as t, r as n, t as r } from "./RecentColorsProvider-DHcfk25u.js";
2
- import { t as i } from "./Select-BppLsJTz.js";
2
+ import { t as i } from "./Select-ouV8O6cp.js";
3
3
  import { t as a } from "./SwatchGrid-9ZPiDmxd.js";
4
4
  import { getAlpha01 as o } from "@weasel-js/core";
5
5
  import { Fragment as s, jsx as c, jsxs as l } from "react/jsx-runtime";
@@ -574,4 +574,4 @@ function v(t) {
574
574
  //#endregion
575
575
  export { f as a, m as i, g as n, p as r, v as t };
576
576
 
577
- //# sourceMappingURL=SwatchStrip-Cw0l8Om7.js.map
577
+ //# sourceMappingURL=SwatchStrip-Bi9iPLoh.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"SwatchStrip-Cw0l8Om7.js","names":["_Fragment","s","useRecentColors","normalizeRecentColor","useRecentColorsStore","RecentColorsProvider","Select","SwatchGrid","STANDARD_PALETTE","BASIC_PALETTE","BUILTIN_PALETTES","SwatchStrip_module_default","describeColor","c","color","alpha","getAlpha01","same","a","b","SwatchStrip","props","palettes","columns","ctxStore","store","recent","recentHeading","useId","ownPalette","setOwnPalette","useState","paletteId","shown","p","choosePalette","id","recentOptions","currentIn","value","options","o","grids","Fragment","className"],"sources":["../../src/components/SwatchStrip/palettes.ts","../../src/components/SwatchStrip/SwatchStrip.module.css","../../src/components/SwatchStrip/SwatchStrip.tsx"],"sourcesContent":["import type { SwatchGridOption } from '../SwatchGrid';\n\n/** A named set of swatches offered by {@link SwatchStrip}. */\nexport interface SwatchPalette {\n /** Stable key, for the palette choice and for React. */\n id: string;\n /** What the palette picker shows. */\n name: string;\n /** `value: null` is the \"no paint\" swatch. Each `label` is the swatch's\n * accessible name, so it should say the color. */\n colors: readonly SwatchGridOption[];\n /** Swatches per row. Default: the strip's `columns`. */\n columns?: number;\n}\n\n/** No paint, the named primaries and secondaries, a gray ramp, and eight hue\n * ramps of ten shades each (50 → 900). */\nexport const STANDARD_PALETTE: SwatchPalette = {\n id: 'standard',\n name: 'Standard',\n columns: 10,\n colors: [\n { value: null, label: 'None' },\n { value: '#ffffffff', label: 'White' },\n { value: '#000000ff', label: 'Black' },\n { value: '#ff0000ff', label: 'Red' },\n { value: '#00ff00ff', label: 'Green' },\n { value: '#0000ffff', label: 'Blue' },\n { value: '#00ffffff', label: 'Cyan' },\n { value: '#ff00ffff', label: 'Magenta' },\n { value: '#ffff00ff', label: 'Yellow' },\n { value: '#ff8800ff', label: 'Orange' },\n { value: '#fafafaff', label: 'Gray 50' },\n { value: '#f5f5f5ff', label: 'Gray 100' },\n { value: '#e5e5e5ff', label: 'Gray 200' },\n { value: '#d4d4d4ff', label: 'Gray 300' },\n { value: '#a3a3a3ff', label: 'Gray 400' },\n { value: '#737373ff', label: 'Gray 500' },\n { value: '#525252ff', label: 'Gray 600' },\n { value: '#404040ff', label: 'Gray 700' },\n { value: '#262626ff', label: 'Gray 800' },\n { value: '#171717ff', label: 'Gray 900' },\n { value: '#fef2f2ff', label: 'Red 50' },\n { value: '#fee2e2ff', label: 'Red 100' },\n { value: '#fecacaff', label: 'Red 200' },\n { value: '#fca5a5ff', label: 'Red 300' },\n { value: '#f87171ff', label: 'Red 400' },\n { value: '#ef4444ff', label: 'Red 500' },\n { value: '#dc2626ff', label: 'Red 600' },\n { value: '#b91c1cff', label: 'Red 700' },\n { value: '#991b1bff', label: 'Red 800' },\n { value: '#7f1d1dff', label: 'Red 900' },\n { value: '#fff7edff', label: 'Orange 50' },\n { value: '#ffedd5ff', label: 'Orange 100' },\n { value: '#fed7aaff', label: 'Orange 200' },\n { value: '#fdba74ff', label: 'Orange 300' },\n { value: '#fb923cff', label: 'Orange 400' },\n { value: '#f97316ff', label: 'Orange 500' },\n { value: '#ea580cff', label: 'Orange 600' },\n { value: '#c2410cff', label: 'Orange 700' },\n { value: '#9a3412ff', label: 'Orange 800' },\n { value: '#7c2d12ff', label: 'Orange 900' },\n { value: '#fefce8ff', label: 'Yellow 50' },\n { value: '#fef9c3ff', label: 'Yellow 100' },\n { value: '#fef08aff', label: 'Yellow 200' },\n { value: '#fde047ff', label: 'Yellow 300' },\n { value: '#facc15ff', label: 'Yellow 400' },\n { value: '#eab308ff', label: 'Yellow 500' },\n { value: '#ca8a04ff', label: 'Yellow 600' },\n { value: '#a16207ff', label: 'Yellow 700' },\n { value: '#854d0eff', label: 'Yellow 800' },\n { value: '#713f12ff', label: 'Yellow 900' },\n { value: '#f0fdf4ff', label: 'Green 50' },\n { value: '#dcfce7ff', label: 'Green 100' },\n { value: '#bbf7d0ff', label: 'Green 200' },\n { value: '#86efacff', label: 'Green 300' },\n { value: '#4ade80ff', label: 'Green 400' },\n { value: '#22c55eff', label: 'Green 500' },\n { value: '#16a34aff', label: 'Green 600' },\n { value: '#15803dff', label: 'Green 700' },\n { value: '#166534ff', label: 'Green 800' },\n { value: '#14532dff', label: 'Green 900' },\n { value: '#ecfeffff', label: 'Cyan 50' },\n { value: '#cffafeff', label: 'Cyan 100' },\n { value: '#a5f3fcff', label: 'Cyan 200' },\n { value: '#67e8f9ff', label: 'Cyan 300' },\n { value: '#22d3eeff', label: 'Cyan 400' },\n { value: '#06b6d4ff', label: 'Cyan 500' },\n { value: '#0891b2ff', label: 'Cyan 600' },\n { value: '#0e7490ff', label: 'Cyan 700' },\n { value: '#155e75ff', label: 'Cyan 800' },\n { value: '#164e63ff', label: 'Cyan 900' },\n { value: '#eff6ffff', label: 'Blue 50' },\n { value: '#dbeafeff', label: 'Blue 100' },\n { value: '#bfdbfeff', label: 'Blue 200' },\n { value: '#93c5fdff', label: 'Blue 300' },\n { value: '#60a5faff', label: 'Blue 400' },\n { value: '#3b82f6ff', label: 'Blue 500' },\n { value: '#2563ebff', label: 'Blue 600' },\n { value: '#1d4ed8ff', label: 'Blue 700' },\n { value: '#1e40afff', label: 'Blue 800' },\n { value: '#1e3a8aff', label: 'Blue 900' },\n { value: '#faf5ffff', label: 'Purple 50' },\n { value: '#f3e8ffff', label: 'Purple 100' },\n { value: '#e9d5ffff', label: 'Purple 200' },\n { value: '#d8b4feff', label: 'Purple 300' },\n { value: '#c084fcff', label: 'Purple 400' },\n { value: '#a855f7ff', label: 'Purple 500' },\n { value: '#9333eaff', label: 'Purple 600' },\n { value: '#7e22ceff', label: 'Purple 700' },\n { value: '#6b21a8ff', label: 'Purple 800' },\n { value: '#581c87ff', label: 'Purple 900' },\n { value: '#fdf2f8ff', label: 'Pink 50' },\n { value: '#fce7f3ff', label: 'Pink 100' },\n { value: '#fbcfe8ff', label: 'Pink 200' },\n { value: '#f9a8d4ff', label: 'Pink 300' },\n { value: '#f472b6ff', label: 'Pink 400' },\n { value: '#ec4899ff', label: 'Pink 500' },\n { value: '#db2777ff', label: 'Pink 600' },\n { value: '#be185dff', label: 'Pink 700' },\n { value: '#9d174dff', label: 'Pink 800' },\n { value: '#831843ff', label: 'Pink 900' },\n ],\n};\n\n/** No paint and CSS's basic named colors, with pink and brown. */\nexport const BASIC_PALETTE: SwatchPalette = {\n id: 'basic',\n name: 'Basic',\n columns: 10,\n colors: [\n { value: null, label: 'None' },\n { value: '#000000ff', label: 'Black' },\n { value: '#ffffffff', label: 'White' },\n { value: '#808080ff', label: 'Gray' },\n { value: '#c0c0c0ff', label: 'Silver' },\n { value: '#800000ff', label: 'Maroon' },\n { value: '#ff0000ff', label: 'Red' },\n { value: '#ffa500ff', label: 'Orange' },\n { value: '#ffff00ff', label: 'Yellow' },\n { value: '#808000ff', label: 'Olive' },\n { value: '#00ff00ff', label: 'Lime' },\n { value: '#008000ff', label: 'Green' },\n { value: '#008080ff', label: 'Teal' },\n { value: '#00ffffff', label: 'Cyan' },\n { value: '#000080ff', label: 'Navy' },\n { value: '#0000ffff', label: 'Blue' },\n { value: '#800080ff', label: 'Purple' },\n { value: '#ff00ffff', label: 'Magenta' },\n { value: '#ffc0cbff', label: 'Pink' },\n { value: '#a52a2aff', label: 'Brown' },\n ],\n};\n\n/** What {@link SwatchStrip} offers when given no `palettes`. */\nexport const BUILTIN_PALETTES: readonly SwatchPalette[] = [STANDARD_PALETTE, BASIC_PALETTE];\n",".root {\n display: flex;\n flex-direction: column;\n gap: var(--wzl-space-3);\n min-inline-size: 0;\n}\n\n.section {\n display: flex;\n flex-direction: column;\n gap: var(--wzl-space-1);\n min-inline-size: 0;\n}\n\n.heading {\n font-family: var(--wzl-font-ui);\n font-size: var(--wzl-font-size-xs);\n font-weight: var(--wzl-font-weight-medium);\n text-transform: var(--wzl-params-label-case, uppercase);\n letter-spacing: var(--wzl-params-label-tracking, var(--wzl-tracking-wide));\n color: var(--wzl-fg-muted);\n}\n\n.empty {\n margin: 0;\n font-family: var(--wzl-font-ui);\n font-size: var(--wzl-font-size-sm);\n color: var(--wzl-fg-muted);\n}\n","import { useId, useState, type ReactElement } from 'react';\nimport { getAlpha01 } from '@weasel-js/core';\nimport { SwatchGrid, type SwatchGridOption } from '../SwatchGrid';\nimport { Select } from '../Select';\nimport {\n RecentColorsProvider,\n normalizeRecentColor,\n useRecentColors,\n useRecentColorsStore,\n type RecentColorsStore,\n} from '../RecentColors';\nimport { BUILTIN_PALETTES, type SwatchPalette } from './palettes';\nimport s from './SwatchStrip.module.css';\n\n/** Props for {@link SwatchStrip}. */\nexport interface SwatchStripProps {\n /** The color to mark current, in either row. `null` marks \"no paint\". */\n value?: string | null;\n /** A swatch applied: click, Enter or Space. */\n onChange: (value: string | null) => void;\n /** The alternate target, as on {@link SwatchGrid}: shift-click,\n * right-click, Shift+Enter. */\n onAltChange?: (value: string | null) => void;\n /** The preset palettes on offer. Default {@link BUILTIN_PALETTES}. More\n * than one adds a picker. */\n palettes?: readonly SwatchPalette[];\n /** The shown palette's id, controlled. */\n palette?: string;\n /** The shown palette's id to start on, uncontrolled. Default: the first. */\n defaultPalette?: string;\n onPaletteChange?: (id: string) => void;\n /** Where the recent row reads from and applies record into. Default: the\n * nearest {@link RecentColorsProvider}'s. With neither there is no recent\n * row. */\n store?: RecentColorsStore;\n /** Swatches per row, for the recent row and any palette that sets none.\n * Default 10. */\n columns?: number;\n 'aria-label'?: string;\n className?: string;\n}\n\n/** A color as a screen reader should hear it: the hex, and the opacity\n * when it is not opaque. Any other CSS color reads as written. */\nexport function describeColor(color: string): string {\n const c = normalizeRecentColor(color) ?? color;\n if (!c.startsWith('#') || c.length !== 9) return c;\n const alpha = Math.round(getAlpha01(c) * 100);\n return alpha === 100 ? c.slice(0, 7) : `${c.slice(0, 7)}, ${alpha}% opacity`;\n}\n\nfunction same(a: string | null, b: string | null): boolean {\n if (a === null || b === null) return a === b;\n return normalizeRecentColor(a) === normalizeRecentColor(b);\n}\n\n/**\n * The swatches a color picker sits beside: the recently used colors, most\n * recent first, above a preset palette. Applying any swatch records it, so\n * it moves to the head of the recent row — as does a color committed\n * through any other picker under the same {@link RecentColorsProvider}.\n *\n * Like {@link SwatchGrid} it applies nothing itself; `onChange` and\n * `onAltChange` hand the color to the app.\n */\nexport function SwatchStrip(props: SwatchStripProps): ReactElement {\n const { value, onChange, onAltChange, className } = props;\n const palettes = props.palettes ?? BUILTIN_PALETTES;\n const columns = props.columns ?? 10;\n const ctxStore = useRecentColorsStore();\n const store = props.store ?? ctxStore;\n const recent = useRecentColors(store);\n const recentHeading = useId();\n\n const [ownPalette, setOwnPalette] = useState(props.defaultPalette);\n const paletteId = props.palette ?? ownPalette;\n const shown = palettes.find((p) => p.id === paletteId) ?? palettes[0];\n const choosePalette = (id: string): void => {\n setOwnPalette(id);\n props.onPaletteChange?.(id);\n };\n\n const recentOptions: SwatchGridOption[] = recent.map((c) => ({ value: c, label: describeColor(c) }));\n // Match on the color, not its spelling, so `#F00` lights `#ff0000ff`.\n const currentIn = (options: readonly SwatchGridOption[]): string | null | undefined =>\n value === undefined ? undefined : options.find((o) => same(o.value, value))?.value;\n\n const grids = (\n <>\n {store && (\n <section className={s.section} aria-labelledby={recentHeading}>\n <div id={recentHeading} className={s.heading}>Recent</div>\n {recentOptions.length > 0 ? (\n <SwatchGrid\n aria-label=\"Recent colors\"\n options={recentOptions}\n value={currentIn(recentOptions)}\n columns={columns}\n onChange={onChange}\n onAltChange={onAltChange}\n />\n ) : (\n <p className={s.empty}>No recent colors</p>\n )}\n </section>\n )}\n {shown && (\n <section className={s.section}>\n {palettes.length > 1 ? (\n <Select<string>\n label=\"Palette\"\n orientation=\"row\"\n options={palettes.map((p) => ({ value: p.id, label: p.name }))}\n selectedKey={shown.id}\n onSelectionChange={choosePalette}\n />\n ) : (\n <div className={s.heading}>{shown.name}</div>\n )}\n <SwatchGrid\n key={shown.id}\n aria-label={shown.name}\n options={shown.colors}\n value={currentIn(shown.colors)}\n columns={shown.columns ?? columns}\n onChange={onChange}\n onAltChange={onAltChange}\n />\n </section>\n )}\n </>\n );\n\n return (\n <div\n className={[s.root, className].filter(Boolean).join(' ')}\n role=\"group\"\n aria-label={props['aria-label'] ?? 'Swatches'}\n >\n {/* A store given by prop is where applies here record too. */}\n {props.store && props.store !== ctxStore\n ? <RecentColorsProvider store={props.store}>{grids}</RecentColorsProvider>\n : grids}\n </div>\n );\n}\n"],"mappings":";;;;;;;AAiBA,IAAaQ,IAAkC;CAC7C,IAAI;CACJ,MAAM;CACN,SAAS;CACT,QAAQ;EACN;GAAE,OAAO;GAAa,OAAO;EAAO;EACpC;GAAE,OAAO;GAAa,OAAO;EAAQ;EACrC;GAAE,OAAO;GAAa,OAAO;EAAQ;EACrC;GAAE,OAAO;GAAa,OAAO;EAAM;EACnC;GAAE,OAAO;GAAa,OAAO;EAAQ;EACrC;GAAE,OAAO;GAAa,OAAO;EAAO;EACpC;GAAE,OAAO;GAAa,OAAO;EAAO;EACpC;GAAE,OAAO;GAAa,OAAO;EAAU;EACvC;GAAE,OAAO;GAAa,OAAO;EAAS;EACtC;GAAE,OAAO;GAAa,OAAO;EAAS;EACtC;GAAE,OAAO;GAAa,OAAO;EAAU;EACvC;GAAE,OAAO;GAAa,OAAO;EAAW;EACxC;GAAE,OAAO;GAAa,OAAO;EAAW;EACxC;GAAE,OAAO;GAAa,OAAO;EAAW;EACxC;GAAE,OAAO;GAAa,OAAO;EAAW;EACxC;GAAE,OAAO;GAAa,OAAO;EAAW;EACxC;GAAE,OAAO;GAAa,OAAO;EAAW;EACxC;GAAE,OAAO;GAAa,OAAO;EAAW;EACxC;GAAE,OAAO;GAAa,OAAO;EAAW;EACxC;GAAE,OAAO;GAAa,OAAO;EAAW;EACxC;GAAE,OAAO;GAAa,OAAO;EAAS;EACtC;GAAE,OAAO;GAAa,OAAO;EAAU;EACvC;GAAE,OAAO;GAAa,OAAO;EAAU;EACvC;GAAE,OAAO;GAAa,OAAO;EAAU;EACvC;GAAE,OAAO;GAAa,OAAO;EAAU;EACvC;GAAE,OAAO;GAAa,OAAO;EAAU;EACvC;GAAE,OAAO;GAAa,OAAO;EAAU;EACvC;GAAE,OAAO;GAAa,OAAO;EAAU;EACvC;GAAE,OA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AAWpC,EAAE;GAAO,UAAA;EAAmB,CAAA,CAErC;CAEV,CAAA,GAAAgC,KACC,kBAAC,WAAD;EAAS,WAAWhC,EAAE;EAAtB,UAAA,CACGqB,EAAS,SAAS,IACjB,kBAAChB,GAAD;GACE,OAAM;GACN,aAAY;GACZ,SAASgB,EAAS,KAAK,OAAO;IAAE,OAAOY,EAAE;IAAI,OAAOA,EAAE;GAAK,EAAE;GAC7D,aAAaD,EAAM;GACnB,mBAAmBE;EACpB,CAAA,IAED,kBAAC,OAAD;GAAK,WAAWlC,EAAE;GAAU,UAAAgC,EAAM;EAAU,CAAA,GAE9C,kBAAC1B,GAAD;GAEE,cAAY0B,EAAM;GAClB,SAASA,EAAM;GACf,OAAOK,EAAUL,EAAM,MAAM;GAC7B,SAASA,EAAM,WAAWV;GAChB;GACG;EACd,GAPMU,EAAM,EAOZ,CACM;CAEX,CAAA,CAAA,EAAA,CAAA;CAGJ,OACE,kBAAC,OAAD;EACE,WAAW,CAAChC,EAAE,MAAM2C,CAAS,CAAC,CAAC,OAAO,OAAO,CAAC,CAAC,KAAK,GAAG;EACvD,MAAK;EACL,cAAYvB,EAAM,iBAAiB;EAGlC,UAAAA,EAAM,SAASA,EAAM,UAAUG,IAC5B,kBAACnB,GAAD;GAAsB,OAAOgB,EAAM;GAAQ,UAAAqB;EAA4B,CAAA,IACvEA;CACD,CAAA;AAET"}
1
+ {"version":3,"file":"SwatchStrip-Bi9iPLoh.js","names":["_Fragment","s","useRecentColors","normalizeRecentColor","useRecentColorsStore","RecentColorsProvider","Select","SwatchGrid","STANDARD_PALETTE","BASIC_PALETTE","BUILTIN_PALETTES","SwatchStrip_module_default","describeColor","c","color","alpha","getAlpha01","same","a","b","SwatchStrip","props","palettes","columns","ctxStore","store","recent","recentHeading","useId","ownPalette","setOwnPalette","useState","paletteId","shown","p","choosePalette","id","recentOptions","currentIn","value","options","o","grids","Fragment","className"],"sources":["../../src/components/SwatchStrip/palettes.ts","../../src/components/SwatchStrip/SwatchStrip.module.css","../../src/components/SwatchStrip/SwatchStrip.tsx"],"sourcesContent":["import type { SwatchGridOption } from '../SwatchGrid';\n\n/** A named set of swatches offered by {@link SwatchStrip}. */\nexport interface SwatchPalette {\n /** Stable key, for the palette choice and for React. */\n id: string;\n /** What the palette picker shows. */\n name: string;\n /** `value: null` is the \"no paint\" swatch. Each `label` is the swatch's\n * accessible name, so it should say the color. */\n colors: readonly SwatchGridOption[];\n /** Swatches per row. Default: the strip's `columns`. */\n columns?: number;\n}\n\n/** No paint, the named primaries and secondaries, a gray ramp, and eight hue\n * ramps of ten shades each (50 → 900). */\nexport const STANDARD_PALETTE: SwatchPalette = {\n id: 'standard',\n name: 'Standard',\n columns: 10,\n colors: [\n { value: null, label: 'None' },\n { value: '#ffffffff', label: 'White' },\n { value: '#000000ff', label: 'Black' },\n { value: '#ff0000ff', label: 'Red' },\n { value: '#00ff00ff', label: 'Green' },\n { value: '#0000ffff', label: 'Blue' },\n { value: '#00ffffff', label: 'Cyan' },\n { value: '#ff00ffff', label: 'Magenta' },\n { value: '#ffff00ff', label: 'Yellow' },\n { value: '#ff8800ff', label: 'Orange' },\n { value: '#fafafaff', label: 'Gray 50' },\n { value: '#f5f5f5ff', label: 'Gray 100' },\n { value: '#e5e5e5ff', label: 'Gray 200' },\n { value: '#d4d4d4ff', label: 'Gray 300' },\n { value: '#a3a3a3ff', label: 'Gray 400' },\n { value: '#737373ff', label: 'Gray 500' },\n { value: '#525252ff', label: 'Gray 600' },\n { value: '#404040ff', label: 'Gray 700' },\n { value: '#262626ff', label: 'Gray 800' },\n { value: '#171717ff', label: 'Gray 900' },\n { value: '#fef2f2ff', label: 'Red 50' },\n { value: '#fee2e2ff', label: 'Red 100' },\n { value: '#fecacaff', label: 'Red 200' },\n { value: '#fca5a5ff', label: 'Red 300' },\n { value: '#f87171ff', label: 'Red 400' },\n { value: '#ef4444ff', label: 'Red 500' },\n { value: '#dc2626ff', label: 'Red 600' },\n { value: '#b91c1cff', label: 'Red 700' },\n { value: '#991b1bff', label: 'Red 800' },\n { value: '#7f1d1dff', label: 'Red 900' },\n { value: '#fff7edff', label: 'Orange 50' },\n { value: '#ffedd5ff', label: 'Orange 100' },\n { value: '#fed7aaff', label: 'Orange 200' },\n { value: '#fdba74ff', label: 'Orange 300' },\n { value: '#fb923cff', label: 'Orange 400' },\n { value: '#f97316ff', label: 'Orange 500' },\n { value: '#ea580cff', label: 'Orange 600' },\n { value: '#c2410cff', label: 'Orange 700' },\n { value: '#9a3412ff', label: 'Orange 800' },\n { value: '#7c2d12ff', label: 'Orange 900' },\n { value: '#fefce8ff', label: 'Yellow 50' },\n { value: '#fef9c3ff', label: 'Yellow 100' },\n { value: '#fef08aff', label: 'Yellow 200' },\n { value: '#fde047ff', label: 'Yellow 300' },\n { value: '#facc15ff', label: 'Yellow 400' },\n { value: '#eab308ff', label: 'Yellow 500' },\n { value: '#ca8a04ff', label: 'Yellow 600' },\n { value: '#a16207ff', label: 'Yellow 700' },\n { value: '#854d0eff', label: 'Yellow 800' },\n { value: '#713f12ff', label: 'Yellow 900' },\n { value: '#f0fdf4ff', label: 'Green 50' },\n { value: '#dcfce7ff', label: 'Green 100' },\n { value: '#bbf7d0ff', label: 'Green 200' },\n { value: '#86efacff', label: 'Green 300' },\n { value: '#4ade80ff', label: 'Green 400' },\n { value: '#22c55eff', label: 'Green 500' },\n { value: '#16a34aff', label: 'Green 600' },\n { value: '#15803dff', label: 'Green 700' },\n { value: '#166534ff', label: 'Green 800' },\n { value: '#14532dff', label: 'Green 900' },\n { value: '#ecfeffff', label: 'Cyan 50' },\n { value: '#cffafeff', label: 'Cyan 100' },\n { value: '#a5f3fcff', label: 'Cyan 200' },\n { value: '#67e8f9ff', label: 'Cyan 300' },\n { value: '#22d3eeff', label: 'Cyan 400' },\n { value: '#06b6d4ff', label: 'Cyan 500' },\n { value: '#0891b2ff', label: 'Cyan 600' },\n { value: '#0e7490ff', label: 'Cyan 700' },\n { value: '#155e75ff', label: 'Cyan 800' },\n { value: '#164e63ff', label: 'Cyan 900' },\n { value: '#eff6ffff', label: 'Blue 50' },\n { value: '#dbeafeff', label: 'Blue 100' },\n { value: '#bfdbfeff', label: 'Blue 200' },\n { value: '#93c5fdff', label: 'Blue 300' },\n { value: '#60a5faff', label: 'Blue 400' },\n { value: '#3b82f6ff', label: 'Blue 500' },\n { value: '#2563ebff', label: 'Blue 600' },\n { value: '#1d4ed8ff', label: 'Blue 700' },\n { value: '#1e40afff', label: 'Blue 800' },\n { value: '#1e3a8aff', label: 'Blue 900' },\n { value: '#faf5ffff', label: 'Purple 50' },\n { value: '#f3e8ffff', label: 'Purple 100' },\n { value: '#e9d5ffff', label: 'Purple 200' },\n { value: '#d8b4feff', label: 'Purple 300' },\n { value: '#c084fcff', label: 'Purple 400' },\n { value: '#a855f7ff', label: 'Purple 500' },\n { value: '#9333eaff', label: 'Purple 600' },\n { value: '#7e22ceff', label: 'Purple 700' },\n { value: '#6b21a8ff', label: 'Purple 800' },\n { value: '#581c87ff', label: 'Purple 900' },\n { value: '#fdf2f8ff', label: 'Pink 50' },\n { value: '#fce7f3ff', label: 'Pink 100' },\n { value: '#fbcfe8ff', label: 'Pink 200' },\n { value: '#f9a8d4ff', label: 'Pink 300' },\n { value: '#f472b6ff', label: 'Pink 400' },\n { value: '#ec4899ff', label: 'Pink 500' },\n { value: '#db2777ff', label: 'Pink 600' },\n { value: '#be185dff', label: 'Pink 700' },\n { value: '#9d174dff', label: 'Pink 800' },\n { value: '#831843ff', label: 'Pink 900' },\n ],\n};\n\n/** No paint and CSS's basic named colors, with pink and brown. */\nexport const BASIC_PALETTE: SwatchPalette = {\n id: 'basic',\n name: 'Basic',\n columns: 10,\n colors: [\n { value: null, label: 'None' },\n { value: '#000000ff', label: 'Black' },\n { value: '#ffffffff', label: 'White' },\n { value: '#808080ff', label: 'Gray' },\n { value: '#c0c0c0ff', label: 'Silver' },\n { value: '#800000ff', label: 'Maroon' },\n { value: '#ff0000ff', label: 'Red' },\n { value: '#ffa500ff', label: 'Orange' },\n { value: '#ffff00ff', label: 'Yellow' },\n { value: '#808000ff', label: 'Olive' },\n { value: '#00ff00ff', label: 'Lime' },\n { value: '#008000ff', label: 'Green' },\n { value: '#008080ff', label: 'Teal' },\n { value: '#00ffffff', label: 'Cyan' },\n { value: '#000080ff', label: 'Navy' },\n { value: '#0000ffff', label: 'Blue' },\n { value: '#800080ff', label: 'Purple' },\n { value: '#ff00ffff', label: 'Magenta' },\n { value: '#ffc0cbff', label: 'Pink' },\n { value: '#a52a2aff', label: 'Brown' },\n ],\n};\n\n/** What {@link SwatchStrip} offers when given no `palettes`. */\nexport const BUILTIN_PALETTES: readonly SwatchPalette[] = [STANDARD_PALETTE, BASIC_PALETTE];\n",".root {\n display: flex;\n flex-direction: column;\n gap: var(--wzl-space-3);\n min-inline-size: 0;\n}\n\n.section {\n display: flex;\n flex-direction: column;\n gap: var(--wzl-space-1);\n min-inline-size: 0;\n}\n\n.heading {\n font-family: var(--wzl-font-ui);\n font-size: var(--wzl-font-size-xs);\n font-weight: var(--wzl-font-weight-medium);\n text-transform: var(--wzl-params-label-case, uppercase);\n letter-spacing: var(--wzl-params-label-tracking, var(--wzl-tracking-wide));\n color: var(--wzl-fg-muted);\n}\n\n.empty {\n margin: 0;\n font-family: var(--wzl-font-ui);\n font-size: var(--wzl-font-size-sm);\n color: var(--wzl-fg-muted);\n}\n","import { useId, useState, type ReactElement } from 'react';\nimport { getAlpha01 } from '@weasel-js/core';\nimport { SwatchGrid, type SwatchGridOption } from '../SwatchGrid';\nimport { Select } from '../Select';\nimport {\n RecentColorsProvider,\n normalizeRecentColor,\n useRecentColors,\n useRecentColorsStore,\n type RecentColorsStore,\n} from '../RecentColors';\nimport { BUILTIN_PALETTES, type SwatchPalette } from './palettes';\nimport s from './SwatchStrip.module.css';\n\n/** Props for {@link SwatchStrip}. */\nexport interface SwatchStripProps {\n /** The color to mark current, in either row. `null` marks \"no paint\". */\n value?: string | null;\n /** A swatch applied: click, Enter or Space. */\n onChange: (value: string | null) => void;\n /** The alternate target, as on {@link SwatchGrid}: shift-click,\n * right-click, Shift+Enter. */\n onAltChange?: (value: string | null) => void;\n /** The preset palettes on offer. Default {@link BUILTIN_PALETTES}. More\n * than one adds a picker. */\n palettes?: readonly SwatchPalette[];\n /** The shown palette's id, controlled. */\n palette?: string;\n /** The shown palette's id to start on, uncontrolled. Default: the first. */\n defaultPalette?: string;\n onPaletteChange?: (id: string) => void;\n /** Where the recent row reads from and applies record into. Default: the\n * nearest {@link RecentColorsProvider}'s. With neither there is no recent\n * row. */\n store?: RecentColorsStore;\n /** Swatches per row, for the recent row and any palette that sets none.\n * Default 10. */\n columns?: number;\n 'aria-label'?: string;\n className?: string;\n}\n\n/** A color as a screen reader should hear it: the hex, and the opacity\n * when it is not opaque. Any other CSS color reads as written. */\nexport function describeColor(color: string): string {\n const c = normalizeRecentColor(color) ?? color;\n if (!c.startsWith('#') || c.length !== 9) return c;\n const alpha = Math.round(getAlpha01(c) * 100);\n return alpha === 100 ? c.slice(0, 7) : `${c.slice(0, 7)}, ${alpha}% opacity`;\n}\n\nfunction same(a: string | null, b: string | null): boolean {\n if (a === null || b === null) return a === b;\n return normalizeRecentColor(a) === normalizeRecentColor(b);\n}\n\n/**\n * The swatches a color picker sits beside: the recently used colors, most\n * recent first, above a preset palette. Applying any swatch records it, so\n * it moves to the head of the recent row — as does a color committed\n * through any other picker under the same {@link RecentColorsProvider}.\n *\n * Like {@link SwatchGrid} it applies nothing itself; `onChange` and\n * `onAltChange` hand the color to the app.\n */\nexport function SwatchStrip(props: SwatchStripProps): ReactElement {\n const { value, onChange, onAltChange, className } = props;\n const palettes = props.palettes ?? BUILTIN_PALETTES;\n const columns = props.columns ?? 10;\n const ctxStore = useRecentColorsStore();\n const store = props.store ?? ctxStore;\n const recent = useRecentColors(store);\n const recentHeading = useId();\n\n const [ownPalette, setOwnPalette] = useState(props.defaultPalette);\n const paletteId = props.palette ?? ownPalette;\n const shown = palettes.find((p) => p.id === paletteId) ?? palettes[0];\n const choosePalette = (id: string): void => {\n setOwnPalette(id);\n props.onPaletteChange?.(id);\n };\n\n const recentOptions: SwatchGridOption[] = recent.map((c) => ({ value: c, label: describeColor(c) }));\n // Match on the color, not its spelling, so `#F00` lights `#ff0000ff`.\n const currentIn = (options: readonly SwatchGridOption[]): string | null | undefined =>\n value === undefined ? undefined : options.find((o) => same(o.value, value))?.value;\n\n const grids = (\n <>\n {store && (\n <section className={s.section} aria-labelledby={recentHeading}>\n <div id={recentHeading} className={s.heading}>Recent</div>\n {recentOptions.length > 0 ? (\n <SwatchGrid\n aria-label=\"Recent colors\"\n options={recentOptions}\n value={currentIn(recentOptions)}\n columns={columns}\n onChange={onChange}\n onAltChange={onAltChange}\n />\n ) : (\n <p className={s.empty}>No recent colors</p>\n )}\n </section>\n )}\n {shown && (\n <section className={s.section}>\n {palettes.length > 1 ? (\n <Select<string>\n label=\"Palette\"\n orientation=\"row\"\n options={palettes.map((p) => ({ value: p.id, label: p.name }))}\n selectedKey={shown.id}\n onSelectionChange={choosePalette}\n />\n ) : (\n <div className={s.heading}>{shown.name}</div>\n )}\n <SwatchGrid\n key={shown.id}\n aria-label={shown.name}\n options={shown.colors}\n value={currentIn(shown.colors)}\n columns={shown.columns ?? columns}\n onChange={onChange}\n onAltChange={onAltChange}\n />\n </section>\n )}\n </>\n );\n\n return (\n <div\n className={[s.root, className].filter(Boolean).join(' ')}\n role=\"group\"\n aria-label={props['aria-label'] ?? 'Swatches'}\n >\n {/* A store given by prop is where applies here record too. */}\n {props.store && props.store !== ctxStore\n ? <RecentColorsProvider store={props.store}>{grids}</RecentColorsProvider>\n : grids}\n </div>\n );\n}\n"],"mappings":";;;;;;;AAiBA,IAAaQ,IAAkC;CAC7C,IAAI;CACJ,MAAM;CACN,SAAS;CACT,QAAQ;EACN;GAAE,OAAO;GAAa,OAAO;EAAO;EACpC;GAAE,OAAO;GAAa,OAAO;EAAQ;EACrC;GAAE,OAAO;GAAa,OAAO;EAAQ;EACrC;GAA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