@zeyos/zx 5.7.0 → 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 +330 -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 +48 -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 +15 -4
- 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 +45 -8
- 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 +31 -1
- 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 +20 -6
- 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/dom.d.ts +14 -0
- 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 +3161 -515
- 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 +970 -57
- package/dist/zx.esm.js +6405 -2249
- package/dist/zx.esm.min.js +26 -26
- package/dist/zx.global.js +6405 -2249
- package/dist/zx.global.min.js +26 -26
- package/dist/zx.layered.css +972 -57
- 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 +3154 -518
- 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 +725 -109
- 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/button/button.css +24 -11
- 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.css +9 -1
- package/src/components/checklist/checklist.js +105 -20
- package/src/components/checklist/field-adapter.js +6 -12
- 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 +24 -33
- 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 +129 -30
- 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 +70 -16
- 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 +39 -13
- 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/dom.js +45 -2
- 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 +60 -8
- package/src/core/keyboard.js +83 -9
- package/src/core/messages.js +3 -0
- package/src/core/position.js +4 -3
- 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
|
@@ -24,6 +24,14 @@ export type NumberFieldOptions = {
|
|
|
24
24
|
* Decimal places; derived from `step` when null.
|
|
25
25
|
*/
|
|
26
26
|
precision?: number | null;
|
|
27
|
+
/**
|
|
28
|
+
* Whether a typed or assigned value is moved onto the `step` grid.
|
|
29
|
+
* With `false` the value is kept exactly as entered — `step` is then only the increment of the
|
|
30
|
+
* buttons and arrow keys, and decimals are rounded only to an explicit `precision`. `min` and
|
|
31
|
+
* `max` still apply. Use it for values that are not multiples of anything: an identifier, a
|
|
32
|
+
* seed, a measurement.
|
|
33
|
+
*/
|
|
34
|
+
snap?: boolean;
|
|
27
35
|
/**
|
|
28
36
|
* Whether stepping past a bound wraps to the other one.
|
|
29
37
|
*/
|
|
@@ -89,6 +97,11 @@ export type NumberFieldOptions = {
|
|
|
89
97
|
* @property {number} [step=1] Increment applied by the buttons and arrow keys.
|
|
90
98
|
* @property {number} [largeStep=10] Multiple of `step` applied by PageUp/PageDown.
|
|
91
99
|
* @property {number|null} [precision=null] Decimal places; derived from `step` when null.
|
|
100
|
+
* @property {boolean} [snap=true] Whether a typed or assigned value is moved onto the `step` grid.
|
|
101
|
+
* With `false` the value is kept exactly as entered — `step` is then only the increment of the
|
|
102
|
+
* buttons and arrow keys, and decimals are rounded only to an explicit `precision`. `min` and
|
|
103
|
+
* `max` still apply. Use it for values that are not multiples of anything: an identifier, a
|
|
104
|
+
* seed, a measurement.
|
|
92
105
|
* @property {boolean} [wrap=false] Whether stepping past a bound wraps to the other one.
|
|
93
106
|
* @property {string} [placeholder=''] Empty-state text.
|
|
94
107
|
* @property {string|null} [label=null] Accessible name for the spinbutton.
|
|
@@ -122,7 +135,9 @@ export declare class NumberField extends Component<NumberFieldOptions> {
|
|
|
122
135
|
_createdRoot: boolean;
|
|
123
136
|
_snapshot: import("../../core/dom.js").TargetSnapshot;
|
|
124
137
|
_step: number;
|
|
138
|
+
_snap: boolean;
|
|
125
139
|
_precision: number;
|
|
140
|
+
_fixedPrecision: boolean;
|
|
126
141
|
_min: number;
|
|
127
142
|
_max: number;
|
|
128
143
|
_separatorLocale: string;
|
|
@@ -150,7 +165,8 @@ export declare class NumberField extends Component<NumberFieldOptions> {
|
|
|
150
165
|
*/
|
|
151
166
|
get(): number | null;
|
|
152
167
|
/**
|
|
153
|
-
* Sets the value,
|
|
168
|
+
* Sets the value, clamping it into `[min, max]` and — unless `snap` is off — moving it onto the
|
|
169
|
+
* `step` grid.
|
|
154
170
|
* @param {number|string|null} next Next value; empty strings and null clear the field.
|
|
155
171
|
* @param {{silent?: boolean}} [options={}] Set `silent` to suppress `change`.
|
|
156
172
|
* @returns {this}
|
|
@@ -250,6 +266,13 @@ export declare class NumberField extends Component<NumberFieldOptions> {
|
|
|
250
266
|
* @returns {string}
|
|
251
267
|
*/
|
|
252
268
|
_format(value: number, editing: boolean): string;
|
|
269
|
+
/**
|
|
270
|
+
* Decimal places a value is held and shown at: the field's precision, widened to the value's
|
|
271
|
+
* own decimals when nothing fixed the precision (`snap: false` without `precision`).
|
|
272
|
+
* @param {number} value Value in question.
|
|
273
|
+
* @returns {number}
|
|
274
|
+
*/
|
|
275
|
+
_decimalsFor(value: number): number;
|
|
253
276
|
/**
|
|
254
277
|
* @param {string} key Message key.
|
|
255
278
|
* @param {string} fallback Text used when the host has no translation.
|
|
@@ -301,3 +324,10 @@ export declare function snapNumber(value: number, { min, max, step, precision }:
|
|
|
301
324
|
step: number;
|
|
302
325
|
precision: number;
|
|
303
326
|
}): number;
|
|
327
|
+
/**
|
|
328
|
+
* Decimal places in a number's shortest exact notation, exponent form included (`2.5e-7` has 8).
|
|
329
|
+
* Shared with Slider, whose `stepPrecision()` is this.
|
|
330
|
+
* @param {number} value Number to measure.
|
|
331
|
+
* @returns {number}
|
|
332
|
+
*/
|
|
333
|
+
export declare function decimalsOf(value: number): number;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { Component } from '../../core/component.js';
|
|
2
|
+
import { Toggle } from '../toggle/toggle.js';
|
|
2
3
|
export type PaginationMode = 'pages' | 'loadmore';
|
|
3
4
|
export type PaginationRangeOptions = {
|
|
4
5
|
/**
|
|
@@ -37,23 +38,126 @@ export type PaginationRangeOptions = {
|
|
|
37
38
|
* @returns {Array<number|'…'>} One-based page numbers interleaved with ellipses.
|
|
38
39
|
*/
|
|
39
40
|
export declare function paginationRange({ page, pages, siblings, boundaries }?: PaginationRangeOptions): Array<number | '…'>;
|
|
41
|
+
export type FitPageSizeOptions = {
|
|
42
|
+
/**
|
|
43
|
+
* Height the rows may fill, in pixels: the viewport's content box.
|
|
44
|
+
*/
|
|
45
|
+
available: number;
|
|
46
|
+
/**
|
|
47
|
+
* Height of one row of items, the gap to the next included, in pixels.
|
|
48
|
+
*/
|
|
49
|
+
rowHeight: number;
|
|
50
|
+
/**
|
|
51
|
+
* Items per row: 1 for a table or a list, the column count of a grid.
|
|
52
|
+
*/
|
|
53
|
+
perRow?: number;
|
|
54
|
+
/**
|
|
55
|
+
* Pixels of `available` something else takes, such as a sticky
|
|
56
|
+
* table header. Negative gives space back — a grid's last row has no gap after it.
|
|
57
|
+
*/
|
|
58
|
+
reserve?: number;
|
|
59
|
+
/**
|
|
60
|
+
* Smallest size returned.
|
|
61
|
+
*/
|
|
62
|
+
min?: number;
|
|
63
|
+
/**
|
|
64
|
+
* Largest size returned.
|
|
65
|
+
*/
|
|
66
|
+
max?: number;
|
|
67
|
+
};
|
|
68
|
+
/**
|
|
69
|
+
* @typedef {Object} FitPageSizeOptions
|
|
70
|
+
* @property {number} available Height the rows may fill, in pixels: the viewport's content box.
|
|
71
|
+
* @property {number} rowHeight Height of one row of items, the gap to the next included, in pixels.
|
|
72
|
+
* @property {number} [perRow=1] Items per row: 1 for a table or a list, the column count of a grid.
|
|
73
|
+
* @property {number} [reserve=0] Pixels of `available` something else takes, such as a sticky
|
|
74
|
+
* table header. Negative gives space back — a grid's last row has no gap after it.
|
|
75
|
+
* @property {number} [min=1] Smallest size returned.
|
|
76
|
+
* @property {number} [max=Infinity] Largest size returned.
|
|
77
|
+
*/
|
|
78
|
+
/**
|
|
79
|
+
* Computes how many items fill a viewport: whole rows only, times the items per row. The rows are
|
|
80
|
+
* clamped so the size stays within `[min, max]` in whole rows — `min` rounds up to a full row,
|
|
81
|
+
* `max` down to one, and there is always at least one row — so a grid never ends on a partial
|
|
82
|
+
* row. Pure arithmetic, no DOM — the component measures, this decides.
|
|
83
|
+
*
|
|
84
|
+
* Returns 0 when there is nothing to measure yet (no height, no row height), so a caller can keep
|
|
85
|
+
* the size it has rather than collapse to the minimum while a view is still hidden.
|
|
86
|
+
* @param {FitPageSizeOptions} options Measurements.
|
|
87
|
+
* @returns {number} Items per page, or 0 when unknown.
|
|
88
|
+
*/
|
|
89
|
+
export declare function fitPageSize({ available, rowHeight, perRow, reserve, min, max }?: FitPageSizeOptions): number;
|
|
90
|
+
export type PageFitStep = {
|
|
91
|
+
/**
|
|
92
|
+
* The page size just measured.
|
|
93
|
+
*/
|
|
94
|
+
size: number;
|
|
95
|
+
/**
|
|
96
|
+
* The page size the pager has now.
|
|
97
|
+
*/
|
|
98
|
+
current: number;
|
|
99
|
+
/**
|
|
100
|
+
* The sizes the pager's recent fits applied, oldest first.
|
|
101
|
+
*/
|
|
102
|
+
trail?: number[];
|
|
103
|
+
/**
|
|
104
|
+
* The viewport's size now: its height in pixels, or a key that
|
|
105
|
+
* changes with its width and height (`'640x300'`), as the component passes.
|
|
106
|
+
*/
|
|
107
|
+
viewport: number | string;
|
|
108
|
+
/**
|
|
109
|
+
* The viewport's size, in the same form, as the
|
|
110
|
+
* pager's last applied fit left it; null before the first fit.
|
|
111
|
+
*/
|
|
112
|
+
settled?: number | string | null;
|
|
113
|
+
};
|
|
114
|
+
/**
|
|
115
|
+
* @typedef {Object} PageFitStep
|
|
116
|
+
* @property {number} size The page size just measured.
|
|
117
|
+
* @property {number} current The page size the pager has now.
|
|
118
|
+
* @property {number[]} [trail=[]] The sizes the pager's recent fits applied, oldest first.
|
|
119
|
+
* @property {number|string} viewport The viewport's size now: its height in pixels, or a key that
|
|
120
|
+
* changes with its width and height (`'640x300'`), as the component passes.
|
|
121
|
+
* @property {number|string|null} [settled=null] The viewport's size, in the same form, as the
|
|
122
|
+
* pager's last applied fit left it; null before the first fit.
|
|
123
|
+
*/
|
|
124
|
+
/**
|
|
125
|
+
* Decides whether a measured page size replaces the current one while the pager fits its
|
|
126
|
+
* viewport. Pure, no DOM — the component measures and keeps the state, this decides.
|
|
127
|
+
*
|
|
128
|
+
* A fit changes the page count, and that can change the viewport it was measured in — a footer
|
|
129
|
+
* that wraps with the longer page numbers — so two sizes could take turns for ever. While the
|
|
130
|
+
* viewport still has the size the last fit left it at, a size that would take the pager back up
|
|
131
|
+
* to where it was two fits ago is that loop, and the smaller size stays. A viewport whose height
|
|
132
|
+
* or width changed since was resized by something else (a drawer, the window, a card grid's
|
|
133
|
+
* columns), and its size is followed whichever way it went, with the trail starting over.
|
|
134
|
+
* @param {PageFitStep} step Measurements and the pager's recent fits.
|
|
135
|
+
* @returns {{apply: boolean, trail: number[]}} Whether to apply `size`, and the trail to keep.
|
|
136
|
+
*/
|
|
137
|
+
export declare function pageFitStep({ size, current, trail, viewport, settled }: PageFitStep): {
|
|
138
|
+
apply: boolean;
|
|
139
|
+
trail: number[];
|
|
140
|
+
};
|
|
141
|
+
export type PaginationMeasure = number | ((viewport: Element) => number | null | undefined) | null;
|
|
40
142
|
export type PaginationOptions = {
|
|
41
143
|
/**
|
|
42
144
|
* One-based current page.
|
|
43
145
|
*/
|
|
44
146
|
page?: number;
|
|
45
147
|
/**
|
|
46
|
-
* Rows per page
|
|
148
|
+
* Rows per page, or `'auto'`: as many as fit `viewport`
|
|
149
|
+
* without scrolling, measured again whenever the viewport changes size.
|
|
47
150
|
*/
|
|
48
|
-
pageSize?: number;
|
|
151
|
+
pageSize?: number | 'auto';
|
|
49
152
|
/**
|
|
50
153
|
* Total row count; 0 is one empty page.
|
|
51
154
|
*/
|
|
52
155
|
total?: number;
|
|
53
156
|
/**
|
|
54
|
-
* Choices offered by the page-size
|
|
157
|
+
* Choices offered by the page-size
|
|
158
|
+
* select. `'auto'` offers the fitted size, shown with the count it currently stands for.
|
|
55
159
|
*/
|
|
56
|
-
pageSizes?: number
|
|
160
|
+
pageSizes?: Array<number | 'auto'>;
|
|
57
161
|
/**
|
|
58
162
|
* Pages shown either side of the current one.
|
|
59
163
|
*/
|
|
@@ -75,6 +179,52 @@ export type PaginationOptions = {
|
|
|
75
179
|
* "Load more" button for append-style lists.
|
|
76
180
|
*/
|
|
77
181
|
mode?: PaginationMode;
|
|
182
|
+
/**
|
|
183
|
+
* Loads the next page by itself when the end of the list
|
|
184
|
+
* scrolls into view — infinite scroll. The pager then appends, as in `loadmore`, whatever `mode`
|
|
185
|
+
* says; `mode` is what it returns to when auto-load is switched off.
|
|
186
|
+
*/
|
|
187
|
+
autoLoad?: boolean;
|
|
188
|
+
/**
|
|
189
|
+
* Whether to render the Auto-load switch, so the reader
|
|
190
|
+
* decides between paging and continuous scrolling.
|
|
191
|
+
*/
|
|
192
|
+
showAutoLoad?: boolean;
|
|
193
|
+
/**
|
|
194
|
+
* The element the rows
|
|
195
|
+
* scroll in. `'auto'` fits the page to its height; auto-load watches its scroll position. A
|
|
196
|
+
* function is asked again on `refit()`, for a host that swaps its views. Without one, auto-load
|
|
197
|
+
* watches the pager itself approach the end of its scrolling ancestor, which suits a pager that
|
|
198
|
+
* follows the rows; a pager in a fixed footer needs the viewport.
|
|
199
|
+
*/
|
|
200
|
+
viewport?: Element | string | (() => Element | null) | null;
|
|
201
|
+
/**
|
|
202
|
+
* One row's height, gap included. By default the
|
|
203
|
+
* first body row of a Zx Table in the viewport (`tbody > tr[data-row]`), else `--zx-row-height`.
|
|
204
|
+
*/
|
|
205
|
+
rowHeight?: PaginationMeasure;
|
|
206
|
+
/**
|
|
207
|
+
* Items per row, for a grid of cards.
|
|
208
|
+
*/
|
|
209
|
+
perRow?: PaginationMeasure;
|
|
210
|
+
/**
|
|
211
|
+
* Pixels of the viewport the rows cannot use. By
|
|
212
|
+
* default the height of the viewport's `thead`, which sticks above the rows.
|
|
213
|
+
*/
|
|
214
|
+
reserve?: PaginationMeasure;
|
|
215
|
+
/**
|
|
216
|
+
* Smallest fitted page size.
|
|
217
|
+
*/
|
|
218
|
+
minPageSize?: number;
|
|
219
|
+
/**
|
|
220
|
+
* Largest fitted page size.
|
|
221
|
+
*/
|
|
222
|
+
maxPageSize?: number;
|
|
223
|
+
/**
|
|
224
|
+
* How close to the end, in pixels, auto-load
|
|
225
|
+
* starts on the next page; half the viewport by default, so the rows arrive before they are due.
|
|
226
|
+
*/
|
|
227
|
+
autoLoadMargin?: number | null;
|
|
78
228
|
/**
|
|
79
229
|
* Whether every control starts disabled.
|
|
80
230
|
*/
|
|
@@ -87,6 +237,12 @@ export type PaginationOptions = {
|
|
|
87
237
|
* Change listener.
|
|
88
238
|
*/
|
|
89
239
|
onchange?: (event: CustomEvent<PaginationChangeDetail>) => void;
|
|
240
|
+
/**
|
|
241
|
+
* Auto-load switch listener.
|
|
242
|
+
*/
|
|
243
|
+
onautoload?: (event: CustomEvent<{
|
|
244
|
+
autoLoad: boolean;
|
|
245
|
+
}>) => void;
|
|
90
246
|
};
|
|
91
247
|
export type PaginationState = {
|
|
92
248
|
/**
|
|
@@ -94,7 +250,7 @@ export type PaginationState = {
|
|
|
94
250
|
*/
|
|
95
251
|
page: number;
|
|
96
252
|
/**
|
|
97
|
-
* Rows per page
|
|
253
|
+
* Rows per page: the fitted count while `auto`.
|
|
98
254
|
*/
|
|
99
255
|
pageSize: number;
|
|
100
256
|
/**
|
|
@@ -109,33 +265,90 @@ export type PaginationState = {
|
|
|
109
265
|
* Zero-based row offset of the current page.
|
|
110
266
|
*/
|
|
111
267
|
offset: number;
|
|
268
|
+
/**
|
|
269
|
+
* Whether the page size is fitted to the viewport.
|
|
270
|
+
*/
|
|
271
|
+
auto: boolean;
|
|
272
|
+
/**
|
|
273
|
+
* Whether the next page loads as the end comes into view.
|
|
274
|
+
*/
|
|
275
|
+
autoLoad: boolean;
|
|
276
|
+
/**
|
|
277
|
+
* What the pager shows: `loadmore` while auto-load is on.
|
|
278
|
+
*/
|
|
279
|
+
mode: PaginationMode;
|
|
280
|
+
};
|
|
281
|
+
export type PaginationReason = 'page' | 'pageSize' | 'fit' | 'more' | 'scroll' | 'mode' | 'state';
|
|
282
|
+
export type PaginationChangeDetail = PaginationState & {
|
|
283
|
+
reason: PaginationReason;
|
|
284
|
+
append: boolean;
|
|
112
285
|
};
|
|
113
|
-
|
|
286
|
+
/**
|
|
287
|
+
* A measurement the pager takes from its viewport: a number of pixels (or items, for `perRow`),
|
|
288
|
+
* or a function that reads it from the viewport — returning null hands back to the default.
|
|
289
|
+
* @typedef {number|((viewport: Element) => number|null|undefined)|null} PaginationMeasure
|
|
290
|
+
*/
|
|
114
291
|
/**
|
|
115
292
|
* @typedef {Object} PaginationOptions
|
|
116
293
|
* @property {number} [page=1] One-based current page.
|
|
117
|
-
* @property {number} [pageSize=25] Rows per page
|
|
294
|
+
* @property {number|'auto'} [pageSize=25] Rows per page, or `'auto'`: as many as fit `viewport`
|
|
295
|
+
* without scrolling, measured again whenever the viewport changes size.
|
|
118
296
|
* @property {number} [total=0] Total row count; 0 is one empty page.
|
|
119
|
-
* @property {number
|
|
297
|
+
* @property {Array<number|'auto'>} [pageSizes=[25, 50, 100]] Choices offered by the page-size
|
|
298
|
+
* select. `'auto'` offers the fitted size, shown with the count it currently stands for.
|
|
120
299
|
* @property {number} [siblings=1] Pages shown either side of the current one.
|
|
121
300
|
* @property {number} [boundaries=1] Pages pinned at each end of the range.
|
|
122
301
|
* @property {boolean} [showPageSize=true] Whether to render the page-size select.
|
|
123
302
|
* @property {boolean} [showSummary=true] Whether to render the "26–50 of 312" summary.
|
|
124
303
|
* @property {PaginationMode} [mode='pages'] `pages` renders a numbered pager, `loadmore` a single
|
|
125
304
|
* "Load more" button for append-style lists.
|
|
305
|
+
* @property {boolean} [autoLoad=false] Loads the next page by itself when the end of the list
|
|
306
|
+
* scrolls into view — infinite scroll. The pager then appends, as in `loadmore`, whatever `mode`
|
|
307
|
+
* says; `mode` is what it returns to when auto-load is switched off.
|
|
308
|
+
* @property {boolean} [showAutoLoad=false] Whether to render the Auto-load switch, so the reader
|
|
309
|
+
* decides between paging and continuous scrolling.
|
|
310
|
+
* @property {Element|string|(() => Element|null)|null} [viewport=null] The element the rows
|
|
311
|
+
* scroll in. `'auto'` fits the page to its height; auto-load watches its scroll position. A
|
|
312
|
+
* function is asked again on `refit()`, for a host that swaps its views. Without one, auto-load
|
|
313
|
+
* watches the pager itself approach the end of its scrolling ancestor, which suits a pager that
|
|
314
|
+
* follows the rows; a pager in a fixed footer needs the viewport.
|
|
315
|
+
* @property {PaginationMeasure} [rowHeight=null] One row's height, gap included. By default the
|
|
316
|
+
* first body row of a Zx Table in the viewport (`tbody > tr[data-row]`), else `--zx-row-height`.
|
|
317
|
+
* @property {PaginationMeasure} [perRow=1] Items per row, for a grid of cards.
|
|
318
|
+
* @property {PaginationMeasure} [reserve=null] Pixels of the viewport the rows cannot use. By
|
|
319
|
+
* default the height of the viewport's `thead`, which sticks above the rows.
|
|
320
|
+
* @property {number} [minPageSize=5] Smallest fitted page size.
|
|
321
|
+
* @property {number} [maxPageSize=200] Largest fitted page size.
|
|
322
|
+
* @property {number|null} [autoLoadMargin=null] How close to the end, in pixels, auto-load
|
|
323
|
+
* starts on the next page; half the viewport by default, so the rows arrive before they are due.
|
|
126
324
|
* @property {boolean} [disabled=false] Whether every control starts disabled.
|
|
127
325
|
* @property {Record<string, string>|Record<string, Record<string, string>>} [msg] Localized messages.
|
|
128
326
|
* @property {(event: CustomEvent<PaginationChangeDetail>) => void} [onchange] Change listener.
|
|
327
|
+
* @property {(event: CustomEvent<{autoLoad: boolean}>) => void} [onautoload] Auto-load switch listener.
|
|
129
328
|
*/
|
|
130
329
|
/**
|
|
131
330
|
* @typedef {Object} PaginationState
|
|
132
331
|
* @property {number} page One-based current page.
|
|
133
|
-
* @property {number} pageSize Rows per page
|
|
332
|
+
* @property {number} pageSize Rows per page: the fitted count while `auto`.
|
|
134
333
|
* @property {number} total Total row count.
|
|
135
334
|
* @property {number} pages Number of pages; at least 1.
|
|
136
335
|
* @property {number} offset Zero-based row offset of the current page.
|
|
336
|
+
* @property {boolean} auto Whether the page size is fitted to the viewport.
|
|
337
|
+
* @property {boolean} autoLoad Whether the next page loads as the end comes into view.
|
|
338
|
+
* @property {PaginationMode} mode What the pager shows: `loadmore` while auto-load is on.
|
|
339
|
+
*/
|
|
340
|
+
/**
|
|
341
|
+
* Why a `change` fired: `page` (a page button, previous/next, `setPage()`), `pageSize` (the select,
|
|
342
|
+
* `setPageSize()`), `fit` (the fitted size followed the viewport), `more` (Load more), `scroll`
|
|
343
|
+
* (auto-load), `mode` (auto-load switched between paging and appending), or `state` (`setState()`).
|
|
344
|
+
* @typedef {'page'|'pageSize'|'fit'|'more'|'scroll'|'mode'|'state'} PaginationReason
|
|
345
|
+
*/
|
|
346
|
+
/**
|
|
347
|
+
* @typedef {PaginationState & {reason: PaginationReason, append: boolean}} PaginationChangeDetail
|
|
348
|
+
* `append` is true when the rows `offset … offset + pageSize` go after the ones already shown
|
|
349
|
+
* (Load more, auto-load). Otherwise the slice is shown from scratch: rows
|
|
350
|
+
* `offset … offset + pageSize` when paging, rows `0 … page × pageSize` while appending.
|
|
137
351
|
*/
|
|
138
|
-
/** @typedef {PaginationState} PaginationChangeDetail */
|
|
139
352
|
/**
|
|
140
353
|
* The pager for a server-backed list. It owns no data: it reports which slice the user asked for
|
|
141
354
|
* — `page`, `pageSize`, and the zero-based row `offset = (page - 1) * pageSize` — and lets the
|
|
@@ -156,21 +369,49 @@ export type PaginationChangeDetail = PaginationState;
|
|
|
156
369
|
*
|
|
157
370
|
* In `loadmore` mode each `change` stands for one `binding.loadMore()`, which appends.
|
|
158
371
|
*
|
|
372
|
+
* Two things adapt the pager to the screen. `pageSize: 'auto'` fits the page to `viewport` — no
|
|
373
|
+
* scrollbar, no empty half page — and follows it as the window, the theme's row height, or a drawer changes
|
|
374
|
+
* its height, keeping the first row of the page on it. `autoLoad` turns paging into continuous
|
|
375
|
+
* scrolling: the next page arrives as the end of the list comes into view. An application loading
|
|
376
|
+
* asynchronously calls `disable()` in its `change` listener and `enable()` once the rows are in;
|
|
377
|
+
* auto-load waits for that, so it never asks for two pages at once.
|
|
378
|
+
*
|
|
159
379
|
* `page` is clamped into `[1, pages]` after every state change, so shrinking `total` under the
|
|
160
380
|
* user's feet can never leave the pager pointing past the end of the data.
|
|
161
381
|
* @fires Pagination#change
|
|
382
|
+
* @fires Pagination#autoload
|
|
162
383
|
* @extends {Component<PaginationOptions>}
|
|
163
384
|
*/
|
|
164
385
|
export declare class Pagination extends Component<PaginationOptions> {
|
|
165
386
|
_createdRoot: boolean;
|
|
166
387
|
_snapshot: import("../../core/dom.js").TargetSnapshot;
|
|
167
388
|
_destroyed: boolean;
|
|
389
|
+
_offerAuto: boolean;
|
|
390
|
+
_pageSizes: number[];
|
|
391
|
+
_auto: boolean;
|
|
168
392
|
_pageSize: number;
|
|
169
393
|
_total: number;
|
|
170
394
|
_page: number;
|
|
171
395
|
_disabled: boolean;
|
|
396
|
+
_autoLoad: any;
|
|
172
397
|
_sizeKey: any;
|
|
173
|
-
|
|
398
|
+
/** @type {{fit: number, load: number}} Pending animation frames, one per kind of check. */
|
|
399
|
+
_frames: {
|
|
400
|
+
fit: number;
|
|
401
|
+
load: number;
|
|
402
|
+
};
|
|
403
|
+
/** @type {number[]} The fitted sizes most recently applied, to stop a resize from oscillating. */
|
|
404
|
+
_fitTrail: number[];
|
|
405
|
+
/** @type {number|null} The viewport's height as the last applied fit left it. */
|
|
406
|
+
_fitSize: number | null;
|
|
407
|
+
/** @type {ResizeObserver|null} */
|
|
408
|
+
_observer: ResizeObserver | null;
|
|
409
|
+
/** @type {Element|null} The viewport being observed. */
|
|
410
|
+
_observed: Element | null;
|
|
411
|
+
/** @type {Element|null} The viewport's first child, observed beside it. */
|
|
412
|
+
_observedContent: Element | null;
|
|
413
|
+
/** @type {Toggle|null} */
|
|
414
|
+
_switch: Toggle | null;
|
|
174
415
|
static cssName: string;
|
|
175
416
|
/** @type {Readonly<PaginationOptions>} */
|
|
176
417
|
static defaults: Readonly<PaginationOptions>;
|
|
@@ -200,36 +441,60 @@ export declare class Pagination extends Component<PaginationOptions> {
|
|
|
200
441
|
*/
|
|
201
442
|
setTotal(total: number): this;
|
|
202
443
|
/**
|
|
203
|
-
* Replaces the page size and returns to page 1.
|
|
204
|
-
* @param {number} pageSize Rows per page.
|
|
444
|
+
* Replaces the page size and returns to page 1. `'auto'` fits it to the viewport.
|
|
445
|
+
* @param {number|'auto'} pageSize Rows per page.
|
|
205
446
|
* @returns {this}
|
|
206
447
|
* @fires Pagination#change
|
|
207
448
|
*/
|
|
208
|
-
setPageSize(pageSize: number): this;
|
|
449
|
+
setPageSize(pageSize: number | 'auto'): this;
|
|
209
450
|
/**
|
|
210
451
|
* Applies any combination of page, page size, and total in one pass, then clamps the page.
|
|
211
452
|
* `change` fires when the effective page or page size moved — updating only `total` is silent
|
|
212
453
|
* unless the new count clamps the page.
|
|
213
|
-
* @param {
|
|
454
|
+
* @param {{page?: number, pageSize?: number|'auto', total?: number}} [state={}] Values to change.
|
|
214
455
|
* @param {{silent?: boolean}} [options={}] Set `silent` to suppress the event.
|
|
215
456
|
* @returns {this}
|
|
216
457
|
* @fires Pagination#change
|
|
217
458
|
*/
|
|
218
|
-
setState(state?:
|
|
459
|
+
setState(state?: {
|
|
460
|
+
page?: number;
|
|
461
|
+
pageSize?: number | 'auto';
|
|
462
|
+
total?: number;
|
|
463
|
+
}, { silent }?: {
|
|
219
464
|
silent?: boolean;
|
|
220
465
|
}): this;
|
|
466
|
+
/**
|
|
467
|
+
* Switches auto-load. Where that changes what the pager shows — paging becomes appending, or
|
|
468
|
+
* back — it returns to page 1 and fires `change` with reason `mode`.
|
|
469
|
+
* @param {boolean} autoLoad Whether the next page loads as the end comes into view.
|
|
470
|
+
* @param {{silent?: boolean}} [options={}] Set `silent` to suppress both events.
|
|
471
|
+
* @returns {this}
|
|
472
|
+
* @fires Pagination#autoload
|
|
473
|
+
* @fires Pagination#change
|
|
474
|
+
*/
|
|
475
|
+
setAutoLoad(autoLoad: boolean, { silent }?: {
|
|
476
|
+
silent?: boolean;
|
|
477
|
+
}): this;
|
|
478
|
+
/**
|
|
479
|
+
* Measures the viewport again — after the host swapped what it shows in it, or replaced it
|
|
480
|
+
* (a `viewport` function is asked again) — and refits an `'auto'` page size. Cheap to call after
|
|
481
|
+
* every redraw: it measures once on the next frame and fires only when the fitted size moved.
|
|
482
|
+
* @returns {this}
|
|
483
|
+
* @fires Pagination#change
|
|
484
|
+
*/
|
|
485
|
+
refit(): this;
|
|
221
486
|
/**
|
|
222
487
|
* Returns the current slice description.
|
|
223
488
|
* @returns {PaginationState}
|
|
224
489
|
*/
|
|
225
490
|
getState(): PaginationState;
|
|
226
491
|
/**
|
|
227
|
-
* Enables every control.
|
|
492
|
+
* Enables every control, and lets auto-load continue.
|
|
228
493
|
* @returns {this}
|
|
229
494
|
*/
|
|
230
495
|
enable(): this;
|
|
231
496
|
/**
|
|
232
|
-
* Disables every control, for instance while a page is in flight.
|
|
497
|
+
* Disables every control, for instance while a page is in flight. Auto-load waits too.
|
|
233
498
|
* @returns {this}
|
|
234
499
|
*/
|
|
235
500
|
disable(): this;
|
|
@@ -240,8 +505,30 @@ export declare class Pagination extends Component<PaginationOptions> {
|
|
|
240
505
|
destroy(): void;
|
|
241
506
|
/** @returns {number} Page count; an empty list is one empty page. */
|
|
242
507
|
_pageCount(): number;
|
|
508
|
+
/** @returns {boolean} Whether pages append — Load more, or auto-load — rather than replace. */
|
|
509
|
+
_continuous(): boolean;
|
|
510
|
+
/**
|
|
511
|
+
* The one place state changes: applies, clamps, redraws, and reports.
|
|
512
|
+
* @param {{page?: number, pageSize?: number|'auto', total?: number}} state Values to change.
|
|
513
|
+
* @param {PaginationReason} reason Why, for the event.
|
|
514
|
+
* @param {boolean} [silent=false] Suppresses the event.
|
|
515
|
+
* @returns {this}
|
|
516
|
+
*/
|
|
517
|
+
_apply(state: {
|
|
518
|
+
page?: number;
|
|
519
|
+
pageSize?: number | 'auto';
|
|
520
|
+
total?: number;
|
|
521
|
+
}, reason: PaginationReason, silent?: boolean): this;
|
|
522
|
+
/**
|
|
523
|
+
* @param {PaginationReason} reason
|
|
524
|
+
* @param {boolean} append
|
|
525
|
+
* @returns {void}
|
|
526
|
+
*/
|
|
527
|
+
_emitChange(reason: PaginationReason, append: boolean): void;
|
|
243
528
|
/** @returns {HTMLElement} The page-size select and its visible label. */
|
|
244
529
|
_renderPageSize(): HTMLElement;
|
|
530
|
+
/** @returns {HTMLElement} The Auto-load switch. */
|
|
531
|
+
_renderAutoLoad(): HTMLElement;
|
|
245
532
|
/** @returns {HTMLElement} Previous / page buttons / next. */
|
|
246
533
|
_renderPages(): HTMLElement;
|
|
247
534
|
/**
|
|
@@ -251,7 +538,7 @@ export declare class Pagination extends Component<PaginationOptions> {
|
|
|
251
538
|
* @returns {HTMLElement}
|
|
252
539
|
*/
|
|
253
540
|
_navButton(ref: string, glyph: string, label: string): HTMLElement;
|
|
254
|
-
/** @returns {HTMLElement} The append-style trigger. */
|
|
541
|
+
/** @returns {HTMLElement} The append-style trigger; under auto-load, the keyboard's way on. */
|
|
255
542
|
_renderLoadMore(): HTMLElement;
|
|
256
543
|
/** Attaches the delegated listeners once, after the shell exists. @returns {void} */
|
|
257
544
|
_wire(): void;
|
|
@@ -270,6 +557,41 @@ export declare class Pagination extends Component<PaginationOptions> {
|
|
|
270
557
|
* @returns {void}
|
|
271
558
|
*/
|
|
272
559
|
_syncPages(pages: number): void;
|
|
560
|
+
/** @returns {Element|null} The viewport option, resolved now. */
|
|
561
|
+
_viewport(): Element | null;
|
|
562
|
+
/**
|
|
563
|
+
* Observes the current viewport and what it holds, letting go of previous ones. The viewport's
|
|
564
|
+
* size is the space; its content's size changes when the rows themselves do — a table stacking
|
|
565
|
+
* into cards on a narrow screen, a new row height, a font arriving.
|
|
566
|
+
* @returns {void}
|
|
567
|
+
*/
|
|
568
|
+
_observe(): void;
|
|
569
|
+
/**
|
|
570
|
+
* Runs a fit or an auto-load check on the next frame, once however often it is asked for — a
|
|
571
|
+
* resize or a scroll asks many times a frame, and measuring inside a ResizeObserver callback
|
|
572
|
+
* that changes the rows would loop.
|
|
573
|
+
* @param {'fit'|'load'} kind
|
|
574
|
+
* @returns {void}
|
|
575
|
+
*/
|
|
576
|
+
_schedule(kind: 'fit' | 'load'): void;
|
|
577
|
+
/**
|
|
578
|
+
* Measures the viewport and, when the fitted size moved, keeps the page's first row on the new
|
|
579
|
+
* page. Appending pagers fit only their first batch: later batches keep its size, so the rows
|
|
580
|
+
* loaded so far always number `page × pageSize`.
|
|
581
|
+
* @returns {void}
|
|
582
|
+
*/
|
|
583
|
+
_fit(): void;
|
|
584
|
+
/** @returns {string} The viewport's width and height now, as one key; '' when there is none. */
|
|
585
|
+
_viewportSize(): string;
|
|
586
|
+
/**
|
|
587
|
+
* How many items fit the viewport now, or 0 when it cannot be measured (absent, hidden).
|
|
588
|
+
* @returns {number}
|
|
589
|
+
*/
|
|
590
|
+
_measure(): number;
|
|
591
|
+
/** Loads the next page when auto-load is on, idle, and the end of the list is near. @returns {void} */
|
|
592
|
+
_checkAutoLoad(): void;
|
|
593
|
+
/** @returns {boolean} Whether the end of the list is within the auto-load margin. */
|
|
594
|
+
_nearEnd(): boolean;
|
|
273
595
|
/**
|
|
274
596
|
* Resolves a message through the host translator, falling back to the built-in English text.
|
|
275
597
|
* @param {string} key Message key.
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { Component } from '../../core/component.js';
|
|
2
|
+
import { AgentAvatar } from '../agent-avatar/agent-avatar.js';
|
|
2
3
|
export type RunState = import('../../internal/agent-model.js').RunState;
|
|
4
|
+
export type AgentFace = import('../../internal/agent-model.js').AgentFace;
|
|
3
5
|
export type RunStatusAction = {
|
|
4
6
|
/**
|
|
5
7
|
* Visible label.
|
|
@@ -112,6 +114,16 @@ export type RunStatusOptions = {
|
|
|
112
114
|
* The model the agent runs on.
|
|
113
115
|
*/
|
|
114
116
|
model?: string | null;
|
|
117
|
+
/**
|
|
118
|
+
* The agent whose run this is, drawn as its AgentAvatar
|
|
119
|
+
* face before the state: its traits and name, or `true` to derive the face from the summary. The
|
|
120
|
+
* face is keyed by the agent's `seed`, else its `name`; without either it is named after the
|
|
121
|
+
* summary it is first drawn with, and it keeps its face while `agent` asks for the same traits,
|
|
122
|
+
* so a summary that changes as the run goes on never changes it. The face takes the run's
|
|
123
|
+
* expression — working while it runs, looking up at you while it waits, blocked when blocked or
|
|
124
|
+
* failed, at rest otherwise. It is decorative, and the compact pill leaves it out.
|
|
125
|
+
*/
|
|
126
|
+
agent?: AgentFace | true | null;
|
|
115
127
|
/**
|
|
116
128
|
* Buttons under the summary.
|
|
117
129
|
*/
|
|
@@ -163,6 +175,7 @@ export type RunStatusState = {
|
|
|
163
175
|
tokenBudget: number | null;
|
|
164
176
|
cost: RunCost | null;
|
|
165
177
|
model: string | null;
|
|
178
|
+
agent: AgentFace | true | null;
|
|
166
179
|
actions: RunStatusAction[];
|
|
167
180
|
};
|
|
168
181
|
/**
|
|
@@ -188,6 +201,9 @@ export declare class RunStatus extends Component<RunStatusOptions> {
|
|
|
188
201
|
/** @type {HTMLElement|null} The action row as drawn, kept across updates that leave it unchanged. */
|
|
189
202
|
_actionsEl: HTMLElement | null;
|
|
190
203
|
_actionsKey: string;
|
|
204
|
+
/** @type {AgentAvatar|null} The agent's face, kept across draws while it asks for the same traits. */
|
|
205
|
+
_avatar: AgentAvatar | null;
|
|
206
|
+
_faceKey: any;
|
|
191
207
|
/** Whether the root took `tabindex="-1"` to hold focus that had nowhere else to go. */
|
|
192
208
|
_heldFocus: boolean;
|
|
193
209
|
/** @type {ReturnType<typeof setInterval>|0} */
|
|
@@ -248,6 +264,16 @@ export declare class RunStatus extends Component<RunStatusOptions> {
|
|
|
248
264
|
private _restoreFocus;
|
|
249
265
|
/** @private Gives back the `tabindex` the root took to hold focus. @returns {void} */
|
|
250
266
|
private _releaseFocus;
|
|
267
|
+
/**
|
|
268
|
+
* The agent's face with the run's expression: the one drawn before, while the traits it asks for
|
|
269
|
+
* stay the same, so a redraw never re-creates it. The summary is not part of what it asks for:
|
|
270
|
+
* it names a face that has no seed or name when the face is built, and never changes it after.
|
|
271
|
+
* @private
|
|
272
|
+
* @param {RunState} state
|
|
273
|
+
* @param {string} summary What names the face when the agent option gives no seed or name.
|
|
274
|
+
* @returns {Element|null}
|
|
275
|
+
*/
|
|
276
|
+
private _face;
|
|
251
277
|
/** @private @param {RunState} state @returns {Node[]} The state's glyph and its word. */
|
|
252
278
|
private _stateParts;
|
|
253
279
|
/** @private @param {{done: number, total: number, percent: number}} steps @returns {HTMLElement} */
|