@dxos/app-framework 0.6.12-main.7907542 → 0.6.12-main.ac23639
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/index.mjs +164 -157
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/node/index.cjs +164 -161
- package/dist/lib/node/index.cjs.map +4 -4
- package/dist/lib/node/meta.json +1 -1
- package/dist/lib/node-esm/index.mjs +164 -157
- package/dist/lib/node-esm/index.mjs.map +4 -4
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/types/src/App.d.ts +4 -4
- package/dist/types/src/App.d.ts.map +1 -1
- package/dist/types/src/plugins/PluginHost/PluginContainer.d.ts +14 -0
- package/dist/types/src/plugins/PluginHost/PluginContainer.d.ts.map +1 -0
- package/dist/types/src/plugins/PluginHost/PluginContext.d.ts +4 -4
- package/dist/types/src/plugins/PluginHost/PluginContext.d.ts.map +1 -1
- package/dist/types/src/plugins/PluginHost/PluginHost.d.ts +4 -8
- package/dist/types/src/plugins/PluginHost/PluginHost.d.ts.map +1 -1
- package/dist/types/src/plugins/PluginHost/plugin.d.ts +37 -72
- package/dist/types/src/plugins/PluginHost/plugin.d.ts.map +1 -1
- package/package.json +10 -10
- package/src/App.tsx +10 -9
- package/src/plugins/PluginHost/PluginContainer.tsx +120 -0
- package/src/plugins/PluginHost/PluginContext.tsx +8 -14
- package/src/plugins/PluginHost/PluginHost.tsx +18 -121
- package/src/plugins/PluginHost/plugin.ts +45 -45
- package/tsconfig.json +1 -29
package/dist/lib/node/index.cjs
CHANGED
|
@@ -58,7 +58,6 @@ __export(node_exports, {
|
|
|
58
58
|
firstIdInPart: () => firstIdInPart,
|
|
59
59
|
getPlugin: () => import_chunk_62W6CMGM.getPlugin,
|
|
60
60
|
indexInPart: () => indexInPart,
|
|
61
|
-
initializePlugin: () => initializePlugin,
|
|
62
61
|
isLayoutAdjustment: () => isLayoutAdjustment,
|
|
63
62
|
isLayoutMode: () => isLayoutMode,
|
|
64
63
|
isLayoutParts: () => isLayoutParts,
|
|
@@ -80,7 +79,6 @@ __export(node_exports, {
|
|
|
80
79
|
parseSurfacePlugin: () => import_chunk_P5GRB4XF.parseSurfacePlugin,
|
|
81
80
|
parseTranslationsPlugin: () => parseTranslationsPlugin,
|
|
82
81
|
partLength: () => partLength,
|
|
83
|
-
pluginMeta: () => pluginMeta,
|
|
84
82
|
resolvePlugin: () => import_chunk_62W6CMGM.resolvePlugin,
|
|
85
83
|
useIntent: () => import_chunk_DFST5IG5.useIntent,
|
|
86
84
|
useIntentDispatcher: () => import_chunk_DFST5IG5.useIntentDispatcher,
|
|
@@ -101,15 +99,17 @@ var import_schema = require("@effect/schema");
|
|
|
101
99
|
var import_zod2 = require("zod");
|
|
102
100
|
var import_zod3 = require("zod");
|
|
103
101
|
var import_react = require("react");
|
|
102
|
+
var import_debug = require("@dxos/debug");
|
|
104
103
|
var import_util = require("@dxos/util");
|
|
105
104
|
var import_react2 = __toESM(require("react"));
|
|
106
105
|
var import_local_storage = require("@dxos/local-storage");
|
|
107
|
-
var import_log = require("@dxos/log");
|
|
108
106
|
var import_react3 = __toESM(require("react"));
|
|
107
|
+
var import_log = require("@dxos/log");
|
|
109
108
|
var import_react4 = __toESM(require("react"));
|
|
110
|
-
var import_react5 = require("react");
|
|
111
|
-
var
|
|
112
|
-
var
|
|
109
|
+
var import_react5 = __toESM(require("react"));
|
|
110
|
+
var import_react6 = require("react");
|
|
111
|
+
var import_debug2 = require("@dxos/debug");
|
|
112
|
+
var import_react7 = __toESM(require("react"));
|
|
113
113
|
var import_invariant = require("@dxos/invariant");
|
|
114
114
|
var defaultFileTypes = {
|
|
115
115
|
images: [
|
|
@@ -298,7 +298,6 @@ var parseTranslationsPlugin = (plugin) => {
|
|
|
298
298
|
const { success } = import_zod3.z.array(Resource).safeParse(plugin.provides.translations);
|
|
299
299
|
return success ? plugin : void 0;
|
|
300
300
|
};
|
|
301
|
-
var pluginMeta = (meta) => meta;
|
|
302
301
|
var Plugin;
|
|
303
302
|
(function(Plugin2) {
|
|
304
303
|
Plugin2.lazy = (p, props) => {
|
|
@@ -307,16 +306,8 @@ var Plugin;
|
|
|
307
306
|
});
|
|
308
307
|
};
|
|
309
308
|
})(Plugin || (Plugin = {}));
|
|
310
|
-
var PluginContext = /* @__PURE__ */ (0, import_react.createContext)(
|
|
311
|
-
|
|
312
|
-
core: [],
|
|
313
|
-
enabled: [],
|
|
314
|
-
plugins: [],
|
|
315
|
-
available: [],
|
|
316
|
-
setPlugin: () => {
|
|
317
|
-
}
|
|
318
|
-
});
|
|
319
|
-
var usePlugins = () => (0, import_react.useContext)(PluginContext);
|
|
309
|
+
var PluginContext = /* @__PURE__ */ (0, import_react.createContext)(void 0);
|
|
310
|
+
var usePlugins = () => (0, import_react.useContext)(PluginContext) ?? (0, import_debug.raise)(new Error("Missing PluginContext"));
|
|
320
311
|
var usePlugin = (id) => {
|
|
321
312
|
const { plugins } = usePlugins();
|
|
322
313
|
return (0, import_chunk_62W6CMGM.findPlugin)(plugins, id);
|
|
@@ -333,8 +324,117 @@ var useResolvePlugins = (predicate) => {
|
|
|
333
324
|
]);
|
|
334
325
|
};
|
|
335
326
|
var PluginProvider = PluginContext.Provider;
|
|
327
|
+
var __dxlog_file = "/home/runner/work/dxos/dxos/packages/sdk/app-framework/src/plugins/PluginHost/PluginContainer.tsx";
|
|
328
|
+
var PluginContainer = ({ plugins: definitions, core, state, placeholder }) => {
|
|
329
|
+
const [error, setError] = (0, import_react3.useState)();
|
|
330
|
+
(0, import_react3.useEffect)(() => {
|
|
331
|
+
(0, import_log.log)("initializing plugins", {
|
|
332
|
+
enabled: state.enabled
|
|
333
|
+
}, {
|
|
334
|
+
F: __dxlog_file,
|
|
335
|
+
L: 26,
|
|
336
|
+
S: void 0,
|
|
337
|
+
C: (f, a) => f(...a)
|
|
338
|
+
});
|
|
339
|
+
const t = setTimeout(async () => {
|
|
340
|
+
try {
|
|
341
|
+
const enabledIds = [
|
|
342
|
+
...core,
|
|
343
|
+
...state.enabled
|
|
344
|
+
];
|
|
345
|
+
const enabled = await Promise.all(enabledIds.map((id) => definitions[id]).filter((definition) => Boolean(definition)).map((definition) => definition()));
|
|
346
|
+
const plugins = await Promise.all(enabled.map(async (definition) => {
|
|
347
|
+
const plugin = await initializePlugin(definition).catch((err) => {
|
|
348
|
+
import_log.log.error("Failed to initialize plugin:", {
|
|
349
|
+
id: definition.meta.id,
|
|
350
|
+
err
|
|
351
|
+
}, {
|
|
352
|
+
F: __dxlog_file,
|
|
353
|
+
L: 41,
|
|
354
|
+
S: void 0,
|
|
355
|
+
C: (f, a) => f(...a)
|
|
356
|
+
});
|
|
357
|
+
});
|
|
358
|
+
(0, import_log.log)("initialized", {
|
|
359
|
+
plugin: definition.meta.id
|
|
360
|
+
}, {
|
|
361
|
+
F: __dxlog_file,
|
|
362
|
+
L: 44,
|
|
363
|
+
S: void 0,
|
|
364
|
+
C: (f, a) => f(...a)
|
|
365
|
+
});
|
|
366
|
+
return plugin;
|
|
367
|
+
}));
|
|
368
|
+
const initialized = plugins.filter((plugin) => Boolean(plugin));
|
|
369
|
+
(0, import_log.log)("plugins initialized", {
|
|
370
|
+
plugins: initialized
|
|
371
|
+
}, {
|
|
372
|
+
F: __dxlog_file,
|
|
373
|
+
L: 50,
|
|
374
|
+
S: void 0,
|
|
375
|
+
C: (f, a) => f(...a)
|
|
376
|
+
});
|
|
377
|
+
await Promise.all(enabled.map((plugin) => plugin.ready?.(initialized)));
|
|
378
|
+
(0, import_log.log)("plugins ready", {
|
|
379
|
+
plugins: initialized
|
|
380
|
+
}, {
|
|
381
|
+
F: __dxlog_file,
|
|
382
|
+
L: 53,
|
|
383
|
+
S: void 0,
|
|
384
|
+
C: (f, a) => f(...a)
|
|
385
|
+
});
|
|
386
|
+
state.plugins = initialized;
|
|
387
|
+
state.ready = true;
|
|
388
|
+
} catch (err) {
|
|
389
|
+
setError(err);
|
|
390
|
+
}
|
|
391
|
+
});
|
|
392
|
+
return () => {
|
|
393
|
+
clearTimeout(t);
|
|
394
|
+
state.ready = false;
|
|
395
|
+
};
|
|
396
|
+
}, []);
|
|
397
|
+
if (error) {
|
|
398
|
+
throw error;
|
|
399
|
+
}
|
|
400
|
+
if (!state.ready) {
|
|
401
|
+
return /* @__PURE__ */ import_react3.default.createElement(import_react3.default.Fragment, null, placeholder);
|
|
402
|
+
}
|
|
403
|
+
const ComposedContext = composeContext(state.plugins);
|
|
404
|
+
return /* @__PURE__ */ import_react3.default.createElement(ComposedContext, null, rootComponents(state.plugins));
|
|
405
|
+
};
|
|
406
|
+
var initializePlugin = async (pluginDefinition) => {
|
|
407
|
+
const provides = await pluginDefinition.initialize?.();
|
|
408
|
+
return {
|
|
409
|
+
...pluginDefinition,
|
|
410
|
+
provides: {
|
|
411
|
+
...pluginDefinition.provides,
|
|
412
|
+
...provides
|
|
413
|
+
}
|
|
414
|
+
};
|
|
415
|
+
};
|
|
416
|
+
var rootComponents = (plugins) => {
|
|
417
|
+
return plugins.map((plugin) => {
|
|
418
|
+
const Component2 = plugin.provides.root;
|
|
419
|
+
if (Component2) {
|
|
420
|
+
return /* @__PURE__ */ import_react3.default.createElement(Component2, {
|
|
421
|
+
key: plugin.meta.id
|
|
422
|
+
});
|
|
423
|
+
} else {
|
|
424
|
+
return null;
|
|
425
|
+
}
|
|
426
|
+
}).filter((node) => Boolean(node));
|
|
427
|
+
};
|
|
428
|
+
var composeContext = (plugins) => {
|
|
429
|
+
return compose(plugins.map((p) => p.provides.context).filter(Boolean));
|
|
430
|
+
};
|
|
431
|
+
var compose = (contexts) => {
|
|
432
|
+
return [
|
|
433
|
+
...contexts
|
|
434
|
+
].reduce((Acc, Next) => ({ children }) => /* @__PURE__ */ import_react3.default.createElement(Acc, null, /* @__PURE__ */ import_react3.default.createElement(Next, null, children)));
|
|
435
|
+
};
|
|
336
436
|
var isObject = (data) => !!data && typeof data === "object";
|
|
337
|
-
var ErrorBoundary = class extends
|
|
437
|
+
var ErrorBoundary = class extends import_react4.Component {
|
|
338
438
|
constructor(props) {
|
|
339
439
|
super(props);
|
|
340
440
|
this.state = {
|
|
@@ -353,7 +453,7 @@ var ErrorBoundary = class extends import_react3.Component {
|
|
|
353
453
|
}
|
|
354
454
|
render() {
|
|
355
455
|
if (this.state.error) {
|
|
356
|
-
return /* @__PURE__ */
|
|
456
|
+
return /* @__PURE__ */ import_react4.default.createElement(this.props.fallback, {
|
|
357
457
|
data: this.props.data,
|
|
358
458
|
error: this.state.error,
|
|
359
459
|
reset: this.resetError
|
|
@@ -367,32 +467,32 @@ var ErrorBoundary = class extends import_react3.Component {
|
|
|
367
467
|
});
|
|
368
468
|
}
|
|
369
469
|
};
|
|
370
|
-
var Surface = /* @__PURE__ */ (0,
|
|
470
|
+
var Surface = /* @__PURE__ */ (0, import_react5.forwardRef)(({ role, name = role, fallback, placeholder, ...rest }, forwardedRef) => {
|
|
371
471
|
const props = {
|
|
372
472
|
role,
|
|
373
473
|
name,
|
|
374
474
|
fallback,
|
|
375
475
|
...rest
|
|
376
476
|
};
|
|
377
|
-
const context = (0,
|
|
477
|
+
const context = (0, import_react6.useContext)(SurfaceContext);
|
|
378
478
|
const data = props.data ?? (name && context?.surfaces?.[name]?.data || {});
|
|
379
|
-
const resolver = /* @__PURE__ */
|
|
479
|
+
const resolver = /* @__PURE__ */ import_react5.default.createElement(SurfaceResolver, {
|
|
380
480
|
...props,
|
|
381
481
|
ref: forwardedRef
|
|
382
482
|
});
|
|
383
|
-
const suspense = placeholder ? /* @__PURE__ */
|
|
483
|
+
const suspense = placeholder ? /* @__PURE__ */ import_react5.default.createElement(import_react5.Suspense, {
|
|
384
484
|
fallback: placeholder
|
|
385
485
|
}, resolver) : resolver;
|
|
386
|
-
return fallback ? /* @__PURE__ */
|
|
486
|
+
return fallback ? /* @__PURE__ */ import_react5.default.createElement(ErrorBoundary, {
|
|
387
487
|
data,
|
|
388
488
|
fallback
|
|
389
489
|
}, suspense) : suspense;
|
|
390
490
|
});
|
|
391
|
-
var SurfaceContext = /* @__PURE__ */ (0,
|
|
392
|
-
var useSurface = () => (0,
|
|
393
|
-
var SurfaceResolver = /* @__PURE__ */ (0,
|
|
491
|
+
var SurfaceContext = /* @__PURE__ */ (0, import_react6.createContext)(null);
|
|
492
|
+
var useSurface = () => (0, import_react6.useContext)(SurfaceContext) ?? (0, import_debug2.raise)(new Error("Surface context not found"));
|
|
493
|
+
var SurfaceResolver = /* @__PURE__ */ (0, import_react5.forwardRef)((props, forwardedRef) => {
|
|
394
494
|
const { components } = (0, import_chunk_P5GRB4XF.useSurfaceRoot)();
|
|
395
|
-
const parent = (0,
|
|
495
|
+
const parent = (0, import_react6.useContext)(SurfaceContext);
|
|
396
496
|
const nodes = resolveNodes(components, props, parent, forwardedRef);
|
|
397
497
|
const currentContext = {
|
|
398
498
|
...props,
|
|
@@ -401,7 +501,7 @@ var SurfaceResolver = /* @__PURE__ */ (0, import_react4.forwardRef)((props, forw
|
|
|
401
501
|
...props.surfaces
|
|
402
502
|
}
|
|
403
503
|
};
|
|
404
|
-
return /* @__PURE__ */
|
|
504
|
+
return /* @__PURE__ */ import_react5.default.createElement(SurfaceContext.Provider, {
|
|
405
505
|
value: currentContext
|
|
406
506
|
}, nodes);
|
|
407
507
|
});
|
|
@@ -421,7 +521,7 @@ var resolveNodes = (components, props, context, forwardedRef) => {
|
|
|
421
521
|
return "node" in result ? [
|
|
422
522
|
key,
|
|
423
523
|
result
|
|
424
|
-
] : /* @__PURE__ */ (0,
|
|
524
|
+
] : /* @__PURE__ */ (0, import_react5.isValidElement)(result) ? [
|
|
425
525
|
key,
|
|
426
526
|
{
|
|
427
527
|
node: result
|
|
@@ -438,15 +538,14 @@ var resolveNodes = (components, props, context, forwardedRef) => {
|
|
|
438
538
|
return 1;
|
|
439
539
|
}
|
|
440
540
|
return 0;
|
|
441
|
-
}).map(([key, result]) => /* @__PURE__ */
|
|
541
|
+
}).map(([key, result]) => /* @__PURE__ */ import_react5.default.createElement(import_react5.Fragment, {
|
|
442
542
|
key
|
|
443
543
|
}, result.node));
|
|
444
544
|
return props.limit ? nodes.slice(0, props.limit) : nodes;
|
|
445
545
|
};
|
|
446
|
-
var __dxlog_file = "/home/runner/work/dxos/dxos/packages/sdk/app-framework/src/plugins/PluginHost/PluginHost.tsx";
|
|
447
546
|
var parsePluginHost = (plugin) => plugin.provides.plugins ? plugin : void 0;
|
|
448
547
|
var PLUGIN_HOST = "dxos.org/plugin/host";
|
|
449
|
-
var PluginHost = ({
|
|
548
|
+
var PluginHost = ({ plugins, meta, core, defaults = [], fallback = DefaultFallback, placeholder = null }) => {
|
|
450
549
|
const state = new import_local_storage.LocalStorageStore(PLUGIN_HOST, {
|
|
451
550
|
ready: false,
|
|
452
551
|
core,
|
|
@@ -454,7 +553,7 @@ var PluginHost = ({ order, plugins: definitions, core = [], defaults = [], fallb
|
|
|
454
553
|
...defaults
|
|
455
554
|
],
|
|
456
555
|
plugins: [],
|
|
457
|
-
available:
|
|
556
|
+
available: meta.filter(({ id }) => !core.includes(id)),
|
|
458
557
|
setPlugin: (id, enabled) => {
|
|
459
558
|
if (enabled) {
|
|
460
559
|
state.values.enabled.push(id);
|
|
@@ -475,16 +574,17 @@ var PluginHost = ({ order, plugins: definitions, core = [], defaults = [], fallb
|
|
|
475
574
|
},
|
|
476
575
|
provides: {
|
|
477
576
|
plugins: state.values,
|
|
478
|
-
context: ({ children }) =>
|
|
479
|
-
|
|
480
|
-
|
|
577
|
+
context: ({ children }) => {
|
|
578
|
+
return /* @__PURE__ */ import_react2.default.createElement(PluginProvider, {
|
|
579
|
+
value: state.values
|
|
580
|
+
}, children);
|
|
581
|
+
},
|
|
481
582
|
root: () => {
|
|
482
583
|
return /* @__PURE__ */ import_react2.default.createElement(ErrorBoundary, {
|
|
483
584
|
fallback
|
|
484
|
-
}, /* @__PURE__ */ import_react2.default.createElement(
|
|
485
|
-
|
|
585
|
+
}, /* @__PURE__ */ import_react2.default.createElement(PluginContainer, {
|
|
586
|
+
plugins,
|
|
486
587
|
core,
|
|
487
|
-
definitions,
|
|
488
588
|
state: state.values,
|
|
489
589
|
placeholder
|
|
490
590
|
}));
|
|
@@ -505,123 +605,20 @@ var DefaultFallback = ({ error }) => {
|
|
|
505
605
|
}
|
|
506
606
|
}, error.message), /* @__PURE__ */ import_react2.default.createElement("pre", null, error.stack));
|
|
507
607
|
};
|
|
508
|
-
var Root = ({ order, core: corePluginIds, definitions, state, placeholder }) => {
|
|
509
|
-
const [error, setError] = (0, import_react2.useState)();
|
|
510
|
-
(0, import_react2.useEffect)(() => {
|
|
511
|
-
(0, import_log.log)("initializing plugins", {
|
|
512
|
-
enabled: state.enabled
|
|
513
|
-
}, {
|
|
514
|
-
F: __dxlog_file,
|
|
515
|
-
L: 102,
|
|
516
|
-
S: void 0,
|
|
517
|
-
C: (f, a) => f(...a)
|
|
518
|
-
});
|
|
519
|
-
const timeout = setTimeout(async () => {
|
|
520
|
-
try {
|
|
521
|
-
const enabledIds = [
|
|
522
|
-
...corePluginIds,
|
|
523
|
-
...state.enabled
|
|
524
|
-
].sort((a, b) => {
|
|
525
|
-
const indexA = order.findIndex(({ id }) => id === a);
|
|
526
|
-
const indexB = order.findIndex(({ id }) => id === b);
|
|
527
|
-
return indexA - indexB;
|
|
528
|
-
});
|
|
529
|
-
const enabled = await Promise.all(enabledIds.map((id) => definitions[id]).filter((definition) => Boolean(definition)).map((definition) => definition()));
|
|
530
|
-
const plugins = await Promise.all(enabled.map(async (definition) => {
|
|
531
|
-
const plugin = await initializePlugin(definition).catch((err) => {
|
|
532
|
-
import_log.log.error("Failed to initialize plugin:", {
|
|
533
|
-
id: definition.meta.id,
|
|
534
|
-
err
|
|
535
|
-
}, {
|
|
536
|
-
F: __dxlog_file,
|
|
537
|
-
L: 122,
|
|
538
|
-
S: void 0,
|
|
539
|
-
C: (f, a) => f(...a)
|
|
540
|
-
});
|
|
541
|
-
return void 0;
|
|
542
|
-
});
|
|
543
|
-
return plugin;
|
|
544
|
-
})).then((plugins2) => plugins2.filter((plugin) => Boolean(plugin)));
|
|
545
|
-
(0, import_log.log)("plugins initialized", {
|
|
546
|
-
plugins
|
|
547
|
-
}, {
|
|
548
|
-
F: __dxlog_file,
|
|
549
|
-
L: 128,
|
|
550
|
-
S: void 0,
|
|
551
|
-
C: (f, a) => f(...a)
|
|
552
|
-
});
|
|
553
|
-
await Promise.all(enabled.map((pluginDefinition) => pluginDefinition.ready?.(plugins)));
|
|
554
|
-
(0, import_log.log)("plugins ready", {
|
|
555
|
-
plugins
|
|
556
|
-
}, {
|
|
557
|
-
F: __dxlog_file,
|
|
558
|
-
L: 131,
|
|
559
|
-
S: void 0,
|
|
560
|
-
C: (f, a) => f(...a)
|
|
561
|
-
});
|
|
562
|
-
state.plugins = plugins;
|
|
563
|
-
state.ready = true;
|
|
564
|
-
} catch (err) {
|
|
565
|
-
setError(err);
|
|
566
|
-
}
|
|
567
|
-
});
|
|
568
|
-
return () => {
|
|
569
|
-
clearTimeout(timeout);
|
|
570
|
-
state.ready = false;
|
|
571
|
-
};
|
|
572
|
-
}, []);
|
|
573
|
-
if (error) {
|
|
574
|
-
throw error;
|
|
575
|
-
}
|
|
576
|
-
if (!state.ready) {
|
|
577
|
-
return /* @__PURE__ */ import_react2.default.createElement(import_react2.default.Fragment, null, placeholder);
|
|
578
|
-
}
|
|
579
|
-
const ComposedContext = composeContext(state.plugins);
|
|
580
|
-
return /* @__PURE__ */ import_react2.default.createElement(ComposedContext, null, rootComponents(state.plugins));
|
|
581
|
-
};
|
|
582
|
-
var initializePlugin = async (pluginDefinition) => {
|
|
583
|
-
const provides = await pluginDefinition.initialize?.();
|
|
584
|
-
return {
|
|
585
|
-
...pluginDefinition,
|
|
586
|
-
provides: {
|
|
587
|
-
...pluginDefinition.provides,
|
|
588
|
-
...provides
|
|
589
|
-
}
|
|
590
|
-
};
|
|
591
|
-
};
|
|
592
|
-
var rootComponents = (plugins) => {
|
|
593
|
-
return plugins.map((plugin) => {
|
|
594
|
-
const Component2 = plugin.provides.root;
|
|
595
|
-
if (Component2) {
|
|
596
|
-
return /* @__PURE__ */ import_react2.default.createElement(Component2, {
|
|
597
|
-
key: plugin.meta.id
|
|
598
|
-
});
|
|
599
|
-
} else {
|
|
600
|
-
return null;
|
|
601
|
-
}
|
|
602
|
-
}).filter((node) => Boolean(node));
|
|
603
|
-
};
|
|
604
|
-
var composeContext = (plugins) => {
|
|
605
|
-
return compose(plugins.map((p) => p.provides.context).filter(Boolean));
|
|
606
|
-
};
|
|
607
|
-
var compose = (contexts) => {
|
|
608
|
-
return [
|
|
609
|
-
...contexts
|
|
610
|
-
].reduce((Acc, Next) => ({ children }) => /* @__PURE__ */ import_react2.default.createElement(Acc, null, /* @__PURE__ */ import_react2.default.createElement(Next, null, children)));
|
|
611
|
-
};
|
|
612
608
|
var __dxlog_file2 = "/home/runner/work/dxos/dxos/packages/sdk/app-framework/src/App.tsx";
|
|
613
|
-
var createApp = ({
|
|
609
|
+
var createApp = ({ meta, plugins, core, ...params }) => {
|
|
614
610
|
const host = PluginHost({
|
|
615
|
-
order: [
|
|
616
|
-
import_chunk_P5GRB4XF.meta_default,
|
|
617
|
-
import_chunk_DFST5IG5.meta_default,
|
|
618
|
-
...order
|
|
619
|
-
],
|
|
620
611
|
plugins: {
|
|
621
612
|
...plugins,
|
|
622
613
|
[import_chunk_P5GRB4XF.meta_default.id]: Plugin.lazy(() => import("./plugin-RUJ5PEXB.cjs")),
|
|
623
614
|
[import_chunk_DFST5IG5.meta_default.id]: Plugin.lazy(() => import("./plugin-QV7ESETI.cjs"))
|
|
624
615
|
},
|
|
616
|
+
// TODO(burdon): Why not include in core?
|
|
617
|
+
meta: [
|
|
618
|
+
import_chunk_P5GRB4XF.meta_default,
|
|
619
|
+
import_chunk_DFST5IG5.meta_default,
|
|
620
|
+
...meta
|
|
621
|
+
],
|
|
625
622
|
core: [
|
|
626
623
|
import_chunk_P5GRB4XF.meta_default.id,
|
|
627
624
|
import_chunk_DFST5IG5.meta_default.id,
|
|
@@ -629,27 +626,35 @@ var createApp = ({ order, plugins, core = order.map(({ id }) => id), ...params }
|
|
|
629
626
|
],
|
|
630
627
|
...params
|
|
631
628
|
});
|
|
632
|
-
(0, import_invariant.invariant)(host.provides
|
|
629
|
+
(0, import_invariant.invariant)(host.provides, void 0, {
|
|
633
630
|
F: __dxlog_file2,
|
|
634
|
-
L:
|
|
631
|
+
L: 52,
|
|
635
632
|
S: void 0,
|
|
636
633
|
A: [
|
|
637
|
-
"host.provides
|
|
634
|
+
"host.provides",
|
|
638
635
|
""
|
|
639
636
|
]
|
|
640
637
|
});
|
|
641
|
-
|
|
638
|
+
const { context: Context, root: Root } = host.provides;
|
|
639
|
+
(0, import_invariant.invariant)(Context, void 0, {
|
|
642
640
|
F: __dxlog_file2,
|
|
643
|
-
L:
|
|
641
|
+
L: 54,
|
|
642
|
+
S: void 0,
|
|
643
|
+
A: [
|
|
644
|
+
"Context",
|
|
645
|
+
""
|
|
646
|
+
]
|
|
647
|
+
});
|
|
648
|
+
(0, import_invariant.invariant)(Root, void 0, {
|
|
649
|
+
F: __dxlog_file2,
|
|
650
|
+
L: 55,
|
|
644
651
|
S: void 0,
|
|
645
652
|
A: [
|
|
646
|
-
"
|
|
653
|
+
"Root",
|
|
647
654
|
""
|
|
648
655
|
]
|
|
649
656
|
});
|
|
650
|
-
|
|
651
|
-
const Root2 = host.provides.root;
|
|
652
|
-
return () => /* @__PURE__ */ import_react6.default.createElement(Context, null, /* @__PURE__ */ import_react6.default.createElement(Root2, null));
|
|
657
|
+
return () => /* @__PURE__ */ import_react7.default.createElement(Context, null, /* @__PURE__ */ import_react7.default.createElement(Root, null));
|
|
653
658
|
};
|
|
654
659
|
// Annotate the CommonJS export names for ESM import in node:
|
|
655
660
|
0 && (module.exports = {
|
|
@@ -683,7 +688,6 @@ var createApp = ({ order, plugins, core = order.map(({ id }) => id), ...params }
|
|
|
683
688
|
firstIdInPart,
|
|
684
689
|
getPlugin,
|
|
685
690
|
indexInPart,
|
|
686
|
-
initializePlugin,
|
|
687
691
|
isLayoutAdjustment,
|
|
688
692
|
isLayoutMode,
|
|
689
693
|
isLayoutParts,
|
|
@@ -705,7 +709,6 @@ var createApp = ({ order, plugins, core = order.map(({ id }) => id), ...params }
|
|
|
705
709
|
parseSurfacePlugin,
|
|
706
710
|
parseTranslationsPlugin,
|
|
707
711
|
partLength,
|
|
708
|
-
pluginMeta,
|
|
709
712
|
resolvePlugin,
|
|
710
713
|
useIntent,
|
|
711
714
|
useIntentDispatcher,
|