@c4a/context-cli 0.7.90 → 0.7.91
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/cli.js +62 -1
- package/indexers/contracts/profile-contract.json +245 -245
- package/indexers/release-manifest.json +1 -1
- package/package.json +12 -12
- package/plugins/VERSION +1 -1
- package/plugins/claude/.claude-plugin/plugin.json +1 -1
- package/plugins/codex/.codex-plugin/plugin.json +2 -2
- package/plugins/cursor/.cursor-plugin/plugin.json +1 -1
- package/providers/context/manifest.json +3 -3
- package/providers/context/provider.yaml +1 -1
package/cli.js
CHANGED
|
@@ -111121,6 +111121,8 @@ const words = {
|
|
|
111121
111121
|
previous: ['查看旧文本', 'Previous text'], removed: ['移除或替换的旧内容', 'Removed or replaced content'],
|
|
111122
111122
|
removedNav: ['移除的目录条目', 'Removed navigation entries'], unplaced: ['待落位文章', 'Unplaced articles'],
|
|
111123
111123
|
sources: ['来源引用', 'Sources'], feedbackTag: ['修订', 'Notes'],
|
|
111124
|
+
previousPage: ['上一页 −', 'Previous −'], nextPage: ['下一页 +', 'Next +'],
|
|
111125
|
+
previousHint: ['上一页(快捷键 -)', 'Previous article (key -)'], nextHint: ['下一页(快捷键 +)', 'Next article (key +)'],
|
|
111124
111126
|
};
|
|
111125
111127
|
let language = 'zh';
|
|
111126
111128
|
const t = key => words[key]?.[language === 'zh' ? 0 : 1] || key;
|
|
@@ -111204,6 +111206,58 @@ function rootFor(pageId) {
|
|
|
111204
111206
|
return node?.key || null;
|
|
111205
111207
|
}
|
|
111206
111208
|
|
|
111209
|
+
/** Candidate articles in navigation order, then any the navigation does not place. */
|
|
111210
|
+
function readingOrder() {
|
|
111211
|
+
const ordered = [];
|
|
111212
|
+
const seen = new Set();
|
|
111213
|
+
function walk(parent, visited = new Set()) {
|
|
111214
|
+
for (const node of DATA.nodes.filter(item => (item.parent || null) === parent).sort((a, b) => a.order - b.order)) {
|
|
111215
|
+
if (visited.has(node.key)) continue;
|
|
111216
|
+
visited.add(node.key);
|
|
111217
|
+
const page = pagesById.get(node.page);
|
|
111218
|
+
if (page?.candidate_id && !seen.has(page.id)) { seen.add(page.id); ordered.push(page); }
|
|
111219
|
+
walk(node.key, visited);
|
|
111220
|
+
}
|
|
111221
|
+
}
|
|
111222
|
+
walk(null);
|
|
111223
|
+
return [...ordered, ...candidates.filter(page => !seen.has(page.id))];
|
|
111224
|
+
}
|
|
111225
|
+
|
|
111226
|
+
/** Home and the revision list come before the first article; previous from the first article returns home. */
|
|
111227
|
+
function pagerTargets() {
|
|
111228
|
+
const order = readingOrder();
|
|
111229
|
+
const index = view === 'article' ? order.findIndex(page => page.id === selected) : -1;
|
|
111230
|
+
return { previous: index >= 0 ? (index > 0 ? order[index - 1].id : 'home') : null, next: order[index + 1]?.id || null };
|
|
111231
|
+
}
|
|
111232
|
+
|
|
111233
|
+
function stepPage(direction) {
|
|
111234
|
+
const target = pagerTargets()[direction < 0 ? 'previous' : 'next'];
|
|
111235
|
+
if (target === 'home') showHome();
|
|
111236
|
+
else if (target) showPage(target);
|
|
111237
|
+
}
|
|
111238
|
+
|
|
111239
|
+
function updatePager() {
|
|
111240
|
+
const targets = pagerTargets();
|
|
111241
|
+
$('previous-page').disabled = !targets.previous;
|
|
111242
|
+
$('next-page').disabled = !targets.next;
|
|
111243
|
+
for (const [id, label, hint] of [['previous-page', 'previousPage', 'previousHint'], ['next-page', 'nextPage', 'nextHint']]) {
|
|
111244
|
+
$(id).textContent = t(label);
|
|
111245
|
+
$(id).title = t(hint);
|
|
111246
|
+
}
|
|
111247
|
+
}
|
|
111248
|
+
|
|
111249
|
+
function pagerKey(event) {
|
|
111250
|
+
if (event.defaultPrevented || event.ctrlKey || event.metaKey || event.altKey || event.isComposing) return false;
|
|
111251
|
+
const target = event.target;
|
|
111252
|
+
if (target?.isContentEditable || ['INPUT', 'TEXTAREA', 'SELECT'].includes(target?.tagName)) return false;
|
|
111253
|
+
if ($('copy-dialog').open) return false;
|
|
111254
|
+
const direction = ['+', '='].includes(event.key) || event.code === 'NumpadAdd' ? 1 : ['-', '_'].includes(event.key) || event.code === 'NumpadSubtract' ? -1 : 0;
|
|
111255
|
+
if (!direction) return false;
|
|
111256
|
+
event.preventDefault?.();
|
|
111257
|
+
stepPage(direction);
|
|
111258
|
+
return true;
|
|
111259
|
+
}
|
|
111260
|
+
|
|
111207
111261
|
function updateCounts() {
|
|
111208
111262
|
const revised = revisedPages().length;
|
|
111209
111263
|
$('counts').innerHTML = \`<span>\${countText(t('read'), read.size)}</span><span class="separator">/</span>\`
|
|
@@ -111293,6 +111347,7 @@ function render() {
|
|
|
111293
111347
|
$('article').classList.toggle('review-new-page', view === 'article' && page?.change === 'new');
|
|
111294
111348
|
renderNav();
|
|
111295
111349
|
updateCounts();
|
|
111350
|
+
updatePager();
|
|
111296
111351
|
if (view === 'home') renderHome();
|
|
111297
111352
|
else if (view === 'revisions') renderRevisions();
|
|
111298
111353
|
else if (page) {
|
|
@@ -111421,7 +111476,11 @@ $('clear-note').onclick = () => {
|
|
|
111421
111476
|
$('revision-note').dispatchEvent(new Event('input', { bubbles: true }));
|
|
111422
111477
|
$('revision-note').focus();
|
|
111423
111478
|
};
|
|
111424
|
-
|
|
111479
|
+
function showHome() { selected = null; active = null; view = 'home'; history.replaceState(null, '', location.pathname + location.search); render(); window.scrollTo(0, 0); }
|
|
111480
|
+
$('home').onclick = showHome;
|
|
111481
|
+
$('previous-page').onclick = () => stepPage(-1);
|
|
111482
|
+
$('next-page').onclick = () => stepPage(1);
|
|
111483
|
+
document.addEventListener('keydown', pagerKey);
|
|
111425
111484
|
$('theme').onclick = () => { document.body.classList.toggle('dark'); persist(); render(); };
|
|
111426
111485
|
$('language').onclick = () => { language = language === 'zh' ? 'en' : 'zh'; persist(); render(); };
|
|
111427
111486
|
$('copy-notes').onclick = copyNotes;
|
|
@@ -111469,6 +111528,7 @@ header nav { scrollbar-width: none; }
|
|
|
111469
111528
|
header nav::-webkit-scrollbar { display: none; }
|
|
111470
111529
|
header nav button { padding: 0 11px; }
|
|
111471
111530
|
.tools { flex-shrink: 0; gap: 16px; }
|
|
111531
|
+
.pager { display: flex; flex-shrink: 0; gap: 6px; }
|
|
111472
111532
|
.reading-progress { min-width: 225px; }
|
|
111473
111533
|
#counts { display: flex; align-items: center; justify-content: space-between; gap: 8px; white-space: nowrap; font-size: 12px; color: var(--muted); }
|
|
111474
111534
|
#counts b { font-weight: 650; color: var(--text); font-variant-numeric: tabular-nums; }
|
|
@@ -111569,6 +111629,7 @@ function renderReviewHtml(model, diagramScript) {
|
|
|
111569
111629
|
<div id="counts" aria-label="阅读进度"></div>
|
|
111570
111630
|
<div class="read-track" role="progressbar" aria-label="本轮阅读进度" aria-valuemin="0" aria-valuenow="0"><span id="read-fill"></span></div>
|
|
111571
111631
|
</div>
|
|
111632
|
+
<div class="pager" role="group" aria-label="文章翻页"><button class="btn" id="previous-page" title="上一页(快捷键 -)" disabled>上一页 −</button><button class="btn" id="next-page" title="下一页(快捷键 +)">下一页 +</button></div>
|
|
111572
111633
|
<button class="btn primary" id="copy-notes">复制修订意见</button>
|
|
111573
111634
|
</div>
|
|
111574
111635
|
<button class="btn" id="theme" aria-label="切换深色主题" title="切换深色主题">◐</button>
|