flet-box 1.0.4 → 1.0.6

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 (147) hide show
  1. package/README.md +10 -0
  2. package/bin/cli.js +23 -7
  3. package/bin/commands/checkApi.js +761 -0
  4. package/bin/commands/create.js +77 -5
  5. package/bin/utils/dtsProps.js +191 -0
  6. package/bin/utils/moduleExports.js +165 -0
  7. package/bin/utils/neutralise.js +64 -0
  8. package/bin/utils/templates.js +366 -27
  9. package/docs/CONTRIBUTING.md +156 -0
  10. package/docs/README.md +68 -0
  11. package/docs/arquitectura.md +164 -0
  12. package/docs/cli/README.md +542 -0
  13. package/docs/guides/README.md +33 -0
  14. package/docs/guides/app-templates.md +197 -0
  15. package/docs/guides/compatibility.md +95 -0
  16. package/docs/guides/embedding.md +284 -0
  17. package/docs/guides/first-app.md +208 -0
  18. package/docs/guides/frontend-services.md +171 -0
  19. package/docs/guides/minification-and-protection.md +260 -0
  20. package/docs/guides/mobile-and-platforms.md +439 -0
  21. package/docs/guides/online-updates.md +196 -0
  22. package/docs/guides/router.md +282 -0
  23. package/docs/guides/state.md +283 -0
  24. package/docs/guides/syntax-philosophy.md +150 -0
  25. package/docs/guides/utilities.md +241 -0
  26. package/docs/guides/widget-structure.md +163 -0
  27. package/docs/server/README.md +68 -0
  28. package/docs/server/START_HERE.md +121 -0
  29. package/docs/server/api.md +225 -0
  30. package/docs/server/data-services.md +300 -0
  31. package/docs/server/deployment.md +113 -0
  32. package/docs/server/security.md +196 -0
  33. package/docs/services/README.md +79 -0
  34. package/docs/services/RamStore.md +84 -0
  35. package/docs/services/Session.md +84 -0
  36. package/docs/services/Storage.md +88 -0
  37. package/docs/services/http.md +86 -0
  38. package/docs/tools/README.md +138 -0
  39. package/docs/tools/animation.md +87 -0
  40. package/docs/tools/async-ids-log.md +80 -0
  41. package/docs/tools/device.md +132 -0
  42. package/docs/tools/introspection.md +67 -0
  43. package/docs/tools/lists.md +96 -0
  44. package/docs/tools/markdown.md +79 -0
  45. package/docs/tools/reactivity.md +288 -0
  46. package/docs/tools/state.md +103 -0
  47. package/docs/tools/styling.md +92 -0
  48. package/docs/tools/text-and-time.md +89 -0
  49. package/docs/tools/theme.md +102 -0
  50. package/docs/tools/validation.md +75 -0
  51. package/docs/tools/visual-effects.md +84 -0
  52. package/docs/widget/Accordion.md +144 -0
  53. package/docs/widget/AdMob.md +144 -0
  54. package/docs/widget/AdSense.md +133 -0
  55. package/docs/widget/AdaptiveScaffold.md +105 -0
  56. package/docs/widget/AlertDialog.md +103 -0
  57. package/docs/widget/AnimatedBox.md +130 -0
  58. package/docs/widget/AnimatedText.md +123 -0
  59. package/docs/widget/AppBar.md +118 -0
  60. package/docs/widget/Audio.md +135 -0
  61. package/docs/widget/Avatar.md +119 -0
  62. package/docs/widget/Badge.md +128 -0
  63. package/docs/widget/BottomNavigation.md +116 -0
  64. package/docs/widget/BottomSheet.md +125 -0
  65. package/docs/widget/Button.md +137 -0
  66. package/docs/widget/COMMON_PROPS.md +150 -0
  67. package/docs/widget/Card.md +125 -0
  68. package/docs/widget/Carousel.md +151 -0
  69. package/docs/widget/Chart.md +151 -0
  70. package/docs/widget/Checkbox.md +118 -0
  71. package/docs/widget/Chip.md +126 -0
  72. package/docs/widget/CircularBar.md +168 -0
  73. package/docs/widget/CircularChart.md +164 -0
  74. package/docs/widget/CodeViewer.md +130 -0
  75. package/docs/widget/CollapsibleSideBar.md +112 -0
  76. package/docs/widget/Column.md +129 -0
  77. package/docs/widget/Container.md +136 -0
  78. package/docs/widget/DataTable.md +150 -0
  79. package/docs/widget/Divider.md +109 -0
  80. package/docs/widget/DraggBox.md +129 -0
  81. package/docs/widget/Drawer.md +135 -0
  82. package/docs/widget/DrawerItem.md +98 -0
  83. package/docs/widget/Dropdown.md +139 -0
  84. package/docs/widget/DroppBox.md +152 -0
  85. package/docs/widget/FloatingActionButton.md +120 -0
  86. package/docs/widget/GridView.md +140 -0
  87. package/docs/widget/Icon.md +117 -0
  88. package/docs/widget/Image.md +125 -0
  89. package/docs/widget/Input.md +151 -0
  90. package/docs/widget/Inspector.md +92 -0
  91. package/docs/widget/InstallButton.md +128 -0
  92. package/docs/widget/ListTile.md +132 -0
  93. package/docs/widget/ListView.md +138 -0
  94. package/docs/widget/Markdown.md +175 -0
  95. package/docs/widget/MatrixRain.md +122 -0
  96. package/docs/widget/Modal.md +129 -0
  97. package/docs/widget/Pagination.md +135 -0
  98. package/docs/widget/ParallaxBox.md +128 -0
  99. package/docs/widget/ProgressBar.md +130 -0
  100. package/docs/widget/QRCode.md +117 -0
  101. package/docs/widget/README.md +188 -0
  102. package/docs/widget/Radio.md +123 -0
  103. package/docs/widget/Rating.md +131 -0
  104. package/docs/widget/Row.md +131 -0
  105. package/docs/widget/START_HERE.md +146 -0
  106. package/docs/widget/Scaffold.md +152 -0
  107. package/docs/widget/Skeleton.md +130 -0
  108. package/docs/widget/Slider.md +146 -0
  109. package/docs/widget/SnackBar.md +102 -0
  110. package/docs/widget/Stack.md +128 -0
  111. package/docs/widget/Stepper.md +145 -0
  112. package/docs/widget/Switch.md +118 -0
  113. package/docs/widget/Tabs.md +124 -0
  114. package/docs/widget/Text.md +133 -0
  115. package/docs/widget/Tooltip.md +145 -0
  116. package/docs/widget/TreeView.md +176 -0
  117. package/docs/widget/Video.md +127 -0
  118. package/docs/widget/_template.md +61 -0
  119. package/package.json +3 -2
  120. package/src/animations/animate.js +180 -70
  121. package/src/animations/index.js +1 -0
  122. package/src/create-index.sh +1 -1
  123. package/src/index.d.ts +45 -22
  124. package/src/index.js +1 -0
  125. package/src/navigations/AdaptiveScaffold.js +11 -2
  126. package/src/navigations/BottomNavigation.js +10 -3
  127. package/src/navigations/Tabs.js +6 -2
  128. package/src/tools/useState.js +54 -63
  129. package/src/widget-factory/assignProps.js +23 -1
  130. package/src/widget-factory/processProps.js +10 -3
  131. package/src/widget-factory/reactiveValue.js +43 -18
  132. package/src/widget-factory/translateProps.js +777 -901
  133. package/src/widgets/AlertDialog.js +7 -5
  134. package/src/widgets/Checkbox.js +9 -7
  135. package/src/widgets/CircularBar.js +12 -1
  136. package/src/widgets/FloatingActionButton.js +4 -7
  137. package/src/widgets/Image.js +5 -7
  138. package/src/widgets/Input.js +92 -0
  139. package/src/widgets/ListView.js +73 -29
  140. package/src/widgets/Pagination.js +6 -3
  141. package/src/widgets/ProgressBar.js +16 -13
  142. package/src/widgets/Radio.js +6 -7
  143. package/src/widgets/Slider.js +23 -4
  144. package/src/widgets/Stack.js +36 -3
  145. package/src/widgets/Stepper.js +4 -3
  146. package/src/widgets/Switch.js +3 -4
  147. package/src/widgets/TreeView.js +0 -1
