@teleporthq/teleport-shared 0.43.70 → 0.43.74

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 (169) hide show
  1. package/__tests__/function-sources.ts +30 -0
  2. package/__tests__/motion-runtime/motion-engine.ts +102 -0
  3. package/__tests__/motion-runtime/scroll-video-engine.ts +28 -0
  4. package/__tests__/scroll-scene/story-lanes.ts +126 -0
  5. package/dist/cjs/index.d.ts +5 -1
  6. package/dist/cjs/index.d.ts.map +1 -1
  7. package/dist/cjs/index.js +9 -1
  8. package/dist/cjs/index.js.map +1 -1
  9. package/dist/cjs/motion-runtime/index.d.ts +3 -0
  10. package/dist/cjs/motion-runtime/index.d.ts.map +1 -0
  11. package/dist/cjs/motion-runtime/index.js +8 -0
  12. package/dist/cjs/motion-runtime/index.js.map +1 -0
  13. package/dist/cjs/motion-runtime/motion-engine-source.d.ts +16 -0
  14. package/dist/cjs/motion-runtime/motion-engine-source.d.ts.map +1 -0
  15. package/dist/cjs/motion-runtime/motion-engine-source.js +20 -0
  16. package/dist/cjs/motion-runtime/motion-engine-source.js.map +1 -0
  17. package/dist/cjs/motion-runtime/scroll-video-engine-source.d.ts +9 -0
  18. package/dist/cjs/motion-runtime/scroll-video-engine-source.d.ts.map +1 -0
  19. package/dist/cjs/motion-runtime/scroll-video-engine-source.js +13 -0
  20. package/dist/cjs/motion-runtime/scroll-video-engine-source.js.map +1 -0
  21. package/dist/cjs/page-transition/index.d.ts +5 -0
  22. package/dist/cjs/page-transition/index.d.ts.map +1 -0
  23. package/dist/cjs/page-transition/index.js +21 -0
  24. package/dist/cjs/page-transition/index.js.map +1 -0
  25. package/dist/cjs/page-transition/morph-source.d.ts +20 -0
  26. package/dist/cjs/page-transition/morph-source.d.ts.map +1 -0
  27. package/dist/cjs/page-transition/morph-source.js +25 -0
  28. package/dist/cjs/page-transition/morph-source.js.map +1 -0
  29. package/dist/cjs/page-transition/variant-sources.generated.d.ts +7 -0
  30. package/dist/cjs/page-transition/variant-sources.generated.d.ts.map +1 -0
  31. package/dist/cjs/page-transition/variant-sources.generated.js +14 -0
  32. package/dist/cjs/page-transition/variant-sources.generated.js.map +1 -0
  33. package/dist/cjs/page-transition/variants.d.ts +87 -0
  34. package/dist/cjs/page-transition/variants.d.ts.map +1 -0
  35. package/dist/cjs/page-transition/variants.js +330 -0
  36. package/dist/cjs/page-transition/variants.js.map +1 -0
  37. package/dist/cjs/page-transition/view-transition-css.d.ts +21 -0
  38. package/dist/cjs/page-transition/view-transition-css.d.ts.map +1 -0
  39. package/dist/cjs/page-transition/view-transition-css.js +188 -0
  40. package/dist/cjs/page-transition/view-transition-css.js.map +1 -0
  41. package/dist/cjs/scroll-scene/chapter-index.d.ts +15 -0
  42. package/dist/cjs/scroll-scene/chapter-index.d.ts.map +1 -0
  43. package/dist/cjs/scroll-scene/chapter-index.js +30 -0
  44. package/dist/cjs/scroll-scene/chapter-index.js.map +1 -0
  45. package/dist/cjs/scroll-scene/controller-source.d.ts +26 -0
  46. package/dist/cjs/scroll-scene/controller-source.d.ts.map +1 -0
  47. package/dist/cjs/scroll-scene/controller-source.js +34 -0
  48. package/dist/cjs/scroll-scene/controller-source.js.map +1 -0
  49. package/dist/cjs/scroll-scene/engine-source.d.ts +2 -0
  50. package/dist/cjs/scroll-scene/engine-source.d.ts.map +1 -0
  51. package/dist/cjs/scroll-scene/engine-source.js +23 -0
  52. package/dist/cjs/scroll-scene/engine-source.js.map +1 -0
  53. package/dist/cjs/scroll-scene/helper-sources.generated.d.ts +9 -0
  54. package/dist/cjs/scroll-scene/helper-sources.generated.d.ts.map +1 -0
  55. package/dist/cjs/scroll-scene/helper-sources.generated.js +16 -0
  56. package/dist/cjs/scroll-scene/helper-sources.generated.js.map +1 -0
  57. package/dist/cjs/scroll-scene/index.d.ts +8 -0
  58. package/dist/cjs/scroll-scene/index.d.ts.map +1 -0
  59. package/dist/cjs/scroll-scene/index.js +24 -0
  60. package/dist/cjs/scroll-scene/index.js.map +1 -0
  61. package/dist/cjs/scroll-scene/moment.d.ts +21 -0
  62. package/dist/cjs/scroll-scene/moment.d.ts.map +1 -0
  63. package/dist/cjs/scroll-scene/moment.js +50 -0
  64. package/dist/cjs/scroll-scene/moment.js.map +1 -0
  65. package/dist/cjs/scroll-scene/points.d.ts +23 -0
  66. package/dist/cjs/scroll-scene/points.d.ts.map +1 -0
  67. package/dist/cjs/scroll-scene/points.js +51 -0
  68. package/dist/cjs/scroll-scene/points.js.map +1 -0
  69. package/dist/cjs/scroll-scene/unclip.d.ts +15 -0
  70. package/dist/cjs/scroll-scene/unclip.d.ts.map +1 -0
  71. package/dist/cjs/scroll-scene/unclip.js +44 -0
  72. package/dist/cjs/scroll-scene/unclip.js.map +1 -0
  73. package/dist/cjs/state-bindings/index.d.ts +74 -0
  74. package/dist/cjs/state-bindings/index.d.ts.map +1 -0
  75. package/dist/cjs/state-bindings/index.js +193 -0
  76. package/dist/cjs/state-bindings/index.js.map +1 -0
  77. package/dist/cjs/tsconfig.tsbuildinfo +1 -1
  78. package/dist/esm/index.d.ts +5 -1
  79. package/dist/esm/index.d.ts.map +1 -1
  80. package/dist/esm/index.js +5 -1
  81. package/dist/esm/index.js.map +1 -1
  82. package/dist/esm/motion-runtime/index.d.ts +3 -0
  83. package/dist/esm/motion-runtime/index.d.ts.map +1 -0
  84. package/dist/esm/motion-runtime/index.js +3 -0
  85. package/dist/esm/motion-runtime/index.js.map +1 -0
  86. package/dist/esm/motion-runtime/motion-engine-source.d.ts +16 -0
  87. package/dist/esm/motion-runtime/motion-engine-source.d.ts.map +1 -0
  88. package/dist/esm/motion-runtime/motion-engine-source.js +16 -0
  89. package/dist/esm/motion-runtime/motion-engine-source.js.map +1 -0
  90. package/dist/esm/motion-runtime/scroll-video-engine-source.d.ts +9 -0
  91. package/dist/esm/motion-runtime/scroll-video-engine-source.d.ts.map +1 -0
  92. package/dist/esm/motion-runtime/scroll-video-engine-source.js +9 -0
  93. package/dist/esm/motion-runtime/scroll-video-engine-source.js.map +1 -0
  94. package/dist/esm/page-transition/index.d.ts +5 -0
  95. package/dist/esm/page-transition/index.d.ts.map +1 -0
  96. package/dist/esm/page-transition/index.js +5 -0
  97. package/dist/esm/page-transition/index.js.map +1 -0
  98. package/dist/esm/page-transition/morph-source.d.ts +20 -0
  99. package/dist/esm/page-transition/morph-source.d.ts.map +1 -0
  100. package/dist/esm/page-transition/morph-source.js +21 -0
  101. package/dist/esm/page-transition/morph-source.js.map +1 -0
  102. package/dist/esm/page-transition/variant-sources.generated.d.ts +7 -0
  103. package/dist/esm/page-transition/variant-sources.generated.d.ts.map +1 -0
  104. package/dist/esm/page-transition/variant-sources.generated.js +11 -0
  105. package/dist/esm/page-transition/variant-sources.generated.js.map +1 -0
  106. package/dist/esm/page-transition/variants.d.ts +87 -0
  107. package/dist/esm/page-transition/variants.d.ts.map +1 -0
  108. package/dist/esm/page-transition/variants.js +318 -0
  109. package/dist/esm/page-transition/variants.js.map +1 -0
  110. package/dist/esm/page-transition/view-transition-css.d.ts +21 -0
  111. package/dist/esm/page-transition/view-transition-css.d.ts.map +1 -0
  112. package/dist/esm/page-transition/view-transition-css.js +161 -0
  113. package/dist/esm/page-transition/view-transition-css.js.map +1 -0
  114. package/dist/esm/scroll-scene/chapter-index.d.ts +15 -0
  115. package/dist/esm/scroll-scene/chapter-index.d.ts.map +1 -0
  116. package/dist/esm/scroll-scene/chapter-index.js +26 -0
  117. package/dist/esm/scroll-scene/chapter-index.js.map +1 -0
  118. package/dist/esm/scroll-scene/controller-source.d.ts +26 -0
  119. package/dist/esm/scroll-scene/controller-source.d.ts.map +1 -0
  120. package/dist/esm/scroll-scene/controller-source.js +26 -0
  121. package/dist/esm/scroll-scene/controller-source.js.map +1 -0
  122. package/dist/esm/scroll-scene/engine-source.d.ts +2 -0
  123. package/dist/esm/scroll-scene/engine-source.d.ts.map +1 -0
  124. package/dist/esm/scroll-scene/engine-source.js +19 -0
  125. package/dist/esm/scroll-scene/engine-source.js.map +1 -0
  126. package/dist/esm/scroll-scene/helper-sources.generated.d.ts +9 -0
  127. package/dist/esm/scroll-scene/helper-sources.generated.d.ts.map +1 -0
  128. package/dist/esm/scroll-scene/helper-sources.generated.js +13 -0
  129. package/dist/esm/scroll-scene/helper-sources.generated.js.map +1 -0
  130. package/dist/esm/scroll-scene/index.d.ts +8 -0
  131. package/dist/esm/scroll-scene/index.d.ts.map +1 -0
  132. package/dist/esm/scroll-scene/index.js +8 -0
  133. package/dist/esm/scroll-scene/index.js.map +1 -0
  134. package/dist/esm/scroll-scene/moment.d.ts +21 -0
  135. package/dist/esm/scroll-scene/moment.d.ts.map +1 -0
  136. package/dist/esm/scroll-scene/moment.js +46 -0
  137. package/dist/esm/scroll-scene/moment.js.map +1 -0
  138. package/dist/esm/scroll-scene/points.d.ts +23 -0
  139. package/dist/esm/scroll-scene/points.d.ts.map +1 -0
  140. package/dist/esm/scroll-scene/points.js +45 -0
  141. package/dist/esm/scroll-scene/points.js.map +1 -0
  142. package/dist/esm/scroll-scene/unclip.d.ts +15 -0
  143. package/dist/esm/scroll-scene/unclip.d.ts.map +1 -0
  144. package/dist/esm/scroll-scene/unclip.js +40 -0
  145. package/dist/esm/scroll-scene/unclip.js.map +1 -0
  146. package/dist/esm/state-bindings/index.d.ts +74 -0
  147. package/dist/esm/state-bindings/index.d.ts.map +1 -0
  148. package/dist/esm/state-bindings/index.js +176 -0
  149. package/dist/esm/state-bindings/index.js.map +1 -0
  150. package/dist/esm/tsconfig.tsbuildinfo +1 -1
  151. package/package.json +3 -3
  152. package/src/index.ts +8 -0
  153. package/src/motion-runtime/index.ts +2 -0
  154. package/src/motion-runtime/motion-engine-source.ts +289 -0
  155. package/src/motion-runtime/scroll-video-engine-source.ts +591 -0
  156. package/src/page-transition/index.ts +4 -0
  157. package/src/page-transition/morph-source.ts +86 -0
  158. package/src/page-transition/variant-sources.generated.ts +14 -0
  159. package/src/page-transition/variants.ts +407 -0
  160. package/src/page-transition/view-transition-css.ts +237 -0
  161. package/src/scroll-scene/chapter-index.ts +25 -0
  162. package/src/scroll-scene/controller-source.ts +451 -0
  163. package/src/scroll-scene/engine-source.ts +327 -0
  164. package/src/scroll-scene/helper-sources.generated.ts +18 -0
  165. package/src/scroll-scene/index.ts +13 -0
  166. package/src/scroll-scene/moment.ts +64 -0
  167. package/src/scroll-scene/points.ts +46 -0
  168. package/src/scroll-scene/unclip.ts +44 -0
  169. package/src/state-bindings/index.ts +207 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"chapter-index.d.ts","sourceRoot":"","sources":["../../../src/scroll-scene/chapter-index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AACH,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM,CAW9E"}
