@jimka/typescript-ui 0.4.1 → 0.5.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 (194) hide show
  1. package/dist/lib/{AbstractBooleanInput-DE5NNJT0.js → AbstractBooleanInput-CbW7ZrDT.js} +2 -2
  2. package/dist/lib/{AbstractBooleanInput-DE5NNJT0.js.map → AbstractBooleanInput-CbW7ZrDT.js.map} +1 -1
  3. package/dist/lib/{AbstractInput-BxfrmD2W.js → AbstractInput-B10DfLOf.js} +2 -2
  4. package/dist/lib/{AbstractInput-BxfrmD2W.js.map → AbstractInput-B10DfLOf.js.map} +1 -1
  5. package/dist/lib/Anchor-BsblS5it.js +2 -0
  6. package/dist/lib/Anchor-BsblS5it.js.map +1 -0
  7. package/dist/lib/AnchorConstraints-Bfkt8019.js +2 -0
  8. package/dist/lib/AnchorConstraints-Bfkt8019.js.map +1 -0
  9. package/dist/lib/{AnimatedDropdown-QLNasu_Y.js → AnimatedDropdown-kL47HPGP.js} +2 -2
  10. package/dist/lib/{AnimatedDropdown-QLNasu_Y.js.map → AnimatedDropdown-kL47HPGP.js.map} +1 -1
  11. package/dist/lib/Border-CNS6aEXB.js +2 -0
  12. package/dist/lib/{Border-CKKUk5G9.js.map → Border-CNS6aEXB.js.map} +1 -1
  13. package/dist/lib/Button-T16zSZip.js +2 -0
  14. package/dist/lib/Button-T16zSZip.js.map +1 -0
  15. package/dist/lib/{Card-a4dzYrbX.js → Card-CD3jxshU.js} +2 -2
  16. package/dist/lib/{Card-a4dzYrbX.js.map → Card-CD3jxshU.js.map} +1 -1
  17. package/dist/lib/CodeEditor-BGlB232h.js +2 -0
  18. package/dist/lib/CodeEditor-BGlB232h.js.map +1 -0
  19. package/dist/lib/ComboBox-C9FYMuLv.js +2 -0
  20. package/dist/lib/ComboBox-C9FYMuLv.js.map +1 -0
  21. package/dist/lib/Component-w65rPK75.js +2 -0
  22. package/dist/lib/Component-w65rPK75.js.map +1 -0
  23. package/dist/lib/Container-C7RPLQEc.js +2 -0
  24. package/dist/lib/{Container-0bsG2Q8Z.js.map → Container-C7RPLQEc.js.map} +1 -1
  25. package/dist/lib/DOM-Ba8YRVel.js +2 -0
  26. package/dist/lib/{DOM-67StIm5G.js.map → DOM-Ba8YRVel.js.map} +1 -1
  27. package/dist/lib/DragManager-UvPHSoRm.js +2 -0
  28. package/dist/lib/{DragManager-DRor_-1x.js.map → DragManager-UvPHSoRm.js.map} +1 -1
  29. package/dist/lib/{FieldDecorator-Bpx8J8n9.js → FieldDecorator-HG65hEtk.js} +2 -2
  30. package/dist/lib/{FieldDecorator-Bpx8J8n9.js.map → FieldDecorator-HG65hEtk.js.map} +1 -1
  31. package/dist/lib/{Fit-CL1m1nIZ.js → Fit-Cg3dPyZg.js} +2 -2
  32. package/dist/lib/{Fit-CL1m1nIZ.js.map → Fit-Cg3dPyZg.js.map} +1 -1
  33. package/dist/lib/FloatingPanel-D5buuVrQ.js +2 -0
  34. package/dist/lib/FloatingPanel-D5buuVrQ.js.map +1 -0
  35. package/dist/lib/{Glyph-wN7bk7mg.js → Glyph-DeJF_zsR.js} +2 -2
  36. package/dist/lib/{Glyph-wN7bk7mg.js.map → Glyph-DeJF_zsR.js.map} +1 -1
  37. package/dist/lib/{Grid-DHHmaB-Y.js → Grid-BYBohJIA.js} +2 -2
  38. package/dist/lib/{Grid-DHHmaB-Y.js.map → Grid-BYBohJIA.js.map} +1 -1
  39. package/dist/lib/{GridConstraints-DVc1BmlP.js → GridConstraints-Bts284FI.js} +2 -2
  40. package/dist/lib/{GridConstraints-DVc1BmlP.js.map → GridConstraints-Bts284FI.js.map} +1 -1
  41. package/dist/lib/{Header-2hKwQo_u.js → Header-BIFJK9nR.js} +2 -2
  42. package/dist/lib/{Header-2hKwQo_u.js.map → Header-BIFJK9nR.js.map} +1 -1
  43. package/dist/lib/{IconText-DC7Xe34b.js → IconText-Dsb1xS-E.js} +2 -2
  44. package/dist/lib/{IconText-DC7Xe34b.js.map → IconText-Dsb1xS-E.js.map} +1 -1
  45. package/dist/lib/LanguageRegistry-CcVnbKuh.js +2 -0
  46. package/dist/lib/LanguageRegistry-CcVnbKuh.js.map +1 -0
  47. package/dist/lib/LayoutSerialization-ySzY1h2l.js +2 -0
  48. package/dist/lib/{LayoutSerialization-D5bBas4W.js.map → LayoutSerialization-ySzY1h2l.js.map} +1 -1
  49. package/dist/lib/LayoutSizes-DKDK1Cle.js +2 -0
  50. package/dist/lib/LayoutSizes-DKDK1Cle.js.map +1 -0
  51. package/dist/lib/List-BPd-IXZR.js +2 -0
  52. package/dist/lib/{List-CG4NvwuV.js.map → List-BPd-IXZR.js.map} +1 -1
  53. package/dist/lib/MemoryStore-BgP7-Uzn.js +2 -0
  54. package/dist/lib/{MemoryStore-DT6iWWco.js.map → MemoryStore-BgP7-Uzn.js.map} +1 -1
  55. package/dist/lib/Menu-C0roOCY7.js +2 -0
  56. package/dist/lib/Menu-C0roOCY7.js.map +1 -0
  57. package/dist/lib/{MenuButton-wy_0RskC.js → MenuButton-BR4KOFld.js} +2 -2
  58. package/dist/lib/{MenuButton-wy_0RskC.js.map → MenuButton-BR4KOFld.js.map} +1 -1
  59. package/dist/lib/Panel-CpNQTLNF.js +2 -0
  60. package/dist/lib/{Panel-Rd9zkNXx.js.map → Panel-CpNQTLNF.js.map} +1 -1
  61. package/dist/lib/{Position-Ck_KD4cR.js → Position-PBVBW1JS.js} +2 -2
  62. package/dist/lib/{Position-Ck_KD4cR.js.map → Position-PBVBW1JS.js.map} +1 -1
  63. package/dist/lib/{ProgressSpinner-yt-VXyCb.js → ProgressSpinner-lAsK26C-.js} +2 -2
  64. package/dist/lib/{ProgressSpinner-yt-VXyCb.js.map → ProgressSpinner-lAsK26C-.js.map} +1 -1
  65. package/dist/lib/RadioButton-CCcIaL54.js +2 -0
  66. package/dist/lib/RadioButton-CCcIaL54.js.map +1 -0
  67. package/dist/lib/{RovingTabIndex-DFJyoveq.js → RovingTabIndex-C2Vzq0IX.js} +2 -2
  68. package/dist/lib/{RovingTabIndex-DFJyoveq.js.map → RovingTabIndex-C2Vzq0IX.js.map} +1 -1
  69. package/dist/lib/Scrollbar-C3ZZyZ1e.js +2 -0
  70. package/dist/lib/Scrollbar-C3ZZyZ1e.js.map +1 -0
  71. package/dist/lib/Slider-DZ9drUxn.js +2 -0
  72. package/dist/lib/Slider-DZ9drUxn.js.map +1 -0
  73. package/dist/lib/{Spacer-qalSEJ5i.js → Spacer-SDhOMp2g.js} +2 -2
  74. package/dist/lib/{Spacer-qalSEJ5i.js.map → Spacer-SDhOMp2g.js.map} +1 -1
  75. package/dist/lib/TabButton-DNo4ZgV8.js +2 -0
  76. package/dist/lib/TabButton-DNo4ZgV8.js.map +1 -0
  77. package/dist/lib/Text-CdHf3B-1.js +2 -0
  78. package/dist/lib/Text-CdHf3B-1.js.map +1 -0
  79. package/dist/lib/{Tooltip-Dro4DOZs.js → Tooltip-B_UF5bXD.js} +2 -2
  80. package/dist/lib/{Tooltip-Dro4DOZs.js.map → Tooltip-B_UF5bXD.js.map} +1 -1
  81. package/dist/lib/Tree-C7qLbIYH.js +2 -0
  82. package/dist/lib/Tree-C7qLbIYH.js.map +1 -0
  83. package/dist/lib/VBox-32fxpkDl.js +2 -0
  84. package/dist/lib/VBox-32fxpkDl.js.map +1 -0
  85. package/dist/lib/{Validator-Du8PqS5i.js → Validator-Cjs1EU5Q.js} +2 -2
  86. package/dist/lib/{Validator-Du8PqS5i.js.map → Validator-Cjs1EU5Q.js.map} +1 -1
  87. package/dist/lib/{VirtualScroller-Bv4KXGKW.js → VirtualScroller-cvFNMS7U.js} +2 -2
  88. package/dist/lib/{VirtualScroller-Bv4KXGKW.js.map → VirtualScroller-cvFNMS7U.js.map} +1 -1
  89. package/dist/lib/component/button.es.js +1 -1
  90. package/dist/lib/component/chart.es.js +1 -1
  91. package/dist/lib/component/chart.es.js.map +1 -1
  92. package/dist/lib/component/container.es.js +1 -1
  93. package/dist/lib/component/container.es.js.map +1 -1
  94. package/dist/lib/component/diagram.es.js +1 -1
  95. package/dist/lib/component/diagram.es.js.map +1 -1
  96. package/dist/lib/component/display.es.js +1 -1
  97. package/dist/lib/component/display.es.js.map +1 -1
  98. package/dist/lib/component/editor.es.js +3 -3
  99. package/dist/lib/component/editor.es.js.map +1 -1
  100. package/dist/lib/component/input.es.js +1 -1
  101. package/dist/lib/component/input.es.js.map +1 -1
  102. package/dist/lib/component/list.es.js +1 -1
  103. package/dist/lib/component/list.es.js.map +1 -1
  104. package/dist/lib/component/menubar.es.js +1 -1
  105. package/dist/lib/component/menubar.es.js.map +1 -1
  106. package/dist/lib/component/table.es.js +2 -2
  107. package/dist/lib/component/table.es.js.map +1 -1
  108. package/dist/lib/component/tree.es.js +1 -1
  109. package/dist/lib/component/tree.es.js.map +1 -1
  110. package/dist/lib/core.es.js +1 -1
  111. package/dist/lib/core.es.js.map +1 -1
  112. package/dist/lib/data.es.js +1 -1
  113. package/dist/lib/glyphs/solid/index.es.js +1 -1
  114. package/dist/lib/languages-Dl8qdL8a.js +2 -0
  115. package/dist/lib/languages-Dl8qdL8a.js.map +1 -0
  116. package/dist/lib/layout.es.js +1 -1
  117. package/dist/lib/layout.es.js.map +1 -1
  118. package/dist/lib/overlay.es.js +1 -1
  119. package/dist/lib/overlay.es.js.map +1 -1
  120. package/dist/lib/primitive.es.js +1 -1
  121. package/dist/lib/router.es.js +1 -1
  122. package/dist/lib/router.es.js.map +1 -1
  123. package/dist/lib/selectionsEqual-BrTxPMmK.js +2 -0
  124. package/dist/lib/{selectionsEqual-Ci3_uflt.js.map → selectionsEqual-BrTxPMmK.js.map} +1 -1
  125. package/dist/lib/types/component/button/TabButton.d.ts +1 -1
  126. package/dist/lib/types/component/button/ToggleButton.d.ts +1 -1
  127. package/dist/lib/types/component/chart/ChartLegend.d.ts +1 -1
  128. package/dist/lib/types/component/container/FloatingPanel.d.ts +23 -0
  129. package/dist/lib/types/component/container/ScrollStrip.d.ts +1 -1
  130. package/dist/lib/types/component/container/Scrollbar.d.ts +1 -3
  131. package/dist/lib/types/component/container/TabBar.d.ts +1 -1
  132. package/dist/lib/types/component/container/index.d.ts +2 -0
  133. package/dist/lib/types/component/diagram/DiagramGroupNode.d.ts +1 -1
  134. package/dist/lib/types/component/display/Markdown.d.ts +42 -1
  135. package/dist/lib/types/component/display/MarkdownMinimap.d.ts +38 -0
  136. package/dist/lib/types/component/display/MarkdownViewer.d.ts +60 -0
  137. package/dist/lib/types/component/display/index.d.ts +6 -0
  138. package/dist/lib/types/component/editor/CodeEditor.d.ts +13 -0
  139. package/dist/lib/types/component/editor/index.d.ts +1 -1
  140. package/dist/lib/types/component/input/Checkbox.d.ts +1 -1
  141. package/dist/lib/types/component/input/RadioButton.d.ts +1 -1
  142. package/dist/lib/types/component/input/Slider.d.ts +1 -1
  143. package/dist/lib/types/component/input/Text.d.ts +0 -2
  144. package/dist/lib/types/component/input/Toggle.d.ts +1 -1
  145. package/dist/lib/types/component/menubar/MenuBar.d.ts +1 -1
  146. package/dist/lib/types/component/menubar/ToolBar.d.ts +1 -0
  147. package/dist/lib/types/component/table/Body.d.ts +1 -0
  148. package/dist/lib/types/component/table/cell/SortPriorityBadge.d.ts +1 -1
  149. package/dist/lib/types/component/table/cell/editor/CellEditorPool.d.ts +1 -0
  150. package/dist/lib/types/component/table/cell/editor/Date.d.ts +1 -0
  151. package/dist/lib/types/component/table/cell/editor/DateTime.d.ts +1 -0
  152. package/dist/lib/types/component/table/cell/editor/Time.d.ts +1 -0
  153. package/dist/lib/types/component/tree/Tree.d.ts +9 -1
  154. package/dist/lib/types/component/tree/index.d.ts +1 -1
  155. package/dist/lib/types/component/tree/renderer/Label.d.ts +1 -1
  156. package/dist/lib/types/core/Component.d.ts +5 -0
  157. package/dist/lib/types/core/Theme.d.ts +4 -2
  158. package/dist/lib/types/layout/LayoutManager.d.ts +8 -0
  159. package/dist/lib/validation.es.js +1 -1
  160. package/llms.txt +3 -0
  161. package/package.json +15 -15
  162. package/dist/lib/AnchorConstraints-DdDYSDkf.js +0 -2
  163. package/dist/lib/AnchorConstraints-DdDYSDkf.js.map +0 -1
  164. package/dist/lib/Border-CKKUk5G9.js +0 -2
  165. package/dist/lib/Button-MZDYJOMC.js +0 -2
  166. package/dist/lib/Button-MZDYJOMC.js.map +0 -1
  167. package/dist/lib/ComboBox-C04SfXAR.js +0 -2
  168. package/dist/lib/ComboBox-C04SfXAR.js.map +0 -1
  169. package/dist/lib/Component-fRQvgaEY.js +0 -2
  170. package/dist/lib/Component-fRQvgaEY.js.map +0 -1
  171. package/dist/lib/Container-0bsG2Q8Z.js +0 -2
  172. package/dist/lib/DOM-67StIm5G.js +0 -2
  173. package/dist/lib/DragManager-DRor_-1x.js +0 -2
  174. package/dist/lib/LayoutSerialization-D5bBas4W.js +0 -2
  175. package/dist/lib/LayoutSizes-qNaURyiw.js +0 -2
  176. package/dist/lib/LayoutSizes-qNaURyiw.js.map +0 -1
  177. package/dist/lib/List-CG4NvwuV.js +0 -2
  178. package/dist/lib/MemoryStore-DT6iWWco.js +0 -2
  179. package/dist/lib/Menu-CrZy2u0g.js +0 -2
  180. package/dist/lib/Menu-CrZy2u0g.js.map +0 -1
  181. package/dist/lib/Panel-Rd9zkNXx.js +0 -2
  182. package/dist/lib/RadioButton-D23rId-V.js +0 -2
  183. package/dist/lib/RadioButton-D23rId-V.js.map +0 -1
  184. package/dist/lib/Scrollbar-SOj9psiP.js +0 -2
  185. package/dist/lib/Scrollbar-SOj9psiP.js.map +0 -1
  186. package/dist/lib/Slider-DBnAZ-F7.js +0 -2
  187. package/dist/lib/Slider-DBnAZ-F7.js.map +0 -1
  188. package/dist/lib/TabButton-DKECTTk1.js +0 -2
  189. package/dist/lib/TabButton-DKECTTk1.js.map +0 -1
  190. package/dist/lib/Text-KB5LksJl.js +0 -2
  191. package/dist/lib/Text-KB5LksJl.js.map +0 -1
  192. package/dist/lib/VBox-P3WFGkPc.js +0 -2
  193. package/dist/lib/VBox-P3WFGkPc.js.map +0 -1
  194. package/dist/lib/selectionsEqual-Ci3_uflt.js +0 -2
