@dxos/plugin-preview 0.8.4-main.406dc2a → 0.8.4-main.548089c

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 (69) hide show
  1. package/dist/lib/browser/chunk-CEWM5LJG.mjs +17 -0
  2. package/dist/lib/browser/chunk-CEWM5LJG.mjs.map +7 -0
  3. package/dist/lib/browser/index.mjs +5 -5
  4. package/dist/lib/browser/index.mjs.map +3 -3
  5. package/dist/lib/browser/meta.json +1 -1
  6. package/dist/lib/browser/{react-surface-X56QWACK.mjs → react-surface-ZAOGRCMT.mjs} +238 -159
  7. package/dist/lib/browser/react-surface-ZAOGRCMT.mjs.map +7 -0
  8. package/dist/lib/node-esm/{chunk-L3IZVX56.mjs → chunk-Q5MUNELK.mjs} +6 -1
  9. package/dist/lib/node-esm/chunk-Q5MUNELK.mjs.map +7 -0
  10. package/dist/lib/node-esm/index.mjs +5 -5
  11. package/dist/lib/node-esm/index.mjs.map +3 -3
  12. package/dist/lib/node-esm/meta.json +1 -1
  13. package/dist/lib/node-esm/{react-surface-4P7UCMK7.mjs → react-surface-X76BTDM5.mjs} +238 -159
  14. package/dist/lib/node-esm/react-surface-X76BTDM5.mjs.map +7 -0
  15. package/dist/types/src/capabilities/react-surface.d.ts.map +1 -1
  16. package/dist/types/src/cards/OrganizationCard.d.ts +5 -0
  17. package/dist/types/src/cards/OrganizationCard.d.ts.map +1 -0
  18. package/dist/types/src/cards/PersonCard.d.ts +5 -0
  19. package/dist/types/src/cards/PersonCard.d.ts.map +1 -0
  20. package/dist/types/src/cards/ProjectCard.d.ts +5 -0
  21. package/dist/types/src/cards/ProjectCard.d.ts.map +1 -0
  22. package/dist/types/src/{components → cards}/TaskCard.d.ts +2 -2
  23. package/dist/types/src/cards/TaskCard.d.ts.map +1 -0
  24. package/dist/types/src/cards/index.d.ts +5 -0
  25. package/dist/types/src/cards/index.d.ts.map +1 -0
  26. package/dist/types/src/components/CardComponents.d.ts +16 -0
  27. package/dist/types/src/components/CardComponents.d.ts.map +1 -0
  28. package/dist/types/src/components/CardSubjectMenu.d.ts +3 -7
  29. package/dist/types/src/components/CardSubjectMenu.d.ts.map +1 -1
  30. package/dist/types/src/components/index.d.ts +2 -3
  31. package/dist/types/src/components/index.d.ts.map +1 -1
  32. package/dist/types/src/meta.d.ts.map +1 -1
  33. package/dist/types/src/stories/Card.stories.d.ts +0 -1
  34. package/dist/types/src/stories/Card.stories.d.ts.map +1 -1
  35. package/dist/types/src/stories/testing.d.ts +2 -1
  36. package/dist/types/src/stories/testing.d.ts.map +1 -1
  37. package/dist/types/src/types.d.ts +4 -3
  38. package/dist/types/src/types.d.ts.map +1 -1
  39. package/dist/types/tsconfig.tsbuildinfo +1 -1
  40. package/package.json +27 -26
  41. package/src/PreviewPlugin.tsx +2 -2
  42. package/src/capabilities/react-surface.tsx +44 -27
  43. package/src/cards/OrganizationCard.tsx +29 -0
  44. package/src/cards/PersonCard.tsx +63 -0
  45. package/src/cards/ProjectCard.tsx +24 -0
  46. package/src/{components → cards}/TaskCard.tsx +6 -6
  47. package/src/cards/index.ts +8 -0
  48. package/src/components/CardComponents.tsx +67 -0
  49. package/src/components/CardSubjectMenu.tsx +61 -40
  50. package/src/components/index.ts +2 -3
  51. package/src/meta.ts +5 -0
  52. package/src/stories/Card.stories.tsx +5 -2
  53. package/src/stories/testing.tsx +19 -19
  54. package/src/types.ts +5 -4
  55. package/dist/lib/browser/chunk-XKCIQK3C.mjs +0 -12
  56. package/dist/lib/browser/chunk-XKCIQK3C.mjs.map +0 -7
  57. package/dist/lib/browser/react-surface-X56QWACK.mjs.map +0 -7
  58. package/dist/lib/node-esm/chunk-L3IZVX56.mjs.map +0 -7
  59. package/dist/lib/node-esm/react-surface-4P7UCMK7.mjs.map +0 -7
  60. package/dist/types/src/components/ContactCard.d.ts +0 -7
  61. package/dist/types/src/components/ContactCard.d.ts.map +0 -1
  62. package/dist/types/src/components/OrganizationCard.d.ts +0 -5
  63. package/dist/types/src/components/OrganizationCard.d.ts.map +0 -1
  64. package/dist/types/src/components/ProjectCard.d.ts +0 -5
  65. package/dist/types/src/components/ProjectCard.d.ts.map +0 -1
  66. package/dist/types/src/components/TaskCard.d.ts.map +0 -1
  67. package/src/components/ContactCard.tsx +0 -78
  68. package/src/components/OrganizationCard.tsx +0 -44
  69. package/src/components/ProjectCard.tsx +0 -28
