@dxos/app-framework 0.3.10-main.cb1d9e2 → 0.3.10-main.ec4f2f4

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 (37) hide show
  1. package/dist/lib/browser/index.mjs +121 -19
  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 +145 -47
  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/PluginHost/PluginContext.d.ts +1 -8
  8. package/dist/types/src/plugins/PluginHost/PluginContext.d.ts.map +1 -1
  9. package/dist/types/src/plugins/PluginHost/PluginHost.d.ts.map +1 -1
  10. package/dist/types/src/plugins/PluginHost/plugin.d.ts +8 -0
  11. package/dist/types/src/plugins/PluginHost/plugin.d.ts.map +1 -1
  12. package/dist/types/src/plugins/common/index.d.ts +1 -0
  13. package/dist/types/src/plugins/common/index.d.ts.map +1 -1
  14. package/dist/types/src/plugins/common/layout.d.ts +5 -5
  15. package/dist/types/src/plugins/common/layout.d.ts.map +1 -1
  16. package/dist/types/src/plugins/common/settings.d.ts +8 -0
  17. package/dist/types/src/plugins/common/settings.d.ts.map +1 -0
  18. package/dist/types/src/plugins/components/SettingsDialog.d.ts +2 -0
  19. package/dist/types/src/plugins/components/SettingsDialog.d.ts.map +1 -0
  20. package/dist/types/src/plugins/components/SettingsValue.d.ts +8 -0
  21. package/dist/types/src/plugins/components/SettingsValue.d.ts.map +1 -0
  22. package/dist/types/src/plugins/components/index.d.ts +3 -0
  23. package/dist/types/src/plugins/components/index.d.ts.map +1 -0
  24. package/dist/types/src/plugins/index.d.ts +1 -0
  25. package/dist/types/src/plugins/index.d.ts.map +1 -1
  26. package/package.json +13 -9
  27. package/src/plugins/PluginHost/PluginContext.tsx +2 -11
  28. package/src/plugins/PluginHost/PluginHost.tsx +6 -5
  29. package/src/plugins/PluginHost/plugin.ts +5 -0
  30. package/src/plugins/common/index.ts +1 -0
  31. package/src/plugins/common/layout.ts +5 -3
  32. package/src/plugins/common/settings.ts +16 -0
  33. package/src/plugins/components/SettingsDialog.tsx +98 -0
  34. package/src/plugins/components/SettingsValue.tsx +36 -0
  35. package/src/plugins/components/index.ts +6 -0
  36. package/src/plugins/index.ts +1 -0
  37. package/tsconfig.json +6 -0
