diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..511eb2f --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,96 @@ +name: release + +# Release @bitcomplete/mdx-components when the version in package.json +# changes on main. Releases are intentional: bump the version in a PR, +# merge, and this workflow releases that exact version — tag vX.Y.Z + +# GitHub Release with the built bundle attached, and (when NPM_TOKEN is +# configured) an npm publish with provenance. +# +# TEMPORARY: npm publish is skipped while the NPM_TOKEN secret is +# absent — the GitHub Release is the artifact channel until the +# @bitcomplete npm org access is sorted. Downstream (pin's +# bump-mdx-bundle workflow) prefers npm and falls back to the GitHub +# Release asset. +# +# Pushes to main that don't change the version are no-ops here (ci.yml +# still tests every push). + +on: + push: + branches: [main] + +permissions: + contents: write + id-token: write # npm provenance attestation + +jobs: + release: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: pnpm/action-setup@v4 + with: + version: 9 + - uses: actions/setup-node@v4 + with: + node-version: "20" + cache: pnpm + registry-url: "https://registry.npmjs.org" + - run: pnpm install --frozen-lockfile + + - name: Check if this version is already released + id: version + env: + GH_TOKEN: ${{ github.token }} + run: | + PKG_VERSION=$(node -p "require('./package.json').version") + echo "version=${PKG_VERSION}" >> "$GITHUB_OUTPUT" + if gh release view "v${PKG_VERSION}" >/dev/null 2>&1; then + echo "publish=false" >> "$GITHUB_OUTPUT" + echo "v${PKG_VERSION} already released; nothing to do" + else + echo "publish=true" >> "$GITHUB_OUTPUT" + fi + + - run: pnpm typecheck + if: steps.version.outputs.publish == 'true' + - run: pnpm test + if: steps.version.outputs.publish == 'true' + - run: pnpm build + if: steps.version.outputs.publish == 'true' + - name: Verify IIFE bundle is self-contained + if: steps.version.outputs.publish == 'true' + run: | + test -f dist/bundle.iife.global.js + node -e "const fs=require('fs');const src=fs.readFileSync('dist/bundle.iife.global.js','utf8');if(!src.includes('compileMDX'))process.exit(1)" + + - name: Check npm token availability + id: npm + env: + NPM_TOKEN: ${{ secrets.NPM_TOKEN }} + run: | + if [ -n "${NPM_TOKEN}" ]; then + echo "available=true" >> "$GITHUB_OUTPUT" + else + echo "available=false" >> "$GITHUB_OUTPUT" + echo "::notice::NPM_TOKEN not configured — skipping npm publish, GitHub Release only" + fi + + - name: Publish to npm + if: steps.version.outputs.publish == 'true' && steps.npm.outputs.available == 'true' + env: + NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} + run: pnpm publish --access public --provenance --no-git-checks + + - name: Tag + GitHub Release + if: steps.version.outputs.publish == 'true' + env: + GH_TOKEN: ${{ github.token }} + run: | + TAG="v${{ steps.version.outputs.version }}" + sha256sum dist/bundle.iife.global.js > dist/bundle.iife.global.js.sha256 + gh release create "${TAG}" \ + dist/bundle.iife.global.js \ + dist/bundle.iife.global.js.sha256 \ + --title "${TAG}" \ + --notes "@bitcomplete/mdx-components ${TAG} (from ${GITHUB_SHA}). npm publish: ${{ steps.npm.outputs.available }}." diff --git a/package.json b/package.json index 42f52b1..9a8e6e4 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "@bitcomplete/mdx-components", - "version": "0.1.0", - "description": "MDX components for agent-generated documents: plans, reports, session summaries. Static HTML output, no React runtime needed in the browser.", + "version": "0.2.0", + "description": "MDX components for agent-generated documents: plans, reports, session summaries. Static HTML output with Agentic Craft visuals, no React runtime needed in the browser.", "keywords": [ "mdx", "components", @@ -36,8 +36,11 @@ "LICENSE" ], "scripts": { - "build": "tsup && cp src/styles.css dist/styles.css", - "dev": "tsup --watch", + "build:css": "tailwindcss -i src/styles/tailwind.css -o dist/styles.css --minify && node scripts/embed-css.mjs", + "build:manifest": "node scripts/extract-manifest.mjs", + "build:js": "tsup", + "build": "pnpm run build:manifest && pnpm run build:css && pnpm run build:js", + "dev": "pnpm run build:manifest && pnpm run build:css && tsup --watch", "test": "vitest run", "test:watch": "vitest", "typecheck": "tsc --noEmit", @@ -45,12 +48,21 @@ "prepublishOnly": "pnpm run build" }, "dependencies": { + "@hugeicons/core-free-icons": "^4.0.0", + "@hugeicons/react": "^1.1.6", "@mdx-js/mdx": "^3.1.0", - "preact": "^10.25.0", - "preact-render-to-string": "^6.5.13" + "clsx": "^2.1.1", + "react": "^19.2.0", + "react-dom": "^19.2.0", + "tailwind-merge": "^3.5.0" }, "devDependencies": { + "@tailwindcss/cli": "^4.2.1", "@types/node": "^22.10.0", + "@types/react": "^19.2.0", + "@types/react-dom": "^19.2.0", + "tailwindcss": "^4.2.1", + "ts-morph": "^28.0.0", "tsup": "^8.3.5", "typescript": "^5.7.2", "vitest": "^2.1.8" diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index c546e71..31bd664 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -8,28 +8,55 @@ importers: .: dependencies: + '@hugeicons/core-free-icons': + specifier: ^4.0.0 + version: 4.2.0 + '@hugeicons/react': + specifier: ^1.1.6 + version: 1.1.6(react@19.2.6) '@mdx-js/mdx': specifier: ^3.1.0 version: 3.1.1 - preact: - specifier: ^10.25.0 - version: 10.29.2 - preact-render-to-string: - specifier: ^6.5.13 - version: 6.7.0(preact@10.29.2) + clsx: + specifier: ^2.1.1 + version: 2.1.1 + react: + specifier: ^19.2.0 + version: 19.2.6 + react-dom: + specifier: ^19.2.0 + version: 19.2.6(react@19.2.6) + tailwind-merge: + specifier: ^3.5.0 + version: 3.6.0 devDependencies: + '@tailwindcss/cli': + specifier: ^4.2.1 + version: 4.3.0 '@types/node': specifier: ^22.10.0 version: 22.19.19 + '@types/react': + specifier: ^19.2.0 + version: 19.2.15 + '@types/react-dom': + specifier: ^19.2.0 + version: 19.2.3(@types/react@19.2.15) + tailwindcss: + specifier: ^4.2.1 + version: 4.3.0 + ts-morph: + specifier: ^28.0.0 + version: 28.0.0 tsup: specifier: ^8.3.5 - version: 8.5.1(postcss@8.5.15)(typescript@5.9.3) + version: 8.5.1(jiti@2.7.0)(postcss@8.5.15)(typescript@5.9.3) typescript: specifier: ^5.7.2 version: 5.9.3 vitest: specifier: ^2.1.8 - version: 2.1.9(@types/node@22.19.19) + version: 2.1.9(@types/node@22.19.19)(lightningcss@1.32.0) packages: @@ -327,9 +354,20 @@ packages: cpu: [x64] os: [win32] + '@hugeicons/core-free-icons@4.2.0': + resolution: {integrity: sha512-V1G/Ph9TbmEow+pKnupZRWQjdORR/TGGr3JVRZOWkomdJ/5N6GgLuKPgBDs7G0kZ0//9LL34AGOUzWe3K+umNA==} + + '@hugeicons/react@1.1.6': + resolution: {integrity: sha512-c2LhXJMAW5wN1pC/smBXG0YPqUON6ceR/ZdXHCjEI9KvB+hjtqYjmzIxok5hAQOeXGz0WtORgCQMzqewFKAZwg==} + peerDependencies: + react: '>=16.0.0' + '@jridgewell/gen-mapping@0.3.13': resolution: {integrity: sha512-2kkt/7niJ6MgEPxF0bYdQ6etZaA+fQvDcLKckhy1yIQOzaoKjBBjSj63/aLVjYE3qhRt5dvM+uUyfCg6UKCBbA==} + '@jridgewell/remapping@2.3.5': + resolution: {integrity: sha512-LI9u/+laYG4Ds1TDKSJW2YPrIlcVYOwi2fUC6xB43lueCjgxV4lffOCZCtYFiH6TNOX+tQKXx97T4IKHbhyHEQ==} + '@jridgewell/resolve-uri@3.1.2': resolution: {integrity: sha512-bRISgCIjP20/tbWSPWMEi54QVPRZExkuD9lJL+UIxUKtwVJA8wW1Trb1jMs1RFXo1CBTNZ/5hpC9QvmKWdopKw==} engines: {node: '>=6.0.0'} @@ -343,6 +381,94 @@ packages: '@mdx-js/mdx@3.1.1': resolution: {integrity: sha512-f6ZO2ifpwAQIpzGWaBQT2TXxPv6z3RBzQKpVftEWN78Vl/YweF1uwussDx8ECAXVtr3Rs89fKyG9YlzUs9DyGQ==} + '@parcel/watcher-android-arm64@2.5.6': + resolution: {integrity: sha512-YQxSS34tPF/6ZG7r/Ih9xy+kP/WwediEUsqmtf0cuCV5TPPKw/PQHRhueUo6JdeFJaqV3pyjm0GdYjZotbRt/A==} + engines: {node: '>= 10.0.0'} + cpu: [arm64] + os: [android] + + '@parcel/watcher-darwin-arm64@2.5.6': + resolution: {integrity: sha512-Z2ZdrnwyXvvvdtRHLmM4knydIdU9adO3D4n/0cVipF3rRiwP+3/sfzpAwA/qKFL6i1ModaabkU7IbpeMBgiVEA==} + engines: {node: '>= 10.0.0'} + cpu: [arm64] + os: [darwin] + + '@parcel/watcher-darwin-x64@2.5.6': + resolution: {integrity: sha512-HgvOf3W9dhithcwOWX9uDZyn1lW9R+7tPZ4sug+NGrGIo4Rk1hAXLEbcH1TQSqxts0NYXXlOWqVpvS1SFS4fRg==} + engines: {node: '>= 10.0.0'} + cpu: [x64] + os: [darwin] + + '@parcel/watcher-freebsd-x64@2.5.6': + resolution: {integrity: sha512-vJVi8yd/qzJxEKHkeemh7w3YAn6RJCtYlE4HPMoVnCpIXEzSrxErBW5SJBgKLbXU3WdIpkjBTeUNtyBVn8TRng==} + engines: {node: '>= 10.0.0'} + cpu: [x64] + os: [freebsd] + + '@parcel/watcher-linux-arm-glibc@2.5.6': + resolution: {integrity: sha512-9JiYfB6h6BgV50CCfasfLf/uvOcJskMSwcdH1PHH9rvS1IrNy8zad6IUVPVUfmXr+u+Km9IxcfMLzgdOudz9EQ==} + engines: {node: '>= 10.0.0'} + cpu: [arm] + os: [linux] + libc: [glibc] + + '@parcel/watcher-linux-arm-musl@2.5.6': + resolution: {integrity: sha512-Ve3gUCG57nuUUSyjBq/MAM0CzArtuIOxsBdQ+ftz6ho8n7s1i9E1Nmk/xmP323r2YL0SONs1EuwqBp2u1k5fxg==} + engines: {node: '>= 10.0.0'} + cpu: [arm] + os: [linux] + libc: [musl] + + '@parcel/watcher-linux-arm64-glibc@2.5.6': + resolution: {integrity: sha512-f2g/DT3NhGPdBmMWYoxixqYr3v/UXcmLOYy16Bx0TM20Tchduwr4EaCbmxh1321TABqPGDpS8D/ggOTaljijOA==} + engines: {node: '>= 10.0.0'} + cpu: [arm64] + os: [linux] + libc: [glibc] + + '@parcel/watcher-linux-arm64-musl@2.5.6': + resolution: {integrity: sha512-qb6naMDGlbCwdhLj6hgoVKJl2odL34z2sqkC7Z6kzir8b5W65WYDpLB6R06KabvZdgoHI/zxke4b3zR0wAbDTA==} + engines: {node: '>= 10.0.0'} + cpu: [arm64] + os: [linux] + libc: [musl] + + '@parcel/watcher-linux-x64-glibc@2.5.6': + resolution: {integrity: sha512-kbT5wvNQlx7NaGjzPFu8nVIW1rWqV780O7ZtkjuWaPUgpv2NMFpjYERVi0UYj1msZNyCzGlaCWEtzc+exjMGbQ==} + engines: {node: '>= 10.0.0'} + cpu: [x64] + os: [linux] + libc: [glibc] + + '@parcel/watcher-linux-x64-musl@2.5.6': + resolution: {integrity: sha512-1JRFeC+h7RdXwldHzTsmdtYR/Ku8SylLgTU/reMuqdVD7CtLwf0VR1FqeprZ0eHQkO0vqsbvFLXUmYm/uNKJBg==} + engines: {node: '>= 10.0.0'} + cpu: [x64] + os: [linux] + libc: [musl] + + '@parcel/watcher-win32-arm64@2.5.6': + resolution: {integrity: sha512-3ukyebjc6eGlw9yRt678DxVF7rjXatWiHvTXqphZLvo7aC5NdEgFufVwjFfY51ijYEWpXbqF5jtrK275z52D4Q==} + engines: {node: '>= 10.0.0'} + cpu: [arm64] + os: [win32] + + '@parcel/watcher-win32-ia32@2.5.6': + resolution: {integrity: sha512-k35yLp1ZMwwee3Ez/pxBi5cf4AoBKYXj00CZ80jUz5h8prpiaQsiRPKQMxoLstNuqe2vR4RNPEAEcjEFzhEz/g==} + engines: {node: '>= 10.0.0'} + cpu: [ia32] + os: [win32] + + '@parcel/watcher-win32-x64@2.5.6': + resolution: {integrity: sha512-hbQlYcCq5dlAX9Qx+kFb0FHue6vbjlf0FrNzSKdYK2APUf7tGfGxQCk2ihEREmbR6ZMc0MVAD5RIX/41gpUzTw==} + engines: {node: '>= 10.0.0'} + cpu: [x64] + os: [win32] + + '@parcel/watcher@2.5.6': + resolution: {integrity: sha512-tmmZ3lQxAe/k/+rNnXQRawJ4NjxO2hqiOLTHvWchtGZULp4RyFeh6aU4XdOYBFe2KE1oShQTv4AblOs2iOrNnQ==} + engines: {node: '>= 10.0.0'} + '@rollup/rollup-android-arm-eabi@4.60.4': resolution: {integrity: sha512-F5QXMSiFebS9hKZj02XhWLLnRpJ3B3AROP0tWbFBSj+6kCbg5m9j5JoHKd4mmSVy5mS/IMQloYgYxCuJC0fxEQ==} cpu: [arm] @@ -481,6 +607,102 @@ packages: cpu: [x64] os: [win32] + '@tailwindcss/cli@4.3.0': + resolution: {integrity: sha512-X9kdlqyMopO9fewbgHsEeuy31YzMHbdZ9VsKt004tB+mxSg1CNbyhZYCzvhciN0AM4R4b5lvIprPjtNq7iQxpQ==} + hasBin: true + + '@tailwindcss/node@4.3.0': + resolution: {integrity: sha512-aFb4gUhFOgdh9AXo4IzBEOzBkkAxm9VigwDJnMIYv3lcfXCJVesNfbEaBl4BNgVRyid92AmdviqwBUBRKSeY3g==} + + '@tailwindcss/oxide-android-arm64@4.3.0': + resolution: {integrity: sha512-TJPiq67tKlLuObP6RkwvVGDoxCMBVtDgKkLfa/uyj7/FyxvQwHS+UOnVrXXgbEsfUaMgiVvC4KbJnRr26ho4Ng==} + engines: {node: '>= 20'} + cpu: [arm64] + os: [android] + + '@tailwindcss/oxide-darwin-arm64@4.3.0': + resolution: {integrity: sha512-oMN/WZRb+SO37BmUElEgeEWuU8E/HXRkiODxJxLe1UTHVXLrdVSgfaJV7pSlhRGMSOiXLuxTIjfsF3wYvz8cgQ==} + engines: {node: '>= 20'} + cpu: [arm64] + os: [darwin] + + '@tailwindcss/oxide-darwin-x64@4.3.0': + resolution: {integrity: sha512-N6CUmu4a6bKVADfw77p+iw6Yd9Q3OBhe0veaDX+QazfuVYlQsHfDgxBrsjQ/IW+zywL8mTrNd0SdJT/zgtvMdA==} + engines: {node: '>= 20'} + cpu: [x64] + os: [darwin] + + '@tailwindcss/oxide-freebsd-x64@4.3.0': + resolution: {integrity: sha512-zDL5hBkQdH5C6MpqbK3gQAgP80tsMwSI26vjOzjJtNCMUo0lFgOItzHKBIupOZNQxt3ouPH7RPhvNhiTfCe5CQ==} + engines: {node: '>= 20'} + cpu: [x64] + os: [freebsd] + + '@tailwindcss/oxide-linux-arm-gnueabihf@4.3.0': + resolution: {integrity: sha512-R06HdNi7A7OEoMsf6d4tjZ71RCWnZQPHj2mnotSFURjNLdBC+cIgXQ7l81CqeoiQftjf6OOblxXMInMgN2VzMA==} + engines: {node: '>= 20'} + cpu: [arm] + os: [linux] + + '@tailwindcss/oxide-linux-arm64-gnu@4.3.0': + resolution: {integrity: sha512-qTJHELX8jetjhRQHCLilkVLmybpzNQAtaI/gaoVoidn/ufbNDbAo8KlK2J+yPoc8wQxvDxCmh/5lr8nC1+lTbg==} + engines: {node: '>= 20'} + cpu: [arm64] + os: [linux] + libc: [glibc] + + '@tailwindcss/oxide-linux-arm64-musl@4.3.0': + resolution: {integrity: sha512-Z6sukiQsngnWO+l39X4pPbiWT81IC+PLKF+PHxIlyZbGNb9MODfYlXEVlFvej5BOZInWX01kVyzeLvHsXhfczQ==} + engines: {node: '>= 20'} + cpu: [arm64] + os: [linux] + libc: [musl] + + '@tailwindcss/oxide-linux-x64-gnu@4.3.0': + resolution: {integrity: sha512-DRNdQRpSGzRGfARVuVkxvM8Q12nh19l4BF/G7zGA1oe+9wcC6saFBHTISrpIcKzhiXtSrlSrluCfvMuledoCTQ==} + engines: {node: '>= 20'} + cpu: [x64] + os: [linux] + libc: [glibc] + + '@tailwindcss/oxide-linux-x64-musl@4.3.0': + resolution: {integrity: sha512-Z0IADbDo8bh6I7h2IQMx601AdXBLfFpEdUotft86evd/8ZPflZe9COPO8Q1vw+pfLWIUo9zN/JGZvwuAJqduqg==} + engines: {node: '>= 20'} + cpu: [x64] + os: [linux] + libc: [musl] + + '@tailwindcss/oxide-wasm32-wasi@4.3.0': + resolution: {integrity: sha512-HNZGOUxEmElksYR7S6sC5jTeNGpobAsy9u7Gu0AskJ8/20FR9GqebUyB+HBcU/ax6BHuiuJi+Oda4B+YX6H1yA==} + engines: {node: '>=14.0.0'} + cpu: [wasm32] + bundledDependencies: + - '@napi-rs/wasm-runtime' + - '@emnapi/core' + - '@emnapi/runtime' + - '@tybys/wasm-util' + - '@emnapi/wasi-threads' + - tslib + + '@tailwindcss/oxide-win32-arm64-msvc@4.3.0': + resolution: {integrity: sha512-Pe+RPVTi1T+qymuuRpcdvwSVZjnll/f7n8gBxMMh3xLTctMDKqpdfGimbMyioqtLhUYZxdJ9wGNhV7MKHvgZsQ==} + engines: {node: '>= 20'} + cpu: [arm64] + os: [win32] + + '@tailwindcss/oxide-win32-x64-msvc@4.3.0': + resolution: {integrity: sha512-Mvrf2kXW/yeW/OTezZlCGOirXRcUuLIBx/5Y12BaPM7wJoryG6dfS/NJL8aBPqtTEx/Vm4T4vKzFUcKDT+TKUA==} + engines: {node: '>= 20'} + cpu: [x64] + os: [win32] + + '@tailwindcss/oxide@4.3.0': + resolution: {integrity: sha512-F7HZGBeN9I0/AuuJS5PwcD8xayx5ri5GhjYUDBEVYUkexyA/giwbDNjRVrxSezE3T250OU2K/wp/ltWx3UOefg==} + engines: {node: '>= 20'} + + '@ts-morph/common@0.29.0': + resolution: {integrity: sha512-35oUmphHbJvQ/+UTwFNme/t2p3FoKiGJ5auTjjpNTop2dyREspirjMy82PLSC1pnDJ8ah1GU98hwpVt64YXQsg==} + '@types/debug@4.1.13': resolution: {integrity: sha512-KSVgmQmzMwPlmtljOomayoR89W4FynCAi3E8PPs7vmDVPe84hT+vGPKkJfThkmXs0x0jAaa9U8uW8bbfyS2fWw==} @@ -508,6 +730,14 @@ packages: '@types/node@22.19.19': resolution: {integrity: sha512-dyh/xO2Fh5bYrfWaaqGrRQQGkNdmYw6AmaAUvYeUMNTWQtvb796ikLdmTchRmOlOiIJ1TDXfWgVx1QkUlQ6Hew==} + '@types/react-dom@19.2.3': + resolution: {integrity: sha512-jp2L/eY6fn+KgVVQAOqYItbF0VY/YApe5Mz2F0aykSO8gx31bYCZyvSeYxCHKvzHG5eZjc+zyaS5BrBWya2+kQ==} + peerDependencies: + '@types/react': ^19.2.0 + + '@types/react@19.2.15': + resolution: {integrity: sha512-eRwcGNHve+E8qtEQSSRl6urh+rFop4v8gm6O8rGv25CodbvFdLjA1vVQ1KkiFE0w0UPOnb8tDiFKL5lp0rtY5Q==} + '@types/unist@2.0.11': resolution: {integrity: sha512-CmBKiL6NNo/OqgmMn95Fk9Whlp2mtvIv+KNpQKN2F4SjvrEesubTRWGYSg+BnWZOnlCaSTU1sMpsBOzgbYhnsA==} @@ -570,6 +800,14 @@ packages: bail@2.0.2: resolution: {integrity: sha512-0xO6mYd7JB2YesxDKplafRpsiOzPt9V02ddPCLbY1xYGPOX24NTyN50qnUxgCPcSoYMhKpAuBTjQoRZCAkUDRw==} + balanced-match@4.0.4: + resolution: {integrity: sha512-BLrgEcRTwX2o6gGxGOCNyMvGSp35YofuYzw9h1IMTRmKqttAZZVU67bdb9Pr2vUHA8+j3i2tJfjO6C6+4myGTA==} + engines: {node: 18 || 20 || >=22} + + brace-expansion@5.0.6: + resolution: {integrity: sha512-kLpxurY4Z4r9sgMsyG0Z9uzsBlgiU/EFKhj/h91/8yHu0edo7XuixOIH3VcJ8kkxs6/jPzoI6U9Vj3WqbMQ94g==} + engines: {node: 18 || 20 || >=22} + bundle-require@5.1.0: resolution: {integrity: sha512-3WrrOuZiyaaZPWiEt4G3+IffISVC9HYlWueJEBWED4ZH4aIAC2PnkdnuRrR94M+w6yGWn4AglWtJtBI8YqvgoA==} engines: {node: ^12.20.0 || ^14.13.1 || >=16.0.0} @@ -607,6 +845,13 @@ packages: resolution: {integrity: sha512-Qgzu8kfBvo+cA4962jnP1KkS6Dop5NS6g7R5LFYJr4b8Ub94PPQXUksCw9PvXoeXPRRddRNC5C1JQUR2SMGtnA==} engines: {node: '>= 14.16.0'} + clsx@2.1.1: + resolution: {integrity: sha512-eYm0QWBtUrBWZWG0d386OGAw16Z995PiOVo2B7bjWSbHedGl5e0ZWaq65kOGgUSNesEIDkB9ISbTg/JK9dhCZA==} + engines: {node: '>=6'} + + code-block-writer@13.0.3: + resolution: {integrity: sha512-Oofo0pq3IKnsFtuHqSF7TqBfr71aeyZDVJ0HpmqB7FBM2qEigL0iPONSCZSO9pE9dZTAxANe5XHG9Uy0YMv8cg==} + collapse-white-space@2.1.0: resolution: {integrity: sha512-loKTxY1zCOuG4j9f6EPnuyyYkf58RnhhWTvRoZEokgB+WbdXehfjFviyOVYkqzEWz1Q5kRiZdBYS5SwxbQYwzw==} @@ -624,6 +869,9 @@ packages: resolution: {integrity: sha512-5IKcdX0nnYavi6G7TtOhwkYzyjfJlatbjMjuLSfE2kYT5pMDOilZ4OvMhi637CcDICTmz3wARPoyhqyX1Y+XvA==} engines: {node: ^14.18.0 || >=16.10.0} + csstype@3.2.3: + resolution: {integrity: sha512-z1HGKcYy2xA8AGQfwrn0PAy+PB7X/GSj3UVJW9qKyn43xWa+gl5nXmU4qqLMRzWVLFC8KusUX8T/0kCiOYpAIQ==} + debug@4.4.3: resolution: {integrity: sha512-RGwwWnwQvkVfavKVt22FGLw+xYSdzARwm0ru6DhTVA3umU5hZc28V3kO4stgYryrTlLpuvgI9GiijltAjNbcqA==} engines: {node: '>=6.0'} @@ -644,9 +892,17 @@ packages: resolution: {integrity: sha512-0je+qPKHEMohvfRTCEo3CrPG6cAzAYgmzKyxRiYSSDkS6eGJdyVJm7WaYA5ECaAD9wLB2T4EEeymA5aFVcYXCA==} engines: {node: '>=6'} + detect-libc@2.1.2: + resolution: {integrity: sha512-Btj2BOOO83o3WyH59e8MgXsxEQVcarkUOpEYrubB0urwnN10yQ364rsiByU11nZlqWYZm05i/of7io4mzihBtQ==} + engines: {node: '>=8'} + devlop@1.1.0: resolution: {integrity: sha512-RWmIqhcFf1lRYBvNmr7qTNuyCt/7/ns2jbpp1+PalgE/rDQcBT0fioSMUpJ93irlUhC5hrg4cYqe6U+0ImW0rA==} + enhanced-resolve@5.22.1: + resolution: {integrity: sha512-6QEuw3zoX1SJQc7b87aBXke/no+mG2bTBgw29gWMQonLmpEkWoCAVkl+M49e48AZlWzxiDzDZzYdp6kobcyLww==} + engines: {node: '>=10.13.0'} + es-module-lexer@1.7.0: resolution: {integrity: sha512-jEQoCwk8hyb2AZziIOLhDqpm5+2ww5uIE6lkO/6jcOCusfk6LhMHpXXfBLXTZ7Ydyt0j4VoUQv6uGNYbdW+kBA==} @@ -711,6 +967,9 @@ packages: engines: {node: ^8.16.0 || ^10.6.0 || >=11.0.0} os: [darwin] + graceful-fs@4.2.11: + resolution: {integrity: sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ==} + hast-util-to-estree@3.1.3: resolution: {integrity: sha512-48+B/rJWAp0jamNbAAf9M7Uf//UVqAoMmgXhBdxTDJLGKY+LRnZ99qcG+Qjl5HfMpYNzS5v4EAwVEF34LeAj7w==} @@ -732,6 +991,14 @@ packages: is-decimal@2.0.1: resolution: {integrity: sha512-AAB9hiomQs5DXWcRB1rqsxGUstbRroFOPPVAomNk/3XHR5JyEZChOyTWe2oayKnsSsr/kcGqF+z6yuH6HHpN0A==} + is-extglob@2.1.1: + resolution: {integrity: sha512-SbKbANkN603Vi4jEZv49LeVJMn4yGwsbzZworEoyEiutsN3nJYdbO36zfhGJ6QEDpOZIFkDtnq5JRxmvl3jsoQ==} + engines: {node: '>=0.10.0'} + + is-glob@4.0.3: + resolution: {integrity: sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==} + engines: {node: '>=0.10.0'} + is-hexadecimal@2.0.1: resolution: {integrity: sha512-DgZQp241c8oO6cA1SbTEWiXeoxV42vlcJxgH+B3hi1AiqqKruZR3ZGF8In3fj4+/y/7rHvlOZLZtgJ/4ttYGZg==} @@ -739,10 +1006,88 @@ packages: resolution: {integrity: sha512-+Pgi+vMuUNkJyExiMBt5IlFoMyKnr5zhJ4Uspz58WOhBF5QoIZkFyNHIbBAtHwzVAgk5RtndVNsDRN61/mmDqg==} engines: {node: '>=12'} + jiti@2.7.0: + resolution: {integrity: sha512-AC/7JofJvZGrrneWNaEnJeOLUx+JlGt7tNa0wZiRPT4MY1wmfKjt2+6O2p2uz2+skll8OZZmJMNqeke7kKbNgQ==} + hasBin: true + joycon@3.1.1: resolution: {integrity: sha512-34wB/Y7MW7bzjKRjUKTa46I2Z7eV62Rkhva+KkopW7Qvv/OSWBqvkSY7vusOPrNuZcUG3tApvdVgNB8POj3SPw==} engines: {node: '>=10'} + lightningcss-android-arm64@1.32.0: + resolution: {integrity: sha512-YK7/ClTt4kAK0vo6w3X+Pnm0D2cf2vPHbhOXdoNti1Ga0al1P4TBZhwjATvjNwLEBCnKvjJc2jQgHXH0NEwlAg==} + engines: {node: '>= 12.0.0'} + cpu: [arm64] + os: [android] + + lightningcss-darwin-arm64@1.32.0: + resolution: {integrity: sha512-RzeG9Ju5bag2Bv1/lwlVJvBE3q6TtXskdZLLCyfg5pt+HLz9BqlICO7LZM7VHNTTn/5PRhHFBSjk5lc4cmscPQ==} + engines: {node: '>= 12.0.0'} + cpu: [arm64] + os: [darwin] + + lightningcss-darwin-x64@1.32.0: + resolution: {integrity: sha512-U+QsBp2m/s2wqpUYT/6wnlagdZbtZdndSmut/NJqlCcMLTWp5muCrID+K5UJ6jqD2BFshejCYXniPDbNh73V8w==} + engines: {node: '>= 12.0.0'} + cpu: [x64] + os: [darwin] + + lightningcss-freebsd-x64@1.32.0: + resolution: {integrity: sha512-JCTigedEksZk3tHTTthnMdVfGf61Fky8Ji2E4YjUTEQX14xiy/lTzXnu1vwiZe3bYe0q+SpsSH/CTeDXK6WHig==} + engines: {node: '>= 12.0.0'} + cpu: [x64] + os: [freebsd] + + lightningcss-linux-arm-gnueabihf@1.32.0: + resolution: {integrity: sha512-x6rnnpRa2GL0zQOkt6rts3YDPzduLpWvwAF6EMhXFVZXD4tPrBkEFqzGowzCsIWsPjqSK+tyNEODUBXeeVHSkw==} + engines: {node: '>= 12.0.0'} + cpu: [arm] + os: [linux] + + lightningcss-linux-arm64-gnu@1.32.0: + resolution: {integrity: sha512-0nnMyoyOLRJXfbMOilaSRcLH3Jw5z9HDNGfT/gwCPgaDjnx0i8w7vBzFLFR1f6CMLKF8gVbebmkUN3fa/kQJpQ==} + engines: {node: '>= 12.0.0'} + cpu: [arm64] + os: [linux] + libc: [glibc] + + lightningcss-linux-arm64-musl@1.32.0: + resolution: {integrity: sha512-UpQkoenr4UJEzgVIYpI80lDFvRmPVg6oqboNHfoH4CQIfNA+HOrZ7Mo7KZP02dC6LjghPQJeBsvXhJod/wnIBg==} + engines: {node: '>= 12.0.0'} + cpu: [arm64] + os: [linux] + libc: [musl] + + lightningcss-linux-x64-gnu@1.32.0: + resolution: {integrity: sha512-V7Qr52IhZmdKPVr+Vtw8o+WLsQJYCTd8loIfpDaMRWGUZfBOYEJeyJIkqGIDMZPwPx24pUMfwSxxI8phr/MbOA==} + engines: {node: '>= 12.0.0'} + cpu: [x64] + os: [linux] + libc: [glibc] + + lightningcss-linux-x64-musl@1.32.0: + resolution: {integrity: sha512-bYcLp+Vb0awsiXg/80uCRezCYHNg1/l3mt0gzHnWV9XP1W5sKa5/TCdGWaR/zBM2PeF/HbsQv/j2URNOiVuxWg==} + engines: {node: '>= 12.0.0'} + cpu: [x64] + os: [linux] + libc: [musl] + + lightningcss-win32-arm64-msvc@1.32.0: + resolution: {integrity: sha512-8SbC8BR40pS6baCM8sbtYDSwEVQd4JlFTOlaD3gWGHfThTcABnNDBda6eTZeqbofalIJhFx0qKzgHJmcPTnGdw==} + engines: {node: '>= 12.0.0'} + cpu: [arm64] + os: [win32] + + lightningcss-win32-x64-msvc@1.32.0: + resolution: {integrity: sha512-Amq9B/SoZYdDi1kFrojnoqPLxYhQ4Wo5XiL8EVJrVsB8ARoC1PWW6VGtT0WKCemjy8aC+louJnjS7U18x3b06Q==} + engines: {node: '>= 12.0.0'} + cpu: [x64] + os: [win32] + + lightningcss@1.32.0: + resolution: {integrity: sha512-NXYBzinNrblfraPGyrbPoD19C1h9lfI/1mzgWYvXUTe414Gz/X1FD2XBZSZM7rRTrMA8JL3OtAaGifrIKhQ5yQ==} + engines: {node: '>= 12.0.0'} + lilconfig@3.1.3: resolution: {integrity: sha512-/vlFKAoH5Cgt3Ie+JLhRbwOsCQePABiU3tJ1egGvyQ+33R/vcwM2Zl2QR/LzjsBeItPt3oSVXapn+m4nQDvpzw==} engines: {node: '>=14'} @@ -878,9 +1223,17 @@ packages: micromark@4.0.2: resolution: {integrity: sha512-zpe98Q6kvavpCr1NPVSCMebCKfD7CA2NqZ+rykeNhONIJBpc1tFKt9hucLGwha3jNTNI8lHpctWJWoimVF4PfA==} + minimatch@10.2.5: + resolution: {integrity: sha512-MULkVLfKGYDFYejP07QOurDLLQpcjk7Fw+7jXS2R2czRQzR56yHRveU5NDJEOviH+hETZKSkIk5c+T23GjFUMg==} + engines: {node: 18 || 20 || >=22} + mlly@1.8.2: resolution: {integrity: sha512-d+ObxMQFmbt10sretNDytwt85VrbkhhUA/JBGm1MPaWJ65Cl4wOgLaB1NYvJSZ0Ef03MMEU/0xpPMXUIQ29UfA==} + mri@1.2.0: + resolution: {integrity: sha512-tzzskb3bG8LvYGFF/mDTpq3jpI6Q9wc3LEmBaghu+DdCssd1FakN7Bc0hVNmEyGq1bq3RgfkCb3cmQLpNPOroA==} + engines: {node: '>=4'} + ms@2.1.3: resolution: {integrity: sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==} @@ -892,6 +1245,9 @@ packages: engines: {node: ^10 || ^12 || ^13.7 || ^14 || >=15.0.1} hasBin: true + node-addon-api@7.1.1: + resolution: {integrity: sha512-5m3bsyrjFWE1xf7nz7YXdN4udnVtXK6/Yfgn5qnahL6bCkf2yKt4k3nuTKAtT4r3IG8JNR2ncsIMdZuAzJjHQQ==} + object-assign@4.1.1: resolution: {integrity: sha512-rJgTQnkUnH1sFw8yT6VSU3zD3sWmu6sZhIseY8VX+GRu3P6F7Fu+JNDoXfklElbLJSnc3FUQHVe4cU5hj+BcUg==} engines: {node: '>=0.10.0'} @@ -899,6 +1255,9 @@ packages: parse-entities@4.0.2: resolution: {integrity: sha512-GG2AQYWoLgL877gQIKeRPGO1xF9+eG1ujIb5soS5gPvLQ1y2o8FL90w2QWNdf9I361Mpp7726c+lj3U0qK1uGw==} + path-browserify@1.0.1: + resolution: {integrity: sha512-b7uo2UCUOYZcnF/3ID0lulOJi/bafxa1xPe7ZPsammBSpjSWQkjNxlt635YGS2MiR9GjvuXCtz2emr3jbsz98g==} + pathe@1.1.2: resolution: {integrity: sha512-whLdWMYL2TwI08hn8/ZqAbrVemu0LNaNNJZX73O6qaIdCTfXutsLhMkjdENX0qhsQ9uIimo4/aQOmXkoon2nDQ==} @@ -945,17 +1304,18 @@ packages: resolution: {integrity: sha512-FfR8sjd4em2T6fb3I2MwAJU7HWVMr9zba+enmQeeWFfCbm+UOC/0X4DS8XtpUTMwWMGbjKYP7xjfNekzyGmB3A==} engines: {node: ^10 || ^12 || >=14} - preact-render-to-string@6.7.0: - resolution: {integrity: sha512-Z4WR8fmLMRpdYqJ9i7vrlXSsSrxVJydwrkEXHapexfARbWfGb7vGcnvNQnIzN0cXciMVOlz/XLoiMCi9gUsy9Q==} - peerDependencies: - preact: '>=10 || >= 11.0.0-0' - - preact@10.29.2: - resolution: {integrity: sha512-7tNmwg/7mzzAoB/8kSg6Hl37JraAZw3Z3A0JSY7VXlZwo82Xn0G7wKbNNs2qoF4ZEEsQGTwDAroNdqKs1ofJxQ==} - property-information@7.1.0: resolution: {integrity: sha512-TwEZ+X+yCJmYfL7TPUOcvBZ4QfoT5YenQiJuX//0th53DE6w0xxLEtfK3iyryQFddXuvkIk51EEgrJQ0WJkOmQ==} + react-dom@19.2.6: + resolution: {integrity: sha512-0prMI+hvBbPjsWnxDLxlCGyM8PN6UuWjEUCYmZhO67xIV9Xasa/r/vDnq+Xyq4Lo27g8QSbO5YzARu0D1Sps3g==} + peerDependencies: + react: ^19.2.6 + + react@19.2.6: + resolution: {integrity: sha512-sfWGGfavi0xr8Pg0sVsyHMAOziVYKgPLNrS7ig+ivMNb3wbCBw3KxtflsGBAwD3gYQlE/AEZsTLgToRrSCjb0Q==} + engines: {node: '>=0.10.0'} + readdirp@4.1.2: resolution: {integrity: sha512-GDhwkLfywWL2s6vEjyhri+eXmfH6j1L7JE27WhqLeYzoh/A3DBaYGEj2H/HFZCn/kMfim73FXxEJTw06WtxQwg==} engines: {node: '>= 14.18.0'} @@ -995,6 +1355,9 @@ packages: engines: {node: '>=18.0.0', npm: '>=8.0.0'} hasBin: true + scheduler@0.27.0: + resolution: {integrity: sha512-eNv+WrVbKu1f3vbYJT/xtiF5syA5HPIMtf9IgY/nKg0sWqzAUEvqY/xm7OcZc/qafLx/iO9FgOmeSAp4v5ti/Q==} + siginfo@2.0.0: resolution: {integrity: sha512-ybx0WO1/8bSBLEWXZvEd7gMW3Sn3JFlW3TvX1nREbDLRNQNaeNN8WK0meBwPdAaOI7TtRRRJn/Es1zhrrCHu7g==} @@ -1029,6 +1392,16 @@ packages: engines: {node: '>=16 || 14 >=14.17'} hasBin: true + tailwind-merge@3.6.0: + resolution: {integrity: sha512-uxL7qAVQriqRQPAyK3pj66VqskWqoZ37PW94jwOTwNfq/z9oyu1V+eqrZqtR2+fCiXdYOZe/Modt8GtvqNzu+w==} + + tailwindcss@4.3.0: + resolution: {integrity: sha512-y6nxMGB1nMW9R6k96e5gdIFzcfL/gTJRNaqGes1YvkLnPVXzWgbqFF2yLC0T8G774n24cx3Pe8XrKoniCOAH+Q==} + + tapable@2.3.3: + resolution: {integrity: sha512-uxc/zpqFg6x7C8vOE7lh6Lbda8eEL9zmVm/PLeTPBRhh1xCgdWaQ+J1CUieGpIfm2HdtsUpRv+HshiasBMcc6A==} + engines: {node: '>=6'} + thenify-all@1.6.0: resolution: {integrity: sha512-RNxQH/qI8/t3thXJDwcstUO4zeqo64+Uy/+sNVRBx4Xn2OX+OZ9oP+iJnNFqplFra2ZUVeKCSa2oVWi3T4uVmA==} engines: {node: '>=0.8'} @@ -1071,6 +1444,9 @@ packages: ts-interface-checker@0.1.13: resolution: {integrity: sha512-Y/arvbn+rrz3JCKl9C4kVNfTfSm2/mEp5FSz5EsZSANGPSlQrpRI5M4PKF+mJnE52jOO90PnPSc3Ur3bTQw0gA==} + ts-morph@28.0.0: + resolution: {integrity: sha512-Wp3tnZ2bzwxyTZMtgWVzXDfm7lB1Drz+y9DmmYH/L702PQhPyVrp3pkou3yIz4qjS14GY9kcpmLiOOMvl8oG1g==} + tsup@8.5.1: resolution: {integrity: sha512-xtgkqwdhpKWr3tKPmCkvYmS9xnQK3m3XgxZHwSUjvfTjp7YfXe5tT3GgWi0F2N+ZSMsOeWeZFh7ZZFg5iPhing==} engines: {node: '>=18'} @@ -1346,11 +1722,22 @@ snapshots: '@esbuild/win32-x64@0.27.7': optional: true + '@hugeicons/core-free-icons@4.2.0': {} + + '@hugeicons/react@1.1.6(react@19.2.6)': + dependencies: + react: 19.2.6 + '@jridgewell/gen-mapping@0.3.13': dependencies: '@jridgewell/sourcemap-codec': 1.5.5 '@jridgewell/trace-mapping': 0.3.31 + '@jridgewell/remapping@2.3.5': + dependencies: + '@jridgewell/gen-mapping': 0.3.13 + '@jridgewell/trace-mapping': 0.3.31 + '@jridgewell/resolve-uri@3.1.2': {} '@jridgewell/sourcemap-codec@1.5.5': {} @@ -1390,6 +1777,66 @@ snapshots: transitivePeerDependencies: - supports-color + '@parcel/watcher-android-arm64@2.5.6': + optional: true + + '@parcel/watcher-darwin-arm64@2.5.6': + optional: true + + '@parcel/watcher-darwin-x64@2.5.6': + optional: true + + '@parcel/watcher-freebsd-x64@2.5.6': + optional: true + + '@parcel/watcher-linux-arm-glibc@2.5.6': + optional: true + + '@parcel/watcher-linux-arm-musl@2.5.6': + optional: true + + '@parcel/watcher-linux-arm64-glibc@2.5.6': + optional: true + + '@parcel/watcher-linux-arm64-musl@2.5.6': + optional: true + + '@parcel/watcher-linux-x64-glibc@2.5.6': + optional: true + + '@parcel/watcher-linux-x64-musl@2.5.6': + optional: true + + '@parcel/watcher-win32-arm64@2.5.6': + optional: true + + '@parcel/watcher-win32-ia32@2.5.6': + optional: true + + '@parcel/watcher-win32-x64@2.5.6': + optional: true + + '@parcel/watcher@2.5.6': + dependencies: + detect-libc: 2.1.2 + is-glob: 4.0.3 + node-addon-api: 7.1.1 + picomatch: 4.0.4 + optionalDependencies: + '@parcel/watcher-android-arm64': 2.5.6 + '@parcel/watcher-darwin-arm64': 2.5.6 + '@parcel/watcher-darwin-x64': 2.5.6 + '@parcel/watcher-freebsd-x64': 2.5.6 + '@parcel/watcher-linux-arm-glibc': 2.5.6 + '@parcel/watcher-linux-arm-musl': 2.5.6 + '@parcel/watcher-linux-arm64-glibc': 2.5.6 + '@parcel/watcher-linux-arm64-musl': 2.5.6 + '@parcel/watcher-linux-x64-glibc': 2.5.6 + '@parcel/watcher-linux-x64-musl': 2.5.6 + '@parcel/watcher-win32-arm64': 2.5.6 + '@parcel/watcher-win32-ia32': 2.5.6 + '@parcel/watcher-win32-x64': 2.5.6 + '@rollup/rollup-android-arm-eabi@4.60.4': optional: true @@ -1465,6 +1912,83 @@ snapshots: '@rollup/rollup-win32-x64-msvc@4.60.4': optional: true + '@tailwindcss/cli@4.3.0': + dependencies: + '@parcel/watcher': 2.5.6 + '@tailwindcss/node': 4.3.0 + '@tailwindcss/oxide': 4.3.0 + enhanced-resolve: 5.22.1 + mri: 1.2.0 + picocolors: 1.1.1 + tailwindcss: 4.3.0 + + '@tailwindcss/node@4.3.0': + dependencies: + '@jridgewell/remapping': 2.3.5 + enhanced-resolve: 5.22.1 + jiti: 2.7.0 + lightningcss: 1.32.0 + magic-string: 0.30.21 + source-map-js: 1.2.1 + tailwindcss: 4.3.0 + + '@tailwindcss/oxide-android-arm64@4.3.0': + optional: true + + '@tailwindcss/oxide-darwin-arm64@4.3.0': + optional: true + + '@tailwindcss/oxide-darwin-x64@4.3.0': + optional: true + + '@tailwindcss/oxide-freebsd-x64@4.3.0': + optional: true + + '@tailwindcss/oxide-linux-arm-gnueabihf@4.3.0': + optional: true + + '@tailwindcss/oxide-linux-arm64-gnu@4.3.0': + optional: true + + '@tailwindcss/oxide-linux-arm64-musl@4.3.0': + optional: true + + '@tailwindcss/oxide-linux-x64-gnu@4.3.0': + optional: true + + '@tailwindcss/oxide-linux-x64-musl@4.3.0': + optional: true + + '@tailwindcss/oxide-wasm32-wasi@4.3.0': + optional: true + + '@tailwindcss/oxide-win32-arm64-msvc@4.3.0': + optional: true + + '@tailwindcss/oxide-win32-x64-msvc@4.3.0': + optional: true + + '@tailwindcss/oxide@4.3.0': + optionalDependencies: + '@tailwindcss/oxide-android-arm64': 4.3.0 + '@tailwindcss/oxide-darwin-arm64': 4.3.0 + '@tailwindcss/oxide-darwin-x64': 4.3.0 + '@tailwindcss/oxide-freebsd-x64': 4.3.0 + '@tailwindcss/oxide-linux-arm-gnueabihf': 4.3.0 + '@tailwindcss/oxide-linux-arm64-gnu': 4.3.0 + '@tailwindcss/oxide-linux-arm64-musl': 4.3.0 + '@tailwindcss/oxide-linux-x64-gnu': 4.3.0 + '@tailwindcss/oxide-linux-x64-musl': 4.3.0 + '@tailwindcss/oxide-wasm32-wasi': 4.3.0 + '@tailwindcss/oxide-win32-arm64-msvc': 4.3.0 + '@tailwindcss/oxide-win32-x64-msvc': 4.3.0 + + '@ts-morph/common@0.29.0': + dependencies: + minimatch: 10.2.5 + path-browserify: 1.0.1 + tinyglobby: 0.2.16 + '@types/debug@4.1.13': dependencies: '@types/ms': 2.1.0 @@ -1493,6 +2017,14 @@ snapshots: dependencies: undici-types: 6.21.0 + '@types/react-dom@19.2.3(@types/react@19.2.15)': + dependencies: + '@types/react': 19.2.15 + + '@types/react@19.2.15': + dependencies: + csstype: 3.2.3 + '@types/unist@2.0.11': {} '@types/unist@3.0.3': {} @@ -1506,13 +2038,13 @@ snapshots: chai: 5.3.3 tinyrainbow: 1.2.0 - '@vitest/mocker@2.1.9(vite@5.4.21(@types/node@22.19.19))': + '@vitest/mocker@2.1.9(vite@5.4.21(@types/node@22.19.19)(lightningcss@1.32.0))': dependencies: '@vitest/spy': 2.1.9 estree-walker: 3.0.3 magic-string: 0.30.21 optionalDependencies: - vite: 5.4.21(@types/node@22.19.19) + vite: 5.4.21(@types/node@22.19.19)(lightningcss@1.32.0) '@vitest/pretty-format@2.1.9': dependencies: @@ -1553,6 +2085,12 @@ snapshots: bail@2.0.2: {} + balanced-match@4.0.4: {} + + brace-expansion@5.0.6: + dependencies: + balanced-match: 4.0.4 + bundle-require@5.1.0(esbuild@0.27.7): dependencies: esbuild: 0.27.7 @@ -1584,6 +2122,10 @@ snapshots: dependencies: readdirp: 4.1.2 + clsx@2.1.1: {} + + code-block-writer@13.0.3: {} + collapse-white-space@2.1.0: {} comma-separated-tokens@2.0.3: {} @@ -1594,6 +2136,8 @@ snapshots: consola@3.4.2: {} + csstype@3.2.3: {} + debug@4.4.3: dependencies: ms: 2.1.3 @@ -1606,10 +2150,17 @@ snapshots: dequal@2.0.3: {} + detect-libc@2.1.2: {} + devlop@1.1.0: dependencies: dequal: 2.0.3 + enhanced-resolve@5.22.1: + dependencies: + graceful-fs: 4.2.11 + tapable: 2.3.3 + es-module-lexer@1.7.0: {} esast-util-from-estree@2.0.0: @@ -1731,6 +2282,8 @@ snapshots: fsevents@2.3.3: optional: true + graceful-fs@4.2.11: {} + hast-util-to-estree@3.1.3: dependencies: '@types/estree': 1.0.9 @@ -1787,12 +2340,69 @@ snapshots: is-decimal@2.0.1: {} + is-extglob@2.1.1: {} + + is-glob@4.0.3: + dependencies: + is-extglob: 2.1.1 + is-hexadecimal@2.0.1: {} is-plain-obj@4.1.0: {} + jiti@2.7.0: {} + joycon@3.1.1: {} + lightningcss-android-arm64@1.32.0: + optional: true + + lightningcss-darwin-arm64@1.32.0: + optional: true + + lightningcss-darwin-x64@1.32.0: + optional: true + + lightningcss-freebsd-x64@1.32.0: + optional: true + + lightningcss-linux-arm-gnueabihf@1.32.0: + optional: true + + lightningcss-linux-arm64-gnu@1.32.0: + optional: true + + lightningcss-linux-arm64-musl@1.32.0: + optional: true + + lightningcss-linux-x64-gnu@1.32.0: + optional: true + + lightningcss-linux-x64-musl@1.32.0: + optional: true + + lightningcss-win32-arm64-msvc@1.32.0: + optional: true + + lightningcss-win32-x64-msvc@1.32.0: + optional: true + + lightningcss@1.32.0: + dependencies: + detect-libc: 2.1.2 + optionalDependencies: + lightningcss-android-arm64: 1.32.0 + lightningcss-darwin-arm64: 1.32.0 + lightningcss-darwin-x64: 1.32.0 + lightningcss-freebsd-x64: 1.32.0 + lightningcss-linux-arm-gnueabihf: 1.32.0 + lightningcss-linux-arm64-gnu: 1.32.0 + lightningcss-linux-arm64-musl: 1.32.0 + lightningcss-linux-x64-gnu: 1.32.0 + lightningcss-linux-x64-musl: 1.32.0 + lightningcss-win32-arm64-msvc: 1.32.0 + lightningcss-win32-x64-msvc: 1.32.0 + lilconfig@3.1.3: {} lines-and-columns@1.2.4: {} @@ -2114,6 +2724,10 @@ snapshots: transitivePeerDependencies: - supports-color + minimatch@10.2.5: + dependencies: + brace-expansion: 5.0.6 + mlly@1.8.2: dependencies: acorn: 8.16.0 @@ -2121,6 +2735,8 @@ snapshots: pkg-types: 1.3.1 ufo: 1.6.4 + mri@1.2.0: {} + ms@2.1.3: {} mz@2.7.0: @@ -2131,6 +2747,8 @@ snapshots: nanoid@3.3.12: {} + node-addon-api@7.1.1: {} + object-assign@4.1.1: {} parse-entities@4.0.2: @@ -2143,6 +2761,8 @@ snapshots: is-decimal: 2.0.1 is-hexadecimal: 2.0.1 + path-browserify@1.0.1: {} + pathe@1.1.2: {} pathe@2.0.3: {} @@ -2161,10 +2781,11 @@ snapshots: mlly: 1.8.2 pathe: 2.0.3 - postcss-load-config@6.0.1(postcss@8.5.15): + postcss-load-config@6.0.1(jiti@2.7.0)(postcss@8.5.15): dependencies: lilconfig: 3.1.3 optionalDependencies: + jiti: 2.7.0 postcss: 8.5.15 postcss@8.5.15: @@ -2173,13 +2794,14 @@ snapshots: picocolors: 1.1.1 source-map-js: 1.2.1 - preact-render-to-string@6.7.0(preact@10.29.2): - dependencies: - preact: 10.29.2 + property-information@7.1.0: {} - preact@10.29.2: {} + react-dom@19.2.6(react@19.2.6): + dependencies: + react: 19.2.6 + scheduler: 0.27.0 - property-information@7.1.0: {} + react@19.2.6: {} readdirp@4.1.2: {} @@ -2277,6 +2899,8 @@ snapshots: '@rollup/rollup-win32-x64-msvc': 4.60.4 fsevents: 2.3.3 + scheduler@0.27.0: {} + siginfo@2.0.0: {} source-map-js@1.2.1: {} @@ -2312,6 +2936,12 @@ snapshots: tinyglobby: 0.2.16 ts-interface-checker: 0.1.13 + tailwind-merge@3.6.0: {} + + tailwindcss@4.3.0: {} + + tapable@2.3.3: {} + thenify-all@1.6.0: dependencies: thenify: 3.3.1 @@ -2343,7 +2973,12 @@ snapshots: ts-interface-checker@0.1.13: {} - tsup@8.5.1(postcss@8.5.15)(typescript@5.9.3): + ts-morph@28.0.0: + dependencies: + '@ts-morph/common': 0.29.0 + code-block-writer: 13.0.3 + + tsup@8.5.1(jiti@2.7.0)(postcss@8.5.15)(typescript@5.9.3): dependencies: bundle-require: 5.1.0(esbuild@0.27.7) cac: 6.7.14 @@ -2354,7 +2989,7 @@ snapshots: fix-dts-default-cjs-exports: 1.0.1 joycon: 3.1.1 picocolors: 1.1.1 - postcss-load-config: 6.0.1(postcss@8.5.15) + postcss-load-config: 6.0.1(jiti@2.7.0)(postcss@8.5.15) resolve-from: 5.0.0 rollup: 4.60.4 source-map: 0.7.6 @@ -2424,13 +3059,13 @@ snapshots: '@types/unist': 3.0.3 vfile-message: 4.0.3 - vite-node@2.1.9(@types/node@22.19.19): + vite-node@2.1.9(@types/node@22.19.19)(lightningcss@1.32.0): dependencies: cac: 6.7.14 debug: 4.4.3 es-module-lexer: 1.7.0 pathe: 1.1.2 - vite: 5.4.21(@types/node@22.19.19) + vite: 5.4.21(@types/node@22.19.19)(lightningcss@1.32.0) transitivePeerDependencies: - '@types/node' - less @@ -2442,7 +3077,7 @@ snapshots: - supports-color - terser - vite@5.4.21(@types/node@22.19.19): + vite@5.4.21(@types/node@22.19.19)(lightningcss@1.32.0): dependencies: esbuild: 0.21.5 postcss: 8.5.15 @@ -2450,11 +3085,12 @@ snapshots: optionalDependencies: '@types/node': 22.19.19 fsevents: 2.3.3 + lightningcss: 1.32.0 - vitest@2.1.9(@types/node@22.19.19): + vitest@2.1.9(@types/node@22.19.19)(lightningcss@1.32.0): dependencies: '@vitest/expect': 2.1.9 - '@vitest/mocker': 2.1.9(vite@5.4.21(@types/node@22.19.19)) + '@vitest/mocker': 2.1.9(vite@5.4.21(@types/node@22.19.19)(lightningcss@1.32.0)) '@vitest/pretty-format': 2.1.9 '@vitest/runner': 2.1.9 '@vitest/snapshot': 2.1.9 @@ -2470,8 +3106,8 @@ snapshots: tinyexec: 0.3.2 tinypool: 1.1.1 tinyrainbow: 1.2.0 - vite: 5.4.21(@types/node@22.19.19) - vite-node: 2.1.9(@types/node@22.19.19) + vite: 5.4.21(@types/node@22.19.19)(lightningcss@1.32.0) + vite-node: 2.1.9(@types/node@22.19.19)(lightningcss@1.32.0) why-is-node-running: 2.3.0 optionalDependencies: '@types/node': 22.19.19 diff --git a/scripts/embed-css.mjs b/scripts/embed-css.mjs new file mode 100644 index 0000000..1e85675 --- /dev/null +++ b/scripts/embed-css.mjs @@ -0,0 +1,17 @@ +// Read dist/styles.css and write src/components/styles.ts exporting it as a +// string literal. tsup picks the .ts up and inlines it into the IIFE so the +// compiled bundle ships its own stylesheet — no filesystem access at run +// time. + +import { readFileSync, writeFileSync } from "node:fs"; + +const css = readFileSync("dist/styles.css", "utf8"); +const escaped = "`" + css.replace(/\\/g, "\\\\").replace(/`/g, "\\`").replace(/\$\{/g, "\\${") + "`"; + +writeFileSync( + "src/components/styles.ts", + `// AUTO-GENERATED by scripts/embed-css.mjs. Edit src/styles/tailwind.css instead.\n` + + `export const stylesheet = ${escaped};\n`, +); + +console.log(`embed-css: wrote ${css.length} bytes → src/components/styles.ts`); diff --git a/scripts/extract-manifest.mjs b/scripts/extract-manifest.mjs new file mode 100644 index 0000000..cdd340e --- /dev/null +++ b/scripts/extract-manifest.mjs @@ -0,0 +1,337 @@ +#!/usr/bin/env node +// Build-time extractor: walks src/components/{ui/*.tsx,index.tsx}, +// finds every exported component, and emits a manifest of +// { kind: "mdx-component", name, summary, category, spec.props, examples } +// entries into dist/manifest.json + src/components/manifest.ts (so the +// IIFE bundle can ship it via globalThis.componentManifest at runtime). +// +// Convention each component must follow: +// - JSDoc above the function declaration with: +// summary (first paragraph) +// @category +// @example (MDX usage) +// - Inline JSDoc on each property of the props TypeLiteral (the RHS +// of an intersection with React.ComponentProps<...>) for per-prop +// descriptions. +// +// Drift: if the JSDoc is missing or @category is unknown, the script +// fails with a clear pointer at the offending file. There's no silent +// fallback — that's what kept the old hand-curated cheatsheet rotting. + +import fs from "node:fs"; +import path from "node:path"; +import { fileURLToPath } from "node:url"; +import { Project, SyntaxKind } from "ts-morph"; + +const __filename = fileURLToPath(import.meta.url); +const ROOT = path.resolve(path.dirname(__filename), ".."); + +const KNOWN_CATEGORIES = new Set([ + "layout", + "emphasis", + "data", + "conversation", + "agent", + "chronological", + "code-media", +]); + +function main() { + const project = new Project({ + tsConfigFilePath: path.join(ROOT, "tsconfig.json"), + skipAddingFilesFromTsConfig: false, + }); + + // The public surface: everything re-exported (or directly exported) + // from src/components/index.tsx. Filtering to that is what keeps + // internal primitives like ToolCallContext out of the manifest. + const indexFile = project.getSourceFileOrThrow( + path.join(ROOT, "src/components/index.tsx"), + ); + const publicExports = collectPublicExports(indexFile); + + const entries = []; + const errors = []; + + for (const { name, declaration } of publicExports) { + if (!isComponentDeclaration(name, declaration)) continue; + try { + entries.push(buildEntry(name, declaration)); + } catch (err) { + errors.push(`${name} (${shortPath(declaration.getSourceFile().getFilePath())}): ${err.message}`); + } + } + + if (errors.length > 0) { + console.error("extract-manifest: failed to extract some components:\n"); + for (const e of errors) console.error(" - " + e); + process.exit(1); + } + + entries.sort((a, b) => a.name.localeCompare(b.name)); + + const distDir = path.join(ROOT, "dist"); + fs.mkdirSync(distDir, { recursive: true }); + const manifestPath = path.join(distDir, "manifest.json"); + fs.writeFileSync(manifestPath, JSON.stringify(entries, null, 2) + "\n"); + + // Also emit a TS file that the IIFE bundle can import. Keeping it + // in src/ means tsup picks it up without a JSON loader. + const tsPath = path.join(ROOT, "src/components/manifest.ts"); + fs.writeFileSync( + tsPath, + "// AUTO-GENERATED by scripts/extract-manifest.mjs. Do not edit by hand.\n" + + "export const componentManifest = " + + JSON.stringify(entries, null, 2) + + " as const;\n", + ); + + console.log( + `extract-manifest: ${entries.length} components → ${shortPath(manifestPath)}`, + ); +} + +// Resolve every named export of src/components/index.tsx to its +// underlying declaration node. Handles both `export { X } from "..."` +// re-exports and inline `export function X(...)` forms. +function collectPublicExports(indexFile) { + const out = []; + for (const [name, declarations] of indexFile.getExportedDeclarations()) { + const decl = declarations[0]; + if (!decl) continue; + out.push({ name, declaration: decl }); + } + return out; +} + +// Names that ARE exported from index.tsx (so technically part of the +// public package API) but aren't usable directly from MDX — they're +// internal building blocks for our MDX-facing wrappers. Documenting +// them in the manifest would only confuse agents. +const INTERNAL_NAMES = new Set([ + "ToolCallPrimitive", + "ToolCallLabel", + "ToolCallContent", + "ToolTreePrimitive", + "ToolTreeTrigger", + "ToolTreeContent", +]); + +function isComponentDeclaration(name, node) { + // We treat as a component anything that's a FunctionDeclaration whose + // name starts with a capital letter and isn't on the internal list. + if (!node) return false; + if (node.getKind() !== SyntaxKind.FunctionDeclaration) return false; + const fnName = node.getName?.(); + if (!fnName || !/^[A-Z]/.test(fnName)) return false; + if (INTERNAL_NAMES.has(name)) return false; + return true; +} + +function buildEntry(name, fn) { + const jsDocs = fn.getJsDocs?.() ?? []; + if (jsDocs.length === 0) { + throw new Error( + "missing JSDoc. Add `/** … @category … @example … */` above the function.", + ); + } + const jsdoc = jsDocs[jsDocs.length - 1]; + + const description = jsdoc.getDescription().trim(); + if (!description) { + throw new Error("JSDoc must have a summary sentence before any @tag."); + } + const summary = firstParagraph(description); + + const category = readTagText(jsdoc, "category"); + if (!category) { + throw new Error("missing @category tag."); + } + if (!KNOWN_CATEGORIES.has(category)) { + throw new Error( + `unknown @category "${category}". Valid: ${[...KNOWN_CATEGORIES].join(", ")}.`, + ); + } + + const examples = jsdoc + .getTags() + .filter((t) => t.getTagName() === "example") + .map((t) => trimExample(t.getCommentText() ?? "")) + .filter(Boolean); + + const props = extractProps(fn); + + return { + kind: "mdx-component", + name, + summary, + category, + spec: { props }, + examples, + }; +} + +function firstParagraph(text) { + const idx = text.indexOf("\n\n"); + const para = (idx === -1 ? text : text.slice(0, idx)).trim(); + // Collapse hard-wraps inside the paragraph so the summary fits on + // one line in the CLI output. + return para.replace(/\s*\n\s*/g, " "); +} + +function readTagText(jsdoc, tagName) { + const tag = jsdoc.getTags().find((t) => t.getTagName() === tagName); + if (!tag) return null; + return (tag.getCommentText() ?? "").trim(); +} + +function trimExample(s) { + // JSDoc strips leading "* " but leaves indentation; normalise it. + const lines = s.split("\n"); + const min = Math.min( + ...lines.filter((l) => l.trim()).map((l) => l.match(/^\s*/)[0].length), + ); + return lines.map((l) => l.slice(min)).join("\n").trim(); +} + +// Pull props out of the function's first parameter type. We only +// document the inline TypeLiteral, which is the RHS of an intersection +// like `React.ComponentProps<"div"> & { foo?: T }`. Anything inherited +// from the HTML attributes side is omitted — it's noise for the +// agent-facing docs. +function extractProps(fn) { + const params = fn.getParameters(); + if (params.length === 0) return []; + const typeNode = params[0].getTypeNode(); + if (!typeNode) return []; + + // Collect defaults from the destructuring pattern. + const defaults = readDestructuringDefaults(params[0]); + + // Find the TypeLiteral somewhere in the type. Common shapes we handle: + // { ... } — bare TypeLiteral + // React.ComponentProps<"x"> & { ... } — intersection + // React.ComponentProps<"x"> — no inline props + const literals = findInlineTypeLiterals(typeNode); + if (literals.length === 0) return []; + + const props = []; + for (const literal of literals) { + for (const member of literal.getProperties()) { + const propName = member.getName(); + const optional = !!member.hasQuestionToken?.(); + // Resolve to expanded text. For type aliases (CalloutType) and + // unions we want the literal text — "info" | "warning" | … + // rather than just "CalloutType". Drop the implicit `| undefined` + // that optional props pick up. + let propType = expandedTypeText(member); + if (optional) { + propType = propType + .replace(/\s*\|\s*undefined\s*$/, "") + .replace(/^undefined\s*\|\s*/, ""); + } + const descTag = member.getJsDocs?.()[0]; + const description = descTag + ? descTag.getDescription().trim() || (descTag.getCommentText?.() ?? "") + : ""; + const def = defaults[propName]; + props.push({ + name: propName, + type: cleanType(propType), + optional, + ...(def !== undefined ? { default: def } : {}), + ...(description ? { description } : {}), + }); + } + } + return props; +} + +function findInlineTypeLiterals(typeNode) { + // Walk the type expression looking for `{ … }` literals. For + // intersections we keep all literals; for everything else we keep + // none unless the node itself is a literal. + const out = []; + function visit(n) { + const k = n.getKind(); + if (k === SyntaxKind.TypeLiteral) { + out.push(n); + return; + } + if (k === SyntaxKind.IntersectionType) { + for (const t of n.getTypeNodes()) visit(t); + return; + } + if (k === SyntaxKind.ParenthesizedType) { + visit(n.getTypeNode()); + return; + } + // TypeReferences (e.g. React.ComponentProps<"div">), unions, + // and bare identifiers don't have inline literals we care about. + } + visit(typeNode); + return out; +} + +function readDestructuringDefaults(param) { + const out = {}; + const name = param.getNameNode(); + if (name.getKind() !== SyntaxKind.ObjectBindingPattern) return out; + for (const el of name.getElements()) { + const init = el.getInitializer?.(); + if (!init) continue; + out[el.getName()] = init.getText(); + } + return out; +} + +// ts-morph's Type#getText() returns the alias name when one exists +// (so `CalloutType` instead of `"info" | "warning" | ...`). Agents +// reading `pin components` need the literal union, since they can't +// look up the alias. But expanding everything turns `boolean` into +// `false | true` and `React.ReactNode` into a 12-arm monster. So: +// expand only when the result is shorter than the unexpanded form, +// or when the alias name is one we know is opaque ("CalloutType", +// "KPITone", etc — anything ending in "Type", "Tone", "Status", +// "Severity", "State", "Color"). Otherwise keep the alias. +function expandedTypeText(node) { + const t = node.getType(); + const raw = cleanType(t.getText(node)); + + if (!t.isUnion()) return raw; + + const expanded = t + .getUnionTypes() + .map((u) => cleanType(u.getText(node))) + .join(" | "); + + // Bare `boolean` shouldn't expand to `false | true`. + if (/^(boolean|boolean \| undefined|undefined \| boolean)$/.test(raw)) { + return raw; + } + + // Expand if the original is an opaque alias OR if the expanded + // form is meaningfully more useful (literal union of strings). + const isOpaqueAlias = /\b[A-Z]\w*(Type|Tone|Status|Severity|State|Color)\b/.test(raw); + const expandedIsAllLiterals = t + .getUnionTypes() + .every((u) => u.isLiteral() || u.isUndefined()); + + if (isOpaqueAlias || (expandedIsAllLiterals && expanded.length < 120)) { + return expanded; + } + return raw; +} + +function cleanType(s) { + // ts-morph returns the resolved type which may include nested + // module imports like `import("…/react").ReactNode`. Strip those for + // readability without changing meaning. + return s.replace(/import\("[^"]+"\)\./g, "").trim(); +} + +function shortPath(p) { + return path.relative(ROOT, p); +} + +main(); diff --git a/src/bundle.ts b/src/bundle.ts index d65bd01..e3b8682 100644 --- a/src/bundle.ts +++ b/src/bundle.ts @@ -3,10 +3,19 @@ // bundled in (tsup's `noExternal: [/.*/]`). Exposes a synchronous // `compileMDX(source)` on `globalThis` that returns `{ html, css }`. +// Polyfills first — must execute before React loads. See polyfills.ts. +import "./polyfills.js"; import { renderMDX } from "./compile.js"; import { stylesheet } from "./components/styles.js"; +import { componentManifest } from "./components/manifest.js"; -(globalThis as Record).compileMDX = (source: string) => { +const g = globalThis as Record; + +g.compileMDX = (source: string) => { const html = renderMDX(source); return { html, css: stylesheet }; }; + +// Component metadata for pin's library discovery API. Pin runs this +// in v8 at startup, JSON-stringifies the result, and caches it. +g.componentManifest = componentManifest; diff --git a/src/compile.ts b/src/compile.ts index dc43132..2b49e30 100644 --- a/src/compile.ts +++ b/src/compile.ts @@ -1,34 +1,23 @@ -// MDX → static HTML. -// -// We compile MDX *synchronously* so this works inside v8go (which has no -// event loop). `@mdx-js/mdx`'s `compileSync` produces an ES module source -// string that we then eval; the module exports a default function that -// returns a preact VNode when called with our components. +// MDX → static HTML, synchronously (works inside v8go which has no event +// loop). import { compileSync } from "@mdx-js/mdx"; -import { h, type ComponentChildren } from "preact"; -import { jsx, jsxs, Fragment } from "preact/jsx-runtime"; -import { renderToString } from "preact-render-to-string"; +import { createElement, type ReactNode } from "react"; +import { jsx, jsxs, Fragment } from "react/jsx-runtime"; +// `react-dom/server.edge` works in environments that have neither Node +// built-ins (stream / crypto / async_hooks) nor the DOM's MessageChannel. +// v8go is one of those. The other server entries fail to load. +import { renderToString } from "react-dom/server.edge"; import * as componentsImport from "./components/index.js"; import { stylesheet } from "./components/styles.js"; export interface CompileResult { - /** Rendered HTML *body* (no / wrapper). */ html: string; - /** Stylesheet to inline. Same value for every compile; safe to cache. */ css: string; - /** A self-contained HTML document wrapping html + css. */ document: string; } -/** - * Compile MDX source to static HTML. - * - * - The result includes a stylesheet you can either inline (via `document`) - * or serve as a separate file. - * - Pure function: no I/O, no network, deterministic given the same input. - */ export function compileMDX(source: string): CompileResult { const html = renderMDX(source); return { @@ -38,58 +27,39 @@ export function compileMDX(source: string): CompileResult { }; } -/** Render only — for embedding pieces into a larger page. */ export function renderMDX(source: string): string { - // Strip top-of-file ES `import` statements. MDX would otherwise turn - // them into `await import(...)`, which can't run inside `new Function` - // (no top-level await). All our components are auto-provided via the - // `components` prop, so authors don't actually need imports — but - // accept-and-ignore is friendlier than failing on them. const stripped = stripLeadingImports(source); const compiled = compileSync(stripped, { outputFormat: "function-body", development: false, - jsxImportSource: "preact", + jsxImportSource: "react", providerImportSource: undefined, }); - // The "function-body" output reads its JSX runtime from `arguments[0]` - // and returns `{ default: MDXContent }`. The runtime is the same object - // shape as preact/jsx-runtime. // eslint-disable-next-line @typescript-eslint/no-implied-eval const factory = new Function(String(compiled)); const mod = factory({ jsx, jsxs, Fragment }) as { default: (props: { components?: Record; - }) => ComponentChildren; + }) => ReactNode; }; - const tree = h(mod.default as never, { components: componentsImport }); - return renderToString(tree as never); + const tree = createElement(mod.default, { components: componentsImport }); + return renderToString(tree); } -/** - * Drop ESM `import` statements that appear before the first non-import, - * non-blank line. Preserves everything below (so an `import` lurking - * inside a code-block survives). Tolerates single-line and multi-line - * import forms (`import {\n A,\n B,\n} from '...'`). - */ function stripLeadingImports(src: string): string { const lines = src.split(/\r?\n/); let i = 0; while (i < lines.length) { const trimmed = lines[i].trim(); if (trimmed === "" || trimmed.startsWith("//")) { - // Skip blank / comment lines but don't write them either; markdown - // doesn't care about extra blank lines at the top. i++; continue; } if (trimmed.startsWith("import ")) { - // Consume until the line ends with a semicolon or a quote-then-EOL. while (i < lines.length && !/['"`];?\s*$/.test(lines[i])) i++; i++; continue; } - // First non-blank, non-import line: the rest of the file is content. break; } return lines.slice(i).join("\n"); diff --git a/src/components/agent.tsx b/src/components/agent.tsx deleted file mode 100644 index 5708871..0000000 --- a/src/components/agent.tsx +++ /dev/null @@ -1,97 +0,0 @@ -import type { ComponentChildren } from "preact"; - -export type ToolStatus = "running" | "ok" | "fail" | "skip"; - -// Inspired by Agentic Craft's ToolCall — a visual record of an LLM -// tool invocation. Static (no spinners or live updates); the "status" -// is a snapshot at the time of share. -export function ToolCall({ - name, - status, - timing, - args, - children, -}: { - name: string; - status?: ToolStatus; - timing?: string; - args?: string; - children?: ComponentChildren; -}) { - const statusCls = status ? ` bc-tool-${status}` : ""; - return ( -
-
- {name} - {timing ? {timing} : null} - {status ? {status} : null} -
- {args ?
{args}
: null} - {children ?
{children}
: null} -
- ); -} - -// Tree visualization — ``s nested inside `` get L-connector -// styling. Style is delivered by CSS so we don't have to know the tree shape. -export function ToolTree({ children }: { children: ComponentChildren }) { - return
{children}
; -} - -export type Severity = "info" | "low" | "medium" | "high" | "critical"; - -export function Finding({ - code, - title, - severity = "medium", - children, -}: { - code?: string; - title: string; - severity?: Severity; - children?: ComponentChildren; -}) { - return ( -
-
- {code ? {code} : null} -

{title}

- {severity} -
- {children ?
{children}
: null} -
- ); -} - -// Static snapshot of an approval prompt. `approved` is true/false/undefined -// (undefined = "still pending"). The visual indicates which choice was made. -export function Approval({ - action, - approved, - by, - at, - children, -}: { - action: string; - approved?: boolean; - by?: string; - at?: string; - children?: ComponentChildren; -}) { - const state = approved === undefined ? "pending" : approved ? "approved" : "denied"; - return ( -
-
- {action} - {state} -
- {(by || at) ? ( -
- {by ? {by} : null} - {at ? {at} : null} -
- ) : null} - {children ?
{children}
: null} -
- ); -} diff --git a/src/components/blocks.tsx b/src/components/blocks.tsx deleted file mode 100644 index cb02461..0000000 --- a/src/components/blocks.tsx +++ /dev/null @@ -1,88 +0,0 @@ -import type { ComponentChildren } from "preact"; - -export type CalloutType = "info" | "warning" | "danger" | "success" | "note"; - -export function Callout({ - type = "info", - title, - children, -}: { - type?: CalloutType; - title?: string; - children: ComponentChildren; -}) { - return ( -
- -
- {title ?
{title}
: null} -
{children}
-
-
- ); -} - -function iconFor(t: CalloutType): string { - switch (t) { - case "warning": - return "▲"; - case "danger": - return "✕"; - case "success": - return "✓"; - case "note": - return "✎"; - default: - return "ⓘ"; - } -} - -export function Quote({ - author, - children, -}: { - author?: string; - children: ComponentChildren; -}) { - return ( -
-
{children}
- {author ?
— {author}
: null} -
- ); -} - -// No syntax highlighting in v0.1 — the output is a plain
 with
