dsh-qr-share 0.1.0 → 0.3.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.md CHANGED
@@ -7,6 +7,103 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [0.3.1] — 2026-09-01
11
+
12
+ ### Changed
13
+
14
+ - **Trimmed `dsh.client.inject` peer-module list** — dropped
15
+ `@deepseek-ai/dsh-client-runtime` and `@deepseek-ai/dsh-client-ui-slots`
16
+ from the package.json manifest. The plugin's runtime only consumes
17
+ three services from the dsh host (`slots`, `locale`, `connection`),
18
+ and these are still provided by the remaining two peer modules
19
+ (`@deepseek-ai/dsh-client-locale` and
20
+ `@deepseek-ai/dsh-client-ui-sidebar`). Boot-time module manifest
21
+ shrinks and `__DSH_BOOT__.clientModules` reflects the smaller
22
+ surface; user-visible behavior (sidebar footer button, QR dialog,
23
+ copy-link, six extra locales) is unchanged.
24
+
25
+ ## [0.3.0] — 2026-08-30
26
+
27
+ ### Added
28
+
29
+ - **Copy link button in the dialog** — a second footer action next to
30
+ Close. Clicking it copies `${window.location.origin}/?token=…` to
31
+ the clipboard; the label flips to a localized "已复制 / Copied"
32
+ confirmation for 1.5 s, then back. Falls back from the async
33
+ Clipboard API to `document.execCommand('copy')` when the secure-
34
+ context path is unavailable (older WebViews, non-HTTPS previews),
35
+ and surfaces "复制失败 / Copy failed" if both paths reject.
36
+ - **Extra locale dictionaries** — beyond the built-in `zh` and `en`,
37
+ six more locales are registered via the single-locale
38
+ `ctx.locale.register(ns, locale, dict)` overload: `zh-Hant` (繁體),
39
+ `ja`, `ko`, `fr`, `de`, `ru`. They activate only when a matching
40
+ language-pack plugin sets the DSH preference; without a language
41
+ pack, the existing fallback chain (`zh` → `en`) still resolves.
42
+ - **Dialog keys for the copy flow** — `dialog.copy`, `dialog.copied`,
43
+ and `dialog.copyFailed` added to the `QrShareKey` interface and
44
+ every dictionary.
45
+ - **Two QrDialog tests** — clipboard write is asserted with a
46
+ stubbed `navigator.clipboard.writeText` (success + reject path).
47
+
48
+ ### Changed
49
+
50
+ - **Footer action row** in `QrDialog` now holds two buttons
51
+ ("Copy link" + "Close") in a flex row (`.actions`) instead of a
52
+ single Close button. The `.close` class is generalized to `.action`;
53
+ the dialog's visual rhythm is unchanged.
54
+
55
+ ## [0.2.0] — 2026-08-30
56
+
57
+ ### Added
58
+
59
+ - **Test infrastructure** — vitest 2 + @testing-library/react, configured
60
+ for happy-dom. `pnpm test` runs 27 specs covering `config`,
61
+ `client/api` and `client/QrDialog`. `tsconfig.build.json` now
62
+ excludes `src/**/*.test.ts(x)` and `src/test/**` so the tests never
63
+ reach the published `.d.ts` output.
64
+ - **Ambient CSS module declaration** — `src/client/styles.module.css.d.ts`
65
+ gives `tsc` the default-export shape that `lightningcss` produces at
66
+ build time, unblocking `import styles from './styles.module.css'`
67
+ in `QrButton.tsx` and `QrDialog.tsx` without weakening the type
68
+ checker.
69
+
70
+ ### Changed
71
+
72
+ - **Dialog now renders into `document.body` via `createPortal`** —
73
+ the sidebar's `transform`/`filter` would otherwise trap
74
+ `position: fixed` inside the sidebar's box; portalling escapes every
75
+ ancestor's containing block so the backdrop covers the viewport and
76
+ the dialog is centered on screen.
77
+ - **Dialog surface is theme-aware and fully opaque** — background
78
+ resolves to the DSH shell's `--dsw-alias-bg-layer-1` token (alpha = 1),
79
+ with a `currentColor 12%` hairline border and a soft shadow. A
80
+ `--dsh-qr-share-dialog-bg` override hook is exposed for power users.
81
+ - **QR code canvas wrapped in a white card** — 8px padding + `#fff`
82
+ background guarantees the black modules stay scannable against
83
+ either light or dark DSH surface.
84
+ - **Sidebar action is now a labeled icon** — wide mode renders both
85
+ the `HiOutlineQrCode` icon and the `button.label` text; rail mode
86
+ keeps the icon only.
87
+ - **Copy localized** — `button.label` is now "分享" (zh) / "Share"
88
+ (en); `button.tooltip` and `dialog.title` were rewritten in the
89
+ same voice ("扫码把当前会话分享到手机" / "Scan to share"). The host
90
+ handshake's semantics are unchanged.
91
+
92
+ ### Fixed
93
+
94
+ - **QR canvas was blank on first render** — the `useEffect` that
95
+ calls `qrcode.toCanvas` ran once before the portal-mounted `<canvas>`
96
+ was in the DOM. Adding `portalTarget` to the effect's dependency
97
+ list gives the canvas a second pass after the portal resolves.
98
+ - **CSS Module class names were hardcoded** — `QrDialog.tsx` and
99
+ `QrButton.tsx` used the literal `'dsh-qr-share-backdrop'`
100
+ strings, but tsdown's `lightningcss` compiles them under the
101
+ `[hash]_[local]` pattern (`i2jIGq_backdrop`). The two forms never
102
+ matched, so the dialog had no styles at all and fell back to
103
+ `position: static`. Both files now consume the `styles.*` import
104
+ map; the bundle ships the hashed class names in the inline
105
+ `<style data-plugin>` tag.
106
+
10
107
  ## [0.1.0] — 2026-08-29
