Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 2 additions & 4 deletions .github/actions/setup-workspace/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,10 @@ runs:
using: composite
steps:
- name: Set up pnpm
uses: pnpm/action-setup@a7487c7e89a18df4991f7f222e4898a00d66ddda
with:
version: 10.32.1
uses: pnpm/action-setup@73e46992e05b19abd31f2f3c20e0e7370d762115 # v6.1.1

- name: Set up Node
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020
uses: actions/setup-node@8fccf151e3ba8038c300f83b40c8fd1e94f9c5ce # v7.2.0
with:
node-version: 22
cache: pnpm
Expand Down
28 changes: 14 additions & 14 deletions .github/architecture/repo-map.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<!-- AUTO-GENERATED by .github/scripts/generate-repo-map.mjs — run `pnpm map` to update. -->
# PolyCSS Repository Map

Tracked production code scanned across `packages/*/src`, `bench/`, and `website/src`: **488 files**, **98,910 lines**. Regenerate with `pnpm map`; verified in CI by `pnpm check:map`.
Tracked production code scanned across `packages/*/src`, `bench/`, and `website/src`: **512 files**, **99,750 lines**. Regenerate with `pnpm map`; verified in CI by `pnpm check:map`.

## 1. Packages & Entry Points

Expand All @@ -10,8 +10,8 @@ Tracked production code scanned across `packages/*/src`, `bench/`, and `website/
| `packages/core` (`@layoutit/polycss-core`) | npm | `., ./three` | — | 104 | 27,402 | 58 |
| `packages/domformat` (`@layoutit/polycss-domformat`) | private | `., ./browser` | — | 36 | 13,165 | 0 |
| `packages/fonts` (`@layoutit/polycss-fonts`) | npm | `.` | `@layoutit/polycss-core` | 7 | 1,656 | 4 |
| `packages/morph` (`@layoutit/polycss-morph`) | npm | `., ./prepare` | `@layoutit/polycss`, `@layoutit/polycss-core` | 49 | 7,629 | 14 |
| `packages/polycss` (`@layoutit/polycss`) | npm | `., ./runtime, ./internal, ./elements, ./three` | `@layoutit/polycss-core` | 91 | 17,154 | 41 |
| `packages/morph` (`@layoutit/polycss-morph`) | npm | `., ./prepare` | `@layoutit/polycss`, `@layoutit/polycss-core` | 54 | 7,826 | 14 |
| `packages/polycss` (`@layoutit/polycss`) | npm | `., ./runtime, ./internal, ./elements, ./three` | `@layoutit/polycss-core` | 95 | 17,300 | 42 |
| `packages/react` (`@layoutit/polycss-react`) | npm | `., ./three` | `@layoutit/polycss`, `@layoutit/polycss-core` | 44 | 4,651 | 31 |
| `packages/skills` (`@layoutit/polycss-skills`) | npm | `.` | — | 1 | 415 | 1 |
| `packages/vue` (`@layoutit/polycss-vue`) | npm | `., ./three` | `@layoutit/polycss`, `@layoutit/polycss-core` | 42 | 4,437 | 29 |
Expand All @@ -37,22 +37,22 @@ Single source of truth: [`packages/workspace-aliases.mjs`](../../packages/worksp
| `@layoutit/polycss-morph/prepare` | `packages/morph/src/prepare.ts` |
| `@layoutit/polycss-morph` | `packages/morph/src/index.ts` |

**Consumers (12):** `bench/build.mjs`, `packages/fonts/vitest.config.ts`, `packages/morph/vitest.config.ts`, `packages/polycss/vitest.config.ts`, `packages/react/vitest.config.ts`, `packages/vitest.base.mjs`, `packages/vue/vitest.config.ts`, `website/astro.config.mjs`, `website/scripts/generate-builder-shape-thumbnails.mjs`, `website/scripts/generate-gallery-domformat.mjs`, `website/scripts/prove-gallery-domformat.mjs`, `website/tsconfig.json`
**Consumers (13):** `bench/build.mjs`, `packages/fonts/vitest.config.ts`, `packages/morph/vitest.config.ts`, `packages/polycss/vitest.config.ts`, `packages/react/vitest.config.ts`, `packages/vitest.base.mjs`, `packages/vue/vitest.config.ts`, `website/astro.config.mjs`, `website/scripts/generate-builder-shape-thumbnails.mjs`, `website/scripts/generate-gallery-domformat.mjs`, `website/scripts/prove-gallery-domformat.mjs`, `website/scripts/run-unit-tests.mjs`, `website/tsconfig.json`

## 3. Top Import Hubs (`fanIn`) & Largest Source Files

### Highest `fanIn` (production files importing this file)

| Fan-in | Lines | File |
|---:|---:|---|
| 123 | 528 | `packages/core/src/index.ts` |
| 127 | 528 | `packages/core/src/index.ts` |
| 92 | 248 | `packages/core/src/types.ts` |
| 38 | 301 | `packages/react/src/index.ts` |
| 33 | 119 | `website/src/components/types.ts` |
| 46 | 301 | `packages/react/src/index.ts` |
| 44 | 119 | `website/src/components/types.ts` |
| 29 | 148 | `packages/polycss/src/runtime.ts` |
| 22 | 220 | `packages/polycss/src/index.ts` |
| 25 | 220 | `packages/polycss/src/index.ts` |
| 23 | 88 | `website/src/components/GalleryWorkbench/types.ts` |
| 20 | 57 | `packages/polycss/src/internal.ts` |
| 19 | 88 | `website/src/components/GalleryWorkbench/types.ts` |
| 17 | 49 | `packages/core/src/math/vec3.ts` |
| 17 | 385 | `packages/polycss/src/api/createPolyScene.ts` |
| 16 | 366 | `packages/core/src/atlas/types.ts` |
Expand All @@ -68,12 +68,12 @@ Single source of truth: [`packages/workspace-aliases.mjs`](../../packages/worksp
| 1,178 | `packages/domformat/src/browser.ts` |
| 1,139 | `website/src/components/GalleryWorkbench/presets/presetFiles.ts` |
| 912 | `bench/entries/lifecycle.tsx` |
| 910 | `website/src/components/GalleryWorkbench/GalleryWorkbench.tsx` |
| 885 | `packages/morph/src/contracts/validation.ts` |
| 860 | `packages/domformat/src/state/interaction.ts` |
| 827 | `website/src/components/BuilderWorkbench/components/BuilderScene.tsx` |
| 825 | `website/src/components/GalleryWorkbench/hooks/useRouteSync.ts` |
| 801 | `packages/polycss/src/api/controls/gizmoEngine.ts` |
| 771 | `packages/core/src/merge/coverPlanarPolygons.ts` |
| 757 | `packages/core/src/parser/parseStl.ts` |
| 728 | `packages/core/src/parser/parseVox.ts` |
| 718 | `bench/perf-gate.mjs` |
| 711 | `packages/domformat/src/state/paged-state.ts` |

## 4. Core Render & Control Pipelines

Expand Down
2 changes: 1 addition & 1 deletion .github/scripts/check-boundaries.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -639,7 +639,7 @@ function checkPackageDir(root, pkg, dir, rules, violations) {
}

function checkDeepImportsOutsidePackages(root, violations) {
const scanRoots = ["website/src", "website/scripts", "bench", "examples"]
const scanRoots = ["website/src", "website/scripts", "website/tests", "bench", "examples"]
.map((dir) => resolve(root, dir))
.filter((dir) => {
try {
Expand Down
25 changes: 14 additions & 11 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
timeout-minutes: 15
steps:
- name: Check out
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
# check:mirrors needs history to merge-base against the PR's base ref;
# it runs with --require-base, so a shallow clone fails the job.
Expand Down Expand Up @@ -58,14 +58,17 @@ jobs:
- name: Certify Gallery domformat corpus
run: pnpm --filter @layoutit/polycss-website test:domformat-tools && pnpm --filter @layoutit/polycss-website verify:domformat

- name: Run website unit tests
run: pnpm test:website

- name: Build website
run: pnpm build:website

- name: Build bench bundles
run: pnpm bench:build

- name: Build examples
run: pnpm --filter './examples/*' -r build
- name: Typecheck and build examples
run: pnpm typecheck:examples && pnpm --filter './examples/*' -r build

visual-gate:
if: github.event_name == 'pull_request'
Expand All @@ -74,7 +77,7 @@ jobs:
timeout-minutes: 20
steps:
- name: Check out
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
fetch-depth: 0

Expand Down Expand Up @@ -111,7 +114,7 @@ jobs:

- name: Upload failing visual-gate report and triptychs
if: failure() && steps.changes.outputs.run == 'true'
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
with:
name: visual-gate-failures
path: bench/results/ci-gate
Expand All @@ -123,7 +126,7 @@ jobs:
timeout-minutes: 20
steps:
- name: Check out
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
fetch-depth: 0

Expand Down Expand Up @@ -158,7 +161,7 @@ jobs:

- name: Upload failing perf-gate report
if: failure() && steps.changes.outputs.run == 'true'
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
with:
name: perf-gate-failures
path: bench/results/ci-perf-gate
Expand All @@ -170,7 +173,7 @@ jobs:
timeout-minutes: 15
steps:
- name: Check out
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
fetch-depth: 0

Expand Down Expand Up @@ -207,7 +210,7 @@ jobs:

- name: Upload failing lifecycle-gate report
if: failure() && steps.changes.outputs.run == 'true'
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
with:
name: lifecycle-gate-failures
path: bench/results/ci-lifecycle-gate
Expand All @@ -219,7 +222,7 @@ jobs:
timeout-minutes: 45
steps:
- name: Check out
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
fetch-depth: 0

Expand Down Expand Up @@ -269,7 +272,7 @@ jobs:
timeout-minutes: 30
steps:
- name: Check out
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
fetch-depth: 0

Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/deploy-website.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ jobs:
url: ${{ steps.deployment.outputs.page_url }}
steps:
- name: Check out
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1

- name: Setup workspace
uses: ./.github/actions/setup-workspace
Expand All @@ -42,15 +42,15 @@ jobs:
run: pnpm build:website

- name: Configure GitHub Pages
uses: actions/configure-pages@983d7736d9b0ae728b81ab479565c72886d7745b
uses: actions/configure-pages@45bfe0192ca1faeb007ade9deae92b16b8254a0d # v6.0.0
with:
enablement: true

- name: Upload GitHub Pages artifact
uses: actions/upload-pages-artifact@7b1f4a764d45c48632c6b24a0339c27f5614fb0b
uses: actions/upload-pages-artifact@fc324d3547104276b827a68afc52ff2a11cc49c9 # v5.0.0
with:
path: website/dist

- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@d6db90164ac5ed86f2b6aed7e0febac5b3c0c03e
uses: actions/deploy-pages@368f82528645a54fb793d4d04e342629a3f51346 # v5.0.1
10 changes: 6 additions & 4 deletions .github/workflows/publish-packages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,15 +35,13 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Check out
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
fetch-depth: 0
token: ${{ secrets.GITHUB_TOKEN }}

- name: Setup workspace
uses: ./.github/actions/setup-workspace
with:
registry-url: "https://registry.npmjs.org"

- name: Run repo guards
run: pnpm check:guards
Expand Down Expand Up @@ -71,7 +69,11 @@ jobs:
run: pnpm --filter @layoutit/polycss-morph test:package

- name: Publish to npm
run: pnpm --filter "./packages/*" --filter "!@layoutit/polycss-domformat" -r publish --access public --no-git-checks
run: |
NPMRC="$(mktemp)"
trap 'rm -f "$NPMRC"' EXIT
printf 'registry=https://registry.npmjs.org/\n//registry.npmjs.org/:_authToken=%s\n' "$NODE_AUTH_TOKEN" > "$NPMRC"
NPM_CONFIG_USERCONFIG="$NPMRC" pnpm --filter "./packages/*" --filter "!@layoutit/polycss-domformat" -r publish --access public --no-git-checks
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

Expand Down
4 changes: 2 additions & 2 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ Public API is **mirrored** across React and Vue. Explicit `*/three` subpaths (`@

