dsh-plugin-easedraw 0.2.0 → 0.2.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/README.md CHANGED
@@ -1,11 +1,12 @@
1
1
  # 逸刻 EaseDraw · DeepSeek Harness 专注插件
2
2
 
3
- 将提供的 EaseDraw 小工具 v1.0.1 的 **84 幅画作**接入 DSH 专注场景。支持分类与画名/画家搜索、5/15/25/45 分钟计时、暂停与继续、提前结束、完成记录。没有邀请码、登录、会员、支付或入睡流程。
3
+ 将提供的 EaseDraw 小工具 v1.0.1 的 **84 幅画作**接入 DSH 专注场景。支持分类与画名/画家搜索、5–120 分钟(每 1 分钟一档)计时、任务备注、暂停与继续、提前结束、完成记录。没有邀请码、登录、会员、支付或入睡流程。
4
4
 
5
5
  ## 当前状态
6
6
 
7
- - 此版本是 **84 幅画的专注插件**,不是原小工具其他功能的完整移植:展厅是本地完成记录列表;没有盖印图片导出、背景音乐、提醒或云同步。
8
- - 在 DSH `0.2.2-rc.5` Web 测试环境验证了本地安装、输入区入口、分类/搜索、选画、开始/暂停/继续/结束,以及 168 个插件内画作资源可访问。Mac 桌面版和其他 DSH 版本尚未实测。`engines.dsh` 声明 `>=0.2.2-rc.5 <0.3.0` 作为安装边界,不表示其中每个版本都通过测试。
7
+ - 此版本是 **84 幅画的专注插件**,不是原小工具其他功能的完整移植:展厅是本地完成记录列表;没有原版长按盖印、分心记录、未完成画作续画、完整展厅、提醒或云同步。
8
+ - 在 DSH `0.2.2-rc.5` Web 测试环境验证了本地安装、右侧工具入口、分类/搜索、选画、开始/暂停/继续/结束,以及插件内画作资源可访问。Mac 桌面版和其他 DSH 版本尚未实测。`engines.dsh` 声明 `>=0.2.2-rc.5 <0.3.0` 作为安装边界,不表示其中每个版本都通过测试。
9
+ - 复用原版四种本地合成环境声(雨、林间、炉火、海浪)、静音、交互音和完成提示音;音频须由用户操作触发,重开后播放声音需要再次点击。关闭插件标签后音频停止。
9
10
  - 时间戳计时:运行中睡眠计入、暂停不计入。系统时钟变动可能影响计时;应用退出时不保证准点提醒。
10
11
  - 存储在客户端的 `localStorage`,不自动同步;清理本地数据会丢失记录。如读取损坏,插件停止写入以保护原数据;应先备份数据。
11
12
  - WebGL 不可用时退回 Canvas 2D 绘制;资源加载失败时退回简单图片揭示,视觉效果会不同。画作资源由 DSH 本地插件资产路由提供,插件不调用远程画作服务。
@@ -17,9 +18,11 @@
17
18
 
18
19
  1. 在 DSH 登录并选择工作目录,点击左侧 **Plugins**,找到 **添加插件 / Add plugin**。
19
20
  2. 在插件名称或安装来源中输入:`dsh-plugin-easedraw`,确认来源为发布该包的 npm 源,然后安装并启用。
20
- 3. 重启 DSH,在选定工作目录的会话输入区找到 **逸刻 · 专注**。选择画作和时长即可开始。
21
+ 3. 重启 DSH,打开一个工作区会话。点击右上角的 **打开右侧栏**,在工具列表中选择 **逸刻 · 专注**。如果右侧栏已有其他标签,点击其上方 **+** 打开工具列表。选择画作和时长即可开始。
21
22
  4. 如果不能安装,请确认 DSH 的准确版本和所选注册表;安装包要求 `>=0.2.2-rc.5 <0.3.0`。DSH 预览版界面和 API 可能变化。
22
23
 
24
+ 旧版升级:DSH 插件管理器对非官方插件通常需要先卸载再以相同名称安装。记录保存在 DSH 客户端本地存储,更新前请备份;不要清理应用数据或更换环境。
25
+
23
26
  DSH 官网说明 bundle 按包名安装的机制:https://deepseek-harness.github.io/deepseek-harness/en/develop/basic/publish
24
27
 
25
28
  ## 发布者操作:发布到 npm
@@ -30,7 +33,7 @@ DSH 官网说明 bundle 按包名安装的机制:https://deepseek-harness.gith
30
33
  npm run build
31
34
  npm test
32
35
  npm pack --dry-run
33
- npm view dsh-plugin-easedraw version # 如果已存在,不要覆盖别人的包
36
+ npm view dsh-plugin-easedraw version # 确认发布目标和现有版本
34
37
  npm login
35
38
  npm publish --access public
36
39
  npm view dsh-plugin-easedraw version # 确认发布成功
@@ -40,10 +43,10 @@ npm view dsh-plugin-easedraw version # 确认发布成功
40
43
 
41
44
  ## 先用文件安装(不发布时)
42
45
 
43
- DSH 插件管理器若提供添加本地压缩包,输入 `dsh-plugin-easedraw-0.2.0.tgz` 的绝对路径;这是测试方法,不等于按名称安装。另一种测试是在独立 DSH Web profile 安装:
46
+ DSH 插件管理器若提供添加本地压缩包,输入 `dsh-plugin-easedraw-0.2.1.tgz` 的绝对路径;这是测试方法,不等于按名称安装。另一种测试是在独立 DSH Web profile 安装:
44
47
 
45
48
  ```sh
46
- dsh plugin --profile web add /绝对路径/dsh-plugin-easedraw-0.2.0.tgz
49
+ dsh plugin --profile web add /绝对路径/dsh-plugin-easedraw-0.2.1.tgz
47
50
  dsh --profile web --dump-config
48
51
  dsh web
49
52
  ```
@@ -60,8 +63,8 @@ npm test
60
63
  npm pack
