@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
|
@@ -94,14 +94,20 @@
|
|
|
94
94
|
padding-inline: var(--zx-space-1);
|
|
95
95
|
color: var(--zx-color-text-muted);
|
|
96
96
|
font-size: var(--zx-text-xs);
|
|
97
|
+
font-variant-numeric: tabular-nums;
|
|
97
98
|
text-align: center;
|
|
98
99
|
}
|
|
99
100
|
|
|
101
|
+
/* A shortcut is text at the right edge, no box — set the way a keycap's label is, so every key
|
|
102
|
+
hint in the library shares one type treatment. */
|
|
100
103
|
.zx-context-menu__shortcut {
|
|
101
104
|
border: 0;
|
|
102
105
|
background: transparent;
|
|
103
106
|
padding: 0;
|
|
104
|
-
font-family: var(--zx-font-
|
|
107
|
+
font-family: var(--zx-font-sans);
|
|
108
|
+
font-weight: var(--zx-weight-medium);
|
|
109
|
+
font-feature-settings: "case", "tnum";
|
|
110
|
+
white-space: nowrap;
|
|
105
111
|
}
|
|
106
112
|
|
|
107
113
|
.zx-context-menu__check {
|
|
@@ -113,6 +113,12 @@
|
|
|
113
113
|
box-shadow: var(--zx-focus-ring);
|
|
114
114
|
}
|
|
115
115
|
|
|
116
|
+
/* Focus usually lands on the chosen day, an accent fill under the accent ring: an inner line in its
|
|
117
|
+
own ink keeps the two apart. */
|
|
118
|
+
.zx-date-picker__day[aria-selected="true"]:focus-visible {
|
|
119
|
+
box-shadow: inset 0 0 0 1px var(--zx-color-on-accent), var(--zx-focus-ring);
|
|
120
|
+
}
|
|
121
|
+
|
|
116
122
|
.zx-date-picker__week,
|
|
117
123
|
.zx-date-picker__week-heading {
|
|
118
124
|
inline-size: 24px;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Component } from '../../core/component.js';
|
|
2
2
|
import { addDays, addMonths, formatDate, getWeekStart, isSameDay, parseDate } from '../../core/date.js';
|
|
3
3
|
import { h } from '../../core/dom.js';
|
|
4
|
-
import { icon } from '../../core/icons.js';
|
|
4
|
+
import { ICON_SIZE, icon } from '../../core/icons.js';
|
|
5
5
|
import { printf } from '../../core/i18n.js';
|
|
6
6
|
import { TimePicker } from './time-picker.js';
|
|
7
7
|
|
|
@@ -57,7 +57,7 @@ export class DatePicker extends Component {
|
|
|
57
57
|
class: 'zx-date-picker__nav',
|
|
58
58
|
type: 'button',
|
|
59
59
|
ariaLabel: this._message('datePicker.previousMonth', 'Previous month')
|
|
60
|
-
}, icon('chevron-left')),
|
|
60
|
+
}, icon('chevron-left', { size: ICON_SIZE.chevron })),
|
|
61
61
|
h('button', {
|
|
62
62
|
ref: 'heading',
|
|
63
63
|
class: 'zx-date-picker__heading',
|
|
@@ -70,7 +70,7 @@ export class DatePicker extends Component {
|
|
|
70
70
|
class: 'zx-date-picker__nav',
|
|
71
71
|
type: 'button',
|
|
72
72
|
ariaLabel: this._message('datePicker.nextMonth', 'Next month')
|
|
73
|
-
}, icon('chevron-right'))
|
|
73
|
+
}, icon('chevron-right', { size: ICON_SIZE.chevron }))
|
|
74
74
|
),
|
|
75
75
|
h('div', {
|
|
76
76
|
ref: 'quickPanel',
|
|
@@ -83,14 +83,14 @@ export class DatePicker extends Component {
|
|
|
83
83
|
class: 'zx-date-picker__nav',
|
|
84
84
|
type: 'button',
|
|
85
85
|
ariaLabel: this._message('datePicker.previousYear', 'Previous year')
|
|
86
|
-
}, icon('chevron-left')),
|
|
86
|
+
}, icon('chevron-left', { size: ICON_SIZE.chevron })),
|
|
87
87
|
h('span', { ref: 'quickYear', class: 'zx-date-picker__quick-year', ariaLive: 'polite' }),
|
|
88
88
|
h('button', {
|
|
89
89
|
ref: 'quickNext',
|
|
90
90
|
class: 'zx-date-picker__nav',
|
|
91
91
|
type: 'button',
|
|
92
92
|
ariaLabel: this._message('datePicker.nextYear', 'Next year')
|
|
93
|
-
}, icon('chevron-right'))
|
|
93
|
+
}, icon('chevron-right', { size: ICON_SIZE.chevron }))
|
|
94
94
|
),
|
|
95
95
|
h('div', { ref: 'quickGrid', class: 'zx-date-picker__quick-grid', role: 'grid' })),
|
|
96
96
|
h('table', {
|
|
@@ -241,6 +241,12 @@
|
|
|
241
241
|
box-shadow: var(--zx-focus-ring);
|
|
242
242
|
}
|
|
243
243
|
|
|
244
|
+
/* The range ends are accent fills under the accent ring: an inner line in their own ink keeps the
|
|
245
|
+
two apart. */
|
|
246
|
+
.zx-date-range-picker__grid td:is([data-range="start"], [data-range="end"]) > .zx-date-range-picker__day:focus-visible {
|
|
247
|
+
box-shadow: inset 0 0 0 1px var(--zx-color-on-accent), var(--zx-focus-ring);
|
|
248
|
+
}
|
|
249
|
+
|
|
244
250
|
.zx-date-range-picker[aria-disabled="true"] .zx-date-range-picker__surface {
|
|
245
251
|
background: var(--zx-color-bg-page);
|
|
246
252
|
opacity: 0.65;
|
|
@@ -2,7 +2,7 @@ import { Component } from '../../core/component.js';
|
|
|
2
2
|
import { addDays, addMonths, formatDate, getWeekStart, isSameDay } from '../../core/date.js';
|
|
3
3
|
import { h } from '../../core/dom.js';
|
|
4
4
|
import { printf, translate } from '../../core/i18n.js';
|
|
5
|
-
import { icon } from '../../core/icons.js';
|
|
5
|
+
import { ICON_SIZE, icon } from '../../core/icons.js';
|
|
6
6
|
|
|
7
7
|
/** @typedef {{start: Date|null, end: Date|null}} DateRange */
|
|
8
8
|
/** @typedef {'start'|'middle'|'end'} DateRangeState */
|
|
@@ -617,14 +617,14 @@ export class DateRangePicker extends Component {
|
|
|
617
617
|
type: 'button',
|
|
618
618
|
dataset: { nav: 'previous' },
|
|
619
619
|
ariaLabel: text('daterange.previousMonth', 'Previous month')
|
|
620
|
-
}, icon('chevron-left')),
|
|
620
|
+
}, icon('chevron-left', { size: ICON_SIZE.chevron })),
|
|
621
621
|
h('div', { class: 'zx-date-range-picker__caption', ariaHidden: 'true' }, caption),
|
|
622
622
|
h('button', {
|
|
623
623
|
class: 'zx-date-range-picker__nav',
|
|
624
624
|
type: 'button',
|
|
625
625
|
dataset: { nav: 'next' },
|
|
626
626
|
ariaLabel: text('daterange.nextMonth', 'Next month')
|
|
627
|
-
}, icon('chevron-right'))),
|
|
627
|
+
}, icon('chevron-right', { size: ICON_SIZE.chevron }))),
|
|
628
628
|
h('table', {
|
|
629
629
|
class: 'zx-date-range-picker__grid',
|
|
630
630
|
role: 'grid',
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { formatDate } from '../../core/date.js';
|
|
2
2
|
import { h } from '../../core/dom.js';
|
|
3
|
-
import { icon } from '../../core/icons.js';
|
|
3
|
+
import { ICON_SIZE, icon } from '../../core/icons.js';
|
|
4
4
|
import { DatePicker } from './date-picker.js';
|
|
5
5
|
|
|
6
6
|
/**
|
|
@@ -48,14 +48,14 @@ export class MonthPicker extends DatePicker {
|
|
|
48
48
|
class: 'zx-month-picker__nav',
|
|
49
49
|
type: 'button',
|
|
50
50
|
ariaLabel: this._message('monthPicker.previousYear', 'Previous year')
|
|
51
|
-
}, icon('chevron-left')),
|
|
51
|
+
}, icon('chevron-left', { size: ICON_SIZE.chevron })),
|
|
52
52
|
h('span', { ref: 'year', class: 'zx-month-picker__year', ariaLive: 'polite' }),
|
|
53
53
|
h('button', {
|
|
54
54
|
ref: 'nextYear',
|
|
55
55
|
class: 'zx-month-picker__nav',
|
|
56
56
|
type: 'button',
|
|
57
57
|
ariaLabel: this._message('monthPicker.nextYear', 'Next year')
|
|
58
|
-
}, icon('chevron-right'))
|
|
58
|
+
}, icon('chevron-right', { size: ICON_SIZE.chevron }))
|
|
59
59
|
),
|
|
60
60
|
h('div', {
|
|
61
61
|
ref: 'grid',
|
|
@@ -150,6 +150,12 @@
|
|
|
150
150
|
box-shadow: var(--zx-focus-ring);
|
|
151
151
|
}
|
|
152
152
|
|
|
153
|
+
/* The chosen mark is an accent fill under the accent ring: an inner line in its own ink keeps the
|
|
154
|
+
two apart. */
|
|
155
|
+
.zx-time-picker__mark[aria-checked="true"]:focus-visible {
|
|
156
|
+
box-shadow: inset 0 0 0 1px var(--zx-color-on-accent), var(--zx-focus-ring);
|
|
157
|
+
}
|
|
158
|
+
|
|
153
159
|
/* The hand's box hangs from the dial centre, so a plain rotation sweeps it around the face. */
|
|
154
160
|
.zx-time-picker__hand {
|
|
155
161
|
position: absolute;
|
|
@@ -2,7 +2,7 @@ import { Component } from '../../core/component.js';
|
|
|
2
2
|
import { formatDate, parseDate } from '../../core/date.js';
|
|
3
3
|
import { h } from '../../core/dom.js';
|
|
4
4
|
import { printf, translate } from '../../core/i18n.js';
|
|
5
|
-
import { icon } from '../../core/icons.js';
|
|
5
|
+
import { ICON_SIZE, icon } from '../../core/icons.js';
|
|
6
6
|
import { position } from '../../core/position.js';
|
|
7
7
|
import { escapeRegExp, uid } from '../../core/util.js';
|
|
8
8
|
import { DateRangePicker, clampRange, normalizeRange } from '../date-picker/date-range-picker.js';
|
|
@@ -16,7 +16,11 @@ import { DateRangePicker, clampRange, normalizeRange } from '../date-picker/date
|
|
|
16
16
|
* @typedef {Object} DateRangeBoxOptions
|
|
17
17
|
* @property {Date|number|string|null} [start=null] Initial start: Date, Unix seconds, or formatted text.
|
|
18
18
|
* @property {Date|number|string|null} [end=null] Initial end: Date, Unix seconds, or formatted text.
|
|
19
|
-
* @property {string} [format='%d.%m.%Y'] Kernel date format
|
|
19
|
+
* @property {string} [format='%d.%m.%Y'] Kernel date format the reader types for both endpoints,
|
|
20
|
+
* shown while the field has focus. Numeric tokens only, since it is parsed.
|
|
21
|
+
* @property {string|null} [displayFormat=null] Format both endpoints are shown in while the field
|
|
22
|
+
* does not have focus. It is never parsed, so it may use any `formatDate()` token, month and
|
|
23
|
+
* weekday names included. Null shows `format`.
|
|
20
24
|
* @property {string} [separator=' – '] Text placed between the two formatted dates.
|
|
21
25
|
* @property {string|null} [placeholder=null] Input placeholder; null derives one from the format.
|
|
22
26
|
* @property {boolean} [clearable=true] Show a clear button while a range is present and the box is
|
|
@@ -110,6 +114,7 @@ export class DateRangeBox extends Component {
|
|
|
110
114
|
start: null,
|
|
111
115
|
end: null,
|
|
112
116
|
format: '%d.%m.%Y',
|
|
117
|
+
displayFormat: null,
|
|
113
118
|
separator: ' – ',
|
|
114
119
|
placeholder: null,
|
|
115
120
|
clearable: true,
|
|
@@ -136,9 +141,11 @@ export class DateRangeBox extends Component {
|
|
|
136
141
|
this._originalClearable = root.getAttribute('data-clearable');
|
|
137
142
|
root.toggleAttribute('data-clearable', Boolean(this.options.clearable));
|
|
138
143
|
this._format = String(this.options.format || '%d.%m.%Y');
|
|
144
|
+
this._displayFormat = this.options.displayFormat ? String(this.options.displayFormat) : this._format;
|
|
139
145
|
this._separator = String(this.options.separator ?? ' – ');
|
|
140
146
|
this._disabled = Boolean(this.options.disabled);
|
|
141
147
|
this._open = false;
|
|
148
|
+
this._focused = false;
|
|
142
149
|
this._position = null;
|
|
143
150
|
this._range = this._coerce({ start: this.options.start, end: this.options.end });
|
|
144
151
|
const popoverId = uid('zx-date-range-box-popover');
|
|
@@ -160,7 +167,7 @@ export class DateRangeBox extends Component {
|
|
|
160
167
|
class: 'zx-icon-btn zx-date-range-box__clear',
|
|
161
168
|
type: 'button',
|
|
162
169
|
ariaLabel: text('daterange.clear', 'Clear date range')
|
|
163
|
-
}, icon('x', { size:
|
|
170
|
+
}, icon('x', { size: ICON_SIZE.dismiss })),
|
|
164
171
|
h('button', {
|
|
165
172
|
ref: 'toggle',
|
|
166
173
|
class: 'zx-date-range-box__toggle',
|
|
@@ -206,10 +213,20 @@ export class DateRangeBox extends Component {
|
|
|
206
213
|
if (event.detail.start && event.detail.end) this._close(true);
|
|
207
214
|
});
|
|
208
215
|
|
|
216
|
+
// Focus swaps the resting text for the typing text; a valid commit on blur swaps it back.
|
|
217
|
+
this.listen(this.refs.input, 'focus', () => {
|
|
218
|
+
this._focused = true;
|
|
219
|
+
if (this.el.dataset.state !== 'invalid') this._syncDisplay();
|
|
220
|
+
});
|
|
209
221
|
// Moving focus into the open calendar blurs the input; committing then would turn a
|
|
210
|
-
// half-picked range into a one-day range behind the user's back.
|
|
222
|
+
// half-picked range into a one-day range behind the user's back. Untouched text still goes
|
|
223
|
+
// back to the display format.
|
|
211
224
|
this.listen(this.refs.input, 'blur', () => {
|
|
225
|
+
this._focused = false;
|
|
212
226
|
if (!this._open) this._commitText();
|
|
227
|
+
else if (this.refs.input.value === formatRangeText(this._range, this._format, this._separator)) {
|
|
228
|
+
this._syncDisplay();
|
|
229
|
+
}
|
|
213
230
|
});
|
|
214
231
|
this.listen(this.refs.input, 'keydown', (event) => this._onInputKeydown(event));
|
|
215
232
|
this.listen(this.refs.toggle, 'click', () => this._open ? this.close() : this.open());
|
|
@@ -436,9 +453,16 @@ export class DateRangeBox extends Component {
|
|
|
436
453
|
return `${one}${this._separator}${one}`;
|
|
437
454
|
}
|
|
438
455
|
|
|
439
|
-
/**
|
|
456
|
+
/**
|
|
457
|
+
* Writes the range into the input: in the typing format while the input has focus, in the
|
|
458
|
+
* display format otherwise. Text that is already there is left alone, so the caret stays put.
|
|
459
|
+
* @returns {void}
|
|
460
|
+
*/
|
|
440
461
|
_syncDisplay() {
|
|
441
|
-
|
|
462
|
+
const input = this.refs.input;
|
|
463
|
+
const format = this._focused ? this._format : this._displayFormat;
|
|
464
|
+
const text = formatRangeText(this._range, format, this._separator);
|
|
465
|
+
if (input.value !== text) input.value = text;
|
|
442
466
|
this._syncClear();
|
|
443
467
|
}
|
|
444
468
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Component } from '../../core/component.js';
|
|
2
2
|
import { clampDate, formatDate, parseDate } from '../../core/date.js';
|
|
3
3
|
import { h } from '../../core/dom.js';
|
|
4
|
-
import { icon } from '../../core/icons.js';
|
|
4
|
+
import { ICON_SIZE, icon } from '../../core/icons.js';
|
|
5
5
|
import { position } from '../../core/position.js';
|
|
6
6
|
import { uid } from '../../core/util.js';
|
|
7
7
|
import { DatePicker } from '../date-picker/date-picker.js';
|
|
@@ -9,7 +9,11 @@ import { DatePicker } from '../date-picker/date-picker.js';
|
|
|
9
9
|
/**
|
|
10
10
|
* @typedef {Object} DateboxOptions
|
|
11
11
|
* @property {Date|number|string|null} [value=null] Date, Unix seconds, or formatted string.
|
|
12
|
-
* @property {string} [format='%d.%m.%Y'] Kernel date format
|
|
12
|
+
* @property {string} [format='%d.%m.%Y'] Kernel date format the reader types, shown while the
|
|
13
|
+
* field has focus. Numeric tokens only (`%d %e %m %Y %y %H %M %S`), since it is parsed.
|
|
14
|
+
* @property {string|null} [displayFormat=null] Format the field shows while it does not have focus,
|
|
15
|
+
* so a date reads as the rest of the screen writes dates. It is never parsed, so it may use any
|
|
16
|
+
* `formatDate()` token, month and weekday names included. Null shows `format`.
|
|
13
17
|
* @property {boolean} [time=false] Append `%H:%M` and show time controls.
|
|
14
18
|
* @property {Date|null} [min=null] Earliest selectable date.
|
|
15
19
|
* @property {Date|null} [max=null] Latest selectable date.
|
|
@@ -40,6 +44,7 @@ export class Datebox extends Component {
|
|
|
40
44
|
static defaults = {
|
|
41
45
|
value: null,
|
|
42
46
|
format: '%d.%m.%Y',
|
|
47
|
+
displayFormat: null,
|
|
43
48
|
time: false,
|
|
44
49
|
min: null,
|
|
45
50
|
max: null,
|
|
@@ -56,9 +61,12 @@ export class Datebox extends Component {
|
|
|
56
61
|
this._originalAriaDisabled = root.getAttribute('aria-disabled');
|
|
57
62
|
this._originalClearable = root.getAttribute('data-clearable');
|
|
58
63
|
root.toggleAttribute('data-clearable', Boolean(this.options.clearable));
|
|
59
|
-
|
|
64
|
+
const formats = dateboxFormats(this.options);
|
|
65
|
+
this._format = formats.format;
|
|
66
|
+
this._displayFormat = formats.display;
|
|
60
67
|
this._disabled = Boolean(this.options.disabled);
|
|
61
68
|
this._open = false;
|
|
69
|
+
this._focused = false;
|
|
62
70
|
this._position = null;
|
|
63
71
|
this._min = validDate(this.options.min);
|
|
64
72
|
this._max = validDate(this.options.max);
|
|
@@ -82,7 +90,7 @@ export class Datebox extends Component {
|
|
|
82
90
|
class: 'zx-icon-btn zx-datebox__clear',
|
|
83
91
|
type: 'button',
|
|
84
92
|
ariaLabel: 'Clear date'
|
|
85
|
-
}, icon('x', { size:
|
|
93
|
+
}, icon('x', { size: ICON_SIZE.dismiss })),
|
|
86
94
|
h('button', {
|
|
87
95
|
ref: 'toggle',
|
|
88
96
|
class: 'zx-datebox__toggle',
|
|
@@ -116,7 +124,15 @@ export class Datebox extends Component {
|
|
|
116
124
|
if (!this.options.time) this._close(true);
|
|
117
125
|
});
|
|
118
126
|
|
|
119
|
-
|
|
127
|
+
// Focus swaps the resting text for the typing text; a valid commit on blur swaps it back.
|
|
128
|
+
this.listen(this.refs.input, 'focus', () => {
|
|
129
|
+
this._focused = true;
|
|
130
|
+
if (this.el.dataset.state !== 'invalid') this._syncDisplay();
|
|
131
|
+
});
|
|
132
|
+
this.listen(this.refs.input, 'blur', () => {
|
|
133
|
+
this._focused = false;
|
|
134
|
+
this._commitText();
|
|
135
|
+
});
|
|
120
136
|
this.listen(this.refs.input, 'keydown', (event) => this._onInputKeydown(event));
|
|
121
137
|
this.listen(this.refs.toggle, 'click', () => this._open ? this.close() : this.open());
|
|
122
138
|
this.listen(this.refs.toggle, 'keydown', (event) => {
|
|
@@ -280,9 +296,16 @@ export class Datebox extends Component {
|
|
|
280
296
|
return clampDate(date, this._min, this._max);
|
|
281
297
|
}
|
|
282
298
|
|
|
283
|
-
/**
|
|
299
|
+
/**
|
|
300
|
+
* Writes the value into the input: in the typing format while the input has focus, in the
|
|
301
|
+
* display format otherwise. Text that is already there is left alone, so the caret stays put.
|
|
302
|
+
* @returns {void}
|
|
303
|
+
*/
|
|
284
304
|
_syncDisplay() {
|
|
285
|
-
|
|
305
|
+
const input = this.refs.input;
|
|
306
|
+
const format = this._focused ? this._format : this._displayFormat;
|
|
307
|
+
const text = this._value ? formatDate(this._value, format) : '';
|
|
308
|
+
if (input.value !== text) input.value = text;
|
|
286
309
|
this._syncClear();
|
|
287
310
|
}
|
|
288
311
|
|
|
@@ -348,6 +371,20 @@ function validDate(value) {
|
|
|
348
371
|
return value instanceof Date && !Number.isNaN(value.getTime()) ? new Date(value.getTime()) : null;
|
|
349
372
|
}
|
|
350
373
|
|
|
374
|
+
/**
|
|
375
|
+
* Resolves the two formats a Datebox works with: `format`, which the reader types and the field
|
|
376
|
+
* shows while focused, and `display`, which the field shows at rest. A missing format is
|
|
377
|
+
* `'%d.%m.%Y'`, a missing display format is the typing format, and with `time` either one that
|
|
378
|
+
* names no hour or minute gets `' %H:%M'` appended, so the time is never hidden.
|
|
379
|
+
* @param {{format?: string|null, displayFormat?: string|null, time?: boolean}} [options={}]
|
|
380
|
+
* The Datebox options that decide them.
|
|
381
|
+
* @returns {{format: string, display: string}}
|
|
382
|
+
*/
|
|
383
|
+
export function dateboxFormats({ format = null, displayFormat = null, time = false } = {}) {
|
|
384
|
+
const typing = effectiveFormat(format, time);
|
|
385
|
+
return { format: typing, display: displayFormat ? effectiveFormat(displayFormat, time) : typing };
|
|
386
|
+
}
|
|
387
|
+
|
|
351
388
|
/** @param {unknown} format @param {unknown} time @returns {string} */
|
|
352
389
|
function effectiveFormat(format, time) {
|
|
353
390
|
const value = String(format || '%d.%m.%Y');
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { h } from '../../core/dom.js';
|
|
2
|
+
import { ICON_SIZE, icon } from '../../core/icons.js';
|
|
2
3
|
import { uid } from '../../core/util.js';
|
|
3
4
|
import { Modal } from '../modal/modal.js';
|
|
4
5
|
import { button } from '../button/button.js';
|
|
@@ -139,7 +140,7 @@ export class Dialog extends Modal {
|
|
|
139
140
|
'data-kind': 'ghost',
|
|
140
141
|
ariaLabel: close,
|
|
141
142
|
title: close
|
|
142
|
-
}, '
|
|
143
|
+
}, icon('x', { size: ICON_SIZE.dismiss }))
|
|
143
144
|
),
|
|
144
145
|
h('div', { class: 'zx-modal__content zx-dialog__body', ref: 'content' }),
|
|
145
146
|
h('footer', { class: 'zx-dialog__footer', ref: 'footer' })
|
|
@@ -2,7 +2,7 @@ import { Component } from '../../core/component.js';
|
|
|
2
2
|
import { STEP, STEP_LARGE, dragAxis } from '../../core/drag-axis.js';
|
|
3
3
|
import { matchBreakpoint, onBreakpoint } from '../../core/breakpoint.js';
|
|
4
4
|
import { h, restoreTarget, snapshotTarget } from '../../core/dom.js';
|
|
5
|
-
import { icon } from '../../core/icons.js';
|
|
5
|
+
import { ICON_SIZE, icon } from '../../core/icons.js';
|
|
6
6
|
import { rovingTabindex } from '../../core/keyboard.js';
|
|
7
7
|
import { storage } from '../../core/storage.js';
|
|
8
8
|
import { clamp, uid } from '../../core/util.js';
|
|
@@ -444,7 +444,7 @@ export class Dock extends Component {
|
|
|
444
444
|
const hasTabs = Array.isArray(definition.tabs) && definition.tabs.length > 0;
|
|
445
445
|
|
|
446
446
|
const chevron = h('span', { class: 'zx-dock__chevron', ariaHidden: 'true' },
|
|
447
|
-
icon('chevron-right', { size:
|
|
447
|
+
icon('chevron-right', { size: ICON_SIZE.chevron }));
|
|
448
448
|
const toggle = h('button', {
|
|
449
449
|
class: 'zx-dock__toggle',
|
|
450
450
|
type: 'button',
|
|
@@ -3,7 +3,8 @@
|
|
|
3
3
|
max-block-size: calc(100vh - (2 * var(--zx-space-3)));
|
|
4
4
|
overflow: auto;
|
|
5
5
|
border: 1px solid var(--zx-color-overlay-border);
|
|
6
|
-
|
|
6
|
+
/* Concentric with the items a panel holds: their corner plus the inset around them. */
|
|
7
|
+
border-radius: var(--zx-radius-panel);
|
|
7
8
|
background-color: var(--zx-color-overlay-surface);
|
|
8
9
|
background-image: var(--zx-overlay-surface-image);
|
|
9
10
|
background-clip: padding-box;
|
|
@@ -23,7 +23,8 @@
|
|
|
23
23
|
inline-size: var(--zx-entity-ref-visual-size);
|
|
24
24
|
block-size: var(--zx-entity-ref-visual-size);
|
|
25
25
|
overflow: hidden;
|
|
26
|
-
|
|
26
|
+
/* One fill, not a fill and a line: the edge stays, transparent, to keep the tile's size. */
|
|
27
|
+
border: 1px solid transparent;
|
|
27
28
|
border-radius: var(--zx-radius-md);
|
|
28
29
|
background: var(--zx-color-bg-muted);
|
|
29
30
|
color: var(--zx-color-text-muted);
|
|
@@ -174,6 +175,12 @@
|
|
|
174
175
|
cursor: default;
|
|
175
176
|
}
|
|
176
177
|
|
|
178
|
+
@media (prefers-contrast: more) {
|
|
179
|
+
.zx-entity-ref__icon {
|
|
180
|
+
border-color: var(--zx-color-border-strong);
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
|
|
177
184
|
@media (forced-colors: active) {
|
|
178
185
|
.zx-entity-ref__icon,
|
|
179
186
|
.zx-entity-ref__action[data-kind="default"] {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Component } from '../../core/component.js';
|
|
2
2
|
import { h, restoreTarget, snapshotTarget } from '../../core/dom.js';
|
|
3
|
-
import { icon } from '../../core/icons.js';
|
|
3
|
+
import { ICON_SIZE, icon } from '../../core/icons.js';
|
|
4
4
|
import { typeahead } from '../../core/keyboard.js';
|
|
5
5
|
import { uid } from '../../core/util.js';
|
|
6
6
|
import { createReaders, isBranch, pathTo } from '../tree/hierarchy.js';
|
|
@@ -276,7 +276,7 @@ export class Finder extends Component {
|
|
|
276
276
|
this.options.renderItem ? this.options.renderItem(node) : this._readers.label(node)));
|
|
277
277
|
if (branch) {
|
|
278
278
|
row.append(h('span', { class: 'zx-finder__chevron', ariaHidden: 'true' },
|
|
279
|
-
icon('chevron-right', { size:
|
|
279
|
+
icon('chevron-right', { size: ICON_SIZE.chevron })));
|
|
280
280
|
}
|
|
281
281
|
row.toggleAttribute('data-branch', branch);
|
|
282
282
|
list.append(row);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Component } from '../../core/component.js';
|
|
2
2
|
import { h, resolveElement } from '../../core/dom.js';
|
|
3
|
-
import { icon } from '../../core/icons.js';
|
|
3
|
+
import { ICON_SIZE, icon } from '../../core/icons.js';
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* @typedef {Object} GroupboxOptions
|
|
@@ -69,7 +69,7 @@ export class Groupbox extends Component {
|
|
|
69
69
|
);
|
|
70
70
|
const summary = h('summary', { class: 'zx-groupbox__summary', ref: 'summary' },
|
|
71
71
|
h('span', { class: 'zx-groupbox__chevron', ariaHidden: 'true' },
|
|
72
|
-
icon('chevron-right', { size:
|
|
72
|
+
icon('chevron-right', { size: ICON_SIZE.chevron })
|
|
73
73
|
),
|
|
74
74
|
h('span', { class: 'zx-groupbox__title', ref: 'title' }, String(this.options.title))
|
|
75
75
|
);
|
|
@@ -143,6 +143,7 @@
|
|
|
143
143
|
flex: 0 0 auto;
|
|
144
144
|
color: var(--zx-color-text-muted);
|
|
145
145
|
font-size: var(--zx-text-xs);
|
|
146
|
+
font-variant-numeric: tabular-nums;
|
|
146
147
|
font-weight: 400;
|
|
147
148
|
line-height: 1.25;
|
|
148
149
|
white-space: nowrap;
|
|
@@ -772,7 +773,7 @@
|
|
|
772
773
|
/*
|
|
773
774
|
* A face is a small Avatar: the initials on the tint of the tone the component derives from the
|
|
774
775
|
* name with Avatar's own hash (`data-tone`), so a person has the same colour on the board as
|
|
775
|
-
* everywhere else.
|
|
776
|
+
* everywhere else. A 2px ring in the surface colour is what separates overlapping faces.
|
|
776
777
|
*/
|
|
777
778
|
.zx-kanban-view__avatar {
|
|
778
779
|
display: inline-grid;
|
|
@@ -781,8 +782,8 @@
|
|
|
781
782
|
inline-size: 1.5rem;
|
|
782
783
|
block-size: 1.5rem;
|
|
783
784
|
overflow: hidden;
|
|
784
|
-
border: 1px solid var(--zx-color-bg-surface);
|
|
785
785
|
border-radius: var(--zx-radius-full);
|
|
786
|
+
box-shadow: 0 0 0 2px var(--zx-color-bg-surface);
|
|
786
787
|
background: var(--zx-kanban-avatar-bg, var(--zx-color-bg-muted));
|
|
787
788
|
color: var(--zx-kanban-avatar-fg, var(--zx-color-text-muted));
|
|
788
789
|
}
|
|
@@ -797,12 +798,15 @@
|
|
|
797
798
|
.zx-kanban-view__avatar[data-tone="violet"] { --zx-kanban-avatar-bg: var(--zx-color-tone-violet-bg); --zx-kanban-avatar-fg: var(--zx-color-tone-violet-fg); }
|
|
798
799
|
.zx-kanban-view__avatar[data-tone="slate"] { --zx-kanban-avatar-bg: var(--zx-color-tone-slate-bg); --zx-kanban-avatar-fg: var(--zx-color-tone-slate-fg); }
|
|
799
800
|
|
|
801
|
+
/* Faces overlap by no more than a small step, so each stays a face rather than a sliver. */
|
|
800
802
|
.zx-kanban-view__avatar + .zx-kanban-view__avatar {
|
|
801
|
-
margin-inline-start: calc(var(--zx-space-
|
|
803
|
+
margin-inline-start: calc(-1 * var(--zx-space-1));
|
|
802
804
|
}
|
|
803
805
|
|
|
806
|
+
/* The overflow count overlaps the face before it, so its fill is opaque: the text tint mixed into
|
|
807
|
+
the surface, never a translucent fill the face would show through. */
|
|
804
808
|
.zx-kanban-view__avatar[data-overflow="true"] {
|
|
805
|
-
background: var(--zx-color-bg-
|
|
809
|
+
background: color-mix(in srgb, var(--zx-color-text) 8%, var(--zx-color-bg-surface));
|
|
806
810
|
color: var(--zx-color-text-muted);
|
|
807
811
|
}
|
|
808
812
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// @ts-check
|
|
2
2
|
import { h, restoreTarget, snapshotTarget } from '../../core/dom.js';
|
|
3
|
-
import { icon } from '../../core/icons.js';
|
|
3
|
+
import { ICON_SIZE, icon } from '../../core/icons.js';
|
|
4
4
|
import { printf } from '../../core/i18n.js';
|
|
5
5
|
import { uid } from '../../core/util.js';
|
|
6
6
|
import { badge } from '../badge/badge.js';
|
|
@@ -1021,7 +1021,7 @@ export class KanbanView extends RecordView {
|
|
|
1021
1021
|
class: 'zx-kanban-view__collapse', type: 'button', ariaExpanded: String(!collapsed),
|
|
1022
1022
|
ariaControls: bodyId, ariaLabel: this._text(collapsed ? 'expandLane' : 'collapseLane', { label: lane.label }),
|
|
1023
1023
|
dataset: { kanbanCollapse: 'swimlane', kanbanId: lane.id }
|
|
1024
|
-
}, icon(collapsed ? 'chevron-right' : 'chevron-down', { size:
|
|
1024
|
+
}, icon(collapsed ? 'chevron-right' : 'chevron-down', { size: ICON_SIZE.chevron }));
|
|
1025
1025
|
const limit = lane.limit ?? null;
|
|
1026
1026
|
const wip = wipState(total, limit);
|
|
1027
1027
|
const custom = this._renderHook('renderSwimlaneHeader', {
|
|
@@ -1074,7 +1074,7 @@ export class KanbanView extends RecordView {
|
|
|
1074
1074
|
class: 'zx-kanban-view__collapse', type: 'button', ariaExpanded: String(!collapsed),
|
|
1075
1075
|
ariaControls: listId, ariaLabel: this._text(collapsed ? 'expandColumn' : 'collapseColumn', { label: column.label }),
|
|
1076
1076
|
dataset: { kanbanCollapse: 'column', kanbanId: column.id }
|
|
1077
|
-
}, icon(collapsed ? 'chevron-right' : 'chevron-down', { size:
|
|
1077
|
+
}, icon(collapsed ? 'chevron-right' : 'chevron-down', { size: ICON_SIZE.chevron }));
|
|
1078
1078
|
const custom = this._renderHook('renderColumnHeader', {
|
|
1079
1079
|
column: { ...column }, swimlane: lane ? { ...lane } : null,
|
|
1080
1080
|
count: visible.length, total: entries.length, columnTotal, limit, wip, collapsed
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Keycaps. One construction for every key hint: a surface fill, one hairline, and a 1px foot, the
|
|
3
|
+
* label at the small size and medium weight, centred on its capital height. A single key is square,
|
|
4
|
+
* so a column of hints lines up. Three hooks retint it for a host that is not a plain surface —
|
|
5
|
+
* `--zx-kbd-ink`, `--zx-kbd-fill`, `--zx-kbd-line` — and `data-tone="inherit"` sets all three from
|
|
6
|
+
* the surrounding text colour, which is what a keycap on a solid button wants.
|
|
7
|
+
*/
|
|
8
|
+
.zx-kbd {
|
|
9
|
+
--zx-kbd-size: calc(var(--zx-text-xs) + 6px);
|
|
10
|
+
display: inline-flex;
|
|
11
|
+
flex: none;
|
|
12
|
+
align-items: center;
|
|
13
|
+
gap: 2px;
|
|
14
|
+
font-family: var(--zx-font-sans);
|
|
15
|
+
font-size: var(--zx-text-xs);
|
|
16
|
+
font-weight: var(--zx-weight-medium);
|
|
17
|
+
font-feature-settings: "case", "tnum";
|
|
18
|
+
font-style: normal;
|
|
19
|
+
letter-spacing: 0;
|
|
20
|
+
line-height: 1;
|
|
21
|
+
vertical-align: middle;
|
|
22
|
+
white-space: nowrap;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
.zx-kbd[data-size="sm"] {
|
|
26
|
+
--zx-kbd-size: calc(var(--zx-text-xs) + 4px);
|
|
27
|
+
font-size: calc(var(--zx-text-xs) - 1px);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
.zx-kbd[data-tone="inherit"] {
|
|
31
|
+
--zx-kbd-ink: currentColor;
|
|
32
|
+
--zx-kbd-fill: color-mix(in srgb, currentColor 14%, transparent);
|
|
33
|
+
--zx-kbd-line: color-mix(in srgb, currentColor 32%, transparent);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
.zx-kbd__key {
|
|
37
|
+
display: inline-grid;
|
|
38
|
+
box-sizing: border-box;
|
|
39
|
+
min-inline-size: var(--zx-kbd-size);
|
|
40
|
+
block-size: var(--zx-kbd-size);
|
|
41
|
+
place-items: center;
|
|
42
|
+
padding: 0 0.25em;
|
|
43
|
+
border: 1px solid var(--zx-kbd-line, var(--zx-color-border));
|
|
44
|
+
border-radius: var(--zx-radius-sm);
|
|
45
|
+
background: var(--zx-kbd-fill, var(--zx-color-bg-surface));
|
|
46
|
+
box-shadow: 0 1px 0 var(--zx-kbd-line, var(--zx-color-border));
|
|
47
|
+
color: var(--zx-kbd-ink, var(--zx-color-text-muted));
|
|
48
|
+
font: inherit;
|
|
49
|
+
font-feature-settings: inherit;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
/* Centre the label on its capital height rather than its line box, where capitals sit low. */
|
|
53
|
+
@supports (text-box: trim-both cap alphabetic) {
|
|
54
|
+
.zx-kbd__key {
|
|
55
|
+
text-box: trim-both cap alphabetic;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
@media (forced-colors: active) {
|
|
60
|
+
.zx-kbd__key {
|
|
61
|
+
border-color: CanvasText;
|
|
62
|
+
box-shadow: none;
|
|
63
|
+
}
|
|
64
|
+
}
|