lantern-harness 0.1.34 → 0.1.36
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 +46 -0
- package/README.md +2 -2
- package/builtin/session/lh-nav-groups.mjs +9 -0
- package/cli/server.mjs +2 -0
- package/config/app.defaults.json +2 -1
- package/dist/500.html +72 -9
- package/dist/_astro/Base.B-G3Zgu4.css +1 -0
- package/dist/_astro/{Base.astro_astro_type_script_index_0_lang.CuCwv2e7.js → Base.astro_astro_type_script_index_0_lang.CvmRHkFv.js} +1 -1
- package/dist/_astro/CaseExecBoard.BWxBjYPI.js +1 -0
- package/dist/_astro/{CaseGenerateApp.BONj-skB.js → CaseGenerateApp.BxkQ-HTK.js} +1 -1
- package/dist/_astro/CasesLibrary.BU1q0MvV.js +24 -0
- package/dist/_astro/ChatApp.DXlSptIj.js +226 -0
- package/dist/_astro/ColumnResize.CkE59sGq.js +1 -0
- package/dist/_astro/{DashboardBoard.BaJyXPXA.js → DashboardBoard.BuyuI8WW.js} +1 -1
- package/dist/_astro/{DocsFileBrowser.D2Cff2LP.js → DocsFileBrowser.9WTBumS5.js} +1 -1
- package/dist/_astro/{DocsPager.CnXEnQqa.js → DocsPager.BS20yicJ.js} +1 -1
- package/dist/_astro/{DrawerField.C0MkN-LW.js → DrawerField.CiHAvXHQ.js} +1 -1
- package/dist/_astro/{KnowledgeLibrary.CWxIHa8I.js → KnowledgeLibrary.CiBRybeE.js} +1 -1
- package/dist/_astro/LifeKrTasksBoard.RENBU_z9.js +1 -0
- package/dist/_astro/LifeKrTodosBoard.CbNnGHSZ.js +1 -0
- package/dist/_astro/LifeObjectivesBoard.BTGFpny2.js +1 -0
- package/dist/_astro/LifePlanTypeSelect.BGtEEsL-.js +1 -0
- package/dist/_astro/LifeReviewsBoard.Bn-uxMI5.js +5 -0
- package/dist/_astro/LifeShared.SnLIiFdN.js +3 -0
- package/dist/_astro/LifeStagesBoard.DrbIVrCK.js +1 -0
- package/dist/_astro/LifeYearCycleSelect.CuiWO8Tc.js +1 -0
- package/dist/_astro/LifeYearPlansBoard.ChAoQUB5.js +1 -0
- package/dist/_astro/MultiSelectDropdown.y8JMbCxO.js +1 -0
- package/dist/_astro/{NavLibraries.CZlA6Z1w.js → NavLibraries.D9EKoN80.js} +1 -1
- package/dist/_astro/{PluginsPage.DOGWQcVc.js → PluginsPage.Bxu1FEvU.js} +1 -1
- package/dist/_astro/PluginsPage.C_hLqPed.js +1 -0
- package/dist/_astro/{PmBugsBoard.ChL0RBVn.js → PmBugsBoard.Cu1uf0TC.js} +1 -1
- package/dist/_astro/{PmIterationsBoard.hTKVnMgh.js → PmIterationsBoard.RzRKkAH0.js} +1 -1
- package/dist/_astro/{PmProjectDetail.Saj76lNM.js → PmProjectDetail.DH8Z3nHb.js} +1 -1
- package/dist/_astro/{PmProjectsBoard.CCtClGM1.js → PmProjectsBoard.Dokaj4V1.js} +1 -1
- package/dist/_astro/{PmRequirementsBoard.DGXYC1Te.js → PmRequirementsBoard.DET5YIVX.js} +1 -1
- package/dist/_astro/PmRequirementsBoard.i203nmYC.js +1 -0
- package/dist/_astro/{PmShared.BuhrL7Gb.js → PmShared.BJpoEYvk.js} +1 -1
- package/dist/_astro/{PromptsLibrary.C9F9RVpz.js → PromptsLibrary.D3huSjPf.js} +1 -1
- package/dist/_astro/ReportsPage.BU3GtBvl.js +1 -0
- package/dist/_astro/{ReqAnalysisBoard.JfmIK2Bb.js → ReqAnalysisBoard.DGrYx1I5.js} +1 -1
- package/dist/_astro/{RequirementsLibrary.WxAFCP3X.js → RequirementsLibrary.BnY7_YXU.js} +1 -1
- package/dist/_astro/{SearchableSelect.D3ODywC4.js → SearchableSelect.5SfNLwNW.js} +1 -1
- package/dist/_astro/SelectDropdown.TgxIOKMD.js +1 -0
- package/dist/_astro/{SettingsDialog.BpKHIbID.js → SettingsDialog.C3qqpZPT.js} +1 -1
- package/dist/_astro/{SpaceSwitcher.BCZbiL7o.js → SpaceSwitcher.Cy4UrzbH.js} +1 -1
- package/dist/_astro/TasksBoard.CWkx5cD1.js +1 -0
- package/dist/_astro/{TemplatesLibrary.y_RtSjYC.js → TemplatesLibrary.phzK5kho.js} +1 -1
- package/dist/_astro/{TestStatsBoard.C3vkF9vc.js → TestStatsBoard.Dp1TWEf7.js} +1 -1
- package/dist/_astro/TodosBoard.ofiKHKcQ.js +1 -0
- package/dist/_astro/{UiAutoBoard._og5jRon.js → UiAutoBoard.Cpb_EF46.js} +1 -1
- package/dist/_astro/app-config.C4rpn1Ix.js +1 -0
- package/dist/_astro/app-version.BuvzE2YQ.js +1 -0
- package/dist/_astro/{bash-tools.cciCC33C.js → bash-tools.RQcI4_42.js} +1 -1
- package/dist/_astro/{case-exec.BLqTXR7U.js → case-exec.BMNk9OyF.js} +1 -1
- package/dist/_astro/{case-gen-run.BSJ0o4Zq.js → case-gen-run.BWQpCgpW.js} +1 -1
- package/dist/_astro/{case-types.CJ5PHz59.js → case-types.CprZTsyX.js} +1 -1
- package/dist/_astro/{hydrate-cache.B7--LFB_.js → hydrate-cache.DI6vqM0o.js} +1 -1
- package/dist/_astro/i18n.BJeTr39S.js +7 -0
- package/dist/_astro/open-docs-in-session.5cTowYAC.js +1 -0
- package/dist/_astro/plugins.C0NrHGZv.js +1 -0
- package/dist/_astro/{report-prompt.CAfZ6RIo.js → report-prompt.B9C4cv84.js} +1 -1
- package/dist/_astro/{req-analysis.D-dTIxXF.js → req-analysis.BOz9djQo.js} +1 -1
- package/dist/_astro/{settings.Cu00if4D.js → settings.NTeTjmxg.js} +2 -2
- package/dist/_astro/{spaces-client.Czm-VPh5.js → spaces-client.CMGNsQJ-.js} +1 -1
- package/dist/_astro/{story-review.CvXvtZ90.js → story-review.Bvz3alFd.js} +1 -1
- package/dist/_astro/tasks.DefXqRfI.js +1 -0
- package/dist/_astro/{view-prefs.SdItxolG.js → view-prefs.8MPl3A7e.js} +1 -1
- package/dist/case-exec/index.html +141 -15
- package/dist/cases/generate/index.html +73 -10
- package/dist/cases/library/index.html +141 -15
- package/dist/dashboard/index.html +141 -15
- package/dist/docs/changelog/index.html +150 -45
- package/dist/docs/install/index.html +77 -9
- package/dist/docs/manual/index.html +142 -18
- package/dist/knowledge/index.html +141 -15
- package/dist/life/kr-tasks/index.html +921 -0
- package/dist/life/kr-todos/index.html +921 -0
- package/dist/life/objectives/index.html +921 -0
- package/dist/life/reviews/index.html +921 -0
- package/dist/life/stages/index.html +921 -0
- package/dist/life/year-plans/index.html +921 -0
- package/dist/plugins/index.html +73 -10
- package/dist/pm/bugs/index.html +141 -15
- package/dist/pm/iterations/index.html +141 -15
- package/dist/pm/projects/detail/index.html +141 -15
- package/dist/pm/projects/index.html +141 -15
- package/dist/pm/requirements/index.html +141 -15
- package/dist/prompts/index.html +141 -15
- package/dist/reports/index.html +141 -15
- package/dist/requirement-analysis/index.html +141 -15
- package/dist/requirements/index.html +141 -15
- package/dist/tasks/index.html +141 -15
- package/dist/templates/index.html +141 -15
- package/dist/test-automation/index.html +141 -15
- package/dist/test-stats/index.html +141 -15
- package/dist/todos/index.html +141 -15
- package/dist/workbench/index.html +73 -10
- package/docs//345/256/211/350/243/205/346/211/213/345/206/214.md +1 -0
- package/docs//346/223/215/344/275/234/346/211/213/345/206/214.md +36 -8
- package/lh-plugins/lh-life.mjs +1130 -0
- package/lh-plugins/lh-reports.mjs +50 -0
- package/package.json +1 -1
- package/dist/_astro/Base.huFPH3Mp.css +0 -1
- package/dist/_astro/CaseExecBoard.CTVdi8MV.js +0 -1
- package/dist/_astro/CasesLibrary.e6nFqhN3.js +0 -24
- package/dist/_astro/ChatApp.XcaVtt7c.js +0 -226
- package/dist/_astro/ColumnResize._Iq05ix_.js +0 -1
- package/dist/_astro/MultiSelectDropdown.BHxW9XLR.js +0 -1
- package/dist/_astro/PluginsPage.Ch3rrYRF.js +0 -1
- package/dist/_astro/PmRequirementsBoard.BNNq671Z.js +0 -1
- package/dist/_astro/ReportsPage.BjD8w0zS.js +0 -1
- package/dist/_astro/SelectDropdown.apWlFGbA.js +0 -1
- package/dist/_astro/TasksBoard.CdWQSwlg.js +0 -1
- package/dist/_astro/TodosBoard.CSupMlTp.js +0 -1
- package/dist/_astro/app-config.Bg6v8zQQ.js +0 -1
- package/dist/_astro/app-version.trTEbNVs.js +0 -1
- package/dist/_astro/i18n.CH6ZNsHf.js +0 -7
- package/dist/_astro/open-docs-in-session.DQ2_5fkC.js +0 -1
- package/dist/_astro/plugins.CVnHeKyf.js +0 -1
- package/dist/_astro/tasks.jfnSAEmg.js +0 -1
|
@@ -0,0 +1,921 @@
|
|
|
1
|
+
<!DOCTYPE html><html lang="zh-CN"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1"><link rel="icon" type="image/png" sizes="32x32" href="/brand/favicon.png"><link rel="apple-touch-icon" href="/brand/apple-touch-icon.png"><title>人生阶段 · Lantern Harness</title><script>
|
|
2
|
+
// 尽早禁用滚动恢复,避免整页跳转/切页时停在旧滚动位置造成文字叠影
|
|
3
|
+
try {
|
|
4
|
+
if ('scrollRestoration' in history) history.scrollRestoration = 'manual';
|
|
5
|
+
} catch (e) {}
|
|
6
|
+
</script><script type="module" src="/_astro/Base.astro_astro_type_script_index_0_lang.CvmRHkFv.js"></script><meta name="astro-view-transitions-enabled" content="true"><meta name="astro-view-transitions-fallback" content="animate"><script type="module" src="/_astro/ClientRouter.astro_astro_type_script_index_0_lang.CO1cjG9V.js"></script><script>
|
|
7
|
+
(function () {
|
|
8
|
+
try {
|
|
9
|
+
// 配置按空间分键(`tw.app.config.v1::<spaceId>`),主题必须从同一个键读,
|
|
10
|
+
// 否则深色下刷新会先按浅色画一帧、等脚本跑完才变黑(闪白)。
|
|
11
|
+
var earlySpaceId = (
|
|
12
|
+
sessionStorage.getItem('tw.space.active-id') ||
|
|
13
|
+
localStorage.getItem('tw.space.active-id') ||
|
|
14
|
+
''
|
|
15
|
+
).trim();
|
|
16
|
+
var raw =
|
|
17
|
+
(earlySpaceId ? localStorage.getItem('tw.app.config.v1::' + earlySpaceId) : null) ||
|
|
18
|
+
localStorage.getItem('tw.app.config.v1');
|
|
19
|
+
var cfg = raw ? JSON.parse(raw) : null;
|
|
20
|
+
var g = (cfg && cfg.general) || {};
|
|
21
|
+
var root = document.documentElement;
|
|
22
|
+
if (raw) {
|
|
23
|
+
var size = typeof g.sessionFontSize === 'number' ? Math.round(g.sessionFontSize) : 14;
|
|
24
|
+
if (size < 12) size = 12;
|
|
25
|
+
if (size > 22) size = 22;
|
|
26
|
+
var px = size + 'px';
|
|
27
|
+
root.style.setProperty('--tw-ui-font-size', px);
|
|
28
|
+
root.style.setProperty('--tw-session-font-size', px);
|
|
29
|
+
if (g.language === 'en') root.lang = 'en';
|
|
30
|
+
}
|
|
31
|
+
// 没有配置时按系统偏好定主题:早一帧定下来,页面就不会先亮后暗
|
|
32
|
+
var appearance = g.appearance;
|
|
33
|
+
var theme =
|
|
34
|
+
appearance === 'dark' || appearance === 'light'
|
|
35
|
+
? appearance
|
|
36
|
+
: window.matchMedia('(prefers-color-scheme: dark)').matches
|
|
37
|
+
? 'dark'
|
|
38
|
+
: 'light';
|
|
39
|
+
root.dataset.theme = theme;
|
|
40
|
+
root.style.colorScheme = theme;
|
|
41
|
+
if (localStorage.getItem('tw.nav.collapsed') === '1') {
|
|
42
|
+
document.documentElement.dataset.navCollapsed = '1';
|
|
43
|
+
}
|
|
44
|
+
var spaceId = earlySpaceId;
|
|
45
|
+
var cfgKey = spaceId ? 'tw.app.config.v1::' + spaceId : 'tw.app.config.v1';
|
|
46
|
+
var cfgRaw = localStorage.getItem(cfgKey) || localStorage.getItem('tw.app.config.v1');
|
|
47
|
+
if (cfgRaw) {
|
|
48
|
+
var savedCfg = JSON.parse(cfgRaw) || {};
|
|
49
|
+
var plugins = savedCfg.plugins || {};
|
|
50
|
+
if (plugins.cases === false) document.documentElement.dataset.pluginOffCases = '1';
|
|
51
|
+
if (plugins.todos === false) document.documentElement.dataset.pluginOffTodos = '1';
|
|
52
|
+
if (plugins.tasks === false) document.documentElement.dataset.pluginOffTasks = '1';
|
|
53
|
+
if (plugins.projects !== true) document.documentElement.dataset.pluginOffProjects = '1';
|
|
54
|
+
if (plugins.iterations !== true)
|
|
55
|
+
document.documentElement.dataset.pluginOffIterations = '1';
|
|
56
|
+
if (plugins.pmRequirements !== true)
|
|
57
|
+
document.documentElement.dataset.pluginOffPmRequirements = '1';
|
|
58
|
+
if (plugins.bugs !== true) document.documentElement.dataset.pluginOffBugs = '1';
|
|
59
|
+
if (plugins.reports !== true) document.documentElement.dataset.pluginOffReports = '1';
|
|
60
|
+
if (plugins.testStats !== true)
|
|
61
|
+
document.documentElement.dataset.pluginOffTestStats = '1';
|
|
62
|
+
if (plugins.caseExec !== true) document.documentElement.dataset.pluginOffCaseExec = '1';
|
|
63
|
+
if (plugins.dashboard !== true)
|
|
64
|
+
document.documentElement.dataset.pluginOffDashboard = '1';
|
|
65
|
+
if (plugins.knowledgeLib === false)
|
|
66
|
+
document.documentElement.dataset.pluginOffKnowledgeLib = '1';
|
|
67
|
+
if (plugins.requirements === false)
|
|
68
|
+
document.documentElement.dataset.pluginOffRequirements = '1';
|
|
69
|
+
if (plugins.templates === false)
|
|
70
|
+
document.documentElement.dataset.pluginOffTemplates = '1';
|
|
71
|
+
// 本地已有菜单布局:静态占位(固定顺序平铺)不再亮相,避免闪一下「排序前」
|
|
72
|
+
if (Array.isArray(savedCfg.navGroups) || Array.isArray(savedCfg.navOrder)) {
|
|
73
|
+
document.documentElement.dataset.navCached = '1';
|
|
74
|
+
// 兜底:脚本没跑起来(岛始终为空)时把占位放回来,别让侧栏彻底空着
|
|
75
|
+
window.setTimeout(function () {
|
|
76
|
+
var island = document.querySelector('.tw-nav-libraries astro-island');
|
|
77
|
+
if (!island || !island.querySelector('.tw-nav-item-main')) {
|
|
78
|
+
document.documentElement.removeAttribute('data-nav-cached');
|
|
79
|
+
}
|
|
80
|
+
}, 3000);
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
// 有了侧栏刷新缓存(上次真实渲染的 DOM)也不必再摆平铺占位:
|
|
84
|
+
// 否则收起的分组会先以「平铺展开」的样子闪一下再变成分组
|
|
85
|
+
try {
|
|
86
|
+
var navCacheKey = spaceId ? 'tw.hydrate.nav::' + spaceId : 'tw.hydrate.nav';
|
|
87
|
+
if (localStorage.getItem(navCacheKey)) {
|
|
88
|
+
document.documentElement.dataset.navCached = '1';
|
|
89
|
+
window.setTimeout(function () {
|
|
90
|
+
var island = document.querySelector('.tw-nav-libraries astro-island');
|
|
91
|
+
if (!island || !island.querySelector('.tw-nav-item-main')) {
|
|
92
|
+
document.documentElement.removeAttribute('data-nav-cached');
|
|
93
|
+
}
|
|
94
|
+
}, 3000);
|
|
95
|
+
}
|
|
96
|
+
} catch (e) {
|
|
97
|
+
/* ignore */
|
|
98
|
+
}
|
|
99
|
+
} catch (e) {}
|
|
100
|
+
})();
|
|
101
|
+
</script><link rel="stylesheet" href="/_astro/Base.B-G3Zgu4.css"><script type="module" src="/_astro/page.Bx2KSkeL.js"></script><style>[data-astro-transition-scope="astro-bbhp3f5g-3"] { view-transition-name: astro-bbhp3f5g-3; }@layer astro { ::view-transition-old(astro-bbhp3f5g-3) {
|
|
102
|
+
animation-duration: 180ms;
|
|
103
|
+
animation-timing-function: cubic-bezier(0.76, 0, 0.24, 1);
|
|
104
|
+
animation-fill-mode: both;
|
|
105
|
+
animation-name: astroFadeOut; }::view-transition-new(astro-bbhp3f5g-3) {
|
|
106
|
+
animation-duration: 180ms;
|
|
107
|
+
animation-timing-function: cubic-bezier(0.76, 0, 0.24, 1);
|
|
108
|
+
animation-fill-mode: both;
|
|
109
|
+
animation-name: astroFadeIn; }[data-astro-transition=back]::view-transition-old(astro-bbhp3f5g-3) {
|
|
110
|
+
animation-duration: 180ms;
|
|
111
|
+
animation-timing-function: cubic-bezier(0.76, 0, 0.24, 1);
|
|
112
|
+
animation-fill-mode: both;
|
|
113
|
+
animation-name: astroFadeOut; }[data-astro-transition=back]::view-transition-new(astro-bbhp3f5g-3) {
|
|
114
|
+
animation-duration: 180ms;
|
|
115
|
+
animation-timing-function: cubic-bezier(0.76, 0, 0.24, 1);
|
|
116
|
+
animation-fill-mode: both;
|
|
117
|
+
animation-name: astroFadeIn; } }[data-astro-transition-fallback="old"] [data-astro-transition-scope="astro-bbhp3f5g-3"],
|
|
118
|
+
[data-astro-transition-fallback="old"][data-astro-transition-scope="astro-bbhp3f5g-3"] {
|
|
119
|
+
animation-duration: 180ms;
|
|
120
|
+
animation-timing-function: cubic-bezier(0.76, 0, 0.24, 1);
|
|
121
|
+
animation-fill-mode: both;
|
|
122
|
+
animation-name: astroFadeOut; }[data-astro-transition-fallback="new"] [data-astro-transition-scope="astro-bbhp3f5g-3"],
|
|
123
|
+
[data-astro-transition-fallback="new"][data-astro-transition-scope="astro-bbhp3f5g-3"] {
|
|
124
|
+
animation-duration: 180ms;
|
|
125
|
+
animation-timing-function: cubic-bezier(0.76, 0, 0.24, 1);
|
|
126
|
+
animation-fill-mode: both;
|
|
127
|
+
animation-name: astroFadeIn; }[data-astro-transition=back][data-astro-transition-fallback="old"] [data-astro-transition-scope="astro-bbhp3f5g-3"],
|
|
128
|
+
[data-astro-transition=back][data-astro-transition-fallback="old"][data-astro-transition-scope="astro-bbhp3f5g-3"] {
|
|
129
|
+
animation-duration: 180ms;
|
|
130
|
+
animation-timing-function: cubic-bezier(0.76, 0, 0.24, 1);
|
|
131
|
+
animation-fill-mode: both;
|
|
132
|
+
animation-name: astroFadeOut; }[data-astro-transition=back][data-astro-transition-fallback="new"] [data-astro-transition-scope="astro-bbhp3f5g-3"],
|
|
133
|
+
[data-astro-transition=back][data-astro-transition-fallback="new"][data-astro-transition-scope="astro-bbhp3f5g-3"] {
|
|
134
|
+
animation-duration: 180ms;
|
|
135
|
+
animation-timing-function: cubic-bezier(0.76, 0, 0.24, 1);
|
|
136
|
+
animation-fill-mode: both;
|
|
137
|
+
animation-name: astroFadeIn; }</style></head><body class="tw-body antialiased"><div class="tw-shell min-h-screen"><aside class="tw-nav-aside fixed inset-y-0 left-0 flex flex-col z-45" id="tw-nav-aside"><div class="tw-nav-brand"><div class="tw-nav-brand-row"><a href="/" class="tw-nav-brand-link min-w-0 flex-1" data-astro-reload><span class="tw-nav-brand-mark" aria-hidden="true"><img class="tw-nav-brand-mark-img" src="/brand/brand-mark.png" alt="" width="36" height="36"></span><span class="tw-nav-brand-text"><span class="tw-nav-brand-title-row"><span class="tw-nav-brand-title" data-i18n="nav.brand">Lantern Harness</span><span class="tw-nav-brand-ver" data-hint="平台版本 v0.1.36">v0.1.36<span class="tw-nav-brand-dot" id="tw-update-dot" role="button" tabindex="-1" aria-label="有新版本可更新" hidden></span></span></span></span></a></div></div><div class="tw-nav-space-slot"><div class="tw-nav-space tw-nav-space-ph" id="tw-nav-space-ph" aria-hidden="true"><div class="tw-nav-space-ph-box"><span class="tw-nav-space-ph-ico"></span><span class="tw-nav-space-ph-lines"><span class="tw-nav-space-ph-bar is-cap"></span><span class="tw-nav-space-ph-bar is-name"></span></span></div></div><style>astro-island,astro-slot,astro-static-slot{display:contents}</style><script>(function(){let e=async e=>{await(await e())()};(self.Astro||(self.Astro={})).only=e,window.dispatchEvent(new Event(`astro:only`))})();</script><script>(function(){function e(t){"@babel/helpers - typeof";return e=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},e(t)}function t(t,n){if(e(t)!=`object`||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var i=r.call(t,n||`default`);if(e(i)!=`object`)return i;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(n===`string`?String:Number)(t)}function n(n){var r=t(n,`string`);return e(r)==`symbol`?r:r+``}function r(e,t,r){return(t=n(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}let i=/* @__PURE__ */ new Set([`__proto__`,`constructor`,`prototype`]);{let e={0:e=>a(e),1:e=>n(e),2:e=>new RegExp(e),3:e=>new Date(e),4:e=>new Map(n(e)),5:e=>new Set(n(e)),6:e=>BigInt(e),7:e=>new URL(e),8:e=>new Uint8Array(e),9:e=>new Uint16Array(e),10:e=>new Uint32Array(e),11:e=>1/0*e},t=t=>{let[n,r]=t;return n in e?e[n](r):void 0},n=e=>e.map(t),a=e=>typeof e!=`object`||!e?e:Object.fromEntries(Object.entries(e).map(([e,n])=>[e,t(n)]));class o extends HTMLElement{constructor(...e){super(...e),r(this,`Component`,void 0),r(this,`hydrator`,void 0),r(this,`hydrate`,async()=>{var e;if(!this.hydrator||!this.isConnected)return;let t=(e=this.parentElement)==null?void 0:e.closest(`astro-island[ssr]`);if(t){t.addEventListener(`astro:hydrate`,this.hydrate,{once:!0});return}let n=this.querySelectorAll(`astro-slot`),r={},i=this.querySelectorAll(`template[data-astro-template]`);for(let e of i){let t=e.closest(this.tagName);t!=null&&t.isSameNode(this)&&(r[e.getAttribute(`data-astro-template`)||`default`]=e.innerHTML,e.remove())}for(let e of n){let t=e.closest(this.tagName);t!=null&&t.isSameNode(this)&&(r[e.getAttribute(`name`)||`default`]=e.innerHTML)}let o;try{o=this.hasAttribute(`props`)?a(JSON.parse(this.getAttribute(`props`))):{}}catch(e){let t=this.getAttribute(`component-url`)||`<unknown>`,n=this.getAttribute(`component-export`);throw n&&(t+=` (export ${n})`),console.error(`[hydrate] Error parsing props for component ${t}`,this.getAttribute(`props`),e),e}await this.hydrator(this)(this.Component,o,r,{client:this.getAttribute(`client`)}),this.removeAttribute(`ssr`),this.dispatchEvent(new CustomEvent(`astro:hydrate`))}),r(this,`unmount`,()=>{this.isConnected||this.dispatchEvent(new CustomEvent(`astro:unmount`))})}disconnectedCallback(){document.removeEventListener(`astro:after-swap`,this.unmount),document.addEventListener(`astro:after-swap`,this.unmount,{once:!0})}connectedCallback(){if(!this.hasAttribute(`await-children`)||document.readyState===`interactive`||document.readyState===`complete`)this.childrenConnectedCallback();else{let e=()=>{document.removeEventListener(`DOMContentLoaded`,e),t.disconnect(),this.childrenConnectedCallback()},t=new MutationObserver(()=>{var t;((t=this.lastChild)==null?void 0:t.nodeType)===Node.COMMENT_NODE&&this.lastChild.nodeValue===`astro:end`&&(this.lastChild.remove(),e())});t.observe(this,{childList:!0}),document.addEventListener(`DOMContentLoaded`,e)}}async childrenConnectedCallback(){let e=this.getAttribute(`before-hydration-url`);e&&await import(e),this.start()}getRetryImportUrl(e){let t=new URL(e,document.baseURI);return t.searchParams.set(`astro-retry`,Date.now().toString()),t.toString()}async importWithRetry(e){try{return await import(e)}catch(t){return await new Promise(e=>setTimeout(e,1e3)),import(this.getRetryImportUrl(e))}}handleHydrationError(e){let t=this.getAttribute(`component-url`),n=new CustomEvent(`astro:hydration-error`,{cancelable:!0,bubbles:!0,composed:!0,detail:{error:e,componentUrl:t}});this.dispatchEvent(n)&&console.error(`[astro-island] Error hydrating ${t}`,e)}async start(){let e=JSON.parse(this.getAttribute(`opts`)),t=this.getAttribute(`client`);if(Astro[t]===void 0)window.addEventListener(`astro:${t}`,()=>this.start(),{once:!0});else try{await Astro[t](async()=>{let e=this.getAttribute(`renderer-url`);try{let[t,{default:n}]=await Promise.all([this.importWithRetry(this.getAttribute(`component-url`)),e?this.importWithRetry(e):Promise.resolve({default:()=>()=>{}})]),r=this.getAttribute(`component-export`)||`default`;if(r.includes(`.`)){this.Component=t;for(let e of r.split(`.`)){if(i.has(e)||!this.Component||typeof this.Component!=`object`&&typeof this.Component!=`function`||!Object.hasOwn(this.Component,e))throw Error(`Invalid component export path: ${r}`);this.Component=this.Component[e]}}else{if(i.has(r))throw Error(`Invalid component export path: ${r}`);this.Component=t[r]}return this.hydrator=n,this.hydrate}catch(e){return this.handleHydrationError(e),()=>{}}},e,this)}catch(e){this.handleHydrationError(e)}}attributeChangedCallback(){this.hydrate()}}r(o,`observedAttributes`,[`props`]),customElements.get(`astro-island`)||customElements.define(`astro-island`,o)}})();</script><astro-island uid="2wH2Dz" component-url="/_astro/SpaceSwitcher.Cy4UrzbH.js" component-export="default" renderer-url="/_astro/client.BHNTqLjv.js" props="{"data-astro-transition-persist":[0,"astro-gyrtbwwo-1"]}" ssr client="only" opts="{"name":"SpaceSwitcher","value":"react"}" data-astro-transition-persist="astro-gyrtbwwo-1"></astro-island></div><button type="button" id="tw-nav-toggle" class="tw-nav-toggle" aria-label="收起或展开左侧导航" aria-expanded="true" aria-controls="tw-nav-aside"><svg class="tw-nav-toggle-icon is-collapse" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M15 6l-6 6 6 6"></path></svg><svg class="tw-nav-toggle-icon is-expand" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M9 6l6 6-6 6"></path></svg></button><nav class="tw-nav-list flex-1 overflow-y-auto"><a href="/workbench/" class="tw-nav-item" data-i18n-hint="nav.home" data-hint="我的工作台"><svg class="tw-nav-ico" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.75" aria-hidden="true"><path d="M3 10.5 12 3l9 7.5"></path><path d="M5 9.5V20h14V9.5"></path></svg><span class="tw-nav-label" data-i18n="nav.home">我的工作台</span></a><div class="tw-nav-libraries"><div class="tw-nav-libraries-ph"><a href="/dashboard/" class="tw-nav-item" data-plugin-nav="dashboard"><svg class="tw-nav-ico" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.75" aria-hidden="true"><rect x="3" y="3" width="7" height="7" rx="1.5"></rect><rect x="14" y="3" width="7" height="7" rx="1.5"></rect><rect x="3" y="14" width="7" height="7" rx="1.5"></rect><rect x="14" y="14" width="7" height="7" rx="1.5"></rect></svg><span class="tw-nav-label" data-i18n="nav.dashboard">仪表盘</span></a><a href="/tasks/" class="tw-nav-item" data-plugin-nav="tasks"><svg class="tw-nav-ico" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.75" aria-hidden="true"><path d="M9 5h10"></path><path d="M9 12h10"></path><path d="M9 19h10"></path><path d="M4 5h.01"></path><path d="M4 12h.01"></path><path d="M4 19h.01"></path></svg><span class="tw-nav-label" data-i18n="nav.tasks">任务管理</span></a><a href="/todos/" class="tw-nav-item" data-plugin-nav="todos"><svg class="tw-nav-ico" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.75" aria-hidden="true"><path d="M8 6h13"></path><path d="M8 12h13"></path><path d="M8 18h13"></path><path d="M3 6h.01"></path><path d="M3 12h.01"></path><path d="M3 18h.01"></path></svg><span class="tw-nav-label" data-i18n="nav.todos">待办事项</span></a><a href="/pm/projects/" class="tw-nav-item" data-plugin-nav="projects"><svg class="tw-nav-ico" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.75" aria-hidden="true"><path d="M3 7a2 2 0 0 1 2-2h4l2 2h8a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V7z"></path></svg><span class="tw-nav-label" data-i18n="nav.projects">项目列表</span></a><a href="/pm/iterations/" class="tw-nav-item" data-plugin-nav="iterations"><svg class="tw-nav-ico" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.75" aria-hidden="true"><rect x="3" y="5" width="18" height="16" rx="2"></rect><path d="M8 3v4"></path><path d="M16 3v4"></path><path d="M3 10h18"></path></svg><span class="tw-nav-label" data-i18n="nav.iterations">迭代管理</span></a><a href="/pm/requirements/" class="tw-nav-item" data-plugin-nav="pmRequirements"><svg class="tw-nav-ico" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.75" aria-hidden="true"><path d="M14 3v5h5"></path><path d="M6 2h8l6 6v12a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2z"></path><path d="M8 13h8"></path><path d="M8 17h5"></path></svg><span class="tw-nav-label" data-i18n="nav.requirementsMgmt">需求管理</span></a><a href="/pm/bugs/" class="tw-nav-item" data-plugin-nav="bugs"><svg class="tw-nav-ico" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.75" aria-hidden="true"><circle cx="12" cy="14" r="5"></circle><path d="M9 6l2 2"></path><path d="M15 6l-2 2"></path><path d="M7 11H4"></path><path d="M20 11h-3"></path><path d="M7 17H4"></path><path d="M20 17h-3"></path></svg><span class="tw-nav-label" data-i18n="nav.bugs">缺陷管理</span></a><a href="/reports/" class="tw-nav-item" data-plugin-nav="reports"><svg class="tw-nav-ico" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.75" aria-hidden="true"><path d="M14 3v5h5"></path><path d="M6 2h8l6 6v12a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2z"></path><path d="M8 13h8"></path><path d="M8 17h5"></path></svg><span class="tw-nav-label" data-i18n="nav.reports">工作汇报</span></a><a href="/test-stats/" class="tw-nav-item" data-plugin-nav="testStats"><svg class="tw-nav-ico" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.75" aria-hidden="true"><path d="M4 20V10"></path><path d="M10 20V4"></path><path d="M16 20v-7"></path><path d="M22 20H2"></path></svg><span class="tw-nav-label" data-i18n="nav.testStats">测试统计</span></a><a href="/case-exec/" class="tw-nav-item" data-plugin-nav="caseExec"><svg class="tw-nav-ico" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.75" aria-hidden="true"><circle cx="12" cy="12" r="9"></circle><circle cx="12" cy="12" r="5"></circle><circle cx="12" cy="12" r="1.4"></circle></svg><span class="tw-nav-label" data-i18n="nav.caseExec">用例执行统计</span></a><a href="/cases/library/" class="tw-nav-item" data-plugin-nav="cases"><svg class="tw-nav-ico" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.75" aria-hidden="true"><path d="M9 11l3 3L22 4"></path><path d="M21 12v7a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h11"></path></svg><span class="tw-nav-label" data-i18n="nav.caseManage">用例管理</span></a><a href="/knowledge/" class="tw-nav-item" data-plugin-nav="knowledgeLib"><svg class="tw-nav-ico" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.75" aria-hidden="true"><path d="M4 19.5A2.5 2.5 0 0 1 6.5 17H20"></path><path d="M6.5 2H20v20H6.5A2.5 2.5 0 0 1 4 19.5v-15A2.5 2.5 0 0 1 6.5 2z"></path></svg><span class="tw-nav-label" data-i18n="nav.knowledge">知识库管理</span></a><a href="/requirements/" class="tw-nav-item" data-plugin-nav="requirements" data-i18n-hint="nav.requirements"><svg class="tw-nav-ico" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.75" aria-hidden="true"><path d="M14 3v5h5"></path><path d="M6 2h8l6 6v12a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2z"></path><path d="M8 13h8"></path><path d="M8 17h6"></path></svg><span class="tw-nav-label" data-i18n="nav.requirements">需求文档库</span></a><a href="/templates/" class="tw-nav-item" data-plugin-nav="templates" data-i18n-hint="nav.templates"><svg class="tw-nav-ico" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.75" aria-hidden="true"><path d="M12 3 3 8l9 5 9-5-9-5z"></path><path d="m3 13 9 5 9-5"></path></svg><span class="tw-nav-label" data-i18n="nav.templates">测试模板库</span></a></div><astro-island uid="Z1lgSd4" component-url="/_astro/NavLibraries.D9EKoN80.js" component-export="default" renderer-url="/_astro/client.BHNTqLjv.js" props="{"data-astro-transition-persist":[0,"astro-iywf7oe7-2"]}" ssr client="only" opts="{"name":"NavLibraries","value":"react"}" data-astro-transition-persist="astro-iywf7oe7-2"></astro-island><script>(function(){const host = ".tw-nav-libraries";
|
|
138
|
+
const cacheKey = "tw.hydrate.nav";
|
|
139
|
+
const fixActive = true;
|
|
140
|
+
const capture = false;
|
|
141
|
+
const syncNavGroups = true;
|
|
142
|
+
|
|
143
|
+
(function () {
|
|
144
|
+
try {
|
|
145
|
+
var target = document.querySelector(host);
|
|
146
|
+
if (!target) return;
|
|
147
|
+
var spaceId = (
|
|
148
|
+
sessionStorage.getItem('tw.space.active-id') ||
|
|
149
|
+
localStorage.getItem('tw.space.active-id') ||
|
|
150
|
+
''
|
|
151
|
+
).trim();
|
|
152
|
+
var key = spaceId ? cacheKey + '::' + spaceId : cacheKey;
|
|
153
|
+
var html = localStorage.getItem(key);
|
|
154
|
+
var island = target.querySelector('astro-island');
|
|
155
|
+
|
|
156
|
+
// 「插件未启用」这类提示不该被缓存,否则启用后刷新还会先闪一下旧提示
|
|
157
|
+
if (html && html.indexOf('tw-lib-notice') !== -1) {
|
|
158
|
+
try {
|
|
159
|
+
localStorage.removeItem(key);
|
|
160
|
+
} catch (e) {
|
|
161
|
+
/* ignore */
|
|
162
|
+
}
|
|
163
|
+
html = null;
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
if (html) {
|
|
167
|
+
var tpl = document.createElement('template');
|
|
168
|
+
tpl.innerHTML = html;
|
|
169
|
+
var nodes = Array.prototype.slice.call(tpl.content.children || []);
|
|
170
|
+
if (nodes.length) {
|
|
171
|
+
for (var i = 0; i < nodes.length; i++) {
|
|
172
|
+
nodes[i].setAttribute('data-hydrate-cache', '');
|
|
173
|
+
nodes[i].setAttribute('aria-hidden', 'true');
|
|
174
|
+
}
|
|
175
|
+
// 侧栏分组:缓存里的展开 / 收起状态可能过期(用户收起后又刷新),
|
|
176
|
+
// 按 localStorage 校正一遍再插入,避免「先展开、再收起」闪一下
|
|
177
|
+
if (syncNavGroups) {
|
|
178
|
+
for (var gi = 0; gi < nodes.length; gi++) {
|
|
179
|
+
// 缓存片段是按岛屿的顶层子节点逐个存的:分组本身就是顶层 <details>,
|
|
180
|
+
// 只查后代会漏掉它,所以自己也要算一个候选
|
|
181
|
+
var candidates = [nodes[gi]];
|
|
182
|
+
var nested = nodes[gi].querySelectorAll
|
|
183
|
+
? nodes[gi].querySelectorAll('[data-nav-group]')
|
|
184
|
+
: [];
|
|
185
|
+
for (var ni = 0; ni < nested.length; ni++) candidates.push(nested[ni]);
|
|
186
|
+
for (var gj = 0; gj < candidates.length; gj++) {
|
|
187
|
+
var groupEl = candidates[gj];
|
|
188
|
+
if (!groupEl.hasAttribute || !groupEl.hasAttribute('data-nav-group')) continue;
|
|
189
|
+
var gid = groupEl.getAttribute('data-nav-group');
|
|
190
|
+
if (!gid) continue;
|
|
191
|
+
var gKey = 'tw.nav.groupOpen.' + gid;
|
|
192
|
+
if (spaceId) gKey += '::' + spaceId;
|
|
193
|
+
var gVal = null;
|
|
194
|
+
try {
|
|
195
|
+
gVal = localStorage.getItem(gKey);
|
|
196
|
+
} catch (e) {
|
|
197
|
+
/* ignore */
|
|
198
|
+
}
|
|
199
|
+
if (gVal === '0') groupEl.removeAttribute('open');
|
|
200
|
+
else if (gVal === '1') groupEl.setAttribute('open', '');
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
// 片段并列插入:挂在岛屿前面,挂载后由 CSS 隐藏
|
|
205
|
+
var frag = document.createDocumentFragment();
|
|
206
|
+
for (var j = 0; j < nodes.length; j++) frag.appendChild(nodes[j]);
|
|
207
|
+
if (island && island.parentNode === target) target.insertBefore(frag, island);
|
|
208
|
+
else target.appendChild(frag);
|
|
209
|
+
|
|
210
|
+
if (fixActive) {
|
|
211
|
+
// 缓存里的高亮是上一次停留的页面,按当前路径重新点亮
|
|
212
|
+
var here = location.pathname.replace(/\/+$/, '') || '/';
|
|
213
|
+
var marks = target.querySelectorAll(
|
|
214
|
+
'[data-hydrate-cache].is-active, [data-hydrate-cache] .is-active',
|
|
215
|
+
);
|
|
216
|
+
for (var k = 0; k < marks.length; k++) marks[k].classList.remove('is-active');
|
|
217
|
+
var links = target.querySelectorAll('[data-hydrate-cache] a.tw-nav-item-main');
|
|
218
|
+
for (var m = 0; m < links.length; m++) {
|
|
219
|
+
var href = (links[m].getAttribute('href') || '').split(/[?#]/)[0].replace(/\/+$/, '');
|
|
220
|
+
if (href && href === here) {
|
|
221
|
+
var row = links[m].closest('.tw-nav-item');
|
|
222
|
+
if (row) row.classList.add('is-active');
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
if (!island) return;
|
|
230
|
+
|
|
231
|
+
/*
|
|
232
|
+
* 缓存已经铺上了:先给 host 打个标记,CSS 会把岛屿整块藏起来(缓存独占),
|
|
233
|
+
* 等真实内容就绪再撤。没有缓存时不打标记,走原来的 loading 骨架。
|
|
234
|
+
*/
|
|
235
|
+
var pendingMarked = false;
|
|
236
|
+
function markPending() {
|
|
237
|
+
if (pendingMarked || !html) return;
|
|
238
|
+
pendingMarked = true;
|
|
239
|
+
target.setAttribute('data-hydrate-pending', '');
|
|
240
|
+
// 兜底:页面一直加载不出来时别把岛屿永远藏着
|
|
241
|
+
setTimeout(function () {
|
|
242
|
+
target.removeAttribute('data-hydrate-pending');
|
|
243
|
+
}, 8000);
|
|
244
|
+
}
|
|
245
|
+
function unmarkPending() {
|
|
246
|
+
target.removeAttribute('data-hydrate-pending');
|
|
247
|
+
}
|
|
248
|
+
markPending();
|
|
249
|
+
|
|
250
|
+
/**
|
|
251
|
+
* 岛屿处于首屏 loading:此时缓存片段继续占位(CSS 同时把岛屿藏起来)。
|
|
252
|
+
* `.tw-lib-spin` / `aria-busy` 是各页面 loading 骨架的统一特征。
|
|
253
|
+
*/
|
|
254
|
+
function isPending() {
|
|
255
|
+
return Boolean(
|
|
256
|
+
island.querySelector('.tw-hydrate-pending, [aria-busy="true"], .tw-lib-spin'),
|
|
257
|
+
);
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
/** 撤掉缓存片段(含淡出中的) */
|
|
261
|
+
function dropCache() {
|
|
262
|
+
var kids = Array.prototype.slice.call(target.children);
|
|
263
|
+
for (var i = 0; i < kids.length; i++) {
|
|
264
|
+
if (kids[i].hasAttribute && kids[i].hasAttribute('data-hydrate-cache')) {
|
|
265
|
+
kids[i].parentNode.removeChild(kids[i]);
|
|
266
|
+
}
|
|
267
|
+
}
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
/** 列出当前缓存节点 */
|
|
271
|
+
function cacheNodes() {
|
|
272
|
+
var out = [];
|
|
273
|
+
var kids = target.children;
|
|
274
|
+
for (var i = 0; i < kids.length; i++) {
|
|
275
|
+
if (kids[i].hasAttribute && kids[i].hasAttribute('data-hydrate-cache')) {
|
|
276
|
+
out.push(kids[i]);
|
|
277
|
+
}
|
|
278
|
+
}
|
|
279
|
+
return out;
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
var timer = 0;
|
|
283
|
+
var settled = false;
|
|
284
|
+
var saved = '';
|
|
285
|
+
/** 单页缓存上限:列表页的 DOM 可能有两三百 KB,超过就不存(仍走正常加载) */
|
|
286
|
+
var MAX_HTML = 600000;
|
|
287
|
+
|
|
288
|
+
/**
|
|
289
|
+
* 所有页面的刷新缓存共用一份预算(3MB):超了就先扔最大的旧页面缓存,
|
|
290
|
+
* 不去碰 nav / 自动化测试的缓存(这两处最常驻,扔了会明显闪)。
|
|
291
|
+
* 不做这一步的话 localStorage 5MB 配额会被几个大列表页吃光。
|
|
292
|
+
*/
|
|
293
|
+
var PAGE_CACHE_BUDGET = 3 * 1024 * 1024;
|
|
294
|
+
function trimOtherPageCaches(needBytes) {
|
|
295
|
+
var entries = [];
|
|
296
|
+
for (var i = 0; i < localStorage.length; i++) {
|
|
297
|
+
var k = localStorage.key(i);
|
|
298
|
+
if (!k || k === key) continue;
|
|
299
|
+
if (k.indexOf('tw.hydrate.') !== 0) continue;
|
|
300
|
+
if (k.indexOf('tw.hydrate.nav') === 0 || k.indexOf('tw.hydrate.ui-auto') === 0) continue;
|
|
301
|
+
entries.push({ k: k, len: (localStorage.getItem(k) || '').length });
|
|
302
|
+
}
|
|
303
|
+
var total = entries.reduce(function (sum, e) {
|
|
304
|
+
return sum + e.len;
|
|
305
|
+
}, needBytes);
|
|
306
|
+
entries.sort(function (a, b) {
|
|
307
|
+
return b.len - a.len;
|
|
308
|
+
});
|
|
309
|
+
for (var j = 0; j < entries.length && total > PAGE_CACHE_BUDGET; j++) {
|
|
310
|
+
try {
|
|
311
|
+
localStorage.removeItem(entries[j].k);
|
|
312
|
+
total -= entries[j].len;
|
|
313
|
+
} catch (e) {
|
|
314
|
+
/* ignore */
|
|
315
|
+
}
|
|
316
|
+
}
|
|
317
|
+
}
|
|
318
|
+
|
|
319
|
+
function saveCache(html) {
|
|
320
|
+
if (!html || html === saved || html.length > MAX_HTML) return;
|
|
321
|
+
trimOtherPageCaches(html.length);
|
|
322
|
+
try {
|
|
323
|
+
localStorage.setItem(key, html);
|
|
324
|
+
saved = html;
|
|
325
|
+
return;
|
|
326
|
+
} catch (e) {
|
|
327
|
+
// 配额满:腾掉其它页面缓存再试一次
|
|
328
|
+
}
|
|
329
|
+
trimOtherPageCaches(html.length);
|
|
330
|
+
try {
|
|
331
|
+
localStorage.setItem(key, html);
|
|
332
|
+
saved = html;
|
|
333
|
+
} catch (e) {
|
|
334
|
+
/* 隐私模式 / 配额仍然不足:放弃缓存 */
|
|
335
|
+
}
|
|
336
|
+
}
|
|
337
|
+
|
|
338
|
+
/** 把当前渲染结果存一份(页面在数据变化后离开时也调用,缓存不会停在首屏) */
|
|
339
|
+
function persistNow() {
|
|
340
|
+
if (!capture) return;
|
|
341
|
+
if (!island.firstElementChild || isPending()) return;
|
|
342
|
+
// 只渲染了提示(插件关闭 / 服务未就绪)时不缓存
|
|
343
|
+
var first = island.firstElementChild;
|
|
344
|
+
if (first && first.classList && first.classList.contains('tw-lib-notice')) return;
|
|
345
|
+
saveCache(island.innerHTML.trim());
|
|
346
|
+
}
|
|
347
|
+
|
|
348
|
+
/**
|
|
349
|
+
* 真实内容就绪后换层:
|
|
350
|
+
* 1) 先把缓存改成绝对叠层(仍盖住画面)
|
|
351
|
+
* 2) 再撤 pending,露出底下已排好的岛屿
|
|
352
|
+
* 3) 缓存短淡出后删除
|
|
353
|
+
* 切勿在撤 pending 前让缓存仍是 in-flow —— 会和岛屿并排把布局摊成两半。
|
|
354
|
+
*/
|
|
355
|
+
function flush() {
|
|
356
|
+
timer = 0;
|
|
357
|
+
if (settled) return;
|
|
358
|
+
if (!island.firstElementChild) return;
|
|
359
|
+
if (isPending()) return;
|
|
360
|
+
|
|
361
|
+
settled = true;
|
|
362
|
+
mo.disconnect();
|
|
363
|
+
|
|
364
|
+
var caches = cacheNodes();
|
|
365
|
+
if (!caches.length) {
|
|
366
|
+
unmarkPending();
|
|
367
|
+
persistNow();
|
|
368
|
+
return;
|
|
369
|
+
}
|
|
370
|
+
|
|
371
|
+
var pendingFade = caches.length;
|
|
372
|
+
function doneOne() {
|
|
373
|
+
pendingFade -= 1;
|
|
374
|
+
if (pendingFade <= 0) dropCache();
|
|
375
|
+
}
|
|
376
|
+
|
|
377
|
+
for (var i = 0; i < caches.length; i++) {
|
|
378
|
+
(function (el) {
|
|
379
|
+
el.setAttribute('data-hydrate-leaving', '');
|
|
380
|
+
var finished = false;
|
|
381
|
+
function finish() {
|
|
382
|
+
if (finished) return;
|
|
383
|
+
finished = true;
|
|
384
|
+
el.removeEventListener('transitionend', onEnd);
|
|
385
|
+
if (el.parentNode) el.parentNode.removeChild(el);
|
|
386
|
+
doneOne();
|
|
387
|
+
}
|
|
388
|
+
function onEnd(ev) {
|
|
389
|
+
if (ev && ev.target !== el) return;
|
|
390
|
+
if (ev && ev.propertyName && ev.propertyName !== 'opacity') return;
|
|
391
|
+
finish();
|
|
392
|
+
}
|
|
393
|
+
el.addEventListener('transitionend', onEnd);
|
|
394
|
+
setTimeout(finish, 200);
|
|
395
|
+
})(caches[i]);
|
|
396
|
+
}
|
|
397
|
+
|
|
398
|
+
// 读一次布局,确保 leaving 的 absolute 已生效,再露岛屿
|
|
399
|
+
void caches[0].offsetWidth;
|
|
400
|
+
unmarkPending();
|
|
401
|
+
persistNow();
|
|
402
|
+
|
|
403
|
+
// 下一帧再收透明度,保证能跑上 transition(同帧改 opacity 常被合成跳过)
|
|
404
|
+
requestAnimationFrame(function () {
|
|
405
|
+
for (var j = 0; j < caches.length; j++) {
|
|
406
|
+
if (caches[j].parentNode) caches[j].style.opacity = '0';
|
|
407
|
+
}
|
|
408
|
+
});
|
|
409
|
+
}
|
|
410
|
+
|
|
411
|
+
// 离开页面 / 切到后台时再存一次:列表增删改之后,下次刷新看到的是最新一屏
|
|
412
|
+
window.addEventListener('pagehide', persistNow);
|
|
413
|
+
document.addEventListener('visibilitychange', function () {
|
|
414
|
+
if (document.visibilityState === 'hidden') persistNow();
|
|
415
|
+
});
|
|
416
|
+
|
|
417
|
+
function schedule() {
|
|
418
|
+
if (settled || timer) return;
|
|
419
|
+
// 内容就绪后稍等级联更新结束再换层;过长会盯着旧画面突然一跳
|
|
420
|
+
timer = setTimeout(flush, 64);
|
|
421
|
+
}
|
|
422
|
+
|
|
423
|
+
var mo = new MutationObserver(schedule);
|
|
424
|
+
mo.observe(island, { childList: true, subtree: true, characterData: true });
|
|
425
|
+
schedule();
|
|
426
|
+
} catch (e) {
|
|
427
|
+
// 缓存坏了就当没有
|
|
428
|
+
}
|
|
429
|
+
})();
|
|
430
|
+
})();</script></div><a href="/prompts/" class="tw-nav-item" data-plugin-nav="prompts" data-pinned-nav="prompts"><svg class="tw-nav-ico" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.75" aria-hidden="true"><path d="M12 20h9"></path><path d="M16.5 3.5a2.1 2.1 0 0 1 3 3L7 19l-4 1 1-4Z"></path></svg><span class="tw-nav-label" data-i18n="nav.prompts">提示词管理</span></a><a href="/docs/manual/" class="tw-nav-item" data-hint="帮助中心" data-i18n-hint="nav.helpCenter"><svg class="tw-nav-ico" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.75" aria-hidden="true"><path d="M5 4.5h9.5L19 9v10.5H5V4.5Z" stroke-linejoin="round"></path><path d="M14.5 4.5V9H19" stroke-linejoin="round"></path><path d="M8 13h8M8 16.5h6" stroke-linecap="round"></path></svg><span class="tw-nav-label" data-i18n="nav.helpCenter">帮助中心</span></a></nav><div class="tw-nav-foot"><script>(function(){let e=async e=>{await(await e())()};(self.Astro||(self.Astro={})).load=e,window.dispatchEvent(new Event(`astro:load`))})();</script><astro-island uid="Z12jkyC" prefix="r1" component-url="/_astro/SettingsDialog.C3qqpZPT.js" component-export="default" renderer-url="/_astro/client.BHNTqLjv.js" props="{}" ssr client="load" opts="{"name":"SettingsDialog","value":true}" await-children><div class="tw-nav-foot-row"><button type="button" class="tw-nav-settings-btn" data-hint="设置"><svg class="tw-nav-ico w-4.5 h-4.5 shrink-0" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.75" aria-hidden="true"><circle cx="12" cy="12" r="3"></circle><path d="M19.4 15a1.7 1.7 0 0 0 .3 1.8l.1.1a2 2 0 1 1-2.8 2.8l-.1-.1a1.7 1.7 0 0 0-1.8-.3 1.7 1.7 0 0 0-1 1.5V21a2 2 0 1 1-4 0v-.1a1.7 1.7 0 0 0-1-1.5 1.7 1.7 0 0 0-1.8.3l-.1.1a2 2 0 1 1-2.8-2.8l.1-.1a1.7 1.7 0 0 0 .3-1.8 1.7 1.7 0 0 0-1.5-1H3a2 2 0 1 1 0-4h.1a1.7 1.7 0 0 0 1.5-1 1.7 1.7 0 0 0-.3-1.8l-.1-.1a2 2 0 1 1 2.8-2.8l.1.1a1.7 1.7 0 0 0 1.8.3H9a1.7 1.7 0 0 0 1-1.5V3a2 2 0 1 1 4 0v.1a1.7 1.7 0 0 0 1 1.5 1.7 1.7 0 0 0 1.8-.3l.1-.1a2 2 0 1 1 2.8 2.8l-.1.1a1.7 1.7 0 0 0-.3 1.8V9c.2.6.7 1 1.5 1H21a2 2 0 1 1 0 4h-.1a1.7 1.7 0 0 0-1.5 1z"></path></svg><span data-i18n="nav.settings">设置</span></button><button type="button" class="tw-nav-provider-chip is-empty" data-hint="未配置模型"><span class="tw-nav-provider-dot" aria-hidden="true"></span><span class="tw-nav-provider-name">未配置</span></button></div><span hidden="" style="position:fixed;top:1px;left:1px;width:1px;height:0;padding:0;margin:-1px;overflow:hidden;clip:rect(0, 0, 0, 0);white-space:nowrap;border-width:0;display:none"></span><!--astro:end--></astro-island></div></aside><script data-astro-rerun>
|
|
431
|
+
(function () {
|
|
432
|
+
try {
|
|
433
|
+
var raw = localStorage.getItem('tw.app.model.v1');
|
|
434
|
+
if (!raw) return;
|
|
435
|
+
var model = JSON.parse(raw) || {};
|
|
436
|
+
var list = Array.isArray(model.providers) ? model.providers : [];
|
|
437
|
+
var active = null;
|
|
438
|
+
for (var i = 0; i < list.length; i++) {
|
|
439
|
+
if (list[i] && list[i].id === model.activeId) {
|
|
440
|
+
active = list[i];
|
|
441
|
+
break;
|
|
442
|
+
}
|
|
443
|
+
}
|
|
444
|
+
if (!active && list.length) active = list[0];
|
|
445
|
+
var name = active && active.name ? String(active.name).trim() : '';
|
|
446
|
+
if (!name) return;
|
|
447
|
+
var el = document.querySelector('.tw-nav-provider-name');
|
|
448
|
+
if (!el) return;
|
|
449
|
+
el.textContent = name;
|
|
450
|
+
var chip = el.closest('.tw-nav-provider-chip');
|
|
451
|
+
if (chip) {
|
|
452
|
+
chip.classList.remove('is-empty');
|
|
453
|
+
var m = active.model ? ' · ' + String(active.model).trim() : '';
|
|
454
|
+
chip.setAttribute('data-hint', name + m);
|
|
455
|
+
}
|
|
456
|
+
} catch (e) {
|
|
457
|
+
/* ignore */
|
|
458
|
+
}
|
|
459
|
+
})();
|
|
460
|
+
</script><script data-astro-rerun>
|
|
461
|
+
(function () {
|
|
462
|
+
var root = document.documentElement;
|
|
463
|
+
var btn = document.getElementById('tw-nav-toggle');
|
|
464
|
+
function apply(collapsed) {
|
|
465
|
+
if (collapsed) root.dataset.navCollapsed = '1';
|
|
466
|
+
else delete root.dataset.navCollapsed;
|
|
467
|
+
try {
|
|
468
|
+
localStorage.setItem('tw.nav.collapsed', collapsed ? '1' : '0');
|
|
469
|
+
} catch (e) {}
|
|
470
|
+
if (btn) {
|
|
471
|
+
btn.setAttribute('aria-expanded', collapsed ? 'false' : 'true');
|
|
472
|
+
// 气泡已移除;改为动态更新不可见标签,读屏仍能获知当前动作
|
|
473
|
+
btn.setAttribute('aria-label', collapsed ? '展开导航' : '收起导航');
|
|
474
|
+
}
|
|
475
|
+
}
|
|
476
|
+
apply(root.dataset.navCollapsed === '1');
|
|
477
|
+
if (btn) {
|
|
478
|
+
btn.addEventListener('click', function () {
|
|
479
|
+
apply(root.dataset.navCollapsed !== '1');
|
|
480
|
+
});
|
|
481
|
+
}
|
|
482
|
+
|
|
483
|
+
try {
|
|
484
|
+
var raw = localStorage.getItem('tw.app.config.v1');
|
|
485
|
+
if (!raw) return;
|
|
486
|
+
var g = JSON.parse(raw).general || {};
|
|
487
|
+
if (g.language !== 'en') return;
|
|
488
|
+
var en = {
|
|
489
|
+
'nav.brand': 'Lantern Harness',
|
|
490
|
+
'nav.home': 'My Workbench',
|
|
491
|
+
'nav.dashboard': 'Dashboard',
|
|
492
|
+
'nav.tasks': 'Tasks',
|
|
493
|
+
'nav.todos': 'Todos',
|
|
494
|
+
'nav.projects': 'Projects',
|
|
495
|
+
'nav.iterations': 'Iterations',
|
|
496
|
+
'nav.requirementsMgmt': 'Requirements Mgmt',
|
|
497
|
+
'nav.bugs': 'Bugs',
|
|
498
|
+
'nav.reports': 'Work Report',
|
|
499
|
+
'nav.testStats': 'Test Statistics',
|
|
500
|
+
'nav.caseExec': 'Case Execution',
|
|
501
|
+
'nav.uiAuto': 'Automation Testing',
|
|
502
|
+
'nav.reqAnalysis': 'Requirement Analysis',
|
|
503
|
+
'nav.caseManage': 'Test Cases',
|
|
504
|
+
'nav.prompts': 'Prompts',
|
|
505
|
+
'nav.knowledge': 'Knowledge Mgmt',
|
|
506
|
+
'nav.plugins': 'My Plugins',
|
|
507
|
+
'nav.docs': 'Documents',
|
|
508
|
+
'nav.requirements': 'Requirements',
|
|
509
|
+
'nav.templates': 'Test Templates',
|
|
510
|
+
'nav.settings': 'Settings',
|
|
511
|
+
'nav.changelog': 'Changelog',
|
|
512
|
+
'nav.changelogShort': 'Changelog',
|
|
513
|
+
'nav.helpCenter': 'Help Center',
|
|
514
|
+
'docs.nav.title': 'Docs',
|
|
515
|
+
'docs.nav.changelog': 'Changelog',
|
|
516
|
+
'docs.nav.manual': 'User Guide',
|
|
517
|
+
'docs.nav.install': 'Install Guide',
|
|
518
|
+
'nav.repo': 'GitHub',
|
|
519
|
+
'nav.repoShort': 'Repo',
|
|
520
|
+
'nav.npm': 'npm package',
|
|
521
|
+
'nav.npmShort': 'npm',
|
|
522
|
+
'nav.site': 'Yycy Docs',
|
|
523
|
+
'nav.siteShort': 'Site',
|
|
524
|
+
'nav.board': 'Questions & suggestions',
|
|
525
|
+
'nav.boardShort': 'Suggestions',
|
|
526
|
+
};
|
|
527
|
+
document.querySelectorAll('[data-i18n]').forEach(function (el) {
|
|
528
|
+
var key = el.getAttribute('data-i18n');
|
|
529
|
+
if (key && en[key]) el.textContent = en[key];
|
|
530
|
+
});
|
|
531
|
+
document.querySelectorAll('[data-i18n-hint]').forEach(function (el) {
|
|
532
|
+
var key = el.getAttribute('data-i18n-hint');
|
|
533
|
+
if (key && en[key]) el.setAttribute('data-hint', en[key]);
|
|
534
|
+
});
|
|
535
|
+
} catch (e) {}
|
|
536
|
+
})();
|
|
537
|
+
</script><main data-astro-transition-scope="astro-bbhp3f5g-3" class="tw-main min-h-screen"><div id="tw-route-loading" class="tw-route-loading is-hidden" role="status" aria-live="polite" aria-label="页面加载中"><span class="tw-route-loading-spin" aria-hidden="true"></span></div><div class="tw-library-page tw-library-wide px-8 py-8"><header class="mb-6 shrink-0"><h1 class="text-2xl font-bold text-stone-900">人生阶段</h1><p class="mt-2 text-sm text-stone-500">自定义多个人生阶段;人生周期可下拉增删改(如「第一辈子(29-34)」),可按人生周期 / 计划类型分组并维护进度。</p></header><div class="tw-hydrate-host"><astro-island uid="lN20P" component-url="/_astro/LifeStagesBoard.DrbIVrCK.js" component-export="default" renderer-url="/_astro/client.BHNTqLjv.js" props="{}" ssr client="only" opts="{"name":"LifeStagesBoard","value":"react"}"></astro-island><script>(function(){const host = ".tw-hydrate-host";
|
|
538
|
+
const cacheKey = "tw.hydrate.life-stages";
|
|
539
|
+
const fixActive = false;
|
|
540
|
+
const capture = true;
|
|
541
|
+
const syncNavGroups = false;
|
|
542
|
+
|
|
543
|
+
(function () {
|
|
544
|
+
try {
|
|
545
|
+
var target = document.querySelector(host);
|
|
546
|
+
if (!target) return;
|
|
547
|
+
var spaceId = (
|
|
548
|
+
sessionStorage.getItem('tw.space.active-id') ||
|
|
549
|
+
localStorage.getItem('tw.space.active-id') ||
|
|
550
|
+
''
|
|
551
|
+
).trim();
|
|
552
|
+
var key = spaceId ? cacheKey + '::' + spaceId : cacheKey;
|
|
553
|
+
var html = localStorage.getItem(key);
|
|
554
|
+
var island = target.querySelector('astro-island');
|
|
555
|
+
|
|
556
|
+
// 「插件未启用」这类提示不该被缓存,否则启用后刷新还会先闪一下旧提示
|
|
557
|
+
if (html && html.indexOf('tw-lib-notice') !== -1) {
|
|
558
|
+
try {
|
|
559
|
+
localStorage.removeItem(key);
|
|
560
|
+
} catch (e) {
|
|
561
|
+
/* ignore */
|
|
562
|
+
}
|
|
563
|
+
html = null;
|
|
564
|
+
}
|
|
565
|
+
|
|
566
|
+
if (html) {
|
|
567
|
+
var tpl = document.createElement('template');
|
|
568
|
+
tpl.innerHTML = html;
|
|
569
|
+
var nodes = Array.prototype.slice.call(tpl.content.children || []);
|
|
570
|
+
if (nodes.length) {
|
|
571
|
+
for (var i = 0; i < nodes.length; i++) {
|
|
572
|
+
nodes[i].setAttribute('data-hydrate-cache', '');
|
|
573
|
+
nodes[i].setAttribute('aria-hidden', 'true');
|
|
574
|
+
}
|
|
575
|
+
// 侧栏分组:缓存里的展开 / 收起状态可能过期(用户收起后又刷新),
|
|
576
|
+
// 按 localStorage 校正一遍再插入,避免「先展开、再收起」闪一下
|
|
577
|
+
if (syncNavGroups) {
|
|
578
|
+
for (var gi = 0; gi < nodes.length; gi++) {
|
|
579
|
+
// 缓存片段是按岛屿的顶层子节点逐个存的:分组本身就是顶层 <details>,
|
|
580
|
+
// 只查后代会漏掉它,所以自己也要算一个候选
|
|
581
|
+
var candidates = [nodes[gi]];
|
|
582
|
+
var nested = nodes[gi].querySelectorAll
|
|
583
|
+
? nodes[gi].querySelectorAll('[data-nav-group]')
|
|
584
|
+
: [];
|
|
585
|
+
for (var ni = 0; ni < nested.length; ni++) candidates.push(nested[ni]);
|
|
586
|
+
for (var gj = 0; gj < candidates.length; gj++) {
|
|
587
|
+
var groupEl = candidates[gj];
|
|
588
|
+
if (!groupEl.hasAttribute || !groupEl.hasAttribute('data-nav-group')) continue;
|
|
589
|
+
var gid = groupEl.getAttribute('data-nav-group');
|
|
590
|
+
if (!gid) continue;
|
|
591
|
+
var gKey = 'tw.nav.groupOpen.' + gid;
|
|
592
|
+
if (spaceId) gKey += '::' + spaceId;
|
|
593
|
+
var gVal = null;
|
|
594
|
+
try {
|
|
595
|
+
gVal = localStorage.getItem(gKey);
|
|
596
|
+
} catch (e) {
|
|
597
|
+
/* ignore */
|
|
598
|
+
}
|
|
599
|
+
if (gVal === '0') groupEl.removeAttribute('open');
|
|
600
|
+
else if (gVal === '1') groupEl.setAttribute('open', '');
|
|
601
|
+
}
|
|
602
|
+
}
|
|
603
|
+
}
|
|
604
|
+
// 片段并列插入:挂在岛屿前面,挂载后由 CSS 隐藏
|
|
605
|
+
var frag = document.createDocumentFragment();
|
|
606
|
+
for (var j = 0; j < nodes.length; j++) frag.appendChild(nodes[j]);
|
|
607
|
+
if (island && island.parentNode === target) target.insertBefore(frag, island);
|
|
608
|
+
else target.appendChild(frag);
|
|
609
|
+
|
|
610
|
+
if (fixActive) {
|
|
611
|
+
// 缓存里的高亮是上一次停留的页面,按当前路径重新点亮
|
|
612
|
+
var here = location.pathname.replace(/\/+$/, '') || '/';
|
|
613
|
+
var marks = target.querySelectorAll(
|
|
614
|
+
'[data-hydrate-cache].is-active, [data-hydrate-cache] .is-active',
|
|
615
|
+
);
|
|
616
|
+
for (var k = 0; k < marks.length; k++) marks[k].classList.remove('is-active');
|
|
617
|
+
var links = target.querySelectorAll('[data-hydrate-cache] a.tw-nav-item-main');
|
|
618
|
+
for (var m = 0; m < links.length; m++) {
|
|
619
|
+
var href = (links[m].getAttribute('href') || '').split(/[?#]/)[0].replace(/\/+$/, '');
|
|
620
|
+
if (href && href === here) {
|
|
621
|
+
var row = links[m].closest('.tw-nav-item');
|
|
622
|
+
if (row) row.classList.add('is-active');
|
|
623
|
+
}
|
|
624
|
+
}
|
|
625
|
+
}
|
|
626
|
+
}
|
|
627
|
+
}
|
|
628
|
+
|
|
629
|
+
if (!island) return;
|
|
630
|
+
|
|
631
|
+
/*
|
|
632
|
+
* 缓存已经铺上了:先给 host 打个标记,CSS 会把岛屿整块藏起来(缓存独占),
|
|
633
|
+
* 等真实内容就绪再撤。没有缓存时不打标记,走原来的 loading 骨架。
|
|
634
|
+
*/
|
|
635
|
+
var pendingMarked = false;
|
|
636
|
+
function markPending() {
|
|
637
|
+
if (pendingMarked || !html) return;
|
|
638
|
+
pendingMarked = true;
|
|
639
|
+
target.setAttribute('data-hydrate-pending', '');
|
|
640
|
+
// 兜底:页面一直加载不出来时别把岛屿永远藏着
|
|
641
|
+
setTimeout(function () {
|
|
642
|
+
target.removeAttribute('data-hydrate-pending');
|
|
643
|
+
}, 8000);
|
|
644
|
+
}
|
|
645
|
+
function unmarkPending() {
|
|
646
|
+
target.removeAttribute('data-hydrate-pending');
|
|
647
|
+
}
|
|
648
|
+
markPending();
|
|
649
|
+
|
|
650
|
+
/**
|
|
651
|
+
* 岛屿处于首屏 loading:此时缓存片段继续占位(CSS 同时把岛屿藏起来)。
|
|
652
|
+
* `.tw-lib-spin` / `aria-busy` 是各页面 loading 骨架的统一特征。
|
|
653
|
+
*/
|
|
654
|
+
function isPending() {
|
|
655
|
+
return Boolean(
|
|
656
|
+
island.querySelector('.tw-hydrate-pending, [aria-busy="true"], .tw-lib-spin'),
|
|
657
|
+
);
|
|
658
|
+
}
|
|
659
|
+
|
|
660
|
+
/** 撤掉缓存片段(含淡出中的) */
|
|
661
|
+
function dropCache() {
|
|
662
|
+
var kids = Array.prototype.slice.call(target.children);
|
|
663
|
+
for (var i = 0; i < kids.length; i++) {
|
|
664
|
+
if (kids[i].hasAttribute && kids[i].hasAttribute('data-hydrate-cache')) {
|
|
665
|
+
kids[i].parentNode.removeChild(kids[i]);
|
|
666
|
+
}
|
|
667
|
+
}
|
|
668
|
+
}
|
|
669
|
+
|
|
670
|
+
/** 列出当前缓存节点 */
|
|
671
|
+
function cacheNodes() {
|
|
672
|
+
var out = [];
|
|
673
|
+
var kids = target.children;
|
|
674
|
+
for (var i = 0; i < kids.length; i++) {
|
|
675
|
+
if (kids[i].hasAttribute && kids[i].hasAttribute('data-hydrate-cache')) {
|
|
676
|
+
out.push(kids[i]);
|
|
677
|
+
}
|
|
678
|
+
}
|
|
679
|
+
return out;
|
|
680
|
+
}
|
|
681
|
+
|
|
682
|
+
var timer = 0;
|
|
683
|
+
var settled = false;
|
|
684
|
+
var saved = '';
|
|
685
|
+
/** 单页缓存上限:列表页的 DOM 可能有两三百 KB,超过就不存(仍走正常加载) */
|
|
686
|
+
var MAX_HTML = 600000;
|
|
687
|
+
|
|
688
|
+
/**
|
|
689
|
+
* 所有页面的刷新缓存共用一份预算(3MB):超了就先扔最大的旧页面缓存,
|
|
690
|
+
* 不去碰 nav / 自动化测试的缓存(这两处最常驻,扔了会明显闪)。
|
|
691
|
+
* 不做这一步的话 localStorage 5MB 配额会被几个大列表页吃光。
|
|
692
|
+
*/
|
|
693
|
+
var PAGE_CACHE_BUDGET = 3 * 1024 * 1024;
|
|
694
|
+
function trimOtherPageCaches(needBytes) {
|
|
695
|
+
var entries = [];
|
|
696
|
+
for (var i = 0; i < localStorage.length; i++) {
|
|
697
|
+
var k = localStorage.key(i);
|
|
698
|
+
if (!k || k === key) continue;
|
|
699
|
+
if (k.indexOf('tw.hydrate.') !== 0) continue;
|
|
700
|
+
if (k.indexOf('tw.hydrate.nav') === 0 || k.indexOf('tw.hydrate.ui-auto') === 0) continue;
|
|
701
|
+
entries.push({ k: k, len: (localStorage.getItem(k) || '').length });
|
|
702
|
+
}
|
|
703
|
+
var total = entries.reduce(function (sum, e) {
|
|
704
|
+
return sum + e.len;
|
|
705
|
+
}, needBytes);
|
|
706
|
+
entries.sort(function (a, b) {
|
|
707
|
+
return b.len - a.len;
|
|
708
|
+
});
|
|
709
|
+
for (var j = 0; j < entries.length && total > PAGE_CACHE_BUDGET; j++) {
|
|
710
|
+
try {
|
|
711
|
+
localStorage.removeItem(entries[j].k);
|
|
712
|
+
total -= entries[j].len;
|
|
713
|
+
} catch (e) {
|
|
714
|
+
/* ignore */
|
|
715
|
+
}
|
|
716
|
+
}
|
|
717
|
+
}
|
|
718
|
+
|
|
719
|
+
function saveCache(html) {
|
|
720
|
+
if (!html || html === saved || html.length > MAX_HTML) return;
|
|
721
|
+
trimOtherPageCaches(html.length);
|
|
722
|
+
try {
|
|
723
|
+
localStorage.setItem(key, html);
|
|
724
|
+
saved = html;
|
|
725
|
+
return;
|
|
726
|
+
} catch (e) {
|
|
727
|
+
// 配额满:腾掉其它页面缓存再试一次
|
|
728
|
+
}
|
|
729
|
+
trimOtherPageCaches(html.length);
|
|
730
|
+
try {
|
|
731
|
+
localStorage.setItem(key, html);
|
|
732
|
+
saved = html;
|
|
733
|
+
} catch (e) {
|
|
734
|
+
/* 隐私模式 / 配额仍然不足:放弃缓存 */
|
|
735
|
+
}
|
|
736
|
+
}
|
|
737
|
+
|
|
738
|
+
/** 把当前渲染结果存一份(页面在数据变化后离开时也调用,缓存不会停在首屏) */
|
|
739
|
+
function persistNow() {
|
|
740
|
+
if (!capture) return;
|
|
741
|
+
if (!island.firstElementChild || isPending()) return;
|
|
742
|
+
// 只渲染了提示(插件关闭 / 服务未就绪)时不缓存
|
|
743
|
+
var first = island.firstElementChild;
|
|
744
|
+
if (first && first.classList && first.classList.contains('tw-lib-notice')) return;
|
|
745
|
+
saveCache(island.innerHTML.trim());
|
|
746
|
+
}
|
|
747
|
+
|
|
748
|
+
/**
|
|
749
|
+
* 真实内容就绪后换层:
|
|
750
|
+
* 1) 先把缓存改成绝对叠层(仍盖住画面)
|
|
751
|
+
* 2) 再撤 pending,露出底下已排好的岛屿
|
|
752
|
+
* 3) 缓存短淡出后删除
|
|
753
|
+
* 切勿在撤 pending 前让缓存仍是 in-flow —— 会和岛屿并排把布局摊成两半。
|
|
754
|
+
*/
|
|
755
|
+
function flush() {
|
|
756
|
+
timer = 0;
|
|
757
|
+
if (settled) return;
|
|
758
|
+
if (!island.firstElementChild) return;
|
|
759
|
+
if (isPending()) return;
|
|
760
|
+
|
|
761
|
+
settled = true;
|
|
762
|
+
mo.disconnect();
|
|
763
|
+
|
|
764
|
+
var caches = cacheNodes();
|
|
765
|
+
if (!caches.length) {
|
|
766
|
+
unmarkPending();
|
|
767
|
+
persistNow();
|
|
768
|
+
return;
|
|
769
|
+
}
|
|
770
|
+
|
|
771
|
+
var pendingFade = caches.length;
|
|
772
|
+
function doneOne() {
|
|
773
|
+
pendingFade -= 1;
|
|
774
|
+
if (pendingFade <= 0) dropCache();
|
|
775
|
+
}
|
|
776
|
+
|
|
777
|
+
for (var i = 0; i < caches.length; i++) {
|
|
778
|
+
(function (el) {
|
|
779
|
+
el.setAttribute('data-hydrate-leaving', '');
|
|
780
|
+
var finished = false;
|
|
781
|
+
function finish() {
|
|
782
|
+
if (finished) return;
|
|
783
|
+
finished = true;
|
|
784
|
+
el.removeEventListener('transitionend', onEnd);
|
|
785
|
+
if (el.parentNode) el.parentNode.removeChild(el);
|
|
786
|
+
doneOne();
|
|
787
|
+
}
|
|
788
|
+
function onEnd(ev) {
|
|
789
|
+
if (ev && ev.target !== el) return;
|
|
790
|
+
if (ev && ev.propertyName && ev.propertyName !== 'opacity') return;
|
|
791
|
+
finish();
|
|
792
|
+
}
|
|
793
|
+
el.addEventListener('transitionend', onEnd);
|
|
794
|
+
setTimeout(finish, 200);
|
|
795
|
+
})(caches[i]);
|
|
796
|
+
}
|
|
797
|
+
|
|
798
|
+
// 读一次布局,确保 leaving 的 absolute 已生效,再露岛屿
|
|
799
|
+
void caches[0].offsetWidth;
|
|
800
|
+
unmarkPending();
|
|
801
|
+
persistNow();
|
|
802
|
+
|
|
803
|
+
// 下一帧再收透明度,保证能跑上 transition(同帧改 opacity 常被合成跳过)
|
|
804
|
+
requestAnimationFrame(function () {
|
|
805
|
+
for (var j = 0; j < caches.length; j++) {
|
|
806
|
+
if (caches[j].parentNode) caches[j].style.opacity = '0';
|
|
807
|
+
}
|
|
808
|
+
});
|
|
809
|
+
}
|
|
810
|
+
|
|
811
|
+
// 离开页面 / 切到后台时再存一次:列表增删改之后,下次刷新看到的是最新一屏
|
|
812
|
+
window.addEventListener('pagehide', persistNow);
|
|
813
|
+
document.addEventListener('visibilitychange', function () {
|
|
814
|
+
if (document.visibilityState === 'hidden') persistNow();
|
|
815
|
+
});
|
|
816
|
+
|
|
817
|
+
function schedule() {
|
|
818
|
+
if (settled || timer) return;
|
|
819
|
+
// 内容就绪后稍等级联更新结束再换层;过长会盯着旧画面突然一跳
|
|
820
|
+
timer = setTimeout(flush, 64);
|
|
821
|
+
}
|
|
822
|
+
|
|
823
|
+
var mo = new MutationObserver(schedule);
|
|
824
|
+
mo.observe(island, { childList: true, subtree: true, characterData: true });
|
|
825
|
+
schedule();
|
|
826
|
+
} catch (e) {
|
|
827
|
+
// 缓存坏了就当没有
|
|
828
|
+
}
|
|
829
|
+
})();
|
|
830
|
+
})();</script></div></div></main><astro-island uid="1ae4mb" component-url="/_astro/Toast.BO2NFckG.js" component-export="GlobalToastHost" renderer-url="/_astro/client.BHNTqLjv.js" props="{"data-astro-transition-persist":[0,"astro-34g7cspi-4"]}" ssr client="only" opts="{"name":"GlobalToastHost","value":"react"}" data-astro-transition-persist="astro-34g7cspi-4"></astro-island></div><script>
|
|
831
|
+
(function () {
|
|
832
|
+
/**
|
|
833
|
+
* 切页滚回顶部。
|
|
834
|
+
* 只在「换页后」重置:若在 before-preparation(点击瞬间)就重置,
|
|
835
|
+
* 当前页面会先跳回顶部、再等新页到达,用户看到的就是「打开时还在滚动」。
|
|
836
|
+
* 带锚点(#)时交给浏览器定位,不强制回顶。
|
|
837
|
+
*/
|
|
838
|
+
try {
|
|
839
|
+
if ('scrollRestoration' in history) history.scrollRestoration = 'manual';
|
|
840
|
+
} catch (e) {}
|
|
841
|
+
function twScrollTop() {
|
|
842
|
+
if (location.hash) return;
|
|
843
|
+
if (window.scrollY === 0 && document.documentElement.scrollTop === 0) return;
|
|
844
|
+
try {
|
|
845
|
+
// instant:不受将来可能加入的 scroll-behavior: smooth 影响
|
|
846
|
+
window.scrollTo({ top: 0, left: 0, behavior: 'instant' });
|
|
847
|
+
} catch (e) {
|
|
848
|
+
// 旧浏览器不认 instant,会抛 TypeError,退回普通写法
|
|
849
|
+
window.scrollTo(0, 0);
|
|
850
|
+
}
|
|
851
|
+
document.documentElement.scrollTop = 0;
|
|
852
|
+
document.body.scrollTop = 0;
|
|
853
|
+
var main = document.querySelector('.tw-main');
|
|
854
|
+
if (main) main.scrollTop = 0;
|
|
855
|
+
}
|
|
856
|
+
document.addEventListener('astro:after-swap', twScrollTop);
|
|
857
|
+
document.addEventListener('astro:page-load', twScrollTop);
|
|
858
|
+
|
|
859
|
+
/**
|
|
860
|
+
* 软导航「闪白」修复。
|
|
861
|
+
* ClientRouter 交换文档时,会用新文档 <html> 的属性整体替换当前 <html>,
|
|
862
|
+
* 于是 data-theme 连同 style 里的 color-scheme 一起被清空;在主题属性
|
|
863
|
+
* 恢复之前,color-scheme 回落到 normal,画布变白 —— 深色主题下就是
|
|
864
|
+
* 切页瞬间的闪白(与具体页面无关,所有路由都受影响)。
|
|
865
|
+
* 在交换前把主题 / 语言写进新文档的 <html>,交换完成时即已带上,不留空档。
|
|
866
|
+
*/
|
|
867
|
+
document.addEventListener('astro:before-swap', function (e) {
|
|
868
|
+
var next = e.newDocument;
|
|
869
|
+
if (!next || !next.documentElement) return;
|
|
870
|
+
var cur = document.documentElement;
|
|
871
|
+
var nextRoot = next.documentElement;
|
|
872
|
+
var theme = cur.dataset.theme;
|
|
873
|
+
if (theme) {
|
|
874
|
+
nextRoot.dataset.theme = theme;
|
|
875
|
+
nextRoot.style.colorScheme = theme;
|
|
876
|
+
}
|
|
877
|
+
if (cur.lang) nextRoot.lang = cur.lang;
|
|
878
|
+
// 新文档是「解析」出来的:head 里的内联脚本在解析阶段不会执行,
|
|
879
|
+
// 于是所有运行期写在 <html> 上的状态都不会自带。主题 / 语言之外,
|
|
880
|
+
// 侧栏收起状态与空间服务可用性同样要显式搬过去,否则每次软导航都会丢
|
|
881
|
+
// (表现为侧栏自己弹开、骨架又冒出来)。
|
|
882
|
+
if (cur.dataset.navCollapsed === '1') nextRoot.dataset.navCollapsed = '1';
|
|
883
|
+
if (cur.dataset.spaceService) nextRoot.dataset.spaceService = cur.dataset.spaceService;
|
|
884
|
+
// 插件开关同理:不搬过去会先亮出被隐藏的侧栏入口,等 page-load 再收起
|
|
885
|
+
[
|
|
886
|
+
'pluginOffTasks',
|
|
887
|
+
'pluginOffTodos',
|
|
888
|
+
'pluginOffProjects',
|
|
889
|
+
'pluginOffIterations',
|
|
890
|
+
'pluginOffPmRequirements',
|
|
891
|
+
'pluginOffBugs',
|
|
892
|
+
'pluginOffReports',
|
|
893
|
+
'pluginOffTestStats',
|
|
894
|
+
'pluginOffCaseExec',
|
|
895
|
+
'pluginOffDashboard',
|
|
896
|
+
'pluginOffCases',
|
|
897
|
+
'pluginOffKnowledgeLib',
|
|
898
|
+
'pluginOffRequirements',
|
|
899
|
+
'pluginOffTemplates',
|
|
900
|
+
].forEach(function (key) {
|
|
901
|
+
if (cur.dataset[key]) nextRoot.dataset[key] = cur.dataset[key];
|
|
902
|
+
});
|
|
903
|
+
});
|
|
904
|
+
|
|
905
|
+
/** 版本日志「查看更多」:委托绑定,兼容 View Transitions 软导航 */
|
|
906
|
+
document.addEventListener('click', function (e) {
|
|
907
|
+
var t = e.target;
|
|
908
|
+
if (!(t instanceof Element)) return;
|
|
909
|
+
var btn = t.closest('.tw-changelog-toggle');
|
|
910
|
+
if (!(btn instanceof HTMLButtonElement)) return;
|
|
911
|
+
var card = btn.closest('.tw-changelog-card');
|
|
912
|
+
if (!(card instanceof HTMLElement)) return;
|
|
913
|
+
e.preventDefault();
|
|
914
|
+
var next = card.getAttribute('data-open') !== 'true';
|
|
915
|
+
card.setAttribute('data-open', next ? 'true' : 'false');
|
|
916
|
+
btn.setAttribute('aria-expanded', next ? 'true' : 'false');
|
|
917
|
+
var label = btn.querySelector('.tw-changelog-toggle-label');
|
|
918
|
+
if (label) label.textContent = next ? '收起' : '查看更多';
|
|
919
|
+
});
|
|
920
|
+
})();
|
|
921
|
+
</script></body></html>
|