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