@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.
- package/LICENSE +8 -0
- package/README.md +1 -0
- package/dist/lib/browser/chunk-B2VK6GFP.mjs +28 -0
- package/dist/lib/browser/chunk-B2VK6GFP.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +72 -0
- package/dist/lib/browser/index.mjs.map +7 -0
- package/dist/lib/browser/meta.json +1 -0
- package/dist/lib/browser/preview-popover-S3OY3CFZ.mjs +65 -0
- package/dist/lib/browser/preview-popover-S3OY3CFZ.mjs.map +7 -0
- package/dist/lib/browser/react-surface-XDHP6EN7.mjs +285 -0
- package/dist/lib/browser/react-surface-XDHP6EN7.mjs.map +7 -0
- package/dist/lib/node/chunk-VFSOM2B4.cjs +55 -0
- package/dist/lib/node/chunk-VFSOM2B4.cjs.map +7 -0
- package/dist/lib/node/index.cjs +97 -0
- package/dist/lib/node/index.cjs.map +7 -0
- package/dist/lib/node/meta.json +1 -0
- package/dist/lib/node/preview-popover-GPBOHU5E.cjs +84 -0
- package/dist/lib/node/preview-popover-GPBOHU5E.cjs.map +7 -0
- package/dist/lib/node/react-surface-CPAQ7ZYR.cjs +297 -0
- package/dist/lib/node/react-surface-CPAQ7ZYR.cjs.map +7 -0
- package/dist/lib/node-esm/chunk-PYKIS3N7.mjs +30 -0
- package/dist/lib/node-esm/chunk-PYKIS3N7.mjs.map +7 -0
- package/dist/lib/node-esm/index.mjs +73 -0
- package/dist/lib/node-esm/index.mjs.map +7 -0
- package/dist/lib/node-esm/meta.json +1 -0
- package/dist/lib/node-esm/preview-popover-EQAEYYDT.mjs +67 -0
- package/dist/lib/node-esm/preview-popover-EQAEYYDT.mjs.map +7 -0
- package/dist/lib/node-esm/react-surface-QJRHN4PN.mjs +286 -0
- package/dist/lib/node-esm/react-surface-QJRHN4PN.mjs.map +7 -0
- package/dist/types/src/Preview.stories.d.ts +141 -0
- package/dist/types/src/Preview.stories.d.ts.map +1 -0
- package/dist/types/src/PreviewPlugin.d.ts +2 -0
- package/dist/types/src/PreviewPlugin.d.ts.map +1 -0
- package/dist/types/src/capabilities/index.d.ts +3 -0
- package/dist/types/src/capabilities/index.d.ts.map +1 -0
- package/dist/types/src/capabilities/preview-popover.d.ts +4 -0
- package/dist/types/src/capabilities/preview-popover.d.ts.map +1 -0
- package/dist/types/src/capabilities/react-surface.d.ts +4 -0
- package/dist/types/src/capabilities/react-surface.d.ts.map +1 -0
- package/dist/types/src/components/ContactCard.d.ts +7 -0
- package/dist/types/src/components/ContactCard.d.ts.map +1 -0
- package/dist/types/src/components/OrganizationCard.d.ts +5 -0
- package/dist/types/src/components/OrganizationCard.d.ts.map +1 -0
- package/dist/types/src/components/ProjectCard.d.ts +5 -0
- package/dist/types/src/components/ProjectCard.d.ts.map +1 -0
- package/dist/types/src/components/index.d.ts +4 -0
- package/dist/types/src/components/index.d.ts.map +1 -0
- package/dist/types/src/index.d.ts +4 -0
- package/dist/types/src/index.d.ts.map +1 -0
- package/dist/types/src/meta.d.ts +4 -0
- package/dist/types/src/meta.d.ts.map +1 -0
- package/dist/types/src/translations.d.ts +9 -0
- package/dist/types/src/translations.d.ts.map +1 -0
- package/dist/types/src/types.d.ts +25 -0
- package/dist/types/src/types.d.ts.map +1 -0
- package/dist/types/tsconfig.tsbuildinfo +1 -0
- package/package.json +61 -0
- package/src/Preview.stories.tsx +145 -0
- package/src/PreviewPlugin.tsx +35 -0
- package/src/capabilities/index.ts +8 -0
- package/src/capabilities/preview-popover.ts +65 -0
- package/src/capabilities/react-surface.tsx +126 -0
- package/src/components/ContactCard.tsx +70 -0
- package/src/components/OrganizationCard.tsx +48 -0
- package/src/components/ProjectCard.tsx +24 -0
- package/src/components/index.ts +7 -0
- package/src/index.ts +8 -0
- package/src/meta.ts +14 -0
- package/src/translations.ts +15 -0
- package/src/types.ts +40 -0
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var chunk_VFSOM2B4_exports = {};
|
|
20
|
+
__export(chunk_VFSOM2B4_exports, {
|
|
21
|
+
PREVIEW_PLUGIN: () => PREVIEW_PLUGIN,
|
|
22
|
+
defaultCard: () => defaultCard,
|
|
23
|
+
kanbanCardWithoutPoster: () => kanbanCardWithoutPoster,
|
|
24
|
+
meta: () => meta,
|
|
25
|
+
popoverCard: () => popoverCard,
|
|
26
|
+
previewChrome: () => previewChrome,
|
|
27
|
+
previewProse: () => previewProse,
|
|
28
|
+
previewTitle: () => previewTitle
|
|
29
|
+
});
|
|
30
|
+
module.exports = __toCommonJS(chunk_VFSOM2B4_exports);
|
|
31
|
+
var PREVIEW_PLUGIN = "dxos.org/plugin/preview";
|
|
32
|
+
var meta = {
|
|
33
|
+
id: PREVIEW_PLUGIN,
|
|
34
|
+
name: "Preview",
|
|
35
|
+
icon: "ph--eye--regular",
|
|
36
|
+
source: "https://github.com/dxos/dxos/tree/main/packages/plugins/plugin-preview"
|
|
37
|
+
};
|
|
38
|
+
var popoverCard = "popover-card-width rounded-lg overflow-hidden";
|
|
39
|
+
var defaultCard = "";
|
|
40
|
+
var kanbanCardWithoutPoster = "pbs-[--rail-action]";
|
|
41
|
+
var previewTitle = "text-lg font-medium line-clamp-2";
|
|
42
|
+
var previewProse = "pli-3 mlb-3";
|
|
43
|
+
var previewChrome = "pli-1.5 mlb-1.5 [&_.dx-button]:pli-1.5 [&_.dx-button]:text-start [&_.dx-button]:is-full";
|
|
44
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
45
|
+
0 && (module.exports = {
|
|
46
|
+
PREVIEW_PLUGIN,
|
|
47
|
+
defaultCard,
|
|
48
|
+
kanbanCardWithoutPoster,
|
|
49
|
+
meta,
|
|
50
|
+
popoverCard,
|
|
51
|
+
previewChrome,
|
|
52
|
+
previewProse,
|
|
53
|
+
previewTitle
|
|
54
|
+
});
|
|
55
|
+
//# sourceMappingURL=chunk-VFSOM2B4.cjs.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,97 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
var node_exports = {};
|
|
30
|
+
__export(node_exports, {
|
|
31
|
+
PREVIEW_PLUGIN: () => import_chunk_VFSOM2B4.PREVIEW_PLUGIN,
|
|
32
|
+
PreviewPlugin: () => PreviewPlugin,
|
|
33
|
+
defaultCard: () => import_chunk_VFSOM2B4.defaultCard,
|
|
34
|
+
kanbanCardWithoutPoster: () => import_chunk_VFSOM2B4.kanbanCardWithoutPoster,
|
|
35
|
+
meta: () => import_chunk_VFSOM2B4.meta,
|
|
36
|
+
popoverCard: () => import_chunk_VFSOM2B4.popoverCard,
|
|
37
|
+
previewChrome: () => import_chunk_VFSOM2B4.previewChrome,
|
|
38
|
+
previewProse: () => import_chunk_VFSOM2B4.previewProse,
|
|
39
|
+
previewTitle: () => import_chunk_VFSOM2B4.previewTitle
|
|
40
|
+
});
|
|
41
|
+
module.exports = __toCommonJS(node_exports);
|
|
42
|
+
var import_chunk_VFSOM2B4 = require("./chunk-VFSOM2B4.cjs");
|
|
43
|
+
var import_app_framework = require("@dxos/app-framework");
|
|
44
|
+
var import_plugin_client = require("@dxos/plugin-client");
|
|
45
|
+
var import_schema = require("@dxos/schema");
|
|
46
|
+
var import_app_framework2 = require("@dxos/app-framework");
|
|
47
|
+
var PreviewPopover = (0, import_app_framework2.lazy)(() => import("./preview-popover-GPBOHU5E.cjs"));
|
|
48
|
+
var ReactSurface = (0, import_app_framework2.lazy)(() => import("./react-surface-CPAQ7ZYR.cjs"));
|
|
49
|
+
var translations_default = [
|
|
50
|
+
{
|
|
51
|
+
"en-US": {
|
|
52
|
+
[import_chunk_VFSOM2B4.PREVIEW_PLUGIN]: {
|
|
53
|
+
"unable to create preview message": "No preview"
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
];
|
|
58
|
+
var PreviewPlugin = () => (0, import_app_framework.definePlugin)(import_chunk_VFSOM2B4.meta, [
|
|
59
|
+
(0, import_app_framework.defineModule)({
|
|
60
|
+
id: `${import_chunk_VFSOM2B4.meta.id}/module/translations`,
|
|
61
|
+
activatesOn: import_app_framework.Events.SetupTranslations,
|
|
62
|
+
activate: () => (0, import_app_framework.contributes)(import_app_framework.Capabilities.Translations, translations_default)
|
|
63
|
+
}),
|
|
64
|
+
(0, import_app_framework.defineModule)({
|
|
65
|
+
id: `${import_chunk_VFSOM2B4.meta.id}/module/schema`,
|
|
66
|
+
activatesOn: import_plugin_client.ClientEvents.SetupSchema,
|
|
67
|
+
activate: () => [
|
|
68
|
+
(0, import_app_framework.contributes)(import_plugin_client.ClientCapabilities.Schema, [
|
|
69
|
+
import_schema.DataType.Person,
|
|
70
|
+
import_schema.DataType.Organization
|
|
71
|
+
])
|
|
72
|
+
]
|
|
73
|
+
}),
|
|
74
|
+
(0, import_app_framework.defineModule)({
|
|
75
|
+
id: `${import_chunk_VFSOM2B4.meta.id}/module/preview-popover`,
|
|
76
|
+
activatesOn: import_app_framework.Events.Startup,
|
|
77
|
+
activate: PreviewPopover
|
|
78
|
+
}),
|
|
79
|
+
(0, import_app_framework.defineModule)({
|
|
80
|
+
id: `${import_chunk_VFSOM2B4.meta.id}/module/react-surface`,
|
|
81
|
+
activatesOn: import_app_framework.Events.SetupReactSurface,
|
|
82
|
+
activate: ReactSurface
|
|
83
|
+
})
|
|
84
|
+
]);
|
|
85
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
86
|
+
0 && (module.exports = {
|
|
87
|
+
PREVIEW_PLUGIN,
|
|
88
|
+
PreviewPlugin,
|
|
89
|
+
defaultCard,
|
|
90
|
+
kanbanCardWithoutPoster,
|
|
91
|
+
meta,
|
|
92
|
+
popoverCard,
|
|
93
|
+
previewChrome,
|
|
94
|
+
previewProse,
|
|
95
|
+
previewTitle
|
|
96
|
+
});
|
|
97
|
+
//# sourceMappingURL=index.cjs.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,2BAA8E;AAC9E,2BAAiD;AACjD,oBAAyB;ACFzB,IAAAA,wBAAqB;AAEd,IAAMC,qBAAiBC,4BAAK,MAAM,OAAO,gCAAA,CAAA;AACzC,IAAMC,mBAAeD,4BAAK,MAAM,OAAO,8BAAA,CAAA;ACD9C,IAAA,uBAAe;EACb;IACE,SAAS;MACP,CAACE,oCAAAA,GAAiB;QAChB,oCAAoC;MACtC;IACF;EACF;;AFDK,IAAMC,gBAAgB,UAC3BC,mCAAaC,4BAAM;MACjBC,mCAAa;IACXC,IAAI,GAAGF,2BAAKE,EAAE;IACdC,aAAaC,4BAAOC;IACpBC,UAAU,UAAMC,kCAAYC,kCAAaC,cAAcC,oBAAAA;EACzD,CAAA;MACAT,mCAAa;IACXC,IAAI,GAAGF,2BAAKE,EAAE;IACdC,aAAaQ,kCAAaC;IAC1BN,UAAU,MAAM;UAACC,kCAAYM,wCAAmBC,QAAQ;QAACC,uBAASC;QAAQD,uBAASE;OAAa;;EAClG,CAAA;MACAhB,mCAAa;IACXC,IAAI,GAAGF,2BAAKE,EAAE;IACdC,aAAaC,4BAAOc;IACpBZ,UAAUZ;EACZ,CAAA;MACAO,mCAAa;IACXC,IAAI,GAAGF,2BAAKE,EAAE;IACdC,aAAaC,4BAAOe;IACpBb,UAAUV;EACZ,CAAA;CACD;",
|
|
6
|
+
"names": ["import_app_framework", "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", "SetupReactSurface"]
|
|
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/index.cjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":3140},"packages/plugins/plugin-preview/dist/lib/node/index.cjs":{"imports":[{"path":"packages/plugins/plugin-preview/dist/lib/node/chunk-VFSOM2B4.cjs","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/preview-popover-GPBOHU5E.cjs","kind":"dynamic-import"},{"path":"packages/plugins/plugin-preview/dist/lib/node/react-surface-CPAQ7ZYR.cjs","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":1902},"packages/plugins/plugin-preview/dist/lib/node/preview-popover-GPBOHU5E.cjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":4302},"packages/plugins/plugin-preview/dist/lib/node/preview-popover-GPBOHU5E.cjs":{"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":2188},"packages/plugins/plugin-preview/dist/lib/node/react-surface-CPAQ7ZYR.cjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":17740},"packages/plugins/plugin-preview/dist/lib/node/react-surface-CPAQ7ZYR.cjs":{"imports":[{"path":"packages/plugins/plugin-preview/dist/lib/node/chunk-VFSOM2B4.cjs","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":10509},"packages/plugins/plugin-preview/dist/lib/node/chunk-VFSOM2B4.cjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":2193},"packages/plugins/plugin-preview/dist/lib/node/chunk-VFSOM2B4.cjs":{"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":842}}}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var preview_popover_GPBOHU5E_exports = {};
|
|
20
|
+
__export(preview_popover_GPBOHU5E_exports, {
|
|
21
|
+
default: () => preview_popover_default
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(preview_popover_GPBOHU5E_exports);
|
|
24
|
+
var import_app_framework = require("@dxos/app-framework");
|
|
25
|
+
var import_async = require("@dxos/async");
|
|
26
|
+
var import_client = require("@dxos/client");
|
|
27
|
+
var import_echo = require("@dxos/client/echo");
|
|
28
|
+
var import_keys = require("@dxos/keys");
|
|
29
|
+
var import_log = require("@dxos/log");
|
|
30
|
+
var import_plugin_client = require("@dxos/plugin-client");
|
|
31
|
+
var __dxlog_file = "/home/runner/work/dxos/dxos/packages/plugins/plugin-preview/src/capabilities/preview-popover.ts";
|
|
32
|
+
var customEventOptions = {
|
|
33
|
+
capture: true,
|
|
34
|
+
passive: false
|
|
35
|
+
};
|
|
36
|
+
var handlePreviewLookup = async (client, defaultSpace, { ref, label }) => {
|
|
37
|
+
const dxn = import_keys.DXN.parse(ref);
|
|
38
|
+
if (!dxn) {
|
|
39
|
+
return null;
|
|
40
|
+
}
|
|
41
|
+
const object = await (0, import_client.resolveRef)(client, dxn, defaultSpace);
|
|
42
|
+
return {
|
|
43
|
+
label,
|
|
44
|
+
object
|
|
45
|
+
};
|
|
46
|
+
};
|
|
47
|
+
var preview_popover_default = (context) => {
|
|
48
|
+
const handleDxRefTagActivate = async ({ refId, label, trigger }) => {
|
|
49
|
+
const { dispatchPromise: dispatch } = context.getCapability(import_app_framework.Capabilities.IntentDispatcher);
|
|
50
|
+
const client = context.getCapability(import_plugin_client.ClientCapabilities.Client);
|
|
51
|
+
const [layout] = context.getCapabilities(import_app_framework.Capabilities.Layout);
|
|
52
|
+
const { spaceId } = (0, import_echo.parseId)(layout.workspace);
|
|
53
|
+
const space = (spaceId && client.spaces.get(spaceId)) ?? client.spaces.default;
|
|
54
|
+
const result = await handlePreviewLookup(client, space, {
|
|
55
|
+
ref: refId,
|
|
56
|
+
label
|
|
57
|
+
});
|
|
58
|
+
if (!result) {
|
|
59
|
+
return;
|
|
60
|
+
}
|
|
61
|
+
await dispatch((0, import_app_framework.createIntent)(import_app_framework.LayoutAction.UpdatePopover, {
|
|
62
|
+
part: "popover",
|
|
63
|
+
subject: result.object,
|
|
64
|
+
options: {
|
|
65
|
+
state: true,
|
|
66
|
+
variant: "virtual",
|
|
67
|
+
anchor: trigger
|
|
68
|
+
}
|
|
69
|
+
}));
|
|
70
|
+
};
|
|
71
|
+
let cleanup;
|
|
72
|
+
if (document.defaultView) {
|
|
73
|
+
cleanup = (0, import_async.addEventListener)(document.defaultView, "dx-ref-tag-activate", handleDxRefTagActivate, customEventOptions);
|
|
74
|
+
} else {
|
|
75
|
+
import_log.log.warn("No default view found", void 0, {
|
|
76
|
+
F: __dxlog_file,
|
|
77
|
+
L: 61,
|
|
78
|
+
S: void 0,
|
|
79
|
+
C: (f, a) => f(...a)
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
return (0, import_app_framework.contributes)(import_app_framework.Capabilities.Null, null, () => cleanup());
|
|
83
|
+
};
|
|
84
|
+
//# sourceMappingURL=preview-popover-GPBOHU5E.cjs.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,2BAA0F;AAC1F,mBAAiC;AACjC,oBAAwC;AACxC,kBAAoC;AACpC,kBAAoB;AAEpB,iBAAoB;AACpB,2BAAmC;;AAGnC,IAAMA,qBAAqB;EAAEC,SAAS;EAAMC,SAAS;AAAM;AAE3D,IAAMC,sBAAsB,OAC1BC,QACAC,cACA,EAAEC,KAAKC,MAAK,MAAkB;AAE9B,QAAMC,MAAMC,gBAAIC,MAAMJ,GAAAA;AACtB,MAAI,CAACE,KAAK;AACR,WAAO;EACT;AAEA,QAAMG,SAAS,UAAMC,0BAAWR,QAAQI,KAAKH,YAAAA;AAC7C,SAAO;IAAEE;IAAOI;EAAO;AACzB;AAEA,IAAA,0BAAe,CAACE,YAAAA;AAEd,QAAMC,yBAAyB,OAAO,EAAEC,OAAOR,OAAOS,QAAO,MAAoB;AAC/E,UAAM,EAAEC,iBAAiBC,SAAQ,IAAKL,QAAQM,cAAcC,kCAAaC,gBAAgB;AACzF,UAAMjB,SAASS,QAAQM,cAAcG,wCAAmBC,MAAM;AAC9D,UAAM,CAACC,MAAAA,IAAUX,QAAQY,gBAAgBL,kCAAaM,MAAM;AAC5D,UAAM,EAAEC,QAAO,QAAKC,qBAAQJ,OAAOK,SAAS;AAC5C,UAAMC,SAASH,WAAWvB,OAAO2B,OAAOC,IAAIL,OAAAA,MAAavB,OAAO2B,OAAOE;AACvE,UAAMC,SAAS,MAAM/B,oBAAoBC,QAAQ0B,OAAO;MAAExB,KAAKS;MAAOR;IAAM,CAAA;AAC5E,QAAI,CAAC2B,QAAQ;AACX;IACF;AAEA,UAAMhB,aACJiB,mCAAaC,kCAAaC,eAAe;MACvCC,MAAM;MACNC,SAASL,OAAOvB;MAChB6B,SAAS;QACPC,OAAO;QACPC,SAAS;QACTC,QAAQ3B;MACV;IACF,CAAA,CAAA;EAEJ;AAEA,MAAI4B;AACJ,MAAIC,SAASC,aAAa;AACxBF,kBAAUG,+BAAiBF,SAASC,aAAa,uBAAuBhC,wBAAwBd,kBAAAA;EAClG,OAAO;AACLgD,mBAAIC,KAAK,yBAAA,QAAA;;;;;;EACX;AAEA,aAAOC,kCAAY9B,kCAAa+B,MAAM,MAAM,MAAMP,QAAAA,CAAAA;AACpD;",
|
|
6
|
+
"names": ["customEventOptions", "capture", "passive", "handlePreviewLookup", "client", "defaultSpace", "ref", "label", "dxn", "DXN", "parse", "object", "resolveRef", "context", "handleDxRefTagActivate", "refId", "trigger", "dispatchPromise", "dispatch", "getCapability", "Capabilities", "IntentDispatcher", "ClientCapabilities", "Client", "layout", "getCapabilities", "Layout", "spaceId", "parseId", "workspace", "space", "spaces", "get", "default", "result", "createIntent", "LayoutAction", "UpdatePopover", "part", "subject", "options", "state", "variant", "anchor", "cleanup", "document", "defaultView", "addEventListener", "log", "warn", "contributes", "Null"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,297 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
var react_surface_CPAQ7ZYR_exports = {};
|
|
30
|
+
__export(react_surface_CPAQ7ZYR_exports, {
|
|
31
|
+
default: () => react_surface_default
|
|
32
|
+
});
|
|
33
|
+
module.exports = __toCommonJS(react_surface_CPAQ7ZYR_exports);
|
|
34
|
+
var import_chunk_VFSOM2B4 = require("./chunk-VFSOM2B4.cjs");
|
|
35
|
+
var import_react = __toESM(require("react"));
|
|
36
|
+
var import_app_framework = require("@dxos/app-framework");
|
|
37
|
+
var import_echo = require("@dxos/client/echo");
|
|
38
|
+
var import_echo_schema = require("@dxos/echo-schema");
|
|
39
|
+
var import_react_ui = require("@dxos/react-ui");
|
|
40
|
+
var import_react_ui_form = require("@dxos/react-ui-form");
|
|
41
|
+
var import_react_ui_table = require("@dxos/react-ui-table");
|
|
42
|
+
var import_react_ui_theme = require("@dxos/react-ui-theme");
|
|
43
|
+
var import_schema = require("@dxos/schema");
|
|
44
|
+
var import_tracking = require("@preact-signals/safe-react/tracking");
|
|
45
|
+
var import_react2 = __toESM(require("react"));
|
|
46
|
+
var import_react_ui2 = require("@dxos/react-ui");
|
|
47
|
+
var import_react_ui_theme2 = require("@dxos/react-ui-theme");
|
|
48
|
+
var import_tracking2 = require("@preact-signals/safe-react/tracking");
|
|
49
|
+
var import_react3 = __toESM(require("react"));
|
|
50
|
+
var import_react_ui3 = require("@dxos/react-ui");
|
|
51
|
+
var import_react_ui_theme3 = require("@dxos/react-ui-theme");
|
|
52
|
+
var import_tracking3 = require("@preact-signals/safe-react/tracking");
|
|
53
|
+
var import_react4 = __toESM(require("react"));
|
|
54
|
+
var import_react_ui_theme4 = require("@dxos/react-ui-theme");
|
|
55
|
+
var ContactCard = ({ children, classNames, role, subject: { fullName, image, organization, emails }, onOrgClick }) => {
|
|
56
|
+
var _effect = (0, import_tracking.useSignals)();
|
|
57
|
+
try {
|
|
58
|
+
const organizationName = organization && typeof organization === "object" ? organization.target?.name : organization;
|
|
59
|
+
return /* @__PURE__ */ import_react2.default.createElement("div", {
|
|
60
|
+
role: "none",
|
|
61
|
+
className: (0, import_react_ui_theme2.mx)(role === "popover" ? import_chunk_VFSOM2B4.popoverCard : import_chunk_VFSOM2B4.defaultCard, classNames)
|
|
62
|
+
}, /* @__PURE__ */ import_react2.default.createElement(import_react_ui2.Avatar.Root, null, /* @__PURE__ */ import_react2.default.createElement("div", {
|
|
63
|
+
role: "group",
|
|
64
|
+
className: (0, import_react_ui_theme2.mx)(import_chunk_VFSOM2B4.previewProse, "grid gap-3 grid-cols-[min-content_1fr]")
|
|
65
|
+
}, /* @__PURE__ */ import_react2.default.createElement(import_react_ui2.Avatar.Content, {
|
|
66
|
+
imgSrc: image,
|
|
67
|
+
icon: "ph--user--regular",
|
|
68
|
+
size: 16,
|
|
69
|
+
hue: "neutral"
|
|
70
|
+
}), /* @__PURE__ */ import_react2.default.createElement("div", {
|
|
71
|
+
role: "none",
|
|
72
|
+
className: "bs-min self-center"
|
|
73
|
+
}, /* @__PURE__ */ import_react2.default.createElement(import_react_ui2.Avatar.Label, {
|
|
74
|
+
asChild: true
|
|
75
|
+
}, /* @__PURE__ */ import_react2.default.createElement("h2", {
|
|
76
|
+
className: import_chunk_VFSOM2B4.previewTitle
|
|
77
|
+
}, fullName))))), organizationName && /* @__PURE__ */ import_react2.default.createElement("div", {
|
|
78
|
+
role: "none",
|
|
79
|
+
className: import_chunk_VFSOM2B4.previewChrome
|
|
80
|
+
}, typeof organization === "object" && onOrgClick ? /* @__PURE__ */ import_react2.default.createElement(import_react_ui2.Button, {
|
|
81
|
+
variant: "ghost",
|
|
82
|
+
classNames: "gap-2 text-start",
|
|
83
|
+
onClick: () => onOrgClick(organization.target)
|
|
84
|
+
}, /* @__PURE__ */ import_react2.default.createElement(import_react_ui2.Icon, {
|
|
85
|
+
icon: "ph--buildings--regular",
|
|
86
|
+
size: 5,
|
|
87
|
+
classNames: "text-subdued"
|
|
88
|
+
}), /* @__PURE__ */ import_react2.default.createElement("span", {
|
|
89
|
+
className: "min-is-0 flex-1 truncate"
|
|
90
|
+
}, organizationName), /* @__PURE__ */ import_react2.default.createElement(import_react_ui2.Icon, {
|
|
91
|
+
icon: "ph--arrow-right--regular"
|
|
92
|
+
})) : /* @__PURE__ */ import_react2.default.createElement("p", {
|
|
93
|
+
className: "dx-button gap-2",
|
|
94
|
+
"data-variant": "ghost"
|
|
95
|
+
}, /* @__PURE__ */ import_react2.default.createElement(import_react_ui2.Icon, {
|
|
96
|
+
icon: "ph--buildings--regular",
|
|
97
|
+
size: 5,
|
|
98
|
+
classNames: "text-subdued"
|
|
99
|
+
}), /* @__PURE__ */ import_react2.default.createElement("span", {
|
|
100
|
+
className: "min-is-0 flex-1 truncate"
|
|
101
|
+
}, organizationName))), /* @__PURE__ */ import_react2.default.createElement("dl", {
|
|
102
|
+
className: (0, import_react_ui_theme2.mx)(import_chunk_VFSOM2B4.previewProse, "grid gap-2 grid-cols-[min-content_1fr] [&_dt]:text-subdued [&_dt]:pbs-0.5 [&_dd]:min-is-0")
|
|
103
|
+
}, emails?.length && emails.map(({ label, value }) => /* @__PURE__ */ import_react2.default.createElement(import_react2.Fragment, {
|
|
104
|
+
key: value
|
|
105
|
+
}, /* @__PURE__ */ import_react2.default.createElement("dt", null, /* @__PURE__ */ import_react2.default.createElement(import_react_ui2.Icon, {
|
|
106
|
+
icon: "ph--at--regular",
|
|
107
|
+
size: 5
|
|
108
|
+
})), /* @__PURE__ */ import_react2.default.createElement("dd", {
|
|
109
|
+
key: value,
|
|
110
|
+
className: "break-words"
|
|
111
|
+
}, value)))), children);
|
|
112
|
+
} finally {
|
|
113
|
+
_effect.f();
|
|
114
|
+
}
|
|
115
|
+
};
|
|
116
|
+
var OrganizationCard = ({ children, classNames, subject: { name, image, description, website }, role }) => {
|
|
117
|
+
var _effect = (0, import_tracking2.useSignals)();
|
|
118
|
+
try {
|
|
119
|
+
return /* @__PURE__ */ import_react3.default.createElement("div", {
|
|
120
|
+
role: "none",
|
|
121
|
+
className: (0, import_react_ui_theme3.mx)(role === "popover" ? import_chunk_VFSOM2B4.popoverCard : import_chunk_VFSOM2B4.defaultCard, classNames)
|
|
122
|
+
}, image ? /* @__PURE__ */ import_react3.default.createElement("img", {
|
|
123
|
+
className: "aspect-video object-cover is-full bs-auto",
|
|
124
|
+
src: image,
|
|
125
|
+
alt: name
|
|
126
|
+
}) : /* @__PURE__ */ import_react3.default.createElement("div", {
|
|
127
|
+
role: "image",
|
|
128
|
+
className: "grid aspect-video place-items-center bg-inputSurface text-subdued"
|
|
129
|
+
}, /* @__PURE__ */ import_react3.default.createElement(import_react_ui3.Icon, {
|
|
130
|
+
icon: "ph--building-office--regular",
|
|
131
|
+
size: 10
|
|
132
|
+
})), /* @__PURE__ */ import_react3.default.createElement("h2", {
|
|
133
|
+
className: (0, import_react_ui_theme3.mx)(import_chunk_VFSOM2B4.previewTitle, import_chunk_VFSOM2B4.previewProse)
|
|
134
|
+
}, name), description && /* @__PURE__ */ import_react3.default.createElement("p", {
|
|
135
|
+
className: (0, import_react_ui_theme3.mx)(import_chunk_VFSOM2B4.previewProse, "line-clamp-2")
|
|
136
|
+
}, description), website && /* @__PURE__ */ import_react3.default.createElement("div", {
|
|
137
|
+
role: "none",
|
|
138
|
+
className: import_chunk_VFSOM2B4.previewChrome
|
|
139
|
+
}, /* @__PURE__ */ import_react3.default.createElement("a", {
|
|
140
|
+
className: "dx-button dx-focus-ring gap-2",
|
|
141
|
+
"data-variant": "ghost",
|
|
142
|
+
href: website,
|
|
143
|
+
target: "_blank",
|
|
144
|
+
rel: "noreferrer"
|
|
145
|
+
}, /* @__PURE__ */ import_react3.default.createElement(import_react_ui3.Icon, {
|
|
146
|
+
icon: "ph--link--regular",
|
|
147
|
+
size: 5,
|
|
148
|
+
classNames: "text-subdued"
|
|
149
|
+
}), /* @__PURE__ */ import_react3.default.createElement("span", {
|
|
150
|
+
className: "grow"
|
|
151
|
+
}, website), /* @__PURE__ */ import_react3.default.createElement(import_react_ui3.Icon, {
|
|
152
|
+
icon: "ph--arrow-square-out--regular"
|
|
153
|
+
}))), children);
|
|
154
|
+
} finally {
|
|
155
|
+
_effect.f();
|
|
156
|
+
}
|
|
157
|
+
};
|
|
158
|
+
var ProjectCard = ({ classNames, role, subject: { name, image, description } }) => {
|
|
159
|
+
var _effect = (0, import_tracking3.useSignals)();
|
|
160
|
+
try {
|
|
161
|
+
return /* @__PURE__ */ import_react4.default.createElement("div", {
|
|
162
|
+
role: "none",
|
|
163
|
+
className: (0, import_react_ui_theme4.mx)(role === "popover" ? import_chunk_VFSOM2B4.popoverCard : import_chunk_VFSOM2B4.defaultCard, classNames)
|
|
164
|
+
}, image && /* @__PURE__ */ import_react4.default.createElement("img", {
|
|
165
|
+
className: "is-full bs-auto",
|
|
166
|
+
src: image,
|
|
167
|
+
alt: name
|
|
168
|
+
}), /* @__PURE__ */ import_react4.default.createElement("h2", {
|
|
169
|
+
className: (0, import_react_ui_theme4.mx)(import_chunk_VFSOM2B4.previewTitle, "pli-3 mlb-3")
|
|
170
|
+
}, name), description && /* @__PURE__ */ import_react4.default.createElement("p", {
|
|
171
|
+
className: "pli-3 line-clamp-2 mlb-3"
|
|
172
|
+
}, description));
|
|
173
|
+
} finally {
|
|
174
|
+
_effect.f();
|
|
175
|
+
}
|
|
176
|
+
};
|
|
177
|
+
var react_surface_default = () => (0, import_app_framework.contributes)(import_app_framework.Capabilities.ReactSurface, [
|
|
178
|
+
//
|
|
179
|
+
// Specific schema types.
|
|
180
|
+
//
|
|
181
|
+
(0, import_app_framework.createSurface)({
|
|
182
|
+
id: `${import_chunk_VFSOM2B4.PREVIEW_PLUGIN}/schema-popover--contact`,
|
|
183
|
+
role: [
|
|
184
|
+
"popover",
|
|
185
|
+
"card--kanban",
|
|
186
|
+
"card"
|
|
187
|
+
],
|
|
188
|
+
filter: (data) => (0, import_echo_schema.isInstanceOf)(import_schema.DataType.Person, data.subject),
|
|
189
|
+
component: ({ data, role }) => {
|
|
190
|
+
const { dispatchPromise: dispatch } = (0, import_app_framework.useIntentDispatcher)();
|
|
191
|
+
const handleOrgClick = (0, import_react.useCallback)(async (org) => {
|
|
192
|
+
const space = (0, import_echo.getSpace)(org);
|
|
193
|
+
const tablesQuery = await space?.db.query(import_echo.Filter.type(import_react_ui_table.TableType)).run();
|
|
194
|
+
const currentSpaceOrgTable = tablesQuery?.objects.find((table) => {
|
|
195
|
+
return table.view?.target?.query?.typename === import_schema.DataType.Organization.typename;
|
|
196
|
+
});
|
|
197
|
+
await dispatch((0, import_app_framework.createIntent)(import_app_framework.LayoutAction.UpdatePopover, {
|
|
198
|
+
part: "popover",
|
|
199
|
+
options: {
|
|
200
|
+
state: false,
|
|
201
|
+
anchorId: ""
|
|
202
|
+
}
|
|
203
|
+
}));
|
|
204
|
+
if (currentSpaceOrgTable) {
|
|
205
|
+
return dispatch((0, import_app_framework.createIntent)(import_app_framework.LayoutAction.Open, {
|
|
206
|
+
part: "main",
|
|
207
|
+
subject: [
|
|
208
|
+
(0, import_echo.fullyQualifiedId)(currentSpaceOrgTable)
|
|
209
|
+
],
|
|
210
|
+
options: {
|
|
211
|
+
workspace: space?.id
|
|
212
|
+
}
|
|
213
|
+
}));
|
|
214
|
+
}
|
|
215
|
+
}, [
|
|
216
|
+
dispatch
|
|
217
|
+
]);
|
|
218
|
+
return /* @__PURE__ */ import_react.default.createElement(ContactCard, {
|
|
219
|
+
subject: data.subject,
|
|
220
|
+
onOrgClick: handleOrgClick,
|
|
221
|
+
role
|
|
222
|
+
}, role === "popover" && /* @__PURE__ */ import_react.default.createElement(import_app_framework.Surface, {
|
|
223
|
+
role: "related",
|
|
224
|
+
data
|
|
225
|
+
}));
|
|
226
|
+
}
|
|
227
|
+
}),
|
|
228
|
+
(0, import_app_framework.createSurface)({
|
|
229
|
+
id: `${import_chunk_VFSOM2B4.PREVIEW_PLUGIN}/schema-popover--organization`,
|
|
230
|
+
role: [
|
|
231
|
+
"popover",
|
|
232
|
+
"card--kanban",
|
|
233
|
+
"card"
|
|
234
|
+
],
|
|
235
|
+
filter: (data) => (0, import_echo_schema.isInstanceOf)(import_schema.DataType.Organization, data.subject),
|
|
236
|
+
component: ({ data, role }) => /* @__PURE__ */ import_react.default.createElement(OrganizationCard, {
|
|
237
|
+
subject: data.subject,
|
|
238
|
+
role
|
|
239
|
+
}, role === "popover" && /* @__PURE__ */ import_react.default.createElement(import_app_framework.Surface, {
|
|
240
|
+
role: "related",
|
|
241
|
+
data
|
|
242
|
+
}))
|
|
243
|
+
}),
|
|
244
|
+
(0, import_app_framework.createSurface)({
|
|
245
|
+
id: `${import_chunk_VFSOM2B4.PREVIEW_PLUGIN}/schema-popover--project`,
|
|
246
|
+
role: [
|
|
247
|
+
"popover",
|
|
248
|
+
"card--kanban",
|
|
249
|
+
"card"
|
|
250
|
+
],
|
|
251
|
+
filter: (data) => (0, import_echo_schema.isInstanceOf)(import_schema.DataType.Project, data.subject),
|
|
252
|
+
component: ({ data, role }) => /* @__PURE__ */ import_react.default.createElement(ProjectCard, {
|
|
253
|
+
subject: data.subject,
|
|
254
|
+
role
|
|
255
|
+
})
|
|
256
|
+
}),
|
|
257
|
+
//
|
|
258
|
+
// Fallback for any object.
|
|
259
|
+
//
|
|
260
|
+
(0, import_app_framework.createSurface)({
|
|
261
|
+
id: `${import_chunk_VFSOM2B4.PREVIEW_PLUGIN}/fallback-popover`,
|
|
262
|
+
role: [
|
|
263
|
+
"popover",
|
|
264
|
+
"card--kanban",
|
|
265
|
+
"card"
|
|
266
|
+
],
|
|
267
|
+
position: "fallback",
|
|
268
|
+
filter: (data) => (0, import_echo.isEchoObject)(data.subject),
|
|
269
|
+
component: ({ data, role }) => {
|
|
270
|
+
const schema = (0, import_echo.getSchema)(data.subject);
|
|
271
|
+
const { t } = (0, import_react_ui.useTranslation)(import_chunk_VFSOM2B4.PREVIEW_PLUGIN);
|
|
272
|
+
if (!schema) {
|
|
273
|
+
return /* @__PURE__ */ import_react.default.createElement("p", {
|
|
274
|
+
className: import_react_ui_theme.descriptionMessage
|
|
275
|
+
}, t("unable to create preview message"));
|
|
276
|
+
}
|
|
277
|
+
const handleSave = (0, import_react.useCallback)((values, { changed }) => {
|
|
278
|
+
const changedPaths = Object.keys(changed).filter((path) => changed[path]);
|
|
279
|
+
for (const path of changedPaths) {
|
|
280
|
+
const value = values[path];
|
|
281
|
+
(0, import_echo_schema.setValue)(data.subject, path, value);
|
|
282
|
+
}
|
|
283
|
+
}, []);
|
|
284
|
+
return /* @__PURE__ */ import_react.default.createElement(import_react_ui_form.Form, {
|
|
285
|
+
schema,
|
|
286
|
+
values: data.subject,
|
|
287
|
+
readonly: role === "popover",
|
|
288
|
+
onSave: handleSave,
|
|
289
|
+
autoSave: true,
|
|
290
|
+
...role === "card--kanban" && {
|
|
291
|
+
classNames: import_chunk_VFSOM2B4.kanbanCardWithoutPoster
|
|
292
|
+
}
|
|
293
|
+
});
|
|
294
|
+
}
|
|
295
|
+
})
|
|
296
|
+
]);
|
|
297
|
+
//# sourceMappingURL=react-surface-CPAQ7ZYR.cjs.map
|