@dxos/plugin-preview 0.8.4-main.4a85c3132b → 0.8.4-main.4f23b4e393

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 (112) hide show
  1. package/dist/lib/neutral/PreviewPlugin.mjs +9 -0
  2. package/dist/lib/neutral/PreviewPlugin.mjs.map +7 -0
  3. package/dist/lib/neutral/PreviewPlugin.node.mjs +17 -0
  4. package/dist/lib/neutral/PreviewPlugin.node.mjs.map +7 -0
  5. package/dist/lib/neutral/capabilities/index.mjs +9 -0
  6. package/dist/lib/neutral/capabilities/index.mjs.map +7 -0
  7. package/dist/lib/neutral/chunk-3SWUVHXJ.mjs +28 -0
  8. package/dist/lib/neutral/chunk-3SWUVHXJ.mjs.map +7 -0
  9. package/dist/lib/{browser/chunk-XLN6KTHK.mjs → neutral/chunk-52UEVZSF.mjs} +2 -2
  10. package/dist/lib/{browser/chunk-XLN6KTHK.mjs.map → neutral/chunk-52UEVZSF.mjs.map} +3 -3
  11. package/dist/lib/neutral/index.mjs +7 -0
  12. package/dist/lib/neutral/index.mjs.map +7 -0
  13. package/dist/lib/neutral/meta.json +1 -0
  14. package/dist/lib/neutral/meta.mjs +7 -0
  15. package/dist/lib/neutral/meta.mjs.map +7 -0
  16. package/dist/lib/neutral/plugin.mjs +11 -0
  17. package/dist/lib/neutral/plugin.mjs.map +7 -0
  18. package/dist/lib/{browser/preview-popover-5YUZCO2D.mjs → neutral/preview-popover-MPPEMUIA.mjs} +10 -14
  19. package/dist/lib/neutral/preview-popover-MPPEMUIA.mjs.map +7 -0
  20. package/dist/lib/neutral/react-surface-YFFJXXPQ.mjs +348 -0
  21. package/dist/lib/neutral/react-surface-YFFJXXPQ.mjs.map +7 -0
  22. package/dist/lib/neutral/testing.mjs +7 -0
  23. package/dist/lib/neutral/testing.mjs.map +7 -0
  24. package/dist/lib/neutral/translations.mjs +21 -0
  25. package/dist/lib/neutral/translations.mjs.map +7 -0
  26. package/dist/types/src/PreviewPlugin.d.ts +1 -0
  27. package/dist/types/src/PreviewPlugin.d.ts.map +1 -1
  28. package/dist/types/src/PreviewPlugin.node.d.ts +4 -0
  29. package/dist/types/src/PreviewPlugin.node.d.ts.map +1 -0
  30. package/dist/types/src/PreviewPlugin.test.d.ts +2 -0
  31. package/dist/types/src/PreviewPlugin.test.d.ts.map +1 -0
  32. package/dist/types/src/capabilities/index.d.ts +3 -2
  33. package/dist/types/src/capabilities/index.d.ts.map +1 -1
  34. package/dist/types/src/capabilities/preview-popover.d.ts.map +1 -0
  35. package/dist/types/src/capabilities/react-surface.d.ts.map +1 -0
  36. package/dist/types/src/cards/ExpandoCard.d.ts +4 -0
  37. package/dist/types/src/cards/ExpandoCard.d.ts.map +1 -0
  38. package/dist/types/src/cards/FormCard.d.ts +2 -2
  39. package/dist/types/src/cards/FormCard.d.ts.map +1 -1
  40. package/dist/types/src/cards/JsonCard.d.ts +5 -0
  41. package/dist/types/src/cards/JsonCard.d.ts.map +1 -0
  42. package/dist/types/src/cards/OrganizationCard.d.ts +2 -2
  43. package/dist/types/src/cards/OrganizationCard.d.ts.map +1 -1
  44. package/dist/types/src/cards/PersonCard.d.ts +2 -2
  45. package/dist/types/src/cards/PersonCard.d.ts.map +1 -1
  46. package/dist/types/src/cards/ProjectCard.d.ts +2 -2
  47. package/dist/types/src/cards/ProjectCard.d.ts.map +1 -1
  48. package/dist/types/src/cards/TaskCard.d.ts +2 -2
  49. package/dist/types/src/cards/TaskCard.d.ts.map +1 -1
  50. package/dist/types/src/cards/index.d.ts +2 -0
  51. package/dist/types/src/cards/index.d.ts.map +1 -1
  52. package/dist/types/src/index.d.ts +0 -1
  53. package/dist/types/src/index.d.ts.map +1 -1
  54. package/dist/types/src/plugin.d.ts +3 -0
  55. package/dist/types/src/plugin.d.ts.map +1 -0
  56. package/dist/types/src/stories/Card.stories.d.ts +15 -9
  57. package/dist/types/src/stories/Card.stories.d.ts.map +1 -1
  58. package/dist/types/src/stories/testing.d.ts +4 -2
  59. package/dist/types/src/stories/testing.d.ts.map +1 -1
  60. package/dist/types/src/testing.d.ts +2 -0
  61. package/dist/types/src/testing.d.ts.map +1 -0
  62. package/dist/types/src/translations.d.ts +8 -9
  63. package/dist/types/src/translations.d.ts.map +1 -1
  64. package/dist/types/tsconfig.tsbuildinfo +1 -1
  65. package/package.json +78 -40
  66. package/src/PreviewPlugin.node.ts +16 -0
  67. package/src/PreviewPlugin.test.ts +25 -0
  68. package/src/PreviewPlugin.tsx +6 -4
  69. package/src/capabilities/index.ts +4 -2
  70. package/src/capabilities/{preview-popover/preview-popover.ts → preview-popover.ts} +11 -5
  71. package/src/capabilities/react-surface.tsx +118 -0
  72. package/src/cards/ExpandoCard.tsx +76 -0
  73. package/src/cards/FormCard.tsx +9 -8
  74. package/src/cards/JsonCard.tsx +19 -0
  75. package/src/cards/OrganizationCard.tsx +3 -3
  76. package/src/cards/PersonCard.tsx +27 -9
  77. package/src/cards/ProjectCard.tsx +2 -2
  78. package/src/cards/TaskCard.tsx +15 -11
  79. package/src/cards/index.ts +2 -0
  80. package/src/index.ts +0 -2
  81. package/src/meta.ts +1 -1
  82. package/src/plugin.ts +9 -0
  83. package/src/stories/Card.stories.tsx +50 -5
  84. package/src/stories/testing.tsx +26 -16
  85. package/src/testing.ts +7 -0
  86. package/src/translations.ts +8 -8
  87. package/dist/lib/browser/index.mjs +0 -55
  88. package/dist/lib/browser/index.mjs.map +0 -7
  89. package/dist/lib/browser/meta.json +0 -1
  90. package/dist/lib/browser/preview-popover-5YUZCO2D.mjs.map +0 -7
  91. package/dist/lib/browser/react-surface-O25YV7AH.mjs +0 -233
  92. package/dist/lib/browser/react-surface-O25YV7AH.mjs.map +0 -7
  93. package/dist/lib/node-esm/chunk-2G4FUGDA.mjs +0 -19
  94. package/dist/lib/node-esm/chunk-2G4FUGDA.mjs.map +0 -7
  95. package/dist/lib/node-esm/index.mjs +0 -56
  96. package/dist/lib/node-esm/index.mjs.map +0 -7
  97. package/dist/lib/node-esm/meta.json +0 -1
  98. package/dist/lib/node-esm/preview-popover-7QRYVL73.mjs +0 -84
  99. package/dist/lib/node-esm/preview-popover-7QRYVL73.mjs.map +0 -7
  100. package/dist/lib/node-esm/react-surface-YA3XXW7A.mjs +0 -234
  101. package/dist/lib/node-esm/react-surface-YA3XXW7A.mjs.map +0 -7
  102. package/dist/types/src/capabilities/preview-popover/index.d.ts +0 -3
  103. package/dist/types/src/capabilities/preview-popover/index.d.ts.map +0 -1
  104. package/dist/types/src/capabilities/preview-popover/preview-popover.d.ts.map +0 -1
  105. package/dist/types/src/capabilities/react-surface/index.d.ts +0 -3
  106. package/dist/types/src/capabilities/react-surface/index.d.ts.map +0 -1
  107. package/dist/types/src/capabilities/react-surface/react-surface.d.ts.map +0 -1
  108. package/src/capabilities/preview-popover/index.ts +0 -7
  109. package/src/capabilities/react-surface/index.ts +0 -7
  110. package/src/capabilities/react-surface/react-surface.tsx +0 -97
  111. /package/dist/types/src/capabilities/{preview-popover/preview-popover.d.ts → preview-popover.d.ts} +0 -0
  112. /package/dist/types/src/capabilities/{react-surface/react-surface.d.ts → react-surface.d.ts} +0 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dxos/plugin-preview",
