cortico-world-fishx 0.7.3 → 0.8.0

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/assets/icon.png CHANGED
Binary file
package/describe.json CHANGED
@@ -29,6 +29,14 @@
29
29
  "locationId": {
30
30
  "type": "string",
31
31
  "description": "指定地点 id;省略则随机。"
32
+ },
33
+ "expeditionId": {
34
+ "type": "string",
35
+ "description": "沿已启动的远征路线前往下一站。"
36
+ },
37
+ "packItemId": {
38
+ "type": "string",
39
+ "description": "随身小物 id;可从 state 的 packItems 目录选择。"
32
40
  }
33
41
  },
34
42
  "required": [],
package/dist/webui.js CHANGED
@@ -15,6 +15,8 @@ const styles = `
15
15
  @keyframes fx-pop{from{transform:scale(.9);opacity:0}to{transform:scale(1);opacity:1}}
16
16
  @media(max-width:900px){.fx-panel .fx-grid{grid-template-columns:1fr}.fx-panel .fx-receipt{position:static;max-height:none;overflow:visible}.fx-panel .fx-collection,.fx-panel .fx-souvenirs{grid-template-columns:repeat(3,minmax(0,1fr))}.fx-panel .fx-history{grid-template-columns:repeat(2,minmax(0,1fr))}}
17
17
  @media(max-width:560px){.fx-panel{padding:10px}.fx-panel .fx-journal,.fx-panel .fx-history{grid-template-columns:1fr}.fx-panel .fx-collection,.fx-panel .fx-souvenirs{grid-template-columns:repeat(2,minmax(0,1fr))}.fx-panel .fx-selectors{flex-wrap:wrap}.fx-panel .fx-primary{width:100%}.fx-panel .fx-sport-info{min-width:0}.fx-panel .fx-tabs .fx-button{font-size:12px;padding:6px 9px}}
18
+ .fx-panel[data-season="spring"]{--fx-brand:#d55788;--fx-soft:#fff0f6;--fx-bg:#fff8fb;--fx-line:#f1d5e2}.fx-panel[data-season="summer"]{--fx-brand:#087eb5;--fx-soft:#e8f7ff;--fx-bg:#f4fbff;--fx-line:#c9e5f2}.fx-panel[data-season="autumn"]{--fx-brand:#b76620;--fx-soft:#fff4e5;--fx-bg:#fffaf3;--fx-line:#efd8bb}.fx-panel[data-season="winter"]{--fx-brand:#386fc2;--fx-soft:#eaf4ff;--fx-bg:#f5faff;--fx-line:#cddff5}.fx-panel[data-season="off"]{--fx-brand:#1459d9}
19
+ .fx-map-card{overflow:hidden}.fx-map{display:block;width:100%;height:auto;min-height:220px;border:1px solid var(--fx-line);border-radius:12px;background:linear-gradient(#e8f5ff,#f9fcff)}.fx-map-grid{stroke:#9bc2df;stroke-width:.35;opacity:.45}.fx-map-land{fill:#cfe5d5;stroke:#8ab69a;stroke-width:1}.fx-map-point{cursor:pointer;stroke:#fff;stroke-width:1.5}.fx-map-point.fx-visited{fill:#ffb52e;filter:drop-shadow(0 0 5px #ff9d00)}.fx-map-point.fx-unvisited{fill:#a8c5d8}.fx-map-point:focus{outline:none;stroke:#1459d9;stroke-width:3}.fx-map-detail{margin-top:9px;padding:9px 11px;border-left:3px solid var(--fx-brand);background:var(--fx-soft);border-radius:0 8px 8px 0;min-height:42px}.fx-map-detail strong{display:block}.fx-map-detail span{display:block;color:var(--fx-muted);font-size:12px}.fx-search{flex:1;min-width:190px;border:1px solid #bacbe5;border-radius:999px;padding:8px 13px;font:inherit;color:var(--fx-ink)}.fx-filter-capsules{display:flex;gap:6px;flex-wrap:wrap;margin:8px 0}.fx-filter-capsules .fx-button{border-radius:999px;padding:5px 10px}.fx-expeditions{display:grid;gap:8px;margin-bottom:12px}.fx-expedition{border:1px solid var(--fx-line);border-radius:11px;padding:11px;background:linear-gradient(120deg,var(--fx-soft),var(--fx-card))}.fx-expedition-head{display:flex;justify-content:space-between;gap:8px;align-items:center}.fx-expedition-stops{display:flex;gap:5px;flex-wrap:wrap;margin:8px 0}.fx-expedition-stop{font-size:11px;padding:3px 7px;border-radius:999px;background:#edf3f9;color:var(--fx-muted)}.fx-expedition-stop.fx-done{background:#d9f3e8;color:var(--fx-good)}.fx-pack-select{min-width:180px}.fx-stamp{float:right;transform:rotate(-8deg);border:2px solid #315d88;border-radius:50%;width:72px;height:72px;display:grid;place-items:center;text-align:center;color:#315d88;font:9px/1.15 ui-monospace,monospace;opacity:.78;background:repeating-radial-gradient(circle,#fff0 0 7px,#315d8844 8px 9px)}.fx-reactions{display:flex;gap:6px;flex-wrap:wrap;margin-top:9px}.fx-postcard .fx-stamp{width:56px;height:56px;font-size:8px}.fx-postcard-wall{position:relative}
18
20
  `;
