@litfamily/litcodex 1.0.29 → 1.0.31

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 (388) hide show
  1. package/README-Ko-KR.md +11 -11
  2. package/README.md +11 -11
  3. package/dist/install/generated-skill-payload-hashes.d.ts +191 -85
  4. package/dist/install/generated-skill-payload-hashes.js +191 -85
  5. package/dist/install/marketplace.js +10 -1
  6. package/dist/install/skill-catalog.d.ts +1 -1
  7. package/dist/install/skill-catalog.js +12 -1
  8. package/dist/install/skill-resource-hashes.d.ts +1 -1
  9. package/dist/install/skill-resource-hashes.js +1 -1
  10. package/marketplace/.agents/plugins/marketplace.json +4 -1
  11. package/marketplace/plugins/litcodex/.codex-plugin/plugin.json +14 -2
  12. package/marketplace/plugins/litcodex/assets/screenshot-lit-ignited.png +0 -0
  13. package/marketplace/plugins/litcodex/components/auto-update/package.json +1 -1
  14. package/marketplace/plugins/litcodex/components/comment-checker/package.json +1 -1
  15. package/marketplace/plugins/litcodex/components/git-bash/package.json +1 -1
  16. package/marketplace/plugins/litcodex/components/lit-loop/directive.md +10 -4
  17. package/marketplace/plugins/litcodex/components/lit-loop/directives/lit-adhd.md +191 -0
  18. package/marketplace/plugins/litcodex/components/lit-loop/directives/lit-handoff.md +2 -0
  19. package/marketplace/plugins/litcodex/components/lit-loop/directives/lit-hijack.md +219 -0
  20. package/marketplace/plugins/litcodex/components/lit-loop/directives/lit-recap.md +2 -0
  21. package/marketplace/plugins/litcodex/components/lit-loop/directives/lit-schematic.md +199 -0
  22. package/marketplace/plugins/litcodex/components/lit-loop/directives/litwork.md +2 -1
  23. package/marketplace/plugins/litcodex/components/lit-loop/dist/adhd-suggest.d.ts +10 -0
  24. package/marketplace/plugins/litcodex/components/lit-loop/dist/adhd-suggest.js +67 -0
  25. package/marketplace/plugins/litcodex/components/lit-loop/dist/card-html.d.ts +1 -1
  26. package/marketplace/plugins/litcodex/components/lit-loop/dist/card-html.js +128 -8
  27. package/marketplace/plugins/litcodex/components/lit-loop/dist/card-looks.d.ts +19 -0
  28. package/marketplace/plugins/litcodex/components/lit-loop/dist/card-looks.js +58 -0
  29. package/marketplace/plugins/litcodex/components/lit-loop/dist/card-status.d.ts +27 -0
  30. package/marketplace/plugins/litcodex/components/lit-loop/dist/card-status.js +94 -7
  31. package/marketplace/plugins/litcodex/components/lit-loop/dist/cli.js +13 -3
  32. package/marketplace/plugins/litcodex/components/lit-loop/dist/codex-hook.d.ts +2 -0
  33. package/marketplace/plugins/litcodex/components/lit-loop/dist/codex-hook.js +8 -9
  34. package/marketplace/plugins/litcodex/components/lit-loop/dist/control-chars.d.ts +5 -0
  35. package/marketplace/plugins/litcodex/components/lit-loop/dist/control-chars.js +23 -0
  36. package/marketplace/plugins/litcodex/components/lit-loop/dist/hook-cli.d.ts +8 -0
  37. package/marketplace/plugins/litcodex/components/lit-loop/dist/hook-cli.js +118 -11
  38. package/marketplace/plugins/litcodex/components/lit-loop/dist/hud.d.ts +1 -1
  39. package/marketplace/plugins/litcodex/components/lit-loop/dist/hud.js +29 -13
  40. package/marketplace/plugins/litcodex/components/lit-loop/dist/lane-events.d.ts +13 -0
  41. package/marketplace/plugins/litcodex/components/lit-loop/dist/lane-events.js +85 -0
  42. package/marketplace/plugins/litcodex/components/lit-loop/dist/lane-state.d.ts +55 -0
  43. package/marketplace/plugins/litcodex/components/lit-loop/dist/lane-state.js +227 -0
  44. package/marketplace/plugins/litcodex/components/lit-loop/dist/live-step.d.ts +5 -1
  45. package/marketplace/plugins/litcodex/components/lit-loop/dist/live-step.js +17 -1
  46. package/marketplace/plugins/litcodex/components/lit-loop/dist/markers.d.ts +6 -0
  47. package/marketplace/plugins/litcodex/components/lit-loop/dist/markers.js +6 -0
  48. package/marketplace/plugins/litcodex/components/lit-loop/dist/modes.d.ts +1 -1
  49. package/marketplace/plugins/litcodex/components/lit-loop/dist/modes.js +25 -1
  50. package/marketplace/plugins/litcodex/components/lit-loop/dist/motion-gate.d.ts +79 -0
  51. package/marketplace/plugins/litcodex/components/lit-loop/dist/motion-gate.js +310 -0
  52. package/marketplace/plugins/litcodex/components/lit-loop/dist/motion-route.js +5 -1
  53. package/marketplace/plugins/litcodex/components/lit-loop/dist/plan-persistence.js +10 -0
  54. package/marketplace/plugins/litcodex/components/lit-loop/dist/redaction.js +18 -0
  55. package/marketplace/plugins/litcodex/components/lit-loop/dist/reentry.d.ts +15 -0
  56. package/marketplace/plugins/litcodex/components/lit-loop/dist/reentry.js +46 -9
  57. package/marketplace/plugins/litcodex/components/lit-loop/dist/rewind-cli.d.ts +10 -0
  58. package/marketplace/plugins/litcodex/components/lit-loop/dist/rewind-cli.js +88 -0
  59. package/marketplace/plugins/litcodex/components/lit-loop/dist/rewind-go.d.ts +20 -0
  60. package/marketplace/plugins/litcodex/components/lit-loop/dist/rewind-go.js +84 -0
  61. package/marketplace/plugins/litcodex/components/lit-loop/dist/rewind-look.d.ts +6 -0
  62. package/marketplace/plugins/litcodex/components/lit-loop/dist/rewind-look.js +41 -0
  63. package/marketplace/plugins/litcodex/components/lit-loop/dist/rewind-redact.d.ts +3 -0
  64. package/marketplace/plugins/litcodex/components/lit-loop/dist/rewind-redact.js +40 -0
  65. package/marketplace/plugins/litcodex/components/lit-loop/dist/rewind-rollout.d.ts +48 -0
  66. package/marketplace/plugins/litcodex/components/lit-loop/dist/rewind-rollout.js +292 -0
  67. package/marketplace/plugins/litcodex/components/lit-loop/dist/rewind.d.ts +162 -0
  68. package/marketplace/plugins/litcodex/components/lit-loop/dist/rewind.js +773 -0
  69. package/marketplace/plugins/litcodex/components/lit-loop/dist/route-heads.js +44 -2
  70. package/marketplace/plugins/litcodex/components/lit-loop/dist/run-panel.js +1 -0
  71. package/marketplace/plugins/litcodex/components/lit-loop/dist/schematic-route.d.ts +6 -0
  72. package/marketplace/plugins/litcodex/components/lit-loop/dist/schematic-route.js +35 -0
  73. package/marketplace/plugins/litcodex/components/lit-loop/dist/screen-card.d.ts +3 -0
  74. package/marketplace/plugins/litcodex/components/lit-loop/dist/screen-card.js +15 -5
  75. package/marketplace/plugins/litcodex/components/lit-loop/dist/skill-mention-scope.js +6 -0
  76. package/marketplace/plugins/litcodex/components/lit-loop/dist/stack-hook.d.ts +8 -0
  77. package/marketplace/plugins/litcodex/components/lit-loop/dist/stack-hook.js +57 -0
  78. package/marketplace/plugins/litcodex/components/lit-loop/dist/statusline.js +8 -3
  79. package/marketplace/plugins/litcodex/components/lit-loop/dist/threads.d.ts +50 -0
  80. package/marketplace/plugins/litcodex/components/lit-loop/dist/threads.js +178 -0
  81. package/marketplace/plugins/litcodex/components/lit-loop/dist/trigger.d.ts +1 -1
  82. package/marketplace/plugins/litcodex/components/lit-loop/dist/trigger.js +31 -6
  83. package/marketplace/plugins/litcodex/components/lit-loop/dist/workflow-map.d.ts +10 -0
  84. package/marketplace/plugins/litcodex/components/lit-loop/dist/workflow-map.js +11 -1
  85. package/marketplace/plugins/litcodex/components/lit-loop/dist/workflow-stack.d.ts +132 -0
  86. package/marketplace/plugins/litcodex/components/lit-loop/dist/workflow-stack.js +488 -0
  87. package/marketplace/plugins/litcodex/components/lit-loop/package.json +1 -1
  88. package/marketplace/plugins/litcodex/components/lsp/package.json +1 -1
  89. package/marketplace/plugins/litcodex/components/rules/node_modules/picomatch/README.md +15 -21
  90. package/marketplace/plugins/litcodex/components/rules/node_modules/picomatch/lib/parse.js +49 -10
  91. package/marketplace/plugins/litcodex/components/rules/node_modules/picomatch/lib/picomatch.js +14 -2
  92. package/marketplace/plugins/litcodex/components/rules/node_modules/picomatch/lib/scan.js +30 -18
  93. package/marketplace/plugins/litcodex/components/rules/node_modules/picomatch/package.json +3 -2
  94. package/marketplace/plugins/litcodex/components/rules/package.json +1 -1
  95. package/marketplace/plugins/litcodex/components/start-work-continuation/dist/codex-hook.d.ts +6 -0
  96. package/marketplace/plugins/litcodex/components/start-work-continuation/dist/codex-hook.js +65 -0
  97. package/marketplace/plugins/litcodex/components/start-work-continuation/package.json +1 -1
  98. package/marketplace/plugins/litcodex/components/telemetry/package.json +1 -1
  99. package/marketplace/plugins/litcodex/components/wikify-knowledge/package.json +1 -1
  100. package/marketplace/plugins/litcodex/hooks/hooks.json +24 -0
  101. package/marketplace/plugins/litcodex/skills/frontend-ui-ux/SKILL.md +6 -0
  102. package/marketplace/plugins/litcodex/skills/frontend-ui-ux/kit/components.css +414 -0
  103. package/marketplace/plugins/litcodex/skills/frontend-ui-ux/kit/fonts.json +22 -0
  104. package/marketplace/plugins/litcodex/skills/frontend-ui-ux/kit/layouts/landing.html +164 -0
  105. package/marketplace/plugins/litcodex/skills/frontend-ui-ux/kit/layouts/settings.html +114 -0
  106. package/marketplace/plugins/litcodex/skills/frontend-ui-ux/kit/layouts/workspace.html +115 -0
  107. package/marketplace/plugins/litcodex/skills/frontend-ui-ux/kit/styles/computational-brutalism.json +227 -0
  108. package/marketplace/plugins/litcodex/skills/frontend-ui-ux/kit/styles/field-notes.json +205 -0
  109. package/marketplace/plugins/litcodex/skills/frontend-ui-ux/kit/styles/graphite.json +200 -0
  110. package/marketplace/plugins/litcodex/skills/frontend-ui-ux/kit/styles/meadow.json +199 -0
  111. package/marketplace/plugins/litcodex/skills/frontend-ui-ux/kit/styles/neo-brutalism.json +222 -0
  112. package/marketplace/plugins/litcodex/skills/frontend-ui-ux/kit/ui.js +228 -0
  113. package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/brand-and-imagery.md +1 -1
  114. package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/complete-contract.md +1 -0
  115. package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/craft-floor.md +2 -2
  116. package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/default-editorial-pixel.json +15 -8
  117. package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/design-choice.md +19 -0
  118. package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/house-styles.md +235 -0
  119. package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/motion-guide.md +2 -2
  120. package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/probe-and-review.md +6 -0
  121. package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/production-interview.md +2 -0
  122. package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/slop-register.md +4 -4
  123. package/marketplace/plugins/litcodex/skills/frontend-ui-ux/scripts/design-lock.mjs +400 -0
  124. package/marketplace/plugins/litcodex/skills/frontend-ui-ux/scripts/lock-probe.mjs +196 -0
  125. package/marketplace/plugins/litcodex/skills/frontend-ui-ux/scripts/page-probe.mjs +22 -4
  126. package/marketplace/plugins/litcodex/skills/frontend-ui-ux/scripts/pixel-art.mjs +60 -0
  127. package/marketplace/plugins/litcodex/skills/frontend-ui-ux/scripts/probe.mjs +59 -13
  128. package/marketplace/plugins/litcodex/skills/frontend-ui-ux/scripts/rule-data.mjs +38 -4
  129. package/marketplace/plugins/litcodex/skills/lit-adhd/SKILL.md +181 -0
  130. package/marketplace/plugins/litcodex/skills/lit-adhd/agents/openai.yaml +6 -0
  131. package/marketplace/plugins/litcodex/skills/lit-adhd/references/card-examples.md +147 -0
  132. package/marketplace/plugins/litcodex/skills/lit-adhd/references/status-taxonomy.md +37 -0
  133. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/SKILL.md +18 -7
  134. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/references/style-guide.md +20 -11
  135. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/references/type-architecture.md +3 -3
  136. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/references/type-dependency.md +1 -1
  137. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/references/type-swimlane.md +1 -1
  138. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/references/type-tree-block-decomposition.md +1 -1
  139. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/references/type-tree.md +3 -3
  140. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/references/type-wardley.md +1 -1
  141. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/references/verifier-guide.md +1 -0
  142. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/scripts/diagram-craft-rules.mjs +1 -2
  143. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/scripts/visual-quality.mjs +1 -2
  144. package/marketplace/plugins/litcodex/skills/lit-docx/SKILL.md +12 -3
  145. package/marketplace/plugins/litcodex/skills/lit-docx/references/direction-step.md +6 -3
  146. package/marketplace/plugins/litcodex/skills/lit-hijack/SKILL.md +449 -0
  147. package/marketplace/plugins/litcodex/skills/lit-hijack/agents/openai.yaml +6 -0
  148. package/marketplace/plugins/litcodex/skills/lit-hijack/references/capture-and-provenance.md +100 -0
  149. package/marketplace/plugins/litcodex/skills/lit-hijack/references/clean-room-build.md +111 -0
  150. package/marketplace/plugins/litcodex/skills/lit-hijack/references/distil-and-licence.md +102 -0
  151. package/marketplace/plugins/litcodex/skills/lit-hijack/references/gap-and-port-design.md +125 -0
  152. package/marketplace/plugins/litcodex/skills/lit-hijack/references/parity-and-report.md +108 -0
  153. package/marketplace/plugins/litcodex/skills/lit-hijack/scripts/hijack.mjs +1050 -0
  154. package/marketplace/plugins/litcodex/skills/lit-loop/SKILL.md +13 -4
  155. package/marketplace/plugins/litcodex/skills/lit-plan/SKILL.md +6 -0
  156. package/marketplace/plugins/litcodex/skills/lit-pptx/NOTICE +1 -0
  157. package/marketplace/plugins/litcodex/skills/lit-pptx/SKILL.md +35 -8
  158. package/marketplace/plugins/litcodex/skills/lit-pptx/fonts/jetbrains-mono/JetBrainsMono-Bold.ttf +0 -0
  159. package/marketplace/plugins/litcodex/skills/lit-pptx/fonts/jetbrains-mono/JetBrainsMono-Regular.ttf +0 -0
  160. package/marketplace/plugins/litcodex/skills/lit-pptx/fonts/jetbrains-mono/OFL.txt +93 -0
  161. package/marketplace/plugins/litcodex/skills/lit-pptx/fonts/jetbrains-mono/SOURCE.md +21 -0
  162. package/marketplace/plugins/litcodex/skills/lit-pptx/references/anti-slop-checklist.md +5 -2
  163. package/marketplace/plugins/litcodex/skills/lit-pptx/references/authoring-guide.md +3 -4
  164. package/marketplace/plugins/litcodex/skills/lit-pptx/references/density-and-fill.md +20 -6
  165. package/marketplace/plugins/litcodex/skills/lit-pptx/references/direction-step.md +26 -8
  166. package/marketplace/plugins/litcodex/skills/lit-pptx/references/examples/14-engineering-review-computational-brutalism-ko.md +173 -0
  167. package/marketplace/plugins/litcodex/skills/lit-pptx/references/examples/15-launch-pitch-neo-brutalism-ko.md +154 -0
  168. package/marketplace/plugins/litcodex/skills/lit-pptx/references/examples/16-design-lecture-bauhaus-ko.md +139 -0
  169. package/marketplace/plugins/litcodex/skills/lit-pptx/references/examples/17-community-programme-riso-ko.md +158 -0
  170. package/marketplace/plugins/litcodex/skills/lit-pptx/references/examples/18-public-data-briefing-newsroom-ko.md +179 -0
  171. package/marketplace/plugins/litcodex/skills/lit-pptx/references/layout-families.md +42 -27
  172. package/marketplace/plugins/litcodex/skills/lit-pptx/references/title-treatments.md +31 -27
  173. package/marketplace/plugins/litcodex/skills/lit-pptx/references/tonalities/bauhaus.md +136 -0
  174. package/marketplace/plugins/litcodex/skills/lit-pptx/references/tonalities/chalk.md +1 -1
  175. package/marketplace/plugins/litcodex/skills/lit-pptx/references/tonalities/computational-brutalism.md +145 -0
  176. package/marketplace/plugins/litcodex/skills/lit-pptx/references/tonalities/neo-brutalism.md +155 -0
  177. package/marketplace/plugins/litcodex/skills/lit-pptx/references/tonalities/newsroom.md +141 -0
  178. package/marketplace/plugins/litcodex/skills/lit-pptx/references/tonalities/riso.md +133 -0
  179. package/marketplace/plugins/litcodex/skills/lit-pptx/references/tonalities/signal.md +1 -1
  180. package/marketplace/plugins/litcodex/skills/lit-pptx/references/tonalities/studio.md +1 -1
  181. package/marketplace/plugins/litcodex/skills/lit-pptx/scripts/compile-deck.js +1 -1
  182. package/marketplace/plugins/litcodex/skills/lit-pptx/scripts/craft_extras.py +136 -94
  183. package/marketplace/plugins/litcodex/skills/lit-pptx/scripts/embed_fonts.py +13 -1
  184. package/marketplace/plugins/litcodex/skills/lit-pptx/scripts/lib/grid-resolver.js +101 -110
  185. package/marketplace/plugins/litcodex/skills/lit-pptx/scripts/lib/layout-resolver.js +9 -15
  186. package/marketplace/plugins/litcodex/skills/lit-pptx/scripts/lib/render-pack.js +386 -579
  187. package/marketplace/plugins/litcodex/skills/lit-pptx/scripts/lib/slide-grid.js +104 -0
  188. package/marketplace/plugins/litcodex/skills/lit-pptx/scripts/lib/template-registry.js +57 -6
  189. package/marketplace/plugins/litcodex/skills/lit-pptx/scripts/office-run.mjs +2 -1
  190. package/marketplace/plugins/litcodex/skills/lit-pptx/scripts/qa_deck.py +7 -13
  191. package/marketplace/plugins/litcodex/skills/lit-pptx/scripts/render_pages.py +124 -0
  192. package/marketplace/plugins/litcodex/skills/lit-pptx/templates/tonalities/atlas/pack.yaml +1 -1
  193. package/marketplace/plugins/litcodex/skills/lit-pptx/templates/tonalities/bauhaus/pack.yaml +98 -0
  194. package/marketplace/plugins/litcodex/skills/lit-pptx/templates/tonalities/chalk/pack.yaml +1 -1
  195. package/marketplace/plugins/litcodex/skills/lit-pptx/templates/tonalities/computational-brutalism/pack.yaml +100 -0
  196. package/marketplace/plugins/litcodex/skills/lit-pptx/templates/tonalities/gazette/pack.yaml +1 -1
  197. package/marketplace/plugins/litcodex/skills/lit-pptx/templates/tonalities/ledger/pack.yaml +1 -1
  198. package/marketplace/plugins/litcodex/skills/lit-pptx/templates/tonalities/neo-brutalism/pack.yaml +107 -0
  199. package/marketplace/plugins/litcodex/skills/lit-pptx/templates/tonalities/newsroom/pack.yaml +99 -0
  200. package/marketplace/plugins/litcodex/skills/lit-pptx/templates/tonalities/night/pack.yaml +1 -1
  201. package/marketplace/plugins/litcodex/skills/lit-pptx/templates/tonalities/paper/pack.yaml +1 -1
  202. package/marketplace/plugins/litcodex/skills/lit-pptx/templates/tonalities/riso/pack.yaml +99 -0
  203. package/marketplace/plugins/litcodex/skills/lit-pptx/templates/tonalities/signal/pack.yaml +2 -2
  204. package/marketplace/plugins/litcodex/skills/lit-pptx/templates/tonalities/studio/pack.yaml +1 -1
  205. package/marketplace/plugins/litcodex/skills/lit-recap/SKILL.md +2 -0
  206. package/marketplace/plugins/litcodex/skills/lit-schematic/SKILL.md +198 -0
  207. package/marketplace/plugins/litcodex/skills/lit-schematic/agents/openai.yaml +6 -0
  208. package/marketplace/plugins/litcodex/skills/lit-schematic/examples/iso-heat-exchanger/build.mjs +38 -0
  209. package/marketplace/plugins/litcodex/skills/lit-schematic/examples/iso-heat-exchanger/scene.mjs +133 -0
  210. package/marketplace/plugins/litcodex/skills/lit-schematic/examples/journal-adsorption-rig/build.mjs +87 -0
  211. package/marketplace/plugins/litcodex/skills/lit-schematic/examples/pid-dosing-skid/build.mjs +85 -0
  212. package/marketplace/plugins/litcodex/skills/lit-schematic/references/cutaway-outputs.md +70 -0
  213. package/marketplace/plugins/litcodex/skills/lit-schematic/references/isometric-craft.md +101 -0
  214. package/marketplace/plugins/litcodex/skills/lit-schematic/references/journal-figures.md +72 -0
  215. package/marketplace/plugins/litcodex/skills/lit-schematic/references/kit-api.md +134 -0
  216. package/marketplace/plugins/litcodex/skills/lit-schematic/references/pfd-and-layout.md +53 -0
  217. package/marketplace/plugins/litcodex/skills/lit-schematic/references/pid-drafting.md +103 -0
  218. package/marketplace/plugins/litcodex/skills/lit-schematic/references/pid-symbols.md +163 -0
  219. package/marketplace/plugins/litcodex/skills/lit-schematic/references/verification.md +100 -0
  220. package/marketplace/plugins/litcodex/skills/lit-schematic/scripts/doctor.mjs +57 -0
  221. package/marketplace/plugins/litcodex/skills/lit-schematic/scripts/lib/figure.mjs +81 -0
  222. package/marketplace/plugins/litcodex/skills/lit-schematic/scripts/lib/fonts.mjs +28 -0
  223. package/marketplace/plugins/litcodex/skills/lit-schematic/scripts/lib/geom.mjs +113 -0
  224. package/marketplace/plugins/litcodex/skills/lit-schematic/scripts/lib/interactive.mjs +292 -0
  225. package/marketplace/plugins/litcodex/skills/lit-schematic/scripts/lib/isa.mjs +115 -0
  226. package/marketplace/plugins/litcodex/skills/lit-schematic/scripts/lib/iso.mjs +719 -0
  227. package/marketplace/plugins/litcodex/skills/lit-schematic/scripts/lib/legend-sheet.mjs +162 -0
  228. package/marketplace/plugins/litcodex/skills/lit-schematic/scripts/lib/pid.mjs +937 -0
  229. package/marketplace/plugins/litcodex/skills/lit-schematic/scripts/lib/png.mjs +132 -0
  230. package/marketplace/plugins/litcodex/skills/lit-schematic/scripts/lib/qa-core.mjs +658 -0
  231. package/marketplace/plugins/litcodex/skills/lit-schematic/scripts/lib/route.mjs +218 -0
  232. package/marketplace/plugins/litcodex/skills/lit-schematic/scripts/lib/sheet.mjs +890 -0
  233. package/marketplace/plugins/litcodex/skills/lit-schematic/scripts/lib/svg.mjs +82 -0
  234. package/marketplace/plugins/litcodex/skills/lit-schematic/scripts/lib/theme.mjs +115 -0
  235. package/marketplace/plugins/litcodex/skills/lit-schematic/scripts/motion.mjs +129 -0
  236. package/marketplace/plugins/litcodex/skills/lit-schematic/scripts/qa.mjs +92 -0
  237. package/marketplace/plugins/litcodex/skills/lit-schematic/scripts/render.mjs +233 -0
  238. package/marketplace/plugins/litcodex/skills/lit-schematic/scripts/scaffold.mjs +60 -0
  239. package/marketplace/plugins/litcodex/skills/lit-scientific-visualization/SKILL.md +34 -8
  240. package/marketplace/plugins/litcodex/skills/lit-typographic-motion/SKILL.md +18 -14
  241. package/marketplace/plugins/litcodex/skills/lit-typographic-motion/engine/THIRD_PARTY_NOTICES +12 -0
  242. package/marketplace/plugins/litcodex/skills/lit-typographic-motion/engine/assets.mjs +388 -0
  243. package/marketplace/plugins/litcodex/skills/lit-typographic-motion/engine/blender/runner.py +221 -0
  244. package/marketplace/plugins/litcodex/skills/lit-typographic-motion/engine/blender.mjs +132 -0
  245. package/marketplace/plugins/litcodex/skills/lit-typographic-motion/engine/board.mjs +142 -0
  246. package/marketplace/plugins/litcodex/skills/lit-typographic-motion/engine/constants.mjs +6 -0
  247. package/marketplace/plugins/litcodex/skills/lit-typographic-motion/engine/cover-assets.mjs +7 -4
  248. package/marketplace/plugins/litcodex/skills/lit-typographic-motion/engine/cover-capture.mjs +8 -7
  249. package/marketplace/plugins/litcodex/skills/lit-typographic-motion/engine/cover-init.js +14 -2
  250. package/marketplace/plugins/litcodex/skills/lit-typographic-motion/engine/cover-treatment.mjs +38 -3
  251. package/marketplace/plugins/litcodex/skills/lit-typographic-motion/engine/cover.mjs +19 -4
  252. package/marketplace/plugins/litcodex/skills/lit-typographic-motion/engine/driver.mjs +8 -8
  253. package/marketplace/plugins/litcodex/skills/lit-typographic-motion/engine/gallery.mjs +147 -0
  254. package/marketplace/plugins/litcodex/skills/lit-typographic-motion/engine/house.mjs +45 -0
  255. package/marketplace/plugins/litcodex/skills/lit-typographic-motion/engine/image.mjs +89 -0
  256. package/marketplace/plugins/litcodex/skills/lit-typographic-motion/engine/look.mjs +58 -25
  257. package/marketplace/plugins/litcodex/skills/lit-typographic-motion/engine/runtime.mjs +59 -14
  258. package/marketplace/plugins/litcodex/skills/lit-typographic-motion/engine/safe-read.mjs +32 -0
  259. package/marketplace/plugins/litcodex/skills/lit-typographic-motion/engine/scaffold.mjs +208 -0
  260. package/marketplace/plugins/litcodex/skills/lit-typographic-motion/engine/score.mjs +668 -0
  261. package/marketplace/plugins/litcodex/skills/lit-typographic-motion/engine/sound.mjs +174 -31
  262. package/marketplace/plugins/litcodex/skills/lit-typographic-motion/engine/stage-gate.mjs +45 -3
  263. package/marketplace/plugins/litcodex/skills/lit-typographic-motion/engine/stage-kit.js +99 -1
  264. package/marketplace/plugins/litcodex/skills/lit-typographic-motion/engine/stage-qa.js +8 -1
  265. package/marketplace/plugins/litcodex/skills/lit-typographic-motion/engine/stage-qa.mjs +180 -11
  266. package/marketplace/plugins/litcodex/skills/lit-typographic-motion/engine/stage-render.mjs +42 -12
  267. package/marketplace/plugins/litcodex/skills/lit-typographic-motion/engine/stage-worker.mjs +7 -4
  268. package/marketplace/plugins/litcodex/skills/lit-typographic-motion/engine/stage.mjs +96 -10
  269. package/marketplace/plugins/litcodex/skills/lit-typographic-motion/engine/styles.mjs +233 -0
  270. package/marketplace/plugins/litcodex/skills/lit-typographic-motion/engine/treatment.mjs +291 -14
  271. package/marketplace/plugins/litcodex/skills/lit-typographic-motion/engine/vendor/three/LICENSE +21 -0
  272. package/marketplace/plugins/litcodex/skills/lit-typographic-motion/engine/vendor/three/addons/environments/RoomEnvironment.js +144 -0
  273. package/marketplace/plugins/litcodex/skills/lit-typographic-motion/engine/vendor/three/addons/geometries/RoundedBoxGeometry.js +155 -0
  274. package/marketplace/plugins/litcodex/skills/lit-typographic-motion/engine/vendor/three/three.module.js +54571 -0
  275. package/marketplace/plugins/litcodex/skills/lit-typographic-motion/recipes/hero-3d/expected.json +33 -0
  276. package/marketplace/plugins/litcodex/skills/lit-typographic-motion/recipes/hero-3d/index.html +139 -0
  277. package/marketplace/plugins/litcodex/skills/lit-typographic-motion/references/cover.md +44 -7
  278. package/marketplace/plugins/litcodex/skills/lit-typographic-motion/references/depth.md +156 -0
  279. package/marketplace/plugins/litcodex/skills/lit-typographic-motion/references/design-choice.md +22 -0
  280. package/marketplace/plugins/litcodex/skills/lit-typographic-motion/references/quality-gate.md +29 -7
  281. package/marketplace/plugins/litcodex/skills/lit-typographic-motion/references/runtime.md +1 -1
  282. package/marketplace/plugins/litcodex/skills/lit-typographic-motion/references/sound.md +87 -0
  283. package/marketplace/plugins/litcodex/skills/lit-typographic-motion/references/stage.md +19 -7
  284. package/marketplace/plugins/litcodex/skills/lit-typographic-motion/references/studio.md +246 -0
  285. package/marketplace/plugins/litcodex/skills/lit-typographic-motion/references/style-bibles.md +2 -2
  286. package/marketplace/plugins/litcodex/skills/lit-typographic-motion/references/treatment.md +41 -21
  287. package/marketplace/plugins/litcodex/skills/lit-typographic-motion/runtime/requirements-audio.txt +3 -3
  288. package/marketplace/plugins/litcodex/skills/lit-typographic-motion/scripts/render.mjs +51 -4
  289. package/marketplace/plugins/litcodex/skills/lit-typographic-motion/styles/paper.json +185 -0
  290. package/marketplace/plugins/litcodex/skills/lit-typographic-motion/styles/swiss-signal.json +188 -0
  291. package/marketplace/plugins/litcodex/skills/lit-typographic-motion/styles/terminalcore.json +182 -0
  292. package/marketplace/plugins/litcodex/skills/lit-typographic-motion/styles/tidal.json +187 -0
  293. package/marketplace/plugins/litcodex/skills/litresearch/SKILL.md +7 -0
  294. package/marketplace/plugins/litcodex/skills/litwork/SKILL.md +2 -1
  295. package/marketplace/plugins/litcodex/skills/lsp-setup/SKILL.md +2 -1
  296. package/marketplace/plugins/litcodex/skills/readme-studio/SKILL.md +10 -0
  297. package/marketplace/plugins/litcodex/skills/readme-studio/templates/hyperframes-cover/package-lock.json +3 -3
  298. package/marketplace/plugins/litcodex/skills/readme-studio/templates/remotion-cover/package-lock.json +3 -3
  299. package/marketplace/plugins/litcodex/skills/review-work/SKILL.md +7 -1
  300. package/marketplace/plugins/litcodex/skills/start-work/SKILL.md +10 -0
  301. package/node_modules/@litcodex/lit-loop/directive.md +10 -4
  302. package/node_modules/@litcodex/lit-loop/directives/lit-adhd.md +191 -0
  303. package/node_modules/@litcodex/lit-loop/directives/lit-handoff.md +2 -0
  304. package/node_modules/@litcodex/lit-loop/directives/lit-hijack.md +219 -0
  305. package/node_modules/@litcodex/lit-loop/directives/lit-recap.md +2 -0
  306. package/node_modules/@litcodex/lit-loop/directives/lit-schematic.md +199 -0
  307. package/node_modules/@litcodex/lit-loop/directives/litwork.md +2 -1
  308. package/node_modules/@litcodex/lit-loop/dist/adhd-suggest.d.ts +10 -0
  309. package/node_modules/@litcodex/lit-loop/dist/adhd-suggest.js +67 -0
  310. package/node_modules/@litcodex/lit-loop/dist/card-html.d.ts +1 -1
  311. package/node_modules/@litcodex/lit-loop/dist/card-html.js +128 -8
  312. package/node_modules/@litcodex/lit-loop/dist/card-looks.d.ts +19 -0
  313. package/node_modules/@litcodex/lit-loop/dist/card-looks.js +58 -0
  314. package/node_modules/@litcodex/lit-loop/dist/card-status.d.ts +27 -0
  315. package/node_modules/@litcodex/lit-loop/dist/card-status.js +94 -7
  316. package/node_modules/@litcodex/lit-loop/dist/cli.js +13 -3
  317. package/node_modules/@litcodex/lit-loop/dist/codex-hook.d.ts +2 -0
  318. package/node_modules/@litcodex/lit-loop/dist/codex-hook.js +8 -9
  319. package/node_modules/@litcodex/lit-loop/dist/control-chars.d.ts +5 -0
  320. package/node_modules/@litcodex/lit-loop/dist/control-chars.js +23 -0
  321. package/node_modules/@litcodex/lit-loop/dist/hook-cli.d.ts +8 -0
  322. package/node_modules/@litcodex/lit-loop/dist/hook-cli.js +118 -11
  323. package/node_modules/@litcodex/lit-loop/dist/hud.d.ts +1 -1
  324. package/node_modules/@litcodex/lit-loop/dist/hud.js +29 -13
  325. package/node_modules/@litcodex/lit-loop/dist/lane-events.d.ts +13 -0
  326. package/node_modules/@litcodex/lit-loop/dist/lane-events.js +85 -0
  327. package/node_modules/@litcodex/lit-loop/dist/lane-state.d.ts +55 -0
  328. package/node_modules/@litcodex/lit-loop/dist/lane-state.js +227 -0
  329. package/node_modules/@litcodex/lit-loop/dist/live-step.d.ts +5 -1
  330. package/node_modules/@litcodex/lit-loop/dist/live-step.js +17 -1
  331. package/node_modules/@litcodex/lit-loop/dist/markers.d.ts +6 -0
  332. package/node_modules/@litcodex/lit-loop/dist/markers.js +6 -0
  333. package/node_modules/@litcodex/lit-loop/dist/modes.d.ts +1 -1
  334. package/node_modules/@litcodex/lit-loop/dist/modes.js +25 -1
  335. package/node_modules/@litcodex/lit-loop/dist/motion-gate.d.ts +79 -0
  336. package/node_modules/@litcodex/lit-loop/dist/motion-gate.js +310 -0
  337. package/node_modules/@litcodex/lit-loop/dist/motion-route.js +5 -1
  338. package/node_modules/@litcodex/lit-loop/dist/plan-persistence.js +10 -0
  339. package/node_modules/@litcodex/lit-loop/dist/redaction.js +18 -0
  340. package/node_modules/@litcodex/lit-loop/dist/reentry.d.ts +15 -0
  341. package/node_modules/@litcodex/lit-loop/dist/reentry.js +46 -9
  342. package/node_modules/@litcodex/lit-loop/dist/rewind-cli.d.ts +10 -0
  343. package/node_modules/@litcodex/lit-loop/dist/rewind-cli.js +88 -0
  344. package/node_modules/@litcodex/lit-loop/dist/rewind-go.d.ts +20 -0
  345. package/node_modules/@litcodex/lit-loop/dist/rewind-go.js +84 -0
  346. package/node_modules/@litcodex/lit-loop/dist/rewind-look.d.ts +6 -0
  347. package/node_modules/@litcodex/lit-loop/dist/rewind-look.js +41 -0
  348. package/node_modules/@litcodex/lit-loop/dist/rewind-redact.d.ts +3 -0
  349. package/node_modules/@litcodex/lit-loop/dist/rewind-redact.js +40 -0
  350. package/node_modules/@litcodex/lit-loop/dist/rewind-rollout.d.ts +48 -0
  351. package/node_modules/@litcodex/lit-loop/dist/rewind-rollout.js +292 -0
  352. package/node_modules/@litcodex/lit-loop/dist/rewind.d.ts +162 -0
  353. package/node_modules/@litcodex/lit-loop/dist/rewind.js +773 -0
  354. package/node_modules/@litcodex/lit-loop/dist/route-heads.js +44 -2
  355. package/node_modules/@litcodex/lit-loop/dist/run-panel.js +1 -0
  356. package/node_modules/@litcodex/lit-loop/dist/schematic-route.d.ts +6 -0
  357. package/node_modules/@litcodex/lit-loop/dist/schematic-route.js +35 -0
  358. package/node_modules/@litcodex/lit-loop/dist/screen-card.d.ts +3 -0
  359. package/node_modules/@litcodex/lit-loop/dist/screen-card.js +15 -5
  360. package/node_modules/@litcodex/lit-loop/dist/skill-mention-scope.js +6 -0
  361. package/node_modules/@litcodex/lit-loop/dist/stack-hook.d.ts +8 -0
  362. package/node_modules/@litcodex/lit-loop/dist/stack-hook.js +57 -0
  363. package/node_modules/@litcodex/lit-loop/dist/statusline.js +8 -3
  364. package/node_modules/@litcodex/lit-loop/dist/threads.d.ts +50 -0
  365. package/node_modules/@litcodex/lit-loop/dist/threads.js +178 -0
  366. package/node_modules/@litcodex/lit-loop/dist/trigger.d.ts +1 -1
  367. package/node_modules/@litcodex/lit-loop/dist/trigger.js +31 -6
  368. package/node_modules/@litcodex/lit-loop/dist/workflow-map.d.ts +10 -0
  369. package/node_modules/@litcodex/lit-loop/dist/workflow-map.js +11 -1
  370. package/node_modules/@litcodex/lit-loop/dist/workflow-stack.d.ts +132 -0
  371. package/node_modules/@litcodex/lit-loop/dist/workflow-stack.js +488 -0
  372. package/node_modules/@litcodex/lit-loop/package.json +1 -1
  373. package/node_modules/@litcodex/lit-loop/skills/lit-adhd/SKILL.md +181 -0
  374. package/node_modules/@litcodex/lit-loop/skills/lit-hijack/SKILL.md +449 -0
  375. package/node_modules/@litcodex/lit-loop/skills/lit-loop/SKILL.md +13 -4
  376. package/node_modules/@litcodex/lit-loop/skills/lit-plan/SKILL.md +6 -0
  377. package/node_modules/@litcodex/lit-loop/skills/lit-recap/SKILL.md +2 -0
  378. package/node_modules/@litcodex/lit-loop/skills/lit-schematic/SKILL.md +198 -0
  379. package/node_modules/@litcodex/lit-loop/skills/lit-scientific-visualization/SKILL.md +34 -8
  380. package/node_modules/@litcodex/lit-loop/skills/litresearch/SKILL.md +7 -0
  381. package/node_modules/@litcodex/lit-loop/skills/litwork/SKILL.md +2 -1
  382. package/node_modules/@litcodex/lit-loop/skills/review-work/SKILL.md +7 -1
  383. package/node_modules/@litcodex/lit-loop/skills/start-work/SKILL.md +10 -0
  384. package/package.json +2 -2
  385. package/readme-assets/badge-version.svg +1 -1
  386. package/readme-assets/skills/lit-adhd.webp +0 -0
  387. package/readme-assets/skills/lit-hijack.webp +0 -0
  388. package/readme-assets/skills/lit-schematic.webp +0 -0
