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