Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ exports[`compiler: element transform > component > static props 1`] = `
export function render(_ctx) {
const _component_Foo = _resolveComponent("Foo")
const n0 = _createComponentWithFallback(_component_Foo, {
id: () => ("foo"),
id: () => ("foo"),
class: () => ("bar")
}, null, true)
return n0
Expand All @@ -150,7 +150,7 @@ exports[`compiler: element transform > component > v-bind="obj" after static pro
export function render(_ctx) {
const _component_Foo = _resolveComponent("Foo")
const n0 = _createComponentWithFallback(_component_Foo, {
id: () => ("foo"),
id: () => ("foo"),
$: [
() => (_ctx.obj)
]
Expand All @@ -165,7 +165,7 @@ exports[`compiler: element transform > component > v-bind="obj" before static pr
export function render(_ctx) {
const _component_Foo = _resolveComponent("Foo")
const n0 = _createComponentWithFallback(_component_Foo, { $: [
() => (_ctx.obj),
() => (_ctx.obj),
{ id: () => ("foo") }
] }, null, true)
return n0
Expand All @@ -178,9 +178,9 @@ exports[`compiler: element transform > component > v-bind="obj" between static p
export function render(_ctx) {
const _component_Foo = _resolveComponent("Foo")
const n0 = _createComponentWithFallback(_component_Foo, {
id: () => ("foo"),
id: () => ("foo"),
$: [
() => (_ctx.obj),
() => (_ctx.obj),
{ class: () => ("bar") }
]
}, null, true)
Expand Down Expand Up @@ -262,7 +262,7 @@ exports[`compiler: element transform > component with dynamic event arguments 1`
export function render(_ctx) {
const _component_Foo = _resolveComponent("Foo")
const n0 = _createComponentWithFallback(_component_Foo, { $: [
() => ({ [_toHandlerKey(_ctx.foo-_ctx.bar)]: () => _ctx.bar }),
() => ({ [_toHandlerKey(_ctx.foo-_ctx.bar)]: () => _ctx.bar }),
() => ({ [_toHandlerKey(_ctx.baz)]: () => _ctx.qux })
] }, null, true)
return n0
Expand All @@ -275,7 +275,7 @@ exports[`compiler: element transform > component with dynamic prop arguments 1`]
export function render(_ctx) {
const _component_Foo = _resolveComponent("Foo")
const n0 = _createComponentWithFallback(_component_Foo, { $: [
() => ({ [_ctx.foo-_ctx.bar]: _ctx.bar }),
() => ({ [_ctx.foo-_ctx.bar]: _ctx.bar }),
() => ({ [_ctx.baz]: _ctx.qux })
] }, null, true)
return n0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@ exports[`compiler: transform <slot> outlets > default slot outlet with props 1`]

export function render(_ctx) {
const n0 = _createSlot("default", {
foo: () => ("bar"),
baz: () => (_ctx.qux),
foo: () => ("bar"),
baz: () => (_ctx.qux),
fooBar: () => (_ctx.foo-_ctx.bar)
})
return n0
Expand Down Expand Up @@ -125,7 +125,7 @@ exports[`compiler: transform <slot> outlets > statically named slot outlet with

export function render(_ctx) {
const n0 = _createSlot("foo", {
foo: () => ("bar"),
foo: () => ("bar"),
baz: () => (_ctx.qux)
})
return n0
Expand All @@ -137,9 +137,9 @@ exports[`compiler: transform <slot> outlets > statically named slot outlet with

export function render(_ctx) {
const n0 = _createSlot("foo", {
foo: () => ("bar"),
foo: () => ("bar"),
$: [
() => (_ctx.obj),
() => (_ctx.obj),
{ baz: () => (_ctx.qux) }
]
})
Expand All @@ -152,9 +152,9 @@ exports[`compiler: transform <slot> outlets > statically named slot outlet with

export function render(_ctx) {
const n0 = _createSlot("default", {
onClick: () => _ctx.foo,
onClick: () => _ctx.foo,
$: [
() => (_toHandlers(_ctx.bar)),
() => (_toHandlers(_ctx.bar)),
{ baz: () => (_ctx.qux) }
]
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ export function render(_ctx) {
const n0 = _createComponentWithFallback(_component_Comp, {
foo: () => (_ctx.foo),
"onUpdate:foo": () => _value => (_ctx.foo = _value),
fooModifiers: () => ({ trim: true }),
fooModifiers: () => ({ trim: true }),
bar: () => (_ctx.bar),
"onUpdate:bar": () => _value => (_ctx.bar = _value),
barModifiers: () => ({ number: true })
Expand Down Expand Up @@ -59,7 +59,7 @@ export function render(_ctx) {
const n0 = _createComponentWithFallback(_component_Comp, { $: [
() => ({ [_ctx.foo]: _ctx.foo,
["onUpdate:" + _ctx.foo]: () => _value => (_ctx.foo = _value),
[_ctx.foo + "Modifiers"]: () => ({ trim: true }) }),
[_ctx.foo + "Modifiers"]: () => ({ trim: true }) }),
() => ({ [_ctx.bar]: _ctx.bar,
["onUpdate:" + _ctx.bar]: () => _value => (_ctx.bar = _value),
[_ctx.bar + "Modifiers"]: () => ({ number: true }) })
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export function render(_ctx) {
const _on_update_model = () => {}
const _on_update_model1 = () => {}
const n0 = _createComponentWithFallback(_component_Foo, {
"onUpdate:model": () => _on_update_model,
"onUpdate:model": () => _on_update_model,
"onUpdate-model": () => _on_update_model1
}, null, true)
return n0
Expand Down Expand Up @@ -333,7 +333,7 @@ const t0 = _template("<div></div>", true)
export function render(_ctx) {
const n0 = t0()
_on(n0, "click", _withModifiers(e => _ctx.test(e), ["stop","prevent"]), {
capture: true,
capture: true,
once: true
})
return n0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ export function render(_ctx) {
const n2 = _createComponentWithFallback(_component_Comp, null, {
$: [
() => ({
name: _ctx.name,
name: _ctx.name,
fn: () => {
const n0 = t0()
return n0
Expand All @@ -30,7 +30,7 @@ export function render(_ctx) {
const n2 = _createComponentWithFallback(_component_Comp, null, {
$: [
() => (_createForSlots(_ctx.list, (item) => ({
name: item,
name: item,
fn: (_slotProps0) => {
const n0 = t0()
_renderEffect(() => _setText(n0, _toDisplayString(_slotProps0["bar"])))
Expand All @@ -52,7 +52,7 @@ export function render(_ctx) {
const n2 = _createComponentWithFallback(_component_Comp, null, {
$: [
() => (_createForSlots(_ctx.list, (_, __, index) => ({
name: index,
name: index,
fn: () => {
const n0 = t0()
return n0
Expand All @@ -76,22 +76,22 @@ export function render(_ctx) {
$: [
() => (_ctx.condition
? {
name: "condition",
name: "condition",
fn: () => {
const n0 = t0()
return n0
}
}
: _ctx.anotherCondition
? {
name: "condition",
name: "condition",
fn: (_slotProps0) => {
const n2 = t1()
return n2
}
}
: {
name: "condition",
name: "condition",
fn: () => {
const n4 = t2()
return n4
Expand Down Expand Up @@ -131,7 +131,7 @@ export function render(_ctx) {
"one": () => {
const n0 = t0()
return n0
},
},
"default": () => {
const n2 = t1()
const n3 = t2()
Expand Down Expand Up @@ -192,7 +192,7 @@ export function render(_ctx) {
const n1 = _createComponentWithFallback(_component_Comp, null, {
$: [
() => ({
name: _ctx.named,
name: _ctx.named,
fn: (_slotProps0) => {
const n0 = t0()
_renderEffect(() => _setText(n0, _toDisplayString(_slotProps0["foo"] + _ctx.bar)))
Expand Down Expand Up @@ -287,7 +287,7 @@ export function render(_ctx) {
"header": () => {
const n0 = t0()
return n0
},
},
"default": () => {
const n2 = t1()
const n3 = t2()
Expand All @@ -309,7 +309,7 @@ export function render(_ctx) {
"header": () => {
const n0 = t0()
return n0
},
},
"default": () => {
const n3 = t1()
return n3
Expand All @@ -330,7 +330,7 @@ export function render(_ctx) {
"header": () => {
const n0 = t0()
return n0
},
},
"footer": () => {
const n3 = t1()
return n3
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ describe('compiler: element transform', () => {

expect(code).toMatchSnapshot()
expect(code).contains(`{
id: () => ("foo"),
id: () => ("foo"),
class: () => ("bar")
}`)

Expand Down Expand Up @@ -262,7 +262,7 @@ describe('compiler: element transform', () => {
)
expect(code).toMatchSnapshot()
expect(code).contains(`{
id: () => ("foo"),
id: () => ("foo"),
$: [
() => (_ctx.obj)
]
Expand All @@ -286,7 +286,7 @@ describe('compiler: element transform', () => {
)
expect(code).toMatchSnapshot()
expect(code).contains(`[
() => (_ctx.obj),
() => (_ctx.obj),
{ id: () => ("foo") }
]`)
expect(ir.block.dynamic.children[0].operation).toMatchObject({
Expand All @@ -308,9 +308,9 @@ describe('compiler: element transform', () => {
)
expect(code).toMatchSnapshot()
expect(code).contains(`{
id: () => ("foo"),
id: () => ("foo"),
$: [
() => (_ctx.obj),
() => (_ctx.obj),
{ class: () => ("bar") }
]
}`)
Expand Down
2 changes: 1 addition & 1 deletion packages/compiler-vapor/__tests__/transforms/vOn.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -415,7 +415,7 @@ describe('v-on', () => {
])
expect(code).contains(
`_on(n0, "click", _withModifiers(e => _ctx.test(e), ["stop","prevent"]), {
capture: true,
capture: true,
once: true
})`,
)
Expand Down
4 changes: 2 additions & 2 deletions packages/compiler-vapor/src/generators/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,13 +79,13 @@ export const DELIMITERS_ARRAY: CodeFragmentDelimiters = ['[', ']', ', ']
export const DELIMITERS_ARRAY_NEWLINE: CodeFragmentDelimiters = [
['[', INDENT_START, NEWLINE],
[INDENT_END, NEWLINE, ']'],
[', ', NEWLINE],
[',', NEWLINE],
]
export const DELIMITERS_OBJECT: CodeFragmentDelimiters = ['{ ', ' }', ', ']
export const DELIMITERS_OBJECT_NEWLINE: CodeFragmentDelimiters = [
['{', INDENT_START, NEWLINE],
[INDENT_END, NEWLINE, '}'],
[', ', NEWLINE],
[',', NEWLINE],
]

export function genCall(
Expand Down
Loading