@@ -0,0 +1,26 @@
1
+ /**
2
+ * Which chapter is ON STAGE at a scene progress: the chapter whose moment is
3
+ * the latest one the visitor has passed (a later chapter wins a tie), -1 before
4
+ * any moment is reached. Moments are read in document order but need not be
5
+ * monotone — an author's "Snap here" can put an early chapter's moment late.
6
+ * The published TqScrollScene announces every change of this index as a
7
+ * `tq-chapter-reached` DOM event on the chapter element — the hook the
8
+ * "A Chapter Is Reached" workflow trigger listens for.
9
+ *
10
+ * Plain JS inside: this function's SOURCE is injected into the generated
11
+ * runtime via toString(), so no TypeScript-only runtime constructs and no
12
+ * template literals.
13
+ */
14
+ export function activeChapterIndex(moments, progress) {
15
+ var active = -1;
16
+ var best = -Infinity;
17
+ for (var index = 0; index < moments.length; index++) {
18
+ var moment = moments[index];
19
+ if (moment <= progress + 0.000001 && moment >= best) {
20
+ best = moment;
21
+ active = index;
22
+ }
23
+ }
24
+ return active;
25
+ }
26
+ //# sourceMappingURL=chapter-index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"chapter-index.js","sourceRoot":"","sources":["../../../src/scroll-scene/chapter-index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AACH,MAAM,UAAU,kBAAkB,CAAC,OAAiB,EAAE,QAAgB;IACpE,IAAI,MAAM,GAAG,CAAC,CAAC,CAAA;IACf,IAAI,IAAI,GAAG,CAAC,QAAQ,CAAA;IACpB,KAAK,IAAI,KAAK,GAAG,CAAC,EAAE,KAAK,GAAG,OAAO,CAAC,MAAM,EAAE,KAAK,EAAE,EAAE;QACnD,IAAM,MAAM,GAAG,OAAO,CAAC,KAAK,CAAC,CAAA;QAC7B,IAAI,MAAM,IAAI,QAAQ,GAAG,QAAQ,IAAI,MAAM,IAAI,IAAI,EAAE;YACnD,IAAI,GAAG,MAAM,CAAA;YACb,MAAM,GAAG,KAAK,CAAA;SACf;KACF;IACD,OAAO,MAAM,CAAA;AACf,CAAC"}
@@ -0,0 +1,26 @@
1
+ /**
2
+ * The parts of a scroll scene's controller that are plain DOM JavaScript, as
3
+ * SOURCE TEXT, shared word for word by the Next export's TqScrollScene and the
4
+ * HTML export's vanilla controller. Each block talks to its surroundings through
5
+ * the same names in both hosts:
6
+ *
7
+ * trackRef, progressRef, chapterHelpersRef, chapterStateRef,
8
+ * scenePointStateRef, awaitedTagsRef, restackRef objects with a `current`
9
+ * pin, layout, chapterSnap, shouldReduceMotion the scene's settings
10
+ *
11
+ * In React those are refs and props; in the HTML runtime they are plain objects
12
+ * and constants of the same names. The engine (engine-source.ts) must be in
13
+ * scope. Bodies that were React effects keep their early `return undefined` and
14
+ * their returned cleanup, so a host wraps them in a function.
15
+ */
16
+ /** Scene points and chapters announced as DOM events, with the stamps late listeners read. */
17
+ export declare const announcementsSource: () => string;
18
+ /** Body of `restack`: every real grid item of a chapters stage goes into the same cell. */
19
+ export declare const restackBodySource: () => string;
20
+ /** Chapter geometry: where a chapter is on stage, which children are chapters, how to scroll there. */
21
+ export declare const chapterHelpersSource: () => string;
22
+ /** Body of the anchor-navigation effect: a hash that points into a pinned scene scrolls to that chapter. */
23
+ export declare const anchorNavigationBodySource: () => string;
24
+ /** Body of the gentle chapter-snap effect: a visitor who pauses mid-scene settles on the nearest chapter. */
25
+ export declare const gentleSnapBodySource: () => string;
26
+ //# sourceMappingURL=controller-source.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"controller-source.d.ts","sourceRoot":"","sources":["../../../src/scroll-scene/controller-source.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,8FAA8F;AAC9F,eAAO,MAAM,mBAAmB,QAC1B,MAwJF,CAAA;AAEJ,2FAA2F;AAC3F,eAAO,MAAM,iBAAiB,QACxB,MAsDwC,CAAA;AAE9C,uGAAuG;AACvG,eAAO,MAAM,oBAAoB,QAAO,MAgFpC,CAAA;AAEJ,4GAA4G;AAC5G,eAAO,MAAM,0BAA0B,QAAO,MA2ExC,CAAA;AAEN,6GAA6G;AAC7G,eAAO,MAAM,oBAAoB,QAAO,MA0DlC,CAAA"}
@@ -0,0 +1,26 @@
1
+ /**
2
+ * The parts of a scroll scene's controller that are plain DOM JavaScript, as
3
+ * SOURCE TEXT, shared word for word by the Next export's TqScrollScene and the
4
+ * HTML export's vanilla controller. Each block talks to its surroundings through
5
+ * the same names in both hosts:
6
+ *
7
+ * trackRef, progressRef, chapterHelpersRef, chapterStateRef,
8
+ * scenePointStateRef, awaitedTagsRef, restackRef objects with a `current`
9
+ * pin, layout, chapterSnap, shouldReduceMotion the scene's settings
10
+ *
11
+ * In React those are refs and props; in the HTML runtime they are plain objects
12
+ * and constants of the same names. The engine (engine-source.ts) must be in
13
+ * scope. Bodies that were React effects keep their early `return undefined` and
14
+ * their returned cleanup, so a host wraps them in a function.
15
+ */
16
+ /** Scene points and chapters announced as DOM events, with the stamps late listeners read. */
17
+ export var announcementsSource = function () { return " // Announces the points passed on the way down, in scroll order, one\n // microtask later (the ancestors' effects, where generated listeners attach,\n // have run by then). The stamp is written with the dispatch, never before it,\n // so a listener attaching in the same effect flush sees no stamp and gets the\n // event, while one attaching later reads the stamp and nothing is announced\n // twice. The first announcement measures from below the scene, so a page\n // that opens already past a point (an anchor link, a restored scroll) counts\n // it as passed. Going up announces nothing; the next way down announces again.\n const announceScenePoints = (p) => {\n const state = scenePointStateRef.current\n const from = state.last === null ? -1 : state.last\n state.last = p\n const passed = passedScenePoints(from, p)\n if (passed.length === 0) {\n return\n }\n state.pending = state.pending.concat(passed)\n if (state.scheduled) {\n return\n }\n state.scheduled = true\n Promise.resolve().then(() => {\n const current = scenePointStateRef.current\n current.scheduled = false\n const batch = current.pending\n current.pending = []\n const track = trackRef.current\n if (!track) {\n return\n }\n for (const key of batch) {\n if (scenePointRank(key) > scenePointRank(track.getAttribute(SCENE_POINT_ATTR) || '')) {\n track.setAttribute(SCENE_POINT_ATTR, key)\n }\n track.dispatchEvent(\n new CustomEvent(SCENE_POINT_EVENT, {\n bubbles: true,\n detail: { point: key, progress: current.last },\n })\n )\n }\n })\n }\n\n // The chapters in document order with the moment each one is on stage \u2014\n // the same moment chapter snap and anchor navigation aim at; a chapter\n // without a moment of its own takes the start of its even share.\n const chapterRecords = () => {\n const track = trackRef.current\n const helpers = chapterHelpersRef.current\n if (!track || !helpers) {\n return []\n }\n const chapters = helpers.chapterElements(track)\n return chapters.map((element, index) => {\n const moment = helpers.chapterProgress(element)\n return {\n element,\n moment:\n moment === null ? index / chapters.length : Math.min(1, Math.max(0, moment)),\n }\n })\n }\n\n // Announces chapters as the visitor passes their moments: every chapter\n // between the last announced one and the one now on stage gets its\n // tq-chapter-reached (bubbling) in travel order, so a jump past a chapter\n // still counts as reaching it. The current chapter carries\n // data-chapter-active / data-chapter-count for listeners that attach later.\n // Dispatch is deferred to a microtask: the ancestors' effects (where the\n // generated listeners attach) have run by then, and nothing is a frame late.\n const announceChapter = (p) => {\n const state = chapterStateRef.current\n if (state.records === null) {\n state.records = chapterRecords()\n state.moments = state.records.map((record) => record.moment)\n // A rebuilt list may hold NEW elements for the same chapters (a repeater\n // re-rendered): the stamp moves to the current chapter's new element\n // without announcing it again.\n const current = state.index >= 0 ? state.records[state.index] : null\n if (current && current.element !== state.element) {\n stampChapter(current.element, state.index + 1, state.records.length)\n } else if (!current && state.index >= 0) {\n state.index = -1\n state.element = null\n }\n }\n const direction = p >= state.lastProgress ? 'down' : 'up'\n state.lastProgress = p\n if (state.moments.length === 0 || !state.onScreen) {\n return\n }\n const next = activeChapterIndex(state.moments, p)\n if (next === state.index) {\n return\n }\n const from = state.index\n state.index = next\n if (next === -1) {\n stampChapter(null, 0, 0)\n return\n }\n const passed = []\n if (from < next) {\n for (let index = from + 1; index <= next; index++) {\n passed.push(index)\n }\n } else {\n for (let index = from - 1; index >= next; index--) {\n passed.push(index)\n }\n }\n stampChapter(state.records[next].element, next + 1, state.records.length)\n state.pending = { passed, progress: p, direction }\n Promise.resolve().then(() => {\n const batch = chapterStateRef.current.pending\n if (!batch) {\n return\n }\n chapterStateRef.current.pending = null\n const records = chapterStateRef.current.records || []\n for (const index of batch.passed) {\n const record = records[index]\n if (!record) {\n continue\n }\n record.element.dispatchEvent(\n new CustomEvent(CHAPTER_REACHED_EVENT, {\n bubbles: true,\n detail: {\n chapterIndex: index + 1,\n chapterCount: records.length,\n progress: batch.progress,\n direction: batch.direction,\n },\n })\n )\n }\n })\n }\n\n const stampChapter = (element, chapterIndex, chapterCount) => {\n const state = chapterStateRef.current\n if (state.element && state.element !== element) {\n state.element.removeAttribute(CHAPTER_ACTIVE_ATTR)\n state.element.removeAttribute(CHAPTER_COUNT_ATTR)\n }\n state.element = element\n if (element) {\n element.setAttribute(CHAPTER_ACTIVE_ATTR, String(chapterIndex))\n element.setAttribute(CHAPTER_COUNT_ATTR, String(chapterCount))\n }\n }"; };
18
+ /** Body of `restack`: every real grid item of a chapters stage goes into the same cell. */
19
+ export var restackBodySource = function () { return " if (layout !== 'chapters' || !trackRef.current) {\n return\n }\n const stage = trackRef.current.querySelector(':scope > [data-scene-stage]')\n if (!stage) {\n return\n }\n const place = (el) => {\n // Duck-typed, never instanceof \u2014 mirrors the editor runtime, where\n // canvas elements belong to another realm and instanceof always fails.\n if (!el || el.nodeType !== 1 || el.tagName === 'STYLE') {\n return\n }\n if (!el.style || typeof el.style.removeProperty !== 'function') {\n return\n }\n let display = ''\n try {\n display = getComputedStyle(el).display\n } catch (e) {\n // detached node \u2014 skip\n }\n if (display === 'contents') {\n // A pre-upgrade pass may have pinned this wrapper as a box \u2014 clean up.\n if (el.style.gridArea) {\n el.style.removeProperty('grid-area')\n }\n if (el.shadowRoot) {\n Array.from(el.shadowRoot.children).forEach(place)\n return\n }\n if (typeof el.assignedElements === 'function') {\n const assigned = el.assignedElements({ flatten: true })\n ;(assigned.length > 0 ? assigned : Array.from(el.children)).forEach(place)\n return\n }\n Array.from(el.children).forEach(place)\n return\n }\n const tag = el.tagName.toLowerCase()\n if (\n tag.includes('-') &&\n typeof customElements !== 'undefined' &&\n !customElements.get(tag) &&\n !awaitedTagsRef.current.has(tag)\n ) {\n awaitedTagsRef.current.add(tag)\n customElements\n .whenDefined(tag)\n .then(() => restackRef.current && restackRef.current())\n .catch(() => undefined)\n }\n el.style.gridArea = '1 / 1'\n }\n Array.from(stage.children).forEach(place)"; };
20
+ /** Chapter geometry: where a chapter is on stage, which children are chapters, how to scroll there. */
21
+ export var chapterHelpersSource = function () { return " if (chapterHelpersRef.current === null) {\n const chapterProgress = (chapterRoot) => {\n // 1. The author's own snap point (\"Snap here\" on the timeline) wins.\n const override = parseFloat(chapterRoot.getAttribute('data-chapter-moment') || '')\n if (Number.isFinite(override)) {\n return Math.min(1, Math.max(0, override))\n }\n // 2. The settled moment \u2014 everything arrived, nothing leaving \u2014 read\n // from the root's and every descendant's lanes.\n const boundLanes = []\n const boundElements = [chapterRoot].concat(\n Array.from(chapterRoot.querySelectorAll('[' + SCROLL_BIND_ATTR + ']'))\n )\n for (const element of boundElements) {\n const lanes = parseScrollBind(element.getAttribute(SCROLL_BIND_ATTR))\n for (const lane of lanes) {\n boundLanes.push(lane)\n }\n }\n const settled = settledMomentForLanes(boundLanes)\n if (settled !== null) {\n return settled\n }\n // 3. Through-motion only (a crossing line): the window's middle.\n const recorded = String(chapterRoot.getAttribute('data-chapter-window') || '')\n .split(',')\n .map((part) => parseFloat(part))\n if (recorded.length === 2 && recorded.every((value) => Number.isFinite(value))) {\n return (recorded[0] + recorded[1]) / 2\n }\n const lanes = parseScrollBind(chapterRoot.getAttribute(SCROLL_BIND_ATTR))\n const stops = lanes.flatMap((lane) => lane.at)\n if (stops.length === 0) {\n return null\n }\n return (Math.min.apply(null, stops) + Math.max.apply(null, stops)) / 2\n }\n chapterHelpersRef.current = {\n stageOf: (track) => track.querySelector(':scope > [data-scene-stage]'),\n chapterProgress,\n // The chapters: the stage's children when the scene pins, the track's own\n // children when it does not. Never the style tag, never a backdrop: the\n // background video, a bare media child (img / video / picture) or any\n // child marked data-scene-backdrop is the scene's background \u2014 it sits\n // under the chapters and owns no story window.\n chapterElements: (track) => {\n const stage = chapterHelpersRef.current.stageOf(track)\n const host = stage || track\n return Array.from(host.children).filter(\n (child) =>\n !!child.getAttribute &&\n child.tagName !== 'STYLE' &&\n child.tagName !== 'IMG' &&\n child.tagName !== 'VIDEO' &&\n child.tagName !== 'PICTURE' &&\n !child.hasAttribute('data-scroll-video') &&\n !child.hasAttribute('data-scene-backdrop') &&\n !child.hasAttribute('data-scene-stage')\n )\n },\n chapterMoments: (track) => {\n const moments = []\n for (const child of chapterHelpersRef.current.chapterElements(track)) {\n const progress = chapterProgress(child)\n if (progress !== null) {\n moments.push(Math.min(1, Math.max(0, progress)))\n }\n }\n return moments.sort((a, b) => a - b)\n },\n scrollToProgress: (track, progress, behavior) => {\n const rect = track.getBoundingClientRect()\n const trackTop = rect.top + window.scrollY\n const travel = Math.max(0, track.offsetHeight - window.innerHeight)\n window.scrollTo({\n top: trackTop + Math.min(1, Math.max(0, progress)) * travel,\n behavior,\n })\n },\n }\n }"; };
22
+ /** Body of the anchor-navigation effect: a hash that points into a pinned scene scrolls to that chapter. */
23
+ export var anchorNavigationBodySource = function () { return " const track = trackRef.current\n if (!track || !pin || typeof window === 'undefined') {\n return undefined\n }\n const helpers = chapterHelpersRef.current\n const chapterRootFor = (target) => {\n const stage = helpers.stageOf(track)\n if (!stage || !stage.contains(target)) {\n return null\n }\n let current = target\n while (current && current.parentElement !== stage) {\n current = current.parentElement\n }\n return current\n }\n const scrollToChapter = (id, behavior) => {\n const target = id ? document.getElementById(id) : null\n const chapterRoot = target ? chapterRootFor(target) : null\n if (!chapterRoot) {\n return false\n }\n const progress = helpers.chapterProgress(chapterRoot)\n if (progress === null) {\n return false\n }\n helpers.scrollToProgress(track, progress, behavior)\n return true\n }\n const onClick = (event) => {\n if (event.defaultPrevented || event.button !== 0) {\n return\n }\n if (event.metaKey || event.ctrlKey || event.shiftKey || event.altKey) {\n return\n }\n const anchor = event.target && event.target.closest ? event.target.closest('a[href]') : null\n if (!anchor) {\n return\n }\n const href = anchor.getAttribute('href') || ''\n const hashIndex = href.indexOf('#')\n if (hashIndex === -1) {\n return\n }\n const beforeHash = href.slice(0, hashIndex)\n if (beforeHash && beforeHash !== window.location.pathname) {\n return\n }\n const id = decodeURIComponent(href.slice(hashIndex + 1))\n if (scrollToChapter(id, 'smooth')) {\n event.preventDefault()\n try {\n window.history.pushState(null, '', '#' + id)\n } catch (e) {\n // history can refuse in sandboxed frames; the scroll already happened\n }\n }\n }\n const onHashChange = () => {\n scrollToChapter(decodeURIComponent(window.location.hash.slice(1)), 'smooth')\n }\n document.addEventListener('click', onClick, true)\n window.addEventListener('hashchange', onHashChange)\n let settleTimer = 0\n const initialId = decodeURIComponent(window.location.hash.slice(1))\n if (initialId) {\n window.requestAnimationFrame(() => scrollToChapter(initialId, 'auto'))\n // late images/fonts shift the track's document position \u2014 one correction\n settleTimer = window.setTimeout(() => scrollToChapter(initialId, 'auto'), 350)\n }\n return () => {\n document.removeEventListener('click', onClick, true)\n window.removeEventListener('hashchange', onHashChange)\n window.clearTimeout(settleTimer)\n }"; };
24
+ /** Body of the gentle chapter-snap effect: a visitor who pauses mid-scene settles on the nearest chapter. */
25
+ export var gentleSnapBodySource = function () { return " const track = trackRef.current\n if (!track || !pin || chapterSnap !== 'gentle' || typeof window === 'undefined') {\n return undefined\n }\n if (shouldReduceMotion) {\n return undefined\n }\n const helpers = chapterHelpersRef.current\n let settleTimer = 0\n let suppressUntil = 0\n let lastProgress = progressRef.current\n let direction = 0\n const settle = () => {\n if (Date.now() < suppressUntil) {\n return\n }\n const progress = progressRef.current\n if (progress <= 0.001 || progress >= 0.999) {\n return\n }\n const moments = helpers.chapterMoments(track)\n if (moments.length === 0) {\n return\n }\n // Settle in the direction the visitor was travelling: a short scroll\n // forward lands on the next chapter, never back on the one just left.\n const ahead = moments.filter((moment) =>\n direction > 0 ? moment >= progress - 0.02 : direction < 0 ? moment <= progress + 0.02 : true\n )\n const candidates = ahead.length > 0 ? ahead : moments\n let nearest = candidates[0]\n for (const moment of candidates) {\n if (Math.abs(moment - progress) < Math.abs(nearest - progress)) {\n nearest = moment\n }\n }\n if (Math.abs(nearest - progress) < 0.005) {\n return\n }\n suppressUntil = Date.now() + 900\n helpers.scrollToProgress(track, nearest, 'smooth')\n }\n const onScroll = () => {\n window.clearTimeout(settleTimer)\n const progress = progressRef.current\n if (progress !== lastProgress) {\n direction = progress > lastProgress ? 1 : -1\n lastProgress = progress\n }\n if (Date.now() < suppressUntil) {\n return\n }\n settleTimer = window.setTimeout(settle, 180)\n }\n window.addEventListener('scroll', onScroll, { passive: true })\n return () => {\n window.removeEventListener('scroll', onScroll)\n window.clearTimeout(settleTimer)\n }"; };
26
+ //# sourceMappingURL=controller-source.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"controller-source.js","sourceRoot":"","sources":["../../../src/scroll-scene/controller-source.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,8FAA8F;AAC9F,MAAM,CAAC,IAAM,mBAAmB,GAC9B,cAAc,OAAA,ynLAwJZ,EAxJY,CAwJZ,CAAA;AAEJ,2FAA2F;AAC3F,MAAM,CAAC,IAAM,iBAAiB,GAC5B,cAAc,OAAA,u2DAsD8B,EAtD9B,CAsD8B,CAAA;AAE9C,uGAAuG;AACvG,MAAM,CAAC,IAAM,oBAAoB,GAAG,cAAc,OAAA,i+GAgF9C,EAhF8C,CAgF9C,CAAA;AAEJ,4GAA4G;AAC5G,MAAM,CAAC,IAAM,0BAA0B,GAAG,cAAc,OAAA,ysFA2ElD,EA3EkD,CA2ElD,CAAA;AAEN,6GAA6G;AAC7G,MAAM,CAAC,IAAM,oBAAoB,GAAG,cAAc,OAAA,g/DA0D5C,EA1D4C,CA0D5C,CAAA"}
@@ -0,0 +1,2 @@
1
+ export declare const scrollSceneEngineSource: () => string;
2
+ //# sourceMappingURL=engine-source.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"engine-source.d.ts","sourceRoot":"","sources":["../../../src/scroll-scene/engine-source.ts"],"names":[],"mappings":"AAkBA,eAAO,MAAM,uBAAuB,QAAO,MAoTzC,CAAA"}
@@ -0,0 +1,19 @@
1
+ /**
2
+ * The scroll-scene lane engine as SOURCE TEXT: the constants, the lane presets
3
+ * and the functions that parse a `data-scroll-bind`, read a lane at a progress
4
+ * and write it onto an element. It is plain DOM JavaScript with no framework in
5
+ * it, which is why two runtimes can share it word for word:
6
+ *
7
+ * - the Next export wraps it in the TqScrollScene React component, where
8
+ * framer-motion supplies the scroll progress;
9
+ * - the HTML export wraps it in a small vanilla controller, where a scroll
10
+ * listener supplies the same progress.
11
+ *
12
+ * One copy means a new lane property or preset reaches both exports at once.
13
+ * The text mirrors the canvas renderer's scroll-scene-lanes module, so the
14
+ * canvas, the Next site and the HTML site move identically. (No backticks in
15
+ * the engine's own comments: it is a template literal.)
16
+ */
17
+ import { SCROLL_SCENE_HELPER_SOURCES } from './helper-sources.generated';
18
+ export var scrollSceneEngineSource = function () { return "const SCROLL_BIND_ATTR = 'data-scroll-bind'\n// A chapter coming on stage is announced on the chapter element (bubbling), so\n// a workflow trigger bound to the chapter can listen without knowing the scene.\nconst CHAPTER_REACHED_EVENT = 'tq-chapter-reached'\nconst CHAPTER_ACTIVE_ATTR = 'data-chapter-active'\nconst CHAPTER_COUNT_ATTR = 'data-chapter-count'\n// Scrolling DOWN past a quarter / halfway / three quarters / the end of the\n// scene is announced on the track (the element with the scene's id), bubbling;\n// the furthest point passed so far is stamped for listeners that attach later.\nconst SCENE_POINT_EVENT = 'tq-scene-point-passed'\nconst SCENE_POINT_ATTR = 'data-scene-point'\n\nconst LANE_PROPS = [\n 'x',\n 'y',\n 'scale',\n 'rotate',\n 'rotate-x',\n 'rotate-y',\n 'opacity',\n 'blur',\n 'grayscale',\n 'saturate',\n 'brightness',\n 'clip',\n 'clip-y',\n 'count',\n]\n\n// Mirrors SCROLL_COUNT_ATTR / SCROLL_COUNT_CSS in the editor's lane contract.\nconst COUNT_ATTR = 'data-scroll-count'\nconst HIDDEN_ATTR = 'data-scene-hidden'\nconst HIDDEN_CSS =\n '[data-scene-hidden], [data-scene-hidden] * { pointer-events: none !important; }'\nconst COUNT_CSS =\n '[data-scroll-count]::before { counter-reset: tq-count var(--tq-count, 0); content: counter(tq-count); }'\nconst clampPercent = (value) => Math.min(100, Math.max(0, Math.round(value * 100) / 100))\n\nconst LANE_PRESETS = {\n 'depth-1': [{ prop: 'y', at: [0, 1], values: [40, -40] }],\n 'depth-2': [{ prop: 'y', at: [0, 1], values: [80, -80] }],\n 'depth-3': [{ prop: 'y', at: [0, 1], values: [140, -140] }],\n 'fade-window': [{ prop: 'opacity', at: [0, 0.15, 0.85, 1], values: [0, 1, 1, 0] }],\n 'rail-x': [{ prop: 'x', at: [0, 1], values: [0, -100], unit: '%' }],\n 'zoom-through': [{ prop: 'scale', at: [0, 1], values: [0.85, 1.1] }],\n 'unblur-in': [{ prop: 'blur', at: [0, 0.3], values: [10, 0] }],\n 'rise-in': [\n { prop: 'y', at: [0, 0.35], values: [70, 0] },\n { prop: 'opacity', at: [0, 0.3], values: [0, 1] },\n ],\n 'ghost-out': [\n { prop: 'opacity', at: [0.7, 1], values: [1, 0] },\n { prop: 'blur', at: [0.7, 1], values: [0, 8] },\n ],\n 'color-in': [{ prop: 'grayscale', at: [0, 0.45], values: [1, 0] }],\n 'sun-up': [{ prop: 'brightness', at: [0, 0.4], values: [0.35, 1] }],\n 'fade-to-mono': [\n { prop: 'grayscale', at: [0.6, 1], values: [0, 1] },\n { prop: 'saturate', at: [0.6, 1], values: [1, 0.6] },\n ],\n 'crash-zoom': [\n { prop: 'scale', at: [0, 0.25], values: [1.6, 1] },\n { prop: 'opacity', at: [0, 0.15], values: [0, 1] },\n ],\n 'tilt-reveal': [\n { prop: 'rotate-x', at: [0, 0.4], values: [35, 0] },\n { prop: 'opacity', at: [0, 0.3], values: [0, 1] },\n ],\n 'spin-in': [\n { prop: 'rotate', at: [0, 0.35], values: [-90, 0] },\n { prop: 'opacity', at: [0, 0.25], values: [0, 1] },\n ],\n breathe: [{ prop: 'scale', at: [0, 0.5, 1], values: [0.98, 1.03, 0.98] }],\n}\n\nconst isValidLane = (lane) => {\n if (!lane || typeof lane !== 'object' || !LANE_PROPS.includes(lane.prop)) {\n return false\n }\n if (!Array.isArray(lane.at) || !Array.isArray(lane.values)) {\n return false\n }\n if (lane.at.length < 2 || lane.at.length !== lane.values.length) {\n return false\n }\n const numbers = (list) => list.every((entry) => typeof entry === 'number' && isFinite(entry))\n if (!numbers(lane.at) || !numbers(lane.values)) {\n return false\n }\n for (let index = 1; index < lane.at.length; index++) {\n if (lane.at[index] < lane.at[index - 1]) {\n return false\n }\n }\n return lane.unit === undefined || lane.unit === 'px' || lane.unit === '%' || lane.unit === 'vw'\n}\n\n".concat(SCROLL_SCENE_HELPER_SOURCES.settledMomentForLanes, "\n\n").concat(SCROLL_SCENE_HELPER_SOURCES.activeChapterIndex, "\n\n").concat(SCROLL_SCENE_HELPER_SOURCES.scenePointList, "\n\n").concat(SCROLL_SCENE_HELPER_SOURCES.passedScenePoints, "\n\n").concat(SCROLL_SCENE_HELPER_SOURCES.scenePointRank, "\n\n").concat(SCROLL_SCENE_HELPER_SOURCES.unclipStickyAncestors, "\n\nconst parseScrollBind = (value) => {\n const raw = String(value || '').trim()\n if (!raw) {\n return []\n }\n if (LANE_PRESETS[raw]) {\n return LANE_PRESETS[raw].map((lane) => ({ ...lane }))\n }\n if (!raw.startsWith('[')) {\n return []\n }\n try {\n const parsed = JSON.parse(raw)\n return Array.isArray(parsed) ? parsed.filter(isValidLane) : []\n } catch (e) {\n return []\n }\n}\n\nconst laneValueAt = (lane, p) => {\n const at = lane.at\n const values = lane.values\n if (p <= at[0]) {\n return values[0]\n }\n if (p >= at[at.length - 1]) {\n return values[values.length - 1]\n }\n for (let index = 1; index < at.length; index++) {\n if (p <= at[index]) {\n const span = at[index] - at[index - 1]\n const local = span === 0 ? 1 : (p - at[index - 1]) / span\n return values[index - 1] + (values[index] - values[index - 1]) * local\n }\n }\n return values[values.length - 1]\n}\n\nconst FILTER_PROP_ORDER = ['blur', 'grayscale', 'saturate', 'brightness']\n\n// Motion lanes write the INDIVIDUAL transform properties (translate / scale /\n// rotate) and never the transform property itself: the browser composes them\n// with whatever the author put in transform (a translateX(-50%) centering, a\n// tilt), so the scene never clobbers the user's own layout. 3D lanes use the\n// axis form of rotate; the stage supplies the vanishing point. Mirrors the\n// canvas. (No backticks in this file's comments \u2014 it is a template literal.)\nconst applyLanesAt = (element, lanes, p) => {\n const filterByProp = {}\n let translateX\n let translateY\n let rotate\n let scale\n for (const lane of lanes) {\n const value = laneValueAt(lane, p)\n switch (lane.prop) {\n case 'x':\n translateX = value + (lane.unit || 'px')\n break\n case 'y':\n translateY = value + (lane.unit || 'px')\n break\n case 'scale':\n scale = String(value)\n break\n case 'rotate':\n rotate = rotate === undefined ? value + 'deg' : rotate\n break\n case 'rotate-x':\n rotate = 'x ' + value + 'deg'\n break\n case 'rotate-y':\n rotate = 'y ' + value + 'deg'\n break\n case 'opacity':\n element.style.opacity = String(value)\n // A faded-out element must not swallow clicks (stacked chapters: the\n // invisible top one would take every tap meant for the visible story).\n // Attribute + CSS rule, never inline pointer-events, so lanes cannot\n // overwrite a pointer-events the author set. Mirrors the editor.\n if (value <= 0.02) {\n element.setAttribute(HIDDEN_ATTR, '')\n } else {\n element.removeAttribute(HIDDEN_ATTR)\n }\n break\n case 'blur':\n filterByProp.blur = 'blur(' + value + 'px)'\n break\n case 'grayscale':\n filterByProp.grayscale = 'grayscale(' + value + ')'\n break\n case 'saturate':\n filterByProp.saturate = 'saturate(' + value + ')'\n break\n case 'brightness':\n filterByProp.brightness = 'brightness(' + value + ')'\n break\n case 'clip':\n element.style.clipPath = 'inset(0 ' + clampPercent(100 - value) + '% 0 0)'\n break\n case 'clip-y':\n element.style.clipPath = 'inset(0 0 ' + clampPercent(100 - value) + '% 0)'\n break\n case 'count':\n element.style.setProperty('--tq-count', String(Math.round(value)))\n if (!element.hasAttribute(COUNT_ATTR)) {\n element.setAttribute(COUNT_ATTR, '')\n }\n break\n }\n }\n if (translateX !== undefined || translateY !== undefined) {\n element.style.translate = (translateX || '0px') + ' ' + (translateY || '0px')\n }\n if (scale !== undefined) {\n element.style.scale = scale\n }\n if (rotate !== undefined) {\n element.style.rotate = rotate\n }\n const filterParts = FILTER_PROP_ORDER.map((prop) => filterByProp[prop]).filter(Boolean)\n if (filterParts.length > 0) {\n element.style.filter = filterParts.join(' ')\n }\n}\n\n// A scene set to keep the story for visitors who ask for less motion\n// (scene-reduced-motion \"story\"): the scroll still drives the scene, chapters\n// still come and go and every text still appears in turn, but nothing moves.\n// Slides, zooms, rotations and wipes are dropped, so each element stays where\n// the layout puts it; fades and filters still follow the scroll; a counting\n// number shows the figure it counts to. Mirrors the editor's lane contract.\nconst MOVEMENT_PROPS = ['x', 'y', 'scale', 'rotate', 'rotate-x', 'rotate-y', 'clip', 'clip-y']\n\nconst storyLanes = (lanes) =>\n lanes\n .filter((lane) => !MOVEMENT_PROPS.includes(lane.prop))\n .map((lane) => {\n if (lane.prop !== 'count') {\n return lane\n }\n const figure = lane.values[lane.values.length - 1]\n return { prop: 'count', at: [0, 1], values: [figure, figure] }\n })\n\n// What a moving lane painted, taken off again when the scene switches to the\n// story without movement while the page is open.\nconst clearMovement = (element, lanes) => {\n for (const lane of lanes) {\n if (lane.prop === 'x' || lane.prop === 'y') {\n element.style.translate = ''\n } else if (lane.prop === 'scale') {\n element.style.scale = ''\n } else if (lane.prop === 'rotate' || lane.prop === 'rotate-x' || lane.prop === 'rotate-y') {\n element.style.rotate = ''\n } else if (lane.prop === 'clip' || lane.prop === 'clip-y') {\n element.style.clipPath = ''\n }\n }\n}\n\n// A row wider than the stage that travelled sideways with the scroll (a\n// rail) would show only its first cards once the movement is dropped, so it\n// becomes a row the visitor swipes: every card stays reachable.\nconst SWIPE_ATTR = 'data-scene-swipe'\nconst letRowsSwipe = (bound, stage) => {\n if (!stage) {\n return\n }\n const stageWidth = stage.getBoundingClientRect().width\n for (const child of bound) {\n const travels = child.lanes.some((lane) => lane.prop === 'x')\n if (!travels || child.element.getBoundingClientRect().width <= stageWidth + 1) {\n continue\n }\n child.element.style.maxWidth = '100%'\n child.element.style.overflowX = 'auto'\n child.element.setAttribute(SWIPE_ATTR, '')\n }\n}\n\nconst collectBound = (track) => {\n const bound = []\n track.querySelectorAll('[' + SCROLL_BIND_ATTR + ']').forEach((element) => {\n const lanes = parseScrollBind(element.getAttribute(SCROLL_BIND_ATTR))\n if (lanes.length > 0) {\n bound.push({ element, lanes })\n }\n })\n return bound\n}\n\nconst normalizeSceneLength = (value) => {\n const match = /^(\\d{2,4})vh$/.exec(String(value || '').trim())\n if (!match) {\n return '300vh'\n }\n // Hard safety bound only \u2014 the editor owns the story-sized soft cap.\n return Math.min(4000, Math.max(100, Number(match[1]))) + 'vh'\n}"); };
19
+ //# sourceMappingURL=engine-source.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"engine-source.js","sourceRoot":"","sources":["../../../src/scroll-scene/engine-source.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AACH,OAAO,EAAE,2BAA2B,EAAE,MAAM,4BAA4B,CAAA;AAExE,MAAM,CAAC,IAAM,uBAAuB,GAAG,cAAc,OAAA,6mHAiGnD,2BAA2B,CAAC,qBAAqB,iBAEjD,2BAA2B,CAAC,kBAAkB,iBAE9C,2BAA2B,CAAC,cAAc,iBAE1C,2BAA2B,CAAC,iBAAiB,iBAE7C,2BAA2B,CAAC,cAAc,iBAE1C,2BAA2B,CAAC,qBAAqB,u0NAyMjD,EApTmD,CAoTnD,CAAA"}
@@ -0,0 +1,9 @@
1
+ export declare const SCROLL_SCENE_HELPER_SOURCES: {
2
+ settledMomentForLanes: string;
3
+ activeChapterIndex: string;
4
+ scenePointList: string;
5
+ passedScenePoints: string;
6
+ scenePointRank: string;
7
+ unclipStickyAncestors: string;
8
+ };
9
+ //# sourceMappingURL=helper-sources.generated.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"helper-sources.generated.d.ts","sourceRoot":"","sources":["../../../src/scroll-scene/helper-sources.generated.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,2BAA2B;;;;;;;CAavC,CAAA"}
@@ -0,0 +1,13 @@
1
+ // Generated by scripts/function-sources.js from moment.ts, chapter-index.ts, points.ts, unclip.ts. Do not edit:
2
+ // `node scripts/function-sources.js` rewrites it, and its drift test fails until it is current.
3
+ /* tslint:disable */
4
+ /* eslint-disable */
5
+ export var SCROLL_SCENE_HELPER_SOURCES = {
6
+ settledMomentForLanes: 'function settledMomentForLanes(lanes) {\n var arrive = -Infinity;\n var leave = Infinity;\n var lastStop = -Infinity;\n var found = false;\n for (var _i = 0, lanes_1 = lanes; _i < lanes_1.length; _i++) {\n var lane = lanes_1[_i];\n if (lane.at.length < 3) {\n continue;\n }\n var settledAt = null;\n for (var index = 1; index < lane.values.length - 1; index++) {\n if (lane.values[index] === lane.values[index + 1] && lane.values[index] !== lane.values[0]) {\n settledAt = index;\n break;\n }\n }\n if (settledAt === null && lane.values[0] === lane.values[1]) {\n settledAt = 0;\n }\n if (settledAt === null) {\n continue;\n }\n found = true;\n arrive = Math.max(arrive, lane.at[settledAt]);\n lastStop = Math.max(lastStop, lane.at[lane.at.length - 1]);\n var settledValue = lane.values[settledAt];\n for (var index = settledAt + 1; index < lane.values.length; index++) {\n if (lane.values[index] !== settledValue) {\n leave = Math.min(leave, lane.at[index - 1]);\n break;\n }\n }\n }\n if (!found) {\n return null;\n }\n if (leave === Infinity) {\n leave = lastStop;\n }\n if (leave < arrive) {\n return null;\n }\n return Math.round(((arrive + leave) / 2) * 10000) / 10000;\n}',
7
+ activeChapterIndex: 'function activeChapterIndex(moments, progress) {\n var active = -1;\n var best = -Infinity;\n for (var index = 0; index < moments.length; index++) {\n var moment = moments[index];\n if (moment <= progress + 0.000001 && moment >= best) {\n best = moment;\n active = index;\n }\n }\n return active;\n}',
8
+ scenePointList: "function scenePointList() {\n return [\n { key: 'quarter', at: 0.25 },\n { key: 'half', at: 0.5 },\n { key: 'three-quarters', at: 0.75 },\n { key: 'end', at: 1 },\n ];\n}",
9
+ passedScenePoints: 'function passedScenePoints(from, to) {\n var passed = [];\n var points = scenePointList();\n for (var index = 0; index < points.length; index++) {\n var point = points[index];\n if (point.at > from + 0.000001 && point.at <= to + 0.000001) {\n passed.push(point.key);\n }\n }\n return passed;\n}',
10
+ scenePointRank: 'function scenePointRank(key) {\n var points = scenePointList();\n for (var index = 0; index < points.length; index++) {\n if (points[index].key === key) {\n return index + 1;\n }\n }\n return 0;\n}',
11
+ unclipStickyAncestors: "function unclipStickyAncestors(track, getStyle) {\n var unclipped = [];\n var element = track.parentElement;\n while (element && element !== element.ownerDocument.documentElement) {\n var style = getStyle(element);\n var both = style.overflow === 'hidden';\n var axes = [];\n if (both || style.overflowX === 'hidden') {\n axes.push('x');\n }\n if (both || style.overflowY === 'hidden') {\n axes.push('y');\n }\n if (axes.length > 0) {\n var host = element;\n for (var i = 0; i < axes.length; i++) {\n host.style.setProperty('overflow-' + axes[i], 'clip');\n }\n host.setAttribute('data-scene-unclipped', axes.join(''));\n unclipped.push(host.tagName.toLowerCase() +\n (host.className ? '.' + String(host.className).split(' ')[0] : ''));\n }\n element = element.parentElement;\n }\n return unclipped;\n}",
12
+ };
13
+ //# sourceMappingURL=helper-sources.generated.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"helper-sources.generated.js","sourceRoot":"","sources":["../../../src/scroll-scene/helper-sources.generated.ts"],"names":[],"mappings":"AAAA,gHAAgH;AAChH,gGAAgG;AAChG,oBAAoB;AACpB,oBAAoB;AACpB,MAAM,CAAC,IAAM,2BAA2B,GAAG;IACzC,qBAAqB,EACnB,i9CAAi9C;IACn9C,kBAAkB,EAChB,uWAAuW;IACzW,cAAc,EACZ,8MAA8M;IAChN,iBAAiB,EACf,uVAAuV;IACzV,cAAc,EACZ,4OAA4O;IAC9O,qBAAqB,EACnB,o+BAAo+B;CACv+B,CAAA"}
@@ -0,0 +1,8 @@
1
+ export { settledMomentForLanes, MomentLane } from './moment';
2
+ export { activeChapterIndex } from './chapter-index';
3
+ export { passedScenePoints, scenePointList, scenePointRank } from './points';
4
+ export { unclipStickyAncestors } from './unclip';
5
+ export { SCROLL_SCENE_HELPER_SOURCES } from './helper-sources.generated';
6
+ export { scrollSceneEngineSource as engineSource } from './engine-source';
7
+ export { announcementsSource, restackBodySource, chapterHelpersSource, anchorNavigationBodySource, gentleSnapBodySource, } from './controller-source';
8
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/scroll-scene/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,UAAU,EAAE,MAAM,UAAU,CAAA;AAC5D,OAAO,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAA;AACpD,OAAO,EAAE,iBAAiB,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,UAAU,CAAA;AAC5E,OAAO,EAAE,qBAAqB,EAAE,MAAM,UAAU,CAAA;AAChD,OAAO,EAAE,2BAA2B,EAAE,MAAM,4BAA4B,CAAA;AACxE,OAAO,EAAE,uBAAuB,IAAI,YAAY,EAAE,MAAM,iBAAiB,CAAA;AACzE,OAAO,EACL,mBAAmB,EACnB,iBAAiB,EACjB,oBAAoB,EACpB,0BAA0B,EAC1B,oBAAoB,GACrB,MAAM,qBAAqB,CAAA"}
@@ -0,0 +1,8 @@
1
+ export { settledMomentForLanes } from './moment';
2
+ export { activeChapterIndex } from './chapter-index';
3
+ export { passedScenePoints, scenePointList, scenePointRank } from './points';
4
+ export { unclipStickyAncestors } from './unclip';
5
+ export { SCROLL_SCENE_HELPER_SOURCES } from './helper-sources.generated';
6
+ export { scrollSceneEngineSource as engineSource } from './engine-source';
7
+ export { announcementsSource, restackBodySource, chapterHelpersSource, anchorNavigationBodySource, gentleSnapBodySource, } from './controller-source';
8
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/scroll-scene/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAc,MAAM,UAAU,CAAA;AAC5D,OAAO,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAA;AACpD,OAAO,EAAE,iBAAiB,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,UAAU,CAAA;AAC5E,OAAO,EAAE,qBAAqB,EAAE,MAAM,UAAU,CAAA;AAChD,OAAO,EAAE,2BAA2B,EAAE,MAAM,4BAA4B,CAAA;AACxE,OAAO,EAAE,uBAAuB,IAAI,YAAY,EAAE,MAAM,iBAAiB,CAAA;AACzE,OAAO,EACL,mBAAmB,EACnB,iBAAiB,EACjB,oBAAoB,EACpB,0BAA0B,EAC1B,oBAAoB,GACrB,MAAM,qBAAqB,CAAA"}
@@ -0,0 +1,21 @@
1
+ /**
2
+ * The progress where a chapter is fully ON STAGE — every lane has arrived
3
+ * and none has started leaving — the centre of that settled span, in the
4
+ * lanes' own (absolute) progress space. The gentle snap and anchor
5
+ * navigation aim here instead of the window's midpoint, which catches the
6
+ * last beat still rising (a half-visible line, a half-arrived card).
7
+ * Null when nothing settles (a chapter made only of through-motion, e.g. a
8
+ * crossing line — its best moment is the window's middle, the caller's
9
+ * fallback).
10
+ *
11
+ * MIRRORED VERBATIM from teleport-gui's chapter-window.ts (the editor draws
12
+ * the same moment on the timeline). Plain JS inside: this function's SOURCE
13
+ * is injected into the generated TqScrollScene runtime via toString(), so no
14
+ * TypeScript-only runtime constructs and no template literals.
15
+ */
16
+ export interface MomentLane {
17
+ at: number[];
18
+ values: number[];
19
+ }
20
+ export declare function settledMomentForLanes(lanes: MomentLane[]): number | null;
21
+ //# sourceMappingURL=moment.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"moment.d.ts","sourceRoot":"","sources":["../../../src/scroll-scene/moment.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AACH,MAAM,WAAW,UAAU;IACzB,EAAE,EAAE,MAAM,EAAE,CAAA;IACZ,MAAM,EAAE,MAAM,EAAE,CAAA;CACjB;AAED,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,UAAU,EAAE,GAAG,MAAM,GAAG,IAAI,CA2CxE"}
@@ -0,0 +1,46 @@
1
+ export function settledMomentForLanes(lanes) {
2
+ var arrive = -Infinity;
3
+ var leave = Infinity;
4
+ var lastStop = -Infinity;
5
+ var found = false;
6
+ for (var _i = 0, lanes_1 = lanes; _i < lanes_1.length; _i++) {
7
+ var lane = lanes_1[_i];
8
+ if (lane.at.length < 3) {
9
+ continue;
10
+ }
11
+ var settledAt = null;
12
+ for (var index = 1; index < lane.values.length - 1; index++) {
13
+ if (lane.values[index] === lane.values[index + 1] && lane.values[index] !== lane.values[0]) {
14
+ settledAt = index;
15
+ break;
16
+ }
17
+ }
18
+ if (settledAt === null && lane.values[0] === lane.values[1]) {
19
+ settledAt = 0;
20
+ }
21
+ if (settledAt === null) {
22
+ continue;
23
+ }
24
+ found = true;
25
+ arrive = Math.max(arrive, lane.at[settledAt]);
26
+ lastStop = Math.max(lastStop, lane.at[lane.at.length - 1]);
27
+ var settledValue = lane.values[settledAt];
28
+ for (var index = settledAt + 1; index < lane.values.length; index++) {
29
+ if (lane.values[index] !== settledValue) {
30
+ leave = Math.min(leave, lane.at[index - 1]);
31
+ break;
32
+ }
33
+ }
34
+ }
35
+ if (!found) {
36
+ return null;
37
+ }
38
+ if (leave === Infinity) {
39
+ leave = lastStop;
40
+ }
41
+ if (leave < arrive) {
42
+ return null;
43
+ }
44
+ return Math.round(((arrive + leave) / 2) * 10000) / 10000;
45
+ }
46
+ //# sourceMappingURL=moment.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"moment.js","sourceRoot":"","sources":["../../../src/scroll-scene/moment.ts"],"names":[],"mappings":"AAoBA,MAAM,UAAU,qBAAqB,CAAC,KAAmB;IACvD,IAAI,MAAM,GAAG,CAAC,QAAQ,CAAA;IACtB,IAAI,KAAK,GAAG,QAAQ,CAAA;IACpB,IAAI,QAAQ,GAAG,CAAC,QAAQ,CAAA;IACxB,IAAI,KAAK,GAAG,KAAK,CAAA;IACjB,KAAmB,UAAK,EAAL,eAAK,EAAL,mBAAK,EAAL,IAAK,EAAE;QAArB,IAAM,IAAI,cAAA;QACb,IAAI,IAAI,CAAC,EAAE,CAAC,MAAM,GAAG,CAAC,EAAE;YACtB,SAAQ;SACT;QACD,IAAI,SAAS,GAAkB,IAAI,CAAA;QACnC,KAAK,IAAI,KAAK,GAAG,CAAC,EAAE,KAAK,GAAG,IAAI,CAAC,MAAM,CAAC,MAAM,GAAG,CAAC,EAAE,KAAK,EAAE,EAAE;YAC3D,IAAI,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,KAAK,IAAI,CAAC,MAAM,CAAC,KAAK,GAAG,CAAC,CAAC,IAAI,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,KAAK,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE;gBAC1F,SAAS,GAAG,KAAK,CAAA;gBACjB,MAAK;aACN;SACF;QACD,IAAI,SAAS,KAAK,IAAI,IAAI,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,KAAK,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE;YAC3D,SAAS,GAAG,CAAC,CAAA;SACd;QACD,IAAI,SAAS,KAAK,IAAI,EAAE;YACtB,SAAQ;SACT;QACD,KAAK,GAAG,IAAI,CAAA;QACZ,MAAM,GAAG,IAAI,CAAC,GAAG,CAAC,MAAM,EAAE,IAAI,CAAC,EAAE,CAAC,SAAS,CAAC,CAAC,CAAA;QAC7C,QAAQ,GAAG,IAAI,CAAC,GAAG,CAAC,QAAQ,EAAE,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAA;QAC1D,IAAM,YAAY,GAAG,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,CAAA;QAC3C,KAAK,IAAI,KAAK,GAAG,SAAS,GAAG,CAAC,EAAE,KAAK,GAAG,IAAI,CAAC,MAAM,CAAC,MAAM,EAAE,KAAK,EAAE,EAAE;YACnE,IAAI,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,KAAK,YAAY,EAAE;gBACvC,KAAK,GAAG,IAAI,CAAC,GAAG,CAAC,KAAK,EAAE,IAAI,CAAC,EAAE,CAAC,KAAK,GAAG,CAAC,CAAC,CAAC,CAAA;gBAC3C,MAAK;aACN;SACF;KACF;IACD,IAAI,CAAC,KAAK,EAAE;QACV,OAAO,IAAI,CAAA;KACZ;IACD,IAAI,KAAK,KAAK,QAAQ,EAAE;QACtB,KAAK,GAAG,QAAQ,CAAA;KACjB;IACD,IAAI,KAAK,GAAG,MAAM,EAAE;QAClB,OAAO,IAAI,CAAA;KACZ;IACD,OAAO,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,GAAG,KAAK,CAAC,GAAG,CAAC,CAAC,GAAG,KAAK,CAAC,GAAG,KAAK,CAAA;AAC3D,CAAC"}
@@ -0,0 +1,23 @@
1
+ /**
2
+ * The "scrolled past a point" contract of a published Scroll Scene: the four
3
+ * plain points in scroll order, which of them a move from one progress to
4
+ * another passes DOWNWARD, and the rank of a point for late listeners. The
5
+ * scene announces every passed point as a `tq-scene-point-passed` DOM event
6
+ * on its track (the element carrying the scene's id) and stamps the furthest
7
+ * point passed so far as `data-scene-point`.
8
+ *
9
+ * Plain JS inside: these functions' SOURCE is injected into the generated
10
+ * runtime via toString(), so no TypeScript-only runtime constructs, no
11
+ * template literals and no reference to anything outside the function. The
12
+ * list mirrors SCROLL_POINT_PROGRESS in teleport-plugin-next-workflows
13
+ * (pinned by a test).
14
+ */
15
+ export declare function scenePointList(): Array<{
16
+ key: string;
17
+ at: number;
18
+ }>;
19
+ /** Points passed going DOWN from one progress to another, in scroll order; none when going up. */
20
+ export declare function passedScenePoints(from: number, to: number): string[];
21
+ /** 1-based rank of a point in scroll order, 0 for anything else. */
22
+ export declare function scenePointRank(key: string): number;
23
+ //# sourceMappingURL=points.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"points.d.ts","sourceRoot":"","sources":["../../../src/scroll-scene/points.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AACH,wBAAgB,cAAc,IAAI,KAAK,CAAC;IAAE,GAAG,EAAE,MAAM,CAAC;IAAC,EAAE,EAAE,MAAM,CAAA;CAAE,CAAC,CAOnE;AAED,kGAAkG;AAClG,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,GAAG,MAAM,EAAE,CAUpE;AAED,oEAAoE;AACpE,wBAAgB,cAAc,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAQlD"}
@@ -0,0 +1,45 @@
1
+ /**
2
+ * The "scrolled past a point" contract of a published Scroll Scene: the four
3
+ * plain points in scroll order, which of them a move from one progress to
4
+ * another passes DOWNWARD, and the rank of a point for late listeners. The
5
+ * scene announces every passed point as a `tq-scene-point-passed` DOM event
6
+ * on its track (the element carrying the scene's id) and stamps the furthest
7
+ * point passed so far as `data-scene-point`.
8
+ *
9
+ * Plain JS inside: these functions' SOURCE is injected into the generated
10
+ * runtime via toString(), so no TypeScript-only runtime constructs, no
11
+ * template literals and no reference to anything outside the function. The
12
+ * list mirrors SCROLL_POINT_PROGRESS in teleport-plugin-next-workflows
13
+ * (pinned by a test).
14
+ */
15
+ export function scenePointList() {
16
+ return [
17
+ { key: 'quarter', at: 0.25 },
18
+ { key: 'half', at: 0.5 },
19
+ { key: 'three-quarters', at: 0.75 },
20
+ { key: 'end', at: 1 },
21
+ ];
22
+ }
23
+ /** Points passed going DOWN from one progress to another, in scroll order; none when going up. */
24
+ export function passedScenePoints(from, to) {
25
+ var passed = [];
26
+ var points = scenePointList();
27
+ for (var index = 0; index < points.length; index++) {
28
+ var point = points[index];
29
+ if (point.at > from + 0.000001 && point.at <= to + 0.000001) {
30
+ passed.push(point.key);
31
+ }
32
+ }
33
+ return passed;
34
+ }
35
+ /** 1-based rank of a point in scroll order, 0 for anything else. */
36
+ export function scenePointRank(key) {
37
+ var points = scenePointList();
38
+ for (var index = 0; index < points.length; index++) {
39
+ if (points[index].key === key) {
40
+ return index + 1;
41
+ }
42
+ }
43
+ return 0;
44
+ }
45
+ //# sourceMappingURL=points.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"points.js","sourceRoot":"","sources":["../../../src/scroll-scene/points.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AACH,MAAM,UAAU,cAAc;IAC5B,OAAO;QACL,EAAE,GAAG,EAAE,SAAS,EAAE,EAAE,EAAE,IAAI,EAAE;QAC5B,EAAE,GAAG,EAAE,MAAM,EAAE,EAAE,EAAE,GAAG,EAAE;QACxB,EAAE,GAAG,EAAE,gBAAgB,EAAE,EAAE,EAAE,IAAI,EAAE;QACnC,EAAE,GAAG,EAAE,KAAK,EAAE,EAAE,EAAE,CAAC,EAAE;KACtB,CAAA;AACH,CAAC;AAED,kGAAkG;AAClG,MAAM,UAAU,iBAAiB,CAAC,IAAY,EAAE,EAAU;IACxD,IAAM,MAAM,GAAG,EAAE,CAAA;IACjB,IAAM,MAAM,GAAG,cAAc,EAAE,CAAA;IAC/B,KAAK,IAAI,KAAK,GAAG,CAAC,EAAE,KAAK,GAAG,MAAM,CAAC,MAAM,EAAE,KAAK,EAAE,EAAE;QAClD,IAAM,KAAK,GAAG,MAAM,CAAC,KAAK,CAAC,CAAA;QAC3B,IAAI,KAAK,CAAC,EAAE,GAAG,IAAI,GAAG,QAAQ,IAAI,KAAK,CAAC,EAAE,IAAI,EAAE,GAAG,QAAQ,EAAE;YAC3D,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAA;SACvB;KACF;IACD,OAAO,MAAM,CAAA;AACf,CAAC;AAED,oEAAoE;AACpE,MAAM,UAAU,cAAc,CAAC,GAAW;IACxC,IAAM,MAAM,GAAG,cAAc,EAAE,CAAA;IAC/B,KAAK,IAAI,KAAK,GAAG,CAAC,EAAE,KAAK,GAAG,MAAM,CAAC,MAAM,EAAE,KAAK,EAAE,EAAE;QAClD,IAAI,MAAM,CAAC,KAAK,CAAC,CAAC,GAAG,KAAK,GAAG,EAAE;YAC7B,OAAO,KAAK,GAAG,CAAC,CAAA;SACjB;KACF;IACD,OAAO,CAAC,CAAA;AACV,CAAC"}
@@ -0,0 +1,15 @@
1
+ /**
2
+ * Keep a pinned scene's stage pinnable: an ancestor with `overflow: hidden`
3
+ * (either axis) turns position:sticky off, silently. Authors and the AI write
4
+ * it for good reasons (a horizontal rail must clip its overhang — run
5
+ * e7f332df wrote `section.rail-scene { overflow: hidden }` around the
6
+ * homepage's story and the stage scrolled straight through). `overflow: clip`
7
+ * keeps the clipping and, unlike hidden, does not make the element a scroll
8
+ * container, so the stage sticks again. Ancestors that really scroll (auto /
9
+ * scroll) are left alone: sticky then rightly binds to that container.
10
+ *
11
+ * Injected into the generated widget via toString — no imports, no template
12
+ * literals (the generated project transpiles it).
13
+ */
14
+ export declare function unclipStickyAncestors(track: Element, getStyle: (element: Element) => CSSStyleDeclaration): string[];
15
+ //# sourceMappingURL=unclip.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"unclip.d.ts","sourceRoot":"","sources":["../../../src/scroll-scene/unclip.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AACH,wBAAgB,qBAAqB,CACnC,KAAK,EAAE,OAAO,EACd,QAAQ,EAAE,CAAC,OAAO,EAAE,OAAO,KAAK,mBAAmB,GAClD,MAAM,EAAE,CA2BV"}
@@ -0,0 +1,40 @@
1
+ /**
2
+ * Keep a pinned scene's stage pinnable: an ancestor with `overflow: hidden`
3
+ * (either axis) turns position:sticky off, silently. Authors and the AI write
4
+ * it for good reasons (a horizontal rail must clip its overhang — run
5
+ * e7f332df wrote `section.rail-scene { overflow: hidden }` around the
6
+ * homepage's story and the stage scrolled straight through). `overflow: clip`
7
+ * keeps the clipping and, unlike hidden, does not make the element a scroll
8
+ * container, so the stage sticks again. Ancestors that really scroll (auto /
9
+ * scroll) are left alone: sticky then rightly binds to that container.
10
+ *
11
+ * Injected into the generated widget via toString — no imports, no template
12
+ * literals (the generated project transpiles it).
13
+ */
14
+ export function unclipStickyAncestors(track, getStyle) {
15
+ var unclipped = [];
16
+ var element = track.parentElement;
17
+ while (element && element !== element.ownerDocument.documentElement) {
18
+ var style = getStyle(element);
19
+ var both = style.overflow === 'hidden';
20
+ var axes = [];
21
+ if (both || style.overflowX === 'hidden') {
22
+ axes.push('x');
23
+ }
24
+ if (both || style.overflowY === 'hidden') {
25
+ axes.push('y');
26
+ }
27
+ if (axes.length > 0) {
28
+ var host = element;
29
+ for (var i = 0; i < axes.length; i++) {
30
+ host.style.setProperty('overflow-' + axes[i], 'clip');
31
+ }
32
+ host.setAttribute('data-scene-unclipped', axes.join(''));
33
+ unclipped.push(host.tagName.toLowerCase() +
34
+ (host.className ? '.' + String(host.className).split(' ')[0] : ''));
35
+ }
36
+ element = element.parentElement;
37
+ }
38
+ return unclipped;
39
+ }
40
+ //# sourceMappingURL=unclip.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"unclip.js","sourceRoot":"","sources":["../../../src/scroll-scene/unclip.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AACH,MAAM,UAAU,qBAAqB,CACnC,KAAc,EACd,QAAmD;IAEnD,IAAM,SAAS,GAAa,EAAE,CAAA;IAC9B,IAAI,OAAO,GAAG,KAAK,CAAC,aAAa,CAAA;IACjC,OAAO,OAAO,IAAI,OAAO,KAAK,OAAO,CAAC,aAAa,CAAC,eAAe,EAAE;QACnE,IAAM,KAAK,GAAG,QAAQ,CAAC,OAAO,CAAC,CAAA;QAC/B,IAAM,IAAI,GAAG,KAAK,CAAC,QAAQ,KAAK,QAAQ,CAAA;QACxC,IAAM,IAAI,GAAa,EAAE,CAAA;QACzB,IAAI,IAAI,IAAI,KAAK,CAAC,SAAS,KAAK,QAAQ,EAAE;YACxC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAA;SACf;QACD,IAAI,IAAI,IAAI,KAAK,CAAC,SAAS,KAAK,QAAQ,EAAE;YACxC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAA;SACf;QACD,IAAI,IAAI,CAAC,MAAM,GAAG,CAAC,EAAE;YACnB,IAAM,IAAI,GAAG,OAAsB,CAAA;YACnC,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;gBACpC,IAAI,CAAC,KAAK,CAAC,WAAW,CAAC,WAAW,GAAG,IAAI,CAAC,CAAC,CAAC,EAAE,MAAM,CAAC,CAAA;aACtD;YACD,IAAI,CAAC,YAAY,CAAC,sBAAsB,EAAE,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,CAAA;YACxD,SAAS,CAAC,IAAI,CACZ,IAAI,CAAC,OAAO,CAAC,WAAW,EAAE;gBACxB,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,GAAG,GAAG,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CACrE,CAAA;SACF;QACD,OAAO,GAAG,OAAO,CAAC,aAAa,CAAA;KAChC;IACD,OAAO,SAAS,CAAA;AAClB,CAAC"}
@@ -0,0 +1,74 @@
1
+ /**
2
+ * State bindings of the static HTML export: the attributes a downloaded page
3
+ * carries so that clicks open menus, switch tabs and restyle elements, and the
4
+ * small expression language they are written in. The HTML generator writes
5
+ * them (teleport-plugin-html-base-component), the one runtime file a download
6
+ * ships (`tq-state.js`, teleport-project-generator-html) reads them back.
7
+ *
8
+ * data-tq-scope="Navigation" a page root or a component instance:
9
+ * data-tq-state="menuOpen = false" its own store, with its starting values
10
+ * data-tq-if="menuOpen" shown while true; `hidden` when it starts false
11
+ * data-tq-class="active: tab === 0" the class is on while true
12
+ * data-tq-on-click="menuOpen = !menuOpen"
13
+ * data-tq-slot content a parent put into a component:
14
+ * it reads the parent's store
15
+ *
16
+ * The language has literals (numbers, 'quoted strings', true, false, null),
17
+ * state names, `!`, `+ -`, the six comparisons and `&& ||`, with JavaScript's
18
+ * meaning. Nothing is ever evaluated as JavaScript, so a page keeps working
19
+ * under a strict Content-Security-Policy.
20
+ */
21
+ export declare const SCOPE_ATTR = "data-tq-scope";
22
+ export declare const STATE_ATTR = "data-tq-state";
23
+ export declare const SLOT_ATTR = "data-tq-slot";
24
+ export declare const IF_ATTR = "data-tq-if";
25
+ export declare const CLASS_ATTR = "data-tq-class";
26
+ export declare const CLICK_ATTR = "data-tq-on-click";
27
+ export declare const RUNTIME_FILE_NAME = "tq-state";
28
+ export type StateValue = string | number | boolean | null;
29
+ export type ComparisonOperator = '===' | '!==' | '<' | '<=' | '>' | '>=';
30
+ export type BinaryOperator = '||' | '&&' | ComparisonOperator | '+' | '-';
31
+ export type StateExpression = {
32
+ kind: 'literal';
33
+ value: StateValue;
34
+ } | {
35
+ kind: 'state';
36
+ name: string;
37
+ } | {
38
+ kind: 'not';
39
+ operand: StateExpression;
40
+ } | {
41
+ kind: 'binary';
42
+ operator: BinaryOperator;
43
+ left: StateExpression;
44
+ right: StateExpression;
45
+ };
46
+ export interface StateAssignment {
47
+ name: string;
48
+ value: StateExpression;
49
+ }
50
+ export interface ClassBinding {
51
+ className: string;
52
+ condition: StateExpression;
53
+ }
54
+ export declare const isStateName: (name: string) => boolean;
55
+ export declare const isBindableClassName: (name: string) => boolean;
56
+ export declare const isStateValue: (value: unknown) => value is StateValue;
57
+ export declare const literal: (value: StateValue) => StateExpression;
58
+ export declare const state: (name: string) => StateExpression;
59
+ export declare const not: (operand: StateExpression) => StateExpression;
60
+ export declare const binary: (operator: BinaryOperator, left: StateExpression, right: StateExpression) => StateExpression;
61
+ export declare const stateNamesOf: (expression: StateExpression, names?: Set<string>) => Set<string>;
62
+ export declare const printValue: (value: StateValue) => string;
63
+ export declare const printExpression: (expression: StateExpression) => string;
64
+ export declare const printAssignments: (assignments: StateAssignment[]) => string;
65
+ export declare const printClassBindings: (bindings: ClassBinding[]) => string;
66
+ /** The same meaning the runtime gives an expression, for the page's first paint. */
67
+ export declare const evaluateExpression: (expression: StateExpression, values: Record<string, StateValue>) => unknown;
68
+ /**
69
+ * An attribute value as the HTML printer must receive it: it writes values
70
+ * between double quotes and escapes nothing. `&&` and `<` stay readable; an
71
+ * ampersand that could start a character reference does not.
72
+ */
73
+ export declare const escapeAttributeValue: (value: string) => string;
74
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/state-bindings/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,eAAO,MAAM,UAAU,kBAAkB,CAAA;AACzC,eAAO,MAAM,UAAU,kBAAkB,CAAA;AACzC,eAAO,MAAM,SAAS,iBAAiB,CAAA;AACvC,eAAO,MAAM,OAAO,eAAe,CAAA;AACnC,eAAO,MAAM,UAAU,kBAAkB,CAAA;AACzC,eAAO,MAAM,UAAU,qBAAqB,CAAA;AAE5C,eAAO,MAAM,iBAAiB,aAAa,CAAA;AAE3C,MAAM,MAAM,UAAU,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,IAAI,CAAA;AAEzD,MAAM,MAAM,kBAAkB,GAAG,KAAK,GAAG,KAAK,GAAG,GAAG,GAAG,IAAI,GAAG,GAAG,GAAG,IAAI,CAAA;AACxE,MAAM,MAAM,cAAc,GAAG,IAAI,GAAG,IAAI,GAAG,kBAAkB,GAAG,GAAG,GAAG,GAAG,CAAA;AAEzE,MAAM,MAAM,eAAe,GACvB;IAAE,IAAI,EAAE,SAAS,CAAC;IAAC,KAAK,EAAE,UAAU,CAAA;CAAE,GACtC;IAAE,IAAI,EAAE,OAAO,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,GAC/B;IAAE,IAAI,EAAE,KAAK,CAAC;IAAC,OAAO,EAAE,eAAe,CAAA;CAAE,GACzC;IAAE,IAAI,EAAE,QAAQ,CAAC;IAAC,QAAQ,EAAE,cAAc,CAAC;IAAC,IAAI,EAAE,eAAe,CAAC;IAAC,KAAK,EAAE,eAAe,CAAA;CAAE,CAAA;AAE/F,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,MAAM,CAAA;IACZ,KAAK,EAAE,eAAe,CAAA;CACvB;AAED,MAAM,WAAW,YAAY;IAC3B,SAAS,EAAE,MAAM,CAAA;IACjB,SAAS,EAAE,eAAe,CAAA;CAC3B;AAID,eAAO,MAAM,WAAW,SAAU,MAAM,KAAG,OACwB,CAAA;AAEnE,eAAO,MAAM,mBAAmB,SAAU,MAAM,KAAG,OAAsC,CAAA;AAEzF,eAAO,MAAM,YAAY,UAAW,OAAO,wBAIY,CAAA;AAEvD,eAAO,MAAM,OAAO,UAAW,UAAU,KAAG,eAA+C,CAAA;AAC3F,eAAO,MAAM,KAAK,SAAU,MAAM,KAAG,eAA4C,CAAA;AACjF,eAAO,MAAM,GAAG,YAAa,eAAe,KAAG,eAA6C,CAAA;AAC5F,eAAO,MAAM,MAAM,aACP,cAAc,QAClB,eAAe,SACd,eAAe,KACrB,eAA8D,CAAA;AAEjE,eAAO,MAAM,YAAY,eAAgB,eAAe,qCAgBvD,CAAA;AA6BD,eAAO,MAAM,UAAU,UAAW,UAAU,KAAG,MAK9C,CAAA;AAED,eAAO,MAAM,eAAe,eAAgB,eAAe,KAAG,MAkB7D,CAAA;AAED,eAAO,MAAM,gBAAgB,gBAAiB,eAAe,EAAE,KAAG,MACsB,CAAA;AAExF,eAAO,MAAM,kBAAkB,aAAc,YAAY,EAAE,KAAG,MAG/C,CAAA;AAEf,oFAAoF;AACpF,eAAO,MAAM,kBAAkB,eACjB,eAAe,UACnB,OAAO,MAAM,EAAE,UAAU,CAAC,KACjC,OAyCF,CAAA;AAED;;;;GAIG;AACH,eAAO,MAAM,oBAAoB,UAAW,MAAM,KAAG,MACc,CAAA"}