@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,103 @@
|
|
|
1
|
+
import type { Link } from '@resumekit/schema';
|
|
2
|
+
export interface LinkFieldProps {
|
|
3
|
+
/** The entry this field renders — its text and its address. */
|
|
4
|
+
item: Link;
|
|
5
|
+
/** Where the entry lives, e.g. `links.0`. Its fields hang off this. */
|
|
6
|
+
path: string;
|
|
7
|
+
/**
|
|
8
|
+
* What the field says while the link is blank.
|
|
9
|
+
*
|
|
10
|
+
* Defaulted from the domain's own guidance rather than required of each
|
|
11
|
+
* template, because a template that passed none rendered an empty inline
|
|
12
|
+
* span: no text, no width, and nothing on the page to say a link belonged
|
|
13
|
+
* there. Three of the four did exactly that.
|
|
14
|
+
*/
|
|
15
|
+
placeholder?: string;
|
|
16
|
+
/**
|
|
17
|
+
* Whether the candidate has just added this link, in this session.
|
|
18
|
+
*
|
|
19
|
+
* The only thing that opens the panel on its own. It used to open for any
|
|
20
|
+
* link with no text and no address — a property of the CONTENTS rather than
|
|
21
|
+
* an act — on the reasoning that only `collection.add()` produces a blank
|
|
22
|
+
* pair. That reasoning held for one press and not for a document: a résumé
|
|
23
|
+
* that had somehow acquired a hundred blank links drew a hundred panels
|
|
24
|
+
* stacked over the page, one per link, every time it was rendered.
|
|
25
|
+
*
|
|
26
|
+
* The act is what the popover actually wants, and the collection is the only
|
|
27
|
+
* thing that knows it — see `SectionCollectionHandle.justAdded`.
|
|
28
|
+
*/
|
|
29
|
+
justAdded?: boolean;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* One of a résumé's links, in every template.
|
|
33
|
+
*
|
|
34
|
+
* The four templates each had their own answer and three of them amounted to
|
|
35
|
+
* none: Harvard rendered a `Collection` of `label ?? url` inline in the contact
|
|
36
|
+
* line, while Cobalt, Executive and Meridian rendered a bare `.map` of the URL
|
|
37
|
+
* as the visible text behind `{links.length > 0 && …}` — no collection, so a
|
|
38
|
+
* résumé whose writer produced no links had nothing to press, and one moved
|
|
39
|
+
* between templates lost its labels.
|
|
40
|
+
*
|
|
41
|
+
* What is shared is what a link IS: the text the document shows and the address
|
|
42
|
+
* behind it. Where it SITS is still the template's decision — this renders the
|
|
43
|
+
* field and nothing around it, so Harvard keeps its contact line and the others
|
|
44
|
+
* keep their websites list.
|
|
45
|
+
*
|
|
46
|
+
* ## The field on the page is a way IN, not a place to type
|
|
47
|
+
*
|
|
48
|
+
* A link is one thing with two parts, and only one of them is on the page. So
|
|
49
|
+
* the visible text is a **read-only** field: it registers at `links.N.label`,
|
|
50
|
+
* draws that text in the document's own typography, and shows the collection's
|
|
51
|
+
* guidance while it is blank — an ordinary-looking field the candidate can see
|
|
52
|
+
* belongs there — but it refuses the caret. Pressing it opens the popover, and
|
|
53
|
+
* the popover is where both halves are typed.
|
|
54
|
+
*
|
|
55
|
+
* The alternative was tried and is what this replaced. With the text editable
|
|
56
|
+
* in place, one press did two things: `EditableText`'s own `mousedown` selected
|
|
57
|
+
* the field and turned it into a `contenteditable`, and this component's opened
|
|
58
|
+
* a popover over it. Two live editors for one value, fighting over the
|
|
59
|
+
* keyboard, and a candidate could still type a label with no way to see what it
|
|
60
|
+
* pointed at.
|
|
61
|
+
*
|
|
62
|
+
* ## Typed into a draft, set by Ok
|
|
63
|
+
*
|
|
64
|
+
* The popover's inputs hold a DRAFT — a copy of both halves — and nothing
|
|
65
|
+
* reaches the document until Ok. That is what makes an address a decision
|
|
66
|
+
* rather than a side effect of typing: a half-written `https://li` is not a
|
|
67
|
+
* link, and every keystroke of it used to land in the résumé and, at the end of
|
|
68
|
+
* the debounce, in storage. Escape and a press outside discard the draft, so
|
|
69
|
+
* backing out of a link leaves the document exactly as it was.
|
|
70
|
+
*
|
|
71
|
+
* Ok writes both fields through the registry, by path — see
|
|
72
|
+
* `FieldRegistry.write`. That is the only route that survives: the save rebuilds
|
|
73
|
+
* the overlay from the fields that carry a path, so a value written any other
|
|
74
|
+
* way would show on screen and be dropped by the next save. Two fields cannot
|
|
75
|
+
* share one path either, so each half has exactly one field and the popover
|
|
76
|
+
* writes to them rather than being a second owner of either.
|
|
77
|
+
*
|
|
78
|
+
* ## Adding and removing belong to the COLLECTION, not here
|
|
79
|
+
*
|
|
80
|
+
* This renders one link. It does not render a control to make another, and it
|
|
81
|
+
* did: a `+` sat past the end of every link, on the reasoning that a collection
|
|
82
|
+
* inside a line has nowhere else to put one. That reasoning was true only
|
|
83
|
+
* because a link could not be selected — the press was swallowed before it
|
|
84
|
+
* reached the item root, so the entry toolbar every other collection uses for
|
|
85
|
+
* add, remove and reorder never appeared on a link. With the press let through,
|
|
86
|
+
* links get the same controls as a role or a qualification, and a second, link-
|
|
87
|
+
* shaped way to add is one the candidate has to learn separately.
|
|
88
|
+
*
|
|
89
|
+
* ## The chrome costs the document nothing
|
|
90
|
+
*
|
|
91
|
+
* The trigger and the popover are `position: absolute`,
|
|
92
|
+
* `contentEditable={false}`, `data-chrome`, and hidden in print — the contract
|
|
93
|
+
* `SpaceHandle` and `EntryOverlay` already meet. The address field is mounted
|
|
94
|
+
* whether or not the popover is open, because a field outside the tree is not
|
|
95
|
+
* collected when the document saves; it is the store, and the popover is the
|
|
96
|
+
* control.
|
|
97
|
+
*
|
|
98
|
+
* The wrapper renders in BOTH states. An element the editor adds and the preview
|
|
99
|
+
* does not is an element the two documents differ by — `position: relative` with
|
|
100
|
+
* no offsets moves nothing, the same argument `[data-gap]` already makes.
|
|
101
|
+
*/
|
|
102
|
+
export declare function LinkField({ item, path, placeholder: givenPlaceholder, justAdded, }: LinkFieldProps): import("react").JSX.Element;
|
|
103
|
+
//# sourceMappingURL=LinkField.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"LinkField.d.ts","sourceRoot":"","sources":["../../src/nodes/LinkField.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAC;AAK9C,OAAO,kBAAkB,CAAC;AAE1B,MAAM,WAAW,cAAc;IAC7B,+DAA+D;IAC/D,IAAI,EAAE,IAAI,CAAC;IACX,uEAAuE;IACvE,IAAI,EAAE,MAAM,CAAC;IACb;;;;;;;OAOG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB;;;;;;;;;;;;OAYG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB;AAQD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsEG;AACH,wBAAgB,SAAS,CAAC,EACxB,IAAI,EACJ,IAAI,EACJ,WAAW,EAAE,gBAAgB,EAC7B,SAAiB,GAClB,EAAE,cAAc,+BA4ThB"}
|
|
@@ -0,0 +1,277 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
+
import { useEffect, useLayoutEffect, useRef, useState } from 'react';
|
|
3
|
+
import { createPortal } from 'react-dom';
|
|
4
|
+
import { useEditorText } from '../i18n/index.js';
|
|
5
|
+
import { useAutosave } from '../autosave-context.js';
|
|
6
|
+
import { useFieldRegistry, useFieldValue } from '../fields/field-registry.js';
|
|
7
|
+
import { EditableText } from './EditableText.js';
|
|
8
|
+
import './link-field.css';
|
|
9
|
+
/**
|
|
10
|
+
* One of a résumé's links, in every template.
|
|
11
|
+
*
|
|
12
|
+
* The four templates each had their own answer and three of them amounted to
|
|
13
|
+
* none: Harvard rendered a `Collection` of `label ?? url` inline in the contact
|
|
14
|
+
* line, while Cobalt, Executive and Meridian rendered a bare `.map` of the URL
|
|
15
|
+
* as the visible text behind `{links.length > 0 && …}` — no collection, so a
|
|
16
|
+
* résumé whose writer produced no links had nothing to press, and one moved
|
|
17
|
+
* between templates lost its labels.
|
|
18
|
+
*
|
|
19
|
+
* What is shared is what a link IS: the text the document shows and the address
|
|
20
|
+
* behind it. Where it SITS is still the template's decision — this renders the
|
|
21
|
+
* field and nothing around it, so Harvard keeps its contact line and the others
|
|
22
|
+
* keep their websites list.
|
|
23
|
+
*
|
|
24
|
+
* ## The field on the page is a way IN, not a place to type
|
|
25
|
+
*
|
|
26
|
+
* A link is one thing with two parts, and only one of them is on the page. So
|
|
27
|
+
* the visible text is a **read-only** field: it registers at `links.N.label`,
|
|
28
|
+
* draws that text in the document's own typography, and shows the collection's
|
|
29
|
+
* guidance while it is blank — an ordinary-looking field the candidate can see
|
|
30
|
+
* belongs there — but it refuses the caret. Pressing it opens the popover, and
|
|
31
|
+
* the popover is where both halves are typed.
|
|
32
|
+
*
|
|
33
|
+
* The alternative was tried and is what this replaced. With the text editable
|
|
34
|
+
* in place, one press did two things: `EditableText`'s own `mousedown` selected
|
|
35
|
+
* the field and turned it into a `contenteditable`, and this component's opened
|
|
36
|
+
* a popover over it. Two live editors for one value, fighting over the
|
|
37
|
+
* keyboard, and a candidate could still type a label with no way to see what it
|
|
38
|
+
* pointed at.
|
|
39
|
+
*
|
|
40
|
+
* ## Typed into a draft, set by Ok
|
|
41
|
+
*
|
|
42
|
+
* The popover's inputs hold a DRAFT — a copy of both halves — and nothing
|
|
43
|
+
* reaches the document until Ok. That is what makes an address a decision
|
|
44
|
+
* rather than a side effect of typing: a half-written `https://li` is not a
|
|
45
|
+
* link, and every keystroke of it used to land in the résumé and, at the end of
|
|
46
|
+
* the debounce, in storage. Escape and a press outside discard the draft, so
|
|
47
|
+
* backing out of a link leaves the document exactly as it was.
|
|
48
|
+
*
|
|
49
|
+
* Ok writes both fields through the registry, by path — see
|
|
50
|
+
* `FieldRegistry.write`. That is the only route that survives: the save rebuilds
|
|
51
|
+
* the overlay from the fields that carry a path, so a value written any other
|
|
52
|
+
* way would show on screen and be dropped by the next save. Two fields cannot
|
|
53
|
+
* share one path either, so each half has exactly one field and the popover
|
|
54
|
+
* writes to them rather than being a second owner of either.
|
|
55
|
+
*
|
|
56
|
+
* ## Adding and removing belong to the COLLECTION, not here
|
|
57
|
+
*
|
|
58
|
+
* This renders one link. It does not render a control to make another, and it
|
|
59
|
+
* did: a `+` sat past the end of every link, on the reasoning that a collection
|
|
60
|
+
* inside a line has nowhere else to put one. That reasoning was true only
|
|
61
|
+
* because a link could not be selected — the press was swallowed before it
|
|
62
|
+
* reached the item root, so the entry toolbar every other collection uses for
|
|
63
|
+
* add, remove and reorder never appeared on a link. With the press let through,
|
|
64
|
+
* links get the same controls as a role or a qualification, and a second, link-
|
|
65
|
+
* shaped way to add is one the candidate has to learn separately.
|
|
66
|
+
*
|
|
67
|
+
* ## The chrome costs the document nothing
|
|
68
|
+
*
|
|
69
|
+
* The trigger and the popover are `position: absolute`,
|
|
70
|
+
* `contentEditable={false}`, `data-chrome`, and hidden in print — the contract
|
|
71
|
+
* `SpaceHandle` and `EntryOverlay` already meet. The address field is mounted
|
|
72
|
+
* whether or not the popover is open, because a field outside the tree is not
|
|
73
|
+
* collected when the document saves; it is the store, and the popover is the
|
|
74
|
+
* control.
|
|
75
|
+
*
|
|
76
|
+
* The wrapper renders in BOTH states. An element the editor adds and the preview
|
|
77
|
+
* does not is an element the two documents differ by — `position: relative` with
|
|
78
|
+
* no offsets moves nothing, the same argument `[data-gap]` already makes.
|
|
79
|
+
*/
|
|
80
|
+
export function LinkField({ item, path, placeholder: givenPlaceholder, justAdded = false, }) {
|
|
81
|
+
const { t, format } = useEditorText();
|
|
82
|
+
const placeholder = givenPlaceholder ?? t.placeholders.label;
|
|
83
|
+
const labelPath = `${path}.label`;
|
|
84
|
+
const urlPath = `${path}.url`;
|
|
85
|
+
/*
|
|
86
|
+
* Both halves of the link, read from the fields that hold them.
|
|
87
|
+
*
|
|
88
|
+
* `useFieldValue` on a path this component does not RENDER is how it reads
|
|
89
|
+
* the address: the address's own field is mounted below, hidden, and this is
|
|
90
|
+
* the same value. It replaces a scan of Craft's node map for the node
|
|
91
|
+
* carrying this path — the indirection `retire-craftjs` removed, since the
|
|
92
|
+
* path was always the identity.
|
|
93
|
+
*/
|
|
94
|
+
const registry = useFieldRegistry();
|
|
95
|
+
const label = String(useFieldValue(labelPath) ?? item.label ?? item.url ?? '');
|
|
96
|
+
const address = String(useFieldValue(urlPath) ?? item.url ?? '');
|
|
97
|
+
const editing = registry?.enabled ?? false;
|
|
98
|
+
/* What the document shows: the text, falling back to the address so a link
|
|
99
|
+
with no label reads as something rather than as a gap. */
|
|
100
|
+
const shown = label || address;
|
|
101
|
+
/*
|
|
102
|
+
* Setting a link is a discrete act with nothing still coming after it, so
|
|
103
|
+
* `saveNow` rather than the deferred request typing makes. The draft below is
|
|
104
|
+
* why: the popover writes once, on Ok, and not once per character.
|
|
105
|
+
*/
|
|
106
|
+
const { saveNow } = useAutosave();
|
|
107
|
+
/*
|
|
108
|
+
* The draft IS the open state: a popover is open exactly while there is
|
|
109
|
+
* something being typed in it. Two flags for one fact is how they come apart.
|
|
110
|
+
*
|
|
111
|
+
* A link the candidate JUST ADDED opens straight away, because the address
|
|
112
|
+
* has nowhere else to be typed. Only that — never "this link is blank". The
|
|
113
|
+
* blank test reads as equivalent and is not: it is true of every empty link
|
|
114
|
+
* in the document at every render, so a résumé carrying a few of them opened
|
|
115
|
+
* a panel for each, stacked over the page.
|
|
116
|
+
*/
|
|
117
|
+
const [draft, setDraft] = useState(() => editing && justAdded ? { label: '', url: '' } : null);
|
|
118
|
+
const open = draft !== null;
|
|
119
|
+
const root = useRef(null);
|
|
120
|
+
const pop = useRef(null);
|
|
121
|
+
const firstInput = useRef(null);
|
|
122
|
+
const [at, setAt] = useState(null);
|
|
123
|
+
const openWith = () => setDraft({ label, url: address });
|
|
124
|
+
const discard = () => setDraft(null);
|
|
125
|
+
/*
|
|
126
|
+
* Ok, which is the only thing that writes.
|
|
127
|
+
*
|
|
128
|
+
* Trimmed, because an address is pasted far more often than it is typed and a
|
|
129
|
+
* leading space is enough to make `isSafeLinkTarget` refuse a perfectly good
|
|
130
|
+
* URL — a link that silently stops being followable in the export.
|
|
131
|
+
*/
|
|
132
|
+
const set = () => {
|
|
133
|
+
if (!draft)
|
|
134
|
+
return;
|
|
135
|
+
registry?.write(labelPath, draft.label.trim());
|
|
136
|
+
registry?.write(urlPath, draft.url.trim());
|
|
137
|
+
setDraft(null);
|
|
138
|
+
saveNow();
|
|
139
|
+
};
|
|
140
|
+
/* Nothing to set while both halves are blank, and a button that does nothing
|
|
141
|
+
should say so rather than pretend. */
|
|
142
|
+
const settable = Boolean(draft && (draft.label.trim() || draft.url.trim()));
|
|
143
|
+
/*
|
|
144
|
+
* Close on an outside press or Escape. Written here rather than imported
|
|
145
|
+
* from a UI library the document would otherwise not need: ten lines is the
|
|
146
|
+
* cheaper of the two prices.
|
|
147
|
+
*/
|
|
148
|
+
useEffect(() => {
|
|
149
|
+
if (!open)
|
|
150
|
+
return;
|
|
151
|
+
const onDown = (e) => {
|
|
152
|
+
/* The panel is portalled out of the link, so "outside" is outside BOTH. */
|
|
153
|
+
const target = e.target;
|
|
154
|
+
if (root.current?.contains(target) || pop.current?.contains(target)) {
|
|
155
|
+
return;
|
|
156
|
+
}
|
|
157
|
+
setDraft(null);
|
|
158
|
+
};
|
|
159
|
+
const onKey = (e) => {
|
|
160
|
+
if (e.key === 'Escape')
|
|
161
|
+
setDraft(null);
|
|
162
|
+
};
|
|
163
|
+
document.addEventListener('mousedown', onDown);
|
|
164
|
+
document.addEventListener('keydown', onKey);
|
|
165
|
+
return () => {
|
|
166
|
+
document.removeEventListener('mousedown', onDown);
|
|
167
|
+
document.removeEventListener('keydown', onKey);
|
|
168
|
+
};
|
|
169
|
+
}, [open]);
|
|
170
|
+
/*
|
|
171
|
+
* The text, in flow, in the document's own typography — and read-only, so the
|
|
172
|
+
* press that opens the popover cannot also put a caret in it. See the note on
|
|
173
|
+
* `EditableText`'s `readOnly`.
|
|
174
|
+
*
|
|
175
|
+
* `undefined` rather than `''` for the address — `href ?? format?.href` falls
|
|
176
|
+
* back only on nullish, so an empty string used to SHADOW an address set
|
|
177
|
+
* elsewhere and the link printed dead.
|
|
178
|
+
*/
|
|
179
|
+
const text = (_jsx(EditableText, { path: labelPath, value: item.label ?? item.url ?? '', placeholder: placeholder, href: address || undefined, readOnly: editing }));
|
|
180
|
+
/*
|
|
181
|
+
* The whole link opens the popover, and the handler is on the WRAPPER rather
|
|
182
|
+
* than on an element drawn over the text.
|
|
183
|
+
*
|
|
184
|
+
* The overlay this replaces was `position: absolute; inset: 0` inside an
|
|
185
|
+
* inline `<span>`. That asks the browser to resolve a containing block from
|
|
186
|
+
* the bounding box of an inline's fragments, which is exactly the kind of
|
|
187
|
+
* geometry jsdom cannot model — so the suite proved the handler ran while
|
|
188
|
+
* saying nothing about whether a pointer could ever reach it. A handler is
|
|
189
|
+
* not an element: it has no box to get wrong, and it costs the document
|
|
190
|
+
* nothing, which is the same guarantee by a shorter route.
|
|
191
|
+
*
|
|
192
|
+
* `mousedown` is where the caret is refused, not `click`. By click time the
|
|
193
|
+
* browser has already placed one in the text, so it has to be cancelled
|
|
194
|
+
* before the selection it would make.
|
|
195
|
+
*
|
|
196
|
+
* The press is NOT stopped from bubbling, and that is the fix for a control
|
|
197
|
+
* nobody could reach. An item's root carries `onClick: select(id)` — it is
|
|
198
|
+
* how every collection reveals the entry's own toolbar, and the toolbar is
|
|
199
|
+
* where remove and reorder live. Swallowing the press here meant a link was
|
|
200
|
+
* the one entry in the document that could never be selected, so a link the
|
|
201
|
+
* candidate did not want could not be got rid of. Selecting the entry and
|
|
202
|
+
* opening the panel are not rivals: the panel edits the link, the toolbar
|
|
203
|
+
* acts on the entry, which is the same division `AuthoredItem` already
|
|
204
|
+
* describes for a job title.
|
|
205
|
+
*/
|
|
206
|
+
const refuseCaret = (e) => e.preventDefault();
|
|
207
|
+
/*
|
|
208
|
+
* Where the popover is drawn, measured when it opens.
|
|
209
|
+
*
|
|
210
|
+
* It is rendered into `document.body` through a portal and positioned
|
|
211
|
+
* `fixed`, and both halves of that are load-bearing.
|
|
212
|
+
*
|
|
213
|
+
* `position: absolute` inside `.tpl-link` is what it did before, and that
|
|
214
|
+
* asked the browser to resolve a containing block from the bounding box of an
|
|
215
|
+
* INLINE span's fragments — the same fragile geometry that made the old
|
|
216
|
+
* overlay trigger unreachable. A popover positioned against a degenerate box
|
|
217
|
+
* lands somewhere nobody can see, which looks exactly like a popover that
|
|
218
|
+
* never opened.
|
|
219
|
+
*
|
|
220
|
+
* And an ancestor clips it. `paged.css` masks `.tpl-pages__flow` on a
|
|
221
|
+
* multi-page document to hide the gutter between sheets, and a mask clips
|
|
222
|
+
* everything inside it: a panel hanging below a link would be cut off at the
|
|
223
|
+
* page edge, or vanish entirely in the gap between two.
|
|
224
|
+
*
|
|
225
|
+
* A portal has neither problem — nothing above it in the DOM can clip it, and
|
|
226
|
+
* nothing about an inline box decides where it goes. The React tree is
|
|
227
|
+
* unchanged by a portal, so the address's field stays registered and the
|
|
228
|
+
* document still saves it.
|
|
229
|
+
*/
|
|
230
|
+
useLayoutEffect(() => {
|
|
231
|
+
if (!open) {
|
|
232
|
+
setAt(null);
|
|
233
|
+
return;
|
|
234
|
+
}
|
|
235
|
+
const box = root.current?.getBoundingClientRect();
|
|
236
|
+
if (box)
|
|
237
|
+
setAt({ top: box.bottom + 4, left: box.left });
|
|
238
|
+
}, [open]);
|
|
239
|
+
/*
|
|
240
|
+
* The caret belongs in the panel that just appeared, not left behind in the
|
|
241
|
+
* document: the field on the page refuses it, so a press with no follow-up
|
|
242
|
+
* would leave the keyboard pointing at nothing.
|
|
243
|
+
*
|
|
244
|
+
* A second effect rather than a line in the one above, because the panel does
|
|
245
|
+
* not exist yet when that one runs — it renders on `draft && at`, and `at` is
|
|
246
|
+
* what that effect is measuring. Focusing there would reach for an input that
|
|
247
|
+
* mounts a render later, find `null`, and silently do nothing.
|
|
248
|
+
*/
|
|
249
|
+
useEffect(() => {
|
|
250
|
+
if (open && at)
|
|
251
|
+
firstInput.current?.focus({ preventScroll: true });
|
|
252
|
+
}, [open, at]);
|
|
253
|
+
const stop = (e) => e.stopPropagation();
|
|
254
|
+
return (_jsxs("span", { className: "tpl-link", ref: root, ...(editing
|
|
255
|
+
? {
|
|
256
|
+
onMouseDown: refuseCaret,
|
|
257
|
+
onClick: (e) => {
|
|
258
|
+
refuseCaret(e);
|
|
259
|
+
if (open)
|
|
260
|
+
discard();
|
|
261
|
+
else
|
|
262
|
+
openWith();
|
|
263
|
+
},
|
|
264
|
+
}
|
|
265
|
+
: {}), children: [text, editing && (_jsxs(_Fragment, { children: [_jsx("button", { type: "button", className: "tpl-link__trigger", "data-chrome": true, contentEditable: false, "aria-haspopup": "dialog", "aria-expanded": open, "aria-label": shown ? format(t.link.edit, { name: shown }) : t.link.editThis, title: t.link.editThis, onClick: (e) => {
|
|
266
|
+
e.stopPropagation();
|
|
267
|
+
if (open)
|
|
268
|
+
discard();
|
|
269
|
+
else
|
|
270
|
+
openWith();
|
|
271
|
+
} }), _jsx("span", { className: "tpl-link__store", "data-chrome": true, hidden: true, children: _jsx(EditableText, { path: urlPath, value: item.url, readOnly: true }) }), draft && at
|
|
272
|
+
? createPortal(_jsxs("form", { className: "tpl-link__pop", ref: pop, "data-chrome": true, role: "dialog", "aria-label": t.link.dialog, style: { top: at.top, left: at.left }, onMouseDown: stop, onClick: stop, onSubmit: (e) => {
|
|
273
|
+
e.preventDefault();
|
|
274
|
+
set();
|
|
275
|
+
}, children: [_jsxs("label", { className: "tpl-link__row", children: [_jsx("span", { className: "tpl-link__label", children: t.link.text }), _jsx("input", { ref: firstInput, className: "tpl-link__input", type: "text", value: draft.label, placeholder: placeholder, onChange: (e) => setDraft({ ...draft, label: e.target.value }) })] }), _jsxs("label", { className: "tpl-link__row", children: [_jsx("span", { className: "tpl-link__label", children: t.link.url }), _jsx("input", { className: "tpl-link__input", type: "url", value: draft.url, placeholder: t.placeholders.url, onChange: (e) => setDraft({ ...draft, url: e.target.value }) })] }), _jsx("div", { className: "tpl-link__actions", children: _jsx("button", { type: "submit", className: "tpl-link__ok", disabled: !settable, children: t.link.ok }) })] }), document.body)
|
|
276
|
+
: null] }))] }));
|
|
277
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The field a candidate types a line of the résumé into.
|
|
3
|
+
*
|
|
4
|
+
* It is a `contenteditable` span rather than an `<input>` or a `<textarea>`,
|
|
5
|
+
* and that is the whole reason this component exists. A form control is an
|
|
6
|
+
* ATOMIC inline box: it can be sized to its text and it can sit in the middle
|
|
7
|
+
* of a line, but it cannot be **split across two of them**. On a résumé that is
|
|
8
|
+
* fatal — "Architecture & Quality: Distributed Systems, …" is one line of text
|
|
9
|
+
* that wraps, and a control asked to hold it had to move somewhere it fitted
|
|
10
|
+
* whole, so clicking the skills dropped them below their own category. Sizing
|
|
11
|
+
* the box more cleverly could not fix it; no amount of width makes a single box
|
|
12
|
+
* occupy the end of one line and the start of the next.
|
|
13
|
+
*
|
|
14
|
+
* An editable span is not atomic. It flows, it wraps, and it breaks across
|
|
15
|
+
* lines exactly where the static text it replaces did — which is the rule this
|
|
16
|
+
* whole layer is built on: the same box, edited or not. It also deletes the
|
|
17
|
+
* machinery that was standing in for this. There is no mirror measuring the
|
|
18
|
+
* text, no `cols` neutralising a widget's opinion of its own width, and no
|
|
19
|
+
* inline grid: an inline box is already the size of its content.
|
|
20
|
+
*
|
|
21
|
+
* `plaintext-only` is what keeps it a FIELD rather than a rich-text editor.
|
|
22
|
+
* Pasting styled markup into a plain `contenteditable` brings the markup with
|
|
23
|
+
* it, and a résumé that carries a paste's colours into the PDF is a résumé the
|
|
24
|
+
* candidate cannot see is broken.
|
|
25
|
+
*/
|
|
26
|
+
export interface PlainTextFieldProps {
|
|
27
|
+
/** The text the field opens with. Read ONCE — see `initial` below. */
|
|
28
|
+
value: string;
|
|
29
|
+
/** Shown while the field is empty. Never part of the value. */
|
|
30
|
+
placeholder?: string;
|
|
31
|
+
/** Whether Enter inserts a line break, or is refused. */
|
|
32
|
+
multiline?: boolean;
|
|
33
|
+
/** The field's accessible name — its path in the résumé. */
|
|
34
|
+
label: string;
|
|
35
|
+
onChange: (next: string) => void;
|
|
36
|
+
}
|
|
37
|
+
export declare function PlainTextField({ value, placeholder, multiline, label, onChange, }: PlainTextFieldProps): import("react").JSX.Element;
|
|
38
|
+
//# sourceMappingURL=PlainTextField.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PlainTextField.d.ts","sourceRoot":"","sources":["../../src/nodes/PlainTextField.tsx"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,MAAM,WAAW,mBAAmB;IAClC,sEAAsE;IACtE,KAAK,EAAE,MAAM,CAAC;IACd,+DAA+D;IAC/D,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,yDAAyD;IACzD,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,4DAA4D;IAC5D,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;CAClC;AAKD,wBAAgB,cAAc,CAAC,EAC7B,KAAK,EACL,WAAW,EACX,SAAS,EACT,KAAK,EACL,QAAQ,GACT,EAAE,mBAAmB,+BAmFrB"}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useEffect, useRef, useState } from 'react';
|
|
3
|
+
/** One line, flattened: what a multi-line paste becomes in a single-line field. */
|
|
4
|
+
const flatten = (text) => text.replace(/\s*\n\s*/g, ' ');
|
|
5
|
+
export function PlainTextField({ value, placeholder, multiline, label, onChange, }) {
|
|
6
|
+
const el = useRef(null);
|
|
7
|
+
/**
|
|
8
|
+
* The text is written into the DOM ONCE, when the field opens, and React is
|
|
9
|
+
* never allowed to write it again.
|
|
10
|
+
*
|
|
11
|
+
* This is the one rule a controlled `contenteditable` cannot break. Re-render
|
|
12
|
+
* it from the value and every keystroke replaces the text node the caret is
|
|
13
|
+
* standing in, so the caret jumps to the start of the field and the candidate
|
|
14
|
+
* types their sentence backwards. Frozen in state, the child React holds is
|
|
15
|
+
* identical on every subsequent render, so it reconciles to nothing and the
|
|
16
|
+
* DOM the browser is editing is left alone.
|
|
17
|
+
*
|
|
18
|
+
* The field is mounted only while it is selected, so "once" means once per
|
|
19
|
+
* visit: selecting it again re-reads whatever the value has become.
|
|
20
|
+
*/
|
|
21
|
+
const [initial] = useState(value);
|
|
22
|
+
/* Emptiness is tracked HERE and not read from the value, which arrives up to
|
|
23
|
+
half a second late — the placeholder would still be sitting beside the
|
|
24
|
+
first letter typed over it. */
|
|
25
|
+
const [empty, setEmpty] = useState(value.length === 0);
|
|
26
|
+
/*
|
|
27
|
+
* Selection is what reveals the field, so the click that selected it has to
|
|
28
|
+
* land in it — and the caret goes to the END, where a form control would have
|
|
29
|
+
* put it. Without this the caret sits before the first character and typing
|
|
30
|
+
* prepends.
|
|
31
|
+
*/
|
|
32
|
+
useEffect(() => {
|
|
33
|
+
const node = el.current;
|
|
34
|
+
if (!node)
|
|
35
|
+
return;
|
|
36
|
+
/*
|
|
37
|
+
* `preventScroll`, because the field is revealed by a CLICK — it is already
|
|
38
|
+
* under the pointer, and there is nothing to scroll to. Without it the
|
|
39
|
+
* browser scrolls every ancestor to reveal the newly focused element, and
|
|
40
|
+
* inside a zoomed sheet its idea of "revealed" is not the reader's: the
|
|
41
|
+
* canvas jumped by a line or two as the caret appeared, on a page the
|
|
42
|
+
* candidate was already looking at.
|
|
43
|
+
*/
|
|
44
|
+
node.focus({ preventScroll: true });
|
|
45
|
+
const selection = window.getSelection?.();
|
|
46
|
+
if (!selection)
|
|
47
|
+
return;
|
|
48
|
+
const range = document.createRange();
|
|
49
|
+
range.selectNodeContents(node);
|
|
50
|
+
range.collapse(false);
|
|
51
|
+
selection.removeAllRanges();
|
|
52
|
+
selection.addRange(range);
|
|
53
|
+
}, []);
|
|
54
|
+
const read = (node) => {
|
|
55
|
+
const text = node.textContent ?? '';
|
|
56
|
+
setEmpty(text.length === 0);
|
|
57
|
+
onChange(multiline ? text : flatten(text));
|
|
58
|
+
};
|
|
59
|
+
return (_jsx("span", { ref: el, className: "tpl-input",
|
|
60
|
+
/*
|
|
61
|
+
* Typed as a plain string because `plaintext-only` is not in every
|
|
62
|
+
* version of React's `contentEditable` union, and the browsers this
|
|
63
|
+
* renders in — including the headless one that produces the PDF — have
|
|
64
|
+
* supported it for years.
|
|
65
|
+
*/
|
|
66
|
+
contentEditable: 'plaintext-only', suppressContentEditableWarning: true, role: "textbox", "aria-multiline": multiline || undefined, "aria-label": label, "data-placeholder": placeholder, "data-empty": empty || undefined, onInput: (e) => read(e.currentTarget), onKeyDown: (e) => {
|
|
67
|
+
// A line stays a line. The value is flattened too, for the paste that
|
|
68
|
+
// gets a newline in anyway.
|
|
69
|
+
if (!multiline && e.key === 'Enter')
|
|
70
|
+
e.preventDefault();
|
|
71
|
+
}, children: initial }));
|
|
72
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import type { CSSProperties } from 'react';
|
|
2
|
+
import { type FieldAlign, type InkId } from '@resumekit/schema';
|
|
3
|
+
/**
|
|
4
|
+
* The formatting a node may carry.
|
|
5
|
+
*
|
|
6
|
+
* Bounded on purpose. A node accepts a boolean, a named alignment and a named
|
|
7
|
+
* ink — never a style object, a class name or a raw colour — so the values a
|
|
8
|
+
* caller can express are exactly the ones the catalog defines, and what they MEAN
|
|
9
|
+
* is decided by the template's stylesheet. See `design.md`, decision 6.
|
|
10
|
+
*/
|
|
11
|
+
export interface FieldFormatting {
|
|
12
|
+
bold?: boolean;
|
|
13
|
+
align?: FieldAlign;
|
|
14
|
+
ink?: InkId;
|
|
15
|
+
href?: LinkTarget;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* A validated `http`/`https` address.
|
|
19
|
+
*
|
|
20
|
+
* An alias, not a re-declaration: `isSafeLinkTarget` in `@resumekit/schema` is the only
|
|
21
|
+
* definition of what makes one valid, and this names the type those values
|
|
22
|
+
* carry so the node's prop surface can be checked against it.
|
|
23
|
+
*/
|
|
24
|
+
export type LinkTarget = string;
|
|
25
|
+
/** Class names the template stylesheet gives meaning to. */
|
|
26
|
+
export declare function formatClass(format: FieldFormatting, base: string): string;
|
|
27
|
+
/**
|
|
28
|
+
* The one custom property a formatted node sets. Not a style prop: the value is
|
|
29
|
+
* looked up from the catalog, so an arbitrary colour cannot be passed through it.
|
|
30
|
+
*/
|
|
31
|
+
export declare function formatInk(format: FieldFormatting): CSSProperties | undefined;
|
|
32
|
+
/** Marks the element as carrying its own ink, which the stylesheet keys off. */
|
|
33
|
+
export declare function inkAttr(format: FieldFormatting): string | undefined;
|
|
34
|
+
//# sourceMappingURL=formatting.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"formatting.d.ts","sourceRoot":"","sources":["../../src/nodes/formatting.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAC3C,OAAO,EAAc,KAAK,UAAU,EAAE,KAAK,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAE5E;;;;;;;GAOG;AACH,MAAM,WAAW,eAAe;IAC9B,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,KAAK,CAAC,EAAE,UAAU,CAAC;IACnB,GAAG,CAAC,EAAE,KAAK,CAAC;IAQZ,IAAI,CAAC,EAAE,UAAU,CAAC;CACnB;AAED;;;;;;GAMG;AACH,MAAM,MAAM,UAAU,GAAG,MAAM,CAAC;AAEhC,4DAA4D;AAC5D,wBAAgB,WAAW,CAAC,MAAM,EAAE,eAAe,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM,CAQzE;AAED;;;GAGG;AACH,wBAAgB,SAAS,CAAC,MAAM,EAAE,eAAe,GAAG,aAAa,GAAG,SAAS,CAG5E;AAED,gFAAgF;AAChF,wBAAgB,OAAO,CAAC,MAAM,EAAE,eAAe,GAAG,MAAM,GAAG,SAAS,CAEnE"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { INK_COLORS } from '@resumekit/schema';
|
|
2
|
+
/** Class names the template stylesheet gives meaning to. */
|
|
3
|
+
export function formatClass(format, base) {
|
|
4
|
+
return [
|
|
5
|
+
base,
|
|
6
|
+
format.bold ? 'is-bold' : '',
|
|
7
|
+
format.align ? `is-${format.align}` : '',
|
|
8
|
+
]
|
|
9
|
+
.filter(Boolean)
|
|
10
|
+
.join(' ');
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* The one custom property a formatted node sets. Not a style prop: the value is
|
|
14
|
+
* looked up from the catalog, so an arbitrary colour cannot be passed through it.
|
|
15
|
+
*/
|
|
16
|
+
export function formatInk(format) {
|
|
17
|
+
if (!format.ink)
|
|
18
|
+
return undefined;
|
|
19
|
+
return { '--f-ink': INK_COLORS[format.ink].hex };
|
|
20
|
+
}
|
|
21
|
+
/** Marks the element as carrying its own ink, which the stylesheet keys off. */
|
|
22
|
+
export function inkAttr(format) {
|
|
23
|
+
return format.ink ? '' : undefined;
|
|
24
|
+
}
|