Skip to content

feat(view): graduate view toward Stable — declarative transitions + optional compiler (#136, #137, #138) - #155

Merged
JosunLP merged 1 commit into
devfrom
feat/view-stable-transitions-compiler
Jun 28, 2026
Merged

feat(view): graduate view toward Stable — declarative transitions + optional compiler (#136, #137, #138)#155
JosunLP merged 1 commit into
devfrom
feat/view-stable-transitions-compiler

Conversation

@JosunLP

@JosunLP JosunLP commented Jun 28, 2026

Copy link
Copy Markdown
Collaborator

Collected PR for all three open view tickets, implemented on one branch.

Closes #136
Closes #137
Closes #138

#136 — Promote view to Stable (freeze the directive contract)

  • bq-for duplicate-key edge case resolved. Colliding :key values 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.
  • Object-expression shorthand resolved. bq-class="{ active }" (and bq-style / bq-aria object syntax) now behaves like JS object shorthand ({ active: active }) instead of silently dropping the property.
  • Directive contract frozen and a per-directive SSR support matrix published in the View guide. README, introduction, the module header, and the directive reference are updated to "targeting Stable in 1.15.0".

#137 — Declarative enter/leave/move transitions

A thin declarative layer over the existing motion engine — no second animation engine.

Attribute Applies to Purpose
bq-transition / bq-in / bq-out bq-if / bq-show / bq-for Named-preset enter/leave
bq-transition-duration / bq-transition-easing same Timing
bq-animate="flip" bq-for FLIP move on reorder

Presets: fade, scale, slide, slide-up/-down/-left/-right. Behaviour: no animation on first paint; bq-if/bq-for defer removal until the leave finishes; rapid toggles are race-safe; and prefers-reduced-motion is honoured everywhere, including the FLIP path.

#138 — Optional compiled-template path

New opt-in entry @bquery/bquery/view/compiler that pre-parses bq-* expressions at build time into optimized, with-free update functions (CSP-safe, no new Function() on the hot path).

  • compileViews(), compileToModule(), compileExpression(), emitModule() — small transforms usable from any bundler.
  • Dependency-free CLI: bquery-view-compile [options] <file...> (runCompileCli / compileFiles).
  • Runtime hooks 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 in stats.skipped — nothing is silently dropped.

Quality

  • 42 new tests across 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).
  • Full suite 2854 pass / 0 fail; tsc --noEmit, eslint, and build:lib / build:types / build:umd all green; check-full-bundle in sync.
  • An adversarial multi-agent review of the diff was run; three confirmed findings were fixed before this PR: FLIP now honours reduced motion, bq-if/bq-show cancel an in-flight leave before restarting, and the SSR matrix's bq-html-safe row was corrected (it is client-only).

🤖 Generated with Claude Code

…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]>
@coderabbitai

coderabbitai Bot commented Jun 28, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 38f313dd-0325-4688-aa7b-4927e3ebac88

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/view-stable-transitions-compiler

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@github-actions github-actions Bot added view Changes to the view module docs Changes to the documentation tests Chenges to the tests build Changes to the build and meta files labels Jun 28, 2026
@JosunLP
JosunLP merged commit 5f26bd7 into dev Jun 28, 2026
9 checks passed
@JosunLP
JosunLP deleted the feat/view-stable-transitions-compiler branch June 28, 2026 20:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

build Changes to the build and meta files docs Changes to the documentation tests Chenges to the tests view Changes to the view module

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant