@dxos/plugin-preview 0.8.4-main.2c6827d → 0.8.4-main.3c1ae3b

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