@@ -1,39 +1,69 @@
1
1
  import {
2
2
  meta
3
- } from "./chunk-XKCIQK3C.mjs";
3
+ } from "./chunk-CEWM5LJG.mjs";
4
4
 
5
5
  // src/capabilities/react-surface.tsx
6
- import React6, { useCallback } from "react";
7
- import { Capabilities, LayoutAction as LayoutAction2, Surface, contributes, createIntent as createIntent2, createSurface, useIntentDispatcher as useIntentDispatcher2 } from "@dxos/app-framework";
8
- import { fullyQualifiedId as fullyQualifiedId2, getSchema, getSpace } from "@dxos/client/echo";
6
+ import React7, { useCallback } from "react";
7
+ import { Capabilities, LayoutAction as LayoutAction2, contributes, createIntent as createIntent2, createSurface } from "@dxos/app-framework";
8
+ import { Surface, useIntentDispatcher as useIntentDispatcher2 } from "@dxos/app-framework/react";
9
+ import { getSchema, getSpace } from "@dxos/client/echo";
9
10
  import { Obj as Obj3 } from "@dxos/echo";
10
11
  import { setValue } from "@dxos/echo/internal";
11
12
  import { useActiveSpace } from "@dxos/plugin-space";
12
13
  import { useTranslation as useTranslation2 } from "@dxos/react-ui";
13
14
  import { Form } from "@dxos/react-ui-form";
14
- import { Card as Card5 } from "@dxos/react-ui-stack";
15
- import { descriptionMessage, mx as mx5 } from "@dxos/react-ui-theme";
16
- import { DataType as DataType2 } from "@dxos/schema";
15
+ import { Card as Card6 } from "@dxos/react-ui-stack";
16
+ import { descriptionMessage, mx as mx4 } from "@dxos/react-ui-theme";
17
+ import { Organization, Person, Project, Task as Task2 } from "@dxos/types";
17
18
 
18
- // src/components/ContactCard.tsx
19
+ // src/cards/OrganizationCard.tsx
20
+ import { useSignals as _useSignals3 } from "@preact-signals/safe-react/tracking";
21
+ import React3 from "react";
22
+ import { Card as Card2 } from "@dxos/react-ui-stack";
23
+
24
+ // src/components/CardComponents.tsx
19
25
  import { useSignals as _useSignals2 } from "@preact-signals/safe-react/tracking";
20
- import React2, { Fragment } from "react";
21
- import { Avatar, Button, Icon } from "@dxos/react-ui";
22
- import { Card, cardHeading, cardText } from "@dxos/react-ui-stack";
26
+ import React2 from "react";
27
+ import { Button, Icon } from "@dxos/react-ui";
28
+ import { Card, cardNoSpacing, cardSpacing } from "@dxos/react-ui-stack";
23
29
  import { mx } from "@dxos/react-ui-theme";
24
30
 
25
31
  // src/components/CardSubjectMenu.tsx
26
32
  import { useSignals as _useSignals } from "@preact-signals/safe-react/tracking";
27
- import { Rx } from "@effect-rx/rx-react";
33
+ import { Atom } from "@effect-atom/atom-react";
28
34
  import React from "react";
29
- import { LayoutAction, createIntent, useIntentDispatcher } from "@dxos/app-framework";
35
+ import { LayoutAction, createIntent } from "@dxos/app-framework";
36
+ import { useIntentDispatcher } from "@dxos/app-framework/react";
30
37
  import { ACTION_TYPE } from "@dxos/app-graph";
31
38
  import { Obj } from "@dxos/echo";
32
39
  import { SpaceAction } from "@dxos/plugin-space/types";
33
- import { fullyQualifiedId } from "@dxos/react-client/echo";
34
40
  import { IconButton, useTranslation } from "@dxos/react-ui";
35
41
  import { DropdownMenu, MenuProvider, useMenuActions } from "@dxos/react-ui-menu";
