@dasl/tile-loader 3.1.0 → 3.2.0

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 (87) hide show
  1. package/README.md +818 -34
  2. package/dist/at.d.ts +126 -12
  3. package/dist/at.d.ts.map +1 -1
  4. package/dist/at.js +574 -90
  5. package/dist/at.js.map +1 -1
  6. package/dist/car.d.ts +21 -2
  7. package/dist/car.d.ts.map +1 -1
  8. package/dist/car.js +78 -15
  9. package/dist/car.js.map +1 -1
  10. package/dist/content-scheme.d.ts +17 -3
  11. package/dist/content-scheme.d.ts.map +1 -1
  12. package/dist/content-scheme.js +32 -6
  13. package/dist/content-scheme.js.map +1 -1
  14. package/dist/guard.d.ts +242 -0
  15. package/dist/guard.d.ts.map +1 -0
  16. package/dist/guard.js +956 -0
  17. package/dist/guard.js.map +1 -0
  18. package/dist/index.d.ts +247 -13
  19. package/dist/index.d.ts.map +1 -1
  20. package/dist/index.js +746 -51
  21. package/dist/index.js.map +1 -1
  22. package/dist/lib/cid.d.ts +25 -0
  23. package/dist/lib/cid.d.ts.map +1 -0
  24. package/dist/lib/cid.js +65 -0
  25. package/dist/lib/cid.js.map +1 -0
  26. package/dist/lib/defaults.d.ts +8 -0
  27. package/dist/lib/defaults.d.ts.map +1 -0
  28. package/dist/lib/defaults.js +14 -0
  29. package/dist/lib/defaults.js.map +1 -0
  30. package/dist/lib/destinations.d.ts +25 -0
  31. package/dist/lib/destinations.d.ts.map +1 -0
  32. package/dist/lib/destinations.js +94 -0
  33. package/dist/lib/destinations.js.map +1 -0
  34. package/dist/lib/drisl.d.ts +10 -0
  35. package/dist/lib/drisl.d.ts.map +1 -0
  36. package/dist/lib/drisl.js +169 -0
  37. package/dist/lib/drisl.js.map +1 -0
  38. package/dist/lib/errors.d.ts +80 -0
  39. package/dist/lib/errors.d.ts.map +1 -0
  40. package/dist/lib/errors.js +44 -0
  41. package/dist/lib/errors.js.map +1 -0
  42. package/dist/lib/fetching.d.ts +24 -0
  43. package/dist/lib/fetching.d.ts.map +1 -0
  44. package/dist/lib/fetching.js +135 -0
  45. package/dist/lib/fetching.js.map +1 -0
  46. package/dist/lib/limits.d.ts +34 -0
  47. package/dist/lib/limits.d.ts.map +1 -0
  48. package/dist/lib/limits.js +33 -0
  49. package/dist/lib/limits.js.map +1 -0
  50. package/dist/lib/pointer.d.ts +83 -0
  51. package/dist/lib/pointer.d.ts.map +1 -0
  52. package/dist/lib/pointer.js +244 -0
  53. package/dist/lib/pointer.js.map +1 -0
  54. package/dist/link.d.ts +110 -13
  55. package/dist/link.d.ts.map +1 -1
  56. package/dist/link.js +336 -43
  57. package/dist/link.js.map +1 -1
  58. package/dist/memory.d.ts +1 -0
  59. package/dist/memory.d.ts.map +1 -1
  60. package/dist/memory.js +5 -0
  61. package/dist/memory.js.map +1 -1
  62. package/dist/mount.d.ts +54 -0
  63. package/dist/mount.d.ts.map +1 -0
  64. package/dist/mount.js +286 -0
  65. package/dist/mount.js.map +1 -0
  66. package/dist/size.d.ts +43 -2
  67. package/dist/size.d.ts.map +1 -1
  68. package/dist/size.js +296 -15
  69. package/dist/size.js.map +1 -1
  70. package/package.json +13 -3
  71. package/src/at.ts +582 -84
  72. package/src/car.ts +75 -16
  73. package/src/content-scheme.ts +38 -7
  74. package/src/guard.ts +1013 -0
  75. package/src/index.ts +837 -52
  76. package/src/lib/cid.ts +65 -0
  77. package/src/lib/defaults.ts +12 -0
  78. package/src/lib/destinations.ts +79 -0
  79. package/src/lib/drisl.ts +160 -0
  80. package/src/lib/errors.ts +111 -0
  81. package/src/lib/fetching.ts +138 -0
  82. package/src/lib/limits.ts +61 -0
  83. package/src/lib/pointer.ts +290 -0
  84. package/src/link.ts +365 -48
  85. package/src/memory.ts +5 -0
  86. package/src/mount.ts +356 -0
  87. package/src/size.ts +304 -16
