@linxin666/dsh-client-ui-browser-view 0.4.11 → 0.4.13
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/README.i18n.yaml +2 -2
- package/README.md +43 -12
- package/README.zh.md +43 -12
- package/icon.svg +3 -0
- package/lib/client.js +1733 -17
- package/lib/client.js.map +1 -1
- package/lib/index.js +363 -48
- package/lib/types/client/BrowserViewSettingsCard.d.ts +40 -0
- package/lib/types/client/PluginSettingsCard.d.ts +255 -0
- package/lib/types/client/RangeBubble.d.ts +46 -0
- package/lib/types/client/SegmentGroup.d.ts +28 -0
- package/lib/types/client/config.d.ts +6 -0
- package/lib/types/client/index.d.ts +10 -0
- package/lib/types/client/locales.d.ts +26 -0
- package/lib/types/client/plugin-card-seat.d.ts +110 -0
- package/lib/types/client/settings-entry-form.d.ts +49 -0
- package/lib/types/client/settings-form.d.ts +235 -0
- package/lib/types/core/protocol.d.ts +7 -1
- package/lib/types/core/tabs.d.ts +20 -0
- package/lib/types/host/cdp-endpoint.d.ts +27 -0
- package/lib/types/host/config.d.ts +26 -0
- package/lib/types/host/service.d.ts +25 -9
- package/lib/types/index.d.ts +10 -1
- package/locale/en.json +6 -0
- package/locale/zh.json +6 -0
- package/package.json +14 -2
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The real-browser CDP settings card for the Web Extensions plugin list.
|
|
3
|
+
* @module @linxin666/dsh-client-ui-browser-view/client/settings-card
|
|
4
|
+
*/
|
|
5
|
+
import type { Context as ClientContext } from '@deepseek-ai/cordis';
|
|
6
|
+
import type { InjectFace, PropsLocale, PropsRuntime } from '@deepseek-ai/dsh-client-ui-slots';
|
|
7
|
+
import type { ConfigForm } from '@deepseek-ai/dsh-client-ui-settings/client';
|
|
8
|
+
import type { SnapshotStore } from '@deepseek-ai/dsh-client-store';
|
|
9
|
+
import { type CardActions, type CardShell, type FieldState } from './settings-form.ts';
|
|
10
|
+
/** Fields shared with the host's real-browser schema. */
|
|
11
|
+
export interface BrowserViewSettings {
|
|
12
|
+
realBrowserEnabled?: boolean;
|
|
13
|
+
cdpEndpoint?: string;
|
|
14
|
+
}
|
|
15
|
+
/** Card projection bound by the renderer. */
|
|
16
|
+
export interface BrowserViewSettingsCardState extends CardShell {
|
|
17
|
+
realBrowserEnabled: FieldState;
|
|
18
|
+
cdpEndpoint: FieldState;
|
|
19
|
+
}
|
|
20
|
+
/** Registration-side snapshot and write actions. */
|
|
21
|
+
export interface BrowserViewSettingsCardFace extends CardActions {
|
|
22
|
+
hooks: {
|
|
23
|
+
browserViewSettingsCard: SnapshotStore<BrowserViewSettingsCardState>;
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
/** Bind the existing browser-view namespace, never a second settings document. */
|
|
27
|
+
export declare function bindBrowserViewSettingsForm(ctx: ClientContext): ConfigForm<BrowserViewSettings>;
|
|
28
|
+
/** Bridge the native volatile form onto the shared staged card form. */
|
|
29
|
+
export declare class BrowserViewSettingsCardController {
|
|
30
|
+
private readonly form;
|
|
31
|
+
private readonly store;
|
|
32
|
+
constructor(scope: ConfigForm<BrowserViewSettings>);
|
|
33
|
+
private projection;
|
|
34
|
+
inject(): BrowserViewSettingsCardFace;
|
|
35
|
+
dispose(): void;
|
|
36
|
+
}
|
|
37
|
+
/** Props supplied by the Web Extensions plugin-item seat. */
|
|
38
|
+
export type BrowserViewSettingsCardProps = PropsRuntime<'web-ui.plugin.item'> & PropsLocale<'browser-view'> & InjectFace<BrowserViewSettingsCardFace>;
|
|
39
|
+
/** Render the real-browser card with the same chrome and field semantics as its siblings. */
|
|
40
|
+
export declare function BrowserViewSettingsCard(props: BrowserViewSettingsCardProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,255 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Family-shared chrome for plugin settings cards: a disclosure header naming
|
|
3
|
+
* the plugin and what its settings govern, the controls inside, and the line
|
|
4
|
+
* that reports a refused write. A pick is written the moment it is made and a
|
|
5
|
+
* typed value after a pause, so the card has no save button and nothing waits
|
|
6
|
+
* on the reader. Renders nothing while the namespace is unavailable — a
|
|
7
|
+
* deployment that does not compose the owning plugin should show no trace of
|
|
8
|
+
* it. Inlined into each consumer's client bundle; mirrors the official
|
|
9
|
+
* ui-plugin-config PluginCard in a self-contained slice.
|
|
10
|
+
*
|
|
11
|
+
* Every field inside the body is one settings row: the label and its hint on
|
|
12
|
+
* the left, the control on the right, a hairline between two rows; a narrow
|
|
13
|
+
* card stacks the control under the text (settings-card.module.css).
|
|
14
|
+
*/
|
|
15
|
+
import { type ReactNode } from 'react';
|
|
16
|
+
import type { CardShell } from './settings-form.ts';
|
|
17
|
+
/** Copy keys the card chrome itself reads; every consumer locale carries this shared vocabulary. */
|
|
18
|
+
export declare const CARD_COPY_KEYS: readonly ["settings.collapse", "settings.expand", "settings.notExposed", "settings.readOnly", "settings.saveFailed"];
|
|
19
|
+
/** Copy key the card chrome itself reads. */
|
|
20
|
+
export type CardCopyKey = (typeof CARD_COPY_KEYS)[number];
|
|
21
|
+
/** Key domain for the plugin's own copy (inferred per consumer). */
|
|
22
|
+
export type SettingsCardKey<TKey extends string = string> = TKey | CardCopyKey;
|
|
23
|
+
/** Card chrome shared by every plugin settings card. */
|
|
24
|
+
export interface PluginSettingsCardProps<TKey extends string = string> {
|
|
25
|
+
/** Locale reader for this card's copy. */
|
|
26
|
+
t: (key: SettingsCardKey<TKey>, params?: Record<string, string | number>) => string;
|
|
27
|
+
/** Locale key of the plugin's name. */
|
|
28
|
+
titleKey: TKey;
|
|
29
|
+
/** Locale key of the line describing what this plugin's settings govern. */
|
|
30
|
+
descriptionKey: TKey;
|
|
31
|
+
/** Optional rich header description rendered instead of the plain t(descriptionKey) text (the plain text stays as the tooltip). */
|
|
32
|
+
descriptionNode?: ReactNode;
|
|
33
|
+
/**
|
|
34
|
+
* Locale key of the full sentence behind a shortened description: when
|
|
35
|
+
* present, the header's native `title` takes this text while the visible
|
|
36
|
+
* line keeps `descriptionKey`/`descriptionNode`, so a compact card can
|
|
37
|
+
* compress the sentence without keeping a second visible copy of it.
|
|
38
|
+
* Defaults to the description key.
|
|
39
|
+
*/
|
|
40
|
+
descriptionTitleKey?: TKey;
|
|
41
|
+
/**
|
|
42
|
+
* Optional leading mark identifying the plugin. A card without one keeps the
|
|
43
|
+
* plain official header shape, so the chrome stays a readable sibling of the
|
|
44
|
+
* built-in PluginCard wherever a family plugin lands in the official bundle
|
|
45
|
+
* seat.
|
|
46
|
+
*/
|
|
47
|
+
icon?: ReactNode;
|
|
48
|
+
/** The card's form state: availability, writability, and how the last write went. */
|
|
49
|
+
state: CardShell;
|
|
50
|
+
/** Write every pending draft now: a text field's Enter or blur. */
|
|
51
|
+
onSave: () => void;
|
|
52
|
+
/** Drop every pending draft: a text field's Escape. */
|
|
53
|
+
onDiscard: () => void;
|
|
54
|
+
/**
|
|
55
|
+
* Id applied to the card's title element, so a header control (an immediate
|
|
56
|
+
* toggle in `headerAction`) can name itself through `aria-labelledby`
|
|
57
|
+
* instead of repeating the title as a string.
|
|
58
|
+
*/
|
|
59
|
+
titleId?: string;
|
|
60
|
+
/**
|
|
61
|
+
* Render the header only, with no body region. A card whose whole setting is
|
|
62
|
+
* the header control (a switch whose explanation is the description) has no
|
|
63
|
+
* controls to lay out below it, and an empty body would draw a divider line
|
|
64
|
+
* with nothing under it.
|
|
65
|
+
*/
|
|
66
|
+
headerOnly?: boolean;
|
|
67
|
+
/**
|
|
68
|
+
* Render the controls expanded on arrival (still collapsible). Defaults to
|
|
69
|
+
* true: promoted first-level sections show their settings immediately.
|
|
70
|
+
*/
|
|
71
|
+
defaultOpen?: boolean;
|
|
72
|
+
/**
|
|
73
|
+
* Render without the collapse affordance: a static header and an always
|
|
74
|
+
* visible body. Used by first-level settings sections whose nav entry
|
|
75
|
+
* already provides the selection.
|
|
76
|
+
*/
|
|
77
|
+
alwaysOpen?: boolean;
|
|
78
|
+
/**
|
|
79
|
+
* Hide the line under the body that reports a refused write: a card whose
|
|
80
|
+
* body applies its own changes (an embedded external settings section)
|
|
81
|
+
* reports its own failures.
|
|
82
|
+
*/
|
|
83
|
+
hideFooter?: boolean;
|
|
84
|
+
/**
|
|
85
|
+
* Optional control rendered at the header's trailing edge, before the
|
|
86
|
+
* chevron. A card whose setting is one immediate flip (it
|
|
87
|
+
* applies outside the card's form) puts its ToggleSwitch here, so the control
|
|
88
|
+
* is reachable without opening the card and matches a plugin card's shape.
|
|
89
|
+
*/
|
|
90
|
+
headerAction?: ReactNode;
|
|
91
|
+
/**
|
|
92
|
+
* Render children even when the settings namespace is not exposed by the
|
|
93
|
+
* host. The 'not exposed' notice still explains the card above them; a card
|
|
94
|
+
* that wants the rows alone hides it through `hideNotExposedNotice`.
|
|
95
|
+
*/
|
|
96
|
+
renderChildrenWhenNotExposed?: boolean;
|
|
97
|
+
/** Hide the 'not exposed' notice, whichever branch renders the card body. */
|
|
98
|
+
hideNotExposedNotice?: boolean;
|
|
99
|
+
/**
|
|
100
|
+
* Compact chrome for a topic card rendered inside another card's body: a
|
|
101
|
+
* smaller title, a tighter header and body inset, and a one-line description
|
|
102
|
+
* whose full text stays on the header's own title. Defaults to the
|
|
103
|
+
* first-level chrome, which is unchanged.
|
|
104
|
+
*/
|
|
105
|
+
density?: 'nested';
|
|
106
|
+
/** The plugin's controls. */
|
|
107
|
+
children: ReactNode;
|
|
108
|
+
}
|
|
109
|
+
/**
|
|
110
|
+
* Render one plugin settings card.
|
|
111
|
+
* @param props - the plugin's copy keys, its form state, and its controls.
|
|
112
|
+
* @returns the card, or nothing while the namespace is still loading.
|
|
113
|
+
*/
|
|
114
|
+
export declare function PluginSettingsCard<TKey extends string = string>(props: PluginSettingsCardProps<TKey>): import("react").JSX.Element | null;
|
|
115
|
+
/** Props every field control needs regardless of its value type. */
|
|
116
|
+
export interface FieldProps {
|
|
117
|
+
/** Stable id associating the label with its control. */
|
|
118
|
+
id: string;
|
|
119
|
+
/** Visible label. */
|
|
120
|
+
label: string;
|
|
121
|
+
/** One-line explanation rendered under the control. */
|
|
122
|
+
hint: string;
|
|
123
|
+
/**
|
|
124
|
+
* Full sentence behind the visible hint, exposed as the paragraph's native
|
|
125
|
+
* `title` so a card can shorten the line without losing the text. Omitted:
|
|
126
|
+
* the paragraph carries no title attribute at all.
|
|
127
|
+
*/
|
|
128
|
+
hintTitle?: string;
|
|
129
|
+
/** Draft text this control renders. */
|
|
130
|
+
text: string;
|
|
131
|
+
/** True when the field holds a user-layer entry over the inherited value. */
|
|
132
|
+
overridden: boolean;
|
|
133
|
+
/** True when the draft is not a value this field accepts. */
|
|
134
|
+
invalid: boolean;
|
|
135
|
+
/** Copy for the overridden badge. */
|
|
136
|
+
overriddenLabel: string;
|
|
137
|
+
/** Copy for the reset control. */
|
|
138
|
+
resetLabel: string;
|
|
139
|
+
/** Copy shown in place of the hint while the draft is invalid. */
|
|
140
|
+
invalidLabel: string;
|
|
141
|
+
/** Disables every control (read-only document, or an unavailable namespace). */
|
|
142
|
+
disabled: boolean;
|
|
143
|
+
/** Take new draft text; the card writes it as the field's entry rule says. */
|
|
144
|
+
onEdit: (text: string) => void;
|
|
145
|
+
/** Clear the field at once so it re-inherits the composition layer. */
|
|
146
|
+
onReset: () => void;
|
|
147
|
+
}
|
|
148
|
+
/**
|
|
149
|
+
* A typed value field. Its draft is written after a pause in typing, at once on
|
|
150
|
+
* Enter or when focus leaves, and Escape puts the stored value back. `numeric`
|
|
151
|
+
* only hints the keypad: which drafts a field accepts is decided by its spec.
|
|
152
|
+
* A field given a `range` also offers the coarse slider bubble: dragging fills
|
|
153
|
+
* the draft live and releasing writes it.
|
|
154
|
+
*/
|
|
155
|
+
export declare function ValueField(props: FieldProps & {
|
|
156
|
+
/** Hints a numeric keypad without narrowing what the control accepts. */
|
|
157
|
+
numeric?: boolean;
|
|
158
|
+
/** Placeholder shown while the draft is empty. */
|
|
159
|
+
placeholder?: string;
|
|
160
|
+
/** Bounds of a numeric field, for the coarse slider; the spec still judges every draft. */
|
|
161
|
+
range?: {
|
|
162
|
+
min: number;
|
|
163
|
+
max: number;
|
|
164
|
+
step: number;
|
|
165
|
+
};
|
|
166
|
+
}): import("react").JSX.Element;
|
|
167
|
+
interface SelectOption {
|
|
168
|
+
value: string;
|
|
169
|
+
label: string;
|
|
170
|
+
}
|
|
171
|
+
/**
|
|
172
|
+
* The shared dual-mode select control. While an appearance skin is active it
|
|
173
|
+
* renders the legacy native `<select>` untouched, so element-level skin
|
|
174
|
+
* selectors keep working; under the default appearance it renders a
|
|
175
|
+
* self-drawn `role="listbox"` popup whose open/close is transition-animated.
|
|
176
|
+
* Cards reach it through BooleanField/ChoiceField; editors outside a card
|
|
177
|
+
* (the side-card prefs) bind it directly through onEdit.
|
|
178
|
+
* 双模式下拉框:皮肤激活时用原生 select,默认外观用自绘动画弹层。
|
|
179
|
+
*/
|
|
180
|
+
export declare function SelectField(props: {
|
|
181
|
+
id: string;
|
|
182
|
+
options: ReadonlyArray<SelectOption>;
|
|
183
|
+
value: string;
|
|
184
|
+
disabled: boolean;
|
|
185
|
+
invalid: boolean;
|
|
186
|
+
onEdit: (text: string) => void;
|
|
187
|
+
}): import("react").JSX.Element;
|
|
188
|
+
/**
|
|
189
|
+
* A visible segmented group for a small set of mutually exclusive values.
|
|
190
|
+
* Every option stays on screen, so inherit/on/off and short enum fields take
|
|
191
|
+
* one click without opening a popup. The pressed option carries the group's
|
|
192
|
+
* sliding highlight and `aria-pressed`; the group takes the field label as its
|
|
193
|
+
* accessible name.
|
|
194
|
+
*/
|
|
195
|
+
export declare function SegmentField(props: {
|
|
196
|
+
id: string;
|
|
197
|
+
label: string;
|
|
198
|
+
options: ReadonlyArray<SelectOption>;
|
|
199
|
+
value: string;
|
|
200
|
+
disabled: boolean;
|
|
201
|
+
invalid: boolean;
|
|
202
|
+
onEdit: (text: string) => void;
|
|
203
|
+
}): import("react").JSX.Element;
|
|
204
|
+
/** How a small single-choice field presents its options. */
|
|
205
|
+
export type FieldPresentation = 'select' | 'segment';
|
|
206
|
+
/** A boolean field: 继承 / 开 / 关. */
|
|
207
|
+
export declare function BooleanField(props: FieldProps & {
|
|
208
|
+
/** Copy for the inherit option. */
|
|
209
|
+
inheritLabel: string;
|
|
210
|
+
/** Copy for the on option. */
|
|
211
|
+
onLabel: string;
|
|
212
|
+
/** Copy for the off option. */
|
|
213
|
+
offLabel: string;
|
|
214
|
+
/** Defaults to the visible segments: the three answers always fit on one row. */
|
|
215
|
+
presentation?: FieldPresentation;
|
|
216
|
+
}): import("react").JSX.Element;
|
|
217
|
+
/** An enumerated field, selecting or segmenting its small choice set. */
|
|
218
|
+
export declare function ChoiceField(props: FieldProps & {
|
|
219
|
+
/** Copy for the inherit option (draft text is the empty string). */
|
|
220
|
+
inheritLabel: string;
|
|
221
|
+
/** Choices rendered in order; `value` is the draft/stored text. */
|
|
222
|
+
choices: ReadonlyArray<{
|
|
223
|
+
value: string;
|
|
224
|
+
label: string;
|
|
225
|
+
}>;
|
|
226
|
+
/**
|
|
227
|
+
* Visible segmented options for a short fixed set; defaults to the compact
|
|
228
|
+
* select, which also suits a list whose length follows the deployment.
|
|
229
|
+
*/
|
|
230
|
+
presentation?: FieldPresentation;
|
|
231
|
+
}): import("react").JSX.Element;
|
|
232
|
+
/**
|
|
233
|
+
* A boolean toggle drawn as a switch track, for a setting that is only on or
|
|
234
|
+
* off and applies on flip. It is a real button with
|
|
235
|
+
* `role="switch"` and `aria-checked`, so keyboard and assistive activation
|
|
236
|
+
* arrive as a click and the state is announced instead of inferred from a
|
|
237
|
+
* checkbox tick.
|
|
238
|
+
*
|
|
239
|
+
* The thumb bounces across only once the reader has pressed this switch: the
|
|
240
|
+
* press writes the mark that arms the bounce, so a page opening, a TAB
|
|
241
|
+
* switching back or a value arriving from elsewhere draws every thumb at rest.
|
|
242
|
+
*/
|
|
243
|
+
export declare function ToggleSwitch(props: {
|
|
244
|
+
/** Id of the element naming the switch (the card's title). */
|
|
245
|
+
labelledBy?: string;
|
|
246
|
+
/** Accessible name when no element labels it. */
|
|
247
|
+
ariaLabel?: string;
|
|
248
|
+
/** Current state. */
|
|
249
|
+
checked: boolean;
|
|
250
|
+
/** Disables the switch while a write is in flight or the Host refuses writes. */
|
|
251
|
+
disabled?: boolean;
|
|
252
|
+
/** Called with the requested next state. */
|
|
253
|
+
onChange: (next: boolean) => void;
|
|
254
|
+
}): import("react").JSX.Element;
|
|
255
|
+
export {};
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Coarse adjustment for a bounded number: resting the pointer on the control
|
|
3
|
+
* (or moving focus into it) raises a small bubble holding a slider across the
|
|
4
|
+
* field's whole range, so a large change is one drag instead of many presses
|
|
5
|
+
* or a retyped value. The control itself stays the precise entry.
|
|
6
|
+
*
|
|
7
|
+
* The bubble belongs to the anchor's subtree, so moving from the control onto
|
|
8
|
+
* the bubble never counts as leaving. It opens after a short rest and closes a
|
|
9
|
+
* moment after the pointer and focus have both gone, so crossing the control
|
|
10
|
+
* on the way elsewhere does not flash it. While a drag is in progress the
|
|
11
|
+
* bubble stays put even if the pointer strays off it.
|
|
12
|
+
*
|
|
13
|
+
* Dragging reports each value through `onInput`, so the field shows it live;
|
|
14
|
+
* releasing the thumb, or a key press on it, reports `onCommit` once. The
|
|
15
|
+
* bubble opens on the side of the control that has room inside the nearest
|
|
16
|
+
* scrolling ancestor, so a row near the top of a settings page does not hang
|
|
17
|
+
* its bubble under the page edge.
|
|
18
|
+
*/
|
|
19
|
+
import { type ReactNode } from 'react';
|
|
20
|
+
/** Props of {@link RangeBubble}. */
|
|
21
|
+
export interface RangeBubbleProps {
|
|
22
|
+
/** Lowest value the slider reaches. */
|
|
23
|
+
min: number;
|
|
24
|
+
/** Highest value the slider reaches. */
|
|
25
|
+
max: number;
|
|
26
|
+
/** Slider granularity. */
|
|
27
|
+
step: number;
|
|
28
|
+
/** Current value; a value outside the range parks the thumb at the nearer end. */
|
|
29
|
+
value: number;
|
|
30
|
+
/** Accessible name of the slider. */
|
|
31
|
+
label: string;
|
|
32
|
+
/** Disables the bubble along with the control. */
|
|
33
|
+
disabled?: boolean;
|
|
34
|
+
/** Each value while the thumb moves. */
|
|
35
|
+
onInput: (value: number) => void;
|
|
36
|
+
/** The value the thumb was released on, once per drag or key press. */
|
|
37
|
+
onCommit: (value: number) => void;
|
|
38
|
+
/** The precise control the bubble hangs off. */
|
|
39
|
+
children: ReactNode;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Render the control with its coarse-adjustment bubble.
|
|
43
|
+
* @param props - the range, the value and the two report callbacks.
|
|
44
|
+
* @returns the anchor holding the control and the bubble.
|
|
45
|
+
*/
|
|
46
|
+
export declare function RangeBubble(props: RangeBubbleProps): ReactNode;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The family's segmented control: a quiet track whose options share one
|
|
3
|
+
* highlight that slides to the pressed option, instead of each option fading
|
|
4
|
+
* its own background out and the next one in. The settings fields' small
|
|
5
|
+
* choices and the Web Extensions TAB strip both render through it, so the two
|
|
6
|
+
* read as one control.
|
|
7
|
+
*
|
|
8
|
+
* The caller builds the option buttons and marks the pressed one with
|
|
9
|
+
* `data-active`; the group measures that button after every render and writes
|
|
10
|
+
* its box as four custom properties, and the stylesheet draws the highlight
|
|
11
|
+
* there (`.segmentGroup[data-pill]::before`). Attribute and first placement
|
|
12
|
+
* land in the same task, so the highlight appears in place and only later
|
|
13
|
+
* changes slide. A ResizeObserver re-measures when the group or an option
|
|
14
|
+
* changes size: a longer locale, a font arriving, a container growing, a
|
|
15
|
+
* strip wrapping onto a second line.
|
|
16
|
+
*/
|
|
17
|
+
import { type HTMLAttributes, type ReactNode } from 'react';
|
|
18
|
+
/** Props of {@link SegmentGroup}: the track's own attributes and the option buttons. */
|
|
19
|
+
export interface SegmentGroupProps extends HTMLAttributes<HTMLDivElement> {
|
|
20
|
+
/** The option buttons; the pressed one carries `data-active`. */
|
|
21
|
+
children: ReactNode;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Render a segmented track around the caller's option buttons.
|
|
25
|
+
* @param props - the track's attributes (role, accessible name, key handler) and its options.
|
|
26
|
+
* @returns the track.
|
|
27
|
+
*/
|
|
28
|
+
export declare function SegmentGroup(props: SegmentGroupProps): ReactNode;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { PropsLocale } from '@deepseek-ai/dsh-client-ui-slots';
|
|
2
|
+
import type { PluginConfigViewProps } from '@deepseek-ai/dsh-client-ui-plugin-manager/client';
|
|
3
|
+
/** Configuration-seat keys for standalone and aggregate bundle rows. */
|
|
4
|
+
export declare const BROWSER_VIEW_CONFIG_KEYS: readonly ["@linxin666/dsh-client-ui-browser-view#ui-browser-view", "@linxin666/dsh-client-ui-browser-view#web-ui-browser-view"];
|
|
5
|
+
/** The row configuration form backed by the Host's volatile settings namespace. */
|
|
6
|
+
export declare function BrowserViewConfig({ t, view, form }: PropsLocale<'browser-view'> & PluginConfigViewProps): string | import("react").JSX.Element;
|
|
@@ -35,6 +35,16 @@ declare module '@deepseek-ai/dsh-client-ui-slots' {
|
|
|
35
35
|
/** Browser-view surface copy. */
|
|
36
36
|
'browser-view': BrowserViewKey;
|
|
37
37
|
}
|
|
38
|
+
interface SlotMap {
|
|
39
|
+
/** The Web Extensions plugin card seat. */
|
|
40
|
+
'web-ui.plugin.item': {
|
|
41
|
+
kind: 'list';
|
|
42
|
+
scope: 'root';
|
|
43
|
+
owner: {
|
|
44
|
+
children?: never;
|
|
45
|
+
};
|
|
46
|
+
};
|
|
47
|
+
}
|
|
38
48
|
}
|
|
39
49
|
/** Services required by this plugin. */
|
|
40
50
|
export declare const inject: string[];
|
|
@@ -30,6 +30,32 @@ export declare const zh: {
|
|
|
30
30
|
'panel.status.connecting': string;
|
|
31
31
|
'panel.status.loading': string;
|
|
32
32
|
'panel.status.live': string;
|
|
33
|
+
'panel.mode.isolated': string;
|
|
34
|
+
'panel.mode.real': string;
|
|
35
|
+
'config.summary': string;
|
|
36
|
+
'config.realBrowserEnabled': string;
|
|
37
|
+
'config.realBrowserEnabled.hint': string;
|
|
38
|
+
'config.cdpEndpoint': string;
|
|
39
|
+
'config.cdpEndpoint.hint': string;
|
|
40
|
+
'config.unavailable': string;
|
|
41
|
+
'config.failed': string;
|
|
42
|
+
'settings.title': string;
|
|
43
|
+
'settings.description': string;
|
|
44
|
+
'settings.enabled': string;
|
|
45
|
+
'settings.enabledHint': string;
|
|
46
|
+
'settings.cdpEndpoint': string;
|
|
47
|
+
'settings.cdpEndpointHint': string;
|
|
48
|
+
'settings.inherit': string;
|
|
49
|
+
'settings.on': string;
|
|
50
|
+
'settings.off': string;
|
|
51
|
+
'settings.overridden': string;
|
|
52
|
+
'settings.reset': string;
|
|
53
|
+
'settings.invalidValue': string;
|
|
54
|
+
'settings.collapse': string;
|
|
55
|
+
'settings.expand': string;
|
|
56
|
+
'settings.notExposed': string;
|
|
57
|
+
'settings.readOnly': string;
|
|
58
|
+
'settings.saveFailed': string;
|
|
33
59
|
};
|
|
34
60
|
/** The browser-view namespace key union. */
|
|
35
61
|
export type BrowserViewKey = keyof typeof zh;
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Family plugin-card seat.
|
|
3
|
+
*
|
|
4
|
+
* A family plugin contributes its settings card to whichever plugin-card seat
|
|
5
|
+
* the running host actually renders:
|
|
6
|
+
*
|
|
7
|
+
* - `web-ui.plugin.item` — the list seat declared by the dsh-web-settings
|
|
8
|
+
* group section (this family's own first-level "Web UI plugins" section);
|
|
9
|
+
* - `plugins.bundle.config` — the official keyed seat of the harness's plugin
|
|
10
|
+
* manager page, keyed by the bundle's package name and rendered on that
|
|
11
|
+
* bundle's page. alpha.2 removed the `settings.plugin.item` keyed seat of the
|
|
12
|
+
* `ui-settings-plugins` tab that this helper used before, so a card keyed by
|
|
13
|
+
* its settings namespace has no seat to land in any more.
|
|
14
|
+
*
|
|
15
|
+
* SEAT SELECTION IS NOT A DECLARATION PROBE. The official plugin surface
|
|
16
|
+
* belongs to the harness bundle and declares its seats before any external
|
|
17
|
+
* plugin's `apply()` runs, so "is the official seat declared?" answers yes even
|
|
18
|
+
* in the deployment whose whole point is the family group. Choosing on that
|
|
19
|
+
* probe sends every family card to the official page and leaves the group's own
|
|
20
|
+
* section permanently empty — the family of reports where the section renders
|
|
21
|
+
* its heading and zero cards.
|
|
22
|
+
*
|
|
23
|
+
* The signal that actually distinguishes the two deployments is whether
|
|
24
|
+
* dsh-web-settings is loaded: it is the package that owns the group section and
|
|
25
|
+
* it publishes the `webUiSettings` service during `apply()`, which every
|
|
26
|
+
* family plugin already reads for its settings form. Group loaded -> the family
|
|
27
|
+
* seat; group absent -> the official seat.
|
|
28
|
+
*
|
|
29
|
+
* The decision is re-evaluated on every `slots/changed` because the group may
|
|
30
|
+
* apply after this plugin (the family aggregate orders it first, a profile that
|
|
31
|
+
* installs the group separately need not): the initial contribution goes to the
|
|
32
|
+
* official seat, then moves to the family seat the moment the group's section
|
|
33
|
+
* registers. The entry is disposed before the replacement is registered, so a
|
|
34
|
+
* card is never in two seats at once.
|
|
35
|
+
*
|
|
36
|
+
* The shared tree has no client-SDK dependency, so this module reads its
|
|
37
|
+
* context through the structural shape below; callers pass the plugin's own
|
|
38
|
+
* `ctx`.
|
|
39
|
+
*/
|
|
40
|
+
/** The family list seat key. */
|
|
41
|
+
export declare const FAMILY_PLUGIN_CARD_SEAT = "web-ui.plugin.item";
|
|
42
|
+
/** The official keyed plugin-card seat key (the alpha.2 bundle-configuration seat). */
|
|
43
|
+
export declare const OFFICIAL_PLUGIN_CARD_SEAT = "plugins.bundle.config";
|
|
44
|
+
/** The service dsh-web-settings publishes while it is loaded. */
|
|
45
|
+
export declare const FAMILY_GROUP_SERVICE = "webUiSettings";
|
|
46
|
+
/** The slot-registry member this helper uses (structurally satisfied by ctx.slots). */
|
|
47
|
+
export interface PluginCardSlots {
|
|
48
|
+
/** Contribution of one card entry. */
|
|
49
|
+
register(options: never, component: never): unknown;
|
|
50
|
+
/** Declaration probe: a target seat may appear after this plugin applies. */
|
|
51
|
+
spec?(key: string): unknown;
|
|
52
|
+
}
|
|
53
|
+
/** The slice of the client context a card contribution needs. */
|
|
54
|
+
export interface PluginCardContext {
|
|
55
|
+
slots: PluginCardSlots;
|
|
56
|
+
/** Service lookup; absent on a context double that only models the slots. */
|
|
57
|
+
get?(name: string): unknown;
|
|
58
|
+
/** Event subscription seat; absent on an event-less test double. */
|
|
59
|
+
on?(event: string, listener: (...args: never[]) => void): unknown;
|
|
60
|
+
}
|
|
61
|
+
/** Owner share of a family list-seat card (that seat supplies nothing). */
|
|
62
|
+
export interface SettingsPluginItemOwnerProps {
|
|
63
|
+
/** Marker field: card owner props are intentionally empty. */
|
|
64
|
+
children?: never;
|
|
65
|
+
}
|
|
66
|
+
/** One family plugin's card contribution. */
|
|
67
|
+
export interface PluginCardSeat {
|
|
68
|
+
/**
|
|
69
|
+
* Npm package name of the bundle this card configures; the official keyed
|
|
70
|
+
* seat dispatches on it. Every family package ships its own bundle patch, so
|
|
71
|
+
* a standalone install lists that package as the bundle whose page renders
|
|
72
|
+
* this card.
|
|
73
|
+
*/
|
|
74
|
+
bundle: string;
|
|
75
|
+
/** Family list-seat entry id. */
|
|
76
|
+
id: string;
|
|
77
|
+
/** Family list-seat sort order. */
|
|
78
|
+
order?: number;
|
|
79
|
+
/** Family list-seat display label; the official keyed seat carries none. */
|
|
80
|
+
label?: () => string;
|
|
81
|
+
/** Locale namespace the card renders with. */
|
|
82
|
+
locale: string;
|
|
83
|
+
/**
|
|
84
|
+
* Child slots this card declares and renders. Forwarded to whichever seat
|
|
85
|
+
* the host renders; absent for a card that declares none.
|
|
86
|
+
*/
|
|
87
|
+
children?: Record<string, unknown>;
|
|
88
|
+
/** Business-face factory of the registration. */
|
|
89
|
+
inject?: () => object;
|
|
90
|
+
/**
|
|
91
|
+
* The card component. Its props type is the seat's composed shape, which is
|
|
92
|
+
* chosen at runtime, so the helper takes it erased; the registrant keeps its
|
|
93
|
+
* own precise typing at the call site.
|
|
94
|
+
*/
|
|
95
|
+
component: unknown;
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* Whether the family group (dsh-web-settings) is loaded in this page. The
|
|
99
|
+
* service is the group package's own contract, so the probe cannot be fooled
|
|
100
|
+
* by a harness release that starts declaring the official seat differently.
|
|
101
|
+
*/
|
|
102
|
+
export declare function familyGroupLoaded(ctx: PluginCardContext): boolean;
|
|
103
|
+
/**
|
|
104
|
+
* Contribute one family plugin card to the seat this host renders, following
|
|
105
|
+
* the group if it loads later. The entry is disposed and re-registered on a
|
|
106
|
+
* seat change, never duplicated.
|
|
107
|
+
* @param ctx - client context (its slot registry decides the seat).
|
|
108
|
+
* @param seat - the card contribution.
|
|
109
|
+
*/
|
|
110
|
+
export declare function installPluginCard(ctx: PluginCardContext, seat: PluginCardSeat): void;
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Family settings form bound to the profile entry id a Host actually serves.
|
|
3
|
+
*
|
|
4
|
+
* Under the 0.1.7 settings model a form is addressed by PROFILE ENTRY ID, while
|
|
5
|
+
* a family card knows only its own settings namespace. The family binder
|
|
6
|
+
* (`ctx.get('webUiSettings')`, published by dsh-web-settings) resolves one onto
|
|
7
|
+
* the other and is the preferred transport; this module is the fallback for a
|
|
8
|
+
* page that serves no binder — the group plugin is not installed, or its client
|
|
9
|
+
* half has not applied yet (the aggregate mounts its children in order, and a
|
|
10
|
+
* child still waiting on its own injects publishes nothing).
|
|
11
|
+
*
|
|
12
|
+
* The shared describe mirror is the only local evidence of which row id this
|
|
13
|
+
* profile serves, but it answers asynchronously: at plugin activation it usually
|
|
14
|
+
* holds nothing yet. A one-shot guess therefore cannot be right for every
|
|
15
|
+
* deployment, and the form is bound once per session:
|
|
16
|
+
*
|
|
17
|
+
* - binding the bare namespace made every save answer `No configurable plugin
|
|
18
|
+
* entry "<namespace>"` on an aggregate install (the namespace is not an entry
|
|
19
|
+
* id there), which the card reported as "the deployment did not accept these
|
|
20
|
+
* values";
|
|
21
|
+
* - binding the aggregate row id would break a standalone install, whose row id
|
|
22
|
+
* is the namespace or the package's own `ui-*` row.
|
|
23
|
+
*
|
|
24
|
+
* So the fallback starts on the most likely row and REBINDS the moment the
|
|
25
|
+
* mirror names one of this package's rows. Until the mirror answers, the form
|
|
26
|
+
* reports the binding it holds (usually `loading`), which the card renders as an
|
|
27
|
+
* unavailable form rather than a doomed one.
|
|
28
|
+
*/
|
|
29
|
+
import type { ConfigForm, ConfigForms } from '@deepseek-ai/dsh-client-ui-settings/client';
|
|
30
|
+
/** Options of {@link createServedEntryForm}. */
|
|
31
|
+
export interface ServedEntryFormOptions<T> {
|
|
32
|
+
/** The shared configuration forms service (`ctx.configForms`). */
|
|
33
|
+
forms: ConfigForms;
|
|
34
|
+
/**
|
|
35
|
+
* Profile entry ids this package's rows carry, most likely first: the
|
|
36
|
+
* aggregate's generated row, the package's own standalone row, then the bare
|
|
37
|
+
* namespace. The first is the fallback while the mirror has no answer; the
|
|
38
|
+
* last is the answer when the mirror serves none of them.
|
|
39
|
+
*/
|
|
40
|
+
entryIds: readonly string[];
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Create a settings form bound to the profile entry id this Host serves, and
|
|
44
|
+
* rebound whenever the shared describe mirror names a different one of this
|
|
45
|
+
* package's rows.
|
|
46
|
+
* @param options - the shared forms service and this package's candidate row ids.
|
|
47
|
+
* @returns a form delegating to the currently resolved entry's own form.
|
|
48
|
+
*/
|
|
49
|
+
export declare function createServedEntryForm<T>(options: ServedEntryFormOptions<T>): ConfigForm<T>;
|