flet-box 1.0.3 → 1.0.4
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/package.json +3 -2
- package/src/animations/AnimatedBox.js +32 -1
- package/src/animations/AnimatedText.js +7 -3
- package/src/animations/MatrixRain.js +37 -12
- package/src/animations/ParallaxBox.js +16 -3
- package/src/animations/animate.js +22 -3
- package/src/core/runApp.js +13 -1
- package/src/index.d.ts +191 -78
- package/src/navigations/AppBar.js +8 -2
- package/src/navigations/BottomNavigation.js +14 -2
- package/src/navigations/DrawerItem.js +16 -3
- package/src/navigations/Scaffold.js +8 -1
- package/src/navigations/Tabs.js +34 -6
- package/src/tools/dimensions.js +11 -3
- package/src/tools/useState.js +115 -68
- package/src/utils/getWidgetProps.js +5 -3
- package/src/widget-factory/assignProps.js +7 -10
- package/src/widget-factory/processProps.js +7 -2
- package/src/widget-factory/reactiveValue.js +147 -0
- package/src/widget-factory/warnings.js +15 -0
- package/src/widget-factory/widgetFactory.js +27 -0
- package/src/widgets/Accordion.js +6 -5
- package/src/widgets/Audio.js +30 -8
- package/src/widgets/BottomSheet.js +24 -1
- package/src/widgets/Chart.js +4 -1
- package/src/widgets/Checkbox.js +7 -1
- package/src/widgets/CircularChart.js +4 -1
- package/src/widgets/CodeViewer.js +26 -8
- package/src/widgets/DataTable.js +11 -2
- package/src/widgets/Dropdown.js +5 -1
- package/src/widgets/Image.js +8 -1
- package/src/widgets/Input.js +27 -6
- package/src/widgets/Inspector.js +16 -10
- package/src/widgets/ListView.js +7 -1
- package/src/widgets/Markdown.js +53 -8
- package/src/widgets/Modal.js +24 -1
- package/src/widgets/QRCode.js +9 -2
- package/src/widgets/Radio.js +5 -1
- package/src/widgets/Slider.js +3 -0
- package/src/widgets/SnackBar.js +20 -2
- package/src/widgets/Switch.js +5 -1
- package/src/widgets/TreeView.js +3 -1
package/src/index.d.ts
CHANGED
|
@@ -5,16 +5,35 @@ declare module 'flet-box' {
|
|
|
5
5
|
// =========================================================================
|
|
6
6
|
// Tipos base
|
|
7
7
|
// =========================================================================
|
|
8
|
-
type Widget = HTMLElement;
|
|
9
|
-
type Color = string;
|
|
10
|
-
type Size = number | string;
|
|
11
|
-
type Padding = number | string;
|
|
12
|
-
type Margin = number | string;
|
|
8
|
+
export type Widget = HTMLElement;
|
|
9
|
+
export type Color = string;
|
|
10
|
+
export type Size = number | string;
|
|
11
|
+
export type Padding = number | string;
|
|
12
|
+
export type Margin = number | string;
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* The element returned by `WidgetFactory()`. It is a real `HTMLElement` with
|
|
16
|
+
* the factory's imperative API attached (see `src/widget-factory/`).
|
|
17
|
+
*/
|
|
18
|
+
export interface WidgetFactoryInstance extends Widget {
|
|
19
|
+
/** Merge new props and re-apply styles, attributes, children and effects. */
|
|
20
|
+
update(props?: Record<string, any>): WidgetFactoryInstance;
|
|
21
|
+
/** Shallow copy of the widget's currently stored props. */
|
|
22
|
+
getProps(): Record<string, any>;
|
|
23
|
+
/** Register a callback fired when the widget enters the live DOM. */
|
|
24
|
+
onMount(fn: (widget: WidgetFactoryInstance) => void): void;
|
|
25
|
+
/** Register a disposer fired on every teardown path. Must be idempotent. */
|
|
26
|
+
onUnmount(fn: (widget: WidgetFactoryInstance) => void): void;
|
|
27
|
+
/** Fire mount callbacks immediately when the widget is already connected. */
|
|
28
|
+
triggerMount(): WidgetFactoryInstance;
|
|
29
|
+
/** Release the widget's resources and remove it from the lifecycle registry. */
|
|
30
|
+
_cleanup(): void;
|
|
31
|
+
}
|
|
13
32
|
|
|
14
33
|
// =========================================================================
|
|
15
34
|
// Props comunes (heredadas by todos the widgets)
|
|
16
35
|
// =========================================================================
|
|
17
|
-
interface CommonProps {
|
|
36
|
+
export interface CommonProps {
|
|
18
37
|
width?: Size;
|
|
19
38
|
height?: Size;
|
|
20
39
|
size?: number;
|
|
@@ -120,10 +139,66 @@ declare module 'flet-box' {
|
|
|
120
139
|
export function httpPatch<T = any>(url: string, options?: HttpRequestOptions): Promise<T>;
|
|
121
140
|
export function httpDelete<T = any>(url: string, options?: HttpRequestOptions): Promise<T>;
|
|
122
141
|
|
|
142
|
+
// =========================================================================
|
|
143
|
+
// Service namespaces
|
|
144
|
+
// =========================================================================
|
|
145
|
+
// Each store is also exported as a namespace object whose members are exactly
|
|
146
|
+
// the functions above, so both call styles are valid:
|
|
147
|
+
// saveRam("k", 1) | RamStore.saveRam("k", 1)
|
|
148
|
+
// Members are typed through `typeof` so a namespace can never drift from the
|
|
149
|
+
// individual declaration.
|
|
150
|
+
export const RamStore: {
|
|
151
|
+
saveRam: typeof saveRam;
|
|
152
|
+
getRam: typeof getRam;
|
|
153
|
+
getAllRam: typeof getAllRam;
|
|
154
|
+
getAllRamKeys: typeof getAllRamKeys;
|
|
155
|
+
hasRam: typeof hasRam;
|
|
156
|
+
updateRam: typeof updateRam;
|
|
157
|
+
deleteRam: typeof deleteRam;
|
|
158
|
+
clearAllRam: typeof clearAllRam;
|
|
159
|
+
subscribeRam: typeof subscribeRam;
|
|
160
|
+
getRamItemCount: typeof getRamItemCount;
|
|
161
|
+
isRamAvailable: typeof isRamAvailable;
|
|
162
|
+
};
|
|
163
|
+
|
|
164
|
+
export const Session: {
|
|
165
|
+
saveSession: typeof saveSession;
|
|
166
|
+
getSession: typeof getSession;
|
|
167
|
+
getSessionSync: typeof getSessionSync;
|
|
168
|
+
updateSession: typeof updateSession;
|
|
169
|
+
deleteSession: typeof deleteSession;
|
|
170
|
+
clearAllSession: typeof clearAllSession;
|
|
171
|
+
hasSession: typeof hasSession;
|
|
172
|
+
getAllSessionKeys: typeof getAllSessionKeys;
|
|
173
|
+
getAllSessionData: typeof getAllSessionData;
|
|
174
|
+
getSessionSize: typeof getSessionSize;
|
|
175
|
+
deleteSessionByPrefix: typeof deleteSessionByPrefix;
|
|
176
|
+
deleteSessionBySuffix: typeof deleteSessionBySuffix;
|
|
177
|
+
getSessionItemCount: typeof getSessionItemCount;
|
|
178
|
+
isSessionAvailable: typeof isSessionAvailable;
|
|
179
|
+
};
|
|
180
|
+
|
|
181
|
+
export const Storage: {
|
|
182
|
+
saveData: typeof saveData;
|
|
183
|
+
getData: typeof getData;
|
|
184
|
+
getDataSync: typeof getDataSync;
|
|
185
|
+
updateData: typeof updateData;
|
|
186
|
+
deleteData: typeof deleteData;
|
|
187
|
+
clearAllData: typeof clearAllData;
|
|
188
|
+
hasData: typeof hasData;
|
|
189
|
+
getAllKeys: typeof getAllKeys;
|
|
190
|
+
getAllData: typeof getAllData;
|
|
191
|
+
getStorageSize: typeof getStorageSize;
|
|
192
|
+
deleteDataByPrefix: typeof deleteDataByPrefix;
|
|
193
|
+
deleteDataBySuffix: typeof deleteDataBySuffix;
|
|
194
|
+
getItemCount: typeof getItemCount;
|
|
195
|
+
isStorageAvailable: typeof isStorageAvailable;
|
|
196
|
+
};
|
|
197
|
+
|
|
123
198
|
// =========================================================================
|
|
124
199
|
// Layouts
|
|
125
200
|
// =========================================================================
|
|
126
|
-
interface ContainerProps extends CommonProps {
|
|
201
|
+
export interface ContainerProps extends CommonProps {
|
|
127
202
|
direction?: 'row' | 'column';
|
|
128
203
|
gap?: number | string;
|
|
129
204
|
justifyContent?: 'flex-start' | 'center' | 'flex-end' | 'space-between' | 'space-around' | 'space-evenly';
|
|
@@ -141,7 +216,7 @@ declare module 'flet-box' {
|
|
|
141
216
|
}
|
|
142
217
|
export function Container(props: ContainerProps): Widget;
|
|
143
218
|
|
|
144
|
-
interface RowProps extends CommonProps {
|
|
219
|
+
export interface RowProps extends CommonProps {
|
|
145
220
|
gap?: number | string;
|
|
146
221
|
justifyContent?: ContainerProps['justifyContent'];
|
|
147
222
|
alignItems?: ContainerProps['alignItems'];
|
|
@@ -151,7 +226,7 @@ declare module 'flet-box' {
|
|
|
151
226
|
}
|
|
152
227
|
export function Row(props: RowProps): Widget;
|
|
153
228
|
|
|
154
|
-
interface ColumnProps extends CommonProps {
|
|
229
|
+
export interface ColumnProps extends CommonProps {
|
|
155
230
|
gap?: number | string;
|
|
156
231
|
justifyContent?: ContainerProps['justifyContent'];
|
|
157
232
|
alignItems?: ContainerProps['alignItems'];
|
|
@@ -160,14 +235,14 @@ declare module 'flet-box' {
|
|
|
160
235
|
}
|
|
161
236
|
export function Column(props: ColumnProps): Widget;
|
|
162
237
|
|
|
163
|
-
interface StackProps extends CommonProps {
|
|
238
|
+
export interface StackProps extends CommonProps {
|
|
164
239
|
children?: Widget[];
|
|
165
240
|
position?: 'relative' | 'absolute';
|
|
166
241
|
alignment?: 'top-left' | 'top-center' | 'top-right' | 'center-left' | 'center' | 'center-right' | 'bottom-left' | 'bottom-center' | 'bottom-right';
|
|
167
242
|
}
|
|
168
243
|
export function Stack(props: StackProps): Widget;
|
|
169
244
|
|
|
170
|
-
interface ListViewProps extends CommonProps {
|
|
245
|
+
export interface ListViewProps extends CommonProps {
|
|
171
246
|
data?: any[];
|
|
172
247
|
renderItem?: (item: any, index: number) => Widget;
|
|
173
248
|
height?: number | string;
|
|
@@ -195,7 +270,7 @@ declare module 'flet-box' {
|
|
|
195
270
|
scrollToEnd(animated?: boolean): void;
|
|
196
271
|
};
|
|
197
272
|
|
|
198
|
-
interface GridViewProps extends Omit<ListViewProps, 'wrapItems' | 'crossAxisCount'> {
|
|
273
|
+
export interface GridViewProps extends Omit<ListViewProps, 'wrapItems' | 'crossAxisCount'> {
|
|
199
274
|
columns?: number;
|
|
200
275
|
spacing?: number;
|
|
201
276
|
itemHeight?: number;
|
|
@@ -205,7 +280,7 @@ declare module 'flet-box' {
|
|
|
205
280
|
// =========================================================================
|
|
206
281
|
// Widgets básicos
|
|
207
282
|
// =========================================================================
|
|
208
|
-
interface TextProps extends CommonProps {
|
|
283
|
+
export interface TextProps extends CommonProps {
|
|
209
284
|
text?: string;
|
|
210
285
|
value?: string;
|
|
211
286
|
children?: string;
|
|
@@ -223,7 +298,7 @@ declare module 'flet-box' {
|
|
|
223
298
|
}
|
|
224
299
|
export function Text(props: TextProps): Widget;
|
|
225
300
|
|
|
226
|
-
interface ButtonProps extends CommonProps {
|
|
301
|
+
export interface ButtonProps extends CommonProps {
|
|
227
302
|
text?: string;
|
|
228
303
|
onPress?: () => void;
|
|
229
304
|
variant?: 'filled' | 'outlined' | 'text';
|
|
@@ -246,7 +321,7 @@ declare module 'flet-box' {
|
|
|
246
321
|
}
|
|
247
322
|
export function Button(props: ButtonProps): Widget;
|
|
248
323
|
|
|
249
|
-
interface IconProps extends CommonProps {
|
|
324
|
+
export interface IconProps extends CommonProps {
|
|
250
325
|
name: string;
|
|
251
326
|
size?: number;
|
|
252
327
|
color?: Color;
|
|
@@ -254,7 +329,7 @@ declare module 'flet-box' {
|
|
|
254
329
|
}
|
|
255
330
|
export function Icon(props: IconProps): Widget;
|
|
256
331
|
|
|
257
|
-
interface ImageProps extends CommonProps {
|
|
332
|
+
export interface ImageProps extends CommonProps {
|
|
258
333
|
src: string;
|
|
259
334
|
alt?: string;
|
|
260
335
|
width?: Size;
|
|
@@ -267,7 +342,7 @@ declare module 'flet-box' {
|
|
|
267
342
|
}
|
|
268
343
|
export function Image(props: ImageProps): Widget;
|
|
269
344
|
|
|
270
|
-
interface AvatarProps extends CommonProps {
|
|
345
|
+
export interface AvatarProps extends CommonProps {
|
|
271
346
|
src?: string;
|
|
272
347
|
name?: string;
|
|
273
348
|
icon?: string;
|
|
@@ -281,7 +356,7 @@ declare module 'flet-box' {
|
|
|
281
356
|
updateContent(newProps: Partial<AvatarProps>): void;
|
|
282
357
|
};
|
|
283
358
|
|
|
284
|
-
interface CardProps extends CommonProps {
|
|
359
|
+
export interface CardProps extends CommonProps {
|
|
285
360
|
child?: Widget;
|
|
286
361
|
children?: Widget[];
|
|
287
362
|
elevation?: number;
|
|
@@ -295,7 +370,7 @@ declare module 'flet-box' {
|
|
|
295
370
|
}
|
|
296
371
|
export function Card(props: CardProps): Widget;
|
|
297
372
|
|
|
298
|
-
interface ListTileProps extends CommonProps {
|
|
373
|
+
export interface ListTileProps extends CommonProps {
|
|
299
374
|
leftItem?: Widget;
|
|
300
375
|
title?: string | Widget;
|
|
301
376
|
subtitle?: string | Widget;
|
|
@@ -315,7 +390,7 @@ declare module 'flet-box' {
|
|
|
315
390
|
}
|
|
316
391
|
export function ListTile(props: ListTileProps): Widget;
|
|
317
392
|
|
|
318
|
-
interface ProgressBarProps extends CommonProps {
|
|
393
|
+
export interface ProgressBarProps extends CommonProps {
|
|
319
394
|
value?: number;
|
|
320
395
|
max?: number;
|
|
321
396
|
height?: number;
|
|
@@ -337,7 +412,7 @@ declare module 'flet-box' {
|
|
|
337
412
|
setValue(value: number): void;
|
|
338
413
|
};
|
|
339
414
|
|
|
340
|
-
interface RatingProps extends CommonProps {
|
|
415
|
+
export interface RatingProps extends CommonProps {
|
|
341
416
|
value?: number;
|
|
342
417
|
max?: number;
|
|
343
418
|
size?: number;
|
|
@@ -360,7 +435,7 @@ declare module 'flet-box' {
|
|
|
360
435
|
getValue(): number;
|
|
361
436
|
};
|
|
362
437
|
|
|
363
|
-
interface ChipProps extends CommonProps {
|
|
438
|
+
export interface ChipProps extends CommonProps {
|
|
364
439
|
label: string;
|
|
365
440
|
icon?: string;
|
|
366
441
|
onPress?: () => void;
|
|
@@ -376,7 +451,7 @@ declare module 'flet-box' {
|
|
|
376
451
|
}
|
|
377
452
|
export function Chip(props: ChipProps): Widget;
|
|
378
453
|
|
|
379
|
-
interface AdSenseProps extends CommonProps {
|
|
454
|
+
export interface AdSenseProps extends CommonProps {
|
|
380
455
|
client?: string;
|
|
381
456
|
slot?: string;
|
|
382
457
|
format?: string;
|
|
@@ -399,7 +474,7 @@ declare module 'flet-box' {
|
|
|
399
474
|
getElement(): Widget;
|
|
400
475
|
};
|
|
401
476
|
|
|
402
|
-
interface AdMobProps extends CommonProps {
|
|
477
|
+
export interface AdMobProps extends CommonProps {
|
|
403
478
|
adId?: string;
|
|
404
479
|
isTesting?: boolean;
|
|
405
480
|
position?: 'top' | 'bottom';
|
|
@@ -430,7 +505,7 @@ declare module 'flet-box' {
|
|
|
430
505
|
getPlugin(): object | null;
|
|
431
506
|
};
|
|
432
507
|
|
|
433
|
-
interface BadgeProps extends CommonProps {
|
|
508
|
+
export interface BadgeProps extends CommonProps {
|
|
434
509
|
value: string | number;
|
|
435
510
|
child: Widget;
|
|
436
511
|
bgColor?: Color;
|
|
@@ -447,7 +522,7 @@ declare module 'flet-box' {
|
|
|
447
522
|
updateValue(newValue: string | number): void;
|
|
448
523
|
};
|
|
449
524
|
|
|
450
|
-
interface SliderProps extends CommonProps {
|
|
525
|
+
export interface SliderProps extends CommonProps {
|
|
451
526
|
value?: number;
|
|
452
527
|
min?: number;
|
|
453
528
|
max?: number;
|
|
@@ -482,7 +557,7 @@ declare module 'flet-box' {
|
|
|
482
557
|
update(props: Partial<SliderProps>): void;
|
|
483
558
|
};
|
|
484
559
|
|
|
485
|
-
interface AccordionProps extends CommonProps {
|
|
560
|
+
export interface AccordionProps extends CommonProps {
|
|
486
561
|
title: string | Widget;
|
|
487
562
|
children: Widget;
|
|
488
563
|
expanded?: boolean;
|
|
@@ -513,7 +588,7 @@ declare module 'flet-box' {
|
|
|
513
588
|
update(props: Partial<AccordionProps>): void;
|
|
514
589
|
};
|
|
515
590
|
|
|
516
|
-
interface DividerProps extends CommonProps {
|
|
591
|
+
export interface DividerProps extends CommonProps {
|
|
517
592
|
color?: Color;
|
|
518
593
|
thickness?: number;
|
|
519
594
|
margin?: number | { top?: number; right?: number; bottom?: number; left?: number };
|
|
@@ -524,7 +599,7 @@ declare module 'flet-box' {
|
|
|
524
599
|
// =========================================================================
|
|
525
600
|
// Formularios e interacción
|
|
526
601
|
// =========================================================================
|
|
527
|
-
interface InputProps extends CommonProps {
|
|
602
|
+
export interface InputProps extends CommonProps {
|
|
528
603
|
value?: string;
|
|
529
604
|
placeholder?: string;
|
|
530
605
|
type?: 'text' | 'email' | 'password' | 'number' | 'tel' | 'search' | 'url';
|
|
@@ -566,7 +641,7 @@ declare module 'flet-box' {
|
|
|
566
641
|
blur(): void;
|
|
567
642
|
};
|
|
568
643
|
|
|
569
|
-
interface RadioProps extends CommonProps {
|
|
644
|
+
export interface RadioProps extends CommonProps {
|
|
570
645
|
selected?: boolean;
|
|
571
646
|
onSelect?: (selected: boolean) => void;
|
|
572
647
|
disabled?: boolean;
|
|
@@ -581,7 +656,7 @@ declare module 'flet-box' {
|
|
|
581
656
|
isSelected(): boolean;
|
|
582
657
|
};
|
|
583
658
|
|
|
584
|
-
interface SwitchProps extends CommonProps {
|
|
659
|
+
export interface SwitchProps extends CommonProps {
|
|
585
660
|
value?: boolean;
|
|
586
661
|
onToggle?: (value: boolean) => void;
|
|
587
662
|
disabled?: boolean;
|
|
@@ -594,7 +669,7 @@ declare module 'flet-box' {
|
|
|
594
669
|
getValue(): boolean;
|
|
595
670
|
};
|
|
596
671
|
|
|
597
|
-
interface CheckboxProps extends CommonProps {
|
|
672
|
+
export interface CheckboxProps extends CommonProps {
|
|
598
673
|
checked?: boolean;
|
|
599
674
|
onCheck?: (checked: boolean) => void;
|
|
600
675
|
disabled?: boolean;
|
|
@@ -607,8 +682,8 @@ declare module 'flet-box' {
|
|
|
607
682
|
getChecked(): boolean;
|
|
608
683
|
};
|
|
609
684
|
|
|
610
|
-
type DropdownOption = { label: string; value: any; icon?: string };
|
|
611
|
-
interface DropdownProps extends CommonProps {
|
|
685
|
+
export type DropdownOption = { label: string; value: any; icon?: string };
|
|
686
|
+
export interface DropdownProps extends CommonProps {
|
|
612
687
|
options: (string | DropdownOption)[];
|
|
613
688
|
value?: any;
|
|
614
689
|
placeholder?: string;
|
|
@@ -640,7 +715,7 @@ declare module 'flet-box' {
|
|
|
640
715
|
// =========================================================================
|
|
641
716
|
// Alert dialogs and feedback
|
|
642
717
|
// =========================================================================
|
|
643
|
-
interface SnackBarOptions {
|
|
718
|
+
export interface SnackBarOptions {
|
|
644
719
|
message: string;
|
|
645
720
|
action?: string;
|
|
646
721
|
onAction?: () => void;
|
|
@@ -662,7 +737,7 @@ declare module 'flet-box' {
|
|
|
662
737
|
}
|
|
663
738
|
export function SnackBar(options: SnackBarOptions): { close(): void; show(): void; getElement(): Widget };
|
|
664
739
|
|
|
665
|
-
interface ModalProps {
|
|
740
|
+
export interface ModalProps {
|
|
666
741
|
title?: string;
|
|
667
742
|
content?: Widget | string;
|
|
668
743
|
actions?: Widget[];
|
|
@@ -709,7 +784,7 @@ declare module 'flet-box' {
|
|
|
709
784
|
setLoading(loading: boolean, loadingText?: string): void;
|
|
710
785
|
};
|
|
711
786
|
|
|
712
|
-
interface BottomSheetProps {
|
|
787
|
+
export interface BottomSheetProps {
|
|
713
788
|
content: Widget;
|
|
714
789
|
title?: string;
|
|
715
790
|
actions?: Widget[];
|
|
@@ -746,7 +821,7 @@ declare module 'flet-box' {
|
|
|
746
821
|
destroy(): void;
|
|
747
822
|
};
|
|
748
823
|
|
|
749
|
-
interface AlertDialogProps {
|
|
824
|
+
export interface AlertDialogProps {
|
|
750
825
|
title: string;
|
|
751
826
|
message: string;
|
|
752
827
|
confirmText?: string;
|
|
@@ -768,7 +843,7 @@ declare module 'flet-box' {
|
|
|
768
843
|
// =========================================================================
|
|
769
844
|
// Navegación
|
|
770
845
|
// =========================================================================
|
|
771
|
-
interface ScaffoldProps extends CommonProps {
|
|
846
|
+
export interface ScaffoldProps extends CommonProps {
|
|
772
847
|
appBar?: Widget | boolean;
|
|
773
848
|
body?: Widget | Record<string, any>;
|
|
774
849
|
bottomBar?: Widget | boolean;
|
|
@@ -794,7 +869,7 @@ declare module 'flet-box' {
|
|
|
794
869
|
closeDrawer?(): void;
|
|
795
870
|
};
|
|
796
871
|
|
|
797
|
-
interface AdaptiveScaffoldProps extends CommonProps {
|
|
872
|
+
export interface AdaptiveScaffoldProps extends CommonProps {
|
|
798
873
|
appBar?: Widget;
|
|
799
874
|
body?: Widget | Record<string, any>;
|
|
800
875
|
bottomBar?: Widget;
|
|
@@ -818,7 +893,7 @@ declare module 'flet-box' {
|
|
|
818
893
|
closeDrawer?(): void;
|
|
819
894
|
};
|
|
820
895
|
|
|
821
|
-
interface AppBarProps extends CommonProps {
|
|
896
|
+
export interface AppBarProps extends CommonProps {
|
|
822
897
|
title?: string | Widget;
|
|
823
898
|
leading?: Widget;
|
|
824
899
|
actions?: Widget[];
|
|
@@ -849,7 +924,7 @@ declare module 'flet-box' {
|
|
|
849
924
|
hide(): void;
|
|
850
925
|
};
|
|
851
926
|
|
|
852
|
-
interface DrawerItemProps extends CommonProps {
|
|
927
|
+
export interface DrawerItemProps extends CommonProps {
|
|
853
928
|
icon?: string;
|
|
854
929
|
label: string;
|
|
855
930
|
route?: string;
|
|
@@ -866,14 +941,14 @@ declare module 'flet-box' {
|
|
|
866
941
|
}
|
|
867
942
|
export function DrawerItem(props: DrawerItemProps): Widget;
|
|
868
943
|
|
|
869
|
-
interface DrawerInstance {
|
|
944
|
+
export interface DrawerInstance {
|
|
870
945
|
open(): void;
|
|
871
946
|
close(): void;
|
|
872
947
|
toggle(): void;
|
|
873
948
|
destroy(): void;
|
|
874
949
|
element: HTMLElement;
|
|
875
950
|
}
|
|
876
|
-
interface DrawerProps {
|
|
951
|
+
export interface DrawerProps {
|
|
877
952
|
header?: Widget;
|
|
878
953
|
body?: Widget[];
|
|
879
954
|
footer?: Widget;
|
|
@@ -896,7 +971,7 @@ declare module 'flet-box' {
|
|
|
896
971
|
export function toggleDrawer(): void;
|
|
897
972
|
export function destroyDrawer(): void;
|
|
898
973
|
|
|
899
|
-
interface BottomNavigationProps extends CommonProps {
|
|
974
|
+
export interface BottomNavigationProps extends CommonProps {
|
|
900
975
|
items: Array<{ icon: string; label?: string; route?: string; onPress?: () => void }>;
|
|
901
976
|
currentIndex?: number;
|
|
902
977
|
onTabChange?: (index: number) => void;
|
|
@@ -919,7 +994,7 @@ declare module 'flet-box' {
|
|
|
919
994
|
getCurrentRoute(): string | null;
|
|
920
995
|
};
|
|
921
996
|
|
|
922
|
-
interface FloatingActionButtonProps extends CommonProps {
|
|
997
|
+
export interface FloatingActionButtonProps extends CommonProps {
|
|
923
998
|
icon?: string | Widget;
|
|
924
999
|
label?: string;
|
|
925
1000
|
onPress?: () => void;
|
|
@@ -933,7 +1008,7 @@ declare module 'flet-box' {
|
|
|
933
1008
|
}
|
|
934
1009
|
export function FloatingActionButton(props: FloatingActionButtonProps): Widget;
|
|
935
1010
|
|
|
936
|
-
interface TabsProps extends CommonProps {
|
|
1011
|
+
export interface TabsProps extends CommonProps {
|
|
937
1012
|
tabs: (string | { label: string; icon?: string; badge?: number | string })[];
|
|
938
1013
|
children: Widget[];
|
|
939
1014
|
activeIndex?: number;
|
|
@@ -959,7 +1034,7 @@ declare module 'flet-box' {
|
|
|
959
1034
|
setActiveTab(index: number): void;
|
|
960
1035
|
};
|
|
961
1036
|
|
|
962
|
-
interface CollapsibleSideBarProps extends CommonProps {
|
|
1037
|
+
export interface CollapsibleSideBarProps extends CommonProps {
|
|
963
1038
|
children: Widget;
|
|
964
1039
|
expanded?: boolean;
|
|
965
1040
|
id?: string;
|
|
@@ -997,7 +1072,7 @@ declare module 'flet-box' {
|
|
|
997
1072
|
// =========================================================================
|
|
998
1073
|
// Animations
|
|
999
1074
|
// =========================================================================
|
|
1000
|
-
interface AnimationStep {
|
|
1075
|
+
export interface AnimationStep {
|
|
1001
1076
|
effect: string;
|
|
1002
1077
|
from: any;
|
|
1003
1078
|
to: any;
|
|
@@ -1006,7 +1081,7 @@ declare module 'flet-box' {
|
|
|
1006
1081
|
loop?: boolean;
|
|
1007
1082
|
delay?: string;
|
|
1008
1083
|
}
|
|
1009
|
-
interface AnimatedBoxProps extends CommonProps {
|
|
1084
|
+
export interface AnimatedBoxProps extends CommonProps {
|
|
1010
1085
|
animations: AnimationStep[];
|
|
1011
1086
|
child: Widget;
|
|
1012
1087
|
timing?: string;
|
|
@@ -1019,7 +1094,7 @@ declare module 'flet-box' {
|
|
|
1019
1094
|
}
|
|
1020
1095
|
export function AnimatedBox(props: AnimatedBoxProps): Widget;
|
|
1021
1096
|
|
|
1022
|
-
interface AnimatedTextProps extends CommonProps {
|
|
1097
|
+
export interface AnimatedTextProps extends CommonProps {
|
|
1023
1098
|
child: Widget;
|
|
1024
1099
|
animations: AnimationStep[];
|
|
1025
1100
|
sameTime?: boolean;
|
|
@@ -1028,7 +1103,7 @@ declare module 'flet-box' {
|
|
|
1028
1103
|
}
|
|
1029
1104
|
export function AnimatedText(props: AnimatedTextProps): Widget;
|
|
1030
1105
|
|
|
1031
|
-
interface MatrixRainProps extends CommonProps {
|
|
1106
|
+
export interface MatrixRainProps extends CommonProps {
|
|
1032
1107
|
chars?: string;
|
|
1033
1108
|
fontSize?: number;
|
|
1034
1109
|
speed?: number;
|
|
@@ -1040,7 +1115,7 @@ declare module 'flet-box' {
|
|
|
1040
1115
|
}
|
|
1041
1116
|
export function MatrixRain(props?: MatrixRainProps): Widget;
|
|
1042
1117
|
|
|
1043
|
-
interface ParallaxBoxProps extends CommonProps {
|
|
1118
|
+
export interface ParallaxBoxProps extends CommonProps {
|
|
1044
1119
|
child: Widget;
|
|
1045
1120
|
type?: 'scroll' | 'mouse' | 'hover';
|
|
1046
1121
|
speed?: number;
|
|
@@ -1085,13 +1160,13 @@ declare module 'flet-box' {
|
|
|
1085
1160
|
// =========================================================================
|
|
1086
1161
|
// Widgets adicionales (Data, Media, Utils)
|
|
1087
1162
|
// =========================================================================
|
|
1088
|
-
interface DataTableColumn {
|
|
1163
|
+
export interface DataTableColumn {
|
|
1089
1164
|
key: string;
|
|
1090
1165
|
label: string;
|
|
1091
1166
|
align?: 'left' | 'center' | 'right';
|
|
1092
1167
|
format?: (value: any, row: any) => string;
|
|
1093
1168
|
}
|
|
1094
|
-
interface DataTableProps extends CommonProps {
|
|
1169
|
+
export interface DataTableProps extends CommonProps {
|
|
1095
1170
|
columns: (string | DataTableColumn)[];
|
|
1096
1171
|
rows: Record<string, any>[];
|
|
1097
1172
|
striped?: boolean;
|
|
@@ -1117,7 +1192,7 @@ declare module 'flet-box' {
|
|
|
1117
1192
|
updateColumns(columns: DataTableColumn[]): void;
|
|
1118
1193
|
};
|
|
1119
1194
|
|
|
1120
|
-
interface ChartProps extends CommonProps {
|
|
1195
|
+
export interface ChartProps extends CommonProps {
|
|
1121
1196
|
type?: 'bar' | 'line' | 'area' | 'candle';
|
|
1122
1197
|
data: number[] | Array<{ open: number; high: number; low: number; close: number }>;
|
|
1123
1198
|
labels?: string[];
|
|
@@ -1148,7 +1223,7 @@ declare module 'flet-box' {
|
|
|
1148
1223
|
redraw(): void;
|
|
1149
1224
|
};
|
|
1150
1225
|
|
|
1151
|
-
interface QRCodeProps extends CommonProps {
|
|
1226
|
+
export interface QRCodeProps extends CommonProps {
|
|
1152
1227
|
value: string;
|
|
1153
1228
|
size?: number;
|
|
1154
1229
|
bgColor?: Color;
|
|
@@ -1164,7 +1239,7 @@ declare module 'flet-box' {
|
|
|
1164
1239
|
getValue(): string;
|
|
1165
1240
|
};
|
|
1166
1241
|
|
|
1167
|
-
interface CodeViewerProps extends CommonProps {
|
|
1242
|
+
export interface CodeViewerProps extends CommonProps {
|
|
1168
1243
|
code: string;
|
|
1169
1244
|
title?: string;
|
|
1170
1245
|
maxHeight?: number;
|
|
@@ -1186,7 +1261,7 @@ declare module 'flet-box' {
|
|
|
1186
1261
|
scrollToEnd(): void;
|
|
1187
1262
|
};
|
|
1188
1263
|
|
|
1189
|
-
interface InspectorProps {
|
|
1264
|
+
export interface InspectorProps {
|
|
1190
1265
|
widget: Widget;
|
|
1191
1266
|
indent?: number;
|
|
1192
1267
|
}
|
|
@@ -1194,7 +1269,7 @@ declare module 'flet-box' {
|
|
|
1194
1269
|
export function printWidgetCode(widget: Widget): void;
|
|
1195
1270
|
export function inspectWidget(widget: Widget): Widget;
|
|
1196
1271
|
|
|
1197
|
-
interface DraggBoxProps extends CommonProps {
|
|
1272
|
+
export interface DraggBoxProps extends CommonProps {
|
|
1198
1273
|
child: Widget;
|
|
1199
1274
|
data?: any;
|
|
1200
1275
|
group?: string;
|
|
@@ -1209,7 +1284,7 @@ declare module 'flet-box' {
|
|
|
1209
1284
|
}
|
|
1210
1285
|
export function DraggBox(props: DraggBoxProps): Widget;
|
|
1211
1286
|
|
|
1212
|
-
interface DroppBoxProps extends CommonProps {
|
|
1287
|
+
export interface DroppBoxProps extends CommonProps {
|
|
1213
1288
|
child: Widget;
|
|
1214
1289
|
onDrop?: (data: any, group: string, event: DragEvent) => void;
|
|
1215
1290
|
onDragEnter?: (event: DragEvent) => void;
|
|
@@ -1239,7 +1314,7 @@ declare module 'flet-box' {
|
|
|
1239
1314
|
}
|
|
1240
1315
|
export function DroppBox(props: DroppBoxProps): Widget;
|
|
1241
1316
|
|
|
1242
|
-
interface CarouselProps extends CommonProps {
|
|
1317
|
+
export interface CarouselProps extends CommonProps {
|
|
1243
1318
|
items: (Widget | string | { src: string; alt?: string })[];
|
|
1244
1319
|
autoPlay?: boolean;
|
|
1245
1320
|
interval?: number;
|
|
@@ -1267,7 +1342,7 @@ declare module 'flet-box' {
|
|
|
1267
1342
|
getCurrentIndex(): number;
|
|
1268
1343
|
};
|
|
1269
1344
|
|
|
1270
|
-
interface TooltipProps extends CommonProps {
|
|
1345
|
+
export interface TooltipProps extends CommonProps {
|
|
1271
1346
|
text: string;
|
|
1272
1347
|
child: Widget;
|
|
1273
1348
|
position?: 'top' | 'bottom' | 'left' | 'right';
|
|
@@ -1296,7 +1371,7 @@ declare module 'flet-box' {
|
|
|
1296
1371
|
updatePosition(): void;
|
|
1297
1372
|
};
|
|
1298
1373
|
|
|
1299
|
-
interface PaginationProps extends CommonProps {
|
|
1374
|
+
export interface PaginationProps extends CommonProps {
|
|
1300
1375
|
totalItems: number;
|
|
1301
1376
|
pageSize?: number;
|
|
1302
1377
|
currentPage?: number;
|
|
@@ -1313,7 +1388,7 @@ declare module 'flet-box' {
|
|
|
1313
1388
|
}
|
|
1314
1389
|
export function Pagination(props: PaginationProps): Widget;
|
|
1315
1390
|
|
|
1316
|
-
interface TreeViewProps extends CommonProps {
|
|
1391
|
+
export interface TreeViewProps extends CommonProps {
|
|
1317
1392
|
nodes: Array<{
|
|
1318
1393
|
id: string;
|
|
1319
1394
|
label: string;
|
|
@@ -1362,7 +1437,7 @@ declare module 'flet-box' {
|
|
|
1362
1437
|
setSelected(nodeId: string): void;
|
|
1363
1438
|
};
|
|
1364
1439
|
|
|
1365
|
-
interface StepperProps extends CommonProps {
|
|
1440
|
+
export interface StepperProps extends CommonProps {
|
|
1366
1441
|
steps: Array<{ label: string; content: Widget; icon?: string }>;
|
|
1367
1442
|
activeStep?: number;
|
|
1368
1443
|
onStepChange?: (index: number) => void;
|
|
@@ -1391,7 +1466,7 @@ declare module 'flet-box' {
|
|
|
1391
1466
|
getActiveStep(): number;
|
|
1392
1467
|
};
|
|
1393
1468
|
|
|
1394
|
-
interface SkeletonProps extends CommonProps {
|
|
1469
|
+
export interface SkeletonProps extends CommonProps {
|
|
1395
1470
|
variant?: 'text' | 'circular' | 'avatar' | 'image' | 'card' | 'listTile' | 'button';
|
|
1396
1471
|
width?: number | string;
|
|
1397
1472
|
height?: number | string;
|
|
@@ -1407,7 +1482,7 @@ declare module 'flet-box' {
|
|
|
1407
1482
|
}
|
|
1408
1483
|
export function Skeleton(props: SkeletonProps): Widget;
|
|
1409
1484
|
|
|
1410
|
-
interface InstallButtonProps extends CommonProps {
|
|
1485
|
+
export interface InstallButtonProps extends CommonProps {
|
|
1411
1486
|
text?: string;
|
|
1412
1487
|
variant?: 'filled' | 'outlined' | 'text';
|
|
1413
1488
|
size?: 'small' | 'medium' | 'large';
|
|
@@ -1419,7 +1494,7 @@ declare module 'flet-box' {
|
|
|
1419
1494
|
}
|
|
1420
1495
|
export function InstallButton(props: InstallButtonProps): Widget;
|
|
1421
1496
|
|
|
1422
|
-
interface VideoProps extends CommonProps {
|
|
1497
|
+
export interface VideoProps extends CommonProps {
|
|
1423
1498
|
src: string;
|
|
1424
1499
|
width?: number | string;
|
|
1425
1500
|
height?: number | string;
|
|
@@ -1441,7 +1516,7 @@ declare module 'flet-box' {
|
|
|
1441
1516
|
unmuteVideo(): void;
|
|
1442
1517
|
};
|
|
1443
1518
|
|
|
1444
|
-
interface AudioProps extends CommonProps {
|
|
1519
|
+
export interface AudioProps extends CommonProps {
|
|
1445
1520
|
src: string;
|
|
1446
1521
|
autoplay?: boolean;
|
|
1447
1522
|
controls?: boolean;
|
|
@@ -1472,7 +1547,7 @@ declare module 'flet-box' {
|
|
|
1472
1547
|
isPlaying(): boolean;
|
|
1473
1548
|
};
|
|
1474
1549
|
|
|
1475
|
-
interface CircularBarProps extends CommonProps {
|
|
1550
|
+
export interface CircularBarProps extends CommonProps {
|
|
1476
1551
|
value?: number;
|
|
1477
1552
|
max?: number;
|
|
1478
1553
|
size?: number;
|
|
@@ -1516,13 +1591,13 @@ declare module 'flet-box' {
|
|
|
1516
1591
|
updateValue(newValue: number, newMax?: number): void;
|
|
1517
1592
|
};
|
|
1518
1593
|
|
|
1519
|
-
interface CircularChartSlice {
|
|
1594
|
+
export interface CircularChartSlice {
|
|
1520
1595
|
value: number;
|
|
1521
1596
|
label?: string;
|
|
1522
1597
|
color?: Color;
|
|
1523
1598
|
}
|
|
1524
1599
|
|
|
1525
|
-
interface CircularChartProps extends CommonProps {
|
|
1600
|
+
export interface CircularChartProps extends CommonProps {
|
|
1526
1601
|
data?: CircularChartSlice[];
|
|
1527
1602
|
size?: number;
|
|
1528
1603
|
strokeWidth?: number;
|
|
@@ -1559,7 +1634,7 @@ declare module 'flet-box' {
|
|
|
1559
1634
|
setCornerRadius(radius: number): void;
|
|
1560
1635
|
};
|
|
1561
1636
|
|
|
1562
|
-
interface MarkdownProps extends CommonProps {
|
|
1637
|
+
export interface MarkdownProps extends CommonProps {
|
|
1563
1638
|
text?: string;
|
|
1564
1639
|
source?: string;
|
|
1565
1640
|
content?: string;
|
|
@@ -1612,16 +1687,37 @@ declare module 'flet-box' {
|
|
|
1612
1687
|
// =========================================================================
|
|
1613
1688
|
// Core
|
|
1614
1689
|
// =========================================================================
|
|
1615
|
-
export function runApp(
|
|
1690
|
+
export function runApp(
|
|
1691
|
+
App: (() => Widget) | Widget,
|
|
1692
|
+
rootId?: string,
|
|
1693
|
+
preventRefresh?: boolean,
|
|
1694
|
+
routes?: any
|
|
1695
|
+
): { destroy(): void };
|
|
1696
|
+
|
|
1697
|
+
/**
|
|
1698
|
+
* Mounts a single widget into `#root`, creating the container when it is
|
|
1699
|
+
* missing. Never clears `document.body`. Returns the root container.
|
|
1700
|
+
*/
|
|
1701
|
+
export function App(widget: Widget): Widget;
|
|
1702
|
+
|
|
1703
|
+
/**
|
|
1704
|
+
* The only rendering engine. Turns a tag (or config object) plus props into a
|
|
1705
|
+
* real `HTMLElement` with styles, events, children, lifecycle and reactivity.
|
|
1706
|
+
*/
|
|
1707
|
+
export function WidgetFactory(
|
|
1708
|
+
tag: string | { tag?: string; [prop: string]: any },
|
|
1709
|
+
customProps?: Record<string, any>
|
|
1710
|
+
): WidgetFactoryInstance;
|
|
1711
|
+
|
|
1616
1712
|
export function createApp(routes: any, options?: { rootId?: string; fallback?: Widget | (() => Widget) }): {
|
|
1617
1713
|
start(): void;
|
|
1618
1714
|
destroy(): void;
|
|
1619
1715
|
};
|
|
1620
1716
|
export function insertBy(widget: Widget, rootId?: string): Widget;
|
|
1621
1717
|
export function prependBy(widget: Widget, rootId?: string): Widget;
|
|
1622
|
-
export function insertBefore(widget: Widget, targetId: string
|
|
1623
|
-
export function insertAfter(widget: Widget, targetId: string
|
|
1624
|
-
export function replaceBy(widget: Widget, targetId: string
|
|
1718
|
+
export function insertBefore(widget: Widget, targetId: string): Widget;
|
|
1719
|
+
export function insertAfter(widget: Widget, targetId: string): Widget;
|
|
1720
|
+
export function replaceBy(widget: Widget, targetId: string): Widget;
|
|
1625
1721
|
export function mountAll(widget: Widget, rootIds: string[]): Widget;
|
|
1626
1722
|
|
|
1627
1723
|
// =========================================================================
|
|
@@ -1890,6 +1986,23 @@ declare module 'flet-box' {
|
|
|
1890
1986
|
export function memoWithKey<T extends (...args: any[]) => any>(fn: T, keyFn: (...args: Parameters<T>) => string): T;
|
|
1891
1987
|
export function clearMemo(memoizedFn: any): void;
|
|
1892
1988
|
|
|
1989
|
+
/**
|
|
1990
|
+
* Thin `console` wrapper that adds a level icon plus optional timestamp and
|
|
1991
|
+
* label. The second argument may also be the options object (legacy style).
|
|
1992
|
+
*/
|
|
1993
|
+
export function print(
|
|
1994
|
+
message: any,
|
|
1995
|
+
type?:
|
|
1996
|
+
| "log"
|
|
1997
|
+
| "warn"
|
|
1998
|
+
| "error"
|
|
1999
|
+
| "info"
|
|
2000
|
+
| "success"
|
|
2001
|
+
| "debug"
|
|
2002
|
+
| { timestamp?: boolean; label?: string; prefix?: boolean },
|
|
2003
|
+
options?: { timestamp?: boolean; label?: string; prefix?: boolean }
|
|
2004
|
+
): void;
|
|
2005
|
+
|
|
1893
2006
|
export function setBaseFontSize(size: number): void;
|
|
1894
2007
|
export function toREM(value: number | string): string | undefined;
|
|
1895
2008
|
export function toPX(value: number | string): string | undefined;
|