Home / File/ ref.ts — vue Source File

ref.ts — vue Source File

Architecture documentation for ref.ts, a typescript file in the vue codebase. 10 imports, 5 dependents.

File typescript VueCore VDom 10 imports 5 dependents 12 functions 3 classes

Entity Profile

Dependency Diagram

graph LR
  22b44e72_ad0a_6a98_e36a_e325291fd02b["ref.ts"]
  e84ea476_9f30_e7b9_aaa0_4026f0c97365["reactive.ts"]
  22b44e72_ad0a_6a98_e36a_e325291fd02b --> e84ea476_9f30_e7b9_aaa0_4026f0c97365
  cfa7ea60_e211_687f_9deb_b342e671fcc2["isReactive"]
  22b44e72_ad0a_6a98_e36a_e325291fd02b --> cfa7ea60_e211_687f_9deb_b342e671fcc2
  02125244_44e5_bcdb_5575_964348bb90d8["ReactiveFlags"]
  22b44e72_ad0a_6a98_e36a_e325291fd02b --> 02125244_44e5_bcdb_5575_964348bb90d8
  7cfaddc3_c5e5_7577_20e9_59bc8caeee91["operations.ts"]
  22b44e72_ad0a_6a98_e36a_e325291fd02b --> 7cfaddc3_c5e5_7577_20e9_59bc8caeee91
  7fd1b3c3_dd3b_c683_10c8_49d1fa005cd2["TrackOpTypes"]
  22b44e72_ad0a_6a98_e36a_e325291fd02b --> 7fd1b3c3_dd3b_c683_10c8_49d1fa005cd2
  cba0714c_aab0_c9ef_7b66_7697f9f6114b["TriggerOpTypes"]
  22b44e72_ad0a_6a98_e36a_e325291fd02b --> cba0714c_aab0_c9ef_7b66_7697f9f6114b
  3897e8b5_9242_b5d7_bf5f_783d40cceb59["index"]
  22b44e72_ad0a_6a98_e36a_e325291fd02b --> 3897e8b5_9242_b5d7_bf5f_783d40cceb59
  301a10c7_6e13_1045_e021_e9f1e2c82389["utils"]
  22b44e72_ad0a_6a98_e36a_e325291fd02b --> 301a10c7_6e13_1045_e021_e9f1e2c82389
  33c70915_1726_ee82_246e_a7d09e56426a["dep"]
  22b44e72_ad0a_6a98_e36a_e325291fd02b --> 33c70915_1726_ee82_246e_a7d09e56426a
  6d8f8976_7066_720b_0d45_45fe42921eaf["util"]
  22b44e72_ad0a_6a98_e36a_e325291fd02b --> 6d8f8976_7066_720b_0d45_45fe42921eaf
  3a7c7919_1905_22a7_f604_9084d5e5d0df["apiSetup.ts"]
  3a7c7919_1905_22a7_f604_9084d5e5d0df --> 22b44e72_ad0a_6a98_e36a_e325291fd02b
  e5380f01_49bc_d965_1141_151fb5c6c097["apiWatch.ts"]
  e5380f01_49bc_d965_1141_151fb5c6c097 --> 22b44e72_ad0a_6a98_e36a_e325291fd02b
  49a97e06_4034_4e1d_a0e8_bb7368ceb3af["computed.ts"]
  49a97e06_4034_4e1d_a0e8_bb7368ceb3af --> 22b44e72_ad0a_6a98_e36a_e325291fd02b
  e84ea476_9f30_e7b9_aaa0_4026f0c97365["reactive.ts"]
  e84ea476_9f30_e7b9_aaa0_4026f0c97365 --> 22b44e72_ad0a_6a98_e36a_e325291fd02b
  8420591a_8fdc_59a9_134d_e2c52487724c["readonly.ts"]
  8420591a_8fdc_59a9_134d_e2c52487724c --> 22b44e72_ad0a_6a98_e36a_e325291fd02b
  style 22b44e72_ad0a_6a98_e36a_e325291fd02b fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

import { defineReactive } from 'core/observer/index'
import {
  isReactive,
  ReactiveFlags,
  type ShallowReactiveMarker
} from './reactive'
import type { IfAny } from 'types/utils'
import Dep from 'core/observer/dep'
import { warn, isArray, def, isServerRendering } from 'core/util'
import { TrackOpTypes, TriggerOpTypes } from './operations'

declare const RefSymbol: unique symbol
export declare const RawSymbol: unique symbol

/**
 * @internal
 */
export const RefFlag = `__v_isRef`

export interface Ref<T = any> {
  value: T
  /**
   * Type differentiator only.
   * We need this to be in public d.ts but don't want it to show up in IDE
   * autocomplete, so we use a private Symbol instead.
   */
  [RefSymbol]: true
  /**
   * @internal
   */
  dep?: Dep
  /**
   * @internal
   */
  [RefFlag]: true
}

export function isRef<T>(r: Ref<T> | unknown): r is Ref<T>
export function isRef(r: any): r is Ref {
  return !!(r && (r as Ref).__v_isRef === true)
}

export function ref<T extends Ref>(value: T): T
export function ref<T>(value: T): Ref<UnwrapRef<T>>
export function ref<T = any>(): Ref<T | undefined>
export function ref(value?: unknown) {
  return createRef(value, false)
}

declare const ShallowRefMarker: unique symbol

export type ShallowRef<T = any> = Ref<T> & { [ShallowRefMarker]?: true }

export function shallowRef<T>(value: T | Ref<T>): Ref<T> | ShallowRef<T>
export function shallowRef<T extends Ref>(value: T): T
export function shallowRef<T>(value: T): ShallowRef<T>
export function shallowRef<T = any>(): ShallowRef<T | undefined>
export function shallowRef(value?: unknown) {
  return createRef(value, true)
}
// ... (234 more lines)

Domain

Subdomains

Frequently Asked Questions

What does ref.ts do?
ref.ts is a source file in the vue codebase, written in typescript. It belongs to the VueCore domain, VDom subdomain.
What functions are defined in ref.ts?
ref.ts defines 12 function(s): createRef, customRef, isRef, proxyRefs, proxyWithRefUnwrap, ref, shallowRef, toRef, toRefs, track, and 2 more.
What does ref.ts depend on?
ref.ts imports 10 module(s): ReactiveFlags, TrackOpTypes, TriggerOpTypes, dep, index, isReactive, operations.ts, reactive.ts, and 2 more.
What files import ref.ts?
ref.ts is imported by 5 file(s): apiSetup.ts, apiWatch.ts, computed.ts, reactive.ts, readonly.ts.
Where is ref.ts in the architecture?
ref.ts is located at src/v3/reactivity/ref.ts (domain: VueCore, subdomain: VDom, directory: src/v3/reactivity).

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free