@cowwo/dsh-icon-custom 0.18.0 → 0.19.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 +2 -0
- package/README.zh.md +11 -1
- package/client/client.js +715 -186
- package/lib/typert.host.js +6 -3
- package/lib/unread.js +18 -4
- package/package.json +3 -3
package/lib/typert.host.js
CHANGED
|
@@ -57,6 +57,8 @@ const unreadRuleSchema = z.object({
|
|
|
57
57
|
appBadge: z.boolean(),
|
|
58
58
|
/** 进入会话后要连续待满多少秒才算"看过";0 = 进入即已读。上限 10 分钟。 */
|
|
59
59
|
clearDelaySec: z.number().int().nonnegative().max(600),
|
|
60
|
+
/** 实验项:点清单条目时在侧栏定位到该会话(展开工作区 + 滚动 + 闪一下;贴产品 DOM,可一键关闭)。 */
|
|
61
|
+
revealOnOpen: z.boolean(),
|
|
60
62
|
/**
|
|
61
63
|
* 宿主此刻的 `Date.now()`。
|
|
62
64
|
* 客户端用它把"看过"水位换算进宿主时钟域(`turn/end.time` 也是宿主时钟):
|
|
@@ -77,7 +79,8 @@ const setUnreadRuleRequestSchema = z.object({
|
|
|
77
79
|
pending: z.boolean().optional(),
|
|
78
80
|
workspaceDot: z.boolean().optional(),
|
|
79
81
|
appBadge: z.boolean().optional(),
|
|
80
|
-
clearDelaySec: z.number().int().nonnegative().max(600).optional()
|
|
82
|
+
clearDelaySec: z.number().int().nonnegative().max(600).optional(),
|
|
83
|
+
revealOnOpen: z.boolean().optional()
|
|
81
84
|
})
|
|
82
85
|
|
|
83
86
|
/** 一次水位线同步:浏览器把自己那份交上来,宿主逐会话取 max 后回权威表。 */
|
|
@@ -376,7 +379,7 @@ export const TYPERT = {
|
|
|
376
379
|
{
|
|
377
380
|
kind: 'method',
|
|
378
381
|
name: 'getUnreadRule',
|
|
379
|
-
signature: 'async getUnreadRule(): Promise<{ reasons: Record<string, boolean>; pending: boolean; workspaceDot: boolean; appBadge: boolean; clearDelaySec: number; hostNow: number; seen: Record<string, number> }>',
|
|
382
|
+
signature: 'async getUnreadRule(): Promise<{ reasons: Record<string, boolean>; pending: boolean; workspaceDot: boolean; appBadge: boolean; clearDelaySec: number; revealOnOpen: boolean; hostNow: number; seen: Record<string, number> }>',
|
|
380
383
|
description: "Read the unread-badge rule, the Host clock and the seen watermark.",
|
|
381
384
|
summary: "Read the unread-badge rule.",
|
|
382
385
|
jsDoc: "/** Read the unread-badge rule. */",
|
|
@@ -385,7 +388,7 @@ export const TYPERT = {
|
|
|
385
388
|
{
|
|
386
389
|
kind: 'method',
|
|
387
390
|
name: 'setUnreadRule',
|
|
388
|
-
signature: 'async setUnreadRule(request: { reasons: Record<string, boolean>; pending?: boolean; workspaceDot?: boolean; appBadge?: boolean; clearDelaySec?: number }): Promise<{ reasons: Record<string, boolean>; pending: boolean; workspaceDot: boolean; appBadge: boolean; clearDelaySec: number; hostNow: number; seen: Record<string, number> }>',
|
|
391
|
+
signature: 'async setUnreadRule(request: { reasons: Record<string, boolean>; pending?: boolean; workspaceDot?: boolean; appBadge?: boolean; clearDelaySec?: number; revealOnOpen?: boolean }): Promise<{ reasons: Record<string, boolean>; pending: boolean; workspaceDot: boolean; appBadge: boolean; clearDelaySec: number; revealOnOpen: boolean; hostNow: number; seen: Record<string, number> }>',
|
|
389
392
|
description: "Replace the unread-badge rule: which turn-end reasons light the red dot.",
|
|
390
393
|
summary: "Set the unread-badge rule.",
|
|
391
394
|
jsDoc: "/** Set the unread-badge rule. */",
|
package/lib/unread.js
CHANGED
|
@@ -46,12 +46,25 @@ export const UNREAD_PENDING_DEFAULT = true
|
|
|
46
46
|
/**
|
|
47
47
|
* 默认:在工作区那一行的文件夹图标上画红点。
|
|
48
48
|
*
|
|
49
|
-
*
|
|
49
|
+
* 这是全套功能里**贴着产品 DOM 走**的两处之一(另一处见下面的 `UNREAD_REVEAL_DEFAULT`),
|
|
50
50
|
* 所以它有自己的开关:一旦 DSH 升级改了结构导致它失效或画歪,
|
|
51
51
|
* 关掉它就行,红点数字/清单/跳转那些稳的部分完全不受影响。
|
|
52
52
|
*/
|
|
53
53
|
export const UNREAD_WORKSPACE_DOT_DEFAULT = true
|
|
54
54
|
|
|
55
|
+
/**
|
|
56
|
+
* 默认:点清单条目时,顺带在侧栏定位到那个会话(展开它所在的工作区、滚到那一行并闪一下)。
|
|
57
|
+
*
|
|
58
|
+
* 这是第二处贴着产品 DOM 走的部分。官方的"展开 + 滚动"只服务于它自己的搜索结果
|
|
59
|
+
* (内部状态,没有对外的 Service),所以插件只能**模拟点击**官方的工作区行与
|
|
60
|
+
* "显示更多"按钮。DSH 升级改结构时它会失效,失效的表现只有一个:
|
|
61
|
+
* **点进去照常打开会话,只是侧栏不动**。不想让它动侧栏就关掉这一项。
|
|
62
|
+
*
|
|
63
|
+
* 还有一件事要说清:展开是**官方自己记住**的状态(存在浏览器里),不会自己收回去 ——
|
|
64
|
+
* 官方搜索跳转也是这个行为。
|
|
65
|
+
*/
|
|
66
|
+
export const UNREAD_REVEAL_DEFAULT = true
|
|
67
|
+
|
|
55
68
|
/**
|
|
56
69
|
* 默认:在系统应用图标上显示角标(安装为应用后生效)。
|
|
57
70
|
*
|
|
@@ -97,8 +110,8 @@ export function normalizeReasons(input) {
|
|
|
97
110
|
|
|
98
111
|
/**
|
|
99
112
|
* 把任意输入夹成完整设置。
|
|
100
|
-
* @param input - `{ reasons?, pending?, workspaceDot?, appBadge?, clearDelaySec? }`,可以是脏的、缺项的、null
|
|
101
|
-
* @returns `{ reasons, pending, workspaceDot, appBadge, clearDelaySec }` —— 每一项都完整
|
|
113
|
+
* @param input - `{ reasons?, pending?, workspaceDot?, appBadge?, clearDelaySec?, revealOnOpen? }`,可以是脏的、缺项的、null
|
|
114
|
+
* @returns `{ reasons, pending, workspaceDot, appBadge, clearDelaySec, revealOnOpen }` —— 每一项都完整
|
|
102
115
|
*/
|
|
103
116
|
export function normalizeUnreadConfig(input) {
|
|
104
117
|
const source = input !== null && typeof input === 'object' ? input : {}
|
|
@@ -107,7 +120,8 @@ export function normalizeUnreadConfig(input) {
|
|
|
107
120
|
pending: typeof source.pending === 'boolean' ? source.pending : UNREAD_PENDING_DEFAULT,
|
|
108
121
|
workspaceDot: typeof source.workspaceDot === 'boolean' ? source.workspaceDot : UNREAD_WORKSPACE_DOT_DEFAULT,
|
|
109
122
|
appBadge: typeof source.appBadge === 'boolean' ? source.appBadge : UNREAD_APP_BADGE_DEFAULT,
|
|
110
|
-
clearDelaySec: normalizeClearDelay(source.clearDelaySec)
|
|
123
|
+
clearDelaySec: normalizeClearDelay(source.clearDelaySec),
|
|
124
|
+
revealOnOpen: typeof source.revealOnOpen === 'boolean' ? source.revealOnOpen : UNREAD_REVEAL_DEFAULT
|
|
111
125
|
}
|
|
112
126
|
}
|
|
113
127
|
|
package/package.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cowwo/dsh-icon-custom",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"description": "自定义浏览器标签页图标:在设置页上传 SVG/PNG/ICO,立即生效并持久保存,自动适配安卓/iOS/平板 PWA 图标,显示未读红点与进行中黄点(
|
|
3
|
+
"version": "0.19.1",
|
|
4
|
+
"description": "自定义浏览器标签页图标:在设置页上传 SVG/PNG/ICO,立即生效并持久保存,自动适配安卓/iOS/平板 PWA 图标,显示未读红点与进行中黄点(工作区数字/会话行/左上角/标签页,数字可点开清单、点条目定位到侧栏),并可把未读数显示为系统应用图标角标(Windows 任务栏 / macOS Dock,含通知权限申请)。· Custom browser tab favicon: upload SVG/PNG/ICO from the settings page, applies instantly and persists, auto-sizes PWA icons for Android/iOS/tablets, shows unread red dots and running yellow marks (workspace number / session row / top-left / tab icon, both counts open a list whose rows locate the session in the sidebar), and projects the unread count onto the system app-icon badge (Windows taskbar / macOS Dock, notifications permission included).",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "lib/index.js",
|
|
7
7
|
"license": "MIT",
|
|
8
8
|
"scripts": {
|
|
9
|
-
"test": "node test/app-badge.mjs && node test/notification-permission.mjs && node test/unread-panel.mjs && node test/unread-clear.mjs && node test/unread-rows.mjs && node test/unread-seen.mjs && node test/unread-host-sync.mjs && node test/running-mark.mjs"
|
|
9
|
+
"test": "node test/app-badge.mjs && node test/notification-permission.mjs && node test/unread-panel.mjs && node test/unread-clear.mjs && node test/unread-rows.mjs && node test/unread-seen.mjs && node test/unread-host-sync.mjs && node test/running-mark.mjs && node test/running-panel.mjs && node test/reveal.mjs"
|
|
10
10
|
},
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"jimp": "^1.6.1",
|