@dxos/app-framework 0.3.10-main.6ba804d → 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
|
@@ -29,11 +29,12 @@ var Layout = z.object({
|
|
|
29
29
|
fullscreen: z.boolean(),
|
|
30
30
|
sidebarOpen: z.boolean(),
|
|
31
31
|
complementarySidebarOpen: z.boolean(),
|
|
32
|
-
|
|
32
|
+
// TODO(burdon): Why do we have a single root?
|
|
33
33
|
dialogOpen: z.boolean(),
|
|
34
|
-
|
|
35
|
-
popoverContent: z.any().optional().describe("Data to be passed to the popover Surface."),
|
|
34
|
+
dialogContent: z.any().optional().describe("Data to be passed to the dialog Surface."),
|
|
36
35
|
popoverOpen: z.boolean(),
|
|
36
|
+
popoverContent: z.any().optional().describe("Data to be passed to the popover Surface."),
|
|
37
|
+
popoverAnchorId: z.string().optional(),
|
|
37
38
|
// TODO(wittjosiah): Array?
|
|
38
39
|
active: z.string().optional().describe("Id of the currently active item."),
|
|
39
40
|
// TODO(wittjosiah): History?
|
|
@@ -54,6 +55,12 @@ var LayoutAction;
|
|
|
54
55
|
LayoutAction2[LayoutAction2["OPEN_POPOVER"] = `${LAYOUT_ACTION}/open-popover`] = "OPEN_POPOVER";
|
|
55
56
|
LayoutAction2[LayoutAction2["CLOSE_POPOVER"] = `${LAYOUT_ACTION}/close-popover`] = "CLOSE_POPOVER";
|
|
56
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";
|
|
57
64
|
})(LayoutAction || (LayoutAction = {}));
|
|
58
65
|
|
|
59
66
|
// packages/sdk/app-framework/src/plugins/common/metadata.ts
|
|
@@ -77,6 +84,96 @@ var parseTranslationsPlugin = (plugin) => {
|
|
|
77
84
|
return success ? plugin : void 0;
|
|
78
85
|
};
|
|
79
86
|
|
|
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 getLabel = (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
|
+
return actions2;
|
|
114
|
+
}, [
|
|
115
|
+
graph
|
|
116
|
+
]);
|
|
117
|
+
const buttonRef = useRef(null);
|
|
118
|
+
return /* @__PURE__ */ React.createElement(Dialog.Content, {
|
|
119
|
+
classNames: [
|
|
120
|
+
"h-[50%] md:max-is-[30rem] overflow-hidden"
|
|
121
|
+
]
|
|
122
|
+
}, /* @__PURE__ */ React.createElement(Dialog.Title, null, t("commands dialog title", {
|
|
123
|
+
ns: "os"
|
|
124
|
+
})), /* @__PURE__ */ React.createElement(SearchList.Root, {
|
|
125
|
+
label: t("commandlist input placeholder"),
|
|
126
|
+
classNames: "flex flex-col grow overflow-hidden my-2"
|
|
127
|
+
}, /* @__PURE__ */ React.createElement(SearchList.Input, {
|
|
128
|
+
placeholder: t("commandlist input placeholder"),
|
|
129
|
+
classNames: mx("px-3 my-2")
|
|
130
|
+
}), /* @__PURE__ */ React.createElement(SearchList.Content, {
|
|
131
|
+
classNames: [
|
|
132
|
+
"min-bs-[12rem] bs-[50dvh] max-bs-[20rem] overflow-auto"
|
|
133
|
+
]
|
|
134
|
+
}, actions?.map((action) => {
|
|
135
|
+
const label = getLabel(action.label);
|
|
136
|
+
const Icon = action.icon ?? DotOutline;
|
|
137
|
+
return /* @__PURE__ */ React.createElement(SearchList.Item, {
|
|
138
|
+
value: label,
|
|
139
|
+
key: action.id,
|
|
140
|
+
onSelect: () => {
|
|
141
|
+
if (action.properties.disabled) {
|
|
142
|
+
return;
|
|
143
|
+
}
|
|
144
|
+
buttonRef.current?.click();
|
|
145
|
+
setTimeout(() => {
|
|
146
|
+
void action.invoke();
|
|
147
|
+
});
|
|
148
|
+
},
|
|
149
|
+
classNames: "flex items-center gap-2 pli-2",
|
|
150
|
+
disabled: action.properties.disabled,
|
|
151
|
+
...action.properties?.testId && {
|
|
152
|
+
"data-testid": action.properties.testId
|
|
153
|
+
}
|
|
154
|
+
}, /* @__PURE__ */ React.createElement(Icon, {
|
|
155
|
+
className: mx(getSize(4), "shrink-0", !action.icon && "invisible")
|
|
156
|
+
}), /* @__PURE__ */ React.createElement("span", {
|
|
157
|
+
className: "grow truncate"
|
|
158
|
+
}, label), action.keyBinding && /* @__PURE__ */ React.createElement("span", {
|
|
159
|
+
className: mx("shrink-0", descriptionText)
|
|
160
|
+
}, keySymbols(action.keyBinding).join("")));
|
|
161
|
+
}))), /* @__PURE__ */ React.createElement(Dialog.Close, {
|
|
162
|
+
asChild: true
|
|
163
|
+
}, /* @__PURE__ */ React.createElement(Button, {
|
|
164
|
+
ref: buttonRef,
|
|
165
|
+
variant: "primary",
|
|
166
|
+
classNames: "mbs-2"
|
|
167
|
+
}, t("close label", {
|
|
168
|
+
ns: "os"
|
|
169
|
+
}))));
|
|
170
|
+
};
|
|
171
|
+
|
|
172
|
+
// packages/sdk/app-framework/src/plugins/components/SettingsDialog.tsx
|
|
173
|
+
import React5, { useState } from "react";
|
|
174
|
+
import { Button as Button2, Dialog as Dialog2, List, ListItem, useTranslation as useTranslation2 } from "@dxos/react-ui";
|
|
175
|
+
import { ghostHover, ghostSelected, groupBorder, mx as mx2 } from "@dxos/react-ui-theme";
|
|
176
|
+
|
|
80
177
|
// packages/sdk/app-framework/src/plugins/PluginHost/plugin.ts
|
|
81
178
|
var pluginMeta = (meta) => meta;
|
|
82
179
|
var Plugin;
|
|
@@ -95,9 +192,7 @@ var PluginContext = /* @__PURE__ */ createContext({
|
|
|
95
192
|
enabled: [],
|
|
96
193
|
plugins: [],
|
|
97
194
|
available: [],
|
|
98
|
-
|
|
99
|
-
},
|
|
100
|
-
disablePlugin: () => {
|
|
195
|
+
setPlugin: () => {
|
|
101
196
|
}
|
|
102
197
|
});
|
|
103
198
|
var usePlugins = () => useContext(PluginContext);
|
|
@@ -113,7 +208,7 @@ var PluginProvider = PluginContext.Provider;
|
|
|
113
208
|
|
|
114
209
|
// packages/sdk/app-framework/src/plugins/PluginHost/PluginHost.tsx
|
|
115
210
|
import { shallow } from "deepsignal/react";
|
|
116
|
-
import
|
|
211
|
+
import React2, { useEffect } from "react";
|
|
117
212
|
import { LocalStorageStore } from "@dxos/local-storage";
|
|
118
213
|
import { log } from "@dxos/log";
|
|
119
214
|
var __dxlog_file = "/home/runner/work/dxos/dxos/packages/sdk/app-framework/src/plugins/PluginHost/PluginHost.tsx";
|
|
@@ -127,14 +222,15 @@ var PluginHost = ({ order, plugins: definitions, core = [], defaults = [], fallb
|
|
|
127
222
|
],
|
|
128
223
|
plugins: [],
|
|
129
224
|
available: order.filter(({ id }) => !core.includes(id)),
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
225
|
+
setPlugin: (id, enabled) => {
|
|
226
|
+
if (enabled) {
|
|
227
|
+
state.values.enabled = [
|
|
228
|
+
...state.values.enabled,
|
|
229
|
+
id
|
|
230
|
+
];
|
|
231
|
+
} else {
|
|
232
|
+
state.values.enabled = state.values.enabled.filter((enabled2) => enabled2 !== id);
|
|
233
|
+
}
|
|
138
234
|
}
|
|
139
235
|
});
|
|
140
236
|
state.prop(state.values.$enabled, "enabled", LocalStorageStore.json);
|
|
@@ -145,7 +241,7 @@ var PluginHost = ({ order, plugins: definitions, core = [], defaults = [], fallb
|
|
|
145
241
|
},
|
|
146
242
|
provides: {
|
|
147
243
|
plugins: state.values,
|
|
148
|
-
context: ({ children }) => /* @__PURE__ */
|
|
244
|
+
context: ({ children }) => /* @__PURE__ */ React2.createElement(PluginProvider, {
|
|
149
245
|
value: state.values
|
|
150
246
|
}, children),
|
|
151
247
|
root: () => {
|
|
@@ -154,7 +250,7 @@ var PluginHost = ({ order, plugins: definitions, core = [], defaults = [], fallb
|
|
|
154
250
|
enabled: state.values.enabled
|
|
155
251
|
}, {
|
|
156
252
|
F: __dxlog_file,
|
|
157
|
-
L:
|
|
253
|
+
L: 67,
|
|
158
254
|
S: void 0,
|
|
159
255
|
C: (f, a) => f(...a)
|
|
160
256
|
});
|
|
@@ -179,7 +275,7 @@ var PluginHost = ({ order, plugins: definitions, core = [], defaults = [], fallb
|
|
|
179
275
|
plugins
|
|
180
276
|
}, {
|
|
181
277
|
F: __dxlog_file,
|
|
182
|
-
L:
|
|
278
|
+
L: 92,
|
|
183
279
|
S: void 0,
|
|
184
280
|
C: (f, a) => f(...a)
|
|
185
281
|
});
|
|
@@ -190,7 +286,7 @@ var PluginHost = ({ order, plugins: definitions, core = [], defaults = [], fallb
|
|
|
190
286
|
plugins
|
|
191
287
|
}, {
|
|
192
288
|
F: __dxlog_file,
|
|
193
|
-
L:
|
|
289
|
+
L: 99,
|
|
194
290
|
S: void 0,
|
|
195
291
|
C: (f, a) => f(...a)
|
|
196
292
|
});
|
|
@@ -203,10 +299,10 @@ var PluginHost = ({ order, plugins: definitions, core = [], defaults = [], fallb
|
|
|
203
299
|
};
|
|
204
300
|
}, []);
|
|
205
301
|
if (!state.values.ready) {
|
|
206
|
-
return /* @__PURE__ */
|
|
302
|
+
return /* @__PURE__ */ React2.createElement(React2.Fragment, null, fallback);
|
|
207
303
|
}
|
|
208
304
|
const ComposedContext = composeContext(state.values.plugins);
|
|
209
|
-
return /* @__PURE__ */
|
|
305
|
+
return /* @__PURE__ */ React2.createElement(ComposedContext, null, rootComponents(state.values.plugins));
|
|
210
306
|
}
|
|
211
307
|
}
|
|
212
308
|
};
|
|
@@ -225,7 +321,7 @@ var rootComponents = (plugins) => {
|
|
|
225
321
|
return plugins.map((plugin) => {
|
|
226
322
|
const Component2 = plugin.provides.root;
|
|
227
323
|
if (Component2) {
|
|
228
|
-
return /* @__PURE__ */
|
|
324
|
+
return /* @__PURE__ */ React2.createElement(Component2, {
|
|
229
325
|
key: plugin.meta.id
|
|
230
326
|
});
|
|
231
327
|
} else {
|
|
@@ -239,14 +335,14 @@ var composeContext = (plugins) => {
|
|
|
239
335
|
var compose = (contexts) => {
|
|
240
336
|
return [
|
|
241
337
|
...contexts
|
|
242
|
-
].reduce((Acc, Next) => ({ children }) => /* @__PURE__ */
|
|
338
|
+
].reduce((Acc, Next) => ({ children }) => /* @__PURE__ */ React2.createElement(Acc, null, /* @__PURE__ */ React2.createElement(Next, null, children)));
|
|
243
339
|
};
|
|
244
340
|
|
|
245
341
|
// packages/sdk/app-framework/src/plugins/SurfacePlugin/helpers.ts
|
|
246
342
|
var isObject = (data) => !!data && typeof data === "object";
|
|
247
343
|
|
|
248
344
|
// packages/sdk/app-framework/src/plugins/SurfacePlugin/ErrorBoundary.tsx
|
|
249
|
-
import
|
|
345
|
+
import React3, { Component } from "react";
|
|
250
346
|
var ErrorBoundary = class extends Component {
|
|
251
347
|
constructor(props) {
|
|
252
348
|
super(props);
|
|
@@ -266,7 +362,7 @@ var ErrorBoundary = class extends Component {
|
|
|
266
362
|
}
|
|
267
363
|
render() {
|
|
268
364
|
if (this.state.error) {
|
|
269
|
-
return /* @__PURE__ */
|
|
365
|
+
return /* @__PURE__ */ React3.createElement(this.props.fallback, {
|
|
270
366
|
error: this.state.error,
|
|
271
367
|
reset: this.resetError
|
|
272
368
|
});
|
|
@@ -281,7 +377,7 @@ var ErrorBoundary = class extends Component {
|
|
|
281
377
|
};
|
|
282
378
|
|
|
283
379
|
// packages/sdk/app-framework/src/plugins/SurfacePlugin/Surface.tsx
|
|
284
|
-
import
|
|
380
|
+
import React4, { forwardRef, Fragment, isValidElement } from "react";
|
|
285
381
|
import { createContext as createContext2, useContext as useContext2 } from "react";
|
|
286
382
|
var Surface = /* @__PURE__ */ forwardRef(({ role, name = role, fallback, ...rest }, forwardedRef) => {
|
|
287
383
|
const props = {
|
|
@@ -292,13 +388,13 @@ var Surface = /* @__PURE__ */ forwardRef(({ role, name = role, fallback, ...rest
|
|
|
292
388
|
};
|
|
293
389
|
const context = useContext2(SurfaceContext);
|
|
294
390
|
const data = props.data ?? (name && context?.surfaces?.[name]?.data || {});
|
|
295
|
-
return /* @__PURE__ */
|
|
391
|
+
return /* @__PURE__ */ React4.createElement(React4.Fragment, null, fallback ? /* @__PURE__ */ React4.createElement(ErrorBoundary, {
|
|
296
392
|
data,
|
|
297
393
|
fallback
|
|
298
|
-
}, /* @__PURE__ */
|
|
394
|
+
}, /* @__PURE__ */ React4.createElement(SurfaceResolver, {
|
|
299
395
|
...props,
|
|
300
396
|
ref: forwardedRef
|
|
301
|
-
})) : /* @__PURE__ */
|
|
397
|
+
})) : /* @__PURE__ */ React4.createElement(SurfaceResolver, {
|
|
302
398
|
...props,
|
|
303
399
|
ref: forwardedRef
|
|
304
400
|
}));
|
|
@@ -315,9 +411,9 @@ var SurfaceResolver = /* @__PURE__ */ forwardRef((props, forwardedRef) => {
|
|
|
315
411
|
...props.surfaces
|
|
316
412
|
}
|
|
317
413
|
};
|
|
318
|
-
return /* @__PURE__ */
|
|
414
|
+
return /* @__PURE__ */ React4.createElement(SurfaceContext.Provider, {
|
|
319
415
|
value: currentContext
|
|
320
|
-
}, nodes.length > 0 ? nodes : props.contentFallback ? /* @__PURE__ */
|
|
416
|
+
}, nodes.length > 0 ? nodes : props.contentFallback ? /* @__PURE__ */ React4.createElement(props.contentFallback, null) : null);
|
|
321
417
|
});
|
|
322
418
|
var resolveNodes = (components, props, context, forwardedRef) => {
|
|
323
419
|
const data = {
|
|
@@ -352,14 +448,147 @@ var resolveNodes = (components, props, context, forwardedRef) => {
|
|
|
352
448
|
return 1;
|
|
353
449
|
}
|
|
354
450
|
return 0;
|
|
355
|
-
}).map(([key, result]) => /* @__PURE__ */
|
|
451
|
+
}).map(([key, result]) => /* @__PURE__ */ React4.createElement(Fragment, {
|
|
356
452
|
key
|
|
357
453
|
}, result.node));
|
|
358
454
|
return props.limit ? nodes.slice(0, props.limit) : nodes;
|
|
359
455
|
};
|
|
360
456
|
|
|
457
|
+
// packages/sdk/app-framework/src/plugins/components/SettingsDialog.tsx
|
|
458
|
+
var SettingsDialogContent = () => {
|
|
459
|
+
const { t } = useTranslation2("os");
|
|
460
|
+
const [plugin, setPlugin] = useState("dxos.org/plugin/registry");
|
|
461
|
+
const { plugins, enabled } = usePlugins();
|
|
462
|
+
const core = [
|
|
463
|
+
"dxos.org/plugin/layout",
|
|
464
|
+
"dxos.org/plugin/client",
|
|
465
|
+
"dxos.org/plugin/space",
|
|
466
|
+
"dxos.org/plugin/registry"
|
|
467
|
+
];
|
|
468
|
+
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);
|
|
469
|
+
return /* @__PURE__ */ React5.createElement(Dialog2.Content, {
|
|
470
|
+
classNames: [
|
|
471
|
+
"h-[90%] md:max-is-[40rem] overflow-hidden"
|
|
472
|
+
]
|
|
473
|
+
}, /* @__PURE__ */ React5.createElement(Dialog2.Title, null, t("settings dialog title", {
|
|
474
|
+
ns: "os"
|
|
475
|
+
})), /* @__PURE__ */ React5.createElement("div", {
|
|
476
|
+
className: "flex grow mlb-4 overflow-hidden"
|
|
477
|
+
}, /* @__PURE__ */ React5.createElement("div", {
|
|
478
|
+
className: mx2("flex flex-col w-[200px] space-y-4 pr-4 border-r overflow-y-auto", groupBorder)
|
|
479
|
+
}, /* @__PURE__ */ React5.createElement(PluginList, {
|
|
480
|
+
title: "Options",
|
|
481
|
+
plugins: core.map((id) => plugins.find((p) => p.meta.id === id).meta),
|
|
482
|
+
selected: plugin,
|
|
483
|
+
onSelect: (plugin2) => setPlugin(plugin2)
|
|
484
|
+
}), /* @__PURE__ */ React5.createElement(PluginList, {
|
|
485
|
+
title: "Plugins",
|
|
486
|
+
plugins: filteredPlugins,
|
|
487
|
+
selected: plugin,
|
|
488
|
+
onSelect: (plugin2) => setPlugin(plugin2)
|
|
489
|
+
})), /* @__PURE__ */ React5.createElement("div", {
|
|
490
|
+
className: mx2("flex flex-col w-full md:px-4 divide-y overflow-y-auto", groupBorder)
|
|
491
|
+
}, /* @__PURE__ */ React5.createElement(Surface, {
|
|
492
|
+
role: "settings",
|
|
493
|
+
data: {
|
|
494
|
+
plugin
|
|
495
|
+
}
|
|
496
|
+
}))), /* @__PURE__ */ React5.createElement(Dialog2.Close, {
|
|
497
|
+
asChild: true
|
|
498
|
+
}, /* @__PURE__ */ React5.createElement(Button2, {
|
|
499
|
+
variant: "primary",
|
|
500
|
+
classNames: "mbs-2"
|
|
501
|
+
}, t("done label", {
|
|
502
|
+
ns: "os"
|
|
503
|
+
}))));
|
|
504
|
+
};
|
|
505
|
+
var PluginList = ({ title, plugins, selected, onSelect }) => {
|
|
506
|
+
return /* @__PURE__ */ React5.createElement("div", {
|
|
507
|
+
role: "none"
|
|
508
|
+
}, /* @__PURE__ */ React5.createElement("h2", {
|
|
509
|
+
className: "my-1 px-2 text-sm text-neutral-500"
|
|
510
|
+
}, title), /* @__PURE__ */ React5.createElement(List, {
|
|
511
|
+
selectable: true
|
|
512
|
+
}, plugins.map((plugin) => /* @__PURE__ */ React5.createElement(ListItem.Root, {
|
|
513
|
+
key: plugin.id,
|
|
514
|
+
onClick: () => onSelect(plugin.id),
|
|
515
|
+
selected: plugin.id === selected,
|
|
516
|
+
classNames: [
|
|
517
|
+
"px-2 rounded",
|
|
518
|
+
plugin.id === selected && ghostSelected,
|
|
519
|
+
ghostHover
|
|
520
|
+
]
|
|
521
|
+
}, /* @__PURE__ */ React5.createElement(ListItem.Heading, {
|
|
522
|
+
classNames: [
|
|
523
|
+
"flex w-full items-center cursor-pointer"
|
|
524
|
+
]
|
|
525
|
+
}, plugin.name)))));
|
|
526
|
+
};
|
|
527
|
+
|
|
528
|
+
// packages/sdk/app-framework/src/plugins/components/SettingsValue.tsx
|
|
529
|
+
import React6 from "react";
|
|
530
|
+
import { Input } from "@dxos/react-ui";
|
|
531
|
+
var SettingsValue = ({ label, description, children }) => {
|
|
532
|
+
return /* @__PURE__ */ React6.createElement("div", {
|
|
533
|
+
role: "none",
|
|
534
|
+
className: "flex w-full gap-4 py-1"
|
|
535
|
+
}, /* @__PURE__ */ React6.createElement(Input.Root, null, /* @__PURE__ */ React6.createElement("div", {
|
|
536
|
+
role: "none",
|
|
537
|
+
className: "flex flex-col w-full"
|
|
538
|
+
}, /* @__PURE__ */ React6.createElement(Input.Label, {
|
|
539
|
+
classNames: "flex min-h-[40px] items-center"
|
|
540
|
+
}, label), description && /* @__PURE__ */ React6.createElement(Input.DescriptionAndValidation, {
|
|
541
|
+
classNames: "mbs-0.5"
|
|
542
|
+
}, /* @__PURE__ */ React6.createElement(Input.Description, null, description))), /* @__PURE__ */ React6.createElement("div", {
|
|
543
|
+
role: "none"
|
|
544
|
+
}, /* @__PURE__ */ React6.createElement("div", {
|
|
545
|
+
role: "none",
|
|
546
|
+
className: "flex min-h-[40px] items-center"
|
|
547
|
+
}, children))));
|
|
548
|
+
};
|
|
549
|
+
|
|
550
|
+
// packages/sdk/app-framework/src/plugins/components/ShortcutsDialog.tsx
|
|
551
|
+
import React7 from "react";
|
|
552
|
+
import { Keyboard as Keyboard2, keySymbols as keySymbols2 } from "@dxos/keyboard";
|
|
553
|
+
import { Button as Button3, Dialog as Dialog3, useTranslation as useTranslation3 } from "@dxos/react-ui";
|
|
554
|
+
import { mx as mx3 } from "@dxos/react-ui-theme";
|
|
555
|
+
var ShortcutsDialogContent = () => {
|
|
556
|
+
const { t } = useTranslation3("os");
|
|
557
|
+
const bindings = Keyboard2.singleton.getBindings();
|
|
558
|
+
const getLabel = (label) => Array.isArray(label) ? t(...label) : label;
|
|
559
|
+
return /* @__PURE__ */ React7.createElement(Dialog3.Content, {
|
|
560
|
+
classNames: [
|
|
561
|
+
"md:max-is-[30rem] overflow-hidden"
|
|
562
|
+
]
|
|
563
|
+
}, /* @__PURE__ */ React7.createElement(Dialog3.Title, null, t("shortcuts dialog title", {
|
|
564
|
+
ns: "os"
|
|
565
|
+
})), /* @__PURE__ */ React7.createElement("table", {
|
|
566
|
+
className: "table-fixed border-collapse my-4"
|
|
567
|
+
}, /* @__PURE__ */ React7.createElement("tbody", null, bindings.map((binding, i) => /* @__PURE__ */ React7.createElement("tr", {
|
|
568
|
+
key: i
|
|
569
|
+
}, /* @__PURE__ */ React7.createElement("td", {
|
|
570
|
+
className: "p-1 w-[120px]"
|
|
571
|
+
}, /* @__PURE__ */ React7.createElement("div", {
|
|
572
|
+
className: "flex gap-1"
|
|
573
|
+
}, keySymbols2(binding.binding).map((c, i2) => /* @__PURE__ */ React7.createElement("span", {
|
|
574
|
+
key: i2,
|
|
575
|
+
className: mx3("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")
|
|
576
|
+
}, c)))), /* @__PURE__ */ React7.createElement("td", {
|
|
577
|
+
className: "p-1"
|
|
578
|
+
}, /* @__PURE__ */ React7.createElement("span", {
|
|
579
|
+
className: "grow truncate"
|
|
580
|
+
}, getLabel(binding.data))))))), /* @__PURE__ */ React7.createElement(Dialog3.Close, {
|
|
581
|
+
asChild: true
|
|
582
|
+
}, /* @__PURE__ */ React7.createElement(Button3, {
|
|
583
|
+
variant: "primary",
|
|
584
|
+
classNames: "mbs-2"
|
|
585
|
+
}, t("close label", {
|
|
586
|
+
ns: "os"
|
|
587
|
+
}))));
|
|
588
|
+
};
|
|
589
|
+
|
|
361
590
|
// packages/sdk/app-framework/src/App.tsx
|
|
362
|
-
import
|
|
591
|
+
import React8 from "react";
|
|
363
592
|
import { invariant } from "@dxos/invariant";
|
|
364
593
|
var __dxlog_file2 = "/home/runner/work/dxos/dxos/packages/sdk/app-framework/src/App.tsx";
|
|
365
594
|
var createApp = ({ order, plugins, core = order.map(({ id }) => id), ...params }) => {
|
|
@@ -401,9 +630,10 @@ var createApp = ({ order, plugins, core = order.map(({ id }) => id), ...params }
|
|
|
401
630
|
});
|
|
402
631
|
const Context = host.provides.context;
|
|
403
632
|
const Root = host.provides.root;
|
|
404
|
-
return () => /* @__PURE__ */
|
|
633
|
+
return () => /* @__PURE__ */ React8.createElement(Context, null, /* @__PURE__ */ React8.createElement(Root, null));
|
|
405
634
|
};
|
|
406
635
|
export {
|
|
636
|
+
CommandsDialogContent,
|
|
407
637
|
ErrorBoundary,
|
|
408
638
|
IntentProvider,
|
|
409
639
|
Layout,
|
|
@@ -414,6 +644,9 @@ export {
|
|
|
414
644
|
Resource,
|
|
415
645
|
ResourceKey,
|
|
416
646
|
ResourceLanguage,
|
|
647
|
+
SettingsDialogContent,
|
|
648
|
+
SettingsValue,
|
|
649
|
+
ShortcutsDialogContent,
|
|
417
650
|
Surface,
|
|
418
651
|
SurfaceProvider,
|
|
419
652
|
createApp,
|