@jskit-ai/agent-docs 0.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.
- package/DISTR_AGENT.md +25 -0
- package/guide/agent/app-extras/assistant.md +636 -0
- package/guide/agent/app-extras/realtime.md +223 -0
- package/guide/agent/app-setup/a-more-interesting-shell.md +643 -0
- package/guide/agent/app-setup/authentication.md +948 -0
- package/guide/agent/app-setup/console.md +316 -0
- package/guide/agent/app-setup/database-layer.md +775 -0
- package/guide/agent/app-setup/initial-scaffolding.md +714 -0
- package/guide/agent/app-setup/multi-homing.md +655 -0
- package/guide/agent/app-setup/users.md +355 -0
- package/guide/agent/app-setup/working-with-the-jskit-cli.md +983 -0
- package/guide/agent/generators/advanced-cruds.md +923 -0
- package/guide/agent/generators/crud-generators.md +556 -0
- package/guide/agent/generators/intro.md +63 -0
- package/guide/agent/generators/ui-generators.md +648 -0
- package/guide/agent/index.md +39 -0
- package/guide/human/app-extras/assistant.md +695 -0
- package/guide/human/app-extras/realtime.md +270 -0
- package/guide/human/app-setup/a-more-interesting-shell.md +734 -0
- package/guide/human/app-setup/authentication.md +963 -0
- package/guide/human/app-setup/console.md +352 -0
- package/guide/human/app-setup/database-layer.md +822 -0
- package/guide/human/app-setup/initial-scaffolding.md +738 -0
- package/guide/human/app-setup/multi-homing.md +795 -0
- package/guide/human/app-setup/users.md +404 -0
- package/guide/human/app-setup/working-with-the-jskit-cli.md +997 -0
- package/guide/human/generators/advanced-cruds.md +923 -0
- package/guide/human/generators/crud-generators.md +556 -0
- package/guide/human/generators/intro.md +109 -0
- package/guide/human/generators/ui-generators.md +665 -0
- package/guide/human/index.md +39 -0
- package/package.json +28 -0
- package/reference/autogen/KERNEL_MAP.md +536 -0
- package/reference/autogen/README.md +44 -0
- package/reference/autogen/packages/agent-docs.md +13 -0
- package/reference/autogen/packages/assistant-core.md +310 -0
- package/reference/autogen/packages/assistant-runtime.md +219 -0
- package/reference/autogen/packages/assistant.md +73 -0
- package/reference/autogen/packages/auth-core.md +352 -0
- package/reference/autogen/packages/auth-provider-supabase-core.md +223 -0
- package/reference/autogen/packages/auth-web.md +267 -0
- package/reference/autogen/packages/console-core.md +116 -0
- package/reference/autogen/packages/console-web.md +37 -0
- package/reference/autogen/packages/crud-core.md +283 -0
- package/reference/autogen/packages/crud-server-generator.md +220 -0
- package/reference/autogen/packages/crud-ui-generator.md +154 -0
- package/reference/autogen/packages/database-runtime-mysql.md +61 -0
- package/reference/autogen/packages/database-runtime-postgres.md +39 -0
- package/reference/autogen/packages/database-runtime.md +216 -0
- package/reference/autogen/packages/http-runtime.md +213 -0
- package/reference/autogen/packages/kernel.md +1350 -0
- package/reference/autogen/packages/realtime.md +95 -0
- package/reference/autogen/packages/shell-web.md +349 -0
- package/reference/autogen/packages/storage-runtime.md +39 -0
- package/reference/autogen/packages/ui-generator.md +101 -0
- package/reference/autogen/packages/uploads-image-web.md +76 -0
- package/reference/autogen/packages/uploads-runtime.md +85 -0
- package/reference/autogen/packages/users-core.md +307 -0
- package/reference/autogen/packages/users-web.md +473 -0
- package/reference/autogen/packages/workspaces-core.md +415 -0
- package/reference/autogen/packages/workspaces-web.md +372 -0
- package/reference/autogen/tooling/config-eslint.md +52 -0
- package/reference/autogen/tooling/create-app.md +194 -0
- package/reference/autogen/tooling/jskit-catalog.md +27 -0
- package/reference/autogen/tooling/jskit-cli.md +624 -0
- package/reference/autogen/tooling/test-support.md +27 -0
- package/reference/autogen/tooling/testUtils.md +31 -0
- package/templates/APP_BLUEPRINT.md +57 -0
- package/workflow/app-state.md +33 -0
- package/workflow/bootstrap.md +24 -0
- package/workflow/feature-delivery.md +21 -0
- package/workflow/review.md +22 -0
- package/workflow/scoping.md +26 -0
|
@@ -0,0 +1,648 @@
|
|
|
1
|
+
<!-- Generated by `npm run agent-docs:build` from `docs/guide/generators/ui-generators.md`. Do not edit manually. -->
|
|
2
|
+
|
|
3
|
+
# UI Generators
|
|
4
|
+
|
|
5
|
+
The earlier chapters already used `ui-generator` a little when we added:
|
|
6
|
+
|
|
7
|
+
- the `Alerts Widget`
|
|
8
|
+
- the `Profile` settings page
|
|
9
|
+
- the `Notifications` settings page
|
|
10
|
+
|
|
11
|
+
This chapter steps back and treats that tool as a subject in its own right.
|
|
12
|
+
|
|
13
|
+
Use `ui-generator` when you want app-owned UI that is **not** a CRUD route tree.
|
|
14
|
+
|
|
15
|
+
That usually means one of four jobs:
|
|
16
|
+
|
|
17
|
+
- create a route page
|
|
18
|
+
- create a small placed UI element
|
|
19
|
+
- turn an existing page into a host for child routes
|
|
20
|
+
- add a generic placement seam to an existing Vue file
|
|
21
|
+
|
|
22
|
+
## `ui-generator` `@jskit-ai/ui-generator` `(0.1.22)`
|
|
23
|
+
|
|
24
|
+
`ui-generator` has four subcommands:
|
|
25
|
+
|
|
26
|
+
- `page`
|
|
27
|
+
- `placed-element`
|
|
28
|
+
- `add-subpages`
|
|
29
|
+
- `outlet`
|
|
30
|
+
|
|
31
|
+
They are all about app-owned UI, but they solve different problems.
|
|
32
|
+
|
|
33
|
+
The easiest way to understand them is:
|
|
34
|
+
|
|
35
|
+
- `page` creates a route and the link that reaches it
|
|
36
|
+
- `placed-element` creates a reusable component and places it somewhere
|
|
37
|
+
- `add-subpages` upgrades a page into a routed child-page host
|
|
38
|
+
- `outlet` adds only a placement seam, without routed child-page behavior
|
|
39
|
+
|
|
40
|
+
## The simplest case: `page`
|
|
41
|
+
|
|
42
|
+
Start with the most common command:
|
|
43
|
+
|
|
44
|
+
```bash
|
|
45
|
+
npx jskit generate ui-generator page \
|
|
46
|
+
home/reports/index.vue \
|
|
47
|
+
--name "Reports"
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
This command creates a page at:
|
|
51
|
+
|
|
52
|
+
```text
|
|
53
|
+
src/pages/home/reports/index.vue
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
and it also appends a matching link placement into:
|
|
57
|
+
|
|
58
|
+
```text
|
|
59
|
+
src/placement.js
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
That second part is important. `page` is not just a file generator. It also makes the new page reachable inside the shell.
|
|
63
|
+
|
|
64
|
+
In a fresh `home` surface app, the generated placement looks like a normal shell menu link. In the throwaway app used to verify this chapter, the command reported:
|
|
65
|
+
|
|
66
|
+
```text
|
|
67
|
+
Generated UI page "/reports" at src/pages/home/reports/index.vue.
|
|
68
|
+
Touched files (2):
|
|
69
|
+
- src/pages/home/reports/index.vue
|
|
70
|
+
- src/placement.js
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
That is the baseline behavior of `page`:
|
|
74
|
+
|
|
75
|
+
- one app-owned page file
|
|
76
|
+
- one app-owned placement entry
|
|
77
|
+
|
|
78
|
+
The important default is this:
|
|
79
|
+
|
|
80
|
+
- if JSKIT sees no nearer routed host, the new page gets a normal shell/menu placement
|
|
81
|
+
- if JSKIT does see a nearer routed host, the new page gets linked into that host instead
|
|
82
|
+
|
|
83
|
+
Open the app and you now have a real `/reports` page plus a real shell link for it.
|
|
84
|
+
|
|
85
|
+
### Customizing the generated menu link
|
|
86
|
+
|
|
87
|
+
The generated page command does not ask for an icon up front. That is deliberate. The command's job is to create the route and the matching placement entry, not to force every menu detail during generation.
|
|
88
|
+
|
|
89
|
+
If you want to customize the link afterwards, edit the placement entry that `page` wrote into `src/placement.js`.
|
|
90
|
+
|
|
91
|
+
That is where things such as:
|
|
92
|
+
|
|
93
|
+
- `label`
|
|
94
|
+
- `order`
|
|
95
|
+
- `icon`
|
|
96
|
+
- a custom `componentToken`
|
|
97
|
+
|
|
98
|
+
normally get adjusted.
|
|
99
|
+
|
|
100
|
+
The important icon rule is this:
|
|
101
|
+
|
|
102
|
+
- inside `src/placement.js` menu metadata, raw `mdi-*` strings are fine
|
|
103
|
+
- inside normal Vue component props, they are not
|
|
104
|
+
|
|
105
|
+
So this is a valid menu-placement customization:
|
|
106
|
+
|
|
107
|
+
```js
|
|
108
|
+
props: {
|
|
109
|
+
label: "Reports",
|
|
110
|
+
to: "/reports",
|
|
111
|
+
icon: "mdi-chart-box-outline"
|
|
112
|
+
}
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
But if you later open the generated page file itself and add a Vuetify icon to the template, switch back to `@mdi/js`:
|
|
116
|
+
|
|
117
|
+
```vue
|
|
118
|
+
<script setup>
|
|
119
|
+
import { mdiChartBoxOutline } from "@mdi/js";
|
|
120
|
+
</script>
|
|
121
|
+
|
|
122
|
+
<v-icon :icon="mdiChartBoxOutline" />
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
This split matters because JSKIT's shell menu components normalize menu metadata icons for you, while direct Vue icon props go straight to Vuetify.
|
|
126
|
+
|
|
127
|
+
## What `page` is really good at
|
|
128
|
+
|
|
129
|
+
The reason `page` is the primary subcommand is that it understands more than just "create this file".
|
|
130
|
+
|
|
131
|
+
It also understands shell topology.
|
|
132
|
+
|
|
133
|
+
If you create a page that lives under a parent page which has already been upgraded into a child-page host, `page` does **not** keep treating it as a top-level shell entry. It changes behavior and links the new page into the nearest host instead.
|
|
134
|
+
|
|
135
|
+
That is what makes it fit naturally with the rest of JSKIT.
|
|
136
|
+
|
|
137
|
+
### The important `page` overrides
|
|
138
|
+
|
|
139
|
+
The happy path is intentionally simple, but `page` also has a small set of override options that matter as soon as you stop accepting the defaults.
|
|
140
|
+
|
|
141
|
+
#### `--link-placement`
|
|
142
|
+
|
|
143
|
+
Use this when the generated page link should go somewhere other than the generator's inferred default.
|
|
144
|
+
|
|
145
|
+
Typical reasons:
|
|
146
|
+
|
|
147
|
+
- you want the page in a different shell menu
|
|
148
|
+
- you want the page link inside a specific existing outlet
|
|
149
|
+
- you do not want the link to land in the normal top-level menu
|
|
150
|
+
|
|
151
|
+
For example, if a page should appear in a settings menu rather than the shell drawer, `--link-placement` is the override that says so.
|
|
152
|
+
|
|
153
|
+
#### `--link-component-token`
|
|
154
|
+
|
|
155
|
+
Use this when the page link should render with a different link component than the default inferred one.
|
|
156
|
+
|
|
157
|
+
In practice, this often means:
|
|
158
|
+
|
|
159
|
+
- using a tab-style link instead of a normal menu link
|
|
160
|
+
- using a local custom link token for a special shell section
|
|
161
|
+
|
|
162
|
+
This matters most once you start targeting non-default outlets. A settings or tab host may want a different link renderer than the main shell drawer.
|
|
163
|
+
|
|
164
|
+
#### `--link-to`
|
|
165
|
+
|
|
166
|
+
Use this when you want to override the generated `props.to` value.
|
|
167
|
+
|
|
168
|
+
This is especially useful for nested pages, because when JSKIT detects a parent subpages host it normally infers a relative link like:
|
|
169
|
+
|
|
170
|
+
```js
|
|
171
|
+
to: "./exports"
|
|
172
|
+
```
|
|
173
|
+
|
|
174
|
+
That default is usually correct. But if the host needs a different local target shape, or you are wiring a link into a custom outlet with different expectations, `--link-to` is the escape hatch.
|
|
175
|
+
|
|
176
|
+
So the rough rule is:
|
|
177
|
+
|
|
178
|
+
- if the link destination is obvious from the route tree, let JSKIT infer it
|
|
179
|
+
- if you need a very specific link destination, use `--link-to`
|
|
180
|
+
|
|
181
|
+
#### `--force`
|
|
182
|
+
|
|
183
|
+
Use this only when the target page file already exists and you intentionally want to overwrite it.
|
|
184
|
+
|
|
185
|
+
That is most common when:
|
|
186
|
+
|
|
187
|
+
- you are regenerating an experimental page
|
|
188
|
+
- you want to throw away the current file and replace it with fresh scaffold
|
|
189
|
+
|
|
190
|
+
It is not a routing option. It is simply an overwrite guard.
|
|
191
|
+
|
|
192
|
+
## Turning a page into a child-page host: `add-subpages`
|
|
193
|
+
|
|
194
|
+
Suppose `Reports` should stop being a single screen and start becoming a section with child routes under it.
|
|
195
|
+
|
|
196
|
+
Run:
|
|
197
|
+
|
|
198
|
+
```bash
|
|
199
|
+
npx jskit generate ui-generator add-subpages \
|
|
200
|
+
home/reports/index.vue \
|
|
201
|
+
--title "Reports" \
|
|
202
|
+
--subtitle "View and manage reporting modules."
|
|
203
|
+
```
|
|
204
|
+
|
|
205
|
+
This upgrades `src/pages/home/reports/index.vue` into a routed host page.
|
|
206
|
+
|
|
207
|
+
On the first use in a fresh app, it also installs the support shell component:
|
|
208
|
+
|
|
209
|
+
```text
|
|
210
|
+
src/components/SectionContainerShell.vue
|
|
211
|
+
```
|
|
212
|
+
|
|
213
|
+
In the verified throwaway app, the command reported:
|
|
214
|
+
|
|
215
|
+
```text
|
|
216
|
+
Enabled subpages in src/pages/home/reports/index.vue for "/reports" using outlet target "reports:sub-pages".
|
|
217
|
+
Touched files (2):
|
|
218
|
+
- src/components/SectionContainerShell.vue
|
|
219
|
+
- src/pages/home/reports/index.vue
|
|
220
|
+
```
|
|
221
|
+
|
|
222
|
+
After the command, the page gains three important pieces:
|
|
223
|
+
|
|
224
|
+
- `SectionContainerShell`
|
|
225
|
+
- a `ShellOutlet` for the child-page tabs
|
|
226
|
+
- `RouterView`
|
|
227
|
+
|
|
228
|
+
That means the page can now keep rendering shared content while child routes render underneath it.
|
|
229
|
+
|
|
230
|
+
This is the first big distinction in this chapter:
|
|
231
|
+
|
|
232
|
+
- a plain page is just a page
|
|
233
|
+
- a subpages host is a page plus routed child-page structure
|
|
234
|
+
|
|
235
|
+
If what you need is routed children, `add-subpages` is the right tool.
|
|
236
|
+
|
|
237
|
+
### When `page` becomes a tab-like child instead of a top-level menu entry
|
|
238
|
+
|
|
239
|
+
This is the key transition to understand.
|
|
240
|
+
|
|
241
|
+
Before `add-subpages`, `page` usually creates:
|
|
242
|
+
|
|
243
|
+
- a page file
|
|
244
|
+
- a top-level shell link
|
|
245
|
+
|
|
246
|
+
After `add-subpages`, that same `page` command may create:
|
|
247
|
+
|
|
248
|
+
- a page file
|
|
249
|
+
- a child link inside the nearest parent host outlet
|
|
250
|
+
|
|
251
|
+
That is why nested pages often feel "tab-like" even though the generator command is still just `page`.
|
|
252
|
+
|
|
253
|
+
The route page is still a normal page file. What changes is the inferred placement target:
|
|
254
|
+
|
|
255
|
+
- no parent host found -> shell/menu entry
|
|
256
|
+
- nearest parent host found -> child link inside that host
|
|
257
|
+
|
|
258
|
+
So JSKIT is not switching to a different generator. It is switching the inferred placement behavior because the route tree now has a routed host above the new page.
|
|
259
|
+
|
|
260
|
+
## Nested pages under an `index.vue` host
|
|
261
|
+
|
|
262
|
+
Once `Reports` is a host, create a child page under it:
|
|
263
|
+
|
|
264
|
+
```bash
|
|
265
|
+
npx jskit generate ui-generator page \
|
|
266
|
+
home/reports/index/exports/index.vue \
|
|
267
|
+
--name "Exports"
|
|
268
|
+
```
|
|
269
|
+
|
|
270
|
+
This path shape matters.
|
|
271
|
+
|
|
272
|
+
Because the parent host is:
|
|
273
|
+
|
|
274
|
+
```text
|
|
275
|
+
src/pages/home/reports/index.vue
|
|
276
|
+
```
|
|
277
|
+
|
|
278
|
+
the child belongs under:
|
|
279
|
+
|
|
280
|
+
```text
|
|
281
|
+
src/pages/home/reports/index/exports/index.vue
|
|
282
|
+
```
|
|
283
|
+
|
|
284
|
+
That `index/...` folder segment is not an odd JSKIT convention. It is the real nesting rule for children of an `index.vue` route host.
|
|
285
|
+
|
|
286
|
+
And this is where `page` becomes interesting again.
|
|
287
|
+
|
|
288
|
+
In the throwaway app, the command reported:
|
|
289
|
+
|
|
290
|
+
```text
|
|
291
|
+
Generated UI page "/reports/exports" at src/pages/home/reports/index/exports/index.vue.
|
|
292
|
+
Touched files (2):
|
|
293
|
+
- src/pages/home/reports/index/exports/index.vue
|
|
294
|
+
- src/placement.js
|
|
295
|
+
```
|
|
296
|
+
|
|
297
|
+
But the placement it wrote was **not** another top-level shell link.
|
|
298
|
+
|
|
299
|
+
Instead, it targeted the host outlet:
|
|
300
|
+
|
|
301
|
+
```text
|
|
302
|
+
reports:sub-pages
|
|
303
|
+
```
|
|
304
|
+
|
|
305
|
+
and used the tab-link renderer with:
|
|
306
|
+
|
|
307
|
+
```js
|
|
308
|
+
to: "./exports"
|
|
309
|
+
```
|
|
310
|
+
|
|
311
|
+
That is exactly the behavior you want:
|
|
312
|
+
|
|
313
|
+
- `Reports` stays the host page
|
|
314
|
+
- `Exports` becomes a child tab under it
|
|
315
|
+
- the child route renders under the parent instead of becoming another top-level menu entry
|
|
316
|
+
|
|
317
|
+
This is also why `--link-placement`, `--link-component-token`, and `--link-to` are often unnecessary in the default nested case. Once the host exists, JSKIT already knows the likely child placement target, link renderer, and relative `to` value.
|
|
318
|
+
|
|
319
|
+
## Nested pages under a file-route host
|
|
320
|
+
|
|
321
|
+
There is a second nesting shape that matters just as much.
|
|
322
|
+
|
|
323
|
+
Create a dynamic file-route page:
|
|
324
|
+
|
|
325
|
+
```bash
|
|
326
|
+
npx jskit generate ui-generator page \
|
|
327
|
+
home/contacts/[contactId].vue \
|
|
328
|
+
--name "Contact"
|
|
329
|
+
```
|
|
330
|
+
|
|
331
|
+
Then upgrade that page into a host:
|
|
332
|
+
|
|
333
|
+
```bash
|
|
334
|
+
npx jskit generate ui-generator add-subpages \
|
|
335
|
+
home/contacts/[contactId].vue \
|
|
336
|
+
--title "Contact" \
|
|
337
|
+
--subtitle "View and manage this contact."
|
|
338
|
+
```
|
|
339
|
+
|
|
340
|
+
This time the parent is a file route, not an `index.vue` route.
|
|
341
|
+
|
|
342
|
+
So the child-page path is different:
|
|
343
|
+
|
|
344
|
+
```bash
|
|
345
|
+
npx jskit generate ui-generator page \
|
|
346
|
+
home/contacts/[contactId]/notes/index.vue \
|
|
347
|
+
--name "Notes"
|
|
348
|
+
```
|
|
349
|
+
|
|
350
|
+
That is the other important nesting rule:
|
|
351
|
+
|
|
352
|
+
- if the host is an `index.vue` page, children go under `index/...`
|
|
353
|
+
- if the host is a file-route page, children go under that page's directory
|
|
354
|
+
|
|
355
|
+
In the verified throwaway app, this command created:
|
|
356
|
+
|
|
357
|
+
```text
|
|
358
|
+
src/pages/home/contacts/[contactId]/notes/index.vue
|
|
359
|
+
```
|
|
360
|
+
|
|
361
|
+
and its link placement targeted:
|
|
362
|
+
|
|
363
|
+
```text
|
|
364
|
+
contacts-contact-id:sub-pages
|
|
365
|
+
```
|
|
366
|
+
|
|
367
|
+
So the exact host token changes, but the principle stays the same:
|
|
368
|
+
|
|
369
|
+
- a nearer routed host changes where `page` places the new link
|
|
370
|
+
- the child page becomes a tab or child link inside that host
|
|
371
|
+
|
|
372
|
+
This is one of the most important things to understand about `ui-generator`: nested pages are not a separate feature bolted on afterwards. The generator already knows how to attach them to the right place.
|
|
373
|
+
|
|
374
|
+
### A practical rule for child-page paths
|
|
375
|
+
|
|
376
|
+
Use these two rules when deciding where the child page file should go:
|
|
377
|
+
|
|
378
|
+
- host is `.../index.vue` -> child pages go under `.../index/...`
|
|
379
|
+
- host is `...[param].vue` or another file route -> child pages go under `.../[param]/...`
|
|
380
|
+
|
|
381
|
+
That is not only a file-layout preference. It is how the router keeps the parent host visible while the child page renders beneath it.
|
|
382
|
+
|
|
383
|
+
## Adding small placed UI: `placed-element`
|
|
384
|
+
|
|
385
|
+
Not everything should be a route.
|
|
386
|
+
|
|
387
|
+
If what you need is a small block of UI rendered into an existing placement target, use `placed-element` instead:
|
|
388
|
+
|
|
389
|
+
```bash
|
|
390
|
+
npx jskit generate ui-generator placed-element \
|
|
391
|
+
--name "Alerts Widget"
|
|
392
|
+
```
|
|
393
|
+
|
|
394
|
+
In the verified throwaway app, that command touched:
|
|
395
|
+
|
|
396
|
+
```text
|
|
397
|
+
- packages/main/src/client/providers/MainClientProvider.js
|
|
398
|
+
- src/components/AlertsWidgetElement.vue
|
|
399
|
+
- src/placement.js
|
|
400
|
+
```
|
|
401
|
+
|
|
402
|
+
Those three edits explain the feature:
|
|
403
|
+
|
|
404
|
+
- the component file is created in `src/components/`
|
|
405
|
+
- the app's local client provider registers a new local token for it
|
|
406
|
+
- `src/placement.js` adds a placement entry that renders that token
|
|
407
|
+
|
|
408
|
+
This is different from `page` in a very important way:
|
|
409
|
+
|
|
410
|
+
- `page` gives you a URL and a link
|
|
411
|
+
- `placed-element` gives you a component token and a placement entry
|
|
412
|
+
|
|
413
|
+
So if the thing you are adding should live *inside* an existing shell region, not at its own route, `placed-element` is the right command.
|
|
414
|
+
|
|
415
|
+
By default, the element goes into:
|
|
416
|
+
|
|
417
|
+
```text
|
|
418
|
+
shell-layout:top-right
|
|
419
|
+
```
|
|
420
|
+
|
|
421
|
+
That is why this is such a good command for widgets, status panels, and compact shell extensions.
|
|
422
|
+
|
|
423
|
+
### When `--surface` matters
|
|
424
|
+
|
|
425
|
+
`placed-element` only needs `--surface` when JSKIT cannot infer the target surface cleanly.
|
|
426
|
+
|
|
427
|
+
The easiest cases are:
|
|
428
|
+
|
|
429
|
+
- the app has only one enabled surface
|
|
430
|
+
- the chosen placement target clearly belongs to a page-owned outlet on one surface
|
|
431
|
+
|
|
432
|
+
In those cases, surface inference is straightforward.
|
|
433
|
+
|
|
434
|
+
The ambiguous cases are the ones to watch for:
|
|
435
|
+
|
|
436
|
+
- the app has several enabled surfaces
|
|
437
|
+
- the target placement is shared shell infrastructure rather than a page-owned outlet
|
|
438
|
+
- the placement itself does not tell JSKIT which surface you meant
|
|
439
|
+
|
|
440
|
+
That is exactly when `--surface` becomes important.
|
|
441
|
+
|
|
442
|
+
A practical example is:
|
|
443
|
+
|
|
444
|
+
```bash
|
|
445
|
+
npx jskit generate ui-generator placed-element \
|
|
446
|
+
--name "Ops Panel" \
|
|
447
|
+
--surface admin \
|
|
448
|
+
--placement shell-layout:top-right
|
|
449
|
+
```
|
|
450
|
+
|
|
451
|
+
`shell-layout:top-right` can exist across several surfaces. If your app has several enabled surfaces, `--surface admin` tells JSKIT which one this element is actually meant for.
|
|
452
|
+
|
|
453
|
+
So the rule of thumb is:
|
|
454
|
+
|
|
455
|
+
- page-owned outlet target -> surface is often inferable
|
|
456
|
+
- shared shell target in a multi-surface app -> pass `--surface`
|
|
457
|
+
|
|
458
|
+
### `--placement`
|
|
459
|
+
|
|
460
|
+
Use `--placement` when the default target `shell-layout:top-right` is not what you want.
|
|
461
|
+
|
|
462
|
+
This is the option that answers:
|
|
463
|
+
|
|
464
|
+
- *where should this element render?*
|
|
465
|
+
|
|
466
|
+
In practice, it is the first override you will use for `placed-element`.
|
|
467
|
+
|
|
468
|
+
### `--path`
|
|
469
|
+
|
|
470
|
+
Use `--path` when the component file should live somewhere other than `src/components`.
|
|
471
|
+
|
|
472
|
+
This is not about placement in the UI. It is about placement in the source tree.
|
|
473
|
+
|
|
474
|
+
Typical reasons:
|
|
475
|
+
|
|
476
|
+
- you want widgets under `src/widgets`
|
|
477
|
+
- you want admin-specific pieces under a more specific component directory
|
|
478
|
+
- you want support scaffold grouped near a feature area instead of dumped into the default component folder
|
|
479
|
+
|
|
480
|
+
So `--path` changes where the new Vue file is written, not where it renders.
|
|
481
|
+
|
|
482
|
+
### `--force`
|
|
483
|
+
|
|
484
|
+
Use `--force` when the target component file already exists and you want to replace it with fresh generated scaffold.
|
|
485
|
+
|
|
486
|
+
That is most useful when:
|
|
487
|
+
|
|
488
|
+
- you are regenerating a throwaway prototype
|
|
489
|
+
- you intentionally want to reset the file to generator output
|
|
490
|
+
|
|
491
|
+
As with `page`, this is an overwrite guard, not a placement rule.
|
|
492
|
+
|
|
493
|
+
## Adding a plain placement seam: `outlet`
|
|
494
|
+
|
|
495
|
+
Now suppose you already have a component and you do **not** need routed child pages. You only need a named place where later UI can render.
|
|
496
|
+
|
|
497
|
+
That is what `outlet` is for.
|
|
498
|
+
|
|
499
|
+
In the verified throwaway app, after generating `Alerts Widget`, I ran:
|
|
500
|
+
|
|
501
|
+
```bash
|
|
502
|
+
npx jskit generate ui-generator outlet \
|
|
503
|
+
src/components/AlertsWidgetElement.vue \
|
|
504
|
+
--target alerts-widget:actions
|
|
505
|
+
```
|
|
506
|
+
|
|
507
|
+
That command touched only one file:
|
|
508
|
+
|
|
509
|
+
```text
|
|
510
|
+
src/components/AlertsWidgetElement.vue
|
|
511
|
+
```
|
|
512
|
+
|
|
513
|
+
and injected:
|
|
514
|
+
|
|
515
|
+
```vue
|
|
516
|
+
<ShellOutlet target="alerts-widget:actions" />
|
|
517
|
+
```
|
|
518
|
+
|
|
519
|
+
It did **not** add:
|
|
520
|
+
|
|
521
|
+
- `RouterView`
|
|
522
|
+
- `SectionContainerShell`
|
|
523
|
+
- child-page tab structure
|
|
524
|
+
|
|
525
|
+
That is the clean boundary between `outlet` and `add-subpages`.
|
|
526
|
+
|
|
527
|
+
Use `outlet` when you want:
|
|
528
|
+
|
|
529
|
+
- a placement seam inside an existing page or component
|
|
530
|
+
- later content to be targetable there
|
|
531
|
+
- no routed child-page behavior
|
|
532
|
+
|
|
533
|
+
After adding the outlet, `npx jskit list-placements` showed the new target immediately:
|
|
534
|
+
|
|
535
|
+
```text
|
|
536
|
+
- alerts-widget:actions [src/components/AlertsWidgetElement.vue]
|
|
537
|
+
```
|
|
538
|
+
|
|
539
|
+
So `outlet` is the smallest possible way to make a Vue file part of the placement topology.
|
|
540
|
+
|
|
541
|
+
### When `outlet` is the smaller correct tool
|
|
542
|
+
|
|
543
|
+
This is the right command when you want to say:
|
|
544
|
+
|
|
545
|
+
- "other things should be able to render here later"
|
|
546
|
+
|
|
547
|
+
without also saying:
|
|
548
|
+
|
|
549
|
+
- "this file should become a routed host page"
|
|
550
|
+
|
|
551
|
+
That is why `outlet` is often the better choice for:
|
|
552
|
+
|
|
553
|
+
- summary cards
|
|
554
|
+
- header/action regions
|
|
555
|
+
- detail panes
|
|
556
|
+
- reusable components that need extension points
|
|
557
|
+
|
|
558
|
+
If you do **not** need `RouterView` and you do **not** need child routes, `outlet` is usually the cleaner tool.
|
|
559
|
+
|
|
560
|
+
### Choosing a good custom `--target`
|
|
561
|
+
|
|
562
|
+
`--target` should be meaningful to humans, not just syntactically valid.
|
|
563
|
+
|
|
564
|
+
A target like:
|
|
565
|
+
|
|
566
|
+
```text
|
|
567
|
+
customer-view:summary-actions
|
|
568
|
+
```
|
|
569
|
+
|
|
570
|
+
is good because it tells you:
|
|
571
|
+
|
|
572
|
+
- the host area: `customer-view`
|
|
573
|
+
- the position or outlet purpose: `summary-actions`
|
|
574
|
+
|
|
575
|
+
That is much better than something vague like:
|
|
576
|
+
|
|
577
|
+
```text
|
|
578
|
+
custom-area:slot1
|
|
579
|
+
```
|
|
580
|
+
|
|
581
|
+
because the meaningful target name will later show up in:
|
|
582
|
+
|
|
583
|
+
- `jskit list-placements`
|
|
584
|
+
- placement entries
|
|
585
|
+
- future generator commands
|
|
586
|
+
|
|
587
|
+
So the target should describe the UI seam you are creating, not just satisfy the `host:position` format.
|
|
588
|
+
|
|
589
|
+
## `add-subpages` versus `outlet`
|
|
590
|
+
|
|
591
|
+
This is the distinction that most often causes hesitation.
|
|
592
|
+
|
|
593
|
+
Use `add-subpages` when:
|
|
594
|
+
|
|
595
|
+
- the page should stay visible while child routes render underneath it
|
|
596
|
+
- you need a routed host page
|
|
597
|
+
- you want later generated child pages to attach there automatically
|
|
598
|
+
|
|
599
|
+
Use `outlet` when:
|
|
600
|
+
|
|
601
|
+
- you only want a placement seam
|
|
602
|
+
- the file already exists
|
|
603
|
+
- you do not want routed children
|
|
604
|
+
|
|
605
|
+
So:
|
|
606
|
+
|
|
607
|
+
- `add-subpages` changes the routing shape of the page
|
|
608
|
+
- `outlet` changes only the placement shape of the file
|
|
609
|
+
|
|
610
|
+
`add-subpages` also tends to be the right tool when the parent page is meant to stay visible while a series of related child pages render under it. `outlet` is the right tool when the file just needs extension points.
|
|
611
|
+
|
|
612
|
+
## Picking the right command
|
|
613
|
+
|
|
614
|
+
The short rule is:
|
|
615
|
+
|
|
616
|
+
- use `page` for new route pages
|
|
617
|
+
- use `placed-element` for reusable placed UI
|
|
618
|
+
- use `add-subpages` when the page should become a routed host
|
|
619
|
+
- use `outlet` when you only need a placement target inside an existing file
|
|
620
|
+
|
|
621
|
+
And the slightly longer rule is:
|
|
622
|
+
|
|
623
|
+
- if it needs a URL, start from `page`
|
|
624
|
+
- if it needs child routes, add `add-subpages`
|
|
625
|
+
- if it does not need a URL but should render somewhere, use `placed-element`
|
|
626
|
+
- if the file already exists and only needs a target for later UI, use `outlet`
|
|
627
|
+
|
|
628
|
+
## Summary
|
|
629
|
+
|
|
630
|
+
`ui-generator` is the non-CRUD side of JSKIT scaffolding.
|
|
631
|
+
|
|
632
|
+
It writes app-owned UI structure in four different shapes:
|
|
633
|
+
|
|
634
|
+
- route pages
|
|
635
|
+
- placed components
|
|
636
|
+
- routed host pages
|
|
637
|
+
- plain placement seams
|
|
638
|
+
|
|
639
|
+
The most important thing to remember is that nested pages are not a special afterthought. Once a page has been upgraded with `add-subpages`, later `page` generation automatically treats that host as the real placement target.
|
|
640
|
+
|
|
641
|
+
That is why the commands fit together cleanly:
|
|
642
|
+
|
|
643
|
+
- `page` creates routes
|
|
644
|
+
- `add-subpages` turns routes into hosts
|
|
645
|
+
- `page` can then create nested child routes under those hosts
|
|
646
|
+
- `placed-element` and `outlet` handle the non-routed side of the same UI system
|
|
647
|
+
|
|
648
|
+
Once the UI you want is no longer just page structure and starts needing real database-backed list/view/new/edit behavior, move to the CRUD generators chapter.
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
<!-- Generated by `npm run agent-docs:build` from `docs/guide/index.md`. Do not edit manually. -->
|
|
2
|
+
|
|
3
|
+
# Guide
|
|
4
|
+
|
|
5
|
+
This guide is the main hands-on path through JSKIT.
|
|
6
|
+
|
|
7
|
+
It starts with the smallest scaffold, then explains how to work with the JSKIT CLI itself before adding the shell and authentication. After that, it introduces the database-backed users layer, expands into console and workspace-aware app structure, and adds a small `App extras` section for optional runtime packages such as realtime and assistant. Finally, the guide breaks out generator-specific workflows into their own section.
|
|
8
|
+
|
|
9
|
+
## Table of Contents
|
|
10
|
+
|
|
11
|
+
### App Setup
|
|
12
|
+
|
|
13
|
+
- [Initial Scaffolding](/guide/app-setup/initial-scaffolding)
|
|
14
|
+
- [Working With The JSKIT CLI](/guide/app-setup/working-with-the-jskit-cli)
|
|
15
|
+
- [A More Interesting Shell](/guide/app-setup/a-more-interesting-shell)
|
|
16
|
+
- [Authentication](/guide/app-setup/authentication)
|
|
17
|
+
- [Database Layer](/guide/app-setup/database-layer)
|
|
18
|
+
- [Users](/guide/app-setup/users)
|
|
19
|
+
- [Console](/guide/app-setup/console)
|
|
20
|
+
- [Multi-homing](/guide/app-setup/multi-homing)
|
|
21
|
+
|
|
22
|
+
### App Extras
|
|
23
|
+
|
|
24
|
+
- [Realtime](/guide/app-extras/realtime)
|
|
25
|
+
- [Assistant](/guide/app-extras/assistant)
|
|
26
|
+
|
|
27
|
+
### Generators
|
|
28
|
+
|
|
29
|
+
- [Intro](/guide/generators/intro)
|
|
30
|
+
- [UI Generators](/guide/generators/ui-generators)
|
|
31
|
+
- [CRUD Generators](/guide/generators/crud-generators)
|
|
32
|
+
- [Advanced CRUDs](/guide/generators/advanced-cruds)
|
|
33
|
+
|
|
34
|
+
## How to use this guide
|
|
35
|
+
|
|
36
|
+
- Start with `App Setup` if you are building up a JSKIT app from scratch.
|
|
37
|
+
- Use `App Extras` once the base app structure is in place and you want optional runtime packages.
|
|
38
|
+
- Jump into `Generators` if you already understand the runtime packages and want app-owned scaffolding workflows.
|
|
39
|
+
- Inside `Generators`, read `CRUD Generators` before `Advanced CRUDs`: the first chapter teaches the workflow, and the second explains the generated anatomy and customization points.
|