@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,253 @@
|
|
|
1
|
+
import { useEffect, useRef, useState } from 'react';
|
|
2
|
+
import { GripIcon, PlusIcon, TrashIcon } from '../collections/icons.js';
|
|
3
|
+
import type { CollectionHandle } from '../collections/useCollection.js';
|
|
4
|
+
import { SortableItems, useDragHandle } from '../collections/SortableItems.js';
|
|
5
|
+
import { useEditorText } from '../i18n/index.js';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* A bullet list the candidate can act on.
|
|
9
|
+
*
|
|
10
|
+
* Split from `EditableBulletList` for the reason `AuthoredItems` is split from
|
|
11
|
+
* `CollectionItems`: this module reaches the drag-and-drop library, and the
|
|
12
|
+
* read-only document — the saved-résumé view, and the renderer that produces the
|
|
13
|
+
* PDF — must not load it. The split is what makes that a fact about the bundle
|
|
14
|
+
* rather than a promise about the render.
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
export interface AuthoredBulletsProps {
|
|
18
|
+
path: string;
|
|
19
|
+
items: readonly string[];
|
|
20
|
+
bullets: CollectionHandle<string>;
|
|
21
|
+
/** Whether the list is the field being typed into. */
|
|
22
|
+
editing: boolean;
|
|
23
|
+
onEdit: (index: number, next: string) => void;
|
|
24
|
+
/** What an empty row says it wants — see `EditableBulletList`. */
|
|
25
|
+
placeholder: string;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* One bullet: its text, its grip, and its two controls.
|
|
30
|
+
*
|
|
31
|
+
* The grip stands **in the marker's column**. A bullet's first column is the
|
|
32
|
+
* marker gutter — every template draws a `•` there — and on hover the marker
|
|
33
|
+
* gives that space up to the handle rather than the handle finding space of its
|
|
34
|
+
* own. So the row does not grow, nothing to the right of it shifts, and the
|
|
35
|
+
* affordance appears exactly where the eye already is.
|
|
36
|
+
*
|
|
37
|
+
* Vertically it is centred on the whole bullet rather than sitting on the first
|
|
38
|
+
* baseline where the marker sits: it is the handle for the row, and on a bullet
|
|
39
|
+
* that wraps to three lines a top-aligned handle reads as belonging to the first
|
|
40
|
+
* of them.
|
|
41
|
+
*
|
|
42
|
+
* Add and remove sit in the page's right margin, out of the document's flow,
|
|
43
|
+
* and appear on the same hover. Both were previously shown whenever the list was
|
|
44
|
+
* selected, which meant a candidate had to click a bullet before learning it
|
|
45
|
+
* could be added to.
|
|
46
|
+
*/
|
|
47
|
+
function Bullet({
|
|
48
|
+
index,
|
|
49
|
+
item,
|
|
50
|
+
path,
|
|
51
|
+
bullets,
|
|
52
|
+
editing,
|
|
53
|
+
onEdit,
|
|
54
|
+
sortable,
|
|
55
|
+
placeholder,
|
|
56
|
+
onActivate,
|
|
57
|
+
fieldRef,
|
|
58
|
+
}: {
|
|
59
|
+
index: number;
|
|
60
|
+
item: string;
|
|
61
|
+
path: string;
|
|
62
|
+
bullets: CollectionHandle<string>;
|
|
63
|
+
editing: boolean;
|
|
64
|
+
onEdit: (index: number, next: string) => void;
|
|
65
|
+
sortable: boolean;
|
|
66
|
+
placeholder: string;
|
|
67
|
+
onActivate: (index: number) => void;
|
|
68
|
+
fieldRef: (index: number, el: HTMLTextAreaElement | null) => void;
|
|
69
|
+
}) {
|
|
70
|
+
const { handleProps, setNodeRef, style } = useDragHandle(
|
|
71
|
+
`${path}:${index}`,
|
|
72
|
+
!sortable,
|
|
73
|
+
);
|
|
74
|
+
const refusal = bullets.removeReason(index);
|
|
75
|
+
const { t, format } = useEditorText();
|
|
76
|
+
const position = { position: index + 1 };
|
|
77
|
+
|
|
78
|
+
return (
|
|
79
|
+
<li
|
|
80
|
+
className="tpl-bullet"
|
|
81
|
+
data-authored
|
|
82
|
+
/*
|
|
83
|
+
* Which bullet the caret belongs in. A bullet list is ONE editor node, so
|
|
84
|
+
* selecting it turns every bullet into a field in the same render — and
|
|
85
|
+
* without this, which of them ends up focused is left to the order the
|
|
86
|
+
* browser happens to deliver the events in.
|
|
87
|
+
*/
|
|
88
|
+
onPointerDown={() => onActivate(index)}
|
|
89
|
+
ref={sortable ? setNodeRef : undefined}
|
|
90
|
+
style={sortable ? style : undefined}
|
|
91
|
+
>
|
|
92
|
+
{/*
|
|
93
|
+
* `aria-hidden` on the glyph, never on the control: the button carries the
|
|
94
|
+
* label, and dnd-kit's keyboard sensor makes it a real way to reorder —
|
|
95
|
+
* Space picks the bullet up, the arrow keys move it, Space puts it down,
|
|
96
|
+
* Escape cancels. That is why the ↑/↓ buttons this replaces are not
|
|
97
|
+
* missed: the handle is the keyboard route as well as the pointer one,
|
|
98
|
+
* which is the only basis on which replacing them was allowed.
|
|
99
|
+
*/}
|
|
100
|
+
<button
|
|
101
|
+
type="button"
|
|
102
|
+
className="tpl-bullet__grip"
|
|
103
|
+
data-chrome
|
|
104
|
+
title={t.bullets.drag}
|
|
105
|
+
aria-label={format(t.bullets.moveLabel, position)}
|
|
106
|
+
{...(sortable ? handleProps : {})}
|
|
107
|
+
>
|
|
108
|
+
<GripIcon />
|
|
109
|
+
</button>
|
|
110
|
+
|
|
111
|
+
{editing ? (
|
|
112
|
+
<span className="tpl-text tpl-grow" data-value={item}>
|
|
113
|
+
<textarea
|
|
114
|
+
className="tpl-input"
|
|
115
|
+
ref={(el) => fieldRef(index, el)}
|
|
116
|
+
value={item}
|
|
117
|
+
rows={1}
|
|
118
|
+
aria-label={`${path}.${index}`}
|
|
119
|
+
/*
|
|
120
|
+
* The guidance survives the click into the field.
|
|
121
|
+
*
|
|
122
|
+
* The row draws it while the bullet is at rest, and this is the
|
|
123
|
+
* same sentence for the state where that drawing is replaced by a
|
|
124
|
+
* control — otherwise clicking an empty bullet to find out what
|
|
125
|
+
* goes in it removes the only thing that said. A textarea's own
|
|
126
|
+
* `placeholder` is painted by the browser and is never part of the
|
|
127
|
+
* value, so it stays out of the résumé exactly as the drawn one
|
|
128
|
+
* does.
|
|
129
|
+
*/
|
|
130
|
+
placeholder={placeholder}
|
|
131
|
+
onChange={(e) => onEdit(index, e.target.value)}
|
|
132
|
+
/>
|
|
133
|
+
</span>
|
|
134
|
+
) : (
|
|
135
|
+
/* Not being typed into, so it says what belongs in it — the same
|
|
136
|
+
guidance the read-only list draws, and for the same reason: an empty
|
|
137
|
+
bullet with no text has no width, and the row's controls hang off a
|
|
138
|
+
row a candidate cannot see. */
|
|
139
|
+
<span
|
|
140
|
+
className="tpl-text"
|
|
141
|
+
data-empty={item.length === 0 || undefined}
|
|
142
|
+
data-placeholder={placeholder}
|
|
143
|
+
>
|
|
144
|
+
{item}
|
|
145
|
+
</span>
|
|
146
|
+
)}
|
|
147
|
+
|
|
148
|
+
<span className="tpl-bullet__tools" data-chrome contentEditable={false}>
|
|
149
|
+
<button
|
|
150
|
+
type="button"
|
|
151
|
+
className="tpl-tool"
|
|
152
|
+
title={t.bullets.addBelow}
|
|
153
|
+
aria-label={format(t.bullets.addAfterLabel, position)}
|
|
154
|
+
onClick={() => bullets.add(index)}
|
|
155
|
+
>
|
|
156
|
+
<PlusIcon />
|
|
157
|
+
</button>
|
|
158
|
+
<button
|
|
159
|
+
type="button"
|
|
160
|
+
className="tpl-tool"
|
|
161
|
+
data-tone="danger"
|
|
162
|
+
disabled={refusal !== undefined}
|
|
163
|
+
/*
|
|
164
|
+
* Disabled and explained rather than hidden: a rule the candidate
|
|
165
|
+
* cannot see is a rule they run into. The words are the collection's,
|
|
166
|
+
* not this component's.
|
|
167
|
+
*/
|
|
168
|
+
title={refusal ?? t.bullets.remove}
|
|
169
|
+
aria-label={format(t.bullets.removeLabel, position)}
|
|
170
|
+
onClick={() => bullets.remove(index)}
|
|
171
|
+
>
|
|
172
|
+
<TrashIcon />
|
|
173
|
+
</button>
|
|
174
|
+
</span>
|
|
175
|
+
</li>
|
|
176
|
+
);
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
export default function AuthoredBullets({
|
|
180
|
+
path,
|
|
181
|
+
items,
|
|
182
|
+
bullets,
|
|
183
|
+
editing,
|
|
184
|
+
onEdit,
|
|
185
|
+
placeholder,
|
|
186
|
+
}: AuthoredBulletsProps) {
|
|
187
|
+
const sortable = bullets.canMove;
|
|
188
|
+
const ids = items.map((_, index) => `${path}:${index}`);
|
|
189
|
+
|
|
190
|
+
/* The bullet the candidate pointed at, and the fields to put the caret in. */
|
|
191
|
+
const [caret, setCaret] = useState<number | null>(null);
|
|
192
|
+
const fields = useRef<Record<number, HTMLTextAreaElement | null>>({});
|
|
193
|
+
/* Read by the ref callback below, which runs during a commit and would
|
|
194
|
+
otherwise close over the caret this render happened to start with. */
|
|
195
|
+
const wanted = useRef(caret);
|
|
196
|
+
wanted.current = caret;
|
|
197
|
+
|
|
198
|
+
/*
|
|
199
|
+
* `preventScroll`, for the reason `PlainTextField` gives: the bullet was
|
|
200
|
+
* pointed at, so it is already on screen, and focusing it must not move the
|
|
201
|
+
* page. Inside the sheet's `zoom` the browser's own idea of where it is
|
|
202
|
+
* scrolling to is wrong by a factor of it, so "reveal the focused element"
|
|
203
|
+
* threw the line the candidate had just clicked out of view.
|
|
204
|
+
*/
|
|
205
|
+
const putCaretIn = (field: HTMLTextAreaElement | null | undefined) =>
|
|
206
|
+
field?.focus({ preventScroll: true });
|
|
207
|
+
|
|
208
|
+
useEffect(() => {
|
|
209
|
+
if (!editing || caret === null) return;
|
|
210
|
+
putCaretIn(fields.current[caret]);
|
|
211
|
+
}, [editing, caret]);
|
|
212
|
+
|
|
213
|
+
const rows = items.map((item, index) => (
|
|
214
|
+
<Bullet
|
|
215
|
+
// Bullets have no identity of their own — they are strings the candidate
|
|
216
|
+
// reorders and deletes — so the index is the only honest key.
|
|
217
|
+
key={index}
|
|
218
|
+
index={index}
|
|
219
|
+
item={item}
|
|
220
|
+
path={path}
|
|
221
|
+
bullets={bullets}
|
|
222
|
+
editing={editing}
|
|
223
|
+
onEdit={onEdit}
|
|
224
|
+
placeholder={placeholder}
|
|
225
|
+
sortable={sortable}
|
|
226
|
+
onActivate={setCaret}
|
|
227
|
+
fieldRef={(i, el) => {
|
|
228
|
+
fields.current[i] = el;
|
|
229
|
+
/*
|
|
230
|
+
* And focused as it ARRIVES, not only when the caret moves.
|
|
231
|
+
*
|
|
232
|
+
* A click both selects the list and names the bullet, so the field is
|
|
233
|
+
* mounted by the same commit that sets the caret — but the row can be
|
|
234
|
+
* mounted again straight after, when the click that revealed it also
|
|
235
|
+
* selects the entry around it. The effect above does not run a second
|
|
236
|
+
* time (neither `editing` nor `caret` has changed), so the focus it
|
|
237
|
+
* placed went out with the old element and the candidate typed into
|
|
238
|
+
* nothing. Re-placing it here costs a call on a field that already has
|
|
239
|
+
* it and closes the gap the timing opened.
|
|
240
|
+
*/
|
|
241
|
+
if (el && i === wanted.current) putCaretIn(el);
|
|
242
|
+
}}
|
|
243
|
+
/>
|
|
244
|
+
));
|
|
245
|
+
|
|
246
|
+
return sortable ? (
|
|
247
|
+
<SortableItems ids={ids} onMove={bullets.move}>
|
|
248
|
+
{rows}
|
|
249
|
+
</SortableItems>
|
|
250
|
+
) : (
|
|
251
|
+
<>{rows}</>
|
|
252
|
+
);
|
|
253
|
+
}
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
import type { ComponentType, ReactNode } from 'react';
|
|
2
|
+
import type { CustomEntry, CustomSection } from '@resumekit/schema';
|
|
3
|
+
import { useEditorText } from '../i18n/index.js';
|
|
4
|
+
import { EditableText } from './EditableText.js';
|
|
5
|
+
import { Heading } from '../kit/Heading.js';
|
|
6
|
+
import { leadLetters, type HeadingLead } from '../kit/textShapes.js';
|
|
7
|
+
import {
|
|
8
|
+
CollectionItems,
|
|
9
|
+
type ItemRootProps,
|
|
10
|
+
} from '../collections/CollectionItems.js';
|
|
11
|
+
import { useCustomEntries } from '../collections/useCustomEntries.js';
|
|
12
|
+
|
|
13
|
+
/** What every template supplies for one entry of a candidate's own section. */
|
|
14
|
+
export type CustomEntryComponent = ComponentType<{
|
|
15
|
+
item: CustomEntry;
|
|
16
|
+
path: string;
|
|
17
|
+
chrome: ReactNode;
|
|
18
|
+
itemProps: ItemRootProps;
|
|
19
|
+
}>;
|
|
20
|
+
|
|
21
|
+
export interface CustomSectionsProps {
|
|
22
|
+
/*
|
|
23
|
+
* OPTIONAL, and that is not defensive padding.
|
|
24
|
+
*
|
|
25
|
+
* `custom_sections` is defaulted by `ResumeObjectSchema`, but a résumé only
|
|
26
|
+
* carries the default if it was PARSED. A writer résumé read straight out of
|
|
27
|
+
* storage and handed to a template has never been through the schema, so the
|
|
28
|
+
* field is genuinely absent — and a template that assumed otherwise crashed
|
|
29
|
+
* every document written before this change. Tolerated here, once, rather
|
|
30
|
+
* than guarded at four call sites.
|
|
31
|
+
*/
|
|
32
|
+
sections: readonly CustomSection[] | undefined;
|
|
33
|
+
/** The template's own section wrapper class. */
|
|
34
|
+
sectionClass: string;
|
|
35
|
+
/** The template's own heading class, so the heading matches its neighbours. */
|
|
36
|
+
headingClass: string;
|
|
37
|
+
/**
|
|
38
|
+
* The template's own entry markup.
|
|
39
|
+
*
|
|
40
|
+
* This is what removed the neutral layout. The original note here explained
|
|
41
|
+
* that borrowing one template's entry markup "would render as debris in the
|
|
42
|
+
* other three" — true while entry markup was inline in a document's JSX, and
|
|
43
|
+
* false now that each template names a component for it. A candidate's own
|
|
44
|
+
* section is set in the same pattern as the sections above it.
|
|
45
|
+
*/
|
|
46
|
+
Entry: CustomEntryComponent;
|
|
47
|
+
/** As `DocumentSection`'s. */
|
|
48
|
+
headingLead?: HeadingLead;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
/** One declared section: the template's heading, the template's entries. */
|
|
52
|
+
function AuthoredSection({
|
|
53
|
+
section,
|
|
54
|
+
index,
|
|
55
|
+
sectionClass,
|
|
56
|
+
headingClass,
|
|
57
|
+
headingLead,
|
|
58
|
+
Entry,
|
|
59
|
+
}: {
|
|
60
|
+
section: CustomSection;
|
|
61
|
+
index: number;
|
|
62
|
+
sectionClass: string;
|
|
63
|
+
headingClass: string;
|
|
64
|
+
headingLead?: HeadingLead;
|
|
65
|
+
Entry: CustomEntryComponent;
|
|
66
|
+
}) {
|
|
67
|
+
const collection = useCustomEntries(section.id, section.entries);
|
|
68
|
+
const { t } = useEditorText();
|
|
69
|
+
const base = `custom_sections.${index}`;
|
|
70
|
+
|
|
71
|
+
return (
|
|
72
|
+
<section className={sectionClass}>
|
|
73
|
+
<Heading
|
|
74
|
+
level={2}
|
|
75
|
+
className={headingClass}
|
|
76
|
+
data-block
|
|
77
|
+
data-keep-with-next
|
|
78
|
+
>
|
|
79
|
+
<EditableText
|
|
80
|
+
path={`${base}.heading`}
|
|
81
|
+
value={section.heading}
|
|
82
|
+
placeholder={t.placeholders.heading}
|
|
83
|
+
shape={headingLead && leadLetters(headingLead)}
|
|
84
|
+
/>
|
|
85
|
+
</Heading>
|
|
86
|
+
|
|
87
|
+
<CollectionItems
|
|
88
|
+
collection={collection}
|
|
89
|
+
basePath={`${base}.entries`}
|
|
90
|
+
noun="entry"
|
|
91
|
+
label={section.heading || t.customSection}
|
|
92
|
+
>
|
|
93
|
+
{({ item, path, chrome, itemProps }) => (
|
|
94
|
+
<Entry
|
|
95
|
+
item={item}
|
|
96
|
+
path={path}
|
|
97
|
+
chrome={chrome}
|
|
98
|
+
itemProps={itemProps}
|
|
99
|
+
/>
|
|
100
|
+
)}
|
|
101
|
+
</CollectionItems>
|
|
102
|
+
</section>
|
|
103
|
+
);
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
/**
|
|
107
|
+
* The sections a candidate added, rendered in whichever template is mounted.
|
|
108
|
+
*
|
|
109
|
+
* Every field is a Craft.js linked node addressed by its DOMAIN path, exactly
|
|
110
|
+
* as the writer-produced fields are, so `serialize.ts` reads them with the walk
|
|
111
|
+
* it already has and nothing here needs to know a custom section is special.
|
|
112
|
+
*
|
|
113
|
+
* Nothing is a canvas and nothing takes a drag connector: an authored section
|
|
114
|
+
* is as locked as a written one.
|
|
115
|
+
*/
|
|
116
|
+
export function CustomSections({
|
|
117
|
+
sections = [],
|
|
118
|
+
sectionClass,
|
|
119
|
+
headingClass,
|
|
120
|
+
headingLead,
|
|
121
|
+
Entry,
|
|
122
|
+
}: CustomSectionsProps) {
|
|
123
|
+
return (
|
|
124
|
+
<>
|
|
125
|
+
{sections.map((section, i) => (
|
|
126
|
+
<AuthoredSection
|
|
127
|
+
key={section.id}
|
|
128
|
+
section={section}
|
|
129
|
+
index={i}
|
|
130
|
+
sectionClass={sectionClass}
|
|
131
|
+
headingClass={headingClass}
|
|
132
|
+
headingLead={headingLead}
|
|
133
|
+
Entry={Entry}
|
|
134
|
+
/>
|
|
135
|
+
))}
|
|
136
|
+
</>
|
|
137
|
+
);
|
|
138
|
+
}
|
|
@@ -0,0 +1,186 @@
|
|
|
1
|
+
import { Suspense, lazy, useMemo } from 'react';
|
|
2
|
+
import { useField } from '../fields/field-registry.js';
|
|
3
|
+
import { formatClass, formatInk, inkAttr } from './formatting.js';
|
|
4
|
+
import { useFieldFormat } from '../presentation-context.js';
|
|
5
|
+
import {
|
|
6
|
+
movedTo,
|
|
7
|
+
useCollection,
|
|
8
|
+
type CollectionStore,
|
|
9
|
+
} from '../collections/useCollection.js';
|
|
10
|
+
import { useAuthoring } from '../collections/authoring-context.js';
|
|
11
|
+
import { useAutosave } from '../autosave-context.js';
|
|
12
|
+
import type { AuthoredBulletsProps } from './AuthoredBullets.js';
|
|
13
|
+
import { useEditorText } from '../i18n/index.js';
|
|
14
|
+
import { usePicture } from '../picture-context.js';
|
|
15
|
+
|
|
16
|
+
export interface EditableBulletListProps {
|
|
17
|
+
/**
|
|
18
|
+
* What an empty row says it wants.
|
|
19
|
+
*
|
|
20
|
+
* A list of achievements and a list of skills are the same control and not
|
|
21
|
+
* the same field: a skills row guided by "what you did, and what changed
|
|
22
|
+
* because of it" asks for a sentence where the page wants a keyword.
|
|
23
|
+
*/
|
|
24
|
+
placeholder?: string;
|
|
25
|
+
/** Where this list lives in the `ResumeObject` — e.g. `experience.0.bullets`. */
|
|
26
|
+
path: string;
|
|
27
|
+
items: string[];
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* A list of bullets, and the same collection rules everything else obeys.
|
|
32
|
+
*
|
|
33
|
+
* A bullet rewords work the résumé already claims, so retyping it is the
|
|
34
|
+
* candidate speaking about their own experience.
|
|
35
|
+
*
|
|
36
|
+
* What is different here is only the STORE. A bullet is text, and text lives in
|
|
37
|
+
* the editor's own node props — so add, remove and move write there rather than
|
|
38
|
+
* into the presentation overlay, where an appended entry lives. Every rule
|
|
39
|
+
* around them (that a list has a minimum, what the refusal says when it is
|
|
40
|
+
* reached, what a move means) comes from `useCollection`, which is the same
|
|
41
|
+
* source `experience` and `education` read. Before `document-collections` (#57)
|
|
42
|
+
* those rules were written out again here, and the minimum was a constant this
|
|
43
|
+
* file owned.
|
|
44
|
+
*
|
|
45
|
+
* Its controls live in `AuthoredBullets`, reached through a dynamic import, so
|
|
46
|
+
* a document that is only being read carries neither them nor the drag library
|
|
47
|
+
* they use. What is left here is the list itself, which is the same list either
|
|
48
|
+
* way.
|
|
49
|
+
*/
|
|
50
|
+
|
|
51
|
+
/*
|
|
52
|
+
* Loaded on demand — see `AuthoredBullets`. The read-only fallback below is
|
|
53
|
+
* rendered until it arrives, so the bullets are on screen before their controls
|
|
54
|
+
* rather than after them.
|
|
55
|
+
*/
|
|
56
|
+
const AuthoredBullets = lazy(() => import('./AuthoredBullets.js')) as (
|
|
57
|
+
props: AuthoredBulletsProps,
|
|
58
|
+
) => React.ReactElement;
|
|
59
|
+
export function EditableBulletList({
|
|
60
|
+
path,
|
|
61
|
+
items,
|
|
62
|
+
placeholder: givenPlaceholder,
|
|
63
|
+
}: EditableBulletListProps) {
|
|
64
|
+
const { t } = useEditorText();
|
|
65
|
+
const placeholder = givenPlaceholder ?? t.placeholders.bullet;
|
|
66
|
+
const format = useFieldFormat(path);
|
|
67
|
+
const picture = usePicture();
|
|
68
|
+
const authoring = useAuthoring();
|
|
69
|
+
/*
|
|
70
|
+
* Only the TEXT is asked for here. Adding, removing and reordering a bullet
|
|
71
|
+
* are stored by `useCollection`, which is where all three actually happen —
|
|
72
|
+
* this component would be a second, drifting opinion about the same events.
|
|
73
|
+
* What it owns is the one thing `useCollection` cannot see: a keystroke.
|
|
74
|
+
*/
|
|
75
|
+
const { saveSoon } = useAutosave();
|
|
76
|
+
const { value: live, editing, selected, select, set } = useField(path, items);
|
|
77
|
+
|
|
78
|
+
/*
|
|
79
|
+
* COPIES, where this used to `splice` an Immer draft inside `setProp`.
|
|
80
|
+
*
|
|
81
|
+
* That draft was the one place Craft's Immer integration was load-bearing
|
|
82
|
+
* rather than incidental, and it is the line to read twice in this file: a
|
|
83
|
+
* mutating call was correct there because nothing outside `setProp` ever
|
|
84
|
+
* touched those props. Here the value is ordinary state, so a mutation would
|
|
85
|
+
* be a mutation — the array is rebuilt instead, which is what React expects
|
|
86
|
+
* and what makes an edit and a reorder the same kind of operation.
|
|
87
|
+
*/
|
|
88
|
+
const store = useMemo<CollectionStore<string>>(
|
|
89
|
+
() => ({
|
|
90
|
+
items: live,
|
|
91
|
+
insert: (index, item) =>
|
|
92
|
+
set([...live.slice(0, index), item, ...live.slice(index)]),
|
|
93
|
+
removeAt: (index) => set(live.filter((_, at) => at !== index)),
|
|
94
|
+
reorder: (from, to) => set(movedTo([...live], from, to)),
|
|
95
|
+
}),
|
|
96
|
+
[live, set],
|
|
97
|
+
);
|
|
98
|
+
|
|
99
|
+
const bullets = useCollection<string>('experience_bullets', store);
|
|
100
|
+
|
|
101
|
+
/*
|
|
102
|
+
* One empty bullet, drawn but not STORED, for a list that has none.
|
|
103
|
+
*
|
|
104
|
+
* An entry with no bullets rendered an empty `<ul>`: nothing on the page, and
|
|
105
|
+
* every control that adds or edits a bullet hangs off a bullet ROW, so the
|
|
106
|
+
* list a candidate needed to start was the one thing they could not reach.
|
|
107
|
+
* A minted role carries a bullet for this reason; an entry the writer
|
|
108
|
+
* produced without one, or an authored section's first entry, does not.
|
|
109
|
+
*
|
|
110
|
+
* Drawn rather than stored, because storing it would put an empty bullet into
|
|
111
|
+
* every such entry the moment the editor opened — a change to the document
|
|
112
|
+
* that the candidate did not make and would have to undo. It becomes real on
|
|
113
|
+
* the first keystroke, which is the moment they meant it.
|
|
114
|
+
*
|
|
115
|
+
* Only while AUTHORING. A document being read has nothing to fill in, and an
|
|
116
|
+
* empty `<li>` under a role is a bullet in the exported file.
|
|
117
|
+
*/
|
|
118
|
+
const guided = authoring !== null && live.length === 0;
|
|
119
|
+
const shown = guided ? [''] : live;
|
|
120
|
+
|
|
121
|
+
const edit = (index: number, next: string) => {
|
|
122
|
+
/* The guide row has no entry behind it yet, so typing into it CREATES the
|
|
123
|
+
list rather than replacing a member of an empty one — `map` over `[]`
|
|
124
|
+
yields `[]`, and the first thing typed would be dropped. */
|
|
125
|
+
set(guided ? [next] : live.map((item, at) => (at === index ? next : item)));
|
|
126
|
+
saveSoon();
|
|
127
|
+
};
|
|
128
|
+
|
|
129
|
+
/* A press selects the field — Craft's `connect` used to attach this. */
|
|
130
|
+
const onMouseDown = editing ? () => select() : undefined;
|
|
131
|
+
|
|
132
|
+
const plain = shown.map((item, index) => (
|
|
133
|
+
// Bullets have no identity of their own — they are strings the candidate
|
|
134
|
+
// reorders and deletes — so the index is the only honest key.
|
|
135
|
+
<li key={index} className="tpl-bullet">
|
|
136
|
+
{/*
|
|
137
|
+
* An empty bullet says what belongs in it, like every other empty field.
|
|
138
|
+
*
|
|
139
|
+
* Without this it was a span with no text and therefore no width: a role
|
|
140
|
+
* added to a blank résumé comes with one bullet, per its `mint`, and that
|
|
141
|
+
* bullet was invisible. Everything that types into it, adds another or
|
|
142
|
+
* removes it hangs off the row — so a candidate saw a marker with nothing
|
|
143
|
+
* beside it and had nothing to aim at. Drawn by CSS from the attribute,
|
|
144
|
+
* never a text node, so it stays out of the résumé's own text.
|
|
145
|
+
*/}
|
|
146
|
+
<span
|
|
147
|
+
className="tpl-text"
|
|
148
|
+
data-empty={item.length === 0 || undefined}
|
|
149
|
+
data-placeholder={picture ? undefined : placeholder}
|
|
150
|
+
>
|
|
151
|
+
{item}
|
|
152
|
+
</span>
|
|
153
|
+
</li>
|
|
154
|
+
));
|
|
155
|
+
|
|
156
|
+
return (
|
|
157
|
+
<ul
|
|
158
|
+
onMouseDown={onMouseDown}
|
|
159
|
+
className={formatClass(format, 'tpl-bullets')}
|
|
160
|
+
style={formatInk(format)}
|
|
161
|
+
data-ink={inkAttr(format)}
|
|
162
|
+
data-path={picture ? undefined : path}
|
|
163
|
+
data-editing={selected || undefined}
|
|
164
|
+
>
|
|
165
|
+
{/*
|
|
166
|
+
A plain list, and the only thing rendered when the document is being
|
|
167
|
+
read. It is also the fallback while the editing chunk loads, so the two
|
|
168
|
+
states differ by the controls and by nothing else.
|
|
169
|
+
*/}
|
|
170
|
+
{authoring ? (
|
|
171
|
+
<Suspense fallback={plain}>
|
|
172
|
+
<AuthoredBullets
|
|
173
|
+
path={path}
|
|
174
|
+
items={shown}
|
|
175
|
+
bullets={bullets}
|
|
176
|
+
editing={selected}
|
|
177
|
+
onEdit={edit}
|
|
178
|
+
placeholder={placeholder}
|
|
179
|
+
/>
|
|
180
|
+
</Suspense>
|
|
181
|
+
) : (
|
|
182
|
+
plain
|
|
183
|
+
)}
|
|
184
|
+
</ul>
|
|
185
|
+
);
|
|
186
|
+
}
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
import { useState } from 'react';
|
|
2
|
+
import { useField } from '../fields/field-registry.js';
|
|
3
|
+
import { formatClass, formatInk, inkAttr } from './formatting.js';
|
|
4
|
+
import { useFieldFormat } from '../presentation-context.js';
|
|
5
|
+
import { useAutosave } from '../autosave-context.js';
|
|
6
|
+
import { PlainTextField } from './PlainTextField.js';
|
|
7
|
+
import { usePicture } from '../picture-context.js';
|
|
8
|
+
|
|
9
|
+
export interface EditableInlineListProps {
|
|
10
|
+
/** Where this list lives in the `ResumeObject` — e.g. `skills.0.items`. */
|
|
11
|
+
path: string;
|
|
12
|
+
items: string[];
|
|
13
|
+
/**
|
|
14
|
+
* Shown while the list is empty. Never saved — the same bargain
|
|
15
|
+
* `EditableText` makes, and drawn the same way, by CSS.
|
|
16
|
+
*
|
|
17
|
+
* Not optional in practice, whatever the type says. An empty inline list has
|
|
18
|
+
* no text, and a span with no text has no width: a skills group the candidate
|
|
19
|
+
* had just added drew its category, a colon, and then nothing — no visible
|
|
20
|
+
* field, and nothing with an area to click on. The guidance is what gives an
|
|
21
|
+
* empty list a body.
|
|
22
|
+
*/
|
|
23
|
+
placeholder?: string;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
/** How a keyword list reads on the page, and how the candidate types it. */
|
|
27
|
+
const SEPARATOR = ', ';
|
|
28
|
+
|
|
29
|
+
function split(text: string): string[] {
|
|
30
|
+
return text
|
|
31
|
+
.split(',')
|
|
32
|
+
.map((item) => item.trim())
|
|
33
|
+
.filter((item) => item.length > 0);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* A keyword list rendered inline — `Node.js, TypeScript, NestJS` — which is how
|
|
38
|
+
* the knowledge base says skills belong on a resume: a flat comma-separated
|
|
39
|
+
* list, no rating bars, no years-per-skill, no grid.
|
|
40
|
+
*
|
|
41
|
+
* While it is being edited the raw text is held locally and the split array is
|
|
42
|
+
* written through to the node on every keystroke. Deriving the displayed text
|
|
43
|
+
* from the array instead would delete the comma the moment it was typed.
|
|
44
|
+
*/
|
|
45
|
+
export function EditableInlineList({
|
|
46
|
+
path,
|
|
47
|
+
items,
|
|
48
|
+
placeholder,
|
|
49
|
+
}: EditableInlineListProps) {
|
|
50
|
+
const format = useFieldFormat(path);
|
|
51
|
+
const picture = usePicture();
|
|
52
|
+
const { value, editing, selected, select, set } = useField(path, items);
|
|
53
|
+
|
|
54
|
+
/* Typing, so deferred — the same bargain `EditableText` makes. */
|
|
55
|
+
const { saveSoon } = useAutosave();
|
|
56
|
+
|
|
57
|
+
/*
|
|
58
|
+
* The raw text, held locally while it is being typed.
|
|
59
|
+
*
|
|
60
|
+
* Deriving the displayed text from the array instead would delete the comma
|
|
61
|
+
* the moment it was typed. The field itself is uncontrolled — see
|
|
62
|
+
* `PlainTextField` — so this is only what the UNSELECTED text is read from
|
|
63
|
+
* once the candidate leaves.
|
|
64
|
+
*/
|
|
65
|
+
const [buffer, setBuffer] = useState<string | null>(null);
|
|
66
|
+
|
|
67
|
+
const text = buffer ?? value.join(SEPARATOR);
|
|
68
|
+
|
|
69
|
+
const change = (next: string) => {
|
|
70
|
+
setBuffer(next);
|
|
71
|
+
set(split(next));
|
|
72
|
+
saveSoon();
|
|
73
|
+
};
|
|
74
|
+
|
|
75
|
+
/* A press selects the field — Craft's `connect` used to attach this. */
|
|
76
|
+
const onMouseDown = editing ? () => select() : undefined;
|
|
77
|
+
|
|
78
|
+
return (
|
|
79
|
+
<span
|
|
80
|
+
onMouseDown={onMouseDown}
|
|
81
|
+
className={formatClass(format, 'tpl-text')}
|
|
82
|
+
style={formatInk(format)}
|
|
83
|
+
data-ink={inkAttr(format)}
|
|
84
|
+
/*
|
|
85
|
+
* Only while it is CLOSED. The field draws its own guidance once it is
|
|
86
|
+
* open, and marking the box empty as well would print the sentence twice
|
|
87
|
+
* — the same split `EditableText` makes for the same reason.
|
|
88
|
+
*/
|
|
89
|
+
data-empty={(!selected && text.length === 0) || undefined}
|
|
90
|
+
data-placeholder={picture ? undefined : placeholder}
|
|
91
|
+
data-path={picture ? undefined : path}
|
|
92
|
+
>
|
|
93
|
+
{selected ? (
|
|
94
|
+
/*
|
|
95
|
+
* Keyed on nothing and mounted only while selected, so it re-reads the
|
|
96
|
+
* list each time it is opened and holds its own text in between.
|
|
97
|
+
*/
|
|
98
|
+
<PlainTextField
|
|
99
|
+
value={text}
|
|
100
|
+
placeholder={placeholder}
|
|
101
|
+
label={path}
|
|
102
|
+
onChange={change}
|
|
103
|
+
/>
|
|
104
|
+
) : (
|
|
105
|
+
text
|
|
106
|
+
)}
|
|
107
|
+
</span>
|
|
108
|
+
);
|
|
109
|
+
}
|