@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.
- package/LICENSE +21 -0
- package/README.md +74 -2
- package/dist/PagedSheet.d.ts +63 -0
- package/dist/PagedSheet.d.ts.map +1 -0
- package/dist/PagedSheet.js +584 -0
- package/dist/TemplateDocument.d.ts +33 -0
- package/dist/TemplateDocument.d.ts.map +1 -0
- package/dist/TemplateDocument.js +33 -0
- package/dist/autosave-context.d.ts +37 -0
- package/dist/autosave-context.d.ts.map +1 -0
- package/dist/autosave-context.js +24 -0
- package/dist/collections/AuthoredItems.d.ts +9 -0
- package/dist/collections/AuthoredItems.d.ts.map +1 -0
- package/dist/collections/AuthoredItems.js +116 -0
- package/dist/collections/Collection.d.ts +48 -0
- package/dist/collections/Collection.d.ts.map +1 -0
- package/dist/collections/Collection.js +24 -0
- package/dist/collections/CollectionItems.d.ts +94 -0
- package/dist/collections/CollectionItems.d.ts.map +1 -0
- package/dist/collections/CollectionItems.js +91 -0
- package/dist/collections/EntryOverlay.d.ts +38 -0
- package/dist/collections/EntryOverlay.d.ts.map +1 -0
- package/dist/collections/EntryOverlay.js +51 -0
- package/dist/collections/SortableItems.d.ts +52 -0
- package/dist/collections/SortableItems.d.ts.map +1 -0
- package/dist/collections/SortableItems.js +80 -0
- package/dist/collections/authoring-context.d.ts +69 -0
- package/dist/collections/authoring-context.d.ts.map +1 -0
- package/dist/collections/authoring-context.js +36 -0
- package/dist/collections/collection.css +462 -0
- package/dist/collections/entry-text.d.ts +23 -0
- package/dist/collections/entry-text.d.ts.map +1 -0
- package/dist/collections/entry-text.js +35 -0
- package/dist/collections/icons.d.ts +53 -0
- package/dist/collections/icons.d.ts.map +1 -0
- package/dist/collections/icons.js +56 -0
- package/dist/collections/library/LibraryAction.d.ts +24 -0
- package/dist/collections/library/LibraryAction.d.ts.map +1 -0
- package/dist/collections/library/LibraryAction.js +122 -0
- package/dist/collections/library/LibraryPicker.d.ts +42 -0
- package/dist/collections/library/LibraryPicker.d.ts.map +1 -0
- package/dist/collections/library/LibraryPicker.js +94 -0
- package/dist/collections/library/library.css +435 -0
- package/dist/collections/overlay-context.d.ts +34 -0
- package/dist/collections/overlay-context.d.ts.map +1 -0
- package/dist/collections/overlay-context.js +13 -0
- package/dist/collections/preload.d.ts +19 -0
- package/dist/collections/preload.d.ts.map +1 -0
- package/dist/collections/preload.js +23 -0
- package/dist/collections/selection-context.d.ts +25 -0
- package/dist/collections/selection-context.d.ts.map +1 -0
- package/dist/collections/selection-context.js +49 -0
- package/dist/collections/useCollection.d.ts +58 -0
- package/dist/collections/useCollection.d.ts.map +1 -0
- package/dist/collections/useCollection.js +90 -0
- package/dist/collections/useCustomEntries.d.ts +18 -0
- package/dist/collections/useCustomEntries.d.ts.map +1 -0
- package/dist/collections/useCustomEntries.js +56 -0
- package/dist/collections/useSectionCollection.d.ts +48 -0
- package/dist/collections/useSectionCollection.d.ts.map +1 -0
- package/dist/collections/useSectionCollection.js +169 -0
- package/dist/document.css +185 -0
- package/dist/export-bundle/bundle.css +2 -0
- package/dist/export-bundle/bundle.js +67 -0
- package/dist/fields/date-issues-context.d.ts +20 -0
- package/dist/fields/date-issues-context.d.ts.map +1 -0
- package/dist/fields/date-issues-context.js +68 -0
- package/dist/fields/field-registry.d.ts +163 -0
- package/dist/fields/field-registry.d.ts.map +1 -0
- package/dist/fields/field-registry.js +175 -0
- package/dist/fonts/README.md +207 -0
- package/dist/fonts/arimo-400.woff2 +0 -0
- package/dist/fonts/arimo-400i.woff2 +0 -0
- package/dist/fonts/arimo-700.woff2 +0 -0
- package/dist/fonts/arimo-700i.woff2 +0 -0
- package/dist/fonts/bitter-400.woff2 +0 -0
- package/dist/fonts/bitter-400i.woff2 +0 -0
- package/dist/fonts/bitter-700.woff2 +0 -0
- package/dist/fonts/bitter-700i.woff2 +0 -0
- package/dist/fonts/cabin-700.woff2 +0 -0
- package/dist/fonts/carlito-400.woff2 +0 -0
- package/dist/fonts/carlito-400i.woff2 +0 -0
- package/dist/fonts/carlito-700.woff2 +0 -0
- package/dist/fonts/carlito-700i.woff2 +0 -0
- package/dist/fonts/clearsans-400.woff2 +0 -0
- package/dist/fonts/clearsans-400i.woff2 +0 -0
- package/dist/fonts/cochineal-400.woff2 +0 -0
- package/dist/fonts/cochineal-400i.woff2 +0 -0
- package/dist/fonts/cochineal-700.woff2 +0 -0
- package/dist/fonts/ebgaramond-400.woff2 +0 -0
- package/dist/fonts/ebgaramond-400i.woff2 +0 -0
- package/dist/fonts/ebgaramond-700.woff2 +0 -0
- package/dist/fonts/ebgaramond-700i.woff2 +0 -0
- package/dist/fonts/fonts.css +622 -0
- package/dist/fonts/gelasio-400.woff2 +0 -0
- package/dist/fonts/gelasio-400i.woff2 +0 -0
- package/dist/fonts/gelasio-700.woff2 +0 -0
- package/dist/fonts/gelasio-700i.woff2 +0 -0
- package/dist/fonts/heros-400.woff2 +0 -0
- package/dist/fonts/heros-400i.woff2 +0 -0
- package/dist/fonts/heros-700.woff2 +0 -0
- package/dist/fonts/heros-700i.woff2 +0 -0
- package/dist/fonts/inconsolata-400.woff2 +0 -0
- package/dist/fonts/lato-100.woff2 +0 -0
- package/dist/fonts/lato-300.woff2 +0 -0
- package/dist/fonts/lato-300i.woff2 +0 -0
- package/dist/fonts/lato-400.woff2 +0 -0
- package/dist/fonts/lato-400i.woff2 +0 -0
- package/dist/fonts/lato-700.woff2 +0 -0
- package/dist/fonts/lato-700i.woff2 +0 -0
- package/dist/fonts/licenses/arimo-OFL.txt +93 -0
- package/dist/fonts/licenses/bitter-OFL.txt +94 -0
- package/dist/fonts/licenses/cabin-OFL.txt +93 -0
- package/dist/fonts/licenses/carlito-OFL.txt +94 -0
- package/dist/fonts/licenses/clearsans-APACHE-2.0.txt +205 -0
- package/dist/fonts/licenses/cochineal-OFL.txt +96 -0
- package/dist/fonts/licenses/ebgaramond-OFL.txt +93 -0
- package/dist/fonts/licenses/gelasio-OFL.txt +93 -0
- package/dist/fonts/licenses/heros-GUST-FONT-LICENSE.txt +30 -0
- package/dist/fonts/licenses/inconsolata-OFL.txt +93 -0
- package/dist/fonts/licenses/latinmodern-GUST-FONT-LICENSE.txt +35 -0
- package/dist/fonts/licenses/lato-OFL.txt +93 -0
- package/dist/fonts/licenses/ptserif-OFL.txt +93 -0
- package/dist/fonts/licenses/raleway-OFL.txt +93 -0
- package/dist/fonts/licenses/roboto-OFL.txt +93 -0
- package/dist/fonts/licenses/robotocondensed-OFL.txt +93 -0
- package/dist/fonts/licenses/robotoslab-APACHE-2.0.txt +205 -0
- package/dist/fonts/licenses/sourcesans3-OFL.txt +93 -0
- package/dist/fonts/licenses/tinos-OFL.txt +93 -0
- package/dist/fonts/lmmono-400.woff2 +0 -0
- package/dist/fonts/lmroman-400.woff2 +0 -0
- package/dist/fonts/lmroman-400i.woff2 +0 -0
- package/dist/fonts/lmroman-700.woff2 +0 -0
- package/dist/fonts/lmroman-700i.woff2 +0 -0
- package/dist/fonts/lmromancaps-400.woff2 +0 -0
- package/dist/fonts/ptserif-400.woff2 +0 -0
- package/dist/fonts/ptserif-400i.woff2 +0 -0
- package/dist/fonts/ptserif-700.woff2 +0 -0
- package/dist/fonts/ptserif-700i.woff2 +0 -0
- package/dist/fonts/raleway-300.woff2 +0 -0
- package/dist/fonts/raleway-400.woff2 +0 -0
- package/dist/fonts/raleway-400i.woff2 +0 -0
- package/dist/fonts/raleway-500.woff2 +0 -0
- package/dist/fonts/raleway-700.woff2 +0 -0
- package/dist/fonts/roboto-100.woff2 +0 -0
- package/dist/fonts/roboto-300.woff2 +0 -0
- package/dist/fonts/roboto-300i.woff2 +0 -0
- package/dist/fonts/roboto-400.woff2 +0 -0
- package/dist/fonts/roboto-400i.woff2 +0 -0
- package/dist/fonts/roboto-700.woff2 +0 -0
- package/dist/fonts/robotocondensed-400.woff2 +0 -0
- package/dist/fonts/robotocondensed-400i.woff2 +0 -0
- package/dist/fonts/robotocondensed-700.woff2 +0 -0
- package/dist/fonts/robotocondensed-700i.woff2 +0 -0
- package/dist/fonts/robotoslab-700.woff2 +0 -0
- package/dist/fonts/sourcesans3-300.woff2 +0 -0
- package/dist/fonts/sourcesans3-300i.woff2 +0 -0
- package/dist/fonts/sourcesans3-400.woff2 +0 -0
- package/dist/fonts/sourcesans3-400i.woff2 +0 -0
- package/dist/fonts/sourcesans3-700.woff2 +0 -0
- package/dist/fonts/tinos-400.woff2 +0 -0
- package/dist/fonts/tinos-400i.woff2 +0 -0
- package/dist/fonts/tinos-700.woff2 +0 -0
- package/dist/fonts/tinos-700i.woff2 +0 -0
- package/dist/i18n/README.md +52 -0
- package/dist/i18n/catalog.d.ts +39 -0
- package/dist/i18n/catalog.d.ts.map +1 -0
- package/dist/i18n/catalog.js +43 -0
- package/dist/i18n/format.d.ts +14 -0
- package/dist/i18n/format.d.ts.map +1 -0
- package/dist/i18n/format.js +38 -0
- package/dist/i18n/index.d.ts +4 -0
- package/dist/i18n/index.d.ts.map +1 -0
- package/dist/i18n/index.js +3 -0
- package/dist/i18n/locale-context.d.ts +43 -0
- package/dist/i18n/locale-context.d.ts.map +1 -0
- package/dist/i18n/locale-context.js +74 -0
- package/dist/i18n/locales/en.json +337 -0
- package/dist/i18n/locales/es.json +337 -0
- package/dist/index.d.ts +101 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +99 -0
- package/dist/kit/BulletSkillGroup.d.ts +20 -0
- package/dist/kit/BulletSkillGroup.d.ts.map +1 -0
- package/dist/kit/BulletSkillGroup.js +25 -0
- package/dist/kit/DescribedEntries.d.ts +41 -0
- package/dist/kit/DescribedEntries.d.ts.map +1 -0
- package/dist/kit/DescribedEntries.js +57 -0
- package/dist/kit/DocumentSection.d.ts +58 -0
- package/dist/kit/DocumentSection.d.ts.map +1 -0
- package/dist/kit/DocumentSection.js +38 -0
- package/dist/kit/GridSkillGroup.d.ts +12 -0
- package/dist/kit/GridSkillGroup.d.ts.map +1 -0
- package/dist/kit/GridSkillGroup.js +14 -0
- package/dist/kit/Heading.d.ts +11 -0
- package/dist/kit/Heading.d.ts.map +1 -0
- package/dist/kit/Heading.js +10 -0
- package/dist/kit/InitialsAvatar.d.ts +17 -0
- package/dist/kit/InitialsAvatar.d.ts.map +1 -0
- package/dist/kit/InitialsAvatar.js +18 -0
- package/dist/kit/InitialsChip.d.ts +16 -0
- package/dist/kit/InitialsChip.d.ts.map +1 -0
- package/dist/kit/InitialsChip.js +16 -0
- package/dist/kit/InlineSkillGroup.d.ts +22 -0
- package/dist/kit/InlineSkillGroup.d.ts.map +1 -0
- package/dist/kit/InlineSkillGroup.js +16 -0
- package/dist/kit/LabelledSkillGroup.d.ts +24 -0
- package/dist/kit/LabelledSkillGroup.d.ts.map +1 -0
- package/dist/kit/LabelledSkillGroup.js +20 -0
- package/dist/kit/LanguageList.d.ts +28 -0
- package/dist/kit/LanguageList.d.ts.map +1 -0
- package/dist/kit/LanguageList.js +56 -0
- package/dist/kit/Separator.d.ts +20 -0
- package/dist/kit/Separator.d.ts.map +1 -0
- package/dist/kit/Separator.js +21 -0
- package/dist/kit/TagSkillGroup.d.ts +8 -0
- package/dist/kit/TagSkillGroup.d.ts.map +1 -0
- package/dist/kit/TagSkillGroup.js +10 -0
- package/dist/kit/avatar.css +42 -0
- package/dist/kit/contact-icons.css +70 -0
- package/dist/kit/contact.d.ts +16 -0
- package/dist/kit/contact.d.ts.map +1 -0
- package/dist/kit/contact.js +18 -0
- package/dist/kit/described.css +114 -0
- package/dist/kit/documentStyle.d.ts +12 -0
- package/dist/kit/documentStyle.d.ts.map +1 -0
- package/dist/kit/documentStyle.js +24 -0
- package/dist/kit/heading.css +17 -0
- package/dist/kit/keywords.css +127 -0
- package/dist/kit/language.css +104 -0
- package/dist/kit/layout.css +16 -0
- package/dist/kit/monogram.d.ts +6 -0
- package/dist/kit/monogram.d.ts.map +1 -0
- package/dist/kit/monogram.js +12 -0
- package/dist/kit/panel.css +26 -0
- package/dist/kit/skill-grid.css +93 -0
- package/dist/kit/skill-tags.css +36 -0
- package/dist/kit/textShapes.d.ts +24 -0
- package/dist/kit/textShapes.d.ts.map +1 -0
- package/dist/kit/textShapes.js +32 -0
- package/dist/letter/LetterDocument.d.ts +13 -0
- package/dist/letter/LetterDocument.d.ts.map +1 -0
- package/dist/letter/LetterDocument.js +12 -0
- package/dist/letter/letter.css +75 -0
- package/dist/nodes/AuthoredBullets.d.ts +22 -0
- package/dist/nodes/AuthoredBullets.d.ts.map +1 -0
- package/dist/nodes/AuthoredBullets.js +101 -0
- package/dist/nodes/CustomSections.d.ts +42 -0
- package/dist/nodes/CustomSections.d.ts.map +1 -0
- package/dist/nodes/CustomSections.js +27 -0
- package/dist/nodes/EditableBulletList.d.ts +15 -0
- package/dist/nodes/EditableBulletList.d.ts.map +1 -0
- package/dist/nodes/EditableBulletList.js +98 -0
- package/dist/nodes/EditableInlineList.d.ts +27 -0
- package/dist/nodes/EditableInlineList.d.ts.map +1 -0
- package/dist/nodes/EditableInlineList.js +50 -0
- package/dist/nodes/EditableText.d.ts +79 -0
- package/dist/nodes/EditableText.d.ts.map +1 -0
- package/dist/nodes/EditableText.js +113 -0
- package/dist/nodes/LinkField.d.ts +103 -0
- package/dist/nodes/LinkField.d.ts.map +1 -0
- package/dist/nodes/LinkField.js +277 -0
- package/dist/nodes/PlainTextField.d.ts +38 -0
- package/dist/nodes/PlainTextField.d.ts.map +1 -0
- package/dist/nodes/PlainTextField.js +72 -0
- package/dist/nodes/formatting.d.ts +34 -0
- package/dist/nodes/formatting.d.ts.map +1 -0
- package/dist/nodes/formatting.js +24 -0
- package/dist/nodes/link-field.css +200 -0
- package/dist/nodes/locked.d.ts +38 -0
- package/dist/nodes/locked.d.ts.map +1 -0
- package/dist/nodes/locked.js +65 -0
- package/dist/nodes/template-node.css +720 -0
- package/dist/paged.css +265 -0
- package/dist/pagination.d.ts +93 -0
- package/dist/pagination.d.ts.map +1 -0
- package/dist/pagination.js +167 -0
- package/dist/picture-context.d.ts +6 -0
- package/dist/picture-context.d.ts.map +1 -0
- package/dist/picture-context.js +14 -0
- package/dist/presentation-context.d.ts +45 -0
- package/dist/presentation-context.d.ts.map +1 -0
- package/dist/presentation-context.js +44 -0
- package/dist/presented.d.ts +16 -0
- package/dist/presented.d.ts.map +1 -0
- package/dist/presented.js +22 -0
- package/dist/rail/ContainerRail.d.ts +29 -0
- package/dist/rail/ContainerRail.d.ts.map +1 -0
- package/dist/rail/ContainerRail.js +50 -0
- package/dist/rail/EntryActions.d.ts +19 -0
- package/dist/rail/EntryActions.d.ts.map +1 -0
- package/dist/rail/EntryActions.js +17 -0
- package/dist/rail/rail-store.d.ts +42 -0
- package/dist/rail/rail-store.d.ts.map +1 -0
- package/dist/rail/rail-store.js +107 -0
- package/dist/rail/rail.css +188 -0
- package/dist/rail/useSpaceDrag.d.ts +30 -0
- package/dist/rail/useSpaceDrag.d.ts.map +1 -0
- package/dist/rail/useSpaceDrag.js +154 -0
- package/dist/registry.d.ts +35 -0
- package/dist/registry.d.ts.map +1 -0
- package/dist/registry.js +74 -0
- package/dist/spacing/spacing-context.d.ts +53 -0
- package/dist/spacing/spacing-context.d.ts.map +1 -0
- package/dist/spacing/spacing-context.js +36 -0
- package/dist/spacing/spacing.css +159 -0
- package/dist/spacing/useSpaceSlot.d.ts +52 -0
- package/dist/spacing/useSpaceSlot.d.ts.map +1 -0
- package/dist/spacing/useSpaceSlot.js +38 -0
- package/dist/static/api.d.ts +13 -0
- package/dist/static/api.d.ts.map +1 -0
- package/dist/static/api.js +1 -0
- package/dist/static/static.mjs +33779 -0
- package/dist/static/templates/academic.css +1 -0
- package/dist/static/templates/alta.css +1 -0
- package/dist/static/templates/classic.css +1 -0
- package/dist/static/templates/cobalt.css +1 -0
- package/dist/static/templates/compact.css +1 -0
- package/dist/static/templates/contemporary.css +1 -0
- package/dist/static/templates/creative.css +1 -0
- package/dist/static/templates/crimson.css +1 -0
- package/dist/static/templates/curve.css +1 -0
- package/dist/static/templates/double-column-logos.css +1 -0
- package/dist/static/templates/double-column.css +1 -0
- package/dist/static/templates/elegant-logos.css +1 -0
- package/dist/static/templates/elegant.css +1 -0
- package/dist/static/templates/engineer.css +1 -0
- package/dist/static/templates/executive.css +1 -0
- package/dist/static/templates/harvard.css +1 -0
- package/dist/static/templates/hipster.css +1 -0
- package/dist/static/templates/ivy.css +1 -0
- package/dist/static/templates/meridian.css +1 -0
- package/dist/static/templates/modern.css +1 -0
- package/dist/static/templates/polished.css +1 -0
- package/dist/static/templates/portrait.css +1 -0
- package/dist/static/templates/prism.css +1 -0
- package/dist/static/templates/scholar.css +1 -0
- package/dist/static/templates/split.css +1 -0
- package/dist/static/templates/stylish.css +1 -0
- package/dist/static/templates/timeline.css +1 -0
- package/dist/static/templates.css +1 -0
- package/dist/templates/academic/AcademicDocument.d.ts +6 -0
- package/dist/templates/academic/AcademicDocument.d.ts.map +1 -0
- package/dist/templates/academic/AcademicDocument.js +29 -0
- package/dist/templates/academic/academic.css +284 -0
- package/dist/templates/academic/entries.d.ts +22 -0
- package/dist/templates/academic/entries.d.ts.map +1 -0
- package/dist/templates/academic/entries.js +17 -0
- package/dist/templates/alta/AltaDocument.d.ts +6 -0
- package/dist/templates/alta/AltaDocument.d.ts.map +1 -0
- package/dist/templates/alta/AltaDocument.js +29 -0
- package/dist/templates/alta/alta.css +413 -0
- package/dist/templates/alta/entries.d.ts +22 -0
- package/dist/templates/alta/entries.d.ts.map +1 -0
- package/dist/templates/alta/entries.js +17 -0
- package/dist/templates/classic/ClassicDocument.d.ts +6 -0
- package/dist/templates/classic/ClassicDocument.d.ts.map +1 -0
- package/dist/templates/classic/ClassicDocument.js +26 -0
- package/dist/templates/classic/classic.css +251 -0
- package/dist/templates/classic/entries.d.ts +22 -0
- package/dist/templates/classic/entries.d.ts.map +1 -0
- package/dist/templates/classic/entries.js +17 -0
- package/dist/templates/cobalt/CobaltDocument.d.ts +6 -0
- package/dist/templates/cobalt/CobaltDocument.d.ts.map +1 -0
- package/dist/templates/cobalt/CobaltDocument.js +28 -0
- package/dist/templates/cobalt/cobalt.css +478 -0
- package/dist/templates/cobalt/crest.d.ts +6 -0
- package/dist/templates/cobalt/crest.d.ts.map +1 -0
- package/dist/templates/cobalt/crest.js +8 -0
- package/dist/templates/cobalt/entries.d.ts +22 -0
- package/dist/templates/cobalt/entries.d.ts.map +1 -0
- package/dist/templates/cobalt/entries.js +17 -0
- package/dist/templates/compact/CompactDocument.d.ts +6 -0
- package/dist/templates/compact/CompactDocument.d.ts.map +1 -0
- package/dist/templates/compact/CompactDocument.js +28 -0
- package/dist/templates/compact/compact.css +240 -0
- package/dist/templates/compact/entries.d.ts +22 -0
- package/dist/templates/compact/entries.d.ts.map +1 -0
- package/dist/templates/compact/entries.js +17 -0
- package/dist/templates/contemporary/ContemporaryDocument.d.ts +6 -0
- package/dist/templates/contemporary/ContemporaryDocument.d.ts.map +1 -0
- package/dist/templates/contemporary/ContemporaryDocument.js +29 -0
- package/dist/templates/contemporary/contemporary.css +411 -0
- package/dist/templates/contemporary/entries.d.ts +22 -0
- package/dist/templates/contemporary/entries.d.ts.map +1 -0
- package/dist/templates/contemporary/entries.js +17 -0
- package/dist/templates/creative/CreativeDocument.d.ts +6 -0
- package/dist/templates/creative/CreativeDocument.d.ts.map +1 -0
- package/dist/templates/creative/CreativeDocument.js +29 -0
- package/dist/templates/creative/creative.css +326 -0
- package/dist/templates/creative/entries.d.ts +22 -0
- package/dist/templates/creative/entries.d.ts.map +1 -0
- package/dist/templates/creative/entries.js +17 -0
- package/dist/templates/crimson/CrimsonDocument.d.ts +6 -0
- package/dist/templates/crimson/CrimsonDocument.d.ts.map +1 -0
- package/dist/templates/crimson/CrimsonDocument.js +30 -0
- package/dist/templates/crimson/crimson.css +301 -0
- package/dist/templates/crimson/entries.d.ts +22 -0
- package/dist/templates/crimson/entries.d.ts.map +1 -0
- package/dist/templates/crimson/entries.js +17 -0
- package/dist/templates/curve/CurveDocument.d.ts +6 -0
- package/dist/templates/curve/CurveDocument.d.ts.map +1 -0
- package/dist/templates/curve/CurveDocument.js +29 -0
- package/dist/templates/curve/curve.css +330 -0
- package/dist/templates/curve/entries.d.ts +22 -0
- package/dist/templates/curve/entries.d.ts.map +1 -0
- package/dist/templates/curve/entries.js +17 -0
- package/dist/templates/double-column/DoubleColumnDocument.d.ts +6 -0
- package/dist/templates/double-column/DoubleColumnDocument.d.ts.map +1 -0
- package/dist/templates/double-column/DoubleColumnDocument.js +29 -0
- package/dist/templates/double-column/double-column.css +331 -0
- package/dist/templates/double-column/entries.d.ts +22 -0
- package/dist/templates/double-column/entries.d.ts.map +1 -0
- package/dist/templates/double-column/entries.js +17 -0
- package/dist/templates/double-column-logos/DoubleColumnLogosDocument.d.ts +6 -0
- package/dist/templates/double-column-logos/DoubleColumnLogosDocument.d.ts.map +1 -0
- package/dist/templates/double-column-logos/DoubleColumnLogosDocument.js +28 -0
- package/dist/templates/double-column-logos/double-column-logos.css +333 -0
- package/dist/templates/double-column-logos/entries.d.ts +22 -0
- package/dist/templates/double-column-logos/entries.d.ts.map +1 -0
- package/dist/templates/double-column-logos/entries.js +18 -0
- package/dist/templates/elegant/ElegantDocument.d.ts +6 -0
- package/dist/templates/elegant/ElegantDocument.d.ts.map +1 -0
- package/dist/templates/elegant/ElegantDocument.js +31 -0
- package/dist/templates/elegant/elegant.css +358 -0
- package/dist/templates/elegant/entries.d.ts +22 -0
- package/dist/templates/elegant/entries.d.ts.map +1 -0
- package/dist/templates/elegant/entries.js +17 -0
- package/dist/templates/elegant-logos/ElegantLogosDocument.d.ts +6 -0
- package/dist/templates/elegant-logos/ElegantLogosDocument.d.ts.map +1 -0
- package/dist/templates/elegant-logos/ElegantLogosDocument.js +30 -0
- package/dist/templates/elegant-logos/elegant-logos.css +370 -0
- package/dist/templates/elegant-logos/entries.d.ts +22 -0
- package/dist/templates/elegant-logos/entries.d.ts.map +1 -0
- package/dist/templates/elegant-logos/entries.js +18 -0
- package/dist/templates/engineer/EngineerDocument.d.ts +6 -0
- package/dist/templates/engineer/EngineerDocument.d.ts.map +1 -0
- package/dist/templates/engineer/EngineerDocument.js +26 -0
- package/dist/templates/engineer/engineer.css +261 -0
- package/dist/templates/engineer/entries.d.ts +22 -0
- package/dist/templates/engineer/entries.d.ts.map +1 -0
- package/dist/templates/engineer/entries.js +17 -0
- package/dist/templates/executive/ExecutiveDocument.d.ts +6 -0
- package/dist/templates/executive/ExecutiveDocument.d.ts.map +1 -0
- package/dist/templates/executive/ExecutiveDocument.js +29 -0
- package/dist/templates/executive/entries.d.ts +22 -0
- package/dist/templates/executive/entries.d.ts.map +1 -0
- package/dist/templates/executive/entries.js +17 -0
- package/dist/templates/executive/executive.css +394 -0
- package/dist/templates/harvard/HarvardDocument.d.ts +6 -0
- package/dist/templates/harvard/HarvardDocument.d.ts.map +1 -0
- package/dist/templates/harvard/HarvardDocument.js +25 -0
- package/dist/templates/harvard/entries.d.ts +28 -0
- package/dist/templates/harvard/entries.d.ts.map +1 -0
- package/dist/templates/harvard/entries.js +22 -0
- package/dist/templates/harvard/harvard.css +436 -0
- package/dist/templates/hipster/HipsterDocument.d.ts +6 -0
- package/dist/templates/hipster/HipsterDocument.d.ts.map +1 -0
- package/dist/templates/hipster/HipsterDocument.js +30 -0
- package/dist/templates/hipster/entries.d.ts +22 -0
- package/dist/templates/hipster/entries.d.ts.map +1 -0
- package/dist/templates/hipster/entries.js +17 -0
- package/dist/templates/hipster/hipster.css +442 -0
- package/dist/templates/ivy/IvyDocument.d.ts +6 -0
- package/dist/templates/ivy/IvyDocument.d.ts.map +1 -0
- package/dist/templates/ivy/IvyDocument.js +26 -0
- package/dist/templates/ivy/entries.d.ts +22 -0
- package/dist/templates/ivy/entries.d.ts.map +1 -0
- package/dist/templates/ivy/entries.js +17 -0
- package/dist/templates/ivy/ivy.css +292 -0
- package/dist/templates/meridian/MeridianDocument.d.ts +6 -0
- package/dist/templates/meridian/MeridianDocument.d.ts.map +1 -0
- package/dist/templates/meridian/MeridianDocument.js +28 -0
- package/dist/templates/meridian/entries.d.ts +22 -0
- package/dist/templates/meridian/entries.d.ts.map +1 -0
- package/dist/templates/meridian/entries.js +17 -0
- package/dist/templates/meridian/meridian.css +431 -0
- package/dist/templates/modern/ModernDocument.d.ts +6 -0
- package/dist/templates/modern/ModernDocument.d.ts.map +1 -0
- package/dist/templates/modern/ModernDocument.js +29 -0
- package/dist/templates/modern/entries.d.ts +22 -0
- package/dist/templates/modern/entries.d.ts.map +1 -0
- package/dist/templates/modern/entries.js +17 -0
- package/dist/templates/modern/modern.css +309 -0
- package/dist/templates/polished/PolishedDocument.d.ts +6 -0
- package/dist/templates/polished/PolishedDocument.d.ts.map +1 -0
- package/dist/templates/polished/PolishedDocument.js +28 -0
- package/dist/templates/polished/entries.d.ts +22 -0
- package/dist/templates/polished/entries.d.ts.map +1 -0
- package/dist/templates/polished/entries.js +17 -0
- package/dist/templates/polished/polished.css +327 -0
- package/dist/templates/portrait/PortraitDocument.d.ts +6 -0
- package/dist/templates/portrait/PortraitDocument.d.ts.map +1 -0
- package/dist/templates/portrait/PortraitDocument.js +30 -0
- package/dist/templates/portrait/entries.d.ts +22 -0
- package/dist/templates/portrait/entries.d.ts.map +1 -0
- package/dist/templates/portrait/entries.js +17 -0
- package/dist/templates/portrait/portrait.css +427 -0
- package/dist/templates/prism/PrismDocument.d.ts +6 -0
- package/dist/templates/prism/PrismDocument.d.ts.map +1 -0
- package/dist/templates/prism/PrismDocument.js +35 -0
- package/dist/templates/prism/entries.d.ts +22 -0
- package/dist/templates/prism/entries.d.ts.map +1 -0
- package/dist/templates/prism/entries.js +17 -0
- package/dist/templates/prism/prism.css +314 -0
- package/dist/templates/scholar/ScholarDocument.d.ts +6 -0
- package/dist/templates/scholar/ScholarDocument.d.ts.map +1 -0
- package/dist/templates/scholar/ScholarDocument.js +27 -0
- package/dist/templates/scholar/entries.d.ts +22 -0
- package/dist/templates/scholar/entries.d.ts.map +1 -0
- package/dist/templates/scholar/entries.js +17 -0
- package/dist/templates/scholar/scholar.css +279 -0
- package/dist/templates/skills.d.ts +19 -0
- package/dist/templates/skills.d.ts.map +1 -0
- package/dist/templates/skills.js +19 -0
- package/dist/templates/split/SplitDocument.d.ts +6 -0
- package/dist/templates/split/SplitDocument.d.ts.map +1 -0
- package/dist/templates/split/SplitDocument.js +29 -0
- package/dist/templates/split/entries.d.ts +22 -0
- package/dist/templates/split/entries.d.ts.map +1 -0
- package/dist/templates/split/entries.js +17 -0
- package/dist/templates/split/split.css +337 -0
- package/dist/templates/stylish/StylishDocument.d.ts +6 -0
- package/dist/templates/stylish/StylishDocument.d.ts.map +1 -0
- package/dist/templates/stylish/StylishDocument.js +29 -0
- package/dist/templates/stylish/entries.d.ts +22 -0
- package/dist/templates/stylish/entries.d.ts.map +1 -0
- package/dist/templates/stylish/entries.js +17 -0
- package/dist/templates/stylish/stylish.css +340 -0
- package/dist/templates/timeline/TimelineDocument.d.ts +6 -0
- package/dist/templates/timeline/TimelineDocument.d.ts.map +1 -0
- package/dist/templates/timeline/TimelineDocument.js +27 -0
- package/dist/templates/timeline/entries.d.ts +22 -0
- package/dist/templates/timeline/entries.d.ts.map +1 -0
- package/dist/templates/timeline/entries.js +17 -0
- package/dist/templates/timeline/timeline.css +295 -0
- package/dist/useFitZoom.d.ts +99 -0
- package/dist/useFitZoom.d.ts.map +1 -0
- package/dist/useFitZoom.js +171 -0
- package/package.json +81 -3
- package/src/PagedSheet.tsx +792 -0
- package/src/TemplateDocument.tsx +112 -0
- package/src/autosave-context.tsx +67 -0
- package/src/collections/AuthoredItems.tsx +199 -0
- package/src/collections/Collection.tsx +73 -0
- package/src/collections/CollectionItems.tsx +318 -0
- package/src/collections/EntryOverlay.tsx +162 -0
- package/src/collections/SortableItems.tsx +167 -0
- package/src/collections/authoring-context.tsx +140 -0
- package/src/collections/entry-text.ts +41 -0
- package/src/collections/icons.tsx +83 -0
- package/src/collections/library/LibraryAction.tsx +200 -0
- package/src/collections/library/LibraryPicker.tsx +325 -0
- package/src/collections/overlay-context.tsx +49 -0
- package/src/collections/preload.ts +23 -0
- package/src/collections/selection-context.tsx +88 -0
- package/src/collections/useCollection.ts +133 -0
- package/src/collections/useCustomEntries.ts +84 -0
- package/src/collections/useSectionCollection.ts +268 -0
- package/src/compiler/emit.ts +736 -0
- package/src/compiler/schema.ts +689 -0
- package/src/export/entry.tsx +177 -0
- package/src/fields/date-issues-context.tsx +105 -0
- package/src/fields/field-registry.tsx +358 -0
- package/src/i18n/catalog.ts +81 -0
- package/src/i18n/format.ts +50 -0
- package/src/i18n/index.ts +21 -0
- package/src/i18n/locale-context.tsx +135 -0
- package/src/index.ts +156 -0
- package/src/kit/BulletSkillGroup.tsx +37 -0
- package/src/kit/DescribedEntries.tsx +132 -0
- package/src/kit/DocumentSection.tsx +97 -0
- package/src/kit/GridSkillGroup.tsx +17 -0
- package/src/kit/Heading.tsx +17 -0
- package/src/kit/InitialsAvatar.tsx +31 -0
- package/src/kit/InitialsChip.tsx +29 -0
- package/src/kit/InlineSkillGroup.tsx +41 -0
- package/src/kit/LabelledSkillGroup.tsx +68 -0
- package/src/kit/LanguageList.tsx +148 -0
- package/src/kit/Separator.tsx +30 -0
- package/src/kit/TagSkillGroup.tsx +19 -0
- package/src/kit/contact.ts +34 -0
- package/src/kit/documentStyle.ts +33 -0
- package/src/kit/monogram.ts +11 -0
- package/src/kit/textShapes.tsx +61 -0
- package/src/letter/LetterDocument.tsx +33 -0
- package/src/nodes/AuthoredBullets.tsx +253 -0
- package/src/nodes/CustomSections.tsx +138 -0
- package/src/nodes/EditableBulletList.tsx +186 -0
- package/src/nodes/EditableInlineList.tsx +109 -0
- package/src/nodes/EditableText.tsx +261 -0
- package/src/nodes/LinkField.tsx +438 -0
- package/src/nodes/PlainTextField.tsx +132 -0
- package/src/nodes/formatting.ts +58 -0
- package/src/nodes/locked.ts +67 -0
- package/src/pagination.ts +238 -0
- package/src/picture-context.tsx +18 -0
- package/src/presentation-context.tsx +87 -0
- package/src/presented.ts +29 -0
- package/src/rail/ContainerRail.tsx +145 -0
- package/src/rail/EntryActions.tsx +104 -0
- package/src/rail/rail-store.tsx +126 -0
- package/src/rail/useSpaceDrag.ts +177 -0
- package/src/registry.ts +101 -0
- package/src/spacing/spacing-context.tsx +100 -0
- package/src/spacing/useSpaceSlot.tsx +97 -0
- package/src/static/api.ts +19 -0
- package/src/static/fixtures.ts +80 -0
- package/src/static/render.tsx +24 -0
- package/src/templates/academic/AcademicDocument.tsx +255 -0
- package/src/templates/academic/entries.tsx +176 -0
- package/src/templates/alta/AltaDocument.tsx +265 -0
- package/src/templates/alta/entries.tsx +167 -0
- package/src/templates/classic/ClassicDocument.tsx +248 -0
- package/src/templates/classic/entries.tsx +175 -0
- package/src/templates/cobalt/CobaltDocument.tsx +302 -0
- package/src/templates/cobalt/crest.tsx +31 -0
- package/src/templates/cobalt/entries.tsx +136 -0
- package/src/templates/compact/CompactDocument.tsx +256 -0
- package/src/templates/compact/entries.tsx +167 -0
- package/src/templates/contemporary/ContemporaryDocument.tsx +287 -0
- package/src/templates/contemporary/entries.tsx +167 -0
- package/src/templates/creative/CreativeDocument.tsx +269 -0
- package/src/templates/creative/entries.tsx +167 -0
- package/src/templates/crimson/CrimsonDocument.tsx +283 -0
- package/src/templates/crimson/entries.tsx +169 -0
- package/src/templates/curve/CurveDocument.tsx +259 -0
- package/src/templates/curve/entries.tsx +168 -0
- package/src/templates/double-column/DoubleColumnDocument.tsx +269 -0
- package/src/templates/double-column/entries.tsx +169 -0
- package/src/templates/double-column-logos/DoubleColumnLogosDocument.tsx +262 -0
- package/src/templates/double-column-logos/entries.tsx +172 -0
- package/src/templates/elegant/ElegantDocument.tsx +297 -0
- package/src/templates/elegant/entries.tsx +167 -0
- package/src/templates/elegant-logos/ElegantLogosDocument.tsx +291 -0
- package/src/templates/elegant-logos/entries.tsx +170 -0
- package/src/templates/engineer/EngineerDocument.tsx +248 -0
- package/src/templates/engineer/entries.tsx +170 -0
- package/src/templates/executive/ExecutiveDocument.tsx +312 -0
- package/src/templates/executive/entries.tsx +146 -0
- package/src/templates/harvard/HarvardDocument.tsx +248 -0
- package/src/templates/harvard/entries.tsx +205 -0
- package/src/templates/hipster/HipsterDocument.tsx +289 -0
- package/src/templates/hipster/entries.tsx +175 -0
- package/src/templates/ivy/IvyDocument.tsx +248 -0
- package/src/templates/ivy/entries.tsx +167 -0
- package/src/templates/meridian/MeridianDocument.tsx +304 -0
- package/src/templates/meridian/entries.tsx +140 -0
- package/src/templates/modern/ModernDocument.tsx +265 -0
- package/src/templates/modern/entries.tsx +167 -0
- package/src/templates/polished/PolishedDocument.tsx +262 -0
- package/src/templates/polished/entries.tsx +167 -0
- package/src/templates/portrait/PortraitDocument.tsx +278 -0
- package/src/templates/portrait/entries.tsx +173 -0
- package/src/templates/prism/PrismDocument.tsx +307 -0
- package/src/templates/prism/entries.tsx +175 -0
- package/src/templates/scholar/ScholarDocument.tsx +266 -0
- package/src/templates/scholar/entries.tsx +169 -0
- package/src/templates/skills.ts +21 -0
- package/src/templates/split/SplitDocument.tsx +293 -0
- package/src/templates/split/entries.tsx +164 -0
- package/src/templates/stylish/StylishDocument.tsx +265 -0
- package/src/templates/stylish/entries.tsx +167 -0
- package/src/templates/timeline/TimelineDocument.tsx +251 -0
- package/src/templates/timeline/entries.tsx +173 -0
- package/src/useFitZoom.ts +185 -0
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
import { useEffect, useRef, useState } from 'react';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* The field a candidate types a line of the résumé into.
|
|
5
|
+
*
|
|
6
|
+
* It is a `contenteditable` span rather than an `<input>` or a `<textarea>`,
|
|
7
|
+
* and that is the whole reason this component exists. A form control is an
|
|
8
|
+
* ATOMIC inline box: it can be sized to its text and it can sit in the middle
|
|
9
|
+
* of a line, but it cannot be **split across two of them**. On a résumé that is
|
|
10
|
+
* fatal — "Architecture & Quality: Distributed Systems, …" is one line of text
|
|
11
|
+
* that wraps, and a control asked to hold it had to move somewhere it fitted
|
|
12
|
+
* whole, so clicking the skills dropped them below their own category. Sizing
|
|
13
|
+
* the box more cleverly could not fix it; no amount of width makes a single box
|
|
14
|
+
* occupy the end of one line and the start of the next.
|
|
15
|
+
*
|
|
16
|
+
* An editable span is not atomic. It flows, it wraps, and it breaks across
|
|
17
|
+
* lines exactly where the static text it replaces did — which is the rule this
|
|
18
|
+
* whole layer is built on: the same box, edited or not. It also deletes the
|
|
19
|
+
* machinery that was standing in for this. There is no mirror measuring the
|
|
20
|
+
* text, no `cols` neutralising a widget's opinion of its own width, and no
|
|
21
|
+
* inline grid: an inline box is already the size of its content.
|
|
22
|
+
*
|
|
23
|
+
* `plaintext-only` is what keeps it a FIELD rather than a rich-text editor.
|
|
24
|
+
* Pasting styled markup into a plain `contenteditable` brings the markup with
|
|
25
|
+
* it, and a résumé that carries a paste's colours into the PDF is a résumé the
|
|
26
|
+
* candidate cannot see is broken.
|
|
27
|
+
*/
|
|
28
|
+
export interface PlainTextFieldProps {
|
|
29
|
+
/** The text the field opens with. Read ONCE — see `initial` below. */
|
|
30
|
+
value: string;
|
|
31
|
+
/** Shown while the field is empty. Never part of the value. */
|
|
32
|
+
placeholder?: string;
|
|
33
|
+
/** Whether Enter inserts a line break, or is refused. */
|
|
34
|
+
multiline?: boolean;
|
|
35
|
+
/** The field's accessible name — its path in the résumé. */
|
|
36
|
+
label: string;
|
|
37
|
+
onChange: (next: string) => void;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
/** One line, flattened: what a multi-line paste becomes in a single-line field. */
|
|
41
|
+
const flatten = (text: string) => text.replace(/\s*\n\s*/g, ' ');
|
|
42
|
+
|
|
43
|
+
export function PlainTextField({
|
|
44
|
+
value,
|
|
45
|
+
placeholder,
|
|
46
|
+
multiline,
|
|
47
|
+
label,
|
|
48
|
+
onChange,
|
|
49
|
+
}: PlainTextFieldProps) {
|
|
50
|
+
const el = useRef<HTMLSpanElement>(null);
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* The text is written into the DOM ONCE, when the field opens, and React is
|
|
54
|
+
* never allowed to write it again.
|
|
55
|
+
*
|
|
56
|
+
* This is the one rule a controlled `contenteditable` cannot break. Re-render
|
|
57
|
+
* it from the value and every keystroke replaces the text node the caret is
|
|
58
|
+
* standing in, so the caret jumps to the start of the field and the candidate
|
|
59
|
+
* types their sentence backwards. Frozen in state, the child React holds is
|
|
60
|
+
* identical on every subsequent render, so it reconciles to nothing and the
|
|
61
|
+
* DOM the browser is editing is left alone.
|
|
62
|
+
*
|
|
63
|
+
* The field is mounted only while it is selected, so "once" means once per
|
|
64
|
+
* visit: selecting it again re-reads whatever the value has become.
|
|
65
|
+
*/
|
|
66
|
+
const [initial] = useState(value);
|
|
67
|
+
/* Emptiness is tracked HERE and not read from the value, which arrives up to
|
|
68
|
+
half a second late — the placeholder would still be sitting beside the
|
|
69
|
+
first letter typed over it. */
|
|
70
|
+
const [empty, setEmpty] = useState(value.length === 0);
|
|
71
|
+
|
|
72
|
+
/*
|
|
73
|
+
* Selection is what reveals the field, so the click that selected it has to
|
|
74
|
+
* land in it — and the caret goes to the END, where a form control would have
|
|
75
|
+
* put it. Without this the caret sits before the first character and typing
|
|
76
|
+
* prepends.
|
|
77
|
+
*/
|
|
78
|
+
useEffect(() => {
|
|
79
|
+
const node = el.current;
|
|
80
|
+
if (!node) return;
|
|
81
|
+
/*
|
|
82
|
+
* `preventScroll`, because the field is revealed by a CLICK — it is already
|
|
83
|
+
* under the pointer, and there is nothing to scroll to. Without it the
|
|
84
|
+
* browser scrolls every ancestor to reveal the newly focused element, and
|
|
85
|
+
* inside a zoomed sheet its idea of "revealed" is not the reader's: the
|
|
86
|
+
* canvas jumped by a line or two as the caret appeared, on a page the
|
|
87
|
+
* candidate was already looking at.
|
|
88
|
+
*/
|
|
89
|
+
node.focus({ preventScroll: true });
|
|
90
|
+
const selection = window.getSelection?.();
|
|
91
|
+
if (!selection) return;
|
|
92
|
+
const range = document.createRange();
|
|
93
|
+
range.selectNodeContents(node);
|
|
94
|
+
range.collapse(false);
|
|
95
|
+
selection.removeAllRanges();
|
|
96
|
+
selection.addRange(range);
|
|
97
|
+
}, []);
|
|
98
|
+
|
|
99
|
+
const read = (node: HTMLSpanElement) => {
|
|
100
|
+
const text = node.textContent ?? '';
|
|
101
|
+
setEmpty(text.length === 0);
|
|
102
|
+
onChange(multiline ? text : flatten(text));
|
|
103
|
+
};
|
|
104
|
+
|
|
105
|
+
return (
|
|
106
|
+
<span
|
|
107
|
+
ref={el}
|
|
108
|
+
className="tpl-input"
|
|
109
|
+
/*
|
|
110
|
+
* Typed as a plain string because `plaintext-only` is not in every
|
|
111
|
+
* version of React's `contentEditable` union, and the browsers this
|
|
112
|
+
* renders in — including the headless one that produces the PDF — have
|
|
113
|
+
* supported it for years.
|
|
114
|
+
*/
|
|
115
|
+
contentEditable={'plaintext-only' as unknown as boolean}
|
|
116
|
+
suppressContentEditableWarning
|
|
117
|
+
role="textbox"
|
|
118
|
+
aria-multiline={multiline || undefined}
|
|
119
|
+
aria-label={label}
|
|
120
|
+
data-placeholder={placeholder}
|
|
121
|
+
data-empty={empty || undefined}
|
|
122
|
+
onInput={(e) => read(e.currentTarget)}
|
|
123
|
+
onKeyDown={(e) => {
|
|
124
|
+
// A line stays a line. The value is flattened too, for the paste that
|
|
125
|
+
// gets a newline in anyway.
|
|
126
|
+
if (!multiline && e.key === 'Enter') e.preventDefault();
|
|
127
|
+
}}
|
|
128
|
+
>
|
|
129
|
+
{initial}
|
|
130
|
+
</span>
|
|
131
|
+
);
|
|
132
|
+
}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import type { CSSProperties } from 'react';
|
|
2
|
+
import { INK_COLORS, type FieldAlign, type InkId } from '@resumekit/schema';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* The formatting a node may carry.
|
|
6
|
+
*
|
|
7
|
+
* Bounded on purpose. A node accepts a boolean, a named alignment and a named
|
|
8
|
+
* ink — never a style object, a class name or a raw colour — so the values a
|
|
9
|
+
* caller can express are exactly the ones the catalog defines, and what they MEAN
|
|
10
|
+
* is decided by the template's stylesheet. See `design.md`, decision 6.
|
|
11
|
+
*/
|
|
12
|
+
export interface FieldFormatting {
|
|
13
|
+
bold?: boolean;
|
|
14
|
+
align?: FieldAlign;
|
|
15
|
+
ink?: InkId;
|
|
16
|
+
/*
|
|
17
|
+
* Where the field points. Typed to the domain's validated target rather than
|
|
18
|
+
* to `string`, for the same reason `align` is typed to the catalog: a free
|
|
19
|
+
* string here would be a hole through which anything could be expressed —
|
|
20
|
+
* including a `javascript:` URL in a document that gets exported and
|
|
21
|
+
* reopened elsewhere.
|
|
22
|
+
*/
|
|
23
|
+
href?: LinkTarget;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* A validated `http`/`https` address.
|
|
28
|
+
*
|
|
29
|
+
* An alias, not a re-declaration: `isSafeLinkTarget` in `@resumekit/schema` is the only
|
|
30
|
+
* definition of what makes one valid, and this names the type those values
|
|
31
|
+
* carry so the node's prop surface can be checked against it.
|
|
32
|
+
*/
|
|
33
|
+
export type LinkTarget = string;
|
|
34
|
+
|
|
35
|
+
/** Class names the template stylesheet gives meaning to. */
|
|
36
|
+
export function formatClass(format: FieldFormatting, base: string): string {
|
|
37
|
+
return [
|
|
38
|
+
base,
|
|
39
|
+
format.bold ? 'is-bold' : '',
|
|
40
|
+
format.align ? `is-${format.align}` : '',
|
|
41
|
+
]
|
|
42
|
+
.filter(Boolean)
|
|
43
|
+
.join(' ');
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* The one custom property a formatted node sets. Not a style prop: the value is
|
|
48
|
+
* looked up from the catalog, so an arbitrary colour cannot be passed through it.
|
|
49
|
+
*/
|
|
50
|
+
export function formatInk(format: FieldFormatting): CSSProperties | undefined {
|
|
51
|
+
if (!format.ink) return undefined;
|
|
52
|
+
return { '--f-ink': INK_COLORS[format.ink].hex } as CSSProperties;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
/** Marks the element as carrying its own ink, which the stylesheet keys off. */
|
|
56
|
+
export function inkAttr(format: FieldFormatting): string | undefined {
|
|
57
|
+
return format.ink ? '' : undefined;
|
|
58
|
+
}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* What a template's editable fields may and may not carry.
|
|
3
|
+
*
|
|
4
|
+
* This file used to open with `LOCKED_RULES` — four movement predicates every
|
|
5
|
+
* node answered `false`, because Craft.js is a page-builder library and this is
|
|
6
|
+
* deliberately the opposite of one. `retire-craftjs` removed the library, and
|
|
7
|
+
* with it the capability those predicates existed to refuse. The file's own
|
|
8
|
+
* argument is why they went rather than being kept for safety: "rules are
|
|
9
|
+
* configuration, and configuration is one API change away from meaning
|
|
10
|
+
* something else". A capability that does not exist cannot be re-enabled by
|
|
11
|
+
* accident, and `nodes.spec.tsx` now asserts the absence directly.
|
|
12
|
+
*
|
|
13
|
+
* What remains is the rule that was never about Craft at all.
|
|
14
|
+
*/
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Prop names a template node may never accept.
|
|
18
|
+
*
|
|
19
|
+
* The rule is **no arbitrary presentation**, not "no presentation". A node may
|
|
20
|
+
* take a bounded formatting value from the catalog — a boolean emphasis, a named
|
|
21
|
+
* `align`, a named `ink` — because those can only express what the domain has
|
|
22
|
+
* vetted, and what they MEAN is still decided by the template's stylesheet.
|
|
23
|
+
* What it may never take is a value through which a caller could express
|
|
24
|
+
* anything at all: a style object, a class name, a raw colour, a dimension.
|
|
25
|
+
*
|
|
26
|
+
* That is the distinction that was actually load-bearing in #29, and the one
|
|
27
|
+
* `resume-document-formatting` (#30) preserves while making formatting possible.
|
|
28
|
+
*
|
|
29
|
+
* Enforced by test rather than by types alone, because a component's prop
|
|
30
|
+
* surface is easy to widen and hard to notice widening.
|
|
31
|
+
*/
|
|
32
|
+
export const FORBIDDEN_NODE_PROPS: readonly string[] = [
|
|
33
|
+
'style',
|
|
34
|
+
'className',
|
|
35
|
+
'class',
|
|
36
|
+
'background',
|
|
37
|
+
'font',
|
|
38
|
+
'fontFamily',
|
|
39
|
+
'fontSize',
|
|
40
|
+
'size',
|
|
41
|
+
'width',
|
|
42
|
+
'height',
|
|
43
|
+
'margin',
|
|
44
|
+
'padding',
|
|
45
|
+
'layout',
|
|
46
|
+
'variant',
|
|
47
|
+
];
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* Formatting props a node MAY accept, each paired with the catalog type its
|
|
51
|
+
* values must come from. Asserted by test, so adding a free-string formatting
|
|
52
|
+
* prop fails the suite rather than quietly reopening the design surface.
|
|
53
|
+
*/
|
|
54
|
+
export const BOUNDED_NODE_PROPS: Readonly<Record<string, string>> = {
|
|
55
|
+
bold: 'boolean',
|
|
56
|
+
align: 'FieldAlign',
|
|
57
|
+
ink: 'InkId',
|
|
58
|
+
/*
|
|
59
|
+
* CONTENT, admitted under the same rule as the rest: a bounded value from the
|
|
60
|
+
* domain, never a free string. `LinkTargetSchema` parses the URL and accepts
|
|
61
|
+
* only `http`/`https`, so this cannot express "anything at all" — which is
|
|
62
|
+
* what `FORBIDDEN_NODE_PROPS` exists to keep out. A URL is not a style, a
|
|
63
|
+
* class, a colour or a dimension; it is a fact about where a word points, of
|
|
64
|
+
* the same kind as the `links` array the résumé schema already carries.
|
|
65
|
+
*/
|
|
66
|
+
href: 'LinkTarget',
|
|
67
|
+
};
|
|
@@ -0,0 +1,238 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Where the pages break — as arithmetic, with no DOM in it.
|
|
3
|
+
*
|
|
4
|
+
* Separated from `PagedSheet` because the two halves fail for different reasons
|
|
5
|
+
* and are checked by different means. Reading the layout is a browser question
|
|
6
|
+
* that jsdom cannot answer (every measurement there is zero). Deciding where a
|
|
7
|
+
* sheet ends is a model, and a model can be handed measurements and held to its
|
|
8
|
+
* answer — which is what `pagination.spec.ts` does, and what no test could do
|
|
9
|
+
* while this lived inside a `useCallback` closed over a ref.
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
/** Letter at 96dpi, and the document's own vertical margin, both in CSS pixels. */
|
|
13
|
+
export const PAGE_HEIGHT = 11 * 96;
|
|
14
|
+
/** Letter's other dimension, which is what a view zoom has to fit into. */
|
|
15
|
+
export const PAGE_WIDTH = 8.5 * 96;
|
|
16
|
+
export const PAGE_MARGIN = 0.5 * 96;
|
|
17
|
+
/**
|
|
18
|
+
* The gap drawn between sheets on screen. Presentation only — never printed.
|
|
19
|
+
*
|
|
20
|
+
* It is the DEFAULT rather than the law, because the export renders the same
|
|
21
|
+
* document onto real paper, where sheets are contiguous. That is the single
|
|
22
|
+
* parameter separating the two renderings: pass `0` and the pitch becomes the
|
|
23
|
+
* page height, so sheet `k` starts exactly where printed page `k` starts.
|
|
24
|
+
*/
|
|
25
|
+
export const SHEET_GAP = 28;
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* One block as the browser reported it, tagged with the column it flows down.
|
|
29
|
+
*
|
|
30
|
+
* `flow` is opaque here on purpose: the model only ever compares flows for
|
|
31
|
+
* identity, so it does not need to know they are elements, and a test can label
|
|
32
|
+
* them `'main'` and `'aside'`.
|
|
33
|
+
*/
|
|
34
|
+
export interface MeasuredBlock<TFlow> {
|
|
35
|
+
flow: TFlow;
|
|
36
|
+
/** Natural position in flow coordinates, before any push. */
|
|
37
|
+
top: number;
|
|
38
|
+
height: number;
|
|
39
|
+
/** A heading, which must not be the last thing on a sheet. */
|
|
40
|
+
keepWithNext: boolean;
|
|
41
|
+
/**
|
|
42
|
+
* Space the candidate recorded above this block. Absent means none.
|
|
43
|
+
*
|
|
44
|
+
* When the block is moved to a new sheet it keeps only the part of this
|
|
45
|
+
* space that was NOT needed to move it there. The space that fitted on the
|
|
46
|
+
* sheet it came from is spent. So a block starts its new sheet on the first
|
|
47
|
+
* line, and each further step moves it down from there.
|
|
48
|
+
*
|
|
49
|
+
* Without it a moved block was placed with its top edge on the sheet's first
|
|
50
|
+
* line, whatever gap it carried: the push is measured from the block's
|
|
51
|
+
* natural position, which already includes that gap, so every extra step of
|
|
52
|
+
* space shortened the push by exactly as much. The spacer's number rose and
|
|
53
|
+
* nothing on the page moved.
|
|
54
|
+
*
|
|
55
|
+
* Only the RECORDED space. The template's own rhythm above a block is space
|
|
56
|
+
* between two things, and at the top of a sheet there is nothing above it.
|
|
57
|
+
*/
|
|
58
|
+
lead?: number;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
export interface PaginationPlan {
|
|
62
|
+
/** Block index → how far down it must be pushed. Absent means "not pushed". */
|
|
63
|
+
pushes: Map<number, number>;
|
|
64
|
+
/** Block index → where a pushed block is SUPPOSED to start. */
|
|
65
|
+
targets: Map<number, number>;
|
|
66
|
+
/**
|
|
67
|
+
* Block index → the recorded space a pushed block keeps above it on its new
|
|
68
|
+
* sheet, after capping. Absent means none. Printing needs it on its own,
|
|
69
|
+
* because it places the block with a page break rather than by position.
|
|
70
|
+
*/
|
|
71
|
+
leads: Map<number, number>;
|
|
72
|
+
/** How many sheets the document occupies. Never below one. */
|
|
73
|
+
pages: number;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
/**
|
|
77
|
+
* Sheet `k` occupies `[pitch*k, pitch*k + PAGE_HEIGHT)`, where the pitch is the
|
|
78
|
+
* page plus whatever gap is drawn between sheets.
|
|
79
|
+
*
|
|
80
|
+
* Derived per call rather than fixed at module scope: the editor draws a gap and
|
|
81
|
+
* the printed document does not, and those are the same document paginated with
|
|
82
|
+
* one number changed. Holding the screen's gap in a constant here is what would
|
|
83
|
+
* make the file and the screen break in different places.
|
|
84
|
+
*/
|
|
85
|
+
function geometry(gap: number) {
|
|
86
|
+
const pitch = PAGE_HEIGHT + gap;
|
|
87
|
+
return {
|
|
88
|
+
pitch,
|
|
89
|
+
textTop: (k: number) => pitch * k + PAGE_MARGIN,
|
|
90
|
+
textBottom: (k: number) => pitch * k + PAGE_HEIGHT - PAGE_MARGIN,
|
|
91
|
+
/** Independent of the gap: a sheet holds what a sheet holds. */
|
|
92
|
+
usable: PAGE_HEIGHT - PAGE_MARGIN * 2,
|
|
93
|
+
};
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
/**
|
|
97
|
+
* Plan the breaks: which blocks move down, how far, and how many sheets result.
|
|
98
|
+
*
|
|
99
|
+
* Every push is derived arithmetically from ONE reading of the natural layout,
|
|
100
|
+
* rather than by measuring, pushing, and measuring again — that costs a reflow
|
|
101
|
+
* per block on every keystroke. Pushing a block down by `p` shifts everything
|
|
102
|
+
* after it **in the same flow** by exactly `p`, so a running offset per flow is
|
|
103
|
+
* all the later blocks need.
|
|
104
|
+
*
|
|
105
|
+
* **Per flow**, and that is the load-bearing word. A template that sets regions
|
|
106
|
+
* side by side has more than one column, and a push in one of them does not move
|
|
107
|
+
* the other. Carrying a single running offset across both — which is what this
|
|
108
|
+
* did while every template was one column — would measure every block of the
|
|
109
|
+
* second column against a position it never occupied, and the sidebar would walk
|
|
110
|
+
* off the sheet on the first break.
|
|
111
|
+
*
|
|
112
|
+
* A document with no declared flow puts every block in the same one, so the maps
|
|
113
|
+
* below hold a single entry and the arithmetic is the single running offset it
|
|
114
|
+
* replaced. Single-column templates are not paginated by a new code path.
|
|
115
|
+
*/
|
|
116
|
+
export function planPagination<TFlow>(
|
|
117
|
+
blocks: readonly MeasuredBlock<TFlow>[],
|
|
118
|
+
sheetGap: number = SHEET_GAP,
|
|
119
|
+
): PaginationPlan {
|
|
120
|
+
const { pitch, textTop, textBottom, usable } = geometry(sheetGap);
|
|
121
|
+
const pushes = new Map<number, number>();
|
|
122
|
+
const targets = new Map<number, number>();
|
|
123
|
+
const leads = new Map<number, number>();
|
|
124
|
+
if (blocks.length === 0) return { pushes, targets, leads, pages: 1 };
|
|
125
|
+
|
|
126
|
+
/*
|
|
127
|
+
* The next block in the SAME flow, for `keepWithNext`.
|
|
128
|
+
*
|
|
129
|
+
* Resolved in one backward pass rather than by searching forward per block: a
|
|
130
|
+
* heading is kept with what follows it *in its own column*, and the block that
|
|
131
|
+
* happens to come next in the document can be the top of the other one.
|
|
132
|
+
*/
|
|
133
|
+
const nextInFlow = new Array<number>(blocks.length).fill(-1);
|
|
134
|
+
const lastSeen = new Map<TFlow, number>();
|
|
135
|
+
for (let i = blocks.length - 1; i >= 0; i--) {
|
|
136
|
+
nextInFlow[i] = lastSeen.get(blocks[i].flow) ?? -1;
|
|
137
|
+
lastSeen.set(blocks[i].flow, i);
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
/** Per flow: how far its content has been pushed, and the sheet it is on. */
|
|
141
|
+
const shifts = new Map<TFlow, number>();
|
|
142
|
+
const sheets = new Map<TFlow, number>();
|
|
143
|
+
/** How far down the document reaches once every push is applied. */
|
|
144
|
+
let bottom = 0;
|
|
145
|
+
|
|
146
|
+
for (const [index, block] of blocks.entries()) {
|
|
147
|
+
const shift = shifts.get(block.flow) ?? 0;
|
|
148
|
+
let sheet = sheets.get(block.flow) ?? 0;
|
|
149
|
+
let top = block.top + shift;
|
|
150
|
+
|
|
151
|
+
// A block taller than a whole sheet cannot be rescued by pushing it; let it
|
|
152
|
+
// run, and count the sheets it spans.
|
|
153
|
+
if (block.height > usable) {
|
|
154
|
+
sheets.set(
|
|
155
|
+
block.flow,
|
|
156
|
+
Math.max(sheet, Math.floor((top + block.height) / pitch)),
|
|
157
|
+
);
|
|
158
|
+
bottom = Math.max(bottom, top + block.height);
|
|
159
|
+
continue;
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
/*
|
|
163
|
+
* A section heading must not be the last thing on a sheet. It is measured
|
|
164
|
+
* together with whatever follows it — the same intent as the stylesheet's
|
|
165
|
+
* `break-after: avoid`, which the printer applies to this very document.
|
|
166
|
+
*
|
|
167
|
+
* UNLESS what follows cannot fit on a sheet by itself. Holding a heading
|
|
168
|
+
* against a block that overflows wherever it starts buys nothing and costs a
|
|
169
|
+
* page: the heading is pushed to a fresh sheet, the block still overruns,
|
|
170
|
+
* and the sheet the heading came from is left empty. That is exactly how a
|
|
171
|
+
* 56-item keyword rail emptied its own first page — the list is one block,
|
|
172
|
+
* taller than the paper, so its heading was moved every single time.
|
|
173
|
+
*/
|
|
174
|
+
const next = nextInFlow[index];
|
|
175
|
+
const nextHeight = next === -1 ? 0 : blocks[next].height;
|
|
176
|
+
const withNext =
|
|
177
|
+
block.keepWithNext && nextHeight <= usable ? nextHeight : 0;
|
|
178
|
+
|
|
179
|
+
if (top + block.height + withNext > textBottom(sheet)) {
|
|
180
|
+
sheet += 1;
|
|
181
|
+
/*
|
|
182
|
+
* How much of the recorded space carries over to the new sheet.
|
|
183
|
+
*
|
|
184
|
+
* `room` is the space the block could have had and still stayed on the
|
|
185
|
+
* sheet it came from. That much is spent there, so only the remainder
|
|
186
|
+
* goes above the block on its new sheet. A block that crosses because of
|
|
187
|
+
* its space therefore lands on the first line and moves down one step at
|
|
188
|
+
* a time from there, rather than arriving with the whole gap again.
|
|
189
|
+
*
|
|
190
|
+
* A block that would not have fitted even with no space spent none of
|
|
191
|
+
* it, so it keeps all of it.
|
|
192
|
+
*
|
|
193
|
+
* Capped so the block, and whatever it is kept with, still fits on its
|
|
194
|
+
* new sheet. A gap taller than that would only push it off again.
|
|
195
|
+
*/
|
|
196
|
+
const recorded = Math.max(0, block.lead ?? 0);
|
|
197
|
+
const room = Math.max(
|
|
198
|
+
0,
|
|
199
|
+
textBottom(sheet - 1) - (top - recorded) - block.height - withNext,
|
|
200
|
+
);
|
|
201
|
+
const lead = Math.min(
|
|
202
|
+
Math.max(0, recorded - room),
|
|
203
|
+
Math.max(0, usable - block.height - withNext),
|
|
204
|
+
);
|
|
205
|
+
const target = textTop(sheet) + lead;
|
|
206
|
+
const push = target - top;
|
|
207
|
+
pushes.set(index, push);
|
|
208
|
+
targets.set(index, target);
|
|
209
|
+
if (lead > 0) leads.set(index, lead);
|
|
210
|
+
shifts.set(block.flow, shift + push);
|
|
211
|
+
sheets.set(block.flow, sheet);
|
|
212
|
+
top = target;
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
// Accumulated as the loop goes, with the offset that was in force for THIS
|
|
216
|
+
// block — a flow's final offset belongs to its last block, not to every
|
|
217
|
+
// block that preceded the pushes making it up.
|
|
218
|
+
bottom = Math.max(bottom, top + block.height);
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
/*
|
|
222
|
+
* The deepest sheet ANY flow reaches decides the count.
|
|
223
|
+
*
|
|
224
|
+
* Per flow rather than "the last block in the document", because the last
|
|
225
|
+
* block of a two-column page is the foot of the sidebar, which is routinely
|
|
226
|
+
* the shorter column — trusting it would drop the sheet the main column is
|
|
227
|
+
* still running onto.
|
|
228
|
+
*/
|
|
229
|
+
let deepest = 0;
|
|
230
|
+
for (const sheet of sheets.values()) deepest = Math.max(deepest, sheet);
|
|
231
|
+
|
|
232
|
+
return {
|
|
233
|
+
pushes,
|
|
234
|
+
targets,
|
|
235
|
+
leads,
|
|
236
|
+
pages: Math.max(deepest + 1, Math.ceil(bottom / pitch) || 1),
|
|
237
|
+
};
|
|
238
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { createContext, useContext, type ReactNode } from 'react';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* A document drawn as a picture of itself: links are text, headings are not
|
|
5
|
+
* part of the host page's outline, and nothing an editor reads is emitted.
|
|
6
|
+
* For previews embedded in another page, never for the document itself.
|
|
7
|
+
*/
|
|
8
|
+
const PictureContext = createContext(false);
|
|
9
|
+
|
|
10
|
+
export function PictureProvider({ children }: { children: ReactNode }) {
|
|
11
|
+
return (
|
|
12
|
+
<PictureContext.Provider value={true}>{children}</PictureContext.Provider>
|
|
13
|
+
);
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export function usePicture(): boolean {
|
|
17
|
+
return useContext(PictureContext);
|
|
18
|
+
}
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import { createContext, useContext, useMemo } from 'react';
|
|
2
|
+
import type { ReactNode } from 'react';
|
|
3
|
+
import {
|
|
4
|
+
formatFor,
|
|
5
|
+
type DocumentStyle,
|
|
6
|
+
type FieldFormat,
|
|
7
|
+
type ResumeFormats,
|
|
8
|
+
} from '@resumekit/schema';
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* How the document is presented, delivered by context rather than by props.
|
|
12
|
+
*
|
|
13
|
+
* This is not a style preference — it is the only thing that works. `<Frame>`
|
|
14
|
+
* children are Craft.js's INITIAL node tree: props are read off that JSX once,
|
|
15
|
+
* when the nodes are created, and thereafter live in Craft's own store. Passing
|
|
16
|
+
* `style` and `formats` down through `<Element>` therefore froze them at mount,
|
|
17
|
+
* and every formatting change stayed invisible until something forced a remount.
|
|
18
|
+
*
|
|
19
|
+
* Context sidesteps the node store entirely: a change re-renders the components
|
|
20
|
+
* that read it, immediately, without touching Craft's state at all. Which is
|
|
21
|
+
* also the correct model — formatting is presentation OVER the document, not
|
|
22
|
+
* part of it. The document is the text, and only the text is Craft's to hold.
|
|
23
|
+
*/
|
|
24
|
+
export interface DocumentPresentation {
|
|
25
|
+
style?: DocumentStyle;
|
|
26
|
+
formats?: ResumeFormats;
|
|
27
|
+
/** The document's language, which its printed words follow. Absent is English. */
|
|
28
|
+
language?: string;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
const PresentationContext = createContext<DocumentPresentation>({});
|
|
32
|
+
|
|
33
|
+
export function DocumentPresentationProvider({
|
|
34
|
+
style,
|
|
35
|
+
formats,
|
|
36
|
+
language,
|
|
37
|
+
children,
|
|
38
|
+
}: DocumentPresentation & { children: ReactNode }) {
|
|
39
|
+
// Keyed on the values themselves, so a parent re-render that changed neither
|
|
40
|
+
// does not cascade a new context object through the whole document.
|
|
41
|
+
const value = useMemo(
|
|
42
|
+
() => ({ style, formats, language }),
|
|
43
|
+
[style, formats, language],
|
|
44
|
+
);
|
|
45
|
+
return (
|
|
46
|
+
<PresentationContext.Provider value={value}>
|
|
47
|
+
{children}
|
|
48
|
+
</PresentationContext.Provider>
|
|
49
|
+
);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
/** The document's style, or undefined for the template's own typography. */
|
|
53
|
+
export function useDocumentStyle(): DocumentStyle | undefined {
|
|
54
|
+
return useContext(PresentationContext).style;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* Every field's formatting, for the one reader that needs the whole list.
|
|
59
|
+
*
|
|
60
|
+
* `useFieldFormat` answers for a path and is what a node should ask; this is
|
|
61
|
+
* for `useSpace`, which reaches the same record for a different question and
|
|
62
|
+
* would otherwise need a second copy of the formats threaded to it.
|
|
63
|
+
*/
|
|
64
|
+
export function useDocumentLanguage(): string | undefined {
|
|
65
|
+
return useContext(PresentationContext).language;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
export function useDocumentFormats(): ResumeFormats | undefined {
|
|
69
|
+
return useContext(PresentationContext).formats;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
/**
|
|
73
|
+
* The formatting for one field, as bounded values a node may accept.
|
|
74
|
+
*
|
|
75
|
+
* Returns the format WITHOUT its path: a node already knows which field it is,
|
|
76
|
+
* and passing the path back in would invite a node to read a different field's
|
|
77
|
+
* formatting than its own.
|
|
78
|
+
*/
|
|
79
|
+
export function useFieldFormat(path: string): Omit<FieldFormat, 'path'> {
|
|
80
|
+
const { formats } = useContext(PresentationContext);
|
|
81
|
+
return useMemo(() => {
|
|
82
|
+
const found = formatFor(formats, path);
|
|
83
|
+
if (!found) return {};
|
|
84
|
+
const { path: _unused, ...rest } = found;
|
|
85
|
+
return rest;
|
|
86
|
+
}, [formats, path]);
|
|
87
|
+
}
|
package/src/presented.ts
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import {
|
|
2
|
+
applyPresentation,
|
|
3
|
+
type ResumeEdits,
|
|
4
|
+
type ResumeObject,
|
|
5
|
+
} from '@resumekit/schema';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* The resume as it should be drawn: the writer's output with the candidate's
|
|
9
|
+
* corrections applied.
|
|
10
|
+
*
|
|
11
|
+
* Lives with the DOCUMENT rather than with the editor, because it answers "what
|
|
12
|
+
* is on the page" — the question every surface that draws a résumé has to
|
|
13
|
+
* answer, including the server-side renderer that never loads an editor.
|
|
14
|
+
*
|
|
15
|
+
* Falls back to the writer's own resume if the overlay cannot be applied. An
|
|
16
|
+
* overlay is data at rest that can outlive the schema it was written against,
|
|
17
|
+
* and a resume that will not open is a worse failure than an edit that does not
|
|
18
|
+
* show — so the document always renders.
|
|
19
|
+
*/
|
|
20
|
+
export function presentedResume(
|
|
21
|
+
base: ResumeObject,
|
|
22
|
+
edits: ResumeEdits,
|
|
23
|
+
): ResumeObject {
|
|
24
|
+
try {
|
|
25
|
+
return applyPresentation(base, edits);
|
|
26
|
+
} catch {
|
|
27
|
+
return base;
|
|
28
|
+
}
|
|
29
|
+
}
|