@genesislcap/ai-assistant 15.71.0-FUI-2650.1 → 15.71.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.
Files changed (139) hide show
  1. package/dist/ai-assistant.api.json +0 -97
  2. package/dist/ai-assistant.d.ts +0 -65
  3. package/dist/chat-driver.cjs +0 -18031
  4. package/dist/chat-driver.cjs.map +4 -4
  5. package/dist/chat-driver.mjs +0 -18024
  6. package/dist/chat-driver.mjs.map +4 -4
  7. package/dist/custom-elements.json +6856 -9696
  8. package/dist/dts/chat-driver-node.d.ts +0 -2
  9. package/dist/dts/chat-driver-node.d.ts.map +1 -1
  10. package/dist/dts/index.d.ts +0 -1
  11. package/dist/dts/index.d.ts.map +1 -1
  12. package/dist/dts/react.d.ts +0 -10
  13. package/dist/esm/chat-driver-node.js +0 -6
  14. package/dist/esm/index.js +0 -3
  15. package/dist/react.cjs +0 -7
  16. package/dist/react.mjs +0 -6
  17. package/package.json +17 -24
  18. package/scripts/smoke-chat-driver-node.mjs +0 -15
  19. package/dist/dts/code-review/code-review.types.d.ts +0 -76
  20. package/dist/dts/code-review/code-review.types.d.ts.map +0 -1
  21. package/dist/dts/code-review/code-reviewer.agent.d.ts +0 -77
  22. package/dist/dts/code-review/code-reviewer.agent.d.ts.map +0 -1
  23. package/dist/dts/code-review/code-reviewer.prompt.d.ts +0 -23
  24. package/dist/dts/code-review/code-reviewer.prompt.d.ts.map +0 -1
  25. package/dist/dts/code-review/gate.d.ts +0 -44
  26. package/dist/dts/code-review/gate.d.ts.map +0 -1
  27. package/dist/dts/code-review/index.d.ts +0 -27
  28. package/dist/dts/code-review/index.d.ts.map +0 -1
  29. package/dist/dts/code-review/review-changes.d.ts +0 -70
  30. package/dist/dts/code-review/review-changes.d.ts.map +0 -1
  31. package/dist/dts/code-review/rules/context-trigger-map.d.ts +0 -6
  32. package/dist/dts/code-review/rules/context-trigger-map.d.ts.map +0 -1
  33. package/dist/dts/code-review/rules/context.registry.d.ts +0 -123
  34. package/dist/dts/code-review/rules/context.registry.d.ts.map +0 -1
  35. package/dist/dts/code-review/rules/fui-ai-extensions.d.ts +0 -13
  36. package/dist/dts/code-review/rules/fui-ai-extensions.d.ts.map +0 -1
  37. package/dist/dts/code-review/rules/fui-blotter.d.ts +0 -16
  38. package/dist/dts/code-review/rules/fui-blotter.d.ts.map +0 -1
  39. package/dist/dts/code-review/rules/fui-chart.d.ts +0 -20
  40. package/dist/dts/code-review/rules/fui-chart.d.ts.map +0 -1
  41. package/dist/dts/code-review/rules/fui-column-defs.d.ts +0 -21
  42. package/dist/dts/code-review/rules/fui-column-defs.d.ts.map +0 -1
  43. package/dist/dts/code-review/rules/fui-components.d.ts +0 -9
  44. package/dist/dts/code-review/rules/fui-components.d.ts.map +0 -1
  45. package/dist/dts/code-review/rules/fui-criteria.d.ts +0 -32
  46. package/dist/dts/code-review/rules/fui-criteria.d.ts.map +0 -1
  47. package/dist/dts/code-review/rules/fui-custom-renderer.d.ts +0 -15
  48. package/dist/dts/code-review/rules/fui-custom-renderer.d.ts.map +0 -1
  49. package/dist/dts/code-review/rules/fui-dashboard.d.ts +0 -19
  50. package/dist/dts/code-review/rules/fui-dashboard.d.ts.map +0 -1
  51. package/dist/dts/code-review/rules/fui-dialogs.d.ts +0 -19
  52. package/dist/dts/code-review/rules/fui-dialogs.d.ts.map +0 -1
  53. package/dist/dts/code-review/rules/fui-entity-management.d.ts +0 -19
  54. package/dist/dts/code-review/rules/fui-entity-management.d.ts.map +0 -1
  55. package/dist/dts/code-review/rules/fui-error-boundary.d.ts +0 -9
  56. package/dist/dts/code-review/rules/fui-error-boundary.d.ts.map +0 -1
  57. package/dist/dts/code-review/rules/fui-eventing.d.ts +0 -8
  58. package/dist/dts/code-review/rules/fui-eventing.d.ts.map +0 -1
  59. package/dist/dts/code-review/rules/fui-flexlayout.d.ts +0 -17
  60. package/dist/dts/code-review/rules/fui-flexlayout.d.ts.map +0 -1
  61. package/dist/dts/code-review/rules/fui-flyout-panel.d.ts +0 -10
  62. package/dist/dts/code-review/rules/fui-flyout-panel.d.ts.map +0 -1
  63. package/dist/dts/code-review/rules/fui-form-component.d.ts +0 -9
  64. package/dist/dts/code-review/rules/fui-form-component.d.ts.map +0 -1
  65. package/dist/dts/code-review/rules/fui-formatters.d.ts +0 -12
  66. package/dist/dts/code-review/rules/fui-formatters.d.ts.map +0 -1
  67. package/dist/dts/code-review/rules/fui-foundation-comms.d.ts +0 -10
  68. package/dist/dts/code-review/rules/fui-foundation-comms.d.ts.map +0 -1
  69. package/dist/dts/code-review/rules/fui-global-filters.d.ts +0 -33
  70. package/dist/dts/code-review/rules/fui-global-filters.d.ts.map +0 -1
  71. package/dist/dts/code-review/rules/fui-import-surface.d.ts +0 -37
  72. package/dist/dts/code-review/rules/fui-import-surface.d.ts.map +0 -1
  73. package/dist/dts/code-review/rules/fui-inline-editing.d.ts +0 -10
  74. package/dist/dts/code-review/rules/fui-inline-editing.d.ts.map +0 -1
  75. package/dist/dts/code-review/rules/fui-layout.d.ts +0 -7
  76. package/dist/dts/code-review/rules/fui-layout.d.ts.map +0 -1
  77. package/dist/dts/code-review/rules/fui-notifications.d.ts +0 -12
  78. package/dist/dts/code-review/rules/fui-notifications.d.ts.map +0 -1
  79. package/dist/dts/code-review/rules/fui-primitives.d.ts +0 -26
  80. package/dist/dts/code-review/rules/fui-primitives.d.ts.map +0 -1
  81. package/dist/dts/code-review/rules/fui-rapid-grid-pro.d.ts +0 -18
  82. package/dist/dts/code-review/rules/fui-rapid-grid-pro.d.ts.map +0 -1
  83. package/dist/dts/code-review/rules/fui-redux-store.d.ts +0 -8
  84. package/dist/dts/code-review/rules/fui-redux-store.d.ts.map +0 -1
  85. package/dist/dts/code-review/rules/fui-reporting.d.ts +0 -19
  86. package/dist/dts/code-review/rules/fui-reporting.d.ts.map +0 -1
  87. package/dist/dts/code-review/rules/fui-styling.d.ts +0 -15
  88. package/dist/dts/code-review/rules/fui-styling.d.ts.map +0 -1
  89. package/dist/dts/code-review/rules/fui-trade-form.d.ts +0 -13
  90. package/dist/dts/code-review/rules/fui-trade-form.d.ts.map +0 -1
  91. package/dist/dts/code-review/submit-code-review.tool.d.ts +0 -12
  92. package/dist/dts/code-review/submit-code-review.tool.d.ts.map +0 -1
  93. package/dist/dts/code-review/unified-diff.d.ts +0 -7
  94. package/dist/dts/code-review/unified-diff.d.ts.map +0 -1
  95. package/dist/dts/code-review/verdict.d.ts +0 -23
  96. package/dist/dts/code-review/verdict.d.ts.map +0 -1
  97. package/dist/dts/components/code-review-result/code-review-result.d.ts +0 -26
  98. package/dist/dts/components/code-review-result/code-review-result.d.ts.map +0 -1
  99. package/dist/esm/code-review/code-review.types.js +0 -6
  100. package/dist/esm/code-review/code-reviewer.agent.js +0 -167
  101. package/dist/esm/code-review/code-reviewer.prompt.js +0 -103
  102. package/dist/esm/code-review/gate.js +0 -93
  103. package/dist/esm/code-review/index.js +0 -28
  104. package/dist/esm/code-review/review-changes.js +0 -123
  105. package/dist/esm/code-review/rules/context-trigger-map.js +0 -20
  106. package/dist/esm/code-review/rules/context.registry.js +0 -772
  107. package/dist/esm/code-review/rules/fui-ai-extensions.js +0 -306
  108. package/dist/esm/code-review/rules/fui-blotter.js +0 -596
  109. package/dist/esm/code-review/rules/fui-chart.js +0 -669
  110. package/dist/esm/code-review/rules/fui-column-defs.js +0 -862
  111. package/dist/esm/code-review/rules/fui-components.js +0 -245
  112. package/dist/esm/code-review/rules/fui-criteria.js +0 -538
  113. package/dist/esm/code-review/rules/fui-custom-renderer.js +0 -612
  114. package/dist/esm/code-review/rules/fui-dashboard.js +0 -604
  115. package/dist/esm/code-review/rules/fui-dialogs.js +0 -588
  116. package/dist/esm/code-review/rules/fui-entity-management.js +0 -1014
  117. package/dist/esm/code-review/rules/fui-error-boundary.js +0 -244
  118. package/dist/esm/code-review/rules/fui-eventing.js +0 -628
  119. package/dist/esm/code-review/rules/fui-flexlayout.js +0 -860
  120. package/dist/esm/code-review/rules/fui-flyout-panel.js +0 -432
  121. package/dist/esm/code-review/rules/fui-form-component.js +0 -898
  122. package/dist/esm/code-review/rules/fui-formatters.js +0 -415
  123. package/dist/esm/code-review/rules/fui-foundation-comms.js +0 -518
  124. package/dist/esm/code-review/rules/fui-global-filters.js +0 -778
  125. package/dist/esm/code-review/rules/fui-import-surface.js +0 -452
  126. package/dist/esm/code-review/rules/fui-inline-editing.js +0 -445
  127. package/dist/esm/code-review/rules/fui-layout.js +0 -431
  128. package/dist/esm/code-review/rules/fui-notifications.js +0 -439
  129. package/dist/esm/code-review/rules/fui-primitives.js +0 -1216
  130. package/dist/esm/code-review/rules/fui-rapid-grid-pro.js +0 -650
  131. package/dist/esm/code-review/rules/fui-redux-store.js +0 -522
  132. package/dist/esm/code-review/rules/fui-reporting.js +0 -506
  133. package/dist/esm/code-review/rules/fui-styling.js +0 -1229
  134. package/dist/esm/code-review/rules/fui-trade-form.js +0 -618
  135. package/dist/esm/code-review/submit-code-review.tool.js +0 -43
  136. package/dist/esm/code-review/unified-diff.js +0 -96
  137. package/dist/esm/code-review/verdict.js +0 -24
  138. package/dist/esm/components/code-review-result/code-review-result.js +0 -89
  139. package/docs/code-review.md +0 -137
