feat: action runner + PrismScene public embed API#3
Merged
Conversation
Extends Solar so a single bundle now serves three identical consumers (Pulsar CEF, Prism webview, arbitrary web embed) with a stable JS API, and consumes Prism's Action descriptors locally rather than receiving dense patches frame-by-frame over the wire. Why now : without this, Prism's animation redesign (P6) can't close the broadcast loop — animations would compose in preview but never land in Pulsar or in a web embed. Highlights : - Patch.action descriptor (count-up, curve-path, text-reveal, stagger-group, reorder, mask-reveal) — additive, fully backward compatible with patches that have no action. - animate/flip.ts as single source of truth for FLIP, shared with Prism preview via @zablab/solar/animate/flip. - PrismScene class : mount/unmount/play/stop/on/off/connectToOrion/ setScene. Concurrency-safe (ALREADY_PLAYING) and abortable. - Packaging : ESM main + ESM alias + UMD + animate/flip subpath + public .d.ts. Tarball under the 80KB minified+gzipped budget. - Docs : embed-on-website.md (client deliverable) + action- descriptors.md (protocol reference). - Examples : embed-vanilla (<script>) + embed-react (forwardRef). - 68 vitest tests green ; lint + typecheck clean. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Closes the broadcast loop for Prism's animation redesign (P6 blocker)
and makes Solar embeddable in arbitrary web pages without Pulsar, CEF,
or Electron. Three consumers, one API : Prism preview (webview), Pulsar
broadcast (CEF), web embed (host page).
Changes
Patch.actiondescriptor on the wire protocol — six built-inkinds (
count-up,curve-path,text-reveal,stagger-group,reorder,mask-reveal). Patches withoutactionflow throughthe existing
transitions.tsmapper untouched — fully backwardcompatible.
animate/action-runner.tsdispatcher + per-kind sub-runnersin
animate/runners/. Unknown kinds throwUnknownActionKindError.Hosts can register custom runners via
registerActionRunner().animate/flip.ts— single source of truth for FLIP. Solar'sreorderrunner consumes it directly ; Prism's preview willimport it via
@zablab/solar/animate/flipat P5.animate/easing-resolver.ts—EasingRef→ CSS easing +t → eased tfor runners that compute values in JS.PrismScenepublic class —mount,unmount,playAnimation,stopAnimation,on/off,connectToOrion,disconnectFromOrion,setScene. Concurrency-safe (rejectsdouble plays of the same asset with
code: "ALREADY_PLAYING")and abortable.
data-anim-path/data-anim-attr. ${param.*} interpolation through patchpath/value and action params.
animate/flipsubpath + public.d.ts.npm publish --dry-rungreen. Runtime gzipped budget : UMD 18.78 KiB ; ESM ~17.8 KiB.
Well under the 80 KB criterion.
docs/embed-on-website.md(client deliverable),docs/action-descriptors.md(protocol reference).examples/embed-vanilla/(<script>tag) +examples/embed-react/(forwardRefwrapper).0.2.0.react,react-dom,framer-motionmoved topeerDependencies;hosts supply their own copies.
Acceptance criteria
npm run lint && typecheck && test && buildgreentests/unit/runners-count-up.test.tstests/unit/runners-reorder-flip.test.tstests/unit/runners-text-reveal.test.tsexamples/embed-vanilla/examples/embed-react/Test plan
npm run lint && npm run typecheckcleannpm test— 68 vitest tests green (11 suites)npm run build— ESM + UMD + flip subpath + types emittednpm publish --dry-run— tarball valid, all required artefacts presentexamples/embed-vanilla/index.htmlin a browser, click the button, verify count-up animationexamples/embed-react/PrismSceneEmbed.tsxinto a React app, verify play prop triggers animation🤖 Generated with Claude Code