@pretty-chitty/core 2.3.1 → 2.3.5

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.
Files changed (44) hide show
  1. package/dist/components/FullScreenGalleryDisplay.d.ts.map +1 -1
  2. package/dist/components/FullScreenGalleryDisplay.js +1 -1
  3. package/dist/components/FullScreenGalleryDisplay.js.map +1 -1
  4. package/dist/components/Gallery/GalleryViewer.d.ts +6 -1
  5. package/dist/components/Gallery/GalleryViewer.d.ts.map +1 -1
  6. package/dist/components/Gallery/GalleryViewer.js +69 -14
  7. package/dist/components/Gallery/GalleryViewer.js.map +1 -1
  8. package/dist/game/Chit.d.ts.map +1 -1
  9. package/dist/game/Chit.js +12 -2
  10. package/dist/game/Chit.js.map +1 -1
  11. package/dist/game/OrderedOutlet.d.ts +1 -1
  12. package/dist/game/OrderedOutlet.d.ts.map +1 -1
  13. package/dist/game/OrderedOutlet.js +3 -1
  14. package/dist/game/OrderedOutlet.js.map +1 -1
  15. package/dist/game/Turn.d.ts +11 -0
  16. package/dist/game/Turn.d.ts.map +1 -1
  17. package/dist/game/Turn.js +13 -2
  18. package/dist/game/Turn.js.map +1 -1
  19. package/dist/game/tutorial/TutorialController.js +2 -2
  20. package/dist/game/tutorial/TutorialController.js.map +1 -1
  21. package/dist/game/tutorial/allowed.js +32 -8
  22. package/dist/game/tutorial/allowed.js.map +1 -1
  23. package/dist/game/tutorial/defineTutorial.d.ts +11 -0
  24. package/dist/game/tutorial/defineTutorial.d.ts.map +1 -1
  25. package/dist/game/tutorial/defineTutorial.js.map +1 -1
  26. package/dist/utilities/CanvasStack/CanvasStack.d.ts +12 -0
  27. package/dist/utilities/CanvasStack/CanvasStack.d.ts.map +1 -1
  28. package/dist/utilities/CanvasStack/CanvasStack.js +87 -0
  29. package/dist/utilities/CanvasStack/CanvasStack.js.map +1 -1
  30. package/package.json +1 -1
  31. package/src/library/components/FullScreenGalleryDisplay.tsx +1 -0
  32. package/src/library/components/Gallery/GalleryViewer.tsx +73 -13
  33. package/src/library/game/Chit.test.ts +50 -0
  34. package/src/library/game/Chit.ts +13 -3
  35. package/src/library/game/OrderedOutlet.test.ts +28 -0
  36. package/src/library/game/OrderedOutlet.ts +3 -1
  37. package/src/library/game/Turn.ts +14 -2
  38. package/src/library/game/serialize.test.ts +39 -0
  39. package/src/library/game/tutorial/TUTORIAL_GUIDE.md +6 -0
  40. package/src/library/game/tutorial/TutorialController.ts +2 -2
  41. package/src/library/game/tutorial/allowed.test.ts +67 -0
  42. package/src/library/game/tutorial/allowed.ts +34 -8
  43. package/src/library/game/tutorial/defineTutorial.ts +11 -0
  44. package/src/library/utilities/CanvasStack/CanvasStack.ts +85 -0
