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 CompilerSFC StyleProcessor 10 imports 5 dependents 12 functions 3 classes

Entity Profile

Dependency Diagram

graph LR
  ada43310_8d32_ee2a_f18b_1e24fd4f8a1d["ref.ts"]
  abfe3078_bfec_252c_2107_7cdf0dd06f08["reactive.ts"]
  ada43310_8d32_ee2a_f18b_1e24fd4f8a1d --> abfe3078_bfec_252c_2107_7cdf0dd06f08
  998575fc_6104_64df_b366_9135ccd9e5f9["isReactive"]
  ada43310_8d32_ee2a_f18b_1e24fd4f8a1d --> 998575fc_6104_64df_b366_9135ccd9e5f9
  2b181521_4bf2_5868_7efc_af9addf489bf["ReactiveFlags"]
  ada43310_8d32_ee2a_f18b_1e24fd4f8a1d --> 2b181521_4bf2_5868_7efc_af9addf489bf
  faea712d_dcaf_968d_10de_977c7fd1c363["operations.ts"]
  ada43310_8d32_ee2a_f18b_1e24fd4f8a1d --> faea712d_dcaf_968d_10de_977c7fd1c363
  8c6d2de9_125d_2555_5536_17f5a6ef143f["TrackOpTypes"]
  ada43310_8d32_ee2a_f18b_1e24fd4f8a1d --> 8c6d2de9_125d_2555_5536_17f5a6ef143f
  78771365_c90f_e1e6_1222_684a4702382e["TriggerOpTypes"]
  ada43310_8d32_ee2a_f18b_1e24fd4f8a1d --> 78771365_c90f_e1e6_1222_684a4702382e
  44839739_d7ca_1c00_8a38_885896b69e14["index"]
  ada43310_8d32_ee2a_f18b_1e24fd4f8a1d --> 44839739_d7ca_1c00_8a38_885896b69e14
  99130c58_ef0f_0fe0_8e9d_fa77f7eff927["utils"]
  ada43310_8d32_ee2a_f18b_1e24fd4f8a1d --> 99130c58_ef0f_0fe0_8e9d_fa77f7eff927
  249e9921_5d55_45a6_e589_ee123f22bc67["dep"]
  ada43310_8d32_ee2a_f18b_1e24fd4f8a1d --> 249e9921_5d55_45a6_e589_ee123f22bc67
  8a5fb776_a8f4_ce8a_8549_67af07f2e1e9["util"]
  ada43310_8d32_ee2a_f18b_1e24fd4f8a1d --> 8a5fb776_a8f4_ce8a_8549_67af07f2e1e9
  4ad51b1f_61ec_31ba_dbb7_667d6a0a8c85["apiSetup.ts"]
  4ad51b1f_61ec_31ba_dbb7_667d6a0a8c85 --> ada43310_8d32_ee2a_f18b_1e24fd4f8a1d
  38aa88fe_678d_7728_4258_240bdb85b32b["apiWatch.ts"]
  38aa88fe_678d_7728_4258_240bdb85b32b --> ada43310_8d32_ee2a_f18b_1e24fd4f8a1d
  50bb6353_35b0_d08f_72d3_b5e73e75dfee["computed.ts"]
  50bb6353_35b0_d08f_72d3_b5e73e75dfee --> ada43310_8d32_ee2a_f18b_1e24fd4f8a1d
  abfe3078_bfec_252c_2107_7cdf0dd06f08["reactive.ts"]
  abfe3078_bfec_252c_2107_7cdf0dd06f08 --> ada43310_8d32_ee2a_f18b_1e24fd4f8a1d
  0c0a6db0_d081_921f_5fe2_f51407664b15["readonly.ts"]
  0c0a6db0_d081_921f_5fe2_f51407664b15 --> ada43310_8d32_ee2a_f18b_1e24fd4f8a1d
  style ada43310_8d32_ee2a_f18b_1e24fd4f8a1d 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 CompilerSFC domain, StyleProcessor 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: CompilerSFC, subdomain: StyleProcessor, directory: src/v3/reactivity).

Analyze Your Own Codebase

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

Try Supermodel Free