@quixomatic/rpf 0.3.1 → 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.
Files changed (180) hide show
  1. package/CHANGELOG.md +236 -0
  2. package/README.md +4 -2
  3. package/assets/dev-host/boot.js +7 -223
  4. package/assets/dev-host/boot.js.LEGAL.txt +0 -22
  5. package/assets/dev-host/chunks/{accordion-O6VUPQ32.js → accordion-7MNNAFNO.js} +2 -2
  6. package/assets/dev-host/chunks/{alert-PRAGKG5L.js → alert-GIZIVENB.js} +2 -2
  7. package/assets/dev-host/chunks/{alert-dialog-SCBXM23J.js → alert-dialog-7NG5WNXK.js} +2 -2
  8. package/assets/dev-host/chunks/{avatar-WXPKQ3Z5.js → avatar-BCPZUJGX.js} +2 -2
  9. package/assets/dev-host/chunks/{breadcrumb-IJQJQ5JV.js → breadcrumb-T2XOHRDG.js} +2 -2
  10. package/assets/dev-host/chunks/button-TGT2523L.js +2 -0
  11. package/assets/dev-host/chunks/calendar-TOTKKMY2.js +2 -0
  12. package/assets/dev-host/chunks/{card-EY3LK2GB.js → card-LOSZVZYW.js} +2 -2
  13. package/assets/dev-host/chunks/{chart-2PHC6UIE.js → chart-43TBOZGK.js} +2 -2
  14. package/assets/dev-host/chunks/{chart-blocks-PZPCWCNT.js → chart-blocks-HLNNWNB5.js} +2 -2
  15. package/assets/dev-host/chunks/{chart-frame-MNUFXAPU.js → chart-frame-FNM5OPZU.js} +2 -2
  16. package/assets/dev-host/chunks/{chat-TTESCYES.js → chat-QVZ4BUWR.js} +2 -2
  17. package/assets/dev-host/chunks/{checkbox-Y2UGSRR4.js → checkbox-AFUTB4DV.js} +2 -2
  18. package/assets/dev-host/chunks/{chunk-UWANBOC6.js → chunk-2FVHAZMZ.js} +2 -2
  19. package/assets/dev-host/chunks/{chunk-CWDPAB6V.js → chunk-34RXMJIM.js} +2 -2
  20. package/assets/dev-host/chunks/chunk-354OFHNU.js +219 -0
  21. package/assets/dev-host/chunks/chunk-354OFHNU.js.LEGAL.txt +23 -0
  22. package/assets/dev-host/chunks/{chunk-CCXMDKVL.js → chunk-3LMPMW3Q.js} +2 -2
  23. package/assets/dev-host/chunks/{chunk-3H6F4X7R.js → chunk-4XESWRTW.js} +2 -2
  24. package/assets/dev-host/chunks/{chunk-PYWKHILP.js → chunk-7FCGD4LS.js} +2 -2
  25. package/assets/dev-host/chunks/{chunk-AVSRGCSF.js → chunk-7JQIKRBV.js} +2 -2
  26. package/assets/dev-host/chunks/{chunk-PHK25MY7.js → chunk-DU3VFETH.js} +2 -2
  27. package/assets/dev-host/chunks/{chunk-2IZ44WWI.js → chunk-E5JYU6CR.js} +2 -2
  28. package/assets/dev-host/chunks/{chunk-BB4IX5QA.js → chunk-FBZMZ5S2.js} +2 -2
  29. package/assets/dev-host/chunks/{chunk-GWDGPUGM.js → chunk-GSJT5YWB.js} +2 -2
  30. package/assets/dev-host/chunks/{chunk-OXJ6LWKI.js → chunk-HCQR5YME.js} +3 -3
  31. package/assets/dev-host/chunks/{chunk-APP2HKWR.js → chunk-HGBRF6KW.js} +2 -2
  32. package/assets/dev-host/chunks/{chunk-6ARM5VDH.js → chunk-HVTUE7NV.js} +2 -2
  33. package/assets/dev-host/chunks/{chunk-M7A47ZSM.js → chunk-IY3GAGI7.js} +2 -2
  34. package/assets/dev-host/chunks/{chunk-MGLBTOXD.js → chunk-KY2HARU6.js} +2 -2
  35. package/assets/dev-host/chunks/{chunk-EDEL6XSO.js → chunk-ND526XXU.js} +2 -2
  36. package/assets/dev-host/chunks/{chunk-UXUS6DNI.js → chunk-NMFZMT4R.js} +2 -2
  37. package/assets/dev-host/chunks/{chunk-XE5RQ73V.js → chunk-NPJXSRRT.js} +2 -2
  38. package/assets/dev-host/chunks/{chunk-FJRWQRLM.js → chunk-OUCK2LIZ.js} +2 -2
  39. package/assets/dev-host/chunks/{chunk-Z76KXEPD.js → chunk-OXLXEX2R.js} +2 -2
  40. package/assets/dev-host/chunks/{chunk-BH6FGVDP.js → chunk-PB5RYDO5.js} +2 -2
  41. package/assets/dev-host/chunks/{chunk-TQPXDAVH.js → chunk-QJVIEN5R.js} +2 -2
  42. package/assets/dev-host/chunks/{chunk-57M36GYM.js → chunk-QZ3NJHFR.js} +2 -2
  43. package/assets/dev-host/chunks/{chunk-FZPMZMFU.js → chunk-SC7J7HFI.js} +2 -2
  44. package/assets/dev-host/chunks/{chunk-X34AFUS2.js → chunk-SKBWMIS5.js} +2 -2
  45. package/assets/dev-host/chunks/{chunk-LTVKSGLG.js → chunk-UCEBXCOI.js} +2 -2
  46. package/assets/dev-host/chunks/{chunk-T7JFBQSG.js → chunk-UNKI7HPL.js} +2 -2
  47. package/assets/dev-host/chunks/{chunk-F5MKIWPQ.js → chunk-UPZXXDXM.js} +2 -2
  48. package/assets/dev-host/chunks/{chunk-ML6HCGK5.js → chunk-XBWE3IIB.js} +2 -2
  49. package/assets/dev-host/chunks/{chunk-NJX7QY3Z.js → chunk-YFI7GTF6.js} +2 -2
  50. package/assets/dev-host/chunks/{chunk-NI6ZJ6DH.js → chunk-YJM2Y722.js} +2 -2
  51. package/assets/dev-host/chunks/{chunk-WLBNJ4K3.js → chunk-ZNWVTDCV.js} +2 -2
  52. package/assets/dev-host/chunks/{chunk-UUJ5X322.js → chunk-ZTMZ7LJW.js} +2 -2
  53. package/assets/dev-host/chunks/{chunk-OW6AVFQA.js → chunk-ZZ2RYU7S.js} +2 -2
  54. package/assets/dev-host/chunks/{code-block-H2ETQV3M.js → code-block-IKYEIWY2.js} +2 -2
  55. package/assets/dev-host/chunks/code-editor-KDRLM33B.js +2 -0
  56. package/assets/dev-host/chunks/{collapsible-4ZOFMWLB.js → collapsible-WK7PDWEV.js} +2 -2
  57. package/assets/dev-host/chunks/{color-picker-RRCCLR54.js → color-picker-VPSOGTDM.js} +2 -2
  58. package/assets/dev-host/chunks/{combobox-U4455OMJ.js → combobox-GYLAHYVX.js} +2 -2
  59. package/assets/dev-host/chunks/{contrast-badge-KDF65X7J.js → contrast-badge-QZW62DMF.js} +2 -2
  60. package/assets/dev-host/chunks/{date-range-picker-WJYHAHRM.js → date-range-picker-6Q2JGR43.js} +2 -2
  61. package/assets/dev-host/chunks/{dialog-I6AGHWB3.js → dialog-HDQAIAFZ.js} +2 -2
  62. package/assets/dev-host/chunks/{dropdown-menu-LSOMXDWG.js → dropdown-menu-E7K3YNXS.js} +2 -2
  63. package/assets/dev-host/chunks/{empty-NLQODUSK.js → empty-JCVCSM3V.js} +2 -2
  64. package/assets/dev-host/chunks/{font-picker-3TLYYZJH.js → font-picker-7FBJCSTQ.js} +2 -2
  65. package/assets/dev-host/chunks/{frame-HA7UIYZF.js → frame-LZ2IUISE.js} +2 -2
  66. package/assets/dev-host/chunks/{heading-7M24WKK6.js → heading-GX36VR3U.js} +2 -2
  67. package/assets/dev-host/chunks/{hover-card-HSHOQPOI.js → hover-card-ONEUZ7TU.js} +2 -2
  68. package/assets/dev-host/chunks/{image-R7XGYKVH.js → image-E3BYZ2HA.js} +2 -2
  69. package/assets/dev-host/chunks/{input-YECXNM53.js → input-G7S4OLSN.js} +2 -2
  70. package/assets/dev-host/chunks/{input-group-GFKXSZM7.js → input-group-54JRMLWQ.js} +2 -2
  71. package/assets/dev-host/chunks/{kbd-V25ZMVCM.js → kbd-TKMXF542.js} +2 -2
  72. package/assets/dev-host/chunks/label-YIVRPKQJ.js +2 -0
  73. package/assets/dev-host/chunks/{label-value-6Z6ATP55.js → label-value-V7QDIDAP.js} +2 -2
  74. package/assets/dev-host/chunks/{logo-AAMBHX2W.js → logo-DBA4NHQE.js} +2 -2
  75. package/assets/dev-host/chunks/{number-field-6TCQAVTR.js → number-field-FPC3YXDC.js} +2 -2
  76. package/assets/dev-host/chunks/{pill-7L57ZNRJ.js → pill-4WVEOBR4.js} +2 -2
  77. package/assets/dev-host/chunks/{popover-3P6YNKH3.js → popover-GQD2U5SP.js} +2 -2
  78. package/assets/dev-host/chunks/{progress-RBCJRVM7.js → progress-TITSWD2A.js} +2 -2
  79. package/assets/dev-host/chunks/{radio-group-NJWXZCX3.js → radio-group-YA3OUIPB.js} +2 -2
  80. package/assets/dev-host/chunks/{resizable-XF4P6OKR.js → resizable-XQKUCHIS.js} +2 -2
  81. package/assets/dev-host/chunks/rich-text-2RYBPVRF.js +2 -0
  82. package/assets/dev-host/chunks/{rich-text-editor-T6KWD4P3.js → rich-text-editor-IX7RIMLI.js} +2 -2
  83. package/assets/dev-host/chunks/{scroll-row-LMI7JCFR.js → scroll-row-MZZQZYLM.js} +2 -2
  84. package/assets/dev-host/chunks/{select-F3MZWTTS.js → select-5U37ZHLQ.js} +2 -2
  85. package/assets/dev-host/chunks/separator-JATMMEKS.js +2 -0
  86. package/assets/dev-host/chunks/{sheet-EXRT4MFB.js → sheet-KTVNRYAO.js} +2 -2
  87. package/assets/dev-host/chunks/{side-panel-IBHLEANN.js → side-panel-2UVNFRIF.js} +2 -2
  88. package/assets/dev-host/chunks/{sidebar-VKQMQMF2.js → sidebar-GR4A2LDD.js} +2 -2
  89. package/assets/dev-host/chunks/{skeleton-KIRVQ4EO.js → skeleton-XE2TGBGQ.js} +2 -2
  90. package/assets/dev-host/chunks/{slider-XKYDL5MR.js → slider-BGGGQLSH.js} +2 -2
  91. package/assets/dev-host/chunks/{split-button-WP6LALDS.js → split-button-KLVGWHNN.js} +2 -2
  92. package/assets/dev-host/chunks/{stepper-KR6PXZHW.js → stepper-AY3NGEDC.js} +2 -2
  93. package/assets/dev-host/chunks/{switch-P6NJELJJ.js → switch-A2VSCLHA.js} +2 -2
  94. package/assets/dev-host/chunks/{tabs-PFPRJNVZ.js → tabs-2IO6EIED.js} +2 -2
  95. package/assets/dev-host/chunks/textarea-YQH2OPGH.js +2 -0
  96. package/assets/dev-host/chunks/{toggle-group-PS7JN2JM.js → toggle-group-3SDBWJ2G.js} +2 -2
  97. package/assets/dev-host/chunks/{tooltip-S4RBC3O4.js → tooltip-4QJ2SWCS.js} +2 -2
  98. package/assets/dev-host/chunks/{tree-NQF6ZJLH.js → tree-CFIKTPFC.js} +2 -2
  99. package/assets/dev-host/kit-candidates.json +1 -1
  100. package/assets/dev-host/kit-manifest.json +1 -1
  101. package/assets/dev-host/stage.js +54 -0
  102. package/assets/forge-app/app/assets/{_forge-shiki-langs-DaJjT17w.js → _forge-shiki-langs-Bm9NaYXm.js} +1 -1
  103. package/assets/forge-app/app/assets/{appendItems-CWJJlOE7.js → appendItems-DrlkyU0a.js} +1 -1
  104. package/assets/forge-app/app/assets/{core-Dl2d1S-D.js → core-8OhGxroQ.js} +1 -1
  105. package/assets/forge-app/app/assets/{diff-view-Chujmqzi.js → diff-view-rgZLuZMg.js} +4 -4
  106. package/assets/forge-app/app/assets/file-panel-CpPZ9DXB.js +1199 -0
  107. package/assets/forge-app/app/assets/{highlights-BxaWC1ve.js → highlights-C-SEG213.js} +1 -1
  108. package/assets/forge-app/app/assets/index-DWGc27yI.css +1 -0
  109. package/assets/forge-app/app/assets/index-DXDXX5UZ.js +298 -0
  110. package/assets/forge-app/app/assets/{loader-BMv9OYvr.js → loader-Du5I86pW.js} +1 -1
  111. package/assets/forge-app/app/assets/{shiki-CoRI3zWj.js → shiki-Bf12fWbJ.js} +2 -2
  112. package/assets/forge-app/app/assets/{stream-tokenizer-BMtK_3oz.js → stream-tokenizer-DdzFthqp.js} +1 -1
  113. package/assets/forge-app/app/assets/{terminal-view-D3CiLjfu.js → terminal-view-Co0jXSWF.js} +1 -1
  114. package/assets/forge-app/app/assets/{themes-CLX9vH7e.js → themes-BrkVmSlQ.js} +2 -2
  115. package/assets/forge-app/app/assets/{useNextRenderData-dgMkjxGZ.js → useNextRenderData-BKv-kpPs.js} +3 -3
  116. package/assets/forge-app/app/index.html +2 -2
  117. package/assets/forge-app/server.mjs +2677 -8753
  118. package/dist/cli.mjs +13247 -7148
  119. package/examples/component-workspace/README.md +23 -0
  120. package/examples/component-workspace/components/@example/greeting/component.json +8 -0
  121. package/examples/component-workspace/components/@example/greeting/main.tsx +22 -0
  122. package/examples/component-workspace/components/@example/greeting/options.schema.json +6 -0
  123. package/examples/component-workspace/forge.workspace.json +7 -0
  124. package/examples/component-workspace/stage.json +11 -0
  125. package/examples/header-slot-widget/README.md +30 -0
  126. package/examples/header-slot-widget/components/@example/page-actions/component.json +8 -0
  127. package/examples/header-slot-widget/components/@example/page-actions/main.tsx +37 -0
  128. package/examples/header-slot-widget/components/@example/page-actions/options.schema.json +9 -0
  129. package/examples/index.json +159 -0
  130. package/examples/layout-regions/README.md +41 -0
  131. package/examples/layout-regions/components/@example/workspace-shell/component.json +21 -0
  132. package/examples/layout-regions/components/@example/workspace-shell/main.tsx +61 -0
  133. package/examples/layout-regions/components/@example/workspace-shell/options.schema.json +29 -0
  134. package/examples/layout-regions/components/@example/workspace-shell/styles.css +95 -0
  135. package/examples/portal-list-page/README.md +22 -0
  136. package/examples/portal-list-page/portal.mjs +40 -0
  137. package/examples/portal-record-page/README.md +23 -0
  138. package/examples/portal-record-page/portal.mjs +62 -0
  139. package/examples/primitive-and-utility/README.md +19 -0
  140. package/examples/primitive-and-utility/components/@example/number-format/component.json +6 -0
  141. package/examples/primitive-and-utility/components/@example/number-format/main.tsx +30 -0
  142. package/examples/primitive-and-utility/components/@example/stat-tile/component.json +6 -0
  143. package/examples/primitive-and-utility/components/@example/stat-tile/main.tsx +45 -0
  144. package/examples/primitive-and-utility/components/@example/work-summary/component.json +9 -0
  145. package/examples/primitive-and-utility/components/@example/work-summary/main.tsx +31 -0
  146. package/examples/primitive-and-utility/components/@example/work-summary/options.schema.json +6 -0
  147. package/examples/primitive-and-utility/components/@example/work-summary/server.js +27 -0
  148. package/examples/side-panel/README.md +18 -0
  149. package/examples/side-panel/components/@example/help-button/component.json +8 -0
  150. package/examples/side-panel/components/@example/help-button/main.tsx +26 -0
  151. package/examples/side-panel/components/@example/help-button/options.schema.json +7 -0
  152. package/examples/side-panel/portal.mjs +46 -0
  153. package/examples/theme/README.md +16 -0
  154. package/examples/theme/themes/teal-harbor/theme.css +11 -0
  155. package/examples/theme/themes/teal-harbor/theme.json +8 -0
  156. package/examples/theme/themes/teal-harbor/tokens.json +72 -0
  157. package/examples/widget-options/README.md +25 -0
  158. package/examples/widget-options/components/@example/notice-banner/component.json +14 -0
  159. package/examples/widget-options/components/@example/notice-banner/main.tsx +60 -0
  160. package/examples/widget-options/components/@example/notice-banner/options.schema.json +24 -0
  161. package/examples/widget-server-user/README.md +21 -0
  162. package/examples/widget-server-user/components/@example/user-card/component.json +9 -0
  163. package/examples/widget-server-user/components/@example/user-card/main.tsx +51 -0
  164. package/examples/widget-server-user/components/@example/user-card/options.schema.json +6 -0
  165. package/examples/widget-server-user/components/@example/user-card/server.js +27 -0
  166. package/package.json +7 -3
  167. package/skills/react-portal/SKILL.md +23 -1
  168. package/skills/react-portal/references/cli.md +11 -0
  169. package/skills/react-portal/references/components.md +40 -2
  170. package/assets/dev-host/chunks/button-4JMBKYN4.js +0 -2
  171. package/assets/dev-host/chunks/calendar-XXLCAUPG.js +0 -2
  172. package/assets/dev-host/chunks/code-editor-2JYERJLS.js +0 -2
  173. package/assets/dev-host/chunks/label-LJT4V2CT.js +0 -2
  174. package/assets/dev-host/chunks/rich-text-7OMYZ564.js +0 -2
  175. package/assets/dev-host/chunks/separator-JRJYKM4Z.js +0 -2
  176. package/assets/dev-host/chunks/textarea-2JXA5XWS.js +0 -2
  177. package/assets/forge-app/app/assets/file-panel-le_M5nHe.js +0 -1199
  178. package/assets/forge-app/app/assets/index-BwYJlfwT.css +0 -1
  179. package/assets/forge-app/app/assets/index-UP3KtgHV.js +0 -291
  180. /package/assets/dev-host/chunks/{chunk-OXJ6LWKI.js.LEGAL.txt → chunk-HCQR5YME.js.LEGAL.txt} +0 -0
