@zeyos/zx 5.5.0 → 5.7.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 +210 -0
- package/README.md +73 -7
- package/bin/zx-css.js +328 -0
- package/dist/types/components/account-menu/account-menu.d.ts +4 -2
- package/dist/types/components/activity-list/activity-list.d.ts +14 -8
- package/dist/types/components/agent-thread/ag-ui.d.ts +340 -0
- package/dist/types/components/agent-thread/agent-thread.d.ts +711 -0
- package/dist/types/components/agent-thread/ui-message-stream.d.ts +401 -0
- package/dist/types/components/app-sidebar/app-sidebar.d.ts +14 -8
- package/dist/types/components/approval-card/approval-card.d.ts +596 -0
- package/dist/types/components/avatar/avatar.d.ts +91 -4
- package/dist/types/components/block-view/block-view.d.ts +205 -0
- package/dist/types/components/breadcrumb/breadcrumb.d.ts +3 -3
- package/dist/types/components/calendar/calendar-model.d.ts +9 -2
- package/dist/types/components/calendar/calendar.d.ts +12 -4
- package/dist/types/components/chart/chart.d.ts +25 -13
- package/dist/types/components/code-editor/code-editor.d.ts +7 -2
- package/dist/types/components/composer/composer.d.ts +938 -0
- package/dist/types/components/composer/queue.d.ts +76 -0
- package/dist/types/components/copy/copy-button.d.ts +6 -4
- package/dist/types/components/copy/copy-input.d.ts +10 -6
- package/dist/types/components/datebox/date-range-box.d.ts +33 -0
- package/dist/types/components/datebox/placeholder.d.ts +7 -0
- package/dist/types/components/dock/dock.d.ts +12 -3
- package/dist/types/components/entity-ref/entity-ref.d.ts +5 -3
- package/dist/types/components/field-upload/field-upload.d.ts +3 -2
- package/dist/types/components/file-item/file-item.d.ts +3 -2
- package/dist/types/components/file-list/file-list.d.ts +14 -8
- package/dist/types/components/filter/filter-model.d.ts +31 -1
- package/dist/types/components/filter/filter.d.ts +20 -2
- package/dist/types/components/finder/finder.d.ts +14 -6
- package/dist/types/components/flag/flag.d.ts +99 -0
- package/dist/types/components/grid/grid.d.ts +1 -1
- package/dist/types/components/kanban-view/kanban-view.d.ts +8 -66
- package/dist/types/components/launcher/launcher.d.ts +2 -0
- package/dist/types/components/multi-value-editor/multi-value-editor.d.ts +3 -2
- package/dist/types/components/number-field/number-field.d.ts +17 -6
- package/dist/types/components/prompt-starters/prompt-starters.d.ts +107 -0
- package/dist/types/components/prose/prose.d.ts +9 -6
- package/dist/types/components/questionnaire/conditions.d.ts +270 -0
- package/dist/types/components/questionnaire/items.d.ts +52 -30
- package/dist/types/components/questionnaire/questionnaire.d.ts +44 -4
- package/dist/types/components/rating/rating.d.ts +5 -3
- package/dist/types/components/run-status/run-status.d.ts +393 -0
- package/dist/types/components/run-trace/run-trace.d.ts +624 -0
- package/dist/types/components/select/country.d.ts +106 -0
- package/dist/types/components/select/field-adapter.d.ts +2 -1
- package/dist/types/components/select/locale.d.ts +102 -0
- package/dist/types/components/select/select.d.ts +41 -2
- package/dist/types/components/slider/slider.d.ts +1 -0
- package/dist/types/components/sort-control/sort-control.d.ts +7 -3
- package/dist/types/components/source-list/source-list.d.ts +179 -0
- package/dist/types/components/split-view/split-view.d.ts +5 -3
- package/dist/types/components/surface/catalog.d.ts +260 -0
- package/dist/types/components/surface/elicit.d.ts +81 -0
- package/dist/types/components/surface/mcp.d.ts +165 -0
- package/dist/types/components/surface/schema.d.ts +314 -0
- package/dist/types/components/surface/stream.d.ts +118 -0
- package/dist/types/components/surface/surface.d.ts +718 -0
- package/dist/types/components/surface/text.d.ts +277 -0
- package/dist/types/components/surface/validate.d.ts +339 -0
- package/dist/types/components/table/table.d.ts +55 -3
- package/dist/types/components/table/window.d.ts +203 -0
- package/dist/types/components/toolbar/toolbar.d.ts +10 -6
- package/dist/types/components/tooltip/tooltip.d.ts +2 -2
- package/dist/types/components/tree/tree.d.ts +20 -13
- package/dist/types/core/component.d.ts +10 -0
- package/dist/types/core/date.d.ts +8 -1
- package/dist/types/core/dom.d.ts +1 -0
- package/dist/types/core/http.d.ts +10 -0
- package/dist/types/core/i18n.d.ts +38 -0
- package/dist/types/core/messages.d.ts +479 -1
- package/dist/types/core/storage.d.ts +7 -2
- package/dist/types/elements/define.d.ts +21 -46
- package/dist/types/elements/definitions.d.ts +147 -0
- package/dist/types/elements/kit.d.ts +7 -0
- package/dist/types/elements/reflect.d.ts +6 -3
- package/dist/types/index.d.ts +18 -1
- package/dist/types/internal/agent-model.d.ts +587 -0
- package/dist/types/internal/date-locale.d.ts +7 -0
- package/dist/types/internal/highlight.d.ts +24 -0
- package/dist/types/internal/json-patch.d.ts +146 -0
- package/dist/types/internal/presence-loop.d.ts +148 -0
- package/dist/types/locales/de.d.ts +13 -0
- package/dist/types/locales/en.d.ts +2 -0
- package/dist/types/locales/index.d.ts +823 -0
- package/dist/types/zeyos/view.d.ts +8 -1
- package/dist/zx-zeyos.esm.js +20505 -18748
- package/dist/zx-zeyos.esm.min.js +5 -5
- package/dist/zx.core.css +1276 -0
- package/dist/zx.core.min.css +1 -0
- package/dist/zx.css +2424 -134
- package/dist/zx.esm.js +46167 -28468
- package/dist/zx.esm.min.js +40 -8
- package/dist/zx.global.js +46167 -28468
- package/dist/zx.global.min.js +40 -8
- package/dist/zx.layered.css +17302 -0
- package/dist/zx.layered.min.css +1 -0
- package/dist/zx.min.css +1 -1
- package/docs/agent-catalog.json +12501 -0
- package/docs/agent-surfaces.md +340 -0
- package/docs/api.json +2057 -166
- package/docs/llms.md +1458 -58
- package/docs/llms.txt +38 -8
- package/package.json +29 -6
- package/src/components/account-menu/account-menu.js +6 -3
- package/src/components/activity-item/activity-item.js +2 -1
- package/src/components/activity-list/activity-list.js +16 -10
- package/src/components/agent-thread/ag-ui.js +1439 -0
- package/src/components/agent-thread/agent-thread.css +417 -0
- package/src/components/agent-thread/agent-thread.js +1670 -0
- package/src/components/agent-thread/ui-message-stream.js +1281 -0
- package/src/components/app-sidebar/app-sidebar.js +18 -8
- package/src/components/approval-card/approval-card.css +289 -0
- package/src/components/approval-card/approval-card.js +1378 -0
- package/src/components/avatar/avatar.css +56 -1
- package/src/components/avatar/avatar.js +148 -26
- package/src/components/block-view/block-view.css +300 -0
- package/src/components/block-view/block-view.js +524 -0
- package/src/components/breadcrumb/breadcrumb.js +8 -5
- package/src/components/calendar/calendar-model.js +8 -2
- package/src/components/calendar/calendar.js +53 -18
- package/src/components/chart/chart.js +54 -23
- package/src/components/code-editor/code-editor.js +45 -8
- package/src/components/code-editor/field-adapter.js +1 -1
- package/src/components/composer/composer.css +482 -0
- package/src/components/composer/composer.js +1815 -0
- package/src/components/composer/queue.js +78 -0
- package/src/components/context-menu/context-menu.js +12 -1
- package/src/components/copy/copy-button.js +9 -7
- package/src/components/copy/copy-input.js +10 -6
- package/src/components/date-picker/date-picker.js +2 -1
- package/src/components/date-picker/date-range-picker.js +8 -7
- package/src/components/datebox/date-range-box.js +3 -9
- package/src/components/datebox/datebox.js +18 -21
- package/src/components/datebox/placeholder.js +18 -0
- package/src/components/dialog/dialog.js +1 -1
- package/src/components/dock/dock.js +34 -13
- package/src/components/entity-ref/entity-ref.js +16 -5
- package/src/components/field-upload/field-upload.js +81 -38
- package/src/components/file-item/file-item.js +70 -40
- package/src/components/file-list/file-list.js +15 -9
- package/src/components/filter/filter-model.js +46 -8
- package/src/components/filter/filter.css +3 -3
- package/src/components/filter/filter.js +29 -10
- package/src/components/filter-panel/filter-panel.js +13 -5
- package/src/components/finder/finder.js +50 -26
- package/src/components/flag/flag.css +40 -0
- package/src/components/flag/flag.js +177 -0
- package/src/components/form/form.js +1 -1
- package/src/components/grid/grid.js +22 -8
- package/src/components/kanban-view/kanban-view.js +51 -81
- package/src/components/launcher/launcher.js +17 -2
- package/src/components/list-toolbar/list-toolbar.js +2 -1
- package/src/components/master-panel/master-panel.js +1 -1
- package/src/components/menu-button/menu-button.js +4 -0
- package/src/components/message/message.js +3 -0
- package/src/components/multi-value-editor/multi-value-editor.js +10 -9
- package/src/components/navigation-bar/navigation-bar.js +3 -3
- package/src/components/number-field/number-field.js +29 -13
- package/src/components/prompt-starters/prompt-starters.css +91 -0
- package/src/components/prompt-starters/prompt-starters.js +206 -0
- package/src/components/prose/prose.js +14 -10
- package/src/components/questionnaire/conditions.js +666 -0
- package/src/components/questionnaire/items.js +150 -41
- package/src/components/questionnaire/questionnaire.js +126 -32
- package/src/components/rating/rating.js +5 -4
- package/src/components/run-status/run-status.css +208 -0
- package/src/components/run-status/run-status.js +782 -0
- package/src/components/run-trace/run-trace.css +443 -0
- package/src/components/run-trace/run-trace.js +1209 -0
- package/src/components/select/country.js +136 -0
- package/src/components/select/field-adapter.js +7 -2
- package/src/components/select/locale.js +219 -0
- package/src/components/select/select.css +20 -22
- package/src/components/select/select.js +94 -12
- package/src/components/sheet/sheet-stack.js +10 -1
- package/src/components/slider/slider.js +7 -2
- package/src/components/sort-control/sort-control.js +15 -5
- package/src/components/source-list/source-list.css +208 -0
- package/src/components/source-list/source-list.js +358 -0
- package/src/components/split-view/split-view.js +5 -3
- package/src/components/surface/catalog.js +1334 -0
- package/src/components/surface/elicit.js +107 -0
- package/src/components/surface/mcp.js +243 -0
- package/src/components/surface/schema.js +644 -0
- package/src/components/surface/stream.js +245 -0
- package/src/components/surface/surface.css +308 -0
- package/src/components/surface/surface.js +2291 -0
- package/src/components/surface/text.js +513 -0
- package/src/components/surface/validate.js +2218 -0
- package/src/components/tabbox/tabbox.js +9 -0
- package/src/components/table/table.css +63 -3
- package/src/components/table/table.js +167 -28
- package/src/components/table/window.js +317 -0
- package/src/components/toolbar/toolbar.js +12 -7
- package/src/components/tooltip/tooltip.css +2 -3
- package/src/components/tooltip/tooltip.js +32 -5
- package/src/components/tree/tree.js +53 -23
- package/src/core/component.js +25 -1
- package/src/core/date.js +62 -16
- package/src/core/dom.js +22 -2
- package/src/core/format.js +15 -13
- package/src/core/http.js +29 -20
- package/src/core/i18n.js +83 -10
- package/src/core/keyboard.js +79 -8
- package/src/core/messages.js +519 -2
- package/src/core/overlay-host.js +1 -0
- package/src/core/storage.js +59 -6
- package/src/elements/define.js +178 -130
- package/src/elements/definitions.js +229 -0
- package/src/elements/kit.js +444 -0
- package/src/elements/reflect.js +8 -3
- package/src/index.js +18 -1
- package/src/internal/agent-model.js +488 -0
- package/src/internal/date-locale.js +11 -0
- package/src/internal/highlight.js +104 -0
- package/src/internal/json-patch.js +405 -0
- package/src/internal/presence-loop.js +343 -0
- package/src/locales/de.js +911 -0
- package/src/locales/en.js +2 -0
- package/src/locales/index.js +7 -0
- package/src/zeyos/calendar.js +2 -1
- package/src/zeyos/form.js +2 -1
- package/src/zeyos/launcher.js +7 -6
- package/src/zeyos/module-bar.js +2 -1
- package/src/zeyos/schema.js +37 -23
- package/src/zeyos/select.js +4 -3
- package/src/zeyos/table.js +2 -13
- package/src/zeyos/view.js +57 -17
- package/styles/core.css +11 -0
- package/styles/tokens/semantic.css +1 -0
- package/styles/zeyos.css +2 -0
- package/styles/zx.css +11 -8
- package/styles/zx.layered.css +1 -0
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* JSON Pointer (RFC 6901) and JSON Patch (RFC 6902) over plain JSON values.
|
|
3
|
+
*
|
|
4
|
+
* Every function here is pure: a document handed in is never mutated, and a function that changes
|
|
5
|
+
* something returns a new document. Pointers may not walk through `__proto__`, `constructor` or
|
|
6
|
+
* `prototype`, so a pointer written by a model or a server can never reach an object's prototype.
|
|
7
|
+
*
|
|
8
|
+
* The module touches no DOM and imports nothing, so it runs unchanged in a browser and on a server.
|
|
9
|
+
*/
|
|
10
|
+
export type JsonPatchErrorCode = 'invalid-pointer' | 'forbidden-segment' | 'not-a-container' | 'path-not-found' | 'invalid-index' | 'invalid-operation' | 'test-failed';
|
|
11
|
+
export type JsonPatchOperation = {
|
|
12
|
+
/**
|
|
13
|
+
* Operation name.
|
|
14
|
+
*/
|
|
15
|
+
op: 'add' | 'remove' | 'replace' | 'move' | 'copy' | 'test';
|
|
16
|
+
/**
|
|
17
|
+
* RFC 6901 pointer to the target.
|
|
18
|
+
*/
|
|
19
|
+
path: string;
|
|
20
|
+
/**
|
|
21
|
+
* Value to add, replace with, or test against.
|
|
22
|
+
*/
|
|
23
|
+
value?: unknown;
|
|
24
|
+
/**
|
|
25
|
+
* RFC 6901 pointer to the source of a `move` or `copy`.
|
|
26
|
+
*/
|
|
27
|
+
from?: string;
|
|
28
|
+
};
|
|
29
|
+
/**
|
|
30
|
+
* Why a pointer or a patch operation could not be applied.
|
|
31
|
+
* - `invalid-pointer`: the pointer is not a string, or is not empty and does not start with `/`,
|
|
32
|
+
* or carries a `~` that is not `~0` or `~1`.
|
|
33
|
+
* - `forbidden-segment`: a segment is `__proto__`, `constructor` or `prototype`.
|
|
34
|
+
* - `not-a-container`: the path runs through a value that is neither an object nor an array.
|
|
35
|
+
* - `path-not-found`: the target, or its parent, does not exist.
|
|
36
|
+
* - `invalid-index`: an array segment is not an index, is out of range, or is `-` where nothing
|
|
37
|
+
* is appended.
|
|
38
|
+
* - `invalid-operation`: an operation is malformed or unknown, or moves a value into itself.
|
|
39
|
+
* - `test-failed`: a `test` operation's value differs from the document's.
|
|
40
|
+
* @typedef {'invalid-pointer'|'forbidden-segment'|'not-a-container'|'path-not-found'|'invalid-index'|'invalid-operation'|'test-failed'} JsonPatchErrorCode
|
|
41
|
+
*/
|
|
42
|
+
/**
|
|
43
|
+
* One RFC 6902 operation. `value` is required by `add`, `replace` and `test`, `from` by `move`
|
|
44
|
+
* and `copy`. Other members are ignored, as the RFC asks.
|
|
45
|
+
* @typedef {Object} JsonPatchOperation
|
|
46
|
+
* @property {'add'|'remove'|'replace'|'move'|'copy'|'test'} op Operation name.
|
|
47
|
+
* @property {string} path RFC 6901 pointer to the target.
|
|
48
|
+
* @property {unknown} [value] Value to add, replace with, or test against.
|
|
49
|
+
* @property {string} [from] RFC 6901 pointer to the source of a `move` or `copy`.
|
|
50
|
+
*/
|
|
51
|
+
/**
|
|
52
|
+
* The error every function in this module throws. `code` says what went wrong, `pointer` where,
|
|
53
|
+
* and `index` which operation of a patch failed (`-1` outside a patch).
|
|
54
|
+
*/
|
|
55
|
+
export declare class JsonPatchError extends Error {
|
|
56
|
+
/** @type {JsonPatchErrorCode} */
|
|
57
|
+
code: JsonPatchErrorCode;
|
|
58
|
+
/** @type {string} */
|
|
59
|
+
pointer: string;
|
|
60
|
+
/** @type {number} */
|
|
61
|
+
index: number;
|
|
62
|
+
/**
|
|
63
|
+
* @param {string} message Human-readable description.
|
|
64
|
+
* @param {JsonPatchErrorCode} code What went wrong.
|
|
65
|
+
* @param {string} [pointer=''] The pointer involved.
|
|
66
|
+
* @param {number} [index=-1] Position of the failing operation within a patch.
|
|
67
|
+
*/
|
|
68
|
+
constructor(message: string, code: JsonPatchErrorCode, pointer?: string, index?: number);
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* Splits an RFC 6901 pointer into its unescaped segments. `''` is the whole document and yields no
|
|
72
|
+
* segments; `'/'` yields one empty segment. `~1` becomes `/` and then `~0` becomes `~`, in that
|
|
73
|
+
* order, so `~01` reads as the two characters `~1`.
|
|
74
|
+
* @param {string} pointer RFC 6901 pointer.
|
|
75
|
+
* @returns {string[]}
|
|
76
|
+
* @throws {JsonPatchError} `invalid-pointer` when malformed, `forbidden-segment` for `__proto__`,
|
|
77
|
+
* `constructor` or `prototype`.
|
|
78
|
+
*/
|
|
79
|
+
export declare function parsePointer(pointer: string): string[];
|
|
80
|
+
/**
|
|
81
|
+
* Joins segments into an RFC 6901 pointer, escaping `~` as `~0` and `/` as `~1`. The inverse of
|
|
82
|
+
* `parsePointer()`.
|
|
83
|
+
* @param {Array<string|number>} segments Unescaped segments.
|
|
84
|
+
* @returns {string}
|
|
85
|
+
*/
|
|
86
|
+
export declare function formatPointer(segments: Array<string | number>): string;
|
|
87
|
+
/**
|
|
88
|
+
* Reads the value a pointer names. A path that does not exist, runs through a value that is not a
|
|
89
|
+
* container, or ends in `-` reads as `undefined` rather than throwing, so a binding to data that
|
|
90
|
+
* has not arrived yet is simply empty.
|
|
91
|
+
* @param {unknown} document JSON value to read from.
|
|
92
|
+
* @param {string} pointer RFC 6901 pointer.
|
|
93
|
+
* @returns {unknown} The value, or `undefined` when there is none.
|
|
94
|
+
* @throws {JsonPatchError} When the pointer itself is malformed or names a forbidden segment.
|
|
95
|
+
*/
|
|
96
|
+
export declare function getPointer(document: unknown, pointer: string): unknown;
|
|
97
|
+
/**
|
|
98
|
+
* Reports whether a pointer names an existing value, which `getPointer()` cannot tell from a
|
|
99
|
+
* missing one when the value read is `undefined`.
|
|
100
|
+
* @param {unknown} document JSON value to read from.
|
|
101
|
+
* @param {string} pointer RFC 6901 pointer.
|
|
102
|
+
* @returns {boolean}
|
|
103
|
+
* @throws {JsonPatchError} When the pointer itself is malformed or names a forbidden segment.
|
|
104
|
+
*/
|
|
105
|
+
export declare function hasPointer(document: unknown, pointer: string): boolean;
|
|
106
|
+
/**
|
|
107
|
+
* Stores a value at a pointer and returns the new document: the simple "set" a data stream needs.
|
|
108
|
+
* An object member is created or replaced; an array element at an existing index is replaced, and
|
|
109
|
+
* one at the array's length or at `-` is appended. The empty pointer replaces the whole document.
|
|
110
|
+
* Every parent on the path must already exist. The value is copied in, never shared.
|
|
111
|
+
* @param {unknown} document JSON value to change. Not mutated.
|
|
112
|
+
* @param {string} pointer RFC 6901 pointer.
|
|
113
|
+
* @param {unknown} value JSON value to store.
|
|
114
|
+
* @returns {unknown} The new document.
|
|
115
|
+
* @throws {JsonPatchError} `not-a-container` when the path runs through a value that is not an
|
|
116
|
+
* object or array, `path-not-found` when a parent is missing, `invalid-index` for a bad array
|
|
117
|
+
* segment, or a pointer error.
|
|
118
|
+
*/
|
|
119
|
+
export declare function setPointer(document: unknown, pointer: string, value: unknown): unknown;
|
|
120
|
+
/**
|
|
121
|
+
* Removes the value at a pointer and returns the new document. An array element is spliced out,
|
|
122
|
+
* so the elements after it move up.
|
|
123
|
+
* @param {unknown} document JSON value to change. Not mutated.
|
|
124
|
+
* @param {string} pointer RFC 6901 pointer to an existing value; not the empty pointer.
|
|
125
|
+
* @returns {unknown} The new document.
|
|
126
|
+
* @throws {JsonPatchError} `path-not-found` when nothing is there, `not-a-container` when the path
|
|
127
|
+
* runs through a value that is not an object or array, `invalid-operation` for the empty
|
|
128
|
+
* pointer, or a pointer error.
|
|
129
|
+
*/
|
|
130
|
+
export declare function removePointer(document: unknown, pointer: string): unknown;
|
|
131
|
+
/**
|
|
132
|
+
* Applies an RFC 6902 patch and returns the new document. The input is never mutated, and the
|
|
133
|
+
* patch applies all or nothing: when any operation fails — a failing `test` included — the error
|
|
134
|
+
* is thrown and no partial result exists.
|
|
135
|
+
* @param {unknown} document JSON value to patch. Not mutated.
|
|
136
|
+
* @param {JsonPatchOperation[]} operations Operations, applied in order.
|
|
137
|
+
* @returns {unknown} The patched document.
|
|
138
|
+
* @throws {JsonPatchError} At the first failing operation; its `index` says which.
|
|
139
|
+
*/
|
|
140
|
+
export declare function applyPatch(document: unknown, operations: JsonPatchOperation[]): unknown;
|
|
141
|
+
/**
|
|
142
|
+
* JSON equality as RFC 6902 `test` defines it: same type, numbers by value, strings by code
|
|
143
|
+
* points, arrays element by element in order, objects by the same members regardless of order.
|
|
144
|
+
* @param {unknown} a @param {unknown} b @returns {boolean}
|
|
145
|
+
*/
|
|
146
|
+
export declare function jsonEqual(a: unknown, b: unknown): boolean;
|
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
export type AgentActivity = import('./agent-model.js').AgentActivity;
|
|
2
|
+
export type PresencePose = {
|
|
3
|
+
y: number;
|
|
4
|
+
r: number;
|
|
5
|
+
s: number;
|
|
6
|
+
w: number;
|
|
7
|
+
blink: number;
|
|
8
|
+
};
|
|
9
|
+
export type PresenceHandle = {
|
|
10
|
+
/**
|
|
11
|
+
* Changes
|
|
12
|
+
* what the avatar is doing, and its phase when `options.phase` is given; the loop eases it into
|
|
13
|
+
* the new pose.
|
|
14
|
+
*/
|
|
15
|
+
set: (activity: AgentActivity | string | null, options?: TrackOptions) => void;
|
|
16
|
+
/**
|
|
17
|
+
* Leaves the loop and puts the avatar back at rest. Safe to call
|
|
18
|
+
* more than once.
|
|
19
|
+
*/
|
|
20
|
+
untrack: () => void;
|
|
21
|
+
};
|
|
22
|
+
export type TrackOptions = {
|
|
23
|
+
/**
|
|
24
|
+
* Where in its cycle this avatar moves, as a fraction of the cycle
|
|
25
|
+
* from 0 up to 1 (whole turns wrap; anything that is not a finite number is 0). Avatars in the same
|
|
26
|
+
* activity at different phases never move in step: 0.5 is half a cycle apart, whatever the
|
|
27
|
+
* activity. `presencePhase(key)` derives one from a stable key.
|
|
28
|
+
*/
|
|
29
|
+
phase?: number;
|
|
30
|
+
};
|
|
31
|
+
/** @typedef {import('./agent-model.js').AgentActivity} AgentActivity */
|
|
32
|
+
/**
|
|
33
|
+
* Where an avatar wants to be at one moment: a vertical offset in pixels, a rotation in degrees, a
|
|
34
|
+
* scale, how much a blink may squash it (`w`, eased like the rest), and the blink's depth now.
|
|
35
|
+
* @typedef {{y: number, r: number, s: number, w: number, blink: number}} PresencePose
|
|
36
|
+
*/
|
|
37
|
+
/**
|
|
38
|
+
* @typedef {Object} PresenceHandle
|
|
39
|
+
* @property {(activity: AgentActivity|string|null, options?: TrackOptions) => void} set Changes
|
|
40
|
+
* what the avatar is doing, and its phase when `options.phase` is given; the loop eases it into
|
|
41
|
+
* the new pose.
|
|
42
|
+
* @property {() => void} untrack Leaves the loop and puts the avatar back at rest. Safe to call
|
|
43
|
+
* more than once.
|
|
44
|
+
*/
|
|
45
|
+
/**
|
|
46
|
+
* @typedef {Object} TrackOptions
|
|
47
|
+
* @property {number} [phase=0] Where in its cycle this avatar moves, as a fraction of the cycle
|
|
48
|
+
* from 0 up to 1 (whole turns wrap; anything that is not a finite number is 0). Avatars in the same
|
|
49
|
+
* activity at different phases never move in step: 0.5 is half a cycle apart, whatever the
|
|
50
|
+
* activity. `presencePhase(key)` derives one from a stable key.
|
|
51
|
+
*/
|
|
52
|
+
/** The longest step one frame may take, so a frame after a stall eases instead of jumping. */
|
|
53
|
+
export declare const MAX_FRAME_MS = 50;
|
|
54
|
+
/**
|
|
55
|
+
* The pose of an avatar doing `activity` at time `t`. Pure: the same input always gives the same
|
|
56
|
+
* pose. Idle breathes, thinking sways, working bobs, and needs-you leans and blinks; blocked,
|
|
57
|
+
* offline, and anything unknown stay at rest.
|
|
58
|
+
* @param {AgentActivity|string|null|undefined} activity
|
|
59
|
+
* @param {number} t Seconds.
|
|
60
|
+
* @returns {PresencePose}
|
|
61
|
+
*/
|
|
62
|
+
export declare function presencePose(activity: AgentActivity | string | null | undefined, t: number): PresencePose;
|
|
63
|
+
/**
|
|
64
|
+
* A stable phase for a key, as a fraction of the cycle from 0 up to 1, so two avatars never move in
|
|
65
|
+
* step and the same avatar always moves the same way.
|
|
66
|
+
* @param {unknown} key
|
|
67
|
+
* @returns {number}
|
|
68
|
+
*/
|
|
69
|
+
export declare function presencePhase(key: unknown): number;
|
|
70
|
+
/**
|
|
71
|
+
* Reads a phase: a finite number wrapped into a fraction from 0 up to 1 (`1.25` is `0.25`, `-0.25`
|
|
72
|
+
* is `0.75`), or null for anything else.
|
|
73
|
+
* @param {unknown} phase
|
|
74
|
+
* @returns {number|null}
|
|
75
|
+
*/
|
|
76
|
+
export declare function normalizePhase(phase: unknown): number | null;
|
|
77
|
+
/**
|
|
78
|
+
* How long one cycle of an activity takes, in seconds; 0 for one that stays at rest.
|
|
79
|
+
* @param {AgentActivity|string|null|undefined} activity
|
|
80
|
+
* @returns {number}
|
|
81
|
+
*/
|
|
82
|
+
export declare function presencePeriod(activity: AgentActivity | string | null | undefined): number;
|
|
83
|
+
/**
|
|
84
|
+
* The seconds a phase moves an avatar along its activity's cycle.
|
|
85
|
+
* @param {AgentActivity|string|null|undefined} activity
|
|
86
|
+
* @param {unknown} phase A fraction of the cycle; see `normalizePhase()`.
|
|
87
|
+
* @returns {number}
|
|
88
|
+
*/
|
|
89
|
+
export declare function presenceOffset(activity: AgentActivity | string | null | undefined, phase: unknown): number;
|
|
90
|
+
export type Entry = {
|
|
91
|
+
activity: string | null;
|
|
92
|
+
/**
|
|
93
|
+
* A fraction of the cycle.
|
|
94
|
+
*/
|
|
95
|
+
phase: number;
|
|
96
|
+
pose: {
|
|
97
|
+
y: number;
|
|
98
|
+
r: number;
|
|
99
|
+
s: number;
|
|
100
|
+
w: number;
|
|
101
|
+
};
|
|
102
|
+
visible: boolean;
|
|
103
|
+
reduced: boolean;
|
|
104
|
+
/**
|
|
105
|
+
* Whether the loop has written a transform it has not cleared.
|
|
106
|
+
*/
|
|
107
|
+
moved: boolean;
|
|
108
|
+
unwatch: () => void;
|
|
109
|
+
};
|
|
110
|
+
export type Loop = {
|
|
111
|
+
document: Document;
|
|
112
|
+
entries: Map<HTMLElement, Entry>;
|
|
113
|
+
observer: IntersectionObserver;
|
|
114
|
+
abort: AbortController;
|
|
115
|
+
frame: number;
|
|
116
|
+
last: number;
|
|
117
|
+
time: number;
|
|
118
|
+
};
|
|
119
|
+
/**
|
|
120
|
+
* @typedef {Object} Entry
|
|
121
|
+
* @property {string|null} activity
|
|
122
|
+
* @property {number} phase A fraction of the cycle.
|
|
123
|
+
* @property {{y: number, r: number, s: number, w: number}} pose
|
|
124
|
+
* @property {boolean} visible
|
|
125
|
+
* @property {boolean} reduced
|
|
126
|
+
* @property {boolean} moved Whether the loop has written a transform it has not cleared.
|
|
127
|
+
* @property {() => void} unwatch
|
|
128
|
+
*/
|
|
129
|
+
/**
|
|
130
|
+
* @typedef {Object} Loop
|
|
131
|
+
* @property {Document} document
|
|
132
|
+
* @property {Map<HTMLElement, Entry>} entries
|
|
133
|
+
* @property {IntersectionObserver} observer
|
|
134
|
+
* @property {AbortController} abort
|
|
135
|
+
* @property {number} frame
|
|
136
|
+
* @property {number} last
|
|
137
|
+
* @property {number} time
|
|
138
|
+
*/
|
|
139
|
+
/**
|
|
140
|
+
* Adds an element to its document's presence loop. The element's `transform` belongs to the loop
|
|
141
|
+
* while it is tracked; `untrack()` clears it. Where `requestAnimationFrame` or
|
|
142
|
+
* `IntersectionObserver` is missing the handle does nothing.
|
|
143
|
+
* @param {HTMLElement} element What moves: the avatar's root.
|
|
144
|
+
* @param {AgentActivity|string|null} activity What the avatar is doing.
|
|
145
|
+
* @param {TrackOptions} [options={}]
|
|
146
|
+
* @returns {PresenceHandle}
|
|
147
|
+
*/
|
|
148
|
+
export declare function trackPresence(element: HTMLElement, activity: AgentActivity | string | null, options?: TrackOptions): PresenceHandle;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The German message catalogue: the keys of `defaultMessages`, in its order, with the same
|
|
3
|
+
* placeholders. Install it with `setTranslator((key) => de[key])` and `setLanguage('de')`.
|
|
4
|
+
*
|
|
5
|
+
* The voice is that of a business application. It addresses the reader formally and prefers forms
|
|
6
|
+
* that need no address at all ("Änderungen speichern"); buttons and menu items use the infinitive.
|
|
7
|
+
* Quotation marks are „…“, the ellipsis is one character attached to its word, and a number stays
|
|
8
|
+
* on the line of its unit through a non-breaking space. Established software terms (Agent, Board,
|
|
9
|
+
* Token, Tool) stay; `docs/llms.md` lists the glossary.
|
|
10
|
+
*
|
|
11
|
+
* @type {Readonly<Record<string, string>>}
|
|
12
|
+
*/
|
|
13
|
+
export declare const de: Readonly<Record<string, string>>;
|