@@ -1,431 +0,0 @@
1
- /**
2
- * Context injected into the UI Builder system prompt.
3
- * Covers flexlayout-react patterns for generated React routes.
4
- */
5
- export const FUI_LAYOUT_TAGS = [
6
- 'flexlayout',
7
- 'IJsonModel',
8
- 'componentMap',
9
- 'factory',
10
- 'tabset',
11
- 'FlexLayout',
12
- 'defaultLayout',
13
- 'TabNode',
14
- 'Model',
15
- 'Layout',
16
- 'flexlayout-react',
17
- 'panel',
18
- 'tile layout',
19
- 'multi-panel',
20
- 'resizable',
21
- 'draggable panel',
22
- ];
23
- export const FUI_LAYOUT_CONTEXT = `
24
- ## GENESIS LAYOUT — flexlayout-react (React routes only)
25
-
26
- Genx-generated React routes use **flexlayout-react** for resizable, draggable panel layouts.
27
- Angular and Web Component apps still use \`rapid-layout\` / \`foundation-layout\` — this section applies only when \`framework === UIFrameworks.REACT\`.
28
-
29
- **Why flexlayout-react?** The previous golden-layout shell physically detached FAST Web Components from the DOM on panel move, triggering full WC lifecycle teardowns and connection drops. flexlayout-react never moves DOM nodes — components stay mounted and connected.
30
-
31
- ---
32
-
33
- ### Full generated route pattern
34
-
35
- \`\`\`tsx
36
- import React, { useRef } from 'react';
37
- import { Layout, Model, TabNode } from 'flexlayout-react';
38
- import { getFlexLayoutStorageKey } from '../../utils/layout';
39
- import { TradesGrid } from './TradesGrid';
40
- import { PositionsGrid } from './PositionsGrid';
41
- import './HomePro.css';
42
-
43
- const STORAGE_KEY = getFlexLayoutStorageKey('home-pro-layout-key');
44
-
45
- const defaultLayout = {
46
- global: { tabEnableClose: false },
47
- layout: {
48
- type: 'row',
49
- children: [
50
- { type: 'tabset', children: [{ type: 'tab', name: 'Trades', component: 'tradesGrid' }] },
51
- { type: 'tabset', children: [{ type: 'tab', name: 'Positions', component: 'positionsGrid' }] },
52
- ],
53
- },
54
- };
55
-
56
- const componentMap: Record<string, React.FC> = {
57
- tradesGrid: TradesGrid,
58
- positionsGrid: PositionsGrid,
59
- };
60
-
61
- function loadModel(): Model {
62
- if (STORAGE_KEY) {
63
- const saved = localStorage.getItem(STORAGE_KEY);
64
- if (saved) {
65
- try { return Model.fromJson(JSON.parse(saved)); } catch {}
66
- }
67
- }
68
- return Model.fromJson(defaultLayout);
69
- }
70
-
71
- const HomeProPage: React.FC = () => {
72
- const modelRef = useRef<Model>(loadModel());
73
-
74
- const factory = (node: TabNode) => {
75
- const Component = componentMap[node.getComponent() ?? ''];
76
- return Component ? <Component /> : null;
77
- };
78
-
79
- const onModelChange = (model: Model) => {
80
- if (STORAGE_KEY) {
81
- localStorage.setItem(STORAGE_KEY, JSON.stringify(model.toJson()));
82
- }
83
- };
84
-
85
- return (
86
- <section className="home-pro-page">
87
- <Layout model={modelRef.current} factory={factory} onModelChange={onModelChange} />
88
- </section>
89
- );
90
- };
91
-
92
- export default HomeProPage;
93
- \`\`\`
94
-
95
- ---
96
-
97
- ### Layout JSON shapes (three variants)
98
-
99
- **horizontal-layout** (Auto with < 4 tiles, or explicit "Horizontal"):
100
- \`\`\`ts
101
- const defaultLayout = {
102
- global: { tabEnableClose: false, tabEnableRenderOnDemand: false },
103
- layout: {
104
- type: 'row',
105
- children: [
106
- { type: 'tabset', children: [{ type: 'tab', name: 'Tile A', component: 'tileA' }] },
107
- { type: 'tabset', children: [{ type: 'tab', name: 'Tile B', component: 'tileB' }] },
108
- ],
109
- },
110
- };
111
- \`\`\`
112
-
113
- **grid-layout** (Auto with exactly 4 tiles, or explicit "Grid 2x2"):
114
- \`\`\`ts
115
- const defaultLayout = {
116
- global: { tabEnableClose: false, tabEnableRenderOnDemand: false },
117
- layout: {
118
- type: 'row',
119
- children: [
120
- {
121
- type: 'row', weight: 50, // LEFT column (nested row = vertical)
122
- children: [
123
- { type: 'tabset', weight: 50, children: [{ type: 'tab', name: 'Tile A', component: 'tileA' }] },
124
- { type: 'tabset', weight: 50, children: [{ type: 'tab', name: 'Tile C', component: 'tileC' }] },
125
- ],
126
- },
127
- {
128
- type: 'row', weight: 50, // RIGHT column
129
- children: [
130
- { type: 'tabset', weight: 50, children: [{ type: 'tab', name: 'Tile B', component: 'tileB' }] },
131
- { type: 'tabset', weight: 50, children: [{ type: 'tab', name: 'Tile D', component: 'tileD' }] },
132
- ],
133
- },
134
- ],
135
- },
136
- };
137
- // Tile order (per gridLayout.hbs): tiles[0] top-left, tiles[2] bottom-left,
138
- // tiles[1] top-right, tiles[3] bottom-right — each nested row is a COLUMN.
139
- \`\`\`
140
-
141
- **tabs-layout** (Auto with > 4 tiles, or explicit "Tabs"):
142
- \`\`\`ts
143
- const defaultLayout = {
144
- global: { tabEnableClose: false, tabEnableRenderOnDemand: false },
145
- layout: {
146
- type: 'row',
147
- children: [
148
- {
149
- type: 'tabset', weight: 100,
150
- children: [
151
- { type: 'tab', name: 'Tile A', component: 'tileA' },
152
- { type: 'tab', name: 'Tile B', component: 'tileB' },
153
- { type: 'tab', name: 'Tile C', component: 'tileC' },
154
- ],
155
- },
156
- ],
157
- },
158
- };
159
- \`\`\`
160
-
161
- \`global: { tabEnableClose: false, tabEnableRenderOnDemand: false }\` is always set — hides close
162
- buttons and keeps every tile mounted (datasources stay subscribed on tab switch).
163
-
164
- ---
165
-
166
- ### Component naming in the model
167
-
168
- \`\`\`
169
- JSON model "component" field = camelCase(componentName)
170
- componentMap key = camelCase(componentName)
171
- React component / export = PascalCase(componentName)
172
-
173
- componentName = "{routeName}-{tileTitle_alphanumeric_only}-{componentType}"
174
- \`\`\`
175
-
176
- ---
177
-
178
- ### CSS height
179
-
180
- **Route with FlexLayout only** (no page-shell content above/below):
181
- \`\`\`css
182
- .home-pro-page {
183
- height: calc(100vh - 48px); /* 48px = fixed header bar */
184
- position: relative; /* required for FlexLayout internals */
185
- }
186
- \`\`\`
187
-
188
- **Route with page-shell content above or below the layout** (e.g. a summary strip, KPI cards, a banner): FlexLayout fills its parent using \`position: absolute\`. If you render sibling elements alongside \`<Layout>\` inside the same container, they will be covered. The fix is to make the section a flex column and wrap \`<Layout>\` in a div that takes the remaining height:
189
-
190
- \`\`\`css
191
- /* {RouteName}.css */
192
- .home-pro-page {
193
- display: flex;
194
- flex-direction: column;
195
- height: calc(100vh - 48px);
196
- }
197
-
198
- .home-pro-layout-container {
199
- flex: 1;
200
- position: relative; /* required for FlexLayout internals */
201
- min-height: 0; /* critical — allows flex child to shrink below intrinsic size */
202
- }
203
- \`\`\`
204
-
205
- **If any page-shell element holds a \`Select\` / \`DatePicker\` / \`Multiselect\`**, it needs
206
- \`position: relative; z-index: 200\` — those components render their popups inside shadow DOM, so the
207
- popup cannot escape its container and the \`position: relative\` on the layout container above would
208
- otherwise make the FlexLayout tiles paint over it. Give the popup-holding row that z-index and give
209
- every other shell element (KPI strips, banners, the layout container) **none**, and never
210
- \`position: sticky\` — nothing scrolls in this shell, and sticky silently creates a stacking context
211
- that traps the popup. Full model in \`fui-styling\` → LAYERING.
212
-
213
- \`\`\`tsx
214
- return (
215
- <section className="home-pro-page">
216
- <SummaryCards /> {/* page-shell element — takes its natural height */}
217
- <div className="home-pro-layout-container">
218
- <Layout model={modelRef.current} factory={factory} onModelChange={onModelChange} />
219
- </div>
220
- </section>
221
- );
222
- \`\`\`
223
-
224
- **Always apply this wrapper pattern** when adding any page-shell content next to \`<Layout>\`. Without \`min-height: 0\` on the wrapper div, the flex child will not shrink and the layout will overflow the page.
225
-
226
- FlexLayout sizes each tab PANE, but content inside the pane does NOT auto-stretch: a tile whose
227
- root is a grid/chart needs \`height: '100%'\`. For a button above an \`<EntityManagement>\` grid, do
228
- NOT stack a hand-rolled toolbar div in the tile's JSX — pass \`customActions\` with
229
- \`position: CrudMenuPosition.Top\` instead; EntityManagement renders that toolbar itself, so the tile
230
- stays a single \`height: '100%'\` root. The flex-column + \`minHeight: 0\` chain (see the "Tile sizing"
231
- section of \`fui-flexlayout\`) applies only to a genuine non-action strip, or to a hand-built
232
- RapidGridPro grid with no native toolbar slot.
233
-
234
- ---
235
-
236
- ### Storage key
237
-
238
- \`\`\`ts
239
- const STORAGE_KEY = getFlexLayoutStorageKey('unique-layout-key');
240
- // Returns null in dev (unless PERSIST_LAYOUT_IN_DEV=true), 'flexlayout_{key}' in prod
241
- \`\`\`
242
-
243
- The \`id\` is the route's \`layoutKey\` — generated at route creation time. **BUMP the key (add/increment
244
- a version suffix) whenever you change \`defaultLayout\`** — otherwise a saved layout in localStorage
245
- shadows the new default and the change never appears (see fui-flexlayout DP-8). Do NOT use the old
246
- \`persistLayout()\` — that helper was removed.
247
-
248
- ---
249
-
250
- ### Tile component datasource config
251
-
252
- \`DatasourceConfiguration\` from \`@genesislcap/foundation-entity-management\` replaces the old \`useEffect\` + DOM traversal:
253
-
254
- \`\`\`tsx
255
- import { DatasourceConfiguration } from '@genesislcap/foundation-entity-management';
256
-
257
- const datasourceConfig: DatasourceConfiguration = {
258
- isSnapshot: true,
259
- pollingInterval: 5000, // number, not string '5000'
260
- requestAutoSetup: false, // boolean, not string 'false'
261
- criteria: useSelector(selectors.eventing.getCriteriaForMyTile),
262
- };
263
-
264
- // EntityManagement: pass as a direct prop
265
- <EntityManagement datasourceConfig={datasourceConfig} ... />
266
-
267
- // GridProGenesisDatasource: spread fields directly onto the datasource child
268
- <GridProGenesisDatasource
269
- criteria={datasourceConfig.criteria}
270
- requestAutoSetup={datasourceConfig.requestAutoSetup}
271
- pollingInterval={datasourceConfig.pollingInterval}
272
- />
273
- \`\`\`
274
-
275
- Entity manager row-selection event uses \`e.detail.api\`; grid-pro uses \`e.api\`:
276
- \`\`\`tsx
277
- // entity-manager onSelectionChanged
278
- const handleRowSelection = (e: any) => {
279
- const selectedRows = e.detail.api.getSelectedRows();
280
- };
281
-
282
- // grid-pro onSelectionChanged
283
- const handleRowSelection = (e: any) => {
284
- const selectedRows = e.api.getSelectedRows();
285
- };
286
- \`\`\`
287
-
288
- ---
289
-
290
- ### KEY RULES
291
- - Always inspect the route before editing a route page (query_project_schema('routes'), then read its generated source with read_source/vfs_read) — you must preserve ALL tiles.
292
- - Every tile in the route's config/source must be present in both \`componentMap\` and the \`defaultLayout\` children.
293
- - When adding a new tile: add its import, add it to \`componentMap\`, add its tabset/tab node to \`defaultLayout\`.
294
- - Do NOT emit \`rapid-layout\`, \`rapid-layout-region\`, \`rapid-layout-item\`, \`setComponentItemsMap\`, \`persistLayout()\`, \`layoutComponentsMap\`, or \`LayoutComponentNames\` — all removed from the React template.
295
- - Tile sizing follows the fui-flexlayout height-chain rules (grid/chart tile roots \`height: '100%'\`). For a button above an EntityManagement grid use \`customActions\` with \`position: CrudMenuPosition.Top\` — do NOT hand-roll a toolbar div; the flex-column/\`minHeight: 0\` chain applies only to a non-action strip or a hand-built grid.
296
- - This pattern is React only — Angular/WC routes still use \`foundation-layout\`/\`rapid-layout\`.
297
-
298
- ---
299
-
300
- ### CSS theme — platform-owned, nothing to import
301
-
302
- The flexlayout theme is installed ONCE at bootstrap by \`main.tsx\` via
303
- \`installRapidFlexLayoutReactStyles()\` from \`@genesislcap/rapid-design-system\`.
304
- NEVER \`import 'flexlayout-react/style/*.css'\` in pages — it double-themes the layout
305
- (see fui-flexlayout DP-9).
306
-
307
- ### Mounted-tabs rule
308
-
309
- flexlayout-react keeps ALL tab components mounted even when their tab is not visible (unless \`tabEnableRenderOnDemand: false\`). Implications:
310
- - Subscriptions and streams in tile components **continue running** even when the tab is hidden
311
- - State is preserved across tab switches (no remount)
312
- - Never put heavy one-time initialization in the component body that assumes single-mount behaviour
313
-
314
- ### Correct factory pattern — TileErrorBoundary in the factory
315
-
316
- The factory function is the single point of wrapping. Do NOT add \`TileErrorBoundary\` inside componentMap registrations.
317
-
318
- \`\`\`tsx
319
- import React, { useRef } from 'react';
320
- import { Layout, Model, TabNode, IJsonModel } from 'flexlayout-react';
321
- import { TileErrorBoundary } from '../../components/error-boundary/ErrorBoundary';
322
- import { getFlexLayoutStorageKey } from '../../utils/layout';
323
- import { TileOne } from './TileOne';
324
- import { TileTwo } from './TileTwo';
325
-
326
- const componentMap: Record<string, React.FC> = {
327
- tileOne: TileOne,
328
- tileTwo: TileTwo,
329
- };
330
-
331
- const STORAGE_KEY = getFlexLayoutStorageKey('home_v1'); // bump suffix when defaultLayout changes
332
-
333
- const defaultLayout: IJsonModel = {
334
- global: { tabEnableClose: false, tabEnableRenderOnDemand: false },
335
- layout: {
336
- type: 'row',
337
- weight: 100,
338
- children: [
339
- { type: 'tabset', weight: 50, children: [{ type: 'tab', name: 'Tile One', component: 'tileOne' }] },
340
- { type: 'tabset', weight: 50, children: [{ type: 'tab', name: 'Tile Two', component: 'tileTwo' }] },
341
- ],
342
- },
343
- };
344
-
345
- function loadModel(): Model {
346
- if (STORAGE_KEY) {
347
- const saved = localStorage.getItem(STORAGE_KEY);
348
- if (saved) {
349
- try { return Model.fromJson(JSON.parse(saved)); } catch {}
350
- }
351
- }
352
- return Model.fromJson(defaultLayout);
353
- }
354
-
355
- export default function Home() {
356
- const modelRef = useRef<Model>(loadModel()); // ref, NOT useState — flexlayout re-renders internally
357
-
358
- const factory = (node: TabNode) => {
359
- const TileComponent = componentMap[node.getComponent() ?? ''];
360
- if (!TileComponent) return null;
361
- return (
362
- <TileErrorBoundary title={node.getName() ?? node.getComponent() ?? ''} tileRegistration={node.getComponent() ?? ''}>
363
- <TileComponent />
364
- </TileErrorBoundary>
365
- );
366
- };
367
-
368
- const onModelChange = (model: Model) => {
369
- if (STORAGE_KEY) localStorage.setItem(STORAGE_KEY, JSON.stringify(model.toJson()));
370
- };
371
-
372
- return (
373
- <div style={{ position: 'relative', height: 'calc(100vh - 48px)' }}>
374
- <Layout model={modelRef.current} factory={factory} onModelChange={onModelChange} />
375
- </div>
376
- );
377
- }
378
- \`\`\`
379
-
380
- ---
381
-
382
- ### DANGEROUS PATTERNS
383
-
384
- #### DP-1: \`tab\` directly in \`row\` (not wrapped in \`tabset\`)
385
-
386
- \`\`\`ts
387
- // WRONG — a tab must always be inside a tabset:
388
- { type: 'row', children: [{ type: 'tab', name: 'Foo', component: 'Foo' }] }
389
-
390
- // CORRECT:
391
- { type: 'row', children: [{ type: 'tabset', children: [{ type: 'tab', name: 'Foo', component: 'Foo' }] }] }
392
- \`\`\`
393
-
394
- #### DP-2: Importing a flexlayout stylesheet in a page
395
-
396
- \`\`\`ts
397
- // WRONG — the platform theme is already installed app-wide; this double-themes the layout:
398
- import { Layout, Model } from 'flexlayout-react';
399
- import 'flexlayout-react/style/dark.css';
400
-
401
- // CORRECT — no stylesheet import needed; main.tsx already calls
402
- // installRapidFlexLayoutReactStyles() from '@genesislcap/rapid-design-system':
403
- import { Layout, Model } from 'flexlayout-react';
404
- \`\`\`
405
-
406
- #### DP-3: TileErrorBoundary inside componentMap (double-wrapping)
407
-
408
- \`\`\`tsx
409
- // WRONG — factory already wraps; this creates a double boundary:
410
- const componentMap = {
411
- MyTile: () => <TileErrorBoundary><MyTileInner /></TileErrorBoundary>,
412
- };
413
-
414
- // CORRECT — wrap ONLY in factory:
415
- const componentMap = { MyTile: MyTile };
416
- // factory: return <TileErrorBoundary><TileComponent /></TileErrorBoundary>
417
- \`\`\`
418
-
419
- #### DP-4: No explicit height on Layout container
420
-
421
- \`\`\`tsx
422
- // WRONG — renders with zero height, tiles invisible:
423
- <Layout model={model} factory={factory} />
424
-
425
- // CORRECT:
426
- <div style={{ position: 'relative', height: 'calc(100vh - 48px)' }}>
427
- <Layout model={model} factory={factory} onModelChange={onModelChange} />
428
- </div>
429
- \`\`\`
430
-
431
- `.trim();