]> git.ipfire.org Git - thirdparty/vuejs/core.git/commitdiff
chore: Merge branch 'minor' into edison/refactor/vaporUseCssVars
authordaiwei <daiwei521@126.com>
Mon, 10 Nov 2025 06:27:43 +0000 (14:27 +0800)
committerdaiwei <daiwei521@126.com>
Mon, 10 Nov 2025 06:27:43 +0000 (14:27 +0800)
1  2 
packages/compiler-sfc/src/compileScript.ts
packages/compiler-sfc/src/style/cssVars.ts
packages/runtime-core/src/component.ts
packages/runtime-dom/src/helpers/useCssVars.ts
packages/runtime-dom/src/index.ts
packages/runtime-vapor/src/index.ts

index 798e7465071cdc5e51c55c7519ee4236ab24095a,022dd2ba0282984916b23ba56b637b63cadcc689..835daa2fc679c2b9c3bd300662352f944e045f56
@@@ -757,9 -823,9 +823,9 @@@ export function compileScript
    if (
      sfc.cssVars.length &&
      // no need to do this when targeting SSR
-     !options.templateOptions?.ssr
+     !ssr
    ) {
 -    ctx.helperImports.add(CSS_VARS_HELPER)
 +    ctx.helperImports.add(getCssVarsHelper(vapor))
      ctx.helperImports.add('unref')
      ctx.s.prependLeft(
        startOffset,
index 64ef565e20bc2aa17313592d2a367a81bbb8941b,2bd8bc6209a1436c69ec0a5beaa7d7b0c52688cb..5d8f497291ee16678570031ec23224d22c40cfc9
@@@ -662,6 -690,19 +701,7 @@@ export interface ComponentInternalInsta
     * @internal
     */
    n?: () => Promise<void>
 -  /**
 -   * `updateTeleportCssVars`
 -   * For updating css vars on contained teleports
 -   * @internal
 -   */
 -  ut?: (vars?: Record<string, unknown>) => void
 -
 -  /**
 -   * dev only. For style v-bind hydration mismatch checks
 -   * @internal
 -   */
 -  getCssVars?: () => Record<string, unknown>
    /**
     * v2 compat only, for caching mutated $options
     * @internal
index cbaea4e8122b0dcd1986f8ff72d8dea6b31aa859,3032143d9a7e2e0c4231e2b643787f38309f1e07..64ac46ae480603d22d4460b227042e3af9ef6f5b
@@@ -18,28 -17,56 +18,30 @@@ export const CSS_VAR_TEXT: unique symbo
   * Runtime helper for SFC's CSS variable injection feature.
   * @private
   */
- export function useCssVars(getter: (ctx: any) => Record<string, string>): void {
+ export function useCssVars(
+   getter: (ctx: any) => Record<string, unknown>,
+ ): void {
    if (!__BROWSER__ && !__TEST__) return
  
 -  const instance = getCurrentInstance()
 -  /* v8 ignore start */
 -  if (!instance) {
 -    __DEV__ &&
 -      warn(`useCssVars is called without current active component instance.`)
 -    return
 -  }
 -  /* v8 ignore stop */
 -
 -  const updateTeleports = (instance.ut = (vars = getter(instance.proxy)) => {
 -    Array.from(
 -      document.querySelectorAll(`[data-v-owner="${instance.uid}"]`),
 -    ).forEach(node => setVarsOnNode(node, vars))
 -  })
 -
 -  if (__DEV__) {
 -    instance.getCssVars = () => getter(instance.proxy)
 -  }
 -
 -  const setVars = () => {
 -    const vars = getter(instance.proxy)
 +  const instance = getCurrentInstance()! // to be check in baseUseCssVars
 +  const getVars = () => getter(instance.proxy)
 +  const setVars = (vars: Record<string, any>) => {
      if (instance.ce) {
        setVarsOnNode(instance.ce as any, vars)
      } else {
        setVarsOnVNode(instance.subTree, vars)
      }
 -    updateTeleports(vars)
    }
  
 -  // handle cases where child component root is affected
 -  // and triggers reflow in onMounted
 -  onBeforeUpdate(() => {
 -    queuePostFlushCb(setVars)
 -  })
 -
 -  onMounted(() => {
 -    // run setVars synchronously here, but run as post-effect on changes
 -    watch(setVars, NOOP, { flush: 'post' })
 -    const ob = new MutationObserver(setVars)
 -    ob.observe(instance.subTree.el!.parentNode, { childList: true })
 -    onUnmounted(() => ob.disconnect())
 -  })
 +  baseUseCssVars(
-     instance,
++    instance as GenericComponentInstance,
 +    () => instance.subTree.el!.parentNode!,
 +    getVars,
 +    setVars,
 +  )
  }
  
 -function setVarsOnVNode(vnode: VNode, vars: Record<string, unknown>) {
 +function setVarsOnVNode(vnode: VNode, vars: Record<string, string>) {
    if (__FEATURE_SUSPENSE__ && vnode.shapeFlag & ShapeFlags.SUSPENSE) {
      const suspense = vnode.suspense!
      vnode = suspense.activeBranch!
index 4287e54c3f86d8517bd6403593b82317ed9caf5d,784a32172fd288a1e00bfd9a32b6699c9f24d6de..fc3d0524c12265b7972f23d0b34b8909c1ccabbe
@@@ -322,7 -328,53 +328,57 @@@ export { patchStyle } from './modules/s
   * @internal
   */
  export { shouldSetAsProp } from './patchProp'
 +/**
 + * @internal
 + */
 +export { baseUseCssVars, setVarsOnNode } from './helpers/useCssVars'
+ /**
+  * @internal
+  */
+ export {
+   vShowOriginalDisplay,
+   vShowHidden,
+   type VShowElement,
+ } from './directives/vShow'
+ /**
+  * @internal
+  */
+ export {
+   vModelTextInit,
+   vModelTextUpdate,
+   vModelCheckboxInit,
+   vModelCheckboxUpdate,
+   getValue as vModelGetValue,
+   vModelSelectInit,
+   vModelSetSelected,
+ } from './directives/vModel'
+ /**
+  * @internal
+  */
+ export { svgNS } from './nodeOps'
+ /**
+  * @internal
+  */
+ export { xlinkNS } from './modules/attrs'
+ /**
+  * @internal
+  */
+ export {
+   resolveTransitionProps,
+   TransitionPropsValidators,
+   forceReflow,
+   type ElementWithTransition,
+ } from './components/Transition'
+ /**
+  * @internal
+  */
+ export {
+   hasCSSTransform,
+   callPendingCbs,
+   handleMovedChildren,
+   baseApplyTranslation,
+ } from './components/TransitionGroup'
+ /**
+  * @internal
+  */
+ export { unsafeToTrustedHTML } from './nodeOps'
index 8c4bb25d241eda6d666ec3321adeb9ca53337b2e,c20c62490628d35037032f61f65db48ed3696c68..e6d0eacaf2165a98d27fbc244efb95142f82f79d
@@@ -19,9 -36,34 +36,35 @@@ export 
    setProp,
    setDOMProp,
    setDynamicProps,
+   setElementText,
  } from './dom/prop'
- export { on, delegate, delegateEvents, setDynamicEvents } from './dom/event'
+ export {
+   on,
+   delegate,
+   delegateEvents,
+   setDynamicEvents,
+   createInvoker,
+ } from './dom/event'
  export { createIf } from './apiCreateIf'
- export { createFor } from './apiCreateFor'
+ export { createKeyedFragment } from './apiCreateFragment'
+ export {
+   createFor,
+   createForSlots,
+   getRestElement,
+   getDefaultValue,
+ } from './apiCreateFor'
  export { createTemplateRefSetter } from './apiTemplateRef'
 +export { vaporUseCssVars } from './helpers/useCssVars'
+ export { createDynamicComponent } from './apiCreateDynamicComponent'
+ export { applyVShow } from './directives/vShow'
+ export {
+   applyTextModel,
+   applyRadioModel,
+   applyCheckboxModel,
+   applySelectModel,
+   applyDynamicModel,
+ } from './directives/vModel'
+ export { withVaporDirectives } from './directives/custom'
+ export { isFragment, VaporFragment } from './fragment'
+ export { VaporTransition } from './components/Transition'
+ export { VaporTransitionGroup } from './components/TransitionGroup'