easter-egg-quest 1.0.2 → 1.0.4
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/dist/easter-egg-quest.es.js +121 -17
- package/dist/easter-egg-quest.umd.js +1 -1
- package/dist/types/rendering/NarrativeRenderer.d.ts +5 -0
- package/dist/types/stages/MotionStage.d.ts +1 -0
- package/dist/types/stages/RhythmStage.d.ts +1 -0
- package/dist/types/stages/StillnessStage.d.ts +1 -0
- package/package.json +1 -1
|
@@ -729,8 +729,8 @@ class HiddenEntry {
|
|
|
729
729
|
this._injectShimmerStyles();
|
|
730
730
|
this._createHintContainer();
|
|
731
731
|
const hints = this.script.hiddenEntryHints;
|
|
732
|
-
const FIRST_HINT_DELAY =
|
|
733
|
-
const HINT_INTERVAL =
|
|
732
|
+
const FIRST_HINT_DELAY = 3e5;
|
|
733
|
+
const HINT_INTERVAL = 6e4;
|
|
734
734
|
for (let i = 0; i < hints.length; i++) {
|
|
735
735
|
const delay = FIRST_HINT_DELAY + i * HINT_INTERVAL;
|
|
736
736
|
const timer = setTimeout(() => {
|
|
@@ -739,7 +739,7 @@ class HiddenEntry {
|
|
|
739
739
|
}, delay);
|
|
740
740
|
this.hintTimers.push(timer);
|
|
741
741
|
}
|
|
742
|
-
const shimmerDelay =
|
|
742
|
+
const shimmerDelay = 42e4;
|
|
743
743
|
const shimmerTimer = setTimeout(() => {
|
|
744
744
|
if (this._destroyed || !this.targetElement) return;
|
|
745
745
|
this.targetElement.classList.add("eeq-entry-target");
|
|
@@ -950,10 +950,46 @@ class NarrativeRenderer {
|
|
|
950
950
|
this.currentLine = line;
|
|
951
951
|
this.clearTimer = setTimeout(() => {
|
|
952
952
|
this.clear();
|
|
953
|
-
},
|
|
953
|
+
}, 12e3);
|
|
954
|
+
}
|
|
955
|
+
/**
|
|
956
|
+
* Show a narrative line with a confirmation button.
|
|
957
|
+
* Resolves when user clicks OK (no auto-advance).
|
|
958
|
+
*/
|
|
959
|
+
showLineWithConfirm(text) {
|
|
960
|
+
return new Promise((resolve) => {
|
|
961
|
+
if (!this.container) {
|
|
962
|
+
resolve();
|
|
963
|
+
return;
|
|
964
|
+
}
|
|
965
|
+
if (this.currentLine) {
|
|
966
|
+
const prev = this.currentLine;
|
|
967
|
+
prev.classList.add("eeq-narrative-exit");
|
|
968
|
+
setTimeout(() => prev.remove(), 750);
|
|
969
|
+
}
|
|
970
|
+
if (this.clearTimer) {
|
|
971
|
+
clearTimeout(this.clearTimer);
|
|
972
|
+
this.clearTimer = null;
|
|
973
|
+
}
|
|
974
|
+
const line = document.createElement("div");
|
|
975
|
+
line.className = "eeq-line";
|
|
976
|
+
line.textContent = text;
|
|
977
|
+
this.container.appendChild(line);
|
|
978
|
+
const btn = document.createElement("button");
|
|
979
|
+
btn.className = "eeq-confirm-btn";
|
|
980
|
+
btn.textContent = "OK";
|
|
981
|
+
btn.addEventListener("click", () => resolve(), { once: true });
|
|
982
|
+
line.appendChild(btn);
|
|
983
|
+
requestAnimationFrame(() => {
|
|
984
|
+
requestAnimationFrame(() => {
|
|
985
|
+
line.classList.add("eeq-line-visible");
|
|
986
|
+
});
|
|
987
|
+
});
|
|
988
|
+
this.currentLine = line;
|
|
989
|
+
});
|
|
954
990
|
}
|
|
955
991
|
/** Show a sequence of lines with pauses. */
|
|
956
|
-
async showSequence(lines, pauseMs =
|
|
992
|
+
async showSequence(lines, pauseMs = 4500) {
|
|
957
993
|
for (const line of lines) {
|
|
958
994
|
this.showLine(line);
|
|
959
995
|
await new Promise((r) => setTimeout(r, pauseMs));
|
|
@@ -1076,6 +1112,27 @@ class NarrativeRenderer {
|
|
|
1076
1112
|
.eeq-celebration.eeq-narrative-exit {
|
|
1077
1113
|
transform: translate(-50%, -50%) scale(1.1) !important;
|
|
1078
1114
|
}
|
|
1115
|
+
|
|
1116
|
+
.eeq-confirm-btn {
|
|
1117
|
+
display: block;
|
|
1118
|
+
margin: 14px auto 0;
|
|
1119
|
+
padding: 5px 32px;
|
|
1120
|
+
border: 1px solid rgba(255,255,255,0.18);
|
|
1121
|
+
border-radius: 20px;
|
|
1122
|
+
background: rgba(255,255,255,0.08);
|
|
1123
|
+
color: inherit;
|
|
1124
|
+
font-family: inherit;
|
|
1125
|
+
font-size: 0.8em;
|
|
1126
|
+
letter-spacing: 0.08em;
|
|
1127
|
+
cursor: pointer;
|
|
1128
|
+
pointer-events: auto;
|
|
1129
|
+
transition: background 0.3s, border-color 0.3s;
|
|
1130
|
+
}
|
|
1131
|
+
|
|
1132
|
+
.eeq-confirm-btn:hover {
|
|
1133
|
+
background: rgba(255,255,255,0.18);
|
|
1134
|
+
border-color: rgba(255,255,255,0.35);
|
|
1135
|
+
}
|
|
1079
1136
|
`;
|
|
1080
1137
|
}
|
|
1081
1138
|
}
|
|
@@ -3979,8 +4036,12 @@ class StillnessStage {
|
|
|
3979
4036
|
this._introPlayed = false;
|
|
3980
4037
|
const introLines = this.script.stage1Intro;
|
|
3981
4038
|
for (let i = 0; i < introLines.length; i++) {
|
|
3982
|
-
|
|
3983
|
-
|
|
4039
|
+
if (i === introLines.length - 1) {
|
|
4040
|
+
await this._showAndConfirm(introLines[i]);
|
|
4041
|
+
} else {
|
|
4042
|
+
this.bus.emit("narrative:show", introLines[i]);
|
|
4043
|
+
await this._wait(5e3);
|
|
4044
|
+
}
|
|
3984
4045
|
}
|
|
3985
4046
|
this.bus.emit("narrative:clear");
|
|
3986
4047
|
await this._wait(1e3);
|
|
@@ -4020,7 +4081,7 @@ class StillnessStage {
|
|
|
4020
4081
|
_handleBreak() {
|
|
4021
4082
|
this._breaks++;
|
|
4022
4083
|
const now = Date.now();
|
|
4023
|
-
if (now - this._lastBreakNarrativeTime >
|
|
4084
|
+
if (now - this._lastBreakNarrativeTime > 6e4) {
|
|
4024
4085
|
this._lastBreakNarrativeTime = now;
|
|
4025
4086
|
const reactions = this.script.stage1Reactions;
|
|
4026
4087
|
const line = reactions[this._narrativeIndex % reactions.length];
|
|
@@ -4031,6 +4092,16 @@ class StillnessStage {
|
|
|
4031
4092
|
_wait(ms) {
|
|
4032
4093
|
return new Promise((r) => setTimeout(r, ms));
|
|
4033
4094
|
}
|
|
4095
|
+
_showAndConfirm(text) {
|
|
4096
|
+
this.bus.emit("narrative:showConfirm", text);
|
|
4097
|
+
return new Promise((resolve) => {
|
|
4098
|
+
const handler = () => {
|
|
4099
|
+
this.bus.off("narrative:confirmed", handler);
|
|
4100
|
+
resolve();
|
|
4101
|
+
};
|
|
4102
|
+
this.bus.on("narrative:confirmed", handler);
|
|
4103
|
+
});
|
|
4104
|
+
}
|
|
4034
4105
|
}
|
|
4035
4106
|
class MotionStage {
|
|
4036
4107
|
constructor(config, script, input, bus) {
|
|
@@ -4059,8 +4130,12 @@ class MotionStage {
|
|
|
4059
4130
|
this._introPlayed = false;
|
|
4060
4131
|
const introLines = this.script.stage2Intro;
|
|
4061
4132
|
for (let i = 0; i < introLines.length; i++) {
|
|
4062
|
-
|
|
4063
|
-
|
|
4133
|
+
if (i === introLines.length - 1) {
|
|
4134
|
+
await this._showAndConfirm(introLines[i]);
|
|
4135
|
+
} else {
|
|
4136
|
+
this.bus.emit("narrative:show", introLines[i]);
|
|
4137
|
+
await this._wait(5e3);
|
|
4138
|
+
}
|
|
4064
4139
|
}
|
|
4065
4140
|
this.bus.emit("narrative:clear");
|
|
4066
4141
|
await this._wait(1e3);
|
|
@@ -4115,7 +4190,7 @@ class MotionStage {
|
|
|
4115
4190
|
// ─── Internal ──────────────────────────────────────────────────────────
|
|
4116
4191
|
_handleFade() {
|
|
4117
4192
|
const now = Date.now();
|
|
4118
|
-
if (now - this._lastFadeNarrativeTime >
|
|
4193
|
+
if (now - this._lastFadeNarrativeTime > 6e4) {
|
|
4119
4194
|
this._lastFadeNarrativeTime = now;
|
|
4120
4195
|
const reactions = this.script.stage2Reactions;
|
|
4121
4196
|
const line = reactions[this._narrativeIndex % reactions.length];
|
|
@@ -4126,6 +4201,16 @@ class MotionStage {
|
|
|
4126
4201
|
_wait(ms) {
|
|
4127
4202
|
return new Promise((r) => setTimeout(r, ms));
|
|
4128
4203
|
}
|
|
4204
|
+
_showAndConfirm(text) {
|
|
4205
|
+
this.bus.emit("narrative:showConfirm", text);
|
|
4206
|
+
return new Promise((resolve) => {
|
|
4207
|
+
const handler = () => {
|
|
4208
|
+
this.bus.off("narrative:confirmed", handler);
|
|
4209
|
+
resolve();
|
|
4210
|
+
};
|
|
4211
|
+
this.bus.on("narrative:confirmed", handler);
|
|
4212
|
+
});
|
|
4213
|
+
}
|
|
4129
4214
|
}
|
|
4130
4215
|
class RhythmStage {
|
|
4131
4216
|
constructor(config, script, input, bus) {
|
|
@@ -4158,8 +4243,12 @@ class RhythmStage {
|
|
|
4158
4243
|
this._introPlayed = false;
|
|
4159
4244
|
const introLines = this.script.stage3Intro;
|
|
4160
4245
|
for (let i = 0; i < introLines.length; i++) {
|
|
4161
|
-
|
|
4162
|
-
|
|
4246
|
+
if (i === introLines.length - 1) {
|
|
4247
|
+
await this._showAndConfirm(introLines[i]);
|
|
4248
|
+
} else {
|
|
4249
|
+
this.bus.emit("narrative:show", introLines[i]);
|
|
4250
|
+
await this._wait(5e3);
|
|
4251
|
+
}
|
|
4163
4252
|
}
|
|
4164
4253
|
this.bus.emit("narrative:clear");
|
|
4165
4254
|
await this._wait(1e3);
|
|
@@ -4219,7 +4308,7 @@ class RhythmStage {
|
|
|
4219
4308
|
}
|
|
4220
4309
|
_showReaction() {
|
|
4221
4310
|
const now = Date.now();
|
|
4222
|
-
if (now - this._lastNarrativeTime >
|
|
4311
|
+
if (now - this._lastNarrativeTime > 6e4) {
|
|
4223
4312
|
this._lastNarrativeTime = now;
|
|
4224
4313
|
const reactions = this.script.stage3Reactions;
|
|
4225
4314
|
const line = reactions[this._narrativeIndex % reactions.length];
|
|
@@ -4230,6 +4319,16 @@ class RhythmStage {
|
|
|
4230
4319
|
_wait(ms) {
|
|
4231
4320
|
return new Promise((r) => setTimeout(r, ms));
|
|
4232
4321
|
}
|
|
4322
|
+
_showAndConfirm(text) {
|
|
4323
|
+
this.bus.emit("narrative:showConfirm", text);
|
|
4324
|
+
return new Promise((resolve) => {
|
|
4325
|
+
const handler = () => {
|
|
4326
|
+
this.bus.off("narrative:confirmed", handler);
|
|
4327
|
+
resolve();
|
|
4328
|
+
};
|
|
4329
|
+
this.bus.on("narrative:confirmed", handler);
|
|
4330
|
+
});
|
|
4331
|
+
}
|
|
4233
4332
|
}
|
|
4234
4333
|
class PageReactor {
|
|
4235
4334
|
constructor() {
|
|
@@ -4467,6 +4566,11 @@ class GameController {
|
|
|
4467
4566
|
var _a3;
|
|
4468
4567
|
return (_a3 = this.narrative) == null ? void 0 : _a3.showLine(text);
|
|
4469
4568
|
});
|
|
4569
|
+
this.bus.on("narrative:showConfirm", async (text) => {
|
|
4570
|
+
var _a3;
|
|
4571
|
+
await ((_a3 = this.narrative) == null ? void 0 : _a3.showLineWithConfirm(text));
|
|
4572
|
+
this.bus.emit("narrative:confirmed");
|
|
4573
|
+
});
|
|
4470
4574
|
this.bus.on("narrative:clear", () => {
|
|
4471
4575
|
var _a3;
|
|
4472
4576
|
return (_a3 = this.narrative) == null ? void 0 : _a3.clear();
|
|
@@ -4683,7 +4787,7 @@ class GameController {
|
|
|
4683
4787
|
this.hiddenEntry = null;
|
|
4684
4788
|
this._startAnticipationTremor();
|
|
4685
4789
|
(_b2 = this.shrine) == null ? void 0 : _b2.show();
|
|
4686
|
-
await ((_c = this.narrative) == null ? void 0 : _c.showSequence(this.script.entryConfirmation,
|
|
4790
|
+
await ((_c = this.narrative) == null ? void 0 : _c.showSequence(this.script.entryConfirmation, 4200));
|
|
4687
4791
|
(_d = this.narrative) == null ? void 0 : _d.clear();
|
|
4688
4792
|
this._stopAnticipationTremor();
|
|
4689
4793
|
await this._wait(800);
|
|
@@ -4799,7 +4903,7 @@ class GameController {
|
|
|
4799
4903
|
(_b2 = (_a2 = this.config.callbacks).onStageComplete) == null ? void 0 : _b2.call(_a2, this.fsm.state, result);
|
|
4800
4904
|
}
|
|
4801
4905
|
const successLines = eggIndex === 0 ? this.script.stage1Success : eggIndex === 1 ? this.script.stage2Success : this.script.stage3Success;
|
|
4802
|
-
await ((_c = this.narrative) == null ? void 0 : _c.showSequence(successLines,
|
|
4906
|
+
await ((_c = this.narrative) == null ? void 0 : _c.showSequence(successLines, 4500));
|
|
4803
4907
|
(_d = this.narrative) == null ? void 0 : _d.clear();
|
|
4804
4908
|
await this._wait(800);
|
|
4805
4909
|
if (this.threeRenderer) {
|
|
@@ -4880,7 +4984,7 @@ class GameController {
|
|
|
4880
4984
|
(_c = this.shrine) == null ? void 0 : _c.hideAll();
|
|
4881
4985
|
await this._wait(1e3);
|
|
4882
4986
|
(_d = this.eggRenderer) == null ? void 0 : _d.startFinale();
|
|
4883
|
-
await ((_e = this.narrative) == null ? void 0 : _e.showSequence(this.script.finale,
|
|
4987
|
+
await ((_e = this.narrative) == null ? void 0 : _e.showSequence(this.script.finale, 5e3));
|
|
4884
4988
|
(_f = this.narrative) == null ? void 0 : _f.clear();
|
|
4885
4989
|
await this._wait(4e3);
|
|
4886
4990
|
this.fsm.transitionTo("results");
|