## Tests, visual gates & build

- **One-command local preflight:** `pnpm verify` runs `check:guards`, `test`, `build:packages`, `typecheck`, `check:ir`, `check:packs`, `bench:build`, and `examples/*` builds. `pnpm test:coverage` enforces coverage thresholds across all 8 workspace packages.
- **One-command local preflight:** `pnpm verify` runs `check:guards`, `test`, `test:website`, `build:packages`, `typecheck`, `typecheck:website`, `typecheck:examples`, `check:ir`, `check:packs`, `bench:build`, and `examples/*` builds. `pnpm test:coverage` enforces coverage thresholds across all 8 workspace packages.
- **`pnpm test && pnpm build` is mandatory** before opening a PR (Vitest does not catch `tsup`/DTS declaration errors). Never delete or weaken tests to pass a refactor.
- **Renderer changes require fail-closed `pixelmatch` static + 360° video triptych gates** via `bench/visual-gate.mjs` (`pixelmatch` + `pngjs` in Node):
- `pnpm bench:gate:parity` — HEAD internal equivalence (4-way renderer parity across vanilla/html/react/vue, strategy parity vs `all-s`, dynamic vs baked, shadows, translucent faces, plus fail-closed `renderStats` tag-shift checks) with zero static PNG baselines.
Expand All @@ -85,7 +85,7 @@ Public API is **mirrored** across React and Vue. Explicit `*/three` subpaths (`@
- `pnpm bench:gate:perf -- --base-ref <ref>` — fail-closed A/B perf gate (`bench/perf-gate.mjs`): enforces active motion, 0 per-frame descendant DOM mutations, exact leaf counts, no non-bucket DOM/style/`<s>`/layout regressions, and paired p50/p95/JS-per-frame/bimodal budgets on Chromium.
- `pnpm bench:gate:lifecycle` — fail-closed Node SSR + Chromium lifecycle gate (`bench/lifecycle-gate.mjs`): verifies pure Node SSR (zero DOM globals), React `<StrictMode>` remounts and textured `<Poly>` blob URLs, `setOptions` / 3× rebake / `undefined` clears, real `.vox` class updates, stable-topology overrides, dynamic shadow emits, Vue async `src` single-mount, and controls interaction.
- Shared browser and `ffmpeg` discovery lives in `bench/browser-discovery.mjs`. Gate fail-closed invariants are unit-tested in `bench/{visual,perf,lifecycle}-gate.test.mjs` (`pnpm test:scripts`).
- **CI (`.github/workflows/ci.yml`)** runs `test-and-build` (`check:guards`, unified `test:coverage`, `build:packages`, `typecheck`, `check:packs`, `check:ir`, website/bench/examples), path-filtered PR `visual-gate` (Chromium + Firefox), `perf-gate` (paired A/B on Chromium), `lifecycle-gate` (Node SSR + Chromium), and `certify-domformat-browser` / `certify-gallery-domformat-corpus` (path-filtered on PRs, unconditional on `push: main`). `.github/workflows/publish-packages.yml` runs `check:guards`, `test`, `build:packages`, `typecheck`, `check:ir`, `check:packs`, and `morph test:package` before publishing.
- **CI (`.github/workflows/ci.yml`)** runs `test-and-build` (`check:guards`, unified `test:coverage`, `build:packages`, `typecheck`, `check:packs`, `check:ir`, `test:website`, website/bench/examples typecheck & builds), path-filtered PR `visual-gate` (Chromium + Firefox), `perf-gate` (paired A/B on Chromium), `lifecycle-gate` (Node SSR + Chromium), and `certify-domformat-browser` / `certify-gallery-domformat-corpus` (path-filtered on PRs, unconditional on `push: main`). `.github/workflows/publish-packages.yml` runs `check:guards`, `test`, `build:packages`, `typecheck`, `check:ir`, `check:packs`, and `morph test:package` before publishing.
- **Pre-push & dead-code hygiene:** Check `.github/workflows/ci.yml` path filters before editing peripheral packages (`packages/domformat` triggers the 45-minute `certify-domformat-browser` job; `packages/morph` is tested against npm-published `@layoutit/polycss-core` by `test:package:registry`). Always grep the entire repo including `.agents/` (e.g., `.agents/skills/chrome-trace/scripts/`) before deleting any export.

## Style / process
Expand Down
1 change: 1 addition & 0 deletions examples/html/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
"scripts": {
"dev": "vite",
"build": "vite build",
"typecheck": "tsc --noEmit",
"preview": "vite preview"
},
"dependencies": {
Expand Down
1 change: 1 addition & 0 deletions examples/react/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
"scripts": {
"dev": "vite",
"build": "vite build",
"typecheck": "tsc --noEmit",
"preview": "vite preview"
},
"dependencies": {
Expand Down
1 change: 1 addition & 0 deletions examples/vanilla/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
"scripts": {
"dev": "vite",
"build": "vite build",
"typecheck": "tsc --noEmit",
"preview": "vite preview"
},
"dependencies": {
Expand Down
1 change: 1 addition & 0 deletions examples/vue/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
"scripts": {
"dev": "vite",
"build": "vite build",
"typecheck": "tsc --noEmit",
"preview": "vite preview"
},
"dependencies": {
Expand Down
4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,11 @@
"check:ir": "node --test bench/renderer-ir-conformance.test.mjs",
"typecheck": "pnpm --filter './packages/*' -r --if-present typecheck",
"typecheck:website": "pnpm --filter @layoutit/polycss-website typecheck",
"typecheck:examples": "pnpm --filter './examples/*' -r typecheck",
"test:website": "pnpm --filter @layoutit/polycss-website test:unit",
"test:scripts": "node --test .github/scripts/*.test.mjs bench/visual-gate.test.mjs bench/perf-gate.test.mjs bench/lifecycle-gate.test.mjs",
"check:guards": "pnpm test:scripts && pnpm check:readmes && pnpm check:skill && pnpm check:map && pnpm check:boundaries && pnpm check:mirrors --require-base && pnpm check:exports",
"verify": "pnpm check:guards && pnpm test && pnpm build:packages && pnpm typecheck && pnpm typecheck:website && pnpm check:ir && pnpm check:packs && pnpm bench:build && pnpm --filter './examples/*' -r build",
"verify": "pnpm check:guards && pnpm test && pnpm test:website && pnpm build:packages && pnpm typecheck && pnpm typecheck:website && pnpm typecheck:examples && pnpm check:ir && pnpm check:packs && pnpm bench:build && pnpm --filter './examples/*' -r build",
"publish:all": "pnpm sync:readmes && pnpm --filter './packages/*' --filter '!@layoutit/polycss-domformat' -r publish --access public",
"dev:website": "pnpm --filter @layoutit/polycss-website dev",
"gallery:domformat": "pnpm --filter @layoutit/polycss-website generate:domformat",
Expand Down
11 changes: 10 additions & 1 deletion packages/morph/src/contracts/validation.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,16 @@ describe("validatePolyMorphModel", () => {
});

it("keeps internal leaf tags out of the public contracts", () => {
const publicFiles = ["types.ts", "validation.ts", "index.ts"].map((name) =>
const publicFiles = [
"types.ts",
"validation.ts",
"index.ts",
"validation/primitives.ts",
"validation/metadata.ts",
"validation/deformation.ts",
"validation/motion.ts",
"validation/render.ts",
].map((name) =>
readFileSync(fileURLToPath(new URL(name, import.meta.url)), "utf8").toLowerCase());
for (const source of publicFiles) {
expect(source).not.toMatch(/<(?:b|i|s|u)>/);
Expand Down
Loading
Loading