diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..263a5ea --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,38 @@ +name: CI + +on: + push: + branches: [main] + pull_request: + branches: [main] + +jobs: + test: + name: Node ${{ matrix.node }} + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + node: [18, 20, 22] + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-node@v4 + with: + node-version: ${{ matrix.node }} + cache: npm + - run: npm ci + - name: Syntax check + run: | + node --check galaxy.js + node --check mcp/server.mjs && node --check mcp/tools.mjs && node --check mcp/build-manifest.cjs + node --check build.mjs && node --check test.mjs && node --check test-mcp.mjs + - name: Lint + run: npm run lint + - name: Manifest is in sync + run: node mcp/build-manifest.cjs && git diff --exit-code galaxy.manifest.json + - name: Build minified bundles + run: npm run build:min + - name: Contract test (no SDK) + run: npm test + - name: End-to-end MCP integration test + run: npm run test:mcp diff --git a/CHANGELOG.md b/CHANGELOG.md index 43762d9..8b74848 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,37 @@ All notable changes are documented here. Format: [Keep a Changelog](https://keepachangelog.com/); versioning: [SemVer](https://semver.org/). +## [3.3.0] "Deep Field" — 2026-07-28 +### Added +- **A WebGL2 tier — still zero dependencies.** `registerAnimation` accepts + `renderer: "webgl2"`, and a new `registerShader(name, { defaults, uniforms, fragment })` helper + compiles a full-screen fragment shader and hands it the same lifecycle every 2D animation gets: + DPR-clamped `ResizeObserver` sizing, pointer input as `uMouse`, `IntersectionObserver` + suspension while off-screen, and one still frame under `prefers-reduced-motion`. Geometry is a + single full-screen triangle derived from `gl_VertexID`, so no vertex buffer is allocated. + Uniform declarations are generated from the arity of the values you pass, so changing an option + never recompiles the program. Hosts expose `host.gl` and `host.reduced`. +- **`glPosterFallback`** — when a browser cannot supply a WebGL2 context, a shader surface paints a + static 2D poster from its own palette instead of leaving an empty canvas. +- **20 animations (60 → 80).** + - Relativistic & gravitational: `lensing`, `accretionDisk`, `nBody`, `tidalStream`, `inspiral` + - Volumetric & raymarched: `volumetricNebula`, `starSurface`, `atmosphere`, `dustLanes`, + `protoplanetary` + - Instruments: `spectrograph`, `transitCurve`, `waterfall`, `hrDiagram`, `pulsarTiming` + - Pointer-driven & generative: `gravityWell`, `nebulaPaint`, `solarWind`, `starForge`, + `relativisticJets` + +### Changed +- `galaxy.d.ts` now declares all 80 names in `AnimationType`. +- **Expected counts in every test now derive from the generated manifest.** `test.mjs` and + `test-mcp.mjs` previously asserted the literal `60`, which fails on every addition and trains you + to bump the number rather than read the failure. A `>= 80` floor still catches accidental + deletion. +- `test.mjs` gained a WebGL2 lifecycle contract: `registerShader` present, a WebGL2 context + requested, a 2D fallback available, and an assertion that the library **never** force-loses a + WebGL context — a canvas returns the same context object on every `getContext`, so losing it + would poison any later mount on that canvas. + ## [3.2.0] "Cinematic" — 2026-06-22 ### Added - **`Galaxy.scrollScene(stickyStage, config)`** — a new top-level API that binds page-scroll diff --git a/README.md b/README.md index 0ca7c95..14274b3 100644 --- a/README.md +++ b/README.md @@ -9,12 +9,37 @@ no framework, ~20 kB gzipped. [![CI](https://github.com/Edwson/GalaxyJS/actions/workflows/ci.yml/badge.svg)](https://github.com/Edwson/GalaxyJS/actions/workflows/ci.yml) [![License](https://img.shields.io/badge/License-MIT-green.svg)](LICENSE) ![Zero dependencies](https://img.shields.io/badge/dependencies-0-7c5cff) -![Version](https://img.shields.io/badge/version-3.2-22d3ee) +![Version](https://img.shields.io/badge/version-3.3-22d3ee) > Live demo: https://edwson.github.io/GalaxyJS/ (mirror: https://edwson.com/GalaxyJS/) · Open [`index.html`](index.html) locally for the interactive playground. --- +## ✨ What's new in v3.3 "Deep Field" + +**Twenty new animations (60 → 80) and a WebGL2 tier — with no new dependencies.** + +Canvas 2D is still the default renderer and the fallback. Eight of the new animations declare +`renderer: "webgl2"` and a hand-written GLSL fragment shader; a shared `registerShader` helper +gives them the same lifecycle every 2D animation already gets — DPR-clamped resize, pointer +input, off-screen suspension, and a single still frame under `prefers-reduced-motion`. Geometry is +one full-screen triangle generated from `gl_VertexID`, so there is nothing to allocate and nothing +to leak. **If WebGL2 is unavailable the surface renders a 2D poster instead of an empty canvas.** + +- **Relativistic & gravitational** — `lensing` (Schwarzschild deflection and the Einstein ring), + `accretionDisk` (Doppler beaming + gravitational redshift), `nBody`, `tidalStream`, `inspiral` +- **Volumetric & raymarched (WebGL2)** — `volumetricNebula` (Beer–Lambert absorption with a + Henyey–Greenstein phase function), `starSurface` (granulation + limb darkening + prominences), + `atmosphere` (Rayleigh + Mie scattering), `dustLanes` (self-shadowed dust), `protoplanetary` +- **Instruments** — `spectrograph`, `transitCurve`, `waterfall`, `hrDiagram`, `pulsarTiming` +- **Pointer-driven & generative** — `gravityWell`, `nebulaPaint` (an advecting, diffusing fluid you + paint into), `solarWind` (bow shock + polar cusps), `starForge`, `relativisticJets` + +```html +
+ +``` + ## ✨ What's new in v3.2 "Cinematic" - **`Galaxy.scrollScene()`** — bind page scroll to a crossfading sequence of scenes. One call turns @@ -25,7 +50,7 @@ no framework, ~20 kB gzipped. ## ✨ What's new in v3 "Nova" - **One unified API** — `Galaxy.create(type, target, options)` for every animation. -- **60 canvas animations** — starfield, warp, black hole, nebula, spiral galaxy, meteors, constellation, particle field, aurora, wormhole, orbits, pulsar, mesh gradient, fireflies, matrix rain, plasma, fireworks, snow, waves, DNA helix, lightning, ripples, comets, confetti, bubbles, fog, synthwave grid, rain, vortex, sparkle, neon tunnel, swarm, ribbons, flow field, dotted globe, heartbeat, equalizer, clock, light rays, radar, embers, typewriter, spirograph, **and 17 new in v3.1** — supernova, quasar, star cluster, cosmic web, eclipse, solar corona, galaxy merge, crystal lattice, moiré, starburst, nebula pillars, ion storm, stardust, orrery, oscilloscope, bokeh, magnetosphere. +- **80 canvas & WebGL2 animations** — starfield, warp, black hole, nebula, spiral galaxy, meteors, constellation, particle field, aurora, wormhole, orbits, pulsar, mesh gradient, fireflies, matrix rain, plasma, fireworks, snow, waves, DNA helix, lightning, ripples, comets, confetti, bubbles, fog, synthwave grid, rain, vortex, sparkle, neon tunnel, swarm, ribbons, flow field, dotted globe, heartbeat, equalizer, clock, light rays, radar, embers, typewriter, spirograph, **and 17 new in v3.1** — supernova, quasar, star cluster, cosmic web, eclipse, solar corona, galaxy merge, crystal lattice, moiré, starburst, nebula pillars, ion storm, stardust, orrery, oscilloscope, bokeh, magnetosphere, **and 20 new in v3.3** — lensing, accretion disk, n-body, tidal stream, inspiral, volumetric nebula, star surface, atmosphere, dust lanes, protoplanetary disk, spectrograph, transit curve, radio waterfall, H-R diagram, pulsar timing, gravity well, nebula paint, solar wind, star forge, relativistic jets. - **A real UI kit** — buttons, cards, modals, toasts, tooltips, tabs, accordions, dropdowns, inputs, switches, progress, spinners — all driven by design tokens. - **Theming** — light/dark out of the box, fully tokenized via CSS variables and `Galaxy.theme()`. - **Accessible & efficient** — respects `prefers-reduced-motion`, one shared rAF loop for the whole page, auto-pause off-screen, HiDPI-aware. diff --git a/galaxy.d.ts b/galaxy.d.ts index f53b848..2400f2f 100644 --- a/galaxy.d.ts +++ b/galaxy.d.ts @@ -65,6 +65,26 @@ export type AnimationType = | "orrery" | "oscilloscope" | "bokeh" + | "lensing" + | "accretionDisk" + | "nBody" + | "tidalStream" + | "inspiral" + | "volumetricNebula" + | "starSurface" + | "atmosphere" + | "dustLanes" + | "protoplanetary" + | "spectrograph" + | "transitCurve" + | "waterfall" + | "hrDiagram" + | "pulsarTiming" + | "gravityWell" + | "nebulaPaint" + | "solarWind" + | "starForge" + | "relativisticJets" | "magnetosphere"; /** A CSS selector string or an existing element. */ diff --git a/galaxy.js b/galaxy.js index 4684284..d879bcb 100644 --- a/galaxy.js +++ b/galaxy.js @@ -1,4 +1,4 @@ -/*! GalaxyJS v3.2 "Cinematic" — galaxy.js +/*! GalaxyJS v3.3 "Deep Field" — galaxy.js * A zero-dependency cosmic animation + UI component library. * Unified API: Galaxy.create(type, target, options) · Galaxy.scrollScene(stage, config) * UMD: works as - + +