@@ -0,0 +1,23 @@
1
+ # A component workspace
2
+
3
+ Build components of one scoped application without a portal: no `portal.mjs`, just `components/@<ns>/<key>/`.
4
+
5
+ ## Files
6
+
7
+ - `forge.workspace.json` with `"kind": "component"`. `rpf init --component` (or Forge's Component start) writes it
8
+ and fills `instances` on the first pull: the app, the update set, the tracked component ids and their base state.
9
+ Never edit it by hand. The empty `instances` here only shows the shape.
10
+ - `stage.json`: the component stage's presets per component (options, URL params, theme, light / dark, width).
11
+ Committed, never pushed.
12
+ - `components/@example/greeting/`: one widget.
13
+
14
+ ## The loop
15
+
16
+ 1. New component: `scaffold_component { id: '<ns>/<key>', kind: 'widget' }` (MCP) or
17
+ `rpf new component <ns>/<key> --kind widget`. It joins the tracked list.
18
+ 2. Preview on the **stage**: `rpf dev` serves `/__rpf/stage` (a picker, the options form, params, theme, widths).
19
+ Agents: `dev_stage { component: '<ns>/<key>', options: {…}, width: 'phone' }`, then `dev_open` with route
20
+ `stage` (and `screenshot: true`).
21
+ 3. `rpf check` / `workspace_check`: Prettier, the lint, the instance compiling every changed component, the push
22
+ dry run.
23
+ 4. Push into the workspace's app and update set: `rpf push` (two steps), or Push in Forge.
@@ -0,0 +1,8 @@
1
+ {
2
+ "name": "Greeting",
3
+ "kind": "widget",
4
+ "description": "Greets the signed-in user by first name",
5
+ "placeable": true,
6
+ "tailwind": true,
7
+ "defaults": { "greeting": "Hello" }
8
+ }
@@ -0,0 +1,22 @@
1
+ import { useUser } from '@portal/runtime';
2
+ import { Card, CardContent } from 'components:card';
3
+
4
+ type Options = { greeting?: string };
5
+
6
+ /**
7
+ * components:example/greeting: greets the signed-in user by first name. No server script: useUser() already has
8
+ * the name on the client.
9
+ */
10
+ export default function Greeting({ options = {} }: { options?: Options }) {
11
+ const user = useUser();
12
+ const name = user.firstName || user.name || 'there';
13
+ return (
14
+ <Card>
15
+ <CardContent>
16
+ <p className="text-lg font-medium">
17
+ {options.greeting || 'Hello'}, {name}
18
+ </p>
19
+ </CardContent>
20
+ </Card>
21
+ );
22
+ }
@@ -0,0 +1,6 @@
1
+ {
2
+ "type": "object",
3
+ "properties": {
4
+ "greeting": { "type": "string", "title": "Greeting", "default": "Hello" }
5
+ }
6
+ }
@@ -0,0 +1,7 @@
1
+ {
2
+ "format": 1,
3
+ "kind": "component",
4
+ "ignore": [],
5
+ "images": [],
6
+ "instances": {}
7
+ }
@@ -0,0 +1,11 @@
1
+ {
2
+ "current": "example/greeting",
3
+ "components": {
4
+ "example/greeting": {
5
+ "options": { "greeting": "Welcome back" },
6
+ "params": {},
7
+ "mode": "light",
8
+ "width": "phone"
9
+ }
10
+ }
11
+ }
@@ -0,0 +1,30 @@
1
+ # A widget that renders into the shell's header slots
2
+
3
+ Put toolbars, counts or a primary button in the header the layout already has, instead of writing a new layout.
4
+
5
+ ## How it works
6
+
7
+ - The header widget (React Portal's `app/app-subheader` in `app/app-shell`) renders outlets:
8
+ `<HeaderSlotOutlet name="left" />`, `center`, `right`, plus `below` (banner mode) and `tabs`.
9
+ - Any page widget contributes with `<HeaderSlot name="right">…</HeaderSlot>` from `utilities:app/header-slots`. The
10
+ content is a React portal: state and events stay with the contributing widget, and it unmounts with the page.
11
+ - `fallback`: `"inline"` renders in place when the layout has no such slot; `"none"` renders nothing.
12
+ - A whole layout region (not a slot inside a header widget) takes `<RegionPortal region="header">` from
13
+ `@portal/runtime` instead, when the layout declares that region with `acceptsContributions: true`.
14
+
15
+ ## In portal.mjs
16
+
17
+ ```js
18
+ {
19
+ route: 'requests',
20
+ name: 'My requests',
21
+ order: 200,
22
+ layoutOptions: { subheader: 'bar' },
23
+ widgets: [
24
+ { key: 'actions', c: 'example/page-actions', order: 10, options: { label: 'New request', page: 'catalog' } },
25
+ { key: 'list', c: 'list-view', order: 100, options: { table: 'sc_req_item', toolbarPlacement: 'inline' } },
26
+ ],
27
+ }
28
+ ```
29
+
30
+ Read more: `read_doc primitives/header-slots` (CLI: `rpf docs read primitives/header-slots`).
@@ -0,0 +1,8 @@
1
+ {
2
+ "name": "Page actions",
3
+ "kind": "widget",
4
+ "description": "Puts a page's primary action (and an optional note) into the shell header's slots",
5
+ "placeable": true,
6
+ "tailwind": true,
7
+ "defaults": { "label": "New request", "icon": "plus", "page": "catalog" }
8
+ }
@@ -0,0 +1,37 @@
1
+ import { useNavigate } from '@portal/runtime';
2
+ import { Button } from 'components:button';
3
+ import { Icon } from 'components:icon';
4
+ import { HeaderSlot } from 'utilities:app/header-slots';
5
+
6
+ type Options = { label?: string; icon?: string; page?: string; note?: string };
7
+
8
+ /**
9
+ * components:example/page-actions: puts a page's primary action into the shell's header instead of the page body.
10
+ *
11
+ * HeaderSlot portals its children into a named slot inside a header widget's own markup (app/app-subheader's bar
12
+ * has left / center / right; the banner adds below; tabs sits under the title). The widget itself renders nothing
13
+ * where it is placed. `fallback="inline"` renders the content in place when the current layout has no such slot,
14
+ * so the action never disappears.
15
+ */
16
+ export default function PageActions({ options = {} }: { options?: Options }) {
17
+ const navigate = useNavigate();
18
+ return (
19
+ <>
20
+ {options.note ? (
21
+ <HeaderSlot name="center" fallback="none">
22
+ <span className="text-sm text-muted-foreground">{options.note}</span>
23
+ </HeaderSlot>
24
+ ) : null}
25
+ <HeaderSlot name="right" fallback="inline">
26
+ <Button
27
+ size="sm"
28
+ onClick={() => options.page && navigate({ page: options.page })}
29
+ disabled={!options.page}
30
+ >
31
+ {options.icon ? <Icon name={options.icon} /> : null}
32
+ {options.label || 'New'}
33
+ </Button>
34
+ </HeaderSlot>
35
+ </>
36
+ );
37
+ }
@@ -0,0 +1,9 @@
1
+ {
2
+ "type": "object",
3
+ "properties": {
4
+ "label": { "type": "string", "title": "Button label", "default": "New request" },
5
+ "icon": { "type": "string", "title": "Icon (Lucide name)", "default": "plus" },
6
+ "page": { "type": "string", "title": "Opens page (route)", "default": "catalog" },
7
+ "note": { "type": "string", "title": "Note in the header's center" }
8
+ }
9
+ }
@@ -0,0 +1,159 @@
1
+ {
2
+ "format": 1,
3
+ "examples": [
4
+ {
5
+ "id": "widget-server-user",
6
+ "title": "Widget with a server script: the signed-in user",
7
+ "teaches": "server.js reads sys_user with GlideRecordSecure; useServer with a pending state; on-load",
8
+ "kind": "widget",
9
+ "requires": {
10
+ "reactPortal": ">=1.73.0"
11
+ },
12
+ "main": "components/@example/user-card",
13
+ "files": [
14
+ "README.md",
15
+ "components/@example/user-card/component.json",
16
+ "components/@example/user-card/main.tsx",
17
+ "components/@example/user-card/options.schema.json",
18
+ "components/@example/user-card/server.js"
19
+ ]
20
+ },
21
+ {
22
+ "id": "widget-options",
23
+ "title": "Widget options: schema, defaults and the options prop",
24
+ "teaches": "options.schema.json (textarea, enum + x-presets, color + x-css-var), defaults",
25
+ "kind": "widget",
26
+ "requires": {
27
+ "reactPortal": ">=1.73.0"
28
+ },
29
+ "main": "components/@example/notice-banner",
30
+ "files": [
31
+ "README.md",
32
+ "components/@example/notice-banner/component.json",
33
+ "components/@example/notice-banner/main.tsx",
34
+ "components/@example/notice-banner/options.schema.json"
35
+ ]
36
+ },
37
+ {
38
+ "id": "primitive-and-utility",
39
+ "title": "A primitive and a utility, imported by a widget",
40
+ "teaches": "a primitive (named exports + preview) and a utility (hooks) imported by a widget",
41
+ "kind": "multi",
42
+ "requires": {
43
+ "reactPortal": ">=1.73.0"
44
+ },
45
+ "files": [
46
+ "README.md",
47
+ "components/@example/number-format/component.json",
48
+ "components/@example/number-format/main.tsx",
49
+ "components/@example/stat-tile/component.json",
50
+ "components/@example/stat-tile/main.tsx",
51
+ "components/@example/work-summary/component.json",
52
+ "components/@example/work-summary/main.tsx",
53
+ "components/@example/work-summary/options.schema.json",
54
+ "components/@example/work-summary/server.js"
55
+ ]
56
+ },
57
+ {
58
+ "id": "header-slot-widget",
59
+ "title": "A widget that renders into the shell's header slots",
60
+ "teaches": "HeaderSlot (utilities:app/header-slots) into the shell header; RegionPortal vs slots",
61
+ "kind": "widget",
62
+ "requires": {
63
+ "reactPortal": ">=1.73.0"
64
+ },
65
+ "main": "components/@example/page-actions",
66
+ "files": [
67
+ "README.md",
68
+ "components/@example/page-actions/component.json",
69
+ "components/@example/page-actions/main.tsx",
70
+ "components/@example/page-actions/options.schema.json"
71
+ ]
72
+ },
73
+ {
74
+ "id": "layout-regions",
75
+ "title": "A bespoke layout: seven regions, a side panel region, CSS-only options",
76
+ "teaches": "regions + acceptsContributions, <Region>, <SidePanelRegion>, CSS-only options, phone collapse",
77
+ "kind": "layout",
78
+ "requires": {
79
+ "reactPortal": ">=1.73.0"
80
+ },
81
+ "main": "components/@example/workspace-shell",
82
+ "files": [
83
+ "README.md",
84
+ "components/@example/workspace-shell/component.json",
85
+ "components/@example/workspace-shell/main.tsx",
86
+ "components/@example/workspace-shell/options.schema.json",
87
+ "components/@example/workspace-shell/styles.css"
88
+ ]
89
+ },
90
+ {
91
+ "id": "portal-list-page",
92
+ "title": "A list page in portal.mjs",
93
+ "teaches": "a page placing app/list-view (table, fixedQuery, columns, recordPage), a menu item",
94
+ "kind": "portal",
95
+ "requires": {
96
+ "reactPortal": ">=1.73.0"
97
+ },
98
+ "files": ["README.md", "portal.mjs"]
99
+ },
100
+ {
101
+ "id": "portal-record-page",
102
+ "title": "A record page: header, form, tabs, related lists, side panels and a variant",
103
+ "teaches": "record-tabs / record-form, a table variant with a split, record panels",
104
+ "kind": "portal",
105
+ "requires": {
106
+ "reactPortal": ">=1.73.0"
107
+ },
108
+ "files": ["README.md", "portal.mjs"]
109
+ },
110
+ {
111
+ "id": "side-panel",
112
+ "title": "A side panel with its own placements, opened from a page",
113
+ "teaches": "panels in portal.mjs, a menu item { panel }, useSidePanel().toggle",
114
+ "kind": "portal",
115
+ "requires": {
116
+ "reactPortal": ">=1.73.0"
117
+ },
118
+ "files": [
119
+ "README.md",
120
+ "components/@example/help-button/component.json",
121
+ "components/@example/help-button/main.tsx",
122
+ "components/@example/help-button/options.schema.json",
123
+ "portal.mjs"
124
+ ]
125
+ },
126
+ {
127
+ "id": "theme",
128
+ "title": "A theme: theme.json, tokens.json and theme.css",
129
+ "teaches": "themes/<key>/ files: light + dark OKLCH tokens, base CSS in theme.css",
130
+ "kind": "theme",
131
+ "requires": {
132
+ "reactPortal": ">=1.73.0"
133
+ },
134
+ "files": [
135
+ "README.md",
136
+ "themes/teal-harbor/theme.css",
137
+ "themes/teal-harbor/theme.json",
138
+ "themes/teal-harbor/tokens.json"
139
+ ]
140
+ },
141
+ {
142
+ "id": "component-workspace",
143
+ "title": "A component workspace",
144
+ "teaches": "forge.workspace.json kind component, stage.json presets, the stage loop",
145
+ "kind": "workspace",
146
+ "requires": {
147
+ "reactPortal": ">=1.73.0"
148
+ },
149
+ "files": [
150
+ "README.md",
151
+ "components/@example/greeting/component.json",
152
+ "components/@example/greeting/main.tsx",
153
+ "components/@example/greeting/options.schema.json",
154
+ "forge.workspace.json",
155
+ "stage.json"
156
+ ]
157
+ }
158
+ ]
159
+ }
@@ -0,0 +1,41 @@
1
+ # A bespoke layout: seven regions, a side panel region, CSS-only options
2
+
3
+ Write a layout only when the structure needs regions the stock shell (`app/app-shell`: sidebar, header, subheader,
4
+ main, footer, plus header slots and subheader modes) doesn't have. This one adds a quick-actions **rail** beside the
5
+ sidebar and a second sub-header row (**subsubheader**) for page tabs.
6
+
7
+ ## Files
8
+
9
+ - `component.json`: `kind: "layout"`, the `regions` with `acceptsContributions`, and `defaults`. `main` hosts the
10
+ matched page. Side panels are not a region.
11
+ - `main.tsx`: `<Region name="…" />` per region and `<SidePanelRegion variant="push" />`. Layouts get
12
+ `{ regions, options }` as props (no `instanceId`).
13
+ - `styles.css`: every option is a data attribute switched in CSS. Options never change the element tree, so changing
14
+ one never remounts a widget. The sidebar column has no width of its own: `app-sidebar` sizes it (expanded, or the
15
+ icon rail on Ctrl/Cmd+B) and turns into a sheet on phones, as in `app/app-shell`. Phones also drop the rail.
16
+ - `options.schema.json`: the options form (portal `settings.layoutOptions`, a page's `layoutOptions`).
17
+
18
+ ## Using it
19
+
20
+ ```js
21
+ // portal.mjs
22
+ layout: 'example/workspace-shell',
23
+ settings: { layoutOptions: { rail: 'shown', contentPadding: 'md' } },
24
+ portalWidgets: [
25
+ { key: 'nav', c: 'app-sidebar', region: 'sidebar', order: 100 },
26
+ { key: 'top', c: 'app-header', region: 'header', order: 100 },
27
+ ],
28
+ ```
29
+
30
+ A page widget can contribute into a region that accepts contributions:
31
+
32
+ ```tsx
33
+ import { RegionPortal } from '@portal/runtime';
34
+
35
+ <RegionPortal region="subsubheader">
36
+ <nav className="flex gap-4 px-4 py-2 text-sm">…</nav>
37
+ </RegionPortal>
38
+ ```
39
+
40
+ Start your own from it: `scaffold_component { id: '<ns>/<key>', from: 'layout-regions' }` or
41
+ `rpf new component <ns>/<key> --from layout-regions`, then rename regions to fit.
@@ -0,0 +1,21 @@
1
+ {
2
+ "name": "Workspace shell",
3
+ "kind": "layout",
4
+ "description": "A layout with a sidebar, a quick-actions rail, a header, two sub-headers, main, a footer and side panels",
5
+ "tailwind": false,
6
+ "regions": [
7
+ { "name": "sidebar", "acceptsContributions": true },
8
+ { "name": "rail", "acceptsContributions": true },
9
+ { "name": "header", "acceptsContributions": true },
10
+ { "name": "subheader", "acceptsContributions": true },
11
+ { "name": "subsubheader", "acceptsContributions": true },
12
+ { "name": "main", "acceptsContributions": false },
13
+ { "name": "footer", "acceptsContributions": true }
14
+ ],
15
+ "defaults": {
16
+ "rail": "shown",
17
+ "subsubheader": "shown",
18
+ "contentPadding": "md",
19
+ "sidePanel": "push"
20
+ }
21
+ }
@@ -0,0 +1,61 @@
1
+ import { Region, SidePanelRegion } from '@portal/runtime';
2
+
3
+ type Options = {
4
+ rail?: 'shown' | 'hidden';
5
+ subsubheader?: 'shown' | 'hidden';
6
+ contentPadding?: 'none' | 'sm' | 'md' | 'lg';
7
+ sidePanel?: 'push' | 'overlay';
8
+ };
9
+
10
+ /**
11
+ * Picks an allowed value or the default (options come from portal.mjs and the designer: never trust their shape).
12
+ * @param value the option value
13
+ * @param allowed the allowed values
14
+ * @param fallback the default
15
+ * @returns the value when allowed, else the default
16
+ */
17
+ function pick<T extends string>(value: unknown, allowed: readonly T[], fallback: T): T {
18
+ return allowed.indexOf(value as T) >= 0 ? (value as T) : fallback;
19
+ }
20
+
21
+ /**
22
+ * components:example/workspace-shell: a bespoke layout with a sidebar, a narrow rail beside it, a header, a
23
+ * sub-header, a sub-sub-header (page tabs), main, a footer and the side panel region.
24
+ *
25
+ * - Regions are declared in component.json (`regions`, with `acceptsContributions`) and rendered with <Region>.
26
+ * `main` hosts the matched page; the others show portal-level placements, then the page's, then RegionPortal
27
+ * contributions where allowed.
28
+ * - Side panels open in <SidePanelRegion>, which is not a region (never declare it in component.json).
29
+ * - Options switch CSS through data attributes and never change the element tree, so changing one never remounts
30
+ * a widget. Every option is CSS in styles.css.
31
+ * - The sidebar region has no width of its own: app/app-sidebar sets it (expanded, icon rail on Ctrl/Cmd+B), as in
32
+ * app/app-shell, so the shell's sidebar widget carries over unchanged.
33
+ * - Phones (below 768px): the rail and the sidebar column collapse (app-sidebar opens as a sheet from the header);
34
+ * the side panel becomes a sheet on its own.
35
+ */
36
+ export default function WorkspaceShell({ options = {} }: { options?: Options }) {
37
+ const sidePanel = pick(options.sidePanel, ['push', 'overlay'] as const, 'push');
38
+ return (
39
+ <div
40
+ className="ws-shell"
41
+ data-rail={pick(options.rail, ['shown', 'hidden'] as const, 'shown')}
42
+ data-subsubheader={pick(options.subsubheader, ['shown', 'hidden'] as const, 'shown')}
43
+ data-pad={pick(options.contentPadding, ['none', 'sm', 'md', 'lg'] as const, 'md')}
44
+ >
45
+ <Region name="sidebar" as="aside" className="ws-shell__sidebar" />
46
+ <Region name="rail" as="nav" className="ws-shell__rail" />
47
+ <div className="ws-shell__column">
48
+ <Region name="header" as="header" className="ws-shell__header" />
49
+ <Region name="subheader" className="ws-shell__subheader" />
50
+ <Region name="subsubheader" className="ws-shell__subsubheader" />
51
+ <div className="ws-shell__stage">
52
+ <main className="ws-shell__main">
53
+ <Region name="main" className="ws-shell__content" />
54
+ </main>
55
+ <SidePanelRegion variant={sidePanel} />
56
+ </div>
57
+ <Region name="footer" as="footer" className="ws-shell__footer" />
58
+ </div>
59
+ </div>
60
+ );
61
+ }
@@ -0,0 +1,29 @@
1
+ {
2
+ "type": "object",
3
+ "properties": {
4
+ "rail": {
5
+ "type": "string",
6
+ "title": "Quick-actions rail",
7
+ "enum": ["shown", "hidden"],
8
+ "default": "shown"
9
+ },
10
+ "subsubheader": {
11
+ "type": "string",
12
+ "title": "Page tabs row",
13
+ "enum": ["shown", "hidden"],
14
+ "default": "shown"
15
+ },
16
+ "contentPadding": {
17
+ "type": "string",
18
+ "title": "Content padding",
19
+ "enum": ["none", "sm", "md", "lg"],
20
+ "default": "md"
21
+ },
22
+ "sidePanel": {
23
+ "type": "string",
24
+ "title": "Side panels",
25
+ "enum": ["push", "overlay"],
26
+ "default": "push"
27
+ }
28
+ }
29
+ }
@@ -0,0 +1,95 @@
1
+ /*
2
+ * Structure only: the widgets in each region own their look (height, borders, background). main is the only
3
+ * scroller. Theme colors are var(--…) tokens; there are no --color-* variables at runtime.
4
+ */
5
+ .ws-shell {
6
+ display: flex;
7
+ height: 100%;
8
+ width: 100%;
9
+ min-height: 0;
10
+ overflow: hidden;
11
+ background: var(--background);
12
+ color: var(--foreground);
13
+ }
14
+
15
+ /* Sidebar: full height; app/app-sidebar fills it and sets its own width (expanded or the icon rail), as in
16
+ app/app-shell. Never give this column a fixed width, or the sidebar's collapse fights it. */
17
+ .ws-shell__sidebar {
18
+ display: flex;
19
+ flex: 0 0 auto;
20
+ flex-direction: column;
21
+ min-height: 0;
22
+ }
23
+ .ws-shell__sidebar > [data-rp-widget] {
24
+ display: flex;
25
+ flex: 1 1 auto;
26
+ flex-direction: column;
27
+ min-height: 0;
28
+ }
29
+ .ws-shell__sidebar > [data-rp-widget] > * {
30
+ flex: 1 1 auto;
31
+ min-height: 0;
32
+ }
33
+
34
+ /* The rail: a narrow column of icon actions beside the sidebar. */
35
+ .ws-shell__rail {
36
+ display: flex;
37
+ flex: 0 0 3.5rem;
38
+ flex-direction: column;
39
+ align-items: center;
40
+ gap: 0.5rem;
41
+ padding-block: 0.75rem;
42
+ border-right: 1px solid var(--border);
43
+ background: var(--sidebar, var(--muted));
44
+ }
45
+ .ws-shell[data-rail='hidden'] .ws-shell__rail,
46
+ .ws-shell__rail:not(:has([data-rp-widget])) {
47
+ display: none;
48
+ }
49
+
50
+ .ws-shell__column {
51
+ display: flex;
52
+ flex: 1 1 auto;
53
+ flex-direction: column;
54
+ min-width: 0;
55
+ min-height: 0;
56
+ }
57
+ .ws-shell__subsubheader {
58
+ border-bottom: 1px solid var(--border);
59
+ }
60
+ .ws-shell[data-subsubheader='hidden'] .ws-shell__subsubheader,
61
+ .ws-shell__subsubheader:not(:has([data-rp-widget])) {
62
+ display: none;
63
+ }
64
+ .ws-shell__stage {
65
+ display: flex;
66
+ flex: 1 1 auto;
67
+ min-height: 0;
68
+ }
69
+ .ws-shell__main {
70
+ flex: 1 1 auto;
71
+ min-width: 0;
72
+ overflow: auto;
73
+ }
74
+ .ws-shell[data-pad='none'] .ws-shell__content {
75
+ padding: 0;
76
+ }
77
+ .ws-shell[data-pad='sm'] .ws-shell__content {
78
+ padding: 0.75rem;
79
+ }
80
+ .ws-shell[data-pad='md'] .ws-shell__content {
81
+ padding: 1.5rem;
82
+ }
83
+ .ws-shell[data-pad='lg'] .ws-shell__content {
84
+ padding: 2.5rem;
85
+ }
86
+ .ws-shell__footer {
87
+ border-top: 1px solid var(--border);
88
+ }
89
+
90
+ /* Phones: one column; the rail goes, app-sidebar turns itself into a sheet opened from the header. */
91
+ @media (max-width: 767px) {
92
+ .ws-shell__rail {
93
+ display: none;
94
+ }
95
+ }
@@ -0,0 +1,22 @@
1
+ # A list page in portal.mjs
2
+
3
+ A page with React Portal's `app/list-view` widget placed and configured, plus a menu item for it. No component code:
4
+ lists are configured, not written.
5
+
6
+ ## Files
7
+
8
+ - `portal.mjs`: a fragment. Merge its `pages` entry into your portal.mjs `pages`, and its menu item into your
9
+ `primary` menu's `items` (don't add a second `primary` menu).
10
+
11
+ ## What to notice
12
+
13
+ - `c: 'list-view'` is `app/list-view`: React Portal's own components drop the `app/` prefix in portal.mjs.
14
+ - `fixedQuery` is always applied and hidden from the user (here: the visitor's own incidents);
15
+ `query` is the default, user-editable filter. Both are encoded queries.
16
+ - `recordPage: 'record'` opens rows on the portal's record page (see the `portal-record-page` example).
17
+ - `toolbarPlacement: 'header'` puts the search and filters into the shell's header slots.
18
+ - Every placement has a stable `key`; `order` decides the order.
19
+ - The options are described by `components:app/list-view#options`: `lookup_api components:app/list-view`
20
+ (CLI: `rpf api components:app/list-view`).
21
+
22
+ Before relying on a query, check it returns what you expect for the audience (as that user).
@@ -0,0 +1,40 @@
1
+ export default {
2
+ pages: [
3
+ {
4
+ route: 'incidents',
5
+ name: 'My incidents',
6
+ title: 'My incidents',
7
+ order: 200,
8
+ layoutOptions: { subheader: 'bar' },
9
+ widgets: [
10
+ {
11
+ key: 'list',
12
+ c: 'list-view',
13
+ order: 100,
14
+ options: {
15
+ table: 'incident',
16
+ title: 'My incidents',
17
+ fixedQuery: 'caller_id=javascript:gs.getUserID()',
18
+ query: 'active=true',
19
+ columns: 'number,short_description,state,priority,sys_updated_on',
20
+ pageSize: 20,
21
+ pagination: 'pages',
22
+ density: 'normal',
23
+ searchMode: 'keywords',
24
+ toolbarPlacement: 'header',
25
+ recordPage: 'record',
26
+ showSavedFilters: true,
27
+ liveUpdates: true,
28
+ },
29
+ },
30
+ ],
31
+ },
32
+ ],
33
+ menus: [
34
+ {
35
+ key: 'primary',
36
+ name: 'Primary',
37
+ items: [{ page: 'incidents', label: 'My incidents', icon: 'list-checks', order: 200 }],
38
+ },
39
+ ],
40
+ };