@dxos/app-framework 0.3.10-main.92d1f2c → 0.3.10-main.a0865c9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/lib/browser/index.mjs +30 -260
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/node/index.cjs +42 -266
- package/dist/lib/node/index.cjs.map +4 -4
- package/dist/lib/node/meta.json +1 -1
- package/dist/types/src/plugins/common/layout.d.ts +8 -11
- package/dist/types/src/plugins/common/layout.d.ts.map +1 -1
- package/dist/types/src/plugins/common/settings.d.ts +6 -5
- package/dist/types/src/plugins/common/settings.d.ts.map +1 -1
- package/dist/types/src/plugins/index.d.ts +0 -1
- package/dist/types/src/plugins/index.d.ts.map +1 -1
- package/package.json +9 -16
- package/src/plugins/common/layout.ts +1 -6
- package/src/plugins/common/settings.ts +11 -5
- package/src/plugins/index.ts +0 -1
- package/tsconfig.json +0 -15
- package/dist/types/src/plugins/components/CommandsDialog.d.ts +0 -5
- package/dist/types/src/plugins/components/CommandsDialog.d.ts.map +0 -1
- package/dist/types/src/plugins/components/SettingsDialog.d.ts +0 -2
- package/dist/types/src/plugins/components/SettingsDialog.d.ts.map +0 -1
- package/dist/types/src/plugins/components/SettingsValue.d.ts +0 -8
- package/dist/types/src/plugins/components/SettingsValue.d.ts.map +0 -1
- package/dist/types/src/plugins/components/ShortcutsDialog.d.ts +0 -2
- package/dist/types/src/plugins/components/ShortcutsDialog.d.ts.map +0 -1
- package/dist/types/src/plugins/components/index.d.ts +0 -5
- package/dist/types/src/plugins/components/index.d.ts.map +0 -1
- package/src/plugins/components/CommandsDialog.tsx +0 -100
- package/src/plugins/components/SettingsDialog.tsx +0 -98
- package/src/plugins/components/SettingsValue.tsx +0 -36
- package/src/plugins/components/ShortcutsDialog.tsx +0 -65
- package/src/plugins/components/index.ts +0 -8
package/dist/lib/node/index.cjs
CHANGED
|
@@ -28,7 +28,6 @@ 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,
|
|
32
31
|
ErrorBoundary: () => ErrorBoundary,
|
|
33
32
|
IntentProvider: () => import_chunk_BOQBLWMX.IntentProvider,
|
|
34
33
|
Layout: () => Layout,
|
|
@@ -39,9 +38,7 @@ __export(node_exports, {
|
|
|
39
38
|
Resource: () => Resource,
|
|
40
39
|
ResourceKey: () => ResourceKey,
|
|
41
40
|
ResourceLanguage: () => ResourceLanguage,
|
|
42
|
-
|
|
43
|
-
SettingsValue: () => SettingsValue,
|
|
44
|
-
ShortcutsDialogContent: () => ShortcutsDialogContent,
|
|
41
|
+
SettingsAction: () => SettingsAction,
|
|
45
42
|
Surface: () => Surface,
|
|
46
43
|
SurfaceProvider: () => import_chunk_DC3GU6QR.SurfaceProvider,
|
|
47
44
|
createApp: () => createApp,
|
|
@@ -59,6 +56,7 @@ __export(node_exports, {
|
|
|
59
56
|
parseMetadataResolverPlugin: () => parseMetadataResolverPlugin,
|
|
60
57
|
parsePluginHost: () => parsePluginHost,
|
|
61
58
|
parseRootSurfacePlugin: () => import_chunk_DC3GU6QR.parseRootSurfacePlugin,
|
|
59
|
+
parseSettingsPlugin: () => parseSettingsPlugin,
|
|
62
60
|
parseSurfacePlugin: () => import_chunk_DC3GU6QR.parseSurfacePlugin,
|
|
63
61
|
parseTranslationsPlugin: () => parseTranslationsPlugin,
|
|
64
62
|
pluginMeta: () => pluginMeta,
|
|
@@ -75,30 +73,15 @@ var import_chunk_BOQBLWMX = require("./chunk-BOQBLWMX.cjs");
|
|
|
75
73
|
var import_chunk_VDKZ7AAF = require("./chunk-VDKZ7AAF.cjs");
|
|
76
74
|
var import_zod = require("zod");
|
|
77
75
|
var import_zod2 = require("zod");
|
|
78
|
-
var import_react = require("
|
|
79
|
-
var import_react2 =
|
|
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
|
+
var import_react = require("react");
|
|
77
|
+
var import_react2 = require("deepsignal/react");
|
|
84
78
|
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"));
|
|
90
79
|
var import_local_storage = require("@dxos/local-storage");
|
|
91
80
|
var import_log = require("@dxos/log");
|
|
81
|
+
var import_react4 = __toESM(require("react"));
|
|
82
|
+
var import_react5 = __toESM(require("react"));
|
|
83
|
+
var import_react6 = require("react");
|
|
92
84
|
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"));
|
|
102
85
|
var import_invariant = require("@dxos/invariant");
|
|
103
86
|
var parseGraphPlugin = (plugin) => plugin.provides.graph?.root ? plugin : void 0;
|
|
104
87
|
var parseGraphBuilderPlugin = (plugin) => plugin.provides.graph?.builder ? plugin : void 0;
|
|
@@ -121,7 +104,7 @@ var parseLayoutPlugin = (plugin) => {
|
|
|
121
104
|
const { success } = Layout.safeParse(plugin.provides.layout);
|
|
122
105
|
return success ? plugin : void 0;
|
|
123
106
|
};
|
|
124
|
-
var LAYOUT_ACTION = "dxos.org/plugin/
|
|
107
|
+
var LAYOUT_ACTION = "dxos.org/plugin/layout";
|
|
125
108
|
var LayoutAction;
|
|
126
109
|
(function(LayoutAction2) {
|
|
127
110
|
LayoutAction2[LayoutAction2["TOGGLE_FULLSCREEN"] = `${LAYOUT_ACTION}/toggle-fullscreen`] = "TOGGLE_FULLSCREEN";
|
|
@@ -132,12 +115,6 @@ var LayoutAction;
|
|
|
132
115
|
LayoutAction2[LayoutAction2["OPEN_POPOVER"] = `${LAYOUT_ACTION}/open-popover`] = "OPEN_POPOVER";
|
|
133
116
|
LayoutAction2[LayoutAction2["CLOSE_POPOVER"] = `${LAYOUT_ACTION}/close-popover`] = "CLOSE_POPOVER";
|
|
134
117
|
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";
|
|
141
118
|
})(LayoutAction || (LayoutAction = {}));
|
|
142
119
|
var parseMetadataRecordsPlugin = (plugin) => {
|
|
143
120
|
return plugin.provides.metadata?.records ? plugin : void 0;
|
|
@@ -145,6 +122,14 @@ var parseMetadataRecordsPlugin = (plugin) => {
|
|
|
145
122
|
var parseMetadataResolverPlugin = (plugin) => {
|
|
146
123
|
return plugin.provides.metadata?.resolver ? plugin : void 0;
|
|
147
124
|
};
|
|
125
|
+
var parseSettingsPlugin = (plugin) => {
|
|
126
|
+
return typeof plugin.provides.settings === "object" ? plugin : void 0;
|
|
127
|
+
};
|
|
128
|
+
var SETTINGS_ACTION = "dxos.org/plugin/settings";
|
|
129
|
+
var SettingsAction;
|
|
130
|
+
(function(SettingsAction2) {
|
|
131
|
+
SettingsAction2[SettingsAction2["OPEN"] = `${SETTINGS_ACTION}/open`] = "OPEN";
|
|
132
|
+
})(SettingsAction || (SettingsAction = {}));
|
|
148
133
|
var ResourceKey = import_zod2.z.union([
|
|
149
134
|
import_zod2.z.string(),
|
|
150
135
|
import_zod2.z.record(import_zod2.z.any())
|
|
@@ -155,86 +140,6 @@ var parseTranslationsPlugin = (plugin) => {
|
|
|
155
140
|
const { success } = import_zod2.z.array(Resource).safeParse(plugin.provides.translations);
|
|
156
141
|
return success ? plugin : void 0;
|
|
157
142
|
};
|
|
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
|
-
};
|
|
238
143
|
var pluginMeta = (meta) => meta;
|
|
239
144
|
var Plugin;
|
|
240
145
|
(function(Plugin2) {
|
|
@@ -244,7 +149,7 @@ var Plugin;
|
|
|
244
149
|
});
|
|
245
150
|
};
|
|
246
151
|
})(Plugin || (Plugin = {}));
|
|
247
|
-
var PluginContext = /* @__PURE__ */ (0,
|
|
152
|
+
var PluginContext = /* @__PURE__ */ (0, import_react.createContext)({
|
|
248
153
|
ready: false,
|
|
249
154
|
enabled: [],
|
|
250
155
|
plugins: [],
|
|
@@ -252,7 +157,7 @@ var PluginContext = /* @__PURE__ */ (0, import_react4.createContext)({
|
|
|
252
157
|
setPlugin: () => {
|
|
253
158
|
}
|
|
254
159
|
});
|
|
255
|
-
var usePlugins = () => (0,
|
|
160
|
+
var usePlugins = () => (0, import_react.useContext)(PluginContext);
|
|
256
161
|
var usePlugin = (id) => {
|
|
257
162
|
const { plugins } = usePlugins();
|
|
258
163
|
return (0, import_chunk_VDKZ7AAF.findPlugin)(plugins, id);
|
|
@@ -292,11 +197,11 @@ var PluginHost = ({ order, plugins: definitions, core = [], defaults = [], fallb
|
|
|
292
197
|
},
|
|
293
198
|
provides: {
|
|
294
199
|
plugins: state.values,
|
|
295
|
-
context: ({ children }) => /* @__PURE__ */
|
|
200
|
+
context: ({ children }) => /* @__PURE__ */ import_react3.default.createElement(PluginProvider, {
|
|
296
201
|
value: state.values
|
|
297
202
|
}, children),
|
|
298
203
|
root: () => {
|
|
299
|
-
(0,
|
|
204
|
+
(0, import_react3.useEffect)(() => {
|
|
300
205
|
(0, import_log.log)("initializing plugins", {
|
|
301
206
|
enabled: state.values.enabled
|
|
302
207
|
}, {
|
|
@@ -341,7 +246,7 @@ var PluginHost = ({ order, plugins: definitions, core = [], defaults = [], fallb
|
|
|
341
246
|
S: void 0,
|
|
342
247
|
C: (f, a) => f(...a)
|
|
343
248
|
});
|
|
344
|
-
state.values.plugins = (0,
|
|
249
|
+
state.values.plugins = (0, import_react2.shallow)(plugins);
|
|
345
250
|
state.values.ready = true;
|
|
346
251
|
});
|
|
347
252
|
return () => {
|
|
@@ -350,10 +255,10 @@ var PluginHost = ({ order, plugins: definitions, core = [], defaults = [], fallb
|
|
|
350
255
|
};
|
|
351
256
|
}, []);
|
|
352
257
|
if (!state.values.ready) {
|
|
353
|
-
return /* @__PURE__ */
|
|
258
|
+
return /* @__PURE__ */ import_react3.default.createElement(import_react3.default.Fragment, null, fallback);
|
|
354
259
|
}
|
|
355
260
|
const ComposedContext = composeContext(state.values.plugins);
|
|
356
|
-
return /* @__PURE__ */
|
|
261
|
+
return /* @__PURE__ */ import_react3.default.createElement(ComposedContext, null, rootComponents(state.values.plugins));
|
|
357
262
|
}
|
|
358
263
|
}
|
|
359
264
|
};
|
|
@@ -372,7 +277,7 @@ var rootComponents = (plugins) => {
|
|
|
372
277
|
return plugins.map((plugin) => {
|
|
373
278
|
const Component2 = plugin.provides.root;
|
|
374
279
|
if (Component2) {
|
|
375
|
-
return /* @__PURE__ */
|
|
280
|
+
return /* @__PURE__ */ import_react3.default.createElement(Component2, {
|
|
376
281
|
key: plugin.meta.id
|
|
377
282
|
});
|
|
378
283
|
} else {
|
|
@@ -386,10 +291,10 @@ var composeContext = (plugins) => {
|
|
|
386
291
|
var compose = (contexts) => {
|
|
387
292
|
return [
|
|
388
293
|
...contexts
|
|
389
|
-
].reduce((Acc, Next) => ({ children }) => /* @__PURE__ */
|
|
294
|
+
].reduce((Acc, Next) => ({ children }) => /* @__PURE__ */ import_react3.default.createElement(Acc, null, /* @__PURE__ */ import_react3.default.createElement(Next, null, children)));
|
|
390
295
|
};
|
|
391
296
|
var isObject = (data) => !!data && typeof data === "object";
|
|
392
|
-
var ErrorBoundary = class extends
|
|
297
|
+
var ErrorBoundary = class extends import_react4.Component {
|
|
393
298
|
constructor(props) {
|
|
394
299
|
super(props);
|
|
395
300
|
this.state = {
|
|
@@ -408,7 +313,7 @@ var ErrorBoundary = class extends import_react7.Component {
|
|
|
408
313
|
}
|
|
409
314
|
render() {
|
|
410
315
|
if (this.state.error) {
|
|
411
|
-
return /* @__PURE__ */
|
|
316
|
+
return /* @__PURE__ */ import_react4.default.createElement(this.props.fallback, {
|
|
412
317
|
error: this.state.error,
|
|
413
318
|
reset: this.resetError
|
|
414
319
|
});
|
|
@@ -421,30 +326,30 @@ var ErrorBoundary = class extends import_react7.Component {
|
|
|
421
326
|
});
|
|
422
327
|
}
|
|
423
328
|
};
|
|
424
|
-
var Surface = /* @__PURE__ */ (0,
|
|
329
|
+
var Surface = /* @__PURE__ */ (0, import_react5.forwardRef)(({ role, name = role, fallback, ...rest }, forwardedRef) => {
|
|
425
330
|
const props = {
|
|
426
331
|
role,
|
|
427
332
|
name,
|
|
428
333
|
fallback,
|
|
429
334
|
...rest
|
|
430
335
|
};
|
|
431
|
-
const context = (0,
|
|
336
|
+
const context = (0, import_react6.useContext)(SurfaceContext);
|
|
432
337
|
const data = props.data ?? (name && context?.surfaces?.[name]?.data || {});
|
|
433
|
-
return /* @__PURE__ */
|
|
338
|
+
return /* @__PURE__ */ import_react5.default.createElement(import_react5.default.Fragment, null, fallback ? /* @__PURE__ */ import_react5.default.createElement(ErrorBoundary, {
|
|
434
339
|
data,
|
|
435
340
|
fallback
|
|
436
|
-
}, /* @__PURE__ */
|
|
341
|
+
}, /* @__PURE__ */ import_react5.default.createElement(SurfaceResolver, {
|
|
437
342
|
...props,
|
|
438
343
|
ref: forwardedRef
|
|
439
|
-
})) : /* @__PURE__ */
|
|
344
|
+
})) : /* @__PURE__ */ import_react5.default.createElement(SurfaceResolver, {
|
|
440
345
|
...props,
|
|
441
346
|
ref: forwardedRef
|
|
442
347
|
}));
|
|
443
348
|
});
|
|
444
|
-
var SurfaceContext = /* @__PURE__ */ (0,
|
|
445
|
-
var SurfaceResolver = /* @__PURE__ */ (0,
|
|
349
|
+
var SurfaceContext = /* @__PURE__ */ (0, import_react6.createContext)(null);
|
|
350
|
+
var SurfaceResolver = /* @__PURE__ */ (0, import_react5.forwardRef)((props, forwardedRef) => {
|
|
446
351
|
const { components } = (0, import_chunk_DC3GU6QR.useSurface)();
|
|
447
|
-
const parent = (0,
|
|
352
|
+
const parent = (0, import_react6.useContext)(SurfaceContext);
|
|
448
353
|
const nodes = resolveNodes(components, props, parent, forwardedRef);
|
|
449
354
|
const currentContext = {
|
|
450
355
|
...props,
|
|
@@ -453,9 +358,9 @@ var SurfaceResolver = /* @__PURE__ */ (0, import_react8.forwardRef)((props, forw
|
|
|
453
358
|
...props.surfaces
|
|
454
359
|
}
|
|
455
360
|
};
|
|
456
|
-
return /* @__PURE__ */
|
|
361
|
+
return /* @__PURE__ */ import_react5.default.createElement(SurfaceContext.Provider, {
|
|
457
362
|
value: currentContext
|
|
458
|
-
}, nodes.length > 0 ? nodes : props.contentFallback ? /* @__PURE__ */
|
|
363
|
+
}, nodes.length > 0 ? nodes : props.contentFallback ? /* @__PURE__ */ import_react5.default.createElement(props.contentFallback, null) : null);
|
|
459
364
|
});
|
|
460
365
|
var resolveNodes = (components, props, context, forwardedRef) => {
|
|
461
366
|
const data = {
|
|
@@ -473,7 +378,7 @@ var resolveNodes = (components, props, context, forwardedRef) => {
|
|
|
473
378
|
return "node" in result ? [
|
|
474
379
|
key,
|
|
475
380
|
result
|
|
476
|
-
] : /* @__PURE__ */ (0,
|
|
381
|
+
] : /* @__PURE__ */ (0, import_react5.isValidElement)(result) ? [
|
|
477
382
|
key,
|
|
478
383
|
{
|
|
479
384
|
node: result
|
|
@@ -490,138 +395,11 @@ var resolveNodes = (components, props, context, forwardedRef) => {
|
|
|
490
395
|
return 1;
|
|
491
396
|
}
|
|
492
397
|
return 0;
|
|
493
|
-
}).map(([key, result]) => /* @__PURE__ */
|
|
398
|
+
}).map(([key, result]) => /* @__PURE__ */ import_react5.default.createElement(import_react5.Fragment, {
|
|
494
399
|
key
|
|
495
400
|
}, result.node));
|
|
496
401
|
return props.limit ? nodes.slice(0, props.limit) : nodes;
|
|
497
402
|
};
|
|
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
|
-
};
|
|
625
403
|
var __dxlog_file2 = "/home/runner/work/dxos/dxos/packages/sdk/app-framework/src/App.tsx";
|
|
626
404
|
var createApp = ({ order, plugins, core = order.map(({ id }) => id), ...params }) => {
|
|
627
405
|
const host = PluginHost({
|
|
@@ -662,11 +440,10 @@ var createApp = ({ order, plugins, core = order.map(({ id }) => id), ...params }
|
|
|
662
440
|
});
|
|
663
441
|
const Context = host.provides.context;
|
|
664
442
|
const Root = host.provides.root;
|
|
665
|
-
return () => /* @__PURE__ */
|
|
443
|
+
return () => /* @__PURE__ */ import_react7.default.createElement(Context, null, /* @__PURE__ */ import_react7.default.createElement(Root, null));
|
|
666
444
|
};
|
|
667
445
|
// Annotate the CommonJS export names for ESM import in node:
|
|
668
446
|
0 && (module.exports = {
|
|
669
|
-
CommandsDialogContent,
|
|
670
447
|
ErrorBoundary,
|
|
671
448
|
IntentProvider,
|
|
672
449
|
Layout,
|
|
@@ -677,9 +454,7 @@ var createApp = ({ order, plugins, core = order.map(({ id }) => id), ...params }
|
|
|
677
454
|
Resource,
|
|
678
455
|
ResourceKey,
|
|
679
456
|
ResourceLanguage,
|
|
680
|
-
|
|
681
|
-
SettingsValue,
|
|
682
|
-
ShortcutsDialogContent,
|
|
457
|
+
SettingsAction,
|
|
683
458
|
Surface,
|
|
684
459
|
SurfaceProvider,
|
|
685
460
|
createApp,
|
|
@@ -697,6 +472,7 @@ var createApp = ({ order, plugins, core = order.map(({ id }) => id), ...params }
|
|
|
697
472
|
parseMetadataResolverPlugin,
|
|
698
473
|
parsePluginHost,
|
|
699
474
|
parseRootSurfacePlugin,
|
|
475
|
+
parseSettingsPlugin,
|
|
700
476
|
parseSurfacePlugin,
|
|
701
477
|
parseTranslationsPlugin,
|
|
702
478
|
pluginMeta,
|