@@ -1,14 +1,17 @@
1
1
  // Sound for both render paths. The generated bed is pure code: a tempo grid, a pulse on every beat
2
2
  // and a pad that plays a chord progression changing on the film's cuts, in one of four documented
3
- // timbre palettes, plus accents only where a treatment beat's `sound` asks for one. It is measured
4
- // with ITU-R BS.1770-4 integrated loudness in product code and normalized to -16 LUFS with a peak
5
- // at or under -2 dBFS. Supplied and authored tracks are fitted to the picture with ffmpeg (padded
6
- // or trimmed, 50 ms fade) and always muxed. Nothing here touches the network or model weights.
3
+ // timbre palettes, plus accents only where a treatment beat's `sound` asks for one and one sound
4
+ // per on-screen event (`sound.events`). The `score` mode (score.mjs) is the layered per-film track
5
+ // of a rich film. Both built tracks end in `masterTo`: ITU-R BS.1770-4 integrated loudness measured
6
+ // in product code, a gain to -16 LUFS and a lookahead limiter that keeps the sample peak at or
7
+ // under -2 dBFS. Supplied and authored tracks are fitted to the picture with ffmpeg (padded or
8
+ // trimmed, 50 ms fade) and always muxed. Nothing here touches the network or model weights.
7
9
  import { spawnSync } from "node:child_process";
