@dxos/plugin-preview 0.8.2-main.2f9c567 → 0.8.2-main.36232bc
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 +31 -53
- package/dist/lib/browser/index.mjs.map +3 -3
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/node/index.cjs +31 -55
- package/dist/lib/node/index.cjs.map +3 -3
- package/dist/lib/node/meta.json +1 -1
- package/dist/lib/node-esm/index.mjs +31 -53
- package/dist/lib/node-esm/index.mjs.map +3 -3
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/types/src/Preview.stories.d.ts +11 -17
- package/dist/types/src/Preview.stories.d.ts.map +1 -1
- package/dist/types/src/PreviewPlugin.d.ts.map +1 -1
- package/dist/types/src/components/ContactCard.d.ts +3 -3
- package/dist/types/src/components/ContactCard.d.ts.map +1 -1
- package/dist/types/src/components/OrganizationCard.d.ts +2 -2
- package/dist/types/src/components/OrganizationCard.d.ts.map +1 -1
- package/dist/types/src/components/ProjectCard.d.ts +2 -2
- package/dist/types/src/components/ProjectCard.d.ts.map +1 -1
- package/dist/types/src/types.d.ts +1 -4
- package/dist/types/src/types.d.ts.map +1 -1
- package/package.json +20 -21
- package/src/Preview.stories.tsx +4 -10
- package/src/PreviewPlugin.tsx +22 -31
- package/src/components/ContactCard.tsx +4 -5
- package/src/components/OrganizationCard.tsx +5 -6
- package/src/components/ProjectCard.tsx +4 -8
- package/src/types.ts +1 -4
|
@@ -8,9 +8,7 @@ var meta = {
|
|
|
8
8
|
};
|
|
9
9
|
|
|
10
10
|
// packages/plugins/plugin-preview/src/types.ts
|
|
11
|
-
var
|
|
12
|
-
var defaultCard = "";
|
|
13
|
-
var kanbanCardWithoutPoster = "pbs-[--rail-action]";
|
|
11
|
+
var previewCard = "popover-max-width rounded-lg overflow-hidden";
|
|
14
12
|
var previewTitle = "text-lg font-medium line-clamp-2";
|
|
15
13
|
var previewProse = "pli-3 mlb-3";
|
|
16
14
|
var previewChrome = "pli-1.5 mlb-1.5 [&_.dx-button]:pli-1.5 [&_.dx-button]:text-start [&_.dx-button]:is-full";
|
|
@@ -29,17 +27,17 @@ import { useTranslation } from "@dxos/react-ui";
|
|
|
29
27
|
import { Form } from "@dxos/react-ui-form";
|
|
30
28
|
import { TableType } from "@dxos/react-ui-table";
|
|
31
29
|
import { descriptionMessage } from "@dxos/react-ui-theme";
|
|
32
|
-
import {
|
|
30
|
+
import { Contact, Organization, Project } from "@dxos/schema";
|
|
33
31
|
|
|
34
32
|
// packages/plugins/plugin-preview/src/components/ContactCard.tsx
|
|
35
33
|
import React, { Fragment } from "react";
|
|
36
34
|
import { Icon, Avatar, Button } from "@dxos/react-ui";
|
|
37
35
|
import { mx } from "@dxos/react-ui-theme";
|
|
38
|
-
var ContactCard = ({ children, classNames,
|
|
36
|
+
var ContactCard = ({ children, classNames, subject: { fullName, image, organization, emails }, onOrgClick }) => {
|
|
39
37
|
const organizationName = organization && typeof organization === "object" ? organization.target?.name : organization;
|
|
40
38
|
return /* @__PURE__ */ React.createElement("div", {
|
|
41
39
|
role: "none",
|
|
42
|
-
className: mx(
|
|
40
|
+
className: mx(previewCard, classNames)
|
|
43
41
|
}, /* @__PURE__ */ React.createElement(Avatar.Root, null, /* @__PURE__ */ React.createElement("div", {
|
|
44
42
|
role: "group",
|
|
45
43
|
className: mx(previewProse, "grid gap-3 grid-cols-[min-content_1fr]")
|
|
@@ -96,17 +94,17 @@ var ContactCard = ({ children, classNames, role, subject: { fullName, image, org
|
|
|
96
94
|
import React2 from "react";
|
|
97
95
|
import { Icon as Icon2 } from "@dxos/react-ui";
|
|
98
96
|
import { mx as mx2 } from "@dxos/react-ui-theme";
|
|
99
|
-
var OrganizationCard = ({ children, classNames, subject: { name, image, description, website }
|
|
97
|
+
var OrganizationCard = ({ children, classNames, subject: { name, image, description, website } }) => {
|
|
100
98
|
return /* @__PURE__ */ React2.createElement("div", {
|
|
101
99
|
role: "none",
|
|
102
|
-
className: mx2(
|
|
100
|
+
className: mx2(previewCard, classNames)
|
|
103
101
|
}, image ? /* @__PURE__ */ React2.createElement("img", {
|
|
104
102
|
className: "aspect-video object-cover is-full bs-auto",
|
|
105
103
|
src: image,
|
|
106
104
|
alt: name
|
|
107
105
|
}) : /* @__PURE__ */ React2.createElement("div", {
|
|
108
106
|
role: "image",
|
|
109
|
-
className: "grid aspect-video place-items-center bg-
|
|
107
|
+
className: "grid aspect-video place-items-center bg-groupSurface text-subdued"
|
|
110
108
|
}, /* @__PURE__ */ React2.createElement(Icon2, {
|
|
111
109
|
icon: "ph--building-office--regular",
|
|
112
110
|
size: 10
|
|
@@ -136,10 +134,10 @@ var OrganizationCard = ({ children, classNames, subject: { name, image, descript
|
|
|
136
134
|
// packages/plugins/plugin-preview/src/components/ProjectCard.tsx
|
|
137
135
|
import React3 from "react";
|
|
138
136
|
import { mx as mx3 } from "@dxos/react-ui-theme";
|
|
139
|
-
var ProjectCard = ({ classNames,
|
|
137
|
+
var ProjectCard = ({ classNames, subject: { name, image, description } }) => {
|
|
140
138
|
return /* @__PURE__ */ React3.createElement("div", {
|
|
141
139
|
role: "none",
|
|
142
|
-
className: mx3(
|
|
140
|
+
className: mx3(previewCard, classNames)
|
|
143
141
|
}, image && /* @__PURE__ */ React3.createElement("img", {
|
|
144
142
|
className: "is-full bs-auto",
|
|
145
143
|
src: image,
|
|
@@ -190,8 +188,8 @@ var PreviewPlugin = () => definePlugin(meta, [
|
|
|
190
188
|
activatesOn: ClientEvents.SetupSchema,
|
|
191
189
|
activate: () => [
|
|
192
190
|
contributes(ClientCapabilities.Schema, [
|
|
193
|
-
|
|
194
|
-
|
|
191
|
+
Contact,
|
|
192
|
+
Organization
|
|
195
193
|
])
|
|
196
194
|
]
|
|
197
195
|
}),
|
|
@@ -225,7 +223,7 @@ var PreviewPlugin = () => definePlugin(meta, [
|
|
|
225
223
|
if (!document.defaultView) {
|
|
226
224
|
log.warn("No default view found", void 0, {
|
|
227
225
|
F: __dxlog_file,
|
|
228
|
-
L:
|
|
226
|
+
L: 105,
|
|
229
227
|
S: void 0,
|
|
230
228
|
C: (f, a) => f(...a)
|
|
231
229
|
});
|
|
@@ -246,18 +244,15 @@ var PreviewPlugin = () => definePlugin(meta, [
|
|
|
246
244
|
//
|
|
247
245
|
createSurface({
|
|
248
246
|
id: `${PREVIEW_PLUGIN}/schema-popover`,
|
|
249
|
-
role:
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
],
|
|
253
|
-
filter: (data) => isInstanceOf(DataType.Person, data.subject),
|
|
254
|
-
component: ({ data, role }) => {
|
|
247
|
+
role: "popover",
|
|
248
|
+
filter: (data) => isInstanceOf(Contact, data.subject),
|
|
249
|
+
component: ({ data }) => {
|
|
255
250
|
const { dispatchPromise: dispatch } = useIntentDispatcher();
|
|
256
251
|
const handleOrgClick = useCallback(async (org) => {
|
|
257
252
|
const space = getSpace(org);
|
|
258
253
|
const tablesQuery = await space?.db.query(Filter.schema(TableType)).run();
|
|
259
254
|
const currentSpaceOrgTable = tablesQuery?.objects.find((table) => {
|
|
260
|
-
return table.view?.target?.query?.typename ===
|
|
255
|
+
return table.view?.target?.query?.typename === Organization.typename;
|
|
261
256
|
});
|
|
262
257
|
await dispatch(createIntent(LayoutAction.UpdatePopover, {
|
|
263
258
|
part: "popover",
|
|
@@ -282,9 +277,8 @@ var PreviewPlugin = () => definePlugin(meta, [
|
|
|
282
277
|
]);
|
|
283
278
|
return /* @__PURE__ */ React4.createElement(ContactCard, {
|
|
284
279
|
subject: data.subject,
|
|
285
|
-
onOrgClick: handleOrgClick
|
|
286
|
-
|
|
287
|
-
}, role === "popover" && /* @__PURE__ */ React4.createElement(Surface, {
|
|
280
|
+
onOrgClick: handleOrgClick
|
|
281
|
+
}, /* @__PURE__ */ React4.createElement(Surface, {
|
|
288
282
|
role: "related",
|
|
289
283
|
data
|
|
290
284
|
}));
|
|
@@ -292,29 +286,21 @@ var PreviewPlugin = () => definePlugin(meta, [
|
|
|
292
286
|
}),
|
|
293
287
|
createSurface({
|
|
294
288
|
id: `${PREVIEW_PLUGIN}/schema-popover`,
|
|
295
|
-
role:
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
component: ({ data, role }) => /* @__PURE__ */ React4.createElement(OrganizationCard, {
|
|
301
|
-
subject: data.subject,
|
|
302
|
-
role
|
|
303
|
-
}, role === "popover" && /* @__PURE__ */ React4.createElement(Surface, {
|
|
289
|
+
role: "popover",
|
|
290
|
+
filter: (data) => isInstanceOf(Organization, data.subject),
|
|
291
|
+
component: ({ data }) => /* @__PURE__ */ React4.createElement(OrganizationCard, {
|
|
292
|
+
subject: data.subject
|
|
293
|
+
}, /* @__PURE__ */ React4.createElement(Surface, {
|
|
304
294
|
role: "related",
|
|
305
295
|
data
|
|
306
296
|
}))
|
|
307
297
|
}),
|
|
308
298
|
createSurface({
|
|
309
299
|
id: `${PREVIEW_PLUGIN}/schema-popover`,
|
|
310
|
-
role:
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
filter: (data) => isInstanceOf(DataType.Project, data.subject),
|
|
315
|
-
component: ({ data, role }) => /* @__PURE__ */ React4.createElement(ProjectCard, {
|
|
316
|
-
subject: data.subject,
|
|
317
|
-
role
|
|
300
|
+
role: "popover",
|
|
301
|
+
filter: (data) => isInstanceOf(Project, data.subject),
|
|
302
|
+
component: ({ data }) => /* @__PURE__ */ React4.createElement(ProjectCard, {
|
|
303
|
+
subject: data.subject
|
|
318
304
|
})
|
|
319
305
|
}),
|
|
320
306
|
//
|
|
@@ -322,13 +308,10 @@ var PreviewPlugin = () => definePlugin(meta, [
|
|
|
322
308
|
//
|
|
323
309
|
createSurface({
|
|
324
310
|
id: `${PREVIEW_PLUGIN}/fallback-popover`,
|
|
325
|
-
role:
|
|
326
|
-
"popover",
|
|
327
|
-
"card--kanban"
|
|
328
|
-
],
|
|
311
|
+
role: "popover",
|
|
329
312
|
position: "fallback",
|
|
330
313
|
filter: (data) => isEchoObject(data.subject),
|
|
331
|
-
component: ({ data
|
|
314
|
+
component: ({ data }) => {
|
|
332
315
|
const schema = getSchema(data.subject);
|
|
333
316
|
const { t } = useTranslation(PREVIEW_PLUGIN);
|
|
334
317
|
if (!schema) {
|
|
@@ -339,10 +322,7 @@ var PreviewPlugin = () => definePlugin(meta, [
|
|
|
339
322
|
return /* @__PURE__ */ React4.createElement(Form, {
|
|
340
323
|
schema,
|
|
341
324
|
values: data.subject,
|
|
342
|
-
readonly: true
|
|
343
|
-
...role === "card--kanban" && {
|
|
344
|
-
classNames: kanbanCardWithoutPoster
|
|
345
|
-
}
|
|
325
|
+
readonly: true
|
|
346
326
|
});
|
|
347
327
|
}
|
|
348
328
|
})
|
|
@@ -353,10 +333,8 @@ var PreviewPlugin = () => definePlugin(meta, [
|
|
|
353
333
|
export {
|
|
354
334
|
PREVIEW_PLUGIN,
|
|
355
335
|
PreviewPlugin,
|
|
356
|
-
defaultCard,
|
|
357
|
-
kanbanCardWithoutPoster,
|
|
358
336
|
meta,
|
|
359
|
-
|
|
337
|
+
previewCard,
|
|
360
338
|
previewChrome,
|
|
361
339
|
previewProse,
|
|
362
340
|
previewTitle
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/meta.ts", "../../../src/types.ts", "../../../src/PreviewPlugin.tsx", "../../../src/components/ContactCard.tsx", "../../../src/components/OrganizationCard.tsx", "../../../src/components/ProjectCard.tsx", "../../../src/translations.ts"],
|
|
4
|
-
"sourcesContent": ["//\n// Copyright 2023 DXOS.org\n//\n\nimport { type PluginMeta } from '@dxos/app-framework';\n\nexport const PREVIEW_PLUGIN = 'dxos.org/plugin/preview';\n\nexport const meta: PluginMeta = {\n id: PREVIEW_PLUGIN,\n name: 'Preview',\n icon: 'ph--eye--regular',\n source: 'https://github.com/dxos/dxos/tree/main/packages/plugins/plugin-preview',\n};\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport { type PropsWithChildren } from 'react';\n\nimport { type ThemedClassName } from '@dxos/react-ui';\n\n// TODO(burdon): Better place for these defs?\nexport type PreviewProps<T extends object> = PropsWithChildren<\n ThemedClassName<{\n subject: T;\n role: string;\n }>\n>;\n\n// TODO(burdon): Update react-ui-card (to use grid) and re-use here.\n// - See https://dxos-storybook.pages.dev/?path=/story/ui-react-ui-card-card--draggable\n// - Standardize Header, actions, image, body, etc.\n// - Support different grid layouts (e.g., image to the side, on top, etc.)\n// - Should co-exist naturally with react-ui-form (e.g., as main content).\n// - Considerations for drag-and-drop.\n/**\n * <Card.Root>\n * <Card.Header>\n * <Card.Title>\n * <Card.Action>\n * </Card.Header>\n * <Card.Body>\n * <Card.Image>\n * <Form />\n * </Card.Body>\n * </Card.Root>\n */\nexport const popoverCard = 'popover-consistent-width rounded-lg overflow-hidden';\nexport const defaultCard = '';\nexport const kanbanCardWithoutPoster = 'pbs-[--rail-action]';\nexport const previewTitle = 'text-lg font-medium line-clamp-2';\nexport const previewProse = 'pli-3 mlb-3';\nexport const previewChrome = 'pli-1.5 mlb-1.5 [&_.dx-button]:pli-1.5 [&_.dx-button]:text-start [&_.dx-button]:is-full';\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport React, { useCallback } from 'react';\n\nimport {\n Capabilities,\n Events,\n LayoutAction,\n Surface,\n contributes,\n createIntent,\n createSurface,\n defineModule,\n definePlugin,\n useIntentDispatcher,\n} from '@dxos/app-framework';\nimport { addEventListener } from '@dxos/async';\nimport { type Client, resolveRef } from '@dxos/client';\nimport {\n Filter,\n fullyQualifiedId,\n getSchema,\n getSpace,\n isEchoObject,\n parseId,\n type AnyLiveObject,\n type Space,\n} from '@dxos/client/echo';\nimport { isInstanceOf } from '@dxos/echo-schema';\nimport { DXN } from '@dxos/keys';\nimport { type DxRefTagActivate } from '@dxos/lit-ui';\nimport { log } from '@dxos/log';\nimport { ClientCapabilities, ClientEvents } from '@dxos/plugin-client';\nimport { useTranslation } from '@dxos/react-ui';\nimport { type PreviewLinkRef, type PreviewLinkTarget } from '@dxos/react-ui-editor';\nimport { Form } from '@dxos/react-ui-form';\nimport { TableType } from '@dxos/react-ui-table';\nimport { descriptionMessage } from '@dxos/react-ui-theme';\nimport { DataType } from '@dxos/schema';\n\nimport { ContactCard, OrganizationCard, ProjectCard } from './components';\nimport { meta, PREVIEW_PLUGIN } from './meta';\nimport translations from './translations';\nimport { kanbanCardWithoutPoster } from './types';\n\nconst customEventOptions = { capture: true, passive: false };\n\nconst handlePreviewLookup = async (\n client: Client,\n defaultSpace: Space,\n { ref, label }: PreviewLinkRef,\n): Promise<PreviewLinkTarget | null> => {\n const dxn = DXN.parse(ref);\n if (!dxn) {\n return null;\n }\n\n const object = await resolveRef(client, dxn, defaultSpace);\n return { label, object };\n};\n\nexport const PreviewPlugin = () =>\n definePlugin(meta, [\n defineModule({\n id: `${meta.id}/module/translations`,\n activatesOn: Events.SetupTranslations,\n activate: () => contributes(Capabilities.Translations, translations),\n }),\n defineModule({\n id: `${meta.id}/module/schema`,\n activatesOn: ClientEvents.SetupSchema,\n activate: () => [contributes(ClientCapabilities.Schema, [DataType.Person, DataType.Organization])],\n }),\n defineModule({\n id: `${meta.id}/module/preview-popover`,\n activatesOn: Events.Startup,\n activate: (context) => {\n // TODO(wittjosiah): Factor out lookup handlers to other plugins to make not ECHO-specific.\n const handleDxRefTagActivate = async ({ ref, label, trigger }: DxRefTagActivate) => {\n const { dispatchPromise: dispatch } = context.requestCapability(Capabilities.IntentDispatcher);\n const client = context.requestCapability(ClientCapabilities.Client);\n const [layout] = context.requestCapabilities(Capabilities.Layout);\n const { spaceId } = parseId(layout.workspace);\n const space = (spaceId && client.spaces.get(spaceId)) ?? client.spaces.default;\n const result = await handlePreviewLookup(client, space, { ref, label });\n if (!result) {\n return;\n }\n\n await dispatch(\n createIntent(LayoutAction.UpdatePopover, {\n part: 'popover',\n subject: result.object,\n options: {\n state: true,\n variant: 'virtual',\n anchor: trigger,\n },\n }),\n );\n };\n\n if (!document.defaultView) {\n log.warn('No default view found');\n return [];\n }\n\n const cleanup = addEventListener(\n document.defaultView,\n 'dx-ref-tag-activate',\n handleDxRefTagActivate,\n customEventOptions,\n );\n return contributes(Capabilities.Null, null, () => cleanup());\n },\n }),\n defineModule({\n id: `${meta.id}/module/react-surface`,\n activatesOn: Events.SetupReactSurface,\n activate: () =>\n // TODO(wittjosiah): Factor out to lazy capabilities like other plugins.\n contributes(Capabilities.ReactSurface, [\n //\n // Specific schema types.\n //\n createSurface({\n id: `${PREVIEW_PLUGIN}/schema-popover`,\n role: ['popover', 'card--kanban'],\n filter: (data): data is { subject: DataType.Person } => isInstanceOf(DataType.Person, data.subject),\n component: ({ data, role }) => {\n const { dispatchPromise: dispatch } = useIntentDispatcher();\n const handleOrgClick = useCallback(\n async (org: DataType.Organization) => {\n const space = getSpace(org);\n const tablesQuery = await space?.db.query(Filter.schema(TableType)).run();\n const currentSpaceOrgTable = tablesQuery?.objects.find((table) => {\n return table.view?.target?.query?.typename === DataType.Organization.typename;\n });\n await dispatch(\n createIntent(LayoutAction.UpdatePopover, {\n part: 'popover',\n options: {\n state: false,\n anchorId: '',\n },\n }),\n );\n if (currentSpaceOrgTable) {\n return dispatch(\n createIntent(LayoutAction.Open, {\n part: 'main',\n subject: [fullyQualifiedId(currentSpaceOrgTable)],\n options: { workspace: space?.id },\n }),\n );\n }\n },\n [dispatch],\n );\n return (\n <ContactCard subject={data.subject} onOrgClick={handleOrgClick} role={role}>\n {role === 'popover' && <Surface role='related' data={data} />}\n </ContactCard>\n );\n },\n }),\n createSurface({\n id: `${PREVIEW_PLUGIN}/schema-popover`,\n role: ['popover', 'card--kanban'],\n filter: (data): data is { subject: DataType.Organization } =>\n isInstanceOf(DataType.Organization, data.subject),\n component: ({ data, role }) => (\n <OrganizationCard subject={data.subject} role={role}>\n {role === 'popover' && <Surface role='related' data={data} />}\n </OrganizationCard>\n ),\n }),\n createSurface({\n id: `${PREVIEW_PLUGIN}/schema-popover`,\n role: ['popover', 'card--kanban'],\n filter: (data): data is { subject: DataType.Project } => isInstanceOf(DataType.Project, data.subject),\n component: ({ data, role }) => <ProjectCard subject={data.subject} role={role} />,\n }),\n\n //\n // Fallback for any object.\n //\n createSurface({\n id: `${PREVIEW_PLUGIN}/fallback-popover`,\n role: ['popover', 'card--kanban'],\n position: 'fallback',\n filter: (data): data is { subject: AnyLiveObject<any> } => isEchoObject(data.subject),\n component: ({ data, role }) => {\n const schema = getSchema(data.subject);\n const { t } = useTranslation(PREVIEW_PLUGIN);\n if (!schema) {\n return <p className={descriptionMessage}>{t('unable to create preview message')}</p>;\n }\n\n return (\n <Form\n schema={schema}\n values={data.subject}\n readonly\n {...(role === 'card--kanban' && { classNames: kanbanCardWithoutPoster })}\n />\n );\n },\n }),\n ]),\n }),\n ]);\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport React, { Fragment } from 'react';\n\nimport { Icon, Avatar, Button } from '@dxos/react-ui';\nimport { mx } from '@dxos/react-ui-theme';\nimport { type DataType } from '@dxos/schema';\n\nimport { type PreviewProps, popoverCard, previewTitle, previewProse, previewChrome, defaultCard } from '../types';\n\nexport const ContactCard = ({\n children,\n classNames,\n role,\n subject: { fullName, image, organization, emails },\n onOrgClick,\n}: PreviewProps<DataType.Person> & { onOrgClick?: (org: DataType.Organization) => void }) => {\n const organizationName = organization && typeof organization === 'object' ? organization.target?.name : organization;\n return (\n <div role='none' className={mx(role === 'popover' ? popoverCard : defaultCard, classNames)}>\n <Avatar.Root>\n <div role='group' className={mx(previewProse, 'grid gap-3 grid-cols-[min-content_1fr]')}>\n <Avatar.Content imgSrc={image} icon='ph--user--regular' size={16} hue='neutral' />\n <div role='none' className='bs-min self-center'>\n <Avatar.Label asChild>\n <h2 className={previewTitle}>{fullName}</h2>\n </Avatar.Label>\n </div>\n </div>\n </Avatar.Root>\n {organizationName && (\n <div role='none' className={previewChrome}>\n {typeof organization === 'object' && onOrgClick ? (\n <Button variant='ghost' classNames='gap-2 text-start' onClick={() => onOrgClick(organization.target!)}>\n <Icon icon='ph--buildings--regular' size={5} classNames='text-subdued' />\n <span className='min-is-0 flex-1 truncate'>{organizationName}</span>\n <Icon icon='ph--arrow-right--regular' />\n </Button>\n ) : (\n <p className='dx-button gap-2' data-variant='ghost'>\n <Icon icon='ph--buildings--regular' size={5} classNames='text-subdued' />\n <span className='min-is-0 flex-1 truncate'>{organizationName}</span>\n </p>\n )}\n </div>\n )}\n <dl\n className={mx(\n previewProse,\n 'grid gap-2 grid-cols-[min-content_1fr] [&_dt]:text-subdued [&_dt]:pbs-0.5 [&_dd]:min-is-0',\n )}\n >\n {emails?.length &&\n emails.map(({ label, value }) => (\n <Fragment key={value}>\n <dt>\n <Icon icon='ph--at--regular' size={5} />\n </dt>\n <dd key={value} className='break-words'>\n {value}\n </dd>\n </Fragment>\n ))}\n </dl>\n {children}\n </div>\n );\n};\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport React from 'react';\n\nimport { Icon } from '@dxos/react-ui';\nimport { mx } from '@dxos/react-ui-theme';\nimport { type DataType } from '@dxos/schema';\n\nimport { type PreviewProps, popoverCard, previewTitle, previewProse, previewChrome, defaultCard } from '../types';\n\nexport const OrganizationCard = ({\n children,\n classNames,\n subject: { name, image, description, website },\n role,\n}: PreviewProps<DataType.Organization>) => {\n return (\n <div role='none' className={mx(role === 'popover' ? popoverCard : defaultCard, classNames)}>\n {image ? (\n <img className='aspect-video object-cover is-full bs-auto' src={image} alt={name} />\n ) : (\n <div role='image' className='grid aspect-video place-items-center bg-input text-subdued'>\n <Icon icon='ph--building-office--regular' size={10} />\n </div>\n )}\n <h2 className={mx(previewTitle, previewProse)}>{name}</h2>\n {description && <p className={mx(previewProse, 'line-clamp-2')}>{description}</p>}\n {website && (\n <div role='none' className={previewChrome}>\n <a className='dx-button dx-focus-ring gap-2' href={website} target='_blank' rel='noreferrer'>\n <Icon icon='ph--link--regular' size={5} classNames='text-subdued' />\n <span className='grow'>{website}</span>\n <Icon icon='ph--arrow-square-out--regular' />\n </a>\n </div>\n )}\n {children}\n </div>\n );\n};\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport React from 'react';\n\nimport { mx } from '@dxos/react-ui-theme';\nimport { type DataType } from '@dxos/schema';\n\nimport { type PreviewProps, popoverCard, previewTitle, defaultCard } from '../types';\n\nexport const ProjectCard = ({\n classNames,\n role,\n subject: { name, image, description },\n}: PreviewProps<DataType.Project>) => {\n return (\n <div role='none' className={mx(role === 'popover' ? popoverCard : defaultCard, classNames)}>\n {image && <img className='is-full bs-auto' src={image} alt={name} />}\n <h2 className={mx(previewTitle, 'pli-3 mlb-3')}>{name}</h2>\n {description && <p className='pli-3 line-clamp-2 mlb-3'>{description}</p>}\n </div>\n );\n};\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport { PREVIEW_PLUGIN } from './meta';\n\nexport default [\n {\n 'en-US': {\n [PREVIEW_PLUGIN]: {\n 'unable to create preview message': 'No preview',\n },\n },\n },\n];\n"],
|
|
5
|
-
"mappings": ";AAMO,IAAMA,iBAAiB;AAEvB,IAAMC,OAAmB;EAC9BC,IAAIF;EACJG,MAAM;EACNC,MAAM;EACNC,QAAQ;AACV;;;
|
|
6
|
-
"names": ["PREVIEW_PLUGIN", "meta", "id", "name", "icon", "source", "
|
|
4
|
+
"sourcesContent": ["//\n// Copyright 2023 DXOS.org\n//\n\nimport { type PluginMeta } from '@dxos/app-framework';\n\nexport const PREVIEW_PLUGIN = 'dxos.org/plugin/preview';\n\nexport const meta: PluginMeta = {\n id: PREVIEW_PLUGIN,\n name: 'Preview',\n icon: 'ph--eye--regular',\n source: 'https://github.com/dxos/dxos/tree/main/packages/plugins/plugin-preview',\n};\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport { type PropsWithChildren } from 'react';\n\nimport { type ThemedClassName } from '@dxos/react-ui';\n\n// TODO(burdon): Better place for these defs?\nexport type PreviewProps<T extends object> = PropsWithChildren<\n ThemedClassName<{\n subject: T;\n }>\n>;\n\n// TODO(burdon): Update react-ui-card (to use grid) and re-use here.\n// - See https://dxos-storybook.pages.dev/?path=/story/ui-react-ui-card-card--draggable\n// - Standardize Header, actions, image, body, etc.\n// - Support different grid layouts (e.g., image to the side, on top, etc.)\n// - Should co-exist naturally with react-ui-form (e.g., as main content).\n// - Considerations for drag-and-drop.\n/**\n * <Card.Root>\n * <Card.Header>\n * <Card.Title>\n * <Card.Action>\n * </Card.Header>\n * <Card.Body>\n * <Card.Image>\n * <Form />\n * </Card.Body>\n * </Card.Root>\n */\nexport const previewCard = 'popover-max-width rounded-lg overflow-hidden';\nexport const previewTitle = 'text-lg font-medium line-clamp-2';\nexport const previewProse = 'pli-3 mlb-3';\nexport const previewChrome = 'pli-1.5 mlb-1.5 [&_.dx-button]:pli-1.5 [&_.dx-button]:text-start [&_.dx-button]:is-full';\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport React, { useCallback } from 'react';\n\nimport {\n Capabilities,\n Events,\n LayoutAction,\n Surface,\n contributes,\n createIntent,\n createSurface,\n defineModule,\n definePlugin,\n useIntentDispatcher,\n} from '@dxos/app-framework';\nimport { addEventListener } from '@dxos/async';\nimport { type Client, resolveRef } from '@dxos/client';\nimport {\n Filter,\n fullyQualifiedId,\n getSchema,\n getSpace,\n isEchoObject,\n parseId,\n type ReactiveEchoObject,\n type Space,\n} from '@dxos/client/echo';\nimport { isInstanceOf } from '@dxos/echo-schema';\nimport { DXN } from '@dxos/keys';\nimport { type DxRefTagActivate } from '@dxos/lit-ui';\nimport { log } from '@dxos/log';\nimport { ClientCapabilities, ClientEvents } from '@dxos/plugin-client';\nimport { useTranslation } from '@dxos/react-ui';\nimport { type PreviewLinkRef, type PreviewLinkTarget } from '@dxos/react-ui-editor';\nimport { Form } from '@dxos/react-ui-form';\nimport { TableType } from '@dxos/react-ui-table';\nimport { descriptionMessage } from '@dxos/react-ui-theme';\nimport { Contact, Organization, Project } from '@dxos/schema';\n\nimport { ContactCard, OrganizationCard, ProjectCard } from './components';\nimport { meta, PREVIEW_PLUGIN } from './meta';\nimport translations from './translations';\n\nconst customEventOptions = { capture: true, passive: false };\n\nconst handlePreviewLookup = async (\n client: Client,\n defaultSpace: Space,\n { ref, label }: PreviewLinkRef,\n): Promise<PreviewLinkTarget | null> => {\n const dxn = DXN.parse(ref);\n if (!dxn) {\n return null;\n }\n\n const object = await resolveRef(client, dxn, defaultSpace);\n return { label, object };\n};\n\nexport const PreviewPlugin = () =>\n definePlugin(meta, [\n defineModule({\n id: `${meta.id}/module/translations`,\n activatesOn: Events.SetupTranslations,\n activate: () => contributes(Capabilities.Translations, translations),\n }),\n defineModule({\n id: `${meta.id}/module/schema`,\n activatesOn: ClientEvents.SetupSchema,\n activate: () => [contributes(ClientCapabilities.Schema, [Contact, Organization])],\n }),\n defineModule({\n id: `${meta.id}/module/preview-popover`,\n activatesOn: Events.Startup,\n activate: (context) => {\n // TODO(wittjosiah): Factor out lookup handlers to other plugins to make not ECHO-specific.\n const handleDxRefTagActivate = async ({ ref, label, trigger }: DxRefTagActivate) => {\n const { dispatchPromise: dispatch } = context.requestCapability(Capabilities.IntentDispatcher);\n const client = context.requestCapability(ClientCapabilities.Client);\n const [layout] = context.requestCapabilities(Capabilities.Layout);\n const { spaceId } = parseId(layout.workspace);\n const space = (spaceId && client.spaces.get(spaceId)) ?? client.spaces.default;\n const result = await handlePreviewLookup(client, space, { ref, label });\n if (!result) {\n return;\n }\n\n await dispatch(\n createIntent(LayoutAction.UpdatePopover, {\n part: 'popover',\n subject: result.object,\n options: {\n state: true,\n variant: 'virtual',\n anchor: trigger,\n },\n }),\n );\n };\n\n if (!document.defaultView) {\n log.warn('No default view found');\n return [];\n }\n\n const cleanup = addEventListener(\n document.defaultView,\n 'dx-ref-tag-activate',\n handleDxRefTagActivate,\n customEventOptions,\n );\n return contributes(Capabilities.Null, null, () => cleanup());\n },\n }),\n defineModule({\n id: `${meta.id}/module/react-surface`,\n activatesOn: Events.SetupReactSurface,\n activate: () =>\n // TODO(wittjosiah): Factor out to lazy capabilities like other plugins.\n contributes(Capabilities.ReactSurface, [\n //\n // Specific schema types.\n //\n createSurface({\n id: `${PREVIEW_PLUGIN}/schema-popover`,\n role: 'popover',\n filter: (data): data is { subject: Contact } => isInstanceOf(Contact, data.subject),\n component: ({ data }) => {\n const { dispatchPromise: dispatch } = useIntentDispatcher();\n const handleOrgClick = useCallback(\n async (org: Organization) => {\n const space = getSpace(org);\n const tablesQuery = await space?.db.query(Filter.schema(TableType)).run();\n const currentSpaceOrgTable = tablesQuery?.objects.find((table) => {\n return table.view?.target?.query?.typename === Organization.typename;\n });\n await dispatch(\n createIntent(LayoutAction.UpdatePopover, {\n part: 'popover',\n options: {\n state: false,\n anchorId: '',\n },\n }),\n );\n if (currentSpaceOrgTable) {\n return dispatch(\n createIntent(LayoutAction.Open, {\n part: 'main',\n subject: [fullyQualifiedId(currentSpaceOrgTable)],\n options: { workspace: space?.id },\n }),\n );\n }\n },\n [dispatch],\n );\n return (\n <ContactCard subject={data.subject} onOrgClick={handleOrgClick}>\n <Surface role='related' data={data} />\n </ContactCard>\n );\n },\n }),\n createSurface({\n id: `${PREVIEW_PLUGIN}/schema-popover`,\n role: 'popover',\n filter: (data): data is { subject: Organization } => isInstanceOf(Organization, data.subject),\n component: ({ data }) => (\n <OrganizationCard subject={data.subject}>\n <Surface role='related' data={data} />\n </OrganizationCard>\n ),\n }),\n createSurface({\n id: `${PREVIEW_PLUGIN}/schema-popover`,\n role: 'popover',\n filter: (data): data is { subject: Project } => isInstanceOf(Project, data.subject),\n component: ({ data }) => <ProjectCard subject={data.subject} />,\n }),\n\n //\n // Fallback for any object.\n //\n createSurface({\n id: `${PREVIEW_PLUGIN}/fallback-popover`,\n role: 'popover',\n position: 'fallback',\n filter: (data): data is { subject: ReactiveEchoObject<any> } => isEchoObject(data.subject),\n component: ({ data }) => {\n const schema = getSchema(data.subject);\n const { t } = useTranslation(PREVIEW_PLUGIN);\n if (!schema) {\n return <p className={descriptionMessage}>{t('unable to create preview message')}</p>;\n }\n\n return <Form schema={schema} values={data.subject} readonly />;\n },\n }),\n ]),\n }),\n ]);\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport React, { Fragment } from 'react';\n\nimport { Icon, Avatar, Button } from '@dxos/react-ui';\nimport { mx } from '@dxos/react-ui-theme';\nimport { type Contact, type Organization } from '@dxos/schema';\n\nimport { type PreviewProps, previewCard, previewTitle, previewProse, previewChrome } from '../types';\n\nexport const ContactCard = ({\n children,\n classNames,\n subject: { fullName, image, organization, emails },\n onOrgClick,\n}: PreviewProps<Contact> & { onOrgClick?: (org: Organization) => void }) => {\n const organizationName = organization && typeof organization === 'object' ? organization.target?.name : organization;\n return (\n <div role='none' className={mx(previewCard, classNames)}>\n <Avatar.Root>\n <div role='group' className={mx(previewProse, 'grid gap-3 grid-cols-[min-content_1fr]')}>\n <Avatar.Content imgSrc={image} icon='ph--user--regular' size={16} hue='neutral' />\n <div role='none' className='bs-min self-center'>\n <Avatar.Label asChild>\n <h2 className={previewTitle}>{fullName}</h2>\n </Avatar.Label>\n </div>\n </div>\n </Avatar.Root>\n {organizationName && (\n <div role='none' className={previewChrome}>\n {typeof organization === 'object' && onOrgClick ? (\n <Button variant='ghost' classNames='gap-2 text-start' onClick={() => onOrgClick(organization.target!)}>\n <Icon icon='ph--buildings--regular' size={5} classNames='text-subdued' />\n <span className='min-is-0 flex-1 truncate'>{organizationName}</span>\n <Icon icon='ph--arrow-right--regular' />\n </Button>\n ) : (\n <p className='dx-button gap-2' data-variant='ghost'>\n <Icon icon='ph--buildings--regular' size={5} classNames='text-subdued' />\n <span className='min-is-0 flex-1 truncate'>{organizationName}</span>\n </p>\n )}\n </div>\n )}\n <dl\n className={mx(\n previewProse,\n 'grid gap-2 grid-cols-[min-content_1fr] [&_dt]:text-subdued [&_dt]:pbs-0.5 [&_dd]:min-is-0',\n )}\n >\n {emails?.length &&\n emails.map(({ label, value }) => (\n <Fragment key={value}>\n <dt>\n <Icon icon='ph--at--regular' size={5} />\n </dt>\n <dd key={value} className='break-words'>\n {value}\n </dd>\n </Fragment>\n ))}\n </dl>\n {children}\n </div>\n );\n};\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport React from 'react';\n\nimport { Icon } from '@dxos/react-ui';\nimport { mx } from '@dxos/react-ui-theme';\nimport { type Organization } from '@dxos/schema';\n\nimport { type PreviewProps, previewCard, previewTitle, previewProse, previewChrome } from '../types';\n\nexport const OrganizationCard = ({\n children,\n classNames,\n subject: { name, image, description, website },\n}: PreviewProps<Organization>) => {\n return (\n <div role='none' className={mx(previewCard, classNames)}>\n {image ? (\n <img className='aspect-video object-cover is-full bs-auto' src={image} alt={name} />\n ) : (\n <div role='image' className='grid aspect-video place-items-center bg-groupSurface text-subdued'>\n <Icon icon='ph--building-office--regular' size={10} />\n </div>\n )}\n <h2 className={mx(previewTitle, previewProse)}>{name}</h2>\n {description && <p className={mx(previewProse, 'line-clamp-2')}>{description}</p>}\n {website && (\n <div role='none' className={previewChrome}>\n <a className='dx-button dx-focus-ring gap-2' href={website} target='_blank' rel='noreferrer'>\n <Icon icon='ph--link--regular' size={5} classNames='text-subdued' />\n <span className='grow'>{website}</span>\n <Icon icon='ph--arrow-square-out--regular' />\n </a>\n </div>\n )}\n {children}\n </div>\n );\n};\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport React from 'react';\n\nimport { mx } from '@dxos/react-ui-theme';\nimport { type Project } from '@dxos/schema';\n\nimport { type PreviewProps, previewCard, previewTitle } from '../types';\n\nexport const ProjectCard = ({ classNames, subject: { name, image, description } }: PreviewProps<Project>) => {\n return (\n <div role='none' className={mx(previewCard, classNames)}>\n {image && <img className='is-full bs-auto' src={image} alt={name} />}\n <h2 className={mx(previewTitle, 'pli-3 mlb-3')}>{name}</h2>\n {description && <p className='pli-3 line-clamp-2 mlb-3'>{description}</p>}\n </div>\n );\n};\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport { PREVIEW_PLUGIN } from './meta';\n\nexport default [\n {\n 'en-US': {\n [PREVIEW_PLUGIN]: {\n 'unable to create preview message': 'No preview',\n },\n },\n },\n];\n"],
|
|
5
|
+
"mappings": ";AAMO,IAAMA,iBAAiB;AAEvB,IAAMC,OAAmB;EAC9BC,IAAIF;EACJG,MAAM;EACNC,MAAM;EACNC,QAAQ;AACV;;;ACoBO,IAAMC,cAAc;AACpB,IAAMC,eAAe;AACrB,IAAMC,eAAe;AACrB,IAAMC,gBAAgB;;;AChC7B,OAAOC,UAASC,mBAAmB;AAEnC,SACEC,cACAC,QACAC,cACAC,SACAC,aACAC,cACAC,eACAC,cACAC,cACAC,2BACK;AACP,SAASC,wBAAwB;AACjC,SAAsBC,kBAAkB;AACxC,SACEC,QACAC,kBACAC,WACAC,UACAC,cACAC,eAGK;AACP,SAASC,oBAAoB;AAC7B,SAASC,WAAW;AAEpB,SAASC,WAAW;AACpB,SAASC,oBAAoBC,oBAAoB;AACjD,SAASC,sBAAsB;AAE/B,SAASC,YAAY;AACrB,SAASC,iBAAiB;AAC1B,SAASC,0BAA0B;AACnC,SAASC,SAASC,cAAcC,eAAe;;;ACpC/C,OAAOC,SAASC,gBAAgB;AAEhC,SAASC,MAAMC,QAAQC,cAAc;AACrC,SAASC,UAAU;AAKZ,IAAMC,cAAc,CAAC,EAC1BC,UACAC,YACAC,SAAS,EAAEC,UAAUC,OAAOC,cAAcC,OAAM,GAChDC,WAAU,MAC2D;AACrE,QAAMC,mBAAmBH,gBAAgB,OAAOA,iBAAiB,WAAWA,aAAaI,QAAQC,OAAOL;AACxG,SACE,sBAAA,cAACM,OAAAA;IAAIC,MAAK;IAAOC,WAAWC,GAAGC,aAAad,UAAAA;KAC1C,sBAAA,cAACe,OAAOC,MAAI,MACV,sBAAA,cAACN,OAAAA;IAAIC,MAAK;IAAQC,WAAWC,GAAGI,cAAc,wCAAA;KAC5C,sBAAA,cAACF,OAAOG,SAAO;IAACC,QAAQhB;IAAOiB,MAAK;IAAoBC,MAAM;IAAIC,KAAI;MACtE,sBAAA,cAACZ,OAAAA;IAAIC,MAAK;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D,EAAC,IAAKC,eAAevC,cAAAA;AAC7B,gBAAI,CAACe,QAAQ;AACX,qBAAO,gBAAAa,OAAA,cAACY,KAAAA;gBAAEC,WAAWC;iBAAqBJ,EAAE,kCAAA,CAAA;YAC9C;AAEA,mBAAO,gBAAAV,OAAA,cAACe,MAAAA;cAAK5B;cAAgB6B,QAAQzC,KAAKlB;cAAS4D,UAAAA;;UACrD;QACF,CAAA;OACD;;EACL,CAAA;CACD;",
|
|
6
|
+
"names": ["PREVIEW_PLUGIN", "meta", "id", "name", "icon", "source", "previewCard", "previewTitle", "previewProse", "previewChrome", "React", "useCallback", "Capabilities", "Events", "LayoutAction", "Surface", "contributes", "createIntent", "createSurface", "defineModule", "definePlugin", "useIntentDispatcher", "addEventListener", "resolveRef", "Filter", "fullyQualifiedId", "getSchema", "getSpace", "isEchoObject", "parseId", "isInstanceOf", "DXN", "log", "ClientCapabilities", "ClientEvents", "useTranslation", "Form", "TableType", "descriptionMessage", "Contact", "Organization", "Project", "React", "Fragment", "Icon", "Avatar", "Button", "mx", "ContactCard", "children", "classNames", "subject", "fullName", "image", "organization", "emails", "onOrgClick", "organizationName", "target", "name", "div", "role", "className", "mx", "previewCard", "Avatar", "Root", "previewProse", "Content", "imgSrc", "icon", "size", "hue", "Label", "asChild", "h2", "previewTitle", "previewChrome", "Button", "variant", "onClick", "Icon", "span", "p", "data-variant", "dl", "length", "map", "label", "value", "Fragment", "key", "dt", "dd", "React", "Icon", "mx", "OrganizationCard", "children", "classNames", "subject", "name", "image", "description", "website", "React", "div", "role", "className", "mx", "previewCard", "img", "src", "alt", "Icon", "icon", "size", "h2", "previewTitle", "previewProse", "p", "previewChrome", "a", "href", "target", "rel", "span", "React", "mx", "ProjectCard", "classNames", "subject", "name", "image", "description", "React", "div", "role", "className", "mx", "previewCard", "img", "src", "alt", "h2", "previewTitle", "p", "PREVIEW_PLUGIN", "customEventOptions", "capture", "passive", "handlePreviewLookup", "client", "defaultSpace", "ref", "label", "dxn", "DXN", "parse", "object", "resolveRef", "PreviewPlugin", "definePlugin", "meta", "defineModule", "id", "activatesOn", "Events", "SetupTranslations", "activate", "contributes", "Capabilities", "Translations", "translations", "ClientEvents", "SetupSchema", "ClientCapabilities", "Schema", "Contact", "Organization", "Startup", "context", "handleDxRefTagActivate", "trigger", "dispatchPromise", "dispatch", "requestCapability", "IntentDispatcher", "Client", "layout", "requestCapabilities", "Layout", "spaceId", "parseId", "workspace", "space", "spaces", "get", "default", "result", "createIntent", "LayoutAction", "UpdatePopover", "part", "subject", "options", "state", "variant", "anchor", "document", "defaultView", "log", "warn", "cleanup", "addEventListener", "Null", "SetupReactSurface", "ReactSurface", "createSurface", "PREVIEW_PLUGIN", "role", "filter", "data", "isInstanceOf", "component", "useIntentDispatcher", "handleOrgClick", "useCallback", "org", "getSpace", "tablesQuery", "db", "query", "Filter", "schema", "TableType", "run", "currentSpaceOrgTable", "objects", "find", "table", "view", "target", "typename", "anchorId", "Open", "fullyQualifiedId", "React", "ContactCard", "onOrgClick", "Surface", "OrganizationCard", "Project", "ProjectCard", "position", "isEchoObject", "getSchema", "t", "useTranslation", "p", "className", "descriptionMessage", "Form", "values", "readonly"]
|
|
7
7
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"inputs":{"packages/plugins/plugin-preview/src/meta.ts":{"bytes":1296,"imports":[],"format":"esm"},"packages/plugins/plugin-preview/src/types.ts":{"bytes":
|
|
1
|
+
{"inputs":{"packages/plugins/plugin-preview/src/meta.ts":{"bytes":1296,"imports":[],"format":"esm"},"packages/plugins/plugin-preview/src/types.ts":{"bytes":3274,"imports":[],"format":"esm"},"packages/plugins/plugin-preview/src/components/ContactCard.tsx":{"bytes":9227,"imports":[{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/react-ui","kind":"import-statement","external":true},{"path":"@dxos/react-ui-theme","kind":"import-statement","external":true},{"path":"packages/plugins/plugin-preview/src/types.ts","kind":"import-statement","original":"../types"}],"format":"esm"},"packages/plugins/plugin-preview/src/components/OrganizationCard.tsx":{"bytes":5532,"imports":[{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/react-ui","kind":"import-statement","external":true},{"path":"@dxos/react-ui-theme","kind":"import-statement","external":true},{"path":"packages/plugins/plugin-preview/src/types.ts","kind":"import-statement","original":"../types"}],"format":"esm"},"packages/plugins/plugin-preview/src/components/ProjectCard.tsx":{"bytes":2743,"imports":[{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/react-ui-theme","kind":"import-statement","external":true},{"path":"packages/plugins/plugin-preview/src/types.ts","kind":"import-statement","original":"../types"}],"format":"esm"},"packages/plugins/plugin-preview/src/components/index.ts":{"bytes":732,"imports":[{"path":"packages/plugins/plugin-preview/src/components/ContactCard.tsx","kind":"import-statement","original":"./ContactCard"},{"path":"packages/plugins/plugin-preview/src/components/OrganizationCard.tsx","kind":"import-statement","original":"./OrganizationCard"},{"path":"packages/plugins/plugin-preview/src/components/ProjectCard.tsx","kind":"import-statement","original":"./ProjectCard"}],"format":"esm"},"packages/plugins/plugin-preview/src/translations.ts":{"bytes":1091,"imports":[{"path":"packages/plugins/plugin-preview/src/meta.ts","kind":"import-statement","original":"./meta"}],"format":"esm"},"packages/plugins/plugin-preview/src/PreviewPlugin.tsx":{"bytes":27057,"imports":[{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/app-framework","kind":"import-statement","external":true},{"path":"@dxos/async","kind":"import-statement","external":true},{"path":"@dxos/client","kind":"import-statement","external":true},{"path":"@dxos/client/echo","kind":"import-statement","external":true},{"path":"@dxos/echo-schema","kind":"import-statement","external":true},{"path":"@dxos/keys","kind":"import-statement","external":true},{"path":"@dxos/log","kind":"import-statement","external":true},{"path":"@dxos/plugin-client","kind":"import-statement","external":true},{"path":"@dxos/react-ui","kind":"import-statement","external":true},{"path":"@dxos/react-ui-form","kind":"import-statement","external":true},{"path":"@dxos/react-ui-table","kind":"import-statement","external":true},{"path":"@dxos/react-ui-theme","kind":"import-statement","external":true},{"path":"@dxos/schema","kind":"import-statement","external":true},{"path":"packages/plugins/plugin-preview/src/components/index.ts","kind":"import-statement","original":"./components"},{"path":"packages/plugins/plugin-preview/src/meta.ts","kind":"import-statement","original":"./meta"},{"path":"packages/plugins/plugin-preview/src/translations.ts","kind":"import-statement","original":"./translations"}],"format":"esm"},"packages/plugins/plugin-preview/src/index.ts":{"bytes":681,"imports":[{"path":"packages/plugins/plugin-preview/src/meta.ts","kind":"import-statement","original":"./meta"},{"path":"packages/plugins/plugin-preview/src/types.ts","kind":"import-statement","original":"./types"},{"path":"packages/plugins/plugin-preview/src/PreviewPlugin.tsx","kind":"import-statement","original":"./PreviewPlugin"}],"format":"esm"}},"outputs":{"packages/plugins/plugin-preview/dist/lib/browser/index.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":24136},"packages/plugins/plugin-preview/dist/lib/browser/index.mjs":{"imports":[{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/app-framework","kind":"import-statement","external":true},{"path":"@dxos/async","kind":"import-statement","external":true},{"path":"@dxos/client","kind":"import-statement","external":true},{"path":"@dxos/client/echo","kind":"import-statement","external":true},{"path":"@dxos/echo-schema","kind":"import-statement","external":true},{"path":"@dxos/keys","kind":"import-statement","external":true},{"path":"@dxos/log","kind":"import-statement","external":true},{"path":"@dxos/plugin-client","kind":"import-statement","external":true},{"path":"@dxos/react-ui","kind":"import-statement","external":true},{"path":"@dxos/react-ui-form","kind":"import-statement","external":true},{"path":"@dxos/react-ui-table","kind":"import-statement","external":true},{"path":"@dxos/react-ui-theme","kind":"import-statement","external":true},{"path":"@dxos/schema","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/react-ui","kind":"import-statement","external":true},{"path":"@dxos/react-ui-theme","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/react-ui","kind":"import-statement","external":true},{"path":"@dxos/react-ui-theme","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/react-ui-theme","kind":"import-statement","external":true}],"exports":["PREVIEW_PLUGIN","PreviewPlugin","meta","previewCard","previewChrome","previewProse","previewTitle"],"entryPoint":"packages/plugins/plugin-preview/src/index.ts","inputs":{"packages/plugins/plugin-preview/src/meta.ts":{"bytesInOutput":216},"packages/plugins/plugin-preview/src/index.ts":{"bytesInOutput":0},"packages/plugins/plugin-preview/src/types.ts":{"bytesInOutput":266},"packages/plugins/plugin-preview/src/PreviewPlugin.tsx":{"bytesInOutput":6691},"packages/plugins/plugin-preview/src/components/ContactCard.tsx":{"bytesInOutput":2668},"packages/plugins/plugin-preview/src/components/index.ts":{"bytesInOutput":0},"packages/plugins/plugin-preview/src/components/OrganizationCard.tsx":{"bytesInOutput":1584},"packages/plugins/plugin-preview/src/components/ProjectCard.tsx":{"bytesInOutput":633},"packages/plugins/plugin-preview/src/translations.ts":{"bytesInOutput":152}},"bytes":12837}}}
|
package/dist/lib/node/index.cjs
CHANGED
|
@@ -30,10 +30,8 @@ var node_exports = {};
|
|
|
30
30
|
__export(node_exports, {
|
|
31
31
|
PREVIEW_PLUGIN: () => PREVIEW_PLUGIN,
|
|
32
32
|
PreviewPlugin: () => PreviewPlugin,
|
|
33
|
-
defaultCard: () => defaultCard,
|
|
34
|
-
kanbanCardWithoutPoster: () => kanbanCardWithoutPoster,
|
|
35
33
|
meta: () => meta,
|
|
36
|
-
|
|
34
|
+
previewCard: () => previewCard,
|
|
37
35
|
previewChrome: () => previewChrome,
|
|
38
36
|
previewProse: () => previewProse,
|
|
39
37
|
previewTitle: () => previewTitle
|
|
@@ -68,17 +66,15 @@ var meta = {
|
|
|
68
66
|
icon: "ph--eye--regular",
|
|
69
67
|
source: "https://github.com/dxos/dxos/tree/main/packages/plugins/plugin-preview"
|
|
70
68
|
};
|
|
71
|
-
var
|
|
72
|
-
var defaultCard = "";
|
|
73
|
-
var kanbanCardWithoutPoster = "pbs-[--rail-action]";
|
|
69
|
+
var previewCard = "popover-max-width rounded-lg overflow-hidden";
|
|
74
70
|
var previewTitle = "text-lg font-medium line-clamp-2";
|
|
75
71
|
var previewProse = "pli-3 mlb-3";
|
|
76
72
|
var previewChrome = "pli-1.5 mlb-1.5 [&_.dx-button]:pli-1.5 [&_.dx-button]:text-start [&_.dx-button]:is-full";
|
|
77
|
-
var ContactCard = ({ children, classNames,
|
|
73
|
+
var ContactCard = ({ children, classNames, subject: { fullName, image, organization, emails }, onOrgClick }) => {
|
|
78
74
|
const organizationName = organization && typeof organization === "object" ? organization.target?.name : organization;
|
|
79
75
|
return /* @__PURE__ */ import_react2.default.createElement("div", {
|
|
80
76
|
role: "none",
|
|
81
|
-
className: (0, import_react_ui_theme2.mx)(
|
|
77
|
+
className: (0, import_react_ui_theme2.mx)(previewCard, classNames)
|
|
82
78
|
}, /* @__PURE__ */ import_react2.default.createElement(import_react_ui2.Avatar.Root, null, /* @__PURE__ */ import_react2.default.createElement("div", {
|
|
83
79
|
role: "group",
|
|
84
80
|
className: (0, import_react_ui_theme2.mx)(previewProse, "grid gap-3 grid-cols-[min-content_1fr]")
|
|
@@ -130,17 +126,17 @@ var ContactCard = ({ children, classNames, role, subject: { fullName, image, org
|
|
|
130
126
|
className: "break-words"
|
|
131
127
|
}, value)))), children);
|
|
132
128
|
};
|
|
133
|
-
var OrganizationCard = ({ children, classNames, subject: { name, image, description, website }
|
|
129
|
+
var OrganizationCard = ({ children, classNames, subject: { name, image, description, website } }) => {
|
|
134
130
|
return /* @__PURE__ */ import_react3.default.createElement("div", {
|
|
135
131
|
role: "none",
|
|
136
|
-
className: (0, import_react_ui_theme3.mx)(
|
|
132
|
+
className: (0, import_react_ui_theme3.mx)(previewCard, classNames)
|
|
137
133
|
}, image ? /* @__PURE__ */ import_react3.default.createElement("img", {
|
|
138
134
|
className: "aspect-video object-cover is-full bs-auto",
|
|
139
135
|
src: image,
|
|
140
136
|
alt: name
|
|
141
137
|
}) : /* @__PURE__ */ import_react3.default.createElement("div", {
|
|
142
138
|
role: "image",
|
|
143
|
-
className: "grid aspect-video place-items-center bg-
|
|
139
|
+
className: "grid aspect-video place-items-center bg-groupSurface text-subdued"
|
|
144
140
|
}, /* @__PURE__ */ import_react3.default.createElement(import_react_ui3.Icon, {
|
|
145
141
|
icon: "ph--building-office--regular",
|
|
146
142
|
size: 10
|
|
@@ -166,10 +162,10 @@ var OrganizationCard = ({ children, classNames, subject: { name, image, descript
|
|
|
166
162
|
icon: "ph--arrow-square-out--regular"
|
|
167
163
|
}))), children);
|
|
168
164
|
};
|
|
169
|
-
var ProjectCard = ({ classNames,
|
|
165
|
+
var ProjectCard = ({ classNames, subject: { name, image, description } }) => {
|
|
170
166
|
return /* @__PURE__ */ import_react4.default.createElement("div", {
|
|
171
167
|
role: "none",
|
|
172
|
-
className: (0, import_react_ui_theme4.mx)(
|
|
168
|
+
className: (0, import_react_ui_theme4.mx)(previewCard, classNames)
|
|
173
169
|
}, image && /* @__PURE__ */ import_react4.default.createElement("img", {
|
|
174
170
|
className: "is-full bs-auto",
|
|
175
171
|
src: image,
|
|
@@ -216,8 +212,8 @@ var PreviewPlugin = () => (0, import_app_framework.definePlugin)(meta, [
|
|
|
216
212
|
activatesOn: import_plugin_client.ClientEvents.SetupSchema,
|
|
217
213
|
activate: () => [
|
|
218
214
|
(0, import_app_framework.contributes)(import_plugin_client.ClientCapabilities.Schema, [
|
|
219
|
-
import_schema.
|
|
220
|
-
import_schema.
|
|
215
|
+
import_schema.Contact,
|
|
216
|
+
import_schema.Organization
|
|
221
217
|
])
|
|
222
218
|
]
|
|
223
219
|
}),
|
|
@@ -251,7 +247,7 @@ var PreviewPlugin = () => (0, import_app_framework.definePlugin)(meta, [
|
|
|
251
247
|
if (!document.defaultView) {
|
|
252
248
|
import_log.log.warn("No default view found", void 0, {
|
|
253
249
|
F: __dxlog_file,
|
|
254
|
-
L:
|
|
250
|
+
L: 105,
|
|
255
251
|
S: void 0,
|
|
256
252
|
C: (f, a) => f(...a)
|
|
257
253
|
});
|
|
@@ -272,18 +268,15 @@ var PreviewPlugin = () => (0, import_app_framework.definePlugin)(meta, [
|
|
|
272
268
|
//
|
|
273
269
|
(0, import_app_framework.createSurface)({
|
|
274
270
|
id: `${PREVIEW_PLUGIN}/schema-popover`,
|
|
275
|
-
role:
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
],
|
|
279
|
-
filter: (data) => (0, import_echo_schema.isInstanceOf)(import_schema.DataType.Person, data.subject),
|
|
280
|
-
component: ({ data, role }) => {
|
|
271
|
+
role: "popover",
|
|
272
|
+
filter: (data) => (0, import_echo_schema.isInstanceOf)(import_schema.Contact, data.subject),
|
|
273
|
+
component: ({ data }) => {
|
|
281
274
|
const { dispatchPromise: dispatch } = (0, import_app_framework.useIntentDispatcher)();
|
|
282
275
|
const handleOrgClick = (0, import_react.useCallback)(async (org) => {
|
|
283
276
|
const space = (0, import_echo.getSpace)(org);
|
|
284
277
|
const tablesQuery = await space?.db.query(import_echo.Filter.schema(import_react_ui_table.TableType)).run();
|
|
285
278
|
const currentSpaceOrgTable = tablesQuery?.objects.find((table) => {
|
|
286
|
-
return table.view?.target?.query?.typename === import_schema.
|
|
279
|
+
return table.view?.target?.query?.typename === import_schema.Organization.typename;
|
|
287
280
|
});
|
|
288
281
|
await dispatch((0, import_app_framework.createIntent)(import_app_framework.LayoutAction.UpdatePopover, {
|
|
289
282
|
part: "popover",
|
|
@@ -308,9 +301,8 @@ var PreviewPlugin = () => (0, import_app_framework.definePlugin)(meta, [
|
|
|
308
301
|
]);
|
|
309
302
|
return /* @__PURE__ */ import_react.default.createElement(ContactCard, {
|
|
310
303
|
subject: data.subject,
|
|
311
|
-
onOrgClick: handleOrgClick
|
|
312
|
-
|
|
313
|
-
}, role === "popover" && /* @__PURE__ */ import_react.default.createElement(import_app_framework.Surface, {
|
|
304
|
+
onOrgClick: handleOrgClick
|
|
305
|
+
}, /* @__PURE__ */ import_react.default.createElement(import_app_framework.Surface, {
|
|
314
306
|
role: "related",
|
|
315
307
|
data
|
|
316
308
|
}));
|
|
@@ -318,29 +310,21 @@ var PreviewPlugin = () => (0, import_app_framework.definePlugin)(meta, [
|
|
|
318
310
|
}),
|
|
319
311
|
(0, import_app_framework.createSurface)({
|
|
320
312
|
id: `${PREVIEW_PLUGIN}/schema-popover`,
|
|
321
|
-
role:
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
component: ({ data, role }) => /* @__PURE__ */ import_react.default.createElement(OrganizationCard, {
|
|
327
|
-
subject: data.subject,
|
|
328
|
-
role
|
|
329
|
-
}, role === "popover" && /* @__PURE__ */ import_react.default.createElement(import_app_framework.Surface, {
|
|
313
|
+
role: "popover",
|
|
314
|
+
filter: (data) => (0, import_echo_schema.isInstanceOf)(import_schema.Organization, data.subject),
|
|
315
|
+
component: ({ data }) => /* @__PURE__ */ import_react.default.createElement(OrganizationCard, {
|
|
316
|
+
subject: data.subject
|
|
317
|
+
}, /* @__PURE__ */ import_react.default.createElement(import_app_framework.Surface, {
|
|
330
318
|
role: "related",
|
|
331
319
|
data
|
|
332
320
|
}))
|
|
333
321
|
}),
|
|
334
322
|
(0, import_app_framework.createSurface)({
|
|
335
323
|
id: `${PREVIEW_PLUGIN}/schema-popover`,
|
|
336
|
-
role:
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
filter: (data) => (0, import_echo_schema.isInstanceOf)(import_schema.DataType.Project, data.subject),
|
|
341
|
-
component: ({ data, role }) => /* @__PURE__ */ import_react.default.createElement(ProjectCard, {
|
|
342
|
-
subject: data.subject,
|
|
343
|
-
role
|
|
324
|
+
role: "popover",
|
|
325
|
+
filter: (data) => (0, import_echo_schema.isInstanceOf)(import_schema.Project, data.subject),
|
|
326
|
+
component: ({ data }) => /* @__PURE__ */ import_react.default.createElement(ProjectCard, {
|
|
327
|
+
subject: data.subject
|
|
344
328
|
})
|
|
345
329
|
}),
|
|
346
330
|
//
|
|
@@ -348,13 +332,10 @@ var PreviewPlugin = () => (0, import_app_framework.definePlugin)(meta, [
|
|
|
348
332
|
//
|
|
349
333
|
(0, import_app_framework.createSurface)({
|
|
350
334
|
id: `${PREVIEW_PLUGIN}/fallback-popover`,
|
|
351
|
-
role:
|
|
352
|
-
"popover",
|
|
353
|
-
"card--kanban"
|
|
354
|
-
],
|
|
335
|
+
role: "popover",
|
|
355
336
|
position: "fallback",
|
|
356
337
|
filter: (data) => (0, import_echo.isEchoObject)(data.subject),
|
|
357
|
-
component: ({ data
|
|
338
|
+
component: ({ data }) => {
|
|
358
339
|
const schema = (0, import_echo.getSchema)(data.subject);
|
|
359
340
|
const { t } = (0, import_react_ui.useTranslation)(PREVIEW_PLUGIN);
|
|
360
341
|
if (!schema) {
|
|
@@ -365,10 +346,7 @@ var PreviewPlugin = () => (0, import_app_framework.definePlugin)(meta, [
|
|
|
365
346
|
return /* @__PURE__ */ import_react.default.createElement(import_react_ui_form.Form, {
|
|
366
347
|
schema,
|
|
367
348
|
values: data.subject,
|
|
368
|
-
readonly: true
|
|
369
|
-
...role === "card--kanban" && {
|
|
370
|
-
classNames: kanbanCardWithoutPoster
|
|
371
|
-
}
|
|
349
|
+
readonly: true
|
|
372
350
|
});
|
|
373
351
|
}
|
|
374
352
|
})
|
|
@@ -380,10 +358,8 @@ var PreviewPlugin = () => (0, import_app_framework.definePlugin)(meta, [
|
|
|
380
358
|
0 && (module.exports = {
|
|
381
359
|
PREVIEW_PLUGIN,
|
|
382
360
|
PreviewPlugin,
|
|
383
|
-
defaultCard,
|
|
384
|
-
kanbanCardWithoutPoster,
|
|
385
361
|
meta,
|
|
386
|
-
|
|
362
|
+
previewCard,
|
|
387
363
|
previewChrome,
|
|
388
364
|
previewProse,
|
|
389
365
|
previewTitle
|