@zeyos/zx 5.4.0 → 5.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 (113) hide show
  1. package/CHANGELOG.md +80 -0
  2. package/README.md +23 -16
  3. package/dist/types/components/app-sidebar/app-sidebar.d.ts +33 -0
  4. package/dist/types/components/badge/badge.d.ts +5 -4
  5. package/dist/types/components/datebox/date-range-box.d.ts +15 -2
  6. package/dist/types/components/datebox/datebox.d.ts +37 -3
  7. package/dist/types/components/kbd/kbd.d.ts +41 -0
  8. package/dist/types/components/launcher/launcher.d.ts +4 -2
  9. package/dist/types/components/prose/prose.d.ts +69 -0
  10. package/dist/types/components/questionnaire/questionnaire.d.ts +0 -36
  11. package/dist/types/components/stat-tile/stat-tile.d.ts +20 -0
  12. package/dist/types/components/tag-picker/tag-picker.d.ts +11 -5
  13. package/dist/types/components/tree/tree.d.ts +44 -3
  14. package/dist/types/core/icons.d.ts +22 -1
  15. package/dist/types/index.d.ts +4 -2
  16. package/dist/types/internal/app-rail.d.ts +10 -3
  17. package/dist/types/internal/row-actions.d.ts +151 -0
  18. package/dist/zx-zeyos.esm.js +264 -82
  19. package/dist/zx-zeyos.esm.min.js +4 -4
  20. package/dist/zx.css +1225 -433
  21. package/dist/zx.esm.js +952 -392
  22. package/dist/zx.esm.min.js +6 -6
  23. package/dist/zx.global.js +952 -392
  24. package/dist/zx.global.min.js +6 -6
  25. package/dist/zx.min.css +1 -1
  26. package/docs/api.json +112 -4
  27. package/docs/llms.md +243 -37
  28. package/docs/llms.txt +2 -0
  29. package/package.json +1 -1
  30. package/src/components/account-menu/account-menu.js +2 -2
  31. package/src/components/app-rail/app-rail.css +11 -11
  32. package/src/components/app-sidebar/app-sidebar.css +90 -17
  33. package/src/components/app-sidebar/app-sidebar.js +120 -12
  34. package/src/components/badge/badge.css +33 -20
  35. package/src/components/badge/badge.js +5 -4
  36. package/src/components/breadcrumb/breadcrumb.css +28 -3
  37. package/src/components/breadcrumb/breadcrumb.js +2 -2
  38. package/src/components/button/button.css +24 -13
  39. package/src/components/button/button.js +20 -2
  40. package/src/components/calendar/calendar.css +14 -4
  41. package/src/components/card-view/card-view.js +2 -2
  42. package/src/components/chart/chart.js +20 -5
  43. package/src/components/check-button/check-button.css +11 -3
  44. package/src/components/check-button/check-button.js +3 -3
  45. package/src/components/context-menu/context-menu.css +7 -1
  46. package/src/components/date-picker/date-picker.css +6 -0
  47. package/src/components/date-picker/date-picker.js +5 -5
  48. package/src/components/date-picker/date-range-picker.css +6 -0
  49. package/src/components/date-picker/date-range-picker.js +3 -3
  50. package/src/components/date-picker/month-picker.js +3 -3
  51. package/src/components/date-picker/time-picker.css +6 -0
  52. package/src/components/datebox/date-range-box.js +30 -6
  53. package/src/components/datebox/datebox.js +44 -7
  54. package/src/components/dialog/dialog.css +0 -1
  55. package/src/components/dialog/dialog.js +2 -1
  56. package/src/components/dock/dock.js +2 -2
  57. package/src/components/dropdown/dropdown.css +2 -1
  58. package/src/components/entity-ref/entity-ref.css +8 -1
  59. package/src/components/file-item/file-item.css +1 -1
  60. package/src/components/finder/finder.js +2 -2
  61. package/src/components/groupbox/groupbox.js +2 -2
  62. package/src/components/kanban-view/kanban-view.css +8 -4
  63. package/src/components/kanban-view/kanban-view.js +3 -3
  64. package/src/components/kbd/kbd.css +64 -0
  65. package/src/components/kbd/kbd.js +121 -0
  66. package/src/components/launcher/launcher.css +30 -25
  67. package/src/components/launcher/launcher.js +15 -21
  68. package/src/components/list-toolbar/list-toolbar.css +7 -1
  69. package/src/components/menu-button/menu-button.css +9 -2
  70. package/src/components/message/message.js +2 -2
  71. package/src/components/module-bar/module-bar.css +11 -1
  72. package/src/components/multi-value-editor/multi-value-editor.js +4 -4
  73. package/src/components/navigation-bar/navigation-bar.css +3 -2
  74. package/src/components/pagination/pagination.js +2 -2
  75. package/src/components/panel/panel.js +2 -2
  76. package/src/components/prose/prose.css +53 -0
  77. package/src/components/prose/prose.js +152 -0
  78. package/src/components/questionnaire/questionnaire.css +7 -17
  79. package/src/components/questionnaire/questionnaire.js +16 -1
  80. package/src/components/rating/rating.css +3 -1
  81. package/src/components/search/search.js +2 -2
  82. package/src/components/select/glyphs.js +3 -3
  83. package/src/components/select/select.css +35 -7
  84. package/src/components/select/select.js +4 -4
  85. package/src/components/stat-tile/stat-tile.css +56 -2
  86. package/src/components/stat-tile/stat-tile.js +25 -2
  87. package/src/components/stepper/stepper.css +2 -1
  88. package/src/components/stepper/stepper.js +3 -3
  89. package/src/components/tabbox/tabbox.css +2 -2
  90. package/src/components/tabbox/tabbox.js +2 -2
  91. package/src/components/table/table.css +52 -16
  92. package/src/components/table/table.js +7 -5
  93. package/src/components/tag-picker/tag-picker.css +56 -43
  94. package/src/components/tag-picker/tag-picker.js +21 -16
  95. package/src/components/tree/tree.css +44 -0
  96. package/src/components/tree/tree.js +97 -9
  97. package/src/components/value-list/value-list.css +25 -4
  98. package/src/components/value-list/value-list.js +2 -1
  99. package/src/components/view/record-view.js +3 -3
  100. package/src/components/view-settings/view-settings.css +2 -1
  101. package/src/components/workspace-switcher/workspace-switcher.js +3 -3
  102. package/src/core/icons.js +34 -3
  103. package/src/elements/define.js +1 -0
  104. package/src/index.js +4 -2
  105. package/src/internal/app-rail.js +5 -1
  106. package/src/internal/row-actions.js +203 -0
  107. package/styles/base.css +26 -1
  108. package/styles/prose.css +306 -0
  109. package/styles/tokens/dark.css +97 -120
  110. package/styles/tokens/global.css +24 -9
  111. package/styles/tokens/semantic.css +464 -184
  112. package/styles/tokens/themes.css +9 -0
  113. package/styles/zx.css +3 -0
