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