3
- "version": "0.8.4-main.4a85c3132b",
3
+ "version": "0.8.4-main.4f23b4e393",
4
4
  "description": "Preview plugin",
5
5
  "homepage": "https://dxos.org",
6
6
  "bugs": "https://github.com/dxos/dxos/issues",
@@ -12,64 +12,102 @@
12
12
  "author": "DXOS.org",
13
13
  "sideEffects": true,
14
14
  "type": "module",
15
+ "imports": {
16
+ "#capabilities": {
17
+ "source": "./src/capabilities/index.ts",
18
+ "types": "./dist/types/src/capabilities/index.d.ts",
19
+ "default": "./dist/lib/neutral/capabilities/index.mjs"
20
+ },
21
+ "#meta": {
22
+ "source": "./src/meta.ts",
23
+ "types": "./dist/types/src/meta.d.ts",
24
+ "default": "./dist/lib/neutral/meta.mjs"
25
+ },
26
+ "#plugin": {
27
+ "source": {
28
+ "node": "./src/PreviewPlugin.node.ts",
29
+ "default": "./src/PreviewPlugin.tsx"
30
+ },
31
+ "types": "./dist/types/src/PreviewPlugin.d.ts",
32
+ "node": "./dist/lib/neutral/PreviewPlugin.node.mjs",
33
+ "default": "./dist/lib/neutral/PreviewPlugin.mjs"
34
+ },
35
+ "#translations": {
36
+ "source": "./src/translations.ts",
37
+ "types": "./dist/types/src/translations.d.ts",
38
+ "default": "./dist/lib/neutral/translations.mjs"
39
+ }
40
+ },
15
41
  "exports": {
16
42
  ".": {
17
43
  "source": "./src/index.ts",
18
44
  "types": "./dist/types/src/index.d.ts",
19
- "browser": "./dist/lib/browser/index.mjs"
45
+ "default": "./dist/lib/neutral/index.mjs"
46
+ },
47
+ "./plugin": {
48
+ "source": "./src/plugin.ts",
49
+ "types": "./dist/types/src/plugin.d.ts",
50
+ "default": "./dist/lib/neutral/plugin.mjs"
51
+ },
52
+ "./testing": {
53
+ "source": "./src/testing.ts",
54
+ "types": "./dist/types/src/testing.d.ts",
55
+ "default": "./dist/lib/neutral/testing.mjs"
56
+ },
57
+ "./translations": {
58
+ "source": "./src/translations.ts",
59
+ "types": "./dist/types/src/translations.d.ts",
60
+ "default": "./dist/lib/neutral/translations.mjs"
20
61
  }
21
62
  },
