@dxos/plugin-preview 0.8.4-main.fcfe5033a5 → 0.8.4-staging.60fe92afc8
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 +102 -5
- package/dist/lib/neutral/PreviewPlugin.mjs +9 -0
- package/dist/lib/neutral/PreviewPlugin.mjs.map +7 -0
- package/dist/lib/neutral/PreviewPlugin.node.mjs +17 -0
- package/dist/lib/neutral/PreviewPlugin.node.mjs.map +7 -0
- package/dist/lib/neutral/PreviewPlugin.workerd.mjs +17 -0
- package/dist/lib/neutral/PreviewPlugin.workerd.mjs.map +7 -0
- package/dist/lib/neutral/capabilities/index.mjs +9 -0
- package/dist/lib/neutral/capabilities/index.mjs.map +7 -0
- package/dist/lib/neutral/chunk-3SWUVHXJ.mjs +28 -0
- package/dist/lib/neutral/chunk-3SWUVHXJ.mjs.map +7 -0
- package/dist/lib/neutral/chunk-QOM5APM7.mjs +23 -0
- package/dist/lib/neutral/chunk-QOM5APM7.mjs.map +7 -0
- package/dist/lib/neutral/index.mjs +7 -0
- package/dist/lib/neutral/index.mjs.map +7 -0
- package/dist/lib/neutral/meta.json +1 -0
- package/dist/lib/neutral/meta.mjs +7 -0
- package/dist/lib/neutral/meta.mjs.map +7 -0
- package/dist/lib/neutral/plugin.mjs +11 -0
- package/dist/lib/neutral/plugin.mjs.map +7 -0
- package/dist/lib/neutral/preview-popover-FLMYMFCH.mjs +94 -0
- package/dist/lib/neutral/preview-popover-FLMYMFCH.mjs.map +7 -0
- package/dist/lib/neutral/react-surface-FE7E2JP7.mjs +418 -0
- package/dist/lib/neutral/react-surface-FE7E2JP7.mjs.map +7 -0
- package/dist/lib/neutral/testing.mjs +7 -0
- package/dist/lib/neutral/testing.mjs.map +7 -0
- package/dist/lib/neutral/translations.mjs +21 -0
- package/dist/lib/neutral/translations.mjs.map +7 -0
- package/dist/types/src/PreviewPlugin.d.ts +1 -0
- package/dist/types/src/PreviewPlugin.d.ts.map +1 -1
- package/dist/types/src/PreviewPlugin.node.d.ts +4 -0
- package/dist/types/src/PreviewPlugin.node.d.ts.map +1 -0
- package/dist/types/src/PreviewPlugin.test.d.ts +2 -0
- package/dist/types/src/PreviewPlugin.test.d.ts.map +1 -0
- package/dist/types/src/PreviewPlugin.workerd.d.ts +4 -0
- package/dist/types/src/PreviewPlugin.workerd.d.ts.map +1 -0
- package/dist/types/src/capabilities/preview-popover.d.ts.map +1 -1
- package/dist/types/src/capabilities/react-surface.d.ts.map +1 -1
- package/dist/types/src/cards/ExpandoCard.d.ts +4 -0
- package/dist/types/src/cards/ExpandoCard.d.ts.map +1 -0
- package/dist/types/src/cards/FormCard.d.ts +12 -2
- package/dist/types/src/cards/FormCard.d.ts.map +1 -1
- package/dist/types/src/cards/JsonCard.d.ts.map +1 -1
- package/dist/types/src/cards/OrganizationCard.d.ts.map +1 -1
- package/dist/types/src/cards/PersonCard.d.ts.map +1 -1
- package/dist/types/src/cards/ProjectCard.d.ts.map +1 -1
- package/dist/types/src/cards/TaskCard.d.ts.map +1 -1
- package/dist/types/src/cards/index.d.ts +1 -0
- package/dist/types/src/cards/index.d.ts.map +1 -1
- package/dist/types/src/index.d.ts +0 -1
- package/dist/types/src/index.d.ts.map +1 -1
- package/dist/types/src/meta.d.ts +1 -1
- package/dist/types/src/meta.d.ts.map +1 -1
- package/dist/types/src/plugin.d.ts +3 -0
- package/dist/types/src/plugin.d.ts.map +1 -0
- package/dist/types/src/stories/Card.stories.d.ts +31 -9
- package/dist/types/src/stories/Card.stories.d.ts.map +1 -1
- package/dist/types/src/stories/testing.d.ts +43 -4
- package/dist/types/src/stories/testing.d.ts.map +1 -1
- package/dist/types/src/testing.d.ts +2 -0
- package/dist/types/src/testing.d.ts.map +1 -0
- package/dist/types/src/translations.d.ts +8 -9
- package/dist/types/src/translations.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +70 -44
- package/src/PreviewPlugin.node.ts +16 -0
- package/src/PreviewPlugin.test.ts +25 -0
- package/src/PreviewPlugin.tsx +4 -3
- package/src/PreviewPlugin.workerd.ts +16 -0
- package/src/capabilities/preview-popover.ts +34 -6
- package/src/capabilities/react-surface.tsx +59 -18
- package/src/cards/ExpandoCard.tsx +76 -0
- package/src/cards/FormCard.tsx +102 -25
- package/src/cards/JsonCard.tsx +7 -4
- package/src/cards/OrganizationCard.tsx +2 -2
- package/src/cards/PersonCard.tsx +4 -4
- package/src/cards/ProjectCard.tsx +2 -2
- package/src/cards/TaskCard.tsx +4 -3
- package/src/cards/index.ts +1 -0
- package/src/index.ts +0 -2
- package/src/meta.ts +7 -4
- package/src/plugin.ts +9 -0
- package/src/stories/Card.stories.tsx +76 -6
- package/src/stories/testing.tsx +69 -7
- package/src/testing.ts +7 -0
- package/dist/lib/browser/index.mjs +0 -59
- package/dist/lib/browser/index.mjs.map +0 -7
- package/dist/lib/browser/meta.json +0 -1
- package/dist/lib/node-esm/index.mjs +0 -61
- package/dist/lib/node-esm/index.mjs.map +0 -7
- package/dist/lib/node-esm/meta.json +0 -1
package/LICENSE
CHANGED
|
@@ -1,8 +1,105 @@
|
|
|
1
|
-
|
|
2
|
-
Copyright (c) 2022 DXOS
|
|
1
|
+
# Functional Source License, Version 1.1, ALv2 Future License
|
|
3
2
|
|
|
4
|
-
|
|
3
|
+
## Abbreviation
|
|
5
4
|
|
|
6
|
-
|
|
5
|
+
FSL-1.1-Apache-2.0
|
|
7
6
|
|
|
8
|
-
|
|
7
|
+
## Notice
|
|
8
|
+
|
|
9
|
+
Copyright 2026 DXOS
|
|
10
|
+
|
|
11
|
+
## Terms and Conditions
|
|
12
|
+
|
|
13
|
+
### Licensor ("We")
|
|
14
|
+
|
|
15
|
+
The party offering the Software under these Terms and Conditions.
|
|
16
|
+
|
|
17
|
+
### The Software
|
|
18
|
+
|
|
19
|
+
The "Software" is each version of the software that we make available under
|
|
20
|
+
these Terms and Conditions, as indicated by our inclusion of these Terms and
|
|
21
|
+
Conditions with the Software.
|
|
22
|
+
|
|
23
|
+
### License Grant
|
|
24
|
+
|
|
25
|
+
Subject to your compliance with this License Grant and the Patents,
|
|
26
|
+
Redistribution and Trademark clauses below, we hereby grant you the right to
|
|
27
|
+
use, copy, modify, create derivative works, publicly perform, publicly display
|
|
28
|
+
and redistribute the Software for any Permitted Purpose identified below.
|
|
29
|
+
|
|
30
|
+
### Permitted Purpose
|
|
31
|
+
|
|
32
|
+
A Permitted Purpose is any purpose other than a Competing Use. A Competing Use
|
|
33
|
+
means making the Software available to others in a commercial product or
|
|
34
|
+
service that:
|
|
35
|
+
|
|
36
|
+
1. substitutes for the Software;
|
|
37
|
+
|
|
38
|
+
2. substitutes for any other product or service we offer using the Software
|
|
39
|
+
that exists as of the date we make the Software available; or
|
|
40
|
+
|
|
41
|
+
3. offers the same or substantially similar functionality as the Software.
|
|
42
|
+
|
|
43
|
+
Permitted Purposes specifically include using the Software:
|
|
44
|
+
|
|
45
|
+
1. for your internal use and access;
|
|
46
|
+
|
|
47
|
+
2. for non-commercial education;
|
|
48
|
+
|
|
49
|
+
3. for non-commercial research; and
|
|
50
|
+
|
|
51
|
+
4. in connection with professional services that you provide to a licensee
|
|
52
|
+
using the Software in accordance with these Terms and Conditions.
|
|
53
|
+
|
|
54
|
+
### Patents
|
|
55
|
+
|
|
56
|
+
To the extent your use for a Permitted Purpose would necessarily infringe our
|
|
57
|
+
patents, the license grant above includes a license under our patents. If you
|
|
58
|
+
make a claim against any party that the Software infringes or contributes to
|
|
59
|
+
the infringement of any patent, then your patent license to the Software ends
|
|
60
|
+
immediately.
|
|
61
|
+
|
|
62
|
+
### Redistribution
|
|
63
|
+
|
|
64
|
+
The Terms and Conditions apply to all copies, modifications and derivatives of
|
|
65
|
+
the Software.
|
|
66
|
+
|
|
67
|
+
If you redistribute any copies, modifications or derivatives of the Software,
|
|
68
|
+
you must include a copy of or a link to these Terms and Conditions and not
|
|
69
|
+
remove any copyright notices provided in or with the Software.
|
|
70
|
+
|
|
71
|
+
### Disclaimer
|
|
72
|
+
|
|
73
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND WITHOUT WARRANTIES OF ANY KIND, EXPRESS OR
|
|
74
|
+
IMPLIED, INCLUDING WITHOUT LIMITATION WARRANTIES OF FITNESS FOR A PARTICULAR
|
|
75
|
+
PURPOSE, MERCHANTABILITY, TITLE OR NON-INFRINGEMENT.
|
|
76
|
+
|
|
77
|
+
IN NO EVENT WILL WE HAVE ANY LIABILITY TO YOU ARISING OUT OF OR RELATED TO THE
|
|
78
|
+
SOFTWARE, INCLUDING INDIRECT, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES,
|
|
79
|
+
EVEN IF WE HAVE BEEN INFORMED OF THEIR POSSIBILITY IN ADVANCE.
|
|
80
|
+
|
|
81
|
+
### Trademarks
|
|
82
|
+
|
|
83
|
+
Except for displaying the License Details and identifying us as the origin of
|
|
84
|
+
the Software, you have no right under these Terms and Conditions to use our
|
|
85
|
+
trademarks, trade names, service marks or product names.
|
|
86
|
+
|
|
87
|
+
## Grant of Future License
|
|
88
|
+
|
|
89
|
+
We hereby irrevocably grant you an additional license to use the Software under
|
|
90
|
+
the Apache License, Version 2.0 that is effective on the second anniversary of
|
|
91
|
+
the date we make the Software available. On or after that date, you may use the
|
|
92
|
+
Software under the Apache License, Version 2.0, in which case the following
|
|
93
|
+
will apply:
|
|
94
|
+
|
|
95
|
+
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
|
|
96
|
+
this file except in compliance with the License.
|
|
97
|
+
|
|
98
|
+
You may obtain a copy of the License at
|
|
99
|
+
|
|
100
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
101
|
+
|
|
102
|
+
Unless required by applicable law or agreed to in writing, software distributed
|
|
103
|
+
under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
|
|
104
|
+
CONDITIONS OF ANY KIND, either express or implied. See the License for the
|
|
105
|
+
specific language governing permissions and limitations under the License.
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
// src/PreviewPlugin.node.ts
|
|
2
|
+
import { Plugin } from "@dxos/app-framework";
|
|
3
|
+
import { AppPlugin } from "@dxos/app-toolkit";
|
|
4
|
+
import { Organization, Person } from "@dxos/types";
|
|
5
|
+
import { meta } from "#meta";
|
|
6
|
+
var PreviewPlugin = Plugin.define(meta).pipe(AppPlugin.addSchemaModule({
|
|
7
|
+
schema: [
|
|
8
|
+
Person.Person,
|
|
9
|
+
Organization.Organization
|
|
10
|
+
]
|
|
11
|
+
}), Plugin.make);
|
|
12
|
+
var PreviewPlugin_node_default = PreviewPlugin;
|
|
13
|
+
export {
|
|
14
|
+
PreviewPlugin,
|
|
15
|
+
PreviewPlugin_node_default as default
|
|
16
|
+
};
|
|
17
|
+
//# sourceMappingURL=PreviewPlugin.node.mjs.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/PreviewPlugin.node.ts"],
|
|
4
|
+
"sourcesContent": ["//\n// Copyright 2023 DXOS.org\n//\n\nimport { Plugin } from '@dxos/app-framework';\nimport { AppPlugin } from '@dxos/app-toolkit';\nimport { Organization, Person } from '@dxos/types';\n\nimport { meta } from '#meta';\n\nexport const PreviewPlugin = Plugin.define(meta).pipe(\n AppPlugin.addSchemaModule({ schema: [Person.Person, Organization.Organization] }),\n Plugin.make,\n);\n\nexport default PreviewPlugin;\n"],
|
|
5
|
+
"mappings": ";AAIA,SAASA,cAAc;AACvB,SAASC,iBAAiB;AAC1B,SAASC,cAAcC,cAAc;AAErC,SAASC,YAAY;AAEd,IAAMC,gBAAgBL,OAAOM,OAAOF,IAAAA,EAAMG,KAC/CN,UAAUO,gBAAgB;EAAEC,QAAQ;IAACN,OAAOA;IAAQD,aAAaA;;AAAc,CAAA,GAC/EF,OAAOU,IAAI;AAGb,IAAA,6BAAeL;",
|
|
6
|
+
"names": ["Plugin", "AppPlugin", "Organization", "Person", "meta", "PreviewPlugin", "define", "pipe", "addSchemaModule", "schema", "make"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
// src/PreviewPlugin.workerd.ts
|
|
2
|
+
import { Plugin } from "@dxos/app-framework";
|
|
3
|
+
import { AppPlugin } from "@dxos/app-toolkit";
|
|
4
|
+
import { Organization, Person } from "@dxos/types";
|
|
5
|
+
import { meta } from "#meta";
|
|
6
|
+
var PreviewPlugin = Plugin.define(meta).pipe(AppPlugin.addSchemaModule({
|
|
7
|
+
schema: [
|
|
8
|
+
Person.Person,
|
|
9
|
+
Organization.Organization
|
|
10
|
+
]
|
|
11
|
+
}), Plugin.make);
|
|
12
|
+
var PreviewPlugin_workerd_default = PreviewPlugin;
|
|
13
|
+
export {
|
|
14
|
+
PreviewPlugin,
|
|
15
|
+
PreviewPlugin_workerd_default as default
|
|
16
|
+
};
|
|
17
|
+
//# sourceMappingURL=PreviewPlugin.workerd.mjs.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/PreviewPlugin.workerd.ts"],
|
|
4
|
+
"sourcesContent": ["//\n// Copyright 2023 DXOS.org\n//\n\nimport { Plugin } from '@dxos/app-framework';\nimport { AppPlugin } from '@dxos/app-toolkit';\nimport { Organization, Person } from '@dxos/types';\n\nimport { meta } from '#meta';\n\nexport const PreviewPlugin = Plugin.define(meta).pipe(\n AppPlugin.addSchemaModule({ schema: [Person.Person, Organization.Organization] }),\n Plugin.make,\n);\n\nexport default PreviewPlugin;\n"],
|
|
5
|
+
"mappings": ";AAIA,SAASA,cAAc;AACvB,SAASC,iBAAiB;AAC1B,SAASC,cAAcC,cAAc;AAErC,SAASC,YAAY;AAEd,IAAMC,gBAAgBL,OAAOM,OAAOF,IAAAA,EAAMG,KAC/CN,UAAUO,gBAAgB;EAAEC,QAAQ;IAACN,OAAOA;IAAQD,aAAaA;;AAAc,CAAA,GAC/EF,OAAOU,IAAI;AAGb,IAAA,gCAAeL;",
|
|
6
|
+
"names": ["Plugin", "AppPlugin", "Organization", "Person", "meta", "PreviewPlugin", "define", "pipe", "addSchemaModule", "schema", "make"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
// src/capabilities/index.ts
|
|
2
|
+
import { Capability } from "@dxos/app-framework";
|
|
3
|
+
var PreviewPopover = Capability.lazy("PreviewPopover", () => import("../preview-popover-FLMYMFCH.mjs"));
|
|
4
|
+
var ReactSurface = Capability.lazy("ReactSurface", () => import("../react-surface-FE7E2JP7.mjs"));
|
|
5
|
+
export {
|
|
6
|
+
PreviewPopover,
|
|
7
|
+
ReactSurface
|
|
8
|
+
};
|
|
9
|
+
//# sourceMappingURL=index.mjs.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../src/capabilities/index.ts"],
|
|
4
|
+
"sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport { Capability } from '@dxos/app-framework';\n\nexport const PreviewPopover = Capability.lazy('PreviewPopover', () => import('./preview-popover'));\nexport const ReactSurface = Capability.lazy('ReactSurface', () => import('./react-surface'));\n"],
|
|
5
|
+
"mappings": ";AAIA,SAASA,kBAAkB;AAEpB,IAAMC,iBAAiBD,WAAWE,KAAK,kBAAkB,MAAM,OAAO,iCAAA,CAAA;AACtE,IAAMC,eAAeH,WAAWE,KAAK,gBAAgB,MAAM,OAAO,+BAAA,CAAA;",
|
|
6
|
+
"names": ["Capability", "PreviewPopover", "lazy", "ReactSurface"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
// src/PreviewPlugin.tsx
|
|
2
|
+
import { ActivationEvents, Plugin } from "@dxos/app-framework";
|
|
3
|
+
import { AppPlugin } from "@dxos/app-toolkit";
|
|
4
|
+
import { Organization, Person } from "@dxos/types";
|
|
5
|
+
import { PreviewPopover, ReactSurface } from "#capabilities";
|
|
6
|
+
import { meta } from "#meta";
|
|
7
|
+
import { translations } from "#translations";
|
|
8
|
+
var PreviewPlugin = Plugin.define(meta).pipe(AppPlugin.addSchemaModule({
|
|
9
|
+
schema: [
|
|
10
|
+
Person.Person,
|
|
11
|
+
Organization.Organization
|
|
12
|
+
]
|
|
13
|
+
}), AppPlugin.addSurfaceModule({
|
|
14
|
+
activate: ReactSurface
|
|
15
|
+
}), AppPlugin.addTranslationsModule({
|
|
16
|
+
translations
|
|
17
|
+
}), Plugin.addModule({
|
|
18
|
+
id: "preview-popover",
|
|
19
|
+
activatesOn: ActivationEvents.Startup,
|
|
20
|
+
activate: PreviewPopover
|
|
21
|
+
}), Plugin.make);
|
|
22
|
+
var PreviewPlugin_default = PreviewPlugin;
|
|
23
|
+
|
|
24
|
+
export {
|
|
25
|
+
PreviewPlugin,
|
|
26
|
+
PreviewPlugin_default
|
|
27
|
+
};
|
|
28
|
+
//# sourceMappingURL=chunk-3SWUVHXJ.mjs.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/PreviewPlugin.tsx"],
|
|
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] }),\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\nexport default PreviewPlugin;\n"],
|
|
5
|
+
"mappings": ";AAIA,SAASA,kBAAkBC,cAAc;AACzC,SAASC,iBAAiB;AAC1B,SAASC,cAAcC,cAAc;AAErC,SAASC,gBAAgBC,oBAAoB;AAC7C,SAASC,YAAY;AACrB,SAASC,oBAAoB;AAEtB,IAAMC,gBAAgBR,OAAOS,OAAOH,IAAAA,EAAMI,KAC/CT,UAAUU,gBAAgB;EAAEC,QAAQ;IAACT,OAAOA;IAAQD,aAAaA;;AAAc,CAAA,GAC/ED,UAAUY,iBAAiB;EAAEC,UAAUT;AAAa,CAAA,GACpDJ,UAAUc,sBAAsB;EAAER;AAAa,CAAA,GAC/CP,OAAOgB,UAAU;EACfC,IAAI;EACJC,aAAanB,iBAAiBoB;EAC9BL,UAAUV;AACZ,CAAA,GACAJ,OAAOoB,IAAI;AAGb,IAAA,wBAAeZ;",
|
|
6
|
+
"names": ["ActivationEvents", "Plugin", "AppPlugin", "Organization", "Person", "PreviewPopover", "ReactSurface", "meta", "translations", "PreviewPlugin", "define", "pipe", "addSchemaModule", "schema", "addSurfaceModule", "activate", "addTranslationsModule", "addModule", "id", "activatesOn", "Startup", "make"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
// src/meta.ts
|
|
2
|
+
import { Plugin } from "@dxos/app-framework";
|
|
3
|
+
import { DXN } from "@dxos/keys";
|
|
4
|
+
import { trim } from "@dxos/util";
|
|
5
|
+
var meta = Plugin.makeMeta({
|
|
6
|
+
key: DXN.make("org.dxos.plugin.preview"),
|
|
7
|
+
name: "Preview",
|
|
8
|
+
author: "DXOS",
|
|
9
|
+
description: trim`
|
|
10
|
+
Rich preview panel for viewing object content without opening full editors.
|
|
11
|
+
Quick peek at documents, images, and data with inline rendering.
|
|
12
|
+
`,
|
|
13
|
+
icon: "ph--eye--regular",
|
|
14
|
+
source: "https://github.com/dxos/dxos/tree/main/packages/plugins/plugin-preview",
|
|
15
|
+
tags: [
|
|
16
|
+
"system"
|
|
17
|
+
]
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
export {
|
|
21
|
+
meta
|
|
22
|
+
};
|
|
23
|
+
//# sourceMappingURL=chunk-QOM5APM7.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 { Plugin } from '@dxos/app-framework';\nimport { DXN } from '@dxos/keys';\nimport { trim } from '@dxos/util';\n\nexport const meta = Plugin.makeMeta({\n key: DXN.make('org.dxos.plugin.preview'),\n name: 'Preview',\n author: 'DXOS',\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 tags: ['system'],\n});\n"],
|
|
5
|
+
"mappings": ";AAIA,SAASA,cAAc;AACvB,SAASC,WAAW;AACpB,SAASC,YAAY;AAEd,IAAMC,OAAOH,OAAOI,SAAS;EAClCC,KAAKJ,IAAIK,KAAK,yBAAA;EACdC,MAAM;EACNC,QAAQ;EACRC,aAAaP;;;;EAIbQ,MAAM;EACNC,QAAQ;EACRC,MAAM;IAAC;;AACT,CAAA;",
|
|
6
|
+
"names": ["Plugin", "DXN", "trim", "meta", "makeMeta", "key", "make", "name", "author", "description", "icon", "source", "tags"]
|
|
7
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"inputs":{"src/meta.ts":{"bytes":2096,"imports":[{"path":"@dxos/app-framework","kind":"import-statement","external":true},{"path":"@dxos/keys","kind":"import-statement","external":true},{"path":"@dxos/util","kind":"import-statement","external":true}],"format":"esm"},"src/index.ts":{"bytes":368,"imports":[{"path":"src/meta.ts","kind":"import-statement","original":"./meta"}],"format":"esm"},"src/PreviewPlugin.tsx":{"bytes":3129,"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":"#capabilities","kind":"import-statement","external":true},{"path":"#meta","kind":"import-statement","external":true},{"path":"#translations","kind":"import-statement","external":true}],"format":"esm"},"src/PreviewPlugin.node.ts":{"bytes":1738,"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":"#meta","kind":"import-statement","external":true}],"format":"esm"},"src/PreviewPlugin.workerd.ts":{"bytes":1742,"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":"#meta","kind":"import-statement","external":true}],"format":"esm"},"src/capabilities/preview-popover.ts":{"bytes":14777,"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/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/cards/ExpandoCard.tsx":{"bytes":8147,"imports":[{"path":"effect/Schema","kind":"import-statement","external":true},{"path":"react","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}],"format":"esm"},"src/cards/FormCard.tsx":{"bytes":14994,"imports":[{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/echo","kind":"import-statement","external":true},{"path":"@dxos/echo-react","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":"#meta","kind":"import-statement","external":true}],"format":"esm"},"src/cards/JsonCard.tsx":{"bytes":1589,"imports":[{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/react-ui","kind":"import-statement","external":true},{"path":"@dxos/react-ui-syntax-highlighter","kind":"import-statement","external":true}],"format":"esm"},"src/cards/OrganizationCard.tsx":{"bytes":2939,"imports":[{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/react-ui","kind":"import-statement","external":true}],"format":"esm"},"src/cards/PersonCard.tsx":{"bytes":7865,"imports":[{"path":"effect/Effect","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","kind":"import-statement","external":true}],"format":"esm"},"src/cards/ProjectCard.tsx":{"bytes":2313,"imports":[{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/echo","kind":"import-statement","external":true},{"path":"@dxos/react-ui","kind":"import-statement","external":true}],"format":"esm"},"src/cards/TaskCard.tsx":{"bytes":5515,"imports":[{"path":"effect/SchemaAST","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/echo","kind":"import-statement","external":true},{"path":"@dxos/echo/internal","kind":"import-statement","external":true},{"path":"@dxos/react-ui","kind":"import-statement","external":true},{"path":"@dxos/types","kind":"import-statement","external":true}],"format":"esm"},"src/cards/index.ts":{"bytes":948,"imports":[{"path":"src/cards/ExpandoCard.tsx","kind":"import-statement","original":"./ExpandoCard"},{"path":"src/cards/FormCard.tsx","kind":"import-statement","original":"./FormCard"},{"path":"src/cards/JsonCard.tsx","kind":"import-statement","original":"./JsonCard"},{"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.tsx":{"bytes":18734,"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/app-toolkit/ui","kind":"import-statement","external":true},{"path":"@dxos/echo","kind":"import-statement","external":true},{"path":"@dxos/react-ui","kind":"import-statement","external":true},{"path":"@dxos/schema","kind":"import-statement","external":true},{"path":"@dxos/types","kind":"import-statement","external":true},{"path":"src/cards/index.ts","kind":"import-statement","original":"../cards"}],"format":"esm"},"src/capabilities/index.ts":{"bytes":1152,"imports":[{"path":"@dxos/app-framework","kind":"import-statement","external":true},{"path":"src/capabilities/preview-popover.ts","kind":"dynamic-import","original":"./preview-popover"},{"path":"src/capabilities/react-surface.tsx","kind":"dynamic-import","original":"./react-surface"}],"format":"esm"},"src/plugin.ts":{"bytes":860,"imports":[{"path":"@dxos/app-framework","kind":"import-statement","external":true},{"path":"src/meta.ts","kind":"import-statement","original":"./meta"},{"path":"#plugin","kind":"dynamic-import","external":true}],"format":"esm"},"src/testing.ts":{"bytes":665,"imports":[{"path":"src/PreviewPlugin.tsx","kind":"import-statement","original":"./PreviewPlugin"}],"format":"esm"},"src/translations.ts":{"bytes":1809,"imports":[{"path":"#meta","kind":"import-statement","external":true}],"format":"esm"}},"outputs":{"dist/lib/neutral/translations.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":888},"dist/lib/neutral/translations.mjs":{"imports":[{"path":"#meta","kind":"import-statement","external":true}],"exports":["translations"],"entryPoint":"src/translations.ts","inputs":{"src/translations.ts":{"bytesInOutput":408}},"bytes":500},"dist/lib/neutral/preview-popover-FLMYMFCH.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":6763},"dist/lib/neutral/preview-popover-FLMYMFCH.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/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.ts","inputs":{"src/capabilities/preview-popover.ts":{"bytesInOutput":2951}},"bytes":3093},"dist/lib/neutral/react-surface-FE7E2JP7.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":31564},"dist/lib/neutral/react-surface-FE7E2JP7.mjs":{"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/app-toolkit/ui","kind":"import-statement","external":true},{"path":"@dxos/echo","kind":"import-statement","external":true},{"path":"@dxos/react-ui","kind":"import-statement","external":true},{"path":"@dxos/schema","kind":"import-statement","external":true},{"path":"@dxos/types","kind":"import-statement","external":true},{"path":"effect/Schema","kind":"import-statement","external":true},{"path":"react","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":"react","kind":"import-statement","external":true},{"path":"@dxos/echo","kind":"import-statement","external":true},{"path":"@dxos/echo-react","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":"#meta","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-syntax-highlighter","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/react-ui","kind":"import-statement","external":true},{"path":"effect/Effect","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","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/echo","kind":"import-statement","external":true},{"path":"@dxos/react-ui","kind":"import-statement","external":true},{"path":"effect/SchemaAST","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/echo","kind":"import-statement","external":true},{"path":"@dxos/echo/internal","kind":"import-statement","external":true},{"path":"@dxos/react-ui","kind":"import-statement","external":true},{"path":"@dxos/types","kind":"import-statement","external":true}],"exports":["default"],"entryPoint":"src/capabilities/react-surface.tsx","inputs":{"src/capabilities/react-surface.tsx":{"bytesInOutput":4659},"src/cards/ExpandoCard.tsx":{"bytesInOutput":1788},"src/cards/index.ts":{"bytesInOutput":0},"src/cards/FormCard.tsx":{"bytesInOutput":2991},"src/cards/JsonCard.tsx":{"bytesInOutput":419},"src/cards/OrganizationCard.tsx":{"bytesInOutput":724},"src/cards/PersonCard.tsx":{"bytesInOutput":2060},"src/cards/ProjectCard.tsx":{"bytesInOutput":514},"src/cards/TaskCard.tsx":{"bytesInOutput":1125}},"bytes":14661},"dist/lib/neutral/index.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":93},"dist/lib/neutral/index.mjs":{"imports":[{"path":"dist/lib/neutral/chunk-QOM5APM7.mjs","kind":"import-statement"}],"exports":["meta"],"entryPoint":"src/index.ts","inputs":{"src/index.ts":{"bytesInOutput":0}},"bytes":101},"dist/lib/neutral/PreviewPlugin.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":93},"dist/lib/neutral/PreviewPlugin.mjs":{"imports":[{"path":"dist/lib/neutral/chunk-3SWUVHXJ.mjs","kind":"import-statement"}],"exports":["PreviewPlugin","default"],"entryPoint":"src/PreviewPlugin.tsx","inputs":{},"bytes":188},"dist/lib/neutral/PreviewPlugin.node.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":894},"dist/lib/neutral/PreviewPlugin.node.mjs":{"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":"#meta","kind":"import-statement","external":true}],"exports":["PreviewPlugin","default"],"entryPoint":"src/PreviewPlugin.node.ts","inputs":{"src/PreviewPlugin.node.ts":{"bytesInOutput":379}},"bytes":525},"dist/lib/neutral/PreviewPlugin.workerd.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":897},"dist/lib/neutral/PreviewPlugin.workerd.mjs":{"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":"#meta","kind":"import-statement","external":true}],"exports":["PreviewPlugin","default"],"entryPoint":"src/PreviewPlugin.workerd.ts","inputs":{"src/PreviewPlugin.workerd.ts":{"bytesInOutput":382}},"bytes":537},"dist/lib/neutral/capabilities/index.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":610},"dist/lib/neutral/capabilities/index.mjs":{"imports":[{"path":"@dxos/app-framework","kind":"import-statement","external":true},{"path":"dist/lib/neutral/preview-popover-FLMYMFCH.mjs","kind":"dynamic-import"},{"path":"dist/lib/neutral/react-surface-FE7E2JP7.mjs","kind":"dynamic-import"}],"exports":["PreviewPopover","ReactSurface"],"entryPoint":"src/capabilities/index.ts","inputs":{"src/capabilities/index.ts":{"bytesInOutput":254}},"bytes":363},"dist/lib/neutral/meta.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":93},"dist/lib/neutral/meta.mjs":{"imports":[{"path":"dist/lib/neutral/chunk-QOM5APM7.mjs","kind":"import-statement"}],"exports":["meta"],"entryPoint":"src/meta.ts","inputs":{},"bytes":100},"dist/lib/neutral/plugin.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":443},"dist/lib/neutral/plugin.mjs":{"imports":[{"path":"dist/lib/neutral/chunk-QOM5APM7.mjs","kind":"import-statement"},{"path":"@dxos/app-framework","kind":"import-statement","external":true},{"path":"#plugin","kind":"dynamic-import","external":true}],"exports":["PreviewPlugin"],"entryPoint":"src/plugin.ts","inputs":{"src/plugin.ts":{"bytesInOutput":110}},"bytes":239},"dist/lib/neutral/chunk-QOM5APM7.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":1029},"dist/lib/neutral/chunk-QOM5APM7.mjs":{"imports":[{"path":"@dxos/app-framework","kind":"import-statement","external":true},{"path":"@dxos/keys","kind":"import-statement","external":true},{"path":"@dxos/util","kind":"import-statement","external":true}],"exports":["meta"],"inputs":{"src/meta.ts":{"bytesInOutput":543}},"bytes":622},"dist/lib/neutral/testing.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":93},"dist/lib/neutral/testing.mjs":{"imports":[{"path":"dist/lib/neutral/chunk-3SWUVHXJ.mjs","kind":"import-statement"}],"exports":["PreviewPlugin"],"entryPoint":"src/testing.ts","inputs":{"src/testing.ts":{"bytesInOutput":0}},"bytes":121},"dist/lib/neutral/chunk-3SWUVHXJ.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":1643},"dist/lib/neutral/chunk-3SWUVHXJ.mjs":{"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":"#capabilities","kind":"import-statement","external":true},{"path":"#meta","kind":"import-statement","external":true},{"path":"#translations","kind":"import-statement","external":true}],"exports":["PreviewPlugin","PreviewPlugin_default"],"inputs":{"src/PreviewPlugin.tsx":{"bytesInOutput":727}},"bytes":850}}}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/plugin.ts"],
|
|
4
|
+
"sourcesContent": ["//\n// Copyright 2023 DXOS.org\n//\n\nimport { Plugin } from '@dxos/app-framework';\n\nimport { meta } from './meta';\n\nexport const PreviewPlugin = Plugin.lazy(meta, () => import('#plugin'));\n"],
|
|
5
|
+
"mappings": ";;;;;AAIA,SAASA,cAAc;AAIhB,IAAMC,gBAAgBC,OAAOC,KAAKC,MAAM,MAAM,OAAO,SAAA,CAAA;",
|
|
6
|
+
"names": ["Plugin", "PreviewPlugin", "Plugin", "lazy", "meta"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
// src/capabilities/preview-popover.ts
|
|
2
|
+
import * as Effect from "effect/Effect";
|
|
3
|
+
import { Capabilities, Capability } from "@dxos/app-framework";
|
|
4
|
+
import { AppCapabilities, LayoutOperation, getPersonalSpace, getSpaceIdFromPath } from "@dxos/app-toolkit";
|
|
5
|
+
import { addEventListener } from "@dxos/async";
|
|
6
|
+
import { Obj } from "@dxos/echo";
|
|
7
|
+
import { EID } from "@dxos/keys";
|
|
8
|
+
import { log } from "@dxos/log";
|
|
9
|
+
import { ClientCapabilities } from "@dxos/plugin-client";
|
|
10
|
+
import { DX_ANCHOR_ACTIVATE } from "@dxos/react-ui";
|
|
11
|
+
var __dxlog_file = "/__w/dxos/dxos/packages/plugins/plugin-preview/src/capabilities/preview-popover.ts";
|
|
12
|
+
var customEventOptions = {
|
|
13
|
+
capture: true,
|
|
14
|
+
passive: false
|
|
15
|
+
};
|
|
16
|
+
var handlePreviewLookup = async (client, defaultSpace, { dxn, label }) => {
|
|
17
|
+
try {
|
|
18
|
+
const object = await defaultSpace.db.makeRef(EID.parse(dxn)).load();
|
|
19
|
+
return {
|
|
20
|
+
label,
|
|
21
|
+
object
|
|
22
|
+
};
|
|
23
|
+
} catch {
|
|
24
|
+
return null;
|
|
25
|
+
}
|
|
26
|
+
};
|
|
27
|
+
var preview_popover_default = Capability.makeModule(Effect.fnUntraced(function* () {
|
|
28
|
+
const capabilities = yield* Capability.Service;
|
|
29
|
+
let activationSequence = 0;
|
|
30
|
+
const handleAnchorActivate = async ({ dxn, label, trigger, kind = "card", title: titleProp, side, props, state }) => {
|
|
31
|
+
const sequence = ++activationSequence;
|
|
32
|
+
const { invokePromise } = capabilities.get(Capabilities.OperationInvoker);
|
|
33
|
+
if (state === false) {
|
|
34
|
+
await invokePromise(LayoutOperation.UpdatePopover, {
|
|
35
|
+
variant: "virtual",
|
|
36
|
+
anchor: trigger,
|
|
37
|
+
kind: "base",
|
|
38
|
+
state: false
|
|
39
|
+
});
|
|
40
|
+
return;
|
|
41
|
+
}
|
|
42
|
+
const client = capabilities.get(ClientCapabilities.Client);
|
|
43
|
+
const registry = capabilities.get(Capabilities.AtomRegistry);
|
|
44
|
+
const [layoutAtom] = capabilities.getAll(AppCapabilities.Layout);
|
|
45
|
+
const spaceId = layoutAtom && getSpaceIdFromPath(registry.get(layoutAtom).workspace);
|
|
46
|
+
const space = (spaceId && client.spaces.get(spaceId)) ?? getPersonalSpace(client);
|
|
47
|
+
if (!space) {
|
|
48
|
+
return;
|
|
49
|
+
}
|
|
50
|
+
const result = await handlePreviewLookup(client, space, {
|
|
51
|
+
dxn,
|
|
52
|
+
label
|
|
53
|
+
});
|
|
54
|
+
if (!result) {
|
|
55
|
+
return;
|
|
56
|
+
}
|
|
57
|
+
if (sequence !== activationSequence) {
|
|
58
|
+
return;
|
|
59
|
+
}
|
|
60
|
+
const title = titleProp ?? Obj.getLabel(result.object, {
|
|
61
|
+
fallback: "typename"
|
|
62
|
+
});
|
|
63
|
+
await invokePromise(LayoutOperation.UpdatePopover, {
|
|
64
|
+
subjectRef: dxn,
|
|
65
|
+
subject: result.object,
|
|
66
|
+
state: true,
|
|
67
|
+
variant: "virtual",
|
|
68
|
+
anchor: trigger,
|
|
69
|
+
...kind && {
|
|
70
|
+
kind
|
|
71
|
+
},
|
|
72
|
+
...title && {
|
|
73
|
+
title
|
|
74
|
+
},
|
|
75
|
+
...side && {
|
|
76
|
+
side
|
|
77
|
+
},
|
|
78
|
+
...props && {
|
|
79
|
+
props
|
|
80
|
+
}
|
|
81
|
+
});
|
|
82
|
+
};
|
|
83
|
+
let cleanup;
|
|
84
|
+
if (document.defaultView) {
|
|
85
|
+
cleanup = addEventListener(document.defaultView, DX_ANCHOR_ACTIVATE, handleAnchorActivate, customEventOptions);
|
|
86
|
+
} else {
|
|
87
|
+
log.warn("no default view found", void 0, { "~LogMeta": "~LogMeta", F: __dxlog_file, L: 102, S: this });
|
|
88
|
+
}
|
|
89
|
+
return Capability.contributes(Capabilities.Null, null, () => Effect.sync(() => cleanup?.()));
|
|
90
|
+
}));
|
|
91
|
+
export {
|
|
92
|
+
preview_popover_default as default
|
|
93
|
+
};
|
|
94
|
+
//# sourceMappingURL=preview-popover-FLMYMFCH.mjs.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/capabilities/preview-popover.ts"],
|
|
4
|
+
"sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport * as Effect from 'effect/Effect';\n\nimport { Capabilities, Capability } from '@dxos/app-framework';\nimport { AppCapabilities, LayoutOperation, getPersonalSpace, getSpaceIdFromPath } from '@dxos/app-toolkit';\nimport { addEventListener } from '@dxos/async';\nimport { type Client } from '@dxos/client';\nimport { type Space } from '@dxos/client/echo';\nimport { Obj } from '@dxos/echo';\nimport { EID } 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(EID.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 // Monotonic activation token: each invocation captures its own sequence; only the\n // most recent activation is allowed to commit popover state. Prevents a slow\n // open (async lookup) from clobbering a later close that fires while it's in flight.\n let activationSequence = 0;\n const handleAnchorActivate = async ({\n dxn,\n label,\n trigger,\n kind = 'card',\n title: titleProp,\n side,\n props,\n state,\n }: DxAnchorActivate) => {\n const sequence = ++activationSequence;\n const { invokePromise } = capabilities.get(Capabilities.OperationInvoker);\n\n // Explicit close: callers pass `state: false` on pointer-leave to dismiss\n // the popover. Operation schema requires anchor + kind, so use placeholders;\n // they're overwritten in ephemeral state but only `state` is read by the UI.\n if (state === false) {\n await invokePromise(LayoutOperation.UpdatePopover, {\n variant: 'virtual',\n anchor: trigger,\n kind: 'base',\n state: false,\n });\n return;\n }\n\n const client = capabilities.get(ClientCapabilities.Client);\n const registry = capabilities.get(Capabilities.AtomRegistry);\n // Layout is optional: in standalone harnesses (Storybook, tests) no plugin contributes\n // `AppCapabilities.Layout`, and `getAll` returns an empty array. Reading `registry.get(undefined)`\n // would crash inside Atom's identity check (`'~atom/Serializable' in undefined`). When layout\n // isn't available, fall through to the personal-space default.\n const [layoutAtom] = capabilities.getAll(AppCapabilities.Layout);\n const spaceId = layoutAtom && getSpaceIdFromPath(registry.get(layoutAtom).workspace);\n const space = (spaceId && client.spaces.get(spaceId)) ?? getPersonalSpace(client);\n if (!space) {\n return;\n }\n const result = await handlePreviewLookup(client, space, { dxn, label });\n if (!result) {\n return;\n }\n // A newer activation (open or close) arrived while the lookup was in flight; bail\n // out so we don't clobber the latest state.\n if (sequence !== activationSequence) {\n return;\n }\n\n const title = titleProp ?? Obj.getLabel(result.object, { fallback: 'typename' });\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,iBAAiBC,kBAAkBC,0BAA0B;AACvF,SAASC,wBAAwB;AAGjC,SAASC,WAAW;AACpB,SAASC,WAAW;AACpB,SAASC,WAAW;AACpB,SAASC,0BAA0B;AACnC,SAASC,0BAAiD;AAG1D,IAAA,eAAMC;IAAsCC,qBAAS;EAAM,SAAA;EAE3D,SAAMC;;0BAMa,OAAMC,QAAaC,cAAeC,EAAAA,KAAMC,MAAMC,MAAI;MACjE;UAASC,SAAAA,MAAAA,aAAAA,GAAAA,QAAAA,IAAAA,MAAAA,GAAAA,CAAAA,EAAAA,KAAAA;WAAOC;MAAO;MACvB;IACA;EACF,QAAA;AACF,WAAA;EAEA;;IAGI,0BAAMC,WAAe,WAAkBC,kBAAO,aAAA;AAG9C,QAAA,eAAA,OAAA,WAAA;MAcE,qBAAmBC;QACnB,uBAAuB,OAAGF,EAAAA,KAAaG,OAAIzB,SAAAA,OAAa0B,QAAAA,OAAgB,WAAA,MAAA,OAAA,MAAA,MAAA;AAExE,UAAA,WAAA,EAAA;AACA,UAAA,EAAA,cAAA,IAAA,aAAA,IAAA,aAAA,gBAAA;kBAIIC,OAAS;YACTC,cAAQC,gBAAAA,eAAAA;QACRC,SAAM;QACNC,QAAO;QACT,MAAA;QACA,OAAA;MACF,CAAA;AAEA;IACA;AACA,UAAA,SAAA,aAAA,IAAA,mBAAA,MAAA;AACA,UAAA,WAAA,aAAA,IAAA,aAAA,YAAA;AAKA,UAAMC,CAAAA,UAASC,IAAAA,aAAkBC,OAAOT,gBAAiBrB,MAAAA;AACzD,UAAK4B,UAAO,cAAA,mBAAA,SAAA,IAAA,UAAA,EAAA,SAAA;UACV,SAAA,WAAA,OAAA,OAAA,IAAA,OAAA,MAAA,iBAAA,MAAA;AACF,QAAA,CAAA,OAAA;AACA;;UAA+DZ,SAAAA,MAAAA,oBAAAA,QAAAA,OAAAA;MAAM;MACjE;;AAEJ,QAAA,CAAA,QAAA;AACA;IACA;AAGA,QAAA,aAAA,oBAAA;AAEA;;AAA8E,UAAA,QAAA,aAAA,IAAA,SAAA,OAAA,QAAA;MAE9E,UAAMe;;UAEJC,cAAgBf,gBAAM,eAAA;MACtBU,YAAO;MACPJ,SAAS,OAAA;MACTC,OAAAA;MACA,SAAIE;cAAUA;MAAK,GAAC,QAAA;QAChBO;;MAAiB,GAAC,SAAA;QAClBC;;MAAe,GAAC,QAAA;QAChBC;;MAAiB,GAAC,SAAA;QACxB;MACF;IAEIC,CAAAA;EACJ;MACEA;AAMF,MAAA,SAAO,aAAA;AACL/B,cAAS,iBAAA,SAAA,aAAA,oBAAA,sBAAA,kBAAA;EACX,OAAA;AAEA,QAAOR,KAAAA,yBAAuBD,QAAayC,EAAAA,YAAY,YAAaC,GAAAA,cAAWF,GAAAA,KAAAA,GAAAA,KAAAA,CAAAA;EAEjF;;;",
|
|
6
|
+
"names": ["Effect", "Capabilities", "Capability", "AppCapabilities", "LayoutOperation", "getPersonalSpace", "getSpaceIdFromPath", "addEventListener", "Obj", "EID", "log", "ClientCapabilities", "DX_ANCHOR_ACTIVATE", "customEventOptions", "passive", "handlePreviewLookup", "defaultSpace", "db", "parse", "dxn", "load", "label", "object", "capabilities", "Service", "activationSequence", "get", "OperationInvoker", "variant", "anchor", "trigger", "kind", "state", "space", "spaceId", "spaces", "invokePromise", "subject", "title", "side", "props", "cleanup", "Null", "sync"]
|
|
7
|
+
}
|