@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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dxos/plugin-settings",
3
- "version": "0.9.1-main.c7dcc2e112",
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-framework": "0.9.1-main.c7dcc2e112",
53
- "@dxos/app-graph": "0.9.1-main.c7dcc2e112",
54
- "@dxos/app-toolkit": "0.9.1-main.c7dcc2e112",
55
- "@dxos/keys": "0.9.1-main.c7dcc2e112",
56
- "@dxos/compute": "0.9.1-main.c7dcc2e112",
57
- "@dxos/react-ui-form": "0.9.1-main.c7dcc2e112",
58
- "@dxos/util": "0.9.1-main.c7dcc2e112"
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.7",
62
- "effect": "3.21.3",
63
- "react": "~19.2.3",
64
- "@dxos/plugin-graph": "0.9.1-main.c7dcc2e112"
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.3",
68
- "react": "~19.2.3"
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: 'first',
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, useSettingsState } from '@dxos/app-framework/ui';
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 { Settings as SettingsForm } from '@dxos/react-ui-form';
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: 'last',
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
+ };
@@ -0,0 +1,5 @@
1
+ //
2
+ // Copyright 2025 DXOS.org
3
+ //
4
+
5
+ export * from './DefaultSettings';
@@ -0,0 +1,5 @@
1
+ //
2
+ // Copyright 2025 DXOS.org
3
+ //
4
+
5
+ export * from './DefaultSettings';
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, getPluginSettingsSectionPath, getPluginRegistrySectionPath } from './types';
7
+ export { SETTINGS_ID, SETTINGS_KEY, getPluginRegistrySectionPath, getPluginSettingsSectionPath } from './types';