flet-box 1.1.2 → 1.1.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (154) hide show
  1. package/AGENTS_FOR_CODE_GEN.md +284 -0
  2. package/CONTRIBUTING.md +238 -0
  3. package/README.md +2 -2
  4. package/bin/cli.js +88 -1
  5. package/bin/commands/auditFix.js +181 -27
  6. package/bin/commands/checkApi.js +14 -3
  7. package/bin/commands/checkStructure.js +368 -0
  8. package/bin/commands/checkSyntax.js +293 -0
  9. package/bin/commands/checkUi.js +666 -14
  10. package/bin/commands/create.js +14 -0
  11. package/bin/commands/createBundle.js +2 -2
  12. package/bin/commands/metrics.js +448 -0
  13. package/bin/commands/release.js +18 -0
  14. package/bin/commands/report.js +849 -0
  15. package/bin/commands/tools.js +76 -0
  16. package/bin/commands/unpack.js +39 -11
  17. package/bin/commands/verify.js +879 -0
  18. package/bin/mcp.js +280 -0
  19. package/bin/utils/contract.js +27 -0
  20. package/bin/utils/dtsProps.js +5 -1
  21. package/bin/utils/migrationGuide.js +146 -0
  22. package/bin/utils/moduleExports.js +9 -5
  23. package/bin/utils/templates.js +225 -18
  24. package/bin/utils/toolkit.js +191 -0
  25. package/docs/README.md +5 -1
  26. package/docs/arquitectura.md +1 -1
  27. package/docs/cli/README.md +168 -2
  28. package/docs/guides/README.md +6 -0
  29. package/docs/guides/accessibility.md +2 -1
  30. package/docs/guides/ai-toolkit.md +166 -0
  31. package/docs/guides/compatibility.md +1 -1
  32. package/docs/guides/migration.md +92 -0
  33. package/docs/guides/minification-and-protection.md +2 -1
  34. package/docs/guides/mobile-and-platforms.md +1 -1
  35. package/docs/guides/online-updates.md +2 -0
  36. package/docs/server/deployment.md +1 -1
  37. package/docs/tools/styling.md +2 -2
  38. package/docs/tools/theme.md +139 -4
  39. package/docs/widget/Accordion.md +74 -8
  40. package/docs/widget/AdMob.md +68 -3
  41. package/docs/widget/AdSense.md +67 -2
  42. package/docs/widget/AlertDialog.md +1 -1
  43. package/docs/widget/AnimatedBox.md +80 -39
  44. package/docs/widget/AnimatedText.md +74 -18
  45. package/docs/widget/Audio.md +73 -14
  46. package/docs/widget/Avatar.md +69 -4
  47. package/docs/widget/Badge.md +68 -3
  48. package/docs/widget/BottomSheet.md +2 -2
  49. package/docs/widget/Button.md +69 -3
  50. package/docs/widget/Card.md +69 -4
  51. package/docs/widget/Carousel.md +67 -2
  52. package/docs/widget/Chart.md +67 -2
  53. package/docs/widget/Checkbox.md +74 -8
  54. package/docs/widget/Chip.md +68 -3
  55. package/docs/widget/CircularBar.md +74 -15
  56. package/docs/widget/CircularChart.md +71 -10
  57. package/docs/widget/CodeViewer.md +67 -2
  58. package/docs/widget/Column.md +68 -3
  59. package/docs/widget/Container.md +68 -3
  60. package/docs/widget/DataTable.md +67 -2
  61. package/docs/widget/Divider.md +67 -2
  62. package/docs/widget/DraggBox.md +67 -2
  63. package/docs/widget/Dropdown.md +76 -10
  64. package/docs/widget/DroppBox.md +67 -2
  65. package/docs/widget/FloatingActionButton.md +68 -3
  66. package/docs/widget/GridView.md +67 -2
  67. package/docs/widget/Icon.md +71 -5
  68. package/docs/widget/Image.md +68 -3
  69. package/docs/widget/Input.md +68 -3
  70. package/docs/widget/Inspector.md +2 -2
  71. package/docs/widget/InstallButton.md +73 -13
  72. package/docs/widget/ListTile.md +69 -3
  73. package/docs/widget/ListView.md +67 -2
  74. package/docs/widget/Maps.md +68 -3
  75. package/docs/widget/Markdown.md +74 -15
  76. package/docs/widget/MatrixRain.md +72 -11
  77. package/docs/widget/Menu.md +209 -0
  78. package/docs/widget/Modal.md +3 -3
  79. package/docs/widget/Pagination.md +68 -3
  80. package/docs/widget/ParallaxBox.md +72 -12
  81. package/docs/widget/ProgressBar.md +69 -4
  82. package/docs/widget/QRCode.md +67 -2
  83. package/docs/widget/README.md +54 -50
  84. package/docs/widget/Radio.md +76 -10
  85. package/docs/widget/Rating.md +70 -6
  86. package/docs/widget/Row.md +68 -3
  87. package/docs/widget/Skeleton.md +68 -3
  88. package/docs/widget/Slider.md +75 -9
  89. package/docs/widget/SnackBar.md +2 -2
  90. package/docs/widget/Stack.md +68 -3
  91. package/docs/widget/Stepper.md +68 -3
  92. package/docs/widget/Switch.md +74 -8
  93. package/docs/widget/Text.md +71 -4
  94. package/docs/widget/ThemePicker.md +197 -0
  95. package/docs/widget/Tooltip.md +72 -7
  96. package/docs/widget/TreeView.md +70 -10
  97. package/docs/widget/Video.md +71 -10
  98. package/package.json +10 -3
  99. package/skills/fletbox-design/SKILL.md +89 -5
  100. package/skills/fletbox-motion/SKILL.md +1 -1
  101. package/skills/fletbox-rules/SKILL.md +56 -4
  102. package/src/core/runApp.js +12 -0
  103. package/src/index.d.ts +374 -101
  104. package/src/index.js +9 -0
  105. package/src/navigations/AdaptiveScaffold.js +2 -2
  106. package/src/navigations/BottomNavigation.js +1 -1
  107. package/src/navigations/Scaffold.js +18 -6
  108. package/src/tools/useState.js +11 -4
  109. package/src/utils/colors.js +275 -0
  110. package/src/utils/errorBoundary.js +288 -0
  111. package/src/utils/index.js +10 -2
  112. package/src/utils/stackPosition.js +39 -24
  113. package/src/utils/syntaxHighlight.js +4 -1
  114. package/src/utils/themes.js +279 -3
  115. package/src/widget-factory/addChildren.js +17 -10
  116. package/src/widget-factory/assignProps.js +18 -6
  117. package/src/widget-factory/createWidget.js +7 -0
  118. package/src/widget-factory/deprecations.js +77 -0
  119. package/src/widget-factory/translateProps.js +11 -1
  120. package/src/widget-factory/warnings.js +1 -27
  121. package/src/widget-factory/widgetFactory.js +59 -17
  122. package/src/widgets/Accordion.js +21 -7
  123. package/src/widgets/Badge.js +11 -2
  124. package/src/widgets/Button.js +15 -3
  125. package/src/widgets/Carousel.js +12 -4
  126. package/src/widgets/Chart.js +7 -2
  127. package/src/widgets/Checkbox.js +1 -2
  128. package/src/widgets/Chip.js +24 -10
  129. package/src/widgets/CircularBar.js +9 -3
  130. package/src/widgets/CircularChart.js +5 -3
  131. package/src/widgets/Container.js +6 -0
  132. package/src/widgets/Divider.js +3 -1
  133. package/src/widgets/DraggBox.js +9 -0
  134. package/src/widgets/Dropdown.js +3 -3
  135. package/src/widgets/DroppBox.js +5 -0
  136. package/src/widgets/FloatingActionButton.js +1 -1
  137. package/src/widgets/Icon.js +5 -1
  138. package/src/widgets/InstallButton.js +4 -2
  139. package/src/widgets/Markdown.js +171 -103
  140. package/src/widgets/Menu.js +340 -0
  141. package/src/widgets/Modal.js +7 -1
  142. package/src/widgets/Pagination.js +10 -5
  143. package/src/widgets/ProgressBar.js +5 -4
  144. package/src/widgets/QRCode.js +4 -0
  145. package/src/widgets/Radio.js +1 -2
  146. package/src/widgets/Rating.js +9 -0
  147. package/src/widgets/Slider.js +4 -1
  148. package/src/widgets/SnackBar.js +2 -2
  149. package/src/widgets/Switch.js +1 -2
  150. package/src/widgets/Text.js +9 -5
  151. package/src/widgets/ThemePicker.js +234 -0
  152. package/src/widgets/TreeView.js +2 -1
  153. package/src/widgets/index.js +2 -0
  154. package/docs/CONTRIBUTING.md +0 -156
