dsh-brief-sidebar 0.9.26 → 0.9.28
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/LICENSE +21 -21
- package/README.de.md +2 -1
- package/README.es.md +2 -1
- package/README.fr.md +2 -1
- package/README.it.md +2 -1
- package/README.md +2 -1
- package/README.pt.md +296 -0
- package/README.ru.md +2 -1
- package/cordis.patch.yml +18 -18
- package/dsh.plugin.json +16 -16
- package/lib/client.js +320 -3
- package/lib/client.js.map +1 -1
- package/lib/index.mjs.map +1 -1
- package/lib/types/client/locales.d.ts +4 -2
- package/lib/types/client/star-row-copy.d.ts +20 -0
- package/locale/de.json +6 -6
- package/locale/en.json +6 -6
- package/locale/es.json +6 -6
- package/locale/fr.json +6 -6
- package/locale/it.json +6 -6
- package/locale/ja.json +6 -6
- package/locale/ko.json +6 -6
- package/locale/pt.json +6 -0
- package/locale/ru.json +6 -6
- package/locale/zh.json +6 -6
- package/package.json +116 -116
- package/screenshots.json +5 -5
- package/src/client/BriefIcon.tsx +56 -56
- package/src/client/SummaryTab.tsx +78 -78
- package/src/client/TodoBoardTab.tsx +188 -188
- package/src/client/brief/board.ts +104 -104
- package/src/client/brief/dock-shadow.tsx +74 -74
- package/src/client/brief/use-todos.ts +27 -27
- package/src/client/echo-viewer/echo-viewer.tsx +135 -135
- package/src/client/family-host.tsx +220 -220
- package/src/client/file-open.ts +108 -108
- package/src/client/index.tsx +415 -415
- package/src/client/locales.ts +111 -2
- package/src/client/memory-open.ts +52 -52
- package/src/client/memory-tab.ts +35 -35
- package/src/client/memory-viewer/viewer.tsx +179 -179
- package/src/client/native-sidebar.tsx +149 -149
- package/src/client/scope-face.ts +101 -101
- package/src/client/settings-card.tsx +2 -0
- package/src/client/spirit-echo.ts +255 -255
- package/src/client/spirit-open.ts +49 -49
- package/src/client/star-row-copy.ts +256 -0
- package/src/client/summary/DeliverablesSection.tsx +247 -247
- package/src/client/summary/EchoViewMenu.tsx +189 -189
- package/src/client/summary/FoldToggle.tsx +114 -114
- package/src/client/summary/MemoryRecallSection.tsx +654 -654
- package/src/client/summary/MemorySlotsSection.tsx +291 -291
- package/src/client/summary/MemoryViewMenu.tsx +247 -247
- package/src/client/summary/RecallBubble.tsx +256 -256
- package/src/client/summary/ReferenceSection.tsx +235 -235
- package/src/client/summary/SearchRefSection.tsx +313 -313
- package/src/client/summary/SkillUsageSection.tsx +191 -191
- package/src/client/summary/SpiritEchoSection.tsx +350 -350
- package/src/client/summary/deliverables.ts +105 -105
- package/src/client/summary/memory-recall.ts +131 -131
- package/src/client/summary/memory-slots.ts +145 -145
- package/src/client/summary/recall-feedback.ts +164 -164
- package/src/client/summary/search-refs.ts +185 -185
- package/src/client/summary/skill-usage.ts +124 -124
- package/src/client/summary/use-config-flag.ts +60 -60
- package/src/client/use-projection.ts +130 -130
- package/src/index.ts +77 -77
- package/src/projection/keys.ts +113 -113
package/lib/client.js
CHANGED
|
@@ -633,7 +633,7 @@ window.__ModuleLoader__.load({
|
|
|
633
633
|
* `LocaleNamespaceMap` merge table, which is exactly what the untyped
|
|
634
634
|
* `register(ns, dicts)` overload is for — but the dictionaries themselves stay
|
|
635
635
|
* strictly paired: `zh` is the key-set source of truth and every other language
|
|
636
|
-
* (`en`, plus the fr/de/it/ru/es pack) is typed as
|
|
636
|
+
* (`en`, plus the fr/de/it/ru/es/pt pack) is typed as
|
|
637
637
|
* `Record<keyof typeof zh, string>`, so a missing or extra key is a COMPILE
|
|
638
638
|
* error rather than a runtime fallback to the raw key.
|
|
639
639
|
*
|
|
@@ -647,7 +647,7 @@ window.__ModuleLoader__.load({
|
|
|
647
647
|
* All locales in the shape the locale service consumes. Registered in ONE call:
|
|
648
648
|
* the registry rejects a duplicate `(namespace, locale)` pair and the
|
|
649
649
|
* per-locale form would leave a half-registered namespace if a later call
|
|
650
|
-
* threw. `zh`/`en` are the host built-ins; the fr/de/it/ru/es pack rides the
|
|
650
|
+
* threw. `zh`/`en` are the host built-ins; the fr/de/it/ru/es/pt pack rides the
|
|
651
651
|
* same map form (every id is a valid BCP 47-style tag, so the registry accepts
|
|
652
652
|
* it as-is).
|
|
653
653
|
*/
|
|
@@ -1596,6 +1596,111 @@ window.__ModuleLoader__.load({
|
|
|
1596
1596
|
"memoryView.failDisabled": "La entrada de la biblioteca de memoria está desactivada en los ajustes",
|
|
1597
1597
|
"memoryView.failUnmounted": "Este host no monta la página de la biblioteca de memoria",
|
|
1598
1598
|
"memoryView.failUnregistered": "El host no ha registrado la página de la biblioteca de memoria"
|
|
1599
|
+
},
|
|
1600
|
+
pt: {
|
|
1601
|
+
"tab.title": "Resumo",
|
|
1602
|
+
"tab.desc": "Tarefas, arquivos produzidos e artefatos de planejamento desta sessão (somente leitura)",
|
|
1603
|
+
"section.progress": "Progresso",
|
|
1604
|
+
"section.deliverables": "Arquivos produzidos",
|
|
1605
|
+
"board.empty": "Nenhuma tarefa ainda",
|
|
1606
|
+
"board.emptyHint": "As tarefas aparecem aqui quando o modelo chama todo_write.",
|
|
1607
|
+
"board.unavailable": "Tarefas indisponíveis",
|
|
1608
|
+
"board.unavailableHint": "Esta sessão ainda não recebeu dados de todo; o painel se preenche no primeiro quadro.",
|
|
1609
|
+
"status.pending": "Pendente",
|
|
1610
|
+
"status.inProgress": "Em andamento",
|
|
1611
|
+
"status.completed": "Concluída",
|
|
1612
|
+
"deliverables.empty": "Nenhum arquivo alterado neste turno",
|
|
1613
|
+
"deliverables.emptyHint": "Arquivos gravados ou editados com sucesso na sessão aparecem aqui em tempo real.",
|
|
1614
|
+
"deliverables.history": "Alterações anteriores · {count}",
|
|
1615
|
+
"deliverables.historyMore": "Mais {count}",
|
|
1616
|
+
"deliverables.currentTurn": "Este turno · {count}",
|
|
1617
|
+
"deliverables.historyCapped": "(a sessão produziu {total} arquivos; a lista está truncada)",
|
|
1618
|
+
"deliverable.codeplanTag": "Planejamento",
|
|
1619
|
+
"section.memorySlots": "Memória",
|
|
1620
|
+
"slots.empty": "Nenhum slot de memória ativo",
|
|
1621
|
+
"slots.emptyHint": "Os slots aparecem aqui em tempo real quando o dsh-prime-memory os ativa.",
|
|
1622
|
+
"slots.openCount": "{count} slots abertos",
|
|
1623
|
+
"slots.viewMemory": "Ver",
|
|
1624
|
+
"slots.status.open": "Ativo",
|
|
1625
|
+
"slots.status.done": "Concluído",
|
|
1626
|
+
"slots.status.dropped": "Descartado",
|
|
1627
|
+
"slots.status.expired": "Expirado",
|
|
1628
|
+
"section.memoryRecall": "Recordação desta sessão",
|
|
1629
|
+
"recall.empty": "Nenhuma memória recordada nesta sessão ainda",
|
|
1630
|
+
"recall.count": "{count} injetadas · as substituídas por resumo ficam recolhidas (limpas só ao limpar a sessão)",
|
|
1631
|
+
"recall.rateHint": "Selecione uma memória para marcá-la: relevância 0–5; -1 declara obsoleta e a retira (recuperável).",
|
|
1632
|
+
"recall.obsolete": "Obsoleta",
|
|
1633
|
+
"recall.obsoleteConfirm": "Retirar?",
|
|
1634
|
+
"recall.obsoleted": "Marcada como obsoleta",
|
|
1635
|
+
"recall.rated": "Avaliada com {count}/5",
|
|
1636
|
+
"recall.failed": "Falha ao marcar: ",
|
|
1637
|
+
"recall.obsoleteWhy": "Declará-la obsoleta retira o registro (recuperável) e avisa o modelo no próximo turno",
|
|
1638
|
+
"recall.viewDetail": "Ver",
|
|
1639
|
+
"recall.strikeHint": "; uma entrada marcada como obsoleta continua na lista, riscada (removida só quando você limpa a sessão)",
|
|
1640
|
+
"recall.supersededHidden": "{count} recordações antigas ocultas — o texto foi substituído por um resumo",
|
|
1641
|
+
"recall.activeGroup": "Recordações ativas · {count}",
|
|
1642
|
+
"recall.historyGroup": "Recordações anteriores · {count}",
|
|
1643
|
+
"recall.supersededTag": "substituída por resumo",
|
|
1644
|
+
"recall.noBody": "(este quadro não traz o texto completo deste registro)",
|
|
1645
|
+
"section.skillUsage": "Referências de skills",
|
|
1646
|
+
"section.references": "Referências",
|
|
1647
|
+
"references.tabSkills": "Skills",
|
|
1648
|
+
"references.tabMemory": "Memória",
|
|
1649
|
+
"skillUsage.empty": "Nenhuma skill carregada nesta sessão",
|
|
1650
|
+
"skillUsage.emptyHint": "As skills aparecem aqui quando o modelo carrega uma com a ferramenta `skill`, ou quando você invoca uma diretamente.",
|
|
1651
|
+
"skillUsage.uses": "{count}x",
|
|
1652
|
+
"skillUsage.count": "{count} carregamentos - {total} skills",
|
|
1653
|
+
"skillUsage.latestTag": "este turno",
|
|
1654
|
+
"skillUsage.invokedGroup": "Referenciadas · {count}",
|
|
1655
|
+
"skillUsage.availableGroup": "Disponíveis nesta sessão · {count}",
|
|
1656
|
+
"skillUsage.availableCapped": "({count} skills no catálogo; a lista está truncada)",
|
|
1657
|
+
"section.searchRefs": "Buscas na web",
|
|
1658
|
+
"references.tabSearch": "Buscas",
|
|
1659
|
+
"references.tabEcho": "Eco",
|
|
1660
|
+
"searchRefs.empty": "Nenhuma busca nesta sessão",
|
|
1661
|
+
"searchRefs.emptyHint": "As consultas e as fontes retornadas aparecem aqui quando o modelo chama web_search ou advanced_search.",
|
|
1662
|
+
"searchRefs.queryGroup": "Consultas · {count}",
|
|
1663
|
+
"searchRefs.sourceGroup": "Fontes · {count}",
|
|
1664
|
+
"searchRefs.hits": "{count} retornadas",
|
|
1665
|
+
"searchRefs.latestTag": "Este turno",
|
|
1666
|
+
"searchRefs.noSourcesHint": "(esta compilação do dsh-free-search não devolve a lista de fontes; atualize para vê-las)",
|
|
1667
|
+
"searchRefs.capped": "({total} na sessão; a lista está truncada)",
|
|
1668
|
+
"settings.title": "Barra lateral de resumo",
|
|
1669
|
+
"settings.desc": "Interruptores de seção da aba de resumo na barra lateral direita (visões somente leitura).",
|
|
1670
|
+
"settings.memorySlots": "Seção de slots de memória",
|
|
1671
|
+
"settings.memorySlotsHint": "Quando ativa, a aba de resumo lista os slots de memória ativos do dsh-prime-memory abaixo de progresso e arquivos produzidos (somente leitura).",
|
|
1672
|
+
"settings.memoryRecall": "Seção de recordação da sessão",
|
|
1673
|
+
"settings.memoryRecallHint": "Quando ativa, a aba Resumo lista as memórias injetadas nesta sessão e permite avaliá-las (0–5; -1 declara uma obsoleta e a retira). Entradas que um resumo substituiu ficam recolhidas.",
|
|
1674
|
+
"settings.spiritEcho": "Aba Eco",
|
|
1675
|
+
"settings.spiritEchoHint": "Quando ativa, o painel de referências mantém a aba Eco, que lista as entradas ecoadas e os trechos recordados desta sessão (persistidos entre reinícios). Desligar esconde a aba inteira.",
|
|
1676
|
+
"settings.unavailable": "A superfície de configuração está indisponível; a seção de memória usa o padrão (ativa).",
|
|
1677
|
+
"settings.readonly": "Esta configuração é somente leitura aqui; não há como editá-la.",
|
|
1678
|
+
"section.spiritEcho": "Eco",
|
|
1679
|
+
"echo.segmentCount": "{count} trechos recordados nesta sessão",
|
|
1680
|
+
"echo.stepCount": "{count} entradas de eco nesta sessão",
|
|
1681
|
+
"echo.openOriginal": "Abrir original",
|
|
1682
|
+
"echo.skippedSummary": "{count} rodadas não injetaram nada ({reasons})",
|
|
1683
|
+
"echo.injectedEmpty": "(sem resumo)",
|
|
1684
|
+
"echo.totalHint": "Trechos nesta sessão: {count} (mantidos entre reinícios)",
|
|
1685
|
+
"echo.latest": "Mais recente:",
|
|
1686
|
+
"echo.lastStep": "Rodada anterior:",
|
|
1687
|
+
"echo.injected": "injetado",
|
|
1688
|
+
"echo.skipped": "pulado",
|
|
1689
|
+
"echo.empty": "Nenhum trecho de eco recordado nesta sessão ainda",
|
|
1690
|
+
"echo.emptyHint": "Os trechos que o dsh-spirit recordou para esta sessão serão listados aqui.",
|
|
1691
|
+
"echo.goto": "Entradas →",
|
|
1692
|
+
"echo.gotoGraph": "Mapa estelar →",
|
|
1693
|
+
"echo.gotoFail": "Não foi possível abrir a página do eco",
|
|
1694
|
+
"echo.viewMenu": "Ver",
|
|
1695
|
+
"memoryView.button": "Detalhes",
|
|
1696
|
+
"memoryView.preview": "Visão rápida",
|
|
1697
|
+
"memoryView.entry": "Entradas",
|
|
1698
|
+
"memoryView.graph2d": "Gráfico 2D",
|
|
1699
|
+
"memoryView.graph3d": "Gráfico 3D",
|
|
1700
|
+
"memoryView.failAbsent": "Biblioteca de memória indisponível (o dsh-prime-memory não está instalado)",
|
|
1701
|
+
"memoryView.failDisabled": "A entrada da biblioteca de memória está desativada nas configurações de memória",
|
|
1702
|
+
"memoryView.failUnmounted": "Este host não monta a página inteira da biblioteca de memória",
|
|
1703
|
+
"memoryView.failUnregistered": "O host não registrou a página da biblioteca de memória"
|
|
1599
1704
|
}
|
|
1600
1705
|
};
|
|
1601
1706
|
/**
|
|
@@ -5402,6 +5507,216 @@ window.__ModuleLoader__.load({
|
|
|
5402
5507
|
}, TodoDockShadow));
|
|
5403
5508
|
}
|
|
5404
5509
|
//#endregion
|
|
5510
|
+
//#region src/client/star-row-copy.ts
|
|
5511
|
+
/**
|
|
5512
|
+
* star-row 真源(面板 star 快车道行,v1)——纯 DOM 实现,零依赖。
|
|
5513
|
+
*
|
|
5514
|
+
* 副本约束:生成文件名 star-row-copy.ts,头部须保留 /** 块注释,单行 ≤140
|
|
5515
|
+
* 字宽(sidebar-fold 仓 lint 门禁:max-line + file-header)。
|
|
5516
|
+
*
|
|
5517
|
+
* 契约(对齐 panel-star-row spec):
|
|
5518
|
+
* - 渲染一行 <a>:GitHub 单色 SVG + `owner/name`;variant A 追加一句工程话术;
|
|
5519
|
+
* - 整行即链接(A/L 档),新标签页打开;不做弹窗、不做按钮交互;
|
|
5520
|
+
* - 文案内嵌 10 语,按 `document.documentElement.lang` 前缀自选
|
|
5521
|
+
* (同 sidebar-fold `pickDictionary` 口径),不依赖宿主 locale 服务,
|
|
5522
|
+
* 避免逐仓动字典文件;
|
|
5523
|
+
* - 样式一次性注入 <style data-dsh-star-row>,色随 currentColor,深浅主题自适应;
|
|
5524
|
+
* - 副本由 _tools/star-row/sync.mjs 生成到各仓 `src/client/star-row-copy.ts`
|
|
5525
|
+
* (文件名含 copy,locale 守卫豁免规则命中),改副本无效,改真源后重跑 sync。
|
|
5526
|
+
*
|
|
5527
|
+
* 每仓生成时在文件头部烘焙 REPO_URL / STAR_NS / STAR_VARIANT 三个常量。
|
|
5528
|
+
*/
|
|
5529
|
+
/** 生成段:REPO_URL / STAR_NS / STAR_VARIANT 由 sync 注入。 */
|
|
5530
|
+
const REPO_URL = "https://github.com/drscrewdriver/dsh-brief-sidebar";
|
|
5531
|
+
const STAR_NS = "brief-sidebar";
|
|
5532
|
+
/** zh 为键集真理源;10 语与 sidebar-fold/manage-session 同集合。 */
|
|
5533
|
+
const STAR_COPY = {
|
|
5534
|
+
zh: { ask: "觉得省事了?一颗 Star 让工具被更多人看见" },
|
|
5535
|
+
en: { ask: "Finding it handy? A star helps more people discover this tool" },
|
|
5536
|
+
ja: { ask: "便利でしたら⭐で、このツールがもっと届きます" },
|
|
5537
|
+
ko: { ask: "유용했다면 ⭐ 하나로 더 많은 사용자에게 닿습니다" },
|
|
5538
|
+
fr: { ask: "Utile ? Une étoile aide cet outil à être découvert" },
|
|
5539
|
+
de: { ask: "Nützlich? Ein Stern hilft dem Tool, gesehen zu werden" },
|
|
5540
|
+
it: { ask: "Ti è utile? Una stella aiuta questo tool a farsi scoprire" },
|
|
5541
|
+
ru: { ask: "Пригодилось? Звезда поможет большему числу людей узнать о tool" },
|
|
5542
|
+
es: { ask: "¿Te resulta útil? Una estrella ayuda a que más gente lo descubra" },
|
|
5543
|
+
pt: { ask: "Achou útil? Uma estrela ajuda mais pessoas a descobrir a ferramenta" }
|
|
5544
|
+
};
|
|
5545
|
+
const STAR_LANGS = [
|
|
5546
|
+
"zh",
|
|
5547
|
+
"en",
|
|
5548
|
+
"ja",
|
|
5549
|
+
"ko",
|
|
5550
|
+
"fr",
|
|
5551
|
+
"de",
|
|
5552
|
+
"it",
|
|
5553
|
+
"ru",
|
|
5554
|
+
"es",
|
|
5555
|
+
"pt"
|
|
5556
|
+
];
|
|
5557
|
+
/** GitHub mark(Simple Icons / octicon 轮廓,24 视口),fill 随 currentColor。 */
|
|
5558
|
+
const GITHUB_MARK_PATH = "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 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 3.633 17.7c-1.087-.744.084-.729.084-.729 1.205.084 1.838 1.236 1.838 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3-5.466-1.332 -5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523.105-3.176 0 0 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 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 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 3.286 0 .315.21.69.825.57C20.565 22.092 24 17.592 24 12.297c0-6.627-5.373-12-12-12";
|
|
5559
|
+
const STYLE_ID = "dsh-star-row-style";
|
|
5560
|
+
const STYLE_CSS = [
|
|
5561
|
+
".dsh-star-row{display:flex;align-items:center;gap:7px;font-size:12px;",
|
|
5562
|
+
"line-height:1.5;color:inherit;text-decoration:none;opacity:.72;padding:3px 0;",
|
|
5563
|
+
"margin-top:6px;min-width:0;flex-wrap:wrap}",
|
|
5564
|
+
".dsh-star-row:hover{opacity:1;text-decoration:underline}",
|
|
5565
|
+
".dsh-star-row svg{width:14px;height:14px;flex:none;display:block}",
|
|
5566
|
+
".dsh-star-row .dsh-star-ask{opacity:.85;font-weight:400}"
|
|
5567
|
+
].join("");
|
|
5568
|
+
const STAR_CTA = {
|
|
5569
|
+
zh: "留颗 Star",
|
|
5570
|
+
en: "Star",
|
|
5571
|
+
ja: "スター",
|
|
5572
|
+
ko: "스타",
|
|
5573
|
+
fr: "Star",
|
|
5574
|
+
de: "Stern",
|
|
5575
|
+
it: "Stella",
|
|
5576
|
+
ru: "Звезда",
|
|
5577
|
+
es: "Estrella",
|
|
5578
|
+
pt: "Estrela"
|
|
5579
|
+
};
|
|
5580
|
+
/** 隐藏钮的可读名(★ 之外的独立动作,10 语同集)。 */
|
|
5581
|
+
const STAR_HIDE = {
|
|
5582
|
+
zh: "不再提示",
|
|
5583
|
+
en: "Dismiss",
|
|
5584
|
+
ja: "今後表示しない",
|
|
5585
|
+
ko: "다시 보지 않기",
|
|
5586
|
+
fr: "Masquer",
|
|
5587
|
+
de: "Ausblenden",
|
|
5588
|
+
it: "Nascondi",
|
|
5589
|
+
ru: "Скрыть",
|
|
5590
|
+
es: "Ocultar",
|
|
5591
|
+
pt: "Ocultar"
|
|
5592
|
+
};
|
|
5593
|
+
const STAR_S_STYLE_ID = "dsh-star-row-s-style";
|
|
5594
|
+
const STAR_S_STYLE = [
|
|
5595
|
+
".dsh-star-row-s{display:flex;align-items:center;gap:8px;flex-wrap:wrap;",
|
|
5596
|
+
"font-size:12px;line-height:1.5;color:inherit;opacity:.75;margin-top:10px;",
|
|
5597
|
+
"padding-top:8px;border-top:1px solid var(--dsw-alias-border-l2,currentColor)}",
|
|
5598
|
+
".dsh-star-row-s:hover{opacity:1}",
|
|
5599
|
+
".dsh-star-link{display:inline-flex;align-items:center;gap:6px;",
|
|
5600
|
+
"color:inherit;text-decoration:none}",
|
|
5601
|
+
".dsh-star-link:hover{text-decoration:underline}",
|
|
5602
|
+
".dsh-star-link svg{width:14px;height:14px;flex:none;display:block}",
|
|
5603
|
+
".dsh-star-row-s .dsh-star-ask{opacity:.85;font-weight:400}",
|
|
5604
|
+
".dsh-star-cta,.dsh-star-hide{font:inherit;font-size:11px;line-height:1;",
|
|
5605
|
+
"padding:4px 9px;border-radius:999px;border:1px solid currentColor;",
|
|
5606
|
+
"background:transparent;color:inherit;cursor:pointer;flex:none;opacity:.7}",
|
|
5607
|
+
".dsh-star-hide{padding:4px 7px}",
|
|
5608
|
+
".dsh-star-cta:hover,.dsh-star-hide:hover{opacity:1}"
|
|
5609
|
+
].join("");
|
|
5610
|
+
/** 宿主语言标签归一:取 `documentElement.lang` 的前缀,命中 STAR_LANGS 即用。 */
|
|
5611
|
+
function starLang() {
|
|
5612
|
+
const low = (typeof document !== "undefined" && document.documentElement.lang || "").toLowerCase();
|
|
5613
|
+
for (const cand of STAR_LANGS) if (low.startsWith(cand)) return cand;
|
|
5614
|
+
return "en";
|
|
5615
|
+
}
|
|
5616
|
+
/** 是否已被用户点掉话术(隐私模式下读失败按未关闭处理,只影响本次会话)。 */
|
|
5617
|
+
function starDismissed() {
|
|
5618
|
+
try {
|
|
5619
|
+
return localStorage.getItem("dsh.star." + STAR_NS + ".dismissed") === "1";
|
|
5620
|
+
} catch {
|
|
5621
|
+
return false;
|
|
5622
|
+
}
|
|
5623
|
+
}
|
|
5624
|
+
/** 记住关闭态(隐私模式写失败不报错,话术本次隐藏、刷新复活)。 */
|
|
5625
|
+
function starDismiss() {
|
|
5626
|
+
try {
|
|
5627
|
+
localStorage.setItem("dsh.star." + STAR_NS + ".dismissed", "1");
|
|
5628
|
+
} catch {}
|
|
5629
|
+
}
|
|
5630
|
+
/** 一次性注入 S 档样式。 */
|
|
5631
|
+
function injectStarSStyle(d) {
|
|
5632
|
+
if (d.getElementById(STAR_S_STYLE_ID)) return;
|
|
5633
|
+
const style = d.createElement("style");
|
|
5634
|
+
style.id = STAR_S_STYLE_ID;
|
|
5635
|
+
style.textContent = STAR_S_STYLE;
|
|
5636
|
+
d.head.appendChild(style);
|
|
5637
|
+
}
|
|
5638
|
+
/** 打开仓库页:桌面壳里 window.open 可能被拦,锚点 click 才是两条路径都通的写法。 */
|
|
5639
|
+
function openRepo(d) {
|
|
5640
|
+
const a = d.createElement("a");
|
|
5641
|
+
a.href = REPO_URL;
|
|
5642
|
+
a.target = "_blank";
|
|
5643
|
+
a.rel = "noopener noreferrer";
|
|
5644
|
+
a.click();
|
|
5645
|
+
}
|
|
5646
|
+
/** S 档扩充:把裸链接行升级成「链接 | 话术 | ★ CTA | × 隐藏」,非 S 档返回 null 走原路径。 */
|
|
5647
|
+
function extendedStarRow(link, d) {
|
|
5648
|
+
if (starDismissed()) return link;
|
|
5649
|
+
injectStarSStyle(d);
|
|
5650
|
+
link.className = "dsh-star-link";
|
|
5651
|
+
const lang = starLang();
|
|
5652
|
+
const row = d.createElement("div");
|
|
5653
|
+
row.className = "dsh-star-row-s";
|
|
5654
|
+
row.appendChild(link);
|
|
5655
|
+
const ask = d.createElement("span");
|
|
5656
|
+
ask.className = "dsh-star-ask";
|
|
5657
|
+
ask.textContent = STAR_COPY[lang].ask;
|
|
5658
|
+
row.appendChild(ask);
|
|
5659
|
+
const cta = d.createElement("button");
|
|
5660
|
+
cta.type = "button";
|
|
5661
|
+
cta.className = "dsh-star-cta";
|
|
5662
|
+
cta.textContent = "★ " + STAR_CTA[lang];
|
|
5663
|
+
cta.addEventListener("click", (event) => {
|
|
5664
|
+
event.preventDefault();
|
|
5665
|
+
event.stopPropagation();
|
|
5666
|
+
openRepo(d);
|
|
5667
|
+
});
|
|
5668
|
+
row.appendChild(cta);
|
|
5669
|
+
const hide = d.createElement("button");
|
|
5670
|
+
hide.type = "button";
|
|
5671
|
+
hide.className = "dsh-star-hide";
|
|
5672
|
+
hide.textContent = "×";
|
|
5673
|
+
hide.title = STAR_HIDE[lang];
|
|
5674
|
+
hide.setAttribute("aria-label", STAR_HIDE[lang]);
|
|
5675
|
+
hide.addEventListener("click", (event) => {
|
|
5676
|
+
event.preventDefault();
|
|
5677
|
+
event.stopPropagation();
|
|
5678
|
+
starDismiss();
|
|
5679
|
+
if (row.parentNode) {
|
|
5680
|
+
row.parentNode.replaceChild(link, row);
|
|
5681
|
+
link.className = "dsh-star-row";
|
|
5682
|
+
}
|
|
5683
|
+
});
|
|
5684
|
+
row.appendChild(hide);
|
|
5685
|
+
return row;
|
|
5686
|
+
}
|
|
5687
|
+
/** 在目标文档上建出快车道行(一次性注入样式)。纯 DOM,React 仓经 ref 回调挂载。 */
|
|
5688
|
+
function mountStarRow(doc) {
|
|
5689
|
+
const d = doc ?? document;
|
|
5690
|
+
if (!d.getElementById(STYLE_ID)) {
|
|
5691
|
+
const tag = d.createElement("style");
|
|
5692
|
+
tag.id = STYLE_ID;
|
|
5693
|
+
tag.textContent = STYLE_CSS;
|
|
5694
|
+
d.head.appendChild(tag);
|
|
5695
|
+
}
|
|
5696
|
+
const match = REPO_URL.match(/github\.com\/([^/]+\/[^/#?]+)/);
|
|
5697
|
+
const repo = match ? match[1] : "drscrewdriver";
|
|
5698
|
+
const a = d.createElement("a");
|
|
5699
|
+
a.className = "dsh-star-row";
|
|
5700
|
+
a.href = REPO_URL;
|
|
5701
|
+
a.target = "_blank";
|
|
5702
|
+
a.rel = "noreferrer";
|
|
5703
|
+
a.dataset.starNs = STAR_NS;
|
|
5704
|
+
const svg = d.createElementNS("http://www.w3.org/2000/svg", "svg");
|
|
5705
|
+
svg.setAttribute("viewBox", "0 0 24 24");
|
|
5706
|
+
svg.setAttribute("aria-hidden", "true");
|
|
5707
|
+
const path = d.createElementNS("http://www.w3.org/2000/svg", "path");
|
|
5708
|
+
path.setAttribute("fill", "currentColor");
|
|
5709
|
+
path.setAttribute("d", GITHUB_MARK_PATH);
|
|
5710
|
+
svg.appendChild(path);
|
|
5711
|
+
a.appendChild(svg);
|
|
5712
|
+
const label = d.createElement("span");
|
|
5713
|
+
label.textContent = repo;
|
|
5714
|
+
a.appendChild(label);
|
|
5715
|
+
const row = extendedStarRow(a, d);
|
|
5716
|
+
if (row) return row;
|
|
5717
|
+
return a;
|
|
5718
|
+
}
|
|
5719
|
+
//#endregion
|
|
5405
5720
|
//#region src/client/settings-card.tsx
|
|
5406
5721
|
/**
|
|
5407
5722
|
* BriefSettingsCard — the brief-sidebar settings card.
|
|
@@ -5588,7 +5903,9 @@ window.__ModuleLoader__.load({
|
|
|
5588
5903
|
onToggle: (next) => {
|
|
5589
5904
|
scope?.set("showMemorySlots", next);
|
|
5590
5905
|
}
|
|
5591
|
-
})), !unavailable && !snapshot.writable && (0, react.createElement)("p", { style: HINT_STYLE }, t("settings.readonly"))))
|
|
5906
|
+
})), !unavailable && !snapshot.writable && (0, react.createElement)("p", { style: HINT_STYLE }, t("settings.readonly"))), (0, react.createElement)("span", { ref: (node) => {
|
|
5907
|
+
if (node && !node.firstChild) node.appendChild(mountStarRow());
|
|
5908
|
+
} }));
|
|
5592
5909
|
}
|
|
5593
5910
|
//#endregion
|
|
5594
5911
|
//#region src/client/family-host.tsx
|