Skip to content

Conversation

edison1105
Copy link
Member

@edison1105 edison1105 commented Feb 27, 2025

Compiler Changes

  • Within Vapor components
    • Transition is automatically rewritten as VaporTransition
    • TransitionGroup is automatically rewritten as VaporTransitionGroup
  • When the root node of a Transition uses the v-if, the compiler automatically adds a $key property to the rendering result, making it easier for the runtime to track the element's leaving state using the key
  <Transition>
    <h1 v-if="show">
      <span>HI</span>
    </h1>
  </Transition>

will be compiled to

  const n4 = _createComponent(_VaporTransition, null, {
    "default": () => {
      const n1 = _createIf(() => (_ctx.show), () => {
        const n3 = t1()
        n3.$key = 3 // adds a `$key` 
        return n3
      })
      return n1
    }
  })
  • When the root node of a Transition has an explicit key, the compiler generates code that includes createKeyedFragment, which creates a new DynamicFragment when the key changes, triggering transitions
  <Transition>
    <span :key="count">{{ count }}</span>
  </Transition>

will be compiled to

  const n1 = _createComponent(_VaporTransition, null, {
    "default": () => {
      return _createKeyedFragment(() => _ctx.count, () => {
        const n0 = t0()
        const x0 = _child(n0)
        _renderEffect(() => _setText(x0, _toDisplayString(_ctx.count)))
        n0.$key = _ctx.count
        return n0
      })
    }
  })
  • When appear is set in the Transition and the root node uses v-show, it need to execute applyVShow after the Transition is created to ensure that the appear behavior works properly.
  <div>
    <transition appear>
      <div v-show="!toggle">content</div>
    </transition>
  </div>

will be compiled to

  const deferredApplyVShows = []
  const n2 = t1()
  const n1 = _createComponent(_VaporTransition, {
    appear: () => (""), 
    persisted: () => ("")
  }, {
    "default": () => {
      const n0 = t0()
      deferredApplyVShows.push(() => _applyVShow(n0, () => (!toggle.value)))
      return n0
    }
  })
  _insert(n1, n2)
  deferredApplyVShows.forEach(fn => fn())
  return n2

Runtime Changes

  • Added VaporTransition and VaporTransitionGroup components that reuses most of the logic from runtime-dom/Transition
  • Transition hooks are now stored on the block.$transition property
  • DynamicFragment Update Logic Modification:
    • When removing old elements, leave animations are triggered
    • When rendering new elements, enter animations are triggered
  • Extracted baseResolveTransitionHooks from the existing resolveTransitionHooks function to be shared between VaporTransition and Transition. Each component passes its own specific TransitionHooksContext
  • Interop:
    • Existing Transition component now supports rendering Vapor components

Tests

  • Ported all test cases except those related to KeepAlive, Suspense, and Teleport from packages/vue/tests/e2e/Transition.spec.ts
  • Ported all test cases from packages/vue/tests/e2e/TransitionGroup.spec.ts

Copy link

netlify bot commented Feb 27, 2025

Deploy Preview for vapor-repl ready!

Name Link
🔨 Latest commit 58ac955
🔍 Latest deploy log https://app.netlify.com/projects/vapor-repl/deploys/6854cdcab5b6cb00087a9aca
😎 Deploy Preview https://deploy-preview-12962--vapor-repl.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

Copy link

pkg-pr-new bot commented Feb 27, 2025

Open in StackBlitz

@vue/compiler-core

npm i https://pkg.pr.new/@vue/compiler-core@12962

@vue/compiler-dom

npm i https://pkg.pr.new/@vue/compiler-dom@12962

@vue/compiler-sfc

npm i https://pkg.pr.new/@vue/compiler-sfc@12962

@vue/compiler-ssr

npm i https://pkg.pr.new/@vue/compiler-ssr@12962

@vue/compiler-vapor

npm i https://pkg.pr.new/@vue/compiler-vapor@12962

@vue/reactivity

npm i https://pkg.pr.new/@vue/reactivity@12962

@vue/runtime-core

npm i https://pkg.pr.new/@vue/runtime-core@12962

@vue/runtime-dom

npm i https://pkg.pr.new/@vue/runtime-dom@12962

@vue/runtime-vapor

npm i https://pkg.pr.new/@vue/runtime-vapor@12962

