@zeyos/zx 4.1.1 → 4.3.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 (102) hide show
  1. package/CHANGELOG.md +81 -0
  2. package/DESIGN-SYSTEM.md +33 -3
  3. package/README.md +22 -5
  4. package/dist/types/components/app-icon/app-icon.d.ts +8 -1
  5. package/dist/types/components/aurora/aurora.d.ts +72 -0
  6. package/dist/types/components/calendar/calendar-model.d.ts +202 -0
  7. package/dist/types/components/calendar/calendar.d.ts +517 -0
  8. package/dist/types/components/card-view/card-view.d.ts +303 -0
  9. package/dist/types/components/card-view/record-card.d.ts +242 -0
  10. package/dist/types/components/dialog/dialog.d.ts +6 -1
  11. package/dist/types/components/dropdown/dropdown.d.ts +5 -0
  12. package/dist/types/components/kanban-view/kanban-view.d.ts +572 -0
  13. package/dist/types/components/launcher/launcher.d.ts +5 -0
  14. package/dist/types/components/message/message.d.ts +9 -1
  15. package/dist/types/components/modal/modal.d.ts +44 -7
  16. package/dist/types/components/sheet/sheet.d.ts +22 -12
  17. package/dist/types/components/table/table.d.ts +120 -31
  18. package/dist/types/components/table-view/table-view.d.ts +192 -0
  19. package/dist/types/components/view/record-view.d.ts +464 -0
  20. package/dist/types/core/overlay-host.d.ts +12 -0
  21. package/dist/types/index.d.ts +7 -0
  22. package/dist/types/zeyos/calendar.d.ts +91 -0
  23. package/dist/types/zeyos/icons.d.ts +18 -2
  24. package/dist/types/zeyos/index.d.ts +4 -0
  25. package/dist/types/zeyos/legacy-saved-views.d.ts +66 -0
  26. package/dist/types/zeyos/saved-views.d.ts +331 -0
  27. package/dist/types/zeyos/view.d.ts +305 -0
  28. package/dist/zx-zeyos.esm.js +4742 -1470
  29. package/dist/zx-zeyos.esm.min.js +1 -1
  30. package/dist/zx.css +2536 -471
  31. package/dist/zx.esm.js +5193 -223
  32. package/dist/zx.esm.min.js +3 -3
  33. package/dist/zx.global.js +5193 -223
  34. package/dist/zx.global.min.js +3 -3
  35. package/dist/zx.min.css +1 -1
  36. package/docs/api.json +1729 -182
  37. package/docs/llms.md +236 -32
  38. package/docs/llms.txt +16 -6
  39. package/package.json +1 -1
  40. package/src/components/account-menu/account-menu.css +1 -1
  41. package/src/components/app-icon/app-icon.css +77 -51
  42. package/src/components/app-icon/app-icon.js +28 -4
  43. package/src/components/app-rail/app-rail.css +12 -3
  44. package/src/components/app-sidebar/app-sidebar.css +11 -2
  45. package/src/components/aurora/aurora.css +143 -0
  46. package/src/components/aurora/aurora.js +146 -0
  47. package/src/components/avatar/avatar.css +1 -1
  48. package/src/components/button/button.css +2 -2
  49. package/src/components/calendar/calendar-model.js +402 -0
  50. package/src/components/calendar/calendar.css +609 -0
  51. package/src/components/calendar/calendar.js +1619 -0
  52. package/src/components/card/card.css +2 -2
  53. package/src/components/card-view/card-view.css +389 -0
  54. package/src/components/card-view/card-view.js +527 -0
  55. package/src/components/card-view/record-card.js +392 -0
  56. package/src/components/context-menu/context-menu.css +4 -4
  57. package/src/components/context-menu/context-menu.js +5 -1
  58. package/src/components/date-picker/date-picker.css +31 -12
  59. package/src/components/datebox/date-range-box.css +17 -2
  60. package/src/components/datebox/datebox.css +18 -3
  61. package/src/components/dialog/dialog.css +4 -3
  62. package/src/components/dialog/dialog.js +2 -1
  63. package/src/components/dropdown/dropdown.css +17 -3
  64. package/src/components/dropdown/dropdown.js +7 -2
  65. package/src/components/kanban-view/kanban-view.css +216 -0
  66. package/src/components/kanban-view/kanban-view.js +1228 -0
  67. package/src/components/launcher/launcher.css +24 -9
  68. package/src/components/launcher/launcher.js +9 -2
  69. package/src/components/master-panel/master-panel.css +14 -3
  70. package/src/components/menu-button/menu-button.css +4 -4
  71. package/src/components/message/message.css +13 -21
  72. package/src/components/message/message.js +17 -11
  73. package/src/components/modal/modal.css +19 -5
  74. package/src/components/modal/modal.js +99 -25
  75. package/src/components/navigation-bar/navigation-bar.css +17 -5
  76. package/src/components/panel/panel.css +10 -2
  77. package/src/components/select/select.css +26 -8
  78. package/src/components/sheet/sheet.css +28 -7
  79. package/src/components/sheet/sheet.js +43 -23
  80. package/src/components/table/table.css +83 -5
  81. package/src/components/table/table.js +322 -37
  82. package/src/components/table-view/table-view.css +18 -0
  83. package/src/components/table-view/table-view.js +347 -0
  84. package/src/components/tag-picker/tag-picker.css +18 -4
  85. package/src/components/tooltip/tooltip.css +17 -3
  86. package/src/components/tooltip/tooltip.js +4 -1
  87. package/src/components/view/record-view.css +114 -0
  88. package/src/components/view/record-view.js +770 -0
  89. package/src/core/overlay-host.js +23 -0
  90. package/src/index.js +15 -0
  91. package/src/zeyos/calendar.js +115 -0
  92. package/src/zeyos/icons.js +11 -4
  93. package/src/zeyos/index.js +13 -0
  94. package/src/zeyos/launcher.js +2 -2
  95. package/src/zeyos/legacy-saved-views.js +155 -0
  96. package/src/zeyos/saved-views.js +815 -0
  97. package/src/zeyos/table.js +3 -1
  98. package/src/zeyos/view.js +543 -0
  99. package/styles/icons.css +3 -10
  100. package/styles/tokens/dark.css +4 -0
  101. package/styles/tokens/semantic.css +142 -3
  102. package/styles/zx.css +6 -0
