@zeyos/zx 5.8.0 → 5.9.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 +93 -0
- package/dist/types/components/block-view/block-view.d.ts +3 -2
- package/dist/types/components/check-button/check-button.d.ts +10 -2
- package/dist/types/components/checklist/checklist.d.ts +28 -6
- package/dist/types/components/code-editor/code-editor.d.ts +19 -1
- package/dist/types/components/dock/dock.d.ts +2 -1
- package/dist/types/components/dropdown/dropdown.d.ts +2 -1
- package/dist/types/components/field-upload/field-upload.d.ts +6 -0
- package/dist/types/components/filter-panel/filter-panel.d.ts +6 -2
- package/dist/types/components/module-bar/module-bar.d.ts +53 -2
- package/dist/types/components/multi-value-editor/multi-value-editor.d.ts +28 -0
- package/dist/types/components/run-status/run-status.d.ts +1 -1
- package/dist/types/components/run-trace/run-trace.d.ts +8 -0
- package/dist/types/components/select/select.d.ts +18 -5
- package/dist/types/components/tabbox/tabbox.d.ts +7 -0
- package/dist/types/components/tag-picker/tag-picker.d.ts +21 -5
- package/dist/types/components/timebox/timebox.d.ts +9 -0
- package/dist/types/core/component.d.ts +4 -1
- package/dist/types/internal/focus-stops.d.ts +42 -0
- package/dist/zx-zeyos.esm.js +296 -97
- package/dist/zx-zeyos.esm.min.js +4 -4
- package/dist/zx.core.css +13 -6
- package/dist/zx.core.min.css +1 -1
- package/dist/zx.css +26 -88
- package/dist/zx.esm.js +516 -159
- package/dist/zx.esm.min.js +26 -26
- package/dist/zx.global.js +516 -159
- package/dist/zx.global.min.js +26 -26
- package/dist/zx.layered.css +26 -88
- package/dist/zx.layered.min.css +1 -1
- package/dist/zx.min.css +1 -1
- package/docs/api.json +97 -9
- package/docs/components/approval-card.md +2 -2
- package/docs/components/block-view.md +2 -1
- package/docs/components/check-button.md +3 -1
- package/docs/components/checklist.md +2 -1
- package/docs/components/code-editor.md +4 -3
- package/docs/components/composer.md +4 -0
- package/docs/components/dock.md +4 -1
- package/docs/components/dropdown.md +3 -1
- package/docs/components/field-upload.md +2 -1
- package/docs/components/modal.md +3 -0
- package/docs/components/multi-value-editor.md +5 -2
- package/docs/components/navigation-bar.md +5 -0
- package/docs/components/questionnaire.md +2 -2
- package/docs/components/run-status.md +2 -1
- package/docs/components/run-trace.md +2 -1
- package/docs/components/select.md +6 -2
- package/docs/components/tabbox.md +6 -0
- package/docs/components/tag-picker.md +3 -1
- package/docs/components/timebox.md +2 -1
- package/docs/components/tokens.md +20 -0
- package/docs/llms.md +84 -21
- package/package.json +1 -1
- package/src/components/app-sidebar/app-sidebar.js +1 -1
- package/src/components/approval-card/approval-card.css +0 -5
- package/src/components/approval-card/approval-card.js +2 -0
- package/src/components/block-view/block-view.css +0 -10
- package/src/components/block-view/block-view.js +11 -6
- package/src/components/card/card.css +3 -0
- package/src/components/card/card.js +2 -2
- package/src/components/card-view/card-view.css +5 -5
- package/src/components/card-view/card-view.js +3 -1
- package/src/components/check-button/check-button.js +5 -1
- package/src/components/checklist/checklist.js +26 -10
- package/src/components/checklist/field-adapter.js +5 -13
- package/src/components/code-editor/code-editor.js +24 -3
- package/src/components/composer/composer.css +15 -26
- package/src/components/copy/copy-input.css +3 -1
- package/src/components/dialog/dialog.js +2 -1
- package/src/components/dock/dock.css +0 -6
- package/src/components/dock/dock.js +22 -7
- package/src/components/dropdown/dropdown.js +17 -2
- package/src/components/field/field.js +2 -1
- package/src/components/field-upload/field-upload.js +15 -0
- package/src/components/filter-panel/filter-panel.js +8 -11
- package/src/components/master-panel/master-panel.js +3 -1
- package/src/components/modal/modal.css +2 -11
- package/src/components/modal/modal.js +5 -2
- package/src/components/module-bar/module-bar.js +110 -26
- package/src/components/multi-value-editor/field-adapter.js +8 -23
- package/src/components/multi-value-editor/multi-value-editor.js +63 -5
- package/src/components/navigation-bar/navigation-bar.css +0 -4
- package/src/components/navigation-bar/navigation-bar.js +11 -2
- package/src/components/questionnaire/questionnaire.css +0 -14
- package/src/components/questionnaire/questionnaire.js +4 -2
- package/src/components/run-status/run-status.css +0 -7
- package/src/components/run-status/run-status.js +3 -1
- package/src/components/run-trace/run-trace.css +0 -5
- package/src/components/run-trace/run-trace.js +23 -2
- package/src/components/select/select.js +43 -5
- package/src/components/skeleton/skeleton.js +16 -3
- package/src/components/surface/surface.css +0 -6
- package/src/components/surface/surface.js +1 -1
- package/src/components/tabbox/tabbox.css +0 -6
- package/src/components/tabbox/tabbox.js +20 -2
- package/src/components/table/table.js +5 -0
- package/src/components/tag-picker/tag-picker.js +35 -6
- package/src/components/timebox/timebox.js +17 -1
- package/src/components/view-settings/view-settings.js +1 -1
- package/src/core/component.js +22 -2
- package/src/core/date.js +1 -4
- package/src/core/drag-axis.js +22 -6
- package/src/internal/focus-stops.js +108 -0
- package/src/zeyos/connect.js +7 -3
- package/src/zeyos/icons.js +7 -2
- package/styles/base.css +27 -3
- package/styles/tokens/dark.css +2 -2
- package/styles/tokens/semantic.css +2 -2
package/dist/zx.esm.js
CHANGED
|
@@ -1775,7 +1775,10 @@ var Component = class extends EventTarget {
|
|
|
1775
1775
|
return componentEvent;
|
|
1776
1776
|
}
|
|
1777
1777
|
/**
|
|
1778
|
-
* Adds an automatically cleaned-up DOM event listener.
|
|
1778
|
+
* Adds an automatically cleaned-up DOM event listener. It goes when the component is destroyed;
|
|
1779
|
+
* a `signal` in the options shortens its life further, for a listener that belongs to one
|
|
1780
|
+
* rendering of a part — it then goes when that signal aborts or the component is destroyed,
|
|
1781
|
+
* whichever comes first.
|
|
1779
1782
|
* @param {EventTarget} element DOM event target.
|
|
1780
1783
|
* @param {string} type Event name.
|
|
1781
1784
|
* @param {EventListenerOrEventListenerObject} fn Listener.
|
|
@@ -1784,7 +1787,23 @@ var Component = class extends EventTarget {
|
|
|
1784
1787
|
*/
|
|
1785
1788
|
listen(element, type, fn, opts = {}) {
|
|
1786
1789
|
const options = typeof opts === "boolean" ? { capture: opts } : { ...opts };
|
|
1787
|
-
|
|
1790
|
+
const shorter = options.signal;
|
|
1791
|
+
if (shorter?.aborted || this.#abort.signal.aborted) return this;
|
|
1792
|
+
if (!shorter || shorter === this.#abort.signal) {
|
|
1793
|
+
element.addEventListener(type, fn, { ...options, signal: this.#abort.signal });
|
|
1794
|
+
return this;
|
|
1795
|
+
}
|
|
1796
|
+
const link = new AbortController();
|
|
1797
|
+
element.addEventListener(type, fn, { ...options, signal: link.signal });
|
|
1798
|
+
if (options.once) {
|
|
1799
|
+
element.addEventListener(
|
|
1800
|
+
type,
|
|
1801
|
+
() => link.abort(),
|
|
1802
|
+
{ once: true, capture: Boolean(options.capture), signal: link.signal }
|
|
1803
|
+
);
|
|
1804
|
+
}
|
|
1805
|
+
shorter.addEventListener("abort", () => link.abort(), { once: true, signal: link.signal });
|
|
1806
|
+
this.#abort.signal.addEventListener("abort", () => link.abort(), { once: true, signal: link.signal });
|
|
1788
1807
|
return this;
|
|
1789
1808
|
}
|
|
1790
1809
|
/**
|
|
@@ -2285,7 +2304,7 @@ function validateAdapter(adapter) {
|
|
|
2285
2304
|
);
|
|
2286
2305
|
}
|
|
2287
2306
|
function errorAdapter(message4, id) {
|
|
2288
|
-
const el = h("div", { class: "zx-field__error-control", id, role: "alert", tabIndex: -1 }, message4);
|
|
2307
|
+
const el = h("div", { class: "zx-field__error-control", id, role: "alert", tabIndex: -1, dataset: { zxFocus: "container" } }, message4);
|
|
2289
2308
|
return {
|
|
2290
2309
|
el,
|
|
2291
2310
|
get: () => null,
|
|
@@ -2656,25 +2675,36 @@ var Checklist = class extends Component {
|
|
|
2656
2675
|
* and checked as soon as items carrying them arrive — through `setItems()` or the `load`
|
|
2657
2676
|
* loader — so a value set before the items load is not lost.
|
|
2658
2677
|
* @param {Iterable<unknown>|unknown[]} ids Checked item IDs.
|
|
2678
|
+
* @param {ChecklistSetOptions} [options={}] Set `silent` to suppress `change`.
|
|
2659
2679
|
* @returns {this}
|
|
2660
2680
|
* @fires Checklist#change
|
|
2661
2681
|
*/
|
|
2662
|
-
setValues(ids) {
|
|
2682
|
+
setValues(ids, { silent = false } = {}) {
|
|
2663
2683
|
const requested = new Set(ids == null ? [] : Array.from(ids));
|
|
2664
2684
|
const known = new Set(this._items.map((item) => this._itemValue(item)));
|
|
2665
2685
|
const next = new Set([...known].filter((value) => requested.has(value)));
|
|
2666
2686
|
const missing = [...requested].filter((value) => !known.has(value));
|
|
2667
|
-
this._replaceChecked(next, missing.length || this._items.length === 0 ? missing : null);
|
|
2687
|
+
this._replaceChecked(next, missing.length || this._items.length === 0 ? missing : null, silent);
|
|
2668
2688
|
return this;
|
|
2669
2689
|
}
|
|
2670
|
-
/**
|
|
2671
|
-
|
|
2672
|
-
|
|
2690
|
+
/**
|
|
2691
|
+
* Checks every item.
|
|
2692
|
+
* @param {ChecklistSetOptions} [options={}] Set `silent` to suppress `change`.
|
|
2693
|
+
* @returns {this}
|
|
2694
|
+
* @fires Checklist#change
|
|
2695
|
+
*/
|
|
2696
|
+
checkAll({ silent = false } = {}) {
|
|
2697
|
+
this._replaceChecked(new Set(this._items.map((item) => this._itemValue(item))), null, silent);
|
|
2673
2698
|
return this;
|
|
2674
2699
|
}
|
|
2675
|
-
/**
|
|
2676
|
-
|
|
2677
|
-
|
|
2700
|
+
/**
|
|
2701
|
+
* Unchecks every item.
|
|
2702
|
+
* @param {ChecklistSetOptions} [options={}] Set `silent` to suppress `change`.
|
|
2703
|
+
* @returns {this}
|
|
2704
|
+
* @fires Checklist#change
|
|
2705
|
+
*/
|
|
2706
|
+
uncheckAll({ silent = false } = {}) {
|
|
2707
|
+
this._replaceChecked(/* @__PURE__ */ new Set(), null, silent);
|
|
2678
2708
|
return this;
|
|
2679
2709
|
}
|
|
2680
2710
|
/**
|
|
@@ -2790,9 +2820,10 @@ var Checklist = class extends Component {
|
|
|
2790
2820
|
* @param {Set<unknown>} next
|
|
2791
2821
|
* @param {unknown[]|null} pending Requested IDs no item carries yet, or null when no request waits
|
|
2792
2822
|
* for items; an empty array is a request made before any item existed.
|
|
2823
|
+
* @param {boolean} [silent=false] Whether to leave out the `change` event.
|
|
2793
2824
|
* @returns {void}
|
|
2794
2825
|
*/
|
|
2795
|
-
_replaceChecked(next, pending) {
|
|
2826
|
+
_replaceChecked(next, pending, silent = false) {
|
|
2796
2827
|
const nextPending = pending;
|
|
2797
2828
|
const pendingChanged = !setsEqual(new Set(this._pending ?? []), new Set(nextPending ?? []));
|
|
2798
2829
|
const unchanged = setsEqual(this._checked, next) && !pendingChanged;
|
|
@@ -2800,7 +2831,7 @@ var Checklist = class extends Component {
|
|
|
2800
2831
|
if (unchanged) return;
|
|
2801
2832
|
this._checked = next;
|
|
2802
2833
|
this._renderItems();
|
|
2803
|
-
this.emit("change", { values: this.getValues() });
|
|
2834
|
+
if (!silent) this.emit("change", { values: this.getValues() });
|
|
2804
2835
|
}
|
|
2805
2836
|
/** @param {ChecklistItem} item @returns {unknown} */
|
|
2806
2837
|
_itemValue(item) {
|
|
@@ -2837,22 +2868,14 @@ function setsEqual(left, right) {
|
|
|
2837
2868
|
function registerChecklistFieldAdapter() {
|
|
2838
2869
|
Field.register("checklist", (field, options) => {
|
|
2839
2870
|
const checklist = field.own(new Checklist(null, { hideLabel: true, ...options.props ?? {} }));
|
|
2840
|
-
let setting = false;
|
|
2841
2871
|
field.listen(checklist.el, "change", (event) => event.stopImmediatePropagation());
|
|
2842
|
-
checklist.on("change", (event) => {
|
|
2843
|
-
if (!setting) field.emit("change", { value: event.detail.values });
|
|
2844
|
-
});
|
|
2872
|
+
checklist.on("change", (event) => field.emit("change", { value: event.detail.values }));
|
|
2845
2873
|
return {
|
|
2846
2874
|
el: checklist.el,
|
|
2847
2875
|
get: () => checklist.getValues(),
|
|
2848
2876
|
set: (value) => {
|
|
2849
|
-
|
|
2850
|
-
|
|
2851
|
-
if (Array.isArray(value)) checklist.setValues(value);
|
|
2852
|
-
else checklist.uncheckAll();
|
|
2853
|
-
} finally {
|
|
2854
|
-
setting = false;
|
|
2855
|
-
}
|
|
2877
|
+
if (Array.isArray(value)) checklist.setValues(value, { silent: true });
|
|
2878
|
+
else checklist.uncheckAll({ silent: true });
|
|
2856
2879
|
},
|
|
2857
2880
|
focus: () => {
|
|
2858
2881
|
const search = checklist.el.querySelector(".zx-checklist__search:not([hidden]):not([disabled])");
|
|
@@ -2882,6 +2905,7 @@ var CodeEditor = class extends Component {
|
|
|
2882
2905
|
wrap: "off",
|
|
2883
2906
|
spellcheck: false,
|
|
2884
2907
|
readOnly: false,
|
|
2908
|
+
readonly: false,
|
|
2885
2909
|
disabled: false,
|
|
2886
2910
|
status: true
|
|
2887
2911
|
};
|
|
@@ -2896,6 +2920,7 @@ var CodeEditor = class extends Component {
|
|
|
2896
2920
|
this._initialChildren = this._createdRoot ? [] : [...root.childNodes];
|
|
2897
2921
|
this._initialAttributes = new Map(["data-language", "data-readonly", "data-disabled", "data-state"].map((name2) => [name2, root.getAttribute(name2)]));
|
|
2898
2922
|
this._language = normalizeLanguage(this.options.language);
|
|
2923
|
+
const readOnly = Boolean(this.options.readOnly || this.options.readonly);
|
|
2899
2924
|
this._languageLabel = h("span", { class: "zx-code-editor__language" }, this._language);
|
|
2900
2925
|
this._position = h("span", { class: "zx-code-editor__position" });
|
|
2901
2926
|
this._header = h(
|
|
@@ -2913,7 +2938,7 @@ var CodeEditor = class extends Component {
|
|
|
2913
2938
|
rows: normalizeRows(this.options.rows),
|
|
2914
2939
|
wrap: normalizeWrap(this.options.wrap),
|
|
2915
2940
|
spellcheck: Boolean(this.options.spellcheck),
|
|
2916
|
-
readOnly
|
|
2941
|
+
readOnly,
|
|
2917
2942
|
disabled: Boolean(this.options.disabled),
|
|
2918
2943
|
autocomplete: "off",
|
|
2919
2944
|
autocapitalize: "off"
|
|
@@ -2928,7 +2953,7 @@ var CodeEditor = class extends Component {
|
|
|
2928
2953
|
this._committedValue = this._input.value;
|
|
2929
2954
|
this._indentEditing = false;
|
|
2930
2955
|
root.dataset.language = this._language;
|
|
2931
|
-
root.dataset.readonly = String(
|
|
2956
|
+
root.dataset.readonly = String(readOnly);
|
|
2932
2957
|
root.dataset.disabled = String(Boolean(this.options.disabled));
|
|
2933
2958
|
root.replaceChildren(this._header, this._input, this._highlight);
|
|
2934
2959
|
this._tabReleased = false;
|
|
@@ -3041,12 +3066,26 @@ var CodeEditor = class extends Component {
|
|
|
3041
3066
|
this.el.dataset.disabled = "true";
|
|
3042
3067
|
return this;
|
|
3043
3068
|
}
|
|
3044
|
-
/**
|
|
3069
|
+
/**
|
|
3070
|
+
* Makes the text selectable but not editable, or editable again; reflected as `data-readonly` on
|
|
3071
|
+
* the root.
|
|
3072
|
+
* @param {boolean} value Read-only state.
|
|
3073
|
+
* @returns {this}
|
|
3074
|
+
*/
|
|
3045
3075
|
setReadOnly(value) {
|
|
3046
3076
|
this._input.readOnly = Boolean(value);
|
|
3047
3077
|
this.el.dataset.readonly = String(Boolean(value));
|
|
3048
3078
|
return this;
|
|
3049
3079
|
}
|
|
3080
|
+
/**
|
|
3081
|
+
* `setReadOnly()` under the spelling every other Zx control uses (`Field#setReadonly()`,
|
|
3082
|
+
* `NumberField#setReadonly()`, `TagPicker#setReadonly()`); the two are interchangeable.
|
|
3083
|
+
* @param {boolean} value Read-only state.
|
|
3084
|
+
* @returns {this}
|
|
3085
|
+
*/
|
|
3086
|
+
setReadonly(value) {
|
|
3087
|
+
return this.setReadOnly(value);
|
|
3088
|
+
}
|
|
3050
3089
|
/** @param {KeyboardEvent} event @returns {void} */
|
|
3051
3090
|
_handleKeydown(event) {
|
|
3052
3091
|
if (event.isComposing || MODIFIER_KEYS.has(event.key)) return;
|
|
@@ -3303,7 +3342,7 @@ function parseDate(str, fmt) {
|
|
|
3303
3342
|
let pattern = "^";
|
|
3304
3343
|
let cursor = 0;
|
|
3305
3344
|
for (const match of String(fmt).matchAll(TOKEN_PATTERN)) {
|
|
3306
|
-
pattern +=
|
|
3345
|
+
pattern += escapeRegExp(String(fmt).slice(cursor, match.index));
|
|
3307
3346
|
const token = match[0];
|
|
3308
3347
|
const tokenPattern = numericPattern(token);
|
|
3309
3348
|
if (tokenPattern === null) return null;
|
|
@@ -3311,7 +3350,7 @@ function parseDate(str, fmt) {
|
|
|
3311
3350
|
fields.push(token);
|
|
3312
3351
|
cursor = match.index + token.length;
|
|
3313
3352
|
}
|
|
3314
|
-
pattern +=
|
|
3353
|
+
pattern += escapeRegExp(String(fmt).slice(cursor)) + "$";
|
|
3315
3354
|
const matched = new RegExp(pattern).exec(String(str));
|
|
3316
3355
|
if (!matched) return null;
|
|
3317
3356
|
const values = /* @__PURE__ */ Object.create(null);
|
|
@@ -3428,9 +3467,6 @@ function yearFromTwoDigits(year) {
|
|
|
3428
3467
|
if (year === void 0) return void 0;
|
|
3429
3468
|
return year >= 69 ? 1900 + year : 2e3 + year;
|
|
3430
3469
|
}
|
|
3431
|
-
function escapeRegExp2(value) {
|
|
3432
|
-
return value.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
3433
|
-
}
|
|
3434
3470
|
|
|
3435
3471
|
// src/core/fontawesome.js
|
|
3436
3472
|
var faStyles = Object.freeze({
|
|
@@ -7103,6 +7139,18 @@ var FieldUpload = class extends Component {
|
|
|
7103
7139
|
this.el.dataset.disabled = String(this._disabled);
|
|
7104
7140
|
return this;
|
|
7105
7141
|
}
|
|
7142
|
+
/** Disables file selection and dropping; the same as `setDisabled(true)`. @returns {this} */
|
|
7143
|
+
disable() {
|
|
7144
|
+
return this.setDisabled(true);
|
|
7145
|
+
}
|
|
7146
|
+
/** Enables file selection and dropping; the same as `setDisabled(false)`. @returns {this} */
|
|
7147
|
+
enable() {
|
|
7148
|
+
return this.setDisabled(false);
|
|
7149
|
+
}
|
|
7150
|
+
/** Whether file selection and dropping are disabled. @returns {boolean} */
|
|
7151
|
+
isDisabled() {
|
|
7152
|
+
return this._disabled;
|
|
7153
|
+
}
|
|
7106
7154
|
/** @param {FileList|File[]|ArrayLike<File>} files @returns {void} */
|
|
7107
7155
|
_selectFiles(files) {
|
|
7108
7156
|
if (!this._setFiles(files)) return;
|
|
@@ -7379,7 +7427,7 @@ var PARTS = Object.freeze({
|
|
|
7379
7427
|
var MultiValueEditor = class extends Component {
|
|
7380
7428
|
static cssName = "multi-value-editor";
|
|
7381
7429
|
/** @type {MultiValueEditorOptions} */
|
|
7382
|
-
static defaults = { values: [], options: null, addLabel: null, reorder: "both" };
|
|
7430
|
+
static defaults = { values: [], options: null, addLabel: null, reorder: "both", disabled: false };
|
|
7383
7431
|
/** @returns {HTMLElement} */
|
|
7384
7432
|
render() {
|
|
7385
7433
|
const root = (
|
|
@@ -7390,6 +7438,8 @@ var MultiValueEditor = class extends Component {
|
|
|
7390
7438
|
this._values = Array.isArray(this.options.values) ? this.options.values.map(String) : [];
|
|
7391
7439
|
this._ownedNodes = [];
|
|
7392
7440
|
this._initialState = root.getAttribute("data-state");
|
|
7441
|
+
this._initialAriaDisabled = root.getAttribute("aria-disabled");
|
|
7442
|
+
this._disabled = Boolean(this.options.disabled);
|
|
7393
7443
|
this._dragIndex = -1;
|
|
7394
7444
|
this._armed = null;
|
|
7395
7445
|
this._rows = h("div", { class: "zx-multi-value-editor__rows" });
|
|
@@ -7414,6 +7464,7 @@ var MultiValueEditor = class extends Component {
|
|
|
7414
7464
|
this.listen(document, "pointercancel", () => this._disarm());
|
|
7415
7465
|
}
|
|
7416
7466
|
this._renderRows();
|
|
7467
|
+
this._syncDisabled();
|
|
7417
7468
|
return root;
|
|
7418
7469
|
}
|
|
7419
7470
|
/**
|
|
@@ -7435,6 +7486,46 @@ var MultiValueEditor = class extends Component {
|
|
|
7435
7486
|
if (!silent) this.emit("change", { values: this.getValues() });
|
|
7436
7487
|
return this;
|
|
7437
7488
|
}
|
|
7489
|
+
/**
|
|
7490
|
+
* Disables or enables the editor. Disabled, every value input or select, drag handle, move and
|
|
7491
|
+
* remove button and the add button is disabled, the root carries `aria-disabled="true"`, and
|
|
7492
|
+
* neither a pointer nor the handle's keys reorder anything. `setValues()` still works, and rows
|
|
7493
|
+
* it renders stay disabled.
|
|
7494
|
+
* @param {boolean} disabled Disabled state.
|
|
7495
|
+
* @returns {this}
|
|
7496
|
+
*/
|
|
7497
|
+
setDisabled(disabled) {
|
|
7498
|
+
this._disabled = Boolean(disabled);
|
|
7499
|
+
this._syncDisabled();
|
|
7500
|
+
return this;
|
|
7501
|
+
}
|
|
7502
|
+
/** Disables the editor; see `setDisabled()`. @returns {this} */
|
|
7503
|
+
disable() {
|
|
7504
|
+
return this.setDisabled(true);
|
|
7505
|
+
}
|
|
7506
|
+
/** Enables the editor. @returns {this} */
|
|
7507
|
+
enable() {
|
|
7508
|
+
return this.setDisabled(false);
|
|
7509
|
+
}
|
|
7510
|
+
/** Whether the editor is disabled. @returns {boolean} */
|
|
7511
|
+
isDisabled() {
|
|
7512
|
+
return this._disabled;
|
|
7513
|
+
}
|
|
7514
|
+
/**
|
|
7515
|
+
* Applies the disabled state to the controls in place rather than re-rendering them, so a value
|
|
7516
|
+
* typed into a row and not yet committed survives.
|
|
7517
|
+
* @returns {void}
|
|
7518
|
+
*/
|
|
7519
|
+
_syncDisabled() {
|
|
7520
|
+
if (this._disabled) {
|
|
7521
|
+
this.el.setAttribute("aria-disabled", "true");
|
|
7522
|
+
this._disarm();
|
|
7523
|
+
} else this.el.removeAttribute("aria-disabled");
|
|
7524
|
+
this._add.disabled = this._disabled;
|
|
7525
|
+
for (const control of this._rows.querySelectorAll("input, select, button")) {
|
|
7526
|
+
control.disabled = this._disabled;
|
|
7527
|
+
}
|
|
7528
|
+
}
|
|
7438
7529
|
/** @returns {{drag: boolean, buttons: boolean}} */
|
|
7439
7530
|
_reorder() {
|
|
7440
7531
|
return REORDER[this.options.reorder] ?? REORDER.both;
|
|
@@ -7454,6 +7545,7 @@ var MultiValueEditor = class extends Component {
|
|
|
7454
7545
|
const control = useSelect ? h("select", {
|
|
7455
7546
|
class: "zx-multi-value-editor__value",
|
|
7456
7547
|
ariaLabel: this.msg("multiValueEditor.value", index + 1),
|
|
7548
|
+
disabled: this._disabled,
|
|
7457
7549
|
dataset: { index }
|
|
7458
7550
|
}, entries.map(([optionValue, label]) => h("option", {
|
|
7459
7551
|
value: optionValue,
|
|
@@ -7463,6 +7555,7 @@ var MultiValueEditor = class extends Component {
|
|
|
7463
7555
|
type: "text",
|
|
7464
7556
|
value,
|
|
7465
7557
|
ariaLabel: this.msg("multiValueEditor.value", index + 1),
|
|
7558
|
+
disabled: this._disabled,
|
|
7466
7559
|
dataset: { index }
|
|
7467
7560
|
});
|
|
7468
7561
|
return h(
|
|
@@ -7472,6 +7565,7 @@ var MultiValueEditor = class extends Component {
|
|
|
7472
7565
|
class: "zx-multi-value-editor__handle",
|
|
7473
7566
|
type: "button",
|
|
7474
7567
|
ariaLabel: this.msg("multiValueEditor.reorder", index + 1),
|
|
7568
|
+
disabled: this._disabled,
|
|
7475
7569
|
dataset: { action: "grab", index }
|
|
7476
7570
|
}, icon("drag", { size: 12 })) : null,
|
|
7477
7571
|
control,
|
|
@@ -7485,6 +7579,7 @@ var MultiValueEditor = class extends Component {
|
|
|
7485
7579
|
// control that disables itself under the reader's finger drops focus to the document.
|
|
7486
7580
|
ariaDisabled: String(index === 0),
|
|
7487
7581
|
ariaLabel: this.msg("multiValueEditor.moveUp", index + 1),
|
|
7582
|
+
disabled: this._disabled,
|
|
7488
7583
|
dataset: { action: "up", index }
|
|
7489
7584
|
}, icon("chevron-up", { size: ICON_SIZE.chevron })) : null,
|
|
7490
7585
|
buttons ? h("button", {
|
|
@@ -7492,12 +7587,14 @@ var MultiValueEditor = class extends Component {
|
|
|
7492
7587
|
type: "button",
|
|
7493
7588
|
ariaDisabled: String(index === last),
|
|
7494
7589
|
ariaLabel: this.msg("multiValueEditor.moveDown", index + 1),
|
|
7590
|
+
disabled: this._disabled,
|
|
7495
7591
|
dataset: { action: "down", index }
|
|
7496
7592
|
}, icon("chevron-down", { size: ICON_SIZE.chevron })) : null,
|
|
7497
7593
|
h("button", {
|
|
7498
7594
|
class: "zx-btn",
|
|
7499
7595
|
type: "button",
|
|
7500
7596
|
ariaLabel: this.msg("multiValueEditor.remove", index + 1),
|
|
7597
|
+
disabled: this._disabled,
|
|
7501
7598
|
dataset: { action: "remove", index }
|
|
7502
7599
|
}, icon("x", { size: ICON_SIZE.dismiss }))
|
|
7503
7600
|
)
|
|
@@ -7512,7 +7609,7 @@ var MultiValueEditor = class extends Component {
|
|
|
7512
7609
|
/** @param {MouseEvent} event @returns {void} */
|
|
7513
7610
|
_handleClick(event) {
|
|
7514
7611
|
const button2 = event.target instanceof Element ? event.target.closest("[data-action]") : null;
|
|
7515
|
-
if (!button2 || !this.el.contains(button2)) return;
|
|
7612
|
+
if (this._disabled || !button2 || !this.el.contains(button2)) return;
|
|
7516
7613
|
if (button2.getAttribute("aria-disabled") === "true") return;
|
|
7517
7614
|
const action = button2.dataset.action;
|
|
7518
7615
|
const index = Number(button2.dataset.index);
|
|
@@ -7546,7 +7643,7 @@ var MultiValueEditor = class extends Component {
|
|
|
7546
7643
|
*/
|
|
7547
7644
|
_handleKeydown(event) {
|
|
7548
7645
|
const handle = event.target instanceof Element ? event.target.closest(".zx-multi-value-editor__handle") : null;
|
|
7549
|
-
if (!handle) return;
|
|
7646
|
+
if (!handle || this._disabled) return;
|
|
7550
7647
|
const index = Number(handle.dataset.index);
|
|
7551
7648
|
const target = event.key === "ArrowUp" ? index - 1 : event.key === "ArrowDown" ? index + 1 : event.key === "Home" ? 0 : event.key === "End" ? this._values.length - 1 : -1;
|
|
7552
7649
|
if (target < 0 || target >= this._values.length) return;
|
|
@@ -7562,7 +7659,7 @@ var MultiValueEditor = class extends Component {
|
|
|
7562
7659
|
_handlePointerDown(event) {
|
|
7563
7660
|
const handle = event.target instanceof Element ? event.target.closest(".zx-multi-value-editor__handle") : null;
|
|
7564
7661
|
this._disarm();
|
|
7565
|
-
if (!handle || handle.disabled) return;
|
|
7662
|
+
if (!handle || handle.disabled || this._disabled) return;
|
|
7566
7663
|
const row2 = (
|
|
7567
7664
|
/** @type {HTMLElement|null} */
|
|
7568
7665
|
handle.closest(".zx-multi-value-editor__row")
|
|
@@ -7661,7 +7758,7 @@ var MultiValueEditor = class extends Component {
|
|
|
7661
7758
|
*/
|
|
7662
7759
|
_move(from, to, part) {
|
|
7663
7760
|
const size2 = this._values.length;
|
|
7664
|
-
if (from === to || from < 0 || to < 0 || from >= size2 || to >= size2) return false;
|
|
7761
|
+
if (this._disabled || from === to || from < 0 || to < 0 || from >= size2 || to >= size2) return false;
|
|
7665
7762
|
const [value] = this._values.splice(from, 1);
|
|
7666
7763
|
this._values.splice(to, 0, value);
|
|
7667
7764
|
this._renderRows(to, part);
|
|
@@ -7676,6 +7773,8 @@ var MultiValueEditor = class extends Component {
|
|
|
7676
7773
|
destroy() {
|
|
7677
7774
|
if (this._initialState === null) this.el?.removeAttribute("data-state");
|
|
7678
7775
|
else this.el?.setAttribute("data-state", this._initialState);
|
|
7776
|
+
if (this._initialAriaDisabled === null) this.el?.removeAttribute("aria-disabled");
|
|
7777
|
+
else this.el?.setAttribute("aria-disabled", this._initialAriaDisabled);
|
|
7679
7778
|
for (const node of this._ownedNodes ?? []) node.remove();
|
|
7680
7779
|
super.destroy();
|
|
7681
7780
|
}
|
|
@@ -7695,33 +7794,19 @@ function registerMultiValueEditorFieldAdapter() {
|
|
|
7695
7794
|
...options.props ?? {},
|
|
7696
7795
|
values: Array.isArray(options.value) ? options.value : []
|
|
7697
7796
|
}));
|
|
7698
|
-
const originalDisabled = /* @__PURE__ */ new WeakMap();
|
|
7699
|
-
let disabled = false;
|
|
7700
|
-
const syncDisabled = () => {
|
|
7701
|
-
editor.el.setAttribute("aria-disabled", String(disabled));
|
|
7702
|
-
for (const control of editor.el.querySelectorAll("input, button, select, textarea")) {
|
|
7703
|
-
if (disabled) {
|
|
7704
|
-
if (!originalDisabled.has(control)) originalDisabled.set(control, Boolean(control.disabled));
|
|
7705
|
-
control.disabled = true;
|
|
7706
|
-
} else if (originalDisabled.has(control)) {
|
|
7707
|
-
control.disabled = originalDisabled.get(control);
|
|
7708
|
-
originalDisabled.delete(control);
|
|
7709
|
-
}
|
|
7710
|
-
}
|
|
7711
|
-
};
|
|
7712
7797
|
field.listen(editor.el, "change", (event) => event.stopImmediatePropagation());
|
|
7713
7798
|
editor.on("change", (event) => field.emit("change", { value: event.detail.values }));
|
|
7714
7799
|
return {
|
|
7715
7800
|
el: editor.el,
|
|
7716
7801
|
get: () => editor.getValues(),
|
|
7717
|
-
|
|
7718
|
-
|
|
7719
|
-
|
|
7720
|
-
|
|
7721
|
-
|
|
7802
|
+
// Rows the editor renders while disabled are rendered disabled, so a value set on a
|
|
7803
|
+
// disabled field needs nothing more.
|
|
7804
|
+
set: (value) => editor.setValues(Array.isArray(value) ? value : [], { silent: true }),
|
|
7805
|
+
// The first value, else the first control: a selector list matches in document order, which
|
|
7806
|
+
// would put the drag handle ahead of the value it belongs to.
|
|
7807
|
+
focus: () => (editor.el.querySelector(".zx-multi-value-editor__value:not([disabled])") ?? editor.el.querySelector("button:not([disabled])"))?.focus(),
|
|
7722
7808
|
setDisabled: (value) => {
|
|
7723
|
-
|
|
7724
|
-
syncDisabled();
|
|
7809
|
+
editor.setDisabled(value);
|
|
7725
7810
|
}
|
|
7726
7811
|
};
|
|
7727
7812
|
});
|
|
@@ -9503,6 +9588,7 @@ var Select = class _Select extends Component {
|
|
|
9503
9588
|
this._loading = false;
|
|
9504
9589
|
this._requestSequence = 0;
|
|
9505
9590
|
this._queryTimer = null;
|
|
9591
|
+
this._queryController = null;
|
|
9506
9592
|
this._position = null;
|
|
9507
9593
|
this._createdRoot = false;
|
|
9508
9594
|
this._root = null;
|
|
@@ -10031,9 +10117,10 @@ var Select = class _Select extends Component {
|
|
|
10031
10117
|
* `true` for public, or a group ID — so the control binds straight to the record field.
|
|
10032
10118
|
*
|
|
10033
10119
|
* @param {Element|string|null} target Component target.
|
|
10034
|
-
* @param {SelectOptions & {groups?: SelectItem[]|
|
|
10120
|
+
* @param {SelectOptions & {groups?: SelectItem[]|SelectFilter}} [options={}]
|
|
10035
10121
|
* Select overrides other than the fixed choices; `groups` holds the shareable groups, either as
|
|
10036
|
-
* an array (filtered locally) or as a loader function (queried remotely
|
|
10122
|
+
* an array (filtered locally) or as a loader function (queried remotely, and handed the same
|
|
10123
|
+
* `{signal}` as any `filter` function).
|
|
10037
10124
|
* @returns {Select}
|
|
10038
10125
|
*/
|
|
10039
10126
|
static permission(target, options = {}) {
|
|
@@ -10318,6 +10405,8 @@ var Select = class _Select extends Component {
|
|
|
10318
10405
|
if (this._queryTimer !== null) clearTimeout(this._queryTimer);
|
|
10319
10406
|
this._requestSequence += 1;
|
|
10320
10407
|
const sequence = this._requestSequence;
|
|
10408
|
+
this._abortQuery();
|
|
10409
|
+
if (sequence !== this._requestSequence) return;
|
|
10321
10410
|
this._visibleFixed = this._matchFixed(query);
|
|
10322
10411
|
if (query.length < Math.max(0, Number(this.options.minQuery) || 0)) {
|
|
10323
10412
|
this._setLoading(false);
|
|
@@ -10337,9 +10426,15 @@ var Select = class _Select extends Component {
|
|
|
10337
10426
|
/** @param {string} query @param {number} sequence @returns {Promise<void>} */
|
|
10338
10427
|
async _runAsyncQuery(query, sequence) {
|
|
10339
10428
|
if (sequence !== this._requestSequence || typeof this.options.filter !== "function") return;
|
|
10429
|
+
const controller = new AbortController();
|
|
10430
|
+
this._queryController = controller;
|
|
10340
10431
|
this.emit("query", { query });
|
|
10432
|
+
if (sequence !== this._requestSequence || controller.signal.aborted) {
|
|
10433
|
+
if (this._queryController === controller) this._queryController = null;
|
|
10434
|
+
return;
|
|
10435
|
+
}
|
|
10341
10436
|
try {
|
|
10342
|
-
const result = await this.options.filter(query);
|
|
10437
|
+
const result = await this.options.filter(query, { signal: controller.signal });
|
|
10343
10438
|
if (sequence !== this._requestSequence || !this._open) return;
|
|
10344
10439
|
this._items = Array.isArray(result) ? result.slice() : [];
|
|
10345
10440
|
this._visibleItems = this._items.slice();
|
|
@@ -10355,6 +10450,8 @@ var Select = class _Select extends Component {
|
|
|
10355
10450
|
this._setLoading(false);
|
|
10356
10451
|
this._renderOptions();
|
|
10357
10452
|
this._position?.update();
|
|
10453
|
+
} finally {
|
|
10454
|
+
if (this._queryController === controller) this._queryController = null;
|
|
10358
10455
|
}
|
|
10359
10456
|
}
|
|
10360
10457
|
/** @returns {void} */
|
|
@@ -10362,6 +10459,17 @@ var Select = class _Select extends Component {
|
|
|
10362
10459
|
if (this._queryTimer !== null) clearTimeout(this._queryTimer);
|
|
10363
10460
|
this._queryTimer = null;
|
|
10364
10461
|
this._requestSequence += 1;
|
|
10462
|
+
this._abortQuery();
|
|
10463
|
+
}
|
|
10464
|
+
/**
|
|
10465
|
+
* Aborts the signal handed to the filter for the request in flight. Callers move the sequence on
|
|
10466
|
+
* first, so whatever the aborted request resolves or rejects with is already stale.
|
|
10467
|
+
* @returns {void}
|
|
10468
|
+
*/
|
|
10469
|
+
_abortQuery() {
|
|
10470
|
+
const controller = this._queryController;
|
|
10471
|
+
this._queryController = null;
|
|
10472
|
+
controller?.abort();
|
|
10365
10473
|
}
|
|
10366
10474
|
/** @param {boolean} loading @returns {void} */
|
|
10367
10475
|
_setLoading(loading) {
|
|
@@ -11102,6 +11210,7 @@ var TagPicker = class extends Component {
|
|
|
11102
11210
|
this._loading = false;
|
|
11103
11211
|
this._requestSequence = 0;
|
|
11104
11212
|
this._queryTimer = null;
|
|
11213
|
+
this._queryController = null;
|
|
11105
11214
|
this._position = null;
|
|
11106
11215
|
this._activeId = null;
|
|
11107
11216
|
this._createdRoot = this.el === null;
|
|
@@ -11662,7 +11771,7 @@ var TagPicker = class extends Component {
|
|
|
11662
11771
|
}
|
|
11663
11772
|
/** @param {string} query @returns {void} */
|
|
11664
11773
|
_scheduleAsyncQuery(query) {
|
|
11665
|
-
this._cancelQuery();
|
|
11774
|
+
if (this._cancelQuery() !== this._requestSequence) return;
|
|
11666
11775
|
const text6 = String(query ?? "");
|
|
11667
11776
|
if (text6.length < Number(this.options.minQuery ?? 0)) {
|
|
11668
11777
|
this._visible = [];
|
|
@@ -11683,10 +11792,16 @@ var TagPicker = class extends Component {
|
|
|
11683
11792
|
const sequence = this._requestSequence + 1;
|
|
11684
11793
|
this._requestSequence = sequence;
|
|
11685
11794
|
this._setLoading(true);
|
|
11795
|
+
const controller = new AbortController();
|
|
11796
|
+
this._queryController = controller;
|
|
11686
11797
|
this.emit("query", { query });
|
|
11798
|
+
if (sequence !== this._requestSequence || controller.signal.aborted) {
|
|
11799
|
+
if (this._queryController === controller) this._queryController = null;
|
|
11800
|
+
return;
|
|
11801
|
+
}
|
|
11687
11802
|
try {
|
|
11688
|
-
const result = await /** @type {
|
|
11689
|
-
this.options.filter(query);
|
|
11803
|
+
const result = await /** @type {TagPickerFilter} */
|
|
11804
|
+
this.options.filter(query, { signal: controller.signal });
|
|
11690
11805
|
if (sequence !== this._requestSequence) return;
|
|
11691
11806
|
this._items = Array.isArray(result) ? result.slice() : [];
|
|
11692
11807
|
this._visible = this._items.slice();
|
|
@@ -11701,16 +11816,21 @@ var TagPicker = class extends Component {
|
|
|
11701
11816
|
this._setActive(this._entries.length > 0 ? 0 : -1);
|
|
11702
11817
|
this._position?.update();
|
|
11703
11818
|
}
|
|
11819
|
+
if (this._queryController === controller) this._queryController = null;
|
|
11704
11820
|
}
|
|
11705
11821
|
}
|
|
11706
|
-
/** @returns {
|
|
11822
|
+
/** @returns {number} The request generation this cancellation started. */
|
|
11707
11823
|
_cancelQuery() {
|
|
11708
11824
|
if (this._queryTimer !== null) {
|
|
11709
11825
|
clearTimeout(this._queryTimer);
|
|
11710
11826
|
this._queryTimer = null;
|
|
11711
11827
|
}
|
|
11712
|
-
this._requestSequence
|
|
11713
|
-
this.
|
|
11828
|
+
const sequence = ++this._requestSequence;
|
|
11829
|
+
const controller = this._queryController;
|
|
11830
|
+
this._queryController = null;
|
|
11831
|
+
controller?.abort();
|
|
11832
|
+
if (sequence === this._requestSequence) this._setLoading(false);
|
|
11833
|
+
return sequence;
|
|
11714
11834
|
}
|
|
11715
11835
|
/** @param {boolean} loading @returns {void} */
|
|
11716
11836
|
_setLoading(loading) {
|
|
@@ -12008,6 +12128,16 @@ var Timebox = class extends Component {
|
|
|
12008
12128
|
if (!options.silent) this._emitChange();
|
|
12009
12129
|
return this;
|
|
12010
12130
|
}
|
|
12131
|
+
/**
|
|
12132
|
+
* Moves focus to the hours segment, the first one a duration is typed into (the sign toggle of a
|
|
12133
|
+
* `signed` timebox sits before it and stays one Shift+Tab away). Focusing selects the segment's
|
|
12134
|
+
* digits, as a click into it does. A disabled timebox does not take focus.
|
|
12135
|
+
* @returns {this}
|
|
12136
|
+
*/
|
|
12137
|
+
focus() {
|
|
12138
|
+
this._inputs[0]?.focus();
|
|
12139
|
+
return this;
|
|
12140
|
+
}
|
|
12011
12141
|
/** Enables the timebox. @returns {this} */
|
|
12012
12142
|
enable() {
|
|
12013
12143
|
this._disabled = false;
|
|
@@ -12068,9 +12198,10 @@ var Timebox = class extends Component {
|
|
|
12068
12198
|
}
|
|
12069
12199
|
/** @returns {void} */
|
|
12070
12200
|
_commitSegments() {
|
|
12201
|
+
const before = this._committed;
|
|
12071
12202
|
this._parts = this._readParts();
|
|
12072
12203
|
this._writeParts();
|
|
12073
|
-
this._emitChange();
|
|
12204
|
+
if (this._committed !== before) this._emitChange();
|
|
12074
12205
|
}
|
|
12075
12206
|
/** @returns {void} */
|
|
12076
12207
|
_writeParts() {
|
|
@@ -12078,6 +12209,7 @@ var Timebox = class extends Component {
|
|
|
12078
12209
|
const name2 = input.dataset.segment;
|
|
12079
12210
|
input.value = name2 === "hours" ? String(this._parts[name2]) : pad3(this._parts[name2]);
|
|
12080
12211
|
}
|
|
12212
|
+
this._committed = joinTime(this._parts, this.options.unit);
|
|
12081
12213
|
if (this.refs.sign) {
|
|
12082
12214
|
this.refs.sign.textContent = this._parts.negative ? "-" : "+";
|
|
12083
12215
|
this.refs.sign.setAttribute("aria-pressed", String(this._parts.negative));
|
|
@@ -14115,7 +14247,9 @@ var Modal = class extends Component {
|
|
|
14115
14247
|
const dialog = (
|
|
14116
14248
|
/** @type {HTMLDialogElement} */
|
|
14117
14249
|
h("dialog", {
|
|
14118
|
-
class: "zx-modal"
|
|
14250
|
+
class: "zx-modal",
|
|
14251
|
+
// The panel is a surface, never a control: when it holds focus itself it draws no ring.
|
|
14252
|
+
dataset: { zxFocus: "container" }
|
|
14119
14253
|
}, h("div", { class: "zx-modal__content", ref: "content" }))
|
|
14120
14254
|
);
|
|
14121
14255
|
dialog.dataset.state = "closed";
|
|
@@ -14506,7 +14640,8 @@ var Dialog = class _Dialog extends Modal {
|
|
|
14506
14640
|
"dialog",
|
|
14507
14641
|
{
|
|
14508
14642
|
class: "zx-modal zx-dialog",
|
|
14509
|
-
ariaLabelledby: titleId
|
|
14643
|
+
ariaLabelledby: titleId,
|
|
14644
|
+
dataset: { zxFocus: "container" }
|
|
14510
14645
|
},
|
|
14511
14646
|
h(
|
|
14512
14647
|
"header",
|
|
@@ -15208,6 +15343,78 @@ var Search = class extends Component {
|
|
|
15208
15343
|
}
|
|
15209
15344
|
};
|
|
15210
15345
|
|
|
15346
|
+
// src/internal/focus-stops.js
|
|
15347
|
+
var NATIVE_STOPS = [
|
|
15348
|
+
"a[href]",
|
|
15349
|
+
"area[href]",
|
|
15350
|
+
"button",
|
|
15351
|
+
'input:not([type="hidden"])',
|
|
15352
|
+
"select",
|
|
15353
|
+
"textarea",
|
|
15354
|
+
"iframe",
|
|
15355
|
+
"object",
|
|
15356
|
+
"embed",
|
|
15357
|
+
"audio[controls]",
|
|
15358
|
+
"video[controls]",
|
|
15359
|
+
"details > summary:first-of-type",
|
|
15360
|
+
'[contenteditable]:not([contenteditable="false"])'
|
|
15361
|
+
].join(",");
|
|
15362
|
+
var CANDIDATES = `${NATIVE_STOPS},[tabindex]`;
|
|
15363
|
+
function syncPanelStop(panel) {
|
|
15364
|
+
const stop = !containsTabStop(panel);
|
|
15365
|
+
if (stop && panel.getAttribute("tabindex") !== "0") panel.tabIndex = 0;
|
|
15366
|
+
else if (!stop && panel.hasAttribute("tabindex") && panel.ownerDocument.activeElement !== panel) {
|
|
15367
|
+
panel.removeAttribute("tabindex");
|
|
15368
|
+
}
|
|
15369
|
+
return stop;
|
|
15370
|
+
}
|
|
15371
|
+
function containsTabStop(container) {
|
|
15372
|
+
const rendered = isRendered2(container);
|
|
15373
|
+
for (const element of container.querySelectorAll(CANDIDATES)) {
|
|
15374
|
+
if (isTabStop(element, container, rendered)) return true;
|
|
15375
|
+
}
|
|
15376
|
+
return false;
|
|
15377
|
+
}
|
|
15378
|
+
function syncScrollStop(element) {
|
|
15379
|
+
const overflowing = isOverflowing(element);
|
|
15380
|
+
if (overflowing && !element.hasAttribute("tabindex")) element.tabIndex = 0;
|
|
15381
|
+
else if (!overflowing && element.hasAttribute("tabindex") && element.ownerDocument.activeElement !== element) {
|
|
15382
|
+
element.removeAttribute("tabindex");
|
|
15383
|
+
}
|
|
15384
|
+
return overflowing;
|
|
15385
|
+
}
|
|
15386
|
+
function isOverflowing(element) {
|
|
15387
|
+
return element.scrollWidth > element.clientWidth + 1 || element.scrollHeight > element.clientHeight + 1;
|
|
15388
|
+
}
|
|
15389
|
+
function isTabStop(element, container, rendered) {
|
|
15390
|
+
const html = (
|
|
15391
|
+
/** @type {HTMLElement} */
|
|
15392
|
+
element
|
|
15393
|
+
);
|
|
15394
|
+
if (typeof html.focus !== "function") return false;
|
|
15395
|
+
const index = Number.parseInt(element.getAttribute("tabindex") ?? "", 10);
|
|
15396
|
+
if (Number.isNaN(index) ? !element.matches(NATIVE_STOPS) : index < 0) return false;
|
|
15397
|
+
if (element.matches(":disabled")) return false;
|
|
15398
|
+
for (let node = (
|
|
15399
|
+
/** @type {Element|null} */
|
|
15400
|
+
element
|
|
15401
|
+
); node && node !== container; node = node.parentElement) {
|
|
15402
|
+
if (
|
|
15403
|
+
/** @type {HTMLElement} */
|
|
15404
|
+
node.hidden || node.hasAttribute("inert")
|
|
15405
|
+
) return false;
|
|
15406
|
+
const parent = node.parentElement;
|
|
15407
|
+
if (parent?.localName === "details" && !/** @type {HTMLDetailsElement} */
|
|
15408
|
+
parent.open && node !== parent.querySelector(":scope > summary")) return false;
|
|
15409
|
+
}
|
|
15410
|
+
if (!rendered) return true;
|
|
15411
|
+
if (typeof html.checkVisibility === "function") return html.checkVisibility({ visibilityProperty: true });
|
|
15412
|
+
return html.getClientRects().length > 0;
|
|
15413
|
+
}
|
|
15414
|
+
function isRendered2(element) {
|
|
15415
|
+
return element.isConnected && element.getClientRects().length > 0;
|
|
15416
|
+
}
|
|
15417
|
+
|
|
15211
15418
|
// src/components/tabbox/tabbox.js
|
|
15212
15419
|
var VARIANTS2 = /* @__PURE__ */ new Set(["divided", "bracket", "line", "segmented"]);
|
|
15213
15420
|
var Tabbox = class extends Component {
|
|
@@ -15345,9 +15552,9 @@ var Tabbox = class extends Component {
|
|
|
15345
15552
|
class: "zx-tabbox__panel",
|
|
15346
15553
|
id: panelId,
|
|
15347
15554
|
role: "tabpanel",
|
|
15348
|
-
tabindex: "0",
|
|
15349
15555
|
ariaLabelledby: tabId,
|
|
15350
|
-
hidden: true
|
|
15556
|
+
hidden: true,
|
|
15557
|
+
dataset: { zxFocus: "region" }
|
|
15351
15558
|
});
|
|
15352
15559
|
const record = { definition: normalized, tab, title, badge: badge2, panel, built: false };
|
|
15353
15560
|
const numericIndex = Number.isFinite(insert.index) ? Math.trunc(insert.index) : this._tabs.length;
|
|
@@ -15482,6 +15689,10 @@ var Tabbox = class extends Component {
|
|
|
15482
15689
|
if (!tab || !this.refs.tablist.contains(tab)) return;
|
|
15483
15690
|
const current = this._recordForTab(tab);
|
|
15484
15691
|
if (!current) return;
|
|
15692
|
+
if (event.key === "Tab" && !event.shiftKey) {
|
|
15693
|
+
this._syncPanelStop();
|
|
15694
|
+
return;
|
|
15695
|
+
}
|
|
15485
15696
|
const enabled = this._enabledTabs();
|
|
15486
15697
|
if (event.key === "ArrowLeft" || event.key === "ArrowRight") {
|
|
15487
15698
|
event.preventDefault();
|
|
@@ -15563,8 +15774,18 @@ var Tabbox = class extends Component {
|
|
|
15563
15774
|
record.tab.setAttribute("aria-selected", "true");
|
|
15564
15775
|
record.panel.hidden = false;
|
|
15565
15776
|
if (record.panel.parentNode !== this.refs.panels) this.refs.panels.append(record.panel);
|
|
15777
|
+
this._syncPanelStop();
|
|
15566
15778
|
this._setFocused(record, false);
|
|
15567
15779
|
}
|
|
15780
|
+
/**
|
|
15781
|
+
* Makes the active panel a Tab stop only while nothing inside it is one: Tab from the tab goes
|
|
15782
|
+
* to the panel's first control when it has one, and onto the panel itself when it holds only
|
|
15783
|
+
* text to read or scroll.
|
|
15784
|
+
* @returns {void}
|
|
15785
|
+
*/
|
|
15786
|
+
_syncPanelStop() {
|
|
15787
|
+
if (this._active) syncPanelStop(this._active.panel);
|
|
15788
|
+
}
|
|
15568
15789
|
/** @param {TabRecord} record @returns {void} */
|
|
15569
15790
|
_ensureContent(record) {
|
|
15570
15791
|
if (record.built) return;
|
|
@@ -16056,6 +16277,9 @@ var Table = class extends Component {
|
|
|
16056
16277
|
this._scroll = h("div", {
|
|
16057
16278
|
class: "zx-table__scroll",
|
|
16058
16279
|
dataset: {
|
|
16280
|
+
// A scroller with nothing focusable inside is a Tab stop of the browser's making: it keeps
|
|
16281
|
+
// an inset ring there, and none while it holds focus for a table with no rows.
|
|
16282
|
+
zxFocus: "region",
|
|
16059
16283
|
stickyHeader: String(Boolean(this.options.stickyHeader)),
|
|
16060
16284
|
// Stripes follow the row's place in the data while windowed: `:nth-child` would count the
|
|
16061
16285
|
// spacers, and the stripes would swap as the window moved.
|
|
@@ -18407,11 +18631,13 @@ var Table = class extends Component {
|
|
|
18407
18631
|
if (!frame.hasAttribute("tabindex")) {
|
|
18408
18632
|
frame.tabIndex = -1;
|
|
18409
18633
|
frame.setAttribute("data-empty-focus", "");
|
|
18634
|
+
frame.dataset.zxFocus = "container";
|
|
18410
18635
|
}
|
|
18411
18636
|
frame.focus({ preventScroll: true });
|
|
18412
18637
|
} else if (frame.hasAttribute("data-empty-focus")) {
|
|
18413
18638
|
frame.removeAttribute("tabindex");
|
|
18414
18639
|
frame.removeAttribute("data-empty-focus");
|
|
18640
|
+
frame.dataset.zxFocus = "region";
|
|
18415
18641
|
}
|
|
18416
18642
|
}
|
|
18417
18643
|
/** @param {Event} event @returns {void} */
|
|
@@ -21213,7 +21439,7 @@ var BlockView = class extends Component {
|
|
|
21213
21439
|
this._nodes.push(node);
|
|
21214
21440
|
if (this._stoppedNote) this._stoppedNote.before(node);
|
|
21215
21441
|
else this.el.append(node);
|
|
21216
|
-
if (copy.type === "table") this._syncScrollers();
|
|
21442
|
+
if (copy.type === "table" || copy.type === "code") this._syncScrollers();
|
|
21217
21443
|
}
|
|
21218
21444
|
/** @private @returns {void} */
|
|
21219
21445
|
_redrawLast() {
|
|
@@ -21257,12 +21483,20 @@ var BlockView = class extends Component {
|
|
|
21257
21483
|
else root.removeAttribute("aria-busy");
|
|
21258
21484
|
}
|
|
21259
21485
|
/**
|
|
21260
|
-
* A wide table scrolls inside the answer; while it does, its
|
|
21261
|
-
*
|
|
21486
|
+
* A wide table or a long code line scrolls inside the answer; while it does, its scroller is a
|
|
21487
|
+
* Tab stop so the keyboard can scroll it too — a table's wrapper a named region. One that fits
|
|
21488
|
+
* is not a Tab stop.
|
|
21262
21489
|
* @private
|
|
21263
21490
|
* @returns {void}
|
|
21264
21491
|
*/
|
|
21265
21492
|
_syncScrollers() {
|
|
21493
|
+
for (
|
|
21494
|
+
const pre of
|
|
21495
|
+
/** @type {NodeListOf<HTMLElement>} */
|
|
21496
|
+
this.el.querySelectorAll(".zx-block-view__pre")
|
|
21497
|
+
) {
|
|
21498
|
+
syncScrollStop(pre);
|
|
21499
|
+
}
|
|
21266
21500
|
for (
|
|
21267
21501
|
const wrap of
|
|
21268
21502
|
/** @type {NodeListOf<HTMLElement>} */
|
|
@@ -21396,14 +21630,14 @@ function renderCode(block, msg) {
|
|
|
21396
21630
|
h("span", { class: "zx-block-view__code-language" }, language2 || msg("blockView.code")),
|
|
21397
21631
|
copyButton({ text: String(block.code ?? ""), title: msg("blockView.copyCode"), size: "sm" })
|
|
21398
21632
|
),
|
|
21399
|
-
block.lines ? h("pre", { class: "zx-block-view__pre", dataset: { lines: ""
|
|
21633
|
+
block.lines ? h("pre", { class: "zx-block-view__pre", dataset: { lines: "", zxFocus: "region" } }, h(
|
|
21400
21634
|
"code",
|
|
21401
21635
|
{},
|
|
21402
21636
|
String(block.code ?? "").split("\n").map((line) => h("span", {
|
|
21403
21637
|
class: "zx-block-view__line",
|
|
21404
21638
|
style: { "--zx-block-view-indent": `${/^\s*/.exec(line)?.[0].length ?? 0}ch` }
|
|
21405
21639
|
}, codeSegments(language2, line)))
|
|
21406
|
-
)) : h("pre", { class: "zx-block-view__pre",
|
|
21640
|
+
)) : h("pre", { class: "zx-block-view__pre", dataset: { zxFocus: "region" } }, h("code", {}, codeSegments(language2, block.code)))
|
|
21407
21641
|
);
|
|
21408
21642
|
}
|
|
21409
21643
|
function codeSegments(language2, code) {
|
|
@@ -21416,7 +21650,7 @@ function renderTable(block, cite) {
|
|
|
21416
21650
|
const value = block.align?.[index];
|
|
21417
21651
|
return value === "end" || value === "center" ? value : null;
|
|
21418
21652
|
};
|
|
21419
|
-
return h("div", { class: "zx-block-view__table" }, h(
|
|
21653
|
+
return h("div", { class: "zx-block-view__table", dataset: { zxFocus: "region" } }, h(
|
|
21420
21654
|
"table",
|
|
21421
21655
|
{},
|
|
21422
21656
|
h("thead", {}, h("tr", {}, columns.map((column, index) => h(
|
|
@@ -22105,6 +22339,7 @@ var ApprovalCard = class extends Component {
|
|
|
22105
22339
|
root.setAttribute("role", "group");
|
|
22106
22340
|
root.setAttribute("aria-labelledby", titleId);
|
|
22107
22341
|
root.tabIndex = -1;
|
|
22342
|
+
root.dataset.zxFocus = "container";
|
|
22108
22343
|
this._titleEl = h(`h${level}`, { class: "zx-approval-card__title", id: titleId }, this._title);
|
|
22109
22344
|
this._noteEl = h("p", { class: "zx-approval-card__note", id: uid("zx-approval-card-note") });
|
|
22110
22345
|
this._statusEl = h("span", { class: "zx-approval-card__status" });
|
|
@@ -23111,7 +23346,7 @@ function normalizeAlign(value) {
|
|
|
23111
23346
|
|
|
23112
23347
|
// src/components/skeleton/skeleton.js
|
|
23113
23348
|
function skeleton(opts = {}) {
|
|
23114
|
-
const options = { width: "100%", height: "1rem", radius: "sm", ...opts };
|
|
23349
|
+
const options = { width: "100%", height: "1rem", radius: "sm", ...given(opts) };
|
|
23115
23350
|
return (
|
|
23116
23351
|
/** @type {HTMLSpanElement} */
|
|
23117
23352
|
h("span", {
|
|
@@ -23123,7 +23358,7 @@ function skeleton(opts = {}) {
|
|
|
23123
23358
|
);
|
|
23124
23359
|
}
|
|
23125
23360
|
function skeletonText(opts = {}) {
|
|
23126
|
-
const options = { lines: 3, width: "100%", heading: false, lastLineWidth: "60%", ...opts };
|
|
23361
|
+
const options = { lines: 3, width: "100%", heading: false, lastLineWidth: "60%", ...given(opts) };
|
|
23127
23362
|
const lines = clamp(Math.trunc(Number(options.lines) || 0), 1, 20);
|
|
23128
23363
|
const element = (
|
|
23129
23364
|
/** @type {HTMLDivElement} */
|
|
@@ -23144,7 +23379,7 @@ function skeletonText(opts = {}) {
|
|
|
23144
23379
|
return element;
|
|
23145
23380
|
}
|
|
23146
23381
|
function skeletonTable(opts = {}) {
|
|
23147
|
-
const options = { rows: 5, columns: 4, header: true, ...opts };
|
|
23382
|
+
const options = { rows: 5, columns: 4, header: true, ...given(opts) };
|
|
23148
23383
|
const rows = clamp(Math.trunc(Number(options.rows) || 0), 1, 50);
|
|
23149
23384
|
const columns = clamp(Math.trunc(Number(options.columns) || 0), 1, 20);
|
|
23150
23385
|
const element = (
|
|
@@ -23183,6 +23418,14 @@ function cellWidth(index, columns) {
|
|
|
23183
23418
|
if (index === columns - 1) return "55%";
|
|
23184
23419
|
return index % 2 === 0 ? "80%" : "65%";
|
|
23185
23420
|
}
|
|
23421
|
+
function given(opts) {
|
|
23422
|
+
return (
|
|
23423
|
+
/** @type {Partial<T>} */
|
|
23424
|
+
Object.fromEntries(
|
|
23425
|
+
Object.entries(opts ?? {}).filter(([, value]) => value !== void 0)
|
|
23426
|
+
)
|
|
23427
|
+
);
|
|
23428
|
+
}
|
|
23186
23429
|
function size(value) {
|
|
23187
23430
|
return typeof value === "number" ? `${value}px` : String(value ?? "");
|
|
23188
23431
|
}
|
|
@@ -23322,6 +23565,8 @@ var RunTrace = class extends Component {
|
|
|
23322
23565
|
}
|
|
23323
23566
|
});
|
|
23324
23567
|
if (this.options.ticking) this.listen(root.ownerDocument, "visibilitychange", () => this._syncClock());
|
|
23568
|
+
this._resize = typeof ResizeObserver === "function" ? new ResizeObserver(() => this._syncCodeStops(root)) : null;
|
|
23569
|
+
this._resize?.observe(root);
|
|
23325
23570
|
this._build(this.options.steps);
|
|
23326
23571
|
return root;
|
|
23327
23572
|
}
|
|
@@ -23444,6 +23689,8 @@ var RunTrace = class extends Component {
|
|
|
23444
23689
|
this._revealTimer = null;
|
|
23445
23690
|
if (this._clock) clearInterval(this._clock);
|
|
23446
23691
|
this._clock = null;
|
|
23692
|
+
this._resize?.disconnect();
|
|
23693
|
+
this._resize = null;
|
|
23447
23694
|
for (const entry of this._entries.values()) this._releaseAvatars(entry);
|
|
23448
23695
|
this._entries.clear();
|
|
23449
23696
|
super.destroy();
|
|
@@ -23589,6 +23836,7 @@ var RunTrace = class extends Component {
|
|
|
23589
23836
|
entry.row = row2;
|
|
23590
23837
|
entry.refs = refs;
|
|
23591
23838
|
entry.body = body;
|
|
23839
|
+
if (body) this._syncCodeStops(body);
|
|
23592
23840
|
const again = focusedRef === null ? null : (
|
|
23593
23841
|
/** @type {HTMLElement|null} */
|
|
23594
23842
|
refs?.querySelector(`[data-ref-index="${focusedRef}"]`) ?? null
|
|
@@ -23746,11 +23994,11 @@ var RunTrace = class extends Component {
|
|
|
23746
23994
|
h("span", { class: "zx-run-trace__section-title", id: titleId }, this.msg(keys.title)),
|
|
23747
23995
|
copyButton({ text: full, title: this.msg(keys.copy), feedback: this.msg("runTrace.copied"), size: "sm" })
|
|
23748
23996
|
),
|
|
23997
|
+
// A Tab stop only while its text scrolls (`_syncCodeStops()`).
|
|
23749
23998
|
h("pre", {
|
|
23750
23999
|
class: "zx-run-trace__code",
|
|
23751
|
-
tabindex: "0",
|
|
23752
24000
|
"aria-labelledby": titleId,
|
|
23753
|
-
dataset: { tone: kind === "error" ? "danger" : null }
|
|
24001
|
+
dataset: { tone: kind === "error" ? "danger" : null, zxFocus: "region" }
|
|
23754
24002
|
}, shown.text),
|
|
23755
24003
|
shown.cut ? h("button", {
|
|
23756
24004
|
type: "button",
|
|
@@ -23770,6 +24018,7 @@ var RunTrace = class extends Component {
|
|
|
23770
24018
|
this._open = open;
|
|
23771
24019
|
this._summary.setAttribute("aria-expanded", String(open));
|
|
23772
24020
|
this._list.hidden = !open;
|
|
24021
|
+
if (open) this._syncCodeStops(this._list);
|
|
23773
24022
|
this._syncClock();
|
|
23774
24023
|
this.emit("toggle", { id: null, open });
|
|
23775
24024
|
}
|
|
@@ -23786,8 +24035,24 @@ var RunTrace = class extends Component {
|
|
|
23786
24035
|
else this._expanded.delete(id);
|
|
23787
24036
|
entry.row.setAttribute("aria-expanded", String(open));
|
|
23788
24037
|
entry.body.hidden = !open;
|
|
24038
|
+
if (open) this._syncCodeStops(entry.body);
|
|
23789
24039
|
this.emit("toggle", { id, open });
|
|
23790
24040
|
}
|
|
24041
|
+
/**
|
|
24042
|
+
* Makes each code block a Tab stop while, and only while, its text scrolls inside it.
|
|
24043
|
+
* @private
|
|
24044
|
+
* @param {Element} scope Where to look for code blocks.
|
|
24045
|
+
* @returns {void}
|
|
24046
|
+
*/
|
|
24047
|
+
_syncCodeStops(scope2) {
|
|
24048
|
+
for (
|
|
24049
|
+
const code of
|
|
24050
|
+
/** @type {NodeListOf<HTMLElement>} */
|
|
24051
|
+
scope2.querySelectorAll(".zx-run-trace__code")
|
|
24052
|
+
) {
|
|
24053
|
+
syncScrollStop(code);
|
|
24054
|
+
}
|
|
24055
|
+
}
|
|
23791
24056
|
/**
|
|
23792
24057
|
* Redraws the summary from the steps.
|
|
23793
24058
|
* @private
|
|
@@ -27730,9 +27995,10 @@ var Questionnaire = class extends Component {
|
|
|
27730
27995
|
this._progressHost = h("div", { class: "zx-questionnaire__progress", hidden: !this.options.progress });
|
|
27731
27996
|
this._itemHost = h("fieldset", {
|
|
27732
27997
|
class: "zx-questionnaire__item",
|
|
27733
|
-
tabIndex: -1
|
|
27998
|
+
tabIndex: -1,
|
|
27999
|
+
dataset: { zxFocus: "container" }
|
|
27734
28000
|
});
|
|
27735
|
-
this._reviewHost = h("div", { class: "zx-questionnaire__review", tabIndex: -1, hidden: true });
|
|
28001
|
+
this._reviewHost = h("div", { class: "zx-questionnaire__review", tabIndex: -1, hidden: true, dataset: { zxFocus: "container" } });
|
|
27736
28002
|
this._actionsHost = h("div", { class: "zx-questionnaire__actions" });
|
|
27737
28003
|
this.refs.item = this._itemHost;
|
|
27738
28004
|
this.refs.review = this._reviewHost;
|
|
@@ -28588,6 +28854,7 @@ function dragAxis(handle, options) {
|
|
|
28588
28854
|
let sign2 = 1;
|
|
28589
28855
|
let moved = false;
|
|
28590
28856
|
let frame = 0;
|
|
28857
|
+
let uncaptured = null;
|
|
28591
28858
|
const axis = (event) => vertical ? event.clientY : event.clientX;
|
|
28592
28859
|
const blocked = () => Boolean(options.disabled?.());
|
|
28593
28860
|
const rightToLeft = () => {
|
|
@@ -28617,6 +28884,8 @@ function dragAxis(handle, options) {
|
|
|
28617
28884
|
moved = false;
|
|
28618
28885
|
cancelFrame2();
|
|
28619
28886
|
releasePointer();
|
|
28887
|
+
uncaptured?.abort();
|
|
28888
|
+
uncaptured = null;
|
|
28620
28889
|
};
|
|
28621
28890
|
handle.addEventListener("pointerdown", (event) => {
|
|
28622
28891
|
const pointer = (
|
|
@@ -28634,9 +28903,17 @@ function dragAxis(handle, options) {
|
|
|
28634
28903
|
try {
|
|
28635
28904
|
handle.setPointerCapture(pointer.pointerId);
|
|
28636
28905
|
} catch {
|
|
28906
|
+
const target = handle.ownerDocument;
|
|
28907
|
+
if (target) {
|
|
28908
|
+
uncaptured = new AbortController();
|
|
28909
|
+
const watch = { signal: uncaptured.signal };
|
|
28910
|
+
target.addEventListener("pointermove", move, watch);
|
|
28911
|
+
target.addEventListener("pointerup", end, watch);
|
|
28912
|
+
target.addEventListener("pointercancel", end, watch);
|
|
28913
|
+
}
|
|
28637
28914
|
}
|
|
28638
28915
|
}, { signal });
|
|
28639
|
-
|
|
28916
|
+
function move(event) {
|
|
28640
28917
|
const pointer = (
|
|
28641
28918
|
/** @type {PointerEvent} */
|
|
28642
28919
|
event
|
|
@@ -28649,8 +28926,9 @@ function dragAxis(handle, options) {
|
|
|
28649
28926
|
frame = 0;
|
|
28650
28927
|
if (dragging) options.onMove(sign2 * (client - startClient));
|
|
28651
28928
|
});
|
|
28652
|
-
}
|
|
28653
|
-
|
|
28929
|
+
}
|
|
28930
|
+
handle.addEventListener("pointermove", move, { signal });
|
|
28931
|
+
function end(event) {
|
|
28654
28932
|
const pointer = (
|
|
28655
28933
|
/** @type {PointerEvent} */
|
|
28656
28934
|
event
|
|
@@ -28662,7 +28940,7 @@ function dragAxis(handle, options) {
|
|
|
28662
28940
|
const delta = sign2 * (client - startClient);
|
|
28663
28941
|
finish();
|
|
28664
28942
|
options.onEnd?.(delta, travelled);
|
|
28665
|
-
}
|
|
28943
|
+
}
|
|
28666
28944
|
handle.addEventListener("pointerup", end, { signal });
|
|
28667
28945
|
handle.addEventListener("pointercancel", end, { signal });
|
|
28668
28946
|
handle.addEventListener("keydown", (event) => {
|
|
@@ -32678,16 +32956,16 @@ function conditionFields2(condition, depth = 0) {
|
|
|
32678
32956
|
function createReply(document2, details) {
|
|
32679
32957
|
const action = String(details.action);
|
|
32680
32958
|
const intent = document2.intent;
|
|
32681
|
-
const
|
|
32959
|
+
const given2 = isObject5(details.values) ? details.values : {};
|
|
32682
32960
|
let values = {};
|
|
32683
32961
|
if (!intent || VALUELESS_INTENTS.has(intent) || VALUELESS_ACTIONS.has(action)) {
|
|
32684
32962
|
values = {};
|
|
32685
32963
|
} else if (intent === "questionnaire") {
|
|
32686
|
-
values = isObject5(
|
|
32964
|
+
values = isObject5(given2.answers) ? visibleSteps(questionnaireSteps(document2), given2.answers, Array.isArray(given2.path) ? given2.path : []) : {};
|
|
32687
32965
|
} else {
|
|
32688
|
-
const { names } = surfaceVisibility(document2,
|
|
32966
|
+
const { names } = surfaceVisibility(document2, given2);
|
|
32689
32967
|
for (const name2 of names) {
|
|
32690
|
-
if (Object.hasOwn(
|
|
32968
|
+
if (Object.hasOwn(given2, name2) && given2[name2] !== void 0) values[name2] = clone2(given2[name2]);
|
|
32691
32969
|
}
|
|
32692
32970
|
}
|
|
32693
32971
|
const reply = {
|
|
@@ -32726,8 +33004,8 @@ function surfaceText(document2, reply, options = {}) {
|
|
|
32726
33004
|
) && !VALUELESS_ACTIONS.has(action);
|
|
32727
33005
|
if (answered && doc.intent === "questionnaire") {
|
|
32728
33006
|
const steps = questionnaireSteps(doc);
|
|
32729
|
-
const
|
|
32730
|
-
const { answers, path } = visibleSteps(steps,
|
|
33007
|
+
const given2 = isObject5(values.answers) ? values.answers : {};
|
|
33008
|
+
const { answers, path } = visibleSteps(steps, given2, Array.isArray(values.path) ? values.path : Object.keys(given2));
|
|
32731
33009
|
for (const name2 of path) {
|
|
32732
33010
|
const step2 = steps.find((entry) => isObject5(entry) && entry.name === name2);
|
|
32733
33011
|
if (!step2 || !Object.hasOwn(answers, name2)) continue;
|
|
@@ -33169,9 +33447,9 @@ var Surface = class extends Component {
|
|
|
33169
33447
|
{ op: "end", surface: valid.surface, ...sources ? { sources } : {} }
|
|
33170
33448
|
);
|
|
33171
33449
|
}
|
|
33172
|
-
const
|
|
33173
|
-
if (valid &&
|
|
33174
|
-
this._reply = structuredClone(
|
|
33450
|
+
const given2 = this.options.reply;
|
|
33451
|
+
if (valid && given2 && typeof given2 === "object" && given2.surface === valid.surface) {
|
|
33452
|
+
this._reply = structuredClone(given2);
|
|
33175
33453
|
}
|
|
33176
33454
|
this._draw();
|
|
33177
33455
|
this._report(errors);
|
|
@@ -33967,15 +34245,15 @@ var Surface = class extends Component {
|
|
|
33967
34245
|
break;
|
|
33968
34246
|
}
|
|
33969
34247
|
case "questionnaire": {
|
|
33970
|
-
const
|
|
34248
|
+
const given2 = (
|
|
33971
34249
|
/** @type {Record<string, unknown>} */
|
|
33972
34250
|
values.answers ?? {}
|
|
33973
34251
|
);
|
|
33974
34252
|
const { answers, path } = visibleSteps(
|
|
33975
34253
|
props.steps,
|
|
33976
|
-
|
|
34254
|
+
given2,
|
|
33977
34255
|
/** @type {string[]} */
|
|
33978
|
-
Array.isArray(values.path) ? values.path : Object.keys(
|
|
34256
|
+
Array.isArray(values.path) ? values.path : Object.keys(given2)
|
|
33979
34257
|
);
|
|
33980
34258
|
for (const name2 of path) {
|
|
33981
34259
|
const step2 = props.steps.find((entry) => entry.name === name2);
|
|
@@ -34583,7 +34861,7 @@ var Surface = class extends Component {
|
|
|
34583
34861
|
const verdict = verdictText(reply.action, this._model.actions ?? [], (key, ...args) => this.msg(key, ...args));
|
|
34584
34862
|
this._verdict = h(
|
|
34585
34863
|
"p",
|
|
34586
|
-
{ class: "zx-surface__verdict", tabIndex: -1, dataset: { action: reply.action } },
|
|
34864
|
+
{ class: "zx-surface__verdict", tabIndex: -1, dataset: { action: reply.action, zxFocus: "container" } },
|
|
34587
34865
|
h(
|
|
34588
34866
|
"span",
|
|
34589
34867
|
{ class: "zx-surface__verdict-icon", "aria-hidden": "true" },
|
|
@@ -34691,9 +34969,9 @@ function openSurface(document2, options = {}) {
|
|
|
34691
34969
|
signal.addEventListener("abort", withdraw, { once: true });
|
|
34692
34970
|
surface2.on("reply", () => signal.removeEventListener("abort", withdraw));
|
|
34693
34971
|
};
|
|
34694
|
-
const
|
|
34695
|
-
if (
|
|
34696
|
-
|
|
34972
|
+
const given2 = surfaceOptions.reply;
|
|
34973
|
+
if (given2 && typeof given2 === "object" && /** @type {SurfaceReply} */
|
|
34974
|
+
given2.surface === preview.surface) {
|
|
34697
34975
|
const host = typeof target === "string" ? globalThis.document.querySelector(target) : target;
|
|
34698
34976
|
if (host) {
|
|
34699
34977
|
const receipt = new Surface(null, { ...surfaceOptions, document: document2 });
|
|
@@ -34702,7 +34980,7 @@ function openSurface(document2, options = {}) {
|
|
|
34702
34980
|
}
|
|
34703
34981
|
resolve(structuredClone(
|
|
34704
34982
|
/** @type {SurfaceReply} */
|
|
34705
|
-
|
|
34983
|
+
given2
|
|
34706
34984
|
));
|
|
34707
34985
|
return;
|
|
34708
34986
|
}
|
|
@@ -36586,10 +36864,10 @@ function keepsSurface(old, item) {
|
|
|
36586
36864
|
if (item.reply && !old.surface?.getReply()) return false;
|
|
36587
36865
|
if ((item.token ?? null) !== (before.token ?? null) || (item.catalog ?? null) !== (before.catalog ?? null)) return false;
|
|
36588
36866
|
if (item.document == null) return true;
|
|
36589
|
-
const
|
|
36590
|
-
if (
|
|
36867
|
+
const given2 = JSON.stringify(item.document);
|
|
36868
|
+
if (given2 === JSON.stringify(before.document ?? null)) return true;
|
|
36591
36869
|
const drawn = old.surface?.toDocument();
|
|
36592
|
-
return Boolean(drawn) &&
|
|
36870
|
+
return Boolean(drawn) && given2 === JSON.stringify(drawn);
|
|
36593
36871
|
}
|
|
36594
36872
|
function actionButton2(glyph, label, data2, disabled = false) {
|
|
36595
36873
|
return (
|
|
@@ -38281,11 +38559,13 @@ var CardView = class extends RecordView {
|
|
|
38281
38559
|
if (!content.hasAttribute("tabindex")) {
|
|
38282
38560
|
content.tabIndex = -1;
|
|
38283
38561
|
content.setAttribute("data-empty-focus", "");
|
|
38562
|
+
content.setAttribute("data-zx-focus", "container");
|
|
38284
38563
|
}
|
|
38285
38564
|
content.focus({ preventScroll: true });
|
|
38286
38565
|
} else if (content.hasAttribute("data-empty-focus")) {
|
|
38287
38566
|
content.removeAttribute("tabindex");
|
|
38288
38567
|
content.removeAttribute("data-empty-focus");
|
|
38568
|
+
content.removeAttribute("data-zx-focus");
|
|
38289
38569
|
}
|
|
38290
38570
|
}
|
|
38291
38571
|
/** @private @returns {HTMLElement[]} Roving items in display order. */
|
|
@@ -38425,7 +38705,7 @@ var CardView = class extends RecordView {
|
|
|
38425
38705
|
for (let index = 0; index < this._cardLoadingCount; index += 1) {
|
|
38426
38706
|
list.append(h(
|
|
38427
38707
|
"li",
|
|
38428
|
-
{ class: "zx-record-card zx-card-view__skeleton", tabindex: -1 },
|
|
38708
|
+
{ class: "zx-record-card zx-card-view__skeleton", tabindex: -1, dataset: { zxFocus: "container" } },
|
|
38429
38709
|
h("span", { class: "zx-card-view__skeleton-preview zx-skeleton" }),
|
|
38430
38710
|
h("span", { class: "zx-card-view__skeleton-line zx-skeleton" }),
|
|
38431
38711
|
h("span", { class: "zx-card-view__skeleton-line zx-skeleton" }),
|
|
@@ -41654,11 +41934,23 @@ var Dropdown = class extends Component {
|
|
|
41654
41934
|
render() {
|
|
41655
41935
|
const panel = h("div", {
|
|
41656
41936
|
id: uid("zx-dropdown"),
|
|
41657
|
-
popover: "manual"
|
|
41937
|
+
popover: "manual",
|
|
41938
|
+
// A surface, not a control: it draws no ring when a script focuses it (`#syncFocusMarker()`).
|
|
41939
|
+
dataset: { zxFocus: "container" }
|
|
41658
41940
|
});
|
|
41659
41941
|
panel.dataset.state = "closed";
|
|
41660
41942
|
return panel;
|
|
41661
41943
|
}
|
|
41944
|
+
/**
|
|
41945
|
+
* A panel the application put in the Tab order (`tabindex` of 0 or more) is reached from its
|
|
41946
|
+
* anchor's Tab, so it shows keyboard focus as a region, with the ring inside its edge; otherwise
|
|
41947
|
+
* only a script focuses it and it draws no ring.
|
|
41948
|
+
* @returns {void}
|
|
41949
|
+
*/
|
|
41950
|
+
#syncFocusMarker() {
|
|
41951
|
+
const reachable = this.el.hasAttribute("tabindex") && this.el.tabIndex >= 0;
|
|
41952
|
+
this.el.dataset.zxFocus = reachable ? "region" : "container";
|
|
41953
|
+
}
|
|
41662
41954
|
/**
|
|
41663
41955
|
* Opens and positions the panel.
|
|
41664
41956
|
* @returns {this}
|
|
@@ -41668,6 +41960,7 @@ var Dropdown = class extends Component {
|
|
|
41668
41960
|
if (this.isOpen() || this.#destroyed) return this;
|
|
41669
41961
|
const host = this.#host();
|
|
41670
41962
|
if (this.el.parentElement !== host) host.append(this.el);
|
|
41963
|
+
this.#syncFocusMarker();
|
|
41671
41964
|
this.#position = position(this.#anchor, this.el, {
|
|
41672
41965
|
placement: this.options.placement,
|
|
41673
41966
|
offset: Number(this.options.offset),
|
|
@@ -45281,6 +45574,7 @@ var RunStatus = class extends Component {
|
|
|
45281
45574
|
}
|
|
45282
45575
|
if (!root.hasAttribute("tabindex")) {
|
|
45283
45576
|
root.tabIndex = -1;
|
|
45577
|
+
root.dataset.zxFocus = "container";
|
|
45284
45578
|
this._heldFocus = true;
|
|
45285
45579
|
}
|
|
45286
45580
|
root.focus({ preventScroll: true });
|
|
@@ -45290,6 +45584,7 @@ var RunStatus = class extends Component {
|
|
|
45290
45584
|
if (!this._heldFocus) return;
|
|
45291
45585
|
this._heldFocus = false;
|
|
45292
45586
|
this.el.removeAttribute("tabindex");
|
|
45587
|
+
this.el.removeAttribute("data-zx-focus");
|
|
45293
45588
|
}
|
|
45294
45589
|
/**
|
|
45295
45590
|
* The agent's face with the run's expression: the one drawn before, while the traits it asks for
|
|
@@ -49050,7 +49345,7 @@ var Card = class extends Component {
|
|
|
49050
49345
|
if (onclick !== void 0 && typeof onclick !== "function") {
|
|
49051
49346
|
throw new TypeError("Card action onclick must be a function");
|
|
49052
49347
|
}
|
|
49053
|
-
if (onclick)
|
|
49348
|
+
if (onclick) this.listen(control, "click", onclick, { signal: nextAbort.signal });
|
|
49054
49349
|
return control;
|
|
49055
49350
|
});
|
|
49056
49351
|
} catch (error2) {
|
|
@@ -49098,7 +49393,7 @@ var Card = class extends Component {
|
|
|
49098
49393
|
target: this._link.target,
|
|
49099
49394
|
rel: this._link.rel
|
|
49100
49395
|
}, title) : h("span", { class: "zx-card__title" }, title);
|
|
49101
|
-
if (this._link?.onclick)
|
|
49396
|
+
if (this._link?.onclick) this.listen(node, "click", this._link.onclick, { signal: nextAbort.signal });
|
|
49102
49397
|
this._linkAbort?.abort();
|
|
49103
49398
|
this._linkAbort = nextAbort;
|
|
49104
49399
|
this.refs.heading.replaceChildren(node);
|
|
@@ -49682,7 +49977,8 @@ var MasterPanel = class extends Component {
|
|
|
49682
49977
|
);
|
|
49683
49978
|
const content = h("div", {
|
|
49684
49979
|
class: "zx-master-panel__content",
|
|
49685
|
-
ref: "content"
|
|
49980
|
+
ref: "content",
|
|
49981
|
+
dataset: { zxFocus: "region" }
|
|
49686
49982
|
});
|
|
49687
49983
|
const footer = h("footer", {
|
|
49688
49984
|
class: "zx-master-panel__footer",
|
|
@@ -50687,7 +50983,7 @@ var Dock = class extends Component {
|
|
|
50687
50983
|
}, chevron, hasTabs ? null : h("span", { class: "zx-dock__title" }, title));
|
|
50688
50984
|
if (!collapsible) toggle.disabled = true;
|
|
50689
50985
|
const header = h("div", { class: "zx-dock__header" }, toggle);
|
|
50690
|
-
const body = h("div", { class: "zx-dock__body", id: bodyId });
|
|
50986
|
+
const body = h("div", { class: "zx-dock__body", id: bodyId, dataset: { zxFocus: "region" } });
|
|
50691
50987
|
const element = h("section", {
|
|
50692
50988
|
class: "zx-dock__pane",
|
|
50693
50989
|
dataset: { name: name2, state: "open" }
|
|
@@ -50738,8 +51034,8 @@ var Dock = class extends Component {
|
|
|
50738
51034
|
role: "tabpanel",
|
|
50739
51035
|
id: panelId,
|
|
50740
51036
|
ariaLabelledby: tabId,
|
|
50741
|
-
|
|
50742
|
-
|
|
51037
|
+
hidden: true,
|
|
51038
|
+
dataset: { zxFocus: "region" }
|
|
50743
51039
|
});
|
|
50744
51040
|
list.append(tab);
|
|
50745
51041
|
body.append(panel);
|
|
@@ -50747,6 +51043,15 @@ var Dock = class extends Component {
|
|
|
50747
51043
|
}
|
|
50748
51044
|
header.append(list);
|
|
50749
51045
|
record.roving = rovingTabindex(list, ".zx-dock__tab", { orientation: "horizontal" });
|
|
51046
|
+
this.listen(list, "keydown", (event) => {
|
|
51047
|
+
const key = (
|
|
51048
|
+
/** @type {KeyboardEvent} */
|
|
51049
|
+
event
|
|
51050
|
+
);
|
|
51051
|
+
if (key.key !== "Tab" || key.shiftKey) return;
|
|
51052
|
+
const active = record.tabs.get(record.active);
|
|
51053
|
+
if (active) syncPanelStop(active.panel);
|
|
51054
|
+
});
|
|
50750
51055
|
this.listen(list, "click", (event) => {
|
|
50751
51056
|
const button2 = (
|
|
50752
51057
|
/** @type {Element} */
|
|
@@ -50781,7 +51086,8 @@ var Dock = class extends Component {
|
|
|
50781
51086
|
return record;
|
|
50782
51087
|
}
|
|
50783
51088
|
/**
|
|
50784
|
-
* Runs any not-yet-run content factory for whatever the pane currently shows
|
|
51089
|
+
* Runs any not-yet-run content factory for whatever the pane currently shows, and settles
|
|
51090
|
+
* whether a shown tab panel is a Tab stop itself.
|
|
50785
51091
|
* @param {Record<string, any>} record Pane record.
|
|
50786
51092
|
* @returns {void}
|
|
50787
51093
|
*/
|
|
@@ -50789,9 +51095,12 @@ var Dock = class extends Component {
|
|
|
50789
51095
|
if (record.collapsed) return;
|
|
50790
51096
|
if (record.tabs) {
|
|
50791
51097
|
const active = record.tabs.get(record.active);
|
|
50792
|
-
if (!active
|
|
50793
|
-
active.built
|
|
50794
|
-
|
|
51098
|
+
if (!active) return;
|
|
51099
|
+
if (!active.built) {
|
|
51100
|
+
active.built = true;
|
|
51101
|
+
appendContent3(active.panel, active.content, true);
|
|
51102
|
+
}
|
|
51103
|
+
syncPanelStop(active.panel);
|
|
50795
51104
|
return;
|
|
50796
51105
|
}
|
|
50797
51106
|
if (record.built) return;
|
|
@@ -51407,9 +51716,9 @@ var NavigationBar = class extends Component {
|
|
|
51407
51716
|
class: "zx-navigation-bar__panel",
|
|
51408
51717
|
id: panelId,
|
|
51409
51718
|
role: "tabpanel",
|
|
51410
|
-
tabindex: "0",
|
|
51411
51719
|
ariaLabelledby: tabId,
|
|
51412
|
-
hidden: true
|
|
51720
|
+
hidden: true,
|
|
51721
|
+
dataset: { zxFocus: "region" }
|
|
51413
51722
|
});
|
|
51414
51723
|
this.refs.panels.append(panel);
|
|
51415
51724
|
}
|
|
@@ -51434,6 +51743,7 @@ var NavigationBar = class extends Component {
|
|
|
51434
51743
|
item.item.setAttribute("aria-selected", String(active));
|
|
51435
51744
|
item.item.tabIndex = active ? 0 : -1;
|
|
51436
51745
|
if (item.panel) item.panel.hidden = !active;
|
|
51746
|
+
if (active && item.panel) syncPanelStop(item.panel);
|
|
51437
51747
|
} else if (active) {
|
|
51438
51748
|
item.item.setAttribute("aria-current", "page");
|
|
51439
51749
|
} else {
|
|
@@ -51461,6 +51771,11 @@ var NavigationBar = class extends Component {
|
|
|
51461
51771
|
if (!item || !this.refs.items.contains(item)) return;
|
|
51462
51772
|
const current = this._items.find((record) => record.item === item);
|
|
51463
51773
|
if (!current) return;
|
|
51774
|
+
if (event.key === "Tab" && !event.shiftKey) {
|
|
51775
|
+
const active = this._activeName === null ? null : this._find(this._activeName);
|
|
51776
|
+
if (active?.panel) syncPanelStop(active.panel);
|
|
51777
|
+
return;
|
|
51778
|
+
}
|
|
51464
51779
|
const enabled = this._enabledItems();
|
|
51465
51780
|
if (event.key === "ArrowLeft" || event.key === "ArrowRight") {
|
|
51466
51781
|
event.preventDefault();
|
|
@@ -58577,8 +58892,10 @@ var ModuleBar = class extends AppRailPresenter {
|
|
|
58577
58892
|
this._layout();
|
|
58578
58893
|
}
|
|
58579
58894
|
/**
|
|
58580
|
-
* Shows the tiles that fit, in bar order, and moves the rest behind "All modules".
|
|
58581
|
-
* shown first so a bar sized by its content measures as not overflowing
|
|
58895
|
+
* Shows the tiles that fit, in bar order, and moves the rest behind "All modules". Every module
|
|
58896
|
+
* the bar could place is shown first, so a bar sized by its content measures as not overflowing
|
|
58897
|
+
* and never shrinks itself; a module that can only ever be in the catalogue is not, so it takes
|
|
58898
|
+
* no room.
|
|
58582
58899
|
* @returns {void}
|
|
58583
58900
|
*/
|
|
58584
58901
|
_layout() {
|
|
@@ -58588,14 +58905,16 @@ var ModuleBar = class extends AppRailPresenter {
|
|
|
58588
58905
|
const moreRow = list.querySelector(":scope > [data-module-bar-more]");
|
|
58589
58906
|
const mode = this.el.dataset.allModules;
|
|
58590
58907
|
const keep = [moduleOf(this._items, this._active)?.id, this._expandedId, this._promoted];
|
|
58591
|
-
|
|
58908
|
+
const reserve = mode === "always";
|
|
58909
|
+
let partition = partitionModules(this._items, Infinity, keep, reserve);
|
|
58592
58910
|
if (mode !== "never" && list.isConnected) {
|
|
58593
|
-
|
|
58911
|
+
const placeable = new Set(partition.visible.map((item) => String(item.id)));
|
|
58912
|
+
for (const row2 of rows) row2.hidden = !placeable.has(row2.dataset.moduleId);
|
|
58594
58913
|
if (moreRow) moreRow.hidden = false;
|
|
58595
58914
|
syncHeadings(list);
|
|
58596
|
-
|
|
58915
|
+
const space = measureSpace(list, this.el.dataset.orientation === "horizontal");
|
|
58916
|
+
if (space) partition = fitModules(this._items, space, keep, reserve);
|
|
58597
58917
|
}
|
|
58598
|
-
const partition = partitionModules(this._items, capacity, keep, mode === "always");
|
|
58599
58918
|
const visible = new Set(partition.visible.map((item) => String(item.id)));
|
|
58600
58919
|
for (const row2 of rows) row2.hidden = !visible.has(row2.dataset.moduleId);
|
|
58601
58920
|
syncHeadings(list);
|
|
@@ -59059,6 +59378,40 @@ function partitionModules(items, capacity = Infinity, keep = [], reserve = false
|
|
|
59059
59378
|
const overflow = list.filter((item) => !visible.includes(item));
|
|
59060
59379
|
return { visible, overflow, more: overflow.length > 0 };
|
|
59061
59380
|
}
|
|
59381
|
+
function fitModules(items, space, keep = [], reserve = false) {
|
|
59382
|
+
const fits2 = (partition) => barExtent(space, partition.visible, reserve || partition.more) <= space.room + 0.5;
|
|
59383
|
+
const all = partitionModules(items, Infinity, keep, reserve);
|
|
59384
|
+
if (fits2(all)) return all;
|
|
59385
|
+
let low = 1;
|
|
59386
|
+
let high = all.visible.length;
|
|
59387
|
+
while (low < high) {
|
|
59388
|
+
const middle = Math.ceil((low + high) / 2);
|
|
59389
|
+
if (fits2(partitionModules(items, middle, keep, true))) low = middle;
|
|
59390
|
+
else high = middle - 1;
|
|
59391
|
+
}
|
|
59392
|
+
return partitionModules(items, low, keep, true);
|
|
59393
|
+
}
|
|
59394
|
+
function barExtent(space, visible, more) {
|
|
59395
|
+
const shown = new Set(visible.map((item) => String(item.id)));
|
|
59396
|
+
let total = 0;
|
|
59397
|
+
let count2 = 0;
|
|
59398
|
+
let heading = null;
|
|
59399
|
+
for (const entry of space.entries ?? []) {
|
|
59400
|
+
if (entry.heading) {
|
|
59401
|
+
heading = entry;
|
|
59402
|
+
continue;
|
|
59403
|
+
}
|
|
59404
|
+
if (entry.more ? !more : !shown.has(String(entry.id))) continue;
|
|
59405
|
+
if (heading && !entry.more) {
|
|
59406
|
+
total += heading.size;
|
|
59407
|
+
count2 += 1;
|
|
59408
|
+
}
|
|
59409
|
+
heading = null;
|
|
59410
|
+
total += entry.size;
|
|
59411
|
+
count2 += 1;
|
|
59412
|
+
}
|
|
59413
|
+
return total + Math.max(0, count2 - 1) * (space.gap ?? 0);
|
|
59414
|
+
}
|
|
59062
59415
|
function resolveModuleColor(item) {
|
|
59063
59416
|
const color = isCssColor(item?.color) ? String(item.color).trim() : null;
|
|
59064
59417
|
if (color) return { tone: null, color };
|
|
@@ -59116,26 +59469,32 @@ function barOrder(items) {
|
|
|
59116
59469
|
const rank = (item) => typeof item.pinned === "number" && Number.isFinite(item.pinned) ? item.pinned : item.pinned === true ? Number.MAX_SAFE_INTEGER - 1 : Number.MAX_SAFE_INTEGER;
|
|
59117
59470
|
return items.map((item, index) => ({ item, index })).sort((first, second) => rank(first.item) - rank(second.item) || first.index - second.index).map(({ item }) => item);
|
|
59118
59471
|
}
|
|
59119
|
-
function
|
|
59472
|
+
function measureSpace(list, horizontal) {
|
|
59120
59473
|
const overflowing = horizontal ? list.scrollWidth > list.clientWidth + 1 : list.scrollHeight > list.clientHeight + 1;
|
|
59121
|
-
if (!overflowing) return
|
|
59122
|
-
const
|
|
59123
|
-
|
|
59124
|
-
|
|
59125
|
-
|
|
59126
|
-
|
|
59127
|
-
const headings = (
|
|
59128
|
-
/** @type {HTMLElement[]} */
|
|
59129
|
-
[...list.querySelectorAll(":scope > li.zx-module-bar__heading:not([hidden])")]
|
|
59130
|
-
);
|
|
59474
|
+
if (!overflowing) return null;
|
|
59475
|
+
const axis = horizontal ? "Inline" : "Block";
|
|
59476
|
+
const edges = (style2, prefix, suffix = "") => (Number.parseFloat(style2[`${prefix}${axis}Start${suffix}`]) || 0) + (Number.parseFloat(style2[`${prefix}${axis}End${suffix}`]) || 0);
|
|
59477
|
+
const drawn = (element) => element.getBoundingClientRect()[horizontal ? "width" : "height"];
|
|
59478
|
+
const laid = horizontal ? list.offsetWidth : list.offsetHeight;
|
|
59479
|
+
const scale = laid > 0 && drawn(list) > 0 ? drawn(list) / laid : 1;
|
|
59131
59480
|
const style = getComputedStyle(list);
|
|
59481
|
+
const room = laid - edges(style, "padding") - edges(style, "border", "Width");
|
|
59132
59482
|
const gap = Number.parseFloat(horizontal ? style.columnGap : style.rowGap) || 0;
|
|
59133
|
-
const
|
|
59134
|
-
|
|
59135
|
-
|
|
59136
|
-
|
|
59137
|
-
|
|
59138
|
-
|
|
59483
|
+
const entries = [];
|
|
59484
|
+
for (
|
|
59485
|
+
const child of
|
|
59486
|
+
/** @type {HTMLElement[]} */
|
|
59487
|
+
[...list.children]
|
|
59488
|
+
) {
|
|
59489
|
+
const childStyle = getComputedStyle(child);
|
|
59490
|
+
if (child.hidden || childStyle.display === "none") continue;
|
|
59491
|
+
const size2 = drawn(child) / scale + edges(childStyle, "margin");
|
|
59492
|
+
if (child.classList.contains("zx-module-bar__heading")) entries.push({ heading: true, size: size2 });
|
|
59493
|
+
else if (child.hasAttribute("data-module-bar-more")) entries.push({ more: true, size: size2 });
|
|
59494
|
+
else if (child.dataset.moduleId != null) entries.push({ id: child.dataset.moduleId, size: size2 });
|
|
59495
|
+
}
|
|
59496
|
+
if (room <= 0 || !entries.some((entry) => entry.id != null && entry.size > 0)) return null;
|
|
59497
|
+
return { room, gap, entries };
|
|
59139
59498
|
}
|
|
59140
59499
|
function nearestInRow(entries, current, direction) {
|
|
59141
59500
|
const origin = current.getBoundingClientRect();
|
|
@@ -60037,7 +60396,7 @@ var AppSidebar = class extends Component {
|
|
|
60037
60396
|
}
|
|
60038
60397
|
/** @param {EventTarget} target @param {string} type @param {EventListener} listener @returns {void} */
|
|
60039
60398
|
_listenMode(target, type, listener) {
|
|
60040
|
-
|
|
60399
|
+
this.listen(target, type, listener, { signal: this._modeAbort.signal });
|
|
60041
60400
|
}
|
|
60042
60401
|
/** @returns {void} */
|
|
60043
60402
|
_renderTree() {
|
|
@@ -65018,7 +65377,6 @@ var FilterPanel = class extends Component {
|
|
|
65018
65377
|
this._restored = false;
|
|
65019
65378
|
this._entries = [];
|
|
65020
65379
|
this._children = [];
|
|
65021
|
-
this._writing = false;
|
|
65022
65380
|
this._draft = {};
|
|
65023
65381
|
this._applied = {};
|
|
65024
65382
|
this._appliedDraft = "";
|
|
@@ -65221,7 +65579,8 @@ var FilterPanel = class extends Component {
|
|
|
65221
65579
|
this._children.push(checklist);
|
|
65222
65580
|
this._entries.push({ key, write: (value) => checklist.setValues(
|
|
65223
65581
|
/** @type {unknown[]} */
|
|
65224
|
-
value ?? []
|
|
65582
|
+
value ?? [],
|
|
65583
|
+
{ silent: true }
|
|
65225
65584
|
) });
|
|
65226
65585
|
return checklist.toElement();
|
|
65227
65586
|
}
|
|
@@ -65449,7 +65808,6 @@ var FilterPanel = class extends Component {
|
|
|
65449
65808
|
}
|
|
65450
65809
|
/** @param {string} key Field key. @param {unknown} value Raw draft value. @returns {void} */
|
|
65451
65810
|
_edited(key, value) {
|
|
65452
|
-
if (this._writing) return;
|
|
65453
65811
|
this._draft[key] = value;
|
|
65454
65812
|
this._afterEdit(key);
|
|
65455
65813
|
}
|
|
@@ -65460,7 +65818,6 @@ var FilterPanel = class extends Component {
|
|
|
65460
65818
|
* @returns {void}
|
|
65461
65819
|
*/
|
|
65462
65820
|
_editedEdge(key, edge, value) {
|
|
65463
|
-
if (this._writing) return;
|
|
65464
65821
|
const current = this._draft[key];
|
|
65465
65822
|
const range = current !== null && typeof current === "object" && !Array.isArray(current) ? { .../** @type {Record<string, unknown>} */
|
|
65466
65823
|
current } : {};
|
|
@@ -65513,14 +65870,14 @@ var FilterPanel = class extends Component {
|
|
|
65513
65870
|
_draftValue() {
|
|
65514
65871
|
return serializeFilterValue(this._draft, this.options.fields, this.options.serialize, this._timeZone);
|
|
65515
65872
|
}
|
|
65516
|
-
/**
|
|
65873
|
+
/**
|
|
65874
|
+
* Pushes the draft back into the controls without re-entering the edit path: every entry writes
|
|
65875
|
+
* silently (a plain input's `value`, `{silent: true}` to the composed controls), so none of them
|
|
65876
|
+
* reports the write back as an edit.
|
|
65877
|
+
* @returns {void}
|
|
65878
|
+
*/
|
|
65517
65879
|
_writeControls() {
|
|
65518
|
-
this.
|
|
65519
|
-
try {
|
|
65520
|
-
for (const entry of this._entries) entry.write(this._draft[entry.key]);
|
|
65521
|
-
} finally {
|
|
65522
|
-
this._writing = false;
|
|
65523
|
-
}
|
|
65880
|
+
for (const entry of this._entries) entry.write(this._draft[entry.key]);
|
|
65524
65881
|
}
|
|
65525
65882
|
/** @param {Record<string, unknown>} [value] The draft value, when it is already at hand. @returns {void} */
|
|
65526
65883
|
_syncActions(value = this._draftValue()) {
|
|
@@ -66965,7 +67322,7 @@ var ViewSettings = class extends Component {
|
|
|
66965
67322
|
this.unbind();
|
|
66966
67323
|
const controller = new AbortController();
|
|
66967
67324
|
this._bound = { view: candidate, controller };
|
|
66968
|
-
|
|
67325
|
+
this.listen(candidate, "statechange", (event) => {
|
|
66969
67326
|
if (this._syncing) return;
|
|
66970
67327
|
const reason = (
|
|
66971
67328
|
/** @type {CustomEvent} */
|