@@ -38,6 +38,8 @@ __export(node_exports, {
38
38
  Resource: () => Resource,
39
39
  ResourceKey: () => ResourceKey,
40
40
  ResourceLanguage: () => ResourceLanguage,
41
+ SettingsDialogContent: () => SettingsDialogContent,
42
+ SettingsValue: () => SettingsValue,
41
43
  Surface: () => Surface,
42
44
  SurfaceProvider: () => import_chunk_DC3GU6QR.SurfaceProvider,
43
45
  createApp: () => createApp,
@@ -71,15 +73,20 @@ var import_chunk_BOQBLWMX = require("./chunk-BOQBLWMX.cjs");
71
73
  var import_chunk_VDKZ7AAF = require("./chunk-VDKZ7AAF.cjs");
72
74
  var import_zod = require("zod");
73
75
  var import_zod2 = require("zod");
74
- var import_react = require("react");
75
- var import_react2 = require("deepsignal/react");
76
- var import_react3 = __toESM(require("react"));
76
+ var import_react = __toESM(require("react"));
77
+ var import_react_ui = require("@dxos/react-ui");
78
+ var import_react_ui_theme = require("@dxos/react-ui-theme");
79
+ var import_react2 = require("react");
80
+ var import_react3 = require("deepsignal/react");
81
+ var import_react4 = __toESM(require("react"));
77
82
  var import_local_storage = require("@dxos/local-storage");
78
83
  var import_log = require("@dxos/log");
79
- var import_react4 = __toESM(require("react"));
80
84
  var import_react5 = __toESM(require("react"));
81
- var import_react6 = require("react");
82
- var import_react7 = __toESM(require("react"));
85
+ var import_react6 = __toESM(require("react"));
86
+ var import_react7 = require("react");
87
+ var import_react8 = __toESM(require("react"));
88
+ var import_react_ui2 = require("@dxos/react-ui");
89
+ var import_react9 = __toESM(require("react"));
83
90
  var import_invariant = require("@dxos/invariant");
84
91
  var parseGraphPlugin = (plugin) => plugin.provides.graph?.root ? plugin : void 0;
85
92
  var parseGraphBuilderPlugin = (plugin) => plugin.provides.graph?.builder ? plugin : void 0;
@@ -87,11 +94,12 @@ var Layout = import_zod.z.object({
87
94
  fullscreen: import_zod.z.boolean(),
88
95
  sidebarOpen: import_zod.z.boolean(),
89
96
  complementarySidebarOpen: import_zod.z.boolean(),
90
- dialogContent: import_zod.z.any().optional().describe("Data to be passed to the dialog Surface."),
97
+ // TODO(burdon): Why do we have a single root?
91
98
  dialogOpen: import_zod.z.boolean(),
92
- popoverAnchorId: import_zod.z.string().optional(),
93
- popoverContent: import_zod.z.any().optional().describe("Data to be passed to the popover Surface."),
99
+ dialogContent: import_zod.z.any().optional().describe("Data to be passed to the dialog Surface."),
94
100
  popoverOpen: import_zod.z.boolean(),
101
+ popoverContent: import_zod.z.any().optional().describe("Data to be passed to the popover Surface."),
102
+ popoverAnchorId: import_zod.z.string().optional(),
95
103
  // TODO(wittjosiah): Array?
96
104
  active: import_zod.z.string().optional().describe("Id of the currently active item."),
97
105
  // TODO(wittjosiah): History?
@@ -138,17 +146,15 @@ var Plugin;
138
146
  });
139
147
  };
140
148
  })(Plugin || (Plugin = {}));