@@ -0,0 +1,66 @@
1
+ /**
2
+ * @typedef {Object} SavedViewScope
3
+ * @property {string|number} userId Client identity used by the controller; never sent to the legacy endpoint.
4
+ * @property {string|number|null} workspaceId ZeyOS fork/workspace id.
5
+ * @property {string} resource ZeyOS resource whose record views are being saved.
6
+ */
7
+ export type SavedViewScope = {
8
+ /**
9
+ * Client identity used by the controller; never sent to the legacy endpoint.
10
+ */
11
+ userId: string | number;
12
+ /**
13
+ * ZeyOS fork/workspace id.
14
+ */
15
+ workspaceId: string | number | null;
16
+ /**
17
+ * ZeyOS resource whose record views are being saved.
18
+ */
19
+ resource: string;
20
+ };
21
+ export type LegacySavedViewTransportOptions = {
22
+ /**
23
+ * Reserved `userfields.name` value.
24
+ */
25
+ recordName?: string;
26
+ /**
27
+ * Namespace prepended to `userfields.view`.
28
+ */
29
+ viewPrefix?: string;
30
+ /**
31
+ * Legacy UMI/module value.
32
+ */
33
+ module?: string;
34
+ };
35
+ /**
36
+ * @typedef {Object} LegacySavedViewTransportOptions
37
+ * @property {string} [recordName='__zx_record_views_v1__'] Reserved `userfields.name` value.
38
+ * @property {string} [viewPrefix='zx.record-views:'] Namespace prepended to `userfields.view`.
39
+ * @property {string} [module=''] Legacy UMI/module value.
40
+ */
41
+ /**
42
+ * Converts the callback form of `PG.load` into the promise request consumed by
43
+ * `createLegacySavedViewTransport`. Pass a bound method (`PG.load.bind(PG)`) so legacy receivers
44
+ * that depend on `this` remain intact.
45
+ * @param {(params:Record<string,unknown>,onLoad:(data:unknown)=>void,onCatch:(message:unknown,type?:unknown,info?:unknown)=>boolean)=>unknown} load Legacy loader.
46
+ * @returns {(params:Record<string,unknown>)=>Promise<unknown>}
47
+ */
48
+ export declare function legacySavedViewRequest(load: (params: Record<string, unknown>, onLoad: (data: unknown) => void, onCatch: (message: unknown, type?: unknown, info?: unknown) => boolean) => unknown): (params: Record<string, unknown>) => Promise<unknown>;
49
+ /**
50
+ * Adapts ZeyOS's existing `fields`, `fields_save`, and `fields_remove` endpoints to the atomic
51
+ * document transport used by saved record views. The endpoint derives the user from the
52
+ * authenticated session; accepting `userId` in the scope prevents accidental controller reuse but
53
+ * deliberately does not turn a client-supplied identity into an authorization input.
54
+ *
55
+ * `request` is injected because Zx supports both the legacy `PG.load` bridge and modern hosts. It
56
+ * receives the familiar plain endpoint parameters and returns a promise for the decoded response.
57
+ *
58
+ * @param {(params:Record<string,unknown>)=>Promise<unknown>} request Promise-based legacy request bridge.
59
+ * @param {LegacySavedViewTransportOptions} [options={}] Endpoint namespace options.
60
+ * @returns {{load:(scope:SavedViewScope)=>Promise<Record<string,unknown>|null>,save:(scope:SavedViewScope,document:Record<string,unknown>)=>Promise<Record<string,unknown>>,remove:(scope:SavedViewScope)=>Promise<void>}}
61
+ */
62
+ export declare function createLegacySavedViewTransport(request: (params: Record<string, unknown>) => Promise<unknown>, options?: LegacySavedViewTransportOptions): {
63
+ load: (scope: SavedViewScope) => Promise<Record<string, unknown> | null>;
64
+ save: (scope: SavedViewScope, document: Record<string, unknown>) => Promise<Record<string, unknown>>;
65
+ remove: (scope: SavedViewScope) => Promise<void>;
66
+ };
@@ -0,0 +1,331 @@
1
+ /** Current persisted saved-view document version. */
2
+ export declare const SAVED_VIEWS_VERSION = 1;
3
+ export type SavedViewType = 'table' | 'card' | 'kanban';
4
+ export type SavedViewDuplicatePolicy = 'reject' | 'replace';
5
+ export type SavedViewScope = {
6
+ /**
7
+ * Authenticated user identifier.
8
+ */
9
+ userId: string;
10
+ /**
11
+ * Workspace/fork identifier; null identifies the base workspace.
12
+ */
13
+ workspaceId: string | null;
14
+ /**
15
+ * ZeyOS resource/view identifier.
16
+ */
17
+ resource: string;
18
+ };
19
+ export type SavedViewEntry = {
20
+ /**
21
+ * Stable saved-view identifier.
22
+ */
23
+ id: string;
24
+ /**
25
+ * User-facing unique name.
26
+ */
27
+ name: string;
28
+ /**
29
+ * Presentation type.
30
+ */
31
+ type: SavedViewType;
32
+ /**
33
+ * Versioned RecordView configuration.
34
+ */
35
+ state: Record<string, unknown>;
36
+ /**
37
+ * JSON-safe query/filter configuration.
38
+ */
39
+ filters: Record<string, unknown>;
40
+ /**
41
+ * Full-text query.
42
+ */
43
+ search: string;
44
+ /**
45
+ * ISO-8601 creation timestamp.
46
+ */
47
+ createdAt: string;
48
+ /**
49
+ * ISO-8601 update timestamp.
50
+ */
51
+ updatedAt: string;
52
+ };
53
+ export type SavedViewDocument = {
54
+ /**
55
+ * Persisted document schema version.
56
+ */
57
+ version: 1;
58
+ /**
59
+ * Scope duplicated in the document to detect transport mix-ups.
60
+ */
61
+ scope: SavedViewScope;
62
+ /**
63
+ * Default saved-view id.
64
+ */
65
+ defaultId: string | null;
66
+ /**
67
+ * Deterministically ordered saved views.
68
+ */
69
+ views: SavedViewEntry[];
70
+ };
71
+ export type SavedViewTransport = {
72
+ /**
73
+ * Loads the one document for scope.
74
+ */
75
+ load: (scope: SavedViewScope) => unknown | Promise<unknown>;
76
+ /**
77
+ * Atomically replaces the one document for scope.
78
+ */
79
+ save: (scope: SavedViewScope, document: SavedViewDocument) => unknown | Promise<unknown>;
80
+ /**
81
+ * Removes the scope document.
82
+ */
83
+ remove?: (scope: SavedViewScope) => unknown | Promise<unknown>;
84
+ };
85
+ export type SavedViewRegistryOptions = {
86
+ /**
87
+ * Duplicate-name policy.
88
+ */
89
+ duplicateNames?: SavedViewDuplicatePolicy;
90
+ /**
91
+ * Timestamp source; defaults to the current time.
92
+ */
93
+ clock?: () => string | Date | number;
94
+ /**
95
+ * Stable-id factory. A deterministic dependency-free id is used when omitted.
96
+ */
97
+ idFactory?: (context: {
98
+ scope: SavedViewScope;
99
+ name: string;
100
+ type: SavedViewType;
101
+ createdAt: string;
102
+ }) => string;
103
+ /**
104
+ * Optional migrations keyed by their source version. Version 0 has a built-in migration.
105
+ */
106
+ migrations?: Record<number, (document: Record<string, unknown>) => Record<string, unknown>>;
107
+ };
108
+ export type SavedViewInput = {
109
+ /**
110
+ * Stable id for an update or import.
111
+ */
112
+ id?: string;
113
+ /**
114
+ * Unique display name.
115
+ */
116
+ name: string;
117
+ /**
118
+ * Presentation type; required for a new view.
119
+ */
120
+ type?: SavedViewType;
121
+ /**
122
+ * RecordView state; required for a new view.
123
+ */
124
+ state?: Record<string, unknown>;
125
+ /**
126
+ * Query/filter state.
127
+ */
128
+ filters?: Record<string, unknown>;
129
+ /**
130
+ * Full-text query.
131
+ */
132
+ search?: string;
133
+ };
134
+ export type SavedViewApplyResult = {
135
+ /**
136
+ * Result status.
137
+ */
138
+ status: 'applied' | 'missing' | 'type-mismatch';
139
+ /**
140
+ * Whether state was applied.
141
+ */
142
+ applied: boolean;
143
+ /**
144
+ * Resolved saved entry.
145
+ */
146
+ entry: SavedViewEntry | null;
147
+ /**
148
+ * Saved presentation required by the entry on a mismatch.
149
+ */
150
+ expectedType?: SavedViewType;
151
+ /**
152
+ * Current/requested renderer presentation on a mismatch.
153
+ */
154
+ currentType?: SavedViewType;
155
+ };
156
+ /** Duplicate saved-view name. */
157
+ export declare class SavedViewDuplicateNameError extends Error {
158
+ /** @param {string} name Duplicate display name. */
159
+ constructor(name: string);
160
+ }
161
+ /** A transport returned a document belonging to another scope. */
162
+ export declare class SavedViewScopeMismatchError extends Error {
163
+ expected: {
164
+ userId: string;
165
+ workspaceId: string | null;
166
+ resource: string;
167
+ };
168
+ actual: {
169
+ userId: string;
170
+ workspaceId: string | null;
171
+ resource: string;
172
+ };
173
+ /** @param {SavedViewScope} expected Expected scope. @param {SavedViewScope} actual Stored scope. */
174
+ constructor(expected: SavedViewScope, actual: SavedViewScope);
175
+ }
176
+ /**
177
+ * Dependency-free named saved-view registry with an injected, scope-atomic transport.
178
+ */
179
+ export declare class SavedViewRegistry {
180
+ transport: SavedViewTransport;
181
+ scope: SavedViewScope;
182
+ options: Required<Pick<SavedViewRegistryOptions, "clock" | "duplicateNames">> & SavedViewRegistryOptions;
183
+ _document: SavedViewDocument;
184
+ _loaded: boolean;
185
+ _loading: Promise<void>;
186
+ _loadSequence: number;
187
+ _mutation: Promise<void>;
188
+ _destroyed: boolean;
189
+ /**
190
+ * @param {SavedViewTransport} transport Persistence adapter.
191
+ * @param {SavedViewScope} scope User/workspace/resource scope.
192
+ * @param {SavedViewRegistryOptions} [options={}] Registry policy and deterministic test hooks.
193
+ */
194
+ constructor(transport: SavedViewTransport, scope: SavedViewScope, options?: SavedViewRegistryOptions);
195
+ /** Loads the scope once and returns this registry. @returns {Promise<this>} */
196
+ ready(): Promise<this>;
197
+ /**
198
+ * Loads and normalizes the persisted document. Repeated calls use the in-memory snapshot unless
199
+ * `force` is true.
200
+ * @param {{force?:boolean}} [options={}] Load behavior.
201
+ * @returns {Promise<this>}
202
+ */
203
+ load(options?: {
204
+ force?: boolean;
205
+ }): Promise<this>;
206
+ /** Returns all entries in deterministic name/id order. @returns {Promise<SavedViewEntry[]>} */
207
+ list(): Promise<SavedViewEntry[]>;
208
+ /** Resolves an entry by exact id or normalized name. @param {string} idOrName @returns {Promise<SavedViewEntry|null>} */
209
+ get(idOrName: string): Promise<SavedViewEntry | null>;
210
+ /** Returns the default entry, or null. @returns {Promise<SavedViewEntry|null>} */
211
+ getDefault(): Promise<SavedViewEntry | null>;
212
+ /**
213
+ * Creates or updates one named entry and persists the whole scope in one transport write.
214
+ * @param {SavedViewInput} input Saved-view values.
215
+ * @param {{onDuplicate?:SavedViewDuplicatePolicy,setDefault?:boolean}} [options={}] Write policy.
216
+ * @returns {Promise<SavedViewEntry>} Saved entry.
217
+ */
218
+ save(input: SavedViewInput, options?: {
219
+ onDuplicate?: SavedViewDuplicatePolicy;
220
+ setDefault?: boolean;
221
+ }): Promise<SavedViewEntry>;
222
+ /**
223
+ * Renames an entry without changing its stable id or creation time.
224
+ * @param {string} idOrName Entry id or name.
225
+ * @param {string} name New display name.
226
+ * @param {{onDuplicate?:SavedViewDuplicatePolicy}} [options={}] Duplicate policy.
227
+ * @returns {Promise<SavedViewEntry|null>} Updated entry, or null when absent.
228
+ */
229
+ rename(idOrName: string, name: string, options?: {
230
+ onDuplicate?: SavedViewDuplicatePolicy;
231
+ }): Promise<SavedViewEntry | null>;
232
+ /**
233
+ * Removes one named entry. The optional transport `remove(scope)` is used when the document
234
+ * becomes empty; otherwise the empty document is saved normally.
235
+ * @param {string} idOrName Entry id or name.
236
+ * @returns {Promise<boolean>} Whether an entry was removed.
237
+ */
238
+ remove(idOrName: string): Promise<boolean>;
239
+ /**
240
+ * Sets or clears the default view.
241
+ * @param {string|null} idOrName Entry id/name or null.
242
+ * @returns {Promise<SavedViewEntry|null>} New default, or null when cleared/absent.
243
+ */
244
+ setDefault(idOrName: string | null): Promise<SavedViewEntry | null>;
245
+ /**
246
+ * Captures `view.getViewState()`, persists it through `save()`, and returns the saved entry.
247
+ * Records and selection are never read from the view.
248
+ * @param {{getViewState:()=>Record<string,unknown>}} view RecordView-compatible instance.
249
+ * @param {Omit<SavedViewInput,'state'>} input Entry metadata/query state.
250
+ * @param {{onDuplicate?:SavedViewDuplicatePolicy,setDefault?:boolean}} [options={}] Write policy.
251
+ * @returns {Promise<SavedViewEntry>} Captured entry.
252
+ */
253
+ capture(view: {
254
+ getViewState: () => Record<string, unknown>;
255
+ }, input: Omit<SavedViewInput, 'state'>, options?: {
256
+ onDuplicate?: SavedViewDuplicatePolicy;
257
+ setDefault?: boolean;
258
+ }): Promise<SavedViewEntry>;
259
+ /**
260
+ * Applies one entry to a RecordView-compatible target. An expected type mismatch is reported
261
+ * without touching the target. Query state is handed to one optional combined callback so a
262
+ * server-backed binding can perform one reload rather than separate filter/search reloads.
263
+ * @param {string} idOrName Entry id or name.
264
+ * @param {{setViewState:(state:Record<string,unknown>)=>unknown}} view RecordView target.
265
+ * @param {{type?:SavedViewType,onQuery?:(query:{filters:Record<string,unknown>,search:string,entry:SavedViewEntry})=>unknown|Promise<unknown>}} [options={}] Apply behavior.
266
+ * @returns {Promise<SavedViewApplyResult>} Explicit apply result.
267
+ */
268
+ apply(idOrName: string, view: {
269
+ setViewState: (state: Record<string, unknown>) => unknown;
270
+ }, options?: {
271
+ type?: SavedViewType;
272
+ onQuery?: (query: {
273
+ filters: Record<string, unknown>;
274
+ search: string;
275
+ entry: SavedViewEntry;
276
+ }) => unknown | Promise<unknown>;
277
+ }): Promise<SavedViewApplyResult>;
278
+ /** Prevents later operations; it never removes persisted user data. @returns {void} */
279
+ destroy(): void;
280
+ /** @private @returns {void} */
281
+ private _assertActive;
282
+ /** @private @returns {string} */
283
+ private _now;
284
+ /**
285
+ * @private
286
+ * @param {SavedViewDocument} document
287
+ * @param {{name:string,type:SavedViewType,createdAt:string}} values
288
+ * @returns {string}
289
+ */
290
+ private _createId;
291
+ /**
292
+ * Serializes mutations inside one registry so concurrent calls cannot overwrite each other.
293
+ * @private
294
+ * @template T
295
+ * @param {(document:SavedViewDocument)=>Promise<{changed:boolean,result:T,removeDocument?:boolean}>} mutate
296
+ * @returns {Promise<T>}
297
+ */
298
+ private _mutate;
299
+ }
300
+ /**
301
+ * Factory useful to adapters that do not need to subclass the registry.
302
+ * @param {SavedViewTransport} transport Persistence adapter.
303
+ * @param {SavedViewScope} scope Scope.
304
+ * @param {SavedViewRegistryOptions} [options={}] Options.
305
+ * @returns {SavedViewRegistry}
306
+ */
307
+ export declare function createSavedViewRegistry(transport: SavedViewTransport, scope: SavedViewScope, options?: SavedViewRegistryOptions): SavedViewRegistry;
308
+ /**
309
+ * Validates and canonicalizes a transport scope. String/number identifiers are intentionally
310
+ * accepted so a ZeyOS fork id can bridge directly to `workspaceId`; null is the base fork.
311
+ * @param {SavedViewScope|Record<string,unknown>} scope Scope.
312
+ * @returns {SavedViewScope} Normalized scope.
313
+ */
314
+ export declare function normalizeSavedViewScope(scope: SavedViewScope | Record<string, unknown>): SavedViewScope;
315
+ /**
316
+ * Migrates and normalizes a persisted document without touching transport state.
317
+ * @param {unknown} value Persisted value, null, or a legacy version-0 value.
318
+ * @param {SavedViewScope} scope Expected scope.
319
+ * @param {SavedViewRegistryOptions} [options={}] Migration hooks.
320
+ * @returns {SavedViewDocument} Current normalized document.
321
+ */
322
+ export declare function normalizeSavedViewDocument(value: unknown, scope: SavedViewScope, options?: SavedViewRegistryOptions): SavedViewDocument;
323
+ /**
324
+ * Migrates old documents to the current structural version. Version 0 accepts an array or an
325
+ * object using `savedViews`/`entries`, `presentation`, `viewState`, `filter`, and `defaultView`.
326
+ * @param {unknown} value Persisted value.
327
+ * @param {Record<number,(document:Record<string,unknown>)=>Record<string,unknown>>} [migrations={}]
328
+ * Additional migrations keyed by source version.
329
+ * @returns {Record<string,unknown>} Migrated current-version document.
330
+ */
331
+ export declare function migrateSavedViewDocument(value: unknown, migrations?: Record<number, (document: Record<string, unknown>) => Record<string, unknown>>): Record<string, unknown>;
@@ -0,0 +1,305 @@
1
+ export type ViewField = import('../components/view/record-view.js').ViewField;
2
+ export type ViewSort = import('../components/view/record-view.js').ViewSort;
3
+ export type SavedViewEntry = import('./saved-views.js').SavedViewEntry;
4
+ export type SavedViewApplyResult = import('./saved-views.js').SavedViewApplyResult;
5
+ export type ZeyosSavedViewsOptions = {
6
+ /**
7
+ * Existing saved-view registry. It remains caller-owned.
8
+ */
9
+ controller?: Record<string, any>;
10
+ /**
11
+ * Alias for `controller`.
12
+ */
13
+ registry?: Record<string, any>;
14
+ /**
15
+ * Injected persistence transport used to construct a registry.
16
+ */
17
+ transport?: Record<string, any>;
18
+ /**
19
+ * Saved-view isolation scope; null workspace identifies ZeyOS's base workspace.
20
+ * resource defaults to the bound ZeyOS resource.
21
+ */
22
+ scope?: {
23
+ userId: string | number;
24
+ workspaceId: string | number | null;
25
+ resource?: string;
26
+ };
27
+ /**
28
+ * Options passed to `createSavedViewRegistry`.
29
+ */
30
+ options?: Record<string, unknown>;
31
+ /**
32
+ * Presentation identity; normally derived from the View.
33
+ */
34
+ type?: 'table' | 'card' | 'kanban';
35
+ };
36
+ export type ZeyosViewOptions = {
37
+ /**
38
+ * Curated ordered schema field allow-list.
39
+ */
40
+ fields?: string[];
41
+ /**
42
+ * Schema fields to omit.
43
+ */
44
+ exclude?: string[];
45
+ /**
46
+ * Per-field label overrides.
47
+ */
48
+ labels?: Record<string, string>;
49
+ /**
50
+ * View descriptor overrides.
51
+ */
52
+ fieldOverrides?: Record<string, Partial<ViewField>>;
53
+ /**
54
+ * Record id accessor.
55
+ */
56
+ recordId?: string | ((record: Record<string, unknown>) => unknown);
57
+ /**
58
+ * Server page size.
59
+ */
60
+ pageSize?: number;
61
+ /**
62
+ * Initial server sort.
63
+ */
64
+ sort?: ViewSort | null;
65
+ /**
66
+ * Initial ZeyOS predicates.
67
+ */
68
+ filters?: Record<string, unknown>;
69
+ /**
70
+ * Initial full-text query.
71
+ */
72
+ search?: string;
73
+ /**
74
+ * Server full-text fields where supported.
75
+ */
76
+ searchFields?: string[];
77
+ /**
78
+ * Options passed to the concrete view.
79
+ */
80
+ viewOptions?: Record<string, unknown>;
81
+ /**
82
+ * Concrete view target.
83
+ */
84
+ target?: Element | string | null;
85
+ /**
86
+ * Card title field included in the projection.
87
+ */
88
+ titleField?: string;
89
+ /**
90
+ * Card subtitle field included in the projection.
91
+ */
92
+ subtitleField?: string;
93
+ /**
94
+ * Preview field or resolver.
95
+ */
96
+ preview?: string | Function;
97
+ /**
98
+ * Card grouping field or resolver.
99
+ */
100
+ groupBy?: string | Function;
101
+ /**
102
+ * Kanban column field or resolver.
103
+ */
104
+ columnBy?: string | Function;
105
+ /**
106
+ * Kanban swim-lane field or resolver.
107
+ */
108
+ swimlaneBy?: string | Function;
109
+ /**
110
+ * Existing registry or
111
+ * injected transport/scope configuration for named saved views.
112
+ */
113
+ savedViews?: false | Record<string, any> | ZeyosSavedViewsOptions | null;
114
+ onRecordClick?: (record: Record<string, unknown>, event: CustomEvent<Record<string, unknown>>) => void;
115
+ };
116
+ export type ZeyosViewConfig = {
117
+ /**
118
+ * Ordered normalized schema metadata.
119
+ */
120
+ fieldMeta: Record<string, any>[];
121
+ /**
122
+ * Common view fields.
123
+ */
124
+ fields: ViewField[];
125
+ /**
126
+ * Complete server projection.
127
+ */
128
+ projection: Record<string, string>;
129
+ /**
130
+ * Concrete view options.
131
+ */
132
+ viewOptions: Record<string, any>;
133
+ };
134
+ export type ZeyosViewLoadOptions = {
135
+ /**
136
+ * Replacement full-text query.
137
+ */
138
+ search?: string;
139
+ /**
140
+ * Replacement predicates.
141
+ */
142
+ filters?: Record<string, unknown>;
143
+ /**
144
+ * Zero-based page; pages above zero append.
145
+ */
146
+ page?: number;
147
+ };
148
+ export type ZeyosViewLoadResult = {
149
+ /**
150
+ * Loaded records.
151
+ */
152
+ data: Record<string, unknown>[];
153
+ /**
154
+ * Server count when supplied.
155
+ */
156
+ count: number | null;
157
+ /**
158
+ * Loaded page.
159
+ */
160
+ page: number;
161
+ /**
162
+ * Whether another page is available.
163
+ */
164
+ hasMore: boolean;
165
+ /**
166
+ * Request sent to the list operation.
167
+ */
168
+ query: Record<string, unknown>;
169
+ };
170
+ export type ZeyosSavedViewCapture = {
171
+ /**
172
+ * Existing saved-view id.
173
+ */
174
+ id?: string;
175
+ /**
176
+ * Saved-view name.
177
+ */
178
+ name: string;
179
+ /**
180
+ * Concrete presentation.
181
+ */
182
+ type: 'table' | 'card' | 'kanban';
183
+ /**
184
+ * JSON-safe component view state.
185
+ */
186
+ state: Record<string, unknown>;
187
+ /**
188
+ * Current server filters.
189
+ */
190
+ filters: Record<string, unknown>;
191
+ /**
192
+ * Current full-text query.
193
+ */
194
+ search: string;
195
+ };
196
+ export type ZeyosSaveViewOptions = {
197
+ /**
198
+ * Existing saved-view id to replace.
199
+ */
200
+ id?: string;
201
+ /**
202
+ * Saved-view name.
203
+ */
204
+ name: string;
205
+ /**
206
+ * Duplicate-name behavior.
207
+ */
208
+ onDuplicate?: 'reject' | 'replace';
209
+ /**
210
+ * Make the saved entry the default.
211
+ */
212
+ setDefault?: boolean;
213
+ };
214
+ export type ZeyosApplyViewOptions = {
215
+ /**
216
+ * Reload the first server page after an applied view.
217
+ */
218
+ load?: boolean;
219
+ };
220
+ export type ZeyosViewBinding = {
221
+ /**
222
+ * Generated RecordView-compatible instance.
223
+ */
224
+ view: Record<string, any>;
225
+ /**
226
+ * Loads a page.
227
+ */
228
+ load: (options?: ZeyosViewLoadOptions) => Promise<ZeyosViewLoadResult>;
229
+ /**
230
+ * Replaces search and reloads.
231
+ */
232
+ setSearch: (search: string) => Promise<ZeyosViewLoadResult>;
233
+ /**
234
+ * Replaces filters and reloads.
235
+ */
236
+ setFilters: (filters: Record<string, unknown>) => Promise<ZeyosViewLoadResult>;
237
+ /**
238
+ * Loads the next page when available.
239
+ */
240
+ loadMore: () => Promise<ZeyosViewLoadResult>;
241
+ /**
242
+ * Current server count.
243
+ */
244
+ count: number | null;
245
+ /**
246
+ * Current zero-based page.
247
+ */
248
+ page: number;
249
+ /**
250
+ * Whether another page is available.
251
+ */
252
+ hasMore: boolean;
253
+ /**
254
+ * Saved-view registry when configured.
255
+ */
256
+ savedViews: Record<string, any> | null;
257
+ /**
258
+ * Default restoration completed before loads.
259
+ */
260
+ ready: Promise<SavedViewApplyResult | null>;
261
+ /**
262
+ * Restores the current default.
263
+ */
264
+ restoreDefault: (options?: ZeyosApplyViewOptions) => Promise<SavedViewApplyResult | null>;
265
+ /**
266
+ * Captures current query/view state without persistence.
267
+ */
268
+ captureView: (details: {
269
+ id?: string;
270
+ name: string;
271
+ }) => ZeyosSavedViewCapture;
272
+ /**
273
+ * Captures and persists the current view.
274
+ */
275
+ saveView: (details: ZeyosSaveViewOptions) => Promise<SavedViewEntry>;
276
+ /**
277
+ * Applies a compatible named view.
278
+ */
279
+ applyView: (idOrName: string, options?: ZeyosApplyViewOptions) => Promise<SavedViewApplyResult>;
280
+ /**
281
+ * Destroys the generated view.
282
+ */
283
+ destroy: () => void;
284
+ };
285
+ /**
286
+ * Produces common view fields and a complete ZeyOS projection without touching the DOM. It reuses
287
+ * the established table schema conversion so entity labels, enums, amounts, currencies, and Unix
288
+ * dates render identically in TableView, CardView, and KanbanView.
289
+ * @param {Record<string, any>} client Injected ZeyOS client.
290
+ * @param {string} resource Schema resource.
291
+ * @param {ZeyosViewOptions} [opts={}] Schema and view options.
292
+ * @returns {ZeyosViewConfig} DOM-free configuration.
293
+ */
294
+ export declare function buildZeyosViewConfig(client: Record<string, any>, resource: string, opts?: ZeyosViewOptions): ZeyosViewConfig;
295
+ /**
296
+ * Creates and binds any RecordView-compatible constructor to server paging. The caller supplies the
297
+ * constructor, so this adapter has no dependency on one concrete presentation and remains simple
298
+ * to unit test or wrap from a framework.
299
+ * @param {Record<string, any>} client Injected ZeyOS client.
300
+ * @param {string} resource Schema resource.
301
+ * @param {new(target:Element|string|null,options:Record<string,unknown>)=>Record<string,any>} View Concrete view class.
302
+ * @param {ZeyosViewOptions} [opts={}] Binding options.
303
+ * @returns {ZeyosViewBinding} View and server-state methods.
304
+ */
305
+ export declare function zeyosView(client: Record<string, any>, resource: string, View: new (target: Element | string | null, options: Record<string, unknown>) => Record<string, any>, opts?: ZeyosViewOptions): ZeyosViewBinding;