22
63
  "types": "dist/types/src/index.d.ts",
23
- "typesVersions": {
24
- "*": {}
25
- },
26
64
  "files": [
27
65
  "dist",
28
66
  "src"
29
67
  ],
30
68
  "dependencies": {
31
69
  "@effect-atom/atom-react": "^0.5.0",
32
- "@dxos/app-framework": "0.8.4-main.4a85c3132b",
33
- "@dxos/app-toolkit": "0.8.4-main.4a85c3132b",
34
- "@dxos/app-graph": "0.8.4-main.4a85c3132b",
35
- "@dxos/client": "0.8.4-main.4a85c3132b",
36
- "@dxos/echo": "0.8.4-main.4a85c3132b",
37
- "@dxos/effect": "0.8.4-main.4a85c3132b",
38
- "@dxos/keys": "0.8.4-main.4a85c3132b",
39
- "@dxos/lit-ui": "0.8.4-main.4a85c3132b",
40
- "@dxos/async": "0.8.4-main.4a85c3132b",
41
- "@dxos/plugin-attention": "0.8.4-main.4a85c3132b",
42
- "@dxos/operation": "0.8.4-main.4a85c3132b",
43
- "@dxos/log": "0.8.4-main.4a85c3132b",
44
- "@dxos/plugin-space": "0.8.4-main.4a85c3132b",
45
- "@dxos/plugin-deck": "0.8.4-main.4a85c3132b",
46
- "@dxos/react-client": "0.8.4-main.4a85c3132b",
47
- "@dxos/react-ui": "0.8.4-main.4a85c3132b",
48
- "@dxos/react-ui-editor": "0.8.4-main.4a85c3132b",
49
- "@dxos/react-ui-form": "0.8.4-main.4a85c3132b",
50
- "@dxos/plugin-client": "0.8.4-main.4a85c3132b",
51
- "@dxos/react-ui-menu": "0.8.4-main.4a85c3132b",
52
- "@dxos/schema": "0.8.4-main.4a85c3132b",
53
- "@dxos/types": "0.8.4-main.4a85c3132b",
54
- "@dxos/ui-editor": "0.8.4-main.4a85c3132b",
55
- "@dxos/react-ui-mosaic": "0.8.4-main.4a85c3132b",
56
- "@dxos/ui-theme": "0.8.4-main.4a85c3132b",
57
- "@dxos/util": "0.8.4-main.4a85c3132b",
58
- "@dxos/react-ui-table": "0.8.4-main.4a85c3132b"
70
+ "@dxos/app-framework": "0.8.4-main.4f23b4e393",
71
+ "@dxos/app-toolkit": "0.8.4-main.4f23b4e393",
72
+ "@dxos/async": "0.8.4-main.4f23b4e393",
73
+ "@dxos/client": "0.8.4-main.4f23b4e393",
74
+ "@dxos/echo": "0.8.4-main.4f23b4e393",
75
+ "@dxos/app-graph": "0.8.4-main.4f23b4e393",
76
+ "@dxos/effect": "0.8.4-main.4f23b4e393",
77
+ "@dxos/lit-ui": "0.8.4-main.4f23b4e393",
78
+ "@dxos/log": "0.8.4-main.4f23b4e393",
79
+ "@dxos/keys": "0.8.4-main.4f23b4e393",
80
+ "@dxos/plugin-attention": "0.8.4-main.4f23b4e393",
81
+ "@dxos/plugin-client": "0.8.4-main.4f23b4e393",
82
+ "@dxos/operation": "0.8.4-main.4f23b4e393",
83
+ "@dxos/plugin-deck": "0.8.4-main.4f23b4e393",
84
+ "@dxos/react-client": "0.8.4-main.4f23b4e393",
85
+ "@dxos/react-ui": "0.8.4-main.4f23b4e393",
86
+ "@dxos/react-ui-editor": "0.8.4-main.4f23b4e393",
87
+ "@dxos/react-ui-menu": "0.8.4-main.4f23b4e393",
88
+ "@dxos/react-ui-form": "0.8.4-main.4f23b4e393",
89
+ "@dxos/react-ui-mosaic": "0.8.4-main.4f23b4e393",
90
+ "@dxos/react-ui-syntax-highlighter": "0.8.4-main.4f23b4e393",
91
+ "@dxos/react-ui-table": "0.8.4-main.4f23b4e393",
92
+ "@dxos/schema": "0.8.4-main.4f23b4e393",
93
+ "@dxos/types": "0.8.4-main.4f23b4e393",
94
+ "@dxos/ui-editor": "0.8.4-main.4f23b4e393",
95
+ "@dxos/ui-theme": "0.8.4-main.4f23b4e393",
96
+ "@dxos/util": "0.8.4-main.4f23b4e393"
59
97
  },
