@dxos/app-framework 0.3.10-main.90b298e → 0.3.10-main.c5193cc
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 +276 -34
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/node/index.cjs +282 -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 +100 -0
- package/src/plugins/components/SettingsDialog.tsx +98 -0
- package/src/plugins/components/SettingsValue.tsx +36 -0
- package/src/plugins/components/ShortcutsDialog.tsx +65 -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,86 @@ 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 toString = (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
|
+
actions2.sort(({ label: a }, { label: b }) => {
|
|
178
|
+
return toString(a)?.toLowerCase().localeCompare(toString(b)?.toLowerCase());
|
|
179
|
+
});
|
|
180
|
+
return actions2;
|
|
181
|
+
}, [
|
|
182
|
+
graph
|
|
183
|
+
]);
|
|
184
|
+
const buttonRef = (0, import_react2.useRef)(null);
|
|
185
|
+
return /* @__PURE__ */ import_react2.default.createElement(import_react_ui.Dialog.Content, {
|
|
186
|
+
classNames: [
|
|
187
|
+
"md:max-is-[30rem] overflow-hidden"
|
|
188
|
+
]
|
|
189
|
+
}, /* @__PURE__ */ import_react2.default.createElement(import_react_ui.Dialog.Title, null, t("commands dialog title", {
|
|
190
|
+
ns: "os"
|
|
191
|
+
})), /* @__PURE__ */ import_react2.default.createElement(import_react_ui_searchlist.SearchList.Root, {
|
|
192
|
+
label: t("commandlist input placeholder"),
|
|
193
|
+
classNames: "flex flex-col grow overflow-hidden my-2"
|
|
194
|
+
}, /* @__PURE__ */ import_react2.default.createElement(import_react_ui_searchlist.SearchList.Input, {
|
|
195
|
+
placeholder: t("commandlist input placeholder"),
|
|
196
|
+
classNames: (0, import_react_ui_theme.mx)("px-1 my-2")
|
|
197
|
+
}), /* @__PURE__ */ import_react2.default.createElement(import_react_ui_searchlist.SearchList.Content, {
|
|
198
|
+
classNames: [
|
|
199
|
+
"max-bs-[30rem] overflow-auto"
|
|
200
|
+
]
|
|
201
|
+
}, actions?.map((action) => {
|
|
202
|
+
const label = toString(action.label);
|
|
203
|
+
const Icon = action.icon ?? import_react.DotOutline;
|
|
204
|
+
return /* @__PURE__ */ import_react2.default.createElement(import_react_ui_searchlist.SearchList.Item, {
|
|
205
|
+
value: label,
|
|
206
|
+
key: action.id,
|
|
207
|
+
onSelect: () => {
|
|
208
|
+
if (action.properties.disabled) {
|
|
209
|
+
return;
|
|
210
|
+
}
|
|
211
|
+
buttonRef.current?.click();
|
|
212
|
+
setTimeout(() => {
|
|
213
|
+
void action.invoke();
|
|
214
|
+
});
|
|
215
|
+
},
|
|
216
|
+
classNames: "flex items-center gap-2",
|
|
217
|
+
disabled: action.properties.disabled,
|
|
218
|
+
...action.properties?.testId && {
|
|
219
|
+
"data-testid": action.properties.testId
|
|
220
|
+
}
|
|
221
|
+
}, /* @__PURE__ */ import_react2.default.createElement(Icon, {
|
|
222
|
+
className: (0, import_react_ui_theme.mx)((0, import_react_ui_theme.getSize)(4), "shrink-0", !action.icon && "invisible")
|
|
223
|
+
}), /* @__PURE__ */ import_react2.default.createElement("span", {
|
|
224
|
+
className: "grow truncate"
|
|
225
|
+
}, label), action.keyBinding && /* @__PURE__ */ import_react2.default.createElement("span", {
|
|
226
|
+
className: (0, import_react_ui_theme.mx)("shrink-0", import_react_ui_theme.descriptionText)
|
|
227
|
+
}, (0, import_keyboard.keySymbols)(action.keyBinding).join("")));
|
|
228
|
+
}))), /* @__PURE__ */ import_react2.default.createElement(import_react_ui.Dialog.Close, {
|
|
229
|
+
asChild: true
|
|
230
|
+
}, /* @__PURE__ */ import_react2.default.createElement(import_react_ui.Button, {
|
|
231
|
+
ref: buttonRef,
|
|
232
|
+
variant: "primary",
|
|
233
|
+
classNames: "mbs-2"
|
|
234
|
+
}, t("close label", {
|
|
235
|
+
ns: "os"
|
|
236
|
+
}))));
|
|
237
|
+
};
|
|
132
238
|
var pluginMeta = (meta) => meta;
|
|
133
239
|
var Plugin;
|
|
134
240
|
(function(Plugin2) {
|
|
@@ -138,17 +244,15 @@ var Plugin;
|
|
|
138
244
|
});
|
|
139
245
|
};
|
|
140
246
|
})(Plugin || (Plugin = {}));
|
|
141
|
-
var PluginContext = /* @__PURE__ */ (0,
|
|
247
|
+
var PluginContext = /* @__PURE__ */ (0, import_react4.createContext)({
|
|
142
248
|
ready: false,
|
|
143
249
|
enabled: [],
|
|
144
250
|
plugins: [],
|
|
145
251
|
available: [],
|
|
146
|
-
|
|
147
|
-
},
|
|
148
|
-
disablePlugin: () => {
|
|
252
|
+
setPlugin: () => {
|
|
149
253
|
}
|
|
150
254
|
});
|
|
151
|
-
var usePlugins = () => (0,
|
|
255
|
+
var usePlugins = () => (0, import_react4.useContext)(PluginContext);
|
|
152
256
|
var usePlugin = (id) => {
|
|
153
257
|
const { plugins } = usePlugins();
|
|
154
258
|
return (0, import_chunk_VDKZ7AAF.findPlugin)(plugins, id);
|
|
@@ -169,14 +273,15 @@ var PluginHost = ({ order, plugins: definitions, core = [], defaults = [], fallb
|
|
|
169
273
|
],
|
|
170
274
|
plugins: [],
|
|
171
275
|
available: order.filter(({ id }) => !core.includes(id)),
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
276
|
+
setPlugin: (id, enabled) => {
|
|
277
|
+
if (enabled) {
|
|
278
|
+
state.values.enabled = [
|
|
279
|
+
...state.values.enabled,
|
|
280
|
+
id
|
|
281
|
+
];
|
|
282
|
+
} else {
|
|
283
|
+
state.values.enabled = state.values.enabled.filter((enabled2) => enabled2 !== id);
|
|
284
|
+
}
|
|
180
285
|
}
|
|
181
286
|
});
|
|
182
287
|
state.prop(state.values.$enabled, "enabled", import_local_storage.LocalStorageStore.json);
|
|
@@ -187,16 +292,16 @@ var PluginHost = ({ order, plugins: definitions, core = [], defaults = [], fallb
|
|
|
187
292
|
},
|
|
188
293
|
provides: {
|
|
189
294
|
plugins: state.values,
|
|
190
|
-
context: ({ children }) => /* @__PURE__ */
|
|
295
|
+
context: ({ children }) => /* @__PURE__ */ import_react6.default.createElement(PluginProvider, {
|
|
191
296
|
value: state.values
|
|
192
297
|
}, children),
|
|
193
298
|
root: () => {
|
|
194
|
-
(0,
|
|
299
|
+
(0, import_react6.useEffect)(() => {
|
|
195
300
|
(0, import_log.log)("initializing plugins", {
|
|
196
301
|
enabled: state.values.enabled
|
|
197
302
|
}, {
|
|
198
303
|
F: __dxlog_file,
|
|
199
|
-
L:
|
|
304
|
+
L: 67,
|
|
200
305
|
S: void 0,
|
|
201
306
|
C: (f, a) => f(...a)
|
|
202
307
|
});
|
|
@@ -221,7 +326,7 @@ var PluginHost = ({ order, plugins: definitions, core = [], defaults = [], fallb
|
|
|
221
326
|
plugins
|
|
222
327
|
}, {
|
|
223
328
|
F: __dxlog_file,
|
|
224
|
-
L:
|
|
329
|
+
L: 92,
|
|
225
330
|
S: void 0,
|
|
226
331
|
C: (f, a) => f(...a)
|
|
227
332
|
});
|
|
@@ -232,11 +337,11 @@ var PluginHost = ({ order, plugins: definitions, core = [], defaults = [], fallb
|
|
|
232
337
|
plugins
|
|
233
338
|
}, {
|
|
234
339
|
F: __dxlog_file,
|
|
235
|
-
L:
|
|
340
|
+
L: 99,
|
|
236
341
|
S: void 0,
|
|
237
342
|
C: (f, a) => f(...a)
|
|
238
343
|
});
|
|
239
|
-
state.values.plugins = (0,
|
|
344
|
+
state.values.plugins = (0, import_react5.shallow)(plugins);
|
|
240
345
|
state.values.ready = true;
|
|
241
346
|
});
|
|
242
347
|
return () => {
|
|
@@ -245,10 +350,10 @@ var PluginHost = ({ order, plugins: definitions, core = [], defaults = [], fallb
|
|
|
245
350
|
};
|
|
246
351
|
}, []);
|
|
247
352
|
if (!state.values.ready) {
|
|
248
|
-
return /* @__PURE__ */
|
|
353
|
+
return /* @__PURE__ */ import_react6.default.createElement(import_react6.default.Fragment, null, fallback);
|
|
249
354
|
}
|
|
250
355
|
const ComposedContext = composeContext(state.values.plugins);
|
|
251
|
-
return /* @__PURE__ */
|
|
356
|
+
return /* @__PURE__ */ import_react6.default.createElement(ComposedContext, null, rootComponents(state.values.plugins));
|
|
252
357
|
}
|
|
253
358
|
}
|
|
254
359
|
};
|
|
@@ -267,7 +372,7 @@ var rootComponents = (plugins) => {
|
|
|
267
372
|
return plugins.map((plugin) => {
|
|
268
373
|
const Component2 = plugin.provides.root;
|
|
269
374
|
if (Component2) {
|
|
270
|
-
return /* @__PURE__ */
|
|
375
|
+
return /* @__PURE__ */ import_react6.default.createElement(Component2, {
|
|
271
376
|
key: plugin.meta.id
|
|
272
377
|
});
|
|
273
378
|
} else {
|
|
@@ -281,10 +386,10 @@ var composeContext = (plugins) => {
|
|
|
281
386
|
var compose = (contexts) => {
|
|
282
387
|
return [
|
|
283
388
|
...contexts
|
|
284
|
-
].reduce((Acc, Next) => ({ children }) => /* @__PURE__ */
|
|
389
|
+
].reduce((Acc, Next) => ({ children }) => /* @__PURE__ */ import_react6.default.createElement(Acc, null, /* @__PURE__ */ import_react6.default.createElement(Next, null, children)));
|
|
285
390
|
};
|
|
286
391
|
var isObject = (data) => !!data && typeof data === "object";
|
|
287
|
-
var ErrorBoundary = class extends
|
|
392
|
+
var ErrorBoundary = class extends import_react7.Component {
|
|
288
393
|
constructor(props) {
|
|
289
394
|
super(props);
|
|
290
395
|
this.state = {
|
|
@@ -303,7 +408,7 @@ var ErrorBoundary = class extends import_react4.Component {
|
|
|
303
408
|
}
|
|
304
409
|
render() {
|
|
305
410
|
if (this.state.error) {
|
|
306
|
-
return /* @__PURE__ */
|
|
411
|
+
return /* @__PURE__ */ import_react7.default.createElement(this.props.fallback, {
|
|
307
412
|
error: this.state.error,
|
|
308
413
|
reset: this.resetError
|
|
309
414
|
});
|
|
@@ -316,30 +421,30 @@ var ErrorBoundary = class extends import_react4.Component {
|
|
|
316
421
|
});
|
|
317
422
|
}
|
|
318
423
|
};
|
|
319
|
-
var Surface = /* @__PURE__ */ (0,
|
|
424
|
+
var Surface = /* @__PURE__ */ (0, import_react8.forwardRef)(({ role, name = role, fallback, ...rest }, forwardedRef) => {
|
|
320
425
|
const props = {
|
|
321
426
|
role,
|
|
322
427
|
name,
|
|
323
428
|
fallback,
|
|
324
429
|
...rest
|
|
325
430
|
};
|
|
326
|
-
const context = (0,
|
|
431
|
+
const context = (0, import_react9.useContext)(SurfaceContext);
|
|
327
432
|
const data = props.data ?? (name && context?.surfaces?.[name]?.data || {});
|
|
328
|
-
return /* @__PURE__ */
|
|
433
|
+
return /* @__PURE__ */ import_react8.default.createElement(import_react8.default.Fragment, null, fallback ? /* @__PURE__ */ import_react8.default.createElement(ErrorBoundary, {
|
|
329
434
|
data,
|
|
330
435
|
fallback
|
|
331
|
-
}, /* @__PURE__ */
|
|
436
|
+
}, /* @__PURE__ */ import_react8.default.createElement(SurfaceResolver, {
|
|
332
437
|
...props,
|
|
333
438
|
ref: forwardedRef
|
|
334
|
-
})) : /* @__PURE__ */
|
|
439
|
+
})) : /* @__PURE__ */ import_react8.default.createElement(SurfaceResolver, {
|
|
335
440
|
...props,
|
|
336
441
|
ref: forwardedRef
|
|
337
442
|
}));
|
|
338
443
|
});
|
|
339
|
-
var SurfaceContext = /* @__PURE__ */ (0,
|
|
340
|
-
var SurfaceResolver = /* @__PURE__ */ (0,
|
|
444
|
+
var SurfaceContext = /* @__PURE__ */ (0, import_react9.createContext)(null);
|
|
445
|
+
var SurfaceResolver = /* @__PURE__ */ (0, import_react8.forwardRef)((props, forwardedRef) => {
|
|
341
446
|
const { components } = (0, import_chunk_DC3GU6QR.useSurface)();
|
|
342
|
-
const parent = (0,
|
|
447
|
+
const parent = (0, import_react9.useContext)(SurfaceContext);
|
|
343
448
|
const nodes = resolveNodes(components, props, parent, forwardedRef);
|
|
344
449
|
const currentContext = {
|
|
345
450
|
...props,
|
|
@@ -348,9 +453,9 @@ var SurfaceResolver = /* @__PURE__ */ (0, import_react5.forwardRef)((props, forw
|
|
|
348
453
|
...props.surfaces
|
|
349
454
|
}
|
|
350
455
|
};
|
|
351
|
-
return /* @__PURE__ */
|
|
456
|
+
return /* @__PURE__ */ import_react8.default.createElement(SurfaceContext.Provider, {
|
|
352
457
|
value: currentContext
|
|
353
|
-
}, nodes.length > 0 ? nodes : props.contentFallback ? /* @__PURE__ */
|
|
458
|
+
}, nodes.length > 0 ? nodes : props.contentFallback ? /* @__PURE__ */ import_react8.default.createElement(props.contentFallback, null) : null);
|
|
354
459
|
});
|
|
355
460
|
var resolveNodes = (components, props, context, forwardedRef) => {
|
|
356
461
|
const data = {
|
|
@@ -368,7 +473,7 @@ var resolveNodes = (components, props, context, forwardedRef) => {
|
|
|
368
473
|
return "node" in result ? [
|
|
369
474
|
key,
|
|
370
475
|
result
|
|
371
|
-
] : /* @__PURE__ */ (0,
|
|
476
|
+
] : /* @__PURE__ */ (0, import_react8.isValidElement)(result) ? [
|
|
372
477
|
key,
|
|
373
478
|
{
|
|
374
479
|
node: result
|
|
@@ -385,11 +490,138 @@ var resolveNodes = (components, props, context, forwardedRef) => {
|
|
|
385
490
|
return 1;
|
|
386
491
|
}
|
|
387
492
|
return 0;
|
|
388
|
-
}).map(([key, result]) => /* @__PURE__ */
|
|
493
|
+
}).map(([key, result]) => /* @__PURE__ */ import_react8.default.createElement(import_react8.Fragment, {
|
|
389
494
|
key
|
|
390
495
|
}, result.node));
|
|
391
496
|
return props.limit ? nodes.slice(0, props.limit) : nodes;
|
|
392
497
|
};
|
|
498
|
+
var SettingsDialogContent = () => {
|
|
499
|
+
const { t } = (0, import_react_ui2.useTranslation)("os");
|
|
500
|
+
const [plugin, setPlugin] = (0, import_react3.useState)("dxos.org/plugin/registry");
|
|
501
|
+
const { plugins, enabled } = usePlugins();
|
|
502
|
+
const core = [
|
|
503
|
+
"dxos.org/plugin/layout",
|
|
504
|
+
"dxos.org/plugin/client",
|
|
505
|
+
"dxos.org/plugin/space",
|
|
506
|
+
"dxos.org/plugin/registry"
|
|
507
|
+
];
|
|
508
|
+
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);
|
|
509
|
+
return /* @__PURE__ */ import_react3.default.createElement(import_react_ui2.Dialog.Content, {
|
|
510
|
+
classNames: [
|
|
511
|
+
"h-full md:max-is-[40rem] overflow-hidden"
|
|
512
|
+
]
|
|
513
|
+
}, /* @__PURE__ */ import_react3.default.createElement(import_react_ui2.Dialog.Title, null, t("settings dialog title", {
|
|
514
|
+
ns: "os"
|
|
515
|
+
})), /* @__PURE__ */ import_react3.default.createElement("div", {
|
|
516
|
+
className: "flex grow mlb-4 overflow-hidden"
|
|
517
|
+
}, /* @__PURE__ */ import_react3.default.createElement("div", {
|
|
518
|
+
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)
|
|
519
|
+
}, /* @__PURE__ */ import_react3.default.createElement(PluginList, {
|
|
520
|
+
title: "Options",
|
|
521
|
+
plugins: core.map((id) => plugins.find((p) => p.meta.id === id).meta),
|
|
522
|
+
selected: plugin,
|
|
523
|
+
onSelect: (plugin2) => setPlugin(plugin2)
|
|
524
|
+
}), /* @__PURE__ */ import_react3.default.createElement(PluginList, {
|
|
525
|
+
title: "Plugins",
|
|
526
|
+
plugins: filteredPlugins,
|
|
527
|
+
selected: plugin,
|
|
528
|
+
onSelect: (plugin2) => setPlugin(plugin2)
|
|
529
|
+
})), /* @__PURE__ */ import_react3.default.createElement("div", {
|
|
530
|
+
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)
|
|
531
|
+
}, /* @__PURE__ */ import_react3.default.createElement(Surface, {
|
|
532
|
+
role: "settings",
|
|
533
|
+
data: {
|
|
534
|
+
plugin
|
|
535
|
+
}
|
|
536
|
+
}))), /* @__PURE__ */ import_react3.default.createElement(import_react_ui2.Dialog.Close, {
|
|
537
|
+
asChild: true
|
|
538
|
+
}, /* @__PURE__ */ import_react3.default.createElement(import_react_ui2.Button, {
|
|
539
|
+
variant: "primary",
|
|
540
|
+
classNames: "mbs-2",
|
|
541
|
+
autoFocus: true
|
|
542
|
+
}, t("done label", {
|
|
543
|
+
ns: "os"
|
|
544
|
+
}))));
|
|
545
|
+
};
|
|
546
|
+
var PluginList = ({ title, plugins, selected, onSelect }) => {
|
|
547
|
+
return /* @__PURE__ */ import_react3.default.createElement("div", {
|
|
548
|
+
role: "none"
|
|
549
|
+
}, /* @__PURE__ */ import_react3.default.createElement("h2", {
|
|
550
|
+
className: "my-1 px-2 text-sm text-neutral-500"
|
|
551
|
+
}, title), /* @__PURE__ */ import_react3.default.createElement(import_react_ui2.List, {
|
|
552
|
+
selectable: true
|
|
553
|
+
}, plugins.map((plugin) => /* @__PURE__ */ import_react3.default.createElement(import_react_ui2.ListItem.Root, {
|
|
554
|
+
key: plugin.id,
|
|
555
|
+
onClick: () => onSelect(plugin.id),
|
|
556
|
+
selected: plugin.id === selected,
|
|
557
|
+
classNames: [
|
|
558
|
+
"px-2 rounded",
|
|
559
|
+
plugin.id === selected && import_react_ui_theme2.ghostSelected,
|
|
560
|
+
import_react_ui_theme2.ghostHover
|
|
561
|
+
]
|
|
562
|
+
}, /* @__PURE__ */ import_react3.default.createElement(import_react_ui2.ListItem.Heading, {
|
|
563
|
+
classNames: [
|
|
564
|
+
"flex w-full items-center cursor-pointer"
|
|
565
|
+
]
|
|
566
|
+
}, plugin.name)))));
|
|
567
|
+
};
|
|
568
|
+
var SettingsValue = ({ label, description, children }) => {
|
|
569
|
+
return /* @__PURE__ */ import_react10.default.createElement("div", {
|
|
570
|
+
role: "none",
|
|
571
|
+
className: "flex w-full gap-4 py-1"
|
|
572
|
+
}, /* @__PURE__ */ import_react10.default.createElement(import_react_ui3.Input.Root, null, /* @__PURE__ */ import_react10.default.createElement("div", {
|
|
573
|
+
role: "none",
|
|
574
|
+
className: "flex flex-col w-full"
|
|
575
|
+
}, /* @__PURE__ */ import_react10.default.createElement(import_react_ui3.Input.Label, {
|
|
576
|
+
classNames: "flex min-h-[40px] items-center"
|
|
577
|
+
}, label), description && /* @__PURE__ */ import_react10.default.createElement(import_react_ui3.Input.DescriptionAndValidation, {
|
|
578
|
+
classNames: "mbs-0.5"
|
|
579
|
+
}, /* @__PURE__ */ import_react10.default.createElement(import_react_ui3.Input.Description, null, description))), /* @__PURE__ */ import_react10.default.createElement("div", {
|
|
580
|
+
role: "none"
|
|
581
|
+
}, /* @__PURE__ */ import_react10.default.createElement("div", {
|
|
582
|
+
role: "none",
|
|
583
|
+
className: "flex min-h-[40px] items-center"
|
|
584
|
+
}, children))));
|
|
585
|
+
};
|
|
586
|
+
var ShortcutsDialogContent = () => {
|
|
587
|
+
const { t } = (0, import_react_ui4.useTranslation)("os");
|
|
588
|
+
const toString = (label) => Array.isArray(label) ? t(...label) : label;
|
|
589
|
+
const bindings = import_keyboard2.Keyboard.singleton.getBindings();
|
|
590
|
+
bindings.sort((a, b) => {
|
|
591
|
+
return toString(a.data)?.toLowerCase().localeCompare(toString(b.data)?.toLowerCase());
|
|
592
|
+
});
|
|
593
|
+
return /* @__PURE__ */ import_react11.default.createElement(import_react_ui4.Dialog.Content, {
|
|
594
|
+
classNames: [
|
|
595
|
+
"max-bs-[40rem] md:max-is-[30rem] overflow-hidden"
|
|
596
|
+
]
|
|
597
|
+
}, /* @__PURE__ */ import_react11.default.createElement(import_react_ui4.Dialog.Title, null, t("shortcuts dialog title", {
|
|
598
|
+
ns: "os"
|
|
599
|
+
})), /* @__PURE__ */ import_react11.default.createElement("div", {
|
|
600
|
+
className: "grow overflow-y-auto py-2"
|
|
601
|
+
}, /* @__PURE__ */ import_react11.default.createElement("table", {
|
|
602
|
+
className: "table-fixed border-collapse my-4"
|
|
603
|
+
}, /* @__PURE__ */ import_react11.default.createElement("tbody", null, bindings.map((binding, i) => /* @__PURE__ */ import_react11.default.createElement("tr", {
|
|
604
|
+
key: i
|
|
605
|
+
}, /* @__PURE__ */ import_react11.default.createElement("td", {
|
|
606
|
+
className: "p-1 w-[120px]"
|
|
607
|
+
}, /* @__PURE__ */ import_react11.default.createElement("div", {
|
|
608
|
+
className: "flex gap-1"
|
|
609
|
+
}, (0, import_keyboard2.keySymbols)(binding.binding).map((c, i2) => /* @__PURE__ */ import_react11.default.createElement("span", {
|
|
610
|
+
key: i2,
|
|
611
|
+
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")
|
|
612
|
+
}, c)))), /* @__PURE__ */ import_react11.default.createElement("td", {
|
|
613
|
+
className: "p-1"
|
|
614
|
+
}, /* @__PURE__ */ import_react11.default.createElement("span", {
|
|
615
|
+
className: "grow truncate"
|
|
616
|
+
}, toString(binding.data)))))))), /* @__PURE__ */ import_react11.default.createElement(import_react_ui4.Dialog.Close, {
|
|
617
|
+
asChild: true
|
|
618
|
+
}, /* @__PURE__ */ import_react11.default.createElement(import_react_ui4.Button, {
|
|
619
|
+
variant: "primary",
|
|
620
|
+
classNames: "mbs-2"
|
|
621
|
+
}, t("close label", {
|
|
622
|
+
ns: "os"
|
|
623
|
+
}))));
|
|
624
|
+
};
|
|
393
625
|
var __dxlog_file2 = "/home/runner/work/dxos/dxos/packages/sdk/app-framework/src/App.tsx";
|
|
394
626
|
var createApp = ({ order, plugins, core = order.map(({ id }) => id), ...params }) => {
|
|
395
627
|
const host = PluginHost({
|
|
@@ -430,10 +662,11 @@ var createApp = ({ order, plugins, core = order.map(({ id }) => id), ...params }
|
|
|
430
662
|
});
|
|
431
663
|
const Context = host.provides.context;
|
|
432
664
|
const Root = host.provides.root;
|
|
433
|
-
return () => /* @__PURE__ */
|
|
665
|
+
return () => /* @__PURE__ */ import_react12.default.createElement(Context, null, /* @__PURE__ */ import_react12.default.createElement(Root, null));
|
|
434
666
|
};
|
|
435
667
|
// Annotate the CommonJS export names for ESM import in node:
|
|
436
668
|
0 && (module.exports = {
|
|
669
|
+
CommandsDialogContent,
|
|
437
670
|
ErrorBoundary,
|
|
438
671
|
IntentProvider,
|
|
439
672
|
Layout,
|
|
@@ -444,6 +677,9 @@ var createApp = ({ order, plugins, core = order.map(({ id }) => id), ...params }
|
|
|
444
677
|
Resource,
|
|
445
678
|
ResourceKey,
|
|
446
679
|
ResourceLanguage,
|
|
680
|
+
SettingsDialogContent,
|
|
681
|
+
SettingsValue,
|
|
682
|
+
ShortcutsDialogContent,
|
|
447
683
|
Surface,
|
|
448
684
|
SurfaceProvider,
|
|
449
685
|
createApp,
|