@dxos/plugin-preview 0.8.3-staging.0fa589b → 0.8.4-main.1068cf700f

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 (115) hide show
  1. package/dist/lib/browser/chunk-XLN6KTHK.mjs +17 -0
  2. package/dist/lib/browser/chunk-XLN6KTHK.mjs.map +7 -0
  3. package/dist/lib/browser/index.mjs +38 -43
  4. package/dist/lib/browser/index.mjs.map +4 -4
  5. package/dist/lib/browser/meta.json +1 -1
  6. package/dist/lib/browser/preview-popover-5YUZCO2D.mjs +82 -0
  7. package/dist/lib/browser/preview-popover-5YUZCO2D.mjs.map +7 -0
  8. package/dist/lib/browser/react-surface-W3FAIVY7.mjs +251 -0
  9. package/dist/lib/browser/react-surface-W3FAIVY7.mjs.map +7 -0
  10. package/dist/lib/node-esm/chunk-2G4FUGDA.mjs +19 -0
  11. package/dist/lib/node-esm/chunk-2G4FUGDA.mjs.map +7 -0
  12. package/dist/lib/node-esm/index.mjs +38 -43
  13. package/dist/lib/node-esm/index.mjs.map +4 -4
  14. package/dist/lib/node-esm/meta.json +1 -1
  15. package/dist/lib/node-esm/preview-popover-7QRYVL73.mjs +84 -0
  16. package/dist/lib/node-esm/preview-popover-7QRYVL73.mjs.map +7 -0
  17. package/dist/lib/node-esm/react-surface-IO5DHYZB.mjs +252 -0
  18. package/dist/lib/node-esm/react-surface-IO5DHYZB.mjs.map +7 -0
  19. package/dist/types/src/PreviewPlugin.d.ts +2 -1
  20. package/dist/types/src/PreviewPlugin.d.ts.map +1 -1
  21. package/dist/types/src/capabilities/index.d.ts +2 -2
  22. package/dist/types/src/capabilities/index.d.ts.map +1 -1
  23. package/dist/types/src/capabilities/preview-popover/index.d.ts +3 -0
  24. package/dist/types/src/capabilities/preview-popover/index.d.ts.map +1 -0
  25. package/dist/types/src/capabilities/preview-popover/preview-popover.d.ts +5 -0
  26. package/dist/types/src/capabilities/preview-popover/preview-popover.d.ts.map +1 -0
  27. package/dist/types/src/capabilities/react-surface/index.d.ts +3 -0
  28. package/dist/types/src/capabilities/react-surface/index.d.ts.map +1 -0
  29. package/dist/types/src/capabilities/react-surface/react-surface.d.ts +5 -0
  30. package/dist/types/src/capabilities/react-surface/react-surface.d.ts.map +1 -0
  31. package/dist/types/src/cards/FormCard.d.ts +7 -0
  32. package/dist/types/src/cards/FormCard.d.ts.map +1 -0
  33. package/dist/types/src/cards/OrganizationCard.d.ts +5 -0
  34. package/dist/types/src/cards/OrganizationCard.d.ts.map +1 -0
  35. package/dist/types/src/cards/PersonCard.d.ts +5 -0
  36. package/dist/types/src/cards/PersonCard.d.ts.map +1 -0
  37. package/dist/types/src/cards/ProjectCard.d.ts +5 -0
  38. package/dist/types/src/cards/ProjectCard.d.ts.map +1 -0
  39. package/dist/types/src/cards/TaskCard.d.ts +5 -0
  40. package/dist/types/src/cards/TaskCard.d.ts.map +1 -0
  41. package/dist/types/src/cards/index.d.ts +6 -0
  42. package/dist/types/src/cards/index.d.ts.map +1 -0
  43. package/dist/types/src/index.d.ts +0 -1
  44. package/dist/types/src/index.d.ts.map +1 -1
  45. package/dist/types/src/meta.d.ts +2 -3
  46. package/dist/types/src/meta.d.ts.map +1 -1
  47. package/dist/types/src/stories/Card.stories.d.ts +32 -0
  48. package/dist/types/src/stories/Card.stories.d.ts.map +1 -0
  49. package/dist/types/src/stories/testing.d.ts +19 -0
  50. package/dist/types/src/stories/testing.d.ts.map +1 -0
  51. package/dist/types/src/translations.d.ts +12 -6
  52. package/dist/types/src/translations.d.ts.map +1 -1
  53. package/dist/types/tsconfig.tsbuildinfo +1 -1
  54. package/package.json +46 -30
  55. package/src/PreviewPlugin.tsx +15 -27
  56. package/src/capabilities/index.ts +2 -4
  57. package/src/capabilities/preview-popover/index.ts +7 -0
  58. package/src/capabilities/preview-popover/preview-popover.ts +90 -0
  59. package/src/capabilities/react-surface/index.ts +7 -0
  60. package/src/capabilities/react-surface/react-surface.tsx +97 -0
  61. package/src/cards/FormCard.tsx +56 -0
  62. package/src/cards/OrganizationCard.tsx +29 -0
  63. package/src/cards/PersonCard.tsx +47 -0
  64. package/src/cards/ProjectCard.tsx +22 -0
  65. package/src/cards/TaskCard.tsx +40 -0
  66. package/src/{components → cards}/index.ts +3 -1
  67. package/src/index.ts +0 -1
  68. package/src/meta.ts +8 -5
  69. package/src/stories/Card.stories.tsx +76 -0
  70. package/src/stories/testing.tsx +84 -0
  71. package/src/translations.ts +12 -4
  72. package/dist/lib/browser/chunk-LFAK2TMG.mjs +0 -14
  73. package/dist/lib/browser/chunk-LFAK2TMG.mjs.map +0 -7
  74. package/dist/lib/browser/preview-popover-NRFVC4QQ.mjs +0 -69
  75. package/dist/lib/browser/preview-popover-NRFVC4QQ.mjs.map +0 -7
  76. package/dist/lib/browser/react-surface-J2R6Q33B.mjs +0 -272
  77. package/dist/lib/browser/react-surface-J2R6Q33B.mjs.map +0 -7
  78. package/dist/lib/node/chunk-XGHMBEIV.cjs +0 -37
  79. package/dist/lib/node/chunk-XGHMBEIV.cjs.map +0 -7
  80. package/dist/lib/node/index.cjs +0 -85
  81. package/dist/lib/node/index.cjs.map +0 -7
  82. package/dist/lib/node/meta.json +0 -1
  83. package/dist/lib/node/preview-popover-HIXRYF6L.cjs +0 -88
  84. package/dist/lib/node/preview-popover-HIXRYF6L.cjs.map +0 -7
  85. package/dist/lib/node/react-surface-ZSNNAKBG.cjs +0 -290
  86. package/dist/lib/node/react-surface-ZSNNAKBG.cjs.map +0 -7
  87. package/dist/lib/node-esm/chunk-7BPXNL44.mjs +0 -16
  88. package/dist/lib/node-esm/chunk-7BPXNL44.mjs.map +0 -7
  89. package/dist/lib/node-esm/preview-popover-HBGSL64N.mjs +0 -71
  90. package/dist/lib/node-esm/preview-popover-HBGSL64N.mjs.map +0 -7
  91. package/dist/lib/node-esm/react-surface-UKEVHG5K.mjs +0 -273
  92. package/dist/lib/node-esm/react-surface-UKEVHG5K.mjs.map +0 -7
  93. package/dist/types/src/Preview.stories.d.ts +0 -127
  94. package/dist/types/src/Preview.stories.d.ts.map +0 -1
  95. package/dist/types/src/capabilities/preview-popover.d.ts +0 -4
  96. package/dist/types/src/capabilities/preview-popover.d.ts.map +0 -1
  97. package/dist/types/src/capabilities/react-surface.d.ts +0 -4
  98. package/dist/types/src/capabilities/react-surface.d.ts.map +0 -1
  99. package/dist/types/src/components/ContactCard.d.ts +0 -7
  100. package/dist/types/src/components/ContactCard.d.ts.map +0 -1
  101. package/dist/types/src/components/OrganizationCard.d.ts +0 -5
  102. package/dist/types/src/components/OrganizationCard.d.ts.map +0 -1
  103. package/dist/types/src/components/ProjectCard.d.ts +0 -5
  104. package/dist/types/src/components/ProjectCard.d.ts.map +0 -1
  105. package/dist/types/src/components/index.d.ts +0 -4
  106. package/dist/types/src/components/index.d.ts.map +0 -1
  107. package/dist/types/src/types.d.ts +0 -6
  108. package/dist/types/src/types.d.ts.map +0 -1
  109. package/src/Preview.stories.tsx +0 -147
  110. package/src/capabilities/preview-popover.ts +0 -74
  111. package/src/capabilities/react-surface.tsx +0 -130
  112. package/src/components/ContactCard.tsx +0 -70
  113. package/src/components/OrganizationCard.tsx +0 -41
  114. package/src/components/ProjectCard.tsx +0 -20
  115. package/src/types.ts +0 -11