60
98
  "devDependencies": {
61
- "effect": "3.19.16",
99
+ "effect": "3.20.0",
62
100
  "react": "~19.2.3",
63
101
  "react-dom": "~19.2.3",
64
- "vite": "^7.1.11",
65
- "@dxos/echo-db": "0.8.4-main.4a85c3132b",
66
- "@dxos/plugin-testing": "0.8.4-main.4a85c3132b",
67
- "@dxos/random": "0.8.4-main.4a85c3132b",
68
- "@dxos/react-ui-components": "0.8.4-main.4a85c3132b",
69
- "@dxos/storybook-utils": "0.8.4-main.4a85c3132b"
102
+ "vite": "^8.0.10",
103
+ "@dxos/echo-db": "0.8.4-main.4f23b4e393",
104
+ "@dxos/plugin-testing": "0.8.4-main.4f23b4e393",
105
+ "@dxos/random": "0.8.4-main.4f23b4e393",
106
+ "@dxos/react-ui-components": "0.8.4-main.4f23b4e393",
107
+ "@dxos/storybook-utils": "0.8.4-main.4f23b4e393"
70
108
  },
71
109
  "peerDependencies": {
72
- "effect": "3.19.16",
110
+ "effect": "3.20.0",
73
111
  "react": "~19.2.3",
74
112
  "react-dom": "~19.2.3"
75
113
  },
@@ -0,0 +1,16 @@
1
+ //
2
+ // Copyright 2023 DXOS.org
3
+ //
4
+
5
+ import { Plugin } from '@dxos/app-framework';
6
+ import { AppPlugin } from '@dxos/app-toolkit';
7
+ import { Organization, Person } from '@dxos/types';
8
+
9
+ import { meta } from '#meta';
10
+
11
+ export const PreviewPlugin = Plugin.define(meta).pipe(
12
+ AppPlugin.addSchemaModule({ schema: [Person.Person, Organization.Organization] }),
13
+ Plugin.make,
14
+ );
15
+
16
+ export default PreviewPlugin;
@@ -0,0 +1,25 @@
1
+ //
2
+ // Copyright 2026 DXOS.org
3
+ //
4
+
5
+ import { describe, test } from 'vitest';
6
+
7
+ import { ClientPlugin } from '@dxos/plugin-client/plugin';
8
+ import { createComposerTestApp } from '@dxos/plugin-testing/harness';
9
+
10
+ import { PreviewPlugin } from '#plugin';
11
+
12
+ import { meta } from './meta';
13
+
14
+ const moduleId = (name: string) => `${meta.id}.module.${name}`;
15
+
16
+ describe('PreviewPlugin', () => {
17
+ test('modules activate on the expected events', { timeout: 10_000 }, async ({ expect }) => {
18
+ await using harness = await createComposerTestApp({
19
+ plugins: [ClientPlugin({}), PreviewPlugin()],
20
+ });
21
+
22
+ // After autoStart: schema auto-cascades from ClientPlugin.
23
+ expect(harness.manager.getActive()).toContain(moduleId('schema'));
24
+ });
25
+ });
@@ -6,12 +6,12 @@ import { ActivationEvents, Plugin } from '@dxos/app-framework';
6
6
  import { AppPlugin } from '@dxos/app-toolkit';
