@zeyos/zx 5.7.1 → 5.8.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 +296 -0
- package/README.md +47 -9
- package/dist/types/components/activity-item/activity-item.d.ts +14 -3
- package/dist/types/components/agent-avatar/agent-avatar.d.ts +165 -0
- package/dist/types/components/agent-avatar/agent-face.d.ts +93 -0
- package/dist/types/components/agent-thread/ag-ui.d.ts +21 -9
- package/dist/types/components/agent-thread/agent-thread.d.ts +26 -0
- package/dist/types/components/agent-thread/ui-message-stream.d.ts +3 -1
- package/dist/types/components/approval-card/approval-card.d.ts +31 -2
- package/dist/types/components/aurora/aurora.d.ts +31 -5
- package/dist/types/components/calendar/calendar.d.ts +39 -26
- package/dist/types/components/chart/chart.d.ts +250 -20
- package/dist/types/components/chart/color.d.ts +66 -0
- package/dist/types/components/chart/svg-adapter.d.ts +103 -0
- package/dist/types/components/chart/svg-geometry.d.ts +203 -0
- package/dist/types/components/check-button/check-button.d.ts +1 -4
- package/dist/types/components/checklist/checklist.d.ts +19 -5
- package/dist/types/components/code-editor/code-editor.d.ts +55 -1
- package/dist/types/components/composer/composer.d.ts +41 -6
- package/dist/types/components/context-menu/context-menu.d.ts +36 -8
- package/dist/types/components/copy/copy-button.d.ts +6 -0
- package/dist/types/components/copy/copy-input.d.ts +1 -0
- package/dist/types/components/date-picker/date-picker.d.ts +14 -0
- package/dist/types/components/date-picker/time-picker.d.ts +26 -17
- package/dist/types/components/datebox/datebox.d.ts +8 -4
- package/dist/types/components/dialog/dialog.d.ts +13 -2
- package/dist/types/components/empty-state/empty-state.d.ts +10 -1
- package/dist/types/components/field/field.d.ts +4 -2
- package/dist/types/components/form/form.d.ts +2 -1
- package/dist/types/components/kanban-view/kanban-card.d.ts +7 -0
- package/dist/types/components/kanban-view/kanban-view.d.ts +15 -3
- package/dist/types/components/launcher/launcher.d.ts +26 -0
- package/dist/types/components/master-panel/master-panel.d.ts +9 -4
- package/dist/types/components/menu-button/menu-button.d.ts +29 -5
- package/dist/types/components/message/message.d.ts +308 -5
- package/dist/types/components/modal/modal.d.ts +11 -0
- package/dist/types/components/modal/native-dialog.d.ts +40 -0
- package/dist/types/components/module-bar/module-bar.d.ts +9 -2
- package/dist/types/components/multi-value-editor/multi-value-editor.d.ts +5 -4
- package/dist/types/components/number-field/number-field.d.ts +7 -0
- package/dist/types/components/pagination/pagination.d.ts +341 -19
- package/dist/types/components/run-status/run-status.d.ts +26 -0
- package/dist/types/components/run-trace/run-trace.d.ts +10 -6
- package/dist/types/components/search/search.d.ts +16 -4
- package/dist/types/components/select/select.d.ts +19 -1
- package/dist/types/components/sheet/sheet.d.ts +18 -4
- package/dist/types/components/slider/slider.d.ts +2 -1
- package/dist/types/components/stat-tile/stat-tile.d.ts +20 -3
- package/dist/types/components/stepper/stepper.d.ts +17 -4
- package/dist/types/components/surface/catalog.d.ts +61 -17
- package/dist/types/components/surface/surface.d.ts +6 -4
- package/dist/types/components/table/table.d.ts +207 -5
- package/dist/types/components/table/window.d.ts +25 -1
- package/dist/types/components/toggle/toggle.d.ts +38 -6
- package/dist/types/components/tooltip/tooltip.d.ts +5 -4
- package/dist/types/components/tree/tree.d.ts +43 -6
- package/dist/types/components/truncate/truncate.d.ts +4 -2
- package/dist/types/components/value-list/value-list.d.ts +9 -2
- package/dist/types/core/date.d.ts +2 -1
- package/dist/types/core/drag-axis.d.ts +10 -5
- package/dist/types/core/export.d.ts +2 -2
- package/dist/types/core/format.d.ts +3 -1
- package/dist/types/core/icons.d.ts +36 -3
- package/dist/types/core/keyboard.d.ts +7 -3
- package/dist/types/core/messages.d.ts +3 -0
- package/dist/types/core/storage.d.ts +4 -3
- package/dist/types/core/util.d.ts +3 -1
- package/dist/types/elements/define.d.ts +5 -2
- package/dist/types/index.d.ts +6 -4
- package/dist/types/internal/agent-model.d.ts +99 -0
- package/dist/types/internal/app-rail.d.ts +37 -2
- package/dist/types/internal/collections.d.ts +18 -0
- package/dist/types/internal/menu-items.d.ts +27 -0
- package/dist/types/internal/overlay-content.d.ts +23 -0
- package/dist/types/internal/presence-loop.d.ts +5 -2
- package/dist/types/locales/index.d.ts +3 -0
- package/dist/types/zeyos/calendar.d.ts +43 -7
- package/dist/types/zeyos/connect.d.ts +4 -0
- package/dist/types/zeyos/form.d.ts +13 -5
- package/dist/types/zeyos/select.d.ts +5 -2
- package/dist/types/zeyos/table.d.ts +16 -8
- package/dist/types/zeyos/view.d.ts +2 -1
- package/dist/zx-zeyos.esm.js +2998 -451
- package/dist/zx-zeyos.esm.min.js +4 -4
- package/dist/zx.core.css +4 -0
- package/dist/zx.core.min.css +1 -1
- package/dist/zx.css +948 -48
- package/dist/zx.esm.js +7432 -3408
- package/dist/zx.esm.min.js +26 -26
- package/dist/zx.global.js +7432 -3408
- package/dist/zx.global.min.js +26 -26
- package/dist/zx.layered.css +950 -48
- package/dist/zx.layered.min.css +1 -1
- package/dist/zx.min.css +1 -1
- package/docs/agent-catalog.json +159 -1
- package/docs/agent-surfaces.md +21 -21
- package/docs/api.json +3122 -528
- package/docs/components/account-menu.md +24 -0
- package/docs/components/activity-item.md +23 -0
- package/docs/components/activity-list.md +28 -0
- package/docs/components/agent-avatar.md +59 -0
- package/docs/components/agent-thread.md +275 -0
- package/docs/components/app-icon.md +36 -0
- package/docs/components/app-sidebar.md +92 -0
- package/docs/components/approval-card.md +71 -0
- package/docs/components/aurora.md +34 -0
- package/docs/components/avatar.md +37 -0
- package/docs/components/badge.md +36 -0
- package/docs/components/block-view.md +34 -0
- package/docs/components/breadcrumb.md +20 -0
- package/docs/components/button.md +23 -0
- package/docs/components/calendar.md +68 -0
- package/docs/components/card-view.md +73 -0
- package/docs/components/card.md +25 -0
- package/docs/components/chart.md +109 -0
- package/docs/components/check-button.md +16 -0
- package/docs/components/checklist.md +19 -0
- package/docs/components/code-editor.md +38 -0
- package/docs/components/composer.md +107 -0
- package/docs/components/context-menu.md +32 -0
- package/docs/components/copy.md +37 -0
- package/docs/components/data-filter.md +16 -0
- package/docs/components/date-picker.md +31 -0
- package/docs/components/date-range.md +21 -0
- package/docs/components/datebox.md +31 -0
- package/docs/components/dialog.md +25 -0
- package/docs/components/dock.md +57 -0
- package/docs/components/dropdown.md +39 -0
- package/docs/components/elements.md +63 -0
- package/docs/components/empty-state.md +17 -0
- package/docs/components/entity-ref.md +26 -0
- package/docs/components/field-upload.md +18 -0
- package/docs/components/file-item.md +27 -0
- package/docs/components/file-list.md +23 -0
- package/docs/components/filter-panel.md +45 -0
- package/docs/components/filter.md +47 -0
- package/docs/components/finder.md +25 -0
- package/docs/components/form-widgets.md +42 -0
- package/docs/components/form.md +80 -0
- package/docs/components/grid.md +26 -0
- package/docs/components/groupbox.md +11 -0
- package/docs/components/helpers.md +359 -0
- package/docs/components/icons.md +87 -0
- package/docs/components/index.md +99 -0
- package/docs/components/kanban-view.md +42 -0
- package/docs/components/kbd.md +23 -0
- package/docs/components/kernel.md +41 -0
- package/docs/components/launcher.md +66 -0
- package/docs/components/layout.md +33 -0
- package/docs/components/list-toolbar.md +38 -0
- package/docs/components/loading.md +48 -0
- package/docs/components/menu-button.md +47 -0
- package/docs/components/message.md +76 -0
- package/docs/components/modal.md +27 -0
- package/docs/components/module-bar.md +71 -0
- package/docs/components/multi-value-editor.md +16 -0
- package/docs/components/navigation-bar.md +22 -0
- package/docs/components/number-field.md +34 -0
- package/docs/components/pagination.md +73 -0
- package/docs/components/panel.md +28 -0
- package/docs/components/prompt-starters.md +40 -0
- package/docs/components/prose.md +38 -0
- package/docs/components/questionnaire.md +115 -0
- package/docs/components/rating.md +19 -0
- package/docs/components/run-status.md +50 -0
- package/docs/components/run-trace.md +72 -0
- package/docs/components/search.md +11 -0
- package/docs/components/select.md +129 -0
- package/docs/components/sheet-stack.md +39 -0
- package/docs/components/sheet.md +77 -0
- package/docs/components/skeleton.md +27 -0
- package/docs/components/slider.md +29 -0
- package/docs/components/sort-control.md +21 -0
- package/docs/components/source-list.md +30 -0
- package/docs/components/split-view.md +12 -0
- package/docs/components/stat-tile.md +49 -0
- package/docs/components/stepper.md +27 -0
- package/docs/components/surface.md +152 -0
- package/docs/components/tabbox.md +33 -0
- package/docs/components/table-view.md +43 -0
- package/docs/components/table.md +232 -0
- package/docs/components/tag-picker.md +39 -0
- package/docs/components/timebox.md +16 -0
- package/docs/components/toggle.md +21 -0
- package/docs/components/tokens.md +82 -0
- package/docs/components/toolbar.md +26 -0
- package/docs/components/tooltip.md +16 -0
- package/docs/components/tree.md +48 -0
- package/docs/components/truncate.md +21 -0
- package/docs/components/value-list.md +14 -0
- package/docs/components/view-settings.md +56 -0
- package/docs/components/workspace-switcher.md +42 -0
- package/docs/components/zeyos.md +196 -0
- package/docs/llms-small.txt +299 -0
- package/docs/llms.md +697 -100
- package/docs/llms.txt +46 -19
- package/package.json +9 -4
- package/src/components/activity-item/activity-item.js +21 -2
- package/src/components/agent-avatar/agent-avatar.css +195 -0
- package/src/components/agent-avatar/agent-avatar.js +333 -0
- package/src/components/agent-avatar/agent-face.js +292 -0
- package/src/components/agent-thread/ag-ui.js +44 -11
- package/src/components/agent-thread/agent-thread.js +103 -11
- package/src/components/agent-thread/ui-message-stream.js +3 -1
- package/src/components/app-rail/app-rail.css +5 -0
- package/src/components/app-sidebar/app-sidebar.css +3 -0
- package/src/components/app-sidebar/app-sidebar.js +4 -3
- package/src/components/approval-card/approval-card.css +6 -0
- package/src/components/approval-card/approval-card.js +55 -7
- package/src/components/aurora/aurora.css +149 -14
- package/src/components/aurora/aurora.js +49 -6
- package/src/components/calendar/calendar.css +6 -2
- package/src/components/calendar/calendar.js +127 -47
- package/src/components/card-view/card-view.js +5 -6
- package/src/components/chart/chart.css +159 -1
- package/src/components/chart/chart.js +450 -62
- package/src/components/chart/color.js +297 -0
- package/src/components/chart/svg-adapter.js +576 -0
- package/src/components/chart/svg-geometry.js +323 -0
- package/src/components/check-button/check-button.js +3 -18
- package/src/components/checklist/checklist.js +46 -17
- package/src/components/checklist/field-adapter.js +4 -1
- package/src/components/code-editor/code-editor.css +33 -0
- package/src/components/code-editor/code-editor.js +97 -8
- package/src/components/code-editor/field-adapter.js +3 -0
- package/src/components/composer/composer.css +3 -0
- package/src/components/composer/composer.js +100 -22
- package/src/components/context-menu/context-menu.js +41 -5
- package/src/components/copy/copy-button.js +9 -1
- package/src/components/copy/copy-input.js +5 -0
- package/src/components/data-filter/filter-core.js +0 -1
- package/src/components/date-picker/date-picker.css +8 -0
- package/src/components/date-picker/date-picker.js +47 -8
- package/src/components/date-picker/date-range-picker.js +1 -1
- package/src/components/date-picker/month-picker.js +19 -3
- package/src/components/date-picker/time-picker.js +54 -19
- package/src/components/datebox/date-range-box.js +7 -3
- package/src/components/datebox/datebox.js +32 -6
- package/src/components/dialog/dialog.css +6 -0
- package/src/components/dialog/dialog.js +22 -30
- package/src/components/dropdown/dropdown.js +1 -18
- package/src/components/empty-state/empty-state.js +21 -2
- package/src/components/field/field.js +19 -3
- package/src/components/fieldset/fieldset.js +3 -1
- package/src/components/filter/filter.js +9 -0
- package/src/components/form/form.js +19 -2
- package/src/components/kanban-view/kanban-card.js +15 -2
- package/src/components/kanban-view/kanban-view.css +21 -0
- package/src/components/kanban-view/kanban-view.js +29 -16
- package/src/components/launcher/launcher.css +14 -0
- package/src/components/launcher/launcher.js +54 -9
- package/src/components/master-panel/master-panel.js +24 -22
- package/src/components/menu-button/menu-button.js +26 -4
- package/src/components/message/message.css +228 -29
- package/src/components/message/message.js +664 -30
- package/src/components/modal/modal.js +70 -25
- package/src/components/modal/native-dialog.js +91 -0
- package/src/components/module-bar/module-bar.css +3 -0
- package/src/components/module-bar/module-bar.js +17 -4
- package/src/components/multi-value-editor/multi-value-editor.css +7 -2
- package/src/components/multi-value-editor/multi-value-editor.js +3 -2
- package/src/components/navigation-bar/navigation-bar.js +13 -1
- package/src/components/number-field/field-adapter.js +3 -0
- package/src/components/number-field/number-field.js +2 -1
- package/src/components/pagination/pagination.css +26 -2
- package/src/components/pagination/pagination.js +551 -65
- package/src/components/prose/prose.js +7 -1
- package/src/components/rating/field-adapter.js +3 -0
- package/src/components/run-status/run-status.js +43 -3
- package/src/components/run-trace/run-trace.js +15 -7
- package/src/components/search/search.js +3 -18
- package/src/components/select/field-adapter.js +8 -1
- package/src/components/select/select.js +68 -13
- package/src/components/sheet/sheet.js +27 -8
- package/src/components/slider/field-adapter.js +3 -0
- package/src/components/slider/slider.js +4 -6
- package/src/components/stat-tile/stat-tile.js +24 -9
- package/src/components/stepper/stepper.css +15 -0
- package/src/components/stepper/stepper.js +34 -2
- package/src/components/surface/catalog.js +185 -28
- package/src/components/surface/surface.js +10 -5
- package/src/components/tabbox/tabbox.js +13 -1
- package/src/components/table/table.css +160 -2
- package/src/components/table/table.js +479 -52
- package/src/components/table/window.js +46 -4
- package/src/components/table-view/table-view.js +1 -10
- package/src/components/tag-picker/field-adapter.js +3 -0
- package/src/components/tag-picker/tag-picker.js +2 -0
- package/src/components/timebox/field-adapter.js +3 -0
- package/src/components/toggle/toggle.js +51 -27
- package/src/components/tooltip/tooltip.js +21 -14
- package/src/components/tree/tree.js +87 -14
- package/src/components/truncate/truncate.js +21 -5
- package/src/components/value-list/value-list.js +37 -9
- package/src/components/view-settings/view-settings.js +1 -5
- package/src/core/component.js +34 -2
- package/src/core/date.js +5 -4
- package/src/core/drag-axis.js +24 -7
- package/src/core/export.js +4 -4
- package/src/core/fontawesome.js +34 -3
- package/src/core/format.js +3 -1
- package/src/core/http.js +23 -11
- package/src/core/icons.js +51 -10
- package/src/core/keyboard.js +83 -9
- package/src/core/messages.js +3 -0
- package/src/core/position.js +2 -2
- package/src/core/storage.js +80 -31
- package/src/core/util.js +16 -5
- package/src/elements/define.js +82 -47
- package/src/elements/kit.js +46 -35
- package/src/index.js +8 -4
- package/src/internal/agent-model.js +152 -0
- package/src/internal/app-rail.js +53 -2
- package/src/internal/collections.js +25 -0
- package/src/internal/menu-items.js +59 -0
- package/src/internal/overlay-content.js +35 -0
- package/src/internal/presence-loop.js +61 -14
- package/src/locales/de.js +3 -0
- package/src/zeyos/calendar.js +81 -19
- package/src/zeyos/connect.js +5 -1
- package/src/zeyos/form.js +29 -10
- package/src/zeyos/select.js +36 -12
- package/src/zeyos/table.js +43 -11
- package/src/zeyos/view.js +2 -1
- package/styles/tokens/semantic.css +7 -1
- package/styles/zx.css +1 -0
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { Component } from '../../core/component.js';
|
|
2
|
-
import { h } from '../../core/dom.js';
|
|
2
|
+
import { h, restoreTarget, snapshotTarget } from '../../core/dom.js';
|
|
3
3
|
import { icon } from '../../core/icons.js';
|
|
4
4
|
import { printf } from '../../core/i18n.js';
|
|
5
|
+
import { uid } from '../../core/util.js';
|
|
5
6
|
import {
|
|
6
7
|
CALENDAR_VIEWS, addCalendarDays, calendarDayDifference, calendarDayKey,
|
|
7
8
|
calendarEventIntersects, calendarEventSpansDays, calendarPageDate, calendarRange,
|
|
@@ -10,6 +11,9 @@ import {
|
|
|
10
11
|
} from './calendar-model.js';
|
|
11
12
|
import { dateLocale } from '../../internal/date-locale.js';
|
|
12
13
|
|
|
14
|
+
/** The date cells of the month and year grids, which share one Tab stop and move it with the arrows. */
|
|
15
|
+
const ROVING_DATES = '.zx-calendar__month-day, .zx-calendar__year-day';
|
|
16
|
+
|
|
13
17
|
/** @typedef {import('./calendar-model.js').CalendarEvent} CalendarEvent */
|
|
14
18
|
/** @typedef {import('./calendar-model.js').CalendarView} CalendarView */
|
|
15
19
|
/** @typedef {import('./calendar-model.js').CalendarReader} CalendarReader */
|
|
@@ -34,7 +38,10 @@ import { dateLocale } from '../../internal/date-locale.js';
|
|
|
34
38
|
* @property {boolean} [selectable=false] Enable pointer time-range selection.
|
|
35
39
|
* @property {boolean} [editable=false] Enable event moving and resizing.
|
|
36
40
|
* @property {boolean|null} [eventStartEditable=null] Global move override; null inherits editable.
|
|
37
|
-
* @property {boolean|null} [eventDurationEditable=null]
|
|
41
|
+
* @property {boolean|null|CalendarReader} [eventDurationEditable=null] Resize policy for events that
|
|
42
|
+
* set none of their own: `true` or `false`, or null to follow `editable`. A string or function
|
|
43
|
+
* instead names the per-event resize field, read as the other `event*` readers are
|
|
44
|
+
* (`'durationEditable'` when none is given).
|
|
38
45
|
* @property {boolean} [optimistic=true] Apply event proposals locally before persistence confirms.
|
|
39
46
|
* @property {boolean} [nowIndicator=true] Show the current-time line in day/week views.
|
|
40
47
|
* @property {Date|(() => Date)|null} [now=null] Current-time override for deterministic rendering.
|
|
@@ -47,7 +54,6 @@ import { dateLocale } from '../../internal/date-locale.js';
|
|
|
47
54
|
* @property {CalendarReader} [eventColor='color'] Event colour reader.
|
|
48
55
|
* @property {CalendarReader} [eventLocation='location'] Event location reader.
|
|
49
56
|
* @property {CalendarReader} [eventEditable='editable'] Per-event move reader.
|
|
50
|
-
* @property {CalendarReader} [eventDurationEditable='durationEditable'] Per-event resize reader.
|
|
51
57
|
* @property {'milliseconds'|'seconds'} [dateUnit='milliseconds'] Unit for numeric event dates.
|
|
52
58
|
* @property {Record<string, string>} [msg] Per-instance messages, keyed `calendar.*` (`calendar.today`,
|
|
53
59
|
* `calendar.next`, …). The bare keys of earlier versions (`today`, `next`) are still read, after the
|
|
@@ -99,7 +105,8 @@ export class Calendar extends Component {
|
|
|
99
105
|
events: [],
|
|
100
106
|
date: null,
|
|
101
107
|
view: 'month',
|
|
102
|
-
|
|
108
|
+
// A copy, marked pure: a spread here keeps the class in every bundle of the entry.
|
|
109
|
+
views: /* @__PURE__ */ Array.from(CALENDAR_VIEWS),
|
|
103
110
|
weekStart: 1,
|
|
104
111
|
weekNumbers: true,
|
|
105
112
|
workweek: false,
|
|
@@ -125,7 +132,6 @@ export class Calendar extends Component {
|
|
|
125
132
|
eventColor: 'color',
|
|
126
133
|
eventLocation: 'location',
|
|
127
134
|
eventEditable: 'editable',
|
|
128
|
-
eventDurationEditable: 'durationEditable',
|
|
129
135
|
dateUnit: 'milliseconds'
|
|
130
136
|
};
|
|
131
137
|
|
|
@@ -135,10 +141,7 @@ export class Calendar extends Component {
|
|
|
135
141
|
const root = /** @type {HTMLElement} */ (this.el ?? h('section'));
|
|
136
142
|
if (!this.el) this.el = root;
|
|
137
143
|
this._createdRoot = createdRoot;
|
|
138
|
-
this.
|
|
139
|
-
attributes: Array.from(root.attributes).map(({ name, value }) => [name, value]),
|
|
140
|
-
children: Array.from(root.childNodes)
|
|
141
|
-
};
|
|
144
|
+
this._snapshot = this._createdRoot ? null : snapshotTarget(root);
|
|
142
145
|
this._views = normalizeViews(this.options.views);
|
|
143
146
|
this._view = this._views.includes(this.options.view) ? this.options.view : this._views[0];
|
|
144
147
|
this._date = normalizeAnchorDate(this.options.date, this.options.dateUnit, this._now());
|
|
@@ -152,6 +155,8 @@ export class Calendar extends Component {
|
|
|
152
155
|
this._suppressClickId = null;
|
|
153
156
|
this._suppressDateClick = false;
|
|
154
157
|
this._focusedSlot = null;
|
|
158
|
+
/** @type {string|null} Day key of the date cell the keyboard was last on. */
|
|
159
|
+
this._focusedDate = null;
|
|
155
160
|
this._selection = null;
|
|
156
161
|
this._nowTimer = null;
|
|
157
162
|
|
|
@@ -233,8 +238,18 @@ export class Calendar extends Component {
|
|
|
233
238
|
return this;
|
|
234
239
|
}
|
|
235
240
|
|
|
236
|
-
/**
|
|
241
|
+
/**
|
|
242
|
+
* Adds one source event. Given an event name and a listener instead, it is the `addEvent()` alias
|
|
243
|
+
* of `on()` that every component has.
|
|
244
|
+
* @param {Record<string, any>|string} event Source event, or a component event name.
|
|
245
|
+
* @param {CalendarSetOptions|import('../../core/component.js').ComponentListener|EventListenerObject} [options={}]
|
|
246
|
+
* Set options, or the listener when `event` is a name.
|
|
247
|
+
* @returns {this}
|
|
248
|
+
*/
|
|
237
249
|
addEvent(event, options = {}) {
|
|
250
|
+
if (typeof event === 'string') {
|
|
251
|
+
return super.addEvent(event, /** @type {import('../../core/component.js').ComponentListener} */ (options));
|
|
252
|
+
}
|
|
238
253
|
const [normalized] = normalizeCalendarEvents([event], this._normalizeOptions());
|
|
239
254
|
if (this._eventById(normalized.id)) throw new RangeError(`Duplicate Calendar event id: ${normalized.id}`);
|
|
240
255
|
this._events = [...this._events, normalized];
|
|
@@ -358,13 +373,8 @@ export class Calendar extends Component {
|
|
|
358
373
|
this._destroyed = true;
|
|
359
374
|
if (this._nowTimer) clearInterval(this._nowTimer);
|
|
360
375
|
this._nowTimer = null;
|
|
361
|
-
const original = this._original;
|
|
362
376
|
super.destroy();
|
|
363
|
-
if (!this._createdRoot
|
|
364
|
-
for (const attribute of Array.from(this.el.attributes)) this.el.removeAttribute(attribute.name);
|
|
365
|
-
for (const [name, value] of original.attributes) this.el.setAttribute(name, value);
|
|
366
|
-
this.el.replaceChildren(...original.children);
|
|
367
|
-
}
|
|
377
|
+
if (!this._createdRoot) restoreTarget(this.el, this._snapshot);
|
|
368
378
|
}
|
|
369
379
|
|
|
370
380
|
/** @param {string} action @param {string} label @param {string|null} [iconName=null] @returns {HTMLButtonElement} */
|
|
@@ -389,7 +399,8 @@ export class Calendar extends Component {
|
|
|
389
399
|
eventColor: this.options.eventColor,
|
|
390
400
|
eventLocation: this.options.eventLocation,
|
|
391
401
|
eventEditable: this.options.eventEditable,
|
|
392
|
-
eventDurationEditable: this.options.eventDurationEditable
|
|
402
|
+
eventDurationEditable: isCalendarReader(this.options.eventDurationEditable)
|
|
403
|
+
? this.options.eventDurationEditable : undefined,
|
|
393
404
|
untitledTitle: this.msg('calendar.untitled'),
|
|
394
405
|
dateUnit: this.options.dateUnit
|
|
395
406
|
};
|
|
@@ -620,6 +631,7 @@ export class Calendar extends Component {
|
|
|
620
631
|
type: 'button',
|
|
621
632
|
class: 'zx-calendar__month-day',
|
|
622
633
|
role: 'gridcell',
|
|
634
|
+
tabindex: -1,
|
|
623
635
|
dataset: {
|
|
624
636
|
calendarAction: 'date',
|
|
625
637
|
date: calendarDayKey(day),
|
|
@@ -657,6 +669,7 @@ export class Calendar extends Component {
|
|
|
657
669
|
}
|
|
658
670
|
wrapper.setAttribute('role', 'grid');
|
|
659
671
|
wrapper.setAttribute('aria-label', this._rangeTitle(range));
|
|
672
|
+
this._rovingDates(wrapper);
|
|
660
673
|
return wrapper;
|
|
661
674
|
}
|
|
662
675
|
|
|
@@ -668,40 +681,84 @@ export class Calendar extends Component {
|
|
|
668
681
|
const first = new Date(year, month, 1);
|
|
669
682
|
const offset = (first.getDay() - this.options.weekStart + 7) % 7;
|
|
670
683
|
const start = addCalendarDays(first, -offset);
|
|
671
|
-
|
|
672
|
-
|
|
684
|
+
// The month name heads the grid from outside it: a grid holds rows and nothing else.
|
|
685
|
+
const heading = h('h3', { class: 'zx-calendar__year-heading', id: uid('zx-calendar-month') },
|
|
686
|
+
this._format(first, { month: 'long' }));
|
|
687
|
+
const weekdays = h('div', { class: 'zx-calendar__year-row', role: 'row' });
|
|
673
688
|
for (let dayIndex = 0; dayIndex < 7; dayIndex += 1) {
|
|
674
689
|
const weekday = addCalendarDays(start, dayIndex);
|
|
675
|
-
|
|
690
|
+
weekdays.append(h('span', { class: 'zx-calendar__year-weekday', role: 'columnheader' },
|
|
676
691
|
this._format(weekday, { weekday: 'narrow' })));
|
|
677
692
|
}
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
693
|
+
const grid = h('div', { class: 'zx-calendar__year-grid', role: 'grid', ariaLabelledby: heading.id }, weekdays);
|
|
694
|
+
for (let week = 0; week < 6; week += 1) {
|
|
695
|
+
const row = h('div', { class: 'zx-calendar__year-row', role: 'row' });
|
|
696
|
+
let filled = false;
|
|
697
|
+
for (let dayIndex = 0; dayIndex < 7; dayIndex += 1) {
|
|
698
|
+
const day = addCalendarDays(start, week * 7 + dayIndex);
|
|
699
|
+
if (day.getMonth() !== month) {
|
|
700
|
+
row.append(h('span', { class: 'zx-calendar__year-blank', role: 'gridcell', ariaHidden: 'true' }));
|
|
701
|
+
continue;
|
|
702
|
+
}
|
|
703
|
+
filled = true;
|
|
704
|
+
const count = this._events.filter((event) => calendarEventIntersects(event, day, addCalendarDays(day, 1))).length;
|
|
705
|
+
row.append(h('button', {
|
|
706
|
+
type: 'button',
|
|
707
|
+
class: 'zx-calendar__year-day',
|
|
708
|
+
role: 'gridcell',
|
|
709
|
+
tabindex: -1,
|
|
710
|
+
dataset: {
|
|
711
|
+
calendarAction: 'date',
|
|
712
|
+
date: calendarDayKey(day),
|
|
713
|
+
dateCell: 'true',
|
|
714
|
+
activity: String(Math.min(3, count))
|
|
715
|
+
},
|
|
716
|
+
ariaCurrent: sameCalendarDay(day, this._now()) ? 'date' : null,
|
|
717
|
+
ariaLabel: this._dayCountLabel(day, count),
|
|
718
|
+
disabled: this.options.disabled
|
|
719
|
+
}, String(day.getDate())));
|
|
683
720
|
}
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
class: 'zx-calendar__year-day',
|
|
688
|
-
role: 'gridcell',
|
|
689
|
-
dataset: {
|
|
690
|
-
calendarAction: 'date',
|
|
691
|
-
date: calendarDayKey(day),
|
|
692
|
-
dateCell: 'true',
|
|
693
|
-
activity: String(Math.min(3, count))
|
|
694
|
-
},
|
|
695
|
-
ariaCurrent: sameCalendarDay(day, this._now()) ? 'date' : null,
|
|
696
|
-
ariaLabel: this._dayCountLabel(day, count),
|
|
697
|
-
disabled: this.options.disabled
|
|
698
|
-
}, String(day.getDate())));
|
|
721
|
+
// Six weeks keep every month the same height; a week of the next month only is not a row.
|
|
722
|
+
if (!filled) row.setAttribute('aria-hidden', 'true');
|
|
723
|
+
grid.append(row);
|
|
699
724
|
}
|
|
700
|
-
surface.append(grid);
|
|
725
|
+
surface.append(h('div', { class: 'zx-calendar__year-month' }, heading, grid));
|
|
701
726
|
}
|
|
727
|
+
this._rovingDates(surface);
|
|
702
728
|
return surface;
|
|
703
729
|
}
|
|
704
730
|
|
|
731
|
+
/**
|
|
732
|
+
* Gives the date cells of a month or year view a single Tab stop, after the APG grid pattern:
|
|
733
|
+
* the date the keyboard was last on, else the anchor date, else today, else the first day of
|
|
734
|
+
* the period. The arrow keys move it with the focus.
|
|
735
|
+
* @param {Element} container The rendered view.
|
|
736
|
+
* @returns {void}
|
|
737
|
+
*/
|
|
738
|
+
_rovingDates(container) {
|
|
739
|
+
const cells = /** @type {HTMLElement[]} */ ([...container.querySelectorAll(ROVING_DATES)]);
|
|
740
|
+
if (!cells.length) return;
|
|
741
|
+
/** @param {string|null} key @returns {HTMLElement|undefined} */
|
|
742
|
+
const find = (key) => (key ? cells.find((cell) => cell.dataset.date === key) : undefined);
|
|
743
|
+
const stop = find(this._focusedDate) ?? find(calendarDayKey(this._date))
|
|
744
|
+
?? find(calendarDayKey(this._now())) ?? cells.find((cell) => !cell.dataset.otherMonth) ?? cells[0];
|
|
745
|
+
for (const cell of cells) cell.tabIndex = cell === stop ? 0 : -1;
|
|
746
|
+
}
|
|
747
|
+
|
|
748
|
+
/**
|
|
749
|
+
* Makes a month or year date cell the grid's Tab stop, and remembers it across re-renders.
|
|
750
|
+
* @param {HTMLElement} cell Date cell.
|
|
751
|
+
* @returns {void}
|
|
752
|
+
*/
|
|
753
|
+
_moveDateStop(cell) {
|
|
754
|
+
if (!cell.matches(ROVING_DATES)) return;
|
|
755
|
+
for (const stop of this.el.querySelectorAll(`:is(${ROVING_DATES})[tabindex="0"]`)) {
|
|
756
|
+
/** @type {HTMLElement} */ (stop).tabIndex = -1;
|
|
757
|
+
}
|
|
758
|
+
cell.tabIndex = 0;
|
|
759
|
+
this._focusedDate = cell.dataset.date ?? null;
|
|
760
|
+
}
|
|
761
|
+
|
|
705
762
|
/**
|
|
706
763
|
* @param {CalendarEvent} event
|
|
707
764
|
* @param {{variant: 'agenda'|'timed'|'span'|'month', day: Date, resizable?: boolean}} context
|
|
@@ -973,9 +1030,18 @@ export class Calendar extends Component {
|
|
|
973
1030
|
} else return;
|
|
974
1031
|
event.preventDefault();
|
|
975
1032
|
const targetDate = addCalendarDays(date, amount);
|
|
976
|
-
const
|
|
977
|
-
|
|
978
|
-
|
|
1033
|
+
const key = calendarDayKey(targetDate);
|
|
1034
|
+
const find = () => /** @type {HTMLElement|null} */ (this.el.querySelector(`[data-date-cell][data-date="${key}"]`));
|
|
1035
|
+
let target = find();
|
|
1036
|
+
if (!target) {
|
|
1037
|
+
// Off the period: page to it, and land on the day itself rather than wherever focus was.
|
|
1038
|
+
this._focusedDate = key;
|
|
1039
|
+
this.setDate(targetDate);
|
|
1040
|
+
target = find();
|
|
1041
|
+
}
|
|
1042
|
+
if (!target) return;
|
|
1043
|
+
this._moveDateStop(target);
|
|
1044
|
+
target.focus();
|
|
979
1045
|
}
|
|
980
1046
|
|
|
981
1047
|
/** @param {PointerEvent} event @returns {void} */
|
|
@@ -1307,7 +1373,7 @@ export class Calendar extends Component {
|
|
|
1307
1373
|
_canResize(event) {
|
|
1308
1374
|
if (this.options.disabled) return false;
|
|
1309
1375
|
if (event.durationEditable != null) return event.durationEditable;
|
|
1310
|
-
if (this.options.eventDurationEditable
|
|
1376
|
+
if (typeof this.options.eventDurationEditable === 'boolean') return this.options.eventDurationEditable;
|
|
1311
1377
|
return Boolean(this.options.editable);
|
|
1312
1378
|
}
|
|
1313
1379
|
|
|
@@ -1405,9 +1471,10 @@ export class Calendar extends Component {
|
|
|
1405
1471
|
/** @param {HTMLElement} target @returns {void} */
|
|
1406
1472
|
_rememberFocusedDate(target) {
|
|
1407
1473
|
if (target.dataset.slot) this._focusedSlot = target.dataset.slot;
|
|
1474
|
+
else this._moveDateStop(target);
|
|
1408
1475
|
}
|
|
1409
1476
|
|
|
1410
|
-
/** @returns {{eventId?: string, eventAction?: string, date?: string, slot?: string, row?: string, column?: string}|null} */
|
|
1477
|
+
/** @returns {{eventId?: string, eventAction?: string, date?: string, dateCell?: string, slot?: string, row?: string, column?: string}|null} */
|
|
1411
1478
|
_focusIdentity() {
|
|
1412
1479
|
const active = document.activeElement;
|
|
1413
1480
|
if (!(active instanceof HTMLElement) || !this.el.contains(active)) return null;
|
|
@@ -1415,13 +1482,14 @@ export class Calendar extends Component {
|
|
|
1415
1482
|
eventId: active.dataset.eventId,
|
|
1416
1483
|
eventAction: active.dataset.eventAction,
|
|
1417
1484
|
date: active.dataset.date,
|
|
1485
|
+
dateCell: active.dataset.dateCell,
|
|
1418
1486
|
slot: active.dataset.slot,
|
|
1419
1487
|
row: active.dataset.rowIndex,
|
|
1420
1488
|
column: active.dataset.dayIndex
|
|
1421
1489
|
};
|
|
1422
1490
|
}
|
|
1423
1491
|
|
|
1424
|
-
/** @param {{eventId?: string, eventAction?: string, date?: string, slot?: string, row?: string, column?: string}} identity @returns {void} */
|
|
1492
|
+
/** @param {{eventId?: string, eventAction?: string, date?: string, dateCell?: string, slot?: string, row?: string, column?: string}} identity @returns {void} */
|
|
1425
1493
|
_restoreFocus(identity) {
|
|
1426
1494
|
let target = null;
|
|
1427
1495
|
if (identity.eventId) target = this.el.querySelector(
|
|
@@ -1443,6 +1511,9 @@ export class Calendar extends Component {
|
|
|
1443
1511
|
}
|
|
1444
1512
|
}
|
|
1445
1513
|
if (!target && identity.date) target = this.el.querySelector(`[data-date-cell][data-date="${cssEscape(identity.date)}"]`);
|
|
1514
|
+
// A date that left the period hands the keyboard to the grid's Tab stop rather than dropping it.
|
|
1515
|
+
if (!target && identity.dateCell) target = this.el.querySelector(`:is(${ROVING_DATES})[tabindex="0"]`);
|
|
1516
|
+
if (target) this._moveDateStop(/** @type {HTMLElement} */ (target));
|
|
1446
1517
|
target?.focus?.();
|
|
1447
1518
|
}
|
|
1448
1519
|
|
|
@@ -1654,3 +1725,12 @@ function cssEscape(value) {
|
|
|
1654
1725
|
/** @event Calendar#eventschange @type {CustomEvent<{events: CalendarEvent[]}>} */
|
|
1655
1726
|
/** @event Calendar#new @type {CustomEvent<{date: Date, view: CalendarView, jsEvent: Event}>} */
|
|
1656
1727
|
/** @event Calendar#moreclick @type {CustomEvent<{date: Date, count: number, jsEvent: Event}>} */
|
|
1728
|
+
|
|
1729
|
+
/**
|
|
1730
|
+
* Whether a value names a per-event field (a key or a reader function) rather than a policy.
|
|
1731
|
+
* @param {unknown} value
|
|
1732
|
+
* @returns {value is CalendarReader}
|
|
1733
|
+
*/
|
|
1734
|
+
function isCalendarReader(value) {
|
|
1735
|
+
return (typeof value === 'string' && value !== '') || typeof value === 'function';
|
|
1736
|
+
}
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
import { h, restoreTarget, snapshotTarget } from '../../core/dom.js';
|
|
3
3
|
import { ICON_SIZE, icon } from '../../core/icons.js';
|
|
4
4
|
import { uid } from '../../core/util.js';
|
|
5
|
+
import { pageStepRows } from '../table/window.js';
|
|
5
6
|
import { normalizeViewFieldControls, RecordView, readViewField } from '../view/record-view.js';
|
|
6
7
|
import {
|
|
7
8
|
createRecordCard, resolveRecordActions
|
|
@@ -119,8 +120,9 @@ import {
|
|
|
119
120
|
export class CardView extends RecordView {
|
|
120
121
|
static cssName = 'card-view';
|
|
121
122
|
|
|
123
|
+
// Marked pure: a bare spread in a static initialiser keeps the class in every bundle of the entry.
|
|
122
124
|
/** @type {Readonly<CardViewOptions & RecordViewOptions>} */
|
|
123
|
-
static defaults
|
|
125
|
+
static defaults =/* @__PURE__ */ (() => ({
|
|
124
126
|
...RecordView.defaults,
|
|
125
127
|
selectionTrigger: 'checkbox',
|
|
126
128
|
titleField: null,
|
|
@@ -141,7 +143,7 @@ export class CardView extends RecordView {
|
|
|
141
143
|
collapsibleGroups: false,
|
|
142
144
|
collapsedGroups: [],
|
|
143
145
|
renderGroupHeading: null
|
|
144
|
-
};
|
|
146
|
+
}))();
|
|
145
147
|
|
|
146
148
|
/**
|
|
147
149
|
* Creates or enhances a card view.
|
|
@@ -913,10 +915,7 @@ export function cardGridTarget(rects, index, key, options = {}) {
|
|
|
913
915
|
* @returns {number} At least 1.
|
|
914
916
|
*/
|
|
915
917
|
export function cardPageSize(viewport, rowHeight, fallback = 10) {
|
|
916
|
-
|
|
917
|
-
const height = Number(rowHeight);
|
|
918
|
-
if (!(visible > 0) || !(height > 0)) return Math.max(1, Math.trunc(fallback) || 10);
|
|
919
|
-
return Math.max(1, Math.floor(visible / height) - 1);
|
|
918
|
+
return pageStepRows(viewport, rowHeight, fallback);
|
|
920
919
|
}
|
|
921
920
|
|
|
922
921
|
/** @param {Element} element @returns {number} Visible height of its nearest vertical scroll container. */
|
|
@@ -11,10 +11,29 @@
|
|
|
11
11
|
/* The automatic minimum width would carry the 220px floor through the aspect ratio (587px at
|
|
12
12
|
16 / 6) and push the canvas out of a narrow card; narrow, the chart grows taller instead. */
|
|
13
13
|
min-inline-size: 0;
|
|
14
|
-
|
|
14
|
+
/* Styling hook: the least height the viewport keeps, whatever the aspect ratio works out to.
|
|
15
|
+
Set it on the chart or any ancestor. */
|
|
16
|
+
min-block-size: var(--zx-chart-min-block-size, 220px);
|
|
15
17
|
aspect-ratio: var(--zx-chart-aspect-ratio, 16 / 9);
|
|
16
18
|
}
|
|
17
19
|
|
|
20
|
+
/* Fill mode: the container decides the height. The root takes all of it, the viewport (or the
|
|
21
|
+
status that stands in for it) takes what the description and a visible summary leave, and the
|
|
22
|
+
floor applies only where the application set one. */
|
|
23
|
+
.zx-chart[data-fill] {
|
|
24
|
+
grid-template-rows: minmax(0, 1fr);
|
|
25
|
+
block-size: 100%;
|
|
26
|
+
min-block-size: 0;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
.zx-chart[data-fill] > .zx-chart__viewport,
|
|
30
|
+
.zx-chart[data-fill] > .zx-chart__status {
|
|
31
|
+
grid-row: 1;
|
|
32
|
+
min-block-size: var(--zx-chart-min-block-size, 0px);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
.zx-chart[data-fill] > .zx-chart__viewport { aspect-ratio: auto; }
|
|
36
|
+
|
|
18
37
|
.zx-chart__viewport[hidden],
|
|
19
38
|
.zx-chart__status[hidden] { display: none; }
|
|
20
39
|
|
|
@@ -62,3 +81,142 @@
|
|
|
62
81
|
.zx-chart__table td { border-block-end: 1px solid var(--zx-color-border); padding: var(--zx-space-2); text-align: end; }
|
|
63
82
|
.zx-chart__table th:first-child,
|
|
64
83
|
.zx-chart__table td:first-child { text-align: start; }
|
|
84
|
+
|
|
85
|
+
/* SvgChartAdapter: the drawing lies over the canvas, which stays empty and keeps the chart's
|
|
86
|
+
accessible name. A legend above, then the plot, whose viewBox is its own size in pixels. */
|
|
87
|
+
.zx-chart__drawing {
|
|
88
|
+
position: absolute;
|
|
89
|
+
inset: 0;
|
|
90
|
+
display: flex;
|
|
91
|
+
flex-direction: column;
|
|
92
|
+
gap: var(--zx-space-2);
|
|
93
|
+
color: var(--zx-color-text-muted);
|
|
94
|
+
font-size: var(--zx-text-xs);
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
.zx-chart__legend {
|
|
98
|
+
display: flex;
|
|
99
|
+
flex-wrap: wrap;
|
|
100
|
+
justify-content: center;
|
|
101
|
+
gap: var(--zx-space-1) var(--zx-space-4);
|
|
102
|
+
max-block-size: 40%;
|
|
103
|
+
overflow: hidden;
|
|
104
|
+
margin: 0;
|
|
105
|
+
padding: 0;
|
|
106
|
+
list-style: none;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
.zx-chart__legend[hidden] { display: none; }
|
|
110
|
+
|
|
111
|
+
.zx-chart__key {
|
|
112
|
+
display: inline-flex;
|
|
113
|
+
align-items: center;
|
|
114
|
+
gap: var(--zx-space-2);
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
.zx-chart__swatch {
|
|
118
|
+
flex: none;
|
|
119
|
+
inline-size: var(--zx-space-3);
|
|
120
|
+
block-size: var(--zx-space-3);
|
|
121
|
+
border-radius: var(--zx-radius-sm);
|
|
122
|
+
background: var(--zx-chart-series);
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
/* A line series is keyed with a stroke, dashed like its line on the palette's second pass. */
|
|
126
|
+
.zx-chart__drawing[data-type="line"] .zx-chart__swatch {
|
|
127
|
+
block-size: 0;
|
|
128
|
+
border-block-start: 2px solid var(--zx-chart-series);
|
|
129
|
+
border-radius: 0;
|
|
130
|
+
background: none;
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
.zx-chart__drawing[data-type="line"] [data-cycle="2"] > .zx-chart__swatch { border-block-start-style: dashed; }
|
|
134
|
+
.zx-chart__drawing:not([data-type="line"]) [data-cycle="2"] > .zx-chart__swatch { opacity: .55; }
|
|
135
|
+
|
|
136
|
+
.zx-chart__plot {
|
|
137
|
+
display: block;
|
|
138
|
+
flex: 1 1 0;
|
|
139
|
+
inline-size: 100%;
|
|
140
|
+
min-block-size: 0;
|
|
141
|
+
overflow: visible;
|
|
142
|
+
/* The axes are not mirrored, so in a right-to-left document the text anchors must still mean
|
|
143
|
+
what the layout measured them for: labels keep their own bidi order, the plot its sides. */
|
|
144
|
+
direction: ltr;
|
|
145
|
+
font-variant-numeric: tabular-nums;
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
.zx-chart__tick { fill: currentColor; }
|
|
149
|
+
|
|
150
|
+
.zx-chart__grid-line {
|
|
151
|
+
stroke: var(--zx-color-border-subtle);
|
|
152
|
+
stroke-width: 1;
|
|
153
|
+
shape-rendering: crispEdges;
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
.zx-chart__baseline {
|
|
157
|
+
stroke: var(--zx-color-border-strong);
|
|
158
|
+
stroke-width: 1;
|
|
159
|
+
shape-rendering: crispEdges;
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
/* The palette slot a series (or, in a pie, a category) is painted with. */
|
|
163
|
+
.zx-chart__drawing [data-series="1"] { --zx-chart-series: var(--zx-color-chart-1); }
|
|
164
|
+
.zx-chart__drawing [data-series="2"] { --zx-chart-series: var(--zx-color-chart-2); }
|
|
165
|
+
.zx-chart__drawing [data-series="3"] { --zx-chart-series: var(--zx-color-chart-3); }
|
|
166
|
+
.zx-chart__drawing [data-series="4"] { --zx-chart-series: var(--zx-color-chart-4); }
|
|
167
|
+
.zx-chart__drawing [data-series="5"] { --zx-chart-series: var(--zx-color-chart-5); }
|
|
168
|
+
.zx-chart__drawing [data-series="6"] { --zx-chart-series: var(--zx-color-chart-6); }
|
|
169
|
+
.zx-chart__drawing [data-series="7"] { --zx-chart-series: var(--zx-color-chart-7); }
|
|
170
|
+
.zx-chart__drawing [data-series="8"] { --zx-chart-series: var(--zx-color-chart-8); }
|
|
171
|
+
|
|
172
|
+
.zx-chart__bar,
|
|
173
|
+
.zx-chart__point,
|
|
174
|
+
.zx-chart__slice { fill: var(--zx-chart-series); }
|
|
175
|
+
|
|
176
|
+
.zx-chart__line {
|
|
177
|
+
fill: none;
|
|
178
|
+
stroke: var(--zx-chart-series);
|
|
179
|
+
stroke-width: 2;
|
|
180
|
+
stroke-linecap: round;
|
|
181
|
+
stroke-linejoin: round;
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
.zx-chart__track { fill: var(--zx-color-bg-muted); }
|
|
185
|
+
|
|
186
|
+
/* Past the eighth series the palette starts over: lighter bars and slices, dashed lines. */
|
|
187
|
+
[data-cycle="2"] > .zx-chart__bar,
|
|
188
|
+
.zx-chart__slice[data-cycle="2"] { fill-opacity: .55; }
|
|
189
|
+
[data-cycle="2"] > .zx-chart__line { stroke-dasharray: 6 4; }
|
|
190
|
+
|
|
191
|
+
/* A line too dense for points keeps an unpainted target per value, which names it on hover. */
|
|
192
|
+
.zx-chart__point[data-hit] { fill-opacity: 0; }
|
|
193
|
+
|
|
194
|
+
@media (hover: hover) {
|
|
195
|
+
.zx-chart__mark:hover { opacity: .8; }
|
|
196
|
+
.zx-chart__point[data-hit]:hover { fill-opacity: 1; }
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
/* The first drawing grows in; a redraw never does (the adapter sets data-animate once). */
|
|
200
|
+
@media (prefers-reduced-motion: no-preference) {
|
|
201
|
+
.zx-chart__drawing[data-animate] .zx-chart__bar {
|
|
202
|
+
transform-box: fill-box;
|
|
203
|
+
transform-origin: 50% 100%;
|
|
204
|
+
animation: zx-chart-grow calc(var(--zx-dur-base) * 3) var(--zx-ease) both;
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
.zx-chart__drawing[data-animate] .zx-chart__bar[data-negative] { transform-origin: 50% 0; }
|
|
208
|
+
|
|
209
|
+
.zx-chart__drawing[data-animate] .zx-chart__line,
|
|
210
|
+
.zx-chart__drawing[data-animate] .zx-chart__point {
|
|
211
|
+
animation: zx-chart-fade calc(var(--zx-dur-base) * 3) var(--zx-ease) both;
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
.zx-chart__drawing[data-animate] .zx-chart__ring {
|
|
215
|
+
transform-box: view-box;
|
|
216
|
+
animation: zx-chart-open calc(var(--zx-dur-base) * 3) var(--zx-ease) both;
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
@keyframes zx-chart-grow { from { transform: scaleY(0); } }
|
|
221
|
+
@keyframes zx-chart-fade { from { opacity: 0; } }
|
|
222
|
+
@keyframes zx-chart-open { from { opacity: 0; transform: scale(.85); } }
|