@object-ui/app-shell 6.2.0 → 6.2.2

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 (50) hide show
  1. package/CHANGELOG.md +61 -0
  2. package/dist/console/AppContent.js +30 -1
  3. package/dist/console/ai/AiChatPage.js +19 -22
  4. package/dist/layout/ConsoleFloatingChatbot.js +44 -24
  5. package/dist/services/builtinComponents.js +10 -7
  6. package/dist/views/metadata-admin/DesignerEditorWrapper.d.ts +11 -1
  7. package/dist/views/metadata-admin/DesignerEditorWrapper.js +21 -3
  8. package/dist/views/metadata-admin/DirectoryPage.js +1 -1
  9. package/dist/views/metadata-admin/EmbeddedItemEditor.d.ts +15 -0
  10. package/dist/views/metadata-admin/EmbeddedItemEditor.js +194 -0
  11. package/dist/views/metadata-admin/MetadataDetailDrawer.d.ts +13 -0
  12. package/dist/views/metadata-admin/MetadataDetailDrawer.js +28 -0
  13. package/dist/views/metadata-admin/PageShell.js +9 -2
  14. package/dist/views/metadata-admin/QuickFind.js +2 -2
  15. package/dist/views/metadata-admin/RelatedPanel.d.ts +37 -0
  16. package/dist/views/metadata-admin/RelatedPanel.js +173 -0
  17. package/dist/views/metadata-admin/ResourceEditPage.d.ts +9 -3
  18. package/dist/views/metadata-admin/ResourceEditPage.js +105 -14
  19. package/dist/views/metadata-admin/ResourceHistoryPage.d.ts +3 -3
  20. package/dist/views/metadata-admin/ResourceHistoryPage.js +6 -3
  21. package/dist/views/metadata-admin/ResourceListPage.d.ts +2 -2
  22. package/dist/views/metadata-admin/ResourceListPage.js +6 -4
  23. package/dist/views/metadata-admin/SchemaForm.js +10 -1
  24. package/dist/views/metadata-admin/anchors.d.ts +1 -0
  25. package/dist/views/metadata-admin/anchors.js +235 -0
  26. package/dist/views/metadata-admin/index.d.ts +7 -3
  27. package/dist/views/metadata-admin/index.js +14 -2
  28. package/dist/views/metadata-admin/preview-registry.d.ts +43 -0
  29. package/dist/views/metadata-admin/preview-registry.js +18 -0
  30. package/dist/views/metadata-admin/previews/AppPreview.d.ts +2 -0
  31. package/dist/views/metadata-admin/previews/AppPreview.js +101 -0
  32. package/dist/views/metadata-admin/previews/DashboardPreview.d.ts +2 -0
  33. package/dist/views/metadata-admin/previews/DashboardPreview.js +25 -0
  34. package/dist/views/metadata-admin/previews/EmailTemplatePreview.d.ts +2 -0
  35. package/dist/views/metadata-admin/previews/EmailTemplatePreview.js +65 -0
  36. package/dist/views/metadata-admin/previews/ObjectPreview.d.ts +2 -0
  37. package/dist/views/metadata-admin/previews/ObjectPreview.js +36 -0
  38. package/dist/views/metadata-admin/previews/PagePreview.d.ts +2 -0
  39. package/dist/views/metadata-admin/previews/PagePreview.js +26 -0
  40. package/dist/views/metadata-admin/previews/PreviewShell.d.ts +40 -0
  41. package/dist/views/metadata-admin/previews/PreviewShell.js +49 -0
  42. package/dist/views/metadata-admin/previews/ReportPreview.d.ts +2 -0
  43. package/dist/views/metadata-admin/previews/ReportPreview.js +27 -0
  44. package/dist/views/metadata-admin/previews/ViewPreview.d.ts +2 -0
  45. package/dist/views/metadata-admin/previews/ViewPreview.js +113 -0
  46. package/dist/views/metadata-admin/previews/index.d.ts +1 -0
  47. package/dist/views/metadata-admin/previews/index.js +26 -0
  48. package/dist/views/metadata-admin/registry.d.ts +124 -0
  49. package/dist/views/metadata-admin/registry.js +58 -0
  50. package/package.json +26 -26
@@ -64,11 +64,32 @@ export interface MetadataResourceConfig {
64
64
  }>;
65
65
  /**
66
66
  * Fully custom edit page. Receives `{ type, name }`.
67
+ *
68
+ * Use this when the bespoke editor replaces the JSONSchema form entirely
69
+ * (e.g. PermissionMatrix grid). For visual designers that should coexist
70
+ * with the generic Form/Layers/References tabs, prefer `DesignerTab`.
67
71
  */
