@dxos/plugin-settings 0.9.1-main.c7dcc2e112 → 0.10.0
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/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/react-surface.d.ts +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/meta.d.ts +4 -0
- package/dist/types/src/meta.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +15 -14
- package/src/capabilities/app-graph-builder.ts +2 -2
- 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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dxos/plugin-settings",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.10.0",
|
|
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",
|
|
@@ -49,23 +50,23 @@
|
|
|
49
50
|
"src"
|
|
50
51
|
],
|
|
51
52
|
"dependencies": {
|
|
52
|
-
"@dxos/app-
|
|
53
|
-
"@dxos/app-
|
|
54
|
-
"@dxos/app-
|
|
55
|
-
"@dxos/keys": "0.
|
|
56
|
-
"@dxos/
|
|
57
|
-
"@dxos/
|
|
58
|
-
"@dxos/
|
|
53
|
+
"@dxos/app-toolkit": "0.10.0",
|
|
54
|
+
"@dxos/app-framework": "0.10.0",
|
|
55
|
+
"@dxos/app-graph": "0.10.0",
|
|
56
|
+
"@dxos/keys": "0.10.0",
|
|
57
|
+
"@dxos/react-ui-form": "0.10.0",
|
|
58
|
+
"@dxos/util": "0.10.0",
|
|
59
|
+
"@dxos/compute": "0.10.0"
|
|
59
60
|
},
|
|
60
61
|
"devDependencies": {
|
|
61
|
-
"@types/react": "~19.2.
|
|
62
|
-
"effect": "3.21.
|
|
63
|
-
"react": "~19.2.
|
|
64
|
-
"@dxos/plugin-graph": "0.
|
|
62
|
+
"@types/react": "~19.2.17",
|
|
63
|
+
"effect": "3.21.4",
|
|
64
|
+
"react": "~19.2.7",
|
|
65
|
+
"@dxos/plugin-graph": "0.10.0"
|
|
65
66
|
},
|
|
66
67
|
"peerDependencies": {
|
|
67
|
-
"effect": "3.21.
|
|
68
|
-
"react": "~19.2.
|
|
68
|
+
"effect": "3.21.4",
|
|
69
|
+
"react": "~19.2.7"
|
|
69
70
|
},
|
|
70
71
|
"publishConfig": {
|
|
71
72
|
"access": "public"
|
|
@@ -8,7 +8,7 @@ import { Capabilities, Capability, type Plugin as Plugin$ } from '@dxos/app-fram
|
|
|
8
8
|
import { GraphBuilder, Node, NodeMatcher } from '@dxos/app-graph';
|
|
9
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
|
|
|
@@ -54,7 +54,7 @@ export default Capability.makeModule(
|
|
|
54
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
|
}),
|
|
@@ -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
|
@@ -4,4 +4,4 @@
|
|
|
4
4
|
|
|
5
5
|
export * from './actions';
|
|
6
6
|
export * from './meta';
|
|
7
|
-
export { SETTINGS_ID, SETTINGS_KEY,
|
|
7
|
+
export { SETTINGS_ID, SETTINGS_KEY, getPluginRegistrySectionPath, getPluginSettingsSectionPath } from './types';
|