7
7
  import { Organization, Person } from '@dxos/types';
8
8
 
9
- import { PreviewPopover, ReactSurface } from './capabilities';
10
- import { meta } from './meta';
11
- import { translations } from './translations';
9
+ import { PreviewPopover, ReactSurface } from '#capabilities';
10
+ import { meta } from '#meta';
11
+ import { translations } from '#translations';
12
12
 
13
13
  export const PreviewPlugin = Plugin.define(meta).pipe(
14
- AppPlugin.addSchemaModule({ schema: [Person.Person, Organization.Organization], id: 'schema' }),
14
+ AppPlugin.addSchemaModule({ schema: [Person.Person, Organization.Organization] }),
15
15
  AppPlugin.addSurfaceModule({ activate: ReactSurface }),
16
16
  AppPlugin.addTranslationsModule({ translations }),
17
17
  Plugin.addModule({
@@ -21,3 +21,5 @@ export const PreviewPlugin = Plugin.define(meta).pipe(
21
21
  }),
22
22
  Plugin.make,
23
23
  );
24
+
25
+ export default PreviewPlugin;
@@ -2,5 +2,7 @@
2
2
  // Copyright 2025 DXOS.org
3
3
  //
4
4
 
5
- export * from './preview-popover';
6
- export * from './react-surface';
5
+ import { Capability } from '@dxos/app-framework';
6
+
7
+ export const PreviewPopover = Capability.lazy('PreviewPopover', () => import('./preview-popover'));
8
+ export const ReactSurface = Capability.lazy('ReactSurface', () => import('./react-surface'));
@@ -5,10 +5,10 @@
5
5
  import * as Effect from 'effect/Effect';
6
6
 
7
7
  import { Capabilities, Capability } from '@dxos/app-framework';
8
- import { AppCapabilities, LayoutOperation } from '@dxos/app-toolkit';
8
+ import { AppCapabilities, LayoutOperation, getPersonalSpace, getSpaceIdFromPath } from '@dxos/app-toolkit';
9
9
  import { addEventListener } from '@dxos/async';
10
10
  import { type Client } from '@dxos/client';
11
- import { type Space, parseId } from '@dxos/client/echo';
11
+ import { type Space } from '@dxos/client/echo';
12
12
  import { Obj } from '@dxos/echo';
13
13
  import { DXN } from '@dxos/keys';
14
14
  import { log } from '@dxos/log';
@@ -49,10 +49,16 @@ export default Capability.makeModule(
49
49
  const { invokePromise } = capabilities.get(Capabilities.OperationInvoker);
50
50
  const client = capabilities.get(ClientCapabilities.Client);
51
51
  const registry = capabilities.get(Capabilities.AtomRegistry);
52
+ // Layout is optional: in standalone harnesses (Storybook, tests) no plugin contributes
53
+ // `AppCapabilities.Layout`, and `getAll` returns an empty array. Reading `registry.get(undefined)`
54
+ // would crash inside Atom's identity check (`'~atom/Serializable' in undefined`). When layout
55
+ // isn't available, fall through to the personal-space default.
52
56
  const [layoutAtom] = capabilities.getAll(AppCapabilities.Layout);
53
- const layout = registry.get(layoutAtom);
54
- const { spaceId } = parseId(layout.workspace);
55
- const space = (spaceId && client.spaces.get(spaceId)) ?? client.spaces.default;
57
+ const spaceId = layoutAtom && getSpaceIdFromPath(registry.get(layoutAtom).workspace);
58
+ const space = (spaceId && client.spaces.get(spaceId)) ?? getPersonalSpace(client);
59
+ if (!space) {
60
+ return;
61
+ }
56
62
  const result = await handlePreviewLookup(client, space, { dxn, label });
57
63
  if (!result) {
58
64
  return;
@@ -0,0 +1,118 @@
1
+ //
2
+ // Copyright 2025 DXOS.org
3
+ //
4
+
5
+ import * as Effect from 'effect/Effect';
6
+ import React from 'react';
7
+
8
+ import { Capabilities, Capability } from '@dxos/app-framework';
9
+ import { Surface } from '@dxos/app-framework/ui';
10
+ import { AppSurface } from '@dxos/app-toolkit/ui';
11
+ import { Obj } from '@dxos/echo';
12
+ import { Card } from '@dxos/react-ui';
13
+ import { Expando, type ProjectionModel } from '@dxos/schema';
14
+ import { Organization, Person, Pipeline, Task } from '@dxos/types';
15
+
16
+ import { ExpandoCard, FormCard, JsonCard, OrganizationCard, PersonCard, ProjectCard, TaskCard } from '../cards';
17
+
18
+ export default Capability.makeModule(() =>
19
+ Effect.succeed(
20
+ Capability.contributes(Capabilities.ReactSurface, [
21
+ //
22
+ // Specific schema types.
23
+ // TODO(burdon): Create helpers and factor out.
24
+ //
25
+
26
+ Surface.create<{ subject: Person.Person }>({
27
+ id: 'schema-popover--contact',
28
+ position: 'hoist',
29
+ filter: AppSurface.object(AppSurface.Card, Person.Person),
30
+ component: ({ data, role }) => {
31
+ return (
32
+ <>
33
+ <PersonCard role={role} subject={data.subject} />
34
+ <Surface.Surface type={AppSurface.Related} data={data} limit={1} />
35
+ </>
36
+ );
37
+ },
38
+ }),
39
+ Surface.create({
40
+ id: 'schema-popover--organization',
41
+ position: 'hoist',
42
+ filter: AppSurface.object(AppSurface.Card, Organization.Organization),
43
+ component: ({ data, role }) => {
44
+ return (
45
+ <>
46
+ <OrganizationCard role={role} subject={data.subject} />
47
+ <Surface.Surface type={AppSurface.Related} data={data} limit={1} />
48
+ </>
49
+ );
50
+ },
51
+ }),
52
+ Surface.create({
53
+ id: 'schema-popover--project',
54
+ position: 'hoist',
55
+ filter: AppSurface.object(AppSurface.Card, Pipeline.Pipeline),
56
+ component: ({ data, role }) => {
57
+ return <ProjectCard role={role} subject={data.subject} />;
58
+ },
59
+ }),
60
+ Surface.create({
61
+ id: 'schema-popover--task',
62
+ position: 'hoist',
63
+ filter: AppSurface.object(AppSurface.Card, Task.Task),
64
+ component: ({ data, role }) => {
65
+ return <TaskCard role={role} subject={data.subject} />;
66
+ },
67
+ }),
68
+ Surface.create<AppSurface.ObjectCardData<Expando.Expando>>({
69
+ id: 'schema-popover--expando',
70
+ filter: AppSurface.object(AppSurface.Card, Expando.Expando),
71
+ component: ({ data, role }) => {
72
+ return <ExpandoCard role={role} subject={data.subject} ignorePaths={data.ignorePaths} />;
73
+ },
74
+ }),
75
+
76
+ //
77
+ // Fallback for any object.
78
+ //
79
+
80
+ Surface.create({
81
+ id: 'fallback-popover',
82
+ role: 'card--content',
83
+ position: 'fallback',
84
+ filter: (data): data is { subject: Obj.Unknown; projection?: ProjectionModel } => Obj.isObject(data.subject),
85
+ component: ({ data, role }) => {
86
+ return <FormCard role={role} subject={data.subject} projection={data.projection} />;
87
+ },
88
+ }),
89
+
90
+ Surface.create({
91
+ id: 'fallback-json',
92
+ role: 'card--content',
93
+ position: 'fallback',
94
+ filter: (data): data is Record<string, unknown> => true,
95
+ component: ({ data }) => {
96
+ return <JsonCard data={data} />;
97
+ },
98
+ }),
99
+
100
+ Surface.create({
101
+ id: 'section',
102
+ position: 'fallback',
103
+ filter: AppSurface.subject(AppSurface.Section, Obj.isObject),
104
+ component: ({ data }) => {
105
+ return (
106
+ <div className='flex w-full justify-center'>
107
+ <div className='py-2 dx-card-min-width dx-card-max-width'>
108
+ <Card.Root>
109
+ <Surface.Surface type={AppSurface.Card} data={data} limit={1} />
110
+ </Card.Root>
111
+ </div>
112
+ </div>
113
+ );
114
+ },
115
+ }),
116
+ ]),
117
+ ),
118
+ );
@@ -0,0 +1,76 @@
1
+ //
2
+ // Copyright 2026 DXOS.org
3
+ //
4
+
5
+ import * as Schema from 'effect/Schema';
6
+ import React, { useCallback, useMemo } from 'react';
7
+
8
+ import { type AppSurface } from '@dxos/app-toolkit/ui';
9
+ import { Obj } from '@dxos/echo';
10
+ import { type JsonPath, splitJsonPath } from '@dxos/effect';
11
+ import { Card } from '@dxos/react-ui';
12
+ import { Form } from '@dxos/react-ui-form';
13
+
14
+ const schemaForValue = (value: unknown): Schema.Schema.AnyNoContext | undefined => {
15
+ switch (typeof value) {
16
+ case 'string':
17
+ return Schema.String;
18
+ case 'number':
19
+ return Schema.Number;
20
+ case 'boolean':
21
+ return Schema.Boolean;
22
+ default:
23
+ return undefined;
24
+ }
25
+ };
26
+
27
+ /**
28
+ * Reserved keys: `id`, plus any `~`-prefixed key (ECHO uses `~`-prefixed
29
+ * string keys to brand entity instances and schemas — KindId,
30
+ * SchemaKindId, SnapshotKindId, etc. — and the `~` namespace is reserved
31
+ * for that purpose). They show up in `Object.keys` but aren't user data.
32
+ */
33
+ const isInternalKey = (key: string) => key === 'id' || key.startsWith('~');
34
+
35
+ export const ExpandoCard = ({ subject, ignorePaths }: AppSurface.ObjectCardProps) => {
36
+ const schema = useMemo(() => {
37
+ const ignored = new Set(ignorePaths ?? []);
38
+ const fields: Record<string, Schema.Schema.AnyNoContext> = {};
39
+ for (const key of Object.keys(subject)) {
40
+ if (isInternalKey(key) || ignored.has(key)) {
41
+ continue;
42
+ }
43
+ const fieldSchema = schemaForValue((subject as any)[key]);
44
+ if (fieldSchema) {
45
+ fields[key] = fieldSchema;
46
+ }
47
+ }
48
+ return Schema.Struct(fields);
49
+ }, [subject, ignorePaths]);
50
+
51
+ const handleSave = useCallback(
52
+ (values: any, { changed }: { changed: Record<string, boolean> }) => {
53
+ const paths = Object.keys(changed).filter((path) => changed[path]);
54
+ Obj.update(subject, () => {
55
+ for (const path of paths) {
56
+ const value = values[path];
57
+ const parts = splitJsonPath(path as JsonPath);
58
+ Obj.setValue(subject, parts, value);
59
+ }
60
+ });
61
+ },
62
+ [subject],
63
+ );
64
+
65
+ return (
66
+ <Card.Content>
67
+ <Form.Root schema={schema} values={subject} autoSave onSave={handleSave}>
68
+ <Form.Viewport>
69
+ <Form.Content>
70
+ <Form.FieldSet />
71
+ </Form.Content>
72
+ </Form.Viewport>
73
+ </Form.Root>
74
+ </Card.Content>
75
+ );
76
+ };
@@ -2,9 +2,9 @@
2
2
  // Copyright 2025 DXOS.org
3
3
  //
4
4
 
5
- import React, { useCallback } from 'react';
5
+ import React, { useCallback, useMemo } from 'react';
6
6
 
7
- import { type SurfaceComponentProps } from '@dxos/app-toolkit/ui';
7
+ import { type AppSurface } from '@dxos/app-toolkit/ui';
8
8
  import { Obj } from '@dxos/echo';
9
9
  import { type JsonPath, splitJsonPath } from '@dxos/effect';
10
10
  import { Card, useTranslation } from '@dxos/react-ui';
@@ -12,15 +12,16 @@ import { Form, omitId } from '@dxos/react-ui-form';
12
12
  import { type ProjectionModel } from '@dxos/schema';
13
13
  import { descriptionMessage, mx } from '@dxos/ui-theme';
14
14
 
15
- import { meta } from '../meta';
15
+ import { meta } from '#meta';
16
16
 
17
- export const FormCard = ({ subject, projection }: SurfaceComponentProps & { projection?: ProjectionModel }) => {
17
+ export const FormCard = ({ subject, projection }: AppSurface.ObjectCardProps & { projection?: ProjectionModel }) => {
18
18
  const { t } = useTranslation(meta.id);
19
- const schema = Obj.getSchema(subject);
19
+ const echoSchema = Obj.getSchema(subject);
20
+ const schema = useMemo(() => echoSchema && omitId(echoSchema), [echoSchema]);
20
21
 
21
22
  const handleSave = useCallback((values: any, { changed }: { changed: Record<string, boolean> }) => {
22
23
  const paths = Object.keys(changed).filter((path) => changed[path]);
23
- Obj.change(subject, () => {
24
+ Obj.update(subject, () => {
24
25
  for (const path of paths) {
25
26
  const value = values[path];
26
27
  const parts = splitJsonPath(path as JsonPath);
@@ -30,12 +31,12 @@ export const FormCard = ({ subject, projection }: SurfaceComponentProps & { proj
30
31
  }, []);
31
32
 
32
33
  if (!schema) {
33
- return <p className={mx(descriptionMessage)}>{t('unable to create preview message')}</p>;
34
+ return <p className={mx(descriptionMessage)}>{t('unable-to-create-preview.message')}</p>;
34
35
  }
35
36
 
36
37
  return (
37
38
  <Card.Content>
38
- <Form.Root schema={omitId(schema)} projection={projection} values={subject} autoSave onSave={handleSave}>
39
+ <Form.Root schema={schema} projection={projection} values={subject} autoSave onSave={handleSave}>
39
40
  <Form.Viewport>
40
41
  <Form.Content>
41
42
  <Form.FieldSet />
@@ -0,0 +1,19 @@
1
+ //
2
+ // Copyright 2025 DXOS.org
3
+ //
4
+
5
+ import React from 'react';
6
+
7
+ import { Card } from '@dxos/react-ui';
8
+ import { JsonHighlighter } from '@dxos/react-ui-syntax-highlighter';
9
+
10
+ export const JsonCard = ({ data }: { data: unknown }) => {
11
+ return (
12
+ <Card.Content>
13
+ <span />
14
+ {/* TODO(wittjosiah): Span whole row. */}
15
+ <JsonHighlighter data={data} />
16
+ <span />
17
+ </Card.Content>
18
+ );
19
+ };
@@ -4,12 +4,12 @@
4
4
 
5
5
  import React from 'react';
6
6
 
7
- import { type SurfaceComponentProps } from '@dxos/app-toolkit/ui';
7
+ import { type AppSurface } from '@dxos/app-toolkit/ui';
8
8
  import { Card } from '@dxos/react-ui';
9
9
  import { type Organization } from '@dxos/types';
10
10
 
11
- export const OrganizationCard = ({ subject }: SurfaceComponentProps<Organization.Organization>) => {
12
- const { image, description, website } = subject;
11
+ export const OrganizationCard = ({ subject }: AppSurface.ObjectCardProps<Organization.Organization>) => {
12
+ const { name, image, description, website } = subject;
13
13
 
14
14
  return (
15
15
  <Card.Content>
@@ -2,16 +2,38 @@
2
2
  // Copyright 2025 DXOS.org
3
3
  //
4
4
 
5
- import React from 'react';
5
+ import * as Effect from 'effect/Effect';
6
+ import React, { useCallback } from 'react';
6
7
 
7
- import { type SurfaceComponentProps } from '@dxos/app-toolkit/ui';
8
+ import { useOperationInvoker } from '@dxos/app-framework/ui';
9
+ import { LayoutOperation, getObjectPathFromObject, getSpacePath } from '@dxos/app-toolkit';
10
+ import { type AppSurface } from '@dxos/app-toolkit/ui';
11
+ import { Obj } from '@dxos/echo';
12
+ import { runAndForwardErrors } from '@dxos/effect';
8
13
  import { Avatar } from '@dxos/react-ui';
9
14
  import { Card } from '@dxos/react-ui';
10
15
  import { type Person } from '@dxos/types';
11
16
 
12
- export const PersonCard = ({ subject }: SurfaceComponentProps<Person.Person>) => {
17
+ export const PersonCard = ({ subject }: AppSurface.ObjectCardProps<Person.Person>) => {
18
+ const { invoke } = useOperationInvoker();
13
19
  const { image, organization: { target: organization } = {}, emails = [] } = subject;
14
20
 
21
+ const handleOrganizationClick = useCallback(() => {
22
+ if (!organization) {
23
+ return;
24
+ }
25
+
26
+ return Effect.gen(function* () {
27
+ const organizationPath = getObjectPathFromObject(organization);
28
+ const db = Obj.getDatabase(organization);
29
+ yield* invoke(LayoutOperation.UpdatePopover, { state: false, anchorId: '' });
30
+ yield* invoke(LayoutOperation.Open, {
31
+ subject: [organizationPath],
32
+ workspace: db ? getSpacePath(db.spaceId) : undefined,
33
+ });
34
+ }).pipe(runAndForwardErrors);
35
+ }, [invoke, organization]);
36
+
15
37
  return (
16
38
  <Card.Content>
17
39
  <Avatar.Root>
@@ -20,7 +42,7 @@ export const PersonCard = ({ subject }: SurfaceComponentProps<Person.Person>) =>
20
42
  <Avatar.Content
21
43
  imgSrc={image}
22
44
  icon='ph--user--regular'
23
- size={16}
45
+ size={20}
24
46
  classNames={!image && 'opacity-50'}
25
47
  hue='neutral'
26
48
  variant='square'
@@ -28,11 +50,7 @@ export const PersonCard = ({ subject }: SurfaceComponentProps<Person.Person>) =>
28
50
  </Card.Row>
29
51
  )}
30
52
  {organization?.name && (
31
- <Card.Action
32
- icon='ph--buildings--regular'
33
- label={organization.name}
34
- // onClick={onSelect ? () => onSelect(organization) : undefined}
35
- />
53
+ <Card.Action icon='ph--buildings--regular' label={organization.name} onClick={handleOrganizationClick} />
36
54
  )}
37
55
  {emails.map(({ value }) => (
38
56
  <Card.Row key={value} icon='ph--at--regular'>
@@ -4,12 +4,12 @@
4
4
 
5
5
  import React from 'react';
6
6
 
7
- import { type SurfaceComponentProps } from '@dxos/app-toolkit/ui';
7
+ import { type AppSurface } from '@dxos/app-toolkit/ui';
8
8
  import { Obj } from '@dxos/echo';
9
9
  import { Card } from '@dxos/react-ui';
10
10
  import { type Pipeline } from '@dxos/types';
11
11
 
12
- export const ProjectCard = ({ subject }: SurfaceComponentProps<Pipeline.Pipeline>) => {
12
+ export const ProjectCard = ({ subject }: AppSurface.ObjectCardProps<Pipeline.Pipeline>) => {
13
13
  const { image, description } = subject;
14
14
 
15
15
  return (