68
72
  EditPage?: ComponentType<{
69
73
  type: string;
70
74
  name: string;
71
75
  }>;
76
+ /**
77
+ * Optional visual designer that renders inside its own dedicated tab on
78
+ * the generic edit page, alongside Form / Layers / References. Receives
79
+ * `{ type, name }` and should render without an outer `PageShell` — the
80
+ * generic engine owns the chrome.
81
+ *
82
+ * When both `EditPage` and `DesignerTab` are provided, `EditPage` wins
83
+ * (full takeover); the tab variant is only used when `EditPage` is unset.
84
+ */
85
+ DesignerTab?: ComponentType<{
86
+ type: string;
87
+ name: string;
88
+ }>;
89
+ /**
90
+ * Optional label for the Designer tab. Defaults to "Designer".
91
+ */
92
+ designerTabLabel?: string;
72
93
  /**
73
94
  * Fully custom create page. Receives `{ type }`.
74
95
  */
@@ -96,7 +117,97 @@ export interface MetadataResourceConfig {
96
117
  * If the server registry DOES return a `schema`, this is ignored.
97
118
  */
98
119
  defaultSchema?: Record<string, unknown>;
120
+ /**
121
+ * Declares that items of this type are "anchored" to one or more
122
+ * parent metadata types. The Related tab on the parent's edit page
123
+ * lists every item that matches the anchor predicate.
124
+ *
125
+ * For example, registering `hook` with
126
+ * `{ anchorType: 'object', match: (item, name) => item.object === name }`
127
+ * makes every `hook` whose `object` field equals `account` show up in
128
+ * the Account object's Related tab under a "Hooks" group.
129
+ *
130
+ * Multiple anchors are allowed (e.g. a field could anchor to both
131
+ * `object` and `view`). The Related panel groups by anchored type.
132
+ */
133
+ anchors?: MetadataAnchor[];
134
+ }
135
+ /**
136
+ * Anchor declaration — "items of type X are children of items of type Y
137
+ * when this predicate matches". Used to power the Related tab.
138
+ *
139
+ * The predicate runs in the client against the unwrapped item shape
140
+ * returned by `client.list(type)`. Keep it cheap (just property reads);
141
+ * we evaluate it once per item per render.
142
+ */
143
+ export interface MetadataAnchor {
144
+ /** The parent metadata type whose Related tab should surface this. */
145
+ anchorType: string;
146
+ /**
147
+ * Where the anchored items live.
148
+ * - 'list' (default): query `client.list(childType)` and filter with
149
+ * `match()`. Used for first-class metadata types (hooks, views, …).
150
+ * - 'embedded': items are stored inside the parent body itself
151
+ * (e.g. `object.fields[]`). `extract()` plucks the array; no
152
+ * network call is made.
153
+ */
154
+ source?: 'list' | 'embedded';
155
+ /**
156
+ * Returns true when the child `item` belongs to the parent identified
157
+ * by `anchorName`. The default helper `byField('object')` covers the
158
+ * common case of an explicit `object: 'foo'` reference. Required when
159
+ * `source === 'list'` (the default); ignored for `'embedded'`.
160
+ */
161
+ match?: (item: Record<string, unknown>, anchorName: string) => boolean;
162
+ /**
163
+ * For `source: 'embedded'` only. Returns the embedded items array
164
+ * given the fully-loaded parent body. Items should already carry a
165
+ * `name` (or be normalised by the renderer).
166
+ */
167
+ extract?: (parentItem: Record<string, unknown>) => Array<Record<string, unknown>>;
168
+ /**
169
+ * Optional override for the group label shown on the Related panel.
170
+ * Defaults to the child type's resolved label.
171
+ */
172
+ groupLabel?: string;
173
+ /**
174
+ * Optional icon override for the group header. Falls back to the
175
+ * child type's registered icon.
176
+ */
177
+ iconName?: string;
178
+ /**
179
+ * Optional explicit ordering hint inside the Related panel. Lower
180
+ * numbers float to the top. Defaults to 100 if unset.
181
+ */
182
+ order?: number;
183
+ /**
184
+ * For `source: 'embedded'` only. The metadata type whose schema /
185
+ * form should drive the embedded item's editor. Defaults to the
186
+ * synthetic `type` from the registration when omitted (which will
187
+ * fall back to JSON view).
188
+ *
189
+ * Example: object.fields → `editAs: 'field'` so the embedded editor
190
+ * pulls `field`'s schema + form from `/meta/types`.
191
+ */
192
+ editAs?: string;
193
+ /**
194
+ * For `source: 'embedded'` only. Dotted path inside the parent body
195
+ * where the collection lives (e.g. `fields`, `validations`). Used by
196
+ * the embedded editor to write the modified item back into the
197
+ * parent on save.
198
+ */
199
+ embeddedPath?: string;
99
200
  }
