@dxos/app-framework 0.3.10-main.dcfebef → 0.3.10-main.e38869c

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.
Files changed (29) hide show
  1. package/dist/lib/browser/index.mjs +15 -150
  2. package/dist/lib/browser/index.mjs.map +4 -4
  3. package/dist/lib/browser/meta.json +1 -1
  4. package/dist/lib/node/index.cjs +43 -173
  5. package/dist/lib/node/index.cjs.map +4 -4
  6. package/dist/lib/node/meta.json +1 -1
  7. package/dist/types/src/plugins/common/layout.d.ts +8 -10
  8. package/dist/types/src/plugins/common/layout.d.ts.map +1 -1
  9. package/dist/types/src/plugins/common/settings.d.ts +6 -5
  10. package/dist/types/src/plugins/common/settings.d.ts.map +1 -1
  11. package/dist/types/src/plugins/index.d.ts +0 -1
  12. package/dist/types/src/plugins/index.d.ts.map +1 -1
  13. package/package.json +9 -15
  14. package/src/plugins/common/layout.ts +1 -3
  15. package/src/plugins/common/settings.ts +11 -5
  16. package/src/plugins/index.ts +0 -1
  17. package/tsconfig.json +0 -12
  18. package/dist/types/src/plugins/components/SettingsDialog.d.ts +0 -2
  19. package/dist/types/src/plugins/components/SettingsDialog.d.ts.map +0 -1
  20. package/dist/types/src/plugins/components/SettingsValue.d.ts +0 -8
  21. package/dist/types/src/plugins/components/SettingsValue.d.ts.map +0 -1
  22. package/dist/types/src/plugins/components/ShortcutsDialog.d.ts +0 -2
  23. package/dist/types/src/plugins/components/ShortcutsDialog.d.ts.map +0 -1
  24. package/dist/types/src/plugins/components/index.d.ts +0 -4
  25. package/dist/types/src/plugins/components/index.d.ts.map +0 -1
  26. package/src/plugins/components/SettingsDialog.tsx +0 -100
  27. package/src/plugins/components/SettingsValue.tsx +0 -36
  28. package/src/plugins/components/ShortcutsDialog.tsx +0 -61
  29. package/src/plugins/components/index.ts +0 -7
