@dxos/plugin-settings 0.8.4-main.d05539e30a → 0.8.4-main.d9fc60f731
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/SettingsPlugin.mjs +1 -1
- package/dist/lib/neutral/chunk-3DJRTSII.mjs +16 -0
- package/dist/lib/neutral/chunk-3DJRTSII.mjs.map +7 -0
- package/dist/lib/neutral/{chunk-3QYY6QYR.mjs → chunk-J2FJOTAW.mjs} +2 -2
- package/dist/lib/neutral/{chunk-3QYY6QYR.mjs.map → chunk-J2FJOTAW.mjs.map} +2 -2
- package/dist/lib/neutral/{chunk-YMWZWP5N.mjs → chunk-XP4EHGJW.mjs} +4 -2
- package/dist/lib/neutral/chunk-XP4EHGJW.mjs.map +7 -0
- package/dist/lib/neutral/index.mjs +2 -2
- package/dist/lib/neutral/meta.json +1 -1
- package/dist/lib/neutral/{open-5UKBN2QG.mjs → open-NRUWKEGC.mjs} +4 -4
- package/dist/lib/neutral/{open-5UKBN2QG.mjs.map → open-NRUWKEGC.mjs.map} +3 -3
- package/dist/lib/neutral/{open-plugin-registry-42UUSSSA.mjs → open-plugin-registry-XGFG2JWB.mjs} +4 -4
- package/dist/lib/neutral/{open-plugin-registry-42UUSSSA.mjs.map → open-plugin-registry-XGFG2JWB.mjs.map} +3 -3
- package/dist/lib/neutral/plugin.mjs +2 -2
- package/dist/lib/neutral/testing.mjs +1 -1
- package/dist/types/src/SettingsPlugin.d.ts.map +1 -1
- package/dist/types/src/actions.d.ts +2 -2
- package/dist/types/src/capabilities/index.d.ts +1 -0
- package/dist/types/src/capabilities/index.d.ts.map +1 -1
- package/dist/types/src/capabilities/react-surface.d.ts +5 -0
- package/dist/types/src/capabilities/react-surface.d.ts.map +1 -0
- package/dist/types/src/meta.d.ts +1 -1
- package/dist/types/src/meta.d.ts.map +1 -1
- package/dist/types/src/operations/open.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +14 -9
- package/src/SettingsPlugin.ts +2 -1
- package/src/actions.ts +1 -1
- package/src/capabilities/app-graph-builder.ts +1 -0
- package/src/capabilities/index.ts +1 -0
- package/src/capabilities/react-surface.tsx +50 -0
- package/src/meta.ts +5 -4
- package/src/operations/open-plugin-registry.ts +5 -5
- package/src/operations/open.ts +6 -5
- package/dist/lib/neutral/chunk-WJUZZMD7.mjs +0 -14
- package/dist/lib/neutral/chunk-WJUZZMD7.mjs.map +0 -7
- package/dist/lib/neutral/chunk-YMWZWP5N.mjs.map +0 -7
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dxos/plugin-settings",
|
|
3
|
-
"version": "0.8.4-main.
|
|
3
|
+
"version": "0.8.4-main.d9fc60f731",
|
|
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",
|
|
@@ -48,20 +48,25 @@
|
|
|
48
48
|
"src"
|
|
49
49
|
],
|
|
50
50
|
"dependencies": {
|
|
51
|
-
"@dxos/app-framework": "0.8.4-main.
|
|
52
|
-
"@dxos/app-graph": "0.8.4-main.
|
|
53
|
-
"@dxos/
|
|
54
|
-
"@dxos/
|
|
55
|
-
"@dxos/
|
|
51
|
+
"@dxos/app-framework": "0.8.4-main.d9fc60f731",
|
|
52
|
+
"@dxos/app-graph": "0.8.4-main.d9fc60f731",
|
|
53
|
+
"@dxos/app-toolkit": "0.8.4-main.d9fc60f731",
|
|
54
|
+
"@dxos/react-ui-form": "0.8.4-main.d9fc60f731",
|
|
55
|
+
"@dxos/compute": "0.8.4-main.d9fc60f731",
|
|
56
|
+
"@dxos/util": "0.8.4-main.d9fc60f731",
|
|
57
|
+
"@dxos/keys": "0.8.4-main.d9fc60f731"
|
|
56
58
|
},
|
|
57
59
|
"devDependencies": {
|
|
58
60
|
"@types/react": "~19.2.7",
|
|
59
|
-
"effect": "3.
|
|
61
|
+
"effect": "3.21.2",
|
|
60
62
|
"react": "~19.2.3",
|
|
61
|
-
"@dxos/plugin-graph": "0.8.4-main.
|
|
63
|
+
"@dxos/plugin-graph": "0.8.4-main.d9fc60f731"
|
|
62
64
|
},
|
|
63
65
|
"peerDependencies": {
|
|
64
|
-
"effect": "3.
|
|
66
|
+
"effect": "3.21.2",
|
|
65
67
|
"react": "~19.2.3"
|
|
68
|
+
},
|
|
69
|
+
"publishConfig": {
|
|
70
|
+
"access": "public"
|
|
66
71
|
}
|
|
67
72
|
}
|
package/src/SettingsPlugin.ts
CHANGED
|
@@ -5,13 +5,14 @@
|
|
|
5
5
|
import { Plugin } from '@dxos/app-framework';
|
|
6
6
|
import { AppPlugin } from '@dxos/app-toolkit';
|
|
7
7
|
|
|
8
|
-
import { OperationHandler, SettingsAppGraphBuilder } from '#capabilities';
|
|
8
|
+
import { OperationHandler, ReactSurface, SettingsAppGraphBuilder } from '#capabilities';
|
|
9
9
|
import { meta } from '#meta';
|
|
10
10
|
import { translations } from '#translations';
|
|
11
11
|
|
|
12
12
|
export const SettingsPlugin = Plugin.define(meta).pipe(
|
|
13
13
|
AppPlugin.addAppGraphModule({ activate: SettingsAppGraphBuilder }),
|
|
14
14
|
AppPlugin.addOperationHandlerModule({ activate: OperationHandler }),
|
|
15
|
+
AppPlugin.addSurfaceModule({ activate: ReactSurface }),
|
|
15
16
|
AppPlugin.addTranslationsModule({ translations }),
|
|
16
17
|
Plugin.make,
|
|
17
18
|
);
|
package/src/actions.ts
CHANGED
|
@@ -17,7 +17,7 @@ export namespace SettingsAction {
|
|
|
17
17
|
output: Schema.Void,
|
|
18
18
|
}) {}
|
|
19
19
|
|
|
20
|
-
export class OpenPluginRegistry extends Schema.TaggedClass<OpenPluginRegistry>()(`${meta.id}.
|
|
20
|
+
export class OpenPluginRegistry extends Schema.TaggedClass<OpenPluginRegistry>()(`${meta.id}.openPluginRegistry`, {
|
|
21
21
|
input: Schema.Void,
|
|
22
22
|
output: Schema.Void,
|
|
23
23
|
}) {}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import * as Effect from 'effect/Effect';
|
|
6
|
+
import React from 'react';
|
|
7
|
+
|
|
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';
|
|
11
|
+
import { AppSurface } from '@dxos/app-toolkit/ui';
|
|
12
|
+
import { Settings as SettingsForm } from '@dxos/react-ui-form';
|
|
13
|
+
|
|
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
|
+
};
|
|
38
|
+
|
|
39
|
+
export default Capability.makeModule(() =>
|
|
40
|
+
Effect.succeed(
|
|
41
|
+
Capability.contributes(Capabilities.ReactSurface, [
|
|
42
|
+
Surface.create({
|
|
43
|
+
id: 'defaultPluginSettings',
|
|
44
|
+
position: 'last',
|
|
45
|
+
filter: AppSurface.settings(AppSurface.Article),
|
|
46
|
+
component: ({ data: { subject } }) => <DefaultSettings subject={subject} />,
|
|
47
|
+
}),
|
|
48
|
+
]),
|
|
49
|
+
),
|
|
50
|
+
);
|
package/src/meta.ts
CHANGED
|
@@ -2,11 +2,12 @@
|
|
|
2
2
|
// Copyright 2025 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import {
|
|
5
|
+
import { Plugin } from '@dxos/app-framework';
|
|
6
|
+
import { DXN } from '@dxos/keys';
|
|
6
7
|
|
|
7
|
-
export const meta
|
|
8
|
-
|
|
8
|
+
export const meta = Plugin.makeMeta({
|
|
9
|
+
key: DXN.make('org.dxos.plugin.settings'),
|
|
9
10
|
name: 'Settings',
|
|
10
11
|
author: 'DXOS',
|
|
11
12
|
tags: ['system'],
|
|
12
|
-
};
|
|
13
|
+
});
|
|
@@ -16,11 +16,11 @@ const handler: Operation.WithHandler<typeof SettingsOperation.OpenPluginRegistry
|
|
|
16
16
|
Effect.gen(function* () {
|
|
17
17
|
const { invoke } = yield* Capability.get(Capabilities.OperationInvoker);
|
|
18
18
|
yield* invoke(LayoutOperation.SwitchWorkspace, { subject: getSpacePath(SETTINGS_ID) });
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
}
|
|
23
|
-
);
|
|
19
|
+
// Await (don't fork): SwitchWorkspace selects the workspace's first child, so a forked Open
|
|
20
|
+
// races/drops before its deck update applies. Awaiting guarantees the registry is selected.
|
|
21
|
+
yield* invoke(LayoutOperation.Open, {
|
|
22
|
+
subject: [`${getSpacePath(SETTINGS_ID)}/${SETTINGS_KEY}:plugins`],
|
|
23
|
+
});
|
|
24
24
|
}),
|
|
25
25
|
),
|
|
26
26
|
);
|
package/src/operations/open.ts
CHANGED
|
@@ -16,11 +16,12 @@ const handler: Operation.WithHandler<typeof SettingsOperation.Open> = SettingsOp
|
|
|
16
16
|
const { invoke } = yield* Capability.get(Capabilities.OperationInvoker);
|
|
17
17
|
yield* invoke(LayoutOperation.SwitchWorkspace, { subject: getSpacePath(SETTINGS_ID) });
|
|
18
18
|
if (input.plugin) {
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
19
|
+
// Await (don't fork): SwitchWorkspace already selects the workspace's first child, so a
|
|
20
|
+
// forked Open for the requested plugin races/drops before its deck update applies, leaving
|
|
21
|
+
// the wrong plugin selected. Awaiting guarantees the requested plugin becomes the selection.
|
|
22
|
+
yield* invoke(LayoutOperation.Open, {
|
|
23
|
+
subject: [`${getSpacePath(SETTINGS_ID)}/${SETTINGS_KEY}:${input.plugin.replaceAll('/', ':')}`],
|
|
24
|
+
});
|
|
24
25
|
}
|
|
25
26
|
}),
|
|
26
27
|
),
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../src/meta.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: 'org.dxos.plugin.settings',\n name: 'Settings',\n author: 'DXOS',\n tags: ['system'],\n};\n"],
|
|
5
|
-
"mappings": ";AAMO,IAAMA,OAAoB;EAC/BC,IAAI;EACJC,MAAM;EACNC,QAAQ;EACRC,MAAM;IAAC;;AACT;",
|
|
6
|
-
"names": ["meta", "id", "name", "author", "tags"]
|
|
7
|
-
}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../src/SettingsPlugin.ts"],
|
|
4
|
-
"sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport { Plugin } from '@dxos/app-framework';\nimport { AppPlugin } from '@dxos/app-toolkit';\n\nimport { OperationHandler, SettingsAppGraphBuilder } 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.addOperationHandlerModule({ activate: OperationHandler }),\n AppPlugin.addTranslationsModule({ translations }),\n Plugin.make,\n);\n\nexport default SettingsPlugin;\n"],
|
|
5
|
-
"mappings": ";AAIA,SAASA,cAAc;AACvB,SAASC,iBAAiB;AAE1B,SAASC,kBAAkBC,+BAA+B;AAC1D,SAASC,YAAY;AACrB,SAASC,oBAAoB;AAEtB,IAAMC,iBAAiBN,OAAOO,OAAOH,IAAAA,EAAMI,KAChDP,UAAUQ,kBAAkB;EAAEC,UAAUP;AAAwB,CAAA,GAChEF,UAAUU,0BAA0B;EAAED,UAAUR;AAAiB,CAAA,GACjED,UAAUW,sBAAsB;EAAEP;AAAa,CAAA,GAC/CL,OAAOa,IAAI;AAGb,IAAA,yBAAeP;",
|
|
6
|
-
"names": ["Plugin", "AppPlugin", "OperationHandler", "SettingsAppGraphBuilder", "meta", "translations", "SettingsPlugin", "define", "pipe", "addAppGraphModule", "activate", "addOperationHandlerModule", "addTranslationsModule", "make"]
|
|
7
|
-
}
|