@linxin666/dsh-client-ui-task-board-team 0.4.13 → 0.4.14
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/lib/client.js +527 -154
- 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/locales.d.ts +7 -0
- package/lib/types/client/settings-form.d.ts +235 -0
- package/lib/types/client/team/settings.d.ts +27 -1
- package/package.json +2 -1
- package/src/client/PluginSettingsCard.tsx +838 -0
- package/src/client/RangeBubble.tsx +164 -0
- package/src/client/SegmentGroup.tsx +93 -0
- package/src/client/locales.ts +14 -0
- package/src/client/settings-card.module.css +821 -0
- package/src/client/settings-form.ts +510 -0
- package/src/client/team/settings.tsx +207 -101
- package/src/client/team/team.module.css +87 -16
|
@@ -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;
|
|
@@ -10,12 +10,14 @@
|
|
|
10
10
|
*/
|
|
11
11
|
export declare const zh: {
|
|
12
12
|
readonly 'section.title': "团队协作";
|
|
13
|
+
readonly 'section.description': "把云端 team-hub 指派给本机 dsh-agents 成员的 issue 领成看板镜像卡并在本机执行";
|
|
13
14
|
readonly 'section.hub': "Hub 地址";
|
|
14
15
|
readonly 'section.team': "团队 ID";
|
|
15
16
|
readonly 'section.token': "Host Token";
|
|
16
17
|
readonly 'section.token.configured': "已配置(保存在宿主侧,不回显)";
|
|
17
18
|
readonly 'section.token.missing': "未配置";
|
|
18
19
|
readonly 'section.token.placeholder': "粘贴 Host Token,保存后只在宿主侧使用";
|
|
20
|
+
readonly 'section.token.placeholderShort': "粘贴 Token";
|
|
19
21
|
readonly 'section.token.save': "保存 Token";
|
|
20
22
|
readonly 'section.token.clear': "清除 Token";
|
|
21
23
|
readonly 'section.agents': "团队 Agent 绑定";
|
|
@@ -47,6 +49,11 @@ export declare const zh: {
|
|
|
47
49
|
readonly 'section.capability.presetPin': "建卡时钉住预设与模型";
|
|
48
50
|
readonly 'section.capability.presetPinMissing': "当前看板版本无法在建卡时钉住 Agent 预设、模型与思考档位,因此领取到的镜像卡没有启动,需要人工处理";
|
|
49
51
|
readonly 'section.problems': "配置问题";
|
|
52
|
+
readonly 'settings.collapse': "收起设置";
|
|
53
|
+
readonly 'settings.expand': "展开设置";
|
|
54
|
+
readonly 'settings.notExposed': "当前版本未向设置页暴露本扩展的配置命名空间,配置表单不可用。";
|
|
55
|
+
readonly 'settings.readOnly': "当前部署的设置只读。";
|
|
56
|
+
readonly 'settings.saveFailed': "部署未接受这次改动。";
|
|
50
57
|
readonly 'detail.title': "团队协作";
|
|
51
58
|
readonly 'detail.issue': "团队 issue";
|
|
52
59
|
readonly 'detail.assignee': "负责人";
|
|
@@ -0,0 +1,235 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Form model behind the plugin settings card. Every control applies itself:
|
|
3
|
+
* a pick (a segment, a select option, a reset) writes the moment it is made,
|
|
4
|
+
* and typed text writes once typing pauses or the reader leaves the field.
|
|
5
|
+
* Between the edit and the write the edit is held here as a draft, so what is
|
|
6
|
+
* on screen is exactly what the write will store; a write the Host refuses
|
|
7
|
+
* puts a pick back to the stored value and keeps typed text for correcting.
|
|
8
|
+
* Family-shared slice inlined into each plugin's client bundle.
|
|
9
|
+
*/
|
|
10
|
+
import type { ConfigForm } from '@deepseek-ai/dsh-client-ui-settings/client';
|
|
11
|
+
import type { SnapshotStore } from '@deepseek-ai/dsh-client-store';
|
|
12
|
+
/** The write one field's draft text performs when it is applied. */
|
|
13
|
+
export type FieldWrite = {
|
|
14
|
+
kind: 'set';
|
|
15
|
+
value: unknown;
|
|
16
|
+
} | {
|
|
17
|
+
kind: 'clear';
|
|
18
|
+
};
|
|
19
|
+
/** How one field converts between its stored value and its draft text. */
|
|
20
|
+
export interface FieldSpec {
|
|
21
|
+
/** Field name inside the namespace section. */
|
|
22
|
+
field: string;
|
|
23
|
+
/**
|
|
24
|
+
* How the reader enters a value, which decides when it is written: a `pick`
|
|
25
|
+
* is a whole value at once and applies immediately; `type` is text arriving
|
|
26
|
+
* a keystroke at a time and applies once typing pauses or the field is left.
|
|
27
|
+
*/
|
|
28
|
+
entry: 'pick' | 'type';
|
|
29
|
+
/**
|
|
30
|
+
* Whether the Host treats this field as a secret and redacts its value from
|
|
31
|
+
* the read-back (role('secret') in the section schema). Redacted secrets are
|
|
32
|
+
* never compared against the draft on save: the Host strips them from every
|
|
33
|
+
* wire view layer, so the settled snapshot carries nothing to read back. A
|
|
34
|
+
* staged secret set is judged by the mutation settling; the rest of its
|
|
35
|
+
* batch, when one exists, is still judged by read-back, and the atomic
|
|
36
|
+
* mutation lands every write or none.
|
|
37
|
+
*/
|
|
38
|
+
secret?: boolean;
|
|
39
|
+
/** Render a stored value as draft text; the empty string when the section carries none. */
|
|
40
|
+
format: (value: unknown) => string;
|
|
41
|
+
/**
|
|
42
|
+
* The write this draft text performs, or undefined when the text is not a
|
|
43
|
+
* value this field accepts — which holds the draft unwritten rather than
|
|
44
|
+
* discarding it.
|
|
45
|
+
*/
|
|
46
|
+
parse: (text: string) => FieldWrite | undefined;
|
|
47
|
+
}
|
|
48
|
+
/** One field as the card renders it. */
|
|
49
|
+
export interface FieldState {
|
|
50
|
+
/** Draft text the control renders. */
|
|
51
|
+
text: string;
|
|
52
|
+
/** Whether the field leaves (or will leave) a user-layer entry. */
|
|
53
|
+
overridden: boolean;
|
|
54
|
+
/** Whether the draft is not a value this field accepts, which holds it unwritten. */
|
|
55
|
+
invalid: boolean;
|
|
56
|
+
}
|
|
57
|
+
/** Form state every plugin settings card shares. */
|
|
58
|
+
export interface CardShell {
|
|
59
|
+
/** False while the namespace is still loading; the card renders nothing. */
|
|
60
|
+
available: boolean;
|
|
61
|
+
/**
|
|
62
|
+
* Whether the namespace is actually served to this client. False when the
|
|
63
|
+
* Host deployment does not expose it (e.g. the owning plugin's settings
|
|
64
|
+
* domain is not mounted): the card renders an explanation
|
|
65
|
+
* instead of its form, so a missing namespace never looks like a missing
|
|
66
|
+
* plugin.
|
|
67
|
+
*/
|
|
68
|
+
exposed: boolean;
|
|
69
|
+
/** Whether the Host document accepts writes. */
|
|
70
|
+
writable: boolean;
|
|
71
|
+
/** Whether the form holds drafts not yet written (typed text waiting for its pause). */
|
|
72
|
+
dirty: boolean;
|
|
73
|
+
/** Whether any draft is invalid, which holds it unwritten. */
|
|
74
|
+
invalid: boolean;
|
|
75
|
+
/** Whether a write is crossing the wire. */
|
|
76
|
+
saving: boolean;
|
|
77
|
+
/** Whether the last write did not land; cleared by the next edit or write. */
|
|
78
|
+
failed: boolean;
|
|
79
|
+
/**
|
|
80
|
+
* The rejection code/message the Host returned for the last failed save,
|
|
81
|
+
* surfaced next to the generic failure text. Undefined while no save has
|
|
82
|
+
* failed (or the failure carried no server reason).
|
|
83
|
+
*/
|
|
84
|
+
failedReason?: string;
|
|
85
|
+
}
|
|
86
|
+
/** The write actions the card's slot entry injects. */
|
|
87
|
+
export interface CardActions {
|
|
88
|
+
/** Take draft text for one field; a pick writes at once, typed text after a pause. */
|
|
89
|
+
edit: (field: string, text: string) => void;
|
|
90
|
+
/** Clear one field at once, so it re-inherits the composition layer. */
|
|
91
|
+
resetField: (field: string) => void;
|
|
92
|
+
/** Write every pending draft now (a text field's Enter or blur), then re-seed from what the Host accepted. */
|
|
93
|
+
save: () => void;
|
|
94
|
+
/** Drop every pending draft, putting each control back to the stored value (a text field's Escape). */
|
|
95
|
+
discard: () => void;
|
|
96
|
+
}
|
|
97
|
+
/** How long typed text rests before it is written. */
|
|
98
|
+
export declare const TYPE_PAUSE_MS = 600;
|
|
99
|
+
/** One durable write inside the save's atomic form mutation. */
|
|
100
|
+
export interface BatchedWrite {
|
|
101
|
+
/** Field this entry writes. */
|
|
102
|
+
field: string;
|
|
103
|
+
/** set stores a value; unset drops the leaf. */
|
|
104
|
+
op: 'set' | 'unset';
|
|
105
|
+
/** Value for op set (absent for unset). */
|
|
106
|
+
value?: unknown;
|
|
107
|
+
}
|
|
108
|
+
/** Constraints a numeric field's accepted drafts must satisfy, mirroring the host schema. */
|
|
109
|
+
export interface NumberConstraints {
|
|
110
|
+
/** The accepted value must be a whole number. */
|
|
111
|
+
integer?: boolean;
|
|
112
|
+
/** The accepted value must be at least this. */
|
|
113
|
+
min?: number;
|
|
114
|
+
}
|
|
115
|
+
/** A whole- or decimal-number field. An empty draft clears the field; any other draft that is not a finite number within the constraints stays unwritten. */
|
|
116
|
+
export declare function numberField(field: string, constraints?: NumberConstraints): FieldSpec;
|
|
117
|
+
/**
|
|
118
|
+
* A free-text field. An empty draft clears the field. `entry` is `pick` when
|
|
119
|
+
* the text arrives whole from a picker (a preset or a reasoning level).
|
|
120
|
+
*/
|
|
121
|
+
export declare function textField(field: string, entry?: FieldSpec['entry']): FieldSpec;
|
|
122
|
+
/**
|
|
123
|
+
* A free-text field the Host treats as a secret and redacts from the read-back
|
|
124
|
+
* (role('secret') in the section schema). The card still edits it like text,
|
|
125
|
+
* but a save never compares the redacted value back: the staged set is judged
|
|
126
|
+
* by the mutation settling (see {@link FieldSpec.secret}).
|
|
127
|
+
*/
|
|
128
|
+
export declare function secretField(field: string): FieldSpec;
|
|
129
|
+
/** A boolean field, edited through true/false draft text. */
|
|
130
|
+
export declare function booleanField(field: string): FieldSpec;
|
|
131
|
+
/** An enumerated string field; only the listed choices are accepted. An empty draft clears the field. */
|
|
132
|
+
export declare function choiceField(field: string, choices: readonly string[]): FieldSpec;
|
|
133
|
+
/**
|
|
134
|
+
* Applies one card's edits to one settings namespace as the reader makes them.
|
|
135
|
+
*
|
|
136
|
+
* The Host is the only authority on whether a value was accepted — its
|
|
137
|
+
* validators own the constraints no schema can express — so the outcome is
|
|
138
|
+
* read back from the section rather than predicted here. A write that did not
|
|
139
|
+
* land puts each pick back to the stored value, the way a switch that could not
|
|
140
|
+
* flip springs back, and keeps typed text so the reader can correct it instead
|
|
141
|
+
* of retyping.
|
|
142
|
+
*/
|
|
143
|
+
export declare class CardForm<T> {
|
|
144
|
+
private readonly scope;
|
|
145
|
+
private readonly specs;
|
|
146
|
+
private readonly staged;
|
|
147
|
+
private readonly listeners;
|
|
148
|
+
/** The form subscription installed in the constructor; released by dispose(). */
|
|
149
|
+
private readonly disposeForm;
|
|
150
|
+
private disposed;
|
|
151
|
+
/** The pending write of typed text, waiting for typing to pause. */
|
|
152
|
+
private typePause;
|
|
153
|
+
private saving;
|
|
154
|
+
/** A save asked for while one was in flight; it runs once the first settles (#1754). */
|
|
155
|
+
private saveQueued;
|
|
156
|
+
private failed;
|
|
157
|
+
private failedReason;
|
|
158
|
+
/** @param scope - the bound configuration form for this card's namespace. */
|
|
159
|
+
constructor(scope: ConfigForm<T>, specs: FieldSpec[]);
|
|
160
|
+
/**
|
|
161
|
+
* Release the form subscription and every bound store listener. The card
|
|
162
|
+
* must call this on teardown; later calls are no-ops.
|
|
163
|
+
*/
|
|
164
|
+
dispose(): void;
|
|
165
|
+
/** Publish a projection of this form, rebuilt whenever the form or a draft changes. */
|
|
166
|
+
bind<S>(project: () => S): SnapshotStore<S>;
|
|
167
|
+
/** Read the card-level state: what the Host serves, and what is still waiting to be written. */
|
|
168
|
+
shell(): CardShell;
|
|
169
|
+
/** Read one field's state from the effective section and its staged draft. */
|
|
170
|
+
field(field: string): FieldState;
|
|
171
|
+
/** The actions the card's slot registration injects. */
|
|
172
|
+
actions(): CardActions;
|
|
173
|
+
/**
|
|
174
|
+
* Run one write, and re-run it once if another was asked for while this one
|
|
175
|
+
* was still in flight.
|
|
176
|
+
*
|
|
177
|
+
* A write is a Host round trip that also drives the profile reconcile, and
|
|
178
|
+
* the Host runs it inside one exclusive transaction. Answering an edit that
|
|
179
|
+
* arrives mid-flight by returning immediately dropped it with no explanation
|
|
180
|
+
* (#1754). Serializing instead means an edit made while another write is
|
|
181
|
+
* still settling is written against the settled state.
|
|
182
|
+
* @returns settlement after the mutation and the read-back.
|
|
183
|
+
*/
|
|
184
|
+
requestSave(): Promise<void>;
|
|
185
|
+
/**
|
|
186
|
+
* Write every valid draft in one atomic form mutation, then re-seed from
|
|
187
|
+
* what the Host accepted. A draft the field does not accept stays on screen,
|
|
188
|
+
* unwritten, without holding the others back.
|
|
189
|
+
*
|
|
190
|
+
* The batch rides one mutate, so cross-field validate hooks (baseURL+model)
|
|
191
|
+
* judge it as a unit: the Host either applies every write or refuses the
|
|
192
|
+
* batch. The form contract answers a refusal or a skipped write with `false`
|
|
193
|
+
* (it recovers with a fresh Host view instead of throwing), so the outcome is
|
|
194
|
+
* judged twice: the answer itself, and then the settled snapshot read back
|
|
195
|
+
* one planned write at a time. One missed write fails the whole batch. A
|
|
196
|
+
* transport that rejects instead (the dsh-web bridge controller on a dead
|
|
197
|
+
* connection) reports through the same failure path with its rejection
|
|
198
|
+
* message. A batch that did not land puts its picks and clears back to the
|
|
199
|
+
* stored value and keeps its typed text, so the reader can correct it.
|
|
200
|
+
* @returns settlement after the mutation and the read-back.
|
|
201
|
+
*/
|
|
202
|
+
save(): Promise<void>;
|
|
203
|
+
/**
|
|
204
|
+
* Every staged edit a write would carry. An entry whose draft is not a value
|
|
205
|
+
* its field accepts carries no write: the form is still dirty, and the draft
|
|
206
|
+
* stays on screen rather than being dropped. A staged edit that matches the
|
|
207
|
+
* effective section is not a write at all.
|
|
208
|
+
* @returns the planned writes, in the order the fields were staged.
|
|
209
|
+
*/
|
|
210
|
+
private plan;
|
|
211
|
+
/**
|
|
212
|
+
* Read-back judgment for a planned set: the user layer must hold the
|
|
213
|
+
* intended value once the mutation has settled.
|
|
214
|
+
*/
|
|
215
|
+
private landedSet;
|
|
216
|
+
/**
|
|
217
|
+
* Read-back judgment for a planned unset: the field must be gone from the
|
|
218
|
+
* user layer once the mutation has settled.
|
|
219
|
+
*/
|
|
220
|
+
private landedUnset;
|
|
221
|
+
/**
|
|
222
|
+
* Take one edit and schedule its write: a pick or a clear is written now,
|
|
223
|
+
* typed text once typing has rested for TYPE_PAUSE_MS.
|
|
224
|
+
*/
|
|
225
|
+
private stage;
|
|
226
|
+
/** Write every pending draft now, taking the place of a waiting pause. */
|
|
227
|
+
private applyNow;
|
|
228
|
+
private specOf;
|
|
229
|
+
private snapshotOf;
|
|
230
|
+
private sectionValue;
|
|
231
|
+
private baseValue;
|
|
232
|
+
private userLayer;
|
|
233
|
+
private stored;
|
|
234
|
+
private publish;
|
|
235
|
+
}
|
|
@@ -9,6 +9,14 @@
|
|
|
9
9
|
* back: the field always renders empty and the status line says whether one is
|
|
10
10
|
* stored.
|
|
11
11
|
*
|
|
12
|
+
* The block is one nested settings card of the board's topic list, exactly like
|
|
13
|
+
* the sibling provider sections: the family card chrome supplies the border, the
|
|
14
|
+
* header, the body insets and the hairline between rows, so this module owns only
|
|
15
|
+
* the rows themselves. Its rows use the shared field grid (label and hint on the
|
|
16
|
+
* left, the control at the trailing edge) instead of a hand-rolled flex row, so a
|
|
17
|
+
* label is never squeezed into a character-per-line column by the control beside
|
|
18
|
+
* it.
|
|
19
|
+
*
|
|
12
20
|
* The block stays reachable while the extension is switched off, because it is
|
|
13
21
|
* where the switch is turned back on; it only reports that fact instead of
|
|
14
22
|
* pretending the forms still apply.
|
|
@@ -33,7 +41,25 @@ interface PublishedConfiguration {
|
|
|
33
41
|
*/
|
|
34
42
|
export declare function readConfiguration(summary: TeamExtensionSummary | undefined): PublishedConfiguration;
|
|
35
43
|
/**
|
|
36
|
-
* The settings
|
|
44
|
+
* The body of the settings card: the configuration form and what the Host
|
|
45
|
+
* reports about it. It is its own component so the card can own the disclosure
|
|
46
|
+
* and the write report while this half owns the drafts.
|
|
47
|
+
* @param props - the board's action dispatcher, plus the write report the card
|
|
48
|
+
* renders in its footer.
|
|
49
|
+
* @returns the card body.
|
|
50
|
+
*/
|
|
51
|
+
export declare function TeamSettingsBody({ dispatch, onSaved }: {
|
|
52
|
+
dispatch: TaskBoardSettingsSectionProps['dispatch'];
|
|
53
|
+
onSaved: (accepted: boolean) => void;
|
|
54
|
+
}): ReactElement;
|
|
55
|
+
/**
|
|
56
|
+
* The settings block: one topic of the board's own settings card.
|
|
57
|
+
*
|
|
58
|
+
* Closed on arrival like the sibling provider card — the settings page opens as
|
|
59
|
+
* a topic list, and this topic is one of them. The body is read only by a reader
|
|
60
|
+
* who opens it, and its rows are written through the board's action channel, so
|
|
61
|
+
* the card holds no staged draft: save and discard are the no-ops of an
|
|
62
|
+
* always-committed form, and the footer reports a refused write.
|
|
37
63
|
* @param props - the board's settings seat props.
|
|
38
64
|
* @returns the block.
|
|
39
65
|
*/
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@linxin666/dsh-client-ui-task-board-team",
|
|
3
3
|
"description": "External provider extension for the dsh Web GUI task board that binds local dsh-agents members as team Agents and mirrors cloud team-hub issues onto the board; shipped as a dsh profile bundle with no DSH source changes.",
|
|
4
|
-
"version": "0.4.
|
|
4
|
+
"version": "0.4.14",
|
|
5
5
|
"icon": "icon.svg",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"engines": {
|
|
@@ -50,6 +50,7 @@
|
|
|
50
50
|
"devDependencies": {
|
|
51
51
|
"@deepseek-ai/cordis": "^4.0.5",
|
|
52
52
|
"@deepseek-ai/dsh-api-gateway": "^0.2.1-rc.3",
|
|
53
|
+
"@deepseek-ai/dsh-client-store": "^0.2.1-rc.3",
|
|
53
54
|
"@deepseek-ai/dsh-credentials": "^0.2.1-rc.3",
|
|
54
55
|
"@deepseek-ai/dsh-client-locale": "^0.2.1-rc.3",
|
|
55
56
|
"@deepseek-ai/dsh-client-ui-renderer": "^0.2.1-rc.3",
|