8
10
  import { existsSync, mkdirSync, readFileSync, writeFileSync } from "node:fs";
9
11
  import { isAbsolute, join, resolve } from "node:path";
10
- import { EXIT, Exit, SOUND_PALETTES } from "./constants.mjs";
12
+ import { EVENT_SOUNDS, EXIT, Exit, SOUND_PALETTES } from "./constants.mjs";
11
13
  import { ffmpegProbe, firstLine } from "./runtime.mjs";
14
+ import { writeScore } from "./score.mjs";
12
15
  import { fnv1a32, mulberry32 } from "./util.mjs";
13
16
 
14
17
  export const SOUND = Object.freeze({
@@ -16,6 +19,9 @@ export const SOUND = Object.freeze({
16
19
  targetLufs: -16,
17
20
  lufsTolerance: 2,
18
21
  bedPeakDb: -2,
22
+ limiterCeilingDb: -2.1,
23
+ limiterLookaheadSec: 0.005,
24
+ limiterReleaseSec: 0.08,
19
25
  muxPeakDb: -0.5,
20
26
  silenceDb: -50,
21
27
  silenceWindowSec: 0.05,
@@ -187,6 +193,77 @@ const ACCENTS = [
187
193
  /** Accent kinds a beat's `sound` field asks for. */
188
194
  export const accentsFor = (text) => ACCENTS.filter(([, pattern]) => pattern.test(String(text ?? ""))).map(([kind]) => kind);
189
195
 
196
+ const onePole = (cutoffHz, sr = SOUND.sampleRate) => 1 - Math.exp((-2 * Math.PI * Math.max(1, cutoffHz)) / sr);
197
+ const round4 = (x) => Math.round(x * 1e4) / 1e4;
198
+
199
+ /**
200
+ * One `event` cue per on-screen event (treatment `sound.events`) at the event's own time: an event
201
+ * follows the picture, so it never snaps to a cut. `fromCut` is the distance to the nearest cut.
202
+ */
203
+ export function eventCues({ events, durationSec, cutTimes = [], beats = [] }) {
204
+ const cues = [];
205
+ for (const e of Array.isArray(events) ? events : []) {
206
+ if (!EVENT_SOUNDS.includes(e?.kind) || !(e.t >= 0 && e.t < durationSec)) continue;
207
+ const beat = Math.max(0, beats.findIndex((b) => e.t >= Number(b.t0) && e.t < Number(b.t1)));
208
+ const near = cutTimes.reduce((best, c) => (best === null || Math.abs(e.t - c) < Math.abs(e.t - best) ? c : best), null);
209
+ cues.push({ kind: "event", sound: e.kind, t: round4(e.t), beat, cutT: round4(e.t), delta: 0, on: String(e.on ?? ""), fromCut: near === null ? null : round4(Math.abs(e.t - near)) });
210
+ }
211
+ return cues;
212
+ }
213
+
214
+ /**
215
+ * Add the sound of one event cue into the stereo buffers: a tap (a click with a pitched body: a key,
216
+ * a latch, a landing), a hit (low thump with a snap), a whoosh (air that ends on the event) or a
217
+ * chime (two notes of the key: something completes). `tonicMidi` is the key's tonic in octave 4.
218
+ */
219
+ export function drawEvent(L, R, cue, { tonicMidi, minor, rand, sr = SOUND.sampleRate }) {
220
+ const n = L.length;
221
+ const s0 = Math.round(cue.t * sr);
222
+ const put = (s, v, left = 1, right = 1) => {
223
+ if (s < 0 || s >= n) return;
224
+ L[s] += v * left;
225
+ R[s] += v * right;
226
+ };
227
+ if (cue.sound === "tap") {
228
+ const hzTap = hz(tonicMidi + 12 + (minor ? 3 : 7));
229
+ const c = onePole(4500, sr);
230
+ let f = 0;
231
+ for (let i = 0; i < Math.round(0.3 * sr); i++) {
232
+ const t = i / sr;
233
+ f += c * (rand() * 2 - 1 - f);
234
+ put(s0 + i, 1.2 * Math.exp(-t / 0.008) * f + 0.6 * Math.exp(-t / 0.07) * Math.sin(2 * Math.PI * hzTap * t), 1, 0.9);
235
+ }
236
+ } else if (cue.sound === "whoosh") {
237
+ const lead = Math.round(0.4 * sr);
238
+ const tail = Math.round(0.08 * sr);
239
+ let f = 0;
240
+ for (let i = 0; i < lead + tail; i++) {
241
+ const u = i < lead ? i / lead : 1 - (i - lead) / tail;
242
+ f += onePole(300 + 3200 * u, sr) * (rand() * 2 - 1 - f);
243
+ put(s0 - lead + i, 0.7 * u * u * f, 1 - 0.4 * u, 0.6 + 0.4 * u);
244
+ }
245
+ } else if (cue.sound === "chime") {
246
+ [[0, 12, 1, 0.6], [0.09, 19, 0.6, 1]].forEach(([delay, semis, left, right]) => {
247
+ const f0 = hz(tonicMidi + semis);
248
+ const at = s0 + Math.round(delay * sr);
249
+ for (let i = 0; i < Math.round(1.4 * sr); i++) {
250
+ const t = i / sr;
251
+ put(at + i, 0.5 * (Math.sin(2 * Math.PI * f0 * t) + 0.2 * Math.sin(2 * Math.PI * f0 * 3 * t)) * envelope(t, 0.002, 0.5), left, right);
252
+ }
253
+ });
254
+ } else {
255
+ const c = onePole(1800, sr);
256
+ let f = 0;
257
+ let ph = 0;
258
+ for (let i = 0; i < Math.round(0.6 * sr); i++) {
259
+ const t = i / sr;
260
+ f += c * (rand() * 2 - 1 - f);
261
+ ph += (2 * Math.PI * (50 + 90 * Math.exp(-t / 0.02))) / sr;
262
+ put(s0 + i, 0.55 * Math.exp(-t / 0.12) * f + 0.8 * Math.exp(-t / 0.22) * Math.sin(ph));
263
+ }
264
+ }
265
+ }
266
+
190
267
  const envelope = (t, attack, decay) => (t < 0 ? 0 : t < attack ? t / attack : Math.exp(-(t - attack) / decay));
191
268
 
192
269
  /**
@@ -337,6 +414,12 @@ export function buildBed({ treatment, frameCount, fps, cuts = null }) {
337
414
  });
338
415
  });
339
416
 
417
+ // On-screen events: each sound sits on its own event time, whatever the cuts do.
418
+ for (const cue of eventCues({ events: plan.events, durationSec: duration, cutTimes, beats })) {
419
+ cues.push(cue);
420
+ drawEvent(L, R, cue, { tonicMidi: root + 12, minor, rand: random });
421
+ }
422
+
340
423
  // Ends: a short fade in at 0 and a 50 ms fade out at the last sample, so no click lands on a cut.
341
424
  const fade = Math.round(SOUND.fadeSec * sr);
342
425
  for (let i = 0; i < Math.min(fade, n); i++) {
@@ -345,33 +428,81 @@ export function buildBed({ treatment, frameCount, fps, cuts = null }) {
345
428
  R[n - 1 - i] *= g;
346
429
  }
347
430
 
348
- const channels = normalize([L, R]);
431
+ const mastered = masterTo(L, R);
432
+ const channels = [mastered.left, mastered.right];
349
433
  const quantized = readWav(writeWav(channels, sr)).channels;
350
434
  const stats = { ...soundStats(quantized, sr), lufs: Math.round(integratedLoudness(quantized, sr) * 100) / 100, samples: n, palette: plan.palette, key: plan.key, tempo };
351
435
  cues.sort((x, y) => x.t - y.t || x.beat - y.beat || x.kind.localeCompare(y.kind));
352
436
  return { wav: writeWav(channels, sr), cues: { palette: plan.palette, key: plan.key, tempo, beatSec, cues }, stats };
353
437
  }
354
438
 
355
- /** Gain to -16 LUFS, then a soft knee that keeps the sample peak at or under -2 dBFS. */
356
- function normalize(channels) {
357
- const ceiling = 10 ** (SOUND.bedPeakDb / 20) * 0.995;
358
- const knee = ceiling * 0.6;
359
- let out = channels;
360
- for (let pass = 0; pass < 4; pass++) {
361
- const lufs = integratedLoudness(out);
362
- if (!Number.isFinite(lufs)) return out;
363
- const gain = 10 ** ((SOUND.targetLufs - lufs) / 20);
364
- out = out.map((ch) =>
365
- ch.map((x) => {
366
- const y = x * gain;
367
- const m = Math.abs(y);
368
- if (m <= knee) return y;
369
- return Math.sign(y) * (knee + (m - knee) / (1 + (m - knee) / (ceiling - knee)));
370
- }),
371
- );
372
- if (Math.abs(integratedLoudness(out) - SOUND.targetLufs) < 0.1) break;
439
+ /**
440
+ * The master stage every built track ends in: a gain to -16 LUFS through a lookahead limiter that
441
+ * keeps the sample peak at or under -2 dBFS, quantized as the WAV will be. Returns the channels,
442
+ * the gain applied and the integrated loudness.
443
+ *
444
+ * The limiter turns the gain down smoothly before a peak (5 ms lookahead, both channels linked,
445
+ * 80 ms release) instead of bending the waveform. A waveshaper adds harmonics that an AAC encode
446
+ * turns into overshoot: a peak at -2.1 dBFS in the WAV decoded above 0 dBFS from the mux.
447
+ */
448
+ export function masterTo(L, R) {
449
+ const n = L.length;
450
+ const sr = SOUND.sampleRate;
451
+ const ceiling = 10 ** (SOUND.limiterCeilingDb / 20);
452
+ const ahead = Math.max(1, Math.round(SOUND.limiterLookaheadSec * sr));
453
+ const release = 1 - Math.exp(-1 / (SOUND.limiterReleaseSec * sr));
454
+ const q = (v) => Math.round(Math.max(-1, Math.min(1, v)) * 32767) / 32767;
455
+ const render = (gain) => {
456
+ // need[s]: the gain that keeps sample s under the ceiling. held[s]: the lowest need in the
457
+ // next `ahead` samples (a monotonic deque). The release lets the gain rise slowly, and a
458
+ // moving average over `ahead` samples reaches every held value before its peak.
459
+ const need = new Float32Array(n);
460
+ for (let s = 0; s < n; s++) {
461
+ const a = Math.max(Math.abs(L[s]), Math.abs(R[s])) * gain;
462
+ need[s] = a > ceiling ? ceiling / a : 1;
463
+ }
464
+ const held = new Float32Array(n);
465
+ const deque = new Int32Array(n + ahead + 1);
466
+ let head = 0;
467
+ let tail = 0;
468
+ let next = 0;
469
+ for (let s = 0; s < n; s++) {
470
+ for (; next < Math.min(n, s + ahead + 1); next++) {
471
+ while (tail > head && need[deque[tail - 1]] >= need[next]) tail--;
472
+ deque[tail++] = next;
473
+ }
474
+ while (deque[head] < s) head++;
475
+ held[s] = need[deque[head]];
476
+ }
477
+ let env = 1;
478
+ const smooth = new Float32Array(n);
479
+ for (let s = 0; s < n; s++) {
480
+ env = Math.min(held[s], env + (1 - env) * release);
481
+ smooth[s] = env;
482
+ }
483
+ const left = new Float32Array(n);
484
+ const right = new Float32Array(n);
485
+ // The averaging window starts full of unity gain; the hard ceiling catches the first 5 ms.
486
+ let win = ahead;
487
+ for (let s = 0; s < n; s++) {
488
+ win += smooth[s] - (s >= ahead ? smooth[s - ahead] : 1);
489
+ const g = win / ahead;
490
+ left[s] = q(Math.max(-ceiling, Math.min(ceiling, L[s] * gain * g)));
491
+ right[s] = q(Math.max(-ceiling, Math.min(ceiling, R[s] * gain * g)));
492
+ }
493
+ return [left, right];
494
+ };
495
+ const first = integratedLoudness([L, R]);
496
+ if (!Number.isFinite(first)) return { left: Float32Array.from(L), right: Float32Array.from(R), gain: 1, lufs: first };
497
+ let gain = 10 ** ((SOUND.targetLufs - first) / 20);
498
+ let [left, right] = render(gain);
499
+ let lufs = integratedLoudness([left, right]);
500
+ for (let pass = 0; pass < 6 && Number.isFinite(lufs) && Math.abs(lufs - SOUND.targetLufs) > 0.05; pass++) {
501
+ gain *= 10 ** ((SOUND.targetLufs - lufs) / 20);
502
+ [left, right] = render(gain);
503
+ lufs = integratedLoudness([left, right]);
373
504
  }
374
- return out;
505
+ return { left, right, gain, lufs };
375
506
  }
376
507
 
377
508
  // ------------------------------------------------------------------------------ tracks for a render
@@ -380,9 +511,10 @@ function normalize(channels) {
380
511
  export const trackPath = (outDir, file) => (isAbsolute(file) ? file : resolve(outDir, file));
381
512
 
382
513
  /**
383
- * The WAV to mux for a render, exactly the picture's length: the generated bed (default), or the
384
- * supplied/authored track padded or trimmed with a 50 ms fade. Writes <out>/sound/ and
385
- * <out>/sound-cues.json. Returns { wav, mode, notes } with wav null when the mode is none.
514
+ * The WAV to mux for a render, exactly the picture's length: the film's score (a rich film's
515
+ * default), the generated bed (a minimal film's), or the supplied/authored track padded or trimmed
516
+ * with a 50 ms fade. Writes <out>/sound/ and <out>/sound-cues.json (the score also keeps its stems
517
+ * under <out>/sound/stems/). Returns { wav, mode, notes } with wav null when the mode is none.
386
518
  */
387
519
  export function prepareTrack({ outDir, treatment, frameCount, fps, cuts = null, supplied = null }) {
388
520
  const mode = supplied ? "supplied" : (treatment.sound?.mode ?? "generated");
@@ -390,6 +522,12 @@ export function prepareTrack({ outDir, treatment, frameCount, fps, cuts = null,
390
522
  mkdirSync(dir, { recursive: true });
391
523
  const duration = frameCount / fps;
392
524
  if (mode === "none") return { wav: null, mode, notes: ["sound: none (the user asked for silence or the channel plays muted)"] };
525
+ if (mode === "score") {
526
+ const score = writeScore({ treatment, frameCount, fps, cutTimes: cuts, dir: outDir });
527
+ const audible = score.stems.filter((x) => x.kind !== "return").length;
528
+ const stats = { peakDb: score.peakDb, lufs: score.lufs, ...soundStats(readWav(readFileSync(score.file)).channels) };
529
+ return { wav: score.file, mode, stats, notes: [`sound: score, ${score.genre} in ${score.key}, ${score.tempo} BPM, ${audible} stems kept in sound/stems/, ${score.lufs} LUFS, peak ${stats.peakDb.toFixed(2)} dBFS, sidechain ${score.sidechainDb.toFixed(1)} dB`] };
530
+ }
393
531
  if (mode === "generated") {
394
532
  const bed = buildBed({ treatment, frameCount, fps, cuts });
395
533
  const wav = join(dir, "bed.wav");
@@ -442,8 +580,10 @@ export function measureMuxed(mp4) {
442
580
  /**
443
581
  * Sound rules over the decoded muxed stream when the treatment plans sound: a stream is present,
444
582
  * its length matches the video within 0.1 s, its sample peak is at or under -0.5 dBFS, and (for a
445
- * generated bed only) the first 3 s never sit under -50 dBFS for more than 1.5 s. A failed sound
446
- * rule makes the render exit 20; the lead check is only a WARN for supplied or authored tracks.
583
+ * built track (a generated bed or a score) the first 3 s never sit under -50 dBFS for more than
584
+ * 1.5 s and the loudness stays within 2 LU of -16 LUFS (a WARN). A failed sound rule makes the
585
+ * render exit 20; the lead check is only a WARN for supplied or authored tracks, whose loudness is
586
+ * reported, not judged.
447
587
  */
448
588
  export function soundRules(measured, { mode, videoDuration }) {
449
589
  if (!mode || mode === "none") return [{ id: "SOUND-STREAM", name: "sound stream", status: "PASS", detail: "sound mode none (asked for silence or a muted channel)" }];
@@ -454,8 +594,11 @@ export function soundRules(measured, { mode, videoDuration }) {
454
594
  const off = Math.abs(measured.durationSec - videoDuration);
455
595
  rules.push({ id: "SOUND-LENGTH", name: "sound length", status: off <= SOUND.durationToleranceSec + 1e-6 ? "PASS" : "FAIL", detail: `${measured.durationSec.toFixed(3)} s against the video's ${videoDuration.toFixed(3)} s (tolerance 0.1 s)`, sound: true });
456
596
  rules.push({ id: "SOUND-PEAK", name: "sound sample peak", status: measured.peakDb <= SOUND.muxPeakDb + 1e-9 ? "PASS" : "FAIL", detail: `${measured.peakDb.toFixed(2)} dBFS (limit -0.5)`, sound: true });
597
+ const built = mode === "generated" || mode === "score";
457
598
  const quiet = measured.leadSilenceSec > SOUND.maxLeadSilenceSec + 1e-9;
458
- rules.push({ id: "SOUND-LEAD", name: "no silent opening", status: quiet ? (mode === "generated" ? "FAIL" : "WARN") : "PASS", detail: `longest stretch under -50 dBFS in the first 3 s: ${measured.leadSilenceSec.toFixed(2)} s (limit 1.5 s)`, sound: mode === "generated" });
599
+ rules.push({ id: "SOUND-LEAD", name: "no silent opening", status: quiet ? (built ? "FAIL" : "WARN") : "PASS", detail: `longest stretch under -50 dBFS in the first 3 s: ${measured.leadSilenceSec.toFixed(2)} s (limit 1.5 s)`, sound: built });
600
+ const inRange = Number.isFinite(measured.lufs) && Math.abs(measured.lufs - SOUND.targetLufs) <= SOUND.lufsTolerance + 1e-9;
601
+ rules.push({ id: "SOUND-LOUDNESS", name: "sound loudness", status: built && !inRange ? "WARN" : "PASS", detail: `${Number.isFinite(measured.lufs) ? measured.lufs : "-inf"} LUFS integrated (BS.1770-4${built ? `, target ${SOUND.targetLufs} +/- ${SOUND.lufsTolerance}` : ", reported"})` });
459
602
  return rules;
460
603
  }
461
604
 
@@ -16,6 +16,10 @@ const PASS = "PASS";
16
16
  const FAIL = "FAIL";
17
17
  const WARN = "WARN";
18
18
  const rule = (id, name, status, detail, extra = {}) => ({ id, name, status, detail, ...extra });
19
+ // Empty-frame limits (seconds, shares of the frame). FLAT-FRAME: 0.5-99.5 % luminance within 0.02, any
20
+ // colour. DEAD-AIR: under 2.5 % of the 48 px cells carry anything; the opening may build from nothing
21
+ // 0.4 s longer, the close may fade 0.6 s longer.
22
+ export const EMPTY_FRAME = Object.freeze({ flatSpread: 0.02, flatHoldSec: 1, flatEdgeSec: 1, deadBusy: 0.025, deadHoldSec: 0.5, deadOpenSec: 0.4, deadCloseSec: 0.6 });
19
23
  export const STAGE_NOT_APPLICABLE = Object.freeze(["MO-C-01 GLSL look pass", "MO-C-02 unless the page uses WebGL", "MO-C-14 glyph-mask method", "MO-D-02 frame-time p95"]);
20
24
 
21
25
  const readJsonl = (path) =>
@@ -101,7 +105,7 @@ export function evaluateStage(data) {
101
105
  }
102
106
  rules.push(rule("MO-C-09", "determinism", detStatus, detDetail));
103
107
 
104
- if (manifest.webgl?.requested) rules.push(rule("MO-C-02", "WebGL tier", manifest.webgl.ok && isSoftwareRenderer(manifest.webgl.renderer) ? PASS : FAIL, `page requested WebGL: ${manifest.webgl.renderer ?? "no context"} (software rung, labelled)`));
108
+ if (manifest.webgl?.requested) rules.push(rule("MO-C-02", "WebGL tier", manifest.webgl.ok && (manifest.rung === "gpu" || isSoftwareRenderer(manifest.webgl.renderer)) ? PASS : FAIL, `page requested WebGL: ${manifest.webgl.renderer ?? "no context"} (${manifest.rung ?? "software"} rung, labelled)`));
105
109
 
106
110
  const beat = 60 / (data.treatment?.sound?.tempo ?? TIMING.defaultBpm);
107
111
  const limit = NEAR_BLACK.runFactor * TIMING.minSceneBeats * beat;
@@ -119,9 +123,11 @@ export function evaluateStage(data) {
119
123
  }
120
124
  }
121
125
  rules.push(rule("MO-D-03", "near-black run cap", blackFault ? FAIL : PASS, blackFault ?? "no near-black run longer than 2x the 2-beat hold floor"));
126
+ rules.push(flatFrameRule(frames, fps), deadAirRule(frames, fps));
122
127
 
123
128
  const flags = (manifest.chromeFlags ?? []).join(" ");
124
- rules.push(rule("MO-A-51", "stage flag set recorded", flags === stageFlags(width, height).join(" ") ? PASS : FAIL, `chromeFlags ${flags}`));
129
+ rules.push(rule("MO-A-51", "stage flag set recorded", flags === stageFlags(width, height, process.platform, manifest.rung ?? "software").join(" ") ? PASS : FAIL, `chromeFlags ${flags}`));
130
+ if (manifest.assetUsed) rules.push(manifest.assetUsed);
125
131
  if (data.qa?.rules) rules.push(...data.qa.rules);
126
132
  else rules.push(rule("QA-TEXT", "DOM text QA", FAIL, "no text QA replay recorded"));
127
133
  rules.push(...soundRules(data.sound, { mode: data.treatment?.sound?.mode ?? manifest.sound?.mode, videoDuration: probe?.videoDuration ?? manifest.durationSec }));
@@ -132,6 +138,41 @@ export function evaluateStage(data) {
132
138
  return rules;
133
139
  }
134
140
 
141
+ /** The longest run of frames where `flagged[f]` holds and exceeds `limit` plus its edge allowance, or null. */
142
+ function longestRun(flagged, limit, allowance) {
143
+ let worst = null;
144
+ let start = -1;
145
+ for (let f = 0; f <= flagged.length; f++) {
146
+ if (f < flagged.length && flagged[f]) {
147
+ if (start < 0) start = f;
148
+ continue;
149
+ }
150
+ if (start < 0) continue;
151
+ const length = f - start;
152
+ if (length > limit + allowance(start === 0, f === flagged.length) && (!worst || length > worst.length)) worst = { length, from: start };
153
+ start = -1;
154
+ }
155
+ return worst;
156
+ }
157
+
158
+ /** FLAT-FRAME: a frame of any colour with nothing on it. MO-D-03 sees only black; a cream frame is as empty. */
159
+ export function flatFrameRule(frames, fps) {
160
+ if (!frames.length || frames.some((f) => typeof f.p005 !== "number" || typeof f.p995 !== "number")) return rule("FLAT-FRAME", "no empty flat frames", "N/A", "per-frame luminance spread not recorded");
161
+ const worst = longestRun(frames.map((f) => f.p995 - f.p005 < EMPTY_FRAME.flatSpread), EMPTY_FRAME.flatHoldSec * fps, (open, close) => (open || close ? EMPTY_FRAME.flatEdgeSec * fps : 0));
162
+ return worst
163
+ ? rule("FLAT-FRAME", "no empty flat frames", FAIL, `${(worst.length / fps).toFixed(2)} s of empty frames from ${(worst.from / fps).toFixed(2)} s (nothing but one flat colour; limit ${EMPTY_FRAME.flatHoldSec} s)`)
164
+ : rule("FLAT-FRAME", "no empty flat frames", PASS, `no run of empty frames longer than ${EMPTY_FRAME.flatHoldSec} s`);
165
+ }
166
+
167
+ /** DEAD-AIR: a near-empty frame, where one dot or one small object sits on the ground. */
168
+ export function deadAirRule(frames, fps) {
169
+ if (!frames.length || frames.some((f) => typeof f.busy !== "number")) return rule("DEAD-AIR", "no near-empty run", "N/A", "per-frame busy share not recorded");
170
+ const worst = longestRun(frames.map((f) => f.busy < EMPTY_FRAME.deadBusy), EMPTY_FRAME.deadHoldSec * fps, (open, close) => (open ? EMPTY_FRAME.deadOpenSec * fps : 0) + (close ? EMPTY_FRAME.deadCloseSec * fps : 0));
171
+ return worst
172
+ ? rule("DEAD-AIR", "no near-empty run", FAIL, `${(worst.length / fps).toFixed(2)} s of near-empty frames from ${(worst.from / fps).toFixed(2)} s (under ${EMPTY_FRAME.deadBusy * 100} % of the frame carries anything; limit ${EMPTY_FRAME.deadHoldSec} s)`)
173
+ : rule("DEAD-AIR", "no near-empty run", PASS, `no near-empty run longer than ${EMPTY_FRAME.deadHoldSec} s`);
174
+ }
175
+
135
176
  export const stagePassed = (rules) => rules.every((r) => r.status !== FAIL);
136
177
 
137
178
  /** The stage render report. "QA gate: PASS|FAIL" is the line the done-check reads. */
@@ -139,7 +180,8 @@ export function renderStageReport({ manifest, rules, outputs, round, framesViewe
139
180
  const lines = ["lit-typographic-motion — stage render report"];
140
181
  lines.push(`outputs: ${outputs.mp4} · ${outputs.preview} (encoder: ${manifest.previewEncoder ?? "none"}) · ${outputs.poster} · ${outputs.still}`);
141
182
  lines.push(`path: stage · format ${manifest.format} ${manifest.width}x${manifest.height} @ ${manifest.fps} fps · ${manifest.durationSec} s (treatment ${manifest.targetDurationSec} s)`);
142
- lines.push(`capture: software rung ${manifest.renderer ?? "(no WebGL requested)"} · per frame p50 ${manifest.timing?.p50Ms ?? "?"} ms, p95 ${manifest.timing?.p95Ms ?? "?"} ms · master ${manifest.timing?.masterSec ?? "?"} s, determinism and text QA replays ${manifest.timing?.replaysSec ?? "?"} s, total ${manifest.timing?.totalSec ?? "?"} s`);
183
+ lines.push(`capture: ${manifest.rung ?? "software"} rung ${manifest.renderer ?? "(no WebGL requested)"} · per frame p50 ${manifest.timing?.p50Ms ?? "?"} ms, p95 ${manifest.timing?.p95Ms ?? "?"} ms · master ${manifest.timing?.masterSec ?? "?"} s, determinism and text QA replays ${manifest.timing?.replaysSec ?? "?"} s, total ${manifest.timing?.totalSec ?? "?"} s`);
184
+ if (manifest.plate) lines.push(`plate: Blender ${manifest.plate.blender}, ${manifest.plate.engine} ${manifest.plate.device}, ${manifest.plate.samples} spp, ${manifest.plate.frames} frames at ${manifest.plate.fps} fps`);
143
185
  lines.push("");
144
186
  const failed = rules.some((r) => r.status === "FAIL");
145
187
  lines.push(`QA gate: ${failed ? "FAIL" : "PASS"}${stage === "stills" ? " (stills only; nothing encoded)" : ""}${withheld ? " (render withheld: exports moved to withheld/ as diagnostics, not deliverables)" : ""}`);
@@ -488,6 +488,104 @@
488
488
  /** #RRGGBB plus alpha as an rgba() string. */
489
489
  const alpha = (hex, a) => `rgba(${parseHex(hex).join(", ")}, ${clamp(a)})`;
490
490
 
491
+ // ---------------------------------------------------------------- the house style and the shot timeline
492
+
493
+ // The renderer serves both as /lit/style.js (window.LitStyle, window.LitTimeline), written from the
494
+ // treatment, so the page and the gate read one timeline and one set of zones. Read lazily: the page
495
+ // may load style.js before or after this kit.
496
+ const styleData = () => {
497
+ if (!global.LitStyle) throw new Error("LitStage: load /lit/style.js before the style helpers");
498
+ return global.LitStyle;
499
+ };
500
+ const timelineData = () => {
501
+ if (!global.LitTimeline) throw new Error("LitStage: load /lit/style.js before the shot helpers");
502
+ return global.LitTimeline;
503
+ };
504
+ const tokenCache = new WeakMap();
505
+ /**
506
+ * The style's motion tokens as functions: eases, durations, staggers, and a spring per object class
507
+ * built from its damping ratio and frequency (spring.panel(t) rises 0 -> 1).
508
+ */
509
+ function tokens() {
510
+ const style = styleData();
511
+ if (tokenCache.has(style)) return tokenCache.get(style);
512
+ const m = style.motion;
513
+ const springOf = ({ zeta, hz }) => {
514
+ const stiffness = (2 * Math.PI * hz) ** 2;
515
+ return (t, options = {}) => spring(t, { stiffness, damping: 2 * zeta * Math.sqrt(stiffness), ...options });
516
+ };
517
+ const value = Object.freeze({
518
+ ease: Object.freeze({ enter: cubicBezier(...m.ease.enter), move: cubicBezier(...m.ease.move), exit: cubicBezier(...m.ease.exit) }),
519
+ dur: Object.freeze({ ...m.dur }),
520
+ stagger: Object.freeze({ ...m.stagger }),
521
+ spring: Object.freeze(Object.fromEntries(Object.entries(m.spring).map(([k, v]) => [k, springOf(v)]))),
522
+ secondary: Object.freeze({ ...m.secondary }),
523
+ ambient: Object.freeze({ ...m.ambient }),
524
+ push: m.push,
525
+ });
526
+ tokenCache.set(style, value);
527
+ return value;
528
+ }
529
+ /**
530
+ * The shot at time t: index, beat, layout, local seconds and progress, plus an entrance and an exit
531
+ * on the style's eases (enter(delay, dur) rises 0 -> 1, exit(dur) rises 0 -> 1 at the shot's end).
532
+ */
533
+ function shot(t) {
534
+ const beats = timelineData().beats;
535
+ let i = beats.findIndex((b) => t >= b.t0 && t < b.t1);
536
+ if (i < 0) i = t < beats[0].t0 ? 0 : beats.length - 1;
537
+ const b = beats[i];
538
+ const length = b.t1 - b.t0;
539
+ const tk = tokens();
540
+ return {
541
+ index: i,
542
+ beat: b,
543
+ layout: b.layout,
544
+ transition: b.transition,
545
+ local: t - b.t0,
546
+ length,
547
+ p: clamp((t - b.t0) / length),
548
+ enter: (delay = 0, dur = tk.dur.hero) => at(t, b.t0 + delay, dur, tk.ease.enter),
549
+ exit: (dur = tk.dur.exit) => at(t, b.t1 - dur, dur, tk.ease.exit),
550
+ };
551
+ }
552
+ /** A layout zone in pixels ({x, y, w, h}) for this film's format. */
553
+ function zone(layout, part = "type") {
554
+ const z = styleData().zones[layout];
555
+ if (!z) throw new Error(`LitStage.zone: unknown layout ${layout}`);
556
+ if (!z[part]) throw new Error(`LitStage.zone: the ${layout} layout has no ${part} zone`);
557
+ return { ...z[part] };
558
+ }
559
+ /** Absolutely position an element on a layout zone; returns the zone. */
560
+ function place(el, layout, part = "type") {
561
+ const z = zone(layout, part);
562
+ Object.assign(el.style, { position: "absolute", left: `${z.x}px`, top: `${z.y}px`, width: `${z.w}px`, height: `${z.h}px`, boxSizing: "border-box" });
563
+ return z;
564
+ }
565
+ /**
566
+ * The Blender plate (render3d: "blender"): a full-frame <img> behind the type showing the plate
567
+ * frame for t. The element is replaced on every frame change, so the renderer waits for its decode
568
+ * before the capture. Returns update(t); call it from render(t).
569
+ */
570
+ function plate({ parent, fps = 30, count, dir = "plate" } = {}) {
571
+ if (!parent || !(count > 0)) throw new Error("LitStage.plate: needs { parent, count } (count: the frames in plate/plate.json)");
572
+ let shown = -1;
573
+ let el = null;
574
+ return (t) => {
575
+ const i = Math.min(count - 1, Math.max(0, Math.floor(t * fps + 1e-6)));
576
+ if (i === shown) return i;
577
+ const next = document.createElement("img");
578
+ next.src = `${dir}/${String(i + 1).padStart(6, "0")}.png`;
579
+ next.alt = "";
580
+ Object.assign(next.style, { position: "absolute", inset: "0", width: "100%", height: "100%", objectFit: "cover" });
581
+ if (el) el.replaceWith(next);
582
+ else parent.prepend(next);
583
+ el = next;
584
+ shown = i;
585
+ return i;
586
+ };
587
+ }
588
+
491
589
  // ---------------------------------------------------------------- contract and text
492
590
 
493
591
  /**
@@ -511,5 +609,5 @@
511
609
  return config;
512
610
  }
513
611
 
514
- global.LitStage = Object.freeze({ define, text, ease, cubicBezier, spring, kf, at, stagger, seq, rand, splitText, drawPath, morph, clip, maskSweep, mix, alpha, clamp, lerp, invLerp, remap });
612
+ global.LitStage = Object.freeze({ define, text, ease, cubicBezier, spring, kf, at, stagger, seq, rand, splitText, drawPath, morph, clip, maskSweep, mix, alpha, clamp, lerp, invLerp, remap, shot, zone, place, tokens, plate });
515
613
  })(window);
@@ -59,6 +59,10 @@
59
59
  const scale = scaleOf(el);
60
60
  const fontSize = Number.parseFloat(cs.fontSize) || 16;
61
61
  const clipText = cs.webkitBackgroundClip === "text" || cs.backgroundClip === "text";
62
+ // Colour and face as the text is painted (SVG text paints with its fill): the first family of
63
+ // the stack is what the house-style rule compares with the style's faces.
64
+ const color = el instanceof SVGElement ? cs.fill : cs.color;
65
+ const family = String(cs.fontFamily || "").split(",")[0].trim().replace(/^["']|["']$/gu, "");
62
66
  if (mark) el.setAttribute("data-lit-qa-run", String(index));
63
67
  return {
64
68
  index,
@@ -68,6 +72,8 @@
68
72
  fontSizePx: fontSize * scale,
69
73
  weight: Number.parseInt(cs.fontWeight, 10) || 400,
70
74
  gradient: clipText && cs.backgroundImage !== "none",
75
+ color,
76
+ family,
71
77
  decor: el.closest('[data-lit-text="decor"]') !== null,
72
78
  marked: el.closest("[data-lit-text]")?.dataset.litText ?? null,
73
79
  tag: el.tagName.toLowerCase(),
@@ -102,7 +108,8 @@
102
108
  const match = /^["'](.*)["']$/su.exec(content ?? "");
103
109
  if (!match || !match[1].trim()) continue;
104
110
  const r = el.getBoundingClientRect();
105
- out.push(describe(el, match[1].trim(), [[r.left, r.top, r.right, r.bottom]], out.length, false));
111
+ // A pseudo-element run reports its element's box, so the text-over-text rule skips it.
112
+ out.push({ ...describe(el, match[1].trim(), [[r.left, r.top, r.right, r.bottom]], out.length, false), pseudo: true });
106
113
  }
107
114
  }
108
115
  const canvases = [...document.querySelectorAll("canvas")].filter((c) => {