@dxos/app-framework 0.6.12-staging.e11e696 → 0.6.13-main.548ca8d
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 +168 -158
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/node/index.cjs +168 -162
- package/dist/lib/node/index.cjs.map +4 -4
- package/dist/lib/node/meta.json +1 -1
- package/dist/lib/node-esm/index.mjs +168 -158
- 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/dist/types/src/plugins/common/navigation.d.ts.map +1 -1
- package/package.json +11 -11
- 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/src/plugins/common/navigation.ts +3 -1
- package/tsconfig.json +1 -29
|
@@ -131,7 +131,10 @@ var LayoutEntrySchema = S.mutable(S.Struct({
|
|
|
131
131
|
path: S.optional(S.String)
|
|
132
132
|
}));
|
|
133
133
|
var LayoutPartSchema = S.Union(S.Literal("sidebar"), S.Literal("main"), S.Literal("solo"), S.Literal("complementary"), S.Literal("fullScreen"));
|
|
134
|
-
var LayoutPartsSchema = S.partial(S.mutable(S.Record(
|
|
134
|
+
var LayoutPartsSchema = S.partial(S.mutable(S.Record({
|
|
135
|
+
key: LayoutPartSchema,
|
|
136
|
+
value: S.mutable(S.Array(LayoutEntrySchema))
|
|
137
|
+
})));
|
|
135
138
|
var LayoutCoordinateSchema = S.mutable(S.Struct({
|
|
136
139
|
part: LayoutPartSchema,
|
|
137
140
|
entryId: S.String
|
|
@@ -226,7 +229,6 @@ var parseTranslationsPlugin = (plugin) => {
|
|
|
226
229
|
};
|
|
227
230
|
|
|
228
231
|
// packages/sdk/app-framework/src/plugins/PluginHost/plugin.ts
|
|
229
|
-
var pluginMeta = (meta) => meta;
|
|
230
232
|
var Plugin;
|
|
231
233
|
(function(Plugin2) {
|
|
232
234
|
Plugin2.lazy = (p, props) => {
|
|
@@ -238,17 +240,10 @@ var Plugin;
|
|
|
238
240
|
|
|
239
241
|
// packages/sdk/app-framework/src/plugins/PluginHost/PluginContext.tsx
|
|
240
242
|
import { createContext, useContext, useMemo } from "react";
|
|
243
|
+
import { raise } from "@dxos/debug";
|
|
241
244
|
import { nonNullable } from "@dxos/util";
|
|
242
|
-
var PluginContext = /* @__PURE__ */ createContext(
|
|
243
|
-
|
|
244
|
-
core: [],
|
|
245
|
-
enabled: [],
|
|
246
|
-
plugins: [],
|
|
247
|
-
available: [],
|
|
248
|
-
setPlugin: () => {
|
|
249
|
-
}
|
|
250
|
-
});
|
|
251
|
-
var usePlugins = () => useContext(PluginContext);
|
|
245
|
+
var PluginContext = /* @__PURE__ */ createContext(void 0);
|
|
246
|
+
var usePlugins = () => useContext(PluginContext) ?? raise(new Error("Missing PluginContext"));
|
|
252
247
|
var usePlugin = (id) => {
|
|
253
248
|
const { plugins } = usePlugins();
|
|
254
249
|
return findPlugin(plugins, id);
|
|
@@ -267,15 +262,127 @@ var useResolvePlugins = (predicate) => {
|
|
|
267
262
|
var PluginProvider = PluginContext.Provider;
|
|
268
263
|
|
|
269
264
|
// packages/sdk/app-framework/src/plugins/PluginHost/PluginHost.tsx
|
|
270
|
-
import
|
|
265
|
+
import React4 from "react";
|
|
271
266
|
import { LocalStorageStore } from "@dxos/local-storage";
|
|
267
|
+
|
|
268
|
+
// packages/sdk/app-framework/src/plugins/PluginHost/PluginContainer.tsx
|
|
269
|
+
import React, { useEffect, useState } from "react";
|
|
272
270
|
import { log } from "@dxos/log";
|
|
271
|
+
var __dxlog_file = "/home/runner/work/dxos/dxos/packages/sdk/app-framework/src/plugins/PluginHost/PluginContainer.tsx";
|
|
272
|
+
var PluginContainer = ({ plugins: definitions, core, state, placeholder }) => {
|
|
273
|
+
const [error, setError] = useState();
|
|
274
|
+
useEffect(() => {
|
|
275
|
+
log("initializing plugins", {
|
|
276
|
+
enabled: state.enabled
|
|
277
|
+
}, {
|
|
278
|
+
F: __dxlog_file,
|
|
279
|
+
L: 26,
|
|
280
|
+
S: void 0,
|
|
281
|
+
C: (f, a) => f(...a)
|
|
282
|
+
});
|
|
283
|
+
const t = setTimeout(async () => {
|
|
284
|
+
try {
|
|
285
|
+
const enabledIds = [
|
|
286
|
+
...core,
|
|
287
|
+
...state.enabled
|
|
288
|
+
];
|
|
289
|
+
const enabled = await Promise.all(enabledIds.map((id) => definitions[id]).filter((definition) => Boolean(definition)).map((definition) => definition()));
|
|
290
|
+
const plugins = await Promise.all(enabled.map(async (definition) => {
|
|
291
|
+
const plugin = await initializePlugin(definition).catch((err) => {
|
|
292
|
+
log.error("Failed to initialize plugin:", {
|
|
293
|
+
id: definition.meta.id,
|
|
294
|
+
err
|
|
295
|
+
}, {
|
|
296
|
+
F: __dxlog_file,
|
|
297
|
+
L: 41,
|
|
298
|
+
S: void 0,
|
|
299
|
+
C: (f, a) => f(...a)
|
|
300
|
+
});
|
|
301
|
+
});
|
|
302
|
+
log("initialized", {
|
|
303
|
+
plugin: definition.meta.id
|
|
304
|
+
}, {
|
|
305
|
+
F: __dxlog_file,
|
|
306
|
+
L: 44,
|
|
307
|
+
S: void 0,
|
|
308
|
+
C: (f, a) => f(...a)
|
|
309
|
+
});
|
|
310
|
+
return plugin;
|
|
311
|
+
}));
|
|
312
|
+
const initialized = plugins.filter((plugin) => Boolean(plugin));
|
|
313
|
+
log("plugins initialized", {
|
|
314
|
+
plugins: initialized
|
|
315
|
+
}, {
|
|
316
|
+
F: __dxlog_file,
|
|
317
|
+
L: 50,
|
|
318
|
+
S: void 0,
|
|
319
|
+
C: (f, a) => f(...a)
|
|
320
|
+
});
|
|
321
|
+
await Promise.all(enabled.map((plugin) => plugin.ready?.(initialized)));
|
|
322
|
+
log("plugins ready", {
|
|
323
|
+
plugins: initialized
|
|
324
|
+
}, {
|
|
325
|
+
F: __dxlog_file,
|
|
326
|
+
L: 53,
|
|
327
|
+
S: void 0,
|
|
328
|
+
C: (f, a) => f(...a)
|
|
329
|
+
});
|
|
330
|
+
state.plugins = initialized;
|
|
331
|
+
state.ready = true;
|
|
332
|
+
} catch (err) {
|
|
333
|
+
setError(err);
|
|
334
|
+
}
|
|
335
|
+
});
|
|
336
|
+
return () => {
|
|
337
|
+
clearTimeout(t);
|
|
338
|
+
state.ready = false;
|
|
339
|
+
};
|
|
340
|
+
}, []);
|
|
341
|
+
if (error) {
|
|
342
|
+
throw error;
|
|
343
|
+
}
|
|
344
|
+
if (!state.ready) {
|
|
345
|
+
return /* @__PURE__ */ React.createElement(React.Fragment, null, placeholder);
|
|
346
|
+
}
|
|
347
|
+
const ComposedContext = composeContext(state.plugins);
|
|
348
|
+
return /* @__PURE__ */ React.createElement(ComposedContext, null, rootComponents(state.plugins));
|
|
349
|
+
};
|
|
350
|
+
var initializePlugin = async (pluginDefinition) => {
|
|
351
|
+
const provides = await pluginDefinition.initialize?.();
|
|
352
|
+
return {
|
|
353
|
+
...pluginDefinition,
|
|
354
|
+
provides: {
|
|
355
|
+
...pluginDefinition.provides,
|
|
356
|
+
...provides
|
|
357
|
+
}
|
|
358
|
+
};
|
|
359
|
+
};
|
|
360
|
+
var rootComponents = (plugins) => {
|
|
361
|
+
return plugins.map((plugin) => {
|
|
362
|
+
const Component2 = plugin.provides.root;
|
|
363
|
+
if (Component2) {
|
|
364
|
+
return /* @__PURE__ */ React.createElement(Component2, {
|
|
365
|
+
key: plugin.meta.id
|
|
366
|
+
});
|
|
367
|
+
} else {
|
|
368
|
+
return null;
|
|
369
|
+
}
|
|
370
|
+
}).filter((node) => Boolean(node));
|
|
371
|
+
};
|
|
372
|
+
var composeContext = (plugins) => {
|
|
373
|
+
return compose(plugins.map((p) => p.provides.context).filter(Boolean));
|
|
374
|
+
};
|
|
375
|
+
var compose = (contexts) => {
|
|
376
|
+
return [
|
|
377
|
+
...contexts
|
|
378
|
+
].reduce((Acc, Next) => ({ children }) => /* @__PURE__ */ React.createElement(Acc, null, /* @__PURE__ */ React.createElement(Next, null, children)));
|
|
379
|
+
};
|
|
273
380
|
|
|
274
381
|
// packages/sdk/app-framework/src/plugins/SurfacePlugin/helpers.ts
|
|
275
382
|
var isObject = (data) => !!data && typeof data === "object";
|
|
276
383
|
|
|
277
384
|
// packages/sdk/app-framework/src/plugins/SurfacePlugin/ErrorBoundary.tsx
|
|
278
|
-
import
|
|
385
|
+
import React2, { Component } from "react";
|
|
279
386
|
var ErrorBoundary = class extends Component {
|
|
280
387
|
constructor(props) {
|
|
281
388
|
super(props);
|
|
@@ -295,7 +402,7 @@ var ErrorBoundary = class extends Component {
|
|
|
295
402
|
}
|
|
296
403
|
render() {
|
|
297
404
|
if (this.state.error) {
|
|
298
|
-
return /* @__PURE__ */
|
|
405
|
+
return /* @__PURE__ */ React2.createElement(this.props.fallback, {
|
|
299
406
|
data: this.props.data,
|
|
300
407
|
error: this.state.error,
|
|
301
408
|
reset: this.resetError
|
|
@@ -311,9 +418,9 @@ var ErrorBoundary = class extends Component {
|
|
|
311
418
|
};
|
|
312
419
|
|
|
313
420
|
// packages/sdk/app-framework/src/plugins/SurfacePlugin/Surface.tsx
|
|
314
|
-
import
|
|
421
|
+
import React3, { forwardRef, Fragment, isValidElement, Suspense } from "react";
|
|
315
422
|
import { createContext as createContext2, useContext as useContext2 } from "react";
|
|
316
|
-
import { raise } from "@dxos/debug";
|
|
423
|
+
import { raise as raise2 } from "@dxos/debug";
|
|
317
424
|
var Surface = /* @__PURE__ */ forwardRef(({ role, name = role, fallback, placeholder, ...rest }, forwardedRef) => {
|
|
318
425
|
const props = {
|
|
319
426
|
role,
|
|
@@ -323,20 +430,20 @@ var Surface = /* @__PURE__ */ forwardRef(({ role, name = role, fallback, placeho
|
|
|
323
430
|
};
|
|
324
431
|
const context = useContext2(SurfaceContext);
|
|
325
432
|
const data = props.data ?? (name && context?.surfaces?.[name]?.data || {});
|
|
326
|
-
const resolver = /* @__PURE__ */
|
|
433
|
+
const resolver = /* @__PURE__ */ React3.createElement(SurfaceResolver, {
|
|
327
434
|
...props,
|
|
328
435
|
ref: forwardedRef
|
|
329
436
|
});
|
|
330
|
-
const suspense = placeholder ? /* @__PURE__ */
|
|
437
|
+
const suspense = placeholder ? /* @__PURE__ */ React3.createElement(Suspense, {
|
|
331
438
|
fallback: placeholder
|
|
332
439
|
}, resolver) : resolver;
|
|
333
|
-
return fallback ? /* @__PURE__ */
|
|
440
|
+
return fallback ? /* @__PURE__ */ React3.createElement(ErrorBoundary, {
|
|
334
441
|
data,
|
|
335
442
|
fallback
|
|
336
443
|
}, suspense) : suspense;
|
|
337
444
|
});
|
|
338
445
|
var SurfaceContext = /* @__PURE__ */ createContext2(null);
|
|
339
|
-
var useSurface = () => useContext2(SurfaceContext) ??
|
|
446
|
+
var useSurface = () => useContext2(SurfaceContext) ?? raise2(new Error("Surface context not found"));
|
|
340
447
|
var SurfaceResolver = /* @__PURE__ */ forwardRef((props, forwardedRef) => {
|
|
341
448
|
const { components } = useSurfaceRoot();
|
|
342
449
|
const parent = useContext2(SurfaceContext);
|
|
@@ -348,7 +455,7 @@ var SurfaceResolver = /* @__PURE__ */ forwardRef((props, forwardedRef) => {
|
|
|
348
455
|
...props.surfaces
|
|
349
456
|
}
|
|
350
457
|
};
|
|
351
|
-
return /* @__PURE__ */
|
|
458
|
+
return /* @__PURE__ */ React3.createElement(SurfaceContext.Provider, {
|
|
352
459
|
value: currentContext
|
|
353
460
|
}, nodes);
|
|
354
461
|
});
|
|
@@ -385,17 +492,16 @@ var resolveNodes = (components, props, context, forwardedRef) => {
|
|
|
385
492
|
return 1;
|
|
386
493
|
}
|
|
387
494
|
return 0;
|
|
388
|
-
}).map(([key, result]) => /* @__PURE__ */
|
|
495
|
+
}).map(([key, result]) => /* @__PURE__ */ React3.createElement(Fragment, {
|
|
389
496
|
key
|
|
390
497
|
}, result.node));
|
|
391
498
|
return props.limit ? nodes.slice(0, props.limit) : nodes;
|
|
392
499
|
};
|
|
393
500
|
|
|
394
501
|
// packages/sdk/app-framework/src/plugins/PluginHost/PluginHost.tsx
|
|
395
|
-
var __dxlog_file = "/home/runner/work/dxos/dxos/packages/sdk/app-framework/src/plugins/PluginHost/PluginHost.tsx";
|
|
396
502
|
var parsePluginHost = (plugin) => plugin.provides.plugins ? plugin : void 0;
|
|
397
503
|
var PLUGIN_HOST = "dxos.org/plugin/host";
|
|
398
|
-
var PluginHost = ({
|
|
504
|
+
var PluginHost = ({ plugins, meta, core, defaults = [], fallback = DefaultFallback, placeholder = null }) => {
|
|
399
505
|
const state = new LocalStorageStore(PLUGIN_HOST, {
|
|
400
506
|
ready: false,
|
|
401
507
|
core,
|
|
@@ -403,7 +509,7 @@ var PluginHost = ({ order, plugins: definitions, core = [], defaults = [], fallb
|
|
|
403
509
|
...defaults
|
|
404
510
|
],
|
|
405
511
|
plugins: [],
|
|
406
|
-
available:
|
|
512
|
+
available: meta.filter(({ id }) => !core.includes(id)),
|
|
407
513
|
setPlugin: (id, enabled) => {
|
|
408
514
|
if (enabled) {
|
|
409
515
|
state.values.enabled.push(id);
|
|
@@ -424,16 +530,17 @@ var PluginHost = ({ order, plugins: definitions, core = [], defaults = [], fallb
|
|
|
424
530
|
},
|
|
425
531
|
provides: {
|
|
426
532
|
plugins: state.values,
|
|
427
|
-
context: ({ children }) =>
|
|
428
|
-
|
|
429
|
-
|
|
533
|
+
context: ({ children }) => {
|
|
534
|
+
return /* @__PURE__ */ React4.createElement(PluginProvider, {
|
|
535
|
+
value: state.values
|
|
536
|
+
}, children);
|
|
537
|
+
},
|
|
430
538
|
root: () => {
|
|
431
|
-
return /* @__PURE__ */
|
|
539
|
+
return /* @__PURE__ */ React4.createElement(ErrorBoundary, {
|
|
432
540
|
fallback
|
|
433
|
-
}, /* @__PURE__ */
|
|
434
|
-
|
|
541
|
+
}, /* @__PURE__ */ React4.createElement(PluginContainer, {
|
|
542
|
+
plugins,
|
|
435
543
|
core,
|
|
436
|
-
definitions,
|
|
437
544
|
state: state.values,
|
|
438
545
|
placeholder
|
|
439
546
|
}));
|
|
@@ -442,139 +549,36 @@ var PluginHost = ({ order, plugins: definitions, core = [], defaults = [], fallb
|
|
|
442
549
|
};
|
|
443
550
|
};
|
|
444
551
|
var DefaultFallback = ({ error }) => {
|
|
445
|
-
return /* @__PURE__ */
|
|
552
|
+
return /* @__PURE__ */ React4.createElement("div", {
|
|
446
553
|
style: {
|
|
447
554
|
padding: "1rem"
|
|
448
555
|
}
|
|
449
|
-
}, /* @__PURE__ */
|
|
556
|
+
}, /* @__PURE__ */ React4.createElement("h1", {
|
|
450
557
|
style: {
|
|
451
558
|
fontSize: "1.2rem",
|
|
452
559
|
fontWeight: 700,
|
|
453
560
|
margin: "0.5rem 0"
|
|
454
561
|
}
|
|
455
|
-
}, error.message), /* @__PURE__ */
|
|
456
|
-
};
|
|
457
|
-
var Root = ({ order, core: corePluginIds, definitions, state, placeholder }) => {
|
|
458
|
-
const [error, setError] = useState();
|
|
459
|
-
useEffect(() => {
|
|
460
|
-
log("initializing plugins", {
|
|
461
|
-
enabled: state.enabled
|
|
462
|
-
}, {
|
|
463
|
-
F: __dxlog_file,
|
|
464
|
-
L: 102,
|
|
465
|
-
S: void 0,
|
|
466
|
-
C: (f, a) => f(...a)
|
|
467
|
-
});
|
|
468
|
-
const timeout = setTimeout(async () => {
|
|
469
|
-
try {
|
|
470
|
-
const enabledIds = [
|
|
471
|
-
...corePluginIds,
|
|
472
|
-
...state.enabled
|
|
473
|
-
].sort((a, b) => {
|
|
474
|
-
const indexA = order.findIndex(({ id }) => id === a);
|
|
475
|
-
const indexB = order.findIndex(({ id }) => id === b);
|
|
476
|
-
return indexA - indexB;
|
|
477
|
-
});
|
|
478
|
-
const enabled = await Promise.all(enabledIds.map((id) => definitions[id]).filter((definition) => Boolean(definition)).map((definition) => definition()));
|
|
479
|
-
const plugins = await Promise.all(enabled.map(async (definition) => {
|
|
480
|
-
const plugin = await initializePlugin(definition).catch((err) => {
|
|
481
|
-
log.error("Failed to initialize plugin:", {
|
|
482
|
-
id: definition.meta.id,
|
|
483
|
-
err
|
|
484
|
-
}, {
|
|
485
|
-
F: __dxlog_file,
|
|
486
|
-
L: 122,
|
|
487
|
-
S: void 0,
|
|
488
|
-
C: (f, a) => f(...a)
|
|
489
|
-
});
|
|
490
|
-
return void 0;
|
|
491
|
-
});
|
|
492
|
-
return plugin;
|
|
493
|
-
})).then((plugins2) => plugins2.filter((plugin) => Boolean(plugin)));
|
|
494
|
-
log("plugins initialized", {
|
|
495
|
-
plugins
|
|
496
|
-
}, {
|
|
497
|
-
F: __dxlog_file,
|
|
498
|
-
L: 128,
|
|
499
|
-
S: void 0,
|
|
500
|
-
C: (f, a) => f(...a)
|
|
501
|
-
});
|
|
502
|
-
await Promise.all(enabled.map((pluginDefinition) => pluginDefinition.ready?.(plugins)));
|
|
503
|
-
log("plugins ready", {
|
|
504
|
-
plugins
|
|
505
|
-
}, {
|
|
506
|
-
F: __dxlog_file,
|
|
507
|
-
L: 131,
|
|
508
|
-
S: void 0,
|
|
509
|
-
C: (f, a) => f(...a)
|
|
510
|
-
});
|
|
511
|
-
state.plugins = plugins;
|
|
512
|
-
state.ready = true;
|
|
513
|
-
} catch (err) {
|
|
514
|
-
setError(err);
|
|
515
|
-
}
|
|
516
|
-
});
|
|
517
|
-
return () => {
|
|
518
|
-
clearTimeout(timeout);
|
|
519
|
-
state.ready = false;
|
|
520
|
-
};
|
|
521
|
-
}, []);
|
|
522
|
-
if (error) {
|
|
523
|
-
throw error;
|
|
524
|
-
}
|
|
525
|
-
if (!state.ready) {
|
|
526
|
-
return /* @__PURE__ */ React3.createElement(React3.Fragment, null, placeholder);
|
|
527
|
-
}
|
|
528
|
-
const ComposedContext = composeContext(state.plugins);
|
|
529
|
-
return /* @__PURE__ */ React3.createElement(ComposedContext, null, rootComponents(state.plugins));
|
|
530
|
-
};
|
|
531
|
-
var initializePlugin = async (pluginDefinition) => {
|
|
532
|
-
const provides = await pluginDefinition.initialize?.();
|
|
533
|
-
return {
|
|
534
|
-
...pluginDefinition,
|
|
535
|
-
provides: {
|
|
536
|
-
...pluginDefinition.provides,
|
|
537
|
-
...provides
|
|
538
|
-
}
|
|
539
|
-
};
|
|
540
|
-
};
|
|
541
|
-
var rootComponents = (plugins) => {
|
|
542
|
-
return plugins.map((plugin) => {
|
|
543
|
-
const Component2 = plugin.provides.root;
|
|
544
|
-
if (Component2) {
|
|
545
|
-
return /* @__PURE__ */ React3.createElement(Component2, {
|
|
546
|
-
key: plugin.meta.id
|
|
547
|
-
});
|
|
548
|
-
} else {
|
|
549
|
-
return null;
|
|
550
|
-
}
|
|
551
|
-
}).filter((node) => Boolean(node));
|
|
552
|
-
};
|
|
553
|
-
var composeContext = (plugins) => {
|
|
554
|
-
return compose(plugins.map((p) => p.provides.context).filter(Boolean));
|
|
555
|
-
};
|
|
556
|
-
var compose = (contexts) => {
|
|
557
|
-
return [
|
|
558
|
-
...contexts
|
|
559
|
-
].reduce((Acc, Next) => ({ children }) => /* @__PURE__ */ React3.createElement(Acc, null, /* @__PURE__ */ React3.createElement(Next, null, children)));
|
|
562
|
+
}, error.message), /* @__PURE__ */ React4.createElement("pre", null, error.stack));
|
|
560
563
|
};
|
|
561
564
|
|
|
562
565
|
// packages/sdk/app-framework/src/App.tsx
|
|
563
|
-
import
|
|
566
|
+
import React5 from "react";
|
|
564
567
|
import { invariant } from "@dxos/invariant";
|
|
565
568
|
var __dxlog_file2 = "/home/runner/work/dxos/dxos/packages/sdk/app-framework/src/App.tsx";
|
|
566
|
-
var createApp = ({
|
|
569
|
+
var createApp = ({ meta, plugins, core, ...params }) => {
|
|
567
570
|
const host = PluginHost({
|
|
568
|
-
order: [
|
|
569
|
-
meta_default2,
|
|
570
|
-
meta_default,
|
|
571
|
-
...order
|
|
572
|
-
],
|
|
573
571
|
plugins: {
|
|
574
572
|
...plugins,
|
|
575
573
|
[meta_default2.id]: Plugin.lazy(() => import("./plugin-K3KCPCTJ.mjs")),
|
|
576
574
|
[meta_default.id]: Plugin.lazy(() => import("./plugin-MM66VRCO.mjs"))
|
|
577
575
|
},
|
|
576
|
+
// TODO(burdon): Why not include in core?
|
|
577
|
+
meta: [
|
|
578
|
+
meta_default2,
|
|
579
|
+
meta_default,
|
|
580
|
+
...meta
|
|
581
|
+
],
|
|
578
582
|
core: [
|
|
579
583
|
meta_default2.id,
|
|
580
584
|
meta_default.id,
|
|
@@ -582,27 +586,35 @@ var createApp = ({ order, plugins, core = order.map(({ id }) => id), ...params }
|
|
|
582
586
|
],
|
|
583
587
|
...params
|
|
584
588
|
});
|
|
585
|
-
invariant(host.provides
|
|
589
|
+
invariant(host.provides, void 0, {
|
|
586
590
|
F: __dxlog_file2,
|
|
587
|
-
L:
|
|
591
|
+
L: 52,
|
|
588
592
|
S: void 0,
|
|
589
593
|
A: [
|
|
590
|
-
"host.provides
|
|
594
|
+
"host.provides",
|
|
591
595
|
""
|
|
592
596
|
]
|
|
593
597
|
});
|
|
594
|
-
|
|
598
|
+
const { context: Context, root: Root } = host.provides;
|
|
599
|
+
invariant(Context, void 0, {
|
|
595
600
|
F: __dxlog_file2,
|
|
596
|
-
L:
|
|
601
|
+
L: 54,
|
|
602
|
+
S: void 0,
|
|
603
|
+
A: [
|
|
604
|
+
"Context",
|
|
605
|
+
""
|
|
606
|
+
]
|
|
607
|
+
});
|
|
608
|
+
invariant(Root, void 0, {
|
|
609
|
+
F: __dxlog_file2,
|
|
610
|
+
L: 55,
|
|
597
611
|
S: void 0,
|
|
598
612
|
A: [
|
|
599
|
-
"
|
|
613
|
+
"Root",
|
|
600
614
|
""
|
|
601
615
|
]
|
|
602
616
|
});
|
|
603
|
-
|
|
604
|
-
const Root2 = host.provides.root;
|
|
605
|
-
return () => /* @__PURE__ */ React4.createElement(Context, null, /* @__PURE__ */ React4.createElement(Root2, null));
|
|
617
|
+
return () => /* @__PURE__ */ React5.createElement(Context, null, /* @__PURE__ */ React5.createElement(Root, null));
|
|
606
618
|
};
|
|
607
619
|
export {
|
|
608
620
|
ActiveParts,
|
|
@@ -635,7 +647,6 @@ export {
|
|
|
635
647
|
firstIdInPart,
|
|
636
648
|
getPlugin,
|
|
637
649
|
indexInPart,
|
|
638
|
-
initializePlugin,
|
|
639
650
|
isLayoutAdjustment,
|
|
640
651
|
isLayoutMode,
|
|
641
652
|
isLayoutParts,
|
|
@@ -657,7 +668,6 @@ export {
|
|
|
657
668
|
parseSurfacePlugin,
|
|
658
669
|
parseTranslationsPlugin,
|
|
659
670
|
partLength,
|
|
660
|
-
pluginMeta,
|
|
661
671
|
resolvePlugin,
|
|
662
672
|
useIntent,
|
|
663
673
|
useIntentDispatcher,
|