@resumekit/react 0.0.0-stage → 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (666) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +74 -2
  3. package/dist/PagedSheet.d.ts +63 -0
  4. package/dist/PagedSheet.d.ts.map +1 -0
  5. package/dist/PagedSheet.js +584 -0
  6. package/dist/TemplateDocument.d.ts +33 -0
  7. package/dist/TemplateDocument.d.ts.map +1 -0
  8. package/dist/TemplateDocument.js +33 -0
  9. package/dist/autosave-context.d.ts +37 -0
  10. package/dist/autosave-context.d.ts.map +1 -0
  11. package/dist/autosave-context.js +24 -0
  12. package/dist/collections/AuthoredItems.d.ts +9 -0
  13. package/dist/collections/AuthoredItems.d.ts.map +1 -0
  14. package/dist/collections/AuthoredItems.js +116 -0
  15. package/dist/collections/Collection.d.ts +48 -0
  16. package/dist/collections/Collection.d.ts.map +1 -0
  17. package/dist/collections/Collection.js +24 -0
  18. package/dist/collections/CollectionItems.d.ts +94 -0
  19. package/dist/collections/CollectionItems.d.ts.map +1 -0
  20. package/dist/collections/CollectionItems.js +91 -0
  21. package/dist/collections/EntryOverlay.d.ts +38 -0
  22. package/dist/collections/EntryOverlay.d.ts.map +1 -0
  23. package/dist/collections/EntryOverlay.js +51 -0
  24. package/dist/collections/SortableItems.d.ts +52 -0
  25. package/dist/collections/SortableItems.d.ts.map +1 -0
  26. package/dist/collections/SortableItems.js +80 -0
  27. package/dist/collections/authoring-context.d.ts +69 -0
  28. package/dist/collections/authoring-context.d.ts.map +1 -0
  29. package/dist/collections/authoring-context.js +36 -0
  30. package/dist/collections/collection.css +462 -0
  31. package/dist/collections/entry-text.d.ts +23 -0
  32. package/dist/collections/entry-text.d.ts.map +1 -0
  33. package/dist/collections/entry-text.js +35 -0
  34. package/dist/collections/icons.d.ts +53 -0
  35. package/dist/collections/icons.d.ts.map +1 -0
  36. package/dist/collections/icons.js +56 -0
  37. package/dist/collections/library/LibraryAction.d.ts +24 -0
  38. package/dist/collections/library/LibraryAction.d.ts.map +1 -0
  39. package/dist/collections/library/LibraryAction.js +122 -0
  40. package/dist/collections/library/LibraryPicker.d.ts +42 -0
  41. package/dist/collections/library/LibraryPicker.d.ts.map +1 -0
  42. package/dist/collections/library/LibraryPicker.js +94 -0
  43. package/dist/collections/library/library.css +435 -0
  44. package/dist/collections/overlay-context.d.ts +34 -0
  45. package/dist/collections/overlay-context.d.ts.map +1 -0
  46. package/dist/collections/overlay-context.js +13 -0
  47. package/dist/collections/preload.d.ts +19 -0
  48. package/dist/collections/preload.d.ts.map +1 -0
  49. package/dist/collections/preload.js +23 -0
  50. package/dist/collections/selection-context.d.ts +25 -0
  51. package/dist/collections/selection-context.d.ts.map +1 -0
  52. package/dist/collections/selection-context.js +49 -0
  53. package/dist/collections/useCollection.d.ts +58 -0
  54. package/dist/collections/useCollection.d.ts.map +1 -0
  55. package/dist/collections/useCollection.js +90 -0
  56. package/dist/collections/useCustomEntries.d.ts +18 -0
  57. package/dist/collections/useCustomEntries.d.ts.map +1 -0
  58. package/dist/collections/useCustomEntries.js +56 -0
  59. package/dist/collections/useSectionCollection.d.ts +48 -0
  60. package/dist/collections/useSectionCollection.d.ts.map +1 -0
  61. package/dist/collections/useSectionCollection.js +169 -0
  62. package/dist/document.css +185 -0
  63. package/dist/export-bundle/bundle.css +2 -0
  64. package/dist/export-bundle/bundle.js +67 -0
  65. package/dist/fields/date-issues-context.d.ts +20 -0
  66. package/dist/fields/date-issues-context.d.ts.map +1 -0
  67. package/dist/fields/date-issues-context.js +68 -0
  68. package/dist/fields/field-registry.d.ts +163 -0
  69. package/dist/fields/field-registry.d.ts.map +1 -0
  70. package/dist/fields/field-registry.js +175 -0
  71. package/dist/fonts/README.md +207 -0
  72. package/dist/fonts/arimo-400.woff2 +0 -0
  73. package/dist/fonts/arimo-400i.woff2 +0 -0
  74. package/dist/fonts/arimo-700.woff2 +0 -0
  75. package/dist/fonts/arimo-700i.woff2 +0 -0
  76. package/dist/fonts/bitter-400.woff2 +0 -0
  77. package/dist/fonts/bitter-400i.woff2 +0 -0
  78. package/dist/fonts/bitter-700.woff2 +0 -0
  79. package/dist/fonts/bitter-700i.woff2 +0 -0
  80. package/dist/fonts/cabin-700.woff2 +0 -0
  81. package/dist/fonts/carlito-400.woff2 +0 -0
  82. package/dist/fonts/carlito-400i.woff2 +0 -0
  83. package/dist/fonts/carlito-700.woff2 +0 -0
  84. package/dist/fonts/carlito-700i.woff2 +0 -0
  85. package/dist/fonts/clearsans-400.woff2 +0 -0
  86. package/dist/fonts/clearsans-400i.woff2 +0 -0
  87. package/dist/fonts/cochineal-400.woff2 +0 -0
  88. package/dist/fonts/cochineal-400i.woff2 +0 -0
  89. package/dist/fonts/cochineal-700.woff2 +0 -0
  90. package/dist/fonts/ebgaramond-400.woff2 +0 -0
  91. package/dist/fonts/ebgaramond-400i.woff2 +0 -0
  92. package/dist/fonts/ebgaramond-700.woff2 +0 -0
  93. package/dist/fonts/ebgaramond-700i.woff2 +0 -0
  94. package/dist/fonts/fonts.css +622 -0
  95. package/dist/fonts/gelasio-400.woff2 +0 -0
  96. package/dist/fonts/gelasio-400i.woff2 +0 -0
  97. package/dist/fonts/gelasio-700.woff2 +0 -0
  98. package/dist/fonts/gelasio-700i.woff2 +0 -0
  99. package/dist/fonts/heros-400.woff2 +0 -0
  100. package/dist/fonts/heros-400i.woff2 +0 -0
  101. package/dist/fonts/heros-700.woff2 +0 -0
  102. package/dist/fonts/heros-700i.woff2 +0 -0
  103. package/dist/fonts/inconsolata-400.woff2 +0 -0
  104. package/dist/fonts/lato-100.woff2 +0 -0
  105. package/dist/fonts/lato-300.woff2 +0 -0
  106. package/dist/fonts/lato-300i.woff2 +0 -0
  107. package/dist/fonts/lato-400.woff2 +0 -0
  108. package/dist/fonts/lato-400i.woff2 +0 -0
  109. package/dist/fonts/lato-700.woff2 +0 -0
  110. package/dist/fonts/lato-700i.woff2 +0 -0
  111. package/dist/fonts/licenses/arimo-OFL.txt +93 -0
  112. package/dist/fonts/licenses/bitter-OFL.txt +94 -0
  113. package/dist/fonts/licenses/cabin-OFL.txt +93 -0
  114. package/dist/fonts/licenses/carlito-OFL.txt +94 -0
  115. package/dist/fonts/licenses/clearsans-APACHE-2.0.txt +205 -0
  116. package/dist/fonts/licenses/cochineal-OFL.txt +96 -0
  117. package/dist/fonts/licenses/ebgaramond-OFL.txt +93 -0
  118. package/dist/fonts/licenses/gelasio-OFL.txt +93 -0
  119. package/dist/fonts/licenses/heros-GUST-FONT-LICENSE.txt +30 -0
  120. package/dist/fonts/licenses/inconsolata-OFL.txt +93 -0
  121. package/dist/fonts/licenses/latinmodern-GUST-FONT-LICENSE.txt +35 -0
  122. package/dist/fonts/licenses/lato-OFL.txt +93 -0
  123. package/dist/fonts/licenses/ptserif-OFL.txt +93 -0
  124. package/dist/fonts/licenses/raleway-OFL.txt +93 -0
  125. package/dist/fonts/licenses/roboto-OFL.txt +93 -0
  126. package/dist/fonts/licenses/robotocondensed-OFL.txt +93 -0
  127. package/dist/fonts/licenses/robotoslab-APACHE-2.0.txt +205 -0
  128. package/dist/fonts/licenses/sourcesans3-OFL.txt +93 -0
  129. package/dist/fonts/licenses/tinos-OFL.txt +93 -0
  130. package/dist/fonts/lmmono-400.woff2 +0 -0
  131. package/dist/fonts/lmroman-400.woff2 +0 -0
  132. package/dist/fonts/lmroman-400i.woff2 +0 -0
  133. package/dist/fonts/lmroman-700.woff2 +0 -0
  134. package/dist/fonts/lmroman-700i.woff2 +0 -0
  135. package/dist/fonts/lmromancaps-400.woff2 +0 -0
  136. package/dist/fonts/ptserif-400.woff2 +0 -0
  137. package/dist/fonts/ptserif-400i.woff2 +0 -0
  138. package/dist/fonts/ptserif-700.woff2 +0 -0
  139. package/dist/fonts/ptserif-700i.woff2 +0 -0
  140. package/dist/fonts/raleway-300.woff2 +0 -0
  141. package/dist/fonts/raleway-400.woff2 +0 -0
  142. package/dist/fonts/raleway-400i.woff2 +0 -0
  143. package/dist/fonts/raleway-500.woff2 +0 -0
  144. package/dist/fonts/raleway-700.woff2 +0 -0
  145. package/dist/fonts/roboto-100.woff2 +0 -0
  146. package/dist/fonts/roboto-300.woff2 +0 -0
  147. package/dist/fonts/roboto-300i.woff2 +0 -0
  148. package/dist/fonts/roboto-400.woff2 +0 -0
  149. package/dist/fonts/roboto-400i.woff2 +0 -0
  150. package/dist/fonts/roboto-700.woff2 +0 -0
  151. package/dist/fonts/robotocondensed-400.woff2 +0 -0
  152. package/dist/fonts/robotocondensed-400i.woff2 +0 -0
  153. package/dist/fonts/robotocondensed-700.woff2 +0 -0
  154. package/dist/fonts/robotocondensed-700i.woff2 +0 -0
  155. package/dist/fonts/robotoslab-700.woff2 +0 -0
  156. package/dist/fonts/sourcesans3-300.woff2 +0 -0
  157. package/dist/fonts/sourcesans3-300i.woff2 +0 -0
  158. package/dist/fonts/sourcesans3-400.woff2 +0 -0
  159. package/dist/fonts/sourcesans3-400i.woff2 +0 -0
  160. package/dist/fonts/sourcesans3-700.woff2 +0 -0
  161. package/dist/fonts/tinos-400.woff2 +0 -0
  162. package/dist/fonts/tinos-400i.woff2 +0 -0
  163. package/dist/fonts/tinos-700.woff2 +0 -0
  164. package/dist/fonts/tinos-700i.woff2 +0 -0
  165. package/dist/i18n/README.md +52 -0
  166. package/dist/i18n/catalog.d.ts +39 -0
  167. package/dist/i18n/catalog.d.ts.map +1 -0
  168. package/dist/i18n/catalog.js +43 -0
  169. package/dist/i18n/format.d.ts +14 -0
  170. package/dist/i18n/format.d.ts.map +1 -0
  171. package/dist/i18n/format.js +38 -0
  172. package/dist/i18n/index.d.ts +4 -0
  173. package/dist/i18n/index.d.ts.map +1 -0
  174. package/dist/i18n/index.js +3 -0
  175. package/dist/i18n/locale-context.d.ts +43 -0
  176. package/dist/i18n/locale-context.d.ts.map +1 -0
  177. package/dist/i18n/locale-context.js +74 -0
  178. package/dist/i18n/locales/en.json +337 -0
  179. package/dist/i18n/locales/es.json +337 -0
  180. package/dist/index.d.ts +101 -0
  181. package/dist/index.d.ts.map +1 -0
  182. package/dist/index.js +99 -0
  183. package/dist/kit/BulletSkillGroup.d.ts +20 -0
  184. package/dist/kit/BulletSkillGroup.d.ts.map +1 -0
  185. package/dist/kit/BulletSkillGroup.js +25 -0
  186. package/dist/kit/DescribedEntries.d.ts +41 -0
  187. package/dist/kit/DescribedEntries.d.ts.map +1 -0
  188. package/dist/kit/DescribedEntries.js +57 -0
  189. package/dist/kit/DocumentSection.d.ts +58 -0
  190. package/dist/kit/DocumentSection.d.ts.map +1 -0
  191. package/dist/kit/DocumentSection.js +38 -0
  192. package/dist/kit/GridSkillGroup.d.ts +12 -0
  193. package/dist/kit/GridSkillGroup.d.ts.map +1 -0
  194. package/dist/kit/GridSkillGroup.js +14 -0
  195. package/dist/kit/Heading.d.ts +11 -0
  196. package/dist/kit/Heading.d.ts.map +1 -0
  197. package/dist/kit/Heading.js +10 -0
  198. package/dist/kit/InitialsAvatar.d.ts +17 -0
  199. package/dist/kit/InitialsAvatar.d.ts.map +1 -0
  200. package/dist/kit/InitialsAvatar.js +18 -0
  201. package/dist/kit/InitialsChip.d.ts +16 -0
  202. package/dist/kit/InitialsChip.d.ts.map +1 -0
  203. package/dist/kit/InitialsChip.js +16 -0
  204. package/dist/kit/InlineSkillGroup.d.ts +22 -0
  205. package/dist/kit/InlineSkillGroup.d.ts.map +1 -0
  206. package/dist/kit/InlineSkillGroup.js +16 -0
  207. package/dist/kit/LabelledSkillGroup.d.ts +24 -0
  208. package/dist/kit/LabelledSkillGroup.d.ts.map +1 -0
  209. package/dist/kit/LabelledSkillGroup.js +20 -0
  210. package/dist/kit/LanguageList.d.ts +28 -0
  211. package/dist/kit/LanguageList.d.ts.map +1 -0
  212. package/dist/kit/LanguageList.js +56 -0
  213. package/dist/kit/Separator.d.ts +20 -0
  214. package/dist/kit/Separator.d.ts.map +1 -0
  215. package/dist/kit/Separator.js +21 -0
  216. package/dist/kit/TagSkillGroup.d.ts +8 -0
  217. package/dist/kit/TagSkillGroup.d.ts.map +1 -0
  218. package/dist/kit/TagSkillGroup.js +10 -0
  219. package/dist/kit/avatar.css +42 -0
  220. package/dist/kit/contact-icons.css +70 -0
  221. package/dist/kit/contact.d.ts +16 -0
  222. package/dist/kit/contact.d.ts.map +1 -0
  223. package/dist/kit/contact.js +18 -0
  224. package/dist/kit/described.css +114 -0
  225. package/dist/kit/documentStyle.d.ts +12 -0
  226. package/dist/kit/documentStyle.d.ts.map +1 -0
  227. package/dist/kit/documentStyle.js +24 -0
  228. package/dist/kit/heading.css +17 -0
  229. package/dist/kit/keywords.css +127 -0
  230. package/dist/kit/language.css +104 -0
  231. package/dist/kit/layout.css +16 -0
  232. package/dist/kit/monogram.d.ts +6 -0
  233. package/dist/kit/monogram.d.ts.map +1 -0
  234. package/dist/kit/monogram.js +12 -0
  235. package/dist/kit/panel.css +26 -0
  236. package/dist/kit/skill-grid.css +93 -0
  237. package/dist/kit/skill-tags.css +36 -0
  238. package/dist/kit/textShapes.d.ts +24 -0
  239. package/dist/kit/textShapes.d.ts.map +1 -0
  240. package/dist/kit/textShapes.js +32 -0
  241. package/dist/letter/LetterDocument.d.ts +13 -0
  242. package/dist/letter/LetterDocument.d.ts.map +1 -0
  243. package/dist/letter/LetterDocument.js +12 -0
  244. package/dist/letter/letter.css +75 -0
  245. package/dist/nodes/AuthoredBullets.d.ts +22 -0
  246. package/dist/nodes/AuthoredBullets.d.ts.map +1 -0
  247. package/dist/nodes/AuthoredBullets.js +101 -0
  248. package/dist/nodes/CustomSections.d.ts +42 -0
  249. package/dist/nodes/CustomSections.d.ts.map +1 -0
  250. package/dist/nodes/CustomSections.js +27 -0
  251. package/dist/nodes/EditableBulletList.d.ts +15 -0
  252. package/dist/nodes/EditableBulletList.d.ts.map +1 -0
  253. package/dist/nodes/EditableBulletList.js +98 -0
  254. package/dist/nodes/EditableInlineList.d.ts +27 -0
  255. package/dist/nodes/EditableInlineList.d.ts.map +1 -0
  256. package/dist/nodes/EditableInlineList.js +50 -0
  257. package/dist/nodes/EditableText.d.ts +79 -0
  258. package/dist/nodes/EditableText.d.ts.map +1 -0
  259. package/dist/nodes/EditableText.js +113 -0
  260. package/dist/nodes/LinkField.d.ts +103 -0
  261. package/dist/nodes/LinkField.d.ts.map +1 -0
  262. package/dist/nodes/LinkField.js +277 -0
  263. package/dist/nodes/PlainTextField.d.ts +38 -0
  264. package/dist/nodes/PlainTextField.d.ts.map +1 -0
  265. package/dist/nodes/PlainTextField.js +72 -0
  266. package/dist/nodes/formatting.d.ts +34 -0
  267. package/dist/nodes/formatting.d.ts.map +1 -0
  268. package/dist/nodes/formatting.js +24 -0
  269. package/dist/nodes/link-field.css +200 -0
  270. package/dist/nodes/locked.d.ts +38 -0
  271. package/dist/nodes/locked.d.ts.map +1 -0
  272. package/dist/nodes/locked.js +65 -0
  273. package/dist/nodes/template-node.css +720 -0
  274. package/dist/paged.css +265 -0
  275. package/dist/pagination.d.ts +93 -0
  276. package/dist/pagination.d.ts.map +1 -0
  277. package/dist/pagination.js +167 -0
  278. package/dist/picture-context.d.ts +6 -0
  279. package/dist/picture-context.d.ts.map +1 -0
  280. package/dist/picture-context.js +14 -0
  281. package/dist/presentation-context.d.ts +45 -0
  282. package/dist/presentation-context.d.ts.map +1 -0
  283. package/dist/presentation-context.js +44 -0
  284. package/dist/presented.d.ts +16 -0
  285. package/dist/presented.d.ts.map +1 -0
  286. package/dist/presented.js +22 -0
  287. package/dist/rail/ContainerRail.d.ts +29 -0
  288. package/dist/rail/ContainerRail.d.ts.map +1 -0
  289. package/dist/rail/ContainerRail.js +50 -0
  290. package/dist/rail/EntryActions.d.ts +19 -0
  291. package/dist/rail/EntryActions.d.ts.map +1 -0
  292. package/dist/rail/EntryActions.js +17 -0
  293. package/dist/rail/rail-store.d.ts +42 -0
  294. package/dist/rail/rail-store.d.ts.map +1 -0
  295. package/dist/rail/rail-store.js +107 -0
  296. package/dist/rail/rail.css +188 -0
  297. package/dist/rail/useSpaceDrag.d.ts +30 -0
  298. package/dist/rail/useSpaceDrag.d.ts.map +1 -0
  299. package/dist/rail/useSpaceDrag.js +154 -0
  300. package/dist/registry.d.ts +35 -0
  301. package/dist/registry.d.ts.map +1 -0
  302. package/dist/registry.js +74 -0
  303. package/dist/spacing/spacing-context.d.ts +53 -0
  304. package/dist/spacing/spacing-context.d.ts.map +1 -0
  305. package/dist/spacing/spacing-context.js +36 -0
  306. package/dist/spacing/spacing.css +159 -0
  307. package/dist/spacing/useSpaceSlot.d.ts +52 -0
  308. package/dist/spacing/useSpaceSlot.d.ts.map +1 -0
  309. package/dist/spacing/useSpaceSlot.js +38 -0
  310. package/dist/static/api.d.ts +13 -0
  311. package/dist/static/api.d.ts.map +1 -0
  312. package/dist/static/api.js +1 -0
  313. package/dist/static/static.mjs +33779 -0
  314. package/dist/static/templates/academic.css +1 -0
  315. package/dist/static/templates/alta.css +1 -0
  316. package/dist/static/templates/classic.css +1 -0
  317. package/dist/static/templates/cobalt.css +1 -0
  318. package/dist/static/templates/compact.css +1 -0
  319. package/dist/static/templates/contemporary.css +1 -0
  320. package/dist/static/templates/creative.css +1 -0
  321. package/dist/static/templates/crimson.css +1 -0
  322. package/dist/static/templates/curve.css +1 -0
  323. package/dist/static/templates/double-column-logos.css +1 -0
  324. package/dist/static/templates/double-column.css +1 -0
  325. package/dist/static/templates/elegant-logos.css +1 -0
  326. package/dist/static/templates/elegant.css +1 -0
  327. package/dist/static/templates/engineer.css +1 -0
  328. package/dist/static/templates/executive.css +1 -0
  329. package/dist/static/templates/harvard.css +1 -0
  330. package/dist/static/templates/hipster.css +1 -0
  331. package/dist/static/templates/ivy.css +1 -0
  332. package/dist/static/templates/meridian.css +1 -0
  333. package/dist/static/templates/modern.css +1 -0
  334. package/dist/static/templates/polished.css +1 -0
  335. package/dist/static/templates/portrait.css +1 -0
  336. package/dist/static/templates/prism.css +1 -0
  337. package/dist/static/templates/scholar.css +1 -0
  338. package/dist/static/templates/split.css +1 -0
  339. package/dist/static/templates/stylish.css +1 -0
  340. package/dist/static/templates/timeline.css +1 -0
  341. package/dist/static/templates.css +1 -0
  342. package/dist/templates/academic/AcademicDocument.d.ts +6 -0
  343. package/dist/templates/academic/AcademicDocument.d.ts.map +1 -0
  344. package/dist/templates/academic/AcademicDocument.js +29 -0
  345. package/dist/templates/academic/academic.css +284 -0
  346. package/dist/templates/academic/entries.d.ts +22 -0
  347. package/dist/templates/academic/entries.d.ts.map +1 -0
  348. package/dist/templates/academic/entries.js +17 -0
  349. package/dist/templates/alta/AltaDocument.d.ts +6 -0
  350. package/dist/templates/alta/AltaDocument.d.ts.map +1 -0
  351. package/dist/templates/alta/AltaDocument.js +29 -0
  352. package/dist/templates/alta/alta.css +413 -0
  353. package/dist/templates/alta/entries.d.ts +22 -0
  354. package/dist/templates/alta/entries.d.ts.map +1 -0
  355. package/dist/templates/alta/entries.js +17 -0
  356. package/dist/templates/classic/ClassicDocument.d.ts +6 -0
  357. package/dist/templates/classic/ClassicDocument.d.ts.map +1 -0
  358. package/dist/templates/classic/ClassicDocument.js +26 -0
  359. package/dist/templates/classic/classic.css +251 -0
  360. package/dist/templates/classic/entries.d.ts +22 -0
  361. package/dist/templates/classic/entries.d.ts.map +1 -0
  362. package/dist/templates/classic/entries.js +17 -0
  363. package/dist/templates/cobalt/CobaltDocument.d.ts +6 -0
  364. package/dist/templates/cobalt/CobaltDocument.d.ts.map +1 -0
  365. package/dist/templates/cobalt/CobaltDocument.js +28 -0
  366. package/dist/templates/cobalt/cobalt.css +478 -0
  367. package/dist/templates/cobalt/crest.d.ts +6 -0
  368. package/dist/templates/cobalt/crest.d.ts.map +1 -0
  369. package/dist/templates/cobalt/crest.js +8 -0
  370. package/dist/templates/cobalt/entries.d.ts +22 -0
  371. package/dist/templates/cobalt/entries.d.ts.map +1 -0
  372. package/dist/templates/cobalt/entries.js +17 -0
  373. package/dist/templates/compact/CompactDocument.d.ts +6 -0
  374. package/dist/templates/compact/CompactDocument.d.ts.map +1 -0
  375. package/dist/templates/compact/CompactDocument.js +28 -0
  376. package/dist/templates/compact/compact.css +240 -0
  377. package/dist/templates/compact/entries.d.ts +22 -0
  378. package/dist/templates/compact/entries.d.ts.map +1 -0
  379. package/dist/templates/compact/entries.js +17 -0
  380. package/dist/templates/contemporary/ContemporaryDocument.d.ts +6 -0
  381. package/dist/templates/contemporary/ContemporaryDocument.d.ts.map +1 -0
  382. package/dist/templates/contemporary/ContemporaryDocument.js +29 -0
  383. package/dist/templates/contemporary/contemporary.css +411 -0
  384. package/dist/templates/contemporary/entries.d.ts +22 -0
  385. package/dist/templates/contemporary/entries.d.ts.map +1 -0
  386. package/dist/templates/contemporary/entries.js +17 -0
  387. package/dist/templates/creative/CreativeDocument.d.ts +6 -0
  388. package/dist/templates/creative/CreativeDocument.d.ts.map +1 -0
  389. package/dist/templates/creative/CreativeDocument.js +29 -0
  390. package/dist/templates/creative/creative.css +326 -0
  391. package/dist/templates/creative/entries.d.ts +22 -0
  392. package/dist/templates/creative/entries.d.ts.map +1 -0
  393. package/dist/templates/creative/entries.js +17 -0
  394. package/dist/templates/crimson/CrimsonDocument.d.ts +6 -0
  395. package/dist/templates/crimson/CrimsonDocument.d.ts.map +1 -0
  396. package/dist/templates/crimson/CrimsonDocument.js +30 -0
  397. package/dist/templates/crimson/crimson.css +301 -0
  398. package/dist/templates/crimson/entries.d.ts +22 -0
  399. package/dist/templates/crimson/entries.d.ts.map +1 -0
  400. package/dist/templates/crimson/entries.js +17 -0
  401. package/dist/templates/curve/CurveDocument.d.ts +6 -0
  402. package/dist/templates/curve/CurveDocument.d.ts.map +1 -0
  403. package/dist/templates/curve/CurveDocument.js +29 -0
  404. package/dist/templates/curve/curve.css +330 -0
  405. package/dist/templates/curve/entries.d.ts +22 -0
  406. package/dist/templates/curve/entries.d.ts.map +1 -0
  407. package/dist/templates/curve/entries.js +17 -0
  408. package/dist/templates/double-column/DoubleColumnDocument.d.ts +6 -0
  409. package/dist/templates/double-column/DoubleColumnDocument.d.ts.map +1 -0
  410. package/dist/templates/double-column/DoubleColumnDocument.js +29 -0
  411. package/dist/templates/double-column/double-column.css +331 -0
  412. package/dist/templates/double-column/entries.d.ts +22 -0
  413. package/dist/templates/double-column/entries.d.ts.map +1 -0
  414. package/dist/templates/double-column/entries.js +17 -0
  415. package/dist/templates/double-column-logos/DoubleColumnLogosDocument.d.ts +6 -0
  416. package/dist/templates/double-column-logos/DoubleColumnLogosDocument.d.ts.map +1 -0
  417. package/dist/templates/double-column-logos/DoubleColumnLogosDocument.js +28 -0
  418. package/dist/templates/double-column-logos/double-column-logos.css +333 -0
  419. package/dist/templates/double-column-logos/entries.d.ts +22 -0
  420. package/dist/templates/double-column-logos/entries.d.ts.map +1 -0
  421. package/dist/templates/double-column-logos/entries.js +18 -0
  422. package/dist/templates/elegant/ElegantDocument.d.ts +6 -0
  423. package/dist/templates/elegant/ElegantDocument.d.ts.map +1 -0
  424. package/dist/templates/elegant/ElegantDocument.js +31 -0
  425. package/dist/templates/elegant/elegant.css +358 -0
  426. package/dist/templates/elegant/entries.d.ts +22 -0
  427. package/dist/templates/elegant/entries.d.ts.map +1 -0
  428. package/dist/templates/elegant/entries.js +17 -0
  429. package/dist/templates/elegant-logos/ElegantLogosDocument.d.ts +6 -0
  430. package/dist/templates/elegant-logos/ElegantLogosDocument.d.ts.map +1 -0
  431. package/dist/templates/elegant-logos/ElegantLogosDocument.js +30 -0
  432. package/dist/templates/elegant-logos/elegant-logos.css +370 -0
  433. package/dist/templates/elegant-logos/entries.d.ts +22 -0
  434. package/dist/templates/elegant-logos/entries.d.ts.map +1 -0
  435. package/dist/templates/elegant-logos/entries.js +18 -0
  436. package/dist/templates/engineer/EngineerDocument.d.ts +6 -0
  437. package/dist/templates/engineer/EngineerDocument.d.ts.map +1 -0
  438. package/dist/templates/engineer/EngineerDocument.js +26 -0
  439. package/dist/templates/engineer/engineer.css +261 -0
  440. package/dist/templates/engineer/entries.d.ts +22 -0
  441. package/dist/templates/engineer/entries.d.ts.map +1 -0
  442. package/dist/templates/engineer/entries.js +17 -0
  443. package/dist/templates/executive/ExecutiveDocument.d.ts +6 -0
  444. package/dist/templates/executive/ExecutiveDocument.d.ts.map +1 -0
  445. package/dist/templates/executive/ExecutiveDocument.js +29 -0
  446. package/dist/templates/executive/entries.d.ts +22 -0
  447. package/dist/templates/executive/entries.d.ts.map +1 -0
  448. package/dist/templates/executive/entries.js +17 -0
  449. package/dist/templates/executive/executive.css +394 -0
  450. package/dist/templates/harvard/HarvardDocument.d.ts +6 -0
  451. package/dist/templates/harvard/HarvardDocument.d.ts.map +1 -0
  452. package/dist/templates/harvard/HarvardDocument.js +25 -0
  453. package/dist/templates/harvard/entries.d.ts +28 -0
  454. package/dist/templates/harvard/entries.d.ts.map +1 -0
  455. package/dist/templates/harvard/entries.js +22 -0
  456. package/dist/templates/harvard/harvard.css +436 -0
  457. package/dist/templates/hipster/HipsterDocument.d.ts +6 -0
  458. package/dist/templates/hipster/HipsterDocument.d.ts.map +1 -0
  459. package/dist/templates/hipster/HipsterDocument.js +30 -0
  460. package/dist/templates/hipster/entries.d.ts +22 -0
  461. package/dist/templates/hipster/entries.d.ts.map +1 -0
  462. package/dist/templates/hipster/entries.js +17 -0
  463. package/dist/templates/hipster/hipster.css +442 -0
  464. package/dist/templates/ivy/IvyDocument.d.ts +6 -0
  465. package/dist/templates/ivy/IvyDocument.d.ts.map +1 -0
  466. package/dist/templates/ivy/IvyDocument.js +26 -0
  467. package/dist/templates/ivy/entries.d.ts +22 -0
  468. package/dist/templates/ivy/entries.d.ts.map +1 -0
  469. package/dist/templates/ivy/entries.js +17 -0
  470. package/dist/templates/ivy/ivy.css +292 -0
  471. package/dist/templates/meridian/MeridianDocument.d.ts +6 -0
  472. package/dist/templates/meridian/MeridianDocument.d.ts.map +1 -0
  473. package/dist/templates/meridian/MeridianDocument.js +28 -0
  474. package/dist/templates/meridian/entries.d.ts +22 -0
  475. package/dist/templates/meridian/entries.d.ts.map +1 -0
  476. package/dist/templates/meridian/entries.js +17 -0
  477. package/dist/templates/meridian/meridian.css +431 -0
  478. package/dist/templates/modern/ModernDocument.d.ts +6 -0
  479. package/dist/templates/modern/ModernDocument.d.ts.map +1 -0
  480. package/dist/templates/modern/ModernDocument.js +29 -0
  481. package/dist/templates/modern/entries.d.ts +22 -0
  482. package/dist/templates/modern/entries.d.ts.map +1 -0
  483. package/dist/templates/modern/entries.js +17 -0
  484. package/dist/templates/modern/modern.css +309 -0
  485. package/dist/templates/polished/PolishedDocument.d.ts +6 -0
  486. package/dist/templates/polished/PolishedDocument.d.ts.map +1 -0
  487. package/dist/templates/polished/PolishedDocument.js +28 -0
  488. package/dist/templates/polished/entries.d.ts +22 -0
  489. package/dist/templates/polished/entries.d.ts.map +1 -0
  490. package/dist/templates/polished/entries.js +17 -0
  491. package/dist/templates/polished/polished.css +327 -0
  492. package/dist/templates/portrait/PortraitDocument.d.ts +6 -0
  493. package/dist/templates/portrait/PortraitDocument.d.ts.map +1 -0
  494. package/dist/templates/portrait/PortraitDocument.js +30 -0
  495. package/dist/templates/portrait/entries.d.ts +22 -0
  496. package/dist/templates/portrait/entries.d.ts.map +1 -0
  497. package/dist/templates/portrait/entries.js +17 -0
  498. package/dist/templates/portrait/portrait.css +427 -0
  499. package/dist/templates/prism/PrismDocument.d.ts +6 -0
  500. package/dist/templates/prism/PrismDocument.d.ts.map +1 -0
  501. package/dist/templates/prism/PrismDocument.js +35 -0
  502. package/dist/templates/prism/entries.d.ts +22 -0
  503. package/dist/templates/prism/entries.d.ts.map +1 -0
  504. package/dist/templates/prism/entries.js +17 -0
  505. package/dist/templates/prism/prism.css +314 -0
  506. package/dist/templates/scholar/ScholarDocument.d.ts +6 -0
  507. package/dist/templates/scholar/ScholarDocument.d.ts.map +1 -0
  508. package/dist/templates/scholar/ScholarDocument.js +27 -0
  509. package/dist/templates/scholar/entries.d.ts +22 -0
  510. package/dist/templates/scholar/entries.d.ts.map +1 -0
  511. package/dist/templates/scholar/entries.js +17 -0
  512. package/dist/templates/scholar/scholar.css +279 -0
  513. package/dist/templates/skills.d.ts +19 -0
  514. package/dist/templates/skills.d.ts.map +1 -0
  515. package/dist/templates/skills.js +19 -0
  516. package/dist/templates/split/SplitDocument.d.ts +6 -0
  517. package/dist/templates/split/SplitDocument.d.ts.map +1 -0
  518. package/dist/templates/split/SplitDocument.js +29 -0
  519. package/dist/templates/split/entries.d.ts +22 -0
  520. package/dist/templates/split/entries.d.ts.map +1 -0
  521. package/dist/templates/split/entries.js +17 -0
  522. package/dist/templates/split/split.css +337 -0
  523. package/dist/templates/stylish/StylishDocument.d.ts +6 -0
  524. package/dist/templates/stylish/StylishDocument.d.ts.map +1 -0
  525. package/dist/templates/stylish/StylishDocument.js +29 -0
  526. package/dist/templates/stylish/entries.d.ts +22 -0
  527. package/dist/templates/stylish/entries.d.ts.map +1 -0
  528. package/dist/templates/stylish/entries.js +17 -0
  529. package/dist/templates/stylish/stylish.css +340 -0
  530. package/dist/templates/timeline/TimelineDocument.d.ts +6 -0
  531. package/dist/templates/timeline/TimelineDocument.d.ts.map +1 -0
  532. package/dist/templates/timeline/TimelineDocument.js +27 -0
  533. package/dist/templates/timeline/entries.d.ts +22 -0
  534. package/dist/templates/timeline/entries.d.ts.map +1 -0
  535. package/dist/templates/timeline/entries.js +17 -0
  536. package/dist/templates/timeline/timeline.css +295 -0
  537. package/dist/useFitZoom.d.ts +99 -0
  538. package/dist/useFitZoom.d.ts.map +1 -0
  539. package/dist/useFitZoom.js +171 -0
  540. package/package.json +81 -3
  541. package/src/PagedSheet.tsx +792 -0
  542. package/src/TemplateDocument.tsx +112 -0
  543. package/src/autosave-context.tsx +67 -0
  544. package/src/collections/AuthoredItems.tsx +199 -0
  545. package/src/collections/Collection.tsx +73 -0
  546. package/src/collections/CollectionItems.tsx +318 -0
  547. package/src/collections/EntryOverlay.tsx +162 -0
  548. package/src/collections/SortableItems.tsx +167 -0
  549. package/src/collections/authoring-context.tsx +140 -0
  550. package/src/collections/entry-text.ts +41 -0
  551. package/src/collections/icons.tsx +83 -0
  552. package/src/collections/library/LibraryAction.tsx +200 -0
  553. package/src/collections/library/LibraryPicker.tsx +325 -0
  554. package/src/collections/overlay-context.tsx +49 -0
  555. package/src/collections/preload.ts +23 -0
  556. package/src/collections/selection-context.tsx +88 -0
  557. package/src/collections/useCollection.ts +133 -0
  558. package/src/collections/useCustomEntries.ts +84 -0
  559. package/src/collections/useSectionCollection.ts +268 -0
  560. package/src/compiler/emit.ts +736 -0
  561. package/src/compiler/schema.ts +689 -0
  562. package/src/export/entry.tsx +177 -0
  563. package/src/fields/date-issues-context.tsx +105 -0
  564. package/src/fields/field-registry.tsx +358 -0
  565. package/src/i18n/catalog.ts +81 -0
  566. package/src/i18n/format.ts +50 -0
  567. package/src/i18n/index.ts +21 -0
  568. package/src/i18n/locale-context.tsx +135 -0
  569. package/src/index.ts +156 -0
  570. package/src/kit/BulletSkillGroup.tsx +37 -0
  571. package/src/kit/DescribedEntries.tsx +132 -0
  572. package/src/kit/DocumentSection.tsx +97 -0
  573. package/src/kit/GridSkillGroup.tsx +17 -0
  574. package/src/kit/Heading.tsx +17 -0
  575. package/src/kit/InitialsAvatar.tsx +31 -0
  576. package/src/kit/InitialsChip.tsx +29 -0
  577. package/src/kit/InlineSkillGroup.tsx +41 -0
  578. package/src/kit/LabelledSkillGroup.tsx +68 -0
  579. package/src/kit/LanguageList.tsx +148 -0
  580. package/src/kit/Separator.tsx +30 -0
  581. package/src/kit/TagSkillGroup.tsx +19 -0
  582. package/src/kit/contact.ts +34 -0
  583. package/src/kit/documentStyle.ts +33 -0
  584. package/src/kit/monogram.ts +11 -0
  585. package/src/kit/textShapes.tsx +61 -0
  586. package/src/letter/LetterDocument.tsx +33 -0
  587. package/src/nodes/AuthoredBullets.tsx +253 -0
  588. package/src/nodes/CustomSections.tsx +138 -0
  589. package/src/nodes/EditableBulletList.tsx +186 -0
  590. package/src/nodes/EditableInlineList.tsx +109 -0
  591. package/src/nodes/EditableText.tsx +261 -0
  592. package/src/nodes/LinkField.tsx +438 -0
  593. package/src/nodes/PlainTextField.tsx +132 -0
  594. package/src/nodes/formatting.ts +58 -0
  595. package/src/nodes/locked.ts +67 -0
  596. package/src/pagination.ts +238 -0
  597. package/src/picture-context.tsx +18 -0
  598. package/src/presentation-context.tsx +87 -0
  599. package/src/presented.ts +29 -0
  600. package/src/rail/ContainerRail.tsx +145 -0
  601. package/src/rail/EntryActions.tsx +104 -0
  602. package/src/rail/rail-store.tsx +126 -0
  603. package/src/rail/useSpaceDrag.ts +177 -0
  604. package/src/registry.ts +101 -0
  605. package/src/spacing/spacing-context.tsx +100 -0
  606. package/src/spacing/useSpaceSlot.tsx +97 -0
  607. package/src/static/api.ts +19 -0
  608. package/src/static/fixtures.ts +80 -0
  609. package/src/static/render.tsx +24 -0
  610. package/src/templates/academic/AcademicDocument.tsx +255 -0
  611. package/src/templates/academic/entries.tsx +176 -0
  612. package/src/templates/alta/AltaDocument.tsx +265 -0
  613. package/src/templates/alta/entries.tsx +167 -0
  614. package/src/templates/classic/ClassicDocument.tsx +248 -0
  615. package/src/templates/classic/entries.tsx +175 -0
  616. package/src/templates/cobalt/CobaltDocument.tsx +302 -0
  617. package/src/templates/cobalt/crest.tsx +31 -0
  618. package/src/templates/cobalt/entries.tsx +136 -0
  619. package/src/templates/compact/CompactDocument.tsx +256 -0
  620. package/src/templates/compact/entries.tsx +167 -0
  621. package/src/templates/contemporary/ContemporaryDocument.tsx +287 -0
  622. package/src/templates/contemporary/entries.tsx +167 -0
  623. package/src/templates/creative/CreativeDocument.tsx +269 -0
  624. package/src/templates/creative/entries.tsx +167 -0
  625. package/src/templates/crimson/CrimsonDocument.tsx +283 -0
  626. package/src/templates/crimson/entries.tsx +169 -0
  627. package/src/templates/curve/CurveDocument.tsx +259 -0
  628. package/src/templates/curve/entries.tsx +168 -0
  629. package/src/templates/double-column/DoubleColumnDocument.tsx +269 -0
  630. package/src/templates/double-column/entries.tsx +169 -0
  631. package/src/templates/double-column-logos/DoubleColumnLogosDocument.tsx +262 -0
  632. package/src/templates/double-column-logos/entries.tsx +172 -0
  633. package/src/templates/elegant/ElegantDocument.tsx +297 -0
  634. package/src/templates/elegant/entries.tsx +167 -0
  635. package/src/templates/elegant-logos/ElegantLogosDocument.tsx +291 -0
  636. package/src/templates/elegant-logos/entries.tsx +170 -0
  637. package/src/templates/engineer/EngineerDocument.tsx +248 -0
  638. package/src/templates/engineer/entries.tsx +170 -0
  639. package/src/templates/executive/ExecutiveDocument.tsx +312 -0
  640. package/src/templates/executive/entries.tsx +146 -0
  641. package/src/templates/harvard/HarvardDocument.tsx +248 -0
  642. package/src/templates/harvard/entries.tsx +205 -0
  643. package/src/templates/hipster/HipsterDocument.tsx +289 -0
  644. package/src/templates/hipster/entries.tsx +175 -0
  645. package/src/templates/ivy/IvyDocument.tsx +248 -0
  646. package/src/templates/ivy/entries.tsx +167 -0
  647. package/src/templates/meridian/MeridianDocument.tsx +304 -0
  648. package/src/templates/meridian/entries.tsx +140 -0
  649. package/src/templates/modern/ModernDocument.tsx +265 -0
  650. package/src/templates/modern/entries.tsx +167 -0
  651. package/src/templates/polished/PolishedDocument.tsx +262 -0
  652. package/src/templates/polished/entries.tsx +167 -0
  653. package/src/templates/portrait/PortraitDocument.tsx +278 -0
  654. package/src/templates/portrait/entries.tsx +173 -0
  655. package/src/templates/prism/PrismDocument.tsx +307 -0
  656. package/src/templates/prism/entries.tsx +175 -0
  657. package/src/templates/scholar/ScholarDocument.tsx +266 -0
  658. package/src/templates/scholar/entries.tsx +169 -0
  659. package/src/templates/skills.ts +21 -0
  660. package/src/templates/split/SplitDocument.tsx +293 -0
  661. package/src/templates/split/entries.tsx +164 -0
  662. package/src/templates/stylish/StylishDocument.tsx +265 -0
  663. package/src/templates/stylish/entries.tsx +167 -0
  664. package/src/templates/timeline/TimelineDocument.tsx +251 -0
  665. package/src/templates/timeline/entries.tsx +173 -0
  666. package/src/useFitZoom.ts +185 -0
