@linxin666/dsh-client-ui-task-board 0.4.10 → 0.4.11
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 +1 -1
- package/README.zh.md +1 -1
- package/lib/client.js +542 -167
- package/lib/client.js.map +1 -1
- package/lib/types/client/PluginSettingsCard.d.ts +69 -22
- 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 +1 -4
- package/lib/types/client/plugin-card-seat.d.ts +2 -0
- package/lib/types/client/settings-form.d.ts +73 -51
- package/package.json +1 -1
- package/src/client/PluginSettingsCard.tsx +226 -93
- package/src/client/RangeBubble.tsx +164 -0
- package/src/client/SegmentGroup.tsx +93 -0
- package/src/client/TaskBoardSettingsCard.tsx +12 -5
- package/src/client/locales.ts +46 -52
- package/src/client/plugin-card-seat.ts +6 -0
- package/src/client/settings-card.module.css +341 -94
- package/src/client/settings-form.ts +102 -60
|
@@ -1,15 +1,21 @@
|
|
|
1
1
|
/**
|
|
2
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
|
|
4
|
-
* that
|
|
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
|
|
5
7
|
* deployment that does not compose the owning plugin should show no trace of
|
|
6
8
|
* it. Inlined into each consumer's client bundle; mirrors the official
|
|
7
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).
|
|
8
14
|
*/
|
|
9
15
|
import { type ReactNode } from 'react';
|
|
10
16
|
import type { CardShell } from './settings-form.ts';
|
|
11
17
|
/** Copy keys the card chrome itself reads; every consumer locale carries this shared vocabulary. */
|
|
12
|
-
export declare const CARD_COPY_KEYS: readonly ["settings.collapse", "settings.expand", "settings.notExposed", "settings.
|
|
18
|
+
export declare const CARD_COPY_KEYS: readonly ["settings.collapse", "settings.expand", "settings.notExposed", "settings.readOnly", "settings.saveFailed"];
|
|
13
19
|
/** Copy key the card chrome itself reads. */
|
|
14
20
|
export type CardCopyKey = (typeof CARD_COPY_KEYS)[number];
|
|
15
21
|
/** Key domain for the plugin's own copy (inferred per consumer). */
|
|
@@ -39,11 +45,11 @@ export interface PluginSettingsCardProps<TKey extends string = string> {
|
|
|
39
45
|
* seat.
|
|
40
46
|
*/
|
|
41
47
|
icon?: ReactNode;
|
|
42
|
-
/** The card's form state: availability, writability, and
|
|
48
|
+
/** The card's form state: availability, writability, and how the last write went. */
|
|
43
49
|
state: CardShell;
|
|
44
|
-
/** Write every
|
|
50
|
+
/** Write every pending draft now: a text field's Enter or blur. */
|
|
45
51
|
onSave: () => void;
|
|
46
|
-
/** Drop every
|
|
52
|
+
/** Drop every pending draft: a text field's Escape. */
|
|
47
53
|
onDiscard: () => void;
|
|
48
54
|
/**
|
|
49
55
|
* Id applied to the card's title element, so a header control (an immediate
|
|
@@ -70,15 +76,15 @@ export interface PluginSettingsCardProps<TKey extends string = string> {
|
|
|
70
76
|
*/
|
|
71
77
|
alwaysOpen?: boolean;
|
|
72
78
|
/**
|
|
73
|
-
* Hide the
|
|
74
|
-
*
|
|
75
|
-
*
|
|
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.
|
|
76
82
|
*/
|
|
77
83
|
hideFooter?: boolean;
|
|
78
84
|
/**
|
|
79
|
-
* Optional control rendered at the header's trailing edge, before the
|
|
80
|
-
*
|
|
81
|
-
* applies outside the
|
|
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
|
|
82
88
|
* is reachable without opening the card and matches a plugin card's shape.
|
|
83
89
|
*/
|
|
84
90
|
headerAction?: ReactNode;
|
|
@@ -118,7 +124,7 @@ export interface FieldProps {
|
|
|
118
124
|
hintTitle?: string;
|
|
119
125
|
/** Draft text this control renders. */
|
|
120
126
|
text: string;
|
|
121
|
-
/** True when
|
|
127
|
+
/** True when the field holds a user-layer entry over the inherited value. */
|
|
122
128
|
overridden: boolean;
|
|
123
129
|
/** True when the draft is not a value this field accepts. */
|
|
124
130
|
invalid: boolean;
|
|
@@ -130,17 +136,29 @@ export interface FieldProps {
|
|
|
130
136
|
invalidLabel: string;
|
|
131
137
|
/** Disables every control (read-only document, or an unavailable namespace). */
|
|
132
138
|
disabled: boolean;
|
|
133
|
-
/**
|
|
139
|
+
/** Take new draft text; the card writes it as the field's entry rule says. */
|
|
134
140
|
onEdit: (text: string) => void;
|
|
135
|
-
/**
|
|
141
|
+
/** Clear the field at once so it re-inherits the composition layer. */
|
|
136
142
|
onReset: () => void;
|
|
137
143
|
}
|
|
138
|
-
/**
|
|
144
|
+
/**
|
|
145
|
+
* A typed value field. Its draft is written after a pause in typing, at once on
|
|
146
|
+
* Enter or when focus leaves, and Escape puts the stored value back. `numeric`
|
|
147
|
+
* only hints the keypad: which drafts a field accepts is decided by its spec.
|
|
148
|
+
* A field given a `range` also offers the coarse slider bubble: dragging fills
|
|
149
|
+
* the draft live and releasing writes it.
|
|
150
|
+
*/
|
|
139
151
|
export declare function ValueField(props: FieldProps & {
|
|
140
152
|
/** Hints a numeric keypad without narrowing what the control accepts. */
|
|
141
153
|
numeric?: boolean;
|
|
142
154
|
/** Placeholder shown while the draft is empty. */
|
|
143
155
|
placeholder?: string;
|
|
156
|
+
/** Bounds of a numeric field, for the coarse slider; the spec still judges every draft. */
|
|
157
|
+
range?: {
|
|
158
|
+
min: number;
|
|
159
|
+
max: number;
|
|
160
|
+
step: number;
|
|
161
|
+
};
|
|
144
162
|
}): import("react").JSX.Element;
|
|
145
163
|
interface SelectOption {
|
|
146
164
|
value: string;
|
|
@@ -151,8 +169,8 @@ interface SelectOption {
|
|
|
151
169
|
* renders the legacy native `<select>` untouched, so element-level skin
|
|
152
170
|
* selectors keep working; under the default appearance it renders a
|
|
153
171
|
* self-drawn `role="listbox"` popup whose open/close is transition-animated.
|
|
154
|
-
*
|
|
155
|
-
*
|
|
172
|
+
* Cards reach it through BooleanField/ChoiceField; editors outside a card
|
|
173
|
+
* (the side-card prefs) bind it directly through onEdit.
|
|
156
174
|
* 双模式下拉框:皮肤激活时用原生 select,默认外观用自绘动画弹层。
|
|
157
175
|
*/
|
|
158
176
|
export declare function SelectField(props: {
|
|
@@ -163,7 +181,25 @@ export declare function SelectField(props: {
|
|
|
163
181
|
invalid: boolean;
|
|
164
182
|
onEdit: (text: string) => void;
|
|
165
183
|
}): import("react").JSX.Element;
|
|
166
|
-
/**
|
|
184
|
+
/**
|
|
185
|
+
* A visible segmented group for a small set of mutually exclusive values.
|
|
186
|
+
* Every option stays on screen, so inherit/on/off and short enum fields take
|
|
187
|
+
* one click without opening a popup. The pressed option carries the group's
|
|
188
|
+
* sliding highlight and `aria-pressed`; the group takes the field label as its
|
|
189
|
+
* accessible name.
|
|
190
|
+
*/
|
|
191
|
+
export declare function SegmentField(props: {
|
|
192
|
+
id: string;
|
|
193
|
+
label: string;
|
|
194
|
+
options: ReadonlyArray<SelectOption>;
|
|
195
|
+
value: string;
|
|
196
|
+
disabled: boolean;
|
|
197
|
+
invalid: boolean;
|
|
198
|
+
onEdit: (text: string) => void;
|
|
199
|
+
}): import("react").JSX.Element;
|
|
200
|
+
/** How a small single-choice field presents its options. */
|
|
201
|
+
export type FieldPresentation = 'select' | 'segment';
|
|
202
|
+
/** A boolean field: 继承 / 开 / 关. */
|
|
167
203
|
export declare function BooleanField(props: FieldProps & {
|
|
168
204
|
/** Copy for the inherit option. */
|
|
169
205
|
inheritLabel: string;
|
|
@@ -171,8 +207,10 @@ export declare function BooleanField(props: FieldProps & {
|
|
|
171
207
|
onLabel: string;
|
|
172
208
|
/** Copy for the off option. */
|
|
173
209
|
offLabel: string;
|
|
210
|
+
/** Defaults to the visible segments: the three answers always fit on one row. */
|
|
211
|
+
presentation?: FieldPresentation;
|
|
174
212
|
}): import("react").JSX.Element;
|
|
175
|
-
/**
|
|
213
|
+
/** An enumerated field, selecting or segmenting its small choice set. */
|
|
176
214
|
export declare function ChoiceField(props: FieldProps & {
|
|
177
215
|
/** Copy for the inherit option (draft text is the empty string). */
|
|
178
216
|
inheritLabel: string;
|
|
@@ -181,13 +219,22 @@ export declare function ChoiceField(props: FieldProps & {
|
|
|
181
219
|
value: string;
|
|
182
220
|
label: string;
|
|
183
221
|
}>;
|
|
222
|
+
/**
|
|
223
|
+
* Visible segmented options for a short fixed set; defaults to the compact
|
|
224
|
+
* select, which also suits a list whose length follows the deployment.
|
|
225
|
+
*/
|
|
226
|
+
presentation?: FieldPresentation;
|
|
184
227
|
}): import("react").JSX.Element;
|
|
185
228
|
/**
|
|
186
|
-
*
|
|
187
|
-
* applies on flip
|
|
229
|
+
* A boolean toggle drawn as a switch track, for a setting that is only on or
|
|
230
|
+
* off and applies on flip. It is a real button with
|
|
188
231
|
* `role="switch"` and `aria-checked`, so keyboard and assistive activation
|
|
189
232
|
* arrive as a click and the state is announced instead of inferred from a
|
|
190
233
|
* checkbox tick.
|
|
234
|
+
*
|
|
235
|
+
* The thumb bounces across only once the reader has pressed this switch: the
|
|
236
|
+
* press writes the mark that arms the bounce, so a page opening, a TAB
|
|
237
|
+
* switching back or a value arriving from elsewhere draws every thumb at rest.
|
|
191
238
|
*/
|
|
192
239
|
export declare function ToggleSwitch(props: {
|
|
193
240
|
/** Id of the element naming the switch (the card's title). */
|
|
@@ -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;
|
|
@@ -309,10 +309,6 @@ export declare const zh: {
|
|
|
309
309
|
'settings.readOnly': string;
|
|
310
310
|
'settings.expand': string;
|
|
311
311
|
'settings.collapse': string;
|
|
312
|
-
'settings.save': string;
|
|
313
|
-
'settings.saving': string;
|
|
314
|
-
'settings.discard': string;
|
|
315
|
-
'settings.unsaved': string;
|
|
316
312
|
'settings.saveFailed': string;
|
|
317
313
|
'settings.invalidNumber': string;
|
|
318
314
|
'settings.sessionPollSeconds': string;
|
|
@@ -481,6 +477,7 @@ export declare const zh: {
|
|
|
481
477
|
'board.hideSubtasks': string;
|
|
482
478
|
'board.showSubtasks': string;
|
|
483
479
|
'board.subtaskFilterHint': string;
|
|
480
|
+
'settings.enabledTopic': string;
|
|
484
481
|
};
|
|
485
482
|
/** en dictionary, complete against the zh key set. */
|
|
486
483
|
export declare const en: Record<keyof typeof zh, string>;
|
|
@@ -47,6 +47,8 @@ export declare const FAMILY_GROUP_SERVICE = "webUiSettings";
|
|
|
47
47
|
export interface PluginCardSlots {
|
|
48
48
|
/** Contribution of one card entry. */
|
|
49
49
|
register(options: never, component: never): unknown;
|
|
50
|
+
/** Declaration probe: a target seat may appear after this plugin applies. */
|
|
51
|
+
spec?(key: string): unknown;
|
|
50
52
|
}
|
|
51
53
|
/** The slice of the client context a card contribution needs. */
|
|
52
54
|
export interface PluginCardContext {
|
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
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.
|
|
8
9
|
*/
|
|
9
10
|
import type { ConfigForm } from '@deepseek-ai/dsh-client-ui-settings/client';
|
|
10
11
|
import type { SnapshotStore } from '@deepseek-ai/dsh-client-store';
|
|
11
|
-
/** The write one field's
|
|
12
|
+
/** The write one field's draft text performs when it is applied. */
|
|
12
13
|
export type FieldWrite = {
|
|
13
14
|
kind: 'set';
|
|
14
15
|
value: unknown;
|
|
@@ -19,6 +20,12 @@ export type FieldWrite = {
|
|
|
19
20
|
export interface FieldSpec {
|
|
20
21
|
/** Field name inside the namespace section. */
|
|
21
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';
|
|
22
29
|
/**
|
|
23
30
|
* Whether the Host treats this field as a secret and redacts its value from
|
|
24
31
|
* the read-back (role('secret') in the section schema). Redacted secrets are
|
|
@@ -32,8 +39,9 @@ export interface FieldSpec {
|
|
|
32
39
|
/** Render a stored value as draft text; the empty string when the section carries none. */
|
|
33
40
|
format: (value: unknown) => string;
|
|
34
41
|
/**
|
|
35
|
-
* The write this draft text
|
|
36
|
-
* value this field accepts — which
|
|
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.
|
|
37
45
|
*/
|
|
38
46
|
parse: (text: string) => FieldWrite | undefined;
|
|
39
47
|
}
|
|
@@ -41,9 +49,9 @@ export interface FieldSpec {
|
|
|
41
49
|
export interface FieldState {
|
|
42
50
|
/** Draft text the control renders. */
|
|
43
51
|
text: string;
|
|
44
|
-
/** Whether
|
|
52
|
+
/** Whether the field leaves (or will leave) a user-layer entry. */
|
|
45
53
|
overridden: boolean;
|
|
46
|
-
/** Whether the draft is not a value this field accepts, which
|
|
54
|
+
/** Whether the draft is not a value this field accepts, which holds it unwritten. */
|
|
47
55
|
invalid: boolean;
|
|
48
56
|
}
|
|
49
57
|
/** Form state every plugin settings card shares. */
|
|
@@ -60,13 +68,13 @@ export interface CardShell {
|
|
|
60
68
|
exposed: boolean;
|
|
61
69
|
/** Whether the Host document accepts writes. */
|
|
62
70
|
writable: boolean;
|
|
63
|
-
/** Whether the form holds
|
|
71
|
+
/** Whether the form holds drafts not yet written (typed text waiting for its pause). */
|
|
64
72
|
dirty: boolean;
|
|
65
|
-
/** Whether any
|
|
73
|
+
/** Whether any draft is invalid, which holds it unwritten. */
|
|
66
74
|
invalid: boolean;
|
|
67
|
-
/** Whether a
|
|
75
|
+
/** Whether a write is crossing the wire. */
|
|
68
76
|
saving: boolean;
|
|
69
|
-
/** Whether the last
|
|
77
|
+
/** Whether the last write did not land; cleared by the next edit or write. */
|
|
70
78
|
failed: boolean;
|
|
71
79
|
/**
|
|
72
80
|
* The rejection code/message the Host returned for the last failed save,
|
|
@@ -77,15 +85,17 @@ export interface CardShell {
|
|
|
77
85
|
}
|
|
78
86
|
/** The write actions the card's slot entry injects. */
|
|
79
87
|
export interface CardActions {
|
|
80
|
-
/**
|
|
88
|
+
/** Take draft text for one field; a pick writes at once, typed text after a pause. */
|
|
81
89
|
edit: (field: string, text: string) => void;
|
|
82
|
-
/**
|
|
90
|
+
/** Clear one field at once, so it re-inherits the composition layer. */
|
|
83
91
|
resetField: (field: string) => void;
|
|
84
|
-
/** Write every
|
|
92
|
+
/** Write every pending draft now (a text field's Enter or blur), then re-seed from what the Host accepted. */
|
|
85
93
|
save: () => void;
|
|
86
|
-
/** Drop every
|
|
94
|
+
/** Drop every pending draft, putting each control back to the stored value (a text field's Escape). */
|
|
87
95
|
discard: () => void;
|
|
88
96
|
}
|
|
97
|
+
/** How long typed text rests before it is written. */
|
|
98
|
+
export declare const TYPE_PAUSE_MS = 600;
|
|
89
99
|
/** One durable write inside the save's atomic form mutation. */
|
|
90
100
|
export interface BatchedWrite {
|
|
91
101
|
/** Field this entry writes. */
|
|
@@ -102,10 +112,13 @@ export interface NumberConstraints {
|
|
|
102
112
|
/** The accepted value must be at least this. */
|
|
103
113
|
min?: number;
|
|
104
114
|
}
|
|
105
|
-
/** A whole- or decimal-number field. An empty draft clears the field; any other draft that is not a finite number within the constraints
|
|
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. */
|
|
106
116
|
export declare function numberField(field: string, constraints?: NumberConstraints): FieldSpec;
|
|
107
|
-
/**
|
|
108
|
-
|
|
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;
|
|
109
122
|
/**
|
|
110
123
|
* A free-text field the Host treats as a secret and redacts from the read-back
|
|
111
124
|
* (role('secret') in the section schema). The card still edits it like text,
|
|
@@ -118,12 +131,14 @@ export declare function booleanField(field: string): FieldSpec;
|
|
|
118
131
|
/** An enumerated string field; only the listed choices are accepted. An empty draft clears the field. */
|
|
119
132
|
export declare function choiceField(field: string, choices: readonly string[]): FieldSpec;
|
|
120
133
|
/**
|
|
121
|
-
*
|
|
134
|
+
* Applies one card's edits to one settings namespace as the reader makes them.
|
|
122
135
|
*
|
|
123
136
|
* The Host is the only authority on whether a value was accepted — its
|
|
124
137
|
* validators own the constraints no schema can express — so the outcome is
|
|
125
|
-
* read back from the section rather than predicted here. A
|
|
126
|
-
* land
|
|
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.
|
|
127
142
|
*/
|
|
128
143
|
export declare class CardForm<T> {
|
|
129
144
|
private readonly scope;
|
|
@@ -133,6 +148,8 @@ export declare class CardForm<T> {
|
|
|
133
148
|
/** The form subscription installed in the constructor; released by dispose(). */
|
|
134
149
|
private readonly disposeForm;
|
|
135
150
|
private disposed;
|
|
151
|
+
/** The pending write of typed text, waiting for typing to pause. */
|
|
152
|
+
private typePause;
|
|
136
153
|
private saving;
|
|
137
154
|
/** A save asked for while one was in flight; it runs once the first settles (#1754). */
|
|
138
155
|
private saveQueued;
|
|
@@ -147,47 +164,46 @@ export declare class CardForm<T> {
|
|
|
147
164
|
dispose(): void;
|
|
148
165
|
/** Publish a projection of this form, rebuilt whenever the form or a draft changes. */
|
|
149
166
|
bind<S>(project: () => S): SnapshotStore<S>;
|
|
150
|
-
/** Read the card-level state: what the Host serves, and what
|
|
167
|
+
/** Read the card-level state: what the Host serves, and what is still waiting to be written. */
|
|
151
168
|
shell(): CardShell;
|
|
152
169
|
/** Read one field's state from the effective section and its staged draft. */
|
|
153
170
|
field(field: string): FieldState;
|
|
154
171
|
/** The actions the card's slot registration injects. */
|
|
155
172
|
actions(): CardActions;
|
|
156
173
|
/**
|
|
157
|
-
*
|
|
158
|
-
*
|
|
174
|
+
* Run one write, and re-run it once if another was asked for while this one
|
|
175
|
+
* was still in flight.
|
|
159
176
|
*
|
|
160
|
-
*
|
|
161
|
-
*
|
|
162
|
-
*
|
|
163
|
-
*
|
|
164
|
-
*
|
|
165
|
-
* settled snapshot read back one planned write at a time. One missed write
|
|
166
|
-
* fails the whole save. A transport that rejects instead (the dsh-web bridge
|
|
167
|
-
* controller on a dead connection) reports through the same failure path
|
|
168
|
-
* with its rejection message. A save that did not land keeps its drafts, so
|
|
169
|
-
* the user can correct them instead of retyping.
|
|
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.
|
|
170
182
|
* @returns settlement after the mutation and the read-back.
|
|
171
183
|
*/
|
|
184
|
+
requestSave(): Promise<void>;
|
|
172
185
|
/**
|
|
173
|
-
*
|
|
174
|
-
*
|
|
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.
|
|
175
189
|
*
|
|
176
|
-
*
|
|
177
|
-
* the Host
|
|
178
|
-
*
|
|
179
|
-
* with
|
|
180
|
-
*
|
|
181
|
-
*
|
|
182
|
-
* the
|
|
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.
|
|
183
200
|
* @returns settlement after the mutation and the read-back.
|
|
184
201
|
*/
|
|
185
|
-
requestSave(): Promise<void>;
|
|
186
202
|
save(): Promise<void>;
|
|
187
203
|
/**
|
|
188
|
-
* Every staged edit a
|
|
189
|
-
* its field accepts carries no write: the form is still dirty, and the
|
|
190
|
-
*
|
|
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
|
|
191
207
|
* effective section is not a write at all.
|
|
192
208
|
* @returns the planned writes, in the order the fields were staged.
|
|
193
209
|
*/
|
|
@@ -202,7 +218,13 @@ export declare class CardForm<T> {
|
|
|
202
218
|
* user layer once the mutation has settled.
|
|
203
219
|
*/
|
|
204
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
|
+
*/
|
|
205
225
|
private stage;
|
|
226
|
+
/** Write every pending draft now, taking the place of a waiting pause. */
|
|
227
|
+
private applyNow;
|
|
206
228
|
private specOf;
|
|
207
229
|
private snapshotOf;
|
|
208
230
|
private sectionValue;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@linxin666/dsh-client-ui-task-board",
|
|
3
3
|
"description": "Host-authoritative task board for the DSH Web GUI with real session execution, Host cron scheduling, and optional cross-platform idle-sleep protection; mounted without DSH source changes.",
|
|
4
|
-
"version": "0.4.
|
|
4
|
+
"version": "0.4.11",
|
|
5
5
|
"icon": "icon.svg",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"main": "lib/index.js",
|