@jimka/typescript-ui 0.2.0 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (167) hide show
  1. package/README.md +4 -0
  2. package/THIRD-PARTY-NOTICES.md +7 -3
  3. package/dist/lib/{AbstractBooleanInput-BGesvIZy.js → AbstractBooleanInput-C3O4kv7_.js} +2 -2
  4. package/dist/lib/{AbstractBooleanInput-BGesvIZy.js.map → AbstractBooleanInput-C3O4kv7_.js.map} +1 -1
  5. package/dist/lib/{AbstractInput-BxOtFrER.js → AbstractInput-DFWniHqq.js} +2 -2
  6. package/dist/lib/{AbstractInput-BxOtFrER.js.map → AbstractInput-DFWniHqq.js.map} +1 -1
  7. package/dist/lib/AnchorConstraints-CSUcj8Wx.js +2 -0
  8. package/dist/lib/AnchorConstraints-CSUcj8Wx.js.map +1 -0
  9. package/dist/lib/{AnimatedDropdown-CZQEqQi-.js → AnimatedDropdown-e9urCXK1.js} +2 -2
  10. package/dist/lib/{AnimatedDropdown-CZQEqQi-.js.map → AnimatedDropdown-e9urCXK1.js.map} +1 -1
  11. package/dist/lib/Border-Dq6dXkmS.js +2 -0
  12. package/dist/lib/{Border-BgaZkc1R.js.map → Border-Dq6dXkmS.js.map} +1 -1
  13. package/dist/lib/{Button-U1rsP4v8.js → Button-B36rBMKC.js} +2 -2
  14. package/dist/lib/{Button-U1rsP4v8.js.map → Button-B36rBMKC.js.map} +1 -1
  15. package/dist/lib/{Card-BVwOS8AG.js → Card-P8iUH2-C.js} +2 -2
  16. package/dist/lib/{Card-BVwOS8AG.js.map → Card-P8iUH2-C.js.map} +1 -1
  17. package/dist/lib/{ComboBox-B9EDPu6T.js → ComboBox-BjAhXXkY.js} +2 -2
  18. package/dist/lib/{ComboBox-B9EDPu6T.js.map → ComboBox-BjAhXXkY.js.map} +1 -1
  19. package/dist/lib/Component-CHTzJxEf.js +2 -0
  20. package/dist/lib/Component-CHTzJxEf.js.map +1 -0
  21. package/dist/lib/Container-xUbHk6l_.js +2 -0
  22. package/dist/lib/{Container-D5H8VxJK.js.map → Container-xUbHk6l_.js.map} +1 -1
  23. package/dist/lib/DOM-BeR95tE8.js +2 -0
  24. package/dist/lib/DOM-BeR95tE8.js.map +1 -0
  25. package/dist/lib/{DragManager-CI4mZQFy.js → DragManager-T5Oljd0F.js} +2 -2
  26. package/dist/lib/{DragManager-CI4mZQFy.js.map → DragManager-T5Oljd0F.js.map} +1 -1
  27. package/dist/lib/{FieldDecorator-CJs9gwqH.js → FieldDecorator-BaTGfKiW.js} +2 -2
  28. package/dist/lib/{FieldDecorator-CJs9gwqH.js.map → FieldDecorator-BaTGfKiW.js.map} +1 -1
  29. package/dist/lib/{Fit-DjRsiwlg.js → Fit-E-EIZv1k.js} +2 -2
  30. package/dist/lib/{Fit-DjRsiwlg.js.map → Fit-E-EIZv1k.js.map} +1 -1
  31. package/dist/lib/{Glyph-KEf4nIv2.js → Glyph-CnNslL95.js} +2 -2
  32. package/dist/lib/{Glyph-KEf4nIv2.js.map → Glyph-CnNslL95.js.map} +1 -1
  33. package/dist/lib/{Grid-DdL9TVeJ.js → Grid-BXS2T8MT.js} +2 -2
  34. package/dist/lib/{Grid-DdL9TVeJ.js.map → Grid-BXS2T8MT.js.map} +1 -1
  35. package/dist/lib/{GridConstraints-DkLueyrf.js → GridConstraints-D_kbd-h2.js} +2 -2
  36. package/dist/lib/{GridConstraints-DkLueyrf.js.map → GridConstraints-D_kbd-h2.js.map} +1 -1
  37. package/dist/lib/HBox-Dm3xgsDE.js +2 -0
  38. package/dist/lib/{HBox-Ce0GTCJP.js.map → HBox-Dm3xgsDE.js.map} +1 -1
  39. package/dist/lib/{Header-BQIVpBte.js → Header-CqFc2OUx.js} +2 -2
  40. package/dist/lib/{Header-BQIVpBte.js.map → Header-CqFc2OUx.js.map} +1 -1
  41. package/dist/lib/{IconText-Bo4Qcnot.js → IconText-CTM2r0Tv.js} +2 -2
  42. package/dist/lib/{IconText-Bo4Qcnot.js.map → IconText-CTM2r0Tv.js.map} +1 -1
  43. package/dist/lib/{LayoutSerialization-BT66TY83.js → LayoutSerialization-D1OHmxSB.js} +2 -2
  44. package/dist/lib/{LayoutSerialization-BT66TY83.js.map → LayoutSerialization-D1OHmxSB.js.map} +1 -1
  45. package/dist/lib/LayoutSizes-CvMmMgHJ.js +2 -0
  46. package/dist/lib/LayoutSizes-CvMmMgHJ.js.map +1 -0
  47. package/dist/lib/List-DHeOPAK2.js +2 -0
  48. package/dist/lib/List-DHeOPAK2.js.map +1 -0
  49. package/dist/lib/MemoryStore-DT6iWWco.js +2 -0
  50. package/dist/lib/MemoryStore-DT6iWWco.js.map +1 -0
  51. package/dist/lib/{Menu-Dz4L7EKJ.js → Menu-B6ippw-p.js} +2 -2
  52. package/dist/lib/{Menu-Dz4L7EKJ.js.map → Menu-B6ippw-p.js.map} +1 -1
  53. package/dist/lib/{MenuButton-VJ5uC3c1.js → MenuButton-Bjm1OyB-.js} +2 -2
  54. package/dist/lib/{MenuButton-VJ5uC3c1.js.map → MenuButton-Bjm1OyB-.js.map} +1 -1
  55. package/dist/lib/{Panel-DzWdYwq1.js → Panel-D9lTLGqP.js} +2 -2
  56. package/dist/lib/{Panel-DzWdYwq1.js.map → Panel-D9lTLGqP.js.map} +1 -1
  57. package/dist/lib/Position-DRSlWn4Z.js +2 -0
  58. package/dist/lib/Position-DRSlWn4Z.js.map +1 -0
  59. package/dist/lib/{ProgressSpinner-zJKtGyNJ.js → ProgressSpinner-glv-29eK.js} +2 -2
  60. package/dist/lib/{ProgressSpinner-zJKtGyNJ.js.map → ProgressSpinner-glv-29eK.js.map} +1 -1
  61. package/dist/lib/{RadioButton-CYSSv4nV.js → RadioButton-R4S3c9WD.js} +2 -2
  62. package/dist/lib/{RadioButton-CYSSv4nV.js.map → RadioButton-R4S3c9WD.js.map} +1 -1
  63. package/dist/lib/{RovingTabIndex-BSZ31Vp5.js → RovingTabIndex-Dgt01LOE.js} +2 -2
  64. package/dist/lib/{RovingTabIndex-BSZ31Vp5.js.map → RovingTabIndex-Dgt01LOE.js.map} +1 -1
  65. package/dist/lib/{Scrollbar-BhtOjqkG.js → Scrollbar-CiVV3axj.js} +2 -2
  66. package/dist/lib/{Scrollbar-BhtOjqkG.js.map → Scrollbar-CiVV3axj.js.map} +1 -1
  67. package/dist/lib/{Slider-CdXm7E64.js → Slider-_JVvuQ8M.js} +2 -2
  68. package/dist/lib/{Slider-CdXm7E64.js.map → Slider-_JVvuQ8M.js.map} +1 -1
  69. package/dist/lib/{Spacer-D9NGW4QG.js → Spacer-B57i2-_G.js} +2 -2
  70. package/dist/lib/{Spacer-D9NGW4QG.js.map → Spacer-B57i2-_G.js.map} +1 -1
  71. package/dist/lib/{TabButton-CThevdY_.js → TabButton-DEypdlZf.js} +2 -2
  72. package/dist/lib/{TabButton-CThevdY_.js.map → TabButton-DEypdlZf.js.map} +1 -1
  73. package/dist/lib/Text-Bni4icFY.js +2 -0
  74. package/dist/lib/Text-Bni4icFY.js.map +1 -0
  75. package/dist/lib/{Tooltip-tkXDk5Bo.js → Tooltip-BUy6uFKN.js} +2 -2
  76. package/dist/lib/{Tooltip-tkXDk5Bo.js.map → Tooltip-BUy6uFKN.js.map} +1 -1
  77. package/dist/lib/VBox-Dr7Ge9M6.js +2 -0
  78. package/dist/lib/VBox-Dr7Ge9M6.js.map +1 -0
  79. package/dist/lib/{VirtualScroller-DwEEJE1_.js → VirtualScroller-BPy6KmSX.js} +2 -2
  80. package/dist/lib/{VirtualScroller-DwEEJE1_.js.map → VirtualScroller-BPy6KmSX.js.map} +1 -1
  81. package/dist/lib/component/button.es.js +1 -1
  82. package/dist/lib/component/chart.es.js +1 -1
  83. package/dist/lib/component/chart.es.js.map +1 -1
  84. package/dist/lib/component/container.es.js +1 -1
  85. package/dist/lib/component/diagram.es.js +1 -1
  86. package/dist/lib/component/diagram.es.js.map +1 -1
  87. package/dist/lib/component/display.es.js +1 -1
  88. package/dist/lib/component/editor.es.js +3 -3
  89. package/dist/lib/component/editor.es.js.map +1 -1
  90. package/dist/lib/component/input.es.js +1 -1
  91. package/dist/lib/component/input.es.js.map +1 -1
  92. package/dist/lib/component/list.es.js +1 -1
  93. package/dist/lib/component/menubar.es.js +1 -1
  94. package/dist/lib/component/table.es.js +2 -2
  95. package/dist/lib/component/table.es.js.map +1 -1
  96. package/dist/lib/component/tree.es.js +1 -1
  97. package/dist/lib/component/tree.es.js.map +1 -1
  98. package/dist/lib/core.es.js +1 -1
  99. package/dist/lib/core.es.js.map +1 -1
  100. package/dist/lib/data.es.js +1 -1
  101. package/dist/lib/data.es.js.map +1 -1
  102. package/dist/lib/glyphs/solid/index.es.js +1 -1
  103. package/dist/lib/layout.es.js +1 -1
  104. package/dist/lib/layout.es.js.map +1 -1
  105. package/dist/lib/overlay.es.js +1 -1
  106. package/dist/lib/overlay.es.js.map +1 -1
  107. package/dist/lib/primitive.es.js +1 -1
  108. package/dist/lib/router.es.js +1 -1
  109. package/dist/lib/router.es.js.map +1 -1
  110. package/dist/lib/{VirtualRowView-BxpHQ_u8.js → selectionsEqual-2PJrcimg.js} +2 -2
  111. package/dist/lib/{VirtualRowView-BxpHQ_u8.js.map → selectionsEqual-2PJrcimg.js.map} +1 -1
  112. package/dist/lib/types/component/diagram/DiagramEdgeLayer.d.ts +14 -1
  113. package/dist/lib/types/component/diagram/DiagramModel.d.ts +1 -0
  114. package/dist/lib/types/component/diagram/DiagramNode.d.ts +4 -0
  115. package/dist/lib/types/component/diagram/DiagramView.d.ts +76 -5
  116. package/dist/lib/types/component/diagram/ElkLayoutEngine.d.ts +14 -1
  117. package/dist/lib/types/component/diagram/index.d.ts +2 -2
  118. package/dist/lib/types/component/editor/CodeEditor.d.ts +3 -2
  119. package/dist/lib/types/component/input/Text.d.ts +3 -1
  120. package/dist/lib/types/component/shared/selectionsEqual.d.ts +1 -0
  121. package/dist/lib/types/component/table/Column.d.ts +2 -0
  122. package/dist/lib/types/component/table/ColumnConfig.d.ts +1 -0
  123. package/dist/lib/types/component/table/Header.d.ts +1 -0
  124. package/dist/lib/types/component/table/Table.d.ts +20 -0
  125. package/dist/lib/types/component/table/cell/Header.d.ts +1 -0
  126. package/dist/lib/types/component/table/index.d.ts +1 -1
  127. package/dist/lib/types/component/tree/Tree.d.ts +1 -0
  128. package/dist/lib/types/core/Aria.d.ts +0 -2
  129. package/dist/lib/types/core/Body.d.ts +1 -0
  130. package/dist/lib/types/core/ClassStyleRules.d.ts +17 -0
  131. package/dist/lib/types/core/Component.d.ts +10 -2
  132. package/dist/lib/types/core/ComponentDefaults.d.ts +1 -0
  133. package/dist/lib/types/core/DOM.d.ts +11 -2
  134. package/dist/lib/types/core/ElementAttributes.d.ts +15 -0
  135. package/dist/lib/types/core/PendingTransitions.d.ts +4 -0
  136. package/dist/lib/types/core/StyleTarget.d.ts +1 -0
  137. package/dist/lib/types/core/Util.d.ts +2 -0
  138. package/dist/lib/types/core/index.d.ts +1 -0
  139. package/dist/lib/types/layout/Border.d.ts +1 -0
  140. package/dist/lib/types/layout/Tab.d.ts +4 -1
  141. package/dist/lib/types/layout/Table.d.ts +1 -0
  142. package/dist/lib/types/overlay/AbstractWindow.d.ts +1 -0
  143. package/dist/lib/types/router/RoutePattern.d.ts +7 -0
  144. package/dist/lib/types/router/Router.d.ts +13 -2
  145. package/dist/lib/types/router/index.d.ts +1 -1
  146. package/dist/lib/validation.es.js +1 -1
  147. package/llms.txt +1 -1
  148. package/package.json +4 -8
  149. package/dist/lib/Border-BgaZkc1R.js +0 -2
  150. package/dist/lib/BoxLayout-DrKGfsup.js +0 -2
  151. package/dist/lib/BoxLayout-DrKGfsup.js.map +0 -1
  152. package/dist/lib/Component-DXf5a3g0.js +0 -2
  153. package/dist/lib/Component-DXf5a3g0.js.map +0 -1
  154. package/dist/lib/Container-D5H8VxJK.js +0 -2
  155. package/dist/lib/DOM-CGn7xyTw.js +0 -2
  156. package/dist/lib/DOM-CGn7xyTw.js.map +0 -1
  157. package/dist/lib/HBox-Ce0GTCJP.js +0 -2
  158. package/dist/lib/LayoutSizes-DU3qSq0w.js +0 -2
  159. package/dist/lib/LayoutSizes-DU3qSq0w.js.map +0 -1
  160. package/dist/lib/List-DtTVTyWW.js +0 -2
  161. package/dist/lib/List-DtTVTyWW.js.map +0 -1
  162. package/dist/lib/Position-A39T7-_1.js +0 -2
  163. package/dist/lib/Position-A39T7-_1.js.map +0 -1
  164. package/dist/lib/Text-gz6qjFfP.js +0 -2
  165. package/dist/lib/Text-gz6qjFfP.js.map +0 -1
  166. package/dist/lib/VBox-EIqw85Rh.js +0 -2
  167. package/dist/lib/VBox-EIqw85Rh.js.map +0 -1