@@ -0,0 +1,17 @@
1
+ // src/meta.ts
2
+ import { trim } from "@dxos/util";
3
+ var meta = {
4
+ id: "dxos.org/plugin/preview",
5
+ name: "Preview",
6
+ description: trim`
7
+ Rich preview panel for viewing object content without opening full editors.
8
+ Quick peek at documents, images, and data with inline rendering.
9
+ `,
10
+ icon: "ph--eye--regular",
11
+ source: "https://github.com/dxos/dxos/tree/main/packages/plugins/plugin-preview"
12
+ };
13
+
14
+ export {
15
+ meta
16
+ };
17
+ //# sourceMappingURL=chunk-XLN6KTHK.mjs.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/meta.ts"],
4
+ "sourcesContent": ["//\n// Copyright 2023 DXOS.org\n//\n\nimport { type Plugin } from '@dxos/app-framework';\nimport { trim } from '@dxos/util';\n\nexport const meta: Plugin.Meta = {\n id: 'dxos.org/plugin/preview',\n name: 'Preview',\n description: trim`\n Rich preview panel for viewing object content without opening full editors.\n Quick peek at documents, images, and data with inline rendering.\n `,\n icon: 'ph--eye--regular',\n source: 'https://github.com/dxos/dxos/tree/main/packages/plugins/plugin-preview',\n};\n"],
5
+ "mappings": ";AAKA,SAASA,YAAY;AAEd,IAAMC,OAAoB;EAC/BC,IAAI;EACJC,MAAM;EACNC,aAAaC;;;;EAIbC,MAAM;EACNC,QAAQ;AACV;",
6
+ "names": ["trim", "meta", "id", "name", "description", "trim", "icon", "source"]
7
+ }
@@ -1,59 +1,54 @@
1
1
  import {
2
- PREVIEW_PLUGIN,
3
2
  meta
4
- } from "./chunk-LFAK2TMG.mjs";
3
+ } from "./chunk-XLN6KTHK.mjs";
5
4
 
6
- // packages/plugins/plugin-preview/src/PreviewPlugin.tsx
7
- import { Capabilities, Events, contributes, defineModule, definePlugin } from "@dxos/app-framework";
8
- import { ClientCapabilities, ClientEvents } from "@dxos/plugin-client";
9
- import { DataType } from "@dxos/schema";
5
+ // src/PreviewPlugin.tsx
6
+ import { ActivationEvents, Plugin } from "@dxos/app-framework";
7
+ import { AppPlugin } from "@dxos/app-toolkit";
8
+ import { Organization, Person } from "@dxos/types";
10
9
 
11
- // packages/plugins/plugin-preview/src/capabilities/index.ts
12
- import { lazy } from "@dxos/app-framework";
13
- var PreviewPopover = lazy(() => import("./preview-popover-NRFVC4QQ.mjs"));
14
- var ReactSurface = lazy(() => import("./react-surface-J2R6Q33B.mjs"));
10
+ // src/capabilities/preview-popover/index.ts
11
+ import { Capability } from "@dxos/app-framework";
12
+ var PreviewPopover = Capability.lazy("PreviewPopover", () => import("./preview-popover-5YUZCO2D.mjs"));
15
13
 
