@bridgebrew/storage 0.0.1 → 0.0.2
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/browser/browser.tsx +24 -3
- package/package.json +1 -2
package/browser/browser.tsx
CHANGED
|
@@ -5,14 +5,23 @@
|
|
|
5
5
|
import * as React from 'react';
|
|
6
6
|
import type { Context } from 'cordis';
|
|
7
7
|
import type {} from '@bridge/ui-renderer/client';
|
|
8
|
-
import { readJson } from '@bridge/ui';
|
|
9
|
-
import { registerSettingsPage, type SettingsPageProps } from '@bridge/plugin-manager/settings-page';
|
|
8
|
+
import { readJson, type FollowTarget } from '@bridge/ui';
|
|
10
9
|
import type { Inventory } from '../inventory.ts';
|
|
11
10
|
import { StoragePage } from './storage-page.tsx';
|
|
12
11
|
|
|
13
12
|
export const name = 'storage';
|
|
14
13
|
export const inject = ['slots'];
|
|
15
14
|
|
|
15
|
+
/** What the plugin manager draws a settings page with (its `settings-page.tsx`, `SettingsPageProps`): the fields this
|
|
16
|
+
* page reads. */
|
|
17
|
+
interface SettingsPageProps {
|
|
18
|
+
slug: string;
|
|
19
|
+
fetch: (input: string, init?: RequestInit) => Promise<Response>;
|
|
20
|
+
item?: string | undefined;
|
|
21
|
+
open: (item?: string) => void;
|
|
22
|
+
linkTo: (item?: string) => FollowTarget;
|
|
23
|
+
}
|
|
24
|
+
|
|
16
25
|
/** The page for the workspace `slug` names. */
|
|
17
26
|
export function StorageSettings({ slug, fetch, item, open, linkTo }: SettingsPageProps) {
|
|
18
27
|
const load = React.useCallback(
|
|
@@ -26,5 +35,17 @@ export function StorageSettings({ slug, fetch, item, open, linkTo }: SettingsPag
|
|
|
26
35
|
}
|
|
27
36
|
|
|
28
37
|
export function apply(ctx: Context) {
|
|
29
|
-
|
|
38
|
+
// The factory `<key>.settings` the plugin manager draws in Settings (its `settings-page.tsx`).
|
|
39
|
+
// oxlint-disable-next-line bridge/no-new-unchecked-cast -- typing: the slot map types factory names statically, a settings page's is `<key>.settings`
|
|
40
|
+
const { slots } = ctx as unknown as {
|
|
41
|
+
slots: {
|
|
42
|
+
registerFactory(
|
|
43
|
+
options: { name: string; scope: 'root' },
|
|
44
|
+
component: (props: SettingsPageProps) => React.ReactNode,
|
|
45
|
+
): () => void;
|
|
46
|
+
};
|
|
47
|
+
};
|
|
48
|
+
slots.registerFactory({ name: `${name}.settings`, scope: 'root' }, (props) => (
|
|
49
|
+
<StorageSettings {...props} />
|
|
50
|
+
));
|
|
30
51
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bridgebrew/storage",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.2",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"description": "Stores every plugin's data in the workspace, with its history; the audit trail is storage-tools-audit's.",
|
|
6
6
|
"keywords": [
|
|
@@ -38,7 +38,6 @@
|
|
|
38
38
|
"zod": "4.6.5"
|
|
39
39
|
},
|
|
40
40
|
"peerDependencies": {
|
|
41
|
-
"@bridge/plugin-manager": ">=0.0.1",
|
|
42
41
|
"@bridge/storage": ">=0.0.1",
|
|
43
42
|
"@bridge/ui": ">=0.0.1",
|
|
44
43
|
"@bridge/worker-runtime": ">=0.0.1",
|