36
- var useSubjectMenuGroupItems = (subject, activeSpace) => {
42
+ var CardSubjectMenu = ({ subject, activeSpace, ...props }) => {
43
+ var _effect = _useSignals();
44
+ try {
45
+ const { t } = useTranslation(meta.id);
46
+ const menuProps = useSubjectMenuGroupItems({
47
+ subject,
48
+ activeSpace
49
+ });
50
+ if (!activeSpace) {
51
+ return null;
52
+ }
53
+ return /* @__PURE__ */ React.createElement(MenuProvider, menuProps, /* @__PURE__ */ React.createElement(DropdownMenu.Root, null, /* @__PURE__ */ React.createElement(DropdownMenu.Trigger, {
54
+ asChild: true
55
+ }, /* @__PURE__ */ React.createElement(IconButton, {
56
+ variant: "ghost",
57
+ icon: "ph--dots-three-vertical--bold",
58
+ iconOnly: true,
59
+ label: t("more options label"),
60
+ ...props
61
+ }))));
62
+ } finally {
63
+ _effect.f();
64
+ }
65
+ };
66
+ var useSubjectMenuGroupItems = ({ subject, activeSpace }) => {
37
67
  const { dispatchPromise: dispatch } = useIntentDispatcher();
38
68
  const result = {
39
69
  edges: [],
@@ -45,7 +75,7 @@ var useSubjectMenuGroupItems = (subject, activeSpace) => {
45
75
  data: () => dispatch(createIntent(LayoutAction.Open, {
46
76
  part: "main",
47
77
  subject: [
48
- fullyQualifiedId(subject)
78
+ Obj.getDXN(subject).toString()
49
79
  ]
50
80
  })),
51
81
  properties: {
@@ -85,169 +115,192 @@ var useSubjectMenuGroupItems = (subject, activeSpace) => {
85
115
  target
86
116
  });
87
117
  });
88
- return useMenuActions(Rx.make(result));
118
+ return useMenuActions(Atom.make(result));
89
119
  };
90
- var CardSubjectMenu = ({ subject, activeSpace, ...props }) => {
91
- var _effect = _useSignals();
120
+
121
+ // src/components/CardComponents.tsx
122
+ var gridRow = "is-full grid grid-cols-[1.5rem_1fr_min-content] gap-2 items-center";
123
+ var CardHeader = ({ label, subject, activeSpace }) => {
124
+ var _effect = _useSignals2();
92
125
  try {
93
- const { t } = useTranslation(meta.id);
94
- const menuProps = useSubjectMenuGroupItems(subject, activeSpace);
95
- if (!activeSpace) {
96
- return null;
97
- }
98
- return /* @__PURE__ */ React.createElement(MenuProvider, menuProps, /* @__PURE__ */ React.createElement(DropdownMenu.Root, null, /* @__PURE__ */ React.createElement(DropdownMenu.Trigger, {
99
- asChild: true
100
- }, /* @__PURE__ */ React.createElement(IconButton, {
101
- iconOnly: true,
102
- variant: "ghost",
103
- icon: "ph--dots-three-vertical--bold",
104
- label: t("more options label"),
105
- ...props
106
- }))));
126
+ return /* @__PURE__ */ React2.createElement("div", {
127
+ role: "none",
128
+ className: mx("flex items-center gap-2", cardSpacing)
129
+ }, /* @__PURE__ */ React2.createElement(Card.Heading, {
130
+ classNames: cardNoSpacing
131
+ }, label), /* @__PURE__ */ React2.createElement(CardSubjectMenu, {
132
+ subject,
133
+ activeSpace
134
+ }));
107
135
  } finally {
108
136
  _effect.f();
109
137
  }
110
138
  };
111
-
112
- // src/components/ContactCard.tsx
113
- var ContactCard = ({ children, subject, activeSpace, onOrgClick, role }) => {
139
+ var CardRow = ({ icon, label, onClick }) => {
114
140
  var _effect = _useSignals2();
115
141
  try {
116
- const { fullName, image, organization, emails } = subject;
117
- const organizationName = organization && typeof organization === "object" ? organization.target?.name : organization;
118
- return /* @__PURE__ */ React2.createElement(Card.SurfaceRoot, {
119
- role
120
- }, /* @__PURE__ */ React2.createElement(Avatar.Root, null, /* @__PURE__ */ React2.createElement(Card.Text, {
121
- role: "group",
122
- classNames: "grid gap-3 grid-cols-[min-content_1fr]"
123
- }, /* @__PURE__ */ React2.createElement(Avatar.Content, {
124
- imgSrc: image,
125
- icon: "ph--user--regular",
126
- size: 16,
127
- hue: "neutral"
128
- }), /* @__PURE__ */ React2.createElement("div", {
129
- role: "none",
130
- className: "bs-min self-center flex items-center"
131
- }, /* @__PURE__ */ React2.createElement(Avatar.Label, {
132
- asChild: true
133
- }, /* @__PURE__ */ React2.createElement("h2", {
134
- className: mx(cardHeading, "grow")
135
- }, fullName)), /* @__PURE__ */ React2.createElement(CardSubjectMenu, {
136
- subject,
137
- activeSpace
138
- })))), organizationName && /* @__PURE__ */ React2.createElement(Card.Chrome, null, typeof organization === "object" && onOrgClick ? /* @__PURE__ */ React2.createElement(Button, {
142
+ if (!onClick) {
143
+ return /* @__PURE__ */ React2.createElement(Card.Chrome, null, /* @__PURE__ */ React2.createElement("p", {
144
+ "data-variant": "ghost",
145
+ className: mx(gridRow, "dx-button")
146
+ }, /* @__PURE__ */ React2.createElement(Icon, {
147
+ icon,
148
+ size: 5,
149
+ classNames: "text-subdued"
150
+ }), /* @__PURE__ */ React2.createElement("span", {
151
+ className: "min-is-0 flex-1 truncate col-span-2"
152
+ }, label)));
153
+ }
154
+ return /* @__PURE__ */ React2.createElement(Card.Chrome, null, /* @__PURE__ */ React2.createElement(Button, {
139
155
  variant: "ghost",
140
- classNames: "gap-2 text-start",
141
- onClick: () => onOrgClick(organization.target)
156
+ classNames: mx(gridRow, "text-start"),
157
+ onClick
142
158
  }, /* @__PURE__ */ React2.createElement(Icon, {
143
- icon: "ph--buildings--regular",
159
+ icon,
144
160
  size: 5,
145
161
  classNames: "text-subdued"
146
162
  }), /* @__PURE__ */ React2.createElement("span", {
147
163
  className: "min-is-0 flex-1 truncate"
148
- }, organizationName), /* @__PURE__ */ React2.createElement(Icon, {
164
+ }, label), /* @__PURE__ */ React2.createElement(Icon, {
149
165
  icon: "ph--arrow-right--regular"
150
- })) : /* @__PURE__ */ React2.createElement("p", {
151
- className: "dx-button gap-2",
152
- "data-variant": "ghost"
166
+ })));
167
+ } finally {
168
+ _effect.f();
169
+ }
170
+ };
171
+ var CardLink = ({ label, href }) => {
172
+ var _effect = _useSignals2();
173
+ try {
174
+ return /* @__PURE__ */ React2.createElement(Card.Chrome, null, /* @__PURE__ */ React2.createElement("a", {
175
+ className: mx(gridRow, "dx-button dx-focus-ring"),
176
+ "data-variant": "ghost",
177
+ href,
178
+ target: "_blank",
179
+ rel: "noreferrer"
153
180
  }, /* @__PURE__ */ React2.createElement(Icon, {
154
- icon: "ph--buildings--regular",
181
+ icon: "ph--link--regular",
155
182
  size: 5,
156
183
  classNames: "text-subdued"
157
184
  }), /* @__PURE__ */ React2.createElement("span", {
158
185
  className: "min-is-0 flex-1 truncate"
159
- }, organizationName))), emails?.length && /* @__PURE__ */ React2.createElement("dl", {
160
- className: mx(cardText, "grid gap-2 grid-cols-[min-content_1fr] [&_dt]:text-subdued [&_dt]:pbs-0.5 [&_dd]:min-is-0")
161
- }, emails?.length && emails.map(({ label, value }) => /* @__PURE__ */ React2.createElement(Fragment, {
162
- key: value
163
- }, /* @__PURE__ */ React2.createElement("dt", null, /* @__PURE__ */ React2.createElement("span", {
164
- className: "sr-only"
165
186
  }, label), /* @__PURE__ */ React2.createElement(Icon, {
166
- icon: "ph--at--regular",
167
- size: 5
168
- })), /* @__PURE__ */ React2.createElement("dd", {
169
- key: value,
170
- className: "break-words"
171
- }, value)))), children);
187
+ icon: "ph--arrow-square-out--regular"
188
+ })));
172
189
  } finally {
173
190
  _effect.f();
174
191
  }
175
192
  };
176
193
 
177
- // src/components/OrganizationCard.tsx
178
- import { useSignals as _useSignals3 } from "@preact-signals/safe-react/tracking";
179
- import React3 from "react";
180
- import { Icon as Icon2 } from "@dxos/react-ui";
181
- import { Card as Card2, cardNoSpacing, cardSpacing } from "@dxos/react-ui-stack";
182
- import { mx as mx2 } from "@dxos/react-ui-theme";
194
+ // src/cards/OrganizationCard.tsx
183
195
  var OrganizationCard = ({ children, subject, role, activeSpace }) => {
184
196
  var _effect = _useSignals3();
185
197
  try {
186
198
  const { name, image, description, website } = subject;
187
199
  return /* @__PURE__ */ React3.createElement(Card2.SurfaceRoot, {
200
+ id: subject.id,
188
201
  role
189
202
  }, /* @__PURE__ */ React3.createElement(Card2.Poster, {
190
- alt: name,
203
+ alt: name ?? "",
191
204
  ...image ? {
192
205
  image
193
206
  } : {
194
207
  icon: "ph--building-office--regular"
195
- }
196
- }), /* @__PURE__ */ React3.createElement("div", {
197
- role: "none",
198
- className: mx2("flex items-center gap-2", cardSpacing)
199
- }, /* @__PURE__ */ React3.createElement(Card2.Heading, {
200
- classNames: cardNoSpacing
201
- }, name), /* @__PURE__ */ React3.createElement(CardSubjectMenu, {
208
+ },
209
+ classNames: !image && "opacity-50"
210
+ }), /* @__PURE__ */ React3.createElement(CardHeader, {
211
+ label: name,
202
212
  subject,
203
213
  activeSpace
204
- })), description && /* @__PURE__ */ React3.createElement(Card2.Text, {
214
+ }), description && /* @__PURE__ */ React3.createElement(Card2.Text, {
205
215
  classNames: "line-clamp-2"
206
- }, description), website && /* @__PURE__ */ React3.createElement(Card2.Chrome, null, /* @__PURE__ */ React3.createElement("a", {
207
- className: "dx-button dx-focus-ring gap-2",
208
- "data-variant": "ghost",
209
- href: website,
210
- target: "_blank",
211
- rel: "noreferrer"
212
- }, /* @__PURE__ */ React3.createElement(Icon2, {
213
- icon: "ph--link--regular",
214
- size: 5,
215
- classNames: "text-subdued"
216
- }), /* @__PURE__ */ React3.createElement("span", {
217
- className: "min-is-0 flex-1 truncate"
218
- }, website), /* @__PURE__ */ React3.createElement(Icon2, {
219
- icon: "ph--arrow-square-out--regular"
220
- }))), children);
216
+ }, description), website && /* @__PURE__ */ React3.createElement(CardLink, {
217
+ label: website,
218
+ href: website
219
+ }), children);
221
220
  } finally {
222
221
  _effect.f();
223
222
  }