@@ -0,0 +1,584 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { createContext, useCallback, useContext, useEffect, useLayoutEffect, useRef, useState, } from 'react';
3
+ import { ZOOM_SETTLE_MS, ZOOM_MAX, ZOOM_MIN, ZOOM_STEP, step, useFitZoom, } from './useFitZoom.js';
4
+ import { PAGE_HEIGHT, SHEET_GAP, PAGE_MARGIN, planPagination, } from './pagination.js';
5
+ import { useEditorText } from './i18n/index.js';
6
+ import './paged.css';
7
+ /** How many times a single pagination will re-measure before giving up. */
8
+ const MAX_PASSES = 4;
9
+ /** How many times one pass corrects a push against where it actually landed. */
10
+ const MAX_CORRECTIONS = 3;
11
+ /**
12
+ * A repaginate handle, published to whatever can see the content change.
13
+ *
14
+ * Neither React nor a ResizeObserver can: the document's text lives in Craft's
15
+ * own store, so a keystroke re-renders a node WITHOUT re-rendering this
16
+ * component or its children, and the observer proved not to deliver for content
17
+ * growth inside the observed subtree. The component that CAN see it subscribes
18
+ * to Craft and calls this.
19
+ */
20
+ const RepaginateContext = createContext(() => undefined);
21
+ /** Ask the enclosing `PagedSheet` to re-measure. A no-op outside one. */
22
+ export function useRepaginate() {
23
+ return useContext(RepaginateContext);
24
+ }
25
+ /**
26
+ * How much the sheet is magnified, for the one thing that has to divide by it.
27
+ *
28
+ * The page is drawn with CSS `zoom`, so a pointer that has travelled 30 screen
29
+ * pixels has travelled 30/zoom document pixels — and a control that turns
30
+ * pointer travel into a document measurement gets it wrong by the zoom unless
31
+ * it knows. Everything else in here works in document pixels already and needs
32
+ * this no more than `useRepaginate` needs a scale.
33
+ */
34
+ const ZoomContext = createContext(1);
35
+ /** The sheet's current magnification. `1` — no zoom — outside a sheet. */
36
+ export function useSheetZoom() {
37
+ return useContext(ZoomContext);
38
+ }
39
+ /**
40
+ * The document, shown as discrete sheets.
41
+ *
42
+ * The flow is **never restructured**. The obvious implementation — measure the
43
+ * blocks, then render each page's blocks into its own page container — moves DOM
44
+ * nodes between parents whenever a break shifts. Those nodes are Craft.js linked
45
+ * nodes holding the candidate's edits, and re-parenting risks remounting them
46
+ * against their JSX-supplied initial props: a repagination would cost somebody
47
+ * their typing, which is the worst bug this feature could have.
48
+ *
49
+ * So content renders as one continuous column and pagination is a set of numbers
50
+ * applied to elements that were already there: a block that would straddle a
51
+ * boundary is pushed down by top margin so it starts on the next sheet. The
52
+ * sheets themselves are inert, absolutely positioned behind the flow, and carry
53
+ * no content at all.
54
+ *
55
+ * It also degrades honestly — before the first measurement, or if measurement
56
+ * fails, the reader sees a continuous document rather than a broken one.
57
+ */
58
+ export function PagedSheet({ measureKey, children, maxZoom = 1, minZoom = 1, fitDelayMs = 0, sheetGap = SHEET_GAP, }) {
59
+ const flow = useRef(null);
60
+ const pagesRef = useRef(null);
61
+ const fit = useFitZoom(pagesRef, maxZoom, fitDelayMs, minZoom);
62
+ /*
63
+ * The gap, held in a ref so `paginate` can stay dependency-free.
64
+ *
65
+ * `paginate` is deliberately a `useCallback` over `[]` — it is scheduled from
66
+ * effects, a resize listener and a microtask guard, and a changing identity
67
+ * would re-subscribe all of them on every render. The gap is a constant per
68
+ * surface in practice (28 in the editor, 0 in the export), so reading it
69
+ * through a ref keeps that property without the callback growing a dependency.
70
+ */
71
+ const gapRef = useRef(sheetGap);
72
+ gapRef.current = sheetGap;
73
+ /*
74
+ * A gap of zero means paper: sheets are contiguous only when they are pages.
75
+ * Derived rather than passed separately, so the two cannot be set to disagree.
76
+ */
77
+ const printing = sheetGap === 0;
78
+ const printingRef = useRef(printing);
79
+ printingRef.current = printing;
80
+ /*
81
+ * The candidate's own zoom, once they have expressed one.
82
+ *
83
+ * `null` means "whatever fits", so the automatic value keeps tracking the
84
+ * window. The moment they touch a control it stops: a resize must not undo a
85
+ * choice somebody made, and this is the smallest way to say which of the two
86
+ * is currently in charge.
87
+ *
88
+ * Never stored, on purpose. It is a fact about how somebody is looking at the
89
+ * document, not about the document — `editor-usability` (#35) is explicit that
90
+ * a view zoom must not become part of the artifact, because the résumé's own
91
+ * type scale already is.
92
+ */
93
+ const [chosen, setChosen] = useState(null);
94
+ const zoom = chosen ?? fit;
95
+ /*
96
+ * Pagination is suspended while the zoom is easing.
97
+ *
98
+ * Measurements are divided by the TARGET zoom, and during a transition the
99
+ * layout is at neither the old value nor the new one — so a pass mid-animation
100
+ * would divide real rects by a scale they are not yet at and plan the pages
101
+ * against numbers that are true for no frame. The ResizeObserver fires on
102
+ * every one of those frames, so this is not a rare case; it is every press.
103
+ *
104
+ * A timer rather than `transitionend`, because `zoom` is not interpolable
105
+ * everywhere: where the browser snaps instead of easing, no event ever fires
106
+ * and pagination would stay suspended for good.
107
+ */
108
+ const zooming = useRef(false);
109
+ const settled = useRef(zoom);
110
+ /*
111
+ * Read by `measure`, which must not be rebuilt when the zoom changes: it is a
112
+ * `useCallback` the observers are bound to, and re-creating it would tear down
113
+ * and re-attach them on every resize.
114
+ */
115
+ const zoomRef = useRef(zoom);
116
+ zoomRef.current = zoom;
117
+ const [pages, setPages] = useState(1);
118
+ /*
119
+ * Re-entrancy guard, cleared synchronously.
120
+ *
121
+ * Pagination writes margins, which resizes the flow, which is what the
122
+ * observer below watches — so it must not be able to call itself while it is
123
+ * running. Deliberately NOT a frame- or timer-based guard: one of those
124
+ * latches shut whenever its callback does not run (a backgrounded tab, a
125
+ * throttled frame loop) and pagination then stops for good. This flag is set
126
+ * and cleared inside one synchronous body, so it cannot outlive the call.
127
+ *
128
+ * The asynchronous half of the loop needs no guard: paginate is idempotent, so
129
+ * a second pass computes the same margins, changes no size, and ends there.
130
+ */
131
+ const running = useRef(false);
132
+ /**
133
+ * One measuring pass. Returns a signature of the pushes it applied, so the
134
+ * caller can tell whether anything moved.
135
+ */
136
+ const measure = useCallback((root) => {
137
+ /*
138
+ * The blocks, with a splittable one replaced by the items inside it.
139
+ *
140
+ * A block is what moves whole onto the next sheet, and for almost everything
141
+ * a résumé holds that is right — an experience entry belongs with its own
142
+ * bullets. A **keyword rail** is the exception: fifty-odd skills are one list
143
+ * because they are one field, and treating them as one block makes a thing
144
+ * taller than the paper, which no amount of pushing can place. Such a
145
+ * container marks itself `data-split` and its list items become the blocks,
146
+ * so the rail breaks between two skills like a list rather than being moved
147
+ * around like a paragraph.
148
+ *
149
+ * Document order is preserved, because `flatMap` preserves it.
150
+ */
151
+ const blocks = Array.from(root.querySelectorAll('[data-block]')).flatMap((block) => block.hasAttribute('data-split')
152
+ ? Array.from(block.querySelectorAll('li'))
153
+ : [block]);
154
+ // Nothing to measure is a stable state, not a failure.
155
+ if (blocks.length === 0)
156
+ return '';
157
+ /*
158
+ * Everything below is read from `getBoundingClientRect`, which reports the
159
+ * VIEWPORT box — so under a view zoom every distance comes back multiplied
160
+ * by it, while `PAGE_HEIGHT` and the margins the plan is compared against
161
+ * stay in unzoomed CSS pixels. Dividing here is what keeps the two in the
162
+ * same units: without it a document at 1.15 would break its pages 15% early.
163
+ *
164
+ * The pushes written back need no such correction. They are CSS lengths
165
+ * applied INSIDE the zoomed subtree, so the browser scales them itself.
166
+ */
167
+ const scale = zoomRef.current;
168
+ const origin = root.getBoundingClientRect().top / scale;
169
+ /*
170
+ * Write, then read, then write — never interleaved.
171
+ *
172
+ * Measuring a block, pushing it, then measuring the next forces the browser
173
+ * to lay the document out again once PER BLOCK, on every keystroke. Instead
174
+ * the natural layout is read in a single pass and handed whole to
175
+ * `planPagination`, which decides every push arithmetically. One reflow, not
176
+ * one per block.
177
+ */
178
+ /*
179
+ * EVERY property a pass writes, cleared before the next one measures — not
180
+ * just the margin.
181
+ *
182
+ * The bug this fixes, which reached exported PDFs: printing writes
183
+ * `break-before` and `padding-top` as well (see the print branch below), and
184
+ * only the margin was ever reset. So the second pass measured a document
185
+ * that was still carrying the FIRST pass's page breaks. Under
186
+ * `emulatedMediaType: print` the renderer's layout is genuinely fragmented,
187
+ * so those breaks move the rects `getBoundingClientRect` reports — the plan
188
+ * read a heading already sitting at the top of page two, concluded that what
189
+ * followed no longer fitted, and broke again. Every pass added one more
190
+ * break, and the paginator ran several: the layout effect, the resize
191
+ * observer, and the export's settle loop.
192
+ *
193
+ * The symptom was exact. A résumé the editor drew on two pages exported on
194
+ * three, with EDUCATION alone at the top of page two and its entries
195
+ * stranded on page three.
196
+ *
197
+ * `''` restores the stylesheet's value rather than zeroing it, which is what
198
+ * makes this a reset to the NATURAL layout instead of a fourth opinion
199
+ * about spacing. `pagination-reset.spec.ts` fails if a future pass writes a
200
+ * property this loop does not clear.
201
+ */
202
+ for (const block of blocks) {
203
+ /*
204
+ * A block this component moved is held still while it is put back, so
205
+ * the read below sees its natural margin rather than the first frame of
206
+ * an animation back to it. See `still` below.
207
+ */
208
+ if (block.style.marginTop)
209
+ block.style.transition = 'none';
210
+ block.style.marginTop = '';
211
+ block.style.breakBefore = '';
212
+ block.style.paddingTop = '';
213
+ }
214
+ /*
215
+ * Hands animation back to every block this pass did not move.
216
+ *
217
+ * A spaced block eases its `margin-top` (`spacing.css`), and a push IS a
218
+ * `margin-top`. Left to ease, a push had not moved the block when the
219
+ * correction loop measured it, so the loop read the whole push as missing
220
+ * and added it again, three times over. The saved résumé showed the entry
221
+ * far down its new page, with space the candidate never asked for. The
222
+ * editor hid it only because a drag switches the easing off.
223
+ *
224
+ * So a moved block never animates. The layout is read first, so handing a
225
+ * block its easing back starts no animation of its own.
226
+ */
227
+ const still = (moved) => {
228
+ void root.getBoundingClientRect();
229
+ for (const block of blocks) {
230
+ if (!moved.has(block))
231
+ block.style.transition = '';
232
+ }
233
+ };
234
+ /*
235
+ * Each block's OWN top margin, read once the inline ones are cleared.
236
+ *
237
+ * A push is written as an inline `margin-top`, which REPLACES whatever the
238
+ * stylesheet gave the block rather than adding to it — so pushing a block
239
+ * onto the next sheet used to delete the margin it was drawn with, and a
240
+ * candidate who had opened a gap above a section watched it vanish the
241
+ * moment that section crossed a page boundary. The correction loop below
242
+ * then had to rediscover the lost distance by measuring, which it does to
243
+ * within half a pixel and no closer.
244
+ *
245
+ * Kept here so the push can be written as the block's own margin PLUS the
246
+ * offset. The plan's offsets are distances to move FROM the natural layout,
247
+ * and the natural layout already includes these — so adding them back is
248
+ * what makes the block move by exactly what the plan asked for.
249
+ */
250
+ const own = blocks.map((block) => Number.parseFloat(getComputedStyle(block).marginTop) || 0);
251
+ /*
252
+ * The space the candidate recorded above each block. The planner decides
253
+ * how much of it a block keeps when it is moved onto a new sheet.
254
+ *
255
+ * A gap belongs to the FIRST block inside the element that carries it: a
256
+ * spaced entry is itself a block, but a spaced section holds its gap above
257
+ * its heading. Blocks come in document order, so the first one found inside
258
+ * a spaced element is the one that claims its gap, and no gap is counted
259
+ * twice.
260
+ *
261
+ * Read as `--tpl-space-height`, which is registered as a `<length>` and so
262
+ * computes to pixels. A browser that cannot register it answers with the
263
+ * unresolved `calc()`, which parses as nothing: such a block keeps no space
264
+ * at the top of a sheet, which is how every block behaved before.
265
+ */
266
+ const claimed = new Set();
267
+ const leads = blocks.map((block) => {
268
+ let lead = 0;
269
+ for (let el = block; el && el !== root; el = el.parentElement) {
270
+ if (!el.hasAttribute('data-spaced') || claimed.has(el))
271
+ continue;
272
+ claimed.add(el);
273
+ lead +=
274
+ Number.parseFloat(getComputedStyle(el).getPropertyValue('--tpl-space-height')) || 0;
275
+ }
276
+ return lead;
277
+ });
278
+ const measured = blocks.map((block, index) => {
279
+ const rect = block.getBoundingClientRect();
280
+ return {
281
+ /*
282
+ * Which COLUMN this block flows down. A template that lays regions side
283
+ * by side marks each one `[data-flow]`; everything else answers `root`,
284
+ * so a single-column document is one flow.
285
+ *
286
+ * Read from the block's PARENT, so a block that is itself a flow root
287
+ * belongs to the flow around it rather than to itself.
288
+ */
289
+ flow: block.parentElement?.closest('[data-flow]') ?? root,
290
+ top: rect.top / scale - origin,
291
+ height: rect.height / scale,
292
+ keepWithNext: block.hasAttribute('data-keep-with-next'),
293
+ lead: leads[index],
294
+ };
295
+ });
296
+ const plan = planPagination(measured, gapRef.current);
297
+ /*
298
+ * ── Printing takes the same PLAN and applies it differently ─────────────
299
+ *
300
+ * On screen a page break is a block pushed down by `margin-top` until it
301
+ * sits at the top of the next sheet. On paper that does not survive, and the
302
+ * reason is CSS fragmentation rather than anything about this code: when the
303
+ * printer breaks a flow across pages it TRUNCATES the margin at the break,
304
+ * and the element's own padding — the page's inner margin, which every
305
+ * template carries on its root box — is applied to the first fragment only.
306
+ * The measured symptom was exact: page one's text started 0.59in down and
307
+ * page two's started 0.064in down, flush against the paper's edge.
308
+ *
309
+ * So printing asks the browser for the break instead of positioning it.
310
+ * `break-before: page` puts the block at the top of a new sheet — the SAME
311
+ * block the shared paginator chose, so the decision is still made in one
312
+ * place — and `padding-top` re-establishes the page's inner margin, because
313
+ * padding at the start of a fragment is preserved where a margin is not.
314
+ *
315
+ * The correction pass below is skipped for the same reason: it exists to
316
+ * verify a block landed where it was pushed, and nothing is being pushed.
317
+ */
318
+ if (printingRef.current) {
319
+ for (const index of plan.pushes.keys()) {
320
+ const el = blocks[index];
321
+ /*
322
+ * Zero, not cleared. Clearing restores the block's own CSS margin — the
323
+ * space a section carries above itself — and at the top of a fresh page
324
+ * that is not space between sections, it is space above the first line
325
+ * of the page. It measured as 1.31in where the first page reads 0.59in.
326
+ */
327
+ el.style.transition = 'none';
328
+ el.style.marginTop = '0px';
329
+ el.style.breakBefore = 'page';
330
+ /*
331
+ * Plus the space the candidate recorded above this block, as padding
332
+ * for the same reason: a margin at the start of a page does not print.
333
+ */
334
+ el.style.paddingTop = `${PAGE_MARGIN + (plan.leads.get(index) ?? 0)}px`;
335
+ }
336
+ still(new Set([...plan.pushes.keys()].map((index) => blocks[index])));
337
+ setPages((current) => (current === plan.pages ? current : plan.pages));
338
+ return [...plan.pushes.keys()].join(',');
339
+ }
340
+ /*
341
+ * Back onto the elements the plan indexed. The model deals in positions, so
342
+ * it never sees a node and cannot move one by mistake.
343
+ */
344
+ const pushes = new Map();
345
+ const targets = new Map();
346
+ for (const [index, offset] of plan.pushes) {
347
+ const applied = (own[index] ?? 0) + offset;
348
+ pushes.set(blocks[index], applied);
349
+ blocks[index].style.transition = 'none';
350
+ blocks[index].style.marginTop = `${applied}px`;
351
+ }
352
+ for (const [index, target] of plan.targets) {
353
+ targets.set(blocks[index], target);
354
+ }
355
+ /*
356
+ * Apply, then VERIFY — do not trust the prediction.
357
+ *
358
+ * The arithmetic above assumes a block moves by exactly what it is given.
359
+ * Real layout disagrees: a pushed block is often the first child of its
360
+ * section, so its margin COLLAPSES with the section's and part of the offset
361
+ * is swallowed; and a multi-column block settles to a different height once
362
+ * laid out. Predicting either is how a section heading ended up floating in
363
+ * the gap between two pages.
364
+ *
365
+ * Measuring the residual absorbs both without modelling them — which is also
366
+ * why the offset is a MARGIN. A margin moves the block's box, so the
367
+ * correction can see whether it worked; padding moves only the content
368
+ * inside the box, leaving the measured position unchanged and the loop
369
+ * correcting forever.
370
+ *
371
+ * So the residual is measured and corrected. Passes over a settled layout
372
+ * read a residual of zero and change nothing.
373
+ */
374
+ for (let correction = 0; correction < MAX_CORRECTIONS; correction++) {
375
+ const after = root.getBoundingClientRect().top / scale;
376
+ let worst = 0;
377
+ for (const [block, target] of targets) {
378
+ const actual = block.getBoundingClientRect().top / scale - after;
379
+ const residual = target - actual;
380
+ if (Math.abs(residual) < 0.5)
381
+ continue;
382
+ worst = Math.max(worst, Math.abs(residual));
383
+ const next = Math.max(0, (pushes.get(block) ?? 0) + residual);
384
+ pushes.set(block, next);
385
+ block.style.marginTop = `${next}px`;
386
+ }
387
+ if (worst === 0)
388
+ break;
389
+ }
390
+ still(new Set(pushes.keys()));
391
+ // Only when it actually changed: this runs on every content change, and a
392
+ // needless state write would re-render the whole document.
393
+ setPages((current) => (current === plan.pages ? current : plan.pages));
394
+ return [...pushes.values()].map((v) => Math.round(v)).join(',');
395
+ }, []);
396
+ /*
397
+ * Measure at most once per task.
398
+ *
399
+ * A single keystroke can produce several renders — the node write, the edits
400
+ * report, the dirty-state settle — and each would otherwise measure the whole
401
+ * document. The microtask coalesces them into one pass, and still runs before
402
+ * the browser paints, so the reader never sees an unpaginated frame.
403
+ *
404
+ * A microtask specifically, because it always runs. A frame or a timer can be
405
+ * throttled to a standstill in a background tab, and pagination that stops
406
+ * there stays stopped — which is exactly how an earlier frame-based guard
407
+ * latched shut and silently stopped repaginating altogether.
408
+ */
409
+ const scheduled = useRef(false);
410
+ const paginate = useCallback(() => {
411
+ if (scheduled.current)
412
+ return;
413
+ scheduled.current = true;
414
+ queueMicrotask(() => {
415
+ scheduled.current = false;
416
+ const root = flow.current;
417
+ if (!root || running.current || zooming.current)
418
+ return;
419
+ running.current = true;
420
+ try {
421
+ /*
422
+ * Measure until it stops changing.
423
+ *
424
+ * One pass is not enough: measuring reads the layout, and the layout can
425
+ * still be settling — a multi-column block reflows to a different height
426
+ * once its content is laid out, which moves every block after it and
427
+ * leaves the pushes computed against numbers that no longer hold. That
428
+ * is how a section heading ended up floating in the gap BETWEEN two
429
+ * pages: pushed by the right amount for a layout that then shrank.
430
+ *
431
+ * Each pass clears its own margins and re-reads, so a pass over a stable
432
+ * layout is a no-op that returns the same signature and ends the loop.
433
+ * Bounded, because "keep going until it settles" must terminate even if
434
+ * a pathological layout oscillates.
435
+ */
436
+ let previous = '';
437
+ for (let pass = 0; pass < MAX_PASSES; pass++) {
438
+ const applied = measure(root);
439
+ if (applied === previous)
440
+ break;
441
+ previous = applied;
442
+ }
443
+ }
444
+ finally {
445
+ running.current = false;
446
+ }
447
+ });
448
+ }, [measure]);
449
+ /*
450
+ * Layout effect so the reader never sees the unpaginated arrangement.
451
+ *
452
+ * `children` IS a dependency, and deliberately so: it is the only trigger that
453
+ * fires for certain when the document's content changes. The ResizeObserver
454
+ * below looks like it should cover this and in practice does not fire reliably
455
+ * for content growth inside the observed subtree — typing enough to spill onto
456
+ * a second page left the document still showing one. React is the honest
457
+ * signal; the observer is the backstop for what React cannot see, like the
458
+ * window resizing.
459
+ *
460
+ * The cost this used to carry is gone: the frame guard above coalesces every
461
+ * call within a frame into a single measurement, so a burst of renders
462
+ * paginates once.
463
+ */
464
+ useLayoutEffect(paginate, [paginate, measureKey, children]);
465
+ /*
466
+ * And again once the document's own faces have arrived.
467
+ *
468
+ * The screen/paper divergence this closes: the export waits for
469
+ * `document.fonts.ready` before it paginates, and this component did not — so
470
+ * the two halves of the one guarantee this file exists to make were measuring
471
+ * documents drawn in different typefaces.
472
+ *
473
+ * A résumé's face is a webfont. Until it loads the browser draws the fallback,
474
+ * and the fallback is not metrically equal to it — `TeX Gyre Heros` matches
475
+ * Helvetica, while a Mac's `Helvetica Neue` is a different set of advances. So
476
+ * the first pass can plan against line breaking that is about to change, and
477
+ * the plan outlives the layout it was made from. The measured symptom was one
478
+ * block: an education entry the exported file fitted on page one with 17px to
479
+ * spare, and the screen pushed onto page two.
480
+ *
481
+ * `document.fonts.ready` is the browser's own answer to "are the metrics
482
+ * final", so nothing here guesses at a delay. It is already resolved on a warm
483
+ * cache, which makes this a microtask and a second measuring pass that finds
484
+ * nothing to change.
485
+ *
486
+ * Feature-detected, because pagination is presentation: an environment with no
487
+ * font loading API must still paginate, not throw. `cancelled` because a
488
+ * promise that settles after unmount must not measure a document that is gone.
489
+ */
490
+ useEffect(() => {
491
+ const fonts = globalThis.document?.fonts;
492
+ if (!fonts?.ready)
493
+ return;
494
+ let cancelled = false;
495
+ void fonts.ready.then(() => {
496
+ if (!cancelled)
497
+ paginate();
498
+ });
499
+ return () => {
500
+ cancelled = true;
501
+ };
502
+ }, [paginate]);
503
+ /*
504
+ * Once the zoom has settled, measure once.
505
+ *
506
+ * A uniform scale cannot move a page break on its own — `pagination.spec.ts`
507
+ * asserts the plan is identical at 1.15 as at 1 — so this is not correcting
508
+ * for the zoom itself. It is correcting for what the zoom does to text: line
509
+ * breaking happens at the scaled width, and a line that fit at 100% can wrap
510
+ * at 115%, which moves everything under it.
511
+ */
512
+ useEffect(() => {
513
+ if (settled.current === zoom)
514
+ return;
515
+ settled.current = zoom;
516
+ zooming.current = true;
517
+ const timer = setTimeout(() => {
518
+ zooming.current = false;
519
+ paginate();
520
+ }, ZOOM_SETTLE_MS);
521
+ return () => clearTimeout(timer);
522
+ }, [zoom, paginate]);
523
+ useEffect(() => {
524
+ const root = flow.current;
525
+ if (!root)
526
+ return;
527
+ /*
528
+ * The document reflows when the window does and when its own content grows;
529
+ * both must repaginate, and neither writes anything to the document.
530
+ *
531
+ * Feature-detected rather than assumed: pagination is presentation, so an
532
+ * environment without a ResizeObserver must show a continuous document, not
533
+ * a crashed one. The layout-effect pass above still runs there.
534
+ */
535
+ const observer = typeof ResizeObserver === 'function'
536
+ ? new ResizeObserver(() => paginate())
537
+ : null;
538
+ observer?.observe(root);
539
+ window.addEventListener('resize', paginate);
540
+ return () => {
541
+ observer?.disconnect();
542
+ window.removeEventListener('resize', paginate);
543
+ };
544
+ }, [paginate]);
545
+ return (_jsx(RepaginateContext.Provider, { value: paginate, children: _jsxs(ZoomProvider, { zoom: zoom, children: [maxZoom > 1 && (_jsx(ZoomControl, { zoom: zoom, onZoomOut: () => setChosen(step(zoom, -ZOOM_STEP)), onReset: () => setChosen(null), onZoomIn: () => setChosen(step(zoom, ZOOM_STEP)) })), _jsxs("div", { ref: pagesRef, className: "tpl-pages", "data-multipage": pages > 1 ? '' : undefined, style: {
546
+ '--page-h': `${PAGE_HEIGHT}px`,
547
+ '--page-gap': `${sheetGap}px`,
548
+ /*
549
+ * The sheets are absolutely positioned decoration, so they add
550
+ * nothing to this element's height — it would otherwise collapse to
551
+ * the TEXT, and a short document would render as a sliver of paper
552
+ * cut off mid-page. Reserving the sheets' full extent here keeps a
553
+ * page looking like a page when it is nearly empty, which is exactly
554
+ * the state a record starts in.
555
+ */
556
+ '--pages': pages,
557
+ /*
558
+ * `zoom` rather than `transform: scale()`, because zoom takes part
559
+ * in layout: the element's own box grows with it, so the canvas
560
+ * scrolls naturally and no height has to be reserved by hand. A
561
+ * transform would leave the box its unzoomed size and the sheets
562
+ * would overlap whatever follows them.
563
+ *
564
+ * Undefined at 1 so the property is absent from an unzoomed
565
+ * document — which is every document outside the editor.
566
+ */
567
+ zoom: zoom === 1 ? undefined : zoom,
568
+ /*
569
+ * The transition's duration, supplied from the same constant that
570
+ * decides how long pagination waits — so the stylesheet and the
571
+ * measurement pause cannot drift apart.
572
+ */
573
+ '--zoom-ms': `${ZOOM_SETTLE_MS}ms`,
574
+ }, children: [_jsx("div", { className: "tpl-pages__sheets", "aria-hidden": "true", children: Array.from({ length: pages }, (_, i) => (_jsx("div", { className: "tpl-sheet", style: { top: `${i * (PAGE_HEIGHT + sheetGap)}px` }, children: _jsxs("span", { className: "tpl-sheet__number", children: [i + 1, " / ", pages] }) }, i))) }), _jsx("div", { className: "tpl-pages__flow", ref: flow, children: children })] })] }) }));
575
+ }
576
+ /** Split out so the sheet's own re-render is not a new context object. */
577
+ function ZoomControl({ zoom, onZoomOut, onReset, onZoomIn, }) {
578
+ const { t, format } = useEditorText();
579
+ const percent = Math.round(zoom * 100);
580
+ return (_jsxs("div", { className: "tpl-zoom", "data-chrome": true, role: "group", "aria-label": t.zoom.group, children: [_jsx("button", { type: "button", className: "tpl-zoom__btn", "aria-label": t.zoom.out, title: t.zoom.out, disabled: zoom <= ZOOM_MIN, onClick: onZoomOut, children: "\u2212" }), _jsxs("button", { type: "button", className: "tpl-zoom__value", "aria-label": format(t.zoom.level, { percent }), title: t.zoom.reset, onClick: onReset, children: [percent, "%"] }), _jsx("button", { type: "button", className: "tpl-zoom__btn", "aria-label": t.zoom.in, title: t.zoom.in, disabled: zoom >= ZOOM_MAX, onClick: onZoomIn, children: "+" })] }));
581
+ }
582
+ function ZoomProvider({ zoom, children, }) {
583
+ return _jsx(ZoomContext.Provider, { value: zoom, children: children });
584
+ }
@@ -0,0 +1,33 @@
1
+ import { type ResumePresentation, type ResumeObject } from '@resumekit/schema';
2
+ export interface TemplateDocumentProps {
3
+ /** The writer's resume object. */
4
+ resume: ResumeObject;
5
+ /** How the owner chose to present it; absent means the default template. */
6
+ presentation?: ResumePresentation;
7
+ /**
8
+ * The gap between sheets. Defaults to the gap drawn on screen; the export
9
+ * renderer passes `0`, because paper has none.
10
+ *
11
+ * This is the whole of the difference between the document on screen and the
12
+ * document in the file. Everything else — the components, the stylesheets, the
13
+ * geometry, the paginator — is one definition used twice.
14
+ */
15
+ sheetGap?: number;
16
+ /**
17
+ * Shrink the page to fit a container narrower than the paper, as on a phone.
18
+ * For viewing only: the export must never pass it, since a rendered page is
19
+ * the page.
20
+ */
21
+ shrinkToFit?: boolean;
22
+ }
23
+ /**
24
+ * A resume rendered read-only in its template.
25
+ *
26
+ * The same component tree the designer edits, mounted with `enabled={false}` so
27
+ * nothing is selectable and no field ever becomes an input. Reusing the tree
28
+ * rather than writing a second renderer is what guarantees the read-only view
29
+ * and the editable one cannot drift apart — there is one Harvard template, not a
30
+ * viewing copy and an editing copy.
31
+ */
32
+ export declare function TemplateDocument({ resume, presentation, sheetGap, shrinkToFit, }: TemplateDocumentProps): import("react").JSX.Element;
33
+ //# sourceMappingURL=TemplateDocument.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TemplateDocument.d.ts","sourceRoot":"","sources":["../src/TemplateDocument.tsx"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,kBAAkB,EACvB,KAAK,YAAY,EAClB,MAAM,mBAAmB,CAAC;AAO3B,OAAO,gBAAgB,CAAC;AAExB,MAAM,WAAW,qBAAqB;IACpC,kCAAkC;IAClC,MAAM,EAAE,YAAY,CAAC;IACrB,4EAA4E;IAC5E,YAAY,CAAC,EAAE,kBAAkB,CAAC;IAClC;;;;;;;OAOG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB;;;;OAIG;IACH,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB;AASD;;;;;;;;GAQG;AACH,wBAAgB,gBAAgB,CAAC,EAC/B,MAAM,EACN,YAAY,EACZ,QAAQ,EACR,WAAmB,GACpB,EAAE,qBAAqB,+BAuDvB"}
@@ -0,0 +1,33 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { DEFAULT_TEMPLATE_ID, } from '@resumekit/schema';
3
+ import { TEMPLATE_RENDERERS } from './registry.js';
4
+ import { presentedResume } from './presented.js';
5
+ import { PagedSheet } from './PagedSheet.js';
6
+ import { DocumentPresentationProvider } from './presentation-context.js';
7
+ import { DocumentSpacingProvider } from './spacing/spacing-context.js';
8
+ import { DocumentOverlayProvider } from './collections/overlay-context.js';
9
+ import './document.css';
10
+ /**
11
+ * Below this a page is unreadable anyway; it scrolls rather than shrinks.
12
+ * 0.3 is what a 320px phone needs once the card's padding is taken: at 0.35 the
13
+ * page was wider than its card there and lost its right edge.
14
+ */
15
+ const SHRINK_MIN = 0.3;
16
+ /**
17
+ * A resume rendered read-only in its template.
18
+ *
19
+ * The same component tree the designer edits, mounted with `enabled={false}` so
20
+ * nothing is selectable and no field ever becomes an input. Reusing the tree
21
+ * rather than writing a second renderer is what guarantees the read-only view
22
+ * and the editable one cannot drift apart — there is one Harvard template, not a
23
+ * viewing copy and an editing copy.
24
+ */
25
+ export function TemplateDocument({ resume, presentation, sheetGap, shrinkToFit = false, }) {
26
+ const templateId = presentation?.template_id ?? DEFAULT_TEMPLATE_ID;
27
+ const { Document } = TEMPLATE_RENDERERS[templateId];
28
+ const presented = presentedResume(resume, presentation?.edits ?? []);
29
+ return (_jsx("div", { className: "tpl-editor tpl-editor--static", children: _jsx(DocumentPresentationProvider, { style: presentation?.style, formats: presentation?.formats, language: presentation?.language, children: _jsx(DocumentOverlayProvider, { base: resume, edits: presentation?.edits ?? [], children: _jsx(DocumentSpacingProvider, { value: { sections: presentation?.section_spacing }, children: _jsx(PagedSheet, { sheetGap: sheetGap, minZoom: shrinkToFit ? SHRINK_MIN : 1, measureKey: JSON.stringify([
30
+ presentation?.style,
31
+ presentation?.section_spacing,
32
+ ]), children: _jsx(Document, { resume: presented }) }) }) }) }) }));
33
+ }