flet-box 1.0.9 → 1.1.1

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 (132) hide show
  1. package/bin/commands/checkUi.js +327 -46
  2. package/bin/commands/create.js +48 -19
  3. package/bin/commands/createScreen.js +1 -1
  4. package/bin/commands/runBundle.js +1 -1
  5. package/bin/utils/colors.js +0 -8
  6. package/bin/utils/helpers.js +0 -5
  7. package/bin/utils/images/jpeg.js +2 -3
  8. package/bin/utils/skills.js +59 -0
  9. package/bin/utils/templates.js +196 -575
  10. package/docs/README.md +3 -1
  11. package/docs/cli/README.md +18 -1
  12. package/docs/guides/README.md +6 -1
  13. package/docs/guides/accessibility.md +282 -0
  14. package/docs/guides/clean-ui.md +84 -21
  15. package/docs/guides/minification-and-protection.md +1 -1
  16. package/docs/guides/mobile-and-platforms.md +51 -0
  17. package/docs/guides/utilities.md +116 -4
  18. package/docs/guides/widget-structure.md +30 -0
  19. package/docs/tools/README.md +1 -1
  20. package/docs/tools/animation.md +134 -11
  21. package/docs/tools/device.md +75 -3
  22. package/docs/tools/text-and-time.md +116 -6
  23. package/docs/widget/Accordion.md +2 -0
  24. package/docs/widget/AnimatedBox.md +46 -20
  25. package/docs/widget/AnimatedText.md +13 -7
  26. package/docs/widget/Badge.md +1 -0
  27. package/docs/widget/COMMON_PROPS.md +26 -3
  28. package/docs/widget/Chart.md +1 -0
  29. package/docs/widget/Checkbox.md +7 -1
  30. package/docs/widget/CircularChart.md +2 -0
  31. package/docs/widget/Drawer.md +1 -0
  32. package/docs/widget/GridView.md +4 -1
  33. package/docs/widget/Input.md +2 -0
  34. package/docs/widget/InstallButton.md +1 -0
  35. package/docs/widget/Markdown.md +4 -0
  36. package/docs/widget/Rating.md +2 -0
  37. package/docs/widget/Slider.md +2 -0
  38. package/docs/widget/Stack.md +6 -5
  39. package/docs/widget/Stepper.md +2 -0
  40. package/docs/widget/Tooltip.md +3 -1
  41. package/package.json +4 -2
  42. package/skills/fletbox-design/SKILL.md +949 -0
  43. package/skills/fletbox-memory/SKILL.md +134 -0
  44. package/skills/fletbox-motion/SKILL.md +266 -0
  45. package/skills/fletbox-rules/SKILL.md +293 -0
  46. package/src/animations/AnimatedBox.js +321 -226
  47. package/src/animations/MatrixRain.js +7 -1
  48. package/src/animations/ParallaxBox.js +13 -10
  49. package/src/animations/animate.js +269 -106
  50. package/src/animations/color.js +91 -0
  51. package/src/animations/easings.js +275 -0
  52. package/src/animations/index.js +21 -0
  53. package/src/animations/motion.js +204 -0
  54. package/src/animations/transitions.js +327 -0
  55. package/src/core/runApp.js +0 -6
  56. package/src/helpers/boxEdges.js +69 -0
  57. package/src/helpers/html.js +39 -0
  58. package/src/index.d.ts +377 -25
  59. package/src/index.js +77 -0
  60. package/src/navigations/AdaptiveScaffold.js +6 -2
  61. package/src/navigations/AppBar.js +16 -7
  62. package/src/navigations/BottomNavigation.js +24 -1
  63. package/src/navigations/CollapsibleSideBar.js +0 -1
  64. package/src/navigations/Drawer.js +32 -1
  65. package/src/navigations/DrawerItem.js +1 -1
  66. package/src/navigations/Router.js +0 -1
  67. package/src/navigations/Scaffold.js +9 -3
  68. package/src/navigations/Tabs.js +104 -31
  69. package/src/services/RamStore.js +1 -2
  70. package/src/tools/breakpoints.js +113 -0
  71. package/src/tools/createList.js +0 -2
  72. package/src/tools/fonts.js +99 -0
  73. package/src/tools/index.js +74 -1
  74. package/src/tools/margin.js +5 -63
  75. package/src/tools/padding.js +5 -63
  76. package/src/tools/print.js +0 -8
  77. package/src/tools/scale.js +9 -2
  78. package/src/tools/time.js +56 -15
  79. package/src/tools/useState.js +1 -54
  80. package/src/utils/fieldFont.js +77 -0
  81. package/src/utils/focusRing.js +73 -0
  82. package/src/utils/focusScope.js +113 -0
  83. package/src/utils/markdownParser.js +7 -9
  84. package/src/utils/readableInk.js +7 -1
  85. package/src/utils/stackLayout.js +55 -0
  86. package/src/utils/styleInjector.js +25 -0
  87. package/src/utils/syntaxHighlight.js +1 -17
  88. package/src/utils/themes.js +31 -0
  89. package/src/utils/visualEffects.js +49 -47
  90. package/src/widget-factory/createWidget.js +16 -3
  91. package/src/widget-factory/effects.js +76 -3
  92. package/src/widget-factory/reactiveValue.js +0 -7
  93. package/src/widget-factory/tools.js +26 -143
  94. package/src/widget-factory/translateProps.js +5 -0
  95. package/src/widget-factory/widgetFactory.js +1 -1
  96. package/src/widgets/Accordion.js +70 -12
  97. package/src/widgets/AdMob.js +1 -1
  98. package/src/widgets/AdSense.js +1 -1
  99. package/src/widgets/AlertDialog.js +11 -9
  100. package/src/widgets/Avatar.js +10 -1
  101. package/src/widgets/Badge.js +7 -1
  102. package/src/widgets/BottomSheet.js +39 -5
  103. package/src/widgets/Chart.js +41 -9
  104. package/src/widgets/Checkbox.js +59 -9
  105. package/src/widgets/Chip.js +13 -1
  106. package/src/widgets/CircularBar.js +17 -5
  107. package/src/widgets/CircularChart.js +24 -2
  108. package/src/widgets/CodeViewer.js +5 -3
  109. package/src/widgets/Dropdown.js +223 -20
  110. package/src/widgets/GridView.js +17 -1
  111. package/src/widgets/Icon.js +21 -0
  112. package/src/widgets/Input.js +75 -44
  113. package/src/widgets/InstallButton.js +8 -2
  114. package/src/widgets/ListTile.js +6 -5
  115. package/src/widgets/ListView.js +21 -7
  116. package/src/widgets/Markdown.js +25 -44
  117. package/src/widgets/Modal.js +43 -6
  118. package/src/widgets/Pagination.js +35 -3
  119. package/src/widgets/ProgressBar.js +18 -0
  120. package/src/widgets/Radio.js +7 -0
  121. package/src/widgets/Rating.js +104 -16
  122. package/src/widgets/Skeleton.js +9 -5
  123. package/src/widgets/Slider.js +87 -7
  124. package/src/widgets/SnackBar.js +30 -1
  125. package/src/widgets/Stack.js +25 -13
  126. package/src/widgets/Stepper.js +112 -64
  127. package/src/widgets/Switch.js +10 -1
  128. package/src/widgets/Tooltip.js +93 -10
  129. package/src/widgets/TreeView.js +5 -5
  130. package/src/create-index.sh +0 -237
  131. package/src/widget-factory/pixTool.js +0 -40
  132. package/src/widget-factory/stringTool.js +0 -26