224
223
  };
225
224
 
226
- // src/components/ProjectCard.tsx
225
+ // src/cards/PersonCard.tsx
227
226
  import { useSignals as _useSignals4 } from "@preact-signals/safe-react/tracking";
228
- import React4 from "react";
227
+ import React4, { Fragment } from "react";
228
+ import { Avatar, Icon as Icon2 } from "@dxos/react-ui";
229
+ import { Card as Card3, cardHeading, cardText } from "@dxos/react-ui-stack";
230
+ import { mx as mx2 } from "@dxos/react-ui-theme";
231
+ var PersonCard = ({ children, role, subject, activeSpace, onSelect }) => {
232
+ var _effect = _useSignals4();
233
+ try {
234
+ const { fullName, image, organization: { target: organization } = {}, emails = [] } = subject;
235
+ return /* @__PURE__ */ React4.createElement(Card3.SurfaceRoot, {
236
+ id: subject.id,
237
+ role
238
+ }, /* @__PURE__ */ React4.createElement(Avatar.Root, null, /* @__PURE__ */ React4.createElement(Card3.Text, {
239
+ role: "group",
240
+ classNames: mx2("grid gap-2 grid-cols-[1fr_min-content]")
241
+ }, /* @__PURE__ */ React4.createElement("div", {
242
+ role: "none",
243
+ className: mx2(gridRow, "grid-rows-2")
244
+ }, activeSpace ? /* @__PURE__ */ React4.createElement(CardSubjectMenu, {
245
+ subject,
246
+ activeSpace
247
+ }) : /* @__PURE__ */ React4.createElement("div", null), /* @__PURE__ */ React4.createElement(Avatar.Label, {
248
+ asChild: true
249
+ }, /* @__PURE__ */ React4.createElement("h2", {
250
+ className: mx2(cardHeading, "grow truncate")
251
+ }, fullName))), /* @__PURE__ */ React4.createElement(Avatar.Content, {
252
+ imgSrc: image,
253
+ icon: "ph--user--regular",
254
+ size: 16,
255
+ classNames: [
256
+ "text-subdued",
257
+ !image && "opacity-50"
258
+ ],
259
+ hue: "neutral",
260
+ variant: "square"
261
+ }))), organization?.name && /* @__PURE__ */ React4.createElement(CardRow, {
262
+ icon: "ph--buildings--regular",
263
+ label: organization.name,
264
+ onClick: onSelect ? () => onSelect(organization) : void 0
265
+ }), emails.length > 0 && /* @__PURE__ */ React4.createElement("dl", {
266
+ className: mx2(cardText, gridRow, "[&_dt]:text-subdued [&_dt]:pbs-0.5 [&_dd]:min-is-0")
267
+ }, emails.map(({ label, value }) => /* @__PURE__ */ React4.createElement(Fragment, {
268
+ key: value
269
+ }, /* @__PURE__ */ React4.createElement("dt", null, /* @__PURE__ */ React4.createElement("span", {
270
+ className: "sr-only"
271
+ }, label), /* @__PURE__ */ React4.createElement(Icon2, {
272
+ icon: "ph--at--regular",
273
+ size: 5
274
+ })), /* @__PURE__ */ React4.createElement("dd", {
275
+ key: value,
276
+ className: "col-span-2 break-words"
277
+ }, value)))), children);
278
+ } finally {
279
+ _effect.f();
280
+ }
281
+ };
282
+
283
+ // src/cards/ProjectCard.tsx
284
+ import { useSignals as _useSignals5 } from "@preact-signals/safe-react/tracking";
285
+ import React5 from "react";
229
286
  import { Obj as Obj2 } from "@dxos/echo";
