dsh-panel-dock 0.0.0-stage → 1.0.43

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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Awenforever
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,3 +1,232 @@
1
- # Temporary Holding Version
1
+ # dsh-panel-dock
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ One owner for plugin panels in DeepSeek Harness: a managed stack in the sidebar footer, and a band
4
+ beside the conversation for cards that need the room next to the transcript.
5
+
6
+ Plugins register a card and the dock decides where it renders. The card never measures the
7
+ conversation column, never negotiates with other cards for space, and never depends on internal
8
+ class names or localized aria labels.
9
+
10
+ ## What it is not
11
+
12
+ It is a slot negotiation layer, not a feature the user operates. It registers no navigation entry,
13
+ no button, no dialog and no keyboard shortcut — every affordance on screen belongs to the cards.
14
+ There is no dock UI to open, close, widen or collapse.
15
+
16
+ ## API
17
+
18
+ ```js
19
+ const dock = window.__dshPanelDock // present once the dock plugin is active
20
+
21
+ const dispose = dock.define({
22
+ id: 'my-panel', // required, unique
23
+ title: 'My panel', // label, shown by CardShell and hosts
24
+ order: 100, // stacking position, ascending; ties keep registration order
25
+ side: 'left', // 'left' (default) | 'right'
26
+ minWidth: 280, // width below which your content stops being useful (default 280)
27
+ version: '1.2.3', // optional; shown by CardShell next to the title
28
+ frame: false, // optional; opt OUT of the dock-drawn rectangle. Default: dock draws it.
29
+ component: MyPanel, // required, a React component
30
+ })
31
+ ```
32
+
33
+ `define()` throws unless `id` is a non-empty string and `component` is a function; defining an
34
+ existing id replaces the earlier definition. It returns a `dispose()` that unregisters the card.
35
+
36
+ | call | returns |
37
+ |---|---|
38
+ | `dock.panels()` | `[{ id, title, order, side, effective, minWidth, version, frame }]` in stacking order |
39
+ | `dock.getSide(id)` | `'left' \| 'right'` |
40
+ | `dock.setSide(id, side)` | the side that was stored |
41
+ | `dock.toggleSide(id)` | the new side |
42
+ | `dock.subscribe(listener)` | `unsubscribe()`; fires on every registration and side change |
43
+ | `dock.version` | the dock's version string |
44
+
45
+ ## Where a panel lives
46
+
47
+ A panel starts on the side its definition asks for (`side`, default `left`) and the user moves it
48
+ with the card's own control:
49
+
50
+ ```js
51
+ dock.getSide('my-panel') // 'left' | 'right'
52
+ dock.toggleSide('my-panel') // returns the new side
53
+ dock.setSide('my-panel', 'right')
54
+ ```
55
+
56
+ The choice is persisted per panel id, so a reload restores it.
57
+
58
+ | Side | Host slot | Geometry |
59
+ |---|---|---|
60
+ | `left` (default) | `sidebar.footer.action` | full sidebar width, intrinsic height, 6px gap |
61
+ | `right` | `shell.overlay` | band between the transcript handle and the turn rail, 6px gap |
62
+
63
+ With nothing on the right the band does not exist at all: no reserved width, no overlay, no click
64
+ target. Stacking is `order` ascending (missing = 100) in both hosts; cards with the same `order` keep
65
+ registration order. `order` is how a card states "I belong above/below the others"; it does not affect
66
+ anything else.
67
+
68
+ ### Right band anchors
69
+
70
+ Measured from the shipped layout, never assumed:
71
+
72
+ | Edge | Rule |
73
+ |---|---|
74
+ | left | `widthHandle[data-side="right"]` right + 6 |
75
+ | right | smallest turn-navigation x that is still right of the handle, minus 6 |
76
+ | top | `[data-conversation-tabs]` row bottom + 6 |
77
+ | bottom | 8 |
78
+
79
+ ```
80
+ width = min(max(span, 200), 480, anchors.right - 8) // span = anchors.right - anchors.left
81
+ inner = railLeft - 6 - (handleRight + 6) // gutter between the handle and the turn rail
82
+ outer = (areaRight - 6) - (railRight + 6) // gutter between the rail and the column's edge
83
+
84
+ required = clamp(max(minWidth of the right-side panels, default 280), 120, 480)
85
+ // one column, one width: the most demanding card in it wins
86
+
87
+ inner >= required → pinned to the handle (the usual case), width = min(inner, 480)
88
+ else outer>=required → pinned to the column's right edge, width = min(outer, 480)
89
+ else → intrusion: width is exactly required, the right edge sits on the column
90
+ edge, so the card takes the smallest possible bite out of the transcript.
91
+ Only if even that would cover half the column do the cards fall back to
92
+ the sidebar stack.
93
+ ```
94
+
95
+ The band is `pointer-events: none` and cards re-enable their own; it never swallows a click meant
96
+ for the conversation. With the right sidebar (开始 / terminal / browser) open, the band is clamped to
97
+ the conversation area's right edge — it never draws on that panel.
98
+
99
+ ## Panel component contract
100
+
101
+ 1. Render **one root element** and **spread the props you receive** onto it, keeping `style` last:
102
+ `h('div', { ...rest, style: { ...style, /* yours */ } })`.
103
+ 2. Never position yourself: no `position: fixed`, no explicit width, no margins used to fight the
104
+ dock. The dock owns placement.
105
+ 3. **The dock owns the visible rectangle.** Since 0.8.0 every card is wrapped in
106
+ `[data-panel-dock-frame]`: background `--dsw-specific-sidebar-fill`, 1px
107
+ `--dsw-alias-border-l1`, radius 12, padding `10px 9px 8px`, shadow
108
+ `0 3px 12px rgba(0,0,0,.16)`. Your root is **flattened** — `padding/margin/border/
109
+ border-radius/background/box-shadow` are forced to zero on it — so draw content, not a box.
110
+ A card that genuinely needs its own box passes `frame: false` and keeps its shell (it will
111
+ then look different from the rest, which is the point of opting out).
112
+ If you want the shared top bar, render `dock.CardShell` (below); it draws only the header
113
+ row, never your body.
114
+ 4. Give it an **intrinsic height** in both hosts. The dock supplies width, flex reset and the 6px
115
+ stack gap, nothing more. `order` decides stacking; `height` is accepted for compatibility but has
116
+ no layout effect.
117
+ 5. **Do not depend on your DOM parent.** Since 0.4.0 each card lives in a container that
118
+ the dock *moves* between the sidebar stack and the band, so that switching sides never
119
+ remounts you (your state and scroll survive). Parent selectors, `closest()` lookups for
120
+ the host, and anything positional that assumes a fixed DOM ancestry will break.
121
+ 6. Declare `minWidth` (default 280). It is your statement of the width below which your content
122
+ stops being useful — the dock never renders you narrower in the **right band** and never guesses
123
+ your number. **It does not apply to the left stack**: there the dock gives you the sidebar's
124
+ width (typically ~264px, the host's and the user's to change), so a card that needs 280 will
125
+ still be cut when it sits on the left.
126
+ To find it: force the strip's width to 240/260/280/300/340 and look at a screenshot of your own
127
+ card; pick the narrowest width where no value is cut to `35.2/1…`. `scrollWidth` and text-range
128
+ measurements both miss that cut, so it has to be looked at.
129
+
130
+ A stack that fits stays a plain, non-clipping column: cards may draw outside their own box (their
131
+ shadow). Only when the cards are **taller than the column** does the band become a scroll container,
132
+ and then it grows by the shadow's reach (16px) and pads the same amount back — every card keeps the
133
+ exact rectangle it had, and the scrollport's clip line lands in the gutter instead of across a
134
+ shadow. Scrolling is wheel/trackpad only: no scrollbar is drawn, because a bar in the gutter would
135
+ sit beside the cards as a foreign affordance. While scrolling, a card is cut at the gutter edge,
136
+ 16px outside the band.
137
+
138
+
139
+ ## CardShell — the optional shared top bar
140
+
141
+ A card is a *sidebar card* (侧栏卡片): it lives in the sidebar stack or the band. `dock.CardShell` is
142
+ the one shared header row for those cards — a monochrome logo that *is* the side toggle, the title,
143
+ and a quiet version. It is **not** a layout container: your frame and body stay yours.
144
+
145
+ ```js
146
+ function MyCard(props) {
147
+ const CardShell = dock.CardShell
148
+ return h('div', Object.assign({}, props, {
149
+ style: Object.assign({}, props.style, myFrame), // your frame; `style` goes last
150
+ }),
151
+ // The shell already renders the version from `define({ version })`. Put *state* here
152
+ // ("up to date", a spinner, a badge) -- never a second copy of the version.
153
+ h(CardShell, { id: 'my-panel', actions: h(StateChip) }),
154
+ h(MyBody), // your body, a sibling
155
+ )
156
+ }
157
+ ```
158
+
159
+ **CardShell renders the header row only — it does not render `children`.** That is deliberate
160
+ (see the user-facing rule: the shell is not a layout container), so put your body *next to* the
161
+ shell, never inside it. Passing children logs one warning per card instead of silently eating them.
162
+
163
+ | prop | meaning |
164
+ |---|---|
165
+ | `id` | required; the registered panel id (the shell reads title/version from it) |
166
+ | `title`, `version` | optional overrides for what `define` declared |
167
+ | `actions` | optional node rendered at the right end (keep it small; it shares the row) |
168
+ | `style` | merged into the header row |
169
+
170
+ The toggle inside the shell calls `dock.toggleSide(id)`, so the logo is the only control a card needs
171
+ for moving between sides. Its aria-label and tooltip follow the dock's locale.
172
+
173
+ **Terminology**: `panel` alone means a *main-area panel* (a full page hosted by DSH — dsh-loci's
174
+ five-view view, for example); anything the dock hosts is a **sidebar card** (侧栏卡片). The dock never
175
+ hosts a main-area panel.
176
+
177
+ ## Appearance spec (SSOT)
178
+
179
+ The dock owns no visuals, but cards look consistent when they follow one spec. This table is the
180
+ contract; it is the measured convention of the shipped cards, not an invention.
181
+
182
+ | | left stack (inside the sidebar) | right band (floating over the conversation) |
183
+ |---|---|---|
184
+ | frame | `padding: 10px 9px 8px`, `border: 1px solid var(--dsw-alias-border-l1)`, `border-radius: 12` | same |
185
+ | background | `var(--dsw-alias-bg-layer-1)` | `var(--dsw-specific-sidebar-fill, var(--dsw-alias-bg-module-platform))` |
186
+ | shadow | `0 3px 12px rgba(0, 0, 0, 0.16)` | `0 3px 12px rgba(15, 23, 42, 0.06)` — same shape, lighter and cooler: a black cast reads as dirt in the narrow gap between two plates |
187
+ | header | `dock.CardShell`: 13px/600 title, 10px secondary version, 18px monochrome logo | same |
188
+ | numbers | `font-variant-numeric: tabular-nums` | same |
189
+
190
+ Theme: use `--dsw-alias-*` tokens only — they inherit light/dark from the host. The one value that
191
+ does not adapt is the hard-coded shadow rgba; keep it as above (both are light enough for dark mode).
192
+
193
+ ## Readiness
194
+
195
+ Client plugin bundles resolve bare module ids only, so the dock publishes a well-known global instead
196
+ of a Cordis service. Consumers poll on activation:
197
+
198
+ ```js
199
+ const register = () => {
200
+ const dock = window.__dshPanelDock
201
+ if (!dock) return setTimeout(register, 200)
202
+ const dispose = dock.define({ /* … */ })
203
+ }
204
+ register()
205
+ ```
206
+
207
+ ## State
208
+
209
+ `localStorage["dsh.panel-dock.v1"] = { sides: { [id]: "left" | "right" } }`. Unknown ids and
210
+ unreadable storage are ignored, so a cleared or private-mode profile just falls back to the
211
+ definition defaults.
212
+
213
+ ## Install
214
+
215
+ Not on npm yet. Install a tarball spec through the host plugin manager; the bundle ships its own
216
+ patch:
217
+
218
+ - `https://github.com/Awenforever/dsh-panel-dock/archive/<commit>.tar.gz`
219
+ - `file:C:/<path>/dsh-panel-dock-<version>.tgz`
220
+
221
+ The client half hot-loads through `dsh-client-hmr`, so no page refresh is needed. Bump the version
222
+ for every build you install: `pnpm` treats an unchanged version as already up to date and keeps the
223
+ old copy.
224
+
225
+ ## Status
226
+
227
+ `0.4.0`. In use by `dsh-ustc-quota` 1.2.7 and `dsh-codex-advisor` 0.10.0, both on the left by
228
+ default. Not published to npm.
229
+
230
+ ## License
231
+
232
+ MIT