@rohal12/spindle 0.64.27 → 0.64.28

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.
@@ -92,11 +92,36 @@ var SVG_NOT_TEXT = /* @__PURE__ */ new Set([
92
92
  "pattern",
93
93
  "marker"
94
94
  ]);
95
+ var hiddenDefaults = /* @__PURE__ */ new WeakSet();
96
+ var needsHiddenDefaults = /* @__PURE__ */ new WeakMap();
97
+ function ensureHiddenDefaults(el) {
98
+ if (!el.hasAttribute("hidden")) return;
99
+ const doc = el.ownerDocument;
100
+ const view = doc.defaultView ?? globalThis.window;
101
+ let needed = needsHiddenDefaults.get(doc);
102
+ if (needed === void 0) {
103
+ const detached = doc.implementation.createHTMLDocument("");
104
+ const probe = detached.createElement("div");
105
+ probe.hidden = true;
106
+ detached.body.append(probe);
107
+ needed = view?.getComputedStyle(probe).display === "block";
108
+ needsHiddenDefaults.set(doc, needed);
109
+ }
110
+ const root = el.getRootNode();
111
+ if (!needed || hiddenDefaults.has(root)) return;
112
+ const container = root.nodeType === 9 ? root.head : root;
113
+ if (root.nodeType !== 9 && !("host" in root)) return;
114
+ const style = doc.createElement("style");
115
+ style.textContent = ":where([hidden]:not([hidden=\"until-found\" i])){display:none}:where([hidden=\"until-found\" i]){content-visibility:hidden}";
116
+ container.prepend(style);
117
+ hiddenDefaults.add(root);
118
+ }
95
119
  /** Detached/headless DOMs may have no computed value; CSSOM still resolves
96
120
  * duplicate inline declarations and priorities correctly.
97
121
  */
98
122
  function styleValue(el, name) {
99
- return (el.ownerDocument.defaultView ?? globalThis.window)?.getComputedStyle?.(el)[name] || el.style?.[name] || "";
123
+ ensureHiddenDefaults(el);
124
+ return (el.ownerDocument.defaultView ?? globalThis.window)?.getComputedStyle?.(el).getPropertyValue(name) || el.style?.getPropertyValue(name) || "";
100
125
  }
101
126
  /**
102
127
  * Whether the element hides its whole subtree, including stylesheet rules.
@@ -104,7 +129,32 @@ function styleValue(el, name) {
104
129
  * A symbol referenced by SVG use is rendered only as an instance root.
105
130
  */
106
131
  function isHidden(el, svgInstanceRoot = false) {
107
- return el.hasAttribute("hidden") || el.getAttribute("aria-hidden") === "true" || styleValue(el, "display") === "none" || NOT_TEXT.has(el.localName.toLowerCase()) || el.namespaceURI === "http://www.w3.org/2000/svg" && SVG_NOT_TEXT.has(el.localName.toLowerCase()) && !(svgInstanceRoot && el.localName.toLowerCase() === "symbol") || el.parentElement?.tagName === "DETAILS" && !el.parentElement.hasAttribute("open") && el !== Array.from(el.parentElement.children).find((c) => c.tagName === "SUMMARY");
132
+ const display = styleValue(el, "display");
133
+ return el.hasAttribute("hidden") && el.getAttribute("hidden")?.toLowerCase() !== "until-found" && display === "" || el.getAttribute("aria-hidden") === "true" || display === "none" || NOT_TEXT.has(el.localName.toLowerCase()) || el.namespaceURI === "http://www.w3.org/2000/svg" && SVG_NOT_TEXT.has(el.localName.toLowerCase()) && !(svgInstanceRoot && el.localName.toLowerCase() === "symbol") || el.parentElement?.tagName === "DETAILS" && !el.parentElement.hasAttribute("open") && el !== Array.from(el.parentElement.children).find((c) => c.tagName === "SUMMARY");
134
+ }
135
+ var NO_LAYOUT_CONTAINMENT = /* @__PURE__ */ new Set([
136
+ "none",
137
+ "contents",
138
+ "ruby",
139
+ "ruby-base",
140
+ "ruby-text",
141
+ "ruby-base-container",
142
+ "ruby-text-container",
143
+ "table-row",
144
+ "table-row-group",
145
+ "table-header-group",
146
+ "table-footer-group",
147
+ "table-column",
148
+ "table-column-group"
149
+ ]);
150
+ /** content-visibility suppresses contents only in layout containment boxes. */
151
+ function hidesContents(el) {
152
+ const value = styleValue(el, "content-visibility");
153
+ if (!(value === "hidden" || value === "" && el.getAttribute("hidden")?.toLowerCase() === "until-found")) return false;
154
+ const display = styleValue(el, "display") || (el.localName === "td" || el.localName === "th" ? "table-cell" : "inline");
155
+ if (NO_LAYOUT_CONTAINMENT.has(display)) return false;
156
+ if (display === "inline" || display === "inline list-item") return el.namespaceURI === "http://www.w3.org/2000/svg" || el.matches("img, input, textarea, select, button, fieldset, video, audio, canvas, iframe, embed");
157
+ return true;
108
158
  }
109
159
  /**
110
160
  * Whether `el` is in a closed `<details>`, other than in the summary that
@@ -134,6 +184,7 @@ function isRendered(el, root, checkVisibility = true) {
134
184
  if (checkVisibility && (visibility === "hidden" || visibility === "collapse")) return false;
135
185
  for (let e = el; e; e = composedParent(e)) {
136
186
  if (styleValue(e, "display") === "none") return false;
187
+ if (e !== el && hidesContents(e)) return false;
137
188
  if (e === root) break;
138
189
  const parent = e.parentElement;
139
190
  if (parent?.shadowRoot && !e.assignedSlot) return false;
@@ -147,6 +198,35 @@ function isReaderVisible(el) {
147
198
  for (let at = el; at; at = composedParent(at)) if (isHidden(at) || at.hasAttribute("inert")) return false;
148
199
  return true;
149
200
  }
201
+ // src/utils/type-reveal.ts
202
+ /** Remaining revealed characters at this node, across nested typewriters. */
203
+ function revealedCharacters(node) {
204
+ let available = Infinity;
205
+ const element = node.nodeType === 1 ? node : node.parentElement;
206
+ for (let at = element; at; at = composedParent(at)) {
207
+ const count = at.getAttribute("data-type-revealed");
208
+ if (count === null) continue;
209
+ let left = Number(count);
210
+ if (!Number.isFinite(left)) continue;
211
+ if (!at.contains(node)) return 0;
212
+ for (let child = node; child !== at; child = child.parentNode) for (let sibling = child.previousSibling; sibling; sibling = sibling.previousSibling) if (sibling.nodeType === 1 || sibling.nodeType === 3) left -= sibling.textContent?.length ?? 0;
213
+ available = Math.min(available, Math.max(0, left));
214
+ }
215
+ return available;
216
+ }
217
+ /** Only the prefix that every containing typewriter has revealed. */
218
+ function revealedText(node) {
219
+ return node.data.slice(0, revealedCharacters(node));
220
+ }
221
+ /** Offer a control once its entire label is revealed, avoiding label spoilers.
222
+ * Controls without DOM text have no measured clip boxes; wait for completion.
223
+ */
224
+ function isFullyRevealed(el) {
225
+ const available = revealedCharacters(el);
226
+ if (available !== Infinity && (!el.textContent || available < el.textContent.length)) return false;
227
+ for (const child of composedElements(el)) if (child.hasAttribute("data-type-revealed") && revealedCharacters(child) < (child.textContent?.length ?? 0)) return false;
228
+ return true;
229
+ }
150
230
  // src/prng.ts
151
231
  /**
152
232
  * Seedable PRNG for Spindle — Mulberry32 algorithm.
@@ -9510,7 +9590,7 @@ function effectiveAction(action) {
9510
9590
  /** Whether any connected instance of this action is visible to a reader. */
9511
9591
  function isActionVisible(action) {
9512
9592
  const elements = actionElements(action.id);
9513
- return elements.length === 0 || elements.some(isReaderVisible);
9593
+ return elements.length === 0 || elements.some((el) => isReaderVisible(el) && isFullyRevealed(el));
9514
9594
  }
9515
9595
  function resetIdCounters() {
9516
9596
  idCounters.clear();
@@ -22359,8 +22439,8 @@ function observableText(el, skip, visibilityRoot) {
22359
22439
  if (instanceRoot && --instanceNodes < 0) return;
22360
22440
  if (node.nodeType === 3) {
22361
22441
  const parent = node.assignedSlot ?? node.parentElement ?? node.getRootNode().host;
22362
- if (parent && !isRendered(parent, instanceRoot ?? visibilityRoot)) return;
22363
- const data = node.textContent ?? "";
22442
+ if (parent && (hidesContents(parent) || !isRendered(parent, instanceRoot ?? visibilityRoot))) return;
22443
+ const data = revealedText(node);
22364
22444
  if (inPre) out += data;
22365
22445
  else {
22366
22446
  const collapsed = data.replace(/\s+/g, " ");
@@ -22371,8 +22451,9 @@ function observableText(el, skip, visibilityRoot) {
22371
22451
  if (node.nodeType !== 1) return;
22372
22452
  const child = node;
22373
22453
  if (isHidden(child, child === instanceRoot) || skip && child !== el && child.matches(skip)) return;
22454
+ if (!isRendered(child, instanceRoot ?? visibilityRoot, false)) return;
22374
22455
  if (child.namespaceURI === "http://www.w3.org/2000/svg" && child.localName === "use") {
22375
- if (!isRendered(child, instanceRoot ?? visibilityRoot, false)) return;
22456
+ if (hidesContents(child) || !isFullyRevealed(child)) return;
22376
22457
  const target = localTarget(child);
22377
22458
  if (!target || target.namespaceURI !== child.namespaceURI || references.has(target) || references.size >= 32) return;
22378
22459
  references.add(target);
@@ -22383,7 +22464,7 @@ function observableText(el, skip, visibilityRoot) {
22383
22464
  }
22384
22465
  if (child.matches("input, textarea, select") || child.hasAttribute("data-action") && getAction(child.getAttribute("data-action"))?.type === "cycle") {
22385
22466
  if (child.matches("input[type=\"hidden\" i]")) return;
22386
- if (!isRendered(child, instanceRoot ?? visibilityRoot)) return;
22467
+ if (!isRendered(child, instanceRoot ?? visibilityRoot) || !isFullyRevealed(child)) return;
22387
22468
  out += controlMarker(child);
22388
22469
  return;
22389
22470
  }
@@ -22392,6 +22473,7 @@ function observableText(el, skip, visibilityRoot) {
22392
22473
  return;
22393
22474
  }
22394
22475
  const block = BLOCKS.has(child.tagName);
22476
+ if (hidesContents(child)) return;
22395
22477
  if (block) endLine();
22396
22478
  const closedDetails = child.tagName === "DETAILS" && !child.hasAttribute("open");
22397
22479
  const rendered = composedChildNodes(child);
@@ -22421,7 +22503,7 @@ function observableErrors(el, skip, visibilityRoot) {
22421
22503
  }
22422
22504
  return false;
22423
22505
  };
22424
- return [...composedElements(el)].filter((e) => e.matches(".error") && !left(e) && isRendered(e, visibilityRoot)).map((e) => observableText(e, skip, visibilityRoot).trim());
22506
+ return [...composedElements(el)].filter((e) => e.matches(".error") && !left(e) && isRendered(e, visibilityRoot)).map((e) => observableText(e, skip, visibilityRoot).trim()).filter(Boolean);
22425
22507
  }
22426
22508
  // src/utils/stable-key.ts
22427
22509
  /**
@@ -25859,6 +25941,7 @@ defineMacro({
25859
25941
  children: [/* @__PURE__ */ jsx("span", {
25860
25942
  ref: innerRef,
25861
25943
  class: "macro-type-inner",
25944
+ "data-type-revealed": done ? void 0 : visibleChars,
25862
25945
  style: {
25863
25946
  display: "inline",
25864
25947
  visibility: measured === null ? "hidden" : "visible",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rohal12/spindle",
3
- "version": "0.64.27",
3
+ "version": "0.64.28",
4
4
  "type": "module",
5
5
  "description": "A Preact-based story format for Twine 2.",
6
6
  "license": "Unlicense",
@@ -1,4 +1,5 @@
1
1
  import { isReaderVisible } from './utils/element-visibility';
2
+ import { isFullyRevealed } from './utils/type-reveal';
2
3
  import { readOnlyValue } from './execute-mutation';
3
4
  import { emit } from './event-emitter';
4
5
  import {
@@ -307,7 +308,10 @@ export function isActionVisible(action: StoryAction): boolean {
307
308
  // Older custom actions need not associate a DOM control. Keep those
308
309
  // registrations available; built-ins and associated custom controls are
309
310
  // filtered against the live DOM.
310
- return elements.length === 0 || elements.some(isReaderVisible);
311
+ return (
312
+ elements.length === 0 ||
313
+ elements.some((el) => isReaderVisible(el) && isFullyRevealed(el))
314
+ );
311
315
  }
312
316
 
313
317
  export function clearActions(): void {
@@ -119,6 +119,7 @@ defineMacro({
119
119
  <span
120
120
  ref={innerRef}
121
121
  class="macro-type-inner"
122
+ data-type-revealed={done ? undefined : visibleChars}
122
123
  style={{
123
124
  display: 'inline',
124
125
  visibility: measured === null ? 'hidden' : 'visible',
@@ -4,7 +4,9 @@ import {
4
4
  composedParent,
5
5
  isHidden,
6
6
  isRendered,
7
+ hidesContents,
7
8
  } from '../utils/element-visibility';
9
+ import { isFullyRevealed, revealedText } from '../utils/type-reveal';
8
10
  import { getAction } from '../action-registry';
9
11
  import { SvgInstances } from './svg-instances';
10
12
 
@@ -134,8 +136,13 @@ export function observableText(
134
136
  (node as Text).assignedSlot ??
135
137
  node.parentElement ??
136
138
  (node.getRootNode() as ShadowRoot).host;
137
- if (parent && !isRendered(parent, instanceRoot ?? visibilityRoot)) return;
138
- const data = node.textContent ?? '';
139
+ if (
140
+ parent &&
141
+ (hidesContents(parent) ||
142
+ !isRendered(parent, instanceRoot ?? visibilityRoot))
143
+ )
144
+ return;
145
+ const data = revealedText(node as Text);
139
146
  if (inPre) out += data;
140
147
  else {
141
148
  // Source whitespace between blocks isn't a line of its own
@@ -152,13 +159,14 @@ export function observableText(
152
159
  (skip && child !== el && child.matches(skip))
153
160
  )
154
161
  return;
162
+ if (!isRendered(child, instanceRoot ?? visibilityRoot, false)) return;
155
163
  if (
156
164
  child.namespaceURI === 'http://www.w3.org/2000/svg' &&
157
165
  child.localName === 'use'
158
166
  ) {
159
167
  // Visibility is inherited by the instance and can be overridden inside
160
168
  // it; unlike display:none, it does not hide the entire subtree.
161
- if (!isRendered(child, instanceRoot ?? visibilityRoot, false)) return;
169
+ if (hidesContents(child) || !isFullyRevealed(child)) return;
162
170
  const target = localTarget(child);
163
171
  if (
164
172
  !target ||
@@ -179,7 +187,11 @@ export function observableText(
179
187
  getAction(child.getAttribute('data-action')!)?.type === 'cycle')
180
188
  ) {
181
189
  if (child.matches('input[type="hidden" i]')) return;
182
- if (!isRendered(child, instanceRoot ?? visibilityRoot)) return;
190
+ if (
191
+ !isRendered(child, instanceRoot ?? visibilityRoot) ||
192
+ !isFullyRevealed(child)
193
+ )
194
+ return;
183
195
  out += controlMarker(child);
184
196
  return;
185
197
  }
@@ -188,6 +200,7 @@ export function observableText(
188
200
  return;
189
201
  }
190
202
  const block = BLOCKS.has(child.tagName);
203
+ if (hidesContents(child)) return;
191
204
  if (block) endLine();
192
205
  const closedDetails =
193
206
  child.tagName === 'DETAILS' && !child.hasAttribute('open');
@@ -241,5 +254,6 @@ export function observableErrors(
241
254
  .filter(
242
255
  (e) => e.matches('.error') && !left(e) && isRendered(e, visibilityRoot),
243
256
  )
244
- .map((e) => observableText(e, skip, visibilityRoot).trim());
257
+ .map((e) => observableText(e, skip, visibilityRoot).trim())
258
+ .filter(Boolean);
245
259
  }
@@ -47,15 +47,49 @@ const SVG_NOT_TEXT = new Set([
47
47
  'marker',
48
48
  ]);
49
49
 
50
+ // DOM shims may omit the native hidden rules. Supply their defaults at zero
51
+ // specificity, before author rules, so the CSS cascade still decides visibility.
52
+ const hiddenDefaults = new WeakSet<Node>();
53
+ const needsHiddenDefaults = new WeakMap<Document, boolean>();
54
+ function ensureHiddenDefaults(el: Element): void {
55
+ if (!el.hasAttribute('hidden')) return;
56
+ const doc = el.ownerDocument;
57
+ const view = doc.defaultView ?? globalThis.window;
58
+ let needed = needsHiddenDefaults.get(doc);
59
+ if (needed === undefined) {
60
+ const detached = doc.implementation.createHTMLDocument('');
61
+ const probe = detached.createElement('div');
62
+ probe.hidden = true;
63
+ detached.body.append(probe);
64
+ // Browsers don't compute styles in documents without a browsing context.
65
+ needed = view?.getComputedStyle(probe).display === 'block';
66
+ needsHiddenDefaults.set(doc, needed);
67
+ }
68
+ const root = el.getRootNode() as Document | ShadowRoot;
69
+ if (!needed || hiddenDefaults.has(root)) return;
70
+ const container = root.nodeType === 9 ? (root as Document).head : root;
71
+ if (root.nodeType !== 9 && !('host' in root)) return;
72
+ const style = doc.createElement('style');
73
+ style.textContent =
74
+ ':where([hidden]:not([hidden="until-found" i])){display:none}' +
75
+ ':where([hidden="until-found" i]){content-visibility:hidden}';
76
+ container.prepend(style);
77
+ hiddenDefaults.add(root);
78
+ }
79
+
50
80
  /** Detached/headless DOMs may have no computed value; CSSOM still resolves
51
81
  * duplicate inline declarations and priorities correctly.
52
82
  */
53
- function styleValue(el: Element, name: 'display' | 'visibility'): string {
83
+ function styleValue(
84
+ el: Element,
85
+ name: 'display' | 'visibility' | 'content-visibility',
86
+ ): string {
87
+ ensureHiddenDefaults(el);
54
88
  return (
55
- (el.ownerDocument.defaultView ?? globalThis.window)?.getComputedStyle?.(el)[
56
- name
57
- ] ||
58
- (el as HTMLElement).style?.[name] ||
89
+ (el.ownerDocument.defaultView ?? globalThis.window)
90
+ ?.getComputedStyle?.(el)
91
+ .getPropertyValue(name) ||
92
+ (el as HTMLElement).style?.getPropertyValue(name) ||
59
93
  ''
60
94
  );
61
95
  }
@@ -66,10 +100,13 @@ function styleValue(el: Element, name: 'display' | 'visibility'): string {
66
100
  * A symbol referenced by SVG use is rendered only as an instance root.
67
101
  */
68
102
  export function isHidden(el: Element, svgInstanceRoot = false): boolean {
103
+ const display = styleValue(el, 'display');
69
104
  return (
70
- el.hasAttribute('hidden') ||
105
+ (el.hasAttribute('hidden') &&
106
+ el.getAttribute('hidden')?.toLowerCase() !== 'until-found' &&
107
+ display === '') ||
71
108
  el.getAttribute('aria-hidden') === 'true' ||
72
- styleValue(el, 'display') === 'none' ||
109
+ display === 'none' ||
73
110
  NOT_TEXT.has(el.localName.toLowerCase()) ||
74
111
  (el.namespaceURI === 'http://www.w3.org/2000/svg' &&
75
112
  SVG_NOT_TEXT.has(el.localName.toLowerCase()) &&
@@ -83,6 +120,50 @@ export function isHidden(el: Element, svgInstanceRoot = false): boolean {
83
120
  );
84
121
  }
85
122
 
123
+ // Layout containment cannot apply to these box types. In particular, an
124
+ // ordinary inline span still paints its contents with content-visibility:hidden.
125
+ const NO_LAYOUT_CONTAINMENT = new Set([
126
+ 'none',
127
+ 'contents',
128
+ 'ruby',
129
+ 'ruby-base',
130
+ 'ruby-text',
131
+ 'ruby-base-container',
132
+ 'ruby-text-container',
133
+ 'table-row',
134
+ 'table-row-group',
135
+ 'table-header-group',
136
+ 'table-footer-group',
137
+ 'table-column',
138
+ 'table-column-group',
139
+ ]);
140
+
141
+ /** content-visibility suppresses contents only in layout containment boxes. */
142
+ export function hidesContents(el: Element): boolean {
143
+ const value = styleValue(el, 'content-visibility');
144
+ const hidden =
145
+ value === 'hidden' ||
146
+ (value === '' &&
147
+ el.getAttribute('hidden')?.toLowerCase() === 'until-found');
148
+ if (!hidden) return false;
149
+ // Some headless DOMs omit the native table-cell and inline display defaults.
150
+ const display =
151
+ styleValue(el, 'display') ||
152
+ (el.localName === 'td' || el.localName === 'th' ? 'table-cell' : 'inline');
153
+ if (NO_LAYOUT_CONTAINMENT.has(display)) return false;
154
+ if (display === 'inline' || display === 'inline list-item') {
155
+ // SVG rendering and native replaced/formatting contexts still suppress
156
+ // their contents even when the computed display is inline.
157
+ return (
158
+ el.namespaceURI === 'http://www.w3.org/2000/svg' ||
159
+ el.matches(
160
+ 'img, input, textarea, select, button, fieldset, video, audio, canvas, iframe, embed',
161
+ )
162
+ );
163
+ }
164
+ return true;
165
+ }
166
+
86
167
  /**
87
168
  * Whether `el` is in a closed `<details>`, other than in the summary that
88
169
  * toggles it: the browser renders none of that content (#389).
@@ -119,6 +200,7 @@ export function isRendered(
119
200
  return false;
120
201
  for (let e: Element | null = el; e; e = composedParent(e)) {
121
202
  if (styleValue(e, 'display') === 'none') return false;
203
+ if (e !== el && hidesContents(e)) return false;
122
204
  if (e === root) break;
123
205
  const parent = e.parentElement;
124
206
  // Connected light DOM may have no place in its host's rendered tree.
@@ -0,0 +1,55 @@
1
+ import { composedElements, composedParent } from './element-visibility';
2
+
3
+ /** Remaining revealed characters at this node, across nested typewriters. */
4
+ function revealedCharacters(node: Node): number {
5
+ let available = Infinity;
6
+ const element = node.nodeType === 1 ? (node as Element) : node.parentElement;
7
+ for (let at = element; at; at = composedParent(at)) {
8
+ const count = at.getAttribute('data-type-revealed');
9
+ if (count === null) continue;
10
+ let left = Number(count);
11
+ if (!Number.isFinite(left)) continue;
12
+ // The visual clip counts DOM text, including text hidden by other CSS.
13
+ // Shadow content has no measured range until its containing type finishes.
14
+ if (!at.contains(node)) return 0;
15
+ for (let child = node; child !== at; child = child.parentNode!) {
16
+ for (
17
+ let sibling = child.previousSibling;
18
+ sibling;
19
+ sibling = sibling.previousSibling
20
+ ) {
21
+ if (sibling.nodeType === 1 || sibling.nodeType === 3)
22
+ left -= sibling.textContent?.length ?? 0;
23
+ }
24
+ }
25
+ available = Math.min(available, Math.max(0, left));
26
+ }
27
+ return available;
28
+ }
29
+
30
+ /** Only the prefix that every containing typewriter has revealed. */
31
+ export function revealedText(node: Text): string {
32
+ return node.data.slice(0, revealedCharacters(node));
33
+ }
34
+
35
+ /** Offer a control once its entire label is revealed, avoiding label spoilers.
36
+ * Controls without DOM text have no measured clip boxes; wait for completion.
37
+ */
38
+ export function isFullyRevealed(el: Element): boolean {
39
+ const available = revealedCharacters(el);
40
+ if (
41
+ available !== Infinity &&
42
+ (!el.textContent || available < el.textContent.length)
43
+ )
44
+ return false;
45
+ // Custom controls may wrap a typewriter in their label. An enclosing
46
+ // typewriter finishing does not reveal a slower one inside the control.
47
+ for (const child of composedElements(el)) {
48
+ if (
49
+ child.hasAttribute('data-type-revealed') &&
50
+ revealedCharacters(child) < (child.textContent?.length ?? 0)
51
+ )
52
+ return false;
53
+ }
54
+ return true;
55
+ }