@dxos/app-framework 0.3.11-main.f5e7551 → 0.3.11-main.f7c1031
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 +186 -148
- package/dist/lib/browser/index.mjs.map +3 -3
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/plugin-PGPBA2JO.mjs +111 -0
- package/dist/lib/browser/plugin-PGPBA2JO.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 +183 -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-HLGHD6N5.cjs} +63 -14
- package/dist/lib/node/plugin-HLGHD6N5.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 +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 +17 -15
- 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 -1
- package/src/plugins/IntentPlugin/plugin.tsx +60 -7
- package/src/plugins/IntentPlugin/provides.ts +2 -2
- package/src/plugins/PluginHost/PluginHost.tsx +92 -57
- package/src/plugins/PluginHost/plugin.ts +2 -1
- package/src/plugins/SurfacePlugin/Surface.tsx +15 -21
- package/src/plugins/common/layout.ts +16 -14
- package/src/vite-env.d.ts +5 -0
- 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");
|
|
@@ -115,6 +117,7 @@ var LayoutAction;
|
|
|
115
117
|
LayoutAction2[LayoutAction2["OPEN_POPOVER"] = `${LAYOUT_ACTION}/open-popover`] = "OPEN_POPOVER";
|
|
116
118
|
LayoutAction2[LayoutAction2["CLOSE_POPOVER"] = `${LAYOUT_ACTION}/close-popover`] = "CLOSE_POPOVER";
|
|
117
119
|
LayoutAction2[LayoutAction2["ACTIVATE"] = `${LAYOUT_ACTION}/activate`] = "ACTIVATE";
|
|
120
|
+
LayoutAction2[LayoutAction2["FOCUS"] = `${LAYOUT_ACTION}/focus`] = "FOCUS";
|
|
118
121
|
})(LayoutAction || (LayoutAction = {}));
|
|
119
122
|
var parseMetadataRecordsPlugin = (plugin) => {
|
|
120
123
|
return plugin.provides.metadata?.records ? plugin : void 0;
|
|
@@ -143,7 +146,7 @@ var parseTranslationsPlugin = (plugin) => {
|
|
|
143
146
|
var pluginMeta = (meta) => meta;
|
|
144
147
|
var Plugin;
|
|
145
148
|
(function(Plugin2) {
|
|
146
|
-
|
|
149
|
+
Plugin2.lazy = (p, props) => {
|
|
147
150
|
return () => p().then(({ default: definition }) => {
|
|
148
151
|
return definition(props);
|
|
149
152
|
});
|
|
@@ -167,132 +170,6 @@ var useResolvePlugin = (predicate) => {
|
|
|
167
170
|
return (0, import_chunk_VDKZ7AAF.resolvePlugin)(plugins, predicate);
|
|
168
171
|
};
|
|
169
172
|
var PluginProvider = PluginContext.Provider;
|
|
170
|
-
var __dxlog_file = "/home/runner/work/dxos/dxos/packages/sdk/app-framework/src/plugins/PluginHost/PluginHost.tsx";
|
|
171
|
-
var parsePluginHost = (plugin) => plugin.provides.plugins ? plugin : void 0;
|
|
172
|
-
var PLUGIN_HOST = "dxos.org/plugin/host";
|
|
173
|
-
var PluginHost = ({ order, plugins: definitions, core = [], defaults = [], fallback = null }) => {
|
|
174
|
-
const state = new import_local_storage.LocalStorageStore(PLUGIN_HOST, {
|
|
175
|
-
ready: false,
|
|
176
|
-
enabled: [
|
|
177
|
-
...defaults
|
|
178
|
-
],
|
|
179
|
-
plugins: [],
|
|
180
|
-
available: order.filter(({ id }) => !core.includes(id)),
|
|
181
|
-
setPlugin: (id, enabled) => {
|
|
182
|
-
if (enabled) {
|
|
183
|
-
state.values.enabled = [
|
|
184
|
-
...state.values.enabled,
|
|
185
|
-
id
|
|
186
|
-
];
|
|
187
|
-
} else {
|
|
188
|
-
state.values.enabled = state.values.enabled.filter((enabled2) => enabled2 !== id);
|
|
189
|
-
}
|
|
190
|
-
}
|
|
191
|
-
});
|
|
192
|
-
state.prop(state.values.$enabled, "enabled", import_local_storage.LocalStorageStore.json);
|
|
193
|
-
return {
|
|
194
|
-
meta: {
|
|
195
|
-
id: PLUGIN_HOST,
|
|
196
|
-
name: "Plugin host"
|
|
197
|
-
},
|
|
198
|
-
provides: {
|
|
199
|
-
plugins: state.values,
|
|
200
|
-
context: ({ children }) => /* @__PURE__ */ import_react3.default.createElement(PluginProvider, {
|
|
201
|
-
value: state.values
|
|
202
|
-
}, children),
|
|
203
|
-
root: () => {
|
|
204
|
-
(0, import_react3.useEffect)(() => {
|
|
205
|
-
(0, import_log.log)("initializing plugins", {
|
|
206
|
-
enabled: state.values.enabled
|
|
207
|
-
}, {
|
|
208
|
-
F: __dxlog_file,
|
|
209
|
-
L: 67,
|
|
210
|
-
S: void 0,
|
|
211
|
-
C: (f, a) => f(...a)
|
|
212
|
-
});
|
|
213
|
-
const timeout = setTimeout(async () => {
|
|
214
|
-
const enabledIds = [
|
|
215
|
-
...core,
|
|
216
|
-
...state.values.enabled
|
|
217
|
-
].sort((a, b) => {
|
|
218
|
-
const indexA = order.findIndex(({ id }) => id === a);
|
|
219
|
-
const indexB = order.findIndex(({ id }) => id === b);
|
|
220
|
-
return indexA - indexB;
|
|
221
|
-
});
|
|
222
|
-
const enabled = await Promise.all(enabledIds.map((id) => definitions[id]).filter((definition) => Boolean(definition)).map((definition) => definition()));
|
|
223
|
-
const plugins = await Promise.all(enabled.map(async (definition) => {
|
|
224
|
-
const plugin = await initializePlugin(definition).catch((err) => {
|
|
225
|
-
console.error("Failed to initialize plugin:", definition.meta.id, err);
|
|
226
|
-
return void 0;
|
|
227
|
-
});
|
|
228
|
-
return plugin;
|
|
229
|
-
})).then((plugins2) => plugins2.filter((plugin) => Boolean(plugin)));
|
|
230
|
-
(0, import_log.log)("plugins initialized", {
|
|
231
|
-
plugins
|
|
232
|
-
}, {
|
|
233
|
-
F: __dxlog_file,
|
|
234
|
-
L: 92,
|
|
235
|
-
S: void 0,
|
|
236
|
-
C: (f, a) => f(...a)
|
|
237
|
-
});
|
|
238
|
-
await Promise.all(enabled.map(async (pluginDefinition) => {
|
|
239
|
-
await pluginDefinition.ready?.(plugins);
|
|
240
|
-
}));
|
|
241
|
-
(0, import_log.log)("plugins ready", {
|
|
242
|
-
plugins
|
|
243
|
-
}, {
|
|
244
|
-
F: __dxlog_file,
|
|
245
|
-
L: 99,
|
|
246
|
-
S: void 0,
|
|
247
|
-
C: (f, a) => f(...a)
|
|
248
|
-
});
|
|
249
|
-
state.values.plugins = (0, import_react2.shallow)(plugins);
|
|
250
|
-
state.values.ready = true;
|
|
251
|
-
});
|
|
252
|
-
return () => {
|
|
253
|
-
clearTimeout(timeout);
|
|
254
|
-
state.values.ready = false;
|
|
255
|
-
};
|
|
256
|
-
}, []);
|
|
257
|
-
if (!state.values.ready) {
|
|
258
|
-
return /* @__PURE__ */ import_react3.default.createElement(import_react3.default.Fragment, null, fallback);
|
|
259
|
-
}
|
|
260
|
-
const ComposedContext = composeContext(state.values.plugins);
|
|
261
|
-
return /* @__PURE__ */ import_react3.default.createElement(ComposedContext, null, rootComponents(state.values.plugins));
|
|
262
|
-
}
|
|
263
|
-
}
|
|
264
|
-
};
|
|
265
|
-
};
|
|
266
|
-
var initializePlugin = async (pluginDefinition) => {
|
|
267
|
-
const provides = await pluginDefinition.initialize?.();
|
|
268
|
-
return {
|
|
269
|
-
...pluginDefinition,
|
|
270
|
-
provides: {
|
|
271
|
-
...pluginDefinition.provides,
|
|
272
|
-
...provides
|
|
273
|
-
}
|
|
274
|
-
};
|
|
275
|
-
};
|
|
276
|
-
var rootComponents = (plugins) => {
|
|
277
|
-
return plugins.map((plugin) => {
|
|
278
|
-
const Component2 = plugin.provides.root;
|
|
279
|
-
if (Component2) {
|
|
280
|
-
return /* @__PURE__ */ import_react3.default.createElement(Component2, {
|
|
281
|
-
key: plugin.meta.id
|
|
282
|
-
});
|
|
283
|
-
} else {
|
|
284
|
-
return null;
|
|
285
|
-
}
|
|
286
|
-
}).filter((node) => Boolean(node));
|
|
287
|
-
};
|
|
288
|
-
var composeContext = (plugins) => {
|
|
289
|
-
return compose(plugins.map((p) => p.provides.context).filter(Boolean));
|
|
290
|
-
};
|
|
291
|
-
var compose = (contexts) => {
|
|
292
|
-
return [
|
|
293
|
-
...contexts
|
|
294
|
-
].reduce((Acc, Next) => ({ children }) => /* @__PURE__ */ import_react3.default.createElement(Acc, null, /* @__PURE__ */ import_react3.default.createElement(Next, null, children)));
|
|
295
|
-
};
|
|
296
173
|
var isObject = (data) => !!data && typeof data === "object";
|
|
297
174
|
var ErrorBoundary = class extends import_react4.Component {
|
|
298
175
|
constructor(props) {
|
|
@@ -326,7 +203,7 @@ var ErrorBoundary = class extends import_react4.Component {
|
|
|
326
203
|
});
|
|
327
204
|
}
|
|
328
205
|
};
|
|
329
|
-
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) => {
|
|
330
207
|
const props = {
|
|
331
208
|
role,
|
|
332
209
|
name,
|
|
@@ -335,16 +212,17 @@ var Surface = /* @__PURE__ */ (0, import_react5.forwardRef)(({ role, name = role
|
|
|
335
212
|
};
|
|
336
213
|
const context = (0, import_react6.useContext)(SurfaceContext);
|
|
337
214
|
const data = props.data ?? (name && context?.surfaces?.[name]?.data || {});
|
|
338
|
-
|
|
339
|
-
data,
|
|
340
|
-
fallback
|
|
341
|
-
}, /* @__PURE__ */ import_react5.default.createElement(SurfaceResolver, {
|
|
342
|
-
...props,
|
|
343
|
-
ref: forwardedRef
|
|
344
|
-
})) : /* @__PURE__ */ import_react5.default.createElement(SurfaceResolver, {
|
|
215
|
+
const resolver = /* @__PURE__ */ import_react5.default.createElement(SurfaceResolver, {
|
|
345
216
|
...props,
|
|
346
217
|
ref: forwardedRef
|
|
347
|
-
})
|
|
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;
|
|
348
226
|
});
|
|
349
227
|
var SurfaceContext = /* @__PURE__ */ (0, import_react6.createContext)(null);
|
|
350
228
|
var SurfaceResolver = /* @__PURE__ */ (0, import_react5.forwardRef)((props, forwardedRef) => {
|
|
@@ -360,7 +238,7 @@ var SurfaceResolver = /* @__PURE__ */ (0, import_react5.forwardRef)((props, forw
|
|
|
360
238
|
};
|
|
361
239
|
return /* @__PURE__ */ import_react5.default.createElement(SurfaceContext.Provider, {
|
|
362
240
|
value: currentContext
|
|
363
|
-
}, nodes
|
|
241
|
+
}, nodes);
|
|
364
242
|
});
|
|
365
243
|
var resolveNodes = (components, props, context, forwardedRef) => {
|
|
366
244
|
const data = {
|
|
@@ -400,22 +278,178 @@ var resolveNodes = (components, props, context, forwardedRef) => {
|
|
|
400
278
|
}, result.node));
|
|
401
279
|
return props.limit ? nodes.slice(0, props.limit) : nodes;
|
|
402
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
|
+
};
|
|
403
437
|
var __dxlog_file2 = "/home/runner/work/dxos/dxos/packages/sdk/app-framework/src/App.tsx";
|
|
404
438
|
var createApp = ({ order, plugins, core = order.map(({ id }) => id), ...params }) => {
|
|
405
439
|
const host = PluginHost({
|
|
406
440
|
order: [
|
|
407
441
|
import_chunk_DC3GU6QR.meta_default,
|
|
408
|
-
|
|
442
|
+
import_chunk_FETX4EGX.meta_default,
|
|
409
443
|
...order
|
|
410
444
|
],
|
|
411
445
|
plugins: {
|
|
412
446
|
...plugins,
|
|
413
447
|
[import_chunk_DC3GU6QR.meta_default.id]: Plugin.lazy(() => import("./plugin-JGSJGRMS.cjs")),
|
|
414
|
-
[
|
|
448
|
+
[import_chunk_FETX4EGX.meta_default.id]: Plugin.lazy(() => import("./plugin-HLGHD6N5.cjs"))
|
|
415
449
|
},
|
|
416
450
|
core: [
|
|
417
451
|
import_chunk_DC3GU6QR.meta_default.id,
|
|
418
|
-
|
|
452
|
+
import_chunk_FETX4EGX.meta_default.id,
|
|
419
453
|
...core
|
|
420
454
|
],
|
|
421
455
|
...params
|
|
@@ -439,8 +473,8 @@ var createApp = ({ order, plugins, core = order.map(({ id }) => id), ...params }
|
|
|
439
473
|
]
|
|
440
474
|
});
|
|
441
475
|
const Context = host.provides.context;
|
|
442
|
-
const
|
|
443
|
-
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));
|
|
444
478
|
};
|
|
445
479
|
// Annotate the CommonJS export names for ESM import in node:
|
|
446
480
|
0 && (module.exports = {
|
|
@@ -478,6 +512,8 @@ var createApp = ({ order, plugins, core = order.map(({ id }) => id), ...params }
|
|
|
478
512
|
pluginMeta,
|
|
479
513
|
resolvePlugin,
|
|
480
514
|
useIntent,
|
|
515
|
+
useIntentDispatcher,
|
|
516
|
+
useIntentResolver,
|
|
481
517
|
usePlugin,
|
|
482
518
|
usePlugins,
|
|
483
519
|
useResolvePlugin,
|