@dxos/app-framework 0.3.10-main.fe592a2 → 0.3.10-next.3597a2d
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/lib/browser/index.mjs +30 -214
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/node/index.cjs +42 -221
- package/dist/lib/node/index.cjs.map +4 -4
- package/dist/lib/node/meta.json +1 -1
- package/dist/types/src/plugins/common/layout.d.ts +8 -11
- package/dist/types/src/plugins/common/layout.d.ts.map +1 -1
- package/dist/types/src/plugins/common/settings.d.ts +6 -5
- package/dist/types/src/plugins/common/settings.d.ts.map +1 -1
- package/dist/types/src/plugins/index.d.ts +0 -1
- package/dist/types/src/plugins/index.d.ts.map +1 -1
- package/package.json +9 -16
- package/src/plugins/common/layout.ts +1 -6
- package/src/plugins/common/settings.ts +11 -5
- package/src/plugins/index.ts +0 -1
- package/tsconfig.json +0 -15
- package/dist/types/src/plugins/components/CommandsDialog.d.ts +0 -5
- package/dist/types/src/plugins/components/CommandsDialog.d.ts.map +0 -1
- package/dist/types/src/plugins/components/SettingsDialog.d.ts +0 -2
- package/dist/types/src/plugins/components/SettingsDialog.d.ts.map +0 -1
- package/dist/types/src/plugins/components/SettingsValue.d.ts +0 -8
- package/dist/types/src/plugins/components/SettingsValue.d.ts.map +0 -1
- package/dist/types/src/plugins/components/index.d.ts +0 -4
- package/dist/types/src/plugins/components/index.d.ts.map +0 -1
- package/src/plugins/components/CommandsDialog.tsx +0 -100
- package/src/plugins/components/SettingsDialog.tsx +0 -98
- package/src/plugins/components/SettingsValue.tsx +0 -36
- package/src/plugins/components/index.ts +0 -7
|
@@ -44,7 +44,7 @@ var parseLayoutPlugin = (plugin) => {
|
|
|
44
44
|
const { success } = Layout.safeParse(plugin.provides.layout);
|
|
45
45
|
return success ? plugin : void 0;
|
|
46
46
|
};
|
|
47
|
-
var LAYOUT_ACTION = "dxos.org/plugin/
|
|
47
|
+
var LAYOUT_ACTION = "dxos.org/plugin/layout";
|
|
48
48
|
var LayoutAction;
|
|
49
49
|
(function(LayoutAction2) {
|
|
50
50
|
LayoutAction2[LayoutAction2["TOGGLE_FULLSCREEN"] = `${LAYOUT_ACTION}/toggle-fullscreen`] = "TOGGLE_FULLSCREEN";
|
|
@@ -55,12 +55,6 @@ var LayoutAction;
|
|
|
55
55
|
LayoutAction2[LayoutAction2["OPEN_POPOVER"] = `${LAYOUT_ACTION}/open-popover`] = "OPEN_POPOVER";
|
|
56
56
|
LayoutAction2[LayoutAction2["CLOSE_POPOVER"] = `${LAYOUT_ACTION}/close-popover`] = "CLOSE_POPOVER";
|
|
57
57
|
LayoutAction2[LayoutAction2["ACTIVATE"] = `${LAYOUT_ACTION}/activate`] = "ACTIVATE";
|
|
58
|
-
LayoutAction2[LayoutAction2[
|
|
59
|
-
// TODO(burdon): Move to new plugin.
|
|
60
|
-
"OPEN_COMMANDS"
|
|
61
|
-
] = `${LAYOUT_ACTION}/open-commands`] = "OPEN_COMMANDS";
|
|
62
|
-
LayoutAction2[LayoutAction2["OPEN_SETTINGS"] = `${LAYOUT_ACTION}/open-settings`] = "OPEN_SETTINGS";
|
|
63
|
-
LayoutAction2[LayoutAction2["OPEN_SHORTCUTS"] = `${LAYOUT_ACTION}/open-shortcuts`] = "OPEN_SHORTCUTS";
|
|
64
58
|
})(LayoutAction || (LayoutAction = {}));
|
|
65
59
|
|
|
66
60
|
// packages/sdk/app-framework/src/plugins/common/metadata.ts
|
|
@@ -71,6 +65,16 @@ var parseMetadataResolverPlugin = (plugin) => {
|
|
|
71
65
|
return plugin.provides.metadata?.resolver ? plugin : void 0;
|
|
72
66
|
};
|
|
73
67
|
|
|
68
|
+
// packages/sdk/app-framework/src/plugins/common/settings.ts
|
|
69
|
+
var parseSettingsPlugin = (plugin) => {
|
|
70
|
+
return typeof plugin.provides.settings === "object" ? plugin : void 0;
|
|
71
|
+
};
|
|
72
|
+
var SETTINGS_ACTION = "dxos.org/plugin/settings";
|
|
73
|
+
var SettingsAction;
|
|
74
|
+
(function(SettingsAction2) {
|
|
75
|
+
SettingsAction2[SettingsAction2["OPEN"] = `${SETTINGS_ACTION}/open`] = "OPEN";
|
|
76
|
+
})(SettingsAction || (SettingsAction = {}));
|
|
77
|
+
|
|
74
78
|
// packages/sdk/app-framework/src/plugins/common/translations.ts
|
|
75
79
|
import { z as z2 } from "zod";
|
|
76
80
|
var ResourceKey = z2.union([
|
|
@@ -84,99 +88,6 @@ var parseTranslationsPlugin = (plugin) => {
|
|
|
84
88
|
return success ? plugin : void 0;
|
|
85
89
|
};
|
|
86
90
|
|
|
87
|
-
// packages/sdk/app-framework/src/plugins/components/CommandsDialog.tsx
|
|
88
|
-
import { DotOutline } from "@phosphor-icons/react";
|
|
89
|
-
import React, { useMemo, useRef } from "react";
|
|
90
|
-
import { Keyboard, keySymbols } from "@dxos/keyboard";
|
|
91
|
-
import { Button, Dialog, useTranslation } from "@dxos/react-ui";
|
|
92
|
-
import { SearchList } from "@dxos/react-ui-searchlist";
|
|
93
|
-
import { descriptionText, getSize, mx } from "@dxos/react-ui-theme";
|
|
94
|
-
var CommandsDialogContent = ({ graph }) => {
|
|
95
|
-
const { t } = useTranslation("os");
|
|
96
|
-
const toString = (label) => Array.isArray(label) ? t(...label) : label;
|
|
97
|
-
const actions = useMemo(() => {
|
|
98
|
-
const current = Keyboard.singleton.getCurrentContext();
|
|
99
|
-
const actionMap = /* @__PURE__ */ new Set();
|
|
100
|
-
const actions2 = [];
|
|
101
|
-
graph?.traverse({
|
|
102
|
-
visitor: (node, path) => {
|
|
103
|
-
if (current.startsWith(path.join("/"))) {
|
|
104
|
-
node.actions.forEach((action) => {
|
|
105
|
-
if (!actionMap.has(action.id)) {
|
|
106
|
-
actionMap.add(action.id);
|
|
107
|
-
actions2.push(action);
|
|
108
|
-
}
|
|
109
|
-
});
|
|
110
|
-
}
|
|
111
|
-
}
|
|
112
|
-
});
|
|
113
|
-
actions2.sort(({ label: a }, { label: b }) => {
|
|
114
|
-
return toString(a)?.toLowerCase().localeCompare(toString(b)?.toLowerCase());
|
|
115
|
-
});
|
|
116
|
-
return actions2;
|
|
117
|
-
}, [
|
|
118
|
-
graph
|
|
119
|
-
]);
|
|
120
|
-
const buttonRef = useRef(null);
|
|
121
|
-
return /* @__PURE__ */ React.createElement(Dialog.Content, {
|
|
122
|
-
classNames: [
|
|
123
|
-
"md:max-is-[30rem] overflow-hidden"
|
|
124
|
-
]
|
|
125
|
-
}, /* @__PURE__ */ React.createElement(Dialog.Title, null, t("commands dialog title", {
|
|
126
|
-
ns: "os"
|
|
127
|
-
})), /* @__PURE__ */ React.createElement(SearchList.Root, {
|
|
128
|
-
label: t("commandlist input placeholder"),
|
|
129
|
-
classNames: "flex flex-col grow overflow-hidden my-2"
|
|
130
|
-
}, /* @__PURE__ */ React.createElement(SearchList.Input, {
|
|
131
|
-
placeholder: t("commandlist input placeholder"),
|
|
132
|
-
classNames: mx("px-1 my-2")
|
|
133
|
-
}), /* @__PURE__ */ React.createElement(SearchList.Content, {
|
|
134
|
-
classNames: [
|
|
135
|
-
"max-bs-[30rem] overflow-auto"
|
|
136
|
-
]
|
|
137
|
-
}, actions?.map((action) => {
|
|
138
|
-
const label = toString(action.label);
|
|
139
|
-
const Icon = action.icon ?? DotOutline;
|
|
140
|
-
return /* @__PURE__ */ React.createElement(SearchList.Item, {
|
|
141
|
-
value: label,
|
|
142
|
-
key: action.id,
|
|
143
|
-
onSelect: () => {
|
|
144
|
-
if (action.properties.disabled) {
|
|
145
|
-
return;
|
|
146
|
-
}
|
|
147
|
-
buttonRef.current?.click();
|
|
148
|
-
setTimeout(() => {
|
|
149
|
-
void action.invoke();
|
|
150
|
-
});
|
|
151
|
-
},
|
|
152
|
-
classNames: "flex items-center gap-2",
|
|
153
|
-
disabled: action.properties.disabled,
|
|
154
|
-
...action.properties?.testId && {
|
|
155
|
-
"data-testid": action.properties.testId
|
|
156
|
-
}
|
|
157
|
-
}, /* @__PURE__ */ React.createElement(Icon, {
|
|
158
|
-
className: mx(getSize(4), "shrink-0", !action.icon && "invisible")
|
|
159
|
-
}), /* @__PURE__ */ React.createElement("span", {
|
|
160
|
-
className: "grow truncate"
|
|
161
|
-
}, label), action.keyBinding && /* @__PURE__ */ React.createElement("span", {
|
|
162
|
-
className: mx("shrink-0", descriptionText)
|
|
163
|
-
}, keySymbols(action.keyBinding).join("")));
|
|
164
|
-
}))), /* @__PURE__ */ React.createElement(Dialog.Close, {
|
|
165
|
-
asChild: true
|
|
166
|
-
}, /* @__PURE__ */ React.createElement(Button, {
|
|
167
|
-
ref: buttonRef,
|
|
168
|
-
variant: "primary",
|
|
169
|
-
classNames: "mbs-2"
|
|
170
|
-
}, t("close label", {
|
|
171
|
-
ns: "os"
|
|
172
|
-
}))));
|
|
173
|
-
};
|
|
174
|
-
|
|
175
|
-
// packages/sdk/app-framework/src/plugins/components/SettingsDialog.tsx
|
|
176
|
-
import React5, { useState } from "react";
|
|
177
|
-
import { Button as Button2, Dialog as Dialog2, List, ListItem, useTranslation as useTranslation2 } from "@dxos/react-ui";
|
|
178
|
-
import { ghostHover, ghostSelected, groupBorder, mx as mx2 } from "@dxos/react-ui-theme";
|
|
179
|
-
|
|
180
91
|
// packages/sdk/app-framework/src/plugins/PluginHost/plugin.ts
|
|
181
92
|
var pluginMeta = (meta) => meta;
|
|
182
93
|
var Plugin;
|
|
@@ -211,7 +122,7 @@ var PluginProvider = PluginContext.Provider;
|
|
|
211
122
|
|
|
212
123
|
// packages/sdk/app-framework/src/plugins/PluginHost/PluginHost.tsx
|
|
213
124
|
import { shallow } from "deepsignal/react";
|
|
214
|
-
import
|
|
125
|
+
import React, { useEffect } from "react";
|
|
215
126
|
import { LocalStorageStore } from "@dxos/local-storage";
|
|
216
127
|
import { log } from "@dxos/log";
|
|
217
128
|
var __dxlog_file = "/home/runner/work/dxos/dxos/packages/sdk/app-framework/src/plugins/PluginHost/PluginHost.tsx";
|
|
@@ -244,7 +155,7 @@ var PluginHost = ({ order, plugins: definitions, core = [], defaults = [], fallb
|
|
|
244
155
|
},
|
|
245
156
|
provides: {
|
|
246
157
|
plugins: state.values,
|
|
247
|
-
context: ({ children }) => /* @__PURE__ */
|
|
158
|
+
context: ({ children }) => /* @__PURE__ */ React.createElement(PluginProvider, {
|
|
248
159
|
value: state.values
|
|
249
160
|
}, children),
|
|
250
161
|
root: () => {
|
|
@@ -302,10 +213,10 @@ var PluginHost = ({ order, plugins: definitions, core = [], defaults = [], fallb
|
|
|
302
213
|
};
|
|
303
214
|
}, []);
|
|
304
215
|
if (!state.values.ready) {
|
|
305
|
-
return /* @__PURE__ */
|
|
216
|
+
return /* @__PURE__ */ React.createElement(React.Fragment, null, fallback);
|
|
306
217
|
}
|
|
307
218
|
const ComposedContext = composeContext(state.values.plugins);
|
|
308
|
-
return /* @__PURE__ */
|
|
219
|
+
return /* @__PURE__ */ React.createElement(ComposedContext, null, rootComponents(state.values.plugins));
|
|
309
220
|
}
|
|
310
221
|
}
|
|
311
222
|
};
|
|
@@ -324,7 +235,7 @@ var rootComponents = (plugins) => {
|
|
|
324
235
|
return plugins.map((plugin) => {
|
|
325
236
|
const Component2 = plugin.provides.root;
|
|
326
237
|
if (Component2) {
|
|
327
|
-
return /* @__PURE__ */
|
|
238
|
+
return /* @__PURE__ */ React.createElement(Component2, {
|
|
328
239
|
key: plugin.meta.id
|
|
329
240
|
});
|
|
330
241
|
} else {
|
|
@@ -338,14 +249,14 @@ var composeContext = (plugins) => {
|
|
|
338
249
|
var compose = (contexts) => {
|
|
339
250
|
return [
|
|
340
251
|
...contexts
|
|
341
|
-
].reduce((Acc, Next) => ({ children }) => /* @__PURE__ */
|
|
252
|
+
].reduce((Acc, Next) => ({ children }) => /* @__PURE__ */ React.createElement(Acc, null, /* @__PURE__ */ React.createElement(Next, null, children)));
|
|
342
253
|
};
|
|
343
254
|
|
|
344
255
|
// packages/sdk/app-framework/src/plugins/SurfacePlugin/helpers.ts
|
|
345
256
|
var isObject = (data) => !!data && typeof data === "object";
|
|
346
257
|
|
|
347
258
|
// packages/sdk/app-framework/src/plugins/SurfacePlugin/ErrorBoundary.tsx
|
|
348
|
-
import
|
|
259
|
+
import React2, { Component } from "react";
|
|
349
260
|
var ErrorBoundary = class extends Component {
|
|
350
261
|
constructor(props) {
|
|
351
262
|
super(props);
|
|
@@ -365,7 +276,7 @@ var ErrorBoundary = class extends Component {
|
|
|
365
276
|
}
|
|
366
277
|
render() {
|
|
367
278
|
if (this.state.error) {
|
|
368
|
-
return /* @__PURE__ */
|
|
279
|
+
return /* @__PURE__ */ React2.createElement(this.props.fallback, {
|
|
369
280
|
error: this.state.error,
|
|
370
281
|
reset: this.resetError
|
|
371
282
|
});
|
|
@@ -380,7 +291,7 @@ var ErrorBoundary = class extends Component {
|
|
|
380
291
|
};
|
|
381
292
|
|
|
382
293
|
// packages/sdk/app-framework/src/plugins/SurfacePlugin/Surface.tsx
|
|
383
|
-
import
|
|
294
|
+
import React3, { forwardRef, Fragment, isValidElement } from "react";
|
|
384
295
|
import { createContext as createContext2, useContext as useContext2 } from "react";
|
|
385
296
|
var Surface = /* @__PURE__ */ forwardRef(({ role, name = role, fallback, ...rest }, forwardedRef) => {
|
|
386
297
|
const props = {
|
|
@@ -391,13 +302,13 @@ var Surface = /* @__PURE__ */ forwardRef(({ role, name = role, fallback, ...rest
|
|
|
391
302
|
};
|
|
392
303
|
const context = useContext2(SurfaceContext);
|
|
393
304
|
const data = props.data ?? (name && context?.surfaces?.[name]?.data || {});
|
|
394
|
-
return /* @__PURE__ */
|
|
305
|
+
return /* @__PURE__ */ React3.createElement(React3.Fragment, null, fallback ? /* @__PURE__ */ React3.createElement(ErrorBoundary, {
|
|
395
306
|
data,
|
|
396
307
|
fallback
|
|
397
|
-
}, /* @__PURE__ */
|
|
308
|
+
}, /* @__PURE__ */ React3.createElement(SurfaceResolver, {
|
|
398
309
|
...props,
|
|
399
310
|
ref: forwardedRef
|
|
400
|
-
})) : /* @__PURE__ */
|
|
311
|
+
})) : /* @__PURE__ */ React3.createElement(SurfaceResolver, {
|
|
401
312
|
...props,
|
|
402
313
|
ref: forwardedRef
|
|
403
314
|
}));
|
|
@@ -414,9 +325,9 @@ var SurfaceResolver = /* @__PURE__ */ forwardRef((props, forwardedRef) => {
|
|
|
414
325
|
...props.surfaces
|
|
415
326
|
}
|
|
416
327
|
};
|
|
417
|
-
return /* @__PURE__ */
|
|
328
|
+
return /* @__PURE__ */ React3.createElement(SurfaceContext.Provider, {
|
|
418
329
|
value: currentContext
|
|
419
|
-
}, nodes.length > 0 ? nodes : props.contentFallback ? /* @__PURE__ */
|
|
330
|
+
}, nodes.length > 0 ? nodes : props.contentFallback ? /* @__PURE__ */ React3.createElement(props.contentFallback, null) : null);
|
|
420
331
|
});
|
|
421
332
|
var resolveNodes = (components, props, context, forwardedRef) => {
|
|
422
333
|
const data = {
|
|
@@ -451,108 +362,14 @@ var resolveNodes = (components, props, context, forwardedRef) => {
|
|
|
451
362
|
return 1;
|
|
452
363
|
}
|
|
453
364
|
return 0;
|
|
454
|
-
}).map(([key, result]) => /* @__PURE__ */
|
|
365
|
+
}).map(([key, result]) => /* @__PURE__ */ React3.createElement(Fragment, {
|
|
455
366
|
key
|
|
456
367
|
}, result.node));
|
|
457
368
|
return props.limit ? nodes.slice(0, props.limit) : nodes;
|
|
458
369
|
};
|
|
459
370
|
|
|
460
|
-
// packages/sdk/app-framework/src/plugins/components/SettingsDialog.tsx
|
|
461
|
-
var SettingsDialogContent = () => {
|
|
462
|
-
const { t } = useTranslation2("os");
|
|
463
|
-
const [plugin, setPlugin] = useState("dxos.org/plugin/registry");
|
|
464
|
-
const { plugins, enabled } = usePlugins();
|
|
465
|
-
const core = [
|
|
466
|
-
"dxos.org/plugin/layout",
|
|
467
|
-
"dxos.org/plugin/client",
|
|
468
|
-
"dxos.org/plugin/space",
|
|
469
|
-
"dxos.org/plugin/registry"
|
|
470
|
-
];
|
|
471
|
-
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);
|
|
472
|
-
return /* @__PURE__ */ React5.createElement(Dialog2.Content, {
|
|
473
|
-
classNames: [
|
|
474
|
-
"h-full md:max-is-[40rem] overflow-hidden"
|
|
475
|
-
]
|
|
476
|
-
}, /* @__PURE__ */ React5.createElement(Dialog2.Title, null, t("settings dialog title", {
|
|
477
|
-
ns: "os"
|
|
478
|
-
})), /* @__PURE__ */ React5.createElement("div", {
|
|
479
|
-
className: "flex grow mlb-4 overflow-hidden"
|
|
480
|
-
}, /* @__PURE__ */ React5.createElement("div", {
|
|
481
|
-
className: mx2("flex flex-col w-[200px] space-y-4 pr-4 border-r overflow-y-auto", groupBorder)
|
|
482
|
-
}, /* @__PURE__ */ React5.createElement(PluginList, {
|
|
483
|
-
title: "Options",
|
|
484
|
-
plugins: core.map((id) => plugins.find((p) => p.meta.id === id).meta),
|
|
485
|
-
selected: plugin,
|
|
486
|
-
onSelect: (plugin2) => setPlugin(plugin2)
|
|
487
|
-
}), /* @__PURE__ */ React5.createElement(PluginList, {
|
|
488
|
-
title: "Plugins",
|
|
489
|
-
plugins: filteredPlugins,
|
|
490
|
-
selected: plugin,
|
|
491
|
-
onSelect: (plugin2) => setPlugin(plugin2)
|
|
492
|
-
})), /* @__PURE__ */ React5.createElement("div", {
|
|
493
|
-
className: mx2("flex flex-col w-full md:px-4 divide-y overflow-y-auto", groupBorder)
|
|
494
|
-
}, /* @__PURE__ */ React5.createElement(Surface, {
|
|
495
|
-
role: "settings",
|
|
496
|
-
data: {
|
|
497
|
-
plugin
|
|
498
|
-
}
|
|
499
|
-
}))), /* @__PURE__ */ React5.createElement(Dialog2.Close, {
|
|
500
|
-
asChild: true
|
|
501
|
-
}, /* @__PURE__ */ React5.createElement(Button2, {
|
|
502
|
-
variant: "primary",
|
|
503
|
-
classNames: "mbs-2",
|
|
504
|
-
autoFocus: true
|
|
505
|
-
}, t("done label", {
|
|
506
|
-
ns: "os"
|
|
507
|
-
}))));
|
|
508
|
-
};
|
|
509
|
-
var PluginList = ({ title, plugins, selected, onSelect }) => {
|
|
510
|
-
return /* @__PURE__ */ React5.createElement("div", {
|
|
511
|
-
role: "none"
|
|
512
|
-
}, /* @__PURE__ */ React5.createElement("h2", {
|
|
513
|
-
className: "my-1 px-2 text-sm text-neutral-500"
|
|
514
|
-
}, title), /* @__PURE__ */ React5.createElement(List, {
|
|
515
|
-
selectable: true
|
|
516
|
-
}, plugins.map((plugin) => /* @__PURE__ */ React5.createElement(ListItem.Root, {
|
|
517
|
-
key: plugin.id,
|
|
518
|
-
onClick: () => onSelect(plugin.id),
|
|
519
|
-
selected: plugin.id === selected,
|
|
520
|
-
classNames: [
|
|
521
|
-
"px-2 rounded",
|
|
522
|
-
plugin.id === selected && ghostSelected,
|
|
523
|
-
ghostHover
|
|
524
|
-
]
|
|
525
|
-
}, /* @__PURE__ */ React5.createElement(ListItem.Heading, {
|
|
526
|
-
classNames: [
|
|
527
|
-
"flex w-full items-center cursor-pointer"
|
|
528
|
-
]
|
|
529
|
-
}, plugin.name)))));
|
|
530
|
-
};
|
|
531
|
-
|
|
532
|
-
// packages/sdk/app-framework/src/plugins/components/SettingsValue.tsx
|
|
533
|
-
import React6 from "react";
|
|
534
|
-
import { Input } from "@dxos/react-ui";
|
|
535
|
-
var SettingsValue = ({ label, description, children }) => {
|
|
536
|
-
return /* @__PURE__ */ React6.createElement("div", {
|
|
537
|
-
role: "none",
|
|
538
|
-
className: "flex w-full gap-4 py-1"
|
|
539
|
-
}, /* @__PURE__ */ React6.createElement(Input.Root, null, /* @__PURE__ */ React6.createElement("div", {
|
|
540
|
-
role: "none",
|
|
541
|
-
className: "flex flex-col w-full"
|
|
542
|
-
}, /* @__PURE__ */ React6.createElement(Input.Label, {
|
|
543
|
-
classNames: "flex min-h-[40px] items-center"
|
|
544
|
-
}, label), description && /* @__PURE__ */ React6.createElement(Input.DescriptionAndValidation, {
|
|
545
|
-
classNames: "mbs-0.5"
|
|
546
|
-
}, /* @__PURE__ */ React6.createElement(Input.Description, null, description))), /* @__PURE__ */ React6.createElement("div", {
|
|
547
|
-
role: "none"
|
|
548
|
-
}, /* @__PURE__ */ React6.createElement("div", {
|
|
549
|
-
role: "none",
|
|
550
|
-
className: "flex min-h-[40px] items-center"
|
|
551
|
-
}, children))));
|
|
552
|
-
};
|
|
553
|
-
|
|
554
371
|
// packages/sdk/app-framework/src/App.tsx
|
|
555
|
-
import
|
|
372
|
+
import React4 from "react";
|
|
556
373
|
import { invariant } from "@dxos/invariant";
|
|
557
374
|
var __dxlog_file2 = "/home/runner/work/dxos/dxos/packages/sdk/app-framework/src/App.tsx";
|
|
558
375
|
var createApp = ({ order, plugins, core = order.map(({ id }) => id), ...params }) => {
|
|
@@ -594,10 +411,9 @@ var createApp = ({ order, plugins, core = order.map(({ id }) => id), ...params }
|
|
|
594
411
|
});
|
|
595
412
|
const Context = host.provides.context;
|
|
596
413
|
const Root = host.provides.root;
|
|
597
|
-
return () => /* @__PURE__ */
|
|
414
|
+
return () => /* @__PURE__ */ React4.createElement(Context, null, /* @__PURE__ */ React4.createElement(Root, null));
|
|
598
415
|
};
|
|
599
416
|
export {
|
|
600
|
-
CommandsDialogContent,
|
|
601
417
|
ErrorBoundary,
|
|
602
418
|
IntentProvider,
|
|
603
419
|
Layout,
|
|
@@ -608,8 +424,7 @@ export {
|
|
|
608
424
|
Resource,
|
|
609
425
|
ResourceKey,
|
|
610
426
|
ResourceLanguage,
|
|
611
|
-
|
|
612
|
-
SettingsValue,
|
|
427
|
+
SettingsAction,
|
|
613
428
|
Surface,
|
|
614
429
|
SurfaceProvider,
|
|
615
430
|
createApp,
|
|
@@ -627,6 +442,7 @@ export {
|
|
|
627
442
|
parseMetadataResolverPlugin,
|
|
628
443
|
parsePluginHost,
|
|
629
444
|
parseRootSurfacePlugin,
|
|
445
|
+
parseSettingsPlugin,
|
|
630
446
|
parseSurfacePlugin,
|
|
631
447
|
parseTranslationsPlugin,
|
|
632
448
|
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/
|
|
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 // TODO(burdon): Move to new plugin.\n OPEN_COMMANDS = `${LAYOUT_ACTION}/open-commands`,\n OPEN_SETTINGS = `${LAYOUT_ACTION}/open-settings`,\n OPEN_SHORTCUTS = `${LAYOUT_ACTION}/open-shortcuts`,\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 { DotOutline } from '@phosphor-icons/react';\nimport React, { useMemo, useRef } from 'react';\n\nimport { type Action, type Graph, type Label } from '@dxos/app-graph';\nimport { Keyboard, keySymbols } from '@dxos/keyboard';\nimport { Button, Dialog, useTranslation } from '@dxos/react-ui';\nimport { SearchList } from '@dxos/react-ui-searchlist';\nimport { descriptionText, getSize, mx } from '@dxos/react-ui-theme';\n\nexport const CommandsDialogContent = ({ graph }: { graph?: Graph }) => {\n const { t } = useTranslation('os');\n\n // TODO(burdon): Factor out.\n // TODO(burdon): How to access all translations across plugins?\n const toString = (label: Label) => (Array.isArray(label) ? t(...label) : label);\n\n // Traverse graph.\n // TODO(burdon): Factor out commonality with shortcut dialog.\n const actions = useMemo(() => {\n // TODO(burdon): Get from navtree (not keyboard).\n const current = Keyboard.singleton.getCurrentContext();\n const actionMap = new Set<string>();\n const actions: Action[] = [];\n graph?.traverse({\n visitor: (node, path) => {\n if (current.startsWith(path.join('/'))) {\n node.actions.forEach((action) => {\n if (!actionMap.has(action.id)) {\n actionMap.add(action.id);\n actions.push(action);\n }\n });\n }\n },\n });\n\n actions.sort(({ label: a }, { label: b }) => {\n return toString(a)?.toLowerCase().localeCompare(toString(b)?.toLowerCase());\n });\n\n // console.log(JSON.stringify(actions, undefined, 2));\n return actions;\n }, [graph]);\n\n // TODO(burdon): Remove.\n const buttonRef = useRef<HTMLButtonElement>(null);\n\n return (\n <Dialog.Content classNames={['md:max-is-[30rem] overflow-hidden']}>\n <Dialog.Title>{t('commands dialog title', { ns: 'os' })}</Dialog.Title>\n\n {/* TODO(burdon): BUG: Overscrolls container. */}\n <SearchList.Root label={t('commandlist input placeholder')} classNames='flex flex-col grow overflow-hidden my-2'>\n <SearchList.Input placeholder={t('commandlist input placeholder')} classNames={mx('px-1 my-2')} />\n <SearchList.Content classNames={['max-bs-[30rem] overflow-auto']}>\n {actions?.map((action) => {\n const label = toString(action.label);\n const Icon = action.icon ?? DotOutline;\n return (\n <SearchList.Item\n value={label}\n key={action.id}\n onSelect={() => {\n if (action.properties.disabled) {\n return;\n }\n\n // TODO(burdon): Remove hack to close dialog (via hook?)\n buttonRef.current?.click();\n setTimeout(() => {\n void action.invoke();\n });\n }}\n classNames='flex items-center gap-2'\n disabled={action.properties.disabled}\n {...(action.properties?.testId && { 'data-testid': action.properties.testId })}\n >\n <Icon className={mx(getSize(4), 'shrink-0', !action.icon && 'invisible')} />\n <span className='grow truncate'>{label}</span>\n {action.keyBinding && (\n <span className={mx('shrink-0', descriptionText)}>{keySymbols(action.keyBinding).join('')}</span>\n )}\n </SearchList.Item>\n );\n })}\n </SearchList.Content>\n </SearchList.Root>\n\n <Dialog.Close asChild>\n <Button ref={buttonRef} variant='primary' classNames='mbs-2'>\n {t('close label', { ns: 'os' })}\n </Button>\n </Dialog.Close>\n </Dialog.Content>\n );\n};\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport React, { useState } from 'react';\n\nimport { Button, 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): Common treatment for dialogs (e.g., shrink height to fit, mobile, etc.)\n return (\n <Dialog.Content classNames={['h-full 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' autoFocus>\n {t('done label', { ns: 'os' })}\n </Button>\n </Dialog.Close>\n </Dialog.Content>\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": ";;;;;;;;;;;;;;;;;;;;;;AAyBO,IAAMA,mBAAmB,CAACC,WAC9BA,OAAOC,SAAiBC,OAAOC,OAAQH,SAAmCI;AAKtE,IAAMC,0BAA0B,CAACL,WACrCA,OAAOC,SAAiBC,OAAOI,UAAWN,SAA0CI;;;AC5BvF,SAASG,SAAS;AAYX,IAAMC,SAASC,EAAEC,OAAO;EAC7BC,YAAYF,EAAEG,QAAO;EACrBC,aAAaJ,EAAEG,QAAO;EACtBE,0BAA0BL,EAAEG,QAAO;;EAGnCG,YAAYN,EAAEG,QAAO;EACrBI,eAAeP,EAAEQ,IAAG,EAAGC,SAAQ,EAAGC,SAAS,0CAAA;EAE3CC,aAAaX,EAAEG,QAAO;EACtBS,gBAAgBZ,EAAEQ,IAAG,EAAGC,SAAQ,EAAGC,SAAS,2CAAA;EAC5CG,iBAAiBb,EAAEc,OAAM,EAAGL,SAAQ;;EAGpCM,QAAQf,E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AAAG,OAAA,cAACF,SAAAA,MACC,gBAAAE,OAAA,cAACD,MAAAA,IAAAA,CAAAA;AAGP;",
|
|
6
|
-
"names": ["parseGraphPlugin", "plugin", "provides", "graph", "root", "undefined", "parseGraphBuilderPlugin", "builder", "z", "Layout", "z", "object", "fullscreen", "boolean", "sidebarOpen", "complementarySidebarOpen", "dialogOpen", "dialogContent", "any", "optional", "describe", "popoverOpen", "popoverContent", "popoverAnchorId", "string", "active", "previous", "parseLayoutPlugin", "plugin", "success", "safeParse", "provides", "layout", "undefined", "LAYOUT_ACTION", "LayoutAction", "TOGGLE_FULLSCREEN", "TOGGLE_SIDEBAR", "TOGGLE_COMPLEMENTARY_SIDEBAR", "OPEN_DIALOG", "CLOSE_DIALOG", "OPEN_POPOVER", "CLOSE_POPOVER", "ACTIVATE", "
|
|
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
|
+
"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O,UAAUC,SAAAA,QAAAA;;;;;;;;;AACzBF,YAAUN,KAAKO,UAAUE,MAAAA,QAAAA;;;;;;;;;AACzB,QAAMC,UAAUV,KAAKO,SAASC;AAC9B,QAAMG,OAAOX,KAAKO,SAASE;AAE3B,SAAO,MACL,gBAAAG,OAAA,cAACF,SAAAA,MACC,gBAAAE,OAAA,cAACD,MAAAA,IAAAA,CAAAA;AAGP;",
|
|
6
|
+
"names": ["parseGraphPlugin", "plugin", "provides", "graph", "root", "undefined", "parseGraphBuilderPlugin", "builder", "z", "Layout", "z", "object", "fullscreen", "boolean", "sidebarOpen", "complementarySidebarOpen", "dialogOpen", "dialogContent", "any", "optional", "describe", "popoverOpen", "popoverContent", "popoverAnchorId", "string", "active", "previous", "parseLayoutPlugin", "plugin", "success", "safeParse", "provides", "layout", "undefined", "LAYOUT_ACTION", "LayoutAction", "TOGGLE_FULLSCREEN", "TOGGLE_SIDEBAR", "TOGGLE_COMPLEMENTARY_SIDEBAR", "OPEN_DIALOG", "CLOSE_DIALOG", "OPEN_POPOVER", "CLOSE_POPOVER", "ACTIVATE", "parseMetadataRecordsPlugin", "plugin", "provides", "metadata", "records", "undefined", "parseMetadataResolverPlugin", "resolver", "parseSettingsPlugin", "plugin", "provides", "settings", "undefined", "SETTINGS_ACTION", "SettingsAction", "OPEN", "z", "ResourceKey", "z", "union", "string", "record", "any", "ResourceLanguage", "Resource", "parseTranslationsPlugin", "plugin", "success", "array", "safeParse", "provides", "translations", "undefined", "pluginMeta", "meta", "Plugin", "lazy", "p", "props", "then", "default", "definition", "createContext", "useContext", "PluginContext", "createContext", "ready", "enabled", "plugins", "available", "setPlugin", "usePlugins", "useContext", "usePlugin", "id", "findPlugin", "useResolvePlugin", "predicate", "resolvePlugin", "PluginProvider", "Provider", "shallow", "React", "useEffect", "LocalStorageStore", "log", "parsePluginHost", "plugin", "provides", "plugins", "undefined", "PLUGIN_HOST", "PluginHost", "order", "definitions", "core", "defaults", "fallback", "state", "LocalStorageStore", "ready", "enabled", "available", "filter", "id", "includes", "setPlugin", "values", "prop", "$enabled", "json", "meta", "name", "context", "children", "PluginProvider", "value", "root", "useEffect", "log", "timeout", "setTimeout", "enabledIds", "sort", "a", "b", "indexA", "findIndex", "indexB", "Promise", "all", "map", "definition", "Boolean", "initializePlugin", "catch", "err", "console", "error", "then", "pluginDefinition", "shallow", "clearTimeout", "ComposedContext", "composeContext", "rootComponents", "initialize", "Component", "key", "node", "compose", "p", "contexts", "reduce", "Acc", "Next", "isObject", "data", "React", "Component", "ErrorBoundary", "Component", "constructor", "props", "state", "error", "undefined", "getDerivedStateFromError", "componentDidUpdate", "prevProps", "data", "resetError", "render", "React", "this", "fallback", "reset", "children", "setState", "React", "forwardRef", "Fragment", "isValidElement", "createContext", "useContext", "Surface", "forwardRef", "role", "name", "fallback", "rest", "forwardedRef", "props", "context", "useContext", "SurfaceContext", "data", "surfaces", "React", "ErrorBoundary", "SurfaceResolver", "ref", "createContext", "components", "useSurface", "parent", "nodes", "resolveNodes", "currentContext", "Provider", "value", "length", "contentFallback", "Object", "entries", "map", "key", "component", "result", "undefined", "isValidElement", "node", "filter", "Boolean", "sort", "a", "b", "aDisposition", "disposition", "bDisposition", "Fragment", "limit", "slice", "React", "invariant", "createApp", "order", "plugins", "core", "map", "id", "params", "host", "PluginHost", "SurfaceMeta", "IntentMeta", "Plugin", "lazy", "invariant", "provides", "context", "root", "Context", "Root", "React"]
|
|
7
7
|
}
|