magpie-digital-pet 1.1.0 → 1.1.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/package.json +1 -1
- package/page/app.css +87 -0
- package/page/app.html +22 -0
- package/page/app.js +30 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "magpie-digital-pet",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.1",
|
|
4
4
|
"description": "Unofficial third-party plugin. A virtual pet page for the magpie gateway: routed usage feeds the active partner, with local care, expeditions and collections. Depends on @jcendal/opencode-digital-pet 0.18.0; pixel sprite frames are extracted from that Apache-2.0 package's TUI bundle. Polls magpie's own usage API; never touches agents' contexts.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./index.mjs",
|
package/page/app.css
CHANGED
|
@@ -137,6 +137,93 @@ body {
|
|
|
137
137
|
line-height: 16px;
|
|
138
138
|
}
|
|
139
139
|
|
|
140
|
+
/* ---------------- Onboarding quest book ---------------- */
|
|
141
|
+
.quest-entry {
|
|
142
|
+
display: inline-flex;
|
|
143
|
+
align-items: center;
|
|
144
|
+
gap: 6px;
|
|
145
|
+
flex: none;
|
|
146
|
+
height: 28px;
|
|
147
|
+
margin-right: 8px;
|
|
148
|
+
padding: 0 9px;
|
|
149
|
+
border: 1px solid var(--accent);
|
|
150
|
+
border-radius: 5px;
|
|
151
|
+
background: var(--accent-surface);
|
|
152
|
+
color: var(--accent-fg);
|
|
153
|
+
font-size: 12px;
|
|
154
|
+
font-weight: 600;
|
|
155
|
+
cursor: pointer;
|
|
156
|
+
}
|
|
157
|
+
.quest-mark { font-family: Georgia, serif; font-size: 19px; line-height: 1; }
|
|
158
|
+
.quest-entry:hover { background: var(--panel); }
|
|
159
|
+
.quest-entry.is-unread { animation: quest-glimmer 2s ease-in-out 3; }
|
|
160
|
+
@keyframes quest-glimmer {
|
|
161
|
+
50% { box-shadow: 0 0 0 3px var(--accent-surface), 0 0 14px var(--accent-surface); }
|
|
162
|
+
}
|
|
163
|
+
.quest-book {
|
|
164
|
+
--paper: #e7d3a5;
|
|
165
|
+
--ink: #372919;
|
|
166
|
+
--paper-line: #a48a59;
|
|
167
|
+
box-sizing: border-box;
|
|
168
|
+
width: min(660px, calc(100vw - 28px));
|
|
169
|
+
max-width: none;
|
|
170
|
+
max-height: calc(100dvh - 36px);
|
|
171
|
+
padding: 9px;
|
|
172
|
+
border: 1px solid #8a6a3b;
|
|
173
|
+
border-radius: 3px;
|
|
174
|
+
background: #bda16c;
|
|
175
|
+
color: var(--ink);
|
|
176
|
+
box-shadow: 0 20px 65px #0008, inset 0 0 0 3px #d4bd89;
|
|
177
|
+
overflow: auto;
|
|
178
|
+
overscroll-behavior: contain;
|
|
179
|
+
color-scheme: light;
|
|
180
|
+
}
|
|
181
|
+
.quest-book::backdrop { background: #130f0ac4; }
|
|
182
|
+
.quest-paper {
|
|
183
|
+
padding: 22px 25px 16px;
|
|
184
|
+
border: 1px solid var(--paper-line);
|
|
185
|
+
background: radial-gradient(ellipse at 15% 0%, #fff1c93b, transparent 65%), linear-gradient(90deg, #8f683b18, transparent 8%, transparent 92%, #8f683b20), var(--paper);
|
|
186
|
+
box-shadow: inset 0 0 28px #8b65392b;
|
|
187
|
+
}
|
|
188
|
+
.quest-heading { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
|
|
189
|
+
.quest-kicker { margin: 0 0 7px; color: #70532c; font-size: 11px; letter-spacing: .16em; }
|
|
190
|
+
.quest-heading h2 { margin: 0; font: 600 26px/1.3 "Noto Serif SC", "Songti SC", SimSun, serif; color: var(--ink); }
|
|
191
|
+
.quest-close {
|
|
192
|
+
flex: none;
|
|
193
|
+
width: 32px;
|
|
194
|
+
height: 32px;
|
|
195
|
+
padding: 0;
|
|
196
|
+
border: 1px solid var(--paper-line);
|
|
197
|
+
border-radius: 2px;
|
|
198
|
+
background: transparent;
|
|
199
|
+
color: var(--ink);
|
|
200
|
+
font-size: 23px;
|
|
201
|
+
cursor: pointer;
|
|
202
|
+
}
|
|
203
|
+
.quest-close:hover { background: #8b65391a; }
|
|
204
|
+
.quest-entry:focus-visible, .quest-close:focus-visible { outline: 2px solid var(--accent-fg); outline-offset: 3px; }
|
|
205
|
+
.quest-close:focus-visible { outline-color: #62411c; }
|
|
206
|
+
.quest-intro { margin: 10px 0 20px; font-size: 12px; color: #6a5031; }
|
|
207
|
+
.quest-list { display: grid; grid-template-columns: 1fr 1fr; gap: 0 24px; padding: 0; margin: 0; list-style: none; }
|
|
208
|
+
.quest-list li { display: flex; gap: 10px; padding: 15px 0; border-top: 1px solid #9c7c494a; min-width: 0; }
|
|
209
|
+
.quest-icon { flex: none; color: #795a2d; padding-top: 2px; }
|
|
210
|
+
.quest-icon .ui-ico { width: 18px; height: 18px; }
|
|
211
|
+
.quest-list h3 { margin: 0 0 6px; font: 600 15px/1.4 "Noto Serif SC", "Songti SC", SimSun, serif; color: var(--ink); }
|
|
212
|
+
.quest-list p { margin: 0; font-size: 12px; line-height: 1.85; color: #503c25; overflow-wrap: anywhere; }
|
|
213
|
+
.quest-colophon { margin: 10px 0 0; padding-top: 12px; border-top: 1px solid #9c7c494a; color: #70532c; font-size: 11px; text-align: center; }
|
|
214
|
+
html.theme-dark .quest-book { --paper: #d4bd8d; --ink: #302315; --paper-line: #927543; }
|
|
215
|
+
@media (max-width: 520px) {
|
|
216
|
+
.quest-list { grid-template-columns: 1fr; }
|
|
217
|
+
.quest-paper { padding: 18px 17px 14px; }
|
|
218
|
+
.quest-heading h2 { font-size: 23px; }
|
|
219
|
+
.quest-list li { padding: 12px 0; }
|
|
220
|
+
.topbar #sub { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
|
|
221
|
+
.topbar .gear-wrap { flex: none; }
|
|
222
|
+
}
|
|
223
|
+
@media (prefers-reduced-motion: reduce) {
|
|
224
|
+
.quest-entry.is-unread { animation: none; }
|
|
225
|
+
}
|
|
226
|
+
|
|
140
227
|
/* ---------------- Topbar ---------------- */
|
|
141
228
|
|
|
142
229
|
.topbar {
|
package/page/app.html
CHANGED
|
@@ -13,6 +13,7 @@
|
|
|
13
13
|
<h1>宠物</h1>
|
|
14
14
|
<p class="muted small" id="sub">烧 token,养电子宠物</p>
|
|
15
15
|
<div class="gear-wrap">
|
|
16
|
+
<button type="button" class="quest-entry" id="quest-open" aria-haspopup="dialog" aria-controls="quest-book"><span class="quest-mark" aria-hidden="true">!</span><span>入门</span></button>
|
|
16
17
|
<button type="button" class="gear-btn" id="difficulty-gear" aria-haspopup="true" aria-expanded="false"
|
|
17
18
|
title="养成难度选择" aria-label="养成难度选择">
|
|
18
19
|
<svg viewBox="0 0 24 24" aria-hidden="true" fill="none" stroke="currentColor" stroke-width="1.7"
|
|
@@ -314,6 +315,27 @@
|
|
|
314
315
|
<div id="say" role="status" aria-live="polite"></div>
|
|
315
316
|
</main>
|
|
316
317
|
|
|
318
|
+
<dialog class="quest-book" id="quest-book" aria-labelledby="quest-title" aria-describedby="quest-intro">
|
|
319
|
+
<div class="quest-paper">
|
|
320
|
+
<header class="quest-heading">
|
|
321
|
+
<div><p class="quest-kicker">旅伴手记</p><h2 id="quest-title">初入数字世界</h2></div>
|
|
322
|
+
<button type="button" class="quest-close" id="quest-close" aria-label="关闭入门手记" autofocus>×</button>
|
|
323
|
+
</header>
|
|
324
|
+
<p class="quest-intro" id="quest-intro">八条小提示,陪你开始这段旅程。</p>
|
|
325
|
+
<ul class="quest-list">
|
|
326
|
+
<li><span class="quest-icon" data-quest-icon="energy" aria-hidden="true"></span><div><h3>让旅伴成长</h3><p>使用 Agent 的 token 会喂给出战伙伴;展示只切换你正在看的宠物。</p></div></li>
|
|
327
|
+
<li><span class="quest-icon" data-quest-icon="snack" aria-hidden="true"></span><div><h3>照顾它的状态</h3><p>留意饱食、心情、精力与清洁,良好状态让成长更顺利。</p></div></li>
|
|
328
|
+
<li><span class="quest-icon" data-quest-icon="pin" aria-hidden="true"></span><div><h3>约定进化方向</h3><p>亲密达到 50、状态良好时,可花碎片锁定分支,进化后会消耗亲密。</p></div></li>
|
|
329
|
+
<li><span class="quest-icon" data-quest-icon="egg" aria-hidden="true"></span><div><h3>延续新的旅程</h3><p>进化至幼年期 II 起可再领新蛋;进化树可用闲置蛋召回曾拥有的形态。</p></div></li>
|
|
330
|
+
<li><span class="quest-icon" data-quest-icon="patrol" aria-hidden="true"></span><div><h3>去远处看看</h3><p>派伙伴探险、归来领取收获,攒下碎片为栖息地添置装饰。</p></div></li>
|
|
331
|
+
<li><span class="quest-icon" data-quest-icon="check" aria-hidden="true"></span><div><h3>收下旅途奖励</h3><p>每日目标完成会自动发奖,也别忘了领取已达成的成就奖励。</p></div></li>
|
|
332
|
+
<li><span class="quest-icon" data-quest-icon="pet" aria-hidden="true"></span><div><h3>慢慢建立羁绊</h3><p>摸摸、玩耍、适时清洁和一起探险,都能增进亲密。</p></div></li>
|
|
333
|
+
<li><span class="quest-icon" data-quest-icon="shard" aria-hidden="true"></span><div><h3>积攒数据碎片</h3><p>领取探险收获、完成每日目标与领取成就奖励,都能获得碎片。</p></div></li>
|
|
334
|
+
</ul>
|
|
335
|
+
<p class="quest-colophon">随时可从右上角「入门」翻阅</p>
|
|
336
|
+
</div>
|
|
337
|
+
</dialog>
|
|
338
|
+
|
|
317
339
|
<div class="gate" id="confirm-gate" role="dialog" aria-modal="true" aria-labelledby="gate-title" hidden>
|
|
318
340
|
<div class="gate-box">
|
|
319
341
|
<h3 id="gate-title">此举动不可逆</h3>
|
package/page/app.js
CHANGED
|
@@ -4968,6 +4968,36 @@ let busy = false;
|
|
|
4968
4968
|
// 获取新蛋确认:点一下待确认,再点一下才真的换蛋。没有倒计时,点别的按钮就取消。
|
|
4969
4969
|
let spawnArmed = false;
|
|
4970
4970
|
|
|
4971
|
+
// Native modal supplies keyboard focus containment and Escape dismissal.
|
|
4972
|
+
const questBook = $("quest-book");
|
|
4973
|
+
const questOpen = $("quest-open");
|
|
4974
|
+
const questSeenKey = "magpie_pet_quest_seen";
|
|
4975
|
+
for (const el of document.querySelectorAll("[data-quest-icon]")) {
|
|
4976
|
+
el.append(svgIcon(el.dataset.questIcon));
|
|
4977
|
+
}
|
|
4978
|
+
try {
|
|
4979
|
+
if (!localStorage.getItem(questSeenKey)) questOpen.classList.add("is-unread");
|
|
4980
|
+
} catch {}
|
|
4981
|
+
questOpen.addEventListener("animationend", () => questOpen.classList.remove("is-unread"));
|
|
4982
|
+
questOpen.addEventListener("click", () => {
|
|
4983
|
+
closeGear();
|
|
4984
|
+
questBook.showModal();
|
|
4985
|
+
questOpen.classList.remove("is-unread");
|
|
4986
|
+
try { localStorage.setItem(questSeenKey, "1"); } catch {}
|
|
4987
|
+
});
|
|
4988
|
+
$("quest-close").addEventListener("click", () => questBook.close());
|
|
4989
|
+
questBook.addEventListener("close", () => questOpen.focus({ preventScroll: true }));
|
|
4990
|
+
let questBackdropDown = false;
|
|
4991
|
+
const outsideQuest = (event) => {
|
|
4992
|
+
const rect = questBook.getBoundingClientRect();
|
|
4993
|
+
return event.clientX < rect.left || event.clientX > rect.right || event.clientY < rect.top || event.clientY > rect.bottom;
|
|
4994
|
+
};
|
|
4995
|
+
questBook.addEventListener("pointerdown", (event) => { questBackdropDown = outsideQuest(event); });
|
|
4996
|
+
questBook.addEventListener("click", (event) => {
|
|
4997
|
+
if (questBackdropDown && outsideQuest(event)) questBook.close();
|
|
4998
|
+
questBackdropDown = false;
|
|
4999
|
+
});
|
|
5000
|
+
|
|
4971
5001
|
const gearBtnEl = $("difficulty-gear");
|
|
4972
5002
|
if (gearBtnEl) {
|
|
4973
5003
|
gearBtnEl.addEventListener("click", (e) => {
|