@@ -32,6 +32,18 @@ export declare class CanvasStack implements IUpdatingCanvas {
32
32
  dispose(): void;
33
33
  constructor(width: number, height: number, operation: CanvasOperation, _mipLevelsOverride?: number | undefined);
34
34
  get mipMaps(): number;
35
+ private _fontsUsed;
36
+ private _unloadedFonts;
37
+ private static _fontLoads;
38
+ private static _pendingFontRedraws;
39
+ private static _fontRedrawScheduled;
40
+ private _trackFonts;
41
+ private _noteUnloadedFonts;
42
+ /** A font this stack drew with before it loaded has loaded since: its pixels are stale. */
43
+ private _fontsArrived;
44
+ private static whenFontLoads;
45
+ private static redrawPendingFonts;
46
+ private _redrawForFonts;
35
47
  private static _pendingMips;
36
48
  private static _mipTimer;
37
49
  private static _firstPendingAt;
@@ -1 +1 @@
1
- {"version":3,"file":"CanvasStack.d.ts","sourceRoot":"","sources":["../../../src/library/utilities/CanvasStack/CanvasStack.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,OAAO,EAMP,QAAQ,EAER,cAAc,EACf,MAAM,OAAO,CAAC;AACf,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAErD,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAGjD,MAAM,MAAM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AAS,CAA4C;IACpE,OAAO,CAAC,MAAM,CAAC,eAAe,CAAK;IACnC,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,YAAY,CAAQ;IAC5C,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,eAAe,CAAQ;IAC/C,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,mBAAmB,CAAK;IAEhD,OAAO,CAAC,MAAM,CAAC,YAAY;IAY3B,OAAO,CAAC,MAAM,CAAC,gBAAgB,CAQ7B;IAEF,OAAO,CAAC,UAAU;IAYlB,uHAAuH;IACvH,OAAO,CAAC,aAAa;IAYrB,OAAO,CAAC,gBAAgB;IAoBxB,OAAO,CAAC,kBAAkB;IAwB1B,OAAO,CAAC,MAAM,CAAC,WAAW,CAA+B;IACzD,OAAO,CAAC,MAAM,CAAC,kBAAkB,CAAS;IAE1C;;;;;OAKG;IACH,OAAO,CAAC,MAAM,CAAC,gCAAgC;IAc/C,IAAI,OAAO;;MAEV;IAED,OAAO,CAAC,SAAS,CAAuB;IACxC,IAAI,QAAQ,IAAI,QAAQ,CAQvB;IAED,IAAI,OAAO,IAAI,OAAO,CA2BrB;IAED,OAAc,QAAQ,6BAqBnB;IAEH,uGAAuG;WACzF,iBAAiB,CAAC,OAAO,EAAE,OAAO;IAIhD,OAAc,gBAAgB,0BAE3B;IAEH,OAAc,WAAW,wEAEtB;CACJ"}
@@ -40,10 +40,12 @@ export class CanvasStack {
40
40
  return;
41
41
  }
42
42
  this._outlets = {};
43
+ this._fontsUsed.clear();
43
44
  this.context.clearRect(0, 0, this.width, this.height);
44
45
  this.operation.render(this.context, { x: 0, y: 0, w: this.width, h: this.height }, this.loadUrl.bind(this), (id, coords) => {
45
46
  this._outlets[id] = coords;
46
47
  });
48
+ this._noteUnloadedFonts();
47
49
  this._renderMipCanvases();
48
50
  this.cbs.forEach((cb) => cb());
49
51
  }
@@ -79,6 +81,13 @@ export class CanvasStack {
79
81
  this._mipCanvases = [];
80
82
  this._mipContexts = [];
81
83
  this.createdAt = Date.now();
84
+ // Webfonts load lazily, so a face drawn before its font arrives is rasterised in the fallback font, and nothing
85
+ // redrew it. Its custom mips, built a second or more later, came out in the real font, and trilinear filtering
86
+ // blended the two layouts into doubled, ghosted text. So each stack records the fonts it measured or drew with;
87
+ // any not loaded yet get loaded, and when one arrives every stack that used it redraws (base and custom mips) and
88
+ // re-uploads its texture, a few per frame.
89
+ this._fontsUsed = new Set();
90
+ this._unloadedFonts = new Set();
82
91
  this._material = undefined;
83
92
  this.canvas = document.createElement("canvas");
84
93
  this.canvas.width = width;
@@ -88,6 +97,7 @@ export class CanvasStack {
88
97
  throw "Invalid Context";
89
98
  }
90
99
  this.context = context;
100
+ this._trackFonts(context);
91
101
  CanvasStack._liveStacks.add(this);
92
102
  CanvasStack.ensureContextRestoreSubscription();
93
103
  this.render();
@@ -99,6 +109,58 @@ export class CanvasStack {
99
109
  return this._mipLevelsOverride;
100
110
  return this.operation.benefitsFromMipMap() ? 2 : 0;
101
111
  }
112
+ _trackFonts(ctx) {
113
+ for (const name of ["fillText", "strokeText", "measureText"]) {
114
+ const original = ctx[name];
115
+ ctx[name] = (...args) => {
116
+ this._fontsUsed.add(ctx.font);
117
+ return original.apply(ctx, args);
118
+ };
119
+ }
120
+ }
121
+ _noteUnloadedFonts() {
122
+ this._unloadedFonts.clear();
123
+ const fonts = typeof document !== "undefined" ? document.fonts : undefined;
124
+ if (!fonts)
125
+ return;
126
+ for (const font of this._fontsUsed) {
127
+ if (fonts.check(font))
128
+ continue;
129
+ this._unloadedFonts.add(font);
130
+ CanvasStack.whenFontLoads(font);
131
+ }
132
+ }
133
+ /** A font this stack drew with before it loaded has loaded since: its pixels are stale. */
134
+ _fontsArrived() {
135
+ for (const font of this._unloadedFonts)
136
+ if (document.fonts.check(font))
137
+ return true;
138
+ return false;
139
+ }
140
+ static whenFontLoads(font) {
141
+ if (CanvasStack._fontLoads.has(font))
142
+ return; // once per font: a font that never loads doesn't loop
143
+ CanvasStack._fontLoads.add(font);
144
+ document.fonts.load(font).then(() => {
145
+ for (const stack of CanvasStack._liveStacks) {
146
+ if (stack._unloadedFonts.has(font))
147
+ CanvasStack._pendingFontRedraws.add(stack);
148
+ }
149
+ if (CanvasStack._pendingFontRedraws.size > 0 && !CanvasStack._fontRedrawScheduled) {
150
+ CanvasStack._fontRedrawScheduled = true;
151
+ requestAnimationFrame(CanvasStack.redrawPendingFonts);
152
+ }
153
+ }, () => { });
154
+ }
155
+ _redrawForFonts() {
156
+ if (!this.context)
157
+ return;
158
+ this.render(); // redraws the custom mips too, when they're built
159
+ if (this._texture) {
160
+ this._texture.needsUpdate = true;
161
+ CanvasStack.disposer.notifyChange(this._texture.uuid);
162
+ }
163
+ }
102
164
  static scheduleMips(stack) {
103
165
  if (CanvasStack._pendingMips.size === 0)
104
166
  CanvasStack._firstPendingAt = Date.now();
@@ -114,6 +176,10 @@ export class CanvasStack {
114
176
  }
115
177
  _buildMips() {
116
178
  this._initMipCanvases();
179
+ // the base was drawn in a fallback font that has loaded since: redraw it (and these mips) in the real one,
180
+ // or the chain would hold two different layouts
181
+ if (this._fontsArrived())
182
+ this.render();
117
183
  if (this._texture) {
118
184
  this._applyMipmaps(this._texture);
119
185
  this._texture.needsUpdate = true;
@@ -214,6 +280,11 @@ export class CanvasStack {
214
280
  throw new Error("CanvasStack has been disposed");
215
281
  }
216
282
  if (!this._texture) {
283
+ // Rebuilt after the disposer reclaimed it: the disposer also dropped the stack from the live set, so a font
284
+ // that arrived meanwhile never redrew it. Redraw now, and rejoin the live set for later fonts and context loss.
285
+ if (this._fontsArrived())
286
+ this.render();
287
+ CanvasStack._liveStacks.add(this);
217
288
  const wrapper = getWebGlRendererInstance();
218
289
  this._texture = new Texture(this.canvas, UVMapping, ClampToEdgeWrapping, ClampToEdgeWrapping, LinearFilter, LinearMipmapLinearFilter);
219
290
  this._applyMipmaps(this._texture);
@@ -230,6 +301,22 @@ export class CanvasStack {
230
301
  }
231
302
  }
232
303
  CanvasStack.imageCache = new ImageCache(50); // 50? Is that good? No idea.
304
+ CanvasStack._fontLoads = new Set();
305
+ CanvasStack._pendingFontRedraws = new Set();
306
+ CanvasStack._fontRedrawScheduled = false;
307
+ CanvasStack.redrawPendingFonts = () => {
308
+ const start = performance.now();
309
+ for (const stack of CanvasStack._pendingFontRedraws) {
310
+ CanvasStack._pendingFontRedraws.delete(stack);
311
+ stack._redrawForFonts();
312
+ if (performance.now() - start > CanvasStack.MIP_FRAME_BUDGET_MS)
313
+ break;
314
+ }
315
+ if (CanvasStack._pendingFontRedraws.size > 0)
316
+ requestAnimationFrame(CanvasStack.redrawPendingFonts);
317
+ else
318
+ CanvasStack._fontRedrawScheduled = false;
319
+ };
233
320
  // Faces with text get hand-drawn mip levels: text rasterised at the small size is sharper than GPU box-filtering.
234
321
  // Building that chain (a canvas per level, down to 1×1) for every face while the table loads is what stalled
235
322
  // phones — Safari queues 2D drawing in its GPU process and the first texture upload waits for all of it (8 s on an
@@ -1 +1 @@
1
- {"version":3,"file":"CanvasStack.js","sourceRoot":"","sources":["../../../src/library/utilities/CanvasStack/CanvasStack.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,OAAO,EACP,SAAS,EACT,mBAAmB,EACnB,YAAY,EACZ,wBAAwB,EACxB,iBAAiB,EAEjB,cAAc,GAEf,MAAM,OAAO,CAAC;AAGf,OAAO,EAAe,UAAU,EAAE,MAAM,cAAc,CAAC;AACvD,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,EAAE,wBAAwB,EAAE,MAAM,8BAA8B,CAAC;AAcxE,IAAI,eAA8C,CAAC;AACnD,MAAM,OAAO,WAAW;IAgBtB,IAAW,eAAe;QACxB,OAAO,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC;IACzB,CAAC;IAED,QAAQ,CAAC,EAAc;QACrB,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;QAClB,OAAO,GAAG,EAAE;YACV,IAAI,CAAC,GA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"description": "A TypeScript framework for building high-quality async or realtime 3D strategy board games",
6
6
  "author": "Pretty Chitty, LLC",
@@ -67,6 +67,7 @@ export function FullScreenGalleryDisplay() {
67
67
  <GalleryViewer
68
68
  kind="fullscreen"
69
69
  tutorialTarget="gallery:fullscreen"
70
+ dismissGestures
70
71
  onClose={() => {
71
72
  setSource(undefined);
72
73
  }}
@@ -42,6 +42,11 @@ export interface GalleryViewerProps {
42
42
  galleryItemHeight?: number;
43
43
  onClose?: () => void;
44
44
  onLongPress?: () => void;
45
+ /**
46
+ * Full-screen galleries: tapping near any edge of the gallery, or swiping down on an item (anywhere but summaries
47
+ * that scroll), calls `onClose`.
48
+ */
49
+ dismissGestures?: boolean;
45
50
  showSummary?: SummaryMode;
46
51
  zFactor?: number;
47
52
  /** Lets tutorials find and point at this gallery's items (see `galleryRegistry`) */
@@ -60,6 +65,25 @@ function itemShows(item: GalleryItem, chit: Chit) {
60
65
  return shown instanceof Chit && shown !== chit && shown.functionallyIdentical(chit);
61
66
  }
62
67
 
68
+ /** Full-screen galleries: how far (px) a swipe down must travel to dismiss, or how fast (px/ms) a shorter flick must be */
69
+ const DISMISS_DISTANCE = 120;
70
+ const DISMISS_FLING_MIN_DISTANCE = 30;
71
+ const DISMISS_FLING_VELOCITY = 0.4;
72
+
73
+ /** Whether a tap at (x, y) is within the edge band of a w×h gallery (tapping there dismisses a full-screen one) */
74
+ function nearEdge(x: number, y: number, w: number, h: number) {
75
+ const band = Math.max(32, Math.min(w, h) * 0.06);
76
+ return x < band || y < band || x > w - band || y > h - band;
77
+ }
78
+
79
+ /** Puts the canvas back after a dismissing swipe, sliding back when `animate` */
80
+ function resetDismissOffset(el: HTMLElement | null, animate: boolean) {
81
+ if (!el) return;
82
+ el.style.transition = animate ? "transform 150ms ease-out, opacity 150ms ease-out" : "none";
83
+ el.style.transform = "";
84
+ el.style.opacity = "";
85
+ }
86
+
63
87
  export function GalleryViewer({
64
88
  items,
65
89
  paused = false,
@@ -68,6 +92,7 @@ export function GalleryViewer({
68
92
  angle = DEFAULT_ANGLE,
69
93
  onClose,
70
94
  onLongPress,
95
+ dismissGestures = false,
71
96
  itemSpacing = DEFAULT_ITEM_SPACING,
72
97
  tweenDuration = DEFAULT_TWEEN_DURATION,
73
98
  w = 0,
@@ -147,6 +172,8 @@ export function GalleryViewer({
147
172
 
148
173
  useEffect(() => {
149
174
  galleryController.setItems(items);
175
+ // a gallery opened again (or reused) starts where it belongs, not where a dismissing swipe left it
176
+ if (items.length > 0) resetDismissOffset(refContainer.current, false);
150
177
  // eslint-disable-next-line react-hooks/exhaustive-deps
151
178
  }, [galleryController, items.map((i) => i.id).join("--")]);
152
179
 
@@ -208,16 +235,18 @@ export function GalleryViewer({
208
235
 
209
236
  hammer.on("singletap", (ev) => {
210
237
  const pos = fixPosition(ev);
211
- // TODO: fix this
212
- if (galleryController.isAnimating()) {
238
+ if (dismissGestures && nearEdge(pos.x, pos.y, el.clientWidth, el.clientHeight)) {
239
+ onClose?.();
240
+ return;
241
+ }
242
+ const tappedItem = galleryController.getItemAtPosition(pos.x, pos.y);
243
+ if (galleryController.isAnimating() && tappedItem) {
244
+ // a tap on a moving item stops the scroll rather than picking whatever happened to be under the finger
213
245
  galleryController.pan(0, true);
214
- } else {
215
- const tappedItem = galleryController.getItemAtPosition(pos.x, pos.y);
216
- if (tappedItem?.onClick) {
217
- tappedItem.onClick();
218
- } else if (!tappedItem && onClose) {
219
- onClose();
220
- }
246
+ } else if (tappedItem?.onClick) {
247
+ tappedItem.onClick();
248
+ } else if (!tappedItem && onClose) {
249
+ onClose();
221
250
  }
222
251
  });
223
252
 
@@ -231,7 +260,7 @@ export function GalleryViewer({
231
260
  // an item with a live DragPick drags it out onto the board; anything else scrolls the strip.
232
261
  // A scroll that leaves the strip through its top edge turns into a drag of the item it started
233
262
  // on, so a long diagonal pull toward the board still lands the piece.
234
- let mode: "undecided" | "scroll" | "drag" | "summaries" = "undecided";
263
+ let mode: "undecided" | "scroll" | "drag" | "summaries" | "dismiss" = "undecided";
235
264
  let lastY: number | undefined = undefined;
236
265
  let summaryX = 0;
237
266
  let drag: ExternalDrag | undefined;
@@ -254,7 +283,17 @@ export function GalleryViewer({
254
283
  startItem = dragsOut ? galleryController.getItemAtPosition(ev.center.x - ev.deltaX - rect.left, ev.center.y - ev.deltaY - rect.top) : null;
255
284
  const upward = -ev.deltaY > Math.abs(ev.deltaX) * 0.58;
256
285
  const vertical = Math.abs(ev.deltaY) > Math.abs(ev.deltaX);
257
- mode = upward && beginDragOut(ev) ? "drag" : !dragsOut && vertical && galleryController.canScrollSummaries() ? "summaries" : "scroll";
286
+ const startY = ev.center.y - ev.deltaY - rect.top;
287
+ const summariesScroll = galleryController.canScrollSummaries();
288
+ const onScrollingSummary = summariesScroll && startY > galleryController.summariesTop();
289
+ mode =
290
+ upward && beginDragOut(ev)
291
+ ? "drag"
292
+ : dismissGestures && vertical && ev.deltaY > 0 && !onScrollingSummary
293
+ ? "dismiss"
294
+ : !dragsOut && vertical && summariesScroll
295
+ ? "summaries"
296
+ : "scroll";
258
297
  // a summary drag scrolls the one it started on
259
298
  summaryX = ev.center.x - ev.deltaX - rect.left;
260
299
  } else if (mode === "scroll" && dragsOut && ev.center.y < el.getBoundingClientRect().top && beginDragOut(ev)) {
@@ -271,6 +310,15 @@ export function GalleryViewer({
271
310
  ev.preventDefault();
272
311
  return;
273
312
  }
313
+ if (mode === "dismiss") {
314
+ // the gallery follows the finger down, fading as it goes
315
+ const dy = Math.max(0, ev.deltaY);
316
+ el.style.transition = "none";
317
+ el.style.transform = `translateY(${dy}px)`;
318
+ el.style.opacity = `${Math.max(0.3, 1 - dy / Math.max(1, el.clientHeight))}`;
319
+ ev.preventDefault();
320
+ return;
321
+ }
274
322
  if (mode === "summaries") {
275
323
  // the text follows the finger: dragging up reads further down
276
324
  if (lastY !== undefined) galleryController.scrollSummaries(lastY - ev.deltaY, summaryX);
@@ -294,13 +342,25 @@ export function GalleryViewer({
294
342
  });
295
343
 
296
344
  hammer.on("pancancel", () => {
345
+ if (mode === "dismiss") resetDismissOffset(el, true);
297
346
  drag?.cancel();
298
347
  drag = undefined;
299
348
  mode = "undecided";
300
349
  lastY = undefined;
301
350
  });
302
351
 
303
- hammer.on("panend", () => {
352
+ hammer.on("panend", (ev) => {
353
+ if (mode === "dismiss") {
354
+ mode = "undecided";
355
+ const far = ev.deltaY > Math.min(DISMISS_DISTANCE, el.clientHeight * 0.2);
356
+ const flung = ev.deltaY > DISMISS_FLING_MIN_DISTANCE && ev.velocityY > DISMISS_FLING_VELOCITY;
357
+ if ((far || flung) && onClose) {
358
+ onClose();
359
+ } else {
360
+ resetDismissOffset(el, true);
361
+ }
362
+ return;
363
+ }
304
364
  if (mode === "drag") {
305
365
  drag?.end();
306
366
  drag = undefined;
@@ -343,7 +403,7 @@ export function GalleryViewer({
343
403
  hammer.destroy();
344
404
  removeWheelListener(el, wheelListener);
345
405
  };
346
- }, [galleryController, onClose, onLongPress, kind, modalState]);
406
+ }, [galleryController, onClose, onLongPress, kind, modalState, dismissGestures]);
347
407
 
348
408
  if (!w || !h) {
349
409
  return null;
@@ -1,3 +1,5 @@
1
+ import v8 from "node:v8";
2
+ import vm from "node:vm";
1
3
  import { expect, test } from "vitest";
2
4
 
3
5
  import { ChildOutlet, NonEditable } from "../utilities/Annotations";
@@ -155,3 +157,51 @@ test("dirty tracking: array mutation via proxy marks dirty", () => {
155
157
  const serialized = c.serialize();
156
158
  expect(JSON.parse(serialized).items).toEqual([1, 2, 3, 4]);
157
159
  });
160
+
161
+ test("dirty tracking: an object two chits share marks the chit it was written through", () => {
162
+ const shared = { a: 1 };
163
+ class ChitWithShared extends Chit {
164
+ public data = shared;
165
+ }
166
+
167
+ const c1 = new ChitWithShared();
168
+ const c2 = new ChitWithShared();
169
+ c1.serialize();
170
+ c2.serialize();
171
+ expect(c1.data.a).toBe(1); // c1 wraps the shared object first
172
+
173
+ c2.data.a = 2;
174
+ expect(c2._dirty).toBe(true);
175
+ expect(c1._dirty).toBe(false);
176
+ });
177
+
178
+ test("dirty tracking: a chit that read long-lived data can still be collected", async () => {
179
+ // Game data in module scope lives as long as the bundle. Reading it through a chit must not tie
180
+ // the chit (and through its parents, a whole disposed match) to that data.
181
+ const gc = exposeGc();
182
+ const staticData = { nested: { value: 1 } };
183
+ class ChitWithStatic extends Chit {
184
+ public data = staticData;
185
+ }
186
+
187
+ let ref: WeakRef<Chit> | undefined;
188
+ (() => {
189
+ const c = new ChitWithStatic();
190
+ c.serialize();
191
+ expect(c.data.nested.value).toBe(1);
192
+ ref = new WeakRef(c);
193
+ })();
194
+
195
+ // WeakRef targets stay alive until the current job ends
196
+ for (let i = 0; i < 5; i++) {
197
+ await new Promise((resolve) => setTimeout(resolve, 10));
198
+ gc();
199
+ }
200
+ expect(ref?.deref()).toBeUndefined();
201
+ });
202
+
203
+ /** V8's gc(), without needing --expose-gc on the command line. */
204
+ function exposeGc(): () => void {
205
+ v8.setFlagsFromString("--expose-gc");
206
+ return vm.runInNewContext("gc") as () => void;
207
+ }
@@ -18,14 +18,24 @@ const EXTRA_SERIALIZATION_PROPS_ARRAY = ["id", "_parent", "_parentOutlet", "_par
18
18
  const EXTRA_SERIALIZATION_PROPS_SET = new Set(EXTRA_SERIALIZATION_PROPS_ARRAY);
19
19
  const DELETED_SERIALIZED = JSON.stringify({ ____deleted: true });
20
20
 
21
- const dirtyProxyCache = new WeakMap<object, object>();
21
+ // Per chit: value -> the proxy that marks that chit dirty. A proxy is bound to one chit, so the cache
22
+ // must be too. Keyed by value alone, an object several chits share (often static game data, which
23
+ // lives as long as the bundle) got the first chit's proxy for good: writes through it marked the
24
+ // wrong chit dirty, and the entry, whose key never dies, kept that chit and its whole match alive
25
+ // after the match was disposed. Keyed by chit, a chit's proxies go when the chit does.
26
+ const dirtyProxyCache = new WeakMap<Chit, WeakMap<object, object>>();
22
27
 
23
28
  function wrapWithDirtyProxy(value: any, chit: Chit): any {
24
29
  if (value === null || value === undefined) return value;
25
30
  if (typeof value !== "object") return value;
26
31
  if (value instanceof Chit || value instanceof OrderedOutlet) return value;
27
32
 
28
- const existing = dirtyProxyCache.get(value);
33
+ let chitProxies = dirtyProxyCache.get(chit);
34
+ if (!chitProxies) {
35
+ chitProxies = new WeakMap();
36
+ dirtyProxyCache.set(chit, chitProxies);
37
+ }
38
+ const existing = chitProxies.get(value);
29
39
  if (existing) return existing;
30
40
 
31
41
  const proxy = new Proxy(value, {
@@ -53,7 +63,7 @@ function wrapWithDirtyProxy(value: any, chit: Chit): any {
53
63
  },
54
64
  });
55
65
 
56
- dirtyProxyCache.set(value, proxy);
66
+ chitProxies.set(value, proxy);
57
67
  return proxy;
58
68
  }
59
69
 
@@ -0,0 +1,28 @@
1
+ import { expect, test } from "vitest";
2
+
3
+ import { Chit } from "./Chit";
4
+ import { OrderedOutlet } from "./OrderedOutlet";
5
+
6
+ class Item extends Chit {}
7
+ class Holder extends Chit {
8
+ items = new OrderedOutlet<Item>("items", this);
9
+ }
10
+
11
+ test("pop detaches the chit it returns", () => {
12
+ const h = new Holder();
13
+ const a = new Item();
14
+ const b = new Item();
15
+ h.items.add(a);
16
+ h.items.add(b);
17
+ expect(b.parent).toBe(h);
18
+
19
+ expect(h.items.pop()).toBe(b);
20
+ expect(h.items.length).toBe(1);
21
+ expect(b.parent).toBeUndefined();
22
+ expect(a.parent).toBe(h);
23
+ expect(a.parentOutletIndex).toBe(0);
24
+
25
+ expect(h.items.pop()).toBe(a);
26
+ expect(a.parent).toBeUndefined();
27
+ expect(h.items.pop()).toBeUndefined();
28
+ });
@@ -200,7 +200,9 @@ export class OrderedOutlet<C extends Chit> {
200
200
  }
201
201
 
202
202
  public pop() {
203
- const result = this.chits.pop();
203
+ // remove() takes it out of `chits` and clears its parent; popping first left remove() nothing to find, so the
204
+ // chit kept its parent and went on rendering there, out of the list
205
+ const result = this.chits[this.chits.length - 1];
204
206
  if (result) {
205
207
  this.remove(result);
206
208
  }
@@ -233,8 +233,20 @@ export class Turn<T, P extends PlayerChit, R extends RootChit<P>> {
233
233
  return p.id;
234
234
  });
235
235
 
236
- // now serialize all chits in their "locked" state. createTurn flushes the parent right before
237
- // building us, so a clean chit's state there is already current and interned.
236
+ this.captureLockedStates();
237
+ }
238
+
239
+ /**
240
+ * Serializes every locked chit in its "locked" state. createTurn flushes the parent right before
241
+ * building us, so a clean chit's state there is already current and interned.
242
+ *
243
+ * This must stay out of the constructor. A local captured by a callback there lives in the
244
+ * constructor's closure context, which every closure made in the constructor shares, including
245
+ * the `findChit` field. `findChit` outlives the turn's absorption, so the parent's full chit-state
246
+ * map (a fresh copy per absorbed sub-turn) would stay pinned by every finished turn: tens of MB
247
+ * in a long game, out of reach of releasePostAbsorptionRefs.
248
+ */
249
+ private captureLockedStates() {
238
250
  const parentStates = this.parent?.lastChitStates;
239
251
  Object.values(this.chitLookup).forEach((c) => {
240
252
  if (!c.id) {
@@ -1,3 +1,5 @@
1
+ import v8 from "node:v8";
2
+ import vm from "node:vm";
1
3
  import { describe, expect, test } from "vitest";
2
4
 
3
5
  import { Chit } from "./Chit";
@@ -100,6 +102,7 @@ type AnyTurn = {
100
102
  clockSteps: { turns?: AnyTurn[]; absorbed?: AnyTurn[] }[];
101
103
  _checkpoints: { nextIndex: number }[];
102
104
  lockedChitStates: Record<string, string>;
105
+ lastChitStates: Record<string, string>;
103
106
  absorbed: boolean;
104
107
  serialize: (playerId: string, clock: number) => { chits: Record<string, string> };
105
108
  chitsHistory: (playerId: string, ids: string[]) => unknown;
@@ -272,4 +275,40 @@ describe("Turn.serialize", () => {
272
275
  expect(finished.filter((t) => t._checkpoints.length > 0)).toEqual([]);
273
276
  expect(Object.keys(root.lockedChitStates).length).toBeGreaterThan(0);
274
277
  });
278
+
279
+ test("finished turns do not keep old chit-state maps alive", async () => {
280
+ // A turn absorbing a sub-turn replaces its lastChitStates with a fresh full copy, so a long game
281
+ // makes hundreds of them. Once replaced, nothing should hold one: in particular not a closure
282
+ // made in the Turn constructor (findChit), which every finished turn keeps for the whole game.
283
+ const gc = exposeGc();
284
+ const seen = new WeakSet<object>();
285
+ const maps: WeakRef<object>[] = [];
286
+ const root = await play((root) => {
287
+ for (const t of allTurns(root)) {
288
+ if (!seen.has(t.lastChitStates)) {
289
+ seen.add(t.lastChitStates);
290
+ maps.push(new WeakRef(t.lastChitStates));
291
+ }
292
+ }
293
+ });
294
+ expect(maps.length).toBeGreaterThan(10);
295
+
296
+ // WeakRef targets stay alive until the current job ends, and the finished match may still have
297
+ // a notify or two queued: let those run, then collect, a few times over
298
+ for (let i = 0; i < 5; i++) {
299
+ await new Promise((resolve) => setTimeout(resolve, 10));
300
+ gc();
301
+ }
302
+
303
+ // The root (and through it every finished turn) is still alive, as in a running match
304
+ const current = new Set<object>(allTurns(root).map((t) => t.lastChitStates));
305
+ const leaked = maps.map((r) => r.deref()).filter((m) => m !== undefined && !current.has(m));
306
+ expect(`${leaked.length} of ${maps.length} replaced maps still alive`).toBe(`0 of ${maps.length} replaced maps still alive`);
307
+ });
275
308
  });
309
+
310
+ /** V8's gc(), without needing --expose-gc on the command line. */
311
+ function exposeGc(): () => void {
312
+ v8.setFlagsFromString("--expose-gc");
313
+ return vm.runInNewContext("gc") as () => void;
314
+ }
@@ -157,6 +157,12 @@ Rules of thumb:
157
157
  - **Every "do it" step needs `allow`.** It is matched like a forced bot move: `key`, `chit`,
158
158
  `target`, `button`, or `"any"`; `allow: []` says the step waits for the bots, not the player. The
159
159
  dev panel flags a waiting step without one, and `runTutorial` warns and then gets stuck on it.
160
+ - **Test the chit played rather than finding it, when that's simpler.** `chit` and `target` are
161
+ selectors: they list every acceptable chit up front, and the move's id must be among them.
162
+ `chitIs` and `targetIs` instead get the chit the player actually played or dropped on:
163
+ `allow: { key: "place.drag", targetIs: (t: Square) => t.x === 12 && t.y === 0 }`. Prefer them
164
+ for "this spot" or "a red one": nothing has to be found in the tree first, and the client's copy
165
+ of a pooled list can be missing chits that are really there.
160
166
  - **Check state, not events.** `checks.state((root) => root.market.cards.length === 4)` passes
161
167
  whether the player confirmed just now or a second before the step started.
162
168
  `checks.logged(...)` only sees log lines written *during* the step.
@@ -599,7 +599,7 @@ export class TutorialController<P extends PlayerChit = PlayerChit, R extends Roo
599
599
  const step = this.step;
600
600
  if (!step || this.reviewing.value || this.status.value !== "waiting") return false;
601
601
  if (action.type === "undo") return false; // handled as Back before this is asked
602
- const move = shapeOfPromptAction(action);
602
+ const move = shapeOfPromptAction(action, (id) => this.view.find(id));
603
603
  if (!move) return false;
604
604
  return isAllowed(step.allow, move, this.view.root(), this.view.me());
605
605
  }
@@ -622,7 +622,7 @@ export class TutorialController<P extends PlayerChit = PlayerChit, R extends Roo
622
622
  if (action.type === "undo") return undefined;
623
623
  const ahead = this.aheadStep();
624
624
  if (ahead === undefined) return undefined;
625
- const move = shapeOfPromptAction(action);
625
+ const move = shapeOfPromptAction(action, (id) => this.view.find(id));
626
626
  if (!move) return undefined;
627
627
  return isAllowed(this.spec.steps[ahead].allow, move, this.view.root(), this.view.me()) ? ahead : undefined;
628
628
  }