flet-box 1.0.4 → 1.0.5
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/README.md +10 -0
- package/bin/cli.js +15 -0
- package/bin/commands/checkApi.js +761 -0
- package/bin/commands/create.js +77 -5
- package/bin/utils/dtsProps.js +191 -0
- package/bin/utils/moduleExports.js +165 -0
- package/bin/utils/neutralise.js +64 -0
- package/bin/utils/templates.js +366 -27
- package/docs/CONTRIBUTING.md +156 -0
- package/docs/README.md +68 -0
- package/docs/arquitectura.md +164 -0
- package/docs/cli/README.md +542 -0
- package/docs/guides/README.md +33 -0
- package/docs/guides/app-templates.md +197 -0
- package/docs/guides/compatibility.md +95 -0
- package/docs/guides/embedding.md +284 -0
- package/docs/guides/first-app.md +208 -0
- package/docs/guides/frontend-services.md +171 -0
- package/docs/guides/minification-and-protection.md +260 -0
- package/docs/guides/mobile-and-platforms.md +439 -0
- package/docs/guides/online-updates.md +196 -0
- package/docs/guides/router.md +282 -0
- package/docs/guides/state.md +283 -0
- package/docs/guides/syntax-philosophy.md +150 -0
- package/docs/guides/utilities.md +241 -0
- package/docs/guides/widget-structure.md +163 -0
- package/docs/server/README.md +68 -0
- package/docs/server/START_HERE.md +121 -0
- package/docs/server/api.md +225 -0
- package/docs/server/data-services.md +300 -0
- package/docs/server/deployment.md +113 -0
- package/docs/server/security.md +196 -0
- package/docs/services/README.md +79 -0
- package/docs/services/RamStore.md +84 -0
- package/docs/services/Session.md +84 -0
- package/docs/services/Storage.md +88 -0
- package/docs/services/http.md +86 -0
- package/docs/tools/README.md +138 -0
- package/docs/tools/animation.md +87 -0
- package/docs/tools/async-ids-log.md +80 -0
- package/docs/tools/device.md +132 -0
- package/docs/tools/introspection.md +67 -0
- package/docs/tools/lists.md +96 -0
- package/docs/tools/markdown.md +79 -0
- package/docs/tools/reactivity.md +288 -0
- package/docs/tools/state.md +103 -0
- package/docs/tools/styling.md +92 -0
- package/docs/tools/text-and-time.md +89 -0
- package/docs/tools/theme.md +102 -0
- package/docs/tools/validation.md +75 -0
- package/docs/tools/visual-effects.md +84 -0
- package/docs/widget/Accordion.md +144 -0
- package/docs/widget/AdMob.md +144 -0
- package/docs/widget/AdSense.md +133 -0
- package/docs/widget/AdaptiveScaffold.md +105 -0
- package/docs/widget/AlertDialog.md +103 -0
- package/docs/widget/AnimatedBox.md +130 -0
- package/docs/widget/AnimatedText.md +123 -0
- package/docs/widget/AppBar.md +118 -0
- package/docs/widget/Audio.md +135 -0
- package/docs/widget/Avatar.md +119 -0
- package/docs/widget/Badge.md +128 -0
- package/docs/widget/BottomNavigation.md +116 -0
- package/docs/widget/BottomSheet.md +125 -0
- package/docs/widget/Button.md +137 -0
- package/docs/widget/COMMON_PROPS.md +150 -0
- package/docs/widget/Card.md +125 -0
- package/docs/widget/Carousel.md +151 -0
- package/docs/widget/Chart.md +151 -0
- package/docs/widget/Checkbox.md +118 -0
- package/docs/widget/Chip.md +126 -0
- package/docs/widget/CircularBar.md +168 -0
- package/docs/widget/CircularChart.md +164 -0
- package/docs/widget/CodeViewer.md +130 -0
- package/docs/widget/CollapsibleSideBar.md +112 -0
- package/docs/widget/Column.md +129 -0
- package/docs/widget/Container.md +136 -0
- package/docs/widget/DataTable.md +150 -0
- package/docs/widget/Divider.md +109 -0
- package/docs/widget/DraggBox.md +129 -0
- package/docs/widget/Drawer.md +135 -0
- package/docs/widget/DrawerItem.md +98 -0
- package/docs/widget/Dropdown.md +139 -0
- package/docs/widget/DroppBox.md +152 -0
- package/docs/widget/FloatingActionButton.md +120 -0
- package/docs/widget/GridView.md +140 -0
- package/docs/widget/Icon.md +117 -0
- package/docs/widget/Image.md +125 -0
- package/docs/widget/Input.md +151 -0
- package/docs/widget/Inspector.md +92 -0
- package/docs/widget/InstallButton.md +128 -0
- package/docs/widget/ListTile.md +132 -0
- package/docs/widget/ListView.md +138 -0
- package/docs/widget/Markdown.md +175 -0
- package/docs/widget/MatrixRain.md +122 -0
- package/docs/widget/Modal.md +129 -0
- package/docs/widget/Pagination.md +135 -0
- package/docs/widget/ParallaxBox.md +128 -0
- package/docs/widget/ProgressBar.md +130 -0
- package/docs/widget/QRCode.md +117 -0
- package/docs/widget/README.md +188 -0
- package/docs/widget/Radio.md +123 -0
- package/docs/widget/Rating.md +131 -0
- package/docs/widget/Row.md +131 -0
- package/docs/widget/START_HERE.md +146 -0
- package/docs/widget/Scaffold.md +152 -0
- package/docs/widget/Skeleton.md +130 -0
- package/docs/widget/Slider.md +146 -0
- package/docs/widget/SnackBar.md +102 -0
- package/docs/widget/Stack.md +128 -0
- package/docs/widget/Stepper.md +145 -0
- package/docs/widget/Switch.md +118 -0
- package/docs/widget/Tabs.md +124 -0
- package/docs/widget/Text.md +133 -0
- package/docs/widget/Tooltip.md +145 -0
- package/docs/widget/TreeView.md +176 -0
- package/docs/widget/Video.md +127 -0
- package/docs/widget/_template.md +61 -0
- package/package.json +3 -2
- package/src/animations/animate.js +180 -70
- package/src/animations/index.js +1 -0
- package/src/create-index.sh +1 -1
- package/src/index.d.ts +45 -22
- package/src/index.js +1 -0
- package/src/navigations/AdaptiveScaffold.js +11 -2
- package/src/navigations/BottomNavigation.js +10 -3
- package/src/navigations/Tabs.js +6 -2
- package/src/tools/useState.js +54 -63
- package/src/widget-factory/assignProps.js +23 -1
- package/src/widget-factory/processProps.js +10 -3
- package/src/widget-factory/reactiveValue.js +43 -18
- package/src/widget-factory/translateProps.js +777 -901
- package/src/widgets/AlertDialog.js +7 -5
- package/src/widgets/Checkbox.js +9 -7
- package/src/widgets/CircularBar.js +12 -1
- package/src/widgets/FloatingActionButton.js +4 -7
- package/src/widgets/Image.js +5 -7
- package/src/widgets/Input.js +92 -0
- package/src/widgets/ListView.js +73 -29
- package/src/widgets/Pagination.js +6 -3
- package/src/widgets/ProgressBar.js +16 -13
- package/src/widgets/Radio.js +6 -7
- package/src/widgets/Slider.js +23 -4
- package/src/widgets/Stack.js +36 -3
- package/src/widgets/Stepper.js +4 -3
- package/src/widgets/Switch.js +3 -4
- package/src/widgets/TreeView.js +0 -1
|
@@ -0,0 +1,542 @@
|
|
|
1
|
+
# FletBox CLI
|
|
2
|
+
|
|
3
|
+
The FletBox CLI helps you create, run, expand, and build FletBox applications from the terminal.
|
|
4
|
+
|
|
5
|
+
You do not need to create every folder by hand. The CLI can create a working project, add screens and components, start a development server, and prepare a production bundle.
|
|
6
|
+
|
|
7
|
+
## Before you start
|
|
8
|
+
|
|
9
|
+
Install:
|
|
10
|
+
|
|
11
|
+
- Node.js 18 or newer.
|
|
12
|
+
- npm.
|
|
13
|
+
- A terminal such as Terminal, iTerm, PowerShell, or the VS Code terminal.
|
|
14
|
+
|
|
15
|
+
Check your Node.js version:
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
node --version
|
|
19
|
+
npm --version
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
## Install FletBox
|
|
23
|
+
|
|
24
|
+
Inside the FletBox package directory:
|
|
25
|
+
|
|
26
|
+
```bash
|
|
27
|
+
npm install
|
|
28
|
+
npm link
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
After linking, the `flet-box` command is available globally on your computer.
|
|
32
|
+
|
|
33
|
+
Check that it works:
|
|
34
|
+
|
|
35
|
+
```bash
|
|
36
|
+
flet-box --version
|
|
37
|
+
flet-box --help
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
When using the published package, install it in a project with:
|
|
41
|
+
|
|
42
|
+
```bash
|
|
43
|
+
npm install flet-box
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
## Your first project
|
|
47
|
+
|
|
48
|
+
Create a project with the default template:
|
|
49
|
+
|
|
50
|
+
```bash
|
|
51
|
+
flet-box create my-app
|
|
52
|
+
cd my-app
|
|
53
|
+
npm install
|
|
54
|
+
flet-box run
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
Open the address shown in the terminal, normally:
|
|
58
|
+
|
|
59
|
+
```text
|
|
60
|
+
http://localhost:8000
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
The default project includes screens, an app bar, a drawer, routing, and the files needed to start experimenting.
|
|
64
|
+
|
|
65
|
+
## Project templates
|
|
66
|
+
|
|
67
|
+
FletBox provides four project templates.
|
|
68
|
+
|
|
69
|
+
### Blank project
|
|
70
|
+
|
|
71
|
+
Use this when you want to start with only the essential app files:
|
|
72
|
+
|
|
73
|
+
```bash
|
|
74
|
+
flet-box create my-app --blank
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
This creates a minimal `src/app.js` where you can build the interface from the beginning.
|
|
78
|
+
|
|
79
|
+
### Basic project
|
|
80
|
+
|
|
81
|
+
This is the default template:
|
|
82
|
+
|
|
83
|
+
```bash
|
|
84
|
+
flet-box create my-app
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
It includes a basic app structure with screens, an app bar, a drawer, and routes.
|
|
88
|
+
|
|
89
|
+
### Full project
|
|
90
|
+
|
|
91
|
+
Use this for an app with a drawer and bottom navigation:
|
|
92
|
+
|
|
93
|
+
```bash
|
|
94
|
+
flet-box create my-app --full
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
### Sidebar project
|
|
98
|
+
|
|
99
|
+
Use this for a desktop-style application with a sidebar:
|
|
100
|
+
|
|
101
|
+
```bash
|
|
102
|
+
flet-box create my-app --sidebar
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
### Adaptive project
|
|
106
|
+
|
|
107
|
+
Use this when the navigation should change between mobile and desktop layouts:
|
|
108
|
+
|
|
109
|
+
```bash
|
|
110
|
+
flet-box create my-app --adaptive
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
The adaptive template can use a drawer and bottom navigation on small screens and a sidebar on larger screens.
|
|
114
|
+
|
|
115
|
+
## Create a screen
|
|
116
|
+
|
|
117
|
+
Move into an existing FletBox project and run:
|
|
118
|
+
|
|
119
|
+
```bash
|
|
120
|
+
flet-box screen Home
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
This creates:
|
|
124
|
+
|
|
125
|
+
```text
|
|
126
|
+
src/screens/HomeScreen.js
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
The command also prints the import and route lines you need to add to `src/app.js`.
|
|
130
|
+
|
|
131
|
+
You can create several screens at once:
|
|
132
|
+
|
|
133
|
+
```bash
|
|
134
|
+
flet-box screen 3
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
This creates `Screen1Screen.js`, `Screen2Screen.js`, and `Screen3Screen.js`.
|
|
138
|
+
|
|
139
|
+
## Create a component
|
|
140
|
+
|
|
141
|
+
Create a reusable component:
|
|
142
|
+
|
|
143
|
+
```bash
|
|
144
|
+
flet-box component ProfileCard
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
This creates:
|
|
148
|
+
|
|
149
|
+
```text
|
|
150
|
+
src/components/ProfileCard.js
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
The generated component is a starting point. Edit its props and replace its content with your own widgets.
|
|
154
|
+
|
|
155
|
+
Create several components:
|
|
156
|
+
|
|
157
|
+
```bash
|
|
158
|
+
flet-box component 3
|
|
159
|
+
```
|
|
160
|
+
|
|
161
|
+
This creates `Component1.js`, `Component2.js`, and `Component3.js`.
|
|
162
|
+
|
|
163
|
+
## Run the development server
|
|
164
|
+
|
|
165
|
+
### Static development server
|
|
166
|
+
|
|
167
|
+
```bash
|
|
168
|
+
flet-box run
|
|
169
|
+
```
|
|
170
|
+
|
|
171
|
+
Aliases:
|
|
172
|
+
|
|
173
|
+
```bash
|
|
174
|
+
flet-box dev
|
|
175
|
+
flet-box serve
|
|
176
|
+
```
|
|
177
|
+
|
|
178
|
+
The server serves the project files and normally uses port `8000`.
|
|
179
|
+
|
|
180
|
+
### SPA server with hot reload
|
|
181
|
+
|
|
182
|
+
```bash
|
|
183
|
+
flet-box run-spa
|
|
184
|
+
```
|
|
185
|
+
|
|
186
|
+
This enables SPA fallback behavior and hot reload. It is useful when your application uses client-side routes.
|
|
187
|
+
|
|
188
|
+
Aliases:
|
|
189
|
+
|
|
190
|
+
```bash
|
|
191
|
+
flet-box runSpa
|
|
192
|
+
flet-box spa
|
|
193
|
+
```
|
|
194
|
+
|
|
195
|
+
### Choose a port
|
|
196
|
+
|
|
197
|
+
```bash
|
|
198
|
+
flet-box run --port 3000
|
|
199
|
+
flet-box run-spa --port 3000
|
|
200
|
+
```
|
|
201
|
+
|
|
202
|
+
### Reduce request logs
|
|
203
|
+
|
|
204
|
+
```bash
|
|
205
|
+
flet-box run --quiet
|
|
206
|
+
```
|
|
207
|
+
|
|
208
|
+
Press `Ctrl+C` to stop the server.
|
|
209
|
+
|
|
210
|
+
## Build for production
|
|
211
|
+
|
|
212
|
+
Run the build command from the root of your FletBox project:
|
|
213
|
+
|
|
214
|
+
```bash
|
|
215
|
+
flet-box build
|
|
216
|
+
```
|
|
217
|
+
|
|
218
|
+
Equivalent commands:
|
|
219
|
+
|
|
220
|
+
```bash
|
|
221
|
+
flet-box bundle
|
|
222
|
+
flet-box createBundle
|
|
223
|
+
npm run build
|
|
224
|
+
```
|
|
225
|
+
|
|
226
|
+
The build process:
|
|
227
|
+
|
|
228
|
+
1. Checks that `src/app.js` exists.
|
|
229
|
+
2. Makes sure FletBox is available in `node_modules`.
|
|
230
|
+
3. Copies the HTML file and assets.
|
|
231
|
+
4. Bundles `src/app.js` with esbuild.
|
|
232
|
+
5. Enables tree shaking.
|
|
233
|
+
6. Writes the production files to `dist/`.
|
|
234
|
+
|
|
235
|
+
For bundle size, frontend code exposure, source maps, and production protection, read [Minify and protect a FletBox build](../guides/minification-and-protection.md).
|
|
236
|
+
|
|
237
|
+
Preview the result:
|
|
238
|
+
|
|
239
|
+
```bash
|
|
240
|
+
cd dist
|
|
241
|
+
./run.sh
|
|
242
|
+
```
|
|
243
|
+
|
|
244
|
+
## Generated project structure
|
|
245
|
+
|
|
246
|
+
A typical generated project looks like this:
|
|
247
|
+
|
|
248
|
+
```text
|
|
249
|
+
my-app/
|
|
250
|
+
├── index.html
|
|
251
|
+
├── package.json
|
|
252
|
+
├── capacitor.config.json
|
|
253
|
+
├── manifest.json
|
|
254
|
+
├── service-worker.js
|
|
255
|
+
├── run.sh
|
|
256
|
+
├── assets/
|
|
257
|
+
│ └── logo.png
|
|
258
|
+
├── scripts/
|
|
259
|
+
│ ├── sync-android-icons.mjs
|
|
260
|
+
│ └── sync-ios-assets.mjs
|
|
261
|
+
└── src/
|
|
262
|
+
├── app.js
|
|
263
|
+
├── assets/
|
|
264
|
+
│ └── fonts/
|
|
265
|
+
├── components/
|
|
266
|
+
│ └── layouts/
|
|
267
|
+
├── database/
|
|
268
|
+
│ └── themes.js
|
|
269
|
+
└── screens/
|
|
270
|
+
├── RootScreen.js
|
|
271
|
+
├── HomeScreen.js
|
|
272
|
+
└── AboutScreen.js
|
|
273
|
+
```
|
|
274
|
+
|
|
275
|
+
The exact folders depend on the selected template.
|
|
276
|
+
|
|
277
|
+
## A complete beginner workflow
|
|
278
|
+
|
|
279
|
+
```bash
|
|
280
|
+
# 1. Create the project
|
|
281
|
+
flet-box create notes-app --adaptive
|
|
282
|
+
|
|
283
|
+
# 2. Enter the project
|
|
284
|
+
cd notes-app
|
|
285
|
+
|
|
286
|
+
# 3. Install dependencies
|
|
287
|
+
npm install
|
|
288
|
+
|
|
289
|
+
# 4. Start development with SPA routing and hot reload
|
|
290
|
+
flet-box run-spa
|
|
291
|
+
|
|
292
|
+
# 5. In another terminal, add a screen
|
|
293
|
+
flet-box screen Notes
|
|
294
|
+
|
|
295
|
+
# 6. Add a reusable component
|
|
296
|
+
flet-box component NoteCard
|
|
297
|
+
|
|
298
|
+
# 7. Build the app
|
|
299
|
+
flet-box build
|
|
300
|
+
|
|
301
|
+
# 8. Preview the production output
|
|
302
|
+
cd dist
|
|
303
|
+
./run.sh
|
|
304
|
+
```
|
|
305
|
+
|
|
306
|
+
## Create an Android app
|
|
307
|
+
|
|
308
|
+
Projects created with `flet-box create` include a Capacitor configuration,
|
|
309
|
+
valid PWA icon files, and Android build scripts. After creating the app, use:
|
|
310
|
+
|
|
311
|
+
```bash
|
|
312
|
+
cd my-app
|
|
313
|
+
npm install
|
|
314
|
+
flet-box build android
|
|
315
|
+
```
|
|
316
|
+
|
|
317
|
+
The first run initializes Capacitor's Android project automatically. Every run
|
|
318
|
+
builds and synchronizes the web app, generates Android launcher icons from
|
|
319
|
+
`assets/logo.png`, and compiles a debug APK at
|
|
320
|
+
`android/app/build/outputs/apk/debug/app-debug.apk`. If project npm dependencies
|
|
321
|
+
are missing, the command runs `npm install` before building and prints the
|
|
322
|
+
absolute APK path when complete. Replace `assets/logo.png` with a 1024×1024 app
|
|
323
|
+
logo before building. Android builds require Node.js 20.9 or newer, Java, and
|
|
324
|
+
the Android SDK; the command checks for Java and the SDK but does not install
|
|
325
|
+
system-wide tools such as Android Studio or the JDK.
|
|
326
|
+
|
|
327
|
+
To build a **release** artifact that you sign yourself, pass `--release`:
|
|
328
|
+
|
|
329
|
+
```bash
|
|
330
|
+
flet-box build android --release # unsigned release APK
|
|
331
|
+
flet-box build android --release --aab # unsigned release AAB (for Play)
|
|
332
|
+
```
|
|
333
|
+
|
|
334
|
+
Release artifacts are left **unsigned by design** so you can sign them with your
|
|
335
|
+
own keystore: the APK at `android/app/build/outputs/apk/release/` is already
|
|
336
|
+
aligned by Gradle, so sign it directly with `apksigner sign --ks <tu.keystore>
|
|
337
|
+
--ks-key-alias <alias> app-release-unsigned.apk` (firma release = tu *upload
|
|
338
|
+
key*). For Play Store, upload the AAB at
|
|
339
|
+
`android/app/build/outputs/bundle/release/app-release.aab` and let Play App
|
|
340
|
+
Signing apply the final key.
|
|
341
|
+
|
|
342
|
+
To open the native project in Android Studio, run `npm run android:open`.
|
|
343
|
+
|
|
344
|
+
## Preview on an emulator, simulator or device
|
|
345
|
+
|
|
346
|
+
To see the app running natively without a store release, use `run-native`. It
|
|
347
|
+
initializes the platform if missing, synchronizes the web app, compiles the debug
|
|
348
|
+
build, and launches it on the first available emulator — or on a connected
|
|
349
|
+
device with `--device`:
|
|
350
|
+
|
|
351
|
+
```bash
|
|
352
|
+
flet-box run-native android # Android emulator (AVD or device)
|
|
353
|
+
flet-box run-native ios # iOS Simulator (macOS + Xcode)
|
|
354
|
+
flet-box run-native android --device # physical Android over USB
|
|
355
|
+
flet-box run-native ios --device --livereload # hot reload on an iPhone
|
|
356
|
+
```
|
|
357
|
+
|
|
358
|
+
`--livereload` keeps a dev server running so edits to `src/app.js` reload the
|
|
359
|
+
app on the device instantly. The same toolchain requirements as `build android`
|
|
360
|
+
/ `build ios` apply: Android needs the SDK and a JDK and an AVD (or USB
|
|
361
|
+
debugging enabled); iOS needs full Xcode, CocoaPods, and an iOS simulator
|
|
362
|
+
runtime.
|
|
363
|
+
|
|
364
|
+
## Create an iOS app
|
|
365
|
+
|
|
366
|
+
Generated projects include Capacitor's iOS platform, scripts, and a script that
|
|
367
|
+
paints the native icon and launch screen from `assets/logo.png`. Install the
|
|
368
|
+
full Xcode app (the Command Line Tools alone cannot build iOS apps), an iOS
|
|
369
|
+
simulator runtime, and CocoaPods, then run:
|
|
370
|
+
|
|
371
|
+
```bash
|
|
372
|
+
cd my-app
|
|
373
|
+
npm install
|
|
374
|
+
flet-box build ios
|
|
375
|
+
```
|
|
376
|
+
|
|
377
|
+
The first run initializes the iOS project. Every run then builds and
|
|
378
|
+
synchronizes the web app, regenerates the app icon, launch images and launch
|
|
379
|
+
screen background from `assets/logo.png`, and compiles the simulator app. The
|
|
380
|
+
command prints its absolute path, normally
|
|
381
|
+
`ios/build/Build/Products/Debug-iphonesimulator/App.app`, and the app installs
|
|
382
|
+
on a running simulator with:
|
|
383
|
+
|
|
384
|
+
```bash
|
|
385
|
+
xcrun simctl install booted <path printed by the command>
|
|
386
|
+
```
|
|
387
|
+
|
|
388
|
+
Missing project npm dependencies are installed automatically. The command
|
|
389
|
+
verifies the toolchain before touching the project and reports the exact fix
|
|
390
|
+
when something is missing, including the case where `xcode-select -p` still
|
|
391
|
+
points at `/Library/Developer/CommandLineTools`. It does not install Xcode,
|
|
392
|
+
CocoaPods, or simulator runtimes.
|
|
393
|
+
|
|
394
|
+
### Archive for real devices
|
|
395
|
+
|
|
396
|
+
```bash
|
|
397
|
+
flet-box build ios --archive
|
|
398
|
+
```
|
|
399
|
+
|
|
400
|
+
This builds `ios/build/App.xcarchive` for the `iphoneos` SDK in Release
|
|
401
|
+
configuration with code signing disabled. The archive is unsigned, so signing
|
|
402
|
+
happens in Xcode: open it with Product → Archive, select your team, then export
|
|
403
|
+
the IPA, or use `xcodebuild -exportArchive` with an `ExportOptions.plist`.
|
|
404
|
+
|
|
405
|
+
### iOS native assets
|
|
406
|
+
|
|
407
|
+
`scripts/sync-ios-assets.mjs` runs as part of `npm run ios:sync`, and can be run
|
|
408
|
+
on its own with `npm run ios:icons`. It reads the icon and launch slots from
|
|
409
|
+
`ios/App/App/Assets.xcassets/*/Contents.json` instead of hardcoding sizes, so a
|
|
410
|
+
Capacitor template with different slots keeps working. It:
|
|
411
|
+
|
|
412
|
+
- rewrites every app icon slot from `assets/logo.png`, flattened onto the brand
|
|
413
|
+
color because iOS rejects icons that carry an alpha channel;
|
|
414
|
+
- rewrites the launch images as a brand-colored canvas with the logo centered,
|
|
415
|
+
keeping the dimensions the template ships;
|
|
416
|
+
- replaces the launch storyboard background with the same brand color, since
|
|
417
|
+
the launch image is laid out inside the safe area and the notch strip and
|
|
418
|
+
home indicator would otherwise flash white;
|
|
419
|
+
- sets `UIStatusBarStyle` to light content and turns off
|
|
420
|
+
`UIViewControllerBasedStatusBarAppearance`, which otherwise makes the plist
|
|
421
|
+
status bar style ignored.
|
|
422
|
+
|
|
423
|
+
The script is idempotent: running it twice leaves identical files. The brand
|
|
424
|
+
color `#1a1a2e` is defined at the top of the script.
|
|
425
|
+
|
|
426
|
+
## Command reference
|
|
427
|
+
|
|
428
|
+
| Command | What it does |
|
|
429
|
+
| --- | --- |
|
|
430
|
+
| `flet-box create <name>` | Creates a default project. |
|
|
431
|
+
| `flet-box create <name> --blank` | Creates a minimal project. |
|
|
432
|
+
| `flet-box create <name> --full` | Creates a project with drawer and bottom navigation. |
|
|
433
|
+
| `flet-box create <name> --sidebar` | Creates a desktop sidebar project. |
|
|
434
|
+
| `flet-box create <name> --adaptive` | Creates a mobile and desktop project. |
|
|
435
|
+
| `flet-box screen <name>` | Creates one screen. |
|
|
436
|
+
| `flet-box screen <number>` | Creates up to ten screens. |
|
|
437
|
+
| `flet-box component <name>` | Creates one component. |
|
|
438
|
+
| `flet-box component <number>` | Creates up to ten components. |
|
|
439
|
+
| `flet-box run` | Starts the static development server. |
|
|
440
|
+
| `flet-box run-spa` | Starts the SPA server with hot reload. |
|
|
441
|
+
| `flet-box build` | Creates a production bundle. |
|
|
442
|
+
| `flet-box build android` | Builds the Android debug APK. |
|
|
443
|
+
| `flet-box build android --release` | Builds an unsigned release APK to sign yourself. |
|
|
444
|
+
| `flet-box build android --release --aab` | Builds an unsigned release AAB for Play. |
|
|
445
|
+
| `flet-box build ios` | Builds an iOS Simulator app (macOS and Xcode required). |
|
|
446
|
+
| `flet-box build ios --archive` | Builds an unsigned device archive to sign in Xcode. |
|
|
447
|
+
| `flet-box run-native <android\|ios>` | Compiles and launches the app on an emulator/simulator or connected device. |
|
|
448
|
+
| `flet-box run-native <android\|ios> --device` | Forces a physical device instead of the emulator. |
|
|
449
|
+
| `flet-box run-native <android\|ios> --livereload` | Launches the app with hot reload on the device. |
|
|
450
|
+
| `flet-box pkg` | Opens the package manager. |
|
|
451
|
+
| `flet-box --version` | Shows the CLI version. |
|
|
452
|
+
| `flet-box --help` | Shows the command list. |
|
|
453
|
+
|
|
454
|
+
## Package manager
|
|
455
|
+
|
|
456
|
+
The interactive package manager can link the local FletBox source while developing the framework:
|
|
457
|
+
|
|
458
|
+
```bash
|
|
459
|
+
flet-box pkg
|
|
460
|
+
```
|
|
461
|
+
|
|
462
|
+
Available options include:
|
|
463
|
+
|
|
464
|
+
- Create a global npm link.
|
|
465
|
+
- Use the linked package in the current project.
|
|
466
|
+
- Remove the link.
|
|
467
|
+
- Check installation status.
|
|
468
|
+
- Install or uninstall FletBox from npm.
|
|
469
|
+
- Publish the package.
|
|
470
|
+
- Check the npm user.
|
|
471
|
+
- Log in to npm.
|
|
472
|
+
|
|
473
|
+
For normal application development, `npm install flet-box` is usually enough.
|
|
474
|
+
|
|
475
|
+
## Common errors
|
|
476
|
+
|
|
477
|
+
### `flet-box: command not found`
|
|
478
|
+
|
|
479
|
+
The CLI is not linked or installed globally. From the FletBox package directory, run:
|
|
480
|
+
|
|
481
|
+
```bash
|
|
482
|
+
npm install
|
|
483
|
+
npm link
|
|
484
|
+
```
|
|
485
|
+
|
|
486
|
+
### `Not a FletBox project`
|
|
487
|
+
|
|
488
|
+
You ran `screen`, `component`, or `build` outside a generated project. Move into the project folder first:
|
|
489
|
+
|
|
490
|
+
```bash
|
|
491
|
+
cd my-app
|
|
492
|
+
```
|
|
493
|
+
|
|
494
|
+
### The project folder already exists
|
|
495
|
+
|
|
496
|
+
Choose a new project name or remove the old folder only if you no longer need it:
|
|
497
|
+
|
|
498
|
+
```bash
|
|
499
|
+
flet-box create another-app
|
|
500
|
+
```
|
|
501
|
+
|
|
502
|
+
### The port is already in use
|
|
503
|
+
|
|
504
|
+
Choose another port:
|
|
505
|
+
|
|
506
|
+
```bash
|
|
507
|
+
flet-box run-spa --port 3001
|
|
508
|
+
```
|
|
509
|
+
|
|
510
|
+
### A generated screen does not appear
|
|
511
|
+
|
|
512
|
+
Creating a screen creates the file and prints the route code, but you still need to import the screen and add it to your app's routes.
|
|
513
|
+
|
|
514
|
+
### Build cannot find esbuild
|
|
515
|
+
|
|
516
|
+
Install the project dependencies:
|
|
517
|
+
|
|
518
|
+
```bash
|
|
519
|
+
npm install
|
|
520
|
+
```
|
|
521
|
+
|
|
522
|
+
You can also install esbuild as a development dependency:
|
|
523
|
+
|
|
524
|
+
```bash
|
|
525
|
+
npm install --save-dev esbuild
|
|
526
|
+
```
|
|
527
|
+
|
|
528
|
+
## Next steps
|
|
529
|
+
|
|
530
|
+
- Learn the basics in [Start here](../widget/START_HERE.md).
|
|
531
|
+
- Learn complete app structures in [Build your first FletBox app](../guides/app-templates.md).
|
|
532
|
+
- Explore every widget in the [widget documentation](../widget/README.md).
|
|
533
|
+
|
|
534
|
+
---
|
|
535
|
+
|
|
536
|
+
## Continue reading
|
|
537
|
+
|
|
538
|
+
- **Previous:** [FletBox utilities](../guides/utilities.md)
|
|
539
|
+
- **Next:** [Minify and protect a FletBox build](../guides/minification-and-protection.md) — Appendix A
|
|
540
|
+
- **Index:** [Guides index](../guides/README.md) · [The FletBox Book](../README.md)
|
|
541
|
+
|
|
542
|
+
You are reading **Chapter 11 · The CLI**.
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
# FletBox guides
|
|
2
|
+
|
|
3
|
+
This directory is the **conceptual index** of FletBox: how to build apps, set up workflows, and ship results. The guide pages sit inside the book's reading path (see [The FletBox Book](../README.md)); every guide links to its **Previous** and **Next**.
|
|
4
|
+
|
|
5
|
+
## The reading path
|
|
6
|
+
|
|
7
|
+
- **[Your first FletBox app, step by step](first-app.md)** — Chapter 0 · build a working todo app in 20 minutes (Beginner).
|
|
8
|
+
- **[State with `useState`](state.md)** — Chapter 9 · key-based RAM state plus subscribers.
|
|
9
|
+
- **[Routing with FletBox](router.md)** — Chapter 9 · fixed paths, dynamic parameters, queries, history, and route subscriptions.
|
|
10
|
+
- **[Frontend services](frontend-services.md)** — Chapter 9 · the practical walkthrough of the three storage layers (`RamStore`, `Session`, `Storage`) and the HTTP client.
|
|
11
|
+
- **[FletBox utilities](utilities.md)** — Chapter 10 · layout/theme/format helpers and validator tools.
|
|
12
|
+
- **[Widget structure](widget-structure.md)** — the canonical, modular shape every widget follows (and how new ones are added).
|
|
13
|
+
|
|
14
|
+
## Appendices (Advanced — for shipping)
|
|
15
|
+
|
|
16
|
+
- **[Minify and protect a FletBox build](minification-and-protection.md)** — smaller production bundles and code protection.
|
|
17
|
+
- **[Build FletBox for mobile and other platforms](mobile-and-platforms.md)** — package the same frontend for web, PWA, Android (Capacitor), and iOS.
|
|
18
|
+
- **[Compatibility and support](compatibility.md)** — what FletBox ships in, and the platform matrix.
|
|
19
|
+
- **[Add FletBox to an existing page](embedding.md)** — drop one widget into an existing HTML page without rewriting it.
|
|
20
|
+
- **[Ship updates without the store (OTA / online updates)](online-updates.md)** — publish once, then self-update the web bundle from GitHub on every release.
|
|
21
|
+
|
|
22
|
+
## Also worth reading
|
|
23
|
+
|
|
24
|
+
- [FletBox syntax philosophy](syntax-philosophy.md) — the ideas behind the syntax: build UIs with plain functions, friendly to Flet, React, and vanilla-JS habits.
|
|
25
|
+
- [Build your first FletBox app](app-templates.md) — complete app examples you can copy, run, and reshape.
|
|
26
|
+
|
|
27
|
+
## Where to go next
|
|
28
|
+
|
|
29
|
+
- [The FletBox Book](../README.md) — the front cover and full reading path.
|
|
30
|
+
- [Widget book](../widget/README.md) — every widget with props, methods, and examples.
|
|
31
|
+
- [Services index](../services/README.md) — the complete list of storage and HTTP helpers.
|
|
32
|
+
- [Tools index](../tools/README.md) — the pure helper functions.
|
|
33
|
+
- [CLI reference](../cli/README.md) — `create`, `dev`, `build`, and the rest of the command line.
|