61
64
  ```
62
65
 
63
- - `assets/paintings.json` 和 `assets/<id>/`:84 幅作品元数据、两张 WebP 画作渲染资源。
64
- - `src/original-painter.js`:从提供的离线包提取的绘制引擎;`src/focus-timer.js`:计时状态机;`src/client-body.js`:DSH 界面和本地持久化。
66
+ - `assets/paintings.json` 和 `assets/<id>/`:84 幅作品元数据、两张 WebP 画作渲染资源;`assets/ui/`:原版墙面、印章和环境声图标素材。
67
+ - `src/original-painter.js`、`src/original-synth.js`:从提供的离线包提取的绘制和声音合成引擎;`src/audio.js`:DSH 音频适配;`src/focus-timer.js`:计时状态机;`src/client-body.js`:DSH 右侧工具界面和本地持久化。
65
68
  - `tools/build.mjs`:构建 `client.js` 及 DSH 规范的内容哈希资源 `lib/assets/`;源码素材修改后需要重新构建。
66
69
  - `cordis.patch.yml`、`package.json`、`index.js`:DSH bundle 配置。
67
70
  - `test/`:计时与 84 幅素材完整性测试。
package/client.js CHANGED
@@ -7,6 +7,7 @@ window.__ModuleLoader__.load({
7
7
  const AT = {"milkmaid":[517,580,258,290],"waterlilies":[558,537,279,268],"pearl":[503,596,252,298],"starry":[616,487,308,244],"wheat":[640,380,320,190],"whistler":[640,424,320,212],"rhone":[623,481,312,240],"lacemaker":[511,587,256,294],"cafe":[491,611,246,306],"letter":[500,600,250,300],"balance":[515,582,258,291],"moonrise":[500,600,250,300],"twomen":[612,490,306,245],"pitcher":[516,581,258,290],"seamoon":[626,479,313,240],"astronomer":[514,583,257,292],"geographer":[517,580,258,290],"milletstars":[611,491,306,246],"delft":[601,499,300,250],"vgmoon":[618,485,309,242],"street":[492,610,246,305],"grimshaw":[640,428,320,214],"thames":[640,380,320,190],"hammershoi":[505,594,252,297],"dnieper":[640,464,320,232],"strandgade":[586,512,293,256],"dehooch":[501,599,250,300],"aivazovsky":[625,480,312,240],"bubbles":[557,538,278,269],"fishermen":[635,472,318,236],"jatte":[640,426,320,213],"kanbara":[640,414,320,207],"parasol":[492,610,246,305],"saruwaka":[414,640,207,320],"boating":[636,471,318,236],"fireworks":[414,640,207,320],"larsson":[640,418,320,209],"wheatsnow":[640,448,320,224],"sorolla":[544,551,272,276],"seinemist":[556,539,278,270],"cypress":[617,486,308,243],"bluesilver":[605,496,302,248],"charing":[610,492,305,246],"impression":[622,482,311,241],"heron":[640,420,320,210],"sadresse":[640,468,320,234],"bridge":[489,614,244,307],"parliament":[582,515,291,258],"rainyparis":[630,476,315,238],"sangiorgio":[640,454,320,227],"angelus":[601,499,300,250],"haywain":[640,442,320,221],"cezanne":[640,464,320,232],"levitan":[612,490,306,245],"lark":[481,623,240,312],"klimt":[552,543,276,272],"fsunset":[640,460,320,230],"poppies":[627,478,314,239],"irises":[623,481,312,240],"bierstadt":[640,440,320,220],"almond":[616,487,308,244],"bedroom":[618,485,309,242],"hammermoon":[612,490,306,245],"sunflowers":[486,617,243,308],"gypsy":[640,408,320,204],"redfuji":[640,434,320,217],"wave":[640,430,320,215],"flaming":[548,548,274,274],"ejiri":[640,458,320,229],"rosebower":[640,334,320,167],"moore":[640,372,320,186],"shower":[432,640,216,320],"pourville-cliff":[640,513,320,256],"poets-garden":[640,508,320,254],"argenteuil-house":[640,523,320,262],"eragny-haymaking":[640,513,320,256],"pontoise-snow":[640,521,320,260],"inokashira-snow":[640,414,320,207],"mishima-mist":[640,425,320,212],"clichy-spring":[640,534,320,267],"monet-bordighera":[640,515,320,258],"monet-apples-grapes":[640,512,320,256],"catherine-lee":[640,427,320,214],"window-five-minutes":[512,640,256,320]};
8
8
  const PATHS = {"milkmaid":{"x":"plugins/dsh-plugin-easedraw/assets/milkmaid/x-72a1b83fb07a.webp","c":"plugins/dsh-plugin-easedraw/assets/milkmaid/c-07ed2a14ee90.webp"},"waterlilies":{"x":"plugins/dsh-plugin-easedraw/assets/waterlilies/x-7ff96f8e6e08.webp","c":"plugins/dsh-plugin-easedraw/assets/waterlilies/c-854ad106fb4f.webp"},"pearl":{"x":"plugins/dsh-plugin-easedraw/assets/pearl/x-6b92370f652e.webp","c":"plugins/dsh-plugin-easedraw/assets/pearl/c-abee4a5932f9.webp"},"starry":{"x":"plugins/dsh-plugin-easedraw/assets/starry/x-d3624b895b6b.webp","c":"plugins/dsh-plugin-easedraw/assets/starry/c-7b73287af9dc.webp"},"wheat":{"x":"plugins/dsh-plugin-easedraw/assets/wheat/x-02bc298cfd7d.webp","c":"plugins/dsh-plugin-easedraw/assets/wheat/c-e87855afd7ba.webp"},"whistler":{"x":"plugins/dsh-plugin-easedraw/assets/whistler/x-f40a7c447b9d.webp","c":"plugins/dsh-plugin-easedraw/assets/whistler/c-64564ba4b30b.webp"},"rhone":{"x":"plugins/dsh-plugin-easedraw/assets/rhone/x-34d5512b3405.webp","c":"plugins/dsh-plugin-easedraw/assets/rhone/c-a9bb3282640f.webp"},"lacemaker":{"x":"plugins/dsh-plugin-easedraw/assets/lacemaker/x-1084932117e2.webp","c":"plugins/dsh-plugin-easedraw/assets/lacemaker/c-d15464271e1a.webp"},"cafe":{"x":"plugins/dsh-plugin-easedraw/assets/cafe/x-0705e4014144.webp","c":"plugins/dsh-plugin-easedraw/assets/cafe/c-594b323da5f9.webp"},"letter":{"x":"plugins/dsh-plugin-easedraw/assets/letter/x-52405463942a.webp","c":"plugins/dsh-plugin-easedraw/assets/letter/c-06e993082905.webp"},"balance":{"x":"plugins/dsh-plugin-easedraw/assets/balance/x-6961a5000855.webp","c":"plugins/dsh-plugin-easedraw/assets/balance/c-07ca61769054.webp"},"moonrise":{"x":"plugins/dsh-plugin-easedraw/assets/moonrise/x-1965abb8b096.webp","c":"plugins/dsh-plugin-easedraw/assets/moonrise/c-ae854bb3b4c8.webp"},"twomen":{"x":"plugins/dsh-plugin-easedraw/assets/twomen/x-0eb1d8912eaf.webp","c":"plugins/dsh-plugin-easedraw/assets/twomen/c-e167d579e51c.webp"},"pitcher":{"x":"plugins/dsh-plugin-easedraw/assets/pitcher/x-19d09121eeaa.webp","c":"plugins/dsh-plugin-easedraw/assets/pitcher/c-a138768110d9.webp"},"seamoon":{"x":"plugins/dsh-plugin-easedraw/assets/seamoon/x-fa06162d5b4a.webp","c":"plugins/dsh-plugin-easedraw/assets/seamoon/c-1fbcf27ee01b.webp"},"astronomer":{"x":"plugins/dsh-plugin-easedraw/assets/astronomer/x-6ecac9f04faf.webp","c":"plugins/dsh-plugin-easedraw/assets/astronomer/c-d06c4268a610.webp"},"geographer":{"x":"plugins/dsh-plugin-easedraw/assets/geographer/x-bdfde18bbbcc.webp","c":"plugins/dsh-plugin-easedraw/assets/geographer/c-d075b3640af6.webp"},"milletstars":{"x":"plugins/dsh-plugin-easedraw/assets/milletstars/x-41be4f4187a6.webp","c":"plugins/dsh-plugin-easedraw/assets/milletstars/c-229791e2b82e.webp"},"delft":{"x":"plugins/dsh-plugin-easedraw/assets/delft/x-48ed7ad9a35c.webp","c":"plugins/dsh-plugin-easedraw/assets/delft/c-cba6b32de2a4.webp"},"vgmoon":{"x":"plugins/dsh-plugin-easedraw/assets/vgmoon/x-2ebbd03a5376.webp","c":"plugins/dsh-plugin-easedraw/assets/vgmoon/c-5a5b29fef873.webp"},"street":{"x":"plugins/dsh-plugin-easedraw/assets/street/x-ce3fd5752baf.webp","c":"plugins/dsh-plugin-easedraw/assets/street/c-60d38251bfcd.webp"},"grimshaw":{"x":"plugins/dsh-plugin-easedraw/assets/grimshaw/x-0f04bc8728c0.webp","c":"plugins/dsh-plugin-easedraw/assets/grimshaw/c-4ff53f0751c0.webp"},"thames":{"x":"plugins/dsh-plugin-easedraw/assets/thames/x-fce36a81b310.webp","c":"plugins/dsh-plugin-easedraw/assets/thames/c-8627d264d156.webp"},"hammershoi":{"x":"plugins/dsh-plugin-easedraw/assets/hammershoi/x-e0702def9b7a.webp","c":"plugins/dsh-plugin-easedraw/assets/hammershoi/c-73cc375407c6.webp"},"dnieper":{"x":"plugins/dsh-plugin-easedraw/assets/dnieper/x-f32d57da7255.webp","c":"plugins/dsh-plugin-easedraw/assets/dnieper/c-3e59ae20e889.webp"},"strandgade":{"x":"plugins/dsh-plugin-easedraw/assets/strandgade/x-265d002db736.webp","c":"plugins/dsh-plugin-easedraw/assets/strandgade/c-1161cdeb8d8e.webp"},"dehooch":{"x":"plugins/dsh-plugin-easedraw/assets/dehooch/x-0949786c8346.webp","c":"plugins/dsh-plugin-easedraw/assets/dehooch/c-22fe1b466f8a.webp"},"aivazovsky":{"x":"plugins/dsh-plugin-easedraw/assets/aivazovsky/x-23506ec34e70.webp","c":"plugins/dsh-plugin-easedraw/assets/aivazovsky/c-74ece4a4aaa8.webp"},"bubbles":{"x":"plugins/dsh-plugin-easedraw/assets/bubbles/x-eb4abd54573e.webp","c":"plugins/dsh-plugin-easedraw/assets/bubbles/c-199a5a79e13f.webp"},"fishermen":{"x":"plugins/dsh-plugin-easedraw/assets/fishermen/x-3aae68790b33.webp","c":"plugins/dsh-plugin-easedraw/assets/fishermen/c-c01429f1c6f3.webp"},"jatte":{"x":"plugins/dsh-plugin-easedraw/assets/jatte/x-02b5d3acc209.webp","c":"plugins/dsh-plugin-easedraw/assets/jatte/c-da189910cd88.webp"},"kanbara":{"x":"plugins/dsh-plugin-easedraw/assets/kanbara/x-23f4c7227d6b.webp","c":"plugins/dsh-plugin-easedraw/assets/kanbara/c-6f4cc1f35a57.webp"},"parasol":{"x":"plugins/dsh-plugin-easedraw/assets/parasol/x-7a23fd01514f.webp","c":"plugins/dsh-plugin-easedraw/assets/parasol/c-15cc5372d478.webp"},"saruwaka":{"x":"plugins/dsh-plugin-easedraw/assets/saruwaka/x-b454a7e3f528.webp","c":"plugins/dsh-plugin-easedraw/assets/saruwaka/c-5331f4f975ba.webp"},"boating":{"x":"plugins/dsh-plugin-easedraw/assets/boating/x-c4c651de7d8a.webp","c":"plugins/dsh-plugin-easedraw/assets/boating/c-17ad717b9290.webp"},"fireworks":{"x":"plugins/dsh-plugin-easedraw/assets/fireworks/x-be3ba365cb81.webp","c":"plugins/dsh-plugin-easedraw/assets/fireworks/c-34cab4e56893.webp"},"larsson":{"x":"plugins/dsh-plugin-easedraw/assets/larsson/x-9951665abec5.webp","c":"plugins/dsh-plugin-easedraw/assets/larsson/c-83b155d44a6c.webp"},"wheatsnow":{"x":"plugins/dsh-plugin-easedraw/assets/wheatsnow/x-f9873517dc8c.webp","c":"plugins/dsh-plugin-easedraw/assets/wheatsnow/c-6a4d554c47db.webp"},"sorolla":{"x":"plugins/dsh-plugin-easedraw/assets/sorolla/x-233b4695f37b.webp","c":"plugins/dsh-plugin-easedraw/assets/sorolla/c-9bcc8b60a8d3.webp"},"seinemist":{"x":"plugins/dsh-plugin-easedraw/assets/seinemist/x-ffdde3be1a98.webp","c":"plugins/dsh-plugin-easedraw/assets/seinemist/c-d2739efee314.webp"},"cypress":{"x":"plugins/dsh-plugin-easedraw/assets/cypress/x-9a1ddc1cc3df.webp","c":"plugins/dsh-plugin-easedraw/assets/cypress/c-ba18c825acd3.webp"},"bluesilver":{"x":"plugins/dsh-plugin-easedraw/assets/bluesilver/x-1f0e749cdc74.webp","c":"plugins/dsh-plugin-easedraw/assets/bluesilver/c-63ba9cef7c06.webp"},"charing":{"x":"plugins/dsh-plugin-easedraw/assets/charing/x-120507fd6d06.webp","c":"plugins/dsh-plugin-easedraw/assets/charing/c-774f6f11a3a2.webp"},"impression":{"x":"plugins/dsh-plugin-easedraw/assets/impression/x-24d3da5d0e17.webp","c":"plugins/dsh-plugin-easedraw/assets/impression/c-b4f475d07a79.webp"},"heron":{"x":"plugins/dsh-plugin-easedraw/assets/heron/x-1b9373d1628f.webp","c":"plugins/dsh-plugin-easedraw/assets/heron/c-fdadb57ac159.webp"},"sadresse":{"x":"plugins/dsh-plugin-easedraw/assets/sadresse/x-d579c72a8073.webp","c":"plugins/dsh-plugin-easedraw/assets/sadresse/c-e87b63d1dfcc.webp"},"bridge":{"x":"plugins/dsh-plugin-easedraw/assets/bridge/x-8c2cc7127b7b.webp","c":"plugins/dsh-plugin-easedraw/assets/bridge/c-6a082f9aa0a6.webp"},"parliament":{"x":"plugins/dsh-plugin-easedraw/assets/parliament/x-f2fc822b7b0d.webp","c":"plugins/dsh-plugin-easedraw/assets/parliament/c-f84f4c4b0d1c.webp"},"rainyparis":{"x":"plugins/dsh-plugin-easedraw/assets/rainyparis/x-4be4d0892ac7.webp","c":"plugins/dsh-plugin-easedraw/assets/rainyparis/c-aa36327878d1.webp"},"sangiorgio":{"x":"plugins/dsh-plugin-easedraw/assets/sangiorgio/x-de26517d9653.webp","c":"plugins/dsh-plugin-easedraw/assets/sangiorgio/c-b5262917a767.webp"},"angelus":{"x":"plugins/dsh-plugin-easedraw/assets/angelus/x-7a068058183f.webp","c":"plugins/dsh-plugin-easedraw/assets/angelus/c-4e662aea88fa.webp"},"haywain":{"x":"plugins/dsh-plugin-easedraw/assets/haywain/x-a3eb85fe27a7.webp","c":"plugins/dsh-plugin-easedraw/assets/haywain/c-774cb587cc58.webp"},"cezanne":{"x":"plugins/dsh-plugin-easedraw/assets/cezanne/x-2fe65fbbf601.webp","c":"plugins/dsh-plugin-easedraw/assets/cezanne/c-021e136264f0.webp"},"levitan":{"x":"plugins/dsh-plugin-easedraw/assets/levitan/x-7fedad353673.webp","c":"plugins/dsh-plugin-easedraw/assets/levitan/c-5dddabeecf46.webp"},"lark":{"x":"plugins/dsh-plugin-easedraw/assets/lark/x-7e35a4c20809.webp","c":"plugins/dsh-plugin-easedraw/assets/lark/c-89b0677ca53e.webp"},"klimt":{"x":"plugins/dsh-plugin-easedraw/assets/klimt/x-444dbcf8846b.webp","c":"plugins/dsh-plugin-easedraw/assets/klimt/c-778fcd65c38d.webp"},"fsunset":{"x":"plugins/dsh-plugin-easedraw/assets/fsunset/x-2d27fc9ed316.webp","c":"plugins/dsh-plugin-easedraw/assets/fsunset/c-b3317bcbbe1a.webp"},"poppies":{"x":"plugins/dsh-plugin-easedraw/assets/poppies/x-7388ac732faa.webp","c":"plugins/dsh-plugin-easedraw/assets/poppies/c-7ad8332feb15.webp"},"irises":{"x":"plugins/dsh-plugin-easedraw/assets/irises/x-c7373b910383.webp","c":"plugins/dsh-plugin-easedraw/assets/irises/c-c8f68538f561.webp"},"bierstadt":{"x":"plugins/dsh-plugin-easedraw/assets/bierstadt/x-bf322b5df640.webp","c":"plugins/dsh-plugin-easedraw/assets/bierstadt/c-5ebae79599c6.webp"},"almond":{"x":"plugins/dsh-plugin-easedraw/assets/almond/x-ed36fce187a2.webp","c":"plugins/dsh-plugin-easedraw/assets/almond/c-6886ae1cbb95.webp"},"bedroom":{"x":"plugins/dsh-plugin-easedraw/assets/bedroom/x-d512d70f4054.webp","c":"plugins/dsh-plugin-easedraw/assets/bedroom/c-26f32687fb88.webp"},"hammermoon":{"x":"plugins/dsh-plugin-easedraw/assets/hammermoon/x-c789306afe4a.webp","c":"plugins/dsh-plugin-easedraw/assets/hammermoon/c-1826dd19c366.webp"},"sunflowers":{"x":"plugins/dsh-plugin-easedraw/assets/sunflowers/x-d843fc288727.webp","c":"plugins/dsh-plugin-easedraw/assets/sunflowers/c-d92b78408fcd.webp"},"gypsy":{"x":"plugins/dsh-plugin-easedraw/assets/gypsy/x-f3027808a89a.webp","c":"plugins/dsh-plugin-easedraw/assets/gypsy/c-43c0af86244a.webp"},"redfuji":{"x":"plugins/dsh-plugin-easedraw/assets/redfuji/x-a499b01dac57.webp","c":"plugins/dsh-plugin-easedraw/assets/redfuji/c-024c36884b12.webp"},"wave":{"x":"plugins/dsh-plugin-easedraw/assets/wave/x-801f9ead0d89.webp","c":"plugins/dsh-plugin-easedraw/assets/wave/c-80bd93875ceb.webp"},"flaming":{"x":"plugins/dsh-plugin-easedraw/assets/flaming/x-8e0e25a637ad.webp","c":"plugins/dsh-plugin-easedraw/assets/flaming/c-afb8021d6c06.webp"},"ejiri":{"x":"plugins/dsh-plugin-easedraw/assets/ejiri/x-a03aae2e28ce.webp","c":"plugins/dsh-plugin-easedraw/assets/ejiri/c-0aa94f32e87a.webp"},"rosebower":{"x":"plugins/dsh-plugin-easedraw/assets/rosebower/x-2bbc9aa8724a.webp","c":"plugins/dsh-plugin-easedraw/assets/rosebower/c-e3738da15800.webp"},"moore":{"x":"plugins/dsh-plugin-easedraw/assets/moore/x-395478413ba2.webp","c":"plugins/dsh-plugin-easedraw/assets/moore/c-9e7dfc1e9f7b.webp"},"shower":{"x":"plugins/dsh-plugin-easedraw/assets/shower/x-7b0b6e902784.webp","c":"plugins/dsh-plugin-easedraw/assets/shower/c-bdce8113db2e.webp"},"pourville-cliff":{"x":"plugins/dsh-plugin-easedraw/assets/pourville-cliff/x-1bd079d79230.webp","c":"plugins/dsh-plugin-easedraw/assets/pourville-cliff/c-62ed22ba016d.webp"},"poets-garden":{"x":"plugins/dsh-plugin-easedraw/assets/poets-garden/x-f0a1aa662a91.webp","c":"plugins/dsh-plugin-easedraw/assets/poets-garden/c-85b493bd97d2.webp"},"argenteuil-house":{"x":"plugins/dsh-plugin-easedraw/assets/argenteuil-house/x-e8d44bfc5250.webp","c":"plugins/dsh-plugin-easedraw/assets/argenteuil-house/c-9bce68c1981d.webp"},"eragny-haymaking":{"x":"plugins/dsh-plugin-easedraw/assets/eragny-haymaking/x-93ec0858c9a6.webp","c":"plugins/dsh-plugin-easedraw/assets/eragny-haymaking/c-45ba8de167a1.webp"},"pontoise-snow":{"x":"plugins/dsh-plugin-easedraw/assets/pontoise-snow/x-b94193dc75da.webp","c":"plugins/dsh-plugin-easedraw/assets/pontoise-snow/c-82d699e90e35.webp"},"inokashira-snow":{"x":"plugins/dsh-plugin-easedraw/assets/inokashira-snow/x-7a893e0c7af2.webp","c":"plugins/dsh-plugin-easedraw/assets/inokashira-snow/c-ff465de168e6.webp"},"mishima-mist":{"x":"plugins/dsh-plugin-easedraw/assets/mishima-mist/x-1a46b16a8841.webp","c":"plugins/dsh-plugin-easedraw/assets/mishima-mist/c-8594decb5a88.webp"},"clichy-spring":{"x":"plugins/dsh-plugin-easedraw/assets/clichy-spring/x-872f4b795694.webp","c":"plugins/dsh-plugin-easedraw/assets/clichy-spring/c-77ebede30edd.webp"},"monet-bordighera":{"x":"plugins/dsh-plugin-easedraw/assets/monet-bordighera/x-643e25ac5f11.webp","c":"plugins/dsh-plugin-easedraw/assets/monet-bordighera/c-04113d1a5b26.webp"},"monet-apples-grapes":{"x":"plugins/dsh-plugin-easedraw/assets/monet-apples-grapes/x-4e2fd1ccb8c8.webp","c":"plugins/dsh-plugin-easedraw/assets/monet-apples-grapes/c-c4e3c80061d5.webp"},"catherine-lee":{"x":"plugins/dsh-plugin-easedraw/assets/catherine-lee/x-fdaa0384c6b9.webp","c":"plugins/dsh-plugin-easedraw/assets/catherine-lee/c-cb7124eb6c2a.webp"},"window-five-minutes":{"x":"plugins/dsh-plugin-easedraw/assets/window-five-minutes/x-9aea0d820252.webp","c":"plugins/dsh-plugin-easedraw/assets/window-five-minutes/c-9fe259c42736.webp"}};
9
9
  const ASSETS = Object.fromEntries(Object.entries(PATHS).map(([id, urls])=>[id,{x:require.asset(urls.x), c:require.asset(urls.c)}]));
10
+ const UI = Object.fromEntries(Object.entries({"bg_day_p":"plugins/dsh-plugin-easedraw/assets/ui/bg_day_p-e920ce54fff1.webp","seal":"plugins/dsh-plugin-easedraw/assets/ui/seal-b0c32ffda37b.webp","amb_rain":"plugins/dsh-plugin-easedraw/assets/ui/amb_rain-c7691490e1b0.webp","amb_forest":"plugins/dsh-plugin-easedraw/assets/ui/amb_forest-e74fc51c3994.webp","amb_fire":"plugins/dsh-plugin-easedraw/assets/ui/amb_fire-b75c71812f22.webp","amb_waves":"plugins/dsh-plugin-easedraw/assets/ui/amb_waves-61d855a9ade8.webp"}).map(([id, url])=>[id,require.asset(url)]));
10
11
  /** Pure, timestamp-based focus timer. Callers persist state after each transition. */
11
12
  const finiteTime = value => Number.isFinite(value) && value >= 0;
12
13
  function checkNow(now) {
@@ -89,101 +90,202 @@ function GLP(cv,fb){let gl=null,U=null,UR=null,RR=null,TX=[],c2=null,ims=null,lo
89
90
  lose(){try{const x=gl&&gl.getExtension('WEBGL_lose_context');x&&x.loseContext()}catch(e){}gl=null}}}
90
91
 
91
92
 
93
+ /* 逸刻 · 本地合成环境声(小工具包内不支持音频文件,改为 Web Audio 实时生成缓冲) */
94
+ const SYNTH = (function () {
95
+ 'use strict';
96
+ function rng(seed) { var s = seed >>> 0 || 1; return function () { s ^= s << 13; s >>>= 0; s ^= s >> 17; s ^= s << 5; s >>>= 0; return s / 4294967296; }; }
97
+ function hash(str) { var h = 2166136261; for (var i = 0; i < str.length; i++) { h ^= str.charCodeAt(i); h = Math.imul(h, 16777619); } return h >>> 0; }
98
+ function loopify(d, n, x) { var o = new Float32Array(n); for (var i = 0; i < n; i++) o[i] = d[i]; for (var j = 0; j < x; j++) { var a = j / x; o[j] = d[j] * a + d[n + j] * (1 - a); } return o; }
99
+ function norm(d, peak) { var m = 0; for (var i = 0; i < d.length; i++) { var v = Math.abs(d[i]); if (v > m) m = v; } if (m > 0) { var k = peak / m; for (var j = 0; j < d.length; j++) d[j] *= k; } return d; }
100
+ function lp(a) { var y = 0; return function (x) { y += a * (x - y); return y; }; }
101
+ function coef(f, sr) { return 1 - Math.exp(-2 * Math.PI * f / sr); }
102
+
103
+ var GEN = {
104
+ rain: function (sr, r) {
105
+ var L = 12, X = sr, n = sr * L, d = new Float32Array(n + X), h1 = lp(coef(5200, sr)), h2 = lp(coef(420, sr)), b = lp(coef(900, sr));
106
+ for (var i = 0; i < n + X; i++) { var w = r() * 2 - 1, hi = h1(w) - h2(w); d[i] = hi * 0.55 + b(w) * 0.25; }
107
+ var drops = Math.floor(L * 40);
108
+ for (var k = 0; k < drops; k++) { var t = Math.floor(r() * (n + X - 2000)), f = 1800 + r() * 3200, a = 0.15 + r() * 0.35, len = Math.floor(sr * (0.006 + r() * 0.02));
109
+ for (var j = 0; j < len; j++) d[t + j] += Math.sin(2 * Math.PI * f * j / sr) * a * Math.exp(-j / (len * 0.25)); }
110
+ return norm(loopify(d, n, X), 0.7);
111
+ },
112
+ waves: function (sr, r) {
113
+ var L = 16, X = sr * 2, n = sr * L, d = new Float32Array(n + X), br = 0, f = lp(coef(600, sr)), f2 = lp(coef(2400, sr));
114
+ for (var i = 0; i < n + X; i++) { var w = r() * 2 - 1; br = (br + 0.02 * w) * 0.997; var tt = i / sr, env = Math.pow(0.5 + 0.5 * Math.sin(2 * Math.PI * tt / 8 - 1.2), 2.2);
115
+ d[i] = f(br * 6) * (0.35 + 0.65 * env) + f2(w) * 0.12 * env; }
116
+ return norm(loopify(d, n, X), 0.7);
117
+ },
118
+ fire: function (sr, r) {
119
+ var L = 12, X = sr, n = sr * L, d = new Float32Array(n + X), br = 0, f = lp(coef(260, sr));
120
+ for (var i = 0; i < n + X; i++) { var w = r() * 2 - 1; br = (br + 0.02 * w) * 0.996; d[i] = f(br * 7) * 0.8; }
121
+ var pops = Math.floor(L * 26);
122
+ for (var k = 0; k < pops; k++) { var t = Math.floor(r() * (n + X - 1500)), a = 0.2 + r() * 0.6, len = Math.floor(sr * (0.002 + r() * 0.012)), hp = 0;
123
+ for (var j = 0; j < len; j++) { var z = r() * 2 - 1; hp = z - hp * 0.6; d[t + j] += hp * a * Math.exp(-j / (len * 0.3)); } }
124
+ return norm(loopify(d, n, X), 0.65);
125
+ },
126
+ forest: function (sr, r) {
127
+ var L = 16, X = sr * 2, n = sr * L, d = new Float32Array(n + X), f = lp(coef(900, sr)), g = lp(coef(140, sr));
128
+ for (var i = 0; i < n + X; i++) { var w = r() * 2 - 1, tt = i / sr, gust = 0.55 + 0.45 * Math.sin(2 * Math.PI * tt / 5.3) * Math.sin(2 * Math.PI * tt / 11.7 + 1); d[i] = (f(w) - g(w)) * 0.5 * gust; }
129
+ var birds = 7;
130
+ for (var k = 0; k < birds; k++) { var t0 = Math.floor(r() * (n - sr)), f0 = 2600 + r() * 1800, notes = 2 + Math.floor(r() * 4);
131
+ for (var q = 0; q < notes; q++) { var st = t0 + Math.floor(q * sr * (0.11 + r() * 0.05)), len = Math.floor(sr * (0.06 + r() * 0.05)), ph = 0;
132
+ for (var j = 0; j < len; j++) { var p = j / len, fr = f0 * (1 + 0.35 * Math.sin(Math.PI * p)) * (1 + 0.04 * Math.sin(2 * Math.PI * 38 * j / sr)); ph += 2 * Math.PI * fr / sr;
133
+ d[st + j] += Math.sin(ph) * 0.22 * Math.sin(Math.PI * p); } } }
134
+ return norm(loopify(d, n, X), 0.6);
135
+ },
136
+ chime: function (sr) {
137
+ var L = 4, n = sr * L, d = new Float32Array(n), notes = [[0, 1318.5], [0.18, 1975.5]], P = [[1, 1], [2.76, 0.45], [5.4, 0.22], [8.93, 0.1]];
138
+ notes.forEach(function (nt) { var s = Math.floor(nt[0] * sr); for (var j = 0; s + j < n; j++) { var t = j / sr, v = 0; for (var k = 0; k < P.length; k++) v += Math.sin(2 * Math.PI * nt[1] * P[k][0] * t) * P[k][1] * Math.exp(-t * (1.2 + k * 1.5)); d[s + j] += v * Math.min(1, j / 40); } });
139
+ return norm(d, 0.8);
140
+ },
141
+ pad: function (sr, r, key) {
142
+ var L = 32, X = sr * 4, n = sr * L, d = new Float32Array(n + X), h = hash(key);
143
+ var scales = [[0, 4, 7, 11, 14], [0, 3, 7, 10, 14], [0, 5, 7, 12, 16], [0, 4, 9, 11, 16]], sc = scales[h % 4], base = 110 * Math.pow(2, ((h >>> 3) % 7) / 12);
144
+ var chord = [base / 2, base, base * Math.pow(2, sc[1] / 12), base * Math.pow(2, sc[2] / 12), base * Math.pow(2, sc[3] / 12)];
145
+ for (var i = 0; i < n + X; i++) { var t = i / sr, v = 0; for (var c = 0; c < chord.length; c++) { var tr = 0.6 + 0.4 * Math.sin(2 * Math.PI * t / (7 + c * 2.3) + c); v += (Math.sin(2 * Math.PI * chord[c] * t) + 0.18 * Math.sin(4 * Math.PI * chord[c] * t)) * tr * (c === 0 ? 0.5 : 0.28); } d[i] = v; }
146
+ var bells = 12; for (var k = 0; k < bells; k++) { var st = Math.floor((k + r() * 0.6) * (n / bells)), fr = base * 4 * Math.pow(2, sc[Math.floor(r() * sc.length)] / 12);
147
+ for (var j = 0; j < sr * 3 && st + j < n + X; j++) { var tt = j / sr; d[st + j] += Math.sin(2 * Math.PI * fr * tt) * 0.16 * Math.exp(-tt * 1.6) * Math.min(1, j / 200); } }
148
+ return norm(loopify(d, n, X), 0.55);
149
+ }
150
+ };
151
+ var CACHE = {};
152
+ return function (ac, url) {
153
+ var m = /^(amb|bgm)\/([\w-]+)\.mp3$/.exec(url); if (!m) return Promise.resolve(null);
154
+ var kind = m[1] === 'bgm' ? 'pad' : m[2], key = m[2];
155
+ if (!GEN[kind]) return Promise.resolve(null);
156
+ var ck = kind + ':' + key; if (CACHE[ck]) return CACHE[ck];
157
+ return CACHE[ck] = new Promise(function (res) {
158
+ setTimeout(function () {
159
+ try { var sr = Math.min(ac.sampleRate, 32000), data = GEN[kind](sr, rng(hash(ck) + 7), key), b = ac.createBuffer(1, data.length, sr); b.getChannelData(0).set(data); res(b); }
160
+ catch (e) { delete CACHE[ck]; res(null); }
161
+ }, 0);
162
+ });
163
+ };
164
+ })();
165
+
166
+ /* Adapted from the original EaseDraw Web Audio engine; one engine per plugin. */
167
+ const sound = (() => {
168
+ let ac=null,master=null,noiseBuffer=null,ambient=null,previewTimer=null,token=0,muted=false,lastTick=0;
169
+ function ensure(){
170
+ try { if(!ac){const C=window.AudioContext||window.webkitAudioContext;if(!C)return false;ac=new C();master=ac.createGain();master.gain.value=muted?0:1;master.connect(ac.destination);}
171
+ if(ac.state==='suspended')ac.resume().catch(()=>{});return true;
172
+ } catch{return false;}
173
+ }
174
+ function volume(m){muted=m;if(master&&ac)master.gain.setTargetAtTime(m?0:1,ac.currentTime,.15);}
175
+ function stop(f=1){++token;clearTimeout(previewTimer);if(!ambient||!ac)return;const s=ambient;ambient=null;try{const n=ac.currentTime;s._gain.gain.cancelScheduledValues(n);s._gain.gain.setValueAtTime(s._gain.gain.value,n);s._gain.gain.linearRampToValueAtTime(0,n+f);s.stop(n+f+.05);}catch{}}
176
+ function play(b,{vol=.8,loop=false,fade=0}={}){const s=ac.createBufferSource(),g=ac.createGain(),t=ac.currentTime+.05;s.buffer=b;s.loop=loop;s.connect(g);g.connect(master);if(fade){g.gain.setValueAtTime(0,t);g.gain.linearRampToValueAtTime(vol,t+fade);}else g.gain.value=vol;s.start(t);s._gain=g;return s;}
177
+ async function loop(k,preview=false){stop(.6);if(k==='quiet'||!ensure())return;const my=token,b=await SYNTH(ac,`amb/${k}.mp3`);if(!b||my!==token)return;ambient=play(b,{vol:preview?.5:.75,loop:true,fade:preview?.6:3});if(preview)previewTimer=setTimeout(()=>stop(1.5),4500);}
178
+ function noise(){if(noiseBuffer)return noiseBuffer;noiseBuffer=ac.createBuffer(1,ac.sampleRate,ac.sampleRate);const d=noiseBuffer.getChannelData(0);for(let i=0;i<d.length;i++)d[i]=Math.random()*2-1;return noiseBuffer;}
179
+ function burst(t,{f=400,type='lowpass',q=.7,vol=.2,a=.008,d=.15}){const s=ac.createBufferSource(),fl=ac.createBiquadFilter(),g=ac.createGain();s.buffer=noise();fl.type=type;fl.frequency.value=f;fl.Q.value=q;g.gain.setValueAtTime(0,t);g.gain.linearRampToValueAtTime(vol,t+a);g.gain.exponentialRampToValueAtTime(.0008,t+a+d);s.connect(fl);fl.connect(g);g.connect(master);s.start(t,Math.random()*.6,a+d+.05);}
180
+ function tone(t,{f0=100,f1=50,vol=.2,d=.2}){const o=ac.createOscillator(),g=ac.createGain();o.frequency.setValueAtTime(f0,t);o.frequency.exponentialRampToValueAtTime(f1,t+d);g.gain.setValueAtTime(vol,t);g.gain.exponentialRampToValueAtTime(.0008,t+d);o.connect(g);g.connect(master);o.start(t);o.stop(t+d+.05);}
181
+ function sfx(k){if(!ensure()||muted||ac.state!=='running')return;if(k==='tick'&&Date.now()-lastTick<60)return;lastTick=Date.now();const t=ac.currentTime+.012;try{if(k==='thunk'){tone(t,{f0:96,f1:44,vol:.5,d:.24});burst(t,{f:650,vol:.32,a:.003,d:.09});burst(t+.01,{f:3200,type:'bandpass',q:.8,vol:.05,a:.002,d:.05});}else if(k==='tick')burst(t,{f:3400,type:'highpass',vol:.05,a:.001,d:.012});else if(k==='click'){burst(t,{f:2600,type:'highpass',vol:.2,a:.002,d:.025});burst(t+.045,{f:1800,type:'bandpass',q:1.2,vol:.07,a:.002,d:.02});}}catch{}}
182
+ async function finish(){stop(2.5);if(!ac||muted||ac.state!=='running')return;const my=token,b=await SYNTH(ac,'amb/chime.mp3');if(b&&my===token&&!muted&&ac.state==='running')play(b,{vol:.6});}
183
+ return {ensure,volume,loop,stop,sfx,finish};
184
+ })();
185
+
92
186
  const KEY = 'easedraw.dsh.focus.v1';
93
187
  const ids = Object.keys(D);
94
- const fresh = () => ({ selected: ids[0], minutes: 25, timer: null, gallery: [] });
95
- function readSaved() {
96
- try {
97
- const raw = localStorage.getItem(KEY);
98
- if (!raw) return {data: fresh(), error: ''};
99
- const s = JSON.parse(raw);
100
- if (!s || !D[s.selected] || ![5,15,25,45].includes(s.minutes) || !Array.isArray(s.gallery)) throw Error('invalid');
101
- if (s.timer) { if (s.timer.status === 'idle' || !D[s.timer.artworkId]) throw Error('invalid artwork'); refresh(s.timer, Date.now()); }
102
- s.gallery = s.gallery.filter(x => x && D[x.artworkId] && Number.isFinite(x.at) && Number.isFinite(x.durationMs) && x.durationMs > 0).slice(-100);
103
- return {data: s, error: ''};
104
- } catch { return {data: fresh(), error: '读取本地记录失败;请先备份浏览器数据。'}; }
188
+ const fresh = () => ({selected:ids[0],minutes:25,task:'',sound:'rain',muted:false,timer:null,gallery:[]});
189
+ function readSaved(){
190
+ try{
191
+ const raw=localStorage.getItem(KEY);if(!raw)return {data:fresh(),error:''};
192
+ const s=JSON.parse(raw);
193
+ if(!s||!D[s.selected]||!Number.isInteger(s.minutes)||s.minutes<5||s.minutes>120||!Array.isArray(s.gallery))throw Error('invalid');
194
+ if(s.timer){if(s.timer.status==='idle'||!D[s.timer.artworkId])throw Error('invalid');refresh(s.timer,Date.now());}
195
+ s.sound=['rain','forest','fire','waves','quiet'].includes(s.sound)?s.sound:'rain';s.muted=s.muted===true;
196
+ s.task=typeof s.task==='string'?s.task.slice(0,80):'';
197
+ s.gallery=s.gallery.filter(x=>x&&D[x.artworkId]&&Number.isFinite(x.at)&&Number.isFinite(x.durationMs)&&x.durationMs>0).slice(-200);
198
+ return {data:s,error:''};
199
+ }catch{return {data:fresh(),error:'读取本地记录失败;请先备份浏览器数据。'};}
105
200
  }
106
- const css = `
107
- .ed-root{font-family:-apple-system,BlinkMacSystemFont,"PingFang SC",sans-serif;color:#382f26;font-size:14px;line-height:1.45}
108
- .ed-root *{box-sizing:border-box}.ed-root button{font:inherit;cursor:pointer}.ed-root button:focus-visible{outline:2px solid #a67e46;outline-offset:2px}
109
- .ed-launch{display:flex;align-items:center;gap:9px;min-height:40px;padding:5px 11px;border:1px solid #d8cbb9;border-radius:9px;background:#f7f2e9;color:#493d30}
110
- .ed-launch:hover{background:#eee4d5}.ed-seal{display:inline-grid;place-items:center;background:#a7372b;color:white;width:25px;height:25px;border-radius:3px;font-family:serif;font-size:15px}
111
- .ed-time{font-variant-numeric:tabular-nums;color:#775d3e}.ed-panel{width:min(380px,100%);max-height:min(68vh,720px);overflow-y:auto;margin:0 0 8px;padding:18px;background:#f7f2e9;border:1px solid #d8cbb9;border-radius:12px;box-shadow:0 6px 24px #30201417}
112
- .ed-head{display:flex;justify-content:space-between;align-items:start;margin-bottom:14px}.ed-eyebrow{font-size:11px;letter-spacing:.16em;color:#7b6d5c}.ed-title{font-family:Georgia,"Songti SC",serif;font-size:21px;margin:3px 0 0;font-weight:600}.ed-close{background:transparent;border:0;color:#62584c;min-width:36px;min-height:36px;font-size:19px}
113
- .ed-artwrap{display:flex;justify-content:center;align-items:center;padding:15px;background:#eae2d4;border-radius:4px;min-height:165px}.ed-frame{display:block;padding:5px;border:3px solid #8a6941;background:#f8f5ee;box-shadow:0 3px 10px #372b1b26;max-width:100%}.ed-canvas{display:block;width:auto;height:auto;max-width:100%;max-height:210px;background:#efe8dc}
114
- .ed-label{display:flex;justify-content:space-between;gap:12px;align-items:start;margin:11px 0 16px}.ed-name{font-family:Georgia,"Songti SC",serif;font-size:16px;font-weight:600}.ed-author,.ed-caption{font-size:12px;color:#6d6051}.ed-caption{margin-top:2px;text-align:right}
115
- .ed-row{display:flex;gap:6px;flex-wrap:wrap}.ed-row button,.ed-secondary{min-height:36px;padding:5px 11px;border:1px solid #cfc2ae;border-radius:7px;background:#fcf9f4;color:#493d30}.ed-row button[aria-pressed=true]{background:#493d30;color:#fff;border-color:#493d30}.ed-row button:disabled{opacity:.45;cursor:not-allowed}
116
- .ed-search{width:100%;min-height:36px;padding:6px 9px;border:1px solid #cfc2ae;border-radius:7px;background:#fcf9f4;color:#382f26;font:inherit}.ed-picker-grid{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:6px;max-height:210px;overflow:auto;padding:3px 1px}.ed-pick{min-width:0;padding:5px;border:1px solid #d8cbb9;border-radius:6px;background:#fcf9f4;color:#493d30;text-align:left}.ed-pick[aria-pressed=true]{border:2px solid #8a6941;padding:4px}.ed-pick img{display:block;width:100%;height:64px;object-fit:cover;border-radius:3px}.ed-pick span{display:block;font-size:11px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;margin-top:4px}.ed-filter-row{display:flex;gap:6px;margin:7px 0}.ed-filter-row select{min-width:95px;border:1px solid #cfc2ae;border-radius:7px;background:#fcf9f4;color:#382f26}.ed-section{margin-top:14px}.ed-section-label{font-size:12px;color:#70614f;margin-bottom:7px}.ed-main{width:100%;min-height:42px;margin-top:16px;border:0;border-radius:7px;background:#382f26;color:#fff;font-weight:600}.ed-main:hover{background:#57483a}.ed-actions{display:flex;gap:8px;margin-top:15px}.ed-actions button{flex:1;min-height:40px;border-radius:7px}.ed-actions .ed-main{margin:0}
117
- .ed-status{display:flex;justify-content:space-between;align-items:center;gap:6px;color:#6d6051}.ed-count{font-size:25px;letter-spacing:.06em;font-variant-numeric:tabular-nums;color:#382f26}.ed-track{height:3px;background:#ddd0be;margin-top:10px}.ed-fill{height:100%;background:#a78350;transition:width .4s ease}
118
- .ed-gallery-toggle{margin:14px 0 0;padding:0;border:0;background:none;text-decoration:underline;color:#67533b}.ed-gallery{margin-top:12px;border-top:1px solid #dfd4c4;padding-top:8px;max-height:145px;overflow:auto}.ed-record{display:flex;justify-content:space-between;gap:8px;padding:5px 0;color:#5e5345}.ed-note{font-size:12px;color:#6d6051;margin:11px 0 0}.ed-error{font-size:12px;color:#9f3025;margin:8px 0}.ed-error:not(:empty){padding:7px;border:1px solid #c77b70;border-radius:6px;background:#fff5f2}
119
- @media(prefers-reduced-motion:reduce){.ed-fill{transition:none}}
201
+ const css=`
202
+ .ed-root{height:100%;min-height:0;overflow:auto;color:#2a251f;font:14px/1.45 -apple-system,BlinkMacSystemFont,"PingFang SC",sans-serif;background-color:#e8dac5;background-image:var(--ed-wall);background-size:cover;background-position:center top;}
203
+ .ed-root *{box-sizing:border-box}.ed-root button,.ed-root input,.ed-root select{font:inherit}.ed-root button{cursor:pointer}.ed-root button:focus-visible,.ed-root input:focus-visible,.ed-root select:focus-visible{outline:3px solid #a9824a;outline-offset:2px}
204
+ .ed-inner{max-width:540px;min-height:100%;margin:auto;padding:24px 18px 26px}.ed-header{display:flex;justify-content:space-between;align-items:center;gap:12px}.ed-sub{color:#6f655a;font-size:12px;letter-spacing:.04em}.ed-title{font-family:"Songti SC","STSong",serif;font-size:30px;font-weight:600;letter-spacing:.07em;line-height:1.2;margin:3px 0 0}.ed-hallbtn{height:42px;min-width:42px;padding:0 12px;border-radius:24px;border:1px solid #e6d8c1;background:#fbf8f2;color:#514438;box-shadow:0 2px 6px #4b2e1720;font-size:13px}
205
+ .ed-stage{position:relative;display:flex;align-items:center;justify-content:center;gap:10px;margin:25px 0 12px}.ed-art{width:min(68%,260px);display:flex;align-items:center;flex-direction:column}.ed-frame{width:100%;padding:9px;background:linear-gradient(135deg,#3a3029,#17120e 30%,#0e0b08 70%,#241c16);box-shadow:0 18px 28px -15px #26160599,0 3px 6px #26160540,inset 0 1px 0 #fff0d236,inset 0 0 0 1px #000}.ed-mat{padding:8px;background:#efe8d8;box-shadow:inset 0 0 0 2px #b8924e,inset 1px 1px 4px #0005}.ed-paint{display:block;width:100%;height:auto;background:#eee5d3;object-fit:cover}.ed-arrow{flex:none;width:38px;height:38px;border:1px solid #f3e5d0;border-radius:50%;background:#fbf7efdf;color:#695746;font-size:23px;box-shadow:0 2px 5px #462a1020}.ed-label{margin-top:14px;background:#fbf8f1;border:1px solid #e4d8c6;box-shadow:0 6px 14px -8px #321e0a66,0 1px 3px #321e0a26;padding:10px 18px;text-align:center;font-family:"Songti SC","STSong",serif;min-width:130px;max-width:100%}.ed-name{font-size:15px;font-weight:600;letter-spacing:.05em}.ed-author{font-size:12px;color:#786e61;letter-spacing:.05em;margin-top:4px}
206
+ .ed-pager{display:flex;align-items:center;justify-content:center;gap:20px;margin:10px 0}.ed-pill{border:1px solid #e5d4bd;border-radius:20px;background:#fbf8f1;color:#5e5041;padding:7px 13px;min-height:36px;font-size:13px;box-shadow:0 2px 4px #36231312}.ed-count{font:13px "Songti SC",serif;color:#6f655a;white-space:nowrap}
207
+ .ed-card{background:linear-gradient(180deg,#fdf8efeb,#f5e9d8eb);border:1px solid #f9f1e5;border-radius:24px;padding:16px;box-shadow:inset 0 1px 0 #fff,0 8px 25px -14px #3c281e70}.ed-task{width:100%;min-height:44px;padding:9px 12px;border:1px solid #e1d5c4;border-radius:12px;background:#ffffffa6;color:#2a251f}.ed-task::placeholder{color:#897d6e}.ed-duration{display:flex;justify-content:space-between;align-items:baseline;margin:16px 2px 6px}.ed-minutes{font:600 30px "Songti SC","STSong",serif;font-variant-numeric:tabular-nums}.ed-minutes small{font:14px -apple-system,sans-serif;color:#6f655a;margin-left:4px}.ed-duration-hint{font:13px "Songti SC",serif;letter-spacing:.1em;color:#906e3c}.ed-range{display:block;width:100%;accent-color:#b5392c;min-height:24px;margin:0}.ed-ticks{display:flex;justify-content:space-between;color:#766b5f;font:11px Georgia,serif;margin:0 3px 14px}
208
+ .ed-main{width:100%;min-height:50px;padding:9px 16px;border:0;border-radius:28px;background:linear-gradient(#352b25,#171310);color:#fff8e9;letter-spacing:.10em;font-weight:600;box-shadow:0 7px 16px -9px #241409aa,inset 0 1px 0 #ffffff38}.ed-actions{display:flex;gap:8px}.ed-actions .ed-main{flex:1}.ed-alt{flex:1;min-height:48px;padding:8px 12px;border:1px solid #d6c3aa;border-radius:26px;background:#fff9ef;color:#4e4033}.ed-note{font-size:12px;color:#64594e;margin:11px 2px 0}.ed-error{font-size:13px;color:#8b231c;padding:9px;border-radius:8px;border:1px solid #b96961;background:#fff4f0;margin:12px 0 0}.ed-status{display:flex;align-items:center;justify-content:space-between;gap:12px}.ed-clock{font:600 30px "Songti SC",serif;font-variant-numeric:tabular-nums}.ed-track{height:4px;background:#ddcbb3;margin:12px 0 18px}.ed-fill{height:100%;background:#a9824a}
209
+ .ed-sheet{background:#faf5ebf2;border:1px solid #ede0cf;border-radius:20px;padding:15px;box-shadow:0 6px 22px -14px #36231380}.ed-sheethead{display:flex;justify-content:space-between;align-items:center;gap:8px;margin-bottom:12px}.ed-sheethead h2{margin:0;font:600 21px "Songti SC",serif}.ed-sheethead button{border:1px solid #decdb5;background:#fffaf2;border-radius:20px;min-height:38px;padding:6px 13px;color:#514438}.ed-filters{display:flex;gap:6px;margin-bottom:11px}.ed-filters input,.ed-filters select{min-width:0;min-height:40px;border:1px solid #dfd2c0;border-radius:9px;padding:7px;background:#fffaf4;color:#2a251f}.ed-filters input{flex:1}.ed-grid{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:8px}.ed-pick{min-width:0;padding:5px;border:1px solid #e3d8c8;background:#fffaf2;border-radius:7px;text-align:left;color:#30291f}.ed-pick[aria-pressed=true]{border:2px solid #a9824a;padding:4px}.ed-pick img{display:block;width:100%;height:75px;object-fit:cover}.ed-pick span{display:block;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;font-size:12px;margin:5px 1px 1px}.ed-gallery-row{display:flex;gap:12px;align-items:center;border-top:1px solid #e5d7c4;padding:10px 0}.ed-gallery-row img{width:48px;height:48px;object-fit:cover;border:3px solid #513b2b}.ed-gallery-row div{min-width:0}.ed-gallery-row strong{display:block;font:600 14px "Songti SC",serif}.ed-gallery-row small{display:block;color:#756a5e;margin-top:3px}.ed-empty{color:#6f655a;text-align:center;padding:26px 0}
210
+ /* Button, glass and ambient medallions adapted from the supplied original. */
211
+ .ed-main{position:relative;overflow:hidden;background:linear-gradient(180deg,#40362c 0%,#29221b 52%,#1b1612 100%);color:#f7efdf;letter-spacing:.16em;box-shadow:inset 0 1px 0 rgba(255,236,200,.24),inset 0 0 0 1px rgba(231,194,124,.18),inset 0 -3px 7px rgba(0,0,0,.38),0 16px 28px -14px rgba(30,18,6,.75),0 2px 4px rgba(30,18,6,.2);transition:transform .2s,filter .2s}.ed-main:active{transform:scale(.98)}.ed-main:hover{filter:brightness(1.08)}.ed-main::after{content:"";position:absolute;inset:0;background:linear-gradient(105deg,transparent 36%,rgba(255,244,220,.16) 50%,transparent 64%);transform:translateX(-120%);transition:transform 1s;pointer-events:none}.ed-main:hover::after{transform:translateX(120%)}.ed-main svg{width:19px;height:19px;vertical-align:-4px;margin-right:7px;color:#e6c682}
212
+ .ed-arrow,.ed-hallbtn{background:radial-gradient(120% 120% at 30% 18%,#fffefb 0%,#f7f0e4 46%,#e6dac7 100%);box-shadow:inset 0 1px 0 #fff,inset 0 -2px 3px rgba(120,88,46,.16),0 0 0 .5px rgba(110,82,44,.32),0 7px 16px -7px rgba(60,38,14,.5)}.ed-pill,.ed-alt,.ed-sheethead button{background:linear-gradient(180deg,#fffdf8,#f1e9db);box-shadow:inset 0 1px 0 #fff,inset 0 -2px 3px rgba(120,88,46,.12),0 0 0 .5px rgba(110,82,44,.3),0 6px 14px -8px rgba(60,38,14,.45)}.ed-task{background:linear-gradient(180deg,rgba(246,240,229,.75),rgba(255,255,255,.7));box-shadow:inset 0 1px 2px rgba(80,58,28,.14),inset 0 0 0 .5px rgba(110,82,44,.18),0 1px 0 rgba(255,255,255,.9)}
213
+ .ed-rwrap{position:relative;margin:0 -16px}.ed-ruler{height:46px;overflow-x:auto;scrollbar-width:none;cursor:grab;-webkit-mask:linear-gradient(90deg,transparent,#000 18%,#000 82%,transparent);mask:linear-gradient(90deg,transparent,#000 18%,#000 82%,transparent)}.ed-ruler::-webkit-scrollbar{display:none}.ed-ruler svg{display:block;height:46px;max-width:none}.ed-pointer{position:absolute;left:50%;top:2px;width:2px;height:30px;margin-left:-1px;background:#b5392c;border-radius:2px;pointer-events:none;box-shadow:0 0 0 2px rgba(255,255,255,.6)}.ed-pointer:after{content:"";position:absolute;left:-3px;top:-4px;width:8px;height:8px;border-radius:50%;background:#b5392c}
214
+ .ed-ambs{display:flex;justify-content:space-between;gap:4px;margin:10px 0 14px}.ed-amb{border:0;padding:2px 0;background:transparent;display:flex;flex-direction:column;align-items:center;gap:5px;font-size:11px;color:#6f655a;width:52px}.ed-amb i{position:relative;width:44px;height:44px;border-radius:50%;background-size:cover;background-position:center;box-shadow:0 0 0 1.5px #fffaf1,0 0 0 2px rgba(110,82,44,.22),0 7px 12px -5px rgba(40,25,10,.5);display:grid;place-items:center}.ed-amb i:before{content:"";position:absolute;inset:0;border-radius:50%;background:radial-gradient(circle at 32% 24%,rgba(255,255,255,.38),transparent 42%),radial-gradient(circle at 50% 125%,rgba(0,0,0,.32),transparent 62%);pointer-events:none}.ed-amb[aria-checked=true]{color:#2a231b;font-weight:600}.ed-amb[aria-checked=true] i:after{content:"";position:absolute;inset:-5px;border-radius:50%;background:conic-gradient(from 210deg,#8a6430,#f3d99c,#a87c3c,#ecd08f,#8a6430);-webkit-mask:radial-gradient(farthest-side,transparent calc(100% - 2.3px),#000 calc(100% - 2px));mask:radial-gradient(farthest-side,transparent calc(100% - 2.3px),#000 calc(100% - 2px))}.ed-amb i.ed-quiet{background:radial-gradient(120% 120% at 30% 18%,#fffefb,#efe6d6 60%,#e0d3bf);color:#8a6f4a}.ed-amb svg{width:19px;height:19px}.ed-soundbar{display:flex;justify-content:space-between;align-items:center;margin:3px 1px 2px;color:#6f655a;font-size:12px}.ed-mute{background:transparent;border:0;color:#756450;text-decoration:underline;padding:5px;min-height:32px}.ed-run-sound{display:flex;gap:6px;margin-bottom:12px;flex-wrap:wrap}.ed-run-sound .ed-pill{font-size:12px;min-height:32px;padding:4px 12px}
215
+ @media(max-height:900px){.ed-inner{padding-top:16px}.ed-stage{margin:12px 0 6px}.ed-art{width:min(60%,220px)}.ed-label{margin-top:8px;padding:7px 14px}.ed-pager{margin:6px 0}.ed-card{padding:12px 16px}.ed-duration{margin:9px 2px 2px}.ed-ticks{margin-bottom:5px}.ed-ambs{margin:5px 0 9px}}
216
+ @media(prefers-reduced-motion:reduce){.ed-main,.ed-main:after{transition:none}}
217
+ @media(max-width:330px){.ed-inner{padding:18px 12px}.ed-stage{gap:5px}.ed-pager{gap:8px}.ed-grid{grid-template-columns:repeat(2,minmax(0,1fr))}}
120
218
  `;
121
- function Painting({id, fraction}) {
122
- const ref=React.useRef(null), painter=React.useRef(null), fallback=React.useRef(false), current=React.useRef(fraction);
123
- current.current=fraction;
124
- React.useEffect(()=>{
125
- let alive=true; const cv=ref.current; let obj;
126
- (async()=>{try{
127
- obj=GLP(cv, ASSETS[id].c); const ims=await assets(id);
128
- if(!alive){obj.lose();return;} obj.set(ims);
129
- const width=400, height=Math.max(2,Math.round(width/D[id].r)); obj.size(width,height);
130
- painter.current=obj; obj.draw(current.current);
131
- }catch(e){if(alive){cv.style.backgroundImage=`url(${ASSETS[id].c})`;cv.style.backgroundSize='cover';fallback.current=true;cv.style.clipPath=`inset(${100-current.current*100}% 0 0)`;}}})();
132
- return ()=>{alive=false;painter.current=null;fallback.current=false;if(obj)obj.lose();};
133
- },[id]);
134
- React.useEffect(()=>{if(painter.current) painter.current.draw(fraction);else if(fallback.current && ref.current)ref.current.style.clipPath=`inset(${100-fraction*100}% 0 0)`;},[id,fraction]);
135
- return h('div',{className:'ed-artwrap'},h('div',{className:'ed-frame'},h('canvas',{ref,className:'ed-canvas',role:'img','aria-label':`${D[id].n},绘画进度 ${Math.round(fraction*100)}%`,style:{aspectRatio:String(D[id].r)}})));
219
+ function Ruler({value,onChange}){
220
+ const ref=React.useRef(null),drag=React.useRef(null),latest=React.useRef(value),[width,setWidth]=React.useState(320);latest.current=value;
221
+ React.useLayoutEffect(()=>{const el=ref.current;if(!el)return;const update=()=>setWidth(el.clientWidth||320);update();const ro=new ResizeObserver(update);ro.observe(el);return()=>ro.disconnect();},[]);
222
+ React.useLayoutEffect(()=>{if(ref.current&&Math.abs(ref.current.scrollLeft-(value-5)*8)>1)ref.current.scrollLeft=(value-5)*8;},[value,width]);
223
+ const ticks=[];for(let m=5;m<=120;m++){const x=width/2+(m-5)*8,k=m%15===0?2:m%5===0?1:0;ticks.push(h('line',{key:'l'+m,x1:x,x2:x,y1:6,y2:6+[7,12,18][k],stroke:k?'#2a251f':'rgba(42,37,31,.35)',strokeWidth:k===2?1.5:1}));if(k)ticks.push(h('text',{key:'t'+m,x,y:40,fontSize:k===2?11:9.5,textAnchor:'middle',fill:k===2?'#2a251f':'#8a7f71',fontFamily:'Songti SC,serif',fontWeight:k===2?600:400},m));}
224
+ return h('div',{className:'ed-rwrap'},h('div',{ref,className:'ed-ruler',role:'slider',tabIndex:0,'aria-label':'专注时长(分钟)','aria-valuemin':5,'aria-valuemax':120,'aria-valuenow':value,
225
+ onScroll:e=>{const n=Math.max(5,Math.min(120,Math.round(e.currentTarget.scrollLeft/8)+5));if(n!==latest.current){latest.current=n;onChange(n);}},
226
+ onWheel:e=>{e.currentTarget.scrollLeft+=(Math.abs(e.deltaX)>Math.abs(e.deltaY)?e.deltaX:e.deltaY)*.6;},
227
+ onPointerDown:e=>{if(e.pointerType==='mouse'){drag.current={x:e.clientX,left:e.currentTarget.scrollLeft};e.currentTarget.setPointerCapture(e.pointerId);}},onPointerMove:e=>{if(drag.current)e.currentTarget.scrollLeft=drag.current.left-(e.clientX-drag.current.x);},onPointerUp:()=>{drag.current=null;},onPointerCancel:()=>{drag.current=null;},
228
+ onKeyDown:e=>{let n=latest.current;if(e.key==='Home')n=5;else if(e.key==='End')n=120;else if(e.key==='ArrowRight'||e.key==='ArrowUp')n+=e.shiftKey?5:1;else if(e.key==='ArrowLeft'||e.key==='ArrowDown')n-=e.shiftKey?5:1;else return;e.preventDefault();n=Math.max(5,Math.min(120,n));latest.current=n;onChange(n);}},
229
+ h('svg',{width:(120-5)*8+width,height:46,'aria-hidden':true},...ticks)),h('span',{className:'ed-pointer','aria-hidden':true}));
230
+ }
231
+ function Painting({id,fraction}){
232
+ const ref=React.useRef(null),painter=React.useRef(null),fallback=React.useRef(false),current=React.useRef(fraction);current.current=fraction;
233
+ React.useEffect(()=>{let alive=true;const cv=ref.current;let obj;(async()=>{try{obj=GLP(cv,ASSETS[id].c);const ims=await assets(id);if(!alive){obj.lose();return;}obj.set(ims);const width=400,height=Math.max(2,Math.round(width/D[id].r));obj.size(width,height);painter.current=obj;obj.draw(current.current);}catch{if(alive){cv.style.backgroundImage=`url(${ASSETS[id].c})`;cv.style.backgroundSize='cover';fallback.current=true;cv.style.clipPath=`inset(${100-current.current*100}% 0 0)`;}}})();return()=>{alive=false;painter.current=null;fallback.current=false;if(obj)obj.lose();};},[id]);
234
+ React.useEffect(()=>{if(painter.current)painter.current.draw(fraction);else if(fallback.current&&ref.current)ref.current.style.clipPath=`inset(${100-fraction*100}% 0 0)`;},[id,fraction]);
235
+ return h('canvas',{ref,className:'ed-paint',role:'img','aria-label':`${D[id].n},绘画进度 ${Math.round(fraction*100)}%`,style:{aspectRatio:String(D[id].r)}});
136
236
  }
137
- function FocusWidget(){
138
- const initial=React.useRef(null); if(!initial.current)initial.current=readSaved();
139
- const [data,setData]=React.useState(initial.current.data), [error,setError]=React.useState(initial.current.error);
140
- const [open,setOpen]=React.useState(false),[gallery,setGallery]=React.useState(false),[confirm,setConfirm]=React.useState(false),[now,setNow]=React.useState(Date.now());
141
- const [category,setCategory]=React.useState('全部'),[search,setSearch]=React.useState('');
142
- const categories=['全部',...new Set(ids.map(id=>D[id].c).filter(Boolean))];
143
- const q=search.trim().toLocaleLowerCase();
237
+ function FocusPage(){
238
+ const initial=React.useRef(null);if(!initial.current)initial.current=readSaved();
239
+ const [data,setData]=React.useState(initial.current.data),[error,setError]=React.useState(initial.current.error);
240
+ const [audioError,setAudioError]=React.useState('');
241
+ const [view,setView]=React.useState('focus'),[confirm,setConfirm]=React.useState(false),[category,setCategory]=React.useState('全部'),[search,setSearch]=React.useState(''),[now,setNow]=React.useState(Date.now());
242
+ React.useEffect(()=>{sound.volume(data.muted);},[data.muted]);
243
+ React.useEffect(()=>()=>sound.stop(.5),[]);
244
+ const dataRef=React.useRef(data),blocked=React.useRef(Boolean(initial.current.error));dataRef.current=data;
245
+ const persist=next=>{dataRef.current=next;setData(next);if(blocked.current){setError('本地记录无法读取,已停止写入以保护原数据;请先备份并修复存储。');return;}try{localStorage.setItem(KEY,JSON.stringify(next));setError('');window.dispatchEvent(new Event('easedraw-dsh-update'));}catch{setError('无法保存到本地,关闭后记录可能丢失。');}};
246
+ React.useEffect(()=>{const sync=()=>{const loaded=readSaved();if(!loaded.error){blocked.current=false;dataRef.current=loaded.data;setData(loaded.data);setError('');}else{blocked.current=true;setError(loaded.error);}};window.addEventListener('storage',sync);window.addEventListener('easedraw-dsh-update',sync);return()=>{window.removeEventListener('storage',sync);window.removeEventListener('easedraw-dsh-update',sync);};},[]);
247
+ React.useEffect(()=>{if(data.timer?.status!=='running')return;const tick=()=>setNow(Date.now());tick();const t=setInterval(tick,1000);document.addEventListener('visibilitychange',tick);return()=>{clearInterval(t);document.removeEventListener('visibilitychange',tick);};},[data.timer?.status,data.timer?.resumedAt]);
248
+ const timer=data.timer,p=timer?progress(timer,now):null;
249
+ React.useEffect(()=>{if(timer?.status==='running'&&p?.state.status==='completed'&&dataRef.current.timer?.status==='running'){persist({...dataRef.current,timer:p.state});sound.finish();}},[timer?.status,p?.state.status]);
250
+ const state=p?.state,status=state?.status||'idle',active=status==='running'||status==='paused',shownId=state?.artworkId||data.selected,fraction=state?p.fraction:0;
251
+ const clock=ms=>{const n=Math.ceil(ms/1000);return `${String(Math.floor(n/60)).padStart(2,'0')}:${String(n%60).padStart(2,'0')}`;};
252
+ const choose=id=>persist({...dataRef.current,selected:id});
253
+ const change=fn=>{const next=fn(dataRef.current.timer,Date.now());persist({...dataRef.current,timer:next});if(next.status==='running')sound.loop(dataRef.current.sound);else if(next.status==='completed')sound.finish();else sound.stop(1);setNow(Date.now());};
254
+ const startSession=()=>{sound.volume(dataRef.current.muted);if(!sound.ensure())setAudioError('当前环境无法播放声音,可选择安静继续专注。');sound.sfx('click');sound.loop(dataRef.current.sound);persist({...dataRef.current,timer:start(createFocus({artworkId:data.selected,durationMs:data.minutes*60000}),Date.now())});setNow(Date.now());};
255
+ const save=()=>{sound.sfx('thunk');const s=dataRef.current;if(!s.timer||refresh(s.timer,Date.now()).status!=='completed')return;persist({...s,timer:null,gallery:[...s.gallery,{artworkId:s.timer.artworkId,at:Date.now(),durationMs:s.timer.durationMs,task:s.task}].slice(-200)});setView('gallery');};
256
+ const soundOptions=[['rain','雨'],['forest','林间'],['fire','炉火'],['waves','海浪'],['quiet','安静']];
257
+ const chooseSound=k=>{persist({...dataRef.current,sound:k});sound.volume(dataRef.current.muted);if(k!=='quiet'&&!sound.ensure())setAudioError('当前环境无法播放声音,可选择安静继续专注。');else setAudioError('');sound.loop(k,true);};
258
+ const categories=['全部',...new Set(ids.map(id=>D[id].c).filter(Boolean))],q=search.trim().toLocaleLowerCase();
144
259
  const filtered=ids.filter(id=>(category==='全部'||D[id].c===category)&&(!q||`${D[id].n} ${D[id].a}`.toLocaleLowerCase().includes(q)));
145
- const dataRef=React.useRef(data), storageBlocked=React.useRef(Boolean(initial.current.error));dataRef.current=data;
146
- const persist=(next)=>{dataRef.current=next;setData(next);if(storageBlocked.current){setError('本地记录无法读取,已停止写入以保护原数据;请先备份并修复存储。');return;}try{localStorage.setItem(KEY,JSON.stringify(next));setError(''); window.dispatchEvent(new Event('easedraw-dsh-update'));}catch{setError('无法保存到本地,关闭后记录可能丢失。');}};
147
- React.useEffect(()=>{const sync=()=>{const loaded=readSaved();if(!loaded.error){storageBlocked.current=false;setData(loaded.data);setError('')}else{storageBlocked.current=true;setError(loaded.error)}};window.addEventListener('storage',sync);window.addEventListener('easedraw-dsh-update',sync);return()=>{window.removeEventListener('storage',sync);window.removeEventListener('easedraw-dsh-update',sync)}},[]);
148
- React.useEffect(()=>{if(data.timer?.status!=='running')return;const tick=()=>setNow(Date.now());tick();const t=setInterval(tick,1000);document.addEventListener('visibilitychange',tick);return()=>{clearInterval(t);document.removeEventListener('visibilitychange',tick)}},[data.timer?.status,data.timer?.resumedAt]);
149
- let timer=data.timer; let p=timer?progress(timer,now):null;
150
- React.useEffect(()=>{if(timer?.status==='running' && p?.state.status==='completed')persist({...dataRef.current,timer:p.state})},[timer?.status,p?.state.status]);
151
- const state=p?.state, status=state?.status||'idle', active=status==='running'||status==='paused';
152
- const shownId=state?.artworkId||data.selected, fraction=state? p.fraction : 0;
153
- const clock=(ms)=>{const s=Math.ceil(ms/1000);return `${String(Math.floor(s/60)).padStart(2,'0')}:${String(s%60).padStart(2,'0')}`};
154
- const choose=(id)=>persist({...dataRef.current,selected:id});
155
- const startSession=()=>{const t=start(createFocus({artworkId:data.selected,durationMs:data.minutes*60000}),Date.now());persist({...dataRef.current,timer:t});setNow(Date.now())};
156
- const change=(fn)=>{persist({...dataRef.current,timer:fn(dataRef.current.timer,Date.now())});setNow(Date.now())};
157
- const save=()=>{const s=dataRef.current;if(!s.timer || refresh(s.timer,Date.now()).status!=='completed')return; const record={artworkId:s.timer.artworkId,at:Date.now(),durationMs:s.timer.durationMs};persist({...s,timer:null,gallery:[...s.gallery,record].slice(-100)});setGallery(true)};
158
- const caption=status==='running'?'画作正在慢慢完成':status==='paused'?'已暂停':status==='completed'?'这一刻,画完了':status==='ended'?'本次专注已结束':'专注多久,画就画多久';
159
- return h('div',{className:'ed-root'},h('style',null,css),
160
- open && h('section',{className:'ed-panel','aria-label':'逸刻专注面板'},
161
- h('div',{className:'ed-head'},h('div',null,h('div',{className:'ed-eyebrow'},'LUCKY & EASE · EASEDRAW'),h('div',{className:'ed-title'},'一幅画的时间')),h('button',{className:'ed-close',onClick:()=>setOpen(false),'aria-label':'收起逸刻'},'×')),
162
- h(Painting,{key:shownId,id:shownId,fraction}),
163
- h('div',{className:'ed-label'},h('div',null,h('div',{className:'ed-name'},D[shownId].n),h('div',{className:'ed-author'},`${D[shownId].a} · ${D[shownId].y}`)),h('div',{className:'ed-caption'},caption)),
164
- !state && h(React.Fragment,null,
165
- h('div',{className:'ed-section'},h('div',{className:'ed-section-label'},`选择画作 · ${filtered.length} / ${ids.length}`),
166
- h('div',{className:'ed-filter-row'},h('select',{'aria-label':'画作分类',value:category,onChange:e=>setCategory(e.target.value)},...categories.map(c=>h('option',{key:c,value:c},c))),h('input',{className:'ed-search',type:'search','aria-label':'搜索画名或画家',placeholder:'搜索画名或画家',value:search,onChange:e=>setSearch(e.target.value)})),
167
- h('div',{className:'ed-picker-grid','aria-label':'画作列表'},...filtered.map(id=>h('button',{className:'ed-pick',key:id,'aria-label':`${D[id].n} · ${D[id].a}`,'aria-pressed':data.selected===id,onClick:()=>choose(id)},h('img',{src:ASSETS[id].c,loading:'lazy',alt:''}),h('span',null,D[id].n)))),
168
- filtered.length===0&&h('p',{className:'ed-note'},'没有找到画作,请换个关键词。')),
169
-
170
- h('div',{className:'ed-section'},h('div',{className:'ed-section-label'},'选择专注时间'),h('div',{className:'ed-row'},...[5,15,25,45].map(m=>h('button',{key:m,'aria-pressed':data.minutes===m,onClick:()=>persist({...dataRef.current,minutes:m})},`${m} 分钟`)))),
171
- h('button',{className:'ed-main',onClick:startSession},'开始专注')),
172
- state && h(React.Fragment,null,
173
- h('div',{className:'ed-status'},h('span',null,status==='completed'?'已完成':status==='ended'?'未完成':status==='paused'?'已暂停':'剩余时间'),h('span',{className:'ed-count'},clock(p.remainingMs))),
174
- h('div',{className:'ed-track',role:'progressbar','aria-label':'绘画进度','aria-valuemin':0,'aria-valuemax':100,'aria-valuenow':Math.round(fraction*100)},h('div',{className:'ed-fill',style:{width:`${fraction*100}%`}})),
175
- active && !confirm && h('div',{className:'ed-actions'},h('button',{className:'ed-main',onClick:()=>change(status==='running'?pause:resume)},status==='running'?'暂停':'继续'),h('button',{className:'ed-secondary',onClick:()=>setConfirm(true)},'结束')),
176
- active && confirm && h(React.Fragment,null,h('p',{className:'ed-note'},'提前结束不会收藏本次画作。'),h('div',{className:'ed-actions'},h('button',{className:'ed-secondary',onClick:()=>setConfirm(false)},'返回'),h('button',{className:'ed-main',onClick:()=>{change(endEarly);setConfirm(false)}},'确认结束'))),
177
- status==='completed' && h('button',{className:'ed-main',onClick:save},'收藏到展厅'),
178
- status==='ended' && h('button',{className:'ed-main',onClick:()=>persist({...dataRef.current,timer:null})},'返回选画')),
179
- h('button',{className:'ed-gallery-toggle',onClick:()=>setGallery(!gallery),'aria-expanded':gallery},`我的展厅 · ${data.gallery.length}`),
180
- gallery && h('div',{className:'ed-gallery'},data.gallery.length?data.gallery.slice().reverse().map((x,i)=>h('div',{className:'ed-record',key:`${x.at}-${i}`},h('span',null,D[x.artworkId].n),h('span',null,`${new Date(x.at).toLocaleDateString()} · ${Math.round(x.durationMs/60000)} 分钟`))):h('p',{className:'ed-note'},'完成第一幅画后,它会挂在这里。')),
181
- h('p',{className:'ed-note'},'记录仅保存在当前环境;清除本地数据可能丢失。'),error && h('p',{className:'ed-error',role:'alert'},error)
182
- ),
183
- h('button',{className:'ed-launch',onClick:()=>setOpen(!open),'aria-expanded':open},h('span',{className:'ed-seal','aria-hidden':true},'逸'),h('span',null,'逸刻 · 专注'),active && h('span',{className:'ed-time'},clock(p.remainingMs)),status==='completed'&&h('span',{className:'ed-time'},'已完成'))
184
- );
260
+ const shift=n=>{const i=ids.indexOf(data.selected);choose(ids[(i+n+ids.length)%ids.length]);};
261
+ const today=new Intl.DateTimeFormat('zh-CN',{month:'long',day:'numeric',weekday:'short'}).format(new Date());
262
+ return h('div',{className:'ed-root',style:{'--ed-wall':`url("${UI.bg_day_p}")`}},h('style',null,css),h('div',{className:'ed-inner'},
263
+ h('header',{className:'ed-header'},h('div',null,h('div',{className:'ed-sub'},`${today} · 选一幅画,开始一段专注`),h('h1',{className:'ed-title'},view==='gallery'?'我的展厅':'专注')),h('button',{className:'ed-hallbtn',onClick:()=>setView(view==='gallery'?'focus':'gallery')},view==='gallery'?'返回':'我的展厅')),
264
+ view==='picker'?h('section',{className:'ed-sheet','aria-label':'全部画作'},h('div',{className:'ed-sheethead'},h('h2',null,`全部画作 · ${filtered.length}`),h('button',{onClick:()=>setView('focus')},'返回')),
265
+ h('div',{className:'ed-filters'},h('select',{'aria-label':'画作分类',value:category,onChange:e=>setCategory(e.target.value)},...categories.map(c=>h('option',{key:c,value:c},c))),h('input',{type:'search','aria-label':'搜索画名或画家',placeholder:'搜索画名或画家',value:search,onChange:e=>setSearch(e.target.value)})),
266
+ h('div',{className:'ed-grid'},...filtered.map(id=>h('button',{className:'ed-pick',key:id,'aria-label':`${D[id].n} · ${D[id].a}`,'aria-pressed':data.selected===id,onClick:()=>{choose(id);setView('focus');}},h('img',{src:ASSETS[id].c,loading:'lazy',alt:''}),h('span',null,D[id].n)))),filtered.length===0&&h('p',{className:'ed-empty'},'没有找到画作,请换个关键词。')):
267
+ view==='gallery'?h('section',{className:'ed-sheet','aria-label':'我的展厅'},h('div',{className:'ed-sheethead'},h('h2',null,`我的展厅 · ${data.gallery.length}`),h('button',{onClick:()=>setView('focus')},'返回')),
268
+ data.gallery.length?data.gallery.slice().reverse().map((x,i)=>h('div',{className:'ed-gallery-row',key:`${x.at}-${i}`},h('img',{src:ASSETS[x.artworkId].c,loading:'lazy',alt:''}),h('div',null,h('strong',null,D[x.artworkId].n),h('small',null,`${new Date(x.at).toLocaleDateString()} · ${Math.round(x.durationMs/60000)} 分钟`),x.task&&h('small',null,x.task)))):h('p',{className:'ed-empty'},'完成第一幅画后,它会挂在这里。')):
269
+ h(React.Fragment,null,
270
+ h('div',{className:'ed-stage'},!state&&h('button',{className:'ed-arrow','aria-label':'上一幅',onClick:()=>shift(-1)},'‹'),h('div',{className:'ed-art'},h('div',{className:'ed-frame'},h('div',{className:'ed-mat'},state?h(Painting,{key:shownId,id:shownId,fraction}):h('img',{className:'ed-paint',src:ASSETS[shownId].c,alt:D[shownId].n}))),h('div',{className:'ed-label'},h('div',{className:'ed-name'},D[shownId].n),h('div',{className:'ed-author'},`${D[shownId].a} · ${D[shownId].y}`))),!state&&h('button',{className:'ed-arrow','aria-label':'下一幅',onClick:()=>shift(1)},'›')),
271
+ !state&&h('div',{className:'ed-pager'},h('button',{className:'ed-pill',onClick:()=>setView('picker')},'▦ 全部'),h('span',{className:'ed-count'},`${ids.indexOf(data.selected)+1} / ${ids.length}`),h('button',{className:'ed-pill',onClick:()=>choose(ids[Math.floor(Math.random()*ids.length)])},'◇ 随机')),
272
+ h('section',{className:'ed-card'},!state?h(React.Fragment,null,h('input',{className:'ed-task','aria-label':'本次专注任务',placeholder:'这一段只做……(可选)',maxLength:80,value:data.task,onChange:e=>persist({...dataRef.current,task:e.target.value})}),
273
+ h('div',{className:'ed-duration'},h('span',{className:'ed-minutes'},data.minutes,h('small',null,'分钟')),h('span',{className:'ed-duration-hint'},'给自己一段完整的时间')),
274
+ h(Ruler,{value:data.minutes,onChange:n=>{sound.sfx('tick');persist({...dataRef.current,minutes:n});}}),h('div',{className:'ed-soundbar'},h('span',null,'选择声音'),h('button',{className:'ed-mute',onClick:()=>{const m=!dataRef.current.muted;persist({...dataRef.current,muted:m});sound.volume(m);}},data.muted?'开启音效':'关闭音效')),h('div',{className:'ed-ambs',role:'radiogroup','aria-label':'声音'},...soundOptions.map(([k,label])=>h('button',{key:k,className:'ed-amb',role:'radio','aria-checked':data.sound===k,onClick:()=>chooseSound(k)},h('i',{className:k==='quiet'?'ed-quiet':'',style:k==='quiet'?{}:{backgroundImage:`url("${UI['amb_'+k]}")`}},k==='quiet'&&h('svg',{viewBox:'0 0 24 24',fill:'none',stroke:'currentColor',strokeWidth:'1.7','aria-hidden':true},h('path',{d:'M5 10v4M8.5 7.5v9M12 5v14M15.5 8.5v7M19 10.5v3'}))),label))),h('button',{className:'ed-main',onClick:startSession},h('svg',{viewBox:'0 0 24 24',fill:'none',stroke:'currentColor',strokeWidth:'1.8','aria-hidden':true},h('path',{d:'M12.6 11.4l7.2-7.2M10.6 9.6l3.8 3.8M10.4 12.8c-2.3-.4-4.3 1-4.6 3.3-.2 1.7-1 2.8-2.3 3.5 3.2.9 6.8.2 8-2.3.6-1.4.3-3-1.1-4.5z',fill:'#e6c682'})),'开始作画')):
275
+ h(React.Fragment,null,active&&h('div',{className:'ed-run-sound'},h('button',{className:'ed-pill',onClick:()=>{const i=soundOptions.findIndex(([k])=>k===dataRef.current.sound);const k=soundOptions[(i+1)%soundOptions.length][0];persist({...dataRef.current,sound:k});if(status==='running')sound.loop(k);}},`声音:${soundOptions.find(([k])=>k===data.sound)?.[1]} · 切换`),status==='running'&&data.sound!=='quiet'&&h('button',{className:'ed-pill',onClick:()=>sound.loop(dataRef.current.sound)},'播放声音'),h('button',{className:'ed-pill',onClick:()=>{const m=!dataRef.current.muted;persist({...dataRef.current,muted:m});sound.volume(m);}},data.muted?'开启音效':'关闭音效')),h('div',{className:'ed-status'},h('span',null,status==='completed'?'画完了':status==='ended'?'本次专注已结束':status==='paused'?'已暂停':'剩余时间'),h('span',{className:'ed-clock'},clock(p.remainingMs))),
276
+ h('div',{className:'ed-track',role:'progressbar','aria-label':'绘画进度','aria-valuemin':0,'aria-valuemax':100,'aria-valuenow':Math.round(fraction*100)},h('div',{className:'ed-fill',style:{width:`${fraction*100}%`}})),
277
+ active&&!confirm&&h('div',{className:'ed-actions'},h('button',{className:'ed-main',onClick:()=>change(status==='running'?pause:resume)},status==='running'?'暂停':'继续'),h('button',{className:'ed-alt',onClick:()=>setConfirm(true)},'结束')),
278
+ active&&confirm&&h(React.Fragment,null,h('p',{className:'ed-note'},'提前结束不会收藏本次画作。'),h('div',{className:'ed-actions'},h('button',{className:'ed-alt',onClick:()=>setConfirm(false)},'返回'),h('button',{className:'ed-main',onClick:()=>{change(endEarly);setConfirm(false);}},'确认结束'))),
279
+ status==='completed'&&h('button',{className:'ed-main',onClick:save},'收藏到展厅'),status==='ended'&&h('button',{className:'ed-main',onClick:()=>persist({...dataRef.current,timer:null})},'返回选画')),
280
+ h('p',{className:'ed-note'},'记录仅保存在当前环境;清除本地数据可能丢失。'))),audioError&&h('p',{className:'ed-error',role:'alert'},audioError),error&&h('p',{className:'ed-error',role:'alert'},error)
281
+ ));
185
282
  }
186
- return {inject:['slots'], apply(ctx) {ctx.slots.inject('conversation.input.dock',()=>ctx.slots.register({name:'conversation.input.dock',id:'easedraw-focus',order:5},FocusWidget));}};
283
+ function GuideIcon({size=24,className}){return h('img',{src:UI.seal,width:size,height:size,className,alt:'',style:{borderRadius:3,objectFit:'cover'}});}
284
+ const TAB_ID='dsh-plugin-easedraw',TAB_KIND='easedraw-focus';
285
+ return {inject:['slots','sidebarRightTabs'],apply(ctx){
286
+ ctx.effect(()=>ctx.sidebarRightTabs.register({id:TAB_ID,kind:TAB_KIND,keepMounted:true,title:()=> '逸刻 · 专注',guide:[{id:'focus',order:25,title:()=> '逸刻 · 专注',description:()=> '用一幅画的时间,专心做一件事',icon:GuideIcon}]}));
287
+ ctx.effect(()=>ctx.slots.inject('sidebar.right.pane.tab',()=>ctx.slots.register({name:'sidebar.right.pane.tab',key:TAB_ID},FocusPage)));
288
+ }};
187
289
 
188
290
  }
189
291
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-plugin-easedraw",
3
- "version": "0.2.0",
3
+ "version": "0.2.1",
4
4
  "type": "module",
5
5
  "description": "EaseDraw focus painting for DeepSeek Harness",
6
6
  "exports": {
@@ -26,7 +26,7 @@
26
26
  "platform": "web",
27
27
  "immediately": true,
28
28
  "inject": [
29
- "@deepseek-ai/dsh-client-ui-conversation"
29
+ "@deepseek-ai/dsh-client-ui-sidebar-right"
30
30
  ]
31
31
  }
32
32
  },