@object-ui/app-shell 6.2.0 → 6.2.1

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.
@@ -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.1",
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.1",
32
+ "@object-ui/collaboration": "6.2.1",
33
+ "@object-ui/components": "6.2.1",
34
+ "@object-ui/plugin-editor": "6.2.1",
35
+ "@object-ui/core": "6.2.1",
36
+ "@object-ui/data-objectstack": "6.2.1",
37
+ "@object-ui/fields": "6.2.1",
38
+ "@object-ui/i18n": "6.2.1",
39
+ "@object-ui/layout": "6.2.1",
40
+ "@object-ui/permissions": "6.2.1",
41
+ "@object-ui/providers": "6.2.1",
42
+ "@object-ui/react": "6.2.1",
43
+ "@object-ui/types": "6.2.1"
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.1",
50
+ "@object-ui/plugin-charts": "^6.2.1",
51
+ "@object-ui/plugin-chatbot": "^6.2.1",
52
+ "@object-ui/plugin-dashboard": "^6.2.1",
53
+ "@object-ui/plugin-designer": "^6.2.1",
54
+ "@object-ui/plugin-detail": "^6.2.1",
55
+ "@object-ui/plugin-form": "^6.2.1",
56
+ "@object-ui/plugin-grid": "^6.2.1",
57
+ "@object-ui/plugin-kanban": "^6.2.1",
58
+ "@object-ui/plugin-list": "^6.2.1",
59
+ "@object-ui/plugin-report": "^6.2.1",
60
+ "@object-ui/plugin-view": "^6.2.1"
61
61
  },
62
62
  "devDependencies": {
63
63
  "@types/node": "^25.9.1",