dsh-sidebar-fold 0.1.14 → 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 +5 -0
- package/LICENSE +21 -21
- package/cordis.patch.yml +17 -17
- package/dsh.plugin.json +1 -1
- package/lib/client.js +4 -0
- package/package.json +1 -1
- package/screenshots.json +6 -6
- package/src/client/settings-card.ts +6 -0
- package/src/client/star-row-copy.ts +111 -0
package/CHANGELOG.md
CHANGED
package/LICENSE
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2026 drscrewdriver
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
in the Software without restriction, including without limitation the rights
|
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
11
|
-
|
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
copies or substantial portions of the Software.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
SOFTWARE.
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 drscrewdriver
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/cordis.patch.yml
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
# dsh-sidebar-fold bundle patch
|
|
2
|
-
#
|
|
3
|
-
# Assembly layer for the DSH profiles whose bundle list includes this package.
|
|
4
|
-
# A pure ADDITION: one insert row carrying an id no shipped entry uses. No
|
|
5
|
-
# shipped row is disabled, renamed, or reconfigured here, so the patch stays
|
|
6
|
-
# safe to compose with any other plugin's patch.
|
|
7
|
-
#
|
|
8
|
-
# The row exists so the loader has a host-side entry point (src/index.js, which
|
|
9
|
-
# installs nothing) and so the bundle's settings namespace is served under this
|
|
10
|
-
# package's name; every behaviour lives in the browser half (lib/client.js).
|
|
11
|
-
#
|
|
12
|
-
# Install (recommended, official CLI):
|
|
13
|
-
# dsh plugin --profile <profile> add dsh-sidebar-fold
|
|
14
|
-
|
|
15
|
-
- insert:
|
|
16
|
-
- id: dsh-sidebar-fold
|
|
17
|
-
name: dsh-sidebar-fold
|
|
1
|
+
# dsh-sidebar-fold bundle patch
|
|
2
|
+
#
|
|
3
|
+
# Assembly layer for the DSH profiles whose bundle list includes this package.
|
|
4
|
+
# A pure ADDITION: one insert row carrying an id no shipped entry uses. No
|
|
5
|
+
# shipped row is disabled, renamed, or reconfigured here, so the patch stays
|
|
6
|
+
# safe to compose with any other plugin's patch.
|
|
7
|
+
#
|
|
8
|
+
# The row exists so the loader has a host-side entry point (src/index.js, which
|
|
9
|
+
# installs nothing) and so the bundle's settings namespace is served under this
|
|
10
|
+
# package's name; every behaviour lives in the browser half (lib/client.js).
|
|
11
|
+
#
|
|
12
|
+
# Install (recommended, official CLI):
|
|
13
|
+
# dsh plugin --profile <profile> add dsh-sidebar-fold
|
|
14
|
+
|
|
15
|
+
- insert:
|
|
16
|
+
- id: dsh-sidebar-fold
|
|
17
|
+
name: dsh-sidebar-fold
|
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",
|
package/screenshots.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
{
|
|
2
|
-
"screenshots": [
|
|
3
|
-
"assets/middle.png",
|
|
4
|
-
"assets/fold.png"
|
|
5
|
-
]
|
|
6
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"screenshots": [
|
|
3
|
+
"assets/middle.png",
|
|
4
|
+
"assets/fold.png"
|
|
5
|
+
]
|
|
6
|
+
}
|
|
@@ -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
|
+
}
|