@yoyaflow/yoya-ui 0.1.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.
@@ -0,0 +1,518 @@
1
+ import type {
2
+ ChildInput,
3
+ ElementFactory,
4
+ ElementOptions,
5
+ SetupCallback,
6
+ SetupInput,
7
+ ViewNode
8
+ } from './core.js';
9
+ import type { HtmlElementNode } from './html.js';
10
+
11
+ // ---------------------------------------------------------------------------
12
+ // Avatar / Badge / Card / Code
13
+ // ---------------------------------------------------------------------------
14
+
15
+ export class VAvatar extends HtmlElementNode {
16
+ text(value?: ChildInput): this;
17
+ content(value: ChildInput): VAvatar;
18
+ icon(value: ChildInput): VAvatar;
19
+ src(value: string): VAvatar;
20
+ alt(value: string): VAvatar;
21
+ size(): number | string;
22
+ size(value: number | string): VAvatar;
23
+ shape(): string;
24
+ shape(value: 'circle' | 'square' | string): VAvatar;
25
+ color(value: string): VAvatar;
26
+ status(value: string): VAvatar;
27
+ }
28
+
29
+ export class VBadge extends HtmlElementNode {
30
+ child(...children: ChildInput[]): this;
31
+ content(value: ChildInput): VBadge;
32
+ count(): number;
33
+ count(value: number): VBadge;
34
+ overflowCount(): number;
35
+ overflowCount(value: number): VBadge;
36
+ showZero(value: boolean): VBadge;
37
+ dot(value: boolean): VBadge;
38
+ status(): string;
39
+ status(value: string): VBadge;
40
+ color(value: string): VBadge;
41
+ text(value?: ChildInput): this;
42
+ label(value?: ChildInput): this;
43
+ title(value?: ChildInput): this;
44
+ offset(value: Array<number | string>): VBadge;
45
+ }
46
+
47
+ export class VCard extends HtmlElementNode {}
48
+ export class VCardHeader extends HtmlElementNode {}
49
+ export class VCardBody extends HtmlElementNode {}
50
+ export class VCardFooter extends HtmlElementNode {}
51
+
52
+ export class VCode extends HtmlElementNode {
53
+ content(content: ChildInput): VCode;
54
+ text(content?: ChildInput): this;
55
+ language(value: string): VCode;
56
+ copyable(value?: boolean): VCode;
57
+ copyLabel(value: ChildInput): VCode;
58
+ }
59
+
60
+ export class CodeBlock extends VCode {}
61
+
62
+ // ---------------------------------------------------------------------------
63
+ // Detail / Digital board
64
+ // ---------------------------------------------------------------------------
65
+
66
+ export class VDetail extends HtmlElementNode {
67
+ columns(): number;
68
+ columns(value: number): VDetail;
69
+ column(value: number): VDetail;
70
+ items(value: Array<string | VDetailItem | DetailItemOptions>): VDetail;
71
+ }
72
+
73
+ export interface DetailItemOptions {
74
+ label?: ChildInput;
75
+ value?: ChildInput;
76
+ [key: string]: any;
77
+ }
78
+
79
+ export class VDetailItem extends HtmlElementNode {
80
+ label(content?: ChildInput): this;
81
+ value(content: ChildInput): VDetailItem;
82
+ content(content: ChildInput): VDetailItem;
83
+ }
84
+
85
+ export class VDigitalBoard extends HtmlElementNode {
86
+ columns(): number;
87
+ columns(value: number): VDigitalBoard;
88
+ }
89
+
90
+ export class VDigitalBoardItem extends HtmlElementNode {
91
+ label(content?: ChildInput): this;
92
+ value(content: ChildInput): VDigitalBoardItem;
93
+ unit(content: ChildInput): VDigitalBoardItem;
94
+ trend(): number;
95
+ trend(value: number): VDigitalBoardItem;
96
+ trendUp(value: boolean): VDigitalBoardItem;
97
+ tone(value: string): VDigitalBoardItem;
98
+ icon(content: ChildInput): VDigitalBoardItem;
99
+ }
100
+
101
+ // ---------------------------------------------------------------------------
102
+ // Charts / gauges / stats
103
+ // ---------------------------------------------------------------------------
104
+
105
+ export class VGauge extends HtmlElementNode {
106
+ value(): number;
107
+ value(value: number): VGauge;
108
+ max(): number;
109
+ max(value: number): VGauge;
110
+ unit(content: ChildInput): VGauge;
111
+ tone(value: string): VGauge;
112
+ }
113
+
114
+ export class VRingStat extends HtmlElementNode {
115
+ percent(): number;
116
+ percent(value: number): VRingStat;
117
+ value(): number;
118
+ value(value: number): VRingStat;
119
+ label(content?: ChildInput): this;
120
+ size(): number | string;
121
+ size(value: number | string): VRingStat;
122
+ strokeWidth(): number;
123
+ strokeWidth(value: number): VRingStat;
124
+ tone(value: string): VRingStat;
125
+ }
126
+
127
+ export class VSparkline extends HtmlElementNode {
128
+ data(values?: Array<number>): this;
129
+ fill(value: boolean): VSparkline;
130
+ strokeWidth(value: number): VSparkline;
131
+ tone(value: string): VSparkline;
132
+ }
133
+
134
+ export class VChart extends HtmlElementNode {
135
+ adapter(value: unknown): VChart;
136
+ data(value?: unknown): this;
137
+ options(value: Record<string, unknown>): VChart;
138
+ width(): number;
139
+ width(value: number): VChart;
140
+ height(): number;
141
+ height(value: number): VChart;
142
+ resize(width?: number, height?: number): VChart;
143
+ destroy(): this;
144
+ }
145
+
146
+ // ---------------------------------------------------------------------------
147
+ // Timeline / Trend card
148
+ // ---------------------------------------------------------------------------
149
+
150
+ export class VTimeline extends HtmlElementNode {}
151
+
152
+ export class VTimelineItem extends HtmlElementNode {
153
+ status(): string;
154
+ status(value: string): VTimelineItem;
155
+ title(content?: ChildInput): this;
156
+ time(content?: ChildInput): this;
157
+ content(setup: ChildInput | SetupCallback<HtmlElementNode>): VTimelineItem;
158
+ }
159
+
160
+ export class VTrendCard extends HtmlElementNode {
161
+ title(content?: ChildInput): this;
162
+ value(content: ChildInput): VTrendCard;
163
+ unit(content: ChildInput): VTrendCard;
164
+ delta(value: number): VTrendCard;
165
+ up(value: boolean): VTrendCard;
166
+ data(values?: Array<number>): this;
167
+ tone(value: string): VTrendCard;
168
+ }
169
+
170
+ // ---------------------------------------------------------------------------
171
+ // Carousel / Progress / Pagination / Scroll
172
+ // ---------------------------------------------------------------------------
173
+
174
+ export class VCarousel extends HtmlElementNode {
175
+ slides(value: Array<unknown>, render?: (item: unknown, index: number) => ChildInput): VCarousel;
176
+ items(value: Array<unknown>, render?: (item: unknown, index: number) => ChildInput): VCarousel;
177
+ renderItem(handler: (item: unknown, index: number) => ChildInput): VCarousel;
178
+ active(): number;
179
+ active(value: number): VCarousel;
180
+ goTo(value: number): VCarousel;
181
+ next(): VCarousel;
182
+ prev(): VCarousel;
183
+ loop(value: boolean): VCarousel;
184
+ autoplay(value: boolean): VCarousel;
185
+ start(): VCarousel;
186
+ stop(): VCarousel;
187
+ interval(): number;
188
+ interval(value: number): VCarousel;
189
+ arrows(value: boolean): VCarousel;
190
+ dots(value: boolean): VCarousel;
191
+ height(value: string | number): VCarousel;
192
+ }
193
+
194
+ export class VProgress extends HtmlElementNode {
195
+ value(): number;
196
+ value(value: number): VProgress;
197
+ max(): number;
198
+ max(value: number): VProgress;
199
+ percent(): number;
200
+ percent(value: number): VProgress;
201
+ showText(value: boolean): VProgress;
202
+ label(content?: ChildInput): this;
203
+ text(content?: ChildInput): this;
204
+ format(handler: (percent: number) => ChildInput): VProgress;
205
+ status(): string;
206
+ status(value: string): VProgress;
207
+ size(): string;
208
+ size(value: string): VProgress;
209
+ strokeColor(value: string): VProgress;
210
+ indeterminate(value: boolean): VProgress;
211
+ active(value: boolean): VProgress;
212
+ ariaLabel(content: ChildInput): VProgress;
213
+ }
214
+
215
+ export interface PaginationOptions {
216
+ page?: number;
217
+ pageSize?: number;
218
+ pageSizes?: Array<number | { label: string; value: number }>;
219
+ total?: number;
220
+ totalPages?: number;
221
+ ariaLabel?: ChildInput;
222
+ [key: string]: any;
223
+ }
224
+
225
+ /** Object component returned by vPagination(). */
226
+ export interface PaginationComponent {
227
+ change(): ((page: number, pageSize: number) => void) | null;
228
+ change(handler: ((page: number, pageSize: number) => void) | null): PaginationComponent;
229
+ onChange(handler: ((page: number, pageSize: number) => void) | null): PaginationComponent;
230
+ page(): number;
231
+ page(value: number): PaginationComponent;
232
+ pageSize(): number;
233
+ pageSize(value: number): PaginationComponent;
234
+ pageSizes(): Array<{ label: string; value: number }>;
235
+ pageSizes(value: Array<number | { label: string; value: number }>): PaginationComponent;
236
+ total(): number;
237
+ total(value: number): PaginationComponent;
238
+ totalPages(): number;
239
+ totalPages(value: number): PaginationComponent;
240
+ update(result?: Partial<PaginationOptions>): PaginationComponent;
241
+ render(): HtmlElementNode;
242
+ [key: string]: any;
243
+ }
244
+
245
+ export class VScroll extends HtmlElementNode {
246
+ content(setup: ChildInput | SetupCallback<HtmlElementNode>): VScroll;
247
+ items(value: Array<unknown>, render?: (item: unknown, index: number) => ChildInput): VScroll;
248
+ append(value: Array<unknown>, render?: (item: unknown, index: number) => ChildInput): VScroll;
249
+ renderItem(handler: (item: unknown, index: number) => ChildInput): VScroll;
250
+ loadMore(handler: () => void): VScroll;
251
+ onLoadMore(handler: () => void): VScroll;
252
+ loop(value: boolean): VScroll;
253
+ block(value: boolean): VScroll;
254
+ blocked(value: boolean): VScroll;
255
+ loading(value: boolean): VScroll;
256
+ threshold(): number;
257
+ threshold(value: number): VScroll;
258
+ virtual(value: boolean): VScroll;
259
+ virtualize(value: boolean): VScroll;
260
+ itemHeight(): number;
261
+ itemHeight(value: number): VScroll;
262
+ overscan(): number;
263
+ overscan(value: number): VScroll;
264
+ page(): number;
265
+ page(value: number): VScroll;
266
+ loadingText(content: ChildInput): VScroll;
267
+ endText(content: ChildInput): VScroll;
268
+ reset(): VScroll;
269
+ clear(): VScroll;
270
+ load(): VScroll;
271
+ check(): VScroll;
272
+ }
273
+
274
+ // ---------------------------------------------------------------------------
275
+ // Table
276
+ // ---------------------------------------------------------------------------
277
+
278
+ export interface TableColumn {
279
+ key?: string;
280
+ title?: ChildInput;
281
+ dataIndex?: string;
282
+ render?: (value: unknown, row: Record<string, unknown>, index: number) => ChildInput;
283
+ width?: string | number;
284
+ [key: string]: any;
285
+ }
286
+
287
+ export class VTable extends HtmlElementNode {
288
+ caption(content?: ChildInput): this;
289
+ columns(value: Array<TableColumn>): VTable;
290
+ rows(value: Array<Record<string, unknown>>): VTable;
291
+ empty(value: ChildInput): VTable;
292
+ emptyText(value: ChildInput): VTable;
293
+ data(value?: { columns?: Array<TableColumn>; rows?: Array<Record<string, unknown>> }): this;
294
+ child(...children: ChildInput[]): this;
295
+ vThead(setup: SetupInput<HtmlElementNode>): VTable;
296
+ vTbody(setup: SetupInput<HtmlElementNode>): VTable;
297
+ vTfoot(setup: SetupInput<HtmlElementNode>): VTable;
298
+ vTr(setup: SetupInput<HtmlElementNode>): VTable;
299
+ }
300
+
301
+ export class VThead extends HtmlElementNode {}
302
+ export class VTbody extends HtmlElementNode {}
303
+ export class VTfoot extends HtmlElementNode {}
304
+ export class VTr extends HtmlElementNode {}
305
+ export class VTh extends HtmlElementNode {}
306
+ export class VTd extends HtmlElementNode {}
307
+
308
+ // ---------------------------------------------------------------------------
309
+ // Tree
310
+ // ---------------------------------------------------------------------------
311
+
312
+ export interface TreeNodeOptions {
313
+ id?: string | number;
314
+ key?: string | number;
315
+ label?: ChildInput;
316
+ title?: ChildInput;
317
+ icon?: ChildInput;
318
+ actions?: ChildInput;
319
+ expanded?: boolean;
320
+ expandable?: boolean;
321
+ selected?: boolean;
322
+ checked?: boolean;
323
+ disabled?: boolean;
324
+ children?: Array<TreeNodeOptions>;
325
+ [key: string]: any;
326
+ }
327
+
328
+ export class VTreeNode {
329
+ constructor(setup?: TreeNodeOptions | null);
330
+ id(value: string | number): VTreeNode;
331
+ key(value: string | number): VTreeNode;
332
+ label(value: ChildInput): VTreeNode;
333
+ text(value: ChildInput): VTreeNode;
334
+ content(value: ChildInput): VTreeNode;
335
+ title(value: ChildInput): VTreeNode;
336
+ actions(value: ChildInput): VTreeNode;
337
+ icon(value: ChildInput): VTreeNode;
338
+ expanded(value: boolean): VTreeNode;
339
+ expandable(value: boolean): VTreeNode;
340
+ selected(value: boolean): VTreeNode;
341
+ checked(value: boolean): VTreeNode;
342
+ disabled(value: boolean): VTreeNode;
343
+ toData(): TreeNodeOptions;
344
+ vTreeNode(value: VTreeNode | TreeNodeOptions): VTreeNode;
345
+ node(value: VTreeNode | TreeNodeOptions): VTreeNode;
346
+ child(...children: Array<VTreeNode | TreeNodeOptions>): VTreeNode;
347
+ }
348
+
349
+ export interface TreeOptions {
350
+ nodes?: Array<VTreeNode | TreeNodeOptions>;
351
+ ariaLabel?: ChildInput;
352
+ checkable?: boolean;
353
+ multiple?: boolean;
354
+ selectable?: boolean;
355
+ toggleIcon?: ChildInput;
356
+ emptyText?: ChildInput;
357
+ expandedKeys?: Array<string | number>;
358
+ selectedKeys?: Array<string | number>;
359
+ checkedKeys?: Array<string | number>;
360
+ change?: (keys: { checked: string[]; expanded: string[]; selected: string[] }) => void;
361
+ onSelect?: (id: string | number, node: VTreeNode) => void;
362
+ onToggle?: (id: string | number, node: VTreeNode) => void;
363
+ onCheck?: (id: string | number, checked: boolean, node: VTreeNode) => void;
364
+ [key: string]: any;
365
+ }
366
+
367
+ /** Object component returned by vTree(). */
368
+ export interface TreeComponent {
369
+ change(): ((keys: { checked: string[]; expanded: string[]; selected: string[] }) => void) | null;
370
+ change(
371
+ handler: ((keys: { checked: string[]; expanded: string[]; selected: string[] }) => void) | null
372
+ ): TreeComponent;
373
+ onChange(
374
+ handler: ((keys: { checked: string[]; expanded: string[]; selected: string[] }) => void) | null
375
+ ): TreeComponent;
376
+ checked(id: string | number): boolean;
377
+ checked(id: string | number, value: boolean): TreeComponent;
378
+ checkedKeys(): string[];
379
+ checkedKeys(value: Array<string | number>): TreeComponent;
380
+ check(id: string | number, value?: boolean): TreeComponent;
381
+ checkable(value: boolean): TreeComponent;
382
+ checkAll(value?: boolean): TreeComponent;
383
+ collapseAll(): TreeComponent;
384
+ collapseNode(id: string | number): TreeComponent;
385
+ data(value: Array<VTreeNode | TreeNodeOptions>): TreeComponent;
386
+ emptyText(value: ChildInput): TreeComponent;
387
+ expandAll(): TreeComponent;
388
+ expandedKeys(): string[];
389
+ expandedKeys(value: Array<string | number>): TreeComponent;
390
+ expandNode(id: string | number, value?: boolean): TreeComponent;
391
+ multiple(value: boolean): TreeComponent;
392
+ nodes(value: Array<VTreeNode | TreeNodeOptions>): TreeComponent;
393
+ vTreeNode(setup: VTreeNode | TreeNodeOptions): VTreeNode;
394
+ node(setup: VTreeNode | TreeNodeOptions): VTreeNode;
395
+ addNode(setup: VTreeNode | TreeNodeOptions): VTreeNode;
396
+ onCheck(handler: (id: string | number, checked: boolean, node: VTreeNode) => void): TreeComponent;
397
+ onSelect(handler: (id: string | number, node: VTreeNode) => void): TreeComponent;
398
+ onToggle(handler: (id: string | number, node: VTreeNode) => void): TreeComponent;
399
+ render(): HtmlElementNode;
400
+ select(id: string | number, value?: boolean): TreeComponent;
401
+ selectable(value: boolean): TreeComponent;
402
+ selected(id: string | number): boolean;
403
+ selected(id: string | number, value: boolean): TreeComponent;
404
+ selectedKeys(): string[];
405
+ selectedKeys(value: Array<string | number>): TreeComponent;
406
+ toggleNode(id: string | number): TreeComponent;
407
+ toggleIcon(value: ChildInput, expandedValue?: ChildInput): TreeComponent;
408
+ update(value: Partial<TreeOptions>): TreeComponent;
409
+ destroy(): TreeComponent;
410
+ [key: string]: any;
411
+ }
412
+
413
+ // ---------------------------------------------------------------------------
414
+ // Factories
415
+ // ---------------------------------------------------------------------------
416
+
417
+ export const vAvatar: ElementFactory<VAvatar>;
418
+ export const vBadge: ElementFactory<VBadge>;
419
+ export const vCard: ElementFactory<VCard>;
420
+ export const vCardHeader: ElementFactory<VCardHeader>;
421
+ export const vCardBody: ElementFactory<VCardBody>;
422
+ export const vCardFooter: ElementFactory<VCardFooter>;
423
+ export const vCarousel: ElementFactory<VCarousel>;
424
+ export const vChart: ElementFactory<VChart>;
425
+ export const vCode: ElementFactory<VCode>;
426
+ export const codeBlock: ElementFactory<CodeBlock>;
427
+ export const vDetail: ElementFactory<VDetail>;
428
+ export const vDetailItem: ElementFactory<VDetailItem> & {
429
+ (setup?: SetupInput<VDetailItem> | null, value?: ChildInput): VDetailItem;
430
+ };
431
+ export const vDigitalBoard: ElementFactory<VDigitalBoard>;
432
+ export const vDigitalBoardItem: ElementFactory<VDigitalBoardItem>;
433
+ export const vGauge: ElementFactory<VGauge>;
434
+ export const vPagination: ElementFactory<PaginationComponent> & {
435
+ (
436
+ first?: PaginationOptions | SetupCallback<PaginationComponent> | null,
437
+ callback?: SetupCallback<PaginationComponent>
438
+ ): PaginationComponent;
439
+ };
440
+ export const vProgress: ElementFactory<VProgress>;
441
+ export const vRingStat: ElementFactory<VRingStat>;
442
+ export const vScroll: ElementFactory<VScroll>;
443
+ export const vSparkline: ElementFactory<VSparkline>;
444
+ export const vTable: ElementFactory<VTable>;
445
+ export const vTbody: ElementFactory<VTbody>;
446
+ export const vTd: ElementFactory<VTd>;
447
+ export const vTfoot: ElementFactory<VTfoot>;
448
+ export const vTh: ElementFactory<VTh>;
449
+ export const vThead: ElementFactory<VThead>;
450
+ export const vTr: ElementFactory<VTr>;
451
+ export const vTree: ElementFactory<TreeComponent> & {
452
+ (
453
+ first?: TreeOptions | SetupCallback<TreeComponent> | null,
454
+ callback?: SetupCallback<TreeComponent>
455
+ ): TreeComponent;
456
+ };
457
+ export const vTreeNode: ElementFactory<VTreeNode> & {
458
+ (first?: TreeNodeOptions | SetupCallback<VTreeNode> | null): VTreeNode;
459
+ };
460
+ export const vTimeline: ElementFactory<VTimeline>;
461
+ export const vTimelineItem: ElementFactory<VTimelineItem>;
462
+ export const vTrendCard: ElementFactory<VTrendCard>;
463
+
464
+ /** Parent-shortcut surface merged onto HtmlElementNode. */
465
+ export interface DataDisplayParentShortcuts {
466
+ vAvatar(first?: SetupInput<VAvatar> | null, callback?: SetupCallback<VAvatar>): VAvatar;
467
+ vBadge(first?: SetupInput<VBadge> | null, callback?: SetupCallback<VBadge>): VBadge;
468
+ vCard(first?: SetupInput<VCard> | null, callback?: SetupCallback<VCard>): VCard;
469
+ vCardHeader(
470
+ first?: SetupInput<VCardHeader> | null,
471
+ callback?: SetupCallback<VCardHeader>
472
+ ): VCardHeader;
473
+ vCardBody(first?: SetupInput<VCardBody> | null, callback?: SetupCallback<VCardBody>): VCardBody;
474
+ vCardFooter(
475
+ first?: SetupInput<VCardFooter> | null,
476
+ callback?: SetupCallback<VCardFooter>
477
+ ): VCardFooter;
478
+ vCarousel(first?: SetupInput<VCarousel> | null, callback?: SetupCallback<VCarousel>): VCarousel;
479
+ vCode(first?: SetupInput<VCode> | null, callback?: SetupCallback<VCode>): VCode;
480
+ vDetail(first?: SetupInput<VDetail> | null, callback?: SetupCallback<VDetail>): VDetail;
481
+ vDetailItem(setup?: SetupInput<VDetailItem> | null, value?: ChildInput): VDetailItem;
482
+ vDigitalBoard(
483
+ first?: SetupInput<VDigitalBoard> | null,
484
+ callback?: SetupCallback<VDigitalBoard>
485
+ ): VDigitalBoard;
486
+ vDigitalBoardItem(
487
+ first?: SetupInput<VDigitalBoardItem> | null,
488
+ callback?: SetupCallback<VDigitalBoardItem>
489
+ ): VDigitalBoardItem;
490
+ vGauge(first?: SetupInput<VGauge> | null, callback?: SetupCallback<VGauge>): VGauge;
491
+ vPagination(
492
+ first?: SetupInput<PaginationComponent> | null,
493
+ callback?: SetupCallback<PaginationComponent>
494
+ ): PaginationComponent;
495
+ vProgress(first?: SetupInput<VProgress> | null, callback?: SetupCallback<VProgress>): VProgress;
496
+ vRingStat(first?: SetupInput<VRingStat> | null, callback?: SetupCallback<VRingStat>): VRingStat;
497
+ vScroll(first?: SetupInput<VScroll> | null, callback?: SetupCallback<VScroll>): VScroll;
498
+ vSparkline(
499
+ first?: SetupInput<VSparkline> | null,
500
+ callback?: SetupCallback<VSparkline>
501
+ ): VSparkline;
502
+ vTable(first?: SetupInput<VTable> | null, callback?: SetupCallback<VTable>): VTable;
503
+ vTimeline(first?: SetupInput<VTimeline> | null, callback?: SetupCallback<VTimeline>): VTimeline;
504
+ vTimelineItem(
505
+ first?: SetupInput<VTimelineItem> | null,
506
+ callback?: SetupCallback<VTimelineItem>
507
+ ): VTimelineItem;
508
+ vTrendCard(
509
+ first?: SetupInput<VTrendCard> | null,
510
+ callback?: SetupCallback<VTrendCard>
511
+ ): VTrendCard;
512
+ vTree(
513
+ first?: SetupInput<TreeComponent> | null,
514
+ callback?: SetupCallback<TreeComponent>
515
+ ): TreeComponent;
516
+ }
517
+
518
+ export type { ElementOptions, ViewNode };
@@ -0,0 +1,40 @@
1
+ import type { ElementFactory, ElementOptions, SetupCallback, SetupInput } from './core.js';
2
+ import type { VButton } from './actions.js';
3
+
4
+ export type GlowMotion = 'auto' | 'sweep' | 'pulse' | 'none' | string;
5
+ export type GlowDirection = 'ltr' | 'rtl' | string;
6
+
7
+ export interface GlowOptions {
8
+ auto?: boolean;
9
+ motion?: GlowMotion;
10
+ direction?: GlowDirection;
11
+ speed?: number | string;
12
+ strength?: number | string;
13
+ ripple?: boolean;
14
+ [key: string]: any;
15
+ }
16
+
17
+ /** Button with animated glow and click ripple effects. */
18
+ export class VGlowButton extends VButton {
19
+ glow(options: GlowOptions): VGlowButton;
20
+ play(value: boolean): VGlowButton;
21
+ speed(value: number | string): VGlowButton;
22
+ direction(value: GlowDirection): VGlowButton;
23
+ strength(value: number | string): VGlowButton;
24
+ motion(value: GlowMotion): VGlowButton;
25
+ ripple(value: boolean): VGlowButton;
26
+ }
27
+
28
+ export const vGlowButton: ElementFactory<VGlowButton> & {
29
+ (first?: SetupInput<VGlowButton> | null, callback?: SetupCallback<VGlowButton>): VGlowButton;
30
+ };
31
+
32
+ /** Parent-shortcut surface merged onto HtmlElementNode. */
33
+ export interface EffectsParentShortcuts {
34
+ vGlowButton(
35
+ first?: SetupInput<VGlowButton> | null,
36
+ callback?: SetupCallback<VGlowButton>
37
+ ): VGlowButton;
38
+ }
39
+
40
+ export type { ElementOptions };
@@ -0,0 +1,119 @@
1
+ import type {
2
+ ChildInput,
3
+ ElementFactory,
4
+ ElementOptions,
5
+ SetupCallback,
6
+ SetupInput,
7
+ ViewNode
8
+ } from './core.js';
9
+ import type { HtmlElementNode } from './html.js';
10
+
11
+ export type MessageType = 'success' | 'error' | 'warning' | 'info';
12
+ export type MessagePlacement =
13
+ 'top' | 'top-left' | 'top-right' | 'bottom' | 'bottom-left' | 'bottom-right';
14
+
15
+ export interface MessageOptions {
16
+ duration?: number;
17
+ closable?: boolean;
18
+ type?: MessageType;
19
+ [key: string]: any;
20
+ }
21
+
22
+ /** Modal dialog. */
23
+ export class VDialog extends HtmlElementNode {
24
+ content(value: ChildInput): VDialog;
25
+ open(value?: boolean): VDialog;
26
+ close(): VDialog;
27
+ }
28
+
29
+ /** Single toast/message entry. */
30
+ export class VMessage extends HtmlElementNode {
31
+ content(content: ChildInput): VMessage;
32
+ type(): MessageType;
33
+ type(value: MessageType): VMessage;
34
+ closable(value?: boolean): VMessage;
35
+ countdown(duration: number, enabled?: boolean): VMessage;
36
+ onClose(handler: (message: VMessage) => void): VMessage;
37
+ close(): VMessage;
38
+ }
39
+
40
+ /** Message container that stacks messages. */
41
+ export class VMessageContainer extends HtmlElementNode {
42
+ placement(): MessagePlacement;
43
+ placement(value: MessagePlacement): VMessageContainer;
44
+ inline(value?: boolean): VMessageContainer;
45
+ show(content: ChildInput, options?: MessageOptions): VMessage;
46
+ success(content: ChildInput, options?: MessageOptions): VMessage;
47
+ error(content: ChildInput, options?: MessageOptions): VMessage;
48
+ warning(content: ChildInput, options?: MessageOptions): VMessage;
49
+ info(content: ChildInput, options?: MessageOptions): VMessage;
50
+ close(id: unknown): VMessageContainer;
51
+ clear(): VMessageContainer;
52
+ }
53
+
54
+ /** Owns an explicitly bound message container and its lifecycle. */
55
+ export class VMessageManager extends ViewNode {
56
+ constructor(setup?: VMessageContainer | { container: VMessageContainer } | null);
57
+ container(): VMessageContainer;
58
+ bindTo(target: string | ParentNode): this;
59
+ renderDom(): Node | null;
60
+ toHTML(): string;
61
+ show(content: ChildInput, options?: MessageOptions): VMessage | null;
62
+ success(content: ChildInput, options?: MessageOptions): VMessage | null;
63
+ error(content: ChildInput, options?: MessageOptions): VMessage | null;
64
+ warning(content: ChildInput, options?: MessageOptions): VMessage | null;
65
+ info(content: ChildInput, options?: MessageOptions): VMessage | null;
66
+ close(id: unknown): VMessageManager;
67
+ clear(): VMessageManager;
68
+ }
69
+
70
+ /** Tooltip anchored to a target. */
71
+ export class VTooltip extends HtmlElementNode {
72
+ target(setup: SetupInput<HtmlElementNode>): VTooltip;
73
+ content(setup: SetupInput<HtmlElementNode>): VTooltip;
74
+ placement(): string;
75
+ placement(value: string): VTooltip;
76
+ trigger(): 'hover' | 'focus' | 'click' | 'manual';
77
+ trigger(value: string): VTooltip;
78
+ open(value?: boolean): VTooltip;
79
+ close(): VTooltip;
80
+ toggle(): VTooltip;
81
+ }
82
+
83
+ /** Default toast singleton. */
84
+ export const toast: {
85
+ use(container: VMessageContainer): typeof toast;
86
+ container(): VMessageContainer;
87
+ show(content: ChildInput, options?: MessageOptions): VMessage;
88
+ success(content: ChildInput, options?: MessageOptions): VMessage;
89
+ error(content: ChildInput, options?: MessageOptions): VMessage;
90
+ warning(content: ChildInput, options?: MessageOptions): VMessage;
91
+ info(content: ChildInput, options?: MessageOptions): VMessage;
92
+ close(id: unknown): VMessageContainer;
93
+ clear(): VMessageContainer;
94
+ };
95
+
96
+ export const vDialog: ElementFactory<VDialog>;
97
+ export const vMessage: ElementFactory<VMessage>;
98
+ export const vMessageContainer: ElementFactory<VMessageContainer>;
99
+ export const vTooltip: ElementFactory<VTooltip>;
100
+ export const vMessageManager: ElementFactory<VMessageManager> & {
101
+ (
102
+ first?:
103
+ VMessageContainer | { container: VMessageContainer } | SetupInput<VMessageManager> | null,
104
+ callback?: SetupCallback<VMessageManager>
105
+ ): VMessageManager;
106
+ };
107
+
108
+ /** Parent-shortcut surface merged onto HtmlElementNode. */
109
+ export interface FeedbackParentShortcuts {
110
+ vDialog(first?: SetupInput<VDialog> | null, callback?: SetupCallback<VDialog>): VDialog;
111
+ vMessage(first?: SetupInput<VMessage> | null, callback?: SetupCallback<VMessage>): VMessage;
112
+ vMessageContainer(
113
+ first?: SetupInput<VMessageContainer> | null,
114
+ callback?: SetupCallback<VMessageContainer>
115
+ ): VMessageContainer;
116
+ vTooltip(first?: SetupInput<VTooltip> | null, callback?: SetupCallback<VTooltip>): VTooltip;
117
+ }
118
+
119
+ export type { ElementOptions };