@litfamily/litcodex 1.0.38 → 1.0.39

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 (1071) hide show
  1. package/README-Ko-KR.md +29 -9
  2. package/README.md +28 -10
  3. package/dist/cli.js +0 -62
  4. package/dist/install/bundled-skill-manifests.d.ts +0 -19
  5. package/dist/install/bundled-skill-manifests.js +0 -19
  6. package/dist/install/bundled-skills.d.ts +0 -1
  7. package/dist/install/bundled-skills.js +2 -13
  8. package/dist/install/development-marketplace.js +0 -5
  9. package/dist/install/doctor-render.js +0 -1
  10. package/dist/install/doctor.js +0 -4
  11. package/dist/install/execute.d.ts +3 -0
  12. package/dist/install/execute.js +8 -1
  13. package/dist/install/extensions-notice.d.ts +27 -0
  14. package/dist/install/extensions-notice.js +57 -0
  15. package/dist/install/generated-skill-payload-hashes.d.ts +13 -948
  16. package/dist/install/generated-skill-payload-hashes.js +13 -948
  17. package/dist/install/index.js +17 -24
  18. package/dist/install/marketplace-payload.d.ts +13 -0
  19. package/dist/install/marketplace-payload.js +55 -6
  20. package/dist/install/shipped-skill-digests.d.ts +1 -0
  21. package/dist/install/shipped-skill-digests.js +1681 -0
  22. package/dist/install/skill-backup.d.ts +19 -0
  23. package/dist/install/skill-backup.js +114 -0
  24. package/dist/install/types.d.ts +0 -1
  25. package/dist/postinstall.js +2 -16
  26. package/marketplace/plugins/litcodex/.codex-plugin/plugin.json +1 -1
  27. package/marketplace/plugins/litcodex/components/auto-update/dist/cli.js +13 -4
  28. package/marketplace/plugins/litcodex/components/auto-update/dist/extensions-notice.d.ts +2 -0
  29. package/marketplace/plugins/litcodex/components/auto-update/dist/extensions-notice.js +37 -0
  30. package/marketplace/plugins/litcodex/components/auto-update/package.json +1 -1
  31. package/marketplace/plugins/litcodex/components/comment-checker/package.json +1 -1
  32. package/marketplace/plugins/litcodex/components/git-bash/package.json +1 -1
  33. package/marketplace/plugins/litcodex/components/lit-loop/directive.md +14 -5
  34. package/marketplace/plugins/litcodex/components/lit-loop/directives/lit-schematic.md +44 -128
  35. package/marketplace/plugins/litcodex/components/lit-loop/directives/lit-scientific-visualization.md +33 -83
  36. package/marketplace/plugins/litcodex/components/lit-loop/directives/litwork.md +4 -3
  37. package/marketplace/plugins/litcodex/components/lit-loop/dist/codex-hook.d.ts +0 -2
  38. package/marketplace/plugins/litcodex/components/lit-loop/dist/codex-hook.js +2 -3
  39. package/marketplace/plugins/litcodex/components/lit-loop/dist/hook-cli.d.ts +0 -3
  40. package/marketplace/plugins/litcodex/components/lit-loop/dist/hook-cli.js +0 -20
  41. package/marketplace/plugins/litcodex/components/lit-loop/dist/motion-route.d.ts +3 -9
  42. package/marketplace/plugins/litcodex/components/lit-loop/dist/motion-route.js +8 -51
  43. package/marketplace/plugins/litcodex/components/lit-loop/dist/route-heads.js +13 -18
  44. package/marketplace/plugins/litcodex/components/lit-loop/package.json +1 -1
  45. package/marketplace/plugins/litcodex/components/lsp/package.json +1 -1
  46. package/marketplace/plugins/litcodex/components/rules/package.json +1 -1
  47. package/marketplace/plugins/litcodex/components/start-work-continuation/package.json +1 -1
  48. package/marketplace/plugins/litcodex/components/telemetry/package.json +1 -1
  49. package/marketplace/plugins/litcodex/components/wikify-knowledge/package.json +1 -1
  50. package/marketplace/plugins/litcodex/skills/frontend-ui-ux/SKILL.md +32 -28
  51. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/SKILL.md +29 -133
  52. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/agents/openai.yaml +1 -1
  53. package/marketplace/plugins/litcodex/skills/lit-docx/SKILL.md +32 -73
  54. package/marketplace/plugins/litcodex/skills/lit-docx/agents/openai.yaml +1 -1
  55. package/marketplace/plugins/litcodex/skills/lit-loop/SKILL.md +15 -7
  56. package/marketplace/plugins/litcodex/skills/lit-loop/references/full-workflow.md +3 -2
  57. package/marketplace/plugins/litcodex/skills/lit-pptx/SKILL.md +32 -88
  58. package/marketplace/plugins/litcodex/skills/lit-pptx/agents/openai.yaml +1 -1
  59. package/marketplace/plugins/litcodex/skills/lit-schematic/SKILL.md +28 -152
  60. package/marketplace/plugins/litcodex/skills/lit-schematic/agents/openai.yaml +1 -1
  61. package/marketplace/plugins/litcodex/skills/lit-scientific-visualization/SKILL.md +30 -239
  62. package/marketplace/plugins/litcodex/skills/lit-scientific-visualization/agents/openai.yaml +1 -1
  63. package/marketplace/plugins/litcodex/skills/lit-typographic-motion/SKILL.md +29 -34
  64. package/marketplace/plugins/litcodex/skills/lit-typographic-motion/agents/openai.yaml +1 -1
  65. package/marketplace/plugins/litcodex/skills/litwork/SKILL.md +4 -3
  66. package/marketplace/plugins/litcodex/skills/litwork/references/delivery-playbook.md +3 -2
  67. package/marketplace/plugins/litcodex/skills/readme-studio/SKILL.md +31 -61
  68. package/marketplace/plugins/litcodex/skills/visual-qa/SKILL.md +40 -34
  69. package/marketplace/plugins/litcodex/vendor/NOTICE +7 -17
  70. package/node_modules/@litcodex/lit-loop/CHANGELOG.md +4 -0
  71. package/node_modules/@litcodex/lit-loop/README.md +4 -2
  72. package/node_modules/@litcodex/lit-loop/directive.md +14 -5
  73. package/node_modules/@litcodex/lit-loop/directives/lit-schematic.md +44 -128
  74. package/node_modules/@litcodex/lit-loop/directives/lit-scientific-visualization.md +33 -83
  75. package/node_modules/@litcodex/lit-loop/directives/litwork.md +4 -3
  76. package/node_modules/@litcodex/lit-loop/dist/codex-hook.d.ts +0 -2
  77. package/node_modules/@litcodex/lit-loop/dist/codex-hook.js +2 -3
  78. package/node_modules/@litcodex/lit-loop/dist/hook-cli.d.ts +0 -3
  79. package/node_modules/@litcodex/lit-loop/dist/hook-cli.js +0 -20
  80. package/node_modules/@litcodex/lit-loop/dist/motion-route.d.ts +3 -9
  81. package/node_modules/@litcodex/lit-loop/dist/motion-route.js +8 -51
  82. package/node_modules/@litcodex/lit-loop/dist/route-heads.js +13 -18
  83. package/node_modules/@litcodex/lit-loop/package.json +1 -1
  84. package/node_modules/@litcodex/lit-loop/skills/lit-loop/SKILL.md +15 -7
  85. package/node_modules/@litcodex/lit-loop/skills/lit-schematic/SKILL.md +28 -152
  86. package/node_modules/@litcodex/lit-loop/skills/lit-scientific-visualization/SKILL.md +30 -239
  87. package/node_modules/@litcodex/lit-loop/skills/litwork/SKILL.md +4 -3
  88. package/node_modules/@litcodex/lit-loop/vendor/NOTICE +7 -17
  89. package/package.json +2 -2
  90. package/readme-assets/badge-version.svg +1 -1
  91. package/dist/install/motion-runtime.d.ts +0 -39
  92. package/dist/install/motion-runtime.js +0 -93
  93. package/dist/install/office-runtime.d.ts +0 -20
  94. package/dist/install/office-runtime.js +0 -42
  95. package/marketplace/plugins/litcodex/components/lit-loop/dist/motion-gate.d.ts +0 -79
  96. package/marketplace/plugins/litcodex/components/lit-loop/dist/motion-gate.js +0 -310
  97. package/marketplace/plugins/litcodex/skills/frontend-ui-ux/THIRD-PARTY-NOTICE.txt +0 -5
  98. package/marketplace/plugins/litcodex/skills/frontend-ui-ux/examples/readme-ab/README.md +0 -13
  99. package/marketplace/plugins/litcodex/skills/frontend-ui-ux/kit/components.css +0 -414
  100. package/marketplace/plugins/litcodex/skills/frontend-ui-ux/kit/fonts.json +0 -22
  101. package/marketplace/plugins/litcodex/skills/frontend-ui-ux/kit/layouts/landing.html +0 -164
  102. package/marketplace/plugins/litcodex/skills/frontend-ui-ux/kit/layouts/settings.html +0 -114
  103. package/marketplace/plugins/litcodex/skills/frontend-ui-ux/kit/layouts/workspace.html +0 -115
  104. package/marketplace/plugins/litcodex/skills/frontend-ui-ux/kit/styles/computational-brutalism.json +0 -227
  105. package/marketplace/plugins/litcodex/skills/frontend-ui-ux/kit/styles/field-notes.json +0 -205
  106. package/marketplace/plugins/litcodex/skills/frontend-ui-ux/kit/styles/graphite.json +0 -200
  107. package/marketplace/plugins/litcodex/skills/frontend-ui-ux/kit/styles/meadow.json +0 -199
  108. package/marketplace/plugins/litcodex/skills/frontend-ui-ux/kit/styles/neo-brutalism.json +0 -222
  109. package/marketplace/plugins/litcodex/skills/frontend-ui-ux/kit/ui.js +0 -228
  110. package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/_canonical-corpus/ATTRIBUTION.md +0 -217
  111. package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/_canonical-corpus/LICENSE +0 -21
  112. package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/_canonical-corpus/LICENSE-Apache-2.0.txt +0 -201
  113. package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/_canonical-corpus/MANIFEST.json +0 -869
  114. package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/_canonical-corpus/PROVENANCE.md +0 -24
  115. package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/_canonical-corpus/design/README.md +0 -248
  116. package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/_canonical-corpus/design/_INDEX.md +0 -191
  117. package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/_canonical-corpus/design/airbnb.md +0 -393
  118. package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/_canonical-corpus/design/airtable.md +0 -92
  119. package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/_canonical-corpus/design/apple.md +0 -250
  120. package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/_canonical-corpus/design/aside.md +0 -209
  121. package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/_canonical-corpus/design/binance.md +0 -348
  122. package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/_canonical-corpus/design/bmw.md +0 -183
  123. package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/_canonical-corpus/design/brutalist-skill.md +0 -92
  124. package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/_canonical-corpus/design/bugatti.md +0 -271
  125. package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/_canonical-corpus/design/cal.md +0 -262
  126. package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/_canonical-corpus/design/claude.md +0 -315
  127. package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/_canonical-corpus/design/clay.md +0 -307
  128. package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/_canonical-corpus/design/clickhouse.md +0 -284
  129. package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/_canonical-corpus/design/clone-from-url.md +0 -65
  130. package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/_canonical-corpus/design/cohere.md +0 -269
  131. package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/_canonical-corpus/design/coinbase.md +0 -132
  132. package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/_canonical-corpus/design/composio.md +0 -310
  133. package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/_canonical-corpus/design/cursor.md +0 -312
  134. package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/_canonical-corpus/design/design-system-architecture.md +0 -244
  135. package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/_canonical-corpus/design/elevenlabs.md +0 -268
  136. package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/_canonical-corpus/design/expo.md +0 -284
  137. package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/_canonical-corpus/design/ferrari.md +0 -317
  138. package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/_canonical-corpus/design/figma.md +0 -223
  139. package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/_canonical-corpus/design/framer.md +0 -249
  140. package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/_canonical-corpus/design/gpt-tasteskill.md +0 -74
  141. package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/_canonical-corpus/design/hashicorp.md +0 -281
  142. package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/_canonical-corpus/design/ibm.md +0 -335
  143. package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/_canonical-corpus/design/image-to-code-skill.md +0 -1228
  144. package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/_canonical-corpus/design/imagegen-brandkit.md +0 -798
  145. package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/_canonical-corpus/design/imagegen-frontend-mobile.md +0 -1465
  146. package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/_canonical-corpus/design/imagegen-frontend-web.md +0 -987
  147. package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/_canonical-corpus/design/intercom.md +0 -149
  148. package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/_canonical-corpus/design/kraken.md +0 -128
  149. package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/_canonical-corpus/design/lamborghini.md +0 -291
  150. package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/_canonical-corpus/design/layout-skill.md +0 -107
  151. package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/_canonical-corpus/design/lazyweb.md +0 -77
  152. package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/_canonical-corpus/design/linear.app.md +0 -370
  153. package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/_canonical-corpus/design/lovable.md +0 -301
  154. package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/_canonical-corpus/design/mastercard.md +0 -368
  155. package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/_canonical-corpus/design/meta.md +0 -369
  156. package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/_canonical-corpus/design/minimalist-skill.md +0 -85
  157. package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/_canonical-corpus/design/minimax.md +0 -260
  158. package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/_canonical-corpus/design/mintlify.md +0 -329
  159. package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/_canonical-corpus/design/miro.md +0 -111
  160. package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/_canonical-corpus/design/mistral.ai.md +0 -264
  161. package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/_canonical-corpus/design/mongodb.md +0 -269
  162. package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/_canonical-corpus/design/nike.md +0 -366
  163. package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/_canonical-corpus/design/notion.md +0 -312
  164. package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/_canonical-corpus/design/nvidia.md +0 -296
  165. package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/_canonical-corpus/design/ollama.md +0 -270
  166. package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/_canonical-corpus/design/opencode.ai.md +0 -284
  167. package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/_canonical-corpus/design/output-skill.md +0 -49
  168. package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/_canonical-corpus/design/pinterest.md +0 -233
  169. package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/_canonical-corpus/design/playstation.md +0 -367
  170. package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/_canonical-corpus/design/posthog.md +0 -259
  171. package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/_canonical-corpus/design/raycast.md +0 -271
  172. package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/_canonical-corpus/design/react-dev-tooling-skill.md +0 -230
  173. package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/_canonical-corpus/design/redesign-skill.md +0 -178
  174. package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/_canonical-corpus/design/renault.md +0 -314
  175. package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/_canonical-corpus/design/replicate.md +0 -264
  176. package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/_canonical-corpus/design/resend.md +0 -306
  177. package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/_canonical-corpus/design/revolut.md +0 -188
  178. package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/_canonical-corpus/design/runwayml.md +0 -247
  179. package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/_canonical-corpus/design/sanity.md +0 -360
  180. package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/_canonical-corpus/design/sentry.md +0 -265
  181. package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/_canonical-corpus/design/shopify.md +0 -353
  182. package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/_canonical-corpus/design/soft-skill.md +0 -98
  183. package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/_canonical-corpus/design/spacex.md +0 -197
  184. package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/_canonical-corpus/design/spotify.md +0 -249
  185. package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/_canonical-corpus/design/starbucks.md +0 -583
  186. package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/_canonical-corpus/design/stitch-design-example.md +0 -121
  187. package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/_canonical-corpus/design/stitch-skill.md +0 -184
  188. package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/_canonical-corpus/design/stripe.md +0 -325
  189. package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/_canonical-corpus/design/supabase.md +0 -258
  190. package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/_canonical-corpus/design/superhuman.md +0 -255
  191. package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/_canonical-corpus/design/taste-skill.md +0 -1206
  192. package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/_canonical-corpus/design/tesla.md +0 -289
  193. package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/_canonical-corpus/design/theverge.md +0 -342
  194. package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/_canonical-corpus/design/together.ai.md +0 -266
  195. package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/_canonical-corpus/design/uber.md +0 -298
  196. package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/_canonical-corpus/design/vercel.md +0 -313
  197. package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/_canonical-corpus/design/vodafone.md +0 -426
  198. package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/_canonical-corpus/design/voltagent.md +0 -326
  199. package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/_canonical-corpus/design/warp.md +0 -256
  200. package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/_canonical-corpus/design/webflow.md +0 -95
  201. package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/_canonical-corpus/design/wired.md +0 -281
  202. package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/_canonical-corpus/design/wise.md +0 -176
  203. package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/_canonical-corpus/design/x.ai.md +0 -260
  204. package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/_canonical-corpus/design/zapier.md +0 -331
  205. package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/_canonical-corpus/designpowers/EVIDENCE.md +0 -97
  206. package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/_canonical-corpus/designpowers/README.md +0 -48
  207. package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/_canonical-corpus/designpowers/UPSTREAM.md +0 -80
  208. package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/_canonical-corpus/designpowers/lane-a-direction.md +0 -64
  209. package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/_canonical-corpus/designpowers/lane-b-execution.md +0 -65
  210. package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/_canonical-corpus/designpowers/lane-c-review.md +0 -65
  211. package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/_canonical-corpus/designpowers/lane-d-memory.md +0 -83
  212. package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/_canonical-corpus/designpowers/orchestration.md +0 -80
  213. package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/_canonical-corpus/designpowers/routing.md +0 -79
  214. package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/_canonical-corpus/designpowers/vendor/LICENSE +0 -21
  215. package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/_canonical-corpus/designpowers/vendor/agents/accessibility-reviewer.md +0 -83
  216. package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/_canonical-corpus/designpowers/vendor/agents/content-writer.md +0 -132
  217. package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/_canonical-corpus/designpowers/vendor/agents/design-builder.md +0 -109
  218. package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/_canonical-corpus/designpowers/vendor/agents/design-critic.md +0 -89
  219. package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/_canonical-corpus/designpowers/vendor/agents/design-lead.md +0 -113
  220. package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/_canonical-corpus/designpowers/vendor/agents/design-scout.md +0 -78
  221. package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/_canonical-corpus/designpowers/vendor/agents/design-strategist.md +0 -121
  222. package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/_canonical-corpus/designpowers/vendor/agents/heuristic-evaluator.md +0 -268
  223. package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/_canonical-corpus/designpowers/vendor/agents/inspiration-scout.md +0 -107
  224. package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/_canonical-corpus/designpowers/vendor/agents/motion-designer.md +0 -120
  225. package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/_canonical-corpus/designpowers/vendor/skills/accessible-content/reference.md +0 -101
  226. package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/_canonical-corpus/designpowers/vendor/skills/adaptive-interfaces/reference.md +0 -109
  227. package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/_canonical-corpus/designpowers/vendor/skills/cognitive-accessibility/reference.md +0 -107
  228. package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/_canonical-corpus/designpowers/vendor/skills/design-debate/reference.md +0 -199
  229. package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/_canonical-corpus/designpowers/vendor/skills/design-debt-tracker/reference.md +0 -174
  230. package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/_canonical-corpus/designpowers/vendor/skills/design-handoff/reference.md +0 -125
  231. package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/_canonical-corpus/designpowers/vendor/skills/design-md/reference.md +0 -106
  232. package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/_canonical-corpus/designpowers/vendor/skills/design-retrospective/reference.md +0 -266
  233. package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/_canonical-corpus/designpowers/vendor/skills/design-review/reference.md +0 -123
  234. package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/_canonical-corpus/designpowers/vendor/skills/design-system-alignment/reference.md +0 -120
  235. package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/_canonical-corpus/designpowers/vendor/skills/designpowers-critique/reference.md +0 -164
  236. package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/_canonical-corpus/designpowers/vendor/skills/heuristic-evaluation/reference.md +0 -85
  237. package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/_canonical-corpus/designpowers/vendor/skills/inclusive-personas/reference.md +0 -98
  238. package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/_canonical-corpus/designpowers/vendor/skills/inspiration-scouting/reference.md +0 -165
  239. package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/_canonical-corpus/designpowers/vendor/skills/interaction-design/reference.md +0 -122
  240. package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/_canonical-corpus/designpowers/vendor/skills/motion-choreography/reference.md +0 -81
  241. package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/_canonical-corpus/designpowers/vendor/skills/research-planning/reference.md +0 -96
  242. package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/_canonical-corpus/designpowers/vendor/skills/responsive-patterns/reference.md +0 -77
  243. package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/_canonical-corpus/designpowers/vendor/skills/synthetic-user-testing/reference.md +0 -192
  244. package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/_canonical-corpus/designpowers/vendor/skills/taste-feedback/reference.md +0 -165
  245. package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/_canonical-corpus/designpowers/vendor/skills/taste-report/reference.md +0 -78
  246. package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/_canonical-corpus/designpowers/vendor/skills/token-architecture/reference.md +0 -75
  247. package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/_canonical-corpus/designpowers/vendor/skills/ui-composition/reference.md +0 -117
  248. package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/_canonical-corpus/designpowers/vendor/skills/usability-testing/reference.md +0 -78
  249. package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/_canonical-corpus/designpowers/vendor/skills/verification-before-shipping/reference.md +0 -125
  250. package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/_canonical-corpus/designpowers/vendor/skills/voice-and-tone/reference.md +0 -79
  251. package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/_canonical-corpus/designpowers/vendor/skills/writing-design-plans/reference.md +0 -119
  252. package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/_canonical-corpus/perfection/README.md +0 -160
  253. package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/_canonical-corpus/perfection/react-perf-tooling.md +0 -127
  254. package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/_canonical-corpus/ui-ux-db/README.md +0 -659
  255. package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/_canonical-corpus/ui-ux-db/data/charts.csv +0 -26
  256. package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/_canonical-corpus/ui-ux-db/data/colors.csv +0 -162
  257. package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/_canonical-corpus/ui-ux-db/data/icons.csv +0 -106
  258. package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/_canonical-corpus/ui-ux-db/data/landing.csv +0 -35
  259. package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/_canonical-corpus/ui-ux-db/data/products.csv +0 -162
  260. package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/_canonical-corpus/ui-ux-db/data/react-performance.csv +0 -45
  261. package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/_canonical-corpus/ui-ux-db/data/stacks/astro.csv +0 -54
  262. package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/_canonical-corpus/ui-ux-db/data/stacks/flutter.csv +0 -53
  263. package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/_canonical-corpus/ui-ux-db/data/stacks/html-tailwind.csv +0 -56
  264. package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/_canonical-corpus/ui-ux-db/data/stacks/jetpack-compose.csv +0 -53
  265. package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/_canonical-corpus/ui-ux-db/data/stacks/nextjs.csv +0 -53
  266. package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/_canonical-corpus/ui-ux-db/data/stacks/nuxt-ui.csv +0 -51
  267. package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/_canonical-corpus/ui-ux-db/data/stacks/nuxtjs.csv +0 -59
  268. package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/_canonical-corpus/ui-ux-db/data/stacks/react-native.csv +0 -52
  269. package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/_canonical-corpus/ui-ux-db/data/stacks/react.csv +0 -54
  270. package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/_canonical-corpus/ui-ux-db/data/stacks/shadcn.csv +0 -61
  271. package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/_canonical-corpus/ui-ux-db/data/stacks/svelte.csv +0 -54
  272. package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/_canonical-corpus/ui-ux-db/data/stacks/swiftui.csv +0 -51
  273. package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/_canonical-corpus/ui-ux-db/data/stacks/vue.csv +0 -50
  274. package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/_canonical-corpus/ui-ux-db/data/styles.csv +0 -85
  275. package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/_canonical-corpus/ui-ux-db/data/typography.csv +0 -74
  276. package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/_canonical-corpus/ui-ux-db/data/ui-reasoning.csv +0 -162
  277. package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/_canonical-corpus/ui-ux-db/data/ux-guidelines.csv +0 -100
  278. package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/_canonical-corpus/ui-ux-db/data/web-interface.csv +0 -31
  279. package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/_canonical-corpus/ui-ux-db/scripts/core.py +0 -262
  280. package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/_canonical-corpus/ui-ux-db/scripts/design_system.py +0 -1148
  281. package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/_canonical-corpus/ui-ux-db/scripts/search.py +0 -114
  282. package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/adaptive-layout.md +0 -23
  283. package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/brand-and-imagery.md +0 -29
  284. package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/canonical-library.md +0 -42
  285. package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/complete-contract.md +0 -391
  286. package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/composition.md +0 -24
  287. package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/craft-floor.md +0 -103
  288. package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/creative-directions.md +0 -20
  289. package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/default-editorial-pixel.json +0 -71
  290. package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/design-choice.md +0 -19
  291. package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/evidence-review.md +0 -29
  292. package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/house-styles.md +0 -235
  293. package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/implementation-platforms.md +0 -25
  294. package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/inclusive-interface.md +0 -23
  295. package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/interaction-motion.md +0 -27
  296. package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/motion-guide.md +0 -123
  297. package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/operating-lanes.md +0 -22
  298. package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/performance-delivery.md +0 -23
  299. package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/probe-and-review.md +0 -47
  300. package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/product-direction.md +0 -23
  301. package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/production-interview.md +0 -25
  302. package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/redesign-playbook.md +0 -29
  303. package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/slop-register.md +0 -98
  304. package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/system-foundations.md +0 -27
  305. package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/taste-direction.md +0 -27
  306. package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/visual-language.md +0 -23
  307. package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/visual-reconstruction.md +0 -19
  308. package/marketplace/plugins/litcodex/skills/frontend-ui-ux/schemas/design-contract.v1alpha1.json +0 -299
  309. package/marketplace/plugins/litcodex/skills/frontend-ui-ux/schemas/design-contract.v1beta1.json +0 -32
  310. package/marketplace/plugins/litcodex/skills/frontend-ui-ux/schemas/design-contract.v1beta2.json +0 -34
  311. package/marketplace/plugins/litcodex/skills/frontend-ui-ux/scripts/canonical-json.mjs +0 -186
  312. package/marketplace/plugins/litcodex/skills/frontend-ui-ux/scripts/design-lock.mjs +0 -400
  313. package/marketplace/plugins/litcodex/skills/frontend-ui-ux/scripts/hover-probe.mjs +0 -28
  314. package/marketplace/plugins/litcodex/skills/frontend-ui-ux/scripts/lock-probe.mjs +0 -196
  315. package/marketplace/plugins/litcodex/skills/frontend-ui-ux/scripts/page-probe.mjs +0 -441
  316. package/marketplace/plugins/litcodex/skills/frontend-ui-ux/scripts/pixel-art.mjs +0 -60
  317. package/marketplace/plugins/litcodex/skills/frontend-ui-ux/scripts/probe.mjs +0 -307
  318. package/marketplace/plugins/litcodex/skills/frontend-ui-ux/scripts/route-mode.mjs +0 -19
  319. package/marketplace/plugins/litcodex/skills/frontend-ui-ux/scripts/rule-data.mjs +0 -149
  320. package/marketplace/plugins/litcodex/skills/frontend-ui-ux/scripts/serve-static.mjs +0 -24
  321. package/marketplace/plugins/litcodex/skills/frontend-ui-ux/scripts/stable-file-read.mjs +0 -201
  322. package/marketplace/plugins/litcodex/skills/frontend-ui-ux/scripts/validate-design-contract.mjs +0 -555
  323. package/marketplace/plugins/litcodex/skills/frontend-ui-ux/scripts/verify-canonical-corpus.mjs +0 -354
  324. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/NOTICE +0 -33
  325. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/assets/examples/type-architecture-dark.html +0 -1
  326. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/assets/examples/type-architecture-full.html +0 -1
  327. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/assets/examples/type-architecture-light.html +0 -1
  328. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/assets/examples/type-bar-dark.html +0 -1
  329. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/assets/examples/type-bar-full.html +0 -1
  330. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/assets/examples/type-bar-light.html +0 -1
  331. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/assets/examples/type-beeswarm-dark.html +0 -1
  332. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/assets/examples/type-beeswarm-full.html +0 -1
  333. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/assets/examples/type-beeswarm-light.html +0 -1
  334. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/assets/examples/type-bubble-dark.html +0 -1
  335. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/assets/examples/type-bubble-full.html +0 -1
  336. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/assets/examples/type-bubble-light.html +0 -1
  337. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/assets/examples/type-bump-dark.html +0 -1
  338. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/assets/examples/type-bump-full.html +0 -1
  339. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/assets/examples/type-bump-light.html +0 -1
  340. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/assets/examples/type-data-flow-dark.html +0 -1
  341. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/assets/examples/type-data-flow-full.html +0 -1
  342. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/assets/examples/type-data-flow-light.html +0 -1
  343. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/assets/examples/type-datalake-dark.html +0 -1
  344. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/assets/examples/type-datalake-full.html +0 -1
  345. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/assets/examples/type-datalake-light.html +0 -1
  346. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/assets/examples/type-db-schema-dark.html +0 -1
  347. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/assets/examples/type-db-schema-full.html +0 -1
  348. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/assets/examples/type-db-schema-light.html +0 -1
  349. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/assets/examples/type-dependency-dark.html +0 -1
  350. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/assets/examples/type-dependency-full.html +0 -1
  351. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/assets/examples/type-dependency-light.html +0 -1
  352. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/assets/examples/type-deployment-dark.html +0 -1
  353. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/assets/examples/type-deployment-full.html +0 -1
  354. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/assets/examples/type-deployment-light.html +0 -1
  355. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/assets/examples/type-dp-integration-dark.html +0 -1
  356. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/assets/examples/type-dp-integration-full.html +0 -1
  357. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/assets/examples/type-dp-integration-light.html +0 -1
  358. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/assets/examples/type-dp-security-matrix-dark.html +0 -1
  359. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/assets/examples/type-dp-security-matrix-full.html +0 -1
  360. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/assets/examples/type-dp-security-matrix-light.html +0 -1
  361. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/assets/examples/type-er-dark.html +0 -1
  362. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/assets/examples/type-er-full.html +0 -1
  363. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/assets/examples/type-er-light.html +0 -1
  364. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/assets/examples/type-fishbone-dark.html +0 -1
  365. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/assets/examples/type-fishbone-full.html +0 -1
  366. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/assets/examples/type-fishbone-light.html +0 -1
  367. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/assets/examples/type-flowchart-dark.html +0 -1
  368. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/assets/examples/type-flowchart-full.html +0 -1
  369. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/assets/examples/type-flowchart-light.html +0 -1
  370. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/assets/examples/type-gantt-dark.html +0 -1
  371. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/assets/examples/type-gantt-full.html +0 -1
  372. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/assets/examples/type-gantt-light.html +0 -1
  373. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/assets/examples/type-heatmap-dark.html +0 -1
  374. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/assets/examples/type-heatmap-full.html +0 -1
  375. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/assets/examples/type-heatmap-light.html +0 -1
  376. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/assets/examples/type-high-level-dark.html +0 -1
  377. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/assets/examples/type-high-level-full.html +0 -1
  378. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/assets/examples/type-high-level-light.html +0 -1
  379. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/assets/examples/type-high-level-vertical-dark.html +0 -1
  380. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/assets/examples/type-high-level-vertical-full.html +0 -1
  381. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/assets/examples/type-high-level-vertical-light.html +0 -1
  382. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/assets/examples/type-import-drawio-dark.html +0 -1
  383. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/assets/examples/type-import-drawio-full.html +0 -1
  384. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/assets/examples/type-import-drawio-light.html +0 -1
  385. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/assets/examples/type-import-excalidraw-dark.html +0 -1
  386. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/assets/examples/type-import-excalidraw-full.html +0 -1
  387. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/assets/examples/type-import-excalidraw-light.html +0 -1
  388. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/assets/examples/type-import-mermaid-dark.html +0 -1
  389. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/assets/examples/type-import-mermaid-full.html +0 -1
  390. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/assets/examples/type-import-mermaid-light.html +0 -1
  391. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/assets/examples/type-it-state-dark.html +0 -1
  392. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/assets/examples/type-it-state-full.html +0 -1
  393. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/assets/examples/type-it-state-light.html +0 -1
  394. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/assets/examples/type-journey-dark.html +0 -1
  395. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/assets/examples/type-journey-full.html +0 -1
  396. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/assets/examples/type-journey-light.html +0 -1
  397. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/assets/examples/type-kanban-dark.html +0 -1
  398. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/assets/examples/type-kanban-full.html +0 -1
  399. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/assets/examples/type-kanban-light.html +0 -1
  400. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/assets/examples/type-layers-dark.html +0 -1
  401. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/assets/examples/type-layers-full.html +0 -1
  402. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/assets/examples/type-layers-light.html +0 -1
  403. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/assets/examples/type-line-dark.html +0 -1
  404. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/assets/examples/type-line-full.html +0 -1
  405. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/assets/examples/type-line-light.html +0 -1
  406. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/assets/examples/type-loop-dark.html +0 -1
  407. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/assets/examples/type-loop-full.html +0 -1
  408. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/assets/examples/type-loop-light.html +0 -1
  409. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/assets/examples/type-loop-terminal-dark.html +0 -1
  410. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/assets/examples/type-loop-terminal-full.html +0 -1
  411. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/assets/examples/type-loop-terminal-light.html +0 -1
  412. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/assets/examples/type-marimekko-dark.html +0 -1
  413. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/assets/examples/type-marimekko-full.html +0 -1
  414. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/assets/examples/type-marimekko-light.html +0 -1
  415. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/assets/examples/type-medallion-dark.html +0 -1
  416. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/assets/examples/type-medallion-full.html +0 -1
  417. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/assets/examples/type-medallion-light.html +0 -1
  418. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/assets/examples/type-nested-dark.html +0 -1
  419. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/assets/examples/type-nested-full.html +0 -1
  420. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/assets/examples/type-nested-light.html +0 -1
  421. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/assets/examples/type-org-chart-dark.html +0 -1
  422. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/assets/examples/type-org-chart-full.html +0 -1
  423. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/assets/examples/type-org-chart-light.html +0 -1
  424. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/assets/examples/type-paved-road-animated-dark.html +0 -1
  425. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/assets/examples/type-paved-road-animated-full.html +0 -1
  426. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/assets/examples/type-paved-road-animated-light.html +0 -1
  427. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/assets/examples/type-polar-dark.html +0 -1
  428. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/assets/examples/type-polar-full.html +0 -1
  429. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/assets/examples/type-polar-light.html +0 -1
  430. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/assets/examples/type-policy-trace-animated-dark.html +0 -1
  431. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/assets/examples/type-policy-trace-animated-full.html +0 -1
  432. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/assets/examples/type-policy-trace-animated-light.html +0 -1
  433. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/assets/examples/type-process-dark.html +0 -1
  434. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/assets/examples/type-process-full.html +0 -1
  435. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/assets/examples/type-process-light.html +0 -1
  436. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/assets/examples/type-pyramid-dark.html +0 -1
  437. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/assets/examples/type-pyramid-full.html +0 -1
  438. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/assets/examples/type-pyramid-light.html +0 -1
  439. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/assets/examples/type-quadrant-consultant-dark.html +0 -1
  440. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/assets/examples/type-quadrant-consultant-full.html +0 -1
  441. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/assets/examples/type-quadrant-consultant-light.html +0 -1
  442. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/assets/examples/type-quadrant-dark.html +0 -1
  443. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/assets/examples/type-quadrant-full.html +0 -1
  444. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/assets/examples/type-quadrant-light.html +0 -1
  445. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/assets/examples/type-queue-animated-dark.html +0 -1
  446. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/assets/examples/type-queue-animated-full.html +0 -1
  447. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/assets/examples/type-queue-animated-light.html +0 -1
  448. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/assets/examples/type-radar-dark.html +0 -1
  449. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/assets/examples/type-radar-full.html +0 -1
  450. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/assets/examples/type-radar-light.html +0 -1
  451. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/assets/examples/type-ridgeline-dark.html +0 -1
  452. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/assets/examples/type-ridgeline-full.html +0 -1
  453. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/assets/examples/type-ridgeline-light.html +0 -1
  454. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/assets/examples/type-sankey-dark.html +0 -1
  455. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/assets/examples/type-sankey-full.html +0 -1
  456. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/assets/examples/type-sankey-light.html +0 -1
  457. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/assets/examples/type-scatter-dark.html +0 -1
  458. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/assets/examples/type-scatter-full.html +0 -1
  459. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/assets/examples/type-scatter-light.html +0 -1
  460. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/assets/examples/type-sequence-dark.html +0 -1
  461. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/assets/examples/type-sequence-full.html +0 -1
  462. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/assets/examples/type-sequence-light.html +0 -1
  463. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/assets/examples/type-sequence-oauth-dark.html +0 -1
  464. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/assets/examples/type-sequence-oauth-full.html +0 -1
  465. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/assets/examples/type-sequence-oauth-light.html +0 -1
  466. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/assets/examples/type-slopegraph-dark.html +0 -1
  467. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/assets/examples/type-slopegraph-full.html +0 -1
  468. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/assets/examples/type-slopegraph-light.html +0 -1
  469. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/assets/examples/type-state-dark.html +0 -1
  470. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/assets/examples/type-state-full.html +0 -1
  471. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/assets/examples/type-state-lifecycle-dark.html +0 -1
  472. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/assets/examples/type-state-lifecycle-full.html +0 -1
  473. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/assets/examples/type-state-lifecycle-light.html +0 -1
  474. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/assets/examples/type-state-light.html +0 -1
  475. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/assets/examples/type-story-map-dark.html +0 -1
  476. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/assets/examples/type-story-map-full.html +0 -1
  477. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/assets/examples/type-story-map-light.html +0 -1
  478. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/assets/examples/type-streamgraph-dark.html +0 -1
  479. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/assets/examples/type-streamgraph-full.html +0 -1
  480. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/assets/examples/type-streamgraph-light.html +0 -1
  481. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/assets/examples/type-swimlane-dark.html +0 -1
  482. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/assets/examples/type-swimlane-full.html +0 -1
  483. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/assets/examples/type-swimlane-light.html +0 -1
  484. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/assets/examples/type-timeline-dark.html +0 -1
  485. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/assets/examples/type-timeline-full.html +0 -1
  486. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/assets/examples/type-timeline-light.html +0 -1
  487. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/assets/examples/type-tree-block-decomposition-dark.html +0 -1
  488. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/assets/examples/type-tree-block-decomposition-full.html +0 -1
  489. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/assets/examples/type-tree-block-decomposition-light.html +0 -1
  490. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/assets/examples/type-tree-dark.html +0 -1
  491. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/assets/examples/type-tree-full.html +0 -1
  492. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/assets/examples/type-tree-light.html +0 -1
  493. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/assets/examples/type-treemap-dark.html +0 -1
  494. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/assets/examples/type-treemap-full.html +0 -1
  495. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/assets/examples/type-treemap-light.html +0 -1
  496. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/assets/examples/type-uml-class-dark.html +0 -1
  497. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/assets/examples/type-uml-class-full.html +0 -1
  498. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/assets/examples/type-uml-class-light.html +0 -1
  499. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/assets/examples/type-venn-dark.html +0 -1
  500. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/assets/examples/type-venn-full.html +0 -1
  501. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/assets/examples/type-venn-light.html +0 -1
  502. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/assets/examples/type-wardley-dark.html +0 -1
  503. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/assets/examples/type-wardley-full.html +0 -1
  504. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/assets/examples/type-wardley-light.html +0 -1
  505. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/assets/examples/type-waterfall-dark.html +0 -1
  506. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/assets/examples/type-waterfall-full.html +0 -1
  507. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/assets/examples/type-waterfall-light.html +0 -1
  508. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/assets/fonts/OFL.txt +0 -94
  509. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/assets/fonts/PretendardVariable.woff2 +0 -0
  510. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/assets/fonts/provenance.json +0 -22
  511. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/assets/icons.html +0 -231
  512. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/assets/index.html +0 -1
  513. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/assets/licenses/devicon-MIT.txt +0 -20
  514. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/assets/licenses/diagram-design-MIT.txt +0 -21
  515. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/assets/licenses/log-z-MIT.txt +0 -21
  516. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/assets/licenses/simple-icons-CC0.md +0 -30
  517. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/assets/licenses/tabler-MIT.txt +0 -21
  518. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/examples/01-service-architecture/after.html +0 -1
  519. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/examples/01-service-architecture/brief.md +0 -33
  520. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/examples/01-service-architecture/constructed-naive-foil.html +0 -1
  521. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/examples/02-release-decision/after.html +0 -1
  522. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/examples/02-release-decision/brief.md +0 -18
  523. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/examples/02-release-decision/constructed-naive-foil.html +0 -1
  524. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/examples/03-data-retention/after.html +0 -1
  525. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/examples/03-data-retention/brief.md +0 -19
  526. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/examples/03-data-retention/constructed-naive-foil.html +0 -1
  527. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/examples/04-oauth-sequence/after.html +0 -1
  528. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/examples/04-oauth-sequence/brief.md +0 -17
  529. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/examples/04-oauth-sequence/constructed-naive-foil.html +0 -1
  530. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/examples/05-review-lanes/after.html +0 -1
  531. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/examples/05-review-lanes/brief.md +0 -17
  532. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/examples/05-review-lanes/constructed-naive-foil.html +0 -1
  533. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/examples/06-rollout-gates/after.html +0 -1
  534. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/examples/06-rollout-gates/brief.md +0 -17
  535. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/examples/06-rollout-gates/constructed-naive-foil.html +0 -1
  536. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/examples/07-deployment-boundary/after.html +0 -1
  537. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/examples/07-deployment-boundary/brief.md +0 -19
  538. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/examples/07-deployment-boundary/constructed-naive-foil.html +0 -1
  539. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/examples/08-policy-traces/after.html +0 -1
  540. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/examples/08-policy-traces/brief.md +0 -20
  541. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/examples/08-policy-traces/constructed-naive-foil.html +0 -1
  542. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/references/accessibility.md +0 -37
  543. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/references/export.md +0 -29
  544. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/references/import-drawio.md +0 -21
  545. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/references/import-excalidraw.md +0 -14
  546. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/references/import-mermaid.md +0 -18
  547. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/references/import-schema.md +0 -28
  548. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/references/korean-typography.md +0 -34
  549. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/references/motion.md +0 -29
  550. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/references/office-pptx-docx.md +0 -42
  551. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/references/output-spec.md +0 -48
  552. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/references/primitive-annotation.md +0 -12
  553. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/references/primitive-icons.md +0 -21
  554. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/references/primitive-sketchy.md +0 -11
  555. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/references/primitive-terminal.md +0 -11
  556. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/references/profiles.md +0 -24
  557. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/references/semantic-patterns.md +0 -27
  558. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/references/style-guide.md +0 -76
  559. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/references/type-architecture.md +0 -51
  560. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/references/type-bar.md +0 -51
  561. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/references/type-beeswarm.md +0 -49
  562. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/references/type-bubble.md +0 -49
  563. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/references/type-bump.md +0 -49
  564. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/references/type-catalog.json +0 -1433
  565. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/references/type-data-flow.md +0 -51
  566. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/references/type-datalake.md +0 -49
  567. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/references/type-db-schema.md +0 -49
  568. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/references/type-dependency.md +0 -49
  569. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/references/type-deployment.md +0 -49
  570. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/references/type-dp-integration.md +0 -49
  571. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/references/type-dp-security-matrix.md +0 -49
  572. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/references/type-er.md +0 -49
  573. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/references/type-fishbone.md +0 -49
  574. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/references/type-flowchart.md +0 -49
  575. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/references/type-gantt.md +0 -49
  576. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/references/type-heatmap.md +0 -53
  577. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/references/type-high-level-vertical.md +0 -53
  578. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/references/type-high-level.md +0 -53
  579. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/references/type-import-drawio.md +0 -53
  580. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/references/type-import-excalidraw.md +0 -53
  581. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/references/type-import-mermaid.md +0 -53
  582. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/references/type-it-state.md +0 -54
  583. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/references/type-journey.md +0 -54
  584. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/references/type-kanban.md +0 -54
  585. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/references/type-layers.md +0 -54
  586. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/references/type-line.md +0 -54
  587. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/references/type-loop-terminal.md +0 -53
  588. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/references/type-loop.md +0 -54
  589. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/references/type-marimekko.md +0 -54
  590. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/references/type-medallion.md +0 -54
  591. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/references/type-nested.md +0 -59
  592. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/references/type-org-chart.md +0 -58
  593. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/references/type-paved-road-animated.md +0 -72
  594. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/references/type-polar.md +0 -67
  595. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/references/type-policy-trace-animated.md +0 -69
  596. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/references/type-process.md +0 -58
  597. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/references/type-pyramid.md +0 -59
  598. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/references/type-quadrant-consultant.md +0 -60
  599. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/references/type-quadrant.md +0 -57
  600. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/references/type-queue-animated.md +0 -63
  601. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/references/type-radar.md +0 -57
  602. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/references/type-ridgeline.md +0 -63
  603. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/references/type-sankey.md +0 -68
  604. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/references/type-scatter.md +0 -60
  605. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/references/type-sequence-oauth.md +0 -66
  606. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/references/type-sequence.md +0 -63
  607. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/references/type-slopegraph.md +0 -65
  608. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/references/type-state-lifecycle.md +0 -53
  609. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/references/type-state.md +0 -59
  610. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/references/type-story-map.md +0 -52
  611. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/references/type-streamgraph.md +0 -53
  612. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/references/type-swimlane.md +0 -52
  613. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/references/type-timeline.md +0 -52
  614. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/references/type-tree-block-decomposition.md +0 -57
  615. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/references/type-tree.md +0 -54
  616. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/references/type-treemap.md +0 -54
  617. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/references/type-uml-class.md +0 -52
  618. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/references/type-venn.md +0 -51
  619. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/references/type-wardley.md +0 -52
  620. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/references/type-waterfall.md +0 -54
  621. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/references/verifier-guide.md +0 -60
  622. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/scripts/block-registry.mjs +0 -43
  623. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/scripts/brief-contract.mjs +0 -94
  624. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/scripts/check-visible-text.mjs +0 -15
  625. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/scripts/diagram-craft-rules.mjs +0 -13
  626. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/scripts/diagram-metrics.mjs +0 -219
  627. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/scripts/doctor.mjs +0 -29
  628. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/scripts/drawio-model.mjs +0 -162
  629. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/scripts/drawio-source.mjs +0 -147
  630. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/scripts/drawio-xml.mjs +0 -148
  631. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/scripts/export.mjs +0 -123
  632. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/scripts/import-common.mjs +0 -85
  633. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/scripts/import-drawio.mjs +0 -48
  634. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/scripts/import-excalidraw.mjs +0 -234
  635. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/scripts/import-mermaid.mjs +0 -104
  636. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/scripts/mermaid-common.mjs +0 -115
  637. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/scripts/mermaid-er.mjs +0 -70
  638. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/scripts/mermaid-flowchart.mjs +0 -178
  639. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/scripts/mermaid-sequence.mjs +0 -137
  640. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/scripts/mermaid-state.mjs +0 -80
  641. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/scripts/office-safety.mjs +0 -54
  642. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/scripts/runtime-probes.mjs +0 -36
  643. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/scripts/verify-all.mjs +0 -85
  644. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/scripts/verify-brief.mjs +0 -16
  645. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/scripts/verify-diagram.mjs +0 -27
  646. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/scripts/verify-motion.mjs +0 -12
  647. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/scripts/verify-type.mjs +0 -48
  648. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/scripts/visual-quality-geometry.mjs +0 -226
  649. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/scripts/visual-quality.mjs +0 -146
  650. package/marketplace/plugins/litcodex/skills/lit-docx/LICENSE +0 -21
  651. package/marketplace/plugins/litcodex/skills/lit-docx/NOTICE +0 -3
  652. package/marketplace/plugins/litcodex/skills/lit-docx/references/components.md +0 -113
  653. package/marketplace/plugins/litcodex/skills/lit-docx/references/direction-step.md +0 -167
  654. package/marketplace/plugins/litcodex/skills/lit-docx/references/examples/01-report-ko.md +0 -95
  655. package/marketplace/plugins/litcodex/skills/lit-docx/references/examples/02-brief-ko.md +0 -45
  656. package/marketplace/plugins/litcodex/skills/lit-docx/references/examples/03-manual-ko.md +0 -105
  657. package/marketplace/plugins/litcodex/skills/lit-docx/references/examples/04-proposal-ko.md +0 -97
  658. package/marketplace/plugins/litcodex/skills/lit-docx/references/examples/05-memo-en.md +0 -34
  659. package/marketplace/plugins/litcodex/skills/lit-docx/references/examples/06-journal-en.md +0 -89
  660. package/marketplace/plugins/litcodex/skills/lit-docx/references/examples/07-report-en.md +0 -101
  661. package/marketplace/plugins/litcodex/skills/lit-docx/references/examples/08-proposal-en.md +0 -94
  662. package/marketplace/plugins/litcodex/skills/lit-docx/references/examples/09-memo-ko.md +0 -34
  663. package/marketplace/plugins/litcodex/skills/lit-docx/references/frontmatter_schema.md +0 -42
  664. package/marketplace/plugins/litcodex/skills/lit-docx/references/journal_style_spec.md +0 -17
  665. package/marketplace/plugins/litcodex/skills/lit-docx/references/markdown_quality_checklist.md +0 -37
  666. package/marketplace/plugins/litcodex/skills/lit-docx/references/page-composition.md +0 -141
  667. package/marketplace/plugins/litcodex/skills/lit-docx/references/slop_phrase_list.yaml +0 -58
  668. package/marketplace/plugins/litcodex/skills/lit-docx/references/slop_rules.md +0 -35
  669. package/marketplace/plugins/litcodex/skills/lit-docx/references/tonalities/brief.md +0 -70
  670. package/marketplace/plugins/litcodex/skills/lit-docx/references/tonalities/journal.md +0 -73
  671. package/marketplace/plugins/litcodex/skills/lit-docx/references/tonalities/manual.md +0 -70
  672. package/marketplace/plugins/litcodex/skills/lit-docx/references/tonalities/memo.md +0 -75
  673. package/marketplace/plugins/litcodex/skills/lit-docx/references/tonalities/proposal.md +0 -71
  674. package/marketplace/plugins/litcodex/skills/lit-docx/references/tonalities/report.md +0 -83
  675. package/marketplace/plugins/litcodex/skills/lit-docx/runtime/requirements.in +0 -5
  676. package/marketplace/plugins/litcodex/skills/lit-docx/runtime/requirements.lock +0 -20
  677. package/marketplace/plugins/litcodex/skills/lit-docx/scripts/clean_markdown.py +0 -95
  678. package/marketplace/plugins/litcodex/skills/lit-docx/scripts/convert_md_to_docx.py +0 -1389
  679. package/marketplace/plugins/litcodex/skills/lit-docx/scripts/convert_md_to_pdf.py +0 -311
  680. package/marketplace/plugins/litcodex/skills/lit-docx/scripts/convert_pdf.py +0 -130
  681. package/marketplace/plugins/litcodex/skills/lit-docx/scripts/docx_craft.py +0 -218
  682. package/marketplace/plugins/litcodex/skills/lit-docx/scripts/docx_design.py +0 -2446
  683. package/marketplace/plugins/litcodex/skills/lit-docx/scripts/docx_layout.py +0 -960
  684. package/marketplace/plugins/litcodex/skills/lit-docx/scripts/edit_docx.py +0 -297
  685. package/marketplace/plugins/litcodex/skills/lit-docx/scripts/embed_images.py +0 -78
  686. package/marketplace/plugins/litcodex/skills/lit-docx/scripts/generate_docx_templates.py +0 -491
  687. package/marketplace/plugins/litcodex/skills/lit-docx/scripts/slop_lint.py +0 -488
  688. package/marketplace/plugins/litcodex/skills/lit-docx/scripts/visual_audit.py +0 -41
  689. package/marketplace/plugins/litcodex/skills/lit-docx/templates/docx/acs.docx +0 -0
  690. package/marketplace/plugins/litcodex/skills/lit-docx/templates/docx/elsevier.docx +0 -0
  691. package/marketplace/plugins/litcodex/skills/lit-docx/templates/docx/ieee.docx +0 -0
  692. package/marketplace/plugins/litcodex/skills/lit-docx/templates/docx/korean-generic.docx +0 -0
  693. package/marketplace/plugins/litcodex/skills/lit-docx/templates/docx/nature.docx +0 -0
  694. package/marketplace/plugins/litcodex/skills/lit-docx/templates/latex/acs/README.md +0 -5
  695. package/marketplace/plugins/litcodex/skills/lit-docx/templates/latex/acs/template.tex +0 -39
  696. package/marketplace/plugins/litcodex/skills/lit-docx/templates/latex/elsevier/README.md +0 -5
  697. package/marketplace/plugins/litcodex/skills/lit-docx/templates/latex/elsevier/template.tex +0 -40
  698. package/marketplace/plugins/litcodex/skills/lit-docx/templates/latex/ieee/README.md +0 -5
  699. package/marketplace/plugins/litcodex/skills/lit-docx/templates/latex/ieee/template.tex +0 -39
  700. package/marketplace/plugins/litcodex/skills/lit-docx/templates/latex/korean-generic/README.md +0 -5
  701. package/marketplace/plugins/litcodex/skills/lit-docx/templates/latex/korean-generic/template.tex +0 -39
  702. package/marketplace/plugins/litcodex/skills/lit-docx/templates/latex/nature/README.md +0 -5
  703. package/marketplace/plugins/litcodex/skills/lit-docx/templates/latex/nature/template.tex +0 -39
  704. package/marketplace/plugins/litcodex/skills/lit-docx/templates/registry.yaml +0 -1366
  705. package/marketplace/plugins/litcodex/skills/lit-docx/templates/tonalities/brief.yaml +0 -27
  706. package/marketplace/plugins/litcodex/skills/lit-docx/templates/tonalities/journal.yaml +0 -25
  707. package/marketplace/plugins/litcodex/skills/lit-docx/templates/tonalities/manual.yaml +0 -25
  708. package/marketplace/plugins/litcodex/skills/lit-docx/templates/tonalities/memo.yaml +0 -26
  709. package/marketplace/plugins/litcodex/skills/lit-docx/templates/tonalities/proposal.yaml +0 -26
  710. package/marketplace/plugins/litcodex/skills/lit-docx/templates/tonalities/report.yaml +0 -26
  711. package/marketplace/plugins/litcodex/skills/lit-pptx/FORBIDDEN_TERMS.json +0 -55
  712. package/marketplace/plugins/litcodex/skills/lit-pptx/NOTICE +0 -8
  713. package/marketplace/plugins/litcodex/skills/lit-pptx/agents/analyst.md +0 -49
  714. package/marketplace/plugins/litcodex/skills/lit-pptx/agents/antithesis.md +0 -59
  715. package/marketplace/plugins/litcodex/skills/lit-pptx/agents/architect.md +0 -44
  716. package/marketplace/plugins/litcodex/skills/lit-pptx/agents/critic.md +0 -42
  717. package/marketplace/plugins/litcodex/skills/lit-pptx/agents/synthesizer.md +0 -47
  718. package/marketplace/plugins/litcodex/skills/lit-pptx/agents/thesis.md +0 -33
  719. package/marketplace/plugins/litcodex/skills/lit-pptx/assets/azure/circle-lg.png +0 -0
  720. package/marketplace/plugins/litcodex/skills/lit-pptx/assets/azure/circle-md.png +0 -0
  721. package/marketplace/plugins/litcodex/skills/lit-pptx/assets/azure/circle-sm.png +0 -0
  722. package/marketplace/plugins/litcodex/skills/lit-pptx/fonts/a2z-font/A2Z-Black.otf +0 -0
  723. package/marketplace/plugins/litcodex/skills/lit-pptx/fonts/a2z-font/A2Z-Bold.otf +0 -0
  724. package/marketplace/plugins/litcodex/skills/lit-pptx/fonts/a2z-font/A2Z-Light.otf +0 -0
  725. package/marketplace/plugins/litcodex/skills/lit-pptx/fonts/a2z-font/A2Z-Medium.otf +0 -0
  726. package/marketplace/plugins/litcodex/skills/lit-pptx/fonts/a2z-font/A2Z-Regular.otf +0 -0
  727. package/marketplace/plugins/litcodex/skills/lit-pptx/fonts/a2z-font/OFL.txt +0 -94
  728. package/marketplace/plugins/litcodex/skills/lit-pptx/fonts/a2z-font/SOURCE.md +0 -29
  729. package/marketplace/plugins/litcodex/skills/lit-pptx/fonts/jetbrains-mono/JetBrainsMono-Bold.ttf +0 -0
  730. package/marketplace/plugins/litcodex/skills/lit-pptx/fonts/jetbrains-mono/JetBrainsMono-Regular.ttf +0 -0
  731. package/marketplace/plugins/litcodex/skills/lit-pptx/fonts/jetbrains-mono/OFL.txt +0 -93
  732. package/marketplace/plugins/litcodex/skills/lit-pptx/fonts/jetbrains-mono/SOURCE.md +0 -21
  733. package/marketplace/plugins/litcodex/skills/lit-pptx/pretendard-font/LICENSE.txt +0 -94
  734. package/marketplace/plugins/litcodex/skills/lit-pptx/pretendard-font/public/static/Pretendard-Bold.otf +0 -0
  735. package/marketplace/plugins/litcodex/skills/lit-pptx/pretendard-font/public/static/Pretendard-Regular.otf +0 -0
  736. package/marketplace/plugins/litcodex/skills/lit-pptx/references/anti-slop-checklist.md +0 -78
  737. package/marketplace/plugins/litcodex/skills/lit-pptx/references/authoring-guide.md +0 -148
  738. package/marketplace/plugins/litcodex/skills/lit-pptx/references/consensus-protocol.md +0 -125
  739. package/marketplace/plugins/litcodex/skills/lit-pptx/references/data-display-cookbook.md +0 -45
  740. package/marketplace/plugins/litcodex/skills/lit-pptx/references/density-and-fill.md +0 -193
  741. package/marketplace/plugins/litcodex/skills/lit-pptx/references/design-system-azure.md +0 -58
  742. package/marketplace/plugins/litcodex/skills/lit-pptx/references/direction-step.md +0 -221
  743. package/marketplace/plugins/litcodex/skills/lit-pptx/references/examples/01-pitch-signal-ko.md +0 -185
  744. package/marketplace/plugins/litcodex/skills/lit-pptx/references/examples/02-pitch-studio-en.md +0 -162
  745. package/marketplace/plugins/litcodex/skills/lit-pptx/references/examples/03-business-review-ledger-ko.md +0 -229
  746. package/marketplace/plugins/litcodex/skills/lit-pptx/references/examples/04-research-talk-paper-en.md +0 -212
  747. package/marketplace/plugins/litcodex/skills/lit-pptx/references/examples/05-research-keynote-night-ko.md +0 -191
  748. package/marketplace/plugins/litcodex/skills/lit-pptx/references/examples/06-lecture-chalk-ko.md +0 -175
  749. package/marketplace/plugins/litcodex/skills/lit-pptx/references/examples/07-data-review-night-en.md +0 -241
  750. package/marketplace/plugins/litcodex/skills/lit-pptx/references/examples/08-field-report-atlas-ko.md +0 -168
  751. package/marketplace/plugins/litcodex/skills/lit-pptx/references/examples/09-briefing-gazette-ko.md +0 -219
  752. package/marketplace/plugins/litcodex/skills/lit-pptx/references/examples/10-status-update-ledger-en.md +0 -157
  753. package/marketplace/plugins/litcodex/skills/lit-pptx/references/examples/11-portfolio-studio-ko.md +0 -183
  754. package/marketplace/plugins/litcodex/skills/lit-pptx/references/examples/12-tutorial-chalk-en.md +0 -176
  755. package/marketplace/plugins/litcodex/skills/lit-pptx/references/examples/13-status-update-gazette-ko.md +0 -157
  756. package/marketplace/plugins/litcodex/skills/lit-pptx/references/examples/14-engineering-review-computational-brutalism-ko.md +0 -173
  757. package/marketplace/plugins/litcodex/skills/lit-pptx/references/examples/15-launch-pitch-neo-brutalism-ko.md +0 -154
  758. package/marketplace/plugins/litcodex/skills/lit-pptx/references/examples/16-design-lecture-bauhaus-ko.md +0 -139
  759. package/marketplace/plugins/litcodex/skills/lit-pptx/references/examples/17-community-programme-riso-ko.md +0 -158
  760. package/marketplace/plugins/litcodex/skills/lit-pptx/references/examples/18-public-data-briefing-newsroom-ko.md +0 -179
  761. package/marketplace/plugins/litcodex/skills/lit-pptx/references/interview-protocol.md +0 -113
  762. package/marketplace/plugins/litcodex/skills/lit-pptx/references/layout-families.md +0 -225
  763. package/marketplace/plugins/litcodex/skills/lit-pptx/references/title-treatments.md +0 -150
  764. package/marketplace/plugins/litcodex/skills/lit-pptx/references/tonalities/atlas.md +0 -113
  765. package/marketplace/plugins/litcodex/skills/lit-pptx/references/tonalities/bauhaus.md +0 -136
  766. package/marketplace/plugins/litcodex/skills/lit-pptx/references/tonalities/chalk.md +0 -115
  767. package/marketplace/plugins/litcodex/skills/lit-pptx/references/tonalities/computational-brutalism.md +0 -145
  768. package/marketplace/plugins/litcodex/skills/lit-pptx/references/tonalities/gazette.md +0 -118
  769. package/marketplace/plugins/litcodex/skills/lit-pptx/references/tonalities/ledger.md +0 -129
  770. package/marketplace/plugins/litcodex/skills/lit-pptx/references/tonalities/neo-brutalism.md +0 -155
  771. package/marketplace/plugins/litcodex/skills/lit-pptx/references/tonalities/newsroom.md +0 -141
  772. package/marketplace/plugins/litcodex/skills/lit-pptx/references/tonalities/night.md +0 -126
  773. package/marketplace/plugins/litcodex/skills/lit-pptx/references/tonalities/paper.md +0 -109
  774. package/marketplace/plugins/litcodex/skills/lit-pptx/references/tonalities/riso.md +0 -133
  775. package/marketplace/plugins/litcodex/skills/lit-pptx/references/tonalities/signal.md +0 -121
  776. package/marketplace/plugins/litcodex/skills/lit-pptx/references/tonalities/studio.md +0 -111
  777. package/marketplace/plugins/litcodex/skills/lit-pptx/runtime/package-lock.json +0 -795
  778. package/marketplace/plugins/litcodex/skills/lit-pptx/runtime/package.json +0 -13
  779. package/marketplace/plugins/litcodex/skills/lit-pptx/runtime/requirements.in +0 -2
  780. package/marketplace/plugins/litcodex/skills/lit-pptx/runtime/requirements.lock +0 -14
  781. package/marketplace/plugins/litcodex/skills/lit-pptx/scripts/check_ooxml.py +0 -40
  782. package/marketplace/plugins/litcodex/skills/lit-pptx/scripts/compile-deck.js +0 -447
  783. package/marketplace/plugins/litcodex/skills/lit-pptx/scripts/craft_extras.py +0 -931
  784. package/marketplace/plugins/litcodex/skills/lit-pptx/scripts/embed_fonts.py +0 -213
  785. package/marketplace/plugins/litcodex/skills/lit-pptx/scripts/inventory.py +0 -125
  786. package/marketplace/plugins/litcodex/skills/lit-pptx/scripts/learn_template.py +0 -433
  787. package/marketplace/plugins/litcodex/skills/lit-pptx/scripts/lib/derive-palette.js +0 -176
  788. package/marketplace/plugins/litcodex/skills/lit-pptx/scripts/lib/directive-parser.js +0 -244
  789. package/marketplace/plugins/litcodex/skills/lit-pptx/scripts/lib/font-map.js +0 -79
  790. package/marketplace/plugins/litcodex/skills/lit-pptx/scripts/lib/gen-bg.js +0 -85
  791. package/marketplace/plugins/litcodex/skills/lit-pptx/scripts/lib/gen-gradient-assets.js +0 -36
  792. package/marketplace/plugins/litcodex/skills/lit-pptx/scripts/lib/grid-resolver.js +0 -512
  793. package/marketplace/plugins/litcodex/skills/lit-pptx/scripts/lib/layout-resolver.js +0 -1113
  794. package/marketplace/plugins/litcodex/skills/lit-pptx/scripts/lib/markdown-loader.js +0 -138
  795. package/marketplace/plugins/litcodex/skills/lit-pptx/scripts/lib/render-adapter-html.js +0 -358
  796. package/marketplace/plugins/litcodex/skills/lit-pptx/scripts/lib/render-adapter-pptx.js +0 -2238
  797. package/marketplace/plugins/litcodex/skills/lit-pptx/scripts/lib/render-pack.js +0 -3365
  798. package/marketplace/plugins/litcodex/skills/lit-pptx/scripts/lib/slide-ast.js +0 -565
  799. package/marketplace/plugins/litcodex/skills/lit-pptx/scripts/lib/slide-grid.js +0 -104
  800. package/marketplace/plugins/litcodex/skills/lit-pptx/scripts/lib/spec-validator.js +0 -94
  801. package/marketplace/plugins/litcodex/skills/lit-pptx/scripts/lib/template-registry.js +0 -730
  802. package/marketplace/plugins/litcodex/skills/lit-pptx/scripts/office-run.mjs +0 -177
  803. package/marketplace/plugins/litcodex/skills/lit-pptx/scripts/package.json +0 -1
  804. package/marketplace/plugins/litcodex/skills/lit-pptx/scripts/qa_deck.py +0 -869
  805. package/marketplace/plugins/litcodex/skills/lit-pptx/scripts/render_pages.py +0 -124
  806. package/marketplace/plugins/litcodex/skills/lit-pptx/scripts/validate_pptx.py +0 -221
  807. package/marketplace/plugins/litcodex/skills/lit-pptx/specs/markdown-slide-spec-v1.md +0 -251
  808. package/marketplace/plugins/litcodex/skills/lit-pptx/specs/markdown-slide-spec-v2.md +0 -207
  809. package/marketplace/plugins/litcodex/skills/lit-pptx/specs/slide-ast-v1.schema.json +0 -229
  810. package/marketplace/plugins/litcodex/skills/lit-pptx/specs/slide-ast-v2.schema.json +0 -144
  811. package/marketplace/plugins/litcodex/skills/lit-pptx/specs/template-enrollment-contract.md +0 -379
  812. package/marketplace/plugins/litcodex/skills/lit-pptx/templates/bauhaus_light.css +0 -4
  813. package/marketplace/plugins/litcodex/skills/lit-pptx/templates/boilerplate_professional.css +0 -508
  814. package/marketplace/plugins/litcodex/skills/lit-pptx/templates/enrolled/AZURE-A2Z/capabilities.yaml +0 -146
  815. package/marketplace/plugins/litcodex/skills/lit-pptx/templates/enrolled/AZURE-A2Z/layout-mapping.yaml +0 -454
  816. package/marketplace/plugins/litcodex/skills/lit-pptx/templates/enrolled/AZURE-A2Z/template.yaml +0 -40
  817. package/marketplace/plugins/litcodex/skills/lit-pptx/templates/enrolled/AZURE-PRO/capabilities.yaml +0 -154
  818. package/marketplace/plugins/litcodex/skills/lit-pptx/templates/enrolled/AZURE-PRO/layout-mapping.yaml +0 -464
  819. package/marketplace/plugins/litcodex/skills/lit-pptx/templates/enrolled/AZURE-PRO/template.yaml +0 -40
  820. package/marketplace/plugins/litcodex/skills/lit-pptx/templates/enrolled/BOILERPLATE-A2Z/capabilities.yaml +0 -179
  821. package/marketplace/plugins/litcodex/skills/lit-pptx/templates/enrolled/BOILERPLATE-A2Z/layout-mapping.yaml +0 -299
  822. package/marketplace/plugins/litcodex/skills/lit-pptx/templates/enrolled/BOILERPLATE-A2Z/template.yaml +0 -45
  823. package/marketplace/plugins/litcodex/skills/lit-pptx/templates/enrolled/BOILERPLATE-PRETENDARD/capabilities.yaml +0 -181
  824. package/marketplace/plugins/litcodex/skills/lit-pptx/templates/enrolled/BOILERPLATE-PRETENDARD/layout-mapping.yaml +0 -299
  825. package/marketplace/plugins/litcodex/skills/lit-pptx/templates/enrolled/BOILERPLATE-PRETENDARD/template.yaml +0 -44
  826. package/marketplace/plugins/litcodex/skills/lit-pptx/templates/tonalities/atlas/pack.yaml +0 -92
  827. package/marketplace/plugins/litcodex/skills/lit-pptx/templates/tonalities/bauhaus/pack.yaml +0 -98
  828. package/marketplace/plugins/litcodex/skills/lit-pptx/templates/tonalities/chalk/pack.yaml +0 -97
  829. package/marketplace/plugins/litcodex/skills/lit-pptx/templates/tonalities/computational-brutalism/pack.yaml +0 -100
  830. package/marketplace/plugins/litcodex/skills/lit-pptx/templates/tonalities/gazette/pack.yaml +0 -92
  831. package/marketplace/plugins/litcodex/skills/lit-pptx/templates/tonalities/ledger/pack.yaml +0 -93
  832. package/marketplace/plugins/litcodex/skills/lit-pptx/templates/tonalities/neo-brutalism/pack.yaml +0 -107
  833. package/marketplace/plugins/litcodex/skills/lit-pptx/templates/tonalities/newsroom/pack.yaml +0 -99
  834. package/marketplace/plugins/litcodex/skills/lit-pptx/templates/tonalities/night/pack.yaml +0 -93
  835. package/marketplace/plugins/litcodex/skills/lit-pptx/templates/tonalities/paper/pack.yaml +0 -98
  836. package/marketplace/plugins/litcodex/skills/lit-pptx/templates/tonalities/riso/pack.yaml +0 -99
  837. package/marketplace/plugins/litcodex/skills/lit-pptx/templates/tonalities/signal/pack.yaml +0 -94
  838. package/marketplace/plugins/litcodex/skills/lit-pptx/templates/tonalities/studio/pack.yaml +0 -92
  839. package/marketplace/plugins/litcodex/skills/lit-schematic/examples/iso-heat-exchanger/build.mjs +0 -38
  840. package/marketplace/plugins/litcodex/skills/lit-schematic/examples/iso-heat-exchanger/scene.mjs +0 -133
  841. package/marketplace/plugins/litcodex/skills/lit-schematic/examples/journal-adsorption-rig/build.mjs +0 -87
  842. package/marketplace/plugins/litcodex/skills/lit-schematic/examples/pid-dosing-skid/build.mjs +0 -85
  843. package/marketplace/plugins/litcodex/skills/lit-schematic/references/cutaway-outputs.md +0 -70
  844. package/marketplace/plugins/litcodex/skills/lit-schematic/references/isometric-craft.md +0 -101
  845. package/marketplace/plugins/litcodex/skills/lit-schematic/references/journal-figures.md +0 -72
  846. package/marketplace/plugins/litcodex/skills/lit-schematic/references/kit-api.md +0 -134
  847. package/marketplace/plugins/litcodex/skills/lit-schematic/references/pfd-and-layout.md +0 -53
  848. package/marketplace/plugins/litcodex/skills/lit-schematic/references/pid-drafting.md +0 -103
  849. package/marketplace/plugins/litcodex/skills/lit-schematic/references/pid-symbols.md +0 -163
  850. package/marketplace/plugins/litcodex/skills/lit-schematic/references/verification.md +0 -100
  851. package/marketplace/plugins/litcodex/skills/lit-schematic/scripts/doctor.mjs +0 -57
  852. package/marketplace/plugins/litcodex/skills/lit-schematic/scripts/lib/figure.mjs +0 -81
  853. package/marketplace/plugins/litcodex/skills/lit-schematic/scripts/lib/fonts.mjs +0 -28
  854. package/marketplace/plugins/litcodex/skills/lit-schematic/scripts/lib/geom.mjs +0 -113
  855. package/marketplace/plugins/litcodex/skills/lit-schematic/scripts/lib/interactive.mjs +0 -292
  856. package/marketplace/plugins/litcodex/skills/lit-schematic/scripts/lib/isa.mjs +0 -115
  857. package/marketplace/plugins/litcodex/skills/lit-schematic/scripts/lib/iso.mjs +0 -719
  858. package/marketplace/plugins/litcodex/skills/lit-schematic/scripts/lib/legend-sheet.mjs +0 -162
  859. package/marketplace/plugins/litcodex/skills/lit-schematic/scripts/lib/pid.mjs +0 -937
  860. package/marketplace/plugins/litcodex/skills/lit-schematic/scripts/lib/png.mjs +0 -132
  861. package/marketplace/plugins/litcodex/skills/lit-schematic/scripts/lib/qa-core.mjs +0 -658
  862. package/marketplace/plugins/litcodex/skills/lit-schematic/scripts/lib/route.mjs +0 -218
  863. package/marketplace/plugins/litcodex/skills/lit-schematic/scripts/lib/sheet.mjs +0 -890
  864. package/marketplace/plugins/litcodex/skills/lit-schematic/scripts/lib/svg.mjs +0 -82
  865. package/marketplace/plugins/litcodex/skills/lit-schematic/scripts/lib/theme.mjs +0 -115
  866. package/marketplace/plugins/litcodex/skills/lit-schematic/scripts/motion.mjs +0 -129
  867. package/marketplace/plugins/litcodex/skills/lit-schematic/scripts/qa.mjs +0 -92
  868. package/marketplace/plugins/litcodex/skills/lit-schematic/scripts/render.mjs +0 -233
  869. package/marketplace/plugins/litcodex/skills/lit-schematic/scripts/scaffold.mjs +0 -60
  870. package/marketplace/plugins/litcodex/skills/lit-scientific-visualization/scripts/dependency-preflight.py +0 -233
  871. package/marketplace/plugins/litcodex/skills/lit-typographic-motion/engine/NOTICE +0 -23
  872. package/marketplace/plugins/litcodex/skills/lit-typographic-motion/engine/THIRD_PARTY_NOTICES +0 -48
  873. package/marketplace/plugins/litcodex/skills/lit-typographic-motion/engine/assets.mjs +0 -388
  874. package/marketplace/plugins/litcodex/skills/lit-typographic-motion/engine/blender/runner.py +0 -221
  875. package/marketplace/plugins/litcodex/skills/lit-typographic-motion/engine/blender.mjs +0 -132
  876. package/marketplace/plugins/litcodex/skills/lit-typographic-motion/engine/board.mjs +0 -142
  877. package/marketplace/plugins/litcodex/skills/lit-typographic-motion/engine/browser-app.js +0 -735
  878. package/marketplace/plugins/litcodex/skills/lit-typographic-motion/engine/completion.mjs +0 -9
  879. package/marketplace/plugins/litcodex/skills/lit-typographic-motion/engine/compose.mjs +0 -255
  880. package/marketplace/plugins/litcodex/skills/lit-typographic-motion/engine/constants.mjs +0 -308
  881. package/marketplace/plugins/litcodex/skills/lit-typographic-motion/engine/cover-assets.mjs +0 -116
  882. package/marketplace/plugins/litcodex/skills/lit-typographic-motion/engine/cover-capture.mjs +0 -162
  883. package/marketplace/plugins/litcodex/skills/lit-typographic-motion/engine/cover-gate.mjs +0 -327
  884. package/marketplace/plugins/litcodex/skills/lit-typographic-motion/engine/cover-image.mjs +0 -136
  885. package/marketplace/plugins/litcodex/skills/lit-typographic-motion/engine/cover-init.js +0 -55
  886. package/marketplace/plugins/litcodex/skills/lit-typographic-motion/engine/cover-sheet.mjs +0 -69
  887. package/marketplace/plugins/litcodex/skills/lit-typographic-motion/engine/cover-treatment.mjs +0 -137
  888. package/marketplace/plugins/litcodex/skills/lit-typographic-motion/engine/cover-worker.mjs +0 -21
  889. package/marketplace/plugins/litcodex/skills/lit-typographic-motion/engine/cover.mjs +0 -367
  890. package/marketplace/plugins/litcodex/skills/lit-typographic-motion/engine/driver.mjs +0 -187
  891. package/marketplace/plugins/litcodex/skills/lit-typographic-motion/engine/encode.mjs +0 -163
  892. package/marketplace/plugins/litcodex/skills/lit-typographic-motion/engine/flash.mjs +0 -251
  893. package/marketplace/plugins/litcodex/skills/lit-typographic-motion/engine/fonts.mjs +0 -180
  894. package/marketplace/plugins/litcodex/skills/lit-typographic-motion/engine/gallery.mjs +0 -147
  895. package/marketplace/plugins/litcodex/skills/lit-typographic-motion/engine/gate.mjs +0 -466
  896. package/marketplace/plugins/litcodex/skills/lit-typographic-motion/engine/house.mjs +0 -45
  897. package/marketplace/plugins/litcodex/skills/lit-typographic-motion/engine/image.mjs +0 -356
  898. package/marketplace/plugins/litcodex/skills/lit-typographic-motion/engine/look.mjs +0 -341
  899. package/marketplace/plugins/litcodex/skills/lit-typographic-motion/engine/loop-kit.js +0 -104
  900. package/marketplace/plugins/litcodex/skills/lit-typographic-motion/engine/passes.mjs +0 -181
  901. package/marketplace/plugins/litcodex/skills/lit-typographic-motion/engine/presets.mjs +0 -110
  902. package/marketplace/plugins/litcodex/skills/lit-typographic-motion/engine/report.mjs +0 -56
  903. package/marketplace/plugins/litcodex/skills/lit-typographic-motion/engine/runtime.mjs +0 -410
  904. package/marketplace/plugins/litcodex/skills/lit-typographic-motion/engine/safe-read.mjs +0 -32
  905. package/marketplace/plugins/litcodex/skills/lit-typographic-motion/engine/scaffold.mjs +0 -208
  906. package/marketplace/plugins/litcodex/skills/lit-typographic-motion/engine/scenes.mjs +0 -309
  907. package/marketplace/plugins/litcodex/skills/lit-typographic-motion/engine/score.mjs +0 -668
  908. package/marketplace/plugins/litcodex/skills/lit-typographic-motion/engine/sound.mjs +0 -606
  909. package/marketplace/plugins/litcodex/skills/lit-typographic-motion/engine/stage-gate.mjs +0 -198
  910. package/marketplace/plugins/litcodex/skills/lit-typographic-motion/engine/stage-init.js +0 -215
  911. package/marketplace/plugins/litcodex/skills/lit-typographic-motion/engine/stage-kit.js +0 -655
  912. package/marketplace/plugins/litcodex/skills/lit-typographic-motion/engine/stage-qa.js +0 -154
  913. package/marketplace/plugins/litcodex/skills/lit-typographic-motion/engine/stage-qa.mjs +0 -412
  914. package/marketplace/plugins/litcodex/skills/lit-typographic-motion/engine/stage-render.mjs +0 -366
  915. package/marketplace/plugins/litcodex/skills/lit-typographic-motion/engine/stage-worker.mjs +0 -29
  916. package/marketplace/plugins/litcodex/skills/lit-typographic-motion/engine/stage.mjs +0 -527
  917. package/marketplace/plugins/litcodex/skills/lit-typographic-motion/engine/stroke.mjs +0 -264
  918. package/marketplace/plugins/litcodex/skills/lit-typographic-motion/engine/styles.mjs +0 -233
  919. package/marketplace/plugins/litcodex/skills/lit-typographic-motion/engine/timeline.mjs +0 -153
  920. package/marketplace/plugins/litcodex/skills/lit-typographic-motion/engine/treatment.mjs +0 -558
  921. package/marketplace/plugins/litcodex/skills/lit-typographic-motion/engine/type.mjs +0 -234
  922. package/marketplace/plugins/litcodex/skills/lit-typographic-motion/engine/util.mjs +0 -198
  923. package/marketplace/plugins/litcodex/skills/lit-typographic-motion/engine/vendor/three/LICENSE +0 -21
  924. package/marketplace/plugins/litcodex/skills/lit-typographic-motion/engine/vendor/three/addons/environments/RoomEnvironment.js +0 -144
  925. package/marketplace/plugins/litcodex/skills/lit-typographic-motion/engine/vendor/three/addons/geometries/RoundedBoxGeometry.js +0 -155
  926. package/marketplace/plugins/litcodex/skills/lit-typographic-motion/engine/vendor/three/three.module.js +0 -54571
  927. package/marketplace/plugins/litcodex/skills/lit-typographic-motion/engine/webp.mjs +0 -140
  928. package/marketplace/plugins/litcodex/skills/lit-typographic-motion/fonts/archivo/Archivo-w100-wt400.ttf +0 -0
  929. package/marketplace/plugins/litcodex/skills/lit-typographic-motion/fonts/archivo/Archivo-w100-wt700.ttf +0 -0
  930. package/marketplace/plugins/litcodex/skills/lit-typographic-motion/fonts/archivo/Archivo-w100-wt900.ttf +0 -0
  931. package/marketplace/plugins/litcodex/skills/lit-typographic-motion/fonts/archivo/Archivo-w125-wt400.ttf +0 -0
  932. package/marketplace/plugins/litcodex/skills/lit-typographic-motion/fonts/archivo/Archivo-w125-wt700.ttf +0 -0
  933. package/marketplace/plugins/litcodex/skills/lit-typographic-motion/fonts/archivo/Archivo-w125-wt900.ttf +0 -0
  934. package/marketplace/plugins/litcodex/skills/lit-typographic-motion/fonts/archivo/Archivo-w75-wt400.ttf +0 -0
  935. package/marketplace/plugins/litcodex/skills/lit-typographic-motion/fonts/archivo/Archivo-w75-wt700.ttf +0 -0
  936. package/marketplace/plugins/litcodex/skills/lit-typographic-motion/fonts/archivo/Archivo-w75-wt900.ttf +0 -0
  937. package/marketplace/plugins/litcodex/skills/lit-typographic-motion/fonts/archivo/OFL.txt +0 -93
  938. package/marketplace/plugins/litcodex/skills/lit-typographic-motion/fonts/archivo/SHA256SUMS +0 -16
  939. package/marketplace/plugins/litcodex/skills/lit-typographic-motion/fonts/jetbrains-mono/JetBrainsMono-wght-latin.woff2 +0 -0
  940. package/marketplace/plugins/litcodex/skills/lit-typographic-motion/fonts/jetbrains-mono/OFL.txt +0 -93
  941. package/marketplace/plugins/litcodex/skills/lit-typographic-motion/fonts/stroke/CREDITS +0 -6
  942. package/marketplace/plugins/litcodex/skills/lit-typographic-motion/fonts/stroke/EMSAllure.svg +0 -216
  943. package/marketplace/plugins/litcodex/skills/lit-typographic-motion/fonts/stroke/EMSFelix.svg +0 -216
  944. package/marketplace/plugins/litcodex/skills/lit-typographic-motion/fonts/stroke/EMSOsmotron.svg +0 -216
  945. package/marketplace/plugins/litcodex/skills/lit-typographic-motion/fonts/stroke/EMSReadability.svg +0 -216
  946. package/marketplace/plugins/litcodex/skills/lit-typographic-motion/fonts/stroke/EMSTech.svg +0 -217
  947. package/marketplace/plugins/litcodex/skills/lit-typographic-motion/fonts/stroke/OFL.txt +0 -86
  948. package/marketplace/plugins/litcodex/skills/lit-typographic-motion/fonts/vt323/OFL.txt +0 -93
  949. package/marketplace/plugins/litcodex/skills/lit-typographic-motion/fonts/vt323/VT323-Regular.ttf +0 -0
  950. package/marketplace/plugins/litcodex/skills/lit-typographic-motion/recipes/hero-3d/expected.json +0 -33
  951. package/marketplace/plugins/litcodex/skills/lit-typographic-motion/recipes/hero-3d/index.html +0 -139
  952. package/marketplace/plugins/litcodex/skills/lit-typographic-motion/recipes/negatives/card-scenes/expected.json +0 -16
  953. package/marketplace/plugins/litcodex/skills/lit-typographic-motion/recipes/negatives/card-scenes/index.html +0 -42
  954. package/marketplace/plugins/litcodex/skills/lit-typographic-motion/recipes/negatives/reset-sweep/expected.json +0 -16
  955. package/marketplace/plugins/litcodex/skills/lit-typographic-motion/recipes/negatives/reset-sweep/index.html +0 -27
  956. package/marketplace/plugins/litcodex/skills/lit-typographic-motion/recipes/negatives/still-glow/expected.json +0 -17
  957. package/marketplace/plugins/litcodex/skills/lit-typographic-motion/recipes/negatives/still-glow/index.html +0 -29
  958. package/marketplace/plugins/litcodex/skills/lit-typographic-motion/recipes/negatives/title-slam/expected.json +0 -17
  959. package/marketplace/plugins/litcodex/skills/lit-typographic-motion/recipes/negatives/title-slam/index.html +0 -44
  960. package/marketplace/plugins/litcodex/skills/lit-typographic-motion/recipes/orbit-loop/expected.json +0 -67
  961. package/marketplace/plugins/litcodex/skills/lit-typographic-motion/recipes/orbit-loop/index.html +0 -182
  962. package/marketplace/plugins/litcodex/skills/lit-typographic-motion/recipes/painted-light/expected.json +0 -95
  963. package/marketplace/plugins/litcodex/skills/lit-typographic-motion/recipes/painted-light/index.html +0 -231
  964. package/marketplace/plugins/litcodex/skills/lit-typographic-motion/recipes/weight-tide/expected.json +0 -67
  965. package/marketplace/plugins/litcodex/skills/lit-typographic-motion/recipes/weight-tide/index.html +0 -103
  966. package/marketplace/plugins/litcodex/skills/lit-typographic-motion/references/cover.md +0 -426
  967. package/marketplace/plugins/litcodex/skills/lit-typographic-motion/references/depth.md +0 -156
  968. package/marketplace/plugins/litcodex/skills/lit-typographic-motion/references/design-choice.md +0 -22
  969. package/marketplace/plugins/litcodex/skills/lit-typographic-motion/references/quality-gate.md +0 -163
  970. package/marketplace/plugins/litcodex/skills/lit-typographic-motion/references/runtime.md +0 -69
  971. package/marketplace/plugins/litcodex/skills/lit-typographic-motion/references/scene-author.md +0 -57
  972. package/marketplace/plugins/litcodex/skills/lit-typographic-motion/references/sound.md +0 -87
  973. package/marketplace/plugins/litcodex/skills/lit-typographic-motion/references/stage.md +0 -213
  974. package/marketplace/plugins/litcodex/skills/lit-typographic-motion/references/studio.md +0 -246
  975. package/marketplace/plugins/litcodex/skills/lit-typographic-motion/references/style-bibles.md +0 -103
  976. package/marketplace/plugins/litcodex/skills/lit-typographic-motion/references/treatment.md +0 -141
  977. package/marketplace/plugins/litcodex/skills/lit-typographic-motion/references/type-and-timing.md +0 -83
  978. package/marketplace/plugins/litcodex/skills/lit-typographic-motion/runtime/package-lock.json +0 -59
  979. package/marketplace/plugins/litcodex/skills/lit-typographic-motion/runtime/package.json +0 -1
  980. package/marketplace/plugins/litcodex/skills/lit-typographic-motion/runtime/requirements-audio.txt +0 -1085
  981. package/marketplace/plugins/litcodex/skills/lit-typographic-motion/runtime/word-timing-models.json +0 -11
  982. package/marketplace/plugins/litcodex/skills/lit-typographic-motion/scripts/beat-grid.py +0 -50
  983. package/marketplace/plugins/litcodex/skills/lit-typographic-motion/scripts/render.mjs +0 -886
  984. package/marketplace/plugins/litcodex/skills/lit-typographic-motion/scripts/runtime.mjs +0 -43
  985. package/marketplace/plugins/litcodex/skills/lit-typographic-motion/styles/paper.json +0 -185
  986. package/marketplace/plugins/litcodex/skills/lit-typographic-motion/styles/swiss-signal.json +0 -188
  987. package/marketplace/plugins/litcodex/skills/lit-typographic-motion/styles/terminalcore.json +0 -182
  988. package/marketplace/plugins/litcodex/skills/lit-typographic-motion/styles/tidal.json +0 -187
  989. package/marketplace/plugins/litcodex/skills/readme-studio/references/decoration-patterns.md +0 -36
  990. package/marketplace/plugins/litcodex/skills/readme-studio/references/facts-and-assembly.md +0 -36
  991. package/marketplace/plugins/litcodex/skills/readme-studio/references/motion-and-delivery.md +0 -47
  992. package/marketplace/plugins/litcodex/skills/readme-studio/references/typography-and-imagery.md +0 -34
  993. package/marketplace/plugins/litcodex/skills/readme-studio/scripts/validate-readme-facts.mjs +0 -130
  994. package/marketplace/plugins/litcodex/skills/readme-studio/templates/cover-source.json +0 -35
  995. package/marketplace/plugins/litcodex/skills/readme-studio/templates/hyperframes-cover/index.html +0 -61
  996. package/marketplace/plugins/litcodex/skills/readme-studio/templates/hyperframes-cover/index.motion.json +0 -6
  997. package/marketplace/plugins/litcodex/skills/readme-studio/templates/hyperframes-cover/package-lock.json +0 -2017
  998. package/marketplace/plugins/litcodex/skills/readme-studio/templates/hyperframes-cover/package.json +0 -14
  999. package/marketplace/plugins/litcodex/skills/readme-studio/templates/readme-cover-section.md +0 -85
  1000. package/marketplace/plugins/litcodex/skills/readme-studio/templates/readme-facts.json +0 -11
  1001. package/marketplace/plugins/litcodex/skills/readme-studio/templates/remotion-cover/package-lock.json +0 -3783
  1002. package/marketplace/plugins/litcodex/skills/readme-studio/templates/remotion-cover/package.json +0 -18
  1003. package/marketplace/plugins/litcodex/skills/readme-studio/templates/remotion-cover/src/ReadmeCover.tsx +0 -102
  1004. package/marketplace/plugins/litcodex/skills/readme-studio/templates/remotion-cover/src/Root.tsx +0 -48
  1005. package/marketplace/plugins/litcodex/skills/readme-studio/templates/remotion-cover/src/index.tsx +0 -4
  1006. package/marketplace/plugins/litcodex/skills/readme-studio/templates/remotion-cover/src/layout.ts +0 -35
  1007. package/marketplace/plugins/litcodex/skills/readme-studio/templates/remotion-cover/src/motion.ts +0 -25
  1008. package/marketplace/plugins/litcodex/skills/readme-studio/templates/typography/package-lock.json +0 -133
  1009. package/marketplace/plugins/litcodex/skills/readme-studio/templates/typography/package.json +0 -8
  1010. package/marketplace/plugins/litcodex/skills/readme-studio/templates/typography/shape-text-to-svg.mjs +0 -238
  1011. package/marketplace/plugins/litcodex/skills/visual-qa/references/capture-playbook.md +0 -141
  1012. package/marketplace/plugins/litcodex/skills/visual-qa/references/complete-contract.md +0 -389
  1013. package/marketplace/plugins/litcodex/skills/visual-qa/schemas/design-contract.v1alpha1.json +0 -299
  1014. package/marketplace/plugins/litcodex/skills/visual-qa/schemas/design-contract.v1beta1.json +0 -32
  1015. package/marketplace/plugins/litcodex/skills/visual-qa/schemas/design-contract.v1beta2.json +0 -34
  1016. package/marketplace/plugins/litcodex/skills/visual-qa/schemas/evidence-manifest.v1alpha1.json +0 -117
  1017. package/marketplace/plugins/litcodex/skills/visual-qa/schemas/evidence-manifest.v1beta1.json +0 -80
  1018. package/marketplace/plugins/litcodex/skills/visual-qa/schemas/review-receipt.v1alpha1.json +0 -57
  1019. package/marketplace/plugins/litcodex/skills/visual-qa/scripts/ansi.mjs +0 -71
  1020. package/marketplace/plugins/litcodex/skills/visual-qa/scripts/cli.mjs +0 -54
  1021. package/marketplace/plugins/litcodex/skills/visual-qa/scripts/east-asian-width.mjs +0 -31
  1022. package/marketplace/plugins/litcodex/skills/visual-qa/scripts/entrypoint.mjs +0 -1
  1023. package/marketplace/plugins/litcodex/skills/visual-qa/scripts/evidence-bytes.mjs +0 -61
  1024. package/marketplace/plugins/litcodex/skills/visual-qa/scripts/image-diff.mjs +0 -63
  1025. package/marketplace/plugins/litcodex/skills/visual-qa/scripts/png-crc.mjs +0 -19
  1026. package/marketplace/plugins/litcodex/skills/visual-qa/scripts/png-decode.mjs +0 -169
  1027. package/marketplace/plugins/litcodex/skills/visual-qa/scripts/strict-input.mjs +0 -241
  1028. package/marketplace/plugins/litcodex/skills/visual-qa/scripts/tui-grid.mjs +0 -117
  1029. package/marketplace/plugins/litcodex/skills/visual-qa/scripts/types.mjs +0 -7
  1030. package/marketplace/plugins/litcodex/skills/visual-qa/scripts/validate-design-contract.mjs +0 -547
  1031. package/marketplace/plugins/litcodex/skills/visual-qa/scripts/validate-evidence.mjs +0 -392
  1032. package/marketplace/plugins/litcodex/skills/visual-qa/scripts/validate-review-receipt.mjs +0 -79
  1033. package/marketplace/plugins/litcodex/vendor/licenses/045_scientific-visualization-MIT.txt +0 -21
  1034. package/marketplace/plugins/litcodex/vendor/provenance/045_scientific-visualization.md +0 -42
  1035. package/marketplace/plugins/litcodex/vendor/scientific-visualization/SKILL.md +0 -283
  1036. package/marketplace/plugins/litcodex/vendor/scientific-visualization/assets/color_palettes.py +0 -197
  1037. package/marketplace/plugins/litcodex/vendor/scientific-visualization/assets/nature.mplstyle +0 -75
  1038. package/marketplace/plugins/litcodex/vendor/scientific-visualization/assets/presentation.mplstyle +0 -74
  1039. package/marketplace/plugins/litcodex/vendor/scientific-visualization/assets/publication.mplstyle +0 -78
  1040. package/marketplace/plugins/litcodex/vendor/scientific-visualization/evals/evals.json +0 -158
  1041. package/marketplace/plugins/litcodex/vendor/scientific-visualization/references/color_palettes.md +0 -380
  1042. package/marketplace/plugins/litcodex/vendor/scientific-visualization/references/journal_requirements.md +0 -359
  1043. package/marketplace/plugins/litcodex/vendor/scientific-visualization/references/matplotlib_examples.md +0 -608
  1044. package/marketplace/plugins/litcodex/vendor/scientific-visualization/references/mdanalysis_martini_visualization.md +0 -85
  1045. package/marketplace/plugins/litcodex/vendor/scientific-visualization/references/publication_guidelines.md +0 -217
  1046. package/marketplace/plugins/litcodex/vendor/scientific-visualization/references/seaborn_for_publications.md +0 -293
  1047. package/marketplace/plugins/litcodex/vendor/scientific-visualization/scripts/figure_export.py +0 -238
  1048. package/marketplace/plugins/litcodex/vendor/scientific-visualization/scripts/style_presets.py +0 -467
  1049. package/marketplace/plugins/litcodex/vendor/scientific-visualization/tests/test_figure_export.py +0 -51
  1050. package/marketplace/plugins/litcodex/vendor/scientific-visualization/tests/test_style_presets.py +0 -114
  1051. package/node_modules/@litcodex/lit-loop/dist/motion-gate.d.ts +0 -79
  1052. package/node_modules/@litcodex/lit-loop/dist/motion-gate.js +0 -310
  1053. package/node_modules/@litcodex/lit-loop/skills/lit-scientific-visualization/scripts/dependency-preflight.py +0 -233
  1054. package/node_modules/@litcodex/lit-loop/vendor/licenses/045_scientific-visualization-MIT.txt +0 -21
  1055. package/node_modules/@litcodex/lit-loop/vendor/provenance/045_scientific-visualization.md +0 -42
  1056. package/node_modules/@litcodex/lit-loop/vendor/scientific-visualization/SKILL.md +0 -283
  1057. package/node_modules/@litcodex/lit-loop/vendor/scientific-visualization/assets/color_palettes.py +0 -197
  1058. package/node_modules/@litcodex/lit-loop/vendor/scientific-visualization/assets/nature.mplstyle +0 -75
  1059. package/node_modules/@litcodex/lit-loop/vendor/scientific-visualization/assets/presentation.mplstyle +0 -74
  1060. package/node_modules/@litcodex/lit-loop/vendor/scientific-visualization/assets/publication.mplstyle +0 -78
  1061. package/node_modules/@litcodex/lit-loop/vendor/scientific-visualization/evals/evals.json +0 -158
  1062. package/node_modules/@litcodex/lit-loop/vendor/scientific-visualization/references/color_palettes.md +0 -380
  1063. package/node_modules/@litcodex/lit-loop/vendor/scientific-visualization/references/journal_requirements.md +0 -359
  1064. package/node_modules/@litcodex/lit-loop/vendor/scientific-visualization/references/matplotlib_examples.md +0 -608
  1065. package/node_modules/@litcodex/lit-loop/vendor/scientific-visualization/references/mdanalysis_martini_visualization.md +0 -85
  1066. package/node_modules/@litcodex/lit-loop/vendor/scientific-visualization/references/publication_guidelines.md +0 -217
  1067. package/node_modules/@litcodex/lit-loop/vendor/scientific-visualization/references/seaborn_for_publications.md +0 -293
  1068. package/node_modules/@litcodex/lit-loop/vendor/scientific-visualization/scripts/figure_export.py +0 -238
  1069. package/node_modules/@litcodex/lit-loop/vendor/scientific-visualization/scripts/style_presets.py +0 -467
  1070. package/node_modules/@litcodex/lit-loop/vendor/scientific-visualization/tests/test_figure_export.py +0 -51
  1071. package/node_modules/@litcodex/lit-loop/vendor/scientific-visualization/tests/test_style_presets.py +0 -114
@@ -1,3365 +0,0 @@
1
- "use strict";
2
-
3
- /**
4
- * render-pack.js — one renderer for every tonality pack.
5
- *
6
- * It reads palette roles, faces, ramp sizes, density tokens, the treatment geometry the resolver
7
- * worked out and the slide's layout family; nothing here branches on which pack it is. A family
8
- * is a plan: it splits the treatment's body zone into regions on the 12-column grid and places the
9
- * slide's content in them. A plan runs again under the pack's fill policies (larger type, wider
10
- * gaps, the visual taking the room) until the body is used, and the treatment is chosen among the
11
- * ones the role and family allow by how well the content fills it. Geometry is in points until
12
- * the moment a shape is added.
13
- */
14
-
15
- const path = require("path");
16
- const G = require("./grid-resolver");
17
- const SG = require("./slide-grid");
18
- const { looksLikeKpi } = require("./layout-resolver");
19
-
20
- // Helpers shared with the legacy renderer (hex, cleanMd, tables, charts, images, placements).
21
- let A = null;
22
- function shared() {
23
- if (!A) A = require("./render-adapter-pptx").shared;
24
- return A;
25
- }
26
-
27
- const IN = (pt) => pt / 72;
28
- const plainText = (s) => shared().cleanMd(String(s || "").replace(/\*\*/g, ""));
29
-
30
- // ── Style ───────────────────────────────────────────────────────────────────
31
-
32
- function packStyle(pack) {
33
- const P = pack.palette;
34
- const voice = pack["type-voice"] || {};
35
- return {
36
- pack, P, sizes: pack.tok.sizes, tok: pack.tok, grid: pack.grid, faces: pack.faces,
37
- deco: new Set(pack.decoration || []),
38
- // Heavier faces set wider: the advance estimate grows with the weight so frames hold their lines.
39
- wide(role = "body", text) { return G.faceWidth(pack.faces[role], text); },
40
- ems(text, role) { return G.textEms(text) * this.wide(role, text); },
41
- lines(text, w, size, role) { return G.lineCount(text, w / this.wide(role, text), size); },
42
- colour: (role) => shared().hex(P[role] || P.ink),
43
- // Tracking is a percentage of the size; Hangul body text is never tracked.
44
- tracking(face, size) {
45
- const pct = face === "display" || face === "numeral" ? voice["display-tracking"] : face === "title" ? voice["title-tracking"] : 0;
46
- return pct ? +((size * pct) / 100).toFixed(2) : 0;
47
- },
48
- };
49
- }
50
-
51
- /** `a` moved toward `b` by `t` (0-1), as #RRGGBB. */
52
- function mix(a, b, t) {
53
- const c = (h, i) => parseInt(String(h).replace("#", "").slice(i, i + 2), 16);
54
- const out = [0, 2, 4].map((i) => Math.round(c(a, i) + (c(b, i) - c(a, i)) * t).toString(16).padStart(2, "0"));
55
- return `#${out.join("").toUpperCase()}`;
56
- }
57
-
58
- // ── Drawing primitives ──────────────────────────────────────────────────────
59
-
60
- /** Title runs: **marked** words in the accent, the rest in the title colour. */
61
- function titleRuns(text, S, base) {
62
- return String(text || "").split(/(\*\*[^*]+\*\*)/g).filter(Boolean).map((part) => {
63
- const marked = part.startsWith("**") && part.endsWith("**");
64
- return { text: marked ? part.slice(2, -2) : part, options: { ...base, ...(marked ? { color: S.colour("accent") } : {}) } };
65
- });
66
- }
67
-
68
- /**
69
- * Display text broken at word boundaries into lines of near-equal width, at the line count the
70
- * frame was measured for, or one more when long words keep every split at that count too wide and
71
- * the frame holds that line (the renderer would wrap to it anyway); text with marked words is left
72
- * to the renderer's own wrapping.
73
- */
74
- function balanced(S, text, w, size, role, room = Infinity) {
75
- const s = String(text || "");
76
- if (/\*\*/u.test(s)) return s;
77
- const lines = S.lines(s, w, size, role);
78
- if (lines < 2) return s;
79
- const per = w / S.wide(role, s) / size;
80
- const set = G.balanceLines(s, lines, per);
81
- // A set ending on one word gets a line more when the frame holds it and that ends on two.
82
- const widow = (t) => t.includes("\n") && !/ /u.test(t.slice(t.lastIndexOf("\n") + 1));
83
- if (set !== s && !widow(set)) return set;
84
- const more = lines + 1 <= room ? G.balanceLines(s, lines + 1, per) : s;
85
- return more !== s && (set === s || !widow(more)) ? more : set;
86
- }
87
-
88
- /** A run split around the linked words it holds, each linked piece carrying its address. */
89
- function linkRuns(run, links) {
90
- for (const [label, url] of links) {
91
- const at = run.text.indexOf(label);
92
- if (at < 0) continue;
93
- const { breakLine, ...rest } = run.options;
94
- const parts = [
95
- at > 0 ? { text: run.text.slice(0, at), options: rest } : null,
96
- { text: label, options: { ...rest, hyperlink: { url } } },
97
- ...linkRuns({ text: run.text.slice(at + label.length), options: run.options }, links),
98
- ].filter((p) => p && p.text !== "");
99
- if (breakLine && parts.length) parts[parts.length - 1] = { ...parts[parts.length - 1], options: { ...parts[parts.length - 1].options, breakLine: true } };
100
- return parts;
101
- }
102
- return [run];
103
- }
104
-
105
- /** A flush text frame (zero insets) on the grid. */
106
- function packText(slide, S, text, box, o = {}) {
107
- const faceRole = o.face || "body";
108
- const face = S.faces[faceRole];
109
- const size = o.size || S.sizes.body;
110
- // A Markdown link is set as its words, linked; the brackets and the address never reach the page.
111
- const links = [];
112
- text = String(text == null ? "" : text).replace(/\[([^\]]+)\]\((https?:\/\/[^)\s]+)\)/gu, (_, label, url) => { links.push([label, url]); return label; });
113
- if (o.balance) text = balanced(S, text, box.w, size, faceRole, Math.floor(box.h / (size * (o.lineSpacing || 1.15)) + 0.01));
114
- else if (!o.title && faceRole !== "numeral") {
115
- text = G.keepLines(text, box.w / S.wide(faceRole, plainText(text)) / size, Math.floor(box.h / (size * (o.lineSpacing || G.leading(plainText(text)))) + 0.01));
116
- }
117
- const tracking = o.tracking != null ? o.tracking : S.tracking(faceRole, size);
118
- const base = { fontFace: face.font, fontSize: size, color: o.colour || S.colour("ink"), bold: Boolean(face.bold || o.bold),
119
- ...(tracking ? { charSpacing: tracking } : {}) };
120
- const runs = (o.title ? titleRuns(text, S, base)
121
- : shared().mdRuns(text, base).map((r) => ({ ...r, options: { ...r.options, bold: base.bold || r.options.bold } })))
122
- // A break inside a run ends the line there and nowhere else (the run's last piece flows on).
123
- .flatMap((r) => r.text.split("\n").map((t, i, all) => ({ text: t, options: { ...r.options, ...(i < all.length - 1 ? { breakLine: true } : {}) } })))
124
- .flatMap((r) => linkRuns(r, links));
125
- // A numeral frame also holds the comma and the descenders that hang below a 1.15 line.
126
- const h = faceRole === "numeral" ? Math.max(box.h, size * 1.32) : box.h;
127
- slide.addText(runs, {
128
- x: IN(box.x), y: IN(box.y), w: IN(box.w), h: IN(Math.max(h, 1)),
129
- ...base,
130
- align: o.align || "left", valign: o.valign || "top",
131
- margin: [0, 0, 0, 0],
132
- // Exact leading in points, so a frame is as tall as the measure says on every renderer.
133
- lineSpacing: +(size * (o.lineSpacing || G.leading(plainText(text)))).toFixed(1),
134
- ...(o.name ? { objectName: o.name } : {}),
135
- });
136
- }
137
-
138
- function packRect(slide, S, box, o = {}) {
139
- const radius = o.radius || 0;
140
- // In a pack with hard edges a block of the field (a band, a plate, a rail) carries the border too.
141
- if (S.pack.shadow && o.fill === "field" && !o.line && box.w >= 24 && box.h >= 24) o = { ...o, line: S.pack["edge-colour"] || "line", lineWidth: S.pack["edge-weight"] };
142
- slide.addShape(radius ? "roundRect" : "rect", {
143
- x: IN(box.x), y: IN(box.y), w: IN(box.w), h: IN(box.h),
144
- ...(radius ? { rectRadius: IN(radius) } : {}),
145
- fill: o.fill ? { color: S.colour(o.fill), transparency: o.alpha || 0 } : { type: "none" },
146
- line: o.line ? { color: S.colour(o.line), width: o.lineWidth || 0.75 } : { type: "none" },
147
- // A hard offset shadow: no blur, fully opaque, down and to the right.
148
- ...(o.shadow && S.pack.shadow ? { shadow: { type: "outer", blur: 0, offset: S.pack.shadow.offset, angle: 45, color: S.colour(S.pack.shadow.colour).replace("#", ""), opacity: 1 } } : {}),
149
- ...(o.name ? { objectName: o.name } : {}),
150
- });
151
- }
152
-
153
- /** A surface (card, box, panel) in the pack's edge treatment and radius. */
154
- function surfaceRect(slide, S, box, fill = "surface") {
155
- const edge = S.pack.edge;
156
- // A shadowed surface is filled, so its shadow never shows through it.
157
- const shadow = S.pack.shadow || null;
158
- packRect(slide, S, box, {
159
- fill: edge === "border" && !shadow ? null : edge === "border" ? "ground" : fill,
160
- line: edge === "fill" ? null : S.pack["edge-colour"] || "line",
161
- lineWidth: S.pack["edge-weight"],
162
- radius: S.pack.radius,
163
- shadow,
164
- });
165
- }
166
-
167
- /** A pack with a hard shadow draws every box with its border and shadow (filled, `fill` when given). */
168
- function hardEdge(S, fill) {
169
- if (!S.pack.shadow) return {};
170
- return { line: S.pack["edge-colour"] || "line", lineWidth: S.pack["edge-weight"], shadow: S.pack.shadow, ...(fill ? { fill } : {}) };
171
- }
172
-
173
- // ── Content atoms ───────────────────────────────────────────────────────────
174
-
175
- /** Body paragraphs of a list, in reading order. */
176
- function packParas(items) {
177
- const paras = [];
178
- let counter = 0;
179
- const children = (list) => {
180
- counter = 0;
181
- for (const c of list || []) paras.push({ kind: "child", text: `(${++counter}) ${c.text || ""}` });
182
- };
183
- for (const it of items || []) {
184
- if (it.type === "section") { paras.push({ kind: "section", text: it.heading || "" }); children(it.children); }
185
- else if (it.type === "bullet") { paras.push({ kind: "bullet", text: it.text || "" }); children(it.children); }
186
- else if (it.type === "numbered") paras.push({ kind: "child", text: `(${++counter}) ${it.text || ""}` });
187
- else if (it.type === "text" && it.text) paras.push({ kind: "text", text: it.text });
188
- }
189
- return paras;
190
- }
191
-
192
- /** Paragraphs of one text item (body, summary group or callout). */
193
- function itemParas(item) {
194
- const c = item.content || {};
195
- if (item.type === "main-box") return [{ kind: "text", text: String(c) }];
196
- if (item.type === "summary-group") return [...(c.heading ? [{ kind: "section", text: c.heading }] : []), ...packParas(c.items)];
197
- return packParas(c.items);
198
- }
199
-
200
- /** Top-level entries of a list with their sub-points: a bold head, the rest of the line, children. */
201
- function entries(paras) {
202
- const out = [];
203
- for (const p of paras) {
204
- if (p.kind === "child" && out.length) { out[out.length - 1].children.push(p.text); continue; }
205
- const m = String(p.text).match(/^\*\*(.+?)\*\*\s*(.*)$/u);
206
- out.push({ kind: p.kind, head: m ? m[1].trim() : p.kind === "section" ? p.text : "", rest: m ? m[2].trim() : p.kind === "section" ? "" : p.text, children: [] });
207
- }
208
- return out;
209
- }
210
-
211
- /** A leading ordinal in a step head ("1. 수거" → 1, "수거"). */
212
- function ordinal(head, index) {
213
- const m = String(head || "").match(/^(\d{1,2})[.)]\s*(.*)$/u);
214
- return m ? { n: m[1], head: m[2] } : { n: String(index + 1), head };
215
- }
216
-
217
- const isText = (i) => ["body", "summary-group", "main-box"].includes(i.type);
218
- const isVisual = (i) => ["kpi-table", "image", "image-grid"].includes(i.type);
219
-
220
- function sortItems(items) {
221
- return {
222
- texts: items.filter(isText),
223
- visuals: items.filter(isVisual),
224
- columns: items.find((i) => i.type === "columns") || null,
225
- captions: items.filter((i) => i.type === "caption"),
226
- };
227
- }
228
-
229
- // ── Measure ─────────────────────────────────────────────────────────────────
230
-
231
- /** A ramp size under the fill state: one step up when stepped, a lead set at body size when compact. */
232
- function bodySize(S, state, role = "body") {
233
- if (state.compact && role === "lead") return S.sizes.body;
234
- return state.stepped ? S.sizes[G.stepRole(role)] : S.sizes[role];
235
- }
236
-
237
- /**
238
- * A point that opens with a bold run-in label reads "label: rest": the label keeps its own separator when it
239
- * ends in one, else it takes a colon. A bold line with nothing after it is a heading.
240
- */
241
- function runIn(text) {
242
- const m = /^\*\*(.+?)\*\*\s+(\S[\s\S]*)$/u.exec(String(text == null ? "" : text));
243
- if (!m || /[::.)\]?!–—-]$/u.test(m[1].trim())) return text;
244
- return `**${m[1].trim()}:** ${m[2]}`;
245
- }
246
-
247
- /** A text block of paragraphs at width w. */
248
- function measureText(paras, w, S, state, o = {}) {
249
- const size = o.size || bodySize(S, state);
250
- const indent = Math.round(size * 1.1);
251
- const lines = paras.map((p, i) => {
252
- const inset = p.kind === "bullet" || p.kind === "child" ? indent : 0;
253
- const h = G.textHeight(plainText(runIn(p.text)), w - inset, size);
254
- const gap = i === 0 ? 0 : p.kind === "section" ? state.groupGap : state.itemGap;
255
- return { ...p, inset, h, gap };
256
- });
257
- return { kind: "text", paras: lines, w, size, h: lines.reduce((sum, l) => sum + l.gap + l.h, 0), muted: o.muted };
258
- }
259
-
260
- function captionText(caption) {
261
- // A source caption that already carries its own number ("표 1.") is renumbered, not doubled.
262
- const text = plainText(caption.caption).replace(/^(?:표|도|Figure|Table)\s*\d+\.\s*/u, "");
263
- return text ? `${caption.prefix} ${caption.number}. ${text}` : `${caption.prefix} ${caption.number}.`;
264
- }
265
-
266
- function captionHeight(caption, w, S) {
267
- if (!caption) return 0;
268
- return 6 + G.textHeight(captionText(caption), w, S.sizes.label, 1.3);
269
- }
270
-
271
- function measureTable(item, w, S, state) {
272
- const c = item.content;
273
- const headers = c.headers || [];
274
- const rows = c.rows || [];
275
- const header = S.sizes.label;
276
- const data = state.stepped ? S.sizes.body : S.sizes.label;
277
- const widths = headers.length ? shared().proportionalWidths(headers, rows, IN(w)).map((v) => v * 72) : [w];
278
- const cell = 6;
279
- const minRow = S.tok.rowMin * (state.anchor ? 1.25 : 1);
280
- // Rows are measured at the face's natural line (about 1.45 of the size with its gap), which is
281
- // what office renderers lay a cell out at; a smaller estimate lets rows grow past the frame.
282
- const rowH = (cells, size, role) => Math.max(minRow, ...cells.map((t, i) => G.textHeight(plainText(t), ((widths[i] || w) - cell * 2) / S.wide(role, plainText(t)), size, 1.45) + cell * 2));
283
- const heights = [rowH(headers, header, "label"), ...rows.map((r) => rowH(r, data, "body"))];
284
- const tableH = heights.reduce((a, b) => a + b, 0);
285
- return { kind: "table", heights, widths, header, data, tableH, h: tableH + captionHeight(item.caption, w, S) };
286
- }
287
-
288
- function measureKpi(item, w, S, state) {
289
- const cards = shared().kpiCards(item.content).slice(0, 6);
290
- const n = cards.length;
291
- const cardW = (w - (n - 1) * S.grid.gutter) / n;
292
- // The value stays on one line: the step-up size when it fits, else the largest that does.
293
- const longest = Math.max(...cards.map((k) => S.ems(plainText(k.value), "numeral")));
294
- const pad = S.tok.pad;
295
- const fitting = (size) => longest * size * 1.04 <= cardW - pad * 2;
296
- // A figure sits at most two steps above the body (title size), never at display or hero scale.
297
- const value = [S.sizes.title, S.sizes.lead, S.sizes.body].find((v) => fitting(v)) || S.sizes.body;
298
- const labelH = Math.max(...cards.map((k) => G.textHeight(plainText(k.label), cardW - pad * 2, S.sizes.label, 1.3)));
299
- const noteSize = S.sizes.label;
300
- const noteH = Math.max(0, ...cards.map((k) => (k.note ? G.textHeight(plainText(k.note), cardW - pad * 2, noteSize, 1.3) : 0)));
301
- const h = pad * 2 + value * 1.15 + 6 + labelH + (noteH ? 6 + noteH : 0);
302
- return { kind: "kpi", cards, n, cardW, value, pad, labelH, noteSize, noteH, h: h + captionHeight(item.caption, w, S), cardH: h };
303
- }
304
-
305
- /**
306
- * Measure one item at width w. Charts and images are flexible: they take the height the plan
307
- * gives them (the rest of their region when they anchor it).
308
- */
309
- function measureItem(item, w, S, state) {
310
- const c = item.content || {};
311
- if (isText(item)) {
312
- if (item.type === "main-box") {
313
- const pad = S.tok.pad;
314
- const m = measureText([{ kind: "text", text: String(c) }], w - pad * 2, S, state);
315
- return { kind: "callout", pad, size: m.size, h: pad * 2 + m.h };
316
- }
317
- return measureText(itemParas(item), w, S, state);
318
- }
319
- if (item.type === "kpi-table" && c.chart) return { kind: "chart", flex: true, cap: captionHeight(item.caption, w, S), min: 150 };
320
- if (item.type === "kpi-table" && !item.values && looksLikeKpi(c, { basis: true })) {
321
- const cards = shared().kpiCards(c).length;
322
- if (cards && (w - (cards - 1) * S.grid.gutter) / cards >= S.grid.span(1, 2).w) return measureKpi(item, w, S, state);
323
- }
324
- if (item.type === "kpi-table") return measureTable(item, w, S, state);
325
- if (item.type === "image" || item.type === "image-grid") return { kind: "image", flex: true, cap: captionHeight(item.caption, w, S), min: 150 };
326
- if (item.type === "caption") return { kind: "caption", h: G.textHeight(captionText(c), w, S.sizes.label, 1.3) };
327
- return { kind: "none", h: 0 };
328
- }
329
-
330
- // ── Regions ─────────────────────────────────────────────────────────────────
331
-
332
- /** Columns a…b of the deck grid as a region from y to bottom. */
333
- function region(S, a, b, y, bottom) {
334
- const s = S.grid.span(a, b);
335
- return { a, b, x: s.x, w: s.w, y, bottom };
336
- }
337
-
338
- /** Split a region's columns: the first `share` of them, and the rest. */
339
- function splitRegion(S, R, share) {
340
- const n = R.b - R.a + 1;
341
- const k = Math.max(1, Math.min(n - 1, Math.round(n * share)));
342
- return [region(S, R.a, R.a + k - 1, R.y, R.bottom), region(S, R.a + k, R.b, R.y, R.bottom)];
343
- }
344
-
345
- /** Equal parts of a region's columns (for 5 parts on 12 columns, equal slots off the column lines). */
346
- function equalParts(S, R, n) {
347
- const cols = R.b - R.a + 1;
348
- if (cols % n === 0) {
349
- const k = cols / n;
350
- return Array.from({ length: n }, (_, i) => region(S, R.a + i * k, R.a + (i + 1) * k - 1, R.y, R.bottom));
351
- }
352
- const gap = n >= 5 ? S.grid.gutter * 1.5 : S.grid.gutter;
353
- const w = (R.w - gap * (n - 1)) / n;
354
- return Array.from({ length: n }, (_, i) => ({ a: R.a, b: R.b, x: R.x + i * (w + gap), w, y: R.y, bottom: R.bottom }));
355
- }
356
-
357
- /**
358
- * Stack items down a region. Flexible visuals take an even share of the room the fixed items
359
- * leave, so a chart or image anchors the region's bottom. Returns placements with the region
360
- * bottom they must stay above.
361
- */
362
- function stack(items, R, S, state) {
363
- const placed = [];
364
- let y = R.y;
365
- items.forEach((item, i) => {
366
- if (item.type === "columns") {
367
- const weights = item.tracks.map((t) => parseFloat(String(t)) || 1);
368
- const total = weights.reduce((a, b) => a + b, 0);
369
- let at = R.a;
370
- const parts = weights.map((v, ci) => {
371
- const n = ci === weights.length - 1 ? R.b - at + 1 : Math.max(1, Math.round(((R.b - R.a + 1) * v) / total));
372
- const part = region(S, at, at + n - 1, y, R.bottom);
373
- at += n;
374
- return part;
375
- });
376
- const cols = parts.map((part, ci) => stack(item.columns[ci] || [], part, S, state));
377
- const bottom = Math.max(y, ...cols.map((c) => c.bottom));
378
- placed.push({ kind: "group", parts: cols.flatMap((c) => c.placed), y, h: bottom - y, x: R.x, w: R.w, limit: R.bottom });
379
- y = bottom + state.blockGap;
380
- return;
381
- }
382
- const m = measureItem(item, R.w, S, state);
383
- if (m.kind === "none") return;
384
- placed.push({ item, ...m, x: R.x, y, w: R.w, limit: R.bottom });
385
- y += (m.h || 0) + state.blockGap;
386
- });
387
- const flex = placed.filter((p) => p.flex);
388
- if (flex.length) {
389
- const fixed = placed.filter((p) => !p.flex).reduce((sum, p) => sum + p.h, 0);
390
- const gaps = state.blockGap * Math.max(0, placed.length - 1);
391
- const share = Math.max(...flex.map((p) => p.min), (R.bottom - R.y - fixed - gaps) / flex.length);
392
- let cursor = R.y;
393
- for (const p of placed) {
394
- if (p.flex) p.h = share;
395
- if (p.kind === "group") shiftGroup(p, cursor - p.y);
396
- p.y = cursor;
397
- cursor += p.h + state.blockGap;
398
- }
399
- y = cursor;
400
- }
401
- const bottom = placed.length ? Math.max(...placed.map((p) => p.y + p.h)) : R.y;
402
- return { placed, bottom };
403
- }
404
-
405
- function shiftGroup(p, dy) {
406
- if (!dy) return;
407
- for (const q of p.parts) {
408
- q.y += dy;
409
- if (q.kind === "group") shiftGroup(q, dy);
410
- }
411
- }
412
-
413
- /**
414
- * Pitch for n rows that share a region: the last row ends on the region floor, never closer than
415
- * the tallest row plus a gap and never wider than `max`.
416
- */
417
- function rowPitch(n, rowH, R, gap, max) {
418
- if (n <= 1) return rowH;
419
- return Math.max(rowH + gap, Math.min(max, (R.bottom - R.y - rowH) / (n - 1)));
420
- }
421
-
422
- /** A text block placed in a region. */
423
- function textAt(paras, R, S, state, o = {}) {
424
- const m = measureText(paras, R.w, S, state, o);
425
- return { ...m, x: R.x, y: R.y, limit: R.bottom };
426
- }
427
-
428
- // ── Layout families ─────────────────────────────────────────────────────────
429
- //
430
- // Each plan gets ctx = { spec, S, state, Z, cls, items } where Z is the treatment's body zone and
431
- // cls the treatment class (top, side, bottom). It returns placements; decoration placements carry
432
- // `decor: true`.
433
-
434
- /** A visual with its takeaway: beside it (share of the columns), or under it on a narrow body. */
435
- function visualWithText(ctx, visuals, texts, share, o = {}) {
436
- const { S, state, Z } = ctx;
437
- const out = [];
438
- // A visual alone (no takeaways): a table opens its rows; on the compact step a
439
- // chart carries its values under it.
440
- if (!texts.length) return ((S.tok.tight && valuesUnder(visuals, Z, S, state)) || openRows(stack(visuals, Z, S, state).placed, Z, S));
441
- if (!visuals.length) return stack(texts, Z, S, state).placed;
442
- // Takeaways too short for their column give the visual columns: a narrower column wraps them onto more
443
- // lines and a wider chart or picture grows, down to a three-column takeaway.
444
- if (!o.fixed && Z.b - Z.a + 1 >= 6 && visuals.some((v) => v.type === "image" || (v.content || {}).chart)) {
445
- const n = Z.b - Z.a + 1;
446
- const base = visualWithText(ctx, visuals, texts, share, { ...o, fixed: true });
447
- let pick = base;
448
- // A picture drawn short of its column (a wide one in a narrow column) takes columns while either side
449
- // leaves more than a fifth of the body empty; a chart only while its takeaways leave over RAIL_EMPTY.
450
- const target = visuals.some((v) => v.type === "image") ? 0.2 : RAIL_EMPTY;
451
- for (let step = 1; shortColumn(pick, Z.bottom, S).share > target; step++) {
452
- const k = o.textFirst ? share - step / n : share + step / n;
453
- const textCols = o.textFirst ? Math.round(n * k) : n - Math.round(n * k);
454
- if (textCols < 3) break;
455
- const next = visualWithText(ctx, visuals, texts, k, { ...o, fixed: true });
456
- // A narrower column never costs the takeaways their size (a lead-size column dropping to body size read as shrunk).
457
- const size = (plan) => Math.max(0, ...plan.filter((q) => q.kind === "text" && !q.strip && !q.muted).map((q) => q.size || 0));
458
- if (!overflows(next) && size(next) >= size(base) && shortColumn(next, Z.bottom, S).share < shortColumn(pick, Z.bottom, S).share) pick = next;
459
- }
460
- // Takeaways too few for even a three-column column beside a chart run under it instead, side by side, and
461
- // the chart (with its values) takes the body's width above them.
462
- if (shortColumn(pick, Z.bottom, S).share > RAIL_EMPTY && visuals.some((v) => (v.content || {}).chart)) {
463
- const paras = texts.flatMap(itemParas);
464
- const half = Math.ceil(paras.length / 2);
465
- const parts = paras.length >= 2 ? splitRegion(S, Z, 0.5) : [Z];
466
- const measured = parts.map((R, i) => measureText(parts.length > 1 ? (i ? paras.slice(half) : paras.slice(0, half)) : paras, R.w, S, state));
467
- const notesH = Math.max(...measured.map((m) => m.h));
468
- const above = { ...Z, bottom: Z.bottom - notesH - state.blockGap };
469
- const top = (S.tok.tight && valuesUnder(visuals, above, S, state, true)) || stack(visuals, above, S, state);
470
- const chart = top.placed.find((q) => q.kind === "chart");
471
- if (chart && chart.h - chart.cap >= 150) {
472
- return [...top.placed, ...measured.map((m, i) => ({ ...m, x: parts[i].x, y: above.bottom + state.blockGap, limit: Z.bottom }))];
473
- }
474
- }
475
- return pick;
476
- }
477
- if (Z.b - Z.a + 1 >= 6) {
478
- let [left, right] = splitRegion(S, Z, share);
479
- // On the compact step takeaways too long for their column take half the body from the visual.
480
- if (S.tok.tight && share > 0.5 && stack(texts, o.textFirst ? left : right, S, state).bottom > Z.bottom) [left, right] = splitRegion(S, Z, 0.5);
481
- const [vR, full] = o.textFirst ? [right, left] : [left, right];
482
- let v = stack(visuals, vR, S, state);
483
- const col = takeawayColumn(ctx, texts, visuals, full, v.bottom);
484
- const t = col.t;
485
- // When the chart's values found no room beside it, they stand under the chart, which gives up the
486
- // height the table takes: as columns, else turned across (the categories as columns, one row a
487
- // series), which costs a row per series only.
488
- if (S.tok.tight && !col.values) {
489
- const under = valuesUnder(visuals, vR, S, state, true);
490
- if (under) v = under;
491
- }
492
- // The strip closes the column once the visual's own height is settled.
493
- if (col.strip && col.end <= col.R.bottom + 0.5 && v.bottom > col.end) t.placed.push(...col.strip.placed.map((q) => ({ ...q, strip: true })));
494
- // A table keeps its own height, so beside it a short takeaway leaves the body half empty. When
495
- // that band is over the density cap and the takeaway fits under the table, it goes there as notes on
496
- // the table above: points that pair off side by side in two columns, an odd count down one column at the
497
- // reading measure, so neither column stops a point short of the other.
498
- if (v.placed.every((p) => !p.flex) && (Z.bottom - Math.max(v.bottom, t.bottom)) / (Z.bottom - Z.y) > S.tok.cap) {
499
- const top = stack(visuals, Z, S, state);
500
- const below = { ...Z, y: top.bottom + state.blockGap };
501
- const paras = texts.flatMap(itemParas);
502
- const half = Math.ceil(paras.length / 2);
503
- const notes = paras.length >= 2 && paras.length % 2 === 0
504
- ? splitRegion(S, below, 0.5).map((R, i) => textAt(i ? paras.slice(half) : paras.slice(0, half), R, S, state))
505
- : [textAt(paras, region(S, Z.a, Math.min(Z.b, Z.a + 8), below.y, below.bottom), S, state)];
506
- const end = Math.max(...notes.map((q) => q.y + q.h));
507
- if (end <= Z.bottom) {
508
- // Still short of the density band: the table's rows open up first (half the room, at most
509
- // one more minimum row height each), then the notes stand midway in what is left under the table.
510
- let room = Z.bottom - end;
511
- let grow = 0;
512
- const table = top.placed.find((q) => q.kind === "table");
513
- if (table && room / (Z.bottom - Z.y) > S.tok.cap) {
514
- const rows = table.heights.length - 1;
515
- grow = Math.floor(Math.min(room / 2, rows * S.tok.rowMin) / rows) * rows;
516
- table.heights = table.heights.map((h, i) => (i ? h + grow / rows : h));
517
- table.tableH += grow;
518
- table.h += grow;
519
- for (const q of top.placed) if (q !== table && q.y > table.y) q.y += grow;
520
- room -= grow;
521
- }
522
- const dy = grow + (room / (Z.bottom - Z.y) > S.tok.cap ? Math.round(room / 2) : 0);
523
- return [...top.placed, ...notes.map((q) => ({ ...q, y: q.y + dy }))];
524
- }
525
- }
526
- // A picture drawn shorter than its box (a wide one in a tall column) stands on the box floor when
527
- // the takeaways beside it run past the picture's top, so the two columns leave no band empty across both.
528
- for (const q of v.placed) if (q.kind === "image") q.beside = t.bottom;
529
- out.push(...v.placed, ...t.placed);
530
- if (S.deco.has("column-hairlines")) out.push(columnHairline(S, o.textFirst ? right : right, Z));
531
- return out;
532
- }
533
- return stack([...visuals, ...texts], Z, S, state).placed;
534
- }
535
-
536
- /**
537
- * A chart over its values as a compact table in region R: as columns, else turned across (the categories
538
- * as columns, one row a series), when the chart keeps at least 150 pt and every row holds one line.
539
- * Returns the placements (or the stack result when `asStack`), or null.
540
- */
541
- function valuesUnder(visuals, R, S, state, asStack = false) {
542
- // Across the body the values run across (two or three rows under a wide chart); in a column, as columns.
543
- const order = R.w >= S.grid.span(1, 8).w ? [chartTable(visuals, true), chartTable(visuals)] : [chartTable(visuals), chartTable(visuals, true)];
544
- for (const table of order) {
545
- if (!table) continue;
546
- const under = stack([...visuals, table], R, S, state);
547
- const chart = under.placed.find((q) => q.kind === "chart");
548
- if (chart && chart.h - chart.cap >= 150 && under.bottom <= R.bottom + 0.5 && under.placed.every((q) => q.kind !== "table" || q.heights.slice(1).every((h) => h <= S.tok.rowMin * 1.6))) {
549
- return asStack ? under : under.placed;
550
- }
551
- }
552
- return null;
553
- }
554
-
555
- /**
556
- * The takeaway column beside a visual that ends at `visualBottom`. The source strip offered by the slide
557
- * closes the column (it is placed by the caller once the visual is settled), so the column reaches the
558
- * floor with the visual instead of stopping halfway; on the compact step a chart's values stand as a
559
- * compact table under the takeaways when they fit, so the exact figures are beside the shape they make.
560
- * Takeaways that still leave more than 40 % of the column empty beside a longer visual are set one step
561
- * up (lead) when they fit: scaled within the ramp, never shrunk.
562
- */
563
- function takeawayColumn(ctx, texts, visuals, full, visualBottom) {
564
- const { S, state } = ctx;
565
- const strip = ctx.strip ? stripPlacements(ctx.strip, full, S) : null;
566
- const R = strip ? { ...full, bottom: full.bottom - strip.h - S.tok.block } : full;
567
- const at = (st) => {
568
- const t = stack(texts, R, S, st);
569
- const values = S.tok.tight ? chartValues(visuals, R, S, state, t.bottom) : null;
570
- if (values) t.placed.push(values);
571
- const end = Math.max(t.bottom, values ? values.y + values.h : 0);
572
- return { t, values, end, empty: (Math.min(visualBottom, R.bottom) - end) / Math.max(1, R.bottom - R.y) };
573
- };
574
- let pick = at(state);
575
- if (pick.empty > 0.4 && !state.stepped && R.w / S.sizes.lead >= 12) {
576
- const lead = at({ ...state, stepped: true });
577
- if (lead.end <= R.bottom + 0.5 && lead.empty < pick.empty) pick = lead;
578
- }
579
- return { ...pick, strip, R };
580
- }
581
-
582
- /**
583
- * A table standing alone in its region (no takeaways beside it) opens its rows, at most one
584
- * minimum row height each, while the region leaves more than the density band empty under it.
585
- */
586
- function openRows(placed, Z, S) {
587
- const tables = placed.filter((q) => q.kind === "table");
588
- if (tables.length !== 1 || placed.some((q) => q.flex)) return placed;
589
- const table = tables[0];
590
- const room = Z.bottom - Math.max(...placed.map((q) => q.y + q.h));
591
- if (room / (Z.bottom - Z.y) <= S.tok.cap) return placed;
592
- const rows = table.heights.length - 1;
593
- const grow = Math.floor(Math.min(room, rows * S.tok.rowMin) / rows) * rows;
594
- table.heights = table.heights.map((h, i) => (i ? h + grow / rows : h));
595
- table.tableH += grow;
596
- table.h += grow;
597
- for (const q of placed) if (q !== table && q.y > table.y) q.y += grow;
598
- return placed;
599
- }
600
-
601
- /**
602
- * The first chart's data as a plain table item (at most 8 rows and 4 columns), or null. `across`
603
- * turns it: the categories head the columns and each series is one row.
604
- */
605
- function chartTable(visuals, across = false) {
606
- const chart = visuals.find((v) => v.type === "kpi-table" && (v.content || {}).chart);
607
- const c = chart && chart.content;
608
- if (!c || !(c.headers || []).length || (c.rows || []).length > 8 || c.headers.length > 4) return null;
609
- if (!across) return { type: "kpi-table", values: true, content: { headers: c.headers, rows: c.rows } };
610
- const headers = [c.headers[0], ...c.rows.map((r) => r[0])];
611
- const rows = c.headers.slice(1).map((h, j) => [h, ...c.rows.map((r) => r[j + 1])]);
612
- return { type: "kpi-table", values: true, content: { headers, rows } };
613
- }
614
-
615
- /** The first chart's data as a table at label size under `top` in region R, or null when it does not fit. */
616
- function chartValues(visuals, R, S, state, top) {
617
- const item = chartTable(visuals);
618
- if (!item) return null;
619
- const m = measureTable(item, R.w, S, { ...state, stepped: false });
620
- const y = top + state.blockGap;
621
- if (y + m.h > R.bottom || m.heights.slice(1).some((h) => h > S.tok.rowMin * 1.6)) return null;
622
- return { item, ...m, x: R.x, y, w: R.w, limit: R.bottom };
623
- }
624
-
625
- /** A 0.5 pt guide in the gutter before region R (the visible grid of an editorial pack). */
626
- function columnHairline(S, R, Z) {
627
- return { decor: true, kind: "rect", x: R.x - S.grid.gutter / 2, y: Z.y, w: 0.5, h: Z.bottom - Z.y, fill: "line" };
628
- }
629
-
630
- const PLANS = {
631
- "text-column"(ctx) {
632
- const { S, state, Z } = ctx;
633
- const items = ctx.items;
634
- // Running text keeps its measure: cols 1-9 on the presented ramp, 1-7 on the reading ramp.
635
- const limit = S.tok.ramp === "presented" ? 9 : 7;
636
- const R = region(S, Z.a, Math.min(Z.b, Z.a + limit - 1), Z.y, Z.bottom);
637
- const { visuals, texts } = sortItems(items);
638
- if (visuals.length && texts.length) return visualWithText(ctx, visuals, texts, 7 / 12);
639
- const placed = stack(items, R, S, state).placed;
640
- // Two to five points that each open with a bold head, and that leave the body more than the
641
- // density band empty, read as rows: the head in its own column, the point beside it.
642
- const ents = !visuals.length ? entries(texts.flatMap(itemParas)) : [];
643
- // Groups of sub-points under bold heads, held to one reading measure narrower than the body,
644
- // run in two columns instead: the measure stays and the body is used across.
645
- const groups = ents.length >= 2 && ents.every((e) => e.head && !e.rest && e.children.length);
646
- if (groups && R.w < Z.w - S.grid.pitch) {
647
- const two = PLANS["text-two-column"](ctx);
648
- if (!two.some((q) => q.y + q.h > Z.bottom)) {
649
- // Each column's groups share the height left under it. A gap past a sixth of the body is one
650
- // more empty band than the page needs, so then the room is shared with the foot as well.
651
- for (const q of two.filter((x) => x.kind === "text")) {
652
- const breaks = q.paras.filter((para, i) => i > 0 && para.kind !== "child");
653
- if (!breaks.length) continue;
654
- const room = Z.bottom - (q.y + q.h);
655
- const per = Math.min(room / breaks.length > (Z.bottom - Z.y) / 6 ? room / (breaks.length + 1) : room / breaks.length, 0.25 * (Z.bottom - Z.y));
656
- for (const para of breaks) para.gap += per;
657
- q.h += per * breaks.length;
658
- }
659
- return two;
660
- }
661
- }
662
- const headed = ents.length >= 2 && ents.length <= 5 && ents.every((e) => e.head && e.rest && !e.children.length && e.kind === "bullet");
663
- if (headed && (Z.bottom - contentBottom(placed, Z.y)) / (Z.bottom - Z.y) > S.tok.cap) return headedRows(ctx, ents);
664
- return placed;
665
- },
666
-
667
- "text-two-column"(ctx) {
668
- const { S, state, Z } = ctx;
669
- const { columns, texts, visuals } = sortItems(ctx.items);
670
- // Points after the columns are the slide's takeaways: they run under both columns.
671
- if (columns) return stack([columns, ...visuals, ...texts], Z, S, state).placed;
672
- const paras = texts.flatMap(itemParas);
673
- const [l, r] = splitRegion(S, Z, 0.5);
674
- // Break at a section boundary nearest to half the height.
675
- const heights = paras.map((p) => G.textHeight(plainText(p.text), l.w, bodySize(S, state)) + state.itemGap);
676
- const total = heights.reduce((a, b) => a + b, 0);
677
- let acc = 0;
678
- let cut = paras.length;
679
- for (let i = 0; i < paras.length; i++) {
680
- if (i > 0 && paras[i].kind !== "child" && acc >= total / 2 - heights[i] / 2) { cut = i; break; }
681
- acc += heights[i];
682
- }
683
- let out = [textAt(paras.slice(0, cut), l, S, state), textAt(paras.slice(cut), r, S, state)];
684
- // Two sections of unequal length leave one column half empty: the break moves to the point (never between a
685
- // point and its sub-points) that brings the columns nearest even.
686
- if (shortColumn(out, Z.bottom, S).share > 0.35) {
687
- const evenest = (ok) => {
688
- let best = null;
689
- for (let i = 1; i < paras.length; i++) {
690
- if (!ok(i)) continue;
691
- const pair = [textAt(paras.slice(0, i), l, S, state), textAt(paras.slice(i), r, S, state)];
692
- const diff = Math.abs(pair[0].h - pair[1].h);
693
- if (!best || diff < best.diff) best = { pair, diff };
694
- }
695
- return best;
696
- };
697
- let best = evenest((i) => paras[i].kind !== "child");
698
- // Groups too unequal to balance whole may continue in the next column, a head never parted from its first point.
699
- if (!best || shortColumn(best.pair, Z.bottom, S).share > RAIL_EMPTY) {
700
- const inside = evenest((i) => paras[i - 1].kind !== "section");
701
- if (inside && (!best || shortColumn(inside.pair, Z.bottom, S).share < shortColumn(best.pair, Z.bottom, S).share)) best = inside;
702
- }
703
- if (best && shortColumn(best.pair, Z.bottom, S).share < shortColumn(out, Z.bottom, S).share) out = best.pair;
704
- }
705
- if (S.deco.has("hairline-rule") || S.deco.has("column-hairlines")) out.push(columnHairline(S, r, Z));
706
- return out;
707
- },
708
-
709
- "summary-box-list"(ctx) {
710
- const { S, state, Z, spec } = ctx;
711
- const paras = sortItems(ctx.items).texts.flatMap(itemParas);
712
- let box = spec.lead ? [{ kind: "text", text: spec.lead }] : null;
713
- let rest = paras;
714
- if (!box) {
715
- const first = paras.findIndex((p) => p.kind === "text" || p.kind === "bullet");
716
- box = first >= 0 ? [paras[first]] : paras.slice(0, 1);
717
- rest = paras.filter((_, i) => i !== (first >= 0 ? first : 0));
718
- }
719
- const pad = 18;
720
- const boxText = measureText(box.map((p) => ({ ...p, kind: "text" })), Z.w - pad * 2, S, state, { size: S.sizes.lead });
721
- const boxH = boxText.h + pad * 2;
722
- const out = [
723
- { kind: "box", x: Z.x, y: Z.y, w: Z.w, h: boxH, outline: S.deco.has("box-outline"), limit: Z.bottom },
724
- { ...boxText, x: Z.x + pad, y: Z.y + pad, bold: true, limit: Z.bottom },
725
- ];
726
- const below = { ...Z, y: Z.y + boxH + 18 };
727
- const [l, r] = splitRegion(S, below, 0.5);
728
- const ents = entries(rest);
729
- const half = Math.ceil(ents.length / 2);
730
- const flat = (list) => list.flatMap((e) => [{ kind: e.kind === "section" ? "section" : "bullet", text: e.head ? `**${e.head}** ${e.rest}`.trim() : e.rest },
731
- ...e.children.map((c) => ({ kind: "child", text: c }))]);
732
- const split = (k) => [textAt(flat(ents.slice(0, k)), l, S, state), textAt(flat(ents.slice(k)), r, S, state)];
733
- let cols = split(half);
734
- // Groups of unequal length split by count leave one column short (OF-115 reads it whatever the longer column's
735
- // length): the split moves to the group boundary that brings the columns nearest even.
736
- const uneven = (p) => Math.abs(p[0].h - p[1].h);
737
- if (ents.length > 2 && uneven(cols) > 0.35 * (below.bottom - below.y)) {
738
- const even = ents.slice(1).map((_, i) => split(i + 1)).reduce((m, p) => (uneven(p) < uneven(m) ? p : m));
739
- if (uneven(even) < uneven(cols)) cols = even;
740
- }
741
- out.push(...cols);
742
- return out;
743
- },
744
-
745
- "sidebar-note"(ctx) {
746
- const { S, state, Z } = ctx;
747
- const { texts, visuals } = sortItems(ctx.items);
748
- // The note is the fenced main-box, else a last text block after the main one; a lone text block is the main.
749
- const note = texts.find((t) => t.type === "main-box") || (texts.length > 1 ? texts[texts.length - 1] : null);
750
- const main = [...visuals, ...texts.filter((t) => t !== note)];
751
- const [mR, nR] = splitRegion(S, Z, 8 / 12);
752
- const out = stack(main, mR, S, state).placed;
753
- if (note) {
754
- const pad = S.tok.pad;
755
- const m = measureText(itemParas(note), nR.w - pad * 2, S, state);
756
- out.push({ kind: "box", x: nR.x, y: nR.y, w: nR.w, h: m.h + pad * 2, surface: true, limit: Z.bottom },
757
- { ...m, x: nR.x + pad, y: nR.y + pad, limit: Z.bottom });
758
- // A short note beside a long main column leaves its column mostly empty: the note then stands across
759
- // the top at lead size and the main points run in two columns under it.
760
- if (main.length && shortColumn(out, Z.bottom, S).share > RAIL_EMPTY && Z.b - Z.a + 1 >= 12) {
761
- // First a narrower note column at the body size (the note never set larger than the main points), the main
762
- // column wider beside it.
763
- const [mR3, nR3] = splitRegion(S, Z, 9 / 12);
764
- const m3 = measureText(itemParas(note), nR3.w - pad * 2, S, state);
765
- const narrow = [...stack(main, mR3, S, state).placed, { kind: "box", x: nR3.x, y: nR3.y, w: nR3.w, h: m3.h + pad * 2, surface: true, limit: Z.bottom },
766
- { ...m3, x: nR3.x + pad, y: nR3.y + pad, limit: Z.bottom }];
767
- if (!overflows(narrow) && shortColumn(narrow, Z.bottom, S).share <= RAIL_EMPTY && (Z.bottom - contentBottom(narrow, Z.y)) / (Z.bottom - Z.y) <= S.tok.cap) return narrow;
768
- }
769
- if (main.length && !visuals.length && shortColumn(out, Z.bottom, S).share > RAIL_EMPTY) {
770
- // The note keeps a reading measure inside the box (S4.4): about 32 Hangul or 70 Latin characters.
771
- const korean = G.isKorean(itemParas(note).map((p) => p.text).join(""));
772
- const inner = Math.min(Z.w - pad * 2, (korean ? 30 : 35) * S.sizes.lead);
773
- const lead = measureText(itemParas(note).map((p) => ({ ...p, kind: "text" })), inner, S, state, { size: S.sizes.lead });
774
- const boxH = lead.h + pad * 2;
775
- const below = { ...Z, y: Z.y + boxH + state.blockGap };
776
- const fits = (plan) => !plan.some((q) => !q.decor && q.y + q.h > Z.bottom + 0.5);
777
- // One column at the reading measure when it holds the points and reaches the density band (the note at lead
778
- // size, else at the points' own size); else grouped points pick their own two columns in the text-column plan
779
- // and plain points run in two columns.
780
- for (const z of [S.sizes.lead, bodySize(S, state)]) {
781
- const m = measureText(itemParas(note).map((p) => ({ ...p, kind: "text" })), Math.min(Z.w - pad * 2, (korean ? 30 : 35) * z), S, state, { size: z });
782
- const top = Z.y + m.h + pad * 2 + state.blockGap;
783
- const single = stack(main, region(S, Z.a, Math.min(Z.b, Z.a + 8), top, Z.bottom), S, state).placed;
784
- if (!fits(single)) continue;
785
- // Room left under the single column is shared between its groups (at most a sixth of the body a gap).
786
- if (single.length === 1 && single[0].kind === "text") {
787
- const q = single[0];
788
- const breaks = q.paras.filter((para, i) => i > 0 && para.kind === "section");
789
- const room = Z.bottom - (q.y + q.h);
790
- if (breaks.length && room / (Z.bottom - top) > S.tok.cap) {
791
- const per = Math.min(room / (breaks.length + 1), (Z.bottom - Z.y) / 6);
792
- for (const para of breaks) para.gap += per;
793
- q.h += per * breaks.length;
794
- }
795
- }
796
- if ((Z.bottom - contentBottom(single, top)) / (Z.bottom - top) <= S.tok.cap) {
797
- return [{ kind: "box", x: Z.x, y: Z.y, w: Z.w, h: m.h + pad * 2, surface: true, limit: Z.bottom },
798
- { ...m, x: Z.x + pad, y: Z.y + pad, limit: Z.bottom }, ...single];
799
- }
800
- }
801
- let two = PLANS["text-column"]({ ...ctx, Z: below, items: main });
802
- const across = PLANS["text-two-column"]({ ...ctx, Z: below, items: main });
803
- if (!fits(two) || (fits(across) && shortColumn(two, Z.bottom, S).share + (Z.bottom - contentBottom(two, below.y)) / (Z.bottom - below.y) > (Z.bottom - contentBottom(across, below.y)) / (Z.bottom - below.y) + 0.1)) two = across;
804
- if (fits(two)) {
805
- return [{ kind: "box", x: Z.x, y: Z.y, w: Z.w, h: boxH, surface: true, limit: Z.bottom },
806
- { ...lead, x: Z.x + pad, y: Z.y + pad, limit: Z.bottom }, ...two];
807
- }
808
- }
809
- }
810
- return out;
811
- },
812
-
813
- agenda(ctx) {
814
- const { S, state, Z } = ctx;
815
- const ents = entries(sortItems(ctx.items).texts.flatMap(itemParas));
816
- if (!ents.length) return [];
817
- const n = ents.length;
818
- const numW = S.grid.span(1, 1).w;
819
- const textX = Z.x + numW + S.grid.gutter;
820
- const textW = Z.x + Z.w - textX;
821
- const head = bodySize(S, state, "lead");
822
- const rest = bodySize(S, state);
823
- const rows = ents.map((e, i) => {
824
- const headText = e.head || e.rest;
825
- const restText = e.head ? [e.rest, ...e.children].filter(Boolean).join(" · ") : e.children.join(" · ");
826
- const h = G.textHeight(headText, textW, head) + (restText ? 6 + G.textHeight(restText, textW, rest) : 0);
827
- return { num: String(i + 1).padStart(2, "0"), head: headText, rest: restText, h };
828
- });
829
- // Rows share the body down to its floor, at most 108 pt apart.
830
- const tallest = Math.max(...rows.map((r) => r.h));
831
- const pitch = rowPitch(n, tallest, Z, state.groupGap, 108);
832
- rows.forEach((r, i) => { r.y = Z.y + i * pitch; });
833
- return [{ kind: "rows", rows, x: Z.x, numW, textX, textW, head, rest, pitch, rule: S.deco.has("hairline-rule"), y: Z.y, h: (n - 1) * pitch + rows[n - 1].h, limit: Z.bottom }];
834
- },
835
-
836
- "references-appendix"(ctx) {
837
- const { S, state, Z } = ctx;
838
- const paras = sortItems(ctx.items).texts.flatMap(itemParas).map((p) => ({ ...p, kind: "text" }));
839
- let size = S.tok.ramp === "presented" ? (state.stepped ? S.sizes.body : S.sizes.label) : bodySize(S, state);
840
- // Entries are scanned for a name or a year: one per row, rows spread down the page with rules.
841
- // A list longer than the body steps down to label size, then runs in two columns.
842
- // Rows share one pitch, so the tallest entry sets the room every row takes.
843
- const fits = (z, w, n) => n * Math.max(...paras.slice(0, n).map((p) => G.textHeight(plainText(p.text), w, z, 1.3))) + 12 * (n - 1) <= Z.bottom - Z.y;
844
- let cols = [Z];
845
- if (!fits(size, Z.w, paras.length)) {
846
- if (fits(S.sizes.label, Z.w, paras.length)) size = S.sizes.label;
847
- else if (paras.length >= 4) { size = S.sizes.label; cols = splitRegion(S, Z, 0.5); }
848
- }
849
- const per = Math.ceil(paras.length / cols.length);
850
- return cols.flatMap((R, ci) => {
851
- const part = paras.slice(ci * per, (ci + 1) * per);
852
- if (!part.length) return [];
853
- const heights = part.map((p) => G.textHeight(plainText(p.text), R.w, size, 1.3));
854
- const pitch = rowPitch(part.length, Math.max(...heights, 1), R, 12, Math.max(...heights, 1) + 72);
855
- return part.flatMap((p, i) => {
856
- const y = R.y + i * pitch;
857
- const row = { kind: "text", paras: [{ ...p, inset: 0, gap: 0, h: heights[i] }], size, x: R.x, y, w: R.w, h: heights[i], limit: Z.bottom };
858
- return i > 0 && S.deco.has("hairline-rule") ? [{ decor: true, kind: "rect", x: R.x, y: y - (pitch - heights[i - 1]) / 2, w: R.w, h: 0.5, fill: "line" }, row] : [row];
859
- });
860
- });
861
- },
862
-
863
- "kpi-row"(ctx) {
864
- const { S, state, Z } = ctx;
865
- const { visuals, texts } = sortItems(ctx.items);
866
- const kpi = visuals.find((v) => v.type === "kpi-table" && looksLikeKpi(v.content || {}, { basis: true }));
867
- if (!kpi) return PLANS["table-insight"](ctx);
868
- const others = visuals.filter((v) => v !== kpi);
869
- if (Z.b - Z.a + 1 < 10 || (state.anchor && !S.pack.shadow)) {
870
- // Under a side title, or when the values take the room, they run down the body as rows:
871
- // the value, then what it measures.
872
- const cards = shared().kpiCards(kpi.content).slice(0, 6);
873
- const out = [];
874
- const restTexts = texts;
875
- const restH = restTexts.length ? stack(restTexts, Z, S, state).bottom - Z.y + state.blockGap : 0;
876
- const rowsZone = { ...Z, bottom: Z.bottom - restH };
877
- out.push(figureRows(cards, rowsZone, S, state));
878
- if (restTexts.length) out.push(...stack(restTexts, { ...Z, y: rowsZone.bottom + state.blockGap }, S, state).placed);
879
- return out;
880
- }
881
- const top = Z.y;
882
- const cardsPlan = stack([kpi, ...others, ...texts], { ...Z, y: top }, S, state);
883
- // A row of cards with its takeaways under it that stops high on the page: the figures then run as
884
- // rows down the first seven columns (value, label, basis), the caption at their foot, and the
885
- // takeaways stand beside them. A pack with hard shadows keeps its cards: the bordered, shadowed card
886
- // is that pack's figure.
887
- if (texts.length && !others.length && !S.pack.shadow && (Z.bottom - cardsPlan.bottom) / (Z.bottom - Z.y) > S.tok.cap) {
888
- const cards = shared().kpiCards(kpi.content).slice(0, 6);
889
- const [fR, tR] = splitRegion(S, Z, 7 / 12);
890
- const capH = kpi.caption ? captionHeight(kpi.caption, fR.w, S) + 6 : 0;
891
- const rows = figureRows(cards, { ...fR, bottom: fR.bottom - capH }, S, state, 48);
892
- const col = takeawayColumn(ctx, texts, [], tR, fR.bottom);
893
- const notes = col.t;
894
- if (col.strip && col.end <= col.R.bottom + 0.5) notes.placed.push(...col.strip.placed.map((q) => ({ ...q, strip: true })));
895
- if (rows.y + rows.h <= fR.bottom - capH + 0.5 && notes.bottom <= Z.bottom + 0.5) {
896
- const out = [rows, ...notes.placed];
897
- if (kpi.caption) out.push({ kind: "caption", item: { content: kpi.caption }, x: fR.x, y: fR.bottom - capH + 6, w: fR.w, h: capH - 6, limit: Z.bottom });
898
- if (shortColumn(out, Z.bottom, S).share <= 0.35) return out;
899
- // Takeaways too few to fill the column beside the rows: the rows run across the body and the takeaways
900
- // stand under them side by side, the caption between.
901
- const paras = texts.flatMap(itemParas);
902
- const half = Math.ceil(paras.length / 2);
903
- // Up to three points read down one column at the reading measure; four or more stand side by side.
904
- const parts = paras.length >= 4 ? splitRegion(S, Z, 0.5) : [region(S, Z.a, Math.min(Z.b, Z.a + 8), Z.y, Z.bottom)];
905
- // The takeaways keep the size they had beside the rows (lead when the column stepped up).
906
- const keep = (notes.placed.find((q) => q.kind === "text" && !q.strip) || {}).size;
907
- const measured = parts.map((R, i) => measureText(parts.length > 1 ? (i ? paras.slice(half) : paras.slice(0, half)) : paras, R.w, S, state, keep ? { size: keep } : {}));
908
- const notesH = Math.max(...measured.map((m) => m.h));
909
- const rowsBottom = Z.bottom - notesH - state.blockGap - capH;
910
- // Four figures or more stand in two columns of rows, so the rows use the body's width.
911
- const halves = cards.length >= 4 ? splitRegion(S, { ...Z, bottom: rowsBottom }, 0.5) : [{ ...Z, bottom: rowsBottom }];
912
- const split = Math.ceil(cards.length / halves.length);
913
- const across = halves.map((R, i) => figureRows(cards.slice(i * split, (i + 1) * split), R, S, state, 72));
914
- // The second column's rows stand level with the first's (an odd count leaves its last row open).
915
- if (across.length === 2) {
916
- const [a, b] = across;
917
- b.rows.forEach((r, k) => { r.y = a.rows[k].y; });
918
- Object.assign(b, { pitch: a.pitch, value: a.value, labelSize: a.labelSize, noteSize: a.noteSize, h: b.rows.length ? b.rows[b.rows.length - 1].y - b.y + (a.h - (a.rows[a.rows.length - 1].y - a.y)) : 0 });
919
- }
920
- // A band left open between the rows and the takeaways under them is worse than a column whose points share
921
- // the room beside the rows, when that sharing fills the column.
922
- const band = (Z.bottom - notesH - state.blockGap - capH - Math.max(...across.map((q) => q.y + q.h))) / (Z.bottom - Z.y);
923
- if (band > S.tok.cap) {
924
- const filled = structuredClone(out);
925
- fillColumn(shortColumn(filled, Z.bottom, S), Z.bottom, S, state);
926
- if (shortColumn(filled, Z.bottom, S).share <= 0.35) return filled;
927
- }
928
- if (across.every((q) => q.y + q.h <= rowsBottom + 0.5)) {
929
- const res = [...across, ...measured.map((m, i) => ({ ...m, x: parts[i].x, y: Z.bottom - notesH, limit: Z.bottom }))];
930
- if (kpi.caption) res.push({ kind: "caption", item: { content: kpi.caption }, x: Z.x, y: rowsBottom + 6, w: Z.w, h: capH - 6, limit: Z.bottom });
931
- return res;
932
- }
933
- return out;
934
- }
935
- }
936
- return cardsPlan.placed;
937
- },
938
-
939
- "big-number"(ctx) {
940
- const { S, state, Z } = ctx;
941
- const { visuals, texts } = sortItems(ctx.items);
942
- const table = visuals.find((v) => v.type === "kpi-table");
943
- if (!table) return PLANS["text-column"](ctx);
944
- if ((S.pack.display || {}).number) return numberPanel(ctx, table, texts);
945
- const c = table.content || {};
946
- const value = plainText(((c.rows || [])[0] || [])[0] || (c.headers || [])[1] || "");
947
- const label = plainText((c.headers || [])[0] || "");
948
- const wide = Z.b - Z.a + 1 >= 10;
949
- const [nR, tR] = wide ? splitRegion(S, Z, 6 / 12) : [Z, null];
950
- const size = [S.sizes.title, S.sizes.lead].find((v) => S.ems(value, "numeral") * v * 1.04 <= nR.w) || S.sizes.body;
951
- const labelSize = bodySize(S, state, "lead");
952
- const labelH = G.textHeight(label, nR.w, labelSize);
953
- const capH = table.caption ? captionHeight(table.caption, nR.w, S) + 6 : 0;
954
- const blockH = size * 1.15 + 12 + labelH + capH;
955
- const out = [];
956
- // The number opens the body, its evidence beside it or under it.
957
- const y = Z.y;
958
- if (texts.length) {
959
- const R = tR ? region(S, tR.a + 1, tR.b, Z.y, Z.bottom)
960
- : { ...Z, y: Z.y + blockH + state.blockGap };
961
- out.push(...stack(texts, R, S, { ...state, stepped: true }).placed);
962
- }
963
- out.push({ kind: "number", value, label, size, labelSize, x: nR.x, y, w: nR.w, h: size * 1.15 + 12 + labelH, limit: Z.bottom });
964
- if (table.caption) out.push({ kind: "caption", item: { content: table.caption }, x: nR.x, y: y + size * 1.15 + 12 + labelH + 6, w: nR.w, h: capH - 6, limit: Z.bottom });
965
- return out;
966
- },
967
-
968
- "chart-insight"(ctx) {
969
- const { visuals, texts } = sortItems(ctx.items);
970
- return visualWithText(ctx, visuals, texts, 8 / 12);
971
- },
972
-
973
- "full-chart"(ctx) {
974
- const { S, state, Z } = ctx;
975
- const { visuals, texts } = sortItems(ctx.items);
976
- // The note runs under the chart.
977
- return stack([...visuals, ...texts], Z, S, state).placed;
978
- },
979
-
980
- "kpi-over-chart"(ctx) {
981
- const { S, state, Z } = ctx;
982
- const { visuals, texts } = sortItems(ctx.items);
983
- const kpi = visuals.find((v) => v.type === "kpi-table" && looksLikeKpi(v.content || {}, { basis: true }) && !(v.content || {}).chart);
984
- const charts = visuals.filter((v) => v !== kpi);
985
- if (!kpi || !charts.length) return PLANS["chart-insight"](ctx);
986
- return stack([kpi, ...charts, ...texts], Z, S, state).placed;
987
- },
988
-
989
- "dashboard-grid"(ctx) {
990
- const { S, state, Z } = ctx;
991
- const { visuals, texts } = sortItems(ctx.items);
992
- if (visuals.length < 2) return PLANS["chart-insight"](ctx);
993
- const panels = visuals.slice(0, 4);
994
- const out = [];
995
- const cols = panels.length === 3 ? 3 : 2;
996
- const rows = Math.ceil(panels.length / cols);
997
- const textH = texts.length ? stack(texts, Z, S, state).bottom - Z.y + state.blockGap : 0;
998
- const gridZ = { ...Z, bottom: Z.bottom - textH };
999
- const rowH = (gridZ.bottom - gridZ.y - (rows - 1) * S.grid.gutter) / rows;
1000
- const parts = equalParts(S, Z, cols);
1001
- panels.forEach((p, i) => {
1002
- const part = parts[i % cols];
1003
- const y = gridZ.y + Math.floor(i / cols) * (rowH + S.grid.gutter);
1004
- out.push(...stack([p], { ...part, y, bottom: y + rowH }, S, state).placed);
1005
- });
1006
- if (texts.length) out.push(...stack(texts, { ...Z, y: gridZ.bottom + state.blockGap }, S, state).placed);
1007
- return out;
1008
- },
1009
-
1010
- "table-insight"(ctx) {
1011
- const { visuals, texts } = sortItems(ctx.items);
1012
- return visualWithText(ctx, visuals, texts, 8 / 12);
1013
- },
1014
-
1015
- "ledger-table"(ctx) {
1016
- const { S, state, Z } = ctx;
1017
- const { visuals, texts } = sortItems(ctx.items);
1018
- return stack([...visuals, ...texts], Z, S, state).placed;
1019
- },
1020
-
1021
- comparison(ctx) {
1022
- const { S, state } = ctx;
1023
- const { columns, texts, visuals } = sortItems(ctx.items);
1024
- if (visuals.length && !columns) return visualWithText(ctx, visuals, texts, 7 / 12);
1025
- // Beside written columns the loose points are the slide's takeaways: they run under the rows.
1026
- const notes = columns && texts.length ? measureText(texts.flatMap(itemParas), ctx.Z.w, S, state) : null;
1027
- const Z = notes ? { ...ctx.Z, bottom: ctx.Z.bottom - notes.h - state.blockGap } : ctx.Z;
1028
- let halves;
1029
- if (columns) halves = columns.columns.map((col) => (col || []).filter(isText).flatMap(itemParas));
1030
- else {
1031
- const ents = entries(texts.flatMap(itemParas));
1032
- const half = Math.ceil(ents.length / 2);
1033
- const flat = (list) => list.flatMap((e) => [{ kind: "section", text: e.head || e.rest }, ...(e.head && e.rest ? [{ kind: "text", text: e.rest }] : []), ...e.children.map((c) => ({ kind: "child", text: c }))]);
1034
- halves = [flat(ents.slice(0, half)), flat(ents.slice(half))];
1035
- }
1036
- const sides = halves.slice(0, 2).map((paras) => {
1037
- const headIdx = paras.findIndex((p) => p.kind === "section");
1038
- return { head: headIdx >= 0 ? paras[headIdx].text : null,
1039
- items: paras.filter((_, j) => j !== headIdx).map((p) => String(p.text).replace(/^\(\d+\)\s*/u, "")) };
1040
- });
1041
- // Points that open with the same label on both sides ("비용: …") read as criteria rows on the
1042
- // compact step: the label stands once in a column of its own, each side keeps the rest. A label
1043
- // is a short name (three words at most); one row whose two labels differ names both ("Limit /
1044
- // Question"), so a single odd row does not cost the whole slide its criteria.
1045
- const LABEL = /^([^::]{1,24})[::]\s*(.+)$/u;
1046
- const isLabel = (t) => { const m = LABEL.exec(plainText(t)); return Boolean(m) && m[1].trim().split(/\s+/u).length <= 3; };
1047
- let criteria = null;
1048
- if (S.tok.tight && sides.length === 2 && sides.every((sd) => sd.items.length && sd.items.every(isLabel))) {
1049
- const n = Math.max(...sides.map((sd) => sd.items.length));
1050
- const sets = Array.from({ length: n }, (_, r) => [...new Set(sides.map((sd) => sd.items[r] && LABEL.exec(plainText(sd.items[r]))[1].trim()).filter(Boolean))]);
1051
- const labels = sets.map((set) => set.join(" / "));
1052
- const odd = sets.filter((set) => set.length > 1).length;
1053
- if (odd <= 1 && odd < n / 2) {
1054
- criteria = labels;
1055
- for (const sd of sides) sd.items = sd.items.map((t) => LABEL.exec(plainText(t))[2]);
1056
- }
1057
- }
1058
- const floor = Z.bottom;
1059
- const critR = criteria ? region(S, Z.a, Z.a + 1, Z.y, Z.bottom) : null;
1060
- const parts = criteria ? splitRegion(S, region(S, Z.a + 2, Z.b, Z.y, Z.bottom), 0.5) : splitRegion(S, Z, 0.5);
1061
- const headSize = bodySize(S, state, "lead");
1062
- // Up to three rows of short points are set a step or two larger when that still keeps a dozen
1063
- // glyphs a line and fits the body; a two-row comparison otherwise holds a third of the page.
1064
- const rowsN = Math.max(...sides.map((sd) => sd.items.length));
1065
- const fitsAt = (z) => {
1066
- if (parts[0].w / z < 12) return false;
1067
- const hs = Array.from({ length: rowsN }, (_, r) => Math.max(...sides.map((sd, i) => (sd.items[r] ? G.textHeight(plainText(sd.items[r]), parts[i].w, z) : 0))));
1068
- const headRoom = Math.max(0, ...sides.map((sd, i) => (sd.head ? G.textHeight(plainText(sd.head), parts[i].w, headSize) + 30 : 0)));
1069
- return Z.y + headRoom + hs.reduce((a, b) => a + b, 0) + (rowsN - 1) * state.groupGap * 2 <= floor;
1070
- };
1071
- // The compact step never inflates type to fill: its rows keep the body size.
1072
- const itemSize = (rowsN <= 3 && !S.tok.tight ? [S.sizes.title, S.sizes.lead].filter((z) => z > bodySize(S, state)) : []).find(fitsAt) || bodySize(S, state);
1073
- const out = [];
1074
- const headH = Math.max(0, ...sides.map((sd, i) => (sd.head ? G.textHeight(plainText(sd.head), parts[i].w, headSize) : 0)));
1075
- let top = Z.y;
1076
- if (headH) {
1077
- sides.forEach((sd, i) => {
1078
- if (!sd.head) return;
1079
- out.push({ kind: "text", paras: [{ kind: "section", text: sd.head, inset: 0, h: headH, gap: 0 }], size: headSize, x: parts[i].x, y: Z.y, w: parts[i].w, h: headH, limit: Z.bottom, bold: true });
1080
- const accent = S.deco.has("accent-rule");
1081
- out.push({ decor: true, kind: "rect", x: parts[i].x, y: Z.y + headH + 12, w: accent ? S.grid.col : parts[i].w, h: accent ? 3 : 0.75, fill: accent ? "accent" : "line" });
1082
- });
1083
- top = Z.y + headH + 30;
1084
- }
1085
- // Parallel points share a row, so they are read across; the rows run down to the floor.
1086
- const n = Math.max(...sides.map((sd) => sd.items.length));
1087
- const labelH = (r) => (criteria ? G.textHeight(criteria[r], critR.w / S.wide("title", criteria[r]), itemSize) : 0);
1088
- // Measured on the lines the text frame will set (word by word), so a narrow side keeps its lines.
1089
- const sideH = (t, i) => {
1090
- const w = parts[i].w / S.wide("body");
1091
- return G.textHeight(G.keepLines(plainText(t), w / itemSize, 99), w, itemSize);
1092
- };
1093
- const rowH = Array.from({ length: n }, (_, r) => Math.max(labelH(r), ...sides.map((sd, i) => (sd.items[r] ? sideH(sd.items[r], i) : 0))));
1094
- const pitch = rowPitch(n, Math.max(...rowH), { y: top, bottom: floor }, state.groupGap, Math.max(112, Math.max(...rowH) + 72));
1095
- // On the compact step each row starts one even gap under the one before (rows of two and three
1096
- // lines alike). The gap opens up to a fifth of the body so four one-line rows across the full body
1097
- // width reach the floor, and never ends the rows higher than a pitch of the tallest row plus 48 pt would.
1098
- const sum = rowH.reduce((a, b) => a + b, 0);
1099
- const reach = n > 1 ? ((n - 1) * (Math.max(...rowH) + 48) + rowH[n - 1] - sum) / (n - 1) : 0;
1100
- const gap = n > 1 ? Math.max(state.groupGap, Math.min(Math.max(48, (floor - Z.y) / 5, reach), (floor - top - sum) / (n - 1))) : 0;
1101
- const ys = rowH.map((_, r) => (S.tok.tight ? top + rowH.slice(0, r).reduce((a, b) => a + b, 0) + r * gap : top + r * pitch));
1102
- for (let r = 0; r < n; r++) {
1103
- const y = ys[r];
1104
- if (r > 0 && (S.deco.has("hairline-rule") || S.deco.has("column-hairlines"))) {
1105
- out.push({ decor: true, kind: "rect", x: Z.x, y: y - Math.min(18, (y - ys[r - 1] - rowH[r - 1]) / 2), w: Z.w, h: 0.5, fill: "line" });
1106
- }
1107
- if (criteria) out.push({ kind: "text", paras: [{ kind: "text", text: criteria[r], inset: 0, h: labelH(r), gap: 0 }], size: itemSize, x: critR.x, y, w: critR.w, h: labelH(r), limit: floor, bold: true });
1108
- sides.forEach((sd, i) => {
1109
- if (!sd.items[r]) return;
1110
- const h = sideH(sd.items[r], i);
1111
- out.push({ kind: "text", paras: [{ kind: "text", text: sd.items[r], inset: 0, h, gap: 0 }], size: itemSize, x: parts[i].x, y, w: parts[i].w, h, limit: Z.bottom });
1112
- });
1113
- }
1114
- if (S.deco.has("column-hairlines")) out.push(columnHairline(S, parts[1], Z));
1115
- if (notes) out.push({ ...notes, x: Z.x, y: Z.bottom + state.blockGap, limit: ctx.Z.bottom });
1116
- return out;
1117
- },
1118
-
1119
- process(ctx) {
1120
- const { S, state } = ctx;
1121
- const all = entries(sortItems(ctx.items).texts.flatMap(itemParas));
1122
- // Points without a bold head after the steps are the slide's takeaways: they run under the
1123
- // steps instead of being read as more steps (or dropped past the fifth).
1124
- const headed = all.filter((e) => e.head);
1125
- const loose = headed.length >= 2 && headed.length < all.length ? all.filter((e) => !e.head) : [];
1126
- const ents = loose.length ? headed : all;
1127
- if (ents.length < 2) return PLANS["text-column"](ctx);
1128
- const notes = loose.length ? measureText(loose.flatMap((e) => [{ kind: "bullet", text: e.rest }, ...e.children.map((c) => ({ kind: "child", text: c }))]), ctx.Z.w, S, state) : null;
1129
- const Z = notes ? { ...ctx.Z, bottom: ctx.Z.bottom - notes.h - state.blockGap } : ctx.Z;
1130
- const withNotes = (placed) => (notes ? [...placed, { ...notes, x: Z.x, y: Z.bottom + state.blockGap, limit: ctx.Z.bottom }] : placed);
1131
- const steps = ents.slice(0, 5).map((e, i) => {
1132
- const o = ordinal(e.head || "", i);
1133
- // Sub-points read as details of the step, joined with the step's text, without their "(1)".
1134
- return { n: o.n, head: o.head || e.rest, rest: [o.head ? e.rest : "", ...e.children.map((c) => String(c).replace(/^\(\d+\)\s*/u, ""))].filter(Boolean).join(" · ") };
1135
- });
1136
- const numSize = S.sizes.display;
1137
- const headSize = bodySize(S, state, "lead");
1138
- const restSize = bodySize(S, state);
1139
- const asRows = () => {
1140
- if (S.tok.tight && Z.b - Z.a + 1 >= 10) {
1141
- // On the compact step a row reads across: the numeral, the step's name, then what happens.
1142
- const numW = S.grid.span(1, 1).w;
1143
- const headR = region(S, Z.a + 1, Z.a + 3, Z.y, Z.bottom);
1144
- const restX = headR.x + headR.w + S.grid.gutter;
1145
- const korean = G.isKorean(steps.map((st) => st.head + st.rest).join(""));
1146
- // The same readable measure as the stacked rows (S4.4; the gate counts spaces as characters). That
1147
- // measure at body size leaves the body's right columns empty, so what happens is set a step up (lead)
1148
- // when the rows still fit: the measure grows with the size and reaches across.
1149
- // `flush` sets what happens against the body's right edge and gives the step's name the columns
1150
- // between, so a body-size measure still reaches across when the lead step does not fit.
1151
- const at = (size, flush = false) => {
1152
- const restW = Math.min(Z.x + Z.w - restX, (korean ? 26 : 35) * size);
1153
- const rx = flush ? Z.x + Z.w - restW : restX;
1154
- const headW = rx - S.grid.gutter - headR.x;
1155
- const rows = steps.map((st) => {
1156
- const hh = G.textHeight(st.head, headW, headSize);
1157
- const rh = st.rest ? G.textHeight(st.rest, restW, size) : 0;
1158
- return { num: st.n, head: st.head, rest: st.rest, hh, rh, h: Math.max(numSize * 1.15, hh, rh) };
1159
- });
1160
- const tallest = Math.max(...rows.map((r) => r.h));
1161
- const pitch = rowPitch(rows.length, tallest, Z, state.groupGap, tallest + 48);
1162
- rows.forEach((r, i) => { r.y = Z.y + i * pitch; });
1163
- return { kind: "rows", rows, x: Z.x, numW, textX: headR.x, textW: headW, restX: rx, restW, head: headSize, rest: size, numSize, pitch, rule: true,
1164
- y: Z.y, h: (rows.length - 1) * pitch + rows[rows.length - 1].h, limit: Z.bottom };
1165
- };
1166
- const body = at(restSize);
1167
- if ((Z.x + Z.w - (restX + body.restW)) / Z.w > 0.25) {
1168
- const lead = at(S.sizes.lead);
1169
- if (lead.y + lead.h <= Z.bottom + 0.5) return [lead];
1170
- return [at(restSize, true)];
1171
- }
1172
- return [body];
1173
- }
1174
- const numW = S.grid.span(1, 2).w;
1175
- const textX = Z.x + numW + S.grid.gutter;
1176
- // Across the full body a step's text keeps a readable measure (S4.4; the gate counts spaces and separators as characters).
1177
- const korean = G.isKorean(steps.map((s) => s.head + s.rest).join(""));
1178
- const textW = Math.min(Z.x + Z.w - textX, korean ? 26 * restSize : 35 * restSize);
1179
- const rows = steps.map((s) => ({ num: s.n, head: s.head, rest: s.rest,
1180
- h: Math.max(numSize * 1.15, G.textHeight(s.head, textW, headSize) + (s.rest ? 6 + G.textHeight(s.rest, textW, restSize) : 0)) }));
1181
- const pitch = rowPitch(rows.length, Math.max(...rows.map((r) => r.h)), Z, state.groupGap, 160);
1182
- rows.forEach((r, i) => { r.y = Z.y + i * pitch; });
1183
- return [{ kind: "rows", rows, x: Z.x, numW, textX, textW, head: headSize, rest: restSize, numSize, pitch, rule: true, y: Z.y, h: (rows.length - 1) * pitch + rows[rows.length - 1].h, limit: Z.bottom }];
1184
- };
1185
- const slots = equalParts(S, Z, steps.length);
1186
- const placedSteps = steps.map((s, i) => {
1187
- const R = slots[i];
1188
- const headH = G.textHeight(s.head, R.w, headSize);
1189
- const restH = s.rest ? G.textHeight(s.rest, R.w, restSize) : 0;
1190
- return { ...s, x: R.x, w: R.w, headH, restH };
1191
- });
1192
- const h = numSize * 1.1 + 18 + Math.max(...placedSteps.map((s) => s.headH + (s.restH ? 12 + s.restH : 0)));
1193
- // Up to four steps whose columns stop high on the body run as rows down it instead.
1194
- if (steps.length <= 4 && (Z.bottom - Z.y - h) / (Z.bottom - Z.y) > S.tok.cap) {
1195
- const rows = asRows();
1196
- if (rows[0].y + rows[0].h <= Z.bottom + 0.5) return withNotes(rows);
1197
- }
1198
- return withNotes([{ kind: "steps", steps: placedSteps, numSize, headSize, restSize, y: Z.y, h, limit: Z.bottom }]);
1199
- },
1200
-
1201
- timeline(ctx) {
1202
- const { S, state, Z } = ctx;
1203
- const { visuals, texts } = sortItems(ctx.items);
1204
- const table = visuals.find((v) => v.type === "kpi-table");
1205
- let events;
1206
- if (table) events = (table.content.rows || []).map((r) => ({ date: plainText(r[0]), label: plainText(r[1] || ""), status: plainText(r.slice(2).join(" · ")) }));
1207
- else events = entries(texts.flatMap(itemParas)).map((e) => ({ date: e.head, label: e.rest, status: e.children.join(" · ") }));
1208
- events = events.slice(0, 6);
1209
- if (!events.length) return PLANS["text-column"](ctx);
1210
- const slots = equalParts(S, Z, events.length);
1211
- const dateSize = bodySize(S, state, "lead");
1212
- const labelSize = bodySize(S, state);
1213
- // The axis runs under the tallest date at the top of the body; the room left under the whole
1214
- // plan is shared out below (see the end of this plan).
1215
- const dateH = Math.max(...events.map((e, i) => G.textHeight(e.date, slots[i].w, dateSize, 1.25)));
1216
- const axisY = Math.round(Z.y + dateH + 18);
1217
- const items = events.map((e, i) => {
1218
- const R = slots[i];
1219
- const labelH = G.textHeight(e.label, R.w, labelSize);
1220
- const statusH = e.status ? 6 + G.textHeight(e.status, R.w, S.sizes.label, 1.3) : 0;
1221
- return { ...e, x: R.x, w: R.w, labelH, statusH };
1222
- });
1223
- const below = Math.max(...items.map((e) => e.labelH + e.statusH));
1224
- const cap = table && table.caption ? { kind: "caption", item: { content: table.caption }, x: Z.x, w: Z.w, h: captionHeight(table.caption, Z.w, S) } : null;
1225
- const out = [{ kind: "timeline", events: items, axisY, dateSize, labelSize, x: Z.x, w: Z.w, y: axisY - dateH - 18, h: dateH + 18 + 18 + below, limit: Z.bottom }];
1226
- if (cap) out.push({ ...cap, y: out[0].y + out[0].h + 18, limit: Z.bottom });
1227
- // When a table carries the events, the bullets are the takeaway and run under the axis.
1228
- if (table && texts.length) {
1229
- const top = Math.max(...out.map((q) => q.y + q.h)) + state.blockGap;
1230
- out.push(...stack(texts, { ...Z, y: top }, S, state).placed);
1231
- }
1232
- // Room past the density band is shared evenly: over the axis, between the axis and its takeaways,
1233
- // and under them, so no one band holds it (an axis halfway down left the top third empty).
1234
- const room = Z.bottom - contentBottom(out, Z.y);
1235
- if (room / (Z.bottom - Z.y) > S.tok.cap) {
1236
- // A single takeaway line stays with the axis it reads (a band over one line set it adrift), so the
1237
- // pair moves together, the room shared over and under it.
1238
- const single = texts.flatMap(itemParas).length === 1;
1239
- const blocks = out.length > (cap ? 2 : 1) && !single ? 3 : 2;
1240
- const step = Math.floor(room / blocks);
1241
- out.forEach((q, i) => {
1242
- const dy = step * (i < (cap ? 2 : 1) || single ? 1 : 2);
1243
- q.y += dy;
1244
- if (q.kind === "timeline") q.axisY += dy;
1245
- if (q.kind === "group") shiftGroup(q, dy);
1246
- });
1247
- }
1248
- return out;
1249
- },
1250
-
1251
- "matrix-2x2"(ctx) {
1252
- const { S, state, Z } = ctx;
1253
- const { visuals, texts } = sortItems(ctx.items);
1254
- const table = visuals.find((v) => v.type === "kpi-table");
1255
- const c = (table && table.content) || {};
1256
- if (!table || (c.headers || []).length !== 3 || (c.rows || []).length !== 2) return PLANS["table-insight"](ctx);
1257
- const [yName, xName] = String(plainText(c.headers[0])).split(/\s*[\\/]\s*/u);
1258
- // The takeaways stand beside the quadrants in the last four columns (under the matrix on a
1259
- // narrow body), so the matrix never drops them.
1260
- const wide = texts.length && Z.b - Z.a + 1 >= 10;
1261
- const M = wide ? region(S, Z.a, Z.b - 4, Z.y, Z.bottom) : Z;
1262
- const notesH = texts.length && !wide ? stack(texts, Z, S, state).bottom - Z.y + state.blockGap : 0;
1263
- const mBottom = M.bottom - notesH;
1264
- const labelCols = wide ? 1 : 2;
1265
- const labels = region(S, M.a, M.a + labelCols - 1, M.y, mBottom);
1266
- const grid = region(S, M.a + labelCols, M.b, M.y, mBottom);
1267
- const capH = table.caption ? captionHeight(table.caption, grid.w, S) + 6 : 0;
1268
- const headH = S.sizes.label * 1.4 + 12;
1269
- const gap = S.grid.gutter;
1270
- const top = grid.y + headH;
1271
- const qh = (grid.bottom - capH - top - gap) / 2;
1272
- const qw = (grid.w - gap) / 2;
1273
- const pad = 18;
1274
- // A cell is its item over its details: "포장재 단가 재협상 · 연 6억 원 · 즉시" sets the item as the
1275
- // cell's head and each detail on a line under it.
1276
- const head = bodySize(S, state, "lead");
1277
- const detail = bodySize(S, state);
1278
- const cells = [0, 1].flatMap((ri) => [0, 1].map((ci) => {
1279
- const [first, ...rest] = plainText(c.rows[ri][ci + 1]).split(/\s+·\s+/u);
1280
- const headH = G.textHeight(first, qw - pad * 2, head, 1.3);
1281
- const details = rest.map((t) => ({ text: t, h: G.textHeight(t, qw - pad * 2, detail) }));
1282
- return { head: first, headH, details, x: grid.x + ci * (qw + gap), y: top + ri * (qh + gap), w: qw, h: qh };
1283
- }));
1284
- const out = [{ kind: "matrix", cells, xHeads: [plainText(c.headers[1]), plainText(c.headers[2])], yHeads: [plainText(c.rows[0][0]), plainText(c.rows[1][0])],
1285
- xName: xName || "", yName: yName || "", labels, grid, top, qw, qh, gap, pad, head, detail,
1286
- caption: table.caption, x: M.x, y: M.y, w: M.w, h: grid.bottom - M.y, limit: Z.bottom }];
1287
- if (texts.length) {
1288
- const R = wide ? region(S, Z.b - 3, Z.b, Z.y, Z.bottom) : { ...Z, y: mBottom + state.blockGap };
1289
- out.push(...stack(texts, R, S, state).placed);
1290
- }
1291
- return out;
1292
- },
1293
-
1294
- quote(ctx) {
1295
- const { S, state, Z } = ctx;
1296
- const paras = sortItems(ctx.items).texts.flatMap(itemParas);
1297
- const by = paras.find((p) => /^[—–-]\s*/u.test(plainText(p.text)));
1298
- const said = paras.filter((p) => p !== by).map((p) => p.text).join(" ");
1299
- const markW = S.grid.span(1, 1).w;
1300
- const R = region(S, Math.min(Z.b, Z.a + 1), Math.max(Z.a + 1, Z.b - 2), Z.y + 24, Z.bottom);
1301
- const size = S.sizes.title;
1302
- const h = G.textHeight(plainText(said), R.w, size, 1.3);
1303
- const blockH = h + (by ? 18 + S.sizes.label * 1.4 : 0);
1304
- // Beside a side title the quote is the slide's display element: it sits in the middle of the
1305
- // body, as a statement does, instead of at the top of an empty page.
1306
- const y = R.y;
1307
- return [{ kind: "quote", text: said, by: by ? plainText(by.text) : "", size, x: R.x, w: R.w, y, h: blockH, textH: h, markX: Z.x, markW, limit: Z.bottom }];
1308
- },
1309
-
1310
- "image-split"(ctx) {
1311
- const { visuals, texts } = sortItems(ctx.items);
1312
- return visualWithText(ctx, visuals, texts, 7 / 12);
1313
- },
1314
-
1315
- "figure-academic"(ctx) {
1316
- const { visuals, texts } = sortItems(ctx.items);
1317
- return visualWithText(ctx, visuals, texts, 8 / 12);
1318
- },
1319
-
1320
- method(ctx) {
1321
- const { S, state, Z } = ctx;
1322
- const { visuals, texts } = sortItems(ctx.items);
1323
- const paras = texts.flatMap(itemParas);
1324
- const formula = paras.filter((p) => p.kind === "text");
1325
- const defs = paras.filter((p) => p.kind !== "text");
1326
- if (!visuals.length && !formula.length) return PLANS["text-column"](ctx);
1327
- const defsItem = defs.length ? [{ type: "body", content: { items: [] }, paras: defs }] : [];
1328
- const out = [];
1329
- const place = (R) => {
1330
- if (visuals.length) out.push(...stack(visuals, R, S, state).placed);
1331
- else {
1332
- const size = S.sizes.title;
1333
- const h = G.textHeight(plainText(formula.map((p) => p.text).join("\n")), R.w, size, 1.4);
1334
- out.push({ kind: "text", paras: formula.map((p) => ({ ...p, inset: 0, gap: 0, h: G.textHeight(plainText(p.text), R.w, size, 1.4) })), size, x: R.x, w: R.w, y: R.y, h, limit: R.bottom, accent: true });
1335
- }
1336
- };
1337
- if (!defsItem.length) { place(Z); return out; }
1338
- const defsAt = (R) => textAt(defs, R, S, { ...state, itemGap: Math.max(state.itemGap, 12) });
1339
- if (!visuals.length && Z.b - Z.a + 1 >= 8) {
1340
- // The formula runs across the top and its terms in columns under it, instead of one line over an empty
1341
- // column beside the terms (on every density step).
1342
- place(Z);
1343
- const below = { ...Z, y: Math.max(...out.map((q) => q.y + q.h)) + state.blockGap };
1344
- // Two columns of terms, else three (a formula beside its terms left its own column four-fifths empty).
1345
- for (const n of [2, 3]) {
1346
- const cols = defsInColumns(defs, below, n);
1347
- if (cols.every((q) => q.y + q.h <= Z.bottom)) return [...out, ...cols];
1348
- }
1349
- out.length = 0;
1350
- }
1351
- // A wide figure (twice as wide as tall or more) set in half the body is drawn at a third of its column's
1352
- // height: it runs across the top instead and its terms stand in two columns under it.
1353
- const size = visuals.length === 1 && visuals[0].type === "image" && visuals[0].imageSize;
1354
- if (S.tok.tight && size && size.width / size.height >= 2 && Z.b - Z.a + 1 >= 8) {
1355
- const cap = captionHeight(visuals[0].caption, Z.w, S);
1356
- for (const [share, n] of [[0.5, 2], [0.45, 2], [0.5, 3], [0.42, 3], [0.36, 3]]) {
1357
- const figH = Math.min(Math.round(Z.w * size.height / size.width) + cap, Math.round((Z.bottom - Z.y) * share));
1358
- place({ ...Z, bottom: Z.y + figH });
1359
- // Measured at their closest step first: whether the terms fit under the figure is not a question of
1360
- // how far they may then open to fill the room.
1361
- const under = { ...Z, y: Z.y + figH + state.blockGap };
1362
- let cols = defsInColumns(defs, under, n, false);
1363
- // The source strip closes the shortest column when it fits there.
1364
- const last = cols.reduce((m, q) => (q.y + q.h < m.y + m.h ? q : m));
1365
- const strip = ctx.strip ? stripPlacements(ctx.strip, { ...Z, x: last.x, w: last.w }, S) : null;
1366
- const closes = strip && last.y + last.h * 1.1 + S.tok.block + strip.h <= Z.bottom;
1367
- // A figure across the body is wider at 130 pt than it stands beside its terms at full column height.
1368
- if (figH - cap >= 130 && cols.every((q) => q.y + q.h * 1.1 <= Z.bottom) && (!strip || closes)) {
1369
- // Then the terms open over the room left above the strip, when they still fit there.
1370
- const roomy = defsInColumns(defs, { ...under, bottom: strip ? Z.bottom - strip.h - S.tok.block : Z.bottom }, n);
1371
- if (roomy.every((q) => q.y + q.h * 1.05 <= (strip ? Z.bottom - strip.h - S.tok.block : Z.bottom))) cols = roomy;
1372
- return [...out, ...cols.map((q) => ({ ...q, limit: Z.bottom - q.h * 0.1 })), ...(strip ? strip.placed.map((q) => ({ ...q, strip: true })) : [])];
1373
- }
1374
- out.length = 0;
1375
- }
1376
- }
1377
- const [vR, full] = splitRegion(S, Z, 7 / 12);
1378
- place(vR);
1379
- // Beside a figure the terms' column closes with the source strip when it ends above the figure, and
1380
- // terms that still leave 40 % of it empty are set a step up.
1381
- const strip = ctx.strip && visuals.length ? stripPlacements(ctx.strip, full, S) : null;
1382
- const dR = strip ? { ...full, bottom: full.bottom - strip.h - S.tok.block } : full;
1383
- let beside = defsAt(dR);
1384
- if (visuals.length && (dR.bottom - (beside.y + beside.h)) / (dR.bottom - dR.y) > 0.4 && dR.w / S.sizes.lead >= 12) {
1385
- const lead = textAt(defs, dR, S, { ...state, stepped: true, itemGap: Math.max(state.itemGap, 12) });
1386
- if (lead.y + lead.h <= dR.bottom + 0.5) beside = lead;
1387
- }
1388
- if (strip && beside.y + beside.h <= dR.bottom + 0.5) out.push(...strip.placed.map((q) => ({ ...q, strip: true })));
1389
- if (S.tok.tight && visuals.length && beside.y + beside.h > Z.bottom) {
1390
- // Terms too long for five columns beside the figure: first half and half, the terms in one column
1391
- // (the figure keeps six columns, so its own labels stay readable); then the figure takes five
1392
- // columns and the terms run in two columns over the other seven.
1393
- const [hR, tR6] = splitRegion(S, Z, 6 / 12);
1394
- const strip6 = ctx.strip ? stripPlacements(ctx.strip, tR6, S) : null;
1395
- const one = textAt(defs, strip6 ? { ...tR6, bottom: tR6.bottom - strip6.h - S.tok.block } : tR6, S, { ...state, itemGap: Math.max(state.itemGap, 12) });
1396
- if (one.y + one.h * 1.1 <= (strip6 ? tR6.bottom - strip6.h - S.tok.block : Z.bottom)) {
1397
- out.length = 0;
1398
- place(hR);
1399
- return [...out, { ...one, limit: Z.bottom - one.h * 0.1 }, ...(strip6 ? strip6.placed.map((q) => ({ ...q, strip: true })) : [])];
1400
- }
1401
- // The text estimate runs short of what a renderer sets for Latin, so the columns keep a tenth
1402
- // of their height spare; the figure gives up a further column when five leave too little.
1403
- for (const share of [5 / 12, 4 / 12]) {
1404
- out.length = 0;
1405
- const [fR, tR] = splitRegion(S, Z, share);
1406
- const cols = defsInColumns(defs, tR);
1407
- if (share < 5 / 12 || cols.every((q) => q.y + q.h * 1.1 <= Z.bottom)) {
1408
- place(fR);
1409
- // The spare tenth is part of each column's limit, so a slide that cannot keep it reads as
1410
- // overflowing and takes a title that leaves the terms more room.
1411
- return [...out, ...cols.map((q) => ({ ...q, limit: Z.bottom - q.h * 0.1 }))];
1412
- }
1413
- }
1414
- }
1415
- out.push(beside);
1416
- return out;
1417
-
1418
- // The terms split between two columns at the entry that brings the first nearest half the height (three
1419
- // columns: the cuts that keep the tallest column lowest).
1420
- function defsInColumns(list, R, n = 2, open = true) {
1421
- const ents = entries(list);
1422
- const flat = (part) => part.flatMap((e) => [{ kind: e.kind === "section" ? "section" : "bullet", text: e.head ? `**${e.head}** ${e.rest}`.trim() : e.rest },
1423
- ...e.children.map((c) => ({ kind: "child", text: c }))]);
1424
- const cols = equalParts(S, R, n);
1425
- const fits = (st) => cols.every((C) => C.y + measureText(flat(ents), C.w, S, st).h / n <= C.bottom);
1426
- // Terms keep a 12 pt step between them when the columns hold it, else the item gap. Terms that leave
1427
- // more than the density band empty under them open the step, up to 36 pt, while the columns hold it.
1428
- const at = (g) => ({ ...state, itemGap: Math.max(state.itemGap, g) });
1429
- const loose = (st) => (C) => (C.bottom - C.y - measureText(flat(ents), C.w, S, st).h / n) / (C.bottom - C.y) > S.tok.cap;
1430
- let gapped = fits(at(12)) ? at(12) : state;
1431
- if (open && gapped !== state && cols.every(loose(gapped))) gapped = [36, 30, 24, 18].map(at).find(fits) || gapped;
1432
- const tall = (part) => (part.length ? measureText(flat(part), cols[0].w, S, gapped).h : 0);
1433
- if (n === 3 && ents.length >= 3) {
1434
- let best = null;
1435
- for (let a = 1; a < ents.length - 1; a++) for (let b = a + 1; b < ents.length; b++) {
1436
- const top = Math.max(tall(ents.slice(0, a)), tall(ents.slice(a, b)), tall(ents.slice(b)));
1437
- if (!best || top < best.top) best = { a, b, top };
1438
- }
1439
- const parts = [ents.slice(0, best.a), ents.slice(best.a, best.b), ents.slice(best.b)];
1440
- return cols.map((C, i) => textAt(flat(parts[i]), C, S, gapped));
1441
- }
1442
- let cut = 1;
1443
- for (let k = 1; k < ents.length; k++) if (Math.abs(tall(ents.slice(0, k)) - tall(ents.slice(k))) < Math.abs(tall(ents.slice(0, cut)) - tall(ents.slice(cut)))) cut = k;
1444
- const res = cols.map((C, i) => textAt(flat(i ? ents.slice(cut) : ents.slice(0, cut)), C, S, gapped));
1445
- return res;
1446
- }
1447
- },
1448
-
1449
- "photo-grid"(ctx) {
1450
- const { S, state, Z } = ctx;
1451
- const { visuals, texts } = sortItems(ctx.items);
1452
- const images = visuals.flatMap((v) => (v.type === "image-grid" ? (v.content.images || []).map((im) => ({ type: "image", content: im })) : v.type === "image" ? [v] : []));
1453
- if (images.length < 2) return PLANS["image-split"](ctx);
1454
- const textH = texts.length ? stack(texts, Z, S, state).bottom - Z.y + state.blockGap : 0;
1455
- const parts = equalParts(S, { ...Z, bottom: Z.bottom - textH }, Math.min(3, images.length));
1456
- const out = images.slice(0, 3).flatMap((im, i) => stack([im], parts[i], S, state).placed);
1457
- if (texts.length) out.push(...stack(texts, { ...Z, y: Z.bottom - textH + state.blockGap }, S, state).placed);
1458
- return out;
1459
- },
1460
-
1461
- "figure-pair"(ctx) {
1462
- const { S, state, Z } = ctx;
1463
- const { visuals, texts } = sortItems(ctx.items);
1464
- if (visuals.length < 2) return PLANS["figure-academic"](ctx);
1465
- const textH = texts.length ? stack(texts, Z, S, state).bottom - Z.y + state.blockGap : 0;
1466
- const [l, r] = splitRegion(S, { ...Z, bottom: Z.bottom - textH }, 0.5);
1467
- const out = [...stack([visuals[0]], l, S, state).placed, ...stack([visuals[1]], r, S, state).placed];
1468
- if (texts.length) out.push(...stack(texts, { ...Z, y: Z.bottom - textH + state.blockGap }, S, state).placed);
1469
- return out;
1470
- },
1471
-
1472
- "asymmetric-feature"(ctx) {
1473
- const { S, state, Z } = ctx;
1474
- const { visuals, texts } = sortItems(ctx.items);
1475
- const table = visuals.find((v) => v.type === "kpi-table" && (v.content.rows || []).length <= 1);
1476
- if (table && !visuals.some((v) => v.type !== "kpi-table")) return PLANS["big-number"](ctx);
1477
- return visualWithText(ctx, visuals, texts, 5 / 12);
1478
- },
1479
-
1480
- // ── Closings (content slides whose title states the ask) ──
1481
- "closing-ask"(ctx) {
1482
- const { S, state, Z } = ctx;
1483
- const { visuals, texts } = sortItems(ctx.items);
1484
- const acts = visuals.length === 1 && visuals[0].type === "kpi-table" && !visuals[0].content.chart ? actionRows(visuals[0].content) : null;
1485
- if (!acts) return visualWithText(ctx, visuals, texts, 8 / 12);
1486
- const step = texts.length ? nextStep(ctx, texts, Z, (S.pack.display || {}).closing || "box") : null;
1487
- // The rows share the room down to the step's own top, so the gap above the step is one of theirs.
1488
- const R = { ...Z, bottom: step ? step.top + state.blockGap : Z.bottom };
1489
- const rows = placeActions(ctx, acts, R, { last: Boolean(step) });
1490
- // Rows that do not fit above the step keep the table.
1491
- if (!rows) return visualWithText(ctx, visuals, texts, 8 / 12);
1492
- return [...rows, ...(step ? step.placed : [])];
1493
- },
1494
-
1495
- "closing-decision-box"(ctx) {
1496
- const { S, state, Z } = ctx;
1497
- const { visuals, texts } = sortItems(ctx.items);
1498
- const out = [];
1499
- let y = Z.y;
1500
- const acts = visuals.length === 1 && visuals[0].type === "kpi-table" && !visuals[0].content.chart ? actionRows(visuals[0].content) : null;
1501
- if (texts.length) {
1502
- const pad = 18;
1503
- const paras = texts.flatMap(itemParas).map((p) => ({ ...p, kind: "text" }));
1504
- const m = measureText(paras, Z.w - pad * 2, S, state, { size: S.sizes.lead });
1505
- out.push({ kind: "box", x: Z.x, y, w: Z.w, h: m.h + pad * 2, outline: S.deco.has("box-outline"), tint: !S.deco.has("box-outline"), limit: Z.bottom },
1506
- { ...m, x: Z.x + pad, y: y + pad, bold: true, tinted: !S.deco.has("box-outline"), limit: Z.bottom });
1507
- y += m.h + pad * 2 + state.blockGap;
1508
- }
1509
- // The items to decide on run as action rows under the box, down to the floor, when they fit.
1510
- const rows = acts ? placeActions(ctx, acts, { ...Z, y }, {}) : null;
1511
- if (rows) return [...out, ...rows];
1512
- if (visuals.length) out.push(...stack(visuals, { ...Z, y }, S, state).placed);
1513
- return out;
1514
- },
1515
-
1516
- "closing-summary-list"(ctx) {
1517
- const { S, state, Z } = ctx;
1518
- const { visuals, texts } = sortItems(ctx.items);
1519
- const [lR, bR] = splitRegion(S, Z, 8 / 12);
1520
- const out = [];
1521
- const paras = texts.flatMap(itemParas);
1522
- if (visuals.length) {
1523
- out.push(...stack(visuals, lR, S, state).placed);
1524
- if (paras.length) {
1525
- const pad = S.tok.pad;
1526
- const m = measureText(paras, bR.w - pad * 2, S, state);
1527
- out.push({ kind: "box", x: bR.x, y: bR.y, w: bR.w, h: m.h + pad * 2, surface: true, limit: Z.bottom }, { ...m, x: bR.x + pad, y: bR.y + pad, limit: Z.bottom });
1528
- }
1529
- return out;
1530
- }
1531
- // Numbered takeaways across the body, one row each, spread down to the floor.
1532
- const size = bodySize(S, state, "lead");
1533
- const heights = paras.map((p) => G.textHeight(plainText(p.text), Z.w - 48, size));
1534
- const pitch = rowPitch(paras.length, Math.max(...heights, 1), Z, state.groupGap, Math.max(...heights, 1) + 48);
1535
- paras.forEach((p, i) => {
1536
- const y = Z.y + i * pitch;
1537
- out.push({ kind: "text", paras: [{ kind: "text", text: String(i + 1), inset: 0, gap: 0, h: size * 1.3 }], size, x: Z.x, y, w: 36, h: size * 1.3, accent: true, limit: Z.bottom },
1538
- { kind: "text", paras: [{ kind: "text", text: p.text, inset: 0, gap: 0, h: heights[i] }], size, x: Z.x + 48, y, w: Z.w - 48, h: heights[i], limit: Z.bottom });
1539
- });
1540
- return out;
1541
- },
1542
-
1543
- "closing-contact-split"(ctx) {
1544
- const { S, state, Z } = ctx;
1545
- const { visuals, texts } = sortItems(ctx.items);
1546
- const acts = visuals.length === 1 && visuals[0].type === "kpi-table" && !visuals[0].content.chart ? actionRows(visuals[0].content) : null;
1547
- // The field starts where the rows' text ends (at most seven of twelve columns, at least five), so each
1548
- // key stands near the row it belongs to instead of across an empty stretch, as long
1549
- // as the rows and the next step keep the sizes and line counts they have in seven columns.
1550
- const n = Z.b - Z.a + 1;
1551
- if (acts && !ctx.splitCols) {
1552
- const at = (k) => PLANS["closing-contact-split"]({ ...ctx, splitCols: k });
1553
- const sig = (plan) => JSON.stringify(plan.filter((q) => q.kind === "actions" || q.kind === "text").map((q) => (q.kind === "actions" ? [q.head, q.meta, q.keySize] : [q.size, Math.round(q.h)])));
1554
- const ref = at(7);
1555
- const need = Math.max(...acts.rows.map((r) => Math.max(G.textEms(r.head) * S.sizes.lead, G.textEms(r.meta) * S.sizes.label) * 1.06));
1556
- for (const k of [5, 6]) {
1557
- if (S.grid.span(Z.a, Z.a + Math.round(n * k / 12) - 1).w < need) continue;
1558
- const plan = at(k);
1559
- if (sig(plan) === sig(ref)) return plan;
1560
- }
1561
- return ref;
1562
- }
1563
- const cols = ctx.splitCols || 7;
1564
- const [lR, fR] = splitRegion(S, Z, cols / 12);
1565
- // The field bleeds off the right and bottom edges; what it holds sits inset from its edges.
1566
- const fieldX = fR.x - S.grid.gutter / 2;
1567
- const inset = 30;
1568
- const F = { ...fR, x: fieldX + inset, w: fR.x + fR.w - fieldX - inset, y: Z.y + inset, bottom: Z.bottom };
1569
- const field = { decor: true, kind: "rect", x: fieldX, y: Z.y, w: S.grid.W - fieldX, h: S.grid.H - Z.y, fill: "field", bleed: true };
1570
- if (acts) {
1571
- // The field is the ask: each row's key (the amount or the date) in line with its row, the rows
1572
- // down the left columns. The next step or contact is a band of the field's colour on the body
1573
- // floor across the left columns, meeting the field, so the two read as one L whose foot holds
1574
- // the step and the field has no empty stretch under its last key.
1575
- // A step at lead size that leaves the rows too little height drops to body size.
1576
- // Amounts add up to the ask: their total closes the field. Beside the step's band it sits on
1577
- // the band's floor, so the field below the keys ends in the sum, not in an empty stretch.
1578
- // Dates do not add up: the field's foot then states how many items run over which span.
1579
- const total = actionTotal(acts) || actionSpan(acts);
1580
- // The band stops at the field's edge. Its text runs on across the field to the field's inset
1581
- // only while the field's foot is empty; with a total there it keeps to the band's own columns.
1582
- const stepW = total ? fieldX - lR.x : F.x + F.w - lR.x;
1583
- for (const small of [false, true]) {
1584
- const step = texts.length ? nextStep(ctx, texts, { ...lR, w: stepW }, "band", { small, panelW: fieldX - lR.x }) : null;
1585
- const foot = step ? step.top + state.blockGap : null;
1586
- const bottom = step ? foot - state.groupGap : Z.bottom;
1587
- const totalH = total ? G.textHeight(total, F.w - inset, S.sizes.lead, 1.3) : 0;
1588
- const totalY = total ? (step ? Z.bottom - totalH - 6 : bottom - totalH) : null;
1589
- const rowsBottom = total && !step ? bottom - totalH - 24 : bottom;
1590
- const rows = placeActions(ctx, acts, { ...lR, y: F.y, bottom: rowsBottom }, { keys: { ...F, bottom: rowsBottom } });
1591
- if (rows) {
1592
- const sum = total ? [{ decor: true, kind: "rect", x: F.x, y: totalY - 12, w: F.w, h: 0.75, fill: "on-field" },
1593
- { kind: "text", paras: [{ kind: "text", text: total, gap: 0, h: totalH }], size: S.sizes.lead, bold: true, onField: true,
1594
- x: F.x, y: totalY, w: F.w - inset, h: totalH, limit: Z.bottom }] : [];
1595
- return [field, ...rows, ...sum, ...(step ? step.placed : [])];
1596
- }
1597
- }
1598
- }
1599
- const out = [field, ...stack(visuals.length ? visuals : texts, lR, S, state).placed];
1600
- if (visuals.length && texts.length) {
1601
- const m = measureText(texts.flatMap(itemParas), F.w, S, state);
1602
- out.push({ ...m, x: F.x, y: F.y, onField: true, limit: Z.bottom });
1603
- }
1604
- return out;
1605
- },
1606
- };
1607
-
1608
- // Families that share another's plan.
1609
- PLANS["step-diagram"] = PLANS.process;
1610
- PLANS.statement = PLANS["text-column"];
1611
-
1612
- /**
1613
- * Headed points as rows: the head bold in the first three columns, the point beside it at lead
1614
- * size when a dozen glyphs a line fit there, rows spread down to the floor with hairlines between.
1615
- */
1616
- function headedRows(ctx, ents) {
1617
- const { S, state, Z } = ctx;
1618
- const headR = region(S, Z.a, Z.a + 2, Z.y, Z.bottom);
1619
- const textR = region(S, Z.a + 3, Z.b, Z.y, Z.bottom);
1620
- const lead = bodySize(S, state, "lead");
1621
- const body = bodySize(S, state);
1622
- const rowsAt = (z) => ents.map((e) => ({ head: e.head, text: e.rest, headH: G.textHeight(e.head, headR.w, z),
1623
- textH: G.textHeight(plainText(e.rest), textR.w, z) })).map((r) => ({ ...r, h: Math.max(r.headH, r.textH) }));
1624
- let size = S.tok.tight ? body : lead;
1625
- let rows = rowsAt(size);
1626
- if (rows.reduce((a, r) => a + r.h, 0) + (rows.length - 1) * state.groupGap > Z.bottom - Z.y) { size = body; rows = rowsAt(body); }
1627
- const pitch = rowPitch(rows.length, Math.max(...rows.map((r) => r.h)), Z, state.groupGap, Math.max(...rows.map((r) => r.h)) + 96);
1628
- rows.forEach((r, i) => { r.y = Z.y + i * pitch; });
1629
- const last = rows[rows.length - 1];
1630
- return [{ kind: "headed", rows, size, headX: headR.x, headW: headR.w, textX: textR.x, textW: textR.w, pitch,
1631
- x: Z.x, w: Z.w, y: Z.y, h: last.y + last.h - Z.y, limit: Z.bottom }];
1632
- }
1633
-
1634
- /** Value rows: each KPI as one row across the body, value first. */
1635
- function figureRows(cards, Z, S, state, spread = null) {
1636
- const n = cards.length;
1637
- const longest = Math.max(...cards.map((c) => S.ems(plainText(c.value), "numeral")));
1638
- const room = (Z.bottom - Z.y - (n - 1) * 24) / n;
1639
- // At most title size (two steps above the body); the value column is as wide as the widest value.
1640
- const value = [S.sizes.title, S.sizes.lead, S.sizes.body].find((v) => longest * v * 1.15 <= Z.w * 0.5 && v * 1.15 <= room) || S.sizes.body;
1641
- const valueW = Math.min(Math.round(Z.w * 0.5), Math.max(Math.round(Z.w * 0.3), Math.ceil(longest * value * 1.15)));
1642
- const labelX = Z.x + valueW + S.grid.gutter;
1643
- const labelW = Z.x + Z.w - labelX;
1644
- // On the compact step the label is set bold at body size, its basis under it at label size.
1645
- const labelSize = S.tok.tight ? S.sizes.body : bodySize(S, state, "lead");
1646
- const noteSize = S.tok.tight ? S.sizes.label : bodySize(S, { ...state, stepped: false });
1647
- const heights = cards.map((c) => Math.max(value * 1.15, G.textHeight(plainText(c.label), labelW, labelSize)
1648
- + (c.note ? 4 + G.textHeight(plainText(c.note), labelW, noteSize) : 0)));
1649
- // Values run down to the floor, the rows evenly apart (at most `spread` apart beyond the tallest row).
1650
- const pitch = rowPitch(n, Math.max(...heights), Z, S.tok.tight ? state.groupGap : 24, spread == null ? 200 : Math.max(...heights) + spread);
1651
- const rows = cards.map((c, i) => ({ value: plainText(c.value), label: plainText(c.label), note: c.note ? plainText(c.note) : "", y: Z.y + i * pitch }));
1652
- return { kind: "figrows", rows, x: Z.x, w: Z.w, valueW, labelX, labelW, value, labelSize, noteSize, pitch, y: Z.y, h: (n - 1) * pitch + heights[n - 1], limit: Z.bottom };
1653
- }
1654
-
1655
- /**
1656
- * A big-number slide as a data panel: the panel takes seven of twelve columns under the title down to
1657
- * the zone's floor. With two to four figures (a KPI table
1658
- * whose second body row gives each figure's basis) the panel holds one row per figure: the value at
1659
- * title size, its label and its basis beside it. One figure is set at title size with its label on a
1660
- * panel as tall as they are. The
1661
- * evidence stands beside the panel as notes. The pack's display device sets the panel: the field, the
1662
- * accent tint, or the surface inside an ink outline. The panel stays under half the page, so it reads
1663
- * as the figures' ground and not as the page's. A number is never set above title size (S4.7).
1664
- */
1665
- function numberPanel(ctx, table, texts) {
1666
- const { S, state, Z } = ctx;
1667
- const c = table.content || {};
1668
- const cards = shared().kpiCards(c).slice(0, 6).filter((k) => plainText(k.value));
1669
- const device = S.pack.display.number;
1670
- const [pR, eR] = texts.length ? splitRegion(S, Z, 7 / 12) : [Z, null];
1671
- const pad = Math.max(18, S.tok.pad);
1672
- const inner = pR.w - pad * 2;
1673
- const panelH = pR.bottom - pR.y;
1674
- const role = device === "field" ? { fill: "field", number: "on-field", label: "on-field", note: "on-field" }
1675
- : device === "tint" ? { fill: "accent-tint", number: "accent", label: "ink", note: "ink" }
1676
- : { fill: "surface", line: "ink", number: "accent", label: "ink", note: "ink-muted" };
1677
- const out = [{ kind: "panel", x: pR.x, y: pR.y, w: pR.w, h: panelH, fill: role.fill, line: role.line, limit: Z.bottom }];
1678
- const capH = table.caption ? captionHeight(table.caption, inner, S) + 6 : 0;
1679
- if (cards.length >= 2 || (cards[0] && cards[0].note)) {
1680
- // One row per figure, rows spread over the panel, the caption at the panel's foot.
1681
- const R = { x: pR.x + pad, w: inner, y: pR.y + pad, bottom: pR.bottom - pad - capH, a: pR.a, b: pR.b };
1682
- const rows = figureRows(cards, R, S, state);
1683
- out.push({ ...rows, colour: role.number, labelColour: role.label, noteColour: role.note });
1684
- if (table.caption) out.push({ kind: "caption", item: { content: table.caption }, x: R.x, y: pR.bottom - pad - capH + 6, w: inner, h: capH - 6, role: role.label, limit: Z.bottom });
1685
- } else {
1686
- const value = plainText((cards[0] || {}).value || ((c.rows || [])[0] || [])[0] || "");
1687
- const label = plainText((cards[0] || {}).label || (c.headers || [])[0] || "");
1688
- const labelSize = bodySize(S, { ...state, stepped: false }, "lead");
1689
- const size = [S.sizes.title, S.sizes.lead].find((v) => S.ems(value, "numeral") * v * 1.04 <= inner) || S.sizes.body;
1690
- const labelH = label ? G.textHeight(label, inner, labelSize) : 0;
1691
- const blockH = size * 1.15 + (label ? 12 + labelH : 0) + capH;
1692
- // One figure at title size: the panel hugs it instead of standing as an empty field.
1693
- out[0].h = Math.min(panelH, Math.round(blockH + pad * 2));
1694
- const y = Math.round(pR.y + pad);
1695
- out.push({ kind: "number", value, label, size, labelSize, x: pR.x + pad, y, w: inner, h: blockH - capH, colour: role.number, labelColour: role.label, limit: Z.bottom });
1696
- if (table.caption) out.push({ kind: "caption", item: { content: table.caption }, x: pR.x + pad, y: y + blockH - capH + 6, w: inner, h: capH - 6, role: role.label, limit: Z.bottom });
1697
- }
1698
- if (eR) {
1699
- const R = region(S, eR.a, eR.b, pR.y, pR.bottom);
1700
- // The evidence reads as notes on the figures: plain lines, no list markers.
1701
- const paras = texts.flatMap(itemParas).map((q) => ({ ...q, kind: q.kind === "section" ? "section" : "text" }));
1702
- const labelSize = bodySize(S, { ...state, stepped: false }, "lead");
1703
- const evidence = R.w >= 12 * labelSize * 1.1 ? labelSize : bodySize(S, { ...state, stepped: false });
1704
- let m = measureText(paras, R.w, S, { ...state, itemGap: Math.max(state.itemGap, 12) }, { size: evidence });
1705
- if (m.h > panelH) m = measureText(paras, R.w, S, state);
1706
- out.push({ ...m, x: R.x, y: Math.round(pR.y + Math.max(0, (panelH - m.h) / 2)), limit: Z.bottom });
1707
- }
1708
- return out;
1709
- }
1710
-
1711
- // A cell that is an amount: digits, an optional Korean unit word, an optional currency or percent.
1712
- const AMOUNT = /^(\d[\d,.]*)\s*([조억만천]*)\s*(원|달러|USD|EUR|KRW|%)?$/u;
1713
- const WHEN = /기한|시점|일정|날짜|마감|언제|when|date|due|deadline/iu;
1714
-
1715
- /**
1716
- * A closing's table read as action rows. The key is the column of amounts in one unit (they add up
1717
- * to the ask), else the column headed as a date or deadline, else the last column; the row's first
1718
- * cell is what is asked or done, the other cells (owner, timing) its detail.
1719
- */
1720
- function actionRows(content) {
1721
- const headers = (content.headers || []).map((h) => plainText(h));
1722
- // A totals row is not an action: the ask line (or the field's total) carries the sum.
1723
- const rows = (content.rows || []).map((r) => r.map((cell) => plainText(cell).trim()))
1724
- .filter((r, i, all) => !(all.length > 1 && i === all.length - 1 && TOTALS.test(r[0] || "")));
1725
- if (rows.length < 1 || rows.length > 5 || headers.length < 2) return null;
1726
- // A bare number under a head that names its unit ("Budget (k USD)") carries that unit, as a key
1727
- // and in a row's detail, so no amount stands on the page without it.
1728
- const units = headers.map((h) => (/\(([^()]{1,12})\)\s*$/u.exec(h) || [])[1] || null);
1729
- const withUnit = (cell, j) => (units[j] && /^\d[\d,.]*$/u.test(cell) ? joinUnit(cell, units[j]) : cell);
1730
- let key = -1;
1731
- let kind = "date";
1732
- for (let j = 1; j < headers.length && key < 0; j++) {
1733
- const m = rows.map((r) => AMOUNT.exec(r[j] || ""));
1734
- if (m.every((x) => x && (x[2] || x[3])) && new Set(m.map((x) => `${x[2]}${x[3] || ""}`)).size === 1) {
1735
- key = j;
1736
- kind = "amount";
1737
- } else if (units[j] && !/%/u.test(units[j]) && rows.every((r) => /^\d[\d,.]*$/u.test(r[j] || ""))) {
1738
- key = j;
1739
- kind = "amount";
1740
- }
1741
- }
1742
- if (key < 0) key = headers.findIndex((h, j) => j > 0 && WHEN.test(h));
1743
- const korean = G.isKorean(headers.join(" ") + rows.map((r) => r[0]).join(" "));
1744
- if (key < 0) key = headers.length - 1;
1745
- return {
1746
- kind,
1747
- rows: rows.map((r) => ({
1748
- key: withUnit(r[key] || "", key),
1749
- num: kind === "amount" ? /^\d[\d,.]*/u.exec(r[key])[0] : null,
1750
- head: r[0] || "",
1751
- // An empty or dash-only cell ("—") says nothing about the row and is left out of its detail.
1752
- meta: r.map(withUnit).filter((cell, j) => j !== 0 && j !== key && cell && !/^[—–-]+$/u.test(cell)).join(" · "),
1753
- value: kind === "amount" ? parseFloat(/^\d[\d,.]*/u.exec(r[key])[0].replace(/,/gu, "")) : null,
1754
- })),
1755
- korean,
1756
- };
1757
- }
1758
-
1759
- /** "30k USD", "14억 원", "12 L": a figure with its unit, joined the way the unit is written. */
1760
- function joinUnit(n, unit) {
1761
- return /^(%|\p{Script=Hangul}|[kKMB](\s|$))/u.test(unit) ? `${n}${unit}` : `${n} ${unit}`;
1762
- }
1763
-
1764
- /** "합계 30억 원": the rows' amounts summed and written in the unit the keys use, or null. */
1765
- function actionTotal(acts) {
1766
- if (!acts || acts.kind !== "amount" || acts.rows.length < 2) return null;
1767
- const sum = acts.rows.reduce((a, r) => a + r.value, 0);
1768
- const digits = Math.max(...acts.rows.map((r) => ((/\.(\d+)/u.exec(r.num) || [, ""])[1]).length));
1769
- const commas = acts.rows.some((r) => r.key.includes(","));
1770
- const n = commas ? sum.toLocaleString("en-US", { minimumFractionDigits: digits, maximumFractionDigits: digits }) : sum.toFixed(digits);
1771
- return `${acts.korean ? "합계" : "Total"} ${acts.rows[0].key.replace(/^\d[\d,.]*/u, n)}`;
1772
- }
1773
-
1774
- /** "안건 4건 · 10월 셋째 주 – 11월 첫째 주": the count of date-keyed rows and their first and last date, or null. */
1775
- function actionSpan(acts) {
1776
- if (!acts || acts.kind !== "date" || acts.rows.length < 2) return null;
1777
- const first = acts.rows[0].key;
1778
- const last = acts.rows[acts.rows.length - 1].key;
1779
- const n = acts.rows.length;
1780
- const count = acts.korean ? `안건 ${n}건` : `${n} items`;
1781
- return first && last && first !== last ? `${count} · ${first} – ${last}` : count;
1782
- }
1783
-
1784
- /**
1785
- * Action rows down a region: the key large on the left (or in `o.keys`, a field beside the rows),
1786
- * what is asked bold at lead size with its detail under it, and for amounts a bar as long as the
1787
- * row's share of the total. The free height is shared out as equal gaps between the rows (and
1788
- * before the next step when one follows), so the rows and the step fill the body together.
1789
- */
1790
- function placeActions(ctx, acts, R, o = {}) {
1791
- const { S, state } = ctx;
1792
- const n = acts.rows.length;
1793
- const keyR = o.keys || region(S, R.a, R.a + 2, R.y, R.bottom);
1794
- const textR = o.keys ? R : region(S, R.a + 3, R.b, R.y, R.bottom);
1795
- const longest = Math.max(...acts.rows.map((r) => S.ems(r.key, "numeral")));
1796
- const sizes = [S.sizes.title, S.sizes.lead, S.sizes.body];
1797
- const total = acts.kind === "amount" ? acts.rows.reduce((a, r) => a + r.value, 0) : 0;
1798
- const gaps = o.last ? n : Math.max(1, n - 1);
1799
- // At lead size first; rows that do not fit step down (lead to body, body to label), then the
1800
- // key steps down the ramp until the rows fit.
1801
- const fit = (step) => {
1802
- const fitting = sizes.filter((v) => v && longest * v * 1.04 <= keyR.w);
1803
- const keySize = fitting[Math.min(step, fitting.length - 1)] || S.sizes.body;
1804
- const head = step ? S.sizes.body : S.sizes.lead;
1805
- const meta = step ? S.sizes.label : S.sizes.body;
1806
- const rows = acts.rows.map((r) => {
1807
- const headH = G.textHeight(r.head, textR.w, head);
1808
- const metaH = r.meta ? G.textHeight(r.meta, textR.w, meta) : 0;
1809
- const bar = total > 0 ? (o.keys ? 14 : 18) : 0;
1810
- // On the field the share bar runs under the key; beside the rows it runs under the text.
1811
- const h = o.keys ? Math.max(keySize * 1.15 + bar, headH + (metaH ? 6 + metaH : 0))
1812
- : Math.max(keySize * 1.15, headH + (metaH ? 6 + metaH : 0) + bar);
1813
- return { ...r, headH, metaH, bar, h };
1814
- });
1815
- const sum = rows.reduce((a, r) => a + r.h, 0);
1816
- return { keySize, head, meta, rows, room: R.bottom - R.y - sum - gaps * state.itemGap };
1817
- };
1818
- let chosen = fit(0);
1819
- for (let step = 1; chosen.room < 0 && step <= 3; step++) chosen = fit(step);
1820
- if (chosen.room < 0) return null;
1821
- const { keySize, head, meta, rows } = chosen;
1822
- const sum = rows.reduce((a, r) => a + r.h, 0);
1823
- // Rows sit at most 96 pt apart (wider gaps read as separate blocks, and at reading sizes left one
1824
- // empty band between two short rows); what is left over is shared above and below the rows.
1825
- const gap = Math.max(state.itemGap, Math.min(96, (R.bottom - R.y - sum) / gaps));
1826
- const spare = Math.max(0, R.bottom - R.y - sum - gap * gaps);
1827
- let y = R.y + Math.round(spare / 2);
1828
- for (const r of rows) { r.y = y; y += r.h + gap; }
1829
- const h = rows[n - 1].y + rows[n - 1].h - R.y;
1830
- return [{ kind: "actions", rows, keyX: keyR.x, keyW: keyR.w, keySize, onField: Boolean(o.keys), textX: textR.x, textW: textR.w,
1831
- head, meta, total, gap, x: R.x, y: R.y, w: (o.keys ? keyR.x + keyR.w : R.x + R.w) - R.x, h, limit: R.bottom }];
1832
- }
1833
-
1834
- /**
1835
- * The next step of a closing, set at lead size on the body floor in the pack's closing device: a
1836
- * band of the field across the region (or `o.panelW` of it, where a field drawn beside continues
1837
- * it; text in the field's colour), a tinted or outlined box, a
1838
- * rule above the line, or (field) a rule above the line inside a field already drawn. A label
1839
- * before a colon is set bold. Returns the placements and its top.
1840
- */
1841
- function nextStep(ctx, texts, R, device, o = {}) {
1842
- const { S, state } = ctx;
1843
- const lead = bodySize(S, { ...state, stepped: false }, "lead");
1844
- const ruled = device === "rules" || device === "field";
1845
- const pad = ruled ? 0 : Math.max(18, S.tok.pad);
1846
- // Each point keeps its own line; a source line is a note at label size. Lines keep a readable
1847
- // measure (S4.4) inside the band.
1848
- const paras = texts.flatMap(itemParas).map((p) => plainText(p.text));
1849
- const notes = paras.filter((t) => /^(출처|자료|sources?)\b/iu.test(t));
1850
- const points = paras.filter((t) => !notes.includes(t)).map((t) => t.replace(/^([^::]{1,16})([::])\s*/u, "**$1$2** "));
1851
- const size = points.length > 2 || o.small ? S.sizes.body : lead;
1852
- const box = R.w - pad * 2;
1853
- const inner = Math.min(box, (G.isKorean(paras.join("")) ? 34 : 70) * size * (G.isKorean(paras.join("")) ? 1 : 0.5));
1854
- // A line that fits the box on one line takes the box's width; a longer one keeps the reading measure, set
1855
- // as narrow as keeps its line count so its lines come out even and none ends on a lone word.
1856
- const widthOf = (t, z) => {
1857
- if (G.lineCount(plainText(t), box, z) <= 1) return box;
1858
- const n = G.lineCount(plainText(t), inner, z);
1859
- let lo = inner / 2;
1860
- let hi = inner;
1861
- for (let i = 0; i < 12; i++) { const mid = (lo + hi) / 2; if (G.lineCount(plainText(t), mid, z) <= n) hi = mid; else lo = mid; }
1862
- return Math.min(inner, Math.ceil(hi + 2 * z));
1863
- };
1864
- const items = [...points.map((t) => ({ text: t, size })), ...notes.map((t) => ({ text: t, size: S.sizes.label }))]
1865
- .map((q) => { const w = widthOf(q.text, q.size); return { ...q, w, h: G.textHeight(plainText(q.text), w, q.size) }; });
1866
- const th = items.reduce((a, q, i) => a + q.h + (i ? 6 : 0), 0);
1867
- const top = ruled ? R.bottom - th - 18 : R.bottom - th - pad * 2;
1868
- const placed = [];
1869
- const outline = device === "box" && S.deco.has("box-outline");
1870
- if (device === "band") placed.push({ kind: "panel", x: R.x, y: top, w: o.panelW || R.w, h: R.bottom - top, fill: "field", limit: R.bottom });
1871
- else if (device === "box") placed.push({ kind: "panel", x: R.x, y: top, w: R.w, h: R.bottom - top, fill: outline ? null : "accent-tint", line: outline ? "ink" : null, limit: R.bottom });
1872
- else placed.push({ decor: true, kind: "rect", x: R.x, y: top, w: R.w, h: 0.75, fill: "line" });
1873
- let y = ruled ? top + 18 : top + pad;
1874
- for (const q of items) {
1875
- placed.push({ kind: "text", paras: [{ kind: "text", text: q.text, inset: 0, gap: 0, h: q.h }], size: q.size, x: R.x + pad, y, w: q.w, h: q.h,
1876
- onField: device === "band" || device === "field", tinted: device === "box" && !outline, muted: q.size === S.sizes.label, limit: R.bottom });
1877
- y += q.h + 6;
1878
- }
1879
- return { placed, top: top - state.blockGap };
1880
- }
1881
-
1882
- // ── Draw ────────────────────────────────────────────────────────────────────
1883
-
1884
- function drawPlaced(slide, S, p, ctx) {
1885
- const A = shared();
1886
- const c = (p.item && p.item.content) || {};
1887
- if (p.kind === "group") { for (const q of p.parts) drawPlaced(slide, S, q, ctx); return; }
1888
- if (p.kind === "rect") { packRect(slide, S, p, { fill: p.fill }); return; }
1889
- if (p.kind === "panel") { packRect(slide, S, p, { fill: p.fill, line: p.line, lineWidth: 1, radius: S.pack.radius }); return; }
1890
- if (p.kind === "actions") {
1891
- const ink = S.colour(p.onField ? "on-field" : "accent");
1892
- p.rows.forEach((r, i) => {
1893
- if (i > 0) packRect(slide, S, { x: p.textX, y: r.y - p.gap / 2, w: p.textW, h: 0.75 }, { fill: "line" });
1894
- packText(slide, S, r.key, { x: p.keyX, y: r.y, w: p.keyW, h: p.keySize * 1.15 }, { face: "numeral", size: p.keySize, colour: ink, lineSpacing: 1.15 });
1895
- packText(slide, S, r.head, { x: p.textX, y: r.y, w: p.textW, h: r.headH }, { size: p.head, bold: true });
1896
- if (r.meta) packText(slide, S, r.meta, { x: p.textX, y: r.y + r.headH + 6, w: p.textW, h: r.metaH }, { size: p.meta, colour: S.colour("ink-muted") });
1897
- if (r.bar) {
1898
- // The row's share of the ask: a bar on a full-width track, under the key on the field.
1899
- const [bx, bw] = p.onField ? [p.keyX, p.keyW] : [p.textX, p.textW];
1900
- const by = p.onField ? r.y + p.keySize * 1.15 + 8 : r.y + r.headH + (r.metaH ? 6 + r.metaH : 0) + 12;
1901
- packRect(slide, S, { x: bx, y: by, w: bw, h: 6 }, { fill: p.onField ? "ink-muted" : "accent-tint" });
1902
- packRect(slide, S, { x: bx, y: by, w: Math.max(4, (bw * r.value) / p.total), h: 6 }, { fill: p.onField ? "on-field" : "accent" });
1903
- }
1904
- });
1905
- return;
1906
- }
1907
- if (p.kind === "box") {
1908
- if (p.outline) packRect(slide, S, p, { line: "ink", lineWidth: S.pack["edge-weight"] || 1, ...hardEdge(S, "ground") });
1909
- else if (p.tint) packRect(slide, S, p, { fill: "accent-tint", radius: S.pack.radius, ...hardEdge(S) });
1910
- else surfaceRect(slide, S, p);
1911
- return;
1912
- }
1913
- if (p.kind === "text") {
1914
- let y = p.y;
1915
- const ink = p.onField ? S.colour("on-field") : p.tinted ? S.colour("accent-deep") : S.colour("ink");
1916
- const soft = p.onField ? S.colour("on-field") : S.colour("ink-muted");
1917
- for (const para of p.paras) {
1918
- y += para.gap;
1919
- // The marker is a small dot centred on the first line: a shape, so no renderer swaps in a
1920
- // symbol font for it and no checker reads it as a column of text.
1921
- if (para.kind === "bullet") {
1922
- const d = Math.max(4, Math.round(p.size * 0.28));
1923
- const lineH = p.size * G.leading(para.text);
1924
- packRect(slide, S, { x: p.x, y: y + (lineH - d) / 2, w: d, h: d }, { fill: p.onField ? "on-field" : "accent" });
1925
- }
1926
- packText(slide, S, para.kind === "section" ? para.text : runIn(para.text), { x: p.x + (para.inset || 0), y, w: p.w - (para.inset || 0), h: para.h }, {
1927
- size: p.size, bold: p.bold || para.kind === "section",
1928
- colour: p.accent ? S.colour("accent-deep") : para.kind === "child" || p.muted ? soft : ink,
1929
- });
1930
- y += para.h;
1931
- }
1932
- return;
1933
- }
1934
- if (p.kind === "callout") {
1935
- packRect(slide, S, p, { fill: "accent-tint", radius: S.pack.radius, ...hardEdge(S) });
1936
- packText(slide, S, plainText(c), { x: p.x + p.pad, y: p.y + p.pad, w: p.w - p.pad * 2, h: p.h - p.pad * 2 },
1937
- { size: p.size, bold: true, colour: S.colour("accent-deep") });
1938
- return;
1939
- }
1940
- if (p.kind === "kpi") {
1941
- p.cards.forEach((card, i) => {
1942
- const x = p.x + i * (p.cardW + S.grid.gutter);
1943
- surfaceRect(slide, S, { x, y: p.y, w: p.cardW, h: p.cardH });
1944
- const inner = p.cardW - p.pad * 2;
1945
- const valueH = p.value * 1.15;
1946
- packText(slide, S, plainText(card.value), { x: x + p.pad, y: p.y + p.pad, w: inner, h: valueH },
1947
- { face: "numeral", size: p.value, lineSpacing: 1.15, colour: S.colour(i === 0 ? "accent" : "ink") });
1948
- packText(slide, S, plainText(card.label), { x: x + p.pad, y: p.y + p.pad + valueH + 6, w: inner, h: p.labelH },
1949
- { size: S.sizes.label, colour: S.colour("ink-muted"), lineSpacing: 1.3 });
1950
- if (card.note) packText(slide, S, plainText(card.note), { x: x + p.pad, y: p.y + p.pad + valueH + 6 + p.labelH + 6, w: inner, h: p.noteH },
1951
- { size: p.noteSize, colour: S.colour("ink"), lineSpacing: 1.3 });
1952
- });
1953
- drawCaption(slide, S, p.item.caption, p.x, p.y + p.cardH + 6, p.w);
1954
- return;
1955
- }
1956
- if (p.kind === "figrows") {
1957
- p.rows.forEach((r, i) => {
1958
- if (i > 0) packRect(slide, S, { x: p.x, y: r.y - 12, w: p.w, h: 0.75 }, { fill: p.colour === "on-field" ? "on-field" : "line" });
1959
- packText(slide, S, r.value, { x: p.x, y: r.y, w: p.valueW, h: p.value * 1.15 },
1960
- { face: "numeral", size: p.value, lineSpacing: 1.15, colour: S.colour(p.colour || (i === 0 ? "accent" : "ink")) });
1961
- const lh = G.textHeight(r.label, p.labelW, p.labelSize);
1962
- const nh = r.note ? G.textHeight(r.note, p.labelW, p.noteSize) : 0;
1963
- // The label reads beside the value; the basis under the label.
1964
- packText(slide, S, r.label, { x: p.labelX, y: r.y, w: p.labelW, h: lh }, { size: p.labelSize, colour: S.colour(p.labelColour || "ink"), bold: true });
1965
- if (r.note) packText(slide, S, r.note, { x: p.labelX, y: r.y + lh + 4, w: p.labelW, h: nh }, { size: p.noteSize, colour: S.colour(p.noteColour || "ink-muted") });
1966
- });
1967
- return;
1968
- }
1969
- if (p.kind === "rows") {
1970
- p.rows.forEach((r, i) => {
1971
- const right = p.restX != null ? p.restX + p.restW : p.textX + p.textW;
1972
- if (p.rule && i > 0) packRect(slide, S, { x: p.x, y: r.y - Math.min(12, (p.pitch - r.h) / 2), w: right - p.x, h: 0.75 }, { fill: "line" });
1973
- const numSize = p.numSize || p.head;
1974
- packText(slide, S, r.num, { x: p.x, y: r.y, w: p.numW, h: numSize * 1.15 }, { face: "numeral", size: numSize, colour: S.colour("accent"), lineSpacing: 1.15 });
1975
- const hh = G.textHeight(r.head, p.textW, p.head);
1976
- packText(slide, S, r.head, { x: p.textX, y: r.y, w: p.textW, h: hh }, { size: p.head, bold: true });
1977
- // Beside the name (restX) or under it.
1978
- if (r.rest && p.restX != null) packText(slide, S, r.rest, { x: p.restX, y: r.y, w: p.restW, h: G.textHeight(r.rest, p.restW, p.rest) }, { size: p.rest });
1979
- else if (r.rest) packText(slide, S, r.rest, { x: p.textX, y: r.y + hh + 6, w: p.textW, h: G.textHeight(r.rest, p.textW, p.rest) }, { size: p.rest, colour: S.colour("ink-muted") });
1980
- });
1981
- return;
1982
- }
1983
- if (p.kind === "headed") {
1984
- p.rows.forEach((r, i) => {
1985
- if (i > 0) packRect(slide, S, { x: p.x, y: r.y - Math.min(12, (p.pitch - p.rows[i - 1].h) / 2), w: p.w, h: 0.75 }, { fill: "line" });
1986
- packText(slide, S, r.head, { x: p.headX, y: r.y, w: p.headW, h: r.headH }, { size: p.size, bold: true, colour: S.colour("accent-deep") });
1987
- packText(slide, S, r.text, { x: p.textX, y: r.y, w: p.textW, h: r.textH }, { size: p.size });
1988
- });
1989
- return;
1990
- }
1991
- if (p.kind === "steps") {
1992
- p.steps.forEach((s) => {
1993
- packText(slide, S, s.n, { x: s.x, y: p.y, w: s.w, h: p.numSize * 1.1 }, { face: "numeral", size: p.numSize, colour: S.colour("accent"), lineSpacing: 1.15 });
1994
- const ruleY = p.y + p.numSize * 1.1 + 6;
1995
- packRect(slide, S, { x: s.x, y: ruleY, w: s.w, h: 0.75 }, { fill: "line" });
1996
- packText(slide, S, s.head, { x: s.x, y: ruleY + 12, w: s.w, h: s.headH }, { size: p.headSize, bold: true });
1997
- if (s.rest) packText(slide, S, s.rest, { x: s.x, y: ruleY + 12 + s.headH + 12, w: s.w, h: s.restH }, { size: p.restSize, colour: S.colour("ink-muted") });
1998
- });
1999
- return;
2000
- }
2001
- if (p.kind === "timeline") {
2002
- packRect(slide, S, { x: p.x, y: p.axisY, w: p.w, h: 1.5 }, { fill: "line" });
2003
- p.events.forEach((e, i) => {
2004
- packRect(slide, S, { x: e.x, y: p.axisY - 4, w: 9, h: 9 }, { fill: i === p.events.length - 1 ? "accent" : "ink-muted" });
2005
- const dh = G.textHeight(e.date, e.w, p.dateSize, 1.25);
2006
- packText(slide, S, e.date, { x: e.x, y: p.axisY - 18 - dh, w: e.w, h: dh }, { size: p.dateSize, bold: true, colour: S.colour("ink"), lineSpacing: 1.25 });
2007
- packText(slide, S, e.label, { x: e.x, y: p.axisY + 18, w: e.w, h: e.labelH }, { size: p.labelSize });
2008
- if (e.status) packText(slide, S, e.status, { x: e.x, y: p.axisY + 18 + e.labelH + 6, w: e.w, h: e.statusH - 6 }, { size: S.sizes.label, colour: S.colour("ink-muted"), lineSpacing: 1.3 });
2009
- });
2010
- return;
2011
- }
2012
- if (p.kind === "matrix") {
2013
- const label = S.sizes.label;
2014
- p.xHeads.forEach((t, i) => packText(slide, S, t, { x: p.grid.x + i * (p.qw + p.gap), y: p.grid.y, w: p.qw, h: label * 1.4 }, { size: label, bold: true, colour: S.colour("ink-muted"), lineSpacing: 1.3 }));
2015
- p.yHeads.forEach((t, i) => packText(slide, S, t, { x: p.labels.x, y: p.top + i * (p.qh + p.gap), w: p.labels.w, h: label * 1.4 }, { size: label, bold: true, colour: S.colour("ink-muted"), lineSpacing: 1.3 }));
2016
- const axis = [p.yName && `↑ ${p.yName}`, p.xName && `→ ${p.xName}`].filter(Boolean).join(" ");
2017
- if (axis) {
2018
- // The axis names sit at the foot of the label column, as tall as they wrap in it.
2019
- const h = G.textHeight(axis, p.labels.w, label, 1.3);
2020
- packText(slide, S, axis, { x: p.labels.x, y: p.top + 2 * p.qh + p.gap - h, w: p.labels.w, h }, { size: label, colour: S.colour("ink-muted"), lineSpacing: 1.3 });
2021
- }
2022
- p.cells.forEach((cell) => {
2023
- packRect(slide, S, cell, { line: "line", lineWidth: 0.75 });
2024
- const w = cell.w - p.pad * 2;
2025
- // The item and its details stand in the middle of the quadrant, so a short cell reads as placed.
2026
- const blockH = cell.headH + cell.details.reduce((a, d) => a + 4 + d.h, 0);
2027
- let y = cell.y + Math.max(p.pad, Math.round((cell.h - blockH) / 2));
2028
- packText(slide, S, cell.head, { x: cell.x + p.pad, y, w, h: cell.headH }, { size: p.head, bold: true, lineSpacing: 1.3 });
2029
- y += cell.headH;
2030
- for (const d of cell.details) {
2031
- y += 4;
2032
- packText(slide, S, d.text, { x: cell.x + p.pad, y, w, h: d.h }, { size: p.detail, colour: S.colour("ink-muted") });
2033
- y += d.h;
2034
- }
2035
- });
2036
- if (p.caption) drawCaption(slide, S, p.caption, p.grid.x, p.top + 2 * p.qh + p.gap + 6, p.grid.w);
2037
- return;
2038
- }
2039
- if (p.kind === "quote") {
2040
- packText(slide, S, "“", { x: p.markX, y: p.y - 6, w: p.markW, h: S.sizes.display * 1.1 }, { face: "display", size: S.sizes.display, colour: S.colour("accent"), lineSpacing: 1.15 });
2041
- packText(slide, S, plainText(p.text).replace(/^[“"]|[”"]$/gu, ""), { x: p.x, y: p.y, w: p.w, h: p.textH }, { face: "title", size: p.size, lineSpacing: 1.3 });
2042
- if (p.by) packText(slide, S, p.by, { x: p.x, y: p.y + p.textH + 18, w: p.w, h: S.sizes.label * 1.4 }, { size: S.sizes.label, colour: S.colour("ink-muted"), lineSpacing: 1.3 });
2043
- return;
2044
- }
2045
- if (p.kind === "number") {
2046
- packText(slide, S, p.value, { x: p.x, y: p.y, w: p.w, h: p.size * 1.1 }, { face: "numeral", size: p.size, colour: S.colour(p.colour || "accent"), lineSpacing: 1.15 });
2047
- if (p.label) packText(slide, S, p.label, { x: p.x, y: p.y + p.size * 1.1 + 12, w: p.w, h: G.textHeight(p.label, p.w, p.labelSize) }, { size: p.labelSize, colour: S.colour(p.labelColour || "ink-muted") });
2048
- return;
2049
- }
2050
- if (p.kind === "table") {
2051
- drawPackTable(slide, S, c, p, ctx.title);
2052
- drawCaption(slide, S, p.item.caption, p.x, p.y + p.tableH + 6, p.w);
2053
- return;
2054
- }
2055
- if (p.kind === "chart") {
2056
- drawChart(slide, S, c, p);
2057
- drawCaption(slide, S, p.item.caption, p.x, p.y + p.h - p.cap + 6, p.w);
2058
- return;
2059
- }
2060
- if (p.kind === "image") {
2061
- const images = p.item.type === "image-grid" ? c.images || [] : [c];
2062
- const h = p.h - p.cap;
2063
- const cellW = (p.w - (images.length - 1) * S.grid.gutter) / Math.max(1, images.length);
2064
- let bottom = p.y;
2065
- images.forEach((image, i) => {
2066
- const file = forGround(A.resolveImagePath(image.src, ctx.sourceDir), S);
2067
- let fit = A.containBox(IN(p.x + i * (cellW + S.grid.gutter)), IN(p.y), IN(cellW), IN(h), A.readImageSize(file));
2068
- const low = IN(p.y + h) - fit.h;
2069
- if (p.beside != null && images.length === 1 && low * 72 <= p.beside) fit = { ...fit, y: low };
2070
- slide.addImage({ path: file, ...fit, altText: image.caption || path.basename(image.src || file) });
2071
- if (S.pack.image && S.pack.image.frame === "hairline") packRect(slide, S, { x: fit.x * 72, y: fit.y * 72, w: fit.w * 72, h: fit.h * 72 }, { line: "line", lineWidth: 0.5 });
2072
- bottom = Math.max(bottom, (fit.y + fit.h) * 72);
2073
- });
2074
- // The caption binds to the picture as drawn: a letterboxed figure keeps its caption under it.
2075
- drawCaption(slide, S, p.item.caption, p.x, bottom + 6, p.w);
2076
- return;
2077
- }
2078
- if (p.kind === "caption") drawCaption(slide, S, p.item.content, p.x, p.y, p.w, p.role === "on-field" ? "on-field" : "ink-muted");
2079
- }
2080
-
2081
- /**
2082
- * A figure on a dark ground is drawn from its dark variant when the source folder has one beside it
2083
- * (`flow.png` → `flow.dark.png`): a chart or diagram exported on white would stand as a white card.
2084
- */
2085
- function forGround(file, S) {
2086
- const c = (i) => parseInt(String(S.P.ground).replace("#", "").slice(i, i + 2), 16) / 255;
2087
- if (0.2126 * c(0) + 0.7152 * c(2) + 0.0722 * c(4) >= 0.25) return file;
2088
- const ext = path.extname(file);
2089
- const dark = `${file.slice(0, file.length - ext.length)}.dark${ext}`;
2090
- return require("fs").existsSync(dark) ? dark : file;
2091
- }
2092
-
2093
- function drawCaption(slide, S, caption, x, y, w, role = "ink-muted") {
2094
- if (!caption) return;
2095
- const text = captionText(caption);
2096
- packText(slide, S, text, { x, y, w, h: G.textHeight(text, w, S.sizes.label, 1.3) },
2097
- { size: S.sizes.label, colour: S.colour(role), lineSpacing: 1.3 });
2098
- }
2099
-
2100
- // Series names that are a reference for the measured one: a plan, target, budget, baseline, prior period.
2101
- const REFERENCE = /계획|목표|예산|전년|전기|기준|이전|기존|평균|plan|target|budget|baseline|benchmark|forecast|prior|previous|last year|average/iu;
2102
-
2103
- /** A series name's period as one comparable number (year, then half, quarter or month), or null. */
2104
- function periodOf(name) {
2105
- const t = plainText(name);
2106
- const year = /(?:^|\D)((?:19|20)\d{2})(?!\d)/u.exec(t) || /(?:^|[^\d.])(\d{2})년/u.exec(t);
2107
- const quarter = /\bQ([1-4])\b|\b([1-4])Q\b|([1-4])\s*분기/iu.exec(t);
2108
- const half = /\bH([12])\b|([상하])반기/iu.exec(t);
2109
- const month = /(?:^|\D)(1[0-2]|[1-9])월|\b(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)[a-z]*\b/iu.exec(t);
2110
- const months = ["jan", "feb", "mar", "apr", "may", "jun", "jul", "aug", "sep", "oct", "nov", "dec"];
2111
- const within = quarter ? 3 * Number(quarter[1] || quarter[2] || quarter[3])
2112
- : half ? 6 * (half[1] ? Number(half[1]) : half[2] === "상" ? 1 : 2)
2113
- : month ? (month[1] ? Number(month[1]) : months.indexOf(month[2].slice(0, 3).toLowerCase()) + 1) : null;
2114
- if (!year && within == null) return null;
2115
- const y = year ? Number(year[1].length === 2 ? `20${year[1]}` : year[1]) : 0;
2116
- return y * 100 + (within || 0);
2117
- }
2118
-
2119
- /**
2120
- * The series a chart highlights: the latest period when every series names one, else the one measured
2121
- * series beside its plans, targets or prior periods, else the last series (where a comparison puts the
2122
- * proposed or current one).
2123
- */
2124
- function primarySeries(names) {
2125
- const periods = names.map(periodOf);
2126
- if (periods.every((v) => v != null) && new Set(periods).size === periods.length) return periods.indexOf(Math.max(...periods));
2127
- const measured = names.map((n, i) => (REFERENCE.test(plainText(n)) ? -1 : i)).filter((i) => i >= 0);
2128
- if (measured.length && measured.length < names.length) return measured[measured.length - 1];
2129
- return names.length - 1;
2130
- }
2131
-
2132
- /** A series name without its unit or case, so "Single feed (%)" and "single feed" are one series. */
2133
- function seriesKey(name) {
2134
- return plainText(name).replace(/\s*[((][^))]*[))]\s*$/u, "").trim().toLowerCase();
2135
- }
2136
-
2137
- /**
2138
- * A native chart in the pack's chart style: one hue per series, the accent on the deck's one highlighted
2139
- * series (primarySeries), the others receding (accent-on-muted) or in the pack's other series hues.
2140
- */
2141
- function drawChart(slide, S, c, p) {
2142
- const P = S.P;
2143
- const chart = S.pack.chart || {};
2144
- const series = (c.headers || []).length - 1;
2145
- const muted = mix(P["ink-muted"], P.ground, 0.45);
2146
- let colours;
2147
- if (series <= 1) {
2148
- // One series is one hue (a per-point highlight would make the chart read as categories): the accent,
2149
- // unless the deck shows the same series receding beside another, where it keeps that colour.
2150
- const other = S.seriesRole && S.seriesRole.get(seriesKey((c.headers || [])[1])) === "other";
2151
- const receding = chart.highlight === "accent-on-muted" ? muted : P.series.find((h) => String(h).toUpperCase() !== String(P.accent).toUpperCase()) || muted;
2152
- colours = [other ? receding : P.accent];
2153
- } else {
2154
- const primary = primarySeries(c.headers.slice(1));
2155
- const others = chart.highlight === "accent-on-muted" ? (series === 2 ? [muted] : P.series.slice(1, series).reverse())
2156
- : P.series.filter((h) => String(h).toUpperCase() !== String(P.accent).toUpperCase());
2157
- let k = 0;
2158
- colours = Array.from({ length: series }, (_, i) => (i === primary ? P.accent : others[k++ % others.length]));
2159
- }
2160
- // Without a value axis, the top data label needs headroom inside the plot.
2161
- const values = (c.rows || []).flatMap((r) => r.slice(1).map((v) => Number(plainText(v).replace(/[^\d.\-]/gu, "")))).filter(Number.isFinite);
2162
- const top = values.length ? Math.max(...values) : 0;
2163
- const style = {
2164
- series: colours, ink: P.ink, ink_muted: P["ink-muted"], line: P.line,
2165
- titleFont: S.faces.title.font, bodyFont: S.faces.body.font, labelSize: S.sizes.label,
2166
- grid: chart.gridlines !== "none", valAxisHidden: chart.gridlines === "none" && chart.labels === "direct",
2167
- ...(top > 0 && !(c.chart && ["pie", "doughnut"].includes(c.chart.type)) ? { valMax: niceCeil(top * 1.15) } : {}),
2168
- };
2169
- const bottom = p.y + p.h - p.cap;
2170
- shared().renderChart(slide, c, { x: IN(p.x), y: IN(p.y), w: IN(p.w), h: IN(bottom - p.y) }, style, IN(bottom));
2171
- }
2172
-
2173
- /** A round axis maximum at or above v (1, 2 or 5 times a power of ten). */
2174
- function niceCeil(v) {
2175
- const p = 10 ** Math.floor(Math.log10(v));
2176
- return [1, 1.2, 1.5, 2, 2.5, 3, 4, 5, 6, 8, 10].map((m) => m * p).find((x) => x >= v);
2177
- }
2178
-
2179
- // A totals row's first cell; a word boundary after Hangul needs the lookahead (\b reads ASCII only).
2180
- const TOTALS = /^(합계|총계|소계|계|total|sum)(?![\p{L}\p{N}])/iu;
2181
-
2182
- /** A table in the pack's table style: header fill, rules and banding from the pack, numbers right-aligned. */
2183
- function drawPackTable(slide, S, c, p, title) {
2184
- const A = shared();
2185
- const headers = c.headers || [];
2186
- // Every row carries one cell per column, so a short source row cannot leave a ragged table.
2187
- const rows = (c.rows || []).map((r) => headers.map((_, i) => (r[i] != null ? r[i] : "")));
2188
- if (!headers.length) return;
2189
- const t = S.pack.table || {};
2190
- const numeric = A.numericColumns(headers, rows);
2191
- const hair = { type: "solid", pt: 0.75, color: S.colour("line") };
2192
- const heavy = (pt) => ({ type: "solid", pt, color: S.colour("ink") });
2193
- const none = { type: "none" };
2194
- const headerFill = t.header && t.header !== "none" ? S.colour(t.header) : null;
2195
- const headerInk = S.colour(t["header-ink"] || (t.header === "field" ? "on-field" : "ink"));
2196
- const lastIsTotal = rows.length > 1 && TOTALS.test(plainText(rows[rows.length - 1][0]));
2197
- const titleText = plainText(title);
2198
- const protagonist = t.protagonist && t.protagonist !== "none"
2199
- ? rows.findIndex((r) => { const k = plainText(r[0]); return k.length >= 2 && titleText.includes(k); })
2200
- : -1;
2201
- // [top, right, bottom, left] for the header (ri = -1) and each data row.
2202
- const border = (ri) => {
2203
- const last = ri === rows.length - 1;
2204
- switch (t.rules) {
2205
- case "grid": return Array(4).fill(S.pack["edge-weight"] ? { type: "solid", pt: S.pack["edge-weight"], color: S.colour(S.pack["edge-colour"] || "line") } : hair);
2206
- case "booktabs": return [ri === -1 ? heavy(1) : none, none, ri === -1 ? heavy(0.5) : last ? heavy(1) : none, none];
2207
- case "top-bottom": return [ri === -1 ? hair : none, none, last ? hair : ri === -1 ? hair : none, none];
2208
- case "header-rule": return [none, none, ri === -1 ? heavy(2) : none, none];
2209
- case "rows": return [none, none, hair, none];
2210
- default: // header-and-totals
2211
- return [last && lastIsTotal ? hair : none, none, ri === -1 ? hair : none, none];
2212
- }
2213
- };
2214
- const cellMargin = [IN(6), IN(6), IN(6), IN(6)];
2215
- // Cell text that wraps is broken at spaces here, as in body text (see G.keepLines).
2216
- const keep = (text, ci, ri, size, role) => G.keepLines(text, ((p.widths[ci] || p.w) - 12) / S.wide(role, text) / size,
2217
- Math.floor(((p.heights[ri + 1] || 0) - 12) / (size * 1.45) + 0.01));
2218
- const tableRows = [headers.map((h, ci) => ({
2219
- text: keep(plainText(h), ci, -1, p.header, "label"),
2220
- options: { bold: true, color: headerInk, fontFace: S.faces.label.font, fontSize: p.header, align: numeric[ci] ? "right" : "left", valign: "middle",
2221
- margin: cellMargin, border: border(-1), ...(headerFill ? { fill: { color: headerFill } } : {}) },
2222
- }))];
2223
- rows.forEach((r, ri) => {
2224
- const total = lastIsTotal && ri === rows.length - 1 && t.totals === "bold";
2225
- const band = t.banding && t.banding !== "none";
2226
- tableRows.push(r.map((cell, ci) => A.linkedTableCell(typeof cell === "string" && !/\]\(/u.test(cell) ? keep(cell, ci, ri, p.data, "body") : cell, {
2227
- color: S.colour("ink"), fontFace: S.faces.body.font, fontSize: p.data, bold: total,
2228
- align: numeric[ci] ? "right" : "left", valign: "middle", margin: cellMargin, border: border(ri),
2229
- ...(ri === protagonist ? { fill: { color: S.colour(t.protagonist) } } : band && ci === 0 ? { fill: { color: S.colour(t.banding) } } : {}),
2230
- })));
2231
- });
2232
- slide.addTable(tableRows, {
2233
- // The frame is as tall as its rows; without h the frame is declared 1in whatever the rows need.
2234
- x: IN(p.x), y: IN(p.y), w: IN(p.w), h: IN(p.tableH), colW: p.widths.map(IN), rowH: p.heights.map(IN), autoPage: false,
2235
- });
2236
- }
2237
-
2238
- // ── Fill and treatment choice ───────────────────────────────────────────────
2239
-
2240
- /** Bottom of the content, decoration excluded. */
2241
- function contentBottom(placed, top) {
2242
- const counted = placed.filter((p) => !p.decor);
2243
- return counted.length ? Math.max(...counted.map((p) => p.y + p.h)) : top;
2244
- }
2245
-
2246
- function overflows(placed) {
2247
- return placed.some((p) => !p.decor && p.limit != null && p.y + p.h > p.limit + 0.5);
2248
- }
2249
-
2250
- /**
2251
- * The zones of one treatment frame: body Z, the class and where the empty band is measured from.
2252
- * Every treatment's body is the shared body zone under the title zone, so the class is "top".
2253
- */
2254
- function zonesOf(frame, S) {
2255
- const t = frame.title;
2256
- if (!frame.body) return { cls: "none" };
2257
- const Z = region(S, frame.body.a, frame.body.b, frame.body.y, frame.body.bottom);
2258
- return { cls: "top", Z, bandTop: Math.min(t.y + t.h, Z.y) };
2259
- }
2260
-
2261
- /**
2262
- * Lay a content slide out under one frame and, when the body leaves more than the density band
2263
- * empty, try the pack's fill policies in order: larger type one ramp step, the next spacing step,
2264
- * the visual taking the room. Content is never invented and decoration never fills space.
2265
- */
2266
- // A line that names the slide's source or a note on its basis ("출처:", "주:", "Source:", "Note:").
2267
- const STRIP = /^(?:출처|자료|주|Sources?|Notes?)\s*[::]/iu;
2268
-
2269
- /**
2270
- * The source and note lines of a content slide's text, taken out of its takeaways: they are set as a
2271
- * strip at the foot of the body zone, at source size under a hairline, so the slide states where its
2272
- * figures come from without a takeaway column spending its lines on it. Closings keep theirs in the
2273
- * next step.
2274
- */
2275
- function takeStrip(spec, items) {
2276
- // A closing with a next step keeps its source there; a closing summary has no such line, so it takes the strip.
2277
- if (G.VARIANTS.closing.includes(spec.family) && spec.family !== "closing-summary-list") return { items, lines: [] };
2278
- const lines = [];
2279
- const keep = (list) => (list || []).filter((it) => {
2280
- if ((it.type === "bullet" || it.type === "text") && STRIP.test(plainText(it.text || "")) && !(it.children || []).length) { lines.push(it.text); return false; }
2281
- return true;
2282
- });
2283
- const out = items.map((item) => {
2284
- if (item.type === "body" && item.content && Array.isArray(item.content.items)) return { ...item, content: { ...item.content, items: keep(item.content.items) } };
2285
- return item;
2286
- }).filter((item) => !(item.type === "body" && item.content && Array.isArray(item.content.items) && !item.content.items.length));
2287
- return { items: out, lines };
2288
- }
2289
-
2290
- function stripPlacements(lines, Z, S) {
2291
- const size = S.sizes.source;
2292
- const paras = lines.map((t) => ({ kind: "text", text: t, inset: 0, gap: 2, h: G.textHeight(plainText(t), Z.w, size, 1.3) }));
2293
- paras[0].gap = 0;
2294
- const h = paras.reduce((a, q) => a + q.gap + q.h, 0);
2295
- const y = Z.bottom - h;
2296
- // A hairline sets the strip off where the pack draws hairlines; elsewhere the size and the muted
2297
- // ink do (a rule in a pack without them adds a colour to the slide).
2298
- return { h: h + 10, placed: [
2299
- ...(S.deco.has("hairline-rule") ? [{ decor: true, kind: "rect", x: Z.x, y: y - 6, w: Z.w, h: 0.5, fill: "line" }] : []),
2300
- { kind: "text", paras, size, x: Z.x, y, w: Z.w, h, muted: true, limit: Z.bottom },
2301
- ] };
2302
- }
2303
-
2304
- // A column more empty than this, beside a longer one, costs the slide its title.
2305
- const RAIL_EMPTY = 0.4;
2306
-
2307
- function planSlide(spec, frame, S, items) {
2308
- const z = zonesOf(frame, S);
2309
- if (spec.lead && spec.family !== "summary-box-list") items = [{ type: "main-box", content: spec.lead }, ...items];
2310
- if (z.cls === "none") return { placed: [], band: 0, applied: [], before: 0, z };
2311
- const full = z.Z;
2312
- const taken = takeStrip(spec, items);
2313
- // The source strip: offered to a takeaway column beside a visual, and across the body's foot when no column takes it.
2314
- const lines = taken.lines;
2315
- items = taken.items;
2316
- const across = lines.length ? stripPlacements(lines, full, S) : null;
2317
- const tok = S.tok;
2318
- const plan = (spec.stacked && PLANS[STACKS[spec.family]]) || PLANS[spec.family] || PLANS["text-column"];
2319
- const state = { stepped: false, anchor: false, itemGap: tok.item, groupGap: tok.group, blockGap: tok.block };
2320
- // Offer the strip to a column first; once a run leaves it, it runs across the foot and the body ends above it.
2321
- let offer = Boolean(across);
2322
- const zone = () => (across && !offer ? { ...full, bottom: full.bottom - across.h - S.tok.block } : full);
2323
- // A later run (another fill state) that leaves the offered strip is refused like an overflow.
2324
- const run = (settle = false) => {
2325
- const ctx = { spec, S, state, Z: zone(), family: spec.family, items, strip: offer ? lines : null };
2326
- const placed = plan(ctx);
2327
- const lost = offer && !placed.some((q) => q.strip);
2328
- if (lost && settle) {
2329
- offer = false;
2330
- return run();
2331
- }
2332
- return { placed, lost, bottom: contentBottom(placed, zone().y) };
2333
- };
2334
- const band = (o) => Math.max(0, Math.min(1, (zone().bottom - o.bottom) / Math.max(1, zone().bottom - z.bandTop)));
2335
- let out = run(true);
2336
- if (overflows(out.placed)) {
2337
- // Too much for the body at the family's sizes: leads drop to body size and gaps to the item gap.
2338
- Object.assign(state, { compact: true, groupGap: tok.item, blockGap: tok.group });
2339
- out = run(true);
2340
- }
2341
- const before = band(out);
2342
- const applied = [];
2343
- if (before > tok.cap && items.length) {
2344
- for (const policy of S.pack["fill-order"] || []) {
2345
- if (band(out) <= tok.cap) break;
2346
- const saved = { ...state };
2347
- if (policy === "step-up") {
2348
- if (!tok.stepUp) continue;
2349
- state.stepped = true;
2350
- } else if (policy === "distribute") {
2351
- state.itemGap = G.stepGap(state.itemGap, 24);
2352
- state.groupGap = G.stepGap(state.groupGap, 48);
2353
- state.blockGap = G.stepGap(state.blockGap, 48);
2354
- } else if (policy === "anchor-visual") {
2355
- state.anchor = true;
2356
- } else {
2357
- continue;
2358
- }
2359
- if (JSON.stringify(saved) === JSON.stringify(state)) continue;
2360
- const next = run();
2361
- if (next.lost || overflows(next.placed)) Object.assign(state, saved);
2362
- else {
2363
- if (next.bottom > out.bottom + 0.5) applied.push(policy);
2364
- out = next;
2365
- }
2366
- }
2367
- }
2368
- z.Z = zone();
2369
- // A text column that stops short of the column beside it is filled by layout; one that still leaves more
2370
- // than RAIL_EMPTY of the body empty makes this title unfit for the slide when another fits.
2371
- const floor = full.bottom;
2372
- let short = shortColumn([...out.placed, ...(across && !offer ? across.placed : [])], floor, S);
2373
- // The fill starts a little under the line (0.35), so a column the gate reads a point or two emptier than the
2374
- // estimate still holds.
2375
- if (short.share > 0.35) {
2376
- fillColumn(short, floor, S, state);
2377
- short = shortColumn([...out.placed, ...(across && !offer ? across.placed : [])], floor, S);
2378
- }
2379
- const placed = [...out.placed, ...(across && !offer ? across.placed : [])];
2380
- const overflow = overflows(placed);
2381
- return { ...out, placed, band: band(out), before, applied, z, overflow, short: short.share,
2382
- unfit: overflow || short.share > RAIL_EMPTY };
2383
- }
2384
-
2385
- /** The frame of a treatment for this slide (a quote under a statement title says the quote). */
2386
- function frameFor(spec, treatment) {
2387
- const ctx = treatment === "statement" && spec.statementText ? { ...spec.ctx, title: spec.statementText } : spec.ctx;
2388
- return G.treatmentGeometry(treatment, ctx);
2389
- }
2390
-
2391
- /**
2392
- * Choose among the treatments the slide may take. The role default stays when its body fills to
2393
- * the density band; otherwise every allowed treatment is laid out and scored by the empty band it
2394
- * leaves, with a small cost for repeating the previous slide's title or one the deck already leans
2395
- * on and a large one past about a third of the deck, so filling never collapses a deck into one look. The variance dial keeps the number of
2396
- * distinct treatments under its maximum.
2397
- */
2398
- // The bottom-anchor style (the title frame closed by a heavy rule) is for a slide led by a chart, a picture,
2399
- // a big number, a row of figures or a timeline axis (S2.5), not for a table.
2400
- const drawn = (spec) => ["big-number", "kpi-row", "timeline"].includes(spec.family) || (spec.items || []).some((i) => (i.type === "kpi-table" && (i.content || {}).chart) || i.type === "image" || i.type === "image-grid");
2401
-
2402
- function chooseTreatment(spec, S, deck) {
2403
- const options = spec.candidates && spec.candidates.length ? spec.candidates : [spec.treatment];
2404
- const allowed = deck.used.size >= deck.max && options.some((t) => deck.used.has(t)) ? options.filter((t) => deck.used.has(t)) : options;
2405
- const tries = allowed.map((t) => ({ t, plan: planSlide(spec, frameFor(spec, t), S, spec.items || []) }));
2406
- // Titles that fit come first; a table goes under a bottom title only when nothing else fits it.
2407
- const fit = tries.filter((x) => !x.plan.unfit);
2408
- const proper = fit.filter((x) => x.t !== "bottom-anchor" || drawn(spec));
2409
- // When every title leaves the slide unfit, the one that overflows least and leaves a column least empty stands.
2410
- const badness = (x) => (x.plan.overflow ? 10 : 0) + Math.max(0, (x.plan.short || 0) - RAIL_EMPTY);
2411
- const pool = proper.length ? proper : fit.length ? fit : [...tries].sort((m, n) => badness(m) - badness(n));
2412
- const first = pool[0];
2413
- if (first.t === options[0] && first.plan.band <= S.tok.cap && first.t !== deck.prev && (deck.count[first.t] || 0) < deck.limit) return first;
2414
- const cost = (x) => x.plan.band + (x.plan.band > S.tok.cap ? 0.15 : 0) + 0.07 * (deck.count[x.t] || 0) +
2415
- (x.t === deck.prev ? 0.08 : 0) - (x.t === options[0] ? 0.03 : 0) + ((deck.count[x.t] || 0) >= deck.limit ? 1 : 0);
2416
- const best = pool.reduce((b, x) => (cost(x) < cost(b) - 1e-9 ? x : b));
2417
- // The role's own title is the pack's structure: it stays unless another title
2418
- // leaves at least 0.10 less of the body empty (0.15 when neither fills to the density band).
2419
- // A bottom title the slide may not take (a table) hands the pack's structure to its next treatment in order.
2420
- const ownT = options[0] === "bottom-anchor" && !drawn(spec) ? options.find((t) => t !== "bottom-anchor") : options[0];
2421
- const own = pool.find((x) => x.t === ownT);
2422
- const margin = best.plan.band > S.tok.cap ? 0.15 : 0.1;
2423
- // A family the pack draws with its own title (`structure`) keeps it past the deck's share of that title.
2424
- const pinned = (S.pack.structure || {})[spec.family] === ownT;
2425
- if (own && own !== best && own.plan.band - best.plan.band < margin && (pinned || (deck.count[own.t] || 0) < deck.limit)) return own;
2426
- return best;
2427
- }
2428
-
2429
- /**
2430
- * Fill alone can settle a deck on two titles. Variance 4 and up asks for three (S13.2) once a deck
2431
- * has eight slides, so while it carries fewer, the slide that loses the least fill moves to a
2432
- * treatment the deck has not used: one of its own candidates, never one that overflows or leaves
2433
- * more than the density band (or what the slide already leaves) empty, and never the last slide of
2434
- * a treatment.
2435
- */
2436
- function spreadTreatments(choices, S, pack, slideCount) {
2437
- const need = slideCount < 8 ? 0 : Math.min(pack.dials.variance <= 3 ? 1 : 3, pack.treatments.length, pack.dials.varianceMax);
2438
- const lines = [];
2439
- const used = () => new Set([...choices.values()].map((c) => c.t));
2440
- while (used().size < need) {
2441
- const have = used();
2442
- const count = (t) => [...choices.values()].filter((c) => c.t === t).length;
2443
- let best = null;
2444
- for (const [spec, current] of choices) {
2445
- if (count(current.t) < 2) continue;
2446
- for (const t of spec.candidates || []) {
2447
- if (have.has(t)) continue;
2448
- const plan = planSlide(spec, frameFor(spec, t), S, spec.items || []);
2449
- if (plan.unfit || plan.band > Math.max(S.tok.cap, current.plan.band) + 0.05) continue;
2450
- const loss = plan.band - current.plan.band;
2451
- if (!best || loss < best.loss) best = { spec, t, plan, loss };
2452
- }
2453
- }
2454
- if (!best) break;
2455
- choices.set(best.spec, { t: best.t, plan: best.plan });
2456
- lines.push(`variety: slide ${best.spec.index + 1} drawn under ${best.t} so the deck carries ${used().size} title treatments`);
2457
- }
2458
- // No title zone on more than 40 % of the content slides (S15): a data slide (a table, chart or
2459
- // figures under their takeaway) that fills no worse under another zone's treatment moves there,
2460
- // the one that gains the most first. Agendas, sequences and definitions keep their own titles.
2461
- const content = [...choices.keys()].filter((spec) => spec.kind === "content");
2462
- const movable = (spec) => spec.role === "data" || spec.role === "data-takeaway";
2463
- const cap = 0.4 * content.length;
2464
- const zonesNow = () => {
2465
- const zones = {};
2466
- for (const spec of content) zones[ZONE_OF[choices.get(spec).t]] = (zones[ZONE_OF[choices.get(spec).t]] || 0) + 1;
2467
- return zones;
2468
- };
2469
- // The data slide in zone `from` that fills best under a title of another zone with room.
2470
- const moveOut = (from, zones, blocked) => {
2471
- let best = null;
2472
- for (const spec of content) {
2473
- const current = choices.get(spec);
2474
- if (ZONE_OF[current.t] !== from || !movable(spec)) continue;
2475
- for (const t of spec.candidates || []) {
2476
- const zone = ZONE_OF[t];
2477
- if (zone === from || blocked.has(zone) || (zones[zone] || 0) + 1 > cap) continue;
2478
- if (t === "bottom-anchor" && !drawn(spec)) continue;
2479
- const inUse = new Set([...choices.values()].map((c) => c.t));
2480
- if (!inUse.has(t) && inUse.size >= pack.dials.varianceMax) continue;
2481
- const plan = planSlide(spec, frameFor(spec, t), S, spec.items || []);
2482
- if (plan.unfit || plan.band > Math.max(S.tok.cap, current.plan.band)) continue;
2483
- const gain = current.plan.band - plan.band;
2484
- if (!best || gain > best.gain) best = { spec, t, plan, gain };
2485
- }
2486
- }
2487
- return best;
2488
- };
2489
- const say = (m) => lines.push(`variety: slide ${m.spec.index + 1} drawn under ${m.t} so no title zone covers more than 40 % of the content slides`);
2490
- for (let guard = 0; guard < content.length; guard++) {
2491
- const zones = zonesNow();
2492
- const [crowded, n] = Object.entries(zones).sort((a, b) => b[1] - a[1])[0] || [];
2493
- if (!crowded || n <= cap) break;
2494
- let best = moveOut(crowded, zones, new Set());
2495
- if (!best) {
2496
- // Every zone a crowded slide could take is full: move one of that zone's own data slides on
2497
- // to a third zone first, when that makes room.
2498
- for (const [full, m] of Object.entries(zones)) {
2499
- if (full === crowded || m + 1 <= cap) continue;
2500
- const first = moveOut(full, zones, new Set([crowded]));
2501
- if (!first) continue;
2502
- const saved = choices.get(first.spec);
2503
- choices.set(first.spec, { t: first.t, plan: first.plan });
2504
- best = moveOut(crowded, zonesNow(), new Set());
2505
- if (best) { say(first); break; }
2506
- choices.set(first.spec, saved);
2507
- }
2508
- }
2509
- if (!best) break;
2510
- choices.set(best.spec, { t: best.t, plan: best.plan });
2511
- say(best);
2512
- }
2513
- // Composition variety (S15) counts title zone x column partition over the content slides,
2514
- // closings excluded. While the deck has fewer distinct layouts than the check needs, a data slide
2515
- // whose layout another slide shares moves to a title that gives a layout the deck lacks, when that
2516
- // neither overflows nor leaves more than the density band (or what the slide already leaves).
2517
- const counted = content.filter((spec) => !G.VARIANTS.closing.includes(spec.family));
2518
- const layoutsNeeded = Math.min(5, Math.ceil(0.6 * counted.length));
2519
- const layoutOf = (t, plan) => `${ZONE_OF[t]}/${partitionOf(plan, S)}`;
2520
- // The check also fails a deck where one layout covers more than 40 % of those slides, so while
2521
- // one does, a slide of that layout moves to a title that gives a layout still under the share.
2522
- // A title style never moves the body (every treatment shares the title zone), so any slide whose
2523
- // source leaves its title open may take another here, not only a data slide.
2524
- const shareCap = 0.4 * counted.length;
2525
- for (let guard = 0; guard < counted.length; guard++) {
2526
- const keys = {};
2527
- for (const spec of counted) { const c = choices.get(spec); const k = layoutOf(c.t, c.plan); keys[k] = (keys[k] || 0) + 1; }
2528
- const [topKey, topN] = Object.entries(keys).sort((a, b) => b[1] - a[1])[0] || [];
2529
- const short = Object.keys(keys).length < layoutsNeeded;
2530
- const crowded = topN > shareCap;
2531
- if (!short && !crowded) break;
2532
- let best = null;
2533
- for (const spec of counted) {
2534
- const current = choices.get(spec);
2535
- const from = layoutOf(current.t, current.plan);
2536
- if (keys[from] < 2 || (!short && from !== topKey)) continue;
2537
- for (const t of spec.candidates || []) {
2538
- if (t === current.t || (t === "bottom-anchor" && !drawn(spec))) continue;
2539
- const inUse = new Set([...choices.values()].map((c) => c.t));
2540
- if (!inUse.has(t) && inUse.size >= pack.dials.varianceMax) continue;
2541
- const plan = planSlide(spec, frameFor(spec, t), S, spec.items || []);
2542
- const to = layoutOf(t, plan);
2543
- if (plan.unfit || plan.band > Math.max(S.tok.cap, current.plan.band) || to === from) continue;
2544
- // A move that adds a layout comes first; else one that relieves the crowded layout.
2545
- const adds = short && !keys[to];
2546
- const relieves = crowded && from === topKey && (keys[to] || 0) + 1 <= shareCap;
2547
- if (!adds && !relieves) continue;
2548
- const loss = plan.band - current.plan.band - (adds ? 2 : 0) - (relieves ? 1 : 0);
2549
- if (!best || loss < best.loss) best = { spec, t, plan, loss, added: !keys[to] };
2550
- }
2551
- }
2552
- if (!best) {
2553
- // No title gives a new layout: a table or chart slide may stack its takeaways under the visual
2554
- // across the body (the composition of the ledger-table and full-chart families) instead.
2555
- for (const spec of counted) {
2556
- const current = choices.get(spec);
2557
- const from = layoutOf(current.t, current.plan);
2558
- if (!STACKS[spec.family] || spec.stacked || keys[from] < 2 || (!short && from !== topKey)) continue;
2559
- const stacked = { ...spec, stacked: true };
2560
- for (const t of [current.t, ...(spec.candidates || []).filter((c) => c !== current.t)]) {
2561
- if (t === "bottom-anchor" && !drawn(spec)) continue;
2562
- const plan = planSlide(stacked, frameFor(spec, t), S, spec.items || []);
2563
- const to = layoutOf(t, plan);
2564
- if (plan.unfit || plan.band > Math.max(S.tok.cap, current.plan.band) || to === from) continue;
2565
- if (short ? keys[to] : (keys[to] || 0) + 1 > shareCap) continue;
2566
- const loss = plan.band - current.plan.band;
2567
- if (!best || loss < best.loss) best = { spec, t, plan, loss, added: !keys[to], stacked: true };
2568
- }
2569
- }
2570
- }
2571
- if (!best) break;
2572
- if (best.stacked) best.spec.stacked = true;
2573
- choices.set(best.spec, { t: best.t, plan: best.plan });
2574
- lines.push(best.added ? `variety: slide ${best.spec.index + 1} drawn under ${best.t} so the deck carries ${Object.keys(keys).length + 1} layouts`
2575
- : `variety: slide ${best.spec.index + 1} drawn under ${best.t} so no layout covers more than 40 % of the content slides`);
2576
- }
2577
- return lines;
2578
- }
2579
-
2580
- /**
2581
- * The boxes a placement draws as the composition check reads them from the page: text frames,
2582
- * tables, charts and pictures, and filled surfaces that hold text (cards). Rules, dots and outlines
2583
- * are decoration there and are left out.
2584
- */
2585
- function drawnBoxes(p, S) {
2586
- const B = (x, y, w, h, card = false) => ({ x, y, w, h, card });
2587
- const filled = S.pack.edge !== "border";
2588
- switch (p.kind) {
2589
- case "group": return p.parts.flatMap((q) => drawnBoxes(q, S));
2590
- case "text": {
2591
- let y = p.y;
2592
- return p.paras.map((para) => { y += para.gap || 0; const box = B(p.x + (para.inset || 0), y, p.w - (para.inset || 0), para.h); y += para.h; return box; });
2593
- }
2594
- case "callout": return [B(p.x, p.y, p.w, p.h, true)];
2595
- case "box": return p.outline || (!p.tint && !filled) ? [] : [B(p.x, p.y, p.w, p.h, true)];
2596
- case "panel": return p.fill && p.h >= 40 ? [B(p.x, p.y, p.w, p.h, true)] : [];
2597
- case "kpi": return p.cards.flatMap((card, i) => {
2598
- const x = p.x + i * (p.cardW + S.grid.gutter);
2599
- if (filled) return [B(x, p.y, p.cardW, p.cardH, true)];
2600
- const y = p.y + p.pad + p.value * 1.15 + 6;
2601
- return [B(x + p.pad, p.y + p.pad, p.cardW - p.pad * 2, p.value * 1.15), B(x + p.pad, y, p.cardW - p.pad * 2, p.labelH)];
2602
- });
2603
- case "figrows": return p.rows.flatMap((r) => [B(p.x, r.y, p.valueW, p.value * 1.15), B(p.labelX, r.y, p.labelW, p.labelSize * 1.4)]);
2604
- case "rows": return p.rows.flatMap((r) => [B(p.x, r.y, p.numW, (p.numSize || p.head) * 1.15), B(p.textX, r.y, p.textW, p.restX != null ? r.hh : r.h),
2605
- ...(p.restX != null && r.rest ? [B(p.restX, r.y, p.restW, r.rh)] : [])]);
2606
- case "headed": return p.rows.flatMap((r) => [B(p.headX, r.y, p.headW, r.headH), B(p.textX, r.y, p.textW, r.textH)]);
2607
- case "steps": return p.steps.flatMap((st) => [B(st.x, p.y, st.w, p.numSize * 1.1), B(st.x, p.y + p.numSize * 1.1 + 18, st.w, st.headH)]);
2608
- case "timeline": return p.events.flatMap((e) => [B(e.x, p.axisY - 18 - p.dateSize * 1.25, e.w, p.dateSize * 1.25), B(e.x, p.axisY + 18, e.w, e.labelH)]);
2609
- case "actions": return p.rows.flatMap((r) => [B(p.keyX, r.y, p.keyW, p.keySize * 1.15), B(p.textX, r.y, p.textW, r.headH)]);
2610
- case "matrix": return [...p.cells.map((c) => B(c.x + p.pad, c.y + p.pad, c.w - p.pad * 2, c.headH)),
2611
- ...p.xHeads.map((_, i) => B(p.grid.x + i * (p.qw + p.gap), p.grid.y, p.qw, 16)),
2612
- ...p.yHeads.map((_, i) => B(p.labels.x, p.top + i * (p.qh + p.gap), p.labels.w, 16))];
2613
- case "quote": return [B(p.x, p.y, p.w, p.h)];
2614
- case "number": return [B(p.x, p.y, p.w, p.h)];
2615
- // A chart's caption is its own frame under the plot, as the check reads it.
2616
- case "chart": return p.cap ? [B(p.x, p.y, p.w, p.h - p.cap), B(p.x, p.y + p.h - p.cap + 6, p.w, p.cap - 6)] : [B(p.x, p.y, p.w, p.h)];
2617
- case "image": {
2618
- // A single picture is drawn contained in its box (on the box floor beside a taller takeaway column),
2619
- // its caption under it: the check reads those two frames.
2620
- const size = p.item && p.item.type === "image" && p.item.imageSize;
2621
- if (!size) return [B(p.x, p.y, p.w, p.h)];
2622
- const fit = shared().containBox(p.x, p.y, p.w, p.h - p.cap, size);
2623
- const low = p.y + p.h - p.cap - fit.h;
2624
- if (p.beside != null && low <= p.beside) fit.y = low;
2625
- return [B(fit.x, fit.y, fit.w, fit.h), ...(p.cap ? [B(p.x, fit.y + fit.h + 6, p.w, p.cap - 6)] : [])];
2626
- }
2627
- case "table": case "caption": return [B(p.x, p.y, p.w, p.h)];
2628
- default: return p.x != null && p.w ? [B(p.x, p.y, p.w, p.h || 0)] : [];
2629
- }
2630
- }
2631
-
2632
- /**
2633
- * The column partition a plan draws, read the way the composition check reads the page (S15):
2634
- * boxes inside a card count as the card; boxes narrower than 70 % of the body are grouped into
2635
- * columns by overlapping x-extent (half the narrower box joins, and a box that joins two columns
2636
- * merges them); two or more columns sharing two or more rows, or four columns, are a grid.
2637
- */
2638
- function partitionOf(plan, S) {
2639
- const Z = plan.z && plan.z.Z;
2640
- const placed = (plan.placed || []).filter((q) => !q.decor);
2641
- if (!Z || !placed.length) return "one";
2642
- const all = placed.flatMap((q) => drawnBoxes(q, S)).filter((b) => b.w > 0 && b.h > 0);
2643
- const cards = all.filter((b) => b.card);
2644
- const inCard = (b) => cards.some((c) => c !== b && b.x + b.w / 2 >= c.x - 1 && b.x + b.w / 2 <= c.x + c.w + 1 && b.y + b.h / 2 >= c.y - 1 && b.y + b.h / 2 <= c.y + c.h + 1);
2645
- // A one-line caption or source on the body floor is the slide's foot, not a column (as the gate reads it).
2646
- const body = SG.zone(S.grid.canvas, "content", "body");
2647
- const floor = body.y + body.h;
2648
- const blocks = all.filter((b) => !inCard(b) && !(!b.card && b.h <= 16 && b.y + b.h >= floor - 2));
2649
- if (!blocks.length) return "one";
2650
- const bodyW = S.grid.W - 2 * S.grid.margin;
2651
- let narrow = blocks.filter((b) => b.w < 0.7 * bodyW);
2652
- if (!narrow.length) narrow = blocks;
2653
- const columns = [];
2654
- for (const b of [...narrow].sort((m, n) => m.x - n.x)) {
2655
- const hits = columns.filter((c) => Math.min(c.r, b.x + b.w) - Math.max(c.l, b.x) >= 0.5 * Math.min(c.r - c.l, b.w));
2656
- if (hits.length) {
2657
- const keep = hits[0];
2658
- for (const other of hits.slice(1)) { keep.l = Math.min(keep.l, other.l); keep.r = Math.max(keep.r, other.r); keep.items.push(...other.items); columns.splice(columns.indexOf(other), 1); }
2659
- keep.l = Math.min(keep.l, b.x); keep.r = Math.max(keep.r, b.x + b.w); keep.items.push(b);
2660
- } else columns.push({ l: b.x, r: b.x + b.w, items: [b] });
2661
- }
2662
- const columnOf = new Map(columns.flatMap((c, i) => c.items.map((b) => [b, i])));
2663
- const rows = [];
2664
- for (const b of [...narrow].sort((m, n) => m.y - n.y)) {
2665
- const last = rows[rows.length - 1];
2666
- if (last && b.y < last.bottom - 2) { last.bottom = Math.max(last.bottom, b.y + b.h); last.items.push(b); }
2667
- else rows.push({ bottom: b.y + b.h, items: [b] });
2668
- }
2669
- const gridRows = rows.filter((r) => new Set(r.items.map((b) => columnOf.get(b))).size >= 2).length;
2670
- const k = columns.length;
2671
- if (k >= 4 || (k >= 2 && gridRows >= 2)) return "grid";
2672
- if (k === 3) return "three";
2673
- if (k === 2) {
2674
- const [a, c] = columns.map((col) => col.r - col.l);
2675
- return Math.min(a, c) / Math.max(a, c) >= 0.85 ? "two-even" : "two-asym";
2676
- }
2677
- return "one";
2678
- }
2679
-
2680
- /**
2681
- * The emptiest text column of a two-column body, read as the gate reads it (OF-115):
2682
- * for every vertical cut no block crosses, a side holding text only, beside a side that reaches at least
2683
- * three quarters of the body, is measured by the largest band its blocks leave empty from the pair's top
2684
- * down to where the other side ends (to the floor beside figure rows), as a share of the body
2685
- * from that top to the floor. A source strip closing the column counts as a block but does not hide the band
2686
- * above it. Returns { share, owners }.
2687
- */
2688
- const TEXT_KINDS = new Set(["text", "caption", "callout", "box", "panel"]);
2689
- // A picture drawn smaller than its box leaves its own column empty above it as a short text column does.
2690
- const SHORT_KINDS = new Set([...TEXT_KINDS, "image"]);
2691
- function shortColumn(placed, floor, S) {
2692
- const flat = (list) => list.flatMap((q) => (q.kind === "group" ? flat(q.parts) : [q]));
2693
- const owners = flat(placed.filter((q) => !q.decor));
2694
- // A matrix's cells are drawn whole on the page, whatever its composition estimate reads of them.
2695
- const boxesOf = (q) => (q.kind === "matrix" ? q.cells.map((c) => ({ x: c.x, y: c.y, w: c.w, h: c.h })) : drawnBoxes(q, S));
2696
- // A chart's values table under its takeaways belongs to their column.
2697
- const boxes = owners.flatMap((q) => boxesOf(q).map((b) => ({ ...b, q, text: SHORT_KINDS.has(q.kind) || Boolean(q.item && q.item.values) })))
2698
- .concat(owners.filter((q) => q.kind === "box" || q.kind === "panel").map((q) => ({ x: q.x, y: q.y, w: q.w, h: q.h, q, text: true })))
2699
- .filter((b) => b.w > 0 && b.h > 0 && b.y < floor);
2700
- let worst = { share: 0, owners: [] };
2701
- if (boxes.length < 2) return worst;
2702
- const left = Math.min(...boxes.map((b) => b.x));
2703
- const right = Math.max(...boxes.map((b) => b.x + b.w));
2704
- for (const cut of [...new Set(boxes.map((b) => b.x + b.w))].sort((m, n) => m - n)) {
2705
- const a = boxes.filter((b) => b.x + b.w <= cut + 2);
2706
- const c = boxes.filter((b) => b.x >= cut - 2);
2707
- // A block across most of the body (a note under both columns) belongs to neither; a narrower one across the cut
2708
- // means there is no column line here.
2709
- const across = boxes.filter((b) => !a.includes(b) && !c.includes(b));
2710
- if (!a.length || !c.length || across.some((b) => b.w < 0.7 * (right - left))) continue;
2711
- const top = Math.min(...[...a, ...c].map((b) => b.y));
2712
- for (const [col, other] of [[a, c], [c, a]]) {
2713
- if (!col.every((b) => b.text)) continue;
2714
- // Beside figure rows (not on their own panel) the column runs to the floor: the rows stop where their
2715
- // spacing ends, not where the slide's content does.
2716
- const figures = other.some((b) => ["figrows", "number"].includes(b.q.kind)) && !other.some((b) => b.q.kind === "panel");
2717
- const reach = figures ? floor : Math.min(floor, Math.max(...other.map((b) => b.y + b.h)));
2718
- if (reach - top < 0.75 * (floor - top)) continue;
2719
- let gap = 0;
2720
- let cursor = top;
2721
- for (const b of [...col].sort((m, n) => m.y - n.y)) {
2722
- gap = Math.max(gap, b.y - cursor);
2723
- cursor = Math.max(cursor, b.y + b.h);
2724
- }
2725
- gap = Math.max(gap, reach - cursor);
2726
- const share = gap / Math.max(1, floor - top);
2727
- if (share > worst.share) worst = { share, owners: [...new Set(col.map((b) => b.q))], top, reach, besideText: other.every((b) => b.q.kind === "text") };
2728
- }
2729
- }
2730
- return worst;
2731
- }
2732
-
2733
- /**
2734
- * Fill a short text column by layout: its points step up to lead size when they fit
2735
- * and keep twelve glyphs a line, then the room left is shared between its points, at most a sixth of the
2736
- * body a gap. Type never shrinks and nothing is added. Changes the placements in place.
2737
- */
2738
- function fillColumn(short, floor, S, state) {
2739
- const texts = short.owners.filter((q) => q.kind === "text" && !q.muted && !q.strip && q.paras);
2740
- if (!texts.length) return;
2741
- // The chart's values under the takeaways move down with them; they bound nothing above them.
2742
- const values = short.owners.filter((q) => q.item && q.item.values);
2743
- const below = (q) => Math.min(floor, q.limit == null ? floor : q.limit, ...short.owners.filter((o) => o !== q && !values.includes(o) && o.y >= q.y + q.h - 0.5).map((o) => o.y - state.blockGap));
2744
- const carried = (q, dy) => values.every((v) => v.y < q.y + q.h - 0.5 || v.y + v.h + dy <= below(v) + 0.5);
2745
- const lead = S.sizes.lead;
2746
- // Beside another text column the points keep its size: two columns of text at two sizes read as a mistake.
2747
- for (const q of short.besideText ? [] : texts) {
2748
- if (q.size >= lead || q.w / lead < 12) continue;
2749
- const m = measureText(q.paras, q.w, S, { ...state, stepped: false }, { size: lead });
2750
- if (q.y + m.h <= below(q) + 0.5 && carried(q, m.h - q.h)) {
2751
- // Every later block in the column moves down by what the step adds.
2752
- const dy = m.h - q.h;
2753
- for (const o of short.owners) if (o !== q && o.y >= q.y + q.h - 0.5 && !o.strip && !o.muted) o.y += dy;
2754
- Object.assign(q, { paras: m.paras, size: m.size, h: m.h });
2755
- }
2756
- }
2757
- const breaks = texts.flatMap((q) => q.paras.filter((para, i) => i > 0 && para.kind !== "child").map((para) => ({ q, para })));
2758
- const last = [...texts, ...values].reduce((m, q) => (q.y + q.h > m.y + m.h ? q : m));
2759
- const room = below(last) - (last.y + last.h);
2760
- // The gap over a values table is shared like a gap between points.
2761
- const gaps = breaks.length + values.length;
2762
- if (!gaps || room <= 0) return;
2763
- const per = Math.min(room / (gaps + 1), (floor - short.top) / 6);
2764
- for (const { q, para } of breaks) { para.gap += per; q.h += per; }
2765
- // A block that grew pushes the text blocks and values under it (never the strip, which stays on the floor).
2766
- let shift = 0;
2767
- for (const q of [...texts, ...values].sort((m, n) => m.y - n.y)) {
2768
- if (values.includes(q)) shift += per;
2769
- q.y += shift;
2770
- shift += breaks.filter((b) => b.q === q).length * per;
2771
- }
2772
- }
2773
-
2774
- /** Families whose visual may take its takeaways under it across the body, and the plan that does. */
2775
- const STACKS = { "table-insight": "ledger-table", "chart-insight": "full-chart" };
2776
-
2777
- /**
2778
- * The composition title zone of each treatment (S15). Every treatment styles the one title frame of the
2779
- * slide grid, so a slide's title "zone" in its signature is its treatment, as the gate reads it.
2780
- */
2781
- const ZONE_OF = Object.fromEntries(G.TREATMENTS.map((t) => [t, t]));
2782
-
2783
- // ── Content, cover and section slides ───────────────────────────────────────
2784
-
2785
- function drawDecor(slide, S, list) {
2786
- for (const d of list || []) packRect(slide, S, d, { fill: d.role, alpha: d.alpha });
2787
- }
2788
-
2789
- /**
2790
- * A content slide: decoration, numeral, body, then the title frame of its treatment. The title is
2791
- * drawn last so the first shape on the slide is an unnamed one that can carry the family name.
2792
- */
2793
- function renderContent(slide, spec, S, ctx, chosen) {
2794
- const f = frameFor(spec, chosen.t);
2795
- const t = f.title;
2796
- const items = spec.items || [];
2797
- if (!f.image) drawDecor(slide, S, f.decor);
2798
- if (f.numeral) {
2799
- packText(slide, S, f.numeral.text, f.numeral, { face: "numeral", size: f.numeral.size, colour: S.colour("accent"), lineSpacing: 1.15, align: f.numeral.align, name: "numeral@kicker" });
2800
- }
2801
- const dctx = { sourceDir: ctx.sourceDir, title: spec.title };
2802
- let ink = t.colour;
2803
- if (f.image) {
2804
- const image = items.find((i) => i.type === "image" || i.type === "image-grid");
2805
- const src = image && (image.content.type === "image-grid" ? image.content.images[0] : image.content);
2806
- if (src) {
2807
- const file = shared().resolveImagePath(src.src, ctx.sourceDir);
2808
- slide.addImage({ path: file, ...croppedTo(file, { x: 0, y: 0, w: f.image.w, h: f.image.h }), altText: src.caption || path.basename(file) });
2809
- drawDecor(slide, S, f.decor);
2810
- if (image.caption) drawCaption(slide, S, image.caption, t.x, 432, t.w, "on-field");
2811
- }
2812
- } else if (f.support) {
2813
- const text = spec.supportText || spec.lead || items.filter(isText).flatMap(itemParas).map((p) => plainText(p.text)).join(" ");
2814
- const supportH = text ? G.textHeight(plainText(text), f.support.w, S.sizes.body) : 0;
2815
- ink = statementDevice(slide, S, f, supportH);
2816
- if (text) packText(slide, S, text, { ...f.support, h: supportH }, { colour: S.colour(ink === "on-field" ? "on-field" : "ink-muted"), name: "support@statement" });
2817
- } else if (f.body) {
2818
- const plan = chosen.plan;
2819
- if (plan.before > S.tok.cap || plan.band > S.tok.cap) {
2820
- ctx.log.push(`fill: slide ${spec.index + 1} band ${plan.before.toFixed(2)} -> ${plan.band.toFixed(2)} (${plan.applied.length ? plan.applied.join(", ") : "none: nothing on the slide can grow; choose a fuller family"})`);
2821
- }
2822
- for (const p of plan.placed.filter((q) => q.decor)) drawPlaced(slide, S, p, dctx);
2823
- for (const p of plan.placed.filter((q) => !q.decor)) drawPlaced(slide, S, p, dctx);
2824
- }
2825
- packText(slide, S, chosen.t === "statement" && spec.statementText ? spec.statementText : spec.title, t, {
2826
- // Every title that wraps is set in balanced lines, never ending on one word.
2827
- face: t.face, size: t.size, colour: S.colour(ink), lineSpacing: t.lineSpacing || 1.15, valign: t.valign, title: true, name: `title@${chosen.t}`, balance: true,
2828
- });
2829
- }
2830
-
2831
- /**
2832
- * What carries a statement, from the pack's display keys: nothing (open), the field over the whole
2833
- * page (drench), the field from just above the sentence's zone to the page foot (plate), a hairline
2834
- * above the sentence and one under its support line (rules), the primaries' composition in the side
2835
- * zone (geometry), or the rail colour filling the side zone (offset). The sentence stays in the display
2836
- * title zone whichever it is. Returns the colour role the sentence takes.
2837
- */
2838
- function statementDevice(slide, S, f, supportH) {
2839
- const g = S.grid;
2840
- const t = f.title;
2841
- const side = SG.zone(g.canvas, "display", "side");
2842
- const device = (S.pack.display || {}).statement || "open";
2843
- if (device === "drench") {
2844
- packRect(slide, S, { x: 0, y: 0, w: g.W, h: g.H }, { fill: "field" });
2845
- return "on-field";
2846
- }
2847
- if (device === "plate") {
2848
- packRect(slide, S, { x: 0, y: t.y - 24, w: g.W, h: g.H - t.y + 24 }, { fill: "field" });
2849
- return "on-field";
2850
- }
2851
- if (device === "rules") {
2852
- // The rules follow the sentence centred in its zone, not the zone's edges.
2853
- const full = g.span(1, 12);
2854
- const top = t.y + (t.h - t.textH) / 2;
2855
- const below = supportH ? f.support.y + supportH + 24 : top + t.textH + 30;
2856
- packRect(slide, S, { x: full.x, y: top - 30, w: full.w, h: 0.75 }, { fill: "line" });
2857
- packRect(slide, S, { x: full.x, y: below, w: full.w, h: 0.75 }, { fill: "line" });
2858
- return t.colour;
2859
- }
2860
- if (device === "geometry") {
2861
- geometry(slide, S, side);
2862
- return t.colour;
2863
- }
2864
- if (device === "offset") {
2865
- packRect(slide, S, { ...side, h: G.ZONE.floor }, { fill: S.pack.rail === "field" ? "field" : "surface" });
2866
- return t.colour;
2867
- }
2868
- return t.colour;
2869
- }
2870
-
2871
- function metaLine(meta) {
2872
- return [meta.date, meta.department, meta.presenter].filter(Boolean).join(" · ");
2873
- }
2874
-
2875
- /**
2876
- * The cover's words, the same places in every tonality (slide-grid cover zones): the meta line in the
2877
- * header zone, the title standing on the title zone's foot at the largest step that fits it (from the
2878
- * hero step while the pack's hero is on), and the
2879
- * subtitle in the subtitle zone. A device only paints what lies behind or beside them.
2880
- */
2881
- function coverWords(slide, spec, S, meta, o = {}) {
2882
- const Z = SG.zones(S.grid.canvas).cover;
2883
- const soft = S.colour(o.soft || "ink-muted");
2884
- const line = metaLine(meta);
2885
- if (line) packText(slide, S, line, Z.header, { size: S.sizes.label, colour: S.colour(o.meta || o.soft || "ink-muted"), lineSpacing: 1.2, name: "header@cover" });
2886
- if (meta.subtitle) {
2887
- const size = G.textHeight(meta.subtitle, Z.subtitle.w, S.sizes.lead) <= Z.subtitle.h ? S.sizes.lead : S.sizes.body;
2888
- packText(slide, S, meta.subtitle, Z.subtitle, { name: "subtitle@cover", size, colour: soft });
2889
- }
2890
- const steps = [...new Set([o.start || (S.pack.hero ? S.sizes.hero : S.sizes.cover), S.sizes.cover, S.sizes.display])].sort((a, b) => b - a);
2891
- const fits = (z) => S.lines(plainText(spec.title), Z.title.w, z, "display") * z * 1.1 <= Z.title.h;
2892
- const size = steps.find(fits) || S.sizes.display;
2893
- packText(slide, S, spec.title, Z.title, { face: "display", size, colour: S.colour(o.ink || "ink"), lineSpacing: 1.1, title: true, balance: true, valign: "bottom", name: "title@cover" });
2894
- }
2895
-
2896
- /** A row of keys over short labels in the cover's strip zone (the deck's parts or its headline figures), under a hairline. */
2897
- function coverStrip(slide, S, parts) {
2898
- const g = S.grid;
2899
- const Z = SG.zones(g.canvas).cover.strip;
2900
- const row = parts.slice(0, 4);
2901
- const cols = equalParts(S, region(S, 1, 12, Z.y, Z.y + Z.h), row.length);
2902
- packRect(slide, S, { x: Z.x, y: Z.y - 9, w: Z.w, h: 0.75 }, { fill: "line" });
2903
- row.forEach(([key, text], i) => {
2904
- const R = cols[i];
2905
- const k = [S.sizes.title, S.sizes.lead].find((z) => S.ems(key, "numeral") * z * 1.1 <= R.w) || S.sizes.body;
2906
- packText(slide, S, key, { x: R.x, y: Z.y, w: R.w, h: k * 1.15 }, { face: "numeral", size: k, colour: S.colour(i === 0 ? "accent" : "ink"), lineSpacing: 1.15 });
2907
- const top = Z.y + k * 1.32 + 4;
2908
- packText(slide, S, text, { x: R.x, y: top, w: R.w, h: Math.max(S.sizes.body * 1.4, Z.y + Z.h - top) }, { size: S.sizes.body, colour: S.colour("ink-muted") });
2909
- });
2910
- }
2911
-
2912
- /** The deck's parts, else its headline figures, as strip entries. */
2913
- function stripParts(facts) {
2914
- if ((facts.index || []).length >= 2) return facts.index.map((name, i) => [String(i + 1).padStart(2, "0"), name]);
2915
- if ((facts.figures || []).length >= 2) return facts.figures.map((f) => [f.value, f.label]);
2916
- return [];
2917
- }
2918
-
2919
- function coverImage(slide, box, src, sourceDir) {
2920
- const file = shared().resolveImagePath(src.src, sourceDir);
2921
- slide.addImage({ path: file, ...croppedTo(file, box), altText: src.caption || path.basename(file) });
2922
- }
2923
-
2924
- /**
2925
- * A picture that fills a box by cropping, never by stretching: the cover sizing reads the picture's
2926
- * own proportions from w and h and crops it to the box (without them it is stretched to the box).
2927
- */
2928
- function croppedTo(file, box) {
2929
- const size = shared().readImageSize(file);
2930
- const ratio = size && size.width && size.height ? size.height / size.width : box.h / box.w;
2931
- return { x: IN(box.x), y: IN(box.y), w: IN(box.w), h: IN(box.w * ratio), sizing: { type: "cover", w: IN(box.w), h: IN(box.h) } };
2932
- }
2933
-
2934
- /** The field behind the title zone and what stands on it, from `top` down to 6 pt under the title's foot. */
2935
- function titleField(slide, S, top) {
2936
- const T = SG.zones(S.grid.canvas).cover.title;
2937
- packRect(slide, S, { x: 0, y: top, w: S.grid.W, h: T.y + T.h + 6 - top }, { fill: "field" });
2938
- }
2939
-
2940
- /**
2941
- * A type-led cover drawn with the pack's display device. Every device leaves the words where
2942
- * coverWords puts them and paints only around them: the field over the whole page (drench), a field
2943
- * plate from over the title to the page foot (plate), a journal page between rules (rules), the
2944
- * composition in the side zone (geometry), or the plain page.
2945
- */
2946
- const TYPE_COVERS = {
2947
- drench(slide, spec, S, meta) {
2948
- packRect(slide, S, { x: 0, y: 0, w: S.grid.W, h: S.grid.H }, { fill: "field" });
2949
- coverWords(slide, spec, S, meta, { ink: "on-field", soft: "on-field", start: S.pack.hero ? S.sizes.hero : S.sizes.cover });
2950
- },
2951
- plate(slide, spec, S, meta) {
2952
- // The plate runs from over the title to the page foot; the meta line stays on the ground above it.
2953
- const top = SG.zones(S.grid.canvas).cover.title.y - 24;
2954
- packRect(slide, S, { x: 0, y: top, w: S.grid.W, h: S.grid.H - top }, { fill: "field" });
2955
- coverWords(slide, spec, S, meta, { ink: "on-field", soft: "on-field", meta: "ink-muted" });
2956
- },
2957
- rules(slide, spec, S, meta) {
2958
- const Z = SG.zones(S.grid.canvas).cover;
2959
- packRect(slide, S, { x: Z.strip.x, y: Z.title.y - 18, w: Z.strip.w, h: 2 }, { fill: "ink" });
2960
- packRect(slide, S, { x: Z.strip.x, y: Z.strip.y - 9, w: Z.strip.w, h: 0.75 }, { fill: "line" });
2961
- coverWords(slide, spec, S, meta);
2962
- },
2963
- geometry(slide, spec, S, meta) {
2964
- geometry(slide, S, SG.zones(S.grid.canvas).cover.side);
2965
- coverWords(slide, spec, S, meta);
2966
- },
2967
- plain(slide, spec, S, meta) {
2968
- coverWords(slide, spec, S, meta);
2969
- },
2970
- };
2971
-
2972
- const COVERS = {
2973
- "cover-typographic"(slide, spec, S, meta) {
2974
- const device = (S.pack.display || {}).cover || "plain";
2975
- const facts = spec.cover || {};
2976
- if (device === "rail") return COVERS["cover-rail"](slide, spec, S, meta);
2977
- if (device === "band") return COVERS["cover-band"](slide, spec, S, meta);
2978
- if (device === "figures" && (facts.figures || []).length >= 2) return COVERS["cover-figures"](slide, spec, S, meta);
2979
- if (device === "numeral" && facts.numeral) return COVERS["cover-numeral"](slide, spec, S, meta);
2980
- return (TYPE_COVERS[device] || TYPE_COVERS.plain)(slide, spec, S, meta);
2981
- },
2982
- "cover-split-field"(slide, spec, S, meta) {
2983
- const side = SG.zones(S.grid.canvas).cover.side;
2984
- packRect(slide, S, side, { fill: "field" });
2985
- if (spec.cover.numeral) {
2986
- const s = S.grid.span(side.a, side.b);
2987
- packText(slide, S, spec.cover.numeral, { ...s, y: 384, h: S.sizes.title * 1.15 }, { face: "numeral", size: S.sizes.title, colour: S.colour("on-field"), lineSpacing: 1.15 });
2988
- }
2989
- coverWords(slide, spec, S, meta);
2990
- },
2991
- "cover-split-image"(slide, spec, S, meta) {
2992
- coverImage(slide, SG.zones(S.grid.canvas).cover.side, spec.cover.image, spec.sourceDir);
2993
- coverWords(slide, spec, S, meta);
2994
- },
2995
- "cover-full-image"(slide, spec, S, meta) {
2996
- const g = S.grid;
2997
- coverImage(slide, { x: 0, y: 0, w: g.W, h: g.H }, spec.cover.image, spec.sourceDir);
2998
- // A translucent field panel under the words' columns, the full page height; the picture keeps the side zone.
2999
- const side = SG.zones(g.canvas).cover.side;
3000
- packRect(slide, S, { x: 0, y: 0, w: side.x, h: g.H }, { fill: "field", alpha: 12 });
3001
- coverWords(slide, spec, S, meta, { ink: "on-field", soft: "on-field" });
3002
- },
3003
- "cover-band"(slide, spec, S, meta) {
3004
- // The header band deepened behind the title; the subtitle and the deck's parts sit on the ground under it.
3005
- titleField(slide, S, 0);
3006
- const parts = stripParts(spec.cover || {});
3007
- if (parts.length) coverStrip(slide, S, parts);
3008
- coverWords(slide, spec, S, meta, { ink: "on-field", meta: "on-field" });
3009
- },
3010
- "cover-numeral"(slide, spec, S, meta) {
3011
- // A number is never the display element: title size at most. It stands in the
3012
- // side zone level with the title zone's top.
3013
- const Z = SG.zones(S.grid.canvas).cover;
3014
- const s = S.grid.span(Z.side.a, Z.side.b);
3015
- packText(slide, S, spec.cover.numeral, { ...s, y: Z.title.y, h: S.sizes.title * 1.15 }, { face: "numeral", size: S.sizes.title, colour: S.colour("accent"), align: "right", lineSpacing: 1.15 });
3016
- coverWords(slide, spec, S, meta);
3017
- },
3018
- "cover-index"(slide, spec, S, meta) {
3019
- coverStrip(slide, S, stripParts({ index: spec.cover.index }));
3020
- coverWords(slide, spec, S, meta);
3021
- },
3022
- "cover-figures"(slide, spec, S, meta) {
3023
- coverStrip(slide, S, stripParts({ figures: spec.cover.figures }));
3024
- coverWords(slide, spec, S, meta);
3025
- },
3026
- "cover-rail"(slide, spec, S, meta) {
3027
- // The rail is the left margin in the field, the page's height; the words keep their zones.
3028
- packRect(slide, S, { x: 0, y: 0, w: 12, h: S.grid.H }, { fill: "field" });
3029
- coverWords(slide, spec, S, meta);
3030
- },
3031
- };
3032
-
3033
- /**
3034
- * Section slides use the display zones (slide-grid), the same in every tonality: the part number in
3035
- * the header zone, the part title centred in the title zone, and what the part opens with (its slide
3036
- * titles, or their first lines) in the support zone. A part number shows only when the deck says how
3037
- * many parts there are; without one the title takes the cover step (the hero step in a hero tonality).
3038
- * A variant paints only the device around the words.
3039
- */
3040
- const SECTIONS = {
3041
- "section-field"(slide, spec, S) {
3042
- const g = S.grid;
3043
- packRect(slide, S, { x: 0, y: 0, w: g.W, h: g.H }, { fill: "field" });
3044
- sectionWords(slide, spec, S, { onField: true });
3045
- },
3046
- "section-numeral"(slide, spec, S) {
3047
- // With the agenda known, the numeral's page is the index page: the title is never alone on it.
3048
- if (spec.parts && ((spec.cover || {}).index || []).length >= 2) { sectionIndex(slide, spec, S); return; }
3049
- sectionWords(slide, spec, S);
3050
- },
3051
- "section-rule"(slide, spec, S) {
3052
- if (showsIndex(spec, S)) { sectionIndex(slide, spec, S); return; }
3053
- const Z = SG.zones(S.grid.canvas).display;
3054
- packRect(slide, S, { ...S.grid.span(1, 12), y: Z.support.y - 12, h: 0.75 }, { fill: "line" });
3055
- sectionWords(slide, spec, S);
3056
- },
3057
- "section-band"(slide, spec, S) {
3058
- // The header band deepened to hold the header zone. With the deck's part index the band carries that
3059
- // index (this part marked) in place of the part number.
3060
- const g = S.grid;
3061
- const Z = SG.zones(g.canvas).display;
3062
- packRect(slide, S, { x: 0, y: 0, w: g.W, h: Z.header.y + Z.header.h + 6 }, { fill: "field" });
3063
- const index = showsIndex(spec, S);
3064
- if (index) partIndex(slide, S, spec, Z.header, true);
3065
- sectionWords(slide, spec, S, { headerOnField: true, numeral: !index });
3066
- },
3067
- "section-rail"(slide, spec, S) {
3068
- packRect(slide, S, { x: 0, y: 0, w: 12, h: S.grid.H }, { fill: "field" });
3069
- sectionWords(slide, spec, S);
3070
- },
3071
- "section-image"(slide, spec, S) {
3072
- // A translucent field panel under the words' columns, the page's height; the picture keeps the side zone.
3073
- const g = S.grid;
3074
- coverImage(slide, { x: 0, y: 0, w: g.W, h: g.H }, spec.cover.image, spec.sourceDir);
3075
- packRect(slide, S, { x: 0, y: 0, w: SG.zones(g.canvas).display.side.x, h: g.H }, { fill: "field", alpha: 12 });
3076
- sectionWords(slide, spec, S, { onField: true });
3077
- },
3078
- };
3079
-
3080
- function sectionWords(slide, spec, S, o = {}) {
3081
- const Z = SG.zones(S.grid.canvas).display;
3082
- const ink = S.colour(o.onField ? "on-field" : "ink");
3083
- const soft = S.colour(o.onField ? "on-field" : "ink-muted");
3084
- if (spec.parts && o.numeral !== false) partNumeral(slide, S, spec, Z.header, S.sizes.title, o.onField || o.headerOnField ? "on-field" : "accent");
3085
- // A numbered part sets its title at the display step; an unnumbered one at the cover step, down to display to fit.
3086
- const steps = spec.parts ? [S.sizes.display] : [...new Set([S.pack.hero ? S.sizes.hero : S.sizes.cover, S.sizes.cover, S.sizes.display])].sort((a, b) => b - a);
3087
- const fits = (z) => S.lines(plainText(spec.title), Z.title.w, z, "display") * z * 1.1 <= Z.title.h;
3088
- const size = steps.find(fits) || S.sizes.display;
3089
- sectionSupport(slide, spec, S, Z.support, ink, soft);
3090
- packText(slide, S, spec.title, Z.title, { face: "display", size, colour: ink, lineSpacing: 1.1, title: true, balance: true, valign: "middle", name: "title@section" });
3091
- }
3092
-
3093
- /**
3094
- * What an unnumbered section opens with, in the support zone: one row per opened slide (its title, then
3095
- * up to two of its first lines) when the slides carry body lines, else their titles one to a line. Lines
3096
- * and then rows drop until the preview fits the zone.
3097
- */
3098
- function sectionSupport(slide, spec, S, Z, ink, soft) {
3099
- const head = S.sizes.lead;
3100
- const body = S.sizes.body;
3101
- const digest = (spec.digest || []).filter((d) => d.lines.length);
3102
- if (!digest.length) {
3103
- const text = (spec.contents || []).join("\n");
3104
- if (text) packText(slide, S, text, Z, { size: head, colour: soft, lineSpacing: 1.4 });
3105
- return;
3106
- }
3107
- // About 70 characters of body text at most: the widest column span inside the zone under that.
3108
- const korean = G.isKorean(digest.map((e) => e.title + e.lines.join("")).join(""));
3109
- const cap = 70 * body * (korean ? 0.94 : 0.5);
3110
- let k = Z.b;
3111
- while (k > Z.a && S.grid.span(Z.a, k).w > cap) k--;
3112
- const span = S.grid.span(Z.a, k);
3113
- const gap = 12;
3114
- const build = (entries, per) => entries.map((e) => {
3115
- const text = e.lines.slice(0, per).join("\n");
3116
- const headH = G.textHeight(e.title, span.w, head, 1.3);
3117
- const textH = text ? G.textHeight(plainText(text), span.w, body) : 0;
3118
- return { ...e, text, headH, textH, h: headH + (text ? 4 + textH : 0) };
3119
- });
3120
- const height = (rows) => rows.reduce((a, r) => a + r.h, 0) + gap * (rows.length - 1);
3121
- let rows = null;
3122
- for (let n = digest.length; n >= 1 && !rows; n--) {
3123
- for (let per = 2; per >= 1; per--) {
3124
- const tried = build(digest.slice(0, n), per);
3125
- if (height(tried) <= Z.h) { rows = tried; break; }
3126
- }
3127
- }
3128
- if (!rows) rows = build(digest.slice(0, 1), 0);
3129
- let at = Z.y;
3130
- for (const r of rows) {
3131
- packText(slide, S, r.title, { ...span, y: at, h: r.headH }, { size: head, bold: true, colour: ink, lineSpacing: 1.3 });
3132
- if (r.text) packText(slide, S, r.text, { ...span, y: at + r.headH + 4, h: r.textH }, { size: body, colour: soft });
3133
- at += r.h + gap;
3134
- }
3135
- }
3136
-
3137
- /**
3138
- * A section in a deck with an agenda, set as its index page: the part number in the header zone over the
3139
- * part title, and the agenda down the side zone, one part a line from the title zone's top, a hairline
3140
- * above each and a heavier accent rule above this part, which is set in the accent.
3141
- */
3142
- function sectionIndex(slide, spec, S) {
3143
- const Z = SG.zones(S.grid.canvas).display;
3144
- const right = S.grid.span(Z.side.a, Z.side.b);
3145
- const names = spec.cover.index;
3146
- const lead = S.sizes.lead;
3147
- const rowH = lead * 1.4;
3148
- const label = (name, i) => `${String(i + 1).padStart(2, "0")} ${name}`;
3149
- const heights = names.map((name, i) => G.textHeight(label(name, i), right.w, lead, 1.4));
3150
- const sum = heights.reduce((a, h) => a + h, 0);
3151
- const floor = Z.support.y + Z.support.h;
3152
- const after = Math.max(12, Math.min(60 - rowH, (floor - Z.title.y - sum) / Math.max(1, names.length - 1)));
3153
- const listH = sum + (names.length - 1) * after;
3154
- const listY = Z.title.y + 12;
3155
- const quiet = S.colour("ink-muted");
3156
- const runs = [];
3157
- let ruleY = listY - 12;
3158
- names.forEach((name, i) => {
3159
- const current = i + 1 === spec.part;
3160
- const colour = current ? S.colour("accent") : quiet;
3161
- packRect(slide, S, { x: right.x, y: ruleY - (current ? 1 : 0), w: right.w, h: current ? 2 : 0.75 }, { fill: current ? "accent" : "line" });
3162
- ruleY += heights[i] + after;
3163
- runs.push({ text: `${String(i + 1).padStart(2, "0")} `, options: { fontFace: S.faces.body.font, fontSize: lead, color: colour, bold: current,
3164
- ...(i ? { paraSpaceBefore: +after.toFixed(1) } : {}) } });
3165
- runs.push({ text: name, options: { fontFace: (current ? S.faces.title : S.faces.body).font, fontSize: lead, color: colour,
3166
- bold: current || Boolean(S.faces.body.bold), breakLine: i < names.length - 1 } });
3167
- });
3168
- // The gap goes before each part after the first, so the frame ends on the last line.
3169
- slide.addText(runs, { x: IN(right.x), y: IN(listY), w: IN(right.w), h: IN(listH), align: "left", valign: "top", margin: [0, 0, 0, 0],
3170
- lineSpacing: +rowH.toFixed(1) });
3171
- sectionWords(slide, spec, S);
3172
- }
3173
-
3174
- /** The part number as the agenda writes it ("03"), followed by the part count when it is known, standing on the box's foot. */
3175
- function partNumeral(slide, S, spec, box, size, colour) {
3176
- const face = S.faces.numeral;
3177
- const base = { fontFace: face.font, bold: Boolean(face.bold), color: S.colour(colour) };
3178
- const pad = (n) => (spec.parts ? String(n).padStart(2, "0") : String(n));
3179
- const tracking = S.tracking("numeral", size);
3180
- const runs = [{ text: pad(spec.part), options: { ...base, fontSize: size, ...(tracking ? { charSpacing: tracking } : {}) } }];
3181
- // The count is a step below the number, so the number stays the display element.
3182
- if (spec.parts) runs.push({ text: ` / ${pad(spec.parts)}`, options: { ...base, fontSize: S.sizes.title, color: S.colour(colour === "on-field" ? "on-field" : "ink-muted") } });
3183
- slide.addText(runs, { x: IN(box.x), y: IN(box.y), w: IN(box.w), h: IN(box.h), align: "left", valign: "bottom", margin: [0, 0, 0, 0],
3184
- lineSpacing: +(size * 1.15).toFixed(1), objectName: "header@section" });
3185
- }
3186
-
3187
- function showsIndex(spec, S) {
3188
- return Boolean((S.pack.display || {}).index && spec.parts && ((spec.cover || {}).index || []).length >= 2);
3189
- }
3190
-
3191
- /** The deck's parts in one line, numbered as in the agenda; this section's part bold in the accent, on the box's foot. */
3192
- function partIndex(slide, S, spec, box, onField = false) {
3193
- const size = S.sizes.body;
3194
- const quiet = onField ? mix(S.P["on-field"], S.P.field, 0.3) : S.P["ink-muted"];
3195
- const runs = [];
3196
- spec.cover.index.forEach((name, i) => {
3197
- const current = i + 1 === spec.part;
3198
- if (i) runs.push({ text: " ", options: { fontFace: S.faces.body.font, fontSize: size } });
3199
- runs.push({ text: `${String(i + 1).padStart(2, "0")} ${name}`, options: {
3200
- fontFace: (current ? S.faces.title : S.faces.body).font, fontSize: size, bold: current || Boolean(S.faces.body.bold),
3201
- color: current ? S.colour(onField ? "on-field" : "accent") : shared().hex(quiet),
3202
- } });
3203
- });
3204
- slide.addText(runs, { x: IN(box.x), y: IN(box.y), w: IN(box.w), h: IN(box.h), align: "left", valign: "bottom", margin: [0, 0, 0, 0],
3205
- lineSpacing: +(size * 1.4).toFixed(1), objectName: "header@section" });
3206
- }
3207
-
3208
- /** The sample-data tag in the footer zone, on the grid's left edge, in the pack's colours. */
3209
- /**
3210
- * The grid shown on purpose: a tick and a two-digit number over each column start in the top margin,
3211
- * and the slide's place in the deck at the right, all in the label face and the muted ink.
3212
- */
3213
- function gridMarks(slide, S, n, total) {
3214
- const g = S.grid;
3215
- const size = S.sizes.source;
3216
- const y = 12;
3217
- for (let a = 1; a <= 12; a++) {
3218
- const x = g.colX(a);
3219
- packRect(slide, S, { x, y, w: 0.75, h: size * 1.2 }, { fill: "line", name: "grid-mark" });
3220
- if (a < 11) packText(slide, S, String(a).padStart(2, "0"), { x: x + 4, y, w: g.col - 4, h: size * 1.2 }, { face: "label", size, colour: S.colour("ink-muted"), lineSpacing: 1.2, name: "grid-mark" });
3221
- }
3222
- const index = `[${String(n).padStart(2, "0")}/${String(total).padStart(2, "0")}]`;
3223
- const right = g.span(11, 12);
3224
- packText(slide, S, index, { ...right, y, h: size * 1.2 }, { face: "label", size, colour: S.colour("ink"), align: "right", lineSpacing: 1.2, name: "grid-mark index" });
3225
- }
3226
-
3227
- /**
3228
- * Elementary geometry in the primaries, in a region of the page that holds no text: a square in the
3229
- * surface colour, a circle in the accent, a bar in the ink and a triangle in the field, one per cell
3230
- * of a two-by-two grid, so no shape overlaps another or the text.
3231
- */
3232
- function geometry(slide, S, region) {
3233
- const cw = region.w / 2;
3234
- const ch = region.h / 2;
3235
- const d = Math.min(cw, ch);
3236
- const cell = (i, j) => ({ x: region.x + i * cw, y: region.y + j * ch });
3237
- const shape = (kind, box, fill) => slide.addShape(kind, { x: IN(box.x), y: IN(box.y), w: IN(box.w), h: IN(box.h), fill: { color: S.colour(fill) }, line: { type: "none" } });
3238
- const a = cell(0, 0);
3239
- shape("rect", { x: a.x, y: a.y, w: cw, h: ch }, "accent-tint");
3240
- const b = cell(1, 0);
3241
- shape("ellipse", { x: b.x + (cw - d) / 2, y: b.y + (ch - d) / 2, w: d, h: d }, "accent");
3242
- const c = cell(0, 1);
3243
- shape("rect", { x: c.x + cw * 0.38, y: c.y, w: cw * 0.24, h: ch }, "ink");
3244
- const e = cell(1, 1);
3245
- shape("triangle", { x: e.x, y: e.y + (ch - d), w: cw, h: d }, "field");
3246
- }
3247
-
3248
- function packNotice(slide, S, text) {
3249
- const label = plainText(text);
3250
- const size = S.sizes.source;
3251
- // A tenth of slack over the measured width keeps a Latin notice on one line in every renderer.
3252
- const w = Math.min(S.grid.span(1, 8).w, G.textEms(label) * size * 1.1 + 24);
3253
- const box = { x: S.grid.margin, y: G.ZONE.footer, w, h: G.ZONE.footerH };
3254
- packRect(slide, S, box, { fill: "accent-tint", radius: S.pack.radius, name: "lit-notice tag" });
3255
- slide.addText(label, {
3256
- objectName: "lit-notice text",
3257
- x: IN(box.x + 12), y: IN(box.y), w: IN(w - 24), h: IN(box.h),
3258
- fontFace: S.faces.label.font, fontSize: size, bold: true, color: S.colour("accent-deep"),
3259
- align: "left", valign: "middle", margin: [0, 0, 0, 0], fit: "shrink",
3260
- });
3261
- }
3262
-
3263
- async function renderPack(resolved, templateObj, outputPath) {
3264
- const A = shared();
3265
- const pack = templateObj.pack;
3266
- const S = packStyle(pack);
3267
- A.usePackFonts(S.faces.title.font, S.faces.body.font, pack.tokens);
3268
-
3269
- const PptxGenJS = require("pptxgenjs");
3270
- const pptx = new PptxGenJS();
3271
- pptx.defineLayout({ name: "LIT_PACK", width: IN(S.grid.W), height: IN(S.grid.H) });
3272
- pptx.layout = "LIT_PACK";
3273
- pptx.title = (resolved.deck && resolved.deck.title) || "Presentation";
3274
- pptx.subject = `lit-pptx tonality=${pack.id} density=${pack.dials.density} grid=${S.grid.name} variance=${pack.dials.variance}`;
3275
- const meta = (resolved.deck && resolved.deck.metadata) || {};
3276
- const notice = typeof meta.notice === "string" && meta.notice.trim() ? meta.notice.trim() : null;
3277
- const log = [...(resolved.notes || []).map((n) => `note: ${n}`)];
3278
- const ctx = { sourceDir: resolved.sourceDir, log };
3279
- const placementCtx = { rich: false, P: {}, fontRoles: {}, pageH: IN(S.grid.H), sourceDir: resolved.sourceDir, layout: "content" };
3280
- // No title treatment chosen for fill may cover more than about a third of the content slides.
3281
- const contentSlides = (resolved.slides || []).filter((s) => s.kind === "content").length;
3282
- const deck = { used: new Set(), max: pack.dials.varianceMax, count: {}, prev: null, limit: Math.max(3, Math.floor(contentSlides * 0.34)) };
3283
- const chosenBy = {};
3284
- const choices = new Map();
3285
- // One colour per series name across the deck: a series that recedes beside the
3286
- // highlighted one on a chart with several series keeps that colour when it stands alone on another chart.
3287
- S.seriesRole = new Map();
3288
- for (const spec of resolved.slides || []) {
3289
- for (const item of spec.items || []) {
3290
- const c = item.type === "kpi-table" && item.content;
3291
- if (!c || !c.chart || (c.headers || []).length < 3) continue;
3292
- const names = c.headers.slice(1);
3293
- const primary = primarySeries(names);
3294
- names.forEach((n, i) => { const key = seriesKey(n); if (!S.seriesRole.has(key) || i === primary) S.seriesRole.set(key, i === primary ? "primary" : "other"); });
3295
- }
3296
- }
3297
- // A picture's own proportions, so the layout reads it as drawn (contained in its box).
3298
- for (const spec of resolved.slides || []) {
3299
- for (const item of spec.items || []) {
3300
- if (item.type !== "image" || !item.content || !item.content.src) continue;
3301
- try { item.imageSize = A.readImageSize(A.resolveImagePath(item.content.src, resolved.sourceDir)); } catch { /* drawn as its box */ }
3302
- }
3303
- }
3304
- for (const spec of resolved.slides || []) {
3305
- if (spec.kind === "cover" || spec.kind === "section") continue;
3306
- const chosen = chooseTreatment(spec, S, deck);
3307
- deck.used.add(chosen.t);
3308
- deck.count[chosen.t] = (deck.count[chosen.t] || 0) + 1;
3309
- deck.prev = chosen.t;
3310
- choices.set(spec, chosen);
3311
- }
3312
- for (const line of spreadTreatments(choices, S, pack, (resolved.slides || []).length)) log.push(line);
3313
-
3314
- for (const spec of resolved.slides || []) {
3315
- const slide = pptx.addSlide();
3316
- slide.background = { color: S.colour("ground") };
3317
- const stamped = A.stampFamily(slide, spec.family);
3318
- A.renderPlacements(slide, spec.placements || [], "under", placementCtx);
3319
- const withDir = { ...spec, sourceDir: resolved.sourceDir };
3320
- if (spec.kind === "cover") COVERS[spec.variant](slide, withDir, S, meta);
3321
- else if (spec.kind === "section") SECTIONS[spec.variant](slide, withDir, S);
3322
- else {
3323
- const chosen = choices.get(spec);
3324
- chosenBy[spec.index] = chosen.t;
3325
- renderContent(slide, spec, S, ctx, chosen);
3326
- }
3327
- A.renderPlacements(slide, spec.placements || [], "content", placementCtx);
3328
- A.renderPlacements(slide, spec.placements || [], "over", placementCtx);
3329
- if (!stamped()) {
3330
- // Nothing unnamed was drawn (a statement alone): an empty marker carries the family.
3331
- slide.addShape("rect", { x: IN(S.grid.margin), y: IN(G.ZONE.top), w: 0, h: 0, fill: { type: "none" }, line: { type: "none" }, objectName: `family@${spec.family}` });
3332
- }
3333
- // The marks read on the ground; a statement page may be drenched in the field, so it goes without.
3334
- if (spec.kind === "content" && chosenBy[spec.index] !== "statement" && S.deco.has("grid-marks")) gridMarks(slide, S, spec.index + 1, (resolved.slides || []).length);
3335
- if (notice) packNotice(slide, S, notice);
3336
- }
3337
- for (const line of log) console.log(line);
3338
- console.log(`Treatments: ${Object.entries(chosenBy).map(([i, t]) => `${Number(i) + 1}:${t}`).join(" ")}`);
3339
- await writeWithEastAsianFaces(pptx, S.faces.body.font, outputPath, Object.values(S.faces).filter((f) => f.ea), Boolean(S.pack.shadow));
3340
- return outputPath;
3341
- }
3342
-
3343
- /**
3344
- * Write the deck with the pack's body face also named for East Asian text in charts and the theme.
3345
- * Chart text otherwise carries only a Latin face, and a renderer sets Hangul axis labels in
3346
- * whatever system font it finds. Korean runs are tagged ko-KR on the way (see writeTagged).
3347
- */
3348
- async function writeWithEastAsianFaces(pptx, face, outputPath, latinOnly = [], hardShadows = false) {
3349
- await shared().writeTagged(pptx, outputPath, (name, xml) => {
3350
- if (/^ppt\/(charts\/chart\d+|theme\/theme\d+)\.xml$/u.test(name)) {
3351
- xml = xml.replace(/<a:ea typeface=""\/>/gu, `<a:ea typeface="${face}"/>`).replace(/(<a:latin typeface="([^"]*)"\/>)(?!<a:ea)/gu, `$1<a:ea typeface="$2"/>`);
3352
- }
3353
- // A Latin-only face names its East Asian face for the Hangul in its runs.
3354
- if (/^ppt\/(slides\/slide\d+|charts\/chart\d+)\.xml$/u.test(name)) {
3355
- for (const f of latinOnly) xml = xml.split(`<a:ea typeface="${f.font}"`).join(`<a:ea typeface="${f.ea}"`);
3356
- }
3357
- // pptxgenjs reads a blur of 0 as "unset" and writes its default; a pack's shadow is drawn with none.
3358
- if (hardShadows && /^ppt\/slides\/slide\d+\.xml$/u.test(name)) {
3359
- xml = xml.replace(/(<a:outerShdw\b[^>]*?\bblurRad=")\d+"/gu, '$10"');
3360
- }
3361
- return xml;
3362
- });
3363
- }
3364
-
3365
- module.exports = { renderPack, PLANS, COVERS, SECTIONS };