@dxos/plugin-preview 0.8.4-main.72ec0f3 → 0.8.4-main.7996785055

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 (99) hide show
  1. package/dist/lib/browser/{chunk-CEWM5LJG.mjs → chunk-KLQDOIFV.mjs} +2 -2
  2. package/dist/lib/browser/chunk-KLQDOIFV.mjs.map +7 -0
  3. package/dist/lib/browser/index.mjs +25 -34
  4. package/dist/lib/browser/index.mjs.map +4 -4
  5. package/dist/lib/browser/meta.json +1 -1
  6. package/dist/lib/browser/preview-popover-DJSZSNMR.mjs +84 -0
  7. package/dist/lib/browser/preview-popover-DJSZSNMR.mjs.map +7 -0
  8. package/dist/lib/browser/react-surface-NGCGCRET.mjs +289 -0
  9. package/dist/lib/browser/react-surface-NGCGCRET.mjs.map +7 -0
  10. package/dist/lib/node-esm/{chunk-Q5MUNELK.mjs → chunk-GFWHEHC5.mjs} +2 -2
  11. package/dist/lib/node-esm/chunk-GFWHEHC5.mjs.map +7 -0
  12. package/dist/lib/node-esm/index.mjs +25 -34
  13. package/dist/lib/node-esm/index.mjs.map +4 -4
  14. package/dist/lib/node-esm/meta.json +1 -1
  15. package/dist/lib/node-esm/preview-popover-3YDUN7LB.mjs +86 -0
  16. package/dist/lib/node-esm/preview-popover-3YDUN7LB.mjs.map +7 -0
  17. package/dist/lib/node-esm/react-surface-RMCPID6L.mjs +290 -0
  18. package/dist/lib/node-esm/react-surface-RMCPID6L.mjs.map +7 -0
  19. package/dist/types/src/PreviewPlugin.d.ts +2 -1
  20. package/dist/types/src/PreviewPlugin.d.ts.map +1 -1
  21. package/dist/types/src/capabilities/index.d.ts +2 -2
  22. package/dist/types/src/capabilities/index.d.ts.map +1 -1
  23. package/dist/types/src/capabilities/preview-popover/index.d.ts +3 -0
  24. package/dist/types/src/capabilities/preview-popover/index.d.ts.map +1 -0
  25. package/dist/types/src/capabilities/preview-popover/preview-popover.d.ts +5 -0
  26. package/dist/types/src/capabilities/preview-popover/preview-popover.d.ts.map +1 -0
  27. package/dist/types/src/capabilities/react-surface/index.d.ts +3 -0
  28. package/dist/types/src/capabilities/react-surface/index.d.ts.map +1 -0
  29. package/dist/types/src/capabilities/react-surface/react-surface.d.ts +5 -0
  30. package/dist/types/src/capabilities/react-surface/react-surface.d.ts.map +1 -0
  31. package/dist/types/src/cards/FormCard.d.ts +7 -0
  32. package/dist/types/src/cards/FormCard.d.ts.map +1 -0
  33. package/dist/types/src/cards/JsonCard.d.ts +5 -0
  34. package/dist/types/src/cards/JsonCard.d.ts.map +1 -0
  35. package/dist/types/src/cards/OrganizationCard.d.ts +2 -2
  36. package/dist/types/src/cards/OrganizationCard.d.ts.map +1 -1
  37. package/dist/types/src/cards/PersonCard.d.ts +2 -2
  38. package/dist/types/src/cards/PersonCard.d.ts.map +1 -1
  39. package/dist/types/src/cards/ProjectCard.d.ts +3 -3
  40. package/dist/types/src/cards/ProjectCard.d.ts.map +1 -1
  41. package/dist/types/src/cards/TaskCard.d.ts +2 -2
  42. package/dist/types/src/cards/TaskCard.d.ts.map +1 -1
  43. package/dist/types/src/cards/index.d.ts +2 -0
  44. package/dist/types/src/cards/index.d.ts.map +1 -1
  45. package/dist/types/src/index.d.ts +0 -1
  46. package/dist/types/src/index.d.ts.map +1 -1
  47. package/dist/types/src/meta.d.ts +2 -2
  48. package/dist/types/src/meta.d.ts.map +1 -1
  49. package/dist/types/src/stories/Card.stories.d.ts +13 -6
  50. package/dist/types/src/stories/Card.stories.d.ts.map +1 -1
  51. package/dist/types/src/stories/testing.d.ts +13 -12
  52. package/dist/types/src/stories/testing.d.ts.map +1 -1
  53. package/dist/types/tsconfig.tsbuildinfo +1 -1
  54. package/package.json +45 -35
  55. package/src/PreviewPlugin.tsx +11 -22
  56. package/src/capabilities/index.ts +2 -4
  57. package/src/capabilities/preview-popover/index.ts +7 -0
  58. package/src/capabilities/preview-popover/preview-popover.ts +93 -0
  59. package/src/capabilities/react-surface/index.ts +7 -0
  60. package/src/capabilities/react-surface/react-surface.tsx +117 -0
  61. package/src/cards/FormCard.tsx +48 -0
  62. package/src/cards/JsonCard.tsx +16 -0
  63. package/src/cards/OrganizationCard.tsx +11 -16
  64. package/src/cards/PersonCard.tsx +51 -49
  65. package/src/cards/ProjectCard.tsx +9 -11
  66. package/src/cards/TaskCard.tsx +24 -26
  67. package/src/cards/index.ts +2 -0
  68. package/src/index.ts +0 -1
  69. package/src/meta.ts +3 -3
  70. package/src/stories/Card.stories.tsx +67 -21
  71. package/src/stories/testing.tsx +47 -70
  72. package/dist/lib/browser/chunk-CEWM5LJG.mjs.map +0 -7
  73. package/dist/lib/browser/preview-popover-IAPAEKZL.mjs +0 -65
  74. package/dist/lib/browser/preview-popover-IAPAEKZL.mjs.map +0 -7
  75. package/dist/lib/browser/react-surface-LRMZKOJS.mjs +0 -498
  76. package/dist/lib/browser/react-surface-LRMZKOJS.mjs.map +0 -7
  77. package/dist/lib/node-esm/chunk-Q5MUNELK.mjs.map +0 -7
  78. package/dist/lib/node-esm/preview-popover-CH2LDYWM.mjs +0 -67
  79. package/dist/lib/node-esm/preview-popover-CH2LDYWM.mjs.map +0 -7
  80. package/dist/lib/node-esm/react-surface-65UVGBIZ.mjs +0 -499
  81. package/dist/lib/node-esm/react-surface-65UVGBIZ.mjs.map +0 -7
  82. package/dist/types/src/capabilities/preview-popover.d.ts +0 -4
  83. package/dist/types/src/capabilities/preview-popover.d.ts.map +0 -1
  84. package/dist/types/src/capabilities/react-surface.d.ts +0 -4
  85. package/dist/types/src/capabilities/react-surface.d.ts.map +0 -1
  86. package/dist/types/src/components/CardComponents.d.ts +0 -16
  87. package/dist/types/src/components/CardComponents.d.ts.map +0 -1
  88. package/dist/types/src/components/CardSubjectMenu.d.ts +0 -8
  89. package/dist/types/src/components/CardSubjectMenu.d.ts.map +0 -1
  90. package/dist/types/src/components/index.d.ts +0 -3
  91. package/dist/types/src/components/index.d.ts.map +0 -1
  92. package/dist/types/src/types.d.ts +0 -12
  93. package/dist/types/src/types.d.ts.map +0 -1
  94. package/src/capabilities/preview-popover.ts +0 -69
  95. package/src/capabilities/react-surface.tsx +0 -157
  96. package/src/components/CardComponents.tsx +0 -67
  97. package/src/components/CardSubjectMenu.tsx +0 -103
  98. package/src/components/index.ts +0 -6
  99. package/src/types.ts +0 -29
