@zeyos/zx 5.8.1 → 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 +46 -0
- package/dist/types/components/block-view/block-view.d.ts +3 -2
- package/dist/types/components/dock/dock.d.ts +2 -1
- package/dist/types/components/dropdown/dropdown.d.ts +2 -1
- package/dist/types/components/module-bar/module-bar.d.ts +53 -2
- 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/tabbox/tabbox.d.ts +7 -0
- package/dist/types/internal/focus-stops.d.ts +42 -0
- package/dist/zx-zeyos.esm.js +87 -25
- package/dist/zx-zeyos.esm.min.js +4 -4
- package/dist/zx.core.css +9 -2
- package/dist/zx.core.min.css +1 -1
- package/dist/zx.css +22 -84
- package/dist/zx.esm.js +258 -51
- package/dist/zx.esm.min.js +26 -26
- package/dist/zx.global.js +258 -51
- package/dist/zx.global.min.js +26 -26
- package/dist/zx.layered.css +22 -84
- package/dist/zx.layered.min.css +1 -1
- package/dist/zx.min.css +1 -1
- package/docs/components/approval-card.md +2 -2
- package/docs/components/block-view.md +2 -1
- package/docs/components/composer.md +4 -0
- package/docs/components/dock.md +4 -1
- package/docs/components/dropdown.md +3 -1
- package/docs/components/modal.md +3 -0
- 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/tabbox.md +6 -0
- package/docs/components/tokens.md +20 -0
- package/docs/llms.md +57 -9
- package/package.json +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-view/card-view.css +5 -5
- package/src/components/card-view/card-view.js +3 -1
- 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/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/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/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/internal/focus-stops.js +108 -0
- package/styles/base.css +27 -3
package/dist/zx.esm.js
CHANGED
|
@@ -2304,7 +2304,7 @@ function validateAdapter(adapter) {
|
|
|
2304
2304
|
);
|
|
2305
2305
|
}
|
|
2306
2306
|
function errorAdapter(message4, id) {
|
|
2307
|
-
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);
|
|
2308
2308
|
return {
|
|
2309
2309
|
el,
|
|
2310
2310
|
get: () => null,
|
|
@@ -14247,7 +14247,9 @@ var Modal = class extends Component {
|
|
|
14247
14247
|
const dialog = (
|
|
14248
14248
|
/** @type {HTMLDialogElement} */
|
|
14249
14249
|
h("dialog", {
|
|
14250
|
-
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" }
|
|
14251
14253
|
}, h("div", { class: "zx-modal__content", ref: "content" }))
|
|
14252
14254
|
);
|
|
14253
14255
|
dialog.dataset.state = "closed";
|
|
@@ -14638,7 +14640,8 @@ var Dialog = class _Dialog extends Modal {
|
|
|
14638
14640
|
"dialog",
|
|
14639
14641
|
{
|
|
14640
14642
|
class: "zx-modal zx-dialog",
|
|
14641
|
-
ariaLabelledby: titleId
|
|
14643
|
+
ariaLabelledby: titleId,
|
|
14644
|
+
dataset: { zxFocus: "container" }
|
|
14642
14645
|
},
|
|
14643
14646
|
h(
|
|
14644
14647
|
"header",
|
|
@@ -15340,6 +15343,78 @@ var Search = class extends Component {
|
|
|
15340
15343
|
}
|
|
15341
15344
|
};
|
|
15342
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
|
+
|
|
15343
15418
|
// src/components/tabbox/tabbox.js
|
|
15344
15419
|
var VARIANTS2 = /* @__PURE__ */ new Set(["divided", "bracket", "line", "segmented"]);
|
|
15345
15420
|
var Tabbox = class extends Component {
|
|
@@ -15477,9 +15552,9 @@ var Tabbox = class extends Component {
|
|
|
15477
15552
|
class: "zx-tabbox__panel",
|
|
15478
15553
|
id: panelId,
|
|
15479
15554
|
role: "tabpanel",
|
|
15480
|
-
tabindex: "0",
|
|
15481
15555
|
ariaLabelledby: tabId,
|
|
15482
|
-
hidden: true
|
|
15556
|
+
hidden: true,
|
|
15557
|
+
dataset: { zxFocus: "region" }
|
|
15483
15558
|
});
|
|
15484
15559
|
const record = { definition: normalized, tab, title, badge: badge2, panel, built: false };
|
|
15485
15560
|
const numericIndex = Number.isFinite(insert.index) ? Math.trunc(insert.index) : this._tabs.length;
|
|
@@ -15614,6 +15689,10 @@ var Tabbox = class extends Component {
|
|
|
15614
15689
|
if (!tab || !this.refs.tablist.contains(tab)) return;
|
|
15615
15690
|
const current = this._recordForTab(tab);
|
|
15616
15691
|
if (!current) return;
|
|
15692
|
+
if (event.key === "Tab" && !event.shiftKey) {
|
|
15693
|
+
this._syncPanelStop();
|
|
15694
|
+
return;
|
|
15695
|
+
}
|
|
15617
15696
|
const enabled = this._enabledTabs();
|
|
15618
15697
|
if (event.key === "ArrowLeft" || event.key === "ArrowRight") {
|
|
15619
15698
|
event.preventDefault();
|
|
@@ -15695,8 +15774,18 @@ var Tabbox = class extends Component {
|
|
|
15695
15774
|
record.tab.setAttribute("aria-selected", "true");
|
|
15696
15775
|
record.panel.hidden = false;
|
|
15697
15776
|
if (record.panel.parentNode !== this.refs.panels) this.refs.panels.append(record.panel);
|
|
15777
|
+
this._syncPanelStop();
|
|
15698
15778
|
this._setFocused(record, false);
|
|
15699
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
|
+
}
|
|
15700
15789
|
/** @param {TabRecord} record @returns {void} */
|
|
15701
15790
|
_ensureContent(record) {
|
|
15702
15791
|
if (record.built) return;
|
|
@@ -16188,6 +16277,9 @@ var Table = class extends Component {
|
|
|
16188
16277
|
this._scroll = h("div", {
|
|
16189
16278
|
class: "zx-table__scroll",
|
|
16190
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",
|
|
16191
16283
|
stickyHeader: String(Boolean(this.options.stickyHeader)),
|
|
16192
16284
|
// Stripes follow the row's place in the data while windowed: `:nth-child` would count the
|
|
16193
16285
|
// spacers, and the stripes would swap as the window moved.
|
|
@@ -18539,11 +18631,13 @@ var Table = class extends Component {
|
|
|
18539
18631
|
if (!frame.hasAttribute("tabindex")) {
|
|
18540
18632
|
frame.tabIndex = -1;
|
|
18541
18633
|
frame.setAttribute("data-empty-focus", "");
|
|
18634
|
+
frame.dataset.zxFocus = "container";
|
|
18542
18635
|
}
|
|
18543
18636
|
frame.focus({ preventScroll: true });
|
|
18544
18637
|
} else if (frame.hasAttribute("data-empty-focus")) {
|
|
18545
18638
|
frame.removeAttribute("tabindex");
|
|
18546
18639
|
frame.removeAttribute("data-empty-focus");
|
|
18640
|
+
frame.dataset.zxFocus = "region";
|
|
18547
18641
|
}
|
|
18548
18642
|
}
|
|
18549
18643
|
/** @param {Event} event @returns {void} */
|
|
@@ -21345,7 +21439,7 @@ var BlockView = class extends Component {
|
|
|
21345
21439
|
this._nodes.push(node);
|
|
21346
21440
|
if (this._stoppedNote) this._stoppedNote.before(node);
|
|
21347
21441
|
else this.el.append(node);
|
|
21348
|
-
if (copy.type === "table") this._syncScrollers();
|
|
21442
|
+
if (copy.type === "table" || copy.type === "code") this._syncScrollers();
|
|
21349
21443
|
}
|
|
21350
21444
|
/** @private @returns {void} */
|
|
21351
21445
|
_redrawLast() {
|
|
@@ -21389,12 +21483,20 @@ var BlockView = class extends Component {
|
|
|
21389
21483
|
else root.removeAttribute("aria-busy");
|
|
21390
21484
|
}
|
|
21391
21485
|
/**
|
|
21392
|
-
* A wide table scrolls inside the answer; while it does, its
|
|
21393
|
-
*
|
|
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.
|
|
21394
21489
|
* @private
|
|
21395
21490
|
* @returns {void}
|
|
21396
21491
|
*/
|
|
21397
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
|
+
}
|
|
21398
21500
|
for (
|
|
21399
21501
|
const wrap of
|
|
21400
21502
|
/** @type {NodeListOf<HTMLElement>} */
|
|
@@ -21528,14 +21630,14 @@ function renderCode(block, msg) {
|
|
|
21528
21630
|
h("span", { class: "zx-block-view__code-language" }, language2 || msg("blockView.code")),
|
|
21529
21631
|
copyButton({ text: String(block.code ?? ""), title: msg("blockView.copyCode"), size: "sm" })
|
|
21530
21632
|
),
|
|
21531
|
-
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(
|
|
21532
21634
|
"code",
|
|
21533
21635
|
{},
|
|
21534
21636
|
String(block.code ?? "").split("\n").map((line) => h("span", {
|
|
21535
21637
|
class: "zx-block-view__line",
|
|
21536
21638
|
style: { "--zx-block-view-indent": `${/^\s*/.exec(line)?.[0].length ?? 0}ch` }
|
|
21537
21639
|
}, codeSegments(language2, line)))
|
|
21538
|
-
)) : h("pre", { class: "zx-block-view__pre",
|
|
21640
|
+
)) : h("pre", { class: "zx-block-view__pre", dataset: { zxFocus: "region" } }, h("code", {}, codeSegments(language2, block.code)))
|
|
21539
21641
|
);
|
|
21540
21642
|
}
|
|
21541
21643
|
function codeSegments(language2, code) {
|
|
@@ -21548,7 +21650,7 @@ function renderTable(block, cite) {
|
|
|
21548
21650
|
const value = block.align?.[index];
|
|
21549
21651
|
return value === "end" || value === "center" ? value : null;
|
|
21550
21652
|
};
|
|
21551
|
-
return h("div", { class: "zx-block-view__table" }, h(
|
|
21653
|
+
return h("div", { class: "zx-block-view__table", dataset: { zxFocus: "region" } }, h(
|
|
21552
21654
|
"table",
|
|
21553
21655
|
{},
|
|
21554
21656
|
h("thead", {}, h("tr", {}, columns.map((column, index) => h(
|
|
@@ -22237,6 +22339,7 @@ var ApprovalCard = class extends Component {
|
|
|
22237
22339
|
root.setAttribute("role", "group");
|
|
22238
22340
|
root.setAttribute("aria-labelledby", titleId);
|
|
22239
22341
|
root.tabIndex = -1;
|
|
22342
|
+
root.dataset.zxFocus = "container";
|
|
22240
22343
|
this._titleEl = h(`h${level}`, { class: "zx-approval-card__title", id: titleId }, this._title);
|
|
22241
22344
|
this._noteEl = h("p", { class: "zx-approval-card__note", id: uid("zx-approval-card-note") });
|
|
22242
22345
|
this._statusEl = h("span", { class: "zx-approval-card__status" });
|
|
@@ -23462,6 +23565,8 @@ var RunTrace = class extends Component {
|
|
|
23462
23565
|
}
|
|
23463
23566
|
});
|
|
23464
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);
|
|
23465
23570
|
this._build(this.options.steps);
|
|
23466
23571
|
return root;
|
|
23467
23572
|
}
|
|
@@ -23584,6 +23689,8 @@ var RunTrace = class extends Component {
|
|
|
23584
23689
|
this._revealTimer = null;
|
|
23585
23690
|
if (this._clock) clearInterval(this._clock);
|
|
23586
23691
|
this._clock = null;
|
|
23692
|
+
this._resize?.disconnect();
|
|
23693
|
+
this._resize = null;
|
|
23587
23694
|
for (const entry of this._entries.values()) this._releaseAvatars(entry);
|
|
23588
23695
|
this._entries.clear();
|
|
23589
23696
|
super.destroy();
|
|
@@ -23729,6 +23836,7 @@ var RunTrace = class extends Component {
|
|
|
23729
23836
|
entry.row = row2;
|
|
23730
23837
|
entry.refs = refs;
|
|
23731
23838
|
entry.body = body;
|
|
23839
|
+
if (body) this._syncCodeStops(body);
|
|
23732
23840
|
const again = focusedRef === null ? null : (
|
|
23733
23841
|
/** @type {HTMLElement|null} */
|
|
23734
23842
|
refs?.querySelector(`[data-ref-index="${focusedRef}"]`) ?? null
|
|
@@ -23886,11 +23994,11 @@ var RunTrace = class extends Component {
|
|
|
23886
23994
|
h("span", { class: "zx-run-trace__section-title", id: titleId }, this.msg(keys.title)),
|
|
23887
23995
|
copyButton({ text: full, title: this.msg(keys.copy), feedback: this.msg("runTrace.copied"), size: "sm" })
|
|
23888
23996
|
),
|
|
23997
|
+
// A Tab stop only while its text scrolls (`_syncCodeStops()`).
|
|
23889
23998
|
h("pre", {
|
|
23890
23999
|
class: "zx-run-trace__code",
|
|
23891
|
-
tabindex: "0",
|
|
23892
24000
|
"aria-labelledby": titleId,
|
|
23893
|
-
dataset: { tone: kind === "error" ? "danger" : null }
|
|
24001
|
+
dataset: { tone: kind === "error" ? "danger" : null, zxFocus: "region" }
|
|
23894
24002
|
}, shown.text),
|
|
23895
24003
|
shown.cut ? h("button", {
|
|
23896
24004
|
type: "button",
|
|
@@ -23910,6 +24018,7 @@ var RunTrace = class extends Component {
|
|
|
23910
24018
|
this._open = open;
|
|
23911
24019
|
this._summary.setAttribute("aria-expanded", String(open));
|
|
23912
24020
|
this._list.hidden = !open;
|
|
24021
|
+
if (open) this._syncCodeStops(this._list);
|
|
23913
24022
|
this._syncClock();
|
|
23914
24023
|
this.emit("toggle", { id: null, open });
|
|
23915
24024
|
}
|
|
@@ -23926,8 +24035,24 @@ var RunTrace = class extends Component {
|
|
|
23926
24035
|
else this._expanded.delete(id);
|
|
23927
24036
|
entry.row.setAttribute("aria-expanded", String(open));
|
|
23928
24037
|
entry.body.hidden = !open;
|
|
24038
|
+
if (open) this._syncCodeStops(entry.body);
|
|
23929
24039
|
this.emit("toggle", { id, open });
|
|
23930
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
|
+
}
|
|
23931
24056
|
/**
|
|
23932
24057
|
* Redraws the summary from the steps.
|
|
23933
24058
|
* @private
|
|
@@ -27870,9 +27995,10 @@ var Questionnaire = class extends Component {
|
|
|
27870
27995
|
this._progressHost = h("div", { class: "zx-questionnaire__progress", hidden: !this.options.progress });
|
|
27871
27996
|
this._itemHost = h("fieldset", {
|
|
27872
27997
|
class: "zx-questionnaire__item",
|
|
27873
|
-
tabIndex: -1
|
|
27998
|
+
tabIndex: -1,
|
|
27999
|
+
dataset: { zxFocus: "container" }
|
|
27874
28000
|
});
|
|
27875
|
-
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" } });
|
|
27876
28002
|
this._actionsHost = h("div", { class: "zx-questionnaire__actions" });
|
|
27877
28003
|
this.refs.item = this._itemHost;
|
|
27878
28004
|
this.refs.review = this._reviewHost;
|
|
@@ -34735,7 +34861,7 @@ var Surface = class extends Component {
|
|
|
34735
34861
|
const verdict = verdictText(reply.action, this._model.actions ?? [], (key, ...args) => this.msg(key, ...args));
|
|
34736
34862
|
this._verdict = h(
|
|
34737
34863
|
"p",
|
|
34738
|
-
{ class: "zx-surface__verdict", tabIndex: -1, dataset: { action: reply.action } },
|
|
34864
|
+
{ class: "zx-surface__verdict", tabIndex: -1, dataset: { action: reply.action, zxFocus: "container" } },
|
|
34739
34865
|
h(
|
|
34740
34866
|
"span",
|
|
34741
34867
|
{ class: "zx-surface__verdict-icon", "aria-hidden": "true" },
|
|
@@ -38433,11 +38559,13 @@ var CardView = class extends RecordView {
|
|
|
38433
38559
|
if (!content.hasAttribute("tabindex")) {
|
|
38434
38560
|
content.tabIndex = -1;
|
|
38435
38561
|
content.setAttribute("data-empty-focus", "");
|
|
38562
|
+
content.setAttribute("data-zx-focus", "container");
|
|
38436
38563
|
}
|
|
38437
38564
|
content.focus({ preventScroll: true });
|
|
38438
38565
|
} else if (content.hasAttribute("data-empty-focus")) {
|
|
38439
38566
|
content.removeAttribute("tabindex");
|
|
38440
38567
|
content.removeAttribute("data-empty-focus");
|
|
38568
|
+
content.removeAttribute("data-zx-focus");
|
|
38441
38569
|
}
|
|
38442
38570
|
}
|
|
38443
38571
|
/** @private @returns {HTMLElement[]} Roving items in display order. */
|
|
@@ -38577,7 +38705,7 @@ var CardView = class extends RecordView {
|
|
|
38577
38705
|
for (let index = 0; index < this._cardLoadingCount; index += 1) {
|
|
38578
38706
|
list.append(h(
|
|
38579
38707
|
"li",
|
|
38580
|
-
{ class: "zx-record-card zx-card-view__skeleton", tabindex: -1 },
|
|
38708
|
+
{ class: "zx-record-card zx-card-view__skeleton", tabindex: -1, dataset: { zxFocus: "container" } },
|
|
38581
38709
|
h("span", { class: "zx-card-view__skeleton-preview zx-skeleton" }),
|
|
38582
38710
|
h("span", { class: "zx-card-view__skeleton-line zx-skeleton" }),
|
|
38583
38711
|
h("span", { class: "zx-card-view__skeleton-line zx-skeleton" }),
|
|
@@ -41806,11 +41934,23 @@ var Dropdown = class extends Component {
|
|
|
41806
41934
|
render() {
|
|
41807
41935
|
const panel = h("div", {
|
|
41808
41936
|
id: uid("zx-dropdown"),
|
|
41809
|
-
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" }
|
|
41810
41940
|
});
|
|
41811
41941
|
panel.dataset.state = "closed";
|
|
41812
41942
|
return panel;
|
|
41813
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
|
+
}
|
|
41814
41954
|
/**
|
|
41815
41955
|
* Opens and positions the panel.
|
|
41816
41956
|
* @returns {this}
|
|
@@ -41820,6 +41960,7 @@ var Dropdown = class extends Component {
|
|
|
41820
41960
|
if (this.isOpen() || this.#destroyed) return this;
|
|
41821
41961
|
const host = this.#host();
|
|
41822
41962
|
if (this.el.parentElement !== host) host.append(this.el);
|
|
41963
|
+
this.#syncFocusMarker();
|
|
41823
41964
|
this.#position = position(this.#anchor, this.el, {
|
|
41824
41965
|
placement: this.options.placement,
|
|
41825
41966
|
offset: Number(this.options.offset),
|
|
@@ -45433,6 +45574,7 @@ var RunStatus = class extends Component {
|
|
|
45433
45574
|
}
|
|
45434
45575
|
if (!root.hasAttribute("tabindex")) {
|
|
45435
45576
|
root.tabIndex = -1;
|
|
45577
|
+
root.dataset.zxFocus = "container";
|
|
45436
45578
|
this._heldFocus = true;
|
|
45437
45579
|
}
|
|
45438
45580
|
root.focus({ preventScroll: true });
|
|
@@ -45442,6 +45584,7 @@ var RunStatus = class extends Component {
|
|
|
45442
45584
|
if (!this._heldFocus) return;
|
|
45443
45585
|
this._heldFocus = false;
|
|
45444
45586
|
this.el.removeAttribute("tabindex");
|
|
45587
|
+
this.el.removeAttribute("data-zx-focus");
|
|
45445
45588
|
}
|
|
45446
45589
|
/**
|
|
45447
45590
|
* The agent's face with the run's expression: the one drawn before, while the traits it asks for
|
|
@@ -49834,7 +49977,8 @@ var MasterPanel = class extends Component {
|
|
|
49834
49977
|
);
|
|
49835
49978
|
const content = h("div", {
|
|
49836
49979
|
class: "zx-master-panel__content",
|
|
49837
|
-
ref: "content"
|
|
49980
|
+
ref: "content",
|
|
49981
|
+
dataset: { zxFocus: "region" }
|
|
49838
49982
|
});
|
|
49839
49983
|
const footer = h("footer", {
|
|
49840
49984
|
class: "zx-master-panel__footer",
|
|
@@ -50839,7 +50983,7 @@ var Dock = class extends Component {
|
|
|
50839
50983
|
}, chevron, hasTabs ? null : h("span", { class: "zx-dock__title" }, title));
|
|
50840
50984
|
if (!collapsible) toggle.disabled = true;
|
|
50841
50985
|
const header = h("div", { class: "zx-dock__header" }, toggle);
|
|
50842
|
-
const body = h("div", { class: "zx-dock__body", id: bodyId });
|
|
50986
|
+
const body = h("div", { class: "zx-dock__body", id: bodyId, dataset: { zxFocus: "region" } });
|
|
50843
50987
|
const element = h("section", {
|
|
50844
50988
|
class: "zx-dock__pane",
|
|
50845
50989
|
dataset: { name: name2, state: "open" }
|
|
@@ -50890,8 +51034,8 @@ var Dock = class extends Component {
|
|
|
50890
51034
|
role: "tabpanel",
|
|
50891
51035
|
id: panelId,
|
|
50892
51036
|
ariaLabelledby: tabId,
|
|
50893
|
-
|
|
50894
|
-
|
|
51037
|
+
hidden: true,
|
|
51038
|
+
dataset: { zxFocus: "region" }
|
|
50895
51039
|
});
|
|
50896
51040
|
list.append(tab);
|
|
50897
51041
|
body.append(panel);
|
|
@@ -50899,6 +51043,15 @@ var Dock = class extends Component {
|
|
|
50899
51043
|
}
|
|
50900
51044
|
header.append(list);
|
|
50901
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
|
+
});
|
|
50902
51055
|
this.listen(list, "click", (event) => {
|
|
50903
51056
|
const button2 = (
|
|
50904
51057
|
/** @type {Element} */
|
|
@@ -50933,7 +51086,8 @@ var Dock = class extends Component {
|
|
|
50933
51086
|
return record;
|
|
50934
51087
|
}
|
|
50935
51088
|
/**
|
|
50936
|
-
* 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.
|
|
50937
51091
|
* @param {Record<string, any>} record Pane record.
|
|
50938
51092
|
* @returns {void}
|
|
50939
51093
|
*/
|
|
@@ -50941,9 +51095,12 @@ var Dock = class extends Component {
|
|
|
50941
51095
|
if (record.collapsed) return;
|
|
50942
51096
|
if (record.tabs) {
|
|
50943
51097
|
const active = record.tabs.get(record.active);
|
|
50944
|
-
if (!active
|
|
50945
|
-
active.built
|
|
50946
|
-
|
|
51098
|
+
if (!active) return;
|
|
51099
|
+
if (!active.built) {
|
|
51100
|
+
active.built = true;
|
|
51101
|
+
appendContent3(active.panel, active.content, true);
|
|
51102
|
+
}
|
|
51103
|
+
syncPanelStop(active.panel);
|
|
50947
51104
|
return;
|
|
50948
51105
|
}
|
|
50949
51106
|
if (record.built) return;
|
|
@@ -51559,9 +51716,9 @@ var NavigationBar = class extends Component {
|
|
|
51559
51716
|
class: "zx-navigation-bar__panel",
|
|
51560
51717
|
id: panelId,
|
|
51561
51718
|
role: "tabpanel",
|
|
51562
|
-
tabindex: "0",
|
|
51563
51719
|
ariaLabelledby: tabId,
|
|
51564
|
-
hidden: true
|
|
51720
|
+
hidden: true,
|
|
51721
|
+
dataset: { zxFocus: "region" }
|
|
51565
51722
|
});
|
|
51566
51723
|
this.refs.panels.append(panel);
|
|
51567
51724
|
}
|
|
@@ -51586,6 +51743,7 @@ var NavigationBar = class extends Component {
|
|
|
51586
51743
|
item.item.setAttribute("aria-selected", String(active));
|
|
51587
51744
|
item.item.tabIndex = active ? 0 : -1;
|
|
51588
51745
|
if (item.panel) item.panel.hidden = !active;
|
|
51746
|
+
if (active && item.panel) syncPanelStop(item.panel);
|
|
51589
51747
|
} else if (active) {
|
|
51590
51748
|
item.item.setAttribute("aria-current", "page");
|
|
51591
51749
|
} else {
|
|
@@ -51613,6 +51771,11 @@ var NavigationBar = class extends Component {
|
|
|
51613
51771
|
if (!item || !this.refs.items.contains(item)) return;
|
|
51614
51772
|
const current = this._items.find((record) => record.item === item);
|
|
51615
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
|
+
}
|
|
51616
51779
|
const enabled = this._enabledItems();
|
|
51617
51780
|
if (event.key === "ArrowLeft" || event.key === "ArrowRight") {
|
|
51618
51781
|
event.preventDefault();
|
|
@@ -58729,8 +58892,10 @@ var ModuleBar = class extends AppRailPresenter {
|
|
|
58729
58892
|
this._layout();
|
|
58730
58893
|
}
|
|
58731
58894
|
/**
|
|
58732
|
-
* Shows the tiles that fit, in bar order, and moves the rest behind "All modules".
|
|
58733
|
-
* 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.
|
|
58734
58899
|
* @returns {void}
|
|
58735
58900
|
*/
|
|
58736
58901
|
_layout() {
|
|
@@ -58740,14 +58905,16 @@ var ModuleBar = class extends AppRailPresenter {
|
|
|
58740
58905
|
const moreRow = list.querySelector(":scope > [data-module-bar-more]");
|
|
58741
58906
|
const mode = this.el.dataset.allModules;
|
|
58742
58907
|
const keep = [moduleOf(this._items, this._active)?.id, this._expandedId, this._promoted];
|
|
58743
|
-
|
|
58908
|
+
const reserve = mode === "always";
|
|
58909
|
+
let partition = partitionModules(this._items, Infinity, keep, reserve);
|
|
58744
58910
|
if (mode !== "never" && list.isConnected) {
|
|
58745
|
-
|
|
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);
|
|
58746
58913
|
if (moreRow) moreRow.hidden = false;
|
|
58747
58914
|
syncHeadings(list);
|
|
58748
|
-
|
|
58915
|
+
const space = measureSpace(list, this.el.dataset.orientation === "horizontal");
|
|
58916
|
+
if (space) partition = fitModules(this._items, space, keep, reserve);
|
|
58749
58917
|
}
|
|
58750
|
-
const partition = partitionModules(this._items, capacity, keep, mode === "always");
|
|
58751
58918
|
const visible = new Set(partition.visible.map((item) => String(item.id)));
|
|
58752
58919
|
for (const row2 of rows) row2.hidden = !visible.has(row2.dataset.moduleId);
|
|
58753
58920
|
syncHeadings(list);
|
|
@@ -59211,6 +59378,40 @@ function partitionModules(items, capacity = Infinity, keep = [], reserve = false
|
|
|
59211
59378
|
const overflow = list.filter((item) => !visible.includes(item));
|
|
59212
59379
|
return { visible, overflow, more: overflow.length > 0 };
|
|
59213
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
|
+
}
|
|
59214
59415
|
function resolveModuleColor(item) {
|
|
59215
59416
|
const color = isCssColor(item?.color) ? String(item.color).trim() : null;
|
|
59216
59417
|
if (color) return { tone: null, color };
|
|
@@ -59268,26 +59469,32 @@ function barOrder(items) {
|
|
|
59268
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;
|
|
59269
59470
|
return items.map((item, index) => ({ item, index })).sort((first, second) => rank(first.item) - rank(second.item) || first.index - second.index).map(({ item }) => item);
|
|
59270
59471
|
}
|
|
59271
|
-
function
|
|
59472
|
+
function measureSpace(list, horizontal) {
|
|
59272
59473
|
const overflowing = horizontal ? list.scrollWidth > list.clientWidth + 1 : list.scrollHeight > list.clientHeight + 1;
|
|
59273
|
-
if (!overflowing) return
|
|
59274
|
-
const
|
|
59275
|
-
|
|
59276
|
-
|
|
59277
|
-
|
|
59278
|
-
|
|
59279
|
-
const headings = (
|
|
59280
|
-
/** @type {HTMLElement[]} */
|
|
59281
|
-
[...list.querySelectorAll(":scope > li.zx-module-bar__heading:not([hidden])")]
|
|
59282
|
-
);
|
|
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;
|
|
59283
59480
|
const style = getComputedStyle(list);
|
|
59481
|
+
const room = laid - edges(style, "padding") - edges(style, "border", "Width");
|
|
59284
59482
|
const gap = Number.parseFloat(horizontal ? style.columnGap : style.rowGap) || 0;
|
|
59285
|
-
const
|
|
59286
|
-
|
|
59287
|
-
|
|
59288
|
-
|
|
59289
|
-
|
|
59290
|
-
|
|
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 };
|
|
59291
59498
|
}
|
|
59292
59499
|
function nearestInRow(entries, current, direction) {
|
|
59293
59500
|
const origin = current.getBoundingClientRect();
|