dsh-sidebar-fold 0.1.13 → 0.1.15
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +24 -0
- package/README.md +32 -0
- package/dsh.plugin.json +1 -1
- package/lib/client.js +4 -0
- package/package.json +2 -1
- package/src/client/settings-card.ts +6 -0
- package/src/client/star-row-copy.ts +111 -0
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
## 0.1.15
|
|
4
|
+
|
|
5
|
+
- 设置面新增 star 快车道行(单源 _tools/star-row 生成,10 语;GitHub 单色图标 + 仓库直达链接 + 一句工程话术,整行可点,无弹窗无打断)。
|
|
6
|
+
- 附带 CI 修复:本包无线标签时直接收工,不再空等读侧滞后。
|
|
7
|
+
|
|
8
|
+
## 0.1.14
|
|
9
|
+
|
|
10
|
+
- **CI 发版通道**:新增 `.github/workflows/release.yml`,打 tag 后由 GitHub Actions 依次完成
|
|
11
|
+
版本对齐、门禁、`npm pack --dry-run`、幂等检查、`npm publish`、`dsh-*` 线标签同步与
|
|
12
|
+
GitHub Release(带 `Latest` 徽标)。
|
|
13
|
+
- **`scripts/release-notes.mjs`**:Release 正文生成器,优先级
|
|
14
|
+
`RELEASE-NOTES-v<ver>.md` > `CHANGELOG.md` 版本节 > tag 提交信息;正文短于 80 字符或命中
|
|
15
|
+
空壳标记时拒绝写入,避免发布空壳 Release。
|
|
16
|
+
- **README 新增 Releases 一节**:写清本地 6 步与 CI 4 步的分界、dry_run 预演方式,以及
|
|
17
|
+
幂等重跑与线标签降级行为。
|
|
18
|
+
- 本文件为首次引入;之后每个版本在顶部新增一节,CI 从该节取 Release 正文。
|
|
19
|
+
|
|
20
|
+
## 0.1.13
|
|
21
|
+
|
|
22
|
+
- 折叠标记落在 panelEntry 包装层,避免与宿主行级 class 冲突(issue #2)。
|
|
23
|
+
- 新增第 10 种 runtime 字典 `pt`(巴西葡萄牙语),locale 文件与门禁同步到 10 种。
|
|
24
|
+
- README.pt.md 镜像翻译,`files[]` 收录。
|
package/README.md
CHANGED
|
@@ -103,6 +103,38 @@ npm run hosts:check # enumeration drift vs scripts/hosts.mjs (--write to repair
|
|
|
103
103
|
|
|
104
104
|
`prepack` runs build + verify, so a stale `lib/client.js` cannot be published.
|
|
105
105
|
|
|
106
|
+
## Releases
|
|
107
|
+
|
|
108
|
+
Releases are published by CI from a pushed tag; the local side only bumps and tags:
|
|
109
|
+
|
|
110
|
+
```sh
|
|
111
|
+
npm run ci # 1 the gate, run locally first
|
|
112
|
+
# 2 bump package.json AND dsh.plugin.json to the same number
|
|
113
|
+
# 3 add the new version section at the top of CHANGELOG.md
|
|
114
|
+
git commit -am "release(0.1.14): ..." # 4 version and changes in one commit
|
|
115
|
+
git tag v0.1.14 # 5 the tag points at that commit
|
|
116
|
+
git push origin main v0.1.14 # 6 pushing the tag is the trigger
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
`.github/workflows/release.yml` then does the rest: version alignment (tag / package.json /
|
|
120
|
+
`dsh.plugin.json`), dependency install, the gate, `npm pack --dry-run`, an idempotency guard
|
|
121
|
+
(`npm view <pkg>@<ver>`), `npm publish`, `dsh-*` line-tag sync with read-side retry, and the
|
|
122
|
+
GitHub Release carrying the `Latest` badge.
|
|
123
|
+
|
|
124
|
+
Two properties worth knowing before you tag:
|
|
125
|
+
|
|
126
|
+
- **Dry run first.** `gh workflow run release.yml -f tag=vX -f dry_run=true` runs every step
|
|
127
|
+
except publish / line-tag sync / Release, so a broken gate is found while the version is
|
|
128
|
+
still unpublished.
|
|
129
|
+
- **Re-publishing is idempotent.** If the version already exists in the registry the job skips
|
|
130
|
+
the publish block and warns instead of failing, so re-dispatching the same tag is safe.
|
|
131
|
+
A line-tag sync failure only warns (publish has already succeeded) and the job summary
|
|
132
|
+
prints the local repair command.
|
|
133
|
+
|
|
134
|
+
Release notes are built by `scripts/release-notes.mjs`: `RELEASE-NOTES-v<ver>.md` > the version
|
|
135
|
+
section of `CHANGELOG.md` > the tag message, with a minimum body length so that an empty shell
|
|
136
|
+
cannot be published.
|
|
137
|
+
|
|
106
138
|
## Supported hosts
|
|
107
139
|
|
|
108
140
|
**DSH hosts `>=0.2.1-rc.3 <0.3.0`** (the "More" row first ships in 0.2.1-rc.3; newer 0.2.x rcs stay installable without a republish). Single source of truth: `scripts/hosts.mjs` — `engines.dsh` carries that bounded range, `peerDependencies` keep the per-rc enumeration (npm resolution never assumes `includePrerelease`), and `dsh.plugin.json` mirrors the range; all generated, never hand-edited.
|
package/dsh.plugin.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"id": "dsh-external/dsh-sidebar-fold",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.15",
|
|
4
4
|
"main": "./src/index.js",
|
|
5
5
|
"description": "折叠左侧栏加项入口:在宿主「更多」行挂一个 28×28 方形箭头按钮,把自动化任务、agent 团队、插件市场、上下文页等加项面板行收纳成一行;设置卡每行三档:显示(一直显示)/ 折叠(允许折叠)/ 隐藏到更多(移进宿主「更多」菜单,宿主 0.2.2 起)。还可调默认态与行内文字图标对齐(左/居中/右)。",
|
|
6
6
|
"engines": {
|
package/lib/client.js
CHANGED
|
@@ -1828,6 +1828,10 @@ window.__ModuleLoader__.load({
|
|
|
1828
1828
|
note.textContent = dict['settings.readonly'];
|
|
1829
1829
|
cardRoot.appendChild(note);
|
|
1830
1830
|
}
|
|
1831
|
+
// star 快车道行(单源 _tools/star-row,改副本无效;重渲染随 cardRoot 一起重建)
|
|
1832
|
+
const starRow = mountStarRow();
|
|
1833
|
+
starRow.setAttribute(ATTR.own, '');
|
|
1834
|
+
cardRoot.appendChild(starRow);
|
|
1831
1835
|
}
|
|
1832
1836
|
/**
|
|
1833
1837
|
* Point the card at a settings scope (called by `index.ts` when a waist resolves).
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-sidebar-fold",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.15",
|
|
4
4
|
"description": "Folds the sidebar's add-on panel rows under the shipped \"More\" row, and from host 0.2.2 on gives every row three states — show, fold, or hide in the host's own \"More\" list. The fold state persists per window, rows are read from the live sidebar, and the managed rows' icon + label can be aligned left, centre or right.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "src/index.js",
|
|
@@ -19,6 +19,7 @@
|
|
|
19
19
|
"cordis.patch.yml",
|
|
20
20
|
"dsh.plugin.json",
|
|
21
21
|
"README.md",
|
|
22
|
+
"CHANGELOG.md",
|
|
22
23
|
"README.zh.md",
|
|
23
24
|
"README.pt.md"
|
|
24
25
|
],
|
|
@@ -20,6 +20,7 @@
|
|
|
20
20
|
*/
|
|
21
21
|
import { ATTR, CLS, type AlignMode } from './constants.ts'
|
|
22
22
|
import { pickDictionary } from './locales.ts'
|
|
23
|
+
import { mountStarRow } from './star-row-copy.ts'
|
|
23
24
|
import {
|
|
24
25
|
applyConfig,
|
|
25
26
|
canMoveToMore,
|
|
@@ -395,6 +396,11 @@ function paint(): void {
|
|
|
395
396
|
note.textContent = dict['settings.readonly']
|
|
396
397
|
cardRoot.appendChild(note)
|
|
397
398
|
}
|
|
399
|
+
|
|
400
|
+
// star 快车道行(单源 _tools/star-row,改副本无效;重渲染随 cardRoot 一起重建)
|
|
401
|
+
const starRow = mountStarRow()
|
|
402
|
+
starRow.setAttribute(ATTR.own, '')
|
|
403
|
+
cardRoot.appendChild(starRow)
|
|
398
404
|
}
|
|
399
405
|
|
|
400
406
|
/**
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* star-row 真源(面板 star 快车道行,v1)——纯 DOM 实现,零依赖。
|
|
3
|
+
*
|
|
4
|
+
* 副本约束:生成文件名 star-row-copy.ts,头部须保留 /** 块注释,单行 ≤140
|
|
5
|
+
* 字宽(sidebar-fold 仓 lint 门禁:max-line + file-header)。
|
|
6
|
+
*
|
|
7
|
+
* 契约(对齐 panel-star-row spec):
|
|
8
|
+
* - 渲染一行 <a>:GitHub 单色 SVG + `owner/name`;variant A 追加一句工程话术;
|
|
9
|
+
* - 整行即链接(A/L 档),新标签页打开;不做弹窗、不做按钮交互;
|
|
10
|
+
* - 文案内嵌 10 语,按 `document.documentElement.lang` 前缀自选
|
|
11
|
+
* (同 sidebar-fold `pickDictionary` 口径),不依赖宿主 locale 服务,
|
|
12
|
+
* 避免逐仓动字典文件;
|
|
13
|
+
* - 样式一次性注入 <style data-dsh-star-row>,色随 currentColor,深浅主题自适应;
|
|
14
|
+
* - 副本由 _tools/star-row/sync.mjs 生成到各仓 `src/client/star-row-copy.ts`
|
|
15
|
+
* (文件名含 copy,locale 守卫豁免规则命中),改副本无效,改真源后重跑 sync。
|
|
16
|
+
*
|
|
17
|
+
* 每仓生成时在文件头部烘焙 REPO_URL / STAR_NS / STAR_VARIANT 三个常量。
|
|
18
|
+
*/
|
|
19
|
+
|
|
20
|
+
/** 生成段:REPO_URL / STAR_NS / STAR_VARIANT 由 sync 注入。 */
|
|
21
|
+
// STAR-CONSTS:BEGIN — generated by _tools/star-row/sync.mjs; edit the real source instead
|
|
22
|
+
const REPO_URL = "https://github.com/drscrewdriver/dsh-sidebar-fold";
|
|
23
|
+
const STAR_NS = "sidebar-fold";
|
|
24
|
+
const STAR_VARIANT = "A" as const;
|
|
25
|
+
// STAR-CONSTS:END
|
|
26
|
+
|
|
27
|
+
/** zh 为键集真理源;10 语与 sidebar-fold/manage-session 同集合。 */
|
|
28
|
+
const STAR_COPY: Record<string, { ask: string }> = {
|
|
29
|
+
zh: { ask: "觉得省事了?一颗 Star 让工具被更多人看见" },
|
|
30
|
+
en: { ask: "Finding it handy? A star helps more people discover this tool" },
|
|
31
|
+
ja: { ask: "便利でしたら⭐で、このツールがもっと届きます" },
|
|
32
|
+
ko: { ask: "유용했다면 ⭐ 하나로 더 많은 사용자에게 닿습니다" },
|
|
33
|
+
fr: { ask: "Utile ? Une étoile aide cet outil à être découvert" },
|
|
34
|
+
de: { ask: "Nützlich? Ein Stern hilft dem Tool, gesehen zu werden" },
|
|
35
|
+
it: { ask: "Ti è utile? Una stella aiuta questo tool a farsi scoprire" },
|
|
36
|
+
ru: { ask: "Пригодилось? Звезда поможет большему числу людей узнать о tool" },
|
|
37
|
+
es: { ask: "¿Te resulta útil? Una estrella ayuda a que más gente lo descubra" },
|
|
38
|
+
pt: { ask: "Achou útil? Uma estrela ajuda mais pessoas a descobrir a ferramenta" },
|
|
39
|
+
};
|
|
40
|
+
const STAR_LANGS = ["zh", "en", "ja", "ko", "fr", "de", "it", "ru", "es", "pt"];
|
|
41
|
+
|
|
42
|
+
/** GitHub mark(Simple Icons / octicon 轮廓,24 视口),fill 随 currentColor。 */
|
|
43
|
+
const GITHUB_MARK_PATH =
|
|
44
|
+
"M12 .297c-6.63 0-12 5.373-12 12 0 5.303 3.438 9.8 8.205 11.385.6.113.82-.258.82-.577" +
|
|
45
|
+
" 0-.285-.01-1.04-.015-2.04-3.338.724-4.042-1.61-4.042-1.61C4.422 18.07 3.633 17.7" +
|
|
46
|
+
" 3.633 17.7c-1.087-.744.084-.729.084-.729 1.205.084 1.838 1.236 1.838 1.236 1.07" +
|
|
47
|
+
" 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3-5.466-1.332" +
|
|
48
|
+
" -5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523.105-3.176 0 0" +
|
|
49
|
+
" 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552" +
|
|
50
|
+
" 3.285-1.23 3.285-1.23.645 1.653.24 2.873.12 3.176.765.84 1.23 1.91 1.23 3.22 0" +
|
|
51
|
+
" 4.61-2.805 5.625-5.475 5.92.42.36.81 1.096.81 2.22 0 1.606-.015 2.896-.015" +
|
|
52
|
+
" 3.286 0 .315.21.69.825.57C20.565 22.092 24 17.592 24 12.297c0-6.627-5.373-12-12-12";
|
|
53
|
+
|
|
54
|
+
const STYLE_ID = "dsh-star-row-style";
|
|
55
|
+
const STYLE_CSS = [
|
|
56
|
+
".dsh-star-row{display:flex;align-items:center;gap:7px;font-size:12px;",
|
|
57
|
+
"line-height:1.5;color:inherit;text-decoration:none;opacity:.72;padding:3px 0;",
|
|
58
|
+
"margin-top:6px;min-width:0;flex-wrap:wrap}",
|
|
59
|
+
".dsh-star-row:hover{opacity:1;text-decoration:underline}",
|
|
60
|
+
".dsh-star-row svg{width:14px;height:14px;flex:none;display:block}",
|
|
61
|
+
".dsh-star-row .dsh-star-ask{opacity:.85;font-weight:400}",
|
|
62
|
+
].join("");
|
|
63
|
+
|
|
64
|
+
function pickLang(): { ask: string } {
|
|
65
|
+
const tag = (typeof document !== "undefined" && document.documentElement.lang) || "";
|
|
66
|
+
const low = tag.toLowerCase();
|
|
67
|
+
for (const cand of STAR_LANGS) {
|
|
68
|
+
if (low.startsWith(cand)) return STAR_COPY[cand];
|
|
69
|
+
}
|
|
70
|
+
return STAR_COPY.en;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
/** 在目标文档上建出快车道行(一次性注入样式)。纯 DOM,React 仓经 ref 回调挂载。 */
|
|
74
|
+
export function mountStarRow(doc?: Document): HTMLElement {
|
|
75
|
+
const d = doc ?? document;
|
|
76
|
+
if (!d.getElementById(STYLE_ID)) {
|
|
77
|
+
const tag = d.createElement("style");
|
|
78
|
+
tag.id = STYLE_ID;
|
|
79
|
+
tag.textContent = STYLE_CSS;
|
|
80
|
+
d.head.appendChild(tag);
|
|
81
|
+
}
|
|
82
|
+
const repo = (REPO_URL.match(/github\.com\/([^/]+\/[^/#?]+)/) ?? [, "drscrewdriver"])[1];
|
|
83
|
+
const a = d.createElement("a");
|
|
84
|
+
a.className = "dsh-star-row";
|
|
85
|
+
a.href = REPO_URL;
|
|
86
|
+
a.target = "_blank";
|
|
87
|
+
a.rel = "noreferrer";
|
|
88
|
+
a.dataset.starNs = STAR_NS;
|
|
89
|
+
|
|
90
|
+
const svg = d.createElementNS("http://www.w3.org/2000/svg", "svg");
|
|
91
|
+
svg.setAttribute("viewBox", "0 0 24 24");
|
|
92
|
+
svg.setAttribute("aria-hidden", "true");
|
|
93
|
+
const path = d.createElementNS("http://www.w3.org/2000/svg", "path");
|
|
94
|
+
path.setAttribute("fill", "currentColor");
|
|
95
|
+
path.setAttribute("d", GITHUB_MARK_PATH);
|
|
96
|
+
svg.appendChild(path);
|
|
97
|
+
a.appendChild(svg);
|
|
98
|
+
|
|
99
|
+
const label = d.createElement("span");
|
|
100
|
+
label.textContent = repo;
|
|
101
|
+
a.appendChild(label);
|
|
102
|
+
|
|
103
|
+
if (STAR_VARIANT === "A") {
|
|
104
|
+
const ask = d.createElement("span");
|
|
105
|
+
ask.className = "dsh-star-ask";
|
|
106
|
+
ask.textContent = pickLang().ask;
|
|
107
|
+
a.appendChild(ask);
|
|
108
|
+
}
|
|
109
|
+
// L 档:仅中性仓库链接,无话术。S 档细条在后续批次扩展。
|
|
110
|
+
return a;
|
|
111
|
+
}
|