package/src/index.d.ts CHANGED
@@ -1,13 +1,13 @@
1
1
  // index.d.ts - FletBox Type Declarations
2
- // Versión completa con todos los widgets, animaciones, servicios y utilidades
2
+ // Full version with every widget, animation, service and utility
3
3
 
4
4
  declare module 'flet-box' {
5
5
  // =========================================================================
6
- // Tipos base
6
+ // Base types
7
7
  // =========================================================================
8
8
  export type Widget = HTMLElement;
9
9
  // A Scaffold slot: an element, a factory it re-runs on each route change (so a
10
- // nav can relight the active item), a boolean show/hide, or null for absent.
10
+ // nav can re-render the active item), a boolean show/hide, or null for absent.
11
11
  export type Slot = Widget | (() => Widget) | boolean | null;
12
12
  export type Color = string;
13
13
  export type Size = number | string;
@@ -35,6 +35,14 @@ declare module 'flet-box' {
35
35
  _cleanup(): void;
36
36
  }
37
37
 
38
+ /**
39
+ * The live element every widget constructor returns. It is the factory
40
+ * instance: a real `HTMLElement` that also carries `update()`, `getProps()`,
41
+ * `onMount()` and `onUnmount()`. Typing widgets as bare `HTMLElement` made
42
+ * `estado.update({ text })` — the documented reactive call — an editor error.
43
+ */
44
+ export type FletWidget = WidgetFactoryInstance;
45
+
38
46
  // =========================================================================
39
47
  // Posicionamiento
40
48
  // =========================================================================
@@ -74,7 +82,7 @@ declare module 'flet-box' {
74
82
  }
75
83
 
76
84
  // =========================================================================
77
- // Props comunes (heredadas by todos the widgets)
85
+ // Common props (inherited by every widget)
78
86
  // =========================================================================
79
87
  export interface CommonProps extends StackPositionProps {
80
88
  width?: Size;
@@ -99,7 +107,30 @@ declare module 'flet-box' {
99
107
  // The engine routes `display` untouched; `Stack` sets it internally and an
100
108
  // app that overrides it is doing something the type must not forbid.
101
109
  display?: string;
110
+ // The rest of the layout and border styles the engine already routes on
111
+ // every widget (`translateProps.js`). Declaring them only on `Container`
112
+ // made `Column({ flexDirection: "row", flexGrow: 1 })` — the recipe the
113
+ // layout skill teaches — a false error in a JS editor.
114
+ boxSizing?: 'border-box' | 'content-box';
115
+ flexDirection?: 'row' | 'column' | 'row-reverse' | 'column-reverse';
116
+ flexGrow?: number;
117
+ flexShrink?: number;
118
+ gap?: number | string;
119
+ fontSize?: number;
120
+ borderColor?: Color;
121
+ borderWidth?: number;
102
122
  padding?: Padding;
123
+ // The engine routes each padding side, and the `pt/pr/pb/pl` aliases, as rem
124
+ // lengths on every widget, exactly like the margins below: `AppBar` reads
125
+ // the top one to keep its title clear of a notch.
126
+ paddingTop?: Size;
127
+ paddingRight?: Size;
128
+ paddingBottom?: Size;
129
+ paddingLeft?: Size;
130
+ pt?: Size;
131
+ pr?: Size;
132
+ pb?: Size;
133
+ pl?: Size;
103
134
  margin?: Margin;
104
135
  // The engine routes each margin side, and the `mt/mr/mb/ml` aliases, as rem
105
136
  // lengths on every widget: `Text({ marginTop: 4 })` is legal at runtime.
@@ -125,28 +156,58 @@ declare module 'flet-box' {
125
156
  filter?: string;
126
157
  backdropFilter?: string;
127
158
  maskImage?: string;
159
+ // The engine routes these four on every widget (`bgImage` → `backgroundImage`
160
+ // in translateProps.js). They are the only way to bias a crop: an `Image`
161
+ // with `fit: 'cover'` centres on its own, while a full-bleed background can
162
+ // be pinned to `center top` so a face stays out from under the copy.
163
+ bgImage?: string;
164
+ bgSize?: string;
165
+ bgPosition?: string;
166
+ bgRepeat?: string;
128
167
  opacity?: number;
129
168
  visible?: boolean;
130
169
  disabled?: boolean;
131
- onPress?: (widget: Widget) => void;
132
- onClick?: (widget: Widget) => void;
170
+ // The handler receives a DOM Event on every widget that forwards the click
171
+ // through the engine (Container, Row, Column, Text, Button, Icon, Image,
172
+ // Avatar, Card, ListTile). A widget that answers with a value declares its
173
+ // own: Switch/Checkbox/Radio pass the new boolean, Accordion the expanded
174
+ // state. `(widget: Widget)` named an argument no call site ever received,
175
+ // so a correct `onPress: (checked: boolean) => ...` was underlined.
176
+ onPress?: (event?: Event) => void;
177
+ onClick?: (event?: Event) => void;
133
178
  // The lowercase alias the engine also routes (`{ prop: "onclick" }` in
134
179
  // translateProps); the generated AppBar reaches for it.
135
- onclick?: (widget: Widget) => void;
180
+ onclick?: (event?: Event) => void;
136
181
  // A child's own cross-axis answer to its parent's `alignItems`. It belongs on
137
182
  // `CommonProps` rather than on the layouts because the widget that needs it is
138
183
  // the *child* — a chip centred inside a row whose other children stretch.
139
184
  alignSelf?: AlignSelf;
140
185
  // Alias of `alignSelf`, matching the `justify` / `alignItems` shorthand style.
141
186
  selfAlign?: AlignSelf;
187
+ // Text-clamping trio. The engine routes all three on any widget
188
+ // (`translateProps.js`), and the one-line ellipsis recipe
189
+ // (`overflow: 'hidden'` + `textOverflow: 'ellipsis'` + `whiteSpace: 'nowrap'`)
190
+ // is written on a `Text`, which used to reject it as an unknown prop.
191
+ overflow?: 'auto' | 'hidden' | 'visible' | 'scroll' | 'clip';
192
+ overflowX?: 'auto' | 'hidden' | 'visible' | 'scroll' | 'clip';
193
+ overflowY?: 'auto' | 'hidden' | 'visible' | 'scroll' | 'clip';
194
+ textOverflow?: 'clip' | 'ellipsis' | string;
195
+ whiteSpace?: 'normal' | 'nowrap' | 'pre' | 'pre-wrap' | 'pre-line' | string;
142
196
  id?: string;
143
197
  className?: string;
144
198
  ref?: (widget: Widget) => void;
145
199
  disableTransform?: boolean;
200
+ // Every `data-*` and `aria-*` prop is forwarded to the DOM untouched —
201
+ // `PASSTHROUGH_PREFIXES` in translateProps.js is the engine's own list — so
202
+ // the type has to allow what the engine honours. An icon-only control has no
203
+ // other way to say what it is, and a declaration that forbids `aria-label`
204
+ // teaches an editor to flag the one line that makes a widget accessible.
205
+ [attribute: `aria-${string}`]: string | number | undefined;
206
+ [attribute: `data-${string}`]: string | number | boolean | undefined;
146
207
  }
147
208
 
148
209
  // =========================================================================
149
- // useState Hook (persistente with RamStore)
210
+ // useState Hook (persistent across page reloads with RamStore)
150
211
  // =========================================================================
151
212
  export function useState<T>(
152
213
  key: string,
@@ -306,7 +367,7 @@ declare module 'flet-box' {
306
367
  maxWidth?: Size;
307
368
  overflow?: 'auto' | 'hidden' | 'visible' | 'scroll';
308
369
  }
309
- export function Container(props: ContainerProps): Widget;
370
+ export function Container(props: ContainerProps): FletWidget;
310
371
 
311
372
  export interface RowProps extends CommonProps {
312
373
  gap?: number | string;
@@ -314,18 +375,18 @@ declare module 'flet-box' {
314
375
  alignItems?: ContainerProps['alignItems'];
315
376
  wrap?: boolean | 'wrap' | 'nowrap' | 'wrap-reverse';
316
377
  children?: Widget[];
317
- onPress?: (widget: Widget) => void;
378
+ onPress?: (event?: Event) => void;
318
379
  }
319
- export function Row(props: RowProps): Widget;
380
+ export function Row(props: RowProps): FletWidget;
320
381
 
321
382
  export interface ColumnProps extends CommonProps {
322
383
  gap?: number | string;
323
384
  justifyContent?: ContainerProps['justifyContent'];
324
385
  alignItems?: ContainerProps['alignItems'];
325
386
  children?: Widget[];
326
- onPress?: (widget: Widget) => void;
387
+ onPress?: (event?: Event) => void;
327
388
  }
328
- export function Column(props: ColumnProps): Widget;
389
+ export function Column(props: ColumnProps): FletWidget;
329
390
 
330
391
  /**
331
392
  * Layers its children in the same box.
@@ -343,7 +404,7 @@ declare module 'flet-box' {
343
404
  position?: 'relative' | 'absolute' | 'stack';
344
405
  alignment?: 'top-left' | 'top-center' | 'top-right' | 'center-left' | 'center' | 'center-right' | 'bottom-left' | 'bottom-center' | 'bottom-right';
345
406
  }
346
- export function Stack(props: StackProps): Widget;
407
+ export function Stack(props: StackProps): FletWidget;
347
408
 
348
409
  export interface ListViewProps extends CommonProps {
349
410
  data?: any[];
@@ -364,7 +425,7 @@ declare module 'flet-box' {
364
425
  bufferSize?: number;
365
426
  expand?: boolean | number;
366
427
  }
367
- export function ListView(props: ListViewProps): Widget & {
428
+ export function ListView(props: ListViewProps): FletWidget & {
368
429
  data: any[];
369
430
  refreshing: boolean;
370
431
  updateData(newData: any[]): void;
@@ -384,7 +445,7 @@ declare module 'flet-box' {
384
445
  */
385
446
  children?: Widget[] | Widget;
386
447
  }
387
- export function GridView(props: GridViewProps): Widget;
448
+ export function GridView(props: GridViewProps): FletWidget;
388
449
 
389
450
  // =========================================================================
390
451
  // Widgets básicos
@@ -395,17 +456,24 @@ declare module 'flet-box' {
395
456
  children?: string;
396
457
  size?: number;
397
458
  color?: Color;
398
- weight?: 'normal' | 'bold' | number;
459
+ // CSS `font-weight`: the two keywords, the numeric scale as a number or as
460
+ // the same scale written as a string (`'600'` is what a design token table
461
+ // prints), and the relative keywords the engine forwards untouched.
462
+ weight?: 'normal' | 'bold' | 'bolder' | 'lighter' | '100' | '200' | '300' | '400' | '500' | '600' | '700' | '800' | '900' | number;
399
463
  align?: 'left' | 'center' | 'right' | 'justify';
400
464
  italic?: boolean;
401
465
  decoration?: 'underline' | 'line-through' | 'overline';
402
466
  lineHeight?: number | string;
403
467
  letterSpacing?: number | string;
468
+ /** Glyph outline, e.g. `"4px #fff"` (-webkit-text-stroke). Pair with paintOrder. */
469
+ textStroke?: string;
470
+ /** `"stroke fill"` puts the textStroke rim behind the fill so the centre keeps its colour. */
471
+ paintOrder?: string;
404
472
  type?: 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6' | 'p';
405
473
  styles?: Array<'bold' | 'italic' | 'underline' | 'strikethrough' | 'mark' | 'small' | 'code'>;
406
- onPress?: (widget: Widget) => void;
474
+ onPress?: (event?: Event) => void;
407
475
  }
408
- export function Text(props: TextProps): Widget;
476
+ export function Text(props: TextProps): FletWidget;
409
477
 
410
478
  export interface ButtonProps extends CommonProps {
411
479
  text?: string;
@@ -428,15 +496,18 @@ declare module 'flet-box' {
428
496
  padding?: Padding;
429
497
  margin?: Margin;
430
498
  }
431
- export function Button(props: ButtonProps): Widget;
499
+ export function Button(props: ButtonProps): FletWidget;
432
500
 
433
501
  export interface IconProps extends CommonProps {
434
- name: string;
502
+ // `icon` is the runtime alias the widget reads first (`icon || name`), so
503
+ // both spellings describe a glyph and neither is the odd one out.
504
+ name?: string;
505
+ icon?: string;
435
506
  size?: number;
436
507
  color?: Color;
437
- onPress?: (widget: Widget) => void;
508
+ onPress?: (event?: Event) => void;
438
509
  }
439
- export function Icon(props: IconProps): Widget;
510
+ export function Icon(props: IconProps): FletWidget;
440
511
 
441
512
  export interface ImageProps extends CommonProps {
442
513
  src: string;
@@ -449,9 +520,9 @@ declare module 'flet-box' {
449
520
  downloadFileName?: string;
450
521
  onLoad?: (widget: Widget) => void;
451
522
  onError?: (widget: Widget) => void;
452
- onPress?: (widget: Widget) => void;
523
+ onPress?: (event?: Event) => void;
453
524
  }
454
- export function Image(props: ImageProps): Widget;
525
+ export function Image(props: ImageProps): FletWidget;
455
526
 
456
527
  export interface AvatarProps extends CommonProps {
457
528
  src?: string;
@@ -463,9 +534,9 @@ declare module 'flet-box' {
463
534
  shape?: 'circle' | 'rounded' | 'square';
464
535
  online?: boolean;
465
536
  badgeColor?: Color;
466
- onPress?: (widget: Widget) => void;
537
+ onPress?: (event?: Event) => void;
467
538
  }
468
- export function Avatar(props: AvatarProps): Widget & {
539
+ export function Avatar(props: AvatarProps): FletWidget & {
469
540
  updateContent(newProps: Partial<AvatarProps>): void;
470
541
  };
471
542
 
@@ -479,9 +550,9 @@ declare module 'flet-box' {
479
550
  borderWidth?: number;
480
551
  borderStyle?: 'solid' | 'dashed' | 'dotted';
481
552
  borderColor?: Color;
482
- onPress?: (widget: Widget) => void;
553
+ onPress?: (event?: Event) => void;
483
554
  }
484
- export function Card(props: CardProps): Widget;
555
+ export function Card(props: CardProps): FletWidget;
485
556
 
486
557
  export interface ListTileProps extends CommonProps {
487
558
  leftItem?: Widget;
@@ -495,7 +566,9 @@ declare module 'flet-box' {
495
566
  /** Text props merged into the description line. */
496
567
  descriptionProps?: Partial<TextProps>;
497
568
  rightItem?: Widget;
498
- onPress?: (widget: Widget) => void;
569
+ /** Space between the left item, the text column and the right item. */
570
+ gap?: number;
571
+ onPress?: (event?: Event) => void;
499
572
  selected?: boolean;
500
573
  disabled?: boolean;
501
574
  divider?: boolean;
@@ -507,7 +580,7 @@ declare module 'flet-box' {
507
580
  elevation?: number;
508
581
  borderRadius?: number;
509
582
  }
510
- export function ListTile(props: ListTileProps): Widget;
583
+ export function ListTile(props: ListTileProps): FletWidget;
511
584
 
512
585
  export interface ProgressBarProps extends CommonProps {
513
586
  value?: number;
@@ -524,7 +597,7 @@ declare module 'flet-box' {
524
597
  striped?: boolean;
525
598
  animatedStripes?: boolean;
526
599
  }
527
- export function ProgressBar(props: ProgressBarProps): Widget & {
600
+ export function ProgressBar(props: ProgressBarProps): FletWidget & {
528
601
  value: number;
529
602
  updateProgress(value: number): void;
530
603
  getValue(): number;
@@ -548,7 +621,7 @@ declare module 'flet-box' {
548
621
  iconHalf?: string;
549
622
  onChange?: (value: number) => void;
550
623
  }
551
- export function Rating(props: RatingProps): Widget & {
624
+ export function Rating(props: RatingProps): FletWidget & {
552
625
  value: number;
553
626
  setValue(value: number): void;
554
627
  getValue(): number;
@@ -570,7 +643,7 @@ declare module 'flet-box' {
570
643
  elevation?: number;
571
644
  gap?: number;
572
645
  }
573
- export function Chip(props: ChipProps): Widget;
646
+ export function Chip(props: ChipProps): FletWidget;
574
647
 
575
648
  export interface AdSenseProps extends CommonProps {
576
649
  client?: string;
@@ -589,7 +662,7 @@ declare module 'flet-box' {
589
662
  onError?: (error: Error, widget: Widget) => void;
590
663
  children?: Widget[];
591
664
  }
592
- export function AdSense(props: AdSenseProps): Widget & {
665
+ export function AdSense(props: AdSenseProps): FletWidget & {
593
666
  refresh(): Widget;
594
667
  load(): void;
595
668
  getElement(): Widget;
@@ -618,7 +691,7 @@ declare module 'flet-box' {
618
691
  onFailed?: (error: Error, widget: Widget) => void;
619
692
  onDismissed?: () => void;
620
693
  }
621
- export function AdMob(props: AdMobProps): Widget & {
694
+ export function AdMob(props: AdMobProps): FletWidget & {
622
695
  show(): Promise<unknown>;
623
696
  hide(): Promise<unknown>;
624
697
  showInterstitial(): Promise<unknown>;
@@ -639,7 +712,7 @@ declare module 'flet-box' {
639
712
  showZero?: boolean;
640
713
  max?: number;
641
714
  }
642
- export function Badge(props: BadgeProps): Widget & {
715
+ export function Badge(props: BadgeProps): FletWidget & {
643
716
  updateValue(newValue: string | number): void;
644
717
  };
645
718
 
@@ -653,6 +726,8 @@ declare module 'flet-box' {
653
726
  height?: number;
654
727
  thumbSize?: number;
655
728
  color?: Color;
729
+ /** Colour of the knob alone, when it must differ from the filled track. */
730
+ thumbColor?: Color;
656
731
  trackColor?: Color;
657
732
  orientation?: 'horizontal' | 'vertical';
658
733
  inverted?: boolean;
@@ -671,7 +746,7 @@ declare module 'flet-box' {
671
746
  onChanged?: (value: number) => void;
672
747
  onChangeEnd?: (value: number) => void;
673
748
  }
674
- export function Slider(props: SliderProps): Widget & {
749
+ export function Slider(props: SliderProps): FletWidget & {
675
750
  value: number;
676
751
  min: number;
677
752
  max: number;
@@ -681,16 +756,23 @@ declare module 'flet-box' {
681
756
  update(props: Partial<SliderProps>): void;
682
757
  };
683
758
 
684
- export interface AccordionProps extends CommonProps {
759
+ export interface AccordionProps extends Omit<CommonProps, 'onPress'> {
685
760
  title: string | Widget;
686
761
  children: Widget;
687
762
  expanded?: boolean;
763
+ /**
764
+ * @deprecated Use `onPress` instead — it receives the same boolean.
765
+ */
688
766
  onToggle?: (expanded: boolean) => void;
767
+ /** Fired with the new expanded state when a panel opens or closes. */
768
+ onPress?: (expanded: boolean) => void;
689
769
  variant?: 'contained' | 'outlined' | 'ghost';
690
770
  borderRadius?: number;
691
771
  bgColor?: Color;
692
772
  expandedColor?: Color;
693
773
  titleColor?: Color;
774
+ /** Colour of the rule between the header and the panel. */
775
+ dividerColor?: Color;
694
776
  titleSize?: number;
695
777
  titleWeight?: string;
696
778
  titlePadding?: string;
@@ -705,7 +787,7 @@ declare module 'flet-box' {
705
787
  animationDuration?: number;
706
788
  elevation?: number;
707
789
  }
708
- export function Accordion(props: AccordionProps): Widget & {
790
+ export function Accordion(props: AccordionProps): FletWidget & {
709
791
  expanded: boolean;
710
792
  setExpanded(exp: boolean, triggerCallback?: boolean): void;
711
793
  toggle(): void;
@@ -718,7 +800,7 @@ declare module 'flet-box' {
718
800
  margin?: number | { top?: number; right?: number; bottom?: number; left?: number };
719
801
  orientation?: 'horizontal' | 'vertical';
720
802
  }
721
- export function Divider(props?: DividerProps): Widget;
803
+ export function Divider(props?: DividerProps): FletWidget;
722
804
 
723
805
  // =========================================================================
724
806
  // Formularios e interacción
@@ -755,7 +837,9 @@ declare module 'flet-box' {
755
837
  onBlur?: (event: Event) => void;
756
838
  onEnter?: (value: string, event: Event) => void;
757
839
  }
758
- export function Input(props: InputProps): Widget & {
840
+ export function Input(props: InputProps): FletWidget & {
841
+ /** The native `<input>` the widget painted: the only place `placeholder` and `value` are visible. */
842
+ _input: HTMLInputElement;
759
843
  getValue(): string;
760
844
  setValue(value: string): void;
761
845
  isValid(): boolean;
@@ -765,37 +849,52 @@ declare module 'flet-box' {
765
849
  blur(): void;
766
850
  };
767
851
 
768
- export interface RadioProps extends CommonProps {
852
+ export interface RadioProps extends Omit<CommonProps, 'onPress'> {
769
853
  selected?: boolean;
854
+ /**
855
+ * @deprecated Use `onPress` instead — it receives the same boolean.
856
+ */
770
857
  onSelect?: (selected: boolean) => void;
858
+ /** Fired with the new state when the radio is picked. */
859
+ onPress?: (selected: boolean) => void;
771
860
  disabled?: boolean;
772
861
  size?: number;
773
862
  activeColor?: Color;
774
863
  label?: string;
775
864
  name?: string;
776
865
  }
777
- export function Radio(props: RadioProps): Widget & {
866
+ export function Radio(props: RadioProps): FletWidget & {
778
867
  select(): void;
779
868
  unselect(): void;
780
869
  isSelected(): boolean;
781
870
  };
782
871
 
783
- export interface SwitchProps extends CommonProps {
872
+ export interface SwitchProps extends Omit<CommonProps, 'onPress'> {
784
873
  value?: boolean;
874
+ /**
875
+ * @deprecated Use `onPress` instead — it receives the same boolean.
876
+ */
785
877
  onToggle?: (value: boolean) => void;
878
+ /** Fired with the new state when the switch is flipped. */
879
+ onPress?: (value: boolean) => void;
786
880
  disabled?: boolean;
787
881
  size?: 'small' | 'medium' | 'large';
788
882
  activeColor?: Color;
789
883
  label?: string;
790
884
  }
791
- export function Switch(props: SwitchProps): Widget & {
885
+ export function Switch(props: SwitchProps): FletWidget & {
792
886
  updateValue(value: boolean): void;
793
887
  getValue(): boolean;
794
888
  };
795
889
 
796
- export interface CheckboxProps extends CommonProps {
890
+ export interface CheckboxProps extends Omit<CommonProps, 'onPress'> {
797
891
  checked?: boolean;
892
+ /**
893
+ * @deprecated Use `onPress` instead — it receives the same boolean.
894
+ */
798
895
  onCheck?: (checked: boolean) => void;
896
+ /** Fired with the new state when the box is ticked or cleared. */
897
+ onPress?: (checked: boolean) => void;
799
898
  disabled?: boolean;
800
899
  size?: number;
801
900
  activeColor?: Color;
@@ -807,20 +906,23 @@ declare module 'flet-box' {
807
906
  */
808
907
  variant?: 'outlined' | 'filled';
809
908
  }
810
- export function Checkbox(props: CheckboxProps): Widget & {
909
+ export function Checkbox(props: CheckboxProps): FletWidget & {
811
910
  setChecked(checked: boolean, triggerCallback?: boolean): void;
812
911
  getChecked(): boolean;
813
912
  };
814
913
 
815
914
  export type DropdownOption = { label: string; value: any; icon?: string };
816
- export interface DropdownProps extends CommonProps {
915
+ export interface DropdownProps extends Omit<CommonProps, 'onPress'> {
817
916
  options: (string | DropdownOption)[];
818
917
  value?: any;
819
918
  placeholder?: string;
820
919
  disabled?: boolean;
821
920
  label?: string;
822
921
  error?: boolean;
823
- variant?: 'outlined' | 'filled';
922
+ // `text` is not a preset the widget styles — it is the honest name for
923
+ // "no chrome": transparent, borderless, just the label and the chevron,
924
+ // which is how an inline model picker inside a composer is built.
925
+ variant?: 'outlined' | 'filled' | 'text';
824
926
  size?: 'small' | 'medium' | 'large';
825
927
  borderRadius?: number;
826
928
  color?: Color;
@@ -830,9 +932,18 @@ declare module 'flet-box' {
830
932
  clearable?: boolean;
831
933
  width?: number | string;
832
934
  portal?: boolean;
833
- onChange?: (value: any, label: string) => void;
935
+ /**
936
+ * @deprecated Use `onPress` instead — it receives the same value.
937
+ */
938
+ onChange?: (value: any) => void;
939
+ /**
940
+ * Fired when the selection changes, with the chosen value; `null` when the
941
+ * selection is cleared. Only the value is sent — read the label from the
942
+ * option that carries it.
943
+ */
944
+ onPress?: (value: any) => void;
834
945
  }
835
- export function Dropdown(props: DropdownProps): Widget & {
946
+ export function Dropdown(props: DropdownProps): FletWidget & {
836
947
  value: any;
837
948
  options: DropdownOption[];
838
949
  disabled: boolean;
@@ -984,15 +1095,27 @@ declare module 'flet-box' {
984
1095
  leftNavBarWidth?: number;
985
1096
  rightNavBar?: Slot;
986
1097
  rightNavBarWidth?: number;
1098
+ /**
1099
+ * @deprecated Use `leftNavBar` (or `rightNavBar`) instead.
1100
+ */
987
1101
  navSideBar?: Slot;
1102
+ /**
1103
+ * @deprecated Use `leftNavBarWidth` (or `rightNavBarWidth`) instead. The
1104
+ * legacy name was accepted and then ignored — the panel kept the default
1105
+ * width, so a width written here never reached the screen.
1106
+ */
988
1107
  navSideBarWidth?: number;
1108
+ /**
1109
+ * @deprecated The legacy sidebar needed this to say which side it was on.
1110
+ * `leftNavBar` and `rightNavBar` say it with their own name.
1111
+ */
989
1112
  navSideBarPosition?: 'left' | 'right';
990
1113
  routes?: Record<string, any>;
991
1114
  basePath?: string;
992
1115
  backgroundColor?: Color;
993
1116
  closeDrawerOnNavigate?: boolean;
994
1117
  }
995
- export function Scaffold(props: ScaffoldProps): Widget & {
1118
+ export function Scaffold(props: ScaffoldProps): FletWidget & {
996
1119
  updateLeftNavBar(cfg: any): void;
997
1120
  updateRightNavBar(cfg: any): void;
998
1121
  setLeftNavBarWidth(width: number): void;
@@ -1016,7 +1139,7 @@ declare module 'flet-box' {
1016
1139
  forceMobile?: boolean;
1017
1140
  forceDesktop?: boolean;
1018
1141
  }
1019
- export function AdaptiveScaffold(props: AdaptiveScaffoldProps): Widget & {
1142
+ export function AdaptiveScaffold(props: AdaptiveScaffoldProps): FletWidget & {
1020
1143
  updateLeftNavBar(cfg: any): void;
1021
1144
  updateRightNavBar(cfg: any): void;
1022
1145
  setLeftNavBarWidth(width: number): void;
@@ -1049,7 +1172,7 @@ declare module 'flet-box' {
1049
1172
  borderRadius?: number;
1050
1173
  shadow?: boolean | string;
1051
1174
  }
1052
- export function AppBar(props: AppBarProps): Widget & {
1175
+ export function AppBar(props: AppBarProps): FletWidget & {
1053
1176
  setTitle(title: string): void;
1054
1177
  setBackgroundColor(color: string): void;
1055
1178
  show(): void;
@@ -1060,6 +1183,8 @@ declare module 'flet-box' {
1060
1183
  icon?: string;
1061
1184
  label: string;
1062
1185
  route?: string;
1186
+ /** Space between the icon, the label and the trailing icon. */
1187
+ gap?: number;
1063
1188
  onPress?: () => void;
1064
1189
  onSelect?: () => void;
1065
1190
  trailingIcon?: string;
@@ -1071,7 +1196,7 @@ declare module 'flet-box' {
1071
1196
  closeOnPress?: boolean;
1072
1197
  disableTransform?: boolean;
1073
1198
  }
1074
- export function DrawerItem(props: DrawerItemProps): Widget;
1199
+ export function DrawerItem(props: DrawerItemProps): FletWidget;
1075
1200
 
1076
1201
  export interface DrawerInstance {
1077
1202
  open(): void;
@@ -1120,7 +1245,7 @@ declare module 'flet-box' {
1120
1245
  elevation?: number;
1121
1246
  useRouter?: boolean;
1122
1247
  }
1123
- export function BottomNavigation(props: BottomNavigationProps): Widget & {
1248
+ export function BottomNavigation(props: BottomNavigationProps): FletWidget & {
1124
1249
  setActiveIndex(index: number): void;
1125
1250
  getActiveIndex(): number;
1126
1251
  getCurrentRoute(): string | null;
@@ -1138,7 +1263,7 @@ declare module 'flet-box' {
1138
1263
  disabled?: boolean;
1139
1264
  margin?: number;
1140
1265
  }
1141
- export function FloatingActionButton(props: FloatingActionButtonProps): Widget;
1266
+ export function FloatingActionButton(props: FloatingActionButtonProps): FletWidget;
1142
1267
 
1143
1268
  export interface TabsProps extends CommonProps {
1144
1269
  tabs: (string | { label: string; icon?: string; badge?: number | string })[];
@@ -1161,7 +1286,7 @@ declare module 'flet-box' {
1161
1286
  badges?: (number | string)[];
1162
1287
  alignment?: 'left' | 'center' | 'right';
1163
1288
  }
1164
- export function Tabs(props: TabsProps): Widget & {
1289
+ export function Tabs(props: TabsProps): FletWidget & {
1165
1290
  activeIndex: number;
1166
1291
  setActiveTab(index: number): void;
1167
1292
  };
@@ -1177,7 +1302,7 @@ declare module 'flet-box' {
1177
1302
  bgColor?: Color;
1178
1303
  borderRight?: string;
1179
1304
  }
1180
- export function CollapsibleSideBar(props: CollapsibleSideBarProps): Widget & {
1305
+ export function CollapsibleSideBar(props: CollapsibleSideBarProps): FletWidget & {
1181
1306
  updateWidth(width: number): void;
1182
1307
  };
1183
1308
 
@@ -1228,7 +1353,7 @@ declare module 'flet-box' {
1228
1353
  bottom?: number | string;
1229
1354
  left?: number | string;
1230
1355
  }
1231
- export function AnimatedBox(props: AnimatedBoxProps): Widget;
1356
+ export function AnimatedBox(props: AnimatedBoxProps): FletWidget;
1232
1357
 
1233
1358
  export interface AnimatedTextProps extends CommonProps {
1234
1359
  child: Widget;
@@ -1238,7 +1363,7 @@ declare module 'flet-box' {
1238
1363
  delayBetween?: number;
1239
1364
  orientation?: 'row' | 'column';
1240
1365
  }
1241
- export function AnimatedText(props: AnimatedTextProps): Widget;
1366
+ export function AnimatedText(props: AnimatedTextProps): FletWidget;
1242
1367
 
1243
1368
  export interface MatrixRainProps extends CommonProps {
1244
1369
  chars?: string;
@@ -1250,7 +1375,7 @@ declare module 'flet-box' {
1250
1375
  position?: 'fixed' | 'absolute';
1251
1376
  zIndex?: number;
1252
1377
  }
1253
- export function MatrixRain(props?: MatrixRainProps): Widget;
1378
+ export function MatrixRain(props?: MatrixRainProps): FletWidget;
1254
1379
 
1255
1380
  export interface ParallaxBoxProps extends CommonProps {
1256
1381
  child: Widget;
@@ -1264,7 +1389,7 @@ declare module 'flet-box' {
1264
1389
  duration?: number;
1265
1390
  easing?: string;
1266
1391
  }
1267
- export function ParallaxBox(props: ParallaxBoxProps): Widget & {
1392
+ export function ParallaxBox(props: ParallaxBoxProps): FletWidget & {
1268
1393
  updateSpeed(speed: number): void;
1269
1394
  updateDirection(direction: string): void;
1270
1395
  setPosition(x: number, y: number, animate?: boolean): void;
@@ -1442,7 +1567,7 @@ declare module 'flet-box' {
1442
1567
  cellPadding?: Padding;
1443
1568
  headerCellPadding?: Padding;
1444
1569
  }
1445
- export function DataTable(props: DataTableProps): Widget & {
1570
+ export function DataTable(props: DataTableProps): FletWidget & {
1446
1571
  updateData(rows: any[]): void;
1447
1572
  updateColumns(columns: DataTableColumn[]): void;
1448
1573
  };
@@ -1473,7 +1598,7 @@ declare module 'flet-box' {
1473
1598
  showValues?: boolean;
1474
1599
  borderRadius?: number;
1475
1600
  }
1476
- export function Chart(props: ChartProps): Widget & {
1601
+ export function Chart(props: ChartProps): FletWidget & {
1477
1602
  updateData(newData: any[], newLabels?: string[]): void;
1478
1603
  redraw(): void;
1479
1604
  };
@@ -1486,7 +1611,7 @@ declare module 'flet-box' {
1486
1611
  errorCorrection?: 'L' | 'M' | 'Q' | 'H';
1487
1612
  margin?: number;
1488
1613
  }
1489
- export function QRCode(props: QRCodeProps): Widget & {
1614
+ export function QRCode(props: QRCodeProps): FletWidget & {
1490
1615
  updateValue(value: string): void;
1491
1616
  download(filename?: string): void;
1492
1617
  getDataURL(): string;
@@ -1508,7 +1633,7 @@ declare module 'flet-box' {
1508
1633
  lineNumberWidth?: number;
1509
1634
  lineNumberColor?: Color;
1510
1635
  }
1511
- export function CodeViewer(props: CodeViewerProps): Widget & {
1636
+ export function CodeViewer(props: CodeViewerProps): FletWidget & {
1512
1637
  updateCode(code: string): void;
1513
1638
  updateTitle(title: string): void;
1514
1639
  scrollTo(x: number, y: number): void;
@@ -1523,7 +1648,7 @@ declare module 'flet-box' {
1523
1648
  indent?: number;
1524
1649
  }
1525
1650
  /** Paints the reconstructed call of a widget tree. */
1526
- export function Inspector(props: InspectorProps): Widget;
1651
+ export function Inspector(props: InspectorProps): FletWidget;
1527
1652
  /** Rebuilds the call that made a widget, as a string. */
1528
1653
  export function Inspector(widget: Widget, indent?: number): string;
1529
1654
  export function printWidgetCode(widget: Widget): void;
@@ -1542,7 +1667,7 @@ declare module 'flet-box' {
1542
1667
  dragOverlayColor?: Color;
1543
1668
  dragBorderColor?: Color;
1544
1669
  }
1545
- export function DraggBox(props: DraggBoxProps): Widget;
1670
+ export function DraggBox(props: DraggBoxProps): FletWidget;
1546
1671
 
1547
1672
  export interface DroppBoxProps extends CommonProps {
1548
1673
  child: Widget;
@@ -1572,7 +1697,7 @@ declare module 'flet-box' {
1572
1697
  transitionTiming?: string;
1573
1698
  showFeedback?: boolean;
1574
1699
  }
1575
- export function DroppBox(props: DroppBoxProps): Widget;
1700
+ export function DroppBox(props: DroppBoxProps): FletWidget;
1576
1701
 
1577
1702
  export interface CarouselProps extends CommonProps {
1578
1703
  items: (Widget | string | { src: string; alt?: string })[];
@@ -1595,7 +1720,7 @@ declare module 'flet-box' {
1595
1720
  buttonTop?: number | string;
1596
1721
  onIndexChange?: (index: number) => void;
1597
1722
  }
1598
- export function Carousel(props: CarouselProps): Widget & {
1723
+ export function Carousel(props: CarouselProps): FletWidget & {
1599
1724
  next(): void;
1600
1725
  prev(): void;
1601
1726
  goTo(index: number): void;
@@ -1626,13 +1751,44 @@ declare module 'flet-box' {
1626
1751
  borderWidth?: number;
1627
1752
  shadow?: string;
1628
1753
  }
1629
- export function Tooltip(props: TooltipProps): Widget & {
1754
+ export function Tooltip(props: TooltipProps): FletWidget & {
1630
1755
  showTooltip(): void;
1631
1756
  hideTooltip(): void;
1632
1757
  updateContent(newText: string): void;
1633
1758
  updatePosition(): void;
1634
1759
  };
1635
1760
 
1761
+ export type MenuItem = {
1762
+ text: string;
1763
+ icon?: string;
1764
+ onPress?: () => void;
1765
+ disabled?: boolean;
1766
+ danger?: boolean;
1767
+ };
1768
+
1769
+ export interface MenuProps extends CommonProps {
1770
+ items: MenuItem[];
1771
+ /** Accessible name of the trigger and of the menu it opens. */
1772
+ label?: string;
1773
+ icon?: string;
1774
+ /** Width of the open panel. The trigger is a square `size` wide. */
1775
+ width?: number | string;
1776
+ /** Which edge of the trigger the panel aligns to. */
1777
+ align?: 'start' | 'end';
1778
+ disabled?: boolean;
1779
+ /** Mount the panel on `document.body` so no ancestor can clip it. */
1780
+ portal?: boolean;
1781
+ bgColor?: Color;
1782
+ borderRadius?: number;
1783
+ size?: number;
1784
+ }
1785
+
1786
+ export function Menu(props: MenuProps): FletWidget & {
1787
+ open(): void;
1788
+ close(): void;
1789
+ update(props: Partial<MenuProps>): void;
1790
+ };
1791
+
1636
1792
  export interface PaginationProps extends CommonProps {
1637
1793
  totalItems: number;
1638
1794
  pageSize?: number;
@@ -1648,18 +1804,22 @@ declare module 'flet-box' {
1648
1804
  showTotal?: boolean;
1649
1805
  label?: string;
1650
1806
  }
1651
- export function Pagination(props: PaginationProps): Widget;
1652
-
1653
- export interface TreeViewProps extends CommonProps {
1654
- nodes: Array<{
1655
- id: string;
1656
- label: string;
1657
- icon?: string;
1658
- iconColor?: Color;
1659
- children?: any[];
1660
- badge?: string | number;
1661
- }>;
1662
- onSelect?: (node: any) => void;
1807
+ export function Pagination(props: PaginationProps): FletWidget;
1808
+
1809
+ export interface TreeViewNode {
1810
+ id: string;
1811
+ label: string;
1812
+ icon?: string;
1813
+ iconColor?: Color;
1814
+ children?: TreeViewNode[];
1815
+ badge?: string | number;
1816
+ }
1817
+ export interface TreeViewProps extends Omit<CommonProps, 'onPress'> {
1818
+ nodes: TreeViewNode[];
1819
+ /** Fired with the node the reader selected. */
1820
+ onSelect?: (node: TreeViewNode) => void;
1821
+ /** The framework's spelling of `onSelect`, fired with the same node; `onSelect` wins when both are given. */
1822
+ onPress?: (node: TreeViewNode) => void;
1663
1823
  onToggle?: (nodeId: string, expanded: boolean) => void;
1664
1824
  expandedNodes?: string[];
1665
1825
  indent?: number;
@@ -1688,7 +1848,7 @@ declare module 'flet-box' {
1688
1848
  iconSize?: number;
1689
1849
  transitionDuration?: string;
1690
1850
  }
1691
- export function TreeView(props: TreeViewProps): Widget & {
1851
+ export function TreeView(props: TreeViewProps): FletWidget & {
1692
1852
  updateNodes(nodes: any[], selectedId?: string | null): void;
1693
1853
  expandAll(): void;
1694
1854
  collapseAll(): void;
@@ -1721,13 +1881,46 @@ declare module 'flet-box' {
1721
1881
  margin?: Margin;
1722
1882
  width?: number | string;
1723
1883
  }
1724
- export function Stepper(props: StepperProps): Widget & {
1884
+ export function Stepper(props: StepperProps): FletWidget & {
1725
1885
  goTo(index: number): void;
1726
1886
  next(): void;
1727
1887
  back(): void;
1728
1888
  getActiveStep(): number;
1729
1889
  };
1730
1890
 
1891
+ /**
1892
+ * One selectable accent: the two stops a single hue wears, one per theme.
1893
+ * `light` is the deep end (it carries white words on a light page) and `dark`
1894
+ * the lifted end (it carries a dark page's own ink). A swatch paints both
1895
+ * because an accent is the pair, never one of them.
1896
+ */
1897
+ export interface Accent {
1898
+ id: string;
1899
+ label: string;
1900
+ light: string;
1901
+ dark: string;
1902
+ }
1903
+
1904
+ export interface ThemePickerProps extends CommonProps {
1905
+ /** Families to offer. Defaults to `listAccents()`, i.e. everything registered. */
1906
+ accents?: Accent[];
1907
+ /** Edge of one swatch, in framework units. Defaults to 40 — the tap minimum. */
1908
+ size?: number;
1909
+ /** Print each family's name under its swatch. Defaults to false. */
1910
+ showLabels?: boolean;
1911
+ /**
1912
+ * Offer the families as themes: picking one also paints the page, the panels,
1913
+ * the cards and the hairlines. Defaults to false — brand only.
1914
+ */
1915
+ surfaces?: boolean;
1916
+ /** Accessible name of the group. Defaults to `"Accent color"`. */
1917
+ label?: string;
1918
+ disabled?: boolean;
1919
+ /** Called with the id after the accent has been applied to the screen. */
1920
+ onChange?: (id: string) => void;
1921
+ }
1922
+ export function ThemePicker(props?: ThemePickerProps): FletWidget;
1923
+
1731
1924
  export interface SkeletonProps extends CommonProps {
1732
1925
  variant?: 'text' | 'circular' | 'avatar' | 'image' | 'card' | 'listTile' | 'button';
1733
1926
  width?: number | string;
@@ -1742,7 +1935,7 @@ declare module 'flet-box' {
1742
1935
  pulseDuration?: string;
1743
1936
  waveDuration?: string;
1744
1937
  }
1745
- export function Skeleton(props: SkeletonProps): Widget;
1938
+ export function Skeleton(props: SkeletonProps): FletWidget;
1746
1939
 
1747
1940
  export interface InstallButtonProps extends CommonProps {
1748
1941
  text?: string;
@@ -1755,7 +1948,7 @@ declare module 'flet-box' {
1755
1948
  onInstalled?: () => void;
1756
1949
  onClick?: () => void;
1757
1950
  }
1758
- export function InstallButton(props: InstallButtonProps): Widget;
1951
+ export function InstallButton(props: InstallButtonProps): FletWidget;
1759
1952
 
1760
1953
  export interface VideoProps extends Omit<CommonProps, 'ref'> {
1761
1954
  src: string;
@@ -1828,7 +2021,7 @@ declare module 'flet-box' {
1828
2021
  animationDuration?: number;
1829
2022
  onComplete?: () => void;
1830
2023
  ref?: (canvas: HTMLCanvasElement) => void;
1831
- // Nuevas props
2024
+ // New props
1832
2025
  valueFormat?: 'percent' | 'value' | 'custom';
1833
2026
  valueSuffix?: string;
1834
2027
  valuePrefix?: string;
@@ -1850,7 +2043,7 @@ declare module 'flet-box' {
1850
2043
  subtitleSize?: number;
1851
2044
  tooltip?: string;
1852
2045
  }
1853
- export function CircularBar(props: CircularBarProps): Widget & {
2046
+ export function CircularBar(props: CircularBarProps): FletWidget & {
1854
2047
  updateValue(newValue: number, newMax?: number): void;
1855
2048
  };
1856
2049
 
@@ -1891,7 +2084,7 @@ declare module 'flet-box' {
1891
2084
  sliceBorderWidth?: number;
1892
2085
  sliceBorderColor?: Color;
1893
2086
  }
1894
- export function CircularChart(props: CircularChartProps): Widget & {
2087
+ export function CircularChart(props: CircularChartProps): FletWidget & {
1895
2088
  updateData(data: CircularChartSlice[], animate?: boolean): void;
1896
2089
  redraw(): void;
1897
2090
  setCornerRadius(radius: number): void;
@@ -1936,12 +2129,15 @@ declare module 'flet-box' {
1936
2129
  imageBorderRadius?: number;
1937
2130
  padding?: Padding;
1938
2131
  maxHeight?: number;
1939
- overflow?: string;
2132
+ // Same value as the engine routes on every widget: the scroll container of the
2133
+ // document. Declared as a bare `string` it was incompatible with the base
2134
+ // interface, which a declaration reader reports as a broken inheritance.
2135
+ overflow?: 'auto' | 'hidden' | 'visible' | 'scroll' | 'clip';
1940
2136
  backgroundColor?: Color;
1941
2137
  borderRadius?: number;
1942
2138
  allowDangerousHtml?: boolean;
1943
2139
  }
1944
- export function Markdown(props: MarkdownProps): Widget & {
2140
+ export function Markdown(props: MarkdownProps): FletWidget & {
1945
2141
  updateContent(newText: string): void;
1946
2142
  getContent(): string;
1947
2143
  getSource(): string;
@@ -2049,7 +2245,7 @@ declare module 'flet-box' {
2049
2245
  /** Fires on each watched fix, including the ones while `followUser` is off. */
2050
2246
  onUserUpdate?: (fix: MapFix) => void;
2051
2247
  }
2052
- export function Maps(props: MapsProps): Widget & {
2248
+ export function Maps(props: MapsProps): FletWidget & {
2053
2249
  setCenter(position: LatLng, zoom?: number): Widget;
2054
2250
  getCenter(): { lat: number; lng: number };
2055
2251
  getZoom(): number;
@@ -2089,14 +2285,31 @@ declare module 'flet-box' {
2089
2285
  */
2090
2286
  export function App(widget: Widget): Widget;
2091
2287
 
2288
+ /**
2289
+ * The element the factory returns for a native `<input type="file">`: the
2290
+ * factory instance plus the HTML input surface. The framework has no file
2291
+ * control, so an app that needs one builds it with `WidgetFactory` and must be
2292
+ * able to say so:
2293
+ *
2294
+ * ```js
2295
+ * const entrada = WidgetFactory<FletInput>({ tag: 'input' });
2296
+ * entrada.type = 'file';
2297
+ * ```
2298
+ */
2299
+ export type FletInput = WidgetFactoryInstance & HTMLInputElement;
2300
+
2092
2301
  /**
2093
2302
  * The only rendering engine. Turns a tag (or config object) plus props into a
2094
2303
  * real `HTMLElement` with styles, events, children, lifecycle and reactivity.
2304
+ *
2305
+ * The return type is the generic `T`, defaulting to the factory instance. Pass
2306
+ * `FletInput` when the element is a native input the code will drive directly —
2307
+ * otherwise an editor reads `entrada.type` as a missing property.
2095
2308
  */
2096
- export function WidgetFactory(
2309
+ export function WidgetFactory<T extends WidgetFactoryInstance = WidgetFactoryInstance>(
2097
2310
  tag: string | { tag?: string; [prop: string]: any },
2098
2311
  customProps?: Record<string, any>
2099
- ): WidgetFactoryInstance;
2312
+ ): T;
2100
2313
 
2101
2314
  export function createApp(routes: any, options?: { rootId?: string; fallback?: Widget | (() => Widget) }): {
2102
2315
  start(): void;
@@ -2120,7 +2333,7 @@ declare module 'flet-box' {
2120
2333
  export function getHMR(): WebSocket | null;
2121
2334
 
2122
2335
  // =========================================================================
2123
- // Utils (temas, dimensiones, aleatorios, etc.)
2336
+ // Utils (themes, dimensions, random, etc.)
2124
2337
  // =========================================================================
2125
2338
  export const colors: Record<string, string>;
2126
2339
  export const palettes: Record<string, Record<string, string>>;
@@ -2129,6 +2342,49 @@ declare module 'flet-box' {
2129
2342
  themeName: string,
2130
2343
  palette: Record<string, string>
2131
2344
  ): Record<string, string>;
2345
+ /**
2346
+ * Adds or replaces one selectable accent. Each end of the pair may be a single
2347
+ * hex or a five-stop ramp, in which case the accent and its wash are read off
2348
+ * the stops the shipped families use. Repaints only when that id is on screen.
2349
+ */
2350
+ export function registerAccent(accent: {
2351
+ id: string;
2352
+ label?: string;
2353
+ light: string | string[];
2354
+ dark: string | string[];
2355
+ }): Accent | null;
2356
+ /**
2357
+ * Lays an accent over the live palette and persists the choice. `null` (or an
2358
+ * unknown id) takes it back off, and the screen returns to the palette's own
2359
+ * `primary`.
2360
+ *
2361
+ * `{ surfaces: true }` wears it as a theme instead of only as a brand: the page,
2362
+ * the panels, the cards and the hairlines are derived from the same ramp. The
2363
+ * plate (`primaryBg`) keeps coming from the accent's measured wash stop either
2364
+ * way, and the ink scale never moves.
2365
+ */
2366
+ export function setAccent(
2367
+ id: string | null,
2368
+ options?: { surfaces?: boolean },
2369
+ ): Record<string, string>;
2370
+ /** Applies an accent only when the reader has never picked one. Never persists. */
2371
+ export function applyAccentPreference(
2372
+ id: string,
2373
+ options?: { surfaces?: boolean },
2374
+ ): string | null;
2375
+ /** The accent on screen, or `null` when the palette's own `primary` is showing. */
2376
+ export function getAccent(): string | null;
2377
+ /** Whether the live accent also paints the surfaces. */
2378
+ export function getAccentSurfaces(): boolean;
2379
+ /** Every selectable accent, in registration order. */
2380
+ export function listAccents(): Accent[];
2381
+ /** The same list with each family's five stops beside it, for a swatch that shows the ramp. */
2382
+ export function listAccentRamps(): Array<{
2383
+ id: string;
2384
+ label: string;
2385
+ light: string[];
2386
+ dark: string[];
2387
+ }>;
2132
2388
  export function getTheme(): string;
2133
2389
  export function toggleTheme(): string;
2134
2390
  export function getColor(colorName: string, opacity?: number): string;
@@ -2143,6 +2399,9 @@ declare module 'flet-box' {
2143
2399
  toggleTheme: typeof toggleTheme;
2144
2400
  getColor: typeof getColor;
2145
2401
  applySystemTheme: typeof applySystemTheme;
2402
+ setAccent: typeof setAccent;
2403
+ getAccent: typeof getAccent;
2404
+ listAccents: typeof listAccents;
2146
2405
  };
2147
2406
 
2148
2407
  export const clipboard: {
@@ -2462,7 +2721,10 @@ declare module 'flet-box' {
2462
2721
  }): void;
2463
2722
  export function injectKeyframes(name: string, keyframes: string): void;
2464
2723
 
2465
- export function border(width?: number | string, style?: string, color?: string): string;
2724
+ // `color` is required (a colorless border is invisible) and the first two have
2725
+ // runtime defaults, so the type admits `undefined` in their place: a required
2726
+ // parameter cannot simply follow an optional one in a declaration.
2727
+ export function border(width: number | string | undefined, style: string | undefined, color: string): string;
2466
2728
  export function margin(value: number | string | { all?: number; horizontal?: number; vertical?: number; top?: number; right?: number; bottom?: number; left?: number }): string;
2467
2729
  export function padding(value: number | string | { all?: number; horizontal?: number; vertical?: number; top?: number; right?: number; bottom?: number; left?: number }): string;
2468
2730
  export function gradient(type: 'linear' | 'circle' | 'conic', colors: string[], angle?: number): string;
@@ -2490,7 +2752,7 @@ declare module 'flet-box' {
2490
2752
 
2491
2753
  export const color: (value: string | ColorInstance) => ColorInstance;
2492
2754
  export function rgba(r: number, g: number, b: number, a?: number): string;
2493
- export function stackPosition(widget: Widget, props: { top?: any; right?: any; bottom?: any; left?: any }): Widget;
2755
+ export function stackPosition(widget: Widget, props?: StackPositionProps): Widget;
2494
2756
  export function flex(grow: number | { grow?: number; shrink?: number; basis?: string }, shrink?: number, basis?: string): string;
2495
2757
  export function grid(options: { columns?: number | string; rows?: number | string; gap?: number | string | { row?: number; column?: number } }): string;
2496
2758
  export function transition(options: { property?: string; duration?: number; timing?: string; delay?: number } | Array<{ property?: string; duration?: number; timing?: string; delay?: number }>): string;
@@ -2533,7 +2795,18 @@ declare module 'flet-box' {
2533
2795
  export function fromJSON(jsonStr: string): any;
2534
2796
  export function fromEntries(entries: [string, any][]): any;
2535
2797
 
2536
- export function ref<T extends Widget = Widget>(): (widget: T) => T & { update(props: Partial<any>): void };
2798
+ /**
2799
+ * What `ref()` hands back: the callback the framework calls with the widget,
2800
+ * plus the live handle the docs use (`display.update({ text })`). Typing it as
2801
+ * a bare function is why `display.update(...)` was an editor error even though
2802
+ * the helper defines it.
2803
+ */
2804
+ export type Ref<T extends Widget = Widget> = ((widget: T | null) => T | null) & {
2805
+ /** The bound widget, or null before the framework mounts it. */
2806
+ current?: T | null;
2807
+ update(props?: Record<string, any>): void;
2808
+ };
2809
+ export function ref<T extends Widget = Widget>(): Ref<T>;
2537
2810
  export function uuid(): string;
2538
2811
  export function shortId(): string;
2539
2812
  export function numericId(length?: number): string;