@@ -38,9 +38,7 @@ __export(node_exports, {
38
38
  Resource: () => Resource,
39
39
  ResourceKey: () => ResourceKey,
40
40
  ResourceLanguage: () => ResourceLanguage,
41
- SettingsDialogContent: () => SettingsDialogContent,
42
- SettingsValue: () => SettingsValue,
43
- ShortcutsDialogContent: () => ShortcutsDialogContent,
41
+ SettingsAction: () => SettingsAction,
44
42
  Surface: () => Surface,
45
43
  SurfaceProvider: () => import_chunk_DC3GU6QR.SurfaceProvider,
46
44
  createApp: () => createApp,
@@ -58,6 +56,7 @@ __export(node_exports, {
58
56
  parseMetadataResolverPlugin: () => parseMetadataResolverPlugin,
59
57
  parsePluginHost: () => parsePluginHost,
60
58
  parseRootSurfacePlugin: () => import_chunk_DC3GU6QR.parseRootSurfacePlugin,
59
+ parseSettingsPlugin: () => parseSettingsPlugin,
61
60
  parseSurfacePlugin: () => import_chunk_DC3GU6QR.parseSurfacePlugin,
62
61
  parseTranslationsPlugin: () => parseTranslationsPlugin,
63
62
  pluginMeta: () => pluginMeta,
@@ -74,24 +73,15 @@ var import_chunk_BOQBLWMX = require("./chunk-BOQBLWMX.cjs");
74
73
  var import_chunk_VDKZ7AAF = require("./chunk-VDKZ7AAF.cjs");
75
74
  var import_zod = require("zod");
76
75
  var import_zod2 = require("zod");
77
- var import_react = __toESM(require("react"));
78
- var import_react_ui = require("@dxos/react-ui");
79
- var import_react_ui_theme = require("@dxos/react-ui-theme");
80
- var import_react2 = require("react");
81
- var import_react3 = require("deepsignal/react");
82
- var import_react4 = __toESM(require("react"));
76
+ var import_react = require("react");
77
+ var import_react2 = require("deepsignal/react");
78
+ var import_react3 = __toESM(require("react"));
83
79
  var import_local_storage = require("@dxos/local-storage");
84
80
  var import_log = require("@dxos/log");
81
+ var import_react4 = __toESM(require("react"));
85
82
  var import_react5 = __toESM(require("react"));
86
- var import_react6 = __toESM(require("react"));
87
- var import_react7 = require("react");
88
- var import_react8 = __toESM(require("react"));
89
- var import_react_ui2 = require("@dxos/react-ui");
90
- var import_react9 = __toESM(require("react"));
91
- var import_keyboard = require("@dxos/keyboard");
92
- var import_react_ui3 = require("@dxos/react-ui");
93
- var import_react_ui_theme2 = require("@dxos/react-ui-theme");
94
- var import_react10 = __toESM(require("react"));
83
+ var import_react6 = require("react");
84
+ var import_react7 = __toESM(require("react"));
95
85
  var import_invariant = require("@dxos/invariant");
96
86
  var parseGraphPlugin = (plugin) => plugin.provides.graph?.root ? plugin : void 0;
97
87
  var parseGraphBuilderPlugin = (plugin) => plugin.provides.graph?.builder ? plugin : void 0;
@@ -114,7 +104,7 @@ var parseLayoutPlugin = (plugin) => {
114
104
  const { success } = Layout.safeParse(plugin.provides.layout);
115
105
  return success ? plugin : void 0;
116
106
  };
117
- var LAYOUT_ACTION = "dxos.org/plugin/intent";
107
+ var LAYOUT_ACTION = "dxos.org/plugin/layout";
118
108
  var LayoutAction;
119
109
  (function(LayoutAction2) {
120
110
  LayoutAction2[LayoutAction2["TOGGLE_FULLSCREEN"] = `${LAYOUT_ACTION}/toggle-fullscreen`] = "TOGGLE_FULLSCREEN";
@@ -124,8 +114,6 @@ var LayoutAction;
124
114
  LayoutAction2[LayoutAction2["CLOSE_DIALOG"] = `${LAYOUT_ACTION}/close-dialog`] = "CLOSE_DIALOG";
125
115
  LayoutAction2[LayoutAction2["OPEN_POPOVER"] = `${LAYOUT_ACTION}/open-popover`] = "OPEN_POPOVER";
126
116
  LayoutAction2[LayoutAction2["CLOSE_POPOVER"] = `${LAYOUT_ACTION}/close-popover`] = "CLOSE_POPOVER";
127
- LayoutAction2[LayoutAction2["OPEN_SETTINGS"] = `${LAYOUT_ACTION}/open-settings`] = "OPEN_SETTINGS";
128
- LayoutAction2[LayoutAction2["OPEN_SHORTCUTS"] = `${LAYOUT_ACTION}/open-shortcuts`] = "OPEN_SHORTCUTS";
129
117
  LayoutAction2[LayoutAction2["ACTIVATE"] = `${LAYOUT_ACTION}/activate`] = "ACTIVATE";
130
118
  })(LayoutAction || (LayoutAction = {}));
131
119
  var parseMetadataRecordsPlugin = (plugin) => {
@@ -134,6 +122,14 @@ var parseMetadataRecordsPlugin = (plugin) => {
134
122
  var parseMetadataResolverPlugin = (plugin) => {
135
123
  return plugin.provides.metadata?.resolver ? plugin : void 0;
136
124
  };
125
+ var parseSettingsPlugin = (plugin) => {
126
+ return typeof plugin.provides.settings === "object" ? plugin : void 0;
127
+ };
128
+ var SETTINGS_ACTION = "dxos.org/plugin/settings";
129
+ var SettingsAction;
130
+ (function(SettingsAction2) {
131
+ SettingsAction2[SettingsAction2["OPEN"] = `${SETTINGS_ACTION}/open`] = "OPEN";
132
+ })(SettingsAction || (SettingsAction = {}));
137
133
  var ResourceKey = import_zod2.z.union([
138
134
  import_zod2.z.string(),
139
135
  import_zod2.z.record(import_zod2.z.any())
@@ -153,7 +149,7 @@ var Plugin;
153
149
  });
154
150
  };
155
151
  })(Plugin || (Plugin = {}));
156
- var PluginContext = /* @__PURE__ */ (0, import_react2.createContext)({
152
+ var PluginContext = /* @__PURE__ */ (0, import_react.createContext)({
157
153
  ready: false,
158
154
  enabled: [],
159
155
  plugins: [],
@@ -161,7 +157,7 @@ var PluginContext = /* @__PURE__ */ (0, import_react2.createContext)({
161
157
  setPlugin: () => {
162
158
  }
163
159
  });
164
- var usePlugins = () => (0, import_react2.useContext)(PluginContext);
160
+ var usePlugins = () => (0, import_react.useContext)(PluginContext);
165
161
  var usePlugin = (id) => {
166
162
  const { plugins } = usePlugins();
167
163
  return (0, import_chunk_VDKZ7AAF.findPlugin)(plugins, id);
@@ -201,11 +197,11 @@ var PluginHost = ({ order, plugins: definitions, core = [], defaults = [], fallb
201
197
  },
202
198
  provides: {
203
199
  plugins: state.values,
204
- context: ({ children }) => /* @__PURE__ */ import_react4.default.createElement(PluginProvider, {
200
+ context: ({ children }) => /* @__PURE__ */ import_react3.default.createElement(PluginProvider, {
205
201
  value: state.values
206
202
  }, children),
207
203
  root: () => {
208
- (0, import_react4.useEffect)(() => {
204
+ (0, import_react3.useEffect)(() => {
209
205
  (0, import_log.log)("initializing plugins", {
210
206
  enabled: state.values.enabled
211
207
  }, {
@@ -250,7 +246,7 @@ var PluginHost = ({ order, plugins: definitions, core = [], defaults = [], fallb
250
246
  S: void 0,
251
247
  C: (f, a) => f(...a)
252
248
  });
253
- state.values.plugins = (0, import_react3.shallow)(plugins);
249
+ state.values.plugins = (0, import_react2.shallow)(plugins);
254
250
  state.values.ready = true;
255
251
  });
256
252
  return () => {
@@ -259,10 +255,10 @@ var PluginHost = ({ order, plugins: definitions, core = [], defaults = [], fallb
259
255
  };
260
256
  }, []);
261
257
  if (!state.values.ready) {
262
- return /* @__PURE__ */ import_react4.default.createElement(import_react4.default.Fragment, null, fallback);
258
+ return /* @__PURE__ */ import_react3.default.createElement(import_react3.default.Fragment, null, fallback);
263
259
  }
264
260
  const ComposedContext = composeContext(state.values.plugins);
265
- return /* @__PURE__ */ import_react4.default.createElement(ComposedContext, null, rootComponents(state.values.plugins));
261
+ return /* @__PURE__ */ import_react3.default.createElement(ComposedContext, null, rootComponents(state.values.plugins));
266
262
  }
267
263
  }
268
264
  };
@@ -281,7 +277,7 @@ var rootComponents = (plugins) => {
281
277
  return plugins.map((plugin) => {
282
278
  const Component2 = plugin.provides.root;
283
279
  if (Component2) {
284
- return /* @__PURE__ */ import_react4.default.createElement(Component2, {
280
+ return /* @__PURE__ */ import_react3.default.createElement(Component2, {
285
281
  key: plugin.meta.id
286
282
  });
287
283
  } else {
@@ -295,10 +291,10 @@ var composeContext = (plugins) => {
295
291
  var compose = (contexts) => {
296
292
  return [
297
293
  ...contexts
298
- ].reduce((Acc, Next) => ({ children }) => /* @__PURE__ */ import_react4.default.createElement(Acc, null, /* @__PURE__ */ import_react4.default.createElement(Next, null, children)));
294
+ ].reduce((Acc, Next) => ({ children }) => /* @__PURE__ */ import_react3.default.createElement(Acc, null, /* @__PURE__ */ import_react3.default.createElement(Next, null, children)));
299
295
  };
300
296
  var isObject = (data) => !!data && typeof data === "object";
301
- var ErrorBoundary = class extends import_react5.Component {
297
+ var ErrorBoundary = class extends import_react4.Component {
302
298
  constructor(props) {
303
299
  super(props);
304
300
  this.state = {
@@ -317,7 +313,7 @@ var ErrorBoundary = class extends import_react5.Component {
317
313
  }
318
314
  render() {
319
315
  if (this.state.error) {
320
- return /* @__PURE__ */ import_react5.default.createElement(this.props.fallback, {
316
+ return /* @__PURE__ */ import_react4.default.createElement(this.props.fallback, {
321
317
  error: this.state.error,
322
318
  reset: this.resetError
323
319
  });
@@ -330,30 +326,30 @@ var ErrorBoundary = class extends import_react5.Component {
330
326
  });
331
327
  }
332
328
  };
333
- var Surface = /* @__PURE__ */ (0, import_react6.forwardRef)(({ role, name = role, fallback, ...rest }, forwardedRef) => {
329
+ var Surface = /* @__PURE__ */ (0, import_react5.forwardRef)(({ role, name = role, fallback, ...rest }, forwardedRef) => {
334
330
  const props = {
335
331
  role,
336
332
  name,
337
333
  fallback,
338
334
  ...rest
339
335
  };
340
- const context = (0, import_react7.useContext)(SurfaceContext);
336
+ const context = (0, import_react6.useContext)(SurfaceContext);
341
337
  const data = props.data ?? (name && context?.surfaces?.[name]?.data || {});
342
- return /* @__PURE__ */ import_react6.default.createElement(import_react6.default.Fragment, null, fallback ? /* @__PURE__ */ import_react6.default.createElement(ErrorBoundary, {
338
+ return /* @__PURE__ */ import_react5.default.createElement(import_react5.default.Fragment, null, fallback ? /* @__PURE__ */ import_react5.default.createElement(ErrorBoundary, {
343
339
  data,
344
340
  fallback
345
- }, /* @__PURE__ */ import_react6.default.createElement(SurfaceResolver, {
341
+ }, /* @__PURE__ */ import_react5.default.createElement(SurfaceResolver, {
346
342
  ...props,
347
343
  ref: forwardedRef
348
- })) : /* @__PURE__ */ import_react6.default.createElement(SurfaceResolver, {
344
+ })) : /* @__PURE__ */ import_react5.default.createElement(SurfaceResolver, {
349
345
  ...props,
350
346
  ref: forwardedRef
351
347
  }));
352
348
  });
353
- var SurfaceContext = /* @__PURE__ */ (0, import_react7.createContext)(null);
354
- var SurfaceResolver = /* @__PURE__ */ (0, import_react6.forwardRef)((props, forwardedRef) => {
349
+ var SurfaceContext = /* @__PURE__ */ (0, import_react6.createContext)(null);
350
+ var SurfaceResolver = /* @__PURE__ */ (0, import_react5.forwardRef)((props, forwardedRef) => {
355
351
  const { components } = (0, import_chunk_DC3GU6QR.useSurface)();
356
- const parent = (0, import_react7.useContext)(SurfaceContext);
352
+ const parent = (0, import_react6.useContext)(SurfaceContext);
357
353
  const nodes = resolveNodes(components, props, parent, forwardedRef);
358
354
  const currentContext = {
359
355
  ...props,
@@ -362,9 +358,9 @@ var SurfaceResolver = /* @__PURE__ */ (0, import_react6.forwardRef)((props, forw
362
358
  ...props.surfaces
363
359
  }
364
360
  };
365
- return /* @__PURE__ */ import_react6.default.createElement(SurfaceContext.Provider, {
361
+ return /* @__PURE__ */ import_react5.default.createElement(SurfaceContext.Provider, {
366
362
  value: currentContext
367
- }, nodes.length > 0 ? nodes : props.contentFallback ? /* @__PURE__ */ import_react6.default.createElement(props.contentFallback, null) : null);
363
+ }, nodes.length > 0 ? nodes : props.contentFallback ? /* @__PURE__ */ import_react5.default.createElement(props.contentFallback, null) : null);
368
364
  });
369
365
  var resolveNodes = (components, props, context, forwardedRef) => {
370
366
  const data = {
@@ -382,7 +378,7 @@ var resolveNodes = (components, props, context, forwardedRef) => {
382
378
  return "node" in result ? [
383
379
  key,
384
380
  result
385
- ] : /* @__PURE__ */ (0, import_react6.isValidElement)(result) ? [
381
+ ] : /* @__PURE__ */ (0, import_react5.isValidElement)(result) ? [
386
382
  key,
387
383
  {
388
384
  node: result
@@ -399,136 +395,11 @@ var resolveNodes = (components, props, context, forwardedRef) => {
399
395
  return 1;
400
396
  }
401
397
  return 0;
402
- }).map(([key, result]) => /* @__PURE__ */ import_react6.default.createElement(import_react6.Fragment, {
398
+ }).map(([key, result]) => /* @__PURE__ */ import_react5.default.createElement(import_react5.Fragment, {
403
399
  key
404
400
  }, result.node));
405
401
  return props.limit ? nodes.slice(0, props.limit) : nodes;
406
402
  };
407
- var SettingsDialogContent = () => {
408
- const { t } = (0, import_react_ui.useTranslation)("os");
409
- const [plugin, setPlugin] = (0, import_react.useState)("dxos.org/plugin/registry");
410
- const { plugins, enabled } = usePlugins();
411
- const core = [
412
- "dxos.org/plugin/layout",
413
- "dxos.org/plugin/client",
414
- "dxos.org/plugin/space",
415
- "dxos.org/plugin/registry"
416
- ];
417
- const filteredPlugins = enabled.map((id) => plugins.find((plugin2) => plugin2.meta.id === id)).filter((plugin2) => plugin2?.provides?.settings).map((plugin2) => plugin2.meta).sort(({ name: a }, { name: b }) => a?.localeCompare(b ?? "") ?? 0);
418
- return /* @__PURE__ */ import_react.default.createElement(import_react_ui.DensityProvider, {
419
- density: "fine"
420
- }, /* @__PURE__ */ import_react.default.createElement(import_react_ui.Dialog.Content, {
421
- classNames: [
422
- "h-[90%] md:max-is-[40rem] overflow-hidden"
423
- ]
424
- }, /* @__PURE__ */ import_react.default.createElement(import_react_ui.Dialog.Title, null, t("settings dialog title", {
425
- ns: "os"
426
- })), /* @__PURE__ */ import_react.default.createElement("div", {
427
- className: "flex grow mlb-4 overflow-hidden"
428
- }, /* @__PURE__ */ import_react.default.createElement("div", {
429
- className: (0, import_react_ui_theme.mx)("flex flex-col w-[200px] space-y-4 pr-4 border-r overflow-y-auto", import_react_ui_theme.groupBorder)
430
- }, /* @__PURE__ */ import_react.default.createElement(PluginList, {
431
- title: "Options",
432
- plugins: core.map((id) => plugins.find((p) => p.meta.id === id).meta),
433
- selected: plugin,
434
- onSelect: (plugin2) => setPlugin(plugin2)
435
- }), /* @__PURE__ */ import_react.default.createElement(PluginList, {
436
- title: "Plugins",
437
- plugins: filteredPlugins,
438
- selected: plugin,
439
- onSelect: (plugin2) => setPlugin(plugin2)
440
- })), /* @__PURE__ */ import_react.default.createElement("div", {
441
- className: (0, import_react_ui_theme.mx)("flex flex-col w-full md:px-4 divide-y overflow-y-auto", import_react_ui_theme.groupBorder)
442
- }, /* @__PURE__ */ import_react.default.createElement(Surface, {
443
- role: "settings",
444
- data: {
445
- plugin
446
- }
447
- }))), /* @__PURE__ */ import_react.default.createElement(import_react_ui.Dialog.Close, {
448
- asChild: true
449
- }, /* @__PURE__ */ import_react.default.createElement(import_react_ui.Button, {
450
- variant: "primary",
451
- classNames: "mbs-2"
452
- }, t("done label", {
453
- ns: "os"
454
- })))));
455
- };
456
- var PluginList = ({ title, plugins, selected, onSelect }) => {
457
- return /* @__PURE__ */ import_react.default.createElement("div", {
458
- role: "none"
459
- }, /* @__PURE__ */ import_react.default.createElement("h2", {
460
- className: "my-1 px-2 text-sm text-neutral-500"
461
- }, title), /* @__PURE__ */ import_react.default.createElement(import_react_ui.List, {
462
- selectable: true
463
- }, plugins.map((plugin) => /* @__PURE__ */ import_react.default.createElement(import_react_ui.ListItem.Root, {
464
- key: plugin.id,
465
- onClick: () => onSelect(plugin.id),
466
- selected: plugin.id === selected,
467
- classNames: [
468
- "px-2 rounded",
469
- plugin.id === selected && import_react_ui_theme.ghostSelected,
470
- import_react_ui_theme.ghostHover
471
- ]
472
- }, /* @__PURE__ */ import_react.default.createElement(import_react_ui.ListItem.Heading, {
473
- classNames: [
474
- "flex w-full items-center cursor-pointer"
475
- ]
476
- }, plugin.name)))));
477
- };
478
- var SettingsValue = ({ label, description, children }) => {
479
- return /* @__PURE__ */ import_react8.default.createElement("div", {
480
- role: "none",
481
- className: "flex w-full gap-4 py-1"
482
- }, /* @__PURE__ */ import_react8.default.createElement(import_react_ui2.Input.Root, null, /* @__PURE__ */ import_react8.default.createElement("div", {
483
- role: "none",
484
- className: "flex flex-col w-full"
485
- }, /* @__PURE__ */ import_react8.default.createElement(import_react_ui2.Input.Label, {
486
- classNames: "flex min-h-[40px] items-center"
487
- }, label), description && /* @__PURE__ */ import_react8.default.createElement(import_react_ui2.Input.DescriptionAndValidation, {
488
- classNames: "mbs-0.5"
489
- }, /* @__PURE__ */ import_react8.default.createElement(import_react_ui2.Input.Description, null, description))), /* @__PURE__ */ import_react8.default.createElement("div", {
490
- role: "none"
491
- }, /* @__PURE__ */ import_react8.default.createElement("div", {
492
- role: "none",
493
- className: "flex min-h-[40px] items-center"
494
- }, children))));
495
- };
496
- var ShortcutsDialogContent = () => {
497
- const { t } = (0, import_react_ui3.useTranslation)("os");
498
- const bindings = import_keyboard.Keyboard.singleton.getBindings();
499
- const getLabel = (label) => Array.isArray(label) ? t(...label) : label;
500
- return /* @__PURE__ */ import_react9.default.createElement(import_react_ui3.DensityProvider, {
501
- density: "fine"
502
- }, /* @__PURE__ */ import_react9.default.createElement(import_react_ui3.Dialog.Content, {
503
- classNames: [
504
- "md:max-is-[30rem] overflow-hidden"
505
- ]
506
- }, /* @__PURE__ */ import_react9.default.createElement(import_react_ui3.Dialog.Title, null, t("shortcuts dialog title", {
507
- ns: "os"
508
- })), /* @__PURE__ */ import_react9.default.createElement("table", {
509
- className: "table-fixed border-collapse my-4"
510
- }, /* @__PURE__ */ import_react9.default.createElement("tbody", null, bindings.map((binding, i) => /* @__PURE__ */ import_react9.default.createElement("tr", {
511
- key: i
512
- }, /* @__PURE__ */ import_react9.default.createElement("td", {
513
- className: "p-1 w-[120px]"
514
- }, /* @__PURE__ */ import_react9.default.createElement("div", {
515
- className: "flex gap-1"
516
- }, (0, import_keyboard.keySymbols)(binding.binding).map((c, i2) => /* @__PURE__ */ import_react9.default.createElement("span", {
517
- key: i2,
518
- className: (0, import_react_ui_theme2.mx)("inline-flex w-[24px] h-[24px] justify-center items-center text-xs", "rounded border border-neutral-300 dark:border-neutral-600 bg-neutral-50 dark:bg-neutral-850")
519
- }, c)))), /* @__PURE__ */ import_react9.default.createElement("td", {
520
- className: "p-1"
521
- }, /* @__PURE__ */ import_react9.default.createElement("span", {
522
- className: "grow truncate"
523
- }, getLabel(binding.data))))))), /* @__PURE__ */ import_react9.default.createElement(import_react_ui3.Dialog.Close, {
524
- asChild: true
525
- }, /* @__PURE__ */ import_react9.default.createElement(import_react_ui3.Button, {
526
- variant: "primary",
527
- classNames: "mbs-2"
528
- }, t("close label", {
529
- ns: "os"
530
- })))));
531
- };
532
403
  var __dxlog_file2 = "/home/runner/work/dxos/dxos/packages/sdk/app-framework/src/App.tsx";
533
404
  var createApp = ({ order, plugins, core = order.map(({ id }) => id), ...params }) => {
534
405
  const host = PluginHost({
@@ -569,7 +440,7 @@ var createApp = ({ order, plugins, core = order.map(({ id }) => id), ...params }
569
440
  });
570
441
  const Context = host.provides.context;
571
442
  const Root = host.provides.root;
572
- return () => /* @__PURE__ */ import_react10.default.createElement(Context, null, /* @__PURE__ */ import_react10.default.createElement(Root, null));
443
+ return () => /* @__PURE__ */ import_react7.default.createElement(Context, null, /* @__PURE__ */ import_react7.default.createElement(Root, null));
573
444
  };
574
445
  // Annotate the CommonJS export names for ESM import in node:
575
446
  0 && (module.exports = {
@@ -583,9 +454,7 @@ var createApp = ({ order, plugins, core = order.map(({ id }) => id), ...params }
583
454
  Resource,
584
455
  ResourceKey,
585
456
  ResourceLanguage,
586
- SettingsDialogContent,
587
- SettingsValue,
588
- ShortcutsDialogContent,
457
+ SettingsAction,
589
458
  Surface,
590
459
  SurfaceProvider,
591
460
  createApp,
@@ -603,6 +472,7 @@ var createApp = ({ order, plugins, core = order.map(({ id }) => id), ...params }
603
472
  parseMetadataResolverPlugin,
604
473
  parsePluginHost,
605
474
  parseRootSurfacePlugin,
475
+ parseSettingsPlugin,
606
476
  parseSurfacePlugin,
607
477
  parseTranslationsPlugin,
608
478
  pluginMeta,
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
- "sources": ["../../../src/plugins/common/graph.ts", "../../../src/plugins/common/layout.ts", "../../../src/plugins/common/metadata.ts", "../../../src/plugins/common/translations.ts", "../../../src/plugins/components/SettingsDialog.tsx", "../../../src/plugins/PluginHost/plugin.ts", "../../../src/plugins/PluginHost/PluginContext.tsx", "../../../src/plugins/PluginHost/PluginHost.tsx", "../../../src/plugins/SurfacePlugin/helpers.ts", "../../../src/plugins/SurfacePlugin/ErrorBoundary.tsx", "../../../src/plugins/SurfacePlugin/Surface.tsx", "../../../src/plugins/components/SettingsValue.tsx", "../../../src/plugins/components/ShortcutsDialog.tsx", "../../../src/App.tsx"],
4
- "sourcesContent": ["//\n// Copyright 2023 DXOS.org\n//\n\nimport type { Graph, Node } from '@dxos/app-graph';\nimport type { UnsubscribeCallback } from '@dxos/async';\n\nimport type { Plugin } from '../PluginHost';\n\n/**\n * Provides for a plugin that exposes the application graph.\n */\nexport type GraphProvides = {\n graph: Graph;\n};\n\nexport type GraphBuilderProvides = {\n graph: {\n builder: (params: { parent: Node; plugins: Plugin[] }) => UnsubscribeCallback | void;\n };\n};\n\n/**\n * Type guard for graph plugins.\n */\nexport const parseGraphPlugin = (plugin: Plugin) =>\n (plugin.provides as any).graph?.root ? (plugin as Plugin<GraphProvides>) : undefined;\n\n/**\n * Type guard for graph builder plugins.\n */\nexport const parseGraphBuilderPlugin = (plugin: Plugin) =>\n (plugin.provides as any).graph?.builder ? (plugin as Plugin<GraphBuilderProvides>) : undefined;\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport { z } from 'zod';\n\nimport type { Plugin } from '../PluginHost';\n\n//\n// Provides\n//\n\n/**\n * Basic state provided by a layout plugin.\n */\n// TODO(burdon): Josiah: why do we use zod here?\nexport const Layout = z.object({\n fullscreen: z.boolean(),\n sidebarOpen: z.boolean(),\n complementarySidebarOpen: z.boolean(),\n\n // TODO(burdon): Why do we have a single root?\n dialogOpen: z.boolean(),\n dialogContent: z.any().optional().describe('Data to be passed to the dialog Surface.'),\n\n popoverOpen: z.boolean(),\n popoverContent: z.any().optional().describe('Data to be passed to the popover Surface.'),\n popoverAnchorId: z.string().optional(),\n\n // TODO(wittjosiah): Array?\n active: z.string().optional().describe('Id of the currently active item.'),\n // TODO(wittjosiah): History?\n previous: z.string().optional(),\n});\n\nexport type Layout = z.infer<typeof Layout>;\n\n/**\n * Provides for a plugin that can manage the app layout.\n */\nexport type LayoutProvides = {\n layout: Readonly<Layout>;\n};\n\n/**\n * Type guard for layout plugins.\n */\nexport const parseLayoutPlugin = (plugin: Plugin) => {\n const { success } = Layout.safeParse((plugin.provides as any).layout);\n return success ? (plugin as Plugin<LayoutProvides>) : undefined;\n};\n\n//\n// Intents\n//\n\nconst LAYOUT_ACTION = 'dxos.org/plugin/intent';\n// TODO(wittjosiah): Consider consolidating some action types (e.g. toggle).\nexport enum LayoutAction {\n TOGGLE_FULLSCREEN = `${LAYOUT_ACTION}/toggle-fullscreen`,\n TOGGLE_SIDEBAR = `${LAYOUT_ACTION}/toggle-sidebar`,\n TOGGLE_COMPLEMENTARY_SIDEBAR = `${LAYOUT_ACTION}/toggle-complementary-sidebar`,\n OPEN_DIALOG = `${LAYOUT_ACTION}/open-dialog`,\n CLOSE_DIALOG = `${LAYOUT_ACTION}/close-dialog`,\n OPEN_POPOVER = `${LAYOUT_ACTION}/open-popover`,\n CLOSE_POPOVER = `${LAYOUT_ACTION}/close-popover`,\n OPEN_SETTINGS = `${LAYOUT_ACTION}/open-settings`,\n OPEN_SHORTCUTS = `${LAYOUT_ACTION}/open-shortcuts`,\n ACTIVATE = `${LAYOUT_ACTION}/activate`,\n}\n\n/**\n * Expected payload for layout actions.\n */\nexport namespace LayoutAction {\n export type ToggleFullscreen = {\n state?: boolean;\n };\n\n export type ToggleSidebar = {\n state?: boolean;\n };\n\n export type ToggleComplementarySidebar = {\n state?: boolean;\n };\n\n export type OpenDialog = {\n component: string;\n subject: any;\n };\n\n export type CloseDialog = {};\n\n export type OpenPopover = {\n anchorId: string;\n component: string;\n subject: any;\n };\n\n export type ClosePopover = {};\n\n export type Activate = {\n id: string;\n };\n}\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport type { Plugin } from '../PluginHost';\n\nexport type Metadata = Record<string, any>;\n\nexport type MetadataRecordsProvides = {\n metadata: {\n records: Record<string, Metadata>;\n };\n};\n\nexport type MetadataResolver = (type: string) => Metadata;\n\nexport type MetadataResolverProvides = {\n metadata: {\n resolver: MetadataResolver;\n };\n};\n\nexport const parseMetadataRecordsPlugin = (plugin: Plugin) => {\n return (plugin.provides as any).metadata?.records ? (plugin as Plugin<MetadataRecordsProvides>) : undefined;\n};\n\nexport const parseMetadataResolverPlugin = (plugin: Plugin) => {\n return (plugin.provides as any).metadata?.resolver ? (plugin as Plugin<MetadataResolverProvides>) : undefined;\n};\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport { z } from 'zod';\n\nimport type { Plugin } from '../PluginHost';\n\nexport const ResourceKey = z.union([z.string(), z.record(z.any())]);\nexport type ResourceKey = z.infer<typeof ResourceKey>;\n\nexport const ResourceLanguage = z.record(ResourceKey);\nexport type ResourceLanguage = z.infer<typeof ResourceLanguage>;\n\n/**\n * A resource is a collection of translations for a language.\n */\nexport const Resource = z.record(ResourceLanguage);\nexport type Resource = z.infer<typeof Resource>;\n\n/**\n * Provides for a plugin that exposes translations.\n */\n// TODO(wittjosiah): Rename to TranslationResourcesProvides.\nexport type TranslationsProvides = {\n translations: Readonly<Resource[]>;\n};\n\n// TODO(wittjosiah): Add TranslationsProvides.\n// export type TranslationsProvides = {\n// translations: {\n// t: TFunction;\n// };\n// };\n\n/**\n * Type guard for translation plugins.\n */\nexport const parseTranslationsPlugin = (plugin: Plugin) => {\n const { success } = z.array(Resource).safeParse((plugin.provides as any).translations);\n return success ? (plugin as Plugin<TranslationsProvides>) : undefined;\n};\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport React, { useState } from 'react';\n\nimport { Button, DensityProvider, Dialog, List, ListItem, useTranslation } from '@dxos/react-ui';\nimport { ghostHover, ghostSelected, groupBorder, mx } from '@dxos/react-ui-theme';\n\nimport { type Plugin, usePlugins } from '../PluginHost';\nimport { Surface } from '../SurfacePlugin';\n\n// TODO(burdon): Move into separate plugin.\nexport const SettingsDialogContent = () => {\n const { t } = useTranslation('os');\n\n // TODO(burdon): Store preview tab.\n const [plugin, setPlugin] = useState<string>('dxos.org/plugin/registry');\n const { plugins, enabled } = usePlugins();\n\n const core = [\n 'dxos.org/plugin/layout',\n 'dxos.org/plugin/client',\n 'dxos.org/plugin/space',\n 'dxos.org/plugin/registry',\n ];\n\n const filteredPlugins = enabled\n .map((id) => plugins.find((plugin) => plugin.meta.id === id))\n .filter((plugin) => (plugin?.provides as any)?.settings)\n .map((plugin) => plugin!.meta)\n .sort(({ name: a }, { name: b }) => a?.localeCompare(b ?? '') ?? 0);\n\n // TODO(burdon): Vertical layout if mobile (pattern).\n return (\n <DensityProvider density='fine'>\n <Dialog.Content classNames={['h-[90%] md:max-is-[40rem] overflow-hidden']}>\n <Dialog.Title>{t('settings dialog title', { ns: 'os' })}</Dialog.Title>\n\n <div className='flex grow mlb-4 overflow-hidden'>\n <div className={mx('flex flex-col w-[200px] space-y-4 pr-4 border-r overflow-y-auto', groupBorder)}>\n <PluginList\n title='Options'\n plugins={core.map((id) => plugins.find((p) => p.meta.id === id)!.meta)}\n selected={plugin}\n onSelect={(plugin) => setPlugin(plugin)}\n />\n\n <PluginList\n title='Plugins'\n plugins={filteredPlugins}\n selected={plugin}\n onSelect={(plugin) => setPlugin(plugin)}\n />\n </div>\n\n <div className={mx('flex flex-col w-full md:px-4 divide-y overflow-y-auto', groupBorder)}>\n <Surface role='settings' data={{ plugin }} />\n </div>\n </div>\n\n <Dialog.Close asChild>\n <Button variant='primary' classNames='mbs-2'>\n {t('done label', { ns: 'os' })}\n </Button>\n </Dialog.Close>\n </Dialog.Content>\n </DensityProvider>\n );\n};\n\nconst PluginList = ({\n title,\n plugins,\n selected,\n onSelect,\n}: {\n title: string;\n plugins: Plugin['meta'][];\n selected?: string;\n onSelect: (plugin: string) => void;\n}) => {\n return (\n <div role='none'>\n <h2 className='my-1 px-2 text-sm text-neutral-500'>{title}</h2>\n <List selectable>\n {plugins.map((plugin) => (\n <ListItem.Root\n key={plugin.id}\n onClick={() => onSelect(plugin.id)}\n selected={plugin.id === selected}\n classNames={['px-2 rounded', plugin.id === selected && ghostSelected, ghostHover]}\n >\n <ListItem.Heading classNames={['flex w-full items-center cursor-pointer']}>{plugin.name}</ListItem.Heading>\n </ListItem.Root>\n ))}\n </List>\n </div>\n );\n};\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport type { IconProps } from '@phosphor-icons/react';\nimport type { FC, PropsWithChildren } from 'react';\n\n/**\n * Capabilities provided by a plugin.\n * The base surface capabilities are always included.\n */\nexport type PluginProvides<TProvides> = TProvides & {\n /**\n * React Context which is wrapped around the application to enable any hooks the plugin may provide.\n */\n context?: FC<PropsWithChildren>;\n\n /*\n * React component which is rendered at the root of the application.\n */\n root?: FC<PropsWithChildren>;\n};\n\n/**\n * A unit of containment of modular functionality that can be provided to an application.\n * Plugins provide things like components, state, actions, etc. to the application.\n */\nexport type Plugin<TProvides = {}> = {\n meta: {\n /**\n * Globally unique ID.\n *\n * Expected to be in the form of a valid URL.\n *\n * @example dxos.org/plugin/example\n */\n id: string;\n\n /**\n * Short ID for use in URLs.\n *\n * NOTE: This is especially experimental and likely to change.\n */\n // TODO(wittjosiah): How should these be managed?\n shortId?: string;\n\n /**\n * Human-readable name.\n */\n name?: string;\n\n /**\n * Short description of plugin functionality.\n */\n description?: string;\n\n /**\n * URL of home page.\n */\n homePage?: string;\n\n /**\n * Tags to help categorize the plugin.\n */\n tags?: string[];\n\n /**\n * Component to render icon for the plugin when displayed in a list.\n */\n // TODO(wittjosiah): Convert to `icon` and make serializable.\n iconComponent?: FC<IconProps>;\n };\n\n /**\n * Capabilities provided by the plugin.\n */\n provides: PluginProvides<TProvides>;\n};\n\n/**\n * Plugin definitions extend the base `Plugin` interface with additional lifecycle methods.\n */\nexport type PluginDefinition<TProvides = {}, TInitializeProvides = {}> = Omit<Plugin, 'provides'> & {\n /**\n * Capabilities provided by the plugin.\n */\n provides?: Plugin<TProvides>['provides'];\n\n /**\n * Initialize any async behavior required by the plugin.\n *\n * @return Capabilities provided by the plugin which are merged with base capabilities.\n */\n initialize?: () => Promise<PluginProvides<TInitializeProvides>>;\n\n /**\n * Called once all plugins have been initialized.\n * This is the place to do any initialization which requires other plugins to be ready.\n *\n * @param plugins All plugins which successfully initialized.\n */\n ready?: (plugins: Plugin[]) => Promise<void>;\n\n /**\n * Called when the plugin is unloaded.\n * This is the place to do any cleanup required by the plugin.\n */\n unload?: () => Promise<void>;\n};\n\nexport const pluginMeta = (meta: Plugin['meta']) => meta;\n\ntype LazyPlugin<T> = () => Promise<{ default: (props: T) => PluginDefinition }>;\n\nexport namespace Plugin {\n export const lazy = <T>(p: LazyPlugin<T>, props?: T) => {\n return () =>\n p().then(({ default: definition }) => {\n return definition(props as T);\n });\n };\n}\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport { type Context, type Provider, createContext, useContext } from 'react';\n\nimport { type Plugin } from './plugin';\nimport { findPlugin, resolvePlugin } from '../helpers';\n\nexport type PluginContext = {\n /**\n * All plugins are ready.\n */\n ready: boolean;\n\n /**\n * Ids of plugins which are enabled on this device.\n */\n enabled: string[];\n\n /**\n * Initialized and ready plugins.\n */\n plugins: Plugin[];\n\n /**\n * All available plugins.\n */\n available: Plugin['meta'][];\n\n /**\n * Mark plugin as enabled.\n * Requires reload to take effect.\n */\n setPlugin: (id: string, enabled: boolean) => void;\n};\n\nconst PluginContext: Context<PluginContext> = createContext<PluginContext>({\n ready: false,\n enabled: [],\n plugins: [],\n available: [],\n setPlugin: () => {},\n});\n\n/**\n * Get all plugins.\n */\nexport const usePlugins = (): PluginContext => useContext(PluginContext);\n\n/**\n * Get a plugin by ID.\n */\nexport const usePlugin = <T,>(id: string): Plugin<T> | undefined => {\n const { plugins } = usePlugins();\n return findPlugin<T>(plugins, id);\n};\n\n/**\n * Resolve a plugin by predicate.\n */\nexport const useResolvePlugin = <T,>(predicate: (plugin: Plugin) => Plugin<T> | undefined): Plugin<T> | undefined => {\n const { plugins } = usePlugins();\n return resolvePlugin(plugins, predicate);\n};\n\nexport const PluginProvider: Provider<PluginContext> = PluginContext.Provider;\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport { shallow } from 'deepsignal/react';\nimport React, { useEffect, type FC, type PropsWithChildren, type ReactNode } from 'react';\n\nimport { LocalStorageStore } from '@dxos/local-storage';\nimport { log } from '@dxos/log';\n\nimport { type PluginContext, PluginProvider } from './PluginContext';\nimport { type Plugin, type PluginDefinition, type PluginProvides } from './plugin';\n\nexport type BootstrapPluginsParams = {\n order: PluginDefinition['meta'][];\n plugins: Record<string, () => Promise<PluginDefinition>>;\n core?: string[];\n defaults?: string[];\n fallback?: ReactNode;\n};\n\nexport type PluginHostProvides = {\n plugins: PluginContext;\n};\n\nexport const parsePluginHost = (plugin: Plugin) =>\n (plugin.provides as PluginHostProvides).plugins ? (plugin as Plugin<PluginHostProvides>) : undefined;\n\nconst PLUGIN_HOST = 'dxos.org/plugin/host';\n\n/**\n * Bootstraps an application by initializing plugins and rendering root components.\n */\nexport const PluginHost = ({\n order,\n plugins: definitions,\n core = [],\n defaults = [],\n fallback = null,\n}: BootstrapPluginsParams): PluginDefinition<PluginHostProvides> => {\n const state = new LocalStorageStore<PluginContext>(PLUGIN_HOST, {\n ready: false,\n enabled: [...defaults],\n plugins: [],\n available: order.filter(({ id }) => !core.includes(id)),\n setPlugin: (id: string, enabled: boolean) => {\n if (enabled) {\n state.values.enabled = [...state.values.enabled, id];\n } else {\n state.values.enabled = state.values.enabled.filter((enabled) => enabled !== id);\n }\n },\n });\n\n state.prop(state.values.$enabled!, 'enabled', LocalStorageStore.json);\n\n return {\n meta: {\n id: PLUGIN_HOST,\n name: 'Plugin host',\n },\n provides: {\n plugins: state.values,\n context: ({ children }) => <PluginProvider value={state.values}>{children}</PluginProvider>,\n root: () => {\n useEffect(() => {\n log('initializing plugins', { enabled: state.values.enabled });\n const timeout = setTimeout(async () => {\n const enabledIds = [...core, ...state.values.enabled].sort((a, b) => {\n const indexA = order.findIndex(({ id }) => id === a);\n const indexB = order.findIndex(({ id }) => id === b);\n return indexA - indexB;\n });\n\n const enabled = await Promise.all(\n enabledIds\n .map((id) => definitions[id])\n // If local storage indicates a plugin is enabled, but it is not available, ignore it.\n .filter((definition): definition is () => Promise<PluginDefinition> => Boolean(definition))\n .map((definition) => definition()),\n );\n\n const plugins = await Promise.all(\n enabled.map(async (definition) => {\n const plugin = await initializePlugin(definition).catch((err) => {\n console.error('Failed to initialize plugin:', definition.meta.id, err);\n return undefined;\n });\n return plugin;\n }),\n ).then((plugins) => plugins.filter((plugin): plugin is Plugin => Boolean(plugin)));\n log('plugins initialized', { plugins });\n\n await Promise.all(\n enabled.map(async (pluginDefinition) => {\n await pluginDefinition.ready?.(plugins);\n }),\n );\n log('plugins ready', { plugins });\n\n state.values.plugins = shallow(plugins);\n state.values.ready = true;\n });\n\n return () => {\n clearTimeout(timeout);\n state.values.ready = false;\n // TODO(wittjosiah): Does this ever need to be called prior to having dynamic plugins?\n // void Promise.all(enabled.map((definition) => definition.unload?.()));\n };\n }, []);\n\n if (!state.values.ready) {\n return <>{fallback}</>;\n }\n\n const ComposedContext = composeContext(state.values.plugins);\n\n return <ComposedContext>{rootComponents(state.values.plugins)}</ComposedContext>;\n },\n },\n };\n};\n\n/**\n * Resolve a `PluginDefinition` into a fully initialized `Plugin`.\n */\nexport const initializePlugin = async <T, U>(pluginDefinition: PluginDefinition<T, U>): Promise<Plugin<T & U>> => {\n const provides = await pluginDefinition.initialize?.();\n return {\n ...pluginDefinition,\n provides: {\n ...pluginDefinition.provides,\n ...provides,\n } as PluginProvides<T & U>,\n };\n};\n\nconst rootComponents = (plugins: Plugin[]) => {\n return plugins\n .map((plugin) => {\n const Component = plugin.provides.root;\n if (Component) {\n return <Component key={plugin.meta.id} />;\n } else {\n return null;\n }\n })\n .filter((node): node is JSX.Element => Boolean(node));\n};\n\nconst composeContext = (plugins: Plugin[]) => {\n return compose(plugins.map((p) => p.provides.context!).filter(Boolean));\n};\n\nconst compose = (contexts: FC<PropsWithChildren>[]) => {\n return [...contexts].reduce((Acc, Next) => ({ children }) => (\n <Acc>\n <Next>{children}</Next>\n </Acc>\n ));\n};\n", "//\n// Copyright 2023 DXOS.org\n//\n\n/**\n * Checks if the given data is an object and not null.\n *\n * Useful inside surface component resolvers as a type guard.\n *\n * @example\n * ```ts\n * const old =\n * data.content &&\n * typeof data.content === 'object' &&\n * 'id' in data.content &&\n * typeof data.content.id === 'string';\n *\n * // becomes\n * const new = isObject(data.content) && typeof data.content.id === 'string';\n * ```\n */\nexport const isObject = (data: unknown): data is { [key: string]: unknown } => !!data && typeof data === 'object';\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport React, { Component, type FC, type PropsWithChildren } from 'react';\n\ntype Props = PropsWithChildren<{ data?: any; fallback: FC<{ error: Error; reset: () => void }> }>;\ntype State = { error: Error | undefined };\n\n/**\n * Surface error boundary.\n *\n * For basic usage prefer providing a fallback component to `Surface`.\n *\n * For more information on error boundaries, see:\n * https://react.dev/reference/react/Component#catching-rendering-errors-with-an-error-boundary\n */\nexport class ErrorBoundary extends Component<Props, State> {\n constructor(props: Props) {\n super(props);\n this.state = { error: undefined };\n }\n\n static getDerivedStateFromError(error: Error) {\n return { error };\n }\n\n override componentDidUpdate(prevProps: Props): void {\n if (prevProps.data !== this.props.data) {\n this.resetError();\n }\n }\n\n override render() {\n if (this.state.error) {\n return <this.props.fallback error={this.state.error} reset={this.resetError} />;\n }\n\n return this.props.children;\n }\n\n private resetError() {\n this.setState({ error: undefined });\n }\n}\n", "//\n// Copyright 2022 DXOS.org\n//\n\nimport React, {\n forwardRef,\n type FC,\n type ReactNode,\n Fragment,\n type ForwardedRef,\n type PropsWithChildren,\n isValidElement,\n} from 'react';\nimport { createContext, useContext } from 'react';\n\nimport { ErrorBoundary } from './ErrorBoundary';\nimport { type SurfaceComponent, useSurface, type SurfaceResult } from './SurfaceRootContext';\n\n/**\n * Direction determines how multiple components are laid out.\n */\nexport type Direction = 'inline' | 'inline-reverse' | 'block' | 'block-reverse';\n\nexport type SurfaceProps = PropsWithChildren<{\n /**\n * Role defines how the data should be rendered.\n */\n role?: string;\n\n /**\n * Names allow nested surfaces to be specified in the parent context, similar to a slot.\n * Defaults to the value of `role` if not specified.\n */\n name?: string;\n\n /**\n * The data to be rendered by the surface.\n */\n data?: Record<string, unknown>;\n\n /**\n * Configure nested surfaces (indexed by the surface's `name`).\n */\n surfaces?: Record<string, Pick<SurfaceProps, 'data' | 'surfaces'>>;\n\n /**\n * If specified, the Surface will be wrapped in an error boundary.\n * The fallback component will be rendered if an error occurs.\n */\n fallback?: ErrorBoundary['props']['fallback'];\n\n /**\n * If specified, this will render if no plugin can offer renderable content for the surface.\n *\n * @deprecated Provide a component with `disposition: 'fallback'` instead.\n */\n contentFallback?: FC<{}>;\n\n /**\n * If more than one component is resolved, the limit determines how many are rendered.\n */\n limit?: number | undefined;\n\n /**\n * If more than one component is resolved, the direction determines how they are laid out.\n * NOTE: This is not yet implemented.\n */\n direction?: Direction;\n\n /**\n * Additional props to pass to the component.\n * These props are not used by Surface itself but may be used by components which resolve the surface.\n */\n [key: string]: unknown;\n}>;\n\n/**\n * A surface is a named region of the screen that can be populated by plugins.\n */\nexport const Surface = forwardRef<HTMLElement, SurfaceProps>(\n ({ role, name = role, fallback, ...rest }, forwardedRef) => {\n const props = { role, name, fallback, ...rest };\n const context = useContext(SurfaceContext);\n const data = props.data ?? ((name && context?.surfaces?.[name]?.data) || {});\n\n return (\n <>\n {fallback ? (\n <ErrorBoundary data={data} fallback={fallback}>\n <SurfaceResolver {...props} ref={forwardedRef} />\n </ErrorBoundary>\n ) : (\n <SurfaceResolver {...props} ref={forwardedRef} />\n )}\n </>\n );\n },\n);\n\nconst SurfaceContext = createContext<SurfaceProps | null>(null);\n\nconst SurfaceResolver = forwardRef<HTMLElement, SurfaceProps>((props, forwardedRef) => {\n const { components } = useSurface();\n const parent = useContext(SurfaceContext);\n const nodes = resolveNodes(components, props, parent, forwardedRef);\n const currentContext: SurfaceProps = {\n ...props,\n surfaces: {\n ...((props.name && parent?.surfaces?.[props.name]?.surfaces) || {}),\n ...props.surfaces,\n },\n };\n\n return (\n <SurfaceContext.Provider value={currentContext}>\n {nodes.length > 0 ? nodes : props.contentFallback ? <props.contentFallback /> : null}\n </SurfaceContext.Provider>\n );\n});\n\nconst resolveNodes = (\n components: Record<string, SurfaceComponent>,\n props: SurfaceProps,\n context: SurfaceProps | null,\n forwardedRef: ForwardedRef<HTMLElement>,\n): ReactNode[] => {\n const data = {\n ...((props.name && context?.surfaces?.[props.name]?.data) || {}),\n ...props.data,\n };\n\n const nodes = Object.entries(components)\n .map(([key, component]): [string, SurfaceResult] | undefined => {\n const result = component({ ...props, data }, forwardedRef);\n if (!result || typeof result !== 'object') {\n return undefined;\n }\n\n return 'node' in result ? [key, result] : isValidElement(result) ? [key, { node: result }] : undefined;\n })\n .filter((result): result is [string, SurfaceResult] => Boolean(result))\n .sort(([, a], [, b]) => {\n const aDisposition = a.disposition ?? 'default';\n const bDisposition = b.disposition ?? 'default';\n\n if (aDisposition === bDisposition) {\n return 0;\n } else if (aDisposition === 'hoist' || bDisposition === 'fallback') {\n return -1;\n } else if (bDisposition === 'hoist' || aDisposition === 'fallback') {\n return 1;\n }\n\n return 0;\n })\n .map(([key, result]) => <Fragment key={key}>{result.node}</Fragment>);\n\n return props.limit ? nodes.slice(0, props.limit) : nodes;\n};\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport React, { type PropsWithChildren } from 'react';\n\nimport { Input } from '@dxos/react-ui';\n\ntype SettingValueProps = {\n label: string;\n description?: JSX.Element;\n};\n\nexport const SettingsValue = ({ label, description, children }: PropsWithChildren<SettingValueProps>) => {\n return (\n <div role='none' className='flex w-full gap-4 py-1'>\n <Input.Root>\n <div role='none' className='flex flex-col w-full'>\n {/* TODO(burdon): Consistent height for controls (e.g., Select, Textbox, and Checkbox are all different). */}\n <Input.Label classNames='flex min-h-[40px] items-center'>{label}</Input.Label>\n {description && (\n <Input.DescriptionAndValidation classNames='mbs-0.5'>\n <Input.Description>{description}</Input.Description>\n </Input.DescriptionAndValidation>\n )}\n </div>\n\n <div role='none'>\n <div role='none' className='flex min-h-[40px] items-center'>\n {children}\n </div>\n </div>\n </Input.Root>\n </div>\n );\n};\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport React from 'react';\n\nimport { type Label } from '@dxos/app-graph';\nimport { Keyboard, keySymbols } from '@dxos/keyboard';\nimport { Button, Dialog, DensityProvider, useTranslation } from '@dxos/react-ui';\nimport { mx } from '@dxos/react-ui-theme';\n\nexport const ShortcutsDialogContent = () => {\n const { t } = useTranslation('os');\n\n const bindings = Keyboard.singleton.getBindings();\n\n // TODO(burdon): Factor out.\n // TODO(burdon): How to access all translations across plugins?\n const getLabel = (label: Label) => (Array.isArray(label) ? t(...label) : label);\n\n return (\n <DensityProvider density='fine'>\n <Dialog.Content classNames={['md:max-is-[30rem] overflow-hidden']}>\n <Dialog.Title>{t('shortcuts dialog title', { ns: 'os' })}</Dialog.Title>\n\n <table className='table-fixed border-collapse my-4'>\n <tbody>\n {bindings.map((binding, i) => (\n <tr key={i}>\n <td className='p-1 w-[120px]'>\n <div className='flex gap-1'>\n {keySymbols(binding.binding).map((c, i) => (\n <span\n key={i}\n className={mx(\n 'inline-flex w-[24px] h-[24px] justify-center items-center text-xs',\n 'rounded border border-neutral-300 dark:border-neutral-600 bg-neutral-50 dark:bg-neutral-850',\n )}\n >\n {c}\n </span>\n ))}\n </div>\n </td>\n <td className='p-1'>\n <span className='grow truncate'>{getLabel(binding.data as Label)}</span>\n </td>\n </tr>\n ))}\n </tbody>\n </table>\n\n <Dialog.Close asChild>\n <Button variant='primary' classNames='mbs-2'>\n {t('close label', { ns: 'os' })}\n </Button>\n </Dialog.Close>\n </Dialog.Content>\n </DensityProvider>\n );\n};\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport React from 'react';\n\nimport { invariant } from '@dxos/invariant';\n\nimport { type BootstrapPluginsParams, PluginHost, Plugin } from './plugins';\nimport IntentMeta from './plugins/IntentPlugin/meta';\nimport SurfaceMeta from './plugins/SurfacePlugin/meta';\n\n/**\n * Expected usage is for this to be the entrypoint of the application.\n * Initializes plugins and renders the root components.\n *\n * @example\n * const order = [LayoutMeta, MyPluginMeta];\n * const plugins = {\n * [LayoutMeta.id]: Plugin.lazy(() => import('./plugins/LayoutPlugin/plugin')),\n * [MyPluginMeta.id]: Plugin.lazy(() => import('./plugins/MyPlugin/plugin')),\n * };\n * const core = [LayoutMeta.id];\n * const default = [MyPluginMeta.id];\n * const fallback = <div>Initializing Plugins...</div>;\n * const App = createApp({ order, plugins, core, default, fallback });\n * createRoot(document.getElementById('root')!).render(\n * <StrictMode>\n * <App />\n * </StrictMode>,\n * );\n *\n * @param params.order Total ordering of plugins.\n * @param params.plugins All plugins available to the application.\n * @param params.core Core plugins which will always be enabled.\n * @param params.default Default plugins are enabled by default but can be disabled by the user.\n * @param params.fallback Fallback component to render while plugins are initializing.\n */\nexport const createApp = ({ order, plugins, core = order.map(({ id }) => id), ...params }: BootstrapPluginsParams) => {\n const host = PluginHost({\n order: [SurfaceMeta, IntentMeta, ...order],\n plugins: {\n ...plugins,\n [SurfaceMeta.id]: Plugin.lazy(() => import('./plugins/SurfacePlugin/plugin')),\n [IntentMeta.id]: Plugin.lazy(() => import('./plugins/IntentPlugin/plugin')),\n },\n core: [SurfaceMeta.id, IntentMeta.id, ...core],\n ...params,\n });\n\n invariant(host.provides?.context);\n invariant(host.provides?.root);\n const Context = host.provides.context;\n const Root = host.provides.root;\n\n return () => (\n <Context>\n <Root />\n </Context>\n );\n};\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;ACIA,iBAAkB;AEAlB,IAAAA,cAAkB;ACAlB,mBAAgC;AAEhC,sBAAgF;AAChF,4BAA2D;AEH3D,IAAAC,gBAAuE;ACAvE,IAAAA,gBAAwB;AACxB,IAAAA,gBAAkF;AAElF,2BAAkC;AAClC,iBAAoB;AEJpB,IAAAA,gBAAkE;ACAlE,IAAAA,gBAQO;AACP,IAAAA,gBAA0C;ACT1C,IAAAA,gBAA8C;AAE9C,IAAAC,mBAAsB;ACFtB,IAAAD,gBAAkB;AAGlB,sBAAqC;AACrC,IAAAC,mBAAgE;AAChE,IAAA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AAK,GAAGoK,OAAAA,MAAgC;AAC/G,QAAMC,OAAO5J,WAAW;IACtBC,OAAO;MAAC4J,sBAAAA;MAAaC;SAAe7J;;IACpChB,SAAS;MACP,GAAGA;MACH,CAAC4K,sBAAAA,aAAYtK,EAAE,GAAGjB,OAAOC,KAAK,MAAM,OAAO,uBAAA,CAAA;MAC3C,CAACuL,mCAAWvK,EAAE,GAAGjB,OAAOC,KAAK,MAAM,OAAO,uBAAA,CAAA;IAC5C;IACA4B,MAAM;MAAC0J,sBAAAA,aAAYtK;MAAIuK,mCAAWvK;SAAOY;;IACzC,GAAGwJ;EACL,CAAA;AAEAI,kCAAUH,KAAK7O,UAAUgG,SAAAA,QAAAA;;;;;;;;;AACzBgJ,kCAAUH,KAAK7O,UAAUE,MAAAA,QAAAA;;;;;;;;;AACzB,QAAM+O,UAAUJ,KAAK7O,SAASgG;AAC9B,QAAM8G,OAAO+B,KAAK7O,SAASE;AAE3B,SAAO,MACLgG,+BAAAA,QAAA,cAAC+I,SAAAA,MACC/I,+BAAAA,QAAA,cAAC4G,MAAAA,IAAAA,CAAAA;AAGP;",
6
- "names": ["import_zod", "import_react", "import_react_ui", "import_react_ui_theme", "parseGraphPlugin", "plugin", "provides", "graph", "root", "undefined", "parseGraphBuilderPlugin", "builder", "Layout", "z", "object", "fullscreen", "boolean", "sidebarOpen", "complementarySidebarOpen", "dialogOpen", "dialogContent", "any", "optional", "describe", "popoverOpen", "popoverContent", "popoverAnchorId", "string", "active", "previous", "parseLayoutPlugin", "success", "safeParse", "layout", "LAYOUT_ACTION", "LayoutAction", "TOGGLE_FULLSCREEN", "TOGGLE_SIDEBAR", "TOGGLE_COMPLEMENTARY_SIDEBAR", "OPEN_DIALOG", "CLOSE_DIALOG", "OPEN_POPOVER", "CLOSE_POPOVER", "OPEN_SETTINGS", "OPEN_SHORTCUTS", "ACTIVATE", "parseMetadataRecordsPlugin", "metadata", "records", "parseMetadataResolverPlugin", "resolver", "ResourceKey", "union", "record", "ResourceLanguage", "Resource", "parseTranslationsPlugin", "array", "translations", "pluginMeta", "meta", "Plugin", "lazy", "p", "props", "then", "default", "definition", "PluginContext", "createContext", "ready", "enabled", "plugins", "available", "setPlugin", "usePlugins", "useContext", "usePlugin", "id", "findPlugin", "useResolvePlugin", "predicate", "resolvePlugin", "PluginProvider", "Provider", "parsePluginHost", "PLUGIN_HOST", "PluginHost", "order", "definitions", "core", "defaults", "fallback", "state", "LocalStorageStore", "filter", "includes", "values", "prop", "$enabled", "json", "name", "context", "children", "React", "value", "useEffect", "log", "timeout", "setTimeout", "enabledIds", "sort", "a", "b", "indexA", "findIndex", "indexB", "Promise", "all", "map", "Boolean", "initializePlugin", "catch", "err", "console", "error", "pluginDefinition", "shallow", "clearTimeout", "ComposedContext", "composeContext", "rootComponents", "initialize", "Component", "key", "node", "compose", "contexts", "reduce", "Acc", "Next", "isObject", "data", "ErrorBoundary", "constructor", "getDerivedStateFromError", "componentDidUpdate", "prevProps", "resetError", "render", "this", "reset", "setState", "Surface", "forwardRef", "role", "rest", "forwardedRef", "SurfaceContext", "surfaces", "SurfaceResolver", "ref", "components", "useSurface", "parent", "nodes", "resolveNodes", "currentContext", "length", "contentFallback", "Object", "entries", "component", "result", "isValidElement", "aDisposition", "disposition", "bDisposition", "Fragment", "limit", "slice", "SettingsDialogContent", "t", "useTranslation", "useState", "filteredPlugins", "find", "settings", "localeCompare", "DensityProvider", "density", "Dialog", "Content", "classNames", "Title", "ns", "div", "className", "mx", "groupBorder", "PluginList", "title", "selected", "onSelect", "Close", "asChild", "Button", "variant", "h2", "List", "selectable", "ListItem", "Root", "onClick", "ghostSelected", "ghostHover", "Heading", "SettingsValue", "label", "description", "Input", "Label", "DescriptionAndValidation", "Description", "ShortcutsDialogContent", "bindings", "Keyboard", "singleton", "getBindings", "getLabel", "Array", "isArray", "table", "tbody", "binding", "i", "tr", "td", "keySymbols", "c", "span", "createApp", "params", "host", "SurfaceMeta", "IntentMeta", "invariant", "Context"]
3
+ "sources": ["../../../src/plugins/common/graph.ts", "../../../src/plugins/common/layout.ts", "../../../src/plugins/common/metadata.ts", "../../../src/plugins/common/settings.ts", "../../../src/plugins/common/translations.ts", "../../../src/plugins/PluginHost/plugin.ts", "../../../src/plugins/PluginHost/PluginContext.tsx", "../../../src/plugins/PluginHost/PluginHost.tsx", "../../../src/plugins/SurfacePlugin/helpers.ts", "../../../src/plugins/SurfacePlugin/ErrorBoundary.tsx", "../../../src/plugins/SurfacePlugin/Surface.tsx", "../../../src/App.tsx"],
4
+ "sourcesContent": ["//\n// Copyright 2023 DXOS.org\n//\n\nimport type { Graph, Node } from '@dxos/app-graph';\nimport type { UnsubscribeCallback } from '@dxos/async';\n\nimport type { Plugin } from '../PluginHost';\n\n/**\n * Provides for a plugin that exposes the application graph.\n */\nexport type GraphProvides = {\n graph: Graph;\n};\n\nexport type GraphBuilderProvides = {\n graph: {\n builder: (params: { parent: Node; plugins: Plugin[] }) => UnsubscribeCallback | void;\n };\n};\n\n/**\n * Type guard for graph plugins.\n */\nexport const parseGraphPlugin = (plugin: Plugin) =>\n (plugin.provides as any).graph?.root ? (plugin as Plugin<GraphProvides>) : undefined;\n\n/**\n * Type guard for graph builder plugins.\n */\nexport const parseGraphBuilderPlugin = (plugin: Plugin) =>\n (plugin.provides as any).graph?.builder ? (plugin as Plugin<GraphBuilderProvides>) : undefined;\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport { z } from 'zod';\n\nimport type { Plugin } from '../PluginHost';\n\n//\n// Provides\n//\n\n/**\n * Basic state provided by a layout plugin.\n */\n// TODO(burdon): Josiah: why do we use zod here?\nexport const Layout = z.object({\n fullscreen: z.boolean(),\n sidebarOpen: z.boolean(),\n complementarySidebarOpen: z.boolean(),\n\n // TODO(burdon): Why do we have a single root?\n dialogOpen: z.boolean(),\n dialogContent: z.any().optional().describe('Data to be passed to the dialog Surface.'),\n\n popoverOpen: z.boolean(),\n popoverContent: z.any().optional().describe('Data to be passed to the popover Surface.'),\n popoverAnchorId: z.string().optional(),\n\n // TODO(wittjosiah): Array?\n active: z.string().optional().describe('Id of the currently active item.'),\n // TODO(wittjosiah): History?\n previous: z.string().optional(),\n});\n\nexport type Layout = z.infer<typeof Layout>;\n\n/**\n * Provides for a plugin that can manage the app layout.\n */\nexport type LayoutProvides = {\n layout: Readonly<Layout>;\n};\n\n/**\n * Type guard for layout plugins.\n */\nexport const parseLayoutPlugin = (plugin: Plugin) => {\n const { success } = Layout.safeParse((plugin.provides as any).layout);\n return success ? (plugin as Plugin<LayoutProvides>) : undefined;\n};\n\n//\n// Intents\n//\n\nconst LAYOUT_ACTION = 'dxos.org/plugin/layout';\n// TODO(wittjosiah): Consider consolidating some action types (e.g. toggle).\nexport enum LayoutAction {\n TOGGLE_FULLSCREEN = `${LAYOUT_ACTION}/toggle-fullscreen`,\n TOGGLE_SIDEBAR = `${LAYOUT_ACTION}/toggle-sidebar`,\n TOGGLE_COMPLEMENTARY_SIDEBAR = `${LAYOUT_ACTION}/toggle-complementary-sidebar`,\n OPEN_DIALOG = `${LAYOUT_ACTION}/open-dialog`,\n CLOSE_DIALOG = `${LAYOUT_ACTION}/close-dialog`,\n OPEN_POPOVER = `${LAYOUT_ACTION}/open-popover`,\n CLOSE_POPOVER = `${LAYOUT_ACTION}/close-popover`,\n ACTIVATE = `${LAYOUT_ACTION}/activate`,\n}\n\n/**\n * Expected payload for layout actions.\n */\nexport namespace LayoutAction {\n export type ToggleFullscreen = {\n state?: boolean;\n };\n\n export type ToggleSidebar = {\n state?: boolean;\n };\n\n export type ToggleComplementarySidebar = {\n state?: boolean;\n };\n\n export type OpenDialog = {\n component: string;\n subject: any;\n };\n\n export type CloseDialog = {};\n\n export type OpenPopover = {\n anchorId: string;\n component: string;\n subject: any;\n };\n\n export type ClosePopover = {};\n\n export type Activate = {\n id: string;\n };\n}\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport type { Plugin } from '../PluginHost';\n\nexport type Metadata = Record<string, any>;\n\nexport type MetadataRecordsProvides = {\n metadata: {\n records: Record<string, Metadata>;\n };\n};\n\nexport type MetadataResolver = (type: string) => Metadata;\n\nexport type MetadataResolverProvides = {\n metadata: {\n resolver: MetadataResolver;\n };\n};\n\nexport const parseMetadataRecordsPlugin = (plugin: Plugin) => {\n return (plugin.provides as any).metadata?.records ? (plugin as Plugin<MetadataRecordsProvides>) : undefined;\n};\n\nexport const parseMetadataResolverPlugin = (plugin: Plugin) => {\n return (plugin.provides as any).metadata?.resolver ? (plugin as Plugin<MetadataResolverProvides>) : undefined;\n};\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport { type Plugin } from '../PluginHost';\n\n// TODO(burdon): Plugins should export ts-effect object (see local-storage).\n// TODO(burdon): Auto generate form.\n// TODO(burdon): Set surface's data.type to plugin id (allow custom settings surface).\n\nexport type SettingsProvides<T extends Record<string, any> = Record<string, any>> = {\n settings: T; // TODO(burdon): Read-only.\n};\n\nexport const parseSettingsPlugin = (plugin: Plugin) => {\n return typeof (plugin.provides as any).settings === 'object' ? (plugin as Plugin<SettingsProvides>) : undefined;\n};\n\nconst SETTINGS_ACTION = 'dxos.org/plugin/settings';\nexport enum SettingsAction {\n OPEN = `${SETTINGS_ACTION}/open`,\n}\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport { z } from 'zod';\n\nimport type { Plugin } from '../PluginHost';\n\nexport const ResourceKey = z.union([z.string(), z.record(z.any())]);\nexport type ResourceKey = z.infer<typeof ResourceKey>;\n\nexport const ResourceLanguage = z.record(ResourceKey);\nexport type ResourceLanguage = z.infer<typeof ResourceLanguage>;\n\n/**\n * A resource is a collection of translations for a language.\n */\nexport const Resource = z.record(ResourceLanguage);\nexport type Resource = z.infer<typeof Resource>;\n\n/**\n * Provides for a plugin that exposes translations.\n */\n// TODO(wittjosiah): Rename to TranslationResourcesProvides.\nexport type TranslationsProvides = {\n translations: Readonly<Resource[]>;\n};\n\n// TODO(wittjosiah): Add TranslationsProvides.\n// export type TranslationsProvides = {\n// translations: {\n// t: TFunction;\n// };\n// };\n\n/**\n * Type guard for translation plugins.\n */\nexport const parseTranslationsPlugin = (plugin: Plugin) => {\n const { success } = z.array(Resource).safeParse((plugin.provides as any).translations);\n return success ? (plugin as Plugin<TranslationsProvides>) : undefined;\n};\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport type { IconProps } from '@phosphor-icons/react';\nimport type { FC, PropsWithChildren } from 'react';\n\n/**\n * Capabilities provided by a plugin.\n * The base surface capabilities are always included.\n */\nexport type PluginProvides<TProvides> = TProvides & {\n /**\n * React Context which is wrapped around the application to enable any hooks the plugin may provide.\n */\n context?: FC<PropsWithChildren>;\n\n /*\n * React component which is rendered at the root of the application.\n */\n root?: FC<PropsWithChildren>;\n};\n\n/**\n * A unit of containment of modular functionality that can be provided to an application.\n * Plugins provide things like components, state, actions, etc. to the application.\n */\nexport type Plugin<TProvides = {}> = {\n meta: {\n /**\n * Globally unique ID.\n *\n * Expected to be in the form of a valid URL.\n *\n * @example dxos.org/plugin/example\n */\n id: string;\n\n /**\n * Short ID for use in URLs.\n *\n * NOTE: This is especially experimental and likely to change.\n */\n // TODO(wittjosiah): How should these be managed?\n shortId?: string;\n\n /**\n * Human-readable name.\n */\n name?: string;\n\n /**\n * Short description of plugin functionality.\n */\n description?: string;\n\n /**\n * URL of home page.\n */\n homePage?: string;\n\n /**\n * Tags to help categorize the plugin.\n */\n tags?: string[];\n\n /**\n * Component to render icon for the plugin when displayed in a list.\n */\n // TODO(wittjosiah): Convert to `icon` and make serializable.\n iconComponent?: FC<IconProps>;\n };\n\n /**\n * Capabilities provided by the plugin.\n */\n provides: PluginProvides<TProvides>;\n};\n\n/**\n * Plugin definitions extend the base `Plugin` interface with additional lifecycle methods.\n */\nexport type PluginDefinition<TProvides = {}, TInitializeProvides = {}> = Omit<Plugin, 'provides'> & {\n /**\n * Capabilities provided by the plugin.\n */\n provides?: Plugin<TProvides>['provides'];\n\n /**\n * Initialize any async behavior required by the plugin.\n *\n * @return Capabilities provided by the plugin which are merged with base capabilities.\n */\n initialize?: () => Promise<PluginProvides<TInitializeProvides>>;\n\n /**\n * Called once all plugins have been initialized.\n * This is the place to do any initialization which requires other plugins to be ready.\n *\n * @param plugins All plugins which successfully initialized.\n */\n ready?: (plugins: Plugin[]) => Promise<void>;\n\n /**\n * Called when the plugin is unloaded.\n * This is the place to do any cleanup required by the plugin.\n */\n unload?: () => Promise<void>;\n};\n\nexport const pluginMeta = (meta: Plugin['meta']) => meta;\n\ntype LazyPlugin<T> = () => Promise<{ default: (props: T) => PluginDefinition }>;\n\nexport namespace Plugin {\n export const lazy = <T>(p: LazyPlugin<T>, props?: T) => {\n return () =>\n p().then(({ default: definition }) => {\n return definition(props as T);\n });\n };\n}\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport { type Context, type Provider, createContext, useContext } from 'react';\n\nimport { type Plugin } from './plugin';\nimport { findPlugin, resolvePlugin } from '../helpers';\n\nexport type PluginContext = {\n /**\n * All plugins are ready.\n */\n ready: boolean;\n\n /**\n * Ids of plugins which are enabled on this device.\n */\n enabled: string[];\n\n /**\n * Initialized and ready plugins.\n */\n plugins: Plugin[];\n\n /**\n * All available plugins.\n */\n available: Plugin['meta'][];\n\n /**\n * Mark plugin as enabled.\n * Requires reload to take effect.\n */\n setPlugin: (id: string, enabled: boolean) => void;\n};\n\nconst PluginContext: Context<PluginContext> = createContext<PluginContext>({\n ready: false,\n enabled: [],\n plugins: [],\n available: [],\n setPlugin: () => {},\n});\n\n/**\n * Get all plugins.\n */\nexport const usePlugins = (): PluginContext => useContext(PluginContext);\n\n/**\n * Get a plugin by ID.\n */\nexport const usePlugin = <T,>(id: string): Plugin<T> | undefined => {\n const { plugins } = usePlugins();\n return findPlugin<T>(plugins, id);\n};\n\n/**\n * Resolve a plugin by predicate.\n */\nexport const useResolvePlugin = <T,>(predicate: (plugin: Plugin) => Plugin<T> | undefined): Plugin<T> | undefined => {\n const { plugins } = usePlugins();\n return resolvePlugin(plugins, predicate);\n};\n\nexport const PluginProvider: Provider<PluginContext> = PluginContext.Provider;\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport { shallow } from 'deepsignal/react';\nimport React, { useEffect, type FC, type PropsWithChildren, type ReactNode } from 'react';\n\nimport { LocalStorageStore } from '@dxos/local-storage';\nimport { log } from '@dxos/log';\n\nimport { type PluginContext, PluginProvider } from './PluginContext';\nimport { type Plugin, type PluginDefinition, type PluginProvides } from './plugin';\n\nexport type BootstrapPluginsParams = {\n order: PluginDefinition['meta'][];\n plugins: Record<string, () => Promise<PluginDefinition>>;\n core?: string[];\n defaults?: string[];\n fallback?: ReactNode;\n};\n\nexport type PluginHostProvides = {\n plugins: PluginContext;\n};\n\nexport const parsePluginHost = (plugin: Plugin) =>\n (plugin.provides as PluginHostProvides).plugins ? (plugin as Plugin<PluginHostProvides>) : undefined;\n\nconst PLUGIN_HOST = 'dxos.org/plugin/host';\n\n/**\n * Bootstraps an application by initializing plugins and rendering root components.\n */\nexport const PluginHost = ({\n order,\n plugins: definitions,\n core = [],\n defaults = [],\n fallback = null,\n}: BootstrapPluginsParams): PluginDefinition<PluginHostProvides> => {\n const state = new LocalStorageStore<PluginContext>(PLUGIN_HOST, {\n ready: false,\n enabled: [...defaults],\n plugins: [],\n available: order.filter(({ id }) => !core.includes(id)),\n setPlugin: (id: string, enabled: boolean) => {\n if (enabled) {\n state.values.enabled = [...state.values.enabled, id];\n } else {\n state.values.enabled = state.values.enabled.filter((enabled) => enabled !== id);\n }\n },\n });\n\n state.prop(state.values.$enabled!, 'enabled', LocalStorageStore.json);\n\n return {\n meta: {\n id: PLUGIN_HOST,\n name: 'Plugin host',\n },\n provides: {\n plugins: state.values,\n context: ({ children }) => <PluginProvider value={state.values}>{children}</PluginProvider>,\n root: () => {\n useEffect(() => {\n log('initializing plugins', { enabled: state.values.enabled });\n const timeout = setTimeout(async () => {\n const enabledIds = [...core, ...state.values.enabled].sort((a, b) => {\n const indexA = order.findIndex(({ id }) => id === a);\n const indexB = order.findIndex(({ id }) => id === b);\n return indexA - indexB;\n });\n\n const enabled = await Promise.all(\n enabledIds\n .map((id) => definitions[id])\n // If local storage indicates a plugin is enabled, but it is not available, ignore it.\n .filter((definition): definition is () => Promise<PluginDefinition> => Boolean(definition))\n .map((definition) => definition()),\n );\n\n const plugins = await Promise.all(\n enabled.map(async (definition) => {\n const plugin = await initializePlugin(definition).catch((err) => {\n console.error('Failed to initialize plugin:', definition.meta.id, err);\n return undefined;\n });\n return plugin;\n }),\n ).then((plugins) => plugins.filter((plugin): plugin is Plugin => Boolean(plugin)));\n log('plugins initialized', { plugins });\n\n await Promise.all(\n enabled.map(async (pluginDefinition) => {\n await pluginDefinition.ready?.(plugins);\n }),\n );\n log('plugins ready', { plugins });\n\n state.values.plugins = shallow(plugins);\n state.values.ready = true;\n });\n\n return () => {\n clearTimeout(timeout);\n state.values.ready = false;\n // TODO(wittjosiah): Does this ever need to be called prior to having dynamic plugins?\n // void Promise.all(enabled.map((definition) => definition.unload?.()));\n };\n }, []);\n\n if (!state.values.ready) {\n return <>{fallback}</>;\n }\n\n const ComposedContext = composeContext(state.values.plugins);\n\n return <ComposedContext>{rootComponents(state.values.plugins)}</ComposedContext>;\n },\n },\n };\n};\n\n/**\n * Resolve a `PluginDefinition` into a fully initialized `Plugin`.\n */\nexport const initializePlugin = async <T, U>(pluginDefinition: PluginDefinition<T, U>): Promise<Plugin<T & U>> => {\n const provides = await pluginDefinition.initialize?.();\n return {\n ...pluginDefinition,\n provides: {\n ...pluginDefinition.provides,\n ...provides,\n } as PluginProvides<T & U>,\n };\n};\n\nconst rootComponents = (plugins: Plugin[]) => {\n return plugins\n .map((plugin) => {\n const Component = plugin.provides.root;\n if (Component) {\n return <Component key={plugin.meta.id} />;\n } else {\n return null;\n }\n })\n .filter((node): node is JSX.Element => Boolean(node));\n};\n\nconst composeContext = (plugins: Plugin[]) => {\n return compose(plugins.map((p) => p.provides.context!).filter(Boolean));\n};\n\nconst compose = (contexts: FC<PropsWithChildren>[]) => {\n return [...contexts].reduce((Acc, Next) => ({ children }) => (\n <Acc>\n <Next>{children}</Next>\n </Acc>\n ));\n};\n", "//\n// Copyright 2023 DXOS.org\n//\n\n/**\n * Checks if the given data is an object and not null.\n *\n * Useful inside surface component resolvers as a type guard.\n *\n * @example\n * ```ts\n * const old =\n * data.content &&\n * typeof data.content === 'object' &&\n * 'id' in data.content &&\n * typeof data.content.id === 'string';\n *\n * // becomes\n * const new = isObject(data.content) && typeof data.content.id === 'string';\n * ```\n */\nexport const isObject = (data: unknown): data is { [key: string]: unknown } => !!data && typeof data === 'object';\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport React, { Component, type FC, type PropsWithChildren } from 'react';\n\ntype Props = PropsWithChildren<{ data?: any; fallback: FC<{ error: Error; reset: () => void }> }>;\ntype State = { error: Error | undefined };\n\n/**\n * Surface error boundary.\n *\n * For basic usage prefer providing a fallback component to `Surface`.\n *\n * For more information on error boundaries, see:\n * https://react.dev/reference/react/Component#catching-rendering-errors-with-an-error-boundary\n */\nexport class ErrorBoundary extends Component<Props, State> {\n constructor(props: Props) {\n super(props);\n this.state = { error: undefined };\n }\n\n static getDerivedStateFromError(error: Error) {\n return { error };\n }\n\n override componentDidUpdate(prevProps: Props): void {\n if (prevProps.data !== this.props.data) {\n this.resetError();\n }\n }\n\n override render() {\n if (this.state.error) {\n return <this.props.fallback error={this.state.error} reset={this.resetError} />;\n }\n\n return this.props.children;\n }\n\n private resetError() {\n this.setState({ error: undefined });\n }\n}\n", "//\n// Copyright 2022 DXOS.org\n//\n\nimport React, {\n forwardRef,\n type FC,\n type ReactNode,\n Fragment,\n type ForwardedRef,\n type PropsWithChildren,\n isValidElement,\n} from 'react';\nimport { createContext, useContext } from 'react';\n\nimport { ErrorBoundary } from './ErrorBoundary';\nimport { type SurfaceComponent, useSurface, type SurfaceResult } from './SurfaceRootContext';\n\n/**\n * Direction determines how multiple components are laid out.\n */\nexport type Direction = 'inline' | 'inline-reverse' | 'block' | 'block-reverse';\n\nexport type SurfaceProps = PropsWithChildren<{\n /**\n * Role defines how the data should be rendered.\n */\n role?: string;\n\n /**\n * Names allow nested surfaces to be specified in the parent context, similar to a slot.\n * Defaults to the value of `role` if not specified.\n */\n name?: string;\n\n /**\n * The data to be rendered by the surface.\n */\n data?: Record<string, unknown>;\n\n /**\n * Configure nested surfaces (indexed by the surface's `name`).\n */\n surfaces?: Record<string, Pick<SurfaceProps, 'data' | 'surfaces'>>;\n\n /**\n * If specified, the Surface will be wrapped in an error boundary.\n * The fallback component will be rendered if an error occurs.\n */\n fallback?: ErrorBoundary['props']['fallback'];\n\n /**\n * If specified, this will render if no plugin can offer renderable content for the surface.\n *\n * @deprecated Provide a component with `disposition: 'fallback'` instead.\n */\n contentFallback?: FC<{}>;\n\n /**\n * If more than one component is resolved, the limit determines how many are rendered.\n */\n limit?: number | undefined;\n\n /**\n * If more than one component is resolved, the direction determines how they are laid out.\n * NOTE: This is not yet implemented.\n */\n direction?: Direction;\n\n /**\n * Additional props to pass to the component.\n * These props are not used by Surface itself but may be used by components which resolve the surface.\n */\n [key: string]: unknown;\n}>;\n\n/**\n * A surface is a named region of the screen that can be populated by plugins.\n */\nexport const Surface = forwardRef<HTMLElement, SurfaceProps>(\n ({ role, name = role, fallback, ...rest }, forwardedRef) => {\n const props = { role, name, fallback, ...rest };\n const context = useContext(SurfaceContext);\n const data = props.data ?? ((name && context?.surfaces?.[name]?.data) || {});\n\n return (\n <>\n {fallback ? (\n <ErrorBoundary data={data} fallback={fallback}>\n <SurfaceResolver {...props} ref={forwardedRef} />\n </ErrorBoundary>\n ) : (\n <SurfaceResolver {...props} ref={forwardedRef} />\n )}\n </>\n );\n },\n);\n\nconst SurfaceContext = createContext<SurfaceProps | null>(null);\n\nconst SurfaceResolver = forwardRef<HTMLElement, SurfaceProps>((props, forwardedRef) => {\n const { components } = useSurface();\n const parent = useContext(SurfaceContext);\n const nodes = resolveNodes(components, props, parent, forwardedRef);\n const currentContext: SurfaceProps = {\n ...props,\n surfaces: {\n ...((props.name && parent?.surfaces?.[props.name]?.surfaces) || {}),\n ...props.surfaces,\n },\n };\n\n return (\n <SurfaceContext.Provider value={currentContext}>\n {nodes.length > 0 ? nodes : props.contentFallback ? <props.contentFallback /> : null}\n </SurfaceContext.Provider>\n );\n});\n\nconst resolveNodes = (\n components: Record<string, SurfaceComponent>,\n props: SurfaceProps,\n context: SurfaceProps | null,\n forwardedRef: ForwardedRef<HTMLElement>,\n): ReactNode[] => {\n const data = {\n ...((props.name && context?.surfaces?.[props.name]?.data) || {}),\n ...props.data,\n };\n\n const nodes = Object.entries(components)\n .map(([key, component]): [string, SurfaceResult] | undefined => {\n const result = component({ ...props, data }, forwardedRef);\n if (!result || typeof result !== 'object') {\n return undefined;\n }\n\n return 'node' in result ? [key, result] : isValidElement(result) ? [key, { node: result }] : undefined;\n })\n .filter((result): result is [string, SurfaceResult] => Boolean(result))\n .sort(([, a], [, b]) => {\n const aDisposition = a.disposition ?? 'default';\n const bDisposition = b.disposition ?? 'default';\n\n if (aDisposition === bDisposition) {\n return 0;\n } else if (aDisposition === 'hoist' || bDisposition === 'fallback') {\n return -1;\n } else if (bDisposition === 'hoist' || aDisposition === 'fallback') {\n return 1;\n }\n\n return 0;\n })\n .map(([key, result]) => <Fragment key={key}>{result.node}</Fragment>);\n\n return props.limit ? nodes.slice(0, props.limit) : nodes;\n};\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport React from 'react';\n\nimport { invariant } from '@dxos/invariant';\n\nimport { type BootstrapPluginsParams, PluginHost, Plugin } from './plugins';\nimport IntentMeta from './plugins/IntentPlugin/meta';\nimport SurfaceMeta from './plugins/SurfacePlugin/meta';\n\n/**\n * Expected usage is for this to be the entrypoint of the application.\n * Initializes plugins and renders the root components.\n *\n * @example\n * const order = [LayoutMeta, MyPluginMeta];\n * const plugins = {\n * [LayoutMeta.id]: Plugin.lazy(() => import('./plugins/LayoutPlugin/plugin')),\n * [MyPluginMeta.id]: Plugin.lazy(() => import('./plugins/MyPlugin/plugin')),\n * };\n * const core = [LayoutMeta.id];\n * const default = [MyPluginMeta.id];\n * const fallback = <div>Initializing Plugins...</div>;\n * const App = createApp({ order, plugins, core, default, fallback });\n * createRoot(document.getElementById('root')!).render(\n * <StrictMode>\n * <App />\n * </StrictMode>,\n * );\n *\n * @param params.order Total ordering of plugins.\n * @param params.plugins All plugins available to the application.\n * @param params.core Core plugins which will always be enabled.\n * @param params.default Default plugins are enabled by default but can be disabled by the user.\n * @param params.fallback Fallback component to render while plugins are initializing.\n */\nexport const createApp = ({ order, plugins, core = order.map(({ id }) => id), ...params }: BootstrapPluginsParams) => {\n const host = PluginHost({\n order: [SurfaceMeta, IntentMeta, ...order],\n plugins: {\n ...plugins,\n [SurfaceMeta.id]: Plugin.lazy(() => import('./plugins/SurfacePlugin/plugin')),\n [IntentMeta.id]: Plugin.lazy(() => import('./plugins/IntentPlugin/plugin')),\n },\n core: [SurfaceMeta.id, IntentMeta.id, ...core],\n ...params,\n });\n\n invariant(host.provides?.context);\n invariant(host.provides?.root);\n const Context = host.provides.context;\n const Root = host.provides.root;\n\n return () => (\n <Context>\n <Root />\n </Context>\n );\n};\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;ACIA,iBAAkB;AGAlB,IAAAA,cAAkB;AEAlB,mBAAuE;ACAvE,IAAAC,gBAAwB;AACxB,IAAAA,gBAAkF;AAElF,2BAAkC;AAClC,iBAAoB;AEJpB,IAAAA,gBAAkE;ACAlE,IAAAA,gBAQO;AACP,IAAAA,gBAA0C;ACT1C,IAAAA,gBAAkB;AAElB,uBAA0B;AXmBnB,IAAMC,mBAAmB,CAACC,WAC9BA,OAAOC,SAAiBC,OAAOC,OAAQH,SAAmCI;AAKtE,IAAMC,0BAA0B,CAACL,WACrCA,OAAOC,SAAiBC,OAAOI,UAAWN,SAA0CI;AChBhF,IAAMG,SAASC,aAAEC,OAAO;EAC7BC,YAAYF,aAAEG,QAAO;EACrBC,a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AAAA,QAAA,cAACoF,MAAAA,IAAAA,CAAAA;AAGP;",
6
+ "names": ["import_zod", "import_react", "parseGraphPlugin", "plugin", "provides", "graph", "root", "undefined", "parseGraphBuilderPlugin", "builder", "Layout", "z", "object", "fullscreen", "boolean", "sidebarOpen", "complementarySidebarOpen", "dialogOpen", "dialogContent", "any", "optional", "describe", "popoverOpen", "popoverContent", "popoverAnchorId", "string", "active", "previous", "parseLayoutPlugin", "success", "safeParse", "layout", "LAYOUT_ACTION", "LayoutAction", "TOGGLE_FULLSCREEN", "TOGGLE_SIDEBAR", "TOGGLE_COMPLEMENTARY_SIDEBAR", "OPEN_DIALOG", "CLOSE_DIALOG", "OPEN_POPOVER", "CLOSE_POPOVER", "ACTIVATE", "parseMetadataRecordsPlugin", "metadata", "records", "parseMetadataResolverPlugin", "resolver", "parseSettingsPlugin", "settings", "SETTINGS_ACTION", "SettingsAction", "OPEN", "ResourceKey", "union", "record", "ResourceLanguage", "Resource", "parseTranslationsPlugin", "array", "translations", "pluginMeta", "meta", "Plugin", "lazy", "p", "props", "then", "default", "definition", "PluginContext", "createContext", "ready", "enabled", "plugins", "available", "setPlugin", "usePlugins", "useContext", "usePlugin", "id", "findPlugin", "useResolvePlugin", "predicate", "resolvePlugin", "PluginProvider", "Provider", "parsePluginHost", "PLUGIN_HOST", "PluginHost", "order", "definitions", "core", "defaults", "fallback", "state", "LocalStorageStore", "filter", "includes", "values", "prop", "$enabled", "json", "name", "context", "children", "React", "value", "useEffect", "log", "timeout", "setTimeout", "enabledIds", "sort", "a", "b", "indexA", "findIndex", "indexB", "Promise", "all", "map", "Boolean", "initializePlugin", "catch", "err", "console", "error", "pluginDefinition", "shallow", "clearTimeout", "ComposedContext", "composeContext", "rootComponents", "initialize", "Component", "key", "node", "compose", "contexts", "reduce", "Acc", "Next", "isObject", "data", "ErrorBoundary", "constructor", "getDerivedStateFromError", "componentDidUpdate", "prevProps", "resetError", "render", "this", "reset", "setState", "Surface", "forwardRef", "role", "rest", "forwardedRef", "SurfaceContext", "surfaces", "SurfaceResolver", "ref", "components", "useSurface", "parent", "nodes", "resolveNodes", "currentContext", "length", "contentFallback", "Object", "entries", "component", "result", "isValidElement", "aDisposition", "disposition", "bDisposition", "Fragment", "limit", "slice", "createApp", "params", "host", "SurfaceMeta", "IntentMeta", "invariant", "Context", "Root"]
7
7
  }