diff --git a/.github/workflows/browser-starter.yml b/.github/workflows/browser-starter.yml index 533997e..3b5102b 100644 --- a/.github/workflows/browser-starter.yml +++ b/.github/workflows/browser-starter.yml @@ -3,9 +3,9 @@ name: Browser starter on: push: branches: [main] - paths: ['examples/browser/**', 'tools/check-browser-starter.py', 'tools/browser-requirements.txt', 'tools/starter_standard_fonts.py', 'tools/starter_engine_fixes.py', 'tools/starter-engine-2.5.22.json', 'tools/starter-engine-2.5.24.json', 'tools/starter-engine-2.5.38.json', '.github/workflows/browser-starter.yml'] + paths: ['examples/browser/**', 'tools/check-browser-starter.py', 'tools/check-starter-invoices.py', 'tools/starter_invoice.py', 'tools/browser-requirements.txt', 'tools/starter_standard_fonts.py', 'tools/starter_engine_fixes.py', 'tools/starter-engine-2.5.22.json', 'tools/starter-engine-2.5.24.json', 'tools/starter-engine-2.5.38.json', '.github/workflows/browser-starter.yml'] pull_request: - paths: ['examples/browser/**', 'tools/check-browser-starter.py', 'tools/browser-requirements.txt', 'tools/starter_standard_fonts.py', 'tools/starter_engine_fixes.py', 'tools/starter-engine-2.5.22.json', 'tools/starter-engine-2.5.24.json', 'tools/starter-engine-2.5.38.json', '.github/workflows/browser-starter.yml'] + paths: ['examples/browser/**', 'tools/check-browser-starter.py', 'tools/check-starter-invoices.py', 'tools/starter_invoice.py', 'tools/browser-requirements.txt', 'tools/starter_standard_fonts.py', 'tools/starter_engine_fixes.py', 'tools/starter-engine-2.5.22.json', 'tools/starter-engine-2.5.24.json', 'tools/starter-engine-2.5.38.json', '.github/workflows/browser-starter.yml'] workflow_dispatch: permissions: @@ -38,6 +38,8 @@ jobs: - run: python -m pip install -r tools/browser-requirements.txt - run: python -m playwright install --with-deps ${{ matrix.browser }} - run: python tools/check-browser-starter.py --dist examples/browser/dist --out output/starter-${{ matrix.browser }} --browser ${{ matrix.browser }} + - name: Verify flowing invoice downloads and every page preview + run: python tools/check-starter-invoices.py --kind browser --dist examples/browser/dist --templates examples/browser/src --out output/starter-${{ matrix.browser }}/invoices --browser ${{ matrix.browser }} - uses: actions/upload-artifact@v4 if: always() with: diff --git a/.github/workflows/react-starter.yml b/.github/workflows/react-starter.yml index 2fff3ee..4123070 100644 --- a/.github/workflows/react-starter.yml +++ b/.github/workflows/react-starter.yml @@ -3,9 +3,9 @@ name: React starter on: push: branches: [main] - paths: ['examples/react/**', 'tools/check-react-starter.py', 'tools/check-react-development.py', 'tools/prepare-react-check.mjs', 'tools/react_component_checks.py', 'tools/browser-requirements.txt', 'tools/starter_standard_fonts.py', 'tools/starter_engine_fixes.py', 'tools/starter-engine-2.5.22.json', 'tools/starter-engine-2.5.24.json', 'tools/starter-engine-2.5.38.json', '.github/workflows/react-starter.yml'] + paths: ['examples/react/**', 'tools/check-react-starter.py', 'tools/check-starter-invoices.py', 'tools/starter_invoice.py', 'tools/check-react-development.py', 'tools/prepare-react-check.mjs', 'tools/react_component_checks.py', 'tools/browser-requirements.txt', 'tools/starter_standard_fonts.py', 'tools/starter_engine_fixes.py', 'tools/starter-engine-2.5.22.json', 'tools/starter-engine-2.5.24.json', 'tools/starter-engine-2.5.38.json', '.github/workflows/react-starter.yml'] pull_request: - paths: ['examples/react/**', 'tools/check-react-starter.py', 'tools/check-react-development.py', 'tools/prepare-react-check.mjs', 'tools/react_component_checks.py', 'tools/browser-requirements.txt', 'tools/starter_standard_fonts.py', 'tools/starter_engine_fixes.py', 'tools/starter-engine-2.5.22.json', 'tools/starter-engine-2.5.24.json', 'tools/starter-engine-2.5.38.json', '.github/workflows/react-starter.yml'] + paths: ['examples/react/**', 'tools/check-react-starter.py', 'tools/check-starter-invoices.py', 'tools/starter_invoice.py', 'tools/check-react-development.py', 'tools/prepare-react-check.mjs', 'tools/react_component_checks.py', 'tools/browser-requirements.txt', 'tools/starter_standard_fonts.py', 'tools/starter_engine_fixes.py', 'tools/starter-engine-2.5.22.json', 'tools/starter-engine-2.5.24.json', 'tools/starter-engine-2.5.38.json', '.github/workflows/react-starter.yml'] workflow_dispatch: permissions: @@ -39,6 +39,8 @@ jobs: - run: python -m pip install -r tools/browser-requirements.txt - run: python -m playwright install --with-deps ${{ matrix.browser }} - run: python tools/check-react-starter.py --dist examples/react/dist --out output/react-${{ matrix.browser }} --browser ${{ matrix.browser }} + - name: Verify flowing invoice downloads and every page preview + run: python tools/check-starter-invoices.py --kind react --dist examples/react/dist --templates examples/react/src --out output/react-${{ matrix.browser }}/invoices --browser ${{ matrix.browser }} - name: Build React development runtime with StrictMode if: matrix.browser == 'chrome' env: diff --git a/.github/workflows/vue-starter.yml b/.github/workflows/vue-starter.yml index 960276b..e42288f 100644 --- a/.github/workflows/vue-starter.yml +++ b/.github/workflows/vue-starter.yml @@ -3,9 +3,9 @@ name: Vue starter on: push: branches: [main] - paths: ['examples/vue/**', 'tools/check-vue-starter.py', 'tools/prepare-vue-check.mjs', 'tools/browser-requirements.txt', 'tools/starter_standard_fonts.py', 'tools/starter_engine_fixes.py', 'tools/starter-engine-2.5.22.json', 'tools/starter-engine-2.5.24.json', 'tools/starter-engine-2.5.38.json', '.github/workflows/vue-starter.yml'] + paths: ['examples/vue/**', 'tools/check-vue-starter.py', 'tools/check-starter-invoices.py', 'tools/starter_invoice.py', 'tools/prepare-vue-check.mjs', 'tools/browser-requirements.txt', 'tools/starter_standard_fonts.py', 'tools/starter_engine_fixes.py', 'tools/starter-engine-2.5.22.json', 'tools/starter-engine-2.5.24.json', 'tools/starter-engine-2.5.38.json', '.github/workflows/vue-starter.yml'] pull_request: - paths: ['examples/vue/**', 'tools/check-vue-starter.py', 'tools/prepare-vue-check.mjs', 'tools/browser-requirements.txt', 'tools/starter_standard_fonts.py', 'tools/starter_engine_fixes.py', 'tools/starter-engine-2.5.22.json', 'tools/starter-engine-2.5.24.json', 'tools/starter-engine-2.5.38.json', '.github/workflows/vue-starter.yml'] + paths: ['examples/vue/**', 'tools/check-vue-starter.py', 'tools/check-starter-invoices.py', 'tools/starter_invoice.py', 'tools/prepare-vue-check.mjs', 'tools/browser-requirements.txt', 'tools/starter_standard_fonts.py', 'tools/starter_engine_fixes.py', 'tools/starter-engine-2.5.22.json', 'tools/starter-engine-2.5.24.json', 'tools/starter-engine-2.5.38.json', '.github/workflows/vue-starter.yml'] workflow_dispatch: permissions: @@ -39,6 +39,8 @@ jobs: - run: python -m pip install -r tools/browser-requirements.txt - run: python -m playwright install --with-deps ${{ matrix.browser }} - run: python tools/check-vue-starter.py --dist examples/vue/dist --out output/vue-${{ matrix.browser }} --browser ${{ matrix.browser }} + - name: Verify flowing invoice downloads and every page preview + run: python tools/check-starter-invoices.py --kind vue --dist examples/vue/dist --templates examples/vue/src --out output/vue-${{ matrix.browser }}/invoices --browser ${{ matrix.browser }} - uses: actions/upload-artifact@v4 if: always() with: diff --git a/examples/browser/README.md b/examples/browser/README.md index 2acf2e7..8f706c3 100644 --- a/examples/browser/README.md +++ b/examples/browser/README.md @@ -40,6 +40,19 @@ Use [supported Fullbleed print CSS](https://docs.fullbleed.dev/css-coverage/). Document scripts do not run. Supply custom image/font bytes through the SDK's `assets` and `fonts` options; document URLs do not trigger browser fetches. +## Let an HTML invoice grow + +Add or remove rows inside `src/invoice.html`'s `
` and update both sample +totals. The HTML sample does not calculate amounts. Its stylesheet lets the table +continue onto new pages, repeats column headings, and prints `Page N of M` in the +page margin. The `.closing` group keeps totals and payment details together; it +can move to the next page when there is not enough room. + +Keep the flowing `@page` margins and automatic `.page` height when adapting this +layout. The invoice check covers the short sample, 24 rows, wrapped descriptions, +empty rows and page-boundary cases, including final PDF text bounds and every +displayed preview. + ## Build and deploy ```sh diff --git a/examples/browser/src/invoice.css b/examples/browser/src/invoice.css index 0c83bd8..14142f7 100644 --- a/examples/browser/src/invoice.css +++ b/examples/browser/src/invoice.css @@ -1,11 +1,20 @@ -@page { size: A4; margin: 0; } +@page { + size: A4; margin: 15mm 16mm 20mm; background: #f8f5ec; + @bottom-left { + content: "NORTHSTAR STUDIO / FICTIONAL INVOICE"; + font-family: Inter; font-size: 6.6pt; color: {{ink}}; + } + @bottom-right { + content: "Page " counter(page) " of " counter(pages); + font-family: Inter; font-size: 6.6pt; color: {{ink}}; + } +} * { box-sizing: border-box; } -html, body { margin: 0; padding: 0; } +html, body { margin: 0; padding: 0; background: #f8f5ec; } body { font-family: Inter; font-size: 10pt; line-height: 1.45; color: {{ink}}; } h1, h2, h3, p, figure { margin: 0; } h1, h2, h3 { font-weight: 400; } -.page { width: 210mm; height: 296.9mm; padding: 15mm 16mm; position: relative; break-after: page; background: #f8f5ec; } -.page:last-child { break-after: auto; } +.page { width: auto; height: auto; } .kicker { font-size: 7.2pt; font-weight: 600; letter-spacing: 1.4pt; text-transform: uppercase; } .serif { font-family: 'DM Serif Display'; font-weight: 400; } .display { font-family: 'Bebas Neue'; font-weight: 400; } @@ -16,7 +25,6 @@ h1, h2, h3 { font-weight: 400; } .grid-2 { display: grid; grid-template-columns: minmax(0,1fr) minmax(0,1fr); gap: 24pt; } .grid-2 > * { min-width: 0; } .grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16pt; } -.footer { position: absolute; left: 16mm; right: 16mm; bottom: 12mm; border-top: .6pt solid #9eafa4; padding-top: 8pt; display: flex; justify-content: space-between; gap: 12pt; font-size: 6.6pt; letter-spacing: .45pt; } table { width: 100%; border-collapse: collapse; font-size: 9pt; } th { font-size: 7.5pt; font-weight: 600; text-align: left; } th, td { padding: 10pt 0; border-bottom: .55pt solid #bdc8bf; vertical-align: top; } @@ -37,12 +45,18 @@ a { color: inherit; } .invoice .details { border-top: .6pt solid #9eafa4; border-bottom: .6pt solid #9eafa4; padding: 15pt 0; margin-bottom: 10pt; } .invoice .details p { margin-top: 5pt; font-size: 8.2pt; } .invoice .details > div + div { border-left: .6pt solid #c7cdc4; padding-left: 14pt; } +.invoice table { table-layout: fixed; } .invoice th { color: #52665a; } +.invoice th:first-child { width: 56%; } +.invoice th:not(:first-child) { width: 14.666%; } +.invoice tr { break-inside: avoid; } .invoice td { padding: 12pt 0; } +.invoice td:first-child { overflow-wrap: anywhere; } .invoice .item-note { color: #617069; font-size: 8pt; margin-top: 4pt; } -.invoice .amounts { display: grid; grid-template-columns: 1fr 1.25fr; gap: 27pt; margin-top: 23pt; } +.invoice .closing { break-inside: avoid; } +.invoice .amounts { display: grid; grid-template-columns: 1fr 1.25fr; gap: 27pt; margin-top: 23pt; break-inside: avoid; } .invoice .thanks { font: italic 22pt/1.2 'DM Serif Display'; color: #b44123; padding-top: 8pt; } .invoice .summary-line { display: flex; justify-content: space-between; padding: 5pt 0; font-size: 8.5pt; } .invoice .total { background: {{ink}}; color: #fff8e8; padding: 16pt; margin-top: 9pt; border-left: 4pt solid #d96238; } .invoice .total .value { font: 38pt/1.1 'Bebas Neue'; margin-top: 7pt; } -.invoice .payment { margin-top: 20pt; padding-top: 12pt; border-top: .6pt solid #9eafa4; display: grid; grid-template-columns: 1fr 1fr; gap: 24pt; font-size: 8pt; } +.invoice .payment { margin-top: 16pt; padding-top: 12pt; border-top: .6pt solid #9eafa4; display: grid; grid-template-columns: 1fr 1fr; gap: 24pt; font-size: 8pt; break-inside: avoid; } diff --git a/examples/browser/src/invoice.html b/examples/browser/src/invoice.html index 4d49034..b923b3b 100644 --- a/examples/browser/src/invoice.html +++ b/examples/browser/src/invoice.html @@ -6,7 +6,9 @@| DESCRIPTION | HOURS | RATE | AMOUNT |
|---|---|---|---|
| Discovery & brand workshop Positioning, priorities, and a clear creative direction | 8 | $125.00 | $1,000.00 |
| Digital design & implementation A cohesive visual system, from layout to launch | 6 | $95.00 | $570.00 |
| Review & studio handoff Final refinements, documentation, and delivery | 2 | $150.00 | $300.00 |
A little clarity.
A lot of possibility.
Thank you for inviting us
to help shape your next chapter.
Reference {{reference}} with your payment.
Payment instructions are supplied separately.
Questions about a line item?
Write to hello@example.invalid.