feat(view): graduate view toward Stable — declarative transitions + optional compiler (#136, #137, #138) - #155
Merged
Conversation
…ptional compiler (#136, #137, #138) Implements all three open `view` tickets in one branch. #136 — Promote `view` to Stable (freeze the directive contract): - Resolve the `bq-for` duplicate-key edge case: colliding keys now fall back to a deterministic, referentially-stable composite key so duplicate rows reuse their DOM across re-renders; the warning is dev-only and emitted once per offending key. - Resolve object-expression shorthand: `bq-class="{ active }"` behaves like JS object shorthand (`{ active: active }`) instead of being silently dropped. - Freeze the directive set/grammar and publish a per-directive SSR support matrix; stability section, README/introduction, and module header updated. #137 — Declarative enter/leave/move transitions: - Companion attributes `bq-transition`, `bq-in`, `bq-out`, `bq-transition-duration`, `bq-transition-easing` on `bq-if`/`bq-show`, and `bq-animate="flip"` on `bq-for`. - Thin layer over the `motion` engine (Web Animations + FLIP): no animation on first paint, leave defers removal, race-safe toggles, and honours prefers-reduced-motion (including the FLIP move path). #138 — Optional compiled-template path: - New `@bquery/bquery/view/compiler` entry: a `with`-free expression transform, template walker, ES-module emitter, and a dependency-free CLI (`bquery-view-compile`). - Runtime hooks `registerCompiledExpressions` / `clearCompiledExpressions`; the runtime evaluator stays the default and un-compilable expressions fall back transparently, so compiled and runtime paths are behaviourally identical. Tests: tests/view-stable.test.ts, tests/view-transitions.test.ts, tests/view-compiler.test.ts (42 new cases). Full suite 2854 pass; tsc, eslint, and lib/types/umd builds green. Co-Authored-By: Claude Opus 4.8 <[email protected]>
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
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.
Collected PR for all three open
viewtickets, implemented on one branch.Closes #136
Closes #137
Closes #138
#136 — Promote
viewto Stable (freeze the directive contract)bq-forduplicate-key edge case resolved. Colliding:keyvalues fall back to a deterministic, referentially-stable composite key, so duplicate rows reuse their DOM across re-renders instead of being recreated. The duplicate-key warning is now dev-only and emitted once per offending key instead of on every reactive update.bq-class="{ active }"(andbq-style/bq-ariaobject syntax) now behaves like JS object shorthand ({ active: active }) instead of silently dropping the property.#137 — Declarative enter/leave/move transitions
A thin declarative layer over the existing
motionengine — no second animation engine.bq-transition/bq-in/bq-outbq-if/bq-show/bq-forbq-transition-duration/bq-transition-easingbq-animate="flip"bq-forPresets:
fade,scale,slide,slide-up/-down/-left/-right. Behaviour: no animation on first paint;bq-if/bq-fordefer removal until the leave finishes; rapid toggles are race-safe; andprefers-reduced-motionis honoured everywhere, including the FLIP path.#138 — Optional compiled-template path
New opt-in entry
@bquery/bquery/view/compilerthat pre-parsesbq-*expressions at build time into optimized,with-free update functions (CSP-safe, nonew Function()on the hot path).compileViews(),compileToModule(),compileExpression(),emitModule()— small transforms usable from any bundler.bquery-view-compile [options] <file...>(runCompileCli/compileFiles).registerCompiledExpressions()/clearCompiledExpressions()(from@bquery/bquery/view). The runtime evaluator stays the default; expressions the compiler can't statically handle fall back transparently, so both paths are behaviourally identical. Skipped expressions are reported instats.skipped— nothing is silently dropped.Quality
tests/view-stable.test.ts,tests/view-transitions.test.ts,tests/view-compiler.test.ts(compiler tests eval the emitted source to assert semantic identity).tsc --noEmit,eslint, andbuild:lib/build:types/build:umdall green;check-full-bundlein sync.bq-if/bq-showcancel an in-flight leave before restarting, and the SSR matrix'sbq-html-saferow was corrected (it is client-only).🤖 Generated with Claude Code