@vue/server-renderer

npm i https://pkg.pr.new/@vue/server-renderer@12962

@vue/shared

npm i https://pkg.pr.new/@vue/shared@12962

vue

npm i https://pkg.pr.new/vue@12962

@vue/compat

npm i https://pkg.pr.new/@vue/compat@12962

commit: 9f8bcbb

@edison1105 edison1105 force-pushed the edison/feat/vaporTransition branch from 47e4e13 to 71db1e0 Compare February 27, 2025 09:29
@edison1105 edison1105 force-pushed the edison/feat/vaporTransition branch from 71db1e0 to 41822e3 Compare February 27, 2025 09:36
@edison1105 edison1105 force-pushed the edison/feat/vaporTransition branch 2 times, most recently from a6362cb to 989e79f Compare March 3, 2025 14:04
@edison1105 edison1105 force-pushed the edison/feat/vaporTransition branch from 989e79f to 1e79054 Compare March 3, 2025 14:07
@edison1105 edison1105 force-pushed the edison/feat/vaporTransition branch from 93a4de3 to f139002 Compare March 4, 2025 12:14
@edison1105 edison1105 added the scope: vapor related to vapor mode label Mar 4, 2025
@edison1105 edison1105 force-pushed the edison/feat/vaporTransition branch from f139002 to 841e0cf Compare March 4, 2025 13:12
@edison1105 edison1105 force-pushed the edison/feat/vaporTransition branch from 841e0cf to 11bcb21 Compare March 4, 2025 14:02
@edison1105 edison1105 force-pushed the edison/feat/vaporTransition branch from 1b5e9ef to 27d15c5 Compare March 5, 2025 01:06
@edison1105 edison1105 force-pushed the edison/feat/vaporTransition branch from 27d15c5 to 3fcba1d Compare March 5, 2025 01:26
@edison1105 edison1105 force-pushed the edison/feat/vaporTransition branch from 44be78b to afc732e Compare March 5, 2025 09:13
@edison1105 edison1105 force-pushed the edison/feat/vaporTransition branch from 3048952 to 9ee219a Compare March 14, 2025 06:40
@edison1105 edison1105 force-pushed the edison/feat/vaporTransition branch from d486cf8 to 2caeecd Compare March 14, 2025 09:37
@edison1105 edison1105 force-pushed the edison/feat/vaporTransition branch from 4c016a8 to e42ff1b Compare March 17, 2025 06:52
@edison1105 edison1105 marked this pull request as ready for review March 17, 2025 06:57
Copy link

coderabbitai bot commented Jun 19, 2025

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.

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

✨ Finishing Touches
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch edison/feat/vaporTransition

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

@edison1105 edison1105 force-pushed the edison/feat/vaporTransition branch from 41aba70 to 542e401 Compare June 19, 2025 06:59
Base automatically changed from vapor to minor July 7, 2025 00:06
Copy link

Size Report

Bundles

File Size Gzip Brotli
compiler-dom.global.prod.js 84.6 kB (+526 B) 30 kB (+168 B) 26.4 kB (+228 B)
runtime-dom.global.prod.js 104 kB (+490 B) 39.3 kB (+114 B) 35.4 kB (+156 B)
vue.global.prod.js 163 kB (+488 B) 59.5 kB (+150 B) 52.9 kB (+108 B)

Usages

Name Size Gzip Brotli
createApp (CAPI only) 47.3 kB (+115 B) 18.5 kB (+59 B) 16.9 kB (+42 B)
createApp 56.2 kB (+115 B) 21.6 kB (+44 B) 19.8 kB (+44 B)
createApp + vaporInteropPlugin 77.7 kB (+9.15 kB) 29.1 kB (+3.27 kB) 26.4 kB (+2.85 kB)
createVaporApp 30.5 kB (+9.5 kB) 11.7 kB (+3.43 kB) 10.7 kB (+3.11 kB)
createSSRApp 60.5 kB (+134 B) 23.4 kB (+55 B) 21.3 kB (+67 B)
defineCustomElement 61.2 kB (+115 B) 23.2 kB (+57 B) 21.2 kB (+40 B)
overall 70.9 kB (+338 B) 26.9 kB (+86 B) 24.5 kB (+77 B)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
scope: vapor related to vapor mode
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant