mirror of https://github.com/vuejs/core.git
Merge remote-tracking branch 'upstream/main'
This commit is contained in:
commit
65909f6e60
|
@ -50,5 +50,9 @@
|
|||
// pinned
|
||||
// https://github.com/vuejs/core/issues/10300#issuecomment-1940855364
|
||||
'lru-cache',
|
||||
|
||||
// pinned
|
||||
// https://github.com/vuejs/core/commit/a012e39b373f1b6918e5c89856e8f902e1bfa14d
|
||||
'@rollup/plugin-replace',
|
||||
],
|
||||
}
|
||||
|
|
14
CHANGELOG.md
14
CHANGELOG.md
|
@ -1,3 +1,17 @@
|
|||
## [3.4.20](https://github.com/vuejs/core/compare/v3.4.19...v3.4.20) (2024-02-26)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **parser:** should not treat uppercase components as special tags ([e0e0253](https://github.com/vuejs/core/commit/e0e02535cdea1aeb1cfaff0d61d4b2555e555c36)), closes [#10395](https://github.com/vuejs/core/issues/10395)
|
||||
* **runtime-dom:** avoid always resetting nullish option value ([ff130c4](https://github.com/vuejs/core/commit/ff130c470204086edaa093fb8fdc1247c69cba69)), closes [#10396](https://github.com/vuejs/core/issues/10396)
|
||||
* **runtime-dom:** fix nested v-show priority regression ([364f890](https://github.com/vuejs/core/commit/364f8902c8657faec7c3a4d70a5b2c856567e92d)), closes [#10338](https://github.com/vuejs/core/issues/10338)
|
||||
* **runtime-dom:** v-bind style should clear previous css string value ([#10373](https://github.com/vuejs/core/issues/10373)) ([e2d3235](https://github.com/vuejs/core/commit/e2d323538e71d404e729148fd19a08bbc2e3da9b)), closes [#10352](https://github.com/vuejs/core/issues/10352)
|
||||
* **suspense:** handle suspense switching with nested suspense ([#10184](https://github.com/vuejs/core/issues/10184)) ([0f3da05](https://github.com/vuejs/core/commit/0f3da05ea201761529bb95594df1e2cee20b7107)), closes [#10098](https://github.com/vuejs/core/issues/10098)
|
||||
* **types:** better typing for direct setup signature of defineComponent ([#10357](https://github.com/vuejs/core/issues/10357)) ([eadce5b](https://github.com/vuejs/core/commit/eadce5b75356656fd2209ebdb406d34823c961b7)), closes [#8604](https://github.com/vuejs/core/issues/8604) [#8855](https://github.com/vuejs/core/issues/8855)
|
||||
|
||||
|
||||
|
||||
## [3.4.19](https://github.com/vuejs/core/compare/v3.4.18...v3.4.19) (2024-02-13)
|
||||
|
||||
|
||||
|
|
44
package.json
44
package.json
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"private": true,
|
||||
"version": "3.0.0-vapor",
|
||||
"packageManager": "pnpm@8.15.1",
|
||||
"packageManager": "pnpm@8.15.4",
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"dev": "node scripts/dev.js vue vue-vapor",
|
||||
|
@ -70,50 +70,50 @@
|
|||
"@rollup/plugin-terser": "^0.4.4",
|
||||
"@types/hash-sum": "^1.0.2",
|
||||
"@types/minimist": "^1.2.5",
|
||||
"@types/node": "^20.11.16",
|
||||
"@types/semver": "^7.5.6",
|
||||
"@typescript-eslint/eslint-plugin": "^6.18.1",
|
||||
"@typescript-eslint/parser": "^6.18.1",
|
||||
"@vitest/coverage-istanbul": "^1.2.2",
|
||||
"@types/node": "^20.11.20",
|
||||
"@types/semver": "^7.5.8",
|
||||
"@typescript-eslint/eslint-plugin": "^7.0.2",
|
||||
"@typescript-eslint/parser": "^7.0.2",
|
||||
"@vitest/coverage-istanbul": "^1.3.1",
|
||||
"@vitest/ui": "^1.2.2",
|
||||
"@vue/consolidate": "1.0.0",
|
||||
"conventional-changelog-cli": "^4.1.0",
|
||||
"enquirer": "^2.4.1",
|
||||
"esbuild": "^0.20.0",
|
||||
"esbuild": "^0.20.1",
|
||||
"esbuild-plugin-polyfill-node": "^0.3.0",
|
||||
"eslint": "^8.56.0",
|
||||
"eslint-define-config": "^1.24.1",
|
||||
"eslint": "^8.57.0",
|
||||
"eslint-define-config": "^2.1.0",
|
||||
"eslint-plugin-import": "npm:eslint-plugin-i@^2.29.1",
|
||||
"eslint-plugin-jest": "^27.6.3",
|
||||
"eslint-plugin-jest": "^27.9.0",
|
||||
"estree-walker": "^2.0.2",
|
||||
"execa": "^8.0.1",
|
||||
"jsdom": "^23.2.0",
|
||||
"lint-staged": "^15.2.0",
|
||||
"jsdom": "^24.0.0",
|
||||
"lint-staged": "^15.2.2",
|
||||
"lodash": "^4.17.21",
|
||||
"magic-string": "^0.30.6",
|
||||
"magic-string": "^0.30.7",
|
||||
"markdown-table": "^3.0.3",
|
||||
"marked": "^11.2.0",
|
||||
"marked": "^12.0.0",
|
||||
"minimist": "^1.2.8",
|
||||
"npm-run-all2": "^6.1.2",
|
||||
"picocolors": "^1.0.0",
|
||||
"prettier": "^3.2.2",
|
||||
"prettier": "^3.2.5",
|
||||
"pretty-bytes": "^6.1.1",
|
||||
"pug": "^3.0.2",
|
||||
"puppeteer": "~21.11.0",
|
||||
"puppeteer": "~22.2.0",
|
||||
"rimraf": "^5.0.5",
|
||||
"rollup": "4.9.2",
|
||||
"rollup": "^4.12.0",
|
||||
"rollup-plugin-dts": "^6.1.0",
|
||||
"rollup-plugin-esbuild": "^6.1.1",
|
||||
"rollup-plugin-polyfill-node": "^0.13.0",
|
||||
"semver": "^7.5.4",
|
||||
"semver": "^7.6.0",
|
||||
"serve": "^14.2.1",
|
||||
"simple-git-hooks": "^2.9.0",
|
||||
"terser": "^5.27.0",
|
||||
"terser": "^5.28.1",
|
||||
"todomvc-app-css": "^2.4.3",
|
||||
"tslib": "^2.6.2",
|
||||
"tsx": "^4.7.0",
|
||||
"tsx": "^4.7.1",
|
||||
"typescript": "^5.2.2",
|
||||
"vite": "^5.0.12",
|
||||
"vitest": "^1.2.2"
|
||||
"vite": "^5.1.4",
|
||||
"vitest": "^1.3.1"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "@vue/compiler-core",
|
||||
"version": "3.4.19",
|
||||
"version": "3.4.20",
|
||||
"description": "@vue/compiler-core",
|
||||
"main": "index.js",
|
||||
"module": "dist/compiler-core.esm-bundler.js",
|
||||
|
|
|
@ -553,12 +553,11 @@ export default class Tokenizer {
|
|||
// HTML mode
|
||||
// - <script>, <style> RAWTEXT
|
||||
// - <title>, <textarea> RCDATA
|
||||
const lower = c | 0x20
|
||||
if (lower === 116 /* t */) {
|
||||
if (c === 116 /* t */) {
|
||||
this.state = State.BeforeSpecialT
|
||||
} else {
|
||||
this.state =
|
||||
lower === 115 /* s */ ? State.BeforeSpecialS : State.InTagName
|
||||
c === 115 /* s */ ? State.BeforeSpecialS : State.InTagName
|
||||
}
|
||||
} else {
|
||||
this.state = State.InTagName
|
||||
|
@ -862,10 +861,9 @@ export default class Tokenizer {
|
|||
}
|
||||
}
|
||||
private stateBeforeSpecialS(c: number): void {
|
||||
const lower = c | 0x20
|
||||
if (lower === Sequences.ScriptEnd[3]) {
|
||||
if (c === Sequences.ScriptEnd[3]) {
|
||||
this.startSpecial(Sequences.ScriptEnd, 4)
|
||||
} else if (lower === Sequences.StyleEnd[3]) {
|
||||
} else if (c === Sequences.StyleEnd[3]) {
|
||||
this.startSpecial(Sequences.StyleEnd, 4)
|
||||
} else {
|
||||
this.state = State.InTagName
|
||||
|
@ -873,10 +871,9 @@ export default class Tokenizer {
|
|||
}
|
||||
}
|
||||
private stateBeforeSpecialT(c: number): void {
|
||||
const lower = c | 0x20
|
||||
if (lower === Sequences.TitleEnd[3]) {
|
||||
if (c === Sequences.TitleEnd[3]) {
|
||||
this.startSpecial(Sequences.TitleEnd, 4)
|
||||
} else if (lower === Sequences.TextareaEnd[3]) {
|
||||
} else if (c === Sequences.TextareaEnd[3]) {
|
||||
this.startSpecial(Sequences.TextareaEnd, 4)
|
||||
} else {
|
||||
this.state = State.InTagName
|
||||
|
|
|
@ -20,7 +20,7 @@ describe('DOM parser', () => {
|
|||
)
|
||||
const element = ast.children[0] as ElementNode
|
||||
const text = element.children[0] as TextNode
|
||||
|
||||
expect(element.children.length).toBe(1)
|
||||
expect(text).toStrictEqual({
|
||||
type: NodeTypes.TEXT,
|
||||
content: 'some<div>text</div>and<!--comment-->',
|
||||
|
@ -32,6 +32,20 @@ describe('DOM parser', () => {
|
|||
})
|
||||
})
|
||||
|
||||
test('should not treat Uppercase component as special tag', () => {
|
||||
const ast = parse(
|
||||
'<TextArea>some<div>text</div>and<!--comment--></TextArea>',
|
||||
parserOptions,
|
||||
)
|
||||
const element = ast.children[0] as ElementNode
|
||||
expect(element.children.map(n => n.type)).toMatchObject([
|
||||
NodeTypes.TEXT,
|
||||
NodeTypes.ELEMENT,
|
||||
NodeTypes.TEXT,
|
||||
NodeTypes.COMMENT,
|
||||
])
|
||||
})
|
||||
|
||||
test('textarea handles entities', () => {
|
||||
const ast = parse('<textarea>&</textarea>', parserOptions)
|
||||
const element = ast.children[0] as ElementNode
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "@vue/compiler-dom",
|
||||
"version": "3.4.19",
|
||||
"version": "3.4.20",
|
||||
"description": "@vue/compiler-dom",
|
||||
"main": "index.js",
|
||||
"module": "dist/compiler-dom.esm-bundler.js",
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "@vue/compiler-sfc",
|
||||
"version": "3.4.19",
|
||||
"version": "3.4.20",
|
||||
"description": "@vue/compiler-sfc",
|
||||
"main": "dist/compiler-sfc.cjs.js",
|
||||
"module": "dist/compiler-sfc.esm-browser.js",
|
||||
|
@ -49,8 +49,8 @@
|
|||
"@vue/compiler-vapor": "workspace:*",
|
||||
"@vue/shared": "workspace:*",
|
||||
"estree-walker": "^2.0.2",
|
||||
"magic-string": "^0.30.6",
|
||||
"postcss": "^8.4.33",
|
||||
"magic-string": "^0.30.7",
|
||||
"postcss": "^8.4.35",
|
||||
"source-map-js": "^1.0.2"
|
||||
},
|
||||
"devDependencies": {
|
||||
|
@ -63,6 +63,6 @@
|
|||
"postcss-modules": "^6.0.0",
|
||||
"postcss-selector-parser": "^6.0.15",
|
||||
"pug": "^3.0.2",
|
||||
"sass": "^1.70.0"
|
||||
"sass": "^1.71.1"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "@vue/compiler-ssr",
|
||||
"version": "3.4.19",
|
||||
"version": "3.4.20",
|
||||
"description": "@vue/compiler-ssr",
|
||||
"main": "dist/compiler-ssr.cjs.js",
|
||||
"types": "dist/compiler-ssr.d.ts",
|
||||
|
|
|
@ -21,6 +21,7 @@ describe.skipIf(!global.gc)('reactivity/gc', () => {
|
|||
// #9233
|
||||
it('should release computed cache', async () => {
|
||||
const src = ref<{} | undefined>({})
|
||||
// @ts-expect-error ES2021 API
|
||||
const srcRef = new WeakRef(src.value!)
|
||||
|
||||
let c: ComputedRef | undefined = computed(() => src.value)
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "@vue/reactivity",
|
||||
"version": "3.4.19",
|
||||
"version": "3.4.20",
|
||||
"description": "@vue/reactivity",
|
||||
"main": "index.js",
|
||||
"module": "dist/reactivity.esm-bundler.js",
|
||||
|
|
|
@ -89,26 +89,26 @@ function hasOwnProperty(this: object, key: string) {
|
|||
class BaseReactiveHandler implements ProxyHandler<Target> {
|
||||
constructor(
|
||||
protected readonly _isReadonly = false,
|
||||
protected readonly _shallow = false,
|
||||
protected readonly _isShallow = false,
|
||||
) {}
|
||||
|
||||
get(target: Target, key: string | symbol, receiver: object) {
|
||||
const isReadonly = this._isReadonly,
|
||||
shallow = this._shallow
|
||||
isShallow = this._isShallow
|
||||
if (key === ReactiveFlags.IS_REACTIVE) {
|
||||
return !isReadonly
|
||||
} else if (key === ReactiveFlags.IS_READONLY) {
|
||||
return isReadonly
|
||||
} else if (key === ReactiveFlags.IS_SHALLOW) {
|
||||
return shallow
|
||||
return isShallow
|
||||
} else if (key === ReactiveFlags.RAW) {
|
||||
if (
|
||||
receiver ===
|
||||
(isReadonly
|
||||
? shallow
|
||||
? isShallow
|
||||
? shallowReadonlyMap
|
||||
: readonlyMap
|
||||
: shallow
|
||||
: isShallow
|
||||
? shallowReactiveMap
|
||||
: reactiveMap
|
||||
).get(target) ||
|
||||
|
@ -143,7 +143,7 @@ class BaseReactiveHandler implements ProxyHandler<Target> {
|
|||
track(target, TrackOpTypes.GET, key)
|
||||
}
|
||||
|
||||
if (shallow) {
|
||||
if (isShallow) {
|
||||
return res
|
||||
}
|
||||
|
||||
|
@ -164,8 +164,8 @@ class BaseReactiveHandler implements ProxyHandler<Target> {
|
|||
}
|
||||
|
||||
class MutableReactiveHandler extends BaseReactiveHandler {
|
||||
constructor(shallow = false) {
|
||||
super(false, shallow)
|
||||
constructor(isShallow = false) {
|
||||
super(false, isShallow)
|
||||
}
|
||||
|
||||
set(
|
||||
|
@ -175,7 +175,7 @@ class MutableReactiveHandler extends BaseReactiveHandler {
|
|||
receiver: object,
|
||||
): boolean {
|
||||
let oldValue = (target as any)[key]
|
||||
if (!this._shallow) {
|
||||
if (!this._isShallow) {
|
||||
const isOldValueReadonly = isReadonly(oldValue)
|
||||
if (!isShallow(value) && !isReadonly(value)) {
|
||||
oldValue = toRaw(oldValue)
|
||||
|
@ -237,8 +237,8 @@ class MutableReactiveHandler extends BaseReactiveHandler {
|
|||
}
|
||||
|
||||
class ReadonlyReactiveHandler extends BaseReactiveHandler {
|
||||
constructor(shallow = false) {
|
||||
super(true, shallow)
|
||||
constructor(isShallow = false) {
|
||||
super(true, isShallow)
|
||||
}
|
||||
|
||||
set(target: object, key: string | symbol) {
|
||||
|
|
|
@ -143,10 +143,10 @@ describe('api: createApp', () => {
|
|||
},
|
||||
setup() {
|
||||
// resolve in setup
|
||||
const FooBar = resolveComponent('foo-bar') as any
|
||||
const FooBar = resolveComponent('foo-bar')
|
||||
return () => {
|
||||
// resolve in render
|
||||
const BarBaz = resolveComponent('bar-baz') as any
|
||||
const BarBaz = resolveComponent('bar-baz')
|
||||
return h('div', [h(FooBar), h(BarBaz)])
|
||||
}
|
||||
},
|
||||
|
@ -182,10 +182,10 @@ describe('api: createApp', () => {
|
|||
},
|
||||
setup() {
|
||||
// resolve in setup
|
||||
const FooBar = resolveDirective('foo-bar')!
|
||||
const FooBar = resolveDirective('foo-bar')
|
||||
return () => {
|
||||
// resolve in render
|
||||
const BarBaz = resolveDirective('bar-baz')!
|
||||
const BarBaz = resolveDirective('bar-baz')
|
||||
return withDirectives(h('div'), [[FooBar], [BarBaz]])
|
||||
}
|
||||
},
|
||||
|
@ -350,7 +350,7 @@ describe('api: createApp', () => {
|
|||
|
||||
const handler = vi.fn((err, instance, info) => {
|
||||
expect(err).toBe(error)
|
||||
expect((instance as any).count).toBe(count.value)
|
||||
expect(instance.count).toBe(count.value)
|
||||
expect(info).toBe(`render function`)
|
||||
})
|
||||
|
||||
|
@ -450,11 +450,6 @@ describe('api: createApp', () => {
|
|||
}
|
||||
|
||||
const app = createApp(Root)
|
||||
Object.defineProperty(app.config, 'isNativeTag', {
|
||||
value: isNativeTag,
|
||||
writable: false,
|
||||
})
|
||||
|
||||
app.mount(nodeOps.createElement('div'))
|
||||
expect(
|
||||
`Do not use built-in directive ids as custom directive id: bind`,
|
||||
|
|
|
@ -790,10 +790,8 @@ describe('api: options', () => {
|
|||
data() {},
|
||||
}
|
||||
defineComponent({
|
||||
// @ts-expect-error edge case after #7963, unlikely to happen in practice
|
||||
// since the user will want to type the mixins themselves.
|
||||
mixins: [defineComponent(MixinA), defineComponent(MixinB)],
|
||||
// @ts-expect-error
|
||||
data() {},
|
||||
})
|
||||
})
|
||||
|
|
|
@ -26,7 +26,7 @@ import {
|
|||
} from '@vue/runtime-dom'
|
||||
import { type SSRContext, renderToString } from '@vue/server-renderer'
|
||||
import { PatchFlags } from '@vue/shared'
|
||||
import { vShowOldKey } from '../../runtime-dom/src/directives/vShow'
|
||||
import { vShowOriginalDisplay } from '../../runtime-dom/src/directives/vShow'
|
||||
|
||||
function mountWithHydration(html: string, render: () => any) {
|
||||
const container = document.createElement('div')
|
||||
|
@ -1252,7 +1252,7 @@ describe('SSR hydration', () => {
|
|||
foo
|
||||
</div>
|
||||
`)
|
||||
expect((container.firstChild as any)[vShowOldKey]).toBe('')
|
||||
expect((container.firstChild as any)[vShowOriginalDisplay]).toBe('')
|
||||
expect(vnode.el).toBe(container.firstChild)
|
||||
expect(`mismatch`).not.toHaveBeenWarned()
|
||||
})
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "@vue/runtime-core",
|
||||
"version": "3.4.19",
|
||||
"version": "3.4.20",
|
||||
"description": "@vue/runtime-core",
|
||||
"main": "index.js",
|
||||
"module": "dist/runtime-core.esm-bundler.js",
|
||||
|
|
|
@ -89,6 +89,30 @@ export type DefineComponent<
|
|||
> &
|
||||
PP
|
||||
|
||||
export type DefineSetupFnComponent<
|
||||
P extends Record<string, any>,
|
||||
E extends EmitsOptions = {},
|
||||
S extends SlotsType = SlotsType,
|
||||
Props = P & EmitsToProps<E>,
|
||||
PP = PublicProps,
|
||||
> = new (
|
||||
props: Props & PP,
|
||||
) => CreateComponentPublicInstance<
|
||||
Props,
|
||||
{},
|
||||
{},
|
||||
{},
|
||||
{},
|
||||
ComponentOptionsMixin,
|
||||
ComponentOptionsMixin,
|
||||
E,
|
||||
PP,
|
||||
{},
|
||||
false,
|
||||
{},
|
||||
S
|
||||
>
|
||||
|
||||
// defineComponent is a utility that is primarily used for type inference
|
||||
// when declaring components. Type inference is provided in the component
|
||||
// options (provided as the argument). The returned value has artificial types
|
||||
|
@ -111,7 +135,7 @@ export function defineComponent<
|
|||
emits?: E | EE[]
|
||||
slots?: S
|
||||
},
|
||||
): (props: Props & EmitsToProps<E>) => any
|
||||
): DefineSetupFnComponent<Props, E, S>
|
||||
export function defineComponent<
|
||||
Props extends Record<string, any>,
|
||||
E extends EmitsOptions = {},
|
||||
|
@ -127,7 +151,7 @@ export function defineComponent<
|
|||
emits?: E | EE[]
|
||||
slots?: S
|
||||
},
|
||||
): (props: Props & EmitsToProps<E>) => any
|
||||
): DefineSetupFnComponent<Props, E, S>
|
||||
|
||||
// overload 2: object format with no props
|
||||
// (uses user defined props interface)
|
||||
|
|
|
@ -144,8 +144,6 @@ const BaseTransitionImpl: ComponentOptions = {
|
|||
const instance = getCurrentInstance()!
|
||||
const state = useTransitionState()
|
||||
|
||||
let prevTransitionKey: any
|
||||
|
||||
return () => {
|
||||
const children =
|
||||
slots.default && getTransitionRawChildren(slots.default(), true)
|
||||
|
@ -211,23 +209,11 @@ const BaseTransitionImpl: ComponentOptions = {
|
|||
const oldChild = instance.subTree
|
||||
const oldInnerChild = oldChild && getKeepAliveChild(oldChild)
|
||||
|
||||
let transitionKeyChanged = false
|
||||
const { getTransitionKey } = innerChild.type as any
|
||||
if (getTransitionKey) {
|
||||
const key = getTransitionKey()
|
||||
if (prevTransitionKey === undefined) {
|
||||
prevTransitionKey = key
|
||||
} else if (key !== prevTransitionKey) {
|
||||
prevTransitionKey = key
|
||||
transitionKeyChanged = true
|
||||
}
|
||||
}
|
||||
|
||||
// handle mode
|
||||
if (
|
||||
oldInnerChild &&
|
||||
oldInnerChild.type !== Comment &&
|
||||
(!isSameVNodeType(innerChild, oldInnerChild) || transitionKeyChanged)
|
||||
!isSameVNodeType(innerChild, oldInnerChild)
|
||||
) {
|
||||
const leavingHooks = resolveTransitionHooks(
|
||||
oldInnerChild,
|
||||
|
|
|
@ -251,7 +251,11 @@ export type {
|
|||
AllowedComponentProps,
|
||||
ComponentInstance,
|
||||
} from './component'
|
||||
export type { DefineComponent, PublicProps } from './apiDefineComponent'
|
||||
export type {
|
||||
DefineComponent,
|
||||
DefineSetupFnComponent,
|
||||
PublicProps,
|
||||
} from './apiDefineComponent'
|
||||
export type {
|
||||
ComponentOptions,
|
||||
ComponentOptionsMixin,
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "@vue/runtime-dom",
|
||||
"version": "3.4.19",
|
||||
"version": "3.4.20",
|
||||
"description": "@vue/runtime-dom",
|
||||
"main": "index.js",
|
||||
"module": "dist/runtime-dom.esm-bundler.js",
|
||||
|
|
|
@ -1,15 +1,18 @@
|
|||
import type { ObjectDirective } from '@vue/runtime-core'
|
||||
|
||||
export const vShowOldKey = Symbol('_vod')
|
||||
export const vShowOriginalDisplay = Symbol('_vod')
|
||||
export const vShowHidden = Symbol('_vsh')
|
||||
|
||||
interface VShowElement extends HTMLElement {
|
||||
export interface VShowElement extends HTMLElement {
|
||||
// _vod = vue original display
|
||||
[vShowOldKey]: string
|
||||
[vShowOriginalDisplay]: string
|
||||
[vShowHidden]: boolean
|
||||
}
|
||||
|
||||
export const vShow: ObjectDirective<VShowElement> & { name?: 'show' } = {
|
||||
beforeMount(el, { value }, { transition }) {
|
||||
el[vShowOldKey] = el.style.display === 'none' ? '' : el.style.display
|
||||
el[vShowOriginalDisplay] =
|
||||
el.style.display === 'none' ? '' : el.style.display
|
||||
if (transition && value) {
|
||||
transition.beforeEnter(el)
|
||||
} else {
|
||||
|
@ -22,11 +25,7 @@ export const vShow: ObjectDirective<VShowElement> & { name?: 'show' } = {
|
|||
}
|
||||
},
|
||||
updated(el, { value, oldValue }, { transition }) {
|
||||
if (
|
||||
!value === !oldValue &&
|
||||
(el.style.display === el[vShowOldKey] || !value)
|
||||
)
|
||||
return
|
||||
if (!value === !oldValue) return
|
||||
if (transition) {
|
||||
if (value) {
|
||||
transition.beforeEnter(el)
|
||||
|
@ -51,7 +50,8 @@ if (__DEV__) {
|
|||
}
|
||||
|
||||
function setDisplay(el: VShowElement, value: unknown): void {
|
||||
el.style.display = value ? el[vShowOldKey] : 'none'
|
||||
el.style.display = value ? el[vShowOriginalDisplay] : 'none'
|
||||
el[vShowHidden] = !value
|
||||
}
|
||||
|
||||
// SSR vnode transforms, only used when user includes client-oriented render
|
||||
|
|
|
@ -1,6 +1,10 @@
|
|||
import { capitalize, hyphenate, isArray, isString } from '@vue/shared'
|
||||
import { camelize, warn } from '@vue/runtime-core'
|
||||
import { vShowOldKey } from '../directives/vShow'
|
||||
import {
|
||||
type VShowElement,
|
||||
vShowHidden,
|
||||
vShowOriginalDisplay,
|
||||
} from '../directives/vShow'
|
||||
import { CSS_VAR_TEXT } from '../helpers/useCssVars'
|
||||
|
||||
type Style = string | Record<string, string | string[]> | null
|
||||
|
@ -10,7 +14,6 @@ const displayRE = /(^|;)\s*display\s*:/
|
|||
export function patchStyle(el: Element, prev: Style, next: Style) {
|
||||
const style = (el as HTMLElement).style
|
||||
const isCssString = isString(next)
|
||||
const currentDisplay = style.display
|
||||
let hasControlledDisplay = false
|
||||
if (next && !isCssString) {
|
||||
if (prev) {
|
||||
|
@ -50,12 +53,14 @@ export function patchStyle(el: Element, prev: Style, next: Style) {
|
|||
el.removeAttribute('style')
|
||||
}
|
||||
}
|
||||
// indicates that the `display` of the element is controlled by `v-show`,
|
||||
// so we always keep the current `display` value regardless of the `style`
|
||||
// value, thus handing over control to `v-show`.
|
||||
if (vShowOldKey in el) {
|
||||
el[vShowOldKey] = hasControlledDisplay ? style.display : ''
|
||||
style.display = currentDisplay
|
||||
// indicates the element also has `v-show`.
|
||||
if (vShowOriginalDisplay in el) {
|
||||
// make v-show respect the current v-bind style display when shown
|
||||
el[vShowOriginalDisplay] = hasControlledDisplay ? style.display : ''
|
||||
// if v-show is in hidden state, v-show has higher priority
|
||||
if ((el as VShowElement)[vShowHidden]) {
|
||||
style.display = 'none'
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "@vue/server-renderer",
|
||||
"version": "3.4.19",
|
||||
"version": "3.4.20",
|
||||
"description": "@vue/server-renderer",
|
||||
"main": "index.js",
|
||||
"module": "dist/server-renderer.esm-bundler.js",
|
||||
|
|
|
@ -9,8 +9,8 @@
|
|||
"serve": "vite preview"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@vitejs/plugin-vue": "^5.0.3",
|
||||
"vite": "^5.0.12"
|
||||
"@vitejs/plugin-vue": "^5.0.4",
|
||||
"vite": "^5.1.4"
|
||||
},
|
||||
"dependencies": {
|
||||
"@vue/repl": "^4.1.1",
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
"vue": "^3.4.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@vitejs/plugin-vue": "^5.0.3",
|
||||
"vite": "^5.0.12"
|
||||
"@vitejs/plugin-vue": "^5.0.4",
|
||||
"vite": "^5.1.4"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "@vue/shared",
|
||||
"version": "3.4.19",
|
||||
"version": "3.4.20",
|
||||
"description": "internal utils shared across @vue packages",
|
||||
"main": "index.js",
|
||||
"module": "dist/shared.esm-bundler.js",
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "@vue/compat",
|
||||
"version": "3.4.19",
|
||||
"version": "3.4.20",
|
||||
"description": "Vue 3 compatibility build for Vue 2",
|
||||
"main": "index.js",
|
||||
"module": "dist/vue.runtime.esm-bundler.js",
|
||||
|
|
|
@ -9,7 +9,7 @@ export const E2E_TIMEOUT = 30 * 1000
|
|||
|
||||
const puppeteerOptions: PuppeteerLaunchOptions = {
|
||||
args: process.env.CI ? ['--no-sandbox', '--disable-setuid-sandbox'] : [],
|
||||
headless: 'new',
|
||||
headless: true,
|
||||
}
|
||||
|
||||
const maxTries = 30
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "vue",
|
||||
"version": "3.4.19",
|
||||
"version": "3.4.20",
|
||||
"description": "The progressive JavaScript framework for building modern web UI.",
|
||||
"main": "index.js",
|
||||
"module": "dist/vue.runtime.esm-bundler.js",
|
||||
|
|
1035
pnpm-lock.yaml
1035
pnpm-lock.yaml
File diff suppressed because it is too large
Load Diff
|
@ -145,6 +145,8 @@ function createConfig(format, output, plugins = []) {
|
|||
}
|
||||
output.sourcemap = !!process.env.SOURCE_MAP
|
||||
output.externalLiveBindings = false
|
||||
// https://github.com/rollup/rollup/pull/5380
|
||||
output.reexportProtoFromExternal = false
|
||||
|
||||
if (isGlobalBuild) {
|
||||
output.name = packageOptions.name
|
||||
|
|
|
@ -18,15 +18,15 @@
|
|||
"esModuleInterop": true,
|
||||
"removeComments": false,
|
||||
"jsx": "preserve",
|
||||
"lib": ["esnext", "dom"],
|
||||
"lib": ["es2016", "dom"],
|
||||
"types": ["vitest/globals", "puppeteer", "node"],
|
||||
"rootDir": ".",
|
||||
"paths": {
|
||||
"@vue/compat": ["packages/vue-compat/src"],
|
||||
"@vue/vapor": ["packages/vue-vapor/src"],
|
||||
"@vue/*": ["packages/*/src"],
|
||||
"vue": ["packages/vue/src"],
|
||||
},
|
||||
"vue": ["packages/vue/src"]
|
||||
}
|
||||
},
|
||||
"include": [
|
||||
"packages/global.d.ts",
|
||||
|
@ -37,6 +37,6 @@
|
|||
"packages/vue/jsx-runtime",
|
||||
"scripts/*",
|
||||
"rollup.*.js",
|
||||
"playground",
|
||||
],
|
||||
"playground"
|
||||
]
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue