@vue/runtime-dom
Advanced tools
Comparing version 3.0.2 to 3.0.3
@@ -414,41 +414,9 @@ 'use strict'; | ||
function useCssVars(getter, scoped = false) { | ||
const instance = runtimeCore.getCurrentInstance(); | ||
/* istanbul ignore next */ | ||
if (!instance) { | ||
runtimeCore.warn(`useCssVars is called without current active component instance.`); | ||
return; | ||
} | ||
const prefix = scoped && instance.type.__scopeId | ||
? `${instance.type.__scopeId.replace(/^data-v-/, '')}-` | ||
: ``; | ||
const setVars = () => setVarsOnVNode(instance.subTree, getter(instance.proxy), prefix); | ||
runtimeCore.onMounted(() => runtimeCore.watchEffect(setVars)); | ||
runtimeCore.onUpdated(setVars); | ||
/** | ||
* Runtime helper for SFC's CSS variable injection feature. | ||
* @private | ||
*/ | ||
function useCssVars(getter) { | ||
return; | ||
} | ||
function setVarsOnVNode(vnode, vars, prefix) { | ||
if ( vnode.shapeFlag & 128 /* SUSPENSE */) { | ||
const suspense = vnode.suspense; | ||
vnode = suspense.activeBranch; | ||
if (suspense.pendingBranch && !suspense.isHydrating) { | ||
suspense.effects.push(() => { | ||
setVarsOnVNode(suspense.activeBranch, vars, prefix); | ||
}); | ||
} | ||
} | ||
// drill down HOCs until it's a non-component vnode | ||
while (vnode.component) { | ||
vnode = vnode.component.subTree; | ||
} | ||
if (vnode.shapeFlag & 1 /* ELEMENT */ && vnode.el) { | ||
const style = vnode.el.style; | ||
for (const key in vars) { | ||
style.setProperty(`--${prefix}${key}`, runtimeCore.unref(vars[key])); | ||
} | ||
} | ||
else if (vnode.type === runtimeCore.Fragment) { | ||
vnode.children.forEach(c => setVarsOnVNode(c, vars, prefix)); | ||
} | ||
} | ||
@@ -706,6 +674,2 @@ const TRANSITION = 'transition'; | ||
function toRaw(observed) { | ||
return ((observed && toRaw(observed["__v_raw" /* RAW */])) || observed); | ||
} | ||
const positionMap = new WeakMap(); | ||
@@ -759,3 +723,3 @@ const newPositionMap = new WeakMap(); | ||
return () => { | ||
const rawProps = toRaw(props); | ||
const rawProps = runtimeCore.toRaw(props); | ||
const cssTransitionProps = resolveTransitionProps(rawProps); | ||
@@ -762,0 +726,0 @@ const tag = rawProps.tag || runtimeCore.Fragment; |
@@ -406,39 +406,9 @@ 'use strict'; | ||
function useCssVars(getter, scoped = false) { | ||
const instance = runtimeCore.getCurrentInstance(); | ||
/* istanbul ignore next */ | ||
if (!instance) { | ||
return; | ||
} | ||
const prefix = scoped && instance.type.__scopeId | ||
? `${instance.type.__scopeId.replace(/^data-v-/, '')}-` | ||
: ``; | ||
const setVars = () => setVarsOnVNode(instance.subTree, getter(instance.proxy), prefix); | ||
runtimeCore.onMounted(() => runtimeCore.watchEffect(setVars)); | ||
runtimeCore.onUpdated(setVars); | ||
/** | ||
* Runtime helper for SFC's CSS variable injection feature. | ||
* @private | ||
*/ | ||
function useCssVars(getter) { | ||
return; | ||
} | ||
function setVarsOnVNode(vnode, vars, prefix) { | ||
if ( vnode.shapeFlag & 128 /* SUSPENSE */) { | ||
const suspense = vnode.suspense; | ||
vnode = suspense.activeBranch; | ||
if (suspense.pendingBranch && !suspense.isHydrating) { | ||
suspense.effects.push(() => { | ||
setVarsOnVNode(suspense.activeBranch, vars, prefix); | ||
}); | ||
} | ||
} | ||
// drill down HOCs until it's a non-component vnode | ||
while (vnode.component) { | ||
vnode = vnode.component.subTree; | ||
} | ||
if (vnode.shapeFlag & 1 /* ELEMENT */ && vnode.el) { | ||
const style = vnode.el.style; | ||
for (const key in vars) { | ||
style.setProperty(`--${prefix}${key}`, runtimeCore.unref(vars[key])); | ||
} | ||
} | ||
else if (vnode.type === runtimeCore.Fragment) { | ||
vnode.children.forEach(c => setVarsOnVNode(c, vars, prefix)); | ||
} | ||
} | ||
@@ -685,6 +655,2 @@ const TRANSITION = 'transition'; | ||
function toRaw(observed) { | ||
return ((observed && toRaw(observed["__v_raw" /* RAW */])) || observed); | ||
} | ||
const positionMap = new WeakMap(); | ||
@@ -738,3 +704,3 @@ const newPositionMap = new WeakMap(); | ||
return () => { | ||
const rawProps = toRaw(props); | ||
const rawProps = runtimeCore.toRaw(props); | ||
const cssTransitionProps = resolveTransitionProps(rawProps); | ||
@@ -741,0 +707,0 @@ const tag = rawProps.tag || runtimeCore.Fragment; |
import { BaseTransitionProps } from '@vue/runtime-core'; | ||
import { ComponentPublicInstance } from '@vue/runtime-core'; | ||
import { CreateAppFunction } from '@vue/runtime-core'; | ||
@@ -59,3 +58,7 @@ import { FunctionalComponent } from '@vue/runtime-core'; | ||
export declare function useCssVars(getter: (ctx: ComponentPublicInstance) => Record<string, string>, scoped?: boolean): void; | ||
/** | ||
* Runtime helper for SFC's CSS variable injection feature. | ||
* @private | ||
*/ | ||
export declare function useCssVars(getter: (ctx: any) => Record<string, string>): void; | ||
@@ -62,0 +65,0 @@ export declare const vModelCheckbox: ModelDirective<HTMLInputElement>; |
@@ -1,2 +0,2 @@ | ||
import { camelize, warn, callWithAsyncErrorHandling, getCurrentInstance, onMounted, watchEffect, onUpdated, unref, Fragment, h, BaseTransition, useTransitionState, getTransitionRawChildren, setTransitionHooks, resolveTransitionHooks, createVNode, createRenderer, createHydrationRenderer } from '@vue/runtime-core'; | ||
import { camelize, warn, callWithAsyncErrorHandling, getCurrentInstance, onMounted, watchEffect, onUpdated, Fragment, h, BaseTransition, useTransitionState, toRaw, getTransitionRawChildren, setTransitionHooks, resolveTransitionHooks, createVNode, createRenderer, createHydrationRenderer } from '@vue/runtime-core'; | ||
export * from '@vue/runtime-core'; | ||
@@ -411,3 +411,7 @@ import { isString, isArray, hyphenate, capitalize, isSpecialBooleanAttr, isOn, isModelListener, isFunction, EMPTY_OBJ, extend, isObject, toNumber, invokeArrayFns, looseIndexOf, isSet, looseEqual, isHTMLTag, isSVGTag } from '@vue/shared'; | ||
function useCssVars(getter, scoped = false) { | ||
/** | ||
* Runtime helper for SFC's CSS variable injection feature. | ||
* @private | ||
*/ | ||
function useCssVars(getter) { | ||
const instance = getCurrentInstance(); | ||
@@ -420,10 +424,7 @@ /* istanbul ignore next */ | ||
} | ||
const prefix = scoped && instance.type.__scopeId | ||
? `${instance.type.__scopeId.replace(/^data-v-/, '')}-` | ||
: ``; | ||
const setVars = () => setVarsOnVNode(instance.subTree, getter(instance.proxy), prefix); | ||
onMounted(() => watchEffect(setVars)); | ||
const setVars = () => setVarsOnVNode(instance.subTree, getter(instance.proxy)); | ||
onMounted(() => watchEffect(setVars, { flush: 'post' })); | ||
onUpdated(setVars); | ||
} | ||
function setVarsOnVNode(vnode, vars, prefix) { | ||
function setVarsOnVNode(vnode, vars) { | ||
if ( vnode.shapeFlag & 128 /* SUSPENSE */) { | ||
@@ -434,3 +435,3 @@ const suspense = vnode.suspense; | ||
suspense.effects.push(() => { | ||
setVarsOnVNode(suspense.activeBranch, vars, prefix); | ||
setVarsOnVNode(suspense.activeBranch, vars); | ||
}); | ||
@@ -446,7 +447,7 @@ } | ||
for (const key in vars) { | ||
style.setProperty(`--${prefix}${key}`, unref(vars[key])); | ||
style.setProperty(`--${key}`, vars[key]); | ||
} | ||
} | ||
else if (vnode.type === Fragment) { | ||
vnode.children.forEach(c => setVarsOnVNode(c, vars, prefix)); | ||
vnode.children.forEach(c => setVarsOnVNode(c, vars)); | ||
} | ||
@@ -707,6 +708,2 @@ } | ||
function toRaw(observed) { | ||
return ((observed && toRaw(observed["__v_raw" /* RAW */])) || observed); | ||
} | ||
const positionMap = new WeakMap(); | ||
@@ -713,0 +710,0 @@ const newPositionMap = new WeakMap(); |
{ | ||
"name": "@vue/runtime-dom", | ||
"version": "3.0.2", | ||
"version": "3.0.3", | ||
"description": "@vue/runtime-dom", | ||
@@ -38,6 +38,6 @@ "main": "index.js", | ||
"dependencies": { | ||
"@vue/shared": "3.0.2", | ||
"@vue/runtime-core": "3.0.2", | ||
"@vue/shared": "3.0.3", | ||
"@vue/runtime-core": "3.0.3", | ||
"csstype": "^2.6.8" | ||
} | ||
} |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
1029288
23938
+ Added@vue/reactivity@3.0.3(transitive)
+ Added@vue/runtime-core@3.0.3(transitive)
+ Added@vue/shared@3.0.3(transitive)
- Removed@vue/reactivity@3.0.2(transitive)
- Removed@vue/runtime-core@3.0.2(transitive)
- Removed@vue/shared@3.0.2(transitive)
Updated@vue/runtime-core@3.0.3
Updated@vue/shared@3.0.3