flet-box 1.0.7 → 1.0.9

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 (139) hide show
  1. package/README.md +3 -0
  2. package/bin/cli.js +13 -0
  3. package/bin/commands/checkApi.js +13 -1
  4. package/bin/commands/checkUi.js +1369 -0
  5. package/bin/commands/create.js +49 -5
  6. package/bin/commands/createBundle.js +21 -0
  7. package/bin/commands/runServer.js +11 -2
  8. package/bin/utils/pwaShell.js +137 -0
  9. package/bin/utils/templates.js +1398 -443
  10. package/docs/README.md +4 -0
  11. package/docs/cli/README.md +63 -2
  12. package/docs/guides/README.md +2 -0
  13. package/docs/guides/clean-ui.md +211 -0
  14. package/docs/guides/minification-and-protection.md +1 -1
  15. package/docs/guides/mobile-and-platforms.md +31 -0
  16. package/docs/guides/online-updates.md +48 -0
  17. package/docs/tools/README.md +1 -1
  18. package/docs/tools/animation.md +1 -1
  19. package/docs/tools/markdown.md +3 -3
  20. package/docs/tools/theme.md +42 -1
  21. package/docs/widget/Accordion.md +3 -0
  22. package/docs/widget/AdMob.md +4 -1
  23. package/docs/widget/AdSense.md +3 -0
  24. package/docs/widget/AnimatedBox.md +6 -3
  25. package/docs/widget/AnimatedText.md +3 -0
  26. package/docs/widget/Audio.md +3 -0
  27. package/docs/widget/Avatar.md +3 -0
  28. package/docs/widget/Badge.md +3 -0
  29. package/docs/widget/Button.md +3 -0
  30. package/docs/widget/COMMON_PROPS.md +52 -0
  31. package/docs/widget/Card.md +3 -0
  32. package/docs/widget/Carousel.md +3 -0
  33. package/docs/widget/Chart.md +3 -0
  34. package/docs/widget/Checkbox.md +3 -0
  35. package/docs/widget/Chip.md +3 -0
  36. package/docs/widget/CircularBar.md +3 -0
  37. package/docs/widget/CircularChart.md +3 -0
  38. package/docs/widget/CodeViewer.md +3 -0
  39. package/docs/widget/Column.md +3 -0
  40. package/docs/widget/Container.md +3 -0
  41. package/docs/widget/DataTable.md +3 -0
  42. package/docs/widget/Divider.md +3 -0
  43. package/docs/widget/DraggBox.md +3 -0
  44. package/docs/widget/Dropdown.md +3 -0
  45. package/docs/widget/DroppBox.md +3 -0
  46. package/docs/widget/FloatingActionButton.md +3 -0
  47. package/docs/widget/GridView.md +3 -0
  48. package/docs/widget/Icon.md +3 -0
  49. package/docs/widget/Image.md +3 -0
  50. package/docs/widget/Input.md +3 -0
  51. package/docs/widget/Inspector.md +2 -2
  52. package/docs/widget/InstallButton.md +3 -0
  53. package/docs/widget/ListTile.md +3 -0
  54. package/docs/widget/ListView.md +3 -0
  55. package/docs/widget/Maps.md +3 -0
  56. package/docs/widget/Markdown.md +3 -0
  57. package/docs/widget/MatrixRain.md +3 -0
  58. package/docs/widget/Pagination.md +3 -0
  59. package/docs/widget/ParallaxBox.md +3 -0
  60. package/docs/widget/ProgressBar.md +3 -0
  61. package/docs/widget/QRCode.md +3 -0
  62. package/docs/widget/README.md +2 -0
  63. package/docs/widget/Radio.md +4 -1
  64. package/docs/widget/Rating.md +3 -0
  65. package/docs/widget/Row.md +3 -0
  66. package/docs/widget/Skeleton.md +3 -0
  67. package/docs/widget/Slider.md +3 -0
  68. package/docs/widget/Stack.md +3 -0
  69. package/docs/widget/Stepper.md +3 -0
  70. package/docs/widget/Switch.md +3 -0
  71. package/docs/widget/Tabs.md +5 -5
  72. package/docs/widget/Text.md +3 -0
  73. package/docs/widget/Tooltip.md +3 -0
  74. package/docs/widget/TreeView.md +3 -0
  75. package/docs/widget/Video.md +3 -0
  76. package/package.json +2 -2
  77. package/src/animations/AnimatedBox.js +4 -1
  78. package/src/animations/MatrixRain.js +3 -3
  79. package/src/index.d.ts +64 -8
  80. package/src/index.js +1 -0
  81. package/src/navigations/AppBar.js +7 -12
  82. package/src/navigations/BottomNavigation.js +8 -13
  83. package/src/navigations/CollapsibleSideBar.js +30 -8
  84. package/src/navigations/Drawer.js +16 -14
  85. package/src/navigations/DrawerItem.js +3 -1
  86. package/src/navigations/Scaffold.js +26 -12
  87. package/src/navigations/Tabs.js +104 -59
  88. package/src/tools/color.js +54 -0
  89. package/src/tools/index.js +9 -1
  90. package/src/tools/scale.js +41 -0
  91. package/src/tools/shadow.js +20 -0
  92. package/src/utils/index.js +1 -0
  93. package/src/utils/readableInk.js +19 -0
  94. package/src/utils/syntaxHighlight.js +78 -10
  95. package/src/utils/themes.js +265 -58
  96. package/src/utils/units.js +33 -11
  97. package/src/widget-factory/effects.js +56 -5
  98. package/src/widget-factory/processProps.js +10 -1
  99. package/src/widget-factory/remTool.js +15 -29
  100. package/src/widget-factory/stackPosition.js +18 -3
  101. package/src/widget-factory/translateProps.js +28 -0
  102. package/src/widgets/Accordion.js +20 -23
  103. package/src/widgets/AdMob.js +7 -2
  104. package/src/widgets/Avatar.js +18 -12
  105. package/src/widgets/Badge.js +3 -2
  106. package/src/widgets/BottomSheet.js +14 -13
  107. package/src/widgets/Button.js +69 -30
  108. package/src/widgets/Card.js +6 -2
  109. package/src/widgets/Carousel.js +12 -10
  110. package/src/widgets/Chart.js +28 -5
  111. package/src/widgets/Checkbox.js +76 -18
  112. package/src/widgets/Chip.js +31 -10
  113. package/src/widgets/CircularBar.js +7 -7
  114. package/src/widgets/CircularChart.js +26 -8
  115. package/src/widgets/CodeViewer.js +93 -20
  116. package/src/widgets/DataTable.js +17 -11
  117. package/src/widgets/DraggBox.js +2 -1
  118. package/src/widgets/Dropdown.js +26 -13
  119. package/src/widgets/DroppBox.js +4 -2
  120. package/src/widgets/FloatingActionButton.js +13 -7
  121. package/src/widgets/Icon.js +3 -1
  122. package/src/widgets/Input.js +30 -23
  123. package/src/widgets/Inspector.js +54 -1
  124. package/src/widgets/InstallButton.js +6 -4
  125. package/src/widgets/ListTile.js +4 -3
  126. package/src/widgets/ListView.js +30 -12
  127. package/src/widgets/Markdown.js +37 -26
  128. package/src/widgets/Modal.js +14 -11
  129. package/src/widgets/Pagination.js +16 -11
  130. package/src/widgets/ProgressBar.js +6 -4
  131. package/src/widgets/Radio.js +73 -15
  132. package/src/widgets/Rating.js +24 -6
  133. package/src/widgets/Skeleton.js +31 -31
  134. package/src/widgets/Slider.js +29 -18
  135. package/src/widgets/SnackBar.js +35 -39
  136. package/src/widgets/Stepper.js +13 -9
  137. package/src/widgets/Switch.js +59 -18
  138. package/src/widgets/Tooltip.js +12 -10
  139. package/src/widgets/TreeView.js +27 -15
