@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
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
import {
|
|
2
|
+
SETTINGS_ID,
|
|
3
|
+
SETTINGS_KEY,
|
|
4
|
+
meta
|
|
5
|
+
} from "./chunk-ONAYSYBX.mjs";
|
|
6
|
+
|
|
7
|
+
// src/capabilities/app-graph-builder/app-graph-builder.ts
|
|
8
|
+
import * as Effect from "effect/Effect";
|
|
9
|
+
import { Capabilities, Capability } from "@dxos/app-framework";
|
|
10
|
+
import { GraphBuilder, NodeMatcher } from "@dxos/app-graph";
|
|
11
|
+
import { AppCapabilities, SettingsOperation } from "@dxos/app-toolkit";
|
|
12
|
+
import { Operation } from "@dxos/operation";
|
|
13
|
+
import { isNonNullable } from "@dxos/util";
|
|
14
|
+
var app_graph_builder_default = Capability.makeModule(Effect.fnUntraced(function* () {
|
|
15
|
+
const capabilities = yield* Capability.Service;
|
|
16
|
+
const managerAtom = capabilities.atom(Capabilities.PluginManager);
|
|
17
|
+
const settingsAtom = capabilities.atom(AppCapabilities.Settings);
|
|
18
|
+
const extensions = yield* Effect.all([
|
|
19
|
+
GraphBuilder.createExtension({
|
|
20
|
+
id: `${meta.id}/action`,
|
|
21
|
+
match: NodeMatcher.whenRoot,
|
|
22
|
+
actions: () => Effect.succeed([
|
|
23
|
+
{
|
|
24
|
+
id: meta.id,
|
|
25
|
+
data: () => Operation.invoke(SettingsOperation.Open, {}),
|
|
26
|
+
properties: {
|
|
27
|
+
label: [
|
|
28
|
+
"open settings label",
|
|
29
|
+
{
|
|
30
|
+
ns: meta.id
|
|
31
|
+
}
|
|
32
|
+
],
|
|
33
|
+
icon: "ph--gear--regular",
|
|
34
|
+
disposition: "menu",
|
|
35
|
+
keyBinding: {
|
|
36
|
+
macos: "meta+,",
|
|
37
|
+
windows: "alt+,"
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
])
|
|
42
|
+
}),
|
|
43
|
+
GraphBuilder.createExtension({
|
|
44
|
+
id: `${meta.id}/core`,
|
|
45
|
+
match: NodeMatcher.whenRoot,
|
|
46
|
+
connector: () => Effect.succeed([
|
|
47
|
+
{
|
|
48
|
+
id: SETTINGS_ID,
|
|
49
|
+
type: meta.id,
|
|
50
|
+
properties: {
|
|
51
|
+
label: [
|
|
52
|
+
"app settings label",
|
|
53
|
+
{
|
|
54
|
+
ns: meta.id
|
|
55
|
+
}
|
|
56
|
+
],
|
|
57
|
+
icon: "ph--gear--regular",
|
|
58
|
+
disposition: "pin-end",
|
|
59
|
+
position: "hoist",
|
|
60
|
+
testId: "treeView.appSettings"
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
])
|
|
64
|
+
}),
|
|
65
|
+
GraphBuilder.createExtension({
|
|
66
|
+
id: `${meta.id}/plugins`,
|
|
67
|
+
match: NodeMatcher.whenId(SETTINGS_ID),
|
|
68
|
+
connector: (node, get) => {
|
|
69
|
+
const [manager] = get(managerAtom);
|
|
70
|
+
const allSettings = get(settingsAtom);
|
|
71
|
+
return Effect.succeed(manager.getPlugins().map((plugin) => {
|
|
72
|
+
const settings = allSettings.find((s) => s.prefix === plugin.meta.id);
|
|
73
|
+
if (!settings) {
|
|
74
|
+
return null;
|
|
75
|
+
}
|
|
76
|
+
return [
|
|
77
|
+
plugin.meta,
|
|
78
|
+
settings
|
|
79
|
+
];
|
|
80
|
+
}).filter(isNonNullable).map(([meta2, settings]) => ({
|
|
81
|
+
id: `${SETTINGS_KEY}:${meta2.id.replaceAll("/", ":")}`,
|
|
82
|
+
type: "category",
|
|
83
|
+
data: settings,
|
|
84
|
+
properties: {
|
|
85
|
+
label: meta2.name ?? meta2.id,
|
|
86
|
+
icon: meta2.icon ?? "ph--circle--regular"
|
|
87
|
+
}
|
|
88
|
+
})));
|
|
89
|
+
}
|
|
90
|
+
})
|
|
91
|
+
]);
|
|
92
|
+
return Capability.contributes(AppCapabilities.AppGraphBuilder, extensions);
|
|
93
|
+
}));
|
|
94
|
+
export {
|
|
95
|
+
app_graph_builder_default as default
|
|
96
|
+
};
|
|
97
|
+
//# sourceMappingURL=app-graph-builder-CCZGWQMT.mjs.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/capabilities/app-graph-builder/app-graph-builder.ts"],
|
|
4
|
+
"sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport * as Effect from 'effect/Effect';\n\nimport { Capabilities, Capability, type Plugin as Plugin$ } from '@dxos/app-framework';\nimport { GraphBuilder, NodeMatcher } from '@dxos/app-graph';\nimport { AppCapabilities, SettingsOperation } from '@dxos/app-toolkit';\nimport { Operation } from '@dxos/operation';\nimport { isNonNullable } from '@dxos/util';\n\nimport { SETTINGS_ID, SETTINGS_KEY } from '../../actions';\nimport { meta } from '../../meta';\n\nexport default Capability.makeModule(\n Effect.fnUntraced(function* () {\n // Get context for lazy capability access in callbacks.\n const capabilities = yield* Capability.Service;\n const managerAtom = capabilities.atom(Capabilities.PluginManager);\n const settingsAtom = capabilities.atom(AppCapabilities.Settings);\n\n const extensions = yield* Effect.all([\n GraphBuilder.createExtension({\n id: `${meta.id}/action`,\n match: NodeMatcher.whenRoot,\n actions: () =>\n Effect.succeed([\n {\n id: meta.id,\n data: () => Operation.invoke(SettingsOperation.Open, {}),\n properties: {\n label: ['open settings label', { ns: meta.id }],\n icon: 'ph--gear--regular',\n disposition: 'menu',\n keyBinding: {\n macos: 'meta+,',\n windows: 'alt+,',\n },\n },\n },\n ]),\n }),\n GraphBuilder.createExtension({\n id: `${meta.id}/core`,\n match: NodeMatcher.whenRoot,\n connector: () =>\n Effect.succeed([\n {\n id: SETTINGS_ID,\n type: meta.id,\n properties: {\n label: ['app settings label', { ns: meta.id }],\n icon: 'ph--gear--regular',\n disposition: 'pin-end',\n position: 'hoist',\n testId: 'treeView.appSettings',\n },\n },\n ]),\n }),\n GraphBuilder.createExtension({\n id: `${meta.id}/plugins`,\n match: NodeMatcher.whenId(SETTINGS_ID),\n connector: (node, get) => {\n const [manager] = get(managerAtom);\n const allSettings = get(settingsAtom);\n return Effect.succeed(\n manager\n .getPlugins()\n .map((plugin: Plugin$.Plugin): [Plugin$.Meta, AppCapabilities.Settings] | null => {\n const settings = allSettings.find((s) => s.prefix === plugin.meta.id);\n if (!settings) {\n return null;\n }\n\n return [plugin.meta, settings];\n })\n .filter(isNonNullable)\n .map(([meta, settings]: [Plugin$.Meta, AppCapabilities.Settings]) => ({\n id: `${SETTINGS_KEY}:${meta.id.replaceAll('/', ':')}`,\n type: 'category',\n data: settings,\n properties: {\n label: meta.name ?? meta.id,\n icon: meta.icon ?? 'ph--circle--regular',\n },\n })),\n );\n },\n }),\n ]);\n\n return Capability.contributes(AppCapabilities.AppGraphBuilder, extensions);\n }),\n);\n"],
|
|
5
|
+
"mappings": ";;;;;;;AAIA,YAAYA,YAAY;AAExB,SAASC,cAAcC,kBAA0C;AACjE,SAASC,cAAcC,mBAAmB;AAC1C,SAASC,iBAAiBC,yBAAyB;AACnD,SAASC,iBAAiB;AAC1B,SAASC,qBAAqB;AAK9B,IAAA,4BAAeC,WAAWC,WACjBC,kBAAW,aAAA;AAEhB,QAAMC,eAAe,OAAOH,WAAWI;AACvC,QAAMC,cAAcF,aAAaG,KAAKC,aAAaC,aAAa;AAChE,QAAMC,eAAeN,aAAaG,KAAKI,gBAAgBC,QAAQ;AAE/D,QAAMC,aAAa,OAAcC,WAAI;IACnCC,aAAaC,gBAAgB;MAC3BC,IAAI,GAAGC,KAAKD,EAAE;MACdE,OAAOC,YAAYC;MACnBC,SAAS,MACAC,eAAQ;QACb;UACEN,IAAIC,KAAKD;UACTO,MAAM,MAAMC,UAAUC,OAAOC,kBAAkBC,MAAM,CAAC,CAAA;UACtDC,YAAY;YACVC,OAAO;cAAC;cAAuB;gBAAEC,IAAIb,KAAKD;cAAG;;YAC7Ce,MAAM;YACNC,aAAa;YACbC,YAAY;cACVC,OAAO;cACPC,SAAS;YACX;UACF;QACF;OACD;IACL,CAAA;IACArB,aAAaC,gBAAgB;MAC3BC,IAAI,GAAGC,KAAKD,EAAE;MACdE,OAAOC,YAAYC;MACnBgB,WAAW,MACFd,eAAQ;QACb;UACEN,IAAIqB;UACJC,MAAMrB,KAAKD;UACXY,YAAY;YACVC,OAAO;cAAC;cAAsB;gBAAEC,IAAIb,KAAKD;cAAG;;YAC5Ce,MAAM;YACNC,aAAa;YACbO,UAAU;YACVC,QAAQ;UACV;QACF;OACD;IACL,CAAA;IACA1B,aAAaC,gBAAgB;MAC3BC,IAAI,GAAGC,KAAKD,EAAE;MACdE,OAAOC,YAAYsB,OAAOJ,WAAAA;MAC1BD,WAAW,CAACM,MAAMC,QAAAA;AAChB,cAAM,CAACC,OAAAA,IAAWD,IAAItC,WAAAA;AACtB,cAAMwC,cAAcF,IAAIlC,YAAAA;AACxB,eAAca,eACZsB,QACGE,WAAU,EACVC,IAAI,CAACC,WAAAA;AACJ,gBAAMC,WAAWJ,YAAYK,KAAK,CAACC,MAAMA,EAAEC,WAAWJ,OAAO/B,KAAKD,EAAE;AACpE,cAAI,CAACiC,UAAU;AACb,mBAAO;UACT;AAEA,iBAAO;YAACD,OAAO/B;YAAMgC;;QACvB,CAAA,EACCI,OAAOC,aAAAA,EACPP,IAAI,CAAC,CAAC9B,OAAMgC,QAAAA,OAAyD;UACpEjC,IAAI,GAAGuC,YAAAA,IAAgBtC,MAAKD,GAAGwC,WAAW,KAAK,GAAA,CAAA;UAC/ClB,MAAM;UACNf,MAAM0B;UACNrB,YAAY;YACVC,OAAOZ,MAAKwC,QAAQxC,MAAKD;YACzBe,MAAMd,MAAKc,QAAQ;UACrB;QACF,EAAA,CAAA;MAEN;IACF,CAAA;GACD;AAED,SAAO/B,WAAW0D,YAAYhD,gBAAgBiD,iBAAiB/C,UAAAA;AACjE,CAAA,CAAA;",
|
|
6
|
+
"names": ["Effect", "Capabilities", "Capability", "GraphBuilder", "NodeMatcher", "AppCapabilities", "SettingsOperation", "Operation", "isNonNullable", "Capability", "makeModule", "fnUntraced", "capabilities", "Service", "managerAtom", "atom", "Capabilities", "PluginManager", "settingsAtom", "AppCapabilities", "Settings", "extensions", "all", "GraphBuilder", "createExtension", "id", "meta", "match", "NodeMatcher", "whenRoot", "actions", "succeed", "data", "Operation", "invoke", "SettingsOperation", "Open", "properties", "label", "ns", "icon", "disposition", "keyBinding", "macos", "windows", "connector", "SETTINGS_ID", "type", "position", "testId", "whenId", "node", "get", "manager", "allSettings", "getPlugins", "map", "plugin", "settings", "find", "s", "prefix", "filter", "isNonNullable", "SETTINGS_KEY", "replaceAll", "name", "contributes", "AppGraphBuilder"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
// src/meta.ts
|
|
2
|
+
var meta = {
|
|
3
|
+
id: "dxos.org/plugin/settings",
|
|
4
|
+
name: "Settings"
|
|
5
|
+
};
|
|
6
|
+
|
|
7
|
+
// src/actions.ts
|
|
8
|
+
import * as Schema from "effect/Schema";
|
|
9
|
+
var SETTINGS_ID = "!dxos:settings";
|
|
10
|
+
var SETTINGS_KEY = "settings";
|
|
11
|
+
(function(SettingsAction2) {
|
|
12
|
+
class Open extends Schema.TaggedClass()(`${meta.id}/open`, {
|
|
13
|
+
input: Schema.Struct({
|
|
14
|
+
plugin: Schema.optional(Schema.String)
|
|
15
|
+
}),
|
|
16
|
+
output: Schema.Void
|
|
17
|
+
}) {
|
|
18
|
+
}
|
|
19
|
+
SettingsAction2.Open = Open;
|
|
20
|
+
class OpenPluginRegistry extends Schema.TaggedClass()(`${meta.id}/open-plugin-registry`, {
|
|
21
|
+
input: Schema.Void,
|
|
22
|
+
output: Schema.Void
|
|
23
|
+
}) {
|
|
24
|
+
}
|
|
25
|
+
SettingsAction2.OpenPluginRegistry = OpenPluginRegistry;
|
|
26
|
+
})(SettingsAction || (SettingsAction = {}));
|
|
27
|
+
var SettingsAction;
|
|
28
|
+
|
|
29
|
+
export {
|
|
30
|
+
meta,
|
|
31
|
+
SETTINGS_ID,
|
|
32
|
+
SETTINGS_KEY,
|
|
33
|
+
SettingsAction
|
|
34
|
+
};
|
|
35
|
+
//# sourceMappingURL=chunk-ONAYSYBX.mjs.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/meta.ts", "../../../src/actions.ts"],
|
|
4
|
+
"sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport { type Plugin } from '@dxos/app-framework';\n\nexport const meta: Plugin.Meta = {\n id: 'dxos.org/plugin/settings',\n name: 'Settings',\n};\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport * as Schema from 'effect/Schema';\n\nimport { meta } from './meta';\n\nexport const SETTINGS_ID = '!dxos:settings';\nexport const SETTINGS_KEY = 'settings';\n\nexport namespace SettingsAction {\n export class Open extends Schema.TaggedClass<Open>()(`${meta.id}/open`, {\n input: Schema.Struct({\n plugin: Schema.optional(Schema.String),\n }),\n output: Schema.Void,\n }) {}\n\n export class OpenPluginRegistry extends Schema.TaggedClass<OpenPluginRegistry>()(`${meta.id}/open-plugin-registry`, {\n input: Schema.Void,\n output: Schema.Void,\n }) {}\n}\n"],
|
|
5
|
+
"mappings": ";AAMO,IAAMA,OAAoB;EAC/BC,IAAI;EACJC,MAAM;AACR;;;ACLA,YAAYC,YAAY;AAIjB,IAAMC,cAAc;AACpB,IAAMC,eAAe;UAEXC,iBAAAA;EACR,MAAMC,aAAoBC,mBAAW,EAAS,GAAGC,KAAKC,EAAE,SAAS;IACtEC,OAAcC,cAAO;MACnBC,QAAeC,gBAAgBC,aAAM;IACvC,CAAA;IACAC,QAAeC;EACjB,CAAA,EAAA;EAAI;kBALSV,OAAAA;EAON,MAAMW,2BAAkCV,mBAAW,EAAuB,GAAGC,KAAKC,EAAE,yBAAyB;IAClHC,OAAcM;IACdD,QAAeC;EACjB,CAAA,EAAA;EAAI;kBAHSC,qBAAAA;AAIf,GAZiBZ,mBAAAA,iBAAAA,CAAAA,EAAAA;;",
|
|
6
|
+
"names": ["meta", "id", "name", "Schema", "SETTINGS_ID", "SETTINGS_KEY", "SettingsAction", "Open", "TaggedClass", "meta", "id", "input", "Struct", "plugin", "optional", "String", "output", "Void", "OpenPluginRegistry"]
|
|
7
|
+
}
|
|
@@ -1,257 +1,46 @@
|
|
|
1
1
|
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
2
|
+
SETTINGS_ID,
|
|
3
|
+
SETTINGS_KEY,
|
|
4
|
+
SettingsAction,
|
|
5
|
+
meta
|
|
6
|
+
} from "./chunk-ONAYSYBX.mjs";
|
|
5
7
|
|
|
6
|
-
//
|
|
7
|
-
import
|
|
8
|
-
import {
|
|
9
|
-
import { LocalStorageStore } from "@dxos/local-storage";
|
|
10
|
-
import { createExtension } from "@dxos/plugin-graph";
|
|
8
|
+
// src/SettingsPlugin.ts
|
|
9
|
+
import { Plugin } from "@dxos/app-framework";
|
|
10
|
+
import { AppPlugin } from "@dxos/app-toolkit";
|
|
11
11
|
|
|
12
|
-
//
|
|
13
|
-
import
|
|
14
|
-
|
|
15
|
-
import { Button, Dialog, Icon, useTranslation } from "@dxos/react-ui";
|
|
16
|
-
import { Tabs } from "@dxos/react-ui-tabs";
|
|
17
|
-
import { getSize } from "@dxos/react-ui-theme";
|
|
18
|
-
import { nonNullable } from "@dxos/util";
|
|
19
|
-
var SettingsDialog = ({ selected, onSelected }) => {
|
|
20
|
-
const { t } = useTranslation(SETTINGS_PLUGIN);
|
|
21
|
-
const { plugins, enabled } = usePlugins();
|
|
22
|
-
const core = [
|
|
23
|
-
"dxos.org/plugin/layout",
|
|
24
|
-
"dxos.org/plugin/deck",
|
|
25
|
-
"dxos.org/plugin/files",
|
|
26
|
-
"dxos.org/plugin/space",
|
|
27
|
-
"dxos.org/plugin/stack",
|
|
28
|
-
"dxos.org/plugin/observability",
|
|
29
|
-
"dxos.org/plugin/registry"
|
|
30
|
-
];
|
|
31
|
-
const sortPlugin = ({ name: a }, { name: b }) => a?.localeCompare(b ?? "") ?? 0;
|
|
32
|
-
const corePlugins = core.map((id) => plugins.find((plugin) => plugin.meta.id === id)?.meta).filter(nonNullable).sort(sortPlugin);
|
|
33
|
-
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);
|
|
34
|
-
const [tabsActivePart, setTabsActivePart] = useState("list");
|
|
35
|
-
return /* @__PURE__ */ React.createElement(Dialog.Content, {
|
|
36
|
-
classNames: "p-0 bs-content max-bs-full md:max-is-[40rem] overflow-hidden"
|
|
37
|
-
}, /* @__PURE__ */ React.createElement("div", {
|
|
38
|
-
role: "none",
|
|
39
|
-
className: "flex justify-between mbe-1 pbs-3 pis-2 pie-3 @md:pbs-4 @md:pis-4 @md:pie-5"
|
|
40
|
-
}, /* @__PURE__ */ React.createElement(Dialog.Title, {
|
|
41
|
-
onClick: () => setTabsActivePart("list"),
|
|
42
|
-
"aria-description": t("click to return to tablist description"),
|
|
43
|
-
classNames: "flex cursor-pointer items-center group/title"
|
|
44
|
-
}, /* @__PURE__ */ React.createElement(Icon, {
|
|
45
|
-
icon: "ph--caret-left--regular",
|
|
46
|
-
classNames: [
|
|
47
|
-
"@md:hidden",
|
|
48
|
-
getSize(4),
|
|
49
|
-
tabsActivePart === "list" && "invisible"
|
|
50
|
-
]
|
|
51
|
-
}), /* @__PURE__ */ React.createElement("span", {
|
|
52
|
-
className: tabsActivePart !== "list" ? "group-hover/title:underline @md:group-hover/title:no-underline underline-offset-4 decoration-1" : ""
|
|
53
|
-
}, t("settings dialog title"))), /* @__PURE__ */ React.createElement(Dialog.Close, {
|
|
54
|
-
asChild: true
|
|
55
|
-
}, /* @__PURE__ */ React.createElement(Button, {
|
|
56
|
-
density: "fine",
|
|
57
|
-
variant: "ghost",
|
|
58
|
-
autoFocus: true
|
|
59
|
-
}, /* @__PURE__ */ React.createElement(Icon, {
|
|
60
|
-
icon: "ph--x--regular",
|
|
61
|
-
size: 3
|
|
62
|
-
})))), /* @__PURE__ */ React.createElement(Tabs.Root, {
|
|
63
|
-
orientation: "vertical",
|
|
64
|
-
value: selected,
|
|
65
|
-
onValueChange: (nextSelected) => onSelected(nextSelected),
|
|
66
|
-
activePart: tabsActivePart,
|
|
67
|
-
onActivePartChange: setTabsActivePart,
|
|
68
|
-
classNames: "flex flex-col flex-1 mbs-2"
|
|
69
|
-
}, /* @__PURE__ */ React.createElement(Tabs.Viewport, {
|
|
70
|
-
classNames: "flex-1 min-bs-0"
|
|
71
|
-
}, /* @__PURE__ */ React.createElement("div", {
|
|
72
|
-
role: "none",
|
|
73
|
-
className: "overflow-y-auto pli-3 @md:pis-2 @md:pie-0 mbe-4 border-r border-separator"
|
|
74
|
-
}, /* @__PURE__ */ React.createElement(Tabs.Tablist, {
|
|
75
|
-
classNames: "flex flex-col gap-4 max-bs-none overflow-y-visible"
|
|
76
|
-
}, /* @__PURE__ */ React.createElement(PluginList, {
|
|
77
|
-
title: "Options",
|
|
78
|
-
plugins: corePlugins
|
|
79
|
-
}), filteredPlugins.length > 0 && /* @__PURE__ */ React.createElement(PluginList, {
|
|
80
|
-
title: "Plugins",
|
|
81
|
-
plugins: filteredPlugins
|
|
82
|
-
}))), corePlugins.map((plugin) => /* @__PURE__ */ React.createElement(Tabs.Tabpanel, {
|
|
83
|
-
key: plugin.id,
|
|
84
|
-
value: plugin.id,
|
|
85
|
-
classNames: "pli-3 @md:pli-5 max-bs-dvh overflow-y-auto"
|
|
86
|
-
}, /* @__PURE__ */ React.createElement(Surface, {
|
|
87
|
-
role: "settings",
|
|
88
|
-
data: {
|
|
89
|
-
plugin: plugin.id
|
|
90
|
-
}
|
|
91
|
-
}))), filteredPlugins.map((plugin) => /* @__PURE__ */ React.createElement(Tabs.Tabpanel, {
|
|
92
|
-
key: plugin.id,
|
|
93
|
-
value: plugin.id,
|
|
94
|
-
classNames: "pli-3 @md:pli-5 max-bs-dvh overflow-y-auto"
|
|
95
|
-
}, /* @__PURE__ */ React.createElement(Surface, {
|
|
96
|
-
role: "settings",
|
|
97
|
-
data: {
|
|
98
|
-
plugin: plugin.id
|
|
99
|
-
}
|
|
100
|
-
}))))));
|
|
101
|
-
};
|
|
102
|
-
var PluginList = ({ title, plugins }) => {
|
|
103
|
-
return /* @__PURE__ */ React.createElement("div", {
|
|
104
|
-
role: "none"
|
|
105
|
-
}, /* @__PURE__ */ React.createElement(Tabs.TabGroupHeading, {
|
|
106
|
-
classNames: "pli-1 mlb-2 mbs-4 @md:mbs-2"
|
|
107
|
-
}, title), /* @__PURE__ */ React.createElement("div", {
|
|
108
|
-
className: "flex flex-col ml-1"
|
|
109
|
-
}, plugins.map((plugin) => /* @__PURE__ */ React.createElement(Tabs.Tab, {
|
|
110
|
-
key: plugin.id,
|
|
111
|
-
value: plugin.id
|
|
112
|
-
}, plugin.name))));
|
|
113
|
-
};
|
|
12
|
+
// src/capabilities/app-graph-builder/index.ts
|
|
13
|
+
import { Capability } from "@dxos/app-framework";
|
|
14
|
+
var SettingsAppGraphBuilder = Capability.lazy("SettingsAppGraphBuilder", () => import("./app-graph-builder-CCZGWQMT.mjs"));
|
|
114
15
|
|
|
115
|
-
//
|
|
116
|
-
import
|
|
117
|
-
|
|
118
|
-
var SettingsValue = ({ label, description, secondary, children }) => {
|
|
119
|
-
const primary = /* @__PURE__ */ React2.createElement("div", {
|
|
120
|
-
role: "none",
|
|
121
|
-
className: "flex w-full gap-4 py-1"
|
|
122
|
-
}, /* @__PURE__ */ React2.createElement(Input.Root, null, /* @__PURE__ */ React2.createElement("div", {
|
|
123
|
-
role: "none",
|
|
124
|
-
className: "flex flex-col w-full"
|
|
125
|
-
}, /* @__PURE__ */ React2.createElement(Input.Label, {
|
|
126
|
-
classNames: "flex min-h-[40px] items-center"
|
|
127
|
-
}, label), description && /* @__PURE__ */ React2.createElement(Input.DescriptionAndValidation, {
|
|
128
|
-
classNames: "mbs-0.5"
|
|
129
|
-
}, /* @__PURE__ */ React2.createElement(Input.Description, null, description))), /* @__PURE__ */ React2.createElement("div", {
|
|
130
|
-
role: "none"
|
|
131
|
-
}, /* @__PURE__ */ React2.createElement("div", {
|
|
132
|
-
role: "none",
|
|
133
|
-
className: "flex min-h-[40px] items-center"
|
|
134
|
-
}, children))));
|
|
135
|
-
if (secondary) {
|
|
136
|
-
return /* @__PURE__ */ React2.createElement("div", {
|
|
137
|
-
role: "none",
|
|
138
|
-
className: "flex flex-col w-full"
|
|
139
|
-
}, primary, secondary);
|
|
140
|
-
}
|
|
141
|
-
return primary;
|
|
142
|
-
};
|
|
16
|
+
// src/capabilities/operation-resolver/index.ts
|
|
17
|
+
import { Capability as Capability2 } from "@dxos/app-framework";
|
|
18
|
+
var SettingsOperationResolver = Capability2.lazy("SettingsOperationResolver", () => import("./operation-resolver-IIUEJRBW.mjs"));
|
|
143
19
|
|
|
144
|
-
//
|
|
145
|
-
var
|
|
20
|
+
// src/translations.ts
|
|
21
|
+
var translations = [
|
|
146
22
|
{
|
|
147
23
|
"en-US": {
|
|
148
|
-
[
|
|
149
|
-
"open settings label": "
|
|
150
|
-
"settings
|
|
151
|
-
"back label": "Back",
|
|
152
|
-
"click to return to tablist description": "Click the title to return to the settings menu"
|
|
24
|
+
[meta.id]: {
|
|
25
|
+
"open settings label": "Open settings",
|
|
26
|
+
"app settings label": "Settings"
|
|
153
27
|
}
|
|
154
28
|
}
|
|
155
29
|
}
|
|
156
30
|
];
|
|
157
31
|
|
|
158
|
-
//
|
|
159
|
-
var
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
ready: async () => {
|
|
167
|
-
settings.prop({
|
|
168
|
-
key: "selected",
|
|
169
|
-
type: LocalStorageStore.string()
|
|
170
|
-
});
|
|
171
|
-
},
|
|
172
|
-
provides: {
|
|
173
|
-
surface: {
|
|
174
|
-
component: ({ data }) => {
|
|
175
|
-
switch (data.component) {
|
|
176
|
-
case `${SETTINGS_PLUGIN}/Settings`:
|
|
177
|
-
return /* @__PURE__ */ React3.createElement(SettingsDialog, {
|
|
178
|
-
selected: settings.values.selected,
|
|
179
|
-
onSelected: (selected) => settings.values.selected = selected
|
|
180
|
-
});
|
|
181
|
-
default:
|
|
182
|
-
return null;
|
|
183
|
-
}
|
|
184
|
-
}
|
|
185
|
-
},
|
|
186
|
-
intent: {
|
|
187
|
-
resolver: (intent) => {
|
|
188
|
-
switch (intent.action) {
|
|
189
|
-
case SettingsAction.OPEN: {
|
|
190
|
-
if (intent.data?.plugin) {
|
|
191
|
-
settings.values.selected = intent.data?.plugin;
|
|
192
|
-
}
|
|
193
|
-
return {
|
|
194
|
-
intents: [
|
|
195
|
-
[
|
|
196
|
-
{
|
|
197
|
-
action: LayoutAction.SET_LAYOUT,
|
|
198
|
-
data: {
|
|
199
|
-
element: "dialog",
|
|
200
|
-
component: `${SETTINGS_PLUGIN}/Settings`,
|
|
201
|
-
dialogBlockAlign: "start"
|
|
202
|
-
}
|
|
203
|
-
}
|
|
204
|
-
]
|
|
205
|
-
]
|
|
206
|
-
};
|
|
207
|
-
}
|
|
208
|
-
}
|
|
209
|
-
}
|
|
210
|
-
},
|
|
211
|
-
graph: {
|
|
212
|
-
builder: (plugins) => {
|
|
213
|
-
const intentPlugin = resolvePlugin(plugins, parseIntentPlugin);
|
|
214
|
-
return createExtension({
|
|
215
|
-
id: SETTINGS_PLUGIN,
|
|
216
|
-
filter: (node) => node.id === "root",
|
|
217
|
-
actions: () => [
|
|
218
|
-
{
|
|
219
|
-
id: SETTINGS_PLUGIN,
|
|
220
|
-
data: async () => {
|
|
221
|
-
await intentPlugin?.provides.intent.dispatch({
|
|
222
|
-
plugin: SETTINGS_PLUGIN,
|
|
223
|
-
action: SettingsAction.OPEN
|
|
224
|
-
});
|
|
225
|
-
},
|
|
226
|
-
properties: {
|
|
227
|
-
label: [
|
|
228
|
-
"open settings label",
|
|
229
|
-
{
|
|
230
|
-
ns: SETTINGS_PLUGIN
|
|
231
|
-
}
|
|
232
|
-
],
|
|
233
|
-
icon: "ph--gear--regular",
|
|
234
|
-
keyBinding: {
|
|
235
|
-
macos: "meta+,",
|
|
236
|
-
windows: "alt+,"
|
|
237
|
-
}
|
|
238
|
-
}
|
|
239
|
-
}
|
|
240
|
-
]
|
|
241
|
-
});
|
|
242
|
-
}
|
|
243
|
-
},
|
|
244
|
-
translations: translations_default
|
|
245
|
-
}
|
|
246
|
-
};
|
|
247
|
-
};
|
|
248
|
-
|
|
249
|
-
// packages/plugins/plugin-settings/src/index.ts
|
|
250
|
-
var src_default = SettingsPlugin;
|
|
32
|
+
// src/SettingsPlugin.ts
|
|
33
|
+
var SettingsPlugin = Plugin.define(meta).pipe(AppPlugin.addAppGraphModule({
|
|
34
|
+
activate: SettingsAppGraphBuilder
|
|
35
|
+
}), AppPlugin.addOperationResolverModule({
|
|
36
|
+
activate: SettingsOperationResolver
|
|
37
|
+
}), AppPlugin.addTranslationsModule({
|
|
38
|
+
translations
|
|
39
|
+
}), Plugin.make);
|
|
251
40
|
export {
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
41
|
+
SETTINGS_ID,
|
|
42
|
+
SETTINGS_KEY,
|
|
43
|
+
SettingsAction,
|
|
44
|
+
SettingsPlugin
|
|
256
45
|
};
|
|
257
46
|
//# sourceMappingURL=index.mjs.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
|
-
"sources": ["../../../src/SettingsPlugin.
|
|
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": "
|
|
6
|
-
"names": ["
|
|
3
|
+
"sources": ["../../../src/SettingsPlugin.ts", "../../../src/capabilities/app-graph-builder/index.ts", "../../../src/capabilities/operation-resolver/index.ts", "../../../src/translations.ts"],
|
|
4
|
+
"sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport { Plugin } from '@dxos/app-framework';\nimport { AppPlugin } from '@dxos/app-toolkit';\n\nimport { SettingsAppGraphBuilder, SettingsOperationResolver } from './capabilities';\nimport { meta } from './meta';\nimport { translations } from './translations';\n\nexport const SettingsPlugin = Plugin.define(meta).pipe(\n AppPlugin.addAppGraphModule({ activate: SettingsAppGraphBuilder }),\n AppPlugin.addOperationResolverModule({ activate: SettingsOperationResolver }),\n AppPlugin.addTranslationsModule({ translations }),\n Plugin.make,\n);\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport { Capability } from '@dxos/app-framework';\n\nexport const SettingsAppGraphBuilder = Capability.lazy('SettingsAppGraphBuilder', () => import('./app-graph-builder'));\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport { Capability } from '@dxos/app-framework';\n\nexport const SettingsOperationResolver = Capability.lazy(\n 'SettingsOperationResolver',\n () => import('./operation-resolver'),\n);\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport { type Resource } from '@dxos/app-toolkit';\n\nimport { meta } from './meta';\n\nexport const translations = [\n {\n 'en-US': {\n [meta.id]: {\n 'open settings label': 'Open settings',\n 'app settings label': 'Settings',\n },\n },\n },\n] as const satisfies Resource[];\n"],
|
|
5
|
+
"mappings": ";;;;;;;;AAIA,SAASA,cAAc;AACvB,SAASC,iBAAiB;;;ACD1B,SAASC,kBAAkB;AAEpB,IAAMC,0BAA0BC,WAAWC,KAAK,2BAA2B,MAAM,OAAO,kCAAA,CAAA;;;ACF/F,SAASC,cAAAA,mBAAkB;AAEpB,IAAMC,4BAA4BC,YAAWC,KAClD,6BACA,MAAM,OAAO,mCAAA,CAAA;;;ACAR,IAAMC,eAAe;EAC1B;IACE,SAAS;MACP,CAACC,KAAKC,EAAE,GAAG;QACT,uBAAuB;QACvB,sBAAsB;MACxB;IACF;EACF;;;;AHLK,IAAMC,iBAAiBC,OAAOC,OAAOC,IAAAA,EAAMC,KAChDC,UAAUC,kBAAkB;EAAEC,UAAUC;AAAwB,CAAA,GAChEH,UAAUI,2BAA2B;EAAEF,UAAUG;AAA0B,CAAA,GAC3EL,UAAUM,sBAAsB;EAAEC;AAAa,CAAA,GAC/CX,OAAOY,IAAI;",
|
|
6
|
+
"names": ["Plugin", "AppPlugin", "Capability", "SettingsAppGraphBuilder", "Capability", "lazy", "Capability", "SettingsOperationResolver", "Capability", "lazy", "translations", "meta", "id", "SettingsPlugin", "Plugin", "define", "meta", "pipe", "AppPlugin", "addAppGraphModule", "activate", "SettingsAppGraphBuilder", "addOperationResolverModule", "SettingsOperationResolver", "addTranslationsModule", "translations", "make"]
|
|
7
7
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"inputs":{"
|
|
1
|
+
{"inputs":{"src/meta.ts":{"bytes":752,"imports":[],"format":"esm"},"src/actions.ts":{"bytes":2730,"imports":[{"path":"effect/Schema","kind":"import-statement","external":true},{"path":"src/meta.ts","kind":"import-statement","original":"./meta"}],"format":"esm"},"src/capabilities/app-graph-builder/app-graph-builder.ts":{"bytes":12156,"imports":[{"path":"effect/Effect","kind":"import-statement","external":true},{"path":"@dxos/app-framework","kind":"import-statement","external":true},{"path":"@dxos/app-graph","kind":"import-statement","external":true},{"path":"@dxos/app-toolkit","kind":"import-statement","external":true},{"path":"@dxos/operation","kind":"import-statement","external":true},{"path":"@dxos/util","kind":"import-statement","external":true},{"path":"src/actions.ts","kind":"import-statement","original":"../../actions"},{"path":"src/meta.ts","kind":"import-statement","original":"../../meta"}],"format":"esm"},"src/capabilities/app-graph-builder/index.ts":{"bytes":994,"imports":[{"path":"@dxos/app-framework","kind":"import-statement","external":true},{"path":"src/capabilities/app-graph-builder/app-graph-builder.ts","kind":"dynamic-import","original":"./app-graph-builder"}],"format":"esm"},"src/capabilities/operation-resolver/operation-resolver.ts":{"bytes":6600,"imports":[{"path":"effect/Effect","kind":"import-statement","external":true},{"path":"@dxos/app-framework","kind":"import-statement","external":true},{"path":"@dxos/app-toolkit","kind":"import-statement","external":true},{"path":"@dxos/operation","kind":"import-statement","external":true},{"path":"src/actions.ts","kind":"import-statement","original":"../../actions"}],"format":"esm"},"src/capabilities/operation-resolver/index.ts":{"bytes":1024,"imports":[{"path":"@dxos/app-framework","kind":"import-statement","external":true},{"path":"src/capabilities/operation-resolver/operation-resolver.ts","kind":"dynamic-import","original":"./operation-resolver"}],"format":"esm"},"src/capabilities/index.ts":{"bytes":611,"imports":[{"path":"src/capabilities/app-graph-builder/index.ts","kind":"import-statement","original":"./app-graph-builder"},{"path":"src/capabilities/operation-resolver/index.ts","kind":"import-statement","original":"./operation-resolver"}],"format":"esm"},"src/translations.ts":{"bytes":1287,"imports":[{"path":"src/meta.ts","kind":"import-statement","original":"./meta"}],"format":"esm"},"src/SettingsPlugin.ts":{"bytes":2427,"imports":[{"path":"@dxos/app-framework","kind":"import-statement","external":true},{"path":"@dxos/app-toolkit","kind":"import-statement","external":true},{"path":"src/capabilities/index.ts","kind":"import-statement","original":"./capabilities"},{"path":"src/meta.ts","kind":"import-statement","original":"./meta"},{"path":"src/translations.ts","kind":"import-statement","original":"./translations"}],"format":"esm"},"src/index.ts":{"bytes":564,"imports":[{"path":"src/actions.ts","kind":"import-statement","original":"./actions"},{"path":"src/SettingsPlugin.ts","kind":"import-statement","original":"./SettingsPlugin"}],"format":"esm"}},"outputs":{"dist/lib/browser/index.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":2569},"dist/lib/browser/index.mjs":{"imports":[{"path":"dist/lib/browser/chunk-ONAYSYBX.mjs","kind":"import-statement"},{"path":"@dxos/app-framework","kind":"import-statement","external":true},{"path":"@dxos/app-toolkit","kind":"import-statement","external":true},{"path":"@dxos/app-framework","kind":"import-statement","external":true},{"path":"dist/lib/browser/app-graph-builder-CCZGWQMT.mjs","kind":"dynamic-import"},{"path":"@dxos/app-framework","kind":"import-statement","external":true},{"path":"dist/lib/browser/operation-resolver-IIUEJRBW.mjs","kind":"dynamic-import"}],"exports":["SETTINGS_ID","SETTINGS_KEY","SettingsAction","SettingsPlugin"],"entryPoint":"src/index.ts","inputs":{"src/index.ts":{"bytesInOutput":0},"src/SettingsPlugin.ts":{"bytesInOutput":357},"src/capabilities/app-graph-builder/index.ts":{"bytesInOutput":174},"src/capabilities/index.ts":{"bytesInOutput":0},"src/capabilities/operation-resolver/index.ts":{"bytesInOutput":195},"src/translations.ts":{"bytesInOutput":169}},"bytes":1277},"dist/lib/browser/app-graph-builder-CCZGWQMT.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":5968},"dist/lib/browser/app-graph-builder-CCZGWQMT.mjs":{"imports":[{"path":"dist/lib/browser/chunk-ONAYSYBX.mjs","kind":"import-statement"},{"path":"effect/Effect","kind":"import-statement","external":true},{"path":"@dxos/app-framework","kind":"import-statement","external":true},{"path":"@dxos/app-graph","kind":"import-statement","external":true},{"path":"@dxos/app-toolkit","kind":"import-statement","external":true},{"path":"@dxos/operation","kind":"import-statement","external":true},{"path":"@dxos/util","kind":"import-statement","external":true}],"exports":["default"],"entryPoint":"src/capabilities/app-graph-builder/app-graph-builder.ts","inputs":{"src/capabilities/app-graph-builder/app-graph-builder.ts":{"bytesInOutput":2761}},"bytes":3006},"dist/lib/browser/operation-resolver-IIUEJRBW.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":3213},"dist/lib/browser/operation-resolver-IIUEJRBW.mjs":{"imports":[{"path":"dist/lib/browser/chunk-ONAYSYBX.mjs","kind":"import-statement"},{"path":"effect/Effect","kind":"import-statement","external":true},{"path":"@dxos/app-framework","kind":"import-statement","external":true},{"path":"@dxos/app-toolkit","kind":"import-statement","external":true},{"path":"@dxos/operation","kind":"import-statement","external":true}],"exports":["default"],"entryPoint":"src/capabilities/operation-resolver/operation-resolver.ts","inputs":{"src/capabilities/operation-resolver/operation-resolver.ts":{"bytesInOutput":1481}},"bytes":1722},"dist/lib/browser/chunk-ONAYSYBX.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":1582},"dist/lib/browser/chunk-ONAYSYBX.mjs":{"imports":[{"path":"effect/Schema","kind":"import-statement","external":true}],"exports":["SETTINGS_ID","SETTINGS_KEY","SettingsAction","meta"],"inputs":{"src/meta.ts":{"bytesInOutput":69},"src/actions.ts":{"bytesInOutput":622}},"bytes":838}}}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import {
|
|
2
|
+
SETTINGS_ID,
|
|
3
|
+
SETTINGS_KEY
|
|
4
|
+
} from "./chunk-ONAYSYBX.mjs";
|
|
5
|
+
|
|
6
|
+
// src/capabilities/operation-resolver/operation-resolver.ts
|
|
7
|
+
import * as Effect from "effect/Effect";
|
|
8
|
+
import { Capabilities, Capability } from "@dxos/app-framework";
|
|
9
|
+
import { LayoutOperation, SettingsOperation } from "@dxos/app-toolkit";
|
|
10
|
+
import { OperationResolver } from "@dxos/operation";
|
|
11
|
+
var operation_resolver_default = Capability.makeModule(Effect.fnUntraced(function* () {
|
|
12
|
+
return Capability.contributes(Capabilities.OperationResolver, [
|
|
13
|
+
//
|
|
14
|
+
// Open Settings
|
|
15
|
+
//
|
|
16
|
+
OperationResolver.make({
|
|
17
|
+
operation: SettingsOperation.Open,
|
|
18
|
+
handler: (input) => Effect.gen(function* () {
|
|
19
|
+
const { invoke } = yield* Capability.get(Capabilities.OperationInvoker);
|
|
20
|
+
yield* invoke(LayoutOperation.SwitchWorkspace, {
|
|
21
|
+
subject: SETTINGS_ID
|
|
22
|
+
});
|
|
23
|
+
if (input.plugin) {
|
|
24
|
+
yield* Effect.fork(invoke(LayoutOperation.Open, {
|
|
25
|
+
subject: [
|
|
26
|
+
`${SETTINGS_KEY}:${input.plugin.replaceAll("/", ":")}`
|
|
27
|
+
]
|
|
28
|
+
}));
|
|
29
|
+
}
|
|
30
|
+
})
|
|
31
|
+
}),
|
|
32
|
+
//
|
|
33
|
+
// Open Plugin Registry
|
|
34
|
+
//
|
|
35
|
+
OperationResolver.make({
|
|
36
|
+
operation: SettingsOperation.OpenPluginRegistry,
|
|
37
|
+
handler: () => Effect.gen(function* () {
|
|
38
|
+
const { invoke } = yield* Capability.get(Capabilities.OperationInvoker);
|
|
39
|
+
yield* invoke(LayoutOperation.SwitchWorkspace, {
|
|
40
|
+
subject: SETTINGS_ID
|
|
41
|
+
});
|
|
42
|
+
yield* Effect.fork(invoke(LayoutOperation.Open, {
|
|
43
|
+
subject: [
|
|
44
|
+
`${SETTINGS_KEY}:plugins`
|
|
45
|
+
]
|
|
46
|
+
}));
|
|
47
|
+
})
|
|
48
|
+
})
|
|
49
|
+
]);
|
|
50
|
+
}));
|
|
51
|
+
export {
|
|
52
|
+
operation_resolver_default as default
|
|
53
|
+
};
|
|
54
|
+
//# sourceMappingURL=operation-resolver-IIUEJRBW.mjs.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/capabilities/operation-resolver/operation-resolver.ts"],
|
|
4
|
+
"sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport * as Effect from 'effect/Effect';\n\nimport { Capabilities, Capability } from '@dxos/app-framework';\nimport { LayoutOperation, SettingsOperation } from '@dxos/app-toolkit';\nimport { OperationResolver } from '@dxos/operation';\n\nimport { SETTINGS_ID, SETTINGS_KEY } from '../../actions';\n\nexport default Capability.makeModule(\n Effect.fnUntraced(function* () {\n return Capability.contributes(Capabilities.OperationResolver, [\n //\n // Open Settings\n //\n OperationResolver.make({\n operation: SettingsOperation.Open,\n handler: (input) =>\n Effect.gen(function* () {\n const { invoke } = yield* Capability.get(Capabilities.OperationInvoker);\n yield* invoke(LayoutOperation.SwitchWorkspace, { subject: SETTINGS_ID });\n if (input.plugin) {\n // Fire and forget the open operation.\n yield* Effect.fork(\n invoke(LayoutOperation.Open, {\n subject: [`${SETTINGS_KEY}:${input.plugin.replaceAll('/', ':')}`],\n }),\n );\n }\n }),\n }),\n\n //\n // Open Plugin Registry\n //\n OperationResolver.make({\n operation: SettingsOperation.OpenPluginRegistry,\n handler: () =>\n Effect.gen(function* () {\n const { invoke } = yield* Capability.get(Capabilities.OperationInvoker);\n yield* invoke(LayoutOperation.SwitchWorkspace, { subject: SETTINGS_ID });\n yield* Effect.fork(\n invoke(LayoutOperation.Open, {\n subject: [`${SETTINGS_KEY}:plugins`],\n }),\n );\n }),\n }),\n ]);\n }),\n);\n"],
|
|
5
|
+
"mappings": ";;;;;;AAIA,YAAYA,YAAY;AAExB,SAASC,cAAcC,kBAAkB;AACzC,SAASC,iBAAiBC,yBAAyB;AACnD,SAASC,yBAAyB;AAIlC,IAAA,6BAAeC,WAAWC,WACjBC,kBAAW,aAAA;AAChB,SAAOF,WAAWG,YAAYC,aAAaC,mBAAmB;;;;IAI5DA,kBAAkBC,KAAK;MACrBC,WAAWC,kBAAkBC;MAC7BC,SAAS,CAACC,UACDC,WAAI,aAAA;AACT,cAAM,EAAEC,OAAM,IAAK,OAAOb,WAAWc,IAAIV,aAAaW,gBAAgB;AACtE,eAAOF,OAAOG,gBAAgBC,iBAAiB;UAAEC,SAASC;QAAY,CAAA;AACtE,YAAIR,MAAMS,QAAQ;AAEhB,iBAAcC,YACZR,OAAOG,gBAAgBP,MAAM;YAC3BS,SAAS;cAAC,GAAGI,YAAAA,IAAgBX,MAAMS,OAAOG,WAAW,KAAK,GAAA,CAAA;;UAC5D,CAAA,CAAA;QAEJ;MACF,CAAA;IACJ,CAAA;;;;IAKAlB,kBAAkBC,KAAK;MACrBC,WAAWC,kBAAkBgB;MAC7Bd,SAAS,MACAE,WAAI,aAAA;AACT,cAAM,EAAEC,OAAM,IAAK,OAAOb,WAAWc,IAAIV,aAAaW,gBAAgB;AACtE,eAAOF,OAAOG,gBAAgBC,iBAAiB;UAAEC,SAASC;QAAY,CAAA;AACtE,eAAcE,YACZR,OAAOG,gBAAgBP,MAAM;UAC3BS,SAAS;YAAC,GAAGI,YAAAA;;QACf,CAAA,CAAA;MAEJ,CAAA;IACJ,CAAA;GACD;AACH,CAAA,CAAA;",
|
|
6
|
+
"names": ["Effect", "Capabilities", "Capability", "LayoutOperation", "SettingsOperation", "OperationResolver", "Capability", "makeModule", "fnUntraced", "contributes", "Capabilities", "OperationResolver", "make", "operation", "SettingsOperation", "Open", "handler", "input", "gen", "invoke", "get", "OperationInvoker", "LayoutOperation", "SwitchWorkspace", "subject", "SETTINGS_ID", "plugin", "fork", "SETTINGS_KEY", "replaceAll", "OpenPluginRegistry"]
|
|
7
|
+
}
|