@@ -73,8 +73,3 @@ export const execCmd = (cmd) => {
73
73
  return false;
74
74
  }
75
75
  };
76
-
77
- // Fixed: Now returns actual package path
78
- export const getPackagePath = () => {
79
- return path.join(process.cwd(), "node_modules", "flet-box");
80
- };
@@ -338,7 +338,7 @@ export const decodeJpeg = (buf) => {
338
338
  const decodeScan = (scan, ctx) => {
339
339
  const { buf, components, width, height, maxH, maxV, block, scratch } = ctx;
340
340
  const { restartInterval, tables: { quant, dc, ac } } = scan;
341
- const specs = readScanHeader(scan.payload, components.length);
341
+ const specs = readScanHeader(scan.payload);
342
342
  if (specs.length !== components.length && specs.length !== 1) {
343
343
  throw new Error(`JPEG scan covers ${specs.length} of ${components.length} components, which is neither interleaved nor single-component`);
344
344
  }
@@ -558,11 +558,10 @@ const readDht = (payload, dc, ac) => {
558
558
  * scan.
559
559
  *
560
560
  * @param {Buffer} payload
561
- * @param {number} componentCount
562
561
  * @returns {{ id: number, tables: number }[]} Component specifiers, in scan order.
563
562
  * @throws {UnsupportedImage} For a progressive or refined scan.
564
563
  */
565
- const readScanHeader = (payload, componentCount) => {
564
+ const readScanHeader = (payload) => {
566
565
  const count = payload[0];
567
566
  if (payload.length < 4 + count * 2) throw new Error("JPEG scan header is truncated");
568
567
  const specs = [];
@@ -0,0 +1,59 @@
1
+ // bin/utils/skills.js
2
+ //
3
+ // The `skills/` folder at the package root is the ONLY source for the agent
4
+ // skills. Claude Code and Qoder load `.claude/skills/<name>/SKILL.md` and
5
+ // `.qoder/skills/<name>/SKILL.md` by frontmatter description, so `flet-box create`
6
+ // copies each file into both roots byte-for-byte. Keeping the text in a real
7
+ // markdown file (instead of a 450-line array of strings in templates.js) means an
8
+ // editor, a diff and `scripts/check-skills.mjs` can all read the same bytes the
9
+ // agent will.
10
+ //
11
+ // Node core only: `bin/` may not import a devDependency at module scope.
12
+
13
+ import fs from "node:fs";
14
+ import path from "node:path";
15
+ import { fileURLToPath } from "node:url";
16
+
17
+ const packageDir = path.join(path.dirname(fileURLToPath(import.meta.url)), "..", "..");
18
+
19
+ /** Absolute path of the folder that holds every shipped skill. */
20
+ export const skillRoot = () => path.join(packageDir, "skills");
21
+
22
+ /** Kebab-case folder names, sorted, skipping anything without a SKILL.md. */
23
+ export const skillNames = () => {
24
+ let entries = [];
25
+ try {
26
+ entries = fs.readdirSync(skillRoot(), { withFileTypes: true });
27
+ } catch {
28
+ return [];
29
+ }
30
+ return entries
31
+ .filter((entry) => entry.isDirectory())
32
+ .map((entry) => entry.name)
33
+ .filter((name) => fs.existsSync(path.join(skillRoot(), name, "SKILL.md")))
34
+ .sort();
35
+ };
36
+
37
+ /**
38
+ * The full skill text, frontmatter included.
39
+ * @throws when the skill does not exist — a missing skill is a build error, not
40
+ * a silent skip, or an app ships with half the contract and no one notices.
41
+ */
42
+ export const readSkill = (name) =>
43
+ fs.readFileSync(path.join(skillRoot(), name, "SKILL.md"), "utf8");
44
+
45
+ /** The `key: value` lines between the two `---` fences. */
46
+ export const readFrontmatter = (name) => {
47
+ const text = readSkill(name);
48
+ const match = /^---\n([\s\S]*?)\n---/.exec(text);
49
+ if (!match) throw new Error(`skill "${name}" has no frontmatter block`);
50
+ const fields = {};
51
+ for (const line of match[1].split("\n")) {
52
+ const pair = /^([A-Za-z][A-Za-z0-9_-]*):\s*(.*)$/.exec(line);
53
+ if (pair) fields[pair[1]] = pair[2];
54
+ }
55
+ return fields;
56
+ };
57
+
58
+ /** One short sentence for a Cursor rule or an index: the description field. */
59
+ export const skillDescription = (name) => readFrontmatter(name).description || name;