201
+ /**
202
+ * Helper that returns a `match` reading a (possibly dotted) field path
203
+ * from the item and comparing it to the anchor name.
204
+ *
205
+ * anchorByField('object') // item.object === name
206
+ * anchorByField('data.object') // item.data?.object === name
207
+ * anchorByField(['list.data.object',
208
+ * 'form.data.object']) // either path matches
209
+ */
210
+ export declare function anchorByField(paths: string | string[]): MetadataAnchor['match'];
100
211
  /**
101
212
  * Register (or merge) an entry. Idempotent — re-registering with the
102
213
  * same `type` merges the new fields with any existing entry so that
@@ -109,6 +220,19 @@ export declare function registerMetadataResource(config: MetadataResourceConfig)
109
220
  export declare function getMetadataResource(type: string): MetadataResourceConfig | undefined;
110
221
  /** Snapshot of all registered entries (diagnostics; directory page). */
111
222
  export declare function listMetadataResources(): MetadataResourceConfig[];
223
+ /**
224
+ * Build the list of child types whose items can be "anchored to" a
225
+ * parent type. Used by the Related tab to decide which `client.list`
226
+ * calls to make.
227
+ *
228
+ * Returns an array of `{ type, anchor }` pairs, sorted by `anchor.order`
229
+ * (lower first) and then by child type label for stable rendering.
230
+ */
231
+ export declare function listAnchorsFor(parentType: string): Array<{
232
+ type: string;
233
+ config: MetadataResourceConfig;
234
+ anchor: MetadataAnchor;
235
+ }>;
112
236
  /**
113
237
  * Merge a registered config (if any) with server-side defaults from
114
238
  * `/meta/types`. Server fields win for label/description/domain
@@ -1,4 +1,33 @@
1
1
  // Copyright (c) 2025 ObjectStack. Licensed under the Apache-2.0 license.
2
+ /**
3
+ * Helper that returns a `match` reading a (possibly dotted) field path
4
+ * from the item and comparing it to the anchor name.
5
+ *
6
+ * anchorByField('object') // item.object === name
7
+ * anchorByField('data.object') // item.data?.object === name
8
+ * anchorByField(['list.data.object',
9
+ * 'form.data.object']) // either path matches
10
+ */
11
+ export function anchorByField(paths) {
12
+ const list = (Array.isArray(paths) ? paths : [paths]).map((p) => p.split('.'));
13
+ return (item, name) => {
14
+ for (const segs of list) {
15
+ let cur = item;
16
+ for (const s of segs) {
17
+ if (cur && typeof cur === 'object' && s in cur) {
18
+ cur = cur[s];
19
+ }
20
+ else {
21
+ cur = undefined;
22
+ break;
23
+ }
24
+ }
25
+ if (cur === name)
26
+ return true;
27
+ }
28
+ return false;
29
+ };
30
+ }
2
31
  const REGISTRY = new Map();