package/README.md CHANGED
@@ -23,6 +23,7 @@ Real DOM · No Virtual DOM · No build config to learn.
23
23
  <br><br>
24
24
 
25
25
  <a href="https://kuko53348.github.io/flet-box-docs/">📖 Docs</a> •
26
+ <a href="https://kuko53348.github.io/flet-box-widgets-exemples/">🧪 Widget gallery</a> •
26
27
  <a href="#quick-start">Quick start</a> •
27
28
  <a href="https://www.youtube.com/@flet-box">▶ YouTube</a> •
28
29
  <a href="#support--sponsorship">❤️ Sponsor</a>
@@ -157,6 +158,8 @@ Read the docs online: **[The FletBox Book — kuko53348.github.io/flet-box-docs]
157
158
 
158
159
  They are **one continuous book** — the cover maps every page: [The FletBox Book source](docs/README.md).
159
160
 
161
+ Rather than read, click: **[the live widget gallery](https://kuko53348.github.io/flet-box-widgets-exemples/)** gives every widget its own page, renders each example in the browser it was written for, and prints the exact call underneath it. The theme toggle in the corner shows the same screen in light and dark, which is the honest way to judge a default color.
162
+
160
163
  - [Your first app](docs/guides/first-app.md) — build a working todo app in 20 minutes
161
164
  - [The widget book](docs/widget/README.md) — every widget with property tables and examples
162
165
  - [State, Router & Services](docs/guides/state.md) — shared state, routing, storage, and HTTP
package/bin/cli.js CHANGED
@@ -14,6 +14,7 @@ import fs from "fs";
14
14
  import path from "path";
15
15
  import { createProject } from "./commands/create.js";
16
16
  import { checkApi } from "./commands/checkApi.js";
17
+ import { checkUi } from "./commands/checkUi.js";
17
18
  import { auditFix } from "./commands/auditFix.js";
18
19
  import { toPng } from "./commands/toPng.js";
19
20
  import { images } from "./commands/images.js";
@@ -86,6 +87,10 @@ ${cmd("unpack <Widget>", "Everything one widget really accepts, and what works")
86
87
  ${cmd(" └─ --example", "paste-ready call using only verified props")}
87
88
  ${cmd(" └─ --diff", "what the docs or types claim that the code ignores")}
88
89
  ${cmd(" └─ unpack --all", "every widget; --json / --md write .fletbox/api/")}
90
+ ${cmd("check-ui", "Clean-UI gate: tokens, 8-based scale, tap targets, WCAG contrast")}
91
+ ${cmd(" └─ --tokens", "print the measured contrast of every color token")}
92
+ ${cmd(" └─ --strict", "fail on contrast warnings too")}
93
+ ${cmd(" └─ alias", "ui | checkUi")}
89
94
  ${cmd("audit-fix", "Rewrite broken imports, missing imports and misspelled props")}
90
95
  ${cmd(" └─ --only imports|props", "run one repair instead of both")}
91
96
  ${cmd(" └─ alias", "fix-imports | fix-path-imports | auditFix")}
@@ -315,6 +320,14 @@ async function main() {
315
320
  break;
316
321
  }
317
322
 
323
+ case "check-ui":
324
+ case "checkUi":
325
+ case "ui": {
326
+ const { exitCode } = await checkUi(args.slice(1));
327
+ if (exitCode) process.exit(exitCode);
328
+ break;
329
+ }
330
+
318
331
  case "audit-fix":
319
332
  case "auditFix":
320
333
  case "fix-imports":
@@ -234,6 +234,13 @@ export const collectSources = (projectRoot) => {
234
234
  /**
235
235
  * Read the keys of an object literal starting at its opening brace.
236
236
  *
237
+ * Only the object's own level is scanned: a comma inside an array, a call or a
238
+ * nested brace belongs to that inner expression, not to the props object.
239
+ * Without the group counter, `children: [slot, line]` was split on its inner
240
+ * commas and every widget variable in the list was reported as a shorthand prop
241
+ * (`Column({ line })` — UNKNOWN_PROP), which is the single most common shape in
242
+ * a FletBox app.
243
+ *
237
244
  * @param {string} code Comment/string-free source.
238
245
  * @param {number} open Index of `{`.
239
246
  * @returns {{ keys: string[], opaque: boolean }} `opaque` when a top-level
@@ -242,6 +249,7 @@ export const collectSources = (projectRoot) => {
242
249
  const literalKeys = (code, open) => {
243
250
  const keys = [];
244
251
  let depth = 0;
252
+ let group = 0;
245
253
  let current = "";
246
254
  let opaque = false;
247
255
  const flush = () => {
@@ -267,7 +275,11 @@ const literalKeys = (code, open) => {
267
275
  flush();
268
276
  return { keys, opaque };
269
277
  }
270
- } else if (depth === 1 && ch === ",") {
278
+ } else if (ch === "[" || ch === "(") {
279
+ group++;
280
+ } else if (ch === "]" || ch === ")") {
281
+ if (group > 0) group--;
282
+ } else if (depth === 1 && group === 0 && ch === ",") {
271
283
  flush();
272
284
  continue;
273
285
  }