package/package.json CHANGED
@@ -1,9 +1,13 @@
1
1
  {
2
2
  "name": "@dxos/plugin-preview",
3
- "version": "0.8.4-main.72ec0f3",
3
+ "version": "0.8.4-main.7996785055",
4
4
  "description": "Preview plugin",
5
5
  "homepage": "https://dxos.org",
6
6
  "bugs": "https://github.com/dxos/dxos/issues",
7
+ "repository": {
8
+ "type": "git",
9
+ "url": "https://github.com/dxos/dxos"
10
+ },
7
11
  "license": "MIT",
8
12
  "author": "DXOS.org",
9
13
  "sideEffects": true,
@@ -24,44 +28,50 @@
24
28
  "src"
25
29
  ],
26
30
  "dependencies": {
27
- "@effect-atom/atom-react": "^0.3.4",
28
- "@preact-signals/safe-react": "^0.9.0",
29
- "@dxos/app-framework": "0.8.4-main.72ec0f3",
30
- "@dxos/client": "0.8.4-main.72ec0f3",
31
- "@dxos/async": "0.8.4-main.72ec0f3",
32
- "@dxos/app-graph": "0.8.4-main.72ec0f3",
33
- "@dxos/keys": "0.8.4-main.72ec0f3",
34
- "@dxos/lit-ui": "0.8.4-main.72ec0f3",
35
- "@dxos/log": "0.8.4-main.72ec0f3",
36
- "@dxos/echo": "0.8.4-main.72ec0f3",
37
- "@dxos/plugin-attention": "0.8.4-main.72ec0f3",
38
- "@dxos/plugin-client": "0.8.4-main.72ec0f3",
39
- "@dxos/plugin-deck": "0.8.4-main.72ec0f3",
40
- "@dxos/plugin-space": "0.8.4-main.72ec0f3",
41
- "@dxos/react-ui": "0.8.4-main.72ec0f3",
42
- "@dxos/react-ui-form": "0.8.4-main.72ec0f3",
43
- "@dxos/react-client": "0.8.4-main.72ec0f3",
44
- "@dxos/react-ui-stack": "0.8.4-main.72ec0f3",
45
- "@dxos/react-ui-editor": "0.8.4-main.72ec0f3",
46
- "@dxos/react-ui-table": "0.8.4-main.72ec0f3",
47
- "@dxos/react-ui-theme": "0.8.4-main.72ec0f3",
48
- "@dxos/schema": "0.8.4-main.72ec0f3",
49
- "@dxos/types": "0.8.4-main.72ec0f3",
50
- "@dxos/util": "0.8.4-main.72ec0f3",
51
- "@dxos/react-ui-menu": "0.8.4-main.72ec0f3"
31
+ "@effect-atom/atom-react": "^0.5.0",
32
+ "@dxos/app-framework": "0.8.4-main.7996785055",
33
+ "@dxos/app-toolkit": "0.8.4-main.7996785055",
34
+ "@dxos/app-graph": "0.8.4-main.7996785055",
35
+ "@dxos/echo": "0.8.4-main.7996785055",
36
+ "@dxos/effect": "0.8.4-main.7996785055",
37
+ "@dxos/async": "0.8.4-main.7996785055",
38
+ "@dxos/keys": "0.8.4-main.7996785055",
39
+ "@dxos/log": "0.8.4-main.7996785055",
40
+ "@dxos/plugin-attention": "0.8.4-main.7996785055",
41
+ "@dxos/lit-ui": "0.8.4-main.7996785055",
42
+ "@dxos/operation": "0.8.4-main.7996785055",
43
+ "@dxos/plugin-client": "0.8.4-main.7996785055",
44
+ "@dxos/plugin-deck": "0.8.4-main.7996785055",
45
+ "@dxos/react-client": "0.8.4-main.7996785055",
46
+ "@dxos/react-ui": "0.8.4-main.7996785055",
47
+ "@dxos/react-ui-editor": "0.8.4-main.7996785055",
48
+ "@dxos/react-ui-form": "0.8.4-main.7996785055",
49
+ "@dxos/react-ui-menu": "0.8.4-main.7996785055",
50
+ "@dxos/react-ui-mosaic": "0.8.4-main.7996785055",
51
+ "@dxos/react-ui-table": "0.8.4-main.7996785055",
52
+ "@dxos/react-ui-syntax-highlighter": "0.8.4-main.7996785055",
53
+ "@dxos/schema": "0.8.4-main.7996785055",
54
+ "@dxos/types": "0.8.4-main.7996785055",
55
+ "@dxos/ui-editor": "0.8.4-main.7996785055",
56
+ "@dxos/ui-theme": "0.8.4-main.7996785055",
57
+ "@dxos/util": "0.8.4-main.7996785055",
58
+ "@dxos/client": "0.8.4-main.7996785055"
52
59
  },
