cortico-world-fishx 0.7.3 → 0.8.1

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,22 +752,33 @@ 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;
770
+ const noteTop = postcardLocation ? footer + 172 : footer + 105;
657
771
  for (let index = 0; index < characters.length; index += 1) {
658
772
  const next = line + characters[index];
659
773
  if (context.measureText(next).width > 1060) {
660
- context.fillText(row === 2 ? `${line}…` : line, 60, footer + 190 + row * 36, 1080);
774
+ context.fillText(row === 2 ? `${line}…` : line, 60, noteTop + row * 36, 1080);
661
775
  row += 1;
662
776
  line = '';
663
777
  if (row === 3) break;
664
778
  }
665
779
  line += characters[index];
666
780
  }
667
- if (line && row < 3) context.fillText(line, 60, footer + 105 + row * 36, 1080);
781
+ if (line && row < 3) context.fillText(line, 60, noteTop + row * 36, 1080);
668
782
  const png = canvas.toDataURL('image/png');
669
783
  if (!png.startsWith('data:image/png')) throw new Error('当前环境无法导出 PNG,请尝试其他浏览器。');
670
784
  if (!current()) return;
@@ -707,6 +821,70 @@ function mount(ctx) {
707
821
  const sport = selectedSport();
708
822
  return sport?.locations?.find(location => location.id === locationSelect.value) || null;
709
823
  };
824
+ function renderMap() {
825
+ mapPoints.replaceChildren();
826
+ const locations = sportsFrom(state).flatMap(sport => (Array.isArray(sport.locations) ? sport.locations : []).map(location => ({ ...location, sport })));
827
+ const visibleLocations = locations.filter(location => Number.isFinite(location.mapX) && Number.isFinite(location.mapY));
828
+ visibleLocations.forEach(location => {
829
+ const point = doc.createElementNS('http://www.w3.org/2000/svg', 'circle');
830
+ point.setAttribute('cx', String(location.mapX * 10));
831
+ point.setAttribute('cy', String(location.mapY * 5));
832
+ point.setAttribute('r', '7');
833
+ point.setAttribute('class', `fx-map-point ${state?.visitedLocations?.[location.id] ? 'fx-visited' : 'fx-unvisited'}`);
834
+ point.setAttribute('tabindex', '0');
835
+ point.setAttribute('role', 'button');
836
+ point.setAttribute('aria-label', `${location.name} · ${sportName(location.sport)} · ${location.region}`);
837
+ const select = () => {
838
+ selectedMapLocationId = location.id;
839
+ mapDetail.replaceChildren(node('strong', '', `${location.name} · ${sportName(location.sport)}`), node('span', '', `${location.region} · ${field(location.scenery)} · 打卡 ${state?.visitedLocations?.[location.id]?.count ?? 0} 次`));
840
+ };
841
+ listeners(point, 'click', select);
842
+ listeners(point, 'focus', select);
843
+ listeners(point, 'keydown', event => { if (event.key === 'Enter' || event.key === ' ') { event.preventDefault(); select(); } });
844
+ mapPoints.append(point);
845
+ });
846
+ if (!visibleLocations.some(location => location.id === selectedMapLocationId)) {
847
+ mapDetail.textContent = visibleLocations.length ? `地图上有 ${visibleLocations.length} 处内置与自定义地标;亮点代表已打卡。` : '暂无带坐标的地标。';
848
+ }
849
+ }
850
+ async function expeditionAction(action, payload = {}) {
851
+ if (!active() || playing || refreshing || changingSports) return;
852
+ try {
853
+ await post(action, payload);
854
+ await refresh(true);
855
+ notice.textContent = action === 'startExpedition' ? '远征已开启。' : action === 'abandonExpedition' ? '远征已放弃。' : '远征已更新。';
856
+ } catch (error) { showError(`远征操作失败:${getError(error)}`); }
857
+ }
858
+ function renderExpeditions() {
859
+ expeditionSection.replaceChildren();
860
+ const routes = Array.isArray(state?.expeditions) ? state.expeditions : [];
861
+ if (!routes.length) return;
862
+ expeditionSection.append(node('h3', '', '连环探险 · 远征路线'));
863
+ routes.forEach(route => {
864
+ const card = node('article', 'fx-expedition');
865
+ const head = node('div', 'fx-expedition-head');
866
+ 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' : ''));
867
+ card.append(head, node('p', 'fx-small fx-muted', field(route.desc)));
868
+ const stops = node('div', 'fx-expedition-stops');
869
+ (route.stops ?? []).forEach(stop => {
870
+ const done = (route.completedStopIds ?? []).includes(stop.locationId);
871
+ stops.append(node('span', `fx-expedition-stop${done ? ' fx-done' : ''}`, `${done ? '✓ ' : ''}${field(stop.label ?? stop.location?.name)} · ${field(stop.sport?.name ?? stop.sportId)}`));
872
+ });
873
+ card.append(stops);
874
+ if (route.active && route.nextStop) {
875
+ const next = button(`沿远征下一站出发 · ${field(route.nextStop.label)}`, () => {
876
+ const stop = route.nextStop;
877
+ selectedSportId = stop.sportId;
878
+ sportSelect.value = stop.sportId;
879
+ syncLocationSelector();
880
+ locationSelect.value = stop.locationId;
881
+ play(stop.sportId, undefined, { locationId: stop.locationId, expeditionId: route.id });
882
+ });
883
+ card.append(next, button('放弃远征', () => expeditionAction('abandonExpedition')));
884
+ } else if (!route.active && !route.completed) card.append(button('开启远征', () => expeditionAction('startExpedition', { expeditionId: route.id })));
885
+ expeditionSection.append(card);
886
+ });
887
+ }
710
888
  function syncLocationSelector() {
711
889
  const sport = selectedSport();
712
890
  const previous = locationSelect.value;
@@ -753,6 +931,7 @@ function mount(ctx) {
753
931
  });
