@quixomatic/rpf 0.0.0-stage → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +52 -0
- package/LICENSE +21 -0
- package/README.md +82 -2
- package/assets/dev-host/THIRD_PARTY_NOTICES.txt +2937 -0
- package/assets/dev-host/boot.js +250 -0
- package/assets/dev-host/boot.js.LEGAL.txt +48 -0
- package/assets/dev-host/chunks/accordion-O6VUPQ32.js +2 -0
- package/assets/dev-host/chunks/alert-PRAGKG5L.js +2 -0
- package/assets/dev-host/chunks/alert-dialog-SCBXM23J.js +2 -0
- package/assets/dev-host/chunks/avatar-WXPKQ3Z5.js +2 -0
- package/assets/dev-host/chunks/badge-KCMWGERA.js +2 -0
- package/assets/dev-host/chunks/breadcrumb-IJQJQ5JV.js +2 -0
- package/assets/dev-host/chunks/button-4JMBKYN4.js +2 -0
- package/assets/dev-host/chunks/calendar-XXLCAUPG.js +2 -0
- package/assets/dev-host/chunks/card-EY3LK2GB.js +2 -0
- package/assets/dev-host/chunks/chart-2PHC6UIE.js +2 -0
- package/assets/dev-host/chunks/chart-blocks-PZPCWCNT.js +2 -0
- package/assets/dev-host/chunks/chart-frame-MNUFXAPU.js +3 -0
- package/assets/dev-host/chunks/charts-SKK6UTYU.js +85 -0
- package/assets/dev-host/chunks/charts-SKK6UTYU.js.LEGAL.txt +48 -0
- package/assets/dev-host/chunks/chat-TTESCYES.js +2 -0
- package/assets/dev-host/chunks/checkbox-Y2UGSRR4.js +2 -0
- package/assets/dev-host/chunks/chunk-2IZ44WWI.js +2 -0
- package/assets/dev-host/chunks/chunk-2L7NK6SJ.js +2 -0
- package/assets/dev-host/chunks/chunk-33RMFA4P.js +2 -0
- package/assets/dev-host/chunks/chunk-3H6F4X7R.js +2 -0
- package/assets/dev-host/chunks/chunk-3UDEYJRG.js +2 -0
- package/assets/dev-host/chunks/chunk-4E74H7FZ.js +2 -0
- package/assets/dev-host/chunks/chunk-4UUMO65R.js +2 -0
- package/assets/dev-host/chunks/chunk-57M36GYM.js +2 -0
- package/assets/dev-host/chunks/chunk-5EK7QOB6.js +2 -0
- package/assets/dev-host/chunks/chunk-5YMOXSSM.js +2 -0
- package/assets/dev-host/chunks/chunk-5ZMYWE5S.js +2 -0
- package/assets/dev-host/chunks/chunk-6ARM5VDH.js +2 -0
- package/assets/dev-host/chunks/chunk-7OCTAHT6.js +2 -0
- package/assets/dev-host/chunks/chunk-7TG23VIV.js +2 -0
- package/assets/dev-host/chunks/chunk-AAL6V4Y3.js +2 -0
- package/assets/dev-host/chunks/chunk-APP2HKWR.js +8 -0
- package/assets/dev-host/chunks/chunk-AVSRGCSF.js +2 -0
- package/assets/dev-host/chunks/chunk-AZWODE64.js +2 -0
- package/assets/dev-host/chunks/chunk-B4MRCKT4.js +2 -0
- package/assets/dev-host/chunks/chunk-BB4IX5QA.js +2 -0
- package/assets/dev-host/chunks/chunk-BH6FGVDP.js +2 -0
- package/assets/dev-host/chunks/chunk-BJZOPTWR.js +2 -0
- package/assets/dev-host/chunks/chunk-CCXMDKVL.js +2 -0
- package/assets/dev-host/chunks/chunk-CJ5CECQT.js +1 -0
- package/assets/dev-host/chunks/chunk-CLVPTZ4G.js +2 -0
- package/assets/dev-host/chunks/chunk-CT4EH2K2.js +8 -0
- package/assets/dev-host/chunks/chunk-CT4EH2K2.js.LEGAL.txt +12 -0
- package/assets/dev-host/chunks/chunk-CWDPAB6V.js +2 -0
- package/assets/dev-host/chunks/chunk-D7BPK3AE.js +1 -0
- package/assets/dev-host/chunks/chunk-DG6LRRQT.js +2 -0
- package/assets/dev-host/chunks/chunk-DR47HKIK.js +2 -0
- package/assets/dev-host/chunks/chunk-E75HEEMN.js +2 -0
- package/assets/dev-host/chunks/chunk-EDEL6XSO.js +2 -0
- package/assets/dev-host/chunks/chunk-EGZKG2B2.js +2 -0
- package/assets/dev-host/chunks/chunk-F353PAEY.js +2 -0
- package/assets/dev-host/chunks/chunk-F5MKIWPQ.js +2 -0
- package/assets/dev-host/chunks/chunk-FJRWQRLM.js +2 -0
- package/assets/dev-host/chunks/chunk-FROPNHO5.js +2 -0
- package/assets/dev-host/chunks/chunk-FTWKUXER.js +2 -0
- package/assets/dev-host/chunks/chunk-FZPMZMFU.js +2 -0
- package/assets/dev-host/chunks/chunk-GN3SYBEC.js +2 -0
- package/assets/dev-host/chunks/chunk-GQYRJYJV.js +2 -0
- package/assets/dev-host/chunks/chunk-GWDGPUGM.js +2 -0
- package/assets/dev-host/chunks/chunk-GX72R347.js +2 -0
- package/assets/dev-host/chunks/chunk-GZJCEDUU.js +4 -0
- package/assets/dev-host/chunks/chunk-H6TI5TWN.js +2 -0
- package/assets/dev-host/chunks/chunk-HFUDOYIP.js +16 -0
- package/assets/dev-host/chunks/chunk-IAEAQCYR.js +2 -0
- package/assets/dev-host/chunks/chunk-IJQ26FTX.js +15 -0
- package/assets/dev-host/chunks/chunk-IJQ26FTX.js.LEGAL.txt +12 -0
- package/assets/dev-host/chunks/chunk-IQ2XSDFU.js +3 -0
- package/assets/dev-host/chunks/chunk-IQ2XSDFU.js.LEGAL.txt +146 -0
- package/assets/dev-host/chunks/chunk-IWEJRU22.js +2 -0
- package/assets/dev-host/chunks/chunk-JIAVZ3V7.js +3 -0
- package/assets/dev-host/chunks/chunk-K7LVVFGH.js +1 -0
- package/assets/dev-host/chunks/chunk-KAZVAX35.js +2 -0
- package/assets/dev-host/chunks/chunk-KCTKD6GV.js +2 -0
- package/assets/dev-host/chunks/chunk-KNOE7TZW.js +2 -0
- package/assets/dev-host/chunks/chunk-KOQLDUOI.js +2 -0
- package/assets/dev-host/chunks/chunk-KPP4HYUV.js +2 -0
- package/assets/dev-host/chunks/chunk-KSVOOYUA.js +2 -0
- package/assets/dev-host/chunks/chunk-KVMUXFPB.js +2 -0
- package/assets/dev-host/chunks/chunk-LTVKSGLG.js +2 -0
- package/assets/dev-host/chunks/chunk-LYT7LQS3.js +2 -0
- package/assets/dev-host/chunks/chunk-M7A47ZSM.js +2 -0
- package/assets/dev-host/chunks/chunk-MGLBTOXD.js +6 -0
- package/assets/dev-host/chunks/chunk-ML6HCGK5.js +2 -0
- package/assets/dev-host/chunks/chunk-MQ67DRDE.js +2 -0
- package/assets/dev-host/chunks/chunk-MTHCFDUE.js +2 -0
- package/assets/dev-host/chunks/chunk-NI6ZJ6DH.js +2 -0
- package/assets/dev-host/chunks/chunk-NJX7QY3Z.js +2 -0
- package/assets/dev-host/chunks/chunk-NZ73KS2Y.js +2 -0
- package/assets/dev-host/chunks/chunk-OW6AVFQA.js +2 -0
- package/assets/dev-host/chunks/chunk-OXJ6LWKI.js +3 -0
- package/assets/dev-host/chunks/chunk-OXJ6LWKI.js.LEGAL.txt +12 -0
- package/assets/dev-host/chunks/chunk-PHK25MY7.js +2 -0
- package/assets/dev-host/chunks/chunk-PQMY72VV.js +2 -0
- package/assets/dev-host/chunks/chunk-PWFHIE6D.js +2 -0
- package/assets/dev-host/chunks/chunk-PYWKHILP.js +2 -0
- package/assets/dev-host/chunks/chunk-QFN6XL4O.js +2 -0
- package/assets/dev-host/chunks/chunk-R5KQ2GRA.js +2 -0
- package/assets/dev-host/chunks/chunk-RCNX6LVJ.js +3 -0
- package/assets/dev-host/chunks/chunk-RCNX6LVJ.js.LEGAL.txt +12 -0
- package/assets/dev-host/chunks/chunk-SFI7YWVR.js +2 -0
- package/assets/dev-host/chunks/chunk-SLZI4G3N.js +2 -0
- package/assets/dev-host/chunks/chunk-SVQCDOZ3.js +2 -0
- package/assets/dev-host/chunks/chunk-T4Y5HG5P.js +4 -0
- package/assets/dev-host/chunks/chunk-T7JFBQSG.js +2 -0
- package/assets/dev-host/chunks/chunk-TIJLEKZ2.js +2 -0
- package/assets/dev-host/chunks/chunk-TNLYU77Y.js +2 -0
- package/assets/dev-host/chunks/chunk-TQPXDAVH.js +2 -0
- package/assets/dev-host/chunks/chunk-UH726PMV.js +7 -0
- package/assets/dev-host/chunks/chunk-UH726PMV.js.LEGAL.txt +12 -0
- package/assets/dev-host/chunks/chunk-URJZKT45.js +2 -0
- package/assets/dev-host/chunks/chunk-URWVHIIJ.js +2 -0
- package/assets/dev-host/chunks/chunk-UUJ5X322.js +2 -0
- package/assets/dev-host/chunks/chunk-UWANBOC6.js +2 -0
- package/assets/dev-host/chunks/chunk-UXUS6DNI.js +2 -0
- package/assets/dev-host/chunks/chunk-VKXVJGG5.js +6 -0
- package/assets/dev-host/chunks/chunk-VSM3ZOBU.js +2 -0
- package/assets/dev-host/chunks/chunk-WLBNJ4K3.js +2 -0
- package/assets/dev-host/chunks/chunk-WRHZYADJ.js +2 -0
- package/assets/dev-host/chunks/chunk-WT34MBTN.js +2 -0
- package/assets/dev-host/chunks/chunk-X34AFUS2.js +2 -0
- package/assets/dev-host/chunks/chunk-XE5RQ73V.js +2 -0
- package/assets/dev-host/chunks/chunk-XGLVZEGD.js +2 -0
- package/assets/dev-host/chunks/chunk-XIXCIQKJ.js +2 -0
- package/assets/dev-host/chunks/chunk-Z76KXEPD.js +2 -0
- package/assets/dev-host/chunks/code-block-H2ETQV3M.js +2 -0
- package/assets/dev-host/chunks/code-editor-2JYERJLS.js +2 -0
- package/assets/dev-host/chunks/collapsible-4ZOFMWLB.js +2 -0
- package/assets/dev-host/chunks/color-UDQWYS2D.js +2 -0
- package/assets/dev-host/chunks/color-picker-RRCCLR54.js +2 -0
- package/assets/dev-host/chunks/combobox-U4455OMJ.js +2 -0
- package/assets/dev-host/chunks/contrast-badge-KDF65X7J.js +2 -0
- package/assets/dev-host/chunks/core.esm-WYAV6XZS.js +2 -0
- package/assets/dev-host/chunks/date-range-picker-WJYHAHRM.js +2 -0
- package/assets/dev-host/chunks/dialog-I6AGHWB3.js +2 -0
- package/assets/dev-host/chunks/dist-T43K2TRF.js +2 -0
- package/assets/dev-host/chunks/dropdown-menu-LSOMXDWG.js +2 -0
- package/assets/dev-host/chunks/empty-NLQODUSK.js +2 -0
- package/assets/dev-host/chunks/esm-L33CRTOD.js +5 -0
- package/assets/dev-host/chunks/font-picker-3TLYYZJH.js +2 -0
- package/assets/dev-host/chunks/frame-HA7UIYZF.js +2 -0
- package/assets/dev-host/chunks/heading-7M24WKK6.js +2 -0
- package/assets/dev-host/chunks/hover-card-HSHOQPOI.js +2 -0
- package/assets/dev-host/chunks/icon-NZIMARLZ.js +2 -0
- package/assets/dev-host/chunks/image-R7XGYKVH.js +2 -0
- package/assets/dev-host/chunks/index-fn-BUQBI34R.js +5 -0
- package/assets/dev-host/chunks/index.esm-SPI7ZXRT.js +6 -0
- package/assets/dev-host/chunks/index.esm-SPI7ZXRT.js.LEGAL.txt +25 -0
- package/assets/dev-host/chunks/input-YECXNM53.js +2 -0
- package/assets/dev-host/chunks/input-group-GFKXSZM7.js +2 -0
- package/assets/dev-host/chunks/kbd-V25ZMVCM.js +2 -0
- package/assets/dev-host/chunks/label-LJT4V2CT.js +2 -0
- package/assets/dev-host/chunks/label-value-6Z6ATP55.js +2 -0
- package/assets/dev-host/chunks/legacy-4ICQWPOE.js +2 -0
- package/assets/dev-host/chunks/logo-AAMBHX2W.js +2 -0
- package/assets/dev-host/chunks/number-field-6TCQAVTR.js +2 -0
- package/assets/dev-host/chunks/pill-7L57ZNRJ.js +2 -0
- package/assets/dev-host/chunks/popover-3P6YNKH3.js +2 -0
- package/assets/dev-host/chunks/portal-code-Z5G6AEMM.js +25 -0
- package/assets/dev-host/chunks/portal-rte-7B6VXIZO.js +163 -0
- package/assets/dev-host/chunks/progress-RBCJRVM7.js +2 -0
- package/assets/dev-host/chunks/radio-group-NJWXZCX3.js +2 -0
- package/assets/dev-host/chunks/resizable-XF4P6OKR.js +2 -0
- package/assets/dev-host/chunks/rich-text-7OMYZ564.js +2 -0
- package/assets/dev-host/chunks/rich-text-editor-T6KWD4P3.js +2 -0
- package/assets/dev-host/chunks/scroll-row-LMI7JCFR.js +2 -0
- package/assets/dev-host/chunks/select-F3MZWTTS.js +2 -0
- package/assets/dev-host/chunks/separator-JRJYKM4Z.js +2 -0
- package/assets/dev-host/chunks/sheet-EXRT4MFB.js +2 -0
- package/assets/dev-host/chunks/side-panel-IBHLEANN.js +2 -0
- package/assets/dev-host/chunks/sidebar-VKQMQMF2.js +2 -0
- package/assets/dev-host/chunks/skeleton-KIRVQ4EO.js +2 -0
- package/assets/dev-host/chunks/slider-XKYDL5MR.js +2 -0
- package/assets/dev-host/chunks/sortable.esm-3VPY5PX7.js +2 -0
- package/assets/dev-host/chunks/split-button-WP6LALDS.js +2 -0
- package/assets/dev-host/chunks/stepper-KR6PXZHW.js +2 -0
- package/assets/dev-host/chunks/switch-P6NJELJJ.js +2 -0
- package/assets/dev-host/chunks/tabs-PFPRJNVZ.js +2 -0
- package/assets/dev-host/chunks/textarea-2JXA5XWS.js +2 -0
- package/assets/dev-host/chunks/toggle-group-PS7JN2JM.js +2 -0
- package/assets/dev-host/chunks/tooltip-S4RBC3O4.js +2 -0
- package/assets/dev-host/chunks/tree-NQF6ZJLH.js +2 -0
- package/assets/dev-host/chunks/utilities.esm-YYZNDLV4.js +2 -0
- package/assets/dev-host/css/shadcn-tailwind.css +637 -0
- package/assets/dev-host/css/tw-animate.css +1 -0
- package/assets/dev-host/kit-candidates.json +1 -0
- package/assets/dev-host/kit-manifest.json +435 -0
- package/assets/react-portal-lockup-on-dark.svg +11 -0
- package/assets/react-portal-lockup.svg +11 -0
- package/dist/cli.mjs +16200 -0
- package/package.json +65 -5
- package/skills/react-portal/SKILL.md +161 -0
- package/skills/react-portal/references/cli.md +141 -0
- package/skills/react-portal/references/components.md +214 -0
- package/skills/react-portal/references/rules.md +115 -0
- package/skills/react-portal/references/troubleshooting.md +58 -0
- package/skills/react-portal/references/workspace.md +178 -0
- package/skills/react-portal-theme/SKILL.md +110 -0
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
# The hard rules
|
|
2
|
+
|
|
3
|
+
Each rule comes from a real failure. `rpforge check` catches some of them; the rest are on you.
|
|
4
|
+
|
|
5
|
+
## Server code
|
|
6
|
+
|
|
7
|
+
### No array spread in server code
|
|
8
|
+
|
|
9
|
+
**Rule.** In `server.js` (and anything else that runs on the instance), don't use array spread: `[...a]`,
|
|
10
|
+
`f(...args)`, `out.push(...items)`. Use `a.concat(b)`, `a.slice()`, loops, or `Array.prototype.push.apply(out, items)`.
|
|
11
|
+
Don't test an array with `if (arr)`: use `arr && arr.length` or `Array.isArray(arr)`.
|
|
12
|
+
|
|
13
|
+
**Why.** The instance transpiles spread into a helper that checks its argument for truthiness. Inside some Promise
|
|
14
|
+
callbacks of the instance's runtime an empty array evaluates as falsy, so the helper throws "Invalid attempt to spread
|
|
15
|
+
non-iterable instance" on `[]`, and only on pages or records where the list happens to be empty.
|
|
16
|
+
|
|
17
|
+
### Follow the scoped runtime's limits
|
|
18
|
+
|
|
19
|
+
- `globalThis` is sealed: you can't add globals. Keep state in local variables.
|
|
20
|
+
- Promise callbacks run when the **outermost** script finishes, not inside your script. Don't build a server script
|
|
21
|
+
around `then()` chains that must finish before `data` is returned.
|
|
22
|
+
- Blocked in scoped code: `gs.sleep` (even reading it throws), `gs.print`, `gs.getImpersonatingUserName()` (use
|
|
23
|
+
`$sp.getUser().impersonatedBy`).
|
|
24
|
+
- No streaming: a server call returns one buffered response, and outbound HTTP reads whole bodies. For progress on long
|
|
25
|
+
work, write progress to a record and watch it from the client (`useRecordWatch`); requests time out at about
|
|
26
|
+
300 seconds.
|
|
27
|
+
- Script errors are caught for you and reported as `script_error` with your line number. Don't swallow errors with an
|
|
28
|
+
empty `catch`: the user then sees nothing.
|
|
29
|
+
- Respect the owning application's JavaScript mode: ES5 (compatibility) apps parse only ES5 in `server.js`.
|
|
30
|
+
|
|
31
|
+
### `data` starts empty on every call
|
|
32
|
+
|
|
33
|
+
The client's `data` is never sent to the server, and the script always starts from `{}`. Put everything the script
|
|
34
|
+
needs in `input` (`server.update({ action: 'close', sysId })`), and treat `input` and URL params as untrusted: validate
|
|
35
|
+
ids (`/^[0-9a-f]{32}$/`), use `GlideRecordSecure` or `$sp.getRecord`, and check `canWrite()` before writing.
|
|
36
|
+
|
|
37
|
+
## Client code
|
|
38
|
+
|
|
39
|
+
### Never name anything `exports`, `module` or `require`
|
|
40
|
+
|
|
41
|
+
**Rule.** No local variable, parameter, destructured prop or import alias may be called `exports`, `module` or
|
|
42
|
+
`require`.
|
|
43
|
+
|
|
44
|
+
**Why.** The compiler turns each file into a CommonJS-style module and rewrites references to the file's own exported
|
|
45
|
+
constants as `exports.NAME`. A local `exports` shadows the module object and the component crashes at runtime with an
|
|
46
|
+
unrelated-looking error ("Cannot read properties of undefined"). `rpforge check` reports it (`reserved-name`).
|
|
47
|
+
|
|
48
|
+
```tsx
|
|
49
|
+
function Menu({ exports }) {} // breaks
|
|
50
|
+
function Menu({ exportOptions }) {} // works
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
### Theme colors in inline styles and SVG: `var(--card)`, never `var(--color-card)`
|
|
54
|
+
|
|
55
|
+
**Rule.** In inline `style` props, SVG `fill` / `stroke` and `styles.css`, use the theme tokens directly:
|
|
56
|
+
`var(--background)`, `var(--card)`, `var(--primary)`, `var(--muted-foreground)`, `var(--chart-1)` … `var(--chart-5)`.
|
|
57
|
+
|
|
58
|
+
**Why.** The Tailwind theme is declared `@theme inline`, so utilities like `bg-card` compile straight to `var(--card)`
|
|
59
|
+
and no `--color-*` variables exist at runtime. `var(--color-card)` resolves to nothing and the stroke or fill silently
|
|
60
|
+
disappears.
|
|
61
|
+
|
|
62
|
+
Related, for charts: Recharts' `<Customized>` and a `<Label>` inside `<Pie>` render nothing in the host. Use HTML
|
|
63
|
+
overlays or plain SVG children. Prefer `components:chart` (shadcn charts with the host's Recharts) over raw Recharts.
|
|
64
|
+
|
|
65
|
+
### Responsive display variants: make them important
|
|
66
|
+
|
|
67
|
+
**Rule.** When a widget shows or hides something by breakpoint with a display utility (`hidden sm:block`,
|
|
68
|
+
`max-sm:flex`, `sm:hidden`), write the variant as important: `hidden sm:block!`, `max-sm:flex!`.
|
|
69
|
+
|
|
70
|
+
**Why.** Every component build ships its own Tailwind layer, and same-named layers merge across stylesheets. A widget
|
|
71
|
+
injected later can re-emit `.hidden` or `.flex` and beat an earlier widget's `sm:block` at equal specificity. Newer
|
|
72
|
+
React Portal versions compile one utilities sheet per portal, but a component's own sheet is still used in Studio
|
|
73
|
+
previews and right after a save. The important form is safe everywhere. `rpforge check` reports these
|
|
74
|
+
(`display-variant`).
|
|
75
|
+
|
|
76
|
+
### Use the host's libraries
|
|
77
|
+
|
|
78
|
+
React Portal ships a fixed library set: React 19, TanStack Query / Table / Virtual, shadcn on Base UI, Tailwind v4,
|
|
79
|
+
sonner toasts, TipTap (rich text), CodeMirror 6 (code), Recharts 3 (charts), motion, dnd-kit and Lucide icons. Import
|
|
80
|
+
them through their registry modules (`components:*`, `utilities:*`). npm packages can't be imported, and you never
|
|
81
|
+
bundle a second copy of something the host provides.
|
|
82
|
+
|
|
83
|
+
### Layering and preferences
|
|
84
|
+
|
|
85
|
+
- Generic UI comes from the kit (`components:tabs`). Anything domain-aware built on it is its own primitive record
|
|
86
|
+
(`components:acme/case-tabs`) that widgets import. Don't wire widgets straight to kit pieces for domain behavior, and
|
|
87
|
+
don't bury reusable logic inside one widget: export hooks and helpers.
|
|
88
|
+
- Store your UI state (collapsed sections, chosen views) under your application's own user preferences or local
|
|
89
|
+
storage keys. Never read or write the platform's own preferences (form tab settings, workspace layouts, list views).
|
|
90
|
+
|
|
91
|
+
### Don't hand-roll floating UI
|
|
92
|
+
|
|
93
|
+
Menus, popovers, dialogs and tooltips must render into the host's overlay layer. Use the kit's components, or
|
|
94
|
+
`createPortal(children, usePortalContainer())`, never `document.body`.
|
|
95
|
+
|
|
96
|
+
## Style
|
|
97
|
+
|
|
98
|
+
All code (components, server scripts, `portal.mjs`) uses the workspace's Prettier config, which `init` writes:
|
|
99
|
+
semicolons always, single quotes, 4-space indent (no tabs), 120 columns, es5 trailing commas, LF line endings. Never
|
|
100
|
+
the semicolon-free style some ServiceNow SDK samples use. `rpforge check` runs Prettier on changed files, and pushes
|
|
101
|
+
format what they write, so unformatted files show up as changes.
|
|
102
|
+
|
|
103
|
+
## Writes
|
|
104
|
+
|
|
105
|
+
- **Never publish.** No command publishes; portals stay inactive drafts until a person publishes in Studio.
|
|
106
|
+
- **Never delete.** `active: false` deactivates; records removed from the files are reported and left on the
|
|
107
|
+
instance. Source files are deleted on the instance only with `--remove-files`.
|
|
108
|
+
- **Two steps.** Dry run, show the plan, then push the exact `--plan-hash`. A plan is refused if the files or the
|
|
109
|
+
instance changed since.
|
|
110
|
+
- **`--force` only when asked.** It overwrites other people's instance changes (listed in the dry run with who and
|
|
111
|
+
when) and needs `--yes --confirm <slug>`.
|
|
112
|
+
- **Don't edit `forge.workspace.json` or `.forge/` by hand.** They are rpforge's record of the base state. Commit the
|
|
113
|
+
manifest with the files.
|
|
114
|
+
- **Update sets.** Pushes write into the workspace's update set, which must stay in progress. Don't switch the user's
|
|
115
|
+
application or update set yourself; rpforge does it per request and restores it.
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
# Troubleshooting
|
|
2
|
+
|
|
3
|
+
Start with `rpforge doctor` (or `rpforge doctor --json`): one line per check, with the fix.
|
|
4
|
+
|
|
5
|
+
## Sign-in (exit code 3)
|
|
6
|
+
|
|
7
|
+
| Symptom | Fix |
|
|
8
|
+
|---|---|
|
|
9
|
+
| `unauthenticated`, HTTP 401 | The credentials were rejected. `rpforge auth status` shows the profile and kind. OAuth: `rpforge auth login dev`. Basic: re-add the profile with the right password (`rpforge auth add dev --force`) |
|
|
10
|
+
| `login_required` | An `oauth-code` profile without a token: `rpforge auth login dev` (a person at a browser) |
|
|
11
|
+
| `forbidden`, HTTP 403 without a Forge code | The platform refused: the token's scope, an API access policy, or the user lacks the Forge role. Ask an admin |
|
|
12
|
+
| `credential_store` | The OS keyring isn't reachable. In CI, set `RPFORGE_KEY_SOURCE=env` and `RPFORGE_ENCRYPTION_KEY`, or use `RP_*` environment variables without profiles |
|
|
13
|
+
|
|
14
|
+
Never print, log or commit secrets. Don't ask the user to paste passwords into the chat: they run `rpforge auth add`
|
|
15
|
+
themselves.
|
|
16
|
+
|
|
17
|
+
## The instance (exit code 4)
|
|
18
|
+
|
|
19
|
+
| Symptom | Fix |
|
|
20
|
+
|---|---|
|
|
21
|
+
| `forge_mcp_disabled` | The Forge kill switch is off (`x_312987_portal.forge.mcp.enabled`). It covers the CLI and the MCP alike. Stop and tell the user; only an admin turns it on. Don't work around it |
|
|
22
|
+
| `forge_api_missing` | React Portal isn't installed, or too old to have the Forge API |
|
|
23
|
+
| `forge_route_missing`, or doctor's Forge API level too old | The instance's React Portal is older than this rpforge: update React Portal on the instance |
|
|
24
|
+
| Forge API level too new | Update rpforge: `npm i -g @quixomatic/rpf` |
|
|
25
|
+
| Global Helpers missing or old | 1.3.0+ for writes into an app and update set, 1.6.0+ for images, 1.7.0+ for `init --new-update-set`. An admin installs or upgrades the Global Helpers app |
|
|
26
|
+
|
|
27
|
+
## Workspaces
|
|
28
|
+
|
|
29
|
+
| Symptom | Fix |
|
|
30
|
+
|---|---|
|
|
31
|
+
| "No workspace here" | Run inside the folder with `forge.workspace.json`, or pass `--dir <folder>` |
|
|
32
|
+
| The workspace "tracks another instance" | Pass `--profile` for the instance the workspace was pulled from |
|
|
33
|
+
| "matches several profiles" | Pass `--profile` |
|
|
34
|
+
| Push refused: conflicts or conflict markers | `rpforge status`, then `rpforge resolve take-instance <key>`, `take-local` or `merge`; remove leftover `<<<<<<<` markers |
|
|
35
|
+
| Push refused: stale plan (409) | Files or the instance changed after the dry run. Run `rpforge push --no-interactive` again and push the new hash |
|
|
36
|
+
| `wrong_scope` | A record belongs to another application than the workspace's. Workspaces write only records of the portal's own application |
|
|
37
|
+
| Update set not in progress | The workspace's set was completed. Re-pull with another in-progress set of the portal's application: `rpforge pull --update-set "<name>"` |
|
|
38
|
+
| A push failed part way | Earlier chunks stay written and become the new base. Fix the cause, then `rpforge push --reprocess` (or a normal push) finishes the owed compiles and reprocess |
|
|
39
|
+
| A rename shows as a create plus a removal | Undo the hand edit and use `rpforge rename <from> <to>` |
|
|
40
|
+
| Untracked files in `status` | Files outside the folder format (for example notes in `components/`). Move them out, or ignore the note |
|
|
41
|
+
|
|
42
|
+
## Compile and runtime errors
|
|
43
|
+
|
|
44
|
+
| Symptom | Fix |
|
|
45
|
+
|---|---|
|
|
46
|
+
| `check` reports a compile error with file, line and column | Fix it locally and run `rpforge check` again; nothing was saved |
|
|
47
|
+
| `the module has no default-exported component` | `main.tsx` must `export default` a component (utilities still need a default export of something) |
|
|
48
|
+
| Unresolved import | Look the specifier up: `rpforge components get acme/order-card`, `rpforge api components:select`. Record imports need the component to exist and be compiled |
|
|
49
|
+
| `script_error` (line N) | A server script threw at line N. Remember `data` starts empty, `input` is untrusted, and the rules in [rules.md](rules.md) |
|
|
50
|
+
| "Cannot read properties of undefined" at runtime from compiled code | Usually a local named `exports`, `module` or `require` |
|
|
51
|
+
| An SVG stroke or fill is invisible | `var(--color-*)` used; switch to `var(--primary)` style tokens |
|
|
52
|
+
| A responsive element shows on the wrong breakpoint | Make the display variant important (`sm:block!`) |
|
|
53
|
+
| A compiled widget doesn't render right | A clean compile doesn't prove rendering. Ask the user to look at the draft in Studio's preview |
|
|
54
|
+
|
|
55
|
+
## Draft portals
|
|
56
|
+
|
|
57
|
+
A draft (inactive) portal is visible only in Studio previews; visitors get "Portal not found" until someone publishes
|
|
58
|
+
it in Studio. That's expected: rpforge never publishes.
|
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
# Workspaces and `portal.mjs`
|
|
2
|
+
|
|
3
|
+
A workspace is one portal as files. `rpforge init` and `rpforge pull` write it; `rpforge push` sends it back.
|
|
4
|
+
|
|
5
|
+
## Folder layout
|
|
6
|
+
|
|
7
|
+
```text
|
|
8
|
+
hr-portal/
|
|
9
|
+
├── portal.mjs pages, variants, side panels, menus, placements, audiences (pure data)
|
|
10
|
+
├── components/@<ns>/<key>/ one folder per component of the portal's application
|
|
11
|
+
│ ├── component.json name, kind, description, tailwind, serverMode, placeable, active, regions, defaults
|
|
12
|
+
│ ├── main.tsx the client code (default export = the component)
|
|
13
|
+
│ ├── server.js the server script (widgets and layouts with a server)
|
|
14
|
+
│ ├── options.schema.json the options form (JSON Schema)
|
|
15
|
+
│ ├── styles.css author CSS (only when there is any)
|
|
16
|
+
│ └── *.ts, *.tsx, *.css extra source files, imported with relative paths
|
|
17
|
+
├── themes/<key>/ theme.json, tokens.json, theme.css (a theme owned by the portal's application)
|
|
18
|
+
├── assets/ images (png, jpeg, gif, webp, avif, ico, svg up to 2 MB) that the files name
|
|
19
|
+
├── forge.workspace.json the manifest: the base state of every record. Commit it with the files
|
|
20
|
+
├── README.md, .gitignore, .prettierrc.json local only, never pushed
|
|
21
|
+
└── .forge/ gitignored: base snapshot, conflicts, the last plan, overwritten values
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
- Only records of the **portal's own application** are files. Components it uses from React Portal (the `app/*`
|
|
25
|
+
primitives and widgets) or from other applications are references; the manifest records them as dependencies.
|
|
26
|
+
- Builds, releases and other derived records aren't files: the instance makes them on compile and reprocess.
|
|
27
|
+
- `.claude/`, `node_modules/`, `.git/` and `.forge/` are never part of the portal.
|
|
28
|
+
- A component's namespace and key can't change after it exists. To move one,
|
|
29
|
+
`rpforge rename component:acme/old-card component:acme/new-card` copies the folder to the new key (a create on
|
|
30
|
+
push) and marks the old one `"active": false`.
|
|
31
|
+
|
|
32
|
+
## `portal.mjs`
|
|
33
|
+
|
|
34
|
+
`export default { ... }`: pure data. No imports, logic, variables or comments (notes go in README.md); rpforge reads
|
|
35
|
+
it as a module, rewrites it on pull, and formats it with Prettier. Records are matched by natural key, never by
|
|
36
|
+
position, so reordering the file changes nothing; `order` fields decide the order.
|
|
37
|
+
|
|
38
|
+
```js
|
|
39
|
+
export default {
|
|
40
|
+
slug: 'hr-portal',
|
|
41
|
+
name: 'HR Portal',
|
|
42
|
+
description: 'Employee self-service',
|
|
43
|
+
app: 'x_acme_hr',
|
|
44
|
+
updateSet: 'HR Portal (React Portal)',
|
|
45
|
+
active: false,
|
|
46
|
+
isDefault: false,
|
|
47
|
+
isTemplate: false,
|
|
48
|
+
roles: '',
|
|
49
|
+
theme: 'hr-portal',
|
|
50
|
+
layout: 'app-shell',
|
|
51
|
+
home: 'home',
|
|
52
|
+
settings: {
|
|
53
|
+
contentWidth: '6xl',
|
|
54
|
+
layoutOptions: { texture: 'plain', contentPadding: 'md' },
|
|
55
|
+
},
|
|
56
|
+
portalWidgets: [
|
|
57
|
+
{ c: 'app-sidebar', region: 'sidebar', order: 100, options: { brand: 'HR Portal', brandIcon: 'users' } },
|
|
58
|
+
{ c: 'app-header', region: 'header', order: 100, options: { sidebarTrigger: true } },
|
|
59
|
+
],
|
|
60
|
+
pages: [
|
|
61
|
+
{
|
|
62
|
+
route: 'home',
|
|
63
|
+
name: 'Home',
|
|
64
|
+
order: 100,
|
|
65
|
+
widgets: [
|
|
66
|
+
{
|
|
67
|
+
key: 'welcome',
|
|
68
|
+
c: 'acme/welcome-card',
|
|
69
|
+
order: 100,
|
|
70
|
+
options: { title: 'Welcome' },
|
|
71
|
+
},
|
|
72
|
+
{
|
|
73
|
+
key: 'cases',
|
|
74
|
+
c: 'list-view',
|
|
75
|
+
order: 200,
|
|
76
|
+
options: { table: 'x_acme_hr_case', title: 'My cases', pageSize: 20, recordPage: 'record' },
|
|
77
|
+
},
|
|
78
|
+
],
|
|
79
|
+
},
|
|
80
|
+
{
|
|
81
|
+
route: 'record',
|
|
82
|
+
name: 'Record',
|
|
83
|
+
order: 200,
|
|
84
|
+
contentWidth: 'full',
|
|
85
|
+
widgets: [
|
|
86
|
+
{ key: 'header', c: 'record-header', order: 100 },
|
|
87
|
+
{ key: 'form', c: 'record-form', order: 200 },
|
|
88
|
+
],
|
|
89
|
+
variants: [
|
|
90
|
+
{
|
|
91
|
+
key: 'case',
|
|
92
|
+
name: 'Case',
|
|
93
|
+
order: 100,
|
|
94
|
+
condition: 'table=x_acme_hr_case',
|
|
95
|
+
widgets: [
|
|
96
|
+
{
|
|
97
|
+
key: 'layout',
|
|
98
|
+
c: 'split',
|
|
99
|
+
order: 100,
|
|
100
|
+
children: {
|
|
101
|
+
start: [{ key: 'form', c: 'record-form', order: 100 }],
|
|
102
|
+
end: [{ key: 'tabs', c: 'record-tabs', order: 100 }],
|
|
103
|
+
},
|
|
104
|
+
},
|
|
105
|
+
],
|
|
106
|
+
},
|
|
107
|
+
],
|
|
108
|
+
},
|
|
109
|
+
],
|
|
110
|
+
panels: [
|
|
111
|
+
{
|
|
112
|
+
key: 'help',
|
|
113
|
+
title: 'Help',
|
|
114
|
+
icon: 'circle-help',
|
|
115
|
+
order: 100,
|
|
116
|
+
widgets: [{ key: 'faq', c: 'acme/faq', order: 100 }],
|
|
117
|
+
},
|
|
118
|
+
],
|
|
119
|
+
menus: [
|
|
120
|
+
{
|
|
121
|
+
key: 'primary',
|
|
122
|
+
name: 'Primary',
|
|
123
|
+
items: [
|
|
124
|
+
{ page: 'home', label: 'Home', icon: 'house', order: 100 },
|
|
125
|
+
{ panel: 'help', label: 'Help', icon: 'circle-help', order: 200 },
|
|
126
|
+
{
|
|
127
|
+
label: 'More',
|
|
128
|
+
order: 300,
|
|
129
|
+
children: [{ url: 'https://example.com/policies', label: 'Policies', order: 100, target: '_blank' }],
|
|
130
|
+
},
|
|
131
|
+
],
|
|
132
|
+
},
|
|
133
|
+
],
|
|
134
|
+
};
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
### Fields
|
|
138
|
+
|
|
139
|
+
- **Portal:** `slug`, `name`, `description`, `app` (owning scope), `updateSet` (where pushes write), `active` (leave
|
|
140
|
+
it `false`: publishing happens in Studio), `roles` (comma-separated audience roles; empty = every signed-in user),
|
|
141
|
+
`theme` (a theme key), `layout` (the default layout component), `home` (a page route), `settings`
|
|
142
|
+
(`contentWidth`, `layoutOptions`, …), `nav`, `availableFor` / `notAvailableFor` (user criteria by name).
|
|
143
|
+
- **Component references** (`c`, `layout`): React Portal's own `app/*` components drop the `app/` prefix
|
|
144
|
+
(`'list-view'` is `app/list-view`); everything else is `<ns>/<key>` (`'acme/welcome-card'`).
|
|
145
|
+
- **Placements** (`portalWidgets` on every page, `widgets` on pages, variants and panels):
|
|
146
|
+
`{ key, c, region?, order, active?, roles?, options?, layout?, style?, visibility?, classes?, children?, availableFor?, notAvailableFor? }`.
|
|
147
|
+
`region` defaults to `main` (or, for children, the zone they're listed under). `key` is stable and unique within its
|
|
148
|
+
page, variant, panel or the portal: give every new placement one. `children` maps a block's drop zones to
|
|
149
|
+
placements.
|
|
150
|
+
- **Pages:** `{ route, name, title?, order, active?, roles?, defaultPanel?, layout?, contentWidth?, layoutOptions?, widgets, variants? }`.
|
|
151
|
+
Routes can have params (`orders/:id`).
|
|
152
|
+
- **Page variants:** `{ key, name, title?, order, active?, roles?, condition, defaultPanel?, layout?, contentWidth?, layoutOptions?, widgets }`.
|
|
153
|
+
The first matching variant (by `order`) replaces the page's placements. Conditions test URL params
|
|
154
|
+
(`table=x_acme_hr_case`). Read `rpforge docs read concepts/page-variants` for the operators.
|
|
155
|
+
- **Side panels:** `{ key, title, icon?, pages?, width?, body?, roles?, order, active?, widgets }`. `pages` lists
|
|
156
|
+
routes (none = every page); `body: 'full'` gives the widgets the whole panel.
|
|
157
|
+
- **Menus:** `{ key, name, items }`. An item is one of `page` (a route), `panel` (a panel key), `route`, `url`, or a
|
|
158
|
+
group with `children`, plus `label`, `icon` (Lucide name), `order`, `active?`, `roles?`, `tooltip?`,
|
|
159
|
+
`match: 'exact'`, `target`, `badge`, `condition`, `availableFor`.
|
|
160
|
+
- **Audiences:** `roles` everywhere is a comma-separated string. `availableFor` / `notAvailableFor` name user criteria
|
|
161
|
+
records; a push makes the links match the list (the criteria records themselves are never changed).
|
|
162
|
+
- **Removing something:** set `active: false` and push. Deleting the entry from the file only reports it as removed
|
|
163
|
+
locally; nothing on the instance is deleted.
|
|
164
|
+
|
|
165
|
+
Layouts own regions (`header`, `sidebar`, `main`, …) and options (`layoutOptions`). Look them up:
|
|
166
|
+
`rpforge components --kind layout` and `rpforge components get app/app-shell`.
|
|
167
|
+
|
|
168
|
+
## Themes in a workspace
|
|
169
|
+
|
|
170
|
+
`themes/<key>/theme.json` (`key`, `name`, `source`, `order`, `active`, `description`) and `tokens.json`
|
|
171
|
+
(`{ "light": {...}, "dark": {...} }`). A new folder plus `theme: '<key>'` in `portal.mjs` creates the theme on push.
|
|
172
|
+
Presets and themes of other applications are referenced by key only. See the `react-portal-theme` skill.
|
|
173
|
+
|
|
174
|
+
## Images
|
|
175
|
+
|
|
176
|
+
Files in `assets/` become images of the portal's application, referenced by file name (`logo: '/hr-logo.svg'`). SVGs
|
|
177
|
+
with scripts, event handlers, external references or DOCTYPE declarations are refused. Image writes need Global
|
|
178
|
+
Helpers 1.6.0+.
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: react-portal-theme
|
|
3
|
+
description: Design or change a React Portal theme (light and dark design tokens, fonts, radius, shadows) in an rpforge workspace and push it to the instance. Generates contrast-safe palettes from a brand color with rpforge themes generate, starts from presets, and checks WCAG contrast. Use it when the user asks for a portal theme, brand colors, a dark mode palette, fonts, or a restyle of a React Portal portal.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# React Portal themes
|
|
7
|
+
|
|
8
|
+
A theme is a set of design tokens (CSS custom properties, shadcn names) plus an optional stylesheet. A portal
|
|
9
|
+
references one theme by key (`theme: 'hr-portal'` in `portal.mjs`). Every host-kit component and Tailwind color
|
|
10
|
+
utility follows the tokens, so a good theme restyles the whole portal without touching components.
|
|
11
|
+
|
|
12
|
+
Work in an rpforge workspace (see the `react-portal` skill for the workspace loop and the ground rules: drafts only,
|
|
13
|
+
never delete, two-step pushes).
|
|
14
|
+
|
|
15
|
+
## How themes work
|
|
16
|
+
|
|
17
|
+
- **Files:** `themes/<key>/theme.json` (`key`, `name`, `source: "custom"`, `order`, `active`, `description`),
|
|
18
|
+
`tokens.json`, and optionally `theme.css` (base CSS, loaded before everything else).
|
|
19
|
+
- **`tokens.json`** is `{ "light": { ... }, "dark": { ... } }` with names without the leading `--`. Dark values
|
|
20
|
+
override light ones in dark mode. A theme without a `dark` set gets the default dark colors.
|
|
21
|
+
- **Color tokens:** `background`, `foreground`, `card`, `card-foreground`, `popover`, `popover-foreground`, `primary`,
|
|
22
|
+
`primary-foreground`, `secondary`, `secondary-foreground`, `muted`, `muted-foreground`, `accent`,
|
|
23
|
+
`accent-foreground`, `destructive`, `destructive-foreground`, `border`, `input`, `ring`, `chart-1` … `chart-5`,
|
|
24
|
+
`sidebar`, `sidebar-foreground`, `sidebar-primary`, `sidebar-primary-foreground`, `sidebar-accent`,
|
|
25
|
+
`sidebar-accent-foreground`, `sidebar-border`, `sidebar-ring`, and the status tones `success`, `warning`, `info`
|
|
26
|
+
(each with `-foreground`; they have defaults).
|
|
27
|
+
- **Shared tokens go in `light` only:** `radius`, `font-sans`, `font-serif`, `font-mono`, `letter-spacing`, `spacing`
|
|
28
|
+
(keep it between `0.2rem` and `0.3rem`), and the shadow geometry (`shadow-opacity`, `shadow-blur`, `shadow-spread`,
|
|
29
|
+
`shadow-offset-x`, `shadow-offset-y`). `shadow-color` may also have a dark value.
|
|
30
|
+
- **Write colors in OKLCH:** `"oklch(0.55 0.2 260)"`.
|
|
31
|
+
- **Contrast:** every foreground must reach 4.5:1 on its background (WCAG AA); `input`, `ring` and chart colors 3:1 on
|
|
32
|
+
their surface. AAA (7:1) when the user asks for it.
|
|
33
|
+
- **Custom variables** are allowed (letters, digits, dashes; up to 500 characters a value): `"brand-gradient"` becomes
|
|
34
|
+
`--brand-gradient` for the portal's own CSS.
|
|
35
|
+
- **Fonts** are self-hosted by the host and loaded only when a theme names them; nothing is fetched from third
|
|
36
|
+
parties. Use only these families, written as a stack (`"Inter, ui-sans-serif, system-ui, sans-serif"`):
|
|
37
|
+
- Sans: Inter, Geist, Plus Jakarta Sans, DM Sans, Outfit, Manrope, Figtree, Public Sans, Source Sans 3,
|
|
38
|
+
IBM Plex Sans, Open Sans, Roboto, Lato, Poppins, Montserrat, Nunito, Work Sans, Space Grotesk, Lexend.
|
|
39
|
+
Display: Oxanium.
|
|
40
|
+
- Serif: Source Serif 4, Lora, Merriweather, Playfair Display, Libre Baskerville, EB Garamond, Fraunces.
|
|
41
|
+
- Mono: JetBrains Mono, Geist Mono, Fira Code, IBM Plex Mono, Source Code Pro, Roboto Mono, Space Mono.
|
|
42
|
+
|
|
43
|
+
The instance has the current list: `rpforge docs read concepts/themes --heading "Fonts, letter spacing and spacing"`.
|
|
44
|
+
|
|
45
|
+
## Steps
|
|
46
|
+
|
|
47
|
+
1. **Understand the brief.** What is the portal for, who uses it, the brand color(s), the feel (calm, bold, dense,
|
|
48
|
+
playful), whether dark mode matters. Ask when it isn't clear.
|
|
49
|
+
2. **See what exists.**
|
|
50
|
+
|
|
51
|
+
```sh
|
|
52
|
+
rpforge themes
|
|
53
|
+
rpforge themes get ocean-breeze
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
Presets (`source: preset`) are read-only on the instance: copy their tokens into your own theme folder to start
|
|
57
|
+
from one.
|
|
58
|
+
3. **Generate a palette from the brand color** (made locally, contrast-checked, light and dark):
|
|
59
|
+
|
|
60
|
+
```sh
|
|
61
|
+
rpforge themes generate --color "#0f766e" --tint tinted --radius 0.75rem --sans "Plus Jakarta Sans, ui-sans-serif, system-ui, sans-serif" --out themes/hr-portal/tokens.json
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
`--tint neutral` keeps grays neutral; `tinted` pulls them toward the brand hue. `--contrast AAA` raises every
|
|
65
|
+
target. To convert a shadcn theme the user pasted, save it to a file and use
|
|
66
|
+
`rpforge themes generate --from-css pasted-theme.css --out themes/hr-portal/tokens.json`.
|
|
67
|
+
4. **Write `theme.json`** next to it:
|
|
68
|
+
|
|
69
|
+
```json
|
|
70
|
+
{ "key": "hr-portal", "name": "HR Portal", "source": "custom", "order": 100, "active": true, "description": "" }
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
Keys: lowercase letters, digits and dashes, starting with a letter.
|
|
74
|
+
5. **Refine by hand.** Adjust tokens in `tokens.json` (keep OKLCH). Then re-check contrast; this prints any pair below
|
|
75
|
+
its target and changes no file:
|
|
76
|
+
|
|
77
|
+
```sh
|
|
78
|
+
rpforge themes generate --from-css themes/hr-portal/tokens.json
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
6. **Point the portal at it:** `theme: 'hr-portal'` in `portal.mjs`. Only do this when the user wants the portal to
|
|
82
|
+
use the theme: on a published portal visitors see the change at once.
|
|
83
|
+
7. **Check and push in two steps:**
|
|
84
|
+
|
|
85
|
+
```sh
|
|
86
|
+
rpforge check
|
|
87
|
+
rpforge push --no-interactive
|
|
88
|
+
rpforge push --plan-hash 3f9c2a7e
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
The dry run lists the theme create or update; show it to the user before pushing. The user can review the result
|
|
92
|
+
in Studio's Themes activity and the draft portal's preview.
|
|
93
|
+
|
|
94
|
+
A brand-new portal can get a generated theme at creation instead:
|
|
95
|
+
`rpforge init --no-interactive --app x_acme_hr --update-set "HR Portal (React Portal)" --name "HR Portal" --brand-color "#0f766e" --tint tinted`.
|
|
96
|
+
|
|
97
|
+
## Design guidance
|
|
98
|
+
|
|
99
|
+
- Start from the generator and change little: it already balances every pair. Hand-picked colors are where contrast
|
|
100
|
+
fails.
|
|
101
|
+
- One accent color does most of the work (`primary`, `ring`, `sidebar-primary`); keep `secondary`, `muted` and
|
|
102
|
+
`accent` quiet so primary actions stand out.
|
|
103
|
+
- Dark mode is not inverted light mode: surfaces get lighter as they rise (`background` < `card` < `popover`), and
|
|
104
|
+
saturated colors need a higher lightness to stay readable.
|
|
105
|
+
- Chart colors (`chart-1` … `chart-5`) should be distinguishable from each other in both modes, not five shades of the
|
|
106
|
+
primary.
|
|
107
|
+
- `radius` sets the personality: `0.25rem` crisp, `0.5rem` neutral, `0.75rem`+ soft.
|
|
108
|
+
- Components read tokens as Tailwind utilities (`bg-card`) or raw variables (`var(--card)`). There are no
|
|
109
|
+
`--color-*` variables at runtime: never tell anyone to use `var(--color-primary)`.
|
|
110
|
+
- Don't put component styling in `theme.css`; it's for portal-wide base CSS (body text, links, selection).
|