@dxos/plugin-settings 0.9.0 → 0.9.1-staging.ee54ba693a
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/neutral/chunk-6FYMXQBX.mjs +14 -0
- package/dist/lib/neutral/chunk-6FYMXQBX.mjs.map +7 -0
- package/dist/lib/neutral/chunk-P5B3UTFE.mjs +23 -0
- package/dist/lib/neutral/chunk-P5B3UTFE.mjs.map +7 -0
- package/dist/lib/neutral/index.mjs +29 -7
- package/dist/lib/neutral/index.mjs.map +4 -4
- package/dist/lib/neutral/meta.json +1 -1
- package/dist/lib/neutral/{open-NRUWKEGC.mjs → open-OXJVRO33.mjs} +6 -6
- package/dist/lib/neutral/open-OXJVRO33.mjs.map +7 -0
- package/dist/lib/neutral/{open-plugin-registry-XGFG2JWB.mjs → open-plugin-registry-HWRSVH4V.mjs} +6 -6
- package/dist/lib/neutral/open-plugin-registry-HWRSVH4V.mjs.map +7 -0
- package/dist/lib/neutral/plugin.mjs +2 -2
- package/dist/lib/neutral/translations.mjs +1 -1
- package/dist/lib/neutral/translations.mjs.map +3 -3
- package/dist/types/dx.config.d.ts +28 -0
- package/dist/types/dx.config.d.ts.map +1 -0
- package/dist/types/src/actions.d.ts.map +1 -1
- package/dist/types/src/capabilities/app-graph-builder.d.ts +1 -2
- package/dist/types/src/capabilities/app-graph-builder.d.ts.map +1 -1
- package/dist/types/src/capabilities/index.d.ts +2 -2
- package/dist/types/src/capabilities/index.d.ts.map +1 -1
- package/dist/types/src/capabilities/react-surface.d.ts +2 -2
- package/dist/types/src/capabilities/react-surface.d.ts.map +1 -1
- package/dist/types/src/containers/DefaultSettings/DefaultSettings.d.ts +17 -0
- package/dist/types/src/containers/DefaultSettings/DefaultSettings.d.ts.map +1 -0
- package/dist/types/src/containers/DefaultSettings/index.d.ts +2 -0
- package/dist/types/src/containers/DefaultSettings/index.d.ts.map +1 -0
- package/dist/types/src/containers/index.d.ts +2 -0
- package/dist/types/src/containers/index.d.ts.map +1 -0
- package/dist/types/src/index.d.ts +1 -1
- package/dist/types/src/index.d.ts.map +1 -1
- package/dist/types/src/meta.d.ts +32 -2
- package/dist/types/src/meta.d.ts.map +1 -1
- package/dist/types/src/operations/open-plugin-registry.d.ts.map +1 -1
- package/dist/types/src/operations/open.d.ts.map +1 -1
- package/dist/types/src/translations.d.ts.map +1 -1
- package/dist/types/src/types/index.d.ts +7 -0
- package/dist/types/src/types/index.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/dx.config.ts +14 -0
- package/package.json +16 -14
- package/src/SettingsPlugin.test.ts +1 -1
- package/src/actions.ts +8 -5
- package/src/capabilities/app-graph-builder.ts +17 -13
- package/src/capabilities/react-surface.tsx +7 -28
- package/src/containers/DefaultSettings/DefaultSettings.tsx +46 -0
- package/src/containers/DefaultSettings/index.ts +5 -0
- package/src/containers/index.ts +5 -0
- package/src/index.ts +1 -1
- package/src/meta.ts +3 -7
- package/src/operations/open-plugin-registry.ts +4 -4
- package/src/operations/open.ts +4 -4
- package/src/translations.ts +3 -3
- package/src/types/index.ts +12 -2
- package/dist/lib/neutral/chunk-3DJRTSII.mjs +0 -16
- package/dist/lib/neutral/chunk-3DJRTSII.mjs.map +0 -7
- package/dist/lib/neutral/chunk-J2FJOTAW.mjs +0 -28
- package/dist/lib/neutral/chunk-J2FJOTAW.mjs.map +0 -7
- package/dist/lib/neutral/open-NRUWKEGC.mjs.map +0 -7
- package/dist/lib/neutral/open-plugin-registry-XGFG2JWB.mjs.map +0 -7
package/dx.config.ts
ADDED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dxos/plugin-settings",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.1-staging.ee54ba693a",
|
|
4
4
|
"description": "DXOS Settings plugin for managing application settings.",
|
|
5
5
|
"homepage": "https://dxos.org",
|
|
6
6
|
"bugs": "https://github.com/dxos/dxos/issues",
|
|
@@ -14,6 +14,7 @@
|
|
|
14
14
|
"type": "module",
|
|
15
15
|
"imports": {
|
|
16
16
|
"#capabilities": "./src/capabilities/index.ts",
|
|
17
|
+
"#containers": "./src/containers/index.ts",
|
|
17
18
|
"#meta": "./src/meta.ts",
|
|
18
19
|
"#operations": "./src/operations/index.ts",
|
|
19
20
|
"#plugin": "./src/SettingsPlugin.ts",
|
|
@@ -45,26 +46,27 @@
|
|
|
45
46
|
"types": "dist/types/src/index.d.ts",
|
|
46
47
|
"files": [
|
|
47
48
|
"dist",
|
|
49
|
+
"dx.config.ts",
|
|
48
50
|
"src"
|
|
49
51
|
],
|
|
50
52
|
"dependencies": {
|
|
51
|
-
"@dxos/app-framework": "0.9.
|
|
52
|
-
"@dxos/app-toolkit": "0.9.
|
|
53
|
-
"@dxos/
|
|
54
|
-
"@dxos/compute": "0.9.
|
|
55
|
-
"@dxos/
|
|
56
|
-
"@dxos/util": "0.9.
|
|
57
|
-
"@dxos/
|
|
53
|
+
"@dxos/app-framework": "0.9.1-staging.ee54ba693a",
|
|
54
|
+
"@dxos/app-toolkit": "0.9.1-staging.ee54ba693a",
|
|
55
|
+
"@dxos/react-ui-form": "0.9.1-staging.ee54ba693a",
|
|
56
|
+
"@dxos/compute": "0.9.1-staging.ee54ba693a",
|
|
57
|
+
"@dxos/keys": "0.9.1-staging.ee54ba693a",
|
|
58
|
+
"@dxos/util": "0.9.1-staging.ee54ba693a",
|
|
59
|
+
"@dxos/app-graph": "0.9.1-staging.ee54ba693a"
|
|
58
60
|
},
|
|
59
61
|
"devDependencies": {
|
|
60
|
-
"@types/react": "~19.2.
|
|
61
|
-
"effect": "3.21.
|
|
62
|
-
"react": "~19.2.
|
|
63
|
-
"@dxos/plugin-graph": "0.9.
|
|
62
|
+
"@types/react": "~19.2.17",
|
|
63
|
+
"effect": "3.21.4",
|
|
64
|
+
"react": "~19.2.7",
|
|
65
|
+
"@dxos/plugin-graph": "0.9.1-staging.ee54ba693a"
|
|
64
66
|
},
|
|
65
67
|
"peerDependencies": {
|
|
66
|
-
"effect": "3.21.
|
|
67
|
-
"react": "~19.2.
|
|
68
|
+
"effect": "3.21.4",
|
|
69
|
+
"react": "~19.2.7"
|
|
68
70
|
},
|
|
69
71
|
"publishConfig": {
|
|
70
72
|
"access": "public"
|
|
@@ -13,7 +13,7 @@ import { SettingsPlugin } from '#plugin';
|
|
|
13
13
|
|
|
14
14
|
import { meta } from './meta';
|
|
15
15
|
|
|
16
|
-
const moduleId = (name: string) => `${meta.
|
|
16
|
+
const moduleId = (name: string) => `${meta.profile.key}.module.${name}`;
|
|
17
17
|
|
|
18
18
|
describe('SettingsPlugin', () => {
|
|
19
19
|
test('modules activate on the expected events', async ({ expect }) => {
|
package/src/actions.ts
CHANGED
|
@@ -10,15 +10,18 @@ import { SETTINGS_ID, SETTINGS_KEY } from '#types';
|
|
|
10
10
|
export { SETTINGS_ID, SETTINGS_KEY };
|
|
11
11
|
|
|
12
12
|
export namespace SettingsAction {
|
|
13
|
-
export class Open extends Schema.TaggedClass<Open>()(`${meta.
|
|
13
|
+
export class Open extends Schema.TaggedClass<Open>()(`${meta.profile.key}.open`, {
|
|
14
14
|
input: Schema.Struct({
|
|
15
15
|
plugin: Schema.optional(Schema.String),
|
|
16
16
|
}),
|
|
17
17
|
output: Schema.Void,
|
|
18
18
|
}) {}
|
|
19
19
|
|
|
20
|
-
export class OpenPluginRegistry extends Schema.TaggedClass<OpenPluginRegistry>()(
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
20
|
+
export class OpenPluginRegistry extends Schema.TaggedClass<OpenPluginRegistry>()(
|
|
21
|
+
`${meta.profile.key}.openPluginRegistry`,
|
|
22
|
+
{
|
|
23
|
+
input: Schema.Void,
|
|
24
|
+
output: Schema.Void,
|
|
25
|
+
},
|
|
26
|
+
) {}
|
|
24
27
|
}
|
|
@@ -6,9 +6,9 @@ import * as Effect from 'effect/Effect';
|
|
|
6
6
|
|
|
7
7
|
import { Capabilities, Capability, type Plugin as Plugin$ } from '@dxos/app-framework';
|
|
8
8
|
import { GraphBuilder, Node, NodeMatcher } from '@dxos/app-graph';
|
|
9
|
-
import { AppCapabilities,
|
|
9
|
+
import { AppCapabilities, Paths, SettingsOperation } from '@dxos/app-toolkit';
|
|
10
10
|
import { Operation } from '@dxos/compute';
|
|
11
|
-
import { isNonNullable } from '@dxos/util';
|
|
11
|
+
import { Position, isNonNullable } from '@dxos/util';
|
|
12
12
|
|
|
13
13
|
import { meta } from '#meta';
|
|
14
14
|
|
|
@@ -31,7 +31,7 @@ export default Capability.makeModule(
|
|
|
31
31
|
id: 'root',
|
|
32
32
|
data: () => Operation.invoke(SettingsOperation.Open, {}),
|
|
33
33
|
properties: {
|
|
34
|
-
label: ['plugin-settings.label', { ns: meta.
|
|
34
|
+
label: ['plugin-settings.label', { ns: meta.profile.key }],
|
|
35
35
|
icon: 'ph--gear--regular',
|
|
36
36
|
disposition: 'menu',
|
|
37
37
|
keyBinding: {
|
|
@@ -49,12 +49,12 @@ export default Capability.makeModule(
|
|
|
49
49
|
Effect.succeed([
|
|
50
50
|
Node.make({
|
|
51
51
|
id: SETTINGS_ID,
|
|
52
|
-
type: meta.
|
|
52
|
+
type: meta.profile.key,
|
|
53
53
|
properties: {
|
|
54
|
-
label: ['plugin-settings.label', { ns: meta.
|
|
54
|
+
label: ['plugin-settings.label', { ns: meta.profile.key }],
|
|
55
55
|
icon: 'ph--gear--regular',
|
|
56
56
|
disposition: 'pin-end',
|
|
57
|
-
position:
|
|
57
|
+
position: Position.first,
|
|
58
58
|
testId: 'treeView.appSettings',
|
|
59
59
|
},
|
|
60
60
|
}),
|
|
@@ -62,7 +62,7 @@ export default Capability.makeModule(
|
|
|
62
62
|
}),
|
|
63
63
|
GraphBuilder.createExtension({
|
|
64
64
|
id: 'plugins',
|
|
65
|
-
match: NodeMatcher.whenId(getSpacePath(SETTINGS_ID)),
|
|
65
|
+
match: NodeMatcher.whenId(Paths.getSpacePath(SETTINGS_ID)),
|
|
66
66
|
connector: (node, get) => {
|
|
67
67
|
const [manager] = get(managerAtom);
|
|
68
68
|
const allSettings = get(settingsAtom);
|
|
@@ -70,7 +70,7 @@ export default Capability.makeModule(
|
|
|
70
70
|
manager
|
|
71
71
|
.getPlugins()
|
|
72
72
|
.map((plugin: Plugin$.Plugin): [Plugin$.Meta, AppCapabilities.Settings] | null => {
|
|
73
|
-
const settings = allSettings.find((s) => s.prefix === plugin.meta.
|
|
73
|
+
const settings = allSettings.find((s) => s.prefix === plugin.meta.profile.key);
|
|
74
74
|
if (!settings) {
|
|
75
75
|
return null;
|
|
76
76
|
}
|
|
@@ -78,16 +78,20 @@ export default Capability.makeModule(
|
|
|
78
78
|
return [plugin.meta, settings];
|
|
79
79
|
})
|
|
80
80
|
.filter(isNonNullable)
|
|
81
|
-
.sort(([a], [b]) =>
|
|
81
|
+
.sort(([a], [b]) =>
|
|
82
|
+
(a.profile.name ?? a.profile.key).localeCompare(b.profile.name ?? b.profile.key, undefined, {
|
|
83
|
+
sensitivity: 'base',
|
|
84
|
+
}),
|
|
85
|
+
)
|
|
82
86
|
.map(([meta, settings]: [Plugin$.Meta, AppCapabilities.Settings]) =>
|
|
83
87
|
Node.make({
|
|
84
|
-
id: `${SETTINGS_KEY}:${meta.
|
|
88
|
+
id: `${SETTINGS_KEY}:${meta.profile.key.replaceAll('/', ':')}`,
|
|
85
89
|
type: 'category',
|
|
86
90
|
data: settings,
|
|
87
91
|
properties: {
|
|
88
|
-
label: meta.name ?? meta.
|
|
89
|
-
icon: meta.icon ?? 'ph--circle--regular',
|
|
90
|
-
iconHue: meta.
|
|
92
|
+
label: meta.profile.name ?? meta.profile.key,
|
|
93
|
+
icon: meta.profile.icon?.key ?? 'ph--circle--regular',
|
|
94
|
+
iconHue: meta.profile.icon?.hue,
|
|
91
95
|
},
|
|
92
96
|
}),
|
|
93
97
|
),
|
|
@@ -6,42 +6,21 @@ import * as Effect from 'effect/Effect';
|
|
|
6
6
|
import React from 'react';
|
|
7
7
|
|
|
8
8
|
import { Capabilities, Capability } from '@dxos/app-framework';
|
|
9
|
-
import { Surface
|
|
10
|
-
import { type AppCapabilities } from '@dxos/app-toolkit';
|
|
9
|
+
import { Surface } from '@dxos/app-framework/ui';
|
|
11
10
|
import { AppSurface } from '@dxos/app-toolkit/ui';
|
|
12
|
-
import {
|
|
11
|
+
import { Position } from '@dxos/util';
|
|
13
12
|
|
|
14
|
-
|
|
15
|
-
* Generic settings surface rendered for any plugin that contributes an
|
|
16
|
-
* `AppCapabilities.Settings` entry. It drives a schema-based form from the
|
|
17
|
-
* contributed `schema`/`atom`, so plugins whose settings are plain editable
|
|
18
|
-
* fields need not register a bespoke settings surface.
|
|
19
|
-
*
|
|
20
|
-
* No section title is rendered: the settings plank heading already names the
|
|
21
|
-
* plugin. Registered with `position: 'last'` so a plugin-specific surface
|
|
22
|
-
* (matching by prefix) always wins under the settings article's `limit={1}`
|
|
23
|
-
* dispatch.
|
|
24
|
-
*/
|
|
25
|
-
const DefaultSettings = ({ subject }: { subject: AppCapabilities.Settings }) => {
|
|
26
|
-
const { settings, updateSettings } = useSettingsState<Record<string, any>>(subject.atom);
|
|
27
|
-
|
|
28
|
-
return (
|
|
29
|
-
<SettingsForm.Viewport>
|
|
30
|
-
<SettingsForm.FieldSet
|
|
31
|
-
schema={subject.schema}
|
|
32
|
-
values={settings}
|
|
33
|
-
onValuesChanged={(values) => updateSettings(() => values)}
|
|
34
|
-
/>
|
|
35
|
-
</SettingsForm.Viewport>
|
|
36
|
-
);
|
|
37
|
-
};
|
|
13
|
+
import { DefaultSettings } from '#containers';
|
|
38
14
|
|
|
15
|
+
// `DefaultSettings` is registered with `position: Position.last` so a
|
|
16
|
+
// plugin-specific surface (matching by prefix) always wins under the settings
|
|
17
|
+
// article's `limit={1}` dispatch.
|
|
39
18
|
export default Capability.makeModule(() =>
|
|
40
19
|
Effect.succeed(
|
|
41
20
|
Capability.contributes(Capabilities.ReactSurface, [
|
|
42
21
|
Surface.create({
|
|
43
22
|
id: 'defaultPluginSettings',
|
|
44
|
-
position:
|
|
23
|
+
position: Position.last,
|
|
45
24
|
filter: AppSurface.settings(AppSurface.Article),
|
|
46
25
|
component: ({ data: { subject } }) => <DefaultSettings subject={subject} />,
|
|
47
26
|
}),
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import React from 'react';
|
|
6
|
+
|
|
7
|
+
import { usePluginManager, useSettingsState } from '@dxos/app-framework/ui';
|
|
8
|
+
import { type AppCapabilities } from '@dxos/app-toolkit';
|
|
9
|
+
import { Form } from '@dxos/react-ui-form';
|
|
10
|
+
|
|
11
|
+
export type DefaultSettingsProps = {
|
|
12
|
+
subject: AppCapabilities.Settings;
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Generic settings surface rendered for any plugin that contributes an
|
|
17
|
+
* `AppCapabilities.Settings` entry. It drives a schema-based form from the
|
|
18
|
+
* contributed `schema`/`atom`, so plugins whose settings are plain editable
|
|
19
|
+
* fields need not register a bespoke settings surface.
|
|
20
|
+
*
|
|
21
|
+
* The contributing plugin's name is rendered as the section heading (resolved
|
|
22
|
+
* by matching `subject.prefix` against each plugin's `meta.profile.key`) so
|
|
23
|
+
* every schema-driven settings article shows a consistent title.
|
|
24
|
+
*/
|
|
25
|
+
export const DefaultSettings = ({ subject }: DefaultSettingsProps) => {
|
|
26
|
+
const manager = usePluginManager();
|
|
27
|
+
const { settings, updateSettings } = useSettingsState<Record<string, any>>(subject.atom);
|
|
28
|
+
const title = manager.getPlugins().find((plugin) => plugin.meta.profile.key === subject.prefix)?.meta.profile.name;
|
|
29
|
+
|
|
30
|
+
return (
|
|
31
|
+
<Form.Root
|
|
32
|
+
schema={subject.schema}
|
|
33
|
+
variant='settings'
|
|
34
|
+
values={settings}
|
|
35
|
+
onValuesChanged={(values) => updateSettings(() => values)}
|
|
36
|
+
>
|
|
37
|
+
<Form.Viewport scroll>
|
|
38
|
+
<Form.Content>
|
|
39
|
+
<Form.Section title={title ?? subject.prefix}>
|
|
40
|
+
<Form.FieldSet />
|
|
41
|
+
</Form.Section>
|
|
42
|
+
</Form.Content>
|
|
43
|
+
</Form.Viewport>
|
|
44
|
+
</Form.Root>
|
|
45
|
+
);
|
|
46
|
+
};
|
package/src/index.ts
CHANGED
package/src/meta.ts
CHANGED
|
@@ -3,11 +3,7 @@
|
|
|
3
3
|
//
|
|
4
4
|
|
|
5
5
|
import { Plugin } from '@dxos/app-framework';
|
|
6
|
-
import { DXN } from '@dxos/keys';
|
|
7
6
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
author: 'DXOS',
|
|
12
|
-
tags: ['system'],
|
|
13
|
-
});
|
|
7
|
+
import config from '../dx.config';
|
|
8
|
+
|
|
9
|
+
export const meta = Plugin.getMetaFromConfig(config);
|
|
@@ -5,21 +5,21 @@
|
|
|
5
5
|
import * as Effect from 'effect/Effect';
|
|
6
6
|
|
|
7
7
|
import { Capabilities, Capability } from '@dxos/app-framework';
|
|
8
|
-
import { LayoutOperation,
|
|
8
|
+
import { LayoutOperation, Paths, SettingsOperation } from '@dxos/app-toolkit';
|
|
9
9
|
import { Operation } from '@dxos/compute';
|
|
10
10
|
|
|
11
|
-
import { SETTINGS_ID,
|
|
11
|
+
import { SETTINGS_ID, getPluginRegistrySectionPath } from '../types';
|
|
12
12
|
|
|
13
13
|
const handler: Operation.WithHandler<typeof SettingsOperation.OpenPluginRegistry> =
|
|
14
14
|
SettingsOperation.OpenPluginRegistry.pipe(
|
|
15
15
|
Operation.withHandler(() =>
|
|
16
16
|
Effect.gen(function* () {
|
|
17
17
|
const { invoke } = yield* Capability.get(Capabilities.OperationInvoker);
|
|
18
|
-
yield* invoke(LayoutOperation.SwitchWorkspace, { subject: getSpacePath(SETTINGS_ID) });
|
|
18
|
+
yield* invoke(LayoutOperation.SwitchWorkspace, { subject: Paths.getSpacePath(SETTINGS_ID) });
|
|
19
19
|
// Await (don't fork): SwitchWorkspace selects the workspace's first child, so a forked Open
|
|
20
20
|
// races/drops before its deck update applies. Awaiting guarantees the registry is selected.
|
|
21
21
|
yield* invoke(LayoutOperation.Open, {
|
|
22
|
-
subject: [
|
|
22
|
+
subject: [getPluginRegistrySectionPath()],
|
|
23
23
|
});
|
|
24
24
|
}),
|
|
25
25
|
),
|
package/src/operations/open.ts
CHANGED
|
@@ -5,22 +5,22 @@
|
|
|
5
5
|
import * as Effect from 'effect/Effect';
|
|
6
6
|
|
|
7
7
|
import { Capabilities, Capability } from '@dxos/app-framework';
|
|
8
|
-
import { LayoutOperation,
|
|
8
|
+
import { LayoutOperation, Paths, SettingsOperation } from '@dxos/app-toolkit';
|
|
9
9
|
import { Operation } from '@dxos/compute';
|
|
10
10
|
|
|
11
|
-
import { SETTINGS_ID,
|
|
11
|
+
import { SETTINGS_ID, getPluginSettingsSectionPath } from '../types';
|
|
12
12
|
|
|
13
13
|
const handler: Operation.WithHandler<typeof SettingsOperation.Open> = SettingsOperation.Open.pipe(
|
|
14
14
|
Operation.withHandler((input) =>
|
|
15
15
|
Effect.gen(function* () {
|
|
16
16
|
const { invoke } = yield* Capability.get(Capabilities.OperationInvoker);
|
|
17
|
-
yield* invoke(LayoutOperation.SwitchWorkspace, { subject: getSpacePath(SETTINGS_ID) });
|
|
17
|
+
yield* invoke(LayoutOperation.SwitchWorkspace, { subject: Paths.getSpacePath(SETTINGS_ID) });
|
|
18
18
|
if (input.plugin) {
|
|
19
19
|
// Await (don't fork): SwitchWorkspace already selects the workspace's first child, so a
|
|
20
20
|
// forked Open for the requested plugin races/drops before its deck update applies, leaving
|
|
21
21
|
// the wrong plugin selected. Awaiting guarantees the requested plugin becomes the selection.
|
|
22
22
|
yield* invoke(LayoutOperation.Open, {
|
|
23
|
-
subject: [
|
|
23
|
+
subject: [getPluginSettingsSectionPath(input.plugin)],
|
|
24
24
|
});
|
|
25
25
|
}
|
|
26
26
|
}),
|
package/src/translations.ts
CHANGED
|
@@ -2,16 +2,16 @@
|
|
|
2
2
|
// Copyright 2025 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import {
|
|
5
|
+
import { Translations } from '@dxos/app-toolkit';
|
|
6
6
|
|
|
7
7
|
import { meta } from '#meta';
|
|
8
8
|
|
|
9
9
|
export const translations = [
|
|
10
10
|
{
|
|
11
11
|
'en-US': {
|
|
12
|
-
[meta.
|
|
12
|
+
[meta.profile.key]: {
|
|
13
13
|
'plugin-settings.label': 'Plugin Settings',
|
|
14
14
|
},
|
|
15
15
|
},
|
|
16
16
|
},
|
|
17
|
-
] as const satisfies Resource[];
|
|
17
|
+
] as const satisfies Translations.Resource[];
|
package/src/types/index.ts
CHANGED
|
@@ -2,7 +2,17 @@
|
|
|
2
2
|
// Copyright 2025 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import {
|
|
5
|
+
import { Paths } from '@dxos/app-toolkit';
|
|
6
6
|
|
|
7
|
-
export const SETTINGS_ID = pinnedWorkspaceId('dxos:settings');
|
|
7
|
+
export const SETTINGS_ID = Paths.pinnedWorkspaceId('dxos:settings');
|
|
8
8
|
export const SETTINGS_KEY = 'settings';
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Canonical qualified path to a specific plugin's section in the settings workspace.
|
|
12
|
+
* Segments are joined using the `settings:plugin-id` convention.
|
|
13
|
+
*/
|
|
14
|
+
export const getPluginSettingsSectionPath = (pluginId: string): string =>
|
|
15
|
+
Paths.getSpacePath(SETTINGS_ID, `${SETTINGS_KEY}:${pluginId.replaceAll('/', ':')}`);
|
|
16
|
+
|
|
17
|
+
/** Canonical qualified path to the plugin registry section in the settings workspace. */
|
|
18
|
+
export const getPluginRegistrySectionPath = (): string => Paths.getSpacePath(SETTINGS_ID, `${SETTINGS_KEY}:plugins`);
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
// src/meta.ts
|
|
2
|
-
import { Plugin } from "@dxos/app-framework";
|
|
3
|
-
import { DXN } from "@dxos/keys";
|
|
4
|
-
var meta = Plugin.makeMeta({
|
|
5
|
-
key: DXN.make("org.dxos.plugin.settings"),
|
|
6
|
-
name: "Settings",
|
|
7
|
-
author: "DXOS",
|
|
8
|
-
tags: [
|
|
9
|
-
"system"
|
|
10
|
-
]
|
|
11
|
-
});
|
|
12
|
-
|
|
13
|
-
export {
|
|
14
|
-
meta
|
|
15
|
-
};
|
|
16
|
-
//# sourceMappingURL=chunk-3DJRTSII.mjs.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../src/meta.ts"],
|
|
4
|
-
"sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport { Plugin } from '@dxos/app-framework';\nimport { DXN } from '@dxos/keys';\n\nexport const meta = Plugin.makeMeta({\n key: DXN.make('org.dxos.plugin.settings'),\n name: 'Settings',\n author: 'DXOS',\n tags: ['system'],\n});\n"],
|
|
5
|
-
"mappings": ";AAIA,SAASA,cAAc;AACvB,SAASC,WAAW;AAEb,IAAMC,OAAOF,OAAOG,SAAS;EAClCC,KAAKH,IAAII,KAAK,0BAAA;EACdC,MAAM;EACNC,QAAQ;EACRC,MAAM;IAAC;;AACT,CAAA;",
|
|
6
|
-
"names": ["Plugin", "DXN", "meta", "makeMeta", "key", "make", "name", "author", "tags"]
|
|
7
|
-
}
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
// src/actions.ts
|
|
2
|
-
import * as Schema from "effect/Schema";
|
|
3
|
-
import { meta } from "#meta";
|
|
4
|
-
import { SETTINGS_ID, SETTINGS_KEY } from "#types";
|
|
5
|
-
(function(SettingsAction2) {
|
|
6
|
-
class Open extends Schema.TaggedClass()(`${meta.id}.open`, {
|
|
7
|
-
input: Schema.Struct({
|
|
8
|
-
plugin: Schema.optional(Schema.String)
|
|
9
|
-
}),
|
|
10
|
-
output: Schema.Void
|
|
11
|
-
}) {
|
|
12
|
-
}
|
|
13
|
-
SettingsAction2.Open = Open;
|
|
14
|
-
class OpenPluginRegistry extends Schema.TaggedClass()(`${meta.id}.openPluginRegistry`, {
|
|
15
|
-
input: Schema.Void,
|
|
16
|
-
output: Schema.Void
|
|
17
|
-
}) {
|
|
18
|
-
}
|
|
19
|
-
SettingsAction2.OpenPluginRegistry = OpenPluginRegistry;
|
|
20
|
-
})(SettingsAction || (SettingsAction = {}));
|
|
21
|
-
var SettingsAction;
|
|
22
|
-
|
|
23
|
-
export {
|
|
24
|
-
SETTINGS_ID,
|
|
25
|
-
SETTINGS_KEY,
|
|
26
|
-
SettingsAction
|
|
27
|
-
};
|
|
28
|
-
//# sourceMappingURL=chunk-J2FJOTAW.mjs.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../src/actions.ts"],
|
|
4
|
-
"sourcesContent": ["//\n// Copyright 2023 DXOS.org\n//\n\nimport * as Schema from 'effect/Schema';\n\nimport { meta } from '#meta';\nimport { SETTINGS_ID, SETTINGS_KEY } from '#types';\n\nexport { SETTINGS_ID, SETTINGS_KEY };\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}.openPluginRegistry`, {\n input: Schema.Void,\n output: Schema.Void,\n }) {}\n}\n"],
|
|
5
|
-
"mappings": ";AAIA,YAAYA,YAAY;AAExB,SAASC,YAAY;AACrB,SAASC,aAAaC,oBAAoB;UAIzBC,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,uBAAuB;IAChHC,OAAcM;IACdD,QAAeC;EACjB,CAAA,EAAA;EAAI;kBAHSC,qBAAAA;AAIf,GAZiBZ,mBAAAA,iBAAAA,CAAAA,EAAAA;;",
|
|
6
|
-
"names": ["Schema", "meta", "SETTINGS_ID", "SETTINGS_KEY", "SettingsAction", "Open", "TaggedClass", "meta", "id", "input", "Struct", "plugin", "optional", "String", "output", "Void", "OpenPluginRegistry"]
|
|
7
|
-
}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../src/operations/open.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, getSpacePath } from '@dxos/app-toolkit';\nimport { Operation } from '@dxos/compute';\n\nimport { SETTINGS_ID, SETTINGS_KEY } from '../actions';\n\nconst handler: Operation.WithHandler<typeof SettingsOperation.Open> = SettingsOperation.Open.pipe(\n Operation.withHandler((input) =>\n Effect.gen(function* () {\n const { invoke } = yield* Capability.get(Capabilities.OperationInvoker);\n yield* invoke(LayoutOperation.SwitchWorkspace, { subject: getSpacePath(SETTINGS_ID) });\n if (input.plugin) {\n // Await (don't fork): SwitchWorkspace already selects the workspace's first child, so a\n // forked Open for the requested plugin races/drops before its deck update applies, leaving\n // the wrong plugin selected. Awaiting guarantees the requested plugin becomes the selection.\n yield* invoke(LayoutOperation.Open, {\n subject: [`${getSpacePath(SETTINGS_ID)}/${SETTINGS_KEY}:${input.plugin.replaceAll('/', ':')}`],\n });\n }\n }),\n ),\n);\n\nexport default handler;\n"],
|
|
5
|
-
"mappings": ";;;;;;AAIA,YAAYA,YAAY;AAExB,SAASC,cAAcC,kBAAkB;AACzC,SAASC,iBAAiBC,mBAAmBC,oBAAoB;AACjE,SAASC,iBAAiB;AAI1B,IAAMC,UAAgEC,kBAAkBC,KAAKC,KAC3FC,UAAUC,YAAY,CAACC,UACdC,WAAI,aAAA;AACT,QAAM,EAAEC,OAAM,IAAK,OAAOC,WAAWC,IAAIC,aAAaC,gBAAgB;AACtE,SAAOJ,OAAOK,gBAAgBC,iBAAiB;IAAEC,SAASC,aAAaC,WAAAA;EAAa,CAAA;AACpF,MAAIX,MAAMY,QAAQ;AAIhB,WAAOV,OAAOK,gBAAgBX,MAAM;MAClCa,SAAS;QAAC,GAAGC,aAAaC,WAAAA,CAAAA,IAAgBE,YAAAA,IAAgBb,MAAMY,OAAOE,WAAW,KAAK,GAAA,CAAA;;IACzF,CAAA;EACF;AACF,CAAA,CAAA,CAAA;AAIJ,IAAA,eAAepB;",
|
|
6
|
-
"names": ["Effect", "Capabilities", "Capability", "LayoutOperation", "SettingsOperation", "getSpacePath", "Operation", "handler", "SettingsOperation", "Open", "pipe", "Operation", "withHandler", "input", "gen", "invoke", "Capability", "get", "Capabilities", "OperationInvoker", "LayoutOperation", "SwitchWorkspace", "subject", "getSpacePath", "SETTINGS_ID", "plugin", "SETTINGS_KEY", "replaceAll"]
|
|
7
|
-
}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../src/operations/open-plugin-registry.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, getSpacePath } from '@dxos/app-toolkit';\nimport { Operation } from '@dxos/compute';\n\nimport { SETTINGS_ID, SETTINGS_KEY } from '../actions';\n\nconst handler: Operation.WithHandler<typeof SettingsOperation.OpenPluginRegistry> =\n SettingsOperation.OpenPluginRegistry.pipe(\n Operation.withHandler(() =>\n Effect.gen(function* () {\n const { invoke } = yield* Capability.get(Capabilities.OperationInvoker);\n yield* invoke(LayoutOperation.SwitchWorkspace, { subject: getSpacePath(SETTINGS_ID) });\n // Await (don't fork): SwitchWorkspace selects the workspace's first child, so a forked Open\n // races/drops before its deck update applies. Awaiting guarantees the registry is selected.\n yield* invoke(LayoutOperation.Open, {\n subject: [`${getSpacePath(SETTINGS_ID)}/${SETTINGS_KEY}:plugins`],\n });\n }),\n ),\n );\n\nexport default handler;\n"],
|
|
5
|
-
"mappings": ";;;;;;AAIA,YAAYA,YAAY;AAExB,SAASC,cAAcC,kBAAkB;AACzC,SAASC,iBAAiBC,mBAAmBC,oBAAoB;AACjE,SAASC,iBAAiB;AAI1B,IAAMC,UACJC,kBAAkBC,mBAAmBC,KACnCC,UAAUC,YAAY,MACbC,WAAI,aAAA;AACT,QAAM,EAAEC,OAAM,IAAK,OAAOC,WAAWC,IAAIC,aAAaC,gBAAgB;AACtE,SAAOJ,OAAOK,gBAAgBC,iBAAiB;IAAEC,SAASC,aAAaC,WAAAA;EAAa,CAAA;AAGpF,SAAOT,OAAOK,gBAAgBK,MAAM;IAClCH,SAAS;MAAC,GAAGC,aAAaC,WAAAA,CAAAA,IAAgBE,YAAAA;;EAC5C,CAAA;AACF,CAAA,CAAA,CAAA;AAIN,IAAA,+BAAelB;",
|
|
6
|
-
"names": ["Effect", "Capabilities", "Capability", "LayoutOperation", "SettingsOperation", "getSpacePath", "Operation", "handler", "SettingsOperation", "OpenPluginRegistry", "pipe", "Operation", "withHandler", "gen", "invoke", "Capability", "get", "Capabilities", "OperationInvoker", "LayoutOperation", "SwitchWorkspace", "subject", "getSpacePath", "SETTINGS_ID", "Open", "SETTINGS_KEY"]
|
|
7
|
-
}
|