-// a language class. Consumers who want highlighting can run prism.js
-// client-side; whether that's allowed depends on the host's CSP.
-export function Code({
-  language,
-  children,
-}: {
-  language?: string;
-  children: ComponentChildren;
-}) {
-  const lang = (language ?? "").toLowerCase();
-  return (
-    
-      {children}
-    
- ); -} - -// Authors pass raw SVG (or any block content) as children. The component -// just provides the figure / caption frame so it looks intentional. -export function Diagram({ - caption, - children, -}: { - caption?: string; - children: ComponentChildren; -}) { - return ( -
-
{children}
- {caption ?
{caption}
: null} -
- ); -} diff --git a/src/components/data.tsx b/src/components/data.tsx deleted file mode 100644 index fe11016..0000000 --- a/src/components/data.tsx +++ /dev/null @@ -1,79 +0,0 @@ -import type { ComponentChildren } from "preact"; - -export type StatusState = "ok" | "warn" | "err" | "info"; - -export function KPIGroup({ children }: { children: ComponentChildren }) { - return
{children}
; -} - -export function KPI({ - value, - label, - trend, - tone, -}: { - value: string | number; - label: string; - trend?: string; - tone?: StatusState; -}) { - const toneCls = tone ? ` bc-kpi-${tone}` : ""; - return ( -
-
{value}
-
{label}
- {trend ?
{trend}
: null} -
- ); -} - -export function Tag({ - color, - children, -}: { - color?: string; - children: ComponentChildren; -}) { - const cls = color ? `bc-tag bc-tag-${color}` : "bc-tag"; - return {children}; -} - -export function Status({ - state, - children, -}: { - state: StatusState; - children?: ComponentChildren; -}) { - return ( - - - ); -} - -export function Diff({ - before, - after, - beforeLabel = "Before", - afterLabel = "After", -}: { - before: ComponentChildren; - after: ComponentChildren; - beforeLabel?: string; - afterLabel?: string; -}) { - return ( -
-
-
{beforeLabel}
-
{before}
-
-
-
{afterLabel}
-
{after}
-
-
- ); -} diff --git a/src/components/index.ts b/src/components/index.ts deleted file mode 100644 index 5d7f833..0000000 --- a/src/components/index.ts +++ /dev/null @@ -1,10 +0,0 @@ -// Every component MDX is allowed to use is re-exported from this file. -// The compile path passes this module as the `components` prop to -// MDXContent so authors can write , , etc. without any -// import statements in their .mdx files. - -export { Section, TLDR, Compare, Option, Steps, Step } from "./layout.js"; -export { Callout, Quote, Code, Diagram } from "./blocks.js"; -export { KPI, KPIGroup, Tag, Status, Diff } from "./data.js"; -export { ToolCall, ToolTree, Finding, Approval } from "./agent.js"; -export { Timeline, Event } from "./timeline.js"; diff --git a/src/components/index.tsx b/src/components/index.tsx new file mode 100644 index 0000000..ea2c3bb --- /dev/null +++ b/src/components/index.tsx @@ -0,0 +1,453 @@ +// MDX-facing component registry. Names here are the JSX tags authors +// write in `.mdx` files. The compile path passes this module as +// `components` to MDXContent so authors don't need import statements. +// +// Structure mirrors the shadcn registry layout (`ui/`): components are +// imported from `./ui/`. Two of them (tool-call, tool-tree) are +// vendored verbatim from agentic-craft's registry. The rest are local +// implementations that mimic agentic-craft's editorial visual language +// — they are intended to be replaced by registry components when (if) +// the upstream project publishes them. + +import * as React from "react"; +import { HugeiconsIcon } from "@hugeicons/react"; +import { + CommandLineIcon, + CodeIcon, + PencilEdit01Icon, + File01Icon, + Search01Icon, + GlobeIcon, + Settings01Icon, + GitBranchIcon, + Database01Icon, + ArrowRight01Icon, +} from "@hugeicons/core-free-icons"; +import type { IconSvgElement } from "@hugeicons/react"; +import { cn } from "@/lib/utils.js"; + +// Vendored from agentic-craft registry — +// https://github.com/arielconti10/agentic-craft/tree/main/registry/base-nova/ui +export { + ToolCall as ToolCallPrimitive, + ToolCallLabel, + ToolCallContent, +} from "./ui/tool-call.js"; +export { + ToolTree as ToolTreePrimitive, + ToolTreeTrigger, + ToolTreeContent, +} from "./ui/tool-tree.js"; + +export { TLDR } from "./ui/tldr.js"; +export { Callout } from "./ui/callout.js"; +export { KPI, KPIGroup } from "./ui/kpi.js"; +export { Steps, Step } from "./ui/steps.js"; +export { Compare, Option } from "./ui/compare.js"; +export { Finding, Findings } from "./ui/finding.js"; +export { Approval } from "./ui/approval.js"; +export { Timeline, Event } from "./ui/timeline.js"; +export { Tag, Status } from "./ui/tag.js"; +export { Diff } from "./ui/diff.js"; +export { Section } from "./ui/section.js"; +export { Quote } from "./ui/quote.js"; +export { Code } from "./ui/code.js"; +export { Diagram } from "./ui/diagram.js"; +export { Subagent } from "./ui/subagent.js"; +export { + Conversation, + UserMessage, + AssistantMessage, + SystemMessage, + Thinking, +} from "./ui/conversation.js"; + +// ── ToolCall MDX wrapper ───────────────────────────────────────────── +// Our MDX API is flat: ``. The vendored primitive expects a hugeicons `icon`, +// ``, and ``. This wrapper translates. +// status: "ok"|"fail"|"running"|"skip" maps to "completed"|"failed"| +// "running"|"completed" (skip = quiet completed). + +const iconByName: Record = { + bash: CommandLineIcon, + shell: CommandLineIcon, + sh: CommandLineIcon, + zsh: CommandLineIcon, + edit: PencilEdit01Icon, + write: PencilEdit01Icon, + read: File01Icon, + file: File01Icon, + grep: Search01Icon, + search: Search01Icon, + webfetch: GlobeIcon, + webview: GlobeIcon, + git: GitBranchIcon, + db: Database01Icon, + database: Database01Icon, + code: CodeIcon, +}; + +type ToolStatus = "running" | "ok" | "fail" | "skip"; + +// We render
/ rather than the vendored React +// ToolCall/ToolTree from agentic-craft. Their primitives use +// React.useState for expand/collapse — that works in their Next.js +// app but pin ships static HTML with no React runtime in the browser, +// so the click handlers never fire.
gets the same UX for +// free with no JS. We keep the same visual language and `data-slot` +// markers so a future client-hydrated swap-in is mechanical. +// +// Following the agentic-craft Actions spec +// (https://agentic-craft.vercel.app/actions): +// - Label is 14px sans, weight 400 — never bold, never function +// signature +// - Icons are monochrome muted; only `fail` switches to red +// - Duration is right-aligned in muted text. Failed calls prefix +// it with "failed ·" +// - Args + children are hidden until the row is expanded — only +// the label is visible by default +// - `fail` rows open by default so the error is immediately visible + +const statusIconClass: Record = { + running: "text-sky-500", + ok: "text-muted-foreground", + fail: "text-red-500", + skip: "text-muted-foreground/50", +}; + +/** + * Single tool invocation row. Collapsible: clicking the row opens + * args + output. Failed calls open by default and gain the "failed ·" + * timing prefix. + * + * @category agent + * @example + * + * ok github.com/bitcomplete/pin/internal/auth 0.418s + * + */ +export function ToolCall({ + name, + label, + status = "ok", + timing, + args, + outputType = "code", + children, +}: { + name: string; + /** Human-readable label override. Falls back to `name`. */ + label?: string; + status?: ToolStatus; + timing?: string; + args?: string; + /** + * How to render the output body. "code" (default) wraps children in + * a monospace pre-style container — right for shell output, raw + * stdout, JSON payloads. "prose" skips the mono wrapper so markdown + * children render with normal typography — right for Skill bodies + * or anything that ships as formatted text. + */ + outputType?: "code" | "prose"; + children?: React.ReactNode; +}) { + const icon: IconSvgElement = + iconByName[name.toLowerCase()] ?? Settings01Icon; + const hasBody = !!(args || children); + const displayLabel = label ?? name; + const isFail = status === "fail"; + + const timingText = timing + ? isFail + ? `failed · ${timing}` + : timing + : isFail + ? "failed" + : undefined; + + const summary = ( + <> + + + + + {displayLabel} + + {timingText ? ( + + {timingText} + + ) : null} + {hasBody ? ( + + ) : null} + + ); + + if (!hasBody) { + // Non-expandable row — still aligned with the others. + return ( +
+ {summary} +
+ ); + } + + return ( +
+ + {summary} + +
+ {args ? : null} + {children ? ( + {children} + ) : null} +
+
+ ); +} + +// Args panel. If `args` parses as a JSON object, render as a definition +// list (mono keys aligned, values wrap). Otherwise render the raw +// string in a single mono code block. Both variants sit under a small +// uppercase ARGS label. +function ToolCallArgs({ args }: { args: string }) { + const kv = parseArgsAsKV(args); + return ( +
+ args + {kv ? ( +
+ {kv.map(([k, v]) => ( + +
{k}
+
+ {v} +
+
+ ))} +
+ ) : ( +
+          {args}
+        
+ )} +
+ ); +} + +function ToolCallOutput({ + isFail, + variant = "code", + children, +}: { + isFail: boolean; + variant?: "code" | "prose"; + children: React.ReactNode; +}) { + // "code" keeps the original mono pre-style frame for raw output. + // "prose" hands children off to the document's normal prose styling + // (headings, paragraphs, lists, inline code) — used by Skill bodies + // where the recipient should be able to read the loaded markdown. + const proseClasses = "rounded-md border border-border/40 bg-muted/30 px-4 py-3 text-sm leading-normal [&>:first-child]:mt-0 [&>:last-child]:mb-0"; + const codeClasses = cn( + "rounded-md bg-muted/40 px-3 py-2 font-mono text-xs leading-relaxed whitespace-pre-wrap break-words [&_p]:font-mono [&_p]:text-xs [&_p]:m-0 [&_p+p]:mt-1.5", + isFail ? "text-red-400/90" : "text-foreground/90", + ); + return ( +
+ + {isFail ? "error" : "output"} + +
+ {children} +
+
+ ); +} + +function SectionLabel({ + tone, + children, +}: { + tone?: "fail"; + children: React.ReactNode; +}) { + return ( +
+ {children} +
+ ); +} + +// Try to detect "{...}" object-shaped JSON and return [key, valueString] +// pairs. Values that aren't strings are JSON-stringified two-space +// pretty so they wrap nicely in the dl. Returns null for anything we +// can't safely treat as a key/value record. +function parseArgsAsKV(args: string): Array<[string, string]> | null { + const trimmed = args.trim(); + if (!(trimmed.startsWith("{") && trimmed.endsWith("}"))) return null; + try { + const parsed = JSON.parse(trimmed); + if (!parsed || typeof parsed !== "object" || Array.isArray(parsed)) { + return null; + } + const entries = Object.entries(parsed as Record); + if (entries.length === 0) return null; + return entries.map(([k, v]) => [ + k, + typeof v === "string" ? v : JSON.stringify(v, null, 2), + ]); + } catch { + return null; + } +} + +// ── ToolCallGroup MDX wrapper ──────────────────────────────────────── +// AC's "Grouped" pattern: wrap N adjacent ToolCalls in a single +// rounded card frame. No header, no toggle — the group exists purely +// to visually associate the calls. Each child
still +// toggles independently. + +/** + * Rounded frame around several adjacent s. Pure visual + * grouping — no header, no shared toggle. For a labelled, collapsible + * parent (e.g. "Running 3 in parallel"), use instead. + * + * @category agent + * @example + * + * + * + * + * + */ +export function ToolCallGroup({ + className, + children, +}: { + /** Extra classes; rarely needed. */ + className?: string; + children?: React.ReactNode; +}) { + return ( +
+ {children} +
+ ); +} + +// ── ToolTree MDX wrapper ───────────────────────────────────────────── +// Grouped tool calls with an explicit header — AC's "Running N tasks +// in parallel" pattern. Children are indented with an L-connector +// spine. Default collapsed. + +/** + * Labelled, collapsible group of tool calls — the "Running N in + * parallel" pattern. Header summary at top, L-connectored children + * inside. Use when the calls share a higher-level purpose worth + * naming; for an unlabelled visual frame, use . + * + * @category agent + * @example + * + * + * + * + * + */ +export function ToolTree({ + label = "Running tools", + children, +}: { + /** Header shown above the children. */ + label?: string; + /** Open by default? Defaults to false. */ + defaultOpen?: boolean; + children?: React.ReactNode; +}) { + return ( +
+ + + + + + {label} + + + +
*]:relative", + "[&>*]:before:absolute [&>*]:before:left-[-20px] [&>*]:before:top-[15px] [&>*]:before:w-4 [&>*]:before:h-px [&>*]:before:bg-border", + )} + > + {children} +
+
+ ); +} diff --git a/src/components/layout.tsx b/src/components/layout.tsx deleted file mode 100644 index 2369cf8..0000000 --- a/src/components/layout.tsx +++ /dev/null @@ -1,73 +0,0 @@ -import type { ComponentChildren } from "preact"; - -export function Section({ - title, - id, - children, -}: { - title?: string; - id?: string; - children: ComponentChildren; -}) { - return ( -
- {title ?

{title}

: null} -
{children}
-
- ); -} - -export function TLDR({ children }: { children: ComponentChildren }) { - return ( - - ); -} - -export function Compare({ children }: { children: ComponentChildren }) { - return
{children}
; -} - -export function Option({ - label, - children, -}: { - label: string; - children: ComponentChildren; -}) { - return ( -
-
{label}
-
{children}
-
- ); -} - -export function Steps({ children }: { children: ComponentChildren }) { - return
    {children}
; -} - -export type StepStatus = "todo" | "doing" | "done" | "blocked"; - -export function Step({ - title, - status, - children, -}: { - title: string; - status?: StepStatus; - children?: ComponentChildren; -}) { - const cls = `bc-step${status ? ` bc-step-${status}` : ""}`; - return ( -
  • -
    - {title} - {status ? {status} : null} -
    - {children ?
    {children}
    : null} -
  • - ); -} diff --git a/src/components/manifest.ts b/src/components/manifest.ts new file mode 100644 index 0000000..73a8f74 --- /dev/null +++ b/src/components/manifest.ts @@ -0,0 +1,660 @@ +// AUTO-GENERATED by scripts/extract-manifest.mjs. Do not edit by hand. +export const componentManifest = [ + { + "kind": "mdx-component", + "name": "Approval", + "summary": "Snapshot of an approval decision — what was requested, whether it was approved, who decided, when. Static record, not an interactive widget; for that, fold the decision into the surrounding prose.", + "category": "agent", + "spec": { + "props": [ + { + "name": "action", + "type": "string", + "optional": false, + "description": "Short description of what was being approved." + }, + { + "name": "approved", + "type": "boolean", + "optional": true, + "description": "undefined → pending, true → approved, false → denied." + }, + { + "name": "by", + "type": "string", + "optional": true, + "description": "Approver identifier (email, handle)." + }, + { + "name": "at", + "type": "string", + "optional": true, + "description": "Timestamp string." + } + ] + }, + "examples": [ + "" + ] + }, + { + "kind": "mdx-component", + "name": "AssistantMessage", + "summary": "Left-aligned agent turn. Serif body, no bubble, 85% max width. Contains the agent's prose plus any s the turn produced.", + "category": "conversation", + "spec": { + "props": [] + }, + "examples": [ + "\n Found three missing SFRs. Let me list them.\n \n" + ] + }, + { + "kind": "mdx-component", + "name": "Callout", + "summary": "Coloured aside — info / warning / danger / success / note. Use it to surface \"be careful\", \"important\", or \"good to know\" alongside the main text flow.", + "category": "emphasis", + "spec": { + "props": [ + { + "name": "type", + "type": "\"info\" | \"warning\" | \"danger\" | \"success\" | \"note\"", + "optional": true, + "default": "\"info\"", + "description": "Visual tone of the callout." + }, + { + "name": "title", + "type": "string", + "optional": true, + "description": "Optional bold title shown above the body." + } + ] + }, + "examples": [ + "\n Don't merge this on a Friday.\n" + ] + }, + { + "kind": "mdx-component", + "name": "Code", + "summary": "Code block. A fenced markdown block (```lang) renders identically; reach for when you need the `language` attribute set programmatically (e.g. for client-side highlighters that read it).", + "category": "code-media", + "spec": { + "props": [ + { + "name": "language", + "type": "string", + "optional": true, + "description": "Optional language hint (e.g. \"go\", \"ts\")." + } + ] + }, + "examples": [ + "\n func handle(w http.ResponseWriter, r *http.Request) { ... }\n" + ] + }, + { + "kind": "mdx-component", + "name": "Compare", + "summary": "Side-by-side panels for weighing 2-3 options. Each child is an