@dxos/app-framework 0.3.10-main.5c4230b → 0.3.10-main.5e11230
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 +230 -34
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/node/index.cjs +237 -46
- package/dist/lib/node/index.cjs.map +4 -4
- package/dist/lib/node/meta.json +1 -1
- package/dist/types/src/plugins/PluginHost/PluginContext.d.ts +1 -8
- package/dist/types/src/plugins/PluginHost/PluginContext.d.ts.map +1 -1
- package/dist/types/src/plugins/PluginHost/PluginHost.d.ts.map +1 -1
- package/dist/types/src/plugins/PluginHost/plugin.d.ts +8 -0
- package/dist/types/src/plugins/PluginHost/plugin.d.ts.map +1 -1
- package/dist/types/src/plugins/common/index.d.ts +1 -0
- package/dist/types/src/plugins/common/index.d.ts.map +1 -1
- package/dist/types/src/plugins/common/layout.d.ts +9 -6
- package/dist/types/src/plugins/common/layout.d.ts.map +1 -1
- package/dist/types/src/plugins/common/settings.d.ts +8 -0
- package/dist/types/src/plugins/common/settings.d.ts.map +1 -0
- package/dist/types/src/plugins/components/CommandsDialog.d.ts +5 -0
- package/dist/types/src/plugins/components/CommandsDialog.d.ts.map +1 -0
- package/dist/types/src/plugins/components/SettingsDialog.d.ts +2 -0
- package/dist/types/src/plugins/components/SettingsDialog.d.ts.map +1 -0
- package/dist/types/src/plugins/components/SettingsValue.d.ts +8 -0
- package/dist/types/src/plugins/components/SettingsValue.d.ts.map +1 -0
- package/dist/types/src/plugins/components/index.d.ts +4 -0
- package/dist/types/src/plugins/components/index.d.ts.map +1 -0
- package/dist/types/src/plugins/index.d.ts +1 -0
- package/dist/types/src/plugins/index.d.ts.map +1 -1
- package/package.json +16 -9
- package/src/plugins/PluginHost/PluginContext.tsx +2 -11
- package/src/plugins/PluginHost/PluginHost.tsx +6 -5
- package/src/plugins/PluginHost/plugin.ts +5 -0
- package/src/plugins/common/index.ts +1 -0
- package/src/plugins/common/layout.ts +10 -3
- package/src/plugins/common/settings.ts +16 -0
- package/src/plugins/components/CommandsDialog.tsx +100 -0
- package/src/plugins/components/SettingsDialog.tsx +98 -0
- package/src/plugins/components/SettingsValue.tsx +36 -0
- package/src/plugins/components/index.ts +7 -0
- package/src/plugins/index.ts +1 -0
- package/tsconfig.json +15 -0
package/dist/lib/node/index.cjs
CHANGED
|
@@ -28,6 +28,7 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
28
28
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
29
|
var node_exports = {};
|
|
30
30
|
__export(node_exports, {
|
|
31
|
+
CommandsDialogContent: () => CommandsDialogContent,
|
|
31
32
|
ErrorBoundary: () => ErrorBoundary,
|
|
32
33
|
IntentProvider: () => import_chunk_BOQBLWMX.IntentProvider,
|
|
33
34
|
Layout: () => Layout,
|
|
@@ -38,6 +39,8 @@ __export(node_exports, {
|
|
|
38
39
|
Resource: () => Resource,
|
|
39
40
|
ResourceKey: () => ResourceKey,
|
|
40
41
|
ResourceLanguage: () => ResourceLanguage,
|
|
42
|
+
SettingsDialogContent: () => SettingsDialogContent,
|
|
43
|
+
SettingsValue: () => SettingsValue,
|
|
41
44
|
Surface: () => Surface,
|
|
42
45
|
SurfaceProvider: () => import_chunk_DC3GU6QR.SurfaceProvider,
|
|
43
46
|
createApp: () => createApp,
|
|
@@ -71,15 +74,26 @@ var import_chunk_BOQBLWMX = require("./chunk-BOQBLWMX.cjs");
|
|
|
71
74
|
var import_chunk_VDKZ7AAF = require("./chunk-VDKZ7AAF.cjs");
|
|
72
75
|
var import_zod = require("zod");
|
|
73
76
|
var import_zod2 = require("zod");
|
|
74
|
-
var import_react = require("react");
|
|
75
|
-
var import_react2 = require("
|
|
77
|
+
var import_react = require("@phosphor-icons/react");
|
|
78
|
+
var import_react2 = __toESM(require("react"));
|
|
79
|
+
var import_keyboard = require("@dxos/keyboard");
|
|
80
|
+
var import_react_ui = require("@dxos/react-ui");
|
|
81
|
+
var import_react_ui_searchlist = require("@dxos/react-ui-searchlist");
|
|
82
|
+
var import_react_ui_theme = require("@dxos/react-ui-theme");
|
|
76
83
|
var import_react3 = __toESM(require("react"));
|
|
84
|
+
var import_react_ui2 = require("@dxos/react-ui");
|
|
85
|
+
var import_react_ui_theme2 = require("@dxos/react-ui-theme");
|
|
86
|
+
var import_react4 = require("react");
|
|
87
|
+
var import_react5 = require("deepsignal/react");
|
|
88
|
+
var import_react6 = __toESM(require("react"));
|
|
77
89
|
var import_local_storage = require("@dxos/local-storage");
|
|
78
90
|
var import_log = require("@dxos/log");
|
|
79
|
-
var import_react4 = __toESM(require("react"));
|
|
80
|
-
var import_react5 = __toESM(require("react"));
|
|
81
|
-
var import_react6 = require("react");
|
|
82
91
|
var import_react7 = __toESM(require("react"));
|
|
92
|
+
var import_react8 = __toESM(require("react"));
|
|
93
|
+
var import_react9 = require("react");
|
|
94
|
+
var import_react10 = __toESM(require("react"));
|
|
95
|
+
var import_react_ui3 = require("@dxos/react-ui");
|
|
96
|
+
var import_react11 = __toESM(require("react"));
|
|
83
97
|
var import_invariant = require("@dxos/invariant");
|
|
84
98
|
var parseGraphPlugin = (plugin) => plugin.provides.graph?.root ? plugin : void 0;
|
|
85
99
|
var parseGraphBuilderPlugin = (plugin) => plugin.provides.graph?.builder ? plugin : void 0;
|
|
@@ -87,11 +101,12 @@ var Layout = import_zod.z.object({
|
|
|
87
101
|
fullscreen: import_zod.z.boolean(),
|
|
88
102
|
sidebarOpen: import_zod.z.boolean(),
|
|
89
103
|
complementarySidebarOpen: import_zod.z.boolean(),
|
|
90
|
-
|
|
104
|
+
// TODO(burdon): Why do we have a single root?
|
|
91
105
|
dialogOpen: import_zod.z.boolean(),
|
|
92
|
-
|
|
93
|
-
popoverContent: import_zod.z.any().optional().describe("Data to be passed to the popover Surface."),
|
|
106
|
+
dialogContent: import_zod.z.any().optional().describe("Data to be passed to the dialog Surface."),
|
|
94
107
|
popoverOpen: import_zod.z.boolean(),
|
|
108
|
+
popoverContent: import_zod.z.any().optional().describe("Data to be passed to the popover Surface."),
|
|
109
|
+
popoverAnchorId: import_zod.z.string().optional(),
|
|
95
110
|
// TODO(wittjosiah): Array?
|
|
96
111
|
active: import_zod.z.string().optional().describe("Id of the currently active item."),
|
|
97
112
|
// TODO(wittjosiah): History?
|
|
@@ -112,6 +127,12 @@ var LayoutAction;
|
|
|
112
127
|
LayoutAction2[LayoutAction2["OPEN_POPOVER"] = `${LAYOUT_ACTION}/open-popover`] = "OPEN_POPOVER";
|
|
113
128
|
LayoutAction2[LayoutAction2["CLOSE_POPOVER"] = `${LAYOUT_ACTION}/close-popover`] = "CLOSE_POPOVER";
|
|
114
129
|
LayoutAction2[LayoutAction2["ACTIVATE"] = `${LAYOUT_ACTION}/activate`] = "ACTIVATE";
|
|
130
|
+
LayoutAction2[LayoutAction2[
|
|
131
|
+
// TODO(burdon): Move to new plugin.
|
|
132
|
+
"OPEN_COMMANDS"
|
|
133
|
+
] = `${LAYOUT_ACTION}/open-commands`] = "OPEN_COMMANDS";
|
|
134
|
+
LayoutAction2[LayoutAction2["OPEN_SETTINGS"] = `${LAYOUT_ACTION}/open-settings`] = "OPEN_SETTINGS";
|
|
135
|
+
LayoutAction2[LayoutAction2["OPEN_SHORTCUTS"] = `${LAYOUT_ACTION}/open-shortcuts`] = "OPEN_SHORTCUTS";
|
|
115
136
|
})(LayoutAction || (LayoutAction = {}));
|
|
116
137
|
var parseMetadataRecordsPlugin = (plugin) => {
|
|
117
138
|
return plugin.provides.metadata?.records ? plugin : void 0;
|
|
@@ -129,6 +150,86 @@ var parseTranslationsPlugin = (plugin) => {
|
|
|
129
150
|
const { success } = import_zod2.z.array(Resource).safeParse(plugin.provides.translations);
|
|
130
151
|
return success ? plugin : void 0;
|
|
131
152
|
};
|
|
153
|
+
var CommandsDialogContent = ({ graph }) => {
|
|
154
|
+
const { t } = (0, import_react_ui.useTranslation)("os");
|
|
155
|
+
const toString = (label) => Array.isArray(label) ? t(...label) : label;
|
|
156
|
+
const actions = (0, import_react2.useMemo)(() => {
|
|
157
|
+
const current = import_keyboard.Keyboard.singleton.getCurrentContext();
|
|
158
|
+
const actionMap = /* @__PURE__ */ new Set();
|
|
159
|
+
const actions2 = [];
|
|
160
|
+
graph?.traverse({
|
|
161
|
+
visitor: (node, path) => {
|
|
162
|
+
if (current.startsWith(path.join("/"))) {
|
|
163
|
+
node.actions.forEach((action) => {
|
|
164
|
+
if (!actionMap.has(action.id)) {
|
|
165
|
+
actionMap.add(action.id);
|
|
166
|
+
actions2.push(action);
|
|
167
|
+
}
|
|
168
|
+
});
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
});
|
|
172
|
+
actions2.sort(({ label: a }, { label: b }) => {
|
|
173
|
+
return toString(a)?.toLowerCase().localeCompare(toString(b)?.toLowerCase());
|
|
174
|
+
});
|
|
175
|
+
return actions2;
|
|
176
|
+
}, [
|
|
177
|
+
graph
|
|
178
|
+
]);
|
|
179
|
+
const buttonRef = (0, import_react2.useRef)(null);
|
|
180
|
+
return /* @__PURE__ */ import_react2.default.createElement(import_react_ui.Dialog.Content, {
|
|
181
|
+
classNames: [
|
|
182
|
+
"md:max-is-[30rem] overflow-hidden"
|
|
183
|
+
]
|
|
184
|
+
}, /* @__PURE__ */ import_react2.default.createElement(import_react_ui.Dialog.Title, null, t("commands dialog title", {
|
|
185
|
+
ns: "os"
|
|
186
|
+
})), /* @__PURE__ */ import_react2.default.createElement(import_react_ui_searchlist.SearchList.Root, {
|
|
187
|
+
label: t("commandlist input placeholder"),
|
|
188
|
+
classNames: "flex flex-col grow overflow-hidden my-2"
|
|
189
|
+
}, /* @__PURE__ */ import_react2.default.createElement(import_react_ui_searchlist.SearchList.Input, {
|
|
190
|
+
placeholder: t("commandlist input placeholder"),
|
|
191
|
+
classNames: (0, import_react_ui_theme.mx)("px-1 my-2")
|
|
192
|
+
}), /* @__PURE__ */ import_react2.default.createElement(import_react_ui_searchlist.SearchList.Content, {
|
|
193
|
+
classNames: [
|
|
194
|
+
"max-bs-[30rem] overflow-auto"
|
|
195
|
+
]
|
|
196
|
+
}, actions?.map((action) => {
|
|
197
|
+
const label = toString(action.label);
|
|
198
|
+
const Icon = action.icon ?? import_react.DotOutline;
|
|
199
|
+
return /* @__PURE__ */ import_react2.default.createElement(import_react_ui_searchlist.SearchList.Item, {
|
|
200
|
+
value: label,
|
|
201
|
+
key: action.id,
|
|
202
|
+
onSelect: () => {
|
|
203
|
+
if (action.properties.disabled) {
|
|
204
|
+
return;
|
|
205
|
+
}
|
|
206
|
+
buttonRef.current?.click();
|
|
207
|
+
setTimeout(() => {
|
|
208
|
+
void action.invoke();
|
|
209
|
+
});
|
|
210
|
+
},
|
|
211
|
+
classNames: "flex items-center gap-2",
|
|
212
|
+
disabled: action.properties.disabled,
|
|
213
|
+
...action.properties?.testId && {
|
|
214
|
+
"data-testid": action.properties.testId
|
|
215
|
+
}
|
|
216
|
+
}, /* @__PURE__ */ import_react2.default.createElement(Icon, {
|
|
217
|
+
className: (0, import_react_ui_theme.mx)((0, import_react_ui_theme.getSize)(4), "shrink-0", !action.icon && "invisible")
|
|
218
|
+
}), /* @__PURE__ */ import_react2.default.createElement("span", {
|
|
219
|
+
className: "grow truncate"
|
|
220
|
+
}, label), action.keyBinding && /* @__PURE__ */ import_react2.default.createElement("span", {
|
|
221
|
+
className: (0, import_react_ui_theme.mx)("shrink-0", import_react_ui_theme.descriptionText)
|
|
222
|
+
}, (0, import_keyboard.keySymbols)(action.keyBinding).join("")));
|
|
223
|
+
}))), /* @__PURE__ */ import_react2.default.createElement(import_react_ui.Dialog.Close, {
|
|
224
|
+
asChild: true
|
|
225
|
+
}, /* @__PURE__ */ import_react2.default.createElement(import_react_ui.Button, {
|
|
226
|
+
ref: buttonRef,
|
|
227
|
+
variant: "primary",
|
|
228
|
+
classNames: "mbs-2"
|
|
229
|
+
}, t("close label", {
|
|
230
|
+
ns: "os"
|
|
231
|
+
}))));
|
|
232
|
+
};
|
|
132
233
|
var pluginMeta = (meta) => meta;
|
|
133
234
|
var Plugin;
|
|
134
235
|
(function(Plugin2) {
|
|
@@ -138,17 +239,15 @@ var Plugin;
|
|
|
138
239
|
});
|
|
139
240
|
};
|
|
140
241
|
})(Plugin || (Plugin = {}));
|
|
141
|
-
var PluginContext = /* @__PURE__ */ (0,
|
|
242
|
+
var PluginContext = /* @__PURE__ */ (0, import_react4.createContext)({
|
|
142
243
|
ready: false,
|
|
143
244
|
enabled: [],
|
|
144
245
|
plugins: [],
|
|
145
246
|
available: [],
|
|
146
|
-
|
|
147
|
-
},
|
|
148
|
-
disablePlugin: () => {
|
|
247
|
+
setPlugin: () => {
|
|
149
248
|
}
|
|
150
249
|
});
|
|
151
|
-
var usePlugins = () => (0,
|
|
250
|
+
var usePlugins = () => (0, import_react4.useContext)(PluginContext);
|
|
152
251
|
var usePlugin = (id) => {
|
|
153
252
|
const { plugins } = usePlugins();
|
|
154
253
|
return (0, import_chunk_VDKZ7AAF.findPlugin)(plugins, id);
|
|
@@ -169,14 +268,15 @@ var PluginHost = ({ order, plugins: definitions, core = [], defaults = [], fallb
|
|
|
169
268
|
],
|
|
170
269
|
plugins: [],
|
|
171
270
|
available: order.filter(({ id }) => !core.includes(id)),
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
271
|
+
setPlugin: (id, enabled) => {
|
|
272
|
+
if (enabled) {
|
|
273
|
+
state.values.enabled = [
|
|
274
|
+
...state.values.enabled,
|
|
275
|
+
id
|
|
276
|
+
];
|
|
277
|
+
} else {
|
|
278
|
+
state.values.enabled = state.values.enabled.filter((enabled2) => enabled2 !== id);
|
|
279
|
+
}
|
|
180
280
|
}
|
|
181
281
|
});
|
|
182
282
|
state.prop(state.values.$enabled, "enabled", import_local_storage.LocalStorageStore.json);
|
|
@@ -187,16 +287,16 @@ var PluginHost = ({ order, plugins: definitions, core = [], defaults = [], fallb
|
|
|
187
287
|
},
|
|
188
288
|
provides: {
|
|
189
289
|
plugins: state.values,
|
|
190
|
-
context: ({ children }) => /* @__PURE__ */
|
|
290
|
+
context: ({ children }) => /* @__PURE__ */ import_react6.default.createElement(PluginProvider, {
|
|
191
291
|
value: state.values
|
|
192
292
|
}, children),
|
|
193
293
|
root: () => {
|
|
194
|
-
(0,
|
|
294
|
+
(0, import_react6.useEffect)(() => {
|
|
195
295
|
(0, import_log.log)("initializing plugins", {
|
|
196
296
|
enabled: state.values.enabled
|
|
197
297
|
}, {
|
|
198
298
|
F: __dxlog_file,
|
|
199
|
-
L:
|
|
299
|
+
L: 67,
|
|
200
300
|
S: void 0,
|
|
201
301
|
C: (f, a) => f(...a)
|
|
202
302
|
});
|
|
@@ -221,7 +321,7 @@ var PluginHost = ({ order, plugins: definitions, core = [], defaults = [], fallb
|
|
|
221
321
|
plugins
|
|
222
322
|
}, {
|
|
223
323
|
F: __dxlog_file,
|
|
224
|
-
L:
|
|
324
|
+
L: 92,
|
|
225
325
|
S: void 0,
|
|
226
326
|
C: (f, a) => f(...a)
|
|
227
327
|
});
|
|
@@ -232,11 +332,11 @@ var PluginHost = ({ order, plugins: definitions, core = [], defaults = [], fallb
|
|
|
232
332
|
plugins
|
|
233
333
|
}, {
|
|
234
334
|
F: __dxlog_file,
|
|
235
|
-
L:
|
|
335
|
+
L: 99,
|
|
236
336
|
S: void 0,
|
|
237
337
|
C: (f, a) => f(...a)
|
|
238
338
|
});
|
|
239
|
-
state.values.plugins = (0,
|
|
339
|
+
state.values.plugins = (0, import_react5.shallow)(plugins);
|
|
240
340
|
state.values.ready = true;
|
|
241
341
|
});
|
|
242
342
|
return () => {
|
|
@@ -245,10 +345,10 @@ var PluginHost = ({ order, plugins: definitions, core = [], defaults = [], fallb
|
|
|
245
345
|
};
|
|
246
346
|
}, []);
|
|
247
347
|
if (!state.values.ready) {
|
|
248
|
-
return /* @__PURE__ */
|
|
348
|
+
return /* @__PURE__ */ import_react6.default.createElement(import_react6.default.Fragment, null, fallback);
|
|
249
349
|
}
|
|
250
350
|
const ComposedContext = composeContext(state.values.plugins);
|
|
251
|
-
return /* @__PURE__ */
|
|
351
|
+
return /* @__PURE__ */ import_react6.default.createElement(ComposedContext, null, rootComponents(state.values.plugins));
|
|
252
352
|
}
|
|
253
353
|
}
|
|
254
354
|
};
|
|
@@ -267,7 +367,7 @@ var rootComponents = (plugins) => {
|
|
|
267
367
|
return plugins.map((plugin) => {
|
|
268
368
|
const Component2 = plugin.provides.root;
|
|
269
369
|
if (Component2) {
|
|
270
|
-
return /* @__PURE__ */
|
|
370
|
+
return /* @__PURE__ */ import_react6.default.createElement(Component2, {
|
|
271
371
|
key: plugin.meta.id
|
|
272
372
|
});
|
|
273
373
|
} else {
|
|
@@ -281,10 +381,10 @@ var composeContext = (plugins) => {
|
|
|
281
381
|
var compose = (contexts) => {
|
|
282
382
|
return [
|
|
283
383
|
...contexts
|
|
284
|
-
].reduce((Acc, Next) => ({ children }) => /* @__PURE__ */
|
|
384
|
+
].reduce((Acc, Next) => ({ children }) => /* @__PURE__ */ import_react6.default.createElement(Acc, null, /* @__PURE__ */ import_react6.default.createElement(Next, null, children)));
|
|
285
385
|
};
|
|
286
386
|
var isObject = (data) => !!data && typeof data === "object";
|
|
287
|
-
var ErrorBoundary = class extends
|
|
387
|
+
var ErrorBoundary = class extends import_react7.Component {
|
|
288
388
|
constructor(props) {
|
|
289
389
|
super(props);
|
|
290
390
|
this.state = {
|
|
@@ -303,7 +403,7 @@ var ErrorBoundary = class extends import_react4.Component {
|
|
|
303
403
|
}
|
|
304
404
|
render() {
|
|
305
405
|
if (this.state.error) {
|
|
306
|
-
return /* @__PURE__ */
|
|
406
|
+
return /* @__PURE__ */ import_react7.default.createElement(this.props.fallback, {
|
|
307
407
|
error: this.state.error,
|
|
308
408
|
reset: this.resetError
|
|
309
409
|
});
|
|
@@ -316,30 +416,30 @@ var ErrorBoundary = class extends import_react4.Component {
|
|
|
316
416
|
});
|
|
317
417
|
}
|
|
318
418
|
};
|
|
319
|
-
var Surface = /* @__PURE__ */ (0,
|
|
419
|
+
var Surface = /* @__PURE__ */ (0, import_react8.forwardRef)(({ role, name = role, fallback, ...rest }, forwardedRef) => {
|
|
320
420
|
const props = {
|
|
321
421
|
role,
|
|
322
422
|
name,
|
|
323
423
|
fallback,
|
|
324
424
|
...rest
|
|
325
425
|
};
|
|
326
|
-
const context = (0,
|
|
426
|
+
const context = (0, import_react9.useContext)(SurfaceContext);
|
|
327
427
|
const data = props.data ?? (name && context?.surfaces?.[name]?.data || {});
|
|
328
|
-
return /* @__PURE__ */
|
|
428
|
+
return /* @__PURE__ */ import_react8.default.createElement(import_react8.default.Fragment, null, fallback ? /* @__PURE__ */ import_react8.default.createElement(ErrorBoundary, {
|
|
329
429
|
data,
|
|
330
430
|
fallback
|
|
331
|
-
}, /* @__PURE__ */
|
|
431
|
+
}, /* @__PURE__ */ import_react8.default.createElement(SurfaceResolver, {
|
|
332
432
|
...props,
|
|
333
433
|
ref: forwardedRef
|
|
334
|
-
})) : /* @__PURE__ */
|
|
434
|
+
})) : /* @__PURE__ */ import_react8.default.createElement(SurfaceResolver, {
|
|
335
435
|
...props,
|
|
336
436
|
ref: forwardedRef
|
|
337
437
|
}));
|
|
338
438
|
});
|
|
339
|
-
var SurfaceContext = /* @__PURE__ */ (0,
|
|
340
|
-
var SurfaceResolver = /* @__PURE__ */ (0,
|
|
439
|
+
var SurfaceContext = /* @__PURE__ */ (0, import_react9.createContext)(null);
|
|
440
|
+
var SurfaceResolver = /* @__PURE__ */ (0, import_react8.forwardRef)((props, forwardedRef) => {
|
|
341
441
|
const { components } = (0, import_chunk_DC3GU6QR.useSurface)();
|
|
342
|
-
const parent = (0,
|
|
442
|
+
const parent = (0, import_react9.useContext)(SurfaceContext);
|
|
343
443
|
const nodes = resolveNodes(components, props, parent, forwardedRef);
|
|
344
444
|
const currentContext = {
|
|
345
445
|
...props,
|
|
@@ -348,9 +448,9 @@ var SurfaceResolver = /* @__PURE__ */ (0, import_react5.forwardRef)((props, forw
|
|
|
348
448
|
...props.surfaces
|
|
349
449
|
}
|
|
350
450
|
};
|
|
351
|
-
return /* @__PURE__ */
|
|
451
|
+
return /* @__PURE__ */ import_react8.default.createElement(SurfaceContext.Provider, {
|
|
352
452
|
value: currentContext
|
|
353
|
-
}, nodes.length > 0 ? nodes : props.contentFallback ? /* @__PURE__ */
|
|
453
|
+
}, nodes.length > 0 ? nodes : props.contentFallback ? /* @__PURE__ */ import_react8.default.createElement(props.contentFallback, null) : null);
|
|
354
454
|
});
|
|
355
455
|
var resolveNodes = (components, props, context, forwardedRef) => {
|
|
356
456
|
const data = {
|
|
@@ -368,7 +468,7 @@ var resolveNodes = (components, props, context, forwardedRef) => {
|
|
|
368
468
|
return "node" in result ? [
|
|
369
469
|
key,
|
|
370
470
|
result
|
|
371
|
-
] : /* @__PURE__ */ (0,
|
|
471
|
+
] : /* @__PURE__ */ (0, import_react8.isValidElement)(result) ? [
|
|
372
472
|
key,
|
|
373
473
|
{
|
|
374
474
|
node: result
|
|
@@ -385,11 +485,99 @@ var resolveNodes = (components, props, context, forwardedRef) => {
|
|
|
385
485
|
return 1;
|
|
386
486
|
}
|
|
387
487
|
return 0;
|
|
388
|
-
}).map(([key, result]) => /* @__PURE__ */
|
|
488
|
+
}).map(([key, result]) => /* @__PURE__ */ import_react8.default.createElement(import_react8.Fragment, {
|
|
389
489
|
key
|
|
390
490
|
}, result.node));
|
|
391
491
|
return props.limit ? nodes.slice(0, props.limit) : nodes;
|
|
392
492
|
};
|
|
493
|
+
var SettingsDialogContent = () => {
|
|
494
|
+
const { t } = (0, import_react_ui2.useTranslation)("os");
|
|
495
|
+
const [plugin, setPlugin] = (0, import_react3.useState)("dxos.org/plugin/registry");
|
|
496
|
+
const { plugins, enabled } = usePlugins();
|
|
497
|
+
const core = [
|
|
498
|
+
"dxos.org/plugin/layout",
|
|
499
|
+
"dxos.org/plugin/client",
|
|
500
|
+
"dxos.org/plugin/space",
|
|
501
|
+
"dxos.org/plugin/registry"
|
|
502
|
+
];
|
|
503
|
+
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);
|
|
504
|
+
return /* @__PURE__ */ import_react3.default.createElement(import_react_ui2.Dialog.Content, {
|
|
505
|
+
classNames: [
|
|
506
|
+
"h-full md:max-is-[40rem] overflow-hidden"
|
|
507
|
+
]
|
|
508
|
+
}, /* @__PURE__ */ import_react3.default.createElement(import_react_ui2.Dialog.Title, null, t("settings dialog title", {
|
|
509
|
+
ns: "os"
|
|
510
|
+
})), /* @__PURE__ */ import_react3.default.createElement("div", {
|
|
511
|
+
className: "flex grow mlb-4 overflow-hidden"
|
|
512
|
+
}, /* @__PURE__ */ import_react3.default.createElement("div", {
|
|
513
|
+
className: (0, import_react_ui_theme2.mx)("flex flex-col w-[200px] space-y-4 pr-4 border-r overflow-y-auto", import_react_ui_theme2.groupBorder)
|
|
514
|
+
}, /* @__PURE__ */ import_react3.default.createElement(PluginList, {
|
|
515
|
+
title: "Options",
|
|
516
|
+
plugins: core.map((id) => plugins.find((p) => p.meta.id === id).meta),
|
|
517
|
+
selected: plugin,
|
|
518
|
+
onSelect: (plugin2) => setPlugin(plugin2)
|
|
519
|
+
}), /* @__PURE__ */ import_react3.default.createElement(PluginList, {
|
|
520
|
+
title: "Plugins",
|
|
521
|
+
plugins: filteredPlugins,
|
|
522
|
+
selected: plugin,
|
|
523
|
+
onSelect: (plugin2) => setPlugin(plugin2)
|
|
524
|
+
})), /* @__PURE__ */ import_react3.default.createElement("div", {
|
|
525
|
+
className: (0, import_react_ui_theme2.mx)("flex flex-col w-full md:px-4 divide-y overflow-y-auto", import_react_ui_theme2.groupBorder)
|
|
526
|
+
}, /* @__PURE__ */ import_react3.default.createElement(Surface, {
|
|
527
|
+
role: "settings",
|
|
528
|
+
data: {
|
|
529
|
+
plugin
|
|
530
|
+
}
|
|
531
|
+
}))), /* @__PURE__ */ import_react3.default.createElement(import_react_ui2.Dialog.Close, {
|
|
532
|
+
asChild: true
|
|
533
|
+
}, /* @__PURE__ */ import_react3.default.createElement(import_react_ui2.Button, {
|
|
534
|
+
variant: "primary",
|
|
535
|
+
classNames: "mbs-2",
|
|
536
|
+
autoFocus: true
|
|
537
|
+
}, t("done label", {
|
|
538
|
+
ns: "os"
|
|
539
|
+
}))));
|
|
540
|
+
};
|
|
541
|
+
var PluginList = ({ title, plugins, selected, onSelect }) => {
|
|
542
|
+
return /* @__PURE__ */ import_react3.default.createElement("div", {
|
|
543
|
+
role: "none"
|
|
544
|
+
}, /* @__PURE__ */ import_react3.default.createElement("h2", {
|
|
545
|
+
className: "my-1 px-2 text-sm text-neutral-500"
|
|
546
|
+
}, title), /* @__PURE__ */ import_react3.default.createElement(import_react_ui2.List, {
|
|
547
|
+
selectable: true
|
|
548
|
+
}, plugins.map((plugin) => /* @__PURE__ */ import_react3.default.createElement(import_react_ui2.ListItem.Root, {
|
|
549
|
+
key: plugin.id,
|
|
550
|
+
onClick: () => onSelect(plugin.id),
|
|
551
|
+
selected: plugin.id === selected,
|
|
552
|
+
classNames: [
|
|
553
|
+
"px-2 rounded",
|
|
554
|
+
plugin.id === selected && import_react_ui_theme2.ghostSelected,
|
|
555
|
+
import_react_ui_theme2.ghostHover
|
|
556
|
+
]
|
|
557
|
+
}, /* @__PURE__ */ import_react3.default.createElement(import_react_ui2.ListItem.Heading, {
|
|
558
|
+
classNames: [
|
|
559
|
+
"flex w-full items-center cursor-pointer"
|
|
560
|
+
]
|
|
561
|
+
}, plugin.name)))));
|
|
562
|
+
};
|
|
563
|
+
var SettingsValue = ({ label, description, children }) => {
|
|
564
|
+
return /* @__PURE__ */ import_react10.default.createElement("div", {
|
|
565
|
+
role: "none",
|
|
566
|
+
className: "flex w-full gap-4 py-1"
|
|
567
|
+
}, /* @__PURE__ */ import_react10.default.createElement(import_react_ui3.Input.Root, null, /* @__PURE__ */ import_react10.default.createElement("div", {
|
|
568
|
+
role: "none",
|
|
569
|
+
className: "flex flex-col w-full"
|
|
570
|
+
}, /* @__PURE__ */ import_react10.default.createElement(import_react_ui3.Input.Label, {
|
|
571
|
+
classNames: "flex min-h-[40px] items-center"
|
|
572
|
+
}, label), description && /* @__PURE__ */ import_react10.default.createElement(import_react_ui3.Input.DescriptionAndValidation, {
|
|
573
|
+
classNames: "mbs-0.5"
|
|
574
|
+
}, /* @__PURE__ */ import_react10.default.createElement(import_react_ui3.Input.Description, null, description))), /* @__PURE__ */ import_react10.default.createElement("div", {
|
|
575
|
+
role: "none"
|
|
576
|
+
}, /* @__PURE__ */ import_react10.default.createElement("div", {
|
|
577
|
+
role: "none",
|
|
578
|
+
className: "flex min-h-[40px] items-center"
|
|
579
|
+
}, children))));
|
|
580
|
+
};
|
|
393
581
|
var __dxlog_file2 = "/home/runner/work/dxos/dxos/packages/sdk/app-framework/src/App.tsx";
|
|
394
582
|
var createApp = ({ order, plugins, core = order.map(({ id }) => id), ...params }) => {
|
|
395
583
|
const host = PluginHost({
|
|
@@ -430,10 +618,11 @@ var createApp = ({ order, plugins, core = order.map(({ id }) => id), ...params }
|
|
|
430
618
|
});
|
|
431
619
|
const Context = host.provides.context;
|
|
432
620
|
const Root = host.provides.root;
|
|
433
|
-
return () => /* @__PURE__ */
|
|
621
|
+
return () => /* @__PURE__ */ import_react11.default.createElement(Context, null, /* @__PURE__ */ import_react11.default.createElement(Root, null));
|
|
434
622
|
};
|
|
435
623
|
// Annotate the CommonJS export names for ESM import in node:
|
|
436
624
|
0 && (module.exports = {
|
|
625
|
+
CommandsDialogContent,
|
|
437
626
|
ErrorBoundary,
|
|
438
627
|
IntentProvider,
|
|
439
628
|
Layout,
|
|
@@ -444,6 +633,8 @@ var createApp = ({ order, plugins, core = order.map(({ id }) => id), ...params }
|
|
|
444
633
|
Resource,
|
|
445
634
|
ResourceKey,
|
|
446
635
|
ResourceLanguage,
|
|
636
|
+
SettingsDialogContent,
|
|
637
|
+
SettingsValue,
|
|
447
638
|
Surface,
|
|
448
639
|
SurfaceProvider,
|
|
449
640
|
createApp,
|