@dxos/plugin-preview 0.8.2-main.10c050d

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 (70) hide show
  1. package/LICENSE +8 -0
  2. package/README.md +1 -0
  3. package/dist/lib/browser/chunk-B2VK6GFP.mjs +28 -0
  4. package/dist/lib/browser/chunk-B2VK6GFP.mjs.map +7 -0
  5. package/dist/lib/browser/index.mjs +72 -0
  6. package/dist/lib/browser/index.mjs.map +7 -0
  7. package/dist/lib/browser/meta.json +1 -0
  8. package/dist/lib/browser/preview-popover-S3OY3CFZ.mjs +65 -0
  9. package/dist/lib/browser/preview-popover-S3OY3CFZ.mjs.map +7 -0
  10. package/dist/lib/browser/react-surface-XDHP6EN7.mjs +285 -0
  11. package/dist/lib/browser/react-surface-XDHP6EN7.mjs.map +7 -0
  12. package/dist/lib/node/chunk-VFSOM2B4.cjs +55 -0
  13. package/dist/lib/node/chunk-VFSOM2B4.cjs.map +7 -0
  14. package/dist/lib/node/index.cjs +97 -0
  15. package/dist/lib/node/index.cjs.map +7 -0
  16. package/dist/lib/node/meta.json +1 -0
  17. package/dist/lib/node/preview-popover-GPBOHU5E.cjs +84 -0
  18. package/dist/lib/node/preview-popover-GPBOHU5E.cjs.map +7 -0
  19. package/dist/lib/node/react-surface-CPAQ7ZYR.cjs +297 -0
  20. package/dist/lib/node/react-surface-CPAQ7ZYR.cjs.map +7 -0
  21. package/dist/lib/node-esm/chunk-PYKIS3N7.mjs +30 -0
  22. package/dist/lib/node-esm/chunk-PYKIS3N7.mjs.map +7 -0
  23. package/dist/lib/node-esm/index.mjs +73 -0
  24. package/dist/lib/node-esm/index.mjs.map +7 -0
  25. package/dist/lib/node-esm/meta.json +1 -0
  26. package/dist/lib/node-esm/preview-popover-EQAEYYDT.mjs +67 -0
  27. package/dist/lib/node-esm/preview-popover-EQAEYYDT.mjs.map +7 -0
  28. package/dist/lib/node-esm/react-surface-QJRHN4PN.mjs +286 -0
  29. package/dist/lib/node-esm/react-surface-QJRHN4PN.mjs.map +7 -0
  30. package/dist/types/src/Preview.stories.d.ts +141 -0
  31. package/dist/types/src/Preview.stories.d.ts.map +1 -0
  32. package/dist/types/src/PreviewPlugin.d.ts +2 -0
  33. package/dist/types/src/PreviewPlugin.d.ts.map +1 -0
  34. package/dist/types/src/capabilities/index.d.ts +3 -0
  35. package/dist/types/src/capabilities/index.d.ts.map +1 -0
  36. package/dist/types/src/capabilities/preview-popover.d.ts +4 -0
  37. package/dist/types/src/capabilities/preview-popover.d.ts.map +1 -0
  38. package/dist/types/src/capabilities/react-surface.d.ts +4 -0
  39. package/dist/types/src/capabilities/react-surface.d.ts.map +1 -0
  40. package/dist/types/src/components/ContactCard.d.ts +7 -0
  41. package/dist/types/src/components/ContactCard.d.ts.map +1 -0
  42. package/dist/types/src/components/OrganizationCard.d.ts +5 -0
  43. package/dist/types/src/components/OrganizationCard.d.ts.map +1 -0
  44. package/dist/types/src/components/ProjectCard.d.ts +5 -0
  45. package/dist/types/src/components/ProjectCard.d.ts.map +1 -0
  46. package/dist/types/src/components/index.d.ts +4 -0
  47. package/dist/types/src/components/index.d.ts.map +1 -0
  48. package/dist/types/src/index.d.ts +4 -0
  49. package/dist/types/src/index.d.ts.map +1 -0
  50. package/dist/types/src/meta.d.ts +4 -0
  51. package/dist/types/src/meta.d.ts.map +1 -0
  52. package/dist/types/src/translations.d.ts +9 -0
  53. package/dist/types/src/translations.d.ts.map +1 -0
  54. package/dist/types/src/types.d.ts +25 -0
  55. package/dist/types/src/types.d.ts.map +1 -0
  56. package/dist/types/tsconfig.tsbuildinfo +1 -0
  57. package/package.json +61 -0
  58. package/src/Preview.stories.tsx +145 -0
  59. package/src/PreviewPlugin.tsx +35 -0
  60. package/src/capabilities/index.ts +8 -0
  61. package/src/capabilities/preview-popover.ts +65 -0
  62. package/src/capabilities/react-surface.tsx +126 -0
  63. package/src/components/ContactCard.tsx +70 -0
  64. package/src/components/OrganizationCard.tsx +48 -0
  65. package/src/components/ProjectCard.tsx +24 -0
  66. package/src/components/index.ts +7 -0
  67. package/src/index.ts +8 -0
  68. package/src/meta.ts +14 -0
  69. package/src/translations.ts +15 -0
  70. package/src/types.ts +40 -0
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/capabilities/react-surface.tsx", "../../../src/components/ContactCard.tsx", "../../../src/components/OrganizationCard.tsx", "../../../src/components/ProjectCard.tsx"],
4
+ "sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport React, { useCallback } from 'react';\n\nimport {\n Capabilities,\n LayoutAction,\n Surface,\n contributes,\n createIntent,\n createSurface,\n useIntentDispatcher,\n} from '@dxos/app-framework';\nimport { Filter, fullyQualifiedId, getSchema, getSpace, isEchoObject, type AnyLiveObject } from '@dxos/client/echo';\nimport { isInstanceOf, type JsonPath, setValue } from '@dxos/echo-schema';\nimport { useTranslation } from '@dxos/react-ui';\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 { PREVIEW_PLUGIN } from '../meta';\nimport { kanbanCardWithoutPoster } from '../types';\n\nexport default () =>\n contributes(Capabilities.ReactSurface, [\n //\n // Specific schema types.\n //\n createSurface({\n id: `${PREVIEW_PLUGIN}/schema-popover--contact`,\n role: ['popover', 'card--kanban', 'card'],\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.type(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--organization`,\n role: ['popover', 'card--kanban', 'card'],\n filter: (data): data is { subject: DataType.Organization } => 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--project`,\n role: ['popover', 'card--kanban', 'card'],\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', 'card'],\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 const handleSave = useCallback((values: any, { changed }: { changed: Record<string, boolean> }) => {\n const changedPaths = Object.keys(changed).filter((path) => changed[path]);\n for (const path of changedPaths) {\n const value = values[path];\n setValue(data.subject, path as JsonPath, value);\n }\n }, []);\n\n return (\n <Form\n schema={schema}\n values={data.subject}\n readonly={role === 'popover'}\n onSave={handleSave}\n autoSave\n {...(role === 'card--kanban' && { classNames: kanbanCardWithoutPoster })}\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-inputSurface 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\n className='dx-button dx-focus-ring gap-2'\n data-variant='ghost'\n href={website}\n target='_blank'\n rel='noreferrer'\n >\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"],
5
+ "mappings": ";;;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QAC3C;MACF,GAAG,CAAA,CAAE;AAEL,aACE9B,6BAAAA,QAAA,cAAC0G,2BAAAA;QACCb;QACAM,QAAQ/C,KAAK7D;QACboH,UAAUrH,SAAS;QACnBsH,QAAQV;QACRW,UAAAA;QACC,GAAIvH,SAAS,kBAAkB;UAAED,YAAYyH;QAAwB;;IAG5E;EACF,CAAA;CACD;",
6
+ "names": ["import_react", "import_react_ui", "import_react_ui_theme", "ContactCard", "children", "classNames", "role", "subject", "fullName", "image", "organization", "emails", "onOrgClick", "organizationName", "target", "name", "React", "div", "className", "mx", "popoverCard", "defaultCard", "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", "OrganizationCard", "description", "website", "img", "src", "alt", "a", "href", "rel", "ProjectCard", "contributes", "Capabilities", "ReactSurface", "createSurface", "id", "PREVIEW_PLUGIN", "filter", "data", "isInstanceOf", "DataType", "Person", "component", "dispatchPromise", "dispatch", "useIntentDispatcher", "handleOrgClick", "useCallback", "org", "space", "getSpace", "tablesQuery", "db", "query", "Filter", "type", "TableType", "run", "currentSpaceOrgTable", "objects", "find", "table", "view", "typename", "Organization", "createIntent", "LayoutAction", "UpdatePopover", "part", "options", "state", "anchorId", "Open", "fullyQualifiedId", "workspace", "Surface", "Project", "position", "isEchoObject", "schema", "getSchema", "t", "useTranslation", "descriptionMessage", "handleSave", "values", "changed", "changedPaths", "Object", "keys", "path", "setValue", "Form", "readonly", "onSave", "autoSave", "kanbanCardWithoutPoster"]
7
+ }
@@ -0,0 +1,30 @@
1
+ import { createRequire } from 'node:module';const require = createRequire(import.meta.url);
2
+
3
+ // packages/plugins/plugin-preview/src/meta.ts
4
+ var PREVIEW_PLUGIN = "dxos.org/plugin/preview";
5
+ var meta = {
6
+ id: PREVIEW_PLUGIN,
7
+ name: "Preview",
8
+ icon: "ph--eye--regular",
9
+ source: "https://github.com/dxos/dxos/tree/main/packages/plugins/plugin-preview"
10
+ };
11
+
12
+ // packages/plugins/plugin-preview/src/types.ts
13
+ var popoverCard = "popover-card-width rounded-lg overflow-hidden";
14
+ var defaultCard = "";
15
+ var kanbanCardWithoutPoster = "pbs-[--rail-action]";
16
+ var previewTitle = "text-lg font-medium line-clamp-2";
17
+ var previewProse = "pli-3 mlb-3";
18
+ var previewChrome = "pli-1.5 mlb-1.5 [&_.dx-button]:pli-1.5 [&_.dx-button]:text-start [&_.dx-button]:is-full";
19
+
20
+ export {
21
+ PREVIEW_PLUGIN,
22
+ meta,
23
+ popoverCard,
24
+ defaultCard,
25
+ kanbanCardWithoutPoster,
26
+ previewTitle,
27
+ previewProse,
28
+ previewChrome
29
+ };
30
+ //# sourceMappingURL=chunk-PYKIS3N7.mjs.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/meta.ts", "../../../src/types.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-card-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"],
5
+ "mappings": ";;;AAMO,IAAMA,iBAAiB;AAEvB,IAAMC,OAAmB;EAC9BC,IAAIF;EACJG,MAAM;EACNC,MAAM;EACNC,QAAQ;AACV;;;ACqBO,IAAMC,cAAc;AACpB,IAAMC,cAAc;AACpB,IAAMC,0BAA0B;AAChC,IAAMC,eAAe;AACrB,IAAMC,eAAe;AACrB,IAAMC,gBAAgB;",
6
+ "names": ["PREVIEW_PLUGIN", "meta", "id", "name", "icon", "source", "popoverCard", "defaultCard", "kanbanCardWithoutPoster", "previewTitle", "previewProse", "previewChrome"]
7
+ }
@@ -0,0 +1,73 @@
1
+ import { createRequire } from 'node:module';const require = createRequire(import.meta.url);
2
+ import {
3
+ PREVIEW_PLUGIN,
4
+ defaultCard,
5
+ kanbanCardWithoutPoster,
6
+ meta,
7
+ popoverCard,
8
+ previewChrome,
9
+ previewProse,
10
+ previewTitle
11
+ } from "./chunk-PYKIS3N7.mjs";
12
+
13
+ // packages/plugins/plugin-preview/src/PreviewPlugin.tsx
14
+ import { Capabilities, Events, contributes, defineModule, definePlugin } from "@dxos/app-framework";
15
+ import { ClientCapabilities, ClientEvents } from "@dxos/plugin-client";
16
+ import { DataType } from "@dxos/schema";
17
+
18
+ // packages/plugins/plugin-preview/src/capabilities/index.ts
19
+ import { lazy } from "@dxos/app-framework";
20
+ var PreviewPopover = lazy(() => import("./preview-popover-EQAEYYDT.mjs"));
21
+ var ReactSurface = lazy(() => import("./react-surface-QJRHN4PN.mjs"));
22
+
23
+ // packages/plugins/plugin-preview/src/translations.ts
24
+ var translations_default = [
25
+ {
26
+ "en-US": {
27
+ [PREVIEW_PLUGIN]: {
28
+ "unable to create preview message": "No preview"
29
+ }
30
+ }
31
+ }
32
+ ];
33
+
34
+ // packages/plugins/plugin-preview/src/PreviewPlugin.tsx
35
+ var PreviewPlugin = () => definePlugin(meta, [
36
+ defineModule({
37
+ id: `${meta.id}/module/translations`,
38
+ activatesOn: Events.SetupTranslations,
39
+ activate: () => contributes(Capabilities.Translations, translations_default)
40
+ }),
41
+ defineModule({
42
+ id: `${meta.id}/module/schema`,
43
+ activatesOn: ClientEvents.SetupSchema,
44
+ activate: () => [
45
+ contributes(ClientCapabilities.Schema, [
46
+ DataType.Person,
47
+ DataType.Organization
48
+ ])
49
+ ]
50
+ }),
51
+ defineModule({
52
+ id: `${meta.id}/module/preview-popover`,
53
+ activatesOn: Events.Startup,
54
+ activate: PreviewPopover
55
+ }),
56
+ defineModule({
57
+ id: `${meta.id}/module/react-surface`,
58
+ activatesOn: Events.SetupReactSurface,
59
+ activate: ReactSurface
60
+ })
61
+ ]);
62
+ export {
63
+ PREVIEW_PLUGIN,
64
+ PreviewPlugin,
65
+ defaultCard,
66
+ kanbanCardWithoutPoster,
67
+ meta,
68
+ popoverCard,
69
+ previewChrome,
70
+ previewProse,
71
+ previewTitle
72
+ };
73
+ //# sourceMappingURL=index.mjs.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/PreviewPlugin.tsx", "../../../src/capabilities/index.ts", "../../../src/translations.ts"],
4
+ "sourcesContent": ["//\n// Copyright 2023 DXOS.org\n//\n\nimport { Capabilities, Events, contributes, defineModule, definePlugin } from '@dxos/app-framework';\nimport { ClientCapabilities, ClientEvents } from '@dxos/plugin-client';\nimport { DataType } from '@dxos/schema';\n\nimport { PreviewPopover, ReactSurface } from './capabilities';\nimport { meta } from './meta';\nimport translations from './translations';\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: PreviewPopover,\n }),\n defineModule({\n id: `${meta.id}/module/react-surface`,\n activatesOn: Events.SetupReactSurface,\n activate: ReactSurface,\n }),\n ]);\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport { lazy } from '@dxos/app-framework';\n\nexport const PreviewPopover = lazy(() => import('./preview-popover'));\nexport const ReactSurface = lazy(() => import('./react-surface'));\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": ";;;;;;;;;;;;;AAIA,SAASA,cAAcC,QAAQC,aAAaC,cAAcC,oBAAoB;AAC9E,SAASC,oBAAoBC,oBAAoB;AACjD,SAASC,gBAAgB;;;ACFzB,SAASC,YAAY;AAEd,IAAMC,iBAAiBC,KAAK,MAAM,OAAO,gCAAA,CAAA;AACzC,IAAMC,eAAeD,KAAK,MAAM,OAAO,8BAAA,CAAA;;;ACD9C,IAAA,uBAAe;EACb;IACE,SAAS;MACP,CAACE,cAAAA,GAAiB;QAChB,oCAAoC;MACtC;IACF;EACF;;;;AFDK,IAAMC,gBAAgB,MAC3BC,aAAaC,MAAM;EACjBC,aAAa;IACXC,IAAI,GAAGF,KAAKE,EAAE;IACdC,aAAaC,OAAOC;IACpBC,UAAU,MAAMC,YAAYC,aAAaC,cAAcC,oBAAAA;EACzD,CAAA;EACAT,aAAa;IACXC,IAAI,GAAGF,KAAKE,EAAE;IACdC,aAAaQ,aAAaC;IAC1BN,UAAU,MAAM;MAACC,YAAYM,mBAAmBC,QAAQ;QAACC,SAASC;QAAQD,SAASE;OAAa;;EAClG,CAAA;EACAhB,aAAa;IACXC,IAAI,GAAGF,KAAKE,EAAE;IACdC,aAAaC,OAAOc;IACpBZ,UAAUa;EACZ,CAAA;EACAlB,aAAa;IACXC,IAAI,GAAGF,KAAKE,EAAE;IACdC,aAAaC,OAAOgB;IACpBd,UAAUe;EACZ,CAAA;CACD;",
6
+ "names": ["Capabilities", "Events", "contributes", "defineModule", "definePlugin", "ClientCapabilities", "ClientEvents", "DataType", "lazy", "PreviewPopover", "lazy", "ReactSurface", "PREVIEW_PLUGIN", "PreviewPlugin", "definePlugin", "meta", "defineModule", "id", "activatesOn", "Events", "SetupTranslations", "activate", "contributes", "Capabilities", "Translations", "translations", "ClientEvents", "SetupSchema", "ClientCapabilities", "Schema", "DataType", "Person", "Organization", "Startup", "PreviewPopover", "SetupReactSurface", "ReactSurface"]
7
+ }
@@ -0,0 +1 @@
1
+ {"inputs":{"packages/plugins/plugin-preview/src/meta.ts":{"bytes":1256,"imports":[],"format":"esm"},"packages/plugins/plugin-preview/src/types.ts":{"bytes":3596,"imports":[],"format":"esm"},"packages/plugins/plugin-preview/src/capabilities/preview-popover.ts":{"bytes":8209,"imports":[{"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/keys","kind":"import-statement","external":true},{"path":"@dxos/log","kind":"import-statement","external":true},{"path":"@dxos/plugin-client","kind":"import-statement","external":true}],"format":"esm"},"packages/plugins/plugin-preview/src/components/ContactCard.tsx":{"bytes":9715,"imports":[{"path":"@preact-signals/safe-react/tracking","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":"packages/plugins/plugin-preview/src/types.ts","kind":"import-statement","original":"../types"}],"format":"esm"},"packages/plugins/plugin-preview/src/components/OrganizationCard.tsx":{"bytes":6173,"imports":[{"path":"@preact-signals/safe-react/tracking","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":"packages/plugins/plugin-preview/src/types.ts","kind":"import-statement","original":"../types"}],"format":"esm"},"packages/plugins/plugin-preview/src/components/ProjectCard.tsx":{"bytes":3139,"imports":[{"path":"@preact-signals/safe-react/tracking","kind":"import-statement","external":true},{"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":700,"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/capabilities/react-surface.tsx":{"bytes":17294,"imports":[{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/app-framework","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/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/types.ts","kind":"import-statement","original":"../types"}],"format":"esm"},"packages/plugins/plugin-preview/src/capabilities/index.ts":{"bytes":1050,"imports":[{"path":"@dxos/app-framework","kind":"import-statement","external":true},{"path":"packages/plugins/plugin-preview/src/capabilities/preview-popover.ts","kind":"dynamic-import","original":"./preview-popover"},{"path":"packages/plugins/plugin-preview/src/capabilities/react-surface.tsx","kind":"dynamic-import","original":"./react-surface"}],"format":"esm"},"packages/plugins/plugin-preview/src/translations.ts":{"bytes":1051,"imports":[{"path":"packages/plugins/plugin-preview/src/meta.ts","kind":"import-statement","original":"./meta"}],"format":"esm"},"packages/plugins/plugin-preview/src/PreviewPlugin.tsx":{"bytes":4744,"imports":[{"path":"@dxos/app-framework","kind":"import-statement","external":true},{"path":"@dxos/plugin-client","kind":"import-statement","external":true},{"path":"@dxos/schema","kind":"import-statement","external":true},{"path":"packages/plugins/plugin-preview/src/capabilities/index.ts","kind":"import-statement","original":"./capabilities"},{"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":649,"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/node-esm/index.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":3141},"packages/plugins/plugin-preview/dist/lib/node-esm/index.mjs":{"imports":[{"path":"packages/plugins/plugin-preview/dist/lib/node-esm/chunk-PYKIS3N7.mjs","kind":"import-statement"},{"path":"@dxos/app-framework","kind":"import-statement","external":true},{"path":"@dxos/plugin-client","kind":"import-statement","external":true},{"path":"@dxos/schema","kind":"import-statement","external":true},{"path":"@dxos/app-framework","kind":"import-statement","external":true},{"path":"packages/plugins/plugin-preview/dist/lib/node-esm/preview-popover-EQAEYYDT.mjs","kind":"dynamic-import"},{"path":"packages/plugins/plugin-preview/dist/lib/node-esm/react-surface-QJRHN4PN.mjs","kind":"dynamic-import"}],"exports":["PREVIEW_PLUGIN","PreviewPlugin","defaultCard","kanbanCardWithoutPoster","meta","popoverCard","previewChrome","previewProse","previewTitle"],"entryPoint":"packages/plugins/plugin-preview/src/index.ts","inputs":{"packages/plugins/plugin-preview/src/index.ts":{"bytesInOutput":0},"packages/plugins/plugin-preview/src/PreviewPlugin.tsx":{"bytesInOutput":960},"packages/plugins/plugin-preview/src/capabilities/index.ts":{"bytesInOutput":190},"packages/plugins/plugin-preview/src/translations.ts":{"bytesInOutput":152}},"bytes":1994},"packages/plugins/plugin-preview/dist/lib/node-esm/preview-popover-EQAEYYDT.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":4304},"packages/plugins/plugin-preview/dist/lib/node-esm/preview-popover-EQAEYYDT.mjs":{"imports":[{"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/keys","kind":"import-statement","external":true},{"path":"@dxos/log","kind":"import-statement","external":true},{"path":"@dxos/plugin-client","kind":"import-statement","external":true}],"exports":["default"],"entryPoint":"packages/plugins/plugin-preview/src/capabilities/preview-popover.ts","inputs":{"packages/plugins/plugin-preview/src/capabilities/preview-popover.ts":{"bytesInOutput":2014}},"bytes":2281},"packages/plugins/plugin-preview/dist/lib/node-esm/react-surface-QJRHN4PN.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":17741},"packages/plugins/plugin-preview/dist/lib/node-esm/react-surface-QJRHN4PN.mjs":{"imports":[{"path":"packages/plugins/plugin-preview/dist/lib/node-esm/chunk-PYKIS3N7.mjs","kind":"import-statement"},{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/app-framework","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/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":"@preact-signals/safe-react/tracking","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":"@preact-signals/safe-react/tracking","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":"@preact-signals/safe-react/tracking","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/react-ui-theme","kind":"import-statement","external":true}],"exports":["default"],"entryPoint":"packages/plugins/plugin-preview/src/capabilities/react-surface.tsx","inputs":{"packages/plugins/plugin-preview/src/capabilities/react-surface.tsx":{"bytesInOutput":4191},"packages/plugins/plugin-preview/src/components/ContactCard.tsx":{"bytesInOutput":2972},"packages/plugins/plugin-preview/src/components/index.ts":{"bytesInOutput":0},"packages/plugins/plugin-preview/src/components/OrganizationCard.tsx":{"bytesInOutput":1881},"packages/plugins/plugin-preview/src/components/ProjectCard.tsx":{"bytesInOutput":855}},"bytes":10601},"packages/plugins/plugin-preview/dist/lib/node-esm/chunk-PYKIS3N7.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":2195},"packages/plugins/plugin-preview/dist/lib/node-esm/chunk-PYKIS3N7.mjs":{"imports":[],"exports":["PREVIEW_PLUGIN","defaultCard","kanbanCardWithoutPoster","meta","popoverCard","previewChrome","previewProse","previewTitle"],"inputs":{"packages/plugins/plugin-preview/src/meta.ts":{"bytesInOutput":216},"packages/plugins/plugin-preview/src/types.ts":{"bytesInOutput":342}},"bytes":935}}}
@@ -0,0 +1,67 @@
1
+ import { createRequire } from 'node:module';const require = createRequire(import.meta.url);
2
+
3
+ // packages/plugins/plugin-preview/src/capabilities/preview-popover.ts
4
+ import { Capabilities, LayoutAction, contributes, createIntent } from "@dxos/app-framework";
5
+ import { addEventListener } from "@dxos/async";
6
+ import { resolveRef } from "@dxos/client";
7
+ import { parseId } from "@dxos/client/echo";
8
+ import { DXN } from "@dxos/keys";
9
+ import { log } from "@dxos/log";
10
+ import { ClientCapabilities } from "@dxos/plugin-client";
11
+ var __dxlog_file = "/home/runner/work/dxos/dxos/packages/plugins/plugin-preview/src/capabilities/preview-popover.ts";
12
+ var customEventOptions = {
13
+ capture: true,
14
+ passive: false
15
+ };
16
+ var handlePreviewLookup = async (client, defaultSpace, { ref, label }) => {
17
+ const dxn = DXN.parse(ref);
18
+ if (!dxn) {
19
+ return null;
20
+ }
21
+ const object = await resolveRef(client, dxn, defaultSpace);
22
+ return {
23
+ label,
24
+ object
25
+ };
26
+ };
27
+ var preview_popover_default = (context) => {
28
+ const handleDxRefTagActivate = async ({ refId, label, trigger }) => {
29
+ const { dispatchPromise: dispatch } = context.getCapability(Capabilities.IntentDispatcher);
30
+ const client = context.getCapability(ClientCapabilities.Client);
31
+ const [layout] = context.getCapabilities(Capabilities.Layout);
32
+ const { spaceId } = parseId(layout.workspace);
33
+ const space = (spaceId && client.spaces.get(spaceId)) ?? client.spaces.default;
34
+ const result = await handlePreviewLookup(client, space, {
35
+ ref: refId,
36
+ label
37
+ });
38
+ if (!result) {
39
+ return;
40
+ }
41
+ await dispatch(createIntent(LayoutAction.UpdatePopover, {
42
+ part: "popover",
43
+ subject: result.object,
44
+ options: {
45
+ state: true,
46
+ variant: "virtual",
47
+ anchor: trigger
48
+ }
49
+ }));
50
+ };
51
+ let cleanup;
52
+ if (document.defaultView) {
53
+ cleanup = addEventListener(document.defaultView, "dx-ref-tag-activate", handleDxRefTagActivate, customEventOptions);
54
+ } else {
55
+ log.warn("No default view found", void 0, {
56
+ F: __dxlog_file,
57
+ L: 61,
58
+ S: void 0,
59
+ C: (f, a) => f(...a)
60
+ });
61
+ }
62
+ return contributes(Capabilities.Null, null, () => cleanup());
63
+ };
64
+ export {
65
+ preview_popover_default as default
66
+ };
67
+ //# sourceMappingURL=preview-popover-EQAEYYDT.mjs.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/capabilities/preview-popover.ts"],
4
+ "sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport { Capabilities, LayoutAction, contributes, createIntent, type PluginContext } from '@dxos/app-framework';\nimport { addEventListener } from '@dxos/async';\nimport { type Client, resolveRef } from '@dxos/client';\nimport { parseId, type Space } from '@dxos/client/echo';\nimport { DXN } from '@dxos/keys';\nimport { type DxRefTagActivate } from '@dxos/lit-ui';\nimport { log } from '@dxos/log';\nimport { ClientCapabilities } from '@dxos/plugin-client';\nimport { type PreviewLinkRef, type PreviewLinkTarget } from '@dxos/react-ui-editor';\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 default (context: PluginContext) => {\n // TODO(wittjosiah): Factor out lookup handlers to other plugins to make not ECHO-specific.\n const handleDxRefTagActivate = async ({ refId, label, trigger }: DxRefTagActivate) => {\n const { dispatchPromise: dispatch } = context.getCapability(Capabilities.IntentDispatcher);\n const client = context.getCapability(ClientCapabilities.Client);\n const [layout] = context.getCapabilities(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: refId, 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 let cleanup: () => void;\n if (document.defaultView) {\n cleanup = addEventListener(document.defaultView, 'dx-ref-tag-activate', handleDxRefTagActivate, customEventOptions);\n } else {\n log.warn('No default view found');\n }\n\n return contributes(Capabilities.Null, null, () => cleanup());\n};\n"],
5
+ "mappings": ";;;AAIA,SAASA,cAAcC,cAAcC,aAAaC,oBAAwC;AAC1F,SAASC,wBAAwB;AACjC,SAAsBC,kBAAkB;AACxC,SAASC,eAA2B;AACpC,SAASC,WAAW;AAEpB,SAASC,WAAW;AACpB,SAASC,0BAA0B;;AAGnC,IAAMC,qBAAqB;EAAEC,SAAS;EAAMC,SAAS;AAAM;AAE3D,IAAMC,sBAAsB,OAC1BC,QACAC,cACA,EAAEC,KAAKC,MAAK,MAAkB;AAE9B,QAAMC,MAAMX,IAAIY,MAAMH,GAAAA;AACtB,MAAI,CAACE,KAAK;AACR,WAAO;EACT;AAEA,QAAME,SAAS,MAAMf,WAAWS,QAAQI,KAAKH,YAAAA;AAC7C,SAAO;IAAEE;IAAOG;EAAO;AACzB;AAEA,IAAA,0BAAe,CAACC,YAAAA;AAEd,QAAMC,yBAAyB,OAAO,EAAEC,OAAON,OAAOO,QAAO,MAAoB;AAC/E,UAAM,EAAEC,iBAAiBC,SAAQ,IAAKL,QAAQM,cAAc3B,aAAa4B,gBAAgB;AACzF,UAAMd,SAASO,QAAQM,cAAclB,mBAAmBoB,MAAM;AAC9D,UAAM,CAACC,MAAAA,IAAUT,QAAQU,gBAAgB/B,aAAagC,MAAM;AAC5D,UAAM,EAAEC,QAAO,IAAK3B,QAAQwB,OAAOI,SAAS;AAC5C,UAAMC,SAASF,WAAWnB,OAAOsB,OAAOC,IAAIJ,OAAAA,MAAanB,OAAOsB,OAAOE;AACvE,UAAMC,SAAS,MAAM1B,oBAAoBC,QAAQqB,OAAO;MAAEnB,KAAKO;MAAON;IAAM,CAAA;AAC5E,QAAI,CAACsB,QAAQ;AACX;IACF;AAEA,UAAMb,SACJvB,aAAaF,aAAauC,eAAe;MACvCC,MAAM;MACNC,SAASH,OAAOnB;MAChBuB,SAAS;QACPC,OAAO;QACPC,SAAS;QACTC,QAAQtB;MACV;IACF,CAAA,CAAA;EAEJ;AAEA,MAAIuB;AACJ,MAAIC,SAASC,aAAa;AACxBF,cAAU3C,iBAAiB4C,SAASC,aAAa,uBAAuB3B,wBAAwBZ,kBAAAA;EAClG,OAAO;AACLF,QAAI0C,KAAK,yBAAA,QAAA;;;;;;EACX;AAEA,SAAOhD,YAAYF,aAAamD,MAAM,MAAM,MAAMJ,QAAAA,CAAAA;AACpD;",
6
+ "names": ["Capabilities", "LayoutAction", "contributes", "createIntent", "addEventListener", "resolveRef", "parseId", "DXN", "log", "ClientCapabilities", "customEventOptions", "capture", "passive", "handlePreviewLookup", "client", "defaultSpace", "ref", "label", "dxn", "parse", "object", "context", "handleDxRefTagActivate", "refId", "trigger", "dispatchPromise", "dispatch", "getCapability", "IntentDispatcher", "Client", "layout", "getCapabilities", "Layout", "spaceId", "workspace", "space", "spaces", "get", "default", "result", "UpdatePopover", "part", "subject", "options", "state", "variant", "anchor", "cleanup", "document", "defaultView", "warn", "Null"]
7
+ }
@@ -0,0 +1,286 @@
1
+ import { createRequire } from 'node:module';const require = createRequire(import.meta.url);
2
+ import {
3
+ PREVIEW_PLUGIN,
4
+ defaultCard,
5
+ kanbanCardWithoutPoster,
6
+ popoverCard,
7
+ previewChrome,
8
+ previewProse,
9
+ previewTitle
10
+ } from "./chunk-PYKIS3N7.mjs";
11
+
12
+ // packages/plugins/plugin-preview/src/capabilities/react-surface.tsx
13
+ import React4, { useCallback } from "react";
14
+ import { Capabilities, LayoutAction, Surface, contributes, createIntent, createSurface, useIntentDispatcher } from "@dxos/app-framework";
15
+ import { Filter, fullyQualifiedId, getSchema, getSpace, isEchoObject } from "@dxos/client/echo";
16
+ import { isInstanceOf, setValue } from "@dxos/echo-schema";
17
+ import { useTranslation } from "@dxos/react-ui";
18
+ import { Form } from "@dxos/react-ui-form";
19
+ import { TableType } from "@dxos/react-ui-table";
20
+ import { descriptionMessage } from "@dxos/react-ui-theme";
21
+ import { DataType } from "@dxos/schema";
22
+
23
+ // packages/plugins/plugin-preview/src/components/ContactCard.tsx
24
+ import { useSignals as _useSignals } from "@preact-signals/safe-react/tracking";
25
+ import React, { Fragment } from "react";
26
+ import { Icon, Avatar, Button } from "@dxos/react-ui";
27
+ import { mx } from "@dxos/react-ui-theme";
28
+ var ContactCard = ({ children, classNames, role, subject: { fullName, image, organization, emails }, onOrgClick }) => {
29
+ var _effect = _useSignals();
30
+ try {
31
+ const organizationName = organization && typeof organization === "object" ? organization.target?.name : organization;
32
+ return /* @__PURE__ */ React.createElement("div", {
33
+ role: "none",
34
+ className: mx(role === "popover" ? popoverCard : defaultCard, classNames)
35
+ }, /* @__PURE__ */ React.createElement(Avatar.Root, null, /* @__PURE__ */ React.createElement("div", {
36
+ role: "group",
37
+ className: mx(previewProse, "grid gap-3 grid-cols-[min-content_1fr]")
38
+ }, /* @__PURE__ */ React.createElement(Avatar.Content, {
39
+ imgSrc: image,
40
+ icon: "ph--user--regular",
41
+ size: 16,
42
+ hue: "neutral"
43
+ }), /* @__PURE__ */ React.createElement("div", {
44
+ role: "none",
45
+ className: "bs-min self-center"
46
+ }, /* @__PURE__ */ React.createElement(Avatar.Label, {
47
+ asChild: true
48
+ }, /* @__PURE__ */ React.createElement("h2", {
49
+ className: previewTitle
50
+ }, fullName))))), organizationName && /* @__PURE__ */ React.createElement("div", {
51
+ role: "none",
52
+ className: previewChrome
53
+ }, typeof organization === "object" && onOrgClick ? /* @__PURE__ */ React.createElement(Button, {
54
+ variant: "ghost",
55
+ classNames: "gap-2 text-start",
56
+ onClick: () => onOrgClick(organization.target)
57
+ }, /* @__PURE__ */ React.createElement(Icon, {
58
+ icon: "ph--buildings--regular",
59
+ size: 5,
60
+ classNames: "text-subdued"
61
+ }), /* @__PURE__ */ React.createElement("span", {
62
+ className: "min-is-0 flex-1 truncate"
63
+ }, organizationName), /* @__PURE__ */ React.createElement(Icon, {
64
+ icon: "ph--arrow-right--regular"
65
+ })) : /* @__PURE__ */ React.createElement("p", {
66
+ className: "dx-button gap-2",
67
+ "data-variant": "ghost"
68
+ }, /* @__PURE__ */ React.createElement(Icon, {
69
+ icon: "ph--buildings--regular",
70
+ size: 5,
71
+ classNames: "text-subdued"
72
+ }), /* @__PURE__ */ React.createElement("span", {
73
+ className: "min-is-0 flex-1 truncate"
74
+ }, organizationName))), /* @__PURE__ */ React.createElement("dl", {
75
+ className: mx(previewProse, "grid gap-2 grid-cols-[min-content_1fr] [&_dt]:text-subdued [&_dt]:pbs-0.5 [&_dd]:min-is-0")
76
+ }, emails?.length && emails.map(({ label, value }) => /* @__PURE__ */ React.createElement(Fragment, {
77
+ key: value
78
+ }, /* @__PURE__ */ React.createElement("dt", null, /* @__PURE__ */ React.createElement(Icon, {
79
+ icon: "ph--at--regular",
80
+ size: 5
81
+ })), /* @__PURE__ */ React.createElement("dd", {
82
+ key: value,
83
+ className: "break-words"
84
+ }, value)))), children);
85
+ } finally {
86
+ _effect.f();
87
+ }
88
+ };
89
+
90
+ // packages/plugins/plugin-preview/src/components/OrganizationCard.tsx
91
+ import { useSignals as _useSignals2 } from "@preact-signals/safe-react/tracking";
92
+ import React2 from "react";
93
+ import { Icon as Icon2 } from "@dxos/react-ui";
94
+ import { mx as mx2 } from "@dxos/react-ui-theme";
95
+ var OrganizationCard = ({ children, classNames, subject: { name, image, description, website }, role }) => {
96
+ var _effect = _useSignals2();
97
+ try {
98
+ return /* @__PURE__ */ React2.createElement("div", {
99
+ role: "none",
100
+ className: mx2(role === "popover" ? popoverCard : defaultCard, classNames)
101
+ }, image ? /* @__PURE__ */ React2.createElement("img", {
102
+ className: "aspect-video object-cover is-full bs-auto",
103
+ src: image,
104
+ alt: name
105
+ }) : /* @__PURE__ */ React2.createElement("div", {
106
+ role: "image",
107
+ className: "grid aspect-video place-items-center bg-inputSurface text-subdued"
108
+ }, /* @__PURE__ */ React2.createElement(Icon2, {
109
+ icon: "ph--building-office--regular",
110
+ size: 10
111
+ })), /* @__PURE__ */ React2.createElement("h2", {
112
+ className: mx2(previewTitle, previewProse)
113
+ }, name), description && /* @__PURE__ */ React2.createElement("p", {
114
+ className: mx2(previewProse, "line-clamp-2")
115
+ }, description), website && /* @__PURE__ */ React2.createElement("div", {
116
+ role: "none",
117
+ className: previewChrome
118
+ }, /* @__PURE__ */ React2.createElement("a", {
119
+ className: "dx-button dx-focus-ring gap-2",
120
+ "data-variant": "ghost",
121
+ href: website,
122
+ target: "_blank",
123
+ rel: "noreferrer"
124
+ }, /* @__PURE__ */ React2.createElement(Icon2, {
125
+ icon: "ph--link--regular",
126
+ size: 5,
127
+ classNames: "text-subdued"
128
+ }), /* @__PURE__ */ React2.createElement("span", {
129
+ className: "grow"
130
+ }, website), /* @__PURE__ */ React2.createElement(Icon2, {
131
+ icon: "ph--arrow-square-out--regular"
132
+ }))), children);
133
+ } finally {
134
+ _effect.f();
135
+ }
136
+ };
137
+
138
+ // packages/plugins/plugin-preview/src/components/ProjectCard.tsx
139
+ import { useSignals as _useSignals3 } from "@preact-signals/safe-react/tracking";
140
+ import React3 from "react";
141
+ import { mx as mx3 } from "@dxos/react-ui-theme";
142
+ var ProjectCard = ({ classNames, role, subject: { name, image, description } }) => {
143
+ var _effect = _useSignals3();
144
+ try {
145
+ return /* @__PURE__ */ React3.createElement("div", {
146
+ role: "none",
147
+ className: mx3(role === "popover" ? popoverCard : defaultCard, classNames)
148
+ }, image && /* @__PURE__ */ React3.createElement("img", {
149
+ className: "is-full bs-auto",
150
+ src: image,
151
+ alt: name
152
+ }), /* @__PURE__ */ React3.createElement("h2", {
153
+ className: mx3(previewTitle, "pli-3 mlb-3")
154
+ }, name), description && /* @__PURE__ */ React3.createElement("p", {
155
+ className: "pli-3 line-clamp-2 mlb-3"
156
+ }, description));
157
+ } finally {
158
+ _effect.f();
159
+ }
160
+ };
161
+
162
+ // packages/plugins/plugin-preview/src/capabilities/react-surface.tsx
163
+ var react_surface_default = () => contributes(Capabilities.ReactSurface, [
164
+ //
165
+ // Specific schema types.
166
+ //
167
+ createSurface({
168
+ id: `${PREVIEW_PLUGIN}/schema-popover--contact`,
169
+ role: [
170
+ "popover",
171
+ "card--kanban",
172
+ "card"
173
+ ],
174
+ filter: (data) => isInstanceOf(DataType.Person, data.subject),
175
+ component: ({ data, role }) => {
176
+ const { dispatchPromise: dispatch } = useIntentDispatcher();
177
+ const handleOrgClick = useCallback(async (org) => {
178
+ const space = getSpace(org);
179
+ const tablesQuery = await space?.db.query(Filter.type(TableType)).run();
180
+ const currentSpaceOrgTable = tablesQuery?.objects.find((table) => {
181
+ return table.view?.target?.query?.typename === DataType.Organization.typename;
182
+ });
183
+ await dispatch(createIntent(LayoutAction.UpdatePopover, {
184
+ part: "popover",
185
+ options: {
186
+ state: false,
187
+ anchorId: ""
188
+ }
189
+ }));
190
+ if (currentSpaceOrgTable) {
191
+ return dispatch(createIntent(LayoutAction.Open, {
192
+ part: "main",
193
+ subject: [
194
+ fullyQualifiedId(currentSpaceOrgTable)
195
+ ],
196
+ options: {
197
+ workspace: space?.id
198
+ }
199
+ }));
200
+ }
201
+ }, [
202
+ dispatch
203
+ ]);
204
+ return /* @__PURE__ */ React4.createElement(ContactCard, {
205
+ subject: data.subject,
206
+ onOrgClick: handleOrgClick,
207
+ role
208
+ }, role === "popover" && /* @__PURE__ */ React4.createElement(Surface, {
209
+ role: "related",
210
+ data
211
+ }));
212
+ }
213
+ }),
214
+ createSurface({
215
+ id: `${PREVIEW_PLUGIN}/schema-popover--organization`,
216
+ role: [
217
+ "popover",
218
+ "card--kanban",
219
+ "card"
220
+ ],
221
+ filter: (data) => isInstanceOf(DataType.Organization, data.subject),
222
+ component: ({ data, role }) => /* @__PURE__ */ React4.createElement(OrganizationCard, {
223
+ subject: data.subject,
224
+ role
225
+ }, role === "popover" && /* @__PURE__ */ React4.createElement(Surface, {
226
+ role: "related",
227
+ data
228
+ }))
229
+ }),
230
+ createSurface({
231
+ id: `${PREVIEW_PLUGIN}/schema-popover--project`,
232
+ role: [
233
+ "popover",
234
+ "card--kanban",
235
+ "card"
236
+ ],
237
+ filter: (data) => isInstanceOf(DataType.Project, data.subject),
238
+ component: ({ data, role }) => /* @__PURE__ */ React4.createElement(ProjectCard, {
239
+ subject: data.subject,
240
+ role
241
+ })
242
+ }),
243
+ //
244
+ // Fallback for any object.
245
+ //
246
+ createSurface({
247
+ id: `${PREVIEW_PLUGIN}/fallback-popover`,
248
+ role: [
249
+ "popover",
250
+ "card--kanban",
251
+ "card"
252
+ ],
253
+ position: "fallback",
254
+ filter: (data) => isEchoObject(data.subject),
255
+ component: ({ data, role }) => {
256
+ const schema = getSchema(data.subject);
257
+ const { t } = useTranslation(PREVIEW_PLUGIN);
258
+ if (!schema) {
259
+ return /* @__PURE__ */ React4.createElement("p", {
260
+ className: descriptionMessage
261
+ }, t("unable to create preview message"));
262
+ }
263
+ const handleSave = useCallback((values, { changed }) => {
264
+ const changedPaths = Object.keys(changed).filter((path) => changed[path]);
265
+ for (const path of changedPaths) {
266
+ const value = values[path];
267
+ setValue(data.subject, path, value);
268
+ }
269
+ }, []);
270
+ return /* @__PURE__ */ React4.createElement(Form, {
271
+ schema,
272
+ values: data.subject,
273
+ readonly: role === "popover",
274
+ onSave: handleSave,
275
+ autoSave: true,
276
+ ...role === "card--kanban" && {
277
+ classNames: kanbanCardWithoutPoster
278
+ }
279
+ });
280
+ }
281
+ })
282
+ ]);
283
+ export {
284
+ react_surface_default as default
285
+ };
286
+ //# sourceMappingURL=react-surface-QJRHN4PN.mjs.map