@dxos/app-framework 0.3.11-main.0e40963 → 0.3.11-main.101b0f0
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-C2K6M6WC.mjs → chunk-7MQ2DVDI.mjs} +19 -2
- package/dist/lib/browser/chunk-7MQ2DVDI.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +185 -148
- package/dist/lib/browser/index.mjs.map +3 -3
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/plugin-KC4DT4AJ.mjs +109 -0
- package/dist/lib/browser/plugin-KC4DT4AJ.mjs.map +7 -0
- package/dist/lib/node/{chunk-BOQBLWMX.cjs → chunk-FETX4EGX.cjs} +26 -7
- package/dist/lib/node/chunk-FETX4EGX.cjs.map +7 -0
- package/dist/lib/node/index.cjs +182 -147
- package/dist/lib/node/index.cjs.map +3 -3
- package/dist/lib/node/meta.json +1 -1
- package/dist/lib/node/{plugin-WDNRX2SR.cjs → plugin-RDMDEGRT.cjs} +60 -14
- package/dist/lib/node/plugin-RDMDEGRT.cjs.map +7 -0
- package/dist/types/src/plugins/IntentPlugin/IntentContext.d.ts +10 -2
- package/dist/types/src/plugins/IntentPlugin/IntentContext.d.ts.map +1 -1
- package/dist/types/src/plugins/IntentPlugin/intent.d.ts +34 -1
- package/dist/types/src/plugins/IntentPlugin/intent.d.ts.map +1 -1
- package/dist/types/src/plugins/IntentPlugin/plugin.d.ts.map +1 -1
- package/dist/types/src/plugins/IntentPlugin/provides.d.ts +2 -2
- package/dist/types/src/plugins/IntentPlugin/provides.d.ts.map +1 -1
- package/dist/types/src/plugins/PluginHost/PluginHost.d.ts +4 -2
- package/dist/types/src/plugins/PluginHost/PluginHost.d.ts.map +1 -1
- package/dist/types/src/plugins/PluginHost/plugin.d.ts.map +1 -1
- package/dist/types/src/plugins/SurfacePlugin/Surface.d.ts +4 -5
- package/dist/types/src/plugins/SurfacePlugin/Surface.d.ts.map +1 -1
- package/dist/types/src/plugins/common/layout.d.ts +15 -14
- package/dist/types/src/plugins/common/layout.d.ts.map +1 -1
- package/package.json +8 -7
- package/project.json +3 -1
- package/src/plugins/IntentPlugin/IntentContext.tsx +27 -3
- package/src/plugins/IntentPlugin/intent.ts +41 -2
- package/src/plugins/IntentPlugin/plugin.tsx +56 -7
- package/src/plugins/IntentPlugin/provides.ts +2 -2
- package/src/plugins/PluginHost/PluginHost.tsx +92 -57
- package/src/plugins/PluginHost/plugin.ts +1 -0
- package/src/plugins/SurfacePlugin/Surface.tsx +15 -21
- package/src/plugins/common/layout.ts +15 -14
- package/tsconfig.json +3 -0
- package/dist/lib/browser/chunk-C2K6M6WC.mjs.map +0 -7
- package/dist/lib/browser/plugin-CBPJO5NB.mjs +0 -63
- package/dist/lib/browser/plugin-CBPJO5NB.mjs.map +0 -7
- package/dist/lib/node/chunk-BOQBLWMX.cjs.map +0 -7
- package/dist/lib/node/plugin-WDNRX2SR.cjs.map +0 -7
package/dist/lib/node/index.cjs
CHANGED
|
@@ -29,7 +29,7 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
29
29
|
var node_exports = {};
|
|
30
30
|
__export(node_exports, {
|
|
31
31
|
ErrorBoundary: () => ErrorBoundary,
|
|
32
|
-
IntentProvider: () =>
|
|
32
|
+
IntentProvider: () => import_chunk_FETX4EGX.IntentProvider,
|
|
33
33
|
Layout: () => Layout,
|
|
34
34
|
LayoutAction: () => LayoutAction,
|
|
35
35
|
Plugin: () => Plugin,
|
|
@@ -49,8 +49,8 @@ __export(node_exports, {
|
|
|
49
49
|
isObject: () => isObject,
|
|
50
50
|
parseGraphBuilderPlugin: () => parseGraphBuilderPlugin,
|
|
51
51
|
parseGraphPlugin: () => parseGraphPlugin,
|
|
52
|
-
parseIntentPlugin: () =>
|
|
53
|
-
parseIntentResolverPlugin: () =>
|
|
52
|
+
parseIntentPlugin: () => import_chunk_FETX4EGX.parseIntentPlugin,
|
|
53
|
+
parseIntentResolverPlugin: () => import_chunk_FETX4EGX.parseIntentResolverPlugin,
|
|
54
54
|
parseLayoutPlugin: () => parseLayoutPlugin,
|
|
55
55
|
parseMetadataRecordsPlugin: () => parseMetadataRecordsPlugin,
|
|
56
56
|
parseMetadataResolverPlugin: () => parseMetadataResolverPlugin,
|
|
@@ -61,7 +61,9 @@ __export(node_exports, {
|
|
|
61
61
|
parseTranslationsPlugin: () => parseTranslationsPlugin,
|
|
62
62
|
pluginMeta: () => pluginMeta,
|
|
63
63
|
resolvePlugin: () => import_chunk_VDKZ7AAF.resolvePlugin,
|
|
64
|
-
useIntent: () =>
|
|
64
|
+
useIntent: () => import_chunk_FETX4EGX.useIntent,
|
|
65
|
+
useIntentDispatcher: () => import_chunk_FETX4EGX.useIntentDispatcher,
|
|
66
|
+
useIntentResolver: () => import_chunk_FETX4EGX.useIntentResolver,
|
|
65
67
|
usePlugin: () => usePlugin,
|
|
66
68
|
usePlugins: () => usePlugins,
|
|
67
69
|
useResolvePlugin: () => useResolvePlugin,
|
|
@@ -69,7 +71,7 @@ __export(node_exports, {
|
|
|
69
71
|
});
|
|
70
72
|
module.exports = __toCommonJS(node_exports);
|
|
71
73
|
var import_chunk_DC3GU6QR = require("./chunk-DC3GU6QR.cjs");
|
|
72
|
-
var
|
|
74
|
+
var import_chunk_FETX4EGX = require("./chunk-FETX4EGX.cjs");
|
|
73
75
|
var import_chunk_VDKZ7AAF = require("./chunk-VDKZ7AAF.cjs");
|
|
74
76
|
var import_zod = require("zod");
|
|
75
77
|
var import_zod2 = require("zod");
|
|
@@ -144,7 +146,7 @@ var parseTranslationsPlugin = (plugin) => {
|
|
|
144
146
|
var pluginMeta = (meta) => meta;
|
|
145
147
|
var Plugin;
|
|
146
148
|
(function(Plugin2) {
|
|
147
|
-
|
|
149
|
+
Plugin2.lazy = (p, props) => {
|
|
148
150
|
return () => p().then(({ default: definition }) => {
|
|
149
151
|
return definition(props);
|
|
150
152
|
});
|
|
@@ -168,132 +170,6 @@ var useResolvePlugin = (predicate) => {
|
|
|
168
170
|
return (0, import_chunk_VDKZ7AAF.resolvePlugin)(plugins, predicate);
|
|
169
171
|
};
|
|
170
172
|
var PluginProvider = PluginContext.Provider;
|
|
171
|
-
var __dxlog_file = "/home/runner/work/dxos/dxos/packages/sdk/app-framework/src/plugins/PluginHost/PluginHost.tsx";
|
|
172
|
-
var parsePluginHost = (plugin) => plugin.provides.plugins ? plugin : void 0;
|
|
173
|
-
var PLUGIN_HOST = "dxos.org/plugin/host";
|
|
174
|
-
var PluginHost = ({ order, plugins: definitions, core = [], defaults = [], fallback = null }) => {
|
|
175
|
-
const state = new import_local_storage.LocalStorageStore(PLUGIN_HOST, {
|
|
176
|
-
ready: false,
|
|
177
|
-
enabled: [
|
|
178
|
-
...defaults
|
|
179
|
-
],
|
|
180
|
-
plugins: [],
|
|
181
|
-
available: order.filter(({ id }) => !core.includes(id)),
|
|
182
|
-
setPlugin: (id, enabled) => {
|
|
183
|
-
if (enabled) {
|
|
184
|
-
state.values.enabled = [
|
|
185
|
-
...state.values.enabled,
|
|
186
|
-
id
|
|
187
|
-
];
|
|
188
|
-
} else {
|
|
189
|
-
state.values.enabled = state.values.enabled.filter((enabled2) => enabled2 !== id);
|
|
190
|
-
}
|
|
191
|
-
}
|
|
192
|
-
});
|
|
193
|
-
state.prop(state.values.$enabled, "enabled", import_local_storage.LocalStorageStore.json);
|
|
194
|
-
return {
|
|
195
|
-
meta: {
|
|
196
|
-
id: PLUGIN_HOST,
|
|
197
|
-
name: "Plugin host"
|
|
198
|
-
},
|
|
199
|
-
provides: {
|
|
200
|
-
plugins: state.values,
|
|
201
|
-
context: ({ children }) => /* @__PURE__ */ import_react3.default.createElement(PluginProvider, {
|
|
202
|
-
value: state.values
|
|
203
|
-
}, children),
|
|
204
|
-
root: () => {
|
|
205
|
-
(0, import_react3.useEffect)(() => {
|
|
206
|
-
(0, import_log.log)("initializing plugins", {
|
|
207
|
-
enabled: state.values.enabled
|
|
208
|
-
}, {
|
|
209
|
-
F: __dxlog_file,
|
|
210
|
-
L: 67,
|
|
211
|
-
S: void 0,
|
|
212
|
-
C: (f, a) => f(...a)
|
|
213
|
-
});
|
|
214
|
-
const timeout = setTimeout(async () => {
|
|
215
|
-
const enabledIds = [
|
|
216
|
-
...core,
|
|
217
|
-
...state.values.enabled
|
|
218
|
-
].sort((a, b) => {
|
|
219
|
-
const indexA = order.findIndex(({ id }) => id === a);
|
|
220
|
-
const indexB = order.findIndex(({ id }) => id === b);
|
|
221
|
-
return indexA - indexB;
|
|
222
|
-
});
|
|
223
|
-
const enabled = await Promise.all(enabledIds.map((id) => definitions[id]).filter((definition) => Boolean(definition)).map((definition) => definition()));
|
|
224
|
-
const plugins = await Promise.all(enabled.map(async (definition) => {
|
|
225
|
-
const plugin = await initializePlugin(definition).catch((err) => {
|
|
226
|
-
console.error("Failed to initialize plugin:", definition.meta.id, err);
|
|
227
|
-
return void 0;
|
|
228
|
-
});
|
|
229
|
-
return plugin;
|
|
230
|
-
})).then((plugins2) => plugins2.filter((plugin) => Boolean(plugin)));
|
|
231
|
-
(0, import_log.log)("plugins initialized", {
|
|
232
|
-
plugins
|
|
233
|
-
}, {
|
|
234
|
-
F: __dxlog_file,
|
|
235
|
-
L: 92,
|
|
236
|
-
S: void 0,
|
|
237
|
-
C: (f, a) => f(...a)
|
|
238
|
-
});
|
|
239
|
-
await Promise.all(enabled.map(async (pluginDefinition) => {
|
|
240
|
-
await pluginDefinition.ready?.(plugins);
|
|
241
|
-
}));
|
|
242
|
-
(0, import_log.log)("plugins ready", {
|
|
243
|
-
plugins
|
|
244
|
-
}, {
|
|
245
|
-
F: __dxlog_file,
|
|
246
|
-
L: 99,
|
|
247
|
-
S: void 0,
|
|
248
|
-
C: (f, a) => f(...a)
|
|
249
|
-
});
|
|
250
|
-
state.values.plugins = (0, import_react2.shallow)(plugins);
|
|
251
|
-
state.values.ready = true;
|
|
252
|
-
});
|
|
253
|
-
return () => {
|
|
254
|
-
clearTimeout(timeout);
|
|
255
|
-
state.values.ready = false;
|
|
256
|
-
};
|
|
257
|
-
}, []);
|
|
258
|
-
if (!state.values.ready) {
|
|
259
|
-
return /* @__PURE__ */ import_react3.default.createElement(import_react3.default.Fragment, null, fallback);
|
|
260
|
-
}
|
|
261
|
-
const ComposedContext = composeContext(state.values.plugins);
|
|
262
|
-
return /* @__PURE__ */ import_react3.default.createElement(ComposedContext, null, rootComponents(state.values.plugins));
|
|
263
|
-
}
|
|
264
|
-
}
|
|
265
|
-
};
|
|
266
|
-
};
|
|
267
|
-
var initializePlugin = async (pluginDefinition) => {
|
|
268
|
-
const provides = await pluginDefinition.initialize?.();
|
|
269
|
-
return {
|
|
270
|
-
...pluginDefinition,
|
|
271
|
-
provides: {
|
|
272
|
-
...pluginDefinition.provides,
|
|
273
|
-
...provides
|
|
274
|
-
}
|
|
275
|
-
};
|
|
276
|
-
};
|
|
277
|
-
var rootComponents = (plugins) => {
|
|
278
|
-
return plugins.map((plugin) => {
|
|
279
|
-
const Component2 = plugin.provides.root;
|
|
280
|
-
if (Component2) {
|
|
281
|
-
return /* @__PURE__ */ import_react3.default.createElement(Component2, {
|
|
282
|
-
key: plugin.meta.id
|
|
283
|
-
});
|
|
284
|
-
} else {
|
|
285
|
-
return null;
|
|
286
|
-
}
|
|
287
|
-
}).filter((node) => Boolean(node));
|
|
288
|
-
};
|
|
289
|
-
var composeContext = (plugins) => {
|
|
290
|
-
return compose(plugins.map((p) => p.provides.context).filter(Boolean));
|
|
291
|
-
};
|
|
292
|
-
var compose = (contexts) => {
|
|
293
|
-
return [
|
|
294
|
-
...contexts
|
|
295
|
-
].reduce((Acc, Next) => ({ children }) => /* @__PURE__ */ import_react3.default.createElement(Acc, null, /* @__PURE__ */ import_react3.default.createElement(Next, null, children)));
|
|
296
|
-
};
|
|
297
173
|
var isObject = (data) => !!data && typeof data === "object";
|
|
298
174
|
var ErrorBoundary = class extends import_react4.Component {
|
|
299
175
|
constructor(props) {
|
|
@@ -327,7 +203,7 @@ var ErrorBoundary = class extends import_react4.Component {
|
|
|
327
203
|
});
|
|
328
204
|
}
|
|
329
205
|
};
|
|
330
|
-
var Surface = /* @__PURE__ */ (0, import_react5.forwardRef)(({ role, name = role, fallback, ...rest }, forwardedRef) => {
|
|
206
|
+
var Surface = /* @__PURE__ */ (0, import_react5.forwardRef)(({ role, name = role, fallback, placeholder, ...rest }, forwardedRef) => {
|
|
331
207
|
const props = {
|
|
332
208
|
role,
|
|
333
209
|
name,
|
|
@@ -336,16 +212,17 @@ var Surface = /* @__PURE__ */ (0, import_react5.forwardRef)(({ role, name = role
|
|
|
336
212
|
};
|
|
337
213
|
const context = (0, import_react6.useContext)(SurfaceContext);
|
|
338
214
|
const data = props.data ?? (name && context?.surfaces?.[name]?.data || {});
|
|
339
|
-
|
|
340
|
-
data,
|
|
341
|
-
fallback
|
|
342
|
-
}, /* @__PURE__ */ import_react5.default.createElement(SurfaceResolver, {
|
|
343
|
-
...props,
|
|
344
|
-
ref: forwardedRef
|
|
345
|
-
})) : /* @__PURE__ */ import_react5.default.createElement(SurfaceResolver, {
|
|
215
|
+
const resolver = /* @__PURE__ */ import_react5.default.createElement(SurfaceResolver, {
|
|
346
216
|
...props,
|
|
347
217
|
ref: forwardedRef
|
|
348
|
-
})
|
|
218
|
+
});
|
|
219
|
+
const suspense = placeholder ? /* @__PURE__ */ import_react5.default.createElement(import_react5.Suspense, {
|
|
220
|
+
fallback: placeholder
|
|
221
|
+
}, resolver) : resolver;
|
|
222
|
+
return fallback ? /* @__PURE__ */ import_react5.default.createElement(ErrorBoundary, {
|
|
223
|
+
data,
|
|
224
|
+
fallback
|
|
225
|
+
}, suspense) : suspense;
|
|
349
226
|
});
|
|
350
227
|
var SurfaceContext = /* @__PURE__ */ (0, import_react6.createContext)(null);
|
|
351
228
|
var SurfaceResolver = /* @__PURE__ */ (0, import_react5.forwardRef)((props, forwardedRef) => {
|
|
@@ -361,7 +238,7 @@ var SurfaceResolver = /* @__PURE__ */ (0, import_react5.forwardRef)((props, forw
|
|
|
361
238
|
};
|
|
362
239
|
return /* @__PURE__ */ import_react5.default.createElement(SurfaceContext.Provider, {
|
|
363
240
|
value: currentContext
|
|
364
|
-
}, nodes
|
|
241
|
+
}, nodes);
|
|
365
242
|
});
|
|
366
243
|
var resolveNodes = (components, props, context, forwardedRef) => {
|
|
367
244
|
const data = {
|
|
@@ -401,22 +278,178 @@ var resolveNodes = (components, props, context, forwardedRef) => {
|
|
|
401
278
|
}, result.node));
|
|
402
279
|
return props.limit ? nodes.slice(0, props.limit) : nodes;
|
|
403
280
|
};
|
|
281
|
+
var __dxlog_file = "/home/runner/work/dxos/dxos/packages/sdk/app-framework/src/plugins/PluginHost/PluginHost.tsx";
|
|
282
|
+
var parsePluginHost = (plugin) => plugin.provides.plugins ? plugin : void 0;
|
|
283
|
+
var PLUGIN_HOST = "dxos.org/plugin/host";
|
|
284
|
+
var PluginHost = ({ order, plugins: definitions, core = [], defaults = [], fallback = DefaultFallback, placeholder = null }) => {
|
|
285
|
+
const state = new import_local_storage.LocalStorageStore(PLUGIN_HOST, {
|
|
286
|
+
ready: false,
|
|
287
|
+
enabled: [
|
|
288
|
+
...defaults
|
|
289
|
+
],
|
|
290
|
+
plugins: [],
|
|
291
|
+
available: order.filter(({ id }) => !core.includes(id)),
|
|
292
|
+
setPlugin: (id, enabled) => {
|
|
293
|
+
if (enabled) {
|
|
294
|
+
state.values.enabled = [
|
|
295
|
+
...state.values.enabled,
|
|
296
|
+
id
|
|
297
|
+
];
|
|
298
|
+
} else {
|
|
299
|
+
state.values.enabled = state.values.enabled.filter((enabled2) => enabled2 !== id);
|
|
300
|
+
}
|
|
301
|
+
}
|
|
302
|
+
});
|
|
303
|
+
state.prop(state.values.$enabled, "enabled", import_local_storage.LocalStorageStore.json);
|
|
304
|
+
return {
|
|
305
|
+
meta: {
|
|
306
|
+
id: PLUGIN_HOST,
|
|
307
|
+
name: "Plugin host"
|
|
308
|
+
},
|
|
309
|
+
provides: {
|
|
310
|
+
plugins: state.values,
|
|
311
|
+
context: ({ children }) => /* @__PURE__ */ import_react3.default.createElement(PluginProvider, {
|
|
312
|
+
value: state.values
|
|
313
|
+
}, children),
|
|
314
|
+
root: () => {
|
|
315
|
+
return /* @__PURE__ */ import_react3.default.createElement(ErrorBoundary, {
|
|
316
|
+
fallback
|
|
317
|
+
}, /* @__PURE__ */ import_react3.default.createElement(Root, {
|
|
318
|
+
order,
|
|
319
|
+
core,
|
|
320
|
+
definitions,
|
|
321
|
+
state: state.values,
|
|
322
|
+
placeholder
|
|
323
|
+
}));
|
|
324
|
+
}
|
|
325
|
+
}
|
|
326
|
+
};
|
|
327
|
+
};
|
|
328
|
+
var DefaultFallback = ({ error }) => {
|
|
329
|
+
return /* @__PURE__ */ import_react3.default.createElement("div", {
|
|
330
|
+
style: {
|
|
331
|
+
padding: "1rem"
|
|
332
|
+
}
|
|
333
|
+
}, /* @__PURE__ */ import_react3.default.createElement("h1", {
|
|
334
|
+
style: {
|
|
335
|
+
fontSize: "1.2rem",
|
|
336
|
+
fontWeight: 700,
|
|
337
|
+
margin: "0.5rem 0"
|
|
338
|
+
}
|
|
339
|
+
}, error.message), /* @__PURE__ */ import_react3.default.createElement("pre", null, error.stack));
|
|
340
|
+
};
|
|
341
|
+
var Root = ({ order, core: corePluginIds, definitions, state, placeholder }) => {
|
|
342
|
+
const [error, setError] = (0, import_react3.useState)();
|
|
343
|
+
(0, import_react3.useEffect)(() => {
|
|
344
|
+
(0, import_log.log)("initializing plugins", {
|
|
345
|
+
enabled: state.enabled
|
|
346
|
+
}, {
|
|
347
|
+
F: __dxlog_file,
|
|
348
|
+
L: 101,
|
|
349
|
+
S: void 0,
|
|
350
|
+
C: (f, a) => f(...a)
|
|
351
|
+
});
|
|
352
|
+
const timeout = setTimeout(async () => {
|
|
353
|
+
try {
|
|
354
|
+
const enabledIds = [
|
|
355
|
+
...corePluginIds,
|
|
356
|
+
...state.enabled
|
|
357
|
+
].sort((a, b) => {
|
|
358
|
+
const indexA = order.findIndex(({ id }) => id === a);
|
|
359
|
+
const indexB = order.findIndex(({ id }) => id === b);
|
|
360
|
+
return indexA - indexB;
|
|
361
|
+
});
|
|
362
|
+
const enabled = await Promise.all(enabledIds.map((id) => definitions[id]).filter((definition) => Boolean(definition)).map((definition) => definition()));
|
|
363
|
+
const plugins = await Promise.all(enabled.map(async (definition) => {
|
|
364
|
+
const plugin = await initializePlugin(definition).catch((err) => {
|
|
365
|
+
console.error("Failed to initialize plugin:", definition.meta.id, err);
|
|
366
|
+
return void 0;
|
|
367
|
+
});
|
|
368
|
+
return plugin;
|
|
369
|
+
})).then((plugins2) => plugins2.filter((plugin) => Boolean(plugin)));
|
|
370
|
+
(0, import_log.log)("plugins initialized", {
|
|
371
|
+
plugins
|
|
372
|
+
}, {
|
|
373
|
+
F: __dxlog_file,
|
|
374
|
+
L: 127,
|
|
375
|
+
S: void 0,
|
|
376
|
+
C: (f, a) => f(...a)
|
|
377
|
+
});
|
|
378
|
+
await Promise.all(enabled.map((pluginDefinition) => pluginDefinition.ready?.(plugins)));
|
|
379
|
+
(0, import_log.log)("plugins ready", {
|
|
380
|
+
plugins
|
|
381
|
+
}, {
|
|
382
|
+
F: __dxlog_file,
|
|
383
|
+
L: 130,
|
|
384
|
+
S: void 0,
|
|
385
|
+
C: (f, a) => f(...a)
|
|
386
|
+
});
|
|
387
|
+
state.plugins = (0, import_react2.shallow)(plugins);
|
|
388
|
+
state.ready = true;
|
|
389
|
+
} catch (err) {
|
|
390
|
+
setError(err);
|
|
391
|
+
}
|
|
392
|
+
});
|
|
393
|
+
return () => {
|
|
394
|
+
clearTimeout(timeout);
|
|
395
|
+
state.ready = false;
|
|
396
|
+
};
|
|
397
|
+
}, []);
|
|
398
|
+
if (error) {
|
|
399
|
+
throw error;
|
|
400
|
+
}
|
|
401
|
+
if (!state.ready) {
|
|
402
|
+
return /* @__PURE__ */ import_react3.default.createElement(import_react3.default.Fragment, null, placeholder);
|
|
403
|
+
}
|
|
404
|
+
const ComposedContext = composeContext(state.plugins);
|
|
405
|
+
return /* @__PURE__ */ import_react3.default.createElement(ComposedContext, null, rootComponents(state.plugins));
|
|
406
|
+
};
|
|
407
|
+
var initializePlugin = async (pluginDefinition) => {
|
|
408
|
+
const provides = await pluginDefinition.initialize?.();
|
|
409
|
+
return {
|
|
410
|
+
...pluginDefinition,
|
|
411
|
+
provides: {
|
|
412
|
+
...pluginDefinition.provides,
|
|
413
|
+
...provides
|
|
414
|
+
}
|
|
415
|
+
};
|
|
416
|
+
};
|
|
417
|
+
var rootComponents = (plugins) => {
|
|
418
|
+
return plugins.map((plugin) => {
|
|
419
|
+
const Component2 = plugin.provides.root;
|
|
420
|
+
if (Component2) {
|
|
421
|
+
return /* @__PURE__ */ import_react3.default.createElement(Component2, {
|
|
422
|
+
key: plugin.meta.id
|
|
423
|
+
});
|
|
424
|
+
} else {
|
|
425
|
+
return null;
|
|
426
|
+
}
|
|
427
|
+
}).filter((node) => Boolean(node));
|
|
428
|
+
};
|
|
429
|
+
var composeContext = (plugins) => {
|
|
430
|
+
return compose(plugins.map((p) => p.provides.context).filter(Boolean));
|
|
431
|
+
};
|
|
432
|
+
var compose = (contexts) => {
|
|
433
|
+
return [
|
|
434
|
+
...contexts
|
|
435
|
+
].reduce((Acc, Next) => ({ children }) => /* @__PURE__ */ import_react3.default.createElement(Acc, null, /* @__PURE__ */ import_react3.default.createElement(Next, null, children)));
|
|
436
|
+
};
|
|
404
437
|
var __dxlog_file2 = "/home/runner/work/dxos/dxos/packages/sdk/app-framework/src/App.tsx";
|
|
405
438
|
var createApp = ({ order, plugins, core = order.map(({ id }) => id), ...params }) => {
|
|
406
439
|
const host = PluginHost({
|
|
407
440
|
order: [
|
|
408
441
|
import_chunk_DC3GU6QR.meta_default,
|
|
409
|
-
|
|
442
|
+
import_chunk_FETX4EGX.meta_default,
|
|
410
443
|
...order
|
|
411
444
|
],
|
|
412
445
|
plugins: {
|
|
413
446
|
...plugins,
|
|
414
447
|
[import_chunk_DC3GU6QR.meta_default.id]: Plugin.lazy(() => import("./plugin-JGSJGRMS.cjs")),
|
|
415
|
-
[
|
|
448
|
+
[import_chunk_FETX4EGX.meta_default.id]: Plugin.lazy(() => import("./plugin-RDMDEGRT.cjs"))
|
|
416
449
|
},
|
|
417
450
|
core: [
|
|
418
451
|
import_chunk_DC3GU6QR.meta_default.id,
|
|
419
|
-
|
|
452
|
+
import_chunk_FETX4EGX.meta_default.id,
|
|
420
453
|
...core
|
|
421
454
|
],
|
|
422
455
|
...params
|
|
@@ -440,8 +473,8 @@ var createApp = ({ order, plugins, core = order.map(({ id }) => id), ...params }
|
|
|
440
473
|
]
|
|
441
474
|
});
|
|
442
475
|
const Context = host.provides.context;
|
|
443
|
-
const
|
|
444
|
-
return () => /* @__PURE__ */ import_react7.default.createElement(Context, null, /* @__PURE__ */ import_react7.default.createElement(
|
|
476
|
+
const Root2 = host.provides.root;
|
|
477
|
+
return () => /* @__PURE__ */ import_react7.default.createElement(Context, null, /* @__PURE__ */ import_react7.default.createElement(Root2, null));
|
|
445
478
|
};
|
|
446
479
|
// Annotate the CommonJS export names for ESM import in node:
|
|
447
480
|
0 && (module.exports = {
|
|
@@ -479,6 +512,8 @@ var createApp = ({ order, plugins, core = order.map(({ id }) => id), ...params }
|
|
|
479
512
|
pluginMeta,
|
|
480
513
|
resolvePlugin,
|
|
481
514
|
useIntent,
|
|
515
|
+
useIntentDispatcher,
|
|
516
|
+
useIntentResolver,
|
|
482
517
|
usePlugin,
|
|
483
518
|
usePlugins,
|
|
484
519
|
useResolvePlugin,
|