text stringlengths 14 100k | source stringclasses 1
value | repo stringclasses 810
values | language stringclasses 13
values |
|---|---|---|---|
<|fim_suffix|>hild/>`))
expect(serializeInner(root)).toBe(`<div>child</div>`)
})
test('rerender if any parent in the parent chain', () => {
const root = nodeOps.createElement('div')
const parent = 'test-force-props-parent-'
const childId = 'test-force-props-child'
const numberOfParents = 5
... | fim | vuejs/core | typescript |
/**
* @vitest-environment jsdom
*/
import {
type ObjectDirective,
Suspense,
Teleport,
Transition,
type VNode,
createBlock,
createCommentVNode,
createElementBlock,
createElementVNode,
createSSRApp,
createStaticVNode,
createTextVNode,
createVNode,
defineAsyncComponent,
defineComponent,
... | fim | vuejs/core | typescript |
<|fim_suffix|>nce)
expect(r).toBe(instance)
expect(isReactive(r)).toBe(false)
})
})
<|fim_prefix|>import { h, isReactive, nodeOps, reactive, render } from '@vue/runtime-test'
describe('misc', () => {
test('component public instance should not be observable', () => {
let instance: any
const Comp = {... | fim | vuejs/core | typescript |
<|fim_prefix|>/**
* @vitest-environment jsdom
*/
// using DOM renderer because this case is mostly DOM-specific
import {
Fragment,
type FunctionalComponent,
Teleport,
createBlock,
createCommentVNode,
createElementBlock,
createElementVNode,
defineComponent,
h,
mergeProps,
nextTick,
onUpdated,
... | fim | vuejs/core | typescript |
<|fim_suffix|>lm.children.length).toBe(1)
expect(serialize(elm.children[0])).toBe('<div>three</div>')
})
test('reorder elements', () => {
render(
h('div', [h('span', ['one']), h('div', ['two']), h('b', ['three'])]),
root,
)
elm = root.children[0] as TestElement
expect((elm.children ... | fim | vuejs/core | typescript |
<|fim_suffix|>inner = ref(0)
return () => {
return [
h('div', inner.value),
h(Child, {
value: outer.value,
onUpdate: (val: number) => (inner.value = val),
}),
]
}
},
}
const Child = {
props: ['value... | fim | vuejs/core | typescript |
<|fim_suffix|>{ id: 'bar' }, ['foo']), root)
expect(inner(root)).toBe('<div id="bar">foo</div>')
render(h('div', { id: 'baz', class: 'bar' }, ['foo']), root)
expect(inner(root)).toBe('<div id="baz" class="bar">foo</div>')
})
})
<|fim_prefix|>import {
type TestElement,
<|fim_middle|> h,
serializeInne... | fim | vuejs/core | typescript |
<|fim_prefix|>import {
Fragment,
NodeOpTypes,
type TestElement,
TestNodeTypes,
type VNode,
createBlock,
createCommentVNode,
createTextVNode,
createVNode,
dumpOps,
h,
nodeOps,
openBlock,
render,
resetOps,
serializeInner,
} from '@vue/runtime-test'
import { PatchFlags } from '@vue/shared'
... | fim | vuejs/core | typescript |
<|fim_suffix|> createVNode('div', null, [
cache[0] ||
(setBlockTracking(-1, true),
((cache[0] = createVNode('div', null, [
createVNode(Child),
])).cacheIndex = 0),
setBlockTracking(1),
... | fim | vuejs/core | typescript |
<|fim_suffix|>this: any) {
return [
h('p', { ref: refToggle.value ? 'foo' : 'bar' }),
h('i', { ref: refToggle.value ? 'bar' : 'foo' }),
]
},
mounted(this: any) {
spy(this.$refs.foo.tag, this.$refs.bar.tag)
},
updated(this: any) {
spy(this.$refs... | fim | vuejs/core | typescript |
<|fim_suffix|>dTimes(0)
queueJob(job1)
queueJob(job2)
await nextTick()
// should not be called
expect(spy).toHaveBeenCalledTimes(0)
})
it('flushPreFlushCbs inside a pre job', async () => {
const spy = vi.fn()
const job: SchedulerJob = () => {
spy()
flushPreFlushCbs()
}... | fim | vuejs/core | typescript |
<|fim_prefix|>import {
Fragment,
Suspense,
createBlock,
createCommentVNode,
createVNode,
defineComponent,
h,
nextTick,
nodeOps,
openBlock,
popScopeId,
pushScopeId,
ref,
render,
renderSlot,
serializeInner,
withScopeId,
} from '@vue/runtime-test'
import { withCtx } from '../src/component... | fim | vuejs/core | typescript |
<|fim_suffix|> vnode =
(openBlock(),
createBlock('div', null, [
hoist,
(vnode1 = createVNode('div', null, 'text', PatchFlags.TEXT)),
(vnode2 =
(openBlock(),
createBlock('div', null, [
hoist,
(vnode3 = createVNode('div', nu... | fim | vuejs/core | typescript |
<|fim_suffix|>dren[0]).toMatchObject({
type: TestNodeTypes.TEXT,
text: 'bar',
})
}),
onVnodeBeforeUnmount: vi.fn<(vnode: VNode) => void>(),
onVnodeUnmounted: vi.fn<(vnode: VNode) => void>(),
}
assertHooks(hooks, h('div', hooks, 'foo'), h('div', hooks, 'bar'))
})
... | fim | vuejs/core | typescript |
<|fim_suffix|>re('./dist/runtime-core.cjs.js')
}
<|fim_prefix|>'use strict'
if (process.e<|fim_middle|>nv.NODE_ENV === 'production') {
module.exports = require('./dist/runtime-core.cjs.prod.js')
} else {
module.exports = requi<|endoftext|> | fim | vuejs/core | javascript |
<|fim_prefix|>import {
type Component,
type ComponentInternalInstance,
type ComponentOptions,
type ConcreteComponent,
currentInstance,
getComponentName,
isInSSRComponentSetup,
} from './component'
import { isFunction, isObject } from '@vue/shared'
import type { ComponentPublicInstance } from './componentP... | fim | vuejs/core | typescript |
<|fim_prefix|>import { type ComputedRefImpl, computed as _computed } from '@vue/reactivity'
import { getCurrentInstance, isInSSRComponentSetup } from './component'
export const computed: typeof _computed = (
getterOrOptions: any,
debugOptions?: any,
) => {
<|fim_suffix|>g.warnRecursiveComputed) {
;(c as unk... | fim | vuejs/core | typescript |
<|fim_prefix|>import {
type Component,
type ComponentInternalInstance,
type ConcreteComponent,
type Data,
getComponentPublicInstance,
validateComponentName,
} from './component'
import type {
ComponentOptions,
MergedComponentOptions,
RuntimeCompilerOptions,
} from './componentOptions'
import type {
... | fim | vuejs/core | typescript |
import type {
ComponentInjectOptions,
ComponentOptions,
ComponentOptionsBase,
ComponentOptionsMixin,
ComponentProvideOptions,
ComputedOptions,
MethodOptions,
RenderFunction,
} from './componentOptions'
import type {
AllowedComponentProps,
Component,
ComponentCustomProps,
GlobalComponents,
Glob... | fim | vuejs/core | typescript |
<|fim_prefix|>import { isFunction } from '@vue/shared'
import { currentInstance, getCurrentInstance } from './component'
import { currentApp } from './apiCreateApp'
import { warn } from './warning'
interface InjectionConstraint<T> {}
export type InjectionKey<T> = symbol & InjectionConstraint<T>
export function provi... | fim | vuejs/core | typescript |
<|fim_prefix|>import {
type ComponentInternalInstance,
currentInstance,
<|fim_suffix|>k(
LifecycleHooks.BEFORE_UNMOUNT,
)
export const onUnmounted: CreateHook = createHook(LifecycleHooks.UNMOUNTED)
export const onServerPrefetch: CreateHook = createHook(
LifecycleHooks.SERVER_PREFETCH,
)
export type DebuggerHo... | fim | vuejs/core | typescript |
<|fim_prefix|>import {
type IfAny,
type LooseRequired,
type Prettify,
type UnionToIntersection,
extend,
isArray,
isFunction,
isPromise,
} from '@vue/shared'
import {
type SetupContext,
createSetupContext,
getCurrentInstance,
isInSSRComponentSetup,
setCurrentInstance,
setInSSRSetupState,
un... | fim | vuejs/core | typescript |
<|fim_suffix|> source: WatchSource<T>,
cb: WatchCallback<T, MaybeUndefined<T, Immediate>>,
options?: WatchOptions<Immediate>,
): WatchHandle
// overload: reactive array or tuple of multiple sources + cb
export function watch<
T extends Readonly<MultiWatchSources>,
Immediate extends Readonly<boolean> = false,
>... | fim | vuejs/core | typescript |
<|fim_suffix|>alse
}
<|fim_prefix|>import { isOn } from '@vue/shared'
import type { ComponentInternalInstance } from '../component'
import { DeprecationTypes, isCompatEnabled } from './compatConfig'
export function shouldSkipAttr(
key: string,
instance: ComponentInternalInstance,
): boolean {
if (key === 'is') {... | fim | vuejs/core | typescript |
<|fim_suffix|>heck user config
const config = getCompatConfigForKey(key, instance)
if (config === 'suppress-warning') {
return
}
const dupKey = key + args.join('')
let compId: string | number | null =
instance && formatComponentName(instance, instance.type)
if (compId === 'Anonymous' && instance) {... | fim | vuejs/core | typescript |
<|fim_suffix|>ons.render = comp.render
}
// copy over internal properties set by the SFC compiler
comp.options.__file = comp.__file
comp.options.__hmrId = comp.__hmrId
comp.options.__scopeId = comp.__scopeId
comp = comp.options
}
// 2.x async component
if (
isFunction(comp) &&
che... | fim | vuejs/core | typescript |
<|fim_suffix|>dAsyncComponentMap = new WeakMap<
LegacyAsyncComponent,
Component
>()
export function convertLegacyAsyncComponent(
comp: LegacyAsyncComponent,
): Component {
if (normalizedAsyncComponentMap.has(comp)) {
return normalizedAsyncComponentMap.get(comp)!
}
// we have to call the function here ... | fim | vuejs/core | typescript |
import {
type ComponentOptions,
type FunctionalComponent,
getCurrentInstance,
} from '../component'
import { resolveInjections } from '../componentOptions'
import type { InternalSlots } from '../componentSlots'
import { getCompatListeners } from './instanceListeners'
import { compatH } from './renderFn'
const no... | fim | vuejs/core | typescript |
<|fim_prefix|>import { ShapeFlags, extend } from '@vue/shared'
import type { ComponentInternalInstance, ComponentOptions } from '../component'
import { createAppContext } from '../apiCreateApp'
import { ErrorCodes, callWithErrorHandling } from '../errorHandling'
import type { VNode } from '../vnode'
import { popWarning... | fim | vuejs/core | typescript |
<|fim_suffix|>nce,
mappedName,
name,
)
}
return dir[mappedName]
}
}
}
<|fim_prefix|>import { isArray } from '@vue/shared'
import type { ComponentInternalInstance } from '../component'
import type { DirectiveHook, ObjectDirective } from '../directives'
import { DeprecationTy... | fim | vuejs/core | typescript |
<|fim_prefix|>import { isPlainObject } from<|fim_suffix|>ainObject(toVal) && isPlainObject(fromVal)) {
__DEV__ && warnDeprecation(DeprecationTypes.OPTIONS_DATA_MERGE, null, key)
deepMergeData(toVal, fromVal)
} else {
to[key] = fromVal
}
}
return to
}
<|fim_middle|> '@vue/shared'
import { D... | fim | vuejs/core | typescript |
<|fim_suffix|> = createComponentInstance(vnode, null, null)
// suppress "missing render fn" warning since it can't be determined
// until $mount is called
if (hasNoRender) {
instance.render = emptyRender
}
setupComponent(instance)
vnode.component = instance
vnode.isCompatRoot = true
... | fim | vuejs/core | typescript |
<|fim_suffix|> val
},
set(newVal) {
if (!isCopyingConfig) {
warnDeprecation(legacyConfigOptions[key], null)
}
val = newVal
},
})
})
}
export function installLegacyOptionMergeStrats(config: AppConfig): void {
config.optionMergeStrategies = new Proxy({} as any,... | fim | vuejs/core | typescript |
<|fim_prefix|>import {
NOOP,
extend,
looseEqual,
looseIndexOf,
looseToNumber,
toDisplayString,
} from '@vue/shared'
import type {
ComponentPublicInstance,
PublicPropertiesMap,
} from '../componentPublicInstance'
import { getCompatChildren } from './instanceChildren'
import {
DeprecationTypes,
assert... | fim | vuejs/core | typescript |
<|fim_suffix|>es.INSTANCE_CHILDREN, instance)
const root = instance.subTree
const children: ComponentPublicInstance[] = []
if (root) {
walk(root, children)
}
return children
}
function walk(vnode: VNode, children: ComponentPublicInstance[]) {
if (vnode.component) {
children.push(vnode.component.pro... | fim | vuejs/core | typescript |
<|fim_suffix|>bind(instance.proxy)),
instance,
ErrorCodes.COMPONENT_EVENT_HANDLER,
args,
)
}
return instance.proxy
}
<|fim_prefix|>import { isArray } from '@vue/shared'
import type { ComponentInternalInstance } from '../component'
import { ErrorCodes, callWithAsyncErrorHandling } from '../erro... | fim | vuejs/core | typescript |
<|fim_prefix|>import { isOn } from '@vue/shared'
<|fim_suffix|>omponentInternalInstance,
): Record<string, Function | Function[]> {
assertCompatEnabled(DeprecationTypes.INSTANCE_LISTENERS, instance)
const listeners: Record<string, Function | Function[]> = {}
const rawProps = instance.vnode.props
if (!rawProps)... | fim | vuejs/core | typescript |
<|fim_prefix|>import { isArray } from '@vue/shared'
import { inject } from '../apiInject'
import type { ComponentInternalInstance, Data } from '../component'
import {
type ComponentOptions,
resolveMergedOptions,
} from '../componentOptions'
import { DeprecationTypes, warnDeprecation } from './compatConfig'
export ... | fim | vuejs/core | typescript |
<|fim_prefix|>import {
ShapeFlags,
extend,
hyphenate,
isArray,
isObject,
isString,
makeMap,
normalizeClass,
normalizeStyle,
toHandlerKey,
} from '@vue/shared'
import type {
Component,
ComponentInternalInstance,
ComponentOptions,
Data,
I<|fim_suffix|>type: string | Component,
props?: Data... | fim | vuejs/core | typescript |
<|fim_suffix|>dSlotsData = Array<
| {
key: string
fn: Function
}
| LegacyScopedSlotsData
>
export function legacyResolveScopedSlots(
fns: LegacyScopedSlotsData,
raw?: Record<string, Slot>,
// the following are added in 2.6
hasDynamicKeys?: boolean,
): ReturnType<typeof createSlots> {
// v... | fim | vuejs/core | typescript |
<|fim_suffix|>ithProxy: ComponentPublicInstance | null
/**
* This is the target for the public instance proxy. It also holds properties
* injected by user options (computed, methods etc.) and user-attached
* custom properties (via `this.x = ...`)
* @internal
*/
ctx: Data
// state
data: Data
pr... | fim | vuejs/core | typescript |
<|fim_prefix|>import {
EMPTY_OBJ,
type OverloadParameters,
type UnionToIntersection,
camelize,
extend,
hasOwn,
hyphenate,
isArray,
isFunction,
isObject,
isOn,
isString,
looseToNumber,
toHandlerKey,
} from '@vue/shared'
import {
type ComponentInternalInstance,
type ComponentOptions,
typ... | fim | vuejs/core | typescript |
<|fim_prefix|>import {
type Component,
type ComponentInternalInstance,
type ComponentInternalOptions,
type ConcreteComponent,
type Data,
type InternalRenderFunction,
type SetupContext,
currentInstance,
} from './component'
import {
type LooseRequired,
NOOP,
type Prettify,
extend,
isArray,
is... | fim | vuejs/core | typescript |
<|fim_suffix|>props)) {
warn('Invalid prop: custom validator check failed for prop "' + name + '".')
}
}
const isSimpleType = /*@__PURE__*/ makeMap(
'String,Number,Boolean,Function,Symbol,BigInt',
)
type AssertionResult = {
valid: boolean
expectedType: string
}
/**
* dev only
*/
function assertType(
... | fim | vuejs/core | typescript |
import {
type Attrs,
type Component,
type ComponentInternalInstance,
type Data,
getComponentPublicInstance,
isStatefulComponent,
} from './component'
import { nextTick, queueJob } from './scheduler'
import {
type OnCleanup,
type WatchOptions,
type WatchStopHandle,
instanceWatch,
} from './apiWatch'
... | fim | vuejs/core | typescript |
<|fim_suffix|> only flag to distinguish scoped slots from non-scoped ones
if (__COMPAT__ && isNonScopedSlot) {
renderFnWithContext._ns = true
}
return renderFnWithContext
}
<|fim_prefix|>import type { ComponentInternalInstance } from './component'
import { devtoolsComponentUpdated } from './devtools'
import {... | fim | vuejs/core | typescript |
<|fim_prefix|>import {
type ComponentInternalInstance,
type Data,
type FunctionalComponent,
getComponentName,
} from './component'
import {
Comment,
type VNode,
type VNodeArrayChildren,
blockStack,
cloneVNode,
createVNode,
isVNode,
normalizeVNode,
} from './vnode'
import { ErrorCodes, handleErro... | fim | vuejs/core | typescript |
<|fim_prefix|>import { type ComponentInternalInstance, currentInstance } from './component'
import {
type VNode,
type VNodeChild,
type VNodeNormalizedChildren,
normalizeVNode,
} from './vnode'
import {
EMPTY_OBJ,
type IfAny,
type Prettify,
ShapeFlags,
SlotFlags,
def,
isArray,
isFunction,
} from ... | fim | vuejs/core | typescript |
<|fim_suffix|>nter
let cancelHook = onEnterCancelled
if (!state.isMounted) {
if (appear) {
hook = onAppear || onEnter
afterHook = onAfterAppear || onAfterEnter
cancelHook = onAppearCancelled || onEnterCancelled
} else {
return
}
}
l... | fim | vuejs/core | typescript |
<|fim_prefix|>import {
type ComponentInternalInstance,
type ComponentOptions,
type ConcreteComponent,
type SetupContext,
currentInstance,
getComponentName,
getCurrentInstance,
} from '../component'
import {
Comment,
type VNode,
type VNodeProps,
cloneVNode,
invokeVNodeHook,
isSameVNodeType,
i... | fim | vuejs/core | typescript |
<|fim_prefix|>import {
Comment,
type VNode,
type VNodeProps,
closeBlock,
createVNode,
currentBlock,
isBlockTreeEnabled,
isSameVNodeType,
normalizeVNode,
openBlock,
} from '../vnode'
import { ShapeFlags, isArray, isFunction, toNumber } from '@vue/shared'
import {
type ComponentInternalInstance,
h... | fim | vuejs/core | typescript |
<|fim_prefix|>import type { ComponentInternalInstance } from '../component'
import type { SuspenseBoundary } from './Suspense'
import {
type ElementNamespace,
MoveType,
type RendererElement,
type RendererInternals,
type RendererNode,
type RendererOptions,
queuePostRenderEffect,
traverseStaticChildren,
}... | fim | vuejs/core | typescript |
<|fim_suffix|>$),
]
}
},
}
function formatInstance(instance: ComponentInternalInstance) {
const blocks = []
if (instance.type.props && instance.props) {
blocks.push(createInstanceBlock('props', toRaw(instance.props)))
}
if (instance.setupState !== EMPTY_OBJ) {
blocks.p... | fim | vuejs/core | typescript |
<|fim_suffix|>VTOOLS_HOOK_REPLAY__ = null
devtoolsNotInstalled = true
buffer = []
}
}, 3000)
} else {
// non-browser env, assume not installed
devtoolsNotInstalled = true
buffer = []
}
}
export function devtoolsInitApp(app: App, version: string): void {
emit(DevtoolsHooks.AP... | fim | vuejs/core | typescript |
<|fim_prefix|>/**
Runtime helper for applying directives to a vnode. Example usage:
const comp = resolveComponent('comp')
const foo = resolveDirective('foo')
const bar = resolveDirective('bar')
return withDirectives(h(comp), [
[foo, this.x]<|fim_suffix|>Record<string, any> | null
value: Value
oldValue: Value | ... | fim | vuejs/core | typescript |
<|fim_prefix|>export enum LifecycleHooks {
BEFORE_CREATE = 'bc',
CREATED = 'c',
BEFORE_MOUNT = 'bm',
MOUNTED = 'm',
BEFORE_UPDATE = 'bu',
UPDATED = 'u',
BEFORE_UNMOUNT = <|fim_suffix|> UNMOUNTED = 'um',
DEACTIVATED = 'da',
ACTIVATED = 'a',
RENDER_TRIGGERED = 'rtg',
RENDER_TRACKED = 'rtc',
ERROR... | fim | vuejs/core | typescript |
<|fim_prefix|>import { pauseTracking, resetTracking } from '@vue/reactivity'
import type { VNode } from './vnode'
import type { ComponentInternalInstance } from './component'
import { popWarningContext, pushWarningContext, warn } from './warning'
import { EMPTY_OBJ, isArray, isFunction, isPromise } from '@vue/shared'
i... | fim | vuejs/core | typescript |
<|fim_suffix|>ATCH_DETAILS__ !== 'boolean') {
__DEV__ && needWarn.push(`__VUE_PROD_HYDRATION_MISMATCH_DETAILS__`)
getGlobalThis().__VUE_PROD_HYDRATION_MISMATCH_DETAILS__ = false
}
if (__DEV__ && needWarn.length) {
const multi = needWarn.length > 1
console.warn(
`Feature flag${multi ? `s` : ``... | fim | vuejs/core | typescript |
<|fim_prefix|>import {
type Comment,
type Fragment,
type Text,
type VNode,
type VNodeArrayChildren,
type VNodeProps,
createVNode,
isVNode,
setBlockTracking,
} from './vnode'
import type { Teleport, TeleportProps } from './components/Teleport'
import type { Suspense, SuspenseProps } from './components/... | fim | vuejs/core | typescript |
<|fim_suffix|>+) {
slots[slot[j].name] = slot[j].fn
}
} else if (slot) {
// conditional single slot generated by <template v-if="..." #foo>
slots[slot.name] = slot.key
? (...args: any[]) => {
const res = slot.fn(...args)
// attach branch key so each conditio... | fim | vuejs/core | typescript |
<|fim_prefix|>import type { VNode, VNodeChild } from '../vnode'
import {
isReactive,
isReadonly,
isShallow,
shallowReadArray,
toReactive,
toReadonly,
} from '@vue/reactivity'
import { isArray, isObject, isString } from '@vue/shared'
import { warn } from '../warning'
/**
* v-for string
* @private
*/
expo... | fim | vuejs/core | typescript |
<|fim_prefix|>import type { Data } from '../component'
import type { RawSlots, Slots } from '../componentSlots'
import {
type ContextualRenderFn,
currentRenderingInstance,
} from '../componentRenderContext'
import {
Comment,
Fragment,
type VNode,
type VNodeArrayChildren,
createBlock,
createVNode,
isVN... | fim | vuejs/core | typescript |
import {
type ComponentOptions,
type ConcreteComponent,
currentInstance,
getComponentName,
} from '../component'
import { currentRenderingInstance } from '../componentRenderContext'
import type { Directive } from '../directives'
import { camelize, capitalize, isString } from '@vue/shared'
import { warn } from '... | fim | vuejs/core | typescript |
<|fim_suffix|>ey)
? `on:${key}`
: toHandlerKey(key)
] = obj[key]
}
return ret
}
<|fim_prefix|>import { isObject, toHandlerKey } from '@vue/shared'
import { warn } from '../warning'
/**
* For prefixing keys in v-on="obj" with "on"
* @private
*/
export function toHandlers(
obj: Record<string... | fim | vuejs/core | typescript |
<|fim_prefix|>import {
type ComponentInternalInstance,
getCurrentInstance,
} from '../component'
import { warn } from '../warning'
export function useId(): string {
const i = getCurrentInstance()
if (i) {
return (i.appContext.config.idPrefix || 'v') + '-' + i.ids[0] + i.ids[1]++
} else if (__DEV__) {
<|... | fim | vuejs/core | typescript |
<|fim_suffix|>edValue
},
}
})
// @ts-expect-error
res[Symbol.iterator] = () => {
let i = 0
return {
next() {
if (i < 2) {
return { value: i++ ? modifiers || EMPTY_OBJ : res, done: false }
} else {
return { done: true }
}
},
}
}
re... | fim | vuejs/core | typescript |
<|fim_prefix|>import { inject } from '../apiInject'
<|fim_suffix|> conditionally in the server build.`,
)
}
return ctx
} else if (__DEV__) {
warn(`useSSRContext() is not supported in the global build.`)
}
}
<|fim_middle|>import { warn } from '../warning'
export const ssrContextKey: unique symbo... | fim | vuejs/core | typescript |
<|fim_prefix|>import { type ShallowRef, readonly, shallowRef } from '@vue/reactivity'
import { type Data, getCurrentInstance } from '../component'
import { warn } from '../warning'
import { EMPTY_OBJ } from '@vue/shared'
export const knownTemplateRefs: WeakSet<ShallowRef> = new WeakSet()
export type TemplateRef<T = u... | fim | vuejs/core | typescript |
import { hasChanged } from '@vue/shared'
import { type VNode, currentBlock, isBlockTreeEnabled } from '../vnode'
export function withMemo(
memo: any[],
render: () => VNode<any, any>,
cache: any[],
index: number,
): VNode<any, any> {
const cached = cache[index] as VNode | undefined
if (cached && isMemoSame(... | fim | vuejs/core | typescript |
<|fim_suffix|>onents.clear()
})
}
function updateComponentDef(
oldComp: ComponentOptions,
newComp: ComponentOptions,
) {
extend(oldComp, newComp)
for (const key in oldComp) {
if (key !== '__file' && !(key in newComp)) {
delete oldComp[key]
}
}
}
function tryWrap(fn: (id: string, arg: any) =>... | fim | vuejs/core | typescript |
<|fim_suffix|>ueParentComponent', parentComponent, true)
}
if (patchFlag === PatchFlags.BAIL) {
optimized = false
vnode.dynamicChildren = null
}
let nextNode: Node | null = null
switch (type) {
case Text:
if (domType !== DOMNodeTypes.TEXT) {
// #5728 empty text ... | fim | vuejs/core | typescript |
<|fim_suffix|>yFactory<Options> = (
options?: Options,
) => HydrationStrategy
export const hydrateOnIdle: HydrationStrategyFactory<number> =
(timeout = 10000) =>
hydrate => {
const id = requestIdleCallback(hydrate, { timeout })
return () => cancelIdleCallback(id)
}
function elementIsVisibleInViewport(... | fim | vuejs/core | typescript |
<|fim_suffix|>er-renderer. Only exposed in ssr-possible builds.
* @internal
*/
export const ssrUtils = (__SSR__ ? _ssrUtils : null) as typeof _ssrUtils
// 2.x COMPAT ------------------------------------------------------------------
import { DeprecationTypes as _DeprecationTypes } from './compat/compatConfig'
expor... | fim | vuejs/core | typescript |
<|fim_suffix|> than defining a
* non-enumerable property. (one of the optimizations done for ssr-benchmark)
*/
const internalObjectProto = {}
export const createInternalObject = (): any =>
Object.create(internalObjectProto)
export const isInternalObject = (obj: object): boolean =>
Object.getPrototypeOf(obj) ===... | fim | vuejs/core | typescript |
<|fim_prefix|>/* eslint-disable no-restricted-globals */
import {
type ComponentInternalInstance,
formatComponentName,
} from './component'
import { devtoolsPerfEnd, devtoolsPerfStart } from './devtools'
let supported: boolean
let perf: Performance
export function startMeasure(
instance: ComponentInternalInstan... | fim | vuejs/core | typescript |
<|fim_prefix|>import {
Comment,
Fragment,
Static,
Text,
type VNode,
type VNodeArrayChildren,
type VNodeHook,
type VNodeProps,
cloneIfMounted,
createVNode,
invokeVNodeHook,
isSameVNodeType,
normalizeVNode,
} from './vnode'
import {
type ComponentInternalInstance,
type ComponentOptions,
ty... | fim | vuejs/core | typescript |
<|fim_suffix|> done because the template ref
// is forwarded to inner component
return
}
const refValue =
vnode.shapeFlag & ShapeFlags.STATEFUL_COMPONENT
? getComponentPublicInstance(vnode.component!)
: vnode.el
const value = isUnmount ? null : refValue
const { i: owner, r: ref } = raw... | fim | vuejs/core | typescript |
<|fim_prefix|>import { ErrorCodes, callWithErrorHandling, handleError } from './errorHandling'
import { NOOP, isArray } from '@vue/shared'
import { type ComponentInternalInstance, getComponentName } from './component'
export enum SchedulerJobFlags {
QUEUED = 1 << 0,
PRE = 1 << 1,
/**
* Indicates whether the e... | fim | vuejs/core | typescript |
import {
EMPTY_ARR,
PatchFlags,
ShapeFlags,
SlotFlags,
extend,
isArray,
isFunction,
isModelListener,
isObject,
isOn,
isString,
normalizeClass,
normalizeStyle,
} from '@vue/shared'
import {
type ClassComponent,
type Component,
type ComponentInternalInstance,
type ConcreteComponent,
ty... | fim | vuejs/core | typescript |
<|fim_prefix|>import type { VNode } from './vnode'
import {
type ComponentInternalInstance,
type ConcreteComponent,
type Data,
formatComponentName,
} from './component'
import { isFunction, isString } from '@vue/shared'
import { isRef, pauseTracking, resetTracking, toRaw } from '@vue/reactivity'
import { ErrorC... | fim | vuejs/core | typescript |
// Note: this file is auto concatenated to the end of the bundled d.ts during
// build.
declare module '@vue/runtime-core' {
export interface GlobalComponents {
Teleport: DefineComponent<TeleportProps>
Suspense: DefineComponent<SuspenseProps>
KeepAlive: DefineComponent<KeepAliveProps>
BaseTransition:... | fim | vuejs/core | typescript |
<|fim_prefix|>// Note: this file is auto concatenated to the end of the bundled d.ts during
// build.
type _defineProps = typeof defineProps
type _defineEmits = typeof defineEmits
type _defineExpose = typeof defineExpose
type _defineOpt<|fim_suffix|>clare global {
const defineProps: _defineProps
const defineEmits: ... | fim | vuejs/core | typescript |
<|fim_suffix|>ot mutate original root component options object', () => {
const originalObj = {
data() {
return {
counter: 0,
}
},
}
const handler = vi.fn(msg => {
expect(msg).toMatch(`Component is missing template or render function`)
})
const Root = { .... | fim | vuejs/core | typescript |
<|fim_suffix|> h('div', null, [
renderSlot(this.$slots, 'default', undefined, () => [
h('div', 'fallback'),
]),
]),
h('div', null, renderSlot(this.$slots, 'named')),
]
},
})
}),
... | fim | vuejs/core | typescript |
<|fim_suffix|>utton' },
])
// should also render the attribute
expect(root.innerHTML).toBe(`<button is="plastic-button"></button>`)
})
})
<|fim_prefix|>import type { MockInstance } from 'vitest'
import { h, render } from '@vue/runtime-dom'
describe('customized built-in elements support', () => {
let cr... | fim | vuejs/core | typescript |
<|fim_prefix|>import { createApp } from '@vue/runtime-dom'
describe('vCloak', () => {
test('should be removed after compile', () => {
const root = doc<|fim_suffix|>loak')).toBe(false)
})
})
<|fim_middle|>ument.createElement('div')
root.setAttribute('v-cloak', '')
createApp({
render() {},
}).m... | fim | vuejs/core | typescript |
<|fim_suffix|>false)
expect(bar.checked).toEqual(true)
})
it('should work with radio', async () => {
const component = defineComponent({
data() {
return { value: null }
},
render() {
return [
withVModel(
h('input', {
type: 'radio',
... | fim | vuejs/core | typescript |
<|fim_suffix|> expect(fn).toBeCalledWith(event, 'value', true)
})
it('withKeys cache wrapped listener separately for different modifiers', () => {
const el1 = document.createElement('button')
const el2 = document.createElement('button')
const fn = vi.fn()
const handler1 = withKeys(fn, ['a'])
... | fim | vuejs/core | typescript |
<|fim_suffix|>isplay).toEqual('none')
isVisible.value = true
await nextTick()
expect($div.style.display).toEqual('')
})
})
<|fim_prefix|>import {
type VNode,
defineComponent,
h,
nextTick,
ref,
watch,
withDirectives,
} from '@vue/runtime-core'
import { Transition, render, vShow } from '@vue/... | fim | vuejs/core | typescript |
<|fim_prefix|>import { h, nodeOps, render } from '@vue/runtime-test'
import { useCssModule } from '../../src/helpers/useCssModule'
describe('useCssModule', () => {
function mountWithModule(modules: any, name?: string) {
let res
render(
h({
render() {},
__cssModules: modules,
set... | fim | vuejs/core | typescript |
<|fim_prefix|>import {
type ComponentOptions,
type FunctionalComponent,
Suspense,
Teleport,
createStaticVNode,
defineCustomElement,
h,
nextTick,
onMounted,
reactive,
ref,
render,
useCssVars,
} from '@vue/runtime-dom'
describe('useCssVars', () => {
async function assertCssVars(getApp: (state... | fim | vuejs/core | typescript |
<|fim_prefix|>import { defineComponent, h, nextTick, ref } from 'vue'
import { mathmlNS, nodeOps, svgNS } from '../src/nodeOps'
import { render } from '@vue/runtime-dom'
describe('runtime-dom: node-ops', () => {
test("the <select>'s multiple attr should be set in createElement", () => {
const el = nodeOps.createE... | fim | vuejs/core | typescript |
<|fim_suffix|>adonly')).toBe(null)
patchProp(el, 'readonly', false, 1)
expect(el.getAttribute('readonly')).toBe('')
patchProp(el, 'readonly', 1, undefined)
expect(el.getAttribute('readonly')).toBe(null)
})
test('attributes', () => {
const el = document.createElement('div')
patchProp(el, 'fo... | fim | vuejs/core | typescript |
<|fim_prefix|>import { patchProp } from '../src/patchProp'
import {
type ElementWithTransition,
vtcKey,
} from '../src/components/Transition'
import { svgNS } from '../src/nodeOps'
describe('runtime-dom: class patching', () => {
test('basics', () => {
const el = document.createElement('div')
patchProp(el... | fim | vuejs/core | typescript |
<|fim_prefix|>import { patchProp } from '../src/patchProp'
const timeout = () => new Promise(r => setTimeout(r))
describe(`runtime-dom: events patching`, () => {
it('should assign event handler', async () => {
const el = document.createElement('div')
const fn = vi.fn()
patchProp(el, 'onClick', null, fn)... | fim | vuejs/core | typescript |
<|fim_suffix|> setup() {
const checked = ref()
return () =>
withDirectives(
h('input', {
type: 'checkbox',
value: undefined,
'onUpdate:modelValue': (value: any) => {
checked.value = value
},
}),
... | fim | vuejs/core | typescript |
import { patchProp } from '../src/patchProp'
describe(`runtime-dom: style patching`, () => {
it('string', () => {
const el = document.createElement('div')
patchProp(el, 'style', {}, 'color:red')
expect(el.style.cssText.replace(/\s/g, '')).toBe('color:red;')
})
// #1309
it('should not patch same st... | fim | vuejs/core | typescript |
<|fim_prefix|>import { createStaticVNode, h, render } from '../src'
describe('static vnode handling', () => {
const content = `<div>hello</div><p>world</p>`
const content2 = `<p>foo</p><div>bar</div><span>baz</span>`
const s = createStaticVNode(content, 2)
const s2 = createStaticVNode(content2, 3)
test('sh... | fim | vuejs/core | typescript |
<|fim_suffix|>')
}
<|fim_prefix|>'use strict'
if (process.env.NODE_ENV === 'production') {
module.exports = require('./dist/runtime-dom.cjs.prod.js')
} else {
module.exports = require<|fim_middle|>('./dist/runtime-dom.cjs.js<|endoftext|> | fim | vuejs/core | javascript |
import {
type App,
type Component,
type ComponentCustomElementInterface,
type ComponentInjectOptions,
type ComponentInternalInstance,
type ComponentObjectPropsOptions,
type ComponentOptions,
type ComponentOptionsBase,
type ComponentOptionsMixin,
type ComponentProvideOptions,
type ComponentPublicIn... | fim | vuejs/core | typescript |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.