flet-box 1.0.9 → 1.1.0
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/commands/checkUi.js +53 -3
- package/bin/commands/create.js +44 -19
- package/bin/utils/skills.js +59 -0
- package/bin/utils/templates.js +118 -502
- package/docs/README.md +1 -1
- package/docs/guides/README.md +3 -1
- package/docs/guides/clean-ui.md +35 -17
- package/package.json +3 -2
- package/skills/fletbox-design/SKILL.md +573 -0
- package/skills/fletbox-memory/SKILL.md +134 -0
- package/skills/fletbox-motion/SKILL.md +168 -0
- package/skills/fletbox-rules/SKILL.md +154 -0
- package/src/utils/themes.js +16 -0
package/docs/README.md
CHANGED
|
@@ -16,7 +16,7 @@ This documentation is one continuous book. Start at **Chapter 0** and follow the
|
|
|
16
16
|
| 9 | [State, Router & Services](guides/state.md) | Shared state, navigation routes, storage, and HTTP | Intermediate |
|
|
17
17
|
| 10 | [Tools & Utilities](tools/README.md) | The helper functions that ship with the framework | Intermediate |
|
|
18
18
|
| 11 | [The CLI](cli/README.md) | Create, run, and build projects with `flet-box` | Intermediate |
|
|
19
|
-
| 12 | [Clean UI](guides/clean-ui.md) | The
|
|
19
|
+
| 12 | [Clean UI](guides/clean-ui.md) | The four skills every app ships with, the design system they hold, and the gate that enforces it | Intermediate |
|
|
20
20
|
| A | [Appendices](guides/minification-and-protection.md) | Minification, mobile, compatibility, embedding, online updates (OTA) | Advanced |
|
|
21
21
|
|
|
22
22
|
> **Levels.** *Beginner:* start here and read in order. *Intermediate:* continue in order — you are comfortable with widgets. *Advanced:* for when you ship, skip on a first read.
|
package/docs/guides/README.md
CHANGED
|
@@ -10,7 +10,9 @@ This directory is the **conceptual index** of FletBox: how to build apps, set up
|
|
|
10
10
|
- **[Frontend services](frontend-services.md)** — Chapter 9 · the practical walkthrough of the three storage layers (`RamStore`, `Session`, `Storage`) and the HTTP client.
|
|
11
11
|
- **[FletBox utilities](utilities.md)** — Chapter 10 · layout/theme/format helpers and validator tools.
|
|
12
12
|
- **[The CLI](../cli/README.md)** — Chapter 11 · create, run, and build projects with `flet-box`.
|
|
13
|
-
- **[Clean UI](clean-ui.md)** — Chapter 12 · the
|
|
13
|
+
- **[Clean UI](clean-ui.md)** — Chapter 12 · the four skills `flet-box create`
|
|
14
|
+
installs, the token scale, the 25 rules, and the `flet-box check-ui` gate that
|
|
15
|
+
enforces them.
|
|
14
16
|
- **[Widget structure](widget-structure.md)** — the canonical, modular shape every widget follows (and how new ones are added).
|
|
15
17
|
|
|
16
18
|
## Appendices (Advanced — for shipping)
|
package/docs/guides/clean-ui.md
CHANGED
|
@@ -5,8 +5,9 @@ defaults, and every later screen copies the screen before it. This page is the
|
|
|
5
5
|
contract that makes the copy look like one product — the numbers, the tokens,
|
|
6
6
|
and the two commands that prove a screen obeys them.
|
|
7
7
|
|
|
8
|
-
It is the published version of the
|
|
9
|
-
|
|
8
|
+
It is the published version of the `fletbox-design` skill — one of four files in
|
|
9
|
+
the framework's `skills/` folder that `flet-box create` copies into every app — so
|
|
10
|
+
the app's agent and the framework's documentation cannot disagree.
|
|
10
11
|
|
|
11
12
|
## The two gates
|
|
12
13
|
|
|
@@ -26,12 +27,24 @@ one replaces opening the page.
|
|
|
26
27
|
|
|
27
28
|
## Where the rules live
|
|
28
29
|
|
|
30
|
+
A generated app is handed four skills — one file per subject, in a visible
|
|
31
|
+
`skills/` folder at its root, mirrored byte for byte to `.claude/skills/` and
|
|
32
|
+
`.qoder/skills/` because that is where those assistants load a skill from, and
|
|
33
|
+
pointed at from one `.cursor/rules/<name>.mdc` each:
|
|
34
|
+
|
|
35
|
+
| Skill | What it owns |
|
|
36
|
+
| --- | --- |
|
|
37
|
+
| `fletbox-rules` | The working contract: FletBox syntax only, never invent an API and the four ways to look one up, the rem rule, aliases, cleanup, the two gates, the memory duty. |
|
|
38
|
+
| `fletbox-design` | The 25 numbered rules below — tokens, the scale, hierarchy, the four states, measured contrast, composition, the framework traps, the dated tells, density. |
|
|
39
|
+
| `fletbox-motion` | Whether a thing may move at all, and through which of `AnimatedBox`, `AnimatedText`, `ParallaxBox` or `animate`. |
|
|
40
|
+
| `fletbox-memory` | The `.fletbox/memory/` journal that hands progress from one AI to the next. |
|
|
41
|
+
|
|
29
42
|
| Home | What it holds |
|
|
30
43
|
| --- | --- |
|
|
31
|
-
|
|
|
44
|
+
| `skills/fletbox-design/SKILL.md` (framework) → `skills/…`, `.claude/skills/…`, `.qoder/skills/…` (app) | The rules as the agent reads them, in 25 numbered sections. The app's copies are generated; edit the framework file and regenerate, never the mirror. |
|
|
32
45
|
| `AGENTS.md` §4 of the app | The short version: one brand color per screen, no hex literals, spacing and radius only from the scale. |
|
|
33
46
|
| `src/tools/scale.js` in the framework | The tables themselves — `SPACING_SCALE`, `RADIUS_SCALE`, `TYPE_SCALE`, `TAP_MINIMUM`, `PILL`, `LABEL_TEXT`. |
|
|
34
|
-
| `bin/commands/checkUi.js` | The gate. It re-exports those same tables instead of keeping its own copy. |
|
|
47
|
+
| `bin/commands/checkUi.js` | The gate. It re-exports those same tables instead of keeping its own copy, and `scripts/check-skills.mjs` fails when a skill and the gate stop naming the same codes. |
|
|
35
48
|
|
|
36
49
|
That last line matters more than it looks. A gate that carries its own numbers
|
|
37
50
|
drifts from the widgets, and the app then gets told to be clean by values the
|
|
@@ -80,7 +93,7 @@ The framework keeps this honest with its own gate, `scripts/check-widget-scale.m
|
|
|
80
93
|
(part of `npm test`): a length written straight to `el.style.*` that is neither
|
|
81
94
|
`toREM(...)` nor measured geometry fails the build.
|
|
82
95
|
|
|
83
|
-
## The
|
|
96
|
+
## The 25 rules
|
|
84
97
|
|
|
85
98
|
When two of them conflict, take them in this order: **consistency · clarity ·
|
|
86
99
|
accessibility · usability · scalability · maintainability · conversion**.
|
|
@@ -104,10 +117,14 @@ accessibility · usability · scalability · maintainability · conversion**.
|
|
|
104
117
|
| 14 | Destructive actions designed last | A delete that is the closest, fastest, most colorful thing on the screen. |
|
|
105
118
|
| 15 | Reduce interaction cost | Taps, scrolls and keystrokes that carry no information. |
|
|
106
119
|
| 16 | Respect the platform | Fighting the browser's own conventions — back, scroll, text selection. |
|
|
107
|
-
| 17 |
|
|
108
|
-
| 18 |
|
|
109
|
-
| 19 |
|
|
110
|
-
| 20 |
|
|
120
|
+
| 17 | Composition starts as a sentence | A screen that begins as "a hero, then three cards, then a footer" instead of a decision the page carries. |
|
|
121
|
+
| 18 | The framework traps | `Container` assumed invisible, a `flex: 1` with no sibling, `alignItems: "center"` mistaken for centered text, absolute coordinates where a `Stack` belongs. |
|
|
122
|
+
| 19 | The dated tells | An eyebrow label, `01 · 02 · 03`, glass everywhere, resting shadows, a hairline `Divider` under every row, copy that says "seamless". |
|
|
123
|
+
| 20 | Density is one dial | Two rhythms in one screen — a gap, a padding and a body size chosen three different times. |
|
|
124
|
+
| 21 | The review | Shipping before reading your own diff as the user. |
|
|
125
|
+
| 22 | Where these books are wrong | Following a guideline that measurement disagrees with. |
|
|
126
|
+
| 23 | What no checker can see | Taste, hierarchy in the wild, whether the screen solves the problem. |
|
|
127
|
+
| 24 | The loop | Fixing the checker instead of the code, or leaving a rule you had to break undocumented. |
|
|
111
128
|
|
|
112
129
|
## What `flet-box check-ui` proves
|
|
113
130
|
|
|
@@ -123,12 +140,12 @@ judging yours. Each finding carries a code, and the code maps to a rule above.
|
|
|
123
140
|
| `OFF_SCALE_SPACING` | 07 | A padding, margin, gap or size off the spacing scale — including inside a `"12px 20px"` shorthand. |
|
|
124
141
|
| `OFF_SCALE_RADIUS` | 03 | A corner radius that is not a scale step. |
|
|
125
142
|
| `OFF_SCALE_TYPE` | 08 | A font size off the type scale. |
|
|
126
|
-
| `SMALL_TAP_TARGET` |
|
|
143
|
+
| `SMALL_TAP_TARGET` | 03 | A pressable widget under the Fitts floor, including a bare `Icon` with `onPress`. The floor is a scale value, so rule 03 owns it. |
|
|
127
144
|
| `LOW_CONTRAST` | 11 | Text measured below AA against the fill it actually sits on. |
|
|
128
145
|
| `UNLABELED_FIELD` | 13 | An `Input` or `Dropdown` with neither a `label` nor a `placeholder`. |
|
|
129
|
-
| `UNLABELED_TOGGLE` |
|
|
146
|
+
| `UNLABELED_TOGGLE` | 11 | A `Switch`, `Checkbox` or `Radio` with nothing to say what it toggles. |
|
|
130
147
|
| `DESTRUCTIVE_COLOR` | 14 | A delete/remove verb rendered in the brand fill instead of the danger one. |
|
|
131
|
-
| `UNREADABLE` |
|
|
148
|
+
| `UNREADABLE` | 00 | A file the scanner could not parse, reported rather than skipped — and nothing else in that file was judged. |
|
|
132
149
|
|
|
133
150
|
### Warnings (fail with `--strict`)
|
|
134
151
|
|
|
@@ -140,17 +157,17 @@ judging yours. Each finding carries a code, and the code maps to a rule above.
|
|
|
140
157
|
| `HAND_MIXED_COLOR` | 03 | `colors.primary + "22"` — a one-off shade no other screen can reuse. |
|
|
141
158
|
| `DEAD_ELEVATION` | 10 | A numeric `elevation` on a widget that never reads it: CSS drops the bare number and the box stays flat in silence. |
|
|
142
159
|
| `IMAGE_NO_ALT` | 11 | An `Image` with no `alt` — `alt: ""` is a decision, a missing prop is an oversight. |
|
|
143
|
-
| `ICON_ONLY_CONTROL` |
|
|
160
|
+
| `ICON_ONLY_CONTROL` | 11 | A pressable glyph with no name; wrap it in `Tooltip({ text, child })`. |
|
|
144
161
|
| `CENTERED_BODY_TEXT` | 08 | A paragraph centered; a paragraph needs a left edge to find the next line. |
|
|
145
|
-
| `GENERIC_ACTION_LABEL` |
|
|
162
|
+
| `GENERIC_ACTION_LABEL` | 14 | "OK", "Submit", "Click here" — a label that says nothing about what pressing it does. |
|
|
146
163
|
| `CONFIRM_ORDER` | 14 | A destructive button placed before Cancel in the same row. |
|
|
147
|
-
| `UNCONSTRAINED_FORM_WIDTH` |
|
|
164
|
+
| `UNCONSTRAINED_FORM_WIDTH` | 13 | A form block whose fields run to the full width of a desktop window. |
|
|
148
165
|
|
|
149
166
|
### Informational
|
|
150
167
|
|
|
151
168
|
| Code | Rule | What it says |
|
|
152
169
|
| --- | --- | --- |
|
|
153
|
-
| `SMALL_PRESET` |
|
|
170
|
+
| `SMALL_PRESET` | 03 | `size: "small"` on a control that is the screen's main action (~30px). |
|
|
154
171
|
| `CROWDED_FORM` | 06 | Many fields in one file: group them, or split the task. |
|
|
155
172
|
| `LIST_WITHOUT_STATE` | 12 | A list with no loading, empty or failed state in this file. |
|
|
156
173
|
| `MULTIPLE_PRIMARY_ACTIONS` | 04 | Several filled buttons on one screen. |
|
|
@@ -190,7 +207,8 @@ right twice, it is a defect in the scale, not in the app.
|
|
|
190
207
|
|
|
191
208
|
`check-ui` has no eyes. It cannot tell you that the screen is ugly, that the
|
|
192
209
|
hierarchy reads wrong at a glance, or that the flow does not solve the user's
|
|
193
|
-
problem. Those are rules 17
|
|
210
|
+
problem. Those are rules 17, 19, 21 and 23 — composition, the tells, the review
|
|
211
|
+
and this section — and they are the ones that need a person.
|
|
194
212
|
Run the gate, then open the page.
|
|
195
213
|
|
|
196
214
|
## Related pages
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "flet-box",
|
|
3
|
-
"version": "1.0
|
|
3
|
+
"version": "1.1.0",
|
|
4
4
|
"description": "Declarative, zero-dependency UI framework in vanilla JS — ship web, PWA, Android and iOS from one codebase",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "src/index.js",
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
"dev": "node bin/cli.js run --hot",
|
|
20
20
|
"build": "node bin/cli.js createBundle",
|
|
21
21
|
"release": "node bin/cli.js release",
|
|
22
|
-
"test": "node scripts/check-widgets.mjs && node scripts/check-widget-scale.mjs && node scripts/check-prop-registry.mjs && node scripts/check-docs-props.mjs && node scripts/check-api-surface.mjs && node scripts/check-api-propscan.mjs && node scripts/check-router-base.mjs && node scripts/check-clean-ui.mjs && node scripts/check-ota-assets.mjs && node scripts/check-pwa-shell.mjs && node scripts/check-cli-install.mjs && python3 tools/snippets-creator-flet-box/build_snippets.py --check && node scripts/check-snippets.mjs",
|
|
22
|
+
"test": "node scripts/check-widgets.mjs && node scripts/check-widget-scale.mjs && node scripts/check-prop-registry.mjs && node scripts/check-docs-props.mjs && node scripts/check-api-surface.mjs && node scripts/check-api-propscan.mjs && node scripts/check-router-base.mjs && node scripts/check-clean-ui.mjs && node scripts/check-skills.mjs && node scripts/check-ota-assets.mjs && node scripts/check-pwa-shell.mjs && node scripts/check-cli-install.mjs && python3 tools/snippets-creator-flet-box/build_snippets.py --check && node scripts/check-snippets.mjs",
|
|
23
23
|
"test:browser": "node scripts/run-browser-tests.mjs"
|
|
24
24
|
},
|
|
25
25
|
"keywords": [
|
|
@@ -53,6 +53,7 @@
|
|
|
53
53
|
"bin/",
|
|
54
54
|
"src/",
|
|
55
55
|
"docs/",
|
|
56
|
+
"skills/",
|
|
56
57
|
"README.md",
|
|
57
58
|
"LICENSE"
|
|
58
59
|
],
|