@zeyos/zx 5.4.0 → 5.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (145) hide show
  1. package/CHANGELOG.md +136 -0
  2. package/README.md +23 -16
  3. package/dist/types/components/agent-thread/agent-thread.d.ts +583 -0
  4. package/dist/types/components/app-sidebar/app-sidebar.d.ts +33 -0
  5. package/dist/types/components/approval-card/approval-card.d.ts +596 -0
  6. package/dist/types/components/avatar/avatar.d.ts +91 -4
  7. package/dist/types/components/badge/badge.d.ts +5 -4
  8. package/dist/types/components/block-view/block-view.d.ts +205 -0
  9. package/dist/types/components/composer/composer.d.ts +736 -0
  10. package/dist/types/components/datebox/date-range-box.d.ts +15 -2
  11. package/dist/types/components/datebox/datebox.d.ts +37 -3
  12. package/dist/types/components/kbd/kbd.d.ts +41 -0
  13. package/dist/types/components/launcher/launcher.d.ts +4 -2
  14. package/dist/types/components/prose/prose.d.ts +69 -0
  15. package/dist/types/components/questionnaire/questionnaire.d.ts +0 -36
  16. package/dist/types/components/run-status/run-status.d.ts +393 -0
  17. package/dist/types/components/run-trace/run-trace.d.ts +624 -0
  18. package/dist/types/components/source-list/source-list.d.ts +177 -0
  19. package/dist/types/components/stat-tile/stat-tile.d.ts +20 -0
  20. package/dist/types/components/tag-picker/tag-picker.d.ts +11 -5
  21. package/dist/types/components/tree/tree.d.ts +44 -3
  22. package/dist/types/core/icons.d.ts +22 -1
  23. package/dist/types/core/messages.d.ts +135 -0
  24. package/dist/types/index.d.ts +12 -2
  25. package/dist/types/internal/agent-model.d.ts +587 -0
  26. package/dist/types/internal/app-rail.d.ts +10 -3
  27. package/dist/types/internal/highlight.d.ts +24 -0
  28. package/dist/types/internal/presence-loop.d.ts +148 -0
  29. package/dist/types/internal/row-actions.d.ts +151 -0
  30. package/dist/zx-zeyos.esm.js +4852 -4535
  31. package/dist/zx-zeyos.esm.min.js +4 -4
  32. package/dist/zx.css +3152 -434
  33. package/dist/zx.esm.js +13730 -6595
  34. package/dist/zx.esm.min.js +27 -8
  35. package/dist/zx.global.js +13730 -6595
  36. package/dist/zx.global.min.js +27 -8
  37. package/dist/zx.min.css +1 -1
  38. package/docs/api.json +1474 -205
  39. package/docs/llms.md +698 -39
  40. package/docs/llms.txt +12 -1
  41. package/package.json +1 -1
  42. package/src/components/account-menu/account-menu.js +2 -2
  43. package/src/components/agent-thread/agent-thread.css +417 -0
  44. package/src/components/agent-thread/agent-thread.js +1365 -0
  45. package/src/components/app-rail/app-rail.css +11 -11
  46. package/src/components/app-sidebar/app-sidebar.css +90 -17
  47. package/src/components/app-sidebar/app-sidebar.js +120 -12
  48. package/src/components/approval-card/approval-card.css +289 -0
  49. package/src/components/approval-card/approval-card.js +1377 -0
  50. package/src/components/avatar/avatar.css +56 -1
  51. package/src/components/avatar/avatar.js +148 -26
  52. package/src/components/badge/badge.css +33 -20
  53. package/src/components/badge/badge.js +5 -4
  54. package/src/components/block-view/block-view.css +300 -0
  55. package/src/components/block-view/block-view.js +523 -0
  56. package/src/components/breadcrumb/breadcrumb.css +28 -3
  57. package/src/components/breadcrumb/breadcrumb.js +2 -2
  58. package/src/components/button/button.css +24 -13
  59. package/src/components/button/button.js +20 -2
  60. package/src/components/calendar/calendar.css +14 -4
  61. package/src/components/card-view/card-view.js +2 -2
  62. package/src/components/chart/chart.js +20 -5
  63. package/src/components/check-button/check-button.css +11 -3
  64. package/src/components/check-button/check-button.js +3 -3
  65. package/src/components/composer/composer.css +403 -0
  66. package/src/components/composer/composer.js +1441 -0
  67. package/src/components/context-menu/context-menu.css +7 -1
  68. package/src/components/date-picker/date-picker.css +6 -0
  69. package/src/components/date-picker/date-picker.js +5 -5
  70. package/src/components/date-picker/date-range-picker.css +6 -0
  71. package/src/components/date-picker/date-range-picker.js +3 -3
  72. package/src/components/date-picker/month-picker.js +3 -3
  73. package/src/components/date-picker/time-picker.css +6 -0
  74. package/src/components/datebox/date-range-box.js +30 -6
  75. package/src/components/datebox/datebox.js +44 -7
  76. package/src/components/dialog/dialog.css +0 -1
  77. package/src/components/dialog/dialog.js +2 -1
  78. package/src/components/dock/dock.js +2 -2
  79. package/src/components/dropdown/dropdown.css +2 -1
  80. package/src/components/entity-ref/entity-ref.css +8 -1
  81. package/src/components/file-item/file-item.css +1 -1
  82. package/src/components/finder/finder.js +2 -2
  83. package/src/components/groupbox/groupbox.js +2 -2
  84. package/src/components/kanban-view/kanban-view.css +8 -4
  85. package/src/components/kanban-view/kanban-view.js +3 -3
  86. package/src/components/kbd/kbd.css +64 -0
  87. package/src/components/kbd/kbd.js +121 -0
  88. package/src/components/launcher/launcher.css +30 -25
  89. package/src/components/launcher/launcher.js +15 -21
  90. package/src/components/list-toolbar/list-toolbar.css +7 -1
  91. package/src/components/menu-button/menu-button.css +9 -2
  92. package/src/components/message/message.js +2 -2
  93. package/src/components/module-bar/module-bar.css +11 -1
  94. package/src/components/multi-value-editor/multi-value-editor.js +4 -4
  95. package/src/components/navigation-bar/navigation-bar.css +3 -2
  96. package/src/components/pagination/pagination.js +2 -2
  97. package/src/components/panel/panel.js +2 -2
  98. package/src/components/prose/prose.css +53 -0
  99. package/src/components/prose/prose.js +152 -0
  100. package/src/components/questionnaire/questionnaire.css +7 -17
  101. package/src/components/questionnaire/questionnaire.js +16 -1
  102. package/src/components/rating/rating.css +3 -1
  103. package/src/components/run-status/run-status.css +208 -0
  104. package/src/components/run-status/run-status.js +782 -0
  105. package/src/components/run-trace/run-trace.css +443 -0
  106. package/src/components/run-trace/run-trace.js +1209 -0
  107. package/src/components/search/search.js +2 -2
  108. package/src/components/select/glyphs.js +3 -3
  109. package/src/components/select/select.css +35 -7
  110. package/src/components/select/select.js +4 -4
  111. package/src/components/source-list/source-list.css +208 -0
  112. package/src/components/source-list/source-list.js +355 -0
  113. package/src/components/stat-tile/stat-tile.css +56 -2
  114. package/src/components/stat-tile/stat-tile.js +25 -2
  115. package/src/components/stepper/stepper.css +2 -1
  116. package/src/components/stepper/stepper.js +3 -3
  117. package/src/components/tabbox/tabbox.css +2 -2
  118. package/src/components/tabbox/tabbox.js +2 -2
  119. package/src/components/table/table.css +52 -16
  120. package/src/components/table/table.js +7 -5
  121. package/src/components/tag-picker/tag-picker.css +56 -43
  122. package/src/components/tag-picker/tag-picker.js +21 -16
  123. package/src/components/tree/tree.css +44 -0
  124. package/src/components/tree/tree.js +97 -9
  125. package/src/components/value-list/value-list.css +25 -4
  126. package/src/components/value-list/value-list.js +2 -1
  127. package/src/components/view/record-view.js +3 -3
  128. package/src/components/view-settings/view-settings.css +2 -1
  129. package/src/components/workspace-switcher/workspace-switcher.js +3 -3
  130. package/src/core/icons.js +34 -3
  131. package/src/core/messages.js +143 -0
  132. package/src/elements/define.js +1 -0
  133. package/src/index.js +12 -2
  134. package/src/internal/agent-model.js +488 -0
  135. package/src/internal/app-rail.js +5 -1
  136. package/src/internal/highlight.js +104 -0
  137. package/src/internal/presence-loop.js +343 -0
  138. package/src/internal/row-actions.js +203 -0
  139. package/styles/base.css +26 -1
  140. package/styles/prose.css +306 -0
  141. package/styles/tokens/dark.css +97 -120
  142. package/styles/tokens/global.css +24 -9
  143. package/styles/tokens/semantic.css +464 -184
  144. package/styles/tokens/themes.css +9 -0
  145. package/styles/zx.css +10 -0