package/src/size.ts CHANGED
@@ -12,14 +12,26 @@
12
12
  // rules are `resolveSize` in @dasl/tile-lexicon, the same for every context,
13
13
  // with the floor no tile goes under.
14
14
  //
15
- // A host that lays the frame out itself passes `apply: false` and resizes its
16
- // own box in `onRequest`; the tile is still told its real size whenever the
17
- // frame's box changes. The width is the context's by default (the frame
18
- // keeps the width its layout gives it): `width: 'tile'` hands that over too.
15
+ // How big is the context's to decide, and so is when. A frame that changes
16
+ // size moves the page around it: what was under the user's pointer is
17
+ // somewhere else, and something else is there. A tile chooses the moment it
18
+ // asks, so a size is only applied where it moves nothing under the pointer,
19
+ // and waits until it can be (see "The gate" below).
20
+ //
21
+ // A host that lays the frame out itself passes a function as `apply`, and
22
+ // sizes its own box with what that is called with; the tile is still told
23
+ // its real size whenever the frame's box changes. (`apply: false` leaves the
24
+ // box, and the moment, to the host altogether: it has every request in
25
+ // `onRequest`, and nothing is held for it.) The width is the context's by
26
+ // default (the frame keeps the width its layout gives it): `width: 'tile'`
27
+ // hands that over too.
19
28
 
20
29
  import { effectiveLimits, resolveSize } from '@dasl/tile-lexicon';
21
30
  import type { SizeLimits, TileSize } from '@dasl/tile-lexicon';
22
31
  import type { ProtocolEvent, Tile } from './index.js';
32
+ import { withDefaults } from './lib/defaults.js';
33
+ import { shield, watchPointer } from './lib/pointer.js';
34
+ import type { Box, Shield } from './lib/pointer.js';
23
35
 
24
36
  export type { SizeLimits, TileSize } from '@dasl/tile-lexicon';
25
37
 
@@ -35,13 +47,66 @@ const SETTLE_MS = 100;
35
47
  // answered with what there is.
36
48
  const HOST_APPLIES_MS = 250;
37
49
 