@@ -1,2 +1,2 @@
1
- import{d as e,f as t,l as n}from"./Component-DXf5a3g0.js";var Fit=class extends n{_fill=e.BOTH;constructor(e){super(),e&&this.applyOptions(e)}applyOptions(e){super.applyOptions(e),e.fill!==void 0&&this.setFill(e.fill)}getFill(){return this._fill}setFill(e){return this._fill=e,this}getPreferredSize(){return this.computeSize(e=>e.getPreferredSize())}getMinSize(){return this.computeSize(e=>e.getMinSize())}getMaxSize(){return this.computeSize(e=>e.getMaxSize())}computeSize(e){let t=this.getContainer();if(!t)return null;let n=t.getPerimeterSize(),r=n.left+n.right,i=n.top+n.bottom,a=t.getLaidOutComponents()[0]??null;if(!a)return null;let o=e(a);return o?{width:o.width+r,height:o.height+i}:null}getComponent(){let e=this.getContainer();if(!e)return null;let t=e.getComponents();if(t.length>1)throw Error(`Container contains more than one component.`);let n;return t.length==1&&(n=t[0]),n}computeTotalMinSize(){let e=this.getContainer();if(!e)return{width:0,height:0};let t=e.getLaidOutComponents()[0];return t?t.getMinSize()??{width:0,height:0}:{width:0,height:0}}doLayout(){let e=this.getContainer();if(!e)return;let t=e.getLaidOutComponents();if(t.length>1)throw Error(`Container contains more than one component.`);let n;if(t.length==1&&(n=t[0]),!n)return;let r=e.getInnerSize(),i=e.getContentInsets();r&&=this.inflateForOverflow(r),this.placeComponent(n,i?i.getLeft():0,i?i.getTop():0,r?r.width:0,r?r.height:0,this._fill)}},r=t(Fit);export{r as t};
2
- //# sourceMappingURL=Fit-DjRsiwlg.js.map
1
+ import{d as e,m as t,p as n}from"./Component-CHTzJxEf.js";var Fit=class extends e{_fill=n.BOTH;constructor(e){super(),e&&this.applyOptions(e)}applyOptions(e){super.applyOptions(e),e.fill!==void 0&&this.setFill(e.fill)}getFill(){return this._fill}setFill(e){return this._fill=e,this}getPreferredSize(){return this.computeSize(e=>e.getPreferredSize())}getMinSize(){return this.computeSize(e=>e.getMinSize())}getMaxSize(){return this.computeSize(e=>e.getMaxSize())}computeSize(e){let t=this.getContainer();if(!t)return null;let n=t.getPerimeterSize(),r=n.left+n.right,i=n.top+n.bottom,a=t.getLaidOutComponents()[0]??null;if(!a)return null;let o=e(a);return o?{width:o.width+r,height:o.height+i}:null}getComponent(){let e=this.getContainer();if(!e)return null;let t=e.getComponents();if(t.length>1)throw Error(`Container contains more than one component.`);let n;return t.length==1&&(n=t[0]),n}computeTotalMinSize(){let e=this.getContainer();if(!e)return{width:0,height:0};let t=e.getLaidOutComponents()[0];return t?t.getMinSize()??{width:0,height:0}:{width:0,height:0}}doLayout(){let e=this.getContainer();if(!e)return;let t=e.getLaidOutComponents();if(t.length>1)throw Error(`Container contains more than one component.`);let n;if(t.length==1&&(n=t[0]),!n)return;let r=e.getInnerSize(),i=e.getContentInsets();r&&=this.inflateForOverflow(r),this.placeComponent(n,i?i.getLeft():0,i?i.getTop():0,r?r.width:0,r?r.height:0,this._fill)}},r=t(Fit);export{r as t};
2
+ //# sourceMappingURL=Fit-E-EIZv1k.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Fit-DjRsiwlg.js","names":[],"sources":["../../src/typescript/lib/layout/Fit.ts"],"sourcesContent":["// SPDX-License-Identifier: PolyForm-Noncommercial-1.0.0\n\nimport { LayoutManager, LayoutManagerOptions } from \"~/layout/LayoutManager.js\";\nimport { Size } from \"~/primitive/Size.js\";\nimport { FillType } from \"~/layout/FillType.js\";\nimport { Component } from \"~/core/Component.js\";\nimport { callable } from \"~/core/Callable.js\";\n\n/**\n * Construction-time options for {@link Fit}.\n *\n * @category Layouts\n */\nexport interface FitOptions extends LayoutManagerOptions {\n fill?: FillType;\n}\n\n/**\n * A layout manager that expects exactly one child component and positions it\n * inside the container's entire inner bounds. The default fill mode is\n * `FillType.BOTH` — the child stretches to fill the bounds. Pass\n * `fill: FillType.NONE` (or call {@link Fit.setFill}) to centre the child at\n * its preferred size instead; `HORIZONTAL` / `VERTICAL` stretch on one axis\n * and centre on the other. Throws if the container holds more than one\n * component.\n *\n * @category Layouts\n */\nclass Fit extends LayoutManager {\n\n private _fill: FillType = FillType.BOTH;\n\n constructor(options?: FitOptions) {\n // LayoutManager's constructor takes no options; applied via applyOptions below.\n // eslint-disable-next-line local/forward-super-options\n super();\n\n if (options) {\n this.applyOptions(options);\n }\n }\n\n /**\n * Applies a {@link FitOptions} bag, dispatching the fill mode after the\n * inherited LayoutManager defaults.\n *\n * @param options - The options bag carrying the values to apply.\n */\n protected applyOptions(options: FitOptions): void {\n super.applyOptions(options);\n\n if (options.fill !== undefined) {\n this.setFill(options.fill);\n }\n }\n\n /**\n * Returns the fill mode applied to the single child.\n *\n * @returns The current [`FillType`](/api/layout/enumerations/FillType).\n */\n getFill(): FillType {\n return this._fill;\n }\n\n /**\n * Sets the fill mode applied to the single child.\n *\n * @param fill - `BOTH` stretches the child to fill (default), `NONE`\n * centres it at its preferred size, `HORIZONTAL` / `VERTICAL` stretch on\n * one axis and centre on the other.\n *\n * @returns This layout manager, for method chaining.\n */\n setFill(fill: FillType): this {\n this._fill = fill;\n\n return this;\n }\n\n /**\n * Returns the preferred size of the single child component plus the container perimeter.\n *\n * @returns The preferred `{width, height}`, or `null` if there is no container or no displayed child.\n */\n getPreferredSize(): Size | null {\n return this.computeSize(component => component.getPreferredSize());\n }\n\n /**\n * Returns the minimum size of the single child component plus the container perimeter.\n *\n * @returns The minimum `{width, height}`, or `null` if there is no container or no displayed child.\n */\n getMinSize(): Size | null {\n return this.computeSize(component => component.getMinSize());\n }\n\n /**\n * Returns the maximum size of the single child component plus the container perimeter.\n *\n * @returns The maximum `{width, height}`, or `null` if there is no container or no displayed child.\n */\n getMaxSize(): Size | null {\n return this.computeSize(component => component.getMaxSize());\n }\n\n /**\n * Shared core of {@link getPreferredSize} / {@link getMinSize} /\n * {@link getMaxSize}: adds the displayed child's size (selected by `sizeOf`)\n * to the container perimeter.\n *\n * @param sizeOf - Selects the child's preferred, minimum, or maximum size.\n * @returns The composed `{width, height}`, or `null` if there is no\n * container, no displayed child, or the child reports no size.\n */\n private computeSize(sizeOf: (component: Component) => Size | null): Size | null {\n const container = this.getContainer();\n if (!container) {\n return null;\n }\n\n const perimeterSize = container.getPerimeterSize();\n\n const outerWidth = perimeterSize.left + perimeterSize.right;\n const outerHeight = perimeterSize.top + perimeterSize.bottom;\n\n // Size the displayed child only: a hidden sole child contributes no\n // size, so the Fit container reports none and its own parent reserves\n // nothing for it (honouring `displayed`, matching doLayout below).\n const component = container.getLaidOutComponents()[0] ?? null;\n if (!component) {\n return null;\n }\n\n const size = sizeOf(component);\n if (!size) {\n return null;\n }\n\n return {\n width: size.width + outerWidth,\n height: size.height + outerHeight\n };\n }\n\n /**\n * Returns the single child component of the container, or `undefined` if the container is empty.\n *\n * @returns The child component, or `undefined`.\n *\n * @remarks Throws if the container holds more than one component.\n */\n getComponent() {\n let container = this.getContainer();\n if (!container) {\n return null;\n }\n\n let components = container.getComponents();\n\n if (components.length > 1) {\n throw new Error(\"Container contains more than one component.\");\n }\n\n let component;\n\n if (components.length == 1) {\n component = components[0];\n }\n\n return component;\n }\n\n /**\n * Computes the children's combined minSize along this manager's geometry:\n * the single child's minSize. Used by `doLayout` to inflate the working\n * size when the host has opted into `setOverflowing`.\n *\n * @returns The single child's min-size; `{ width: 0, height: 0 }` when\n * the container is absent or empty.\n */\n protected computeTotalMinSize(): Size {\n const container = this.getContainer();\n if (!container) {\n return { width: 0, height: 0 };\n }\n\n const component = container.getLaidOutComponents()[0];\n if (!component) {\n return { width: 0, height: 0 };\n }\n\n const min = component.getMinSize();\n\n return min ?? { width: 0, height: 0 };\n }\n\n /**\n * Places the single child component inside the container's inner bounds\n * using the configured fill mode.\n *\n * @remarks Throws if the container holds more than one component. With\n * the default `FillType.BOTH` the child is sized to the full bounds;\n * with `FillType.NONE` it is placed at its preferred size and centred\n * via the inherited anchor-displacement logic in `placeComponent`.\n */\n doLayout() {\n let container = this.getContainer();\n if (!container) {\n return;\n }\n\n // Honour `displayed`: a hidden sole child contributes nothing and a\n // hidden first-of-two is skipped, so the visible child still fits.\n let components = container.getLaidOutComponents();\n\n if (components.length > 1) {\n throw new Error(\"Container contains more than one component.\");\n }\n\n let component;\n\n if (components.length == 1) {\n component = components[0];\n }\n\n if (!component) {\n return;\n }\n\n let containerSize = container.getInnerSize();\n let containerInsets = container.getContentInsets();\n\n // Universal scroll: see HBox.doLayout for the rationale. When the\n // host has marked the corresponding axis as overflowing, grow the\n // working size past the host's inner rect to the child's minSize so\n // the host's CSS `overflow: auto` produces a scrollbar.\n if (containerSize) {\n containerSize = this.inflateForOverflow(containerSize);\n }\n\n this.placeComponent(\n component,\n containerInsets ? containerInsets.getLeft() : 0,\n containerInsets ? containerInsets.getTop() : 0,\n containerSize ? containerSize.width : 0,\n containerSize ? containerSize.height : 0,\n this._fill\n );\n }\n}\n\nconst FitCallable = callable(Fit);\ntype FitCallable = Fit;\nexport {\n Fit as _Fit,\n FitCallable as Fit\n};\n"],"mappings":"0DA4BA,IAAM,IAAN,cAAkB,CAAc,CAE5B,MAA0B,EAAS,KAEnC,YAAY,EAAsB,CAG9B,MAAM,EAEF,GACA,KAAK,aAAa,CAAO,CAEjC,CAQA,aAAuB,EAA2B,CAC9C,MAAM,aAAa,CAAO,EAEtB,EAAQ,OAAS,IAAA,IACjB,KAAK,QAAQ,EAAQ,IAAI,CAEjC,CAOA,SAAoB,CAChB,OAAO,KAAK,KAChB,CAWA,QAAQ,EAAsB,CAG1B,MAF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,EAGjE,IAAI,EAMJ,GAJI,EAAW,QAAU,IACrB,EAAY,EAAW,IAGvB,CAAC,EACD,OAGJ,IAAI,EAAgB,EAAU,aAAa,EACvC,EAAkB,EAAU,iBAAiB,EAMjD,AACI,IAAgB,KAAK,mBAAmB,CAAa,EAGzD,KAAK,eACD,EACA,EAAkB,EAAgB,QAAQ,EAAI,EAC9C,EAAkB,EAAgB,OAAO,EAAI,EAC7C,EAAgB,EAAc,MAAQ,EACtC,EAAgB,EAAc,OAAS,EACvC,KAAK,KACT,CACJ,CACJ,EAEM,EAAc,EAAS,GAAG"}
1
+ {"version":3,"file":"Fit-E-EIZv1k.js","names":[],"sources":["../../src/typescript/lib/layout/Fit.ts"],"sourcesContent":["// SPDX-License-Identifier: PolyForm-Noncommercial-1.0.0\n\nimport { LayoutManager, LayoutManagerOptions } from \"~/layout/LayoutManager.js\";\nimport { Size } from \"~/primitive/Size.js\";\nimport { FillType } from \"~/layout/FillType.js\";\nimport { Component } from \"~/core/Component.js\";\nimport { callable } from \"~/core/Callable.js\";\n\n/**\n * Construction-time options for {@link Fit}.\n *\n * @category Layouts\n */\nexport interface FitOptions extends LayoutManagerOptions {\n fill?: FillType;\n}\n\n/**\n * A layout manager that expects exactly one child component and positions it\n * inside the container's entire inner bounds. The default fill mode is\n * `FillType.BOTH` — the child stretches to fill the bounds. Pass\n * `fill: FillType.NONE` (or call {@link Fit.setFill}) to centre the child at\n * its preferred size instead; `HORIZONTAL` / `VERTICAL` stretch on one axis\n * and centre on the other. Throws if the container holds more than one\n * component.\n *\n * @category Layouts\n */\nclass Fit extends LayoutManager {\n\n private _fill: FillType = FillType.BOTH;\n\n constructor(options?: FitOptions) {\n // LayoutManager's constructor takes no options; applied via applyOptions below.\n // eslint-disable-next-line local/forward-super-options\n super();\n\n if (options) {\n this.applyOptions(options);\n }\n }\n\n /**\n * Applies a {@link FitOptions} bag, dispatching the fill mode after the\n * inherited LayoutManager defaults.\n *\n * @param options - The options bag carrying the values to apply.\n */\n protected applyOptions(options: FitOptions): void {\n super.applyOptions(options);\n\n if (options.fill !== undefined) {\n this.setFill(options.fill);\n }\n }\n\n /**\n * Returns the fill mode applied to the single child.\n *\n * @returns The current [`FillType`](/api/layout/enumerations/FillType).\n */\n getFill(): FillType {\n return this._fill;\n }\n\n /**\n * Sets the fill mode applied to the single child.\n *\n * @param fill - `BOTH` stretches the child to fill (default), `NONE`\n * centres it at its preferred size, `HORIZONTAL` / `VERTICAL` stretch on\n * one axis and centre on the other.\n *\n * @returns This layout manager, for method chaining.\n */\n setFill(fill: FillType): this {\n this._fill = fill;\n\n return this;\n }\n\n /**\n * Returns the preferred size of the single child component plus the container perimeter.\n *\n * @returns The preferred `{width, height}`, or `null` if there is no container or no displayed child.\n */\n getPreferredSize(): Size | null {\n return this.computeSize(component => component.getPreferredSize());\n }\n\n /**\n * Returns the minimum size of the single child component plus the container perimeter.\n *\n * @returns The minimum `{width, height}`, or `null` if there is no container or no displayed child.\n */\n getMinSize(): Size | null {\n return this.computeSize(component => component.getMinSize());\n }\n\n /**\n * Returns the maximum size of the single child component plus the container perimeter.\n *\n * @returns The maximum `{width, height}`, or `null` if there is no container or no displayed child.\n */\n getMaxSize(): Size | null {\n return this.computeSize(component => component.getMaxSize());\n }\n\n /**\n * Shared core of {@link getPreferredSize} / {@link getMinSize} /\n * {@link getMaxSize}: adds the displayed child's size (selected by `sizeOf`)\n * to the container perimeter.\n *\n * @param sizeOf - Selects the child's preferred, minimum, or maximum size.\n * @returns The composed `{width, height}`, or `null` if there is no\n * container, no displayed child, or the child reports no size.\n */\n private computeSize(sizeOf: (component: Component) => Size | null): Size | null {\n const container = this.getContainer();\n if (!container) {\n return null;\n }\n\n const perimeterSize = container.getPerimeterSize();\n\n const outerWidth = perimeterSize.left + perimeterSize.right;\n const outerHeight = perimeterSize.top + perimeterSize.bottom;\n\n // Size the displayed child only: a hidden sole child contributes no\n // size, so the Fit container reports none and its own parent reserves\n // nothing for it (honouring `displayed`, matching doLayout below).\n const component = container.getLaidOutComponents()[0] ?? null;\n if (!component) {\n return null;\n }\n\n const size = sizeOf(component);\n if (!size) {\n return null;\n }\n\n return {\n width: size.width + outerWidth,\n height: size.height + outerHeight\n };\n }\n\n /**\n * Returns the single child component of the container, or `undefined` if the container is empty.\n *\n * @returns The child component, or `undefined`.\n *\n * @remarks Throws if the container holds more than one component.\n */\n getComponent() {\n let container = this.getContainer();\n if (!container) {\n return null;\n }\n\n let components = container.getComponents();\n\n if (components.length > 1) {\n throw new Error(\"Container contains more than one component.\");\n }\n\n let component;\n\n if (components.length == 1) {\n component = components[0];\n }\n\n return component;\n }\n\n /**\n * Computes the children's combined minSize along this manager's geometry:\n * the single child's minSize. Used by `doLayout` to inflate the working\n * size when the host has opted into `setOverflowing`.\n *\n * @returns The single child's min-size; `{ width: 0, height: 0 }` when\n * the container is absent or empty.\n */\n protected computeTotalMinSize(): Size {\n const container = this.getContainer();\n if (!container) {\n return { width: 0, height: 0 };\n }\n\n const component = container.getLaidOutComponents()[0];\n if (!component) {\n return { width: 0, height: 0 };\n }\n\n const min = component.getMinSize();\n\n return min ?? { width: 0, height: 0 };\n }\n\n /**\n * Places the single child component inside the container's inner bounds\n * using the configured fill mode.\n *\n * @remarks Throws if the container holds more than one component. With\n * the default `FillType.BOTH` the child is sized to the full bounds;\n * with `FillType.NONE` it is placed at its preferred size and centred\n * via the inherited anchor-displacement logic in `placeComponent`.\n */\n doLayout() {\n let container = this.getContainer();\n if (!container) {\n return;\n }\n\n // Honour `displayed`: a hidden sole child contributes nothing and a\n // hidden first-of-two is skipped, so the visible child still fits.\n let components = container.getLaidOutComponents();\n\n if (components.length > 1) {\n throw new Error(\"Container contains more than one component.\");\n }\n\n let component;\n\n if (components.length == 1) {\n component = components[0];\n }\n\n if (!component) {\n return;\n }\n\n let containerSize = container.getInnerSize();\n let containerInsets = container.getContentInsets();\n\n // Universal scroll: see HBox.doLayout for the rationale. When the\n // host has marked the corresponding axis as overflowing, grow the\n // working size past the host's inner rect to the child's minSize so\n // the host's CSS `overflow: auto` produces a scrollbar.\n if (containerSize) {\n containerSize = this.inflateForOverflow(containerSize);\n }\n\n this.placeComponent(\n component,\n containerInsets ? containerInsets.getLeft() : 0,\n containerInsets ? containerInsets.getTop() : 0,\n containerSize ? containerSize.width : 0,\n containerSize ? containerSize.height : 0,\n this._fill\n );\n }\n}\n\nconst FitCallable = callable(Fit);\ntype FitCallable = Fit;\nexport {\n Fit as _Fit,\n FitCallable as Fit\n};\n"],"mappings":"0DA4BA,IAAM,IAAN,cAAkB,CAAc,CAE5B,MAA0B,EAAS,KAEnC,YAAY,EAAsB,CAG9B,MAAM,EAEF,GACA,KAAK,aAAa,CAAO,CAEjC,CAQA,aAAuB,EAA2B,CAC9C,MAAM,aAAa,CAAO,EAEtB,EAAQ,OAAS,IAAA,IACjB,KAAK,QAAQ,EAAQ,IAAI,CAEjC,CAOA,SAAoB,CAChB,OAAO,KAAK,KAChB,CAWA,QAAQ,EAAsB,CAG1B,MAFA,MAAK,MAAQ,EAEN,IACX,CAOA,kBAAgC,CAC5B,OAAO,KAAK,YAAY,GAAa,EAAU,iBAAiB,CAAC,CACrE,CAOA,YAA0B,CACtB,OAAO,KAAK,YAAY,GAAa,EAAU,WAAW,CAAC,CAC/D,CAOA,YAA0B,CACtB,OAAO,KAAK,YAAY,GAAa,EAAU,WAAW,CAAC,CAC/D,CAWA,YAAoB,EAA4D,CAC5E,IAAM,EAAY,KAAK,aAAa,EACpC,GAAI,CAAC,EACD,OAAO,KAGX,IAAM,EAAgB,EAAU,iBAAiB,EAE3C,EAAa,EAAc,KAAO,EAAc,MAChD,EAAc,EAAc,IAAM,EAAc,OAKhD,EAAY,EAAU,qBAAqB,CAAC,CAAC,IAAM,KACzD,GAAI,CAAC,EACD,OAAO,KAGX,IAAM,EAAO,EAAO,CAAS,EAK7B,OAJK,EAIE,CACH,MAAO,EAAK,MAAQ,EACpB,OAAQ,EAAK,OAAS,CAC1B,EANW,IAOf,CASA,cAAe,CACX,IAAI,EAAY,KAAK,aAAa,EAClC,GAAI,CAAC,EACD,OAAO,KAGX,IAAI,EAAa,EAAU,cAAc,EAEzC,GAAI,EAAW,OAAS,EACpB,MAAU,MAAM,6CAA6C,EAGjE,IAAI,EAMJ,OAJI,EAAW,QAAU,IACrB,EAAY,EAAW,IAGpB,CACX,CAUA,qBAAsC,CAClC,IAAM,EAAY,KAAK,aAAa,EACpC,GAAI,CAAC,EACD,MAAO,CAAE,MAAO,EAAG,OAAQ,CAAE,EAGjC,IAAM,EAAY,EAAU,qBAAqB,CAAC,CAAC,GAOnD,OANK,EAIO,EAAU,WAEf,GAAO,CAAE,MAAO,EAAG,OAAQ,CAAE,EALzB,CAAE,MAAO,EAAG,OAAQ,CAAE,CAMrC,CAWA,UAAW,CACP,IAAI,EAAY,KAAK,aAAa,EAClC,GAAI,CAAC,EACD,OAKJ,IAAI,EAAa,EAAU,qBAAqB,EAEhD,GAAI,EAAW,OAAS,EACpB,MAAU,MAAM,6CAA6C,EAGjE,IAAI,EAMJ,GAJI,EAAW,QAAU,IACrB,EAAY,EAAW,IAGvB,CAAC,EACD,OAGJ,IAAI,EAAgB,EAAU,aAAa,EACvC,EAAkB,EAAU,iBAAiB,EAMjD,AACI,IAAgB,KAAK,mBAAmB,CAAa,EAGzD,KAAK,eACD,EACA,EAAkB,EAAgB,QAAQ,EAAI,EAC9C,EAAkB,EAAgB,OAAO,EAAI,EAC7C,EAAgB,EAAc,MAAQ,EACtC,EAAgB,EAAc,OAAS,EACvC,KAAK,KACT,CACJ,CACJ,EAEM,EAAc,EAAS,GAAG"}
@@ -1,2 +1,2 @@
1
- import{t as e}from"./DOM-CGn7xyTw.js";import{_ as t,f as n,h as r,t as i}from"./Component-DXf5a3g0.js";var a=new Map;a.set(`unicode-arrow-up`,{kind:`char`,char:`▲`}),a.set(`unicode-arrow-down`,{kind:`char`,char:`▼`}),a.set(`unicode-arrow-left`,{kind:`char`,char:`◀`}),a.set(`unicode-arrow-right`,{kind:`char`,char:`▶`});var o=`http://www.w3.org/2000/svg`,s=`ts-glyph-`,c=!1,l=null;function registerGlyph(e){a.set(e.name,e),e.kind===`svg`&&c&&_addSymbolToSprite(e.name,e)}function unregisterGlyph(e){let t=a.get(e);a.delete(e),t&&t.kind===`svg`&&c&&_removeSymbolFromSprite(e)}function lookupGlyph(e){return a.get(e)}function ensureGlyphSprite(){if(c)return;let t=e.sink.createElementNS(o,`svg`);e.sink.apply(t,{setAttr:{"aria-hidden":`true`,focusable:`false`},style:{position:`absolute`,width:`0`,height:`0`,overflow:`hidden`}}),e.sink.appendChild(e.source.getBody(),t),l=t,c=!0}function ensureGlyphSymbolMounted(e){if(!c)return;let t=a.get(e);t&&t.kind===`svg`&&_addSymbolToSprite(e,t)}function _addSymbolToSprite(t,n){if(!l||n.kind!==`svg`)return;let r=s+t;if(e.source.querySelector(l,`#${e.source.escapeSelector(r)}`))return;let i=e.sink.createElementNS(o,`symbol`);e.sink.apply(i,{setAttr:{id:r,viewBox:n.viewBox}});let a=e.sink.createElementNS(o,`path`);e.sink.apply(a,{setAttr:{d:n.path}}),e.sink.appendChild(i,a),e.sink.appendChild(l,i)}function _removeSymbolFromSprite(t){if(!l)return;let n=s+t,r=e.source.querySelector(l,`#${e.source.escapeSelector(n)}`);if(r){let t=e.source.querySelector(r,`path`);e.sink.removeChild(l,r),e.sink.release(r),t&&e.sink.release(t)}}var u=`ts-ui-glyph-`,d=new Set,f=!1;function ensureGlyphKeyframes(){f||(f=!0,t.ensureKeyframes(`ts-ui-glyph-spin`,`from { transform: rotate(0deg); } to { transform: rotate(360deg); }`),t.ensureKeyframes(`ts-ui-glyph-pulse`,`0%, 12.5% { transform: rotate(0deg); } 12.5%, 25% { transform: rotate(45deg); } 25%, 37.5% { transform: rotate(90deg); } 37.5%, 50% { transform: rotate(135deg); } 50%, 62.5% { transform: rotate(180deg); } 62.5%, 75% { transform: rotate(225deg); } 75%, 87.5% { transform: rotate(270deg); } 87.5%, 100% { transform: rotate(315deg); }`),t.ensureKeyframes(`ts-ui-glyph-beat`,`0%, 90% { transform: scale(1); } 45% { transform: scale(1.25); }`),new t({scope:`class`,name:`ts-ui-glyph-spin`,styles:{animation:`ts-ui-glyph-spin var(--ts-ui-glyph-spin-duration, 2000ms) linear infinite`}}),new t({scope:`class`,name:`ts-ui-glyph-pulse`,styles:{animation:`ts-ui-glyph-pulse var(--ts-ui-glyph-pulse-duration, 1000ms) steps(8) infinite`}}),new t({scope:`class`,name:`ts-ui-glyph-beat`,styles:{animation:`ts-ui-glyph-beat var(--ts-ui-glyph-beat-duration, 1000ms) ease-in-out infinite`}}))}function _onReducedMotionChange(){for(let e of Array.from(d)){let t=e.deref();if(!t){d.delete(e);continue}t._syncReducedMotion()}}e.source.matchMedia(`(prefers-reduced-motion: reduce)`).addChangeListener(_onReducedMotionChange);var p={preferredSize:{width:16,height:16}},Glyph=class extends i{_name;_def;static register(...e){for(let t of e)registerGlyph(t)}static unregister(e){unregisterGlyph(e)}constructor(e,t){let n=lookupGlyph(e);if(!n)throw Error(`Unknown glyph: `+e);super(t,{...p,tag:n.kind===`svg`?`svg`:`span`}),this._name=e,this._def=n,n.kind===`char`&&(this._options.lineHeight===void 0&&this.setLineHeight(`1`),this._options.textAlign===void 0&&this.setTextAlign(`center`))}setPreferredSize(e){return super.setPreferredSize(e),super.setMinSize(e),super.setMaxSize(e),this}getBaseline(){let e=this.getPreferredSize();return e?e.height-3:null}getGlyphName(){return this._name}getFontSize(){return this._options.fontSize??null}setFontSize(e){return this._options.fontSize=e,this.setElementCSSRule(`fontSize`,e+`px`),this}getLineHeight(){let e=this._options.lineHeight;return e===void 0?null:typeof e==`number`?e+`px`:e}setLineHeight(e){return this._options.lineHeight=e,this.setElementCSSRule(`lineHeight`,typeof e==`number`?e+`px`:e),this}getTextAlign(){return this._options.textAlign??null}setTextAlign(e){return this._options.textAlign=e,this.setElementCSSRule(`textAlign`,e),this}getAnimated(){return this._glyphAnimation}setAnimated(t){if(this._glyphAnimation===t)return this;let n=this._glyphAnimation;this._glyphAnimation=t;let i=this.getElement();return i&&n&&e.sink.apply(i,{removeClass:[u+n]}),t===null?(this.setElementStyle(`animationDuration`,null),this.setWillChange(null),this._animatedRef&&=(d.delete(this._animatedRef),null),this):(ensureGlyphKeyframes(),this._animatedRef||(this._animatedRef=new WeakRef(this),d.add(this._animatedRef)),r.isReducedMotion()||(i&&e.sink.apply(i,{addClass:[u+t]}),this.setWillChange(`transform`)),this._glyphAnimationDuration>0&&this.setElementStyle(`animationDuration`,this._glyphAnimationDuration+`ms`),this)}clearAnimated(){return this.setAnimated(null)}getAnimationDuration(){return this._glyphAnimationDuration}setAnimationDuration(e){return this._glyphAnimationDuration=e,this._glyphAnimation!==null&&!r.isReducedMotion()&&this.setElementStyle(`animationDuration`,e>0?e+`ms`:null),this}_syncReducedMotion(){let t=this._glyphAnimation;if(!t)return;let n=this.getElement(!0),i=u+t;r.isReducedMotion()?(e.sink.apply(n,{removeClass:[i]}),this.setWillChange(null),this.setElementStyle(`animationDuration`,null)):(e.sink.apply(n,{addClass:[i]}),this.setWillChange(`transform`),this._glyphAnimationDuration>0&&this.setElementStyle(`animationDuration`,this._glyphAnimationDuration+`ms`))}applyOptions(e){super.applyOptions(e),e.fontSize!==void 0&&this.setFontSize(e.fontSize),e.lineHeight!==void 0&&this.setLineHeight(e.lineHeight),e.textAlign!==void 0&&this.setTextAlign(e.textAlign),e.animationDuration!==void 0&&this.setAnimationDuration(e.animationDuration);let t=this.getPreferredSizeConstraint();return t&&(e.minSize===void 0&&this.setMinSize({width:t.width,height:t.height}),e.maxSize===void 0&&this.setMaxSize({width:t.width,height:t.height})),e.animation!==void 0&&this.setAnimated(e.animation),this}createRootElement(){if(this._def.kind===`svg`){ensureGlyphSprite(),ensureGlyphSymbolMounted(this._name);let t=`http://www.w3.org/2000/svg`,n=e.sink.createElementNS(t,`svg`);e.sink.apply(n,{setAttr:{fill:`currentColor`,"aria-hidden":`true`,focusable:`false`}});let r=e.sink.createElementNS(t,`use`);return e.sink.apply(r,{setAttr:{href:`#`+s+this._name}}),e.sink.appendChild(n,r),this.trackHandle(r),n}return super.createRootElement()}render(){let t=super.render();this._def.kind===`char`&&e.sink.apply(t,{text:this._def.char}),this._glyphAnimation&&!r.isReducedMotion()&&e.sink.apply(t,{addClass:[u+this._glyphAnimation]});let n=this._options.preferredSize;return n&&(this.setElementStyle(`width`,n.width+`px`),this.setElementStyle(`height`,n.height+`px`)),t}},m=n(Glyph);export{m as t};
2
- //# sourceMappingURL=Glyph-KEf4nIv2.js.map
1
+ import{t as e}from"./DOM-BeR95tE8.js";import{_ as t,m as n,t as r,y as i}from"./Component-CHTzJxEf.js";var a=new Map;a.set(`unicode-arrow-up`,{kind:`char`,char:`▲`}),a.set(`unicode-arrow-down`,{kind:`char`,char:`▼`}),a.set(`unicode-arrow-left`,{kind:`char`,char:`◀`}),a.set(`unicode-arrow-right`,{kind:`char`,char:`▶`});var o=`http://www.w3.org/2000/svg`,s=`ts-glyph-`,c=!1,l=null;function registerGlyph(e){a.set(e.name,e),e.kind===`svg`&&c&&_addSymbolToSprite(e.name,e)}function unregisterGlyph(e){let t=a.get(e);a.delete(e),t&&t.kind===`svg`&&c&&_removeSymbolFromSprite(e)}function lookupGlyph(e){return a.get(e)}function ensureGlyphSprite(){if(c)return;let t=e.sink.createElementNS(o,`svg`);e.sink.apply(t,{setAttr:{"aria-hidden":`true`,focusable:`false`},style:{position:`absolute`,width:`0`,height:`0`,overflow:`hidden`}}),e.sink.appendChild(e.source.getBody(),t),l=t,c=!0}function ensureGlyphSymbolMounted(e){if(!c)return;let t=a.get(e);t&&t.kind===`svg`&&_addSymbolToSprite(e,t)}function _addSymbolToSprite(t,n){if(!l||n.kind!==`svg`)return;let r=s+t;if(e.source.querySelector(l,`#${e.source.escapeSelector(r)}`))return;let i=e.sink.createElementNS(o,`symbol`);e.sink.apply(i,{setAttr:{id:r,viewBox:n.viewBox}});let a=e.sink.createElementNS(o,`path`);e.sink.apply(a,{setAttr:{d:n.path}}),e.sink.appendChild(i,a),e.sink.appendChild(l,i)}function _removeSymbolFromSprite(t){if(!l)return;let n=s+t,r=e.source.querySelector(l,`#${e.source.escapeSelector(n)}`);if(r){let t=e.source.querySelector(r,`path`);e.sink.removeChild(l,r),e.sink.release(r),t&&e.sink.release(t)}}var u=`ts-ui-glyph-`,d=new Set,f=!1;function ensureGlyphKeyframes(){f||(f=!0,i.ensureKeyframes(`ts-ui-glyph-spin`,`from { transform: rotate(0deg); } to { transform: rotate(360deg); }`),i.ensureKeyframes(`ts-ui-glyph-pulse`,`0%, 12.5% { transform: rotate(0deg); } 12.5%, 25% { transform: rotate(45deg); } 25%, 37.5% { transform: rotate(90deg); } 37.5%, 50% { transform: rotate(135deg); } 50%, 62.5% { transform: rotate(180deg); } 62.5%, 75% { transform: rotate(225deg); } 75%, 87.5% { transform: rotate(270deg); } 87.5%, 100% { transform: rotate(315deg); }`),i.ensureKeyframes(`ts-ui-glyph-beat`,`0%, 90% { transform: scale(1); } 45% { transform: scale(1.25); }`),new i({scope:`class`,name:`ts-ui-glyph-spin`,styles:{animation:`ts-ui-glyph-spin var(--ts-ui-glyph-spin-duration, 2000ms) linear infinite`}}),new i({scope:`class`,name:`ts-ui-glyph-pulse`,styles:{animation:`ts-ui-glyph-pulse var(--ts-ui-glyph-pulse-duration, 1000ms) steps(8) infinite`}}),new i({scope:`class`,name:`ts-ui-glyph-beat`,styles:{animation:`ts-ui-glyph-beat var(--ts-ui-glyph-beat-duration, 1000ms) ease-in-out infinite`}}))}function _onReducedMotionChange(){for(let e of Array.from(d)){let t=e.deref();if(!t){d.delete(e);continue}t._syncReducedMotion()}}e.source.matchMedia(`(prefers-reduced-motion: reduce)`).addChangeListener(_onReducedMotionChange);var p={preferredSize:{width:16,height:16}},Glyph=class extends r{_name;_def;static register(...e){for(let t of e)registerGlyph(t)}static unregister(e){unregisterGlyph(e)}constructor(e,t){let n=lookupGlyph(e);if(!n)throw Error(`Unknown glyph: `+e);super(t,{...p,tag:n.kind===`svg`?`svg`:`span`}),this._name=e,this._def=n,n.kind===`char`&&(this._options.lineHeight===void 0&&this.setLineHeight(`1`),this._options.textAlign===void 0&&this.setTextAlign(`center`))}setPreferredSize(e){return super.setPreferredSize(e),super.setMinSize(e),super.setMaxSize(e),this}getBaseline(){let e=this.getPreferredSize();return e?e.height-3:null}getGlyphName(){return this._name}getFontSize(){return this._options.fontSize??null}setFontSize(e){return this._options.fontSize=e,this.setElementCSSRule(`fontSize`,e+`px`),this}getLineHeight(){let e=this._options.lineHeight;return e===void 0?null:typeof e==`number`?e+`px`:e}setLineHeight(e){return this._options.lineHeight=e,this.setElementCSSRule(`lineHeight`,typeof e==`number`?e+`px`:e),this}getTextAlign(){return this._options.textAlign??null}setTextAlign(e){return this._options.textAlign=e,this.setElementCSSRule(`textAlign`,e),this}getAnimated(){return this._glyphAnimation}setAnimated(n){if(this._glyphAnimation===n)return this;let r=this._glyphAnimation;this._glyphAnimation=n;let i=this.getElement();return i&&r&&e.sink.apply(i,{removeClass:[u+r]}),n===null?(this.setElementStyle(`animationDuration`,null),this.setWillChange(null),this._animatedRef&&=(d.delete(this._animatedRef),null),this):(ensureGlyphKeyframes(),this._animatedRef||(this._animatedRef=new WeakRef(this),d.add(this._animatedRef)),t.isReducedMotion()||(i&&e.sink.apply(i,{addClass:[u+n]}),this.setWillChange(`transform`)),this._glyphAnimationDuration>0&&this.setElementStyle(`animationDuration`,this._glyphAnimationDuration+`ms`),this)}clearAnimated(){return this.setAnimated(null)}getAnimationDuration(){return this._glyphAnimationDuration}setAnimationDuration(e){return this._glyphAnimationDuration=e,this._glyphAnimation!==null&&!t.isReducedMotion()&&this.setElementStyle(`animationDuration`,e>0?e+`ms`:null),this}_syncReducedMotion(){let n=this._glyphAnimation;if(!n)return;let r=this.getElement(!0),i=u+n;t.isReducedMotion()?(e.sink.apply(r,{removeClass:[i]}),this.setWillChange(null),this.setElementStyle(`animationDuration`,null)):(e.sink.apply(r,{addClass:[i]}),this.setWillChange(`transform`),this._glyphAnimationDuration>0&&this.setElementStyle(`animationDuration`,this._glyphAnimationDuration+`ms`))}applyOptions(e){super.applyOptions(e),e.fontSize!==void 0&&this.setFontSize(e.fontSize),e.lineHeight!==void 0&&this.setLineHeight(e.lineHeight),e.textAlign!==void 0&&this.setTextAlign(e.textAlign),e.animationDuration!==void 0&&this.setAnimationDuration(e.animationDuration);let t=this.getPreferredSizeConstraint();return t&&(e.minSize===void 0&&this.setMinSize({width:t.width,height:t.height}),e.maxSize===void 0&&this.setMaxSize({width:t.width,height:t.height})),e.animation!==void 0&&this.setAnimated(e.animation),this}createRootElement(){if(this._def.kind===`svg`){ensureGlyphSprite(),ensureGlyphSymbolMounted(this._name);let t=`http://www.w3.org/2000/svg`,n=e.sink.createElementNS(t,`svg`);e.sink.apply(n,{setAttr:{fill:`currentColor`,"aria-hidden":`true`,focusable:`false`}});let r=e.sink.createElementNS(t,`use`);return e.sink.apply(r,{setAttr:{href:`#`+s+this._name}}),e.sink.appendChild(n,r),this.trackHandle(r),n}return super.createRootElement()}render(){let n=super.render();this._def.kind===`char`&&e.sink.apply(n,{text:this._def.char}),this._glyphAnimation&&!t.isReducedMotion()&&e.sink.apply(n,{addClass:[u+this._glyphAnimation]});let r=this._options.preferredSize;return r&&(this.setElementStyle(`width`,r.width+`px`),this.setElementStyle(`height`,r.height+`px`)),n}},m=n(Glyph);export{m as t};
2
+ //# sourceMappingURL=Glyph-CnNslL95.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Glyph-KEf4nIv2.js","names":[],"sources":["../../src/typescript/lib/component/display/Glyphs.ts","../../src/typescript/lib/component/display/Glyph.ts"],"sourcesContent":["// SPDX-License-Identifier: PolyForm-Noncommercial-1.0.0\n\nimport { DOM } from \"~/core/DOM.js\";\nimport type { Handle } from \"~/core/DOM.js\";\n\n/**\n * Tagged union describing how a glyph is rendered.\n *\n * @remarks\n * - `kind: \"svg\"` entries supply a `viewBox` and an SVG `<path>` `d` attribute.\n * The path data is mounted once into a shared hidden `<svg>` sprite and each\n * Glyph instance references it via `<svg><use href=\"#...\"/></svg>` so the\n * path string is not duplicated in the DOM.\n * - `kind: \"char\"` entries carry a single Unicode character rendered inside a\n * `<span>`; the character follows the inherited text colour.\n */\nexport type GlyphDef =\n | { kind: \"svg\", viewBox: string; path: string }\n | { kind: \"char\", char: string };\n\n/**\n * A {@link GlyphDef} carrying its own registry name. Glyph modules generated\n * from third-party icon sets export values of this shape so they can be\n * registered in a single call to `Glyph.register(...)`.\n */\nexport type NamedGlyphDef = GlyphDef & { name: string };\n\n/**\n * Mutable registry of named glyphs, populated via `registerGlyph` /\n * `Glyph.register`. Starts empty — consumers register the glyphs they need.\n *\n * @internal\n */\nconst _glyphs: Map<string, GlyphDef> = new Map();\n\n// Built-in Unicode-triangle glyphs registered eagerly. Prefixed `unicode-` so\n// user code can register its own `arrow-up` / `arrow-down` SVG glyphs without\n// overwriting these — built-in chrome like Scrollbar's end-cap buttons\n// references the prefixed names directly and stays immune to user overrides.\n// Char-mode entries are tiny (no sprite, no path data) so the always-on cost\n// is negligible; the triangles inherit the surrounding text colour via\n// `currentColor`, so a single foreground-colour write themes them.\n_glyphs.set(\"unicode-arrow-up\", { kind: \"char\", char: \"▲\" });\n_glyphs.set(\"unicode-arrow-down\", { kind: \"char\", char: \"▼\" });\n_glyphs.set(\"unicode-arrow-left\", { kind: \"char\", char: \"◀\" });\n_glyphs.set(\"unicode-arrow-right\", { kind: \"char\", char: \"▶\" });\n\nconst SVG_NS = \"http://www.w3.org/2000/svg\";\n\n/**\n * Prefix applied to every `<symbol>` id inside the sprite. A consumer-supplied\n * registry name `\"xmark\"` becomes the id `\"ts-glyph-xmark\"`, which is what\n * `<use href=\"#ts-glyph-xmark\"/>` references.\n */\nexport const GLYPH_SYMBOL_ID_PREFIX = \"ts-glyph-\";\n\nlet _spriteMounted: boolean = false;\nlet _spriteElement: Handle | null = null;\n\n/**\n * Registers a glyph by name. If the glyph is SVG-mode and the sprite is\n * already mounted, the corresponding `<symbol>` is appended immediately so\n * Glyphs constructed after this call can reference it.\n *\n * @internal\n */\nexport function registerGlyph(def: NamedGlyphDef): void {\n _glyphs.set(def.name, def);\n\n if (def.kind === \"svg\" && _spriteMounted) {\n _addSymbolToSprite(def.name, def);\n }\n}\n\n/**\n * Removes a glyph from the registry by name. If the glyph was SVG-mode and\n * the sprite is mounted, its `<symbol>` is removed from the DOM as well.\n *\n * @internal\n */\nexport function unregisterGlyph(name: string): void {\n const def = _glyphs.get(name);\n _glyphs.delete(name);\n\n if (def && def.kind === \"svg\" && _spriteMounted) {\n _removeSymbolFromSprite(name);\n }\n}\n\n/**\n * Looks up a glyph definition by registry name.\n *\n * @returns The registered {@link GlyphDef}, or `undefined` if not registered.\n *\n * @internal\n */\nexport function lookupGlyph(name: string): GlyphDef | undefined {\n return _glyphs.get(name);\n}\n\n/**\n * Ensures the document carries a single hidden `<svg>` sprite that hosts the\n * `<symbol>` elements for every SVG-mode glyph. Idempotent — subsequent calls\n * are no-ops. The sprite starts empty; entries are appended incrementally\n * either by {@link registerGlyph} (after the sprite is mounted) or by\n * {@link ensureGlyphSymbolMounted} (when a Glyph instance is constructed).\n *\n * @internal\n */\nexport function ensureGlyphSprite(): void {\n if (_spriteMounted) {\n return;\n }\n\n const sprite = DOM.sink.createElementNS(SVG_NS, \"svg\");\n // `sprite` is a raw off-screen SVG element mounted directly on document.body,\n // not a Component, so the Component style setters don't apply here.\n DOM.sink.apply(sprite, {\n setAttr: { \"aria-hidden\": \"true\", focusable: \"false\" },\n style: { position: \"absolute\", width: \"0\", height: \"0\", overflow: \"hidden\" },\n });\n\n DOM.sink.appendChild(DOM.source.getBody(), sprite);\n\n _spriteElement = sprite;\n _spriteMounted = true;\n}\n\n/**\n * Ensures the sprite carries a `<symbol>` for the named SVG-mode glyph,\n * appending it on demand for glyphs registered before the sprite was mounted.\n * Idempotent.\n *\n * @internal\n */\nexport function ensureGlyphSymbolMounted(name: string): void {\n if (!_spriteMounted) {\n return;\n }\n\n const def = _glyphs.get(name);\n if (def && def.kind === \"svg\") {\n _addSymbolToSprite(name, def);\n }\n}\n\n/**\n * Appends a `<symbol>` for the given SVG-mode glyph to the sprite. Idempotent:\n * a no-op when a `<symbol>` with the same id already exists.\n *\n * @internal\n */\nfunction _addSymbolToSprite(name: string, def: GlyphDef): void {\n if (!_spriteElement || def.kind !== \"svg\") {\n return;\n }\n\n const id = GLYPH_SYMBOL_ID_PREFIX + name;\n if (DOM.source.querySelector(_spriteElement, `#${DOM.source.escapeSelector(id)}`)) {\n return;\n }\n\n const symbol = DOM.sink.createElementNS(SVG_NS, \"symbol\");\n DOM.sink.apply(symbol, { setAttr: { id: id, viewBox: def.viewBox } });\n\n const path = DOM.sink.createElementNS(SVG_NS, \"path\");\n DOM.sink.apply(path, { setAttr: { d: def.path } });\n DOM.sink.appendChild(symbol, path);\n\n DOM.sink.appendChild(_spriteElement, symbol);\n}\n\n/**\n * Removes the `<symbol>` for the given glyph name from the sprite, if present.\n *\n * @internal\n */\nfunction _removeSymbolFromSprite(name: string): void {\n if (!_spriteElement) {\n return;\n }\n\n const id = GLYPH_SYMBOL_ID_PREFIX + name;\n const symbol = DOM.source.querySelector(_spriteElement, `#${DOM.source.escapeSelector(id)}`);\n if (symbol) {\n // Release the symbol's retained `<path>` child too — releasing only the\n // symbol would pin the detached path handle in the registry. Queried\n // before removal so it resolves to its canonical retained handle.\n const path = DOM.source.querySelector(symbol, \"path\");\n\n DOM.sink.removeChild(_spriteElement, symbol);\n DOM.sink.release(symbol);\n\n if (path) {\n DOM.sink.release(path);\n }\n }\n}\n","// SPDX-License-Identifier: PolyForm-Noncommercial-1.0.0\n\nimport { Animation } from \"~/core/Animation.js\";\nimport { Component, ComponentOptions } from \"~/core/Component.js\";\nimport { DOM } from \"~/core/DOM.js\";\nimport type { Handle } from \"~/core/DOM.js\";\nimport { StyleRule } from \"~/core/StyleTarget.js\";\nimport { callable } from \"~/core/Callable.js\";\nimport { Size } from \"~/primitive/Size.js\";\nimport {\n ensureGlyphSprite,\n ensureGlyphSymbolMounted,\n GLYPH_SYMBOL_ID_PREFIX,\n GlyphDef,\n lookupGlyph,\n NamedGlyphDef,\n registerGlyph,\n unregisterGlyph,\n} from \"~/component/display/Glyphs.js\";\n\n/**\n * Named animation kinds supported by {@link Glyph.setAnimated}.\n *\n * - `spin` — continuous 360 degree rotate. Loading and refresh affordances.\n * - `pulse` — 8-step rotate. Mechanical, faux-loading tick.\n * - `beat` — transform-scale pulse. Notification dots and attention nudges.\n *\n * Mirrors FontAwesome's `fa-spin` / `fa-pulse` / `fa-beat` vocabulary.\n *\n * @category Components\n */\nexport type GlyphAnimation = \"spin\" | \"pulse\" | \"beat\";\n\n/**\n * CSS class prefix shared by all three animation rules. The full class name\n * is `ts-ui-glyph-<kind>` (e.g. `ts-ui-glyph-spin`).\n */\nconst CLASS_PREFIX = \"ts-ui-glyph-\";\n\n/**\n * Registry of `WeakRef<Glyph>` for currently-animated instances. A single\n * module-level `matchMedia` listener walks this set on OS preference changes\n * and re-applies the class to match. `WeakRef` lets the GC collect unrooted\n * glyphs without an explicit deregister-on-disposal step.\n */\nconst _animatedRefs: Set<WeakRef<Glyph>> = new Set();\n\nlet _keyframesInjected = false;\n\n/**\n * Injects the three `@keyframes` blocks and matching class rules on first\n * use. Idempotent — guarded by the module-level `_keyframesInjected` flag.\n */\nfunction ensureGlyphKeyframes(): void {\n if (_keyframesInjected) {\n return;\n }\n\n _keyframesInjected = true;\n\n StyleRule.ensureKeyframes(\"ts-ui-glyph-spin\",\n \"from { transform: rotate(0deg); } to { transform: rotate(360deg); }\");\n\n StyleRule.ensureKeyframes(\"ts-ui-glyph-pulse\",\n \"0%, 12.5% { transform: rotate(0deg); } \" +\n \"12.5%, 25% { transform: rotate(45deg); } \" +\n \"25%, 37.5% { transform: rotate(90deg); } \" +\n \"37.5%, 50% { transform: rotate(135deg); } \" +\n \"50%, 62.5% { transform: rotate(180deg); } \" +\n \"62.5%, 75% { transform: rotate(225deg); } \" +\n \"75%, 87.5% { transform: rotate(270deg); } \" +\n \"87.5%, 100% { transform: rotate(315deg); }\");\n\n StyleRule.ensureKeyframes(\"ts-ui-glyph-beat\",\n \"0%, 90% { transform: scale(1); } 45% { transform: scale(1.25); }\");\n\n new StyleRule({\n scope: \"class\",\n name: CLASS_PREFIX + \"spin\",\n styles: {\n animation: \"ts-ui-glyph-spin var(--ts-ui-glyph-spin-duration, 2000ms) linear infinite\",\n },\n });\n\n new StyleRule({\n scope: \"class\",\n name: CLASS_PREFIX + \"pulse\",\n styles: {\n animation: \"ts-ui-glyph-pulse var(--ts-ui-glyph-pulse-duration, 1000ms) steps(8) infinite\",\n },\n });\n\n new StyleRule({\n scope: \"class\",\n name: CLASS_PREFIX + \"beat\",\n styles: {\n animation: \"ts-ui-glyph-beat var(--ts-ui-glyph-beat-duration, 1000ms) ease-in-out infinite\",\n },\n });\n}\n\n/**\n * Module-level listener that re-evaluates every animated glyph when the OS\n * `prefers-reduced-motion` preference flips. Dead `WeakRef`s are pruned.\n */\nfunction _onReducedMotionChange(): void {\n for (const ref of Array.from(_animatedRefs)) {\n const glyph = ref.deref();\n if (!glyph) {\n _animatedRefs.delete(ref);\n continue;\n }\n\n glyph._syncReducedMotion();\n }\n}\n\n// The seam's `matchMedia` degrades to an inert result off-browser, so this\n// module-level registration needs no environment guard of its own.\nDOM.source.matchMedia(\"(prefers-reduced-motion: reduce)\").addChangeListener(_onReducedMotionChange);\n\n/**\n * Construction-time options for {@link Glyph}.\n *\n * @category Components\n */\nexport interface GlyphOptions extends ComponentOptions {\n\n /**\n * CSS `font-size` override in pixels. Only meaningful for char-mode\n * glyphs (SVG glyphs paint via `<use>` and ignore font-size). Useful when\n * the inherited font-size produces a line-box taller than the glyph's\n * element box and the Unicode character overflows or gets clipped.\n */\n fontSize?: number;\n\n /**\n * CSS `line-height` override. A number is interpreted as pixels (e.g.\n * `24` → `\"24px\"`); a string is used verbatim (e.g. `\"1\"` for the\n * unitless font-size multiplier used by char-mode glyphs).\n */\n lineHeight?: number | string;\n\n /**\n * CSS `text-align` keyword (e.g. `\"left\"`, `\"center\"`, `\"right\"`).\n * Char-mode glyphs default to `\"center\"`; SVG-mode glyphs leave this\n * unset.\n */\n textAlign?: string;\n\n /**\n * Optional animation kind to play on this glyph from construction.\n */\n animation?: GlyphAnimation;\n\n /**\n * Optional override (ms) for the active animation's duration. Wins over\n * the theme-token default while non-zero. Ignored when `animation` is\n * unset.\n */\n animationDuration?: number;\n}\n\n/**\n * User-overridable defaults forwarded to `super` via the options bag. The\n * cascade dispatches each present setter once with the final value. Only\n * defaults that apply unconditionally for every Glyph kind live here — the\n * char-only `lineHeight`/`textAlign` defaults stay in the constructor body\n * because they depend on the per-instance `def.kind`.\n */\nconst _defaultGlyphOptions: Partial<GlyphOptions> = {\n preferredSize: { width: 16, height: 16 } as GlyphOptions[\"preferredSize\"],\n};\n\n/**\n * A small icon rendered from the internal `Glyphs` registry.\n *\n * @remarks\n * Each registry entry is either an SVG or a single Unicode character. SVG\n * entries are rendered as `<svg><use href=\"#…\"/></svg>` against a hidden\n * sprite mounted once into `document.body`, so the path data lives in the\n * DOM exactly once regardless of how many Glyph instances reference it.\n * Unicode entries render as `<span>`. Both forms render with `currentColor`,\n * so a `Glyph` inherits the surrounding text colour for free. The underlying\n * root tag is decided once at construction from the entry's `kind` and\n * cannot be changed afterwards — to swap glyph, discard the instance and\n * create a new one.\n *\n * Pass any registry name to the constructor; unknown names throw at\n * construction. The default preferred size is 16×16.\n *\n * @example\n * ```typescript\n * import { xmark } from \"~/glyphs/solid/xmark.js\";\n * import { arrow_right } from \"~/glyphs/solid/arrow_right.js\";\n *\n * Glyph.register(xmark, arrow_right);\n *\n * panel.addComponent(new Glyph(\"xmark\"));\n * panel.addComponent(new Glyph(\"arrow-right\"));\n * ```\n *\n * @category Components\n */\nclass Glyph extends Component<GlyphOptions> {\n\n private _name: string;\n private _def: GlyphDef;\n declare private _glyphAnimation: GlyphAnimation | null;\n declare private _glyphAnimationDuration: number;\n declare private _animatedRef: WeakRef<Glyph> | null;\n\n /**\n * Registers one or more glyph definitions so they can be instantiated by\n * name. Pass the named exports from `~/glyphs/<style>/<name>.js` modules.\n *\n * @param defs - One or more {@link NamedGlyphDef} values to register.\n */\n static register(...defs: NamedGlyphDef[]): void {\n for (const def of defs) {\n registerGlyph(def);\n }\n }\n\n /**\n * Removes a previously registered glyph by name.\n *\n * @param name - Registry key to unregister.\n */\n static unregister(name: string): void {\n unregisterGlyph(name);\n }\n\n /**\n * Constructs a Glyph for the registry entry with the given name.\n *\n * @param name - Registry key. Must have been registered via {@link Glyph.register}.\n * @param options - Optional component options bag.\n */\n constructor(name: string, options?: GlyphOptions) {\n const def = lookupGlyph(name);\n if (!def) {\n throw new Error(\"Unknown glyph: \" + name);\n }\n\n // Hand defaults plus the per-instance tag (chosen from the registry\n // entry's `kind`) to Component via the subclass-defaults arg so they\n // land in `_defaultOptions`. Component's super-time cascade applies\n // them; user `options` win because `applyOptions` merges\n // `{...defaults, ...options}` at dispatch time.\n super(options, {\n ..._defaultGlyphOptions,\n tag: def.kind === \"svg\" ? \"svg\" : \"span\",\n });\n\n this._name = name;\n this._def = def;\n\n // Char-mode glyphs need a line-height and text-align that SVG glyphs\n // should not get. Keep these guards in the constructor body since they\n // depend on per-instance `def.kind` rather than a static default.\n if (def.kind === \"char\") {\n if (this._options.lineHeight === undefined) {\n this.setLineHeight(\"1\");\n }\n\n if (this._options.textAlign === undefined) {\n this.setTextAlign(\"center\");\n }\n }\n }\n\n /**\n * Sets the preferred size and pins minSize/maxSize to the same value so\n * the glyph stays rigid in flexible layouts — HBox's shrink-on-overflow\n * logic and any grow path see equal min/pref/max and leave the glyph at\n * its configured size. Callers can still override the lock by calling\n * `setMinSize` / `setMaxSize` explicitly after this method.\n *\n * @param size - The preferred size in pixels.\n *\n * @returns This component, for method chaining.\n */\n setPreferredSize(size: Size): this {\n super.setPreferredSize(size);\n super.setMinSize(size);\n super.setMaxSize(size);\n\n return this;\n }\n\n /**\n * Returns a baseline near the bottom edge so the glyph participates in\n * baseline alignment — sitting with its ink roughly on the surrounding text\n * baseline when placed next to labels — instead of being vertically centred\n * in the row. The anchor is 4px above the bottom edge (vs 2px on the\n * bar-shaped controls), which drops a square icon slightly lower so its ink\n * lands on the text baseline rather than floating above it.\n *\n * @returns The preferred height minus 4, or `null` before a size is set.\n */\n getBaseline(): number | null {\n const size = this.getPreferredSize();\n\n return size ? size.height - 3 : null;\n }\n\n /**\n * Returns the registry name this Glyph was constructed with. Named\n * `getGlyphName` rather than `getName` so it does not shadow\n * [`Component.getName`](/api/core/classes/Component#getname), whose\n * intrinsic `name` is a display label with a different meaning.\n *\n * @returns The registry key supplied to the constructor.\n */\n getGlyphName(): string {\n return this._name;\n }\n\n /**\n * Returns the explicit CSS `font-size` override (in pixels) written by\n * this Glyph, or `null` when no override has been written (the element\n * inherits the parent's font-size).\n *\n * @returns The cached font-size in pixels, or null.\n */\n getFontSize(): number | null {\n return this._options.fontSize ?? null;\n }\n\n /**\n * Overrides the CSS `font-size` of this Glyph's root element. Useful when\n * the ambient inherited font-size produces a line-box taller than the\n * glyph's `preferredSize`, causing the Unicode character to overflow or\n * get clipped by the element's `overflow: hidden`. No-op visually for\n * SVG glyphs (which size via `viewBox`), but the rule is written regardless.\n *\n * @param value - The new font-size in pixels.\n * @returns This Glyph, for method chaining.\n */\n setFontSize(value: number): this {\n this._options.fontSize = value;\n this.setElementCSSRule(\"fontSize\", value + \"px\");\n\n return this;\n }\n\n /**\n * Returns the current CSS `line-height` value written by this Glyph, or\n * `null` if no rule has been written (the element inherits the parent's\n * line-height).\n *\n * @returns The cached line-height CSS value (e.g. `\"1\"`, `\"24px\"`), or null.\n *\n * @remarks\n * Char-mode glyphs construct with `\"1\"`; SVG-mode glyphs default to null.\n * Use this getter rather than reading `element.style.lineHeight` to avoid\n * a forced style read.\n */\n getLineHeight(): string | null {\n const value = this._options.lineHeight;\n if (value === undefined) {\n return null;\n }\n\n return typeof value === \"number\" ? value + \"px\" : value;\n }\n\n /**\n * Overrides the CSS `line-height` of this Glyph's root element.\n *\n * @param value - Pixel number (e.g. `24` → `\"24px\"`) or a raw CSS\n * line-height value (e.g. `\"1\"` for the unitless\n * font-size multiplier used by char-mode glyphs).\n * @returns This Glyph, for method chaining.\n *\n * @remarks\n * Char-mode glyphs construct with `line-height: 1`, which keeps Unicode\n * characters like `▲` / `▼` snug against the top of their box. When a\n * Glyph is sized larger than its natural char height and needs to\n * vertically centre within that box, callers can match the line-height to\n * the element height to push the line-box to the middle. No-op visually\n * for SVG glyphs (which size via `viewBox`), but the rule is written\n * regardless.\n */\n setLineHeight(value: number | string): this {\n this._options.lineHeight = value;\n this.setElementCSSRule(\"lineHeight\", typeof value === \"number\" ? value + \"px\" : value);\n\n return this;\n }\n\n /**\n * Returns the current CSS `text-align` value written by this Glyph, or\n * `null` if no rule has been written (the element inherits the parent's\n * text-align).\n *\n * @returns The cached text-align CSS value (e.g. `\"center\"`), or null.\n *\n * @remarks\n * Char-mode glyphs construct with `\"center\"` to keep the Unicode\n * character horizontally centred within its element box; SVG-mode glyphs\n * default to null. Use this getter rather than reading\n * `element.style.textAlign` to avoid a forced style read.\n */\n getTextAlign(): string | null {\n return this._options.textAlign ?? null;\n }\n\n /**\n * Overrides the CSS `text-align` of this Glyph's root element.\n *\n * @param value - A CSS `text-align` keyword such as `\"left\"`, `\"center\"`,\n * `\"right\"`, `\"start\"`, or `\"end\"`.\n * @returns This Glyph, for method chaining.\n */\n setTextAlign(value: string): this {\n this._options.textAlign = value;\n this.setElementCSSRule(\"textAlign\", value);\n\n return this;\n }\n\n /**\n * Returns the currently-playing animation kind, or `null` when none is\n * active.\n *\n * @returns The active {@link GlyphAnimation}, or `null`.\n */\n getAnimated(): GlyphAnimation | null {\n return this._glyphAnimation;\n }\n\n /**\n * Starts the named animation, or stops the current one when `kind` is\n * `null`. No-op when the requested kind already matches the current one.\n *\n * @param kind - A {@link GlyphAnimation} value or `null` to stop.\n * @returns This Glyph, for method chaining.\n *\n * @remarks\n * Adds the corresponding `ts-ui-glyph-<kind>` class to the root element.\n * Honours [`Animation.isReducedMotion`](/api/core/namespaces/Animation/functions/isReducedMotion):\n * when reduced-motion is on, the class is not mounted but the requested\n * kind is cached and a module-level listener re-applies it should the OS\n * preference flip back. While motion is active, `will-change: transform`\n * is set via [`Component.setWillChange`](/api/core/classes/Component#setwillchange);\n * cleared when motion stops.\n *\n * Differs from the inherited `Component.setAnimation(value: string)`:\n * this is a typed-enum surface that toggles a pre-registered class rule;\n * the inherited setter accepts a raw CSS shorthand and writes a\n * per-component `#id { animation: … }` rule.\n *\n * @example\n * ```typescript\n * const g = new Glyph(\"xmark\");\n * g.setAnimated(\"spin\");\n * g.setAnimated(null); // stop\n * ```\n */\n setAnimated(kind: GlyphAnimation | null): this {\n if (this._glyphAnimation === kind) {\n return this;\n }\n\n const prev = this._glyphAnimation;\n this._glyphAnimation = kind;\n\n const el = this.getElement();\n\n if (el && prev) {\n DOM.sink.apply(el, { removeClass: [CLASS_PREFIX + prev] });\n }\n\n if (kind === null) {\n this.setElementStyle(\"animationDuration\", null);\n this.setWillChange(null);\n\n if (this._animatedRef) {\n _animatedRefs.delete(this._animatedRef);\n this._animatedRef = null;\n }\n\n return this;\n }\n\n ensureGlyphKeyframes();\n\n if (!this._animatedRef) {\n this._animatedRef = new WeakRef(this);\n _animatedRefs.add(this._animatedRef);\n }\n\n if (!Animation.isReducedMotion()) {\n if (el) {\n DOM.sink.apply(el, { addClass: [CLASS_PREFIX + kind] });\n }\n\n this.setWillChange(\"transform\");\n }\n\n if (this._glyphAnimationDuration > 0) {\n this.setElementStyle(\"animationDuration\", this._glyphAnimationDuration + \"ms\");\n }\n\n return this;\n }\n\n /**\n * Stops the current animation. Equivalent to `setAnimated(null)`.\n *\n * @returns This Glyph, for method chaining.\n */\n clearAnimated(): this {\n return this.setAnimated(null);\n }\n\n /**\n * Returns the override duration (ms) set via {@link setAnimationDuration},\n * or `0` when no override is active. Read the active CSS custom property\n * (`--ts-ui-glyph-<kind>-duration`) for the live value when no override\n * is set.\n *\n * @returns The override duration in ms, or `0`.\n */\n getAnimationDuration(): number {\n return this._glyphAnimationDuration;\n }\n\n /**\n * Overrides the active animation's duration. Pass `0` to clear the\n * override and fall back to the theme-token default. No visible effect\n * when no animation is currently set, but the override is cached and\n * will apply on the next {@link setAnimated} call.\n *\n * @param ms - Duration in milliseconds, or `0` to clear.\n * @returns This Glyph, for method chaining.\n */\n setAnimationDuration(ms: number): this {\n this._glyphAnimationDuration = ms;\n\n if (this._glyphAnimation !== null && !Animation.isReducedMotion()) {\n this.setElementStyle(\"animationDuration\", ms > 0 ? ms + \"ms\" : null);\n }\n\n return this;\n }\n\n /**\n * Re-applies (or removes) the animation class to match the current\n * `prefers-reduced-motion` state. Called by the module-level listener\n * when the OS preference flips. Internal; not part of the public API.\n */\n _syncReducedMotion(): void {\n const kind = this._glyphAnimation;\n if (!kind) {\n return;\n }\n\n const element = this.getElement(true)!;\n const className = CLASS_PREFIX + kind;\n\n if (Animation.isReducedMotion()) {\n DOM.sink.apply(element, { removeClass: [className] });\n this.setWillChange(null);\n this.setElementStyle(\"animationDuration\", null);\n } else {\n DOM.sink.apply(element, { addClass: [className] });\n this.setWillChange(\"transform\");\n\n if (this._glyphAnimationDuration > 0) {\n this.setElementStyle(\"animationDuration\", this._glyphAnimationDuration + \"ms\");\n }\n }\n }\n\n /**\n * Applies a {@link GlyphOptions} bag by dispatching each present field to\n * its corresponding setter.\n *\n * @param options - The options bag carrying the values to apply.\n * @returns This Glyph, for method chaining.\n */\n protected applyOptions(options: GlyphOptions): this {\n super.applyOptions(options);\n\n if (options.fontSize !== undefined) {\n this.setFontSize(options.fontSize);\n }\n\n if (options.lineHeight !== undefined) {\n this.setLineHeight(options.lineHeight);\n }\n\n if (options.textAlign !== undefined) {\n this.setTextAlign(options.textAlign);\n }\n\n if (options.animationDuration !== undefined) {\n this.setAnimationDuration(options.animationDuration);\n }\n\n // Re-pin minSize / maxSize to the current preferred size so the glyph\n // stays rigid in flexible layouts. The inherited cascade has just\n // overwritten the pin from `setPreferredSize` with Component's `{0,0}`\n // minSize / `{MAX,MAX}` maxSize defaults; restore it here, but honour\n // an explicit `options.minSize` / `options.maxSize` from the caller.\n const pref = this.getPreferredSizeConstraint();\n if (pref) {\n if (options.minSize === undefined) {\n this.setMinSize({ width: pref.width, height: pref.height });\n }\n\n if (options.maxSize === undefined) {\n this.setMaxSize({ width: pref.width, height: pref.height });\n }\n }\n\n if (options.animation !== undefined) {\n this.setAnimated(options.animation);\n }\n\n return this;\n }\n\n /**\n * Creates the root element, using the SVG namespace when the registry\n * entry is an SVG definition. SVG instances reference a shared sprite\n * symbol rather than inlining the path data.\n *\n * @returns The root element for this Glyph (HTML `<span>` or SVG `<svg>`).\n */\n protected createRootElement(): Handle {\n if (this._def.kind === \"svg\") {\n ensureGlyphSprite();\n ensureGlyphSymbolMounted(this._name);\n\n const svgNs = \"http://www.w3.org/2000/svg\";\n const svg = DOM.sink.createElementNS(svgNs, \"svg\");\n DOM.sink.apply(svg, { setAttr: { fill: \"currentColor\", \"aria-hidden\": \"true\", focusable: \"false\" } });\n\n const use = DOM.sink.createElementNS(svgNs, \"use\");\n DOM.sink.apply(use, { setAttr: { href: \"#\" + GLYPH_SYMBOL_ID_PREFIX + this._name } });\n DOM.sink.appendChild(svg, use);\n\n // Track the `<use>` child so it is released with the glyph (the root\n // `svg` is tracked by Component.render). Released on destructor or GC.\n this.trackHandle(use);\n\n return svg;\n }\n\n return super.createRootElement();\n }\n\n /**\n * Populates the rendered element. For char-mode glyphs the character is\n * written into the span's text content; SVG-mode element children are\n * created by `createRootElement`.\n *\n * Applies `preferredSize` as inline width/height so SVG glyphs appended\n * raw via `glyph.getElement(true)` outside a framework layout don't fall\n * back to the user-agent's 300×150 default replaced-element size.\n *\n * @returns The rendered root element.\n */\n protected render(): Handle {\n const element = super.render();\n\n if (this._def.kind === \"char\") {\n DOM.sink.apply(element, { text: this._def.char });\n }\n\n if (this._glyphAnimation && !Animation.isReducedMotion()) {\n DOM.sink.apply(element, { addClass: [CLASS_PREFIX + this._glyphAnimation] });\n }\n\n const preferredSize = this._options.preferredSize;\n if (preferredSize) {\n this.setElementStyle(\"width\", preferredSize.width + \"px\");\n this.setElementStyle(\"height\", preferredSize.height + \"px\");\n }\n\n return element;\n }\n}\n\nconst GlyphCallable = callable(Glyph);\ntype GlyphCallable = Glyph;\nexport {\n Glyph as _Glyph,\n GlyphCallable as Glyph\n};\n"],"mappings":"uGAiCA,IAAM,EAAiC,IAAI,IAS3C,EAAQ,IAAI,mBAAuB,CAAE,KAAM,OAAQ,KAAM,GAAI,CAAC,EAC9D,EAAQ,IAAI,qBAAuB,CAAE,KAAM,OAAQ,KAAM,GAAI,CAAC,EAC9D,EAAQ,IAAI,qBAAuB,CAAE,KAAM,OAAQ,KAAM,GAAI,CAAC,EAC9D,EAAQ,IAAI,sBAAuB,CAAE,KAAM,OAAQ,KAAM,GAAI,CAAC,EAE9D,IAAM,EAAS,6BAOF,EAAyB,YAElC,EAAiC,GACjC,EAAgC,KASpC,SAAgB,cAAc,EAA0B,CACpD,EAAQ,IAAI,EAAI,KAAM,CAAG,EAErB,EAAI,OAAS,OAAS,GACtB,mBAAmB,EAAI,KAAM,CAAG,CAExC,CAQA,SAAgB,gBAAgB,EAAoB,CAChD,IAAM,EAAM,EAAQ,IAAI,CAAI,EAC5B,EAAQ,OAAO,CAAI,EAEf,GAAO,EAAI,OAAS,OAAS,GAC7B,wBAAwB,CAAI,CAEpC,CASA,SAAgB,YAAY,EAAoC,CAC5D,OAAO,EAAQ,IAAI,CAAI,CAC3B,CAWA,SAAgB,mBAA0B,CACtC,GAAI,EACA,OAGJ,IAAM,EAAS,EAAI,KAAK,gBAAgB,EAAQ,KAAK,EAGrD,EAAI,KAAK,MAAM,EAAQ,CACnB,QAAS,CAAE,cAAe,OAAQ,UAAW,OAAQ,EACrD,MAAO,CAAE,SAAU,WAAY,MAAO,IAAK,OAAQ,IAAK,SAAU,QAAS,CAC/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AAK"}
1
+ {"version":3,"file":"Glyph-CnNslL95.js","names":[],"sources":["../../src/typescript/lib/component/display/Glyphs.ts","../../src/typescript/lib/component/display/Glyph.ts"],"sourcesContent":["// SPDX-License-Identifier: PolyForm-Noncommercial-1.0.0\n\nimport { DOM } from \"~/core/DOM.js\";\nimport type { Handle } from \"~/core/DOM.js\";\n\n/**\n * Tagged union describing how a glyph is rendered.\n *\n * @remarks\n * - `kind: \"svg\"` entries supply a `viewBox` and an SVG `<path>` `d` attribute.\n * The path data is mounted once into a shared hidden `<svg>` sprite and each\n * Glyph instance references it via `<svg><use href=\"#...\"/></svg>` so the\n * path string is not duplicated in the DOM.\n * - `kind: \"char\"` entries carry a single Unicode character rendered inside a\n * `<span>`; the character follows the inherited text colour.\n */\nexport type GlyphDef =\n | { kind: \"svg\", viewBox: string; path: string }\n | { kind: \"char\", char: string };\n\n/**\n * A {@link GlyphDef} carrying its own registry name. Glyph modules generated\n * from third-party icon sets export values of this shape so they can be\n * registered in a single call to `Glyph.register(...)`.\n */\nexport type NamedGlyphDef = GlyphDef & { name: string };\n\n/**\n * Mutable registry of named glyphs, populated via `registerGlyph` /\n * `Glyph.register`. Starts empty — consumers register the glyphs they need.\n *\n * @internal\n */\nconst _glyphs: Map<string, GlyphDef> = new Map();\n\n// Built-in Unicode-triangle glyphs registered eagerly. Prefixed `unicode-` so\n// user code can register its own `arrow-up` / `arrow-down` SVG glyphs without\n// overwriting these — built-in chrome like Scrollbar's end-cap buttons\n// references the prefixed names directly and stays immune to user overrides.\n// Char-mode entries are tiny (no sprite, no path data) so the always-on cost\n// is negligible; the triangles inherit the surrounding text colour via\n// `currentColor`, so a single foreground-colour write themes them.\n_glyphs.set(\"unicode-arrow-up\", { kind: \"char\", char: \"▲\" });\n_glyphs.set(\"unicode-arrow-down\", { kind: \"char\", char: \"▼\" });\n_glyphs.set(\"unicode-arrow-left\", { kind: \"char\", char: \"◀\" });\n_glyphs.set(\"unicode-arrow-right\", { kind: \"char\", char: \"▶\" });\n\nconst SVG_NS = \"http://www.w3.org/2000/svg\";\n\n/**\n * Prefix applied to every `<symbol>` id inside the sprite. A consumer-supplied\n * registry name `\"xmark\"` becomes the id `\"ts-glyph-xmark\"`, which is what\n * `<use href=\"#ts-glyph-xmark\"/>` references.\n */\nexport const GLYPH_SYMBOL_ID_PREFIX = \"ts-glyph-\";\n\nlet _spriteMounted: boolean = false;\nlet _spriteElement: Handle | null = null;\n\n/**\n * Registers a glyph by name. If the glyph is SVG-mode and the sprite is\n * already mounted, the corresponding `<symbol>` is appended immediately so\n * Glyphs constructed after this call can reference it.\n *\n * @internal\n */\nexport function registerGlyph(def: NamedGlyphDef): void {\n _glyphs.set(def.name, def);\n\n if (def.kind === \"svg\" && _spriteMounted) {\n _addSymbolToSprite(def.name, def);\n }\n}\n\n/**\n * Removes a glyph from the registry by name. If the glyph was SVG-mode and\n * the sprite is mounted, its `<symbol>` is removed from the DOM as well.\n *\n * @internal\n */\nexport function unregisterGlyph(name: string): void {\n const def = _glyphs.get(name);\n _glyphs.delete(name);\n\n if (def && def.kind === \"svg\" && _spriteMounted) {\n _removeSymbolFromSprite(name);\n }\n}\n\n/**\n * Looks up a glyph definition by registry name.\n *\n * @returns The registered {@link GlyphDef}, or `undefined` if not registered.\n *\n * @internal\n */\nexport function lookupGlyph(name: string): GlyphDef | undefined {\n return _glyphs.get(name);\n}\n\n/**\n * Ensures the document carries a single hidden `<svg>` sprite that hosts the\n * `<symbol>` elements for every SVG-mode glyph. Idempotent — subsequent calls\n * are no-ops. The sprite starts empty; entries are appended incrementally\n * either by {@link registerGlyph} (after the sprite is mounted) or by\n * {@link ensureGlyphSymbolMounted} (when a Glyph instance is constructed).\n *\n * @internal\n */\nexport function ensureGlyphSprite(): void {\n if (_spriteMounted) {\n return;\n }\n\n const sprite = DOM.sink.createElementNS(SVG_NS, \"svg\");\n // `sprite` is a raw off-screen SVG element mounted directly on document.body,\n // not a Component, so the Component style setters don't apply here.\n DOM.sink.apply(sprite, {\n setAttr: { \"aria-hidden\": \"true\", focusable: \"false\" },\n style: { position: \"absolute\", width: \"0\", height: \"0\", overflow: \"hidden\" },\n });\n\n DOM.sink.appendChild(DOM.source.getBody(), sprite);\n\n _spriteElement = sprite;\n _spriteMounted = true;\n}\n\n/**\n * Ensures the sprite carries a `<symbol>` for the named SVG-mode glyph,\n * appending it on demand for glyphs registered before the sprite was mounted.\n * Idempotent.\n *\n * @internal\n */\nexport function ensureGlyphSymbolMounted(name: string): void {\n if (!_spriteMounted) {\n return;\n }\n\n const def = _glyphs.get(name);\n if (def && def.kind === \"svg\") {\n _addSymbolToSprite(name, def);\n }\n}\n\n/**\n * Appends a `<symbol>` for the given SVG-mode glyph to the sprite. Idempotent:\n * a no-op when a `<symbol>` with the same id already exists.\n *\n * @internal\n */\nfunction _addSymbolToSprite(name: string, def: GlyphDef): void {\n if (!_spriteElement || def.kind !== \"svg\") {\n return;\n }\n\n const id = GLYPH_SYMBOL_ID_PREFIX + name;\n if (DOM.source.querySelector(_spriteElement, `#${DOM.source.escapeSelector(id)}`)) {\n return;\n }\n\n const symbol = DOM.sink.createElementNS(SVG_NS, \"symbol\");\n DOM.sink.apply(symbol, { setAttr: { id: id, viewBox: def.viewBox } });\n\n const path = DOM.sink.createElementNS(SVG_NS, \"path\");\n DOM.sink.apply(path, { setAttr: { d: def.path } });\n DOM.sink.appendChild(symbol, path);\n\n DOM.sink.appendChild(_spriteElement, symbol);\n}\n\n/**\n * Removes the `<symbol>` for the given glyph name from the sprite, if present.\n *\n * @internal\n */\nfunction _removeSymbolFromSprite(name: string): void {\n if (!_spriteElement) {\n return;\n }\n\n const id = GLYPH_SYMBOL_ID_PREFIX + name;\n const symbol = DOM.source.querySelector(_spriteElement, `#${DOM.source.escapeSelector(id)}`);\n if (symbol) {\n // Release the symbol's retained `<path>` child too — releasing only the\n // symbol would pin the detached path handle in the registry. Queried\n // before removal so it resolves to its canonical retained handle.\n const path = DOM.source.querySelector(symbol, \"path\");\n\n DOM.sink.removeChild(_spriteElement, symbol);\n DOM.sink.release(symbol);\n\n if (path) {\n DOM.sink.release(path);\n }\n }\n}\n","// SPDX-License-Identifier: PolyForm-Noncommercial-1.0.0\n\nimport { Animation } from \"~/core/Animation.js\";\nimport { Component, ComponentOptions } from \"~/core/Component.js\";\nimport { DOM } from \"~/core/DOM.js\";\nimport type { Handle } from \"~/core/DOM.js\";\nimport { StyleRule } from \"~/core/StyleTarget.js\";\nimport { callable } from \"~/core/Callable.js\";\nimport { Size } from \"~/primitive/Size.js\";\nimport {\n ensureGlyphSprite,\n ensureGlyphSymbolMounted,\n GLYPH_SYMBOL_ID_PREFIX,\n GlyphDef,\n lookupGlyph,\n NamedGlyphDef,\n registerGlyph,\n unregisterGlyph,\n} from \"~/component/display/Glyphs.js\";\n\n/**\n * Named animation kinds supported by {@link Glyph.setAnimated}.\n *\n * - `spin` — continuous 360 degree rotate. Loading and refresh affordances.\n * - `pulse` — 8-step rotate. Mechanical, faux-loading tick.\n * - `beat` — transform-scale pulse. Notification dots and attention nudges.\n *\n * Mirrors FontAwesome's `fa-spin` / `fa-pulse` / `fa-beat` vocabulary.\n *\n * @category Components\n */\nexport type GlyphAnimation = \"spin\" | \"pulse\" | \"beat\";\n\n/**\n * CSS class prefix shared by all three animation rules. The full class name\n * is `ts-ui-glyph-<kind>` (e.g. `ts-ui-glyph-spin`).\n */\nconst CLASS_PREFIX = \"ts-ui-glyph-\";\n\n/**\n * Registry of `WeakRef<Glyph>` for currently-animated instances. A single\n * module-level `matchMedia` listener walks this set on OS preference changes\n * and re-applies the class to match. `WeakRef` lets the GC collect unrooted\n * glyphs without an explicit deregister-on-disposal step.\n */\nconst _animatedRefs: Set<WeakRef<Glyph>> = new Set();\n\nlet _keyframesInjected = false;\n\n/**\n * Injects the three `@keyframes` blocks and matching class rules on first\n * use. Idempotent — guarded by the module-level `_keyframesInjected` flag.\n */\nfunction ensureGlyphKeyframes(): void {\n if (_keyframesInjected) {\n return;\n }\n\n _keyframesInjected = true;\n\n StyleRule.ensureKeyframes(\"ts-ui-glyph-spin\",\n \"from { transform: rotate(0deg); } to { transform: rotate(360deg); }\");\n\n StyleRule.ensureKeyframes(\"ts-ui-glyph-pulse\",\n \"0%, 12.5% { transform: rotate(0deg); } \" +\n \"12.5%, 25% { transform: rotate(45deg); } \" +\n \"25%, 37.5% { transform: rotate(90deg); } \" +\n \"37.5%, 50% { transform: rotate(135deg); } \" +\n \"50%, 62.5% { transform: rotate(180deg); } \" +\n \"62.5%, 75% { transform: rotate(225deg); } \" +\n \"75%, 87.5% { transform: rotate(270deg); } \" +\n \"87.5%, 100% { transform: rotate(315deg); }\");\n\n StyleRule.ensureKeyframes(\"ts-ui-glyph-beat\",\n \"0%, 90% { transform: scale(1); } 45% { transform: scale(1.25); }\");\n\n new StyleRule({\n scope: \"class\",\n name: CLASS_PREFIX + \"spin\",\n styles: {\n animation: \"ts-ui-glyph-spin var(--ts-ui-glyph-spin-duration, 2000ms) linear infinite\",\n },\n });\n\n new StyleRule({\n scope: \"class\",\n name: CLASS_PREFIX + \"pulse\",\n styles: {\n animation: \"ts-ui-glyph-pulse var(--ts-ui-glyph-pulse-duration, 1000ms) steps(8) infinite\",\n },\n });\n\n new StyleRule({\n scope: \"class\",\n name: CLASS_PREFIX + \"beat\",\n styles: {\n animation: \"ts-ui-glyph-beat var(--ts-ui-glyph-beat-duration, 1000ms) ease-in-out infinite\",\n },\n });\n}\n\n/**\n * Module-level listener that re-evaluates every animated glyph when the OS\n * `prefers-reduced-motion` preference flips. Dead `WeakRef`s are pruned.\n */\nfunction _onReducedMotionChange(): void {\n for (const ref of Array.from(_animatedRefs)) {\n const glyph = ref.deref();\n if (!glyph) {\n _animatedRefs.delete(ref);\n continue;\n }\n\n glyph._syncReducedMotion();\n }\n}\n\n// The seam's `matchMedia` degrades to an inert result off-browser, so this\n// module-level registration needs no environment guard of its own.\nDOM.source.matchMedia(\"(prefers-reduced-motion: reduce)\").addChangeListener(_onReducedMotionChange);\n\n/**\n * Construction-time options for {@link Glyph}.\n *\n * @category Components\n */\nexport interface GlyphOptions extends ComponentOptions {\n\n /**\n * CSS `font-size` override in pixels. Only meaningful for char-mode\n * glyphs (SVG glyphs paint via `<use>` and ignore font-size). Useful when\n * the inherited font-size produces a line-box taller than the glyph's\n * element box and the Unicode character overflows or gets clipped.\n */\n fontSize?: number;\n\n /**\n * CSS `line-height` override. A number is interpreted as pixels (e.g.\n * `24` → `\"24px\"`); a string is used verbatim (e.g. `\"1\"` for the\n * unitless font-size multiplier used by char-mode glyphs).\n */\n lineHeight?: number | string;\n\n /**\n * CSS `text-align` keyword (e.g. `\"left\"`, `\"center\"`, `\"right\"`).\n * Char-mode glyphs default to `\"center\"`; SVG-mode glyphs leave this\n * unset.\n */\n textAlign?: string;\n\n /**\n * Optional animation kind to play on this glyph from construction.\n */\n animation?: GlyphAnimation;\n\n /**\n * Optional override (ms) for the active animation's duration. Wins over\n * the theme-token default while non-zero. Ignored when `animation` is\n * unset.\n */\n animationDuration?: number;\n}\n\n/**\n * User-overridable defaults forwarded to `super` via the options bag. The\n * cascade dispatches each present setter once with the final value. Only\n * defaults that apply unconditionally for every Glyph kind live here — the\n * char-only `lineHeight`/`textAlign` defaults stay in the constructor body\n * because they depend on the per-instance `def.kind`.\n */\nconst _defaultGlyphOptions: Partial<GlyphOptions> = {\n preferredSize: { width: 16, height: 16 } as GlyphOptions[\"preferredSize\"],\n};\n\n/**\n * A small icon rendered from the internal `Glyphs` registry.\n *\n * @remarks\n * Each registry entry is either an SVG or a single Unicode character. SVG\n * entries are rendered as `<svg><use href=\"#…\"/></svg>` against a hidden\n * sprite mounted once into `document.body`, so the path data lives in the\n * DOM exactly once regardless of how many Glyph instances reference it.\n * Unicode entries render as `<span>`. Both forms render with `currentColor`,\n * so a `Glyph` inherits the surrounding text colour for free. The underlying\n * root tag is decided once at construction from the entry's `kind` and\n * cannot be changed afterwards — to swap glyph, discard the instance and\n * create a new one.\n *\n * Pass any registry name to the constructor; unknown names throw at\n * construction. The default preferred size is 16×16.\n *\n * @example\n * ```typescript\n * import { xmark } from \"~/glyphs/solid/xmark.js\";\n * import { arrow_right } from \"~/glyphs/solid/arrow_right.js\";\n *\n * Glyph.register(xmark, arrow_right);\n *\n * panel.addComponent(new Glyph(\"xmark\"));\n * panel.addComponent(new Glyph(\"arrow-right\"));\n * ```\n *\n * @category Components\n */\nclass Glyph extends Component<GlyphOptions> {\n\n private _name: string;\n private _def: GlyphDef;\n declare private _glyphAnimation: GlyphAnimation | null;\n declare private _glyphAnimationDuration: number;\n declare private _animatedRef: WeakRef<Glyph> | null;\n\n /**\n * Registers one or more glyph definitions so they can be instantiated by\n * name. Pass the named exports from `~/glyphs/<style>/<name>.js` modules.\n *\n * @param defs - One or more {@link NamedGlyphDef} values to register.\n */\n static register(...defs: NamedGlyphDef[]): void {\n for (const def of defs) {\n registerGlyph(def);\n }\n }\n\n /**\n * Removes a previously registered glyph by name.\n *\n * @param name - Registry key to unregister.\n */\n static unregister(name: string): void {\n unregisterGlyph(name);\n }\n\n /**\n * Constructs a Glyph for the registry entry with the given name.\n *\n * @param name - Registry key. Must have been registered via {@link Glyph.register}.\n * @param options - Optional component options bag.\n */\n constructor(name: string, options?: GlyphOptions) {\n const def = lookupGlyph(name);\n if (!def) {\n throw new Error(\"Unknown glyph: \" + name);\n }\n\n // Hand defaults plus the per-instance tag (chosen from the registry\n // entry's `kind`) to Component via the subclass-defaults arg so they\n // land in `_defaultOptions`. Component's super-time cascade applies\n // them; user `options` win because `applyOptions` merges\n // `{...defaults, ...options}` at dispatch time.\n super(options, {\n ..._defaultGlyphOptions,\n tag: def.kind === \"svg\" ? \"svg\" : \"span\",\n });\n\n this._name = name;\n this._def = def;\n\n // Char-mode glyphs need a line-height and text-align that SVG glyphs\n // should not get. Keep these guards in the constructor body since they\n // depend on per-instance `def.kind` rather than a static default.\n if (def.kind === \"char\") {\n if (this._options.lineHeight === undefined) {\n this.setLineHeight(\"1\");\n }\n\n if (this._options.textAlign === undefined) {\n this.setTextAlign(\"center\");\n }\n }\n }\n\n /**\n * Sets the preferred size and pins minSize/maxSize to the same value so\n * the glyph stays rigid in flexible layouts — HBox's shrink-on-overflow\n * logic and any grow path see equal min/pref/max and leave the glyph at\n * its configured size. Callers can still override the lock by calling\n * `setMinSize` / `setMaxSize` explicitly after this method.\n *\n * @param size - The preferred size in pixels.\n *\n * @returns This component, for method chaining.\n */\n setPreferredSize(size: Size): this {\n super.setPreferredSize(size);\n super.setMinSize(size);\n super.setMaxSize(size);\n\n return this;\n }\n\n /**\n * Returns a baseline near the bottom edge so the glyph participates in\n * baseline alignment — sitting with its ink roughly on the surrounding text\n * baseline when placed next to labels — instead of being vertically centred\n * in the row. The anchor is 4px above the bottom edge (vs 2px on the\n * bar-shaped controls), which drops a square icon slightly lower so its ink\n * lands on the text baseline rather than floating above it.\n *\n * @returns The preferred height minus 4, or `null` before a size is set.\n */\n getBaseline(): number | null {\n const size = this.getPreferredSize();\n\n return size ? size.height - 3 : null;\n }\n\n /**\n * Returns the registry name this Glyph was constructed with. Named\n * `getGlyphName` rather than `getName` so it does not shadow\n * [`Component.getName`](/api/core/classes/Component#getname), whose\n * intrinsic `name` is a display label with a different meaning.\n *\n * @returns The registry key supplied to the constructor.\n */\n getGlyphName(): string {\n return this._name;\n }\n\n /**\n * Returns the explicit CSS `font-size` override (in pixels) written by\n * this Glyph, or `null` when no override has been written (the element\n * inherits the parent's font-size).\n *\n * @returns The cached font-size in pixels, or null.\n */\n getFontSize(): number | null {\n return this._options.fontSize ?? null;\n }\n\n /**\n * Overrides the CSS `font-size` of this Glyph's root element. Useful when\n * the ambient inherited font-size produces a line-box taller than the\n * glyph's `preferredSize`, causing the Unicode character to overflow or\n * get clipped by the element's `overflow: hidden`. No-op visually for\n * SVG glyphs (which size via `viewBox`), but the rule is written regardless.\n *\n * @param value - The new font-size in pixels.\n * @returns This Glyph, for method chaining.\n */\n setFontSize(value: number): this {\n this._options.fontSize = value;\n this.setElementCSSRule(\"fontSize\", value + \"px\");\n\n return this;\n }\n\n /**\n * Returns the current CSS `line-height` value written by this Glyph, or\n * `null` if no rule has been written (the element inherits the parent's\n * line-height).\n *\n * @returns The cached line-height CSS value (e.g. `\"1\"`, `\"24px\"`), or null.\n *\n * @remarks\n * Char-mode glyphs construct with `\"1\"`; SVG-mode glyphs default to null.\n * Use this getter rather than reading `element.style.lineHeight` to avoid\n * a forced style read.\n */\n getLineHeight(): string | null {\n const value = this._options.lineHeight;\n if (value === undefined) {\n return null;\n }\n\n return typeof value === \"number\" ? value + \"px\" : value;\n }\n\n /**\n * Overrides the CSS `line-height` of this Glyph's root element.\n *\n * @param value - Pixel number (e.g. `24` → `\"24px\"`) or a raw CSS\n * line-height value (e.g. `\"1\"` for the unitless\n * font-size multiplier used by char-mode glyphs).\n * @returns This Glyph, for method chaining.\n *\n * @remarks\n * Char-mode glyphs construct with `line-height: 1`, which keeps Unicode\n * characters like `▲` / `▼` snug against the top of their box. When a\n * Glyph is sized larger than its natural char height and needs to\n * vertically centre within that box, callers can match the line-height to\n * the element height to push the line-box to the middle. No-op visually\n * for SVG glyphs (which size via `viewBox`), but the rule is written\n * regardless.\n */\n setLineHeight(value: number | string): this {\n this._options.lineHeight = value;\n this.setElementCSSRule(\"lineHeight\", typeof value === \"number\" ? value + \"px\" : value);\n\n return this;\n }\n\n /**\n * Returns the current CSS `text-align` value written by this Glyph, or\n * `null` if no rule has been written (the element inherits the parent's\n * text-align).\n *\n * @returns The cached text-align CSS value (e.g. `\"center\"`), or null.\n *\n * @remarks\n * Char-mode glyphs construct with `\"center\"` to keep the Unicode\n * character horizontally centred within its element box; SVG-mode glyphs\n * default to null. Use this getter rather than reading\n * `element.style.textAlign` to avoid a forced style read.\n */\n getTextAlign(): string | null {\n return this._options.textAlign ?? null;\n }\n\n /**\n * Overrides the CSS `text-align` of this Glyph's root element.\n *\n * @param value - A CSS `text-align` keyword such as `\"left\"`, `\"center\"`,\n * `\"right\"`, `\"start\"`, or `\"end\"`.\n * @returns This Glyph, for method chaining.\n */\n setTextAlign(value: string): this {\n this._options.textAlign = value;\n this.setElementCSSRule(\"textAlign\", value);\n\n return this;\n }\n\n /**\n * Returns the currently-playing animation kind, or `null` when none is\n * active.\n *\n * @returns The active {@link GlyphAnimation}, or `null`.\n */\n getAnimated(): GlyphAnimation | null {\n return this._glyphAnimation;\n }\n\n /**\n * Starts the named animation, or stops the current one when `kind` is\n * `null`. No-op when the requested kind already matches the current one.\n *\n * @param kind - A {@link GlyphAnimation} value or `null` to stop.\n * @returns This Glyph, for method chaining.\n *\n * @remarks\n * Adds the corresponding `ts-ui-glyph-<kind>` class to the root element.\n * Honours [`Animation.isReducedMotion`](/api/core/namespaces/Animation/functions/isReducedMotion):\n * when reduced-motion is on, the class is not mounted but the requested\n * kind is cached and a module-level listener re-applies it should the OS\n * preference flip back. While motion is active, `will-change: transform`\n * is set via [`Component.setWillChange`](/api/core/classes/Component#setwillchange);\n * cleared when motion stops.\n *\n * Differs from the inherited `Component.setAnimation(value: string)`:\n * this is a typed-enum surface that toggles a pre-registered class rule;\n * the inherited setter accepts a raw CSS shorthand and writes a\n * per-component `#id { animation: … }` rule.\n *\n * @example\n * ```typescript\n * const g = new Glyph(\"xmark\");\n * g.setAnimated(\"spin\");\n * g.setAnimated(null); // stop\n * ```\n */\n setAnimated(kind: GlyphAnimation | null): this {\n if (this._glyphAnimation === kind) {\n return this;\n }\n\n const prev = this._glyphAnimation;\n this._glyphAnimation = kind;\n\n const el = this.getElement();\n\n if (el && prev) {\n DOM.sink.apply(el, { removeClass: [CLASS_PREFIX + prev] });\n }\n\n if (kind === null) {\n this.setElementStyle(\"animationDuration\", null);\n this.setWillChange(null);\n\n if (this._animatedRef) {\n _animatedRefs.delete(this._animatedRef);\n this._animatedRef = null;\n }\n\n return this;\n }\n\n ensureGlyphKeyframes();\n\n if (!this._animatedRef) {\n this._animatedRef = new WeakRef(this);\n _animatedRefs.add(this._animatedRef);\n }\n\n if (!Animation.isReducedMotion()) {\n if (el) {\n DOM.sink.apply(el, { addClass: [CLASS_PREFIX + kind] });\n }\n\n this.setWillChange(\"transform\");\n }\n\n if (this._glyphAnimationDuration > 0) {\n this.setElementStyle(\"animationDuration\", this._glyphAnimationDuration + \"ms\");\n }\n\n return this;\n }\n\n /**\n * Stops the current animation. Equivalent to `setAnimated(null)`.\n *\n * @returns This Glyph, for method chaining.\n */\n clearAnimated(): this {\n return this.setAnimated(null);\n }\n\n /**\n * Returns the override duration (ms) set via {@link setAnimationDuration},\n * or `0` when no override is active. Read the active CSS custom property\n * (`--ts-ui-glyph-<kind>-duration`) for the live value when no override\n * is set.\n *\n * @returns The override duration in ms, or `0`.\n */\n getAnimationDuration(): number {\n return this._glyphAnimationDuration;\n }\n\n /**\n * Overrides the active animation's duration. Pass `0` to clear the\n * override and fall back to the theme-token default. No visible effect\n * when no animation is currently set, but the override is cached and\n * will apply on the next {@link setAnimated} call.\n *\n * @param ms - Duration in milliseconds, or `0` to clear.\n * @returns This Glyph, for method chaining.\n */\n setAnimationDuration(ms: number): this {\n this._glyphAnimationDuration = ms;\n\n if (this._glyphAnimation !== null && !Animation.isReducedMotion()) {\n this.setElementStyle(\"animationDuration\", ms > 0 ? ms + \"ms\" : null);\n }\n\n return this;\n }\n\n /**\n * Re-applies (or removes) the animation class to match the current\n * `prefers-reduced-motion` state. Called by the module-level listener\n * when the OS preference flips. Internal; not part of the public API.\n */\n _syncReducedMotion(): void {\n const kind = this._glyphAnimation;\n if (!kind) {\n return;\n }\n\n const element = this.getElement(true)!;\n const className = CLASS_PREFIX + kind;\n\n if (Animation.isReducedMotion()) {\n DOM.sink.apply(element, { removeClass: [className] });\n this.setWillChange(null);\n this.setElementStyle(\"animationDuration\", null);\n } else {\n DOM.sink.apply(element, { addClass: [className] });\n this.setWillChange(\"transform\");\n\n if (this._glyphAnimationDuration > 0) {\n this.setElementStyle(\"animationDuration\", this._glyphAnimationDuration + \"ms\");\n }\n }\n }\n\n /**\n * Applies a {@link GlyphOptions} bag by dispatching each present field to\n * its corresponding setter.\n *\n * @param options - The options bag carrying the values to apply.\n * @returns This Glyph, for method chaining.\n */\n protected applyOptions(options: GlyphOptions): this {\n super.applyOptions(options);\n\n if (options.fontSize !== undefined) {\n this.setFontSize(options.fontSize);\n }\n\n if (options.lineHeight !== undefined) {\n this.setLineHeight(options.lineHeight);\n }\n\n if (options.textAlign !== undefined) {\n this.setTextAlign(options.textAlign);\n }\n\n if (options.animationDuration !== undefined) {\n this.setAnimationDuration(options.animationDuration);\n }\n\n // Re-pin minSize / maxSize to the current preferred size so the glyph\n // stays rigid in flexible layouts. The inherited cascade has just\n // overwritten the pin from `setPreferredSize` with Component's `{0,0}`\n // minSize / `{MAX,MAX}` maxSize defaults; restore it here, but honour\n // an explicit `options.minSize` / `options.maxSize` from the caller.\n const pref = this.getPreferredSizeConstraint();\n if (pref) {\n if (options.minSize === undefined) {\n this.setMinSize({ width: pref.width, height: pref.height });\n }\n\n if (options.maxSize === undefined) {\n this.setMaxSize({ width: pref.width, height: pref.height });\n }\n }\n\n if (options.animation !== undefined) {\n this.setAnimated(options.animation);\n }\n\n return this;\n }\n\n /**\n * Creates the root element, using the SVG namespace when the registry\n * entry is an SVG definition. SVG instances reference a shared sprite\n * symbol rather than inlining the path data.\n *\n * @returns The root element for this Glyph (HTML `<span>` or SVG `<svg>`).\n */\n protected createRootElement(): Handle {\n if (this._def.kind === \"svg\") {\n ensureGlyphSprite();\n ensureGlyphSymbolMounted(this._name);\n\n const svgNs = \"http://www.w3.org/2000/svg\";\n const svg = DOM.sink.createElementNS(svgNs, \"svg\");\n DOM.sink.apply(svg, { setAttr: { fill: \"currentColor\", \"aria-hidden\": \"true\", focusable: \"false\" } });\n\n const use = DOM.sink.createElementNS(svgNs, \"use\");\n DOM.sink.apply(use, { setAttr: { href: \"#\" + GLYPH_SYMBOL_ID_PREFIX + this._name } });\n DOM.sink.appendChild(svg, use);\n\n // Track the `<use>` child so it is released with the glyph (the root\n // `svg` is tracked by Component.render). Released on destructor or GC.\n this.trackHandle(use);\n\n return svg;\n }\n\n return super.createRootElement();\n }\n\n /**\n * Populates the rendered element. For char-mode glyphs the character is\n * written into the span's text content; SVG-mode element children are\n * created by `createRootElement`.\n *\n * Applies `preferredSize` as inline width/height so SVG glyphs appended\n * raw via `glyph.getElement(true)` outside a framework layout don't fall\n * back to the user-agent's 300×150 default replaced-element size.\n *\n * @returns The rendered root element.\n */\n protected render(): Handle {\n const element = super.render();\n\n if (this._def.kind === \"char\") {\n DOM.sink.apply(element, { text: this._def.char });\n }\n\n if (this._glyphAnimation && !Animation.isReducedMotion()) {\n DOM.sink.apply(element, { addClass: [CLASS_PREFIX + this._glyphAnimation] });\n }\n\n const preferredSize = this._options.preferredSize;\n if (preferredSize) {\n this.setElementStyle(\"width\", preferredSize.width + \"px\");\n this.setElementStyle(\"height\", preferredSize.height + \"px\");\n }\n\n return element;\n }\n}\n\nconst GlyphCallable = callable(Glyph);\ntype GlyphCallable = Glyph;\nexport {\n Glyph as _Glyph,\n GlyphCallable as Glyph\n};\n"],"mappings":"uGAiCA,IAAM,EAAiC,IAAI,IAS3C,EAAQ,IAAI,mBAAuB,CAAE,KAAM,OAAQ,KAAM,GAAI,CAAC,EAC9D,EAAQ,IAAI,qBAAuB,CAAE,KAAM,OAAQ,KAAM,GAAI,CAAC,EAC9D,EAAQ,IAAI,qBAAuB,CAAE,KAAM,OAAQ,KAAM,GAAI,CAAC,EAC9D,EAAQ,IAAI,sBAAuB,CAAE,KAAM,OAAQ,KAAM,GAAI,CAAC,EAE9D,IAAM,EAAS,6BAOF,EAAyB,YAElC,EAAiC,GACjC,EAAgC,KASpC,SAAgB,cAAc,EAA0B,CACpD,EAAQ,IAAI,EAAI,KAAM,CAAG,EAErB,EAAI,OAAS,OAAS,GACtB,mBAAmB,EAAI,KAAM,CAAG,CAExC,CAQA,SAAgB,gBAAgB,EAAoB,CAChD,IAAM,EAAM,EAAQ,IAAI,CAAI,EAC5B,EAAQ,OAAO,CAAI,EAEf,GAAO,EAAI,OAAS,O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AAM,EAAS,CAAE,KAAM,KAAK,KAAK,IAAK,CAAC,EAGhD,KAAK,iBAAmB,CAAC,EAAU,gBAAgB,GACnD,EAAI,KAAK,MAAM,EAAS,CAAE,SAAU,CAAC,EAAe,KAAK,eAAe,CAAE,CAAC,EAG/E,IAAM,EAAgB,KAAK,SAAS,cAMpC,OALI,IACA,KAAK,gBAAgB,QAAU,EAAc,MAAS,IAAI,EAC1D,KAAK,gBAAgB,SAAU,EAAc,OAAS,IAAI,GAGvD,CACX,CACJ,EAEM,EAAgB,EAAS,KAAK"}
@@ -1,2 +1,2 @@
1
- import{a as e,l as t,o as n,s as r}from"./Position-A39T7-_1.js";import{d as i,f as a,l as o,u as s}from"./Component-DXf5a3g0.js";var Grid=class extends o{_rows=0;_columns=0;_spacing=5;_defaultFill=i.BOTH;_defaultAnchor=s.CENTER;_baselineAlign=!1;_columnTracks=[];_rowTracks=[];constructor(e){super(),e&&this.applyOptions(e)}applyOptions(e){super.applyOptions(e),e.rows!==void 0&&this.setRows(e.rows),e.columns!==void 0&&this.setColumns(e.columns),e.spacing!==void 0&&this.setComponentSpacing(e.spacing),e.defaultFill!==void 0&&this.setDefaultFill(e.defaultFill),e.defaultAnchor!==void 0&&this.setDefaultAnchor(e.defaultAnchor),e.baselineAlign!==void 0&&this.setBaselineAlign(e.baselineAlign),e.columnTracks!==void 0&&this.setColumnTracks(e.columnTracks),e.rowTracks!==void 0&&this.setRowTracks(e.rowTracks)}getDefaultFill(){return this._defaultFill}setDefaultFill(e){return this._defaultFill=e,this}getDefaultAnchor(){return this._defaultAnchor}setDefaultAnchor(e){return this._defaultAnchor=e,this}isBaselineAlign(){return this._baselineAlign}setBaselineAlign(e){return this._baselineAlign=e,this}getRows(){return this._rows}setRows(e){return this._rows=e,this}getComponentSpacing(){return this._spacing||0}setComponentSpacing(e){return this._spacing=e||0,this}getColumns(){return this._columns}setColumns(e){return this._columns=e,this}getColumnTracks(){return this._columnTracks}setColumnTracks(e){return this._columnTracks=e,this}getRowTracks(){return this._rowTracks}setRowTracks(e){return this._rowTracks=e,this}getColRowCount(){let e=this.getContainer();if(!e)return;let t=e.getLaidOutComponents().length,n=0,r=0;return!this._rows&&!this._columns?(r=Math.floor(Math.sqrt(t)),n=Math.ceil(t/r)):this._rows&&this._columns?(n=this._rows,r=this._columns):this._columns?(r=this._columns,n=Math.ceil(t/r)):(n=this._rows,r=Math.ceil(t/n)),{width:r,height:n}}getPreferredSize(){let e=this.getContainer();if(!e)return null;let t=e.getPerimeterSize(),n=t.left+t.right,r=t.top+t.bottom,i=e.getLaidOutComponents(),a=0,o=0;for(let e of i){let t=e.getPreferredSize();t&&(a=Math.max(a,t.width),o=Math.max(o,t.height))}let s=this.getColRowCount(),c=s?s.width:1,l=s?s.height:1,u=this.getComponentSpacing(),d=this.measureContent(i,c,l),f=this._columnTracks.length>0?this.trackAxisExtent(this._columnTracks,c,d.columns,!0):a*c,p=this._rowTracks.length>0?this.trackAxisExtent(this._rowTracks,l,d.rows,!0):o*l;return f+=Math.max(0,c-1)*u,p+=Math.max(0,l-1)*u,{width:f+n,height:p+r}}getMinSize(){let e=this.getContainer();if(!e)return null;let t=e.getPerimeterSize(),n=t.left+t.right,r=t.top+t.bottom,i=e.getLaidOutComponents(),a=0,o=0;for(let e of i){let t=e.getMinSize();t&&(a=Math.max(a,t.width),o=Math.max(o,t.height))}let s=this.getColRowCount(),c=s?s.width:1,l=s?s.height:1,u=this.getComponentSpacing(),d=this.measureContent(i,c,l),f=this._columnTracks.length>0?this.trackAxisExtent(this._columnTracks,c,d.columns,!1):a*c,p=this._rowTracks.length>0?this.trackAxisExtent(this._rowTracks,l,d.rows,!1):o*l;return f+=Math.max(0,c-1)*u,p+=Math.max(0,l-1)*u,{width:f+n,height:p+r}}getMaxSize(){let e=this.getContainer();if(!e)return null;let t=e.getPerimeterSize(),n=t.left+t.right,i=t.top+t.bottom,a=e.getLaidOutComponents(),o=this.getColRowCount(),s=o?o.width:1,c=o?o.height:1,l=this.getComponentSpacing(),u=this.measureContent(a,s,c),d=this._columnTracks.length>0?this.trackAxisMax(this._columnTracks,s,u.columns):s*this.maxChildExtent(a,!0),f=this._rowTracks.length>0?this.trackAxisMax(this._rowTracks,c,u.rows):c*this.maxChildExtent(a,!1);return{width:r(d+Math.max(0,s-1)*l+n),height:r(f+Math.max(0,c-1)*l+i)}}trackAxisMax(t,n,r){let i=0;for(let a=0;a<n;a+=1){let n=t[a]??{mode:`weight`,value:1};if(n.mode===`fixed`)i+=n.value??0;else if(n.mode===`content`)i+=r[a]??0;else return e}return i}maxChildExtent(t,r){let i=0;for(let a of t){let t=a.getMaxSize();if(!t)return e;let o=r?t.width:t.height;if(n(o))return e;i=Math.max(i,o)}return i}computeTotalMinSize(){let e=this.getContainer();if(!e)return{width:0,height:0};let t=e.getLaidOutComponents();if(t.length===0)return{width:0,height:0};let n=this.getColRowCount(),r=n?n.width:1,i=n?n.height:1,a=this.getComponentSpacing(),o=0,s=0;for(let e of t){let t=e.getMinSize();t&&(o=Math.max(o,t.width),s=Math.max(s,t.height))}let c=this.measureContent(t,r,i),l=this._columnTracks.length>0?this.trackAxisExtent(this._columnTracks,r,c.columns,!1):r*o,u=this._rowTracks.length>0?this.trackAxisExtent(this._rowTracks,i,c.rows,!1):i*s;return{width:l+Math.max(0,r-1)*a,height:u+Math.max(0,i-1)*a}}trackAxisExtent(e,t,n,r){let i=0;for(let a=0;a<t;a+=1){let t=e[a]??{mode:`weight`,value:1};t.mode===`fixed`?i+=t.value??0:(t.mode===`content`||r)&&(i+=n[a]??0)}return i}doLayout(){let e=this.getContainer();if(!e)return;let n=e.getLaidOutComponents(),r=e.getContentInsets(),i=e.getInnerSize();if(!i)return;let a=this.getColRowCount(),o=a?a.width:1,s=a?a.height:1,c=this.getComponentSpacing();if(i=this.inflateForOverflow(i),!this._baselineAlign){this.layoutOccupancy(n,o,s,i,r,c);return}let l=this.measureContent(n,o,s),u=this.resolveTracks(this._columnTracks,o,i.width,c,l.columns),d=this.resolveTracks(this._rowTracks,s,i.height,c,l.rows),f=Array.from({length:s},()=>[]),p=0,m=0;for(let e of n){if(m>=s)break;let n=this.getLayoutConstraints(e),r=t.clamp(n?.colSpan??1,1,o),i=e.getPreferredSize();f[m].push({component:e,col:p,colSpan:r,height:i?i.height:0,baseline:e.getBaseline()}),p+=r,p>=o&&(p=0,m+=1)}let h=r.getTop();for(let e=0;e<s;e+=1){let t=f[e],{rowAscent:n,rowDescent:i}=this.computeRowMetrics(t.map(e=>e.height),t.map(e=>e.baseline));for(let e of t){let t=r.getLeft();for(let n=0;n<e.col;n+=1)t+=(u[n]??0)+c;let a=(e.colSpan-1)*c;for(let t=e.col;t<e.col+e.colSpan;t+=1)a+=u[t]??0;let o;o=n===null?h:e.baseline===null?h+this.nullChildY(e.height,n,i):h+(n-e.baseline),this.placeComponent(e.component,t,o,a,e.height,this._defaultFill,this._defaultAnchor)}let a=n===null?0:n+i;h+=Math.max(d[e]??0,a)+c}}resolveTracks(e,t,n,r,i){let a=n-Math.max(0,t-1)*r,o=Array(t).fill(0),s=0,c=0,l=0;for(let n=0;n<t;n+=1){let t=e[n]??{mode:`weight`,value:1};t.mode===`fixed`?(o[n]=t.value??0,s+=o[n]):t.mode===`content`?(o[n]=i[n]??0,c+=o[n]):l+=Math.max(0,t.value??1)}let u=Math.max(0,a-s-c);if(l>0)for(let n=0;n<t;n+=1){let t=e[n]??{mode:`weight`,value:1};t.mode===`weight`&&(o[n]=u*(Math.max(0,t.value??1)/l))}return o}measureContent(e,n,r){let i=Array(n).fill(0),a=Array(r).fill(0),o=this._baselineAlign?Array.from({length:r},()=>[]):[],s=this._baselineAlign?Array.from({length:r},()=>[]):[],c=0,l=0;for(let u of e){let e=this.getLayoutConstraints(u),d=u.getPreferredSize(),f=u.getMinSize(),p=Math.max(d?d.width:0,f?f.width:0),m=Math.max(d?d.height:0,f?f.height:0),h=Math.max(1,e?.colSpan??1),g=Math.max(1,e?.rowSpan??1),_,v;e&&(e.col!=null||e.row!=null)?(_=t.clamp(e.col??0,0,Math.max(0,n-1)),v=t.clamp(e.row??0,0,Math.max(0,r-1))):(_=c,v=l,c+=h,c>=n&&(c=0,l+=g)),h===1&&_<n&&(i[_]=Math.max(i[_],p)),g===1&&v<r&&(a[v]=Math.max(a[v],m),this._baselineAlign&&(o[v].push(d?d.height:0),s[v].push(u.getBaseline())))}if(this._baselineAlign)for(let e=0;e<r;e+=1){let{rowAscent:t,rowDescent:n}=this.computeRowMetrics(o[e],s[e]);t!==null&&(a[e]=Math.max(a[e],t+n))}return{columns:i,rows:a}}layoutOccupancy(e,n,r,i,a,o){let s=this.measureContent(e,n,r),c=this.resolveTracks(this._columnTracks,n,i.width,o,s.columns),l=this.resolveTracks(this._rowTracks,r,i.height,o,s.rows),u=[];for(let e=0;e<r;e+=1)u.push(Array(n).fill(!1));let d=[];for(let e=0;e<r;e+=1)d.push(Array(n).fill(null));let placeAt=(e,t,n,r,i)=>{let s=a.getLeft();for(let e=0;e<n;e+=1)s+=c[e]+o;let u=a.getTop();for(let e=0;e<t;e+=1)u+=l[e]+o;let d=(i-1)*o;for(let e=n;e<n+i;e+=1)d+=c[e]??0;let f=(r-1)*o;for(let e=t;e<t+r;e+=1)f+=l[e]??0;let p=e.getMinSize();if(p&&(p.width>d||p.height>f)){let t=this.resolveBounds(e,s,u,d,f,this._defaultFill,this._defaultAnchor),n=e.getPreferredSize(),r=p.width>d?n?n.width:p.width:t.width,i=p.height>f?n?n.height:p.height:t.height;e.setClipFrame(s,u,d,f),this.commitBounds(e,t.x-s,t.y-u,r,i)}else{let t=this.resolveBounds(e,s,u,d,f,this._defaultFill,this._defaultAnchor);e.clearClipFrame(),this.commitBounds(e,t.x,t.y,t.width,t.height)}};for(let i of e){let e=this.getLayoutConstraints(i);if(!e||e.col==null&&e.row==null)continue;let a=t.clamp(e.col??0,0,Math.max(0,n-1)),o=t.clamp(e.row??0,0,Math.max(0,r-1)),s=t.clamp(e.colSpan??1,1,n-a),c=t.clamp(e.rowSpan??1,1,r-o);for(let e=o;e<o+c;e+=1)for(let t=a;t<a+s;t+=1)u[e][t]&&console.warn(`Grid: ${i.getId()} overlaps ${d[e][t]} at cell (${e},${t})`),u[e][t]=!0,d[e][t]=i.getId();placeAt(i,o,a,c,s)}for(let i of e){let e=this.getLayoutConstraints(i);if(e&&(e.col!=null||e.row!=null))continue;let a=t.clamp(e?.colSpan??1,1,n),o=t.clamp(e?.rowSpan??1,1,r),s=this.findFreeCell(u,r,n,o,a);if(s){for(let e=s.r;e<s.r+o;e+=1)for(let t=s.c;t<s.c+a;t+=1)u[e][t]=!0,d[e][t]=i.getId();placeAt(i,s.r,s.c,o,a)}}}findFreeCell(e,t,n,r,i){for(let a=0;a+r<=t;a+=1)for(let t=0;t+i<=n;t+=1){let n=!0;for(let o=a;o<a+r&&n;o+=1)for(let r=t;r<t+i;r+=1)if(e[o][r]){n=!1;break}if(n)return{r:a,c:t}}return null}},c=a(Grid);export{c as t};
2
- //# sourceMappingURL=Grid-DdL9TVeJ.js.map
1
+ import{a as e,l as t,o as n,s as r}from"./Position-DRSlWn4Z.js";import{d as i,f as a,m as o,p as s}from"./Component-CHTzJxEf.js";var Grid=class extends i{_rows=0;_columns=0;_spacing=5;_defaultFill=s.BOTH;_defaultAnchor=a.CENTER;_baselineAlign=!1;_columnTracks=[];_rowTracks=[];constructor(e){super(),e&&this.applyOptions(e)}applyOptions(e){super.applyOptions(e),e.rows!==void 0&&this.setRows(e.rows),e.columns!==void 0&&this.setColumns(e.columns),e.spacing!==void 0&&this.setComponentSpacing(e.spacing),e.defaultFill!==void 0&&this.setDefaultFill(e.defaultFill),e.defaultAnchor!==void 0&&this.setDefaultAnchor(e.defaultAnchor),e.baselineAlign!==void 0&&this.setBaselineAlign(e.baselineAlign),e.columnTracks!==void 0&&this.setColumnTracks(e.columnTracks),e.rowTracks!==void 0&&this.setRowTracks(e.rowTracks)}getDefaultFill(){return this._defaultFill}setDefaultFill(e){return this._defaultFill=e,this}getDefaultAnchor(){return this._defaultAnchor}setDefaultAnchor(e){return this._defaultAnchor=e,this}isBaselineAlign(){return this._baselineAlign}setBaselineAlign(e){return this._baselineAlign=e,this}getRows(){return this._rows}setRows(e){return this._rows=e,this}getComponentSpacing(){return this._spacing||0}setComponentSpacing(e){return this._spacing=e||0,this}getColumns(){return this._columns}setColumns(e){return this._columns=e,this}getColumnTracks(){return this._columnTracks}setColumnTracks(e){return this._columnTracks=e,this}getRowTracks(){return this._rowTracks}setRowTracks(e){return this._rowTracks=e,this}getColRowCount(){let e=this.getContainer();if(!e)return;let t=e.getLaidOutComponents().length,n=0,r=0;return!this._rows&&!this._columns?(r=Math.floor(Math.sqrt(t)),n=Math.ceil(t/r)):this._rows&&this._columns?(n=this._rows,r=this._columns):this._columns?(r=this._columns,n=Math.ceil(t/r)):(n=this._rows,r=Math.ceil(t/n)),{width:r,height:n}}getPreferredSize(){let e=this.getContainer();if(!e)return null;let t=e.getPerimeterSize(),n=t.left+t.right,r=t.top+t.bottom,i=e.getLaidOutComponents(),a=0,o=0;for(let e of i){let t=e.getPreferredSize();t&&(a=Math.max(a,t.width),o=Math.max(o,t.height))}let s=this.getColRowCount(),c=s?s.width:1,l=s?s.height:1,u=this.getComponentSpacing(),d=this.measureContent(i,c,l),f=this._columnTracks.length>0?this.trackAxisExtent(this._columnTracks,c,d.columns,!0):a*c,p=this._rowTracks.length>0?this.trackAxisExtent(this._rowTracks,l,d.rows,!0):o*l;return f+=Math.max(0,c-1)*u,p+=Math.max(0,l-1)*u,{width:f+n,height:p+r}}getMinSize(){let e=this.getContainer();if(!e)return null;let t=e.getPerimeterSize(),n=t.left+t.right,r=t.top+t.bottom,i=e.getLaidOutComponents(),a=0,o=0;for(let e of i){let t=e.getMinSize();t&&(a=Math.max(a,t.width),o=Math.max(o,t.height))}let s=this.getColRowCount(),c=s?s.width:1,l=s?s.height:1,u=this.getComponentSpacing(),d=this.measureContent(i,c,l),f=this._columnTracks.length>0?this.trackAxisExtent(this._columnTracks,c,d.columns,!1):a*c,p=this._rowTracks.length>0?this.trackAxisExtent(this._rowTracks,l,d.rows,!1):o*l;return f+=Math.max(0,c-1)*u,p+=Math.max(0,l-1)*u,{width:f+n,height:p+r}}getMaxSize(){let e=this.getContainer();if(!e)return null;let t=e.getPerimeterSize(),n=t.left+t.right,i=t.top+t.bottom,a=e.getLaidOutComponents(),o=this.getColRowCount(),s=o?o.width:1,c=o?o.height:1,l=this.getComponentSpacing(),u=this.measureContent(a,s,c),d=this._columnTracks.length>0?this.trackAxisMax(this._columnTracks,s,u.columns):s*this.maxChildExtent(a,!0),f=this._rowTracks.length>0?this.trackAxisMax(this._rowTracks,c,u.rows):c*this.maxChildExtent(a,!1);return{width:r(d+Math.max(0,s-1)*l+n),height:r(f+Math.max(0,c-1)*l+i)}}trackAxisMax(t,n,r){let i=0;for(let a=0;a<n;a+=1){let n=t[a]??{mode:`weight`,value:1};if(n.mode===`fixed`)i+=n.value??0;else if(n.mode===`content`)i+=r[a]??0;else return e}return i}maxChildExtent(t,r){let i=0;for(let a of t){let t=a.getMaxSize();if(!t)return e;let o=r?t.width:t.height;if(n(o))return e;i=Math.max(i,o)}return i}computeTotalMinSize(){let e=this.getContainer();if(!e)return{width:0,height:0};let t=e.getLaidOutComponents();if(t.length===0)return{width:0,height:0};let n=this.getColRowCount(),r=n?n.width:1,i=n?n.height:1,a=this.getComponentSpacing(),o=0,s=0;for(let e of t){let t=e.getMinSize();t&&(o=Math.max(o,t.width),s=Math.max(s,t.height))}let c=this.measureContent(t,r,i),l=this._columnTracks.length>0?this.trackAxisExtent(this._columnTracks,r,c.columns,!1):r*o,u=this._rowTracks.length>0?this.trackAxisExtent(this._rowTracks,i,c.rows,!1):i*s;return{width:l+Math.max(0,r-1)*a,height:u+Math.max(0,i-1)*a}}trackAxisExtent(e,t,n,r){let i=0;for(let a=0;a<t;a+=1){let t=e[a]??{mode:`weight`,value:1};t.mode===`fixed`?i+=t.value??0:(t.mode===`content`||r)&&(i+=n[a]??0)}return i}doLayout(){let e=this.getContainer();if(!e)return;let n=e.getLaidOutComponents(),r=e.getContentInsets(),i=e.getInnerSize();if(!i)return;let a=this.getColRowCount(),o=a?a.width:1,s=a?a.height:1,c=this.getComponentSpacing();if(i=this.inflateForOverflow(i),!this._baselineAlign){this.layoutOccupancy(n,o,s,i,r,c);return}let l=this.measureContent(n,o,s),u=this.resolveTracks(this._columnTracks,o,i.width,c,l.columns),d=this.resolveTracks(this._rowTracks,s,i.height,c,l.rows),f=Array.from({length:s},()=>[]),p=0,m=0;for(let e of n){if(m>=s)break;let n=this.getLayoutConstraints(e),r=t.clamp(n?.colSpan??1,1,o),i=e.getPreferredSize();f[m].push({component:e,col:p,colSpan:r,height:i?i.height:0,baseline:e.getBaseline()}),p+=r,p>=o&&(p=0,m+=1)}let h=r.getTop();for(let e=0;e<s;e+=1){let t=f[e],{rowAscent:n,rowDescent:i}=this.computeRowMetrics(t.map(e=>e.height),t.map(e=>e.baseline));for(let e of t){let t=r.getLeft();for(let n=0;n<e.col;n+=1)t+=(u[n]??0)+c;let a=(e.colSpan-1)*c;for(let t=e.col;t<e.col+e.colSpan;t+=1)a+=u[t]??0;let o;o=n===null?h:e.baseline===null?h+this.nullChildY(e.height,n,i):h+(n-e.baseline),this.placeComponent(e.component,t,o,a,e.height,this._defaultFill,this._defaultAnchor)}let a=n===null?0:n+i;h+=Math.max(d[e]??0,a)+c}}resolveTracks(e,t,n,r,i){let a=n-Math.max(0,t-1)*r,o=Array(t).fill(0),s=0,c=0,l=0;for(let n=0;n<t;n+=1){let t=e[n]??{mode:`weight`,value:1};t.mode===`fixed`?(o[n]=t.value??0,s+=o[n]):t.mode===`content`?(o[n]=i[n]??0,c+=o[n]):l+=Math.max(0,t.value??1)}let u=Math.max(0,a-s-c);if(l>0)for(let n=0;n<t;n+=1){let t=e[n]??{mode:`weight`,value:1};t.mode===`weight`&&(o[n]=u*(Math.max(0,t.value??1)/l))}return o}measureContent(e,n,r){let i=Array(n).fill(0),a=Array(r).fill(0),o=this._baselineAlign?Array.from({length:r},()=>[]):[],s=this._baselineAlign?Array.from({length:r},()=>[]):[],c=0,l=0;for(let u of e){let e=this.getLayoutConstraints(u),d=u.getPreferredSize(),f=u.getMinSize(),p=Math.max(d?d.width:0,f?f.width:0),m=Math.max(d?d.height:0,f?f.height:0),h=Math.max(1,e?.colSpan??1),g=Math.max(1,e?.rowSpan??1),_,v;e&&(e.col!=null||e.row!=null)?(_=t.clamp(e.col??0,0,Math.max(0,n-1)),v=t.clamp(e.row??0,0,Math.max(0,r-1))):(_=c,v=l,c+=h,c>=n&&(c=0,l+=g)),h===1&&_<n&&(i[_]=Math.max(i[_],p)),g===1&&v<r&&(a[v]=Math.max(a[v],m),this._baselineAlign&&(o[v].push(d?d.height:0),s[v].push(u.getBaseline())))}if(this._baselineAlign)for(let e=0;e<r;e+=1){let{rowAscent:t,rowDescent:n}=this.computeRowMetrics(o[e],s[e]);t!==null&&(a[e]=Math.max(a[e],t+n))}return{columns:i,rows:a}}layoutOccupancy(e,n,r,i,a,o){let s=this.measureContent(e,n,r),c=this.resolveTracks(this._columnTracks,n,i.width,o,s.columns),l=this.resolveTracks(this._rowTracks,r,i.height,o,s.rows),u=[];for(let e=0;e<r;e+=1)u.push(Array(n).fill(!1));let d=[];for(let e=0;e<r;e+=1)d.push(Array(n).fill(null));let placeAt=(e,t,n,r,i)=>{let s=a.getLeft();for(let e=0;e<n;e+=1)s+=c[e]+o;let u=a.getTop();for(let e=0;e<t;e+=1)u+=l[e]+o;let d=(i-1)*o;for(let e=n;e<n+i;e+=1)d+=c[e]??0;let f=(r-1)*o;for(let e=t;e<t+r;e+=1)f+=l[e]??0;let p=e.getMinSize();if(p&&(p.width>d||p.height>f)){let t=this.resolveBounds(e,s,u,d,f,this._defaultFill,this._defaultAnchor),n=e.getPreferredSize(),r=p.width>d?n?n.width:p.width:t.width,i=p.height>f?n?n.height:p.height:t.height;e.setClipFrame(s,u,d,f),this.commitBounds(e,t.x-s,t.y-u,r,i)}else{let t=this.resolveBounds(e,s,u,d,f,this._defaultFill,this._defaultAnchor);e.clearClipFrame(),this.commitBounds(e,t.x,t.y,t.width,t.height)}};for(let i of e){let e=this.getLayoutConstraints(i);if(!e||e.col==null&&e.row==null)continue;let a=t.clamp(e.col??0,0,Math.max(0,n-1)),o=t.clamp(e.row??0,0,Math.max(0,r-1)),s=t.clamp(e.colSpan??1,1,n-a),c=t.clamp(e.rowSpan??1,1,r-o);for(let e=o;e<o+c;e+=1)for(let t=a;t<a+s;t+=1)u[e][t]&&console.warn(`Grid: ${i.getId()} overlaps ${d[e][t]} at cell (${e},${t})`),u[e][t]=!0,d[e][t]=i.getId();placeAt(i,o,a,c,s)}for(let i of e){let e=this.getLayoutConstraints(i);if(e&&(e.col!=null||e.row!=null))continue;let a=t.clamp(e?.colSpan??1,1,n),o=t.clamp(e?.rowSpan??1,1,r),s=this.findFreeCell(u,r,n,o,a);if(s){for(let e=s.r;e<s.r+o;e+=1)for(let t=s.c;t<s.c+a;t+=1)u[e][t]=!0,d[e][t]=i.getId();placeAt(i,s.r,s.c,o,a)}}}findFreeCell(e,t,n,r,i){for(let a=0;a+r<=t;a+=1)for(let t=0;t+i<=n;t+=1){let n=!0;for(let o=a;o<a+r&&n;o+=1)for(let r=t;r<t+i;r+=1)if(e[o][r]){n=!1;break}if(n)return{r:a,c:t}}return null}},c=o(Grid);export{c as t};
2
+ //# sourceMappingURL=Grid-BXS2T8MT.js.map