package/README.md CHANGED
@@ -95,8 +95,18 @@ flet-box createBundle www # bundle the app into www/
95
95
  flet-box build android # Android debug APK
96
96
  flet-box build ios # iOS Simulator app (macOS + Xcode)
97
97
  flet-box build ios --archive # unsigned iOS archive, sign in Xcode
98
+
99
+ # API lookup + anti-hallucination gate (works offline, in the repo or any app)
100
+ flet-box check-api # scan src/ for invented widgets/props
101
+ flet-box check-api --props Button # print the real props of one widget
102
+ flet-box check-api --list # print every public export
103
+ flet-box check-api --emit-api # (re)generate .fletbox/api/cheatsheet.md
98
104
  ```
99
105
 
106
+ In a generated app these are also `npm run check` (and `npm run check -- --props Button`),
107
+ because `flet-box create` writes `scripts/check-app.mjs` plus the `AGENTS.md` contract
108
+ that points any AI assistant at the real API.
109
+
100
110
  ## Android and iOS
101
111
 
102
112
  `flet-box create` ships the Capacitor config, so the same SPA builds for both platforms. FletBox isn't on the npm registry — link it before installing:
package/bin/cli.js CHANGED
@@ -13,17 +13,15 @@ import { createRequire } from "module";
13
13
  import fs from "fs";
14
14
  import path from "path";
15
15
  import { createProject } from "./commands/create.js";
16
+ import { checkApi } from "./commands/checkApi.js";
16
17
  import { packageManager } from "./commands/package.js";
17
18
  import { createBundle } from "./commands/createBundle.js";
18
19
  import { buildAndroid } from "./commands/buildAndroid.js";
19
20
  import { buildIOS } from "./commands/buildIOS.js";
20
21
  import { runNative } from "./commands/runNative.js";
21
- import { runDevServer } from "./commands/runServer.js";
22
22
  import { createScreen } from "./commands/createScreen.js";
23
23
  import { createComponent } from "./commands/createComponent.js";
24
24
  import { killServer } from "./commands/killServer.js";
25
- import { runBundle } from "./commands/runBundle.js";
26
- import { runCloudflareDemo } from "./commands/runCloudflare.js";
27
25
  import { release } from "./commands/release.js";
28
26
  import { c, gradient, section, banner, divider, width, setupCtrlC } from "./utils/colors.js";
29
27
 
@@ -73,6 +71,11 @@ ${cmd(" └─ [dir]", "target folder (default www)")}
73
71
  ${cmd("release [--patch]", "Bump version, rebuild, tag (OTA release)")}
74
72
  ${cmd(" └─ --minor|--major", "bump that position instead of patch")}
75
73
  ${cmd(" └─ --push", "push the commit + tag to origin")}
74
+ ${cmd("check-api", "Validate the app against the installed flet-box API")}
75
+ ${cmd(" └─ --props <Widget>", "print one widget's real props")}
76
+ ${cmd(" └─ --list", "list every widget")}
77
+ ${cmd(" └─ --emit-api", "write .fletbox/api/cheatsheet.md")}
78
+ ${cmd(" └─ alias", "check | checkApi | doctor")}
76
79
  ${cmd("build android", "Build Android debug APK")}
77
80
  ${cmd("build android --release", "Build unsigned release APK/AAB to sign yourself")}
78
81
  ${cmd("build ios", "Build iOS Simulator app (macOS + Xcode)")}
@@ -262,6 +265,15 @@ async function main() {
262
265
  await release(args.slice(1));
263
266
  break;
264
267
 
268
+ case "check-api":
269
+ case "checkApi":
270
+ case "check":
271
+ case "doctor": {
272
+ const { exitCode } = await checkApi(args.slice(1));
273
+ if (exitCode) process.exit(exitCode);
274
+ break;
275
+ }
276
+
265
277
  case "build":
266
278
  if (args[1] === "android") {
267
279
  buildAndroid(args.slice(2));
@@ -308,7 +320,11 @@ async function main() {
308
320
  runNative(args.slice(1));
309
321
  break;
310
322
  }
311
- await runDevServer({
323
+ // The server commands are the only ones that pull in `ws`/`chokidar`,
324
+ // which are devDependencies: a consumer installing `flet-box` from npm
325
+ // has neither, so loading them at module scope would break every CLI
326
+ // command for them. Import them when a server is actually started.
327
+ await (await import("./commands/runServer.js")).runDevServer({
312
328
  spaMode: false,
313
329
  hotReload: flags.hot,
314
330
  port: flags.port,
@@ -329,7 +345,7 @@ async function main() {
329
345
  !args[1].startsWith("-")
330
346
  ? args[1]
331
347
  : "www";
332
- await runBundle({
348
+ await (await import("./commands/runBundle.js")).runBundle({
333
349
  target: targetDir,
334
350
  port: flags.port,
335
351
  askPort: !flags.portExplicit,
@@ -342,7 +358,7 @@ async function main() {
342
358
  case "runSpa":
343
359
  case "spa":
344
360
  ensureProject();
345
- await runDevServer({
361
+ await (await import("./commands/runServer.js")).runDevServer({
346
362
  spaMode: true,
347
363
  hotReload: true,
348
364
  port: flags.port,
@@ -356,7 +372,7 @@ async function main() {
356
372
  case "demo":
357
373
  case "tunnel":
358
374
  ensureProject();
359
- await runCloudflareDemo({
375
+ await (await import("./commands/runCloudflare.js")).runCloudflareDemo({
360
376
  port: flags.port,
361
377
  logRequests: flags.logRequests,
362
378
  });