3
32
  /**
4
33
  * Register (or merge) an entry. Idempotent — re-registering with the
@@ -28,6 +57,35 @@ export function getMetadataResource(type) {
28
57
  export function listMetadataResources() {
29
58
  return Array.from(REGISTRY.values());
30
59
  }
60
+ /**
61
+ * Build the list of child types whose items can be "anchored to" a
62
+ * parent type. Used by the Related tab to decide which `client.list`
63
+ * calls to make.
64
+ *
65
+ * Returns an array of `{ type, anchor }` pairs, sorted by `anchor.order`
66
+ * (lower first) and then by child type label for stable rendering.
67
+ */
68
+ export function listAnchorsFor(parentType) {
69
+ const hits = [];
70
+ for (const cfg of REGISTRY.values()) {
71
+ if (!cfg.anchors?.length)
72
+ continue;
73
+ for (const a of cfg.anchors) {
74
+ if (a.anchorType === parentType)
75
+ hits.push({ type: cfg.type, config: cfg, anchor: a });
76
+ }
77
+ }
78
+ hits.sort((a, b) => {
79
+ const ao = a.anchor.order ?? 100;
80
+ const bo = b.anchor.order ?? 100;
81
+ if (ao !== bo)
82
+ return ao - bo;
83
+ const al = a.anchor.groupLabel ?? a.config.label ?? a.type;
84
+ const bl = b.anchor.groupLabel ?? b.config.label ?? b.type;
85
+ return al.localeCompare(bl);
86
+ });
87
+ return hits;
88
+ }
31
89
  /**
32
90
  * Merge a registered config (if any) with server-side defaults from
33
91
  * `/meta/types`. Server fields win for label/description/domain
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@object-ui/app-shell",
3
- "version": "6.2.0",
3
+ "version": "6.2.2",
4
4
  "type": "module",
5
5
  "license": "MIT",
6
6
  "description": "Minimal application shell for ObjectUI - framework-agnostic rendering engine",
@@ -28,36 +28,36 @@
28
28
  "@sentry/react": "^10.53.1",
29
29
  "lucide-react": "^1.16.0",
30
30
  "sonner": "^2.0.7",
31
- "@object-ui/auth": "6.2.0",
32
- "@object-ui/collaboration": "6.2.0",
33
- "@object-ui/components": "6.2.0",
34
- "@object-ui/plugin-editor": "6.2.0",
35
- "@object-ui/core": "6.2.0",
36
- "@object-ui/data-objectstack": "6.2.0",
37
- "@object-ui/fields": "6.2.0",
38
- "@object-ui/i18n": "6.2.0",
39
- "@object-ui/layout": "6.2.0",
40
- "@object-ui/permissions": "6.2.0",
41
- "@object-ui/providers": "6.2.0",
42
- "@object-ui/react": "6.2.0",
43
- "@object-ui/types": "6.2.0"
31
+ "@object-ui/auth": "6.2.2",
32
+ "@object-ui/collaboration": "6.2.2",
33
+ "@object-ui/components": "6.2.2",
34
+ "@object-ui/plugin-editor": "6.2.2",
35
+ "@object-ui/core": "6.2.2",
36
+ "@object-ui/data-objectstack": "6.2.2",
37
+ "@object-ui/fields": "6.2.2",
38
+ "@object-ui/i18n": "6.2.2",
39
+ "@object-ui/layout": "6.2.2",
40
+ "@object-ui/permissions": "6.2.2",
41
+ "@object-ui/providers": "6.2.2",
42
+ "@object-ui/react": "6.2.2",
43
+ "@object-ui/types": "6.2.2"
44
44
  },
45
45
  "peerDependencies": {
46
46
  "react": "^18.0.0 || ^19.0.0",
47
47
  "react-dom": "^18.0.0 || ^19.0.0",
48
48
  "react-router-dom": "^6.0.0 || ^7.0.0",
49
- "@object-ui/plugin-calendar": "^6.2.0",
50
- "@object-ui/plugin-charts": "^6.2.0",
51
- "@object-ui/plugin-chatbot": "^6.2.0",
52
- "@object-ui/plugin-dashboard": "^6.2.0",
53
- "@object-ui/plugin-designer": "^6.2.0",
54
- "@object-ui/plugin-detail": "^6.2.0",
55
- "@object-ui/plugin-form": "^6.2.0",
56
- "@object-ui/plugin-grid": "^6.2.0",
57
- "@object-ui/plugin-kanban": "^6.2.0",
58
- "@object-ui/plugin-list": "^6.2.0",
59
- "@object-ui/plugin-report": "^6.2.0",
60
- "@object-ui/plugin-view": "^6.2.0"
49
+ "@object-ui/plugin-calendar": "^6.2.2",
50
+ "@object-ui/plugin-charts": "^6.2.2",
51
+ "@object-ui/plugin-chatbot": "^6.2.2",
52
+ "@object-ui/plugin-dashboard": "^6.2.2",
53
+ "@object-ui/plugin-designer": "^6.2.2",
54
+ "@object-ui/plugin-detail": "^6.2.2",
55
+ "@object-ui/plugin-form": "^6.2.2",
56
+ "@object-ui/plugin-grid": "^6.2.2",
57
+ "@object-ui/plugin-kanban": "^6.2.2",
58
+ "@object-ui/plugin-list": "^6.2.2",
59
+ "@object-ui/plugin-report": "^6.2.2",
60
+ "@object-ui/plugin-view": "^6.2.2"
61
61
  },
62
62
  "devDependencies": {
63
63
  "@types/node": "^25.9.1",