@zeyos/zx 5.4.0 → 5.6.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 +136 -0
- package/README.md +23 -16
- package/dist/types/components/agent-thread/agent-thread.d.ts +583 -0
- package/dist/types/components/app-sidebar/app-sidebar.d.ts +33 -0
- package/dist/types/components/approval-card/approval-card.d.ts +596 -0
- package/dist/types/components/avatar/avatar.d.ts +91 -4
- package/dist/types/components/badge/badge.d.ts +5 -4
- package/dist/types/components/block-view/block-view.d.ts +205 -0
- package/dist/types/components/composer/composer.d.ts +736 -0
- package/dist/types/components/datebox/date-range-box.d.ts +15 -2
- package/dist/types/components/datebox/datebox.d.ts +37 -3
- package/dist/types/components/kbd/kbd.d.ts +41 -0
- package/dist/types/components/launcher/launcher.d.ts +4 -2
- package/dist/types/components/prose/prose.d.ts +69 -0
- package/dist/types/components/questionnaire/questionnaire.d.ts +0 -36
- package/dist/types/components/run-status/run-status.d.ts +393 -0
- package/dist/types/components/run-trace/run-trace.d.ts +624 -0
- package/dist/types/components/source-list/source-list.d.ts +177 -0
- package/dist/types/components/stat-tile/stat-tile.d.ts +20 -0
- package/dist/types/components/tag-picker/tag-picker.d.ts +11 -5
- package/dist/types/components/tree/tree.d.ts +44 -3
- package/dist/types/core/icons.d.ts +22 -1
- package/dist/types/core/messages.d.ts +135 -0
- package/dist/types/index.d.ts +12 -2
- package/dist/types/internal/agent-model.d.ts +587 -0
- package/dist/types/internal/app-rail.d.ts +10 -3
- package/dist/types/internal/highlight.d.ts +24 -0
- package/dist/types/internal/presence-loop.d.ts +148 -0
- package/dist/types/internal/row-actions.d.ts +151 -0
- package/dist/zx-zeyos.esm.js +4852 -4535
- package/dist/zx-zeyos.esm.min.js +4 -4
- package/dist/zx.css +3152 -434
- package/dist/zx.esm.js +13730 -6595
- package/dist/zx.esm.min.js +27 -8
- package/dist/zx.global.js +13730 -6595
- package/dist/zx.global.min.js +27 -8
- package/dist/zx.min.css +1 -1
- package/docs/api.json +1474 -205
- package/docs/llms.md +698 -39
- package/docs/llms.txt +12 -1
- package/package.json +1 -1
- package/src/components/account-menu/account-menu.js +2 -2
- package/src/components/agent-thread/agent-thread.css +417 -0
- package/src/components/agent-thread/agent-thread.js +1365 -0
- package/src/components/app-rail/app-rail.css +11 -11
- package/src/components/app-sidebar/app-sidebar.css +90 -17
- package/src/components/app-sidebar/app-sidebar.js +120 -12
- package/src/components/approval-card/approval-card.css +289 -0
- package/src/components/approval-card/approval-card.js +1377 -0
- package/src/components/avatar/avatar.css +56 -1
- package/src/components/avatar/avatar.js +148 -26
- package/src/components/badge/badge.css +33 -20
- package/src/components/badge/badge.js +5 -4
- package/src/components/block-view/block-view.css +300 -0
- package/src/components/block-view/block-view.js +523 -0
- package/src/components/breadcrumb/breadcrumb.css +28 -3
- package/src/components/breadcrumb/breadcrumb.js +2 -2
- package/src/components/button/button.css +24 -13
- package/src/components/button/button.js +20 -2
- package/src/components/calendar/calendar.css +14 -4
- package/src/components/card-view/card-view.js +2 -2
- package/src/components/chart/chart.js +20 -5
- package/src/components/check-button/check-button.css +11 -3
- package/src/components/check-button/check-button.js +3 -3
- package/src/components/composer/composer.css +403 -0
- package/src/components/composer/composer.js +1441 -0
- package/src/components/context-menu/context-menu.css +7 -1
- package/src/components/date-picker/date-picker.css +6 -0
- package/src/components/date-picker/date-picker.js +5 -5
- package/src/components/date-picker/date-range-picker.css +6 -0
- package/src/components/date-picker/date-range-picker.js +3 -3
- package/src/components/date-picker/month-picker.js +3 -3
- package/src/components/date-picker/time-picker.css +6 -0
- package/src/components/datebox/date-range-box.js +30 -6
- package/src/components/datebox/datebox.js +44 -7
- package/src/components/dialog/dialog.css +0 -1
- package/src/components/dialog/dialog.js +2 -1
- package/src/components/dock/dock.js +2 -2
- package/src/components/dropdown/dropdown.css +2 -1
- package/src/components/entity-ref/entity-ref.css +8 -1
- package/src/components/file-item/file-item.css +1 -1
- package/src/components/finder/finder.js +2 -2
- package/src/components/groupbox/groupbox.js +2 -2
- package/src/components/kanban-view/kanban-view.css +8 -4
- package/src/components/kanban-view/kanban-view.js +3 -3
- package/src/components/kbd/kbd.css +64 -0
- package/src/components/kbd/kbd.js +121 -0
- package/src/components/launcher/launcher.css +30 -25
- package/src/components/launcher/launcher.js +15 -21
- package/src/components/list-toolbar/list-toolbar.css +7 -1
- package/src/components/menu-button/menu-button.css +9 -2
- package/src/components/message/message.js +2 -2
- package/src/components/module-bar/module-bar.css +11 -1
- package/src/components/multi-value-editor/multi-value-editor.js +4 -4
- package/src/components/navigation-bar/navigation-bar.css +3 -2
- package/src/components/pagination/pagination.js +2 -2
- package/src/components/panel/panel.js +2 -2
- package/src/components/prose/prose.css +53 -0
- package/src/components/prose/prose.js +152 -0
- package/src/components/questionnaire/questionnaire.css +7 -17
- package/src/components/questionnaire/questionnaire.js +16 -1
- package/src/components/rating/rating.css +3 -1
- package/src/components/run-status/run-status.css +208 -0
- package/src/components/run-status/run-status.js +782 -0
- package/src/components/run-trace/run-trace.css +443 -0
- package/src/components/run-trace/run-trace.js +1209 -0
- package/src/components/search/search.js +2 -2
- package/src/components/select/glyphs.js +3 -3
- package/src/components/select/select.css +35 -7
- package/src/components/select/select.js +4 -4
- package/src/components/source-list/source-list.css +208 -0
- package/src/components/source-list/source-list.js +355 -0
- package/src/components/stat-tile/stat-tile.css +56 -2
- package/src/components/stat-tile/stat-tile.js +25 -2
- package/src/components/stepper/stepper.css +2 -1
- package/src/components/stepper/stepper.js +3 -3
- package/src/components/tabbox/tabbox.css +2 -2
- package/src/components/tabbox/tabbox.js +2 -2
- package/src/components/table/table.css +52 -16
- package/src/components/table/table.js +7 -5
- package/src/components/tag-picker/tag-picker.css +56 -43
- package/src/components/tag-picker/tag-picker.js +21 -16
- package/src/components/tree/tree.css +44 -0
- package/src/components/tree/tree.js +97 -9
- package/src/components/value-list/value-list.css +25 -4
- package/src/components/value-list/value-list.js +2 -1
- package/src/components/view/record-view.js +3 -3
- package/src/components/view-settings/view-settings.css +2 -1
- package/src/components/workspace-switcher/workspace-switcher.js +3 -3
- package/src/core/icons.js +34 -3
- package/src/core/messages.js +143 -0
- package/src/elements/define.js +1 -0
- package/src/index.js +12 -2
- package/src/internal/agent-model.js +488 -0
- package/src/internal/app-rail.js +5 -1
- package/src/internal/highlight.js +104 -0
- package/src/internal/presence-loop.js +343 -0
- package/src/internal/row-actions.js +203 -0
- package/styles/base.css +26 -1
- package/styles/prose.css +306 -0
- package/styles/tokens/dark.css +97 -120
- package/styles/tokens/global.css +24 -9
- package/styles/tokens/semantic.css +464 -184
- package/styles/tokens/themes.css +9 -0
- package/styles/zx.css +10 -0
|
@@ -53,7 +53,8 @@
|
|
|
53
53
|
border-color: transparent;
|
|
54
54
|
border-radius: var(--zx-radius-md);
|
|
55
55
|
background: transparent;
|
|
56
|
-
|
|
56
|
+
/* Navigation rests one ink step under the content and comes up to the full text colour below. */
|
|
57
|
+
color: var(--zx-color-text-chrome);
|
|
57
58
|
padding: 0;
|
|
58
59
|
text-decoration: none;
|
|
59
60
|
}
|
|
@@ -91,6 +92,7 @@
|
|
|
91
92
|
padding-inline: 3px;
|
|
92
93
|
color: var(--zx-color-on-accent);
|
|
93
94
|
font-size: 10px;
|
|
95
|
+
font-variant-numeric: tabular-nums;
|
|
94
96
|
line-height: 15px;
|
|
95
97
|
text-align: center;
|
|
96
98
|
}
|
|
@@ -181,7 +183,8 @@
|
|
|
181
183
|
label. Either way a single-line row is one control tall, and a wrapped one grows. */
|
|
182
184
|
padding-block: min(var(--zx-space-1), (var(--zx-app-rail-item-height) - var(--zx-app-rail-icon)) / 2);
|
|
183
185
|
padding-inline: var(--zx-app-rail-pad-x);
|
|
184
|
-
|
|
186
|
+
/* A slice of the navigation, so it rests in the navigation's ink as the tree does. */
|
|
187
|
+
color: var(--zx-color-text-chrome);
|
|
185
188
|
font-size: var(--zx-text-md);
|
|
186
189
|
font-weight: 500;
|
|
187
190
|
line-height: 1.35;
|
|
@@ -193,13 +196,14 @@
|
|
|
193
196
|
.zx-app-rail__flyout-item { min-block-size: 40px; }
|
|
194
197
|
}
|
|
195
198
|
|
|
199
|
+
/* The icon follows the label's ink. */
|
|
196
200
|
.zx-app-rail__flyout-item-icon {
|
|
197
201
|
grid-column: 1;
|
|
198
202
|
display: flex;
|
|
199
203
|
align-items: center;
|
|
200
204
|
justify-content: center;
|
|
201
205
|
inline-size: var(--zx-app-rail-icon);
|
|
202
|
-
color:
|
|
206
|
+
color: inherit;
|
|
203
207
|
}
|
|
204
208
|
|
|
205
209
|
.zx-app-rail__flyout-item-label {
|
|
@@ -226,26 +230,23 @@
|
|
|
226
230
|
}
|
|
227
231
|
|
|
228
232
|
.zx-app-rail__flyout-item:hover { background: var(--zx-app-rail-hover); }
|
|
229
|
-
.zx-app-rail__flyout-item:hover
|
|
230
|
-
.zx-app-rail__flyout-item:hover .zx-app-rail__flyout-item-disclosure { color: var(--zx-color-text); }
|
|
233
|
+
.zx-app-rail__flyout-item:is(:hover, :focus-visible) { color: var(--zx-color-text); }
|
|
234
|
+
.zx-app-rail__flyout-item:is(:hover, :focus-visible) .zx-app-rail__flyout-item-disclosure { color: var(--zx-color-text); }
|
|
231
235
|
.zx-app-rail__flyout-item:active { background: var(--zx-app-rail-press); }
|
|
232
236
|
|
|
233
237
|
/* An open nested branch holds the hover fill: the chain that leads to the panel in front stays
|
|
234
238
|
readable while the pointer is two panels away. The rail item does the same thing. */
|
|
235
239
|
.zx-app-rail__flyout-item[aria-expanded="true"]:not([aria-current="page"]) {
|
|
236
240
|
background: var(--zx-app-rail-hover);
|
|
241
|
+
color: var(--zx-color-text);
|
|
237
242
|
}
|
|
238
|
-
.zx-app-rail__flyout-item[aria-expanded="true"]:not([aria-current="page"]) .zx-app-rail__flyout-item-icon,
|
|
239
243
|
.zx-app-rail__flyout-item[aria-expanded="true"]:not([aria-current="page"]) .zx-app-rail__flyout-item-disclosure {
|
|
240
244
|
color: var(--zx-color-text);
|
|
241
245
|
}
|
|
242
246
|
|
|
243
247
|
.zx-app-rail__flyout-item[data-active-descendant="true"][aria-expanded="false"] {
|
|
244
|
-
font-weight: var(--zx-weight-semibold);
|
|
245
|
-
}
|
|
246
|
-
|
|
247
|
-
.zx-app-rail__flyout-item[data-active-descendant="true"][aria-expanded="false"] .zx-app-rail__flyout-item-icon {
|
|
248
248
|
color: var(--zx-color-text);
|
|
249
|
+
font-weight: var(--zx-weight-semibold);
|
|
249
250
|
}
|
|
250
251
|
|
|
251
252
|
/* The current page, as in the tree: the neutral current fill, the full text colour and a heavier
|
|
@@ -260,7 +261,6 @@
|
|
|
260
261
|
background: var(--zx-app-rail-press);
|
|
261
262
|
}
|
|
262
263
|
|
|
263
|
-
.zx-app-rail__flyout-item[aria-current="page"] .zx-app-rail__flyout-item-icon,
|
|
264
264
|
.zx-app-rail__flyout-item[aria-current="page"] .zx-app-rail__flyout-item-disclosure {
|
|
265
265
|
color: var(--zx-color-text);
|
|
266
266
|
}
|
|
@@ -113,10 +113,10 @@
|
|
|
113
113
|
single icon keeps the column on every row so the labels stay in one line down the list. Each
|
|
114
114
|
list answers for its own rows only — a branch of plain labels under iconned parents drops the
|
|
115
115
|
column without taking it from the parents. */
|
|
116
|
-
.zx-app-sidebar__list:not(:has(> .zx-app-sidebar__row > .zx-app-sidebar__item .zx-app-sidebar__item-icon,
|
|
117
|
-
> .zx-app-sidebar__section > .zx-app-sidebar__section-list > .zx-app-sidebar__row > .zx-app-sidebar__item .zx-app-sidebar__item-icon)),
|
|
118
|
-
.zx-app-sidebar__section-list:not(:has(> .zx-app-sidebar__row > .zx-app-sidebar__item .zx-app-sidebar__item-icon)),
|
|
119
|
-
.zx-app-sidebar__sublist:not(:has(> .zx-app-sidebar__row > .zx-app-sidebar__item .zx-app-sidebar__item-icon)) {
|
|
116
|
+
.zx-app-sidebar__list:not(:has(> .zx-app-sidebar__row > :is(.zx-app-sidebar__item, .zx-app-sidebar__line) .zx-app-sidebar__item-icon,
|
|
117
|
+
> .zx-app-sidebar__section > .zx-app-sidebar__section-list > .zx-app-sidebar__row > :is(.zx-app-sidebar__item, .zx-app-sidebar__line) .zx-app-sidebar__item-icon)),
|
|
118
|
+
.zx-app-sidebar__section-list:not(:has(> .zx-app-sidebar__row > :is(.zx-app-sidebar__item, .zx-app-sidebar__line) .zx-app-sidebar__item-icon)),
|
|
119
|
+
.zx-app-sidebar__sublist:not(:has(> .zx-app-sidebar__row > :is(.zx-app-sidebar__item, .zx-app-sidebar__line) .zx-app-sidebar__item-icon)) {
|
|
120
120
|
--zx-app-sidebar-icon: 0px;
|
|
121
121
|
--zx-app-sidebar-item-gap: 0px;
|
|
122
122
|
}
|
|
@@ -139,11 +139,11 @@
|
|
|
139
139
|
/* Children with icons of their own step in by the shorter icon indent instead: their icons sit
|
|
140
140
|
just past the guide rather than under the parent's label. Text-only children keep lining up
|
|
141
141
|
with the words above them. */
|
|
142
|
-
.zx-app-sidebar__row[data-level="1"]:has(> .zx-app-sidebar__sublist > .zx-app-sidebar__row > .zx-app-sidebar__item .zx-app-sidebar__item-icon) {
|
|
142
|
+
.zx-app-sidebar__row[data-level="1"]:has(> .zx-app-sidebar__sublist > .zx-app-sidebar__row > :is(.zx-app-sidebar__item, .zx-app-sidebar__line) .zx-app-sidebar__item-icon) {
|
|
143
143
|
--zx-app-sidebar-step-1: max(var(--zx-app-sidebar-indent), var(--zx-app-sidebar-icon-indent));
|
|
144
144
|
}
|
|
145
145
|
|
|
146
|
-
.zx-app-sidebar__row[data-level="2"]:has(> .zx-app-sidebar__sublist > .zx-app-sidebar__row > .zx-app-sidebar__item .zx-app-sidebar__item-icon) {
|
|
146
|
+
.zx-app-sidebar__row[data-level="2"]:has(> .zx-app-sidebar__sublist > .zx-app-sidebar__row > :is(.zx-app-sidebar__item, .zx-app-sidebar__line) .zx-app-sidebar__item-icon) {
|
|
147
147
|
--zx-app-sidebar-step-2: calc(var(--zx-app-sidebar-step-1) + max(var(--zx-app-sidebar-indent), var(--zx-app-sidebar-icon-indent)));
|
|
148
148
|
}
|
|
149
149
|
|
|
@@ -226,7 +226,9 @@
|
|
|
226
226
|
label. Either way a single-line row is one control tall, and a wrapped one grows. */
|
|
227
227
|
padding-block: min(var(--zx-space-1), (var(--zx-app-sidebar-item-height) - var(--zx-app-sidebar-icon)) / 2);
|
|
228
228
|
padding-inline: var(--zx-app-sidebar-pad-x);
|
|
229
|
-
|
|
229
|
+
/* Navigation rests one ink step under the content, so the eye lands on the page beside it; the
|
|
230
|
+
row comes up to the full text colour when pointed at, focused, or current. */
|
|
231
|
+
color: var(--zx-color-text-chrome);
|
|
230
232
|
font-size: var(--zx-text-md);
|
|
231
233
|
font-weight: 500;
|
|
232
234
|
line-height: 1.35;
|
|
@@ -240,16 +242,19 @@
|
|
|
240
242
|
.zx-app-sidebar__item { min-block-size: 40px; }
|
|
241
243
|
}
|
|
242
244
|
|
|
245
|
+
.zx-app-sidebar__row[data-level="2"] > .zx-app-sidebar__line > .zx-app-sidebar__item,
|
|
243
246
|
.zx-app-sidebar__row[data-level="2"] > .zx-app-sidebar__item { padding-inline-start: calc(var(--zx-app-sidebar-pad-x) + var(--zx-app-sidebar-step-1)); }
|
|
247
|
+
.zx-app-sidebar__row[data-level="3"] > .zx-app-sidebar__line > .zx-app-sidebar__item,
|
|
244
248
|
.zx-app-sidebar__row[data-level="3"] > .zx-app-sidebar__item { padding-inline-start: calc(var(--zx-app-sidebar-pad-x) + var(--zx-app-sidebar-step-2)); }
|
|
245
249
|
|
|
250
|
+
/* The icon is drawn in the label's ink, so the row reads as one thing at rest and comes up as one. */
|
|
246
251
|
.zx-app-sidebar__item-icon {
|
|
247
252
|
grid-column: 1;
|
|
248
253
|
display: flex;
|
|
249
254
|
align-items: center;
|
|
250
255
|
justify-content: center;
|
|
251
256
|
inline-size: var(--zx-app-sidebar-icon);
|
|
252
|
-
color:
|
|
257
|
+
color: inherit;
|
|
253
258
|
}
|
|
254
259
|
|
|
255
260
|
/* No nowrap and no ellipsis: the row grows instead. `hyphens` is what makes that bearable for a
|
|
@@ -280,19 +285,16 @@
|
|
|
280
285
|
}
|
|
281
286
|
|
|
282
287
|
.zx-app-sidebar__item:hover { background: var(--zx-app-sidebar-hover); }
|
|
283
|
-
.zx-app-sidebar__item:hover
|
|
284
|
-
.zx-app-sidebar__item:hover .zx-app-sidebar__item-disclosure { color: var(--zx-color-text); }
|
|
288
|
+
.zx-app-sidebar__item:is(:hover, :focus-visible) { color: var(--zx-color-text); }
|
|
289
|
+
.zx-app-sidebar__item:is(:hover, :focus-visible) .zx-app-sidebar__item-disclosure { color: var(--zx-color-text); }
|
|
285
290
|
.zx-app-sidebar__item:active { background: var(--zx-app-sidebar-press); }
|
|
286
291
|
|
|
287
292
|
/* A branch that is closed over the active route carries the heavier label, so the way back to
|
|
288
293
|
the current page is visible without opening it; a branch that is open says so with its chevron
|
|
289
294
|
and shows the active row itself. */
|
|
290
295
|
.zx-app-sidebar__item[data-active-descendant="true"][aria-expanded="false"] {
|
|
291
|
-
font-weight: var(--zx-weight-semibold);
|
|
292
|
-
}
|
|
293
|
-
|
|
294
|
-
.zx-app-sidebar__item[data-active-descendant="true"][aria-expanded="false"] .zx-app-sidebar__item-icon {
|
|
295
296
|
color: var(--zx-color-text);
|
|
297
|
+
font-weight: var(--zx-weight-semibold);
|
|
296
298
|
}
|
|
297
299
|
|
|
298
300
|
/* The current page: a neutral fill, the full text colour, a heavier label. Focus is a ring on top
|
|
@@ -309,7 +311,6 @@
|
|
|
309
311
|
background: var(--zx-app-sidebar-press);
|
|
310
312
|
}
|
|
311
313
|
|
|
312
|
-
.zx-app-sidebar__item[aria-current="page"] .zx-app-sidebar__item-icon,
|
|
313
314
|
.zx-app-sidebar__item[aria-current="page"] .zx-app-sidebar__item-disclosure {
|
|
314
315
|
color: var(--zx-color-text);
|
|
315
316
|
}
|
|
@@ -327,6 +328,73 @@
|
|
|
327
328
|
.zx-app-sidebar__item[aria-disabled="true"]:hover,
|
|
328
329
|
.zx-app-sidebar__item[aria-disabled="true"]:active { background: transparent; }
|
|
329
330
|
|
|
331
|
+
/*
|
|
332
|
+
* Row actions. A destination with actions puts its control and the action strip on one line, the
|
|
333
|
+
* reveal host (`data-zx-reveal-host` in base.css): the strip rests out of sight over the end of the
|
|
334
|
+
* control and shows while the line is pointed at, holds focus or has its menu open. The control
|
|
335
|
+
* keeps room for the strip, so the label, the count and the chevron never run underneath it.
|
|
336
|
+
*/
|
|
337
|
+
.zx-app-sidebar__line {
|
|
338
|
+
--zx-app-sidebar-action-size: calc(var(--zx-control-height) - var(--zx-space-1) - 2px);
|
|
339
|
+
display: grid;
|
|
340
|
+
grid-template-columns: minmax(0, 1fr);
|
|
341
|
+
}
|
|
342
|
+
|
|
343
|
+
.zx-app-sidebar__line > .zx-app-sidebar__item {
|
|
344
|
+
grid-area: 1 / 1;
|
|
345
|
+
padding-inline-end: calc(var(--zx-app-sidebar-pad-x) + var(--zx-space-1)
|
|
346
|
+
+ var(--zx-app-sidebar-actions, 1) * (var(--zx-app-sidebar-action-size) + 2px));
|
|
347
|
+
}
|
|
348
|
+
|
|
349
|
+
.zx-app-sidebar__actions {
|
|
350
|
+
position: relative;
|
|
351
|
+
grid-area: 1 / 1;
|
|
352
|
+
display: inline-flex;
|
|
353
|
+
align-items: center;
|
|
354
|
+
align-self: center;
|
|
355
|
+
justify-self: end;
|
|
356
|
+
gap: 2px;
|
|
357
|
+
margin-inline-end: var(--zx-space-1);
|
|
358
|
+
}
|
|
359
|
+
|
|
360
|
+
/* The current page is where the reader is: its actions stay in view, as a selected tree row's do. */
|
|
361
|
+
.zx-app-sidebar__line:has(> [aria-current="page"]) > .zx-app-sidebar__actions {
|
|
362
|
+
opacity: 1;
|
|
363
|
+
}
|
|
364
|
+
|
|
365
|
+
/* Pointing at the strip is still pointing at the row. */
|
|
366
|
+
.zx-app-sidebar__line:has(> .zx-app-sidebar__actions:hover) > .zx-app-sidebar__item:not([aria-current="page"], [aria-disabled="true"]) {
|
|
367
|
+
background: var(--zx-app-sidebar-hover);
|
|
368
|
+
color: var(--zx-color-text);
|
|
369
|
+
}
|
|
370
|
+
|
|
371
|
+
.zx-app-sidebar .zx-app-sidebar__action {
|
|
372
|
+
display: inline-grid;
|
|
373
|
+
place-items: center;
|
|
374
|
+
inline-size: var(--zx-app-sidebar-action-size);
|
|
375
|
+
block-size: var(--zx-app-sidebar-action-size);
|
|
376
|
+
min-block-size: 0;
|
|
377
|
+
padding: 0;
|
|
378
|
+
border: 0;
|
|
379
|
+
border-radius: var(--zx-radius-sm);
|
|
380
|
+
background: none;
|
|
381
|
+
color: var(--zx-color-text-muted);
|
|
382
|
+
}
|
|
383
|
+
|
|
384
|
+
.zx-app-sidebar .zx-app-sidebar__action:is(:hover, [aria-expanded="true"]):not(:disabled) {
|
|
385
|
+
background: var(--zx-app-sidebar-hover);
|
|
386
|
+
color: var(--zx-color-text);
|
|
387
|
+
}
|
|
388
|
+
|
|
389
|
+
.zx-app-sidebar .zx-app-sidebar__action:focus-visible {
|
|
390
|
+
outline-color: transparent;
|
|
391
|
+
box-shadow: inset var(--zx-focus-ring);
|
|
392
|
+
}
|
|
393
|
+
|
|
394
|
+
.zx-app-sidebar .zx-app-sidebar__action .zx-btn__label:empty {
|
|
395
|
+
display: none;
|
|
396
|
+
}
|
|
397
|
+
|
|
330
398
|
.zx-app-sidebar__footer {
|
|
331
399
|
border-block-start: 1px solid var(--zx-color-border);
|
|
332
400
|
padding: var(--zx-space-2) var(--zx-space-3);
|
|
@@ -379,7 +447,8 @@
|
|
|
379
447
|
display: inline-grid;
|
|
380
448
|
justify-self: center;
|
|
381
449
|
gap: 2px;
|
|
382
|
-
|
|
450
|
+
/* Concentric with the options inside it: their corner plus the 2px between them. */
|
|
451
|
+
border-radius: calc(var(--zx-radius-sm) + 2px);
|
|
383
452
|
background: var(--zx-color-bg-hover);
|
|
384
453
|
padding: 2px;
|
|
385
454
|
}
|
|
@@ -499,7 +568,11 @@
|
|
|
499
568
|
* the loss of the label.
|
|
500
569
|
*/
|
|
501
570
|
.zx-app-sidebar__rail .zx-app-rail__item {
|
|
502
|
-
color: var(--zx-color-text-
|
|
571
|
+
color: var(--zx-color-text-chrome);
|
|
572
|
+
}
|
|
573
|
+
|
|
574
|
+
.zx-app-sidebar__rail .zx-app-rail__item:focus-visible {
|
|
575
|
+
color: var(--zx-color-text);
|
|
503
576
|
}
|
|
504
577
|
|
|
505
578
|
.zx-app-sidebar__rail .zx-app-rail__item:not([aria-current="page"]):hover,
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { Component } from '../../core/component.js';
|
|
2
2
|
import { h } from '../../core/dom.js';
|
|
3
3
|
import { printf } from '../../core/i18n.js';
|
|
4
|
-
import { icon } from '../../core/icons.js';
|
|
4
|
+
import { ICON_SIZE, icon } from '../../core/icons.js';
|
|
5
5
|
import { uid } from '../../core/util.js';
|
|
6
|
+
import { renderRowActions, rowActionMenu, setRowActionsTabbable } from '../../internal/row-actions.js';
|
|
6
7
|
import {
|
|
7
8
|
AppRailPresenter as MinimizedPresenter, appNavIcon, normalizeAppItems
|
|
8
9
|
} from '../../internal/app-rail.js';
|
|
@@ -54,6 +55,8 @@ const PRESENTATIONS = Object.freeze(['expanded', 'compact', 'collapsed']);
|
|
|
54
55
|
* switch between presentations. Turn it off when the choice lives elsewhere — an account menu,
|
|
55
56
|
* through `presentationChoice()`.
|
|
56
57
|
* @property {string} [label='Applications'] Navigation accessible label.
|
|
58
|
+
* @property {string} [moreLabel='More actions'] Name of a destination's overflow menu when its
|
|
59
|
+
* `actions` fold; every action name is followed by the destination's label.
|
|
57
60
|
* @property {Node|string|number|{toElement: () => Node|null}|null} [header=null] Expanded header content;
|
|
58
61
|
* in the modules layout, content above every module's menu.
|
|
59
62
|
* @property {Node|string|number|{toElement: () => Node|null}|null} [footer=null] Expanded sticky footer content.
|
|
@@ -103,6 +106,7 @@ export class AppSidebar extends Component {
|
|
|
103
106
|
presentations: ['expanded', 'compact', 'collapsed'],
|
|
104
107
|
presentationSwitch: true,
|
|
105
108
|
label: 'Applications',
|
|
109
|
+
moreLabel: 'More actions',
|
|
106
110
|
header: null,
|
|
107
111
|
footer: null,
|
|
108
112
|
railHeader: null,
|
|
@@ -153,6 +157,12 @@ export class AppSidebar extends Component {
|
|
|
153
157
|
}
|
|
154
158
|
this._shownId = this._modules ? this._resolveShown(this.options.module) : null;
|
|
155
159
|
this._modeAbort = null;
|
|
160
|
+
/** @type {Map<string, import('../../internal/row-actions.js').RowActionStrip>} Destinations' actions, by id. */
|
|
161
|
+
this._strips = new Map();
|
|
162
|
+
/** @type {import('../context-menu/context-menu.js').ContextMenu|null} */
|
|
163
|
+
this._rowMenu = null;
|
|
164
|
+
/** @type {HTMLElement|null} The list the row menu is attached to. */
|
|
165
|
+
this._rowMenuList = null;
|
|
156
166
|
root.replaceChildren();
|
|
157
167
|
return root;
|
|
158
168
|
}
|
|
@@ -456,6 +466,7 @@ export class AppSidebar extends Component {
|
|
|
456
466
|
this._modeAbort?.abort();
|
|
457
467
|
this._modeAbort = null;
|
|
458
468
|
for (const tooltip of this._stripTooltips.splice(0)) tooltip.destroy();
|
|
469
|
+
this._dropRowActions({ menu: true });
|
|
459
470
|
this._rail?.destroy();
|
|
460
471
|
this._rail = null;
|
|
461
472
|
super.destroy();
|
|
@@ -470,6 +481,7 @@ export class AppSidebar extends Component {
|
|
|
470
481
|
_renderMode() {
|
|
471
482
|
this._modeAbort?.abort();
|
|
472
483
|
this._modeAbort = new AbortController();
|
|
484
|
+
this._dropRowActions({ menu: true });
|
|
473
485
|
for (const tooltip of this._stripTooltips.splice(0)) tooltip.destroy();
|
|
474
486
|
this._presentationGroup = null;
|
|
475
487
|
this._rail?.destroy();
|
|
@@ -515,7 +527,7 @@ export class AppSidebar extends Component {
|
|
|
515
527
|
class: 'zx-app-sidebar__collapse zx-icon-btn',
|
|
516
528
|
type: 'button',
|
|
517
529
|
ariaLabel: this._message('appSidebar.minimize', 'Minimize application sidebar')
|
|
518
|
-
}, icon(this._side === 'right' ? 'chevron-right' : 'chevron-left')));
|
|
530
|
+
}, icon(this._side === 'right' ? 'chevron-right' : 'chevron-left', { size: ICON_SIZE.chevron })));
|
|
519
531
|
button.hidden = !this.options.collapsible;
|
|
520
532
|
this._listenMode(button, 'click', () => this.collapse());
|
|
521
533
|
return button;
|
|
@@ -527,7 +539,7 @@ export class AppSidebar extends Component {
|
|
|
527
539
|
class: 'zx-app-sidebar__rail-toggle zx-icon-btn',
|
|
528
540
|
type: 'button',
|
|
529
541
|
ariaLabel: this._message('appSidebar.expand', 'Expand application sidebar')
|
|
530
|
-
}, icon(this._side === 'right' ? 'chevron-left' : 'chevron-right')));
|
|
542
|
+
}, icon(this._side === 'right' ? 'chevron-left' : 'chevron-right', { size: ICON_SIZE.chevron })));
|
|
531
543
|
this._railExpandButton = button;
|
|
532
544
|
this._listenMode(button, 'click', () => this.expand());
|
|
533
545
|
return button;
|
|
@@ -537,6 +549,8 @@ export class AppSidebar extends Component {
|
|
|
537
549
|
_listenTree(list) {
|
|
538
550
|
this._listenMode(list, 'click', (event) => this._onTreeClick(event));
|
|
539
551
|
this._listenMode(list, 'keydown', (event) => this._onTreeKeydown(/** @type {KeyboardEvent} */ (event)));
|
|
552
|
+
// The actions of the row holding focus are Tab stops; every other row's wait for the pointer.
|
|
553
|
+
this._listenMode(list, 'focusin', (event) => this._syncActionStops(event.target));
|
|
540
554
|
}
|
|
541
555
|
|
|
542
556
|
/** @returns {void} */
|
|
@@ -920,11 +934,23 @@ export class AppSidebar extends Component {
|
|
|
920
934
|
/** @returns {void} */
|
|
921
935
|
_renderTree() {
|
|
922
936
|
if (!this.refs.list) return;
|
|
923
|
-
const
|
|
924
|
-
|
|
925
|
-
|
|
937
|
+
const active = /** @type {Element|null} */ (document.activeElement);
|
|
938
|
+
// Focus on a row's action comes back to the row's own control.
|
|
939
|
+
const focused = active && this.refs.list.contains(active)
|
|
940
|
+
? (active.closest('[data-app-nav-id]') ?? rowControl(active.closest('.zx-app-sidebar__row')))
|
|
941
|
+
?.getAttribute('data-app-nav-id') ?? null
|
|
926
942
|
: null;
|
|
943
|
+
this._dropRowActions({ menu: this._rowMenuList !== this.refs.list });
|
|
927
944
|
this.refs.list.replaceChildren(...this._treeItems().map((item) => this._treeRow(item, 1)));
|
|
945
|
+
if (this._strips.size > 0 && !this._rowMenu) {
|
|
946
|
+
this._rowMenuList = this.refs.list;
|
|
947
|
+
this._rowMenu = rowActionMenu(this.refs.list, '.zx-app-sidebar__line', (line) => {
|
|
948
|
+
const id = rowControl(line.parentElement)?.getAttribute('data-app-nav-id') ?? null;
|
|
949
|
+
const strip = id === null ? null : this._strips.get(id);
|
|
950
|
+
const item = strip ? findItem(this._items, id) : null;
|
|
951
|
+
return strip && item ? { actions: strip.actions, subject: item } : null;
|
|
952
|
+
});
|
|
953
|
+
}
|
|
928
954
|
this._syncActive();
|
|
929
955
|
if (focused !== null) {
|
|
930
956
|
const replacement = [...this.refs.list.querySelectorAll('[data-app-nav-id]')]
|
|
@@ -949,10 +975,11 @@ export class AppSidebar extends Component {
|
|
|
949
975
|
location: level === 1 ? 'root' : 'inline'
|
|
950
976
|
});
|
|
951
977
|
const control = navControl(item, hasChildren, expanded, childId, visual);
|
|
978
|
+
const strip = this._renderRowActions(item);
|
|
952
979
|
const row = h('li', {
|
|
953
980
|
class: 'zx-app-sidebar__row',
|
|
954
981
|
dataset: { level }
|
|
955
|
-
}, control);
|
|
982
|
+
}, strip ? actionLine(control, strip.element) : control);
|
|
956
983
|
if (hasChildren) {
|
|
957
984
|
row.append(h('ul', {
|
|
958
985
|
class: 'zx-app-sidebar__sublist',
|
|
@@ -984,8 +1011,63 @@ export class AppSidebar extends Component {
|
|
|
984
1011
|
(item.children ?? []).map((child) => this._treeRow(child, level))));
|
|
985
1012
|
}
|
|
986
1013
|
|
|
1014
|
+
/**
|
|
1015
|
+
* Builds a destination's action strip, when it lists actions.
|
|
1016
|
+
* @param {AppNavItem} item Destination.
|
|
1017
|
+
* @returns {import('../../internal/row-actions.js').RowActionStrip|null}
|
|
1018
|
+
*/
|
|
1019
|
+
_renderRowActions(item) {
|
|
1020
|
+
const entries = Array.isArray(item.actions) ? item.actions
|
|
1021
|
+
: item.actions && typeof item.actions === 'object' && 'nodeType' in item.actions ? [item.actions] : [];
|
|
1022
|
+
if (entries.length === 0) return null;
|
|
1023
|
+
const strip = renderRowActions(entries, {
|
|
1024
|
+
block: 'app-sidebar',
|
|
1025
|
+
name: item.label,
|
|
1026
|
+
moreLabel: String(this.options.moreLabel ?? 'More actions'),
|
|
1027
|
+
run: (action) => action.onSelect(item)
|
|
1028
|
+
});
|
|
1029
|
+
if (strip) this._strips.set(String(item.id), strip);
|
|
1030
|
+
return strip;
|
|
1031
|
+
}
|
|
1032
|
+
|
|
1033
|
+
/**
|
|
1034
|
+
* Makes the actions of the row holding focus Tab stops, and every other row's not.
|
|
1035
|
+
* @param {EventTarget|null} target What took focus.
|
|
1036
|
+
* @returns {void}
|
|
1037
|
+
*/
|
|
1038
|
+
_syncActionStops(target) {
|
|
1039
|
+
const line = /** @type {Element|null} */ (target)?.closest?.('.zx-app-sidebar__line') ?? null;
|
|
1040
|
+
for (const strip of this._strips.values()) {
|
|
1041
|
+
setRowActionsTabbable(strip.element, Boolean(line?.contains(strip.element)));
|
|
1042
|
+
}
|
|
1043
|
+
}
|
|
1044
|
+
|
|
1045
|
+
/**
|
|
1046
|
+
* Destroys the destinations' action strips, and with `menu` the row menu bound to the list.
|
|
1047
|
+
* @param {{menu?: boolean}} [options={}]
|
|
1048
|
+
* @returns {void}
|
|
1049
|
+
*/
|
|
1050
|
+
_dropRowActions({ menu = false } = {}) {
|
|
1051
|
+
for (const strip of this._strips?.values() ?? []) strip.destroy();
|
|
1052
|
+
this._strips?.clear();
|
|
1053
|
+
if (menu) {
|
|
1054
|
+
this._rowMenu?.destroy();
|
|
1055
|
+
this._rowMenu = null;
|
|
1056
|
+
this._rowMenuList = null;
|
|
1057
|
+
}
|
|
1058
|
+
}
|
|
1059
|
+
|
|
987
1060
|
/** @param {Event} event @returns {void} */
|
|
988
1061
|
_onTreeClick(event) {
|
|
1062
|
+
const actionControl = /** @type {HTMLElement|null} */ (/** @type {Element|null} */ (event.target)
|
|
1063
|
+
?.closest?.('.zx-app-sidebar__actions [data-row-action]') ?? null);
|
|
1064
|
+
if (actionControl && this.refs.list.contains(actionControl)) {
|
|
1065
|
+
const id = rowControl(actionControl.closest('.zx-app-sidebar__row'))?.getAttribute('data-app-nav-id') ?? null;
|
|
1066
|
+
const action = id === null ? null : this._strips.get(id)?.actions[Number(actionControl.dataset.rowAction)];
|
|
1067
|
+
const item = action ? findItem(this._items, id) : null;
|
|
1068
|
+
if (action && item && !action.disabled) action.onSelect(item);
|
|
1069
|
+
return;
|
|
1070
|
+
}
|
|
989
1071
|
const control = /** @type {Element|null} */ (event.target)?.closest?.('[data-app-nav-id]');
|
|
990
1072
|
if (!control || !this.refs.list.contains(control)) return;
|
|
991
1073
|
const item = findItem(this._items, control.getAttribute('data-app-nav-id'));
|
|
@@ -1007,7 +1089,7 @@ export class AppSidebar extends Component {
|
|
|
1007
1089
|
if (event.key === 'ArrowRight' && item?.children?.length) {
|
|
1008
1090
|
event.preventDefault();
|
|
1009
1091
|
if (!this._expanded.has(String(item.id))) this.toggleBranch(item.id);
|
|
1010
|
-
else visibleTreeControls(current.
|
|
1092
|
+
else visibleTreeControls(current.closest('.zx-app-sidebar__row')?.querySelector(':scope > .zx-app-sidebar__sublist'))[0]?.focus();
|
|
1011
1093
|
return;
|
|
1012
1094
|
}
|
|
1013
1095
|
if (event.key === 'ArrowLeft') {
|
|
@@ -1017,7 +1099,7 @@ export class AppSidebar extends Component {
|
|
|
1017
1099
|
return;
|
|
1018
1100
|
}
|
|
1019
1101
|
const parentList = current.closest('.zx-app-sidebar__sublist');
|
|
1020
|
-
const parentControl = parentList?.parentElement
|
|
1102
|
+
const parentControl = rowControl(parentList?.parentElement ?? null);
|
|
1021
1103
|
if (parentControl instanceof HTMLElement) {
|
|
1022
1104
|
event.preventDefault();
|
|
1023
1105
|
parentControl.focus();
|
|
@@ -1093,7 +1175,7 @@ export class AppSidebar extends Component {
|
|
|
1093
1175
|
if (!this.refs.list) return;
|
|
1094
1176
|
const control = [...this.refs.list.querySelectorAll('[data-app-nav-id]')]
|
|
1095
1177
|
.find((candidate) => candidate.getAttribute('data-app-nav-id') === key) ?? null;
|
|
1096
|
-
const sublist = control?.
|
|
1178
|
+
const sublist = control?.closest('.zx-app-sidebar__row')?.querySelector(':scope > .zx-app-sidebar__sublist');
|
|
1097
1179
|
if (sublist instanceof HTMLElement) sublist.dataset.branchMotion = 'expand';
|
|
1098
1180
|
}
|
|
1099
1181
|
|
|
@@ -1162,7 +1244,33 @@ function navControl(item, disclosure, expanded, controls, visual) {
|
|
|
1162
1244
|
h('span', { class: 'zx-app-sidebar__item-label' }, item.label),
|
|
1163
1245
|
item.badge != null ? h('span', { class: 'zx-app-sidebar__item-badge' }, String(item.badge)) : null,
|
|
1164
1246
|
disclosure ? h('span', { class: 'zx-app-sidebar__item-disclosure', ariaHidden: 'true' },
|
|
1165
|
-
icon(expanded ? 'chevron-down' : 'chevron-right')) : null));
|
|
1247
|
+
icon(expanded ? 'chevron-down' : 'chevron-right', { size: ICON_SIZE.chevron })) : null));
|
|
1248
|
+
}
|
|
1249
|
+
|
|
1250
|
+
/**
|
|
1251
|
+
* A row's own control: the row's first child, or the first child of its action line.
|
|
1252
|
+
* @param {Element|null|undefined} row `li.zx-app-sidebar__row`.
|
|
1253
|
+
* @returns {HTMLElement|null}
|
|
1254
|
+
*/
|
|
1255
|
+
function rowControl(row) {
|
|
1256
|
+
return /** @type {HTMLElement|null} */ (row?.querySelector(
|
|
1257
|
+
':scope > [data-app-nav-id], :scope > .zx-app-sidebar__line > [data-app-nav-id]') ?? null);
|
|
1258
|
+
}
|
|
1259
|
+
|
|
1260
|
+
/**
|
|
1261
|
+
* A destination with actions: its control and the action strip on one line, which is the reveal
|
|
1262
|
+
* host — the row's sub-list sits outside it, so pointing at a child never shows the parent's
|
|
1263
|
+
* actions. The line tells the stylesheet how many controls to keep room for.
|
|
1264
|
+
* @param {HTMLElement} control Destination control.
|
|
1265
|
+
* @param {HTMLElement} strip Action strip.
|
|
1266
|
+
* @returns {HTMLElement}
|
|
1267
|
+
*/
|
|
1268
|
+
function actionLine(control, strip) {
|
|
1269
|
+
return /** @type {HTMLElement} */ (h('div', {
|
|
1270
|
+
class: 'zx-app-sidebar__line',
|
|
1271
|
+
'data-zx-reveal-host': '',
|
|
1272
|
+
style: { '--zx-app-sidebar-actions': String(strip.childElementCount) }
|
|
1273
|
+
}, control, strip));
|
|
1166
1274
|
}
|
|
1167
1275
|
|
|
1168
1276
|
/** @param {Element|null|undefined} root @returns {HTMLElement[]} */
|
|
@@ -1178,7 +1286,7 @@ function visibleTreeControl(control) {
|
|
|
1178
1286
|
while (candidate) {
|
|
1179
1287
|
const hiddenList = candidate.closest('.zx-app-sidebar__sublist[hidden]');
|
|
1180
1288
|
if (!hiddenList) return candidate;
|
|
1181
|
-
candidate =
|
|
1289
|
+
candidate = rowControl(hiddenList.parentElement);
|
|
1182
1290
|
}
|
|
1183
1291
|
return null;
|
|
1184
1292
|
}
|