53
60
  "devDependencies": {
54
- "effect": "3.18.3",
55
- "react": "~19.2.0",
56
- "react-dom": "~19.2.0",
57
- "vite": "7.1.9",
58
- "@dxos/random": "0.8.4-main.72ec0f3",
59
- "@dxos/storybook-utils": "0.8.4-main.72ec0f3"
61
+ "effect": "3.20.0",
62
+ "react": "~19.2.3",
63
+ "react-dom": "~19.2.3",
64
+ "vite": "^7.1.11",
65
+ "@dxos/random": "0.8.4-main.7996785055",
66
+ "@dxos/plugin-testing": "0.8.4-main.7996785055",
67
+ "@dxos/react-ui-components": "0.8.4-main.7996785055",
68
+ "@dxos/storybook-utils": "0.8.4-main.7996785055",
69
+ "@dxos/echo-db": "0.8.4-main.7996785055"
60
70
  },
61
71
  "peerDependencies": {
62
- "effect": "^3.13.3",
63
- "react": "^19.0.0",
64
- "react-dom": "^19.0.0"
72
+ "effect": "3.20.0",
73
+ "react": "~19.2.3",
74
+ "react-dom": "~19.2.3"
65
75
  },
66
76
  "publishConfig": {
67
77
  "access": "public"
@@ -2,33 +2,22 @@
2
2
  // Copyright 2023 DXOS.org
3
3
  //
4
4
 
5
- import { Capabilities, Events, contributes, defineModule, definePlugin } from '@dxos/app-framework';
6
- import { ClientCapabilities, ClientEvents } from '@dxos/plugin-client';
5
+ import { ActivationEvents, Plugin } from '@dxos/app-framework';
6
+ import { AppPlugin } from '@dxos/app-toolkit';
7
7
  import { Organization, Person } from '@dxos/types';
8
8
 
9
9
  import { PreviewPopover, ReactSurface } from './capabilities';
10
10
  import { meta } from './meta';
11
11
  import { translations } from './translations';
12
12
 
13
- export const PreviewPlugin = definePlugin(meta, () => [
14
- defineModule({
15
- id: `${meta.id}/module/translations`,
16
- activatesOn: Events.SetupTranslations,
17
- activate: () => contributes(Capabilities.Translations, translations),
18
- }),
19
- defineModule({
20
- id: `${meta.id}/module/schema`,
21
- activatesOn: ClientEvents.SetupSchema,
22
- activate: () => [contributes(ClientCapabilities.Schema, [Person.Person, Organization.Organization])],
23
- }),
24
- defineModule({
25
- id: `${meta.id}/module/preview-popover`,
26
- activatesOn: Events.Startup,
13
+ export const PreviewPlugin = Plugin.define(meta).pipe(
14
+ AppPlugin.addSchemaModule({ schema: [Person.Person, Organization.Organization], id: 'schema' }),
15
+ AppPlugin.addSurfaceModule({ activate: ReactSurface }),
16
+ AppPlugin.addTranslationsModule({ translations }),
17
+ Plugin.addModule({
18
+ id: 'preview-popover',
19
+ activatesOn: ActivationEvents.Startup,
27
20
  activate: PreviewPopover,
28
21
  }),
29
- defineModule({
30
- id: `${meta.id}/module/react-surface`,
31
- activatesOn: Events.SetupReactSurface,
32
- activate: ReactSurface,
33
- }),
34
- ]);
22
+ Plugin.make,
23
+ );
@@ -2,7 +2,5 @@
2
2
  // Copyright 2025 DXOS.org
3
3
  //
4
4
 
5
- import { lazy } from '@dxos/app-framework';
6
-
7
- export const PreviewPopover = lazy(() => import('./preview-popover'));
8
- export const ReactSurface = lazy(() => import('./react-surface'));
5
+ export * from './preview-popover';
6
+ export * from './react-surface';
@@ -0,0 +1,7 @@
1
+ //
2
+ // Copyright 2025 DXOS.org
3
+ //
4
+
5
+ import { Capability } from '@dxos/app-framework';
6
+
7
+ export const PreviewPopover = Capability.lazy('PreviewPopover', () => import('./preview-popover'));
@@ -0,0 +1,93 @@
1
+ //
2
+ // Copyright 2025 DXOS.org
3
+ //
4
+
5
+ import * as Effect from 'effect/Effect';
6
+
7
+ import { Capabilities, Capability } from '@dxos/app-framework';
8
+ import { AppCapabilities, LayoutOperation, getPersonalSpace, getSpaceIdFromPath } from '@dxos/app-toolkit';
9
+ import { addEventListener } from '@dxos/async';
10
+ import { type Client } from '@dxos/client';
11
+ import { type Space } from '@dxos/client/echo';
12
+ import { Obj } from '@dxos/echo';
13
+ import { DXN } from '@dxos/keys';
14
+ import { log } from '@dxos/log';
15
+ import { ClientCapabilities } from '@dxos/plugin-client';
16
+ import { DX_ANCHOR_ACTIVATE, type DxAnchorActivate } from '@dxos/react-ui';
17
+ import { type PreviewLinkRef, type PreviewLinkTarget } from '@dxos/ui-editor';
18
+
19
+ const customEventOptions = { capture: true, passive: false };
20
+
21
+ const handlePreviewLookup = async (
22
+ client: Client,
23
+ defaultSpace: Space,
24
+ { dxn, label }: PreviewLinkRef,
25
+ ): Promise<PreviewLinkTarget | null> => {
26
+ try {
27
+ const object = await defaultSpace.db.makeRef(DXN.parse(dxn)).load();
28
+ return { label, object };
29
+ } catch {
30
+ return null;
31
+ }
32
+ };
33
+
34
+ export default Capability.makeModule(
35
+ Effect.fnUntraced(function* () {
36
+ // Get context for lazy capability access in callbacks.
37
+ const capabilities = yield* Capability.Service;
38
+
39
+ // TODO(wittjosiah): Factor out lookup handlers to other plugins to make not ECHO-specific.
40
+ const handleAnchorActivate = async ({
41
+ dxn,
42
+ label,
43
+ trigger,
44
+ kind = 'card',
45
+ title: titleProp,
46
+ side,
47
+ props,
48
+ }: DxAnchorActivate) => {
49
+ const { invokePromise } = capabilities.get(Capabilities.OperationInvoker);
50
+ const client = capabilities.get(ClientCapabilities.Client);
51
+ const registry = capabilities.get(Capabilities.AtomRegistry);
52
+ const [layoutAtom] = capabilities.getAll(AppCapabilities.Layout);
53
+ const layout = registry.get(layoutAtom);
54
+ const spaceId = getSpaceIdFromPath(layout.workspace);
55
+ const space = (spaceId && client.spaces.get(spaceId)) ?? getPersonalSpace(client);
56
+ if (!space) {
57
+ return;
58
+ }
59
+ const result = await handlePreviewLookup(client, space, { dxn, label });
60
+ if (!result) {
61
+ return;
62
+ }
63
+
64
+ const title = titleProp ?? Obj.getLabel(result.object);
65
+
66
+ await invokePromise(LayoutOperation.UpdatePopover, {
67
+ subjectRef: dxn,
68
+ subject: result.object,
69
+ state: true,
70
+ variant: 'virtual',
71
+ anchor: trigger,
72
+ ...(kind && { kind }),
73
+ ...(title && { title }),
74
+ ...(side && { side }),
75
+ ...(props && { props }),
76
+ });
77
+ };
78
+
79
+ let cleanup: () => void;
80
+ if (document.defaultView) {
81
+ cleanup = addEventListener(
82
+ document.defaultView,
83
+ DX_ANCHOR_ACTIVATE as any,
84
+ handleAnchorActivate,
85
+ customEventOptions,
86
+ );
87
+ } else {
88
+ log.warn('no default view found');
89
+ }
90
+
91
+ return Capability.contributes(Capabilities.Null, null, () => Effect.sync(() => cleanup?.()));
92
+ }),
93
+ );
@@ -0,0 +1,7 @@
1
+ //
2
+ // Copyright 2025 DXOS.org
3
+ //
4
+
5
+ import { Capability } from '@dxos/app-framework';
6
+
7
+ export const ReactSurface = Capability.lazy('ReactSurface', () => import('./react-surface'));
@@ -0,0 +1,117 @@
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 { Obj } from '@dxos/echo';
11
+ import { Card } from '@dxos/react-ui';
12
+ import { type ProjectionModel } from '@dxos/schema';
13
+ import { Organization, Person, Pipeline, Task } from '@dxos/types';
14
+
15
+ import { FormCard, JsonCard, OrganizationCard, PersonCard, ProjectCard, TaskCard } from '../../cards';
16
+ import { meta } from '../../meta';
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: `${meta.id}.schema-popover--contact`,
28
+ role: 'card--content',
29
+ position: 'hoist',
30
+ filter: (data): data is { subject: Person.Person } => Obj.instanceOf(Person.Person, data.subject),
31
+ component: ({ data, role }) => {
32
+ return (
33
+ <>
34
+ <PersonCard role={role} subject={data.subject} />
35
+ <Surface.Surface role='related' data={data} limit={1} />
36
+ </>
37
+ );
38
+ },
39
+ }),
40
+ Surface.create({
41
+ id: `${meta.id}.schema-popover--organization`,
42
+ role: 'card--content',
43
+ position: 'hoist',
44
+ filter: (data): data is { subject: Organization.Organization } =>
45
+ Obj.instanceOf(Organization.Organization, data.subject),
46
+ component: ({ data, role }) => {
47
+ return (
48
+ <>
49
+ <OrganizationCard role={role} subject={data.subject} />
50
+ <Surface.Surface role='related' data={data} limit={1} />
51
+ </>
52
+ );
53
+ },
54
+ }),
55
+ Surface.create({
56
+ id: `${meta.id}.schema-popover--project`,
57
+ role: 'card--content',
58
+ position: 'hoist',
59
+ filter: (data): data is { subject: Pipeline.Pipeline } => Obj.instanceOf(Pipeline.Pipeline, data.subject),
60
+ component: ({ data, role }) => {
61
+ return <ProjectCard role={role} subject={data.subject} />;
62
+ },
63
+ }),
64
+ Surface.create({
65
+ id: `${meta.id}.schema-popover--task`,
66
+ role: 'card--content',
67
+ position: 'hoist',
68
+ filter: (data): data is { subject: Task.Task } => Obj.instanceOf(Task.Task, data.subject),
69
+ component: ({ data, role }) => {
70
+ return <TaskCard role={role} subject={data.subject} />;
71
+ },
72
+ }),
73
+
74
+ //
75
+ // Fallback for any object.
76
+ //
77
+
78
+ Surface.create({
79
+ id: `${meta.id}.fallback-popover`,
80
+ role: 'card--content',
81
+ position: 'fallback',
82
+ filter: (data): data is { subject: Obj.Unknown; projection?: ProjectionModel } => Obj.isObject(data.subject),
83
+ component: ({ data, role }) => {
84
+ return <FormCard role={role} subject={data.subject} projection={data.projection} />;
85
+ },
86
+ }),
87
+
88
+ Surface.create({
89
+ id: `${meta.id}.fallback-json`,
90
+ role: 'card--content',
91
+ position: 'fallback',
92
+ filter: (data): data is Record<string, unknown> => true,
93
+ component: ({ data }) => {
94
+ return <JsonCard data={data} />;
95
+ },
96
+ }),
97
+
98
+ Surface.create({
99
+ id: `${meta.id}.section`,
100
+ role: ['section'],
101
+ position: 'fallback',
102
+ filter: (data): data is { subject: Obj.Unknown } => Obj.isObject(data.subject),
103
+ component: ({ data }) => {
104
+ return (
105
+ <div role='none' className='flex w-full justify-center'>
106
+ <div role='none' className='pt-2 pb-2 dx-card-min-width dx-card-max-width'>
107
+ <Card.Root>
108
+ <Surface.Surface role='card--content' data={data} limit={1} />
109
+ </Card.Root>
110
+ </div>
111
+ </div>
112
+ );
113
+ },
114
+ }),
115
+ ]),
116
+ ),
117
+ );
@@ -0,0 +1,48 @@
1
+ //
2
+ // Copyright 2025 DXOS.org
3
+ //
4
+
5
+ import React, { useCallback, useMemo } from 'react';
6
+
7
+ import { type SurfaceComponentProps } from '@dxos/app-toolkit/ui';
8
+ import { Obj } from '@dxos/echo';
9
+ import { type JsonPath, splitJsonPath } from '@dxos/effect';
10
+ import { Card, useTranslation } from '@dxos/react-ui';
11
+ import { Form, omitId } from '@dxos/react-ui-form';
12
+ import { type ProjectionModel } from '@dxos/schema';
13
+ import { descriptionMessage, mx } from '@dxos/ui-theme';
14
+
15
+ import { meta } from '../meta';
16
+
17
+ export const FormCard = ({ subject, projection }: SurfaceComponentProps & { projection?: ProjectionModel }) => {
18
+ const { t } = useTranslation(meta.id);
19
+ const echoSchema = Obj.getSchema(subject);
20
+ const schema = useMemo(() => echoSchema && omitId(echoSchema), [echoSchema]);
21
+
22
+ const handleSave = useCallback((values: any, { changed }: { changed: Record<string, boolean> }) => {
23
+ const paths = Object.keys(changed).filter((path) => changed[path]);
24
+ Obj.change(subject, () => {
25
+ for (const path of paths) {
26
+ const value = values[path];
27
+ const parts = splitJsonPath(path as JsonPath);
28
+ Obj.setValue(subject, parts, value);
29
+ }
30
+ });
31
+ }, []);
32
+
33
+ if (!schema) {
34
+ return <p className={mx(descriptionMessage)}>{t('unable to create preview message')}</p>;
35
+ }
36
+
37
+ return (
38
+ <Card.Content>
39
+ <Form.Root schema={schema} projection={projection} values={subject} autoSave onSave={handleSave}>
40
+ <Form.Viewport>
41
+ <Form.Content>
42
+ <Form.FieldSet />
43
+ </Form.Content>
44
+ </Form.Viewport>
45
+ </Form.Root>
46
+ </Card.Content>
47
+ );
48
+ };
@@ -0,0 +1,16 @@
1
+ //
2
+ // Copyright 2025 DXOS.org
3
+ //
4
+
5
+ import React from 'react';
6
+
7
+ import { Card } from '@dxos/react-ui';
8
+ import { Json } from '@dxos/react-ui-syntax-highlighter';
9
+
10
+ export const JsonCard = ({ data }: { data: unknown }) => {
11
+ return (
12
+ <Card.Content>
13
+ <Json data={data} />
14
+ </Card.Content>
15
+ );
16
+ };
@@ -4,31 +4,26 @@
4
4
 
