@dsh-plugin/dsh-loader 1.1.0-dev.32287576957 → 1.2.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/adapters/dsh-1-x.js +4 -0
- package/dist/adapters/dsh-1-x.js.map +1 -1
- package/dist/api.d.ts +2 -0
- package/dist/api.js +18 -2
- package/dist/api.js.map +1 -1
- package/dist/client.d.ts +0 -1
- package/dist/client.js +13 -3
- package/dist/client.js.map +1 -1
- package/dist/index.js +7 -1
- package/dist/index.js.map +1 -1
- package/dist/patch.d.ts +112 -0
- package/dist/patch.js +179 -0
- package/dist/patch.js.map +1 -0
- package/dist/services/dsh-symbols.d.ts +70 -0
- package/dist/services/dsh-symbols.js +82 -0
- package/dist/services/dsh-symbols.js.map +1 -0
- package/dist/services/llm.d.ts +30 -0
- package/dist/services/llm.js +35 -0
- package/dist/services/llm.js.map +1 -0
- package/dist/services/registry.d.ts +144 -0
- package/dist/services/registry.js +209 -0
- package/dist/services/registry.js.map +1 -0
- package/dist/services/settings.d.ts +6 -0
- package/dist/services/settings.js +29 -1
- package/dist/services/settings.js.map +1 -1
- package/dist/services/web.js +20 -4
- package/dist/services/web.js.map +1 -1
- package/dist/setup.js +17 -1
- package/dist/setup.js.map +1 -1
- package/dist/types.d.ts +55 -0
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/lib/client.js +2775 -4
- package/lib/client.js.map +1 -1
- package/lib/types/adapters/dsh-1-x.d.ts +23 -0
- package/lib/types/adapters/index.d.ts +22 -0
- package/lib/types/client-ui.d.ts +40 -0
- package/lib/types/client.d.ts +156 -0
- package/lib/types/patch.d.ts +112 -0
- package/lib/types/registry.d.ts +35 -0
- package/lib/types/services/dsh-symbols.d.ts +70 -0
- package/lib/types/services/llm.d.ts +30 -0
- package/lib/types/services/registry.d.ts +144 -0
- package/lib/types/services/settings.d.ts +47 -0
- package/lib/types/types.d.ts +166 -0
- package/lib/types/ui/anchors.d.ts +56 -0
- package/lib/types/ui/components.d.ts +159 -0
- package/lib/types/ui/icons.d.ts +142 -0
- package/lib/types/ui/index.d.ts +30 -0
- package/lib/types/ui/menu.d.ts +104 -0
- package/lib/types/ui/slots.d.ts +152 -0
- package/lib/types/ui/style.d.ts +97 -0
- package/lib/types/version.d.ts +2 -0
- package/package.json +42 -9
- package/src/stable/compaction-basic.d.ts +1 -0
- package/src/stable/compaction-basic.js +5 -0
- package/src/stable/credentials.d.ts +1 -0
- package/src/stable/credentials.js +5 -0
- package/src/stable/subagent.d.ts +1 -0
- package/src/stable/subagent.js +5 -0
- package/src/stable/timeout.d.ts +1 -0
- package/src/stable/timeout.js +5 -0
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import type { CordisContext, SettingsAPI, SettingsResult, NamespaceView } from '../types.js';
|
|
2
|
+
/**
|
|
3
|
+
* Official browser-writable settings namespaces (dsh-host-apiproxy
|
|
4
|
+
* WEB_SETTINGS_NAMESPACES), as documented in dsh-upstream-fixes/README.md.
|
|
5
|
+
* Product namespaces and dynamic model-provider namespaces are not enumerable
|
|
6
|
+
* without dsh internals; callers may extend this set via `extraWhitelist`.
|
|
7
|
+
*/
|
|
8
|
+
export declare const DEFAULT_WEB_SETTINGS_NAMESPACES: Set<string>;
|
|
9
|
+
/** A raw settings descriptor returned by the real settings service. */
|
|
10
|
+
interface SettingsDescriptor {
|
|
11
|
+
ns: string;
|
|
12
|
+
schema: any;
|
|
13
|
+
value: any;
|
|
14
|
+
base?: any;
|
|
15
|
+
user?: any;
|
|
16
|
+
applies?: any;
|
|
17
|
+
secrets?: {
|
|
18
|
+
path: string[];
|
|
19
|
+
set?: any;
|
|
20
|
+
}[];
|
|
21
|
+
revision?: any;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Shape a raw settings descriptor into the official NamespaceView wire shape
|
|
25
|
+
* (mirrors dsh-upstream-fixes/lib/index.js `namespaceView`).
|
|
26
|
+
*/
|
|
27
|
+
export declare function toNamespaceView(descriptor: SettingsDescriptor): NamespaceView;
|
|
28
|
+
/**
|
|
29
|
+
* Map a thrown settings error into a SettingsResult, preserving the official
|
|
30
|
+
* `settings-conflict` / `settings-rejected` classification.
|
|
31
|
+
*/
|
|
32
|
+
export declare function settingsErrorToResult(error: unknown, ns: string, method: string): SettingsResult;
|
|
33
|
+
/**
|
|
34
|
+
* Build the `ctx.dshLoader.settings` stable API.
|
|
35
|
+
*/
|
|
36
|
+
export declare function createSettingsAPI(opts: {
|
|
37
|
+
ctx: CordisContext;
|
|
38
|
+
exposeAllNamespaces: boolean;
|
|
39
|
+
whitelist?: Set<string>;
|
|
40
|
+
/** The real `@deepseek-ai/dsh-settings` module, when it resolved at boot. */
|
|
41
|
+
module?: {
|
|
42
|
+
installSettingsSection?: (ctx: unknown, ns: unknown, schema: unknown, entry: unknown, hooks: unknown) => void;
|
|
43
|
+
settingsNamespace?: (id: string) => unknown;
|
|
44
|
+
SettingsConflictError?: new (...args: never[]) => Error;
|
|
45
|
+
};
|
|
46
|
+
}): SettingsAPI;
|
|
47
|
+
export {};
|
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared TypeScript types for dshloader (host + client).
|
|
3
|
+
*
|
|
4
|
+
* These describe only the shapes dshloader itself relies on from the cordis
|
|
5
|
+
* runtime, the real dsh settings/web services, and the browser client
|
|
6
|
+
* environment. The real dsh services are intentionally typed loosely (`any`)
|
|
7
|
+
* because dshloader's whole job is to absorb dsh's internal shape changes
|
|
8
|
+
* behind a stable API — pinning them here would defeat the compatibility
|
|
9
|
+
* shim's purpose.
|
|
10
|
+
*/
|
|
11
|
+
/** Minimal cordis context surface dshloader uses. */
|
|
12
|
+
export interface CordisContext {
|
|
13
|
+
get(name: string): any;
|
|
14
|
+
reflect: {
|
|
15
|
+
provide(name: string, value: any): void;
|
|
16
|
+
};
|
|
17
|
+
effect(fn: () => void | (() => void) | Promise<void | (() => void)>, label?: string): void;
|
|
18
|
+
/** Event registration; optional so a reduced context (tests) still type-checks. */
|
|
19
|
+
on?(event: string, listener: (...args: any[]) => any, options?: Record<string, unknown>): (() => void) | void;
|
|
20
|
+
/** Cordis logger; optional for the same reason. */
|
|
21
|
+
logger?: {
|
|
22
|
+
info?(...args: unknown[]): void;
|
|
23
|
+
warn?(...args: unknown[]): void;
|
|
24
|
+
error?(...args: unknown[]): void;
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
/** dshloader host adapter factory. */
|
|
28
|
+
export interface AdapterFactory {
|
|
29
|
+
supports: string;
|
|
30
|
+
name: string;
|
|
31
|
+
create(ctx: CordisContext, config?: HostAdapterConfig): HostAdapter;
|
|
32
|
+
}
|
|
33
|
+
/** An instantiated host adapter. */
|
|
34
|
+
export interface HostAdapter {
|
|
35
|
+
supports: string;
|
|
36
|
+
name: string;
|
|
37
|
+
apply?: () => Promise<void> | void;
|
|
38
|
+
dispose?: () => void;
|
|
39
|
+
/** Adapter-provided overrides for the stable API capabilities. */
|
|
40
|
+
settings?: any;
|
|
41
|
+
web?: any;
|
|
42
|
+
services?: any;
|
|
43
|
+
/** Optional override for the registry facade (it names private dsh shapes). */
|
|
44
|
+
registry?: any;
|
|
45
|
+
}
|
|
46
|
+
/** Config passed to an adapter's create(). */
|
|
47
|
+
export interface HostAdapterConfig {
|
|
48
|
+
exposeAllNamespaces?: boolean;
|
|
49
|
+
hostPackageAliases?: Record<string, string>;
|
|
50
|
+
}
|
|
51
|
+
/** Result of AdapterRegistry.select(). */
|
|
52
|
+
export interface AdapterSelection {
|
|
53
|
+
factory: AdapterFactory;
|
|
54
|
+
mode: 'exact' | 'range' | 'fallback';
|
|
55
|
+
}
|
|
56
|
+
/** dshloader host API exposed as `ctx.dshLoader`. */
|
|
57
|
+
export interface HostAPI {
|
|
58
|
+
version: string;
|
|
59
|
+
dshVersion?: string;
|
|
60
|
+
adapterVersion?: string;
|
|
61
|
+
settings: SettingsAPI;
|
|
62
|
+
web: WebAPI;
|
|
63
|
+
services: ServicesAPI;
|
|
64
|
+
/** Monkey-patch protocol: RAW original, identity-checked restore, re-apply safe. */
|
|
65
|
+
patch: import('./patch.js').PatchAPI;
|
|
66
|
+
/** Stable facade over dsh registry internals (tools / sandbox / permission presets). */
|
|
67
|
+
registry: import('./services/registry.js').RegistryAPI;
|
|
68
|
+
/** Module-level LLM helpers that `services.get('llm')` cannot reach. */
|
|
69
|
+
llm: import('./services/llm.js').LlmAPI;
|
|
70
|
+
/** Module-level dsh symbols (defineTool, deadline, BasicCompactionEngine, ...). */
|
|
71
|
+
dsh: import('./services/dsh-symbols.js').DshSymbolsAPI;
|
|
72
|
+
registerPackageAlias(oldName: string, newName: string): void;
|
|
73
|
+
}
|
|
74
|
+
/** Settings stable API. */
|
|
75
|
+
export interface SettingsAPI {
|
|
76
|
+
exposeAllNamespaces: boolean;
|
|
77
|
+
register(ns: string, schema: any, options?: any): any;
|
|
78
|
+
describe(options?: {
|
|
79
|
+
redactSecrets?: boolean;
|
|
80
|
+
}): any[];
|
|
81
|
+
update(ns: string, section?: any, expectedRevision?: number): Promise<SettingsResult>;
|
|
82
|
+
replace(ns: string, section?: any, expectedRevision?: number): Promise<SettingsResult>;
|
|
83
|
+
mutate(ns: string, ops?: any, expectedRevision?: number): Promise<SettingsResult>;
|
|
84
|
+
/**
|
|
85
|
+
* Build a settings namespace handle (delegates to dsh's `settingsNamespace`).
|
|
86
|
+
* @param id - namespace id; dsh accepts only `[a-z0-9-]`.
|
|
87
|
+
* @returns the namespace handle, or the raw id when the module is unavailable.
|
|
88
|
+
*/
|
|
89
|
+
namespace(id: string): any;
|
|
90
|
+
/**
|
|
91
|
+
* Install the canonical optional-settings consumer wiring (delegates to dsh's
|
|
92
|
+
* `installSettingsSection`): register `ns` with `entry` as the `base` layer,
|
|
93
|
+
* point the hooks' source thunk at the resolved scope while a settings service
|
|
94
|
+
* exists, and fall back to `entry` when it goes away.
|
|
95
|
+
*
|
|
96
|
+
* Delegated rather than reimplemented — the fallback and fiber semantics are
|
|
97
|
+
* real upstream behaviour, not something a shim should copy.
|
|
98
|
+
*
|
|
99
|
+
* @returns `true` when the wiring was installed, `false` when dsh-settings is
|
|
100
|
+
* unavailable (the caller then keeps using its composition entry).
|
|
101
|
+
*/
|
|
102
|
+
installSection<T>(ctx: any, ns: any, schema: any, entry: T, hooks: {
|
|
103
|
+
setSource(current: () => T): void;
|
|
104
|
+
onChange(): void;
|
|
105
|
+
validate(value: T): void;
|
|
106
|
+
}): boolean;
|
|
107
|
+
/** Whether `error` is dsh's optimistic-concurrency `SettingsConflictError`. */
|
|
108
|
+
isConflictError(error: unknown): boolean;
|
|
109
|
+
}
|
|
110
|
+
/** Settings write result shape. */
|
|
111
|
+
export interface SettingsResult {
|
|
112
|
+
ok: boolean;
|
|
113
|
+
value?: NamespaceView;
|
|
114
|
+
code?: string;
|
|
115
|
+
message?: string;
|
|
116
|
+
details?: Record<string, any>;
|
|
117
|
+
}
|
|
118
|
+
/** Official NamespaceView wire shape. */
|
|
119
|
+
export interface NamespaceView {
|
|
120
|
+
ns: string;
|
|
121
|
+
schema: any;
|
|
122
|
+
value: any;
|
|
123
|
+
base?: any;
|
|
124
|
+
user?: any;
|
|
125
|
+
applies?: any;
|
|
126
|
+
secrets: {
|
|
127
|
+
path: string[];
|
|
128
|
+
set?: any;
|
|
129
|
+
}[];
|
|
130
|
+
revision?: any;
|
|
131
|
+
}
|
|
132
|
+
/** Web stable API. */
|
|
133
|
+
export interface WebAPI {
|
|
134
|
+
/** Mount a handler on a path PREFIX (`kind: 'prefix'`), any method. */
|
|
135
|
+
register(prefix: string, handler: any): () => void;
|
|
136
|
+
/**
|
|
137
|
+
* Mount a handler on an EXACT path, any method (`kind: 'exact'`).
|
|
138
|
+
*
|
|
139
|
+
* Use this when one handler dispatches several methods itself — the shape
|
|
140
|
+
* dsh-network-settings' `/_dsh/.../settings` and `/_dsh/.../probe` routes use.
|
|
141
|
+
*/
|
|
142
|
+
exact(path: string, handler: any): () => void;
|
|
143
|
+
get(path: string, handler: any): () => void;
|
|
144
|
+
post(path: string, handler: any): () => void;
|
|
145
|
+
put(path: string, handler: any): () => void;
|
|
146
|
+
patch(path: string, handler: any): () => void;
|
|
147
|
+
/** `DELETE` route. Named `del` because `delete` is awkward on a facade. */
|
|
148
|
+
del(path: string, handler: any): () => void;
|
|
149
|
+
use(middleware: any): () => void;
|
|
150
|
+
registerUpgrade(route: {
|
|
151
|
+
path: string;
|
|
152
|
+
handler: (req: any, socket: any, head: Buffer) => void;
|
|
153
|
+
}): () => void;
|
|
154
|
+
}
|
|
155
|
+
/** Services stable API. */
|
|
156
|
+
export interface ServicesAPI {
|
|
157
|
+
get(name: string): any;
|
|
158
|
+
alias(from: string, to: string): void;
|
|
159
|
+
}
|
|
160
|
+
/** Selectable adapter entry exposed for CLI/tests. */
|
|
161
|
+
export interface AdapterSelectionResult {
|
|
162
|
+
registry: import('./registry.js').AdapterRegistry;
|
|
163
|
+
factory: AdapterFactory;
|
|
164
|
+
mode: AdapterSelection['mode'];
|
|
165
|
+
dshVersion: string;
|
|
166
|
+
}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The dsh-1-x SHELL ANCHOR TABLE.
|
|
3
|
+
*
|
|
4
|
+
* Every entry is a selector some plugin in this family currently hardcodes.
|
|
5
|
+
* Centralising them here is the whole point of `dshLoader.ui`: when dsh moves
|
|
6
|
+
* its DOM, this table changes and the plugins do not.
|
|
7
|
+
*
|
|
8
|
+
* Each anchor records WHO needed it and WHAT it was before, so a future
|
|
9
|
+
* maintainer can trace an anchor back to the behaviour it supports.
|
|
10
|
+
*
|
|
11
|
+
* @module @dsh-plugin/dsh-loader/ui/anchors
|
|
12
|
+
*/
|
|
13
|
+
import type { AnchorSpec } from './slots.js';
|
|
14
|
+
/** Anchor names dshloader ships for the dsh 1.x shell. */
|
|
15
|
+
export declare const ANCHOR_NAMES: readonly ['conversation.status', 'conversation.column', 'shell.overlay', 'desktop.detailsSurface', 'layout.frame', 'settings.nav'];
|
|
16
|
+
/** One of the built-in anchor names. */
|
|
17
|
+
export type BuiltinAnchor = (typeof ANCHOR_NAMES)[number];
|
|
18
|
+
/**
|
|
19
|
+
* The built-in anchors for dsh 1.x (verified against dsh 0.1.0-rc.6).
|
|
20
|
+
*
|
|
21
|
+
* Provenance of each selector:
|
|
22
|
+
*
|
|
23
|
+
* - `conversation.status` — dsh-thought-buddy, `src/client/index.ts:632-637`:
|
|
24
|
+
* `[data-conversation-scroll] [role="status"]` with a whole-document
|
|
25
|
+
* `[role="status"]` fallback. Callers add their own `accept` (thought-buddy
|
|
26
|
+
* matches the status text) via {@link AnchorSpec.accept} on a redefinition,
|
|
27
|
+
* or filter in `MountSpec.when`.
|
|
28
|
+
* - `conversation.column` — dsh-better-sidebar, `src/client/Sidebar.tsx:396`:
|
|
29
|
+
* `#root [data-slot="conversation"]`.
|
|
30
|
+
* - `shell.overlay` — dsh-code-review, `src/client.ts:1930` / `:2528`:
|
|
31
|
+
* `[data-shell-overlay]`.
|
|
32
|
+
* - `desktop.detailsSurface` — dsh-code-review, `src/client.ts:1957`:
|
|
33
|
+
* `.dshDesktopDetailsSurface`. A CSS-module-adjacent CLASS name and therefore
|
|
34
|
+
* the most fragile anchor in the table; kept because the behaviour needs it.
|
|
35
|
+
* - `layout.frame` — dsh-code-review, `src/client.ts:1176` / `:1209` / `:1244`:
|
|
36
|
+
* the frame whose `style.gridTemplateColumns` carries the sidebar width and
|
|
37
|
+
* whose `data-sidebar-collapsed` attribute carries the collapsed state. This
|
|
38
|
+
* anchor is READ (via `ui.hosts('layout.frame')`), never mounted into.
|
|
39
|
+
* - `settings.nav` — dsh-better-sidebar, `src/client/settings-nav-icon.ts`:
|
|
40
|
+
* the settings navigation list that gets an icon synced into it.
|
|
41
|
+
*/
|
|
42
|
+
export declare const BUILTIN_ANCHORS: Record<BuiltinAnchor, AnchorSpec>;
|
|
43
|
+
/** Read the sidebar layout state from the `layout.frame` anchor. */
|
|
44
|
+
export interface LayoutFrameState {
|
|
45
|
+
/** Whether the shell reports the sidebar as collapsed. */
|
|
46
|
+
collapsed: boolean;
|
|
47
|
+
/** First `px` value of the frame's grid template, when present. */
|
|
48
|
+
firstColumnPx: number | undefined;
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Project one `layout.frame` host into {@link LayoutFrameState}.
|
|
52
|
+
*
|
|
53
|
+
* Encapsulates the `style.gridTemplateColumns` parsing dsh-code-review does at
|
|
54
|
+
* `src/client.ts:1176`, so the regex lives with the anchor it belongs to.
|
|
55
|
+
*/
|
|
56
|
+
export declare function readLayoutFrame(host: Element): LayoutFrameState;
|
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The dshloader BASE CONTROLS.
|
|
3
|
+
*
|
|
4
|
+
* A small, deliberately unopinionated control set so every plugin in this family
|
|
5
|
+
* renders the same design language instead of each hand-rolling inline styles
|
|
6
|
+
* (dsh-network-settings alone carries ~40 inline style objects today, and
|
|
7
|
+
* dsh-auxiliary / dsh-code-review each maintain their own button and input
|
|
8
|
+
* looks).
|
|
9
|
+
*
|
|
10
|
+
* Design rules:
|
|
11
|
+
* - Styling is ONE injected stylesheet with `dshl-` prefixed classes, tagged
|
|
12
|
+
* with the DSH `data-plugin` / `data-plugin-css` ownership attributes so HMR
|
|
13
|
+
* can reclaim it. No CSS Modules, so consumers need no build-time CSS setup.
|
|
14
|
+
* - Every colour is a DSH token with a fallback (see `./style.js`), so controls
|
|
15
|
+
* follow the shell's theme, including dark mode, with no JS theme plumbing.
|
|
16
|
+
* - Icons come from the curated set and inherit `currentColor`.
|
|
17
|
+
* - Every control forwards native props and `className`, so a plugin can always
|
|
18
|
+
* escape the defaults without forking the component.
|
|
19
|
+
*
|
|
20
|
+
* @module @dsh-plugin/dsh-loader/ui/components
|
|
21
|
+
*/
|
|
22
|
+
import * as React from 'react';
|
|
23
|
+
import { type IconName } from './icons.js';
|
|
24
|
+
/** Inject the control stylesheet once (idempotent, safe to call from any component). */
|
|
25
|
+
export declare function ensureStyles(): void;
|
|
26
|
+
/** Visual weight of a {@link Button}. */
|
|
27
|
+
export type ButtonVariant = 'default' | 'primary' | 'ghost' | 'danger';
|
|
28
|
+
/** {@link Button} props. */
|
|
29
|
+
export interface ButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {
|
|
30
|
+
variant?: ButtonVariant;
|
|
31
|
+
/** Compact height. */
|
|
32
|
+
small?: boolean;
|
|
33
|
+
/** Leading icon from the curated set. */
|
|
34
|
+
icon?: IconName;
|
|
35
|
+
/** Replace the label with a spinner and disable interaction. */
|
|
36
|
+
loading?: boolean;
|
|
37
|
+
}
|
|
38
|
+
/** A button in the DSH design language. */
|
|
39
|
+
export declare const Button: React.ForwardRefExoticComponent<ButtonProps & React.RefAttributes<HTMLButtonElement>>;
|
|
40
|
+
/** {@link IconButton} props. */
|
|
41
|
+
export interface IconButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {
|
|
42
|
+
/** Icon from the curated set. */
|
|
43
|
+
icon: IconName;
|
|
44
|
+
/** Accessible name — required, since the button has no visible text. */
|
|
45
|
+
label: string;
|
|
46
|
+
}
|
|
47
|
+
/** A square icon-only button. `label` becomes its accessible name. */
|
|
48
|
+
export declare const IconButton: React.ForwardRefExoticComponent<IconButtonProps & React.RefAttributes<HTMLButtonElement>>;
|
|
49
|
+
/** {@link TextInput} props. */
|
|
50
|
+
export interface TextInputProps extends React.InputHTMLAttributes<HTMLInputElement> {
|
|
51
|
+
/** Render with the monospace stack (paths, commands, tokens). */
|
|
52
|
+
mono?: boolean;
|
|
53
|
+
/** Mark the field as failing validation. */
|
|
54
|
+
invalid?: boolean;
|
|
55
|
+
}
|
|
56
|
+
/** A single-line text input. */
|
|
57
|
+
export declare const TextInput: React.ForwardRefExoticComponent<TextInputProps & React.RefAttributes<HTMLInputElement>>;
|
|
58
|
+
/** {@link Textarea} props. */
|
|
59
|
+
export interface TextareaProps extends React.TextareaHTMLAttributes<HTMLTextAreaElement> {
|
|
60
|
+
mono?: boolean;
|
|
61
|
+
invalid?: boolean;
|
|
62
|
+
}
|
|
63
|
+
/** A multi-line text area. */
|
|
64
|
+
export declare const Textarea: React.ForwardRefExoticComponent<TextareaProps & React.RefAttributes<HTMLTextAreaElement>>;
|
|
65
|
+
/** One option of a {@link Select}. */
|
|
66
|
+
export interface SelectOption {
|
|
67
|
+
value: string;
|
|
68
|
+
label: string;
|
|
69
|
+
disabled?: boolean;
|
|
70
|
+
}
|
|
71
|
+
/** {@link Select} props. */
|
|
72
|
+
export interface SelectProps extends Omit<React.SelectHTMLAttributes<HTMLSelectElement>, 'children'> {
|
|
73
|
+
options: readonly SelectOption[];
|
|
74
|
+
/** Optional leading placeholder rendered as a disabled empty option. */
|
|
75
|
+
placeholder?: string;
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* A dropdown built on the native `<select>`.
|
|
79
|
+
*
|
|
80
|
+
* Native on purpose: it inherits the platform's keyboard handling, mobile
|
|
81
|
+
* pickers, and accessibility for free. Plugins needing DSH's rich popup should
|
|
82
|
+
* use `Menu` from `@dsh-plugin/dsh-loader/ui-primitives` instead.
|
|
83
|
+
*/
|
|
84
|
+
export declare const Select: React.ForwardRefExoticComponent<SelectProps & React.RefAttributes<HTMLSelectElement>>;
|
|
85
|
+
/** {@link MenuSelect} props — a value dropdown rendered with the platform menu. */
|
|
86
|
+
export interface MenuSelectProps {
|
|
87
|
+
options: readonly SelectOption[];
|
|
88
|
+
/** Currently selected value; renders {@link placeholder} when unmatched. */
|
|
89
|
+
value?: string;
|
|
90
|
+
placeholder?: string;
|
|
91
|
+
disabled?: boolean;
|
|
92
|
+
/** Called with the chosen option's value. */
|
|
93
|
+
onChange?: (value: string) => void;
|
|
94
|
+
id?: string;
|
|
95
|
+
/** Field label, used for the trigger's accessible name. */
|
|
96
|
+
label?: string;
|
|
97
|
+
className?: string;
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
100
|
+
* A dropdown whose trigger and popup match the shell's own pickers (the
|
|
101
|
+
* dsh-auxiliary model picker look): a bordered layer-1 trigger button plus the
|
|
102
|
+
* platform menu popup via {@link DshMenu}.
|
|
103
|
+
*
|
|
104
|
+
* Prefer this over {@link Select} on settings pages: the native `<select>`
|
|
105
|
+
* popup is OS-styled and cannot follow the shell theme, which is exactly the
|
|
106
|
+
* visual drift this component removes. `Select` remains for dense/inline forms
|
|
107
|
+
* where the native control's compactness matters.
|
|
108
|
+
*/
|
|
109
|
+
export declare function MenuSelect({ options, value, placeholder, disabled, onChange, id, label, className, }: MenuSelectProps): React.ReactElement;
|
|
110
|
+
/** {@link Checkbox} props. */
|
|
111
|
+
export interface CheckboxProps extends Omit<React.InputHTMLAttributes<HTMLInputElement>, 'type'> {
|
|
112
|
+
/** Text beside the box. */
|
|
113
|
+
label?: React.ReactNode;
|
|
114
|
+
}
|
|
115
|
+
/** A checkbox with an optional label. Native input styled via `accent-color`,
|
|
116
|
+
* matching the shell's own settings pages. */
|
|
117
|
+
export declare const Checkbox: React.ForwardRefExoticComponent<CheckboxProps & React.RefAttributes<HTMLInputElement>>;
|
|
118
|
+
/** {@link Switch} props. */
|
|
119
|
+
export interface SwitchProps extends Omit<React.InputHTMLAttributes<HTMLInputElement>, 'type'> {
|
|
120
|
+
label?: React.ReactNode;
|
|
121
|
+
}
|
|
122
|
+
/** A toggle switch — use for "applies immediately" settings. */
|
|
123
|
+
export declare const Switch: React.ForwardRefExoticComponent<SwitchProps & React.RefAttributes<HTMLInputElement>>;
|
|
124
|
+
/** {@link Field} props. */
|
|
125
|
+
export interface FieldProps {
|
|
126
|
+
label?: React.ReactNode;
|
|
127
|
+
/** Supporting description under the control. */
|
|
128
|
+
description?: React.ReactNode;
|
|
129
|
+
/** Validation message; renders in the danger colour. */
|
|
130
|
+
error?: React.ReactNode;
|
|
131
|
+
/** Associates the label with the control. */
|
|
132
|
+
htmlFor?: string;
|
|
133
|
+
children?: React.ReactNode;
|
|
134
|
+
className?: string;
|
|
135
|
+
}
|
|
136
|
+
/** Label + control + description/error, the standard settings row. */
|
|
137
|
+
export declare function Field({ label, description, error, htmlFor, children, className }: FieldProps): React.ReactElement;
|
|
138
|
+
/** {@link Card} props. */
|
|
139
|
+
export interface CardProps {
|
|
140
|
+
title?: React.ReactNode;
|
|
141
|
+
children?: React.ReactNode;
|
|
142
|
+
className?: string;
|
|
143
|
+
}
|
|
144
|
+
/** A bordered section container — the settings-page card look. */
|
|
145
|
+
export declare function Card({ title, children, className }: CardProps): React.ReactElement;
|
|
146
|
+
/** A horizontal flex row with the standard gap. */
|
|
147
|
+
export declare function Row({ children, className }: {
|
|
148
|
+
children?: React.ReactNode;
|
|
149
|
+
className?: string;
|
|
150
|
+
}): React.ReactElement;
|
|
151
|
+
/** A vertical flex column with the standard gap. */
|
|
152
|
+
export declare function Col({ children, className }: {
|
|
153
|
+
children?: React.ReactNode;
|
|
154
|
+
className?: string;
|
|
155
|
+
}): React.ReactElement;
|
|
156
|
+
/** An inline spinner. */
|
|
157
|
+
export declare function Spinner({ size }: {
|
|
158
|
+
size?: number;
|
|
159
|
+
}): React.ReactElement;
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The curated dshloader ICON SET.
|
|
3
|
+
*
|
|
4
|
+
* Sourced from `@icon-park/react` so no plugin hand-maintains SVG path data
|
|
5
|
+
* again (dsh-better-sidebar's `src/client/icons.tsx` keeps 10 icons by hand
|
|
6
|
+
* today; every entry here replaces one of those or a
|
|
7
|
+
* `@deepseek-ai/dsh-client-ui-primitives` icon import).
|
|
8
|
+
*
|
|
9
|
+
* WHY A SUBSET, NOT `export *`: IconPark ships ~2000 icons. dshloader's client
|
|
10
|
+
* bundle is materialised through the DSH client module table, and a runtime
|
|
11
|
+
* module boundary cannot be tree-shaken — re-exporting everything would put all
|
|
12
|
+
* ~2000 icons into one bundle every plugin pays for. Naming a subset keeps the
|
|
13
|
+
* cost proportional (only the icons listed here are bundled), and a plugin that
|
|
14
|
+
* needs an exotic glyph can still depend on `@icon-park/react` directly.
|
|
15
|
+
*
|
|
16
|
+
* Adding an icon: import it below and add it to the export block. That is the
|
|
17
|
+
* only change needed — no SVG, no viewBox, no stroke bookkeeping.
|
|
18
|
+
*
|
|
19
|
+
* @module @dsh-plugin/dsh-loader/ui/icons
|
|
20
|
+
*/
|
|
21
|
+
import * as React from 'react';
|
|
22
|
+
import { IconProvider, type IIconProps, type Theme } from '@icon-park/react/es/runtime';
|
|
23
|
+
/** Props every dshloader icon accepts (IconPark's own prop contract). */
|
|
24
|
+
export type IconProps = IIconProps;
|
|
25
|
+
/** An icon component. */
|
|
26
|
+
export type IconComponent = (props: IconProps) => React.ReactElement;
|
|
27
|
+
/**
|
|
28
|
+
* The curated set, grouped by purpose. Names are intent-based (`Settings`,
|
|
29
|
+
* `Warning`) rather than IconPark's raw names so a glyph can be swapped without
|
|
30
|
+
* touching consumers.
|
|
31
|
+
*/
|
|
32
|
+
export declare const Icons: {
|
|
33
|
+
readonly ChevronUp: import("@icon-park/react/es/runtime").Icon;
|
|
34
|
+
readonly ChevronDown: import("@icon-park/react/es/runtime").Icon;
|
|
35
|
+
readonly ChevronLeft: import("@icon-park/react/es/runtime").Icon;
|
|
36
|
+
readonly ChevronRight: import("@icon-park/react/es/runtime").Icon;
|
|
37
|
+
readonly Back: import("@icon-park/react/es/runtime").Icon;
|
|
38
|
+
readonly Expand: import("@icon-park/react/es/runtime").Icon;
|
|
39
|
+
readonly More: import("@icon-park/react/es/runtime").Icon;
|
|
40
|
+
readonly Sort: import("@icon-park/react/es/runtime").Icon;
|
|
41
|
+
readonly Add: import("@icon-park/react/es/runtime").Icon;
|
|
42
|
+
readonly Edit: import("@icon-park/react/es/runtime").Icon;
|
|
43
|
+
readonly Write: import("@icon-park/react/es/runtime").Icon;
|
|
44
|
+
readonly Delete: import("@icon-park/react/es/runtime").Icon;
|
|
45
|
+
readonly Copy: import("@icon-park/react/es/runtime").Icon;
|
|
46
|
+
readonly Save: import("@icon-park/react/es/runtime").Icon;
|
|
47
|
+
readonly Search: import("@icon-park/react/es/runtime").Icon;
|
|
48
|
+
readonly Refresh: import("@icon-park/react/es/runtime").Icon;
|
|
49
|
+
readonly Download: import("@icon-park/react/es/runtime").Icon;
|
|
50
|
+
readonly Upload: import("@icon-park/react/es/runtime").Icon;
|
|
51
|
+
readonly Undo: import("@icon-park/react/es/runtime").Icon;
|
|
52
|
+
readonly Redo: import("@icon-park/react/es/runtime").Icon;
|
|
53
|
+
readonly Play: import("@icon-park/react/es/runtime").Icon;
|
|
54
|
+
readonly Stop: import("@icon-park/react/es/runtime").Icon;
|
|
55
|
+
readonly Close: import("@icon-park/react/es/runtime").Icon;
|
|
56
|
+
readonly CloseSmall: import("@icon-park/react/es/runtime").Icon;
|
|
57
|
+
readonly Check: import("@icon-park/react/es/runtime").Icon;
|
|
58
|
+
readonly CheckSmall: import("@icon-park/react/es/runtime").Icon;
|
|
59
|
+
readonly Info: import("@icon-park/react/es/runtime").Icon;
|
|
60
|
+
readonly Warning: import("@icon-park/react/es/runtime").Icon;
|
|
61
|
+
readonly Error: import("@icon-park/react/es/runtime").Icon;
|
|
62
|
+
readonly Success: import("@icon-park/react/es/runtime").Icon;
|
|
63
|
+
readonly Loading: import("@icon-park/react/es/runtime").Icon;
|
|
64
|
+
readonly Help: import("@icon-park/react/es/runtime").Icon;
|
|
65
|
+
readonly Settings: import("@icon-park/react/es/runtime").Icon;
|
|
66
|
+
readonly SettingsAlt: import("@icon-park/react/es/runtime").Icon;
|
|
67
|
+
readonly Config: import("@icon-park/react/es/runtime").Icon;
|
|
68
|
+
readonly Terminal: import("@icon-park/react/es/runtime").Icon;
|
|
69
|
+
readonly Code: import("@icon-park/react/es/runtime").Icon;
|
|
70
|
+
readonly FileCode: import("@icon-park/react/es/runtime").Icon;
|
|
71
|
+
readonly Doc: import("@icon-park/react/es/runtime").Icon;
|
|
72
|
+
readonly Folder: import("@icon-park/react/es/runtime").Icon;
|
|
73
|
+
readonly FolderOpen: import("@icon-park/react/es/runtime").Icon;
|
|
74
|
+
readonly GitBranch: import("@icon-park/react/es/runtime").Icon;
|
|
75
|
+
readonly Link: import("@icon-park/react/es/runtime").Icon;
|
|
76
|
+
readonly Web: import("@icon-park/react/es/runtime").Icon;
|
|
77
|
+
readonly Browser: import("@icon-park/react/es/runtime").Icon;
|
|
78
|
+
readonly Lock: import("@icon-park/react/es/runtime").Icon;
|
|
79
|
+
readonly Unlock: import("@icon-park/react/es/runtime").Icon;
|
|
80
|
+
readonly EyeOpen: import("@icon-park/react/es/runtime").Icon;
|
|
81
|
+
readonly EyeClosed: import("@icon-park/react/es/runtime").Icon;
|
|
82
|
+
readonly Alarm: import("@icon-park/react/es/runtime").Icon;
|
|
83
|
+
readonly Diamond: import("@icon-park/react/es/runtime").Icon;
|
|
84
|
+
readonly Apps: import("@icon-park/react/es/runtime").Icon;
|
|
85
|
+
};
|
|
86
|
+
/** Name of a curated icon. */
|
|
87
|
+
export type IconName = keyof typeof Icons;
|
|
88
|
+
/** Every curated icon name, for pickers and tests. */
|
|
89
|
+
export declare const ICON_NAMES: IconName[];
|
|
90
|
+
/**
|
|
91
|
+
* Look one icon up by name. Unknown names resolve to `Help` rather than
|
|
92
|
+
* throwing, so a stale name degrades to a visible placeholder.
|
|
93
|
+
*/
|
|
94
|
+
export declare function icon(name: IconName): IconComponent;
|
|
95
|
+
/**
|
|
96
|
+
* `<Icon name="Settings" />` — the ergonomic form for data-driven icon choices
|
|
97
|
+
* (menu descriptors, settings rows) where a component reference is awkward.
|
|
98
|
+
*/
|
|
99
|
+
export declare function Icon({ name, ...rest }: {
|
|
100
|
+
name: IconName;
|
|
101
|
+
} & IconProps): React.ReactElement;
|
|
102
|
+
/** The icon defaults dshloader components render with. */
|
|
103
|
+
export declare const DSH_ICON_CONFIG: {
|
|
104
|
+
strokeLinecap: import("@icon-park/react/es/runtime").StrokeLinecap;
|
|
105
|
+
strokeLinejoin: import("@icon-park/react/es/runtime").StrokeLinejoin;
|
|
106
|
+
prefix: string;
|
|
107
|
+
rtl: boolean;
|
|
108
|
+
size: number;
|
|
109
|
+
strokeWidth: number;
|
|
110
|
+
theme: Theme;
|
|
111
|
+
colors: {
|
|
112
|
+
filled: {
|
|
113
|
+
fill: string;
|
|
114
|
+
background: string;
|
|
115
|
+
};
|
|
116
|
+
twoTone: {
|
|
117
|
+
fill: string;
|
|
118
|
+
twoTone: string;
|
|
119
|
+
};
|
|
120
|
+
multiColor: {
|
|
121
|
+
outStrokeColor: string;
|
|
122
|
+
outFillColor: string;
|
|
123
|
+
innerStrokeColor: string;
|
|
124
|
+
innerFillColor: string;
|
|
125
|
+
};
|
|
126
|
+
outline: {
|
|
127
|
+
fill: string;
|
|
128
|
+
background: string;
|
|
129
|
+
};
|
|
130
|
+
};
|
|
131
|
+
};
|
|
132
|
+
/**
|
|
133
|
+
* Wrap a subtree so every dshloader icon inside inherits the DSH defaults
|
|
134
|
+
* (outline theme, `currentColor` fill, matching size). Plugins that render
|
|
135
|
+
* dshloader components inside their own React tree should mount this once near
|
|
136
|
+
* the root; the components in `./components.js` do not require it, but they look
|
|
137
|
+
* consistent with the rest of DSH when it is present.
|
|
138
|
+
*/
|
|
139
|
+
export declare function DshIconProvider({ children }: {
|
|
140
|
+
children?: React.ReactNode;
|
|
141
|
+
}): React.ReactElement;
|
|
142
|
+
export { IconProvider };
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The dshloader UI surface: virtual slots, the curated icon set, and the base
|
|
3
|
+
* controls, wrapped as one `ui` facade.
|
|
4
|
+
*
|
|
5
|
+
* Consumers reach this at runtime through `@dsh-plugin/dsh-loader/client`, which
|
|
6
|
+
* the DSH client module table resolves by stripping the `/client` suffix to
|
|
7
|
+
* dshloader's registered bundle id — so no alias and no load-order coordination
|
|
8
|
+
* is needed (see docs/ui.md).
|
|
9
|
+
*
|
|
10
|
+
* @module @dsh-plugin/dsh-loader/ui
|
|
11
|
+
*/
|
|
12
|
+
import { type LayoutFrameState } from './anchors.js';
|
|
13
|
+
import { type CreateUiOptions, type UiAPI } from './slots.js';
|
|
14
|
+
export * from './slots.js';
|
|
15
|
+
export * from './anchors.js';
|
|
16
|
+
export * from './style.js';
|
|
17
|
+
export * from './icons.js';
|
|
18
|
+
export * from './components.js';
|
|
19
|
+
export * from './menu.js';
|
|
20
|
+
/** The `ui` facade plus the built-in anchor helpers. */
|
|
21
|
+
export interface DshLoaderUi extends UiAPI {
|
|
22
|
+
/** Read the shell's sidebar layout state, when the anchor resolves. */
|
|
23
|
+
layoutFrame(): LayoutFrameState | undefined;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Build the UI facade and seed it with the dsh 1.x anchor table.
|
|
27
|
+
*
|
|
28
|
+
* @param options - forwarded to {@link createUiAPI} (observe root, warn sink).
|
|
29
|
+
*/
|
|
30
|
+
export declare function createUi(options?: CreateUiOptions): DshLoaderUi;
|