@quixomatic/rpf 0.3.2 → 0.3.3
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/CHANGELOG.md +190 -0
- package/README.md +4 -2
- package/assets/dev-host/kit-manifest.json +1 -1
- package/assets/forge-app/app/assets/{_forge-shiki-langs-nxHsAEiY.js → _forge-shiki-langs-Bm9NaYXm.js} +1 -1
- package/assets/forge-app/app/assets/{appendItems-CLsiMCGq.js → appendItems-DrlkyU0a.js} +1 -1
- package/assets/forge-app/app/assets/{core-DEkUYqk0.js → core-8OhGxroQ.js} +1 -1
- package/assets/forge-app/app/assets/{diff-view-ctlXj2p5.js → diff-view-rgZLuZMg.js} +4 -4
- package/assets/forge-app/app/assets/file-panel-CpPZ9DXB.js +1199 -0
- package/assets/forge-app/app/assets/{highlights-CEbVTJAm.js → highlights-C-SEG213.js} +1 -1
- package/assets/forge-app/app/assets/index-DWGc27yI.css +1 -0
- package/assets/forge-app/app/assets/index-DXDXX5UZ.js +298 -0
- package/assets/forge-app/app/assets/{loader-V5V4Ad0d.js → loader-Du5I86pW.js} +1 -1
- package/assets/forge-app/app/assets/{shiki-B5GY8Ub_.js → shiki-Bf12fWbJ.js} +2 -2
- package/assets/forge-app/app/assets/{stream-tokenizer-CZZoarTM.js → stream-tokenizer-DdzFthqp.js} +1 -1
- package/assets/forge-app/app/assets/{terminal-view-BR9EXBM5.js → terminal-view-Co0jXSWF.js} +1 -1
- package/assets/forge-app/app/assets/{themes-BMbfM7BC.js → themes-BrkVmSlQ.js} +2 -2
- package/assets/forge-app/app/assets/{useNextRenderData-ICppXFTX.js → useNextRenderData-BKv-kpPs.js} +3 -3
- package/assets/forge-app/app/index.html +2 -2
- package/assets/forge-app/server.mjs +2445 -8770
- package/dist/cli.mjs +11908 -6997
- package/examples/component-workspace/README.md +23 -0
- package/examples/component-workspace/components/@example/greeting/component.json +8 -0
- package/examples/component-workspace/components/@example/greeting/main.tsx +22 -0
- package/examples/component-workspace/components/@example/greeting/options.schema.json +6 -0
- package/examples/component-workspace/forge.workspace.json +7 -0
- package/examples/component-workspace/stage.json +11 -0
- package/examples/header-slot-widget/README.md +30 -0
- package/examples/header-slot-widget/components/@example/page-actions/component.json +8 -0
- package/examples/header-slot-widget/components/@example/page-actions/main.tsx +37 -0
- package/examples/header-slot-widget/components/@example/page-actions/options.schema.json +9 -0
- package/examples/index.json +159 -0
- package/examples/layout-regions/README.md +41 -0
- package/examples/layout-regions/components/@example/workspace-shell/component.json +21 -0
- package/examples/layout-regions/components/@example/workspace-shell/main.tsx +61 -0
- package/examples/layout-regions/components/@example/workspace-shell/options.schema.json +29 -0
- package/examples/layout-regions/components/@example/workspace-shell/styles.css +95 -0
- package/examples/portal-list-page/README.md +22 -0
- package/examples/portal-list-page/portal.mjs +40 -0
- package/examples/portal-record-page/README.md +23 -0
- package/examples/portal-record-page/portal.mjs +62 -0
- package/examples/primitive-and-utility/README.md +19 -0
- package/examples/primitive-and-utility/components/@example/number-format/component.json +6 -0
- package/examples/primitive-and-utility/components/@example/number-format/main.tsx +30 -0
- package/examples/primitive-and-utility/components/@example/stat-tile/component.json +6 -0
- package/examples/primitive-and-utility/components/@example/stat-tile/main.tsx +45 -0
- package/examples/primitive-and-utility/components/@example/work-summary/component.json +9 -0
- package/examples/primitive-and-utility/components/@example/work-summary/main.tsx +31 -0
- package/examples/primitive-and-utility/components/@example/work-summary/options.schema.json +6 -0
- package/examples/primitive-and-utility/components/@example/work-summary/server.js +27 -0
- package/examples/side-panel/README.md +18 -0
- package/examples/side-panel/components/@example/help-button/component.json +8 -0
- package/examples/side-panel/components/@example/help-button/main.tsx +26 -0
- package/examples/side-panel/components/@example/help-button/options.schema.json +7 -0
- package/examples/side-panel/portal.mjs +46 -0
- package/examples/theme/README.md +16 -0
- package/examples/theme/themes/teal-harbor/theme.css +11 -0
- package/examples/theme/themes/teal-harbor/theme.json +8 -0
- package/examples/theme/themes/teal-harbor/tokens.json +72 -0
- package/examples/widget-options/README.md +25 -0
- package/examples/widget-options/components/@example/notice-banner/component.json +14 -0
- package/examples/widget-options/components/@example/notice-banner/main.tsx +60 -0
- package/examples/widget-options/components/@example/notice-banner/options.schema.json +24 -0
- package/examples/widget-server-user/README.md +21 -0
- package/examples/widget-server-user/components/@example/user-card/component.json +9 -0
- package/examples/widget-server-user/components/@example/user-card/main.tsx +51 -0
- package/examples/widget-server-user/components/@example/user-card/options.schema.json +6 -0
- package/examples/widget-server-user/components/@example/user-card/server.js +27 -0
- package/package.json +7 -3
- package/skills/react-portal/SKILL.md +23 -1
- package/skills/react-portal/references/cli.md +11 -0
- package/skills/react-portal/references/components.md +40 -2
- package/assets/forge-app/app/assets/file-panel-BnUdO2N6.js +0 -1199
- package/assets/forge-app/app/assets/index-DYFQser1.js +0 -291
- package/assets/forge-app/app/assets/index-Ddi87x2p.css +0 -1
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
# Widget with a server script: the signed-in user
|
|
2
|
+
|
|
3
|
+
A widget whose `server.js` reads the current user's `sys_user` record with `GlideRecordSecure`, and whose `main.tsx`
|
|
4
|
+
shows it through `useServer()` with a pending state.
|
|
5
|
+
|
|
6
|
+
## Files
|
|
7
|
+
|
|
8
|
+
- `component.json`: `kind: "widget"`, `placeable: true`, **`serverMode: "on-load"`** (the workspace file's spelling;
|
|
9
|
+
the record field is `server_mode`). `server.js` runs only when `serverMode` is set: `on-load` runs it before the
|
|
10
|
+
first render and on every client call, `on-demand` only when the client calls `server.get / update / refresh`.
|
|
11
|
+
- `server.js`: an IIFE that fills `data`. `input` is the client's call input, `options` the placement's effective
|
|
12
|
+
options, `data` starts empty on every call.
|
|
13
|
+
- `main.tsx`: `useServer()` returns `{ data, pending, error, server }`. `data` is undefined until the first result.
|
|
14
|
+
- `options.schema.json` + `defaults` in `component.json`: one boolean option, read by both sides.
|
|
15
|
+
|
|
16
|
+
## Notes
|
|
17
|
+
|
|
18
|
+
- Only the name? `useUser()` from `@portal/runtime` has it on the client with no server script. The server version is
|
|
19
|
+
for fields beyond it, read with the visitor's ACLs.
|
|
20
|
+
- Start a component from it: `scaffold_component { id: '<ns>/<key>', from: 'widget-server-user' }` (MCP) or
|
|
21
|
+
`rpf new component <ns>/<key> --from widget-server-user`.
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "User card",
|
|
3
|
+
"kind": "widget",
|
|
4
|
+
"description": "The signed-in user's name, title, department and email, read on the server with their own ACLs",
|
|
5
|
+
"placeable": true,
|
|
6
|
+
"serverMode": "on-load",
|
|
7
|
+
"tailwind": true,
|
|
8
|
+
"defaults": { "showEmail": true }
|
|
9
|
+
}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { useServer } from '@portal/runtime';
|
|
2
|
+
import { UserAvatar } from 'components:avatar';
|
|
3
|
+
import { Card, CardContent } from 'components:card';
|
|
4
|
+
import { Skeleton } from 'components:skeleton';
|
|
5
|
+
|
|
6
|
+
type Options = { showEmail?: boolean };
|
|
7
|
+
type User = { sysId: string; name: string; title: string; department: string; email: string };
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* components:example/user-card: the signed-in user's name, title, department and email, read by server.js.
|
|
11
|
+
*
|
|
12
|
+
* useServer() gives `data` (undefined until the first result), `pending` (on-load: true until the page's
|
|
13
|
+
* initialize result for the current URL params arrives) and `error`. The skeleton covers both "pending" and
|
|
14
|
+
* "no data yet", so the card never flashes an empty state.
|
|
15
|
+
*/
|
|
16
|
+
export default function UserCard({ options = {} }: { options?: Options }) {
|
|
17
|
+
const { data, pending, error } = useServer();
|
|
18
|
+
const user = data ? (data.user as User | null) : undefined;
|
|
19
|
+
return (
|
|
20
|
+
<Card>
|
|
21
|
+
<CardContent className="flex items-center gap-3">
|
|
22
|
+
{error ? (
|
|
23
|
+
<p className="text-sm text-destructive">{error.message}</p>
|
|
24
|
+
) : pending || user === undefined ? (
|
|
25
|
+
<>
|
|
26
|
+
<Skeleton className="size-10 rounded-full" />
|
|
27
|
+
<div className="flex flex-col gap-2">
|
|
28
|
+
<Skeleton className="h-4 w-32" />
|
|
29
|
+
<Skeleton className="h-3 w-24" />
|
|
30
|
+
</div>
|
|
31
|
+
</>
|
|
32
|
+
) : user === null ? (
|
|
33
|
+
<p className="text-sm text-muted-foreground">No user record to show.</p>
|
|
34
|
+
) : (
|
|
35
|
+
<>
|
|
36
|
+
<UserAvatar name={user.name} size="lg" />
|
|
37
|
+
<div className="min-w-0">
|
|
38
|
+
<p className="truncate font-medium">{user.name}</p>
|
|
39
|
+
<p className="truncate text-sm text-muted-foreground">
|
|
40
|
+
{[user.title, user.department].filter(Boolean).join(' · ')}
|
|
41
|
+
</p>
|
|
42
|
+
{options.showEmail !== false && user.email ? (
|
|
43
|
+
<p className="truncate text-sm">{user.email}</p>
|
|
44
|
+
) : null}
|
|
45
|
+
</div>
|
|
46
|
+
</>
|
|
47
|
+
)}
|
|
48
|
+
</CardContent>
|
|
49
|
+
</Card>
|
|
50
|
+
);
|
|
51
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Server script of components:example/user-card: reads the signed-in user's own sys_user record.
|
|
3
|
+
*
|
|
4
|
+
* serverMode is "on-load" (component.json), so this runs in the page's initialize batch and the first render already
|
|
5
|
+
* has the data; it runs again on every server.refresh() / update() from the client.
|
|
6
|
+
*
|
|
7
|
+
* - gs.getUserID() is the visitor (the impersonated user while impersonating).
|
|
8
|
+
* - GlideRecordSecure applies the visitor's ACLs: a field they can't read comes back empty instead of leaking.
|
|
9
|
+
* - data starts empty on every call; store plain values (getValue / getDisplayValue), never GlideElements.
|
|
10
|
+
* - ES5 on purpose (var, function): it parses in every application's JavaScript mode.
|
|
11
|
+
*/
|
|
12
|
+
(function () {
|
|
13
|
+
var user = new GlideRecordSecure('sys_user');
|
|
14
|
+
if (!user.get(gs.getUserID())) {
|
|
15
|
+
// No readable record (a guest, or ACLs hide it): the client shows its empty state.
|
|
16
|
+
data.user = null;
|
|
17
|
+
return;
|
|
18
|
+
}
|
|
19
|
+
data.user = {
|
|
20
|
+
sysId: user.getUniqueValue(),
|
|
21
|
+
name: user.getDisplayValue('name') || user.getValue('user_name'),
|
|
22
|
+
title: user.getValue('title') || '',
|
|
23
|
+
department: user.getDisplayValue('department') || '',
|
|
24
|
+
// The placement decides whether the email is shown; the server leaves it out entirely when not.
|
|
25
|
+
email: options.showEmail === false ? '' : user.getValue('email') || '',
|
|
26
|
+
};
|
|
27
|
+
})();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@quixomatic/rpf",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.3",
|
|
4
4
|
"description": "React Portal from the terminal: instance profiles, sign-in, new draft portals, local workspaces, live lookups, built-in Claude Code skills, health checks and the Forge MCP server for ServiceNow instances running React Portal.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -14,6 +14,7 @@
|
|
|
14
14
|
"files": [
|
|
15
15
|
"dist",
|
|
16
16
|
"skills",
|
|
17
|
+
"examples",
|
|
17
18
|
"assets",
|
|
18
19
|
"LICENSE",
|
|
19
20
|
"README.md",
|
|
@@ -33,8 +34,8 @@
|
|
|
33
34
|
"build": "bun run scripts/build.ts",
|
|
34
35
|
"dev": "bun run src/cli.ts",
|
|
35
36
|
"typecheck": "bunx tsc --noEmit",
|
|
36
|
-
"test": "bun run test/update.ts && bun run test/cli.ts && bun run test/init.ts && bun run test/skills.ts && bun run test/seed.ts",
|
|
37
|
-
"test:dist": "bun run build && bun run test/cli.ts --dist && bun run test/init.ts --dist && bun run test/skills.ts --dist && bun run test/seed.ts --dist",
|
|
37
|
+
"test": "bun run test/update.ts && bun run test/cli.ts && bun run test/init.ts && bun run test/skills.ts && bun run test/seed.ts && bun run test/knowledge.ts && bun run test/discovery.ts && bun run test/refs.ts",
|
|
38
|
+
"test:dist": "bun run build && bun run test/cli.ts --dist && bun run test/init.ts --dist && bun run test/skills.ts --dist && bun run test/seed.ts --dist && bun run test/knowledge.ts --dist && bun run test/discovery.ts --dist && bun run test/refs.ts --dist",
|
|
38
39
|
"test:mcp": "bun run test/mcp.ts",
|
|
39
40
|
"test:workspace": "bun run test/workspace.ts",
|
|
40
41
|
"test:live": "bun run test/workspace.ts --live",
|
|
@@ -43,6 +44,9 @@
|
|
|
43
44
|
"test:update": "bun run test/update.ts",
|
|
44
45
|
"test:skills": "bun run test/skills.ts",
|
|
45
46
|
"test:seed": "bun run test/seed.ts",
|
|
47
|
+
"test:knowledge": "bun run test/knowledge.ts",
|
|
48
|
+
"test:discovery": "bun run test/discovery.ts",
|
|
49
|
+
"test:refs": "bun run test/refs.ts",
|
|
46
50
|
"release:cli": "bun run scripts/release-cli.ts"
|
|
47
51
|
},
|
|
48
52
|
"dependencies": {
|
|
@@ -21,6 +21,10 @@ Read the reference pages when the task needs them:
|
|
|
21
21
|
|
|
22
22
|
## Ground rules
|
|
23
23
|
|
|
24
|
+
- **Step 0: orient.** Before anything else run `rpforge orient` (MCP: the `orientation` tool) and read every doc its
|
|
25
|
+
reading list names for the task. It returns the hard rules, the workspace, the instance's React Portal version and
|
|
26
|
+
features, the component anatomy card, the examples index and a catalog summary. `rpforge orient --topic <id>`
|
|
27
|
+
expands one block (`anatomy`, `catalog`, `examples`, `rules`, …).
|
|
24
28
|
- **Drafts only. Never publish.** rpforge has no publish command. New portals are inactive drafts; a person with the
|
|
25
29
|
publish capability publishes in Studio (Portals activity). Don't try to set `active: true` on a portal.
|
|
26
30
|
- **Never delete.** Pushes never delete records. To remove a page, placement, panel, variant or menu item, keep it in
|
|
@@ -92,7 +96,9 @@ for `rpforge resolve`. A pull never writes to the instance.
|
|
|
92
96
|
1. **Look before you build.** Reuse what exists (see "Look it up live" below).
|
|
93
97
|
2. **Edit files.** `portal.mjs` for structure, `components/@<ns>/<key>/` for code, `themes/<key>/` for the theme. New
|
|
94
98
|
component: `rpforge new component acme/order-card --kind widget` (kinds: widget, primitive, block, layout,
|
|
95
|
-
utility)
|
|
99
|
+
utility; a widget comes with `server.js`, `options.schema.json`, `styles.css` and `serverMode: "on-demand"`), or
|
|
100
|
+
start from an example: `rpforge new component acme/user-card --from widget-server-user`. `rpforge examples`
|
|
101
|
+
lists them (`rpforge examples show <id>` prints one).
|
|
96
102
|
3. **`rpforge status`**: local changes, instance changes made meanwhile (who and when), conflicts, untracked files.
|
|
97
103
|
`rpforge diff page:home` shows one entry; `rpforge diff --against instance` compares with the instance now.
|
|
98
104
|
4. **`rpforge check`**: Prettier, a lint for the hard rules, the instance compiling every changed component (nothing
|
|
@@ -122,6 +128,22 @@ self-sufficient.
|
|
|
122
128
|
The instance is the source of truth for what exists: its catalog and docs change with each React Portal upgrade, so
|
|
123
129
|
look them up instead of guessing.
|
|
124
130
|
|
|
131
|
+
Before you build a page or a component, find how the portals already build it, and reuse that:
|
|
132
|
+
|
|
133
|
+
```sh
|
|
134
|
+
rpforge patterns my hr cases # find_pattern: patterns for what you build (primitives, data, pitfalls)
|
|
135
|
+
rpforge patterns show list-page # show_example: its example page live (layout, placements, options)
|
|
136
|
+
rpforge catalog modal # search_catalog: the kit and every component, by meaning ("modal" → dialog)
|
|
137
|
+
rpforge usage app/list-view # where_used: real placements and their options
|
|
138
|
+
rpforge data tables hr case # data_find_tables: tables you can read
|
|
139
|
+
rpforge data table sn_hr_core_case # describe_table: fields, types, choice labels
|
|
140
|
+
rpforge data query incident "active=true^caller_id=…" # data_query: count, rows, every term checked
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
`data query` flags terms on fields that don't exist (the platform drops them silently, so a filter that "works" may
|
|
144
|
+
return everything): check every `fixedQuery`, `query` option and `server.js` query with it. Also `data sample`,
|
|
145
|
+
`data relations`, `data stats` (counts) and `data graphql` (queries only). The MCP has the same tools.
|
|
146
|
+
|
|
125
147
|
```sh
|
|
126
148
|
rpforge components --kind primitive
|
|
127
149
|
rpforge components record form
|
|
@@ -125,6 +125,17 @@ Keys, as `status` lists them: `page:<route>`, `variant:<route>#<key>`, `panel:<k
|
|
|
125
125
|
| `rpforge api useTableQuery` | Exact API reference for a hook or function |
|
|
126
126
|
| `rpforge api components:dialog` | A host-kit module and its exports |
|
|
127
127
|
| `rpforge api components:app/record-form` | A record component's props |
|
|
128
|
+
| `rpforge patterns <intent>` | Patterns for what you build: primitives, data, examples, first pitfalls (no intent: every pattern) |
|
|
129
|
+
| `rpforge patterns show list-page` | A pattern's example page live (or a page: `portal:route`): layout, regions, placements with full options |
|
|
130
|
+
| `rpforge catalog <words>` | The kit and every component ranked by meaning, with synonyms (`--kind`, `--area`, `--refresh`) |
|
|
131
|
+
| `rpforge usage app/list-view` | Where a component is placed, with each placement's options |
|
|
132
|
+
| `rpforge data tables <words>` | Tables you can read whose name or label matches (`--scope`, `--extends`) |
|
|
133
|
+
| `rpforge data table <name>` | Fields, types, references, choices with labels, the extends chain |
|
|
134
|
+
| `rpforge data query <table> [query]` | Count and rows (≤ 20) as you; every term checked (`--fields`, `--order-by`, `--display-value`) |
|
|
135
|
+
| `rpforge data sample <table> [query]` | A few records (≤ 5, display values) |
|
|
136
|
+
| `rpforge data relations <table>` | Inbound references, many-to-many tables, related lists |
|
|
137
|
+
| `rpforge data stats <table> [query] --group-by state` | Counts, per value with `--group-by` |
|
|
138
|
+
| `rpforge data graphql '<query>'` | A GraphQL query as you (`@file` or `-` for stdin; mutations refused) |
|
|
128
139
|
| `rpforge themes` | Themes and presets, which portals use them |
|
|
129
140
|
| `rpforge themes get ocean-breeze` | A theme's `tokens.json` and `theme.css` |
|
|
130
141
|
| `rpforge themes generate --color "#2563eb"` | Contrast-checked light and dark tokens from a brand color, made locally |
|
|
@@ -1,8 +1,42 @@
|
|
|
1
1
|
# Components
|
|
2
2
|
|
|
3
3
|
Every piece of portal code is a component record, compiled on the instance. In a workspace each one is a folder,
|
|
4
|
-
`components/@<ns>/<key>/`. Scaffold new ones with `rpforge new component acme/order-card --kind widget
|
|
5
|
-
`
|
|
4
|
+
`components/@<ns>/<key>/`. Scaffold new ones with `rpforge new component acme/order-card --kind widget` (MCP:
|
|
5
|
+
`scaffold_component`), never from a blank file: every kind starts with all its files. `--from <example>` starts from
|
|
6
|
+
one of rpf's examples (`rpforge examples`). `rpforge check` compiles them on the instance without saving;
|
|
7
|
+
`rpforge push` creates them.
|
|
8
|
+
|
|
9
|
+
## The anatomy card
|
|
10
|
+
|
|
11
|
+
- **Files** (`components/@<ns>/<key>/`): `main.tsx` (default export = the component; primitives and utilities export
|
|
12
|
+
named pieces), `server.js` (optional), `options.schema.json` (with `defaults` in `component.json`), `styles.css`
|
|
13
|
+
(optional), `component.json`. A new widget gets all five; layouts get `styles.css` for their CSS-only options.
|
|
14
|
+
- **`component.json`**: `name`, `kind` (widget, primitive, block, layout, utility), `description`, `placeable`
|
|
15
|
+
(widgets), `serverMode` (`on-load` or `on-demand`; absent = none, and `server.js` never runs), `regions` (layouts
|
|
16
|
+
and blocks: `{ name, acceptsContributions }`), `defaults`, `tailwind`. The workspace file says `serverMode`; the
|
|
17
|
+
record field (and the docs about records) say `server_mode`, likewise `options_schema_json`, `default_options_json`,
|
|
18
|
+
`regions_json`.
|
|
19
|
+
- **`server.js`**: an IIFE that fills `data` (empty on every call) from `input` (the client call's input, untrusted)
|
|
20
|
+
and `options`. URL params: `$sp.getParameter('sys_id')`; the user: `gs.getUserID()`, `$sp.getUser()`. Read with
|
|
21
|
+
`GlideRecordSecure` (the visitor's ACLs), `canWrite()` before writing. Runs in the component app's scope. Limits:
|
|
22
|
+
no array spread (`concat`, loops), test arrays with `arr && arr.length`, ES5 only in compatibility-mode apps, sealed
|
|
23
|
+
`globalThis`, Promise callbacks run after the script, no `gs.sleep`.
|
|
24
|
+
- **Client**: `const { data, pending, error, server } = useServer()` from `@portal/runtime`. `data` is undefined until
|
|
25
|
+
a result arrives: with `on-load`, `pending` is true until the page's initialize result; with `on-demand`, nothing
|
|
26
|
+
runs until `server.refresh()`, `server.get(input)` (returns data, keeps local) or `server.update(input)` (replaces
|
|
27
|
+
data). Plain table reads: `useRecord`, `useTableQuery`; the user: `useUser()`.
|
|
28
|
+
- **Props**: widgets `{ options, instanceId }`; layouts `{ options }` and render `<Region name="…" />` plus
|
|
29
|
+
`<SidePanelRegion>`; blocks call `useBlock()` (spread `rootProps`) and render `<Region>`.
|
|
30
|
+
- **Imports**: `components:<kit>` (host kit: card, button, dialog, …), `components:app/<key>` and
|
|
31
|
+
`utilities:app/<key>` (React Portal's record primitives), `components:<ns>/<key>`, `@portal/runtime`, relative
|
|
32
|
+
files. No npm packages. Check each with `lookup_api` (CLI: `rpforge api <module>`) before importing. Never name a local
|
|
33
|
+
`exports`, `module` or `require`. Inline and SVG styles use `var(--card)`, never `var(--color-*)`. Prettier:
|
|
34
|
+
semicolons, single quotes, 4 spaces, 120 columns.
|
|
35
|
+
- **Preview**: in a component workspace, on the stage: `dev_stage { component, options }`, then `dev_open` route
|
|
36
|
+
`stage` with a screenshot (CLI: `rpforge dev`, `/__rpf/stage`). In a portal workspace, place it and `dev_open` the
|
|
37
|
+
page. Then `workspace_check` (CLI: `rpforge check`).
|
|
38
|
+
- **Depth**: `authoring/server-script`, `authoring/client-script`, `runtime-api/server-calls`, `authoring/options`,
|
|
39
|
+
`authoring/regions` (`read_doc`; CLI: `rpforge docs read <path>`).
|
|
6
40
|
|
|
7
41
|
## Kinds
|
|
8
42
|
|
|
@@ -195,6 +229,10 @@ Two layers, always:
|
|
|
195
229
|
ServiceNow-aware pieces built on the kit. Your own domain pieces belong here too, as your own primitives
|
|
196
230
|
(`components:acme/<key>`), not buried in a widget.
|
|
197
231
|
|
|
232
|
+
**Find before you build:** `find_pattern` (CLI `rpforge patterns <intent>`) → `show_example`
|
|
233
|
+
(`rpforge patterns show <id>`) → `search_catalog` (`rpforge catalog <words>`) → `lookup_api` (`rpforge api <id>`). A
|
|
234
|
+
new component needs a reason the pattern can't cover.
|
|
235
|
+
|
|
198
236
|
The catalog changes with each React Portal release, so look it up on the instance:
|
|
199
237
|
`rpforge components --kind primitive`, `rpforge components get app/record-form`, `rpforge api components:select`,
|
|
200
238
|
`rpforge docs read primitives/overview`, `rpforge docs read runtime-api/host-kit`.
|