19
21
 
20
22
  const weatherOptions = [['sunny-morning', '澄澈晨光'], ['golden-sunset', '黄金日落'], ['misty-breeze', '薄雾微风'], ['starry-twilight', '星夜微光']];
@@ -57,6 +59,10 @@ function mount(ctx) {
57
59
  let selectedSportId = '';
58
60
  let seasonOverride = null;
59
61
  let editingLocationId = '';
62
+ let quickSearch = '';
63
+ let quickFilter = 'all';
64
+ let selectedMapLocationId = '';
65
+ let selectedPackItemId = '';
60
66
  const panelId = `fishx-${Math.random().toString(36).slice(2)}`;
61
67
  const objectURLs = new Set();
62
68
  const subscriptions = new Set();
@@ -108,6 +114,16 @@ function mount(ctx) {
108
114
  throw error;
109
115
  }
110
116
  };
117
+ const post = async (action, payload = {}) => {
118
+ try {
119
+ const result = typeof ctx.post === 'function' ? await ctx.post(action, payload) : await ctx.invoke(action, [payload]);
120
+ if (result?.ok === false) throw new Error(getError(result));
121
+ return result;
122
+ } catch (error) {
123
+ showError(`${action} 调用失败:${getError(error)}`);
124
+ throw error;
125
+ }
126
+ };
111
127
 
112
128
  const style = node('style');
113
129
  style.textContent = styles;
