@xeplr/cli 0.3.6 → 0.3.7
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 +2 -0
- package/lib/generate/index.js +9 -1
- package/package.json +1 -1
- package/templates/.githooks/pre-commit +12 -0
- package/templates/CLAUDE.md +8 -2
- package/templates/README.md +2 -0
- package/templates/api/README.md +2 -1
- package/templates/api/bin/www +11 -6
- package/templates/api/development.env.tpl +8 -5
- package/templates/api/env.required.js +4 -0
- package/templates/api/gitignore.tpl +2 -2
- package/templates/api/package.json +5 -5
- package/templates/api/production.env.example +3 -2
- package/templates/ui/README.md +1 -0
- package/templates/ui/package.json +4 -2
- package/templates/ui/pages.json +19 -0
- package/templates/ui/src/index.css +7 -0
- package/templates/ui/src/pages/MenuSettings.jsx +10 -1
package/README.md
CHANGED
|
@@ -86,6 +86,8 @@ These are architecture decisions, not defaults to tune — each one exists becau
|
|
|
86
86
|
| **The browser is not a security boundary.** Front-end hooks (`ui/src/pages/Edit<Form>.jsx`) shape what people see and send; anything that must hold goes in server hooks (`api/screens/<form>/<form>.hooks.js`); data shape in the model (`<form>.model.js`). | `@xeplr/ui-factory`, `@xeplr/factory` | |
|
|
87
87
|
| **Anything every app would write identically lives in a package, not in the generated app.** A generated app is a starting point that then lives its own life — glue copied into it can never be fixed centrally, so an app made last month keeps that copy forever. When the flow designer needed this app's forms, its functions and its flows, the wiring went into `@xeplr/ui-factory` (`FlowDesignerPage`) and the generated page passes its two API clients. | `@xeplr/ui-factory` | A fix or a new control type has to reach apps that already exist, and it cannot reach code that was copied into them. `test/cli.test.js` fails if the glue reappears in the generated app. |
|
|
88
88
|
| **Every page works on a phone.** Below 640px the side rail is a bar across the top, forms from the designer go one field per row, and tables scroll sideways inside their own box with their row buttons pinned on screen. | `@xeplr/ui-account`, `@xeplr/ui-factory`, `@xeplr/ui-table`, `ui/src/index.css` | One design serves both. A phone-only copy of a screen drifts from the real one, and a scaled-down desktop form is text too small to read in boxes too small to tap. |
|
|
89
|
+
| **A screen is a document; a button is a registered function and its parameters; a page written by hand is web only.** Every route is listed in `ui/pages.json` — `documents`, or `webOnly` with the reason. | `@xeplr/ui-factory` (`xeplr-factory pages`), `.githooks/pre-commit`, Configure UI → Menu | What is a document can be drawn by anything that reads it — a phone app too. A hand-written page is allowed, but never a secret: every commit warns about it, and the menu tags it. |
|
|
90
|
+
| **Every file the app keeps is under `XEPLR_DATA_DIR`** — absolute, a folder per company. | `@xeplr/actions`, `@xeplr/factory`, `api/development.env` | One folder to back up, and no company reads another's files. A relative or missing folder is refused rather than read as empty. |
|
|
89
91
|
| **Every data address is under `/api`.** | `api/routes`, `ui/vite.config.js` | A page path and a data path must never collide. |
|
|
90
92
|
| **No guessed database names or connections.** | `api/development.env` | A wrong-but-present value starts cleanly and reads as empty data. |
|
|
91
93
|
| **Email is checked at start, never fatal.** The sign-in banner shows `email ✓ …` or `✗ NOT WORKING — reason`. | `@xeplr/auth` | Sign-in works without email; activation, invite and reset links cannot be sent until `EMAIL_PROVIDER` is set. |
|
package/lib/generate/index.js
CHANGED
|
@@ -115,6 +115,8 @@ function tenancySubstitutions(levels) {
|
|
|
115
115
|
|
|
116
116
|
// ui/src/App.jsx
|
|
117
117
|
__MT_APP_UI_IMPORTS__: on ? "import SelectScope, { ScopeGate } from './pages/SelectScope.jsx'" : '',
|
|
118
|
+
// ui/pages.json: the company picker is written by hand, so it is web only.
|
|
119
|
+
__MT_PAGES_SELECT__: on ? ' { "path": "/select", "menu": "Switch ' + first.label.toLowerCase() + '", "reason": "The ' + levels.map(function (l) { return l.label.toLowerCase(); }).join(' and ') + ' picker is written by hand." },' : '',
|
|
118
120
|
__MT_MENU_KEY__: on ? " 'Switch " + first.label.toLowerCase() + "'," : '',
|
|
119
121
|
__MT_DRAWER_ITEM__: on ? " { key: 'Switch " + first.label.toLowerCase() + "', icon: SwitchIcon, clickHandler: () => navigate('/select') }," : '',
|
|
120
122
|
__MT_SWITCH_ICON__: on ? [
|
|
@@ -288,6 +290,11 @@ function generate(answers, target) {
|
|
|
288
290
|
}
|
|
289
291
|
|
|
290
292
|
var subs = substitutions(answers);
|
|
293
|
+
// WHERE THE APP'S FILES LIVE — absolute, because a relative one would read
|
|
294
|
+
// different data depending on where the API was started. Made now: the API
|
|
295
|
+
// refuses a folder that does not exist rather than reading it as empty.
|
|
296
|
+
var dataDir = path.join(path.resolve(target), 'api', 'data');
|
|
297
|
+
subs.__DATA_DIR__ = dataDir;
|
|
291
298
|
var written = [];
|
|
292
299
|
|
|
293
300
|
var sources = {};
|
|
@@ -317,13 +324,14 @@ function generate(answers, target) {
|
|
|
317
324
|
// chmod there only touches the read-only flag — and a filesystem that
|
|
318
325
|
// refuses it entirely must not take the whole generation down over a
|
|
319
326
|
// permission that platform does not use.
|
|
320
|
-
if (outName === 'www') {
|
|
327
|
+
if (outName === 'www' || rel === path.join('.githooks', 'pre-commit')) {
|
|
321
328
|
try { fs.chmodSync(dest, 0o755); } catch (err) { /* not a unix filesystem */ }
|
|
322
329
|
}
|
|
323
330
|
|
|
324
331
|
written.push(path.join(dir, outName));
|
|
325
332
|
});
|
|
326
333
|
|
|
334
|
+
fs.mkdirSync(dataDir, { recursive: true });
|
|
327
335
|
return { written: written.sort() };
|
|
328
336
|
}
|
|
329
337
|
|
package/package.json
CHANGED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
#!/bin/sh
|
|
2
|
+
# WEB-ONLY PAGES, SAID OUT LOUD on every commit — never a block.
|
|
3
|
+
#
|
|
4
|
+
# ui/pages.json lists every page: drawn from screen documents (works in any
|
|
5
|
+
# renderer, a phone app included) or hand-written for the browser ("webOnly",
|
|
6
|
+
# with the reason). This prints a warning for each web-only page and for any
|
|
7
|
+
# route nobody listed. Installed by `npm install` in ui/ (its "prepare" sets
|
|
8
|
+
# git's hooksPath to .githooks).
|
|
9
|
+
if [ -x ui/node_modules/.bin/xeplr-factory ]; then
|
|
10
|
+
ui/node_modules/.bin/xeplr-factory pages ui
|
|
11
|
+
fi
|
|
12
|
+
exit 0
|
package/templates/CLAUDE.md
CHANGED
|
@@ -5,6 +5,8 @@ Forms are **screens** made with @xeplr/ui-factory and served by @xeplr/factory.
|
|
|
5
5
|
|
|
6
6
|
Read `api/node_modules/@xeplr/ui-factory/AUTHORING.md` for what screens, functions, front-end hooks and models mean. This file says where they go in **this** app.
|
|
7
7
|
|
|
8
|
+
**Before changing any screen or button, read the "Screens and buttons — the rules" section of `ui/node_modules/@xeplr/ui-factory/README.md` and follow it.** In short: a screen is a document; a button is a registered function and its parameters; a page written by hand is web only, listed in `ui/pages.json` with the reason — and before writing one, say so and ask whether to add the missing control to the factory instead.
|
|
9
|
+
|
|
8
10
|
## Create a new UI
|
|
9
11
|
|
|
10
12
|
A new UI is a **form**: a list, and an add / edit form it opens — on a page of its own (like Tasks) or in a popup — saved in its own table. Use the singular for `<form>` (`farming_department`), the plural for the page (`FarmingDepartments`).
|
|
@@ -32,7 +34,9 @@ Then change only what the request asks for:
|
|
|
32
34
|
| the request says… | change |
|
|
33
35
|
|---|---|
|
|
34
36
|
| a field, label, rule, dropdown, layout, colour | the screen JSON → validate → publish in Configure UI → Forms (or, never published yet, restart the API) |
|
|
35
|
-
|
|
|
37
|
+
| a button that does something to a record — set a status, confirm, approve | a **Buttons** control in the screen JSON naming a server function (`event: 'button'`, with an `inputSchema` — `options` for the values allowed) and its `params`; the function in `<form>.functions.js`. Several buttons that differ only by a value are ONE function |
|
|
38
|
+
| a list whose rows are worked out, a search box, filter chips with counts | a list with `rowsFrom` naming a server function (`event: 'listRows'`) that returns `{ rows, counts }` — it writes the text the list shows |
|
|
39
|
+
| hide / filter rows on screen, fill in a value before saving, check something before Next moves on | front-end hooks — `ui/src/pages/Edit<Form>.jsx` (`get`, `save`, `delete`, `step`). Browser only: say so if it matters on a phone |
|
|
36
40
|
| must / only if / check against / email when / only managers see | a server function — registered in `api/screens/<form>/<form>.functions.js` with its `event`, then named in `<form>-edit.screen.json`'s `events` (or picked in Configure UI → Flows → Events). Register before naming: a screen naming an unregistered function is refused at publish |
|
|
37
41
|
| store as / convert / comma-separated ↔ array / work out X from Y | server model — `api/screens/<form>/<form>.model.js` |
|
|
38
42
|
| a query in your own server code | `factory.table('<forms table>')` — this company, active rows, the model applied |
|
|
@@ -44,7 +48,7 @@ Then change only what the request asks for:
|
|
|
44
48
|
`text` (default), `textarea`, `number`, `date`, `datetime`, `checkbox`, `dropdown`, `radio`, `multiselect`, `file`, plus `stepper` and `label`. The sample uses every one — read `api/screens/task/task.entity.json` for how each is written. Three are worth knowing about:
|
|
45
49
|
|
|
46
50
|
- **`multiselect`** — several ids in ONE text column, comma separated, and an array in your code. An option's id may not contain a comma.
|
|
47
|
-
- **`file`** — the column holds the **path**, never the file. Say which extensions (`"accept": ".pdf,.docx"`) and how large (`"maxSize": 10`, in MB); the API enforces both, by extension, and keeps the file under `
|
|
51
|
+
- **`file`** — the column holds the **path**, never the file. Say which extensions (`"accept": ".pdf,.docx"`) and how large (`"maxSize": 10`, in MB); the API enforces both, by extension, and keeps the file in the company's own folder under `XEPLR_DATA_DIR` (`screens/<table>/`). Uploading needs `multer` in `api/` (already in package.json).
|
|
48
52
|
- **`stepper`** — a journey across the top. Every other field says which step it is on (`"step": "Planning"`), and one without a `step` shows on every step. `step(ctx)` in the front-end hooks runs before each move: return `false` to stay, a step's key to go there, `ctx.disable(['planning'])` to rule steps out (struck through on the bar, passed over by Next and Back) and `ctx.enable()` to bring them back.
|
|
49
53
|
|
|
50
54
|
**A list opens its form on a page or in a popup** — `"openIn": "page"` in the entity spec, or Configure UI → Forms → the list. A page needs `onOpenRecord` on the list's page (where to navigate) and `onDone` on the form's page (where Save and Cancel go back to): `Tasks.jsx` and `EditTask.jsx` show both, with routes `/tasks/new` and `/tasks/:id` in `App.jsx`.
|
|
@@ -69,4 +73,6 @@ Replace the bold parts. Add behaviour in the same message if you want it — "a
|
|
|
69
73
|
- Hooks and models are **methods** calling `super` — never arrow-function properties.
|
|
70
74
|
- `authFetch` returns the parsed body, not a Response.
|
|
71
75
|
- **Every page works on a phone.** Forms and lists from the designer stack themselves below 640px; a page written by hand puts its phone rules in the `@media (max-width: 640px)` block at the bottom of `ui/src/index.css` — inputs 16px or larger, buttons 44px tall, tables scrolling inside their own box, no fixed width wider than the screen. Do not design a second, phone-only screen.
|
|
76
|
+
- **Every page is in `ui/pages.json`:** under `documents` when it is drawn from screens, under `webOnly` with the reason when it is written by hand. The pre-commit hook (`.githooks/pre-commit`, installed by `npm install` in `ui/`) warns about every web-only page and every route not listed; Configure UI → Menu tags those items "Web only". It never blocks — it makes sure nobody is surprised that a page is missing from a phone app.
|
|
77
|
+
- **Every file the app keeps is under `XEPLR_DATA_DIR`**, in the company's own folder — never a folder of your own choosing, never a relative path.
|
|
72
78
|
- Sign-up needs email and `AUTH_REGISTER_ROLES` (the role a new account gets, in `api/development.env`); without either, registration is refused on purpose — never work around it by activating accounts or granting roles in SQL. An admin can activate an account from the User Roles screen.
|
package/templates/README.md
CHANGED
|
@@ -83,5 +83,7 @@ __WF_README__
|
|
|
83
83
|
| Designing and publishing forms is **Super Admin only**. | Publishing changes database tables. |
|
|
84
84
|
| Rules that must hold go in **server functions** (`api/functions/`), named in a screen's events; the browser only shapes what people see and send. | The browser is not a security boundary. |
|
|
85
85
|
| Every data address is under **`/api`**. | A page and a data path must never collide. |
|
|
86
|
+
| A screen is a **document**; a button is a **registered function and its parameters**; a page written by hand is **web only**, listed in `ui/pages.json` with the reason. | What is a document can be drawn anywhere — a phone app too. The pre-commit hook and Configure UI → Menu say which pages are not. |
|
|
87
|
+
| Every file the app keeps is under **`XEPLR_DATA_DIR`**, a folder per company. | One place to back up, and no company reads another's files. |
|
|
86
88
|
|
|
87
89
|
The full list, and where each piece lives, is in `CLAUDE.md`.
|
package/templates/api/README.md
CHANGED
|
@@ -27,7 +27,7 @@ The API (`@xeplr/base-apis`) and the sign-in service (`@xeplr/auth`), with this
|
|
|
27
27
|
| `screens/` | the forms this app ships with: per form, its spec, list and edit screens, server functions and model — registered in `screens/index.js` |
|
|
28
28
|
| `functions/` | this app's functions — the code screens' events and flows' `decide` pick by name — registered with `@xeplr/actions` by event, loaded at startup |
|
|
29
29
|
| `workflow.js` | flows: `@xeplr/workflow-api` started inside this API, in its own database (`DB_WORKFLOW`) |
|
|
30
|
-
| `
|
|
30
|
+
| `data/` | `XEPLR_DATA_DIR` in development: every file the app keeps, a folder per company — what people attach through a form's **file** field is in `<company>/screens/`. Never committed, and never served: a file comes back only through the API's own route, which checks the caller the way reading a record does |
|
|
31
31
|
| `migrations/` | hand-written SQL for tables no form owns |
|
|
32
32
|
| `migrations-auth/` | this app's rows in the sign-in database — menus (by key), permissions |
|
|
33
33
|
| `models/` | models for hand-written tables |
|
|
@@ -37,6 +37,7 @@ The API (`@xeplr/base-apis`) and the sign-in service (`@xeplr/auth`), with this
|
|
|
37
37
|
| Setting | |
|
|
38
38
|
|---|---|
|
|
39
39
|
| `REDIS_PREFIX` | **required, unique to this app** (`__NAME__:`) |
|
|
40
|
+
| `XEPLR_DATA_DIR` | **required, absolute, existing**: where every file the app keeps lives, a folder per company (`<root>/__NAME__/<company>/…`). Generated as `api/data`; on a server, somewhere backed up |
|
|
40
41
|
| `__PREFIX___CONNECTION`, `AUTH_DB_CONNECTION_INFO_ENCRYPTED` | the database, encrypted — `npm run db:encrypt` |
|
|
41
42
|
| `DB_API`, `AUTH_DB_NAME` | the two database names — never guessed |
|
|
42
43
|
| `AUTH_SUPER_ADMIN_EMAIL` / `_PASSWORD` | the first account — created once, when the sign-in database is first set up |
|
package/templates/api/bin/www
CHANGED
|
@@ -40,6 +40,11 @@ require('../functions');
|
|
|
40
40
|
var screens = require('../screens');
|
|
41
41
|
|
|
42
42
|
async function start() {
|
|
43
|
+
// WHICH PRODUCT THIS IS, for every file it keeps: each company's files live
|
|
44
|
+
// in <XEPLR_DATA_DIR>/__NAME__/<company>/… and nowhere else. Fixed here, at
|
|
45
|
+
// boot — never from a request.
|
|
46
|
+
require('@xeplr/db').registerApplication('__NAME__');
|
|
47
|
+
|
|
43
48
|
// Name the connection before anything uses it — the migrator resolves by
|
|
44
49
|
// name from a registry that getConnection does not populate.
|
|
45
50
|
await resolveConfig('api', process.env.__PREFIX___CONNECTION);
|
|
@@ -63,14 +68,14 @@ async function start() {
|
|
|
63
68
|
var knex = await require('../db/setup');
|
|
64
69
|
|
|
65
70
|
// The screens and their models. A malformed model stops startup here,
|
|
66
|
-
// rather than silently never running.
|
|
67
|
-
//
|
|
68
|
-
// served from it — a file comes back only through
|
|
69
|
-
// which checks the caller the way reading a record
|
|
71
|
+
// rather than silently never running. What people attach through a form's
|
|
72
|
+
// file field goes in the tenant's own folder under XEPLR_DATA_DIR
|
|
73
|
+
// (screens/); nothing is served from it — a file comes back only through
|
|
74
|
+
// the factory's own route, which checks the caller the way reading a record
|
|
75
|
+
// does.
|
|
70
76
|
await factory.init({
|
|
71
77
|
knex: knex,
|
|
72
|
-
models: screens.models
|
|
73
|
-
filesDir: process.env.FACTORY_FILES_DIR
|
|
78
|
+
models: screens.models
|
|
74
79
|
});
|
|
75
80
|
|
|
76
81
|
// Screens never published yet are published now, creating their tables.
|
|
@@ -76,11 +76,14 @@ AUTH_RESET_URL=http://localhost:__UI_PORT__/auth/reset-password
|
|
|
76
76
|
# more than one; Super Admin is never allowed here.
|
|
77
77
|
AUTH_REGISTER_ROLES=Viewer
|
|
78
78
|
|
|
79
|
-
# ──
|
|
80
|
-
#
|
|
81
|
-
#
|
|
82
|
-
#
|
|
83
|
-
|
|
79
|
+
# ── Where this app's files live ──
|
|
80
|
+
# Everything the app keeps on disk — what people attach through a form's FILE
|
|
81
|
+
# field, files a flow reads or writes — is under this one folder, a folder per
|
|
82
|
+
# company inside it: <XEPLR_DATA_DIR>/__NAME__/<company>/screens/… The record
|
|
83
|
+
# stores a path inside that folder; the file is served only through the API's
|
|
84
|
+
# own route, which checks the caller the way reading a record does.
|
|
85
|
+
# ABSOLUTE, and it must exist: a wrong folder would read as empty data.
|
|
86
|
+
XEPLR_DATA_DIR=__DATA_DIR__
|
|
84
87
|
|
|
85
88
|
# ── Email ──
|
|
86
89
|
# Needed for anyone but the super admin to get in: registration, resending an
|
|
@@ -14,6 +14,10 @@ module.exports = [
|
|
|
14
14
|
// AUTH_ACTIVATION_URL, AUTH_RESET_URL
|
|
15
15
|
...require('@xeplr/auth').requiredEnv,
|
|
16
16
|
|
|
17
|
+
// XEPLR_DATA_DIR — the one folder every file this app keeps lives under,
|
|
18
|
+
// a folder per company inside it. Absolute, and never defaulted.
|
|
19
|
+
...require('@xeplr/actions').requiredEnv,
|
|
20
|
+
|
|
17
21
|
// ── this app's own ──
|
|
18
22
|
'__PREFIX___PORT',
|
|
19
23
|
|
|
@@ -19,16 +19,16 @@
|
|
|
19
19
|
"dependencies": {
|
|
20
20
|
"@xeplr/auth": "^1.3.0",
|
|
21
21
|
"@xeplr/base-apis": "^2.0.0",
|
|
22
|
-
"@xeplr/db": "^1.0
|
|
23
|
-
"@xeplr/factory": "^
|
|
24
|
-
"@xeplr/ui-factory": "^1.8.
|
|
22
|
+
"@xeplr/db": "^1.1.0",
|
|
23
|
+
"@xeplr/factory": "^3.0.1",
|
|
24
|
+
"@xeplr/ui-factory": "^1.8.4",
|
|
25
25
|
"@xeplr/utils": "^1.0.11",
|
|
26
26
|
"dotenv": "^17.4.2",
|
|
27
27
|
"express": "^5.2.0",
|
|
28
28
|
"multer": "^2.0.2",
|
|
29
29
|
"nodemailer": "^10.0.2",
|
|
30
|
-
"@xeplr/actions": "^
|
|
31
|
-
"@xeplr/workflow-api": "^
|
|
30
|
+
"@xeplr/actions": "^2.2.0",
|
|
31
|
+
"@xeplr/workflow-api": "^2.1.0"
|
|
32
32
|
},
|
|
33
33
|
"devDependencies": {
|
|
34
34
|
"dotenv-cli": "^8.0.0",
|
|
@@ -35,5 +35,6 @@ AUTH_TENANT_HEADER=none
|
|
|
35
35
|
AUTH_ACTIVATION_URL=https://app.example.com/auth/activate
|
|
36
36
|
AUTH_INVITE_URL=https://app.example.com/auth/accept-invite
|
|
37
37
|
|
|
38
|
-
# ──
|
|
39
|
-
|
|
38
|
+
# ── Where this app's files live — an absolute folder that exists ──
|
|
39
|
+
# A folder per company inside it: <XEPLR_DATA_DIR>/__NAME__/<company>/…
|
|
40
|
+
XEPLR_DATA_DIR=/var/lib/__NAME__/data
|
package/templates/ui/README.md
CHANGED
|
@@ -28,3 +28,4 @@ npm run build # → dist/
|
|
|
28
28
|
- The rail is 48px when collapsed; `--app-rail-width` in `src/index.css` reserves the same space and must match it.
|
|
29
29
|
- **Phones work without extra code.** Below 640px the rail becomes a bar across the top (`@xeplr/ui-account`) and `src/index.css` gives the page's top to it instead of its left (`--xeplr-nav-bar-height`). Forms and lists made in the designer stack themselves (`@xeplr/ui-factory`); tables keep scrolling sideways with their row buttons pinned on screen (`@xeplr/ui-table`). A page you write by hand follows the same rules in the phone block at the bottom of `src/index.css`: inputs 16px or larger (or iOS zooms the page), buttons 44px tall, tables that scroll inside their own box, nothing a fixed width wider than the screen.
|
|
30
30
|
- Set page backgrounds on a container inside the theme, never on `body`.
|
|
31
|
+
- **`pages.json` lists every route**: `documents` (drawn from screens — works in any renderer, a phone app included) or `webOnly` (written by hand, with the reason). `npm run pages` prints the warnings the pre-commit hook prints: each web-only page, each route not listed, each listed page no route has. `npm install` here points git at `../.githooks`, where that hook is. Configure UI → Menu tags web-only items.
|
|
@@ -6,13 +6,15 @@
|
|
|
6
6
|
"scripts": {
|
|
7
7
|
"dev": "vite",
|
|
8
8
|
"build": "vite build",
|
|
9
|
-
"preview": "vite preview"
|
|
9
|
+
"preview": "vite preview",
|
|
10
|
+
"pages": "xeplr-factory pages .",
|
|
11
|
+
"prepare": "git -C .. config core.hooksPath .githooks 2>/dev/null || true"
|
|
10
12
|
},
|
|
11
13
|
"dependencies": {
|
|
12
14
|
"@tanstack/react-table": "^8.21.3",
|
|
13
15
|
"@xeplr/ui-account": "^1.4.2",
|
|
14
16
|
"@xeplr/ui-canvas": "^1.1.0",
|
|
15
|
-
"@xeplr/ui-factory": "^1.8.
|
|
17
|
+
"@xeplr/ui-factory": "^1.8.4",
|
|
16
18
|
"@xeplr/ui-table": "^1.1.3",
|
|
17
19
|
"react": "^19.2.4",
|
|
18
20
|
"react-dom": "^19.2.4",
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
{
|
|
2
|
+
"routes": ["src/App.jsx"],
|
|
3
|
+
"documents": [
|
|
4
|
+
{ "path": "/tasks", "menu": "Tasks", "screen": "task_list" },
|
|
5
|
+
{ "path": "/tasks/new", "screen": "task_edit" },
|
|
6
|
+
{ "path": "/tasks/:id", "screen": "task_edit" },
|
|
7
|
+
{ "path": "/forms/:form", "screen": "every form's list" },
|
|
8
|
+
{ "path": "/journey/:flow", "screen": "a flow's screens" },
|
|
9
|
+
{ "path": "/journey/:flow/:run", "screen": "a flow's screens" }
|
|
10
|
+
],
|
|
11
|
+
"webOnly": [
|
|
12
|
+
__MT_PAGES_SELECT__
|
|
13
|
+
{ "path": "/home", "menu": "Home", "reason": "The starter page that proves sign-in and the API work — replace it with your first page." },
|
|
14
|
+
{ "path": "/flows", "menu": "Flows", "reason": "The flows list and designer are tools for building, used on a computer." },
|
|
15
|
+
{ "path": "/configure/flows/:flow", "reason": "The flow designer is a tool for building, used on a computer." },
|
|
16
|
+
{ "path": "/configure", "menu": "Configure UI", "reason": "The form designer and menu settings are tools for building, used on a computer." },
|
|
17
|
+
{ "path": "/configure/forms/:form/design/:part", "reason": "The form designer is a tool for building, used on a computer." }
|
|
18
|
+
]
|
|
19
|
+
}
|
|
@@ -359,6 +359,13 @@ body { margin: 0; }
|
|
|
359
359
|
}
|
|
360
360
|
|
|
361
361
|
.app-menu-hidden td { opacity: 0.5; }
|
|
362
|
+
/* A menu item whose page is hand-written for the browser (ui/pages.json): it
|
|
363
|
+
will not be in a phone app. The reason is its tooltip. */
|
|
364
|
+
.app-web-only {
|
|
365
|
+
display: inline-block; margin-left: 8px; padding: 1px 7px; border-radius: 999px; white-space: nowrap;
|
|
366
|
+
font-size: 11px; font-weight: 600; cursor: help;
|
|
367
|
+
color: var(--xeplr-warning, #a86a00); background: color-mix(in srgb, var(--xeplr-warning, #a86a00) 14%, transparent);
|
|
368
|
+
}
|
|
362
369
|
|
|
363
370
|
.app-menu-shown { display: inline-flex; gap: 6px; align-items: center; }
|
|
364
371
|
|
|
@@ -5,7 +5,13 @@
|
|
|
5
5
|
// Saved for everyone at once; your own rail updates straight away.
|
|
6
6
|
import { useCallback, useEffect, useState } from 'react'
|
|
7
7
|
import { listMenuItems, saveMenuItems, useAccess } from '@xeplr/ui-account'
|
|
8
|
+
import { webOnlyMenus } from '@xeplr/ui-factory'
|
|
8
9
|
import { APP_MENU_KEYS, FORM_MENU_PREFIX } from '../menu.js'
|
|
10
|
+
import pages from '../../pages.json'
|
|
11
|
+
|
|
12
|
+
// Items whose page is hand-written for the browser (ui/pages.json "webOnly"):
|
|
13
|
+
// tagged, so whoever arranges the menu knows they will not be in a phone app.
|
|
14
|
+
const WEB_ONLY = webOnlyMenus(pages)
|
|
9
15
|
|
|
10
16
|
// The app's own items (ui/src/menu.js) and forms added to the menu. The rest —
|
|
11
17
|
// sign-in's pages (Login, Register …) and admin screens — only with "Show all".
|
|
@@ -80,7 +86,10 @@ export default function MenuSettings() {
|
|
|
80
86
|
<td>
|
|
81
87
|
<input className="app-menu-label" value={it.label} placeholder={it.name} aria-label={'Label for ' + it.name} onChange={(e) => change(it.name, { label: e.target.value })} />
|
|
82
88
|
</td>
|
|
83
|
-
<td
|
|
89
|
+
<td>
|
|
90
|
+
<code>{it.name}</code>
|
|
91
|
+
{WEB_ONLY[it.name] && <span className="app-web-only" title={WEB_ONLY[it.name]}>Web only</span>}
|
|
92
|
+
</td>
|
|
84
93
|
<td>
|
|
85
94
|
<label className="app-menu-shown">
|
|
86
95
|
<input type="checkbox" checked={!it.isHidden} onChange={(e) => change(it.name, { isHidden: !e.target.checked })} /> Shown
|