@zeyos/zx 4.1.0 → 4.2.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 +61 -0
- package/DESIGN-SYSTEM.md +33 -3
- package/README.md +17 -5
- package/dist/types/components/app-icon/app-icon.d.ts +8 -1
- package/dist/types/components/aurora/aurora.d.ts +72 -0
- package/dist/types/components/calendar/calendar-model.d.ts +202 -0
- package/dist/types/components/calendar/calendar.d.ts +500 -0
- package/dist/types/components/card-view/card-view.d.ts +303 -0
- package/dist/types/components/card-view/record-card.d.ts +242 -0
- package/dist/types/components/kanban-view/kanban-view.d.ts +572 -0
- package/dist/types/components/table/table.d.ts +120 -31
- package/dist/types/components/table-view/table-view.d.ts +192 -0
- package/dist/types/components/view/record-view.d.ts +464 -0
- package/dist/types/index.d.ts +7 -0
- package/dist/types/zeyos/calendar.d.ts +91 -0
- package/dist/types/zeyos/icons.d.ts +19 -3
- package/dist/types/zeyos/index.d.ts +4 -0
- package/dist/types/zeyos/legacy-saved-views.d.ts +66 -0
- package/dist/types/zeyos/saved-views.d.ts +331 -0
- package/dist/types/zeyos/view.d.ts +305 -0
- package/dist/zx-zeyos.esm.js +4627 -1460
- package/dist/zx-zeyos.esm.min.js +1 -1
- package/dist/zx.css +2492 -410
- package/dist/zx.esm.js +4891 -115
- package/dist/zx.esm.min.js +3 -3
- package/dist/zx.global.js +4891 -115
- package/dist/zx.global.min.js +3 -3
- package/dist/zx.min.css +1 -1
- package/docs/api.json +1702 -191
- package/docs/llms.md +207 -20
- package/docs/llms.txt +16 -6
- package/package.json +1 -1
- package/src/components/app-icon/app-icon.css +140 -30
- package/src/components/app-icon/app-icon.js +32 -5
- package/src/components/app-rail/app-rail.css +11 -2
- package/src/components/app-sidebar/app-sidebar.css +11 -2
- package/src/components/aurora/aurora.css +143 -0
- package/src/components/aurora/aurora.js +146 -0
- package/src/components/avatar/avatar.css +1 -1
- package/src/components/button/button.css +34 -2
- package/src/components/calendar/calendar-model.js +402 -0
- package/src/components/calendar/calendar.css +567 -0
- package/src/components/calendar/calendar.js +1524 -0
- package/src/components/card/card.css +25 -3
- package/src/components/card-view/card-view.css +389 -0
- package/src/components/card-view/card-view.js +527 -0
- package/src/components/card-view/record-card.js +392 -0
- package/src/components/context-menu/context-menu.css +2 -2
- package/src/components/date-picker/date-picker.css +15 -3
- package/src/components/datebox/date-range-box.css +15 -2
- package/src/components/datebox/datebox.css +16 -3
- package/src/components/dropdown/dropdown.css +15 -3
- package/src/components/kanban-view/kanban-view.css +216 -0
- package/src/components/kanban-view/kanban-view.js +1228 -0
- package/src/components/launcher/launcher.css +18 -5
- package/src/components/master-panel/master-panel.css +14 -3
- package/src/components/menu-button/menu-button.css +2 -2
- package/src/components/message/message.css +15 -10
- package/src/components/modal/modal.css +15 -3
- package/src/components/navigation-bar/navigation-bar.css +17 -5
- package/src/components/panel/panel.css +10 -2
- package/src/components/select/select.css +20 -4
- package/src/components/sheet/sheet.css +4 -1
- package/src/components/table/table.css +80 -4
- package/src/components/table/table.js +322 -37
- package/src/components/table-view/table-view.css +18 -0
- package/src/components/table-view/table-view.js +347 -0
- package/src/components/tag-picker/tag-picker.css +15 -3
- package/src/components/tooltip/tooltip.css +15 -3
- package/src/components/view/record-view.css +114 -0
- package/src/components/view/record-view.js +770 -0
- package/src/index.js +15 -0
- package/src/zeyos/calendar.js +115 -0
- package/src/zeyos/icons.js +15 -8
- package/src/zeyos/index.js +13 -0
- package/src/zeyos/launcher.js +2 -2
- package/src/zeyos/legacy-saved-views.js +155 -0
- package/src/zeyos/saved-views.js +815 -0
- package/src/zeyos/table.js +3 -1
- package/src/zeyos/view.js +543 -0
- package/styles/icons.css +3 -10
- package/styles/tokens/semantic.css +74 -2
- package/styles/zx.css +6 -0
|
@@ -0,0 +1,303 @@
|
|
|
1
|
+
import { RecordView } from '../view/record-view.js';
|
|
2
|
+
export type ViewRecord = Record<string, any>;
|
|
3
|
+
export type ViewField = import('../view/record-view.js').ViewField;
|
|
4
|
+
export type RecordViewOptions = import('../view/record-view.js').RecordViewOptions;
|
|
5
|
+
export type RecordCardValueSource = import('./record-card.js').RecordCardValueSource;
|
|
6
|
+
export type RecordCardPreview = import('./record-card.js').RecordCardPreview;
|
|
7
|
+
export type RecordCardLink = import('./record-card.js').RecordCardLink;
|
|
8
|
+
export type RecordCardAction = import('./record-card.js').RecordCardAction;
|
|
9
|
+
export type CardViewOptions = {
|
|
10
|
+
/**
|
|
11
|
+
* Shared ordered field descriptors.
|
|
12
|
+
*/
|
|
13
|
+
fields?: ViewField[];
|
|
14
|
+
/**
|
|
15
|
+
* Initial records.
|
|
16
|
+
*/
|
|
17
|
+
data?: ViewRecord[];
|
|
18
|
+
/**
|
|
19
|
+
* Stable record id accessor.
|
|
20
|
+
*/
|
|
21
|
+
recordId?: string | ((record: ViewRecord) => unknown);
|
|
22
|
+
/**
|
|
23
|
+
* Initial shared sort.
|
|
24
|
+
*/
|
|
25
|
+
sort?: import('../view/record-view.js').ViewSort | null;
|
|
26
|
+
/**
|
|
27
|
+
* Local sorting or event-only server sorting.
|
|
28
|
+
*/
|
|
29
|
+
sortMode?: 'local' | 'server';
|
|
30
|
+
/**
|
|
31
|
+
* Record selection behavior.
|
|
32
|
+
*/
|
|
33
|
+
selectable?: false | 'single' | 'multi';
|
|
34
|
+
/**
|
|
35
|
+
* Initially selected record ids.
|
|
36
|
+
*/
|
|
37
|
+
selection?: unknown[];
|
|
38
|
+
/**
|
|
39
|
+
* Preferred shared field order.
|
|
40
|
+
*/
|
|
41
|
+
fieldOrder?: string[];
|
|
42
|
+
/**
|
|
43
|
+
* Initially hidden metadata fields.
|
|
44
|
+
*/
|
|
45
|
+
hiddenFields?: string[];
|
|
46
|
+
/**
|
|
47
|
+
* Whether to expose shared field controls.
|
|
48
|
+
*/
|
|
49
|
+
fieldControls?: boolean;
|
|
50
|
+
/**
|
|
51
|
+
* Empty-result content.
|
|
52
|
+
*/
|
|
53
|
+
emptyText?: string | Node | (() => string | Node) | null;
|
|
54
|
+
/**
|
|
55
|
+
* Title field id or explicit resolver.
|
|
56
|
+
*/
|
|
57
|
+
titleField?: RecordCardValueSource;
|
|
58
|
+
/**
|
|
59
|
+
* Subtitle field id or explicit resolver.
|
|
60
|
+
*/
|
|
61
|
+
subtitleField?: RecordCardValueSource;
|
|
62
|
+
/**
|
|
63
|
+
* Preview field id or explicit resolver.
|
|
64
|
+
*/
|
|
65
|
+
preview?: string | ((record: ViewRecord, index: number) => RecordCardPreview);
|
|
66
|
+
/**
|
|
67
|
+
* Preview alt field, literal, or resolver.
|
|
68
|
+
*/
|
|
69
|
+
previewAlt?: string | ((record: ViewRecord, index: number) => unknown) | null;
|
|
70
|
+
/**
|
|
71
|
+
* Safe native title link or resolver.
|
|
72
|
+
*/
|
|
73
|
+
link?: RecordCardLink | ((record: ViewRecord, index: number) => RecordCardLink);
|
|
74
|
+
/**
|
|
75
|
+
* Listener-free action descriptors or resolver.
|
|
76
|
+
*/
|
|
77
|
+
actions?: RecordCardAction[] | ((record: ViewRecord, index: number) => RecordCardAction[]);
|
|
78
|
+
/**
|
|
79
|
+
* Field id or local group resolver.
|
|
80
|
+
*/
|
|
81
|
+
groupBy?: string | ((record: ViewRecord, index: number) => unknown) | null;
|
|
82
|
+
/**
|
|
83
|
+
* Preferred group ids; missing ids render as empty groups.
|
|
84
|
+
*/
|
|
85
|
+
groupOrder?: unknown[];
|
|
86
|
+
/**
|
|
87
|
+
* Responsive minimum card width.
|
|
88
|
+
*/
|
|
89
|
+
minCardWidth?: number | string;
|
|
90
|
+
/**
|
|
91
|
+
* Maximum cards per row; null is unconstrained.
|
|
92
|
+
*/
|
|
93
|
+
maxColumns?: number | null;
|
|
94
|
+
/**
|
|
95
|
+
* Card surface treatment.
|
|
96
|
+
*/
|
|
97
|
+
variant?: 'outlined' | 'raised' | 'filled';
|
|
98
|
+
/**
|
|
99
|
+
* Skeleton cards shown while loading.
|
|
100
|
+
*/
|
|
101
|
+
loadingCount?: number;
|
|
102
|
+
/**
|
|
103
|
+
* Per-card title heading level.
|
|
104
|
+
*/
|
|
105
|
+
headingLevel?: 1 | 2 | 3 | 4 | 5 | 6;
|
|
106
|
+
/**
|
|
107
|
+
* Accessible collection label.
|
|
108
|
+
*/
|
|
109
|
+
label?: string;
|
|
110
|
+
onrecordaction?: (event: CustomEvent<Record<string, unknown>>) => void;
|
|
111
|
+
};
|
|
112
|
+
export type CardViewState = {
|
|
113
|
+
/**
|
|
114
|
+
* State schema version.
|
|
115
|
+
*/
|
|
116
|
+
version: 1;
|
|
117
|
+
/**
|
|
118
|
+
* Shared field order.
|
|
119
|
+
*/
|
|
120
|
+
fieldOrder: string[];
|
|
121
|
+
/**
|
|
122
|
+
* Shared hidden fields.
|
|
123
|
+
*/
|
|
124
|
+
hiddenFields: string[];
|
|
125
|
+
/**
|
|
126
|
+
* Shared sort.
|
|
127
|
+
*/
|
|
128
|
+
sort: import('../view/record-view.js').ViewSort | null;
|
|
129
|
+
/**
|
|
130
|
+
* Preferred group ids.
|
|
131
|
+
*/
|
|
132
|
+
groupOrder: string[];
|
|
133
|
+
/**
|
|
134
|
+
* Responsive minimum card width.
|
|
135
|
+
*/
|
|
136
|
+
minCardWidth: string;
|
|
137
|
+
/**
|
|
138
|
+
* Maximum cards per row.
|
|
139
|
+
*/
|
|
140
|
+
maxColumns: number | null;
|
|
141
|
+
/**
|
|
142
|
+
* Surface treatment.
|
|
143
|
+
*/
|
|
144
|
+
variant: 'outlined' | 'raised' | 'filled';
|
|
145
|
+
};
|
|
146
|
+
export type CardRecordGroup = {
|
|
147
|
+
/**
|
|
148
|
+
* Normalized group id, null for an ungrouped collection.
|
|
149
|
+
*/
|
|
150
|
+
id: string | null;
|
|
151
|
+
/**
|
|
152
|
+
* Display label.
|
|
153
|
+
*/
|
|
154
|
+
label: string;
|
|
155
|
+
/**
|
|
156
|
+
* Records in current shared display order.
|
|
157
|
+
*/
|
|
158
|
+
records: ViewRecord[];
|
|
159
|
+
};
|
|
160
|
+
/** @typedef {Record<string, any>} ViewRecord */
|
|
161
|
+
/** @typedef {import('../view/record-view.js').ViewField} ViewField */
|
|
162
|
+
/** @typedef {import('../view/record-view.js').RecordViewOptions} RecordViewOptions */
|
|
163
|
+
/** @typedef {import('./record-card.js').RecordCardValueSource} RecordCardValueSource */
|
|
164
|
+
/** @typedef {import('./record-card.js').RecordCardPreview} RecordCardPreview */
|
|
165
|
+
/** @typedef {import('./record-card.js').RecordCardLink} RecordCardLink */
|
|
166
|
+
/** @typedef {import('./record-card.js').RecordCardAction} RecordCardAction */
|
|
167
|
+
/**
|
|
168
|
+
* @typedef {Object} CardViewOptions
|
|
169
|
+
* @property {ViewField[]} [fields=[]] Shared ordered field descriptors.
|
|
170
|
+
* @property {ViewRecord[]} [data=[]] Initial records.
|
|
171
|
+
* @property {string|((record:ViewRecord)=>unknown)} [recordId='ID'] Stable record id accessor.
|
|
172
|
+
* @property {import('../view/record-view.js').ViewSort|null} [sort=null] Initial shared sort.
|
|
173
|
+
* @property {'local'|'server'} [sortMode='local'] Local sorting or event-only server sorting.
|
|
174
|
+
* @property {false|'single'|'multi'} [selectable=false] Record selection behavior.
|
|
175
|
+
* @property {unknown[]} [selection=[]] Initially selected record ids.
|
|
176
|
+
* @property {string[]} [fieldOrder=[]] Preferred shared field order.
|
|
177
|
+
* @property {string[]} [hiddenFields=[]] Initially hidden metadata fields.
|
|
178
|
+
* @property {boolean} [fieldControls=true] Whether to expose shared field controls.
|
|
179
|
+
* @property {string|Node|(()=>string|Node)|null} [emptyText=null] Empty-result content.
|
|
180
|
+
* @property {RecordCardValueSource} [titleField=null] Title field id or explicit resolver.
|
|
181
|
+
* @property {RecordCardValueSource} [subtitleField=null] Subtitle field id or explicit resolver.
|
|
182
|
+
* @property {string|((record:ViewRecord,index:number)=>RecordCardPreview)} [preview]
|
|
183
|
+
* Preview field id or explicit resolver.
|
|
184
|
+
* @property {string|((record:ViewRecord,index:number)=>unknown)|null} [previewAlt=null]
|
|
185
|
+
* Preview alt field, literal, or resolver.
|
|
186
|
+
* @property {RecordCardLink|((record:ViewRecord,index:number)=>RecordCardLink)} [link]
|
|
187
|
+
* Safe native title link or resolver.
|
|
188
|
+
* @property {RecordCardAction[]|((record:ViewRecord,index:number)=>RecordCardAction[])} [actions=[]]
|
|
189
|
+
* Listener-free action descriptors or resolver.
|
|
190
|
+
* @property {string|((record:ViewRecord,index:number)=>unknown)|null} [groupBy=null]
|
|
191
|
+
* Field id or local group resolver.
|
|
192
|
+
* @property {unknown[]} [groupOrder=[]] Preferred group ids; missing ids render as empty groups.
|
|
193
|
+
* @property {number|string} [minCardWidth='18rem'] Responsive minimum card width.
|
|
194
|
+
* @property {number|null} [maxColumns=null] Maximum cards per row; null is unconstrained.
|
|
195
|
+
* @property {'outlined'|'raised'|'filled'} [variant='outlined'] Card surface treatment.
|
|
196
|
+
* @property {number} [loadingCount=6] Skeleton cards shown while loading.
|
|
197
|
+
* @property {1|2|3|4|5|6} [headingLevel=3] Per-card title heading level.
|
|
198
|
+
* @property {string} [label='Card view'] Accessible collection label.
|
|
199
|
+
* @property {(event:CustomEvent<Record<string,unknown>>)=>void} [onrecordaction]
|
|
200
|
+
*/
|
|
201
|
+
/**
|
|
202
|
+
* @typedef {Object} CardViewState
|
|
203
|
+
* @property {1} version State schema version.
|
|
204
|
+
* @property {string[]} fieldOrder Shared field order.
|
|
205
|
+
* @property {string[]} hiddenFields Shared hidden fields.
|
|
206
|
+
* @property {import('../view/record-view.js').ViewSort|null} sort Shared sort.
|
|
207
|
+
* @property {string[]} groupOrder Preferred group ids.
|
|
208
|
+
* @property {string} minCardWidth Responsive minimum card width.
|
|
209
|
+
* @property {number|null} maxColumns Maximum cards per row.
|
|
210
|
+
* @property {'outlined'|'raised'|'filled'} variant Surface treatment.
|
|
211
|
+
*/
|
|
212
|
+
/**
|
|
213
|
+
* @typedef {Object} CardRecordGroup
|
|
214
|
+
* @property {string|null} id Normalized group id, null for an ungrouped collection.
|
|
215
|
+
* @property {string} label Display label.
|
|
216
|
+
* @property {ViewRecord[]} records Records in current shared display order.
|
|
217
|
+
*/
|
|
218
|
+
/**
|
|
219
|
+
* Responsive, schema-friendly record cards with shared fields, sorting, selection, state, groups,
|
|
220
|
+
* safe preview media, native title links, and delegated actions.
|
|
221
|
+
* @fires CardView#recordaction
|
|
222
|
+
* @extends {RecordView}
|
|
223
|
+
*/
|
|
224
|
+
export declare class CardView extends RecordView {
|
|
225
|
+
_cardCreatedRoot: boolean;
|
|
226
|
+
_cardOriginal: import("../../core/dom.js").TargetSnapshot;
|
|
227
|
+
_cardCleaned: boolean;
|
|
228
|
+
_cardNodesById: Map<any, any>;
|
|
229
|
+
_cardGroupOrder: string[];
|
|
230
|
+
_cardMinWidth: string;
|
|
231
|
+
_cardMaxColumns: number;
|
|
232
|
+
_cardVariant: "filled" | "outlined" | "raised";
|
|
233
|
+
_cardLoadingCount: number;
|
|
234
|
+
_cardHeadingLevel: 1 | 2 | 3 | 4 | 5 | 6;
|
|
235
|
+
static cssName: string;
|
|
236
|
+
/** @type {Readonly<CardViewOptions & RecordViewOptions>} */
|
|
237
|
+
static defaults: Readonly<CardViewOptions & RecordViewOptions>;
|
|
238
|
+
/**
|
|
239
|
+
* Creates or enhances a card view.
|
|
240
|
+
* @param {Element|string|null} [target=null] Existing root, selector, or null.
|
|
241
|
+
* @param {CardViewOptions & RecordViewOptions} [options={}] Card and shared view options.
|
|
242
|
+
*/
|
|
243
|
+
constructor(target?: Element | string | null, options?: CardViewOptions & RecordViewOptions);
|
|
244
|
+
/** @returns {HTMLElement} Card-view root. */
|
|
245
|
+
render(): HTMLElement;
|
|
246
|
+
/** Returns shared plus CardView configuration, never records or rendered values. @returns {CardViewState} */
|
|
247
|
+
getViewState(): CardViewState;
|
|
248
|
+
/**
|
|
249
|
+
* Restores shared and CardView configuration. Unknown shared fields reconcile in RecordView.
|
|
250
|
+
* @param {Partial<CardViewState>|null} state Saved JSON-safe state.
|
|
251
|
+
* @param {{silent?:boolean}} [options={}] Event behavior.
|
|
252
|
+
* @returns {this}
|
|
253
|
+
*/
|
|
254
|
+
setViewState(state: Partial<CardViewState> | null, options?: {
|
|
255
|
+
silent?: boolean;
|
|
256
|
+
}): this;
|
|
257
|
+
/** Restores an enhanced target exactly, or removes an owned root. @returns {void} */
|
|
258
|
+
destroy(): void;
|
|
259
|
+
/** @protected @param {string} reason Refresh reason. @returns {void} */
|
|
260
|
+
protected _refreshView(reason: string): void;
|
|
261
|
+
/** @private @returns {void} */
|
|
262
|
+
private _applyCardLayout;
|
|
263
|
+
/** @private @returns {void} */
|
|
264
|
+
private _renderCardSort;
|
|
265
|
+
/** @private @returns {void} */
|
|
266
|
+
private _changeCardSort;
|
|
267
|
+
/** @private @returns {void} */
|
|
268
|
+
private _renderCards;
|
|
269
|
+
/** @private @param {CardRecordGroup} group @param {ViewField[]} fields @param {ViewField[]} visibleFields @param {number} groupIndex @returns {HTMLElement} */
|
|
270
|
+
private _createCardGroup;
|
|
271
|
+
/** @private @returns {HTMLElement} */
|
|
272
|
+
private _createCardSkeletons;
|
|
273
|
+
/** @private @returns {HTMLElement} */
|
|
274
|
+
private _createCardEmpty;
|
|
275
|
+
/** @private @returns {void} */
|
|
276
|
+
private _syncCardSelection;
|
|
277
|
+
/** @private @param {MouseEvent} event @returns {void} */
|
|
278
|
+
private _cardClick;
|
|
279
|
+
/** @private @param {MouseEvent} event @returns {void} */
|
|
280
|
+
private _cardDoubleClick;
|
|
281
|
+
/** @private @param {KeyboardEvent} event @returns {void} */
|
|
282
|
+
private _cardKeydown;
|
|
283
|
+
/** @private @param {ViewRecord} record @param {unknown} id @param {number} index @param {Event} event @returns {void} */
|
|
284
|
+
private _activateCard;
|
|
285
|
+
/** @private @param {ViewRecord} record @param {unknown} id @param {number} index @param {string|undefined} actionId @param {MouseEvent} event @returns {void} */
|
|
286
|
+
private _activateCardAction;
|
|
287
|
+
/** @private @param {Event} event @returns {void} */
|
|
288
|
+
private _cardPreviewError;
|
|
289
|
+
/** @private @returns {Readonly<CardViewOptions & RecordViewOptions>} */
|
|
290
|
+
private _cardOptions;
|
|
291
|
+
}
|
|
292
|
+
/**
|
|
293
|
+
* Groups a cloned record list without mutating records or caller arrays. Explicit order entries
|
|
294
|
+
* are always materialized, including empty groups; remaining values keep first-seen order.
|
|
295
|
+
* @param {ViewRecord[]} records Records in display order.
|
|
296
|
+
* @param {CardViewOptions['groupBy']} groupBy Group field or resolver.
|
|
297
|
+
* @param {unknown[]} [groupOrder=[]] Preferred group ids.
|
|
298
|
+
* @param {ViewField[]} [fields=[]] Complete fields for accessor-aware grouping.
|
|
299
|
+
* @returns {CardRecordGroup[]} Deterministic groups.
|
|
300
|
+
*/
|
|
301
|
+
export declare function groupCardRecords(records: ViewRecord[], groupBy: CardViewOptions['groupBy'], groupOrder?: unknown[], fields?: ViewField[]): CardRecordGroup[];
|
|
302
|
+
/** @param {unknown} value @returns {string} */
|
|
303
|
+
export declare function normalizeCardWidth(value: unknown): string;
|
|
@@ -0,0 +1,242 @@
|
|
|
1
|
+
export type ViewRecord = Record<string, any>;
|
|
2
|
+
export type ViewField = import('../view/record-view.js').ViewField;
|
|
3
|
+
export type RecordCardValueSource = string | ((record: ViewRecord, index: number) => unknown) | null;
|
|
4
|
+
export type RecordCardPreviewDescriptor = {
|
|
5
|
+
/**
|
|
6
|
+
* Image URL.
|
|
7
|
+
*/
|
|
8
|
+
src: string;
|
|
9
|
+
/**
|
|
10
|
+
* Image alternative text.
|
|
11
|
+
*/
|
|
12
|
+
alt?: string;
|
|
13
|
+
/**
|
|
14
|
+
* Image fitting behavior.
|
|
15
|
+
*/
|
|
16
|
+
fit?: 'cover' | 'contain' | 'fill' | 'none' | 'scale-down';
|
|
17
|
+
};
|
|
18
|
+
export type RecordCardPreview = string | Node | RecordCardPreviewDescriptor | null;
|
|
19
|
+
export type RecordCardLinkDescriptor = {
|
|
20
|
+
/**
|
|
21
|
+
* Native link destination.
|
|
22
|
+
*/
|
|
23
|
+
href: string;
|
|
24
|
+
/**
|
|
25
|
+
* Native browsing context.
|
|
26
|
+
*/
|
|
27
|
+
target?: string;
|
|
28
|
+
/**
|
|
29
|
+
* Native link relationship.
|
|
30
|
+
*/
|
|
31
|
+
rel?: string;
|
|
32
|
+
};
|
|
33
|
+
export type RecordCardLink = string | RecordCardLinkDescriptor | null;
|
|
34
|
+
export type RecordCardAction = {
|
|
35
|
+
/**
|
|
36
|
+
* Stable delegated-action identifier.
|
|
37
|
+
*/
|
|
38
|
+
id: string;
|
|
39
|
+
/**
|
|
40
|
+
* Visible action label.
|
|
41
|
+
*/
|
|
42
|
+
label?: string;
|
|
43
|
+
/**
|
|
44
|
+
* Optional Zx icon name.
|
|
45
|
+
*/
|
|
46
|
+
icon?: string | null;
|
|
47
|
+
/**
|
|
48
|
+
* Accessible/native title, especially for an icon-only action.
|
|
49
|
+
*/
|
|
50
|
+
title?: string;
|
|
51
|
+
/**
|
|
52
|
+
* Optional safe native link destination; otherwise a button is rendered.
|
|
53
|
+
*/
|
|
54
|
+
href?: string;
|
|
55
|
+
/**
|
|
56
|
+
* Native link browsing context.
|
|
57
|
+
*/
|
|
58
|
+
target?: string;
|
|
59
|
+
/**
|
|
60
|
+
* Native link relationship.
|
|
61
|
+
*/
|
|
62
|
+
rel?: string;
|
|
63
|
+
/**
|
|
64
|
+
* Whether a button action is unavailable.
|
|
65
|
+
*/
|
|
66
|
+
disabled?: boolean;
|
|
67
|
+
/**
|
|
68
|
+
* Callback invoked by an owning view's delegated listener; this helper never installs listeners.
|
|
69
|
+
*/
|
|
70
|
+
onclick?: (record: ViewRecord, index: number, event: MouseEvent) => void;
|
|
71
|
+
};
|
|
72
|
+
export type RecordCardOptions = {
|
|
73
|
+
/**
|
|
74
|
+
* Complete fields, used to resolve title and subtitle sources.
|
|
75
|
+
*/
|
|
76
|
+
fields?: ViewField[];
|
|
77
|
+
/**
|
|
78
|
+
* Ordered fields rendered as labelled metadata.
|
|
79
|
+
*/
|
|
80
|
+
visibleFields?: ViewField[];
|
|
81
|
+
/**
|
|
82
|
+
* Field id or explicit value resolver.
|
|
83
|
+
*/
|
|
84
|
+
titleField?: RecordCardValueSource;
|
|
85
|
+
/**
|
|
86
|
+
* Field id or explicit value resolver.
|
|
87
|
+
*/
|
|
88
|
+
subtitleField?: RecordCardValueSource;
|
|
89
|
+
/**
|
|
90
|
+
* Preview field id or explicit resolver.
|
|
91
|
+
*/
|
|
92
|
+
preview?: string | ((record: ViewRecord, index: number) => RecordCardPreview);
|
|
93
|
+
/**
|
|
94
|
+
* Alternative-text field, literal text, or resolver.
|
|
95
|
+
*/
|
|
96
|
+
previewAlt?: string | ((record: ViewRecord, index: number) => unknown) | null;
|
|
97
|
+
link?: RecordCardLink | ((record: ViewRecord, index: number) => RecordCardLink);
|
|
98
|
+
actions?: RecordCardAction[] | ((record: ViewRecord, index: number) => RecordCardAction[]);
|
|
99
|
+
/**
|
|
100
|
+
* Selection presentation.
|
|
101
|
+
*/
|
|
102
|
+
selectable?: false | 'single' | 'multi';
|
|
103
|
+
/**
|
|
104
|
+
* Current selection state.
|
|
105
|
+
*/
|
|
106
|
+
selected?: boolean;
|
|
107
|
+
/**
|
|
108
|
+
* Surface treatment.
|
|
109
|
+
*/
|
|
110
|
+
variant?: 'outlined' | 'raised' | 'filled';
|
|
111
|
+
/**
|
|
112
|
+
* Card title heading level.
|
|
113
|
+
*/
|
|
114
|
+
headingLevel?: 1 | 2 | 3 | 4 | 5 | 6;
|
|
115
|
+
/**
|
|
116
|
+
* Listener-free, owner-created controls such as a move handle.
|
|
117
|
+
*/
|
|
118
|
+
controls?: Node[];
|
|
119
|
+
};
|
|
120
|
+
export type ResolvedRecordPreview = {
|
|
121
|
+
/**
|
|
122
|
+
* Explicit preview node.
|
|
123
|
+
*/
|
|
124
|
+
node: Node | null;
|
|
125
|
+
/**
|
|
126
|
+
* Safe image URL, or null when rejected.
|
|
127
|
+
*/
|
|
128
|
+
src: string | null;
|
|
129
|
+
/**
|
|
130
|
+
* Alternative text.
|
|
131
|
+
*/
|
|
132
|
+
alt: string;
|
|
133
|
+
/**
|
|
134
|
+
* Image fitting behavior.
|
|
135
|
+
*/
|
|
136
|
+
fit: 'cover' | 'contain' | 'fill' | 'none' | 'scale-down';
|
|
137
|
+
/**
|
|
138
|
+
* Whether a supplied URL was unsafe or malformed.
|
|
139
|
+
*/
|
|
140
|
+
rejected: boolean;
|
|
141
|
+
};
|
|
142
|
+
/** @typedef {Record<string, any>} ViewRecord */
|
|
143
|
+
/** @typedef {import('../view/record-view.js').ViewField} ViewField */
|
|
144
|
+
/** @typedef {string|((record:ViewRecord,index:number)=>unknown)|null} RecordCardValueSource */
|
|
145
|
+
/**
|
|
146
|
+
* @typedef {Object} RecordCardPreviewDescriptor
|
|
147
|
+
* @property {string} src Image URL.
|
|
148
|
+
* @property {string} [alt] Image alternative text.
|
|
149
|
+
* @property {'cover'|'contain'|'fill'|'none'|'scale-down'} [fit='cover'] Image fitting behavior.
|
|
150
|
+
*/
|
|
151
|
+
/** @typedef {string|Node|RecordCardPreviewDescriptor|null} RecordCardPreview */
|
|
152
|
+
/**
|
|
153
|
+
* @typedef {Object} RecordCardLinkDescriptor
|
|
154
|
+
* @property {string} href Native link destination.
|
|
155
|
+
* @property {string} [target] Native browsing context.
|
|
156
|
+
* @property {string} [rel] Native link relationship.
|
|
157
|
+
*/
|
|
158
|
+
/** @typedef {string|RecordCardLinkDescriptor|null} RecordCardLink */
|
|
159
|
+
/**
|
|
160
|
+
* @typedef {Object} RecordCardAction
|
|
161
|
+
* @property {string} id Stable delegated-action identifier.
|
|
162
|
+
* @property {string} [label=''] Visible action label.
|
|
163
|
+
* @property {string|null} [icon=null] Optional Zx icon name.
|
|
164
|
+
* @property {string} [title] Accessible/native title, especially for an icon-only action.
|
|
165
|
+
* @property {string} [href] Optional safe native link destination; otherwise a button is rendered.
|
|
166
|
+
* @property {string} [target] Native link browsing context.
|
|
167
|
+
* @property {string} [rel] Native link relationship.
|
|
168
|
+
* @property {boolean} [disabled=false] Whether a button action is unavailable.
|
|
169
|
+
* @property {(record:ViewRecord,index:number,event:MouseEvent)=>void} [onclick]
|
|
170
|
+
* Callback invoked by an owning view's delegated listener; this helper never installs listeners.
|
|
171
|
+
*/
|
|
172
|
+
/**
|
|
173
|
+
* @typedef {Object} RecordCardOptions
|
|
174
|
+
* @property {ViewField[]} [fields=[]] Complete fields, used to resolve title and subtitle sources.
|
|
175
|
+
* @property {ViewField[]} [visibleFields=fields] Ordered fields rendered as labelled metadata.
|
|
176
|
+
* @property {RecordCardValueSource} [titleField=null] Field id or explicit value resolver.
|
|
177
|
+
* @property {RecordCardValueSource} [subtitleField=null] Field id or explicit value resolver.
|
|
178
|
+
* @property {string|((record:ViewRecord,index:number)=>RecordCardPreview)} [preview]
|
|
179
|
+
* Preview field id or explicit resolver.
|
|
180
|
+
* @property {string|((record:ViewRecord,index:number)=>unknown)|null} [previewAlt=null]
|
|
181
|
+
* Alternative-text field, literal text, or resolver.
|
|
182
|
+
* @property {RecordCardLink|((record:ViewRecord,index:number)=>RecordCardLink)} [link]
|
|
183
|
+
* @property {RecordCardAction[]|((record:ViewRecord,index:number)=>RecordCardAction[])} [actions=[]]
|
|
184
|
+
* @property {false|'single'|'multi'} [selectable=false] Selection presentation.
|
|
185
|
+
* @property {boolean} [selected=false] Current selection state.
|
|
186
|
+
* @property {'outlined'|'raised'|'filled'} [variant='outlined'] Surface treatment.
|
|
187
|
+
* @property {1|2|3|4|5|6} [headingLevel=3] Card title heading level.
|
|
188
|
+
* @property {Node[]} [controls=[]] Listener-free, owner-created controls such as a move handle.
|
|
189
|
+
*/
|
|
190
|
+
/**
|
|
191
|
+
* @typedef {Object} ResolvedRecordPreview
|
|
192
|
+
* @property {Node|null} node Explicit preview node.
|
|
193
|
+
* @property {string|null} src Safe image URL, or null when rejected.
|
|
194
|
+
* @property {string} alt Alternative text.
|
|
195
|
+
* @property {'cover'|'contain'|'fill'|'none'|'scale-down'} fit Image fitting behavior.
|
|
196
|
+
* @property {boolean} rejected Whether a supplied URL was unsafe or malformed.
|
|
197
|
+
*/
|
|
198
|
+
/**
|
|
199
|
+
* Builds the listener-free card anatomy shared by CardView and KanbanView. All primitive content
|
|
200
|
+
* becomes text, URLs are normalized before reaching native attributes, and actions expose stable
|
|
201
|
+
* data attributes for a component-owned delegated listener.
|
|
202
|
+
*
|
|
203
|
+
* The returned `<li>` belongs in a semantic `<ul>`/`<ol>`. When selectable it carries
|
|
204
|
+
* `aria-selected`; multi-selection adds a native checkbox. It deliberately retains list-item
|
|
205
|
+
* semantics rather than becoming an ARIA option because cards may contain native links and
|
|
206
|
+
* buttons, which the listbox pattern does not permit inside an option. Preview images are paired
|
|
207
|
+
* with a stable fallback. The owning component listens for image `error` and marks the fallback.
|
|
208
|
+
*
|
|
209
|
+
* @param {ViewRecord} record Record to render.
|
|
210
|
+
* @param {number} index Current display index.
|
|
211
|
+
* @param {RecordCardOptions} [options={}] Rendering options.
|
|
212
|
+
* @returns {HTMLLIElement} Semantic record card list item.
|
|
213
|
+
*/
|
|
214
|
+
export declare function createRecordCard(record: ViewRecord, index: number, options?: RecordCardOptions): HTMLLIElement;
|
|
215
|
+
/**
|
|
216
|
+
* Resolves a preview without touching the DOM. Unsafe, malformed, and non-image URL schemes are
|
|
217
|
+
* rejected into the same descriptor shape so callers can still render the stable fallback.
|
|
218
|
+
* @param {ViewRecord} record Record.
|
|
219
|
+
* @param {number} index Display index.
|
|
220
|
+
* @param {RecordCardOptions['preview']} preview Preview field or resolver.
|
|
221
|
+
* @param {RecordCardOptions['previewAlt']} previewAlt Alt field, literal, or resolver.
|
|
222
|
+
* @param {ViewField[]} [fields=[]] Complete fields.
|
|
223
|
+
* @returns {ResolvedRecordPreview|null} Resolved preview.
|
|
224
|
+
*/
|
|
225
|
+
export declare function resolveRecordPreview(record: ViewRecord, index: number, preview: RecordCardOptions['preview'], previewAlt: RecordCardOptions['previewAlt'], fields?: ViewField[]): ResolvedRecordPreview | null;
|
|
226
|
+
/**
|
|
227
|
+
* Resolves and validates a native title link without touching the DOM.
|
|
228
|
+
* @param {ViewRecord} record Record.
|
|
229
|
+
* @param {number} index Display index.
|
|
230
|
+
* @param {RecordCardOptions['link']} link Link value or resolver.
|
|
231
|
+
* @returns {RecordCardLinkDescriptor|null} Safe normalized link.
|
|
232
|
+
*/
|
|
233
|
+
export declare function resolveRecordLink(record: ViewRecord, index: number, link: RecordCardOptions['link']): RecordCardLinkDescriptor | null;
|
|
234
|
+
/**
|
|
235
|
+
* Resolves and clones delegated action descriptors. Invalid entries are omitted rather than
|
|
236
|
+
* creating unnamed or ambiguously interactive controls.
|
|
237
|
+
* @param {ViewRecord} record Record.
|
|
238
|
+
* @param {number} index Display index.
|
|
239
|
+
* @param {RecordCardOptions['actions']} actions Actions or resolver.
|
|
240
|
+
* @returns {RecordCardAction[]} Normalized action copies.
|
|
241
|
+
*/
|
|
242
|
+
export declare function resolveRecordActions(record: ViewRecord, index: number, actions: RecordCardOptions['actions']): RecordCardAction[];
|