Skip to content

A one-of-a-kind resume builder that keeps your privacy in mind. Completely secure, customizable, portable, open-source and free forever. Try it out today!

fix: keep brief PDF bullet rows together (#3751)

Amruth Pillai8e080c922902
diff --git a/packages/pdf/src/forme/fixtures/long.json b/packages/pdf/src/forme/fixtures/long.json
new file mode 100644
index 000000000..45dd3c7fd
--- /dev/null
+++ b/packages/pdf/src/forme/fixtures/long.json
@@ -0,0 +1,602 @@
+{
+ "picture": {
+ "hidden": false,
+ "fit": "cover",
+ "url": "",
+ "size": 80,
+ "rotation": 0,
+ "aspectRatio": 1,
+ "borderRadius": 0,
+ "borderColor": "rgba(0, 0, 0, 0.5)",
+ "borderWidth": 0,
+ "shadowColor": "rgba(0, 0, 0, 0.5)",
+ "shadowWidth": 0
+ },
+ "basics": {
+ "name": "Jordan Long",
+ "headline": "Audit Long Senior Consultant",
+ "email": "[email protected]",
+ "phone": "+49 30 555 0100",
+ "location": "Berlin, Germany",
+ "website": {
+ "url": "https://example.com/portfolio",
+ "label": ""
+ },
+ "customFields": []
+ },
+ "summary": {
+ "title": "",
+ "icon": "article",
+ "columns": 1,
+ "hidden": false,
+ "showHeading": true,
+ "keepTogether": false,
+ "startOnNewPage": false,
+ "content": "<p>Experienced professional creating accessible products with international teams. Seeking thoughtful teams and measurable customer outcomes.</p>"
+ },
+ "sections": {
+ "profiles": {
+ "title": "",
+ "icon": "messenger-logo",
+ "columns": 1,
+ "hidden": false,
+ "showHeading": true,
+ "keepTogether": false,
+ "startOnNewPage": false,
+ "items": []
+ },
+ "experience": {
+ "title": "",
+ "icon": "briefcase",
+ "columns": 1,
+ "hidden": false,
+ "showHeading": true,
+ "keepTogether": false,
+ "startOnNewPage": false,
+ "items": [
+ {
+ "id": "7a4cc1a3-6836-4513-86a6-c47c44a4ca6a",
+ "hidden": false,
+ "company": "Synthetic Studio 1",
+ "position": "Engineering Role 1",
+ "location": "Remote",
+ "period": "2020 – Present",
+ "dates": {
+ "start": "2020",
+ "end": "",
+ "present": true
+ },
+ "website": {
+ "url": "",
+ "label": "",
+ "inlineLink": false
+ },
+ "description": "<ul><li>Project 1.1: Built accessible services for global customers, mentored four engineers, and reduced processing time by 25%. Tracked reliability and customer feedback.</li><li>Project 1.2: Built accessible services for global customers, mentored four engineers, and reduced processing time by 25%. Tracked reliability and customer feedback.</li><li>Project 1.3: Built accessible services for global customers, mentored four engineers, and reduced processing time by 25%. Tracked reliability and customer feedback.</li><li>Project 1.4: Built accessible services for global customers, mentored four engineers, and reduced processing time by 25%. Tracked reliability and customer feedback.</li><li>Project 1.5: Built accessible services for global customers, mentored four engineers, and reduced processing time by 25%. Tracked reliability and customer feedback.</li><li>Project 1.6: Built accessible services for global customers, mentored four engineers, and reduced processing time by 25%. Tracked reliability and customer feedback.</li></ul>",
+ "roles": []
+ },
+ {
+ "id": "a9724065-7f83-4773-ad3b-5778b0c24b87",
+ "hidden": false,
+ "company": "Synthetic Studio 2",
+ "position": "Engineering Role 2",
+ "location": "Remote",
+ "period": "2018 – 2019",
+ "dates": {
+ "start": "2018",
+ "end": "2019",
+ "present": false
+ },
+ "website": {
+ "url": "",
+ "label": "",
+ "inlineLink": false
+ },
+ "description": "<ul><li>Project 2.1: Built accessible services for global customers, mentored four engineers, and reduced processing time by 25%. Tracked reliability and customer feedback.</li><li>Project 2.2: Built accessible services for global customers, mentored four engineers, and reduced processing time by 25%. Tracked reliability and customer feedback.</li><li>Project 2.3: Built accessible services for global customers, mentored four engineers, and reduced processing time by 25%. Tracked reliability and customer feedback.</li><li>Project 2.4: Built accessible services for global customers, mentored four engineers, and reduced processing time by 25%. Tracked reliability and customer feedback.</li><li>Project 2.5: Built accessible services for global customers, mentored four engineers, and reduced processing time by 25%. Tracked reliability and customer feedback.</li><li>Project 2.6: Built accessible services for global customers, mentored four engineers, and reduced processing time by 25%. Tracked reliability and customer feedback.</li></ul>",
+ "roles": []
+ },
+ {
+ "id": "21bbb873-6ad0-4ae6-9e80-42dfbc241687",
+ "hidden": false,
+ "company": "Synthetic Studio 3",
+ "position": "Engineering Role 3",
+ "location": "Remote",
+ "period": "2017 – 2018",
+ "dates": {
+ "start": "2017",
+ "end": "2018",
+ "present": false
+ },
+ "website": {
+ "url": "",
+ "label": "",
+ "inlineLink": false
+ },
+ "description": "<ul><li>Project 3.1: Built accessible services for global customers, mentored four engineers, and reduced processing time by 25%. Tracked reliability and customer feedback.</li><li>Project 3.2: Built accessible services for global customers, mentored four engineers, and reduced processing time by 25%. Tracked reliability and customer feedback.</li><li>Project 3.3: Built accessible services for global customers, mentored four engineers, and reduced processing time by 25%. Tracked reliability and customer feedback.</li><li>Project 3.4: Built accessible services for global customers, mentored four engineers, and reduced processing time by 25%. Tracked reliability and customer feedback.</li><li>Project 3.5: Built accessible services for global customers, mentored four engineers, and reduced processing time by 25%. Tracked reliability and customer feedback.</li><li>Project 3.6: Built accessible services for global customers, mentored four engineers, and reduced processing time by 25%. Tracked reliability and customer feedback.</li></ul>",
+ "roles": []
+ },
+ {
+ "id": "626003bb-0e3a-4f30-9528-50b169622d47",
+ "hidden": false,
+ "company": "Synthetic Studio 4",
+ "position": "Engineering Role 4",
+ "location": "Remote",
+ "period": "2016 – 2017",
+ "dates": {
+ "start": "2016",
+ "end": "2017",
+ "present": false
+ },
+ "website": {
+ "url": "",
+ "label": "",
+ "inlineLink": false
+ },
+ "description": "<ul><li>Project 4.1: Built accessible services for global customers, mentored four engineers, and reduced processing time by 25%. Tracked reliability and customer feedback.</li><li>Project 4.2: Built accessible services for global customers, mentored four engineers, and reduced processing time by 25%. Tracked reliability and customer feedback.</li><li>Project 4.3: Built accessible services for global customers, mentored four engineers, and reduced processing time by 25%. Tracked reliability and customer feedback.</li><li>Project 4.4: Built accessible services for global customers, mentored four engineers, and reduced processing time by 25%. Tracked reliability and customer feedback.</li><li>Project 4.5: Built accessible services for global customers, mentored four engineers, and reduced processing time by 25%. Tracked reliability and customer feedback.</li><li>Project 4.6: Built accessible services for global customers, mentored four engineers, and reduced processing time by 25%. Tracked reliability and customer feedback.</li></ul>",
+ "roles": []
+ },
+ {
+ "id": "a94c3a3d-6f8f-4e91-8350-05f13c612493",
+ "hidden": false,
+ "company": "Synthetic Studio 5",
+ "position": "Engineering Role 5",
+ "location": "Remote",
+ "period": "2015 – 2016",
+ "dates": {
+ "start": "2015",
+ "end": "2016",
+ "present": false
+ },
+ "website": {
+ "url": "",
+ "label": "",
+ "inlineLink": false
+ },
+ "description": "<ul><li>Project 5.1: Built accessible services for global customers, mentored four engineers, and reduced processing time by 25%. Tracked reliability and customer feedback.</li><li>Project 5.2: Built accessible services for global customers, mentored four engineers, and reduced processing time by 25%. Tracked reliability and customer feedback.</li><li>Project 5.3: Built accessible services for global customers, mentored four engineers, and reduced processing time by 25%. Tracked reliability and customer feedback.</li><li>Project 5.4: Built accessible services for global customers, mentored four engineers, and reduced processing time by 25%. Tracked reliability and customer feedback.</li><li>Project 5.5: Built accessible services for global customers, mentored four engineers, and reduced processing time by 25%. Tracked reliability and customer feedback.</li><li>Project 5.6: Built accessible services for global customers, mentored four engineers, and reduced processing time by 25%. Tracked reliability and customer feedback.</li></ul>",
+ "roles": []
+ },
+ {
+ "id": "44bd127f-fb9d-4fda-86a2-b3905e9b8fb7",
+ "hidden": false,
+ "company": "Synthetic Studio 6",
+ "position": "Engineering Role 6",
+ "location": "Remote",
+ "period": "2014 – 2015",
+ "dates": {
+ "start": "2014",
+ "end": "2015",
+ "present": false
+ },
+ "website": {
+ "url": "",
+ "label": "",
+ "inlineLink": false
+ },
+ "description": "<ul><li>Project 6.1: Built accessible services for global customers, mentored four engineers, and reduced processing time by 25%. Tracked reliability and customer feedback.</li><li>Project 6.2: Built accessible services for global customers, mentored four engineers, and reduced processing time by 25%. Tracked reliability and customer feedback.</li><li>Project 6.3: Built accessible services for global customers, mentored four engineers, and reduced processing time by 25%. Tracked reliability and customer feedback.</li><li>Project 6.4: Built accessible services for global customers, mentored four engineers, and reduced processing time by 25%. Tracked reliability and customer feedback.</li><li>Project 6.5: Built accessible services for global customers, mentored four engineers, and reduced processing time by 25%. Tracked reliability and customer feedback.</li><li>Project 6.6: Built accessible services for global customers, mentored four engineers, and reduced processing time by 25%. Tracked reliability and customer feedback.</li></ul>",
+ "roles": []
+ },
+ {
+ "id": "df0b8e60-40d2-4acb-956b-4d22d54785a4",
+ "hidden": false,
+ "company": "Synthetic Studio 7",
+ "position": "Engineering Role 7",
+ "location": "Remote",
+ "period": "2013 – 2014",
+ "dates": {
+ "start": "2013",
+ "end": "2014",
+ "present": false
+ },
+ "website": {
+ "url": "",
+ "label": "",
+ "inlineLink": false
+ },
+ "description": "<ul><li>Project 7.1: Built accessible services for global customers, mentored four engineers, and reduced processing time by 25%. Tracked reliability and customer feedback.</li><li>Project 7.2: Built accessible services for global customers, mentored four engineers, and reduced processing time by 25%. Tracked reliability and customer feedback.</li><li>Project 7.3: Built accessible services for global customers, mentored four engineers, and reduced processing time by 25%. Tracked reliability and customer feedback.</li><li>Project 7.4: Built accessible services for global customers, mentored four engineers, and reduced processing time by 25%. Tracked reliability and customer feedback.</li><li>Project 7.5: Built accessible services for global customers, mentored four engineers, and reduced processing time by 25%. Tracked reliability and customer feedback.</li><li>Project 7.6: Built accessible services for global customers, mentored four engineers, and reduced processing time by 25%. Tracked reliability and customer feedback.</li></ul>",
+ "roles": []
+ },
+ {
+ "id": "77c060bb-75d2-45aa-8c5b-2ac6328fef59",
+ "hidden": false,
+ "company": "Synthetic Studio 8",
+ "position": "Engineering Role 8",
+ "location": "Remote",
+ "period": "2012 – 2013",
+ "dates": {
+ "start": "2012",
+ "end": "2013",
+ "present": false
+ },
+ "website": {
+ "url": "",
+ "label": "",
+ "inlineLink": false
+ },
+ "description": "<ul><li>Project 8.1: Built accessible services for global customers, mentored four engineers, and reduced processing time by 25%. Tracked reliability and customer feedback.</li><li>Project 8.2: Built accessible services for global customers, mentored four engineers, and reduced processing time by 25%. Tracked reliability and customer feedback.</li><li>Project 8.3: Built accessible services for global customers, mentored four engineers, and reduced processing time by 25%. Tracked reliability and customer feedback.</li><li>Project 8.4: Built accessible services for global customers, mentored four engineers, and reduced processing time by 25%. Tracked reliability and customer feedback.</li><li>Project 8.5: Built accessible services for global customers, mentored four engineers, and reduced processing time by 25%. Tracked reliability and customer feedback.</li><li>Project 8.6: Built accessible services for global customers, mentored four engineers, and reduced processing time by 25%. Tracked reliability and customer feedback.</li></ul>",
+ "roles": []
+ },
+ {
+ "id": "92149770-2712-4c8c-9cc2-2214e006fead",
+ "hidden": false,
+ "company": "Synthetic Studio 9",
+ "position": "Engineering Role 9",
+ "location": "Remote",
+ "period": "2011 – 2012",
+ "dates": {
+ "start": "2011",
+ "end": "2012",
+ "present": false
+ },
+ "website": {
+ "url": "",
+ "label": "",
+ "inlineLink": false
+ },
+ "description": "<ul><li>Project 9.1: Built accessible services for global customers, mentored four engineers, and reduced processing time by 25%. Tracked reliability and customer feedback.</li><li>Project 9.2: Built accessible services for global customers, mentored four engineers, and reduced processing time by 25%. Tracked reliability and customer feedback.</li><li>Project 9.3: Built accessible services for global customers, mentored four engineers, and reduced processing time by 25%. Tracked reliability and customer feedback.</li><li>Project 9.4: Built accessible services for global customers, mentored four engineers, and reduced processing time by 25%. Tracked reliability and customer feedback.</li><li>Project 9.5: Built accessible services for global customers, mentored four engineers, and reduced processing time by 25%. Tracked reliability and customer feedback.</li><li>Project 9.6: Built accessible services for global customers, mentored four engineers, and reduced processing time by 25%. Tracked reliability and customer feedback.</li></ul>",
+ "roles": []
+ },
+ {
+ "id": "f35f584f-926f-4612-aca7-7433c8aac80b",
+ "hidden": false,
+ "company": "Synthetic Studio 10",
+ "position": "Engineering Role 10",
+ "location": "Remote",
+ "period": "2010 – 2011",
+ "dates": {
+ "start": "2010",
+ "end": "2011",
+ "present": false
+ },
+ "website": {
+ "url": "",
+ "label": "",
+ "inlineLink": false
+ },
+ "description": "<ul><li>Project 10.1: Built accessible services for global customers, mentored four engineers, and reduced processing time by 25%. Tracked reliability and customer feedback.</li><li>Project 10.2: Built accessible services for global customers, mentored four engineers, and reduced processing time by 25%. Tracked reliability and customer feedback.</li><li>Project 10.3: Built accessible services for global customers, mentored four engineers, and reduced processing time by 25%. Tracked reliability and customer feedback.</li><li>Project 10.4: Built accessible services for global customers, mentored four engineers, and reduced processing time by 25%. Tracked reliability and customer feedback.</li><li>Project 10.5: Built accessible services for global customers, mentored four engineers, and reduced processing time by 25%. Tracked reliability and customer feedback.</li><li>Project 10.6: Built accessible services for global customers, mentored four engineers, and reduced processing time by 25%. Tracked reliability and customer feedback.</li></ul>",
+ "roles": []
+ },
+ {
+ "id": "435dd936-1c95-4615-ba20-0d30322918cf",
+ "hidden": false,
+ "company": "Synthetic Studio 11",
+ "position": "Engineering Role 11",
+ "location": "Remote",
+ "period": "2009 – 2010",
+ "dates": {
+ "start": "2009",
+ "end": "2010",
+ "present": false
+ },
+ "website": {
+ "url": "",
+ "label": "",
+ "inlineLink": false
+ },
+ "description": "<ul><li>Project 11.1: Built accessible services for global customers, mentored four engineers, and reduced processing time by 25%. Tracked reliability and customer feedback.</li><li>Project 11.2: Built accessible services for global customers, mentored four engineers, and reduced processing time by 25%. Tracked reliability and customer feedback.</li><li>Project 11.3: Built accessible services for global customers, mentored four engineers, and reduced processing time by 25%. Tracked reliability and customer feedback.</li><li>Project 11.4: Built accessible services for global customers, mentored four engineers, and reduced processing time by 25%. Tracked reliability and customer feedback.</li><li>Project 11.5: Built accessible services for global customers, mentored four engineers, and reduced processing time by 25%. Tracked reliability and customer feedback.</li><li>Project 11.6: Built accessible services for global customers, mentored four engineers, and reduced processing time by 25%. Tracked reliability and customer feedback.</li></ul>",
+ "roles": []
+ },
+ {
+ "id": "53c298b4-515e-4982-9887-389becf9d303",
+ "hidden": false,
+ "company": "Synthetic Studio 12",
+ "position": "Engineering Role 12",
+ "location": "Remote",
+ "period": "2008 – 2009",
+ "dates": {
+ "start": "2008",
+ "end": "2009",
+ "present": false
+ },
+ "website": {
+ "url": "",
+ "label": "",
+ "inlineLink": false
+ },
+ "description": "<ul><li>Project 12.1: Built accessible services for global customers, mentored four engineers, and reduced processing time by 25%. Tracked reliability and customer feedback.</li><li>Project 12.2: Built accessible services for global customers, mentored four engineers, and reduced processing time by 25%. Tracked reliability and customer feedback.</li><li>Project 12.3: Built accessible services for global customers, mentored four engineers, and reduced processing time by 25%. Tracked reliability and customer feedback.</li><li>Project 12.4: Built accessible services for global customers, mentored four engineers, and reduced processing time by 25%. Tracked reliability and customer feedback.</li><li>Project 12.5: Built accessible services for global customers, mentored four engineers, and reduced processing time by 25%. Tracked reliability and customer feedback.</li><li>Project 12.6: Built accessible services for global customers, mentored four engineers, and reduced processing time by 25%. Tracked reliability and customer feedback.</li></ul>",
+ "roles": []
+ },
+ {
+ "id": "4d1a393f-a34d-43c7-9db9-efd011e9090e",
+ "hidden": false,
+ "company": "Synthetic Studio 13",
+ "position": "Engineering Role 13",
+ "location": "Remote",
+ "period": "2007 – 2008",
+ "dates": {
+ "start": "2007",
+ "end": "2008",
+ "present": false
+ },
+ "website": {
+ "url": "",
+ "label": "",
+ "inlineLink": false
+ },
+ "description": "<ul><li>Project 13.1: Built accessible services for global customers, mentored four engineers, and reduced processing time by 25%. Tracked reliability and customer feedback.</li><li>Project 13.2: Built accessible services for global customers, mentored four engineers, and reduced processing time by 25%. Tracked reliability and customer feedback.</li><li>Project 13.3: Built accessible services for global customers, mentored four engineers, and reduced processing time by 25%. Tracked reliability and customer feedback.</li><li>Project 13.4: Built accessible services for global customers, mentored four engineers, and reduced processing time by 25%. Tracked reliability and customer feedback.</li><li>Project 13.5: Built accessible services for global customers, mentored four engineers, and reduced processing time by 25%. Tracked reliability and customer feedback.</li><li>Project 13.6: Built accessible services for global customers, mentored four engineers, and reduced processing time by 25%. Tracked reliability and customer feedback.</li></ul>",
+ "roles": []
+ },
+ {
+ "id": "dc0e9c30-28ad-47bb-8085-7a7a38366fa3",
+ "hidden": false,
+ "company": "Synthetic Studio 14",
+ "position": "Engineering Role 14",
+ "location": "Remote",
+ "period": "2006 – 2007",
+ "dates": {
+ "start": "2006",
+ "end": "2007",
+ "present": false
+ },
+ "website": {
+ "url": "",
+ "label": "",
+ "inlineLink": false
+ },
+ "description": "<ul><li>Project 14.1: Built accessible services for global customers, mentored four engineers, and reduced processing time by 25%. Tracked reliability and customer feedback.</li><li>Project 14.2: Built accessible services for global customers, mentored four engineers, and reduced processing time by 25%. Tracked reliability and customer feedback.</li><li>Project 14.3: Built accessible services for global customers, mentored four engineers, and reduced processing time by 25%. Tracked reliability and customer feedback.</li><li>Project 14.4: Built accessible services for global customers, mentored four engineers, and reduced processing time by 25%. Tracked reliability and customer feedback.</li><li>Project 14.5: Built accessible services for global customers, mentored four engineers, and reduced processing time by 25%. Tracked reliability and customer feedback.</li><li>Project 14.6: Built accessible services for global customers, mentored four engineers, and reduced processing time by 25%. Tracked reliability and customer feedback.</li></ul>",
+ "roles": []
+ },
+ {
+ "id": "00c480c8-c49b-4ca3-8fe5-3a96404ccf0a",
+ "hidden": false,
+ "company": "Synthetic Studio 15",
+ "position": "Engineering Role 15",
+ "location": "Remote",
+ "period": "2005 – 2006",
+ "dates": {
+ "start": "2005",
+ "end": "2006",
+ "present": false
+ },
+ "website": {
+ "url": "",
+ "label": "",
+ "inlineLink": false
+ },
+ "description": "<ul><li>Project 15.1: Built accessible services for global customers, mentored four engineers, and reduced processing time by 25%. Tracked reliability and customer feedback.</li><li>Project 15.2: Built accessible services for global customers, mentored four engineers, and reduced processing time by 25%. Tracked reliability and customer feedback.</li><li>Project 15.3: Built accessible services for global customers, mentored four engineers, and reduced processing time by 25%. Tracked reliability and customer feedback.</li><li>Project 15.4: Built accessible services for global customers, mentored four engineers, and reduced processing time by 25%. Tracked reliability and customer feedback.</li><li>Project 15.5: Built accessible services for global customers, mentored four engineers, and reduced processing time by 25%. Tracked reliability and customer feedback.</li><li>Project 15.6: Built accessible services for global customers, mentored four engineers, and reduced processing time by 25%. Tracked reliability and customer feedback.</li></ul>",
+ "roles": []
+ },
+ {
+ "id": "9833e3a9-edf5-4f91-a22b-f75938b9e578",
+ "hidden": false,
+ "company": "Synthetic Studio 16",
+ "position": "Engineering Role 16",
+ "location": "Remote",
+ "period": "2004 – 2005",
+ "dates": {
+ "start": "2004",
+ "end": "2005",
+ "present": false
+ },
+ "website": {
+ "url": "",
+ "label": "",
+ "inlineLink": false
+ },
+ "description": "<ul><li>Project 16.1: Built accessible services for global customers, mentored four engineers, and reduced processing time by 25%. Tracked reliability and customer feedback.</li><li>Project 16.2: Built accessible services for global customers, mentored four engineers, and reduced processing time by 25%. Tracked reliability and customer feedback.</li><li>Project 16.3: Built accessible services for global customers, mentored four engineers, and reduced processing time by 25%. Tracked reliability and customer feedback.</li><li>Project 16.4: Built accessible services for global customers, mentored four engineers, and reduced processing time by 25%. Tracked reliability and customer feedback.</li><li>Project 16.5: Built accessible services for global customers, mentored four engineers, and reduced processing time by 25%. Tracked reliability and customer feedback.</li><li>Project 16.6: Built accessible services for global customers, mentored four engineers, and reduced processing time by 25%. Tracked reliability and customer feedback.</li></ul>",
+ "roles": []
+ }
+ ]
+ },
+ "education": {
+ "title": "",
+ "icon": "graduation-cap",
+ "columns": 1,
+ "hidden": false,
+ "showHeading": true,
+ "keepTogether": false,
+ "startOnNewPage": false,
+ "items": [
+ {
+ "id": "d4c90c5f-31e5-4ab2-a4af-c4782e936f0d",
+ "hidden": false,
+ "school": "Synthetic University",
+ "degree": "BSc",
+ "area": "Computer Science",
+ "grade": "First class",
+ "location": "Berlin",
+ "period": "2010 – 2014",
+ "dates": {
+ "start": "2010",
+ "end": "2014",
+ "present": false
+ },
+ "website": {
+ "url": "",
+ "label": "",
+ "inlineLink": false
+ },
+ "description": "<p>Human-computer interaction and software engineering.</p>"
+ }
+ ]
+ },
+ "projects": {
+ "title": "",
+ "icon": "code-simple",
+ "columns": 1,
+ "hidden": false,
+ "showHeading": true,
+ "keepTogether": false,
+ "startOnNewPage": false,
+ "items": []
+ },
+ "skills": {
+ "title": "",
+ "icon": "compass-tool",
+ "columns": 1,
+ "hidden": false,
+ "showHeading": true,
+ "keepTogether": false,
+ "startOnNewPage": false,
+ "items": [
+ {
+ "id": "4b33f1c9-4608-4e72-8947-8a87f8247d7b",
+ "hidden": false,
+ "icon": "",
+ "iconColor": "",
+ "name": "Engineering",
+ "proficiency": "Advanced",
+ "level": 4,
+ "keywords": ["TypeScript", "Accessibility", "Product strategy", "Research"]
+ }
+ ],
+ "keywordLayout": "inline",
+ "layout": "default"
+ },
+ "languages": {
+ "title": "",
+ "icon": "translate",
+ "columns": 1,
+ "hidden": false,
+ "showHeading": true,
+ "keepTogether": false,
+ "startOnNewPage": false,
+ "items": [
+ {
+ "id": "481e5f52-fa66-48fb-a1f0-b26543c92144",
+ "hidden": false,
+ "language": "English",
+ "fluency": "Professional",
+ "level": 4
+ },
+ {
+ "id": "f5e1405f-a4fb-43a7-8ff2-375e4c77b7e9",
+ "hidden": false,
+ "language": "日本語",
+ "fluency": "Professional",
+ "level": 4
+ },
+ {
+ "id": "50fdb125-8711-447e-99bd-629fd3edbeb5",
+ "hidden": false,
+ "language": "العربية",
+ "fluency": "Professional",
+ "level": 4
+ }
+ ]
+ },
+ "interests": {
+ "title": "",
+ "icon": "football",
+ "columns": 1,
+ "hidden": false,
+ "showHeading": true,
+ "keepTogether": false,
+ "startOnNewPage": false,
+ "items": []
+ },
+ "awards": {
+ "title": "",
+ "icon": "trophy",
+ "columns": 1,
+ "hidden": false,
+ "showHeading": true,
+ "keepTogether": false,
+ "startOnNewPage": false,
+ "items": []
+ },
+ "certifications": {
+ "title": "",
+ "icon": "certificate",
+ "columns": 1,
+ "hidden": false,
+ "showHeading": true,
+ "keepTogether": false,
+ "startOnNewPage": false,
+ "items": []
+ },
+ "publications": {
+ "title": "",
+ "icon": "books",
+ "columns": 1,
+ "hidden": false,
+ "showHeading": true,
+ "keepTogether": false,
+ "startOnNewPage": false,
+ "items": []
+ },
+ "volunteer": {
+ "title": "",
+ "icon": "hand-heart",
+ "columns": 1,
+ "hidden": false,
+ "showHeading": true,
+ "keepTogether": false,
+ "startOnNewPage": false,
+ "items": []
+ },
+ "references": {
+ "title": "",
+ "icon": "phone",
+ "columns": 1,
+ "hidden": false,
+ "showHeading": true,
+ "keepTogether": false,
+ "startOnNewPage": false,
+ "items": []
+ }
+ },
+ "customSections": [],
+ "metadata": {
+ "template": "onyx",
+ "layout": {
+ "sidebarWidth": 35,
+ "pages": [
+ {
+ "fullWidth": false,
+ "main": ["profiles", "summary", "education", "experience", "projects", "volunteer", "references"],
+ "sidebar": ["skills", "certifications", "awards", "languages", "interests", "publications"]
+ }
+ ]
+ },
+ "page": {
+ "gapX": 4,
+ "gapY": 6,
+ "marginX": 14,
+ "marginY": 12,
+ "format": "a4",
+ "locale": "en-US",
+ "dateFormat": "short",
+ "hideLinkUnderline": false,
+ "hideIcons": false,
+ "hideSectionIcons": true
+ },
+ "design": {
+ "level": {
+ "icon": "star",
+ "type": "circle"
+ },
+ "colors": {
+ "primary": "rgba(220, 38, 38, 1)",
+ "text": "rgba(0, 0, 0, 1)",
+ "background": "rgba(255, 255, 255, 1)"
+ },
+ "entry": {
+ "layout": "stacked",
+ "lead": "organization",
+ "accent": "none"
+ }
+ },
+ "typography": {
+ "body": {
+ "fontFamily": "IBM Plex Serif",
+ "fontWeights": ["400", "500"],
+ "fontSize": 10,
+ "lineHeight": 1.5
+ },
+ "heading": {
+ "fontFamily": "IBM Plex Serif",
+ "fontWeights": ["600"],
+ "fontSize": 14,
+ "lineHeight": 1.5
+ }
+ },
+ "notes": "",
+ "styleRules": [],
+ "stylesheet": {
+ "mode": "semantic",
+ "source": {
+ "languageVersion": 1,
+ "text": ""
+ }
+ }
+ }
+}
diff --git a/packages/pdf/src/forme/list-pagination.integration.test.tsx b/packages/pdf/src/forme/list-pagination.integration.test.tsx
index 4edd02d1e..5ea3d83a0 100644
--- a/packages/pdf/src/forme/list-pagination.integration.test.tsx
+++ b/packages/pdf/src/forme/list-pagination.integration.test.tsx
@@ -1,3 +1,4 @@
+import type { ElementInfo } from "@formepdf/core";
import assert from "node:assert/strict";
import { expect, it } from "vite-plus/test";
import * as forme from "@formepdf/core";
@@ -5,6 +6,125 @@ import { getDocument } from "pdfjs-dist/legacy/build/pdf.mjs";
import { act } from "react";
import { Document, Page, Text, View } from "./primitives";
import { renderResumeElement } from "./render";
+import { LIST_ROLE } from "./to-forme";
+
+it.each([false, true])("handles a detached fitting row with off-page recovery %s", async (recoverable) => {
+ const markerIn = (elements: ElementInfo[]): ElementInfo | undefined => {
+ for (const element of elements) {
+ if (element.sourceLocation?.column === LIST_ROLE.marker) return element;
+ const marker = markerIn(element.children);
+ if (marker) return marker;
+ }
+ };
+ let calls = 0;
+ const rendering = act(() =>
+ renderResumeElement(
+ {
+ async renderSerializedDocWithLayout(document) {
+ calls++;
+ const result = await forme.renderSerializedDocWithLayout(document);
+ if (recoverable && calls > 1) return result;
+ const marker = markerIn(result.layout.pages.flatMap((page) => page.elements));
+ const first = result.layout.pages[0];
+ assert(marker && first);
+ // Simulate a corrupt engine result: its marker appears on an earlier page than its text.
+ first.elements.unshift(marker);
+ if (recoverable) first.elements.push({ ...marker, y: -Number.MAX_VALUE });
+ return result;
+ },
+ },
+ <Document>
+ <Page size={{ width: 200, height: 150 }} style={{ padding: 10, fontSize: 10 }}>
+ <View style={{ height: 120 }} />
+ <View data-resume-list-item style={{ flexDirection: "row" }}>
+ <Text data-resume-list-marker style={{ width: 10 }}>
+ •
+ </Text>
+ <View data-resume-list-content style={{ flex: 1 }}>
+ <Text>Fitting row</Text>
+ </View>
+ </View>
+ </Page>
+ </Document>,
+ ),
+ );
+ if (recoverable) {
+ const result = await rendering;
+ expect(calls).toBe(2);
+ expect(result.warnings).toEqual([]);
+ } else await expect(rendering).rejects.toThrow("could not keep a list marker with its content");
+});
+
+it.each([
+ [8, 1, 0],
+ [25, 1, 0],
+ [25, 12, 0],
+ [8, 1, 8],
+])(
+ "lets %i-line list items (%i items, %i padding) continue without hiding following content",
+ async (length, count, padding) => {
+ const lines = Array.from({ length: length * count }, (_, index) => `LONG_LINE_${index}`);
+ let calls = 0;
+ const result = await act(() =>
+ renderResumeElement(
+ {
+ renderSerializedDocWithLayout(document) {
+ calls++;
+ return forme.renderSerializedDocWithLayout(document);
+ },
+ },
+ <Document>
+ <Page size={{ width: 200, height: 150 }} style={{ padding: 10, fontSize: 10, lineHeight: 1.5 }}>
+ <Text>Before list</Text>
+ <View style={{ padding }}>
+ {Array.from({ length: count }, (_, item) => (
+ <View key={item} data-resume-list-item style={{ flexDirection: "row" }}>
+ <Text data-resume-list-marker style={{ width: 10 }}>
+ •
+ </Text>
+ <View data-resume-list-content style={{ flex: 1 }}>
+ <Text>{lines.slice(item * length, (item + 1) * length).join("\n")}</Text>
+ </View>
+ </View>
+ ))}
+ </View>
+ <Text>After list</Text>
+ </Page>
+ </Document>,
+ ),
+ );
+ if (count === 1) expect(calls).toBeLessThanOrEqual(3);
+ const loading = getDocument({ data: result.pdf.slice(), useSystemFonts: true });
+ try {
+ const pdf = await loading.promise;
+ if (count === 1) expect(pdf.numPages).toBe(length === 8 ? 2 : 4);
+ const rendered: string[] = [];
+ for (let index = 1; index <= pdf.numPages; index++) {
+ const page = await pdf.getPage(index);
+ const items = (await page.getTextContent()).items.flatMap((item) =>
+ "str" in item && item.str.trim() ? [item] : [],
+ );
+ if (index === 1) expect(items.map((item) => item.str)).toContain("LONG_LINE_0");
+ for (let offset = 0; offset < items.length; offset++) {
+ const marker = items[offset];
+ if (marker?.str !== "•") continue;
+ const first = items[offset + 1];
+ assert(first);
+ expect(first.str).toMatch(/^LONG_LINE_\d+$/);
+ expect(marker.transform[5]).toBeCloseTo(first.transform[5] ?? 0, 1);
+ }
+ for (const item of items) {
+ expect(item.transform[5]).toBeGreaterThanOrEqual(10);
+ expect(item.transform[5] + item.height).toBeLessThanOrEqual(140);
+ rendered.push(item.str);
+ }
+ }
+ expect(rendered.filter((text) => text !== "•")).toEqual(["Before list", ...lines, "After list"]);
+ } finally {
+ await loading.destroy();
+ }
+ },
+);
it("reserves every line of a list item moved to the next page", async () => {
const result = await act(() =>
diff --git a/packages/pdf/src/forme/long-list-pagination.integration.test.tsx b/packages/pdf/src/forme/long-list-pagination.integration.test.tsx
new file mode 100644
index 000000000..f2742313c
--- /dev/null
+++ b/packages/pdf/src/forme/long-list-pagination.integration.test.tsx
@@ -0,0 +1,149 @@
+import type { ElementInfo } from "@formepdf/core";
+import assert from "node:assert/strict";
+import { expect, it } from "vite-plus/test";
+import * as forme from "@formepdf/core";
+import { parse } from "node-html-parser";
+import { getDocument } from "pdfjs-dist/legacy/build/pdf.mjs";
+import { act } from "react";
+import { parseResumeData } from "@reactive-resume/schema/resume/data";
+import { templateSchema } from "@reactive-resume/schema/templates";
+import longResume from "./fixtures/long.json";
+import { renderResume } from "./render";
+import { FIXED_SOURCE, LIST_ROLE } from "./to-forme";
+
+const cases = [
+ ...templateSchema.options.map((template) => ({ template, roles: 16, lines: 0 })),
+ ...(["porygon", "azurill"] as const).flatMap((template) => [48, 96].map((roles) => ({ template, roles, lines: 0 }))),
+ ...(["porygon", "azurill"] as const).flatMap((template) =>
+ [24, 48].map((bullets) => ({ template, roles: bullets / 6, lines: 25 })),
+ ),
+];
+
+it.each(cases)(
+ "paginates $roles audit roles in $template ($lines explicit lines per bullet)",
+ async ({ template, roles, lines }) => {
+ // Exact synthetic audit input that reproduced RX-87 in nine templates; keep its fonts, headers and sidebar.
+ const data = parseResumeData(structuredClone(longResume));
+ data.metadata.template = template;
+ const original = data.sections.experience.items;
+ data.sections.experience.items = Array.from({ length: roles }, (_, index) => {
+ const item = original[lines ? 0 : index % original.length];
+ assert(item);
+ return {
+ ...item,
+ id: `role-${index}`,
+ company: lines ? `Fictional Studio ${index}` : `Synthetic Studio ${index + 1}`,
+ description: lines
+ ? `<ul>${Array.from(
+ { length: 6 },
+ (_, bullet) =>
+ `<li><p>${Array.from({ length: lines }, (_, line) => `CASE_${index}_${bullet}_${line} fictional outcome`).join("<br>")}</p></li>`,
+ ).join("")}</ul>`
+ : item.description.replace(/Project \d+\./g, `Project ${index + 1}.`),
+ };
+ });
+ const bullets = data.sections.experience.items.flatMap((item) =>
+ parse(item.description)
+ .querySelectorAll("li")
+ .map((li) => li.textContent),
+ );
+ let calls = 0;
+ const result = await act(() =>
+ renderResume(
+ {
+ renderSerializedDocWithLayout(document) {
+ calls++;
+ return forme.renderSerializedDocWithLayout(document);
+ },
+ },
+ { data },
+ ),
+ );
+ // A4 paragraph-sized rows must settle together too; this is not a tiny-page oversized-row exception.
+ if (lines) expect(calls).toBeLessThanOrEqual(3);
+ else if (roles > 16) expect(calls).toBeLessThanOrEqual(2);
+ expect(result.missingFonts).toEqual([]);
+ expect(result.warnings).toEqual([]);
+ const markers = new Map<number, { page: number; x: number; y: number; width: number; height: number }>();
+ const content = new Map<number, { page: number; x: number; y: number; width: number; height: number }>();
+ result.layout.pages.forEach((page, pageIndex) => {
+ let contentBottom = page.contentY;
+ let bulletLines = 0;
+ const visit = (element: ElementInfo, parentSource?: ElementInfo["sourceLocation"], fixed = false) => {
+ const source = element.sourceLocation ?? parentSource;
+ const repeated = fixed || source?.file === FIXED_SOURCE;
+ if (element.kind === "Text") {
+ expect(element.x).toBeGreaterThanOrEqual(page.contentX - 0.1);
+ expect(element.x + element.width).toBeLessThanOrEqual(page.contentX + page.contentWidth + 0.1);
+ expect(element.y).toBeGreaterThanOrEqual(page.contentY - 0.1);
+ expect(element.y + element.height).toBeLessThanOrEqual(page.contentY + page.contentHeight + 0.1);
+ const positions =
+ source?.column === LIST_ROLE.marker ? markers : source?.column === LIST_ROLE.content ? content : null;
+ if (source && positions && !positions.has(source.line))
+ positions.set(source.line, {
+ page: pageIndex,
+ x: element.x,
+ y: element.y,
+ width: element.width,
+ height: element.height,
+ });
+ if (!repeated) contentBottom = Math.max(contentBottom, element.y + element.height);
+ if (source?.column === LIST_ROLE.content) {
+ bulletLines++;
+ }
+ }
+ for (const child of element.children) visit(child, source, repeated);
+ };
+ for (const element of page.elements) visit(element);
+ // Ignore page furniture; repeated headings alone cannot fill the body. A natural partial last page is allowed.
+ if (pageIndex < result.layout.pages.length - 1) {
+ expect(bulletLines, `page ${pageIndex + 1}/${result.layout.pages.length}`).toBeGreaterThanOrEqual(6);
+ // The review's paragraph fixture has a 74%-filled second page on base; keep the original audit at 75%.
+ expect(
+ contentBottom,
+ `page ${pageIndex + 1}/${result.layout.pages.length}; ${bulletLines} bullet lines`,
+ ).toBeGreaterThan(page.contentY + page.contentHeight * (lines ? 0.7 : 0.75));
+ }
+ });
+ expect(markers.size).toBe(bullets.length);
+ expect(content.size).toBe(bullets.length);
+ for (const [key, marker] of markers) {
+ const first = content.get(key);
+ assert(first);
+ expect(marker.page).toBe(first.page);
+ expect(marker.y).toBeCloseTo(first.y, 1);
+ expect(marker.height).toBeCloseTo(first.height, 1);
+ expect(marker.x + marker.width).toBeLessThanOrEqual(first.x + 0.1);
+ }
+ const loading = getDocument({ data: result.pdf.slice(), useSystemFonts: true });
+ try {
+ const pdf = await loading.promise;
+ expect(pdf.numPages).toBeGreaterThan(1);
+ const pages: string[][] = [];
+ for (let index = 1; index <= pdf.numPages; index++) {
+ const page = await pdf.getPage(index);
+ pages.push(
+ (await page.getTextContent()).items.flatMap((item) => ("str" in item && item.str.trim() ? [item.str] : [])),
+ );
+ }
+ // Lapras repeats its section heading inside split content in the PDF text stream.
+ const text = pages
+ .flat()
+ .filter((line) => line !== "Experience")
+ .join("")
+ .replace(/\s/g, "");
+ for (const bullet of bullets) expect(text.split(bullet.replace(/\s/g, "")), bullet).toHaveLength(2);
+ if (lines) {
+ expect([...text.matchAll(/CASE_\d+_\d+_\d+/g)].map(([token]) => token)).toEqual(
+ bullets.flatMap((bullet) => [...bullet.matchAll(/CASE_\d+_\d+_\d+/g)].map(([token]) => token)),
+ );
+ } else {
+ expect([...text.matchAll(/Project\d+\.\d+:/g)].map(([token]) => token)).toEqual(
+ bullets.map((bullet) => bullet.slice(0, bullet.indexOf(":") + 1).replace(/\s/g, "")),
+ );
+ }
+ } finally {
+ await loading.destroy();
+ }
+ },
+);
diff --git a/packages/pdf/src/forme/render.ts b/packages/pdf/src/forme/render.ts
index 792bd7179..01cb9ff6a 100644
--- a/packages/pdf/src/forme/render.ts
+++ b/packages/pdf/src/forme/render.ts
@@ -124,14 +124,30 @@ function unplacedBlocks(layout: RenderWithLayoutResult["layout"]): string[] {
const isFixed = (element: ElementInfo): boolean =>
element.sourceLocation?.file === FIXED_SOURCE || element.children.some(isFixed);
-/** List items needing a page break to keep their marker and full row height (see `LIST_ROLE`). */
-function listItemsNeedingBreak(layout: RenderWithLayoutResult["layout"]): number[] {
+/** Flow constraints for large items, and marker/row repairs for items that still split (see `LIST_ROLE`). */
+function listPaginationRepairs(layout: RenderWithLayoutResult["layout"]) {
const markerPage = new Map<number, number>();
const contentPage = new Map<number, number>();
const itemPage = new Map<number, number>();
+ const split = new Set<number>();
+ const oversized = new Set<number>();
+ const contentPages = new Map<number, Set<number>>();
layout.pages.forEach((page, pageIndex) => {
- const visit = (element: ElementInfo) => {
+ const visit = (element: ElementInfo, availableHeight: number, parentSource?: ElementInfo["sourceLocation"]) => {
const source = element.sourceLocation;
+ const inheritedSource = source ?? parentSource;
+ if (inheritedSource?.column === LIST_ROLE.content && element.kind === "Text" && !offPage(element.y)) {
+ const pages = contentPages.get(inheritedSource.line) ?? new Set<number>();
+ pages.add(pageIndex);
+ contentPages.set(inheritedSource.line, pages);
+ }
+ const { margin, padding, borderWidth } = element.style;
+ if (source?.column === LIST_ROLE.item) {
+ const height = element.height + margin.top + margin.bottom;
+ // Prefer splitting large rows for page fill; only rows exceeding a fresh page cannot stay whole.
+ if (height > availableHeight / 4) split.add(source.line - 1);
+ if (height > availableHeight) oversized.add(source.line - 1);
+ }
const pages =
source?.column === LIST_ROLE.marker
? markerPage
@@ -142,16 +158,21 @@ function listItemsNeedingBreak(layout: RenderWithLayoutResult["layout"]): number
: null;
// Forme leaves some fragments of a splitting box at y ±Number.MAX_VALUE; they aren't on this page.
if (source && pages && !pages.has(source.line) && !offPage(element.y)) pages.set(source.line, pageIndex);
- element.children.forEach(visit);
+ const innerHeight = availableHeight - padding.top - padding.bottom - borderWidth.top - borderWidth.bottom;
+ for (const child of element.children) visit(child, innerHeight, inheritedSource);
};
- page.elements.forEach(visit);
- });
- return [...markerPage].flatMap(([line, page]) => {
- const content = contentPage.get(line) ?? page;
- // Forme can move both companions to a new page but drop their row, reserving only the marker's line height.
- const detached = page > 0 && content === page && itemPage.get(line) !== page;
- return content > page || detached ? [line - 1] : [];
+ for (const element of page.elements) visit(element, page.contentHeight);
});
+ const breakBefore = [...markerPage]
+ .flatMap(([line, page]) => {
+ const content = contentPage.get(line) ?? page;
+ // Forme can move both companions to a new page but drop their row, reserving only the marker's line height.
+ const detached = page > 0 && content === page && itemPage.get(line) !== page;
+ return content > page || detached ? [line - 1] : [];
+ })
+ .sort((a, b) => a - b);
+ const unsplit = [...contentPages].flatMap(([line, pages]) => (pages.size === 1 ? [line - 1] : []));
+ return { split, oversized, breakBefore, unsplit };
}
/**
@@ -231,6 +252,7 @@ export async function renderResumeElement(
]);
const breakBeforeListItems = new Set<number>();
+ const splitListItems = new Set<number>();
const breakBeforeNodes = new Set<string>();
// Every pass draws the same text, so the fonts are prepared once, from the first pass's document.
let formeFonts: typeof fonts | undefined;
@@ -240,6 +262,7 @@ export async function renderResumeElement(
images,
keepNestedRowsWhole,
breakBeforeListItems,
+ splitListItems,
breakBeforeNodes,
freeFormHeights,
});
@@ -274,14 +297,44 @@ export async function renderResumeElement(
return { result, warnings: converted.warnings };
};
- // Explicit breaks keep markers with their first line and restore rows lost when an item moves to a new page.
- // Breaks move what follows, so a few passes settle it; each item is repaired at most once.
+ // Flow constraints remain valid when earlier rows move: batch repairs of rows that fit a fresh page. Only
+ // oversized rows need positional repairs, whose later break positions must be rechecked after each move.
const layOut = async (keepNestedRowsWhole: boolean) => {
- for (let pass = 0; ; pass++) {
+ breakBeforeListItems.clear();
+ splitListItems.clear();
+ const whole = new Set<number>();
+ let measuredOversized: ReadonlySet<number> | undefined;
+ for (;;) {
const laidOut = await layOutOnce(keepNestedRowsWhole);
- const needsBreak = listItemsNeedingBreak(laidOut.result.layout).filter((item) => !breakBeforeListItems.has(item));
- if (needsBreak.length === 0 || pass === 3) return laidOut;
- for (const item of needsBreak) breakBeforeListItems.add(item);
+ const repairs = listPaginationRepairs(laidOut.result.layout);
+ // Capture full intrinsic heights before reopening rows; later fragments do not measure the whole row.
+ const oversized = (measuredOversized ??= repairs.oversized);
+ let changed = false;
+ for (const item of repairs.split) {
+ if (whole.has(item) || splitListItems.has(item)) continue;
+ splitListItems.add(item);
+ changed = true;
+ }
+ if (changed) continue;
+ if (repairs.breakBefore.some((item) => !oversized.has(item))) {
+ // Reserve fitting rows already in one piece too, so later rows do not repeat the same defect after reflow.
+ // Preserve genuine continuations: their content already spans pages without leaving its marker behind.
+ for (const item of [...repairs.breakBefore, ...repairs.unsplit]) {
+ if (oversized.has(item) || whole.has(item) || !splitListItems.has(item)) continue;
+ whole.add(item);
+ splitListItems.delete(item);
+ changed = true;
+ }
+ }
+ if (changed) continue;
+ // shortcut: oversized rows need sequential marker repair until Forme supports atomic first fragments.
+ const first = repairs.breakBefore.find((item) => oversized.has(item) && !breakBeforeListItems.has(item));
+ if (first === undefined) {
+ if (repairs.breakBefore.some((item) => !oversized.has(item)) && !misplacesABox(laidOut.result))
+ throw new Error("The PDF engine could not keep a list marker with its content.");
+ return laidOut;
+ }
+ breakBeforeListItems.add(first);
}
};
diff --git a/packages/pdf/src/forme/to-forme.tsx b/packages/pdf/src/forme/to-forme.tsx
index fe6f24717..fdc0bbe4e 100644
--- a/packages/pdf/src/forme/to-forme.tsx
+++ b/packages/pdf/src/forme/to-forme.tsx
@@ -67,7 +67,7 @@ type Context = {
warnings: Set<string>;
sourceMap: WeakMap<object, SourceLocation>;
/** Counts list items in document order and names those that start a page (see `LIST_ROLE`). */
- lists: { count: number; breakBefore: ReadonlySet<number> };
+ lists: { count: number; breakBefore: ReadonlySet<number>; split: ReadonlySet<number> };
/** The list item being converted, and what part of it. */
listItem?: { index: number; role: (typeof LIST_ROLE)[keyof typeof LIST_ROLE] } | undefined;
};
@@ -491,6 +491,9 @@ function convertNode(node: HostNode, parentContext: Context, key: number): React
);
let children = spread.children;
const viewStyle = flowStyle(props, spread.style);
+ // A flow constraint stays valid when earlier items move; unlike a forced break it cannot go stale.
+ if (props["data-resume-list-item"] && context.listItem && !context.lists.split.has(context.listItem.index))
+ viewStyle.wrap = false;
const nodeKey = props[RESUME_NODE_PROP];
if (typeof nodeKey === "string" && context.breakBeforeNodes.has(nodeKey)) viewStyle.breakBefore = true;
if (context.listItem?.role === LIST_ROLE.item && context.lists.breakBefore.has(context.listItem.index))
@@ -515,6 +518,7 @@ function convertNode(node: HostNode, parentContext: Context, key: number): React
if (
context.keepNestedRowsWhole &&
context.insideRow &&
+ !props["data-resume-list-item"] &&
(style.flexDirection === "row" || style.flexDirection === "row-reverse")
)
viewStyle.wrap = false;
@@ -959,6 +963,8 @@ export type ConvertOptions = {
keepNestedRowsWhole?: boolean;
/** List items (by index, see `LIST_ROLE`) that start a new page, so their marker stays with their first line. */
breakBeforeListItems?: ReadonlySet<number>;
+ /** Large items remain splittable for page fill; brief marker/content rows paginate as a unit. */
+ splitListItems?: ReadonlySet<number>;
/** Unplaced sections or items that need an explicit page break on a render retry. */
breakBeforeNodes?: ReadonlySet<string>;
/** Measured heights of free-form pages, by page index; an unmeasured one is `FREE_FORM_MEASURE_HEIGHT` tall. */
@@ -971,6 +977,7 @@ export function toFormeDocument(
images = new Map(),
keepNestedRowsWhole = false,
breakBeforeListItems = new Set(),
+ splitListItems = new Set(),
breakBeforeNodes = new Set(),
freeFormHeights = [],
}: ConvertOptions = {},
@@ -1000,7 +1007,7 @@ export function toFormeDocument(
},
warnings: new Set(),
sourceMap: new WeakMap(),
- lists: { count: 0, breakBefore: breakBeforeListItems },
+ lists: { count: 0, breakBefore: breakBeforeListItems, split: splitListItems },
};
const { props } = root;