@zeyos/zx 5.3.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.
- package/CHANGELOG.md +125 -0
- package/README.md +49 -16
- package/dist/types/components/app-sidebar/app-sidebar.d.ts +33 -0
- package/dist/types/components/badge/badge.d.ts +5 -4
- package/dist/types/components/datebox/date-range-box.d.ts +15 -2
- package/dist/types/components/datebox/datebox.d.ts +37 -3
- package/dist/types/components/kbd/kbd.d.ts +41 -0
- package/dist/types/components/launcher/launcher.d.ts +4 -2
- package/dist/types/components/prose/prose.d.ts +69 -0
- package/dist/types/components/questionnaire/questionnaire.d.ts +0 -36
- package/dist/types/components/stat-tile/stat-tile.d.ts +20 -0
- package/dist/types/components/tag-picker/tag-picker.d.ts +11 -5
- package/dist/types/components/tree/tree.d.ts +44 -3
- package/dist/types/core/icons.d.ts +22 -1
- package/dist/types/index.d.ts +4 -2
- package/dist/types/internal/app-rail.d.ts +10 -3
- package/dist/types/internal/row-actions.d.ts +151 -0
- package/dist/zx-zeyos.esm.js +264 -82
- package/dist/zx-zeyos.esm.min.js +4 -4
- package/dist/zx.css +1288 -439
- package/dist/zx.esm.js +952 -392
- package/dist/zx.esm.min.js +6 -6
- package/dist/zx.global.js +952 -392
- package/dist/zx.global.min.js +6 -6
- package/dist/zx.min.css +1 -1
- package/docs/api.json +112 -4
- package/docs/llms.md +433 -38
- package/docs/llms.txt +21 -1
- package/package.json +1 -1
- package/src/components/account-menu/account-menu.js +2 -2
- package/src/components/app-rail/app-rail.css +11 -11
- package/src/components/app-sidebar/app-sidebar.css +90 -17
- package/src/components/app-sidebar/app-sidebar.js +120 -12
- package/src/components/badge/badge.css +33 -20
- package/src/components/badge/badge.js +5 -4
- package/src/components/breadcrumb/breadcrumb.css +28 -3
- package/src/components/breadcrumb/breadcrumb.js +2 -2
- package/src/components/button/button.css +24 -13
- package/src/components/button/button.js +20 -2
- package/src/components/calendar/calendar.css +14 -4
- package/src/components/card-view/card-view.js +2 -2
- package/src/components/chart/chart.js +20 -5
- package/src/components/check-button/check-button.css +11 -3
- package/src/components/check-button/check-button.js +3 -3
- package/src/components/context-menu/context-menu.css +7 -1
- package/src/components/date-picker/date-picker.css +6 -0
- package/src/components/date-picker/date-picker.js +5 -5
- package/src/components/date-picker/date-range-picker.css +6 -0
- package/src/components/date-picker/date-range-picker.js +3 -3
- package/src/components/date-picker/month-picker.js +3 -3
- package/src/components/date-picker/time-picker.css +6 -0
- package/src/components/datebox/date-range-box.js +30 -6
- package/src/components/datebox/datebox.js +44 -7
- package/src/components/dialog/dialog.css +0 -1
- package/src/components/dialog/dialog.js +2 -1
- package/src/components/dock/dock.js +2 -2
- package/src/components/dropdown/dropdown.css +2 -1
- package/src/components/entity-ref/entity-ref.css +8 -1
- package/src/components/file-item/file-item.css +1 -1
- package/src/components/finder/finder.js +2 -2
- package/src/components/groupbox/groupbox.js +2 -2
- package/src/components/kanban-view/kanban-view.css +8 -4
- package/src/components/kanban-view/kanban-view.js +3 -3
- package/src/components/kbd/kbd.css +64 -0
- package/src/components/kbd/kbd.js +121 -0
- package/src/components/launcher/launcher.css +30 -25
- package/src/components/launcher/launcher.js +15 -21
- package/src/components/list-toolbar/list-toolbar.css +7 -1
- package/src/components/menu-button/menu-button.css +9 -2
- package/src/components/message/message.css +6 -2
- package/src/components/message/message.js +2 -2
- package/src/components/module-bar/module-bar.css +11 -1
- package/src/components/multi-value-editor/multi-value-editor.js +4 -4
- package/src/components/navigation-bar/navigation-bar.css +3 -2
- package/src/components/pagination/pagination.js +2 -2
- package/src/components/panel/panel.js +2 -2
- package/src/components/prose/prose.css +53 -0
- package/src/components/prose/prose.js +152 -0
- package/src/components/questionnaire/questionnaire.css +7 -17
- package/src/components/questionnaire/questionnaire.js +16 -1
- package/src/components/rating/rating.css +3 -1
- package/src/components/search/search.js +2 -2
- package/src/components/select/glyphs.js +3 -3
- package/src/components/select/select.css +35 -7
- package/src/components/select/select.js +4 -4
- package/src/components/stat-tile/stat-tile.css +56 -2
- package/src/components/stat-tile/stat-tile.js +25 -2
- package/src/components/stepper/stepper.css +2 -1
- package/src/components/stepper/stepper.js +3 -3
- package/src/components/tabbox/tabbox.css +2 -2
- package/src/components/tabbox/tabbox.js +2 -2
- package/src/components/table/table.css +52 -16
- package/src/components/table/table.js +7 -5
- package/src/components/tag-picker/tag-picker.css +56 -43
- package/src/components/tag-picker/tag-picker.js +21 -16
- package/src/components/tree/tree.css +44 -0
- package/src/components/tree/tree.js +97 -9
- package/src/components/value-list/value-list.css +25 -4
- package/src/components/value-list/value-list.js +2 -1
- package/src/components/view/record-view.js +3 -3
- package/src/components/view-settings/view-settings.css +2 -1
- package/src/components/workspace-switcher/workspace-switcher.js +3 -3
- package/src/core/icons.js +34 -3
- package/src/elements/define.js +1 -0
- package/src/index.js +4 -2
- package/src/internal/app-rail.js +5 -1
- package/src/internal/row-actions.js +203 -0
- package/styles/base.css +26 -1
- package/styles/prose.css +306 -0
- package/styles/tokens/dark.css +108 -103
- package/styles/tokens/global.css +24 -9
- package/styles/tokens/semantic.css +520 -198
- package/styles/tokens/themes.css +9 -0
- package/styles/zx.css +3 -0
package/dist/zx.esm.js
CHANGED
|
@@ -1289,12 +1289,12 @@ function mergeOptions(constructor, options) {
|
|
|
1289
1289
|
const result = {};
|
|
1290
1290
|
let messages = {};
|
|
1291
1291
|
let hasMessages = false;
|
|
1292
|
-
for (const
|
|
1293
|
-
if (!
|
|
1294
|
-
Object.assign(result,
|
|
1295
|
-
if (
|
|
1292
|
+
for (const defaults7 of chain) {
|
|
1293
|
+
if (!defaults7 || typeof defaults7 !== "object") continue;
|
|
1294
|
+
Object.assign(result, defaults7);
|
|
1295
|
+
if (defaults7.msg && typeof defaults7.msg === "object") {
|
|
1296
1296
|
hasMessages = true;
|
|
1297
|
-
messages = deepMerge(messages,
|
|
1297
|
+
messages = deepMerge(messages, defaults7.msg);
|
|
1298
1298
|
}
|
|
1299
1299
|
}
|
|
1300
1300
|
Object.assign(result, options && typeof options === "object" ? options : {});
|
|
@@ -1319,9 +1319,9 @@ function isMessageTable(value) {
|
|
|
1319
1319
|
}
|
|
1320
1320
|
function inheritedMessages(constructor) {
|
|
1321
1321
|
let messages = null;
|
|
1322
|
-
for (const
|
|
1323
|
-
if (
|
|
1324
|
-
messages = deepMerge(messages ?? {},
|
|
1322
|
+
for (const defaults7 of defaultsChain(constructor)) {
|
|
1323
|
+
if (defaults7 && typeof defaults7 === "object" && isMessageTable(defaults7.msg)) {
|
|
1324
|
+
messages = deepMerge(messages ?? {}, defaults7.msg);
|
|
1325
1325
|
}
|
|
1326
1326
|
}
|
|
1327
1327
|
return messages ? Object.freeze(messages) : null;
|
|
@@ -2760,6 +2760,22 @@ function loadFontAwesomeKit(kit) {
|
|
|
2760
2760
|
|
|
2761
2761
|
// src/core/icons.js
|
|
2762
2762
|
var SVG_NS = "http://www.w3.org/2000/svg";
|
|
2763
|
+
var ICON_SIZE = Object.freeze({
|
|
2764
|
+
/** The default: an icon that is a control's content or leads its label. */
|
|
2765
|
+
control: 16,
|
|
2766
|
+
/** Dropdown, disclosure, and reorder chevrons; calendar and pager arrows; breadcrumb separators. */
|
|
2767
|
+
chevron: 14,
|
|
2768
|
+
/** The × that clears a field, closes a tab, dialog, or message, or removes a row. */
|
|
2769
|
+
dismiss: 14,
|
|
2770
|
+
/** The check of a selected option, a pressed toggle button, or a completed step. */
|
|
2771
|
+
check: 14,
|
|
2772
|
+
/** The sort-direction arrow beside a column heading. */
|
|
2773
|
+
sort: 14,
|
|
2774
|
+
/** Any glyph inside a chip or token, its remove × included. */
|
|
2775
|
+
chip: 12,
|
|
2776
|
+
/** A glyph drawn inside a small status marker. */
|
|
2777
|
+
marker: 8
|
|
2778
|
+
});
|
|
2763
2779
|
var VIEW_BOX = "0 0 24 24";
|
|
2764
2780
|
var STROKE_WIDTH = 1.75;
|
|
2765
2781
|
var MIN_STROKE_PX = 1;
|
|
@@ -2770,6 +2786,8 @@ var icons = Object.freeze({
|
|
|
2770
2786
|
// arrow-up-wide-narrow
|
|
2771
2787
|
"arrow-down-wide-short": outline("M3 16l4 4 4-4M7 20V4M11 4h10M11 8h7M11 12h4"),
|
|
2772
2788
|
// arrow-down-wide-narrow
|
|
2789
|
+
"arrow-up": outline("M5 12l7-7 7 7M12 19V5"),
|
|
2790
|
+
"arrow-down": outline("M12 5v14M19 12l-7 7-7-7"),
|
|
2773
2791
|
"chevron-down": outline("M6 9l6 6 6-6"),
|
|
2774
2792
|
"chevron-up": outline("M18 15l-6-6-6 6"),
|
|
2775
2793
|
"chevron-left": outline("M15 18l-6-6 6-6"),
|
|
@@ -2916,7 +2934,7 @@ function builtinIcon(name2, options) {
|
|
|
2916
2934
|
return svg;
|
|
2917
2935
|
}
|
|
2918
2936
|
function iconSvg(viewBox, paint, options) {
|
|
2919
|
-
const { size: size2 =
|
|
2937
|
+
const { size: size2 = ICON_SIZE.control } = options;
|
|
2920
2938
|
const svg = document.createElementNS(SVG_NS, "svg");
|
|
2921
2939
|
svg.setAttribute("class", classList("zx-icon", options.class));
|
|
2922
2940
|
svg.setAttribute("viewBox", viewBox);
|
|
@@ -2956,7 +2974,7 @@ function warnMissingIcon(name2) {
|
|
|
2956
2974
|
console.warn(`[zx.icon] Unknown icon "${name2}" \u2014 rendered an empty placeholder. Add it with registerIcons(), or render Font Awesome with useFontAwesome().`);
|
|
2957
2975
|
}
|
|
2958
2976
|
function faIcon(classes, options) {
|
|
2959
|
-
const { size: size2 =
|
|
2977
|
+
const { size: size2 = ICON_SIZE.control } = options;
|
|
2960
2978
|
const element = document.createElement("i");
|
|
2961
2979
|
element.className = classList("zx-icon", ...classes, options.class);
|
|
2962
2980
|
element.style.fontSize = typeof size2 === "number" ? `${size2}px` : String(size2);
|
|
@@ -3360,7 +3378,7 @@ var DatePicker = class extends Component {
|
|
|
3360
3378
|
class: "zx-date-picker__nav",
|
|
3361
3379
|
type: "button",
|
|
3362
3380
|
ariaLabel: this._message("datePicker.previousMonth", "Previous month")
|
|
3363
|
-
}, icon("chevron-left")),
|
|
3381
|
+
}, icon("chevron-left", { size: ICON_SIZE.chevron })),
|
|
3364
3382
|
h("button", {
|
|
3365
3383
|
ref: "heading",
|
|
3366
3384
|
class: "zx-date-picker__heading",
|
|
@@ -3373,7 +3391,7 @@ var DatePicker = class extends Component {
|
|
|
3373
3391
|
class: "zx-date-picker__nav",
|
|
3374
3392
|
type: "button",
|
|
3375
3393
|
ariaLabel: this._message("datePicker.nextMonth", "Next month")
|
|
3376
|
-
}, icon("chevron-right"))
|
|
3394
|
+
}, icon("chevron-right", { size: ICON_SIZE.chevron }))
|
|
3377
3395
|
),
|
|
3378
3396
|
h(
|
|
3379
3397
|
"div",
|
|
@@ -3390,14 +3408,14 @@ var DatePicker = class extends Component {
|
|
|
3390
3408
|
class: "zx-date-picker__nav",
|
|
3391
3409
|
type: "button",
|
|
3392
3410
|
ariaLabel: this._message("datePicker.previousYear", "Previous year")
|
|
3393
|
-
}, icon("chevron-left")),
|
|
3411
|
+
}, icon("chevron-left", { size: ICON_SIZE.chevron })),
|
|
3394
3412
|
h("span", { ref: "quickYear", class: "zx-date-picker__quick-year", ariaLive: "polite" }),
|
|
3395
3413
|
h("button", {
|
|
3396
3414
|
ref: "quickNext",
|
|
3397
3415
|
class: "zx-date-picker__nav",
|
|
3398
3416
|
type: "button",
|
|
3399
3417
|
ariaLabel: this._message("datePicker.nextYear", "Next year")
|
|
3400
|
-
}, icon("chevron-right"))
|
|
3418
|
+
}, icon("chevron-right", { size: ICON_SIZE.chevron }))
|
|
3401
3419
|
),
|
|
3402
3420
|
h("div", { ref: "quickGrid", class: "zx-date-picker__quick-grid", role: "grid" })
|
|
3403
3421
|
),
|
|
@@ -3815,14 +3833,14 @@ var MonthPicker = class extends DatePicker {
|
|
|
3815
3833
|
class: "zx-month-picker__nav",
|
|
3816
3834
|
type: "button",
|
|
3817
3835
|
ariaLabel: this._message("monthPicker.previousYear", "Previous year")
|
|
3818
|
-
}, icon("chevron-left")),
|
|
3836
|
+
}, icon("chevron-left", { size: ICON_SIZE.chevron })),
|
|
3819
3837
|
h("span", { ref: "year", class: "zx-month-picker__year", ariaLive: "polite" }),
|
|
3820
3838
|
h("button", {
|
|
3821
3839
|
ref: "nextYear",
|
|
3822
3840
|
class: "zx-month-picker__nav",
|
|
3823
3841
|
type: "button",
|
|
3824
3842
|
ariaLabel: this._message("monthPicker.nextYear", "Next year")
|
|
3825
|
-
}, icon("chevron-right"))
|
|
3843
|
+
}, icon("chevron-right", { size: ICON_SIZE.chevron }))
|
|
3826
3844
|
),
|
|
3827
3845
|
h("div", {
|
|
3828
3846
|
ref: "grid",
|
|
@@ -4712,14 +4730,14 @@ var DateRangePicker = class extends Component {
|
|
|
4712
4730
|
type: "button",
|
|
4713
4731
|
dataset: { nav: "previous" },
|
|
4714
4732
|
ariaLabel: text("daterange.previousMonth", "Previous month")
|
|
4715
|
-
}, icon("chevron-left")),
|
|
4733
|
+
}, icon("chevron-left", { size: ICON_SIZE.chevron })),
|
|
4716
4734
|
h("div", { class: "zx-date-range-picker__caption", ariaHidden: "true" }, caption),
|
|
4717
4735
|
h("button", {
|
|
4718
4736
|
class: "zx-date-range-picker__nav",
|
|
4719
4737
|
type: "button",
|
|
4720
4738
|
dataset: { nav: "next" },
|
|
4721
4739
|
ariaLabel: text("daterange.nextMonth", "Next month")
|
|
4722
|
-
}, icon("chevron-right"))
|
|
4740
|
+
}, icon("chevron-right", { size: ICON_SIZE.chevron }))
|
|
4723
4741
|
),
|
|
4724
4742
|
h(
|
|
4725
4743
|
"table",
|
|
@@ -5045,6 +5063,7 @@ var DateRangeBox = class extends Component {
|
|
|
5045
5063
|
start: null,
|
|
5046
5064
|
end: null,
|
|
5047
5065
|
format: "%d.%m.%Y",
|
|
5066
|
+
displayFormat: null,
|
|
5048
5067
|
separator: " \u2013 ",
|
|
5049
5068
|
placeholder: null,
|
|
5050
5069
|
clearable: true,
|
|
@@ -5072,9 +5091,11 @@ var DateRangeBox = class extends Component {
|
|
|
5072
5091
|
this._originalClearable = root.getAttribute("data-clearable");
|
|
5073
5092
|
root.toggleAttribute("data-clearable", Boolean(this.options.clearable));
|
|
5074
5093
|
this._format = String(this.options.format || "%d.%m.%Y");
|
|
5094
|
+
this._displayFormat = this.options.displayFormat ? String(this.options.displayFormat) : this._format;
|
|
5075
5095
|
this._separator = String(this.options.separator ?? " \u2013 ");
|
|
5076
5096
|
this._disabled = Boolean(this.options.disabled);
|
|
5077
5097
|
this._open = false;
|
|
5098
|
+
this._focused = false;
|
|
5078
5099
|
this._position = null;
|
|
5079
5100
|
this._range = this._coerce({ start: this.options.start, end: this.options.end });
|
|
5080
5101
|
const popoverId = uid("zx-date-range-box-popover");
|
|
@@ -5099,7 +5120,7 @@ var DateRangeBox = class extends Component {
|
|
|
5099
5120
|
class: "zx-icon-btn zx-date-range-box__clear",
|
|
5100
5121
|
type: "button",
|
|
5101
5122
|
ariaLabel: text2("daterange.clear", "Clear date range")
|
|
5102
|
-
}, icon("x", { size:
|
|
5123
|
+
}, icon("x", { size: ICON_SIZE.dismiss })),
|
|
5103
5124
|
h("button", {
|
|
5104
5125
|
ref: "toggle",
|
|
5105
5126
|
class: "zx-date-range-box__toggle",
|
|
@@ -5142,8 +5163,16 @@ var DateRangeBox = class extends Component {
|
|
|
5142
5163
|
this._apply({ start: event.detail.start, end: event.detail.end }, { push: false });
|
|
5143
5164
|
if (event.detail.start && event.detail.end) this._close(true);
|
|
5144
5165
|
});
|
|
5166
|
+
this.listen(this.refs.input, "focus", () => {
|
|
5167
|
+
this._focused = true;
|
|
5168
|
+
if (this.el.dataset.state !== "invalid") this._syncDisplay();
|
|
5169
|
+
});
|
|
5145
5170
|
this.listen(this.refs.input, "blur", () => {
|
|
5171
|
+
this._focused = false;
|
|
5146
5172
|
if (!this._open) this._commitText();
|
|
5173
|
+
else if (this.refs.input.value === formatRangeText(this._range, this._format, this._separator)) {
|
|
5174
|
+
this._syncDisplay();
|
|
5175
|
+
}
|
|
5147
5176
|
});
|
|
5148
5177
|
this.listen(this.refs.input, "keydown", (event) => this._onInputKeydown(event));
|
|
5149
5178
|
this.listen(this.refs.toggle, "click", () => this._open ? this.close() : this.open());
|
|
@@ -5357,9 +5386,16 @@ var DateRangeBox = class extends Component {
|
|
|
5357
5386
|
const one = this._format.replace(/%[demYy]/g, (token) => PLACEHOLDER_TOKENS[token] ?? token);
|
|
5358
5387
|
return `${one}${this._separator}${one}`;
|
|
5359
5388
|
}
|
|
5360
|
-
/**
|
|
5389
|
+
/**
|
|
5390
|
+
* Writes the range into the input: in the typing format while the input has focus, in the
|
|
5391
|
+
* display format otherwise. Text that is already there is left alone, so the caret stays put.
|
|
5392
|
+
* @returns {void}
|
|
5393
|
+
*/
|
|
5361
5394
|
_syncDisplay() {
|
|
5362
|
-
|
|
5395
|
+
const input = this.refs.input;
|
|
5396
|
+
const format2 = this._focused ? this._format : this._displayFormat;
|
|
5397
|
+
const text4 = formatRangeText(this._range, format2, this._separator);
|
|
5398
|
+
if (input.value !== text4) input.value = text4;
|
|
5363
5399
|
this._syncClear();
|
|
5364
5400
|
}
|
|
5365
5401
|
/** A disabled box offers no clear button: there is nothing it could do. @returns {void} */
|
|
@@ -5433,6 +5469,7 @@ var Datebox = class extends Component {
|
|
|
5433
5469
|
static defaults = {
|
|
5434
5470
|
value: null,
|
|
5435
5471
|
format: "%d.%m.%Y",
|
|
5472
|
+
displayFormat: null,
|
|
5436
5473
|
time: false,
|
|
5437
5474
|
min: null,
|
|
5438
5475
|
max: null,
|
|
@@ -5451,9 +5488,12 @@ var Datebox = class extends Component {
|
|
|
5451
5488
|
this._originalAriaDisabled = root.getAttribute("aria-disabled");
|
|
5452
5489
|
this._originalClearable = root.getAttribute("data-clearable");
|
|
5453
5490
|
root.toggleAttribute("data-clearable", Boolean(this.options.clearable));
|
|
5454
|
-
|
|
5491
|
+
const formats = dateboxFormats(this.options);
|
|
5492
|
+
this._format = formats.format;
|
|
5493
|
+
this._displayFormat = formats.display;
|
|
5455
5494
|
this._disabled = Boolean(this.options.disabled);
|
|
5456
5495
|
this._open = false;
|
|
5496
|
+
this._focused = false;
|
|
5457
5497
|
this._position = null;
|
|
5458
5498
|
this._min = validDate4(this.options.min);
|
|
5459
5499
|
this._max = validDate4(this.options.max);
|
|
@@ -5480,7 +5520,7 @@ var Datebox = class extends Component {
|
|
|
5480
5520
|
class: "zx-icon-btn zx-datebox__clear",
|
|
5481
5521
|
type: "button",
|
|
5482
5522
|
ariaLabel: "Clear date"
|
|
5483
|
-
}, icon("x", { size:
|
|
5523
|
+
}, icon("x", { size: ICON_SIZE.dismiss })),
|
|
5484
5524
|
h("button", {
|
|
5485
5525
|
ref: "toggle",
|
|
5486
5526
|
class: "zx-datebox__toggle",
|
|
@@ -5512,7 +5552,14 @@ var Datebox = class extends Component {
|
|
|
5512
5552
|
this.set(event.detail.date);
|
|
5513
5553
|
if (!this.options.time) this._close(true);
|
|
5514
5554
|
});
|
|
5515
|
-
this.listen(this.refs.input, "
|
|
5555
|
+
this.listen(this.refs.input, "focus", () => {
|
|
5556
|
+
this._focused = true;
|
|
5557
|
+
if (this.el.dataset.state !== "invalid") this._syncDisplay();
|
|
5558
|
+
});
|
|
5559
|
+
this.listen(this.refs.input, "blur", () => {
|
|
5560
|
+
this._focused = false;
|
|
5561
|
+
this._commitText();
|
|
5562
|
+
});
|
|
5516
5563
|
this.listen(this.refs.input, "keydown", (event) => this._onInputKeydown(event));
|
|
5517
5564
|
this.listen(this.refs.toggle, "click", () => this._open ? this.close() : this.open());
|
|
5518
5565
|
this.listen(this.refs.toggle, "keydown", (event) => {
|
|
@@ -5663,9 +5710,16 @@ var Datebox = class extends Component {
|
|
|
5663
5710
|
if (!date || Number.isNaN(date.getTime())) return null;
|
|
5664
5711
|
return clampDate(date, this._min, this._max);
|
|
5665
5712
|
}
|
|
5666
|
-
/**
|
|
5713
|
+
/**
|
|
5714
|
+
* Writes the value into the input: in the typing format while the input has focus, in the
|
|
5715
|
+
* display format otherwise. Text that is already there is left alone, so the caret stays put.
|
|
5716
|
+
* @returns {void}
|
|
5717
|
+
*/
|
|
5667
5718
|
_syncDisplay() {
|
|
5668
|
-
|
|
5719
|
+
const input = this.refs.input;
|
|
5720
|
+
const format2 = this._focused ? this._format : this._displayFormat;
|
|
5721
|
+
const text4 = this._value ? formatDate(this._value, format2) : "";
|
|
5722
|
+
if (input.value !== text4) input.value = text4;
|
|
5669
5723
|
this._syncClear();
|
|
5670
5724
|
}
|
|
5671
5725
|
/** A disabled box offers no clear button: there is nothing it could do. @returns {void} */
|
|
@@ -5711,6 +5765,10 @@ var DateTimeBox = function DateTimeBox2(target, options = {}) {
|
|
|
5711
5765
|
function validDate4(value) {
|
|
5712
5766
|
return value instanceof Date && !Number.isNaN(value.getTime()) ? new Date(value.getTime()) : null;
|
|
5713
5767
|
}
|
|
5768
|
+
function dateboxFormats({ format: format2 = null, displayFormat = null, time = false } = {}) {
|
|
5769
|
+
const typing = effectiveFormat(format2, time);
|
|
5770
|
+
return { format: typing, display: displayFormat ? effectiveFormat(displayFormat, time) : typing };
|
|
5771
|
+
}
|
|
5714
5772
|
function effectiveFormat(format2, time) {
|
|
5715
5773
|
const value = String(format2 || "%d.%m.%Y");
|
|
5716
5774
|
return time && !/%[HM]/.test(value) ? `${value} %H:%M` : value;
|
|
@@ -6265,20 +6323,20 @@ var MultiValueEditor = class extends Component {
|
|
|
6265
6323
|
ariaDisabled: String(index === 0),
|
|
6266
6324
|
ariaLabel: `Move value ${index + 1} up`,
|
|
6267
6325
|
dataset: { action: "up", index }
|
|
6268
|
-
}, icon("chevron-up", { size:
|
|
6326
|
+
}, icon("chevron-up", { size: ICON_SIZE.chevron })) : null,
|
|
6269
6327
|
buttons ? h("button", {
|
|
6270
6328
|
class: "zx-btn",
|
|
6271
6329
|
type: "button",
|
|
6272
6330
|
ariaDisabled: String(index === last),
|
|
6273
6331
|
ariaLabel: `Move value ${index + 1} down`,
|
|
6274
6332
|
dataset: { action: "down", index }
|
|
6275
|
-
}, icon("chevron-down", { size:
|
|
6333
|
+
}, icon("chevron-down", { size: ICON_SIZE.chevron })) : null,
|
|
6276
6334
|
h("button", {
|
|
6277
6335
|
class: "zx-btn",
|
|
6278
6336
|
type: "button",
|
|
6279
6337
|
ariaLabel: `Remove value ${index + 1}`,
|
|
6280
6338
|
dataset: { action: "remove", index }
|
|
6281
|
-
}, icon("x", { size:
|
|
6339
|
+
}, icon("x", { size: ICON_SIZE.dismiss }))
|
|
6282
6340
|
)
|
|
6283
6341
|
);
|
|
6284
6342
|
});
|
|
@@ -7722,8 +7780,8 @@ function statusIcon(status, options = {}) {
|
|
|
7722
7780
|
dataset: { indicator, tone }
|
|
7723
7781
|
})
|
|
7724
7782
|
);
|
|
7725
|
-
if (indicator === "done") marker.append(icon("check", { size:
|
|
7726
|
-
if (indicator === "canceled") marker.append(icon("x", { size:
|
|
7783
|
+
if (indicator === "done") marker.append(icon("check", { size: ICON_SIZE.marker }));
|
|
7784
|
+
if (indicator === "canceled") marker.append(icon("x", { size: ICON_SIZE.marker }));
|
|
7727
7785
|
return name(marker, options?.label);
|
|
7728
7786
|
}
|
|
7729
7787
|
function priorityIcon(level, options = {}) {
|
|
@@ -7842,7 +7900,7 @@ var Select = class _Select extends Component {
|
|
|
7842
7900
|
tabIndex: -1,
|
|
7843
7901
|
ariaLabel: this._message("select.clear", "Clear selection"),
|
|
7844
7902
|
hidden: true
|
|
7845
|
-
}, icon("x", { size:
|
|
7903
|
+
}, icon("x", { size: ICON_SIZE.dismiss }));
|
|
7846
7904
|
const loading = h("span", {
|
|
7847
7905
|
ref: "loading",
|
|
7848
7906
|
class: "zx-select__loading",
|
|
@@ -7856,7 +7914,7 @@ var Select = class _Select extends Component {
|
|
|
7856
7914
|
type: "button",
|
|
7857
7915
|
tabIndex: -1,
|
|
7858
7916
|
ariaLabel: this._message("select.toggle", "Toggle options")
|
|
7859
|
-
}, icon("chevron-down", { size:
|
|
7917
|
+
}, icon("chevron-down", { size: ICON_SIZE.chevron }));
|
|
7860
7918
|
const control = h(
|
|
7861
7919
|
"div",
|
|
7862
7920
|
{ ref: "control", class: "zx-select__control" },
|
|
@@ -8467,7 +8525,7 @@ var Select = class _Select extends Component {
|
|
|
8467
8525
|
ariaSelected: String(selected),
|
|
8468
8526
|
dataset: { index }
|
|
8469
8527
|
}, h("span", { class: "zx-select__option-content" }, content));
|
|
8470
|
-
if (selected) option.append(icon("check", { size:
|
|
8528
|
+
if (selected) option.append(icon("check", { size: ICON_SIZE.check }));
|
|
8471
8529
|
this.refs.list.append(option);
|
|
8472
8530
|
this._optionEntries.push({ item, clear, action: null, element: option });
|
|
8473
8531
|
}
|
|
@@ -9309,7 +9367,7 @@ var TagPicker = class extends Component {
|
|
|
9309
9367
|
type: "button",
|
|
9310
9368
|
tabIndex: -1,
|
|
9311
9369
|
ariaLabel: this._message("tagPicker.toggle", "Toggle options")
|
|
9312
|
-
}, icon("chevron-down", { size:
|
|
9370
|
+
}, icon("chevron-down", { size: ICON_SIZE.chevron }));
|
|
9313
9371
|
const control = h(
|
|
9314
9372
|
"div",
|
|
9315
9373
|
{ ref: "control", class: "zx-tag-picker__control" },
|
|
@@ -9588,24 +9646,28 @@ var TagPicker = class extends Component {
|
|
|
9588
9646
|
if (!this._createdRoot && root) restoreTarget(root, this._snapshot);
|
|
9589
9647
|
}
|
|
9590
9648
|
/* ------------------------------------------------------------------ rendering -- */
|
|
9591
|
-
/**
|
|
9649
|
+
/**
|
|
9650
|
+
* Draws the selection. A tag is a Badge — `badge({ tone })` with the picker's own class — so it
|
|
9651
|
+
* has one construction wherever a label appears, and only the remove button is the picker's.
|
|
9652
|
+
* @returns {void}
|
|
9653
|
+
*/
|
|
9592
9654
|
_renderTags() {
|
|
9593
9655
|
const tags = this._selected.map((item) => {
|
|
9594
9656
|
const label = this._labelOf(item);
|
|
9595
9657
|
const tone = this._toneOf(item);
|
|
9596
9658
|
const color = tone ? null : this._colorOf(item);
|
|
9597
|
-
const content = this.options.renderTag ? this.options.renderTag(item) : [this._iconOf(item), h("span", { class: "zx-tag-picker__tag-label" }, label)];
|
|
9598
|
-
const tag =
|
|
9599
|
-
|
|
9600
|
-
|
|
9601
|
-
|
|
9602
|
-
|
|
9659
|
+
const content = this.options.renderTag ? [this.options.renderTag(item)] : [this._iconOf(item), h("span", { class: "zx-badge__label zx-tag-picker__tag-label" }, label)];
|
|
9660
|
+
const tag = badge({ tone });
|
|
9661
|
+
tag.classList.add("zx-tag-picker__tag");
|
|
9662
|
+
tag.dataset.colored = String(Boolean(color));
|
|
9663
|
+
if (color) tag.style.setProperty("--zx-tag-color", color);
|
|
9664
|
+
tag.append(...content.filter((node) => node !== null && node !== void 0));
|
|
9603
9665
|
if (!this._readonly && !this._disabled) {
|
|
9604
9666
|
tag.append(h("button", {
|
|
9605
9667
|
class: "zx-icon-btn zx-tag-picker__remove",
|
|
9606
9668
|
type: "button",
|
|
9607
9669
|
ariaLabel: this._message("tagPicker.remove", "Remove %1", [label])
|
|
9608
|
-
}, icon("x", { size:
|
|
9670
|
+
}, icon("x", { size: ICON_SIZE.chip })));
|
|
9609
9671
|
}
|
|
9610
9672
|
return tag;
|
|
9611
9673
|
});
|
|
@@ -9632,7 +9694,7 @@ var TagPicker = class extends Component {
|
|
|
9632
9694
|
h(
|
|
9633
9695
|
"span",
|
|
9634
9696
|
{ class: "zx-tag-picker__check", ariaHidden: "true" },
|
|
9635
|
-
selected ? icon("check", { size:
|
|
9697
|
+
selected ? icon("check", { size: ICON_SIZE.check }) : null
|
|
9636
9698
|
),
|
|
9637
9699
|
h(
|
|
9638
9700
|
"span",
|
|
@@ -9655,7 +9717,7 @@ var TagPicker = class extends Component {
|
|
|
9655
9717
|
ariaSelected: "false",
|
|
9656
9718
|
dataset: { create: "true" }
|
|
9657
9719
|
},
|
|
9658
|
-
h("span", { class: "zx-tag-picker__check", ariaHidden: "true" }, icon("plus", { size:
|
|
9720
|
+
h("span", { class: "zx-tag-picker__check", ariaHidden: "true" }, icon("plus", { size: ICON_SIZE.check })),
|
|
9659
9721
|
h(
|
|
9660
9722
|
"span",
|
|
9661
9723
|
{ class: "zx-tag-picker__option-label" },
|
|
@@ -10632,7 +10694,7 @@ var ValueList = class extends Component {
|
|
|
10632
10694
|
class: "zx-value-list__remove",
|
|
10633
10695
|
dataset: { remove: "" },
|
|
10634
10696
|
ariaHidden: "true"
|
|
10635
|
-
}, "
|
|
10697
|
+
}, icon("x", { size: ICON_SIZE.chip })) : null));
|
|
10636
10698
|
this._list.replaceChildren(...chips);
|
|
10637
10699
|
if (focusIndex >= 0) chips[Math.min(focusIndex, chips.length - 1)]?.focus();
|
|
10638
10700
|
}
|
|
@@ -11525,8 +11587,8 @@ var CheckButton = class extends Component {
|
|
|
11525
11587
|
children.push(h(
|
|
11526
11588
|
"span",
|
|
11527
11589
|
{ class: "zx-check-button__icon", ariaHidden: "true" },
|
|
11528
|
-
h("span", { class: "zx-check-button__off" }, icon("square", { size:
|
|
11529
|
-
h("span", { class: "zx-check-button__on" }, icon("check", { size:
|
|
11590
|
+
h("span", { class: "zx-check-button__off" }, icon("square", { size: ICON_SIZE.check })),
|
|
11591
|
+
h("span", { class: "zx-check-button__on" }, icon("check", { size: ICON_SIZE.check }))
|
|
11530
11592
|
));
|
|
11531
11593
|
}
|
|
11532
11594
|
children.push(h("span", { class: "zx-check-button__label", ref: "label" }));
|
|
@@ -12371,6 +12433,75 @@ function isBackdropClick(dialog, event) {
|
|
|
12371
12433
|
return event.clientX < rect.left || event.clientX > rect.right || event.clientY < rect.top || event.clientY > rect.bottom;
|
|
12372
12434
|
}
|
|
12373
12435
|
|
|
12436
|
+
// src/components/kbd/kbd.js
|
|
12437
|
+
var MODIFIERS = Object.freeze({
|
|
12438
|
+
mod: ["\u2318", "Ctrl"],
|
|
12439
|
+
meta: ["\u2318", "Meta"],
|
|
12440
|
+
cmd: ["\u2318", "Ctrl"],
|
|
12441
|
+
command: ["\u2318", "Ctrl"],
|
|
12442
|
+
ctrl: ["\u2303", "Ctrl"],
|
|
12443
|
+
control: ["\u2303", "Ctrl"],
|
|
12444
|
+
alt: ["\u2325", "Alt"],
|
|
12445
|
+
option: ["\u2325", "Alt"],
|
|
12446
|
+
shift: ["\u21E7", "Shift"],
|
|
12447
|
+
backspace: ["\u232B", "Backspace"],
|
|
12448
|
+
delete: ["\u2326", "Del"],
|
|
12449
|
+
tab: ["\u21E5", "Tab"]
|
|
12450
|
+
});
|
|
12451
|
+
var KEYS = Object.freeze({
|
|
12452
|
+
enter: "\u21B5",
|
|
12453
|
+
return: "\u21B5",
|
|
12454
|
+
escape: "Esc",
|
|
12455
|
+
esc: "Esc",
|
|
12456
|
+
space: "Space",
|
|
12457
|
+
arrowup: "\u2191",
|
|
12458
|
+
up: "\u2191",
|
|
12459
|
+
arrowdown: "\u2193",
|
|
12460
|
+
down: "\u2193",
|
|
12461
|
+
arrowleft: "\u2190",
|
|
12462
|
+
left: "\u2190",
|
|
12463
|
+
arrowright: "\u2192",
|
|
12464
|
+
right: "\u2192",
|
|
12465
|
+
pageup: "PgUp",
|
|
12466
|
+
pagedown: "PgDn",
|
|
12467
|
+
home: "Home",
|
|
12468
|
+
end: "End"
|
|
12469
|
+
});
|
|
12470
|
+
function isApplePlatform() {
|
|
12471
|
+
const nav = globalThis.navigator;
|
|
12472
|
+
if (!nav) return false;
|
|
12473
|
+
const platform = (
|
|
12474
|
+
/** @type {{userAgentData?: {platform?: string}}} */
|
|
12475
|
+
nav.userAgentData?.platform || nav.platform || ""
|
|
12476
|
+
);
|
|
12477
|
+
return /mac|iphone|ipad|ios/i.test(platform);
|
|
12478
|
+
}
|
|
12479
|
+
function splitChord(chord) {
|
|
12480
|
+
if (chord === "+") return ["+"];
|
|
12481
|
+
const keys = chord.split("+");
|
|
12482
|
+
if (chord.endsWith("++")) keys.splice(-2, 2, "+");
|
|
12483
|
+
return keys.map((key) => key.trim()).filter((key) => key !== "");
|
|
12484
|
+
}
|
|
12485
|
+
function keyLabel(key, apple) {
|
|
12486
|
+
const name2 = key.toLowerCase();
|
|
12487
|
+
if (Object.hasOwn(MODIFIERS, name2)) return MODIFIERS[name2][apple ? 0 : 1];
|
|
12488
|
+
if (Object.hasOwn(KEYS, name2)) return KEYS[name2];
|
|
12489
|
+
return key.length === 1 ? key.toUpperCase() : key;
|
|
12490
|
+
}
|
|
12491
|
+
function keyLabels(keys, { apple = isApplePlatform() } = {}) {
|
|
12492
|
+
const list = Array.isArray(keys) ? keys.map(String) : splitChord(String(keys));
|
|
12493
|
+
return list.map((key) => keyLabel(key, apple));
|
|
12494
|
+
}
|
|
12495
|
+
function kbd(keys, options = {}) {
|
|
12496
|
+
return h("kbd", {
|
|
12497
|
+
class: "zx-kbd",
|
|
12498
|
+
dataset: {
|
|
12499
|
+
size: options.size === "sm" ? "sm" : void 0,
|
|
12500
|
+
tone: options.tone === "inherit" ? "inherit" : void 0
|
|
12501
|
+
}
|
|
12502
|
+
}, keyLabels(keys).map((label) => h("kbd", { class: "zx-kbd__key" }, label)));
|
|
12503
|
+
}
|
|
12504
|
+
|
|
12374
12505
|
// src/components/loading/spinner.js
|
|
12375
12506
|
var defaults2 = Object.freeze({
|
|
12376
12507
|
size: "md",
|
|
@@ -12434,7 +12565,7 @@ function button(opts = {}) {
|
|
|
12434
12565
|
if (options.label !== "") {
|
|
12435
12566
|
element.append(h("span", { class: "zx-btn__label" }, String(options.label)));
|
|
12436
12567
|
}
|
|
12437
|
-
if (options.shortcut) element.append(
|
|
12568
|
+
if (options.shortcut) element.append(shortcutHint(options.shortcut.label));
|
|
12438
12569
|
if (!options.label && options.title) element.setAttribute("aria-label", options.title);
|
|
12439
12570
|
if (typeof options.onclick === "function") element.onclick = options.onclick;
|
|
12440
12571
|
if (options.busy) setButtonBusy(element, true);
|
|
@@ -12473,6 +12604,12 @@ function setButtonBusy(element, busy) {
|
|
|
12473
12604
|
}
|
|
12474
12605
|
return element;
|
|
12475
12606
|
}
|
|
12607
|
+
function shortcutHint(label) {
|
|
12608
|
+
const hint = kbd(String(label), { size: "sm" });
|
|
12609
|
+
hint.classList.add("zx-btn__shortcut");
|
|
12610
|
+
hint.setAttribute("aria-hidden", "true");
|
|
12611
|
+
return hint;
|
|
12612
|
+
}
|
|
12476
12613
|
function normalizeKind2(value) {
|
|
12477
12614
|
return ["primary", "danger", "ghost"].includes(String(value)) ? (
|
|
12478
12615
|
/** @type {'primary'|'danger'|'ghost'} */
|
|
@@ -12550,7 +12687,7 @@ var Dialog = class _Dialog extends Modal {
|
|
|
12550
12687
|
"data-kind": "ghost",
|
|
12551
12688
|
ariaLabel: close,
|
|
12552
12689
|
title: close
|
|
12553
|
-
}, "
|
|
12690
|
+
}, icon("x", { size: ICON_SIZE.dismiss }))
|
|
12554
12691
|
),
|
|
12555
12692
|
h("div", { class: "zx-modal__content zx-dialog__body", ref: "content" }),
|
|
12556
12693
|
h("footer", { class: "zx-dialog__footer", ref: "footer" })
|
|
@@ -12991,7 +13128,7 @@ var Groupbox = class extends Component {
|
|
|
12991
13128
|
h(
|
|
12992
13129
|
"span",
|
|
12993
13130
|
{ class: "zx-groupbox__chevron", ariaHidden: "true" },
|
|
12994
|
-
icon("chevron-right", { size:
|
|
13131
|
+
icon("chevron-right", { size: ICON_SIZE.chevron })
|
|
12995
13132
|
),
|
|
12996
13133
|
h("span", { class: "zx-groupbox__title", ref: "title" }, String(this.options.title))
|
|
12997
13134
|
);
|
|
@@ -13131,7 +13268,7 @@ var Search = class extends Component {
|
|
|
13131
13268
|
type: "button",
|
|
13132
13269
|
ariaLabel: clearLabel,
|
|
13133
13270
|
title: clearLabel
|
|
13134
|
-
}, icon("x", { size:
|
|
13271
|
+
}, icon("x", { size: ICON_SIZE.dismiss })) : null;
|
|
13135
13272
|
const submit = h("button", {
|
|
13136
13273
|
class: "zx-search__submit",
|
|
13137
13274
|
ref: "submit",
|
|
@@ -13370,7 +13507,7 @@ var Tabbox = class extends Component {
|
|
|
13370
13507
|
class: "zx-tabbox__close zx-icon-btn",
|
|
13371
13508
|
ariaHidden: "true",
|
|
13372
13509
|
title: this._message("tabbox.close", "Close")
|
|
13373
|
-
}, icon("x", { size:
|
|
13510
|
+
}, icon("x", { size: ICON_SIZE.dismiss })));
|
|
13374
13511
|
}
|
|
13375
13512
|
const tab = (
|
|
13376
13513
|
/** @type {HTMLButtonElement} */
|
|
@@ -14785,14 +14922,14 @@ var Table = class extends Component {
|
|
|
14785
14922
|
disabled: index === 0,
|
|
14786
14923
|
ariaLabel: `Move ${name2} earlier`,
|
|
14787
14924
|
dataset: { columnId: column.id, columnAction: "up" }
|
|
14788
|
-
}, icon("chevron-up", { size:
|
|
14925
|
+
}, icon("chevron-up", { size: ICON_SIZE.chevron })),
|
|
14789
14926
|
h("button", {
|
|
14790
14927
|
class: "zx-table__column-move",
|
|
14791
14928
|
type: "button",
|
|
14792
14929
|
disabled: index === this._columns.length - 1,
|
|
14793
14930
|
ariaLabel: `Move ${name2} later`,
|
|
14794
14931
|
dataset: { columnId: column.id, columnAction: "down" }
|
|
14795
|
-
}, icon("chevron-down", { size:
|
|
14932
|
+
}, icon("chevron-down", { size: ICON_SIZE.chevron }))
|
|
14796
14933
|
) : null;
|
|
14797
14934
|
return h("div", { class: "zx-table__column-option", dataset: { columnId: column.id } }, label, order);
|
|
14798
14935
|
});
|
|
@@ -15072,11 +15209,17 @@ var Table = class extends Component {
|
|
|
15072
15209
|
const name2 = tableHeaderName(column);
|
|
15073
15210
|
if (name2 !== null) th.setAttribute("aria-label", name2);
|
|
15074
15211
|
if (column.sortable && !this._spanning) {
|
|
15075
|
-
const button2 = h(
|
|
15076
|
-
|
|
15077
|
-
|
|
15078
|
-
|
|
15079
|
-
|
|
15212
|
+
const button2 = h(
|
|
15213
|
+
"button",
|
|
15214
|
+
{
|
|
15215
|
+
class: "zx-table__sort-button",
|
|
15216
|
+
type: "button",
|
|
15217
|
+
ariaLabel: name2 ?? void 0
|
|
15218
|
+
},
|
|
15219
|
+
h("span", { class: "zx-table__header-label" }, column.label),
|
|
15220
|
+
// One arrow per sortable header; `aria-sort` on the header shows it and says which way.
|
|
15221
|
+
h("span", { class: "zx-table__sort-icon", ariaHidden: "true" }, icon("arrow-up", { size: ICON_SIZE.sort }))
|
|
15222
|
+
);
|
|
15080
15223
|
this.listen(button2, "click", () => {
|
|
15081
15224
|
const direction = this._sort?.id === column.id && this._sort.dir === "asc" ? "desc" : "asc";
|
|
15082
15225
|
this.setSort(column.id, direction);
|
|
@@ -15276,7 +15419,7 @@ var Table = class extends Component {
|
|
|
15276
15419
|
type: "button",
|
|
15277
15420
|
tabIndex: -1,
|
|
15278
15421
|
ariaExpanded: String(expanded)
|
|
15279
|
-
}, icon(expanded ? "chevron-down" : "chevron-right", { size:
|
|
15422
|
+
}, icon(expanded ? "chevron-down" : "chevron-right", { size: ICON_SIZE.chevron })));
|
|
15280
15423
|
} else {
|
|
15281
15424
|
branch.append(h("span", { class: "zx-table__tree-spacer", ariaHidden: "true" }));
|
|
15282
15425
|
}
|
|
@@ -16785,6 +16928,7 @@ var CHECKLIST_ATTRS = attributes({
|
|
|
16785
16928
|
});
|
|
16786
16929
|
var DATEBOX_ATTRS = attributes({
|
|
16787
16930
|
format: text3({ default: "%d.%m.%Y", rebuild: true }),
|
|
16931
|
+
"display-format": text3({ property: "displayFormat", default: null, rebuild: true }),
|
|
16788
16932
|
time: bool({ always: true, rebuild: true }),
|
|
16789
16933
|
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 }),
|
|
16790
16934
|
placeholder: text3({ default: null, rebuild: true }),
|
|
@@ -17310,7 +17454,7 @@ function cloneDefault(value) {
|
|
|
17310
17454
|
}
|
|
17311
17455
|
|
|
17312
17456
|
// src/components/empty-state/empty-state.js
|
|
17313
|
-
var
|
|
17457
|
+
var ICON_SIZE2 = Object.freeze({ md: 40, sm: 28 });
|
|
17314
17458
|
var defaults4 = Object.freeze({
|
|
17315
17459
|
icon: "folder-open",
|
|
17316
17460
|
title: "",
|
|
@@ -17333,7 +17477,7 @@ function emptyState(opts = {}) {
|
|
|
17333
17477
|
element.append(h(
|
|
17334
17478
|
"div",
|
|
17335
17479
|
{ class: "zx-empty-state__icon", ariaHidden: "true" },
|
|
17336
|
-
icon(options.icon, { size:
|
|
17480
|
+
icon(options.icon, { size: ICON_SIZE2[size2] })
|
|
17337
17481
|
));
|
|
17338
17482
|
}
|
|
17339
17483
|
if (options.title) {
|
|
@@ -18001,6 +18145,108 @@ var CopyInput = class extends Component {
|
|
|
18001
18145
|
}
|
|
18002
18146
|
};
|
|
18003
18147
|
|
|
18148
|
+
// src/components/prose/prose.js
|
|
18149
|
+
var defaults5 = Object.freeze({
|
|
18150
|
+
selector: "h2[id], h3[id], h4[id]",
|
|
18151
|
+
label: "Copy link to %1",
|
|
18152
|
+
title: "Copy link",
|
|
18153
|
+
feedback: "Link copied",
|
|
18154
|
+
feedbackDuration: 2e3
|
|
18155
|
+
});
|
|
18156
|
+
function sectionHref(base, id) {
|
|
18157
|
+
const url = new URL(String(base));
|
|
18158
|
+
url.hash = String(id);
|
|
18159
|
+
return url.href;
|
|
18160
|
+
}
|
|
18161
|
+
function proseAnchors(root, options = {}) {
|
|
18162
|
+
const target = typeof root === "string" ? document.querySelector(root) : root;
|
|
18163
|
+
if (!(target instanceof Element)) throw new TypeError("proseAnchors root could not be resolved");
|
|
18164
|
+
const settings = { ...defaults5, ...options };
|
|
18165
|
+
const abort = new AbortController();
|
|
18166
|
+
const anchors = /* @__PURE__ */ new Map();
|
|
18167
|
+
const hosts = /* @__PURE__ */ new Set();
|
|
18168
|
+
const status = h("span", { class: "zx-prose__status", role: "status" });
|
|
18169
|
+
let timer = 0;
|
|
18170
|
+
const hrefFor = (id) => typeof settings.href === "function" ? String(settings.href(id)) : sectionHref(globalThis.location?.href ?? "about:blank", id);
|
|
18171
|
+
const refresh = () => {
|
|
18172
|
+
if (abort.signal.aborted) return;
|
|
18173
|
+
for (const [anchor, heading] of anchors) {
|
|
18174
|
+
if (anchor.isConnected && heading.contains(anchor) && heading.id) {
|
|
18175
|
+
anchor.setAttribute("href", `#${heading.id}`);
|
|
18176
|
+
continue;
|
|
18177
|
+
}
|
|
18178
|
+
anchor.remove();
|
|
18179
|
+
anchors.delete(anchor);
|
|
18180
|
+
}
|
|
18181
|
+
const headings = (
|
|
18182
|
+
/** @type {HTMLElement[]} */
|
|
18183
|
+
[...target.querySelectorAll(String(settings.selector))]
|
|
18184
|
+
);
|
|
18185
|
+
for (const heading of headings) {
|
|
18186
|
+
if (!heading.id || !heading.closest(".zx-prose")) continue;
|
|
18187
|
+
if ([...anchors.values()].includes(heading)) continue;
|
|
18188
|
+
const text4 = (heading.textContent ?? "").trim();
|
|
18189
|
+
const anchor = (
|
|
18190
|
+
/** @type {HTMLAnchorElement} */
|
|
18191
|
+
h("a", {
|
|
18192
|
+
class: "zx-prose__anchor",
|
|
18193
|
+
href: `#${heading.id}`,
|
|
18194
|
+
ariaLabel: String(settings.label).replace("%1", text4),
|
|
18195
|
+
title: String(settings.title),
|
|
18196
|
+
"data-zx-reveal": ""
|
|
18197
|
+
}, icon("link-2"))
|
|
18198
|
+
);
|
|
18199
|
+
if (!heading.hasAttribute("data-zx-reveal-host")) {
|
|
18200
|
+
heading.setAttribute("data-zx-reveal-host", "");
|
|
18201
|
+
hosts.add(heading);
|
|
18202
|
+
}
|
|
18203
|
+
heading.append(anchor);
|
|
18204
|
+
anchors.set(anchor, heading);
|
|
18205
|
+
}
|
|
18206
|
+
if (!status.isConnected) target.append(status);
|
|
18207
|
+
};
|
|
18208
|
+
target.addEventListener("click", async (event) => {
|
|
18209
|
+
const anchor = (
|
|
18210
|
+
/** @type {Element} */
|
|
18211
|
+
event.target?.closest?.(".zx-prose__anchor")
|
|
18212
|
+
);
|
|
18213
|
+
if (!(anchor instanceof HTMLAnchorElement) || !anchors.has(anchor)) return;
|
|
18214
|
+
if (event.button !== 0 || event.metaKey || event.ctrlKey || event.shiftKey || event.altKey) return;
|
|
18215
|
+
event.preventDefault();
|
|
18216
|
+
const heading = anchors.get(anchor);
|
|
18217
|
+
const url = hrefFor(heading?.id ?? "");
|
|
18218
|
+
const copied = await copyToClipboard(url);
|
|
18219
|
+
if (abort.signal.aborted) return;
|
|
18220
|
+
settings.oncopy?.(url, copied);
|
|
18221
|
+
if (!copied) return;
|
|
18222
|
+
clearTimeout(timer);
|
|
18223
|
+
for (const other of anchors.keys()) delete other.dataset.copied;
|
|
18224
|
+
anchor.dataset.copied = "true";
|
|
18225
|
+
anchor.replaceChildren(icon("check"));
|
|
18226
|
+
if (!status.isConnected) target.append(status);
|
|
18227
|
+
status.textContent = String(settings.feedback);
|
|
18228
|
+
timer = setTimeout(() => {
|
|
18229
|
+
delete anchor.dataset.copied;
|
|
18230
|
+
anchor.replaceChildren(icon("link-2"));
|
|
18231
|
+
status.textContent = "";
|
|
18232
|
+
}, Math.max(0, Number(settings.feedbackDuration) || 0));
|
|
18233
|
+
}, { signal: abort.signal });
|
|
18234
|
+
refresh();
|
|
18235
|
+
return {
|
|
18236
|
+
refresh,
|
|
18237
|
+
destroy() {
|
|
18238
|
+
if (abort.signal.aborted) return;
|
|
18239
|
+
abort.abort();
|
|
18240
|
+
clearTimeout(timer);
|
|
18241
|
+
for (const anchor of anchors.keys()) anchor.remove();
|
|
18242
|
+
anchors.clear();
|
|
18243
|
+
for (const heading of hosts) heading.removeAttribute("data-zx-reveal-host");
|
|
18244
|
+
hosts.clear();
|
|
18245
|
+
status.remove();
|
|
18246
|
+
}
|
|
18247
|
+
};
|
|
18248
|
+
}
|
|
18249
|
+
|
|
18004
18250
|
// src/internal/menu-items.js
|
|
18005
18251
|
var MENU_ITEM_SELECTOR = [
|
|
18006
18252
|
'[role="menuitem"]',
|
|
@@ -19465,7 +19711,7 @@ var DIRECTION_ICONS = Object.freeze({ up: "chevron-up", down: "chevron-down", fl
|
|
|
19465
19711
|
var TREND_WIDTH = 100;
|
|
19466
19712
|
var TREND_HEIGHT = 30;
|
|
19467
19713
|
var TREND_INSET = 2;
|
|
19468
|
-
var
|
|
19714
|
+
var defaults6 = Object.freeze({
|
|
19469
19715
|
label: "",
|
|
19470
19716
|
value: null,
|
|
19471
19717
|
format: "number",
|
|
@@ -19477,6 +19723,8 @@ var defaults5 = Object.freeze({
|
|
|
19477
19723
|
trend: [],
|
|
19478
19724
|
icon: null,
|
|
19479
19725
|
kind: "neutral",
|
|
19726
|
+
variant: "default",
|
|
19727
|
+
emphasis: false,
|
|
19480
19728
|
href: null,
|
|
19481
19729
|
clickable: false,
|
|
19482
19730
|
loading: false
|
|
@@ -19485,7 +19733,7 @@ var SVG_NS2 = "http://www.w3.org/2000/svg";
|
|
|
19485
19733
|
var StatTile = class extends Component {
|
|
19486
19734
|
static cssName = "stat-tile";
|
|
19487
19735
|
/** @type {Readonly<StatTileOptions>} */
|
|
19488
|
-
static defaults =
|
|
19736
|
+
static defaults = defaults6;
|
|
19489
19737
|
/**
|
|
19490
19738
|
* Creates or adopts one metric tile.
|
|
19491
19739
|
* @param {Element|string|null} [target=null] Existing element of the required tag, or null.
|
|
@@ -19611,6 +19859,9 @@ function statDelta(delta, options = {}) {
|
|
|
19611
19859
|
const magnitude = formatStatValue(Math.abs(number2), options);
|
|
19612
19860
|
return { direction, sign: sign2, magnitude, text: `${sign2}${magnitude}` };
|
|
19613
19861
|
}
|
|
19862
|
+
function normalizeStatTileVariant(value) {
|
|
19863
|
+
return value === "plain" ? "plain" : "default";
|
|
19864
|
+
}
|
|
19614
19865
|
function statTileTag(options = {}) {
|
|
19615
19866
|
if (safeHref(options.href)) return "a";
|
|
19616
19867
|
if (options.clickable === true || typeof options.onclick === "function") return "button";
|
|
@@ -19646,6 +19897,9 @@ function fillStatTile(root, options, message) {
|
|
|
19646
19897
|
const loading = options.loading === true;
|
|
19647
19898
|
root.classList.add("zx-stat-tile");
|
|
19648
19899
|
root.dataset.kind = kind;
|
|
19900
|
+
root.dataset.variant = normalizeStatTileVariant(options.variant);
|
|
19901
|
+
if (options.emphasis === true) root.dataset.emphasis = "true";
|
|
19902
|
+
else delete root.dataset.emphasis;
|
|
19649
19903
|
root.dataset.loading = String(loading);
|
|
19650
19904
|
if (root.tagName.toLowerCase() === "a") {
|
|
19651
19905
|
const href = safeHref(options.href);
|
|
@@ -19731,7 +19985,7 @@ function trendBody(values) {
|
|
|
19731
19985
|
function loadingBody(options) {
|
|
19732
19986
|
const blocks = [
|
|
19733
19987
|
h("div", { class: "zx-stat-tile__header" }, skeleton({ width: "55%", height: "0.75rem" })),
|
|
19734
|
-
skeleton({ width: "70%", height: "1.
|
|
19988
|
+
skeleton({ width: "70%", height: "calc(var(--zx-stat-tile-value-size) * 1.15)", radius: "md" })
|
|
19735
19989
|
];
|
|
19736
19990
|
if (asText(options.caption).trim()) blocks.push(skeleton({ width: "35%", height: "0.75rem" }));
|
|
19737
19991
|
if (options.delta !== null && options.delta !== void 0) {
|
|
@@ -19947,7 +20201,7 @@ var Panel = class extends Component {
|
|
|
19947
20201
|
toggleChildren.push(h("span", {
|
|
19948
20202
|
class: "zx-panel__chevron",
|
|
19949
20203
|
ariaHidden: "true"
|
|
19950
|
-
}, icon("chevron-right", { size:
|
|
20204
|
+
}, icon("chevron-right", { size: ICON_SIZE.chevron })));
|
|
19951
20205
|
}
|
|
19952
20206
|
toggleChildren.push(title);
|
|
19953
20207
|
const toggle = this._collapsible ? h("button", {
|
|
@@ -21360,7 +21614,7 @@ var Dock = class extends Component {
|
|
|
21360
21614
|
const chevron = h(
|
|
21361
21615
|
"span",
|
|
21362
21616
|
{ class: "zx-dock__chevron", ariaHidden: "true" },
|
|
21363
|
-
icon("chevron-right", { size:
|
|
21617
|
+
icon("chevron-right", { size: ICON_SIZE.chevron })
|
|
21364
21618
|
);
|
|
21365
21619
|
const toggle = h("button", {
|
|
21366
21620
|
class: "zx-dock__toggle",
|
|
@@ -22644,8 +22898,8 @@ var Stepper = class extends Component {
|
|
|
22644
22898
|
* @returns {Array<Node|string>}
|
|
22645
22899
|
*/
|
|
22646
22900
|
_markerContent(state, index) {
|
|
22647
|
-
if (state === "complete") return [icon("check", { size:
|
|
22648
|
-
if (state === "error") return [icon("warning", { size:
|
|
22901
|
+
if (state === "complete") return [icon("check", { size: ICON_SIZE.check })];
|
|
22902
|
+
if (state === "error") return [icon("warning", { size: ICON_SIZE.check })];
|
|
22649
22903
|
return this.options.showNumbers ? [String(index + 1)] : [];
|
|
22650
22904
|
}
|
|
22651
22905
|
/**
|
|
@@ -22936,7 +23190,7 @@ var Breadcrumb = class extends Component {
|
|
|
22936
23190
|
return h(
|
|
22937
23191
|
"span",
|
|
22938
23192
|
{ class: "zx-breadcrumb__separator", ariaHidden: "true" },
|
|
22939
|
-
this.options.separator === "slash" ? "/" : icon("chevron-right", { size:
|
|
23193
|
+
this.options.separator === "slash" ? "/" : icon("chevron-right", { size: ICON_SIZE.chevron })
|
|
22940
23194
|
);
|
|
22941
23195
|
}
|
|
22942
23196
|
/**
|
|
@@ -23192,7 +23446,7 @@ var Pagination = class extends Component {
|
|
|
23192
23446
|
ref,
|
|
23193
23447
|
ariaLabel: label,
|
|
23194
23448
|
dataset: { kind: "default", size: "sm" }
|
|
23195
|
-
}, icon(glyph, { size:
|
|
23449
|
+
}, icon(glyph, { size: ICON_SIZE.chevron }));
|
|
23196
23450
|
}
|
|
23197
23451
|
/** @returns {HTMLElement} The append-style trigger. */
|
|
23198
23452
|
_renderLoadMore() {
|
|
@@ -23563,7 +23817,7 @@ var Launcher = class extends Component {
|
|
|
23563
23817
|
ref: "scopeBack",
|
|
23564
23818
|
class: "zx-icon-btn zx-launcher__scope-back",
|
|
23565
23819
|
type: "button"
|
|
23566
|
-
}, icon("x"));
|
|
23820
|
+
}, icon("x", { size: ICON_SIZE.dismiss }));
|
|
23567
23821
|
const scope2 = h(
|
|
23568
23822
|
"span",
|
|
23569
23823
|
{ ref: "scope", class: "zx-launcher__scope", hidden: true },
|
|
@@ -23575,7 +23829,7 @@ var Launcher = class extends Component {
|
|
|
23575
23829
|
class: "zx-icon-btn zx-launcher__close",
|
|
23576
23830
|
type: "button",
|
|
23577
23831
|
ariaLabel: this.options.closeLabel ?? this._message("launcher.close", "Close launcher")
|
|
23578
|
-
}, icon("x"));
|
|
23832
|
+
}, icon("x", { size: ICON_SIZE.dismiss }));
|
|
23579
23833
|
const status = h("div", {
|
|
23580
23834
|
ref: "status",
|
|
23581
23835
|
class: "zx-launcher__status",
|
|
@@ -23596,10 +23850,7 @@ var Launcher = class extends Component {
|
|
|
23596
23850
|
role: "listbox",
|
|
23597
23851
|
ariaLabel: this.options.resultsLabel ?? this._message("launcher.results", "Launcher results")
|
|
23598
23852
|
});
|
|
23599
|
-
const shortcut = this.options.shortcut === "mod+k" ? h("
|
|
23600
|
-
class: "zx-launcher__shortcut",
|
|
23601
|
-
ariaHidden: "true"
|
|
23602
|
-
}, launcherShortcutLabel()) : null;
|
|
23853
|
+
const shortcut = this.options.shortcut === "mod+k" ? h("span", { class: "zx-launcher__shortcut", ariaHidden: "true" }, kbd("Mod+K")) : null;
|
|
23603
23854
|
const footer = launcherHints(this.options.hints, {
|
|
23604
23855
|
move: this._message("launcher.hintMove", "Move"),
|
|
23605
23856
|
open: this._message("launcher.hintOpen", "Open"),
|
|
@@ -24113,9 +24364,9 @@ var Launcher = class extends Component {
|
|
|
24113
24364
|
if (caps.length) children.push(h(
|
|
24114
24365
|
"span",
|
|
24115
24366
|
{ class: "zx-launcher__keys", ariaHidden: keys ? "true" : null },
|
|
24116
|
-
caps
|
|
24367
|
+
kbd(caps, { size: "sm" })
|
|
24117
24368
|
));
|
|
24118
|
-
if (page) children.push(h("span", { class: "zx-launcher__chevron", ariaHidden: "true" }, icon("chevron-right")));
|
|
24369
|
+
if (page) children.push(h("span", { class: "zx-launcher__chevron", ariaHidden: "true" }, icon("chevron-right", { size: ICON_SIZE.chevron })));
|
|
24119
24370
|
return (
|
|
24120
24371
|
/** @type {HTMLElement} */
|
|
24121
24372
|
h(tag, {
|
|
@@ -24298,24 +24549,17 @@ var Launcher = class extends Component {
|
|
|
24298
24549
|
return message === key ? printf(fallback, args) : message;
|
|
24299
24550
|
}
|
|
24300
24551
|
};
|
|
24301
|
-
function
|
|
24302
|
-
const platform = String(
|
|
24303
|
-
/** @type {any} */
|
|
24304
|
-
navigator.userAgentData?.platform ?? navigator.platform ?? ""
|
|
24305
|
-
);
|
|
24306
|
-
return /mac|iphone|ipad/i.test(platform) ? "\u2318 K" : "Ctrl K";
|
|
24307
|
-
}
|
|
24308
|
-
function launcherHints(hints, defaults6) {
|
|
24552
|
+
function launcherHints(hints, defaults7) {
|
|
24309
24553
|
if (hints === false) return null;
|
|
24310
24554
|
const labels = hints && typeof hints === "object" ? hints : {};
|
|
24311
24555
|
return h(
|
|
24312
24556
|
"footer",
|
|
24313
24557
|
{ class: "zx-launcher__hints", ariaHidden: "true" },
|
|
24314
|
-
h("span", {},
|
|
24315
|
-
h("span", {},
|
|
24558
|
+
h("span", {}, kbd(["\u2191\u2193\u2190\u2192"]), labels.move ?? defaults7.move),
|
|
24559
|
+
h("span", {}, kbd("Enter"), labels.open ?? defaults7.open),
|
|
24316
24560
|
// Shown only on a page (`_syncPage()`).
|
|
24317
|
-
h("span", { ref: "backHint", hidden: true },
|
|
24318
|
-
h("span", {},
|
|
24561
|
+
h("span", { ref: "backHint", hidden: true }, kbd("Backspace"), labels.back ?? defaults7.back),
|
|
24562
|
+
h("span", {}, kbd("Escape"), labels.close ?? defaults7.close)
|
|
24319
24563
|
);
|
|
24320
24564
|
}
|
|
24321
24565
|
function isLauncherPage(item) {
|
|
@@ -26794,7 +27038,7 @@ var AccountMenu = class extends Component {
|
|
|
26794
27038
|
h("span", { ref: "name", class: "zx-account-menu__name" }),
|
|
26795
27039
|
h("span", { ref: "secondary", class: "zx-account-menu__secondary" })
|
|
26796
27040
|
),
|
|
26797
|
-
h("span", { class: "zx-account-menu__chevron", ariaHidden: "true" }, icon("chevron-down"))
|
|
27041
|
+
h("span", { class: "zx-account-menu__chevron", ariaHidden: "true" }, icon("chevron-down", { size: ICON_SIZE.chevron }))
|
|
26798
27042
|
));
|
|
26799
27043
|
return root;
|
|
26800
27044
|
}
|
|
@@ -26966,7 +27210,7 @@ var WorkspaceSwitcher = class extends Component {
|
|
|
26966
27210
|
h("span", { ref: "name", class: "zx-workspace-switcher__name" }),
|
|
26967
27211
|
h("span", { ref: "secondary", class: "zx-workspace-switcher__secondary" })
|
|
26968
27212
|
),
|
|
26969
|
-
h("span", { class: "zx-workspace-switcher__chevron", ariaHidden: "true" }, icon("chevron-down"))
|
|
27213
|
+
h("span", { class: "zx-workspace-switcher__chevron", ariaHidden: "true" }, icon("chevron-down", { size: ICON_SIZE.chevron }))
|
|
26970
27214
|
));
|
|
26971
27215
|
return root;
|
|
26972
27216
|
}
|
|
@@ -27095,7 +27339,7 @@ var WorkspaceSwitcher = class extends Component {
|
|
|
27095
27339
|
description: workspace.secondary || void 0,
|
|
27096
27340
|
badge: workspace.badge ?? void 0,
|
|
27097
27341
|
disabled: workspace.disabled,
|
|
27098
|
-
adornment: h("span", { class: "zx-workspace-switcher__check", ariaHidden: "true" }, icon("check"))
|
|
27342
|
+
adornment: h("span", { class: "zx-workspace-switcher__check", ariaHidden: "true" }, icon("check", { size: ICON_SIZE.check }))
|
|
27099
27343
|
};
|
|
27100
27344
|
this._entries.set(entry, workspace);
|
|
27101
27345
|
rows.push([entries.length, workspace]);
|
|
@@ -29211,6 +29455,393 @@ function containsItemId2(items, id) {
|
|
|
29211
29455
|
return items.some((item) => String(item.id) === id || containsItemId2(item.children ?? [], id));
|
|
29212
29456
|
}
|
|
29213
29457
|
|
|
29458
|
+
// src/components/context-menu/context-menu.js
|
|
29459
|
+
var ContextMenu = class extends Component {
|
|
29460
|
+
/** @type {ContextMenuOptions} */
|
|
29461
|
+
static defaults = {
|
|
29462
|
+
items: [],
|
|
29463
|
+
selector: null
|
|
29464
|
+
};
|
|
29465
|
+
/** @type {Element} */
|
|
29466
|
+
#target;
|
|
29467
|
+
/** @type {Dropdown} */
|
|
29468
|
+
#dropdown;
|
|
29469
|
+
/** @type {HTMLElement} */
|
|
29470
|
+
#panel;
|
|
29471
|
+
/** @type {ReturnType<typeof rovingTabindex>} */
|
|
29472
|
+
#roving;
|
|
29473
|
+
/** @type {(event: KeyboardEvent|string) => void} */
|
|
29474
|
+
#typeahead;
|
|
29475
|
+
/** @type {ContextMenuEntry[]} */
|
|
29476
|
+
#items = [];
|
|
29477
|
+
/** @type {Element|null} */
|
|
29478
|
+
#context = null;
|
|
29479
|
+
/** @type {Element|null} */
|
|
29480
|
+
#returnFocus = null;
|
|
29481
|
+
#destroyed = false;
|
|
29482
|
+
/**
|
|
29483
|
+
* Attaches a context menu to an existing element.
|
|
29484
|
+
* @param {Element|string} target Element or selector the menu belongs to.
|
|
29485
|
+
* @param {ContextMenuOptions} [options={}] Context-menu options.
|
|
29486
|
+
*/
|
|
29487
|
+
constructor(target, options = {}) {
|
|
29488
|
+
const resolved = resolveElement(target);
|
|
29489
|
+
if (!resolved) throw new TypeError("ContextMenu target could not be resolved");
|
|
29490
|
+
super(null, options);
|
|
29491
|
+
this.#target = resolved;
|
|
29492
|
+
document.body.append(this.el);
|
|
29493
|
+
this.#dropdown = new Dropdown(this.el, {
|
|
29494
|
+
openOn: "manual",
|
|
29495
|
+
placement: "bottom-start",
|
|
29496
|
+
scope: resolved
|
|
29497
|
+
});
|
|
29498
|
+
this.#panel = this.#dropdown.getPanel();
|
|
29499
|
+
this.#dropdown._configure({ onEscape: () => this.close(), tabReach: false });
|
|
29500
|
+
this.#panel.classList.add("zx-context-menu");
|
|
29501
|
+
this.#panel.setAttribute("role", "menu");
|
|
29502
|
+
if (Array.isArray(this.options.items)) this.setItems(this.options.items);
|
|
29503
|
+
this.#roving = rovingTabindex(this.#panel, MENU_ITEM_SELECTOR);
|
|
29504
|
+
this.#typeahead = typeahead(() => this.#menuItems(), (item) => item.focus());
|
|
29505
|
+
this.#dropdown.on("close", () => {
|
|
29506
|
+
this.#context = null;
|
|
29507
|
+
const restore10 = this.#returnFocus;
|
|
29508
|
+
this.#returnFocus = null;
|
|
29509
|
+
if (restore10 instanceof HTMLElement && restore10.isConnected) restore10.focus();
|
|
29510
|
+
this.emit("close");
|
|
29511
|
+
});
|
|
29512
|
+
this.listen(this.#target, "contextmenu", (event) => this.#onContextMenu(event));
|
|
29513
|
+
this.listen(this.#target, "keydown", (event) => this.#onTargetKeydown(event));
|
|
29514
|
+
this.listen(this.#panel, "click", (event) => {
|
|
29515
|
+
const item = event.target.closest?.(MENU_ITEM_SELECTOR);
|
|
29516
|
+
if (item && this.#panel.contains(item)) this.#select(item, event);
|
|
29517
|
+
});
|
|
29518
|
+
this.listen(this.#panel, "keydown", (event) => this.#onMenuKeydown(event));
|
|
29519
|
+
}
|
|
29520
|
+
/**
|
|
29521
|
+
* Creates the zero-sized element the menu is anchored to.
|
|
29522
|
+
* @returns {HTMLElement}
|
|
29523
|
+
*/
|
|
29524
|
+
render() {
|
|
29525
|
+
return h("span", { class: "zx-context-menu__anchor", ariaHidden: "true" });
|
|
29526
|
+
}
|
|
29527
|
+
/**
|
|
29528
|
+
* Replaces the menu items.
|
|
29529
|
+
* @param {ContextMenuEntry[]} items Menu definitions.
|
|
29530
|
+
* @returns {this}
|
|
29531
|
+
*/
|
|
29532
|
+
setItems(items) {
|
|
29533
|
+
this.#items = Array.isArray(items) ? items.slice() : [];
|
|
29534
|
+
this.#panel.replaceChildren(...renderMenuEntries(this.#items, "context-menu"));
|
|
29535
|
+
return this;
|
|
29536
|
+
}
|
|
29537
|
+
/**
|
|
29538
|
+
* Opens the menu at a point in viewport coordinates.
|
|
29539
|
+
* @param {number} x Client X.
|
|
29540
|
+
* @param {number} y Client Y.
|
|
29541
|
+
* @param {Element|null} [context=null] Element the menu applies to.
|
|
29542
|
+
* @returns {this}
|
|
29543
|
+
* @fires ContextMenu#open
|
|
29544
|
+
*/
|
|
29545
|
+
openAt(x, y, context = null) {
|
|
29546
|
+
if (!this.#prepare(context)) return this;
|
|
29547
|
+
this.#openResolved(x, y, context);
|
|
29548
|
+
return this;
|
|
29549
|
+
}
|
|
29550
|
+
/**
|
|
29551
|
+
* Opens the menu against an element's box, which is where a keyboard invocation puts it.
|
|
29552
|
+
* @param {Element} element Element to anchor to.
|
|
29553
|
+
* @returns {this}
|
|
29554
|
+
* @fires ContextMenu#open
|
|
29555
|
+
*/
|
|
29556
|
+
openAtElement(element) {
|
|
29557
|
+
const box = element.getBoundingClientRect();
|
|
29558
|
+
return this.openAt(box.left, box.bottom, element);
|
|
29559
|
+
}
|
|
29560
|
+
/**
|
|
29561
|
+
* Closes the menu.
|
|
29562
|
+
* @returns {this}
|
|
29563
|
+
*/
|
|
29564
|
+
close() {
|
|
29565
|
+
this.#dropdown.close();
|
|
29566
|
+
return this;
|
|
29567
|
+
}
|
|
29568
|
+
/**
|
|
29569
|
+
* Reports whether the menu is open.
|
|
29570
|
+
* @returns {boolean}
|
|
29571
|
+
*/
|
|
29572
|
+
isOpen() {
|
|
29573
|
+
return this.#dropdown.isOpen();
|
|
29574
|
+
}
|
|
29575
|
+
/**
|
|
29576
|
+
* The element the open menu applies to — the `selector` match under the pointer, or the target.
|
|
29577
|
+
* @returns {Element|null}
|
|
29578
|
+
*/
|
|
29579
|
+
getContext() {
|
|
29580
|
+
return this.#context;
|
|
29581
|
+
}
|
|
29582
|
+
/**
|
|
29583
|
+
* Detaches the menu and removes its anchor.
|
|
29584
|
+
* @returns {void}
|
|
29585
|
+
*/
|
|
29586
|
+
destroy() {
|
|
29587
|
+
if (this.#destroyed) return;
|
|
29588
|
+
this.#destroyed = true;
|
|
29589
|
+
this.#roving.destroy();
|
|
29590
|
+
this.#dropdown.destroy();
|
|
29591
|
+
super.destroy();
|
|
29592
|
+
}
|
|
29593
|
+
/**
|
|
29594
|
+
* Resolves the items for this opening and reports whether it may proceed.
|
|
29595
|
+
* @param {Element|null} context Element the menu applies to.
|
|
29596
|
+
* @returns {boolean}
|
|
29597
|
+
*/
|
|
29598
|
+
#prepare(context) {
|
|
29599
|
+
const items = this.options.items;
|
|
29600
|
+
if (typeof items === "function") {
|
|
29601
|
+
const resolved = items(context);
|
|
29602
|
+
if (!Array.isArray(resolved) || resolved.length === 0) return false;
|
|
29603
|
+
this.setItems(resolved);
|
|
29604
|
+
}
|
|
29605
|
+
return this.#items.length > 0;
|
|
29606
|
+
}
|
|
29607
|
+
/**
|
|
29608
|
+
* Places the anchor and opens, with the items for this opening already resolved.
|
|
29609
|
+
*
|
|
29610
|
+
* `left`/`top` rather than the logical insets used everywhere else: these are viewport
|
|
29611
|
+
* coordinates from a pointer event, which are physical whatever the writing direction is.
|
|
29612
|
+
*
|
|
29613
|
+
* @param {number} x Client X.
|
|
29614
|
+
* @param {number} y Client Y.
|
|
29615
|
+
* @param {Element|null} context Element the menu applies to.
|
|
29616
|
+
* @returns {void}
|
|
29617
|
+
*/
|
|
29618
|
+
#openResolved(x, y, context) {
|
|
29619
|
+
const root = (
|
|
29620
|
+
/** @type {HTMLElement} */
|
|
29621
|
+
this.el
|
|
29622
|
+
);
|
|
29623
|
+
root.style.left = `${x}px`;
|
|
29624
|
+
root.style.top = `${y}px`;
|
|
29625
|
+
this.#context = context;
|
|
29626
|
+
this.#returnFocus = document.activeElement;
|
|
29627
|
+
this.#dropdown.open();
|
|
29628
|
+
this.#roving.focusFirst();
|
|
29629
|
+
this.emit("open", { context });
|
|
29630
|
+
}
|
|
29631
|
+
/** @param {Event} event @returns {void} */
|
|
29632
|
+
#onContextMenu(event) {
|
|
29633
|
+
const pointer = (
|
|
29634
|
+
/** @type {PointerEvent & {target: Element}} */
|
|
29635
|
+
event
|
|
29636
|
+
);
|
|
29637
|
+
const context = this.#contextFor(pointer.target);
|
|
29638
|
+
if (!context || !this.#prepare(context)) return;
|
|
29639
|
+
event.preventDefault();
|
|
29640
|
+
this.#openResolved(pointer.clientX, pointer.clientY, context);
|
|
29641
|
+
}
|
|
29642
|
+
/** @param {Event} event @returns {void} */
|
|
29643
|
+
#onTargetKeydown(event) {
|
|
29644
|
+
const key = (
|
|
29645
|
+
/** @type {KeyboardEvent} */
|
|
29646
|
+
event
|
|
29647
|
+
);
|
|
29648
|
+
if (key.key !== "ContextMenu" && !(key.key === "F10" && key.shiftKey)) return;
|
|
29649
|
+
const context = this.#contextFor(
|
|
29650
|
+
/** @type {Element} */
|
|
29651
|
+
key.target
|
|
29652
|
+
);
|
|
29653
|
+
if (!context || !this.#prepare(context)) return;
|
|
29654
|
+
event.preventDefault();
|
|
29655
|
+
const box = context.getBoundingClientRect();
|
|
29656
|
+
this.#openResolved(box.left, box.bottom, context);
|
|
29657
|
+
}
|
|
29658
|
+
/**
|
|
29659
|
+
* The element a pointer or key event applies to, honoring `selector`.
|
|
29660
|
+
* @param {Element|null} from Event target.
|
|
29661
|
+
* @returns {Element|null}
|
|
29662
|
+
*/
|
|
29663
|
+
#contextFor(from) {
|
|
29664
|
+
if (!this.options.selector) return this.#target;
|
|
29665
|
+
const match = from?.closest?.(String(this.options.selector));
|
|
29666
|
+
return match && this.#target.contains(match) ? match : null;
|
|
29667
|
+
}
|
|
29668
|
+
/** @param {Event} event @returns {void} */
|
|
29669
|
+
#onMenuKeydown(event) {
|
|
29670
|
+
const key = (
|
|
29671
|
+
/** @type {KeyboardEvent} */
|
|
29672
|
+
event
|
|
29673
|
+
);
|
|
29674
|
+
if (key.key === "Tab") {
|
|
29675
|
+
event.preventDefault();
|
|
29676
|
+
this.close();
|
|
29677
|
+
return;
|
|
29678
|
+
}
|
|
29679
|
+
if (key.key === "Enter" || key.key === " ") {
|
|
29680
|
+
const item = (
|
|
29681
|
+
/** @type {Element} */
|
|
29682
|
+
key.target.closest?.(MENU_ITEM_SELECTOR)
|
|
29683
|
+
);
|
|
29684
|
+
if (!item || !this.#panel.contains(item)) return;
|
|
29685
|
+
if (key.key === "Enter" && item.tagName === "A") return;
|
|
29686
|
+
event.preventDefault();
|
|
29687
|
+
item.click();
|
|
29688
|
+
return;
|
|
29689
|
+
}
|
|
29690
|
+
this.#typeahead(key);
|
|
29691
|
+
}
|
|
29692
|
+
/** @param {Element} element @param {Event|null} [event=null] @returns {void} */
|
|
29693
|
+
#select(element, event = null) {
|
|
29694
|
+
const index = Number(element.getAttribute("data-menu-item"));
|
|
29695
|
+
const item = this.#items[index];
|
|
29696
|
+
if (!isMenuItem(item) || item.disabled) {
|
|
29697
|
+
event?.preventDefault();
|
|
29698
|
+
return;
|
|
29699
|
+
}
|
|
29700
|
+
const context = this.#context;
|
|
29701
|
+
const selected = this.emit("select", { value: item.value, item, context });
|
|
29702
|
+
if (selected.defaultPrevented) {
|
|
29703
|
+
event?.preventDefault();
|
|
29704
|
+
return;
|
|
29705
|
+
}
|
|
29706
|
+
try {
|
|
29707
|
+
item.onselect?.(item.value, item, this);
|
|
29708
|
+
} finally {
|
|
29709
|
+
this.close();
|
|
29710
|
+
}
|
|
29711
|
+
}
|
|
29712
|
+
/** @returns {HTMLElement[]} */
|
|
29713
|
+
#menuItems() {
|
|
29714
|
+
return Array.from(this.#panel.querySelectorAll(MENU_ITEM_SELECTOR));
|
|
29715
|
+
}
|
|
29716
|
+
};
|
|
29717
|
+
|
|
29718
|
+
// src/internal/row-actions.js
|
|
29719
|
+
var ROW_ACTION_LIMIT = 2;
|
|
29720
|
+
function isRowActionNode(entry) {
|
|
29721
|
+
return Boolean(entry) && typeof entry === "object" && typeof /** @type {{nodeType?: unknown}} */
|
|
29722
|
+
entry.nodeType === "number";
|
|
29723
|
+
}
|
|
29724
|
+
function isRowAction(entry) {
|
|
29725
|
+
if (!entry || typeof entry !== "object" || isRowActionNode(entry)) return false;
|
|
29726
|
+
const action = (
|
|
29727
|
+
/** @type {Record<string, unknown>} */
|
|
29728
|
+
entry
|
|
29729
|
+
);
|
|
29730
|
+
return action.label != null && String(action.label) !== "" && typeof action.onSelect === "function";
|
|
29731
|
+
}
|
|
29732
|
+
function planRowActions(entries) {
|
|
29733
|
+
const valid = (
|
|
29734
|
+
/** @type {RowActionEntry[]} */
|
|
29735
|
+
(Array.isArray(entries) ? entries : []).filter((entry) => isRowActionNode(entry) || isRowAction(entry))
|
|
29736
|
+
);
|
|
29737
|
+
if (valid.length <= ROW_ACTION_LIMIT) return { inline: valid, overflow: [] };
|
|
29738
|
+
const [first, ...rest] = valid;
|
|
29739
|
+
return {
|
|
29740
|
+
inline: [first, ...rest.filter(isRowActionNode)],
|
|
29741
|
+
overflow: (
|
|
29742
|
+
/** @type {RowAction[]} */
|
|
29743
|
+
rest.filter((entry) => !isRowActionNode(entry))
|
|
29744
|
+
)
|
|
29745
|
+
};
|
|
29746
|
+
}
|
|
29747
|
+
function rowActionLabel(action, name2) {
|
|
29748
|
+
const row2 = String(name2 ?? "").trim();
|
|
29749
|
+
return row2 ? `${String(action).trim()}: ${row2}` : String(action).trim();
|
|
29750
|
+
}
|
|
29751
|
+
function menuEntries(actions2, only = actions2) {
|
|
29752
|
+
return only.map((action) => ({
|
|
29753
|
+
label: String(action.label),
|
|
29754
|
+
icon: action.icon ? String(action.icon) : void 0,
|
|
29755
|
+
value: actions2.indexOf(action),
|
|
29756
|
+
danger: Boolean(action.danger),
|
|
29757
|
+
disabled: Boolean(action.disabled)
|
|
29758
|
+
}));
|
|
29759
|
+
}
|
|
29760
|
+
function renderRowActions(entries, { block, name: name2, moreLabel = "More actions", run }) {
|
|
29761
|
+
const plan = planRowActions(entries);
|
|
29762
|
+
if (plan.inline.length === 0) return null;
|
|
29763
|
+
const actions2 = (
|
|
29764
|
+
/** @type {RowAction[]} */
|
|
29765
|
+
(Array.isArray(entries) ? entries : []).filter(isRowAction)
|
|
29766
|
+
);
|
|
29767
|
+
const element = (
|
|
29768
|
+
/** @type {HTMLElement} */
|
|
29769
|
+
h("span", { class: `zx-${block}__actions`, "data-zx-reveal": "" })
|
|
29770
|
+
);
|
|
29771
|
+
for (const entry of plan.inline) {
|
|
29772
|
+
if (isRowActionNode(entry)) {
|
|
29773
|
+
element.append(entry);
|
|
29774
|
+
continue;
|
|
29775
|
+
}
|
|
29776
|
+
element.append(h("button", {
|
|
29777
|
+
type: "button",
|
|
29778
|
+
class: ["zx-icon-btn", `zx-${block}__action`],
|
|
29779
|
+
ariaLabel: rowActionLabel(entry.label, name2),
|
|
29780
|
+
title: String(entry.label),
|
|
29781
|
+
disabled: Boolean(entry.disabled),
|
|
29782
|
+
dataset: { rowAction: String(actions2.indexOf(entry)) }
|
|
29783
|
+
}, icon(entry.icon ? String(entry.icon) : "dots")));
|
|
29784
|
+
}
|
|
29785
|
+
let menu = null;
|
|
29786
|
+
if (plan.overflow.length > 0) {
|
|
29787
|
+
menu = new MenuButton(null, {
|
|
29788
|
+
icon: "dots",
|
|
29789
|
+
label: "",
|
|
29790
|
+
kind: "ghost",
|
|
29791
|
+
placement: "bottom-end",
|
|
29792
|
+
items: menuEntries(actions2, plan.overflow)
|
|
29793
|
+
});
|
|
29794
|
+
const trigger = menu.getTrigger();
|
|
29795
|
+
trigger.classList.add(`zx-${block}__action`, `zx-${block}__more`);
|
|
29796
|
+
trigger.setAttribute("aria-label", rowActionLabel(moreLabel, name2));
|
|
29797
|
+
trigger.title = String(moreLabel);
|
|
29798
|
+
menu.on("select", (event) => {
|
|
29799
|
+
const action = actions2[Number(
|
|
29800
|
+
/** @type {CustomEvent} */
|
|
29801
|
+
event.detail.value
|
|
29802
|
+
)];
|
|
29803
|
+
if (action && !action.disabled) run(action);
|
|
29804
|
+
});
|
|
29805
|
+
for (const type of ["zx-select", "zx-open", "zx-close"]) {
|
|
29806
|
+
menu.listen(trigger, type, (event) => event.stopPropagation());
|
|
29807
|
+
}
|
|
29808
|
+
element.append(trigger);
|
|
29809
|
+
}
|
|
29810
|
+
setRowActionsTabbable(element, false);
|
|
29811
|
+
return {
|
|
29812
|
+
element,
|
|
29813
|
+
actions: actions2,
|
|
29814
|
+
menu,
|
|
29815
|
+
destroy: () => menu?.destroy()
|
|
29816
|
+
};
|
|
29817
|
+
}
|
|
29818
|
+
function setRowActionsTabbable(element, tabbable) {
|
|
29819
|
+
if (!element) return;
|
|
29820
|
+
const controls = element.querySelectorAll("button, a[href], input, select, textarea, [tabindex]");
|
|
29821
|
+
for (const control of controls) control.tabIndex = tabbable ? 0 : -1;
|
|
29822
|
+
}
|
|
29823
|
+
function rowActionMenu(target, selector, resolve) {
|
|
29824
|
+
const menu = new ContextMenu(target, {
|
|
29825
|
+
selector,
|
|
29826
|
+
items: (context) => {
|
|
29827
|
+
const found = context ? resolve(context) : null;
|
|
29828
|
+
return found ? menuEntries(found.actions) : [];
|
|
29829
|
+
}
|
|
29830
|
+
});
|
|
29831
|
+
menu.on("select", (event) => {
|
|
29832
|
+
const { value, context } = (
|
|
29833
|
+
/** @type {CustomEvent} */
|
|
29834
|
+
event.detail
|
|
29835
|
+
);
|
|
29836
|
+
event.preventDefault();
|
|
29837
|
+
const found = context ? resolve(context) : null;
|
|
29838
|
+
const action = found?.actions[Number(value)];
|
|
29839
|
+
menu.close();
|
|
29840
|
+
if (action && !action.disabled) action.onSelect(found.subject);
|
|
29841
|
+
});
|
|
29842
|
+
return menu;
|
|
29843
|
+
}
|
|
29844
|
+
|
|
29214
29845
|
// src/components/app-sidebar/app-sidebar.js
|
|
29215
29846
|
var PRESENTATIONS = Object.freeze(["expanded", "compact", "collapsed"]);
|
|
29216
29847
|
var AppSidebar = class extends Component {
|
|
@@ -29231,6 +29862,7 @@ var AppSidebar = class extends Component {
|
|
|
29231
29862
|
presentations: ["expanded", "compact", "collapsed"],
|
|
29232
29863
|
presentationSwitch: true,
|
|
29233
29864
|
label: "Applications",
|
|
29865
|
+
moreLabel: "More actions",
|
|
29234
29866
|
header: null,
|
|
29235
29867
|
footer: null,
|
|
29236
29868
|
railHeader: null,
|
|
@@ -29279,6 +29911,9 @@ var AppSidebar = class extends Component {
|
|
|
29279
29911
|
}
|
|
29280
29912
|
this._shownId = this._modules ? this._resolveShown(this.options.module) : null;
|
|
29281
29913
|
this._modeAbort = null;
|
|
29914
|
+
this._strips = /* @__PURE__ */ new Map();
|
|
29915
|
+
this._rowMenu = null;
|
|
29916
|
+
this._rowMenuList = null;
|
|
29282
29917
|
root.replaceChildren();
|
|
29283
29918
|
return root;
|
|
29284
29919
|
}
|
|
@@ -29551,6 +30186,7 @@ var AppSidebar = class extends Component {
|
|
|
29551
30186
|
this._modeAbort?.abort();
|
|
29552
30187
|
this._modeAbort = null;
|
|
29553
30188
|
for (const tooltip2 of this._stripTooltips.splice(0)) tooltip2.destroy();
|
|
30189
|
+
this._dropRowActions({ menu: true });
|
|
29554
30190
|
this._rail?.destroy();
|
|
29555
30191
|
this._rail = null;
|
|
29556
30192
|
super.destroy();
|
|
@@ -29564,6 +30200,7 @@ var AppSidebar = class extends Component {
|
|
|
29564
30200
|
_renderMode() {
|
|
29565
30201
|
this._modeAbort?.abort();
|
|
29566
30202
|
this._modeAbort = new AbortController();
|
|
30203
|
+
this._dropRowActions({ menu: true });
|
|
29567
30204
|
for (const tooltip2 of this._stripTooltips.splice(0)) tooltip2.destroy();
|
|
29568
30205
|
this._presentationGroup = null;
|
|
29569
30206
|
this._rail?.destroy();
|
|
@@ -29612,7 +30249,7 @@ var AppSidebar = class extends Component {
|
|
|
29612
30249
|
class: "zx-app-sidebar__collapse zx-icon-btn",
|
|
29613
30250
|
type: "button",
|
|
29614
30251
|
ariaLabel: this._message("appSidebar.minimize", "Minimize application sidebar")
|
|
29615
|
-
}, icon(this._side === "right" ? "chevron-right" : "chevron-left"))
|
|
30252
|
+
}, icon(this._side === "right" ? "chevron-right" : "chevron-left", { size: ICON_SIZE.chevron }))
|
|
29616
30253
|
);
|
|
29617
30254
|
button2.hidden = !this.options.collapsible;
|
|
29618
30255
|
this._listenMode(button2, "click", () => this.collapse());
|
|
@@ -29626,7 +30263,7 @@ var AppSidebar = class extends Component {
|
|
|
29626
30263
|
class: "zx-app-sidebar__rail-toggle zx-icon-btn",
|
|
29627
30264
|
type: "button",
|
|
29628
30265
|
ariaLabel: this._message("appSidebar.expand", "Expand application sidebar")
|
|
29629
|
-
}, icon(this._side === "right" ? "chevron-left" : "chevron-right"))
|
|
30266
|
+
}, icon(this._side === "right" ? "chevron-left" : "chevron-right", { size: ICON_SIZE.chevron }))
|
|
29630
30267
|
);
|
|
29631
30268
|
this._railExpandButton = button2;
|
|
29632
30269
|
this._listenMode(button2, "click", () => this.expand());
|
|
@@ -29639,6 +30276,7 @@ var AppSidebar = class extends Component {
|
|
|
29639
30276
|
/** @type {KeyboardEvent} */
|
|
29640
30277
|
event
|
|
29641
30278
|
));
|
|
30279
|
+
this._listenMode(list, "focusin", (event) => this._syncActionStops(event.target));
|
|
29642
30280
|
}
|
|
29643
30281
|
/** @returns {void} */
|
|
29644
30282
|
_renderRail() {
|
|
@@ -30045,11 +30683,22 @@ var AppSidebar = class extends Component {
|
|
|
30045
30683
|
/** @returns {void} */
|
|
30046
30684
|
_renderTree() {
|
|
30047
30685
|
if (!this.refs.list) return;
|
|
30048
|
-
const
|
|
30049
|
-
/** @type {Element} */
|
|
30050
|
-
document.activeElement
|
|
30051
|
-
)
|
|
30686
|
+
const active = (
|
|
30687
|
+
/** @type {Element|null} */
|
|
30688
|
+
document.activeElement
|
|
30689
|
+
);
|
|
30690
|
+
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;
|
|
30691
|
+
this._dropRowActions({ menu: this._rowMenuList !== this.refs.list });
|
|
30052
30692
|
this.refs.list.replaceChildren(...this._treeItems().map((item) => this._treeRow(item, 1)));
|
|
30693
|
+
if (this._strips.size > 0 && !this._rowMenu) {
|
|
30694
|
+
this._rowMenuList = this.refs.list;
|
|
30695
|
+
this._rowMenu = rowActionMenu(this.refs.list, ".zx-app-sidebar__line", (line) => {
|
|
30696
|
+
const id = rowControl(line.parentElement)?.getAttribute("data-app-nav-id") ?? null;
|
|
30697
|
+
const strip = id === null ? null : this._strips.get(id);
|
|
30698
|
+
const item = strip ? findItem2(this._items, id) : null;
|
|
30699
|
+
return strip && item ? { actions: strip.actions, subject: item } : null;
|
|
30700
|
+
});
|
|
30701
|
+
}
|
|
30053
30702
|
this._syncActive();
|
|
30054
30703
|
if (focused !== null) {
|
|
30055
30704
|
const replacement = [...this.refs.list.querySelectorAll("[data-app-nav-id]")].find((control) => control.getAttribute("data-app-nav-id") === focused) ?? null;
|
|
@@ -30072,10 +30721,11 @@ var AppSidebar = class extends Component {
|
|
|
30072
30721
|
location: level === 1 ? "root" : "inline"
|
|
30073
30722
|
});
|
|
30074
30723
|
const control = navControl2(item, hasChildren, expanded, childId, visual);
|
|
30724
|
+
const strip = this._renderRowActions(item);
|
|
30075
30725
|
const row2 = h("li", {
|
|
30076
30726
|
class: "zx-app-sidebar__row",
|
|
30077
30727
|
dataset: { level }
|
|
30078
|
-
}, control);
|
|
30728
|
+
}, strip ? actionLine(control, strip.element) : control);
|
|
30079
30729
|
if (hasChildren) {
|
|
30080
30730
|
row2.append(h("ul", {
|
|
30081
30731
|
class: "zx-app-sidebar__sublist",
|
|
@@ -30115,8 +30765,65 @@ var AppSidebar = class extends Component {
|
|
|
30115
30765
|
)
|
|
30116
30766
|
);
|
|
30117
30767
|
}
|
|
30768
|
+
/**
|
|
30769
|
+
* Builds a destination's action strip, when it lists actions.
|
|
30770
|
+
* @param {AppNavItem} item Destination.
|
|
30771
|
+
* @returns {import('../../internal/row-actions.js').RowActionStrip|null}
|
|
30772
|
+
*/
|
|
30773
|
+
_renderRowActions(item) {
|
|
30774
|
+
const entries = Array.isArray(item.actions) ? item.actions : item.actions && typeof item.actions === "object" && "nodeType" in item.actions ? [item.actions] : [];
|
|
30775
|
+
if (entries.length === 0) return null;
|
|
30776
|
+
const strip = renderRowActions(entries, {
|
|
30777
|
+
block: "app-sidebar",
|
|
30778
|
+
name: item.label,
|
|
30779
|
+
moreLabel: String(this.options.moreLabel ?? "More actions"),
|
|
30780
|
+
run: (action) => action.onSelect(item)
|
|
30781
|
+
});
|
|
30782
|
+
if (strip) this._strips.set(String(item.id), strip);
|
|
30783
|
+
return strip;
|
|
30784
|
+
}
|
|
30785
|
+
/**
|
|
30786
|
+
* Makes the actions of the row holding focus Tab stops, and every other row's not.
|
|
30787
|
+
* @param {EventTarget|null} target What took focus.
|
|
30788
|
+
* @returns {void}
|
|
30789
|
+
*/
|
|
30790
|
+
_syncActionStops(target) {
|
|
30791
|
+
const line = (
|
|
30792
|
+
/** @type {Element|null} */
|
|
30793
|
+
target?.closest?.(".zx-app-sidebar__line") ?? null
|
|
30794
|
+
);
|
|
30795
|
+
for (const strip of this._strips.values()) {
|
|
30796
|
+
setRowActionsTabbable(strip.element, Boolean(line?.contains(strip.element)));
|
|
30797
|
+
}
|
|
30798
|
+
}
|
|
30799
|
+
/**
|
|
30800
|
+
* Destroys the destinations' action strips, and with `menu` the row menu bound to the list.
|
|
30801
|
+
* @param {{menu?: boolean}} [options={}]
|
|
30802
|
+
* @returns {void}
|
|
30803
|
+
*/
|
|
30804
|
+
_dropRowActions({ menu = false } = {}) {
|
|
30805
|
+
for (const strip of this._strips?.values() ?? []) strip.destroy();
|
|
30806
|
+
this._strips?.clear();
|
|
30807
|
+
if (menu) {
|
|
30808
|
+
this._rowMenu?.destroy();
|
|
30809
|
+
this._rowMenu = null;
|
|
30810
|
+
this._rowMenuList = null;
|
|
30811
|
+
}
|
|
30812
|
+
}
|
|
30118
30813
|
/** @param {Event} event @returns {void} */
|
|
30119
30814
|
_onTreeClick(event) {
|
|
30815
|
+
const actionControl = (
|
|
30816
|
+
/** @type {HTMLElement|null} */
|
|
30817
|
+
/** @type {Element|null} */
|
|
30818
|
+
event.target?.closest?.(".zx-app-sidebar__actions [data-row-action]") ?? null
|
|
30819
|
+
);
|
|
30820
|
+
if (actionControl && this.refs.list.contains(actionControl)) {
|
|
30821
|
+
const id = rowControl(actionControl.closest(".zx-app-sidebar__row"))?.getAttribute("data-app-nav-id") ?? null;
|
|
30822
|
+
const action = id === null ? null : this._strips.get(id)?.actions[Number(actionControl.dataset.rowAction)];
|
|
30823
|
+
const item2 = action ? findItem2(this._items, id) : null;
|
|
30824
|
+
if (action && item2 && !action.disabled) action.onSelect(item2);
|
|
30825
|
+
return;
|
|
30826
|
+
}
|
|
30120
30827
|
const control = (
|
|
30121
30828
|
/** @type {Element|null} */
|
|
30122
30829
|
event.target?.closest?.("[data-app-nav-id]")
|
|
@@ -30143,7 +30850,7 @@ var AppSidebar = class extends Component {
|
|
|
30143
30850
|
if (event.key === "ArrowRight" && item?.children?.length) {
|
|
30144
30851
|
event.preventDefault();
|
|
30145
30852
|
if (!this._expanded.has(String(item.id))) this.toggleBranch(item.id);
|
|
30146
|
-
else visibleTreeControls(current.
|
|
30853
|
+
else visibleTreeControls(current.closest(".zx-app-sidebar__row")?.querySelector(":scope > .zx-app-sidebar__sublist"))[0]?.focus();
|
|
30147
30854
|
return;
|
|
30148
30855
|
}
|
|
30149
30856
|
if (event.key === "ArrowLeft") {
|
|
@@ -30153,7 +30860,7 @@ var AppSidebar = class extends Component {
|
|
|
30153
30860
|
return;
|
|
30154
30861
|
}
|
|
30155
30862
|
const parentList = current.closest(".zx-app-sidebar__sublist");
|
|
30156
|
-
const parentControl = parentList?.parentElement
|
|
30863
|
+
const parentControl = rowControl(parentList?.parentElement ?? null);
|
|
30157
30864
|
if (parentControl instanceof HTMLElement) {
|
|
30158
30865
|
event.preventDefault();
|
|
30159
30866
|
parentControl.focus();
|
|
@@ -30222,7 +30929,7 @@ var AppSidebar = class extends Component {
|
|
|
30222
30929
|
_markBranchMotion(key) {
|
|
30223
30930
|
if (!this.refs.list) return;
|
|
30224
30931
|
const control = [...this.refs.list.querySelectorAll("[data-app-nav-id]")].find((candidate) => candidate.getAttribute("data-app-nav-id") === key) ?? null;
|
|
30225
|
-
const sublist = control?.
|
|
30932
|
+
const sublist = control?.closest(".zx-app-sidebar__row")?.querySelector(":scope > .zx-app-sidebar__sublist");
|
|
30226
30933
|
if (sublist instanceof HTMLElement) sublist.dataset.branchMotion = "expand";
|
|
30227
30934
|
}
|
|
30228
30935
|
/**
|
|
@@ -30285,11 +30992,29 @@ function navControl2(item, disclosure, expanded, controls, visual) {
|
|
|
30285
30992
|
disclosure ? h(
|
|
30286
30993
|
"span",
|
|
30287
30994
|
{ class: "zx-app-sidebar__item-disclosure", ariaHidden: "true" },
|
|
30288
|
-
icon(expanded ? "chevron-down" : "chevron-right")
|
|
30995
|
+
icon(expanded ? "chevron-down" : "chevron-right", { size: ICON_SIZE.chevron })
|
|
30289
30996
|
) : null
|
|
30290
30997
|
)
|
|
30291
30998
|
);
|
|
30292
30999
|
}
|
|
31000
|
+
function rowControl(row2) {
|
|
31001
|
+
return (
|
|
31002
|
+
/** @type {HTMLElement|null} */
|
|
31003
|
+
row2?.querySelector(
|
|
31004
|
+
":scope > [data-app-nav-id], :scope > .zx-app-sidebar__line > [data-app-nav-id]"
|
|
31005
|
+
) ?? null
|
|
31006
|
+
);
|
|
31007
|
+
}
|
|
31008
|
+
function actionLine(control, strip) {
|
|
31009
|
+
return (
|
|
31010
|
+
/** @type {HTMLElement} */
|
|
31011
|
+
h("div", {
|
|
31012
|
+
class: "zx-app-sidebar__line",
|
|
31013
|
+
"data-zx-reveal-host": "",
|
|
31014
|
+
style: { "--zx-app-sidebar-actions": String(strip.childElementCount) }
|
|
31015
|
+
}, control, strip)
|
|
31016
|
+
);
|
|
31017
|
+
}
|
|
30293
31018
|
function visibleTreeControls(root) {
|
|
30294
31019
|
if (!root) return [];
|
|
30295
31020
|
return (
|
|
@@ -30305,8 +31030,7 @@ function visibleTreeControl(control) {
|
|
|
30305
31030
|
while (candidate) {
|
|
30306
31031
|
const hiddenList = candidate.closest(".zx-app-sidebar__sublist[hidden]");
|
|
30307
31032
|
if (!hiddenList) return candidate;
|
|
30308
|
-
candidate =
|
|
30309
|
-
hiddenList.parentElement?.firstElementChild ?? null;
|
|
31033
|
+
candidate = rowControl(hiddenList.parentElement);
|
|
30310
31034
|
}
|
|
30311
31035
|
return null;
|
|
30312
31036
|
}
|
|
@@ -30709,7 +31433,7 @@ var Message = class _Message extends Component {
|
|
|
30709
31433
|
type: "button",
|
|
30710
31434
|
ariaLabel: this._message("message.close", "Close message"),
|
|
30711
31435
|
title: this._message("message.closeTitle", "Close")
|
|
30712
|
-
}, icon("x", { size:
|
|
31436
|
+
}, icon("x", { size: ICON_SIZE.dismiss }));
|
|
30713
31437
|
node.append(close);
|
|
30714
31438
|
this.listen(close, "click", () => this._close(entry));
|
|
30715
31439
|
}
|
|
@@ -31685,266 +32409,6 @@ function clearDepth(sheet) {
|
|
|
31685
32409
|
]) element.style.removeProperty(property);
|
|
31686
32410
|
}
|
|
31687
32411
|
|
|
31688
|
-
// src/components/context-menu/context-menu.js
|
|
31689
|
-
var ContextMenu = class extends Component {
|
|
31690
|
-
/** @type {ContextMenuOptions} */
|
|
31691
|
-
static defaults = {
|
|
31692
|
-
items: [],
|
|
31693
|
-
selector: null
|
|
31694
|
-
};
|
|
31695
|
-
/** @type {Element} */
|
|
31696
|
-
#target;
|
|
31697
|
-
/** @type {Dropdown} */
|
|
31698
|
-
#dropdown;
|
|
31699
|
-
/** @type {HTMLElement} */
|
|
31700
|
-
#panel;
|
|
31701
|
-
/** @type {ReturnType<typeof rovingTabindex>} */
|
|
31702
|
-
#roving;
|
|
31703
|
-
/** @type {(event: KeyboardEvent|string) => void} */
|
|
31704
|
-
#typeahead;
|
|
31705
|
-
/** @type {ContextMenuEntry[]} */
|
|
31706
|
-
#items = [];
|
|
31707
|
-
/** @type {Element|null} */
|
|
31708
|
-
#context = null;
|
|
31709
|
-
/** @type {Element|null} */
|
|
31710
|
-
#returnFocus = null;
|
|
31711
|
-
#destroyed = false;
|
|
31712
|
-
/**
|
|
31713
|
-
* Attaches a context menu to an existing element.
|
|
31714
|
-
* @param {Element|string} target Element or selector the menu belongs to.
|
|
31715
|
-
* @param {ContextMenuOptions} [options={}] Context-menu options.
|
|
31716
|
-
*/
|
|
31717
|
-
constructor(target, options = {}) {
|
|
31718
|
-
const resolved = resolveElement(target);
|
|
31719
|
-
if (!resolved) throw new TypeError("ContextMenu target could not be resolved");
|
|
31720
|
-
super(null, options);
|
|
31721
|
-
this.#target = resolved;
|
|
31722
|
-
document.body.append(this.el);
|
|
31723
|
-
this.#dropdown = new Dropdown(this.el, {
|
|
31724
|
-
openOn: "manual",
|
|
31725
|
-
placement: "bottom-start",
|
|
31726
|
-
scope: resolved
|
|
31727
|
-
});
|
|
31728
|
-
this.#panel = this.#dropdown.getPanel();
|
|
31729
|
-
this.#dropdown._configure({ onEscape: () => this.close(), tabReach: false });
|
|
31730
|
-
this.#panel.classList.add("zx-context-menu");
|
|
31731
|
-
this.#panel.setAttribute("role", "menu");
|
|
31732
|
-
if (Array.isArray(this.options.items)) this.setItems(this.options.items);
|
|
31733
|
-
this.#roving = rovingTabindex(this.#panel, MENU_ITEM_SELECTOR);
|
|
31734
|
-
this.#typeahead = typeahead(() => this.#menuItems(), (item) => item.focus());
|
|
31735
|
-
this.#dropdown.on("close", () => {
|
|
31736
|
-
this.#context = null;
|
|
31737
|
-
const restore10 = this.#returnFocus;
|
|
31738
|
-
this.#returnFocus = null;
|
|
31739
|
-
if (restore10 instanceof HTMLElement && restore10.isConnected) restore10.focus();
|
|
31740
|
-
this.emit("close");
|
|
31741
|
-
});
|
|
31742
|
-
this.listen(this.#target, "contextmenu", (event) => this.#onContextMenu(event));
|
|
31743
|
-
this.listen(this.#target, "keydown", (event) => this.#onTargetKeydown(event));
|
|
31744
|
-
this.listen(this.#panel, "click", (event) => {
|
|
31745
|
-
const item = event.target.closest?.(MENU_ITEM_SELECTOR);
|
|
31746
|
-
if (item && this.#panel.contains(item)) this.#select(item, event);
|
|
31747
|
-
});
|
|
31748
|
-
this.listen(this.#panel, "keydown", (event) => this.#onMenuKeydown(event));
|
|
31749
|
-
}
|
|
31750
|
-
/**
|
|
31751
|
-
* Creates the zero-sized element the menu is anchored to.
|
|
31752
|
-
* @returns {HTMLElement}
|
|
31753
|
-
*/
|
|
31754
|
-
render() {
|
|
31755
|
-
return h("span", { class: "zx-context-menu__anchor", ariaHidden: "true" });
|
|
31756
|
-
}
|
|
31757
|
-
/**
|
|
31758
|
-
* Replaces the menu items.
|
|
31759
|
-
* @param {ContextMenuEntry[]} items Menu definitions.
|
|
31760
|
-
* @returns {this}
|
|
31761
|
-
*/
|
|
31762
|
-
setItems(items) {
|
|
31763
|
-
this.#items = Array.isArray(items) ? items.slice() : [];
|
|
31764
|
-
this.#panel.replaceChildren(...renderMenuEntries(this.#items, "context-menu"));
|
|
31765
|
-
return this;
|
|
31766
|
-
}
|
|
31767
|
-
/**
|
|
31768
|
-
* Opens the menu at a point in viewport coordinates.
|
|
31769
|
-
* @param {number} x Client X.
|
|
31770
|
-
* @param {number} y Client Y.
|
|
31771
|
-
* @param {Element|null} [context=null] Element the menu applies to.
|
|
31772
|
-
* @returns {this}
|
|
31773
|
-
* @fires ContextMenu#open
|
|
31774
|
-
*/
|
|
31775
|
-
openAt(x, y, context = null) {
|
|
31776
|
-
if (!this.#prepare(context)) return this;
|
|
31777
|
-
this.#openResolved(x, y, context);
|
|
31778
|
-
return this;
|
|
31779
|
-
}
|
|
31780
|
-
/**
|
|
31781
|
-
* Opens the menu against an element's box, which is where a keyboard invocation puts it.
|
|
31782
|
-
* @param {Element} element Element to anchor to.
|
|
31783
|
-
* @returns {this}
|
|
31784
|
-
* @fires ContextMenu#open
|
|
31785
|
-
*/
|
|
31786
|
-
openAtElement(element) {
|
|
31787
|
-
const box = element.getBoundingClientRect();
|
|
31788
|
-
return this.openAt(box.left, box.bottom, element);
|
|
31789
|
-
}
|
|
31790
|
-
/**
|
|
31791
|
-
* Closes the menu.
|
|
31792
|
-
* @returns {this}
|
|
31793
|
-
*/
|
|
31794
|
-
close() {
|
|
31795
|
-
this.#dropdown.close();
|
|
31796
|
-
return this;
|
|
31797
|
-
}
|
|
31798
|
-
/**
|
|
31799
|
-
* Reports whether the menu is open.
|
|
31800
|
-
* @returns {boolean}
|
|
31801
|
-
*/
|
|
31802
|
-
isOpen() {
|
|
31803
|
-
return this.#dropdown.isOpen();
|
|
31804
|
-
}
|
|
31805
|
-
/**
|
|
31806
|
-
* The element the open menu applies to — the `selector` match under the pointer, or the target.
|
|
31807
|
-
* @returns {Element|null}
|
|
31808
|
-
*/
|
|
31809
|
-
getContext() {
|
|
31810
|
-
return this.#context;
|
|
31811
|
-
}
|
|
31812
|
-
/**
|
|
31813
|
-
* Detaches the menu and removes its anchor.
|
|
31814
|
-
* @returns {void}
|
|
31815
|
-
*/
|
|
31816
|
-
destroy() {
|
|
31817
|
-
if (this.#destroyed) return;
|
|
31818
|
-
this.#destroyed = true;
|
|
31819
|
-
this.#roving.destroy();
|
|
31820
|
-
this.#dropdown.destroy();
|
|
31821
|
-
super.destroy();
|
|
31822
|
-
}
|
|
31823
|
-
/**
|
|
31824
|
-
* Resolves the items for this opening and reports whether it may proceed.
|
|
31825
|
-
* @param {Element|null} context Element the menu applies to.
|
|
31826
|
-
* @returns {boolean}
|
|
31827
|
-
*/
|
|
31828
|
-
#prepare(context) {
|
|
31829
|
-
const items = this.options.items;
|
|
31830
|
-
if (typeof items === "function") {
|
|
31831
|
-
const resolved = items(context);
|
|
31832
|
-
if (!Array.isArray(resolved) || resolved.length === 0) return false;
|
|
31833
|
-
this.setItems(resolved);
|
|
31834
|
-
}
|
|
31835
|
-
return this.#items.length > 0;
|
|
31836
|
-
}
|
|
31837
|
-
/**
|
|
31838
|
-
* Places the anchor and opens, with the items for this opening already resolved.
|
|
31839
|
-
*
|
|
31840
|
-
* `left`/`top` rather than the logical insets used everywhere else: these are viewport
|
|
31841
|
-
* coordinates from a pointer event, which are physical whatever the writing direction is.
|
|
31842
|
-
*
|
|
31843
|
-
* @param {number} x Client X.
|
|
31844
|
-
* @param {number} y Client Y.
|
|
31845
|
-
* @param {Element|null} context Element the menu applies to.
|
|
31846
|
-
* @returns {void}
|
|
31847
|
-
*/
|
|
31848
|
-
#openResolved(x, y, context) {
|
|
31849
|
-
const root = (
|
|
31850
|
-
/** @type {HTMLElement} */
|
|
31851
|
-
this.el
|
|
31852
|
-
);
|
|
31853
|
-
root.style.left = `${x}px`;
|
|
31854
|
-
root.style.top = `${y}px`;
|
|
31855
|
-
this.#context = context;
|
|
31856
|
-
this.#returnFocus = document.activeElement;
|
|
31857
|
-
this.#dropdown.open();
|
|
31858
|
-
this.#roving.focusFirst();
|
|
31859
|
-
this.emit("open", { context });
|
|
31860
|
-
}
|
|
31861
|
-
/** @param {Event} event @returns {void} */
|
|
31862
|
-
#onContextMenu(event) {
|
|
31863
|
-
const pointer = (
|
|
31864
|
-
/** @type {PointerEvent & {target: Element}} */
|
|
31865
|
-
event
|
|
31866
|
-
);
|
|
31867
|
-
const context = this.#contextFor(pointer.target);
|
|
31868
|
-
if (!context || !this.#prepare(context)) return;
|
|
31869
|
-
event.preventDefault();
|
|
31870
|
-
this.#openResolved(pointer.clientX, pointer.clientY, context);
|
|
31871
|
-
}
|
|
31872
|
-
/** @param {Event} event @returns {void} */
|
|
31873
|
-
#onTargetKeydown(event) {
|
|
31874
|
-
const key = (
|
|
31875
|
-
/** @type {KeyboardEvent} */
|
|
31876
|
-
event
|
|
31877
|
-
);
|
|
31878
|
-
if (key.key !== "ContextMenu" && !(key.key === "F10" && key.shiftKey)) return;
|
|
31879
|
-
const context = this.#contextFor(
|
|
31880
|
-
/** @type {Element} */
|
|
31881
|
-
key.target
|
|
31882
|
-
);
|
|
31883
|
-
if (!context || !this.#prepare(context)) return;
|
|
31884
|
-
event.preventDefault();
|
|
31885
|
-
const box = context.getBoundingClientRect();
|
|
31886
|
-
this.#openResolved(box.left, box.bottom, context);
|
|
31887
|
-
}
|
|
31888
|
-
/**
|
|
31889
|
-
* The element a pointer or key event applies to, honoring `selector`.
|
|
31890
|
-
* @param {Element|null} from Event target.
|
|
31891
|
-
* @returns {Element|null}
|
|
31892
|
-
*/
|
|
31893
|
-
#contextFor(from) {
|
|
31894
|
-
if (!this.options.selector) return this.#target;
|
|
31895
|
-
const match = from?.closest?.(String(this.options.selector));
|
|
31896
|
-
return match && this.#target.contains(match) ? match : null;
|
|
31897
|
-
}
|
|
31898
|
-
/** @param {Event} event @returns {void} */
|
|
31899
|
-
#onMenuKeydown(event) {
|
|
31900
|
-
const key = (
|
|
31901
|
-
/** @type {KeyboardEvent} */
|
|
31902
|
-
event
|
|
31903
|
-
);
|
|
31904
|
-
if (key.key === "Tab") {
|
|
31905
|
-
event.preventDefault();
|
|
31906
|
-
this.close();
|
|
31907
|
-
return;
|
|
31908
|
-
}
|
|
31909
|
-
if (key.key === "Enter" || key.key === " ") {
|
|
31910
|
-
const item = (
|
|
31911
|
-
/** @type {Element} */
|
|
31912
|
-
key.target.closest?.(MENU_ITEM_SELECTOR)
|
|
31913
|
-
);
|
|
31914
|
-
if (!item || !this.#panel.contains(item)) return;
|
|
31915
|
-
if (key.key === "Enter" && item.tagName === "A") return;
|
|
31916
|
-
event.preventDefault();
|
|
31917
|
-
item.click();
|
|
31918
|
-
return;
|
|
31919
|
-
}
|
|
31920
|
-
this.#typeahead(key);
|
|
31921
|
-
}
|
|
31922
|
-
/** @param {Element} element @param {Event|null} [event=null] @returns {void} */
|
|
31923
|
-
#select(element, event = null) {
|
|
31924
|
-
const index = Number(element.getAttribute("data-menu-item"));
|
|
31925
|
-
const item = this.#items[index];
|
|
31926
|
-
if (!isMenuItem(item) || item.disabled) {
|
|
31927
|
-
event?.preventDefault();
|
|
31928
|
-
return;
|
|
31929
|
-
}
|
|
31930
|
-
const context = this.#context;
|
|
31931
|
-
const selected = this.emit("select", { value: item.value, item, context });
|
|
31932
|
-
if (selected.defaultPrevented) {
|
|
31933
|
-
event?.preventDefault();
|
|
31934
|
-
return;
|
|
31935
|
-
}
|
|
31936
|
-
try {
|
|
31937
|
-
item.onselect?.(item.value, item, this);
|
|
31938
|
-
} finally {
|
|
31939
|
-
this.close();
|
|
31940
|
-
}
|
|
31941
|
-
}
|
|
31942
|
-
/** @returns {HTMLElement[]} */
|
|
31943
|
-
#menuItems() {
|
|
31944
|
-
return Array.from(this.#panel.querySelectorAll(MENU_ITEM_SELECTOR));
|
|
31945
|
-
}
|
|
31946
|
-
};
|
|
31947
|
-
|
|
31948
32412
|
// src/components/calendar/calendar-model.js
|
|
31949
32413
|
var CALENDAR_VIEWS = Object.freeze(["agenda", "day", "week", "month", "year"]);
|
|
31950
32414
|
var DAY_MS2 = 864e5;
|
|
@@ -34384,14 +34848,14 @@ var RecordView = class extends Component {
|
|
|
34384
34848
|
ariaLabel: this._message("recordView.moveFieldUp", "Move %1 up", field.label),
|
|
34385
34849
|
disabled: index === 0,
|
|
34386
34850
|
dataset: { viewFieldAction: "up", fieldId: field.id }
|
|
34387
|
-
}, icon("chevron-up", { size:
|
|
34851
|
+
}, icon("chevron-up", { size: ICON_SIZE.chevron }));
|
|
34388
34852
|
const down = h("button", {
|
|
34389
34853
|
class: "zx-record-view__field-move",
|
|
34390
34854
|
type: "button",
|
|
34391
34855
|
ariaLabel: this._message("recordView.moveFieldDown", "Move %1 down", field.label),
|
|
34392
34856
|
disabled: index === fields.length - 1,
|
|
34393
34857
|
dataset: { viewFieldAction: "down", fieldId: field.id }
|
|
34394
|
-
}, icon("chevron-down", { size:
|
|
34858
|
+
}, icon("chevron-down", { size: ICON_SIZE.chevron }));
|
|
34395
34859
|
return h(
|
|
34396
34860
|
"div",
|
|
34397
34861
|
{ class: "zx-record-view__field-option" },
|
|
@@ -35551,7 +36015,7 @@ var CardView = class extends RecordView {
|
|
|
35551
36015
|
ariaExpanded: String(!collapsed),
|
|
35552
36016
|
ariaControls: `${headingId}-list`,
|
|
35553
36017
|
dataset: { groupToggle: "" }
|
|
35554
|
-
}, icon("chevron-down", { size:
|
|
36018
|
+
}, icon("chevron-down", { size: ICON_SIZE.chevron }), labelNode) : labelNode;
|
|
35555
36019
|
const heading = h("h2", { class: "zx-card-view__group-heading", id: headingId }, content);
|
|
35556
36020
|
const header = h("div", {
|
|
35557
36021
|
class: "zx-card-view__group-header",
|
|
@@ -37259,7 +37723,7 @@ var KanbanView = class extends RecordView {
|
|
|
37259
37723
|
ariaControls: bodyId,
|
|
37260
37724
|
ariaLabel: this._text(collapsed ? "expandLane" : "collapseLane", { label: lane.label }),
|
|
37261
37725
|
dataset: { kanbanCollapse: "swimlane", kanbanId: lane.id }
|
|
37262
|
-
}, icon(collapsed ? "chevron-right" : "chevron-down", { size:
|
|
37726
|
+
}, icon(collapsed ? "chevron-right" : "chevron-down", { size: ICON_SIZE.chevron }));
|
|
37263
37727
|
const limit = lane.limit ?? null;
|
|
37264
37728
|
const wip = wipState(total, limit);
|
|
37265
37729
|
const custom = this._renderHook("renderSwimlaneHeader", {
|
|
@@ -37325,7 +37789,7 @@ var KanbanView = class extends RecordView {
|
|
|
37325
37789
|
ariaControls: listId,
|
|
37326
37790
|
ariaLabel: this._text(collapsed ? "expandColumn" : "collapseColumn", { label: column.label }),
|
|
37327
37791
|
dataset: { kanbanCollapse: "column", kanbanId: column.id }
|
|
37328
|
-
}, icon(collapsed ? "chevron-right" : "chevron-down", { size:
|
|
37792
|
+
}, icon(collapsed ? "chevron-right" : "chevron-down", { size: ICON_SIZE.chevron }));
|
|
37329
37793
|
const custom = this._renderHook("renderColumnHeader", {
|
|
37330
37794
|
column: { ...column },
|
|
37331
37795
|
swimlane: lane ? { ...lane } : null,
|
|
@@ -39345,11 +39809,11 @@ var ChartJsAdapter = class {
|
|
|
39345
39809
|
* @param {Function|{Chart?: Function}} engine Injected Chart.js constructor or namespace.
|
|
39346
39810
|
* @param {Record<string, unknown>} [defaults={}] Adapter-wide Chart.js options.
|
|
39347
39811
|
*/
|
|
39348
|
-
constructor(engine,
|
|
39812
|
+
constructor(engine, defaults7 = {}) {
|
|
39349
39813
|
const constructor = typeof engine === "function" ? engine : engine?.Chart;
|
|
39350
39814
|
if (typeof constructor !== "function") throw new TypeError("ChartJsAdapter requires an injected Chart.js constructor");
|
|
39351
39815
|
this.engine = constructor;
|
|
39352
|
-
this.defaults = cloneChartValue(
|
|
39816
|
+
this.defaults = cloneChartValue(defaults7);
|
|
39353
39817
|
}
|
|
39354
39818
|
/**
|
|
39355
39819
|
* Creates one Chart.js lifecycle handle.
|
|
@@ -39400,12 +39864,12 @@ var ChartJsAdapter = class {
|
|
|
39400
39864
|
};
|
|
39401
39865
|
}
|
|
39402
39866
|
};
|
|
39403
|
-
function chartJsConfig(spec,
|
|
39867
|
+
function chartJsConfig(spec, defaults7, getInstance) {
|
|
39404
39868
|
const supplied = cloneChartValue(spec.options);
|
|
39405
39869
|
const options = {
|
|
39406
39870
|
responsive: true,
|
|
39407
39871
|
maintainAspectRatio: false,
|
|
39408
|
-
...cloneChartValue(
|
|
39872
|
+
...cloneChartValue(defaults7),
|
|
39409
39873
|
...supplied
|
|
39410
39874
|
};
|
|
39411
39875
|
if (spec.reducedMotion) options.animation = false;
|
|
@@ -39526,14 +39990,20 @@ function summaryValue(value) {
|
|
|
39526
39990
|
}
|
|
39527
39991
|
function themeChartOptions(root) {
|
|
39528
39992
|
if (typeof getComputedStyle !== "function") return {};
|
|
39529
|
-
const style = getComputedStyle(root);
|
|
39530
|
-
const color = style.getPropertyValue("--zx-color-text").trim();
|
|
39531
|
-
const borderColor = style.getPropertyValue("--zx-color-border").trim();
|
|
39532
39993
|
return {
|
|
39533
|
-
color: color
|
|
39534
|
-
borderColor:
|
|
39994
|
+
color: themeColour(root, "--zx-color-text"),
|
|
39995
|
+
borderColor: themeColour(root, "--zx-color-border")
|
|
39535
39996
|
};
|
|
39536
39997
|
}
|
|
39998
|
+
function themeColour(root, token) {
|
|
39999
|
+
if (!getComputedStyle(root).getPropertyValue(token).trim()) return void 0;
|
|
40000
|
+
const probe = h("span", { hidden: true });
|
|
40001
|
+
probe.style.color = `var(${token})`;
|
|
40002
|
+
root.append(probe);
|
|
40003
|
+
const colour = getComputedStyle(probe).color;
|
|
40004
|
+
probe.remove();
|
|
40005
|
+
return colour || void 0;
|
|
40006
|
+
}
|
|
39537
40007
|
function errorMessage(error2, fallback) {
|
|
39538
40008
|
const message = error2 && typeof error2 === "object" && "message" in error2 ? String(error2.message) : "";
|
|
39539
40009
|
return message.trim() ? message : String(fallback);
|
|
@@ -39627,6 +40097,8 @@ var TreeView = class extends Component {
|
|
|
39627
40097
|
checked: [],
|
|
39628
40098
|
icons: true,
|
|
39629
40099
|
renderLabel: null,
|
|
40100
|
+
rowActions: null,
|
|
40101
|
+
moreLabel: "More actions",
|
|
39630
40102
|
load: null,
|
|
39631
40103
|
filter: "",
|
|
39632
40104
|
label: "Tree",
|
|
@@ -39643,6 +40115,8 @@ var TreeView = class extends Component {
|
|
|
39643
40115
|
this._loading = /* @__PURE__ */ new Map();
|
|
39644
40116
|
this._focusId = null;
|
|
39645
40117
|
this._filter = "";
|
|
40118
|
+
this._strips = [];
|
|
40119
|
+
this._rowMenu = null;
|
|
39646
40120
|
this._createdRoot = this.el === null;
|
|
39647
40121
|
this._snapshot = this._createdRoot ? null : snapshotTarget(this.el);
|
|
39648
40122
|
const root = (
|
|
@@ -39690,6 +40164,21 @@ var TreeView = class extends Component {
|
|
|
39690
40164
|
this.listen(root, "focus", () => {
|
|
39691
40165
|
if (this._rows.length > 0 && !this._rowElement(this._focusId)) this._focusRow(0);
|
|
39692
40166
|
});
|
|
40167
|
+
this.listen(root, "focusin", (event) => {
|
|
40168
|
+
const strip = this._stripOf(event.target);
|
|
40169
|
+
const row2 = strip ? this._rows[this._rowIndex(strip.closest(".zx-tree__row"))] : null;
|
|
40170
|
+
if (row2 && !Object.is(row2.id, this._focusId)) {
|
|
40171
|
+
this._focusId = row2.id;
|
|
40172
|
+
this._syncRows();
|
|
40173
|
+
}
|
|
40174
|
+
});
|
|
40175
|
+
if (typeof this.options.rowActions === "function") {
|
|
40176
|
+
this._rowMenu = rowActionMenu(root, ".zx-tree__row", (element) => {
|
|
40177
|
+
const index = this._rowIndex(element);
|
|
40178
|
+
const strip = this._strips[index];
|
|
40179
|
+
return strip ? { actions: strip.actions, subject: this._subject(this._rows[index]) } : null;
|
|
40180
|
+
});
|
|
40181
|
+
}
|
|
39693
40182
|
if (String(this.options.filter ?? "") !== "") this.setFilter(this.options.filter);
|
|
39694
40183
|
else this._renderRows();
|
|
39695
40184
|
return root;
|
|
@@ -39935,6 +40424,7 @@ var TreeView = class extends Component {
|
|
|
39935
40424
|
_renderRows() {
|
|
39936
40425
|
const items = this._visibleItems();
|
|
39937
40426
|
this._rows = flattenVisible(items, this._readers, this._expanded);
|
|
40427
|
+
for (const strip of this._strips.splice(0)) strip?.destroy();
|
|
39938
40428
|
if (this._rows.length === 0) {
|
|
39939
40429
|
this.el.replaceChildren(h(
|
|
39940
40430
|
"div",
|
|
@@ -39943,14 +40433,15 @@ var TreeView = class extends Component {
|
|
|
39943
40433
|
));
|
|
39944
40434
|
return;
|
|
39945
40435
|
}
|
|
39946
|
-
this.el.replaceChildren(...this._rows.map((row2) => this._renderRow(row2)));
|
|
40436
|
+
this.el.replaceChildren(...this._rows.map((row2, index) => this._renderRow(row2, index)));
|
|
39947
40437
|
this._syncRows();
|
|
39948
40438
|
}
|
|
39949
40439
|
/**
|
|
39950
40440
|
* @param {{node: TreeNode, id: unknown, level: number, posinset: number, setsize: number}} row Row spec.
|
|
40441
|
+
* @param {number} index Visible position.
|
|
39951
40442
|
* @returns {HTMLElement}
|
|
39952
40443
|
*/
|
|
39953
|
-
_renderRow(row2) {
|
|
40444
|
+
_renderRow(row2, index) {
|
|
39954
40445
|
const branch = isBranch(row2.node, this._readers);
|
|
39955
40446
|
const expanded = branch && this._expanded.has(row2.id);
|
|
39956
40447
|
const element = h("div", {
|
|
@@ -39967,7 +40458,7 @@ var TreeView = class extends Component {
|
|
|
39967
40458
|
const twisty = h(
|
|
39968
40459
|
"span",
|
|
39969
40460
|
{ class: "zx-tree__twisty", ariaHidden: "true" },
|
|
39970
|
-
branch ? icon("chevron-right", { size:
|
|
40461
|
+
branch ? icon("chevron-right", { size: ICON_SIZE.chevron }) : null
|
|
39971
40462
|
);
|
|
39972
40463
|
twisty.dataset.action = "twisty";
|
|
39973
40464
|
element.append(twisty);
|
|
@@ -39992,9 +40483,23 @@ var TreeView = class extends Component {
|
|
|
39992
40483
|
));
|
|
39993
40484
|
}
|
|
39994
40485
|
const content = this.options.renderLabel ? this.options.renderLabel(row2.node) : this._readers.label(row2.node);
|
|
39995
|
-
|
|
39996
|
-
|
|
39997
|
-
|
|
40486
|
+
const label = h("span", { class: "zx-tree__label" }, content);
|
|
40487
|
+
element.append(label);
|
|
40488
|
+
const badge2 = row2.node.badge != null ? h("span", { class: "zx-tree__badge" }, String(row2.node.badge)) : null;
|
|
40489
|
+
if (badge2) element.append(badge2);
|
|
40490
|
+
const strip = typeof this.options.rowActions === "function" ? renderRowActions(this.options.rowActions(this._subject(row2)), {
|
|
40491
|
+
block: "tree",
|
|
40492
|
+
name: this._readers.label(row2.node),
|
|
40493
|
+
moreLabel: String(this.options.moreLabel ?? "More actions"),
|
|
40494
|
+
run: (action) => action.onSelect(this._subject(row2))
|
|
40495
|
+
}) : null;
|
|
40496
|
+
if (strip) {
|
|
40497
|
+
this._strips[index] = strip;
|
|
40498
|
+
label.id = uid("zx-tree-label");
|
|
40499
|
+
if (badge2) badge2.id = uid("zx-tree-badge");
|
|
40500
|
+
element.setAttribute("aria-labelledby", badge2 ? `${label.id} ${badge2.id}` : label.id);
|
|
40501
|
+
element.setAttribute("data-zx-reveal-host", "");
|
|
40502
|
+
element.append(strip.element);
|
|
39998
40503
|
}
|
|
39999
40504
|
return element;
|
|
40000
40505
|
}
|
|
@@ -40016,6 +40521,7 @@ var TreeView = class extends Component {
|
|
|
40016
40521
|
element.toggleAttribute("data-branch", branch);
|
|
40017
40522
|
element.toggleAttribute("data-loading", this._loading.has(row2.id));
|
|
40018
40523
|
element.tabIndex = index === focusIndex ? 0 : -1;
|
|
40524
|
+
setRowActionsTabbable(this._strips[index]?.element, index === focusIndex);
|
|
40019
40525
|
const box = (
|
|
40020
40526
|
/** @type {HTMLInputElement|null} */
|
|
40021
40527
|
element.querySelector(".zx-tree__checkbox")
|
|
@@ -40037,6 +40543,18 @@ var TreeView = class extends Component {
|
|
|
40037
40543
|
/* -------------------------------------------------------------- interaction -- */
|
|
40038
40544
|
/** @param {MouseEvent} event @returns {void} */
|
|
40039
40545
|
_onClick(event) {
|
|
40546
|
+
const strip = this._stripOf(event.target);
|
|
40547
|
+
if (strip) {
|
|
40548
|
+
const control = (
|
|
40549
|
+
/** @type {HTMLElement|null} */
|
|
40550
|
+
/** @type {Element} */
|
|
40551
|
+
event.target.closest("[data-row-action]")
|
|
40552
|
+
);
|
|
40553
|
+
const index2 = this._rowIndex(strip.closest(".zx-tree__row"));
|
|
40554
|
+
const action2 = control ? this._strips[index2]?.actions[Number(control.dataset.rowAction)] : null;
|
|
40555
|
+
if (action2 && !action2.disabled) action2.onSelect(this._subject(this._rows[index2]));
|
|
40556
|
+
return;
|
|
40557
|
+
}
|
|
40040
40558
|
const element = (
|
|
40041
40559
|
/** @type {Element} */
|
|
40042
40560
|
event.target.closest(".zx-tree__row")
|
|
@@ -40067,6 +40585,7 @@ var TreeView = class extends Component {
|
|
|
40067
40585
|
}
|
|
40068
40586
|
/** @param {MouseEvent} event @returns {void} */
|
|
40069
40587
|
_onDoubleClick(event) {
|
|
40588
|
+
if (this._stripOf(event.target)) return;
|
|
40070
40589
|
const element = (
|
|
40071
40590
|
/** @type {Element} */
|
|
40072
40591
|
event.target.closest(".zx-tree__row")
|
|
@@ -40082,6 +40601,7 @@ var TreeView = class extends Component {
|
|
|
40082
40601
|
}
|
|
40083
40602
|
/** @param {KeyboardEvent} event @returns {void} */
|
|
40084
40603
|
_onKeydown(event) {
|
|
40604
|
+
if (this._stripOf(event.target)) return;
|
|
40085
40605
|
const index = this._rows.findIndex((row3) => Object.is(row3.id, this._focusId));
|
|
40086
40606
|
if (index < 0 || this._rows.length === 0) return;
|
|
40087
40607
|
const row2 = this._rows[index];
|
|
@@ -40230,7 +40750,32 @@ var TreeView = class extends Component {
|
|
|
40230
40750
|
if (from < 0) return this._rows;
|
|
40231
40751
|
return [...this._rows.slice(from + 1), ...this._rows.slice(0, from + 1)];
|
|
40232
40752
|
}
|
|
40233
|
-
/**
|
|
40753
|
+
/**
|
|
40754
|
+
* The action strip an event target sits in, if any.
|
|
40755
|
+
* @param {EventTarget|null} target Event target.
|
|
40756
|
+
* @returns {HTMLElement|null}
|
|
40757
|
+
*/
|
|
40758
|
+
_stripOf(target) {
|
|
40759
|
+
const element = target && /** @type {Node} */
|
|
40760
|
+
target.nodeType === 1 ? (
|
|
40761
|
+
/** @type {Element} */
|
|
40762
|
+
target
|
|
40763
|
+
) : null;
|
|
40764
|
+
const strip = (
|
|
40765
|
+
/** @type {HTMLElement|null} */
|
|
40766
|
+
element?.closest(".zx-tree__actions") ?? null
|
|
40767
|
+
);
|
|
40768
|
+
return strip && this.el.contains(strip) ? strip : null;
|
|
40769
|
+
}
|
|
40770
|
+
/**
|
|
40771
|
+
* What a row's actions receive: the node in the working tree, not a filtered copy.
|
|
40772
|
+
* @param {{node: TreeNode, id: unknown}|undefined} row Visible row.
|
|
40773
|
+
* @returns {TreeNode|null}
|
|
40774
|
+
*/
|
|
40775
|
+
_subject(row2) {
|
|
40776
|
+
return row2 ? this.getNode(row2.id) ?? row2.node : null;
|
|
40777
|
+
}
|
|
40778
|
+
/** @param {Element|null} element @returns {number} */
|
|
40234
40779
|
_rowIndex(element) {
|
|
40235
40780
|
return [...this.el.querySelectorAll(".zx-tree__row")].indexOf(element);
|
|
40236
40781
|
}
|
|
@@ -40266,6 +40811,9 @@ var TreeView = class extends Component {
|
|
|
40266
40811
|
/** Restores an enhanced target to the markup it had before the takeover. @returns {void} */
|
|
40267
40812
|
destroy() {
|
|
40268
40813
|
const root = this.el;
|
|
40814
|
+
for (const strip of this._strips?.splice(0) ?? []) strip?.destroy();
|
|
40815
|
+
this._rowMenu?.destroy();
|
|
40816
|
+
this._rowMenu = null;
|
|
40269
40817
|
super.destroy();
|
|
40270
40818
|
if (!this._createdRoot && root) restoreTarget(root, this._snapshot);
|
|
40271
40819
|
}
|
|
@@ -40524,7 +41072,7 @@ var Finder = class extends Component {
|
|
|
40524
41072
|
row2.append(h(
|
|
40525
41073
|
"span",
|
|
40526
41074
|
{ class: "zx-finder__chevron", ariaHidden: "true" },
|
|
40527
|
-
icon("chevron-right", { size:
|
|
41075
|
+
icon("chevron-right", { size: ICON_SIZE.chevron })
|
|
40528
41076
|
));
|
|
40529
41077
|
}
|
|
40530
41078
|
row2.toggleAttribute("data-branch", branch);
|
|
@@ -46477,6 +47025,12 @@ function normalizeInput(input) {
|
|
|
46477
47025
|
|
|
46478
47026
|
// src/components/questionnaire/questionnaire.js
|
|
46479
47027
|
var AUTO_ADVANCE_DELAY = 260;
|
|
47028
|
+
function keyHint(key) {
|
|
47029
|
+
const hint = kbd([key]);
|
|
47030
|
+
hint.classList.add("zx-questionnaire__key");
|
|
47031
|
+
hint.setAttribute("aria-hidden", "true");
|
|
47032
|
+
return hint;
|
|
47033
|
+
}
|
|
46480
47034
|
var Questionnaire = class extends Component {
|
|
46481
47035
|
static cssName = "questionnaire";
|
|
46482
47036
|
/** @type {QuestionnaireOptions & {msg: Record<string, string>}} */
|
|
@@ -47084,7 +47638,7 @@ var Questionnaire = class extends Component {
|
|
|
47084
47638
|
h("span", { class: "zx-questionnaire__label" }, choice.label),
|
|
47085
47639
|
choice.description ? h("span", { class: "zx-questionnaire__hint" }, choice.description) : null
|
|
47086
47640
|
),
|
|
47087
|
-
choice.key ?
|
|
47641
|
+
choice.key ? keyHint(choice.key) : null
|
|
47088
47642
|
)));
|
|
47089
47643
|
if (item.input) {
|
|
47090
47644
|
const inputId = `${this._uid}-freeform`;
|
|
@@ -47389,6 +47943,7 @@ export {
|
|
|
47389
47943
|
Grid,
|
|
47390
47944
|
Groupbox,
|
|
47391
47945
|
Http,
|
|
47946
|
+
ICON_SIZE,
|
|
47392
47947
|
InlineLoading,
|
|
47393
47948
|
KanbanView,
|
|
47394
47949
|
Launcher,
|
|
@@ -47476,6 +48031,7 @@ export {
|
|
|
47476
48031
|
createKanbanHistory,
|
|
47477
48032
|
createKanbanIndicator,
|
|
47478
48033
|
createKanbanProgress,
|
|
48034
|
+
dateboxFormats,
|
|
47479
48035
|
debounce,
|
|
47480
48036
|
deepMerge,
|
|
47481
48037
|
defaultDateRangePresets,
|
|
@@ -47527,6 +48083,8 @@ export {
|
|
|
47527
48083
|
joinTime,
|
|
47528
48084
|
kanbanAvatarLimit,
|
|
47529
48085
|
kanbanSearchTerms,
|
|
48086
|
+
kbd,
|
|
48087
|
+
keyLabels,
|
|
47530
48088
|
kitUrl,
|
|
47531
48089
|
layoutCalendarSpans,
|
|
47532
48090
|
layoutTimedCalendarEvents,
|
|
@@ -47568,6 +48126,7 @@ export {
|
|
|
47568
48126
|
presentationGlyph,
|
|
47569
48127
|
printf,
|
|
47570
48128
|
priorityIcon,
|
|
48129
|
+
proseAnchors,
|
|
47571
48130
|
pruneValue,
|
|
47572
48131
|
rangeNights,
|
|
47573
48132
|
rangeStateOf,
|
|
@@ -47588,6 +48147,7 @@ export {
|
|
|
47588
48147
|
resolveModuleColor,
|
|
47589
48148
|
resolveSize,
|
|
47590
48149
|
rovingTabindex,
|
|
48150
|
+
sectionHref,
|
|
47591
48151
|
serializeFilterValue,
|
|
47592
48152
|
setButtonBusy,
|
|
47593
48153
|
setLanguage,
|