@@ -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,151 @@
1
+ import { ContextMenu } from '../components/context-menu/context-menu.js';
2
+ import { MenuButton } from '../components/menu-button/menu-button.js';
3
+ export type RowAction = {
4
+ /**
5
+ * What the action does; the tooltip, and with the row's name its
6
+ * accessible name.
7
+ */
8
+ label: string;
9
+ /**
10
+ * Icon name. Inline actions show only the icon.
11
+ */
12
+ icon?: string;
13
+ /**
14
+ * Runs the action for the row's node or item.
15
+ */
16
+ onSelect: (subject: any) => void;
17
+ /**
18
+ * Whether the action is unavailable on this row.
19
+ */
20
+ disabled?: boolean;
21
+ /**
22
+ * Whether the action destroys something; menus colour it.
23
+ */
24
+ danger?: boolean;
25
+ };
26
+ export type RowActionEntry = RowAction | Node;
27
+ export type RowActionStrip = {
28
+ /**
29
+ * The strip, marked `data-zx-reveal`.
30
+ */
31
+ element: HTMLElement;
32
+ /**
33
+ * Every descriptor of the row, inline and folded, in order — what
34
+ * the row's context menu lists. Inline buttons and menu items carry indexes into it.
35
+ */
36
+ actions: RowAction[];
37
+ /**
38
+ * The overflow menu, when actions were folded.
39
+ */
40
+ menu: MenuButton | null;
41
+ /**
42
+ * Destroys the overflow menu.
43
+ */
44
+ destroy: () => void;
45
+ };
46
+ /**
47
+ * One action a row offers: a repeated, secondary command such as "Add sub-page" or "Rename".
48
+ * @typedef {Object} RowAction
49
+ * @property {string} label What the action does; the tooltip, and with the row's name its
50
+ * accessible name.
51
+ * @property {string} [icon] Icon name. Inline actions show only the icon.
52
+ * @property {(subject: any) => void} onSelect Runs the action for the row's node or item.
53
+ * @property {boolean} [disabled=false] Whether the action is unavailable on this row.
54
+ * @property {boolean} [danger=false] Whether the action destroys something; menus colour it.
55
+ */
56
+ /** @typedef {RowAction|Node} RowActionEntry */
57
+ /**
58
+ * The controls built for one row.
59
+ * @typedef {Object} RowActionStrip
60
+ * @property {HTMLElement} element The strip, marked `data-zx-reveal`.
61
+ * @property {RowAction[]} actions Every descriptor of the row, inline and folded, in order — what
62
+ * the row's context menu lists. Inline buttons and menu items carry indexes into it.
63
+ * @property {MenuButton|null} menu The overflow menu, when actions were folded.
64
+ * @property {() => void} destroy Destroys the overflow menu.
65
+ */
66
+ /** A row never carries more controls than this before the rest fold into a menu. */
67
+ export declare const ROW_ACTION_LIMIT = 2;
68
+ /**
69
+ * Whether an entry is a control of the application's own, placed in the row as given.
70
+ * @param {unknown} entry Candidate entry.
71
+ * @returns {entry is Node}
72
+ */
73
+ export declare function isRowActionNode(entry: unknown): entry is Node;
74
+ /**
75
+ * Whether an entry is a usable action descriptor: a label and something to run.
76
+ * @param {unknown} entry Candidate entry.
77
+ * @returns {entry is RowAction}
78
+ */
79
+ export declare function isRowAction(entry: unknown): entry is RowAction;
80
+ /**
81
+ * Decides which entries a row shows and which fold into its overflow menu. One or two entries all
82
+ * show; with more, the first shows and the descriptors after it fold, so a row carries at most two
83
+ * controls of its own. A node is the application's control and never folds.
84
+ * @param {unknown} entries What `rowActions` or `actions` returned.
85
+ * @returns {{inline: RowActionEntry[], overflow: RowAction[]}}
86
+ */
87
+ export declare function planRowActions(entries: unknown): {
88
+ inline: RowActionEntry[];
89
+ overflow: RowAction[];
90
+ };
91
+ /**
92
+ * An action control's accessible name, which says which row it acts on: on a list of rows every
93
+ * "Rename" button is otherwise the same button. The action comes first, so a screen reader's
94
+ * list of buttons still sorts by what they do.
95
+ * @param {string} action Action label.
96
+ * @param {string} name The row's name.
97
+ * @returns {string}
98
+ */
99
+ export declare function rowActionLabel(action: string, name: string): string;
100
+ /**
101
+ * Menu items for descriptors, valued by their index in `actions`.
102
+ * @param {RowAction[]} actions The row's descriptors.
103
+ * @param {RowAction[]} [only=actions] The descriptors to list.
104
+ * @returns {Array<{label: string, icon?: string, value: number, danger: boolean, disabled: boolean}>}
105
+ */
106
+ export declare function menuEntries(actions: RowAction[], only?: RowAction[]): Array<{
107
+ label: string;
108
+ icon?: string;
109
+ value: number;
110
+ danger: boolean;
111
+ disabled: boolean;
112
+ }>;
113
+ /**
114
+ * Builds a row's action strip: an icon button per inline descriptor, the given nodes, and the
115
+ * overflow menu. Every control starts outside the Tab order; the host component makes the strip
116
+ * of the row holding focus tabbable. Inline buttons carry `data-row-action`, an index into
117
+ * `actions`, so the host runs them from its own delegated click listener.
118
+ * @param {unknown} entries Row actions.
119
+ * @param {{block: string, name: string, moreLabel?: string, run: (action: RowAction) => void}} options
120
+ * `block` names the parts (`zx-<block>__actions`, `zx-<block>__action`); `name` is the row's
121
+ * name; `moreLabel` names the overflow menu ("More actions"); `run` is called with a descriptor
122
+ * chosen from the overflow menu.
123
+ * @returns {RowActionStrip|null} Null when nothing usable was given.
124
+ */
125
+ export declare function renderRowActions(entries: unknown, { block, name, moreLabel, run }: {
126
+ block: string;
127
+ name: string;
128
+ moreLabel?: string;
129
+ run: (action: RowAction) => void;
130
+ }): RowActionStrip | null;
131
+ /**
132
+ * Puts every control in a strip in or out of the Tab order.
133
+ * @param {Element|null|undefined} element A strip.
134
+ * @param {boolean} tabbable Whether its controls are Tab stops.
135
+ * @returns {void}
136
+ */
137
+ export declare function setRowActionsTabbable(element: Element | null | undefined, tabbable: boolean): void;
138
+ /**
139
+ * The context menu of a component's rows: every descriptor of the row it opens on. Choosing an
140
+ * item closes the menu, which returns focus to the row, and only then runs the action — so a
141
+ * dialog the action opens records the row as the place to return to.
142
+ * @param {Element} target The element holding the rows.
143
+ * @param {string} selector The rows.
144
+ * @param {(row: Element) => {actions: RowAction[], subject: unknown}|null} resolve The row's
145
+ * descriptors and what their `onSelect` receives.
146
+ * @returns {ContextMenu}
147
+ */
148
+ export declare function rowActionMenu(target: Element, selector: string, resolve: (row: Element) => {
149
+ actions: RowAction[];
150
+ subject: unknown;
151
+ } | null): ContextMenu;