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