package/dist/zx.global.js CHANGED
@@ -64,6 +64,7 @@ var zx = (() => {
64
64
  Grid: () => Grid,
65
65
  Groupbox: () => Groupbox,
66
66
  Http: () => Http,
67
+ ICON_SIZE: () => ICON_SIZE,
67
68
  InlineLoading: () => InlineLoading,
68
69
  KanbanView: () => KanbanView,
69
70
  Launcher: () => Launcher,
@@ -151,6 +152,7 @@ var zx = (() => {
151
152
  createKanbanHistory: () => createKanbanHistory,
152
153
  createKanbanIndicator: () => createKanbanIndicator,
153
154
  createKanbanProgress: () => createKanbanProgress,
155
+ dateboxFormats: () => dateboxFormats,
154
156
  debounce: () => debounce,
155
157
  deepMerge: () => deepMerge,
156
158
  defaultDateRangePresets: () => defaultDateRangePresets,
@@ -202,6 +204,8 @@ var zx = (() => {
202
204
  joinTime: () => joinTime,
203
205
  kanbanAvatarLimit: () => kanbanAvatarLimit,
204
206
  kanbanSearchTerms: () => kanbanSearchTerms,
207
+ kbd: () => kbd,
208
+ keyLabels: () => keyLabels,
205
209
  kitUrl: () => kitUrl,
206
210
  layoutCalendarSpans: () => layoutCalendarSpans,
207
211
  layoutTimedCalendarEvents: () => layoutTimedCalendarEvents,
@@ -243,6 +247,7 @@ var zx = (() => {
243
247
  presentationGlyph: () => presentationGlyph,
244
248
  printf: () => printf,
245
249
  priorityIcon: () => priorityIcon,
250
+ proseAnchors: () => proseAnchors,
246
251
  pruneValue: () => pruneValue,
247
252
  rangeNights: () => rangeNights,
248
253
  rangeStateOf: () => rangeStateOf,
@@ -263,6 +268,7 @@ var zx = (() => {
263
268
  resolveModuleColor: () => resolveModuleColor,
264
269
  resolveSize: () => resolveSize,
265
270
  rovingTabindex: () => rovingTabindex,
271
+ sectionHref: () => sectionHref,
266
272
  serializeFilterValue: () => serializeFilterValue,
267
273
  setButtonBusy: () => setButtonBusy,
268
274
  setLanguage: () => setLanguage,
@@ -1593,12 +1599,12 @@ var zx = (() => {
1593
1599
  const result = {};
1594
1600
  let messages = {};
1595
1601
  let hasMessages = false;
1596
- for (const defaults6 of chain) {
1597
- if (!defaults6 || typeof defaults6 !== "object") continue;
1598
- Object.assign(result, defaults6);
1599
- if (defaults6.msg && typeof defaults6.msg === "object") {
1602
+ for (const defaults7 of chain) {
1603
+ if (!defaults7 || typeof defaults7 !== "object") continue;
1604
+ Object.assign(result, defaults7);
1605
+ if (defaults7.msg && typeof defaults7.msg === "object") {
1600
1606
  hasMessages = true;
1601
- messages = deepMerge(messages, defaults6.msg);
1607
+ messages = deepMerge(messages, defaults7.msg);
1602
1608
  }
1603
1609
  }
1604
1610
  Object.assign(result, options && typeof options === "object" ? options : {});
@@ -1623,9 +1629,9 @@ var zx = (() => {
1623
1629
  }
1624
1630
  function inheritedMessages(constructor) {
1625
1631
  let messages = null;
1626
- for (const defaults6 of defaultsChain(constructor)) {
1627
- if (defaults6 && typeof defaults6 === "object" && isMessageTable(defaults6.msg)) {
1628
- messages = deepMerge(messages ?? {}, defaults6.msg);
1632
+ for (const defaults7 of defaultsChain(constructor)) {
1633
+ if (defaults7 && typeof defaults7 === "object" && isMessageTable(defaults7.msg)) {
1634
+ messages = deepMerge(messages ?? {}, defaults7.msg);
1629
1635
  }
1630
1636
  }
1631
1637
  return messages ? Object.freeze(messages) : null;
@@ -3064,6 +3070,22 @@ var zx = (() => {
3064
3070
 
3065
3071
  // src/core/icons.js
3066
3072
  var SVG_NS = "http://www.w3.org/2000/svg";
3073
+ var ICON_SIZE = Object.freeze({
3074
+ /** The default: an icon that is a control's content or leads its label. */
3075
+ control: 16,
3076
+ /** Dropdown, disclosure, and reorder chevrons; calendar and pager arrows; breadcrumb separators. */
3077
+ chevron: 14,
3078
+ /** The × that clears a field, closes a tab, dialog, or message, or removes a row. */
3079
+ dismiss: 14,
3080
+ /** The check of a selected option, a pressed toggle button, or a completed step. */
3081
+ check: 14,
3082
+ /** The sort-direction arrow beside a column heading. */
3083
+ sort: 14,
3084
+ /** Any glyph inside a chip or token, its remove × included. */
3085
+ chip: 12,
3086
+ /** A glyph drawn inside a small status marker. */
3087
+ marker: 8
3088
+ });
3067
3089
  var VIEW_BOX = "0 0 24 24";
3068
3090
  var STROKE_WIDTH = 1.75;
3069
3091
  var MIN_STROKE_PX = 1;
@@ -3074,6 +3096,8 @@ var zx = (() => {
3074
3096
  // arrow-up-wide-narrow
3075
3097
  "arrow-down-wide-short": outline("M3 16l4 4 4-4M7 20V4M11 4h10M11 8h7M11 12h4"),
3076
3098
  // arrow-down-wide-narrow
3099
+ "arrow-up": outline("M5 12l7-7 7 7M12 19V5"),
3100
+ "arrow-down": outline("M12 5v14M19 12l-7 7-7-7"),
3077
3101
  "chevron-down": outline("M6 9l6 6 6-6"),
3078
3102
  "chevron-up": outline("M18 15l-6-6-6 6"),
3079
3103
  "chevron-left": outline("M15 18l-6-6 6-6"),
@@ -3220,7 +3244,7 @@ var zx = (() => {
3220
3244
  return svg;
3221
3245
  }
3222
3246
  function iconSvg(viewBox, paint, options) {
3223
- const { size: size2 = 16 } = options;
3247
+ const { size: size2 = ICON_SIZE.control } = options;
3224
3248
  const svg = document.createElementNS(SVG_NS, "svg");
3225
3249
  svg.setAttribute("class", classList("zx-icon", options.class));
3226
3250
  svg.setAttribute("viewBox", viewBox);
@@ -3260,7 +3284,7 @@ var zx = (() => {
3260
3284
  console.warn(`[zx.icon] Unknown icon "${name2}" \u2014 rendered an empty placeholder. Add it with registerIcons(), or render Font Awesome with useFontAwesome().`);
3261
3285
  }
3262
3286
  function faIcon(classes, options) {
3263
- const { size: size2 = 16 } = options;
3287
+ const { size: size2 = ICON_SIZE.control } = options;
3264
3288
  const element = document.createElement("i");
3265
3289
  element.className = classList("zx-icon", ...classes, options.class);
3266
3290
  element.style.fontSize = typeof size2 === "number" ? `${size2}px` : String(size2);
@@ -3664,7 +3688,7 @@ var zx = (() => {
3664
3688
  class: "zx-date-picker__nav",
3665
3689
  type: "button",
3666
3690
  ariaLabel: this._message("datePicker.previousMonth", "Previous month")
3667
- }, icon("chevron-left")),
3691
+ }, icon("chevron-left", { size: ICON_SIZE.chevron })),
3668
3692
  h("button", {
3669
3693
  ref: "heading",
3670
3694
  class: "zx-date-picker__heading",
@@ -3677,7 +3701,7 @@ var zx = (() => {
3677
3701
  class: "zx-date-picker__nav",
3678
3702
  type: "button",
3679
3703
  ariaLabel: this._message("datePicker.nextMonth", "Next month")
3680
- }, icon("chevron-right"))
3704
+ }, icon("chevron-right", { size: ICON_SIZE.chevron }))
3681
3705
  ),
3682
3706
  h(
3683
3707
  "div",
@@ -3694,14 +3718,14 @@ var zx = (() => {
3694
3718
  class: "zx-date-picker__nav",
3695
3719
  type: "button",
3696
3720
  ariaLabel: this._message("datePicker.previousYear", "Previous year")
3697
- }, icon("chevron-left")),
3721
+ }, icon("chevron-left", { size: ICON_SIZE.chevron })),
3698
3722
  h("span", { ref: "quickYear", class: "zx-date-picker__quick-year", ariaLive: "polite" }),
3699
3723
  h("button", {
3700
3724
  ref: "quickNext",
3701
3725
  class: "zx-date-picker__nav",
3702
3726
  type: "button",
3703
3727
  ariaLabel: this._message("datePicker.nextYear", "Next year")
3704
- }, icon("chevron-right"))
3728
+ }, icon("chevron-right", { size: ICON_SIZE.chevron }))
3705
3729
  ),
3706
3730
  h("div", { ref: "quickGrid", class: "zx-date-picker__quick-grid", role: "grid" })
3707
3731
  ),
@@ -4119,14 +4143,14 @@ var zx = (() => {
4119
4143
  class: "zx-month-picker__nav",
4120
4144
  type: "button",
4121
4145
  ariaLabel: this._message("monthPicker.previousYear", "Previous year")
4122
- }, icon("chevron-left")),
4146
+ }, icon("chevron-left", { size: ICON_SIZE.chevron })),
4123
4147
  h("span", { ref: "year", class: "zx-month-picker__year", ariaLive: "polite" }),
4124
4148
  h("button", {
4125
4149
  ref: "nextYear",
4126
4150
  class: "zx-month-picker__nav",
4127
4151
  type: "button",
4128
4152
  ariaLabel: this._message("monthPicker.nextYear", "Next year")
4129
- }, icon("chevron-right"))
4153
+ }, icon("chevron-right", { size: ICON_SIZE.chevron }))
4130
4154
  ),
4131
4155
  h("div", {
4132
4156
  ref: "grid",
@@ -5016,14 +5040,14 @@ var zx = (() => {
5016
5040
  type: "button",
5017
5041
  dataset: { nav: "previous" },
5018
5042
  ariaLabel: text("daterange.previousMonth", "Previous month")
5019
- }, icon("chevron-left")),
5043
+ }, icon("chevron-left", { size: ICON_SIZE.chevron })),
5020
5044
  h("div", { class: "zx-date-range-picker__caption", ariaHidden: "true" }, caption),
5021
5045
  h("button", {
5022
5046
  class: "zx-date-range-picker__nav",
5023
5047
  type: "button",
5024
5048
  dataset: { nav: "next" },
5025
5049
  ariaLabel: text("daterange.nextMonth", "Next month")
5026
- }, icon("chevron-right"))
5050
+ }, icon("chevron-right", { size: ICON_SIZE.chevron }))
5027
5051
  ),
5028
5052
  h(
5029
5053
  "table",
@@ -5349,6 +5373,7 @@ var zx = (() => {
5349
5373
  start: null,
5350
5374
  end: null,
5351
5375
  format: "%d.%m.%Y",
5376
+ displayFormat: null,
5352
5377
  separator: " \u2013 ",
5353
5378
  placeholder: null,
5354
5379
  clearable: true,
@@ -5376,9 +5401,11 @@ var zx = (() => {
5376
5401
  this._originalClearable = root.getAttribute("data-clearable");
5377
5402
  root.toggleAttribute("data-clearable", Boolean(this.options.clearable));
5378
5403
  this._format = String(this.options.format || "%d.%m.%Y");
5404
+ this._displayFormat = this.options.displayFormat ? String(this.options.displayFormat) : this._format;
5379
5405
  this._separator = String(this.options.separator ?? " \u2013 ");
5380
5406
  this._disabled = Boolean(this.options.disabled);
5381
5407
  this._open = false;
5408
+ this._focused = false;
5382
5409
  this._position = null;
5383
5410
  this._range = this._coerce({ start: this.options.start, end: this.options.end });
5384
5411
  const popoverId = uid("zx-date-range-box-popover");
@@ -5403,7 +5430,7 @@ var zx = (() => {
5403
5430
  class: "zx-icon-btn zx-date-range-box__clear",
5404
5431
  type: "button",
5405
5432
  ariaLabel: text2("daterange.clear", "Clear date range")
5406
- }, icon("x", { size: 13 })),
5433
+ }, icon("x", { size: ICON_SIZE.dismiss })),
5407
5434
  h("button", {
5408
5435
  ref: "toggle",
5409
5436
  class: "zx-date-range-box__toggle",
@@ -5446,8 +5473,16 @@ var zx = (() => {
5446
5473
  this._apply({ start: event.detail.start, end: event.detail.end }, { push: false });
5447
5474
  if (event.detail.start && event.detail.end) this._close(true);
5448
5475
  });
5476
+ this.listen(this.refs.input, "focus", () => {
5477
+ this._focused = true;
5478
+ if (this.el.dataset.state !== "invalid") this._syncDisplay();
5479
+ });
5449
5480
  this.listen(this.refs.input, "blur", () => {
5481
+ this._focused = false;
5450
5482
  if (!this._open) this._commitText();
5483
+ else if (this.refs.input.value === formatRangeText(this._range, this._format, this._separator)) {
5484
+ this._syncDisplay();
5485
+ }
5451
5486
  });
5452
5487
  this.listen(this.refs.input, "keydown", (event) => this._onInputKeydown(event));
5453
5488
  this.listen(this.refs.toggle, "click", () => this._open ? this.close() : this.open());
@@ -5661,9 +5696,16 @@ var zx = (() => {
5661
5696
  const one = this._format.replace(/%[demYy]/g, (token) => PLACEHOLDER_TOKENS[token] ?? token);
5662
5697
  return `${one}${this._separator}${one}`;
5663
5698
  }
5664
- /** @returns {void} */
5699
+ /**
5700
+ * Writes the range into the input: in the typing format while the input has focus, in the
5701
+ * display format otherwise. Text that is already there is left alone, so the caret stays put.
5702
+ * @returns {void}
5703
+ */
5665
5704
  _syncDisplay() {
5666
- this.refs.input.value = formatRangeText(this._range, this._format, this._separator);
5705
+ const input = this.refs.input;
5706
+ const format2 = this._focused ? this._format : this._displayFormat;
5707
+ const text4 = formatRangeText(this._range, format2, this._separator);
5708
+ if (input.value !== text4) input.value = text4;
5667
5709
  this._syncClear();
5668
5710
  }
5669
5711
  /** A disabled box offers no clear button: there is nothing it could do. @returns {void} */
@@ -5737,6 +5779,7 @@ var zx = (() => {
5737
5779
  static defaults = {
5738
5780
  value: null,
5739
5781
  format: "%d.%m.%Y",
5782
+ displayFormat: null,
5740
5783
  time: false,
5741
5784
  min: null,
5742
5785
  max: null,
@@ -5755,9 +5798,12 @@ var zx = (() => {
5755
5798
  this._originalAriaDisabled = root.getAttribute("aria-disabled");
5756
5799
  this._originalClearable = root.getAttribute("data-clearable");
5757
5800
  root.toggleAttribute("data-clearable", Boolean(this.options.clearable));
5758
- this._format = effectiveFormat(this.options.format, this.options.time);
5801
+ const formats = dateboxFormats(this.options);
5802
+ this._format = formats.format;
5803
+ this._displayFormat = formats.display;
5759
5804
  this._disabled = Boolean(this.options.disabled);
5760
5805
  this._open = false;
5806
+ this._focused = false;
5761
5807
  this._position = null;
5762
5808
  this._min = validDate4(this.options.min);
5763
5809
  this._max = validDate4(this.options.max);
@@ -5784,7 +5830,7 @@ var zx = (() => {
5784
5830
  class: "zx-icon-btn zx-datebox__clear",
5785
5831
  type: "button",
5786
5832
  ariaLabel: "Clear date"
5787
- }, icon("x", { size: 13 })),
5833
+ }, icon("x", { size: ICON_SIZE.dismiss })),
5788
5834
  h("button", {
5789
5835
  ref: "toggle",
5790
5836
  class: "zx-datebox__toggle",
@@ -5816,7 +5862,14 @@ var zx = (() => {
5816
5862
  this.set(event.detail.date);
5817
5863
  if (!this.options.time) this._close(true);
5818
5864
  });
5819
- this.listen(this.refs.input, "blur", () => this._commitText());
5865
+ this.listen(this.refs.input, "focus", () => {
5866
+ this._focused = true;
5867
+ if (this.el.dataset.state !== "invalid") this._syncDisplay();
5868
+ });
5869
+ this.listen(this.refs.input, "blur", () => {
5870
+ this._focused = false;
5871
+ this._commitText();
5872
+ });
5820
5873
  this.listen(this.refs.input, "keydown", (event) => this._onInputKeydown(event));
5821
5874
  this.listen(this.refs.toggle, "click", () => this._open ? this.close() : this.open());
5822
5875
  this.listen(this.refs.toggle, "keydown", (event) => {
@@ -5967,9 +6020,16 @@ var zx = (() => {
5967
6020
  if (!date || Number.isNaN(date.getTime())) return null;
5968
6021
  return clampDate(date, this._min, this._max);
5969
6022
  }
5970
- /** @returns {void} */
6023
+ /**
6024
+ * Writes the value into the input: in the typing format while the input has focus, in the
6025
+ * display format otherwise. Text that is already there is left alone, so the caret stays put.
6026
+ * @returns {void}
6027
+ */
5971
6028
  _syncDisplay() {
5972
- this.refs.input.value = this._value ? formatDate(this._value, this._format) : "";
6029
+ const input = this.refs.input;
6030
+ const format2 = this._focused ? this._format : this._displayFormat;
6031
+ const text4 = this._value ? formatDate(this._value, format2) : "";
6032
+ if (input.value !== text4) input.value = text4;
5973
6033
  this._syncClear();
5974
6034
  }
5975
6035
  /** A disabled box offers no clear button: there is nothing it could do. @returns {void} */
@@ -6015,6 +6075,10 @@ var zx = (() => {
6015
6075
  function validDate4(value) {
6016
6076
  return value instanceof Date && !Number.isNaN(value.getTime()) ? new Date(value.getTime()) : null;
6017
6077
  }
6078
+ function dateboxFormats({ format: format2 = null, displayFormat = null, time = false } = {}) {
6079
+ const typing = effectiveFormat(format2, time);
6080
+ return { format: typing, display: displayFormat ? effectiveFormat(displayFormat, time) : typing };
6081
+ }
6018
6082
  function effectiveFormat(format2, time) {
6019
6083
  const value = String(format2 || "%d.%m.%Y");
6020
6084
  return time && !/%[HM]/.test(value) ? `${value} %H:%M` : value;
@@ -6569,20 +6633,20 @@ var zx = (() => {
6569
6633
  ariaDisabled: String(index === 0),
6570
6634
  ariaLabel: `Move value ${index + 1} up`,
6571
6635
  dataset: { action: "up", index }
6572
- }, icon("chevron-up", { size: 12 })) : null,
6636
+ }, icon("chevron-up", { size: ICON_SIZE.chevron })) : null,
6573
6637
  buttons ? h("button", {
6574
6638
  class: "zx-btn",
6575
6639
  type: "button",
6576
6640
  ariaDisabled: String(index === last),
6577
6641
  ariaLabel: `Move value ${index + 1} down`,
6578
6642
  dataset: { action: "down", index }
6579
- }, icon("chevron-down", { size: 12 })) : null,
6643
+ }, icon("chevron-down", { size: ICON_SIZE.chevron })) : null,
6580
6644
  h("button", {
6581
6645
  class: "zx-btn",
6582
6646
  type: "button",
6583
6647
  ariaLabel: `Remove value ${index + 1}`,
6584
6648
  dataset: { action: "remove", index }
6585
- }, icon("x", { size: 12 }))
6649
+ }, icon("x", { size: ICON_SIZE.dismiss }))
6586
6650
  )
6587
6651
  );
6588
6652
  });
@@ -8026,8 +8090,8 @@ var zx = (() => {
8026
8090
  dataset: { indicator, tone }
8027
8091
  })
8028
8092
  );
8029
- if (indicator === "done") marker.append(icon("check", { size: 8 }));
8030
- if (indicator === "canceled") marker.append(icon("x", { size: 7 }));
8093
+ if (indicator === "done") marker.append(icon("check", { size: ICON_SIZE.marker }));
8094
+ if (indicator === "canceled") marker.append(icon("x", { size: ICON_SIZE.marker }));
8031
8095
  return name(marker, options?.label);
8032
8096
  }
8033
8097
  function priorityIcon(level, options = {}) {
@@ -8146,7 +8210,7 @@ var zx = (() => {
8146
8210
  tabIndex: -1,
8147
8211
  ariaLabel: this._message("select.clear", "Clear selection"),
8148
8212
  hidden: true
8149
- }, icon("x", { size: 13 }));
8213
+ }, icon("x", { size: ICON_SIZE.dismiss }));
8150
8214
  const loading = h("span", {
8151
8215
  ref: "loading",
8152
8216
  class: "zx-select__loading",
@@ -8160,7 +8224,7 @@ var zx = (() => {
8160
8224
  type: "button",
8161
8225
  tabIndex: -1,
8162
8226
  ariaLabel: this._message("select.toggle", "Toggle options")
8163
- }, icon("chevron-down", { size: 16 }));
8227
+ }, icon("chevron-down", { size: ICON_SIZE.chevron }));
8164
8228
  const control = h(
8165
8229
  "div",
8166
8230
  { ref: "control", class: "zx-select__control" },
@@ -8771,7 +8835,7 @@ var zx = (() => {
8771
8835
  ariaSelected: String(selected),
8772
8836
  dataset: { index }
8773
8837
  }, h("span", { class: "zx-select__option-content" }, content));
8774
- if (selected) option.append(icon("check", { size: 15 }));
8838
+ if (selected) option.append(icon("check", { size: ICON_SIZE.check }));
8775
8839
  this.refs.list.append(option);
8776
8840
  this._optionEntries.push({ item, clear, action: null, element: option });
8777
8841
  }
@@ -9613,7 +9677,7 @@ var zx = (() => {
9613
9677
  type: "button",
9614
9678
  tabIndex: -1,
9615
9679
  ariaLabel: this._message("tagPicker.toggle", "Toggle options")
9616
- }, icon("chevron-down", { size: 15 }));
9680
+ }, icon("chevron-down", { size: ICON_SIZE.chevron }));
9617
9681
  const control = h(
9618
9682
  "div",
9619
9683
  { ref: "control", class: "zx-tag-picker__control" },
@@ -9892,24 +9956,28 @@ var zx = (() => {
9892
9956
  if (!this._createdRoot && root) restoreTarget(root, this._snapshot);
9893
9957
  }
9894
9958
  /* ------------------------------------------------------------------ rendering -- */
9895
- /** @returns {void} */
9959
+ /**
9960
+ * Draws the selection. A tag is a Badge — `badge({ tone })` with the picker's own class — so it
9961
+ * has one construction wherever a label appears, and only the remove button is the picker's.
9962
+ * @returns {void}
9963
+ */
9896
9964
  _renderTags() {
9897
9965
  const tags = this._selected.map((item) => {
9898
9966
  const label = this._labelOf(item);
9899
9967
  const tone = this._toneOf(item);
9900
9968
  const color = tone ? null : this._colorOf(item);
9901
- const content = this.options.renderTag ? this.options.renderTag(item) : [this._iconOf(item), h("span", { class: "zx-tag-picker__tag-label" }, label)];
9902
- const tag = h("span", {
9903
- class: "zx-tag-picker__tag",
9904
- dataset: { colored: String(Boolean(color)), tone: tone ?? void 0 },
9905
- style: color ? { "--zx-tag-color": color } : null
9906
- }, content);
9969
+ const content = this.options.renderTag ? [this.options.renderTag(item)] : [this._iconOf(item), h("span", { class: "zx-badge__label zx-tag-picker__tag-label" }, label)];
9970
+ const tag = badge({ tone });
9971
+ tag.classList.add("zx-tag-picker__tag");
9972
+ tag.dataset.colored = String(Boolean(color));
9973
+ if (color) tag.style.setProperty("--zx-tag-color", color);
9974
+ tag.append(...content.filter((node) => node !== null && node !== void 0));
9907
9975
  if (!this._readonly && !this._disabled) {
9908
9976
  tag.append(h("button", {
9909
9977
  class: "zx-icon-btn zx-tag-picker__remove",
9910
9978
  type: "button",
9911
9979
  ariaLabel: this._message("tagPicker.remove", "Remove %1", [label])
9912
- }, icon("x", { size: 11 })));
9980
+ }, icon("x", { size: ICON_SIZE.chip })));
9913
9981
  }
9914
9982
  return tag;
9915
9983
  });
@@ -9936,7 +10004,7 @@ var zx = (() => {
9936
10004
  h(
9937
10005
  "span",
9938
10006
  { class: "zx-tag-picker__check", ariaHidden: "true" },
9939
- selected ? icon("check", { size: 13 }) : null
10007
+ selected ? icon("check", { size: ICON_SIZE.check }) : null
9940
10008
  ),
9941
10009
  h(
9942
10010
  "span",
@@ -9959,7 +10027,7 @@ var zx = (() => {
9959
10027
  ariaSelected: "false",
9960
10028
  dataset: { create: "true" }
9961
10029
  },
9962
- h("span", { class: "zx-tag-picker__check", ariaHidden: "true" }, icon("plus", { size: 13 })),
10030
+ h("span", { class: "zx-tag-picker__check", ariaHidden: "true" }, icon("plus", { size: ICON_SIZE.check })),
9963
10031
  h(
9964
10032
  "span",
9965
10033
  { class: "zx-tag-picker__option-label" },
@@ -10936,7 +11004,7 @@ var zx = (() => {
10936
11004
  class: "zx-value-list__remove",
10937
11005
  dataset: { remove: "" },
10938
11006
  ariaHidden: "true"
10939
- }, "\xD7") : null));
11007
+ }, icon("x", { size: ICON_SIZE.chip })) : null));
10940
11008
  this._list.replaceChildren(...chips);
10941
11009
  if (focusIndex >= 0) chips[Math.min(focusIndex, chips.length - 1)]?.focus();
10942
11010
  }
@@ -11829,8 +11897,8 @@ var zx = (() => {
11829
11897
  children.push(h(
11830
11898
  "span",
11831
11899
  { class: "zx-check-button__icon", ariaHidden: "true" },
11832
- h("span", { class: "zx-check-button__off" }, icon("square", { size: 15 })),
11833
- h("span", { class: "zx-check-button__on" }, icon("check", { size: 15 }))
11900
+ h("span", { class: "zx-check-button__off" }, icon("square", { size: ICON_SIZE.check })),
11901
+ h("span", { class: "zx-check-button__on" }, icon("check", { size: ICON_SIZE.check }))
11834
11902
  ));
11835
11903
  }
11836
11904
  children.push(h("span", { class: "zx-check-button__label", ref: "label" }));
@@ -12675,6 +12743,75 @@ var zx = (() => {
12675
12743
  return event.clientX < rect.left || event.clientX > rect.right || event.clientY < rect.top || event.clientY > rect.bottom;
12676
12744
  }
12677
12745
 
12746
+ // src/components/kbd/kbd.js
12747
+ var MODIFIERS = Object.freeze({
12748
+ mod: ["\u2318", "Ctrl"],
12749
+ meta: ["\u2318", "Meta"],
12750
+ cmd: ["\u2318", "Ctrl"],
12751
+ command: ["\u2318", "Ctrl"],
12752
+ ctrl: ["\u2303", "Ctrl"],
12753
+ control: ["\u2303", "Ctrl"],
12754
+ alt: ["\u2325", "Alt"],
12755
+ option: ["\u2325", "Alt"],
12756
+ shift: ["\u21E7", "Shift"],
12757
+ backspace: ["\u232B", "Backspace"],
12758
+ delete: ["\u2326", "Del"],
12759
+ tab: ["\u21E5", "Tab"]
12760
+ });
12761
+ var KEYS = Object.freeze({
12762
+ enter: "\u21B5",
12763
+ return: "\u21B5",
12764
+ escape: "Esc",
12765
+ esc: "Esc",
12766
+ space: "Space",
12767
+ arrowup: "\u2191",
12768
+ up: "\u2191",
12769
+ arrowdown: "\u2193",
12770
+ down: "\u2193",
12771
+ arrowleft: "\u2190",
12772
+ left: "\u2190",
12773
+ arrowright: "\u2192",
12774
+ right: "\u2192",
12775
+ pageup: "PgUp",
12776
+ pagedown: "PgDn",
12777
+ home: "Home",
12778
+ end: "End"
12779
+ });
12780
+ function isApplePlatform() {
12781
+ const nav = globalThis.navigator;
12782
+ if (!nav) return false;
12783
+ const platform = (
12784
+ /** @type {{userAgentData?: {platform?: string}}} */
12785
+ nav.userAgentData?.platform || nav.platform || ""
12786
+ );
12787
+ return /mac|iphone|ipad|ios/i.test(platform);
12788
+ }
12789
+ function splitChord(chord) {
12790
+ if (chord === "+") return ["+"];
12791
+ const keys = chord.split("+");
12792
+ if (chord.endsWith("++")) keys.splice(-2, 2, "+");
12793
+ return keys.map((key) => key.trim()).filter((key) => key !== "");
12794
+ }
12795
+ function keyLabel(key, apple) {
12796
+ const name2 = key.toLowerCase();
12797
+ if (Object.hasOwn(MODIFIERS, name2)) return MODIFIERS[name2][apple ? 0 : 1];
12798
+ if (Object.hasOwn(KEYS, name2)) return KEYS[name2];
12799
+ return key.length === 1 ? key.toUpperCase() : key;
12800
+ }
12801
+ function keyLabels(keys, { apple = isApplePlatform() } = {}) {
12802
+ const list = Array.isArray(keys) ? keys.map(String) : splitChord(String(keys));
12803
+ return list.map((key) => keyLabel(key, apple));
12804
+ }
12805
+ function kbd(keys, options = {}) {
12806
+ return h("kbd", {
12807
+ class: "zx-kbd",
12808
+ dataset: {
12809
+ size: options.size === "sm" ? "sm" : void 0,
12810
+ tone: options.tone === "inherit" ? "inherit" : void 0
12811
+ }
12812
+ }, keyLabels(keys).map((label) => h("kbd", { class: "zx-kbd__key" }, label)));
12813
+ }
12814
+
12678
12815
  // src/components/loading/spinner.js
12679
12816
  var defaults2 = Object.freeze({
12680
12817
  size: "md",
@@ -12738,7 +12875,7 @@ var zx = (() => {
12738
12875
  if (options.label !== "") {
12739
12876
  element.append(h("span", { class: "zx-btn__label" }, String(options.label)));
12740
12877
  }
12741
- if (options.shortcut) element.append(h("kbd", { class: "zx-btn__shortcut", ariaHidden: "true" }, options.shortcut.label));
12878
+ if (options.shortcut) element.append(shortcutHint(options.shortcut.label));
12742
12879
  if (!options.label && options.title) element.setAttribute("aria-label", options.title);
12743
12880
  if (typeof options.onclick === "function") element.onclick = options.onclick;
12744
12881
  if (options.busy) setButtonBusy(element, true);
@@ -12777,6 +12914,12 @@ var zx = (() => {
12777
12914
  }
12778
12915
  return element;
12779
12916
  }
12917
+ function shortcutHint(label) {
12918
+ const hint = kbd(String(label), { size: "sm" });
12919
+ hint.classList.add("zx-btn__shortcut");
12920
+ hint.setAttribute("aria-hidden", "true");
12921
+ return hint;
12922
+ }
12780
12923
  function normalizeKind2(value) {
12781
12924
  return ["primary", "danger", "ghost"].includes(String(value)) ? (
12782
12925
  /** @type {'primary'|'danger'|'ghost'} */
@@ -12854,7 +12997,7 @@ var zx = (() => {
12854
12997
  "data-kind": "ghost",
12855
12998
  ariaLabel: close,
12856
12999
  title: close
12857
- }, "\xD7")
13000
+ }, icon("x", { size: ICON_SIZE.dismiss }))
12858
13001
  ),
12859
13002
  h("div", { class: "zx-modal__content zx-dialog__body", ref: "content" }),
12860
13003
  h("footer", { class: "zx-dialog__footer", ref: "footer" })
@@ -13295,7 +13438,7 @@ var zx = (() => {
13295
13438
  h(
13296
13439
  "span",
13297
13440
  { class: "zx-groupbox__chevron", ariaHidden: "true" },
13298
- icon("chevron-right", { size: 16 })
13441
+ icon("chevron-right", { size: ICON_SIZE.chevron })
13299
13442
  ),
13300
13443
  h("span", { class: "zx-groupbox__title", ref: "title" }, String(this.options.title))
13301
13444
  );
@@ -13435,7 +13578,7 @@ var zx = (() => {
13435
13578
  type: "button",
13436
13579
  ariaLabel: clearLabel,
13437
13580
  title: clearLabel
13438
- }, icon("x", { size: 15 })) : null;
13581
+ }, icon("x", { size: ICON_SIZE.dismiss })) : null;
13439
13582
  const submit = h("button", {
13440
13583
  class: "zx-search__submit",
13441
13584
  ref: "submit",
@@ -13674,7 +13817,7 @@ var zx = (() => {
13674
13817
  class: "zx-tabbox__close zx-icon-btn",
13675
13818
  ariaHidden: "true",
13676
13819
  title: this._message("tabbox.close", "Close")
13677
- }, icon("x", { size: 14 })));
13820
+ }, icon("x", { size: ICON_SIZE.dismiss })));
13678
13821
  }
13679
13822
  const tab = (
13680
13823
  /** @type {HTMLButtonElement} */
@@ -15089,14 +15232,14 @@ var zx = (() => {
15089
15232
  disabled: index === 0,
15090
15233
  ariaLabel: `Move ${name2} earlier`,
15091
15234
  dataset: { columnId: column.id, columnAction: "up" }
15092
- }, icon("chevron-up", { size: 11 })),
15235
+ }, icon("chevron-up", { size: ICON_SIZE.chevron })),
15093
15236
  h("button", {
15094
15237
  class: "zx-table__column-move",
15095
15238
  type: "button",
15096
15239
  disabled: index === this._columns.length - 1,
15097
15240
  ariaLabel: `Move ${name2} later`,
15098
15241
  dataset: { columnId: column.id, columnAction: "down" }
15099
- }, icon("chevron-down", { size: 11 }))
15242
+ }, icon("chevron-down", { size: ICON_SIZE.chevron }))
15100
15243
  ) : null;
15101
15244
  return h("div", { class: "zx-table__column-option", dataset: { columnId: column.id } }, label, order);
15102
15245
  });
@@ -15376,11 +15519,17 @@ var zx = (() => {
15376
15519
  const name2 = tableHeaderName(column);
15377
15520
  if (name2 !== null) th.setAttribute("aria-label", name2);
15378
15521
  if (column.sortable && !this._spanning) {
15379
- const button2 = h("button", {
15380
- class: "zx-table__sort-button",
15381
- type: "button",
15382
- ariaLabel: name2 ?? void 0
15383
- }, h("span", { class: "zx-table__header-label" }, column.label));
15522
+ const button2 = h(
15523
+ "button",
15524
+ {
15525
+ class: "zx-table__sort-button",
15526
+ type: "button",
15527
+ ariaLabel: name2 ?? void 0
15528
+ },
15529
+ h("span", { class: "zx-table__header-label" }, column.label),
15530
+ // One arrow per sortable header; `aria-sort` on the header shows it and says which way.
15531
+ h("span", { class: "zx-table__sort-icon", ariaHidden: "true" }, icon("arrow-up", { size: ICON_SIZE.sort }))
15532
+ );
15384
15533
  this.listen(button2, "click", () => {
15385
15534
  const direction = this._sort?.id === column.id && this._sort.dir === "asc" ? "desc" : "asc";
15386
15535
  this.setSort(column.id, direction);
@@ -15580,7 +15729,7 @@ var zx = (() => {
15580
15729
  type: "button",
15581
15730
  tabIndex: -1,
15582
15731
  ariaExpanded: String(expanded)
15583
- }, icon(expanded ? "chevron-down" : "chevron-right", { size: 14 })));
15732
+ }, icon(expanded ? "chevron-down" : "chevron-right", { size: ICON_SIZE.chevron })));
15584
15733
  } else {
15585
15734
  branch.append(h("span", { class: "zx-table__tree-spacer", ariaHidden: "true" }));
15586
15735
  }
@@ -17089,6 +17238,7 @@ var zx = (() => {
17089
17238
  });
17090
17239
  var DATEBOX_ATTRS = attributes({
17091
17240
  format: text3({ default: "%d.%m.%Y", rebuild: true }),
17241
+ "display-format": text3({ property: "displayFormat", default: null, rebuild: true }),
17092
17242
  time: bool({ always: true, rebuild: true }),
17093
17243
  value: text3({ option: null, default: null, normalize: normalizeDateValue, set: (component, value) => component.set(value, { silent: true }), get: (component, host) => dateValue(component.get(), Boolean(host.time)), serialize: serializeDateValue }),
17094
17244
  placeholder: text3({ default: null, rebuild: true }),
@@ -17614,7 +17764,7 @@ var zx = (() => {
17614
17764
  }
17615
17765
 
17616
17766
  // src/components/empty-state/empty-state.js
17617
- var ICON_SIZE = Object.freeze({ md: 40, sm: 28 });
17767
+ var ICON_SIZE2 = Object.freeze({ md: 40, sm: 28 });
17618
17768
  var defaults4 = Object.freeze({
17619
17769
  icon: "folder-open",
17620
17770
  title: "",
@@ -17637,7 +17787,7 @@ var zx = (() => {
17637
17787
  element.append(h(
17638
17788
  "div",
17639
17789
  { class: "zx-empty-state__icon", ariaHidden: "true" },
17640
- icon(options.icon, { size: ICON_SIZE[size2] })
17790
+ icon(options.icon, { size: ICON_SIZE2[size2] })
17641
17791
  ));
17642
17792
  }
17643
17793
  if (options.title) {
@@ -18305,6 +18455,108 @@ var zx = (() => {
18305
18455
  }
18306
18456
  };
18307
18457
 
18458
+ // src/components/prose/prose.js
18459
+ var defaults5 = Object.freeze({
18460
+ selector: "h2[id], h3[id], h4[id]",
18461
+ label: "Copy link to %1",
18462
+ title: "Copy link",
18463
+ feedback: "Link copied",
18464
+ feedbackDuration: 2e3
18465
+ });
18466
+ function sectionHref(base, id) {
18467
+ const url = new URL(String(base));
18468
+ url.hash = String(id);
18469
+ return url.href;
18470
+ }
18471
+ function proseAnchors(root, options = {}) {
18472
+ const target = typeof root === "string" ? document.querySelector(root) : root;
18473
+ if (!(target instanceof Element)) throw new TypeError("proseAnchors root could not be resolved");
18474
+ const settings = { ...defaults5, ...options };
18475
+ const abort = new AbortController();
18476
+ const anchors = /* @__PURE__ */ new Map();
18477
+ const hosts = /* @__PURE__ */ new Set();
18478
+ const status = h("span", { class: "zx-prose__status", role: "status" });
18479
+ let timer = 0;
18480
+ const hrefFor = (id) => typeof settings.href === "function" ? String(settings.href(id)) : sectionHref(globalThis.location?.href ?? "about:blank", id);
18481
+ const refresh = () => {
18482
+ if (abort.signal.aborted) return;
18483
+ for (const [anchor, heading] of anchors) {
18484
+ if (anchor.isConnected && heading.contains(anchor) && heading.id) {
18485
+ anchor.setAttribute("href", `#${heading.id}`);
18486
+ continue;
18487
+ }
18488
+ anchor.remove();
18489
+ anchors.delete(anchor);
18490
+ }
18491
+ const headings = (
18492
+ /** @type {HTMLElement[]} */
18493
+ [...target.querySelectorAll(String(settings.selector))]
18494
+ );
18495
+ for (const heading of headings) {
18496
+ if (!heading.id || !heading.closest(".zx-prose")) continue;
18497
+ if ([...anchors.values()].includes(heading)) continue;
18498
+ const text4 = (heading.textContent ?? "").trim();
18499
+ const anchor = (
18500
+ /** @type {HTMLAnchorElement} */
18501
+ h("a", {
18502
+ class: "zx-prose__anchor",
18503
+ href: `#${heading.id}`,
18504
+ ariaLabel: String(settings.label).replace("%1", text4),
18505
+ title: String(settings.title),
18506
+ "data-zx-reveal": ""
18507
+ }, icon("link-2"))
18508
+ );
18509
+ if (!heading.hasAttribute("data-zx-reveal-host")) {
18510
+ heading.setAttribute("data-zx-reveal-host", "");
18511
+ hosts.add(heading);
18512
+ }
18513
+ heading.append(anchor);
18514
+ anchors.set(anchor, heading);
18515
+ }
18516
+ if (!status.isConnected) target.append(status);
18517
+ };
18518
+ target.addEventListener("click", async (event) => {
18519
+ const anchor = (
18520
+ /** @type {Element} */
18521
+ event.target?.closest?.(".zx-prose__anchor")
18522
+ );
18523
+ if (!(anchor instanceof HTMLAnchorElement) || !anchors.has(anchor)) return;
18524
+ if (event.button !== 0 || event.metaKey || event.ctrlKey || event.shiftKey || event.altKey) return;
18525
+ event.preventDefault();
18526
+ const heading = anchors.get(anchor);
18527
+ const url = hrefFor(heading?.id ?? "");
18528
+ const copied = await copyToClipboard(url);
18529
+ if (abort.signal.aborted) return;
18530
+ settings.oncopy?.(url, copied);
18531
+ if (!copied) return;
18532
+ clearTimeout(timer);
18533
+ for (const other of anchors.keys()) delete other.dataset.copied;
18534
+ anchor.dataset.copied = "true";
18535
+ anchor.replaceChildren(icon("check"));
18536
+ if (!status.isConnected) target.append(status);
18537
+ status.textContent = String(settings.feedback);
18538
+ timer = setTimeout(() => {
18539
+ delete anchor.dataset.copied;
18540
+ anchor.replaceChildren(icon("link-2"));
18541
+ status.textContent = "";
18542
+ }, Math.max(0, Number(settings.feedbackDuration) || 0));
18543
+ }, { signal: abort.signal });
18544
+ refresh();
18545
+ return {
18546
+ refresh,
18547
+ destroy() {
18548
+ if (abort.signal.aborted) return;
18549
+ abort.abort();
18550
+ clearTimeout(timer);
18551
+ for (const anchor of anchors.keys()) anchor.remove();
18552
+ anchors.clear();
18553
+ for (const heading of hosts) heading.removeAttribute("data-zx-reveal-host");
18554
+ hosts.clear();
18555
+ status.remove();
18556
+ }
18557
+ };
18558
+ }
18559
+
18308
18560
  // src/internal/menu-items.js
18309
18561
  var MENU_ITEM_SELECTOR = [
18310
18562
  '[role="menuitem"]',
@@ -19769,7 +20021,7 @@ var zx = (() => {
19769
20021
  var TREND_WIDTH = 100;
19770
20022
  var TREND_HEIGHT = 30;
19771
20023
  var TREND_INSET = 2;
19772
- var defaults5 = Object.freeze({
20024
+ var defaults6 = Object.freeze({
19773
20025
  label: "",
19774
20026
  value: null,
19775
20027
  format: "number",
@@ -19781,6 +20033,8 @@ var zx = (() => {
19781
20033
  trend: [],
19782
20034
  icon: null,
19783
20035
  kind: "neutral",
20036
+ variant: "default",
20037
+ emphasis: false,
19784
20038
  href: null,
19785
20039
  clickable: false,
19786
20040
  loading: false
@@ -19789,7 +20043,7 @@ var zx = (() => {
19789
20043
  var StatTile = class extends Component {
19790
20044
  static cssName = "stat-tile";
19791
20045
  /** @type {Readonly<StatTileOptions>} */
19792
- static defaults = defaults5;
20046
+ static defaults = defaults6;
19793
20047
  /**
19794
20048
  * Creates or adopts one metric tile.
19795
20049
  * @param {Element|string|null} [target=null] Existing element of the required tag, or null.
@@ -19915,6 +20169,9 @@ var zx = (() => {
19915
20169
  const magnitude = formatStatValue(Math.abs(number2), options);
19916
20170
  return { direction, sign: sign2, magnitude, text: `${sign2}${magnitude}` };
19917
20171
  }
20172
+ function normalizeStatTileVariant(value) {
20173
+ return value === "plain" ? "plain" : "default";
20174
+ }
19918
20175
  function statTileTag(options = {}) {
19919
20176
  if (safeHref(options.href)) return "a";
19920
20177
  if (options.clickable === true || typeof options.onclick === "function") return "button";
@@ -19950,6 +20207,9 @@ var zx = (() => {
19950
20207
  const loading = options.loading === true;
19951
20208
  root.classList.add("zx-stat-tile");
19952
20209
  root.dataset.kind = kind;
20210
+ root.dataset.variant = normalizeStatTileVariant(options.variant);
20211
+ if (options.emphasis === true) root.dataset.emphasis = "true";
20212
+ else delete root.dataset.emphasis;
19953
20213
  root.dataset.loading = String(loading);
19954
20214
  if (root.tagName.toLowerCase() === "a") {
19955
20215
  const href = safeHref(options.href);
@@ -20035,7 +20295,7 @@ var zx = (() => {
20035
20295
  function loadingBody(options) {
20036
20296
  const blocks = [
20037
20297
  h("div", { class: "zx-stat-tile__header" }, skeleton({ width: "55%", height: "0.75rem" })),
20038
- skeleton({ width: "70%", height: "1.75rem", radius: "md" })
20298
+ skeleton({ width: "70%", height: "calc(var(--zx-stat-tile-value-size) * 1.15)", radius: "md" })
20039
20299
  ];
20040
20300
  if (asText(options.caption).trim()) blocks.push(skeleton({ width: "35%", height: "0.75rem" }));
20041
20301
  if (options.delta !== null && options.delta !== void 0) {
@@ -20251,7 +20511,7 @@ var zx = (() => {
20251
20511
  toggleChildren.push(h("span", {
20252
20512
  class: "zx-panel__chevron",
20253
20513
  ariaHidden: "true"
20254
- }, icon("chevron-right", { size: 16 })));
20514
+ }, icon("chevron-right", { size: ICON_SIZE.chevron })));
20255
20515
  }
20256
20516
  toggleChildren.push(title);
20257
20517
  const toggle = this._collapsible ? h("button", {
@@ -21664,7 +21924,7 @@ var zx = (() => {
21664
21924
  const chevron = h(
21665
21925
  "span",
21666
21926
  { class: "zx-dock__chevron", ariaHidden: "true" },
21667
- icon("chevron-right", { size: 14 })
21927
+ icon("chevron-right", { size: ICON_SIZE.chevron })
21668
21928
  );
21669
21929
  const toggle = h("button", {
21670
21930
  class: "zx-dock__toggle",
@@ -22948,8 +23208,8 @@ var zx = (() => {
22948
23208
  * @returns {Array<Node|string>}
22949
23209
  */
22950
23210
  _markerContent(state, index) {
22951
- if (state === "complete") return [icon("check", { size: 12 })];
22952
- if (state === "error") return [icon("warning", { size: 12 })];
23211
+ if (state === "complete") return [icon("check", { size: ICON_SIZE.check })];
23212
+ if (state === "error") return [icon("warning", { size: ICON_SIZE.check })];
22953
23213
  return this.options.showNumbers ? [String(index + 1)] : [];
22954
23214
  }
22955
23215
  /**
@@ -23240,7 +23500,7 @@ var zx = (() => {
23240
23500
  return h(
23241
23501
  "span",
23242
23502
  { class: "zx-breadcrumb__separator", ariaHidden: "true" },
23243
- this.options.separator === "slash" ? "/" : icon("chevron-right", { size: 11 })
23503
+ this.options.separator === "slash" ? "/" : icon("chevron-right", { size: ICON_SIZE.chevron })
23244
23504
  );
23245
23505
  }
23246
23506
  /**
@@ -23496,7 +23756,7 @@ var zx = (() => {
23496
23756
  ref,
23497
23757
  ariaLabel: label,
23498
23758
  dataset: { kind: "default", size: "sm" }
23499
- }, icon(glyph, { size: 14 }));
23759
+ }, icon(glyph, { size: ICON_SIZE.chevron }));
23500
23760
  }
23501
23761
  /** @returns {HTMLElement} The append-style trigger. */
23502
23762
  _renderLoadMore() {
@@ -23867,7 +24127,7 @@ var zx = (() => {
23867
24127
  ref: "scopeBack",
23868
24128
  class: "zx-icon-btn zx-launcher__scope-back",
23869
24129
  type: "button"
23870
- }, icon("x"));
24130
+ }, icon("x", { size: ICON_SIZE.dismiss }));
23871
24131
  const scope2 = h(
23872
24132
  "span",
23873
24133
  { ref: "scope", class: "zx-launcher__scope", hidden: true },
@@ -23879,7 +24139,7 @@ var zx = (() => {
23879
24139
  class: "zx-icon-btn zx-launcher__close",
23880
24140
  type: "button",
23881
24141
  ariaLabel: this.options.closeLabel ?? this._message("launcher.close", "Close launcher")
23882
- }, icon("x"));
24142
+ }, icon("x", { size: ICON_SIZE.dismiss }));
23883
24143
  const status = h("div", {
23884
24144
  ref: "status",
23885
24145
  class: "zx-launcher__status",
@@ -23900,10 +24160,7 @@ var zx = (() => {
23900
24160
  role: "listbox",
23901
24161
  ariaLabel: this.options.resultsLabel ?? this._message("launcher.results", "Launcher results")
23902
24162
  });
23903
- const shortcut = this.options.shortcut === "mod+k" ? h("kbd", {
23904
- class: "zx-launcher__shortcut",
23905
- ariaHidden: "true"
23906
- }, launcherShortcutLabel()) : null;
24163
+ const shortcut = this.options.shortcut === "mod+k" ? h("span", { class: "zx-launcher__shortcut", ariaHidden: "true" }, kbd("Mod+K")) : null;
23907
24164
  const footer = launcherHints(this.options.hints, {
23908
24165
  move: this._message("launcher.hintMove", "Move"),
23909
24166
  open: this._message("launcher.hintOpen", "Open"),
@@ -24417,9 +24674,9 @@ var zx = (() => {
24417
24674
  if (caps.length) children.push(h(
24418
24675
  "span",
24419
24676
  { class: "zx-launcher__keys", ariaHidden: keys ? "true" : null },
24420
- caps.map((cap) => h("kbd", { class: "zx-launcher__key" }, cap))
24677
+ kbd(caps, { size: "sm" })
24421
24678
  ));
24422
- if (page) children.push(h("span", { class: "zx-launcher__chevron", ariaHidden: "true" }, icon("chevron-right")));
24679
+ if (page) children.push(h("span", { class: "zx-launcher__chevron", ariaHidden: "true" }, icon("chevron-right", { size: ICON_SIZE.chevron })));
24423
24680
  return (
24424
24681
  /** @type {HTMLElement} */
24425
24682
  h(tag, {
@@ -24602,24 +24859,17 @@ var zx = (() => {
24602
24859
  return message === key ? printf(fallback, args) : message;
24603
24860
  }
24604
24861
  };
24605
- function launcherShortcutLabel() {
24606
- const platform = String(
24607
- /** @type {any} */
24608
- navigator.userAgentData?.platform ?? navigator.platform ?? ""
24609
- );
24610
- return /mac|iphone|ipad/i.test(platform) ? "\u2318 K" : "Ctrl K";
24611
- }
24612
- function launcherHints(hints, defaults6) {
24862
+ function launcherHints(hints, defaults7) {
24613
24863
  if (hints === false) return null;
24614
24864
  const labels = hints && typeof hints === "object" ? hints : {};
24615
24865
  return h(
24616
24866
  "footer",
24617
24867
  { class: "zx-launcher__hints", ariaHidden: "true" },
24618
- h("span", {}, h("kbd", {}, "\u2191\u2193\u2190\u2192"), labels.move ?? defaults6.move),
24619
- h("span", {}, h("kbd", {}, "\u21B5"), labels.open ?? defaults6.open),
24868
+ h("span", {}, kbd(["\u2191\u2193\u2190\u2192"]), labels.move ?? defaults7.move),
24869
+ h("span", {}, kbd("Enter"), labels.open ?? defaults7.open),
24620
24870
  // Shown only on a page (`_syncPage()`).
24621
- h("span", { ref: "backHint", hidden: true }, h("kbd", {}, "\u232B"), labels.back ?? defaults6.back),
24622
- h("span", {}, h("kbd", {}, "Esc"), labels.close ?? defaults6.close)
24871
+ h("span", { ref: "backHint", hidden: true }, kbd("Backspace"), labels.back ?? defaults7.back),
24872
+ h("span", {}, kbd("Escape"), labels.close ?? defaults7.close)
24623
24873
  );
24624
24874
  }
24625
24875
  function isLauncherPage(item) {
@@ -27098,7 +27348,7 @@ var zx = (() => {
27098
27348
  h("span", { ref: "name", class: "zx-account-menu__name" }),
27099
27349
  h("span", { ref: "secondary", class: "zx-account-menu__secondary" })
27100
27350
  ),
27101
- h("span", { class: "zx-account-menu__chevron", ariaHidden: "true" }, icon("chevron-down"))
27351
+ h("span", { class: "zx-account-menu__chevron", ariaHidden: "true" }, icon("chevron-down", { size: ICON_SIZE.chevron }))
27102
27352
  ));
27103
27353
  return root;
27104
27354
  }
@@ -27270,7 +27520,7 @@ var zx = (() => {
27270
27520
  h("span", { ref: "name", class: "zx-workspace-switcher__name" }),
27271
27521
  h("span", { ref: "secondary", class: "zx-workspace-switcher__secondary" })
27272
27522
  ),
27273
- h("span", { class: "zx-workspace-switcher__chevron", ariaHidden: "true" }, icon("chevron-down"))
27523
+ h("span", { class: "zx-workspace-switcher__chevron", ariaHidden: "true" }, icon("chevron-down", { size: ICON_SIZE.chevron }))
27274
27524
  ));
27275
27525
  return root;
27276
27526
  }
@@ -27399,7 +27649,7 @@ var zx = (() => {
27399
27649
  description: workspace.secondary || void 0,
27400
27650
  badge: workspace.badge ?? void 0,
27401
27651
  disabled: workspace.disabled,
27402
- adornment: h("span", { class: "zx-workspace-switcher__check", ariaHidden: "true" }, icon("check"))
27652
+ adornment: h("span", { class: "zx-workspace-switcher__check", ariaHidden: "true" }, icon("check", { size: ICON_SIZE.check }))
27403
27653
  };
27404
27654
  this._entries.set(entry, workspace);
27405
27655
  rows.push([entries.length, workspace]);
@@ -29515,6 +29765,393 @@ var zx = (() => {
29515
29765
  return items.some((item) => String(item.id) === id || containsItemId2(item.children ?? [], id));
29516
29766
  }
29517
29767
 
29768
+ // src/components/context-menu/context-menu.js
29769
+ var ContextMenu = class extends Component {
29770
+ /** @type {ContextMenuOptions} */
29771
+ static defaults = {
29772
+ items: [],
29773
+ selector: null
29774
+ };
29775
+ /** @type {Element} */
29776
+ #target;
29777
+ /** @type {Dropdown} */
29778
+ #dropdown;
29779
+ /** @type {HTMLElement} */
29780
+ #panel;
29781
+ /** @type {ReturnType<typeof rovingTabindex>} */
29782
+ #roving;
29783
+ /** @type {(event: KeyboardEvent|string) => void} */
29784
+ #typeahead;
29785
+ /** @type {ContextMenuEntry[]} */
29786
+ #items = [];
29787
+ /** @type {Element|null} */
29788
+ #context = null;
29789
+ /** @type {Element|null} */
29790
+ #returnFocus = null;
29791
+ #destroyed = false;
29792
+ /**
29793
+ * Attaches a context menu to an existing element.
29794
+ * @param {Element|string} target Element or selector the menu belongs to.
29795
+ * @param {ContextMenuOptions} [options={}] Context-menu options.
29796
+ */
29797
+ constructor(target, options = {}) {
29798
+ const resolved = resolveElement(target);
29799
+ if (!resolved) throw new TypeError("ContextMenu target could not be resolved");
29800
+ super(null, options);
29801
+ this.#target = resolved;
29802
+ document.body.append(this.el);
29803
+ this.#dropdown = new Dropdown(this.el, {
29804
+ openOn: "manual",
29805
+ placement: "bottom-start",
29806
+ scope: resolved
29807
+ });
29808
+ this.#panel = this.#dropdown.getPanel();
29809
+ this.#dropdown._configure({ onEscape: () => this.close(), tabReach: false });
29810
+ this.#panel.classList.add("zx-context-menu");
29811
+ this.#panel.setAttribute("role", "menu");
29812
+ if (Array.isArray(this.options.items)) this.setItems(this.options.items);
29813
+ this.#roving = rovingTabindex(this.#panel, MENU_ITEM_SELECTOR);
29814
+ this.#typeahead = typeahead(() => this.#menuItems(), (item) => item.focus());
29815
+ this.#dropdown.on("close", () => {
29816
+ this.#context = null;
29817
+ const restore10 = this.#returnFocus;
29818
+ this.#returnFocus = null;
29819
+ if (restore10 instanceof HTMLElement && restore10.isConnected) restore10.focus();
29820
+ this.emit("close");
29821
+ });
29822
+ this.listen(this.#target, "contextmenu", (event) => this.#onContextMenu(event));
29823
+ this.listen(this.#target, "keydown", (event) => this.#onTargetKeydown(event));
29824
+ this.listen(this.#panel, "click", (event) => {
29825
+ const item = event.target.closest?.(MENU_ITEM_SELECTOR);
29826
+ if (item && this.#panel.contains(item)) this.#select(item, event);
29827
+ });
29828
+ this.listen(this.#panel, "keydown", (event) => this.#onMenuKeydown(event));
29829
+ }
29830
+ /**
29831
+ * Creates the zero-sized element the menu is anchored to.
29832
+ * @returns {HTMLElement}
29833
+ */
29834
+ render() {
29835
+ return h("span", { class: "zx-context-menu__anchor", ariaHidden: "true" });
29836
+ }
29837
+ /**
29838
+ * Replaces the menu items.
29839
+ * @param {ContextMenuEntry[]} items Menu definitions.
29840
+ * @returns {this}
29841
+ */
29842
+ setItems(items) {
29843
+ this.#items = Array.isArray(items) ? items.slice() : [];
29844
+ this.#panel.replaceChildren(...renderMenuEntries(this.#items, "context-menu"));
29845
+ return this;
29846
+ }
29847
+ /**
29848
+ * Opens the menu at a point in viewport coordinates.
29849
+ * @param {number} x Client X.
29850
+ * @param {number} y Client Y.
29851
+ * @param {Element|null} [context=null] Element the menu applies to.
29852
+ * @returns {this}
29853
+ * @fires ContextMenu#open
29854
+ */
29855
+ openAt(x, y, context = null) {
29856
+ if (!this.#prepare(context)) return this;
29857
+ this.#openResolved(x, y, context);
29858
+ return this;
29859
+ }
29860
+ /**
29861
+ * Opens the menu against an element's box, which is where a keyboard invocation puts it.
29862
+ * @param {Element} element Element to anchor to.
29863
+ * @returns {this}
29864
+ * @fires ContextMenu#open
29865
+ */
29866
+ openAtElement(element) {
29867
+ const box = element.getBoundingClientRect();
29868
+ return this.openAt(box.left, box.bottom, element);
29869
+ }
29870
+ /**
29871
+ * Closes the menu.
29872
+ * @returns {this}
29873
+ */
29874
+ close() {
29875
+ this.#dropdown.close();
29876
+ return this;
29877
+ }
29878
+ /**
29879
+ * Reports whether the menu is open.
29880
+ * @returns {boolean}
29881
+ */
29882
+ isOpen() {
29883
+ return this.#dropdown.isOpen();
29884
+ }
29885
+ /**
29886
+ * The element the open menu applies to — the `selector` match under the pointer, or the target.
29887
+ * @returns {Element|null}
29888
+ */
29889
+ getContext() {
29890
+ return this.#context;
29891
+ }
29892
+ /**
29893
+ * Detaches the menu and removes its anchor.
29894
+ * @returns {void}
29895
+ */
29896
+ destroy() {
29897
+ if (this.#destroyed) return;
29898
+ this.#destroyed = true;
29899
+ this.#roving.destroy();
29900
+ this.#dropdown.destroy();
29901
+ super.destroy();
29902
+ }
29903
+ /**
29904
+ * Resolves the items for this opening and reports whether it may proceed.
29905
+ * @param {Element|null} context Element the menu applies to.
29906
+ * @returns {boolean}
29907
+ */
29908
+ #prepare(context) {
29909
+ const items = this.options.items;
29910
+ if (typeof items === "function") {
29911
+ const resolved = items(context);
29912
+ if (!Array.isArray(resolved) || resolved.length === 0) return false;
29913
+ this.setItems(resolved);
29914
+ }
29915
+ return this.#items.length > 0;
29916
+ }
29917
+ /**
29918
+ * Places the anchor and opens, with the items for this opening already resolved.
29919
+ *
29920
+ * `left`/`top` rather than the logical insets used everywhere else: these are viewport
29921
+ * coordinates from a pointer event, which are physical whatever the writing direction is.
29922
+ *
29923
+ * @param {number} x Client X.
29924
+ * @param {number} y Client Y.
29925
+ * @param {Element|null} context Element the menu applies to.
29926
+ * @returns {void}
29927
+ */
29928
+ #openResolved(x, y, context) {
29929
+ const root = (
29930
+ /** @type {HTMLElement} */
29931
+ this.el
29932
+ );
29933
+ root.style.left = `${x}px`;
29934
+ root.style.top = `${y}px`;
29935
+ this.#context = context;
29936
+ this.#returnFocus = document.activeElement;
29937
+ this.#dropdown.open();
29938
+ this.#roving.focusFirst();
29939
+ this.emit("open", { context });
29940
+ }
29941
+ /** @param {Event} event @returns {void} */
29942
+ #onContextMenu(event) {
29943
+ const pointer = (
29944
+ /** @type {PointerEvent & {target: Element}} */
29945
+ event
29946
+ );
29947
+ const context = this.#contextFor(pointer.target);
29948
+ if (!context || !this.#prepare(context)) return;
29949
+ event.preventDefault();
29950
+ this.#openResolved(pointer.clientX, pointer.clientY, context);
29951
+ }
29952
+ /** @param {Event} event @returns {void} */
29953
+ #onTargetKeydown(event) {
29954
+ const key = (
29955
+ /** @type {KeyboardEvent} */
29956
+ event
29957
+ );
29958
+ if (key.key !== "ContextMenu" && !(key.key === "F10" && key.shiftKey)) return;
29959
+ const context = this.#contextFor(
29960
+ /** @type {Element} */
29961
+ key.target
29962
+ );
29963
+ if (!context || !this.#prepare(context)) return;
29964
+ event.preventDefault();
29965
+ const box = context.getBoundingClientRect();
29966
+ this.#openResolved(box.left, box.bottom, context);
29967
+ }
29968
+ /**
29969
+ * The element a pointer or key event applies to, honoring `selector`.
29970
+ * @param {Element|null} from Event target.
29971
+ * @returns {Element|null}
29972
+ */
29973
+ #contextFor(from) {
29974
+ if (!this.options.selector) return this.#target;
29975
+ const match = from?.closest?.(String(this.options.selector));
29976
+ return match && this.#target.contains(match) ? match : null;
29977
+ }
29978
+ /** @param {Event} event @returns {void} */
29979
+ #onMenuKeydown(event) {
29980
+ const key = (
29981
+ /** @type {KeyboardEvent} */
29982
+ event
29983
+ );
29984
+ if (key.key === "Tab") {
29985
+ event.preventDefault();
29986
+ this.close();
29987
+ return;
29988
+ }
29989
+ if (key.key === "Enter" || key.key === " ") {
29990
+ const item = (
29991
+ /** @type {Element} */
29992
+ key.target.closest?.(MENU_ITEM_SELECTOR)
29993
+ );
29994
+ if (!item || !this.#panel.contains(item)) return;
29995
+ if (key.key === "Enter" && item.tagName === "A") return;
29996
+ event.preventDefault();
29997
+ item.click();
29998
+ return;
29999
+ }
30000
+ this.#typeahead(key);
30001
+ }
30002
+ /** @param {Element} element @param {Event|null} [event=null] @returns {void} */
30003
+ #select(element, event = null) {
30004
+ const index = Number(element.getAttribute("data-menu-item"));
30005
+ const item = this.#items[index];
30006
+ if (!isMenuItem(item) || item.disabled) {
30007
+ event?.preventDefault();
30008
+ return;
30009
+ }
30010
+ const context = this.#context;
30011
+ const selected = this.emit("select", { value: item.value, item, context });
30012
+ if (selected.defaultPrevented) {
30013
+ event?.preventDefault();
30014
+ return;
30015
+ }
30016
+ try {
30017
+ item.onselect?.(item.value, item, this);
30018
+ } finally {
30019
+ this.close();
30020
+ }
30021
+ }
30022
+ /** @returns {HTMLElement[]} */
30023
+ #menuItems() {
30024
+ return Array.from(this.#panel.querySelectorAll(MENU_ITEM_SELECTOR));
30025
+ }
30026
+ };
30027
+
30028
+ // src/internal/row-actions.js
30029
+ var ROW_ACTION_LIMIT = 2;
30030
+ function isRowActionNode(entry) {
30031
+ return Boolean(entry) && typeof entry === "object" && typeof /** @type {{nodeType?: unknown}} */
30032
+ entry.nodeType === "number";
30033
+ }
30034
+ function isRowAction(entry) {
30035
+ if (!entry || typeof entry !== "object" || isRowActionNode(entry)) return false;
30036
+ const action = (
30037
+ /** @type {Record<string, unknown>} */
30038
+ entry
30039
+ );
30040
+ return action.label != null && String(action.label) !== "" && typeof action.onSelect === "function";
30041
+ }
30042
+ function planRowActions(entries) {
30043
+ const valid = (
30044
+ /** @type {RowActionEntry[]} */
30045
+ (Array.isArray(entries) ? entries : []).filter((entry) => isRowActionNode(entry) || isRowAction(entry))
30046
+ );
30047
+ if (valid.length <= ROW_ACTION_LIMIT) return { inline: valid, overflow: [] };
30048
+ const [first, ...rest] = valid;
30049
+ return {
30050
+ inline: [first, ...rest.filter(isRowActionNode)],
30051
+ overflow: (
30052
+ /** @type {RowAction[]} */
30053
+ rest.filter((entry) => !isRowActionNode(entry))
30054
+ )
30055
+ };
30056
+ }
30057
+ function rowActionLabel(action, name2) {
30058
+ const row2 = String(name2 ?? "").trim();
30059
+ return row2 ? `${String(action).trim()}: ${row2}` : String(action).trim();
30060
+ }
30061
+ function menuEntries(actions2, only = actions2) {
30062
+ return only.map((action) => ({
30063
+ label: String(action.label),
30064
+ icon: action.icon ? String(action.icon) : void 0,
30065
+ value: actions2.indexOf(action),
30066
+ danger: Boolean(action.danger),
30067
+ disabled: Boolean(action.disabled)
30068
+ }));
30069
+ }
30070
+ function renderRowActions(entries, { block, name: name2, moreLabel = "More actions", run }) {
30071
+ const plan = planRowActions(entries);
30072
+ if (plan.inline.length === 0) return null;
30073
+ const actions2 = (
30074
+ /** @type {RowAction[]} */
30075
+ (Array.isArray(entries) ? entries : []).filter(isRowAction)
30076
+ );
30077
+ const element = (
30078
+ /** @type {HTMLElement} */
30079
+ h("span", { class: `zx-${block}__actions`, "data-zx-reveal": "" })
30080
+ );
30081
+ for (const entry of plan.inline) {
30082
+ if (isRowActionNode(entry)) {
30083
+ element.append(entry);
30084
+ continue;
30085
+ }
30086
+ element.append(h("button", {
30087
+ type: "button",
30088
+ class: ["zx-icon-btn", `zx-${block}__action`],
30089
+ ariaLabel: rowActionLabel(entry.label, name2),
30090
+ title: String(entry.label),
30091
+ disabled: Boolean(entry.disabled),
30092
+ dataset: { rowAction: String(actions2.indexOf(entry)) }
30093
+ }, icon(entry.icon ? String(entry.icon) : "dots")));
30094
+ }
30095
+ let menu = null;
30096
+ if (plan.overflow.length > 0) {
30097
+ menu = new MenuButton(null, {
30098
+ icon: "dots",
30099
+ label: "",
30100
+ kind: "ghost",
30101
+ placement: "bottom-end",
30102
+ items: menuEntries(actions2, plan.overflow)
30103
+ });
30104
+ const trigger = menu.getTrigger();
30105
+ trigger.classList.add(`zx-${block}__action`, `zx-${block}__more`);
30106
+ trigger.setAttribute("aria-label", rowActionLabel(moreLabel, name2));
30107
+ trigger.title = String(moreLabel);
30108
+ menu.on("select", (event) => {
30109
+ const action = actions2[Number(
30110
+ /** @type {CustomEvent} */
30111
+ event.detail.value
30112
+ )];
30113
+ if (action && !action.disabled) run(action);
30114
+ });
30115
+ for (const type of ["zx-select", "zx-open", "zx-close"]) {
30116
+ menu.listen(trigger, type, (event) => event.stopPropagation());
30117
+ }
30118
+ element.append(trigger);
30119
+ }
30120
+ setRowActionsTabbable(element, false);
30121
+ return {
30122
+ element,
30123
+ actions: actions2,
30124
+ menu,
30125
+ destroy: () => menu?.destroy()
30126
+ };
30127
+ }
30128
+ function setRowActionsTabbable(element, tabbable) {
30129
+ if (!element) return;
30130
+ const controls = element.querySelectorAll("button, a[href], input, select, textarea, [tabindex]");
30131
+ for (const control of controls) control.tabIndex = tabbable ? 0 : -1;
30132
+ }
30133
+ function rowActionMenu(target, selector, resolve) {
30134
+ const menu = new ContextMenu(target, {
30135
+ selector,
30136
+ items: (context) => {
30137
+ const found = context ? resolve(context) : null;
30138
+ return found ? menuEntries(found.actions) : [];
30139
+ }
30140
+ });
30141
+ menu.on("select", (event) => {
30142
+ const { value, context } = (
30143
+ /** @type {CustomEvent} */
30144
+ event.detail
30145
+ );
30146
+ event.preventDefault();
30147
+ const found = context ? resolve(context) : null;
30148
+ const action = found?.actions[Number(value)];
30149
+ menu.close();
30150
+ if (action && !action.disabled) action.onSelect(found.subject);
30151
+ });
30152
+ return menu;
30153
+ }
30154
+
29518
30155
  // src/components/app-sidebar/app-sidebar.js
29519
30156
  var PRESENTATIONS = Object.freeze(["expanded", "compact", "collapsed"]);
29520
30157
  var AppSidebar = class extends Component {
@@ -29535,6 +30172,7 @@ var zx = (() => {
29535
30172
  presentations: ["expanded", "compact", "collapsed"],
29536
30173
  presentationSwitch: true,
29537
30174
  label: "Applications",
30175
+ moreLabel: "More actions",
29538
30176
  header: null,
29539
30177
  footer: null,
29540
30178
  railHeader: null,
@@ -29583,6 +30221,9 @@ var zx = (() => {
29583
30221
  }
29584
30222
  this._shownId = this._modules ? this._resolveShown(this.options.module) : null;
29585
30223
  this._modeAbort = null;
30224
+ this._strips = /* @__PURE__ */ new Map();
30225
+ this._rowMenu = null;
30226
+ this._rowMenuList = null;
29586
30227
  root.replaceChildren();
29587
30228
  return root;
29588
30229
  }
@@ -29855,6 +30496,7 @@ var zx = (() => {
29855
30496
  this._modeAbort?.abort();
29856
30497
  this._modeAbort = null;
29857
30498
  for (const tooltip2 of this._stripTooltips.splice(0)) tooltip2.destroy();
30499
+ this._dropRowActions({ menu: true });
29858
30500
  this._rail?.destroy();
29859
30501
  this._rail = null;
29860
30502
  super.destroy();
@@ -29868,6 +30510,7 @@ var zx = (() => {
29868
30510
  _renderMode() {
29869
30511
  this._modeAbort?.abort();
29870
30512
  this._modeAbort = new AbortController();
30513
+ this._dropRowActions({ menu: true });
29871
30514
  for (const tooltip2 of this._stripTooltips.splice(0)) tooltip2.destroy();
29872
30515
  this._presentationGroup = null;
29873
30516
  this._rail?.destroy();
@@ -29916,7 +30559,7 @@ var zx = (() => {
29916
30559
  class: "zx-app-sidebar__collapse zx-icon-btn",
29917
30560
  type: "button",
29918
30561
  ariaLabel: this._message("appSidebar.minimize", "Minimize application sidebar")
29919
- }, icon(this._side === "right" ? "chevron-right" : "chevron-left"))
30562
+ }, icon(this._side === "right" ? "chevron-right" : "chevron-left", { size: ICON_SIZE.chevron }))
29920
30563
  );
29921
30564
  button2.hidden = !this.options.collapsible;
29922
30565
  this._listenMode(button2, "click", () => this.collapse());
@@ -29930,7 +30573,7 @@ var zx = (() => {
29930
30573
  class: "zx-app-sidebar__rail-toggle zx-icon-btn",
29931
30574
  type: "button",
29932
30575
  ariaLabel: this._message("appSidebar.expand", "Expand application sidebar")
29933
- }, icon(this._side === "right" ? "chevron-left" : "chevron-right"))
30576
+ }, icon(this._side === "right" ? "chevron-left" : "chevron-right", { size: ICON_SIZE.chevron }))
29934
30577
  );
29935
30578
  this._railExpandButton = button2;
29936
30579
  this._listenMode(button2, "click", () => this.expand());
@@ -29943,6 +30586,7 @@ var zx = (() => {
29943
30586
  /** @type {KeyboardEvent} */
29944
30587
  event
29945
30588
  ));
30589
+ this._listenMode(list, "focusin", (event) => this._syncActionStops(event.target));
29946
30590
  }
29947
30591
  /** @returns {void} */
29948
30592
  _renderRail() {
@@ -30349,11 +30993,22 @@ var zx = (() => {
30349
30993
  /** @returns {void} */
30350
30994
  _renderTree() {
30351
30995
  if (!this.refs.list) return;
30352
- const focused = this.refs.list.contains(document.activeElement) ? (
30353
- /** @type {Element} */
30354
- document.activeElement.closest("[data-app-nav-id]")?.getAttribute("data-app-nav-id")
30355
- ) : null;
30996
+ const active = (
30997
+ /** @type {Element|null} */
30998
+ document.activeElement
30999
+ );
31000
+ const focused = active && this.refs.list.contains(active) ? (active.closest("[data-app-nav-id]") ?? rowControl(active.closest(".zx-app-sidebar__row")))?.getAttribute("data-app-nav-id") ?? null : null;
31001
+ this._dropRowActions({ menu: this._rowMenuList !== this.refs.list });
30356
31002
  this.refs.list.replaceChildren(...this._treeItems().map((item) => this._treeRow(item, 1)));
31003
+ if (this._strips.size > 0 && !this._rowMenu) {
31004
+ this._rowMenuList = this.refs.list;
31005
+ this._rowMenu = rowActionMenu(this.refs.list, ".zx-app-sidebar__line", (line) => {
31006
+ const id = rowControl(line.parentElement)?.getAttribute("data-app-nav-id") ?? null;
31007
+ const strip = id === null ? null : this._strips.get(id);
31008
+ const item = strip ? findItem2(this._items, id) : null;
31009
+ return strip && item ? { actions: strip.actions, subject: item } : null;
31010
+ });
31011
+ }
30357
31012
  this._syncActive();
30358
31013
  if (focused !== null) {
30359
31014
  const replacement = [...this.refs.list.querySelectorAll("[data-app-nav-id]")].find((control) => control.getAttribute("data-app-nav-id") === focused) ?? null;
@@ -30376,10 +31031,11 @@ var zx = (() => {
30376
31031
  location: level === 1 ? "root" : "inline"
30377
31032
  });
30378
31033
  const control = navControl2(item, hasChildren, expanded, childId, visual);
31034
+ const strip = this._renderRowActions(item);
30379
31035
  const row2 = h("li", {
30380
31036
  class: "zx-app-sidebar__row",
30381
31037
  dataset: { level }
30382
- }, control);
31038
+ }, strip ? actionLine(control, strip.element) : control);
30383
31039
  if (hasChildren) {
30384
31040
  row2.append(h("ul", {
30385
31041
  class: "zx-app-sidebar__sublist",
@@ -30419,8 +31075,65 @@ var zx = (() => {
30419
31075
  )
30420
31076
  );
30421
31077
  }
31078
+ /**
31079
+ * Builds a destination's action strip, when it lists actions.
31080
+ * @param {AppNavItem} item Destination.
31081
+ * @returns {import('../../internal/row-actions.js').RowActionStrip|null}
31082
+ */
31083
+ _renderRowActions(item) {
31084
+ const entries = Array.isArray(item.actions) ? item.actions : item.actions && typeof item.actions === "object" && "nodeType" in item.actions ? [item.actions] : [];
31085
+ if (entries.length === 0) return null;
31086
+ const strip = renderRowActions(entries, {
31087
+ block: "app-sidebar",
31088
+ name: item.label,
31089
+ moreLabel: String(this.options.moreLabel ?? "More actions"),
31090
+ run: (action) => action.onSelect(item)
31091
+ });
31092
+ if (strip) this._strips.set(String(item.id), strip);
31093
+ return strip;
31094
+ }
31095
+ /**
31096
+ * Makes the actions of the row holding focus Tab stops, and every other row's not.
31097
+ * @param {EventTarget|null} target What took focus.
31098
+ * @returns {void}
31099
+ */
31100
+ _syncActionStops(target) {
31101
+ const line = (
31102
+ /** @type {Element|null} */
31103
+ target?.closest?.(".zx-app-sidebar__line") ?? null
31104
+ );
31105
+ for (const strip of this._strips.values()) {
31106
+ setRowActionsTabbable(strip.element, Boolean(line?.contains(strip.element)));
31107
+ }
31108
+ }
31109
+ /**
31110
+ * Destroys the destinations' action strips, and with `menu` the row menu bound to the list.
31111
+ * @param {{menu?: boolean}} [options={}]
31112
+ * @returns {void}
31113
+ */
31114
+ _dropRowActions({ menu = false } = {}) {
31115
+ for (const strip of this._strips?.values() ?? []) strip.destroy();
31116
+ this._strips?.clear();
31117
+ if (menu) {
31118
+ this._rowMenu?.destroy();
31119
+ this._rowMenu = null;
31120
+ this._rowMenuList = null;
31121
+ }
31122
+ }
30422
31123
  /** @param {Event} event @returns {void} */
30423
31124
  _onTreeClick(event) {
31125
+ const actionControl = (
31126
+ /** @type {HTMLElement|null} */
31127
+ /** @type {Element|null} */
31128
+ event.target?.closest?.(".zx-app-sidebar__actions [data-row-action]") ?? null
31129
+ );
31130
+ if (actionControl && this.refs.list.contains(actionControl)) {
31131
+ const id = rowControl(actionControl.closest(".zx-app-sidebar__row"))?.getAttribute("data-app-nav-id") ?? null;
31132
+ const action = id === null ? null : this._strips.get(id)?.actions[Number(actionControl.dataset.rowAction)];
31133
+ const item2 = action ? findItem2(this._items, id) : null;
31134
+ if (action && item2 && !action.disabled) action.onSelect(item2);
31135
+ return;
31136
+ }
30424
31137
  const control = (
30425
31138
  /** @type {Element|null} */
30426
31139
  event.target?.closest?.("[data-app-nav-id]")
@@ -30447,7 +31160,7 @@ var zx = (() => {
30447
31160
  if (event.key === "ArrowRight" && item?.children?.length) {
30448
31161
  event.preventDefault();
30449
31162
  if (!this._expanded.has(String(item.id))) this.toggleBranch(item.id);
30450
- else visibleTreeControls(current.parentElement?.querySelector(".zx-app-sidebar__sublist"))[0]?.focus();
31163
+ else visibleTreeControls(current.closest(".zx-app-sidebar__row")?.querySelector(":scope > .zx-app-sidebar__sublist"))[0]?.focus();
30451
31164
  return;
30452
31165
  }
30453
31166
  if (event.key === "ArrowLeft") {
@@ -30457,7 +31170,7 @@ var zx = (() => {
30457
31170
  return;
30458
31171
  }
30459
31172
  const parentList = current.closest(".zx-app-sidebar__sublist");
30460
- const parentControl = parentList?.parentElement?.querySelector(":scope > [data-app-nav-id]");
31173
+ const parentControl = rowControl(parentList?.parentElement ?? null);
30461
31174
  if (parentControl instanceof HTMLElement) {
30462
31175
  event.preventDefault();
30463
31176
  parentControl.focus();
@@ -30526,7 +31239,7 @@ var zx = (() => {
30526
31239
  _markBranchMotion(key) {
30527
31240
  if (!this.refs.list) return;
30528
31241
  const control = [...this.refs.list.querySelectorAll("[data-app-nav-id]")].find((candidate) => candidate.getAttribute("data-app-nav-id") === key) ?? null;
30529
- const sublist = control?.parentElement?.querySelector(":scope > .zx-app-sidebar__sublist");
31242
+ const sublist = control?.closest(".zx-app-sidebar__row")?.querySelector(":scope > .zx-app-sidebar__sublist");
30530
31243
  if (sublist instanceof HTMLElement) sublist.dataset.branchMotion = "expand";
30531
31244
  }
30532
31245
  /**
@@ -30589,11 +31302,29 @@ var zx = (() => {
30589
31302
  disclosure ? h(
30590
31303
  "span",
30591
31304
  { class: "zx-app-sidebar__item-disclosure", ariaHidden: "true" },
30592
- icon(expanded ? "chevron-down" : "chevron-right")
31305
+ icon(expanded ? "chevron-down" : "chevron-right", { size: ICON_SIZE.chevron })
30593
31306
  ) : null
30594
31307
  )
30595
31308
  );
30596
31309
  }
31310
+ function rowControl(row2) {
31311
+ return (
31312
+ /** @type {HTMLElement|null} */
31313
+ row2?.querySelector(
31314
+ ":scope > [data-app-nav-id], :scope > .zx-app-sidebar__line > [data-app-nav-id]"
31315
+ ) ?? null
31316
+ );
31317
+ }
31318
+ function actionLine(control, strip) {
31319
+ return (
31320
+ /** @type {HTMLElement} */
31321
+ h("div", {
31322
+ class: "zx-app-sidebar__line",
31323
+ "data-zx-reveal-host": "",
31324
+ style: { "--zx-app-sidebar-actions": String(strip.childElementCount) }
31325
+ }, control, strip)
31326
+ );
31327
+ }
30597
31328
  function visibleTreeControls(root) {
30598
31329
  if (!root) return [];
30599
31330
  return (
@@ -30609,8 +31340,7 @@ var zx = (() => {
30609
31340
  while (candidate) {
30610
31341
  const hiddenList = candidate.closest(".zx-app-sidebar__sublist[hidden]");
30611
31342
  if (!hiddenList) return candidate;
30612
- candidate = /** @type {HTMLElement|null} */
30613
- hiddenList.parentElement?.firstElementChild ?? null;
31343
+ candidate = rowControl(hiddenList.parentElement);
30614
31344
  }
30615
31345
  return null;
30616
31346
  }
@@ -31013,7 +31743,7 @@ var zx = (() => {
31013
31743
  type: "button",
31014
31744
  ariaLabel: this._message("message.close", "Close message"),
31015
31745
  title: this._message("message.closeTitle", "Close")
31016
- }, icon("x", { size: 14 }));
31746
+ }, icon("x", { size: ICON_SIZE.dismiss }));
31017
31747
  node.append(close);
31018
31748
  this.listen(close, "click", () => this._close(entry));
31019
31749
  }
@@ -31989,266 +32719,6 @@ var zx = (() => {
31989
32719
  ]) element.style.removeProperty(property);
31990
32720
  }
31991
32721
 
31992
- // src/components/context-menu/context-menu.js
31993
- var ContextMenu = class extends Component {
31994
- /** @type {ContextMenuOptions} */
31995
- static defaults = {
31996
- items: [],
31997
- selector: null
31998
- };
31999
- /** @type {Element} */
32000
- #target;
32001
- /** @type {Dropdown} */
32002
- #dropdown;
32003
- /** @type {HTMLElement} */
32004
- #panel;
32005
- /** @type {ReturnType<typeof rovingTabindex>} */
32006
- #roving;
32007
- /** @type {(event: KeyboardEvent|string) => void} */
32008
- #typeahead;
32009
- /** @type {ContextMenuEntry[]} */
32010
- #items = [];
32011
- /** @type {Element|null} */
32012
- #context = null;
32013
- /** @type {Element|null} */
32014
- #returnFocus = null;
32015
- #destroyed = false;
32016
- /**
32017
- * Attaches a context menu to an existing element.
32018
- * @param {Element|string} target Element or selector the menu belongs to.
32019
- * @param {ContextMenuOptions} [options={}] Context-menu options.
32020
- */
32021
- constructor(target, options = {}) {
32022
- const resolved = resolveElement(target);
32023
- if (!resolved) throw new TypeError("ContextMenu target could not be resolved");
32024
- super(null, options);
32025
- this.#target = resolved;
32026
- document.body.append(this.el);
32027
- this.#dropdown = new Dropdown(this.el, {
32028
- openOn: "manual",
32029
- placement: "bottom-start",
32030
- scope: resolved
32031
- });
32032
- this.#panel = this.#dropdown.getPanel();
32033
- this.#dropdown._configure({ onEscape: () => this.close(), tabReach: false });
32034
- this.#panel.classList.add("zx-context-menu");
32035
- this.#panel.setAttribute("role", "menu");
32036
- if (Array.isArray(this.options.items)) this.setItems(this.options.items);
32037
- this.#roving = rovingTabindex(this.#panel, MENU_ITEM_SELECTOR);
32038
- this.#typeahead = typeahead(() => this.#menuItems(), (item) => item.focus());
32039
- this.#dropdown.on("close", () => {
32040
- this.#context = null;
32041
- const restore10 = this.#returnFocus;
32042
- this.#returnFocus = null;
32043
- if (restore10 instanceof HTMLElement && restore10.isConnected) restore10.focus();
32044
- this.emit("close");
32045
- });
32046
- this.listen(this.#target, "contextmenu", (event) => this.#onContextMenu(event));
32047
- this.listen(this.#target, "keydown", (event) => this.#onTargetKeydown(event));
32048
- this.listen(this.#panel, "click", (event) => {
32049
- const item = event.target.closest?.(MENU_ITEM_SELECTOR);
32050
- if (item && this.#panel.contains(item)) this.#select(item, event);
32051
- });
32052
- this.listen(this.#panel, "keydown", (event) => this.#onMenuKeydown(event));
32053
- }
32054
- /**
32055
- * Creates the zero-sized element the menu is anchored to.
32056
- * @returns {HTMLElement}
32057
- */
32058
- render() {
32059
- return h("span", { class: "zx-context-menu__anchor", ariaHidden: "true" });
32060
- }
32061
- /**
32062
- * Replaces the menu items.
32063
- * @param {ContextMenuEntry[]} items Menu definitions.
32064
- * @returns {this}
32065
- */
32066
- setItems(items) {
32067
- this.#items = Array.isArray(items) ? items.slice() : [];
32068
- this.#panel.replaceChildren(...renderMenuEntries(this.#items, "context-menu"));
32069
- return this;
32070
- }
32071
- /**
32072
- * Opens the menu at a point in viewport coordinates.
32073
- * @param {number} x Client X.
32074
- * @param {number} y Client Y.
32075
- * @param {Element|null} [context=null] Element the menu applies to.
32076
- * @returns {this}
32077
- * @fires ContextMenu#open
32078
- */
32079
- openAt(x, y, context = null) {
32080
- if (!this.#prepare(context)) return this;
32081
- this.#openResolved(x, y, context);
32082
- return this;
32083
- }
32084
- /**
32085
- * Opens the menu against an element's box, which is where a keyboard invocation puts it.
32086
- * @param {Element} element Element to anchor to.
32087
- * @returns {this}
32088
- * @fires ContextMenu#open
32089
- */
32090
- openAtElement(element) {
32091
- const box = element.getBoundingClientRect();
32092
- return this.openAt(box.left, box.bottom, element);
32093
- }
32094
- /**
32095
- * Closes the menu.
32096
- * @returns {this}
32097
- */
32098
- close() {
32099
- this.#dropdown.close();
32100
- return this;
32101
- }
32102
- /**
32103
- * Reports whether the menu is open.
32104
- * @returns {boolean}
32105
- */
32106
- isOpen() {
32107
- return this.#dropdown.isOpen();
32108
- }
32109
- /**
32110
- * The element the open menu applies to — the `selector` match under the pointer, or the target.
32111
- * @returns {Element|null}
32112
- */
32113
- getContext() {
32114
- return this.#context;
32115
- }
32116
- /**
32117
- * Detaches the menu and removes its anchor.
32118
- * @returns {void}
32119
- */
32120
- destroy() {
32121
- if (this.#destroyed) return;
32122
- this.#destroyed = true;
32123
- this.#roving.destroy();
32124
- this.#dropdown.destroy();
32125
- super.destroy();
32126
- }
32127
- /**
32128
- * Resolves the items for this opening and reports whether it may proceed.
32129
- * @param {Element|null} context Element the menu applies to.
32130
- * @returns {boolean}
32131
- */
32132
- #prepare(context) {
32133
- const items = this.options.items;
32134
- if (typeof items === "function") {
32135
- const resolved = items(context);
32136
- if (!Array.isArray(resolved) || resolved.length === 0) return false;
32137
- this.setItems(resolved);
32138
- }
32139
- return this.#items.length > 0;
32140
- }
32141
- /**
32142
- * Places the anchor and opens, with the items for this opening already resolved.
32143
- *
32144
- * `left`/`top` rather than the logical insets used everywhere else: these are viewport
32145
- * coordinates from a pointer event, which are physical whatever the writing direction is.
32146
- *
32147
- * @param {number} x Client X.
32148
- * @param {number} y Client Y.
32149
- * @param {Element|null} context Element the menu applies to.
32150
- * @returns {void}
32151
- */
32152
- #openResolved(x, y, context) {
32153
- const root = (
32154
- /** @type {HTMLElement} */
32155
- this.el
32156
- );
32157
- root.style.left = `${x}px`;
32158
- root.style.top = `${y}px`;
32159
- this.#context = context;
32160
- this.#returnFocus = document.activeElement;
32161
- this.#dropdown.open();
32162
- this.#roving.focusFirst();
32163
- this.emit("open", { context });
32164
- }
32165
- /** @param {Event} event @returns {void} */
32166
- #onContextMenu(event) {
32167
- const pointer = (
32168
- /** @type {PointerEvent & {target: Element}} */
32169
- event
32170
- );
32171
- const context = this.#contextFor(pointer.target);
32172
- if (!context || !this.#prepare(context)) return;
32173
- event.preventDefault();
32174
- this.#openResolved(pointer.clientX, pointer.clientY, context);
32175
- }
32176
- /** @param {Event} event @returns {void} */
32177
- #onTargetKeydown(event) {
32178
- const key = (
32179
- /** @type {KeyboardEvent} */
32180
- event
32181
- );
32182
- if (key.key !== "ContextMenu" && !(key.key === "F10" && key.shiftKey)) return;
32183
- const context = this.#contextFor(
32184
- /** @type {Element} */
32185
- key.target
32186
- );
32187
- if (!context || !this.#prepare(context)) return;
32188
- event.preventDefault();
32189
- const box = context.getBoundingClientRect();
32190
- this.#openResolved(box.left, box.bottom, context);
32191
- }
32192
- /**
32193
- * The element a pointer or key event applies to, honoring `selector`.
32194
- * @param {Element|null} from Event target.
32195
- * @returns {Element|null}
32196
- */
32197
- #contextFor(from) {
32198
- if (!this.options.selector) return this.#target;
32199
- const match = from?.closest?.(String(this.options.selector));
32200
- return match && this.#target.contains(match) ? match : null;
32201
- }
32202
- /** @param {Event} event @returns {void} */
32203
- #onMenuKeydown(event) {
32204
- const key = (
32205
- /** @type {KeyboardEvent} */
32206
- event
32207
- );
32208
- if (key.key === "Tab") {
32209
- event.preventDefault();
32210
- this.close();
32211
- return;
32212
- }
32213
- if (key.key === "Enter" || key.key === " ") {
32214
- const item = (
32215
- /** @type {Element} */
32216
- key.target.closest?.(MENU_ITEM_SELECTOR)
32217
- );
32218
- if (!item || !this.#panel.contains(item)) return;
32219
- if (key.key === "Enter" && item.tagName === "A") return;
32220
- event.preventDefault();
32221
- item.click();
32222
- return;
32223
- }
32224
- this.#typeahead(key);
32225
- }
32226
- /** @param {Element} element @param {Event|null} [event=null] @returns {void} */
32227
- #select(element, event = null) {
32228
- const index = Number(element.getAttribute("data-menu-item"));
32229
- const item = this.#items[index];
32230
- if (!isMenuItem(item) || item.disabled) {
32231
- event?.preventDefault();
32232
- return;
32233
- }
32234
- const context = this.#context;
32235
- const selected = this.emit("select", { value: item.value, item, context });
32236
- if (selected.defaultPrevented) {
32237
- event?.preventDefault();
32238
- return;
32239
- }
32240
- try {
32241
- item.onselect?.(item.value, item, this);
32242
- } finally {
32243
- this.close();
32244
- }
32245
- }
32246
- /** @returns {HTMLElement[]} */
32247
- #menuItems() {
32248
- return Array.from(this.#panel.querySelectorAll(MENU_ITEM_SELECTOR));
32249
- }
32250
- };
32251
-
32252
32722
  // src/components/calendar/calendar-model.js
32253
32723
  var CALENDAR_VIEWS = Object.freeze(["agenda", "day", "week", "month", "year"]);
32254
32724
  var DAY_MS2 = 864e5;
@@ -34688,14 +35158,14 @@ var zx = (() => {
34688
35158
  ariaLabel: this._message("recordView.moveFieldUp", "Move %1 up", field.label),
34689
35159
  disabled: index === 0,
34690
35160
  dataset: { viewFieldAction: "up", fieldId: field.id }
34691
- }, icon("chevron-up", { size: 11 }));
35161
+ }, icon("chevron-up", { size: ICON_SIZE.chevron }));
34692
35162
  const down = h("button", {
34693
35163
  class: "zx-record-view__field-move",
34694
35164
  type: "button",
34695
35165
  ariaLabel: this._message("recordView.moveFieldDown", "Move %1 down", field.label),
34696
35166
  disabled: index === fields.length - 1,
34697
35167
  dataset: { viewFieldAction: "down", fieldId: field.id }
34698
- }, icon("chevron-down", { size: 11 }));
35168
+ }, icon("chevron-down", { size: ICON_SIZE.chevron }));
34699
35169
  return h(
34700
35170
  "div",
34701
35171
  { class: "zx-record-view__field-option" },
@@ -35855,7 +36325,7 @@ var zx = (() => {
35855
36325
  ariaExpanded: String(!collapsed),
35856
36326
  ariaControls: `${headingId}-list`,
35857
36327
  dataset: { groupToggle: "" }
35858
- }, icon("chevron-down", { size: 14 }), labelNode) : labelNode;
36328
+ }, icon("chevron-down", { size: ICON_SIZE.chevron }), labelNode) : labelNode;
35859
36329
  const heading = h("h2", { class: "zx-card-view__group-heading", id: headingId }, content);
35860
36330
  const header = h("div", {
35861
36331
  class: "zx-card-view__group-header",
@@ -37563,7 +38033,7 @@ var zx = (() => {
37563
38033
  ariaControls: bodyId,
37564
38034
  ariaLabel: this._text(collapsed ? "expandLane" : "collapseLane", { label: lane.label }),
37565
38035
  dataset: { kanbanCollapse: "swimlane", kanbanId: lane.id }
37566
- }, icon(collapsed ? "chevron-right" : "chevron-down", { size: 13 }));
38036
+ }, icon(collapsed ? "chevron-right" : "chevron-down", { size: ICON_SIZE.chevron }));
37567
38037
  const limit = lane.limit ?? null;
37568
38038
  const wip = wipState(total, limit);
37569
38039
  const custom = this._renderHook("renderSwimlaneHeader", {
@@ -37629,7 +38099,7 @@ var zx = (() => {
37629
38099
  ariaControls: listId,
37630
38100
  ariaLabel: this._text(collapsed ? "expandColumn" : "collapseColumn", { label: column.label }),
37631
38101
  dataset: { kanbanCollapse: "column", kanbanId: column.id }
37632
- }, icon(collapsed ? "chevron-right" : "chevron-down", { size: 13 }));
38102
+ }, icon(collapsed ? "chevron-right" : "chevron-down", { size: ICON_SIZE.chevron }));
37633
38103
  const custom = this._renderHook("renderColumnHeader", {
37634
38104
  column: { ...column },
37635
38105
  swimlane: lane ? { ...lane } : null,
@@ -39649,11 +40119,11 @@ var zx = (() => {
39649
40119
  * @param {Function|{Chart?: Function}} engine Injected Chart.js constructor or namespace.
39650
40120
  * @param {Record<string, unknown>} [defaults={}] Adapter-wide Chart.js options.
39651
40121
  */
39652
- constructor(engine, defaults6 = {}) {
40122
+ constructor(engine, defaults7 = {}) {
39653
40123
  const constructor = typeof engine === "function" ? engine : engine?.Chart;
39654
40124
  if (typeof constructor !== "function") throw new TypeError("ChartJsAdapter requires an injected Chart.js constructor");
39655
40125
  this.engine = constructor;
39656
- this.defaults = cloneChartValue(defaults6);
40126
+ this.defaults = cloneChartValue(defaults7);
39657
40127
  }
39658
40128
  /**
39659
40129
  * Creates one Chart.js lifecycle handle.
@@ -39704,12 +40174,12 @@ var zx = (() => {
39704
40174
  };
39705
40175
  }
39706
40176
  };
39707
- function chartJsConfig(spec, defaults6, getInstance) {
40177
+ function chartJsConfig(spec, defaults7, getInstance) {
39708
40178
  const supplied = cloneChartValue(spec.options);
39709
40179
  const options = {
39710
40180
  responsive: true,
39711
40181
  maintainAspectRatio: false,
39712
- ...cloneChartValue(defaults6),
40182
+ ...cloneChartValue(defaults7),
39713
40183
  ...supplied
39714
40184
  };
39715
40185
  if (spec.reducedMotion) options.animation = false;
@@ -39830,14 +40300,20 @@ var zx = (() => {
39830
40300
  }
39831
40301
  function themeChartOptions(root) {
39832
40302
  if (typeof getComputedStyle !== "function") return {};
39833
- const style = getComputedStyle(root);
39834
- const color = style.getPropertyValue("--zx-color-text").trim();
39835
- const borderColor = style.getPropertyValue("--zx-color-border").trim();
39836
40303
  return {
39837
- color: color || void 0,
39838
- borderColor: borderColor || void 0
40304
+ color: themeColour(root, "--zx-color-text"),
40305
+ borderColor: themeColour(root, "--zx-color-border")
39839
40306
  };
39840
40307
  }
40308
+ function themeColour(root, token) {
40309
+ if (!getComputedStyle(root).getPropertyValue(token).trim()) return void 0;
40310
+ const probe = h("span", { hidden: true });
40311
+ probe.style.color = `var(${token})`;
40312
+ root.append(probe);
40313
+ const colour = getComputedStyle(probe).color;
40314
+ probe.remove();
40315
+ return colour || void 0;
40316
+ }
39841
40317
  function errorMessage(error2, fallback) {
39842
40318
  const message = error2 && typeof error2 === "object" && "message" in error2 ? String(error2.message) : "";
39843
40319
  return message.trim() ? message : String(fallback);
@@ -39931,6 +40407,8 @@ var zx = (() => {
39931
40407
  checked: [],
39932
40408
  icons: true,
39933
40409
  renderLabel: null,
40410
+ rowActions: null,
40411
+ moreLabel: "More actions",
39934
40412
  load: null,
39935
40413
  filter: "",
39936
40414
  label: "Tree",
@@ -39947,6 +40425,8 @@ var zx = (() => {
39947
40425
  this._loading = /* @__PURE__ */ new Map();
39948
40426
  this._focusId = null;
39949
40427
  this._filter = "";
40428
+ this._strips = [];
40429
+ this._rowMenu = null;
39950
40430
  this._createdRoot = this.el === null;
39951
40431
  this._snapshot = this._createdRoot ? null : snapshotTarget(this.el);
39952
40432
  const root = (
@@ -39994,6 +40474,21 @@ var zx = (() => {
39994
40474
  this.listen(root, "focus", () => {
39995
40475
  if (this._rows.length > 0 && !this._rowElement(this._focusId)) this._focusRow(0);
39996
40476
  });
40477
+ this.listen(root, "focusin", (event) => {
40478
+ const strip = this._stripOf(event.target);
40479
+ const row2 = strip ? this._rows[this._rowIndex(strip.closest(".zx-tree__row"))] : null;
40480
+ if (row2 && !Object.is(row2.id, this._focusId)) {
40481
+ this._focusId = row2.id;
40482
+ this._syncRows();
40483
+ }
40484
+ });
40485
+ if (typeof this.options.rowActions === "function") {
40486
+ this._rowMenu = rowActionMenu(root, ".zx-tree__row", (element) => {
40487
+ const index = this._rowIndex(element);
40488
+ const strip = this._strips[index];
40489
+ return strip ? { actions: strip.actions, subject: this._subject(this._rows[index]) } : null;
40490
+ });
40491
+ }
39997
40492
  if (String(this.options.filter ?? "") !== "") this.setFilter(this.options.filter);
39998
40493
  else this._renderRows();
39999
40494
  return root;
@@ -40239,6 +40734,7 @@ var zx = (() => {
40239
40734
  _renderRows() {
40240
40735
  const items = this._visibleItems();
40241
40736
  this._rows = flattenVisible(items, this._readers, this._expanded);
40737
+ for (const strip of this._strips.splice(0)) strip?.destroy();
40242
40738
  if (this._rows.length === 0) {
40243
40739
  this.el.replaceChildren(h(
40244
40740
  "div",
@@ -40247,14 +40743,15 @@ var zx = (() => {
40247
40743
  ));
40248
40744
  return;
40249
40745
  }
40250
- this.el.replaceChildren(...this._rows.map((row2) => this._renderRow(row2)));
40746
+ this.el.replaceChildren(...this._rows.map((row2, index) => this._renderRow(row2, index)));
40251
40747
  this._syncRows();
40252
40748
  }
40253
40749
  /**
40254
40750
  * @param {{node: TreeNode, id: unknown, level: number, posinset: number, setsize: number}} row Row spec.
40751
+ * @param {number} index Visible position.
40255
40752
  * @returns {HTMLElement}
40256
40753
  */
40257
- _renderRow(row2) {
40754
+ _renderRow(row2, index) {
40258
40755
  const branch = isBranch(row2.node, this._readers);
40259
40756
  const expanded = branch && this._expanded.has(row2.id);
40260
40757
  const element = h("div", {
@@ -40271,7 +40768,7 @@ var zx = (() => {
40271
40768
  const twisty = h(
40272
40769
  "span",
40273
40770
  { class: "zx-tree__twisty", ariaHidden: "true" },
40274
- branch ? icon("chevron-right", { size: 12 }) : null
40771
+ branch ? icon("chevron-right", { size: ICON_SIZE.chevron }) : null
40275
40772
  );
40276
40773
  twisty.dataset.action = "twisty";
40277
40774
  element.append(twisty);
@@ -40296,9 +40793,23 @@ var zx = (() => {
40296
40793
  ));
40297
40794
  }
40298
40795
  const content = this.options.renderLabel ? this.options.renderLabel(row2.node) : this._readers.label(row2.node);
40299
- element.append(h("span", { class: "zx-tree__label" }, content));
40300
- if (row2.node.badge != null) {
40301
- element.append(h("span", { class: "zx-tree__badge" }, String(row2.node.badge)));
40796
+ const label = h("span", { class: "zx-tree__label" }, content);
40797
+ element.append(label);
40798
+ const badge2 = row2.node.badge != null ? h("span", { class: "zx-tree__badge" }, String(row2.node.badge)) : null;
40799
+ if (badge2) element.append(badge2);
40800
+ const strip = typeof this.options.rowActions === "function" ? renderRowActions(this.options.rowActions(this._subject(row2)), {
40801
+ block: "tree",
40802
+ name: this._readers.label(row2.node),
40803
+ moreLabel: String(this.options.moreLabel ?? "More actions"),
40804
+ run: (action) => action.onSelect(this._subject(row2))
40805
+ }) : null;
40806
+ if (strip) {
40807
+ this._strips[index] = strip;
40808
+ label.id = uid("zx-tree-label");
40809
+ if (badge2) badge2.id = uid("zx-tree-badge");
40810
+ element.setAttribute("aria-labelledby", badge2 ? `${label.id} ${badge2.id}` : label.id);
40811
+ element.setAttribute("data-zx-reveal-host", "");
40812
+ element.append(strip.element);
40302
40813
  }
40303
40814
  return element;
40304
40815
  }
@@ -40320,6 +40831,7 @@ var zx = (() => {
40320
40831
  element.toggleAttribute("data-branch", branch);
40321
40832
  element.toggleAttribute("data-loading", this._loading.has(row2.id));
40322
40833
  element.tabIndex = index === focusIndex ? 0 : -1;
40834
+ setRowActionsTabbable(this._strips[index]?.element, index === focusIndex);
40323
40835
  const box = (
40324
40836
  /** @type {HTMLInputElement|null} */
40325
40837
  element.querySelector(".zx-tree__checkbox")
@@ -40341,6 +40853,18 @@ var zx = (() => {
40341
40853
  /* -------------------------------------------------------------- interaction -- */
40342
40854
  /** @param {MouseEvent} event @returns {void} */
40343
40855
  _onClick(event) {
40856
+ const strip = this._stripOf(event.target);
40857
+ if (strip) {
40858
+ const control = (
40859
+ /** @type {HTMLElement|null} */
40860
+ /** @type {Element} */
40861
+ event.target.closest("[data-row-action]")
40862
+ );
40863
+ const index2 = this._rowIndex(strip.closest(".zx-tree__row"));
40864
+ const action2 = control ? this._strips[index2]?.actions[Number(control.dataset.rowAction)] : null;
40865
+ if (action2 && !action2.disabled) action2.onSelect(this._subject(this._rows[index2]));
40866
+ return;
40867
+ }
40344
40868
  const element = (
40345
40869
  /** @type {Element} */
40346
40870
  event.target.closest(".zx-tree__row")
@@ -40371,6 +40895,7 @@ var zx = (() => {
40371
40895
  }
40372
40896
  /** @param {MouseEvent} event @returns {void} */
40373
40897
  _onDoubleClick(event) {
40898
+ if (this._stripOf(event.target)) return;
40374
40899
  const element = (
40375
40900
  /** @type {Element} */
40376
40901
  event.target.closest(".zx-tree__row")
@@ -40386,6 +40911,7 @@ var zx = (() => {
40386
40911
  }
40387
40912
  /** @param {KeyboardEvent} event @returns {void} */
40388
40913
  _onKeydown(event) {
40914
+ if (this._stripOf(event.target)) return;
40389
40915
  const index = this._rows.findIndex((row3) => Object.is(row3.id, this._focusId));
40390
40916
  if (index < 0 || this._rows.length === 0) return;
40391
40917
  const row2 = this._rows[index];
@@ -40534,7 +41060,32 @@ var zx = (() => {
40534
41060
  if (from < 0) return this._rows;
40535
41061
  return [...this._rows.slice(from + 1), ...this._rows.slice(0, from + 1)];
40536
41062
  }
40537
- /** @param {Element} element @returns {number} */
41063
+ /**
41064
+ * The action strip an event target sits in, if any.
41065
+ * @param {EventTarget|null} target Event target.
41066
+ * @returns {HTMLElement|null}
41067
+ */
41068
+ _stripOf(target) {
41069
+ const element = target && /** @type {Node} */
41070
+ target.nodeType === 1 ? (
41071
+ /** @type {Element} */
41072
+ target
41073
+ ) : null;
41074
+ const strip = (
41075
+ /** @type {HTMLElement|null} */
41076
+ element?.closest(".zx-tree__actions") ?? null
41077
+ );
41078
+ return strip && this.el.contains(strip) ? strip : null;
41079
+ }
41080
+ /**
41081
+ * What a row's actions receive: the node in the working tree, not a filtered copy.
41082
+ * @param {{node: TreeNode, id: unknown}|undefined} row Visible row.
41083
+ * @returns {TreeNode|null}
41084
+ */
41085
+ _subject(row2) {
41086
+ return row2 ? this.getNode(row2.id) ?? row2.node : null;
41087
+ }
41088
+ /** @param {Element|null} element @returns {number} */
40538
41089
  _rowIndex(element) {
40539
41090
  return [...this.el.querySelectorAll(".zx-tree__row")].indexOf(element);
40540
41091
  }
@@ -40570,6 +41121,9 @@ var zx = (() => {
40570
41121
  /** Restores an enhanced target to the markup it had before the takeover. @returns {void} */
40571
41122
  destroy() {
40572
41123
  const root = this.el;
41124
+ for (const strip of this._strips?.splice(0) ?? []) strip?.destroy();
41125
+ this._rowMenu?.destroy();
41126
+ this._rowMenu = null;
40573
41127
  super.destroy();
40574
41128
  if (!this._createdRoot && root) restoreTarget(root, this._snapshot);
40575
41129
  }
@@ -40828,7 +41382,7 @@ var zx = (() => {
40828
41382
  row2.append(h(
40829
41383
  "span",
40830
41384
  { class: "zx-finder__chevron", ariaHidden: "true" },
40831
- icon("chevron-right", { size: 11 })
41385
+ icon("chevron-right", { size: ICON_SIZE.chevron })
40832
41386
  ));
40833
41387
  }
40834
41388
  row2.toggleAttribute("data-branch", branch);
@@ -46781,6 +47335,12 @@ var zx = (() => {
46781
47335
 
46782
47336
  // src/components/questionnaire/questionnaire.js
46783
47337
  var AUTO_ADVANCE_DELAY = 260;
47338
+ function keyHint(key) {
47339
+ const hint = kbd([key]);
47340
+ hint.classList.add("zx-questionnaire__key");
47341
+ hint.setAttribute("aria-hidden", "true");
47342
+ return hint;
47343
+ }
46784
47344
  var Questionnaire = class extends Component {
46785
47345
  static cssName = "questionnaire";
46786
47346
  /** @type {QuestionnaireOptions & {msg: Record<string, string>}} */
@@ -47388,7 +47948,7 @@ var zx = (() => {
47388
47948
  h("span", { class: "zx-questionnaire__label" }, choice.label),
47389
47949
  choice.description ? h("span", { class: "zx-questionnaire__hint" }, choice.description) : null
47390
47950
  ),
47391
- choice.key ? h("kbd", { class: "zx-questionnaire__key", ariaHidden: "true" }, choice.key) : null
47951
+ choice.key ? keyHint(choice.key) : null
47392
47952
  )));
47393
47953
  if (item.input) {
47394
47954
  const inputId = `${this._uid}-freeform`;