@vue/runtime-dom
Advanced tools
Comparing version 3.4.0-beta.2 to 3.4.0-beta.3
@@ -406,2 +406,7 @@ 'use strict'; | ||
const CSS_VAR_TEXT = Symbol("CSS_VAR_TEXT" ); | ||
function useCssVars(getter) { | ||
return; | ||
} | ||
function patchStyle(el, prev, next) { | ||
@@ -425,2 +430,6 @@ const style = el.style; | ||
if (prev !== next) { | ||
const cssVarText = style[CSS_VAR_TEXT]; | ||
if (cssVarText) { | ||
next += ";" + cssVarText; | ||
} | ||
style.cssText = next; | ||
@@ -933,6 +942,2 @@ } | ||
function useCssVars(getter) { | ||
return; | ||
} | ||
const positionMap = /* @__PURE__ */ new WeakMap(); | ||
@@ -939,0 +944,0 @@ const newPositionMap = /* @__PURE__ */ new WeakMap(); |
@@ -403,2 +403,7 @@ 'use strict'; | ||
const CSS_VAR_TEXT = Symbol(""); | ||
function useCssVars(getter) { | ||
return; | ||
} | ||
function patchStyle(el, prev, next) { | ||
@@ -422,2 +427,6 @@ const style = el.style; | ||
if (prev !== next) { | ||
const cssVarText = style[CSS_VAR_TEXT]; | ||
if (cssVarText) { | ||
next += ";" + cssVarText; | ||
} | ||
style.cssText = next; | ||
@@ -894,6 +903,2 @@ } | ||
function useCssVars(getter) { | ||
return; | ||
} | ||
const positionMap = /* @__PURE__ */ new WeakMap(); | ||
@@ -900,0 +905,0 @@ const newPositionMap = /* @__PURE__ */ new WeakMap(); |
@@ -1,2 +0,2 @@ | ||
import { h, BaseTransition, BaseTransitionPropsValidators, assertNumber, warn, camelize, callWithAsyncErrorHandling, defineComponent, nextTick, createVNode, getCurrentInstance, watchPostEffect, onMounted, onUnmounted, Fragment, Static, useTransitionState, onUpdated, toRaw, getTransitionRawChildren, setTransitionHooks, resolveTransitionHooks, isRuntimeOnly, createRenderer, createHydrationRenderer } from '@vue/runtime-core'; | ||
import { h, BaseTransition, BaseTransitionPropsValidators, assertNumber, getCurrentInstance, warn, watchPostEffect, onMounted, onUnmounted, Fragment, Static, camelize, callWithAsyncErrorHandling, defineComponent, nextTick, createVNode, useTransitionState, onUpdated, toRaw, getTransitionRawChildren, setTransitionHooks, resolveTransitionHooks, isRuntimeOnly, createRenderer, createHydrationRenderer } from '@vue/runtime-core'; | ||
export * from '@vue/runtime-core'; | ||
@@ -403,2 +403,65 @@ import { extend, isObject, toNumber, isArray, isString, hyphenate, capitalize, isSpecialBooleanAttr, includeBooleanAttr, isOn, isModelListener, isFunction, camelize as camelize$1, EMPTY_OBJ, looseToNumber, looseIndexOf, isSet, looseEqual, invokeArrayFns, isHTMLTag, isSVGTag, isMathMLTag } from '@vue/shared'; | ||
const CSS_VAR_TEXT = Symbol(!!(process.env.NODE_ENV !== "production") ? "CSS_VAR_TEXT" : ""); | ||
function useCssVars(getter) { | ||
const instance = getCurrentInstance(); | ||
if (!instance) { | ||
!!(process.env.NODE_ENV !== "production") && warn(`useCssVars is called without current active component instance.`); | ||
return; | ||
} | ||
const updateTeleports = instance.ut = (vars = getter(instance.proxy)) => { | ||
Array.from( | ||
document.querySelectorAll(`[data-v-owner="${instance.uid}"]`) | ||
).forEach((node) => setVarsOnNode(node, vars)); | ||
}; | ||
const setVars = () => { | ||
const vars = getter(instance.proxy); | ||
setVarsOnVNode(instance.subTree, vars); | ||
updateTeleports(vars); | ||
}; | ||
watchPostEffect(setVars); | ||
onMounted(() => { | ||
const ob = new MutationObserver(setVars); | ||
ob.observe(instance.subTree.el.parentNode, { childList: true }); | ||
onUnmounted(() => ob.disconnect()); | ||
}); | ||
} | ||
function setVarsOnVNode(vnode, vars) { | ||
if (vnode.shapeFlag & 128) { | ||
const suspense = vnode.suspense; | ||
vnode = suspense.activeBranch; | ||
if (suspense.pendingBranch && !suspense.isHydrating) { | ||
suspense.effects.push(() => { | ||
setVarsOnVNode(suspense.activeBranch, vars); | ||
}); | ||
} | ||
} | ||
while (vnode.component) { | ||
vnode = vnode.component.subTree; | ||
} | ||
if (vnode.shapeFlag & 1 && vnode.el) { | ||
setVarsOnNode(vnode.el, vars); | ||
} else if (vnode.type === Fragment) { | ||
vnode.children.forEach((c) => setVarsOnVNode(c, vars)); | ||
} else if (vnode.type === Static) { | ||
let { el, anchor } = vnode; | ||
while (el) { | ||
setVarsOnNode(el, vars); | ||
if (el === anchor) | ||
break; | ||
el = el.nextSibling; | ||
} | ||
} | ||
} | ||
function setVarsOnNode(el, vars) { | ||
if (el.nodeType === 1) { | ||
const style = el.style; | ||
let cssText = ""; | ||
for (const key in vars) { | ||
style.setProperty(`--${key}`, vars[key]); | ||
cssText += `--${key}: ${vars[key]};`; | ||
} | ||
style[CSS_VAR_TEXT] = cssText; | ||
} | ||
} | ||
function patchStyle(el, prev, next) { | ||
@@ -422,2 +485,6 @@ const style = el.style; | ||
if (prev !== next) { | ||
const cssVarText = style[CSS_VAR_TEXT]; | ||
if (cssVarText) { | ||
next += ";" + cssVarText; | ||
} | ||
style.cssText = next; | ||
@@ -930,61 +997,2 @@ } | ||
function useCssVars(getter) { | ||
const instance = getCurrentInstance(); | ||
if (!instance) { | ||
!!(process.env.NODE_ENV !== "production") && warn(`useCssVars is called without current active component instance.`); | ||
return; | ||
} | ||
const updateTeleports = instance.ut = (vars = getter(instance.proxy)) => { | ||
Array.from( | ||
document.querySelectorAll(`[data-v-owner="${instance.uid}"]`) | ||
).forEach((node) => setVarsOnNode(node, vars)); | ||
}; | ||
const setVars = () => { | ||
const vars = getter(instance.proxy); | ||
setVarsOnVNode(instance.subTree, vars); | ||
updateTeleports(vars); | ||
}; | ||
watchPostEffect(setVars); | ||
onMounted(() => { | ||
const ob = new MutationObserver(setVars); | ||
ob.observe(instance.subTree.el.parentNode, { childList: true }); | ||
onUnmounted(() => ob.disconnect()); | ||
}); | ||
} | ||
function setVarsOnVNode(vnode, vars) { | ||
if (vnode.shapeFlag & 128) { | ||
const suspense = vnode.suspense; | ||
vnode = suspense.activeBranch; | ||
if (suspense.pendingBranch && !suspense.isHydrating) { | ||
suspense.effects.push(() => { | ||
setVarsOnVNode(suspense.activeBranch, vars); | ||
}); | ||
} | ||
} | ||
while (vnode.component) { | ||
vnode = vnode.component.subTree; | ||
} | ||
if (vnode.shapeFlag & 1 && vnode.el) { | ||
setVarsOnNode(vnode.el, vars); | ||
} else if (vnode.type === Fragment) { | ||
vnode.children.forEach((c) => setVarsOnVNode(c, vars)); | ||
} else if (vnode.type === Static) { | ||
let { el, anchor } = vnode; | ||
while (el) { | ||
setVarsOnNode(el, vars); | ||
if (el === anchor) | ||
break; | ||
el = el.nextSibling; | ||
} | ||
} | ||
} | ||
function setVarsOnNode(el, vars) { | ||
if (el.nodeType === 1) { | ||
const style = el.style; | ||
for (const key in vars) { | ||
style.setProperty(`--${key}`, vars[key]); | ||
} | ||
} | ||
} | ||
const positionMap = /* @__PURE__ */ new WeakMap(); | ||
@@ -991,0 +999,0 @@ const newPositionMap = /* @__PURE__ */ new WeakMap(); |
{ | ||
"name": "@vue/runtime-dom", | ||
"version": "3.4.0-beta.2", | ||
"version": "3.4.0-beta.3", | ||
"description": "@vue/runtime-dom", | ||
@@ -39,5 +39,5 @@ "main": "index.js", | ||
"csstype": "^3.1.3", | ||
"@vue/shared": "3.4.0-beta.2", | ||
"@vue/runtime-core": "3.4.0-beta.2" | ||
"@vue/shared": "3.4.0-beta.3", | ||
"@vue/runtime-core": "3.4.0-beta.3" | ||
} | ||
} |
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
1030157
28273
18
+ Added@vue/reactivity@3.4.0-beta.3(transitive)
+ Added@vue/runtime-core@3.4.0-beta.3(transitive)
+ Added@vue/shared@3.4.0-beta.3(transitive)
- Removed@vue/reactivity@3.4.0-beta.2(transitive)
- Removed@vue/runtime-core@3.4.0-beta.2(transitive)
- Removed@vue/shared@3.4.0-beta.2(transitive)
Updated@vue/shared@3.4.0-beta.3