dsh-folia 4.26.0-pre.71 → 4.26.0-pre.72

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.
Files changed (2) hide show
  1. package/lib/client.js +30 -29
  2. package/package.json +1 -1
package/lib/client.js CHANGED
@@ -917,6 +917,7 @@ window.__ModuleLoader__.load({
917
917
  "对话": "Chat",
918
918
  "可选工作能力(已安装才可用)": "Optional work capabilities (installed only)",
919
919
  "能力": "Capabilities",
920
+ "工作": "Work",
920
921
  "麦克风测试": "Microphone test",
921
922
  "测试麦克风": "Test microphone",
922
923
  "录音中…": "Recording…",
@@ -964,7 +965,6 @@ window.__ModuleLoader__.load({
964
965
  "工作能力": "Work",
965
966
  "娱乐": "Fun",
966
967
  "详情": "Details",
967
- "预览图来自作者仓库": "Preview from the author's repository",
968
968
  "收起": "Collapse",
969
969
  "复制安装命令": "Copy install command",
970
970
  "已复制": "Copied",
@@ -21849,26 +21849,24 @@ window.__ModuleLoader__.load({
21849
21849
  borderRadius: '8px',
21850
21850
  background: 'rgba(255,255,255,0.06)',
21851
21851
  };
21852
- const CAP_PREVIEW_IMG = { width: '100%', height: '120px', objectFit: 'cover', display: 'block' };
21853
21852
 
21854
- /**
21855
- * 从能力条目的 `source` 推作者仓库的 OG 预览图:
21856
- * https://github.com/<owner>/<repo>[/tree/...] → https://opengraph.githubassets.com/1/<owner>/<repo>
21857
- * 非 GitHub 来源(npm / 其它)返回空串 —— 调用方据此整块不渲染,保持原布局。
21858
- * 不新增 catalog 字段,也不发起额外抓取:OG 图由 GitHub 自己生成。
21859
- */
21860
- function capPreviewUrl(source) {
21861
- const m = String(source || '').match(/^https?:\/\/(?:www\.)?github\.com\/([^/?#]+)\/([^/?#]+)/i);
21862
- if (!m) return '';
21863
- const repo = m[2].replace(/\.git$/i, '');
21864
- if (!m[1] || !repo) return '';
21865
- return 'https://opengraph.githubassets.com/1/' + m[1] + '/' + repo;
21853
+
21854
+ /** 本地封面:按名字做确定性色相,永不依赖网络(离线也好看)。 */
21855
+ function capCoverHue(item) {
21856
+ const text = String((item && (item.pkg || item.name)) || '');
21857
+ let h = 0;
21858
+ for (let i = 0; i < text.length; i += 1) h = (h * 31 + text.charCodeAt(i)) % 360;
21859
+ return h;
21860
+ }
21861
+
21862
+ function capCoverBg(item) {
21863
+ const h = capCoverHue(item);
21864
+ return 'linear-gradient(135deg, hsl(' + h + ' 45% 26%) 0%, hsl(' + ((h + 42) % 360) + ' 50% 15%) 100%)';
21866
21865
  }
21867
21866
 
21868
21867
  function CapabilityCard({ item }) {
21869
21868
  const [open, setOpen] = React.useState(false);
21870
21869
  const [copied, setCopied] = React.useState(false);
21871
- const [previewFailed, setPreviewFailed] = React.useState(false);
21872
21870
  const copy = () => {
21873
21871
  const text = String(item.command || '');
21874
21872
  try {
@@ -21908,21 +21906,24 @@ window.__ModuleLoader__.load({
21908
21906
  const body = [head];
21909
21907
  if (open) {
21910
21908
  const line = (k, v) => React.createElement('div', { key: k, className: 'we-picker__hint', style: { marginTop: '4px' } }, v);
21911
- const previewUrl = capPreviewUrl(item.source);
21912
- if (previewUrl) {
21913
- body.push(React.createElement('div', { key: 'preview', style: { marginTop: '8px' } },
21914
- React.createElement('div', { style: CAP_PREVIEW_BOX },
21915
- previewFailed ? null : React.createElement('img', {
21916
- src: previewUrl,
21917
- alt: item.name,
21918
- loading: 'lazy',
21919
- style: CAP_PREVIEW_IMG,
21920
- onError: () => setPreviewFailed(true),
21921
- })),
21909
+ // 本地生成的封面(图标 + 名称 + 分类),不依赖任何外部图片,离线也好看。
21910
+ const sectionLabel = item.section === 'fun' ? weT('娱乐') : weT('工作');
21911
+ body.push(React.createElement('div', { key: 'cover', style: { marginTop: '8px' } },
21912
+ React.createElement('div', {
21913
+ style: {
21914
+ height: '120px', borderRadius: '8px', overflow: 'hidden',
21915
+ display: 'flex', alignItems: 'center', gap: '12px', padding: '0 16px',
21916
+ background: capCoverBg(item),
21917
+ },
21918
+ }),
21919
+ React.createElement('span', { style: { fontSize: '40px', lineHeight: 1 } }, item.icon || '🧩'),
21920
+ React.createElement('div', { style: { minWidth: 0 } },
21922
21921
  React.createElement('div', {
21923
- className: 'we-picker__hint', style: { marginTop: '4px' },
21924
- }, weT('预览图来自作者仓库'))));
21925
- }
21922
+ style: { fontWeight: 600, fontSize: '14px', whiteSpace: 'nowrap', overflow: 'hidden', textOverflow: 'ellipsis' },
21923
+ }, item.name),
21924
+ React.createElement('div', {
21925
+ style: { marginTop: '4px', fontSize: '11px', opacity: 0.78, whiteSpace: 'nowrap', overflow: 'hidden', textOverflow: 'ellipsis' },
21926
+ }, sectionLabel + ' · ' + (item.pkg || '')))));
21926
21927
  body.push(React.createElement('div', { key: 'd-title', style: { marginTop: '8px', fontSize: '12px', fontWeight: 600 } }, weT('详情')));
21927
21928
  body.push(line('desc', item.authorDesc || item.summary || ''));
21928
21929
  body.push(React.createElement('div', { key: 'u-title', style: { marginTop: '8px', fontSize: '12px', fontWeight: 600 } }, weT('如何使用')));
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "dsh-folia",
3
3
  "displayName": "Folia · 壁纸引擎与 AI 桌宠",
4
- "version": "4.26.0-pre.71",
4
+ "version": "4.26.0-pre.72",
5
5
  "description": "Folia:壁纸引擎 + AI 桌宠语音助手 + 多人设角色卡 + 皮肤/开机动画 + 能力市场,一站式桌面伴侣。",
6
6
  "type": "module",
7
7
  "engines": {