@@ -0,0 +1,60 @@
1
+ import { Panel, PanelOptions } from "../../core/Panel.js";
2
+ import { Markdown } from "../../component/display/Markdown.js";
3
+ import type { MarkdownLinkResolver } from "../../component/display/Markdown.js";
4
+ import type { HeadingScrollSource } from "../../component/display/MarkdownMinimap.js";
5
+ export interface MarkdownViewerOptions extends PanelOptions {
6
+ markdown?: string;
7
+ linkResolver?: MarkdownLinkResolver;
8
+ maxHeadingDepth?: number;
9
+ showMinimap?: boolean;
10
+ showControls?: boolean;
11
+ listeners?: {
12
+ activeheadingchange?: (headingId: string | null) => void;
13
+ };
14
+ }
15
+ declare class MarkdownViewer extends Panel<MarkdownViewerOptions> implements HeadingScrollSource {
16
+ private readonly _markdown;
17
+ private readonly _minimap;
18
+ private _controls;
19
+ private _narrowerBtn;
20
+ private _widerBtn;
21
+ private _zoomOutBtn;
22
+ private _zoomInBtn;
23
+ private _resetBtn;
24
+ private _headings;
25
+ private _widthIndex;
26
+ private _zoomIndex;
27
+ private _lastActiveHeadingId;
28
+ private _pendingClickScrollTop;
29
+ private readonly _listeners;
30
+ private readonly handleNativeScroll;
31
+ private readonly handleMinimapSelect;
32
+ private readonly _onNarrower;
33
+ private readonly _onWider;
34
+ private readonly _onZoomOut;
35
+ private readonly _onZoomIn;
36
+ private readonly _onReset;
37
+ constructor(options?: MarkdownViewerOptions, subclassDefaults?: Partial<MarkdownViewerOptions>);
38
+ doLayout(): this;
39
+ protected applyOptions(options: MarkdownViewerOptions): this;
40
+ getMarkdown(): Markdown;
41
+ setMarkdown(markdown: string): this;
42
+ isMinimapVisible(): boolean;
43
+ setMinimapVisible(value: boolean): this;
44
+ isControlsVisible(): boolean;
45
+ setControlsVisible(value: boolean): this;
46
+ on(event: "activeheadingchange", listener: (headingId: string | null) => void): this;
47
+ off(event: "activeheadingchange", listener: (headingId: string | null) => void): this;
48
+ protected emit(event: "activeheadingchange", headingId: string | null): void;
49
+ private buildControls;
50
+ private makeControlButton;
51
+ private wireControlListeners;
52
+ private stepWidth;
53
+ private stepZoom;
54
+ private resetViewerProperties;
55
+ private onNativeScroll;
56
+ private scrollToHeading;
57
+ }
58
+ declare const MarkdownViewerCallable: import("../../core/Callable.js").Callable<typeof MarkdownViewer>;
59
+ type MarkdownViewerCallable = MarkdownViewer;
60
+ export { MarkdownViewer as _MarkdownViewer, MarkdownViewerCallable as MarkdownViewer, };
@@ -13,6 +13,12 @@ export { IconText } from '../../component/display/IconText.js';
13
13
  export type { IconTextOptions } from '../../component/display/IconText.js';
14
14
  export { Markdown } from '../../component/display/Markdown.js';
15
15
  export type { MarkdownOptions, MarkdownLinkResolution, MarkdownLinkResolver } from '../../component/display/Markdown.js';
16
+ export { extractMarkdownHeadings, findActiveHeading } from '../../component/display/Markdown.js';
17
+ export type { MarkdownHeading } from '../../component/display/Markdown.js';
18
+ export { MarkdownMinimap } from '../../component/display/MarkdownMinimap.js';
19
+ export type { MarkdownMinimapOptions, MarkdownMinimapEvent, HeadingScrollSource } from '../../component/display/MarkdownMinimap.js';
20
+ export { MarkdownViewer } from '../../component/display/MarkdownViewer.js';
21
+ export type { MarkdownViewerOptions } from '../../component/display/MarkdownViewer.js';
16
22
  export { IconLabel } from '../../component/display/IconLabel.js';
17
23
  export type { IconLabelOptions } from '../../component/display/IconLabel.js';
18
24
  export { ProgressBar } from '../../component/display/ProgressBar.js';
@@ -3,13 +3,18 @@ import type { Handle } from "../../core/DOM.js";
3
3
  export interface CodeEditorChange {
4
4
  value: string;
5
5
  }
6
+ export interface CodeEditorHeightChange {
7
+ height: number;
8
+ }
6
9
  export interface CodeEditorOptions extends ComponentOptions {
7
10
  value?: string;
8
11
  language?: string;
9
12
  readOnly?: boolean;
13
+ autoHeightMaxRows?: number;
10
14
  listeners?: {
11
15
  change?: (payload: CodeEditorChange) => void;
12
16
  readonlyedit?: () => void;
17
+ heightchange?: (payload: CodeEditorHeightChange) => void;
13
18
  };
14
19
  }
