@dxos/app-framework 0.6.13 → 0.6.14-main.1366248
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 +183 -293
- 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 +195 -310
- 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/{chunk-P5GRB4XF.cjs → plugin-surface-B5NHOBSW.cjs} +19 -22
- 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/chunk-MYNXI5VG.mjs +214 -0
- 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 +567 -0
- package/dist/lib/node-esm/index.mjs.map +7 -0
- package/dist/lib/node-esm/meta.json +1 -0
- package/dist/lib/node-esm/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 +5 -5
- 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 +9 -20
- 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/plugin-host/HostPlugin.d.ts +21 -0
- package/dist/types/src/plugins/plugin-host/HostPlugin.d.ts.map +1 -0
- package/dist/types/src/plugins/plugin-host/PluginContainer.d.ts +14 -0
- package/dist/types/src/plugins/plugin-host/PluginContainer.d.ts.map +1 -0
- package/dist/types/src/plugins/{PluginHost → plugin-host}/PluginContext.d.ts +4 -4
- 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/{PluginHost → plugin-host}/plugin.d.ts +41 -83
- 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 +6 -2
- 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/{SurfacePlugin → plugin-surface}/SurfaceRootContext.d.ts +15 -2
- 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 +16 -14
- package/project.json +3 -8
- package/src/App.tsx +18 -16
- 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 +10 -15
- 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/plugin-host/HostPlugin.tsx +96 -0
- package/src/plugins/plugin-host/PluginContainer.tsx +120 -0
- package/src/plugins/{PluginHost → plugin-host}/PluginContext.tsx +9 -14
- package/src/plugins/{PluginHost → plugin-host}/index.ts +2 -1
- package/src/plugins/{PluginHost → plugin-host}/plugin.test.ts +1 -2
- package/src/plugins/{PluginHost → plugin-host}/plugin.ts +50 -52
- 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 +74 -40
- package/src/plugins/{SurfacePlugin/plugin.tsx → plugin-surface/SurfacePlugin.tsx} +3 -5
- package/src/plugins/{SurfacePlugin → plugin-surface}/SurfaceRootContext.tsx +21 -4
- package/src/plugins/{SurfacePlugin → plugin-surface}/index.ts +4 -0
- package/src/plugins/{SurfacePlugin → plugin-surface}/provides.ts +2 -1
- package/tsconfig.json +2 -30
- package/vitest.config.ts +9 -0
- 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-YYV26N3W.mjs +0 -26
- package/dist/lib/browser/chunk-YYV26N3W.mjs.map +0 -7
- package/dist/lib/browser/plugin-K3KCPCTJ.mjs +0 -39
- package/dist/lib/browser/plugin-K3KCPCTJ.mjs.map +0 -7
- package/dist/lib/browser/plugin-MM66VRCO.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-P5GRB4XF.cjs.map +0 -7
- package/dist/lib/node/plugin-QV7ESETI.cjs.map +0 -7
- package/dist/lib/node/plugin-RUJ5PEXB.cjs +0 -61
- package/dist/lib/node/plugin-RUJ5PEXB.cjs.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/PluginContext.d.ts.map +0 -1
- package/dist/types/src/plugins/PluginHost/PluginHost.d.ts +0 -25
- 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/PluginHost/PluginHost.tsx +0 -198
- package/src/plugins/common/settings.ts +0 -22
- /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}/helpers.d.ts +0 -0
- /package/dist/types/src/plugins/{SurfacePlugin → plugin-surface}/meta.d.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}/helpers.ts +0 -0
- /package/src/plugins/{SurfacePlugin → plugin-surface}/meta.ts +0 -0
package/dist/lib/node/index.cjs
CHANGED
|
@@ -29,15 +29,14 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
29
29
|
var node_exports = {};
|
|
30
30
|
__export(node_exports, {
|
|
31
31
|
ActiveParts: () => ActiveParts,
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
IntentAction: () =>
|
|
35
|
-
IntentProvider: () =>
|
|
32
|
+
ErrorBoundary: () => import_chunk_EF67TRWJ.ErrorBoundary,
|
|
33
|
+
HostPlugin: () => HostPlugin,
|
|
34
|
+
IntentAction: () => import_chunk_VOKMWTKO.IntentAction,
|
|
35
|
+
IntentProvider: () => import_chunk_VOKMWTKO.IntentProvider,
|
|
36
36
|
Layout: () => Layout,
|
|
37
37
|
LayoutAction: () => LayoutAction,
|
|
38
38
|
NavigationAction: () => NavigationAction,
|
|
39
39
|
Plugin: () => Plugin,
|
|
40
|
-
PluginHost: () => PluginHost,
|
|
41
40
|
PluginProvider: () => PluginProvider,
|
|
42
41
|
Resource: () => Resource,
|
|
43
42
|
ResourceKey: () => ResourceKey,
|
|
@@ -47,70 +46,67 @@ __export(node_exports, {
|
|
|
47
46
|
SLUG_KEY_VALUE_SEPARATOR: () => SLUG_KEY_VALUE_SEPARATOR,
|
|
48
47
|
SLUG_LIST_SEPARATOR: () => SLUG_LIST_SEPARATOR,
|
|
49
48
|
SLUG_PATH_SEPARATOR: () => SLUG_PATH_SEPARATOR,
|
|
50
|
-
SettingsAction: () => SettingsAction,
|
|
51
|
-
Surface: () => Surface,
|
|
52
|
-
SurfaceProvider: () =>
|
|
49
|
+
SettingsAction: () => import_chunk_JZ2JVKRY.SettingsAction,
|
|
50
|
+
Surface: () => import_chunk_EF67TRWJ.Surface,
|
|
51
|
+
SurfaceProvider: () => import_chunk_EF67TRWJ.SurfaceProvider,
|
|
53
52
|
Toast: () => Toast,
|
|
54
53
|
createApp: () => createApp,
|
|
55
54
|
defaultFileTypes: () => defaultFileTypes,
|
|
56
|
-
definePlugin: () =>
|
|
57
|
-
filterPlugins: () =>
|
|
58
|
-
findPlugin: () =>
|
|
55
|
+
definePlugin: () => import_chunk_QBM42OQ6.definePlugin,
|
|
56
|
+
filterPlugins: () => import_chunk_QBM42OQ6.filterPlugins,
|
|
57
|
+
findPlugin: () => import_chunk_QBM42OQ6.findPlugin,
|
|
59
58
|
firstIdInPart: () => firstIdInPart,
|
|
60
|
-
getPlugin: () =>
|
|
59
|
+
getPlugin: () => import_chunk_QBM42OQ6.getPlugin,
|
|
61
60
|
indexInPart: () => indexInPart,
|
|
62
|
-
initializePlugin: () => initializePlugin,
|
|
63
61
|
isLayoutAdjustment: () => isLayoutAdjustment,
|
|
64
62
|
isLayoutMode: () => isLayoutMode,
|
|
65
63
|
isLayoutParts: () => isLayoutParts,
|
|
66
|
-
isObject: () => isObject,
|
|
64
|
+
isObject: () => import_chunk_EF67TRWJ.isObject,
|
|
67
65
|
openIds: () => openIds,
|
|
68
66
|
parseFileManagerPlugin: () => parseFileManagerPlugin,
|
|
69
67
|
parseGraphBuilderPlugin: () => parseGraphBuilderPlugin,
|
|
70
68
|
parseGraphPlugin: () => parseGraphPlugin,
|
|
71
69
|
parseGraphSerializerPlugin: () => parseGraphSerializerPlugin,
|
|
72
|
-
parseIntentPlugin: () =>
|
|
73
|
-
parseIntentResolverPlugin: () =>
|
|
70
|
+
parseIntentPlugin: () => import_chunk_VOKMWTKO.parseIntentPlugin,
|
|
71
|
+
parseIntentResolverPlugin: () => import_chunk_VOKMWTKO.parseIntentResolverPlugin,
|
|
74
72
|
parseLayoutPlugin: () => parseLayoutPlugin,
|
|
75
73
|
parseMetadataRecordsPlugin: () => parseMetadataRecordsPlugin,
|
|
76
74
|
parseMetadataResolverPlugin: () => parseMetadataResolverPlugin,
|
|
77
75
|
parseNavigationPlugin: () => parseNavigationPlugin,
|
|
78
76
|
parsePluginHost: () => parsePluginHost,
|
|
79
|
-
parseRootSurfacePlugin: () =>
|
|
80
|
-
parseSettingsPlugin: () => parseSettingsPlugin,
|
|
81
|
-
parseSurfacePlugin: () =>
|
|
77
|
+
parseRootSurfacePlugin: () => import_chunk_EF67TRWJ.parseRootSurfacePlugin,
|
|
78
|
+
parseSettingsPlugin: () => import_chunk_JZ2JVKRY.parseSettingsPlugin,
|
|
79
|
+
parseSurfacePlugin: () => import_chunk_EF67TRWJ.parseSurfacePlugin,
|
|
82
80
|
parseTranslationsPlugin: () => parseTranslationsPlugin,
|
|
83
81
|
partLength: () => partLength,
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
useIntentResolver: () => import_chunk_DFST5IG5.useIntentResolver,
|
|
82
|
+
resolvePlugin: () => import_chunk_QBM42OQ6.resolvePlugin,
|
|
83
|
+
useIntent: () => import_chunk_VOKMWTKO.useIntent,
|
|
84
|
+
useIntentDispatcher: () => import_chunk_VOKMWTKO.useIntentDispatcher,
|
|
85
|
+
useIntentResolver: () => import_chunk_VOKMWTKO.useIntentResolver,
|
|
89
86
|
usePlugin: () => usePlugin,
|
|
90
87
|
usePlugins: () => usePlugins,
|
|
91
88
|
useResolvePlugin: () => useResolvePlugin,
|
|
92
89
|
useResolvePlugins: () => useResolvePlugins,
|
|
93
|
-
useSurface: () => useSurface,
|
|
94
|
-
useSurfaceRoot: () =>
|
|
90
|
+
useSurface: () => import_chunk_EF67TRWJ.useSurface,
|
|
91
|
+
useSurfaceRoot: () => import_chunk_EF67TRWJ.useSurfaceRoot
|
|
95
92
|
});
|
|
96
93
|
module.exports = __toCommonJS(node_exports);
|
|
97
|
-
var
|
|
98
|
-
var
|
|
99
|
-
var
|
|
94
|
+
var import_chunk_VOKMWTKO = require("./chunk-VOKMWTKO.cjs");
|
|
95
|
+
var import_chunk_EF67TRWJ = require("./chunk-EF67TRWJ.cjs");
|
|
96
|
+
var import_chunk_QBM42OQ6 = require("./chunk-QBM42OQ6.cjs");
|
|
97
|
+
var import_chunk_JZ2JVKRY = require("./chunk-JZ2JVKRY.cjs");
|
|
100
98
|
var import_zod = require("zod");
|
|
99
|
+
var import_schema = require("@effect/schema");
|
|
101
100
|
var import_zod2 = require("zod");
|
|
102
|
-
var import_echo_schema = require("@dxos/echo-schema");
|
|
103
101
|
var import_zod3 = require("zod");
|
|
104
|
-
var import_react = require("react");
|
|
105
|
-
var import_util = require("@dxos/util");
|
|
106
|
-
var import_react2 = __toESM(require("react"));
|
|
102
|
+
var import_react = __toESM(require("react"));
|
|
107
103
|
var import_local_storage = require("@dxos/local-storage");
|
|
104
|
+
var import_react2 = __toESM(require("react"));
|
|
108
105
|
var import_log = require("@dxos/log");
|
|
109
|
-
var import_react3 =
|
|
110
|
-
var import_react4 = __toESM(require("react"));
|
|
111
|
-
var import_react5 = require("react");
|
|
106
|
+
var import_react3 = require("react");
|
|
112
107
|
var import_debug = require("@dxos/debug");
|
|
113
|
-
var
|
|
108
|
+
var import_util = require("@dxos/util");
|
|
109
|
+
var import_react4 = __toESM(require("react"));
|
|
114
110
|
var import_invariant = require("@dxos/invariant");
|
|
115
111
|
var defaultFileTypes = {
|
|
116
112
|
images: [
|
|
@@ -184,7 +180,8 @@ var parseLayoutPlugin = (plugin) => {
|
|
|
184
180
|
const { success } = Layout.safeParse(plugin.provides.layout);
|
|
185
181
|
return success ? plugin : void 0;
|
|
186
182
|
};
|
|
187
|
-
var
|
|
183
|
+
var LAYOUT_PLUGIN = "dxos.org/plugin/layout";
|
|
184
|
+
var LAYOUT_ACTION = `${LAYOUT_PLUGIN}/action`;
|
|
188
185
|
var LayoutAction;
|
|
189
186
|
(function(LayoutAction2) {
|
|
190
187
|
LayoutAction2[LayoutAction2["SET_LAYOUT"] = `${LAYOUT_ACTION}/set-layout`] = "SET_LAYOUT";
|
|
@@ -203,18 +200,21 @@ var SLUG_ENTRY_SEPARATOR = "_";
|
|
|
203
200
|
var SLUG_KEY_VALUE_SEPARATOR = "-";
|
|
204
201
|
var SLUG_PATH_SEPARATOR = "~";
|
|
205
202
|
var SLUG_COLLECTION_INDICATOR = "";
|
|
206
|
-
var LayoutEntrySchema =
|
|
207
|
-
id:
|
|
208
|
-
path:
|
|
203
|
+
var LayoutEntrySchema = import_schema.Schema.mutable(import_schema.Schema.Struct({
|
|
204
|
+
id: import_schema.Schema.String,
|
|
205
|
+
path: import_schema.Schema.optional(import_schema.Schema.String)
|
|
209
206
|
}));
|
|
210
|
-
var LayoutPartSchema =
|
|
211
|
-
var LayoutPartsSchema =
|
|
212
|
-
|
|
207
|
+
var LayoutPartSchema = import_schema.Schema.Union(import_schema.Schema.Literal("sidebar"), import_schema.Schema.Literal("main"), import_schema.Schema.Literal("solo"), import_schema.Schema.Literal("complementary"), import_schema.Schema.Literal("fullScreen"));
|
|
208
|
+
var LayoutPartsSchema = import_schema.Schema.partial(import_schema.Schema.mutable(import_schema.Schema.Record({
|
|
209
|
+
key: LayoutPartSchema,
|
|
210
|
+
value: import_schema.Schema.mutable(import_schema.Schema.Array(LayoutEntrySchema))
|
|
211
|
+
})));
|
|
212
|
+
var LayoutCoordinateSchema = import_schema.Schema.mutable(import_schema.Schema.Struct({
|
|
213
213
|
part: LayoutPartSchema,
|
|
214
|
-
entryId:
|
|
214
|
+
entryId: import_schema.Schema.String
|
|
215
215
|
}));
|
|
216
|
-
var PartAdjustmentSchema =
|
|
217
|
-
var LayoutAdjustmentSchema =
|
|
216
|
+
var PartAdjustmentSchema = import_schema.Schema.Union(import_schema.Schema.Literal("increment-start"), import_schema.Schema.Literal("increment-end"), import_schema.Schema.Literal("solo"));
|
|
217
|
+
var LayoutAdjustmentSchema = import_schema.Schema.mutable(import_schema.Schema.Struct({
|
|
218
218
|
layoutCoordinate: LayoutCoordinateSchema,
|
|
219
219
|
type: PartAdjustmentSchema
|
|
220
220
|
}));
|
|
@@ -222,27 +222,24 @@ var ActiveParts = import_zod2.z.record(import_zod2.z.string(), import_zod2.z.uni
|
|
|
222
222
|
import_zod2.z.string(),
|
|
223
223
|
import_zod2.z.array(import_zod2.z.string())
|
|
224
224
|
]));
|
|
225
|
-
var
|
|
226
|
-
|
|
227
|
-
});
|
|
228
|
-
var LocationProvidesSchema = import_echo_schema.S.mutable(import_echo_schema.S.Struct({
|
|
229
|
-
location: import_echo_schema.S.Struct({
|
|
225
|
+
var LocationProvidesSchema = import_schema.Schema.mutable(import_schema.Schema.Struct({
|
|
226
|
+
location: import_schema.Schema.Struct({
|
|
230
227
|
active: LayoutPartsSchema,
|
|
231
|
-
closed:
|
|
228
|
+
closed: import_schema.Schema.Array(import_schema.Schema.String)
|
|
232
229
|
})
|
|
233
230
|
}));
|
|
234
231
|
var isLayoutParts = (value) => {
|
|
235
|
-
return
|
|
232
|
+
return import_schema.Schema.is(LayoutPartsSchema)(value);
|
|
236
233
|
};
|
|
237
234
|
var isLayoutAdjustment = (value) => {
|
|
238
|
-
return
|
|
235
|
+
return import_schema.Schema.is(LayoutAdjustmentSchema)(value);
|
|
239
236
|
};
|
|
240
237
|
var parseNavigationPlugin = (plugin) => {
|
|
241
238
|
const location = plugin.provides?.location;
|
|
242
239
|
if (!location) {
|
|
243
240
|
return void 0;
|
|
244
241
|
}
|
|
245
|
-
if (
|
|
242
|
+
if (import_schema.Schema.is(LocationProvidesSchema)({
|
|
246
243
|
location
|
|
247
244
|
})) {
|
|
248
245
|
return plugin;
|
|
@@ -271,7 +268,8 @@ var partLength = (layout, part) => {
|
|
|
271
268
|
}
|
|
272
269
|
return layout[part]?.length ?? 0;
|
|
273
270
|
};
|
|
274
|
-
var
|
|
271
|
+
var NAVIGATION_PLUGIN = "dxos.org/plugin/navigation";
|
|
272
|
+
var NAVIGATION_ACTION = `${NAVIGATION_PLUGIN}/action`;
|
|
275
273
|
var NavigationAction;
|
|
276
274
|
(function(NavigationAction2) {
|
|
277
275
|
NavigationAction2[NavigationAction2["OPEN"] = `${NAVIGATION_ACTION}/open`] = "OPEN";
|
|
@@ -281,14 +279,6 @@ var NavigationAction;
|
|
|
281
279
|
NavigationAction2[NavigationAction2["CLOSE"] = `${NAVIGATION_ACTION}/close`] = "CLOSE";
|
|
282
280
|
NavigationAction2[NavigationAction2["EXPOSE"] = `${NAVIGATION_ACTION}/expose`] = "EXPOSE";
|
|
283
281
|
})(NavigationAction || (NavigationAction = {}));
|
|
284
|
-
var parseSettingsPlugin = (plugin) => {
|
|
285
|
-
return typeof plugin.provides.settings === "object" ? plugin : void 0;
|
|
286
|
-
};
|
|
287
|
-
var SETTINGS_ACTION = "dxos.org/plugin/settings";
|
|
288
|
-
var SettingsAction;
|
|
289
|
-
(function(SettingsAction2) {
|
|
290
|
-
SettingsAction2[SettingsAction2["OPEN"] = `${SETTINGS_ACTION}/open`] = "OPEN";
|
|
291
|
-
})(SettingsAction || (SettingsAction = {}));
|
|
292
282
|
var ResourceKey = import_zod3.z.union([
|
|
293
283
|
import_zod3.z.string(),
|
|
294
284
|
import_zod3.z.record(import_zod3.z.any())
|
|
@@ -299,7 +289,6 @@ var parseTranslationsPlugin = (plugin) => {
|
|
|
299
289
|
const { success } = import_zod3.z.array(Resource).safeParse(plugin.provides.translations);
|
|
300
290
|
return success ? plugin : void 0;
|
|
301
291
|
};
|
|
302
|
-
var pluginMeta = (meta) => meta;
|
|
303
292
|
var Plugin;
|
|
304
293
|
(function(Plugin2) {
|
|
305
294
|
Plugin2.lazy = (p, props) => {
|
|
@@ -308,225 +297,24 @@ var Plugin;
|
|
|
308
297
|
});
|
|
309
298
|
};
|
|
310
299
|
})(Plugin || (Plugin = {}));
|
|
311
|
-
var
|
|
312
|
-
|
|
313
|
-
core: [],
|
|
314
|
-
enabled: [],
|
|
315
|
-
plugins: [],
|
|
316
|
-
available: [],
|
|
317
|
-
setPlugin: () => {
|
|
318
|
-
}
|
|
319
|
-
});
|
|
320
|
-
var usePlugins = () => (0, import_react.useContext)(PluginContext);
|
|
321
|
-
var usePlugin = (id) => {
|
|
322
|
-
const { plugins } = usePlugins();
|
|
323
|
-
return (0, import_chunk_62W6CMGM.findPlugin)(plugins, id);
|
|
324
|
-
};
|
|
325
|
-
var useResolvePlugin = (predicate) => {
|
|
326
|
-
const { plugins } = usePlugins();
|
|
327
|
-
return (0, import_chunk_62W6CMGM.resolvePlugin)(plugins, predicate);
|
|
328
|
-
};
|
|
329
|
-
var useResolvePlugins = (predicate) => {
|
|
330
|
-
const { plugins } = usePlugins();
|
|
331
|
-
return (0, import_react.useMemo)(() => plugins.map(predicate).filter(import_util.nonNullable), [
|
|
332
|
-
plugins,
|
|
333
|
-
predicate
|
|
334
|
-
]);
|
|
335
|
-
};
|
|
336
|
-
var PluginProvider = PluginContext.Provider;
|
|
337
|
-
var isObject = (data) => !!data && typeof data === "object";
|
|
338
|
-
var ErrorBoundary = class extends import_react3.Component {
|
|
339
|
-
constructor(props) {
|
|
340
|
-
super(props);
|
|
341
|
-
this.state = {
|
|
342
|
-
error: void 0
|
|
343
|
-
};
|
|
344
|
-
}
|
|
345
|
-
static getDerivedStateFromError(error) {
|
|
346
|
-
return {
|
|
347
|
-
error
|
|
348
|
-
};
|
|
349
|
-
}
|
|
350
|
-
componentDidUpdate(prevProps) {
|
|
351
|
-
if (prevProps.data !== this.props.data) {
|
|
352
|
-
this.resetError();
|
|
353
|
-
}
|
|
354
|
-
}
|
|
355
|
-
render() {
|
|
356
|
-
if (this.state.error) {
|
|
357
|
-
return /* @__PURE__ */ import_react3.default.createElement(this.props.fallback, {
|
|
358
|
-
data: this.props.data,
|
|
359
|
-
error: this.state.error,
|
|
360
|
-
reset: this.resetError
|
|
361
|
-
});
|
|
362
|
-
}
|
|
363
|
-
return this.props.children;
|
|
364
|
-
}
|
|
365
|
-
resetError() {
|
|
366
|
-
this.setState({
|
|
367
|
-
error: void 0
|
|
368
|
-
});
|
|
369
|
-
}
|
|
370
|
-
};
|
|
371
|
-
var Surface = /* @__PURE__ */ (0, import_react4.forwardRef)(({ role, name = role, fallback, placeholder, ...rest }, forwardedRef) => {
|
|
372
|
-
const props = {
|
|
373
|
-
role,
|
|
374
|
-
name,
|
|
375
|
-
fallback,
|
|
376
|
-
...rest
|
|
377
|
-
};
|
|
378
|
-
const context = (0, import_react5.useContext)(SurfaceContext);
|
|
379
|
-
const data = props.data ?? (name && context?.surfaces?.[name]?.data || {});
|
|
380
|
-
const resolver = /* @__PURE__ */ import_react4.default.createElement(SurfaceResolver, {
|
|
381
|
-
...props,
|
|
382
|
-
ref: forwardedRef
|
|
383
|
-
});
|
|
384
|
-
const suspense = placeholder ? /* @__PURE__ */ import_react4.default.createElement(import_react4.Suspense, {
|
|
385
|
-
fallback: placeholder
|
|
386
|
-
}, resolver) : resolver;
|
|
387
|
-
return fallback ? /* @__PURE__ */ import_react4.default.createElement(ErrorBoundary, {
|
|
388
|
-
data,
|
|
389
|
-
fallback
|
|
390
|
-
}, suspense) : suspense;
|
|
391
|
-
});
|
|
392
|
-
var SurfaceContext = /* @__PURE__ */ (0, import_react5.createContext)(null);
|
|
393
|
-
var useSurface = () => (0, import_react5.useContext)(SurfaceContext) ?? (0, import_debug.raise)(new Error("Surface context not found"));
|
|
394
|
-
var SurfaceResolver = /* @__PURE__ */ (0, import_react4.forwardRef)((props, forwardedRef) => {
|
|
395
|
-
const { components } = (0, import_chunk_P5GRB4XF.useSurfaceRoot)();
|
|
396
|
-
const parent = (0, import_react5.useContext)(SurfaceContext);
|
|
397
|
-
const nodes = resolveNodes(components, props, parent, forwardedRef);
|
|
398
|
-
const currentContext = {
|
|
399
|
-
...props,
|
|
400
|
-
surfaces: {
|
|
401
|
-
...props.name && parent?.surfaces?.[props.name]?.surfaces || {},
|
|
402
|
-
...props.surfaces
|
|
403
|
-
}
|
|
404
|
-
};
|
|
405
|
-
return /* @__PURE__ */ import_react4.default.createElement(SurfaceContext.Provider, {
|
|
406
|
-
value: currentContext
|
|
407
|
-
}, nodes);
|
|
408
|
-
});
|
|
409
|
-
var resolveNodes = (components, props, context, forwardedRef) => {
|
|
410
|
-
const data = {
|
|
411
|
-
...props.name && context?.surfaces?.[props.name]?.data || {},
|
|
412
|
-
...props.data
|
|
413
|
-
};
|
|
414
|
-
const nodes = Object.entries(components).map(([key, component]) => {
|
|
415
|
-
const result = component({
|
|
416
|
-
...props,
|
|
417
|
-
data
|
|
418
|
-
}, forwardedRef);
|
|
419
|
-
if (!result || typeof result !== "object") {
|
|
420
|
-
return void 0;
|
|
421
|
-
}
|
|
422
|
-
return "node" in result ? [
|
|
423
|
-
key,
|
|
424
|
-
result
|
|
425
|
-
] : /* @__PURE__ */ (0, import_react4.isValidElement)(result) ? [
|
|
426
|
-
key,
|
|
427
|
-
{
|
|
428
|
-
node: result
|
|
429
|
-
}
|
|
430
|
-
] : void 0;
|
|
431
|
-
}).filter((result) => Boolean(result)).sort(([, a], [, b]) => {
|
|
432
|
-
const aDisposition = a.disposition ?? "default";
|
|
433
|
-
const bDisposition = b.disposition ?? "default";
|
|
434
|
-
if (aDisposition === bDisposition) {
|
|
435
|
-
return 0;
|
|
436
|
-
} else if (aDisposition === "hoist" || bDisposition === "fallback") {
|
|
437
|
-
return -1;
|
|
438
|
-
} else if (bDisposition === "hoist" || aDisposition === "fallback") {
|
|
439
|
-
return 1;
|
|
440
|
-
}
|
|
441
|
-
return 0;
|
|
442
|
-
}).map(([key, result]) => /* @__PURE__ */ import_react4.default.createElement(import_react4.Fragment, {
|
|
443
|
-
key
|
|
444
|
-
}, result.node));
|
|
445
|
-
return props.limit ? nodes.slice(0, props.limit) : nodes;
|
|
446
|
-
};
|
|
447
|
-
var __dxlog_file = "/home/runner/work/dxos/dxos/packages/sdk/app-framework/src/plugins/PluginHost/PluginHost.tsx";
|
|
448
|
-
var parsePluginHost = (plugin) => plugin.provides.plugins ? plugin : void 0;
|
|
449
|
-
var PLUGIN_HOST = "dxos.org/plugin/host";
|
|
450
|
-
var PluginHost = ({ order, plugins: definitions, core = [], defaults = [], fallback = DefaultFallback, placeholder = null }) => {
|
|
451
|
-
const state = new import_local_storage.LocalStorageStore(PLUGIN_HOST, {
|
|
452
|
-
ready: false,
|
|
453
|
-
core,
|
|
454
|
-
enabled: [
|
|
455
|
-
...defaults
|
|
456
|
-
],
|
|
457
|
-
plugins: [],
|
|
458
|
-
available: order.filter(({ id }) => !core.includes(id)),
|
|
459
|
-
setPlugin: (id, enabled) => {
|
|
460
|
-
if (enabled) {
|
|
461
|
-
state.values.enabled.push(id);
|
|
462
|
-
} else {
|
|
463
|
-
const index = state.values.enabled.findIndex((enabled2) => enabled2 === id);
|
|
464
|
-
index !== -1 && state.values.enabled.splice(index, 1);
|
|
465
|
-
}
|
|
466
|
-
}
|
|
467
|
-
});
|
|
468
|
-
state.prop({
|
|
469
|
-
key: "enabled",
|
|
470
|
-
type: import_local_storage.LocalStorageStore.json()
|
|
471
|
-
});
|
|
472
|
-
return {
|
|
473
|
-
meta: {
|
|
474
|
-
id: PLUGIN_HOST,
|
|
475
|
-
name: "Plugin host"
|
|
476
|
-
},
|
|
477
|
-
provides: {
|
|
478
|
-
plugins: state.values,
|
|
479
|
-
context: ({ children }) => /* @__PURE__ */ import_react2.default.createElement(PluginProvider, {
|
|
480
|
-
value: state.values
|
|
481
|
-
}, children),
|
|
482
|
-
root: () => {
|
|
483
|
-
return /* @__PURE__ */ import_react2.default.createElement(ErrorBoundary, {
|
|
484
|
-
fallback
|
|
485
|
-
}, /* @__PURE__ */ import_react2.default.createElement(Root, {
|
|
486
|
-
order,
|
|
487
|
-
core,
|
|
488
|
-
definitions,
|
|
489
|
-
state: state.values,
|
|
490
|
-
placeholder
|
|
491
|
-
}));
|
|
492
|
-
}
|
|
493
|
-
}
|
|
494
|
-
};
|
|
495
|
-
};
|
|
496
|
-
var DefaultFallback = ({ error }) => {
|
|
497
|
-
return /* @__PURE__ */ import_react2.default.createElement("div", {
|
|
498
|
-
style: {
|
|
499
|
-
padding: "1rem"
|
|
500
|
-
}
|
|
501
|
-
}, /* @__PURE__ */ import_react2.default.createElement("h1", {
|
|
502
|
-
style: {
|
|
503
|
-
fontSize: "1.2rem",
|
|
504
|
-
fontWeight: 700,
|
|
505
|
-
margin: "0.5rem 0"
|
|
506
|
-
}
|
|
507
|
-
}, error.message), /* @__PURE__ */ import_react2.default.createElement("pre", null, error.stack));
|
|
508
|
-
};
|
|
509
|
-
var Root = ({ order, core: corePluginIds, definitions, state, placeholder }) => {
|
|
300
|
+
var __dxlog_file = "/home/runner/work/dxos/dxos/packages/sdk/app-framework/src/plugins/plugin-host/PluginContainer.tsx";
|
|
301
|
+
var PluginContainer = ({ plugins: definitions, core, state, placeholder }) => {
|
|
510
302
|
const [error, setError] = (0, import_react2.useState)();
|
|
511
303
|
(0, import_react2.useEffect)(() => {
|
|
512
304
|
(0, import_log.log)("initializing plugins", {
|
|
513
305
|
enabled: state.enabled
|
|
514
306
|
}, {
|
|
515
307
|
F: __dxlog_file,
|
|
516
|
-
L:
|
|
308
|
+
L: 26,
|
|
517
309
|
S: void 0,
|
|
518
310
|
C: (f, a) => f(...a)
|
|
519
311
|
});
|
|
520
|
-
const
|
|
312
|
+
const t = setTimeout(async () => {
|
|
521
313
|
try {
|
|
522
314
|
const enabledIds = [
|
|
523
|
-
...
|
|
315
|
+
...core,
|
|
524
316
|
...state.enabled
|
|
525
|
-
]
|
|
526
|
-
const indexA = order.findIndex(({ id }) => id === a);
|
|
527
|
-
const indexB = order.findIndex(({ id }) => id === b);
|
|
528
|
-
return indexA - indexB;
|
|
529
|
-
});
|
|
317
|
+
];
|
|
530
318
|
const enabled = await Promise.all(enabledIds.map((id) => definitions[id]).filter((definition) => Boolean(definition)).map((definition) => definition()));
|
|
531
319
|
const plugins = await Promise.all(enabled.map(async (definition) => {
|
|
532
320
|
const plugin = await initializePlugin(definition).catch((err) => {
|
|
@@ -535,39 +323,47 @@ var Root = ({ order, core: corePluginIds, definitions, state, placeholder }) =>
|
|
|
535
323
|
err
|
|
536
324
|
}, {
|
|
537
325
|
F: __dxlog_file,
|
|
538
|
-
L:
|
|
326
|
+
L: 41,
|
|
539
327
|
S: void 0,
|
|
540
328
|
C: (f, a) => f(...a)
|
|
541
329
|
});
|
|
542
|
-
|
|
330
|
+
});
|
|
331
|
+
(0, import_log.log)("initialized", {
|
|
332
|
+
plugin: definition.meta.id
|
|
333
|
+
}, {
|
|
334
|
+
F: __dxlog_file,
|
|
335
|
+
L: 44,
|
|
336
|
+
S: void 0,
|
|
337
|
+
C: (f, a) => f(...a)
|
|
543
338
|
});
|
|
544
339
|
return plugin;
|
|
545
|
-
}))
|
|
340
|
+
}));
|
|
341
|
+
const initialized = plugins.filter((plugin) => Boolean(plugin));
|
|
546
342
|
(0, import_log.log)("plugins initialized", {
|
|
547
|
-
plugins
|
|
343
|
+
plugins: initialized
|
|
548
344
|
}, {
|
|
549
345
|
F: __dxlog_file,
|
|
550
|
-
L:
|
|
346
|
+
L: 50,
|
|
551
347
|
S: void 0,
|
|
552
348
|
C: (f, a) => f(...a)
|
|
553
349
|
});
|
|
554
|
-
await Promise.all(enabled.map((
|
|
350
|
+
await Promise.all(enabled.map((plugin) => plugin.ready?.(initialized)));
|
|
555
351
|
(0, import_log.log)("plugins ready", {
|
|
556
|
-
plugins
|
|
352
|
+
plugins: initialized
|
|
557
353
|
}, {
|
|
558
354
|
F: __dxlog_file,
|
|
559
|
-
L:
|
|
355
|
+
L: 53,
|
|
560
356
|
S: void 0,
|
|
561
357
|
C: (f, a) => f(...a)
|
|
562
358
|
});
|
|
563
|
-
state.plugins =
|
|
359
|
+
state.plugins = initialized;
|
|
564
360
|
state.ready = true;
|
|
565
361
|
} catch (err) {
|
|
566
362
|
setError(err);
|
|
567
363
|
}
|
|
568
364
|
});
|
|
569
365
|
return () => {
|
|
570
|
-
clearTimeout(
|
|
366
|
+
clearTimeout(t);
|
|
571
367
|
state.ready = false;
|
|
572
368
|
};
|
|
573
369
|
}, []);
|
|
@@ -592,9 +388,9 @@ var initializePlugin = async (pluginDefinition) => {
|
|
|
592
388
|
};
|
|
593
389
|
var rootComponents = (plugins) => {
|
|
594
390
|
return plugins.map((plugin) => {
|
|
595
|
-
const
|
|
596
|
-
if (
|
|
597
|
-
return /* @__PURE__ */ import_react2.default.createElement(
|
|
391
|
+
const Component = plugin.provides.root;
|
|
392
|
+
if (Component) {
|
|
393
|
+
return /* @__PURE__ */ import_react2.default.createElement(Component, {
|
|
598
394
|
key: plugin.meta.id
|
|
599
395
|
});
|
|
600
396
|
} else {
|
|
@@ -610,60 +406,151 @@ var compose = (contexts) => {
|
|
|
610
406
|
...contexts
|
|
611
407
|
].reduce((Acc, Next) => ({ children }) => /* @__PURE__ */ import_react2.default.createElement(Acc, null, /* @__PURE__ */ import_react2.default.createElement(Next, null, children)));
|
|
612
408
|
};
|
|
613
|
-
var
|
|
614
|
-
var
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
409
|
+
var PluginContext = /* @__PURE__ */ (0, import_react3.createContext)(void 0);
|
|
410
|
+
var usePlugins = () => (0, import_react3.useContext)(PluginContext) ?? (0, import_debug.raise)(new Error("Missing PluginContext"));
|
|
411
|
+
var usePlugin = (id) => {
|
|
412
|
+
const { plugins } = usePlugins();
|
|
413
|
+
return (0, import_chunk_QBM42OQ6.findPlugin)(plugins, id);
|
|
414
|
+
};
|
|
415
|
+
var useResolvePlugin = (predicate) => {
|
|
416
|
+
const { plugins } = usePlugins();
|
|
417
|
+
return (0, import_chunk_QBM42OQ6.resolvePlugin)(plugins, predicate);
|
|
418
|
+
};
|
|
419
|
+
var useResolvePlugins = (predicate) => {
|
|
420
|
+
const { plugins } = usePlugins();
|
|
421
|
+
return (0, import_react3.useMemo)(() => plugins.map(predicate).filter(import_util.nonNullable), [
|
|
422
|
+
plugins,
|
|
423
|
+
predicate
|
|
424
|
+
]);
|
|
425
|
+
};
|
|
426
|
+
var PluginProvider = PluginContext.Provider;
|
|
427
|
+
var parsePluginHost = (plugin) => plugin.provides.plugins ? plugin : void 0;
|
|
428
|
+
var HOST_PLUGIN = "dxos.org/plugin/host";
|
|
429
|
+
var HostPlugin = ({ plugins, meta, core, defaults = [], fallback = DefaultFallback, placeholder = null }) => {
|
|
430
|
+
const state = new import_local_storage.LocalStorageStore(HOST_PLUGIN, {
|
|
431
|
+
ready: false,
|
|
432
|
+
core,
|
|
433
|
+
enabled: [
|
|
434
|
+
...defaults
|
|
620
435
|
],
|
|
436
|
+
plugins: [],
|
|
437
|
+
available: meta.filter(({ id }) => !core.includes(id)),
|
|
438
|
+
// TODO(burdon): Functions should not be part of the settings type.
|
|
439
|
+
setPlugin: (id, enabled) => {
|
|
440
|
+
if (enabled) {
|
|
441
|
+
state.values.enabled.push(id);
|
|
442
|
+
} else {
|
|
443
|
+
const index = state.values.enabled.findIndex((enabled2) => enabled2 === id);
|
|
444
|
+
index !== -1 && state.values.enabled.splice(index, 1);
|
|
445
|
+
}
|
|
446
|
+
}
|
|
447
|
+
});
|
|
448
|
+
state.prop({
|
|
449
|
+
key: "enabled",
|
|
450
|
+
type: import_local_storage.LocalStorageStore.json()
|
|
451
|
+
});
|
|
452
|
+
return {
|
|
453
|
+
meta: {
|
|
454
|
+
id: HOST_PLUGIN,
|
|
455
|
+
name: "Plugin host"
|
|
456
|
+
},
|
|
457
|
+
provides: {
|
|
458
|
+
plugins: state.values,
|
|
459
|
+
context: ({ children }) => {
|
|
460
|
+
return /* @__PURE__ */ import_react.default.createElement(PluginProvider, {
|
|
461
|
+
value: state.values
|
|
462
|
+
}, children);
|
|
463
|
+
},
|
|
464
|
+
root: () => {
|
|
465
|
+
return /* @__PURE__ */ import_react.default.createElement(import_chunk_EF67TRWJ.ErrorBoundary, {
|
|
466
|
+
fallback
|
|
467
|
+
}, /* @__PURE__ */ import_react.default.createElement(PluginContainer, {
|
|
468
|
+
plugins,
|
|
469
|
+
core,
|
|
470
|
+
state: state.values,
|
|
471
|
+
placeholder
|
|
472
|
+
}));
|
|
473
|
+
}
|
|
474
|
+
}
|
|
475
|
+
};
|
|
476
|
+
};
|
|
477
|
+
var DefaultFallback = ({ error }) => {
|
|
478
|
+
return /* @__PURE__ */ import_react.default.createElement("div", {
|
|
479
|
+
style: {
|
|
480
|
+
padding: "1rem"
|
|
481
|
+
}
|
|
482
|
+
}, /* @__PURE__ */ import_react.default.createElement("h1", {
|
|
483
|
+
style: {
|
|
484
|
+
fontSize: "1.2rem",
|
|
485
|
+
fontWeight: 700,
|
|
486
|
+
margin: "0.5rem 0"
|
|
487
|
+
}
|
|
488
|
+
}, error.message), /* @__PURE__ */ import_react.default.createElement("pre", null, error.stack));
|
|
489
|
+
};
|
|
490
|
+
var __dxlog_file2 = "/home/runner/work/dxos/dxos/packages/sdk/app-framework/src/App.tsx";
|
|
491
|
+
var createApp = ({ meta, plugins, core, ...params }) => {
|
|
492
|
+
const hostPlugin = HostPlugin({
|
|
621
493
|
plugins: {
|
|
622
494
|
...plugins,
|
|
623
|
-
[
|
|
624
|
-
[
|
|
495
|
+
[import_chunk_VOKMWTKO.meta_default.id]: Plugin.lazy(() => import("./plugin-intent-FMC4SDI3.cjs")),
|
|
496
|
+
[import_chunk_JZ2JVKRY.meta_default.id]: Plugin.lazy(() => import("./plugin-settings-OZ6IKAE5.cjs")),
|
|
497
|
+
[import_chunk_EF67TRWJ.meta_default.id]: Plugin.lazy(() => import("./plugin-surface-B5NHOBSW.cjs"))
|
|
625
498
|
},
|
|
499
|
+
meta: [
|
|
500
|
+
import_chunk_VOKMWTKO.meta_default,
|
|
501
|
+
import_chunk_JZ2JVKRY.meta_default,
|
|
502
|
+
import_chunk_EF67TRWJ.meta_default,
|
|
503
|
+
...meta
|
|
504
|
+
],
|
|
626
505
|
core: [
|
|
627
|
-
|
|
628
|
-
|
|
506
|
+
import_chunk_VOKMWTKO.meta_default.id,
|
|
507
|
+
import_chunk_JZ2JVKRY.meta_default.id,
|
|
508
|
+
import_chunk_EF67TRWJ.meta_default.id,
|
|
629
509
|
...core
|
|
630
510
|
],
|
|
631
511
|
...params
|
|
632
512
|
});
|
|
633
|
-
(0, import_invariant.invariant)(
|
|
513
|
+
(0, import_invariant.invariant)(hostPlugin.provides, void 0, {
|
|
514
|
+
F: __dxlog_file2,
|
|
515
|
+
L: 53,
|
|
516
|
+
S: void 0,
|
|
517
|
+
A: [
|
|
518
|
+
"hostPlugin.provides",
|
|
519
|
+
""
|
|
520
|
+
]
|
|
521
|
+
});
|
|
522
|
+
const { context: Context, root: Root } = hostPlugin.provides;
|
|
523
|
+
(0, import_invariant.invariant)(Context, void 0, {
|
|
634
524
|
F: __dxlog_file2,
|
|
635
|
-
L:
|
|
525
|
+
L: 55,
|
|
636
526
|
S: void 0,
|
|
637
527
|
A: [
|
|
638
|
-
"
|
|
528
|
+
"Context",
|
|
639
529
|
""
|
|
640
530
|
]
|
|
641
531
|
});
|
|
642
|
-
(0, import_invariant.invariant)(
|
|
532
|
+
(0, import_invariant.invariant)(Root, void 0, {
|
|
643
533
|
F: __dxlog_file2,
|
|
644
|
-
L:
|
|
534
|
+
L: 56,
|
|
645
535
|
S: void 0,
|
|
646
536
|
A: [
|
|
647
|
-
"
|
|
537
|
+
"Root",
|
|
648
538
|
""
|
|
649
539
|
]
|
|
650
540
|
});
|
|
651
|
-
|
|
652
|
-
const Root2 = host.provides.root;
|
|
653
|
-
return () => /* @__PURE__ */ import_react6.default.createElement(Context, null, /* @__PURE__ */ import_react6.default.createElement(Root2, null));
|
|
541
|
+
return () => /* @__PURE__ */ import_react4.default.createElement(Context, null, /* @__PURE__ */ import_react4.default.createElement(Root, null));
|
|
654
542
|
};
|
|
655
543
|
// Annotate the CommonJS export names for ESM import in node:
|
|
656
544
|
0 && (module.exports = {
|
|
657
545
|
ActiveParts,
|
|
658
|
-
Attention,
|
|
659
546
|
ErrorBoundary,
|
|
547
|
+
HostPlugin,
|
|
660
548
|
IntentAction,
|
|
661
549
|
IntentProvider,
|
|
662
550
|
Layout,
|
|
663
551
|
LayoutAction,
|
|
664
552
|
NavigationAction,
|
|
665
553
|
Plugin,
|
|
666
|
-
PluginHost,
|
|
667
554
|
PluginProvider,
|
|
668
555
|
Resource,
|
|
669
556
|
ResourceKey,
|
|
@@ -685,7 +572,6 @@ var createApp = ({ order, plugins, core = order.map(({ id }) => id), ...params }
|
|
|
685
572
|
firstIdInPart,
|
|
686
573
|
getPlugin,
|
|
687
574
|
indexInPart,
|
|
688
|
-
initializePlugin,
|
|
689
575
|
isLayoutAdjustment,
|
|
690
576
|
isLayoutMode,
|
|
691
577
|
isLayoutParts,
|
|
@@ -707,7 +593,6 @@ var createApp = ({ order, plugins, core = order.map(({ id }) => id), ...params }
|
|
|
707
593
|
parseSurfacePlugin,
|
|
708
594
|
parseTranslationsPlugin,
|
|
709
595
|
partLength,
|
|
710
|
-
pluginMeta,
|
|
711
596
|
resolvePlugin,
|
|
712
597
|
useIntent,
|
|
713
598
|
useIntentDispatcher,
|