5
5
  import React from 'react';
6
6
 
7
- import { Card } from '@dxos/react-ui-stack';
7
+ import { type SurfaceComponentProps } from '@dxos/app-toolkit/ui';
8
+ import { Card } from '@dxos/react-ui';
8
9
  import { type Organization } from '@dxos/types';
9
10
 
10
- import { CardHeader, CardLink } from '../components';
11
- import { type CardPreviewProps } from '../types';
12
-
13
- export const OrganizationCard = ({
14
- children,
15
- subject,
16
- role,
17
- activeSpace,
18
- }: CardPreviewProps<Organization.Organization>) => {
11
+ export const OrganizationCard = ({ subject }: SurfaceComponentProps<Organization.Organization>) => {
19
12
  const { name, image, description, website } = subject;
20
13
 
21
14
  return (
22
- <Card.SurfaceRoot id={subject.id} role={role}>
15
+ <Card.Content>
23
16
  <Card.Poster
24
17
  alt={name ?? ''}
25
18
  {...(image ? { image } : { icon: 'ph--building-office--regular' })}
26
19
  classNames={!image && 'opacity-50'}
27
20
  />
28
- <CardHeader label={name} subject={subject} activeSpace={activeSpace} />
29
- {description && <Card.Text classNames='line-clamp-2'>{description}</Card.Text>}
30
- {website && <CardLink label={website} href={website} />}
31
- {children}
32
- </Card.SurfaceRoot>
21
+ {description && (
22
+ <Card.Row>
23
+ <Card.Text variant='description'>{description}</Card.Text>
24
+ </Card.Row>
25
+ )}
26
+ {website && <Card.Link label={website} href={website} />}
27
+ </Card.Content>
33
28
  );
34
29
  };
@@ -2,62 +2,64 @@
2
2
  // Copyright 2025 DXOS.org
3
3
  //
4
4
 
5
- import React, { Fragment } from 'react';
5
+ import * as Effect from 'effect/Effect';
6
+ import React, { useCallback } from 'react';
6
7
 
7
- import { Avatar, Icon } from '@dxos/react-ui';
8
- import { Card, cardHeading, cardText } from '@dxos/react-ui-stack';
9
- import { mx } from '@dxos/react-ui-theme';
8
+ import { useOperationInvoker } from '@dxos/app-framework/ui';
9
+ import { LayoutOperation, getObjectPathFromObject, getSpacePath } from '@dxos/app-toolkit';
10
+ import { type SurfaceComponentProps } from '@dxos/app-toolkit/ui';
11
+ import { Obj } from '@dxos/echo';
12
+ import { runAndForwardErrors } from '@dxos/effect';
13
+ import { Avatar } from '@dxos/react-ui';
14
+ import { Card } from '@dxos/react-ui';
10
15
  import { type Person } from '@dxos/types';
11
16
 
12
- import { CardRow, CardSubjectMenu, gridRow } from '../components';
13
- import { type CardPreviewProps } from '../types';
17
+ export const PersonCard = ({ subject }: SurfaceComponentProps<Person.Person>) => {
18
+ const { invoke } = useOperationInvoker();
19
+ const { image, organization: { target: organization } = {}, emails = [] } = subject;
14
20
 
15
- export const PersonCard = ({ children, role, subject, activeSpace, onSelect }: CardPreviewProps<Person.Person>) => {
16
- const { fullName, image, organization: { target: organization } = {}, emails = [] } = subject;
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]);
17
36
 
18
37
  return (
19
- <Card.SurfaceRoot id={subject.id} role={role}>
38
+ <Card.Content>
20
39
  <Avatar.Root>
21
- <Card.Text role='group' classNames={mx('grid gap-2 grid-cols-[1fr_min-content]')}>
22
- <div role='none' className={mx(gridRow, 'grid-rows-2')}>
23
- {activeSpace ? <CardSubjectMenu subject={subject} activeSpace={activeSpace} /> : <div />}
24
- <Avatar.Label asChild>
25
- <h2 className={mx(cardHeading, 'grow truncate')}>{fullName}</h2>
26
- </Avatar.Label>
27
- </div>
28
- <Avatar.Content
29
- imgSrc={image}
30
- icon='ph--user--regular'
31
- size={16}
32
- classNames={['text-subdued', !image && 'opacity-50']}
33
- hue='neutral'
34
- variant='square'
35
- />
36
- </Card.Text>
40
+ {image && (
41
+ <Card.Row className='py-1'>
42
+ <Avatar.Content
43
+ imgSrc={image}
44
+ icon='ph--user--regular'
45
+ size={20}
46
+ classNames={!image && 'opacity-50'}
47
+ hue='neutral'
48
+ variant='square'
49
+ />
50
+ </Card.Row>
51
+ )}
52
+ {organization?.name && (
53
+ <Card.Action icon='ph--buildings--regular' label={organization.name} onClick={handleOrganizationClick} />
54
+ )}
55
+ {emails.map(({ value }) => (
56
+ <Card.Row key={value} icon='ph--at--regular'>
57
+ <Card.Text truncate className='text-primary-text'>
58
+ {value}
59
+ </Card.Text>
60
+ </Card.Row>
61
+ ))}
37
62
  </Avatar.Root>
38
- {organization?.name && (
39
- <CardRow
40
- icon='ph--buildings--regular'
41
- label={organization.name}
42
- onClick={onSelect ? () => onSelect(organization) : undefined}
43
- />
44
- )}
45
- {emails.length > 0 && (
46
- <dl className={mx(cardText, gridRow, '[&_dt]:text-subdued [&_dt]:pbs-0.5 [&_dd]:min-is-0')}>
47
- {emails.map(({ label, value }) => (
48
- <Fragment key={value}>
49
- <dt>
50
- <span className='sr-only'>{label}</span>
51
- <Icon icon='ph--at--regular' size={5} />
52
- </dt>
53
- <dd key={value} className='col-span-2 break-words'>
54
- {value}
55
- </dd>
56
- </Fragment>
57
- ))}
58
- </dl>
59
- )}
60
- {children}
61
- </Card.SurfaceRoot>
63
+ </Card.Content>
62
64
  );
63
65
  };