16
- // packages/plugins/plugin-preview/src/translations.ts
17
- var translations_default = [
14
+ // src/capabilities/react-surface/index.ts
15
+ import { Capability as Capability2 } from "@dxos/app-framework";
16
+ var ReactSurface = Capability2.lazy("ReactSurface", () => import("./react-surface-W3FAIVY7.mjs"));
17
+
18
+ // src/translations.ts
19
+ var translations = [
18
20
  {
19
21
  "en-US": {
20
- [PREVIEW_PLUGIN]: {
21
- "unable to create preview message": "No preview"
22
+ [meta.id]: {
23
+ "unable to create preview message": "No preview",
24
+ "todo label": "To do",
25
+ "in-progress label": "In progress",
26
+ "done label": "Done",
27
+ "open object label": "Open",
28
+ "add object to space label": "Add to space",
29
+ "more options label": "More options"
22
30
  }
23
31
  }
24
32
  }
25
33
  ];
26
34
 
27
- // packages/plugins/plugin-preview/src/PreviewPlugin.tsx
28
- var PreviewPlugin = () => definePlugin(meta, [
29
- defineModule({
30
- id: `${meta.id}/module/translations`,
31
- activatesOn: Events.SetupTranslations,
32
- activate: () => contributes(Capabilities.Translations, translations_default)
33
- }),
34
- defineModule({
35
- id: `${meta.id}/module/schema`,
36
- activatesOn: ClientEvents.SetupSchema,
37
- activate: () => [
38
- contributes(ClientCapabilities.Schema, [
39
- DataType.Person,
40
- DataType.Organization
41
- ])
42
- ]
43
- }),
44
- defineModule({
45
- id: `${meta.id}/module/preview-popover`,
46
- activatesOn: Events.Startup,
47
- activate: PreviewPopover
48
- }),
49
- defineModule({
50
- id: `${meta.id}/module/react-surface`,
51
- activatesOn: Events.SetupReactSurface,
52
- activate: ReactSurface
53
- })
54
- ]);
35
+ // src/PreviewPlugin.tsx
36
+ var PreviewPlugin = Plugin.define(meta).pipe(AppPlugin.addSchemaModule({
37
+ schema: [
38
+ Person.Person,
39
+ Organization.Organization
40
+ ],
41
+ id: "schema"
42
+ }), AppPlugin.addSurfaceModule({
43
+ activate: ReactSurface
44
+ }), AppPlugin.addTranslationsModule({
45
+ translations
46
+ }), Plugin.addModule({
47
+ id: "preview-popover",
48
+ activatesOn: ActivationEvents.Startup,
49
+ activate: PreviewPopover
50
+ }), Plugin.make);
55
51
  export {
56
- PREVIEW_PLUGIN,
57
52
  PreviewPlugin,
58
53
  meta
59
54
  };
@@ -1,7 +1,7 @@
1
1
  {
2
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"]
3
+ "sources": ["../../../src/PreviewPlugin.tsx", "../../../src/capabilities/preview-popover/index.ts", "../../../src/capabilities/react-surface/index.ts", "../../../src/translations.ts"],
4
+ "sourcesContent": ["//\n// Copyright 2023 DXOS.org\n//\n\nimport { ActivationEvents, Plugin } from '@dxos/app-framework';\nimport { AppPlugin } from '@dxos/app-toolkit';\nimport { Organization, Person } from '@dxos/types';\n\nimport { PreviewPopover, ReactSurface } from './capabilities';\nimport { meta } from './meta';\nimport { translations } from './translations';\n\nexport const PreviewPlugin = Plugin.define(meta).pipe(\n AppPlugin.addSchemaModule({ schema: [Person.Person, Organization.Organization], id: 'schema' }),\n AppPlugin.addSurfaceModule({ activate: ReactSurface }),\n AppPlugin.addTranslationsModule({ translations }),\n Plugin.addModule({\n id: 'preview-popover',\n activatesOn: ActivationEvents.Startup,\n activate: PreviewPopover,\n }),\n Plugin.make,\n);\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport { Capability } from '@dxos/app-framework';\n\nexport const PreviewPopover = Capability.lazy('PreviewPopover', () => import('./preview-popover'));\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport { Capability } from '@dxos/app-framework';\n\nexport const ReactSurface = Capability.lazy('ReactSurface', () => import('./react-surface'));\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport { type Resource } from '@dxos/react-ui';\n\nimport { meta } from './meta';\n\nexport const translations = [\n {\n 'en-US': {\n [meta.id]: {\n 'unable to create preview message': 'No preview',\n 'todo label': 'To do',\n 'in-progress label': 'In progress',\n 'done label': 'Done',\n 'open object label': 'Open',\n 'add object to space label': 'Add to space',\n 'more options label': 'More options',\n },\n },\n },\n] as const satisfies Resource[];\n"],
5
+ "mappings": ";;;;;AAIA,SAASA,kBAAkBC,cAAc;AACzC,SAASC,iBAAiB;AAC1B,SAASC,cAAcC,cAAc;;;ACFrC,SAASC,kBAAkB;AAEpB,IAAMC,iBAAiBC,WAAWC,KAAK,kBAAkB,MAAM,OAAO,gCAAA,CAAA;;;ACF7E,SAASC,cAAAA,mBAAkB;AAEpB,IAAMC,eAAeC,YAAWC,KAAK,gBAAgB,MAAM,OAAO,8BAAA,CAAA;;;ACElE,IAAMC,eAAe;EAC1B;IACE,SAAS;MACP,CAACC,KAAKC,EAAE,GAAG;QACT,oCAAoC;QACpC,cAAc;QACd,qBAAqB;QACrB,cAAc;QACd,qBAAqB;QACrB,6BAA6B;QAC7B,sBAAsB;MACxB;IACF;EACF;;;;AHTK,IAAMC,gBAAgBC,OAAOC,OAAOC,IAAAA,EAAMC,KAC/CC,UAAUC,gBAAgB;EAAEC,QAAQ;IAACC,OAAOA;IAAQC,aAAaA;;EAAeC,IAAI;AAAS,CAAA,GAC7FL,UAAUM,iBAAiB;EAAEC,UAAUC;AAAa,CAAA,GACpDR,UAAUS,sBAAsB;EAAEC;AAAa,CAAA,GAC/Cd,OAAOe,UAAU;EACfN,IAAI;EACJO,aAAaC,iBAAiBC;EAC9BP,UAAUQ;AACZ,CAAA,GACAnB,OAAOoB,IAAI;",
6
+ "names": ["ActivationEvents", "Plugin", "AppPlugin", "Organization", "Person", "Capability", "PreviewPopover", "Capability", "lazy", "Capability", "ReactSurface", "Capability", "lazy", "translations", "meta", "id", "PreviewPlugin", "Plugin", "define", "meta", "pipe", "AppPlugin", "addSchemaModule", "schema", "Person", "Organization", "id", "addSurfaceModule", "activate", "ReactSurface", "addTranslationsModule", "translations", "addModule", "activatesOn", "ActivationEvents", "Startup", "PreviewPopover", "make"]
7
7
  }
@@ -1 +1 @@
1
- {"inputs":{"packages/plugins/plugin-preview/src/meta.ts":{"bytes":1256,"imports":[],"format":"esm"},"packages/plugins/plugin-preview/src/types.ts":{"bytes":745,"imports":[],"format":"esm"},"packages/plugins/plugin-preview/src/capabilities/preview-popover.ts":{"bytes":8510,"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":9249,"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-stack","kind":"import-statement","external":true},{"path":"@dxos/react-ui-theme","kind":"import-statement","external":true}],"format":"esm"},"packages/plugins/plugin-preview/src/components/OrganizationCard.tsx":{"bytes":4743,"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-stack","kind":"import-statement","external":true}],"format":"esm"},"packages/plugins/plugin-preview/src/components/ProjectCard.tsx":{"bytes":2581,"imports":[{"path":"@preact-signals/safe-react/tracking","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/react-ui-stack","kind":"import-statement","external":true}],"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":18015,"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","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-stack","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"}],"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/browser/index.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":3134},"packages/plugins/plugin-preview/dist/lib/browser/index.mjs":{"imports":[{"path":"packages/plugins/plugin-preview/dist/lib/browser/chunk-LFAK2TMG.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/browser/preview-popover-NRFVC4QQ.mjs","kind":"dynamic-import"},{"path":"packages/plugins/plugin-preview/dist/lib/browser/react-surface-J2R6Q33B.mjs","kind":"dynamic-import"}],"exports":["PREVIEW_PLUGIN","PreviewPlugin","meta"],"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":1690},"packages/plugins/plugin-preview/dist/lib/browser/preview-popover-NRFVC4QQ.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":4452},"packages/plugins/plugin-preview/dist/lib/browser/preview-popover-NRFVC4QQ.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":2079}},"bytes":2253},"packages/plugins/plugin-preview/dist/lib/browser/react-surface-J2R6Q33B.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":16988},"packages/plugins/plugin-preview/dist/lib/browser/react-surface-J2R6Q33B.mjs":{"imports":[{"path":"packages/plugins/plugin-preview/dist/lib/browser/chunk-LFAK2TMG.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","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-stack","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-stack","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-stack","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-stack","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":4441},"packages/plugins/plugin-preview/src/components/ContactCard.tsx":{"bytesInOutput":2882},"packages/plugins/plugin-preview/src/components/index.ts":{"bytesInOutput":0},"packages/plugins/plugin-preview/src/components/OrganizationCard.tsx":{"bytesInOutput":1436},"packages/plugins/plugin-preview/src/components/ProjectCard.tsx":{"bytesInOutput":707}},"bytes":9970},"packages/plugins/plugin-preview/dist/lib/browser/chunk-LFAK2TMG.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":613},"packages/plugins/plugin-preview/dist/lib/browser/chunk-LFAK2TMG.mjs":{"imports":[],"exports":["PREVIEW_PLUGIN","meta"],"inputs":{"packages/plugins/plugin-preview/src/meta.ts":{"bytesInOutput":216}},"bytes":345}}}
1
+ {"inputs":{"src/meta.ts":{"bytes":1673,"imports":[{"path":"@dxos/util","kind":"import-statement","external":true}],"format":"esm"},"src/capabilities/preview-popover/preview-popover.ts":{"bytes":10686,"imports":[{"path":"effect/Effect","kind":"import-statement","external":true},{"path":"@dxos/app-framework","kind":"import-statement","external":true},{"path":"@dxos/app-toolkit","kind":"import-statement","external":true},{"path":"@dxos/async","kind":"import-statement","external":true},{"path":"@dxos/client/echo","kind":"import-statement","external":true},{"path":"@dxos/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},{"path":"@dxos/react-ui","kind":"import-statement","external":true}],"format":"esm"},"src/capabilities/preview-popover/index.ts":{"bytes":935,"imports":[{"path":"@dxos/app-framework","kind":"import-statement","external":true},{"path":"src/capabilities/preview-popover/preview-popover.ts","kind":"dynamic-import","original":"./preview-popover"}],"format":"esm"},"src/cards/FormCard.tsx":{"bytes":7809,"imports":[{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/app-framework/ui","kind":"import-statement","external":true},{"path":"@dxos/app-toolkit","kind":"import-statement","external":true},{"path":"@dxos/echo","kind":"import-statement","external":true},{"path":"@dxos/effect","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/ui-theme","kind":"import-statement","external":true},{"path":"src/meta.ts","kind":"import-statement","original":"../meta"}],"format":"esm"},"src/cards/OrganizationCard.tsx":{"bytes":3051,"imports":[{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/react-ui-mosaic","kind":"import-statement","external":true}],"format":"esm"},"src/cards/PersonCard.tsx":{"bytes":4490,"imports":[{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/react-ui","kind":"import-statement","external":true},{"path":"@dxos/react-ui-mosaic","kind":"import-statement","external":true}],"format":"esm"},"src/cards/ProjectCard.tsx":{"bytes":2488,"imports":[{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/echo","kind":"import-statement","external":true},{"path":"@dxos/react-ui-mosaic","kind":"import-statement","external":true}],"format":"esm"},"src/cards/TaskCard.tsx":{"bytes":5354,"imports":[{"path":"effect/SchemaAST","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/echo/internal","kind":"import-statement","external":true},{"path":"@dxos/react-ui-mosaic","kind":"import-statement","external":true},{"path":"@dxos/types","kind":"import-statement","external":true}],"format":"esm"},"src/cards/index.ts":{"bytes":853,"imports":[{"path":"src/cards/FormCard.tsx","kind":"import-statement","original":"./FormCard"},{"path":"src/cards/OrganizationCard.tsx","kind":"import-statement","original":"./OrganizationCard"},{"path":"src/cards/PersonCard.tsx","kind":"import-statement","original":"./PersonCard"},{"path":"src/cards/ProjectCard.tsx","kind":"import-statement","original":"./ProjectCard"},{"path":"src/cards/TaskCard.tsx","kind":"import-statement","original":"./TaskCard"}],"format":"esm"},"src/capabilities/react-surface/react-surface.tsx":{"bytes":12495,"imports":[{"path":"effect/Effect","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/app-framework","kind":"import-statement","external":true},{"path":"@dxos/app-framework/ui","kind":"import-statement","external":true},{"path":"@dxos/echo","kind":"import-statement","external":true},{"path":"@dxos/react-ui-mosaic","kind":"import-statement","external":true},{"path":"@dxos/types","kind":"import-statement","external":true},{"path":"src/cards/index.ts","kind":"import-statement","original":"../../cards"},{"path":"src/meta.ts","kind":"import-statement","original":"../../meta"}],"format":"esm"},"src/capabilities/react-surface/index.ts":{"bytes":911,"imports":[{"path":"@dxos/app-framework","kind":"import-statement","external":true},{"path":"src/capabilities/react-surface/react-surface.tsx","kind":"dynamic-import","original":"./react-surface"}],"format":"esm"},"src/capabilities/index.ts":{"bytes":595,"imports":[{"path":"src/capabilities/preview-popover/index.ts","kind":"import-statement","original":"./preview-popover"},{"path":"src/capabilities/react-surface/index.ts","kind":"import-statement","original":"./react-surface"}],"format":"esm"},"src/translations.ts":{"bytes":1903,"imports":[{"path":"src/meta.ts","kind":"import-statement","original":"./meta"}],"format":"esm"},"src/PreviewPlugin.tsx":{"bytes":3183,"imports":[{"path":"@dxos/app-framework","kind":"import-statement","external":true},{"path":"@dxos/app-toolkit","kind":"import-statement","external":true},{"path":"@dxos/types","kind":"import-statement","external":true},{"path":"src/capabilities/index.ts","kind":"import-statement","original":"./capabilities"},{"path":"src/meta.ts","kind":"import-statement","original":"./meta"},{"path":"src/translations.ts","kind":"import-statement","original":"./translations"}],"format":"esm"},"src/index.ts":{"bytes":555,"imports":[{"path":"src/meta.ts","kind":"import-statement","original":"./meta"},{"path":"src/PreviewPlugin.tsx","kind":"import-statement","original":"./PreviewPlugin"}],"format":"esm"}},"outputs":{"dist/lib/browser/index.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":3180},"dist/lib/browser/index.mjs":{"imports":[{"path":"dist/lib/browser/chunk-XLN6KTHK.mjs","kind":"import-statement"},{"path":"@dxos/app-framework","kind":"import-statement","external":true},{"path":"@dxos/app-toolkit","kind":"import-statement","external":true},{"path":"@dxos/types","kind":"import-statement","external":true},{"path":"@dxos/app-framework","kind":"import-statement","external":true},{"path":"dist/lib/browser/preview-popover-5YUZCO2D.mjs","kind":"dynamic-import"},{"path":"@dxos/app-framework","kind":"import-statement","external":true},{"path":"dist/lib/browser/react-surface-W3FAIVY7.mjs","kind":"dynamic-import"}],"exports":["PreviewPlugin","meta"],"entryPoint":"src/index.ts","inputs":{"src/index.ts":{"bytesInOutput":0},"src/PreviewPlugin.tsx":{"bytesInOutput":562},"src/capabilities/preview-popover/index.ts":{"bytesInOutput":154},"src/capabilities/index.ts":{"bytesInOutput":0},"src/capabilities/react-surface/index.ts":{"bytesInOutput":164},"src/translations.ts":{"bytesInOutput":378}},"bytes":1542},"dist/lib/browser/preview-popover-5YUZCO2D.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":5533},"dist/lib/browser/preview-popover-5YUZCO2D.mjs":{"imports":[{"path":"effect/Effect","kind":"import-statement","external":true},{"path":"@dxos/app-framework","kind":"import-statement","external":true},{"path":"@dxos/app-toolkit","kind":"import-statement","external":true},{"path":"@dxos/async","kind":"import-statement","external":true},{"path":"@dxos/client/echo","kind":"import-statement","external":true},{"path":"@dxos/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},{"path":"@dxos/react-ui","kind":"import-statement","external":true}],"exports":["default"],"entryPoint":"src/capabilities/preview-popover/preview-popover.ts","inputs":{"src/capabilities/preview-popover/preview-popover.ts":{"bytesInOutput":2573}},"bytes":2731},"dist/lib/browser/react-surface-W3FAIVY7.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":18315},"dist/lib/browser/react-surface-W3FAIVY7.mjs":{"imports":[{"path":"dist/lib/browser/chunk-XLN6KTHK.mjs","kind":"import-statement"},{"path":"effect/Effect","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/app-framework","kind":"import-statement","external":true},{"path":"@dxos/app-framework/ui","kind":"import-statement","external":true},{"path":"@dxos/echo","kind":"import-statement","external":true},{"path":"@dxos/react-ui-mosaic","kind":"import-statement","external":true},{"path":"@dxos/types","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/app-framework/ui","kind":"import-statement","external":true},{"path":"@dxos/app-toolkit","kind":"import-statement","external":true},{"path":"@dxos/echo","kind":"import-statement","external":true},{"path":"@dxos/effect","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/ui-theme","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/react-ui-mosaic","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-mosaic","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/echo","kind":"import-statement","external":true},{"path":"@dxos/react-ui-mosaic","kind":"import-statement","external":true},{"path":"effect/SchemaAST","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/echo/internal","kind":"import-statement","external":true},{"path":"@dxos/react-ui-mosaic","kind":"import-statement","external":true},{"path":"@dxos/types","kind":"import-statement","external":true}],"exports":["default"],"entryPoint":"src/capabilities/react-surface/react-surface.tsx","inputs":{"src/capabilities/react-surface/react-surface.tsx":{"bytesInOutput":3066},"src/cards/FormCard.tsx":{"bytesInOutput":1861},"src/cards/index.ts":{"bytesInOutput":0},"src/cards/OrganizationCard.tsx":{"bytesInOutput":714},"src/cards/PersonCard.tsx":{"bytesInOutput":1061},"src/cards/ProjectCard.tsx":{"bytesInOutput":537},"src/cards/TaskCard.tsx":{"bytesInOutput":1182}},"bytes":8821},"dist/lib/browser/chunk-XLN6KTHK.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":800},"dist/lib/browser/chunk-XLN6KTHK.mjs":{"imports":[{"path":"@dxos/util","kind":"import-statement","external":true}],"exports":["meta"],"inputs":{"src/meta.ts":{"bytesInOutput":389}},"bytes":468}}}
@@ -0,0 +1,82 @@
1
+ // src/capabilities/preview-popover/preview-popover.ts
2
+ import * as Effect from "effect/Effect";
3
+ import { Capabilities, Capability } from "@dxos/app-framework";
4
+ import { AppCapabilities, LayoutOperation } from "@dxos/app-toolkit";
5
+ import { addEventListener } from "@dxos/async";
6
+ import { parseId } from "@dxos/client/echo";
7
+ import { Obj } from "@dxos/echo";
8
+ import { DXN } from "@dxos/keys";
9
+ import { log } from "@dxos/log";
10
+ import { ClientCapabilities } from "@dxos/plugin-client";
11
+ import { DX_ANCHOR_ACTIVATE } from "@dxos/react-ui";
12
+ var __dxlog_file = "/__w/dxos/dxos/packages/plugins/plugin-preview/src/capabilities/preview-popover/preview-popover.ts";
13
+ var customEventOptions = {
14
+ capture: true,
15
+ passive: false
16
+ };
17
+ var handlePreviewLookup = async (client, defaultSpace, { dxn, label }) => {
18
+ try {
19
+ const object = await defaultSpace.db.makeRef(DXN.parse(dxn)).load();
20
+ return {
21
+ label,
22
+ object
23
+ };
24
+ } catch {
25
+ return null;
26
+ }
27
+ };
28
+ var preview_popover_default = Capability.makeModule(Effect.fnUntraced(function* () {
29
+ const capabilities = yield* Capability.Service;
30
+ const handleAnchorActivate = async ({ dxn, label, trigger, kind = "card", title: titleProp, side, props }) => {
31
+ const { invokePromise } = capabilities.get(Capabilities.OperationInvoker);
32
+ const client = capabilities.get(ClientCapabilities.Client);
33
+ const registry = capabilities.get(Capabilities.AtomRegistry);
34
+ const [layoutAtom] = capabilities.getAll(AppCapabilities.Layout);
35
+ const layout = registry.get(layoutAtom);
36
+ const { spaceId } = parseId(layout.workspace);
37
+ const space = (spaceId && client.spaces.get(spaceId)) ?? client.spaces.default;
38
+ const result = await handlePreviewLookup(client, space, {
39
+ dxn,
40
+ label
41
+ });
42
+ if (!result) {
43
+ return;
44
+ }
45
+ const title = titleProp ?? Obj.getLabel(result.object);
46
+ await invokePromise(LayoutOperation.UpdatePopover, {
47
+ subjectRef: dxn,
48
+ subject: result.object,
49
+ state: true,
50
+ variant: "virtual",
51
+ anchor: trigger,
52
+ ...kind && {
53
+ kind
54
+ },
55
+ ...title && {
56
+ title
57
+ },
58
+ ...side && {
59
+ side
60
+ },
61
+ ...props && {
62
+ props
63
+ }
64
+ });
65
+ };
66
+ let cleanup;
67
+ if (document.defaultView) {
68
+ cleanup = addEventListener(document.defaultView, DX_ANCHOR_ACTIVATE, handleAnchorActivate, customEventOptions);
69
+ } else {
70
+ log.warn("no default view found", void 0, {
71
+ F: __dxlog_file,
72
+ L: 85,
73
+ S: this,
74
+ C: (f, a) => f(...a)
75
+ });
76
+ }
77
+ return Capability.contributes(Capabilities.Null, null, () => Effect.sync(() => cleanup?.()));
78
+ }));
79
+ export {
80
+ preview_popover_default as default
81
+ };
82
+ //# sourceMappingURL=preview-popover-5YUZCO2D.mjs.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/capabilities/preview-popover/preview-popover.ts"],
4
+ "sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport * as Effect from 'effect/Effect';\n\nimport { Capabilities, Capability } from '@dxos/app-framework';\nimport { AppCapabilities, LayoutOperation } from '@dxos/app-toolkit';\nimport { addEventListener } from '@dxos/async';\nimport { type Client } from '@dxos/client';\nimport { type Space, parseId } from '@dxos/client/echo';\nimport { Obj } from '@dxos/echo';\nimport { DXN } from '@dxos/keys';\nimport { log } from '@dxos/log';\nimport { ClientCapabilities } from '@dxos/plugin-client';\nimport { DX_ANCHOR_ACTIVATE, type DxAnchorActivate } from '@dxos/react-ui';\nimport { type PreviewLinkRef, type PreviewLinkTarget } from '@dxos/ui-editor';\n\nconst customEventOptions = { capture: true, passive: false };\n\nconst handlePreviewLookup = async (\n client: Client,\n defaultSpace: Space,\n { dxn, label }: PreviewLinkRef,\n): Promise<PreviewLinkTarget | null> => {\n try {\n const object = await defaultSpace.db.makeRef(DXN.parse(dxn)).load();\n return { label, object };\n } catch {\n return null;\n }\n};\n\nexport default Capability.makeModule(\n Effect.fnUntraced(function* () {\n // Get context for lazy capability access in callbacks.\n const capabilities = yield* Capability.Service;\n\n // TODO(wittjosiah): Factor out lookup handlers to other plugins to make not ECHO-specific.\n const handleAnchorActivate = async ({\n dxn,\n label,\n trigger,\n kind = 'card',\n title: titleProp,\n side,\n props,\n }: DxAnchorActivate) => {\n const { invokePromise } = capabilities.get(Capabilities.OperationInvoker);\n const client = capabilities.get(ClientCapabilities.Client);\n const registry = capabilities.get(Capabilities.AtomRegistry);\n const [layoutAtom] = capabilities.getAll(AppCapabilities.Layout);\n const layout = registry.get(layoutAtom);\n const { spaceId } = parseId(layout.workspace);\n const space = (spaceId && client.spaces.get(spaceId)) ?? client.spaces.default;\n const result = await handlePreviewLookup(client, space, { dxn, label });\n if (!result) {\n return;\n }\n\n const title = titleProp ?? Obj.getLabel(result.object);\n\n await invokePromise(LayoutOperation.UpdatePopover, {\n subjectRef: dxn,\n subject: result.object,\n state: true,\n variant: 'virtual',\n anchor: trigger,\n ...(kind && { kind }),\n ...(title && { title }),\n ...(side && { side }),\n ...(props && { props }),\n });\n };\n\n let cleanup: () => void;\n if (document.defaultView) {\n cleanup = addEventListener(\n document.defaultView,\n DX_ANCHOR_ACTIVATE as any,\n handleAnchorActivate,\n customEventOptions,\n );\n } else {\n log.warn('no default view found');\n }\n\n return Capability.contributes(Capabilities.Null, null, () => Effect.sync(() => cleanup?.()));\n }),\n);\n"],
5
+ "mappings": ";AAIA,YAAYA,YAAY;AAExB,SAASC,cAAcC,kBAAkB;AACzC,SAASC,iBAAiBC,uBAAuB;AACjD,SAASC,wBAAwB;AAEjC,SAAqBC,eAAe;AACpC,SAASC,WAAW;AACpB,SAASC,WAAW;AACpB,SAASC,WAAW;AACpB,SAASC,0BAA0B;AACnC,SAASC,0BAAiD;;AAG1D,IAAMC,qBAAqB;EAAEC,SAAS;EAAMC,SAAS;AAAM;AAE3D,IAAMC,sBAAsB,OAC1BC,QACAC,cACA,EAAEC,KAAKC,MAAK,MAAkB;AAE9B,MAAI;AACF,UAAMC,SAAS,MAAMH,aAAaI,GAAGC,QAAQd,IAAIe,MAAML,GAAAA,CAAAA,EAAMM,KAAI;AACjE,WAAO;MAAEL;MAAOC;IAAO;EACzB,QAAQ;AACN,WAAO;EACT;AACF;AAEA,IAAA,0BAAelB,WAAWuB,WACjBC,kBAAW,aAAA;AAEhB,QAAMC,eAAe,OAAOzB,WAAW0B;AAGvC,QAAMC,uBAAuB,OAAO,EAClCX,KACAC,OACAW,SACAC,OAAO,QACPC,OAAOC,WACPC,MACAC,MAAK,MACY;AACjB,UAAM,EAAEC,cAAa,IAAKT,aAAaU,IAAIpC,aAAaqC,gBAAgB;AACxE,UAAMtB,SAASW,aAAaU,IAAI3B,mBAAmB6B,MAAM;AACzD,UAAMC,WAAWb,aAAaU,IAAIpC,aAAawC,YAAY;AAC3D,UAAM,CAACC,UAAAA,IAAcf,aAAagB,OAAOxC,gBAAgByC,MAAM;AAC/D,UAAMC,SAASL,SAASH,IAAIK,UAAAA;AAC5B,UAAM,EAAEI,QAAO,IAAKxC,QAAQuC,OAAOE,SAAS;AAC5C,UAAMC,SAASF,WAAW9B,OAAOiC,OAAOZ,IAAIS,OAAAA,MAAa9B,OAAOiC,OAAOC;AACvE,UAAMC,SAAS,MAAMpC,oBAAoBC,QAAQgC,OAAO;MAAE9B;MAAKC;IAAM,CAAA;AACrE,QAAI,CAACgC,QAAQ;AACX;IACF;AAEA,UAAMnB,QAAQC,aAAa1B,IAAI6C,SAASD,OAAO/B,MAAM;AAErD,UAAMgB,cAAchC,gBAAgBiD,eAAe;MACjDC,YAAYpC;MACZqC,SAASJ,OAAO/B;MAChBoC,OAAO;MACPC,SAAS;MACTC,QAAQ5B;MACR,GAAIC,QAAQ;QAAEA;MAAK;MACnB,GAAIC,SAAS;QAAEA;MAAM;MACrB,GAAIE,QAAQ;QAAEA;MAAK;MACnB,GAAIC,SAAS;QAAEA;MAAM;IACvB,CAAA;EACF;AAEA,MAAIwB;AACJ,MAAIC,SAASC,aAAa;AACxBF,cAAUtD,iBACRuD,SAASC,aACTlD,oBACAkB,sBACAjB,kBAAAA;EAEJ,OAAO;AACLH,QAAIqD,KAAK,yBAAA,QAAA;;;;;;EACX;AAEA,SAAO5D,WAAW6D,YAAY9D,aAAa+D,MAAM,MAAM,MAAaC,YAAK,MAAMN,UAAAA,CAAAA,CAAAA;AACjF,CAAA,CAAA;",
6
+ "names": ["Effect", "Capabilities", "Capability", "AppCapabilities", "LayoutOperation", "addEventListener", "parseId", "Obj", "DXN", "log", "ClientCapabilities", "DX_ANCHOR_ACTIVATE", "customEventOptions", "capture", "passive", "handlePreviewLookup", "client", "defaultSpace", "dxn", "label", "object", "db", "makeRef", "parse", "load", "makeModule", "fnUntraced", "capabilities", "Service", "handleAnchorActivate", "trigger", "kind", "title", "titleProp", "side", "props", "invokePromise", "get", "OperationInvoker", "Client", "registry", "AtomRegistry", "layoutAtom", "getAll", "Layout", "layout", "spaceId", "workspace", "space", "spaces", "default", "result", "getLabel", "UpdatePopover", "subjectRef", "subject", "state", "variant", "anchor", "cleanup", "document", "defaultView", "warn", "contributes", "Null", "sync"]
7
+ }
@@ -0,0 +1,251 @@
1
+ import {
2
+ meta
3
+ } from "./chunk-XLN6KTHK.mjs";
4
+
5
+ // src/capabilities/react-surface/react-surface.tsx
6
+ import * as Effect from "effect/Effect";
7
+ import React6 from "react";
8
+ import { Capabilities, Capability } from "@dxos/app-framework";
9
+ import { Surface } from "@dxos/app-framework/ui";
10
+ import { Obj as Obj3 } from "@dxos/echo";
11
+ import { Card as Card5 } from "@dxos/react-ui-mosaic";
12
+ import { Organization, Person, Pipeline, Task as Task2 } from "@dxos/types";
13
+
14
+ // src/cards/FormCard.tsx
15
+ import React, { useCallback } from "react";
16
+ import { useOperationInvoker } from "@dxos/app-framework/ui";
17
+ import { LayoutOperation } from "@dxos/app-toolkit";
18
+ import { Obj } from "@dxos/echo";
19
+ import { splitJsonPath } from "@dxos/effect";
20
+ import { useTranslation } from "@dxos/react-ui";
21
+ import { Form, omitId } from "@dxos/react-ui-form";
22
+ import { descriptionMessage, mx } from "@dxos/ui-theme";
23
+ var FormCard = ({ subject, projection }) => {
24
+ const { t } = useTranslation(meta.id);
25
+ const { invokePromise } = useOperationInvoker();
26
+ const schema = Obj.getSchema(subject);
27
+ const label = Obj.getLabel(subject) ?? Obj.getTypename(subject) ?? t("unable to create preview message");
28
+ const handleNavigate = useCallback(async () => {
29
+ await invokePromise(LayoutOperation.UpdatePopover, {
30
+ state: false,
31
+ anchorId: ""
32
+ });
33
+ await invokePromise(LayoutOperation.Open, {
34
+ subject: [
35
+ Obj.getDXN(subject).toString()
36
+ ]
37
+ });
38
+ }, [
39
+ invokePromise,
40
+ subject
41
+ ]);
42
+ const handleSave = useCallback((values, { changed }) => {
43
+ const paths = Object.keys(changed).filter((path) => changed[path]);
44
+ Obj.change(subject, () => {
45
+ for (const path of paths) {
46
+ const value = values[path];
47
+ const parts = splitJsonPath(path);
48
+ Obj.setValue(subject, parts, value);
49
+ }
50
+ });
51
+ }, []);
52
+ if (!schema) {
53
+ return /* @__PURE__ */ React.createElement("p", {
54
+ className: mx(descriptionMessage)
55
+ }, t("unable to create preview message"));
56
+ }
57
+ return /* @__PURE__ */ React.createElement(Form.Root, {
58
+ schema: omitId(schema),
59
+ projection,
60
+ values: subject,
61
+ autoSave: true,
62
+ onSave: handleSave
63
+ }, /* @__PURE__ */ React.createElement(Form.Viewport, null, /* @__PURE__ */ React.createElement(Form.Content, null, /* @__PURE__ */ React.createElement(Form.FieldSet, null))));
64
+ };
65
+
66
+ // src/cards/OrganizationCard.tsx
67
+ import React2 from "react";
68
+ import { Card } from "@dxos/react-ui-mosaic";
69
+ var OrganizationCard = ({ subject }) => {
70
+ const { image, description, website } = subject;
71
+ return /* @__PURE__ */ React2.createElement(Card.Content, null, /* @__PURE__ */ React2.createElement(Card.Poster, {
72
+ alt: name ?? "",
73
+ ...image ? {
74
+ image
75
+ } : {
76
+ icon: "ph--building-office--regular"
77
+ },
78
+ classNames: !image && "opacity-50"
79
+ }), description && /* @__PURE__ */ React2.createElement(Card.Row, null, /* @__PURE__ */ React2.createElement(Card.Text, {
80
+ variant: "description"
81
+ }, description)), website && /* @__PURE__ */ React2.createElement(Card.Link, {
82
+ label: website,
83
+ href: website
84
+ }));
85
+ };
86
+
87
+ // src/cards/PersonCard.tsx
88
+ import React3 from "react";
89
+ import { Avatar } from "@dxos/react-ui";
90
+ import { Card as Card2 } from "@dxos/react-ui-mosaic";
91
+ var PersonCard = ({ subject }) => {
92
+ const { image, organization: { target: organization } = {}, emails = [] } = subject;
93
+ return /* @__PURE__ */ React3.createElement(Avatar.Root, null, /* @__PURE__ */ React3.createElement(Card2.Content, null, image && /* @__PURE__ */ React3.createElement(Card2.Row, {
94
+ className: "plb-1"
95
+ }, /* @__PURE__ */ React3.createElement(Avatar.Content, {
96
+ imgSrc: image,
97
+ icon: "ph--user--regular",
98
+ size: 16,
99
+ classNames: !image && "opacity-50",
100
+ hue: "neutral",
101
+ variant: "square"
102
+ })), organization?.name && /* @__PURE__ */ React3.createElement(Card2.Action, {
103
+ icon: "ph--buildings--regular",
104
+ label: organization.name
105
+ }), emails.map(({ value }) => /* @__PURE__ */ React3.createElement(Card2.Row, {
106
+ key: value,
107
+ icon: "ph--at--regular"
108
+ }, /* @__PURE__ */ React3.createElement(Card2.Text, {
109
+ truncate: true,
110
+ className: "text-primaryText"
111
+ }, value)))));
112
+ };
113
+
114
+ // src/cards/ProjectCard.tsx
115
+ import React4 from "react";
116
+ import { Obj as Obj2 } from "@dxos/echo";
117
+ import { Card as Card3 } from "@dxos/react-ui-mosaic";
118
+ var ProjectCard = ({ subject }) => {
119
+ const { name: name2, image, description } = subject;
120
+ return /* @__PURE__ */ React4.createElement(Card3.Content, null, image && /* @__PURE__ */ React4.createElement(Card3.Poster, {
121
+ image,
122
+ alt: Obj2.getLabel(subject) ?? "",
123
+ aspect: "auto"
124
+ }), description && /* @__PURE__ */ React4.createElement(Card3.Text, {
125
+ variant: "description"
126
+ }, description));
127
+ };
128
+
129
+ // src/cards/TaskCard.tsx
130
+ import * as SchemaAST from "effect/SchemaAST";
131
+ import React5 from "react";
132
+ import { PropertyMetaAnnotationId } from "@dxos/echo/internal";
133
+ import { Card as Card4 } from "@dxos/react-ui-mosaic";
134
+ import { Task } from "@dxos/types";
135
+ var TaskCard = ({ subject }) => {
136
+ const { title, status } = subject;
137
+ const statusOption = getActiveStatusOption(status);
138
+ return /* @__PURE__ */ React5.createElement(Card4.Content, null, /* @__PURE__ */ React5.createElement(Card4.Heading, {
139
+ classNames: "min-is-0 flex-1 truncate"
140
+ }, title), statusOption && /* @__PURE__ */ React5.createElement("span", {
141
+ className: "dx-tag",
142
+ "data-hue": statusOption.color
143
+ }, statusOption.title));
144
+ };
145
+ var getActiveStatusOption = (status) => {
146
+ const properties = SchemaAST.getPropertySignatures(Task.Task.ast);
147
+ const statusProperty = properties.find((p) => p.name === "status");
148
+ const statusMeta = SchemaAST.getAnnotation(PropertyMetaAnnotationId)(
149
+ // TODO(thure): Typescript asserts `.type` doesn’t have `.types`, but in runtime it does.
150
+ statusProperty.type.types[0]
151
+ );
152
+ const options = statusMeta.value.singleSelect.options;
153
+ return options.find(({ id }) => id === status);
154
+ };
155
+
156
+ // src/capabilities/react-surface/react-surface.tsx
157
+ var react_surface_default = Capability.makeModule(() => Effect.succeed(Capability.contributes(Capabilities.ReactSurface, [
158
+ //
159
+ // Specific schema types.
160
+ // TODO(burdon): Create helpers and factor out.
161
+ //
162
+ Surface.create({
163
+ id: `${meta.id}/schema-popover--contact`,
164
+ role: "card--content",
165
+ position: "hoist",
166
+ filter: (data) => Obj3.instanceOf(Person.Person, data.subject),
167
+ component: ({ data, role }) => {
168
+ return /* @__PURE__ */ React6.createElement(PersonCard, {
169
+ role,
170
+ subject: data.subject
171
+ });
172
+ }
173
+ }),
174
+ Surface.create({
175
+ id: `${meta.id}/schema-popover--organization`,
176
+ role: "card--content",
177
+ position: "hoist",
178
+ filter: (data) => Obj3.instanceOf(Organization.Organization, data.subject),
179
+ component: ({ data, role }) => {
180
+ return /* @__PURE__ */ React6.createElement(OrganizationCard, {
181
+ role,
182
+ subject: data.subject
183
+ });
184
+ }
185
+ }),
186
+ Surface.create({
187
+ id: `${meta.id}/schema-popover--project`,
188
+ role: "card--content",
189
+ position: "hoist",
190
+ filter: (data) => Obj3.instanceOf(Pipeline.Pipeline, data.subject),
191
+ component: ({ data, role }) => {
192
+ return /* @__PURE__ */ React6.createElement(ProjectCard, {
193
+ role,
194
+ subject: data.subject
195
+ });
196
+ }
197
+ }),
198
+ Surface.create({
199
+ id: `${meta.id}/schema-popover--task`,
200
+ role: "card--content",
201
+ position: "hoist",
202
+ filter: (data) => Obj3.instanceOf(Task2.Task, data.subject),
203
+ component: ({ data, role }) => {
204
+ return /* @__PURE__ */ React6.createElement(TaskCard, {
205
+ role,
206
+ subject: data.subject
207
+ });
208
+ }
209
+ }),
210
+ //
211
+ // Fallback for any object.
212
+ //
213
+ Surface.create({
214
+ id: `${meta.id}/fallback-popover`,
215
+ role: "card--content",
216
+ position: "fallback",
217
+ filter: (data) => Obj3.isObject(data.subject),
218
+ component: ({ data, role }) => {
219
+ return /* @__PURE__ */ React6.createElement(FormCard, {
220
+ role,
221
+ subject: data.subject,
222
+ projection: data.projection
223
+ });
224
+ }
225
+ }),
226
+ Surface.create({
227
+ id: `${meta.id}/section`,
228
+ role: [
229
+ "section"
230
+ ],
231
+ position: "fallback",
232
+ filter: (data) => Obj3.isObject(data.subject),
233
+ component: ({ data }) => {
234
+ return /* @__PURE__ */ React6.createElement("div", {
235
+ role: "none",
236
+ className: "flex is-full justify-center"
237
+ }, /* @__PURE__ */ React6.createElement("div", {
238
+ role: "none",
239
+ className: "pbs-2 pbe-2 card-min-width card-max-width"
240
+ }, /* @__PURE__ */ React6.createElement(Card5.Root, null, /* @__PURE__ */ React6.createElement(Surface.Surface, {
241
+ role: "card--content",
242
+ data,
243
+ limit: 1
244
+ }))));
245
+ }
246
+ })
247
+ ])));
248
+ export {
249
+ react_surface_default as default
250
+ };
251
+ //# sourceMappingURL=react-surface-W3FAIVY7.mjs.map