15
20
  declare class CodeEditor extends Component<CodeEditorOptions> {
@@ -22,6 +27,9 @@ declare class CodeEditor extends Component<CodeEditorOptions> {
22
27
  private readonly _listeners;
23
28
  private readonly _unsubscribeTheme;
24
29
  private _scrollElement;
30
+ private _contentElement;
31
+ private _lastSyncedShape;
32
+ private _lastHbarReserve;
25
33
  constructor(value?: string, options?: CodeEditorOptions, subclassDefaults?: Partial<CodeEditorOptions>);
26
34
  protected applyOptions(options: CodeEditorOptions): this;
27
35
  getValue(): string;
@@ -30,19 +38,24 @@ declare class CodeEditor extends Component<CodeEditorOptions> {
30
38
  setLanguage(id: string | null): this;
31
39
  getReadOnly(): boolean;
32
40
  setReadOnly(readOnly: boolean): this;
41
+ getAutoHeightMaxRows(): number | null;
33
42
  focus(preventScroll?: boolean): this;
34
43
  moveCursorToEnd(): this;
35
44
  format(): Promise<void>;
36
45
  private reindentFallback;
37
46
  on(event: "change", listener: (payload: CodeEditorChange) => void): this;
38
47
  on(event: "readonlyedit", listener: () => void): this;
48
+ on(event: "heightchange", listener: (payload: CodeEditorHeightChange) => void): this;
39
49
  off(event: "change", listener: (payload: CodeEditorChange) => void): this;
40
50
  off(event: "readonlyedit", listener: () => void): this;
51
+ off(event: "heightchange", listener: (payload: CodeEditorHeightChange) => void): this;
41
52
  protected emit(event: "change", payload: CodeEditorChange): void;
42
53
  protected emit(event: "readonlyedit"): void;
54
+ protected emit(event: "heightchange", payload: CodeEditorHeightChange): void;
43
55
  protected destructor(): void;
44
56
  protected getScrollElement(): Handle | undefined;
45
57
  private mount;
58
+ private syncAutoHeight;
46
59
  private mountFlashOverlay;
47
60
  private onThemeChange;
48
61
  private onEditIntent;
@@ -1,6 +1,6 @@
1
1
  import '../../component/editor/languages.js';
2
2
  export { CodeEditor } from '../../component/editor/CodeEditor.js';
3
- export type { CodeEditorOptions, CodeEditorChange } from '../../component/editor/CodeEditor.js';
3
+ export type { CodeEditorOptions, CodeEditorChange, CodeEditorHeightChange } from '../../component/editor/CodeEditor.js';
4
4
  export { registerLanguage, getLanguage, listLanguages } from '../../component/editor/LanguageRegistry.js';
5
5
  export type { LanguageDefinition, Formatter } from '../../component/editor/LanguageRegistry.js';
6
6
  export { MarkdownEditor } from '../../component/editor/MarkdownEditor.js';
@@ -15,7 +15,7 @@ declare class Checkbox<TOptions extends CheckboxOptions = CheckboxOptions> exten
15
15
  private _box;
16
16
  private _check;
17
17
  private _dash;
18
- constructor(options?: TOptions);
18
+ constructor(options?: CheckboxOptions, subclassDefaults?: Partial<CheckboxOptions>);
19
19
  protected applyOptions(options: TOptions): this;
20
20
  protected activate(): void;
21
21
  protected getInteractiveSurface(): Component;
@@ -15,7 +15,7 @@ export interface RadioButtonOptions extends AbstractBooleanInputOptions {
15
15
  declare class RadioButton<TOptions extends RadioButtonOptions = RadioButtonOptions> extends AbstractBooleanInput<TOptions> {
16
16
  private _ring;
17
17
  private _dot;
18
- constructor(text?: string, options?: TOptions);
18
+ constructor(text?: string, options?: RadioButtonOptions, subclassDefaults?: Partial<RadioButtonOptions>);
19
19
  protected applyOptions(options: TOptions): this;
20
20
  protected activate(): void;
21
21
  protected getInteractiveSurface(): Component;
@@ -22,7 +22,7 @@ declare class Slider<TOptions extends SliderOptions = SliderOptions> extends Abs
22
22
  private _activeTrack;
23
23
  private _thumb;
24
24
  private _draggingPointer;
25
- constructor(options?: TOptions);
25
+ constructor(options?: SliderOptions, subclassDefaults?: Partial<SliderOptions>);
26
26
  protected applyOptions(options: TOptions): this;
27
27
  getValue(): number;
28
28
  setValue(value: number): this;
@@ -32,8 +32,6 @@ declare class Text<TOptions extends TextOptions = TextOptions> extends Component
32
32
  private _measuredGeneration;
33
33
  private _wordBreak;
34
34
  private _lineClamp;
35
- private _textOverflow;
36
- private _truncate;
37
35
  constructor(text?: String, options?: NoInfer<TOptions>, subclassDefaults?: Partial<TOptions>);
38
36
  protected applyOptions(options: TOptions): this;
39
37
  private readThemeLineHeightPx;
@@ -6,7 +6,7 @@ export interface ToggleOptions extends AbstractBooleanInputOptions {
6
6
  declare class Toggle<TOptions extends ToggleOptions = ToggleOptions> extends AbstractBooleanInput<TOptions> {
7
7
  private _track;
8
8
  private _thumb;
9
- constructor(options?: TOptions);
9
+ constructor(options?: ToggleOptions, subclassDefaults?: Partial<ToggleOptions>);
10
10
  protected applyOptions(options: TOptions): this;
11
11
  protected activate(): void;
12
12
  protected getInteractiveSurface(): Component;
@@ -10,7 +10,7 @@ declare class MenuBar extends Component {
10
10
  private _quickSwitchActive;
11
11
  private _keydownListening;
12
12
  private readonly _onKeyDown;
13
- constructor(options?: MenuBarOptions);
13
+ constructor(options?: MenuBarOptions, subclassDefaults?: Partial<MenuBarOptions>);
14
14
  setMenus(menus: MenuConfig[]): this;
15
15
  protected destructor(): void;
16
16
  openMenu(index: number): this;
@@ -24,6 +24,7 @@ declare class ToolBar<TOptions extends ToolBarOptions = ToolBarOptions> extends
24
24
  constructor(options?: ToolBarOptions, subclassDefaults?: Partial<ToolBarOptions>);
25
25
  protected applyOptions(options: TOptions): this;
26
26
  setOrientation(value: AxisOrientation): this;
27
+ private applyOrientation;
27
28
  getOrientation(): AxisOrientation;
28
29
  setCompact(value: boolean): this;
29
30
  isCompact(): boolean;
@@ -75,6 +75,7 @@ declare class Body extends VirtualRowView<Row> {
75
75
  protected onScrollerTick(): void;
76
76
  private onFocus;
77
77
  getEditorPool(): CellEditorPool;
78
+ protected destructor(): void;
78
79
  doLayout(): this;
79
80
  renderWindow(bodyWidth?: number, columnWidths?: number[]): void;
80
81
  private renderWindowPass;
@@ -5,7 +5,7 @@ interface SortPriorityBadgeOptions extends ComponentOptions {
5
5
  }
6
6
  declare class SortPriorityBadge extends Component<SortPriorityBadgeOptions> {
7
7
  private _priority;
8
- constructor(options?: SortPriorityBadgeOptions);
8
+ constructor(options?: SortPriorityBadgeOptions, subclassDefaults?: Partial<SortPriorityBadgeOptions>);
9
9
  protected applyOptions(options: SortPriorityBadgeOptions): this;
10
10
  protected render(): Handle;
11
11
  getPriority(): number | null;
@@ -9,5 +9,6 @@ export declare class CellEditorPool {
9
9
  register(key: string, factory: CellEditorFactory): this;
10
10
  acquire(key: string, cell: Cell<any>): CellEditor<unknown> | null;
11
11
  release(): void;
12
+ dispose(): void;
12
13
  private wireListeners;
13
14
  }
@@ -5,6 +5,7 @@ declare class DateEditor extends TextInputCellEditor<Date | null> {
5
5
  private _animated;
6
6
  private _text;
7
7
  constructor();
8
+ protected destructor(): void;
8
9
  isEmpty(): boolean;
9
10
  getValue(): Date | null;
10
11
  setValue(value: Date | null): this;
@@ -7,6 +7,7 @@ declare class DateTimeEditor extends TextInputCellEditor<Date | null> {
7
7
  private _animated;
8
8
  private _text;
9
9
  constructor(showSeconds?: boolean);
10
+ protected destructor(): void;
10
11
  retainsFocus(relatedTarget: Handle | null): boolean;
11
12
  isEmpty(): boolean;
12
13
  getValue(): Date | null;
@@ -6,6 +6,7 @@ declare class TimeEditor extends TextInputCellEditor<Date | null> {
6
6
  private _animated;
7
7
  private _text;
8
8
  constructor(showSeconds?: boolean);
9
+ protected destructor(): void;
9
10
  isEmpty(): boolean;
10
11
  getValue(): Date | null;
11
12
  setValue(value: Date | null): this;
@@ -1,11 +1,14 @@
1
1
  import { ComponentOptions } from "../../core/Component.js";
2
2
  import type { Handle } from "../../core/DOM.js";
3
+ import type { Size } from "../../primitive/Size.js";
3
4
  import { VirtualRowView } from "../../component/shared/VirtualRowView.js";
4
5
  import { TreeNode } from "../../component/tree/TreeNode.js";
5
6
  import { TreeRow } from "../../component/tree/TreeRow.js";
6
7
  import { TreeNodeRenderer } from "../../component/tree/TreeNodeRenderer.js";
7
8
  export type TreeEvent = "selection" | "loaderror" | "contextmenu" | "dblclick";
9
+ export type TreeRowOverflow = "scroll" | "clip";
8
10
  export interface TreeOptions extends ComponentOptions {
11
+ rowOverflow?: TreeRowOverflow;
9
12
  listeners?: {
10
13
  selection?: (nodes: TreeNode[]) => void;
11
14
  loaderror?: (node: TreeNode, error: unknown) => void;
@@ -26,7 +29,11 @@ declare class Tree extends VirtualRowView<TreeRow, TreeOptions> {
26
29
  private _focusNode;
27
30
  private _listeners;
28
31
  private _rendererFactory;
29
- constructor(options?: TreeOptions);
32
+ constructor(options?: TreeOptions, subclassDefaults?: Partial<TreeOptions>);
33
+ protected applyOptions(options: TreeOptions): this;
34
+ getRowOverflow(): TreeRowOverflow;
35
+ setRowOverflow(rowOverflow: TreeRowOverflow): this;
36
+ getPreferredSize(): Size | null;
30
37
  setNodes(nodes: TreeNode[]): this;
31
38
  expandAll(): this;
32
39
  protected getRowHeight(): number;
@@ -52,6 +59,7 @@ declare class Tree extends VirtualRowView<TreeRow, TreeOptions> {
52
59
  private _isExpandable;
53
60
  private _flatten;
54
61
  private _reflattenAndRender;
62
+ expandNode(node: TreeNode): this;
55
63
  private _onToggle;
56
64
  private _loadAndExpand;
57
65
  private _notifySelectionChange;
@@ -1,5 +1,5 @@
1
1
  export { Tree } from '../../component/tree/Tree.js';
2
- export type { TreeOptions, TreeEvent } from '../../component/tree/Tree.js';
2
+ export type { TreeOptions, TreeEvent, TreeRowOverflow } from '../../component/tree/Tree.js';
3
3
  export type { TreeNode } from '../../component/tree/TreeNode.js';
4
4
  export type { TreeNodeRenderContext } from '../../component/tree/TreeNodeRenderContext.js';
5
5
  export { TreeNodeRenderer } from '../../component/tree/TreeNodeRenderer.js';
@@ -8,6 +8,6 @@ export declare class LabelTreeNodeRenderer extends TreeNodeRenderer {
8
8
  getLabel(): Text;
9
9
  update(context: TreeNodeRenderContext): void;
10
10
  getContentWidth(): number;
11
- layoutChildren(_width: number, height: number): void;
11
+ layoutChildren(width: number, height: number): void;
12
12
  protected init(element?: Handle): this;
13
13
  }
@@ -95,6 +95,8 @@ declare class Component<TOptions extends ComponentOptions = ComponentOptions> ex
95
95
  private _contain;
96
96
  private _animation;
97
97
  private _lastEffectiveVisible;
98
+ private _pendingRematerialize;
99
+ private _refocusOnRematerialize;
98
100
  private _animationPlayState;
99
101
  private _outline;
100
102
  private _appearance;
@@ -142,6 +144,7 @@ declare class Component<TOptions extends ComponentOptions = ComponentOptions> ex
142
144
  getElement(createIfMissing?: boolean): Handle | undefined;
143
145
  protected getScrollElement(): Handle | undefined;
144
146
  removeElement(): this;
147
+ release(): boolean;
145
148
  setClipFrame(x: number, y: number, width: number, height: number): this;
146
149
  clearClipFrame(): this;
147
150
  private createFrame;
@@ -268,6 +271,7 @@ declare class Component<TOptions extends ComponentOptions = ComponentOptions> ex
268
271
  getWidth(): number;
269
272
  setWidth(width: number): this;
270
273
  protected clampsToContentSize(): boolean;
274
+ protected canRelease(): boolean;
271
275
  private clampWidth;
272
276
  getHeight(): number;
273
277
  setHeight(height: number): this;
@@ -280,6 +284,7 @@ declare class Component<TOptions extends ComponentOptions = ComponentOptions> ex
280
284
  getScrollTop(): number;
281
285
  setScrollLeft(value: number): this;
282
286
  setScrollTop(value: number): this;
287
+ private restoreReleasedState;
283
288
  syncScrollOffsets(): this;
284
289
  getMaxScrollLeft(): number;
285
290
  getMaxScrollTop(): number;
@@ -317,12 +317,10 @@ export interface Theme {
317
317
  };
318
318
  };
319
319
  drawer: {
320
- background: string;
321
320
  shadow: string;
322
321
  border: string;
323
322
  };
324
323
  rail: {
325
- background: string;
326
324
  border: string;
327
325
  shadow: string;
328
326
  handle: {
@@ -450,6 +448,10 @@ export interface Theme {
450
448
  scroll: {
451
449
  shadowColor: string;
452
450
  };
451
+ markdown: {
452
+ lineHeight: string;
453
+ maxMeasure: string;
454
+ };
453
455
  chart: {
454
456
  series: string[];
455
457
  axis: string;
@@ -7,6 +7,13 @@ import type { ComponentFactory } from "../core/Component.js";
7
7
  import { BaseObject } from "../core/BaseObject.js";
8
8
  export interface LayoutManagerOptions {
9
9
  }
10
+ export interface ResolvedPlacement {
11
+ component: Component;
12
+ x: number;
13
+ y: number;
14
+ width: number;
15
+ height: number;
16
+ }
10
17
  export declare abstract class LayoutManager extends BaseObject {
11
18
  private _container;
12
19
  private _layoutConstraints;
@@ -37,6 +44,7 @@ export declare abstract class LayoutManager extends BaseObject {
37
44
  height: number;
38
45
  };
39
46
  protected commitBounds(component: Component, x: number, y: number, width: number, height: number): void;
47
+ protected commitPlacements(placements: ResolvedPlacement[]): void;
40
48
  setLayoutConstraints(component: Component, constraints?: LayoutConstraints): LayoutConstraints | undefined;
41
49
  delLayoutConstraints(component: Component): LayoutConstraints | undefined;
42
50
  getLayoutConstraints(component: Component): LayoutConstraints | undefined;
@@ -1 +1 @@
1
- import{t as e}from"./FieldDecorator-Bpx8J8n9.js";export{e as FieldDecorator};
1
+ import{t as e}from"./FieldDecorator-HG65hEtk.js";export{e as FieldDecorator};
package/llms.txt CHANGED
@@ -31,6 +31,7 @@ Organized by task. Columns: task → symbol · import subpath · summary · docs
31
31
  - Bottom status bar with segments → **StatusBar** · `@jimka/typescript-ui/component/container` · A thin horizontal strip mounted at the bottom of a window or panel that surfaces a transient status message and small persistent indicators. · docs/components/StatusBar.md
32
32
  - Virtualize a huge child list (render only visible rows) → **VirtualScroller** · `@jimka/typescript-ui/component/container` · Shared scroll machinery for transform-based virtual lists (e.g. table body, tree). Owns the rows-container element, two custom Scrollbar ov… · docs/components/VirtualScroller.md
33
33
  - Mutually-exclusive group of toggle buttons → **ButtonGroup** · `@jimka/typescript-ui/overlay` · Manages mutual exclusivity among a set of RadioButton or ToggleButton instances. · docs/components/ButtonGroup.md
34
+ - Corner-pinned floating panel → **FloatingPanel** · `@jimka/typescript-ui/component/container` · A `Panel` that pins itself to one corner of its host's inner box, via an owned AnchorConstraints instance. · docs/components/FloatingPanel.md
34
35
 
35
36
  ### Inputs / Forms
36
37
  - Semantic <form> container with submit handling → **Form** · `@jimka/typescript-ui/core` · A Panel that bakes the semantic `<form>` tag and wires the native `submit` event to a single `onSubmit` callback. · docs/components/Form.md
@@ -68,6 +69,8 @@ Organized by task. Columns: task → symbol · import subpath · summary · docs
68
69
  - Font-Awesome icon glyph → **Glyph** · `@jimka/typescript-ui/component/display` · A small icon rendered from the internal `Glyphs` registry. · docs/components/Glyph.md
69
70
  - Icon paired with a label → **IconLabel** · `@jimka/typescript-ui/component/display` · A small composite pairing a leading `Glyph` with a trailing `Label`, laid out horizontally with a configurable gap (default 2). · docs/components/IconLabel.md
70
71
  - Render a Markdown string as formatted content → **Markdown** · `@jimka/typescript-ui/component/display` · A display component that renders a Markdown source string as a live DOM subtree. · docs/components/Markdown.md
72
+ - Floating heading-outline minimap → **MarkdownMinimap** · `@jimka/typescript-ui/component/display` · A floating card showing a document's heading outline as a `Tree`. · docs/components/MarkdownMinimap.md
73
+ - Markdown viewer with minimap and zoom controls → **MarkdownViewer** · `@jimka/typescript-ui/component/display` · A single-document Markdown viewer with a floating outline minimap and width/zoom controls, both pinned over the prose. · docs/components/MarkdownViewer.md
71
74
  - Syntax-highlighted code editor with one-command formatting → **CodeEditor** · `@jimka/typescript-ui/component/editor` · A syntax-highlighting, formatting code editor wrapping CodeMirror 6. · docs/components/CodeEditor.md
72
75
  - WYSIWYG rich-text editor whose value is a Markdown string → **MarkdownEditor** · `@jimka/typescript-ui/component/editor` · A WYSIWYG rich-text editor whose public value is a Markdown string, with an optional raw-Markdown source mode. · docs/components/MarkdownEditor.md
73
76
  - Determinate/indeterminate progress bar → **ProgressBar** · `@jimka/typescript-ui/component/display` · A horizontal progress indicator with a determinate (0–100%) and an indeterminate (continuously animated) mode. · docs/components/ProgressBar.md
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jimka/typescript-ui",
3
- "version": "0.4.1",
3
+ "version": "0.5.0",
4
4
  "description": "A web-based layout manager and UI component framework written in TypeScript.",
5
5
  "keywords": ["ui", "ui-components", "typescript", "layout", "layout-manager", "widgets", "framework", "dock", "data-table", "retained-mode"],
6
6
  "author": "Jimmy Karlsson",
@@ -153,12 +153,12 @@
153
153
  "@types/prismjs": "^1.26.6",
154
154
  "@vitest/coverage-v8": "^4.1.9",
155
155
  "cloc": "^2.6.0-cloc",
156
- "concurrently": "^6.3.0",
156
+ "concurrently": "^10.0.4",
157
157
  "elkjs": "^0.12.0",
158
- "eslint": "^9.0.0",
159
- "google-closure-compiler": "^20200406.0.0",
158
+ "eslint": "^10.8.0",
159
+ "google-closure-compiler": "^20260803.0.0",
160
160
  "jsdom": "^29.1.1",
161
- "rimraf": "^3.0.2",
161
+ "rimraf": "^6.1.3",
162
162
  "ts-morph": "^28.0.0",
163
163
  "tsc-alias": "^1.9.0",
164
164
  "tsx": "^4.22.1",
@@ -181,21 +181,21 @@
181
181
  "@codemirror/state": "^6.7.1",
182
182
  "@codemirror/view": "^6.43.6",
183
183
  "@fontsource-variable/manrope": "^5.2.8",
184
- "@lexical/code": "^0.46.0",
185
- "@lexical/history": "^0.46.0",
186
- "@lexical/link": "^0.46.0",
187
- "@lexical/list": "^0.46.0",
188
- "@lexical/markdown": "^0.46.0",
189
- "@lexical/rich-text": "^0.46.0",
190
- "@lexical/selection": "^0.46.0",
191
- "@lexical/table": "^0.46.0",
192
- "@lexical/utils": "^0.46.0",
184
+ "@lexical/code": "^0.49.0",
185
+ "@lexical/history": "^0.49.0",
186
+ "@lexical/link": "^0.49.0",
187
+ "@lexical/list": "^0.49.0",
188
+ "@lexical/markdown": "^0.49.0",
189
+ "@lexical/rich-text": "^0.49.0",
190
+ "@lexical/selection": "^0.49.0",
191
+ "@lexical/table": "^0.49.0",
192
+ "@lexical/utils": "^0.49.0",
193
193
  "@lezer/highlight": "^1.2.3",
194
194
  "codemirror": "^6.0.2",
195
195
  "d3-array": "^3.2.4",
196
196
  "d3-scale": "^4.0.2",
197
197
  "d3-shape": "^3.2.0",
198
- "lexical": "^0.46.0",
198
+ "lexical": "^0.49.0",
199
199
  "marked": "^18.0.5",
200
200
  "prettier": "^3.9.4",
201
201
  "sql-formatter": "^15.8.2"
@@ -1,2 +0,0 @@
1
- import{f as e,h as t}from"./Component-fRQvgaEY.js";import{t as n}from"./LayoutConstraints-LIHYYd2F.js";var Anchor=class extends e{constructor(e){super(),e&&this.applyOptions(e)}resolve(e,t){if(e!==void 0)return typeof e==`number`?e:t*e.percent/100}resolveAxis(e,t,n,r,i,a,o){if(e!==void 0&&t!==void 0){let n=Math.max(0,r-e-t);return{start:o+e,extent:n}}let s=n??i;return e===void 0?t===void 0?{start:a,extent:s}:{start:o+r-t-s,extent:s}:{start:o+e,extent:s}}doLayout(){let e=this.getContainer();if(!e)return;let t=e.getInnerSize();if(!t)return;let n=e.getContentInsets(),r=n.getLeft(),i=n.getTop();for(let n of e.getLaidOutComponents()){let e=this.getLayoutConstraints(n),a=n.getPreferredSize(),o=n.getSize(),s=a?.width??o?.width??0,c=a?.height??o?.height??0,l=this.resolveAxis(this.resolve(e?.left,t.width),this.resolve(e?.right,t.width),this.resolve(e?.width,t.width),t.width,s,n.getX(),r),u=this.resolveAxis(this.resolve(e?.top,t.height),this.resolve(e?.bottom,t.height),this.resolve(e?.height,t.height),t.height,c,n.getY(),i);this.commitBounds(n,l.start,u.start,l.extent,u.extent)}}},r=t(Anchor),AnchorConstraints=class extends n{left;right;top;bottom;width;height;constructor(){super()}};export{r as n,AnchorConstraints as t};
2
- //# sourceMappingURL=AnchorConstraints-DdDYSDkf.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"AnchorConstraints-DdDYSDkf.js","names":[],"sources":["../../src/typescript/lib/layout/Anchor.ts","../../src/typescript/lib/layout/AnchorConstraints.ts"],"sourcesContent":["// SPDX-License-Identifier: PolyForm-Noncommercial-1.0.0\n\nimport { LayoutManager, LayoutManagerOptions } from \"~/layout/LayoutManager.js\";\nimport { AnchorConstraints } from \"~/layout/AnchorConstraints.js\";\nimport { callable } from \"~/core/Callable.js\";\n\n/**\n * A length used by an {@link Anchor} constraint, expressed either in **pixels**\n * (a bare `number`) or as a **percentage** of the container's inner extent\n * (`{ percent }`, on a 0–100 scale). The percentage resolves against inner width\n * for horizontal fields (`left` / `right` / `width`) and inner height for\n * vertical fields (`top` / `bottom` / `height`).\n *\n * @category Layouts\n */\nexport type AnchorValue = number | { percent: number };\n\n/**\n * Construction-time options for {@link Anchor}.\n *\n * @category Layouts\n */\nexport interface AnchorOptions extends LayoutManagerOptions {\n}\n\n/**\n * The resolved placement of a child along one axis: a `start` offset in the\n * container's coordinate space and the `extent` (width or height) to commit.\n */\ninterface AxisResult {\n start: number;\n extent: number;\n}\n\n/**\n * A resize-reactive layout manager that positions each child by edge-relative\n * and proportional offsets, re-resolving them on every `doLayout` pass so a\n * child stays pinned to a container edge — or stretched between two edges — as\n * the container resizes. It is the reactive counterpart to the static\n * [`Absolute`](/api/layout/classes/Absolute) manager, which never reads the\n * container's inner size.\n *\n * Per child (via {@link AnchorConstraints}) an axis can: pin a fixed distance\n * from one edge (`left` / `right` / `top` / `bottom`), derive its extent from\n * the container when both opposing edges are set (stretch), or take an explicit\n * `width` / `height`. Any offset or size may be a pixel `number` or an\n * {@link AnchorValue} percentage of the container's inner extent.\n *\n * Like `Absolute`, `Anchor` commits rects directly through `commitBounds`,\n * bypassing the cell clamp — a child sized larger than the container is\n * committed at its computed size and may overflow, which a host `Panel` with\n * `autoScroll: \"auto\"` scrolls natively. It imposes no intrinsic preferred,\n * min, or max size on its host.\n *\n * @category Layouts\n */\nclass Anchor extends LayoutManager {\n\n constructor(options?: AnchorOptions) {\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 * Resolves an {@link AnchorValue} to pixels against the given extent.\n * Returns the number unchanged for a pixel value, `extent * percent / 100`\n * for a percentage tag, and `undefined` when the field is unset.\n *\n * @param value - The pixel-or-percent value, or `undefined` if unset.\n * @param extent - The container inner extent the percentage resolves against.\n * @returns The resolved pixel value, or `undefined` when `value` is unset.\n */\n private resolve(value: AnchorValue | undefined, extent: number): number | undefined {\n if (value === undefined) {\n return undefined;\n }\n\n if (typeof value === \"number\") {\n return value;\n }\n\n // Percent is on a 0–100 (CSS-style) scale, resolved against the inner extent.\n return extent * value.percent / 100;\n }\n\n /**\n * Resolves one axis's placement from its near edge, far edge, and explicit\n * size against the container inner extent, applying the precedence rules:\n * both edges stretch (size ignored); near edge pins the start; far edge pins\n * the end; neither edge falls back to the child's own start. The `origin`\n * (the inset on this axis) is added for every anchored row but **not** for\n * the no-edge fallback, matching {@link Absolute}, which commits the child's\n * own `getX` / `getY` without an inset offset.\n *\n * @param near - Resolved `left` / `top` offset, or `undefined` if unset.\n * @param far - Resolved `right` / `bottom` offset, or `undefined` if unset.\n * @param size - Resolved explicit `width` / `height`, or `undefined` if unset.\n * @param inner - The container's inner extent on this axis.\n * @param preferred - The child's preferred extent on this axis.\n * @param ownStart - The child's own `getX` / `getY` on this axis.\n * @param origin - The inset on this axis added to anchored placements.\n * @returns The `{ start, extent }` to commit on this axis.\n */\n private resolveAxis(near: number | undefined, far: number | undefined, size: number | undefined,\n inner: number, preferred: number, ownStart: number, origin: number): AxisResult {\n if (near !== undefined && far !== undefined) {\n // Stretch between both edges; explicit size is ignored. Clamp the\n // derived extent at 0 so an over-constrained pair never goes negative.\n const extent = Math.max(0, inner - near - far);\n\n return { start: origin + near, extent };\n }\n\n const extent = size ?? preferred;\n\n if (near !== undefined) {\n return { start: origin + near, extent };\n }\n\n if (far !== undefined) {\n return { start: origin + inner - far - extent, extent };\n }\n\n // No edge constrained: keep the child's own position, like Absolute, and\n // do not add the inset origin so mixed Anchor/Absolute usage is consistent.\n return { start: ownStart, extent };\n }\n\n /**\n * Resolves each child's rect from its {@link AnchorConstraints} against the\n * container's current inner size and insets, then commits via the base\n * `commitBounds` (bypassing the cell clamp). Bails before the container\n * connects, when `getInnerSize` is still `null`.\n */\n doLayout(): void {\n const container = this.getContainer();\n\n if (!container) {\n return;\n }\n\n const inner = container.getInnerSize();\n\n if (!inner) {\n return;\n }\n\n const insets = container.getContentInsets();\n const originX = insets.getLeft();\n const originY = insets.getTop();\n\n for (const component of container.getLaidOutComponents()) {\n const cons = this.getLayoutConstraints(component) as AnchorConstraints | undefined;\n\n const preferredSize = component.getPreferredSize();\n const size = component.getSize();\n const prefW = preferredSize?.width ?? size?.width ?? 0;\n const prefH = preferredSize?.height ?? size?.height ?? 0;\n\n const xAxis = this.resolveAxis(this.resolve(cons?.left, inner.width),\n this.resolve(cons?.right, inner.width), this.resolve(cons?.width, inner.width),\n inner.width, prefW, component.getX(), originX);\n\n const yAxis = this.resolveAxis(this.resolve(cons?.top, inner.height),\n this.resolve(cons?.bottom, inner.height), this.resolve(cons?.height, inner.height),\n inner.height, prefH, component.getY(), originY);\n\n this.commitBounds(component, xAxis.start, yAxis.start, xAxis.extent, yAxis.extent);\n }\n }\n}\n\nconst AnchorCallable = callable(Anchor);\ntype AnchorCallable = Anchor;\nexport {\n Anchor as _Anchor,\n AnchorCallable as Anchor\n};\n","// SPDX-License-Identifier: PolyForm-Noncommercial-1.0.0\n\nimport { LayoutConstraints } from \"~/layout/LayoutConstraints.js\";\nimport { AnchorValue } from \"~/layout/Anchor.js\";\n\n/**\n * Per-child layout constraints for components added to an {@link Anchor}\n * container. Each edge offset pins the child a fixed distance (pixels) or a\n * proportion ({@link AnchorValue} `{ percent }`, on a 0–100 scale) from that\n * side of the container's inner box; setting **both** opposing edges of an axis\n * stretches the child between them. `width` / `height` give an explicit extent\n * (pixels or percent) used when at most one edge of an axis is constrained.\n *\n * @remarks Each axis resolves independently from three inputs — the near edge,\n * the far edge, and the explicit size — against the container's inner extent\n * (post-insets) for that axis. When both edges of an axis are set, the explicit\n * size for that axis is ignored (the pair derives the extent), mirroring CSS\n * `position: absolute`. When neither edge of an axis is set, the child keeps its\n * own `getX` / `getY` on that axis, behaving like {@link Absolute} there, so an\n * application can anchor one axis and hand-place the other.\n *\n * Percentages resolve against the container's **inner** size (the same\n * coordinate space the committed rect lives in), not its border box.\n *\n * @category Layouts\n */\nexport class AnchorConstraints extends LayoutConstraints {\n\n /** Distance from the container's inner left edge to the child's left edge. */\n left?: AnchorValue;\n\n /** Distance from the container's inner right edge to the child's right edge. */\n right?: AnchorValue;\n\n /** Distance from the container's inner top edge to the child's top edge. */\n top?: AnchorValue;\n\n /** Distance from the container's inner bottom edge to the child's bottom edge. */\n bottom?: AnchorValue;\n\n /**\n * Explicit width; used when at most one horizontal edge is constrained.\n * Ignored when both {@link AnchorConstraints.left} and\n * {@link AnchorConstraints.right} are set (the pair derives the width).\n */\n width?: AnchorValue;\n\n /**\n * Explicit height; used when at most one vertical edge is constrained.\n * Ignored when both {@link AnchorConstraints.top} and\n * {@link AnchorConstraints.bottom} are set (the pair derives the height).\n */\n height?: AnchorValue;\n\n constructor() {\n super();\n }\n}\n"],"mappings":"uGAwDA,IAAM,OAAN,cAAqB,CAAc,CAE/B,YAAY,EAAyB,CAGjC,MAAM,EAEF,GACA,KAAK,aAAa,CAAO,CAEjC,CAWA,QAAgB,EAAgC,EAAoC,CAC5E,OAAU,IAAA,GASd,OALI,OAAO,GAAU,SACV,EAIJ,EAAS,EAAM,QAAU,GACpC,CAoBA,YAAoB,EAA0B,EAAyB,EACnD,EAAe,EAAmB,EAAkB,EAA4B,CAChG,GAAI,IAAS,IAAA,IAAa,IAAQ,IAAA,GAAW,CAGzC,IAAM,EAAS,KAAK,IAAI,EAAG,EAAQ,EAAO,CAAG,EAE7C,MAAO,CAAE,MAAO,EAAS,EAAM,QAAO,CAC1C,CAEA,IAAM,EAAS,GAAQ,EAYvB,OAVI,IAAS,IAAA,GAIT,IAAQ,IAAA,GAML,CAAE,MAAO,EAAU,QAAO,EALtB,CAAE,MAAO,EAAS,EAAQ,EAAM,EAAQ,QAAO,EAJ/C,CAAE,MAAO,EAAS,EAAM,QAAO,CAU9C,CAQA,UAAiB,CACb,IAAM,EAAY,KAAK,aAAa,EAEpC,GAAI,CAAC,EACD,OAGJ,IAAM,EAAQ,EAAU,aAAa,EAErC,GAAI,CAAC,EACD,OAGJ,IAAM,EAAS,EAAU,iBAAiB,EACpC,EAAU,EAAO,QAAQ,EACzB,EAAU,EAAO,OAAO,EAE9B,IAAK,IAAM,KAAa,EAAU,qBAAqB,EAAG,CACtD,IAAM,EAAO,KAAK,qBAAqB,CAAS,EAE1C,EAAgB,EAAU,iBAAiB,EAC3C,EAAO,EAAU,QAAQ,EACzB,EAAQ,GAAe,OAAS,GAAM,OAAS,EAC/C,EAAQ,GAAe,QAAU,GAAM,QAAU,EAEjD,EAAQ,KAAK,YAAY,KAAK,QAAQ,GAAM,KAAM,EAAM,KAAK,EAC/D,KAAK,QAAQ,GAAM,MAAO,EAAM,KAAK,EAAG,KAAK,QAAQ,GAAM,MAAO,EAAM,KAAK,EAC7E,EAAM,MAAO,EAAO,EAAU,KAAK,EAAG,CAAO,EAE3C,EAAQ,KAAK,YAAY,KAAK,QAAQ,GAAM,IAAK,EAAM,MAAM,EAC/D,KAAK,QAAQ,GAAM,OAAQ,EAAM,MAAM,EAAG,KAAK,QAAQ,GAAM,OAAQ,EAAM,MAAM,EACjF,EAAM,OAAQ,EAAO,EAAU,KAAK,EAAG,CAAO,EAElD,KAAK,aAAa,EAAW,EAAM,MAAO,EAAM,MAAO,EAAM,OAAQ,EAAM,MAAM,CACrF,CACJ,CACJ,EAEM,EAAiB,EAAS,MAAM,ECvJzB,kBAAb,cAAuC,CAAkB,CAGrD,KAGA,MAGA,IAGA,OAOA,MAOA,OAEA,aAAc,CACV,MAAM,CACV,CACJ"}
@@ -1,2 +0,0 @@
1
- import{t as e}from"./DOM-67StIm5G.js";import{a as t,s as n}from"./Position-Ck_KD4cR.js";import{S as r,b as i,f as a,h as o,m as s,t as c,v as l}from"./Component-fRQvgaEY.js";import{t as u}from"./ListenerBag-WPdKuuds.js";import{t as d}from"./Tooltip-Dro4DOZs.js";import{t as f}from"./Placement-7kqdaK4Z.js";import{t as p}from"./LayoutConstraints-LIHYYd2F.js";function beginPointerDrag(t){e.sink.apply(e.source.getBody(),{style:{pointerEvents:`none`}}),e.sink.apply(e.source.getDocumentElement(),{style:{cursor:t}})}function endPointerDrag(){e.sink.apply(e.source.getBody(),{style:{pointerEvents:``}}),e.sink.apply(e.source.getDocumentElement(),{style:{cursor:``}})}var m=200,h=`cubic-bezier(0.4, 0, 0.6, 1)`,g={cancel:()=>{}};function track(e,t){let n=null,r=!1,prune=()=>{r=!0;let t=n===null?-1:e.indexOf(n);t>=0&&e.splice(t,1)},{handle:i,cleanup:a}=t(prune);r||(n={cancel:()=>i.cancel(),settle:()=>{i.cancel(),a()}},e.push(n))}function primeCollapse(e,t,n,r,i){let cleanup=()=>{for(let e of n)e.setTransition(null);e.setWillChange(null)};if(l.isReducedMotion())return r(),{handle:g,cleanup};let a=t.map(e=>`${e} ${m}ms ${h}`).join(`, `);for(let e of n)e.setTransition(a);return e.setWillChange(t.join(`, `)),{handle:l.afterTransition({component:e,property:i??t[0],durationMs:m,fallbackBufferMs:40,onComplete:()=>{cleanup(),r()}}),cleanup}}function captureRect(e){return{x:e.getX(),y:e.getY(),width:e.getWidth(),height:e.getHeight()}}function parseCubicBezier(e){let t=e.match(/cubic-bezier\(([^)]+)\)/);if(!t)return e=>e;let[n,r,i,a]=t[1].split(`,`).map(e=>parseFloat(e)),o=3*n,s=3*(i-n)-o,c=1-o-s,l=3*r,u=3*(a-r)-l,d=1-l-u,sampleX=e=>((c*e+s)*e+o)*e,sampleY=e=>((d*e+u)*e+l)*e,sampleDX=e=>(3*c*e+2*s)*e+o;return e=>{let t=e;for(let n=0;n<8;n+=1){let n=sampleX(t)-e;if(Math.abs(n)<1e-6)return sampleY(t);let r=sampleDX(t);if(Math.abs(r)<1e-6)break;t-=n/r}let n=0,r=1;for(t=e;n<r;){let i=sampleX(t);if(Math.abs(i-e)<1e-6)break;i<e?n=t:r=t,t=(n+r)/2}return sampleY(t)}}var _=parseCubicBezier(h),lerp=(e,t,n)=>e+(t-e)*n,lerpRect=(e,t,n)=>({x:lerp(e.x,t.x,n),y:lerp(e.y,t.y,n),width:lerp(e.width,t.width,n),height:lerp(e.height,t.height,n)});function commitRect(e,t,n){e.setAutoCommitStyle(!1),e.setX(t.x),e.setY(t.y),e.setWidth(t.width),e.setHeight(t.height),n&&e.doLayout(),e.setAutoCommitStyle(!0)}function animateLayout(t,n){if(l.isReducedMotion()){for(let e of t)commitRect(e.component,e.end,e.relayout);return n?.(),()=>{}}let r=!1,i=0;for(let e of t)commitRect(e.component,e.start,e.relayout);let a=performance.now(),frame=o=>{if(r)return;let s=Math.min(1,(o-a)/m),c=_(s);for(let e of t)commitRect(e.component,s>=1?e.end:lerpRect(e.start,e.end,c),e.relayout);s<1?i=e.sink.requestAnimationFrame(frame):n?.()};return i=e.sink.requestAnimationFrame(frame),()=>{r=!0,i&&e.sink.cancelAnimationFrame(i)}}function runCollapse(e,t,n,r,i,a){r?.(),track(i,e=>primeCollapse(t,[`clip-path`],[t],e,`clip-path`));let o=n.filter(e=>!e.relayout).map(e=>e.component);o.length>0&&track(i,e=>primeCollapse(o[0],[`background-color`],o,e,`background-color`));let s=n.map(e=>captureRect(e.component));return e.doLayout(),animateLayout(n.map((e,t)=>({component:e.component,relayout:e.relayout,start:s[t],end:captureRect(e.component)})),a)}var v=10,y=40,b={east:0,south:90,west:180,north:-90},x=null;function ensureCollapseButtonClassRule(){x||=new i({scope:`class`,name:`CollapseButton`,styles:{position:`absolute`,top:`50%`,left:`50%`,transform:`translate(-50%, -50%)`,boxSizing:`border-box`,width:`${v}px`,height:`${y}px`,borderRadius:`2px`,background:`var(--ts-ui-button-bg, #e8e8e8)`,border:`1px solid var(--ts-ui-button-border, #c8c8c8)`,boxShadow:`var(--ts-ui-button-shadow, 0 1px 2px rgba(0, 0, 0, 0.2))`,textAlign:`center`,fontSize:`9px`,lineHeight:`${y-2}px`,color:`var(--ts-ui-collapse-button-color, rgb(100,100,100))`,pointerEvents:`auto`,userSelect:`none`}})}var CollapseButton=class extends c{_listeners=new u;constructor(e){ensureCollapseButtonClassRule(),super({tag:`span`,cursor:`pointer`,...e??{}}),this._direction??=`east`,this.applyRotation(),this.applyListeners(e?.listeners),r.addListener(this,`dblclick`,this.onDoubleClick),r.addListener(this,`mousedown`,this.onMouseDown)}applyOptions(e){return super.applyOptions(e),e.direction!==void 0&&this.setDirection(e.direction),this}render(){let t=super.render();return e.sink.apply(t,{text:`▶`}),t}applyRotation(){let e=b[this._direction];this.createStyleRule(``).set(`transform`,`translate(-50%, -50%) rotate(${e}deg)`)}setStripMode(e){return this.createStyleRule(``).set(`width`,`${e?18:v}px`),this}getDirection(){return this._direction}setDirection(e){return this._direction=e,this.applyRotation(),this}on(e,t){return this._listeners.add(e,t),this}off(e,t){return this._listeners.remove(e,t),this}emit(e){this._listeners.fire(e)}onDoubleClick(e){return this.emit(`collapse`),!0}onMouseDown(e){return!0}},S=o(CollapseButton),C={west:`east`,east:`west`,north:`south`,south:`north`},w={orientation:`horizontal`,collapsible:!0,movable:!0},SplitGutter=class extends c{_opaque=!1;_collapseDirection=`west`;_expandedBackground=`var(--ts-ui-gutter-bg, #AAAAAA)`;_tooltipText=``;_listeners=new u;constructor(e,t,n){super(t,{...w,...n??{}}),e&&t?.orientation===void 0&&(this._direction=e),this._expandedBackground=t?.expandedBackground??`var(--ts-ui-gutter-bg, #AAAAAA)`,this.setBackgroundColor(this._expandedBackground),this._collapseDirection=t?.collapseDirection??(this._direction===`horizontal`?`west`:`north`),this._collapseButton=new S({direction:this._collapseDirection,listeners:{collapse:()=>this.emit(`collapse`)}}),this._collapseButton.setVisible(this._collapsible),t?.opaque&&this.setOpaque(!0),this._movable||this.setPointerEvents(`none`),this._movable&&r.addListener(this,`mousedown`,this.onDragStart),this.applyListeners(t?.listeners),this.updateTooltip()}init(t){super.init(t);let n=t||this.getElement();return n&&e.sink.appendChild(n,this._collapseButton.getElement(!0)),this}isCollapsible(){return this._collapsible??this._defaultOptions.collapsible}setCollapsible(e){return this._collapsible=e,this._collapseButton?.setVisible(e),this._collapseButton&&this.updateTooltip(),this}applyOptions(e){return super.applyOptions(e),this.setDirection(e.orientation??this.getDirection()),this.setCollapsible(e.collapsible??this.isCollapsible()),this.setMovable(e.movable??this.isMovable()),this}isMovable(){return this._movable??this._defaultOptions.movable}setMovable(e){return this._movable=e,this}isOpaque(){return this._opaque}setOpaque(e){return this._opaque=e,e?(this.setBackgroundColor(`var(--ts-ui-button-bg, #e8e8e8)`),this.setBackgroundImage(`var(--ts-ui-button-bg, linear-gradient(rgb(241, 241, 241), rgb(200, 200, 200)))`),this.setBorder(`1px solid var(--ts-ui-button-border, #c8c8c8)`),this._collapseButton?.setDirection(C[this._collapseDirection])):(this.clearBackgroundImage(),this.clearBorder(),this.setBackgroundColor(this._expandedBackground),this._collapseButton?.setDirection(this._collapseDirection)),this._collapseButton?.setStripMode(e),this.applyCursor(),this.updateTooltip(),this}getCollapseDirection(){return this._collapseDirection}setCollapseDirection(e){return this._collapseDirection=e,this._collapseButton?.setDirection(this._opaque?C[e]:e),this.updateTooltip(),this}updateTooltip(){if(!this._collapsible){this._tooltipText!==``&&(d.detach(this),this._collapseButton&&d.detach(this._collapseButton),this._tooltipText=``);return}let e=`Double-click to ${this._opaque?`expand`:`collapse`} ${this._opaque?C[this._collapseDirection]:this._collapseDirection}ward`;e!==this._tooltipText&&(this._tooltipText=e,d.attach(this,e),this._collapseButton&&d.attach(this._collapseButton,e))}getDirection(){return this._direction??this._defaultOptions.orientation}setDirection(e){return e||=`horizontal`,this._direction=e,this}on(e,t){return this._listeners.add(e,t),this}off(e,t){return this._listeners.remove(e,t),this}emit(e,...t){this._listeners.fire(e,...t)}destructor(){this._collapseButton?.dispose(),super.destructor()}_dispatchDrag(e){this.emit(`drag`,e)}onDragStart(e){if(this._opaque)return;let t=this._direction===`horizontal`?e.clientX:e.clientY;this.emit(`dragstart`,t),r.addViewportListener(this,`mouseup`,this.onDragStop),r.addViewportListener(this,`touchend`,this.onDragStop),r.addViewportListener(this,`touchcancel`,this.onDragStop),r.addViewportListener(this,`mousemove`,this.onDrag),r.addViewportListener(this,`touchmove`,this.onDrag),beginPointerDrag(this.dragCursor())}onDragStop(){return r.removeViewportListener(this,`mouseup`,this.onDragStop),r.removeViewportListener(this,`touchend`,this.onDragStop),r.removeViewportListener(this,`touchcancel`,this.onDragStop),r.removeViewportListener(this,`mousemove`,this.onDrag),r.removeViewportListener(this,`touchmove`,this.onDrag),endPointerDrag(),this.emit(`dragend`),!0}onDrag(e){let t;return t=this._direction===`horizontal`?e.clientX:e.clientY,this._dispatchDrag(t),!0}dragCursor(){return this._direction==`horizontal`?`ew-resize`:`ns-resize`}applyCursor(){this._movable&&!this._opaque?this.setCursor(this.dragCursor()):this.setCursor(`default`)}render(){let e=super.render();return this.applyCursor(),e}},T=o(SplitGutter),E=4,D={[f.NORTH]:`north`,[f.SOUTH]:`south`,[f.WEST]:`west`,[f.EAST]:`east`},Border=class extends a{_northComponent=null;_southComponent=null;_westComponent=null;_eastComponent=null;_centerComponent=null;_spacing=5;_collapsed=new Map;_collapsible=new Map;_gutters=new Map;_collapseAnimation=null;_pendingCollapseTransitions=[];_collapsing=!1;constructor(e){super(),e&&this.applyOptions(e)}applyOptions(e){super.applyOptions(e),e.spacing!==void 0&&this.setComponentSpacing(e.spacing)}setLayoutConstraints(e,t){switch(t||(t=new p,t.placement=f.CENTER),t.placement||=f.CENTER,t.placement){case f.NORTH:this._northComponent=e;break;case f.SOUTH:this._southComponent=e;break;case f.WEST:this._westComponent=e;break;case f.EAST:this._eastComponent=e;break;case f.CENTER:this._centerComponent=e;break}return t.placement===f.CENTER?this._collapsible.set(f.CENTER,!1):this._collapsible.set(t.placement,t.collapsible??!1),super.setLayoutConstraints(e,t)}delLayoutConstraints(e){return this._northComponent===e?this._northComponent=null:this._southComponent===e?this._southComponent=null:this._westComponent===e?this._westComponent=null:this._eastComponent===e?this._eastComponent=null:this._centerComponent===e&&(this._centerComponent=null),super.delLayoutConstraints(e)}getComponentSpacing(){return this._spacing}setComponentSpacing(e){return this._spacing=e,this}getRegionComponent(e){switch(e){case f.NORTH:return this._northComponent;case f.SOUTH:return this._southComponent;case f.WEST:return this._westComponent;case f.EAST:return this._eastComponent;case f.CENTER:return this._centerComponent}}isRegionCollapsed(e){return this._collapsed.get(e)??!1}setRegionCollapsed(e,t){if(e===f.CENTER||!this.isRegionCollapsible(e))return this;let n=this.getRegionComponent(e);if(!n||(this._collapsed.get(e)??!1)===t)return this;let r=this.getContainer();if(!r)return this;let i=this._collapsing;this._collapsing=!0,i||r.doLayout(),this._collapsed.set(e,t),this.ensureGutter(e);let a=[...[this._northComponent,this._southComponent,this._westComponent,this._eastComponent,this._centerComponent].filter(e=>e!=null).map(e=>({component:e,relayout:!0})),...[...this._gutters.values()].map(e=>({component:e,relayout:!1}))];return this._collapseAnimation=runCollapse(r,n,a,this._collapseAnimation,this._pendingCollapseTransitions,()=>{this._collapseAnimation=null,this._collapsing=!1,r.doLayout()}),this}isRegionCollapsible(e){return e===f.CENTER?!1:this._collapsible.get(e)??!1}setRegionCollapsible(e,t){return e===f.CENTER?this:(this._collapsible.set(e,t),this.getContainer()?.scheduleLayout(),this)}ensureGutter(t){let n=this._gutters.get(t);if(n)return n;let r=this.getContainer();return n=new T(t===f.NORTH||t===f.SOUTH?`vertical`:`horizontal`,{movable:!1,opaque:!1,collapseDirection:D[t],expandedBackground:`transparent`,listeners:{collapse:()=>this.setRegionCollapsed(t,!this.isRegionCollapsed(t))}}),n.setVisible(!1),e.sink.appendChild(r.getElement(),n.getElement(!0)),this._gutters.set(t,n),n}regionExtent(e,t){return this.isRegionCollapsed(e)?18:t}flooredMainExtent(e,t,n){let r=t?n?t.height:t.width:0;return Math.max(e,r)}applyRegionClip(e,t){if(this.isRegionCollapsible(t)){if(!this.isRegionCollapsed(t)){e.setClipPath(`inset(0 0 0 0)`);return}switch(t){case f.WEST:e.setClipPath(`inset(0 100% 0 0)`);break;case f.EAST:e.setClipPath(`inset(0 0 0 100%)`);break;case f.NORTH:e.setClipPath(`inset(0 0 100% 0)`);break;case f.SOUTH:e.setClipPath(`inset(100% 0 0 0)`);break}}}updateRegionGutter(e,t,n,r,i){let a=this.getRegionComponent(e);if(!a)return;if(!this.isRegionCollapsible(e)){a.setVisible(!0),this._gutters.get(e)?.setVisible(!1);return}let o=this.isRegionCollapsed(e),s=this.ensureGutter(e);a.setVisible(!0),s.setOpaque(o),s.setVisible(!0);let c=o?{x:t,y:n,width:r,height:i}:this.innerEdgeTrack(e,t,n,r,i);s.setX(c.x),s.setY(c.y),s.setWidth(c.width),s.setHeight(c.height)}innerEdgeTrack(e,t,n,r,i){switch(e){case f.NORTH:return{x:t,y:n+i,width:r,height:E};case f.SOUTH:return{x:t,y:n-E,width:r,height:E};case f.WEST:return{x:t+r,y:n,width:E,height:i};case f.EAST:return{x:t-E,y:n,width:E,height:i};default:return{x:t,y:n,width:r,height:i}}}laidOut(e){return e&&e.isDisplayed()?e:null}getPreferredSize(){let e=this.getContainer();if(!e)return null;let t=e.getPerimeterSize(),n=t.left+t.right,r=t.top+t.bottom,i=0,a=0,o=0,s=0,c=this.laidOut(this._northComponent),l=this.laidOut(this._southComponent),u=this.laidOut(this._westComponent),d=this.laidOut(this._centerComponent),p=this.laidOut(this._eastComponent);if(c){let e=c.getPreferredSize();if(e){let t=this.flooredMainExtent(e.height,c.getMinSize(),!0);i=Math.max(i,e.width),a+=this.isRegionCollapsed(f.NORTH)?18:t}}if(l){let e=l.getPreferredSize();if(e){let t=this.flooredMainExtent(e.height,l.getMinSize(),!0);i=Math.max(i,e.width),a+=this.isRegionCollapsed(f.SOUTH)?18:t}}if(u){let e=u.getPreferredSize();if(e){let t=this.flooredMainExtent(e.width,u.getMinSize(),!1);o+=this.isRegionCollapsed(f.WEST)?18:t,s=Math.max(s,e.height)}}if(d){let e=d.getPreferredSize();e&&(o+=e.width,s=Math.max(s,e.height))}if(p){let e=p.getPreferredSize();if(e){let t=this.flooredMainExtent(e.width,p.getMinSize(),!1);o+=this.isRegionCollapsed(f.EAST)?18:t,s=Math.max(s,e.height)}}return i=Math.max(i,o),a+=s,{width:i+n,height:a+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=0,a=0,o=0,s=0,c=this.laidOut(this._northComponent),l=this.laidOut(this._southComponent),u=this.laidOut(this._westComponent),d=this.laidOut(this._centerComponent),p=this.laidOut(this._eastComponent);if(c){let e=c.getMinSize();e&&(i=Math.max(i,e.width),a+=this.isRegionCollapsed(f.NORTH)?18:e.height)}if(l){let e=l.getMinSize();e&&(i=Math.max(i,e.width),a+=this.isRegionCollapsed(f.SOUTH)?18:e.height)}if(u){let e=u.getMinSize();e&&(o+=this.isRegionCollapsed(f.WEST)?18:e.width,s=Math.max(s,e.height))}if(d){let e=d.getMinSize();e&&(o+=e.width,s=Math.max(s,e.height))}if(p){let e=p.getMinSize();e&&(o+=this.isRegionCollapsed(f.EAST)?18:e.width,s=Math.max(s,e.height))}return i=Math.max(i,o),a+=s,{width:i+n,height:a+r}}getMaxSize(){let e=this.getContainer();if(!e)return null;let r=e.getPerimeterSize(),i=r.left+r.right,a=r.top+r.bottom,maxOf=e=>this.laidOut(e)?e.getMaxSize()??{width:t,height:t}:null,o=maxOf(this._northComponent),s=maxOf(this._southComponent),c=maxOf(this._westComponent),l=maxOf(this._centerComponent),u=maxOf(this._eastComponent),d=0,f=0,p=!1;for(let e of[c,l,u])e&&(p=!0,d+=e.width,f=Math.max(f,e.height));let m=t;o&&(m=Math.min(m,o.width)),s&&(m=Math.min(m,s.width)),p&&(m=Math.min(m,d));let h=0;return o&&(h+=o.height),p&&(h+=f),s&&(h+=s.height),{width:n(m+i),height:n(h+a)}}computeTotalMinSize(){if(!this.getContainer())return{width:0,height:0};let e=this.laidOut(this._westComponent)?.getMinSize(),t=this.laidOut(this._centerComponent)?.getMinSize(),n=this.laidOut(this._eastComponent)?.getMinSize(),r=this.laidOut(this._northComponent)?.getMinSize(),i=this.laidOut(this._southComponent)?.getMinSize(),a=[];e&&a.push(this.isRegionCollapsed(f.WEST)?18:e.width),t&&a.push(t.width),n&&a.push(this.isRegionCollapsed(f.EAST)?18:n.width);let o=[];r&&o.push(this.isRegionCollapsed(f.NORTH)?18:r.height),t&&o.push(t.height),i&&o.push(this.isRegionCollapsed(f.SOUTH)?18:i.height);let s=0,c=0;for(let e of a)s+=e;s+=Math.max(0,a.length-1)*this._spacing,r&&(s=Math.max(s,r.width)),i&&(s=Math.max(s,i.width));for(let e of o)c+=e;return c+=Math.max(0,o.length-1)*this._spacing,{width:s,height:c}}clearSkippedRegionFrames(...e){[this._northComponent,this._southComponent,this._westComponent,this._centerComponent,this._eastComponent].forEach((t,n)=>{t&&!e[n]&&t.clearClipFrame()})}doLayout(){let e=this.getContainer();if(!e)return;let t=e.getInnerSize();if(!t)return;let n=e.getContentInsets();t=this.inflateForOverflow(t);let r=this.laidOut(this._northComponent),i=this.laidOut(this._southComponent),a=this.laidOut(this._westComponent),o=this.laidOut(this._centerComponent),c=this.laidOut(this._eastComponent);this.clearSkippedRegionFrames(r,i,a,o,c);let l=t.width,u=t.height,d,p,m,h;if(r){let e=this.getLayoutConstraints(r);if(!e)throw Error(`Unable to determine layout constraints for north component.`);let t=r.getPreferredSize();if(!t)throw Error(`Unable to determine preferred size for north component.`);let u=this.flooredMainExtent(t.height,r.getMinSize(),!0),d=this.regionExtent(f.NORTH,u),m=e.ignoreParentInsets?0:n.getLeft(),h=e.ignoreParentInsets?0:n.getTop(),g=l+(e.ignoreParentInsets?n.getLeft()+n.getRight():0),_=e.ignoreParentInsets?n.getTop():0;p=d+_,this.isRegionCollapsible(f.NORTH)||this._collapsing?(this.placeComponent(r,m,h,g,u+_,s.BOTH),r.clearClipFrame(),this.applyRegionClip(r,f.NORTH)):(r.setClipPath(null),r.setClipFrame(m,h,g,u+_),this.commitBounds(r,0,0,g,u+_)),this.updateRegionGutter(f.NORTH,m,h,g,p),(a||o||c||i)&&(p+=this._spacing)}else p=0;if(h=u-p,i){let e=i.getPreferredSize();if(!e)throw Error(`Unable to determine preferred size for south component.`);let t=this.flooredMainExtent(e.height,i.getMinSize(),!0),r=this.regionExtent(f.SOUTH,t),a=n.getLeft(),o=n.getTop()+u-r;h-=this._spacing,h-=r;let c=n.getTop()+u-t;this.isRegionCollapsible(f.SOUTH)||this._collapsing?(this.placeComponent(i,a,c,l,t,s.BOTH),i.clearClipFrame(),this.applyRegionClip(i,f.SOUTH)):(i.setClipPath(null),i.setClipFrame(a,c,l,t),this.commitBounds(i,0,0,l,t)),this.updateRegionGutter(f.SOUTH,a,o,l,r)}let g=0,_=0;if(c){let e=c.getPreferredSize();if(!e)throw Error(`Unable to determine preferred size for east component.`);let t=this.flooredMainExtent(e.width,c.getMinSize(),!1);_=t,g=this.regionExtent(f.EAST,t)}if(a){let e=a.getPreferredSize();if(!e)throw Error(`Unable to determine preferred size for west component.`);let t=this.flooredMainExtent(e.width,a.getMinSize(),!1),r=Math.max(0,Math.min(this.regionExtent(f.WEST,t),l-g)),i=n.getLeft(),c=n.getTop()+p;d=r;let u=Math.max(0,Math.min(t,l-g));this.isRegionCollapsible(f.WEST)||this._collapsing?(this.placeComponent(a,i,c,u,h,s.BOTH),a.clearClipFrame(),this.applyRegionClip(a,f.WEST)):(a.setClipPath(null),a.setClipFrame(i,c,u,h),this.commitBounds(a,0,0,u,h)),this.updateRegionGutter(f.WEST,i,c,r,h),o&&(d+=this._spacing)}else d=0;if(m=l-d,c){m-=this._spacing,m-=g;let e=n.getLeft()+l-g,t=n.getTop()+p,r=n.getLeft()+l-_;this.isRegionCollapsible(f.EAST)||this._collapsing?(this.placeComponent(c,r,t,_,h,s.BOTH),c.clearClipFrame(),this.applyRegionClip(c,f.EAST)):(c.setClipPath(null),c.setClipFrame(r,t,_,h),this.commitBounds(c,0,0,_,h)),this.updateRegionGutter(f.EAST,e,t,g,h)}if(o){let e=n.getLeft()+d,t=n.getTop()+p;this._collapsing?(this.placeComponent(o,e,t,m,h,s.BOTH),o.clearClipFrame()):(o.setClipFrame(e,t,m,h),this.commitBounds(o,0,0,m,h))}}detach(){this._collapseAnimation?.(),this._collapseAnimation=null,this._collapsing=!1;let t=(this.getContainer()?.getComponents().length??0)>0;for(let e of this._pendingCollapseTransitions)t?e.settle():e.cancel();this._pendingCollapseTransitions.length=0,super.detach();for(let t of this._gutters.values()){let n=t.getElement(),r=n?e.source.getParentNode(n):null;n&&r&&e.sink.removeChild(r,n),t.dispose()}this._gutters.clear();for(let e of[f.NORTH,f.SOUTH,f.WEST,f.EAST,f.CENTER])this.getRegionComponent(e)?.clearClipFrame();return this}},O=o(Border);export{beginPointerDrag as a,runCollapse as i,T as n,endPointerDrag as o,S as r,O as t};
2
- //# sourceMappingURL=Border-CKKUk5G9.js.map
@@ -1,2 +0,0 @@
1
- import{i as e,l as t,n}from"./Position-Ck_KD4cR.js";import{S as r,h as i,m as a,p as o,t as s}from"./Component-fRQvgaEY.js";import{t as c}from"./Glyph-wN7bk7mg.js";import{t as l}from"./Tooltip-Dro4DOZs.js";import{t as u}from"./Fit-CL1m1nIZ.js";import{t as d}from"./Text-KB5LksJl.js";import{n as f,r as p}from"./VBox-P3WFGkPc.js";var m=new n(5,10,5,10),h=new n(2,6,2,6),g=new n(2,2,2,2),_=new n(4,4,4,4),v=`var(--ts-ui-button-bg, transparent)`,y={tag:`button`,cursor:`pointer`,foregroundColor:`var(--ts-ui-text-color, black)`,border:`2px ridge var(--ts-ui-button-border, rgb(200, 200, 200))`,borderRadius:`var(--ts-ui-border-radius, 4px)`,shadow:`var(--ts-ui-button-shadow, 1px 2px 5px 0 rgba(0, 0, 0, 0.2))`,backgroundImage:`var(--ts-ui-button-bg, linear-gradient(rgb(241, 241, 241), rgb(200, 200, 200)))`,insets:m,anchor:o.CENTER,fill:a.NONE,pressedForegroundColor:`var(--ts-ui-button-pressed-fg, rgb(150, 150, 150))`,pressedBackgroundColor:`var(--ts-ui-button-pressed-bg, rgb(200, 200, 200))`,pressedBackgroundImage:`var(--ts-ui-button-pressed-bg, none)`,pressedShadow:`var(--ts-ui-button-pressed-shadow, 1px 2px 5px 0 rgba(0, 0, 0, 0.2) inset)`,hoverBackgroundColor:`var(--ts-ui-button-hover-bg, rgb(252, 252, 252))`,hoverBackgroundImage:`var(--ts-ui-button-hover-bg, none)`,hoverShadow:`var(--ts-ui-button-hover-shadow, 1px 3px 6px 0 rgba(0, 0, 0, 0.25))`},b=i(class Button extends s{_text;_content;_titleColumn;_description=null;_tooltipSuppressed=!1;_outerColumn=null;_innerRow=null;_glyph=null;_glyphSyncedSize=null;_glyphSizePinned=!1;_onThemeChange=()=>{this._rebuildContentRow(),this.recomputePreferredSize()};get pressedStyleRule(){return this._pressedStyleRule??=this.createStyleRule(`:active`)}_pressedBorder=null;get hoverStyleRule(){return this._hoverStyleRule??=this.createStyleRule(`:hover:not(:active)`)}_hoverBorder=null;_enabledCursor=`pointer`;constructor(e,t,r){let i;typeof e==`string`?i=e:e!==void 0&&(t=e),super(t,{...y,...r??{}}),this.setLayoutManager(new u),this._text=new d,this._titleColumn=new s,this._titleColumn.setLayoutManager(new f({spacing:0})),this._titleColumn.setInsets(new n(0,0,0,0)),this._titleColumn.setPointerEvents(`none`),this._titleColumn.addComponent(this._text),this._content=new s,this._content.setLayoutManager(new p({spacing:2})),this._content.setInsets(new n(0,0,0,0)),this._content.setPointerEvents(`none`),this._content.addComponent(this._titleColumn),this._text.setPointerEvents(`none`),this._text.setTextAlign(`center`),this._text.setFontWeight(`bold`),this._text.setFontSize(`--ts-ui-button-font-size`),this.addComponent(this._content,{fill:this.getFill(),anchor:this.getAnchor()});let a=this._options.text??this._defaultOptions.text??i;a!==void 0&&this.setText(a);let o=this._options.glyph??this._defaultOptions.glyph;o!==void 0&&this.setGlyph(o);let c=this._options.description??this._defaultOptions.description;c!==void 0&&this.setDescription(c),(this._flat||this._compact)&&this._resolveInsets(),this.recomputePreferredSize(),this.subscribeTheme(this._onThemeChange),Object.getPrototypeOf(this)===Button.prototype&&this.applyListeners(t?.listeners)}getAnchor(){return this._options.anchor??this._defaultOptions.anchor}getFill(){return this._options.fill??this._defaultOptions.fill}applyOptions(e){let t=this.getLayoutManager();super.applyOptions(e),e.layoutManager===void 0&&this.getLayoutManager()!==t&&this.setLayoutManager(t),e.descriptionUnderGlyph!==void 0&&(this._options.descriptionUnderGlyph=e.descriptionUnderGlyph),e.showDescription!==void 0&&(this._options.showDescription=e.showDescription),e.showText!==void 0&&(this._options.showText=e.showText);let n=this._text!==void 0;return e.glyphColor!==void 0&&(n?this.setGlyphColor(e.glyphColor):this._options.glyphColor=e.glyphColor),e.descriptionColor!==void 0&&(n?this.setDescriptionColor(e.descriptionColor):this._options.descriptionColor=e.descriptionColor),e.text!==void 0&&(n?this.setText(e.text):this._options.text=e.text),e.description!==void 0&&(n?this.setDescription(e.description):this._options.description=e.description),e.glyph!==void 0&&(n?this.setGlyph(e.glyph):this._options.glyph=e.glyph),e.enabled!==void 0&&this.setEnabled(e.enabled),e.chromeless!==void 0&&(this._options.chromeless=e.chromeless),e.flat!==void 0&&(this._options.flat=e.flat),e.compact!==void 0&&this.setCompact(e.compact),e.anchor!==void 0&&(this._options.anchor=e.anchor),e.fill!==void 0&&(this._options.fill=e.fill),this}applyChromeOptions(e){if((e.chromeless??this.isChromeless())===!0){this.clearBorder(),this._options.borderRadius=void 0,this._options.shadow=void 0,this._options.backgroundImage=void 0,this.getBackgroundColor()===null&&(this._options.backgroundColor=`transparent`);return}super.applyChromeOptions(e),(this._options.flat??e.flat)!==!0&&e.backgroundColor===void 0&&this.setBackgroundColor(v),this.setPressedForegroundColor(e.pressedForegroundColor??this.getPressedForegroundColor()),this.setPressedBackgroundColor(e.pressedBackgroundColor??this.getPressedBackgroundColor()),this.setPressedBackgroundImage(e.pressedBackgroundImage??this.getPressedBackgroundImage()),this.setPressedShadow(e.pressedShadow??this.getPressedShadow()),e.pressedBorder!==void 0&&this.setPressedBorder(e.pressedBorder),e.pressedBorderRadius!==void 0&&this.setPressedBorderRadius(e.pressedBorderRadius),e.hoverForegroundColor!==void 0&&this.setHoverForegroundColor(e.hoverForegroundColor),this.setHoverBackgroundColor(e.hoverBackgroundColor??this.getHoverBackgroundColor()),this.setHoverBackgroundImage(e.hoverBackgroundImage??this.getHoverBackgroundImage()),this.setHoverShadow(e.hoverShadow??this.getHoverShadow()),e.hoverBorder!==void 0&&this.setHoverBorder(e.hoverBorder),e.hoverBorderRadius!==void 0&&this.setHoverBorderRadius(e.hoverBorderRadius),(this._options.flat??e.flat)===!0&&(this._flat=!0,this._applyFlatChrome())}setText(e){return this._options.text=e,this._text.setText(this._isShowText()?e:``),this.recomputePreferredSize(),this._rebuildTooltip(),this._reflectAccessibleName(),this}getText(){return this._options.text??``}setWritingMode(e){let t=this._contentOrientation();return super.setWritingMode(e),this._text&&(this._text.setWritingMode(e),this._description?.setWritingMode(e),this._contentOrientation()!==t&&(this._glyph||this._description)&&this._rebuildContentRow(),this.recomputePreferredSize()),this}setTextAlign(e){if(this._text){this._text.setTextAlign(e);let t=this.getLayoutConstraints(this._content);t&&(t.anchor=this._anchorForTextAlign(e),this.scheduleLayout())}return this}_anchorForTextAlign(e){let t=e===`left`||e===`start`,n=e===`right`||e===`end`,r=this._contentOrientation();return r===`cw`?t?o.NORTH:n?o.SOUTH:o.CENTER:r===`ccw`?t?o.SOUTH:n?o.NORTH:o.CENTER:t?o.WEST:n?o.EAST:o.CENTER}clearWritingMode(){let e=this._contentOrientation();return super.clearWritingMode(),this._text&&(this._text.clearWritingMode(),this._description?.clearWritingMode(),this._contentOrientation()!==e&&(this._glyph||this._description)&&this._rebuildContentRow(),this.recomputePreferredSize()),this}setDescription(e){return this._description||(this._description=new d,this._description.setPointerEvents(`none`),this._description.setTextAlign(`center`),this._description.setFontSize(`--ts-ui-button-description-font-size`),this._description.setFontWeight(`var(--ts-ui-button-description-weight, normal)`),this._description.setForegroundColor(this._options.descriptionColor??`var(--ts-ui-button-description-fg, rgb(110, 110, 110))`)),this._description.setText(e),this._rebuildContentRow(),this._rebuildTooltip(),this.recomputePreferredSize(),this}getDescription(){return this._description}clearDescription(){return this._description=null,this._rebuildContentRow(),this._rebuildTooltip(),this.recomputePreferredSize(),this}_rebuildTooltip(){if(this._tooltipSuppressed){l.detach(this);return}let e=this._options.text??``,t=this._description?.getText().valueOf()??``,n;n=e&&t?`${e}\n\n${t}`:e||t,n?l.attach(this,n):l.detach(this)}setTooltipSuppressed(e){return e===this._tooltipSuppressed?this:(this._tooltipSuppressed=e,this._rebuildTooltip(),this)}_reflectAccessibleName(){let e=this._options.text??``;!this._isShowText()&&e!==``?this.getAria().setLabel(e):this.getAria().clearLabel()}_isDescriptionUnderGlyph(){return this._options.descriptionUnderGlyph??!0}_isShowDescription(){return this._options.showDescription??!0}_isShowText(){return this._options.showText??!0}_contentOrientation(){let e=this.getWritingMode();return e===`sideways-rl`?`cw`:e===`sideways-lr`?`ccw`:`horizontal`}_orientBox(e,t,n){e.setLayoutManager(t===`v`?new f({spacing:n}):new p({spacing:n}))}_addContentChildren(e,t,n){let r=n?[...t].reverse():t;for(let t of r)e.addComponent(t)}_rebuildContentRow(){this._content.removeAllComponents(),this._titleColumn.removeAllComponents(),this._innerRow?.removeAllComponents(),this._outerColumn?.removeAllComponents();let e=this._description!==null&&this._isShowDescription(),r=this._isShowText(),i=this._contentOrientation(),a=i!==`horizontal`,o=a?`v`:`h`,c=a?`h`:`v`,l=i===`ccw`,u=i===`cw`;if(e&&this._glyph&&this._isDescriptionUnderGlyph())this._innerRow||(this._innerRow=new s,this._innerRow.setInsets(new n(0,0,0,0)),this._innerRow.setPointerEvents(`none`)),this._outerColumn||(this._outerColumn=new s,this._outerColumn.setInsets(new n(0,0,0,0)),this._outerColumn.setPointerEvents(`none`)),this._orientBox(this._content,o,2),this._orientBox(this._innerRow,o,2),this._orientBox(this._outerColumn,c,0),this._addContentChildren(this._innerRow,r?[this._glyph,this._text]:[this._glyph],l),this._addContentChildren(this._outerColumn,[this._innerRow,this._description],u),this._content.addComponent(this._outerColumn);else if(e){this._orientBox(this._content,o,2),this._orientBox(this._titleColumn,c,0),this._addContentChildren(this._titleColumn,r?[this._text,this._description]:[this._description],u);let e=this._glyph?[this._glyph,this._titleColumn]:[this._titleColumn];this._addContentChildren(this._content,e,l)}else{let e=this._text.getText().valueOf()!==``;this._orientBox(this._content,o,this._glyph&&!e?0:2);let t=this._glyph?[this._glyph,this._text]:[this._text];this._addContentChildren(this._content,t,l)}let d=!a&&!e&&this._text.getText().valueOf()!==``?t.opticalCenterOffset():0;this._content.setInsets(new n(d,0,0,0)),this._reflectAccessibleName(),this._afterRebuildContentRow()}_afterRebuildContentRow(){}_syncGlyphSize(){let e=this._glyph;if(!e||this._glyphSizePinned)return;let t=this._text.getLineHeight();if(t===null)return;let n=Math.round(t),r=e.getPreferredSize(),i=this._glyphSyncedSize;r&&i!==null&&(r.width!==i||r.height!==i)||(e.setPreferredSize({width:n,height:n}),this._glyphSyncedSize=n)}setGlyph(e){let t=new c(e);return t.setPointerEvents(`none`),this._glyph=t,this._glyphSyncedSize=null,this._options.glyphColor!==void 0&&t.setForegroundColor(this._options.glyphColor),this._rebuildContentRow(),this.recomputePreferredSize(),this}clearGlyph(){return this._glyph=null,this._glyphSyncedSize=null,this._rebuildContentRow(),this.recomputePreferredSize(),this}getGlyph(){return this._glyph}setGlyphColor(e){return this._options.glyphColor=e,this._glyph?.setForegroundColor(e),this}setDescriptionColor(e){return this._options.descriptionColor=e,this._description?.setForegroundColor(e),this}pinGlyphSize(e){return this._glyphSizePinned=!0,this._glyph?.setPreferredSize({width:e,height:e}),this}getBaseline(){return this.wrapInnerBaseline(this._text.getBaseline())}on(e,t){return r.addListener(this,`click`,t),this}off(e,t){return r.removeListener(this,`click`,t),this}click(){return r.fireEvent(this,`click`),this}addPointerDownListener(e){return r.addListener(this,`pointerdown`,e),this}isChromeless(){return this._options.chromeless??this._defaultOptions.chromeless??!1}setChromeless(e){return this.isChromeless()===e||(e?(this._clearChrome(),this._options.chromeless=!0,this._flat=!1,this._options.flat=!1):(this._options.chromeless=!1,this._restoreChrome())),this}_clearChrome(){this.clearBorder(),this.clearBorderRadius(),this.clearShadow(),this.clearBackgroundImage(),this._pressedStyleRule!==void 0&&(this.clearPressedBackgroundColor(),this.clearPressedBackgroundImage(),this.clearPressedForegroundColor(),this.clearPressedShadow(),this.clearPressedBorderRadius(),this.clearPressedBorder()),this._hoverStyleRule!==void 0&&(this.clearHoverBackgroundColor(),this.clearHoverBackgroundImage(),this.clearHoverForegroundColor(),this.clearHoverShadow(),this.clearHoverBorderRadius(),this.clearHoverBorder())}_restoreChrome(){let e=this._defaultOptions;e.backgroundColor===void 0&&this._options.backgroundColor===`transparent`&&this.setBackgroundColor(v),e.border!==void 0&&this.setBorder(e.border),e.borderRadius!==void 0&&this.setBorderRadius(e.borderRadius),e.shadow!==void 0&&this.setShadow(e.shadow),e.backgroundImage!==void 0&&this.setBackgroundImage(e.backgroundImage),e.pressedForegroundColor!==void 0&&this.setPressedForegroundColor(e.pressedForegroundColor),e.pressedBackgroundColor!==void 0&&this.setPressedBackgroundColor(e.pressedBackgroundColor),e.pressedBackgroundImage!==void 0&&this.setPressedBackgroundImage(e.pressedBackgroundImage),e.pressedShadow!==void 0&&this.setPressedShadow(e.pressedShadow),e.pressedBorder===void 0?this.clearPressedBorder():this.setPressedBorder(e.pressedBorder),e.pressedBorderRadius!==void 0&&this.setPressedBorderRadius(e.pressedBorderRadius),e.hoverForegroundColor!==void 0&&this.setHoverForegroundColor(e.hoverForegroundColor),e.hoverBackgroundColor!==void 0&&this.setHoverBackgroundColor(e.hoverBackgroundColor),e.hoverBackgroundImage!==void 0&&this.setHoverBackgroundImage(e.hoverBackgroundImage),e.hoverShadow!==void 0&&this.setHoverShadow(e.hoverShadow),e.hoverBorder===void 0?this.clearHoverBorder():this.setHoverBorder(e.hoverBorder),e.hoverBorderRadius!==void 0&&this.setHoverBorderRadius(e.hoverBorderRadius)}isFlat(){return this._flat??!1}setFlat(e){return e&&this.isChromeless()?(console.warn(`Button #`+this.getId()+`: setFlat(true) ignored — flat and chromeless are mutually exclusive, chromeless wins.`),this):((this._flat??!1)===e||(e?(this._flat=!0,this._options.flat=!0,this._applyFlatChrome()):(this._flat=!1,this._options.flat=!1,this._restoreChrome(),this._resolveInsets())),this)}isCompact(){return this._compact??!1}setCompact(e){return(this._compact??!1)===e?this:(this._compact=e,this._options.compact=e,this._resolveInsets(),this)}_applyFlatChrome(){this.setBorder(`1px solid transparent`),this.clearBorderRadius(),this.clearShadow(),this.clearBackgroundImage();let e=this.getBackgroundColor();(e===void 0||e===v)&&this.setBackgroundColor(`transparent`),this.clearPressedBackgroundImage(),this.clearHoverBackgroundImage(),this.clearHoverShadow(),this.setHoverBackgroundColor(`var(--ts-ui-button-flat-hover-bg, rgba(0, 0, 0, 0.06))`),this.setHoverBorder(`var(--ts-ui-button-flat-hover-border, 1px solid rgb(200, 200, 200))`),this.setPressedBackgroundColor(`var(--ts-ui-button-flat-pressed-bg, rgba(0, 0, 0, 0.10))`),this.setPressedShadow(`var(--ts-ui-button-flat-pressed-shadow, inset 1px 1px 3px rgba(0, 0, 0, 0.25))`),this.setPressedBorder(`var(--ts-ui-button-flat-pressed-border, 1px solid rgb(180, 180, 180))`),this._resolveInsets()}_resolveInsets(){if(this._text===void 0)return;let e=this._glyph!==null&&this._text.getText().valueOf()===``,t;t=this._compact&&e?g:this._compact?h:this._flat&&e?_:m,this.setInsets(t)}setInsets(e){return super.setInsets(e),this.recomputePreferredSize(),this}setPreferredSize(e){return this._consumerSetPreferredSize=!0,super.setPreferredSize(e),this}getPreferredSize(){return this._consumerSetPreferredSize||this._defaultOptions.preferredSize?super.getPreferredSize():this.computePreferredSize()}recomputePreferredSize(){if(this._syncGlyphSize(),this._consumerSetPreferredSize||this._defaultOptions.preferredSize)return;let e=this.computePreferredSize();super.setPreferredSize({width:e.width,height:e.height})}computePreferredSize(){let e=this._content?.getPreferredSize()??{width:0,height:0},t=this.getPerimeterSize();return{width:e.width+t.left+t.right,height:e.height+t.top+t.bottom}}getPressedBackgroundColor(){return this._options.pressedBackgroundColor??this._defaultOptions.pressedBackgroundColor??null}setPressedBackgroundColor(e){return this._options.pressedBackgroundColor=e,this.pressedStyleRule.set(`backgroundColor`,e),this}clearPressedBackgroundColor(){return this._options.pressedBackgroundColor=void 0,this.pressedStyleRule.set(`backgroundColor`,null),this}getPressedBackgroundImage(){return this._options.pressedBackgroundImage??this._defaultOptions.pressedBackgroundImage??null}setPressedBackgroundImage(e){return this._options.pressedBackgroundImage=e,this.pressedStyleRule.set(`backgroundImage`,e),this}clearPressedBackgroundImage(){return this._options.pressedBackgroundImage=void 0,this.pressedStyleRule.set(`backgroundImage`,null),this}getPressedForegroundColor(){return this._options.pressedForegroundColor??this._defaultOptions.pressedForegroundColor??null}setPressedForegroundColor(e){return this._options.pressedForegroundColor=e,this.pressedStyleRule.set(`color`,e),this}clearPressedForegroundColor(){return this._options.pressedForegroundColor=void 0,this.pressedStyleRule.set(`color`,null),this}getPressedBorder(){return this._pressedBorder}setPressedBorder(t){return this._pressedBorder=typeof t==`string`?{border:t}:t??{},this.pressedStyleRule.setMany(e(this._pressedBorder)),this}clearPressedBorder(){return this._pressedBorder=null,this.pressedStyleRule.setMany({borderTop:null,borderRight:null,borderBottom:null,borderLeft:null}),this}getPressedBorderRadius(){return this._options.pressedBorderRadius??null}setPressedBorderRadius(e){return this._options.pressedBorderRadius=e,this.pressedStyleRule.set(`borderRadius`,e),this}clearPressedBorderRadius(){return this._options.pressedBorderRadius=void 0,this.pressedStyleRule.set(`borderRadius`,null),this}getPressedShadow(){return this._options.pressedShadow??this._defaultOptions.pressedShadow??null}setPressedShadow(e){return this._options.pressedShadow=e,this.pressedStyleRule.set(`boxShadow`,e),this}clearPressedShadow(){return this._options.pressedShadow=void 0,this.pressedStyleRule.set(`boxShadow`,null),this}getHoverBackgroundColor(){return this._options.hoverBackgroundColor??this._defaultOptions.hoverBackgroundColor??null}setHoverBackgroundColor(e){return this._options.hoverBackgroundColor=e,this.hoverStyleRule.set(`backgroundColor`,e),this}clearHoverBackgroundColor(){return this._options.hoverBackgroundColor=void 0,this.hoverStyleRule.set(`backgroundColor`,null),this}getHoverBackgroundImage(){return this._options.hoverBackgroundImage??this._defaultOptions.hoverBackgroundImage??null}setHoverBackgroundImage(e){return this._options.hoverBackgroundImage=e,this.hoverStyleRule.set(`backgroundImage`,e),this}clearHoverBackgroundImage(){return this._options.hoverBackgroundImage=void 0,this.hoverStyleRule.set(`backgroundImage`,null),this}getHoverForegroundColor(){return this._options.hoverForegroundColor??null}setHoverForegroundColor(e){return this._options.hoverForegroundColor=e,this.hoverStyleRule.set(`color`,e),this}clearHoverForegroundColor(){return this._options.hoverForegroundColor=void 0,this.hoverStyleRule.set(`color`,null),this}getHoverBorder(){return this._hoverBorder}setHoverBorder(t){return this._hoverBorder=typeof t==`string`?{border:t}:t??{},this.hoverStyleRule.setMany(e(this._hoverBorder)),this}clearHoverBorder(){return this._hoverBorder=null,this.hoverStyleRule.setMany({borderTop:null,borderRight:null,borderBottom:null,borderLeft:null}),this}getHoverBorderRadius(){return this._options.hoverBorderRadius??null}setHoverBorderRadius(e){return this._options.hoverBorderRadius=e,this.hoverStyleRule.set(`borderRadius`,e),this}clearHoverBorderRadius(){return this._options.hoverBorderRadius=void 0,this.hoverStyleRule.set(`borderRadius`,null),this}getHoverShadow(){return this._options.hoverShadow??this._defaultOptions.hoverShadow??null}setHoverShadow(e){return this._options.hoverShadow=e,this.hoverStyleRule.set(`boxShadow`,e),this}clearHoverShadow(){return this._options.hoverShadow=void 0,this.hoverStyleRule.set(`boxShadow`,null),this}setEnabled(e){return(this._options.enabled??!0)===e?this:(this._options.enabled=e,e?(this.setDisabledAttribute(!1),this.clearOpacity(),this.setCursor(this._enabledCursor)):(this._enabledCursor=this.getCursor()??`pointer`,this.setDisabledAttribute(!0),this.setOpacity(.5),this.setCursor(`not-allowed`)),this)}isEnabled(){return this._options.enabled??!0}setDescriptionUnderGlyph(e){return this._options.descriptionUnderGlyph=e,this._rebuildContentRow(),this.recomputePreferredSize(),this}isDescriptionUnderGlyph(){return this._isDescriptionUnderGlyph()}setShowDescription(e){return this._options.showDescription=e,this._rebuildContentRow(),this.recomputePreferredSize(),this}isShowDescription(){return this._isShowDescription()}setShowText(e){return this._options.showText=e,this._text.setText(e?this._options.text??``:``),this._rebuildContentRow(),this._resolveInsets(),this.recomputePreferredSize(),this}isShowText(){return this._isShowText()}});export{b as t};
2
- //# sourceMappingURL=Button-MZDYJOMC.js.map