dsh-mini-utility-dock 0.5.0 → 0.5.1
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/CHANGELOG.en.md +4 -0
- package/CHANGELOG.md +4 -0
- package/bin/dsh-mini-utility-dock.js +8 -6
- package/dist/launcher.js +33 -3
- package/package.json +1 -1
package/CHANGELOG.en.md
CHANGED
|
@@ -3,6 +3,10 @@
|
|
|
3
3
|
Release notes are generated from the matching version section; newest first.
|
|
4
4
|
For Chinese, see [CHANGELOG.md](CHANGELOG.md).
|
|
5
5
|
|
|
6
|
+
## 0.5.1 - 2026-09-25
|
|
7
|
+
|
|
8
|
+
- Fix the launcher disappearing after a hot reload: the claim is released with its owner, which wakes the other copies to register again instead of requiring a full page reload.
|
|
9
|
+
|
|
6
10
|
## 0.5.0 - 2026-09-24
|
|
7
11
|
|
|
8
12
|
- New `dist/launcher.js` (marker `dsh-utility-launcher`): the family's shared entry point — one icon at the bottom-left that opens a menu of the family's panels. It goes through slots rather than a page-local protocol: one copy of the assembly runs per page (the first plugin to load wins the `window` mutex and declares the menu seat `createhelper.utility.item`), and every other plugin contributes one row to that seat. Consumers maintain it with `launcher:sync` / `launcher:check`, so the three client halves no longer each carry their own copy.
|
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,10 @@
|
|
|
3
3
|
Release Notes 由对应版本段生成;最新版本在前。
|
|
4
4
|
英文版见 [CHANGELOG.en.md](CHANGELOG.en.md)。
|
|
5
5
|
|
|
6
|
+
## 0.5.1 - 2026-09-25
|
|
7
|
+
|
|
8
|
+
- 修复 launcher 热重载后消失:归属从一次性闩锁改为可释放的认领,owner 被销毁时唤醒其余副本重新注册,不再需要刷新整页。
|
|
9
|
+
|
|
6
10
|
## 0.5.0 - 2026-09-24
|
|
7
11
|
|
|
8
12
|
- 新增 `dist/launcher.js`(片段标记 `dsh-utility-launcher`):族的共享入口——左下角一个图标,点开一个列出各插件面板的菜单。它走槽位而不是页面级协议:每页只有一份装配(先加载的插件赢得 `window` 互斥并声明菜单座位 `createhelper.utility.item`),其余插件各往那个座位投一行。消费插件用 `launcher:sync` / `launcher:check` 维护,三个 client 半从此不再各写一份。
|
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
// Embed a canonical fragment from this package into a consumer file.
|
|
3
3
|
//
|
|
4
|
-
//
|
|
5
|
-
// of problem: the consumer must ship the code standalone (a browser classic
|
|
4
|
+
// Three fragments are maintained the same way, because all three have the same
|
|
5
|
+
// shape of problem: the consumer must ship the code standalone (a browser classic
|
|
6
6
|
// script cannot `import`, and a host half must not depend on the dock being
|
|
7
7
|
// installed), so the code is embedded at build time and drift is a build error.
|
|
8
8
|
//
|
|
9
|
-
// dsh-
|
|
10
|
-
// the
|
|
9
|
+
// dsh-utility-launcher -> <dsh-utility-launcher> ... </dsh-utility-launcher>
|
|
10
|
+
// the family launcher (one icon plus the menu of family panels it opens),
|
|
11
|
+
// embedded into a plugin's lib/client.js
|
|
11
12
|
//
|
|
12
13
|
// dsh-loopback-helpers -> <dsh-loopback-helpers> ... </dsh-loopback-helpers>
|
|
13
14
|
// the loopback predicates, embedded into a plugin's lib/shared.js
|
|
@@ -21,8 +22,9 @@
|
|
|
21
22
|
// embed just those.
|
|
22
23
|
//
|
|
23
24
|
// The fragment is selected by the marker already present in the target file, so
|
|
24
|
-
// one command serves
|
|
25
|
-
// `
|
|
25
|
+
// one command serves every target and only a named block is ever touched. A
|
|
26
|
+
// consumer calls this through its own `launcher:sync` / `guard:sync` /
|
|
27
|
+
// `loopback:sync` script; the paired `check` mode is what CI runs.
|
|
26
28
|
|
|
27
29
|
import { readFile, writeFile, stat } from 'node:fs/promises'
|
|
28
30
|
import { resolve } from 'node:path'
|
package/dist/launcher.js
CHANGED
|
@@ -155,9 +155,39 @@ function UtilityLauncher (props) {
|
|
|
155
155
|
// The seat belongs to the shell, so it is reached through inject: registering
|
|
156
156
|
// into it directly throws while that declaration is still pending, and a
|
|
157
157
|
// launcher must never cost the caller the surfaces it registers afterwards.
|
|
158
|
+
//
|
|
159
|
+
// The claim lives on the page and is released with its owner. Every family
|
|
160
|
+
// client half carries this assembly, so without the release a hot reload of the
|
|
161
|
+
// owner would dispose its registration while the claim stayed taken, and the
|
|
162
|
+
// launcher would stay missing until the page was reloaded. A released claim
|
|
163
|
+
// wakes the other copies, which re-register immediately.
|
|
164
|
+
const utilityClaim = () => {
|
|
165
|
+
if (typeof window === 'undefined') return null
|
|
166
|
+
const existing = window[UTILITY_MUTEX_KEY]
|
|
167
|
+
if (existing !== null && typeof existing === 'object') return existing
|
|
168
|
+
const claim = { owner: null, waiters: new Set() }
|
|
169
|
+
window[UTILITY_MUTEX_KEY] = claim
|
|
170
|
+
return claim
|
|
171
|
+
}
|
|
158
172
|
const registerUtilityLauncher = (scope) => {
|
|
159
|
-
|
|
160
|
-
|
|
173
|
+
const claim = utilityClaim()
|
|
174
|
+
if (claim === null) return
|
|
175
|
+
if (claim.owner !== null) {
|
|
176
|
+
claim.waiters.add(() => registerUtilityLauncher(scope))
|
|
177
|
+
return
|
|
178
|
+
}
|
|
179
|
+
claim.owner = scope
|
|
180
|
+
let released = false
|
|
181
|
+
const release = () => {
|
|
182
|
+
if (released) return
|
|
183
|
+
released = true
|
|
184
|
+
if (claim.owner === scope) claim.owner = null
|
|
185
|
+
if (window[UTILITY_MUTEX_KEY] !== claim) return
|
|
186
|
+
const waiters = [...claim.waiters]
|
|
187
|
+
claim.waiters.clear()
|
|
188
|
+
for (const wake of waiters) wake()
|
|
189
|
+
}
|
|
190
|
+
scope.on('dispose', release)
|
|
161
191
|
scope.slots.inject('shell.overlay', () => {
|
|
162
192
|
try {
|
|
163
193
|
scope.slots.register({
|
|
@@ -167,7 +197,7 @@ const registerUtilityLauncher = (scope) => {
|
|
|
167
197
|
children: { [UTILITY_ITEM_SLOT]: { kind: 'list', scope: 'root' } }
|
|
168
198
|
}, UtilityLauncher)
|
|
169
199
|
} catch (error) {
|
|
170
|
-
|
|
200
|
+
release()
|
|
171
201
|
if (typeof console !== 'undefined' && typeof console.error === 'function') {
|
|
172
202
|
console.error('[utility-launcher] could not register the family launcher', error)
|
|
173
203
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-mini-utility-dock",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.1",
|
|
4
4
|
"description": "The DSH plugin family's shared assets: source fragments (the loopback predicates and host request guard for host halves, the utility launcher for client halves), the embedding CLI, and the family diagnostics — cross-repo drift check and bilingual docs structure check.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|