@dxos/app-framework 0.6.14-main.2b6a0f3 → 0.6.14-main.f49f251
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/lib/browser/chunk-3E7RY3CE.mjs +72 -0
- package/dist/lib/browser/chunk-3E7RY3CE.mjs.map +7 -0
- package/dist/lib/browser/chunk-653Y45CL.mjs +41 -0
- package/dist/lib/browser/chunk-653Y45CL.mjs.map +7 -0
- package/dist/lib/browser/{plugin-MM66VRCO.mjs → chunk-CDLQO5K2.mjs} +66 -20
- package/dist/lib/browser/chunk-CDLQO5K2.mjs.map +7 -0
- package/dist/lib/browser/chunk-EQTQGGE6.mjs +214 -0
- package/dist/lib/browser/chunk-EQTQGGE6.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +78 -212
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/plugin-intent-Q5KFPKFA.mjs +22 -0
- package/dist/lib/browser/plugin-intent-Q5KFPKFA.mjs.map +7 -0
- package/dist/lib/browser/plugin-settings-OM3G2QFY.mjs +11 -0
- package/dist/lib/browser/plugin-settings-OM3G2QFY.mjs.map +7 -0
- package/dist/lib/browser/plugin-surface-ZQXFAL46.mjs +24 -0
- package/dist/lib/browser/plugin-surface-ZQXFAL46.mjs.map +7 -0
- package/dist/lib/node/chunk-EF67TRWJ.cjs +236 -0
- package/dist/lib/node/chunk-EF67TRWJ.cjs.map +7 -0
- package/dist/lib/node/chunk-JZ2JVKRY.cjs +58 -0
- package/dist/lib/node/chunk-JZ2JVKRY.cjs.map +7 -0
- package/dist/lib/node/{chunk-62W6CMGM.cjs → chunk-QBM42OQ6.cjs} +56 -5
- package/dist/lib/node/chunk-QBM42OQ6.cjs.map +7 -0
- package/dist/lib/node/{plugin-QV7ESETI.cjs → chunk-VOKMWTKO.cjs} +74 -20
- package/dist/lib/node/chunk-VOKMWTKO.cjs.map +7 -0
- package/dist/lib/node/index.cjs +89 -223
- package/dist/lib/node/index.cjs.map +4 -4
- package/dist/lib/node/meta.json +1 -1
- package/dist/lib/node/plugin-intent-FMC4SDI3.cjs +43 -0
- package/dist/lib/node/plugin-intent-FMC4SDI3.cjs.map +7 -0
- package/dist/lib/node/plugin-settings-OZ6IKAE5.cjs +32 -0
- package/dist/lib/node/plugin-settings-OZ6IKAE5.cjs.map +7 -0
- package/dist/lib/node/plugin-surface-B5NHOBSW.cjs +45 -0
- package/dist/lib/node/plugin-surface-B5NHOBSW.cjs.map +7 -0
- package/dist/lib/node-esm/chunk-3FCLBEOX.mjs +215 -0
- package/dist/lib/node-esm/chunk-3FCLBEOX.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-EYCTSFEJ.mjs +74 -0
- package/dist/lib/node-esm/chunk-EYCTSFEJ.mjs.map +7 -0
- package/dist/lib/node-esm/{plugin-5AAUGDB3.mjs → chunk-MYNXI5VG.mjs} +66 -20
- package/dist/lib/node-esm/chunk-MYNXI5VG.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-YNU7FTGJ.mjs +43 -0
- package/dist/lib/node-esm/chunk-YNU7FTGJ.mjs.map +7 -0
- package/dist/lib/node-esm/index.mjs +78 -212
- package/dist/lib/node-esm/index.mjs.map +4 -4
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/lib/node-esm/plugin-intent-KETLP7UL.mjs +23 -0
- package/dist/lib/node-esm/plugin-intent-KETLP7UL.mjs.map +7 -0
- package/dist/lib/node-esm/plugin-settings-37UVWF2V.mjs +12 -0
- package/dist/lib/node-esm/plugin-settings-37UVWF2V.mjs.map +7 -0
- package/dist/lib/node-esm/plugin-surface-QXQRR534.mjs +25 -0
- package/dist/lib/node-esm/plugin-surface-QXQRR534.mjs.map +7 -0
- package/dist/types/src/App.d.ts +2 -2
- package/dist/types/src/App.d.ts.map +1 -1
- package/dist/types/src/plugins/common/file.d.ts +1 -1
- package/dist/types/src/plugins/common/file.d.ts.map +1 -1
- package/dist/types/src/plugins/common/graph.d.ts +1 -1
- package/dist/types/src/plugins/common/graph.d.ts.map +1 -1
- package/dist/types/src/plugins/common/index.d.ts +0 -1
- package/dist/types/src/plugins/common/index.d.ts.map +1 -1
- package/dist/types/src/plugins/common/layout.d.ts +6 -6
- package/dist/types/src/plugins/common/layout.d.ts.map +1 -1
- package/dist/types/src/plugins/common/metadata.d.ts +1 -1
- package/dist/types/src/plugins/common/metadata.d.ts.map +1 -1
- package/dist/types/src/plugins/common/navigation.d.ts +8 -8
- package/dist/types/src/plugins/common/navigation.d.ts.map +1 -1
- package/dist/types/src/plugins/common/translations.d.ts +1 -1
- package/dist/types/src/plugins/common/translations.d.ts.map +1 -1
- package/dist/types/src/plugins/helpers.d.ts +20 -5
- package/dist/types/src/plugins/helpers.d.ts.map +1 -1
- package/dist/types/src/plugins/index.d.ts +4 -3
- package/dist/types/src/plugins/index.d.ts.map +1 -1
- package/dist/types/src/plugins/{PluginHost/PluginHost.d.ts → plugin-host/HostPlugin.d.ts} +6 -6
- package/dist/types/src/plugins/plugin-host/HostPlugin.d.ts.map +1 -0
- package/dist/types/src/plugins/{PluginHost → plugin-host}/PluginContainer.d.ts +2 -2
- package/dist/types/src/plugins/plugin-host/PluginContainer.d.ts.map +1 -0
- package/dist/types/src/plugins/plugin-host/PluginContext.d.ts.map +1 -0
- package/dist/types/src/plugins/plugin-host/index.d.ts +4 -0
- package/dist/types/src/plugins/plugin-host/index.d.ts.map +1 -0
- package/dist/types/src/plugins/plugin-host/plugin.d.ts.map +1 -0
- package/dist/types/src/plugins/plugin-host/plugin.test.d.ts.map +1 -0
- package/dist/types/src/plugins/plugin-intent/IntentContext.d.ts.map +1 -0
- package/dist/types/src/plugins/{IntentPlugin/plugin.d.ts → plugin-intent/IntentPlugin.d.ts} +3 -4
- package/dist/types/src/plugins/plugin-intent/IntentPlugin.d.ts.map +1 -0
- package/dist/types/src/plugins/plugin-intent/helpers.d.ts.map +1 -0
- package/dist/types/src/plugins/plugin-intent/index.d.ts +6 -0
- package/dist/types/src/plugins/plugin-intent/index.d.ts.map +1 -0
- package/dist/types/src/plugins/{IntentPlugin → plugin-intent}/intent.d.ts +1 -1
- package/dist/types/src/plugins/plugin-intent/intent.d.ts.map +1 -0
- package/dist/types/src/plugins/plugin-intent/meta.d.ts.map +1 -0
- package/dist/types/src/plugins/{IntentPlugin → plugin-intent}/provides.d.ts +2 -2
- package/dist/types/src/plugins/plugin-intent/provides.d.ts.map +1 -0
- package/dist/types/src/plugins/plugin-settings/SettingsPlugin.d.ts +4 -0
- package/dist/types/src/plugins/plugin-settings/SettingsPlugin.d.ts.map +1 -0
- package/dist/types/src/plugins/plugin-settings/index.d.ts +4 -0
- package/dist/types/src/plugins/plugin-settings/index.d.ts.map +1 -0
- package/dist/types/src/plugins/plugin-settings/meta.d.ts +5 -0
- package/dist/types/src/plugins/plugin-settings/meta.d.ts.map +1 -0
- package/dist/types/src/plugins/plugin-settings/provides.d.ts +13 -0
- package/dist/types/src/plugins/plugin-settings/provides.d.ts.map +1 -0
- package/dist/types/src/plugins/plugin-surface/ErrorBoundary.d.ts.map +1 -0
- package/dist/types/src/plugins/{SurfacePlugin → plugin-surface}/Surface.d.ts +4 -0
- package/dist/types/src/plugins/plugin-surface/Surface.d.ts.map +1 -0
- package/dist/types/src/plugins/plugin-surface/SurfacePlugin.d.ts +7 -0
- package/dist/types/src/plugins/plugin-surface/SurfacePlugin.d.ts.map +1 -0
- package/dist/types/src/plugins/plugin-surface/SurfaceRootContext.d.ts.map +1 -0
- package/dist/types/src/plugins/plugin-surface/helpers.d.ts.map +1 -0
- package/dist/types/src/plugins/{SurfacePlugin → plugin-surface}/index.d.ts +2 -0
- package/dist/types/src/plugins/plugin-surface/index.d.ts.map +1 -0
- package/dist/types/src/plugins/plugin-surface/meta.d.ts.map +1 -0
- package/dist/types/src/plugins/{SurfacePlugin → plugin-surface}/provides.d.ts +1 -1
- package/dist/types/src/plugins/plugin-surface/provides.d.ts.map +1 -0
- package/package.json +14 -16
- package/src/App.tsx +13 -12
- package/src/plugins/common/file.ts +1 -1
- package/src/plugins/common/graph.ts +1 -1
- package/src/plugins/common/index.ts +0 -1
- package/src/plugins/common/layout.ts +6 -3
- package/src/plugins/common/metadata.ts +1 -1
- package/src/plugins/common/navigation.ts +6 -3
- package/src/plugins/common/translations.ts +2 -8
- package/src/plugins/helpers.ts +55 -11
- package/src/plugins/index.ts +4 -3
- package/src/plugins/{PluginHost/PluginHost.tsx → plugin-host/HostPlugin.tsx} +10 -9
- package/src/plugins/{PluginHost → plugin-host}/PluginContainer.tsx +2 -2
- package/src/plugins/{PluginHost → plugin-host}/PluginContext.tsx +1 -0
- package/src/plugins/{PluginHost → plugin-host}/index.ts +2 -1
- package/src/plugins/{IntentPlugin/plugin.tsx → plugin-intent/IntentPlugin.tsx} +3 -6
- package/src/plugins/{IntentPlugin → plugin-intent}/index.ts +4 -0
- package/src/plugins/{IntentPlugin → plugin-intent}/intent.ts +1 -1
- package/src/plugins/{IntentPlugin → plugin-intent}/provides.ts +5 -2
- package/src/plugins/plugin-settings/SettingsPlugin.tsx +22 -0
- package/src/plugins/plugin-settings/index.ts +9 -0
- package/src/plugins/plugin-settings/meta.ts +9 -0
- package/src/plugins/plugin-settings/provides.ts +29 -0
- package/src/plugins/{SurfacePlugin → plugin-surface}/Surface.tsx +60 -46
- package/src/plugins/{SurfacePlugin/plugin.tsx → plugin-surface/SurfacePlugin.tsx} +2 -4
- package/src/plugins/{SurfacePlugin → plugin-surface}/index.ts +4 -0
- package/src/plugins/{SurfacePlugin → plugin-surface}/provides.ts +2 -1
- package/dist/lib/browser/chunk-J45KR4DI.mjs +0 -52
- package/dist/lib/browser/chunk-J45KR4DI.mjs.map +0 -7
- package/dist/lib/browser/chunk-S5CI6EUQ.mjs +0 -20
- package/dist/lib/browser/chunk-S5CI6EUQ.mjs.map +0 -7
- package/dist/lib/browser/chunk-SB4XRTGZ.mjs +0 -25
- package/dist/lib/browser/chunk-SB4XRTGZ.mjs.map +0 -7
- package/dist/lib/browser/plugin-MM66VRCO.mjs.map +0 -7
- package/dist/lib/browser/plugin-Y4KRQJE4.mjs +0 -40
- package/dist/lib/browser/plugin-Y4KRQJE4.mjs.map +0 -7
- package/dist/lib/node/chunk-62W6CMGM.cjs.map +0 -7
- package/dist/lib/node/chunk-DFST5IG5.cjs +0 -77
- package/dist/lib/node/chunk-DFST5IG5.cjs.map +0 -7
- package/dist/lib/node/chunk-PJGE52CN.cjs +0 -47
- package/dist/lib/node/chunk-PJGE52CN.cjs.map +0 -7
- package/dist/lib/node/plugin-6TEDSCXW.cjs +0 -62
- package/dist/lib/node/plugin-6TEDSCXW.cjs.map +0 -7
- package/dist/lib/node/plugin-QV7ESETI.cjs.map +0 -7
- package/dist/lib/node-esm/chunk-IY7HCP4K.mjs +0 -22
- package/dist/lib/node-esm/chunk-IY7HCP4K.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-MBHRXQTR.mjs +0 -27
- package/dist/lib/node-esm/chunk-MBHRXQTR.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-P2TQLXZR.mjs +0 -54
- package/dist/lib/node-esm/chunk-P2TQLXZR.mjs.map +0 -7
- package/dist/lib/node-esm/plugin-5AAUGDB3.mjs.map +0 -7
- package/dist/lib/node-esm/plugin-J5IRJLM6.mjs +0 -41
- package/dist/lib/node-esm/plugin-J5IRJLM6.mjs.map +0 -7
- package/dist/types/src/plugins/IntentPlugin/IntentContext.d.ts.map +0 -1
- package/dist/types/src/plugins/IntentPlugin/helpers.d.ts.map +0 -1
- package/dist/types/src/plugins/IntentPlugin/index.d.ts +0 -4
- package/dist/types/src/plugins/IntentPlugin/index.d.ts.map +0 -1
- package/dist/types/src/plugins/IntentPlugin/intent.d.ts.map +0 -1
- package/dist/types/src/plugins/IntentPlugin/meta.d.ts.map +0 -1
- package/dist/types/src/plugins/IntentPlugin/plugin.d.ts.map +0 -1
- package/dist/types/src/plugins/IntentPlugin/provides.d.ts.map +0 -1
- package/dist/types/src/plugins/PluginHost/PluginContainer.d.ts.map +0 -1
- package/dist/types/src/plugins/PluginHost/PluginContext.d.ts.map +0 -1
- package/dist/types/src/plugins/PluginHost/PluginHost.d.ts.map +0 -1
- package/dist/types/src/plugins/PluginHost/index.d.ts +0 -4
- package/dist/types/src/plugins/PluginHost/index.d.ts.map +0 -1
- package/dist/types/src/plugins/PluginHost/plugin.d.ts.map +0 -1
- package/dist/types/src/plugins/PluginHost/plugin.test.d.ts.map +0 -1
- package/dist/types/src/plugins/SurfacePlugin/ErrorBoundary.d.ts.map +0 -1
- package/dist/types/src/plugins/SurfacePlugin/Surface.d.ts.map +0 -1
- package/dist/types/src/plugins/SurfacePlugin/SurfaceRootContext.d.ts.map +0 -1
- package/dist/types/src/plugins/SurfacePlugin/helpers.d.ts.map +0 -1
- package/dist/types/src/plugins/SurfacePlugin/index.d.ts.map +0 -1
- package/dist/types/src/plugins/SurfacePlugin/meta.d.ts.map +0 -1
- package/dist/types/src/plugins/SurfacePlugin/plugin.d.ts +0 -8
- package/dist/types/src/plugins/SurfacePlugin/plugin.d.ts.map +0 -1
- package/dist/types/src/plugins/SurfacePlugin/provides.d.ts.map +0 -1
- package/dist/types/src/plugins/common/settings.d.ts +0 -9
- package/dist/types/src/plugins/common/settings.d.ts.map +0 -1
- package/src/plugins/common/settings.ts +0 -22
- /package/dist/types/src/plugins/{PluginHost → plugin-host}/PluginContext.d.ts +0 -0
- /package/dist/types/src/plugins/{PluginHost → plugin-host}/plugin.d.ts +0 -0
- /package/dist/types/src/plugins/{PluginHost → plugin-host}/plugin.test.d.ts +0 -0
- /package/dist/types/src/plugins/{IntentPlugin → plugin-intent}/IntentContext.d.ts +0 -0
- /package/dist/types/src/plugins/{IntentPlugin → plugin-intent}/helpers.d.ts +0 -0
- /package/dist/types/src/plugins/{IntentPlugin → plugin-intent}/meta.d.ts +0 -0
- /package/dist/types/src/plugins/{SurfacePlugin → plugin-surface}/ErrorBoundary.d.ts +0 -0
- /package/dist/types/src/plugins/{SurfacePlugin → plugin-surface}/SurfaceRootContext.d.ts +0 -0
- /package/dist/types/src/plugins/{SurfacePlugin → plugin-surface}/helpers.d.ts +0 -0
- /package/dist/types/src/plugins/{SurfacePlugin → plugin-surface}/meta.d.ts +0 -0
- /package/src/plugins/{PluginHost → plugin-host}/plugin.test.ts +0 -0
- /package/src/plugins/{PluginHost → plugin-host}/plugin.ts +0 -0
- /package/src/plugins/{IntentPlugin → plugin-intent}/IntentContext.tsx +0 -0
- /package/src/plugins/{IntentPlugin → plugin-intent}/helpers.ts +0 -0
- /package/src/plugins/{IntentPlugin → plugin-intent}/meta.ts +0 -0
- /package/src/plugins/{SurfacePlugin → plugin-surface}/ErrorBoundary.tsx +0 -0
- /package/src/plugins/{SurfacePlugin → plugin-surface}/SurfaceRootContext.tsx +0 -0
- /package/src/plugins/{SurfacePlugin → plugin-surface}/helpers.ts +0 -0
- /package/src/plugins/{SurfacePlugin → plugin-surface}/meta.ts +0 -0
|
@@ -1,11 +1,4 @@
|
|
|
1
1
|
import { createRequire } from 'node:module';const require = createRequire(import.meta.url);
|
|
2
|
-
import {
|
|
3
|
-
SurfaceProvider,
|
|
4
|
-
meta_default as meta_default2,
|
|
5
|
-
parseRootSurfacePlugin,
|
|
6
|
-
parseSurfacePlugin,
|
|
7
|
-
useSurfaceRoot
|
|
8
|
-
} from "./chunk-MBHRXQTR.mjs";
|
|
9
2
|
import {
|
|
10
3
|
IntentAction,
|
|
11
4
|
IntentProvider,
|
|
@@ -15,14 +8,30 @@ import {
|
|
|
15
8
|
useIntent,
|
|
16
9
|
useIntentDispatcher,
|
|
17
10
|
useIntentResolver
|
|
18
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-MYNXI5VG.mjs";
|
|
12
|
+
import {
|
|
13
|
+
ErrorBoundary,
|
|
14
|
+
Surface,
|
|
15
|
+
SurfaceProvider,
|
|
16
|
+
isObject,
|
|
17
|
+
meta_default as meta_default2,
|
|
18
|
+
parseRootSurfacePlugin,
|
|
19
|
+
parseSurfacePlugin,
|
|
20
|
+
useSurface,
|
|
21
|
+
useSurfaceRoot
|
|
22
|
+
} from "./chunk-3FCLBEOX.mjs";
|
|
19
23
|
import {
|
|
20
24
|
definePlugin,
|
|
21
25
|
filterPlugins,
|
|
22
26
|
findPlugin,
|
|
23
27
|
getPlugin,
|
|
24
28
|
resolvePlugin
|
|
25
|
-
} from "./chunk-
|
|
29
|
+
} from "./chunk-EYCTSFEJ.mjs";
|
|
30
|
+
import {
|
|
31
|
+
SettingsAction,
|
|
32
|
+
meta_default as meta_default3,
|
|
33
|
+
parseSettingsPlugin
|
|
34
|
+
} from "./chunk-YNU7FTGJ.mjs";
|
|
26
35
|
|
|
27
36
|
// packages/sdk/app-framework/src/plugins/common/file.ts
|
|
28
37
|
var defaultFileTypes = {
|
|
@@ -102,7 +111,8 @@ var parseLayoutPlugin = (plugin) => {
|
|
|
102
111
|
const { success } = Layout.safeParse(plugin.provides.layout);
|
|
103
112
|
return success ? plugin : void 0;
|
|
104
113
|
};
|
|
105
|
-
var
|
|
114
|
+
var LAYOUT_PLUGIN = "dxos.org/plugin/layout";
|
|
115
|
+
var LAYOUT_ACTION = `${LAYOUT_PLUGIN}/action`;
|
|
106
116
|
var LayoutAction;
|
|
107
117
|
(function(LayoutAction2) {
|
|
108
118
|
LayoutAction2[LayoutAction2["SET_LAYOUT"] = `${LAYOUT_ACTION}/set-layout`] = "SET_LAYOUT";
|
|
@@ -195,7 +205,8 @@ var partLength = (layout, part) => {
|
|
|
195
205
|
}
|
|
196
206
|
return layout[part]?.length ?? 0;
|
|
197
207
|
};
|
|
198
|
-
var
|
|
208
|
+
var NAVIGATION_PLUGIN = "dxos.org/plugin/navigation";
|
|
209
|
+
var NAVIGATION_ACTION = `${NAVIGATION_PLUGIN}/action`;
|
|
199
210
|
var NavigationAction;
|
|
200
211
|
(function(NavigationAction2) {
|
|
201
212
|
NavigationAction2[NavigationAction2["OPEN"] = `${NAVIGATION_ACTION}/open`] = "OPEN";
|
|
@@ -206,16 +217,6 @@ var NavigationAction;
|
|
|
206
217
|
NavigationAction2[NavigationAction2["EXPOSE"] = `${NAVIGATION_ACTION}/expose`] = "EXPOSE";
|
|
207
218
|
})(NavigationAction || (NavigationAction = {}));
|
|
208
219
|
|
|
209
|
-
// packages/sdk/app-framework/src/plugins/common/settings.ts
|
|
210
|
-
var parseSettingsPlugin = (plugin) => {
|
|
211
|
-
return typeof plugin.provides.settings === "object" ? plugin : void 0;
|
|
212
|
-
};
|
|
213
|
-
var SETTINGS_ACTION = "dxos.org/plugin/settings";
|
|
214
|
-
var SettingsAction;
|
|
215
|
-
(function(SettingsAction2) {
|
|
216
|
-
SettingsAction2[SettingsAction2["OPEN"] = `${SETTINGS_ACTION}/open`] = "OPEN";
|
|
217
|
-
})(SettingsAction || (SettingsAction = {}));
|
|
218
|
-
|
|
219
220
|
// packages/sdk/app-framework/src/plugins/common/translations.ts
|
|
220
221
|
import { z as z3 } from "zod";
|
|
221
222
|
var ResourceKey = z3.union([
|
|
@@ -229,7 +230,7 @@ var parseTranslationsPlugin = (plugin) => {
|
|
|
229
230
|
return success ? plugin : void 0;
|
|
230
231
|
};
|
|
231
232
|
|
|
232
|
-
// packages/sdk/app-framework/src/plugins/
|
|
233
|
+
// packages/sdk/app-framework/src/plugins/plugin-host/plugin.ts
|
|
233
234
|
var Plugin;
|
|
234
235
|
(function(Plugin2) {
|
|
235
236
|
Plugin2.lazy = (p, props) => {
|
|
@@ -239,37 +240,14 @@ var Plugin;
|
|
|
239
240
|
};
|
|
240
241
|
})(Plugin || (Plugin = {}));
|
|
241
242
|
|
|
242
|
-
// packages/sdk/app-framework/src/plugins/
|
|
243
|
-
import
|
|
244
|
-
import { raise } from "@dxos/debug";
|
|
245
|
-
import { nonNullable } from "@dxos/util";
|
|
246
|
-
var PluginContext = /* @__PURE__ */ createContext(void 0);
|
|
247
|
-
var usePlugins = () => useContext(PluginContext) ?? raise(new Error("Missing PluginContext"));
|
|
248
|
-
var usePlugin = (id) => {
|
|
249
|
-
const { plugins } = usePlugins();
|
|
250
|
-
return findPlugin(plugins, id);
|
|
251
|
-
};
|
|
252
|
-
var useResolvePlugin = (predicate) => {
|
|
253
|
-
const { plugins } = usePlugins();
|
|
254
|
-
return resolvePlugin(plugins, predicate);
|
|
255
|
-
};
|
|
256
|
-
var useResolvePlugins = (predicate) => {
|
|
257
|
-
const { plugins } = usePlugins();
|
|
258
|
-
return useMemo(() => plugins.map(predicate).filter(nonNullable), [
|
|
259
|
-
plugins,
|
|
260
|
-
predicate
|
|
261
|
-
]);
|
|
262
|
-
};
|
|
263
|
-
var PluginProvider = PluginContext.Provider;
|
|
264
|
-
|
|
265
|
-
// packages/sdk/app-framework/src/plugins/PluginHost/PluginHost.tsx
|
|
266
|
-
import React4 from "react";
|
|
243
|
+
// packages/sdk/app-framework/src/plugins/plugin-host/HostPlugin.tsx
|
|
244
|
+
import React2 from "react";
|
|
267
245
|
import { LocalStorageStore } from "@dxos/local-storage";
|
|
268
246
|
|
|
269
|
-
// packages/sdk/app-framework/src/plugins/
|
|
247
|
+
// packages/sdk/app-framework/src/plugins/plugin-host/PluginContainer.tsx
|
|
270
248
|
import React, { useEffect, useState } from "react";
|
|
271
249
|
import { log } from "@dxos/log";
|
|
272
|
-
var __dxlog_file = "/home/runner/work/dxos/dxos/packages/sdk/app-framework/src/plugins/
|
|
250
|
+
var __dxlog_file = "/home/runner/work/dxos/dxos/packages/sdk/app-framework/src/plugins/plugin-host/PluginContainer.tsx";
|
|
273
251
|
var PluginContainer = ({ plugins: definitions, core, state, placeholder }) => {
|
|
274
252
|
const [error, setError] = useState();
|
|
275
253
|
useEffect(() => {
|
|
@@ -360,9 +338,9 @@ var initializePlugin = async (pluginDefinition) => {
|
|
|
360
338
|
};
|
|
361
339
|
var rootComponents = (plugins) => {
|
|
362
340
|
return plugins.map((plugin) => {
|
|
363
|
-
const
|
|
364
|
-
if (
|
|
365
|
-
return /* @__PURE__ */ React.createElement(
|
|
341
|
+
const Component = plugin.provides.root;
|
|
342
|
+
if (Component) {
|
|
343
|
+
return /* @__PURE__ */ React.createElement(Component, {
|
|
366
344
|
key: plugin.meta.id
|
|
367
345
|
});
|
|
368
346
|
} else {
|
|
@@ -379,149 +357,34 @@ var compose = (contexts) => {
|
|
|
379
357
|
].reduce((Acc, Next) => ({ children }) => /* @__PURE__ */ React.createElement(Acc, null, /* @__PURE__ */ React.createElement(Next, null, children)));
|
|
380
358
|
};
|
|
381
359
|
|
|
382
|
-
// packages/sdk/app-framework/src/plugins/
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
var
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
error: void 0
|
|
392
|
-
};
|
|
393
|
-
}
|
|
394
|
-
static getDerivedStateFromError(error) {
|
|
395
|
-
return {
|
|
396
|
-
error
|
|
397
|
-
};
|
|
398
|
-
}
|
|
399
|
-
componentDidUpdate(prevProps) {
|
|
400
|
-
if (prevProps.data !== this.props.data) {
|
|
401
|
-
this.resetError();
|
|
402
|
-
}
|
|
403
|
-
}
|
|
404
|
-
render() {
|
|
405
|
-
if (this.state.error) {
|
|
406
|
-
return /* @__PURE__ */ React2.createElement(this.props.fallback, {
|
|
407
|
-
data: this.props.data,
|
|
408
|
-
error: this.state.error,
|
|
409
|
-
reset: this.resetError
|
|
410
|
-
});
|
|
411
|
-
}
|
|
412
|
-
return this.props.children;
|
|
413
|
-
}
|
|
414
|
-
resetError() {
|
|
415
|
-
this.setState({
|
|
416
|
-
error: void 0
|
|
417
|
-
});
|
|
418
|
-
}
|
|
360
|
+
// packages/sdk/app-framework/src/plugins/plugin-host/PluginContext.tsx
|
|
361
|
+
import { createContext, useContext, useMemo } from "react";
|
|
362
|
+
import { raise } from "@dxos/debug";
|
|
363
|
+
import { nonNullable } from "@dxos/util";
|
|
364
|
+
var PluginContext = /* @__PURE__ */ createContext(void 0);
|
|
365
|
+
var usePlugins = () => useContext(PluginContext) ?? raise(new Error("Missing PluginContext"));
|
|
366
|
+
var usePlugin = (id) => {
|
|
367
|
+
const { plugins } = usePlugins();
|
|
368
|
+
return findPlugin(plugins, id);
|
|
419
369
|
};
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
var
|
|
425
|
-
const
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
...rest
|
|
430
|
-
};
|
|
431
|
-
const { debugInfo } = useSurfaceRoot();
|
|
432
|
-
const [id] = useState2(Math.random().toString(36).slice(2));
|
|
433
|
-
useEffect2(() => {
|
|
434
|
-
debugInfo?.set(id, {
|
|
435
|
-
id,
|
|
436
|
-
created: Date.now(),
|
|
437
|
-
name,
|
|
438
|
-
role,
|
|
439
|
-
renderCount: 0
|
|
440
|
-
});
|
|
441
|
-
return () => {
|
|
442
|
-
debugInfo?.delete(id);
|
|
443
|
-
};
|
|
444
|
-
}, [
|
|
445
|
-
id
|
|
370
|
+
var useResolvePlugin = (predicate) => {
|
|
371
|
+
const { plugins } = usePlugins();
|
|
372
|
+
return resolvePlugin(plugins, predicate);
|
|
373
|
+
};
|
|
374
|
+
var useResolvePlugins = (predicate) => {
|
|
375
|
+
const { plugins } = usePlugins();
|
|
376
|
+
return useMemo(() => plugins.map(predicate).filter(nonNullable), [
|
|
377
|
+
plugins,
|
|
378
|
+
predicate
|
|
446
379
|
]);
|
|
447
|
-
if (debugInfo?.get(id)) {
|
|
448
|
-
debugInfo.get(id).renderCount++;
|
|
449
|
-
}
|
|
450
|
-
const context = useContext2(SurfaceContext);
|
|
451
|
-
const data = props.data ?? (name && context?.surfaces?.[name]?.data || {});
|
|
452
|
-
const resolver = /* @__PURE__ */ React3.createElement(SurfaceResolver, {
|
|
453
|
-
...props,
|
|
454
|
-
ref: forwardedRef
|
|
455
|
-
});
|
|
456
|
-
const suspense = placeholder ? /* @__PURE__ */ React3.createElement(Suspense, {
|
|
457
|
-
fallback: placeholder
|
|
458
|
-
}, resolver) : resolver;
|
|
459
|
-
return fallback ? /* @__PURE__ */ React3.createElement(ErrorBoundary, {
|
|
460
|
-
data,
|
|
461
|
-
fallback
|
|
462
|
-
}, suspense) : suspense;
|
|
463
|
-
}));
|
|
464
|
-
var SurfaceContext = /* @__PURE__ */ createContext2(void 0);
|
|
465
|
-
var useSurface = () => useContext2(SurfaceContext) ?? raise2(new Error("Surface context not found"));
|
|
466
|
-
var SurfaceResolver = /* @__PURE__ */ forwardRef((props, forwardedRef) => {
|
|
467
|
-
const { components } = useSurfaceRoot();
|
|
468
|
-
const parent = useContext2(SurfaceContext);
|
|
469
|
-
const nodes = resolveNodes(components, props, parent, forwardedRef);
|
|
470
|
-
const currentContext = {
|
|
471
|
-
...props,
|
|
472
|
-
surfaces: {
|
|
473
|
-
...props.name && parent?.surfaces?.[props.name]?.surfaces || {},
|
|
474
|
-
...props.surfaces
|
|
475
|
-
}
|
|
476
|
-
};
|
|
477
|
-
return /* @__PURE__ */ React3.createElement(SurfaceContext.Provider, {
|
|
478
|
-
value: currentContext
|
|
479
|
-
}, nodes);
|
|
480
|
-
});
|
|
481
|
-
var resolveNodes = (components, props, context, forwardedRef) => {
|
|
482
|
-
const data = {
|
|
483
|
-
...props.name && context?.surfaces?.[props.name]?.data || {},
|
|
484
|
-
...props.data
|
|
485
|
-
};
|
|
486
|
-
const nodes = Object.entries(components).map(([key, component]) => {
|
|
487
|
-
const result = component({
|
|
488
|
-
...props,
|
|
489
|
-
data
|
|
490
|
-
}, forwardedRef);
|
|
491
|
-
if (!result || typeof result !== "object") {
|
|
492
|
-
return void 0;
|
|
493
|
-
}
|
|
494
|
-
return "node" in result ? [
|
|
495
|
-
key,
|
|
496
|
-
result
|
|
497
|
-
] : /* @__PURE__ */ isValidElement(result) ? [
|
|
498
|
-
key,
|
|
499
|
-
{
|
|
500
|
-
node: result
|
|
501
|
-
}
|
|
502
|
-
] : void 0;
|
|
503
|
-
}).filter((result) => Boolean(result)).sort(([, a], [, b]) => {
|
|
504
|
-
const aDisposition = a.disposition ?? "default";
|
|
505
|
-
const bDisposition = b.disposition ?? "default";
|
|
506
|
-
if (aDisposition === bDisposition) {
|
|
507
|
-
return 0;
|
|
508
|
-
} else if (aDisposition === "hoist" || bDisposition === "fallback") {
|
|
509
|
-
return -1;
|
|
510
|
-
} else if (bDisposition === "hoist" || aDisposition === "fallback") {
|
|
511
|
-
return 1;
|
|
512
|
-
}
|
|
513
|
-
return 0;
|
|
514
|
-
}).map(([key, result]) => /* @__PURE__ */ React3.createElement(Fragment, {
|
|
515
|
-
key
|
|
516
|
-
}, result.node));
|
|
517
|
-
return props.limit ? nodes.slice(0, props.limit) : nodes;
|
|
518
380
|
};
|
|
381
|
+
var PluginProvider = PluginContext.Provider;
|
|
519
382
|
|
|
520
|
-
// packages/sdk/app-framework/src/plugins/
|
|
383
|
+
// packages/sdk/app-framework/src/plugins/plugin-host/HostPlugin.tsx
|
|
521
384
|
var parsePluginHost = (plugin) => plugin.provides.plugins ? plugin : void 0;
|
|
522
|
-
var
|
|
523
|
-
var
|
|
524
|
-
const state = new LocalStorageStore(
|
|
385
|
+
var HOST_PLUGIN = "dxos.org/plugin/host";
|
|
386
|
+
var HostPlugin = ({ plugins, meta, core, defaults = [], fallback = DefaultFallback, placeholder = null }) => {
|
|
387
|
+
const state = new LocalStorageStore(HOST_PLUGIN, {
|
|
525
388
|
ready: false,
|
|
526
389
|
core,
|
|
527
390
|
enabled: [
|
|
@@ -529,6 +392,7 @@ var PluginHost = ({ plugins, meta, core, defaults = [], fallback = DefaultFallba
|
|
|
529
392
|
],
|
|
530
393
|
plugins: [],
|
|
531
394
|
available: meta.filter(({ id }) => !core.includes(id)),
|
|
395
|
+
// TODO(burdon): Functions should not be part of the settings type.
|
|
532
396
|
setPlugin: (id, enabled) => {
|
|
533
397
|
if (enabled) {
|
|
534
398
|
state.values.enabled.push(id);
|
|
@@ -544,20 +408,20 @@ var PluginHost = ({ plugins, meta, core, defaults = [], fallback = DefaultFallba
|
|
|
544
408
|
});
|
|
545
409
|
return {
|
|
546
410
|
meta: {
|
|
547
|
-
id:
|
|
411
|
+
id: HOST_PLUGIN,
|
|
548
412
|
name: "Plugin host"
|
|
549
413
|
},
|
|
550
414
|
provides: {
|
|
551
415
|
plugins: state.values,
|
|
552
416
|
context: ({ children }) => {
|
|
553
|
-
return /* @__PURE__ */
|
|
417
|
+
return /* @__PURE__ */ React2.createElement(PluginProvider, {
|
|
554
418
|
value: state.values
|
|
555
419
|
}, children);
|
|
556
420
|
},
|
|
557
421
|
root: () => {
|
|
558
|
-
return /* @__PURE__ */
|
|
422
|
+
return /* @__PURE__ */ React2.createElement(ErrorBoundary, {
|
|
559
423
|
fallback
|
|
560
|
-
}, /* @__PURE__ */
|
|
424
|
+
}, /* @__PURE__ */ React2.createElement(PluginContainer, {
|
|
561
425
|
plugins,
|
|
562
426
|
core,
|
|
563
427
|
state: state.values,
|
|
@@ -568,56 +432,58 @@ var PluginHost = ({ plugins, meta, core, defaults = [], fallback = DefaultFallba
|
|
|
568
432
|
};
|
|
569
433
|
};
|
|
570
434
|
var DefaultFallback = ({ error }) => {
|
|
571
|
-
return /* @__PURE__ */
|
|
435
|
+
return /* @__PURE__ */ React2.createElement("div", {
|
|
572
436
|
style: {
|
|
573
437
|
padding: "1rem"
|
|
574
438
|
}
|
|
575
|
-
}, /* @__PURE__ */
|
|
439
|
+
}, /* @__PURE__ */ React2.createElement("h1", {
|
|
576
440
|
style: {
|
|
577
441
|
fontSize: "1.2rem",
|
|
578
442
|
fontWeight: 700,
|
|
579
443
|
margin: "0.5rem 0"
|
|
580
444
|
}
|
|
581
|
-
}, error.message), /* @__PURE__ */
|
|
445
|
+
}, error.message), /* @__PURE__ */ React2.createElement("pre", null, error.stack));
|
|
582
446
|
};
|
|
583
447
|
|
|
584
448
|
// packages/sdk/app-framework/src/App.tsx
|
|
585
|
-
import
|
|
449
|
+
import React3 from "react";
|
|
586
450
|
import { invariant } from "@dxos/invariant";
|
|
587
451
|
var __dxlog_file2 = "/home/runner/work/dxos/dxos/packages/sdk/app-framework/src/App.tsx";
|
|
588
452
|
var createApp = ({ meta, plugins, core, ...params }) => {
|
|
589
|
-
const
|
|
453
|
+
const hostPlugin = HostPlugin({
|
|
590
454
|
plugins: {
|
|
591
455
|
...plugins,
|
|
592
|
-
[
|
|
593
|
-
[
|
|
456
|
+
[meta_default.id]: Plugin.lazy(() => import("./plugin-intent-KETLP7UL.mjs")),
|
|
457
|
+
[meta_default3.id]: Plugin.lazy(() => import("./plugin-settings-37UVWF2V.mjs")),
|
|
458
|
+
[meta_default2.id]: Plugin.lazy(() => import("./plugin-surface-QXQRR534.mjs"))
|
|
594
459
|
},
|
|
595
|
-
// TODO(burdon): Why not include in core?
|
|
596
460
|
meta: [
|
|
597
|
-
meta_default2,
|
|
598
461
|
meta_default,
|
|
462
|
+
meta_default3,
|
|
463
|
+
meta_default2,
|
|
599
464
|
...meta
|
|
600
465
|
],
|
|
601
466
|
core: [
|
|
602
|
-
meta_default2.id,
|
|
603
467
|
meta_default.id,
|
|
468
|
+
meta_default3.id,
|
|
469
|
+
meta_default2.id,
|
|
604
470
|
...core
|
|
605
471
|
],
|
|
606
472
|
...params
|
|
607
473
|
});
|
|
608
|
-
invariant(
|
|
474
|
+
invariant(hostPlugin.provides, void 0, {
|
|
609
475
|
F: __dxlog_file2,
|
|
610
|
-
L:
|
|
476
|
+
L: 53,
|
|
611
477
|
S: void 0,
|
|
612
478
|
A: [
|
|
613
|
-
"
|
|
479
|
+
"hostPlugin.provides",
|
|
614
480
|
""
|
|
615
481
|
]
|
|
616
482
|
});
|
|
617
|
-
const { context: Context, root: Root } =
|
|
483
|
+
const { context: Context, root: Root } = hostPlugin.provides;
|
|
618
484
|
invariant(Context, void 0, {
|
|
619
485
|
F: __dxlog_file2,
|
|
620
|
-
L:
|
|
486
|
+
L: 55,
|
|
621
487
|
S: void 0,
|
|
622
488
|
A: [
|
|
623
489
|
"Context",
|
|
@@ -626,25 +492,25 @@ var createApp = ({ meta, plugins, core, ...params }) => {
|
|
|
626
492
|
});
|
|
627
493
|
invariant(Root, void 0, {
|
|
628
494
|
F: __dxlog_file2,
|
|
629
|
-
L:
|
|
495
|
+
L: 56,
|
|
630
496
|
S: void 0,
|
|
631
497
|
A: [
|
|
632
498
|
"Root",
|
|
633
499
|
""
|
|
634
500
|
]
|
|
635
501
|
});
|
|
636
|
-
return () => /* @__PURE__ */
|
|
502
|
+
return () => /* @__PURE__ */ React3.createElement(Context, null, /* @__PURE__ */ React3.createElement(Root, null));
|
|
637
503
|
};
|
|
638
504
|
export {
|
|
639
505
|
ActiveParts,
|
|
640
506
|
ErrorBoundary,
|
|
507
|
+
HostPlugin,
|
|
641
508
|
IntentAction,
|
|
642
509
|
IntentProvider,
|
|
643
510
|
Layout,
|
|
644
511
|
LayoutAction,
|
|
645
512
|
NavigationAction,
|
|
646
513
|
Plugin,
|
|
647
|
-
PluginHost,
|
|
648
514
|
PluginProvider,
|
|
649
515
|
Resource,
|
|
650
516
|
ResourceKey,
|