diff --git a/packages/compiler-vapor/__tests__/__snapshots__/compile.spec.ts.snap b/packages/compiler-vapor/__tests__/__snapshots__/compile.spec.ts.snap index e4084a66fba..670ed8d17a8 100644 --- a/packages/compiler-vapor/__tests__/__snapshots__/compile.spec.ts.snap +++ b/packages/compiler-vapor/__tests__/__snapshots__/compile.spec.ts.snap @@ -38,7 +38,7 @@ export function render(_ctx) { "default": _withVaporCtx(() => { const n0 = _createIf(() => (true), () => { const n3 = t0() - _setInsertionState(n3, null, 0, true) + _setInsertionState(n3, null, 0) const n2 = _createComponentWithFallback(_component_Bar) _withVaporDirectives(n2, [[_directive_hello, void 0, void 0, { world: true }]]) return n3 @@ -159,7 +159,7 @@ export function render(_ctx, $props, $emit, $attrs, $slots) { const n3 = t1() const n2 = _child(n3, 1) _renderEffect(() => _setProp(n3, "id", _ctx.foo)) - _setInsertionState(n3, 0, 0, true) + _setInsertionState(n3, 0, 0) const n1 = _createComponentWithFallback(_component_Comp) _renderEffect(() => _setText(n2, _toDisplayString(_ctx.bar))) return [n0, n3] @@ -223,7 +223,7 @@ export function render(_ctx, $props, $emit, $attrs, $slots) { const n5 = _next(n2, 1) const n4 = _next(n5, 2) const x2 = _txt(n2) - _setInsertionState(n6, n5, 1, true) + _setInsertionState(n6, n5, 1) const n3 = _createComponentWithFallback(_component_Child) const x4 = _txt(n4) _renderEffect(() => _setText(x4, _toDisplayString(_ctx.useId()))) @@ -246,7 +246,7 @@ export function render(_ctx, $props, $emit, $attrs, $slots) { const _component_Child = _resolveComponent("Child") const n1 = t0() _renderEffect(() => _setProp(n1, "id", _ctx.useId())) - _setInsertionState(n1, null, 0, true) + _setInsertionState(n1, null, 0) const n0 = _createComponentWithFallback(_component_Child) return n1 }" @@ -280,7 +280,7 @@ export function render(_ctx) { const n4 = _child(p0) _setInsertionState(n6, n5, 1) const n0 = _createComponentWithFallback(_component_Comp) - _setInsertionState(n6, n7, 3, true) + _setInsertionState(n6, n7, 3) const n1 = _createIf(() => (true), () => { const n3 = t0() return n3 @@ -298,9 +298,9 @@ export function render(_ctx) { const _component_Comp = _resolveComponent("Comp") const n3 = t0() const n1 = _child(n3) - _setInsertionState(n1, null, 0, true) + _setInsertionState(n1, null, 0) const n0 = _createSlot("default", null) - _setInsertionState(n3, null, 1, true) + _setInsertionState(n3, null, 1) const n2 = _createComponentWithFallback(_component_Comp) return n3 }" diff --git a/packages/compiler-vapor/__tests__/compile.spec.ts b/packages/compiler-vapor/__tests__/compile.spec.ts index 4cf9ad286f1..58d852af1fd 100644 --- a/packages/compiler-vapor/__tests__/compile.spec.ts +++ b/packages/compiler-vapor/__tests__/compile.spec.ts @@ -266,7 +266,7 @@ describe('compile', () => { }) expect(code).contains( `_renderEffect(() => _setProp(n1, "id", _ctx.useId())) - _setInsertionState(n1, null, 0, true) + _setInsertionState(n1, null, 0) const n0 = _createComponentWithFallback(_component_Child)`, ) expect(code).matchSnapshot() diff --git a/packages/compiler-vapor/__tests__/transforms/__snapshots__/TransformTransition.spec.ts.snap b/packages/compiler-vapor/__tests__/transforms/__snapshots__/TransformTransition.spec.ts.snap index ed349cf93a8..960a99fe990 100644 --- a/packages/compiler-vapor/__tests__/transforms/__snapshots__/TransformTransition.spec.ts.snap +++ b/packages/compiler-vapor/__tests__/transforms/__snapshots__/TransformTransition.spec.ts.snap @@ -49,7 +49,7 @@ export function render(_ctx) { return n5 }, () => { const n14 = t2() - _setInsertionState(n14, 0, 0, true) + _setInsertionState(n14, 0, 0) const n9 = _createIf(() => (_ctx.c), () => { const n11 = t1() return n11 diff --git a/packages/compiler-vapor/__tests__/transforms/__snapshots__/logicalIndex.spec.ts.snap b/packages/compiler-vapor/__tests__/transforms/__snapshots__/logicalIndex.spec.ts.snap index 201dd5e8a3f..c34ea1aa123 100644 --- a/packages/compiler-vapor/__tests__/transforms/__snapshots__/logicalIndex.spec.ts.snap +++ b/packages/compiler-vapor/__tests__/transforms/__snapshots__/logicalIndex.spec.ts.snap @@ -11,7 +11,7 @@ export function render(_ctx) { const n3 = _next(_child(n2), 2) _setInsertionState(n2, 0, 0) const n0 = _createComponentWithFallback(_component_Comp1) - _setInsertionState(n2, n3, 2, true) + _setInsertionState(n2, n3, 2) const n1 = _createComponentWithFallback(_component_Comp2) return n2 }" @@ -31,7 +31,7 @@ export function render(_ctx) { const n0 = _createComponentWithFallback(_component_Comp1) _setInsertionState(n3, 0, 1) const n1 = _createComponentWithFallback(_component_Comp2) - _setInsertionState(n3, n4, 3, true) + _setInsertionState(n3, n4, 3) const n2 = _createComponentWithFallback(_component_Comp3) return n3 }" @@ -48,7 +48,7 @@ export function render(_ctx) { const n4 = _next(_child(n5), 1) _setInsertionState(n5, n4, 1) const n0 = _createComponentWithFallback(_component_Comp) - _setInsertionState(n5, null, 3, true) + _setInsertionState(n5, null, 3) const n1 = _createIf(() => (true), () => { const n3 = t0() return n3 @@ -69,7 +69,7 @@ export function render(_ctx) { const n6 = _nthChild(n5, 3, 3) _setInsertionState(n5, n4, 1) const n0 = _createComponentWithFallback(_component_Comp) - _setInsertionState(n5, n6, 3, true) + _setInsertionState(n5, n6, 3) const n1 = _createIf(() => (true), () => { const n3 = t0() return n3 @@ -88,7 +88,7 @@ export function render(_ctx) { const n2 = t0() _setInsertionState(n2, null, 1) const n0 = _createComponentWithFallback(_component_Comp1) - _setInsertionState(n2, null, 2, true) + _setInsertionState(n2, null, 2) const n1 = _createComponentWithFallback(_component_Comp2) return n2 }" @@ -101,7 +101,7 @@ const t0 = _template("
", true) export function render(_ctx) { const _component_Comp = _resolveComponent("Comp") const n1 = t0() - _setInsertionState(n1, null, 0, true) + _setInsertionState(n1, null, 0) const n0 = _createComponentWithFallback(_component_Comp) return n1 }" @@ -114,7 +114,7 @@ const t0 = _template("
A", true) export function render(_ctx) { const _component_Comp = _resolveComponent("Comp") const n1 = t0() - _setInsertionState(n1, null, 1, true) + _setInsertionState(n1, null, 1) const n0 = _createComponentWithFallback(_component_Comp) return n1 }" @@ -131,7 +131,7 @@ export function render(_ctx) { const n2 = _next(_child(n3), 1) _setInsertionState(n3, n2, 1) const n0 = _createComponentWithFallback(_component_Comp1) - _setInsertionState(n3, n2, 2, true) + _setInsertionState(n3, n2, 2) const n1 = _createComponentWithFallback(_component_Comp2) return n3 }" @@ -145,7 +145,7 @@ export function render(_ctx) { const _component_Comp = _resolveComponent("Comp") const n2 = t0() const n1 = _next(_child(n2), 1) - _setInsertionState(n2, n1, 1, true) + _setInsertionState(n2, n1, 1) const n0 = _createComponentWithFallback(_component_Comp) return n2 }" @@ -158,7 +158,7 @@ const t1 = _template("
A", true) export function render(_ctx) { const n2 = t1() - _setInsertionState(n2, null, 1, true) + _setInsertionState(n2, null, 1) const n0 = _createKeyedFragment(() => (_ctx.id), () => { const n1 = t0() return n1 @@ -175,7 +175,7 @@ const t1 = _template("
AB", true) export function render(_ctx) { const n3 = t1() const n2 = _next(_child(n3), 1) - _setInsertionState(n3, n2, 1, true) + _setInsertionState(n3, n2, 1) const n0 = _createKeyedFragment(() => (_ctx.id), () => { const n1 = t0() return n1 @@ -191,7 +191,7 @@ const t1 = _template("
A", true) export function render(_ctx) { const n2 = t1() - _setInsertionState(n2, 0, 0, true) + _setInsertionState(n2, 0, 0) const n0 = _createKeyedFragment(() => (_ctx.id), () => { const n1 = t0() return n1 @@ -210,7 +210,7 @@ export function render(_ctx) { const n2 = t0() _setInsertionState(n2, 0, 0) const n0 = _createComponentWithFallback(_component_Comp1) - _setInsertionState(n2, null, 2, true) + _setInsertionState(n2, null, 2) const n1 = _createComponentWithFallback(_component_Comp2) return n2 }" @@ -230,7 +230,7 @@ export function render(_ctx) { const n0 = _createComponentWithFallback(_component_Comp1) _setInsertionState(n3, n4, 2) const n1 = _createComponentWithFallback(_component_Comp2) - _setInsertionState(n3, null, 4, true) + _setInsertionState(n3, null, 4) const n2 = _createComponentWithFallback(_component_Comp3) return n3 }" @@ -246,7 +246,7 @@ export function render(_ctx) { const n2 = t0() _setInsertionState(n2, 0, 0) const n0 = _createComponentWithFallback(_component_Comp1) - _setInsertionState(n2, 0, 1, true) + _setInsertionState(n2, 0, 1) const n1 = _createComponentWithFallback(_component_Comp2) return n2 }" @@ -259,7 +259,7 @@ const t0 = _template("
A", true) export function render(_ctx) { const _component_Comp = _resolveComponent("Comp") const n1 = t0() - _setInsertionState(n1, 0, 0, true) + _setInsertionState(n1, 0, 0) const n0 = _createComponentWithFallback(_component_Comp) return n1 }" @@ -271,7 +271,7 @@ const t0 = _template("
A", true) export function render(_ctx) { const n1 = t0() - _setInsertionState(n1, null, 1, true) + _setInsertionState(n1, null, 1) const n0 = _createSlot("default", null) return n1 }" @@ -283,7 +283,7 @@ const t0 = _template("
A", true) export function render(_ctx) { const n1 = t0() - _setInsertionState(n1, 0, 0, true) + _setInsertionState(n1, 0, 0) const n0 = _createSlot("default", null) return n1 }" @@ -296,7 +296,7 @@ const t1 = _template("
A", true) export function render(_ctx) { const n3 = t1() - _setInsertionState(n3, null, 1, true) + _setInsertionState(n3, null, 1) const n0 = _createFor(() => (_ctx.list), (_for_item0) => { const n2 = t0() return n2 @@ -312,7 +312,7 @@ const t1 = _template("
A", true) export function render(_ctx) { const n3 = t1() - _setInsertionState(n3, 0, 0, true) + _setInsertionState(n3, 0, 0) const n0 = _createFor(() => (_ctx.list), (_for_item0) => { const n2 = t0() return n2 @@ -328,7 +328,7 @@ const t1 = _template("
A", true) export function render(_ctx) { const n3 = t1() - _setInsertionState(n3, null, 1, true) + _setInsertionState(n3, null, 1) const n0 = _createIf(() => (_ctx.show), () => { const n2 = t0() return n2 @@ -345,7 +345,7 @@ const t1 = _template("
A

B", true) export function render(_ctx) { const n4 = t1() const n3 = _next(_child(n4), 1) - _setInsertionState(n4, n3, 1, true) + _setInsertionState(n4, n3, 1) const n0 = _createIf(() => (_ctx.show), () => { const n2 = t0() return n2 @@ -361,7 +361,7 @@ const t1 = _template("

A", true) export function render(_ctx) { const n3 = t1() - _setInsertionState(n3, 0, 0, true) + _setInsertionState(n3, 0, 0) const n0 = _createIf(() => (_ctx.show), () => { const n2 = t0() return n2 @@ -390,7 +390,7 @@ export function render(_ctx) { const n5 = t1() return n5 }, 5, null, 0) - _setInsertionState(n7, null, 2, true) + _setInsertionState(n7, null, 2) const n6 = _createComponentWithFallback(_component_Comp2) return n7 }" @@ -407,7 +407,7 @@ export function render(_ctx) { const n6 = t2() _setInsertionState(n6, 0, 0) const n0 = _createComponentWithFallback(_component_Comp) - _setInsertionState(n6, 0, 1, true) + _setInsertionState(n6, 0, 1) const n1 = _createIf(() => (_ctx.show), () => { const n3 = t0() return n3 @@ -428,7 +428,7 @@ const t2 = _template("
A

B", true) export function render(_ctx) { const n6 = t2() const n5 = _next(_child(n6), 1) - _setInsertionState(n6, n5, 1, true) + _setInsertionState(n6, n5, 1) const n0 = _createIf(() => (_ctx.show), () => { const n2 = t0() return n2 @@ -450,7 +450,7 @@ const t3 = _template("

A

B", true) export function render(_ctx) { const n8 = t3() const n7 = _next(_child(n8), 1) - _setInsertionState(n8, n7, 1, true) + _setInsertionState(n8, n7, 1) const n0 = _createIf(() => (_ctx.a), () => { const n2 = t0() return n2 @@ -473,7 +473,7 @@ const t2 = _template("

A", true) export function render(_ctx) { const n5 = t2() - _setInsertionState(n5, null, 1, true) + _setInsertionState(n5, null, 1) const n0 = _createIf(() => (_ctx.show), () => { const n2 = t0() return n2 @@ -502,7 +502,7 @@ export function render(_ctx) { const n4 = t1() return n4 }, 5, null, 0) - _setInsertionState(n6, null, 2, true) + _setInsertionState(n6, null, 2) const n5 = _createComponentWithFallback(_component_Comp) return n6 }" @@ -516,7 +516,7 @@ const t2 = _template("
A", true) export function render(_ctx) { const n5 = t2() - _setInsertionState(n5, 0, 0, true) + _setInsertionState(n5, 0, 0) const n0 = _createIf(() => (_ctx.show), () => { const n2 = t0() return n2 diff --git a/packages/compiler-vapor/__tests__/transforms/__snapshots__/transformChildren.spec.ts.snap b/packages/compiler-vapor/__tests__/transforms/__snapshots__/transformChildren.spec.ts.snap index 2653467a6d5..ad31de3f867 100644 --- a/packages/compiler-vapor/__tests__/transforms/__snapshots__/transformChildren.spec.ts.snap +++ b/packages/compiler-vapor/__tests__/transforms/__snapshots__/transformChildren.spec.ts.snap @@ -8,7 +8,7 @@ const t1 = _template("
", true) export function render(_ctx) { const n4 = t1() const n3 = _next(_child(n4), 1) - _setInsertionState(n4, n3, 1, true) + _setInsertionState(n4, n3, 1) const n0 = _createIf(() => (1), () => { const n2 = t0() return n2 diff --git a/packages/compiler-vapor/__tests__/transforms/__snapshots__/transformKey.spec.ts.snap b/packages/compiler-vapor/__tests__/transforms/__snapshots__/transformKey.spec.ts.snap index d5f01e5c27e..1292ef742f4 100644 --- a/packages/compiler-vapor/__tests__/transforms/__snapshots__/transformKey.spec.ts.snap +++ b/packages/compiler-vapor/__tests__/transforms/__snapshots__/transformKey.spec.ts.snap @@ -92,7 +92,7 @@ const t0 = _template("
", true) export function render(_ctx) { const _component_Foo = _resolveComponent("Foo") const n2 = t0() - _setInsertionState(n2, null, 0, true) + _setInsertionState(n2, null, 0) const n0 = _createKeyedFragment(() => (_ctx.id), () => { const n1 = _createComponentWithFallback(_component_Foo) return n1 diff --git a/packages/compiler-vapor/__tests__/transforms/__snapshots__/vFor.spec.ts.snap b/packages/compiler-vapor/__tests__/transforms/__snapshots__/vFor.spec.ts.snap index e7304e39203..6146d74f762 100644 --- a/packages/compiler-vapor/__tests__/transforms/__snapshots__/vFor.spec.ts.snap +++ b/packages/compiler-vapor/__tests__/transforms/__snapshots__/vFor.spec.ts.snap @@ -87,7 +87,7 @@ const t1 = _template("
") export function render(_ctx) { const n0 = _createFor(() => (_ctx.list), (_for_item0) => { const n5 = t1() - _setInsertionState(n5, null, 0, true) + _setInsertionState(n5, null, 0) const n2 = _createFor(() => (_for_item0.value), (_for_item1) => { const n4 = t0() const x4 = _txt(n4) diff --git a/packages/compiler-vapor/__tests__/transforms/__snapshots__/vIf.spec.ts.snap b/packages/compiler-vapor/__tests__/transforms/__snapshots__/vIf.spec.ts.snap index 00f3b1d5edd..e9c721bff4b 100644 --- a/packages/compiler-vapor/__tests__/transforms/__snapshots__/vIf.spec.ts.snap +++ b/packages/compiler-vapor/__tests__/transforms/__snapshots__/vIf.spec.ts.snap @@ -281,7 +281,7 @@ export function render(_ctx) { const n2 = t0() return n2 }, null, 1) - _setInsertionState(n8, null, 1, true) + _setInsertionState(n8, null, 1) const n3 = _createIf(() => (_ctx.bar), () => { const n5 = t1() return n5 diff --git a/packages/compiler-vapor/__tests__/transforms/__snapshots__/vOnce.spec.ts.snap b/packages/compiler-vapor/__tests__/transforms/__snapshots__/vOnce.spec.ts.snap index e57903b60ac..a994ba5cb76 100644 --- a/packages/compiler-vapor/__tests__/transforms/__snapshots__/vOnce.spec.ts.snap +++ b/packages/compiler-vapor/__tests__/transforms/__snapshots__/vOnce.spec.ts.snap @@ -42,7 +42,7 @@ const t0 = _template("
", true) export function render(_ctx) { const _component_Comp = _resolveComponent("Comp") const n1 = t0() - _setInsertionState(n1, null, 0, true) + _setInsertionState(n1, null, 0) const n0 = _createComponentWithFallback(_component_Comp, { id: () => (_ctx.foo) }, null, null, true) return n1 }" @@ -66,7 +66,7 @@ const t0 = _template("
", true) export function render(_ctx) { const n1 = t0() - _setInsertionState(n1, null, 0, true) + _setInsertionState(n1, null, 0) const n0 = _createSlot("default", null, null, null, true) return n1 }" diff --git a/packages/compiler-vapor/__tests__/transforms/__snapshots__/vSlot.spec.ts.snap b/packages/compiler-vapor/__tests__/transforms/__snapshots__/vSlot.spec.ts.snap index 0b162b38817..6d3b33ce165 100644 --- a/packages/compiler-vapor/__tests__/transforms/__snapshots__/vSlot.spec.ts.snap +++ b/packages/compiler-vapor/__tests__/transforms/__snapshots__/vSlot.spec.ts.snap @@ -411,7 +411,7 @@ export function render(_ctx) { const n6 = t0() _setInsertionState(n6, null, 0) const n0 = _createSlot("foo", null) - _setInsertionState(n6, null, 1, true) + _setInsertionState(n6, null, 1) const n1 = _createIf(() => (true), () => { const n3 = _createComponentWithFallback(_component_Foo) return n3 @@ -635,7 +635,7 @@ export function render(_ctx) { "default": _withVaporCtx(() => { const n0 = _createFor(() => (_ctx.items), (_for_item0) => { const n3 = t0() - _setInsertionState(n3, null, 0, true) + _setInsertionState(n3, null, 0) const n2 = _createComponentWithFallback(_component_ChildComp) return n3 }) @@ -657,7 +657,7 @@ export function render(_ctx) { "default": _withVaporCtx(() => { const n0 = _createIf(() => (_ctx.show), () => { const n3 = t0() - _setInsertionState(n3, null, 0, true) + _setInsertionState(n3, null, 0) const n2 = _createComponentWithFallback(_component_ChildComp) return n3 }, null, 1) @@ -694,7 +694,7 @@ export function render(_ctx) { "default": _withVaporCtx(() => { const n0 = _createIf(() => (_ctx.show), () => { const n3 = t0() - _setInsertionState(n3, null, 0, true) + _setInsertionState(n3, null, 0) const n2 = _createPlainElement("my-element") return n3 }, null, 1) @@ -732,10 +732,10 @@ export function render(_ctx) { "default": _withVaporCtx(() => { const n0 = _createIf(() => (_ctx.a), () => { const n6 = t1() - _setInsertionState(n6, null, 0, true) + _setInsertionState(n6, null, 0) const n2 = _createIf(() => (_ctx.b), () => { const n5 = t0() - _setInsertionState(n5, null, 0, true) + _setInsertionState(n5, null, 0) const n4 = _createComponentWithFallback(_component_ChildComp) return n5 }, null, 1) diff --git a/packages/compiler-vapor/__tests__/transforms/logicalIndex.spec.ts b/packages/compiler-vapor/__tests__/transforms/logicalIndex.spec.ts index 5374707e608..9abc007563e 100644 --- a/packages/compiler-vapor/__tests__/transforms/logicalIndex.spec.ts +++ b/packages/compiler-vapor/__tests__/transforms/logicalIndex.spec.ts @@ -106,8 +106,8 @@ describe('compiler: logicalIndex', () => { A
`) - // setInsertionState(parent, anchor=0(prepend), logicalIndex=0, last=true) - expect(code).toContain('_setInsertionState(n1, 0, 0, true)') + // setInsertionState(parent, anchor=0(prepend), logicalIndex=0) + expect(code).toContain('_setInsertionState(n1, 0, 0)') expect(code).toMatchSnapshot() }) @@ -122,7 +122,7 @@ describe('compiler: logicalIndex', () => { // Comp1 expect(code).toContain('_setInsertionState(n2, 0, 0)') // Comp2 - expect(code).toContain('_setInsertionState(n2, 0, 1, true)') + expect(code).toContain('_setInsertionState(n2, 0, 1)') expect(code).toMatchSnapshot() }) }) @@ -136,8 +136,8 @@ describe('compiler: logicalIndex', () => {

B

`) - // setInsertionState(parent, anchor=n${id}, logicalIndex=1, last=true) - expect(code).toContain('_setInsertionState(n2, n1, 1, true)') + // setInsertionState(parent, anchor=n${id}, logicalIndex=1) + expect(code).toContain('_setInsertionState(n2, n1, 1)') expect(code).toMatchSnapshot() }) @@ -153,7 +153,7 @@ describe('compiler: logicalIndex', () => { // Comp1 expect(code).toContain('_setInsertionState(n3, n2, 1)') // Comp2 - expect(code).toContain('_setInsertionState(n3, n2, 2, true)') + expect(code).toContain('_setInsertionState(n3, n2, 2)') expect(code).toMatchSnapshot() }) }) @@ -166,8 +166,8 @@ describe('compiler: logicalIndex', () => {
`) - // setInsertionState(parent, null(append), logicalIndex=1, last=true) - expect(code).toContain('_setInsertionState(n1, null, 1, true)') + // setInsertionState(parent, null(append), logicalIndex=1) + expect(code).toContain('_setInsertionState(n1, null, 1)') expect(code).toMatchSnapshot() }) @@ -182,7 +182,7 @@ describe('compiler: logicalIndex', () => { // Comp1 expect(code).toContain('_setInsertionState(n2, null, 1)') // Comp2 - expect(code).toContain('_setInsertionState(n2, null, 2, true)') + expect(code).toContain('_setInsertionState(n2, null, 2)') expect(code).toMatchSnapshot() }) @@ -192,7 +192,7 @@ describe('compiler: logicalIndex', () => {
`) - expect(code).toContain('_setInsertionState(n1, null, 0, true)') + expect(code).toContain('_setInsertionState(n1, null, 0)') expect(code).toMatchSnapshot() }) }) @@ -209,7 +209,7 @@ describe('compiler: logicalIndex', () => { // Comp1: prepend, logicalIndex=0 expect(code).toContain('_setInsertionState(n2, 0, 0)') // Comp2: append, logicalIndex=2 - expect(code).toContain('_setInsertionState(n2, null, 2, true)') + expect(code).toContain('_setInsertionState(n2, null, 2)') expect(code).toMatchSnapshot() }) @@ -228,7 +228,7 @@ describe('compiler: logicalIndex', () => { // Comp2: insert, logicalIndex=2 expect(code).toContain('_setInsertionState(n3, n4, 2)') // Comp3: append, logicalIndex=4 - expect(code).toContain('_setInsertionState(n3, null, 4, true)') + expect(code).toContain('_setInsertionState(n3, null, 4)') expect(code).toMatchSnapshot() }) }) @@ -241,7 +241,7 @@ describe('compiler: logicalIndex', () => { A
`) - expect(code).toContain('_setInsertionState(n3, 0, 0, true)') + expect(code).toContain('_setInsertionState(n3, 0, 0)') expect(code).toMatchSnapshot() }) @@ -253,7 +253,7 @@ describe('compiler: logicalIndex', () => {

B

`) - expect(code).toContain('_setInsertionState(n4, n3, 1, true)') + expect(code).toContain('_setInsertionState(n4, n3, 1)') expect(code).toMatchSnapshot() }) @@ -264,7 +264,7 @@ describe('compiler: logicalIndex', () => {
`) - expect(code).toContain('_setInsertionState(n3, null, 1, true)') + expect(code).toContain('_setInsertionState(n3, null, 1)') expect(code).toMatchSnapshot() }) }) @@ -277,7 +277,7 @@ describe('compiler: logicalIndex', () => { A
`) - expect(code).toContain('_setInsertionState(n3, 0, 0, true)') + expect(code).toContain('_setInsertionState(n3, 0, 0)') expect(code).toMatchSnapshot() }) @@ -288,7 +288,7 @@ describe('compiler: logicalIndex', () => {
`) - expect(code).toContain('_setInsertionState(n3, null, 1, true)') + expect(code).toContain('_setInsertionState(n3, null, 1)') expect(code).toMatchSnapshot() }) }) @@ -301,7 +301,7 @@ describe('compiler: logicalIndex', () => { A
`) - expect(code).toContain('_setInsertionState(n1, 0, 0, true)') + expect(code).toContain('_setInsertionState(n1, 0, 0)') expect(code).toMatchSnapshot() }) @@ -312,7 +312,7 @@ describe('compiler: logicalIndex', () => {
`) - expect(code).toContain('_setInsertionState(n1, null, 1, true)') + expect(code).toContain('_setInsertionState(n1, null, 1)') expect(code).toMatchSnapshot() }) }) @@ -329,7 +329,7 @@ describe('compiler: logicalIndex', () => {
`) // The entire if/else block is logicalIndex = 1 - expect(code).toContain('_setInsertionState(n6, n5, 1, true)') + expect(code).toContain('_setInsertionState(n6, n5, 1)') expect(code).toMatchSnapshot() }) @@ -344,7 +344,7 @@ describe('compiler: logicalIndex', () => {
`) // The entire if/else-if/else block is logicalIndex = 1 - expect(code).toContain('_setInsertionState(n8, n7, 1, true)') + expect(code).toContain('_setInsertionState(n8, n7, 1)') expect(code).toMatchSnapshot() }) @@ -357,7 +357,7 @@ describe('compiler: logicalIndex', () => {
`) // logicalIndex = 0 for prepend - expect(code).toContain('_setInsertionState(n5, 0, 0, true)') + expect(code).toContain('_setInsertionState(n5, 0, 0)') expect(code).toMatchSnapshot() }) @@ -370,7 +370,7 @@ describe('compiler: logicalIndex', () => {
`) // logicalIndex = 1 for append - expect(code).toContain('_setInsertionState(n5, null, 1, true)') + expect(code).toContain('_setInsertionState(n5, null, 1)') expect(code).toMatchSnapshot() }) @@ -386,7 +386,7 @@ describe('compiler: logicalIndex', () => { // v-if/v-else: logicalIndex = 1 // Comp: logicalIndex = 2 expect(code).toContain('_setInsertionState(n6, null, 1)') - expect(code).toContain('_setInsertionState(n6, null, 2, true)') + expect(code).toContain('_setInsertionState(n6, null, 2)') expect(code).toMatchSnapshot() }) @@ -403,7 +403,7 @@ describe('compiler: logicalIndex', () => { // v-if/v-else: logicalIndex = 1 // span: logicalIndex = 2 expect(code).toContain('_setInsertionState(n6, 0, 0)') - expect(code).toContain('_setInsertionState(n6, 0, 1, true)') + expect(code).toContain('_setInsertionState(n6, 0, 1)') expect(code).toMatchSnapshot() }) @@ -421,7 +421,7 @@ describe('compiler: logicalIndex', () => { // Comp2: logicalIndex = 2 expect(code).toContain('_setInsertionState(n7, null, 0)') expect(code).toContain('_setInsertionState(n7, null, 1)') - expect(code).toContain('_setInsertionState(n7, null, 2, true)') + expect(code).toContain('_setInsertionState(n7, null, 2)') expect(code).toMatchSnapshot() }) }) @@ -434,7 +434,7 @@ describe('compiler: logicalIndex', () => { A
`) - expect(code).toContain('_setInsertionState(n2, 0, 0, true)') + expect(code).toContain('_setInsertionState(n2, 0, 0)') expect(code).toMatchSnapshot() }) @@ -446,7 +446,7 @@ describe('compiler: logicalIndex', () => {
`) expect(code).toMatchSnapshot() - expect(code).toContain('_setInsertionState(n2, null, 1, true)') + expect(code).toContain('_setInsertionState(n2, null, 1)') }) test('key in middle', () => { @@ -457,7 +457,7 @@ describe('compiler: logicalIndex', () => { B
`) - expect(code).toContain('_setInsertionState(n3, n2, 1, true)') + expect(code).toContain('_setInsertionState(n3, n2, 1)') expect(code).toMatchSnapshot() }) }) diff --git a/packages/compiler-vapor/__tests__/transforms/transformChildren.spec.ts b/packages/compiler-vapor/__tests__/transforms/transformChildren.spec.ts index 36df074dd99..7a72975a985 100644 --- a/packages/compiler-vapor/__tests__/transforms/transformChildren.spec.ts +++ b/packages/compiler-vapor/__tests__/transforms/transformChildren.spec.ts @@ -70,7 +70,7 @@ describe('compiler: children transform', () => { ) // ensure the insertion anchor is generated before the insertion statement expect(code).toMatch(`const n3 = _next(_child(n4), 1)`) - expect(code).toMatch(`_setInsertionState(n4, n3, 1, true)`) + expect(code).toMatch(`_setInsertionState(n4, n3, 1)`) expect(code).toMatchSnapshot() }) }) diff --git a/packages/compiler-vapor/src/generators/operation.ts b/packages/compiler-vapor/src/generators/operation.ts index 036816360bd..884865153c9 100644 --- a/packages/compiler-vapor/src/generators/operation.ts +++ b/packages/compiler-vapor/src/generators/operation.ts @@ -171,7 +171,7 @@ function genInsertionState( operation: InsertionStateTypes, context: CodegenContext, ): CodeFragment[] { - const { parent, anchor, logicalIndex, append, last } = operation + const { parent, anchor, logicalIndex, append } = operation return [ NEWLINE, ...genCall( @@ -186,7 +186,6 @@ function genInsertionState( 'null' : `n${anchor}`, logicalIndex !== undefined ? String(logicalIndex) : undefined, - last && 'true', ), ] } diff --git a/packages/compiler-vapor/src/ir/index.ts b/packages/compiler-vapor/src/ir/index.ts index 31ef721a92c..8ca98360fd6 100644 --- a/packages/compiler-vapor/src/ir/index.ts +++ b/packages/compiler-vapor/src/ir/index.ts @@ -100,7 +100,6 @@ export interface IfIRNode extends BaseIRNode, EffectBoundary { anchor?: number logicalIndex?: number append?: boolean - last?: boolean } export interface IRFor { @@ -122,7 +121,6 @@ export interface ForIRNode extends BaseIRNode, IRFor, EffectBoundary { anchor?: number logicalIndex?: number append?: boolean - last?: boolean } export interface KeyIRNode extends BaseIRNode, EffectBoundary { @@ -134,7 +132,6 @@ export interface KeyIRNode extends BaseIRNode, EffectBoundary { anchor?: number logicalIndex?: number append?: boolean - last?: boolean } export interface SetBlockKeyIRNode extends BaseIRNode { @@ -244,7 +241,6 @@ export interface CreateComponentIRNode extends BaseIRNode, EffectBoundary { anchor?: number logicalIndex?: number append?: boolean - last?: boolean } export interface SlotOutletIRNode extends BaseIRNode, EffectBoundary { @@ -259,7 +255,6 @@ export interface SlotOutletIRNode extends BaseIRNode, EffectBoundary { anchor?: number logicalIndex?: number append?: boolean - last?: boolean } export interface GetTextChildIRNode extends BaseIRNode { diff --git a/packages/compiler-vapor/src/transforms/transformChildren.ts b/packages/compiler-vapor/src/transforms/transformChildren.ts index ff48a6ee6e5..58612494017 100644 --- a/packages/compiler-vapor/src/transforms/transformChildren.ts +++ b/packages/compiler-vapor/src/transforms/transformChildren.ts @@ -8,7 +8,6 @@ import { DynamicFlag, type IRDynamicInfo, IRNodeTypes, - type InsertionStateTypes, isBlockOperation, } from '../ir' import { shouldUseCreateElement } from './transformElement' @@ -81,8 +80,6 @@ export const transformChildren: NodeTransform = (node, context) => { function processDynamicChildren(context: TransformContext) { let prevDynamics: IRDynamicInfo[] = [] let staticCount = 0 - let dynamicCount = 0 - let lastInsertionChild: IRDynamicInfo | undefined const children = context.dynamic.children // Track logical index for each child. @@ -94,7 +91,7 @@ function processDynamicChildren(context: TransformContext) { for (const [index, child] of children.entries()) { if (child.flags & DynamicFlag.INSERT) { child.logicalIndex = logicalIndex - prevDynamics.push((lastInsertionChild = child)) + prevDynamics.push(child) logicalIndex++ } @@ -109,7 +106,6 @@ function processDynamicChildren(context: TransformContext) { } else { registerInsertion(prevDynamics, context, -1 /* prepend */) } - dynamicCount += prevDynamics.length prevDynamics = [] } staticCount++ @@ -122,14 +118,10 @@ function processDynamicChildren(context: TransformContext) { prevDynamics, context, // the logical index of append child - dynamicCount + staticCount, + prevDynamics[0].logicalIndex!, true, ) } - - if (lastInsertionChild && lastInsertionChild.operation) { - ;(lastInsertionChild.operation! as InsertionStateTypes).last = true - } } function registerInsertion( diff --git a/packages/compiler-vapor/src/utils.ts b/packages/compiler-vapor/src/utils.ts index 172bb281ed4..e0221ebdb4b 100644 --- a/packages/compiler-vapor/src/utils.ts +++ b/packages/compiler-vapor/src/utils.ts @@ -153,6 +153,9 @@ export function isTeleportTag(tag: string): boolean { export function isBuiltInComponent(tag: string): string | undefined { if (isTeleportTag(tag)) { return 'VaporTeleport' + } else if (tag === 'Suspense' || tag === 'suspense') { + // TODO: replace with VaporSuspense once it's implemented + return 'Suspense' } else if (isKeepAliveTag(tag)) { return 'VaporKeepAlive' } else if (isTransitionTag(tag)) { diff --git a/packages/runtime-vapor/__tests__/componentSlots.spec.ts b/packages/runtime-vapor/__tests__/componentSlots.spec.ts index 2bc4b6ffd36..6f1c1c217a1 100644 --- a/packages/runtime-vapor/__tests__/componentSlots.spec.ts +++ b/packages/runtime-vapor/__tests__/componentSlots.spec.ts @@ -1676,7 +1676,7 @@ describe('component: slots', () => { () => props.show, () => { const n5 = template('
')() as any - setInsertionState(n5, null, 0, true) + setInsertionState(n5, null, 0) createSlot('header', null, () => { const n4 = template('default header')() return n4 diff --git a/packages/runtime-vapor/__tests__/components/Teleport.spec.ts b/packages/runtime-vapor/__tests__/components/Teleport.spec.ts index bdc784b9f03..e1547b51531 100644 --- a/packages/runtime-vapor/__tests__/components/Teleport.spec.ts +++ b/packages/runtime-vapor/__tests__/components/Teleport.spec.ts @@ -1388,7 +1388,7 @@ function runSharedTests(deferMode: boolean): void { () => show.value, () => { const n0 = template('
')() - setInsertionState(n0 as any, null, 0, true) + setInsertionState(n0 as any, null, 0) createComponent( VaporTeleport, { @@ -1585,7 +1585,7 @@ function runSharedTests(deferMode: boolean): void { setup() { const n0 = template('
')() const n4 = template('
')() as any - setInsertionState(n4, null, 0, true) + setInsertionState(n4, null, 0) createComponent( VaporTeleport, { to: () => '#tt' }, diff --git a/packages/runtime-vapor/__tests__/customElement.spec.ts b/packages/runtime-vapor/__tests__/customElement.spec.ts index cce030013fd..a407c4369fe 100644 --- a/packages/runtime-vapor/__tests__/customElement.spec.ts +++ b/packages/runtime-vapor/__tests__/customElement.spec.ts @@ -125,7 +125,7 @@ describe('defineVaporCustomElement', () => { const containerComp = defineVaporComponent({ setup() { const n1 = template('
', true)() as any - setInsertionState(n1, 0, 0, true) + setInsertionState(n1, 0, 0) createPlainElement('my-el-input', { value: () => num.value, onInput: () => ($event: CustomEvent) => { @@ -781,13 +781,13 @@ describe('defineVaporCustomElement', () => { const t0 = template('
fallback
') const t1 = template('
') const n3 = t1() as any - setInsertionState(n3, null, 0, true) + setInsertionState(n3, null, 0) createSlot('default', null, () => { const n2 = t0() return n2 }) const n5 = t1() as any - setInsertionState(n5, null, 0, true) + setInsertionState(n5, null, 0) createSlot('named', null) return [n3, n5] }, diff --git a/packages/runtime-vapor/__tests__/hydration.spec.ts b/packages/runtime-vapor/__tests__/hydration.spec.ts index 8a026ac4fe7..f820c9c5a81 100644 --- a/packages/runtime-vapor/__tests__/hydration.spec.ts +++ b/packages/runtime-vapor/__tests__/hydration.spec.ts @@ -5060,6 +5060,38 @@ describe('Vapor Mode hydration', () => { ) }) + test('enabled teleport hydration with empty v-if should preserve target anchors', async () => { + const data = ref({ ok: false, msg: 'foo' }) + + const teleportContainer = document.createElement('div') + teleportContainer.id = 'teleport-empty-if' + teleportContainer.innerHTML = + `` + `` + document.body.appendChild(teleportContainer) + + const { container } = await mountWithHydration( + '', + ` + {{data.msg}} + `, + data, + ) + await nextTick() + + expect(container.innerHTML).toBe( + ``, + ) + expect(teleportContainer.innerHTML).toBe( + ``, + ) + + data.value.ok = true + await nextTick() + expect(teleportContainer.innerHTML).toBe( + `foo`, + ) + }) + test('disabled teleport hydration over empty main-view range should preserve teleport end anchor', async () => { const data = ref({ msg: 'foo' }) @@ -5882,7 +5914,6 @@ describe('Vapor Mode hydration', () => { ` const appCode = `