11
108
 
12
109
  ### Added
@@ -50,5 +147,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
50
147
  preventing cross-site frames from reaching the route and stopping
51
148
  intermediary caches from storing the token.
52
149
 
53
- [Unreleased]: https://github.com/xiaoguomeiyitian/dsh-qr-share/compare/v0.1.0...HEAD
150
+ [Unreleased]: https://github.com/xiaoguomeiyitian/dsh-qr-share/compare/v0.2.0...HEAD
151
+ [0.2.0]: https://github.com/xiaoguomeiyitian/dsh-qr-share/compare/v0.1.0...v0.2.0
54
152
  [0.1.0]: https://github.com/xiaoguomeiyitian/dsh-qr-share/releases/tag/v0.1.0
package/README.md CHANGED
@@ -99,12 +99,24 @@ layout needs a symlink — see `manual` install below).
99
99
  ## Build
100
100
 
101
101
  ```bash
102
+ # Recommended: pnpm (matches the project lockfile-less layout)
102
103
  pnpm install
103
104
  pnpm build # tsc declarations + tsdown bundles
104
105
  pnpm typecheck # strict check
105
106
  pnpm pack # produce dsh-qr-share-<version>.tgz (used by the install commands above)
107
+
108
+ # Also supported: npm (any Node >= 20, no extra install)
109
+ npm install
110
+ npm run build # same tsc + tsdown pipeline
111
+ npm run typecheck
112
+ npm pack
106
113
  ```
107
114
 
115
+ > For npm publishing we ship [`./npm_publish.sh`](npm_publish.sh) — a
116
+ > single-file mirror of the [core_ts](https://github.com/xiaoguomeiyitian/core_ts)
117
+ > release flow (`npm login` → `npm install` → `npm run build` →
118
+ > `npm pack --dry-run` review → `npm publish --access public`).
119
+
108
120
  Outputs:
109
121
 
110
122
  - `lib/index.js` — Node host half (the `/_qr/share` route)
package/README.zh.md CHANGED
@@ -74,12 +74,21 @@ pnpm add dsh-qr-share
74
74
  ## 构建
75
75
 
76
76
  ```bash
77
+ # 推荐:pnpm(与项目无 lockfile 的设计一致)
77
78
  pnpm install
78
79
  pnpm build # tsc 声明 + tsdown bundle
79
80
  pnpm typecheck # 严格检查
80
81
  pnpm pack # 产出 dsh-qr-share-<version>.tgz
82
+
83
+ # 也支持:npm(任意 Node >= 20, 无需额外安装)
84
+ npm install
85
+ npm run build # 同样的 tsc + tsdown 管线
86
+ npm run typecheck
87
+ npm pack
81
88
  ```
82
89
 
90
+ > 发版用 [`./npm_publish.sh`](npm_publish.sh)——单文件脚本,照搬 [core_ts](https://github.com/xiaoguomeiyitian/core_ts) 的发布流程(`npm login` → `npm install` → `npm run build` → `npm pack --dry-run` 预检 → `npm publish --access public`)。
91
+
83
92
  产物:
84
93
 
85
94
  - `lib/index.js` — Node 宿主半(`/_qr/share` 路由)
package/cordis.patch.yml CHANGED
@@ -14,9 +14,11 @@
14
14
  # modules resolves `<name>/package.json` from the profile dir to
15
15
  # discover the client half and compose window.__DSH_BOOT__.
16
16
  #
17
- # To disable the plugin without uninstalling, swap this row's `name`
18
- # to a `!!js` expression returning a disabled placeholder (see
19
- # dsh-better-sidebar's cordis.patch.yml for the pattern).
17
+ # `id` MUST match the bundle's own `window.__ModuleLoader__.load({id,
18
+ # …})` argument (set by `tsdown.config.ts#clientBundle(pluginId)`.).
19
+ # An id mismatch breaks dsh-client-modules' module graph: the loader
20
+ # entry path and the bundle's required id diverge, so the browser
21
+ # never resolves the plugin and shows nothing on screen.
20
22
  - insert:
21
- - id: qr-share
23
+ - id: dsh-qr-share
22
24
  name: 'dsh-qr-share'