flet-box 1.0.2 → 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/bin/ota/loader.js +6 -1
- package/bin/utils/templates.js +6 -2
- 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/create-index.sh +2 -2
- package/src/index.d.ts +193 -79
- package/src/index.js +1 -0
- package/src/navigations/AppBar.js +17 -4
- package/src/navigations/BottomNavigation.js +14 -2
- package/src/navigations/DrawerItem.js +16 -3
- package/src/navigations/Router.js +125 -6
- package/src/navigations/Scaffold.js +13 -3
- package/src/navigations/Tabs.js +34 -6
- package/src/navigations/index.js +2 -0
- 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;
|
|
@@ -977,12 +1052,13 @@ declare module 'flet-box' {
|
|
|
977
1052
|
// =========================================================================
|
|
978
1053
|
// Router
|
|
979
1054
|
// =========================================================================
|
|
980
|
-
export function initRouter(routes: Record<string, any>, initialPath?: string): void;
|
|
1055
|
+
export function initRouter(routes: Record<string, any>, initialPath?: string, options?: { base?: string }): void;
|
|
981
1056
|
export function goTo(path: string, params?: Record<string, any>): void;
|
|
982
1057
|
export function goBack(): void;
|
|
983
1058
|
export function goForward(): void;
|
|
984
1059
|
export function replace(path: string, params?: Record<string, any>): void;
|
|
985
1060
|
export function getCurrentPath(): string;
|
|
1061
|
+
export function getBasePath(): string;
|
|
986
1062
|
export function getCurrentRoute(): any;
|
|
987
1063
|
export function getCurrentRouteConfig(): { route: any; params: Record<string, any>; query: Record<string, any>; path: string };
|
|
988
1064
|
export function getRoute(path: string): any;
|
|
@@ -996,7 +1072,7 @@ declare module 'flet-box' {
|
|
|
996
1072
|
// =========================================================================
|
|
997
1073
|
// Animations
|
|
998
1074
|
// =========================================================================
|
|
999
|
-
interface AnimationStep {
|
|
1075
|
+
export interface AnimationStep {
|
|
1000
1076
|
effect: string;
|
|
1001
1077
|
from: any;
|
|
1002
1078
|
to: any;
|
|
@@ -1005,7 +1081,7 @@ declare module 'flet-box' {
|
|
|
1005
1081
|
loop?: boolean;
|
|
1006
1082
|
delay?: string;
|
|
1007
1083
|
}
|
|
1008
|
-
interface AnimatedBoxProps extends CommonProps {
|
|
1084
|
+
export interface AnimatedBoxProps extends CommonProps {
|
|
1009
1085
|
animations: AnimationStep[];
|
|
1010
1086
|
child: Widget;
|
|
1011
1087
|
timing?: string;
|
|
@@ -1018,7 +1094,7 @@ declare module 'flet-box' {
|
|
|
1018
1094
|
}
|
|
1019
1095
|
export function AnimatedBox(props: AnimatedBoxProps): Widget;
|
|
1020
1096
|
|
|
1021
|
-
interface AnimatedTextProps extends CommonProps {
|
|
1097
|
+
export interface AnimatedTextProps extends CommonProps {
|
|
1022
1098
|
child: Widget;
|
|
1023
1099
|
animations: AnimationStep[];
|
|
1024
1100
|
sameTime?: boolean;
|
|
@@ -1027,7 +1103,7 @@ declare module 'flet-box' {
|
|
|
1027
1103
|
}
|
|
1028
1104
|
export function AnimatedText(props: AnimatedTextProps): Widget;
|
|
1029
1105
|
|
|
1030
|
-
interface MatrixRainProps extends CommonProps {
|
|
1106
|
+
export interface MatrixRainProps extends CommonProps {
|
|
1031
1107
|
chars?: string;
|
|
1032
1108
|
fontSize?: number;
|
|
1033
1109
|
speed?: number;
|
|
@@ -1039,7 +1115,7 @@ declare module 'flet-box' {
|
|
|
1039
1115
|
}
|
|
1040
1116
|
export function MatrixRain(props?: MatrixRainProps): Widget;
|
|
1041
1117
|
|
|
1042
|
-
interface ParallaxBoxProps extends CommonProps {
|
|
1118
|
+
export interface ParallaxBoxProps extends CommonProps {
|
|
1043
1119
|
child: Widget;
|
|
1044
1120
|
type?: 'scroll' | 'mouse' | 'hover';
|
|
1045
1121
|
speed?: number;
|
|
@@ -1084,13 +1160,13 @@ declare module 'flet-box' {
|
|
|
1084
1160
|
// =========================================================================
|
|
1085
1161
|
// Widgets adicionales (Data, Media, Utils)
|
|
1086
1162
|
// =========================================================================
|
|
1087
|
-
interface DataTableColumn {
|
|
1163
|
+
export interface DataTableColumn {
|
|
1088
1164
|
key: string;
|
|
1089
1165
|
label: string;
|
|
1090
1166
|
align?: 'left' | 'center' | 'right';
|
|
1091
1167
|
format?: (value: any, row: any) => string;
|
|
1092
1168
|
}
|
|
1093
|
-
interface DataTableProps extends CommonProps {
|
|
1169
|
+
export interface DataTableProps extends CommonProps {
|
|
1094
1170
|
columns: (string | DataTableColumn)[];
|
|
1095
1171
|
rows: Record<string, any>[];
|
|
1096
1172
|
striped?: boolean;
|
|
@@ -1116,7 +1192,7 @@ declare module 'flet-box' {
|
|
|
1116
1192
|
updateColumns(columns: DataTableColumn[]): void;
|
|
1117
1193
|
};
|
|
1118
1194
|
|
|
1119
|
-
interface ChartProps extends CommonProps {
|
|
1195
|
+
export interface ChartProps extends CommonProps {
|
|
1120
1196
|
type?: 'bar' | 'line' | 'area' | 'candle';
|
|
1121
1197
|
data: number[] | Array<{ open: number; high: number; low: number; close: number }>;
|
|
1122
1198
|
labels?: string[];
|
|
@@ -1147,7 +1223,7 @@ declare module 'flet-box' {
|
|
|
1147
1223
|
redraw(): void;
|
|
1148
1224
|
};
|
|
1149
1225
|
|
|
1150
|
-
interface QRCodeProps extends CommonProps {
|
|
1226
|
+
export interface QRCodeProps extends CommonProps {
|
|
1151
1227
|
value: string;
|
|
1152
1228
|
size?: number;
|
|
1153
1229
|
bgColor?: Color;
|
|
@@ -1163,7 +1239,7 @@ declare module 'flet-box' {
|
|
|
1163
1239
|
getValue(): string;
|
|
1164
1240
|
};
|
|
1165
1241
|
|
|
1166
|
-
interface CodeViewerProps extends CommonProps {
|
|
1242
|
+
export interface CodeViewerProps extends CommonProps {
|
|
1167
1243
|
code: string;
|
|
1168
1244
|
title?: string;
|
|
1169
1245
|
maxHeight?: number;
|
|
@@ -1185,7 +1261,7 @@ declare module 'flet-box' {
|
|
|
1185
1261
|
scrollToEnd(): void;
|
|
1186
1262
|
};
|
|
1187
1263
|
|
|
1188
|
-
interface InspectorProps {
|
|
1264
|
+
export interface InspectorProps {
|
|
1189
1265
|
widget: Widget;
|
|
1190
1266
|
indent?: number;
|
|
1191
1267
|
}
|
|
@@ -1193,7 +1269,7 @@ declare module 'flet-box' {
|
|
|
1193
1269
|
export function printWidgetCode(widget: Widget): void;
|
|
1194
1270
|
export function inspectWidget(widget: Widget): Widget;
|
|
1195
1271
|
|
|
1196
|
-
interface DraggBoxProps extends CommonProps {
|
|
1272
|
+
export interface DraggBoxProps extends CommonProps {
|
|
1197
1273
|
child: Widget;
|
|
1198
1274
|
data?: any;
|
|
1199
1275
|
group?: string;
|
|
@@ -1208,7 +1284,7 @@ declare module 'flet-box' {
|
|
|
1208
1284
|
}
|
|
1209
1285
|
export function DraggBox(props: DraggBoxProps): Widget;
|
|
1210
1286
|
|
|
1211
|
-
interface DroppBoxProps extends CommonProps {
|
|
1287
|
+
export interface DroppBoxProps extends CommonProps {
|
|
1212
1288
|
child: Widget;
|
|
1213
1289
|
onDrop?: (data: any, group: string, event: DragEvent) => void;
|
|
1214
1290
|
onDragEnter?: (event: DragEvent) => void;
|
|
@@ -1238,7 +1314,7 @@ declare module 'flet-box' {
|
|
|
1238
1314
|
}
|
|
1239
1315
|
export function DroppBox(props: DroppBoxProps): Widget;
|
|
1240
1316
|
|
|
1241
|
-
interface CarouselProps extends CommonProps {
|
|
1317
|
+
export interface CarouselProps extends CommonProps {
|
|
1242
1318
|
items: (Widget | string | { src: string; alt?: string })[];
|
|
1243
1319
|
autoPlay?: boolean;
|
|
1244
1320
|
interval?: number;
|
|
@@ -1266,7 +1342,7 @@ declare module 'flet-box' {
|
|
|
1266
1342
|
getCurrentIndex(): number;
|
|
1267
1343
|
};
|
|
1268
1344
|
|
|
1269
|
-
interface TooltipProps extends CommonProps {
|
|
1345
|
+
export interface TooltipProps extends CommonProps {
|
|
1270
1346
|
text: string;
|
|
1271
1347
|
child: Widget;
|
|
1272
1348
|
position?: 'top' | 'bottom' | 'left' | 'right';
|
|
@@ -1295,7 +1371,7 @@ declare module 'flet-box' {
|
|
|
1295
1371
|
updatePosition(): void;
|
|
1296
1372
|
};
|
|
1297
1373
|
|
|
1298
|
-
interface PaginationProps extends CommonProps {
|
|
1374
|
+
export interface PaginationProps extends CommonProps {
|
|
1299
1375
|
totalItems: number;
|
|
1300
1376
|
pageSize?: number;
|
|
1301
1377
|
currentPage?: number;
|
|
@@ -1312,7 +1388,7 @@ declare module 'flet-box' {
|
|
|
1312
1388
|
}
|
|
1313
1389
|
export function Pagination(props: PaginationProps): Widget;
|
|
1314
1390
|
|
|
1315
|
-
interface TreeViewProps extends CommonProps {
|
|
1391
|
+
export interface TreeViewProps extends CommonProps {
|
|
1316
1392
|
nodes: Array<{
|
|
1317
1393
|
id: string;
|
|
1318
1394
|
label: string;
|
|
@@ -1361,7 +1437,7 @@ declare module 'flet-box' {
|
|
|
1361
1437
|
setSelected(nodeId: string): void;
|
|
1362
1438
|
};
|
|
1363
1439
|
|
|
1364
|
-
interface StepperProps extends CommonProps {
|
|
1440
|
+
export interface StepperProps extends CommonProps {
|
|
1365
1441
|
steps: Array<{ label: string; content: Widget; icon?: string }>;
|
|
1366
1442
|
activeStep?: number;
|
|
1367
1443
|
onStepChange?: (index: number) => void;
|
|
@@ -1390,7 +1466,7 @@ declare module 'flet-box' {
|
|
|
1390
1466
|
getActiveStep(): number;
|
|
1391
1467
|
};
|
|
1392
1468
|
|
|
1393
|
-
interface SkeletonProps extends CommonProps {
|
|
1469
|
+
export interface SkeletonProps extends CommonProps {
|
|
1394
1470
|
variant?: 'text' | 'circular' | 'avatar' | 'image' | 'card' | 'listTile' | 'button';
|
|
1395
1471
|
width?: number | string;
|
|
1396
1472
|
height?: number | string;
|
|
@@ -1406,7 +1482,7 @@ declare module 'flet-box' {
|
|
|
1406
1482
|
}
|
|
1407
1483
|
export function Skeleton(props: SkeletonProps): Widget;
|
|
1408
1484
|
|
|
1409
|
-
interface InstallButtonProps extends CommonProps {
|
|
1485
|
+
export interface InstallButtonProps extends CommonProps {
|
|
1410
1486
|
text?: string;
|
|
1411
1487
|
variant?: 'filled' | 'outlined' | 'text';
|
|
1412
1488
|
size?: 'small' | 'medium' | 'large';
|
|
@@ -1418,7 +1494,7 @@ declare module 'flet-box' {
|
|
|
1418
1494
|
}
|
|
1419
1495
|
export function InstallButton(props: InstallButtonProps): Widget;
|
|
1420
1496
|
|
|
1421
|
-
interface VideoProps extends CommonProps {
|
|
1497
|
+
export interface VideoProps extends CommonProps {
|
|
1422
1498
|
src: string;
|
|
1423
1499
|
width?: number | string;
|
|
1424
1500
|
height?: number | string;
|
|
@@ -1440,7 +1516,7 @@ declare module 'flet-box' {
|
|
|
1440
1516
|
unmuteVideo(): void;
|
|
1441
1517
|
};
|
|
1442
1518
|
|
|
1443
|
-
interface AudioProps extends CommonProps {
|
|
1519
|
+
export interface AudioProps extends CommonProps {
|
|
1444
1520
|
src: string;
|
|
1445
1521
|
autoplay?: boolean;
|
|
1446
1522
|
controls?: boolean;
|
|
@@ -1471,7 +1547,7 @@ declare module 'flet-box' {
|
|
|
1471
1547
|
isPlaying(): boolean;
|
|
1472
1548
|
};
|
|
1473
1549
|
|
|
1474
|
-
interface CircularBarProps extends CommonProps {
|
|
1550
|
+
export interface CircularBarProps extends CommonProps {
|
|
1475
1551
|
value?: number;
|
|
1476
1552
|
max?: number;
|
|
1477
1553
|
size?: number;
|
|
@@ -1515,13 +1591,13 @@ declare module 'flet-box' {
|
|
|
1515
1591
|
updateValue(newValue: number, newMax?: number): void;
|
|
1516
1592
|
};
|
|
1517
1593
|
|
|
1518
|
-
interface CircularChartSlice {
|
|
1594
|
+
export interface CircularChartSlice {
|
|
1519
1595
|
value: number;
|
|
1520
1596
|
label?: string;
|
|
1521
1597
|
color?: Color;
|
|
1522
1598
|
}
|
|
1523
1599
|
|
|
1524
|
-
interface CircularChartProps extends CommonProps {
|
|
1600
|
+
export interface CircularChartProps extends CommonProps {
|
|
1525
1601
|
data?: CircularChartSlice[];
|
|
1526
1602
|
size?: number;
|
|
1527
1603
|
strokeWidth?: number;
|
|
@@ -1558,7 +1634,7 @@ declare module 'flet-box' {
|
|
|
1558
1634
|
setCornerRadius(radius: number): void;
|
|
1559
1635
|
};
|
|
1560
1636
|
|
|
1561
|
-
interface MarkdownProps extends CommonProps {
|
|
1637
|
+
export interface MarkdownProps extends CommonProps {
|
|
1562
1638
|
text?: string;
|
|
1563
1639
|
source?: string;
|
|
1564
1640
|
content?: string;
|
|
@@ -1611,16 +1687,37 @@ declare module 'flet-box' {
|
|
|
1611
1687
|
// =========================================================================
|
|
1612
1688
|
// Core
|
|
1613
1689
|
// =========================================================================
|
|
1614
|
-
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
|
+
|
|
1615
1712
|
export function createApp(routes: any, options?: { rootId?: string; fallback?: Widget | (() => Widget) }): {
|
|
1616
1713
|
start(): void;
|
|
1617
1714
|
destroy(): void;
|
|
1618
1715
|
};
|
|
1619
1716
|
export function insertBy(widget: Widget, rootId?: string): Widget;
|
|
1620
1717
|
export function prependBy(widget: Widget, rootId?: string): Widget;
|
|
1621
|
-
export function insertBefore(widget: Widget, targetId: string
|
|
1622
|
-
export function insertAfter(widget: Widget, targetId: string
|
|
1623
|
-
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;
|
|
1624
1721
|
export function mountAll(widget: Widget, rootIds: string[]): Widget;
|
|
1625
1722
|
|
|
1626
1723
|
// =========================================================================
|
|
@@ -1889,6 +1986,23 @@ declare module 'flet-box' {
|
|
|
1889
1986
|
export function memoWithKey<T extends (...args: any[]) => any>(fn: T, keyFn: (...args: Parameters<T>) => string): T;
|
|
1890
1987
|
export function clearMemo(memoizedFn: any): void;
|
|
1891
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
|
+
|
|
1892
2006
|
export function setBaseFontSize(size: number): void;
|
|
1893
2007
|
export function toREM(value: number | string): string | undefined;
|
|
1894
2008
|
export function toPX(value: number | string): string | undefined;
|