230
- import { Card as Card3, cardNoSpacing as cardNoSpacing2, cardSpacing as cardSpacing2 } from "@dxos/react-ui-stack";
231
- import { mx as mx3 } from "@dxos/react-ui-theme";
287
+ import { Card as Card4 } from "@dxos/react-ui-stack";
232
288
  var ProjectCard = ({ subject, role, activeSpace }) => {
233
- var _effect = _useSignals4();
289
+ var _effect = _useSignals5();
234
290
  try {
235
291
  const { name, image, description } = subject;
236
- return /* @__PURE__ */ React4.createElement(Card3.SurfaceRoot, {
292
+ return /* @__PURE__ */ React5.createElement(Card4.SurfaceRoot, {
293
+ id: subject.id,
237
294
  role
238
- }, image && /* @__PURE__ */ React4.createElement(Card3.Poster, {
295
+ }, image && /* @__PURE__ */ React5.createElement(Card4.Poster, {
239
296
  image,
240
297
  alt: Obj2.getLabel(subject) ?? "",
241
298
  aspect: "auto"
242
- }), /* @__PURE__ */ React4.createElement("div", {
243
- role: "none",
244
- className: mx3("flex items-center gap-2", cardSpacing2)
245
- }, /* @__PURE__ */ React4.createElement(Card3.Heading, {
246
- classNames: cardNoSpacing2
247
- }, name), /* @__PURE__ */ React4.createElement(CardSubjectMenu, {
299
+ }), /* @__PURE__ */ React5.createElement(CardHeader, {
300
+ label: name,
248
301
  subject,
249
302
  activeSpace
250
- })), description && /* @__PURE__ */ React4.createElement(Card3.Text, {
303
+ }), description && /* @__PURE__ */ React5.createElement(Card4.Text, {
251
304
  classNames: "line-clamp-2"
252
305
  }, description));
253
306
  } finally {
@@ -255,16 +308,16 @@ var ProjectCard = ({ subject, role, activeSpace }) => {
255
308
  }
256
309
  };
257
310
 
258
- // src/components/TaskCard.tsx
259
- import { useSignals as _useSignals5 } from "@preact-signals/safe-react/tracking";
311
+ // src/cards/TaskCard.tsx
312
+ import { useSignals as _useSignals6 } from "@preact-signals/safe-react/tracking";
260
313
  import * as SchemaAST from "effect/SchemaAST";
261
- import React5 from "react";
314
+ import React6 from "react";
262
315
  import { PropertyMetaAnnotationId } from "@dxos/echo/internal";
263
- import { Card as Card4, cardNoSpacing as cardNoSpacing3, cardSpacing as cardSpacing3 } from "@dxos/react-ui-stack";
264
- import { mx as mx4 } from "@dxos/react-ui-theme";
265
- import { DataType } from "@dxos/schema";
316
+ import { Card as Card5, cardNoSpacing as cardNoSpacing2, cardSpacing as cardSpacing2 } from "@dxos/react-ui-stack";
317
+ import { mx as mx3 } from "@dxos/react-ui-theme";
318
+ import { Task } from "@dxos/types";
266
319
  var getActiveStatusOption = (status) => {
267
- const properties = SchemaAST.getPropertySignatures(DataType.Task.ast);
320
+ const properties = SchemaAST.getPropertySignatures(Task.Task.ast);
268
321
  const statusProperty = properties.find((p) => p.name === "status");
269
322
  const statusMeta = SchemaAST.getAnnotation(PropertyMetaAnnotationId)(
270
323
  // TODO(thure): Typescript asserts `.type` doesn’t have `.types`, but in runtime it does.
@@ -274,24 +327,25 @@ var getActiveStatusOption = (status) => {
274
327
  return options.find(({ id }) => id === status);
275
328
  };
276
329
  var TaskCard = ({ subject, role, activeSpace }) => {
277
- var _effect = _useSignals5();
330
+ var _effect = _useSignals6();
278
331
  try {
279
332
  const { title, status } = subject;
280
333
  const statusOption = getActiveStatusOption(status);
281
- return /* @__PURE__ */ React5.createElement(Card4.SurfaceRoot, {
334
+ return /* @__PURE__ */ React6.createElement(Card5.SurfaceRoot, {
335
+ id: subject.id,
282
336
  role
283
- }, /* @__PURE__ */ React5.createElement("div", {
337
+ }, /* @__PURE__ */ React6.createElement("div", {
284
338
  role: "none",
285
- className: mx4("flex items-center gap-2", cardSpacing3)
286
- }, /* @__PURE__ */ React5.createElement(Card4.Heading, {
339
+ className: mx3("flex items-center gap-2", cardSpacing2)
340
+ }, /* @__PURE__ */ React6.createElement(Card5.Heading, {
287
341
  classNames: [
288
- cardNoSpacing3,
342
+ cardNoSpacing2,
289
343
  "min-is-0 flex-1 truncate"
290
344
  ]
291
- }, title), statusOption && /* @__PURE__ */ React5.createElement("span", {
345
+ }, title), statusOption && /* @__PURE__ */ React6.createElement("span", {
292
346
  className: "dx-tag",
293
347
  "data-hue": statusOption.color
294
- }, statusOption.title), /* @__PURE__ */ React5.createElement(CardSubjectMenu, {
348
+ }, statusOption.title), /* @__PURE__ */ React6.createElement(CardSubjectMenu, {
295
349
  subject,
296
350
  activeSpace
297
351
  })));
@@ -304,6 +358,7 @@ var TaskCard = ({ subject, role, activeSpace }) => {
304
358
  var react_surface_default = (() => contributes(Capabilities.ReactSurface, [
305
359
  //
306
360
  // Specific schema types.
361
+ // TODO(burdon): Create helpers and factor out.
307
362
  //
308
363
  createSurface({
309
364
  id: `${meta.id}/schema-popover--contact`,
@@ -314,15 +369,15 @@ var react_surface_default = (() => contributes(Capabilities.ReactSurface, [
314
369
  "card--extrinsic",
315
370
  "card"
316
371
  ],
317
- filter: (data) => Obj3.instanceOf(DataType2.Person, data.subject),
372
+ filter: (data) => Obj3.instanceOf(Person.Person, data.subject),
318
373
  component: ({ data, role }) => {
319
374
  const { dispatchPromise: dispatch } = useIntentDispatcher2();
320
375
  const space = getSpace(data.subject);
321
376
  const activeSpace = useActiveSpace();
322
- const handleOrgClick = useCallback((org) => dispatch(createIntent2(LayoutAction2.Open, {
377
+ const handleSelect = useCallback((object) => dispatch(createIntent2(LayoutAction2.Open, {
323
378
  part: "main",
324
379
  subject: [
325
- fullyQualifiedId2(org)
380
+ Obj3.getDXN(object).toString()
326
381
  ],
327
382
  options: {
328
383
  workspace: space?.id
@@ -330,12 +385,12 @@ var react_surface_default = (() => contributes(Capabilities.ReactSurface, [
330
385
  })), [
331
386
  dispatch
332
387
  ]);
333
- return /* @__PURE__ */ React6.createElement(ContactCard, {
388
+ return /* @__PURE__ */ React7.createElement(PersonCard, {
334
389
  role,
335
390
  subject: data.subject,
336
391
  activeSpace,
337
- onOrgClick: handleOrgClick
338
- }, role === "card--popover" && /* @__PURE__ */ React6.createElement(Surface, {
392
+ onSelect: handleSelect
393
+ }, role === "card--popover" && /* @__PURE__ */ React7.createElement(Surface, {
339
394
  role: "related",
340
395
  data
341
396
  }));
@@ -350,14 +405,14 @@ var react_surface_default = (() => contributes(Capabilities.ReactSurface, [
350
405
  "card--extrinsic",
351
406
  "card"
352
407
  ],
353
- filter: (data) => Obj3.instanceOf(DataType2.Organization, data.subject),
408
+ filter: (data) => Obj3.instanceOf(Organization.Organization, data.subject),
354
409
  component: ({ data, role }) => {
355
410
  const activeSpace = useActiveSpace();
356
- return /* @__PURE__ */ React6.createElement(OrganizationCard, {
411
+ return /* @__PURE__ */ React7.createElement(OrganizationCard, {
357
412
  role,
358
413
  subject: data.subject,
359
414
  activeSpace
360
- }, role === "card--popover" && /* @__PURE__ */ React6.createElement(Surface, {
415
+ }, role === "card--popover" && /* @__PURE__ */ React7.createElement(Surface, {
361
416
  role: "related",
362
417
  data
363
418
  }));
@@ -372,10 +427,10 @@ var react_surface_default = (() => contributes(Capabilities.ReactSurface, [
372
427
  "card--extrinsic",
373
428
  "card"
374
429
  ],
375
- filter: (data) => Obj3.instanceOf(DataType2.Project, data.subject),
430
+ filter: (data) => Obj3.instanceOf(Project.Project, data.subject),
376
431
  component: ({ data, role }) => {
377
432
  const activeSpace = useActiveSpace();
378
- return /* @__PURE__ */ React6.createElement(ProjectCard, {
433
+ return /* @__PURE__ */ React7.createElement(ProjectCard, {
379
434
  subject: data.subject,
380
435
  role,
381
436
  activeSpace
@@ -391,11 +446,13 @@ var react_surface_default = (() => contributes(Capabilities.ReactSurface, [
391
446
  "card--extrinsic",
392
447
  "card"
393
448
  ],
394
- filter: (data) => Obj3.instanceOf(DataType2.Task, data.subject),
395
- component: ({ data, role }) => /* @__PURE__ */ React6.createElement(TaskCard, {
396
- subject: data.subject,
397
- role
398
- })
449
+ filter: (data) => Obj3.instanceOf(Task2.Task, data.subject),
450
+ component: ({ data, role }) => {
451
+ return /* @__PURE__ */ React7.createElement(TaskCard, {
452
+ subject: data.subject,
453
+ role
454
+ });
455
+ }
399
456
  }),
400
457
  //
401
458
  // Fallback for any object.
@@ -415,8 +472,8 @@ var react_surface_default = (() => contributes(Capabilities.ReactSurface, [
415
472
  const schema = getSchema(data.subject);
416
473
  const { t } = useTranslation2(meta.id);
417
474
  if (!schema) {
418
- return /* @__PURE__ */ React6.createElement("p", {
419
- className: mx5(descriptionMessage)
475
+ return /* @__PURE__ */ React7.createElement("p", {
476
+ className: mx4(descriptionMessage)
420
477
  }, t("unable to create preview message"));
421
478
  }
422
479
  const handleSave = useCallback((values, { changed }) => {
@@ -426,9 +483,10 @@ var react_surface_default = (() => contributes(Capabilities.ReactSurface, [
426
483
  setValue(data.subject, path, value);
427
484
  }
428
485
  }, []);
429
- return /* @__PURE__ */ React6.createElement(Card5.SurfaceRoot, {
486
+ return /* @__PURE__ */ React7.createElement(Card6.SurfaceRoot, {
430
487
  role
431
- }, /* @__PURE__ */ React6.createElement(Form, {
488
+ }, /* @__PURE__ */ React7.createElement(Form, {
489
+ id: data.subject.id,
432
490
  schema,
433
491
  projection: data.projection,
434
492
  values: data.subject,
@@ -440,9 +498,30 @@ var react_surface_default = (() => contributes(Capabilities.ReactSurface, [
440
498
  }
441
499
  }));
442
500
  }
501
+ }),
502
+ createSurface({
503
+ id: `${meta.id}/section`,
504
+ role: [
505
+ "section"
506
+ ],
507
+ position: "fallback",
508
+ filter: (data) => Obj3.isObject(data.subject),
509
+ component: ({ data }) => {
510
+ return /* @__PURE__ */ React7.createElement("div", {
511
+ role: "none",
512
+ className: "flex is-full justify-center"
513
+ }, /* @__PURE__ */ React7.createElement("div", {
514
+ role: "none",
515
+ className: "pbs-2 pbe-2 card-min-width card-max-width"
516
+ }, /* @__PURE__ */ React7.createElement(Surface, {
517
+ role: "card",
518
+ data,
519
+ limit: 1
520
+ })));
521
+ }
443
522
  })
444
523
  ]));
445
524
  export {
446
525
  react_surface_default as default
447
526
  };
448
- //# sourceMappingURL=react-surface-X56QWACK.mjs.map
527
+ //# sourceMappingURL=react-surface-ZAOGRCMT.mjs.map