141
- var PluginContext = /* @__PURE__ */ (0, import_react.createContext)({
149
+ var PluginContext = /* @__PURE__ */ (0, import_react2.createContext)({
142
150
  ready: false,
143
151
  enabled: [],
144
152
  plugins: [],
145
153
  available: [],
146
- enablePlugin: () => {
147
- },
148
- disablePlugin: () => {
154
+ setPlugin: () => {
149
155
  }
150
156
  });
151
- var usePlugins = () => (0, import_react.useContext)(PluginContext);
157
+ var usePlugins = () => (0, import_react2.useContext)(PluginContext);
152
158
  var usePlugin = (id) => {
153
159
  const { plugins } = usePlugins();
154
160
  return (0, import_chunk_VDKZ7AAF.findPlugin)(plugins, id);
@@ -169,14 +175,15 @@ var PluginHost = ({ order, plugins: definitions, core = [], defaults = [], fallb
169
175
  ],
170
176
  plugins: [],
171
177
  available: order.filter(({ id }) => !core.includes(id)),
172
- enablePlugin: (id) => {
173
- state.values.enabled = [
174
- ...state.values.enabled,
175
- id
176
- ];
177
- },
178
- disablePlugin: (id) => {
179
- state.values.enabled = state.values.enabled.filter((enabled) => enabled !== id);
178
+ setPlugin: (id, enabled) => {
179
+ if (enabled) {
180
+ state.values.enabled = [
181
+ ...state.values.enabled,
182
+ id
183
+ ];
184
+ } else {
185
+ state.values.enabled = state.values.enabled.filter((enabled2) => enabled2 !== id);
186
+ }
180
187
  }
181
188
  });
182
189
  state.prop(state.values.$enabled, "enabled", import_local_storage.LocalStorageStore.json);
@@ -187,16 +194,16 @@ var PluginHost = ({ order, plugins: definitions, core = [], defaults = [], fallb
187
194
  },
188
195
  provides: {
189
196
  plugins: state.values,
190
- context: ({ children }) => /* @__PURE__ */ import_react3.default.createElement(PluginProvider, {
197
+ context: ({ children }) => /* @__PURE__ */ import_react4.default.createElement(PluginProvider, {
191
198
  value: state.values
192
199
  }, children),
193
200
  root: () => {
194
- (0, import_react3.useEffect)(() => {
201
+ (0, import_react4.useEffect)(() => {
195
202
  (0, import_log.log)("initializing plugins", {
196
203
  enabled: state.values.enabled
197
204
  }, {
198
205
  F: __dxlog_file,
199
- L: 66,
206
+ L: 67,
200
207
  S: void 0,
201
208
  C: (f, a) => f(...a)
202
209
  });
@@ -221,7 +228,7 @@ var PluginHost = ({ order, plugins: definitions, core = [], defaults = [], fallb
221
228
  plugins
222
229
  }, {
223
230
  F: __dxlog_file,
224
- L: 91,
231
+ L: 92,
225
232
  S: void 0,
226
233
  C: (f, a) => f(...a)
227
234
  });
@@ -232,11 +239,11 @@ var PluginHost = ({ order, plugins: definitions, core = [], defaults = [], fallb
232
239
  plugins
233
240
  }, {
234
241
  F: __dxlog_file,
235
- L: 98,
242
+ L: 99,
236
243
  S: void 0,
237
244
  C: (f, a) => f(...a)
238
245
  });
239
- state.values.plugins = (0, import_react2.shallow)(plugins);
246
+ state.values.plugins = (0, import_react3.shallow)(plugins);
240
247
  state.values.ready = true;
241
248
  });
242
249
  return () => {
@@ -245,10 +252,10 @@ var PluginHost = ({ order, plugins: definitions, core = [], defaults = [], fallb
245
252
  };
246
253
  }, []);
247
254
  if (!state.values.ready) {
248
- return /* @__PURE__ */ import_react3.default.createElement(import_react3.default.Fragment, null, fallback);
255
+ return /* @__PURE__ */ import_react4.default.createElement(import_react4.default.Fragment, null, fallback);
249
256
  }
250
257
  const ComposedContext = composeContext(state.values.plugins);
251
- return /* @__PURE__ */ import_react3.default.createElement(ComposedContext, null, rootComponents(state.values.plugins));
258
+ return /* @__PURE__ */ import_react4.default.createElement(ComposedContext, null, rootComponents(state.values.plugins));
252
259
  }
253
260
  }
254
261
  };
@@ -267,7 +274,7 @@ var rootComponents = (plugins) => {
267
274
  return plugins.map((plugin) => {
268
275
  const Component2 = plugin.provides.root;
269
276
  if (Component2) {
270
- return /* @__PURE__ */ import_react3.default.createElement(Component2, {
277
+ return /* @__PURE__ */ import_react4.default.createElement(Component2, {
271
278
  key: plugin.meta.id
272
279
  });
273
280
  } else {
@@ -281,10 +288,10 @@ var composeContext = (plugins) => {
281
288
  var compose = (contexts) => {
282
289
  return [
283
290
  ...contexts
284
- ].reduce((Acc, Next) => ({ children }) => /* @__PURE__ */ import_react3.default.createElement(Acc, null, /* @__PURE__ */ import_react3.default.createElement(Next, null, children)));
291
+ ].reduce((Acc, Next) => ({ children }) => /* @__PURE__ */ import_react4.default.createElement(Acc, null, /* @__PURE__ */ import_react4.default.createElement(Next, null, children)));
285
292
  };
286
293
  var isObject = (data) => !!data && typeof data === "object";
287
- var ErrorBoundary = class extends import_react4.Component {
294
+ var ErrorBoundary = class extends import_react5.Component {
288
295
  constructor(props) {
289
296
  super(props);
290
297
  this.state = {
@@ -303,7 +310,7 @@ var ErrorBoundary = class extends import_react4.Component {
303
310
  }
304
311
  render() {
305
312
  if (this.state.error) {
306
- return /* @__PURE__ */ import_react4.default.createElement(this.props.fallback, {
313
+ return /* @__PURE__ */ import_react5.default.createElement(this.props.fallback, {
307
314
  error: this.state.error,
308
315
  reset: this.resetError
309
316
  });
@@ -316,30 +323,30 @@ var ErrorBoundary = class extends import_react4.Component {
316
323
  });
317
324
  }
318
325
  };
319
- var Surface = /* @__PURE__ */ (0, import_react5.forwardRef)(({ role, name = role, fallback, ...rest }, forwardedRef) => {
326
+ var Surface = /* @__PURE__ */ (0, import_react6.forwardRef)(({ role, name = role, fallback, ...rest }, forwardedRef) => {
320
327
  const props = {
321
328
  role,
322
329
  name,
323
330
  fallback,
324
331
  ...rest
325
332
  };
326
- const context = (0, import_react6.useContext)(SurfaceContext);
333
+ const context = (0, import_react7.useContext)(SurfaceContext);
327
334
  const data = props.data ?? (name && context?.surfaces?.[name]?.data || {});
328
- return /* @__PURE__ */ import_react5.default.createElement(import_react5.default.Fragment, null, fallback ? /* @__PURE__ */ import_react5.default.createElement(ErrorBoundary, {
335
+ return /* @__PURE__ */ import_react6.default.createElement(import_react6.default.Fragment, null, fallback ? /* @__PURE__ */ import_react6.default.createElement(ErrorBoundary, {
329
336
  data,
330
337
  fallback
331
- }, /* @__PURE__ */ import_react5.default.createElement(SurfaceResolver, {
338
+ }, /* @__PURE__ */ import_react6.default.createElement(SurfaceResolver, {
332
339
  ...props,
333
340
  ref: forwardedRef
334
- })) : /* @__PURE__ */ import_react5.default.createElement(SurfaceResolver, {
341
+ })) : /* @__PURE__ */ import_react6.default.createElement(SurfaceResolver, {
335
342
  ...props,
336
343
  ref: forwardedRef
337
344
  }));
338
345
  });
339
- var SurfaceContext = /* @__PURE__ */ (0, import_react6.createContext)(null);
340
- var SurfaceResolver = /* @__PURE__ */ (0, import_react5.forwardRef)((props, forwardedRef) => {
346
+ var SurfaceContext = /* @__PURE__ */ (0, import_react7.createContext)(null);
347
+ var SurfaceResolver = /* @__PURE__ */ (0, import_react6.forwardRef)((props, forwardedRef) => {
341
348
  const { components } = (0, import_chunk_DC3GU6QR.useSurface)();
342
- const parent = (0, import_react6.useContext)(SurfaceContext);
349
+ const parent = (0, import_react7.useContext)(SurfaceContext);
343
350
  const nodes = resolveNodes(components, props, parent, forwardedRef);
344
351
  const currentContext = {
345
352
  ...props,
@@ -348,9 +355,9 @@ var SurfaceResolver = /* @__PURE__ */ (0, import_react5.forwardRef)((props, forw
348
355
  ...props.surfaces
349
356
  }
350
357
  };
351
- return /* @__PURE__ */ import_react5.default.createElement(SurfaceContext.Provider, {
358
+ return /* @__PURE__ */ import_react6.default.createElement(SurfaceContext.Provider, {
352
359
  value: currentContext
353
- }, nodes.length > 0 ? nodes : props.contentFallback ? /* @__PURE__ */ import_react5.default.createElement(props.contentFallback, null) : null);
360
+ }, nodes.length > 0 ? nodes : props.contentFallback ? /* @__PURE__ */ import_react6.default.createElement(props.contentFallback, null) : null);
354
361
  });
355
362
  var resolveNodes = (components, props, context, forwardedRef) => {
356
363
  const data = {
@@ -368,7 +375,7 @@ var resolveNodes = (components, props, context, forwardedRef) => {
368
375
  return "node" in result ? [
369
376
  key,
370
377
  result
371
- ] : /* @__PURE__ */ (0, import_react5.isValidElement)(result) ? [
378
+ ] : /* @__PURE__ */ (0, import_react6.isValidElement)(result) ? [
372
379
  key,
373
380
  {
374
381
  node: result
@@ -385,11 +392,100 @@ var resolveNodes = (components, props, context, forwardedRef) => {
385
392
  return 1;
386
393
  }
387
394
  return 0;
388
- }).map(([key, result]) => /* @__PURE__ */ import_react5.default.createElement(import_react5.Fragment, {
395
+ }).map(([key, result]) => /* @__PURE__ */ import_react6.default.createElement(import_react6.Fragment, {
389
396
  key
390
397
  }, result.node));
391
398
  return props.limit ? nodes.slice(0, props.limit) : nodes;
392
399
  };
400
+ var SettingsDialogContent = () => {
401
+ const [plugin, setPlugin] = (0, import_react.useState)("dxos.org/plugin/registry");
402
+ const { t } = (0, import_react_ui.useTranslation)("os");
403
+ const { plugins, enabled } = usePlugins();
404
+ const core = [
405
+ "dxos.org/plugin/layout",
406
+ "dxos.org/plugin/client",
407
+ "dxos.org/plugin/space",
408
+ "dxos.org/plugin/registry"
409
+ ];
410
+ 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);
411
+ return /* @__PURE__ */ import_react.default.createElement(import_react_ui.DensityProvider, {
412
+ density: "fine"
413
+ }, /* @__PURE__ */ import_react.default.createElement(import_react_ui.Dialog.Content, {
414
+ classNames: [
415
+ "h-[90%] md:max-is-[40rem] overflow-hidden"
416
+ ]
417
+ }, /* @__PURE__ */ import_react.default.createElement(import_react_ui.Dialog.Title, null, t("settings dialog title", {
418
+ ns: "os"
419
+ })), /* @__PURE__ */ import_react.default.createElement("div", {
420
+ className: "flex grow mlb-4 overflow-hidden"
421
+ }, /* @__PURE__ */ import_react.default.createElement("div", {
422
+ 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)
423
+ }, /* @__PURE__ */ import_react.default.createElement(PluginList, {
424
+ title: "Options",
425
+ plugins: core.map((id) => plugins.find((p) => p.meta.id === id).meta),
426
+ selected: plugin,
427
+ onSelect: (plugin2) => setPlugin(plugin2)
428
+ }), /* @__PURE__ */ import_react.default.createElement(PluginList, {
429
+ title: "Plugins",
430
+ plugins: filteredPlugins,
431
+ selected: plugin,
432
+ onSelect: (plugin2) => setPlugin(plugin2)
433
+ })), /* @__PURE__ */ import_react.default.createElement("div", {
434
+ 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)
435
+ }, /* @__PURE__ */ import_react.default.createElement(Surface, {
436
+ role: "settings",
437
+ data: {
438
+ plugin
439
+ }
440
+ }))), /* @__PURE__ */ import_react.default.createElement(import_react_ui.Dialog.Close, {
441
+ asChild: true
442
+ }, /* @__PURE__ */ import_react.default.createElement(import_react_ui.Button, {
443
+ variant: "primary",
444
+ classNames: "mbs-2"
445
+ }, t("done label", {
446
+ ns: "os"
447
+ })))));
448
+ };
449
+ var PluginList = ({ title, plugins, selected, onSelect }) => {
450
+ return /* @__PURE__ */ import_react.default.createElement("div", {
451
+ role: "none"
452
+ }, /* @__PURE__ */ import_react.default.createElement("h2", {
453
+ className: "my-1 px-2 text-sm text-neutral-500"
454
+ }, title), /* @__PURE__ */ import_react.default.createElement(import_react_ui.List, {
455
+ selectable: true
456
+ }, plugins.map((plugin) => /* @__PURE__ */ import_react.default.createElement(import_react_ui.ListItem.Root, {
457
+ key: plugin.id,
458
+ onClick: () => onSelect(plugin.id),
459
+ selected: plugin.id === selected,
460
+ classNames: [
461
+ "px-2 rounded",
462
+ plugin.id === selected && import_react_ui_theme.ghostSelected,
463
+ import_react_ui_theme.ghostHover
464
+ ]
465
+ }, /* @__PURE__ */ import_react.default.createElement(import_react_ui.ListItem.Heading, {
466
+ classNames: [
467
+ "flex w-full items-center cursor-pointer"
468
+ ]
469
+ }, plugin.name)))));
470
+ };
471
+ var SettingsValue = ({ label, description, children }) => {
472
+ return /* @__PURE__ */ import_react8.default.createElement("div", {
473
+ role: "none",
474
+ className: "flex w-full gap-4 py-1"
475
+ }, /* @__PURE__ */ import_react8.default.createElement(import_react_ui2.Input.Root, null, /* @__PURE__ */ import_react8.default.createElement("div", {
476
+ role: "none",
477
+ className: "flex flex-col w-full"
478
+ }, /* @__PURE__ */ import_react8.default.createElement(import_react_ui2.Input.Label, {
479
+ classNames: "flex min-h-[40px] items-center"
480
+ }, label), description && /* @__PURE__ */ import_react8.default.createElement(import_react_ui2.Input.DescriptionAndValidation, {
481
+ classNames: "mbs-0.5"
482
+ }, /* @__PURE__ */ import_react8.default.createElement(import_react_ui2.Input.Description, null, description))), /* @__PURE__ */ import_react8.default.createElement("div", {
483
+ role: "none"
484
+ }, /* @__PURE__ */ import_react8.default.createElement("div", {
485
+ role: "none",
486
+ className: "flex min-h-[40px] items-center"
487
+ }, children))));
488
+ };
393
489
  var __dxlog_file2 = "/home/runner/work/dxos/dxos/packages/sdk/app-framework/src/App.tsx";
394
490
  var createApp = ({ order, plugins, core = order.map(({ id }) => id), ...params }) => {
395
491
  const host = PluginHost({
@@ -430,7 +526,7 @@ var createApp = ({ order, plugins, core = order.map(({ id }) => id), ...params }
430
526
  });
431
527
  const Context = host.provides.context;
432
528
  const Root = host.provides.root;
433
- return () => /* @__PURE__ */ import_react7.default.createElement(Context, null, /* @__PURE__ */ import_react7.default.createElement(Root, null));
529
+ return () => /* @__PURE__ */ import_react9.default.createElement(Context, null, /* @__PURE__ */ import_react9.default.createElement(Root, null));
434
530
  };
435
531
  // Annotate the CommonJS export names for ESM import in node:
436
532
  0 && (module.exports = {
@@ -444,6 +540,8 @@ var createApp = ({ order, plugins, core = order.map(({ id }) => id), ...params }
444
540
  Resource,
445
541
  ResourceKey,
446
542
  ResourceLanguage,
543
+ SettingsDialogContent,
544
+ SettingsValue,
447
545
  Surface,
448
546
  SurfaceProvider,
449
547
  createApp,
@@ -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/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 */\nexport const Layout = z.object({\n fullscreen: z.boolean(),\n sidebarOpen: z.boolean(),\n complementarySidebarOpen: z.boolean(),\n\n dialogContent: z.any().optional().describe('Data to be passed to the dialog Surface.'),\n dialogOpen: z.boolean(),\n\n popoverAnchorId: z.string().optional(),\n popoverContent: z.any().optional().describe('Data to be passed to the popover Surface.'),\n popoverOpen: z.boolean(),\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 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 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 * 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 *\n * Requires reload to take effect.\n */\n enablePlugin: (id: string) => void;\n\n /**\n * Mark plugin as disabled.\n *\n * Requires reload to take effect.\n */\n disablePlugin: (id: string) => void;\n};\n\nconst PluginContext: Context<PluginContext> = createContext<PluginContext>({\n ready: false,\n enabled: [],\n plugins: [],\n available: [],\n enablePlugin: () => {},\n disablePlugin: () => {},\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 enablePlugin: (id: string) => {\n state.values.enabled = [...state.values.enabled, id];\n },\n disablePlugin: (id: string) => {\n state.values.enabled = state.values.enabled.filter((enabled) => enabled !== id);\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;AEAlB,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;AVmBnB,IAAMC,mBAAmB,CAACC,WAC9BA,OAAOC,SAAiBC,OAAOC,OAAQH,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", "plugin", "provides", "graph", "root", "undefined", "parseGraphBuilderPlugin", "builder", "Layout", "z", "object", "fullscreen", "boolean", "sidebarOpen", "complementarySidebarOpen", "dialogContent", "any", "optional", "describe", "dialogOpen", "popoverAnchorId", "string", "popoverContent", "popoverOpen", "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", "ResourceKey", "union", "record", "ResourceLanguage", "Resource", "parseTranslationsPlugin", "array", "translations", "pluginMeta", "meta", "Plugin", "lazy", "p", "props", "then", "default", "definition", "PluginContext", "createContext", "ready", "enabled", "plugins", "available", "enablePlugin", "disablePlugin", "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"]
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/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 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\nexport const SettingsDialogContent = () => {\n // TODO(burdon): Store preview tab.\n const [plugin, setPlugin] = useState<string>('dxos.org/plugin/registry');\n const { t } = useTranslation('os');\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.\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 { 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;AAElB,uBAA0B;AZmBnB,IAAME,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,aAAaJ,aAAEG,QAAO;EACtBE,0BAA0BL,aAAEG,QAAO;;EAGnCG,YAAYN,aAAEG,QAAO;EACrBI,eAAeP,aAAEQ,IAAG,EAAGC,SAAQ,EAAGC,SAAS,0CAAA;EAE3CC,aAAaX,aAAEG,QAAO;EACtBS,gBAAgBZ,aAAEQ,IAAG,EAAGC,SAAQ,EAAGC,SAAS,2CAAA;EAC5CG,iBAAiBb,aAAEc,OAAM,EAAGL,SAAQ;;EAGpCM,QAAQf,aAAEc,OAAM,EAAGL,SAAQ,EAAGC,SAAS,kCAAA;;EAEvCM,UAAUhB,aAAEc,OAAM,EAAGL,SAAQ;AAC/B,CAAA;AAcO,IAAMQ,oBAAoB,CAACzB,WAAAA;AAChC,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AAA,CAAAA,GAK1BnH,8BAAAA,QAAA,cAAC4F,OAAAA;IAAIzC,MAAK;KACRnD,8BAAAA,QAAA,cAAC4F,OAAAA;IAAIzC,MAAK;IAAO0C,WAAU;KACxB9F,QAAAA,CAAAA,CAAAA,CAAAA;AAMb;;ACGO,IAAMyH,YAAY,CAAC,EAAExI,OAAOhB,SAASkB,OAAOF,MAAM+B,IAAI,CAAC,EAAEzC,GAAE,MAAOA,EAAAA,GAAK,GAAGmJ,OAAAA,MAAgC;AAC/G,QAAMC,OAAO3I,WAAW;IACtBC,OAAO;MAAC2I,sBAAAA;MAAaC;SAAe5I;;IACpChB,SAAS;MACP,GAAGA;MACH,CAAC2J,sBAAAA,aAAYrJ,EAAE,GAAGjB,OAAOC,KAAK,MAAM,OAAO,uBAAA,CAAA;MAC3C,CAACsK,mCAAWtJ,EAAE,GAAGjB,OAAOC,KAAK,MAAM,OAAO,uBAAA,CAAA;IAC5C;IACA4B,MAAM;MAACyI,sBAAAA,aAAYrJ;MAAIsJ,mCAAWtJ;SAAOY;;IACzC,GAAGuI;EACL,CAAA;AAEAI,kCAAUH,KAAK1N,UAAU8F,SAAAA,QAAAA;;;;;;;;;AACzB+H,kCAAUH,KAAK1N,UAAUE,MAAAA,QAAAA;;;;;;;;;AACzB,QAAM4N,UAAUJ,KAAK1N,SAAS8F;AAC9B,QAAM8G,OAAOc,KAAK1N,SAASE;AAE3B,SAAO,MACL8F,8BAAAA,QAAA,cAAC8H,SAAAA,MACC9H,8BAAAA,QAAA,cAAC4G,MAAAA,IAAAA,CAAAA;AAGP;",
6
+ "names": ["import_zod", "import_react", "import_react_ui", "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", "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", "useState", "t", "useTranslation", "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", "createApp", "params", "host", "SurfaceMeta", "IntentMeta", "invariant", "Context"]
7
7
  }