From 1fb95ff9259490531c676461795ce40d69f087cb Mon Sep 17 00:00:00 2001 From: anurag629 Date: Fri, 20 Nov 2026 21:14:24 +0530 Subject: [PATCH] release: v1.9.0, five new templates and meta fetcher fixes --- .github/workflows/template-previews.yml | 84 + .well-known/funding-manifest-urls | 1 + README.md | 8 +- package-lock.json | 1599 ++++++++----------- package.json | 4 +- public/.well-known/funding-manifest-urls | 1 + src/components/Footer.astro | 26 +- src/components/editor/AIAutofill.tsx | 3 +- src/components/editor/ExportBar.tsx | 18 +- src/components/editor/useSatoriRenderer.ts | 4 + src/components/preview/FixItButton.tsx | 19 +- src/lib/ai/normalize-autofill-url.ts | 5 + src/lib/clipboard.ts | 35 + src/lib/html-entities.ts | 77 + src/lib/meta-fetcher.ts | 28 +- src/lib/upstash.ts | 6 + src/pages/api/visitors.ts | 4 +- src/templates/developer/build-in-public.ts | 404 +++++ src/templates/developer/index.ts | 1 + src/templates/developer/terminal-bio.ts | 6 +- src/templates/developer/vscode-theme.ts | 1 + src/templates/ecommerce/index.ts | 1 + src/templates/ecommerce/rating-breakdown.ts | 258 +++ src/templates/github/release-notes.ts | 8 +- src/templates/github/terminal-style.ts | 2 + src/templates/newsletter/editorial.ts | 1 + src/templates/newsletter/index.ts | 1 + src/templates/newsletter/mailbag.ts | 362 +++++ src/templates/podcast/index.ts | 1 + src/templates/podcast/transcript.ts | 135 ++ src/templates/product/feature-grid.ts | 11 +- src/templates/quote/bold-highlight.ts | 6 +- src/templates/quote/index.ts | 1 + src/templates/quote/two-takes.ts | 366 +++++ src/templates/registry.ts | 12 +- src/templates/saas/comparison.ts | 16 +- src/templates/saas/pricing-highlight.ts | 10 +- src/templates/saas/social-proof.ts | 12 +- tests/ai/normalize-autofill-url.test.ts | 23 + tests/api/ai-autofill.test.ts | 168 ++ tests/api/visitors.test.ts | 129 ++ tests/components/fix-it-button.test.ts | 81 + tests/editor/export-bar-copy.test.ts | 171 ++ tests/editor/satori-renderer.test.ts | 54 + tests/lib/clipboard.test.ts | 147 ++ tests/lib/meta-fetcher.test.ts | 297 ++++ tests/templates/build-in-public.test.ts | 153 ++ tests/templates/comparison.test.ts | 29 + tests/templates/feature-grid.test.ts | 28 + tests/templates/mailbag.test.ts | 235 +++ tests/templates/previews.test.ts | 60 + tests/templates/pricing-highlight.test.ts | 20 + tests/templates/rating-breakdown.test.ts | 202 +++ tests/templates/release-notes.test.ts | 30 + tests/templates/social-proof.test.ts | 29 + tests/templates/two-takes.test.ts | 199 +++ tests/templates/vscode-theme.test.ts | 24 + tests/templates/whitespace.test.ts | 24 + 58 files changed, 4644 insertions(+), 996 deletions(-) create mode 100644 .github/workflows/template-previews.yml create mode 100644 src/lib/ai/normalize-autofill-url.ts create mode 100644 src/lib/clipboard.ts create mode 100644 src/lib/html-entities.ts create mode 100644 src/templates/developer/build-in-public.ts create mode 100644 src/templates/ecommerce/rating-breakdown.ts create mode 100644 src/templates/newsletter/mailbag.ts create mode 100644 src/templates/podcast/transcript.ts create mode 100644 src/templates/quote/two-takes.ts create mode 100644 tests/ai/normalize-autofill-url.test.ts create mode 100644 tests/api/ai-autofill.test.ts create mode 100644 tests/api/visitors.test.ts create mode 100644 tests/components/fix-it-button.test.ts create mode 100644 tests/editor/export-bar-copy.test.ts create mode 100644 tests/editor/satori-renderer.test.ts create mode 100644 tests/lib/clipboard.test.ts create mode 100644 tests/templates/build-in-public.test.ts create mode 100644 tests/templates/comparison.test.ts create mode 100644 tests/templates/feature-grid.test.ts create mode 100644 tests/templates/mailbag.test.ts create mode 100644 tests/templates/previews.test.ts create mode 100644 tests/templates/rating-breakdown.test.ts create mode 100644 tests/templates/release-notes.test.ts create mode 100644 tests/templates/social-proof.test.ts create mode 100644 tests/templates/two-takes.test.ts create mode 100644 tests/templates/vscode-theme.test.ts create mode 100644 tests/templates/whitespace.test.ts diff --git a/.github/workflows/template-previews.yml b/.github/workflows/template-previews.yml new file mode 100644 index 0000000..9016cdb --- /dev/null +++ b/.github/workflows/template-previews.yml @@ -0,0 +1,84 @@ +name: Template previews + +# Renders every template a PR adds or changes to PNG (defaults, optional text +# empty, long text, light background) and uploads them as the +# "template-previews" artifact, so a review can look at the images without +# running the PR's code locally. +# +# It uses pull_request, so a fork PR runs with a read-only token and no +# secrets, the same as CI. +on: + pull_request: + branches: [dev] + paths: + - 'src/templates/**' + - 'tests/templates/previews.test.ts' + - '.github/workflows/template-previews.yml' + +permissions: + contents: read + +concurrency: + group: template-previews-${{ github.event.pull_request.number }} + cancel-in-progress: true + +jobs: + render: + name: Render changed templates + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: List changed templates + id: changed + run: | + set -euo pipefail + # HEAD is GitHub's test merge of the PR into dev, so HEAD^1 is the dev + # commit it was merged onto. pull_request.base.sha can be the dev commit + # from when the PR was opened, which pulls in everything merged since. + changed=$(git diff --name-only --diff-filter=AM HEAD^1 HEAD) + # Template files only: src/templates//.ts, not the index files. + files=$(grep -E '^src/templates/[^/]+/[^/]+\.ts$' <<<"$changed" | grep -v '/index\.ts$' | head -n 20 | tr '\n' ' ' || true) + # A change to this setup itself renders the reference template, so it gets tested too. + if [ -z "$files" ] && grep -qE '^(tests/templates/previews\.test\.ts|\.github/workflows/template-previews\.yml)$' <<<"$changed"; then + files="src/templates/blog/minimal-dark.ts" + fi + echo "files=$files" >> "$GITHUB_OUTPUT" + echo "Templates to render: ${files:-none}" + + - uses: actions/setup-node@v4 + if: steps.changed.outputs.files != '' + with: + node-version: 22 + cache: npm + + - if: steps.changed.outputs.files != '' + run: npm ci + + - name: Render + if: steps.changed.outputs.files != '' + env: + PREVIEW_FILES: ${{ steps.changed.outputs.files }} + PREVIEW_OUT: previews + run: npx vitest run tests/templates/previews.test.ts + + - uses: actions/upload-artifact@v4 + if: steps.changed.outputs.files != '' + with: + name: template-previews + path: previews/ + retention-days: 14 + if-no-files-found: error + + - name: Summary + if: steps.changed.outputs.files != '' + run: | + { + echo "### Template previews" + echo + echo "Download the \`template-previews\` artifact below to see these:" + echo + for f in previews/*.png; do echo "- \`$(basename "$f")\`"; done + } >> "$GITHUB_STEP_SUMMARY" diff --git a/.well-known/funding-manifest-urls b/.well-known/funding-manifest-urls index 42647b8..8cd6afd 100644 --- a/.well-known/funding-manifest-urls +++ b/.well-known/funding-manifest-urls @@ -1 +1,2 @@ https://oss.codercops.com/funding.json +https://raw.githubusercontent.com/codercops/.github/main/funding.json diff --git a/README.md b/README.md index 80421f2..3d9aaf9 100644 --- a/README.md +++ b/README.md @@ -5,11 +5,11 @@ [![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg)](CONTRIBUTING.md) [![Discord](https://img.shields.io/badge/chat-Discord-5865F2.svg?logo=discord&logoColor=white)](https://discord.gg/mpGdJyjaRQ) -> Free, open-source OG image generator. 109 templates, 8 platform previews, free API. No login, no watermarks. +> Free, open-source OG image generator. 175+ templates, 8 platform previews, free API. No login, no watermarks. **Live:** [og.codercops.com](https://og.codercops.com) -![OGCOPS](https://og.codercops.com/api/og?template=github-readme-hero&title=OGCOPS&description=Free%2C+open-source+OG+image+generator.+109+templates.+8+platform+previews.+Free+API.&tagline=No+login+%E2%80%A2+No+watermarks+%E2%80%A2+No+limits&badges=MIT+License&accentColor=%23E07A5F) +![OGCOPS](https://og.codercops.com/api/og?template=github-readme-hero&title=OGCOPS&description=Free%2C+open-source+OG+image+generator.+175%2B+templates.+8+platform+previews.+Free+API.&tagline=No+login+%E2%80%A2+No+watermarks+%E2%80%A2+No+limits&badges=MIT+License&accentColor=%23E07A5F) ## Why OGCOPS? @@ -19,13 +19,13 @@ OGCOPS is different: - **Completely free** — no login, no watermarks, no rate limits - **Open source** — MIT licensed, self-hostable, fully transparent -- **109 templates** — professional designs across 12 categories, ready to use +- **175+ templates** — professional designs across 12 categories, ready to use - **Instant preview** — client-side Satori rendering, zero server calls while editing - **Developer-friendly API** — generate images via URL, CORS-enabled, no API key needed ## Features -- **109 Templates** across 12 categories: Blog, Product, SaaS, GitHub, Event, Podcast, Developer, Newsletter, Quote, E-commerce, Job, Tutorial +- **175+ Templates** across 12 categories: Blog, Product, SaaS, GitHub, Event, Podcast, Developer, Newsletter, Quote, E-commerce, Job, Tutorial - **8 Platform Previews**: Twitter/X, Facebook, LinkedIn, Discord, Slack, Reddit, WhatsApp, Google Search — see exactly how your image looks on each platform - **Free REST API**: Generate OG images via URL. CORS-enabled. No API key required. - **Social Preview Checker**: Paste any URL to analyze its meta tags and see platform previews diff --git a/package-lock.json b/package-lock.json index dbd4d5e..f60463e 100644 --- a/package-lock.json +++ b/package-lock.json @@ -16,11 +16,11 @@ "@fontsource/jetbrains-mono": "^5.2.8", "@fontsource/playfair-display": "^5.2.8", "@resvg/resvg-wasm": "^2.6.2", - "astro": "^7.3.5", + "astro": "^7.4.12", "react": "^19.0.0", "react-dom": "^19.0.0", "satori": "^0.12.0", - "zod": "^3.24.0" + "zod": "^4.6.6" }, "devDependencies": { "@astrojs/check": "^0.9.10", @@ -123,30 +123,30 @@ } }, "node_modules/@astrojs/compiler-binding": { - "version": "0.5.1", - "resolved": "https://registry.npmjs.org/@astrojs/compiler-binding/-/compiler-binding-0.5.1.tgz", - "integrity": "sha512-oczyolLUl9mNrtuBuNjuvn5thpHrFLXAHAWGTRg0JDHQ8cGVsVeFekOu2uSoQGgainJIi+A3/9m0DyYwz3Nlnw==", + "version": "0.5.3", + "resolved": "https://registry.npmjs.org/@astrojs/compiler-binding/-/compiler-binding-0.5.3.tgz", + "integrity": "sha512-fHG6eWKvnSlV11dUMZSi4AynOGjVbNBgZZc704Hi9DW8WeKtbsS7fJQT3omz1Nba+5mccLQQGAWOQ65cnuNLtg==", "license": "MIT", "engines": { "node": "^20.19.0 || >=22.12.0" }, "optionalDependencies": { - "@astrojs/compiler-binding-android-arm64": "0.5.1", - "@astrojs/compiler-binding-darwin-arm64": "0.5.1", - "@astrojs/compiler-binding-darwin-x64": "0.5.1", - "@astrojs/compiler-binding-linux-arm64-gnu": "0.5.1", - "@astrojs/compiler-binding-linux-arm64-musl": "0.5.1", - "@astrojs/compiler-binding-linux-x64-gnu": "0.5.1", - "@astrojs/compiler-binding-linux-x64-musl": "0.5.1", - "@astrojs/compiler-binding-wasm32-wasi": "0.5.1", - "@astrojs/compiler-binding-win32-arm64-msvc": "0.5.1", - "@astrojs/compiler-binding-win32-x64-msvc": "0.5.1" + "@astrojs/compiler-binding-android-arm64": "0.5.3", + "@astrojs/compiler-binding-darwin-arm64": "0.5.3", + "@astrojs/compiler-binding-darwin-x64": "0.5.3", + "@astrojs/compiler-binding-linux-arm64-gnu": "0.5.3", + "@astrojs/compiler-binding-linux-arm64-musl": "0.5.3", + "@astrojs/compiler-binding-linux-x64-gnu": "0.5.3", + "@astrojs/compiler-binding-linux-x64-musl": "0.5.3", + "@astrojs/compiler-binding-wasm32-wasi": "0.5.3", + "@astrojs/compiler-binding-win32-arm64-msvc": "0.5.3", + "@astrojs/compiler-binding-win32-x64-msvc": "0.5.3" } }, "node_modules/@astrojs/compiler-binding-android-arm64": { - "version": "0.5.1", - "resolved": "https://registry.npmjs.org/@astrojs/compiler-binding-android-arm64/-/compiler-binding-android-arm64-0.5.1.tgz", - "integrity": "sha512-nMb2nMIJtcWLNH+fV75Enmi+jp4tIOYOfsv4XtpgdOWkqc9P4uSSdK5u1xb340AzrXo5V18SxLl/nc3vcqtamQ==", + "version": "0.5.3", + "resolved": "https://registry.npmjs.org/@astrojs/compiler-binding-android-arm64/-/compiler-binding-android-arm64-0.5.3.tgz", + "integrity": "sha512-ThyoCqtrdp6UwmMvScluDll4vvj4kXwUPKHYozLbXJKPH5zrJ8sr5xQJVOk0YvgBrCvGBA/lPVVLyEp1aLuBYg==", "cpu": [ "arm64" ], @@ -160,9 +160,9 @@ } }, "node_modules/@astrojs/compiler-binding-darwin-arm64": { - "version": "0.5.1", - "resolved": "https://registry.npmjs.org/@astrojs/compiler-binding-darwin-arm64/-/compiler-binding-darwin-arm64-0.5.1.tgz", - "integrity": "sha512-5k4+nZ/WRt+dcVow4z7rBuI7iv9A58h/uQ91YJe1PrTivbcCkq3u2Ynx/AZJwII4CsZawBCeGpojkFjutZBhBQ==", + "version": "0.5.3", + "resolved": "https://registry.npmjs.org/@astrojs/compiler-binding-darwin-arm64/-/compiler-binding-darwin-arm64-0.5.3.tgz", + "integrity": "sha512-zMI4ndCVCd0Wsrm8sXVcIk6uviKsgndFLnxqNd6Qx26LINSkb0lQ7SL8gKyGcTu0hJRTBwl7Y1WcpMk37aeaKQ==", "cpu": [ "arm64" ], @@ -176,9 +176,9 @@ } }, "node_modules/@astrojs/compiler-binding-darwin-x64": { - "version": "0.5.1", - "resolved": "https://registry.npmjs.org/@astrojs/compiler-binding-darwin-x64/-/compiler-binding-darwin-x64-0.5.1.tgz", - "integrity": "sha512-0Buw+YST9Ff2EqQyhRMQujuFq/dijLw3zXWhsvI0dJ2pGrT38iVoxTEca2eBX/PfhlwkVWSRJEKO5gMqKHyeHg==", + "version": "0.5.3", + "resolved": "https://registry.npmjs.org/@astrojs/compiler-binding-darwin-x64/-/compiler-binding-darwin-x64-0.5.3.tgz", + "integrity": "sha512-Ce51oGlDgBAwoVOy5Y4FeIqFkXbS/vJkIAPN5pXIYchn/3izF4c2t//KuUZJopwzD6Kblj46kKiqmxRUt/mAJg==", "cpu": [ "x64" ], @@ -192,12 +192,15 @@ } }, "node_modules/@astrojs/compiler-binding-linux-arm64-gnu": { - "version": "0.5.1", - "resolved": "https://registry.npmjs.org/@astrojs/compiler-binding-linux-arm64-gnu/-/compiler-binding-linux-arm64-gnu-0.5.1.tgz", - "integrity": "sha512-x5LRpyCoMKuu3INr18cn42YhwSOaRpp9b5Ny3eJJ/sWVeejC16Zeshu1JlvlSmEZACLeWxU5JM0RX6T6nI+YyA==", + "version": "0.5.3", + "resolved": "https://registry.npmjs.org/@astrojs/compiler-binding-linux-arm64-gnu/-/compiler-binding-linux-arm64-gnu-0.5.3.tgz", + "integrity": "sha512-WCBGgpmUqbuWW3KAsNOKRXDeQIAeQLftZhZ+CNyl3eg4JtkfZRXHav2qItzVg6ODyzmS2e+QkpgsQuwMSInGgA==", "cpu": [ "arm64" ], + "libc": [ + "glibc" + ], "license": "MIT", "optional": true, "os": [ @@ -208,12 +211,15 @@ } }, "node_modules/@astrojs/compiler-binding-linux-arm64-musl": { - "version": "0.5.1", - "resolved": "https://registry.npmjs.org/@astrojs/compiler-binding-linux-arm64-musl/-/compiler-binding-linux-arm64-musl-0.5.1.tgz", - "integrity": "sha512-mL7tQEuDk3rGfaKmrO63nw6WBy1TPVioQGmVyjcAr+C+a/k3SVMYBytNSMqH9mZPT/Swj30JaZ2N842Z1NnOEQ==", + "version": "0.5.3", + "resolved": "https://registry.npmjs.org/@astrojs/compiler-binding-linux-arm64-musl/-/compiler-binding-linux-arm64-musl-0.5.3.tgz", + "integrity": "sha512-DRcjEOFWcMbaaTsbOEferYozr2zDUf/roDzcF6WxHSSto+rqZ1N87xxj/pjOpz0JtTBlZ3V59nZGONcNiQUSWw==", "cpu": [ "arm64" ], + "libc": [ + "musl" + ], "license": "MIT", "optional": true, "os": [ @@ -224,12 +230,15 @@ } }, "node_modules/@astrojs/compiler-binding-linux-x64-gnu": { - "version": "0.5.1", - "resolved": "https://registry.npmjs.org/@astrojs/compiler-binding-linux-x64-gnu/-/compiler-binding-linux-x64-gnu-0.5.1.tgz", - "integrity": "sha512-uLGc9jtxwiDe4cQyhNPQim4ECiB/YzbWlXssfLAv8r374kArfTwBHjwR2+j+XVyF71yCx5mF9YNRclRqdNBgeg==", + "version": "0.5.3", + "resolved": "https://registry.npmjs.org/@astrojs/compiler-binding-linux-x64-gnu/-/compiler-binding-linux-x64-gnu-0.5.3.tgz", + "integrity": "sha512-8rIMmEFtuVe5mMvwBR59uSHZL7CaJ/CPm5Hh3r3Bd5JLoSPkBbl1xk8kwUkNKJ0QSbGEFdWkUnx73JRZq46i2A==", "cpu": [ "x64" ], + "libc": [ + "glibc" + ], "license": "MIT", "optional": true, "os": [ @@ -240,12 +249,15 @@ } }, "node_modules/@astrojs/compiler-binding-linux-x64-musl": { - "version": "0.5.1", - "resolved": "https://registry.npmjs.org/@astrojs/compiler-binding-linux-x64-musl/-/compiler-binding-linux-x64-musl-0.5.1.tgz", - "integrity": "sha512-G0cywinaQUc8v1MrytvYKUX7svTDMmYtOCZfxjwKPbJi59zIqM+Ll0rWgO0GQWLZH3XoPYo19ZwlP3Xt9ep9YA==", + "version": "0.5.3", + "resolved": "https://registry.npmjs.org/@astrojs/compiler-binding-linux-x64-musl/-/compiler-binding-linux-x64-musl-0.5.3.tgz", + "integrity": "sha512-+sZCsIXq/PQBiemALIr+GbERKQbQ82mHW2ibJUlCDtsjyFA/8Udm8WGZhS7AGjb2P9ekQ4j7Z8dbxb0f3E0oZw==", "cpu": [ "x64" ], + "libc": [ + "musl" + ], "license": "MIT", "optional": true, "os": [ @@ -256,9 +268,9 @@ } }, "node_modules/@astrojs/compiler-binding-wasm32-wasi": { - "version": "0.5.1", - "resolved": "https://registry.npmjs.org/@astrojs/compiler-binding-wasm32-wasi/-/compiler-binding-wasm32-wasi-0.5.1.tgz", - "integrity": "sha512-yMhLL8asmLydoAdnEZxAw6eLfNDs3YJl6jqn0pjPt6zrb2U5qIDLnii4/twThpIFODKkQ6YDpBRTOz/vSfZCxw==", + "version": "0.5.3", + "resolved": "https://registry.npmjs.org/@astrojs/compiler-binding-wasm32-wasi/-/compiler-binding-wasm32-wasi-0.5.3.tgz", + "integrity": "sha512-cEhZ7XAoZYffJdNYb3MDWci1UKhSEjPN+DMaLEB8X1tKlhlYNw9eVWUyNZTe1gb3nr7JJBVXdXDioqE00dyVLQ==", "cpu": [ "wasm32" ], @@ -267,16 +279,37 @@ "dependencies": { "@emnapi/core": "1.11.3", "@emnapi/runtime": "1.11.3", - "@napi-rs/wasm-runtime": "^1.2.4" + "@napi-rs/wasm-runtime": "^1.2.7" }, "engines": { "node": "^20.19.0 || >=22.12.0" } }, + "node_modules/@astrojs/compiler-binding-wasm32-wasi/node_modules/@napi-rs/wasm-runtime": { + "version": "1.2.7", + "resolved": "https://registry.npmjs.org/@napi-rs/wasm-runtime/-/wasm-runtime-1.2.7.tgz", + "integrity": "sha512-zJccwplOAbgfZju95IUHazLnx9RAPtPN2YGJXI6UbrgeaR9QfPjGrQL6ERkSAtnVCA4Q+83ApGyaX5zdpCaKkQ==", + "license": "MIT", + "optional": true, + "dependencies": { + "@tybys/wasm-util": "^0.10.3" + }, + "engines": { + "node": "^20.19.0 || ^22.13.0 || >=23.5.0" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/Brooooooklyn" + }, + "peerDependencies": { + "@emnapi/core": "^1.7.1 || 2.0.0-beta.2 || 2.0.0-beta.3", + "@emnapi/runtime": "^1.7.1 || 2.0.0-beta.2 || 2.0.0-beta.3" + } + }, "node_modules/@astrojs/compiler-binding-win32-arm64-msvc": { - "version": "0.5.1", - "resolved": "https://registry.npmjs.org/@astrojs/compiler-binding-win32-arm64-msvc/-/compiler-binding-win32-arm64-msvc-0.5.1.tgz", - "integrity": "sha512-aClIG6poFt3Wf/bZykrEAX2nAnKvBHW6RXiKUa69QjBtWH0/FOlOAjnFcxRNlhej2AMWNYFx0o+LGjwMcH8P7Q==", + "version": "0.5.3", + "resolved": "https://registry.npmjs.org/@astrojs/compiler-binding-win32-arm64-msvc/-/compiler-binding-win32-arm64-msvc-0.5.3.tgz", + "integrity": "sha512-Vcg6+NlU2SOmVGweQEmufu40MHuDuRR80dp9xNLutBWGdJG1HP0XivjGWKGkx/2EK3HN5rwB2NwPgBNDkhKsnQ==", "cpu": [ "arm64" ], @@ -290,9 +323,9 @@ } }, "node_modules/@astrojs/compiler-binding-win32-x64-msvc": { - "version": "0.5.1", - "resolved": "https://registry.npmjs.org/@astrojs/compiler-binding-win32-x64-msvc/-/compiler-binding-win32-x64-msvc-0.5.1.tgz", - "integrity": "sha512-/E6uBCagY70YpWqssBC+/FuniNSloeQPRgj7l3LDWiqjxIyTLnIgX1sTt18FU7jrigetpSnC9cHAM6b6IxSgPw==", + "version": "0.5.3", + "resolved": "https://registry.npmjs.org/@astrojs/compiler-binding-win32-x64-msvc/-/compiler-binding-win32-x64-msvc-0.5.3.tgz", + "integrity": "sha512-Mt5bK4l5ZcUdNcVxJ7VVt2x5Ck46cXgxCmIhT8sVyUST04FBRYqcYTXQLvy1Py4ejglcWRxAS6z+jBVHs3LPfg==", "cpu": [ "x64" ], @@ -306,12 +339,12 @@ } }, "node_modules/@astrojs/compiler-rs": { - "version": "0.5.1", - "resolved": "https://registry.npmjs.org/@astrojs/compiler-rs/-/compiler-rs-0.5.1.tgz", - "integrity": "sha512-1k1acnX7DepIiea9U9/Y+d1hdAFfylu1ZQQkkYgRSwBOBAsXInolyZuh/2tax+83vu/A+hOYP6P3+265RvMTvw==", + "version": "0.5.3", + "resolved": "https://registry.npmjs.org/@astrojs/compiler-rs/-/compiler-rs-0.5.3.tgz", + "integrity": "sha512-rNSAYm5IcRJMpNm+cSMaaPNCmzCXIdiz67kcBwC1qN8eTmO48wEJ6hZdlGq60+0HIHwUlncfaMxti1Fk2uJu7w==", "license": "MIT", "dependencies": { - "@astrojs/compiler-binding": "0.5.1" + "@astrojs/compiler-binding": "0.5.3" }, "engines": { "node": ">=22.12.0" @@ -375,27 +408,43 @@ } }, "node_modules/@astrojs/markdown-satteri": { - "version": "0.4.2", - "resolved": "https://registry.npmjs.org/@astrojs/markdown-satteri/-/markdown-satteri-0.4.2.tgz", - "integrity": "sha512-g4QehXnB/MzxQWnSf17NciFInMqEJy9948p8cc7zGg/r7995m0Ln5PMr3Xlnj24iey1LchaoZ3SzTOa3D4P/3w==", + "version": "0.4.10", + "resolved": "https://registry.npmjs.org/@astrojs/markdown-satteri/-/markdown-satteri-0.4.10.tgz", + "integrity": "sha512-3h/wheVjZIcP/m295nkiUjOvCsCs6QpvZ3l4BfDU4ghNQcrcFrNVu1+K+I+YT61hH9tuCDQiGdF8QDzfDoG42w==", "license": "MIT", "dependencies": { - "@astrojs/internal-helpers": "0.11.0", - "@astrojs/prism": "4.0.2", + "@astrojs/internal-helpers": "^0.13.2", + "@astrojs/prism": "^4.1.2", "github-slugger": "^2.0.0", - "satteri": "^0.10.3" + "satteri": "^0.11.6" + } + }, + "node_modules/@astrojs/markdown-satteri/node_modules/@astrojs/internal-helpers": { + "version": "0.13.2", + "resolved": "https://registry.npmjs.org/@astrojs/internal-helpers/-/internal-helpers-0.13.2.tgz", + "integrity": "sha512-SWiNS+OMrhwWYzJENTekHUyUCMKB+tdU6D4v1ZNIU1ZHh2mScQ8WIs0J6AJ8KPXkIrs9+EZU7Rm2CstfThyVnw==", + "license": "MIT", + "dependencies": { + "@types/hast": "^3.0.5", + "@types/mdast": "^4.0.4", + "picomatch": "^4.0.7", + "retext-smartypants": "^6.2.0", + "shiki": "^4.6.0", + "smol-toml": "^1.9.1", + "unified": "^11.0.5", + "yaml": "^2.9.1" } }, "node_modules/@astrojs/prism": { - "version": "4.0.2", - "resolved": "https://registry.npmjs.org/@astrojs/prism/-/prism-4.0.2.tgz", - "integrity": "sha512-KTivpmnz6lDsC6o9H4+DNm2SrE/GHzw8cNAvEJwAvUT+eoaEnn/4NtbDNfRRaxaJHdp15gf+tfHAWiXR4wB3BA==", + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/@astrojs/prism/-/prism-4.1.2.tgz", + "integrity": "sha512-jMrUEpFDarDO1KWPvVc9eSa8DSfwBlwEOHwX+8zvZQpiqXRGDxFnOXHsYqV6DP7w+0qIgTr98gS1GdQlm8ypWg==", "license": "MIT", "dependencies": { "prismjs": "^1.30.0" }, "engines": { - "node": ">=22.12.0" + "node": ">=22.23.4" } }, "node_modules/@astrojs/react": { @@ -426,6 +475,16 @@ } } }, + "node_modules/@astrojs/runtime": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/@astrojs/runtime/-/runtime-0.1.1.tgz", + "integrity": "sha512-2Tr9IJ4aQBPDFzlSLq139eWS9OZnuhL0yU2al8cCpnTE/RszygSyGIP8piBmEio1zDUaItb/+YxxsrmldUCBmg==", + "license": "MIT", + "dependencies": { + "@oslojs/encoding": "^1.1.0", + "clsx": "^2.1.1" + } + }, "node_modules/@astrojs/sitemap": { "version": "3.7.4", "resolved": "https://registry.npmjs.org/@astrojs/sitemap/-/sitemap-3.7.4.tgz", @@ -436,28 +495,19 @@ "zod": "^4.3.6" } }, - "node_modules/@astrojs/sitemap/node_modules/zod": { - "version": "4.6.7", - "resolved": "https://registry.npmjs.org/zod/-/zod-4.6.7.tgz", - "integrity": "sha512-g8W2D2kU6a8untc053fX1uVBKzM7yqAxW/3zwk83+6RyF2+SKOuV+c0wBDhUwzV1PaGapmZH+rmcUzPf+3CGwg==", - "license": "MIT", - "funding": { - "url": "https://github.com/sponsors/colinhacks" - } - }, "node_modules/@astrojs/telemetry": { - "version": "3.3.3", - "resolved": "https://registry.npmjs.org/@astrojs/telemetry/-/telemetry-3.3.3.tgz", - "integrity": "sha512-C1TLn5sPJr0x4vk56piHWKbnqlEB8BKyte5Y45V02U+D7BGO5eMqZDH5aPjnkXQWJggvmsTXxH03QMZ9NgWLzQ==", + "version": "3.4.2", + "resolved": "https://registry.npmjs.org/@astrojs/telemetry/-/telemetry-3.4.2.tgz", + "integrity": "sha512-2JOMRUxJrBSfiVDfeKLv1wBmvSIx1Y6u2YEO8awZ9qSq3u/rNAiUyFdOYi8dHv91kHrmYEQX7pRDw0J4xyj3UA==", "license": "MIT", "dependencies": { "ci-info": "^4.4.0", "dset": "^3.1.4", "is-docker": "^4.0.0", - "package-manager-detector": "^1.6.0" + "package-manager-detector": "^1.9.0" }, "engines": { - "node": "18.20.8 || ^20.3.0 || >=22.0.0" + "node": ">=22.23.4" } }, "node_modules/@astrojs/underscore-redirects": { @@ -466,6 +516,60 @@ "integrity": "sha512-sD3bn7i2yC+ocxlhCTshdg3gUM471Nag3wgyHilA+kpmufokvmUu1p5Mw5GT5Xp8SPC1Nlq0BJAgV/lslnWvRw==", "license": "MIT" }, + "node_modules/@astrojs/vite-plugin-astro": { + "version": "0.1.3", + "resolved": "https://registry.npmjs.org/@astrojs/vite-plugin-astro/-/vite-plugin-astro-0.1.3.tgz", + "integrity": "sha512-yj+xGnr3HeHUtIdra/tWizJuisBoxAuWlBTElMlf22FpSxinrTwTl/dqftG0D2BsQTcn4/shgCCUwcnkcZ8buA==", + "license": "MIT", + "dependencies": { + "@astrojs/compiler-rs": "^0.5.1", + "@astrojs/internal-helpers": "^0.13.2", + "@astrojs/runtime": "^0.1.1", + "common-ancestor-path": "^2.0.0", + "devalue": "^6.0.2", + "magic-string": "^1.4.2", + "rolldown": "~1.2.16", + "smol-toml": "^1.9.0", + "zod": "^4.6.5" + }, + "peerDependencies": { + "vite": "^8.3.3" + } + }, + "node_modules/@astrojs/vite-plugin-astro/node_modules/@astrojs/internal-helpers": { + "version": "0.13.2", + "resolved": "https://registry.npmjs.org/@astrojs/internal-helpers/-/internal-helpers-0.13.2.tgz", + "integrity": "sha512-SWiNS+OMrhwWYzJENTekHUyUCMKB+tdU6D4v1ZNIU1ZHh2mScQ8WIs0J6AJ8KPXkIrs9+EZU7Rm2CstfThyVnw==", + "license": "MIT", + "dependencies": { + "@types/hast": "^3.0.5", + "@types/mdast": "^4.0.4", + "picomatch": "^4.0.7", + "retext-smartypants": "^6.2.0", + "shiki": "^4.6.0", + "smol-toml": "^1.9.1", + "unified": "^11.0.5", + "yaml": "^2.9.1" + } + }, + "node_modules/@astrojs/vite-plugin-astro/node_modules/devalue": { + "version": "6.0.3", + "resolved": "https://registry.npmjs.org/devalue/-/devalue-6.0.3.tgz", + "integrity": "sha512-3woMEITftG1wKeO/4d/QXH1DVKctTSZg3jNGPpjp9hNr5Hos8MCFF5McTML5ZtgKDObm2R591B0spRp2IVernA==", + "license": "MIT", + "engines": { + "node": ">=18" + } + }, + "node_modules/@astrojs/vite-plugin-astro/node_modules/magic-string": { + "version": "1.4.5", + "resolved": "https://registry.npmjs.org/magic-string/-/magic-string-1.4.5.tgz", + "integrity": "sha512-oLLC2+YvQUfAa+vxoufE/yc1icb87M9iXIRqAoR/2EhE/8cb3SF/+Gi0c2By1B+5Vz2e2vQtUvHiu1+63Znh+w==", + "license": "MIT", + "dependencies": { + "@jridgewell/sourcemap-codec": "^1.6.0" + } + }, "node_modules/@astrojs/yaml2ts": { "version": "0.2.4", "resolved": "https://registry.npmjs.org/@astrojs/yaml2ts/-/yaml2ts-0.2.4.tgz", @@ -522,10 +626,23 @@ "node": ">=6.9.0" } }, + "node_modules/@bruits/satteri-android-arm64": { + "version": "0.11.7", + "resolved": "https://registry.npmjs.org/@bruits/satteri-android-arm64/-/satteri-android-arm64-0.11.7.tgz", + "integrity": "sha512-ej+1rIKs+yb6/OtcIe1SO22OXjJV0qqUopl5VNZF8Sqc/Pj4m1DXoqBQsPxW5OUYYiDUymIy6hnnn8M78VYk2w==", + "cpu": [ + "arm64" + ], + "license": "MIT", + "optional": true, + "os": [ + "android" + ] + }, "node_modules/@bruits/satteri-darwin-arm64": { - "version": "0.10.5", - "resolved": "https://registry.npmjs.org/@bruits/satteri-darwin-arm64/-/satteri-darwin-arm64-0.10.5.tgz", - "integrity": "sha512-27KTVl4TJkVahMy/ohyA7qd4938G5UNneFUz/PsScYfpIhj0IVAS23mpcJXdPF44sa6nva198lmV/cKIb2YPyA==", + "version": "0.11.7", + "resolved": "https://registry.npmjs.org/@bruits/satteri-darwin-arm64/-/satteri-darwin-arm64-0.11.7.tgz", + "integrity": "sha512-yllQOX1kVWrwqL7tamQlp4NP0loIb4KuadjuNrAe4JEOerHpgYISPRDb8DqLipgvP7Ks4e87LydZpdakMR1rhQ==", "cpu": [ "arm64" ], @@ -536,9 +653,9 @@ ] }, "node_modules/@bruits/satteri-darwin-x64": { - "version": "0.10.5", - "resolved": "https://registry.npmjs.org/@bruits/satteri-darwin-x64/-/satteri-darwin-x64-0.10.5.tgz", - "integrity": "sha512-IjnLe3nKspq6qaeqGgjT7MT8VrTV74yWRlaag7ZdNsI8TDAYZ0iPxMCo+9KQZHUk5EyVB+reBI/PFWL5KuFw9Q==", + "version": "0.11.7", + "resolved": "https://registry.npmjs.org/@bruits/satteri-darwin-x64/-/satteri-darwin-x64-0.11.7.tgz", + "integrity": "sha512-RMQrKzEZRZSiYyLFifiSuk0nBH6uAY1TVMNR/h/aE4rr2OS6l82e4MJTpC6H/tqSMoE+3CwbkUKBQGLHIweYlg==", "cpu": [ "x64" ], @@ -548,13 +665,29 @@ "darwin" ] }, + "node_modules/@bruits/satteri-freebsd-x64": { + "version": "0.11.7", + "resolved": "https://registry.npmjs.org/@bruits/satteri-freebsd-x64/-/satteri-freebsd-x64-0.11.7.tgz", + "integrity": "sha512-EFlqw+RDRo3wYdy1ZSR/dNYhfWjuZL86PYwRcpLWWEZskjfpNnhIdxS13Xw2QJE1hSjTGVq4aZaVvlUjoj8p5A==", + "cpu": [ + "x64" + ], + "license": "MIT", + "optional": true, + "os": [ + "freebsd" + ] + }, "node_modules/@bruits/satteri-linux-arm64-gnu": { - "version": "0.10.5", - "resolved": "https://registry.npmjs.org/@bruits/satteri-linux-arm64-gnu/-/satteri-linux-arm64-gnu-0.10.5.tgz", - "integrity": "sha512-glkYXZCJywjP13v67eAyAMSJdF+ncvEbYvgi/wOtffL9tQ27lr/zsyzUfgs+ovjJ9d8JNQKiXeiArJcX8PJL9w==", + "version": "0.11.7", + "resolved": "https://registry.npmjs.org/@bruits/satteri-linux-arm64-gnu/-/satteri-linux-arm64-gnu-0.11.7.tgz", + "integrity": "sha512-aeH365GHaqv01wRSiHaGUlpL28U8e9UnV9LxjIF6BOyTj71/M5bop4HKomcis4VxFZjd68fDqNyU22yFkF/h7A==", "cpu": [ "arm64" ], + "libc": [ + "glibc" + ], "license": "MIT", "optional": true, "os": [ @@ -562,12 +695,15 @@ ] }, "node_modules/@bruits/satteri-linux-arm64-musl": { - "version": "0.10.5", - "resolved": "https://registry.npmjs.org/@bruits/satteri-linux-arm64-musl/-/satteri-linux-arm64-musl-0.10.5.tgz", - "integrity": "sha512-yWdgG1g17Nh2QyGVlFUxGRa3FEFwiMcpZEyMNWkbM3deC94cmVc+/i9OuyFpdKuWo3GkgoCtYVOoxk1uCnCZIA==", + "version": "0.11.7", + "resolved": "https://registry.npmjs.org/@bruits/satteri-linux-arm64-musl/-/satteri-linux-arm64-musl-0.11.7.tgz", + "integrity": "sha512-72WlBhuwOHm+2Nv4Qf1WzfS75PHOLz81sYkDJnmj0Rm2C4Xax5faSiTDt7vWo1IcK6rDlkuRDNnWIw8uIKWuVQ==", "cpu": [ "arm64" ], + "libc": [ + "musl" + ], "license": "MIT", "optional": true, "os": [ @@ -575,12 +711,15 @@ ] }, "node_modules/@bruits/satteri-linux-x64-gnu": { - "version": "0.10.5", - "resolved": "https://registry.npmjs.org/@bruits/satteri-linux-x64-gnu/-/satteri-linux-x64-gnu-0.10.5.tgz", - "integrity": "sha512-FVaLoPT1fBgGl0J+AYebyyXJYBachGl8Oyyrf1lye4RTqCB4S0Gwkj1uM9RJyThUOvx5VUmAT1CnNh1SFHA+kw==", + "version": "0.11.7", + "resolved": "https://registry.npmjs.org/@bruits/satteri-linux-x64-gnu/-/satteri-linux-x64-gnu-0.11.7.tgz", + "integrity": "sha512-gDp4v1jjckeNCetLtrMUfDV4CKGYL6fayDPdoaQq09nkDCSrclxEFK7kAmRuHhoalgsao4bZMFqQr3HQtN2NEQ==", "cpu": [ "x64" ], + "libc": [ + "glibc" + ], "license": "MIT", "optional": true, "os": [ @@ -588,12 +727,15 @@ ] }, "node_modules/@bruits/satteri-linux-x64-musl": { - "version": "0.10.5", - "resolved": "https://registry.npmjs.org/@bruits/satteri-linux-x64-musl/-/satteri-linux-x64-musl-0.10.5.tgz", - "integrity": "sha512-EHpVAx2bqW3GINHTKkljtxVfQmVDGWIuwOYOP5YghTj+0PkBa2o8oKPRtQ9Kbsr1Fye8jtUcDjhwj2jMNugZKg==", + "version": "0.11.7", + "resolved": "https://registry.npmjs.org/@bruits/satteri-linux-x64-musl/-/satteri-linux-x64-musl-0.11.7.tgz", + "integrity": "sha512-zqzSpQLA6V3J/TO2Vjuc1VRQPIQQdoSYmzKKFL+3GwGlbXiFQP2ZUDSLw9xlm0tTKXkCM9ANr4jMiDASZ+JGUw==", "cpu": [ "x64" ], + "libc": [ + "musl" + ], "license": "MIT", "optional": true, "os": [ @@ -601,9 +743,9 @@ ] }, "node_modules/@bruits/satteri-wasm32-wasi": { - "version": "0.10.5", - "resolved": "https://registry.npmjs.org/@bruits/satteri-wasm32-wasi/-/satteri-wasm32-wasi-0.10.5.tgz", - "integrity": "sha512-ypz8c/Zmipxp4IoeDa228Gstv6TLzVmNs3yC6wKCoNSOjx1iwpgzu87Y3hTkXFdwChVGU85qeUDuOIarGUZQLw==", + "version": "0.11.7", + "resolved": "https://registry.npmjs.org/@bruits/satteri-wasm32-wasi/-/satteri-wasm32-wasi-0.11.7.tgz", + "integrity": "sha512-L46f6rtlaBR4fsTWGCTFcXtbtka2GyM3l9TsmE0FgTxjXGq+sndYg5X3hzlhWDkNvJpRtCHCmgTRJ5+cIi4o3A==", "cpu": [ "wasm32" ], @@ -612,7 +754,7 @@ "dependencies": { "@emnapi/core": "1.11.1", "@emnapi/runtime": "1.11.1", - "@napi-rs/wasm-runtime": "^1.2.3" + "@napi-rs/wasm-runtime": "^1.2.7" }, "engines": { "node": ">=14.0.0" @@ -649,10 +791,31 @@ "tslib": "^2.4.0" } }, + "node_modules/@bruits/satteri-wasm32-wasi/node_modules/@napi-rs/wasm-runtime": { + "version": "1.2.7", + "resolved": "https://registry.npmjs.org/@napi-rs/wasm-runtime/-/wasm-runtime-1.2.7.tgz", + "integrity": "sha512-zJccwplOAbgfZju95IUHazLnx9RAPtPN2YGJXI6UbrgeaR9QfPjGrQL6ERkSAtnVCA4Q+83ApGyaX5zdpCaKkQ==", + "license": "MIT", + "optional": true, + "dependencies": { + "@tybys/wasm-util": "^0.10.3" + }, + "engines": { + "node": "^20.19.0 || ^22.13.0 || >=23.5.0" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/Brooooooklyn" + }, + "peerDependencies": { + "@emnapi/core": "^1.7.1 || 2.0.0-beta.2 || 2.0.0-beta.3", + "@emnapi/runtime": "^1.7.1 || 2.0.0-beta.2 || 2.0.0-beta.3" + } + }, "node_modules/@bruits/satteri-win32-arm64-msvc": { - "version": "0.10.5", - "resolved": "https://registry.npmjs.org/@bruits/satteri-win32-arm64-msvc/-/satteri-win32-arm64-msvc-0.10.5.tgz", - "integrity": "sha512-siTV88nb0LRqNpkL2gXboqCwVdq95sLtzMHS1/3eONV2gLbB3NAK46wmSMvCO/yquBvI2lvaFIfd8P12ecsxBw==", + "version": "0.11.7", + "resolved": "https://registry.npmjs.org/@bruits/satteri-win32-arm64-msvc/-/satteri-win32-arm64-msvc-0.11.7.tgz", + "integrity": "sha512-R2+o6EbJK4pqbd086H9BGUVYAyZ5F6FnShfoyRIu0Zu9DTE3H6EU/Z+ua7p9dmYf6JQQbE9DCwwavi4xiaGAhQ==", "cpu": [ "arm64" ], @@ -663,9 +826,9 @@ ] }, "node_modules/@bruits/satteri-win32-x64-msvc": { - "version": "0.10.5", - "resolved": "https://registry.npmjs.org/@bruits/satteri-win32-x64-msvc/-/satteri-win32-x64-msvc-0.10.5.tgz", - "integrity": "sha512-C3IfPvfvMXmlzBxaMPKFS1XiuV9pu2mC7YqkPk7PSvTgPZ8gbdASIpHpztDLvTTQjqZ0z1Ol8tK5X+V6XXC0wQ==", + "version": "0.11.7", + "resolved": "https://registry.npmjs.org/@bruits/satteri-win32-x64-msvc/-/satteri-win32-x64-msvc-0.11.7.tgz", + "integrity": "sha512-OIyBFJ35uMu5CH5RWnIR3bKsZwScKZ7vXmhCohZ+qonT1SkxmHCEf4H8YRWThRL2EXdVDjkjhfOsaiA4O24Vvw==", "cpu": [ "x64" ], @@ -874,501 +1037,85 @@ }, "node_modules/@emmetio/css-abbreviation": { "version": "2.1.8", - "resolved": "https://registry.npmjs.org/@emmetio/css-abbreviation/-/css-abbreviation-2.1.8.tgz", - "integrity": "sha512-s9yjhJ6saOO/uk1V74eifykk2CBYi01STTK3WlXWGOepyKa23ymJ053+DNQjpFcy1ingpaO7AxCcwLvHFY9tuw==", - "dev": true, - "license": "MIT", - "dependencies": { - "@emmetio/scanner": "^1.0.4" - } - }, - "node_modules/@emmetio/css-parser": { - "version": "0.4.1", - "resolved": "https://registry.npmjs.org/@emmetio/css-parser/-/css-parser-0.4.1.tgz", - "integrity": "sha512-2bC6m0MV/voF4CTZiAbG5MWKbq5EBmDPKu9Sb7s7nVcEzNQlrZP6mFFFlIaISM8X6514H9shWMme1fCm8cWAfQ==", - "dev": true, - "license": "MIT", - "dependencies": { - "@emmetio/stream-reader": "^2.2.0", - "@emmetio/stream-reader-utils": "^0.1.0" - } - }, - "node_modules/@emmetio/html-matcher": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/@emmetio/html-matcher/-/html-matcher-1.3.0.tgz", - "integrity": "sha512-NTbsvppE5eVyBMuyGfVu2CRrLvo7J4YHb6t9sBFLyY03WYhXET37qA4zOYUjBWFCRHO7pS1B9khERtY0f5JXPQ==", - "dev": true, - "license": "ISC", - "dependencies": { - "@emmetio/scanner": "^1.0.0" - } - }, - "node_modules/@emmetio/scanner": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/@emmetio/scanner/-/scanner-1.0.4.tgz", - "integrity": "sha512-IqRuJtQff7YHHBk4G8YZ45uB9BaAGcwQeVzgj/zj8/UdOhtQpEIupUhSk8dys6spFIWVZVeK20CzGEnqR5SbqA==", - "dev": true, - "license": "MIT" - }, - "node_modules/@emmetio/stream-reader": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/@emmetio/stream-reader/-/stream-reader-2.2.0.tgz", - "integrity": "sha512-fXVXEyFA5Yv3M3n8sUGT7+fvecGrZP4k6FnWWMSZVQf69kAq0LLpaBQLGcPR30m3zMmKYhECP4k/ZkzvhEW5kw==", - "dev": true, - "license": "MIT" - }, - "node_modules/@emmetio/stream-reader-utils": { - "version": "0.1.0", - "resolved": "https://registry.npmjs.org/@emmetio/stream-reader-utils/-/stream-reader-utils-0.1.0.tgz", - "integrity": "sha512-ZsZ2I9Vzso3Ho/pjZFsmmZ++FWeEd/txqybHTm4OgaZzdS8V9V/YYWQwg5TC38Z7uLWUV1vavpLLbjJtKubR1A==", - "dev": true, - "license": "MIT" - }, - "node_modules/@emnapi/core": { - "version": "1.11.3", - "resolved": "https://registry.npmjs.org/@emnapi/core/-/core-1.11.3.tgz", - "integrity": "sha512-zLpS5asjEb7lq8jYLq37N6XKaE41DIexlY1rF/z4/tIl3wo13Sqm28fRyfIsKZD+NZ8mM5RoKkpW/rBcuoSZSg==", - "devOptional": true, - "license": "MIT", - "dependencies": { - "@emnapi/wasi-threads": "1.2.3", - "tslib": "^2.4.0" - } - }, - "node_modules/@emnapi/runtime": { - "version": "1.11.3", - "resolved": "https://registry.npmjs.org/@emnapi/runtime/-/runtime-1.11.3.tgz", - "integrity": "sha512-Xz4Tpyki7XyrpbUK1jR1AhdAdaXyhhY4lZ3neLodmhpuWfy2PAQN5B46sAiU4liOXGLkHypn/qU+jvfWSCYYLA==", - "devOptional": true, - "license": "MIT", - "dependencies": { - "tslib": "^2.4.0" - } - }, - "node_modules/@emnapi/wasi-threads": { - "version": "1.2.3", - "resolved": "https://registry.npmjs.org/@emnapi/wasi-threads/-/wasi-threads-1.2.3.tgz", - "integrity": "sha512-ELEBe8PsLvvJ6QMr0zLt8ffvOHW/dc1m3CEzNMg7aJUv3bMaoDtw2TXyDAwkYBuroxxuHEwhRTLJSe5sya547g==", - "devOptional": true, - "license": "MIT", - "dependencies": { - "tslib": "^2.4.0" - } - }, - "node_modules/@esbuild/aix-ppc64": { - "version": "0.28.2", - "resolved": "https://registry.npmjs.org/@esbuild/aix-ppc64/-/aix-ppc64-0.28.2.tgz", - "integrity": "sha512-XExcO+dvLKvVtNTibSTBej1NCAbaGhWn9Ww1ZPx80qsahhPFe/8jgWP0IchNe0F3HwkU7n8ejhH8bjonqht8mQ==", - "cpu": [ - "ppc64" - ], - "license": "MIT", - "optional": true, - "os": [ - "aix" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/@esbuild/android-arm": { - "version": "0.28.2", - "resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.28.2.tgz", - "integrity": "sha512-kXXoiPVVGQcnIYGOeaovwOURpniDBpSq4A03qkQ+BMQqtGG6HYap3xne9C1O1yo4TR3qxlCX5IqqmX6fFo2Lqg==", - "cpu": [ - "arm" - ], - "license": "MIT", - "optional": true, - "os": [ - "android" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/@esbuild/android-arm64": { - "version": "0.28.2", - "resolved": "https://registry.npmjs.org/@esbuild/android-arm64/-/android-arm64-0.28.2.tgz", - "integrity": "sha512-5YfKeeI8qWfBZIX+u2xZC3Zlb3Os/gLS2sbEKM+I4ZOcsWmHS2WLysCcQZDAFRslDUU5Oiq44gf6PYN1vGwG5A==", - "cpu": [ - "arm64" - ], - "license": "MIT", - "optional": true, - "os": [ - "android" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/@esbuild/android-x64": { - "version": "0.28.2", - "resolved": "https://registry.npmjs.org/@esbuild/android-x64/-/android-x64-0.28.2.tgz", - "integrity": "sha512-O387ite7SzUyCcy3JQX4P4bLtEA7bLLkx+esve5JHnyYfNTxcVpXZo9jhdB0lTKN44gztELTdU7nS8Nr16Fs1Q==", - "cpu": [ - "x64" - ], - "license": "MIT", - "optional": true, - "os": [ - "android" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/@esbuild/darwin-arm64": { - "version": "0.28.2", - "resolved": "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.28.2.tgz", - "integrity": "sha512-n4KqkOQrraxHJcgjM1RvwbigfQKIKJVpM7xp+KsxiyUSrRdIXnt73VhrPAx0fV44hgfmIVKjxMN9J1t5jySVkw==", - "cpu": [ - "arm64" - ], - "license": "MIT", - "optional": true, - "os": [ - "darwin" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/@esbuild/darwin-x64": { - "version": "0.28.2", - "resolved": "https://registry.npmjs.org/@esbuild/darwin-x64/-/darwin-x64-0.28.2.tgz", - "integrity": "sha512-uq6suIWYP37qzGddBKPw5QEQPi6HiLGsO7UmkpfyaYNQ3D+rN6w6WfwH+nuqcGXWvawGwxOEroO4YGnFh95azw==", - "cpu": [ - "x64" - ], - "license": "MIT", - "optional": true, - "os": [ - "darwin" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/@esbuild/freebsd-arm64": { - "version": "0.28.2", - "resolved": "https://registry.npmjs.org/@esbuild/freebsd-arm64/-/freebsd-arm64-0.28.2.tgz", - "integrity": "sha512-n+I0BTSRIoy+d6RPKnEVwql5UwBJolytvY4mAOIEJorKlqgPII8ix6slVVrfZ5Tnj7glIZvloylbB/EJPMWEXw==", - "cpu": [ - "arm64" - ], - "license": "MIT", - "optional": true, - "os": [ - "freebsd" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/@esbuild/freebsd-x64": { - "version": "0.28.2", - "resolved": "https://registry.npmjs.org/@esbuild/freebsd-x64/-/freebsd-x64-0.28.2.tgz", - "integrity": "sha512-78XJTJkvPs0kz2w61301PJjXl4g7q3JqiYMZ/M/yVI73EHBrCRTgkhu9oqG7vPqq+a/yadEW8aD+agKlk5xrmg==", - "cpu": [ - "x64" - ], - "license": "MIT", - "optional": true, - "os": [ - "freebsd" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/@esbuild/linux-arm": { - "version": "0.28.2", - "resolved": "https://registry.npmjs.org/@esbuild/linux-arm/-/linux-arm-0.28.2.tgz", - "integrity": "sha512-XlDnu2q5yoqems+xay6wSAcg9DDD7K9RLKZEBOMZm3ckNpJBvOX20tSfby8KfrrhINDyv9V2YVZKY/SpoGJI8w==", - "cpu": [ - "arm" - ], - "license": "MIT", - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/@esbuild/linux-arm64": { - "version": "0.28.2", - "resolved": "https://registry.npmjs.org/@esbuild/linux-arm64/-/linux-arm64-0.28.2.tgz", - "integrity": "sha512-pW4AC0P3it8c7do9MVM4p51FzHzdM/TZrerurgRcHJ2WTa1VQ1CIq18xncfpBJw4ojkiZZrKW2yIBWBP92j6Ug==", - "cpu": [ - "arm64" - ], - "license": "MIT", - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/@esbuild/linux-ia32": { - "version": "0.28.2", - "resolved": "https://registry.npmjs.org/@esbuild/linux-ia32/-/linux-ia32-0.28.2.tgz", - "integrity": "sha512-CYbnj78HsIeA+DhgUKgFCfvNsTHFhMMrinUrMZpDXJXKN8T3XViTZ/+wtHeVxEWY8ewSzTFN+nRmSwO2tZaLUQ==", - "cpu": [ - "ia32" - ], - "license": "MIT", - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/@esbuild/linux-loong64": { - "version": "0.28.2", - "resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.28.2.tgz", - "integrity": "sha512-buwkd8nsph4R+ajRvw0qM5Hja/TXQow3ptzWO2EbG/cqcIkHloRrdlBtQlshyYGTNFvfkfJ5tpPLVkY4DtsPfQ==", - "cpu": [ - "loong64" - ], - "license": "MIT", - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/@esbuild/linux-mips64el": { - "version": "0.28.2", - "resolved": "https://registry.npmjs.org/@esbuild/linux-mips64el/-/linux-mips64el-0.28.2.tgz", - "integrity": "sha512-ZVykbDyk7519VwiNb9Lcj9m8XM6v5V9uKPvrEMkkEedVewf+0itkhahp4HDpgERXhwLRpWFypsGbG/J8s0QjJA==", - "cpu": [ - "mips64el" - ], - "license": "MIT", - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/@esbuild/linux-ppc64": { - "version": "0.28.2", - "resolved": "https://registry.npmjs.org/@esbuild/linux-ppc64/-/linux-ppc64-0.28.2.tgz", - "integrity": "sha512-CAXl+Dtd9UUuJd8pKKdwh6MLm3MUMiqMPmhZ3tTSXPqfyQ3vDl6R5hZdZ/kYojK4ofXtdfSv1tFq8XzWx3heNQ==", - "cpu": [ - "ppc64" - ], - "license": "MIT", - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/@esbuild/linux-riscv64": { - "version": "0.28.2", - "resolved": "https://registry.npmjs.org/@esbuild/linux-riscv64/-/linux-riscv64-0.28.2.tgz", - "integrity": "sha512-GeXCej4IQtU1B+QlDV8W/RRvbzI3O/Stss+/bCXv4lZls5WGRtu2a+3JkA3i4qIUlMXpcHebWpF8AkJhATowuA==", - "cpu": [ - "riscv64" - ], - "license": "MIT", - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/@esbuild/linux-s390x": { - "version": "0.28.2", - "resolved": "https://registry.npmjs.org/@esbuild/linux-s390x/-/linux-s390x-0.28.2.tgz", - "integrity": "sha512-3H1weTYZPxt/WOhByszQZybS9w5lKzUn1FDMsgEChbHWQwHYQQRfBxgCcZvPhjHfKyJjIievvMmEUawJrdY9Dg==", - "cpu": [ - "s390x" - ], - "license": "MIT", - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/@esbuild/linux-x64": { - "version": "0.28.2", - "resolved": "https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-0.28.2.tgz", - "integrity": "sha512-4xTZr1FUmSoQW4XIWmit3tzQrUTZM+N3P0XV8xROKYF50XfI7xeO90+1bZvNwxIufQ9hDQVRJH5YhgPVF8A/HQ==", - "cpu": [ - "x64" - ], - "license": "MIT", - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/@esbuild/netbsd-arm64": { - "version": "0.28.2", - "resolved": "https://registry.npmjs.org/@esbuild/netbsd-arm64/-/netbsd-arm64-0.28.2.tgz", - "integrity": "sha512-sSATRjPeDBg3pdgHoQfoYBob11Kk1FGa9lui5RIHZCoCkJa9QKlvl3/vKz2usCmYYjs7ymJR/2Nnsqe+Hjt5nw==", - "cpu": [ - "arm64" - ], - "license": "MIT", - "optional": true, - "os": [ - "netbsd" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/@esbuild/netbsd-x64": { - "version": "0.28.2", - "resolved": "https://registry.npmjs.org/@esbuild/netbsd-x64/-/netbsd-x64-0.28.2.tgz", - "integrity": "sha512-lqnzCV+mM0gIADaKihiCg6ifgfU2L3h5E33rNQBN1Y4MaVGnzryzmvvf7UHxprpQdE8hpqLolJ9Rl+SkIRDpyw==", - "cpu": [ - "x64" - ], - "license": "MIT", - "optional": true, - "os": [ - "netbsd" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/@esbuild/openbsd-arm64": { - "version": "0.28.2", - "resolved": "https://registry.npmjs.org/@esbuild/openbsd-arm64/-/openbsd-arm64-0.28.2.tgz", - "integrity": "sha512-AL2qJILH7lNjrDmCQDvdxMfAUIv8KMNZOvrwAQ8i8//ntL9FflhOyMJ8OZSMBb8/AWXe3/5v5S20y3zCoZWKoQ==", - "cpu": [ - "arm64" - ], - "license": "MIT", - "optional": true, - "os": [ - "openbsd" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/@esbuild/openbsd-x64": { - "version": "0.28.2", - "resolved": "https://registry.npmjs.org/@esbuild/openbsd-x64/-/openbsd-x64-0.28.2.tgz", - "integrity": "sha512-QtiuPytchRyC4rwUKhexJdQKvDuZ6hWloi3igqPQNUJCS1/v9EiO3UTOXR6A3FoMo4fnAKbWJdqaIwhOzh8qEw==", - "cpu": [ - "x64" - ], - "license": "MIT", - "optional": true, - "os": [ - "openbsd" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/@esbuild/openharmony-arm64": { - "version": "0.28.2", - "resolved": "https://registry.npmjs.org/@esbuild/openharmony-arm64/-/openharmony-arm64-0.28.2.tgz", - "integrity": "sha512-WkhYDmpTjLvGlScA1rwjRUmhl4k8oXR3cIbtqWmELgU/dFeHHlEllxDvdWcNJV9rbzCexB5vz8gtNewWLgCT7Q==", - "cpu": [ - "arm64" - ], - "license": "MIT", - "optional": true, - "os": [ - "openharmony" - ], - "engines": { - "node": ">=18" + "resolved": "https://registry.npmjs.org/@emmetio/css-abbreviation/-/css-abbreviation-2.1.8.tgz", + "integrity": "sha512-s9yjhJ6saOO/uk1V74eifykk2CBYi01STTK3WlXWGOepyKa23ymJ053+DNQjpFcy1ingpaO7AxCcwLvHFY9tuw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@emmetio/scanner": "^1.0.4" } }, - "node_modules/@esbuild/sunos-x64": { - "version": "0.28.2", - "resolved": "https://registry.npmjs.org/@esbuild/sunos-x64/-/sunos-x64-0.28.2.tgz", - "integrity": "sha512-GPMSkTOtMnv2U2F8gxe4Io6qmVs+YKyp832Etqqxr0hFngmXQ3rzwytelm3GIn7T4VviRUlf3sOgBOiTdvaf7g==", - "cpu": [ - "x64" - ], + "node_modules/@emmetio/css-parser": { + "version": "0.4.1", + "resolved": "https://registry.npmjs.org/@emmetio/css-parser/-/css-parser-0.4.1.tgz", + "integrity": "sha512-2bC6m0MV/voF4CTZiAbG5MWKbq5EBmDPKu9Sb7s7nVcEzNQlrZP6mFFFlIaISM8X6514H9shWMme1fCm8cWAfQ==", + "dev": true, "license": "MIT", - "optional": true, - "os": [ - "sunos" - ], - "engines": { - "node": ">=18" + "dependencies": { + "@emmetio/stream-reader": "^2.2.0", + "@emmetio/stream-reader-utils": "^0.1.0" } }, - "node_modules/@esbuild/win32-arm64": { - "version": "0.28.2", - "resolved": "https://registry.npmjs.org/@esbuild/win32-arm64/-/win32-arm64-0.28.2.tgz", - "integrity": "sha512-PIhhEkE9uPBleRBrQEJpUn7MBnibZzbGzYWPmY3x+YoVg/95zbjB4CxPPOQ8l5tYYM4mMaCthF8/1DIfBQQyWQ==", - "cpu": [ - "arm64" - ], + "node_modules/@emmetio/html-matcher": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/@emmetio/html-matcher/-/html-matcher-1.3.0.tgz", + "integrity": "sha512-NTbsvppE5eVyBMuyGfVu2CRrLvo7J4YHb6t9sBFLyY03WYhXET37qA4zOYUjBWFCRHO7pS1B9khERtY0f5JXPQ==", + "dev": true, + "license": "ISC", + "dependencies": { + "@emmetio/scanner": "^1.0.0" + } + }, + "node_modules/@emmetio/scanner": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/@emmetio/scanner/-/scanner-1.0.4.tgz", + "integrity": "sha512-IqRuJtQff7YHHBk4G8YZ45uB9BaAGcwQeVzgj/zj8/UdOhtQpEIupUhSk8dys6spFIWVZVeK20CzGEnqR5SbqA==", + "dev": true, + "license": "MIT" + }, + "node_modules/@emmetio/stream-reader": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/@emmetio/stream-reader/-/stream-reader-2.2.0.tgz", + "integrity": "sha512-fXVXEyFA5Yv3M3n8sUGT7+fvecGrZP4k6FnWWMSZVQf69kAq0LLpaBQLGcPR30m3zMmKYhECP4k/ZkzvhEW5kw==", + "dev": true, + "license": "MIT" + }, + "node_modules/@emmetio/stream-reader-utils": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/@emmetio/stream-reader-utils/-/stream-reader-utils-0.1.0.tgz", + "integrity": "sha512-ZsZ2I9Vzso3Ho/pjZFsmmZ++FWeEd/txqybHTm4OgaZzdS8V9V/YYWQwg5TC38Z7uLWUV1vavpLLbjJtKubR1A==", + "dev": true, + "license": "MIT" + }, + "node_modules/@emnapi/core": { + "version": "1.11.3", + "resolved": "https://registry.npmjs.org/@emnapi/core/-/core-1.11.3.tgz", + "integrity": "sha512-zLpS5asjEb7lq8jYLq37N6XKaE41DIexlY1rF/z4/tIl3wo13Sqm28fRyfIsKZD+NZ8mM5RoKkpW/rBcuoSZSg==", + "devOptional": true, "license": "MIT", - "optional": true, - "os": [ - "win32" - ], - "engines": { - "node": ">=18" + "dependencies": { + "@emnapi/wasi-threads": "1.2.3", + "tslib": "^2.4.0" } }, - "node_modules/@esbuild/win32-ia32": { - "version": "0.28.2", - "resolved": "https://registry.npmjs.org/@esbuild/win32-ia32/-/win32-ia32-0.28.2.tgz", - "integrity": "sha512-YmJbfTlvU7Sdn9BB+4PRES4oB6pxgS37MAONj+hBr/cpXS1aBPKXxNnDbu+QCWPj0o9dgyxeq79g6c5P8KeuYA==", - "cpu": [ - "ia32" - ], + "node_modules/@emnapi/runtime": { + "version": "1.11.3", + "resolved": "https://registry.npmjs.org/@emnapi/runtime/-/runtime-1.11.3.tgz", + "integrity": "sha512-Xz4Tpyki7XyrpbUK1jR1AhdAdaXyhhY4lZ3neLodmhpuWfy2PAQN5B46sAiU4liOXGLkHypn/qU+jvfWSCYYLA==", + "devOptional": true, "license": "MIT", - "optional": true, - "os": [ - "win32" - ], - "engines": { - "node": ">=18" + "dependencies": { + "tslib": "^2.4.0" } }, - "node_modules/@esbuild/win32-x64": { - "version": "0.28.2", - "resolved": "https://registry.npmjs.org/@esbuild/win32-x64/-/win32-x64-0.28.2.tgz", - "integrity": "sha512-5ebpxr3nWMzrL/rnUI755Jkuee0bHL/Gq0WTF9lvcpv73wAp5eu8MfBUgWK9bhWvZjj7yX8etf/8tI8Ney695g==", - "cpu": [ - "x64" - ], + "node_modules/@emnapi/wasi-threads": { + "version": "1.2.3", + "resolved": "https://registry.npmjs.org/@emnapi/wasi-threads/-/wasi-threads-1.2.3.tgz", + "integrity": "sha512-ELEBe8PsLvvJ6QMr0zLt8ffvOHW/dc1m3CEzNMg7aJUv3bMaoDtw2TXyDAwkYBuroxxuHEwhRTLJSe5sya547g==", + "devOptional": true, "license": "MIT", - "optional": true, - "os": [ - "win32" - ], - "engines": { - "node": ">=18" + "dependencies": { + "tslib": "^2.4.0" } }, "node_modules/@fontsource/inter": { @@ -1917,7 +1664,7 @@ "version": "1.2.4", "resolved": "https://registry.npmjs.org/@napi-rs/wasm-runtime/-/wasm-runtime-1.2.4.tgz", "integrity": "sha512-AJxoUD2/15ESHbvpcyjU274nsAPLuOtPHCk0vKJM5pj//Fg/B1FXNWjPnXTT9PymCYYiHo4zPj0ZomXBKhoy7g==", - "devOptional": true, + "dev": true, "license": "MIT", "dependencies": { "@tybys/wasm-util": "^0.10.3" @@ -1941,9 +1688,9 @@ "license": "MIT" }, "node_modules/@oxc-project/types": { - "version": "0.155.0", - "resolved": "https://registry.npmjs.org/@oxc-project/types/-/types-0.155.0.tgz", - "integrity": "sha512-SeE8JPwW1xs1tHeNycjUtUBdhorRa8o4jlvjwk49R7/Z291i+4DQa7JJIgOm/TaYQZx+QrPQbVJ/9c8dMIZN8Q==", + "version": "0.156.0", + "resolved": "https://registry.npmjs.org/@oxc-project/types/-/types-0.156.0.tgz", + "integrity": "sha512-1Duyg48TdJNdyhEB8Xn1L36bT9Pv6GUtlKjHxOys8xkaF/rQq3XJE+bAurSK/AgIz5mGFsb77cn9Pb20+WCScw==", "license": "MIT", "funding": { "url": "https://github.com/sponsors/oxc-project" @@ -2222,9 +1969,9 @@ } }, "node_modules/@rolldown/binding-android-arm-eabi": { - "version": "1.2.15", - "resolved": "https://registry.npmjs.org/@rolldown/binding-android-arm-eabi/-/binding-android-arm-eabi-1.2.15.tgz", - "integrity": "sha512-aLcgK9gIJ3YRvrrtfSBbRa27F5WrpiTaPulnFpsHPxpUHgFlSgnU4854MHwoRGEBhfRJDWCS2WQ7lIjskE9Olw==", + "version": "1.2.19", + "resolved": "https://registry.npmjs.org/@rolldown/binding-android-arm-eabi/-/binding-android-arm-eabi-1.2.19.tgz", + "integrity": "sha512-e+Ebe0WT+9tbXmNKPIiC8YrWAHYwug3m6i4p3rZGGulfZri1jtI4HslT+OZnFf/OIHowWF71DTlHwXBP2SiA7A==", "cpu": [ "arm" ], @@ -2238,9 +1985,9 @@ } }, "node_modules/@rolldown/binding-android-arm64": { - "version": "1.2.15", - "resolved": "https://registry.npmjs.org/@rolldown/binding-android-arm64/-/binding-android-arm64-1.2.15.tgz", - "integrity": "sha512-xD7DdZCrbThKuxNg7ooQmvp07ys4J/pnSEMTG3/OdOWl6daC67m/Q4fL78sRHMxTH/N4fGUbYhcPM0MF5WFHkg==", + "version": "1.2.19", + "resolved": "https://registry.npmjs.org/@rolldown/binding-android-arm64/-/binding-android-arm64-1.2.19.tgz", + "integrity": "sha512-hOombrTJ+szt2ciEzS7oCA78lMPBgF5UMQWCJIyNfnrI7GLl8HYoFqCnpL2gcPOaXMqryGCU5ExdQKyDDcC+yA==", "cpu": [ "arm64" ], @@ -2254,9 +2001,9 @@ } }, "node_modules/@rolldown/binding-darwin-arm64": { - "version": "1.2.15", - "resolved": "https://registry.npmjs.org/@rolldown/binding-darwin-arm64/-/binding-darwin-arm64-1.2.15.tgz", - "integrity": "sha512-m2WuQ6r0B4OTYxyPpNLtXaMRbRDUbG8YQV2Q3KTdSSK8Th6KHCnC8jVCJt8bvYeSB5WivkkNbc85mKadaSdOxA==", + "version": "1.2.19", + "resolved": "https://registry.npmjs.org/@rolldown/binding-darwin-arm64/-/binding-darwin-arm64-1.2.19.tgz", + "integrity": "sha512-XoMA2pwCKGTQzUjPgtRwkedH4WmXhdIPKT6l6oOxd1PUbNodGI6DcBekgN7EC//+x3pfBYX/qL1gNmZAqivw5g==", "cpu": [ "arm64" ], @@ -2270,9 +2017,9 @@ } }, "node_modules/@rolldown/binding-darwin-x64": { - "version": "1.2.15", - "resolved": "https://registry.npmjs.org/@rolldown/binding-darwin-x64/-/binding-darwin-x64-1.2.15.tgz", - "integrity": "sha512-5RtnsHM36nodM9WbMy+zip0LGS/G+y5wro5RHrpOlr4ac24+1zSi9kiV2MP1myZeZ/ifEHfulQcWjnAXzc2C2A==", + "version": "1.2.19", + "resolved": "https://registry.npmjs.org/@rolldown/binding-darwin-x64/-/binding-darwin-x64-1.2.19.tgz", + "integrity": "sha512-zo8EsSSwMZCY/e+fRnGaX02YGgvJD0yvhNi/9hpGPA2MJ9ZF8dPCw75UGfpI6OpQ/myR/dIYmogRvqiZD0TrXg==", "cpu": [ "x64" ], @@ -2286,9 +2033,9 @@ } }, "node_modules/@rolldown/binding-freebsd-x64": { - "version": "1.2.15", - "resolved": "https://registry.npmjs.org/@rolldown/binding-freebsd-x64/-/binding-freebsd-x64-1.2.15.tgz", - "integrity": "sha512-g3l09pyFqhu+135JKkbkwiKGQmwU5hUMUPJ4VdBADvuqR8d33L6H578rh8m7rtxbdp+VmX/+nzI7nvhSZlzpUQ==", + "version": "1.2.19", + "resolved": "https://registry.npmjs.org/@rolldown/binding-freebsd-x64/-/binding-freebsd-x64-1.2.19.tgz", + "integrity": "sha512-O8ISAOfI1nj7AuBPd30FSF47z7f7lzlk5poQVGgiikvQuGEBFYvW8ki+UEnT+YJPnNGjQzn304klt4O9FUE7mA==", "cpu": [ "x64" ], @@ -2302,9 +2049,9 @@ } }, "node_modules/@rolldown/binding-linux-arm-gnueabihf": { - "version": "1.2.15", - "resolved": "https://registry.npmjs.org/@rolldown/binding-linux-arm-gnueabihf/-/binding-linux-arm-gnueabihf-1.2.15.tgz", - "integrity": "sha512-nIe3VugI97nGQtspPxDqA4sXMUpeiocKIP/CqpY/u/vgbT+alX+cVxu1C/oVBPKg4feNTmYovE91v4DgXvXNwQ==", + "version": "1.2.19", + "resolved": "https://registry.npmjs.org/@rolldown/binding-linux-arm-gnueabihf/-/binding-linux-arm-gnueabihf-1.2.19.tgz", + "integrity": "sha512-/lYCba5NO0yq4S0jGMH8QTBtkvQxoXjoQWzF5BcWp9MjB9jxVRD1GQDNofkVjcOj30DWyhLIN/4Oe60JKzaONw==", "cpu": [ "arm" ], @@ -2318,9 +2065,9 @@ } }, "node_modules/@rolldown/binding-linux-arm64-gnu": { - "version": "1.2.15", - "resolved": "https://registry.npmjs.org/@rolldown/binding-linux-arm64-gnu/-/binding-linux-arm64-gnu-1.2.15.tgz", - "integrity": "sha512-iTBjXx+B5QSvgI89lJfmqh4wTh8NabR1YZIIN3hNx4zSG0EVfVqkOvLulNpG4251pbd6/IAmZ/LefVk1Y4rPhw==", + "version": "1.2.19", + "resolved": "https://registry.npmjs.org/@rolldown/binding-linux-arm64-gnu/-/binding-linux-arm64-gnu-1.2.19.tgz", + "integrity": "sha512-pm/apFMBnSbFb3O6nG5pHO1iqHhZrjGDFEjSm+ot9J17XXPvH9L90y5h+jgfHCE+Qdlsvy8qKEcU4VKxgjD+vA==", "cpu": [ "arm64" ], @@ -2337,9 +2084,9 @@ } }, "node_modules/@rolldown/binding-linux-arm64-musl": { - "version": "1.2.15", - "resolved": "https://registry.npmjs.org/@rolldown/binding-linux-arm64-musl/-/binding-linux-arm64-musl-1.2.15.tgz", - "integrity": "sha512-uN26XOnVR7rqQupG3V9oAG2EGGatWjcJHOeDOHUFCh4TBWmP2tHTFoVN13aYbwfm0aHqJAEmcwhAu6sooIjfqQ==", + "version": "1.2.19", + "resolved": "https://registry.npmjs.org/@rolldown/binding-linux-arm64-musl/-/binding-linux-arm64-musl-1.2.19.tgz", + "integrity": "sha512-K1SmQp3FFichn8oqrNIwvFoZ5wcvjC7goBzpaMNvLf9FZc+QB/QvLmnpJZgAAGHiD980tP8FZZnXk2K94rvlxg==", "cpu": [ "arm64" ], @@ -2356,9 +2103,9 @@ } }, "node_modules/@rolldown/binding-linux-ppc64-gnu": { - "version": "1.2.15", - "resolved": "https://registry.npmjs.org/@rolldown/binding-linux-ppc64-gnu/-/binding-linux-ppc64-gnu-1.2.15.tgz", - "integrity": "sha512-9nWkcdd+H+XhaA3fQIwpHnKIrfx/PQ6rO0pivr78Og07tXlUlctBBJoEYLPfhTmCR/QxEVdn6uPjHV5SymPhdw==", + "version": "1.2.19", + "resolved": "https://registry.npmjs.org/@rolldown/binding-linux-ppc64-gnu/-/binding-linux-ppc64-gnu-1.2.19.tgz", + "integrity": "sha512-I0xwD57jP/3A7+5UPZin2w8Y7XHEmEM5zqpYZOcQ45MlNW6tUJUziymV3yRr7rL4vwyfEcRsRksC4a7Kc08p5Q==", "cpu": [ "ppc64" ], @@ -2375,9 +2122,9 @@ } }, "node_modules/@rolldown/binding-linux-s390x-gnu": { - "version": "1.2.15", - "resolved": "https://registry.npmjs.org/@rolldown/binding-linux-s390x-gnu/-/binding-linux-s390x-gnu-1.2.15.tgz", - "integrity": "sha512-Ggh0ciFjLwIusLSLz7LZYEaGdxOAUJXI+Qu5JCbhPJJHEt8vP+IjRATTJheiJsdzzTYgUiHUiw3X1Ea3ZpMBdA==", + "version": "1.2.19", + "resolved": "https://registry.npmjs.org/@rolldown/binding-linux-s390x-gnu/-/binding-linux-s390x-gnu-1.2.19.tgz", + "integrity": "sha512-BrtEHT24SNXj9HiXqy+s/kXiSiQGt6EKCPUlRirAoIioVxKGnbXBUEkbZASAei7iZJB0/Ynm+0JP00Ipx7AnSw==", "cpu": [ "s390x" ], @@ -2394,9 +2141,9 @@ } }, "node_modules/@rolldown/binding-linux-x64-gnu": { - "version": "1.2.15", - "resolved": "https://registry.npmjs.org/@rolldown/binding-linux-x64-gnu/-/binding-linux-x64-gnu-1.2.15.tgz", - "integrity": "sha512-FHg60rS6DBePAYZ9X9F67x+JObFdmgn6tupA1C/a3B+CufFmTD4mX+e8M75tCiAO3foR/6xwVBI0KQiI7sn/rw==", + "version": "1.2.19", + "resolved": "https://registry.npmjs.org/@rolldown/binding-linux-x64-gnu/-/binding-linux-x64-gnu-1.2.19.tgz", + "integrity": "sha512-rm75/9DkHKeU2WnA8w4X94WGYgLlDCFCfkQC+4bguVJmC/jvDRv2B+2wLOYhyE0fVuv7//Ckk39OoOufyCu76Q==", "cpu": [ "x64" ], @@ -2413,9 +2160,9 @@ } }, "node_modules/@rolldown/binding-linux-x64-musl": { - "version": "1.2.15", - "resolved": "https://registry.npmjs.org/@rolldown/binding-linux-x64-musl/-/binding-linux-x64-musl-1.2.15.tgz", - "integrity": "sha512-/cvV/7v5VGz/moiz0XKRj2dE8DzsKyhIu1KpOvJGPjRywg3yscON889UGvAe8zfiJLHup7VLjBduoGWi3HusWQ==", + "version": "1.2.19", + "resolved": "https://registry.npmjs.org/@rolldown/binding-linux-x64-musl/-/binding-linux-x64-musl-1.2.19.tgz", + "integrity": "sha512-irh/4+iYFM4GAzpluDErgjz89bj6NDtqqMAG/6O1LG38Ed3NpyebzCpcVNkFW8uhy+/3/BocUvnXDR33CXWe9A==", "cpu": [ "x64" ], @@ -2432,9 +2179,9 @@ } }, "node_modules/@rolldown/binding-openharmony-arm64": { - "version": "1.2.15", - "resolved": "https://registry.npmjs.org/@rolldown/binding-openharmony-arm64/-/binding-openharmony-arm64-1.2.15.tgz", - "integrity": "sha512-MyzC5Hrv/sm+Z7TSGKP/j8001RO2xQm1zOpCNVL4j0cY/VhBZviludA2YFQ7i4lH6ZAXxQm0lcMdBzM+99mE7w==", + "version": "1.2.19", + "resolved": "https://registry.npmjs.org/@rolldown/binding-openharmony-arm64/-/binding-openharmony-arm64-1.2.19.tgz", + "integrity": "sha512-+KWTWNoPt+CfSq94CiceWu3yPE+QzkaG+phPyz9G60tmZLwfQkcA4AeksafzvJAw4pvg1mcd5a1TkUqVv0s4JA==", "cpu": [ "arm64" ], @@ -2447,10 +2194,80 @@ "node": "^20.19.0 || >=22.12.0" } }, + "node_modules/@rolldown/binding-wasm32-wasi": { + "version": "1.2.19", + "resolved": "https://registry.npmjs.org/@rolldown/binding-wasm32-wasi/-/binding-wasm32-wasi-1.2.19.tgz", + "integrity": "sha512-7EH+skOsl5qpWnK0vzamgJFhOv1cwxQpsxm8tI883K9fur5c27p8q87fzEO6BbBPabA2/+s/zR63/pLc137iOg==", + "cpu": [ + "wasm32" + ], + "license": "MIT", + "optional": true, + "dependencies": { + "@emnapi/core": "2.0.0-beta.2", + "@emnapi/runtime": "2.0.0-beta.2", + "@napi-rs/wasm-runtime": "1.2.6" + }, + "engines": { + "node": "^20.19.0 || ^22.13.0 || >=23.5.0" + } + }, + "node_modules/@rolldown/binding-wasm32-wasi/node_modules/@emnapi/core": { + "version": "2.0.0-beta.2", + "resolved": "https://registry.npmjs.org/@emnapi/core/-/core-2.0.0-beta.2.tgz", + "integrity": "sha512-MzCVoWtcg4Pm2B3je5mMvYMvj3MmBKw+fU7vbsJc9/iT8ip6/eYIHo/Dsm/mr+wsHB6SEyJDuxB09Yy6r/8+4A==", + "license": "MIT", + "optional": true, + "dependencies": { + "@emnapi/wasi-threads": "2.2.0", + "tslib": "^2.4.0" + } + }, + "node_modules/@rolldown/binding-wasm32-wasi/node_modules/@emnapi/runtime": { + "version": "2.0.0-beta.2", + "resolved": "https://registry.npmjs.org/@emnapi/runtime/-/runtime-2.0.0-beta.2.tgz", + "integrity": "sha512-JcrSPzPvZuNZvJqPTF9Fw25LbOJ8avzFVlaf2grmH4Cku0oGP47tRgqPZadcfj3YoZMHkFVnCYFbQM8I+i5QEw==", + "license": "MIT", + "optional": true, + "dependencies": { + "tslib": "^2.4.0" + } + }, + "node_modules/@rolldown/binding-wasm32-wasi/node_modules/@emnapi/wasi-threads": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/@emnapi/wasi-threads/-/wasi-threads-2.2.0.tgz", + "integrity": "sha512-JP7OYH38Q7+pyTAe14raZHLQIK7BDKbdwji+Xi3pcd/6QkJYQH3SX4wu6EplGrGJWRepoNzedfm0G3B9Z4e9Rw==", + "license": "MIT", + "optional": true, + "dependencies": { + "tslib": "^2.4.0" + } + }, + "node_modules/@rolldown/binding-wasm32-wasi/node_modules/@napi-rs/wasm-runtime": { + "version": "1.2.6", + "resolved": "https://registry.npmjs.org/@napi-rs/wasm-runtime/-/wasm-runtime-1.2.6.tgz", + "integrity": "sha512-mRyDmEw9/fCDXCGfL1sbgIw/GUK0PVxRW4YwgPN61F3LQ+fSyoBFarJVzgGyhF6kRzEQZ0FejDqm4WLXSeqQmw==", + "license": "MIT", + "optional": true, + "dependencies": { + "@tybys/wasm-util": "^0.10.3" + }, + "engines": { + "node": "^20.19.0 || ^22.13.0 || >=23.5.0" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/Brooooooklyn" + }, + "peerDependencies": { + "@emnapi/core": "^1.7.1 || 2.0.0-beta.2", + "@emnapi/runtime": "^1.7.1 || 2.0.0-beta.2" + } + }, "node_modules/@rolldown/binding-win32-arm64-msvc": { - "version": "1.2.15", - "resolved": "https://registry.npmjs.org/@rolldown/binding-win32-arm64-msvc/-/binding-win32-arm64-msvc-1.2.15.tgz", - "integrity": "sha512-+PgYiS+AH5omy6L45ZLxybasauJaj3M8buoT83D+nzPmCayXlxUV9hydhciCKVyIg0B/v0BtXPDE1uGqNwCPpg==", + "version": "1.2.19", + "resolved": "https://registry.npmjs.org/@rolldown/binding-win32-arm64-msvc/-/binding-win32-arm64-msvc-1.2.19.tgz", + "integrity": "sha512-3Q1Yg1Q7tEvBWoZf5rFvG/GKZQPgwfru+p4wBajDfJFBs0SHCpL++dfTjW9gyAKd1T7ZpIYvdaUax7Pa/IhFVQ==", "cpu": [ "arm64" ], @@ -2464,9 +2281,9 @@ } }, "node_modules/@rolldown/binding-win32-x64-msvc": { - "version": "1.2.15", - "resolved": "https://registry.npmjs.org/@rolldown/binding-win32-x64-msvc/-/binding-win32-x64-msvc-1.2.15.tgz", - "integrity": "sha512-HFZd2QNQYn1JbIi+Hpd7H+r/lkWxcfIu28nirZ6eCn2LafuvmExMlb/P96Sfx5tf7pPArw39IdhmCF8vmV+NhQ==", + "version": "1.2.19", + "resolved": "https://registry.npmjs.org/@rolldown/binding-win32-x64-msvc/-/binding-win32-x64-msvc-1.2.19.tgz", + "integrity": "sha512-y/sqRRc6d7hECzOFc5n3LSeqctmIp9mMjY1Kq4s14uLPd/LZ4z7i1zrW6fMtp2mPeuQIC4e6ULMcwQzMomqQag==", "cpu": [ "x64" ], @@ -2486,29 +2303,29 @@ "license": "MIT" }, "node_modules/@shikijs/core": { - "version": "4.5.0", - "resolved": "https://registry.npmjs.org/@shikijs/core/-/core-4.5.0.tgz", - "integrity": "sha512-6CIgwq+bt2JZ3OSjb/nBkkwEf/CfpHcbam+Mg5Pllco7HAGRQ2/EFhZrrJtbyNTgKwknfVS+llsXGygiDGwJWw==", + "version": "4.6.0", + "resolved": "https://registry.npmjs.org/@shikijs/core/-/core-4.6.0.tgz", + "integrity": "sha512-bfd4OKgvoyXYiYmMRuleA656P4V7M/Du9lcTl38Ngm6KszMj7bq4J1IGZwSYR4c95Tv5UQALtYNWUwaI9UT3xw==", "license": "MIT", "dependencies": { - "@shikijs/primitive": "4.5.0", - "@shikijs/types": "4.5.0", - "@shikijs/vscode-textmate": "^10.0.2", + "@shikijs/primitive": "4.6.0", + "@shikijs/types": "4.6.0", + "@shikijs/vscode-textmate": "^10.1.0", "@types/hast": "^3.0.5", - "hast-util-to-html": "^9.0.5" + "hast-util-to-html": "^9.0.6" }, "engines": { "node": ">=20" } }, "node_modules/@shikijs/engine-javascript": { - "version": "4.5.0", - "resolved": "https://registry.npmjs.org/@shikijs/engine-javascript/-/engine-javascript-4.5.0.tgz", - "integrity": "sha512-Ed6UdEj84LyYkwnxM5CvSMWAD+id9ExTYri0/+x41U9zrgNifPSS9lZm0JqBP0VfYI8yr8tY5nbNq9+p9R0kFA==", + "version": "4.6.0", + "resolved": "https://registry.npmjs.org/@shikijs/engine-javascript/-/engine-javascript-4.6.0.tgz", + "integrity": "sha512-K0oqxFoL+kEMdz89mHLFO15Tsbv3kFZ6WR1cXZKMvLSc+oqaM00A6pyga1qSeXB22dP0tTiSApRcGBaKWsEccg==", "license": "MIT", "dependencies": { - "@shikijs/types": "4.5.0", - "@shikijs/vscode-textmate": "^10.0.2", + "@shikijs/types": "4.6.0", + "@shikijs/vscode-textmate": "^10.1.0", "oniguruma-to-es": "^4.3.6" }, "engines": { @@ -2516,38 +2333,38 @@ } }, "node_modules/@shikijs/engine-oniguruma": { - "version": "4.5.0", - "resolved": "https://registry.npmjs.org/@shikijs/engine-oniguruma/-/engine-oniguruma-4.5.0.tgz", - "integrity": "sha512-dKVmbJecVdB9recl8a/CU4jdpNXyjJQrIcesIkpS70s5HS02ohpnCSpMUbotPnEUzbAcLQ+S4hwZYbkBBiTcJw==", + "version": "4.6.0", + "resolved": "https://registry.npmjs.org/@shikijs/engine-oniguruma/-/engine-oniguruma-4.6.0.tgz", + "integrity": "sha512-aggd6Q7SuJOXNnsUbfG2XesxBJKBMAw/PDTUo9PyRjMaaJJ2dNrI+q0C+25ARXAK9yLHAlwxc9oRT2u68YKZ7w==", "license": "MIT", "dependencies": { - "@shikijs/types": "4.5.0", - "@shikijs/vscode-textmate": "^10.0.2" + "@shikijs/types": "4.6.0", + "@shikijs/vscode-textmate": "^10.1.0" }, "engines": { "node": ">=20" } }, "node_modules/@shikijs/langs": { - "version": "4.5.0", - "resolved": "https://registry.npmjs.org/@shikijs/langs/-/langs-4.5.0.tgz", - "integrity": "sha512-wwBTqwduXSz0X4v9Qa2EWeFaYJEw1clCncWjoRNQRbVDu3SPRTRWucnouYapKj3b8Q+sk/41Vbc4B5c8nuYzLA==", + "version": "4.6.0", + "resolved": "https://registry.npmjs.org/@shikijs/langs/-/langs-4.6.0.tgz", + "integrity": "sha512-1yMEX3oCVV54LUq/ovfpRkDQoYDkcvjSWFFa/YLUDMiSoRzMi2uxLJYbv41ahT8Lu9lFMaa7hecd3Q39trqUyg==", "license": "MIT", "dependencies": { - "@shikijs/types": "4.5.0" + "@shikijs/types": "4.6.0" }, "engines": { "node": ">=20" } }, "node_modules/@shikijs/primitive": { - "version": "4.5.0", - "resolved": "https://registry.npmjs.org/@shikijs/primitive/-/primitive-4.5.0.tgz", - "integrity": "sha512-UM7ShlA8oz0OWxLLO8BmO9Ip6fVqdkt8yF0EH7nOCqHfrx1eEAzF0ZUVK7L+I8NEgeu1PEWSRlxaiPPeCb4iDg==", + "version": "4.6.0", + "resolved": "https://registry.npmjs.org/@shikijs/primitive/-/primitive-4.6.0.tgz", + "integrity": "sha512-c54+TQEo9ToqgfL/AU8FpjnV09+GA9Oa7M5ROkkXteZfp5XzpAJGXjjvZQFQioJOwm/w/6Z3lIzQstAkl8coag==", "license": "MIT", "dependencies": { - "@shikijs/types": "4.5.0", - "@shikijs/vscode-textmate": "^10.0.2", + "@shikijs/types": "4.6.0", + "@shikijs/vscode-textmate": "^10.1.0", "@types/hast": "^3.0.5" }, "engines": { @@ -2555,24 +2372,24 @@ } }, "node_modules/@shikijs/themes": { - "version": "4.5.0", - "resolved": "https://registry.npmjs.org/@shikijs/themes/-/themes-4.5.0.tgz", - "integrity": "sha512-zGb87H3UBbpuI4yoh5UguB1XbU+2BDU3kflM7UfZ+Cy2hWo9lBtqjSVK20gmLY6ukYl040hAypGXMgud9vul8Q==", + "version": "4.6.0", + "resolved": "https://registry.npmjs.org/@shikijs/themes/-/themes-4.6.0.tgz", + "integrity": "sha512-qHAVAs80RiGD+IRuH9G+JPDOEc9A/kHsng4EzCUCwB9bLzW6Z0y9WETh2YyCcADJBmfrIaJ1Jp7KBNP6FHkgtQ==", "license": "MIT", "dependencies": { - "@shikijs/types": "4.5.0" + "@shikijs/types": "4.6.0" }, "engines": { "node": ">=20" } }, "node_modules/@shikijs/types": { - "version": "4.5.0", - "resolved": "https://registry.npmjs.org/@shikijs/types/-/types-4.5.0.tgz", - "integrity": "sha512-drtPrtD8N0DENyD2cyt6Ajy+IWsiCLgMxODwLTpvH1UsN6a9jf90tNTPjqwHvA+0Lzu9e0txk8DjfqH1p9UJRw==", + "version": "4.6.0", + "resolved": "https://registry.npmjs.org/@shikijs/types/-/types-4.6.0.tgz", + "integrity": "sha512-+ENG1adsKt/X7cRYw1Nl7BEpBmPOjmQ7bR/eGmHuMlT8gtOFf3KEi5l31DJYyAWhW6Y6bjP1plU7FmaxWGENFw==", "license": "MIT", "dependencies": { - "@shikijs/vscode-textmate": "^10.0.2", + "@shikijs/vscode-textmate": "^10.1.0", "@types/hast": "^3.0.5" }, "engines": { @@ -2580,9 +2397,9 @@ } }, "node_modules/@shikijs/vscode-textmate": { - "version": "10.0.2", - "resolved": "https://registry.npmjs.org/@shikijs/vscode-textmate/-/vscode-textmate-10.0.2.tgz", - "integrity": "sha512-83yeghZ2xxin3Nj8z1NMd/NCuca+gsYXswywDy5bHvwlWL8tpTQmzGeUuHd9FC3E/SBEMvzJRwWEOz5gGes9Qg==", + "version": "10.1.0", + "resolved": "https://registry.npmjs.org/@shikijs/vscode-textmate/-/vscode-textmate-10.1.0.tgz", + "integrity": "sha512-cVBuhDQjBZaNMTwBquYfPydrUP+E3hE6oYGasx8h6ZrODIM7/r+gxLDXdd66oszbrggZHEntdE6j+5gYIVyMWQ==", "license": "MIT" }, "node_modules/@shuding/opentype.js": { @@ -3027,9 +2844,9 @@ } }, "node_modules/am-i-vibing": { - "version": "0.4.0", - "resolved": "https://registry.npmjs.org/am-i-vibing/-/am-i-vibing-0.4.0.tgz", - "integrity": "sha512-MxT4XZL7pzLHpuvhDKdMaQHMGGkJDLluKBLsbstn+8wv9sWcFT6h+0ve9qkml95amVTZtZV83gQe2hY+ojgHLg==", + "version": "0.5.0", + "resolved": "https://registry.npmjs.org/am-i-vibing/-/am-i-vibing-0.5.0.tgz", + "integrity": "sha512-KLcsDhqf1XRrJmJr+9I/C0EX2K+sGrAGZFgkmd84c8TJO9zJBu+/kFInjazu1KfJWFhWDKdRWkpBzEs7s35DVA==", "license": "MIT", "dependencies": { "process-ancestry": "^0.1.0" @@ -3121,70 +2938,69 @@ } }, "node_modules/astro": { - "version": "7.3.5", - "resolved": "https://registry.npmjs.org/astro/-/astro-7.3.5.tgz", - "integrity": "sha512-1p/ernaq/RuESbM5NMjWzbO6SiebMGrGcYlGjMfBhzzgM+n/X7AUmVyw8BqW2QYCdivpsHwJBcD1fqmlTZjZHg==", - "license": "MIT", - "dependencies": { - "@astrojs/compiler-rs": "^0.5.0", - "@astrojs/internal-helpers": "0.11.0", - "@astrojs/markdown-satteri": "0.4.2", - "@astrojs/telemetry": "3.3.3", - "@capsizecss/unpack": "^4.0.0", - "@clack/prompts": "^1.1.0", + "version": "7.4.12", + "resolved": "https://registry.npmjs.org/astro/-/astro-7.4.12.tgz", + "integrity": "sha512-DKX+Ds0rqV49HrLwEB9JFrCyfvQeC16FCe1HrPK8S3osiJH/e2vQ22CHIDOpI48UaeiPbxPT26peXgGTy6w0ig==", + "license": "MIT", + "dependencies": { + "@astrojs/compiler-rs": "^0.5.2", + "@astrojs/internal-helpers": "^0.13.2", + "@astrojs/markdown-satteri": "^0.4.10", + "@astrojs/runtime": "^0.1.1", + "@astrojs/telemetry": "^3.4.2", + "@astrojs/vite-plugin-astro": "^0.1.3", + "@capsizecss/unpack": "^4.0.1", + "@clack/prompts": "^1.8.1", "@oslojs/encoding": "^1.1.0", - "am-i-vibing": "^0.4.0", + "am-i-vibing": "^0.5.0", "aria-query": "^5.3.2", "axobject-query": "^4.1.0", "ci-info": "^4.4.0", - "clsx": "^2.1.1", - "common-ancestor-path": "^2.0.0", - "cookie": "^2.0.1", - "devalue": "^5.8.1", + "cookie": "^2.0.2", + "devalue": "^6.0.3", "diff": "^9.0.0", "dset": "^3.1.4", - "es-module-lexer": "^2.0.0", - "esbuild": "^0.28.0", - "find-proc": "0.2.0", + "es-module-lexer": "^3.0.4", "flattie": "^1.1.1", "fontace": "~0.4.1", - "get-tsconfig": "5.0.0-beta.4", + "get-tsconfig": "5.0.0-beta.6", "github-slugger": "^2.0.0", "html-escaper": "3.0.3", - "http-cache-semantics": "^4.2.0", - "js-yaml": "^4.3.2", + "http-cache-semantics": "^4.3.0", "jsonc-parser": "^3.3.1", - "magic-string": "^1.0.0", - "magicast": "^0.5.2", + "magic-string": "^1.4.5", + "magicast": "^0.5.5", + "mri": "^1.2.0", "mrmime": "^2.0.1", "neotraverse": "^1.0.1", "obug": "^3.0.0", - "p-limit": "^7.3.0", - "p-queue": "^9.1.0", - "package-manager-detector": "^1.6.0", + "p-limit": "^7.3.3", + "p-queue": "^10.0.0", + "package-manager-detector": "^1.9.0", "piccolore": "^0.1.3", - "picomatch": "^4.0.4", - "shiki": "^4.0.2", - "smol-toml": "^1.8.0", + "picomatch": "^4.0.7", + "rolldown": "~1.2.16", + "shiki": "^4.6.0", + "smol-toml": "^1.9.1", "svgo": "^4.1.0", - "tinyclip": "^1.0.1", - "tinyexec": "^1.0.4", - "tinyglobby": "^0.2.15", - "ultrahtml": "^1.6.0", - "unifont": "~0.7.5", - "unstorage": "^1.17.5", - "verkit": "^0.4.0", - "vite": "^8.0.13", - "vitefu": "^1.1.2", + "tinyclip": "^1.0.3", + "tinyexec": "^1.3.1", + "tinyglobby": "^0.2.17", + "tinyps": "^0.5.1", + "ultrahtml": "^1.7.0", + "unifont": "^1.0.3", + "unstorage": "^1.17.6", + "verkit": "^0.5.0", + "vite": "^8.3.6", + "vitefu": "^1.1.3", "xxhash-wasm": "^1.1.0", - "yargs-parser": "^22.0.0", - "zod": "^4.5.4" + "zod": "^4.6.7" }, "bin": { "astro": "bin/astro.mjs" }, "engines": { - "node": ">=22.12.0", + "node": ">=22.23.4", "npm": ">=9.6.5", "pnpm": ">=7.1.0" }, @@ -3204,10 +3020,26 @@ } } }, + "node_modules/astro/node_modules/@astrojs/internal-helpers": { + "version": "0.13.2", + "resolved": "https://registry.npmjs.org/@astrojs/internal-helpers/-/internal-helpers-0.13.2.tgz", + "integrity": "sha512-SWiNS+OMrhwWYzJENTekHUyUCMKB+tdU6D4v1ZNIU1ZHh2mScQ8WIs0J6AJ8KPXkIrs9+EZU7Rm2CstfThyVnw==", + "license": "MIT", + "dependencies": { + "@types/hast": "^3.0.5", + "@types/mdast": "^4.0.4", + "picomatch": "^4.0.7", + "retext-smartypants": "^6.2.0", + "shiki": "^4.6.0", + "smol-toml": "^1.9.1", + "unified": "^11.0.5", + "yaml": "^2.9.1" + } + }, "node_modules/astro/node_modules/cookie": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/cookie/-/cookie-2.0.1.tgz", - "integrity": "sha512-yuToqVvRrj6pfDXREyQAAv8SkAEk/8GS3jQRTiUMm66TVtBYmqQeoEjL2Lmq8Rpo6271vH76InTChTitEAm65w==", + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/cookie/-/cookie-2.0.2.tgz", + "integrity": "sha512-SL0cVuEdETEp7pN0FuZb01toc3vnODEfVUCooxG1SJN0yIirh7JMb9X9bvfCFf0vzzbT68RdbKDHYTiWy7a7iw==", "license": "MIT", "engines": { "node": ">=22" @@ -3217,6 +3049,21 @@ "url": "https://opencollective.com/express" } }, + "node_modules/astro/node_modules/devalue": { + "version": "6.0.3", + "resolved": "https://registry.npmjs.org/devalue/-/devalue-6.0.3.tgz", + "integrity": "sha512-3woMEITftG1wKeO/4d/QXH1DVKctTSZg3jNGPpjp9hNr5Hos8MCFF5McTML5ZtgKDObm2R591B0spRp2IVernA==", + "license": "MIT", + "engines": { + "node": ">=18" + } + }, + "node_modules/astro/node_modules/es-module-lexer": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/es-module-lexer/-/es-module-lexer-3.0.4.tgz", + "integrity": "sha512-BldNY5mwkVu+cQ5Ymn3e6hB9Sx8XHx4ZevWbiUyZbfKxJxYO27Hf0wfzkxIaD5CAJMaGl3YspKELj0ff/7nCMA==", + "license": "MIT" + }, "node_modules/astro/node_modules/jsonc-parser": { "version": "3.3.1", "resolved": "https://registry.npmjs.org/jsonc-parser/-/jsonc-parser-3.3.1.tgz", @@ -3224,9 +3071,9 @@ "license": "MIT" }, "node_modules/astro/node_modules/magic-string": { - "version": "1.4.2", - "resolved": "https://registry.npmjs.org/magic-string/-/magic-string-1.4.2.tgz", - "integrity": "sha512-vG+rjFRj1PqdIBozIxAGMjPlOhaVe+GXpbttY/iSK7rGcJRMlwNJO7dcUwmUqkymsFLJiNGI06t4D7Fr7yRC9g==", + "version": "1.4.5", + "resolved": "https://registry.npmjs.org/magic-string/-/magic-string-1.4.5.tgz", + "integrity": "sha512-oLLC2+YvQUfAa+vxoufE/yc1icb87M9iXIRqAoR/2EhE/8cb3SF/+Gi0c2By1B+5Vz2e2vQtUvHiu1+63Znh+w==", "license": "MIT", "dependencies": { "@jridgewell/sourcemap-codec": "^1.6.0" @@ -3245,15 +3092,6 @@ "node": ">=12.20.0" } }, - "node_modules/astro/node_modules/zod": { - "version": "4.6.7", - "resolved": "https://registry.npmjs.org/zod/-/zod-4.6.7.tgz", - "integrity": "sha512-g8W2D2kU6a8untc053fX1uVBKzM7yqAxW/3zwk83+6RyF2+SKOuV+c0wBDhUwzV1PaGapmZH+rmcUzPf+3CGwg==", - "license": "MIT", - "funding": { - "url": "https://github.com/sponsors/colinhacks" - } - }, "node_modules/axobject-query": { "version": "4.1.0", "resolved": "https://registry.npmjs.org/axobject-query/-/axobject-query-4.1.0.tgz", @@ -3359,9 +3197,9 @@ } }, "node_modules/ci-info": { - "version": "4.4.0", - "resolved": "https://registry.npmjs.org/ci-info/-/ci-info-4.4.0.tgz", - "integrity": "sha512-77PSwercCZU2Fc4sX94eF8k8Pxte6JAwL4/ICZLFjJLqegs7kCuAsqqj/70NQF6TvDpgFjkubQB2FW2ZZddvQg==", + "version": "4.5.0", + "resolved": "https://registry.npmjs.org/ci-info/-/ci-info-4.5.0.tgz", + "integrity": "sha512-d1uM8k5UZEyPza1n/MG3ko8nKupKN0KJpFsipgPcgaCCvV+IqIfJ+NzTjetlLM+UcXZx3+cLrNr76+eAO7G1Mw==", "funding": [ { "type": "github", @@ -3775,49 +3613,9 @@ "version": "2.3.2", "resolved": "https://registry.npmjs.org/es-module-lexer/-/es-module-lexer-2.3.2.tgz", "integrity": "sha512-poHGpORABojJJucnV9KbOavETW8lBVnphkW77ER5/BQ5Fz7oXSoCNek7IH3vR5nRjdsEz926ibFYX8KtLQmdyw==", + "dev": true, "license": "MIT" }, - "node_modules/esbuild": { - "version": "0.28.2", - "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.28.2.tgz", - "integrity": "sha512-HKVLS8dvII+xoKW9kmqxbRKrnWEXfJJr/FZhhJmiqIB0e053QNYFqOBouTMO/k5sID4MvCiUCvv8b9M4h32wIA==", - "hasInstallScript": true, - "license": "MIT", - "bin": { - "esbuild": "bin/esbuild" - }, - "engines": { - "node": ">=18" - }, - "optionalDependencies": { - "@esbuild/aix-ppc64": "0.28.2", - "@esbuild/android-arm": "0.28.2", - "@esbuild/android-arm64": "0.28.2", - "@esbuild/android-x64": "0.28.2", - "@esbuild/darwin-arm64": "0.28.2", - "@esbuild/darwin-x64": "0.28.2", - "@esbuild/freebsd-arm64": "0.28.2", - "@esbuild/freebsd-x64": "0.28.2", - "@esbuild/linux-arm": "0.28.2", - "@esbuild/linux-arm64": "0.28.2", - "@esbuild/linux-ia32": "0.28.2", - "@esbuild/linux-loong64": "0.28.2", - "@esbuild/linux-mips64el": "0.28.2", - "@esbuild/linux-ppc64": "0.28.2", - "@esbuild/linux-riscv64": "0.28.2", - "@esbuild/linux-s390x": "0.28.2", - "@esbuild/linux-x64": "0.28.2", - "@esbuild/netbsd-arm64": "0.28.2", - "@esbuild/netbsd-x64": "0.28.2", - "@esbuild/openbsd-arm64": "0.28.2", - "@esbuild/openbsd-x64": "0.28.2", - "@esbuild/openharmony-arm64": "0.28.2", - "@esbuild/sunos-x64": "0.28.2", - "@esbuild/win32-arm64": "0.28.2", - "@esbuild/win32-ia32": "0.28.2", - "@esbuild/win32-x64": "0.28.2" - } - }, "node_modules/escalade": { "version": "3.2.0", "resolved": "https://registry.npmjs.org/escalade/-/escalade-3.2.0.tgz", @@ -3844,12 +3642,6 @@ "@types/estree": "^1.0.0" } }, - "node_modules/eventemitter3": { - "version": "5.0.4", - "resolved": "https://registry.npmjs.org/eventemitter3/-/eventemitter3-5.0.4.tgz", - "integrity": "sha512-mlsTRyGaPBjPedk6Bvw+aqbsXDtoAyAzm5MO7JgU+yVRyMQ5O8bD4Kcci7BS85f93veegeCPkL8R4GLClnjLFw==", - "license": "MIT" - }, "node_modules/expect-type": { "version": "1.3.0", "resolved": "https://registry.npmjs.org/expect-type/-/expect-type-1.3.0.tgz", @@ -3937,15 +3729,6 @@ "integrity": "sha512-QieYf//cis6ywHNi5qW1+PXPQ4bC+XVJAtS4AXIML8P76GroEiOxm/oQtn1f02UkJY1+KsXMJcC+R2v/Eg4G3g==", "license": "MIT" }, - "node_modules/find-proc": { - "version": "0.2.0", - "resolved": "https://registry.npmjs.org/find-proc/-/find-proc-0.2.0.tgz", - "integrity": "sha512-a6h2nTrgB3g5Wrn4au9Ux4kMk7IJtyF6oA8uGn+mk3weLZssUtc1cp6meHIzzuW2o1srrBAxzkmXLbqjRkgB6w==", - "license": "MIT", - "engines": { - "node": "^20.19.0 || >=22.12.0" - } - }, "node_modules/flattie": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/flattie/-/flattie-1.1.1.tgz", @@ -3955,6 +3738,12 @@ "node": ">=8" } }, + "node_modules/fnv1a-64": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/fnv1a-64/-/fnv1a-64-0.1.2.tgz", + "integrity": "sha512-mJbcILTPybAR1jdOwt/lVv8N2cffeJFFP+gVbSAwLEx1ujXH27RpPd8Rokec/KX9c76UYIB6Co+H4lQzxPnJfA==", + "license": "MIT" + }, "node_modules/fontace": { "version": "0.4.1", "resolved": "https://registry.npmjs.org/fontace/-/fontace-0.4.1.tgz", @@ -4014,9 +3803,9 @@ } }, "node_modules/get-tsconfig": { - "version": "5.0.0-beta.4", - "resolved": "https://registry.npmjs.org/get-tsconfig/-/get-tsconfig-5.0.0-beta.4.tgz", - "integrity": "sha512-7nF7C9fIPFEMHgEMEfgIlO9wDdZ8CyHw27rWciFZfHvHDReIiPhsYuzPRXsfvBCqFy1l8RRyyWV7QLM+ZhUJsQ==", + "version": "5.0.0-beta.6", + "resolved": "https://registry.npmjs.org/get-tsconfig/-/get-tsconfig-5.0.0-beta.6.tgz", + "integrity": "sha512-X6fBC0pmImC70gvX2zm56go9hx0MyoGVdG0tUCkg/D+Xnh5TJsOZ7iDbOdI3PvmtrDxnu1YdDufpK2QJX1Meqw==", "license": "MIT", "dependencies": { "resolve-pkg-maps": "^1.0.0" @@ -4052,9 +3841,9 @@ } }, "node_modules/hast-util-to-html": { - "version": "9.0.5", - "resolved": "https://registry.npmjs.org/hast-util-to-html/-/hast-util-to-html-9.0.5.tgz", - "integrity": "sha512-OguPdidb+fbHQSU4Q4ZiLKnzWo8Wwsf5bZfbvu7//a9oTYoqD/fWpe96NuHkoS9h0ccGOTe0C4NGXdtS0iObOw==", + "version": "9.0.6", + "resolved": "https://registry.npmjs.org/hast-util-to-html/-/hast-util-to-html-9.0.6.tgz", + "integrity": "sha512-1SZUxCN3TtJAE7e2BQN2MBHsoZ1gnmi9GoCP5Di59CSWptIezSAW09yDZyVbanb78V9eCwrKqdQsjtfVTxYHWA==", "license": "MIT", "dependencies": { "@types/hast": "^3.0.0", @@ -4116,9 +3905,9 @@ } }, "node_modules/http-cache-semantics": { - "version": "4.2.0", - "resolved": "https://registry.npmjs.org/http-cache-semantics/-/http-cache-semantics-4.2.0.tgz", - "integrity": "sha512-dTxcvPXqPvXBQpq5dUr6mEMJX4oIEFv6bwom3FDwKRDsuIjjJGANqhBuoAn9c1RQJIdAKav33ED65E2ys+87QQ==", + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/http-cache-semantics/-/http-cache-semantics-4.3.0.tgz", + "integrity": "sha512-M5t5LlJpS1UHMjvwRQVdFHvPISGeLAxNcrWuJkeGh0KxsqCHZ1O3NXZU/8x7cD0BDcGW8kapxMKTvwlqrNkHkA==", "license": "BSD-2-Clause" }, "node_modules/iron-webcrypto": { @@ -4483,9 +4272,9 @@ } }, "node_modules/mdast-util-to-hast": { - "version": "13.2.1", - "resolved": "https://registry.npmjs.org/mdast-util-to-hast/-/mdast-util-to-hast-13.2.1.tgz", - "integrity": "sha512-cctsq2wp5vTsLIcaymblUriiTcZd0CwWtCbLvrOzYCDZoWyMNV8sZ7krj09FSnsiJi3WVsHLM4k6Dq/yaPyCXA==", + "version": "13.2.2", + "resolved": "https://registry.npmjs.org/mdast-util-to-hast/-/mdast-util-to-hast-13.2.2.tgz", + "integrity": "sha512-l2pnmOuqs+SGLVpTVXnRLQu5v1AzvDe181404fbXzzqObVxrAnnVxapAP27pUwzLBL/ABIkgUhGlPVU7QSvIFg==", "license": "MIT", "dependencies": { "@types/hast": "^3.0.0", @@ -4624,6 +4413,15 @@ "node": ">=20.18.1" } }, + "node_modules/mri": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/mri/-/mri-1.2.0.tgz", + "integrity": "sha512-tzzskb3bG8LvYGFF/mDTpq3jpI6Q9wc3LEmBaghu+DdCssd1FakN7Bc0hVNmEyGq1bq3RgfkCb3cmQLpNPOroA==", + "license": "MIT", + "engines": { + "node": ">=4" + } + }, "node_modules/mrmime": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/mrmime/-/mrmime-2.0.1.tgz", @@ -4738,12 +4536,6 @@ "ufo": "^1.6.1" } }, - "node_modules/ohash": { - "version": "2.0.12", - "resolved": "https://registry.npmjs.org/ohash/-/ohash-2.0.12.tgz", - "integrity": "sha512-65S/5gk9YSsaRjcyf7Nfa6h/d3E8/1gslpXfI4W7Dxn/oap8IKRuNT5VXkLQ1YFKIEg4apRY4Pj6aiwFzrDdmw==", - "license": "MIT" - }, "node_modules/oniguruma-parser": { "version": "0.12.2", "resolved": "https://registry.npmjs.org/oniguruma-parser/-/oniguruma-parser-0.12.2.tgz", @@ -4777,37 +4569,21 @@ } }, "node_modules/p-queue": { - "version": "9.3.3", - "resolved": "https://registry.npmjs.org/p-queue/-/p-queue-9.3.3.tgz", - "integrity": "sha512-NXAOdnEe5FsZJfT4oK84lE1Y5cFFdWlRuOo5tww8DyNMxyRXwn39fIkUtNLKppcPC+UYU/bXujNCUGDv01y7CA==", - "license": "MIT", - "dependencies": { - "eventemitter3": "^5.0.4", - "p-timeout": "^7.0.0" - }, - "engines": { - "node": ">=20" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/p-timeout": { - "version": "7.0.2", - "resolved": "https://registry.npmjs.org/p-timeout/-/p-timeout-7.0.2.tgz", - "integrity": "sha512-prbX4Z3YszrFNgH+MW5Zoeq3baXrMtP/MQnFeET90UB/GtGcGDQ5Usg9OCy6ETjTTntOw1SL2z9fMPUppN3Guw==", + "version": "10.0.0", + "resolved": "https://registry.npmjs.org/p-queue/-/p-queue-10.0.0.tgz", + "integrity": "sha512-P2wrCri3bhGLPo3kX7qYVXbo/5GvaVATU0DpO24CbeT53Y4z35t8JUWku04ERpXHUYB5rPMi3TkWE3fmJgx5rA==", "license": "MIT", "engines": { - "node": ">=20" + "node": ">=22" }, "funding": { "url": "https://github.com/sponsors/sindresorhus" } }, "node_modules/package-manager-detector": { - "version": "1.8.0", - "resolved": "https://registry.npmjs.org/package-manager-detector/-/package-manager-detector-1.8.0.tgz", - "integrity": "sha512-yQA4H19AmPEoMUeavPMDIe1higySl/gH/yaQrkT/s07Qp+7pp2hYz30N3z2l5BkjVkF9Ow6o0wjJamm2y7Sn0A==", + "version": "1.9.0", + "resolved": "https://registry.npmjs.org/package-manager-detector/-/package-manager-detector-1.9.0.tgz", + "integrity": "sha512-zAMfbta9nPA8AKkA4WdmNAT8R8s6Dk0/xwPsqNnRidMFcLo1YkLuPDTgs2f64XdzS8vbLNnoJ+uUIkgbz7oRHA==", "license": "MIT" }, "node_modules/pako": { @@ -4870,9 +4646,9 @@ } }, "node_modules/postcss": { - "version": "8.5.31", - "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.5.31.tgz", - "integrity": "sha512-YUbWYCgErwnMAVkjUnYa+KlMBzGpHwiIt/DE7f0G33AuX2LH9UcTk6KgWxd3zRU+pN3u/C+Xl3EnMLM4Hea7Sg==", + "version": "8.5.33", + "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.5.33.tgz", + "integrity": "sha512-RVHEU9/Pp1Fnjr/MpAJsZoADukCKhfIi15OunEYiGktIkYLkPVvC1sioWolGDS7XByMTx9m/IGbro0Js13zhnQ==", "funding": [ { "type": "opencollective", @@ -5053,12 +4829,12 @@ } }, "node_modules/rolldown": { - "version": "1.2.15", - "resolved": "https://registry.npmjs.org/rolldown/-/rolldown-1.2.15.tgz", - "integrity": "sha512-6odND+fel5zVw3I4Yc2e69gvguDnX0CAAGiNDZSq4ik5WUcaLrkD2GLuog0XcODbor31hZ5ayEMgVDno+KPV5g==", + "version": "1.2.19", + "resolved": "https://registry.npmjs.org/rolldown/-/rolldown-1.2.19.tgz", + "integrity": "sha512-QIiV1J9d0pzN4jeeTH4sjPy0AZ6cAy2cG0ExeoE1+U8Rvj+hR3gYkokx0YbeUNGlZqiQJJ2utcETe0oKXwzsuA==", "license": "MIT", "dependencies": { - "@oxc-project/types": "=0.155.0", + "@oxc-project/types": "=0.156.0", "@rolldown/pluginutils": "^1.0.0" }, "bin": { @@ -5068,21 +4844,22 @@ "node": "^20.19.0 || >=22.12.0" }, "optionalDependencies": { - "@rolldown/binding-android-arm-eabi": "1.2.15", - "@rolldown/binding-android-arm64": "1.2.15", - "@rolldown/binding-darwin-arm64": "1.2.15", - "@rolldown/binding-darwin-x64": "1.2.15", - "@rolldown/binding-freebsd-x64": "1.2.15", - "@rolldown/binding-linux-arm-gnueabihf": "1.2.15", - "@rolldown/binding-linux-arm64-gnu": "1.2.15", - "@rolldown/binding-linux-arm64-musl": "1.2.15", - "@rolldown/binding-linux-ppc64-gnu": "1.2.15", - "@rolldown/binding-linux-s390x-gnu": "1.2.15", - "@rolldown/binding-linux-x64-gnu": "1.2.15", - "@rolldown/binding-linux-x64-musl": "1.2.15", - "@rolldown/binding-openharmony-arm64": "1.2.15", - "@rolldown/binding-win32-arm64-msvc": "1.2.15", - "@rolldown/binding-win32-x64-msvc": "1.2.15" + "@rolldown/binding-android-arm-eabi": "1.2.19", + "@rolldown/binding-android-arm64": "1.2.19", + "@rolldown/binding-darwin-arm64": "1.2.19", + "@rolldown/binding-darwin-x64": "1.2.19", + "@rolldown/binding-freebsd-x64": "1.2.19", + "@rolldown/binding-linux-arm-gnueabihf": "1.2.19", + "@rolldown/binding-linux-arm64-gnu": "1.2.19", + "@rolldown/binding-linux-arm64-musl": "1.2.19", + "@rolldown/binding-linux-ppc64-gnu": "1.2.19", + "@rolldown/binding-linux-s390x-gnu": "1.2.19", + "@rolldown/binding-linux-x64-gnu": "1.2.19", + "@rolldown/binding-linux-x64-musl": "1.2.19", + "@rolldown/binding-openharmony-arm64": "1.2.19", + "@rolldown/binding-wasm32-wasi": "1.2.19", + "@rolldown/binding-win32-arm64-msvc": "1.2.19", + "@rolldown/binding-win32-x64-msvc": "1.2.19" } }, "node_modules/satori": { @@ -5108,9 +4885,9 @@ } }, "node_modules/satteri": { - "version": "0.10.5", - "resolved": "https://registry.npmjs.org/satteri/-/satteri-0.10.5.tgz", - "integrity": "sha512-Ao1LKpAEa9Wdg0otgbVKViZHEq9ebdXe4DMrp3s9vQAU0HNIuHnFEuMuOcm0ZIXyV0Yzxj91NvhLpvXZJO/5ZQ==", + "version": "0.11.7", + "resolved": "https://registry.npmjs.org/satteri/-/satteri-0.11.7.tgz", + "integrity": "sha512-xDOSxkc1ew3z3IovIjmsqJaVHRXTGYJkPvx0LL/U6o90km8kSU+pmrZVvnWd5creJeE0UnvMEienlkPuYQdJaA==", "license": "MIT", "dependencies": { "@types/estree-jsx": "^1.0.5", @@ -5119,15 +4896,17 @@ "@types/unist": "^3.0.3" }, "optionalDependencies": { - "@bruits/satteri-darwin-arm64": "0.10.5", - "@bruits/satteri-darwin-x64": "0.10.5", - "@bruits/satteri-linux-arm64-gnu": "0.10.5", - "@bruits/satteri-linux-arm64-musl": "0.10.5", - "@bruits/satteri-linux-x64-gnu": "0.10.5", - "@bruits/satteri-linux-x64-musl": "0.10.5", - "@bruits/satteri-wasm32-wasi": "0.10.5", - "@bruits/satteri-win32-arm64-msvc": "0.10.5", - "@bruits/satteri-win32-x64-msvc": "0.10.5" + "@bruits/satteri-android-arm64": "0.11.7", + "@bruits/satteri-darwin-arm64": "0.11.7", + "@bruits/satteri-darwin-x64": "0.11.7", + "@bruits/satteri-freebsd-x64": "0.11.7", + "@bruits/satteri-linux-arm64-gnu": "0.11.7", + "@bruits/satteri-linux-arm64-musl": "0.11.7", + "@bruits/satteri-linux-x64-gnu": "0.11.7", + "@bruits/satteri-linux-x64-musl": "0.11.7", + "@bruits/satteri-wasm32-wasi": "0.11.7", + "@bruits/satteri-win32-arm64-msvc": "0.11.7", + "@bruits/satteri-win32-x64-msvc": "0.11.7" } }, "node_modules/sax": { @@ -5207,18 +4986,18 @@ } }, "node_modules/shiki": { - "version": "4.5.0", - "resolved": "https://registry.npmjs.org/shiki/-/shiki-4.5.0.tgz", - "integrity": "sha512-OcRW72ngQvc+MSVWBRIovC/BTW589iUE/Vxav7VeM4RcY9MUjqB+IR6ILG1k9nuW6LiG/nct9uma4/MBtnZbmQ==", - "license": "MIT", - "dependencies": { - "@shikijs/core": "4.5.0", - "@shikijs/engine-javascript": "4.5.0", - "@shikijs/engine-oniguruma": "4.5.0", - "@shikijs/langs": "4.5.0", - "@shikijs/themes": "4.5.0", - "@shikijs/types": "4.5.0", - "@shikijs/vscode-textmate": "^10.0.2", + "version": "4.6.0", + "resolved": "https://registry.npmjs.org/shiki/-/shiki-4.6.0.tgz", + "integrity": "sha512-imjLsVHgPuWhvpU3P+zOekvMYqnel7QmKsFC4Sn0fCuAvaaalBsxwKEsrU8Ko5BdFnZA6Go/8a0RzahS634UgA==", + "license": "MIT", + "dependencies": { + "@shikijs/core": "4.6.0", + "@shikijs/engine-javascript": "4.6.0", + "@shikijs/engine-oniguruma": "4.6.0", + "@shikijs/langs": "4.6.0", + "@shikijs/themes": "4.6.0", + "@shikijs/types": "4.6.0", + "@shikijs/vscode-textmate": "^10.1.0", "@types/hast": "^3.0.5" }, "engines": { @@ -5273,9 +5052,9 @@ "license": "MIT" }, "node_modules/smol-toml": { - "version": "1.9.0", - "resolved": "https://registry.npmjs.org/smol-toml/-/smol-toml-1.9.0.tgz", - "integrity": "sha512-hpd+HLON7HdZXqYchMM/+LaTTbdK0AU3NngIJ4KVyWbY9bfQqdL9cD+4yf6dUoU2Ap4VsU0JkQi6FxAI1B2mXQ==", + "version": "1.9.1", + "resolved": "https://registry.npmjs.org/smol-toml/-/smol-toml-1.9.1.tgz", + "integrity": "sha512-j7WyPdf0CJoutMzMoPLF/bVXHtKZIT9Rb4eGeEbWw8X2t5oirjPgpL+OpaENZrILYaXqYwnVH+qgUwVbl+pUJQ==", "license": "BSD-3-Clause", "engines": { "node": ">= 18" @@ -5314,7 +5093,6 @@ "version": "4.3.0", "resolved": "https://registry.npmjs.org/std-env/-/std-env-4.3.0.tgz", "integrity": "sha512-OtU/EgQ1kIm5KwqQpBC6ZEMXrZRui11w8zgfTWp8cdO9B8OaPsbA8bTHO2P+HNo1VlUTGMVBwPhydu6poeXiag==", - "dev": true, "license": "MIT" }, "node_modules/string-width": { @@ -5454,6 +5232,12 @@ "url": "https://github.com/sponsors/SuperchupuDev" } }, + "node_modules/tinyps": { + "version": "0.5.2", + "resolved": "https://registry.npmjs.org/tinyps/-/tinyps-0.5.2.tgz", + "integrity": "sha512-sYhvdbpuo2rGE7u/jPUMiZz4H2LCaOodUtRD9ot4DLNFQbr884g9zozoJnxLI+1r4hXqWkmdHUl8Yig2Rllxxw==", + "license": "MIT" + }, "node_modules/tinyrainbow": { "version": "3.2.0", "resolved": "https://registry.npmjs.org/tinyrainbow/-/tinyrainbow-3.2.0.tgz", @@ -5541,9 +5325,9 @@ "license": "MIT" }, "node_modules/undici": { - "version": "8.12.3", - "resolved": "https://registry.npmjs.org/undici/-/undici-8.12.3.tgz", - "integrity": "sha512-+fdndUTwBP86cVjihTp21hZHo7d6oj1c/47XPA3lL8mM0XHs+C4EkcjmgRsFnFk2f/UONGDy9ItBItmXsLOQHw==", + "version": "8.12.4", + "resolved": "https://registry.npmjs.org/undici/-/undici-8.12.4.tgz", + "integrity": "sha512-8Mx+uNKKER2bA4AdtedkqRbwUCIJFr2nJckXRe5yrDqzePqwLP7VNcctN8/XdmDSbF7mS+jJKIszlL+vbam1VA==", "license": "MIT", "engines": { "node": ">=22.19.0" @@ -5594,13 +5378,14 @@ } }, "node_modules/unifont": { - "version": "0.7.5", - "resolved": "https://registry.npmjs.org/unifont/-/unifont-0.7.5.tgz", - "integrity": "sha512-ULe/Cs+ZIsq+dcFofNkhqielCrUJnb5mr+Yc4EBM2VlL+6OZR6+cjtI2mT1bJvRBrVncqHAbLURxmPLcCXzWMg==", + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/unifont/-/unifont-1.0.3.tgz", + "integrity": "sha512-XGnEwj5sWdCbiBX01mWLSBncS0yMRjnLygau3IfdOlfjMacNIQvTGW4VH7pWBq+gGWArfSef/CensMLjMmIr/A==", "license": "MIT", "dependencies": { "css-tree": "^3.1.0", - "ohash": "^2.0.11", + "fnv1a-64": "^0.1.2", + "std-env": "^4.2.0", "undici": "^8.0.0" } }, @@ -5673,19 +5458,19 @@ } }, "node_modules/unstorage": { - "version": "1.17.5", - "resolved": "https://registry.npmjs.org/unstorage/-/unstorage-1.17.5.tgz", - "integrity": "sha512-0i3iqvRfx29hkNntHyQvJTpf5W9dQ9ZadSoRU8+xVlhVtT7jAX57fazYO9EHvcRCfBCyi5YRya7XCDOsbTgkPg==", + "version": "1.17.6", + "resolved": "https://registry.npmjs.org/unstorage/-/unstorage-1.17.6.tgz", + "integrity": "sha512-gjKtcmn/KwZuJZO9o2sc0esAQnhmTw0LviDHwevTXbJMYs0dRTp8ZEEWXHU0vTpzbN3cA0yxlTeyXssMp3zDqw==", "license": "MIT", "dependencies": { "anymatch": "^3.1.3", "chokidar": "^5.0.0", "destr": "^2.0.5", - "h3": "^1.15.10", - "lru-cache": "^11.2.7", + "h3": "^1.15.11", + "lru-cache": "^11.5.3", "node-fetch-native": "^1.6.7", "ofetch": "^1.5.1", - "ufo": "^1.6.3" + "ufo": "^1.6.4" }, "peerDependencies": { "@azure/app-configuration": "^1.8.0", @@ -5696,7 +5481,7 @@ "@azure/storage-blob": "^12.26.0", "@capacitor/preferences": "^6 || ^7 || ^8", "@deno/kv": ">=0.9.0", - "@netlify/blobs": "^6.5.0 || ^7.0.0 || ^8.1.0 || ^9.0.0 || ^10.0.0", + "@netlify/blobs": "^6.5.0 || ^7.0.0 || ^8.1.0 || ^9.0.0 || ^10.0.0 || ^11.0.0", "@planetscale/database": "^1.19.0", "@upstash/redis": "^1.34.3", "@vercel/blob": ">=0.27.1", @@ -5769,9 +5554,9 @@ } }, "node_modules/verkit": { - "version": "0.4.1", - "resolved": "https://registry.npmjs.org/verkit/-/verkit-0.4.1.tgz", - "integrity": "sha512-mMVzj0TXExtVdlDEq+Mzp0eyOuyznNpFobNM3uAqe3HVm/Ps2c+u17BligMkZjZCA6EiXpoon8iRTer3iu40SQ==", + "version": "0.5.0", + "resolved": "https://registry.npmjs.org/verkit/-/verkit-0.5.0.tgz", + "integrity": "sha512-u4J1hr6Y+C/hit34GwL3eIcUf3wngT8TlYUjK7tk0jxydKLAq3sYvifjdTDA6U3KCKRcQCQDGf/srjxfZF3l7g==", "license": "MIT", "engines": { "node": ">=18.12.0" @@ -5809,15 +5594,15 @@ } }, "node_modules/vite": { - "version": "8.3.5", - "resolved": "https://registry.npmjs.org/vite/-/vite-8.3.5.tgz", - "integrity": "sha512-z1YpjieJ9g0ebTmQpLBv/oq9E3F9EIlOe+7LahW8SrE3LTiG3udBRUXQOlYXP9b+IC2q2phHeVxj9xGlw34OEQ==", + "version": "8.3.8", + "resolved": "https://registry.npmjs.org/vite/-/vite-8.3.8.tgz", + "integrity": "sha512-LzOn3h9rG/0vhLdXrV4yJ4QFA9eEoqCl+Yx+kGJd7aB9w6nfNgVHKSYwLPZUHrz4ZGa+t+kXjV9itvcHDLQouA==", "license": "MIT", "dependencies": { "lightningcss": "^1.33.0", "picomatch": "^4.0.7", - "postcss": "^8.5.30", - "rolldown": "~1.2.14", + "postcss": "^8.5.32", + "rolldown": "~1.2.18", "tinyglobby": "^0.2.17" }, "bin": { @@ -6890,7 +6675,6 @@ "version": "2.9.1", "resolved": "https://registry.npmjs.org/yaml/-/yaml-2.9.1.tgz", "integrity": "sha512-3NxN8+78OdzbT7C/WjGsyfPAtJaN3FNDsWxv7Y7mcDsT/oOmgW8BpyQQFFBnvZE3j9Y2Sdz1ULFLezL7Eb2yFw==", - "devOptional": true, "license": "ISC", "bin": { "yaml": "bin.mjs" @@ -6971,6 +6755,7 @@ "version": "22.0.0", "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-22.0.0.tgz", "integrity": "sha512-rwu/ClNdSMpkSrUb+d6BRsSkLUq1fmfsY6TOpYzTwvwkg1/NRG85KBy3kq++A8LKQwX6lsu+aWad+2khvuXrqw==", + "dev": true, "license": "ISC", "engines": { "node": "^20.19.0 || ^22.12.0 || >=23" @@ -7018,9 +6803,9 @@ } }, "node_modules/zod": { - "version": "3.25.76", - "resolved": "https://registry.npmjs.org/zod/-/zod-3.25.76.tgz", - "integrity": "sha512-gzUt/qt81nXsFGKIFcC3YnfEAx5NkunCfnDlvuBSSFS02bcXu4Lmea0AFIUwbLWxWPx3d9p8S5QoaujKcNQxcQ==", + "version": "4.6.7", + "resolved": "https://registry.npmjs.org/zod/-/zod-4.6.7.tgz", + "integrity": "sha512-g8W2D2kU6a8untc053fX1uVBKzM7yqAxW/3zwk83+6RyF2+SKOuV+c0wBDhUwzV1PaGapmZH+rmcUzPf+3CGwg==", "license": "MIT", "funding": { "url": "https://github.com/sponsors/colinhacks" diff --git a/package.json b/package.json index 510c44e..c00e416 100644 --- a/package.json +++ b/package.json @@ -24,11 +24,11 @@ "@fontsource/jetbrains-mono": "^5.2.8", "@fontsource/playfair-display": "^5.2.8", "@resvg/resvg-wasm": "^2.6.2", - "astro": "^7.3.5", + "astro": "^7.4.12", "react": "^19.0.0", "react-dom": "^19.0.0", "satori": "^0.12.0", - "zod": "^3.24.0" + "zod": "^4.6.6" }, "devDependencies": { "@astrojs/check": "^0.9.10", diff --git a/public/.well-known/funding-manifest-urls b/public/.well-known/funding-manifest-urls index 42647b8..8cd6afd 100644 --- a/public/.well-known/funding-manifest-urls +++ b/public/.well-known/funding-manifest-urls @@ -1 +1,2 @@ https://oss.codercops.com/funding.json +https://raw.githubusercontent.com/codercops/.github/main/funding.json diff --git a/src/components/Footer.astro b/src/components/Footer.astro index bb221a0..2a10f98 100644 --- a/src/components/Footer.astro +++ b/src/components/Footer.astro @@ -187,6 +187,8 @@ const year = new Date().getFullYear(); (function() { // The router swaps the footer on every navigation and runs this script only // once. The numbers are fetched once, and every new footer is filled in from them. + // Counts once fetched, or false when the API has no counter to show + // (204 on self-hosted copies without Upstash, or any other error). var latest = null; var loading = false; @@ -197,9 +199,19 @@ const year = new Date().getFullYear(); if (total) total.textContent = (data.total || 0).toLocaleString(); } + // Hide the Stats title and counters in whichever footer is on the page, + // keeping the MIT License and copyright line below them. + function hideStats() { + var title = document.querySelector('.footer-stats-col .footer-col-title'); + var stats = document.querySelector('.footer-stats-col .footer-stats'); + if (title) title.style.display = 'none'; + if (stats) stats.style.display = 'none'; + } + function loadVisitors() { - if (latest) { - updateDOM(latest); + if (latest !== null) { + if (latest === false) hideStats(); + else updateDOM(latest); return; } // A fetch is already on its way and will fill in whichever footer is on the page @@ -212,8 +224,16 @@ const year = new Date().getFullYear(); ? fetch('/api/visitors') : fetch('/api/visitors', { method: 'POST', headers: { 'Content-Type': 'application/json' } }); request - .then(function(r) { return r.json(); }) + .then(function(r) { + if (r.status !== 200) return null; + return r.json(); + }) .then(function(data) { + if (data === null) { + latest = false; + hideStats(); + return; + } if (!counted) sessionStorage.setItem('ogcops-counted', '1'); latest = data; updateDOM(data); diff --git a/src/components/editor/AIAutofill.tsx b/src/components/editor/AIAutofill.tsx index 4568769..c08dbeb 100644 --- a/src/components/editor/AIAutofill.tsx +++ b/src/components/editor/AIAutofill.tsx @@ -2,6 +2,7 @@ import { useState, useCallback, useEffect } from 'react'; import { useAI } from './AIContext'; import { getApiKey, getSelectedProvider, getSelectedModel } from '@/lib/ai/storage'; import { getDefaultModel } from '@/lib/ai/providers'; +import { normalizeAutofillUrl } from '@/lib/ai/normalize-autofill-url'; interface AIAutofillProps { onAutofill: (result: { templateId: string; fields: Record; colors?: Record }) => void; @@ -54,7 +55,7 @@ export function AIAutofill({ onAutofill, initialUrl }: AIAutofillProps) { provider, apiKey, model, - url: url.trim().startsWith('http') ? url.trim() : `https://${url.trim()}`, + url: normalizeAutofillUrl(url), }), }); diff --git a/src/components/editor/ExportBar.tsx b/src/components/editor/ExportBar.tsx index 0b14bac..0bfc78a 100644 --- a/src/components/editor/ExportBar.tsx +++ b/src/components/editor/ExportBar.tsx @@ -1,5 +1,6 @@ import { useState, useCallback, useEffect, useRef } from 'react'; import { generateMetaTags } from '@/lib/meta-tag-generator'; +import { copyToClipboard as copyTextToClipboard } from '@/lib/clipboard'; import { containsLocalImage, svgToPngBlob } from './export-utils'; interface ExportBarProps { @@ -74,22 +75,13 @@ export function ExportBar({ }, []); const copyToClipboard = useCallback(async (text: string, label: string) => { - try { - await navigator.clipboard.writeText(text); - setCopied(label); - window.showToast?.(label === 'url' ? 'URL copied to clipboard!' : 'Meta tags copied!', 'success'); - setTimeout(() => setCopied(null), 2000); - } catch { - // Fallback - const ta = document.createElement('textarea'); - ta.value = text; - document.body.appendChild(ta); - ta.select(); - document.execCommand('copy'); - document.body.removeChild(ta); + const success = await copyTextToClipboard(text); + if (success) { setCopied(label); window.showToast?.(label === 'url' ? 'URL copied to clipboard!' : 'Meta tags copied!', 'success'); setTimeout(() => setCopied(null), 2000); + } else { + window.showToast?.(label === 'url' ? 'Could not copy URL' : 'Could not copy meta tags', 'error'); } }, []); diff --git a/src/components/editor/useSatoriRenderer.ts b/src/components/editor/useSatoriRenderer.ts index c59b684..daa3667 100644 --- a/src/components/editor/useSatoriRenderer.ts +++ b/src/components/editor/useSatoriRenderer.ts @@ -69,6 +69,7 @@ export function useSatoriRenderer(): SatoriRendererResult { const [error, setError] = useState(null); const readyRef = useRef(false); const queuedRef = useRef(null); + const renderIdRef = useRef(0); // Initialize satori + fonts useEffect(() => { @@ -93,15 +94,18 @@ export function useSatoriRenderer(): SatoriRendererResult { const doRender = useCallback(async (element: any) => { if (!satoriModule || !fontsLoaded) return; + const renderId = ++renderIdRef.current; try { const result = await satoriModule(element, { width: 1200, height: 630, fonts: fontsLoaded, }); + if (renderId !== renderIdRef.current) return; setSvg(result); setError(null); } catch (e) { + if (renderId !== renderIdRef.current) return; setError(e instanceof Error ? e.message : 'Render failed'); } }, []); diff --git a/src/components/preview/FixItButton.tsx b/src/components/preview/FixItButton.tsx index 7662875..d783779 100644 --- a/src/components/preview/FixItButton.tsx +++ b/src/components/preview/FixItButton.tsx @@ -1,5 +1,6 @@ import type { MetaTags } from '@/lib/meta-fetcher'; import { generateMetaTags } from '@/lib/meta-tag-generator'; +import { copyToClipboard } from '@/lib/clipboard'; interface FixItButtonProps { meta: MetaTags; @@ -26,21 +27,11 @@ export function FixItButton({ meta }: FixItButtonProps) { }); const handleCopy = async () => { - try { - await navigator.clipboard.writeText(tags); + const success = await copyToClipboard(tags); + if (success) { window.showToast?.('Recommended meta tags copied!', 'success'); - } catch { - try { - const ta = document.createElement('textarea'); - ta.value = tags; - document.body.appendChild(ta); - ta.select(); - document.execCommand('copy'); - document.body.removeChild(ta); - window.showToast?.('Recommended meta tags copied!', 'success'); - } catch { - window.showToast?.('Could not copy meta tags', 'error'); - } + } else { + window.showToast?.('Could not copy meta tags', 'error'); } }; diff --git a/src/lib/ai/normalize-autofill-url.ts b/src/lib/ai/normalize-autofill-url.ts new file mode 100644 index 0000000..b3cd7f8 --- /dev/null +++ b/src/lib/ai/normalize-autofill-url.ts @@ -0,0 +1,5 @@ +/** Preserve HTTP(S) URLs and default bare domains to HTTPS. */ +export function normalizeAutofillUrl(url: string): string { + const trimmed = url.trim(); + return /^https?:\/\//i.test(trimmed) ? trimmed : `https://${trimmed}`; +} diff --git a/src/lib/clipboard.ts b/src/lib/clipboard.ts new file mode 100644 index 0000000..0d05e10 --- /dev/null +++ b/src/lib/clipboard.ts @@ -0,0 +1,35 @@ +/** + * Copies text to the clipboard using the modern Clipboard API, + * falling back to document.execCommand('copy') with a temporary textarea + * if the modern API is unavailable or rejects. + * + * Returns true if copying succeeded, false otherwise. + */ +export async function copyToClipboard(text: string): Promise { + if (typeof navigator !== 'undefined' && typeof navigator.clipboard?.writeText === 'function') { + try { + await navigator.clipboard.writeText(text); + return true; + } catch { + // Modern Clipboard API rejected; proceed to fallback. + } + } + + if (typeof document !== 'undefined' && document.body) { + let successful = false; + const ta = document.createElement('textarea'); + ta.value = text; + document.body.appendChild(ta); + try { + ta.select?.(); + successful = Boolean(document.execCommand?.('copy')); + } catch { + successful = false; + } finally { + document.body.removeChild(ta); + } + return successful; + } + + return false; +} diff --git a/src/lib/html-entities.ts b/src/lib/html-entities.ts new file mode 100644 index 0000000..f3fa526 --- /dev/null +++ b/src/lib/html-entities.ts @@ -0,0 +1,77 @@ +/** + * HTML 4 named character references (Latin-1, symbols and special sets), + * with characters taken from the current WHATWG list + * (https://html.spec.whatwg.org/entities.json). `lang` and `rang` differ + * from HTML 4 (U+27E8 / U+27E9 instead of U+2329 / U+232A). + * + * Names are case-sensitive: `É` is É and `é` is é. + */ + +// Latin-1 supplement: consecutive code points starting at U+00A0. +const LATIN1_START = 0xa0; +const LATIN1_NAMES = ( + 'nbsp iexcl cent pound curren yen brvbar sect uml copy ordf laquo not shy reg macr ' + + 'deg plusmn sup2 sup3 acute micro para middot cedil sup1 ordm raquo frac14 frac12 frac34 iquest ' + + 'Agrave Aacute Acirc Atilde Auml Aring AElig Ccedil Egrave Eacute Ecirc Euml ' + + 'Igrave Iacute Icirc Iuml ETH Ntilde Ograve Oacute Ocirc Otilde Ouml times ' + + 'Oslash Ugrave Uacute Ucirc Uuml Yacute THORN szlig ' + + 'agrave aacute acirc atilde auml aring aelig ccedil egrave eacute ecirc euml ' + + 'igrave iacute icirc iuml eth ntilde ograve oacute ocirc otilde ouml divide ' + + 'oslash ugrave uacute ucirc uuml yacute thorn yuml' +).split(' '); + +// Symbols (math, Greek letters, arrows, shapes) and special characters. +const OTHER_ENTITIES: Record = { + // Special + quot: 0x22, amp: 0x26, lt: 0x3c, gt: 0x3e, + OElig: 0x152, oelig: 0x153, Scaron: 0x160, scaron: 0x161, Yuml: 0x178, + circ: 0x2c6, tilde: 0x2dc, + ensp: 0x2002, emsp: 0x2003, thinsp: 0x2009, zwnj: 0x200c, zwj: 0x200d, lrm: 0x200e, rlm: 0x200f, + ndash: 0x2013, mdash: 0x2014, + lsquo: 0x2018, rsquo: 0x2019, sbquo: 0x201a, ldquo: 0x201c, rdquo: 0x201d, bdquo: 0x201e, + dagger: 0x2020, Dagger: 0x2021, permil: 0x2030, lsaquo: 0x2039, rsaquo: 0x203a, euro: 0x20ac, + + // Symbols: Latin extended and Greek + fnof: 0x192, + Alpha: 0x391, Beta: 0x392, Gamma: 0x393, Delta: 0x394, Epsilon: 0x395, Zeta: 0x396, + Eta: 0x397, Theta: 0x398, Iota: 0x399, Kappa: 0x39a, Lambda: 0x39b, Mu: 0x39c, + Nu: 0x39d, Xi: 0x39e, Omicron: 0x39f, Pi: 0x3a0, Rho: 0x3a1, Sigma: 0x3a3, + Tau: 0x3a4, Upsilon: 0x3a5, Phi: 0x3a6, Chi: 0x3a7, Psi: 0x3a8, Omega: 0x3a9, + alpha: 0x3b1, beta: 0x3b2, gamma: 0x3b3, delta: 0x3b4, epsilon: 0x3b5, zeta: 0x3b6, + eta: 0x3b7, theta: 0x3b8, iota: 0x3b9, kappa: 0x3ba, lambda: 0x3bb, mu: 0x3bc, + nu: 0x3bd, xi: 0x3be, omicron: 0x3bf, pi: 0x3c0, rho: 0x3c1, sigmaf: 0x3c2, + sigma: 0x3c3, tau: 0x3c4, upsilon: 0x3c5, phi: 0x3c6, chi: 0x3c7, psi: 0x3c8, + omega: 0x3c9, thetasym: 0x3d1, upsih: 0x3d2, piv: 0x3d6, + + // Symbols: punctuation, letterlike, arrows + bull: 0x2022, hellip: 0x2026, prime: 0x2032, Prime: 0x2033, oline: 0x203e, frasl: 0x2044, + weierp: 0x2118, image: 0x2111, real: 0x211c, trade: 0x2122, alefsym: 0x2135, + larr: 0x2190, uarr: 0x2191, rarr: 0x2192, darr: 0x2193, harr: 0x2194, crarr: 0x21b5, + lArr: 0x21d0, uArr: 0x21d1, rArr: 0x21d2, dArr: 0x21d3, hArr: 0x21d4, + + // Symbols: math operators + forall: 0x2200, part: 0x2202, exist: 0x2203, empty: 0x2205, nabla: 0x2207, + isin: 0x2208, notin: 0x2209, ni: 0x220b, prod: 0x220f, sum: 0x2211, minus: 0x2212, + lowast: 0x2217, radic: 0x221a, prop: 0x221d, infin: 0x221e, ang: 0x2220, + and: 0x2227, or: 0x2228, cap: 0x2229, cup: 0x222a, int: 0x222b, there4: 0x2234, + sim: 0x223c, cong: 0x2245, asymp: 0x2248, ne: 0x2260, equiv: 0x2261, le: 0x2264, ge: 0x2265, + sub: 0x2282, sup: 0x2283, nsub: 0x2284, sube: 0x2286, supe: 0x2287, + oplus: 0x2295, otimes: 0x2297, perp: 0x22a5, sdot: 0x22c5, + + // Symbols: technical and shapes + lceil: 0x2308, rceil: 0x2309, lfloor: 0x230a, rfloor: 0x230b, + lang: 0x27e8, rang: 0x27e9, loz: 0x25ca, + spades: 0x2660, clubs: 0x2663, hearts: 0x2665, diams: 0x2666, +}; + +// Not in HTML 4, but already supported before this table existed. +const EXTRA_ENTITIES: Record = { + apos: 0x27, + AMP: 0x26, LT: 0x3c, GT: 0x3e, QUOT: 0x22, +}; + +export const HTML_ENTITIES: Record = Object.fromEntries([ + ...LATIN1_NAMES.map((name, index): [string, number] => [name, LATIN1_START + index]), + ...Object.entries(OTHER_ENTITIES), + ...Object.entries(EXTRA_ENTITIES), +].map(([name, codePoint]) => [name, String.fromCodePoint(codePoint)])); diff --git a/src/lib/meta-fetcher.ts b/src/lib/meta-fetcher.ts index b9ff6c8..68864c4 100644 --- a/src/lib/meta-fetcher.ts +++ b/src/lib/meta-fetcher.ts @@ -1,3 +1,4 @@ +import { HTML_ENTITIES } from './html-entities'; export interface MetaTags { title?: string; description?: string; @@ -43,12 +44,20 @@ export async function fetchMetaTags(url: string): Promise { } export function parseMetaTags(html: string, baseUrl: string): MetaTags { + // Strip HTML comments before any extraction so that commented-out tags are + // not mistaken for active metadata (issue #389). + html = html.replace(//g, ''); + + // Strip script elements before any extraction so that tags inside scripts + // or JSON-LD do not affect metadata (issue #394). + html = html.replace(/]*>[\s\S]*?<\/script>/gi, ''); + const tags: MetaTags = {}; let inFirstImageGroup = false; // Extract const titleMatch = html.match(/<title[^>]*>(.*?)<\/title>/is); - if (titleMatch) tags.title = decodeEntities(titleMatch[1].trim()); + if (titleMatch) tags.title = decodeEntities(titleMatch[1]).replace(/[ \t\n\r\f]+/g, ' ').replace(/^ | $/g, ''); // Extract meta tags for (const tag of findTags(html, 'meta')) { @@ -183,22 +192,9 @@ function findTags(html: string, tagName: 'meta' | 'link'): string[] { return tags; } -const NAMED_ENTITIES: Record<string, string> = { - amp: '&', - lt: '<', - gt: '>', - quot: '"', - apos: "'", - nbsp: '\u00a0', - AMP: '&', - LT: '<', - GT: '>', - QUOT: '"', -}; - function decodeEntities(str: string): string { - return str.replace(/&(#\d+|#x[0-9a-f]+|[a-z]+);/gi, (entity, body: string) => { - if (body[0] !== '#') return NAMED_ENTITIES[body] ?? entity; + return str.replace(/&(#\d+|#x[0-9a-f]+|[a-z][a-z0-9]*);/gi, (entity, body: string) => { + if (body[0] !== '#') return Object.hasOwn(HTML_ENTITIES, body) ? HTML_ENTITIES[body] : entity; const hex = body[1] === 'x' || body[1] === 'X'; const code = parseInt(body.slice(hex ? 2 : 1), hex ? 16 : 10); return code > 0 && code <= 0x10ffff ? String.fromCodePoint(code) : entity; diff --git a/src/lib/upstash.ts b/src/lib/upstash.ts index 2bdb4ef..64dd78b 100644 --- a/src/lib/upstash.ts +++ b/src/lib/upstash.ts @@ -9,6 +9,12 @@ function upstash(): { url: string; token: string } { return { url, token }; } +// Same per-call read as upstash(): routes check this to skip the counter +// entirely on self-hosted copies that never set the secrets. +export function hasUpstashCredentials(): boolean { + return Boolean(getSecret('UPSTASH_REDIS_REST_URL') && getSecret('UPSTASH_REDIS_REST_TOKEN')); +} + async function redis(command: string[]): Promise<any> { const { url, token } = upstash(); const res = await fetch(url, { diff --git a/src/pages/api/visitors.ts b/src/pages/api/visitors.ts index b547c07..b18e85e 100644 --- a/src/pages/api/visitors.ts +++ b/src/pages/api/visitors.ts @@ -1,5 +1,5 @@ import type { APIRoute } from 'astro'; -import { incrementVisitors, getVisitors } from '../../lib/upstash'; +import { incrementVisitors, getVisitors, hasUpstashCredentials } from '../../lib/upstash'; const SITE = 'ogcops'; const HEADERS = { @@ -8,6 +8,7 @@ const HEADERS = { }; export const POST: APIRoute = async () => { + if (!hasUpstashCredentials()) return new Response(null, { status: 204 }); try { const counts = await incrementVisitors(SITE); return new Response(JSON.stringify(counts), { headers: HEADERS }); @@ -17,6 +18,7 @@ export const POST: APIRoute = async () => { }; export const GET: APIRoute = async () => { + if (!hasUpstashCredentials()) return new Response(null, { status: 204 }); try { const counts = await getVisitors(SITE); return new Response(JSON.stringify(counts), { headers: HEADERS }); diff --git a/src/templates/developer/build-in-public.ts b/src/templates/developer/build-in-public.ts new file mode 100644 index 0000000..31863bb --- /dev/null +++ b/src/templates/developer/build-in-public.ts @@ -0,0 +1,404 @@ +import type { SatoriElement, TemplateDefinition } from '../types'; +import { autoFontSize, commonFields, isLightColor, mixColors, truncate } from '../utils'; + +const MAX_BARS = 6; +const CHART_HEIGHT = 200; +const MIN_BAR_HEIGHT = 12; + +function parseHistory(rawHistory: unknown): number[] { + if (rawHistory === undefined || rawHistory === null) return []; + const str = String(rawHistory).trim(); + if (!str) return []; + + const rawEntries = str + .split(',') + .map((s) => s.trim()) + .filter((s) => s.length > 0); + + if (rawEntries.length === 0) return []; + + const parsed = rawEntries.map((entry) => { + const num = Number(entry); + return Number.isFinite(num) && num > 0 ? num : 0; + }); + + return parsed.slice(-MAX_BARS); +} + +const template: TemplateDefinition = { + id: 'developer-build-in-public', + name: 'Build in Public', + category: 'developer', + description: 'Monthly building-in-public update with headline metrics, a change chip, and a 6-month bar chart', + tags: ['developer', 'build in public', 'mrr', 'indie hacker', 'metrics', 'stats'], + fields: [ + commonFields.title, + { key: 'period', label: 'Period', type: 'text', defaultValue: 'Month 7', placeholder: 'Month 7', group: 'Content' }, + { key: 'metricValue', label: 'Metric Value', type: 'text', defaultValue: '$2,480', placeholder: '$2,480', required: true, group: 'Content' }, + { key: 'metricLabel', label: 'Metric Label', type: 'text', defaultValue: 'MRR', placeholder: 'MRR', group: 'Content' }, + { key: 'change', label: 'Change', type: 'text', defaultValue: '+18% from last month', placeholder: '+18% from last month', group: 'Content' }, + { key: 'history', label: 'History (comma-separated)', type: 'text', defaultValue: '820, 1100, 1350, 1700, 2100, 2480', placeholder: '820, 1100, 1350, 1700, 2100, 2480', group: 'Content' }, + { key: 'note', label: 'Note', type: 'text', defaultValue: '312 paying customers, 2.1% churn', placeholder: '312 paying customers, 2.1% churn', group: 'Content' }, + commonFields.siteName, + commonFields.bgColor, + commonFields.accentColor, + commonFields.textColor, + ], + defaults: { + title: 'Invoice Kit', + period: 'Month 7', + metricValue: '$2,480', + metricLabel: 'MRR', + change: '+18% from last month', + history: '820, 1100, 1350, 1700, 2100, 2480', + note: '312 paying customers, 2.1% churn', + siteName: 'codercops.com', + bgColor: '#0b0f1a', + accentColor: '#34d399', + textColor: '#f1f5f9', + }, + render: (params) => { + const rawTitle = String(params.title ?? template.defaults.title).replace(/\s+/g, ' ').trim(); + const title = truncate(rawTitle || String(template.defaults.title), 50); + const titleSize = autoFontSize(title, [ + { maxLen: 16, size: 44 }, + { maxLen: 28, size: 36 }, + { maxLen: 40, size: 30 }, + { maxLen: 50, size: 26 }, + ]); + + const period = truncate(String(params.period ?? '').replace(/\s+/g, ' ').trim(), 20); + const rawMetricValue = String(params.metricValue ?? template.defaults.metricValue).replace(/\s+/g, ' ').trim(); + const metricValue = truncate(rawMetricValue || String(template.defaults.metricValue), 24); + const metricLabel = truncate(String(params.metricLabel ?? '').replace(/\s+/g, ' ').trim(), 30); + const change = truncate(String(params.change ?? '').replace(/\s+/g, ' ').trim(), 40); + const note = truncate(String(params.note ?? '').replace(/\s+/g, ' ').trim(), 70); + const siteName = truncate(String(params.siteName ?? template.defaults.siteName).replace(/\s+/g, ' ').trim(), 40); + + const bgColor = String(params.bgColor || template.defaults.bgColor); + const accentColor = String(params.accentColor || template.defaults.accentColor); + const textColor = String(params.textColor || template.defaults.textColor); + const isLight = isLightColor(bgColor); + + const values = parseHistory(params.history); + const hasChart = values.length > 0; + const maxValue = hasChart ? Math.max(...values, 0) : 0; + + // Metric value size so larger numbers like "$1,250,000" fit comfortably + const metricSize = autoFontSize(metricValue, [ + { maxLen: 8, size: 76 }, + { maxLen: 12, size: 62 }, + { maxLen: 16, size: 50 }, + { maxLen: 24, size: 40 }, + ]); + + // Change chip styling + let chipBg = isLight ? mixColors(textColor, bgColor, 0.08) : mixColors(textColor, bgColor, 0.12); + let chipBorder = isLight ? mixColors(textColor, bgColor, 0.2) : mixColors(textColor, bgColor, 0.25); + let chipText = isLight ? mixColors(textColor, bgColor, 0.8) : mixColors(textColor, bgColor, 0.85); + + if (change.startsWith('+')) { + chipBg = isLight ? '#dcfce7' : '#052e16'; + chipBorder = isLight ? '#86efac' : '#14532d'; + chipText = isLight ? '#15803d' : '#4ade80'; + } else if (change.startsWith('-')) { + chipBg = isLight ? '#fee2e2' : '#450a0a'; + chipBorder = isLight ? '#fca5a5' : '#7f1d1d'; + chipText = isLight ? '#b91c1c' : '#f87171'; + } + + // Pill styling next to title + const pillBg = isLight ? mixColors(accentColor, '#ffffff', 0.18) : mixColors(accentColor, '#000000', 0.22); + const pillBorder = isLight ? mixColors(accentColor, '#000000', 0.35) : mixColors(accentColor, '#ffffff', 0.4); + const pillText = isLight ? mixColors(accentColor, '#000000', 0.6) : mixColors(accentColor, '#ffffff', 0.95); + + // Muted label and note color + const mutedColor = isLight ? mixColors(textColor, bgColor, 0.6) : mixColors(textColor, bgColor, 0.65); + const barInactiveColor = isLight ? mixColors(textColor, bgColor, 0.16) : mixColors(textColor, bgColor, 0.2); + + return { + type: 'div', + props: { + style: { + display: 'flex', + flexDirection: 'column', + justifyContent: 'space-between', + width: '1200px', + height: '630px', + padding: '60px 72px', + backgroundColor: bgColor, + color: textColor, + fontFamily: 'Inter, sans-serif', + boxSizing: 'border-box', + }, + children: [ + // Header: Project name (title) + Period pill + { + type: 'div', + props: { + style: { + display: 'flex', + alignItems: 'center', + gap: '16px', + minHeight: '52px', + }, + children: [ + { + type: 'span', + props: { + style: { + display: 'flex', + fontSize: `${titleSize}px`, + fontWeight: 700, + lineHeight: 1.1, + letterSpacing: '-0.02em', + color: textColor, + }, + children: title, + }, + }, + ...(period + ? [ + { + type: 'div', + props: { + style: { + display: 'flex', + alignItems: 'center', + padding: '6px 14px', + borderRadius: '9999px', + backgroundColor: pillBg, + border: `1.5px solid ${pillBorder}`, + fontSize: '15px', + fontWeight: 600, + letterSpacing: '0.02em', + color: pillText, + }, + children: period, + }, + }, + ] + : []), + ], + }, + }, + + // Main body: Metric Stats (left) + Bar Chart (right) + { + type: 'div', + props: { + style: { + display: 'flex', + alignItems: 'center', + justifyContent: 'space-between', + gap: '48px', + flex: 1, + marginTop: '36px', + marginBottom: '36px', + }, + children: [ + // Left Column: Headline number, label, change chip, note + { + type: 'div', + props: { + style: { + display: 'flex', + flexDirection: 'column', + justifyContent: 'center', + flex: hasChart ? '0 1 540px' : '1 1 100%', + minWidth: 0, + }, + children: [ + // Metric Value + Label + { + type: 'div', + props: { + style: { + display: 'flex', + alignItems: 'baseline', + gap: '14px', + flexWrap: 'wrap', + }, + children: [ + { + type: 'span', + props: { + style: { + display: 'flex', + fontSize: `${metricSize}px`, + fontWeight: 800, + lineHeight: 1.05, + letterSpacing: '-0.03em', + fontFamily: 'Inter, sans-serif', + color: textColor, + }, + children: metricValue, + }, + }, + ...(metricLabel + ? [ + { + type: 'span', + props: { + style: { + display: 'flex', + fontSize: '24px', + fontWeight: 600, + letterSpacing: '0.04em', + textTransform: 'uppercase' as const, + color: mutedColor, + }, + children: metricLabel, + }, + }, + ] + : []), + ], + }, + }, + + // Change Chip (if present) + ...(change + ? [ + { + type: 'div', + props: { + style: { + display: 'flex', + alignItems: 'center', + alignSelf: 'flex-start', + marginTop: '18px', + padding: '6px 14px', + borderRadius: '8px', + backgroundColor: chipBg, + border: `1px solid ${chipBorder}`, + fontSize: '16px', + fontWeight: 600, + color: chipText, + }, + children: change, + }, + }, + ] + : []), + + // Note (if present) + ...(note + ? [ + { + type: 'span', + props: { + style: { + display: 'flex', + marginTop: change ? '16px' : '20px', + fontSize: '18px', + fontWeight: 500, + color: mutedColor, + lineHeight: 1.4, + whiteSpace: 'nowrap', + overflow: 'hidden', + textOverflow: 'ellipsis', + }, + children: note, + }, + }, + ] + : []), + ], + }, + }, + + // Right Column: 6-month bar chart (if history has values) + ...(hasChart + ? [ + { + type: 'div', + props: { + style: { + display: 'flex', + alignItems: 'flex-end', + justifyContent: 'flex-end', + gap: '18px', + height: `${CHART_HEIGHT}px`, + flexShrink: 0, + paddingBottom: '4px', + }, + children: values.map((val, idx) => { + const isCurrent = idx === values.length - 1; + const barHeight = + maxValue > 0 + ? Math.max(MIN_BAR_HEIGHT, Math.round((val / maxValue) * CHART_HEIGHT)) + : MIN_BAR_HEIGHT; + + const barColor = isCurrent ? accentColor : barInactiveColor; + + return { + type: 'div', + props: { + style: { + display: 'flex', + flexDirection: 'column', + alignItems: 'center', + justifyContent: 'flex-end', + height: `${CHART_HEIGHT}px`, + }, + children: [ + { + type: 'div', + props: { + style: { + display: 'flex', + width: '42px', + height: `${barHeight}px`, + borderRadius: '6px 6px 2px 2px', + backgroundColor: barColor, + }, + children: '', + }, + }, + ], + }, + }; + }), + }, + }, + ] + : []), + ], + }, + }, + + // Footer: Site name + { + type: 'div', + props: { + style: { + display: 'flex', + alignItems: 'center', + justifyContent: 'flex-end', + minHeight: '28px', + }, + children: [ + { + type: 'span', + props: { + style: { + display: 'flex', + fontSize: '16px', + fontWeight: 600, + color: mutedColor, + letterSpacing: '0.04em', + }, + children: siteName, + }, + }, + ], + }, + }, + ], + }, + }; + }, +}; + +export default template; diff --git a/src/templates/developer/index.ts b/src/templates/developer/index.ts index 7f6f421..610f8d5 100644 --- a/src/templates/developer/index.ts +++ b/src/templates/developer/index.ts @@ -11,3 +11,4 @@ export { default as developerOpenToWork } from './open-to-work'; export { default as developerDayStreak } from './day-streak'; export { default as developerNow } from './now'; export { default as developerYearReview } from './year-review'; +export { default as developerBuildInPublic } from './build-in-public'; diff --git a/src/templates/developer/terminal-bio.ts b/src/templates/developer/terminal-bio.ts index 41014bf..8c539fd 100644 --- a/src/templates/developer/terminal-bio.ts +++ b/src/templates/developer/terminal-bio.ts @@ -161,7 +161,7 @@ const template: TemplateDefinition = { { type: 'span', props: { - style: { fontSize: '18px', fontWeight: 700, color: promptColor }, + style: { fontSize: '18px', fontWeight: 700, color: promptColor, whiteSpace: 'pre' }, children: '$ ', }, }, @@ -177,7 +177,7 @@ const template: TemplateDefinition = { { type: 'span', props: { - style: { fontSize: '17px', color: textColor, width: '120px' }, + style: { fontSize: '17px', color: textColor, width: '120px', whiteSpace: 'pre' }, children: ` ${line.key}:`, }, }, @@ -204,7 +204,7 @@ const template: TemplateDefinition = { { type: 'span', props: { - style: { fontSize: '18px', fontWeight: 700, color: promptColor }, + style: { fontSize: '18px', fontWeight: 700, color: promptColor, whiteSpace: 'pre' }, children: '$ ', }, }, diff --git a/src/templates/developer/vscode-theme.ts b/src/templates/developer/vscode-theme.ts index f2ad54f..a3b0f0a 100644 --- a/src/templates/developer/vscode-theme.ts +++ b/src/templates/developer/vscode-theme.ts @@ -278,6 +278,7 @@ const template: TemplateDefinition = { style: { fontSize: '16px', color: token.color, + whiteSpace: 'pre', }, children: token.text, }, diff --git a/src/templates/ecommerce/index.ts b/src/templates/ecommerce/index.ts index 288fc28..6e71bc4 100644 --- a/src/templates/ecommerce/index.ts +++ b/src/templates/ecommerce/index.ts @@ -11,3 +11,4 @@ export { default as ecommerceBundleDeal } from './bundle-deal'; export { default as ecommerceOrderStatus } from './order-status'; export { default as ecommerceGiftCard } from './gift-card'; export { default as ecommerceBackInStock } from './back-in-stock'; +export { default as ecommerceRatingBreakdown } from './rating-breakdown'; diff --git a/src/templates/ecommerce/rating-breakdown.ts b/src/templates/ecommerce/rating-breakdown.ts new file mode 100644 index 0000000..81ffd36 --- /dev/null +++ b/src/templates/ecommerce/rating-breakdown.ts @@ -0,0 +1,258 @@ +import type { SatoriElement, TemplateDefinition } from '../types'; +import { autoFontSize, commonFields, isLightColor, mixColors, normalizeStarRating, starIcon, truncate } from '../utils'; + +const COUNT_KEYS = [5, 4, 3, 2, 1] as const; +const STAR_GOLD = '#F5C518'; + +const template: TemplateDefinition = { + id: 'ecommerce-rating-breakdown', + name: 'Rating Breakdown', + category: 'ecommerce', + description: 'Overall star score with five horizontal bars showing how reviews split across star ratings', + tags: ['ecommerce', 'rating', 'reviews', 'stars', 'breakdown'], + fields: [ + commonFields.title, + { key: 'count5', label: '5-star Reviews', type: 'number', defaultValue: 742, placeholder: '742', min: 0, max: 1_000_000_000, group: 'Content' }, + { key: 'count4', label: '4-star Reviews', type: 'number', defaultValue: 351, placeholder: '351', min: 0, max: 1_000_000_000, group: 'Content' }, + { key: 'count3', label: '3-star Reviews', type: 'number', defaultValue: 110, placeholder: '110', min: 0, max: 1_000_000_000, group: 'Content' }, + { key: 'count2', label: '2-star Reviews', type: 'number', defaultValue: 44, placeholder: '44', min: 0, max: 1_000_000_000, group: 'Content' }, + { key: 'count1', label: '1-star Reviews', type: 'number', defaultValue: 37, placeholder: '37', min: 0, max: 1_000_000_000, group: 'Content' }, + commonFields.siteName, + commonFields.bgColor, + commonFields.accentColor, + commonFields.textColor, + ], + defaults: { + title: 'Trail Runner 2', + count5: 742, + count4: 351, + count3: 110, + count2: 44, + count1: 37, + siteName: 'codercops.com', + bgColor: '#0a0a0a', + accentColor: '#E07A5F', + textColor: '#FFFFFF', + }, + render: (params) => { + const rawTitle = String(params.title ?? template.defaults.title).replace(/\s+/g, ' ').trim(); + const title = truncate(rawTitle || String(template.defaults.title), 120); + const titleSize = autoFontSize(title, [ + { maxLen: 36, size: 46 }, + { maxLen: 60, size: 40 }, + { maxLen: 90, size: 34 }, + { maxLen: 120, size: 28 }, + ]); + + // Blank, negative or non-numeric counts count as 0 so the score, + // the percentages and the review count always agree with each other. + const counts = COUNT_KEYS.map((stars) => { + const raw = params[`count${stars}`]; + if (raw === undefined || raw === null || String(raw).trim() === '') return { stars, value: 0 }; + const value = Number(raw); + return { stars, value: Number.isFinite(value) && value >= 0 ? value : 0 }; + }); + const total = counts.reduce((sum, { value }) => sum + value, 0); + const weighted = counts.reduce((sum, { stars, value }) => sum + stars * value, 0); + const hasReviews = total > 0; + const scoreText = hasReviews ? (weighted / total).toFixed(1) : ''; + // Derive the stars from the score actually displayed so the two can never disagree. + const starCount = hasReviews ? normalizeStarRating(Number(scoreText), 5) : 0; + const reviewText = hasReviews + ? `${new Intl.NumberFormat('en-US').format(total)} ${total === 1 ? 'review' : 'reviews'}` + : ''; + const reviewSize = autoFontSize(reviewText, [ + { maxLen: 14, size: 26 }, + { maxLen: 20, size: 22 }, + { maxLen: 30, size: 18 }, + ]); + const percentages = counts.map(({ value }) => (hasReviews ? Math.round((value / total) * 100) : 0)); + + const siteName = String(params.siteName ?? '').replace(/\s+/g, ' ').trim(); + const bgColor = String(params.bgColor || '#0a0a0a'); + const accentColor = String(params.accentColor || '#E07A5F'); + const textColor = String(params.textColor || '#FFFFFF'); + const lightBg = isLightColor(bgColor); + const foregroundColor = lightBg && isLightColor(textColor) ? '#111111' : textColor; + const accentInk = lightBg ? mixColors(accentColor, '#000000', 0.45) : accentColor; + const mutedText = mixColors(bgColor, foregroundColor, lightBg ? 0.68 : 0.62); + const trackColor = mixColors(bgColor, foregroundColor, lightBg ? 0.13 : 0.2); + const litStar = lightBg ? mixColors(STAR_GOLD, '#000000', 0.35) : STAR_GOLD; + const emptyStar = mixColors(bgColor, foregroundColor, lightBg ? 0.5 : 0.42); + + const scoreElements: SatoriElement[] = hasReviews + ? [ + { + type: 'span', + props: { + style: { + display: 'flex', color: foregroundColor, fontSize: '96px', + fontWeight: 800, lineHeight: 1, letterSpacing: '-0.03em', + }, + children: scoreText, + }, + }, + { + type: 'div', + props: { + style: { display: 'flex', alignItems: 'center', gap: '8px' }, + children: Array.from({ length: 5 }, (_, index) => + starIcon(30, index < starCount ? litStar : emptyStar)), + }, + }, + { + type: 'span', + props: { + style: { + display: 'flex', color: mutedText, fontSize: `${reviewSize}px`, + fontWeight: 600, maxWidth: '100%', overflow: 'hidden', + textOverflow: 'ellipsis', whiteSpace: 'nowrap', + }, + children: reviewText, + }, + }, + ] + : [ + { + type: 'span', + props: { + style: { display: 'flex', color: foregroundColor, fontSize: '40px', fontWeight: 700 }, + children: 'No reviews yet', + }, + }, + ]; + + const rows: SatoriElement[] = counts.map(({ stars }, index) => { + const percentage = percentages[index]; + return { + type: 'div', + props: { + style: { display: 'flex', alignItems: 'center', gap: '16px', width: '100%' }, + children: [ + { + type: 'span', + props: { + style: { + display: 'flex', flexShrink: 0, width: '64px', minWidth: 0, + overflow: 'hidden', textOverflow: 'ellipsis', whiteSpace: 'nowrap', + fontSize: '17px', fontWeight: 600, color: mutedText, + }, + children: `${stars} star${stars === 1 ? '' : 's'}`, + }, + }, + { + type: 'div', + props: { + style: { + display: 'flex', flex: 1, minWidth: 0, height: '14px', + overflow: 'hidden', borderRadius: '999px', backgroundColor: trackColor, + }, + children: [ + { + type: 'div', + props: { + style: { + display: 'flex', width: `${percentage}%`, height: '100%', + borderRadius: '999px', backgroundColor: accentInk, + }, + children: [], + }, + }, + ], + }, + }, + { + type: 'span', + props: { + style: { + display: 'flex', justifyContent: 'flex-end', flexShrink: 0, + width: '56px', minWidth: 0, fontSize: '17px', fontWeight: 700, + color: foregroundColor, + }, + children: `${percentage}%`, + }, + }, + ], + }, + }; + }); + + return { + type: 'div', + props: { + style: { + display: 'flex', flexDirection: 'column', width: '1200px', height: '630px', + boxSizing: 'border-box', padding: '52px 64px 42px', backgroundColor: bgColor, + fontFamily: 'Inter, sans-serif', + }, + children: [ + { + type: 'h1', + props: { + style: { + display: 'flex', width: '100%', margin: 0, color: foregroundColor, + fontSize: `${titleSize}px`, fontWeight: 700, lineHeight: 1.18, + letterSpacing: '-0.02em', overflow: 'hidden', textOverflow: 'ellipsis', + whiteSpace: 'nowrap', + }, + children: title, + }, + }, + { + type: 'div', + props: { + style: { + display: 'flex', flexDirection: 'row', alignItems: 'center', gap: '56px', + width: '100%', marginTop: 'auto', marginBottom: 'auto', + }, + children: [ + { + type: 'div', + props: { + style: { + display: 'flex', flexDirection: 'column', alignItems: 'center', + gap: '16px', flexShrink: 0, width: '340px', minWidth: 0, + }, + children: scoreElements, + }, + }, + { + type: 'div', + props: { + style: { + display: 'flex', flexDirection: 'column', justifyContent: 'center', + gap: '16px', flex: 1, minWidth: 0, + }, + children: rows, + }, + }, + ], + }, + }, + ...(siteName + ? [ + { + type: 'div', + props: { + style: { + display: 'flex', justifyContent: 'flex-end', marginTop: 'auto', + paddingTop: '14px', borderTop: `1px solid ${trackColor}`, + }, + children: { + type: 'span', + props: { + style: { display: 'flex', fontSize: '16px', fontWeight: 600, color: mutedText }, + children: truncate(siteName, 48), + }, + }, + }, + }, + ] + : []), + ], + }, + }; + }, +}; + +export default template; diff --git a/src/templates/github/release-notes.ts b/src/templates/github/release-notes.ts index 96dade1..8b14716 100644 --- a/src/templates/github/release-notes.ts +++ b/src/templates/github/release-notes.ts @@ -36,10 +36,10 @@ const template: TemplateDefinition = { const version = String(params.version || 'v3.0.0'); const releaseTitle = String(params.releaseTitle || 'Major Release'); const changes = [ - String(params.change1 || 'New plugin system'), - String(params.change2 || 'Performance improvements'), - String(params.change3 || 'Breaking: Updated API'), - ]; + String(params.change1 ?? 'New plugin system'), + String(params.change2 ?? 'Performance improvements'), + String(params.change3 ?? 'Breaking: Updated API'), + ].filter((change) => change.trim()); const date = String(params.date || ''); const bgColor = String(params.bgColor || '#0d1117'); const accentColor = String(params.accentColor || '#58a6ff'); diff --git a/src/templates/github/terminal-style.ts b/src/templates/github/terminal-style.ts index 60be0f0..c55adeb 100644 --- a/src/templates/github/terminal-style.ts +++ b/src/templates/github/terminal-style.ts @@ -62,6 +62,7 @@ const template: TemplateDefinition = { fontSize: '16px', fontFamily: 'JetBrains Mono, monospace', color: color, + whiteSpace: 'pre-wrap', }, children: ` ${command}`, }, @@ -212,6 +213,7 @@ const template: TemplateDefinition = { fontFamily: 'JetBrains Mono, monospace', color: '#9ece6a', fontWeight: 600, + whiteSpace: 'pre', }, children: '$ ', }, diff --git a/src/templates/newsletter/editorial.ts b/src/templates/newsletter/editorial.ts index 8af2ae3..37516cf 100644 --- a/src/templates/newsletter/editorial.ts +++ b/src/templates/newsletter/editorial.ts @@ -176,6 +176,7 @@ const template: TemplateDefinition = { style: { fontSize: '16px', color: `${textColor}44`, + whiteSpace: 'pre', }, children: ` | ${date}`, }, diff --git a/src/templates/newsletter/index.ts b/src/templates/newsletter/index.ts index 6dafabf..7df6b4b 100644 --- a/src/templates/newsletter/index.ts +++ b/src/templates/newsletter/index.ts @@ -11,3 +11,4 @@ export { default as newsletterSponsor } from './sponsor'; export { default as newsletterPoll } from './poll'; export { default as newsletterWelcome } from './welcome'; export { default as newsletterMembersOnly } from './members-only'; +export { default as newsletterMailbag } from './mailbag'; diff --git a/src/templates/newsletter/mailbag.ts b/src/templates/newsletter/mailbag.ts new file mode 100644 index 0000000..5fd4198 --- /dev/null +++ b/src/templates/newsletter/mailbag.ts @@ -0,0 +1,362 @@ +import type { SatoriElement, TemplateDefinition } from '../types'; +import { autoFontSize, commonFields, isLightColor, mixColors, truncate } from '../utils'; + +const cleanText = (value: unknown, maxLength: number) => + truncate(String(value ?? '').replace(/\s+/g, ' ').trim(), maxLength); + +const template: TemplateDefinition = { + id: 'newsletter-mailbag', + name: 'Mailbag', + category: 'newsletter', + description: 'Newsletter mailbag issue with reader questions and who asked them', + tags: ['newsletter', 'mailbag', 'questions', 'readers', 'qa', 'email'], + fields: [ + { ...commonFields.siteName, defaultValue: 'The Friday Diff' }, + { + key: 'issue', + label: 'Issue', + type: 'text', + defaultValue: 'Issue 58', + placeholder: 'Issue 58', + group: 'Content', + }, + { + ...commonFields.title, + defaultValue: 'Your questions about going freelance', + placeholder: 'The issue title...', + }, + { + key: 'question1', + label: 'Question 1', + type: 'text', + defaultValue: 'How did you find your first client?', + placeholder: 'Question 1', + group: 'Content', + }, + { + key: 'asker1', + label: 'Asker 1', + type: 'text', + defaultValue: 'Sam, Lisbon', + placeholder: 'Asker 1', + group: 'Content', + }, + { + key: 'question2', + label: 'Question 2', + type: 'text', + defaultValue: 'What do you charge for a small project?', + placeholder: 'Question 2', + group: 'Content', + }, + { + key: 'asker2', + label: 'Asker 2', + type: 'text', + defaultValue: 'Priya', + placeholder: 'Asker 2', + group: 'Content', + }, + { + key: 'question3', + label: 'Question 3', + type: 'text', + defaultValue: 'Do you still take full-time offers?', + placeholder: 'Question 3', + group: 'Content', + }, + { + key: 'asker3', + label: 'Asker 3', + type: 'text', + defaultValue: 'A reader in Toronto', + placeholder: 'Asker 3', + group: 'Content', + }, + commonFields.bgColor, + commonFields.accentColor, + commonFields.textColor, + ], + defaults: { + siteName: 'The Friday Diff', + issue: 'Issue 58', + title: 'Your questions about going freelance', + question1: 'How did you find your first client?', + asker1: 'Sam, Lisbon', + question2: 'What do you charge for a small project?', + asker2: 'Priya', + question3: 'Do you still take full-time offers?', + asker3: 'A reader in Toronto', + bgColor: '#0a0a0a', + accentColor: '#E07A5F', + textColor: '#FFFFFF', + }, + render: (params) => { + const rawTitle = cleanText(params.title, 140); + const titleSize = rawTitle + ? autoFontSize(rawTitle, [ + { maxLen: 36, size: 58 }, + { maxLen: 64, size: 48 }, + { maxLen: 96, size: 40 }, + { maxLen: 140, size: 34 }, + ]) + : 58; + const title = rawTitle; + + const siteName = cleanText(params.siteName, 42); + const issue = cleanText(params.issue, 24); + + const rawQuestions = [ + { q: params.question1, a: params.asker1 }, + { q: params.question2, a: params.asker2 }, + { q: params.question3, a: params.asker3 }, + ]; + + const questions = rawQuestions + .map(({ q, a }) => ({ + question: cleanText(q, 120), + asker: cleanText(a, 40), + })) + .filter((item) => Boolean(item.question)); + + const bgColor = String(params.bgColor || '#0a0a0a'); + const accentColor = String(params.accentColor || '#E07A5F'); + const textColor = String(params.textColor || '#FFFFFF'); + const lightBg = isLightColor(bgColor); + const accentInk = lightBg ? mixColors(accentColor, '#000000', 0.45) : accentColor; + const mainColor = lightBg && isLightColor(textColor) ? '#111111' : textColor; + const mutedColor = mixColors(bgColor, mainColor, 0.65); + const rowBackground = mixColors(bgColor, mainColor, lightBg ? 0.04 : 0.07); + const rowBorder = mixColors(bgColor, mainColor, lightBg ? 0.15 : 0.18); + + const headerItems: SatoriElement[] = [ + ...(siteName + ? [ + { + type: 'span', + props: { + style: { + fontSize: '21px', + fontWeight: 700, + color: mainColor, + whiteSpace: 'nowrap', + overflow: 'hidden', + textOverflow: 'ellipsis', + }, + children: siteName, + }, + }, + ] + : []), + ...(issue + ? [ + { + type: 'span', + props: { + style: { + fontSize: '17px', + fontWeight: 600, + color: mutedColor, + whiteSpace: 'nowrap', + overflow: 'hidden', + textOverflow: 'ellipsis', + }, + children: issue, + }, + }, + ] + : []), + ]; + + const questionRows: SatoriElement[] = questions.map((item) => ({ + type: 'div', + props: { + style: { + display: 'flex', + alignItems: 'center', + boxSizing: 'border-box', + width: '100%', + padding: '16px 20px', + marginBottom: '14px', + borderRadius: '14px', + border: `1px solid ${rowBorder}`, + backgroundColor: rowBackground, + }, + children: [ + // Q circle + { + type: 'div', + props: { + style: { + display: 'flex', + alignItems: 'center', + justifyContent: 'center', + flexShrink: 0, + width: '32px', + height: '32px', + borderRadius: '50%', + border: `2px solid ${accentInk}`, + color: accentInk, + fontSize: '15px', + fontWeight: 700, + marginRight: '16px', + }, + children: 'Q', + }, + }, + // Question text + { + type: 'span', + props: { + style: { + display: 'flex', + flex: 1, + minWidth: 0, + fontSize: '20px', + fontWeight: 600, + lineHeight: 1.25, + color: mainColor, + whiteSpace: 'nowrap', + overflow: 'hidden', + textOverflow: 'ellipsis', + }, + children: item.question, + }, + }, + // Asker (if present) + ...(item.asker + ? [ + { + type: 'span', + props: { + style: { + display: 'flex', + flexShrink: 0, + maxWidth: '320px', + marginLeft: '24px', + fontSize: '16px', + fontWeight: 500, + color: mutedColor, + whiteSpace: 'nowrap', + overflow: 'hidden', + textOverflow: 'ellipsis', + }, + children: item.asker, + }, + }, + ] + : []), + ], + }, + })); + + return { + type: 'div', + props: { + style: { + display: 'flex', + flexDirection: 'column', + boxSizing: 'border-box', + width: '1200px', + height: '630px', + padding: '54px 64px', + backgroundColor: bgColor, + fontFamily: 'Inter, sans-serif', + }, + children: [ + // Header row (siteName and issue) + ...(headerItems.length + ? [ + { + type: 'div', + props: { + style: { + display: 'flex', + alignItems: 'center', + justifyContent: + siteName && issue + ? 'space-between' + : siteName + ? 'flex-start' + : 'flex-end', + width: '100%', + marginBottom: '24px', + }, + children: headerItems, + }, + }, + ] + : []), + // Mailbag pill + { + type: 'div', + props: { + style: { + display: 'flex', + alignItems: 'center', + alignSelf: 'flex-start', + padding: '7px 16px', + marginBottom: '18px', + borderRadius: '999px', + border: `1px solid ${accentInk}55`, + backgroundColor: mixColors(bgColor, accentInk, lightBg ? 0.08 : 0.16), + }, + children: { + type: 'span', + props: { + style: { + fontSize: '13px', + fontWeight: 700, + color: accentInk, + letterSpacing: '0.08em', + textTransform: 'uppercase', + }, + children: 'Mailbag', + }, + }, + }, + }, + // Title + ...(title + ? [ + { + type: 'h1', + props: { + style: { + display: 'block', + margin: '0 0 24px 0', + fontSize: `${titleSize}px`, + fontWeight: 700, + lineHeight: 1.15, + color: mainColor, + overflow: 'hidden', + lineClamp: 2, + }, + children: title, + }, + }, + ] + : []), + // Question rows + ...(questionRows.length + ? [ + { + type: 'div', + props: { + style: { + display: 'flex', + flexDirection: 'column', + width: '100%', + }, + children: questionRows, + }, + }, + ] + : []), + ], + }, + }; + }, +}; + +export default template; diff --git a/src/templates/podcast/index.ts b/src/templates/podcast/index.ts index 9bf52fd..23b7152 100644 --- a/src/templates/podcast/index.ts +++ b/src/templates/podcast/index.ts @@ -10,3 +10,4 @@ export { default as podcastShowNotes } from './show-notes'; export { default as podcastListenOn } from './listen-on'; export { default as podcastTopEpisodes } from './top-episodes'; export { default as podcastLiveRecording } from './live-recording'; +export { default as podcastTranscript } from './transcript'; diff --git a/src/templates/podcast/transcript.ts b/src/templates/podcast/transcript.ts new file mode 100644 index 0000000..40e6f37 --- /dev/null +++ b/src/templates/podcast/transcript.ts @@ -0,0 +1,135 @@ +import type { TemplateDefinition } from '../types'; +import { autoFontSize, commonFields, isLightColor, mixColors, truncate } from '../utils'; + +const DEFAULT_TIMES = ['12:04', '12:09', '12:11']; +const DEFAULT_SPEAKERS = ['Maya', 'Leo', 'Maya']; +const DEFAULT_LINES = [ + 'We had more services than engineers.', + 'So you merged them back?', + 'One repo, one deploy. Nobody misses the old setup.', +]; + +const template: TemplateDefinition = { + id: 'podcast-transcript', + name: 'Transcript', + category: 'podcast', + description: 'Podcast episode card with up to three transcript lines, each with a timestamp and speaker', + tags: ['podcast', 'transcript', 'quote', 'dialogue', 'episode'], + fields: [ + { key: 'showName', label: 'Show Name', type: 'text' as const, defaultValue: 'The Build Log', placeholder: 'Podcast name', group: 'Content' as const }, + commonFields.title, + ...[1, 2, 3].flatMap((number) => [ + { key: `time${number}`, label: `Time ${number}`, type: 'text' as const, defaultValue: DEFAULT_TIMES[number - 1], placeholder: '12:04', group: 'Content' as const }, + { key: `speaker${number}`, label: `Speaker ${number}`, type: 'text' as const, defaultValue: DEFAULT_SPEAKERS[number - 1], placeholder: 'Speaker name', group: 'Content' as const }, + { key: `line${number}`, label: `Line ${number}`, type: 'text' as const, defaultValue: DEFAULT_LINES[number - 1], placeholder: 'What they said', group: 'Content' as const }, + ]), + commonFields.bgColor, + commonFields.accentColor, + commonFields.textColor, + ], + defaults: { + showName: 'The Build Log', + title: 'Why we went back to a monolith', + time1: '12:04', + speaker1: 'Maya', + line1: 'We had more services than engineers.', + time2: '12:09', + speaker2: 'Leo', + line2: 'So you merged them back?', + time3: '12:11', + speaker3: 'Maya', + line3: 'One repo, one deploy. Nobody misses the old setup.', + bgColor: '#0d1117', + accentColor: '#E07A5F', + textColor: '#FFFFFF', + }, + render: (params) => { + const showName = truncate(String(params.showName ?? '').trim(), 48); + const title = String(params.title ?? '').trim() || 'Episode Transcript'; + const titleSize = autoFontSize(title, [ + { maxLen: 30, size: 46 }, + { maxLen: 40, size: 38 }, + { maxLen: 52, size: 32 }, + { maxLen: 64, size: 28 }, + ]); + const rows = [1, 2, 3] + .map((number) => ({ + time: String(params[`time${number}`] ?? '').trim(), + speaker: String(params[`speaker${number}`] ?? '').trim(), + line: String(params[`line${number}`] ?? '').trim(), + })) + .filter((row) => row.line); // blank text => row skipped, no gap + + const bgColor = String(params.bgColor || '#0d1117'); + const accentColor = String(params.accentColor || '#E07A5F'); + const textColor = String(params.textColor || '#FFFFFF'); + const light = isLightColor(bgColor); + const accentInk = light ? mixColors(accentColor, '#000000', 0.45) : accentColor; + const mutedColor = mixColors(bgColor, textColor, light ? 0.68 : 0.62); + + return { + type: 'div', + props: { + style: { + display: 'flex', + flexDirection: 'column', + width: '1200px', + height: '630px', + padding: '64px 72px', + backgroundColor: bgColor, + fontFamily: 'Inter, sans-serif', + }, + children: [ + ...(showName + ? [{ + type: 'div', + props: { + style: { display: 'flex', alignItems: 'center', gap: '14px', marginBottom: '14px' }, + children: [ + { type: 'div', props: { style: { display: 'flex', width: '10px', height: '10px', borderRadius: '50%', backgroundColor: accentInk } } }, + { type: 'span', props: { style: { display: 'flex', fontSize: '20px', fontWeight: 700, color: mutedColor, letterSpacing: '0.04em' }, children: showName } }, + ], + }, + }] + : []), + { + type: 'h1', + props: { + style: { display: 'flex', margin: rows.length ? '0 0 32px' : '0', fontSize: `${titleSize}px`, lineHeight: 1.15, fontWeight: 700, color: textColor, whiteSpace: 'nowrap', overflow: 'hidden' }, + children: truncate(title, 64), + }, + }, + ...(rows.length + ? [{ + type: 'div', + props: { + style: { display: 'flex', flexDirection: 'column', gap: '12px', flex: 1, minHeight: 0, overflow: 'hidden' }, + children: rows.map((row) => ({ + type: 'div', + props: { + style: { + display: 'flex', + alignItems: 'flex-start', + padding: '16px 24px', + gap: '20px', + borderRadius: '16px', + backgroundColor: `${textColor}08`, + border: `1px solid ${textColor}16`, + }, + children: [ + { type: 'span', props: { style: { display: 'flex', width: '96px', flexShrink: 0, fontFamily: 'JetBrains Mono', fontSize: '20px', lineHeight: '34px', color: mutedColor, whiteSpace: 'nowrap' }, children: truncate(row.time, 8) } }, + { type: 'span', props: { style: { display: 'block', width: '130px', flexShrink: 0, overflow: 'hidden', whiteSpace: 'nowrap', textOverflow: 'ellipsis', fontSize: '22px', lineHeight: '34px', fontWeight: 700, color: accentInk }, children: truncate(row.speaker, 12) } }, + { type: 'span', props: { style: { display: 'block', flex: 1, minWidth: 0, overflow: 'hidden', lineClamp: 2, fontSize: '26px', lineHeight: '34px', fontWeight: 500, color: textColor }, children: truncate(row.line, 110) } }, + ], + }, + })), + }, + }] + : []), + ], + }, + }; + }, +}; + +export default template; \ No newline at end of file diff --git a/src/templates/product/feature-grid.ts b/src/templates/product/feature-grid.ts index af7314b..95ba96a 100644 --- a/src/templates/product/feature-grid.ts +++ b/src/templates/product/feature-grid.ts @@ -35,11 +35,11 @@ const template: TemplateDefinition = { const title = truncate(String(params.title || 'Your Product'), 40); const tagline = String(params.tagline || ''); const features = [ - String(params.feature1 || 'Lightning Fast'), - String(params.feature2 || 'Secure by Default'), - String(params.feature3 || 'Easy Integration'), - String(params.feature4 || 'Real-time Sync'), - ]; + String(params.feature1 ?? 'Lightning Fast'), + String(params.feature2 ?? 'Secure by Default'), + String(params.feature3 ?? 'Easy Integration'), + String(params.feature4 ?? 'Real-time Sync'), + ].filter((feature) => feature.trim()); const siteName = String(params.siteName || ''); const bgColor = String(params.bgColor || '#0f172a'); const accentColor = String(params.accentColor || '#06b6d4'); @@ -201,6 +201,7 @@ const template: TemplateDefinition = { display: 'flex', flexWrap: 'wrap', alignItems: 'center', + alignContent: 'center', justifyContent: 'center', width: '660px', gap: '16px', diff --git a/src/templates/quote/bold-highlight.ts b/src/templates/quote/bold-highlight.ts index b124d9e..9cacc64 100644 --- a/src/templates/quote/bold-highlight.ts +++ b/src/templates/quote/bold-highlight.ts @@ -69,6 +69,7 @@ const template: TemplateDefinition = { fontWeight: 300, color: `${textColor}CC`, lineHeight: 1.3, + whiteSpace: 'pre-wrap', }, children: `${quoteBefore} `, }, @@ -81,8 +82,9 @@ const template: TemplateDefinition = { fontWeight: 800, color: accentColor, lineHeight: 1.3, + whiteSpace: 'pre-wrap', }, - children: highlight, + children: quoteAfter ? `${highlight} ` : highlight, }, }, ...(quoteAfter @@ -96,7 +98,7 @@ const template: TemplateDefinition = { color: `${textColor}CC`, lineHeight: 1.3, }, - children: ` ${quoteAfter}`, + children: quoteAfter, }, }, ] diff --git a/src/templates/quote/index.ts b/src/templates/quote/index.ts index 3deb3e5..333144f 100644 --- a/src/templates/quote/index.ts +++ b/src/templates/quote/index.ts @@ -11,3 +11,4 @@ export { default as quoteCodeComment } from './code-comment'; export { default as quoteSubtitle } from './subtitle'; export { default as quoteArticleExcerpt } from './article-excerpt'; export { default as quoteInterview } from './interview'; +export { default as quoteTwoTakes } from './two-takes'; diff --git a/src/templates/quote/two-takes.ts b/src/templates/quote/two-takes.ts new file mode 100644 index 0000000..1f9a2f3 --- /dev/null +++ b/src/templates/quote/two-takes.ts @@ -0,0 +1,366 @@ +import type { TemplateDefinition } from '../types'; +import { autoFontSize, commonFields, isLightColor, mixColors, truncate } from '../utils'; + +const cleanText = (value: unknown, maxLength: number) => + truncate(String(value ?? '').replace(/\s+/g, ' ').trim(), maxLength); + +const template: TemplateDefinition = { + id: 'quote-two-takes', + name: 'Two Takes', + category: 'quote', + description: 'Put two opposing opinions side by side with a "vs" chip divider, for debate recaps, panel writeups and two-views columns', + tags: ['quote', 'debate', 'comparison', 'opinion', 'panel', 'versus'], + fields: [ + { + ...commonFields.title, + defaultValue: 'Should every team write design docs?', + placeholder: 'The debate topic...', + required: false, + }, + { key: 'leftLabel', label: 'Left Label', type: 'text', defaultValue: 'Yes', placeholder: 'Yes', group: 'Content' }, + { + key: 'leftQuote', + label: 'Left Quote', + type: 'textarea', + defaultValue: "Writing it down is the cheapest review you\u2019ll ever get.", + placeholder: 'The first opinion...', + required: true, + group: 'Content', + }, + { key: 'leftAuthor', label: 'Left Author', type: 'text', defaultValue: 'Dana Whitfield, Engineering Manager', placeholder: 'Name, role', group: 'Content' }, + { key: 'rightLabel', label: 'Right Label', type: 'text', defaultValue: 'No', placeholder: 'No', group: 'Content' }, + { + key: 'rightQuote', + label: 'Right Quote', + type: 'textarea', + defaultValue: 'Most design docs are read once, by the person who wrote them.', + placeholder: 'The opposing opinion...', + required: true, + group: 'Content', + }, + { key: 'rightAuthor', label: 'Right Author', type: 'text', defaultValue: 'Marco Velez, Staff Engineer', placeholder: 'Name, role', group: 'Content' }, + { ...commonFields.siteName, defaultValue: 'Dev Panel Weekly' }, + commonFields.bgColor, + commonFields.accentColor, + commonFields.textColor, + ], + defaults: { + title: 'Should every team write design docs?', + leftLabel: 'Yes', + leftQuote: "Writing it down is the cheapest review you’ll ever get.", + leftAuthor: 'Dana Whitfield, Engineering Manager', + rightLabel: 'No', + rightQuote: 'Most design docs are read once, by the person who wrote them.', + rightAuthor: 'Marco Velez, Staff Engineer', + siteName: 'Dev Panel Weekly', + bgColor: '#0b1120', + accentColor: '#818cf8', + textColor: '#e2e8f0', + }, + render: (params) => { + const bgColor = String(params.bgColor || '#0b1120'); + const accentColor = String(params.accentColor || '#818cf8'); + const textColor = String(params.textColor || '#e2e8f0'); + const lightBg = isLightColor(bgColor); + const accentInk = lightBg ? mixColors(accentColor, '#000000', 0.45) : accentColor; + const mainColor = lightBg && isLightColor(textColor) ? '#111111' : textColor; + const mutedColor = mixColors(bgColor, mainColor, 0.62); + const dividerColor = mixColors(bgColor, mainColor, 0.35); + const rightLabelColor = mutedColor; + + // Title + const rawTitle = String(params.title ?? '').replace(/\s+/g, ' ').trim(); + const title = truncate(rawTitle, 80); + const titleSize = title + ? autoFontSize(title, [ + { maxLen: 32, size: 36 }, + { maxLen: 56, size: 30 }, + { maxLen: 80, size: 26 }, + ]) + : 30; + + // Quotes — required, fall back to defaults + const rawLeftQuote = String(params.leftQuote ?? '').replace(/\s+/g, ' ').trim() || + "Writing it down is the cheapest review you’ll ever get."; + const rawRightQuote = String(params.rightQuote ?? '').replace(/\s+/g, ' ').trim() || + 'Most design docs are read once, by the person who wrote them.'; + + // Font size driven by the longer of the two to keep both columns balanced + const longerQuote = rawLeftQuote.length >= rawRightQuote.length ? rawLeftQuote : rawRightQuote; + const quoteSize = autoFontSize(longerQuote, [ + { maxLen: 70, size: 40 }, + { maxLen: 120, size: 34 }, + { maxLen: 170, size: 28 }, + { maxLen: 220, size: 24 }, + ]); + + const leftQuote = truncate(rawLeftQuote, 220); + const rightQuote = truncate(rawRightQuote, 220); + + // Labels and authors + const leftLabel = cleanText(params.leftLabel, 24); + const rightLabel = cleanText(params.rightLabel, 24); + const leftAuthor = cleanText(params.leftAuthor, 56); + const rightAuthor = cleanText(params.rightAuthor, 56); + const siteName = cleanText(params.siteName, 48); + + const renderQuoteColumn = ( + label: string, + labelColor: string, + quote: string, + author: string, + ) => ({ + type: 'div', + props: { + style: { + display: 'flex', + flexDirection: 'column', + flex: 1, + minWidth: 0, + gap: '0px', + }, + children: [ + // Label pill + ...(label + ? [ + { + type: 'div', + props: { + style: { + display: 'flex', + marginBottom: '20px', + }, + children: { + type: 'span', + props: { + style: { + fontSize: '13px', + fontWeight: 700, + color: labelColor, + letterSpacing: '0.08em', + textTransform: 'uppercase', + padding: '5px 12px', + border: `1.5px solid ${labelColor}60`, + borderRadius: '20px', + }, + children: label, + }, + }, + }, + }, + ] + : []), + // Quote text — flex 1 so both columns grow equally + { + type: 'div', + props: { + style: { + display: 'flex', + flex: 1, + alignItems: 'flex-start', + overflow: 'hidden', + }, + children: { + type: 'span', + props: { + style: { + fontSize: `${quoteSize}px`, + fontWeight: 600, + lineHeight: 1.3, + color: mainColor, + display: 'flex', + overflow: 'hidden', + }, + children: quote, + }, + }, + }, + }, + // Author byline + ...(author + ? [ + { + type: 'span', + props: { + style: { + marginTop: '18px', + fontSize: '15px', + fontWeight: 400, + color: mutedColor, + whiteSpace: 'nowrap', + overflow: 'hidden', + textOverflow: 'ellipsis', + }, + children: author, + }, + }, + ] + : []), + ], + }, + }); + + return { + type: 'div', + props: { + style: { + display: 'flex', + flexDirection: 'column', + width: '1200px', + height: '630px', + boxSizing: 'border-box', + padding: '54px 60px 48px', + backgroundColor: bgColor, + fontFamily: 'Inter, sans-serif', + }, + children: [ + // Title row + ...(title + ? [ + { + type: 'h1', + props: { + style: { + margin: '0 0 32px', + fontSize: `${titleSize}px`, + fontWeight: 700, + color: mainColor, + lineHeight: 1.2, + whiteSpace: 'nowrap', + overflow: 'hidden', + textOverflow: 'ellipsis', + }, + children: title, + }, + }, + ] + : []), + // Two-column body + { + type: 'div', + props: { + style: { + display: 'flex', + flex: 1, + gap: '0px', + minHeight: 0, + overflow: 'hidden', + }, + children: [ + // Left column + renderQuoteColumn(leftLabel, accentInk, leftQuote, leftAuthor), + // Divider with "vs" chip + { + type: 'div', + props: { + style: { + display: 'flex', + flexDirection: 'column', + alignItems: 'center', + justifyContent: 'center', + flexShrink: 0, + width: '64px', + position: 'relative', + }, + children: [ + // Thin vertical line top + { + type: 'div', + props: { + style: { + display: 'flex', + width: '1px', + flex: 1, + backgroundColor: dividerColor, + }, + children: [], + }, + }, + // "vs" chip + { + type: 'div', + props: { + style: { + display: 'flex', + alignItems: 'center', + justifyContent: 'center', + width: '36px', + height: '36px', + borderRadius: '50%', + border: `1.5px solid ${dividerColor}`, + backgroundColor: bgColor, + flexShrink: 0, + margin: '8px 0', + }, + children: { + type: 'span', + props: { + style: { + fontSize: '11px', + fontWeight: 700, + color: mutedColor, + letterSpacing: '0.04em', + }, + children: 'vs', + }, + }, + }, + }, + // Thin vertical line bottom + { + type: 'div', + props: { + style: { + display: 'flex', + width: '1px', + flex: 1, + backgroundColor: dividerColor, + }, + children: [], + }, + }, + ], + }, + }, + // Right column + renderQuoteColumn(rightLabel, rightLabelColor, rightQuote, rightAuthor), + ], + }, + }, + // Footer: site name bottom right + ...(siteName + ? [ + { + type: 'div', + props: { + style: { + display: 'flex', + justifyContent: 'flex-end', + marginTop: '20px', + }, + children: { + type: 'span', + props: { + style: { + fontSize: '14px', + fontWeight: 600, + color: mutedColor, + letterSpacing: '0.07em', + whiteSpace: 'nowrap', + overflow: 'hidden', + textOverflow: 'ellipsis', + }, + children: siteName, + }, + }, + }, + }, + ] + : []), + ], + }, + }; + }, +}; + +export default template; diff --git a/src/templates/registry.ts b/src/templates/registry.ts index cea8634..c7cfe06 100644 --- a/src/templates/registry.ts +++ b/src/templates/registry.ts @@ -210,11 +210,13 @@ import podcastShowNotes from './podcast/show-notes'; import podcastListenOn from './podcast/listen-on'; import podcastTopEpisodes from './podcast/top-episodes'; import podcastLiveRecording from './podcast/live-recording'; +import podcastTranscript from './podcast/transcript'; [ podcastEpisodeCard, podcastWaveform, podcastGuestSpotlight, podcastConversation, podcastSeriesBanner, podcastMinimalPlayer, podcastVideoThumbnail, podcastAudiogram, podcastShowNotes, podcastTopEpisodes, podcastListenOn, podcastLiveRecording, + podcastTranscript, ].forEach(registerTemplate); // Developer @@ -231,6 +233,7 @@ import developerOpenToWork from './developer/open-to-work'; import developerDayStreak from './developer/day-streak'; import developerNow from './developer/now'; import developerYearReview from './developer/year-review'; +import developerBuildInPublic from './developer/build-in-public'; [ developerPortfolioCard, developerTechStack, developerTerminalBio, developerGradientProfile, @@ -238,6 +241,7 @@ import developerYearReview from './developer/year-review'; developerLinkTree, developerOpenToWork, developerDayStreak, developerNow, developerYearReview, + developerBuildInPublic, ].forEach(registerTemplate); // Newsletter @@ -254,12 +258,13 @@ import newsletterSponsor from './newsletter/sponsor'; import newsletterPoll from './newsletter/poll'; import newsletterWelcome from './newsletter/welcome'; import newsletterMembersOnly from './newsletter/members-only'; +import newsletterMailbag from './newsletter/mailbag'; [ newsletterIssueCard, newsletterDigestBanner, newsletterPreviewText, newsletterEditorial, newsletterCuratedLinks, newsletterMinimalNumber, newsletterNewspaperFold, newsletterSubscriberCount, newsletterSubscribeCard, newsletterSponsor, newsletterPoll, - newsletterWelcome, newsletterMembersOnly, + newsletterWelcome, newsletterMembersOnly, newsletterMailbag, ].forEach(registerTemplate); // Quote @@ -276,11 +281,12 @@ import quoteCodeComment from './quote/code-comment'; import quoteSubtitle from './quote/subtitle'; import quoteArticleExcerpt from './quote/article-excerpt'; import quoteInterview from './quote/interview'; +import quoteTwoTakes from './quote/two-takes'; [ quoteCenteredSerif, quoteGradientCard, quoteSpeechBubble, quoteTwitterStyle, quoteBookPage, quoteBoldHighlight, quoteMinimalDash, quotePhotoBackground, quoteStickyNote, - quoteCodeComment, quoteSubtitle, quoteArticleExcerpt, quoteInterview, + quoteCodeComment, quoteSubtitle, quoteArticleExcerpt, quoteInterview, quoteTwoTakes, ].forEach(registerTemplate); // E-commerce @@ -297,12 +303,14 @@ import ecommerceBundleDeal from './ecommerce/bundle-deal'; import ecommerceOrderStatus from './ecommerce/order-status'; import ecommerceGiftCard from './ecommerce/gift-card'; import ecommerceBackInStock from './ecommerce/back-in-stock'; +import ecommerceRatingBreakdown from './ecommerce/rating-breakdown'; [ ecommerceProductCard, ecommerceSaleBanner, ecommerceCollection, ecommerceReviewHighlight, ecommercePriceDrop, ecommerceNewArrival, ecommerceComparisonGrid, ecommerceBrandStory, ecommerceCouponCode, ecommerceOrderStatus, ecommerceBundleDeal, ecommerceGiftCard, ecommerceBackInStock, + ecommerceRatingBreakdown, ].forEach(registerTemplate); // Job diff --git a/src/templates/saas/comparison.ts b/src/templates/saas/comparison.ts index 79bf3aa..5d62ac3 100644 --- a/src/templates/saas/comparison.ts +++ b/src/templates/saas/comparison.ts @@ -42,15 +42,15 @@ const template: TemplateDefinition = { const beforeLabel = String(params.beforeLabel || 'Before'); const afterLabel = String(params.afterLabel || 'After'); const beforeItems = [ - String(params.beforeItem1 || 'Manual processes'), - String(params.beforeItem2 || 'Slow deployments'), - String(params.beforeItem3 || 'No visibility'), - ]; + String(params.beforeItem1 ?? 'Manual processes'), + String(params.beforeItem2 ?? 'Slow deployments'), + String(params.beforeItem3 ?? 'No visibility'), + ].filter((item) => item.trim()); const afterItems = [ - String(params.afterItem1 || 'Fully automated'), - String(params.afterItem2 || '10x faster shipping'), - String(params.afterItem3 || 'Real-time insights'), - ]; + String(params.afterItem1 ?? 'Fully automated'), + String(params.afterItem2 ?? '10x faster shipping'), + String(params.afterItem3 ?? 'Real-time insights'), + ].filter((item) => item.trim()); const siteName = String(params.siteName || ''); const bgColor = String(params.bgColor || '#0f172a'); const accentColor = String(params.accentColor || '#10b981'); diff --git a/src/templates/saas/pricing-highlight.ts b/src/templates/saas/pricing-highlight.ts index fdd5081..99444d2 100644 --- a/src/templates/saas/pricing-highlight.ts +++ b/src/templates/saas/pricing-highlight.ts @@ -41,11 +41,11 @@ const template: TemplateDefinition = { const price = truncate(String(params.price || '$29'), 12); const period = String(params.period || '/month'); const features = [ - String(params.feature1 || 'Unlimited projects'), - String(params.feature2 || 'Priority support'), - String(params.feature3 || 'Advanced analytics'), - String(params.feature4 || 'Custom integrations'), - ]; + String(params.feature1 ?? 'Unlimited projects'), + String(params.feature2 ?? 'Priority support'), + String(params.feature3 ?? 'Advanced analytics'), + String(params.feature4 ?? 'Custom integrations'), + ].filter((feature) => feature.trim()); const siteName = String(params.siteName || ''); const bgColor = String(params.bgColor || '#0f172a'); const accentColor = String(params.accentColor || '#6366f1'); diff --git a/src/templates/saas/social-proof.ts b/src/templates/saas/social-proof.ts index 587dd76..001b42a 100644 --- a/src/templates/saas/social-proof.ts +++ b/src/templates/saas/social-proof.ts @@ -39,12 +39,12 @@ const template: TemplateDefinition = { const title = truncate(String(params.title || 'Used by the Best Teams'), 50); const description = params.description ? truncate(String(params.description), 100) : ''; const companies = [ - String(params.company1 || 'Stripe'), - String(params.company2 || 'Vercel'), - String(params.company3 || 'Linear'), - String(params.company4 || 'Notion'), - String(params.company5 || 'Figma'), - ]; + String(params.company1 ?? 'Stripe'), + String(params.company2 ?? 'Vercel'), + String(params.company3 ?? 'Linear'), + String(params.company4 ?? 'Notion'), + String(params.company5 ?? 'Figma'), + ].filter((company) => company.trim()); const trustText = String(params.trustText || 'Trusted by 10,000+ teams worldwide'); const siteName = String(params.siteName || ''); const bgColor = String(params.bgColor || '#0f172a'); diff --git a/tests/ai/normalize-autofill-url.test.ts b/tests/ai/normalize-autofill-url.test.ts new file mode 100644 index 0000000..7326c74 --- /dev/null +++ b/tests/ai/normalize-autofill-url.test.ts @@ -0,0 +1,23 @@ +import { describe, expect, it } from 'vitest'; +import { normalizeAutofillUrl } from '@/lib/ai/normalize-autofill-url'; + +describe('normalizeAutofillUrl', () => { + it.each([ + 'https://example.com', + 'http://example.com', + 'HTTPS://example.com', + 'HTTP://example.com', + 'hTtPs://example.com/Case?key=Value#Section', + ])('preserves an existing HTTP(S) scheme: %s', (url) => { + expect(normalizeAutofillUrl(url)).toBe(url); + }); + + it.each(['example.com', 'httpbin.org', 'https-example.com/path'])('adds HTTPS to the bare domain %s', (url) => { + expect(normalizeAutofillUrl(url)).toBe(`https://${url}`); + }); + + it('trims surrounding whitespace before checking or adding a scheme', () => { + expect(normalizeAutofillUrl(' HTTPS://example.com \n')).toBe('HTTPS://example.com'); + expect(normalizeAutofillUrl(' httpbin.org \n')).toBe('https://httpbin.org'); + }); +}); diff --git a/tests/api/ai-autofill.test.ts b/tests/api/ai-autofill.test.ts new file mode 100644 index 0000000..ea8466f --- /dev/null +++ b/tests/api/ai-autofill.test.ts @@ -0,0 +1,168 @@ +import { afterEach, beforeEach, describe, it, expect, vi } from 'vitest'; +import type { MetaTags } from '@/lib/meta-fetcher'; + +vi.mock('@/lib/meta-fetcher', () => ({ + fetchMetaTags: vi.fn(), +})); + +const { POST } = await import('@/pages/api/ai/autofill'); +const { fetchMetaTags } = await import('@/lib/meta-fetcher'); + +const VALID = { + provider: 'openai', + apiKey: 'sk-test', + model: 'gpt-4o-mini', + url: 'https://example.com', +}; + +const META: MetaTags = { + title: 'Example', + ogTitle: 'Example', + description: 'An example page', + ogDescription: 'An example page', + themeColor: '#123456', +} as MetaTags; + +// Picks a real template that is not the fallback id, so the success test can +// tell the AI's choice apart from the 'blog-minimal-dark' rewrite below. +const AI_JSON = JSON.stringify({ + templateId: 'product-minimal-badge', + fields: { title: 'Example', description: 'An example page' }, + colors: { bgColor: '#123456', accentColor: '#ffffff' }, +}); + +function post(body: unknown, raw?: string) { + const request = new Request('http://localhost:4321/api/ai/autofill', { + method: 'POST', + headers: { 'Content-Type': 'application/json' }, + body: raw ?? JSON.stringify(body), + }); + return POST({ request } as Parameters<NonNullable<typeof POST>>[0]); +} + +function openAiReply(content: string, status = 200) { + return new Response( + JSON.stringify({ choices: [{ message: { content } }] }), + { status } + ); +} + +describe('POST /api/ai/autofill', () => { + beforeEach(() => { + vi.mocked(fetchMetaTags).mockResolvedValue(META); + vi.stubGlobal('fetch', vi.fn()); + }); + + afterEach(() => { + vi.unstubAllGlobals(); + vi.resetAllMocks(); + }); + + it('returns 400 when the body is not JSON', async () => { + const res = await post(null, 'this is not json {'); + + expect(res.status).toBe(400); + expect(await res.json()).toEqual({ error: 'Invalid JSON body' }); + }); + + it.each([ + [{ ...VALID, provider: 'not-a-provider' }, 'provider'], + [{ ...VALID, apiKey: '' }, 'apiKey'], + [{ ...VALID, url: 'not-a-url' }, 'url'], + [{ provider: 'openai', apiKey: 'sk-test', model: 'gpt-4o-mini' }, 'url'], + [{ url: 'https://example.com' }, 'provider'], + ])('returns 400 naming the bad field (%j)', async (body, field) => { + const res = await post(body); + + expect(res.status).toBe(400); + const json = await res.json(); + expect(json.error).toContain(`${field}:`); + expect(fetchMetaTags).not.toHaveBeenCalled(); + }); + + it('returns 502 and never calls the provider when the page fetch fails', async () => { + vi.mocked(fetchMetaTags).mockRejectedValue(new Error('network down')); + const fetchSpy = vi.mocked(fetch); + + const res = await post(VALID); + + expect(res.status).toBe(502); + expect(await res.json()).toEqual({ error: 'Could not fetch the URL' }); + expect(fetchSpy).not.toHaveBeenCalled(); + }); + + it.each([401, 403])('maps a provider %i answer to 401 Invalid API key', async (status) => { + vi.mocked(fetch).mockResolvedValue(new Response('denied', { status })); + + const res = await post(VALID); + + expect(res.status).toBe(401); + expect(await res.json()).toEqual({ error: 'Invalid API key' }); + }); + + it('maps another provider error to 502 with the status', async () => { + vi.mocked(fetch).mockResolvedValue(new Response('oops', { status: 500 })); + + const res = await post(VALID); + + expect(res.status).toBe(502); + expect(await res.json()).toEqual({ error: 'AI provider error (500)' }); + }); + + it('returns 502 when the provider reply has no usable JSON', async () => { + vi.mocked(fetch).mockResolvedValue(openAiReply('sorry, I cannot help with that')); + + const res = await post(VALID); + + expect(res.status).toBe(502); + expect(await res.json()).toEqual({ error: 'Could not parse AI response' }); + }); + + it('falls back to blog-minimal-dark when the AI picks an unknown template', async () => { + vi.mocked(fetch).mockResolvedValue( + openAiReply( + JSON.stringify({ templateId: 'does-not-exist', fields: { title: 'Example' } }) + ) + ); + + const res = await post(VALID); + + expect(res.status).toBe(200); + const json = await res.json(); + expect(json.templateId).toBe('blog-minimal-dark'); + expect(json.fields).toEqual({ title: 'Example' }); + }); + + it('returns 200 with templateId, fields and colors when everything works', async () => { + vi.mocked(fetch).mockResolvedValue(openAiReply(AI_JSON)); + + const res = await post(VALID); + + expect(res.status).toBe(200); + const json = await res.json(); + expect(json.templateId).toBe('product-minimal-badge'); + expect(json.fields).toEqual({ title: 'Example', description: 'An example page' }); + expect(json.colors).toEqual({ bgColor: '#123456', accentColor: '#ffffff' }); + expect(fetchMetaTags).toHaveBeenCalledWith('https://example.com'); + }); + + it('sends the api key in the request URL for google', async () => { + const fetchSpy = vi.mocked(fetch).mockResolvedValue( + new Response( + JSON.stringify({ + candidates: [{ content: { parts: [{ text: AI_JSON }] } }], + modelVersion: 'gemini-2.0-flash', + }), + { status: 200 } + ) + ); + + const res = await post({ ...VALID, provider: 'google', model: 'gemini-2.0-flash' }); + + expect(res.status).toBe(200); + const [calledUrl, init] = fetchSpy.mock.calls[0] as [string, RequestInit]; + expect(calledUrl).toContain('?key=sk-test'); + expect(calledUrl).toContain('gemini-2.0-flash:generateContent'); + expect(JSON.stringify(init.headers)).not.toContain('sk-test'); + }); +}); diff --git a/tests/api/visitors.test.ts b/tests/api/visitors.test.ts new file mode 100644 index 0000000..1a0a819 --- /dev/null +++ b/tests/api/visitors.test.ts @@ -0,0 +1,129 @@ +import { afterEach, describe, expect, it, vi } from 'vitest'; + +// astro:env/server is a Vite virtual module, so it is mocked the same way +// tests/middleware.test.ts mocks astro:middleware. +const mocks = vi.hoisted(() => ({ + getSecret: vi.fn<(key: string) => string | undefined>(), +})); + +vi.mock('astro:env/server', () => ({ + getSecret: mocks.getSecret, +})); + +const { GET, POST } = await import('@/pages/api/visitors'); + +const context = {} as Parameters<NonNullable<typeof GET>>[0]; + +const URL_SECRET = 'UPSTASH_REDIS_REST_URL'; +const TOKEN_SECRET = 'UPSTASH_REDIS_REST_TOKEN'; + +function setSecrets(url: string | undefined, token: string | undefined) { + mocks.getSecret.mockImplementation((key: string) => { + if (key === URL_SECRET) return url; + if (key === TOKEN_SECRET) return token; + return undefined; + }); +} + +describe('/api/visitors without Upstash secrets', () => { + afterEach(() => { + vi.unstubAllGlobals(); + mocks.getSecret.mockReset(); + }); + + it.each([ + ['neither', undefined, undefined], + ['only the URL', 'https://example.upstash.io', undefined], + ['only the token', undefined, 'token'], + ])('GET answers 204 and calls no fetch when %s is set', async (_case, url, token) => { + const fetchSpy = vi.fn(); + vi.stubGlobal('fetch', fetchSpy); + setSecrets(url, token); + + const res = await GET(context); + + expect(res.status).toBe(204); + expect(await res.text()).toBe(''); + expect(fetchSpy).not.toHaveBeenCalled(); + }); + + it.each([ + ['neither', undefined, undefined], + ['only the URL', 'https://example.upstash.io', undefined], + ['only the token', undefined, 'token'], + ])('POST answers 204 and calls no fetch when %s is set', async (_case, url, token) => { + const fetchSpy = vi.fn(); + vi.stubGlobal('fetch', fetchSpy); + setSecrets(url, token); + + const res = await POST(context); + + expect(res.status).toBe(204); + expect(await res.text()).toBe(''); + expect(fetchSpy).not.toHaveBeenCalled(); + }); +}); + +describe('/api/visitors with Upstash secrets set', () => { + afterEach(() => { + vi.unstubAllGlobals(); + mocks.getSecret.mockReset(); + }); + + it('GET returns the stored counts', async () => { + setSecrets('https://example.upstash.io', 'token'); + const fetchSpy = vi.fn().mockResolvedValue( + new Response(JSON.stringify([{ result: '7' }, { result: '123' }]), { status: 200 }) + ); + vi.stubGlobal('fetch', fetchSpy); + + const res = await GET(context); + + expect(res.status).toBe(200); + expect(await res.json()).toEqual({ today: 7, total: 123 }); + expect(fetchSpy).toHaveBeenCalledWith( + 'https://example.upstash.io/pipeline', + expect.objectContaining({ method: 'POST' }) + ); + }); + + it('POST increments and returns the counts', async () => { + setSecrets('https://example.upstash.io', 'token'); + const fetchSpy = vi.fn().mockResolvedValue( + new Response(JSON.stringify({ result: [7, 123] }), { status: 200 }) + ); + vi.stubGlobal('fetch', fetchSpy); + + const res = await POST(context); + + expect(res.status).toBe(200); + expect(await res.json()).toEqual({ today: 7, total: 123 }); + expect(fetchSpy).toHaveBeenCalledWith( + 'https://example.upstash.io', + expect.objectContaining({ method: 'POST' }) + ); + }); + + it('POST stays a 500 when Upstash answers with an error', async () => { + setSecrets('https://example.upstash.io', 'token'); + vi.stubGlobal( + 'fetch', + vi.fn().mockResolvedValue(new Response('upstream error', { status: 500 })) + ); + + const res = await POST(context); + + expect(res.status).toBe(500); + expect(await res.json()).toEqual({ today: 0, total: 0 }); + }); + + it('GET stays a 500 when the Upstash request throws', async () => { + setSecrets('https://example.upstash.io', 'token'); + vi.stubGlobal('fetch', vi.fn().mockRejectedValue(new Error('network down'))); + + const res = await GET(context); + + expect(res.status).toBe(500); + expect(await res.json()).toEqual({ today: 0, total: 0 }); + }); +}); diff --git a/tests/components/fix-it-button.test.ts b/tests/components/fix-it-button.test.ts new file mode 100644 index 0000000..4149ace --- /dev/null +++ b/tests/components/fix-it-button.test.ts @@ -0,0 +1,81 @@ +import { describe, it, expect, vi, beforeEach, afterEach } from 'vitest'; +import { FixItButton } from '@/components/preview/FixItButton'; + +describe('FixItButton copy notification behavior', () => { + let showToastMock: ReturnType<typeof vi.fn>; + let mockExecCommand: ReturnType<typeof vi.fn>; + let mockAppendChild: ReturnType<typeof vi.fn>; + let mockRemoveChild: ReturnType<typeof vi.fn>; + let createdTextarea: { value: string; select: ReturnType<typeof vi.fn> } | null; + + beforeEach(() => { + createdTextarea = null; + showToastMock = vi.fn(); + mockExecCommand = vi.fn(); + mockAppendChild = vi.fn((el) => el); + mockRemoveChild = vi.fn((el) => el); + + vi.stubGlobal('window', { showToast: showToastMock }); + vi.stubGlobal('navigator', {}); // Clipboard API unavailable by default + vi.stubGlobal('document', { + createElement: vi.fn((tag: string) => { + if (tag === 'textarea') { + createdTextarea = { value: '', select: vi.fn() }; + return createdTextarea; + } + return {}; + }), + body: { + appendChild: mockAppendChild, + removeChild: mockRemoveChild, + }, + execCommand: mockExecCommand, + }); + }); + + afterEach(() => { + vi.unstubAllGlobals(); + vi.restoreAllMocks(); + }); + + function getCopyButton(meta = { ogTitle: 'Test Title', ogDescription: 'Test Desc' }) { + const tree = FixItButton({ meta }); + // Structure: div.fix-it-section -> [h3, p, div.fix-it-actions] + const actionsDiv = tree.props.children[2]; + // actionsDiv children: [a.fix-it-btn-primary, button.fix-it-btn-ghost] + const copyBtn = actionsDiv.props.children[1]; + return copyBtn; + } + + it('shows error notification and never reports success when execCommand returns false', async () => { + mockExecCommand.mockReturnValue(false); + const copyBtn = getCopyButton(); + + await copyBtn.props.onClick(); + + expect(showToastMock).toHaveBeenCalledWith('Could not copy meta tags', 'error'); + expect(showToastMock).not.toHaveBeenCalledWith(expect.anything(), 'success'); + }); + + it('shows error notification and never reports success when execCommand throws', async () => { + mockExecCommand.mockImplementation(() => { + throw new Error('execCommand copy disabled'); + }); + const copyBtn = getCopyButton(); + + await copyBtn.props.onClick(); + + expect(showToastMock).toHaveBeenCalledWith('Could not copy meta tags', 'error'); + expect(showToastMock).not.toHaveBeenCalledWith(expect.anything(), 'success'); + }); + + it('shows success notification only when copy succeeds', async () => { + mockExecCommand.mockReturnValue(true); + const copyBtn = getCopyButton(); + + await copyBtn.props.onClick(); + + expect(showToastMock).toHaveBeenCalledWith('Recommended meta tags copied!', 'success'); + expect(showToastMock).not.toHaveBeenCalledWith(expect.anything(), 'error'); + }); +}); diff --git a/tests/editor/export-bar-copy.test.ts b/tests/editor/export-bar-copy.test.ts new file mode 100644 index 0000000..bfea443 --- /dev/null +++ b/tests/editor/export-bar-copy.test.ts @@ -0,0 +1,171 @@ +import { describe, it, expect, vi, beforeEach, afterEach } from 'vitest'; + +const hooks = vi.hoisted(() => ({ + copied: null as string | null, + setCopied: vi.fn(), + effects: [] as (() => void)[], +})); + +vi.mock('react', () => ({ + default: { + createElement: (type: any, props: any, ...children: any[]) => ({ type, props: { ...props, children } }), + }, + useState: (initial: any) => [initial, hooks.setCopied], + useRef: (current: unknown) => ({ current }), + useCallback: (callback: unknown) => callback, + useEffect: (effect: () => void) => { + hooks.effects.push(effect); + }, +})); + +const { ExportBar } = await import('@/components/editor/ExportBar'); + +describe('ExportBar copy notifications and fallback failure', () => { + let showToastMock: ReturnType<typeof vi.fn>; + let mockExecCommand: ReturnType<typeof vi.fn>; + let mockAppendChild: ReturnType<typeof vi.fn>; + let mockRemoveChild: ReturnType<typeof vi.fn>; + let keydownListeners: ((e: any) => void)[]; + let createdTextarea: { value: string; select: ReturnType<typeof vi.fn> } | null; + + beforeEach(() => { + createdTextarea = null; + showToastMock = vi.fn(); + mockExecCommand = vi.fn(); + mockAppendChild = vi.fn((el) => el); + mockRemoveChild = vi.fn((el) => el); + keydownListeners = []; + hooks.setCopied.mockClear(); + hooks.effects.length = 0; + + vi.stubGlobal('window', { showToast: showToastMock }); + vi.stubGlobal('navigator', {}); // Modern clipboard unavailable + vi.stubGlobal('document', { + createElement: vi.fn((tag: string) => { + if (tag === 'textarea') { + createdTextarea = { value: '', select: vi.fn() }; + return createdTextarea; + } + return {}; + }), + body: { + appendChild: mockAppendChild, + removeChild: mockRemoveChild, + }, + execCommand: mockExecCommand, + addEventListener: vi.fn((event: string, listener: (e: any) => void) => { + if (event === 'keydown') keydownListeners.push(listener); + }), + removeEventListener: vi.fn(), + }); + }); + + afterEach(() => { + vi.unstubAllGlobals(); + vi.restoreAllMocks(); + }); + + function renderBar() { + const tree = ExportBar({ + apiUrl: 'https://example.com/api/og?title=Test', + downloadUrl: 'https://example.com/api/og?title=Test', + params: { title: 'Test' }, + templateId: 'saas-maintenance', + svg: null, + }); + hooks.effects.forEach((effect) => effect()); + // Structure: div.export-bar -> div.export-buttons -> [downloadBtn, copyUrlBtn, copyMetaBtn] + const buttonsContainer = tree.props.children; + const buttons = buttonsContainer.props.children; + return { + copyUrlBtn: buttons[1], + copyMetaBtn: buttons[2], + }; + } + + it('shows error notification and never reports success when execCommand returns false on Copy Image URL', async () => { + mockExecCommand.mockReturnValue(false); + const { copyUrlBtn } = renderBar(); + + await copyUrlBtn.props.onClick(); + + expect(showToastMock).toHaveBeenCalledWith('Could not copy URL', 'error'); + expect(showToastMock).not.toHaveBeenCalledWith(expect.anything(), 'success'); + expect(hooks.setCopied).not.toHaveBeenCalledWith('url'); + }); + + it('shows error notification and never reports success when execCommand throws on Copy Image URL', async () => { + mockExecCommand.mockImplementation(() => { + throw new Error('execCommand copy disabled'); + }); + const { copyUrlBtn } = renderBar(); + + await copyUrlBtn.props.onClick(); + + expect(showToastMock).toHaveBeenCalledWith('Could not copy URL', 'error'); + expect(showToastMock).not.toHaveBeenCalledWith(expect.anything(), 'success'); + expect(hooks.setCopied).not.toHaveBeenCalledWith('url'); + }); + + it('shows error notification and never reports success when execCommand returns false on Copy Meta Tags', async () => { + mockExecCommand.mockReturnValue(false); + const { copyMetaBtn } = renderBar(); + + await copyMetaBtn.props.onClick(); + + expect(showToastMock).toHaveBeenCalledWith('Could not copy meta tags', 'error'); + expect(showToastMock).not.toHaveBeenCalledWith(expect.anything(), 'success'); + expect(hooks.setCopied).not.toHaveBeenCalledWith('meta'); + }); + + it('shows error notification and never reports success when execCommand throws on Copy Meta Tags', async () => { + mockExecCommand.mockImplementation(() => { + throw new Error('execCommand copy disabled'); + }); + const { copyMetaBtn } = renderBar(); + + await copyMetaBtn.props.onClick(); + + expect(showToastMock).toHaveBeenCalledWith('Could not copy meta tags', 'error'); + expect(showToastMock).not.toHaveBeenCalledWith(expect.anything(), 'success'); + expect(hooks.setCopied).not.toHaveBeenCalledWith('meta'); + }); + + it('handles Ctrl/Cmd+Shift+C keyboard shortcut when fallback fails', async () => { + mockExecCommand.mockReturnValue(false); + renderBar(); + + const event = { + key: 'C', + shiftKey: true, + ctrlKey: true, + metaKey: false, + preventDefault: vi.fn(), + }; + for (const listener of keydownListeners) { + listener(event); + } + await Promise.resolve(); + + expect(event.preventDefault).toHaveBeenCalled(); + expect(showToastMock).toHaveBeenCalledWith('Could not copy URL', 'error'); + expect(showToastMock).not.toHaveBeenCalledWith(expect.anything(), 'success'); + expect(hooks.setCopied).not.toHaveBeenCalledWith('url'); + }); + + it('reports success when copy succeeds', async () => { + mockExecCommand.mockReturnValue(true); + const { copyUrlBtn, copyMetaBtn } = renderBar(); + + await copyUrlBtn.props.onClick(); + expect(showToastMock).toHaveBeenCalledWith('URL copied to clipboard!', 'success'); + expect(hooks.setCopied).toHaveBeenCalledWith('url'); + + showToastMock.mockClear(); + hooks.setCopied.mockClear(); + + await copyMetaBtn.props.onClick(); + expect(showToastMock).toHaveBeenCalledWith('Meta tags copied!', 'success'); + expect(hooks.setCopied).toHaveBeenCalledWith('meta'); + }); +}); diff --git a/tests/editor/satori-renderer.test.ts b/tests/editor/satori-renderer.test.ts new file mode 100644 index 0000000..7f102d6 --- /dev/null +++ b/tests/editor/satori-renderer.test.ts @@ -0,0 +1,54 @@ +import { afterEach, describe, expect, it, vi } from 'vitest'; + +const hooks = vi.hoisted(() => ({ setters: [] as ReturnType<typeof vi.fn>[], effects: [] as (() => void)[] })); +const satori = vi.hoisted(() => vi.fn()); +vi.mock('satori', () => ({ default: satori })); +// Exercise the hook's asynchronous callbacks without adding a DOM dependency. +vi.mock('react', () => ({ + useState: () => { + const setter = vi.fn(); + hooks.setters.push(setter); + return [null, setter]; + }, + useRef: (current: unknown) => ({ current }), + useCallback: (callback: unknown) => callback, + useEffect: (effect: () => void) => hooks.effects.push(effect), +})); + +function deferred() { + let resolve!: (value: string) => void; + let reject!: (error: Error) => void; + const promise = new Promise<string>((res, rej) => { resolve = res; reject = rej; }); + return { promise, resolve, reject }; +} + +afterEach(() => { + vi.unstubAllGlobals(); + vi.resetModules(); + hooks.setters.length = 0; + hooks.effects.length = 0; + satori.mockReset(); +}); + +describe('useSatoriRenderer render ordering', () => { + it.each(['success', 'failure'])('ignores an older %s that finishes after the latest render', async (outcome) => { + vi.stubGlobal('fetch', vi.fn(async () => ({ arrayBuffer: async () => new ArrayBuffer(8) }))); + const { useSatoriRenderer } = await import('@/components/editor/useSatoriRenderer'); + const renderer = useSatoriRenderer(); + hooks.effects.forEach((effect) => effect()); + await vi.waitFor(() => expect(hooks.setters[1]).toHaveBeenCalledWith(false)); + const older = deferred(); + const latest = deferred(); + satori.mockReturnValueOnce(older.promise).mockReturnValueOnce(latest.promise); + renderer.render({ logo: 'slow-logo.png' }); + renderer.render({ logo: '' }); + latest.resolve('<svg>latest</svg>'); + await vi.waitFor(() => expect(hooks.setters[0]).toHaveBeenCalledWith('<svg>latest</svg>')); + if (outcome === 'success') older.resolve('<svg>old logo</svg>'); + else older.reject(new Error('Old logo failed')); + await older.promise.catch(() => {}); + await Promise.resolve(); + expect(hooks.setters[0].mock.calls).toEqual([['<svg>latest</svg>']]); + expect(hooks.setters[2].mock.calls).toEqual([[null]]); + }); +}); diff --git a/tests/lib/clipboard.test.ts b/tests/lib/clipboard.test.ts new file mode 100644 index 0000000..f63caf4 --- /dev/null +++ b/tests/lib/clipboard.test.ts @@ -0,0 +1,147 @@ +import { describe, it, expect, vi, beforeEach, afterEach } from 'vitest'; +import { copyToClipboard } from '@/lib/clipboard'; + +describe('copyToClipboard', () => { + let mockAppendChild: ReturnType<typeof vi.fn>; + let mockRemoveChild: ReturnType<typeof vi.fn>; + let mockExecCommand: ReturnType<typeof vi.fn>; + let mockSelect: ReturnType<typeof vi.fn>; + let createdTextarea: { value: string; select: ReturnType<typeof vi.fn> } | null; + + beforeEach(() => { + createdTextarea = null; + mockAppendChild = vi.fn((el) => el); + mockRemoveChild = vi.fn((el) => el); + mockExecCommand = vi.fn(); + mockSelect = vi.fn(); + + vi.stubGlobal('document', { + createElement: vi.fn((tag: string) => { + if (tag === 'textarea') { + createdTextarea = { value: '', select: mockSelect }; + return createdTextarea; + } + return {}; + }), + body: { + appendChild: mockAppendChild, + removeChild: mockRemoveChild, + }, + execCommand: mockExecCommand, + }); + }); + + afterEach(() => { + vi.unstubAllGlobals(); + vi.restoreAllMocks(); + }); + + describe('when navigator.clipboard is available and succeeds', () => { + it('uses navigator.clipboard.writeText and does not use fallback', async () => { + const writeText = vi.fn().mockResolvedValue(undefined); + vi.stubGlobal('navigator', { clipboard: { writeText } }); + + const result = await copyToClipboard('test text'); + + expect(result).toBe(true); + expect(writeText).toHaveBeenCalledWith('test text'); + expect(mockExecCommand).not.toHaveBeenCalled(); + expect(mockAppendChild).not.toHaveBeenCalled(); + }); + }); + + describe('fallback when navigator.clipboard is unavailable', () => { + beforeEach(() => { + vi.stubGlobal('navigator', {}); + }); + + it('returns true when document.execCommand succeeds', async () => { + mockExecCommand.mockReturnValue(true); + + const result = await copyToClipboard('fallback text'); + + expect(result).toBe(true); + expect(createdTextarea?.value).toBe('fallback text'); + expect(mockSelect).toHaveBeenCalled(); + expect(mockExecCommand).toHaveBeenCalledWith('copy'); + expect(mockAppendChild).toHaveBeenCalledWith(createdTextarea); + expect(mockRemoveChild).toHaveBeenCalledWith(createdTextarea); + }); + + it('returns false and cleans up textarea when document.execCommand returns false', async () => { + mockExecCommand.mockReturnValue(false); + + const result = await copyToClipboard('fallback text'); + + expect(result).toBe(false); + expect(mockExecCommand).toHaveBeenCalledWith('copy'); + expect(mockAppendChild).toHaveBeenCalledWith(createdTextarea); + expect(mockRemoveChild).toHaveBeenCalledWith(createdTextarea); + }); + + it('returns false and cleans up textarea when document.execCommand throws', async () => { + mockExecCommand.mockImplementation(() => { + throw new Error('execCommand copy failed'); + }); + + const result = await copyToClipboard('fallback text'); + + expect(result).toBe(false); + expect(mockAppendChild).toHaveBeenCalledWith(createdTextarea); + expect(mockRemoveChild).toHaveBeenCalledWith(createdTextarea); + }); + }); + + describe('fallback when navigator.clipboard.writeText rejects', () => { + it('falls back to execCommand and returns false when execCommand returns false', async () => { + const writeText = vi.fn().mockRejectedValue(new Error('Permission denied')); + vi.stubGlobal('navigator', { clipboard: { writeText } }); + mockExecCommand.mockReturnValue(false); + + const result = await copyToClipboard('fallback text'); + + expect(result).toBe(false); + expect(writeText).toHaveBeenCalledWith('fallback text'); + expect(mockExecCommand).toHaveBeenCalledWith('copy'); + expect(mockAppendChild).toHaveBeenCalledWith(createdTextarea); + expect(mockRemoveChild).toHaveBeenCalledWith(createdTextarea); + }); + + it('falls back to execCommand and returns false when execCommand throws', async () => { + const writeText = vi.fn().mockRejectedValue(new Error('Permission denied')); + vi.stubGlobal('navigator', { clipboard: { writeText } }); + mockExecCommand.mockImplementation(() => { + throw new Error('execCommand threw'); + }); + + const result = await copyToClipboard('fallback text'); + + expect(result).toBe(false); + expect(writeText).toHaveBeenCalledWith('fallback text'); + expect(mockAppendChild).toHaveBeenCalledWith(createdTextarea); + expect(mockRemoveChild).toHaveBeenCalledWith(createdTextarea); + }); + + it('falls back to execCommand and returns true when execCommand succeeds', async () => { + const writeText = vi.fn().mockRejectedValue(new Error('Permission denied')); + vi.stubGlobal('navigator', { clipboard: { writeText } }); + mockExecCommand.mockReturnValue(true); + + const result = await copyToClipboard('fallback text'); + + expect(result).toBe(true); + expect(writeText).toHaveBeenCalledWith('fallback text'); + expect(mockExecCommand).toHaveBeenCalledWith('copy'); + expect(mockAppendChild).toHaveBeenCalledWith(createdTextarea); + expect(mockRemoveChild).toHaveBeenCalledWith(createdTextarea); + }); + }); + + it('returns false when neither clipboard nor document is available', async () => { + vi.stubGlobal('navigator', undefined); + vi.stubGlobal('document', undefined); + + const result = await copyToClipboard('test'); + expect(result).toBe(false); + }); +}); diff --git a/tests/lib/meta-fetcher.test.ts b/tests/lib/meta-fetcher.test.ts index 01fc9fc..6d825e5 100644 --- a/tests/lib/meta-fetcher.test.ts +++ b/tests/lib/meta-fetcher.test.ts @@ -1,6 +1,7 @@ import { describe, it, expect, vi, afterEach } from 'vitest'; import { fetchMetaTags, parseMetaTags } from '@/lib/meta-fetcher'; import { analyzeMeta } from '@/lib/meta-analyzer'; +import { HTML_ENTITIES } from '@/lib/html-entities'; describe('parseMetaTags', () => { const base = 'https://example.com/page'; @@ -97,6 +98,53 @@ describe('parseMetaTags', () => { expect(tags.description).toBe('a &bogus; b'); }); + it('decodes typographic named entities in a title and keeps it under the length limit', () => { + const tags = parseMetaTags( + '<title>Don’t ship on Fridays — notes from 200 releases | Acme Blog', + base, + ); + expect(tags.title).toBe('Don\u2019t ship on Fridays \u2014 notes from 200 releases | Acme Blog'); + expect(analyzeMeta(tags).issues.some((issue) => issue.tag === 'title')).toBe(false); + }); + + it.each([ + ['…', '\u2026'], ['“', '\u201c'], ['”', '\u201d'], + ['é', '\u00e9'], ['É', '\u00c9'], ['©', '\u00a9'], + ['™', '\u2122'], ['€', '\u20ac'], + ['½', '\u00bd'], ['²', '\u00b2'], ['∴', '\u2234'], + ['⟨', '\u27e8'], ['⟩', '\u27e9'], + ])('decodes %s in attribute values', (entity, character) => { + const tags = parseMetaTags(``, base); + expect(tags.description).toBe(`a ${character} b`); + }); + + it('decodes every table entry in titles and attribute values', () => { + for (const [name, character] of Object.entries(HTML_ENTITIES)) { + const title = parseMetaTags(`[&${name};]`, base).title; + const description = parseMetaTags(``, base).description; + expect(title, name).toBe(`[${character}]`); + expect(description, name).toBe(`[${character}]`); + } + }); + + it('covers the 252 HTML 4 names plus apos and the four uppercase names', () => { + expect(Object.keys(HTML_ENTITIES)).toHaveLength(257); + }); + + it('keeps entity names case-sensitive', () => { + const tags = parseMetaTags('', base); + expect(tags.description).toBe('\u00e9 \u00c9 &EACUTE; &Frac12;'); + }); + + it('leaves prototype property names like &constructor;, &toString;, &hasOwnProperty;, and &valueOf; as they are', () => { + const tags = parseMetaTags( + 'a &constructor; b', + base, + ); + expect(tags.title).toBe('a &constructor; b'); + expect(tags.description).toBe('&toString; &hasOwnProperty; &valueOf;'); + }); + it('decodes entities in the title', () => { const tags = parseMetaTags('Tom & Jerry's', base); expect(tags.title).toBe("Tom & Jerry's"); @@ -110,6 +158,20 @@ describe('parseMetaTags', () => { expect(tags.title).toBe(''); }); + it('collapses multiline indentation, internal tabs, and double spaces in title while preserving non-ASCII whitespace', () => { + const tags = parseMetaTags( + ` + Cutting\t\tcold starts in half with Fluid Compute + | Acme Blog + `, + base, + ); + expect(tags.title).toBe('Cutting cold starts in\u00a0half with Fluid Compute | Acme Blog'); + + const boundaryTags = parseMetaTags(' Hello world ', base); + expect(boundaryTags.title).toBe('\u00A0Hello world\u00A0'); + }); + it('does not decode uppercase or mixed-case entities that are not valid in HTML', () => { const tags = parseMetaTags( '', @@ -233,3 +295,238 @@ describe('canonical and favicon attribute order', () => { expect(tags.ogImage).toBe('https://example.com/posts/hello/cover.png'); }); }); + +describe('parseMetaTags – HTML comment stripping (issue #389)', () => { + const base = 'https://example.com/page'; + + it('ignores a commented-out before the live title', () => { + const html = ` + <!-- <title>Wrong Title --> + Correct Title + `; + const tags = parseMetaTags(html, base); + expect(tags.title).toBe('Correct Title'); + }); + + it('does not overwrite a live og:title with a commented-out one that follows it', () => { + const html = ` + + + `; + const tags = parseMetaTags(html, base); + expect(tags.ogTitle).toBe('Real OG Title'); + }); + + it('does not overwrite live og:description with a later commented-out one', () => { + const html = ` + + + `; + const tags = parseMetaTags(html, base); + expect(tags.ogDescription).toBe('Live description'); + }); + + it('does not overwrite live og:image with a later commented-out one', () => { + const html = ` + + + `; + const tags = parseMetaTags(html, base); + expect(tags.ogImage).toBe('https://example.com/live.png'); + }); + + it('ignores a commented-out canonical link before the live one', () => { + const html = ` + + + `; + const tags = parseMetaTags(html, base); + expect(tags.canonical).toBe('https://example.com/correct'); + }); + + it('ignores a commented-out favicon link before the live one', () => { + const html = ` + + + `; + const tags = parseMetaTags(html, base); + expect(tags.favicon).toBe('https://example.com/correct-favicon.ico'); + }); + + it('still parses all normal active metadata when no comments are present', () => { + const html = ` + Page Title + + + + + + + `; + const tags = parseMetaTags(html, base); + expect(tags.title).toBe('Page Title'); + expect(tags.description).toBe('Page description'); + expect(tags.ogTitle).toBe('OG Title'); + expect(tags.ogDescription).toBe('OG Description'); + expect(tags.ogImage).toBe('https://example.com/image.png'); + expect(tags.canonical).toBe('https://example.com/page'); + expect(tags.favicon).toBe('https://example.com/favicon.ico'); + }); + + it('handles multi-line HTML comments correctly', () => { + const html = ` + + Active Title + + `; + const tags = parseMetaTags(html, base); + expect(tags.title).toBe('Active Title'); + expect(tags.ogTitle).toBe('Active OG'); + }); +}); + +describe('parseMetaTags – script element stripping (issue #394)', () => { + const base = 'https://example.com/page'; + + it('ignores fake , <meta>, and <link rel="canonical"> inside scripts before real tags', () => { + const html = ` + <script> + const fakeTitle = '<title>Script Title'; + const fakeDesc = ''; + const fakeOgTitle = ''; + const fakeCanonical = ''; + + Real Title + + + + `; + const tags = parseMetaTags(html, base); + expect(tags.title).toBe('Real Title'); + expect(tags.description).toBe('Real Description'); + expect(tags.ogTitle).toBe('Real OG Title'); + expect(tags.canonical).toBe('https://example.com/real'); + }); + + it('does not allow fake metadata inside scripts after real tags to overwrite real metadata', () => { + const html = ` + Real Title + + + + + + + `; + const tags = parseMetaTags(html, base); + expect(tags.title).toBe('Real Title'); + expect(tags.ogTitle).toBe('Real OG Title'); + expect(tags.ogDescription).toBe('Real OG Description'); + expect(tags.ogImage).toBe('https://example.com/real.png'); + expect(tags.twitterCard).toBe('summary_large_image'); + expect(tags.canonical).toBe('https://example.com/real'); + }); + + it('extracts nothing when metadata tags only appear inside scripts', () => { + const html = ` + + `; + const tags = parseMetaTags(html, base); + expect(tags.title).toBeUndefined(); + expect(tags.ogTitle).toBeUndefined(); + expect(tags.canonical).toBeUndefined(); + }); + + it('handles multiple scripts, scripts with attributes, mixed-case tags, and application/ld+json', () => { + const html = ` + + Real Page Title + + + + + + `; + const tags = parseMetaTags(html, base); + expect(tags.title).toBe('Real Page Title'); + expect(tags.ogTitle).toBe('Real Page OG'); + expect(tags.description).toBe('Real Page Description'); + expect(tags.canonical).toBe('https://example.com/real-url'); + }); + + it('handles multiline script elements with arbitrary attributes', () => { + const html = ` + + Actual Title + + + + `; + const tags = parseMetaTags(html, base); + expect(tags.title).toBe('Actual Title'); + expect(tags.ogTitle).toBe('Actual OG'); + expect(tags.twitterTitle).toBe('Actual Twitter'); + expect(tags.canonical).toBe('https://example.com/actual'); + }); + + it('preserves existing parsing behavior and precedence for tags outside scripts', () => { + const html = ` + + First Real Title + + Second Real Title + + + + + + + + + `; + const tags = parseMetaTags(html, base); + // First title wins outside scripts + expect(tags.title).toBe('First Real Title'); + // Later meta tags overwrite earlier ones outside scripts + expect(tags.ogTitle).toBe('Second OG Title'); + // First canonical wins outside scripts + expect(tags.canonical).toBe('https://example.com/first-real-canon'); + }); +}); diff --git a/tests/templates/build-in-public.test.ts b/tests/templates/build-in-public.test.ts new file mode 100644 index 0000000..34bae28 --- /dev/null +++ b/tests/templates/build-in-public.test.ts @@ -0,0 +1,153 @@ +import { describe, expect, it } from 'vitest'; +import buildInPublic from '@/templates/developer/build-in-public'; +import { developerBuildInPublic } from '@/templates/developer'; +import { getTemplate, getTemplatesByCategory } from '@/templates/registry'; +import type { SatoriElement } from '@/templates/types'; + +function elements(node: unknown): SatoriElement[] { + if (Array.isArray(node)) return node.flatMap(elements); + if (!node || typeof node !== 'object' || !('type' in node)) return []; + + const element = node as SatoriElement; + return [element, ...elements(element.props.children)]; +} + +function textContent(node: unknown): string[] { + if (typeof node === 'string') return [node]; + if (Array.isArray(node)) return node.flatMap(textContent); + if (node && typeof node === 'object' && 'props' in node) { + return textContent((node as SatoriElement).props.children); + } + return []; +} + +const render = (overrides: Record = {}) => + buildInPublic.render({ ...buildInPublic.defaults, ...overrides }); + +describe('developer-build-in-public', () => { + it('is re-exported and registered once in the developer category', () => { + expect(developerBuildInPublic).toBe(buildInPublic); + expect(getTemplate('developer-build-in-public')).toBe(buildInPublic); + expect(getTemplatesByCategory('developer').filter(({ id }) => id === 'developer-build-in-public')).toHaveLength(1); + }); + + it('renders defaults with title, period pill, metric value, label, green change chip, note, site name, and 6 bars', () => { + const tree = render(); + const text = textContent(tree); + + expect(text).toContain('Invoice Kit'); + expect(text).toContain('Month 7'); + expect(text).toContain('$2,480'); + expect(text).toContain('MRR'); + expect(text).toContain('+18% from last month'); + expect(text).toContain('312 paying customers, 2.1% churn'); + expect(text).toContain('codercops.com'); + + // Find the chart container and bars + const allDivs = elements(tree); + const bars = allDivs.filter((el) => el.props.style?.width === '42px'); + expect(bars).toHaveLength(6); + + // Last bar should be accent color + const lastBar = bars[5]; + expect(lastBar.props.style?.backgroundColor).toBe('#34d399'); + + // Change chip should have green background in default dark mode + const chip = allDivs.find((el) => textContent(el).includes('+18% from last month') && el.props.style?.borderRadius === '8px'); + expect(chip).toBeDefined(); + expect(chip?.props.style?.backgroundColor).toBe('#052e16'); + }); + + it('handles negative, non-numeric, trailing commas, and keeps only the last 6 entries', () => { + const tree = render({ + history: '100, 200, 300, invalid, -50, , 400, 500, 600, 700, 800, 900,', + }); + const bars = elements(tree).filter((el) => el.props.style?.width === '42px'); + expect(bars).toHaveLength(6); + + // The last 6 validly sliced entries from [100, 200, 300, 0, 0, 400, 500, 600, 700, 800, 900] are [400, 500, 600, 700, 800, 900] + // 900 is the largest, so height is CHART_HEIGHT (200px) + expect(bars[5].props.style?.height).toBe('200px'); + }); + + it('renders short equal stubs when all values in history are 0 instead of disappearing', () => { + const tree = render({ + history: '0, 0, 0, 0, 0, 0', + }); + const bars = elements(tree).filter((el) => el.props.style?.width === '42px'); + expect(bars).toHaveLength(6); + for (const bar of bars) { + expect(bar.props.style?.height).toBe('12px'); + } + }); + + it('hides the chart completely and lets the left column take full width when history is empty', () => { + const tree = render({ history: '' }); + const bars = elements(tree).filter((el) => el.props.style?.width === '42px'); + expect(bars).toHaveLength(0); + + const leftCol = elements(tree).find((el) => el.props.style?.flex === '1 1 100%'); + expect(leftCol).toBeDefined(); + }); + + it('hides period, metricLabel, change, and note cleanly without leaving empty containers', () => { + const tree = render({ + period: '', + metricLabel: '', + change: '', + note: '', + }); + const text = textContent(tree); + + expect(text).not.toContain('Month 7'); + expect(text).not.toContain('MRR'); + expect(text).not.toContain('+18% from last month'); + expect(text).not.toContain('312 paying customers, 2.1% churn'); + expect(text).toContain('Invoice Kit'); + expect(text).toContain('$2,480'); + }); + + it('formats red change chip when change starts with - and neutral otherwise', () => { + const redTree = render({ change: '-5% churn spike' }); + const redChip = elements(redTree).find((el) => textContent(el).includes('-5% churn spike') && el.props.style?.borderRadius === '8px'); + expect(redChip?.props.style?.backgroundColor).toBe('#450a0a'); + + const neutralTree = render({ change: 'steady this month' }); + const neutralChip = elements(neutralTree).find((el) => textContent(el).includes('steady this month') && el.props.style?.borderRadius === '8px'); + expect(neutralChip?.props.style?.backgroundColor).not.toBe('#450a0a'); + expect(neutralChip?.props.style?.backgroundColor).not.toBe('#052e16'); + }); + + it('renders cleanly on light backgrounds with readable colors', () => { + const tree = render({ + bgColor: '#ffffff', + textColor: '#111827', + accentColor: '#10b981', + change: '+25% ARR', + }); + const allDivs = elements(tree); + const chip = allDivs.find((el) => textContent(el).includes('+25% ARR') && el.props.style?.borderRadius === '8px'); + expect(chip?.props.style?.backgroundColor).toBe('#dcfce7'); + expect(chip?.props.style?.color).toBe('#15803d'); + }); + + it('falls back to default metric value when blank or cleared', () => { + const tree = render({ metricValue: '' }); + expect(textContent(tree)).toContain('$2,480'); + }); + + it('handles long title, large metric value, and long note without breaking layout', () => { + const tree = render({ + title: 'A Very Long Product Project Name That Exceeds Normal Limits', + metricValue: '$1,250,000', + note: 'A very long explanatory note describing customer growth and retention across all subscription tiers in detail', + }); + const text = textContent(tree); + expect(text.some((t) => t.includes('$1,250,000'))).toBe(true); + expect(text.some((t) => t.includes('A very long explanatory note describing customer growth and retention'))).toBe(true); + + const noteEl = elements(tree).find((el) => el.props.style?.whiteSpace === 'nowrap' && el.props.style?.overflow === 'hidden'); + expect(noteEl).toBeDefined(); + expect(noteEl?.props.style?.textOverflow).toBe('ellipsis'); + }); +}); diff --git a/tests/templates/comparison.test.ts b/tests/templates/comparison.test.ts new file mode 100644 index 0000000..2e5da5f --- /dev/null +++ b/tests/templates/comparison.test.ts @@ -0,0 +1,29 @@ +import { describe, expect, it } from 'vitest'; +import template from '@/templates/saas/comparison'; +import type { SatoriElement } from '@/templates/types'; + +function textContent(node: unknown): string[] { + if (typeof node === 'string') return [node]; + if (Array.isArray(node)) return node.flatMap(textContent); + if (node && typeof node === 'object' && 'props' in node) { + return textContent((node as SatoriElement).props.children); + } + return []; +} + +const text = (params: Record) => textContent(template.render({ ...template.defaults, ...params })); + +describe('saas-comparison', () => { + it('shows every item by default', () => { + expect(text({})).toEqual(expect.arrayContaining(['Manual processes', 'No visibility', 'Fully automated', 'Real-time insights'])); + }); + + it('leaves out a cleared item', () => { + const shown = text({ beforeItem1: 'Spreadsheets', beforeItem2: '', beforeItem3: '', afterItem1: 'One dashboard', afterItem2: '', afterItem3: '' }); + + expect(shown).toContain('Spreadsheets'); + expect(shown).toContain('One dashboard'); + expect(shown).not.toContain('Slow deployments'); + expect(shown).not.toContain('10x faster shipping'); + }); +}); diff --git a/tests/templates/feature-grid.test.ts b/tests/templates/feature-grid.test.ts new file mode 100644 index 0000000..4625c50 --- /dev/null +++ b/tests/templates/feature-grid.test.ts @@ -0,0 +1,28 @@ +import { describe, expect, it } from 'vitest'; +import template from '@/templates/product/feature-grid'; +import type { SatoriElement } from '@/templates/types'; + +function textContent(node: unknown): string[] { + if (typeof node === 'string') return [node]; + if (Array.isArray(node)) return node.flatMap(textContent); + if (node && typeof node === 'object' && 'props' in node) { + return textContent((node as SatoriElement).props.children); + } + return []; +} + +const text = (params: Record) => textContent(template.render({ ...template.defaults, ...params })); + +describe('product-feature-grid', () => { + it('shows every feature by default', () => { + expect(text({})).toEqual(expect.arrayContaining(['Lightning Fast', 'Secure by Default', 'Easy Integration', 'Real-time Sync'])); + }); + + it('leaves out a cleared feature', () => { + const shown = text({ feature1: 'Offline mode', feature2: '', feature3: '', feature4: '' }); + + expect(shown).toContain('Offline mode'); + expect(shown).not.toContain('Secure by Default'); + expect(shown).not.toContain('Real-time Sync'); + }); +}); diff --git a/tests/templates/mailbag.test.ts b/tests/templates/mailbag.test.ts new file mode 100644 index 0000000..fc8be46 --- /dev/null +++ b/tests/templates/mailbag.test.ts @@ -0,0 +1,235 @@ +import { describe, expect, it } from 'vitest'; +import newsletterMailbag from '@/templates/newsletter/mailbag'; +import { newsletterMailbag as newsletterMailbagExport } from '@/templates/newsletter'; +import { getTemplate, getTemplatesByCategory } from '@/templates/registry'; +import type { SatoriElement } from '@/templates/types'; + +function walk(node: unknown, visit: (element: SatoriElement) => void): void { + if (Array.isArray(node)) { + node.forEach((child) => walk(child, visit)); + return; + } + if (!node || typeof node !== 'object' || !('type' in node)) return; + + const element = node as SatoriElement; + visit(element); + walk(element.props.children, visit); +} + +function textContent(node: unknown): string[] { + if (typeof node === 'string') return [node]; + if (Array.isArray(node)) return node.flatMap(textContent); + if (node && typeof node === 'object' && 'props' in node) { + return textContent((node as SatoriElement).props.children); + } + return []; +} + +function allElements(node: unknown): SatoriElement[] { + const found: SatoriElement[] = []; + walk(node, (element) => found.push(element)); + return found; +} + +const tree = (overrides: Record = {}) => + newsletterMailbag.render({ ...newsletterMailbag.defaults, ...overrides }); + +describe('newsletter-mailbag', () => { + it('is re-exported and registered exactly once in the newsletter category', () => { + expect(newsletterMailbagExport).toBe(newsletterMailbag); + expect(getTemplate('newsletter-mailbag')).toBe(newsletterMailbag); + expect( + getTemplatesByCategory('newsletter').filter((t) => t.id === 'newsletter-mailbag'), + ).toHaveLength(1); + }); + + it('renders the defaults with site name, issue, Mailbag pill, title, and three question rows with askers', () => { + const rendered = tree(); + const texts = textContent(rendered); + + expect(texts).toContain('The Friday Diff'); + expect(texts).toContain('Issue 58'); + expect(texts).toContain('Mailbag'); + expect(texts).toContain('Your questions about going freelance'); + expect(texts).toContain('How did you find your first client?'); + expect(texts).toContain('Sam, Lisbon'); + expect(texts).toContain('What do you charge for a small project?'); + expect(texts).toContain('Priya'); + expect(texts).toContain('Do you still take full-time offers?'); + expect(texts).toContain('A reader in Toronto'); + + // Check for 3 'Q' circles + const qCircles = allElements(rendered).filter( + (el) => el.type === 'div' && el.props.children === 'Q', + ); + expect(qCircles).toHaveLength(3); + }); + + it('drops a question row completely when its question is blank, closing up remaining rows', () => { + const rendered = tree({ + question2: ' ', + asker2: 'Should Be Dropped', + }); + const texts = textContent(rendered); + + expect(texts).toContain('How did you find your first client?'); + expect(texts).toContain('Sam, Lisbon'); + expect(texts).not.toContain('What do you charge for a small project?'); + expect(texts).not.toContain('Should Be Dropped'); + expect(texts).toContain('Do you still take full-time offers?'); + expect(texts).toContain('A reader in Toronto'); + + // Only 2 Q circles remain + const qCircles = allElements(rendered).filter( + (el) => el.type === 'div' && el.props.children === 'Q', + ); + expect(qCircles).toHaveLength(2); + }); + + it('drops the question list completely when all three questions are blank', () => { + const rendered = tree({ + question1: '', + question2: '', + question3: '', + asker1: 'Asker 1', + asker2: 'Asker 2', + asker3: 'Asker 3', + }); + const texts = textContent(rendered); + + expect(texts).toContain('The Friday Diff'); + expect(texts).toContain('Issue 58'); + expect(texts).toContain('Mailbag'); + expect(texts).toContain('Your questions about going freelance'); + expect(texts).not.toContain('Asker 1'); + expect(texts).not.toContain('Asker 2'); + expect(texts).not.toContain('Asker 3'); + + // 0 Q circles remain + const qCircles = allElements(rendered).filter( + (el) => el.type === 'div' && el.props.children === 'Q', + ); + expect(qCircles).toHaveLength(0); + }); + + it('lets the question use the full row width when its asker is blank', () => { + const rendered = tree({ + asker1: '', + }); + const texts = textContent(rendered); + expect(texts).not.toContain('Sam, Lisbon'); + + // Find the row for question 1 + const rows = allElements(rendered).filter( + (el) => el.type === 'div' && el.props.style?.borderRadius === '14px', + ); + expect(rows).toHaveLength(3); + + // First row should have 2 children: [Q circle, questionSpan], no askerSpan + const row1Children = rows[0].props.children as SatoriElement[]; + expect(row1Children).toHaveLength(2); + expect(row1Children[1].props.style?.flex).toBe(1); + }); + + it('shrinks a long title with autoFontSize() and caps at two lines', () => { + const longTitle = 'An Exceptionally Long Newsletter Mailbag Edition Title About Launching Your Solo Consulting Practice'; + const shortTitle = 'Mailbag'; + + const longRendered = tree({ title: longTitle }); + const shortRendered = tree({ title: shortTitle }); + + const longH1 = allElements(longRendered).find((el) => el.type === 'h1'); + const shortH1 = allElements(shortRendered).find((el) => el.type === 'h1'); + + const longSize = parseInt(String(longH1?.props.style?.fontSize ?? '0'), 10); + const shortSize = parseInt(String(shortH1?.props.style?.fontSize ?? '0'), 10); + + expect(shortSize).toBeGreaterThan(longSize); + expect(longH1?.props.style?.overflow).toBe('hidden'); + expect(longH1?.props.style?.lineClamp).toBe(2); + expect(longH1?.props.style?.display).toBe('block'); + expect(longH1?.props.style?.whiteSpace).toBeUndefined(); + }); + + it('truncates a long question on one line with an ellipsis before reaching the asker', () => { + const longQuestion = 'How exactly did you manage to get your first paying client when you had zero previous portfolio items or testimonials? '.repeat(2); + const rendered = tree({ question1: longQuestion }); + + const qSpan = allElements(rendered).find( + (el) => el.type === 'span' && textContent(el).some((t) => t.startsWith('How exactly did you manage')), + ); + expect(qSpan).toBeDefined(); + expect(qSpan?.props.style?.whiteSpace).toBe('nowrap'); + expect(qSpan?.props.style?.overflow).toBe('hidden'); + expect(qSpan?.props.style?.textOverflow).toBe('ellipsis'); + expect(qSpan?.props.style?.flex).toBe(1); + expect(textContent(qSpan)[0].length).toBeLessThanOrEqual(120); + expect(textContent(qSpan)[0]).toMatch(/…$/); + }); + + it('truncates a long asker on one line while keeping most of the row for the question', () => { + const longAsker = 'Alexander Montgomery-Fitzgerald the Third, VP of Engineering'; + const rendered = tree({ asker1: longAsker }); + + const askerSpan = allElements(rendered).find( + (el) => el.type === 'span' && textContent(el).some((t) => t.startsWith('Alexander')), + ); + expect(askerSpan).toBeDefined(); + expect(askerSpan?.props.style?.maxWidth).toBe('320px'); + expect(askerSpan?.props.style?.overflow).toBe('hidden'); + expect(askerSpan?.props.style?.textOverflow).toBe('ellipsis'); + expect(askerSpan?.props.style?.whiteSpace).toBe('nowrap'); + expect(textContent(askerSpan)[0]).toHaveLength(40); + expect(textContent(askerSpan)[0]).toMatch(/…$/); + }); + + it('omits siteName or issue cleanly without leaving an awkward gap', () => { + const noSite = tree({ siteName: '' }); + const noIssue = tree({ issue: '' }); + const noHeader = tree({ siteName: '', issue: '' }); + + expect(textContent(noSite)).not.toContain('The Friday Diff'); + expect(textContent(noSite)).toContain('Issue 58'); + + expect(textContent(noIssue)).toContain('The Friday Diff'); + expect(textContent(noIssue)).not.toContain('Issue 58'); + + expect(textContent(noHeader)).not.toContain('The Friday Diff'); + expect(textContent(noHeader)).not.toContain('Issue 58'); + }); + + it('renders cleanly on a light background with readable pill, Q circles, and askers', () => { + const rendered = tree({ + bgColor: '#ffffff', + textColor: '#111827', + accentColor: '#e07a5f', + }); + + // Pill color + const pillSpan = allElements(rendered).find( + (el) => el.type === 'span' && el.props.children === 'Mailbag', + ); + expect(pillSpan).toBeDefined(); + const pillColor = String(pillSpan?.props.style?.color ?? '').toLowerCase(); + expect(pillColor).not.toBe('#ffffff'); + expect(pillColor).not.toBe('#fff'); + + // Q circle border & text color + const qCircle = allElements(rendered).find( + (el) => el.type === 'div' && el.props.children === 'Q', + ); + expect(qCircle).toBeDefined(); + const qColor = String(qCircle?.props.style?.color ?? '').toLowerCase(); + expect(qColor).not.toBe('#ffffff'); + expect(qColor).not.toBe('#fff'); + + // Asker color + const askerSpan = allElements(rendered).find( + (el) => el.type === 'span' && textContent(el).includes('Sam, Lisbon'), + ); + expect(askerSpan).toBeDefined(); + const askerColor = String(askerSpan?.props.style?.color ?? '').toLowerCase(); + expect(askerColor).not.toBe('#ffffff'); + expect(askerColor).not.toBe('#fff'); + }); +}); diff --git a/tests/templates/previews.test.ts b/tests/templates/previews.test.ts new file mode 100644 index 0000000..4e2422a --- /dev/null +++ b/tests/templates/previews.test.ts @@ -0,0 +1,60 @@ +// Renders the templates a PR adds or changes to PNG files, so a review can look +// at them. The "Template previews" workflow runs this with PREVIEW_FILES set to +// the changed template files. A plain `npm run test` skips it. +import { describe, it, expect } from 'vitest'; +import { readFileSync, writeFileSync, mkdirSync } from 'node:fs'; +import { join, resolve } from 'node:path'; +import satori from 'satori'; +import { Resvg } from '@resvg/resvg-js'; +import { getTemplate } from '@/templates/registry'; +import type { TemplateDefinition } from '@/templates/types'; + +const files = (process.env.PREVIEW_FILES ?? '').split(/\s+/).filter(Boolean); +const out = process.env.PREVIEW_OUT ?? 'previews'; + +const fonts = ([ + ['Inter-Regular.woff', 'Inter', 400], + ['Inter-Medium.woff', 'Inter', 500], + ['Inter-SemiBold.woff', 'Inter', 600], + ['Inter-Bold.woff', 'Inter', 700], + ['PlayfairDisplay-Regular.woff', 'Playfair Display', 400], + ['PlayfairDisplay-Bold.woff', 'Playfair Display', 700], + ['JetBrainsMono-Regular.woff', 'JetBrains Mono', 400], + ['JetBrainsMono-Bold.woff', 'JetBrains Mono', 700], +] as const).map(([file, name, weight]) => ({ + name, + weight, + style: 'normal' as const, + data: readFileSync(join(process.cwd(), 'public/fonts', file)), +})); + +const LONG = 'A fairly long piece of text that keeps going and going '.repeat(6).trim(); + +// The same four cases a review checks by hand. +function variants(template: TemplateDefinition): Record> { + const text = template.fields.filter((f) => f.type === 'text' || f.type === 'textarea'); + return { + defaults: {}, + empty: Object.fromEntries(text.filter((f) => !f.required).map((f) => [f.key, ''])), + long: Object.fromEntries(text.map((f) => [f.key, LONG])), + light: { bgColor: '#ffffff', textColor: '#111111' }, + }; +} + +describe.skipIf(files.length === 0)('template previews', () => { + it.each(files.length ? files : ['none'])('renders %s', async (file) => { + const template: TemplateDefinition | undefined = (await import(resolve(process.cwd(), file))).default; + expect(template?.id, `${file} has no default export with an id`).toBeTruthy(); + expect(getTemplate(template!.id), `${template!.id} isn't registered in src/templates/registry.ts`).toBeDefined(); + + mkdirSync(out, { recursive: true }); + for (const [name, overrides] of Object.entries(variants(template!))) { + const svg = await satori(template!.render({ ...template!.defaults, ...overrides }) as any, { + width: 1200, + height: 630, + fonts, + }); + writeFileSync(join(out, `${template!.id}--${name}.png`), new Resvg(svg).render().asPng()); + } + }); +}); diff --git a/tests/templates/pricing-highlight.test.ts b/tests/templates/pricing-highlight.test.ts index 9fa69c5..a6de5ac 100644 --- a/tests/templates/pricing-highlight.test.ts +++ b/tests/templates/pricing-highlight.test.ts @@ -2,6 +2,7 @@ import { describe, expect, it } from 'vitest'; import { readFileSync } from 'node:fs'; import satori, { type SatoriNode } from 'satori'; import pricingHighlight from '@/templates/saas/pricing-highlight'; +import type { SatoriElement } from '@/templates/types'; const fonts = ['Inter-Regular', 'Inter-SemiBold', 'Inter-Bold'].map((file) => ({ name: 'Inter', @@ -21,6 +22,15 @@ async function layout(price: string) { return { priceNode, period, innerRight: card.left + card.width - 40 }; } +function textContent(node: unknown): string[] { + if (typeof node === 'string') return [node]; + if (Array.isArray(node)) return node.flatMap(textContent); + if (node && typeof node === 'object' && 'props' in node) { + return textContent((node as SatoriElement).props.children); + } + return []; +} + describe('saas-pricing-highlight', () => { it('keeps the default price at 56px', async () => { expect((await layout('$29')).priceNode.props.style.fontSize).toBe('56px'); @@ -32,4 +42,14 @@ describe('saas-pricing-highlight', () => { expect(period.left).toBeGreaterThanOrEqual(priceNode.left + priceNode.width); expect(period.left + period.width).toBeLessThanOrEqual(innerRight); }); + + it('leaves out a cleared feature', () => { + const shown = textContent( + pricingHighlight.render({ ...pricingHighlight.defaults, feature1: '5 projects', feature2: 'Email support', feature3: '', feature4: '' }), + ); + + expect(shown).toEqual(expect.arrayContaining(['5 projects', 'Email support'])); + expect(shown).not.toContain('Advanced analytics'); + expect(shown).not.toContain('Custom integrations'); + }); }); diff --git a/tests/templates/rating-breakdown.test.ts b/tests/templates/rating-breakdown.test.ts new file mode 100644 index 0000000..5321dc9 --- /dev/null +++ b/tests/templates/rating-breakdown.test.ts @@ -0,0 +1,202 @@ +import { describe, expect, it } from 'vitest'; +import ratingBreakdown from '@/templates/ecommerce/rating-breakdown'; +import { getTemplate, getTemplatesByCategory } from '@/templates/registry'; +import { mixColors } from '@/templates/utils'; +import type { SatoriElement } from '@/templates/types'; + +function elements(node: unknown): SatoriElement[] { + if (Array.isArray(node)) return node.flatMap(elements); + if (!node || typeof node !== 'object' || !('type' in node)) return []; + + const element = node as SatoriElement; + return [element, ...elements(element.props.children)]; +} + +function textContent(node: unknown): string[] { + if (typeof node === 'string') return [node]; + if (Array.isArray(node)) return node.flatMap(textContent); + if (node && typeof node === 'object' && 'props' in node) { + return textContent((node as SatoriElement).props.children); + } + return []; +} + +const render = (overrides: Record = {}) => + ratingBreakdown.render({ ...ratingBreakdown.defaults, ...overrides }); + +// One rating row: a star label, a bar track, and a percentage label. +const rows = (tree: unknown) => elements(tree).filter((element) => + element.type === 'div' && + element.props.style?.width === '100%' && + !element.props.style?.flexDirection && + Array.isArray(element.props.children) && + element.props.children.length === 3); +const fills = (tree: unknown) => rows(tree).map( + (row) => ((row.props.children as SatoriElement[])[1].props.children as SatoriElement[])[0]); +const starFills = (tree: unknown) => elements(tree) + .filter((element) => element.type === 'svg') + .map((star) => star.props.children.props.fill); + +describe('ecommerce-rating-breakdown', () => { + it('is re-exported and registered once in the ecommerce category', async () => { + const exports = await import('@/templates/ecommerce'); + expect(exports.ecommerceRatingBreakdown).toBe(ratingBreakdown); + expect(getTemplate('ecommerce-rating-breakdown')).toBe(ratingBreakdown); + expect(getTemplatesByCategory('ecommerce').filter(({ id }) => id === 'ecommerce-rating-breakdown')) + .toHaveLength(1); + }); + + it('declares the five optional count fields with min 0 and the documented defaults', () => { + const countFields = ratingBreakdown.fields.filter(({ key }) => /^count[1-5]$/.test(key)); + + expect(countFields.map(({ key }) => key)).toEqual(['count5', 'count4', 'count3', 'count2', 'count1']); + for (const field of countFields) { + expect(field.type).toBe('number'); + expect(field.min).toBe(0); + expect(field.required).toBeFalsy(); + } + expect(ratingBreakdown.defaults).toMatchObject({ + title: 'Trail Runner 2', + count5: 742, + count4: 351, + count3: 110, + count2: 44, + count1: 37, + }); + }); + + it('renders the derived score, four gold stars, the review count, and the rounded percentages', () => { + const tree = render(); + const text = textContent(tree); + + expect(text).toContain('Trail Runner 2'); + expect(text).toContain('4.3'); + expect(text).toContain('1,284 reviews'); + expect(text).toContain('codercops.com'); + expect(fills(tree).map(({ props }) => props.style.width)) + .toEqual(['58%', '27%', '9%', '3%', '3%']); + expect(rows(tree).map((row) => textContent((row.props.children as SatoriElement[])[0])[0])) + .toEqual(['5 stars', '4 stars', '3 stars', '2 stars', '1 star']); + expect(rows(tree).map((row) => textContent((row.props.children as SatoriElement[])[2])[0])) + .toEqual(['58%', '27%', '9%', '3%', '3%']); + + const stars = starFills(tree); + expect(stars).toHaveLength(5); + expect(stars.filter((color) => color === '#F5C518')).toHaveLength(4); + expect(stars[4]).not.toBe('#F5C518'); + expect(JSON.stringify(tree)).not.toContain('NaN'); + }); + + it('counts blank, negative, and non-numeric values as 0 without disagreeing with the totals', () => { + const tree = render({ count5: '', count4: -10, count3: 'abc', count2: ' ', count1: 1 }); + const text = textContent(tree); + + expect(text).toContain('1.0'); + expect(text).toContain('1 review'); + expect(text).not.toContain('1,284 reviews'); + expect(fills(tree).map(({ props }) => props.style.width)) + .toEqual(['0%', '0%', '0%', '0%', '100%']); + expect(text).toContain('100%'); + expect(JSON.stringify(tree)).not.toContain('NaN'); + }); + + it('keeps the stars in step with the displayed score when the raw average rounds up', () => { + const tree = render({ count5: 47, count4: 53, count3: 0, count2: 0, count1: 0 }); + const text = textContent(tree); + + // 47 five-star + 53 four-star reviews average 4.47, which displays as 4.5. + expect(text).toContain('4.5'); + expect(text).toContain('100 reviews'); + const stars = starFills(tree); + expect(stars).toHaveLength(5); + expect(stars.filter((color) => color === '#F5C518')).toHaveLength(5); + expect(fills(tree).map(({ props }) => props.style.width)) + .toEqual(['47%', '53%', '0%', '0%', '0%']); + expect(JSON.stringify(tree)).not.toContain('NaN'); + }); + + it('replaces the score and stars with "No reviews yet" and empties every bar when all counts are 0', () => { + const tree = render({ count5: 0, count4: '0', count3: '', count2: null, count1: -5 }); + const text = textContent(tree); + + expect(text).toContain('No reviews yet'); + expect(text).not.toContain('4.3'); + expect(starFills(tree)).toHaveLength(0); + expect(fills(tree).map(({ props }) => props.style.width)) + .toEqual(['0%', '0%', '0%', '0%', '0%']); + expect(rows(tree).map((row) => textContent((row.props.children as SatoriElement[])[2])[0])) + .toEqual(['0%', '0%', '0%', '0%', '0%']); + expect(JSON.stringify(tree)).not.toContain('NaN'); + }); + + it('shrinks a long title with autoFontSize and then truncates it on one line', () => { + const short = elements(render()).find((element) => element.type === 'h1'); + const tree = render({ title: 'Trail Runner '.repeat(20) }); + const title = elements(tree).find((element) => element.type === 'h1'); + + expect(short?.props.style.fontSize).toBe('46px'); + expect(textContent(title)[0]).toHaveLength(120); + expect(textContent(title)[0]).toMatch(/…$/); + expect(title?.props.style.fontSize).toBe('28px'); + expect(title?.props.style.whiteSpace).toBe('nowrap'); + expect(title?.props.style.overflow).toBe('hidden'); + expect(title?.props.style.textOverflow).toBe('ellipsis'); + }); + + it('keeps a review count in the millions intact and readable', () => { + const tree = render({ count5: 1250000, count4: 0, count3: 0, count2: 0, count1: 0 }); + const count = elements(tree).find((element) => + element.type === 'span' && textContent(element)[0]?.endsWith('reviews')); + + expect(textContent(count)[0]).toBe('1,250,000 reviews'); + expect(textContent(count)[0]).not.toMatch(/…/); + expect(count?.props.style.whiteSpace).toBe('nowrap'); + expect(textContent(tree)).toContain('5.0'); + expect(fills(tree).map(({ props }) => props.style.width)) + .toEqual(['100%', '0%', '0%', '0%', '0%']); + }); + + it('keeps bars, tracks, and stars readable on a light background', () => { + const dark = render(); + const accentInk = mixColors('#fde047', '#000000', 0.45); + const tree = render({ bgColor: '#ffffff', textColor: '#111111', accentColor: '#fde047' }); + const title = elements(tree).find((element) => element.type === 'h1'); + const percentLabels = rows(tree).map((row) => (row.props.children as SatoriElement[])[2]); + + expect(starFills(dark).filter((color) => color === '#F5C518')).toHaveLength(4); + expect(fills(dark).every(({ props }) => props.style.backgroundColor === '#E07A5F')).toBe(true); + + expect(accentInk).not.toBe('#fde047'); + expect(fills(tree).every(({ props }) => props.style.backgroundColor === accentInk)).toBe(true); + expect(rows(tree).every((row) => + (row.props.children as SatoriElement[])[1].props.style.backgroundColor === + mixColors('#ffffff', '#111111', 0.13))).toBe(true); + expect(title?.props.style.color).toBe('#111111'); + expect(percentLabels.every((label) => label.props.style.color === '#111111')).toBe(true); + + const stars = starFills(tree); + expect(stars.filter((color) => color === mixColors('#F5C518', '#000000', 0.35))).toHaveLength(4); + expect(stars).not.toContain('#F5C518'); + expect(stars[4]).toBe(mixColors('#ffffff', '#111111', 0.5)); + }); + + it('hides a blank site name cleanly', () => { + const tree = render({ siteName: ' ' }); + expect(textContent(tree)).not.toContain('codercops.com'); + }); + + it('follows the shared template checklist', () => { + const tree = ratingBreakdown.render(ratingBreakdown.defaults); + const all = elements(tree); + + expect(tree.props.style.width).toBe('1200px'); + expect(tree.props.style.height).toBe('630px'); + expect(ratingBreakdown.tags.length).toBeGreaterThanOrEqual(4); + expect(ratingBreakdown.tags.length).toBeLessThanOrEqual(6); + expect(ratingBreakdown.description).toBeTruthy(); + for (const element of all.filter(({ type }) => type === 'div')) { + expect(element.props.style?.display).toBe('flex'); + } + expect(JSON.stringify(tree)).not.toMatch(/[\u{1F300}-\u{1FAFF}]/u); + }); +}); diff --git a/tests/templates/release-notes.test.ts b/tests/templates/release-notes.test.ts new file mode 100644 index 0000000..7961336 --- /dev/null +++ b/tests/templates/release-notes.test.ts @@ -0,0 +1,30 @@ +import { describe, expect, it } from 'vitest'; +import template from '@/templates/github/release-notes'; +import type { SatoriElement } from '@/templates/types'; + +function textContent(node: unknown): string[] { + if (typeof node === 'string') return [node]; + if (Array.isArray(node)) return node.flatMap(textContent); + if (node && typeof node === 'object' && 'props' in node) { + return textContent((node as SatoriElement).props.children); + } + return []; +} + +const text = (params: Record) => textContent(template.render({ ...template.defaults, ...params })); + +describe('github-release-notes', () => { + it('shows all three changes by default', () => { + expect(text({})).toEqual( + expect.arrayContaining(['New plugin system', 'Performance improvements', 'Breaking: Updated API']), + ); + }); + + it('leaves out a cleared change', () => { + const shown = text({ change1: 'Fix login redirect', change2: '', change3: '' }); + + expect(shown).toContain('Fix login redirect'); + expect(shown).not.toContain('Performance improvements'); + expect(shown).not.toContain('Breaking: Updated API'); + }); +}); diff --git a/tests/templates/social-proof.test.ts b/tests/templates/social-proof.test.ts new file mode 100644 index 0000000..aa71220 --- /dev/null +++ b/tests/templates/social-proof.test.ts @@ -0,0 +1,29 @@ +import { describe, expect, it } from 'vitest'; +import template from '@/templates/saas/social-proof'; +import type { SatoriElement } from '@/templates/types'; + +function textContent(node: unknown): string[] { + if (typeof node === 'string') return [node]; + if (Array.isArray(node)) return node.flatMap(textContent); + if (node && typeof node === 'object' && 'props' in node) { + return textContent((node as SatoriElement).props.children); + } + return []; +} + +const text = (params: Record) => textContent(template.render({ ...template.defaults, ...params })); + +describe('saas-social-proof', () => { + it('shows every company by default', () => { + expect(text({})).toEqual(expect.arrayContaining(['Stripe', 'Vercel', 'Linear', 'Notion', 'Figma'])); + }); + + it('leaves out a cleared company', () => { + const shown = text({ company1: 'Acme', company2: 'Orbit', company3: '', company4: '', company5: '' }); + + expect(shown).toContain('Acme'); + expect(shown).toContain('Orbit'); + expect(shown).not.toContain('Linear'); + expect(shown).not.toContain('Figma'); + }); +}); diff --git a/tests/templates/two-takes.test.ts b/tests/templates/two-takes.test.ts new file mode 100644 index 0000000..2861187 --- /dev/null +++ b/tests/templates/two-takes.test.ts @@ -0,0 +1,199 @@ +import { describe, expect, it } from 'vitest'; +import quoteTwoTakesDefault from '@/templates/quote/two-takes'; +import { quoteTwoTakes } from '@/templates/quote'; +import { getTemplate, getTemplatesByCategory } from '@/templates/registry'; +import type { SatoriElement } from '@/templates/types'; + +function elements(node: unknown): SatoriElement[] { + if (Array.isArray(node)) return node.flatMap(elements); + if (!node || typeof node !== 'object' || !('type' in node)) return []; + + const element = node as SatoriElement; + return [element, ...elements(element.props.children)]; +} + +function textContent(node: unknown): string[] { + if (typeof node === 'string') return [node]; + if (Array.isArray(node)) return node.flatMap(textContent); + if (node && typeof node === 'object' && 'props' in node) { + return textContent((node as SatoriElement).props.children); + } + return []; +} + +const render = (overrides: Record = {}) => + quoteTwoTakesDefault.render({ ...quoteTwoTakesDefault.defaults, ...overrides }); + +describe('quote-two-takes', () => { + it('is re-exported and registered once in the quote category', () => { + expect(quoteTwoTakes).toBe(quoteTwoTakesDefault); + expect(getTemplate('quote-two-takes')).toBe(quoteTwoTakesDefault); + expect( + getTemplatesByCategory('quote').filter(({ id }) => id === 'quote-two-takes'), + ).toHaveLength(1); + }); + + it('renders defaults with title, left label, left quote, left author, vs chip, right quote, right author, and site name', () => { + const tree = render(); + const text = textContent(tree); + + expect(text).toContain('Should every team write design docs?'); + expect(text).toContain('Yes'); + expect(text).toContain('Writing it down is the cheapest review you\u2019ll ever get.'); + expect(text).toContain('Dana Whitfield, Engineering Manager'); + expect(text).toContain('vs'); + expect(text).toContain('No'); + expect(text).toContain('Most design docs are read once, by the person who wrote them.'); + expect(text).toContain('Marco Velez, Staff Engineer'); + expect(text).toContain('Dev Panel Weekly'); + }); + + it('falls back to default quote text when leftQuote or rightQuote is blank', () => { + const tree = render({ leftQuote: '', rightQuote: '' }); + const text = textContent(tree); + + expect(text).toContain('Writing it down is the cheapest review you\u2019ll ever get.'); + expect(text).toContain('Most design docs are read once, by the person who wrote them.'); + }); + + it('omits title row entirely when title is blank, with no empty gap', () => { + const tree = render({ title: '' }); + const text = textContent(tree); + + expect(text).not.toContain('Should every team write design docs?'); + // h1 element should not appear + const h1s = elements(tree).filter((el) => el.type === 'h1'); + expect(h1s).toHaveLength(0); + }); + + it('omits label pill when leftLabel or rightLabel is blank, leaving no gap', () => { + const tree = render({ leftLabel: '', rightLabel: '' }); + const text = textContent(tree); + + expect(text).not.toContain('Yes'); + expect(text).not.toContain('No'); + + // The uppercase pill spans should not exist + const pillSpans = elements(tree).filter( + (el) => el.type === 'span' && el.props.style?.textTransform === 'uppercase', + ); + expect(pillSpans).toHaveLength(0); + }); + + it('renders default quotes at 40px font size', () => { + const tree = render(); + const allEls = elements(tree); + const leftSpan = allEls.find( + (el) => el.type === 'span' && textContent(el).some((t) => t.includes('Writing it down')), + ); + expect(leftSpan).toBeDefined(); + expect(leftSpan!.props.style?.fontSize).toBe('40px'); + }); + + it('omits author byline when leftAuthor or rightAuthor is blank', () => { + const tree = render({ leftAuthor: '', rightAuthor: '' }); + const text = textContent(tree); + + expect(text).not.toContain('Dana Whitfield, Engineering Manager'); + expect(text).not.toContain('Marco Velez, Staff Engineer'); + }); + + it('omits site name footer when siteName is blank', () => { + const tree = render({ siteName: '' }); + const text = textContent(tree); + + expect(text).not.toContain('Dev Panel Weekly'); + }); + + it('truncates long quotes at 220 chars without pushing content off-card', () => { + const longQuote = 'A'.repeat(300); + const tree = render({ leftQuote: longQuote, rightQuote: longQuote }); + const text = textContent(tree); + + // The rendered text should not exceed 220 chars (truncated by truncate()) + const leftRendered = text.find((t) => t.startsWith('A') && t.length <= 220); + expect(leftRendered).toBeDefined(); + expect(leftRendered!.length).toBeLessThanOrEqual(220); + }); + + it('uses the same quoteSize for both columns (driven by the longer quote)', () => { + const shortQuote = 'Short.'; + const longQuote = 'A much longer quote that pushes the font size down for both columns.'; + const tree = render({ leftQuote: shortQuote, rightQuote: longQuote }); + + // Both quote spans should share the same fontSize (derived from the longer quote) + const allEls = elements(tree); + // Find spans containing quote text + const leftSpan = allEls.find((el) => el.type === 'span' && textContent(el).includes(shortQuote)); + const rightSpan = allEls.find((el) => el.type === 'span' && textContent(el).includes(longQuote)); + + expect(leftSpan).toBeDefined(); + expect(rightSpan).toBeDefined(); + expect(leftSpan!.props.style?.fontSize).toBe(rightSpan!.props.style?.fontSize); + }); + + it('renders long title truncated to one line with ellipsis style', () => { + const longTitle = 'An Extremely Long Debate Topic Title That Would Normally Overflow The Header Row'; + const tree = render({ title: longTitle.slice(0, 80) }); + + const h1 = elements(tree).find((el) => el.type === 'h1'); + expect(h1).toBeDefined(); + expect(h1!.props.style?.overflow).toBe('hidden'); + expect(h1!.props.style?.textOverflow).toBe('ellipsis'); + expect(h1!.props.style?.whiteSpace).toBe('nowrap'); + }); + + it('renders with a smaller titleSize for longer titles', () => { + const shortTitle = render({ title: 'Short?' }); + const longTitle = render({ title: 'A very long debate topic title that pushes the font size down significantly' }); + + const shortH1 = elements(shortTitle).find((el) => el.type === 'h1'); + const longH1 = elements(longTitle).find((el) => el.type === 'h1'); + + const shortSize = parseInt(String(shortH1?.props.style?.fontSize ?? '0'), 10); + const longSize = parseInt(String(longH1?.props.style?.fontSize ?? '0'), 10); + + expect(shortSize).toBeGreaterThan(longSize); + }); + + it('renders cleanly on a light background with readable label colors (not white on white)', () => { + const tree = render({ + bgColor: '#ffffff', + textColor: '#111827', + accentColor: '#6366f1', + }); + + const allEls = elements(tree); + + // Left label pill color should NOT be close to pure white + const leftLabelSpan = allEls.find( + (el) => el.type === 'span' && textContent(el).includes('Yes') && el.props.style?.fontWeight === 700, + ); + expect(leftLabelSpan).toBeDefined(); + // Color must not be white (#ffffff / #fff) + const color = String(leftLabelSpan!.props.style?.color ?? ''); + expect(color.toLowerCase()).not.toBe('#ffffff'); + expect(color.toLowerCase()).not.toBe('#fff'); + + // vs chip text color must not be white + const vsSpan = allEls.find((el) => el.type === 'span' && textContent(el).includes('vs')); + expect(vsSpan).toBeDefined(); + const vsColor = String(vsSpan!.props.style?.color ?? ''); + expect(vsColor.toLowerCase()).not.toBe('#ffffff'); + expect(vsColor.toLowerCase()).not.toBe('#fff'); + }); + + it('renders "vs" chip with a circular border in the divider', () => { + const tree = render(); + const allEls = elements(tree); + + const vsChip = allEls.find( + (el) => + el.type === 'div' && + el.props.style?.borderRadius === '50%' && + textContent(el).includes('vs'), + ); + expect(vsChip).toBeDefined(); + expect(vsChip!.props.style?.border).toBeDefined(); + }); +}); diff --git a/tests/templates/vscode-theme.test.ts b/tests/templates/vscode-theme.test.ts new file mode 100644 index 0000000..e4a20a6 --- /dev/null +++ b/tests/templates/vscode-theme.test.ts @@ -0,0 +1,24 @@ +import { describe, expect, it } from 'vitest'; +import template from '@/templates/developer/vscode-theme'; +import type { SatoriElement } from '@/templates/types'; + +function spans(node: unknown): SatoriElement[] { + if (Array.isArray(node)) return node.flatMap(spans); + if (node && typeof node === 'object' && 'props' in node) { + const element = node as SatoriElement; + return [...(element.type === 'span' ? [element] : []), ...spans(element.props.children)]; + } + return []; +} + +describe('developer-vscode-theme', () => { + it('keeps the indentation and the space after each colon', () => { + const spaced = spans(template.render(template.defaults)).filter((span) => { + const text = String(span.props.children); + return text !== text.trim(); + }); + + expect(spaced.map((span) => span.props.children)).toEqual(expect.arrayContaining([' ', ' ', ': '])); + for (const span of spaced) expect(span.props.style?.whiteSpace).toBe('pre'); + }); +}); diff --git a/tests/templates/whitespace.test.ts b/tests/templates/whitespace.test.ts new file mode 100644 index 0000000..e33ecea --- /dev/null +++ b/tests/templates/whitespace.test.ts @@ -0,0 +1,24 @@ +import { describe, expect, it } from 'vitest'; +import { getAllTemplates } from '@/templates/registry'; +import type { SatoriElement } from '@/templates/types'; + +/** Text that starts or ends with a space, where no element up the tree keeps white-space. */ +function trimmedText(node: unknown, keepsSpaces = false): string[] { + if (typeof node === 'string') return !keepsSpaces && node !== node.trim() ? [node] : []; + if (Array.isArray(node)) return node.flatMap((child) => trimmedText(child, keepsSpaces)); + if (node && typeof node === 'object' && 'props' in node) { + const { style, children } = (node as SatoriElement).props; + const whiteSpace = style?.whiteSpace; + return trimmedText(children, whiteSpace ? whiteSpace === 'pre' || whiteSpace === 'pre-wrap' : keepsSpaces); + } + return []; +} + +describe('template text', () => { + it.each(getAllTemplates().map((template) => [template.id, template] as const))( + '%s keeps the spaces at the edge of its text', + (_id, template) => { + expect(trimmedText(template.render(template.defaults))).toEqual([]); + }, + ); +});