@linxin666/dsh-pet 0.1.12 → 0.1.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/README.i18n.yaml +6 -0
- package/README.md +64 -59
- package/README.zh.md +113 -0
- package/lib/client.js +78 -53
- package/lib/client.js.map +1 -1
- package/lib/index.js +164 -25
- package/lib/invariant.js +1 -1
- package/lib/{state-C9EyycwI.js → state-P-wsVJ6O.js} +7 -6
- package/lib/types/client/PluginSettingsCard.d.ts.map +1 -1
- package/lib/types/client/PluginSettingsCard.js +3 -2
- package/lib/types/client/WhalePet.d.ts.map +1 -1
- package/lib/types/client/WhalePet.js +2 -1
- package/lib/types/service.d.ts +16 -5
- package/lib/types/service.d.ts.map +1 -1
- package/lib/types/service.js +159 -35
- package/lib/types/state.d.ts +10 -12
- package/lib/types/state.d.ts.map +1 -1
- package/lib/types/state.js +14 -10
- package/package.json +1 -11
- package/src/client/PluginSettingsCard.tsx +30 -5
- package/src/client/WhalePet.test.tsx +25 -1
- package/src/client/WhalePet.tsx +6 -0
- package/src/client/pet.module.css +9 -0
- package/src/client/settings-card.module.css +141 -127
- package/src/service.ts +187 -34
- package/src/state.test.ts +4 -1
- package/src/state.ts +17 -13
package/README.i18n.yaml
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
# Bilingual-pair consistency record (docs/i18n.md): the git blob hash of each
|
|
2
|
+
# side as of the last confirmed-consistent state. Both languages carry equal authority;
|
|
3
|
+
# after editing either side, bring the other along and re-record with:
|
|
4
|
+
# node scripts/verify-docs.mjs --write <dir>
|
|
5
|
+
README.md: 437e1068038cb013e2880441e69cf1c259f51e79
|
|
6
|
+
README.zh.md: 46511480ae653cc8d6c9b164e9e84ff5645f5945
|
package/README.md
CHANGED
|
@@ -1,85 +1,89 @@
|
|
|
1
|
-
# dsh-pet —
|
|
1
|
+
# dsh-pet — Whale-girl pet plugin
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
English | [中文](README.zh.md)
|
|
4
4
|
|
|
5
|
-
>
|
|
5
|
+
> A soft, healing whale-girl who works alongside you in DeepSeek Harness.
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
While the model thinks, you wait — she swims. She follows official session activity and switches animations while waiting, thinking, using tools, composing a reply, celebrating completion, or reporting failure; you can also pat her head, feed her dried fish, and watch her grow from a baby whale into your deep-sea bond.
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
Re-implemented from the pet feature of the Codex desktop app, as an official DSH plugin shape (cordis bundle: host half + client half in one package).
|
|
10
10
|
|
|
11
|
-
##
|
|
11
|
+
## Features
|
|
12
12
|
|
|
13
|
-
|
|
|
13
|
+
| Feature | Description |
|
|
14
14
|
|---|---|
|
|
15
|
-
|
|
|
16
|
-
|
|
|
17
|
-
|
|
|
18
|
-
|
|
|
19
|
-
|
|
|
20
|
-
|
|
|
21
|
-
|
|
|
22
|
-
|
|
|
23
|
-
|
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
15
|
+
| State animation | Official session activity → whale-girl animation: `thinking → running`, `tool → running-right`, `review → review`, `waiting → waiting`, `done → jumping`, `failed → failed` |
|
|
16
|
+
| Head-pat interaction | Click the whale-girl → bubble feedback + affinity +1 (10s cooldown) |
|
|
17
|
+
| Feeding | Hover panel "喂食" (Feed) → consumes 1 dried fish + affinity +5 (30s cooldown) |
|
|
18
|
+
| Treat economy | Dried-fish stock (cap 20): +1 every 3 rounds of work, +1 every 30 minutes; when low it prompts "多陪鲸鱼娘工作一会儿" (Work with the whale-girl a bit more) |
|
|
19
|
+
| Affinity | +1 per round completed; 4 levels: 幼鲸 (baby whale) → 伙伴 (companion) → 挚友 (close friend) → 深海羁绊 (deep-sea bond, capped at 100) |
|
|
20
|
+
| Custom naming | Hover panel "改名" (Rename) → 1–20 characters, persisted, echoed in the summon button/panel |
|
|
21
|
+
| Dragging | Hold and drag the whale-girl to reposition; position persisted |
|
|
22
|
+
| Hide/Summon | Hover panel "隐藏" (Hide); after hiding, a "召唤{name}" (Summon {name}) button appears in the input selector row |
|
|
23
|
+
| Status bubble | Shows the current session stage or tool name; transient interaction feedback temporarily takes priority |
|
|
24
|
+
| Multi-session activity | The pet is host-global: the most recent meaningful event controls its display, while completed turns from every session contribute affinity and treats |
|
|
25
|
+
|
|
26
|
+
## Animation preview
|
|
27
|
+
|
|
28
|
+
The sprites are an 8-column × 9-row atlas (192×208 cells) generated by the [hatch-pet](https://github.com/dsh2026) pipeline; below are previews of each state:
|
|
29
|
+
|
|
30
|
+
| idle | waiting | running | jumping |
|
|
30
31
|
|---|---|---|---|
|
|
31
32
|
|  |  |  |  |
|
|
32
33
|
|
|
33
|
-
| waving
|
|
34
|
+
| waving | review | failed | move left/right |
|
|
34
35
|
|---|---|---|---|
|
|
35
36
|
|  |  |  |   |
|
|
36
37
|
|
|
37
|
-
##
|
|
38
|
+
## Architecture
|
|
38
39
|
|
|
39
40
|
```
|
|
40
41
|
dsh-pet/
|
|
41
42
|
|-- src/
|
|
42
|
-
| |-- index.ts # host
|
|
43
|
-
| |-- service.ts # PetService
|
|
44
|
-
| |-- state.ts #
|
|
45
|
-
| |-- affinity.ts #
|
|
46
|
-
| |-- treats.ts #
|
|
47
|
-
| |-- persist.ts #
|
|
48
|
-
| |-- routes.ts # /api/pet/* JSON API + /pet/whale/*
|
|
49
|
-
| `-- client/ #
|
|
50
|
-
| |-- index.ts #
|
|
51
|
-
| |-- PetDockEntry.tsx #
|
|
52
|
-
| |-- WhalePet.tsx #
|
|
53
|
-
| |-- spritesheet.ts #
|
|
43
|
+
| |-- index.ts # host half: plugin entry (cordis apply, route registration)
|
|
44
|
+
| |-- service.ts # PetService: pet state machine + affinity + config (HTTP API service face)
|
|
45
|
+
| |-- state.ts # pet state machine: projected session activity → 9 state animations
|
|
46
|
+
| |-- affinity.ts # affinity ledger (pure functions + cooldowns)
|
|
47
|
+
| |-- treats.ts # dried-fish stock ledger
|
|
48
|
+
| |-- persist.ts # persistence ($DSH_HOME/pet.json, atomic write)
|
|
49
|
+
| |-- routes.ts # /api/pet/* JSON API + /pet/whale/* static asset routes
|
|
50
|
+
| `-- client/ # browser half
|
|
51
|
+
| |-- index.ts # global mount (createRoot → body) + polling (800ms) + interaction wiring (fetch)
|
|
52
|
+
| |-- PetDockEntry.tsx # global floating entry (document.body, always shown: no session / new session / mid-session)
|
|
53
|
+
| |-- WhalePet.tsx # floating component (portal + rAF frame animation + dragging)
|
|
54
|
+
| |-- spritesheet.ts # atlas geometry + per-state animation tracks (frames/duration)
|
|
54
55
|
| `-- pet.module.css
|
|
55
|
-
|-- assets/whale/ #
|
|
56
|
-
`-- cordis.patch.yml # bundle patch
|
|
56
|
+
|-- assets/whale/ # whale-girl assets (pet.json + spritesheet.webp + animation previews)
|
|
57
|
+
`-- cordis.patch.yml # bundle patch: inserts the pet plugin row
|
|
57
58
|
```
|
|
58
59
|
|
|
59
|
-
###
|
|
60
|
+
### Data flow
|
|
60
61
|
|
|
61
62
|
```
|
|
62
|
-
|
|
63
|
+
official session events (turn/step/chunk/tool) ----\
|
|
64
|
+
> PetService (host)
|
|
65
|
+
optional legacy activity/status ------------------/
|
|
63
66
|
| /api/pet/* JSON
|
|
64
|
-
global React root
|
|
67
|
+
global React root (createRoot → document.body) <-- polling 800ms -- pet-client (browser)
|
|
65
68
|
|
|
|
66
|
-
WhalePet
|
|
69
|
+
WhalePet floating layer (portal + rAF)
|
|
67
70
|
```
|
|
68
71
|
|
|
69
|
-
-
|
|
70
|
-
-
|
|
71
|
-
-
|
|
72
|
-
-
|
|
72
|
+
- **Status source**: the host projects official `turn/start`, `step/start`, `assistant/chunk`, `assistant/message`, `tool/call`, `tool/result`, and `turn/end` events into waiting/thinking/tool/review/done/failed states. Optional legacy `activity/status` events remain a compatibility input.
|
|
73
|
+
- **Multi-session semantics**: the API and browser mount are host-global and expose no foreground-session identity, so the most recent meaningful event wins the display. Every session's completed turns are still rewarded independently, and disposing a non-current session does not reset the visible state.
|
|
74
|
+
- **Mount point**: `document.body` (global React root, always shown: no session / new session / mid-session — the old mount point `conversation.composer.dock` only rendered in an active session, hiding the pet in new sessions); the component uses `createPortal` internally to render the global floating layer.
|
|
75
|
+
- **Rendering**: CSS sprite (background-position) per-frame animation, frame durations from the track definitions in `spritesheet.ts`.
|
|
76
|
+
- **Communication**: browser ↔ host over the same-origin `/api/pet/*` JSON endpoints (state/interact/set-visible/set-config); the atlas loads from `/pet/whale/spritesheet.webp` — both the RPC domain and the `/plugins/` static service are platform-registered, and the plugin self-sufficiently provides its own API and assets (the same pattern as dsh-remote-web-ui's `/api/pair`).
|
|
73
77
|
|
|
74
|
-
##
|
|
78
|
+
## Install
|
|
75
79
|
|
|
76
|
-
|
|
80
|
+
Install the family aggregate package `@linxin666/dsh-web-ui-all` (all plugins and skins in one) or this plugin alone:
|
|
77
81
|
|
|
78
82
|
```sh
|
|
79
|
-
|
|
83
|
+
### 从 npm 安装(推荐)
|
|
80
84
|
dsh plugin --profile web add @linxin666/dsh-pet
|
|
81
85
|
|
|
82
|
-
|
|
86
|
+
### 从仓库安装(开发调试)
|
|
83
87
|
git clone https://github.com/zhu1090093659/dsh-web-ui.git
|
|
84
88
|
cd dsh-web-ui
|
|
85
89
|
pnpm install && pnpm -r build
|
|
@@ -87,23 +91,24 @@ dsh plugin --profile web add link:$(pwd)/packages/dsh-pet
|
|
|
87
91
|
|
|
88
92
|
```
|
|
89
93
|
|
|
90
|
-
|
|
94
|
+
After installing, **restart `dsh web`** — the whale-girl appears at the bottom-right of the interface. In link mode, `pnpm build` and refresh the page after a code change; no reinstall needed.
|
|
91
95
|
|
|
92
|
-
##
|
|
96
|
+
## Development
|
|
93
97
|
|
|
94
98
|
```sh
|
|
95
|
-
pnpm build # tsc -b
|
|
96
|
-
pnpm test # vitest
|
|
97
|
-
pnpm prepare #
|
|
98
|
-
pnpm typecheck #
|
|
99
|
+
pnpm build # tsc -b (types+declarations) && tsdown (node half + browser bundle)
|
|
100
|
+
pnpm test # vitest unit/component tests (event projection / state / UI / ledgers)
|
|
101
|
+
pnpm prepare # transpile-only build (no type checking, for consumer installs)
|
|
102
|
+
pnpm typecheck # type check only
|
|
99
103
|
```
|
|
100
104
|
|
|
101
|
-
|
|
105
|
+
The browser bundle rides the `window.__ModuleLoader__.load` contract; React/cordis and so on resolve from the loader's module table (external); CSS Modules are inlined by lightningcss as `<style data-plugin>`.
|
|
102
106
|
|
|
103
|
-
##
|
|
107
|
+
## Sprites and animation-track calibration
|
|
104
108
|
|
|
105
|
-
|
|
109
|
+
The whale-girl atlas is generated by the hatch-pet pipeline as 9 states × 8 columns: `assets/whale/spritesheet.webp` (1536×1872, 8 columns × 9 rows of 192×208 cells) + `assets/whale/pet.json`. The actual frame count and rhythm of each row are defined in `TRACKS` in `src/client/spritesheet.ts`. If the artwork is redone and the frame count changes, only that table needs updating (row-order contract: 0 idle / 1 running-right / 2 running-left / 3 waving / 4 jumping / 5 failed / 6 waiting / 7 running / 8 review).
|
|
106
110
|
|
|
107
111
|
## License
|
|
108
112
|
|
|
109
113
|
[BSD-3-Clause](LICENSE)
|
|
114
|
+
|
package/README.zh.md
ADDED
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
# dsh-pet — 鲸鱼娘宠物插件
|
|
2
|
+
|
|
3
|
+
[English](README.md) | 中文
|
|
4
|
+
|
|
5
|
+
> 一只软萌治愈的鲸鱼娘,陪你在 DeepSeek Harness 里工作。
|
|
6
|
+
|
|
7
|
+
模型思考的时候你在等,她在游。她会跟随官方会话活动,在等待、思考、使用工具、整理回复、庆祝完成或报告失败时切换动画;你还可以摸头、喂小鱼干,看着她从幼鲸慢慢长成你的深海羁绊。
|
|
8
|
+
|
|
9
|
+
复刻自 Codex 桌面版的宠物功能,以 DSH 官方插件形态实现(cordis bundle:host 半区 + client 半区单包)。
|
|
10
|
+
|
|
11
|
+
## 功能
|
|
12
|
+
|
|
13
|
+
| 功能 | 说明 |
|
|
14
|
+
|---|---|
|
|
15
|
+
| 状态动画 | 官方会话活动 → 鲸鱼娘动画:`thinking → running`、`tool → running-right`、`review → review`、`waiting → waiting`、`done → jumping`、`failed → failed` |
|
|
16
|
+
| 摸头互动 | 点击鲸鱼娘 → 气泡反馈 + 亲密度 +1(10s 冷却) |
|
|
17
|
+
| 喂食 | 悬浮面板「喂食」→ 消耗 1 条小鱼干 + 亲密度 +5(30s 冷却) |
|
|
18
|
+
| 饲料经济 | 小鱼干库存(上限 20):工作每 3 回合 +1 条、每 30 分钟 +1 条;库存不足会提示「多陪鲸鱼娘工作一会儿」 |
|
|
19
|
+
| 亲密度 | 每完成一个回合 +1;4 个等级:幼鲸 → 伙伴 → 挚友 → 深海羁绊(100 点封顶) |
|
|
20
|
+
| 自定义命名 | 悬浮面板「改名」→ 1–20 字符,持久化,召唤按钮/面板同步显示 |
|
|
21
|
+
| 拖动 | 按住鲸鱼娘拖动重新摆放,位置持久化 |
|
|
22
|
+
| 隐藏/召唤 | 悬浮面板「隐藏」;隐藏后输入选择行出现「召唤{名字}」按钮 |
|
|
23
|
+
| 状态气泡 | 显示当前会话阶段或工具名;短暂的交互反馈会临时优先显示 |
|
|
24
|
+
| 多会话活动 | 宠物是 host 全局的:最近一条有效事件决定显示,所有会话的完成回合都会计入亲密度与小鱼干 |
|
|
25
|
+
|
|
26
|
+
## 动画演示
|
|
27
|
+
|
|
28
|
+
素材为 8 列 × 9 行图集(192×208 单元),由 [hatch-pet](https://github.com/dsh2026) 流水线生成,以下为各状态动画预览:
|
|
29
|
+
|
|
30
|
+
| idle 待机 | waiting 等待 | running 干活 | jumping 庆祝 |
|
|
31
|
+
|---|---|---|---|
|
|
32
|
+
|  |  |  |  |
|
|
33
|
+
|
|
34
|
+
| waving 挥手 | review 复盘 | failed 失败 | 左右移动 |
|
|
35
|
+
|---|---|---|---|
|
|
36
|
+
|  |  |  |   |
|
|
37
|
+
|
|
38
|
+
## 架构
|
|
39
|
+
|
|
40
|
+
```
|
|
41
|
+
dsh-pet/
|
|
42
|
+
|-- src/
|
|
43
|
+
| |-- index.ts # host 半区:插件入口(cordis apply,注册路由)
|
|
44
|
+
| |-- service.ts # PetService:宠物状态机 + 亲密度 + 配置(HTTP API 服务面)
|
|
45
|
+
| |-- state.ts # 宠物状态机:投影后的会话活动 → 9 状态动画
|
|
46
|
+
| |-- affinity.ts # 亲密度账本(纯函数 + 冷却)
|
|
47
|
+
| |-- treats.ts # 小鱼干库存账本
|
|
48
|
+
| |-- persist.ts # 持久化($DSH_HOME/pet.json,原子写入)
|
|
49
|
+
| |-- routes.ts # /api/pet/* JSON API + /pet/whale/* 素材静态路由
|
|
50
|
+
| `-- client/ # 浏览器半区
|
|
51
|
+
| |-- index.ts # 全局挂载(createRoot → body)+ 轮询(800ms)+ 交互接线(fetch)
|
|
52
|
+
| |-- PetDockEntry.tsx # 全局浮层入口(document.body,无会话/新会话/会话中全程显示)
|
|
53
|
+
| |-- WhalePet.tsx # 浮层组件(portal + rAF 帧动画 + 拖动)
|
|
54
|
+
| |-- spritesheet.ts # 图集几何 + 每状态动画轨道(帧/时长)
|
|
55
|
+
| `-- pet.module.css
|
|
56
|
+
|-- assets/whale/ # 鲸鱼娘素材(pet.json + spritesheet.webp + 动画预览)
|
|
57
|
+
`-- cordis.patch.yml # bundle patch:插入 pet 插件行
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
### 数据流
|
|
61
|
+
|
|
62
|
+
```
|
|
63
|
+
官方会话事件(turn/step/chunk/tool) ----\
|
|
64
|
+
> PetService(host)
|
|
65
|
+
可选的兼容事件 activity/status --------------/
|
|
66
|
+
| /api/pet/* JSON
|
|
67
|
+
global React root(createRoot → document.body) <-- 轮询 800ms -- pet-client(浏览器)
|
|
68
|
+
|
|
|
69
|
+
WhalePet 浮层(portal + rAF)
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
- **状态源**:host 将官方 `turn/start`、`step/start`、`assistant/chunk`、`assistant/message`、`tool/call`、`tool/result` 和 `turn/end` 事件投影为 waiting/thinking/tool/review/done/failed 状态。可选的旧版 `activity/status` 事件仍作为兼容输入。
|
|
73
|
+
- **多会话语义**:API 和浏览器挂载是 host 全局的,也不提供前台会话标识,因此最近一条有效事件决定显示。各会话的完成回合仍独立奖励,销毁非当前会话不会重置可见状态。
|
|
74
|
+
- **挂载点**:`document.body`(全局 React root,无会话/新会话/会话中全程显示——旧挂载点 `conversation.composer.dock` 只在活跃会话渲染,导致新会话界面看不到宠物),组件内部 `createPortal` 渲染全局浮层。
|
|
75
|
+
- **渲染**:CSS sprite(background-position)逐帧动画,帧时长来自 `spritesheet.ts` 的轨道定义。
|
|
76
|
+
- **通信**:浏览器 ↔ host 走同源 `/api/pet/*` JSON 端点(state/interact/set-visible/set-config),图集从 `/pet/whale/spritesheet.webp` 加载——RPC 域与 `/plugins/` 静态服务都是平台注册的,插件自足地提供自己的 API 与素材(与 dsh-remote-web-ui 的 `/api/pair` 同一模式)。
|
|
77
|
+
|
|
78
|
+
## 安装
|
|
79
|
+
|
|
80
|
+
推荐直接安装全家桶聚合包 `@linxin666/dsh-web-ui-all`(一个包装齐全部功能插件与皮肤),或单独安装本插件:
|
|
81
|
+
|
|
82
|
+
```sh
|
|
83
|
+
### 从 npm 安装(推荐)
|
|
84
|
+
dsh plugin --profile web add @linxin666/dsh-pet
|
|
85
|
+
|
|
86
|
+
### 从仓库安装(开发调试)
|
|
87
|
+
git clone https://github.com/zhu1090093659/dsh-web-ui.git
|
|
88
|
+
cd dsh-web-ui
|
|
89
|
+
pnpm install && pnpm -r build
|
|
90
|
+
dsh plugin --profile web add link:$(pwd)/packages/dsh-pet
|
|
91
|
+
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
安装后**重启 `dsh web`**,鲸鱼娘出现在界面右下角即生效。link 模式下改代码后重新 `pnpm build` 并刷新页面即可,无需重装。
|
|
95
|
+
|
|
96
|
+
## 开发
|
|
97
|
+
|
|
98
|
+
```sh
|
|
99
|
+
pnpm build # tsc -b(类型+声明)&& tsdown(node 半区 + 浏览器 bundle)
|
|
100
|
+
pnpm test # vitest 单元/组件测试(事件投影 / state / UI / 账本)
|
|
101
|
+
pnpm prepare # 仅转译构建(无类型检查,供消费者安装)
|
|
102
|
+
pnpm typecheck # 仅类型检查
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
浏览器 bundle 走 `window.__ModuleLoader__.load` 契约,React/cordis 等由 loader 模块表解析(external);CSS Modules 由 lightningcss 内联为 `<style data-plugin>`。
|
|
106
|
+
|
|
107
|
+
## 素材与动画轨道校准
|
|
108
|
+
|
|
109
|
+
鲸鱼娘图集由 hatch-pet 流水线按 9 状态 × 8 列生成:`assets/whale/spritesheet.webp`(1536×1872,8 列 × 9 行 192×208 单元)+ `assets/whale/pet.json`。每行实际帧数与节奏在 `src/client/spritesheet.ts` 的 `TRACKS` 中定义。若素材重做导致帧数变化,只需更新该表(行序契约:0 idle / 1 running-right / 2 running-left / 3 waving / 4 jumping / 5 failed / 6 waiting / 7 running / 8 review)。
|
|
110
|
+
|
|
111
|
+
## License
|
|
112
|
+
|
|
113
|
+
[BSD-3-Clause](LICENSE)
|
package/lib/client.js
CHANGED
|
@@ -304,8 +304,8 @@ window.__ModuleLoader__.load({
|
|
|
304
304
|
};
|
|
305
305
|
}
|
|
306
306
|
//#endregion
|
|
307
|
-
//#region \0dsh-css
|
|
308
|
-
const css$1 = ".
|
|
307
|
+
//#region \0dsh-css:packages/dsh-pet/src/client/pet.module.css.mjs
|
|
308
|
+
const css$1 = ".kz2Bea_float{pointer-events:auto;-webkit-user-select:none;user-select:none;flex-direction:column;align-items:center;display:flex;position:fixed}.kz2Bea_sprite{image-rendering:auto;touch-action:none;position:relative}.kz2Bea_bubble{white-space:nowrap;color:#fff;pointer-events:none;border-radius:999px;margin-bottom:6px;padding:4px 10px;font-size:12px;line-height:1.4;animation:2.6s ease-out forwards kz2Bea_pet-bubble-pop;position:absolute;bottom:100%;box-shadow:0 2px 8px #00000040}.kz2Bea_bubblePet{background:#f472b6eb}.kz2Bea_bubbleFeed{background:#38bdf8eb}.kz2Bea_bubbleStatus{text-overflow:ellipsis;background:#0f172ae6;border:1px solid #7dd3fc80;max-width:min(280px,100vw - 24px);animation:none;overflow:hidden}@keyframes kz2Bea_pet-bubble-pop{0%{opacity:0;transform:translateY(6px)scale(.85)}15%{opacity:1;transform:translateY(0)scale(1.05)}25%{transform:translateY(0)scale(1)}75%{opacity:1}to{opacity:0;transform:translateY(-8px)scale(.95)}}.kz2Bea_panel{color:#e2e8f0;backdrop-filter:blur(6px);background:#0f172aeb;border:1px solid #94a3b859;border-radius:10px;flex-direction:column;gap:6px;min-width:132px;padding:8px 10px;font-size:12px;display:flex;position:absolute;bottom:100%;box-shadow:0 4px 16px #00000059}.kz2Bea_panel:after{content:\"\";height:14px;position:absolute;top:100%;left:0;right:0}.kz2Bea_rankRow{white-space:nowrap;justify-content:space-between;gap:10px;display:flex}.kz2Bea_nameCell{font-weight:600}.kz2Bea_renameRow{align-items:center;gap:6px;display:flex}.kz2Bea_nameInput{color:#e2e8f0;background:#1e293be6;border:1px solid #7dd3fc80;border-radius:6px;outline:none;flex:1;min-width:0;padding:3px 6px;font-size:12px}.kz2Bea_nameInput:focus{border-color:#38bdf8;box-shadow:0 0 0 2px #38bdf873}.kz2Bea_actions{gap:6px;display:flex}.kz2Bea_action{cursor:pointer;color:#0f172a;background:linear-gradient(#7dd3fc,#38bdf8);border:none;border-radius:6px;flex:1;padding:4px 8px;font-size:12px;transition:filter .12s,box-shadow .12s}.kz2Bea_action:hover{filter:brightness(1.08)}.kz2Bea_action:active{filter:brightness(.94)}.kz2Bea_action:focus-visible{outline:none;box-shadow:0 0 0 2px #38bdf8d9}.kz2Bea_summon{color:#7dd3fc;cursor:pointer;background:#0f172abf;border:1px dashed #7dd3fc99;border-radius:999px;padding:2px 10px;font-size:11px;transition:border-color .12s,color .12s,background .12s,box-shadow .12s}.kz2Bea_summon:hover{color:#bae6fd;background:#0f172ae6;border-color:#7dd3fcf2}.kz2Bea_summon:active{color:#7dd3fc;border-color:#7dd3fccc}.kz2Bea_summon:focus-visible{outline:none;box-shadow:0 0 0 2px #38bdf8d9}@media (prefers-reduced-motion:reduce){.kz2Bea_bubble{opacity:1;animation:none}.kz2Bea_action,.kz2Bea_summon{transition:none}}";
|
|
309
309
|
const tagId$1 = "@linxin666/dsh-pet/pet.module.css";
|
|
310
310
|
if (typeof document !== "undefined" && document.querySelector("style[data-plugin-css=" + JSON.stringify(tagId$1) + "]") === null) {
|
|
311
311
|
const tag = document.createElement("style");
|
|
@@ -315,20 +315,21 @@ window.__ModuleLoader__.load({
|
|
|
315
315
|
document.head.appendChild(tag);
|
|
316
316
|
}
|
|
317
317
|
var pet_module_css_default = {
|
|
318
|
-
"action": "
|
|
319
|
-
"actions": "
|
|
320
|
-
"bubble": "
|
|
321
|
-
"bubbleFeed": "
|
|
322
|
-
"bubblePet": "
|
|
323
|
-
"
|
|
324
|
-
"
|
|
325
|
-
"
|
|
326
|
-
"
|
|
327
|
-
"
|
|
328
|
-
"
|
|
329
|
-
"
|
|
330
|
-
"
|
|
331
|
-
"
|
|
318
|
+
"action": "kz2Bea_action",
|
|
319
|
+
"actions": "kz2Bea_actions",
|
|
320
|
+
"bubble": "kz2Bea_bubble",
|
|
321
|
+
"bubbleFeed": "kz2Bea_bubbleFeed",
|
|
322
|
+
"bubblePet": "kz2Bea_bubblePet",
|
|
323
|
+
"bubbleStatus": "kz2Bea_bubbleStatus",
|
|
324
|
+
"float": "kz2Bea_float",
|
|
325
|
+
"nameCell": "kz2Bea_nameCell",
|
|
326
|
+
"nameInput": "kz2Bea_nameInput",
|
|
327
|
+
"panel": "kz2Bea_panel",
|
|
328
|
+
"pet-bubble-pop": "kz2Bea_pet-bubble-pop",
|
|
329
|
+
"rankRow": "kz2Bea_rankRow",
|
|
330
|
+
"renameRow": "kz2Bea_renameRow",
|
|
331
|
+
"sprite": "kz2Bea_sprite",
|
|
332
|
+
"summon": "kz2Bea_summon"
|
|
332
333
|
};
|
|
333
334
|
//#endregion
|
|
334
335
|
//#region src/client/WhalePet.tsx
|
|
@@ -487,6 +488,7 @@ window.__ModuleLoader__.load({
|
|
|
487
488
|
};
|
|
488
489
|
const spriteWidth = Math.round(192 * spriteScale);
|
|
489
490
|
const spriteHeight = Math.round(208 * spriteScale);
|
|
491
|
+
const statusBubble = feedback === null && !hovered ? snapshot?.bubble : void 0;
|
|
490
492
|
return (0, react_dom.createPortal)(/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
491
493
|
ref: floatRef,
|
|
492
494
|
className: pet_module_css_default.float,
|
|
@@ -532,6 +534,12 @@ window.__ModuleLoader__.load({
|
|
|
532
534
|
className: `${pet_module_css_default.bubble} ${feedback.kind === "feed" ? pet_module_css_default.bubbleFeed : pet_module_css_default.bubblePet}`,
|
|
533
535
|
children: feedback.text
|
|
534
536
|
}, feedback.at),
|
|
537
|
+
statusBubble !== void 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
538
|
+
className: `${pet_module_css_default.bubble} ${pet_module_css_default.bubbleStatus}`,
|
|
539
|
+
role: "status",
|
|
540
|
+
"aria-live": "polite",
|
|
541
|
+
children: statusBubble
|
|
542
|
+
}),
|
|
535
543
|
hovered && dragRef.current === null && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
536
544
|
className: pet_module_css_default.panel,
|
|
537
545
|
onPointerEnter: () => {
|
|
@@ -677,8 +685,8 @@ window.__ModuleLoader__.load({
|
|
|
677
685
|
});
|
|
678
686
|
}
|
|
679
687
|
//#endregion
|
|
680
|
-
//#region \0dsh-css
|
|
681
|
-
const css = ".
|
|
688
|
+
//#region \0dsh-css:packages/dsh-pet/src/client/settings-card.module.css.mjs
|
|
689
|
+
const css = ".kKk9aW_card{border:1px solid var(--dsw-alias-border-l2);background:var(--dsw-alias-bg-layer-3);border-radius:12px;list-style:none;transition:border-color .16s,background .16s}.kKk9aW_card:hover{border-color:var(--dsw-alias-label-dimmed)}.kKk9aW_cardOpen{background:var(--dsw-alias-bg-layer-2);border-color:var(--dsw-alias-label-dimmed)}.kKk9aW_header{appearance:none;width:100%;font:inherit;color:inherit;text-align:left;cursor:pointer;background:0 0;border:0;border-radius:12px;align-items:center;gap:12px;padding:14px 16px;display:flex}.kKk9aW_header:focus-visible{outline:2px solid var(--dsw-alias-brand-primary);outline-offset:-2px}.kKk9aW_headText{flex-direction:column;flex:1;gap:4px;min-width:0;display:flex}.kKk9aW_name{color:var(--dsw-alias-label-primary);font-size:15px;font-weight:600;line-height:1.4}.kKk9aW_description{color:var(--dsw-alias-label-tertiary);font-size:13px;line-height:1.5}.kKk9aW_pending{white-space:nowrap;background:var(--dsw-alias-bg-module-platform);color:var(--dsw-alias-label-secondary);border-radius:999px;flex:none;padding:1px 8px;font-size:11px;font-weight:500;line-height:17px}.kKk9aW_chevron{color:var(--dsw-alias-label-tertiary);flex:none;transition:transform .16s}.kKk9aW_chevronOpen{transform:rotate(180deg)}.kKk9aW_body{border-top:1px solid var(--dsw-alias-border-l2);margin:0 16px;padding-bottom:8px}.kKk9aW_readOnly{color:var(--dsw-alias-label-tertiary);margin:12px 0 0;font-size:12px;line-height:1.5}.kKk9aW_notExposed{color:var(--dsw-alias-state-warn-primary);margin:12px 0 0;font-size:12px;line-height:1.5}.kKk9aW_footer{border-top:1px solid var(--dsw-alias-border-l2);justify-content:flex-end;align-items:center;gap:8px;padding:12px 0 4px;display:flex}.kKk9aW_failed{min-width:0;color:var(--dsw-alias-label-error);flex:1;margin:0;font-size:12px;line-height:1.5}.kKk9aW_discard,.kKk9aW_save{appearance:none;font:inherit;cursor:pointer;border:1px solid #0000;border-radius:8px;padding:5px 14px;font-size:13px;line-height:1.5}.kKk9aW_discard{border-color:var(--dsw-alias-border-l2);color:var(--dsw-alias-label-secondary);background:0 0}.kKk9aW_discard:hover:not(:disabled){color:var(--dsw-alias-label-primary);border-color:var(--dsw-alias-label-dimmed)}.kKk9aW_save{background:var(--dsw-alias-label-primary);color:var(--dsw-alias-bg-layer-3)}.kKk9aW_discard:disabled,.kKk9aW_save:disabled{opacity:.4;cursor:default}.kKk9aW_discard:focus-visible,.kKk9aW_save:focus-visible{outline:2px solid var(--dsw-alias-brand-primary);outline-offset:1px}.kKk9aW_field{flex-direction:column;gap:6px;padding:12px 0;display:flex}.kKk9aW_field+.kKk9aW_field{border-top:1px solid var(--dsw-alias-border-l2)}.kKk9aW_head{align-items:center;gap:8px;display:flex}.kKk9aW_label{min-width:0;color:var(--dsw-alias-label-primary);flex:1;font-size:13px;font-weight:500;line-height:1.5}.kKk9aW_badges{align-items:center;gap:8px;display:inline-flex}.kKk9aW_badge{white-space:nowrap;background:var(--dsw-alias-bg-module-platform);color:var(--dsw-alias-label-secondary);border-radius:999px;padding:1px 8px;font-size:11px;font-weight:500;line-height:17px}.kKk9aW_reset{font:inherit;color:var(--dsw-alias-label-secondary);cursor:pointer;background:0 0;border:none;padding:0;font-size:12px;line-height:1.5}.kKk9aW_reset:hover:not(:disabled){color:var(--dsw-alias-label-primary)}.kKk9aW_reset:disabled{cursor:default}.kKk9aW_reset:focus-visible{outline:2px solid var(--dsw-alias-brand-primary);outline-offset:2px}.kKk9aW_input,.kKk9aW_select{border:1px solid var(--dsw-alias-border-l2);background:var(--dsw-alias-bg-layer-3);height:34px;font:inherit;color:var(--dsw-alias-label-primary);border-radius:8px;padding:0 12px;font-size:13px;line-height:1.5}.kKk9aW_input:focus-visible,.kKk9aW_select:focus-visible{border-color:var(--dsw-alias-brand-primary);outline:none}.kKk9aW_input:disabled,.kKk9aW_select:disabled{color:var(--dsw-alias-label-tertiary);cursor:default}.kKk9aW_inputInvalid{border:1px solid var(--dsw-alias-label-error);background:var(--dsw-alias-bg-layer-3);height:34px;font:inherit;color:var(--dsw-alias-label-primary);border-radius:8px;padding:0 12px;font-size:13px;line-height:1.5}.kKk9aW_inputInvalid:focus-visible{outline:2px solid var(--dsw-alias-label-error);outline-offset:1px;border-color:var(--dsw-alias-label-error)}.kKk9aW_invalid{color:var(--dsw-alias-label-error);margin:0;font-size:12px;line-height:1.5}.kKk9aW_hint{color:var(--dsw-alias-label-tertiary);margin:0;font-size:12px;line-height:1.5}@media (prefers-reduced-motion:reduce){.kKk9aW_card,.kKk9aW_header,.kKk9aW_chevron,.kKk9aW_chevronOpen,.kKk9aW_discard,.kKk9aW_save{transition:none}}";
|
|
682
690
|
const tagId = "@linxin666/dsh-pet/settings-card.module.css";
|
|
683
691
|
if (typeof document !== "undefined" && document.querySelector("style[data-plugin-css=" + JSON.stringify(tagId) + "]") === null) {
|
|
684
692
|
const tag = document.createElement("style");
|
|
@@ -688,33 +696,33 @@ window.__ModuleLoader__.load({
|
|
|
688
696
|
document.head.appendChild(tag);
|
|
689
697
|
}
|
|
690
698
|
var settings_card_module_css_default = {
|
|
691
|
-
"badge": "
|
|
692
|
-
"badges": "
|
|
693
|
-
"body": "
|
|
694
|
-
"card": "
|
|
695
|
-
"cardOpen": "
|
|
696
|
-
"chevron": "
|
|
697
|
-
"chevronOpen": "
|
|
698
|
-
"description": "
|
|
699
|
-
"discard": "
|
|
700
|
-
"failed": "
|
|
701
|
-
"field": "
|
|
702
|
-
"footer": "
|
|
703
|
-
"head": "
|
|
704
|
-
"headText": "
|
|
705
|
-
"header": "
|
|
706
|
-
"hint": "
|
|
707
|
-
"input": "
|
|
708
|
-
"inputInvalid": "
|
|
709
|
-
"invalid": "
|
|
710
|
-
"label": "
|
|
711
|
-
"name": "
|
|
712
|
-
"notExposed": "
|
|
713
|
-
"pending": "
|
|
714
|
-
"readOnly": "
|
|
715
|
-
"reset": "
|
|
716
|
-
"save": "
|
|
717
|
-
"select": "
|
|
699
|
+
"badge": "kKk9aW_badge",
|
|
700
|
+
"badges": "kKk9aW_badges",
|
|
701
|
+
"body": "kKk9aW_body",
|
|
702
|
+
"card": "kKk9aW_card",
|
|
703
|
+
"cardOpen": "kKk9aW_cardOpen",
|
|
704
|
+
"chevron": "kKk9aW_chevron",
|
|
705
|
+
"chevronOpen": "kKk9aW_chevronOpen",
|
|
706
|
+
"description": "kKk9aW_description",
|
|
707
|
+
"discard": "kKk9aW_discard",
|
|
708
|
+
"failed": "kKk9aW_failed",
|
|
709
|
+
"field": "kKk9aW_field",
|
|
710
|
+
"footer": "kKk9aW_footer",
|
|
711
|
+
"head": "kKk9aW_head",
|
|
712
|
+
"headText": "kKk9aW_headText",
|
|
713
|
+
"header": "kKk9aW_header",
|
|
714
|
+
"hint": "kKk9aW_hint",
|
|
715
|
+
"input": "kKk9aW_input",
|
|
716
|
+
"inputInvalid": "kKk9aW_inputInvalid",
|
|
717
|
+
"invalid": "kKk9aW_invalid",
|
|
718
|
+
"label": "kKk9aW_label",
|
|
719
|
+
"name": "kKk9aW_name",
|
|
720
|
+
"notExposed": "kKk9aW_notExposed",
|
|
721
|
+
"pending": "kKk9aW_pending",
|
|
722
|
+
"readOnly": "kKk9aW_readOnly",
|
|
723
|
+
"reset": "kKk9aW_reset",
|
|
724
|
+
"save": "kKk9aW_save",
|
|
725
|
+
"select": "kKk9aW_select"
|
|
718
726
|
};
|
|
719
727
|
//#endregion
|
|
720
728
|
//#region src/client/PluginSettingsCard.tsx
|
|
@@ -737,8 +745,9 @@ window.__ModuleLoader__.load({
|
|
|
737
745
|
if (!state.available) return null;
|
|
738
746
|
const title = props.t(props.titleKey);
|
|
739
747
|
const blocked = !state.dirty || state.invalid || state.saving;
|
|
748
|
+
const cardClass = open ? `${settings_card_module_css_default.cardOpen} ${settings_card_module_css_default.card}` : settings_card_module_css_default.card;
|
|
740
749
|
if (!state.exposed) return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("li", {
|
|
741
|
-
className:
|
|
750
|
+
className: cardClass,
|
|
742
751
|
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("button", {
|
|
743
752
|
type: "button",
|
|
744
753
|
className: settings_card_module_css_default.header,
|
|
@@ -756,9 +765,17 @@ window.__ModuleLoader__.load({
|
|
|
756
765
|
className: settings_card_module_css_default.description,
|
|
757
766
|
children: props.t(props.descriptionKey)
|
|
758
767
|
})]
|
|
759
|
-
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("
|
|
760
|
-
|
|
761
|
-
|
|
768
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("svg", {
|
|
769
|
+
width: "14",
|
|
770
|
+
height: "14",
|
|
771
|
+
viewBox: "0 0 14 14",
|
|
772
|
+
fill: "none",
|
|
773
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
774
|
+
className: open ? `${settings_card_module_css_default.chevron} ${settings_card_module_css_default.chevronOpen}` : settings_card_module_css_default.chevron,
|
|
775
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", {
|
|
776
|
+
d: "M11.8486 5.5L11.4238 5.92383L8.69727 8.65137C8.44157 8.90706 8.21562 9.13382 8.01172 9.29785C7.79912 9.46883 7.55595 9.61756 7.25 9.66602C7.08435 9.69222 6.91565 9.69222 6.75 9.66602C6.44405 9.61756 6.20088 9.46883 5.98828 9.29785C5.78438 9.13382 5.55843 8.90706 5.30273 8.65137L2.57617 5.92383L2.15137 5.5L3 4.65137L3.42383 5.07617L6.15137 7.80273C6.42595 8.07732 6.59876 8.24849 6.74023 8.3623C6.87291 8.46904 6.92272 8.47813 6.9375 8.48047C6.97895 8.48703 7.02105 8.48703 7.0625 8.48047C7.07728 8.47813 7.12709 8.46904 7.25977 8.3623C7.40124 8.24849 7.57405 8.07732 7.84863 7.80273L10.5762 5.07617L11 4.65137L11.8486 5.5Z",
|
|
777
|
+
fill: "currentColor"
|
|
778
|
+
})
|
|
762
779
|
})]
|
|
763
780
|
}), open ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
764
781
|
className: settings_card_module_css_default.body,
|
|
@@ -770,7 +787,7 @@ window.__ModuleLoader__.load({
|
|
|
770
787
|
}) : null]
|
|
771
788
|
});
|
|
772
789
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("li", {
|
|
773
|
-
className:
|
|
790
|
+
className: cardClass,
|
|
774
791
|
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("button", {
|
|
775
792
|
type: "button",
|
|
776
793
|
className: settings_card_module_css_default.header,
|
|
@@ -794,9 +811,17 @@ window.__ModuleLoader__.load({
|
|
|
794
811
|
className: settings_card_module_css_default.pending,
|
|
795
812
|
children: props.t("settings.unsaved")
|
|
796
813
|
}) : null,
|
|
797
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("
|
|
798
|
-
|
|
799
|
-
|
|
814
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("svg", {
|
|
815
|
+
width: "14",
|
|
816
|
+
height: "14",
|
|
817
|
+
viewBox: "0 0 14 14",
|
|
818
|
+
fill: "none",
|
|
819
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
820
|
+
className: open ? `${settings_card_module_css_default.chevron} ${settings_card_module_css_default.chevronOpen}` : settings_card_module_css_default.chevron,
|
|
821
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", {
|
|
822
|
+
d: "M11.8486 5.5L11.4238 5.92383L8.69727 8.65137C8.44157 8.90706 8.21562 9.13382 8.01172 9.29785C7.79912 9.46883 7.55595 9.61756 7.25 9.66602C7.08435 9.69222 6.91565 9.69222 6.75 9.66602C6.44405 9.61756 6.20088 9.46883 5.98828 9.29785C5.78438 9.13382 5.55843 8.90706 5.30273 8.65137L2.57617 5.92383L2.15137 5.5L3 4.65137L3.42383 5.07617L6.15137 7.80273C6.42595 8.07732 6.59876 8.24849 6.74023 8.3623C6.87291 8.46904 6.92272 8.47813 6.9375 8.48047C6.97895 8.48703 7.02105 8.48703 7.0625 8.48047C7.07728 8.47813 7.12709 8.46904 7.25977 8.3623C7.40124 8.24849 7.57405 8.07732 7.84863 7.80273L10.5762 5.07617L11 4.65137L11.8486 5.5Z",
|
|
823
|
+
fill: "currentColor"
|
|
824
|
+
})
|
|
800
825
|
})
|
|
801
826
|
]
|
|
802
827
|
}), open ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|