50
+ /**
51
+ * The numbers the gate goes by. All of them are first guesses: each trades a
52
+ * tile that follows its content promptly against a page that holds still
53
+ * under its user.
54
+ */
55
+ export interface SizeGateOptions {
56
+ /** How far above the edge that moves a pointer still counts as on what moves, in pixels. */
57
+ margin?: number;
58
+ /** The least time between two changes of size, in milliseconds. */
59
+ intervalMs?: number;
60
+ /** How many changes in a row a tile gets. */
61
+ burst?: number;
62
+ /** How long until a tile that has used its changes up gets one back, in milliseconds. */
63
+ refillMs?: number;
64
+ /** How long what a change put where a press may be coming takes no press, in milliseconds. */
65
+ shieldMs?: number;
66
+ /** The same while a mouse rests on it without pressing, in milliseconds. */
67
+ dwellMs?: number;
68
+ /** How long the strip a tile gave up under a finger waits for the tap it is there to take, in milliseconds. */
69
+ stickyMs?: number;
70
+ /** How long until a change that is held is looked at again, should the pointer not say sooner, in milliseconds. */
71
+ retryMs?: number;
72
+ /** How long a page that is not drawing takes to decide, in milliseconds. One that draws decides two frames on. */
73
+ decideMs?: number;
74
+ }
75
+
76
+ /** The gate's numbers where a host gives none. */
77
+ export const SIZE_GATE: Readonly<Required<SizeGateOptions>> = Object.freeze({
78
+ margin: 24,
79
+ intervalMs: 250,
80
+ burst: 8,
81
+ refillMs: 3000,
82
+ shieldMs: 700,
83
+ dwellMs: 900,
84
+ stickyMs: 4000,
85
+ retryMs: 1000,
86
+ decideMs: 150,
87
+ });
88
+
38
89
  export interface TileSizeOptions {
39
90
  /** The context's limits; the floor (SIZE_FLOOR) is under them regardless. */
40
91
  limits?: SizeLimits;
41
- /** Size the frame here (the default), or leave its box to the host (`false`). */
42
- apply?: boolean;
92
+ /**
93
+ * Size the frame here (the default); or hand each size to the host, to put
94
+ * on a box of its own, when it may be applied (a function: it is called
95
+ * with the size to start at, then with each change); or leave the box, and
96
+ * when it changes, to the host altogether (`false`: nothing is held then).
97
+ */
98
+ apply?: boolean | ((size: TileSize) => void);
43
99
  /** Who sets the width: the context's layout (the default), or the tile, within the limits. */
44
100
  width?: 'context' | 'tile';
101
+ /** The gate's numbers, where a host knows better than `SIZE_GATE`. */
102
+ gate?: SizeGateOptions;
103
+ /**
104
+ * What a change of the frame's height moves is taken to be everything
105
+ * below it, the whole width of the window. A host whose layout keeps that
106
+ * to one column names an element as wide as the column here: a pointer
107
+ * beside it then holds nothing up.
108
+ */
109
+ column?: Element;
45
110
  /** Called with each thing the tile asks for and the size the rules give it. */
46
111
  onRequest?: (want: Partial<TileSize>, resolved: TileSize) => void;
47
112
  /** Called with the tile's size whenever it changes. */
@@ -62,16 +127,22 @@ export interface TileSizeControl {
62
127
  }
63
128
 
64
129
  const positive = (v: unknown): number | undefined => (typeof v === 'number' && Number.isFinite(v) && v > 0 ? v : undefined);
130
+ const now = () => performance.now();
65
131
 
66
132
  /** Negotiates the size of a rendered tile's frame with the tile. */
67
133
  export function tileSize (tile: Tile, frame: HTMLElement, options: TileSizeOptions = {}): TileSizeControl {
68
- const apply = options.apply !== false;
134
+ // Who puts a size on the frame's box: we do (the default); the host does,
135
+ // when we say (a function); or the host does, when it likes (`false`).
136
+ const hostApplies = typeof options.apply === 'function' ? options.apply : undefined;
137
+ const apply = options.apply !== false && !hostApplies;
69
138
  const tileWidth = options.width === 'tile';
70
139
  const sizing = tile.manifest?.sizing;
71
140
  let limits = options.limits ?? {};
72
141
  // What the tile has asked for so far, kept so that a change of limits can
73
142
  // be settled again against its wishes.
74
143
  const wish: Partial<TileSize> = {};
144
+ // The wishes in force: those of the last move that was made.
145
+ let granted: Partial<TileSize> = {};
75
146
  let current: TileSize = { ...DEFAULT_SIZE };
76
147
  let told = '';
77
148
  let reported = ''; // the last size the host was told of
@@ -86,12 +157,14 @@ export function tileSize (tile: Tile, frame: HTMLElement, options: TileSizeOptio
86
157
  const r = frame.getBoundingClientRect?.();
87
158
  return r && r.width > 0 && r.height > 0 ? { width: Math.round(r.width), height: Math.round(r.height) } : undefined;
88
159
  };
89
- const settle = (): TileSize => resolveSize({
90
- want: tileWidth ? wish : { height: wish.height },
160
+ const settle = (want: Partial<TileSize> = wish): TileSize => resolveSize({
161
+ want: tileWidth ? want : { height: want.height },
91
162
  sizing: tileWidth ? sizing : { ...sizing, width: undefined, minWidth: undefined, maxWidth: undefined },
92
163
  limits,
93
164
  fallback: box() ?? current,
94
165
  });
166
+ // The frame's box is in whole pixels; what a tile asks for need not be.
167
+ const same = (a: TileSize, b: TileSize) => Math.round(a.height) === Math.round(b.height) && (!tileWidth || Math.round(a.width) === Math.round(b.width));
95
168
 
96
169
  const grant = (id?: string) => {
97
170
  if (stopped) return; // a move's timer can still fire after stop()
@@ -122,28 +195,236 @@ export function tileSize (tile: Tile, frame: HTMLElement, options: TileSizeOptio
122
195
 
123
196
  const put = (size: TileSize) => {
124
197
  current = size;
198
+ if (hostApplies) {
199
+ // A host whose own code fails must not leave the tile waiting for ever
200
+ // for a move that was made.
201
+ try { hostApplies(size); }
202
+ catch (err) { console.error('Could not apply a tile\'s size:', err); }
203
+ return;
204
+ }
125
205
  if (!apply) return;
126
206
  frame.style.height = `${size.height}px`;
127
207
  if (tileWidth) frame.style.width = `${size.width}px`;
128
208
  };
209
+ // A move was made: the requests it was for hear what came of it.
210
+ const made = (ids: string[]) => {
211
+ if (apply) return answer(ids);
212
+ // The host resizes its box. Each move's requests get their own time
213
+ // for that; the observer may answer them sooner.
214
+ moved.push(...ids);
215
+ setTimeout(() => answer(take(ids)), HOST_APPLIES_MS);
216
+ };
217
+
218
+ // --- The gate
219
+ // A tile never moves what the pointer is over, and never slides itself
220
+ // under it.
221
+ //
222
+ // - A change of height moves everything below the frame's shorter edge
223
+ // (the old one for a growth, the new one for a shrink). While a mouse is
224
+ // there, or may be, the change waits, and is made once the mouse is
225
+ // somewhere it does not move. A mouse inside the frame may be in the
226
+ // strip a shrink gives up, so a shrink waits for it to leave; a growth
227
+ // does not move it, and goes ahead.
228
+ // - The strip a growth gains is the tile arriving where the page was: it
229
+ // takes no press for a moment, so that one that was on its way to the
230
+ // page does not land in the tile.
231
+ // - A finger gives no warning. For a user without a pointer that hovers
232
+ // the change is made, and everything from the moved edge down takes no
233
+ // press for a moment; the strip a shrink gave up, where the tile may
234
+ // have had its user tapping, until it has taken one tap (or `stickyMs`).
235
+ // Where a screen takes fingers as well as a mouse, what a change moved
236
+ // takes no press for a moment wherever the mouse is: the finger that
237
+ // taps in the tile is never seen.
238
+ // - A change of width may move the frame's whole row: it is treated as a
239
+ // change from the frame's top edge down.
240
+ // - At most one change per `intervalMs`, and a budget of them: `burst` to
241
+ // start with, one more every `refillMs`.
242
+ //
243
+ // What the context decides itself (its limits, a size it asks for) is not
244
+ // the tile's to time, and is done at once.
245
+ const doc = frame.ownerDocument;
246
+ const win = doc?.defaultView;
247
+ const gate = options.apply !== false && win ? withDefaults(SIZE_GATE, options.gate) : undefined;
248
+ const pointer = gate ? watchPointer(doc) : undefined;
249
+ // The one move that is before the gate, and the wishes it would put in force.
250
+ let pending: { size: TileSize; want: Partial<TileSize> } | undefined;
251
+ const asked: string[] = []; // the requests that wait to hear what comes of it
252
+ let deciding = false; // it has not been made or held yet: what is asked meanwhile is gathered
253
+ let queued = false; // and something was
254
+ let considering: object | undefined;
255
+ let retry: ReturnType<typeof setTimeout> | undefined;
256
+ let retryAt = 0;
257
+ let tokens = gate?.burst ?? 0;
258
+ let refilled = now();
259
+ let lastMove = -Infinity;
260
+ const shields = new Set<Shield>();
261
+
262
+ const rect = () => frame.getBoundingClientRect();
263
+ // Whether the pointer, where the page last saw it, is on what moves when
264
+ // the frame's box changes from `edge` (a client y) down.
265
+ const inZone = (edge: number, g: Required<SizeGateOptions>): boolean => {
266
+ const p = pointer!.state;
267
+ const c = options.column?.getBoundingClientRect?.();
268
+ const [left, right] = c ? [c.left, c.right] : [-Infinity, Infinity];
269
+ const other = pointer!.frame;
270
+ if (p.kind === 'frame' && other && other !== frame) {
271
+ // Somewhere inside another frame: on what moves if any of that frame is.
272
+ const r = other.getBoundingClientRect();
273
+ return r.bottom >= edge - g.margin && r.right >= left && r.left <= right;
274
+ }
275
+ return p.y >= edge - g.margin && p.x >= left && p.x <= right;
276
+ };
277
+ const cover = (g: Required<SizeGateOptions>, area: () => Box, sticky = false) => {
278
+ const s = shield(doc, area, { ms: g.shieldMs, dwellMs: g.dwellMs, maxMs: g.stickyMs, sticky, follow: frame });
279
+ shields.add(s);
280
+ for (const old of shields) if (old.gone) shields.delete(old);
281
+ };
282
+ // Looks at the move again in `ms`, or sooner if that was already the plan.
283
+ const later = (ms: number) => {
284
+ if (stopped) return;
285
+ const at = now() + ms;
286
+ if (retry && retryAt <= at) return;
287
+ if (retry) clearTimeout(retry);
288
+ retryAt = at;
289
+ retry = setTimeout(() => { retry = undefined; consider(); }, ms);
290
+ };
291
+ // The move before the gate has its answer, for now: made, or held. What
292
+ // was asked while it had none gets its turn.
293
+ const decided = () => {
294
+ if (!deciding) return;
295
+ deciding = false;
296
+ if (queued) { queued = false; move(); }
297
+ };
298
+ // Held: its requests hear the size the tile still has, and the move stays
299
+ // before the gate.
300
+ const hold = () => {
301
+ answer(asked.splice(0));
302
+ decided();
303
+ };
304
+ function attempt () {
305
+ const g = gate;
306
+ if (stopped || !pending || !g) return;
307
+ const from = box() ?? current;
308
+ const to = pending.size;
309
+ const t = now();
310
+ if (same(from, to)) {
311
+ granted = pending.want;
312
+ pending = undefined;
313
+ current = from;
314
+ made(asked.splice(0));
315
+ return decided();
316
+ }
317
+ const earned = Math.floor((t - refilled) / g.refillMs);
318
+ if (earned > 0) { tokens = Math.min(g.burst, tokens + earned); refilled += earned * g.refillMs; }
319
+ if (t - lastMove < g.intervalMs) return later(g.intervalMs - (t - lastMove));
320
+ if (tokens < 1) { hold(); return later(g.refillMs - (t - refilled) + 5); }
321
+ const gains = to.height > from.height || (tileWidth && to.width > from.width);
322
+ const loses = to.height < from.height || (tileWidth && to.width < from.width);
323
+ // How far down the frame nothing changes.
324
+ const low = tileWidth && to.width !== from.width ? 0 : Math.min(from.height, to.height);
325
+ const p = pointer!.state;
326
+ // What takes no press for a moment once the change is made: the strip the
327
+ // tile gains, or everything from the moved edge down.
328
+ let guard: 'strip' | 'below' | undefined;
329
+ let sticky = false;
330
+ if (!pointer!.hovers || p.kind === 'none') {
331
+ // A finger: no warning, and the tile may have had it tapping.
332
+ guard = 'below';
333
+ sticky = true;
334
+ }
335
+ else if (p.kind === 'unknown') guard = 'below'; // a mouse that has not moved since the page loaded: nothing to wait for
336
+ else if (p.kind !== 'away' && (pointer!.inside(frame) ? loses : inZone(rect().top + low, g))) {
337
+ hold();
338
+ // And again when the pointer moves on (see `onPointer`). A frame that
339
+ // is out of the document has nothing left to move.
340
+ if (frame.isConnected) later(g.retryMs);
341
+ return;
342
+ }
343
+ // The mouse is where the change moves nothing. On a screen that takes
344
+ // fingers as well, one may be on its way into the tile all the same,
345
+ // and the page will not be told.
346
+ else if (pointer!.fingers) guard = 'below';
347
+ else if (gains) guard = 'strip';
348
+ tokens--;
349
+ lastMove = t;
350
+ granted = pending.want;
351
+ pending = undefined;
352
+ put(to);
353
+ if (guard === 'strip') {
354
+ cover(g, () => { const b = rect(); return { left: b.left, top: b.top + low, width: b.width, height: b.height - low }; });
355
+ }
356
+ else if (guard === 'below') {
357
+ cover(g, () => { const y = Math.max(0, rect().top + low); return { left: 0, top: y, width: win!.innerWidth, height: win!.innerHeight - y }; });
358
+ // The strip the tile gave up is where it had its user tapping: the page
359
+ // that slides into it takes no tap until one has been swallowed there.
360
+ if (sticky && loses) {
361
+ cover(g, () => {
362
+ const b = rect();
363
+ return low ? { left: b.left, top: b.top + to.height, width: b.width, height: from.height - to.height } : { left: 0, top: b.top, width: win!.innerWidth, height: Math.max(from.height, to.height) };
364
+ }, true);
365
+ }
366
+ }
367
+ made(asked.splice(0));
368
+ decided();
369
+ }
370
+ // Pointer moves reach the page aligned to its frames, while a tile's request
371
+ // is an ordinary message: it can get here before the page has been told
372
+ // that the pointer came in over the tile, or left it. So nothing is decided
373
+ // on the spot, but once the next frame's input has been dispatched.
374
+ const consider = () => {
375
+ if (considering || stopped || !pending || !gate || !win) return;
376
+ const mine = considering = {};
377
+ const run = () => {
378
+ if (considering !== mine) return;
379
+ considering = undefined;
380
+ attempt();
381
+ };
382
+ if (typeof win.requestAnimationFrame === 'function') win.requestAnimationFrame(() => win.requestAnimationFrame(run));
383
+ setTimeout(run, gate.decideMs); // a page that is not drawing still decides
384
+ };
385
+ // A change that is held is made as soon as the pointer is somewhere it
386
+ // does not move.
387
+ const onPointer = () => { if (pending) consider(); };
388
+ const offPointer = pointer?.onChange(onPointer);
389
+ // What the context decides is done at once. Only the wishes already in
390
+ // force are settled with it: what the tile has asked for since waits its
391
+ // turn at the gate.
392
+ const enforce = () => {
393
+ if (!gate || stopped) return;
394
+ const size = settle(granted);
395
+ if (pending) pending.size = settle(pending.want);
396
+ if (same(size, box() ?? current)) return;
397
+ put(size);
398
+ made([]);
399
+ };
400
+
129
401
  // At most one move per SETTLE_MS: the first at once, the rest together. The
130
402
  // requests gathered into one move are applied as one (for each dimension the
131
403
  // last value asked for, which is what `wish` holds), and every one of them
132
404
  // is answered, by its own id, with the size that came of it: no request is
133
- // left waiting because a later one overtook it.
405
+ // left waiting because a later one overtook it. "At once" is as soon as the
406
+ // gate has decided; what is asked before it has is gathered too.
134
407
  const move = () => {
135
408
  const go = () => {
136
409
  timer = undefined;
137
410
  lastApplied = Date.now();
138
- put(settle());
139
411
  const ids = waiting.splice(0);
140
- if (apply) return answer(ids);
141
- // The host resizes its box. Each move's requests get their own time
142
- // for that; the observer may answer them sooner.
143
- moved.push(...ids);
144
- setTimeout(() => answer(take(ids)), HOST_APPLIES_MS);
412
+ if (!gate) {
413
+ put(settle());
414
+ return made(ids);
415
+ }
416
+ pending = { size: settle(), want: { ...wish } };
417
+ asked.push(...ids);
418
+ deciding = true;
419
+ // The wait starts with this request, whatever was under way for the
420
+ // move it replaces.
421
+ considering = undefined;
422
+ if (retry) clearTimeout(retry);
423
+ retry = undefined;
424
+ consider();
145
425
  };
146
426
  if (timer || stopped) return;
427
+ if (deciding) { queued = true; return; }
147
428
  const since = Date.now() - lastApplied;
148
429
  if (since >= SETTLE_MS) go();
149
430
  else timer = setTimeout(go, SETTLE_MS - since);
@@ -183,11 +464,15 @@ export function tileSize (tile: Tile, frame: HTMLElement, options: TileSizeOptio
183
464
  get limits () { return effectiveLimits(limits); },
184
465
  setLimits (next) {
185
466
  limits = next ?? {};
467
+ enforce();
186
468
  move();
187
469
  },
188
470
  request (want) {
189
471
  Object.assign(wish, want);
472
+ Object.assign(granted, want);
473
+ if (pending) Object.assign(pending.want, want);
190
474
  const resolved = settle();
475
+ enforce();
191
476
  move();
192
477
  return resolved;
193
478
  },
@@ -195,7 +480,10 @@ export function tileSize (tile: Tile, frame: HTMLElement, options: TileSizeOptio
195
480
  stopped = true;
196
481
  tile.removeEventListener('protocol', onProtocol);
197
482
  observer?.disconnect();
483
+ offPointer?.();
198
484
  if (timer) clearTimeout(timer);
485
+ if (retry) clearTimeout(retry);
486
+ shields.forEach(s => s.remove());
199
487
  },
200
488
  };
201
489
  }