@@ -4,21 +4,19 @@
4
4
 
5
5
  import React from 'react';
6
6
 
7
+ import { type SurfaceComponentProps } from '@dxos/app-toolkit/ui';
7
8
  import { Obj } from '@dxos/echo';
8
- import { Card } from '@dxos/react-ui-stack';
9
- import { type Project } from '@dxos/types';
9
+ import { Card } from '@dxos/react-ui';
10
+ import { type Pipeline } from '@dxos/types';
10
11
 
11
- import { CardHeader } from '../components';
12
- import { type CardPreviewProps } from '../types';
13
-
14
- export const ProjectCard = ({ subject, role, activeSpace }: CardPreviewProps<Project.Project>) => {
15
- const { name, image, description } = subject;
12
+ export const ProjectCard = ({ subject }: SurfaceComponentProps<Pipeline.Pipeline>) => {
13
+ const { image, description } = subject;
16
14
 
17
15
  return (
18
- <Card.SurfaceRoot id={subject.id} role={role}>
16
+ <Card.Content>
19
17
  {image && <Card.Poster image={image} alt={Obj.getLabel(subject) ?? ''} aspect='auto' />}
20
- <CardHeader label={name} subject={subject} activeSpace={activeSpace} />
21
- {description && <Card.Text classNames='line-clamp-2'>{description}</Card.Text>}
22
- </Card.SurfaceRoot>
18
+ {/* <CardHeader label={name} subject={subject} db={db} /> */}
19
+ {description && <Card.Text variant='description'>{description}</Card.Text>}
20
+ </Card.Content>
23
21
  );
24
22
  };