@dxos/plugin-settings 0.6.14-main.2b6a0f3 → 0.8.4-main.1068cf700f
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/app-graph-builder-CCZGWQMT.mjs +97 -0
- package/dist/lib/browser/app-graph-builder-CCZGWQMT.mjs.map +7 -0
- package/dist/lib/browser/chunk-ONAYSYBX.mjs +35 -0
- package/dist/lib/browser/chunk-ONAYSYBX.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +31 -242
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/operation-resolver-IIUEJRBW.mjs +54 -0
- package/dist/lib/browser/operation-resolver-IIUEJRBW.mjs.map +7 -0
- package/dist/lib/node-esm/app-graph-builder-LZWJ45UQ.mjs +98 -0
- package/dist/lib/node-esm/app-graph-builder-LZWJ45UQ.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-TSHGTOLF.mjs +37 -0
- package/dist/lib/node-esm/chunk-TSHGTOLF.mjs.map +7 -0
- package/dist/lib/node-esm/index.mjs +31 -242
- package/dist/lib/node-esm/index.mjs.map +4 -4
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/lib/node-esm/operation-resolver-QRFPVUSP.mjs +55 -0
- package/dist/lib/node-esm/operation-resolver-QRFPVUSP.mjs.map +7 -0
- package/dist/types/src/SettingsPlugin.d.ts +2 -6
- package/dist/types/src/SettingsPlugin.d.ts.map +1 -1
- package/dist/types/src/actions.d.ts +25 -0
- package/dist/types/src/actions.d.ts.map +1 -0
- package/dist/types/src/capabilities/app-graph-builder/app-graph-builder.d.ts +6 -0
- package/dist/types/src/capabilities/app-graph-builder/app-graph-builder.d.ts.map +1 -0
- package/dist/types/src/capabilities/app-graph-builder/index.d.ts +3 -0
- package/dist/types/src/capabilities/app-graph-builder/index.d.ts.map +1 -0
- package/dist/types/src/capabilities/index.d.ts +3 -0
- package/dist/types/src/capabilities/index.d.ts.map +1 -0
- package/dist/types/src/capabilities/operation-resolver/index.d.ts +3 -0
- package/dist/types/src/capabilities/operation-resolver/index.d.ts.map +1 -0
- package/dist/types/src/capabilities/operation-resolver/operation-resolver.d.ts +5 -0
- package/dist/types/src/capabilities/operation-resolver/operation-resolver.d.ts.map +1 -0
- package/dist/types/src/index.d.ts +1 -3
- package/dist/types/src/index.d.ts.map +1 -1
- package/dist/types/src/meta.d.ts +2 -5
- package/dist/types/src/meta.d.ts.map +1 -1
- package/dist/types/src/translations.d.ts +7 -9
- package/dist/types/src/translations.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -0
- package/package.json +21 -36
- package/src/SettingsPlugin.ts +17 -0
- package/src/actions.ts +24 -0
- package/src/capabilities/app-graph-builder/app-graph-builder.ts +96 -0
- package/src/capabilities/app-graph-builder/index.ts +7 -0
- package/src/capabilities/index.ts +6 -0
- package/src/capabilities/operation-resolver/index.ts +10 -0
- package/src/capabilities/operation-resolver/operation-resolver.ts +54 -0
- package/src/index.ts +2 -9
- package/src/meta.ts +6 -7
- package/src/translations.ts +9 -9
- package/README.md +0 -15
- package/dist/lib/browser/chunk-PD3C4TDW.mjs +0 -11
- package/dist/lib/browser/chunk-PD3C4TDW.mjs.map +0 -7
- package/dist/lib/browser/meta.mjs +0 -9
- package/dist/lib/browser/meta.mjs.map +0 -7
- package/dist/lib/node/chunk-AHM6OLF2.cjs +0 -34
- package/dist/lib/node/chunk-AHM6OLF2.cjs.map +0 -7
- package/dist/lib/node/index.cjs +0 -278
- package/dist/lib/node/index.cjs.map +0 -7
- package/dist/lib/node/meta.cjs +0 -30
- package/dist/lib/node/meta.cjs.map +0 -7
- package/dist/lib/node/meta.json +0 -1
- package/dist/lib/node-esm/chunk-PPOEIFFE.mjs +0 -13
- package/dist/lib/node-esm/chunk-PPOEIFFE.mjs.map +0 -7
- package/dist/lib/node-esm/meta.mjs +0 -10
- package/dist/lib/node-esm/meta.mjs.map +0 -7
- package/dist/types/src/components/SettingsDialog.d.ts +0 -6
- package/dist/types/src/components/SettingsDialog.d.ts.map +0 -1
- package/dist/types/src/components/SettingsValue.d.ts +0 -9
- package/dist/types/src/components/SettingsValue.d.ts.map +0 -1
- package/dist/types/src/components/index.d.ts +0 -3
- package/dist/types/src/components/index.d.ts.map +0 -1
- package/src/SettingsPlugin.tsx +0 -122
- package/src/components/SettingsDialog.tsx +0 -126
- package/src/components/SettingsValue.tsx +0 -49
- package/src/components/index.ts +0 -6
package/dist/lib/node/index.cjs
DELETED
|
@@ -1,278 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __create = Object.create;
|
|
3
|
-
var __defProp = Object.defineProperty;
|
|
4
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
-
var __export = (target, all) => {
|
|
9
|
-
for (var name in all)
|
|
10
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
-
};
|
|
12
|
-
var __copyProps = (to, from, except, desc) => {
|
|
13
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
-
for (let key of __getOwnPropNames(from))
|
|
15
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
-
}
|
|
18
|
-
return to;
|
|
19
|
-
};
|
|
20
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
-
mod
|
|
27
|
-
));
|
|
28
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
-
var node_exports = {};
|
|
30
|
-
__export(node_exports, {
|
|
31
|
-
SettingsDialog: () => SettingsDialog,
|
|
32
|
-
SettingsPlugin: () => SettingsPlugin,
|
|
33
|
-
SettingsValue: () => SettingsValue,
|
|
34
|
-
default: () => src_default
|
|
35
|
-
});
|
|
36
|
-
module.exports = __toCommonJS(node_exports);
|
|
37
|
-
var import_chunk_AHM6OLF2 = require("./chunk-AHM6OLF2.cjs");
|
|
38
|
-
var import_react = __toESM(require("react"));
|
|
39
|
-
var import_app_framework = require("@dxos/app-framework");
|
|
40
|
-
var import_local_storage = require("@dxos/local-storage");
|
|
41
|
-
var import_plugin_graph = require("@dxos/plugin-graph");
|
|
42
|
-
var import_react2 = __toESM(require("react"));
|
|
43
|
-
var import_app_framework2 = require("@dxos/app-framework");
|
|
44
|
-
var import_react_ui = require("@dxos/react-ui");
|
|
45
|
-
var import_react_ui_tabs = require("@dxos/react-ui-tabs");
|
|
46
|
-
var import_react_ui_theme = require("@dxos/react-ui-theme");
|
|
47
|
-
var import_util = require("@dxos/util");
|
|
48
|
-
var import_react3 = __toESM(require("react"));
|
|
49
|
-
var import_react_ui2 = require("@dxos/react-ui");
|
|
50
|
-
var SettingsDialog = ({ selected, onSelected }) => {
|
|
51
|
-
const { t } = (0, import_react_ui.useTranslation)(import_chunk_AHM6OLF2.SETTINGS_PLUGIN);
|
|
52
|
-
const { plugins, enabled } = (0, import_app_framework2.usePlugins)();
|
|
53
|
-
const core = [
|
|
54
|
-
"dxos.org/plugin/layout",
|
|
55
|
-
"dxos.org/plugin/deck",
|
|
56
|
-
"dxos.org/plugin/files",
|
|
57
|
-
"dxos.org/plugin/space",
|
|
58
|
-
"dxos.org/plugin/stack",
|
|
59
|
-
"dxos.org/plugin/observability",
|
|
60
|
-
"dxos.org/plugin/registry"
|
|
61
|
-
];
|
|
62
|
-
const sortPlugin = ({ name: a }, { name: b }) => a?.localeCompare(b ?? "") ?? 0;
|
|
63
|
-
const corePlugins = core.map((id) => plugins.find((plugin) => plugin.meta.id === id)?.meta).filter(import_util.nonNullable).sort(sortPlugin);
|
|
64
|
-
const filteredPlugins = enabled.filter((id) => !core.includes(id)).map((id) => plugins.find((plugin) => plugin.meta.id === id)).filter((plugin) => plugin?.provides?.settings).map((plugin) => plugin.meta).sort(sortPlugin);
|
|
65
|
-
const [tabsActivePart, setTabsActivePart] = (0, import_react2.useState)("list");
|
|
66
|
-
return /* @__PURE__ */ import_react2.default.createElement(import_react_ui.Dialog.Content, {
|
|
67
|
-
classNames: "p-0 bs-content max-bs-full md:max-is-[40rem] overflow-hidden"
|
|
68
|
-
}, /* @__PURE__ */ import_react2.default.createElement("div", {
|
|
69
|
-
role: "none",
|
|
70
|
-
className: "flex justify-between mbe-1 pbs-3 pis-2 pie-3 @md:pbs-4 @md:pis-4 @md:pie-5"
|
|
71
|
-
}, /* @__PURE__ */ import_react2.default.createElement(import_react_ui.Dialog.Title, {
|
|
72
|
-
onClick: () => setTabsActivePart("list"),
|
|
73
|
-
"aria-description": t("click to return to tablist description"),
|
|
74
|
-
classNames: "flex cursor-pointer items-center group/title"
|
|
75
|
-
}, /* @__PURE__ */ import_react2.default.createElement(import_react_ui.Icon, {
|
|
76
|
-
icon: "ph--caret-left--regular",
|
|
77
|
-
classNames: [
|
|
78
|
-
"@md:hidden",
|
|
79
|
-
(0, import_react_ui_theme.getSize)(4),
|
|
80
|
-
tabsActivePart === "list" && "invisible"
|
|
81
|
-
]
|
|
82
|
-
}), /* @__PURE__ */ import_react2.default.createElement("span", {
|
|
83
|
-
className: tabsActivePart !== "list" ? "group-hover/title:underline @md:group-hover/title:no-underline underline-offset-4 decoration-1" : ""
|
|
84
|
-
}, t("settings dialog title"))), /* @__PURE__ */ import_react2.default.createElement(import_react_ui.Dialog.Close, {
|
|
85
|
-
asChild: true
|
|
86
|
-
}, /* @__PURE__ */ import_react2.default.createElement(import_react_ui.Button, {
|
|
87
|
-
density: "fine",
|
|
88
|
-
variant: "ghost",
|
|
89
|
-
autoFocus: true
|
|
90
|
-
}, /* @__PURE__ */ import_react2.default.createElement(import_react_ui.Icon, {
|
|
91
|
-
icon: "ph--x--regular",
|
|
92
|
-
size: 3
|
|
93
|
-
})))), /* @__PURE__ */ import_react2.default.createElement(import_react_ui_tabs.Tabs.Root, {
|
|
94
|
-
orientation: "vertical",
|
|
95
|
-
value: selected,
|
|
96
|
-
onValueChange: (nextSelected) => onSelected(nextSelected),
|
|
97
|
-
activePart: tabsActivePart,
|
|
98
|
-
onActivePartChange: setTabsActivePart,
|
|
99
|
-
classNames: "flex flex-col flex-1 mbs-2"
|
|
100
|
-
}, /* @__PURE__ */ import_react2.default.createElement(import_react_ui_tabs.Tabs.Viewport, {
|
|
101
|
-
classNames: "flex-1 min-bs-0"
|
|
102
|
-
}, /* @__PURE__ */ import_react2.default.createElement("div", {
|
|
103
|
-
role: "none",
|
|
104
|
-
className: "overflow-y-auto pli-3 @md:pis-2 @md:pie-0 mbe-4 border-r border-separator"
|
|
105
|
-
}, /* @__PURE__ */ import_react2.default.createElement(import_react_ui_tabs.Tabs.Tablist, {
|
|
106
|
-
classNames: "flex flex-col gap-4 max-bs-none overflow-y-visible"
|
|
107
|
-
}, /* @__PURE__ */ import_react2.default.createElement(PluginList, {
|
|
108
|
-
title: "Options",
|
|
109
|
-
plugins: corePlugins
|
|
110
|
-
}), filteredPlugins.length > 0 && /* @__PURE__ */ import_react2.default.createElement(PluginList, {
|
|
111
|
-
title: "Plugins",
|
|
112
|
-
plugins: filteredPlugins
|
|
113
|
-
}))), corePlugins.map((plugin) => /* @__PURE__ */ import_react2.default.createElement(import_react_ui_tabs.Tabs.Tabpanel, {
|
|
114
|
-
key: plugin.id,
|
|
115
|
-
value: plugin.id,
|
|
116
|
-
classNames: "pli-3 @md:pli-5 max-bs-dvh overflow-y-auto"
|
|
117
|
-
}, /* @__PURE__ */ import_react2.default.createElement(import_app_framework2.Surface, {
|
|
118
|
-
role: "settings",
|
|
119
|
-
data: {
|
|
120
|
-
plugin: plugin.id
|
|
121
|
-
}
|
|
122
|
-
}))), filteredPlugins.map((plugin) => /* @__PURE__ */ import_react2.default.createElement(import_react_ui_tabs.Tabs.Tabpanel, {
|
|
123
|
-
key: plugin.id,
|
|
124
|
-
value: plugin.id,
|
|
125
|
-
classNames: "pli-3 @md:pli-5 max-bs-dvh overflow-y-auto"
|
|
126
|
-
}, /* @__PURE__ */ import_react2.default.createElement(import_app_framework2.Surface, {
|
|
127
|
-
role: "settings",
|
|
128
|
-
data: {
|
|
129
|
-
plugin: plugin.id
|
|
130
|
-
}
|
|
131
|
-
}))))));
|
|
132
|
-
};
|
|
133
|
-
var PluginList = ({ title, plugins }) => {
|
|
134
|
-
return /* @__PURE__ */ import_react2.default.createElement("div", {
|
|
135
|
-
role: "none"
|
|
136
|
-
}, /* @__PURE__ */ import_react2.default.createElement(import_react_ui_tabs.Tabs.TabGroupHeading, {
|
|
137
|
-
classNames: "pli-1 mlb-2 mbs-4 @md:mbs-2"
|
|
138
|
-
}, title), /* @__PURE__ */ import_react2.default.createElement("div", {
|
|
139
|
-
className: "flex flex-col ml-1"
|
|
140
|
-
}, plugins.map((plugin) => /* @__PURE__ */ import_react2.default.createElement(import_react_ui_tabs.Tabs.Tab, {
|
|
141
|
-
key: plugin.id,
|
|
142
|
-
value: plugin.id
|
|
143
|
-
}, plugin.name))));
|
|
144
|
-
};
|
|
145
|
-
var SettingsValue = ({ label, description, secondary, children }) => {
|
|
146
|
-
const primary = /* @__PURE__ */ import_react3.default.createElement("div", {
|
|
147
|
-
role: "none",
|
|
148
|
-
className: "flex w-full gap-4 py-1"
|
|
149
|
-
}, /* @__PURE__ */ import_react3.default.createElement(import_react_ui2.Input.Root, null, /* @__PURE__ */ import_react3.default.createElement("div", {
|
|
150
|
-
role: "none",
|
|
151
|
-
className: "flex flex-col w-full"
|
|
152
|
-
}, /* @__PURE__ */ import_react3.default.createElement(import_react_ui2.Input.Label, {
|
|
153
|
-
classNames: "flex min-h-[40px] items-center"
|
|
154
|
-
}, label), description && /* @__PURE__ */ import_react3.default.createElement(import_react_ui2.Input.DescriptionAndValidation, {
|
|
155
|
-
classNames: "mbs-0.5"
|
|
156
|
-
}, /* @__PURE__ */ import_react3.default.createElement(import_react_ui2.Input.Description, null, description))), /* @__PURE__ */ import_react3.default.createElement("div", {
|
|
157
|
-
role: "none"
|
|
158
|
-
}, /* @__PURE__ */ import_react3.default.createElement("div", {
|
|
159
|
-
role: "none",
|
|
160
|
-
className: "flex min-h-[40px] items-center"
|
|
161
|
-
}, children))));
|
|
162
|
-
if (secondary) {
|
|
163
|
-
return /* @__PURE__ */ import_react3.default.createElement("div", {
|
|
164
|
-
role: "none",
|
|
165
|
-
className: "flex flex-col w-full"
|
|
166
|
-
}, primary, secondary);
|
|
167
|
-
}
|
|
168
|
-
return primary;
|
|
169
|
-
};
|
|
170
|
-
var translations_default = [
|
|
171
|
-
{
|
|
172
|
-
"en-US": {
|
|
173
|
-
[import_chunk_AHM6OLF2.SETTINGS_PLUGIN]: {
|
|
174
|
-
"open settings label": "Show settings",
|
|
175
|
-
"settings dialog title": "Settings",
|
|
176
|
-
"back label": "Back",
|
|
177
|
-
"click to return to tablist description": "Click the title to return to the settings menu"
|
|
178
|
-
}
|
|
179
|
-
}
|
|
180
|
-
}
|
|
181
|
-
];
|
|
182
|
-
var DEFAULT_PLUGIN = "dxos.org/plugin/registry";
|
|
183
|
-
var SettingsPlugin = () => {
|
|
184
|
-
const settings = new import_local_storage.LocalStorageStore(import_chunk_AHM6OLF2.SETTINGS_PLUGIN, {
|
|
185
|
-
selected: DEFAULT_PLUGIN
|
|
186
|
-
});
|
|
187
|
-
return {
|
|
188
|
-
meta: import_chunk_AHM6OLF2.meta_default,
|
|
189
|
-
ready: async () => {
|
|
190
|
-
settings.prop({
|
|
191
|
-
key: "selected",
|
|
192
|
-
type: import_local_storage.LocalStorageStore.string()
|
|
193
|
-
});
|
|
194
|
-
},
|
|
195
|
-
provides: {
|
|
196
|
-
surface: {
|
|
197
|
-
component: ({ data }) => {
|
|
198
|
-
switch (data.component) {
|
|
199
|
-
case `${import_chunk_AHM6OLF2.SETTINGS_PLUGIN}/Settings`:
|
|
200
|
-
return /* @__PURE__ */ import_react.default.createElement(SettingsDialog, {
|
|
201
|
-
selected: settings.values.selected,
|
|
202
|
-
onSelected: (selected) => settings.values.selected = selected
|
|
203
|
-
});
|
|
204
|
-
default:
|
|
205
|
-
return null;
|
|
206
|
-
}
|
|
207
|
-
}
|
|
208
|
-
},
|
|
209
|
-
intent: {
|
|
210
|
-
resolver: (intent) => {
|
|
211
|
-
switch (intent.action) {
|
|
212
|
-
case import_app_framework.SettingsAction.OPEN: {
|
|
213
|
-
if (intent.data?.plugin) {
|
|
214
|
-
settings.values.selected = intent.data?.plugin;
|
|
215
|
-
}
|
|
216
|
-
return {
|
|
217
|
-
intents: [
|
|
218
|
-
[
|
|
219
|
-
{
|
|
220
|
-
action: import_app_framework.LayoutAction.SET_LAYOUT,
|
|
221
|
-
data: {
|
|
222
|
-
element: "dialog",
|
|
223
|
-
component: `${import_chunk_AHM6OLF2.SETTINGS_PLUGIN}/Settings`,
|
|
224
|
-
dialogBlockAlign: "start"
|
|
225
|
-
}
|
|
226
|
-
}
|
|
227
|
-
]
|
|
228
|
-
]
|
|
229
|
-
};
|
|
230
|
-
}
|
|
231
|
-
}
|
|
232
|
-
}
|
|
233
|
-
},
|
|
234
|
-
graph: {
|
|
235
|
-
builder: (plugins) => {
|
|
236
|
-
const intentPlugin = (0, import_app_framework.resolvePlugin)(plugins, import_app_framework.parseIntentPlugin);
|
|
237
|
-
return (0, import_plugin_graph.createExtension)({
|
|
238
|
-
id: import_chunk_AHM6OLF2.SETTINGS_PLUGIN,
|
|
239
|
-
filter: (node) => node.id === "root",
|
|
240
|
-
actions: () => [
|
|
241
|
-
{
|
|
242
|
-
id: import_chunk_AHM6OLF2.SETTINGS_PLUGIN,
|
|
243
|
-
data: async () => {
|
|
244
|
-
await intentPlugin?.provides.intent.dispatch({
|
|
245
|
-
plugin: import_chunk_AHM6OLF2.SETTINGS_PLUGIN,
|
|
246
|
-
action: import_app_framework.SettingsAction.OPEN
|
|
247
|
-
});
|
|
248
|
-
},
|
|
249
|
-
properties: {
|
|
250
|
-
label: [
|
|
251
|
-
"open settings label",
|
|
252
|
-
{
|
|
253
|
-
ns: import_chunk_AHM6OLF2.SETTINGS_PLUGIN
|
|
254
|
-
}
|
|
255
|
-
],
|
|
256
|
-
icon: "ph--gear--regular",
|
|
257
|
-
keyBinding: {
|
|
258
|
-
macos: "meta+,",
|
|
259
|
-
windows: "alt+,"
|
|
260
|
-
}
|
|
261
|
-
}
|
|
262
|
-
}
|
|
263
|
-
]
|
|
264
|
-
});
|
|
265
|
-
}
|
|
266
|
-
},
|
|
267
|
-
translations: translations_default
|
|
268
|
-
}
|
|
269
|
-
};
|
|
270
|
-
};
|
|
271
|
-
var src_default = SettingsPlugin;
|
|
272
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
273
|
-
0 && (module.exports = {
|
|
274
|
-
SettingsDialog,
|
|
275
|
-
SettingsPlugin,
|
|
276
|
-
SettingsValue
|
|
277
|
-
});
|
|
278
|
-
//# sourceMappingURL=index.cjs.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../src/SettingsPlugin.tsx", "../../../src/components/SettingsDialog.tsx", "../../../src/components/SettingsValue.tsx", "../../../src/translations.ts", "../../../src/index.ts"],
|
|
4
|
-
"sourcesContent": ["//\n// Copyright 2023 DXOS.org\n//\n\nimport React from 'react';\n\nimport {\n type IntentResolverProvides,\n type PluginDefinition,\n type SurfaceProvides,\n parseIntentPlugin,\n resolvePlugin,\n LayoutAction,\n SettingsAction,\n type GraphBuilderProvides,\n type TranslationsProvides,\n} from '@dxos/app-framework';\nimport { LocalStorageStore } from '@dxos/local-storage';\nimport { createExtension, type Node } from '@dxos/plugin-graph';\n\nimport { SettingsDialog } from './components';\nimport meta, { SETTINGS_PLUGIN } from './meta';\nimport translations from './translations';\n\nconst DEFAULT_PLUGIN = 'dxos.org/plugin/registry';\n\nexport type SettingsPluginProvides = SurfaceProvides &\n IntentResolverProvides &\n GraphBuilderProvides &\n TranslationsProvides;\n\ntype SettingsSettingsProps = {\n selected: string;\n};\n\n/**\n * Plugin for aggregating and rendering plugin settings.\n */\nexport const SettingsPlugin = (): PluginDefinition<SettingsPluginProvides> => {\n const settings = new LocalStorageStore<SettingsSettingsProps>(SETTINGS_PLUGIN, { selected: DEFAULT_PLUGIN });\n\n return {\n meta,\n ready: async () => {\n settings.prop({ key: 'selected', type: LocalStorageStore.string() });\n },\n provides: {\n surface: {\n component: ({ data }) => {\n switch (data.component) {\n case `${SETTINGS_PLUGIN}/Settings`:\n return (\n <SettingsDialog\n selected={settings.values.selected}\n onSelected={(selected) => (settings.values.selected = selected)}\n />\n );\n\n default:\n return null;\n }\n },\n },\n intent: {\n resolver: (intent) => {\n switch (intent.action) {\n case SettingsAction.OPEN: {\n if (intent.data?.plugin) {\n settings.values.selected = intent.data?.plugin;\n }\n\n return {\n intents: [\n [\n {\n action: LayoutAction.SET_LAYOUT,\n data: {\n element: 'dialog',\n component: `${SETTINGS_PLUGIN}/Settings`,\n dialogBlockAlign: 'start',\n },\n },\n ],\n ],\n };\n }\n }\n },\n },\n graph: {\n builder: (plugins) => {\n const intentPlugin = resolvePlugin(plugins, parseIntentPlugin);\n\n return createExtension({\n id: SETTINGS_PLUGIN,\n filter: (node): node is Node<null> => node.id === 'root',\n actions: () => [\n {\n id: SETTINGS_PLUGIN,\n data: async () => {\n await intentPlugin?.provides.intent.dispatch({\n plugin: SETTINGS_PLUGIN,\n action: SettingsAction.OPEN,\n });\n },\n properties: {\n label: ['open settings label', { ns: SETTINGS_PLUGIN }],\n icon: 'ph--gear--regular',\n keyBinding: {\n macos: 'meta+,',\n windows: 'alt+,',\n },\n },\n },\n ],\n });\n },\n },\n translations,\n },\n };\n};\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport React, { useState } from 'react';\n\nimport { type PluginMeta, Surface, usePlugins } from '@dxos/app-framework';\nimport { Button, Dialog, Icon, useTranslation } from '@dxos/react-ui';\nimport { Tabs, type TabsActivePart } from '@dxos/react-ui-tabs';\nimport { getSize } from '@dxos/react-ui-theme';\nimport { nonNullable } from '@dxos/util';\n\nimport { SETTINGS_PLUGIN } from '../meta';\n\nexport const SettingsDialog = ({\n selected,\n onSelected,\n}: {\n selected: string;\n onSelected: (plugin: string) => void;\n}) => {\n const { t } = useTranslation(SETTINGS_PLUGIN);\n const { plugins, enabled } = usePlugins();\n\n // TODO(burdon): Factor out common defs?\n const core = [\n 'dxos.org/plugin/layout',\n 'dxos.org/plugin/deck',\n 'dxos.org/plugin/files',\n 'dxos.org/plugin/space',\n 'dxos.org/plugin/stack',\n 'dxos.org/plugin/observability',\n 'dxos.org/plugin/registry',\n ];\n\n const sortPlugin = ({ name: a }: PluginMeta, { name: b }: PluginMeta) => a?.localeCompare(b ?? '') ?? 0;\n\n const corePlugins = core\n .map((id) => plugins.find((plugin) => plugin.meta.id === id)?.meta)\n .filter(nonNullable)\n .sort(sortPlugin);\n\n const filteredPlugins = enabled\n .filter((id) => !core.includes(id))\n .map((id) => plugins.find((plugin) => plugin.meta.id === id))\n .filter((plugin) => (plugin?.provides as any)?.settings)\n .map((plugin) => plugin!.meta)\n .sort(sortPlugin);\n\n const [tabsActivePart, setTabsActivePart] = useState<TabsActivePart>('list');\n\n return (\n <Dialog.Content classNames='p-0 bs-content max-bs-full md:max-is-[40rem] overflow-hidden'>\n <div role='none' className='flex justify-between mbe-1 pbs-3 pis-2 pie-3 @md:pbs-4 @md:pis-4 @md:pie-5'>\n <Dialog.Title\n onClick={() => setTabsActivePart('list')}\n aria-description={t('click to return to tablist description')}\n classNames='flex cursor-pointer items-center group/title'\n >\n <Icon\n icon='ph--caret-left--regular'\n classNames={['@md:hidden', getSize(4), tabsActivePart === 'list' && 'invisible']}\n />\n <span\n className={\n tabsActivePart !== 'list'\n ? 'group-hover/title:underline @md:group-hover/title:no-underline underline-offset-4 decoration-1'\n : ''\n }\n >\n {t('settings dialog title')}\n </span>\n </Dialog.Title>\n <Dialog.Close asChild>\n <Button density='fine' variant='ghost' autoFocus>\n <Icon icon='ph--x--regular' size={3} />\n </Button>\n </Dialog.Close>\n </div>\n\n <Tabs.Root\n orientation='vertical'\n value={selected}\n onValueChange={(nextSelected) => onSelected(nextSelected)}\n activePart={tabsActivePart}\n onActivePartChange={setTabsActivePart}\n classNames='flex flex-col flex-1 mbs-2'\n >\n <Tabs.Viewport classNames='flex-1 min-bs-0'>\n <div role='none' className='overflow-y-auto pli-3 @md:pis-2 @md:pie-0 mbe-4 border-r border-separator'>\n <Tabs.Tablist classNames='flex flex-col gap-4 max-bs-none overflow-y-visible'>\n <PluginList title='Options' plugins={corePlugins} />\n {filteredPlugins.length > 0 && <PluginList title='Plugins' plugins={filteredPlugins} />}\n </Tabs.Tablist>\n </div>\n\n {corePlugins.map((plugin) => (\n <Tabs.Tabpanel key={plugin.id} value={plugin.id} classNames='pli-3 @md:pli-5 max-bs-dvh overflow-y-auto'>\n <Surface role='settings' data={{ plugin: plugin.id }} />\n </Tabs.Tabpanel>\n ))}\n {filteredPlugins.map((plugin) => (\n <Tabs.Tabpanel key={plugin.id} value={plugin.id} classNames='pli-3 @md:pli-5 max-bs-dvh overflow-y-auto'>\n <Surface role='settings' data={{ plugin: plugin.id }} />\n </Tabs.Tabpanel>\n ))}\n </Tabs.Viewport>\n </Tabs.Root>\n </Dialog.Content>\n );\n};\n\nconst PluginList = ({ title, plugins }: { title: string; plugins: PluginMeta[] }) => {\n return (\n <div role='none'>\n <Tabs.TabGroupHeading classNames={'pli-1 mlb-2 mbs-4 @md:mbs-2'}>{title}</Tabs.TabGroupHeading>\n <div className='flex flex-col ml-1'>\n {plugins.map((plugin) => (\n <Tabs.Tab key={plugin.id} value={plugin.id}>\n {plugin.name}\n </Tabs.Tab>\n ))}\n </div>\n </div>\n );\n};\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport React, { type JSX, type PropsWithChildren } from 'react';\n\nimport { Input } from '@dxos/react-ui';\n\ntype SettingValueProps = {\n label: string;\n description?: JSX.Element;\n secondary?: JSX.Element;\n};\n\nexport const SettingsValue = ({ label, description, secondary, children }: PropsWithChildren<SettingValueProps>) => {\n const primary = (\n <div role='none' className='flex w-full gap-4 py-1'>\n <Input.Root>\n <div role='none' className='flex flex-col w-full'>\n {/* TODO(burdon): Consistent height for controls (e.g., Select, Textbox, and Checkbox are all different). */}\n <Input.Label classNames='flex min-h-[40px] items-center'>{label}</Input.Label>\n {description && (\n <Input.DescriptionAndValidation classNames='mbs-0.5'>\n <Input.Description>{description}</Input.Description>\n </Input.DescriptionAndValidation>\n )}\n </div>\n\n <div role='none'>\n <div role='none' className='flex min-h-[40px] items-center'>\n {children}\n </div>\n </div>\n </Input.Root>\n </div>\n );\n\n if (secondary) {\n // console.log(secondary);\n return (\n <div role='none' className='flex flex-col w-full'>\n {primary}\n {secondary}\n </div>\n );\n }\n\n return primary;\n};\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport { SETTINGS_PLUGIN } from './meta';\n\nexport default [\n {\n 'en-US': {\n [SETTINGS_PLUGIN]: {\n 'open settings label': 'Show settings',\n 'settings dialog title': 'Settings',\n 'back label': 'Back',\n 'click to return to tablist description': 'Click the title to return to the settings menu',\n },\n },\n },\n];\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport { SettingsPlugin } from './SettingsPlugin';\n\nexport default SettingsPlugin;\n\nexport * from './SettingsPlugin';\n\n// TODO(wittjosiah): Remove.\n// Settings should be exposed from plugins as state and intents rather than components.\nexport * from './components';\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;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,oCAAclG,SAASmG,sCAAAA;AAE5C,qBAAOC,qCAAgB;YACrBzF,IAAIZ;YACJgB,QAAQ,CAACsF,SAA6BA,KAAK1F,OAAO;YAClD2F,SAAS,MAAM;cACb;gBACE3F,IAAIZ;gBACJ+D,MAAM,YAAA;AACJ,wBAAMmC,cAAc7E,SAASiE,OAAOkB,SAAS;oBAC3C1F,QAAQd;oBACRwF,QAAQC,oCAAeC;kBACzB,CAAA;gBACF;gBACAe,YAAY;kBACVtC,OAAO;oBAAC;oBAAuB;sBAAEuC,IAAI1G;oBAAgB;;kBACrDqC,MAAM;kBACNsE,YAAY;oBACVC,OAAO;oBACPC,SAAS;kBACX;gBACF;cACF;;UAEJ,CAAA;QACF;MACF;MACAC,cAAAA;IACF;EACF;AACF;AInHA,IAAA,cAAejC;",
|
|
6
|
-
"names": ["import_react", "import_app_framework", "import_react_ui", "SettingsDialog", "selected", "onSelected", "t", "useTranslation", "SETTINGS_PLUGIN", "plugins", "enabled", "usePlugins", "core", "sortPlugin", "name", "a", "b", "localeCompare", "corePlugins", "map", "id", "find", "plugin", "meta", "filter", "nonNullable", "sort", "filteredPlugins", "includes", "provides", "settings", "tabsActivePart", "setTabsActivePart", "useState", "React", "Dialog", "Content", "classNames", "div", "role", "className", "Title", "onClick", "aria-description", "Icon", "icon", "getSize", "span", "Close", "asChild", "Button", "density", "variant", "autoFocus", "size", "Tabs", "Root", "orientation", "value", "onValueChange", "nextSelected", "activePart", "onActivePartChange", "Viewport", "Tablist", "PluginList", "title", "length", "Tabpanel", "key", "Surface", "data", "TabGroupHeading", "Tab", "SettingsValue", "label", "description", "secondary", "children", "primary", "Input", "Label", "DescriptionAndValidation", "Description", "DEFAULT_PLUGIN", "SettingsPlugin", "LocalStorageStore", "ready", "prop", "type", "string", "surface", "component", "values", "intent", "resolver", "action", "SettingsAction", "OPEN", "intents", "LayoutAction", "SET_LAYOUT", "element", "dialogBlockAlign", "graph", "builder", "intentPlugin", "resolvePlugin", "parseIntentPlugin", "createExtension", "node", "actions", "dispatch", "properties", "ns", "keyBinding", "macos", "windows", "translations"]
|
|
7
|
-
}
|
package/dist/lib/node/meta.cjs
DELETED
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __export = (target, all) => {
|
|
7
|
-
for (var name in all)
|
|
8
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
-
};
|
|
10
|
-
var __copyProps = (to, from, except, desc) => {
|
|
11
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
-
for (let key of __getOwnPropNames(from))
|
|
13
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
-
}
|
|
16
|
-
return to;
|
|
17
|
-
};
|
|
18
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
-
var meta_exports = {};
|
|
20
|
-
__export(meta_exports, {
|
|
21
|
-
SETTINGS_PLUGIN: () => import_chunk_AHM6OLF2.SETTINGS_PLUGIN,
|
|
22
|
-
default: () => import_chunk_AHM6OLF2.meta_default
|
|
23
|
-
});
|
|
24
|
-
module.exports = __toCommonJS(meta_exports);
|
|
25
|
-
var import_chunk_AHM6OLF2 = require("./chunk-AHM6OLF2.cjs");
|
|
26
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
27
|
-
0 && (module.exports = {
|
|
28
|
-
SETTINGS_PLUGIN
|
|
29
|
-
});
|
|
30
|
-
//# sourceMappingURL=meta.cjs.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["meta.cjs"],
|
|
4
|
-
"sourcesContent": ["import {\n SETTINGS_PLUGIN,\n meta_default\n} from \"./chunk-AHM6OLF2.cjs\";\nexport {\n SETTINGS_PLUGIN,\n meta_default as default\n};\n//# sourceMappingURL=meta.cjs.map\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,4BAGO;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
package/dist/lib/node/meta.json
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"inputs":{"packages/plugins/plugin-settings/src/meta.ts":{"bytes":886,"imports":[],"format":"esm"},"packages/plugins/plugin-settings/src/components/SettingsDialog.tsx":{"bytes":15774,"imports":[{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/app-framework","kind":"import-statement","external":true},{"path":"@dxos/react-ui","kind":"import-statement","external":true},{"path":"@dxos/react-ui-tabs","kind":"import-statement","external":true},{"path":"@dxos/react-ui-theme","kind":"import-statement","external":true},{"path":"@dxos/util","kind":"import-statement","external":true},{"path":"packages/plugins/plugin-settings/src/meta.ts","kind":"import-statement","original":"../meta"}],"format":"esm"},"packages/plugins/plugin-settings/src/components/SettingsValue.tsx":{"bytes":4471,"imports":[{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/react-ui","kind":"import-statement","external":true}],"format":"esm"},"packages/plugins/plugin-settings/src/components/index.ts":{"bytes":634,"imports":[{"path":"packages/plugins/plugin-settings/src/components/SettingsDialog.tsx","kind":"import-statement","original":"./SettingsDialog"},{"path":"packages/plugins/plugin-settings/src/components/SettingsValue.tsx","kind":"import-statement","original":"./SettingsValue"}],"format":"esm"},"packages/plugins/plugin-settings/src/translations.ts":{"bytes":1571,"imports":[{"path":"packages/plugins/plugin-settings/src/meta.ts","kind":"import-statement","original":"./meta"}],"format":"esm"},"packages/plugins/plugin-settings/src/SettingsPlugin.tsx":{"bytes":12272,"imports":[{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/app-framework","kind":"import-statement","external":true},{"path":"@dxos/local-storage","kind":"import-statement","external":true},{"path":"@dxos/plugin-graph","kind":"import-statement","external":true},{"path":"packages/plugins/plugin-settings/src/components/index.ts","kind":"import-statement","original":"./components"},{"path":"packages/plugins/plugin-settings/src/meta.ts","kind":"import-statement","original":"./meta"},{"path":"packages/plugins/plugin-settings/src/translations.ts","kind":"import-statement","original":"./translations"}],"format":"esm"},"packages/plugins/plugin-settings/src/index.ts":{"bytes":1216,"imports":[{"path":"packages/plugins/plugin-settings/src/SettingsPlugin.tsx","kind":"import-statement","original":"./SettingsPlugin"},{"path":"packages/plugins/plugin-settings/src/SettingsPlugin.tsx","kind":"import-statement","original":"./SettingsPlugin"},{"path":"packages/plugins/plugin-settings/src/components/index.ts","kind":"import-statement","original":"./components"}],"format":"esm"}},"outputs":{"packages/plugins/plugin-settings/dist/lib/node/index.cjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":16969},"packages/plugins/plugin-settings/dist/lib/node/index.cjs":{"imports":[{"path":"packages/plugins/plugin-settings/dist/lib/node/chunk-AHM6OLF2.cjs","kind":"import-statement"},{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/app-framework","kind":"import-statement","external":true},{"path":"@dxos/local-storage","kind":"import-statement","external":true},{"path":"@dxos/plugin-graph","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/app-framework","kind":"import-statement","external":true},{"path":"@dxos/react-ui","kind":"import-statement","external":true},{"path":"@dxos/react-ui-tabs","kind":"import-statement","external":true},{"path":"@dxos/react-ui-theme","kind":"import-statement","external":true},{"path":"@dxos/util","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/react-ui","kind":"import-statement","external":true}],"exports":["SettingsDialog","SettingsPlugin","SettingsValue","default"],"entryPoint":"packages/plugins/plugin-settings/src/index.ts","inputs":{"packages/plugins/plugin-settings/src/SettingsPlugin.tsx":{"bytesInOutput":2830},"packages/plugins/plugin-settings/src/components/SettingsDialog.tsx":{"bytesInOutput":4430},"packages/plugins/plugin-settings/src/components/SettingsValue.tsx":{"bytesInOutput":1125},"packages/plugins/plugin-settings/src/translations.ts":{"bytesInOutput":318},"packages/plugins/plugin-settings/src/index.ts":{"bytesInOutput":34}},"bytes":9304},"packages/plugins/plugin-settings/dist/lib/node/meta.cjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":93},"packages/plugins/plugin-settings/dist/lib/node/meta.cjs":{"imports":[{"path":"packages/plugins/plugin-settings/dist/lib/node/chunk-AHM6OLF2.cjs","kind":"import-statement"}],"exports":["SETTINGS_PLUGIN","default"],"entryPoint":"packages/plugins/plugin-settings/src/meta.ts","inputs":{},"bytes":165},"packages/plugins/plugin-settings/dist/lib/node/chunk-AHM6OLF2.cjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":417},"packages/plugins/plugin-settings/dist/lib/node/chunk-AHM6OLF2.cjs":{"imports":[],"exports":["SETTINGS_PLUGIN","meta_default"],"inputs":{"packages/plugins/plugin-settings/src/meta.ts":{"bytesInOutput":96}},"bytes":235}}}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { createRequire } from 'node:module';const require = createRequire(import.meta.url);
|
|
2
|
-
|
|
3
|
-
// packages/plugins/plugin-settings/src/meta.ts
|
|
4
|
-
var SETTINGS_PLUGIN = "dxos.org/plugin/settings";
|
|
5
|
-
var meta_default = {
|
|
6
|
-
id: SETTINGS_PLUGIN
|
|
7
|
-
};
|
|
8
|
-
|
|
9
|
-
export {
|
|
10
|
-
SETTINGS_PLUGIN,
|
|
11
|
-
meta_default
|
|
12
|
-
};
|
|
13
|
-
//# sourceMappingURL=chunk-PPOEIFFE.mjs.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../src/meta.ts"],
|
|
4
|
-
"sourcesContent": ["//\n// Copyright 2023 DXOS.org\n//\n\nimport { type PluginMeta } from '@dxos/app-framework';\n\nexport const SETTINGS_PLUGIN = 'dxos.org/plugin/settings';\n\nexport default {\n id: SETTINGS_PLUGIN,\n} satisfies PluginMeta;\n"],
|
|
5
|
-
"mappings": ";;;AAMO,IAAMA,kBAAkB;AAE/B,IAAA,eAAe;EACbC,IAAID;AACN;",
|
|
6
|
-
"names": ["SETTINGS_PLUGIN", "id"]
|
|
7
|
-
}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { createRequire } from 'node:module';const require = createRequire(import.meta.url);
|
|
2
|
-
import {
|
|
3
|
-
SETTINGS_PLUGIN,
|
|
4
|
-
meta_default
|
|
5
|
-
} from "./chunk-PPOEIFFE.mjs";
|
|
6
|
-
export {
|
|
7
|
-
SETTINGS_PLUGIN,
|
|
8
|
-
meta_default as default
|
|
9
|
-
};
|
|
10
|
-
//# sourceMappingURL=meta.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"SettingsDialog.d.ts","sourceRoot":"","sources":["../../../../src/components/SettingsDialog.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAmB,MAAM,OAAO,CAAC;AAUxC,eAAO,MAAM,cAAc,8BAGxB;IACD,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,CAAC;CACtC,sBA0FA,CAAC"}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { type JSX, type PropsWithChildren } from 'react';
|
|
2
|
-
type SettingValueProps = {
|
|
3
|
-
label: string;
|
|
4
|
-
description?: JSX.Element;
|
|
5
|
-
secondary?: JSX.Element;
|
|
6
|
-
};
|
|
7
|
-
export declare const SettingsValue: ({ label, description, secondary, children }: PropsWithChildren<SettingValueProps>) => JSX.Element;
|
|
8
|
-
export {};
|
|
9
|
-
//# sourceMappingURL=SettingsValue.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"SettingsValue.d.ts","sourceRoot":"","sources":["../../../../src/components/SettingsValue.tsx"],"names":[],"mappings":"AAIA,OAAc,EAAE,KAAK,GAAG,EAAE,KAAK,iBAAiB,EAAE,MAAM,OAAO,CAAC;AAIhE,KAAK,iBAAiB,GAAG;IACvB,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,CAAC,EAAE,GAAG,CAAC,OAAO,CAAC;IAC1B,SAAS,CAAC,EAAE,GAAG,CAAC,OAAO,CAAC;CACzB,CAAC;AAEF,eAAO,MAAM,aAAa,gDAAiD,iBAAiB,CAAC,iBAAiB,CAAC,gBAkC9G,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/index.ts"],"names":[],"mappings":"AAIA,cAAc,kBAAkB,CAAC;AACjC,cAAc,iBAAiB,CAAC"}
|
package/src/SettingsPlugin.tsx
DELETED
|
@@ -1,122 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2023 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
import React from 'react';
|
|
6
|
-
|
|
7
|
-
import {
|
|
8
|
-
type IntentResolverProvides,
|
|
9
|
-
type PluginDefinition,
|
|
10
|
-
type SurfaceProvides,
|
|
11
|
-
parseIntentPlugin,
|
|
12
|
-
resolvePlugin,
|
|
13
|
-
LayoutAction,
|
|
14
|
-
SettingsAction,
|
|
15
|
-
type GraphBuilderProvides,
|
|
16
|
-
type TranslationsProvides,
|
|
17
|
-
} from '@dxos/app-framework';
|
|
18
|
-
import { LocalStorageStore } from '@dxos/local-storage';
|
|
19
|
-
import { createExtension, type Node } from '@dxos/plugin-graph';
|
|
20
|
-
|
|
21
|
-
import { SettingsDialog } from './components';
|
|
22
|
-
import meta, { SETTINGS_PLUGIN } from './meta';
|
|
23
|
-
import translations from './translations';
|
|
24
|
-
|
|
25
|
-
const DEFAULT_PLUGIN = 'dxos.org/plugin/registry';
|
|
26
|
-
|
|
27
|
-
export type SettingsPluginProvides = SurfaceProvides &
|
|
28
|
-
IntentResolverProvides &
|
|
29
|
-
GraphBuilderProvides &
|
|
30
|
-
TranslationsProvides;
|
|
31
|
-
|
|
32
|
-
type SettingsSettingsProps = {
|
|
33
|
-
selected: string;
|
|
34
|
-
};
|
|
35
|
-
|
|
36
|
-
/**
|
|
37
|
-
* Plugin for aggregating and rendering plugin settings.
|
|
38
|
-
*/
|
|
39
|
-
export const SettingsPlugin = (): PluginDefinition<SettingsPluginProvides> => {
|
|
40
|
-
const settings = new LocalStorageStore<SettingsSettingsProps>(SETTINGS_PLUGIN, { selected: DEFAULT_PLUGIN });
|
|
41
|
-
|
|
42
|
-
return {
|
|
43
|
-
meta,
|
|
44
|
-
ready: async () => {
|
|
45
|
-
settings.prop({ key: 'selected', type: LocalStorageStore.string() });
|
|
46
|
-
},
|
|
47
|
-
provides: {
|
|
48
|
-
surface: {
|
|
49
|
-
component: ({ data }) => {
|
|
50
|
-
switch (data.component) {
|
|
51
|
-
case `${SETTINGS_PLUGIN}/Settings`:
|
|
52
|
-
return (
|
|
53
|
-
<SettingsDialog
|
|
54
|
-
selected={settings.values.selected}
|
|
55
|
-
onSelected={(selected) => (settings.values.selected = selected)}
|
|
56
|
-
/>
|
|
57
|
-
);
|
|
58
|
-
|
|
59
|
-
default:
|
|
60
|
-
return null;
|
|
61
|
-
}
|
|
62
|
-
},
|
|
63
|
-
},
|
|
64
|
-
intent: {
|
|
65
|
-
resolver: (intent) => {
|
|
66
|
-
switch (intent.action) {
|
|
67
|
-
case SettingsAction.OPEN: {
|
|
68
|
-
if (intent.data?.plugin) {
|
|
69
|
-
settings.values.selected = intent.data?.plugin;
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
return {
|
|
73
|
-
intents: [
|
|
74
|
-
[
|
|
75
|
-
{
|
|
76
|
-
action: LayoutAction.SET_LAYOUT,
|
|
77
|
-
data: {
|
|
78
|
-
element: 'dialog',
|
|
79
|
-
component: `${SETTINGS_PLUGIN}/Settings`,
|
|
80
|
-
dialogBlockAlign: 'start',
|
|
81
|
-
},
|
|
82
|
-
},
|
|
83
|
-
],
|
|
84
|
-
],
|
|
85
|
-
};
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
},
|
|
89
|
-
},
|
|
90
|
-
graph: {
|
|
91
|
-
builder: (plugins) => {
|
|
92
|
-
const intentPlugin = resolvePlugin(plugins, parseIntentPlugin);
|
|
93
|
-
|
|
94
|
-
return createExtension({
|
|
95
|
-
id: SETTINGS_PLUGIN,
|
|
96
|
-
filter: (node): node is Node<null> => node.id === 'root',
|
|
97
|
-
actions: () => [
|
|
98
|
-
{
|
|
99
|
-
id: SETTINGS_PLUGIN,
|
|
100
|
-
data: async () => {
|
|
101
|
-
await intentPlugin?.provides.intent.dispatch({
|
|
102
|
-
plugin: SETTINGS_PLUGIN,
|
|
103
|
-
action: SettingsAction.OPEN,
|
|
104
|
-
});
|
|
105
|
-
},
|
|
106
|
-
properties: {
|
|
107
|
-
label: ['open settings label', { ns: SETTINGS_PLUGIN }],
|
|
108
|
-
icon: 'ph--gear--regular',
|
|
109
|
-
keyBinding: {
|
|
110
|
-
macos: 'meta+,',
|
|
111
|
-
windows: 'alt+,',
|
|
112
|
-
},
|
|
113
|
-
},
|
|
114
|
-
},
|
|
115
|
-
],
|
|
116
|
-
});
|
|
117
|
-
},
|
|
118
|
-
},
|
|
119
|
-
translations,
|
|
120
|
-
},
|
|
121
|
-
};
|
|
122
|
-
};
|