@@ -149,11 +165,20 @@ function mount(ctx) {
149
165
  const apiSize = node('input', 'fx-draw-api-size'); apiSize.type = 'text'; apiSize.placeholder = '1024x1024';
150
166
  apiFields.append(drawField('协议', apiProtocol), drawField('API Base URL', apiBaseUrl), drawField('API Key', apiKey), clearApiKeyLabel, drawField('模型', apiModel), drawField('尺寸', apiSize));
151
167
  const localFields = node('div', 'fx-draw-mode-fields fx-draw-local');
168
+ const localProtocol = node('select', 'fx-draw-local-protocol');
169
+ localProtocol.append(option('comfyui', 'ComfyUI'), option('sdwebui', 'SD WebUI (Automatic1111 / Forge)'));
152
170
  const comfyUrl = node('input', 'fx-draw-comfy-url'); comfyUrl.type = 'url'; comfyUrl.placeholder = 'http://127.0.0.1:8188';
153
171
  const comfyNegative = node('input', 'fx-draw-comfy-negative'); comfyNegative.type = 'text';
154
172
  const comfyWorkflow = node('textarea', 'fx-draw-comfy-workflow');
155
173
  comfyWorkflow.placeholder = '留空使用内置默认工作流;支持粘贴 ComfyUI Save (API Format) JSON,自动识别 KSampler 或 {{prompt}} 占位符';
156
- localFields.append(drawField('ComfyUI URL', comfyUrl), drawField('负向词', comfyNegative), drawField('工作流', comfyWorkflow));
174
+ const sdwebuiFields = node('div', 'fx-sdwebui-fields');
175
+ const sdwebuiUrl = node('input', 'fx-draw-sdwebui-url'); sdwebuiUrl.type = 'url'; sdwebuiUrl.placeholder = 'http://127.0.0.1:7860';
176
+ const sdwebuiSampler = node('input', 'fx-draw-sdwebui-sampler'); sdwebuiSampler.type = 'text';
177
+ const sdwebuiSteps = node('input', 'fx-draw-sdwebui-steps'); sdwebuiSteps.type = 'number';
178
+ const sdwebuiCfg = node('input', 'fx-draw-sdwebui-cfg'); sdwebuiCfg.type = 'number';
179
+ const sdwebuiNegative = node('input', 'fx-draw-sdwebui-negative'); sdwebuiNegative.type = 'text';
180
+ sdwebuiFields.append(drawField('SD WebUI URL', sdwebuiUrl), drawField('Sampler', sdwebuiSampler), drawField('Steps', sdwebuiSteps), drawField('CFG', sdwebuiCfg), drawField('Negative prompt', sdwebuiNegative));
181
+ localFields.append(drawField('本地协议', localProtocol), drawField('ComfyUI URL', comfyUrl), drawField('负向词', comfyNegative), drawField('工作流', comfyWorkflow), sdwebuiFields);
157
182
  drawFields.append(delegateFields, apiFields, localFields);
158
183
  const drawStatus = node('div', 'fx-draw-status'); drawStatus.setAttribute('role', 'status');
159
184
  const drawFooter = node('div', 'fx-draw-footer');
@@ -164,12 +189,14 @@ function mount(ctx) {
164
189
  drawDialog.append(node('h2', '', '🎨 出图设置'), drawFields, drawStatus, drawFooter);
165
190
  drawModal.append(drawDialog);
166
191
  listeners(drawMode, 'change', syncDrawMode);
192
+ listeners(localProtocol, 'change', syncDrawMode);
167
193
  listeners(drawModal, 'click', event => { if (event.target === drawModal) drawModal.hidden = true; });
168
194
  panel.append(drawModal);
169
195
  function syncDrawMode() {
170
196
  delegateFields.hidden = drawMode.value !== 'delegate';
171
197
  apiFields.hidden = drawMode.value !== 'api';
172
198
  localFields.hidden = drawMode.value !== 'local';
199
+ sdwebuiFields.hidden = drawMode.value !== 'local' || localProtocol.value !== 'sdwebui';
173
200
  }
174
201
  function openDrawSettings() {
175
202
  const config = state?.drawConfig ?? {};
@@ -185,6 +212,12 @@ function mount(ctx) {
185
212
  comfyUrl.value = text(config.comfyUrl) || 'http://127.0.0.1:8188';
186
213
  comfyNegative.value = text(config.comfyNegative);
187
214
  comfyWorkflow.value = text(config.comfyWorkflow);
215
+ localProtocol.value = config.localProtocol || 'comfyui';
216
+ sdwebuiUrl.value = text(config.sdwebuiUrl) || 'http://127.0.0.1:7860';
217
+ sdwebuiSampler.value = text(config.sdwebuiSampler) || 'DPM++ 2M';
218
+ sdwebuiSteps.value = text(config.sdwebuiSteps) || '24';
219
+ sdwebuiCfg.value = text(config.sdwebuiCfg) || '7';
220
+ sdwebuiNegative.value = text(config.sdwebuiNegative);
188
221
  drawStatus.textContent = '';
189
222
  drawStatus.className = 'fx-draw-status';
190
223
  syncDrawMode();
@@ -193,7 +226,9 @@ function mount(ctx) {
193
226
  function drawConfigPayload() {
194
227
  const config = { mode: drawMode.value, apiProtocol: apiProtocol.value,
195
228
  apiBaseUrl: apiBaseUrl.value.trim(), apiModel: apiModel.value.trim(), apiSize: apiSize.value.trim(),
196
- comfyUrl: comfyUrl.value.trim(), comfyWorkflow: comfyWorkflow.value, comfyNegative: comfyNegative.value };
229
+ comfyUrl: comfyUrl.value.trim(), comfyWorkflow: comfyWorkflow.value, comfyNegative: comfyNegative.value,
230
+ localProtocol: localProtocol.value, sdwebuiUrl: sdwebuiUrl.value.trim(), sdwebuiSampler: sdwebuiSampler.value.trim(),
231
+ sdwebuiSteps: sdwebuiSteps.value.trim(), sdwebuiCfg: sdwebuiCfg.value.trim(), sdwebuiNegative: sdwebuiNegative.value };
197
232
  if (apiKey.value) config.apiKey = apiKey.value;
198
233
  if (clearApiKey.checked) config.clearApiKey = true;
199
234
  return config;
@@ -277,6 +312,9 @@ function mount(ctx) {
277
312
  if (location) locationPreview.append(node('strong', '', `📍 ${location.name} · ${location.region}`), node('span', '', location.scenery));
278
313
  });
279
314
  const playButton = button('随机玩一次', () => play(), 'fx-primary');
315
+ const packSelect = selector('随身小物', 'fx-pack-select');
316
+ packSelect.append(option('', '不携带随身小物'));
317
+ listeners(packSelect, 'change', () => { selectedPackItemId = packSelect.value; });
280
318
  const actionStatus = node('div', 'fx-status', '正在读取状态…');
281
319
  actionStatus.setAttribute('role', 'status');
282
320
  actionStatus.setAttribute('aria-live', 'polite');
@@ -291,6 +329,18 @@ function mount(ctx) {
291
329
  sportsHeader.append(sportsTitle, sportsSource);
292
330
  const sportsList = node('div', 'fx-sports');
293
331
  sportsList.append(empty('正在加载服务端运动清单…'));
332
+ const quickSearchInput = node('input', 'fx-search');
333
+ quickSearchInput.type = 'search';
334
+ quickSearchInput.placeholder = '搜索运动、标签或地标…';
335
+ quickSearchInput.setAttribute('aria-label', '搜索运动、标签或地标');
336
+ listeners(quickSearchInput, 'input', () => { quickSearch = quickSearchInput.value.trim().toLocaleLowerCase(); renderSports(); releaseDetachedListeners(); });
337
+ const quickFilters = node('div', 'fx-filter-capsules');
338
+ [['all', '全部'], ['unvisited', '未打卡'], ['daily', '每日悬赏'], ['skilled', '高熟练度']].forEach(([id, label]) => {
339
+ const filter = button(label, () => { quickFilter = id; renderSports(); releaseDetachedListeners(); });
340
+ filter.dataset.quickFilter = id;
341
+ quickFilters.append(filter);
342
+ });
343
+ const expeditionSection = node('section', 'fx-expeditions');
294
344
  const sportFilters = node('div', 'fx-filters');
295
345
  sportFilters.setAttribute('aria-label', '运动分类');
296
346
  [['', '全部'], ...domains].forEach(([id, name]) => {
@@ -392,7 +442,7 @@ function mount(ctx) {
392
442
  const locationList = node('div', 'fx-location-list');
393
443
  locationTools.append(locationSummary, locationForm, locationList);
394
444
  listeners(locationForm, 'submit', event => { event.preventDefault(); saveLocation(); });
395
- sportsCard.append(sportsHeader, sportFilters, packActions, importDialog, addForm, locationTools, sportNotice, sportsList);
445
+ sportsCard.append(sportsHeader, quickSearchInput, quickFilters, expeditionSection, sportFilters, packActions, importDialog, addForm, locationTools, sportNotice, sportsList);
396
446
  const receiptCard = node('section', 'fx-card fx-receipt');
397
447
  receiptCard.setAttribute('aria-label', '本次回执');
398
448
  const receiptHead = node('div', 'fx-section-head');
@@ -437,9 +487,30 @@ function mount(ctx) {
437
487
  left.append(dailyButton, hero, sportsCard);
438
488
  grid.append(left, receiptCard);
439
489
  const journal = node('div', 'fx-journal');
490
+ const mapCard = node('section', 'fx-card fx-map-card');
491
+ mapCard.append(node('h2', '', '世界足迹地图'), node('p', 'fx-small fx-muted', '选择航点查看运动、地区与风景。'));
492
+ const svg = doc.createElementNS('http://www.w3.org/2000/svg', 'svg');
493
+ svg.setAttribute('class', 'fx-map');
494
+ svg.setAttribute('viewBox', '0 0 1000 500');
495
+ svg.setAttribute('role', 'group');
496
+ svg.setAttribute('aria-label', '世界运动地标互动地图');
497
+ const mapGrid = doc.createElementNS('http://www.w3.org/2000/svg', 'g');
498
+ mapGrid.setAttribute('class', 'fx-map-grid');
499
+ for (let x = 100; x < 1000; x += 100) { const line = doc.createElementNS('http://www.w3.org/2000/svg', 'path'); line.setAttribute('d', `M${x} 0V500`); line.setAttribute('class', 'fx-map-grid'); mapGrid.append(line); }
500
+ for (let y = 50; y < 500; y += 50) { const line = doc.createElementNS('http://www.w3.org/2000/svg', 'path'); line.setAttribute('d', `M0 ${y}H1000`); line.setAttribute('class', 'fx-map-grid'); mapGrid.append(line); }
501
+ svg.append(mapGrid);
502
+ const landShapes = ['M95 106 130 70 208 57 250 83 289 78 320 116 300 155 264 171 250 211 209 229 178 208 156 172 121 161Z', 'M247 238 278 252 293 296 283 341 262 378 245 348 231 307Z', 'M415 92 454 74 490 90 523 80 557 109 550 139 512 145 485 173 450 158 424 131Z', 'M481 183 526 172 557 202 574 252 558 307 533 352 507 326 494 274 470 235Z', 'M559 104 615 78 683 82 730 104 788 96 841 126 859 160 830 185 779 171 745 194 704 177 665 202 624 182 593 152Z', 'M736 276 783 264 829 284 842 319 816 347 776 338 747 314Z'];
503
+ landShapes.forEach(d => { const path = doc.createElementNS('http://www.w3.org/2000/svg', 'path'); path.setAttribute('d', d); path.setAttribute('class', 'fx-map-land'); svg.append(path); });
504
+ const mapPoints = doc.createElementNS('http://www.w3.org/2000/svg', 'g');
505
+ mapPoints.setAttribute('class', 'fx-map-points');
506
+ svg.append(mapPoints);
507
+ const mapDetail = node('div', 'fx-map-detail');
508
+ mapDetail.setAttribute('aria-live', 'polite');
509
+ mapDetail.textContent = '选择地图航点,查看地标详情。';
510
+ mapCard.append(svg, mapDetail);
440
511
  const journalIntro = node('div', 'fx-stack');
441
512
  journalIntro.append(personalityCard, growthCard);
442
- journal.append(journalIntro, achievementCard, albumCard, souvenirCard);
513
+ journal.append(mapCard, journalIntro, achievementCard, albumCard, souvenirCard);
443
514
  const tabs = node('div', 'fx-tabs');
444
515
  tabs.setAttribute('role', 'tablist');
445
516
  tabs.setAttribute('aria-label', '青空分舱');
@@ -526,6 +597,36 @@ function mount(ctx) {
526
597
  const date = new Date(value);
527
598
  return Number.isNaN(date.getTime()) ? field(value, '') : date.toLocaleString();
528
599
  }
600
+ function postmark(entry) {
601
+ const mark = doc.createElementNS('http://www.w3.org/2000/svg', 'svg');
602
+ mark.setAttribute('class', 'fx-stamp'); mark.setAttribute('viewBox', '0 0 100 100'); mark.setAttribute('role', 'img');
603
+ const place = storyOf(entry).location ?? entry?.location;
604
+ const season = state?.seasonState?.active ? state.seasonState.name : '四季旅途';
605
+ mark.setAttribute('aria-label', `邮戳:${field(place?.name, '青空')}, ${dateLabel(entry?.at) || '今日'}, ${season}`);
606
+ const circle = doc.createElementNS('http://www.w3.org/2000/svg', 'circle');
607
+ circle.setAttribute('cx', '50'); circle.setAttribute('cy', '50'); circle.setAttribute('r', '43'); circle.setAttribute('fill', 'none'); circle.setAttribute('stroke', 'currentColor'); circle.setAttribute('stroke-width', '2');
608
+ mark.append(circle);
609
+ [field(place?.name, '青空'), dateLabel(entry?.at).split(' ')[0] || '今日', season].forEach((value, index) => {
610
+ const line = doc.createElementNS('http://www.w3.org/2000/svg', 'text');
611
+ line.setAttribute('x', '50'); line.setAttribute('y', String(38 + index * 14)); line.setAttribute('text-anchor', 'middle'); line.setAttribute('fill', 'currentColor'); line.setAttribute('font-size', index === 0 ? '11' : '8');
612
+ line.textContent = value.length > 10 ? `${value.slice(0, 9)}…` : value; mark.append(line);
613
+ });
614
+ return mark;
615
+ }
616
+ async function reactToTrip(entry, reaction) {
617
+ const tripId = entry?.tripId ?? storyOf(entry).tripId ?? entry?.id;
618
+ if (!tripId || entry?.userReaction || !active()) return;
619
+ try {
620
+ const result = await post('reactTrip', { tripId, reaction });
621
+ if (result?.trip) {
622
+ currentReceipt = currentReceipt && recordKey(currentReceipt) === recordKey(entry) ? { ...currentReceipt, ...result.trip } : currentReceipt;
623
+ if (state?.last && recordKey(state.last) === recordKey(entry)) state.last = { ...state.last, ...result.trip };
624
+ historyItems = historyItems?.map(item => recordKey(item) === recordKey(entry) ? { ...item, ...result.trip } : item);
625
+ }
626
+ await refresh(true);
627
+ notice.textContent = '回信已送达,小蓝鲸记住这份鼓励了。';
628
+ } catch (error) { showError(`互动发送失败:${getError(error)}`); }
629
+ }
529
630
  function addField(parent, label, value, className = 'fx-text') {
530
631
  const group = node('div', 'fx-field');
531
632
  group.append(node('div', 'fx-label', label), node('div', className, value));
@@ -624,11 +725,13 @@ function mount(ctx) {
624
725
  canvas.height = photoHeight + 500;
625
726
  context.fillStyle = '#eaf5ff';
626
727
  context.fillRect(0, 0, canvas.width, canvas.height);
728
+ for (let offset = -canvas.height; offset < canvas.width; offset += 28) {
729
+ context.strokeStyle = Math.floor((offset + canvas.height) / 28) % 2 ? '#245c9c' : '#d95858';
730
+ context.lineWidth = 10; context.beginPath(); context.moveTo(offset, 0); context.lineTo(offset + canvas.height, canvas.height); context.stroke();
731
+ }
627
732
  context.fillStyle = '#ffffff';
628
- context.fillRect(24, 24, canvas.width - 48, canvas.height - 48);
629
- context.strokeStyle = '#418cce';
630
- context.lineWidth = 3;
631
- context.strokeRect(40, 40, canvas.width - 80, canvas.height - 80);
733
+ context.fillRect(30, 30, canvas.width - 60, canvas.height - 60);
734
+ context.strokeStyle = '#418cce'; context.lineWidth = 2; context.strokeRect(48, 48, canvas.width - 96, canvas.height - 96);
632
735
  context.fillStyle = '#1459d9';
633
736
  context.font = 'bold 26px sans-serif';
634
737
  context.fillText('青空极限运动 · 旅途明信片', 60, 85, 1080);
@@ -649,9 +752,19 @@ function mount(ctx) {
649
752
  context.font = '20px sans-serif';
650
753
  context.fillText(postcardLocation.scenery ?? '', 60, footer + 124, 1080);
651
754
  }
755
+ context.save();
756
+ context.translate(1030, 135); context.rotate(-8 * Math.PI / 180);
757
+ context.strokeStyle = '#315d88'; context.fillStyle = '#315d88'; context.lineWidth = 4;
758
+ context.beginPath(); context.arc(0, 0, 66, 0, Math.PI * 2); context.stroke();
759
+ context.font = 'bold 14px monospace'; context.textAlign = 'center';
760
+ context.fillText((postcardLocation?.name ?? '青空').slice(0, 10), 0, -12, 110);
761
+ context.font = '12px monospace'; context.fillText((dateLabel(entry?.at).split(' ')[0] || '今日').slice(0, 12), 0, 12, 110);
762
+ context.fillText((state?.seasonState?.name || '四季旅途').slice(0, 10), 0, 34, 110);
763
+ context.restore();
652
764
  context.fillStyle = '#192b3d';
653
765
  context.font = '26px sans-serif';
654
- const characters = Array.from(field(entry?.caption, '把今天的青空,收藏进明信片。').replace(/\s+/gu, ' '));
766
+ const handwrittenNote = field(entry?.companionNote ?? storyOf(entry).companionNote, field(entry?.packItem?.bonusLine ?? storyOf(entry).packItem?.bonusLine, '把今天的青空,收藏进明信片。'));
767
+ const characters = Array.from(handwrittenNote.replace(/\s+/gu, ' '));
655
768
  let line = '';
656
769
  let row = 0;
657
770
  for (let index = 0; index < characters.length; index += 1) {
@@ -707,6 +820,70 @@ function mount(ctx) {
707
820
  const sport = selectedSport();
708
821
  return sport?.locations?.find(location => location.id === locationSelect.value) || null;
709
822
  };
823
+ function renderMap() {
824
+ mapPoints.replaceChildren();
825
+ const locations = sportsFrom(state).flatMap(sport => (Array.isArray(sport.locations) ? sport.locations : []).map(location => ({ ...location, sport })));
826
+ const visibleLocations = locations.filter(location => Number.isFinite(location.mapX) && Number.isFinite(location.mapY));
827
+ visibleLocations.forEach(location => {
828
+ const point = doc.createElementNS('http://www.w3.org/2000/svg', 'circle');
829
+ point.setAttribute('cx', String(location.mapX * 10));
830
+ point.setAttribute('cy', String(location.mapY * 5));
831
+ point.setAttribute('r', '7');
832
+ point.setAttribute('class', `fx-map-point ${state?.visitedLocations?.[location.id] ? 'fx-visited' : 'fx-unvisited'}`);
833
+ point.setAttribute('tabindex', '0');
834
+ point.setAttribute('role', 'button');
835
+ point.setAttribute('aria-label', `${location.name} · ${sportName(location.sport)} · ${location.region}`);
836
+ const select = () => {
837
+ selectedMapLocationId = location.id;
838
+ mapDetail.replaceChildren(node('strong', '', `${location.name} · ${sportName(location.sport)}`), node('span', '', `${location.region} · ${field(location.scenery)} · 打卡 ${state?.visitedLocations?.[location.id]?.count ?? 0} 次`));
839
+ };
840
+ listeners(point, 'click', select);
841
+ listeners(point, 'focus', select);
842
+ listeners(point, 'keydown', event => { if (event.key === 'Enter' || event.key === ' ') { event.preventDefault(); select(); } });
843
+ mapPoints.append(point);
844
+ });
845
+ if (!visibleLocations.some(location => location.id === selectedMapLocationId)) {
846
+ mapDetail.textContent = visibleLocations.length ? `地图上有 ${visibleLocations.length} 处内置与自定义地标;亮点代表已打卡。` : '暂无带坐标的地标。';
847
+ }
848
+ }
849
+ async function expeditionAction(action, payload = {}) {
850
+ if (!active() || playing || refreshing || changingSports) return;
851
+ try {
852
+ await post(action, payload);
853
+ await refresh(true);
854
+ notice.textContent = action === 'startExpedition' ? '远征已开启。' : action === 'abandonExpedition' ? '远征已放弃。' : '远征已更新。';
855
+ } catch (error) { showError(`远征操作失败:${getError(error)}`); }
856
+ }
857
+ function renderExpeditions() {
858
+ expeditionSection.replaceChildren();
859
+ const routes = Array.isArray(state?.expeditions) ? state.expeditions : [];
860
+ if (!routes.length) return;
861
+ expeditionSection.append(node('h3', '', '连环探险 · 远征路线'));
862
+ routes.forEach(route => {
863
+ const card = node('article', 'fx-expedition');
864
+ const head = node('div', 'fx-expedition-head');
865
+ head.append(node('strong', '', `${route.badge ?? '🧭'} ${route.name}`), badge(route.active ? `进行中 ${route.progress}/${route.stops?.length ?? 3}` : route.completed ? '已完成' : '待开启', route.active || route.completed ? 'fx-good' : ''));
866
+ card.append(head, node('p', 'fx-small fx-muted', field(route.desc)));
867
+ const stops = node('div', 'fx-expedition-stops');
868
+ (route.stops ?? []).forEach(stop => {
869
+ const done = (route.completedStopIds ?? []).includes(stop.locationId);
870
+ stops.append(node('span', `fx-expedition-stop${done ? ' fx-done' : ''}`, `${done ? '✓ ' : ''}${field(stop.label ?? stop.location?.name)} · ${field(stop.sport?.name ?? stop.sportId)}`));
871
+ });
872
+ card.append(stops);
873
+ if (route.active && route.nextStop) {
874
+ const next = button(`沿远征下一站出发 · ${field(route.nextStop.label)}`, () => {
875
+ const stop = route.nextStop;
876
+ selectedSportId = stop.sportId;
877
+ sportSelect.value = stop.sportId;
878
+ syncLocationSelector();
879
+ locationSelect.value = stop.locationId;
880
+ play(stop.sportId, undefined, { locationId: stop.locationId, expeditionId: route.id });
881
+ });
882
+ card.append(next, button('放弃远征', () => expeditionAction('abandonExpedition')));
883
+ } else if (!route.active && !route.completed) card.append(button('开启远征', () => expeditionAction('startExpedition', { expeditionId: route.id })));
884
+ expeditionSection.append(card);
885
+ });
886
+ }
710
887
  function syncLocationSelector() {
711
888
  const sport = selectedSport();
712
889
  const previous = locationSelect.value;
@@ -753,6 +930,7 @@ function mount(ctx) {
753
930
  });
754
931
  }
755
932
  async function setSeason(value) {
933
+ panel.setAttribute('data-season', value === 'auto' ? (state?.seasonState?.id || 'off') : value);
756
934
  try {
757
935
  seasonSelect.disabled = true;
758
936
  const result = await call('setSeason', [{ seasonOverride: value }]);
@@ -1085,6 +1263,7 @@ function mount(ctx) {
1085
1263
  return parts.filter(Boolean).join(' · ') || '未提供状态';
1086
1264
  }
1087
1265
  function renderReceipt(parent, entry, historical, generation) {
1266
+ parent.append(postmark(entry));
1088
1267
  const title = node('div', 'fx-row');
1089
1268
  title.append(node('h3', '', sportName(entry)));
1090
1269
  if (sportTag(entry)) title.append(node('span', 'fx-tag', sportTag(entry)));
@@ -1103,6 +1282,9 @@ function mount(ctx) {
1103
1282
  parent.append(node('p', 'fx-note', `${domainName}熟练度 +${outcomeXP[story.outcome] * (story.dailyCompleted ? 2 : 1)} XP · Lv.${story.domainLevel ?? 1}${story.leveledUp ? ' · 升级啦!' : ''}${receiptDryRun ? '(试运行,不保存)' : ''}`));
1104
1283
  }
1105
1284
  if (story.location) parent.append(node('p', 'fx-note fx-location-receipt', `\u{1F4CD} ${field(story.location.name)} \u00b7 ${field(story.location.region)} \u00b7 ${field(story.location.scenery)}`));
1285
+ if (entry?.companionNote || story.companionNote) parent.append(node('p', 'fx-note fx-companion-note', `小蓝鲸来信:${field(entry?.companionNote ?? story.companionNote)}`));
1286
+ if (entry?.packItem?.bonusLine || story.packItem?.bonusLine) parent.append(node('p', 'fx-note fx-pack-bonus', field(entry?.packItem?.bonusLine ?? story.packItem?.bonusLine)));
1287
+ if (entry?.userReaction) parent.append(badge(`已${{ praise: '夸夸', encourage: '鼓励', highfive: '击掌' }[entry.userReaction] ?? '互动'}`, 'fx-good'));
1106
1288
  if (story.souvenir) parent.append(node('p', 'fx-note', `获得纪念品:${field(story.souvenir.name)}${story.souvenir.desc ? ` · ${story.souvenir.desc}` : ''}`));
1107
1289
  addField(parent, 'CAPTION · 运动文案', field(entry?.caption, historical ? '历史未保存文案' : '本次未返回文案'), 'fx-text fx-caption');
1108
1290
  if (!historical && entry?.drawError) parent.append(node('p', 'fx-note', `出图暂未成功:${getError(entry.drawError)}。文字手账已正常保存。`));
@@ -1111,6 +1293,15 @@ function mount(ctx) {
1111
1293
  if (historical) {
1112
1294
  return;
1113
1295
  }
1296
+ if (entry?.tripId || story.tripId || entry?.id) {
1297
+ const reactions = node('div', 'fx-reactions');
1298
+ [['praise', '夸夸她'], ['encourage', '鼓励她'], ['highfive', '击掌']].forEach(([reaction, label]) => {
1299
+ const action = button(label, () => reactToTrip(entry, reaction));
1300
+ action.disabled = Boolean(entry?.userReaction);
1301
+ reactions.append(action);
1302
+ });
1303
+ parent.append(reactions);
1304
+ }
1114
1305
  const technical = node('details', 'fx-field fx-technical');
1115
1306
  technical.append(node('summary', '', '查看绘图状态'));
1116
1307
  const meta = node('div', 'fx-meta');
@@ -1126,17 +1317,26 @@ function mount(ctx) {
1126
1317
  function renderSports() {
1127
1318
  sportsList.replaceChildren();
1128
1319
  const sports = sportsFrom(state);
1129
- const filtered = category ? sports.filter(sport => sportDomain(sport) === category) : sports;
1320
+ const challengeId = state?.dailyChallenge?.sportId;
1321
+ const searched = sports.filter(sport => !quickSearch || [sportName(sport), sportTag(sport), ...(sport.locations ?? []).flatMap(location => [location.name, location.region, location.scenery])].some(value => text(value).toLocaleLowerCase().includes(quickSearch)));
1322
+ const quickMatched = searched.filter(sport => {
1323
+ if (quickFilter === 'unvisited') return (sport.locations ?? []).some(location => !state?.visitedLocations?.[location.id]);
1324
+ if (quickFilter === 'daily') return sport.id === challengeId;
1325
+ if (quickFilter === 'skilled') return Number(state?.profile?.domains?.[sportDomain(sport)]?.level) >= 3;
1326
+ return true;
1327
+ });
1328
+ const filtered = category ? quickMatched.filter(sport => sportDomain(sport) === category) : quickMatched;
1130
1329
  sportsSource.textContent = `${filtered.length} 项运动`;
1131
1330
  sportFilters.querySelectorAll('button').forEach(item => {
1132
1331
  if (item.dataset.category !== undefined) item.setAttribute('aria-pressed', String(item.dataset.category === category));
1133
1332
  });
1333
+ quickFilters.querySelectorAll('button').forEach(item => item.setAttribute('aria-pressed', String(item.dataset.quickFilter === quickFilter)));
1134
1334
  configStatus.textContent = text(state?.config?.drawTool).trim() ? '出图模式 · 照片就绪后自动收入手账' : '纯文字模式 · 同样积累熟练度与收藏';
1135
1335
  if (!sports.length) {
1136
1336
  sportsList.append(empty('state 未返回可用运动清单,请刷新或检查服务端配置。'));
1137
1337
  return;
1138
1338
  }
1139
- if (!filtered.length) sportsList.append(node('p', 'fx-muted', '此分类下暂无运动'));
1339
+ if (!filtered.length) sportsList.append(node('p', 'fx-muted', '当前搜索或筛选条件下暂无运动'));
1140
1340
  filtered.forEach((sport) => {
1141
1341
  const row = node('article', 'fx-sport');
1142
1342
  const info = node('div', 'fx-sport-info');
package/package.json CHANGED
@@ -1,6 +1,7 @@
1
1
  {
2
2
  "name": "cortico-world-fishx",
3
- "version": "0.7.3",
3
+ "version": "0.8.0",
4
+ "author": "青",
4
5
  "description": "青空极限运动:内置 18 项极限运动与世界知名地标,支持自建运动及导入导出、五域熟练度成长、每日挑战打卡、季节限定活动与明信片 PNG 合成;支持委派插件、直连 API(OpenAI/Gemini)及本地 ComfyUI 出图,纯文字也可完整游玩,数据只存本机 fish-x/。",
5
6
  "type": "module",
6
7
  "keywords": [