easter-egg-quest 1.0.3 → 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.
@@ -952,6 +952,42 @@ class NarrativeRenderer {
952
952
  this.clear();
953
953
  }, 12e3);
954
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
+ });
990
+ }
955
991
  /** Show a sequence of lines with pauses. */
956
992
  async showSequence(lines, pauseMs = 4500) {
957
993
  for (const line of lines) {
@@ -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
- this.bus.emit("narrative:show", introLines[i]);
3983
- await this._wait(4500);
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);
@@ -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
- this.bus.emit("narrative:show", introLines[i]);
4063
- await this._wait(4500);
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);
@@ -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
- this.bus.emit("narrative:show", introLines[i]);
4162
- await this._wait(4500);
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);
@@ -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();