@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-zeyos.esm.js
CHANGED
|
@@ -2091,7 +2091,10 @@ var Component = class extends EventTarget {
|
|
|
2091
2091
|
return componentEvent;
|
|
2092
2092
|
}
|
|
2093
2093
|
/**
|
|
2094
|
-
* Adds an automatically cleaned-up DOM event listener.
|
|
2094
|
+
* Adds an automatically cleaned-up DOM event listener. It goes when the component is destroyed;
|
|
2095
|
+
* a `signal` in the options shortens its life further, for a listener that belongs to one
|
|
2096
|
+
* rendering of a part — it then goes when that signal aborts or the component is destroyed,
|
|
2097
|
+
* whichever comes first.
|
|
2095
2098
|
* @param {EventTarget} element DOM event target.
|
|
2096
2099
|
* @param {string} type Event name.
|
|
2097
2100
|
* @param {EventListenerOrEventListenerObject} fn Listener.
|
|
@@ -2100,7 +2103,23 @@ var Component = class extends EventTarget {
|
|
|
2100
2103
|
*/
|
|
2101
2104
|
listen(element, type, fn, opts = {}) {
|
|
2102
2105
|
const options = typeof opts === "boolean" ? { capture: opts } : { ...opts };
|
|
2103
|
-
|
|
2106
|
+
const shorter = options.signal;
|
|
2107
|
+
if (shorter?.aborted || this.#abort.signal.aborted) return this;
|
|
2108
|
+
if (!shorter || shorter === this.#abort.signal) {
|
|
2109
|
+
element.addEventListener(type, fn, { ...options, signal: this.#abort.signal });
|
|
2110
|
+
return this;
|
|
2111
|
+
}
|
|
2112
|
+
const link = new AbortController();
|
|
2113
|
+
element.addEventListener(type, fn, { ...options, signal: link.signal });
|
|
2114
|
+
if (options.once) {
|
|
2115
|
+
element.addEventListener(
|
|
2116
|
+
type,
|
|
2117
|
+
() => link.abort(),
|
|
2118
|
+
{ once: true, capture: Boolean(options.capture), signal: link.signal }
|
|
2119
|
+
);
|
|
2120
|
+
}
|
|
2121
|
+
shorter.addEventListener("abort", () => link.abort(), { once: true, signal: link.signal });
|
|
2122
|
+
this.#abort.signal.addEventListener("abort", () => link.abort(), { once: true, signal: link.signal });
|
|
2104
2123
|
return this;
|
|
2105
2124
|
}
|
|
2106
2125
|
/**
|
|
@@ -2601,7 +2620,7 @@ function validateAdapter(adapter) {
|
|
|
2601
2620
|
);
|
|
2602
2621
|
}
|
|
2603
2622
|
function errorAdapter(message4, id) {
|
|
2604
|
-
const el = h("div", { class: "zx-field__error-control", id, role: "alert", tabIndex: -1 }, message4);
|
|
2623
|
+
const el = h("div", { class: "zx-field__error-control", id, role: "alert", tabIndex: -1, dataset: { zxFocus: "container" } }, message4);
|
|
2605
2624
|
return {
|
|
2606
2625
|
el,
|
|
2607
2626
|
get: () => null,
|
|
@@ -2972,25 +2991,36 @@ var Checklist = class extends Component {
|
|
|
2972
2991
|
* and checked as soon as items carrying them arrive — through `setItems()` or the `load`
|
|
2973
2992
|
* loader — so a value set before the items load is not lost.
|
|
2974
2993
|
* @param {Iterable<unknown>|unknown[]} ids Checked item IDs.
|
|
2994
|
+
* @param {ChecklistSetOptions} [options={}] Set `silent` to suppress `change`.
|
|
2975
2995
|
* @returns {this}
|
|
2976
2996
|
* @fires Checklist#change
|
|
2977
2997
|
*/
|
|
2978
|
-
setValues(ids) {
|
|
2998
|
+
setValues(ids, { silent = false } = {}) {
|
|
2979
2999
|
const requested = new Set(ids == null ? [] : Array.from(ids));
|
|
2980
3000
|
const known = new Set(this._items.map((item) => this._itemValue(item)));
|
|
2981
3001
|
const next = new Set([...known].filter((value) => requested.has(value)));
|
|
2982
3002
|
const missing = [...requested].filter((value) => !known.has(value));
|
|
2983
|
-
this._replaceChecked(next, missing.length || this._items.length === 0 ? missing : null);
|
|
3003
|
+
this._replaceChecked(next, missing.length || this._items.length === 0 ? missing : null, silent);
|
|
2984
3004
|
return this;
|
|
2985
3005
|
}
|
|
2986
|
-
/**
|
|
2987
|
-
|
|
2988
|
-
|
|
3006
|
+
/**
|
|
3007
|
+
* Checks every item.
|
|
3008
|
+
* @param {ChecklistSetOptions} [options={}] Set `silent` to suppress `change`.
|
|
3009
|
+
* @returns {this}
|
|
3010
|
+
* @fires Checklist#change
|
|
3011
|
+
*/
|
|
3012
|
+
checkAll({ silent = false } = {}) {
|
|
3013
|
+
this._replaceChecked(new Set(this._items.map((item) => this._itemValue(item))), null, silent);
|
|
2989
3014
|
return this;
|
|
2990
3015
|
}
|
|
2991
|
-
/**
|
|
2992
|
-
|
|
2993
|
-
|
|
3016
|
+
/**
|
|
3017
|
+
* Unchecks every item.
|
|
3018
|
+
* @param {ChecklistSetOptions} [options={}] Set `silent` to suppress `change`.
|
|
3019
|
+
* @returns {this}
|
|
3020
|
+
* @fires Checklist#change
|
|
3021
|
+
*/
|
|
3022
|
+
uncheckAll({ silent = false } = {}) {
|
|
3023
|
+
this._replaceChecked(/* @__PURE__ */ new Set(), null, silent);
|
|
2994
3024
|
return this;
|
|
2995
3025
|
}
|
|
2996
3026
|
/**
|
|
@@ -3106,9 +3136,10 @@ var Checklist = class extends Component {
|
|
|
3106
3136
|
* @param {Set<unknown>} next
|
|
3107
3137
|
* @param {unknown[]|null} pending Requested IDs no item carries yet, or null when no request waits
|
|
3108
3138
|
* for items; an empty array is a request made before any item existed.
|
|
3139
|
+
* @param {boolean} [silent=false] Whether to leave out the `change` event.
|
|
3109
3140
|
* @returns {void}
|
|
3110
3141
|
*/
|
|
3111
|
-
_replaceChecked(next, pending) {
|
|
3142
|
+
_replaceChecked(next, pending, silent = false) {
|
|
3112
3143
|
const nextPending = pending;
|
|
3113
3144
|
const pendingChanged = !setsEqual(new Set(this._pending ?? []), new Set(nextPending ?? []));
|
|
3114
3145
|
const unchanged = setsEqual(this._checked, next) && !pendingChanged;
|
|
@@ -3116,7 +3147,7 @@ var Checklist = class extends Component {
|
|
|
3116
3147
|
if (unchanged) return;
|
|
3117
3148
|
this._checked = next;
|
|
3118
3149
|
this._renderItems();
|
|
3119
|
-
this.emit("change", { values: this.getValues() });
|
|
3150
|
+
if (!silent) this.emit("change", { values: this.getValues() });
|
|
3120
3151
|
}
|
|
3121
3152
|
/** @param {ChecklistItem} item @returns {unknown} */
|
|
3122
3153
|
_itemValue(item) {
|
|
@@ -3153,22 +3184,14 @@ function setsEqual(left, right) {
|
|
|
3153
3184
|
function registerChecklistFieldAdapter() {
|
|
3154
3185
|
Field.register("checklist", (field, options) => {
|
|
3155
3186
|
const checklist = field.own(new Checklist(null, { hideLabel: true, ...options.props ?? {} }));
|
|
3156
|
-
let setting = false;
|
|
3157
3187
|
field.listen(checklist.el, "change", (event) => event.stopImmediatePropagation());
|
|
3158
|
-
checklist.on("change", (event) => {
|
|
3159
|
-
if (!setting) field.emit("change", { value: event.detail.values });
|
|
3160
|
-
});
|
|
3188
|
+
checklist.on("change", (event) => field.emit("change", { value: event.detail.values }));
|
|
3161
3189
|
return {
|
|
3162
3190
|
el: checklist.el,
|
|
3163
3191
|
get: () => checklist.getValues(),
|
|
3164
3192
|
set: (value) => {
|
|
3165
|
-
|
|
3166
|
-
|
|
3167
|
-
if (Array.isArray(value)) checklist.setValues(value);
|
|
3168
|
-
else checklist.uncheckAll();
|
|
3169
|
-
} finally {
|
|
3170
|
-
setting = false;
|
|
3171
|
-
}
|
|
3193
|
+
if (Array.isArray(value)) checklist.setValues(value, { silent: true });
|
|
3194
|
+
else checklist.uncheckAll({ silent: true });
|
|
3172
3195
|
},
|
|
3173
3196
|
focus: () => {
|
|
3174
3197
|
const search = checklist.el.querySelector(".zx-checklist__search:not([hidden]):not([disabled])");
|
|
@@ -3198,6 +3221,7 @@ var CodeEditor = class extends Component {
|
|
|
3198
3221
|
wrap: "off",
|
|
3199
3222
|
spellcheck: false,
|
|
3200
3223
|
readOnly: false,
|
|
3224
|
+
readonly: false,
|
|
3201
3225
|
disabled: false,
|
|
3202
3226
|
status: true
|
|
3203
3227
|
};
|
|
@@ -3212,6 +3236,7 @@ var CodeEditor = class extends Component {
|
|
|
3212
3236
|
this._initialChildren = this._createdRoot ? [] : [...root.childNodes];
|
|
3213
3237
|
this._initialAttributes = new Map(["data-language", "data-readonly", "data-disabled", "data-state"].map((name2) => [name2, root.getAttribute(name2)]));
|
|
3214
3238
|
this._language = normalizeLanguage(this.options.language);
|
|
3239
|
+
const readOnly = Boolean(this.options.readOnly || this.options.readonly);
|
|
3215
3240
|
this._languageLabel = h("span", { class: "zx-code-editor__language" }, this._language);
|
|
3216
3241
|
this._position = h("span", { class: "zx-code-editor__position" });
|
|
3217
3242
|
this._header = h(
|
|
@@ -3229,7 +3254,7 @@ var CodeEditor = class extends Component {
|
|
|
3229
3254
|
rows: normalizeRows(this.options.rows),
|
|
3230
3255
|
wrap: normalizeWrap(this.options.wrap),
|
|
3231
3256
|
spellcheck: Boolean(this.options.spellcheck),
|
|
3232
|
-
readOnly
|
|
3257
|
+
readOnly,
|
|
3233
3258
|
disabled: Boolean(this.options.disabled),
|
|
3234
3259
|
autocomplete: "off",
|
|
3235
3260
|
autocapitalize: "off"
|
|
@@ -3244,7 +3269,7 @@ var CodeEditor = class extends Component {
|
|
|
3244
3269
|
this._committedValue = this._input.value;
|
|
3245
3270
|
this._indentEditing = false;
|
|
3246
3271
|
root.dataset.language = this._language;
|
|
3247
|
-
root.dataset.readonly = String(
|
|
3272
|
+
root.dataset.readonly = String(readOnly);
|
|
3248
3273
|
root.dataset.disabled = String(Boolean(this.options.disabled));
|
|
3249
3274
|
root.replaceChildren(this._header, this._input, this._highlight);
|
|
3250
3275
|
this._tabReleased = false;
|
|
@@ -3357,12 +3382,26 @@ var CodeEditor = class extends Component {
|
|
|
3357
3382
|
this.el.dataset.disabled = "true";
|
|
3358
3383
|
return this;
|
|
3359
3384
|
}
|
|
3360
|
-
/**
|
|
3385
|
+
/**
|
|
3386
|
+
* Makes the text selectable but not editable, or editable again; reflected as `data-readonly` on
|
|
3387
|
+
* the root.
|
|
3388
|
+
* @param {boolean} value Read-only state.
|
|
3389
|
+
* @returns {this}
|
|
3390
|
+
*/
|
|
3361
3391
|
setReadOnly(value) {
|
|
3362
3392
|
this._input.readOnly = Boolean(value);
|
|
3363
3393
|
this.el.dataset.readonly = String(Boolean(value));
|
|
3364
3394
|
return this;
|
|
3365
3395
|
}
|
|
3396
|
+
/**
|
|
3397
|
+
* `setReadOnly()` under the spelling every other Zx control uses (`Field#setReadonly()`,
|
|
3398
|
+
* `NumberField#setReadonly()`, `TagPicker#setReadonly()`); the two are interchangeable.
|
|
3399
|
+
* @param {boolean} value Read-only state.
|
|
3400
|
+
* @returns {this}
|
|
3401
|
+
*/
|
|
3402
|
+
setReadonly(value) {
|
|
3403
|
+
return this.setReadOnly(value);
|
|
3404
|
+
}
|
|
3366
3405
|
/** @param {KeyboardEvent} event @returns {void} */
|
|
3367
3406
|
_handleKeydown(event) {
|
|
3368
3407
|
if (event.isComposing || MODIFIER_KEYS.has(event.key)) return;
|
|
@@ -3619,7 +3658,7 @@ function parseDate(str, fmt) {
|
|
|
3619
3658
|
let pattern = "^";
|
|
3620
3659
|
let cursor = 0;
|
|
3621
3660
|
for (const match of String(fmt).matchAll(TOKEN_PATTERN)) {
|
|
3622
|
-
pattern +=
|
|
3661
|
+
pattern += escapeRegExp(String(fmt).slice(cursor, match.index));
|
|
3623
3662
|
const token = match[0];
|
|
3624
3663
|
const tokenPattern = numericPattern(token);
|
|
3625
3664
|
if (tokenPattern === null) return null;
|
|
@@ -3627,7 +3666,7 @@ function parseDate(str, fmt) {
|
|
|
3627
3666
|
fields.push(token);
|
|
3628
3667
|
cursor = match.index + token.length;
|
|
3629
3668
|
}
|
|
3630
|
-
pattern +=
|
|
3669
|
+
pattern += escapeRegExp(String(fmt).slice(cursor)) + "$";
|
|
3631
3670
|
const matched = new RegExp(pattern).exec(String(str));
|
|
3632
3671
|
if (!matched) return null;
|
|
3633
3672
|
const values = /* @__PURE__ */ Object.create(null);
|
|
@@ -3738,9 +3777,6 @@ function yearFromTwoDigits(year) {
|
|
|
3738
3777
|
if (year === void 0) return void 0;
|
|
3739
3778
|
return year >= 69 ? 1900 + year : 2e3 + year;
|
|
3740
3779
|
}
|
|
3741
|
-
function escapeRegExp2(value) {
|
|
3742
|
-
return value.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
3743
|
-
}
|
|
3744
3780
|
|
|
3745
3781
|
// src/core/fontawesome.js
|
|
3746
3782
|
var faStyles = Object.freeze({
|
|
@@ -7388,6 +7424,18 @@ var FieldUpload = class extends Component {
|
|
|
7388
7424
|
this.el.dataset.disabled = String(this._disabled);
|
|
7389
7425
|
return this;
|
|
7390
7426
|
}
|
|
7427
|
+
/** Disables file selection and dropping; the same as `setDisabled(true)`. @returns {this} */
|
|
7428
|
+
disable() {
|
|
7429
|
+
return this.setDisabled(true);
|
|
7430
|
+
}
|
|
7431
|
+
/** Enables file selection and dropping; the same as `setDisabled(false)`. @returns {this} */
|
|
7432
|
+
enable() {
|
|
7433
|
+
return this.setDisabled(false);
|
|
7434
|
+
}
|
|
7435
|
+
/** Whether file selection and dropping are disabled. @returns {boolean} */
|
|
7436
|
+
isDisabled() {
|
|
7437
|
+
return this._disabled;
|
|
7438
|
+
}
|
|
7391
7439
|
/** @param {FileList|File[]|ArrayLike<File>} files @returns {void} */
|
|
7392
7440
|
_selectFiles(files) {
|
|
7393
7441
|
if (!this._setFiles(files)) return;
|
|
@@ -7664,7 +7712,7 @@ var PARTS = Object.freeze({
|
|
|
7664
7712
|
var MultiValueEditor = class extends Component {
|
|
7665
7713
|
static cssName = "multi-value-editor";
|
|
7666
7714
|
/** @type {MultiValueEditorOptions} */
|
|
7667
|
-
static defaults = { values: [], options: null, addLabel: null, reorder: "both" };
|
|
7715
|
+
static defaults = { values: [], options: null, addLabel: null, reorder: "both", disabled: false };
|
|
7668
7716
|
/** @returns {HTMLElement} */
|
|
7669
7717
|
render() {
|
|
7670
7718
|
const root = (
|
|
@@ -7675,6 +7723,8 @@ var MultiValueEditor = class extends Component {
|
|
|
7675
7723
|
this._values = Array.isArray(this.options.values) ? this.options.values.map(String) : [];
|
|
7676
7724
|
this._ownedNodes = [];
|
|
7677
7725
|
this._initialState = root.getAttribute("data-state");
|
|
7726
|
+
this._initialAriaDisabled = root.getAttribute("aria-disabled");
|
|
7727
|
+
this._disabled = Boolean(this.options.disabled);
|
|
7678
7728
|
this._dragIndex = -1;
|
|
7679
7729
|
this._armed = null;
|
|
7680
7730
|
this._rows = h("div", { class: "zx-multi-value-editor__rows" });
|
|
@@ -7699,6 +7749,7 @@ var MultiValueEditor = class extends Component {
|
|
|
7699
7749
|
this.listen(document, "pointercancel", () => this._disarm());
|
|
7700
7750
|
}
|
|
7701
7751
|
this._renderRows();
|
|
7752
|
+
this._syncDisabled();
|
|
7702
7753
|
return root;
|
|
7703
7754
|
}
|
|
7704
7755
|
/**
|
|
@@ -7720,6 +7771,46 @@ var MultiValueEditor = class extends Component {
|
|
|
7720
7771
|
if (!silent) this.emit("change", { values: this.getValues() });
|
|
7721
7772
|
return this;
|
|
7722
7773
|
}
|
|
7774
|
+
/**
|
|
7775
|
+
* Disables or enables the editor. Disabled, every value input or select, drag handle, move and
|
|
7776
|
+
* remove button and the add button is disabled, the root carries `aria-disabled="true"`, and
|
|
7777
|
+
* neither a pointer nor the handle's keys reorder anything. `setValues()` still works, and rows
|
|
7778
|
+
* it renders stay disabled.
|
|
7779
|
+
* @param {boolean} disabled Disabled state.
|
|
7780
|
+
* @returns {this}
|
|
7781
|
+
*/
|
|
7782
|
+
setDisabled(disabled) {
|
|
7783
|
+
this._disabled = Boolean(disabled);
|
|
7784
|
+
this._syncDisabled();
|
|
7785
|
+
return this;
|
|
7786
|
+
}
|
|
7787
|
+
/** Disables the editor; see `setDisabled()`. @returns {this} */
|
|
7788
|
+
disable() {
|
|
7789
|
+
return this.setDisabled(true);
|
|
7790
|
+
}
|
|
7791
|
+
/** Enables the editor. @returns {this} */
|
|
7792
|
+
enable() {
|
|
7793
|
+
return this.setDisabled(false);
|
|
7794
|
+
}
|
|
7795
|
+
/** Whether the editor is disabled. @returns {boolean} */
|
|
7796
|
+
isDisabled() {
|
|
7797
|
+
return this._disabled;
|
|
7798
|
+
}
|
|
7799
|
+
/**
|
|
7800
|
+
* Applies the disabled state to the controls in place rather than re-rendering them, so a value
|
|
7801
|
+
* typed into a row and not yet committed survives.
|
|
7802
|
+
* @returns {void}
|
|
7803
|
+
*/
|
|
7804
|
+
_syncDisabled() {
|
|
7805
|
+
if (this._disabled) {
|
|
7806
|
+
this.el.setAttribute("aria-disabled", "true");
|
|
7807
|
+
this._disarm();
|
|
7808
|
+
} else this.el.removeAttribute("aria-disabled");
|
|
7809
|
+
this._add.disabled = this._disabled;
|
|
7810
|
+
for (const control of this._rows.querySelectorAll("input, select, button")) {
|
|
7811
|
+
control.disabled = this._disabled;
|
|
7812
|
+
}
|
|
7813
|
+
}
|
|
7723
7814
|
/** @returns {{drag: boolean, buttons: boolean}} */
|
|
7724
7815
|
_reorder() {
|
|
7725
7816
|
return REORDER[this.options.reorder] ?? REORDER.both;
|
|
@@ -7739,6 +7830,7 @@ var MultiValueEditor = class extends Component {
|
|
|
7739
7830
|
const control = useSelect ? h("select", {
|
|
7740
7831
|
class: "zx-multi-value-editor__value",
|
|
7741
7832
|
ariaLabel: this.msg("multiValueEditor.value", index + 1),
|
|
7833
|
+
disabled: this._disabled,
|
|
7742
7834
|
dataset: { index }
|
|
7743
7835
|
}, entries.map(([optionValue, label]) => h("option", {
|
|
7744
7836
|
value: optionValue,
|
|
@@ -7748,6 +7840,7 @@ var MultiValueEditor = class extends Component {
|
|
|
7748
7840
|
type: "text",
|
|
7749
7841
|
value,
|
|
7750
7842
|
ariaLabel: this.msg("multiValueEditor.value", index + 1),
|
|
7843
|
+
disabled: this._disabled,
|
|
7751
7844
|
dataset: { index }
|
|
7752
7845
|
});
|
|
7753
7846
|
return h(
|
|
@@ -7757,6 +7850,7 @@ var MultiValueEditor = class extends Component {
|
|
|
7757
7850
|
class: "zx-multi-value-editor__handle",
|
|
7758
7851
|
type: "button",
|
|
7759
7852
|
ariaLabel: this.msg("multiValueEditor.reorder", index + 1),
|
|
7853
|
+
disabled: this._disabled,
|
|
7760
7854
|
dataset: { action: "grab", index }
|
|
7761
7855
|
}, icon("drag", { size: 12 })) : null,
|
|
7762
7856
|
control,
|
|
@@ -7770,6 +7864,7 @@ var MultiValueEditor = class extends Component {
|
|
|
7770
7864
|
// control that disables itself under the reader's finger drops focus to the document.
|
|
7771
7865
|
ariaDisabled: String(index === 0),
|
|
7772
7866
|
ariaLabel: this.msg("multiValueEditor.moveUp", index + 1),
|
|
7867
|
+
disabled: this._disabled,
|
|
7773
7868
|
dataset: { action: "up", index }
|
|
7774
7869
|
}, icon("chevron-up", { size: ICON_SIZE.chevron })) : null,
|
|
7775
7870
|
buttons ? h("button", {
|
|
@@ -7777,12 +7872,14 @@ var MultiValueEditor = class extends Component {
|
|
|
7777
7872
|
type: "button",
|
|
7778
7873
|
ariaDisabled: String(index === last),
|
|
7779
7874
|
ariaLabel: this.msg("multiValueEditor.moveDown", index + 1),
|
|
7875
|
+
disabled: this._disabled,
|
|
7780
7876
|
dataset: { action: "down", index }
|
|
7781
7877
|
}, icon("chevron-down", { size: ICON_SIZE.chevron })) : null,
|
|
7782
7878
|
h("button", {
|
|
7783
7879
|
class: "zx-btn",
|
|
7784
7880
|
type: "button",
|
|
7785
7881
|
ariaLabel: this.msg("multiValueEditor.remove", index + 1),
|
|
7882
|
+
disabled: this._disabled,
|
|
7786
7883
|
dataset: { action: "remove", index }
|
|
7787
7884
|
}, icon("x", { size: ICON_SIZE.dismiss }))
|
|
7788
7885
|
)
|
|
@@ -7797,7 +7894,7 @@ var MultiValueEditor = class extends Component {
|
|
|
7797
7894
|
/** @param {MouseEvent} event @returns {void} */
|
|
7798
7895
|
_handleClick(event) {
|
|
7799
7896
|
const button2 = event.target instanceof Element ? event.target.closest("[data-action]") : null;
|
|
7800
|
-
if (!button2 || !this.el.contains(button2)) return;
|
|
7897
|
+
if (this._disabled || !button2 || !this.el.contains(button2)) return;
|
|
7801
7898
|
if (button2.getAttribute("aria-disabled") === "true") return;
|
|
7802
7899
|
const action = button2.dataset.action;
|
|
7803
7900
|
const index = Number(button2.dataset.index);
|
|
@@ -7831,7 +7928,7 @@ var MultiValueEditor = class extends Component {
|
|
|
7831
7928
|
*/
|
|
7832
7929
|
_handleKeydown(event) {
|
|
7833
7930
|
const handle = event.target instanceof Element ? event.target.closest(".zx-multi-value-editor__handle") : null;
|
|
7834
|
-
if (!handle) return;
|
|
7931
|
+
if (!handle || this._disabled) return;
|
|
7835
7932
|
const index = Number(handle.dataset.index);
|
|
7836
7933
|
const target = event.key === "ArrowUp" ? index - 1 : event.key === "ArrowDown" ? index + 1 : event.key === "Home" ? 0 : event.key === "End" ? this._values.length - 1 : -1;
|
|
7837
7934
|
if (target < 0 || target >= this._values.length) return;
|
|
@@ -7847,7 +7944,7 @@ var MultiValueEditor = class extends Component {
|
|
|
7847
7944
|
_handlePointerDown(event) {
|
|
7848
7945
|
const handle = event.target instanceof Element ? event.target.closest(".zx-multi-value-editor__handle") : null;
|
|
7849
7946
|
this._disarm();
|
|
7850
|
-
if (!handle || handle.disabled) return;
|
|
7947
|
+
if (!handle || handle.disabled || this._disabled) return;
|
|
7851
7948
|
const row = (
|
|
7852
7949
|
/** @type {HTMLElement|null} */
|
|
7853
7950
|
handle.closest(".zx-multi-value-editor__row")
|
|
@@ -7946,7 +8043,7 @@ var MultiValueEditor = class extends Component {
|
|
|
7946
8043
|
*/
|
|
7947
8044
|
_move(from, to, part) {
|
|
7948
8045
|
const size = this._values.length;
|
|
7949
|
-
if (from === to || from < 0 || to < 0 || from >= size || to >= size) return false;
|
|
8046
|
+
if (this._disabled || from === to || from < 0 || to < 0 || from >= size || to >= size) return false;
|
|
7950
8047
|
const [value] = this._values.splice(from, 1);
|
|
7951
8048
|
this._values.splice(to, 0, value);
|
|
7952
8049
|
this._renderRows(to, part);
|
|
@@ -7961,6 +8058,8 @@ var MultiValueEditor = class extends Component {
|
|
|
7961
8058
|
destroy() {
|
|
7962
8059
|
if (this._initialState === null) this.el?.removeAttribute("data-state");
|
|
7963
8060
|
else this.el?.setAttribute("data-state", this._initialState);
|
|
8061
|
+
if (this._initialAriaDisabled === null) this.el?.removeAttribute("aria-disabled");
|
|
8062
|
+
else this.el?.setAttribute("aria-disabled", this._initialAriaDisabled);
|
|
7964
8063
|
for (const node of this._ownedNodes ?? []) node.remove();
|
|
7965
8064
|
super.destroy();
|
|
7966
8065
|
}
|
|
@@ -7980,33 +8079,19 @@ function registerMultiValueEditorFieldAdapter() {
|
|
|
7980
8079
|
...options.props ?? {},
|
|
7981
8080
|
values: Array.isArray(options.value) ? options.value : []
|
|
7982
8081
|
}));
|
|
7983
|
-
const originalDisabled = /* @__PURE__ */ new WeakMap();
|
|
7984
|
-
let disabled = false;
|
|
7985
|
-
const syncDisabled = () => {
|
|
7986
|
-
editor.el.setAttribute("aria-disabled", String(disabled));
|
|
7987
|
-
for (const control of editor.el.querySelectorAll("input, button, select, textarea")) {
|
|
7988
|
-
if (disabled) {
|
|
7989
|
-
if (!originalDisabled.has(control)) originalDisabled.set(control, Boolean(control.disabled));
|
|
7990
|
-
control.disabled = true;
|
|
7991
|
-
} else if (originalDisabled.has(control)) {
|
|
7992
|
-
control.disabled = originalDisabled.get(control);
|
|
7993
|
-
originalDisabled.delete(control);
|
|
7994
|
-
}
|
|
7995
|
-
}
|
|
7996
|
-
};
|
|
7997
8082
|
field.listen(editor.el, "change", (event) => event.stopImmediatePropagation());
|
|
7998
8083
|
editor.on("change", (event) => field.emit("change", { value: event.detail.values }));
|
|
7999
8084
|
return {
|
|
8000
8085
|
el: editor.el,
|
|
8001
8086
|
get: () => editor.getValues(),
|
|
8002
|
-
|
|
8003
|
-
|
|
8004
|
-
|
|
8005
|
-
|
|
8006
|
-
|
|
8087
|
+
// Rows the editor renders while disabled are rendered disabled, so a value set on a
|
|
8088
|
+
// disabled field needs nothing more.
|
|
8089
|
+
set: (value) => editor.setValues(Array.isArray(value) ? value : [], { silent: true }),
|
|
8090
|
+
// The first value, else the first control: a selector list matches in document order, which
|
|
8091
|
+
// would put the drag handle ahead of the value it belongs to.
|
|
8092
|
+
focus: () => (editor.el.querySelector(".zx-multi-value-editor__value:not([disabled])") ?? editor.el.querySelector("button:not([disabled])"))?.focus(),
|
|
8007
8093
|
setDisabled: (value) => {
|
|
8008
|
-
|
|
8009
|
-
syncDisabled();
|
|
8094
|
+
editor.setDisabled(value);
|
|
8010
8095
|
}
|
|
8011
8096
|
};
|
|
8012
8097
|
});
|
|
@@ -9664,6 +9749,7 @@ var Select = class _Select extends Component {
|
|
|
9664
9749
|
this._loading = false;
|
|
9665
9750
|
this._requestSequence = 0;
|
|
9666
9751
|
this._queryTimer = null;
|
|
9752
|
+
this._queryController = null;
|
|
9667
9753
|
this._position = null;
|
|
9668
9754
|
this._createdRoot = false;
|
|
9669
9755
|
this._root = null;
|
|
@@ -10192,9 +10278,10 @@ var Select = class _Select extends Component {
|
|
|
10192
10278
|
* `true` for public, or a group ID — so the control binds straight to the record field.
|
|
10193
10279
|
*
|
|
10194
10280
|
* @param {Element|string|null} target Component target.
|
|
10195
|
-
* @param {SelectOptions & {groups?: SelectItem[]|
|
|
10281
|
+
* @param {SelectOptions & {groups?: SelectItem[]|SelectFilter}} [options={}]
|
|
10196
10282
|
* Select overrides other than the fixed choices; `groups` holds the shareable groups, either as
|
|
10197
|
-
* an array (filtered locally) or as a loader function (queried remotely
|
|
10283
|
+
* an array (filtered locally) or as a loader function (queried remotely, and handed the same
|
|
10284
|
+
* `{signal}` as any `filter` function).
|
|
10198
10285
|
* @returns {Select}
|
|
10199
10286
|
*/
|
|
10200
10287
|
static permission(target, options = {}) {
|
|
@@ -10479,6 +10566,8 @@ var Select = class _Select extends Component {
|
|
|
10479
10566
|
if (this._queryTimer !== null) clearTimeout(this._queryTimer);
|
|
10480
10567
|
this._requestSequence += 1;
|
|
10481
10568
|
const sequence = this._requestSequence;
|
|
10569
|
+
this._abortQuery();
|
|
10570
|
+
if (sequence !== this._requestSequence) return;
|
|
10482
10571
|
this._visibleFixed = this._matchFixed(query);
|
|
10483
10572
|
if (query.length < Math.max(0, Number(this.options.minQuery) || 0)) {
|
|
10484
10573
|
this._setLoading(false);
|
|
@@ -10498,9 +10587,15 @@ var Select = class _Select extends Component {
|
|
|
10498
10587
|
/** @param {string} query @param {number} sequence @returns {Promise<void>} */
|
|
10499
10588
|
async _runAsyncQuery(query, sequence) {
|
|
10500
10589
|
if (sequence !== this._requestSequence || typeof this.options.filter !== "function") return;
|
|
10590
|
+
const controller = new AbortController();
|
|
10591
|
+
this._queryController = controller;
|
|
10501
10592
|
this.emit("query", { query });
|
|
10593
|
+
if (sequence !== this._requestSequence || controller.signal.aborted) {
|
|
10594
|
+
if (this._queryController === controller) this._queryController = null;
|
|
10595
|
+
return;
|
|
10596
|
+
}
|
|
10502
10597
|
try {
|
|
10503
|
-
const result = await this.options.filter(query);
|
|
10598
|
+
const result = await this.options.filter(query, { signal: controller.signal });
|
|
10504
10599
|
if (sequence !== this._requestSequence || !this._open) return;
|
|
10505
10600
|
this._items = Array.isArray(result) ? result.slice() : [];
|
|
10506
10601
|
this._visibleItems = this._items.slice();
|
|
@@ -10516,6 +10611,8 @@ var Select = class _Select extends Component {
|
|
|
10516
10611
|
this._setLoading(false);
|
|
10517
10612
|
this._renderOptions();
|
|
10518
10613
|
this._position?.update();
|
|
10614
|
+
} finally {
|
|
10615
|
+
if (this._queryController === controller) this._queryController = null;
|
|
10519
10616
|
}
|
|
10520
10617
|
}
|
|
10521
10618
|
/** @returns {void} */
|
|
@@ -10523,6 +10620,17 @@ var Select = class _Select extends Component {
|
|
|
10523
10620
|
if (this._queryTimer !== null) clearTimeout(this._queryTimer);
|
|
10524
10621
|
this._queryTimer = null;
|
|
10525
10622
|
this._requestSequence += 1;
|
|
10623
|
+
this._abortQuery();
|
|
10624
|
+
}
|
|
10625
|
+
/**
|
|
10626
|
+
* Aborts the signal handed to the filter for the request in flight. Callers move the sequence on
|
|
10627
|
+
* first, so whatever the aborted request resolves or rejects with is already stale.
|
|
10628
|
+
* @returns {void}
|
|
10629
|
+
*/
|
|
10630
|
+
_abortQuery() {
|
|
10631
|
+
const controller = this._queryController;
|
|
10632
|
+
this._queryController = null;
|
|
10633
|
+
controller?.abort();
|
|
10526
10634
|
}
|
|
10527
10635
|
/** @param {boolean} loading @returns {void} */
|
|
10528
10636
|
_setLoading(loading) {
|
|
@@ -11255,6 +11363,7 @@ var TagPicker = class extends Component {
|
|
|
11255
11363
|
this._loading = false;
|
|
11256
11364
|
this._requestSequence = 0;
|
|
11257
11365
|
this._queryTimer = null;
|
|
11366
|
+
this._queryController = null;
|
|
11258
11367
|
this._position = null;
|
|
11259
11368
|
this._activeId = null;
|
|
11260
11369
|
this._createdRoot = this.el === null;
|
|
@@ -11815,7 +11924,7 @@ var TagPicker = class extends Component {
|
|
|
11815
11924
|
}
|
|
11816
11925
|
/** @param {string} query @returns {void} */
|
|
11817
11926
|
_scheduleAsyncQuery(query) {
|
|
11818
|
-
this._cancelQuery();
|
|
11927
|
+
if (this._cancelQuery() !== this._requestSequence) return;
|
|
11819
11928
|
const text3 = String(query ?? "");
|
|
11820
11929
|
if (text3.length < Number(this.options.minQuery ?? 0)) {
|
|
11821
11930
|
this._visible = [];
|
|
@@ -11836,10 +11945,16 @@ var TagPicker = class extends Component {
|
|
|
11836
11945
|
const sequence = this._requestSequence + 1;
|
|
11837
11946
|
this._requestSequence = sequence;
|
|
11838
11947
|
this._setLoading(true);
|
|
11948
|
+
const controller = new AbortController();
|
|
11949
|
+
this._queryController = controller;
|
|
11839
11950
|
this.emit("query", { query });
|
|
11951
|
+
if (sequence !== this._requestSequence || controller.signal.aborted) {
|
|
11952
|
+
if (this._queryController === controller) this._queryController = null;
|
|
11953
|
+
return;
|
|
11954
|
+
}
|
|
11840
11955
|
try {
|
|
11841
|
-
const result = await /** @type {
|
|
11842
|
-
this.options.filter(query);
|
|
11956
|
+
const result = await /** @type {TagPickerFilter} */
|
|
11957
|
+
this.options.filter(query, { signal: controller.signal });
|
|
11843
11958
|
if (sequence !== this._requestSequence) return;
|
|
11844
11959
|
this._items = Array.isArray(result) ? result.slice() : [];
|
|
11845
11960
|
this._visible = this._items.slice();
|
|
@@ -11854,16 +11969,21 @@ var TagPicker = class extends Component {
|
|
|
11854
11969
|
this._setActive(this._entries.length > 0 ? 0 : -1);
|
|
11855
11970
|
this._position?.update();
|
|
11856
11971
|
}
|
|
11972
|
+
if (this._queryController === controller) this._queryController = null;
|
|
11857
11973
|
}
|
|
11858
11974
|
}
|
|
11859
|
-
/** @returns {
|
|
11975
|
+
/** @returns {number} The request generation this cancellation started. */
|
|
11860
11976
|
_cancelQuery() {
|
|
11861
11977
|
if (this._queryTimer !== null) {
|
|
11862
11978
|
clearTimeout(this._queryTimer);
|
|
11863
11979
|
this._queryTimer = null;
|
|
11864
11980
|
}
|
|
11865
|
-
this._requestSequence
|
|
11866
|
-
this.
|
|
11981
|
+
const sequence = ++this._requestSequence;
|
|
11982
|
+
const controller = this._queryController;
|
|
11983
|
+
this._queryController = null;
|
|
11984
|
+
controller?.abort();
|
|
11985
|
+
if (sequence === this._requestSequence) this._setLoading(false);
|
|
11986
|
+
return sequence;
|
|
11867
11987
|
}
|
|
11868
11988
|
/** @param {boolean} loading @returns {void} */
|
|
11869
11989
|
_setLoading(loading) {
|
|
@@ -12161,6 +12281,16 @@ var Timebox = class extends Component {
|
|
|
12161
12281
|
if (!options.silent) this._emitChange();
|
|
12162
12282
|
return this;
|
|
12163
12283
|
}
|
|
12284
|
+
/**
|
|
12285
|
+
* Moves focus to the hours segment, the first one a duration is typed into (the sign toggle of a
|
|
12286
|
+
* `signed` timebox sits before it and stays one Shift+Tab away). Focusing selects the segment's
|
|
12287
|
+
* digits, as a click into it does. A disabled timebox does not take focus.
|
|
12288
|
+
* @returns {this}
|
|
12289
|
+
*/
|
|
12290
|
+
focus() {
|
|
12291
|
+
this._inputs[0]?.focus();
|
|
12292
|
+
return this;
|
|
12293
|
+
}
|
|
12164
12294
|
/** Enables the timebox. @returns {this} */
|
|
12165
12295
|
enable() {
|
|
12166
12296
|
this._disabled = false;
|
|
@@ -12221,9 +12351,10 @@ var Timebox = class extends Component {
|
|
|
12221
12351
|
}
|
|
12222
12352
|
/** @returns {void} */
|
|
12223
12353
|
_commitSegments() {
|
|
12354
|
+
const before = this._committed;
|
|
12224
12355
|
this._parts = this._readParts();
|
|
12225
12356
|
this._writeParts();
|
|
12226
|
-
this._emitChange();
|
|
12357
|
+
if (this._committed !== before) this._emitChange();
|
|
12227
12358
|
}
|
|
12228
12359
|
/** @returns {void} */
|
|
12229
12360
|
_writeParts() {
|
|
@@ -12231,6 +12362,7 @@ var Timebox = class extends Component {
|
|
|
12231
12362
|
const name2 = input.dataset.segment;
|
|
12232
12363
|
input.value = name2 === "hours" ? String(this._parts[name2]) : pad3(this._parts[name2]);
|
|
12233
12364
|
}
|
|
12365
|
+
this._committed = joinTime(this._parts, this.options.unit);
|
|
12234
12366
|
if (this.refs.sign) {
|
|
12235
12367
|
this.refs.sign.textContent = this._parts.negative ? "-" : "+";
|
|
12236
12368
|
this.refs.sign.setAttribute("aria-pressed", String(this._parts.negative));
|
|
@@ -13895,6 +14027,9 @@ var Table = class extends Component {
|
|
|
13895
14027
|
this._scroll = h("div", {
|
|
13896
14028
|
class: "zx-table__scroll",
|
|
13897
14029
|
dataset: {
|
|
14030
|
+
// A scroller with nothing focusable inside is a Tab stop of the browser's making: it keeps
|
|
14031
|
+
// an inset ring there, and none while it holds focus for a table with no rows.
|
|
14032
|
+
zxFocus: "region",
|
|
13898
14033
|
stickyHeader: String(Boolean(this.options.stickyHeader)),
|
|
13899
14034
|
// Stripes follow the row's place in the data while windowed: `:nth-child` would count the
|
|
13900
14035
|
// spacers, and the stripes would swap as the window moved.
|
|
@@ -16246,11 +16381,13 @@ var Table = class extends Component {
|
|
|
16246
16381
|
if (!frame.hasAttribute("tabindex")) {
|
|
16247
16382
|
frame.tabIndex = -1;
|
|
16248
16383
|
frame.setAttribute("data-empty-focus", "");
|
|
16384
|
+
frame.dataset.zxFocus = "container";
|
|
16249
16385
|
}
|
|
16250
16386
|
frame.focus({ preventScroll: true });
|
|
16251
16387
|
} else if (frame.hasAttribute("data-empty-focus")) {
|
|
16252
16388
|
frame.removeAttribute("tabindex");
|
|
16253
16389
|
frame.removeAttribute("data-empty-focus");
|
|
16390
|
+
frame.dataset.zxFocus = "region";
|
|
16254
16391
|
}
|
|
16255
16392
|
}
|
|
16256
16393
|
/** @param {Event} event @returns {void} */
|
|
@@ -20066,11 +20203,23 @@ var Dropdown = class extends Component {
|
|
|
20066
20203
|
render() {
|
|
20067
20204
|
const panel = h("div", {
|
|
20068
20205
|
id: uid("zx-dropdown"),
|
|
20069
|
-
popover: "manual"
|
|
20206
|
+
popover: "manual",
|
|
20207
|
+
// A surface, not a control: it draws no ring when a script focuses it (`#syncFocusMarker()`).
|
|
20208
|
+
dataset: { zxFocus: "container" }
|
|
20070
20209
|
});
|
|
20071
20210
|
panel.dataset.state = "closed";
|
|
20072
20211
|
return panel;
|
|
20073
20212
|
}
|
|
20213
|
+
/**
|
|
20214
|
+
* A panel the application put in the Tab order (`tabindex` of 0 or more) is reached from its
|
|
20215
|
+
* anchor's Tab, so it shows keyboard focus as a region, with the ring inside its edge; otherwise
|
|
20216
|
+
* only a script focuses it and it draws no ring.
|
|
20217
|
+
* @returns {void}
|
|
20218
|
+
*/
|
|
20219
|
+
#syncFocusMarker() {
|
|
20220
|
+
const reachable = this.el.hasAttribute("tabindex") && this.el.tabIndex >= 0;
|
|
20221
|
+
this.el.dataset.zxFocus = reachable ? "region" : "container";
|
|
20222
|
+
}
|
|
20074
20223
|
/**
|
|
20075
20224
|
* Opens and positions the panel.
|
|
20076
20225
|
* @returns {this}
|
|
@@ -20080,6 +20229,7 @@ var Dropdown = class extends Component {
|
|
|
20080
20229
|
if (this.isOpen() || this.#destroyed) return this;
|
|
20081
20230
|
const host = this.#host();
|
|
20082
20231
|
if (this.el.parentElement !== host) host.append(this.el);
|
|
20232
|
+
this.#syncFocusMarker();
|
|
20083
20233
|
this.#position = position(this.#anchor, this.el, {
|
|
20084
20234
|
placement: this.options.placement,
|
|
20085
20235
|
offset: Number(this.options.offset),
|
|
@@ -21441,8 +21591,10 @@ var ModuleBar = class extends AppRailPresenter {
|
|
|
21441
21591
|
this._layout();
|
|
21442
21592
|
}
|
|
21443
21593
|
/**
|
|
21444
|
-
* Shows the tiles that fit, in bar order, and moves the rest behind "All modules".
|
|
21445
|
-
* shown first so a bar sized by its content measures as not overflowing
|
|
21594
|
+
* Shows the tiles that fit, in bar order, and moves the rest behind "All modules". Every module
|
|
21595
|
+
* the bar could place is shown first, so a bar sized by its content measures as not overflowing
|
|
21596
|
+
* and never shrinks itself; a module that can only ever be in the catalogue is not, so it takes
|
|
21597
|
+
* no room.
|
|
21446
21598
|
* @returns {void}
|
|
21447
21599
|
*/
|
|
21448
21600
|
_layout() {
|
|
@@ -21452,14 +21604,16 @@ var ModuleBar = class extends AppRailPresenter {
|
|
|
21452
21604
|
const moreRow = list.querySelector(":scope > [data-module-bar-more]");
|
|
21453
21605
|
const mode = this.el.dataset.allModules;
|
|
21454
21606
|
const keep = [moduleOf(this._items, this._active)?.id, this._expandedId, this._promoted];
|
|
21455
|
-
|
|
21607
|
+
const reserve = mode === "always";
|
|
21608
|
+
let partition = partitionModules(this._items, Infinity, keep, reserve);
|
|
21456
21609
|
if (mode !== "never" && list.isConnected) {
|
|
21457
|
-
|
|
21610
|
+
const placeable = new Set(partition.visible.map((item) => String(item.id)));
|
|
21611
|
+
for (const row of rows) row.hidden = !placeable.has(row.dataset.moduleId);
|
|
21458
21612
|
if (moreRow) moreRow.hidden = false;
|
|
21459
21613
|
syncHeadings(list);
|
|
21460
|
-
|
|
21614
|
+
const space = measureSpace(list, this.el.dataset.orientation === "horizontal");
|
|
21615
|
+
if (space) partition = fitModules(this._items, space, keep, reserve);
|
|
21461
21616
|
}
|
|
21462
|
-
const partition = partitionModules(this._items, capacity, keep, mode === "always");
|
|
21463
21617
|
const visible = new Set(partition.visible.map((item) => String(item.id)));
|
|
21464
21618
|
for (const row of rows) row.hidden = !visible.has(row.dataset.moduleId);
|
|
21465
21619
|
syncHeadings(list);
|
|
@@ -21923,6 +22077,40 @@ function partitionModules(items, capacity = Infinity, keep = [], reserve = false
|
|
|
21923
22077
|
const overflow = list.filter((item) => !visible.includes(item));
|
|
21924
22078
|
return { visible, overflow, more: overflow.length > 0 };
|
|
21925
22079
|
}
|
|
22080
|
+
function fitModules(items, space, keep = [], reserve = false) {
|
|
22081
|
+
const fits = (partition) => barExtent(space, partition.visible, reserve || partition.more) <= space.room + 0.5;
|
|
22082
|
+
const all = partitionModules(items, Infinity, keep, reserve);
|
|
22083
|
+
if (fits(all)) return all;
|
|
22084
|
+
let low = 1;
|
|
22085
|
+
let high = all.visible.length;
|
|
22086
|
+
while (low < high) {
|
|
22087
|
+
const middle = Math.ceil((low + high) / 2);
|
|
22088
|
+
if (fits(partitionModules(items, middle, keep, true))) low = middle;
|
|
22089
|
+
else high = middle - 1;
|
|
22090
|
+
}
|
|
22091
|
+
return partitionModules(items, low, keep, true);
|
|
22092
|
+
}
|
|
22093
|
+
function barExtent(space, visible, more) {
|
|
22094
|
+
const shown = new Set(visible.map((item) => String(item.id)));
|
|
22095
|
+
let total = 0;
|
|
22096
|
+
let count = 0;
|
|
22097
|
+
let heading = null;
|
|
22098
|
+
for (const entry of space.entries ?? []) {
|
|
22099
|
+
if (entry.heading) {
|
|
22100
|
+
heading = entry;
|
|
22101
|
+
continue;
|
|
22102
|
+
}
|
|
22103
|
+
if (entry.more ? !more : !shown.has(String(entry.id))) continue;
|
|
22104
|
+
if (heading && !entry.more) {
|
|
22105
|
+
total += heading.size;
|
|
22106
|
+
count += 1;
|
|
22107
|
+
}
|
|
22108
|
+
heading = null;
|
|
22109
|
+
total += entry.size;
|
|
22110
|
+
count += 1;
|
|
22111
|
+
}
|
|
22112
|
+
return total + Math.max(0, count - 1) * (space.gap ?? 0);
|
|
22113
|
+
}
|
|
21926
22114
|
function resolveModuleColor(item) {
|
|
21927
22115
|
const color = isCssColor(item?.color) ? String(item.color).trim() : null;
|
|
21928
22116
|
if (color) return { tone: null, color };
|
|
@@ -21980,26 +22168,32 @@ function barOrder(items) {
|
|
|
21980
22168
|
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;
|
|
21981
22169
|
return items.map((item, index) => ({ item, index })).sort((first, second) => rank(first.item) - rank(second.item) || first.index - second.index).map(({ item }) => item);
|
|
21982
22170
|
}
|
|
21983
|
-
function
|
|
22171
|
+
function measureSpace(list, horizontal) {
|
|
21984
22172
|
const overflowing = horizontal ? list.scrollWidth > list.clientWidth + 1 : list.scrollHeight > list.clientHeight + 1;
|
|
21985
|
-
if (!overflowing) return
|
|
21986
|
-
const
|
|
21987
|
-
|
|
21988
|
-
|
|
21989
|
-
|
|
21990
|
-
|
|
21991
|
-
const headings = (
|
|
21992
|
-
/** @type {HTMLElement[]} */
|
|
21993
|
-
[...list.querySelectorAll(":scope > li.zx-module-bar__heading:not([hidden])")]
|
|
21994
|
-
);
|
|
22173
|
+
if (!overflowing) return null;
|
|
22174
|
+
const axis = horizontal ? "Inline" : "Block";
|
|
22175
|
+
const edges = (style2, prefix, suffix = "") => (Number.parseFloat(style2[`${prefix}${axis}Start${suffix}`]) || 0) + (Number.parseFloat(style2[`${prefix}${axis}End${suffix}`]) || 0);
|
|
22176
|
+
const drawn = (element) => element.getBoundingClientRect()[horizontal ? "width" : "height"];
|
|
22177
|
+
const laid = horizontal ? list.offsetWidth : list.offsetHeight;
|
|
22178
|
+
const scale = laid > 0 && drawn(list) > 0 ? drawn(list) / laid : 1;
|
|
21995
22179
|
const style = getComputedStyle(list);
|
|
22180
|
+
const room = laid - edges(style, "padding") - edges(style, "border", "Width");
|
|
21996
22181
|
const gap = Number.parseFloat(horizontal ? style.columnGap : style.rowGap) || 0;
|
|
21997
|
-
const
|
|
21998
|
-
|
|
21999
|
-
|
|
22000
|
-
|
|
22001
|
-
|
|
22002
|
-
|
|
22182
|
+
const entries = [];
|
|
22183
|
+
for (
|
|
22184
|
+
const child of
|
|
22185
|
+
/** @type {HTMLElement[]} */
|
|
22186
|
+
[...list.children]
|
|
22187
|
+
) {
|
|
22188
|
+
const childStyle = getComputedStyle(child);
|
|
22189
|
+
if (child.hidden || childStyle.display === "none") continue;
|
|
22190
|
+
const size = drawn(child) / scale + edges(childStyle, "margin");
|
|
22191
|
+
if (child.classList.contains("zx-module-bar__heading")) entries.push({ heading: true, size });
|
|
22192
|
+
else if (child.hasAttribute("data-module-bar-more")) entries.push({ more: true, size });
|
|
22193
|
+
else if (child.dataset.moduleId != null) entries.push({ id: child.dataset.moduleId, size });
|
|
22194
|
+
}
|
|
22195
|
+
if (room <= 0 || !entries.some((entry) => entry.id != null && entry.size > 0)) return null;
|
|
22196
|
+
return { room, gap, entries };
|
|
22003
22197
|
}
|
|
22004
22198
|
function nearestInRow(entries, current, direction) {
|
|
22005
22199
|
const origin = current.getBoundingClientRect();
|
|
@@ -25414,9 +25608,12 @@ function isRecord(value) {
|
|
|
25414
25608
|
return Boolean(value) && typeof value === "object" && !Array.isArray(value);
|
|
25415
25609
|
}
|
|
25416
25610
|
function errorMessage(error) {
|
|
25417
|
-
|
|
25418
|
-
|
|
25419
|
-
|
|
25611
|
+
const message4 = error && typeof error === "object" ? (
|
|
25612
|
+
/** @type {{message?: unknown}} */
|
|
25613
|
+
error.message
|
|
25614
|
+
) : error;
|
|
25615
|
+
const text3 = message4 == null ? "" : String(message4);
|
|
25616
|
+
return text3.trim() ? text3 : "ZeyOS request failed";
|
|
25420
25617
|
}
|
|
25421
25618
|
function normalizeResource(value) {
|
|
25422
25619
|
return String(value).replace(/[^a-z\d]/gi, "").toLowerCase();
|
|
@@ -25603,7 +25800,8 @@ function contrastRatio(first, second) {
|
|
|
25603
25800
|
// src/zeyos/icons.js
|
|
25604
25801
|
var ZEYOS_ICON_KIT = "https://kit.fontawesome.com/ae8320b210.js";
|
|
25605
25802
|
function useZeyosIcons(options = {}) {
|
|
25606
|
-
|
|
25803
|
+
const { kit = ZEYOS_ICON_KIT, ...rest2 } = options ?? {};
|
|
25804
|
+
return loadFontAwesome({ ...rest2, kit });
|
|
25607
25805
|
}
|
|
25608
25806
|
function moduleIcon(name2, options = {}) {
|
|
25609
25807
|
const { standard = false, ...rest2 } = options;
|
|
@@ -25646,7 +25844,8 @@ function moduleChip(name2, options = {}) {
|
|
|
25646
25844
|
return chip;
|
|
25647
25845
|
}
|
|
25648
25846
|
function zeyosAppIcon(name2, options = {}) {
|
|
25649
|
-
|
|
25847
|
+
const { shape: shape2 = "circle", ...rest2 } = options ?? {};
|
|
25848
|
+
return moduleChip(name2, { ...rest2, shape: shape2 });
|
|
25650
25849
|
}
|
|
25651
25850
|
|
|
25652
25851
|
// src/zeyos/launcher.js
|