754
932
  }
755
933
  async function setSeason(value) {
934
+ panel.setAttribute('data-season', value === 'auto' ? (state?.seasonState?.id || 'off') : value);
756
935
  try {
757
936
  seasonSelect.disabled = true;
758
937
  const result = await call('setSeason', [{ seasonOverride: value }]);
@@ -912,6 +1091,7 @@ function mount(ctx) {
912
1091
  seasonTitle.textContent = season?.active ? `${season.name} \u00b7 \u5b63\u8282\u9650\u5b9a\u6d3b\u52a8` : '\u5b63\u8282\u6d3b\u52a8\u5df2\u5173\u95ed';
913
1092
  seasonHint.textContent = [season?.active && season?.festival?.name ? `\u8282\u65e5\u5f69\u86cb\uff1a${season.festival.name}` : '', season?.weather ? `\u5f53\u5b63\u63a8\u8350\uff1a${season.weather}` : ''].filter(Boolean).join(' \u00b7 ') || '\u9009\u62e9\u5b63\u8282\uff0c\u53d1\u73b0\u5f53\u5b63\u63a8\u8350\u4e0e\u8282\u65e5\u98ce\u666f';
914
1093
  seasonSelect.value = seasonOverride ?? (season?.id ?? 'off');
1094
+ panel.setAttribute('data-season', season?.id || 'off');
915
1095
  const challenge = state?.dailyChallenge;
916
1096
  dailyButton.hidden = !hasSportId(challenge?.sportId);
917
1097
  dailyButton.replaceChildren(node('strong', '', '今日青空挑战'), node('span', '', `${field(challenge?.sportName)} · ${field(challenge?.weatherName, '任意天气')}`), badge(challenge?.completed ? '已完成' : '未完成', challenge?.completed ? 'fx-good' : ''), node('div', 'fx-small', challenge?.completed ? '今日奖励已领取 · 仍可再次体验' : '首次完成:双倍 XP + 必掉纪念品 · 点击出发'));
@@ -1085,6 +1265,7 @@ function mount(ctx) {
1085
1265
  return parts.filter(Boolean).join(' · ') || '未提供状态';
1086
1266
  }
1087
1267
  function renderReceipt(parent, entry, historical, generation) {
1268
+ parent.append(postmark(entry));
1088
1269
  const title = node('div', 'fx-row');
1089
1270
  title.append(node('h3', '', sportName(entry)));
1090
1271
  if (sportTag(entry)) title.append(node('span', 'fx-tag', sportTag(entry)));
@@ -1103,6 +1284,9 @@ function mount(ctx) {
1103
1284
  parent.append(node('p', 'fx-note', `${domainName}熟练度 +${outcomeXP[story.outcome] * (story.dailyCompleted ? 2 : 1)} XP · Lv.${story.domainLevel ?? 1}${story.leveledUp ? ' · 升级啦!' : ''}${receiptDryRun ? '(试运行,不保存)' : ''}`));
1104
1285
  }
1105
1286
  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)}`));
1287
+ if (entry?.companionNote || story.companionNote) parent.append(node('p', 'fx-note fx-companion-note', `小蓝鲸来信:${field(entry?.companionNote ?? story.companionNote)}`));
1288
+ if (entry?.packItem?.bonusLine || story.packItem?.bonusLine) parent.append(node('p', 'fx-note fx-pack-bonus', field(entry?.packItem?.bonusLine ?? story.packItem?.bonusLine)));
1289
+ if (entry?.userReaction) parent.append(badge(`已${{ praise: '夸夸', encourage: '鼓励', highfive: '击掌' }[entry.userReaction] ?? '互动'}`, 'fx-good'));
1106
1290
  if (story.souvenir) parent.append(node('p', 'fx-note', `获得纪念品:${field(story.souvenir.name)}${story.souvenir.desc ? ` · ${story.souvenir.desc}` : ''}`));
1107
1291
  addField(parent, 'CAPTION · 运动文案', field(entry?.caption, historical ? '历史未保存文案' : '本次未返回文案'), 'fx-text fx-caption');
1108
1292
  if (!historical && entry?.drawError) parent.append(node('p', 'fx-note', `出图暂未成功:${getError(entry.drawError)}。文字手账已正常保存。`));
@@ -1111,6 +1295,15 @@ function mount(ctx) {
1111
1295
  if (historical) {
1112
1296
  return;
1113
1297
  }
1298
+ if (entry?.tripId || story.tripId || entry?.id) {
1299
+ const reactions = node('div', 'fx-reactions');
1300
+ [['praise', '夸夸她'], ['encourage', '鼓励她'], ['highfive', '击掌']].forEach(([reaction, label]) => {
1301
+ const action = button(label, () => reactToTrip(entry, reaction));
1302
+ action.disabled = Boolean(entry?.userReaction);
1303
+ reactions.append(action);
1304
+ });
1305
+ parent.append(reactions);
1306
+ }
1114
1307
  const technical = node('details', 'fx-field fx-technical');
1115
1308
  technical.append(node('summary', '', '查看绘图状态'));
1116
1309
  const meta = node('div', 'fx-meta');
@@ -1126,17 +1319,26 @@ function mount(ctx) {
1126
1319
  function renderSports() {
1127
1320
  sportsList.replaceChildren();
1128
1321
  const sports = sportsFrom(state);
1129
- const filtered = category ? sports.filter(sport => sportDomain(sport) === category) : sports;
1322
+ const challengeId = state?.dailyChallenge?.sportId;
1323
+ 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)));
1324
+ const quickMatched = searched.filter(sport => {
1325
+ if (quickFilter === 'unvisited') return (sport.locations ?? []).some(location => !state?.visitedLocations?.[location.id]);
1326
+ if (quickFilter === 'daily') return sport.id === challengeId;
1327
+ if (quickFilter === 'skilled') return Number(state?.profile?.domains?.[sportDomain(sport)]?.level) >= 3;
1328
+ return true;
1329
+ });
1330
+ const filtered = category ? quickMatched.filter(sport => sportDomain(sport) === category) : quickMatched;
1130
1331
  sportsSource.textContent = `${filtered.length} 项运动`;
1131
1332
  sportFilters.querySelectorAll('button').forEach(item => {
1132
1333
  if (item.dataset.category !== undefined) item.setAttribute('aria-pressed', String(item.dataset.category === category));
1133
1334
  });
1335
+ quickFilters.querySelectorAll('button').forEach(item => item.setAttribute('aria-pressed', String(item.dataset.quickFilter === quickFilter)));
1134
1336
  configStatus.textContent = text(state?.config?.drawTool).trim() ? '出图模式 · 照片就绪后自动收入手账' : '纯文字模式 · 同样积累熟练度与收藏';
1135
1337
  if (!sports.length) {
1136
1338
  sportsList.append(empty('state 未返回可用运动清单,请刷新或检查服务端配置。'));
1137
1339
  return;
1138
1340
  }
1139
- if (!filtered.length) sportsList.append(node('p', 'fx-muted', '此分类下暂无运动'));
1341
+ if (!filtered.length) sportsList.append(node('p', 'fx-muted', '当前搜索或筛选条件下暂无运动'));
1140
1342
  filtered.forEach((sport) => {
1141
1343
  const row = node('article', 'fx-sport');
1142
1344
  const info = node('div', 'fx-sport-info');
@@ -1292,7 +1494,7 @@ function mount(ctx) {
1292
1494
  if (active()) { changingSports = false; setBusy(); }
1293
1495
  }
1294
1496
  }
1295
- async function play(sport) {
1497
+ async function play(sport, challenge, extra) {
1296
1498
  if (!active() || playing || refreshing || changingSports || !state) return;
1297
1499
  playing = true;
1298
1500
  stopPolling();
@@ -1311,10 +1513,15 @@ function mount(ctx) {
1311
1513
  setBusy();
1312
1514
  try {
1313
1515
  const params = sport !== undefined ? { sport } : {};
1314
- if (weatherOptions.some(([id]) => id === weatherSelect.value)) params.weather = weatherSelect.value;
1516
+ const challengeWeather = challenge?.weatherId && weatherOptions.some(([id]) => id === challenge.weatherId) ? challenge.weatherId : '';
1517
+ if (challengeWeather) params.weather = challengeWeather;
1518
+ else if (weatherOptions.some(([id]) => id === weatherSelect.value)) params.weather = weatherSelect.value;
1315
1519
  if (gearSelect.value && state.unlockedGear?.includes(gearSelect.value)) params.gear = gearSelect.value;
1520
+ if (selectedPackItemId && state.packItems?.some(item => item.id === selectedPackItemId)) params.packItemId = selectedPackItemId;
1316
1521
  const location = selectedLocation();
1317
- if (location && (!sport || sport === selectedSportId)) params.locationId = location.id;
1522
+ if (extra?.locationId) params.locationId = extra.locationId;
1523
+ else if (location && (!sport || sport === selectedSportId)) params.locationId = location.id;
1524
+ if (extra?.expeditionId) params.expeditionId = extra.expeditionId;
1318
1525
  const result = await call('play', [params]);
1319
1526
  if (!active()) return;
1320
1527
  const entry = result?.receipt;
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.1",
4
+ "author": "青",
4
5
  "description": "青空极限运动:内置 18 项极限运动与世界知名地标,支持自建运动及导入导出、五域熟练度成长、每日挑战打卡、季节限定活动与明信片 PNG 合成;支持委派插件、直连 API(OpenAI/Gemini)及本地 ComfyUI 出图,纯文字也可完整游玩,数据只存本机 fish-x/。",
5
6
  "type": "module",
6
7
  "keywords": [
@@ -24,7 +25,7 @@
24
25
  "CHANGELOG.md"
25
26
  ],
26
27
  "scripts": {
27
- "test": "node test/sports.test.mjs && node test/prompt.test.mjs && node test/state.test.mjs && node test/tools.test.mjs && node test/world.test.mjs && node test/contract.test.mjs && node --test test/integration.test.mjs test/attach-image.test.mjs test/webui-api.test.mjs test/webui-client.test.mjs test/contract-check.test.mjs test/zip-manifest.test.mjs test/stage-three.test.mjs",
28
+ "test": "node test/sports.test.mjs && node test/prompt.test.mjs && node test/state.test.mjs && node test/tools.test.mjs && node test/world.test.mjs && node test/contract.test.mjs && node --test test/integration.test.mjs test/attach-image.test.mjs test/webui-api.test.mjs test/webui-client.test.mjs test/contract-check.test.mjs test/zip-manifest.test.mjs test/stage-three.test.mjs test/draw.test.mjs test/stage-four.test.mjs",
28
29
  "verify": "node tools/fix-ps1-bom.mjs --check && node tools/check-name.mjs && node tools/check-prompt.mjs && node tools/check-isolation.mjs && node tools/contract-check.mjs && node tools/smoke.mjs && node tools/make-describe.mjs --check"
29
30
  },
30
31
  "cortico": {