How to use isEmitListener method in Playwright Internal

Best JavaScript code snippet using playwright-internal

vue3.js

Source:vue3.js Github

copy

Full Screen

...1827 }1828 // Check if an incoming prop key is a declared emit event listener.1829 // e.g. With `emits: { click: null }`, props named `onClick` and `onclick` are1830 // both considered matched listeners.1831 function isEmitListener(options, key) {1832 if (!options || !isOn(key)) {1833 return false;1834 }1835 key = key.replace(/Once$/, '');1836 return (hasOwn(options, key[2].toLowerCase() + key.slice(3)) ||1837 hasOwn(options, key.slice(2)));1838 }1839 // mark the current rendering instance for asset resolution (e.g.1840 // resolveComponent, resolveDirective) during render1841 let currentRenderingInstance = null;1842 function setCurrentRenderingInstance(instance) {1843 currentRenderingInstance = instance;1844 }1845 // dev only flag to track whether $attrs was used during render.1846 // If $attrs was used during render then the warning for failed attrs1847 // fallthrough can be suppressed.1848 let accessedAttrs = false;1849 function markAttrsAccessed() {1850 accessedAttrs = true;1851 }1852 function renderComponentRoot(instance) {1853 const { type: Component, vnode, proxy, withProxy, props, propsOptions: [propsOptions], slots, attrs, emit, render, renderCache, data, setupState, ctx } = instance;1854 let result;1855 currentRenderingInstance = instance;1856 {1857 accessedAttrs = false;1858 }1859 try {1860 let fallthroughAttrs;1861 if (vnode.shapeFlag & 4 /* STATEFUL_COMPONENT */) {1862 // withProxy is a proxy with a different `has` trap only for1863 // runtime-compiled render functions using `with` block.1864 const proxyToUse = withProxy || proxy;1865 result = normalizeVNode(render.call(proxyToUse, proxyToUse, renderCache, props, setupState, data, ctx));1866 fallthroughAttrs = attrs;1867 }1868 else {1869 // functional1870 const render = Component;1871 // in dev, mark attrs accessed if optional props (attrs === props)1872 if (true && attrs === props) {1873 markAttrsAccessed();1874 }1875 result = normalizeVNode(render.length > 11876 ? render(props, true1877 ? {1878 get attrs() {1879 markAttrsAccessed();1880 return attrs;1881 },1882 slots,1883 emit1884 }1885 : { attrs, slots, emit })1886 : render(props, null /* we know it doesn't need it */));1887 fallthroughAttrs = Component.props1888 ? attrs1889 : getFunctionalFallthrough(attrs);1890 }1891 // attr merging1892 // in dev mode, comments are preserved, and it's possible for a template1893 // to have comments along side the root element which makes it a fragment1894 let root = result;1895 let setRoot = undefined;1896 if (true) {1897 ;1898 [root, setRoot] = getChildRoot(result);1899 }1900 if (Component.inheritAttrs !== false && fallthroughAttrs) {1901 const keys = Object.keys(fallthroughAttrs);1902 const { shapeFlag } = root;1903 if (keys.length) {1904 if (shapeFlag & 1 /* ELEMENT */ ||1905 shapeFlag & 6 /* COMPONENT */) {1906 if (propsOptions && keys.some(isModelListener)) {1907 // If a v-model listener (onUpdate:xxx) has a corresponding declared1908 // prop, it indicates this component expects to handle v-model and1909 // it should not fallthrough.1910 // related: #1543, #1643, #19891911 fallthroughAttrs = filterModelListeners(fallthroughAttrs, propsOptions);1912 }1913 root = cloneVNode(root, fallthroughAttrs);1914 }1915 else if (true && !accessedAttrs && root.type !== Comment) {1916 const allAttrs = Object.keys(attrs);1917 const eventAttrs = [];1918 const extraAttrs = [];1919 for (let i = 0, l = allAttrs.length; i < l; i++) {1920 const key = allAttrs[i];1921 if (isOn(key)) {1922 // ignore v-model handlers when they fail to fallthrough1923 if (!isModelListener(key)) {1924 // remove `on`, lowercase first letter to reflect event casing1925 // accurately1926 eventAttrs.push(key[2].toLowerCase() + key.slice(3));1927 }1928 }1929 else {1930 extraAttrs.push(key);1931 }1932 }1933 if (extraAttrs.length) {1934 warn(`Extraneous non-props attributes (` +1935 `${extraAttrs.join(', ')}) ` +1936 `were passed to component but could not be automatically inherited ` +1937 `because component renders fragment or text root nodes.`);1938 }1939 if (eventAttrs.length) {1940 warn(`Extraneous non-emits event listeners (` +1941 `${eventAttrs.join(', ')}) ` +1942 `were passed to component but could not be automatically inherited ` +1943 `because component renders fragment or text root nodes. ` +1944 `If the listener is intended to be a component custom event listener only, ` +1945 `declare it using the "emits" option.`);1946 }1947 }1948 }1949 }1950 // inherit directives1951 if (vnode.dirs) {1952 if (true && !isElementRoot(root)) {1953 warn(`Runtime directive used on component with non-element root node. ` +1954 `The directives will not function as intended.`);1955 }1956 root.dirs = root.dirs ? root.dirs.concat(vnode.dirs) : vnode.dirs;1957 }1958 // inherit transition data1959 if (vnode.transition) {1960 if (true && !isElementRoot(root)) {1961 warn(`Component inside <Transition> renders non-element root node ` +1962 `that cannot be animated.`);1963 }1964 root.transition = vnode.transition;1965 }1966 if (true && setRoot) {1967 setRoot(root);1968 }1969 else {1970 result = root;1971 }1972 }1973 catch (err) {1974 handleError(err, instance, 1 /* RENDER_FUNCTION */);1975 result = createVNode(Comment);1976 }1977 currentRenderingInstance = null;1978 return result;1979 }1980 /**1981 * dev only1982 * In dev mode, template root level comments are rendered, which turns the1983 * template into a fragment root, but we need to locate the single element1984 * root for attrs and scope id processing.1985 */1986 const getChildRoot = (vnode) => {1987 if (vnode.type !== Fragment) {1988 return [vnode, undefined];1989 }1990 const rawChildren = vnode.children;1991 const dynamicChildren = vnode.dynamicChildren;1992 const childRoot = filterSingleRoot(rawChildren);1993 if (!childRoot) {1994 return [vnode, undefined];1995 }1996 const index = rawChildren.indexOf(childRoot);1997 const dynamicIndex = dynamicChildren ? dynamicChildren.indexOf(childRoot) : -1;1998 const setRoot = (updatedRoot) => {1999 rawChildren[index] = updatedRoot;2000 if (dynamicChildren) {2001 if (dynamicIndex > -1) {2002 dynamicChildren[dynamicIndex] = updatedRoot;2003 }2004 else if (updatedRoot.patchFlag > 0) {2005 vnode.dynamicChildren = [...dynamicChildren, updatedRoot];2006 }2007 }2008 };2009 return [normalizeVNode(childRoot), setRoot];2010 };2011 /**2012 * dev only2013 */2014 function filterSingleRoot(children) {2015 const filtered = children.filter(child => {2016 return !(isVNode(child) &&2017 child.type === Comment &&2018 child.children !== 'v-if');2019 });2020 return filtered.length === 1 && isVNode(filtered[0]) ? filtered[0] : null;2021 }2022 const getFunctionalFallthrough = (attrs) => {2023 let res;2024 for (const key in attrs) {2025 if (key === 'class' || key === 'style' || isOn(key)) {2026 (res || (res = {}))[key] = attrs[key];2027 }2028 }2029 return res;2030 };2031 const filterModelListeners = (attrs, props) => {2032 const res = {};2033 for (const key in attrs) {2034 if (!isModelListener(key) || !(key.slice(9) in props)) {2035 res[key] = attrs[key];2036 }2037 }2038 return res;2039 };2040 const isElementRoot = (vnode) => {2041 return (vnode.shapeFlag & 6 /* COMPONENT */ ||2042 vnode.shapeFlag & 1 /* ELEMENT */ ||2043 vnode.type === Comment // potential v-if branch switch2044 );2045 };2046 function shouldUpdateComponent(prevVNode, nextVNode, optimized) {2047 const { props: prevProps, children: prevChildren, component } = prevVNode;2048 const { props: nextProps, children: nextChildren, patchFlag } = nextVNode;2049 const emits = component.emitsOptions;2050 // Parent component's render function was hot-updated. Since this may have2051 // caused the child component's slots content to have changed, we need to2052 // force the child to update as well.2053 if ( (prevChildren || nextChildren) && isHmrUpdating) {2054 return true;2055 }2056 // force child update for runtime directive or transition on component vnode.2057 if (nextVNode.dirs || nextVNode.transition) {2058 return true;2059 }2060 if (optimized && patchFlag > 0) {2061 if (patchFlag & 1024 /* DYNAMIC_SLOTS */) {2062 // slot content that references values that might have changed,2063 // e.g. in a v-for2064 return true;2065 }2066 if (patchFlag & 16 /* FULL_PROPS */) {2067 if (!prevProps) {2068 return !!nextProps;2069 }2070 // presence of this flag indicates props are always non-null2071 return hasPropsChanged(prevProps, nextProps, emits);2072 }2073 else if (patchFlag & 8 /* PROPS */) {2074 const dynamicProps = nextVNode.dynamicProps;2075 for (let i = 0; i < dynamicProps.length; i++) {2076 const key = dynamicProps[i];2077 if (nextProps[key] !== prevProps[key] &&2078 !isEmitListener(emits, key)) {2079 return true;2080 }2081 }2082 }2083 }2084 else {2085 // this path is only taken by manually written render functions2086 // so presence of any children leads to a forced update2087 if (prevChildren || nextChildren) {2088 if (!nextChildren || !nextChildren.$stable) {2089 return true;2090 }2091 }2092 if (prevProps === nextProps) {2093 return false;2094 }2095 if (!prevProps) {2096 return !!nextProps;2097 }2098 if (!nextProps) {2099 return true;2100 }2101 return hasPropsChanged(prevProps, nextProps, emits);2102 }2103 return false;2104 }2105 function hasPropsChanged(prevProps, nextProps, emitsOptions) {2106 const nextKeys = Object.keys(nextProps);2107 if (nextKeys.length !== Object.keys(prevProps).length) {2108 return true;2109 }2110 for (let i = 0; i < nextKeys.length; i++) {2111 const key = nextKeys[i];2112 if (nextProps[key] !== prevProps[key] &&2113 !isEmitListener(emitsOptions, key)) {2114 return true;2115 }2116 }2117 return false;2118 }2119 function updateHOCHostEl({ vnode, parent }, el // HostNode2120 ) {2121 while (parent && parent.subTree === vnode) {2122 (vnode = parent.vnode).el = el;2123 parent = parent.parent;2124 }2125 }2126 const isSuspense = (type) => type.__isSuspense;2127 // Suspense exposes a component-like API, and is treated like a component2128 // in the compiler, but internally it's a special built-in type that hooks2129 // directly into the renderer.2130 const SuspenseImpl = {2131 // In order to make Suspense tree-shakable, we need to avoid importing it2132 // directly in the renderer. The renderer checks for the __isSuspense flag2133 // on a vnode's type and calls the `process` method, passing in renderer2134 // internals.2135 __isSuspense: true,2136 process(n1, n2, container, anchor, parentComponent, parentSuspense, isSVG, optimized, 2137 // platform-specific impl passed from renderer2138 rendererInternals) {2139 if (n1 == null) {2140 mountSuspense(n2, container, anchor, parentComponent, parentSuspense, isSVG, optimized, rendererInternals);2141 }2142 else {2143 patchSuspense(n1, n2, container, anchor, parentComponent, isSVG, rendererInternals);2144 }2145 },2146 hydrate: hydrateSuspense,2147 create: createSuspenseBoundary2148 };2149 // Force-casted public typing for h and TSX props inference2150 const Suspense = ( SuspenseImpl2151 );2152 function mountSuspense(vnode, container, anchor, parentComponent, parentSuspense, isSVG, optimized, rendererInternals) {2153 const { p: patch, o: { createElement } } = rendererInternals;2154 const hiddenContainer = createElement('div');2155 const suspense = (vnode.suspense = createSuspenseBoundary(vnode, parentSuspense, parentComponent, container, hiddenContainer, anchor, isSVG, optimized, rendererInternals));2156 // start mounting the content subtree in an off-dom container2157 patch(null, (suspense.pendingBranch = vnode.ssContent), hiddenContainer, null, parentComponent, suspense, isSVG);2158 // now check if we have encountered any async deps2159 if (suspense.deps > 0) {2160 // has async2161 // mount the fallback tree2162 patch(null, vnode.ssFallback, container, anchor, parentComponent, null, // fallback tree will not have suspense context2163 isSVG);2164 setActiveBranch(suspense, vnode.ssFallback);2165 }2166 else {2167 // Suspense has no async deps. Just resolve.2168 suspense.resolve();2169 }2170 }2171 function patchSuspense(n1, n2, container, anchor, parentComponent, isSVG, { p: patch, um: unmount, o: { createElement } }) {2172 const suspense = (n2.suspense = n1.suspense);2173 suspense.vnode = n2;2174 n2.el = n1.el;2175 const newBranch = n2.ssContent;2176 const newFallback = n2.ssFallback;2177 const { activeBranch, pendingBranch, isInFallback, isHydrating } = suspense;2178 if (pendingBranch) {2179 suspense.pendingBranch = newBranch;2180 if (isSameVNodeType(newBranch, pendingBranch)) {2181 // same root type but content may have changed.2182 patch(pendingBranch, newBranch, suspense.hiddenContainer, null, parentComponent, suspense, isSVG);2183 if (suspense.deps <= 0) {2184 suspense.resolve();2185 }2186 else if (isInFallback) {2187 patch(activeBranch, newFallback, container, anchor, parentComponent, null, // fallback tree will not have suspense context2188 isSVG);2189 setActiveBranch(suspense, newFallback);2190 }2191 }2192 else {2193 // toggled before pending tree is resolved2194 suspense.pendingId++;2195 if (isHydrating) {2196 // if toggled before hydration is finished, the current DOM tree is2197 // no longer valid. set it as the active branch so it will be unmounted2198 // when resolved2199 suspense.isHydrating = false;2200 suspense.activeBranch = pendingBranch;2201 }2202 else {2203 unmount(pendingBranch, parentComponent, suspense);2204 }2205 // increment pending ID. this is used to invalidate async callbacks2206 // reset suspense state2207 suspense.deps = 0;2208 // discard effects from pending branch2209 suspense.effects.length = 0;2210 // discard previous container2211 suspense.hiddenContainer = createElement('div');2212 if (isInFallback) {2213 // already in fallback state2214 patch(null, newBranch, suspense.hiddenContainer, null, parentComponent, suspense, isSVG);2215 if (suspense.deps <= 0) {2216 suspense.resolve();2217 }2218 else {2219 patch(activeBranch, newFallback, container, anchor, parentComponent, null, // fallback tree will not have suspense context2220 isSVG);2221 setActiveBranch(suspense, newFallback);2222 }2223 }2224 else if (activeBranch && isSameVNodeType(newBranch, activeBranch)) {2225 // toggled "back" to current active branch2226 patch(activeBranch, newBranch, container, anchor, parentComponent, suspense, isSVG);2227 // force resolve2228 suspense.resolve(true);2229 }2230 else {2231 // switched to a 3rd branch2232 patch(null, newBranch, suspense.hiddenContainer, null, parentComponent, suspense, isSVG);2233 if (suspense.deps <= 0) {2234 suspense.resolve();2235 }2236 }2237 }2238 }2239 else {2240 if (activeBranch && isSameVNodeType(newBranch, activeBranch)) {2241 // root did not change, just normal patch2242 patch(activeBranch, newBranch, container, anchor, parentComponent, suspense, isSVG);2243 setActiveBranch(suspense, newBranch);2244 }2245 else {2246 // root node toggled2247 // invoke @pending event2248 const onPending = n2.props && n2.props.onPending;2249 if (isFunction(onPending)) {2250 onPending();2251 }2252 // mount pending branch in off-dom container2253 suspense.pendingBranch = newBranch;2254 suspense.pendingId++;2255 patch(null, newBranch, suspense.hiddenContainer, null, parentComponent, suspense, isSVG);2256 if (suspense.deps <= 0) {2257 // incoming branch has no async deps, resolve now.2258 suspense.resolve();2259 }2260 else {2261 const { timeout, pendingId } = suspense;2262 if (timeout > 0) {2263 setTimeout(() => {2264 if (suspense.pendingId === pendingId) {2265 suspense.fallback(newFallback);2266 }2267 }, timeout);2268 }2269 else if (timeout === 0) {2270 suspense.fallback(newFallback);2271 }2272 }2273 }2274 }2275 }2276 let hasWarned = false;2277 function createSuspenseBoundary(vnode, parent, parentComponent, container, hiddenContainer, anchor, isSVG, optimized, rendererInternals, isHydrating = false) {2278 /* istanbul ignore if */2279 if ( !hasWarned) {2280 hasWarned = true;2281 // @ts-ignore `console.info` cannot be null error2282 console[console.info ? 'info' : 'log'](`<Suspense> is an experimental feature and its API will likely change.`);2283 }2284 const { p: patch, m: move, um: unmount, n: next, o: { parentNode, remove } } = rendererInternals;2285 const timeout = toNumber(vnode.props && vnode.props.timeout);2286 const suspense = {2287 vnode,2288 parent,2289 parentComponent,2290 isSVG,2291 container,2292 hiddenContainer,2293 anchor,2294 deps: 0,2295 pendingId: 0,2296 timeout: typeof timeout === 'number' ? timeout : -1,2297 activeBranch: null,2298 pendingBranch: null,2299 isInFallback: true,2300 isHydrating,2301 isUnmounted: false,2302 effects: [],2303 resolve(resume = false) {2304 {2305 if (!resume && !suspense.pendingBranch) {2306 throw new Error(`suspense.resolve() is called without a pending branch.`);2307 }2308 if (suspense.isUnmounted) {2309 throw new Error(`suspense.resolve() is called on an already unmounted suspense boundary.`);2310 }2311 }2312 const { vnode, activeBranch, pendingBranch, pendingId, effects, parentComponent, container } = suspense;2313 if (suspense.isHydrating) {2314 suspense.isHydrating = false;2315 }2316 else if (!resume) {2317 const delayEnter = activeBranch &&2318 pendingBranch.transition &&2319 pendingBranch.transition.mode === 'out-in';2320 if (delayEnter) {2321 activeBranch.transition.afterLeave = () => {2322 if (pendingId === suspense.pendingId) {2323 move(pendingBranch, container, anchor, 0 /* ENTER */);2324 }2325 };2326 }2327 // this is initial anchor on mount2328 let { anchor } = suspense;2329 // unmount current active tree2330 if (activeBranch) {2331 // if the fallback tree was mounted, it may have been moved2332 // as part of a parent suspense. get the latest anchor for insertion2333 anchor = next(activeBranch);2334 unmount(activeBranch, parentComponent, suspense, true);2335 }2336 if (!delayEnter) {2337 // move content from off-dom container to actual container2338 move(pendingBranch, container, anchor, 0 /* ENTER */);2339 }2340 }2341 setActiveBranch(suspense, pendingBranch);2342 suspense.pendingBranch = null;2343 suspense.isInFallback = false;2344 // flush buffered effects2345 // check if there is a pending parent suspense2346 let parent = suspense.parent;2347 let hasUnresolvedAncestor = false;2348 while (parent) {2349 if (parent.pendingBranch) {2350 // found a pending parent suspense, merge buffered post jobs2351 // into that parent2352 parent.effects.push(...effects);2353 hasUnresolvedAncestor = true;2354 break;2355 }2356 parent = parent.parent;2357 }2358 // no pending parent suspense, flush all jobs2359 if (!hasUnresolvedAncestor) {2360 queuePostFlushCb(effects);2361 }2362 suspense.effects = [];2363 // invoke @resolve event2364 const onResolve = vnode.props && vnode.props.onResolve;2365 if (isFunction(onResolve)) {2366 onResolve();2367 }2368 },2369 fallback(fallbackVNode) {2370 if (!suspense.pendingBranch) {2371 return;2372 }2373 const { vnode, activeBranch, parentComponent, container, isSVG } = suspense;2374 // invoke @fallback event2375 const onFallback = vnode.props && vnode.props.onFallback;2376 if (isFunction(onFallback)) {2377 onFallback();2378 }2379 const anchor = next(activeBranch);2380 const mountFallback = () => {2381 if (!suspense.isInFallback) {2382 return;2383 }2384 // mount the fallback tree2385 patch(null, fallbackVNode, container, anchor, parentComponent, null, // fallback tree will not have suspense context2386 isSVG);2387 setActiveBranch(suspense, fallbackVNode);2388 };2389 const delayEnter = fallbackVNode.transition && fallbackVNode.transition.mode === 'out-in';2390 if (delayEnter) {2391 activeBranch.transition.afterLeave = mountFallback;2392 }2393 // unmount current active branch2394 unmount(activeBranch, parentComponent, null, // no suspense so unmount hooks fire now2395 true // shouldRemove2396 );2397 suspense.isInFallback = true;2398 if (!delayEnter) {2399 mountFallback();2400 }2401 },2402 move(container, anchor, type) {2403 suspense.activeBranch &&2404 move(suspense.activeBranch, container, anchor, type);2405 suspense.container = container;2406 },2407 next() {2408 return suspense.activeBranch && next(suspense.activeBranch);2409 },2410 registerDep(instance, setupRenderEffect) {2411 if (!suspense.pendingBranch) {2412 return;2413 }2414 const hydratedEl = instance.vnode.el;2415 suspense.deps++;2416 instance2417 .asyncDep.catch(err => {2418 handleError(err, instance, 0 /* SETUP_FUNCTION */);2419 })2420 .then(asyncSetupResult => {2421 // retry when the setup() promise resolves.2422 // component may have been unmounted before resolve.2423 if (instance.isUnmounted ||2424 suspense.isUnmounted ||2425 suspense.pendingId !== instance.suspenseId) {2426 return;2427 }2428 suspense.deps--;2429 // retry from this component2430 instance.asyncResolved = true;2431 const { vnode } = instance;2432 {2433 pushWarningContext(vnode);2434 }2435 handleSetupResult(instance, asyncSetupResult);2436 if (hydratedEl) {2437 // vnode may have been replaced if an update happened before the2438 // async dep is resolved.2439 vnode.el = hydratedEl;2440 }2441 const placeholder = !hydratedEl && instance.subTree.el;2442 setupRenderEffect(instance, vnode, 2443 // component may have been moved before resolve.2444 // if this is not a hydration, instance.subTree will be the comment2445 // placeholder.2446 parentNode(hydratedEl || instance.subTree.el), 2447 // anchor will not be used if this is hydration, so only need to2448 // consider the comment placeholder case.2449 hydratedEl ? null : next(instance.subTree), suspense, isSVG, optimized);2450 if (placeholder) {2451 remove(placeholder);2452 }2453 updateHOCHostEl(instance, vnode.el);2454 {2455 popWarningContext();2456 }2457 if (suspense.deps === 0) {2458 suspense.resolve();2459 }2460 });2461 },2462 unmount(parentSuspense, doRemove) {2463 suspense.isUnmounted = true;2464 if (suspense.activeBranch) {2465 unmount(suspense.activeBranch, parentComponent, parentSuspense, doRemove);2466 }2467 if (suspense.pendingBranch) {2468 unmount(suspense.pendingBranch, parentComponent, parentSuspense, doRemove);2469 }2470 }2471 };2472 return suspense;2473 }2474 function hydrateSuspense(node, vnode, parentComponent, parentSuspense, isSVG, optimized, rendererInternals, hydrateNode) {2475 /* eslint-disable no-restricted-globals */2476 const suspense = (vnode.suspense = createSuspenseBoundary(vnode, parentSuspense, parentComponent, node.parentNode, document.createElement('div'), null, isSVG, optimized, rendererInternals, true /* hydrating */));2477 // there are two possible scenarios for server-rendered suspense:2478 // - success: ssr content should be fully resolved2479 // - failure: ssr content should be the fallback branch.2480 // however, on the client we don't really know if it has failed or not2481 // attempt to hydrate the DOM assuming it has succeeded, but we still2482 // need to construct a suspense boundary first2483 const result = hydrateNode(node, (suspense.pendingBranch = vnode.ssContent), parentComponent, suspense, optimized);2484 if (suspense.deps === 0) {2485 suspense.resolve();2486 }2487 return result;2488 /* eslint-enable no-restricted-globals */2489 }2490 function normalizeSuspenseChildren(vnode) {2491 const { shapeFlag, children } = vnode;2492 let content;2493 let fallback;2494 if (shapeFlag & 32 /* SLOTS_CHILDREN */) {2495 content = normalizeSuspenseSlot(children.default);2496 fallback = normalizeSuspenseSlot(children.fallback);2497 }2498 else {2499 content = normalizeSuspenseSlot(children);2500 fallback = normalizeVNode(null);2501 }2502 return {2503 content,2504 fallback2505 };2506 }2507 function normalizeSuspenseSlot(s) {2508 if (isFunction(s)) {2509 s = s();2510 }2511 if (isArray(s)) {2512 const singleChild = filterSingleRoot(s);2513 if ( !singleChild) {2514 warn(`<Suspense> slots expect a single root node.`);2515 }2516 s = singleChild;2517 }2518 return normalizeVNode(s);2519 }2520 function queueEffectWithSuspense(fn, suspense) {2521 if (suspense && suspense.pendingBranch) {2522 if (isArray(fn)) {2523 suspense.effects.push(...fn);2524 }2525 else {2526 suspense.effects.push(fn);2527 }2528 }2529 else {2530 queuePostFlushCb(fn);2531 }2532 }2533 function setActiveBranch(suspense, branch) {2534 suspense.activeBranch = branch;2535 const { vnode, parentComponent } = suspense;2536 const el = (vnode.el = branch.el);2537 // in case suspense is the root node of a component,2538 // recursively update the HOC el2539 if (parentComponent && parentComponent.subTree === vnode) {2540 parentComponent.vnode.el = el;2541 updateHOCHostEl(parentComponent, el);2542 }2543 }2544 let isRenderingCompiledSlot = 0;2545 const setCompiledSlotRendering = (n) => (isRenderingCompiledSlot += n);2546 /**2547 * Compiler runtime helper for rendering `<slot/>`2548 * @private2549 */2550 function renderSlot(slots, name, props = {}, 2551 // this is not a user-facing function, so the fallback is always generated by2552 // the compiler and guaranteed to be a function returning an array2553 fallback) {2554 let slot = slots[name];2555 if ( slot && slot.length > 1) {2556 warn(`SSR-optimized slot function detected in a non-SSR-optimized render ` +2557 `function. You need to mark this component with $dynamic-slots in the ` +2558 `parent template.`);2559 slot = () => [];2560 }2561 // a compiled slot disables block tracking by default to avoid manual2562 // invocation interfering with template-based block tracking, but in2563 // `renderSlot` we can be sure that it's template-based so we can force2564 // enable it.2565 isRenderingCompiledSlot++;2566 const rendered = (openBlock(),2567 createBlock(Fragment, { key: props.key }, slot ? slot(props) : fallback ? fallback() : [], slots._ === 1 /* STABLE */2568 ? 64 /* STABLE_FRAGMENT */2569 : -2 /* BAIL */));2570 isRenderingCompiledSlot--;2571 return rendered;2572 }2573 /**2574 * Wrap a slot function to memoize current rendering instance2575 * @private2576 */2577 function withCtx(fn, ctx = currentRenderingInstance) {2578 if (!ctx)2579 return fn;2580 const renderFnWithContext = (...args) => {2581 // If a user calls a compiled slot inside a template expression (#1745), it2582 // can mess up block tracking, so by default we need to push a null block to2583 // avoid that. This isn't necessary if rendering a compiled `<slot>`.2584 if (!isRenderingCompiledSlot) {2585 openBlock(true /* null block that disables tracking */);2586 }2587 const owner = currentRenderingInstance;2588 setCurrentRenderingInstance(ctx);2589 const res = fn(...args);2590 setCurrentRenderingInstance(owner);2591 if (!isRenderingCompiledSlot) {2592 closeBlock();2593 }2594 return res;2595 };2596 renderFnWithContext._c = true;2597 return renderFnWithContext;2598 }2599 // SFC scoped style ID management.2600 let currentScopeId = null;2601 const scopeIdStack = [];2602 /**2603 * @private2604 */2605 function pushScopeId(id) {2606 scopeIdStack.push((currentScopeId = id));2607 }2608 /**2609 * @private2610 */2611 function popScopeId() {2612 scopeIdStack.pop();2613 currentScopeId = scopeIdStack[scopeIdStack.length - 1] || null;2614 }2615 /**2616 * @private2617 */2618 function withScopeId(id) {2619 return ((fn) => withCtx(function () {2620 pushScopeId(id);2621 const res = fn.apply(this, arguments);2622 popScopeId();2623 return res;2624 }));2625 }2626 function initProps(instance, rawProps, isStateful, // result of bitwise flag comparison2627 isSSR = false) {2628 const props = {};2629 const attrs = {};2630 def(attrs, InternalObjectKey, 1);2631 setFullProps(instance, rawProps, props, attrs);2632 // validation2633 {2634 validateProps(props, instance);2635 }2636 if (isStateful) {2637 // stateful2638 instance.props = isSSR ? props : shallowReactive(props);2639 }2640 else {2641 if (!instance.type.props) {2642 // functional w/ optional props, props === attrs2643 instance.props = attrs;2644 }2645 else {2646 // functional w/ declared props2647 instance.props = props;2648 }2649 }2650 instance.attrs = attrs;2651 }2652 function updateProps(instance, rawProps, rawPrevProps, optimized) {2653 const { props, attrs, vnode: { patchFlag } } = instance;2654 const rawCurrentProps = toRaw(props);2655 const [options] = instance.propsOptions;2656 if (2657 // always force full diff in dev2658 // - #1942 if hmr is enabled with sfc component2659 // - vite#872 non-sfc component used by sfc component2660 !(2661 (instance.type.__hmrId ||2662 (instance.parent && instance.parent.type.__hmrId))) &&2663 (optimized || patchFlag > 0) &&2664 !(patchFlag & 16 /* FULL_PROPS */)) {2665 if (patchFlag & 8 /* PROPS */) {2666 // Compiler-generated props & no keys change, just set the updated2667 // the props.2668 const propsToUpdate = instance.vnode.dynamicProps;2669 for (let i = 0; i < propsToUpdate.length; i++) {2670 const key = propsToUpdate[i];2671 // PROPS flag guarantees rawProps to be non-null2672 const value = rawProps[key];2673 if (options) {2674 // attr / props separation was done on init and will be consistent2675 // in this code path, so just check if attrs have it.2676 if (hasOwn(attrs, key)) {2677 attrs[key] = value;2678 }2679 else {2680 const camelizedKey = camelize(key);2681 props[camelizedKey] = resolvePropValue(options, rawCurrentProps, camelizedKey, value, instance);2682 }2683 }2684 else {2685 attrs[key] = value;2686 }2687 }2688 }2689 }2690 else {2691 // full props update.2692 setFullProps(instance, rawProps, props, attrs);2693 // in case of dynamic props, check if we need to delete keys from2694 // the props object2695 let kebabKey;2696 for (const key in rawCurrentProps) {2697 if (!rawProps ||2698 // for camelCase2699 (!hasOwn(rawProps, key) &&2700 // it's possible the original props was passed in as kebab-case2701 // and converted to camelCase (#955)2702 ((kebabKey = hyphenate(key)) === key || !hasOwn(rawProps, kebabKey)))) {2703 if (options) {2704 if (rawPrevProps &&2705 // for camelCase2706 (rawPrevProps[key] !== undefined ||2707 // for kebab-case2708 rawPrevProps[kebabKey] !== undefined)) {2709 props[key] = resolvePropValue(options, rawProps || EMPTY_OBJ, key, undefined, instance);2710 }2711 }2712 else {2713 delete props[key];2714 }2715 }2716 }2717 // in the case of functional component w/o props declaration, props and2718 // attrs point to the same object so it should already have been updated.2719 if (attrs !== rawCurrentProps) {2720 for (const key in attrs) {2721 if (!rawProps || !hasOwn(rawProps, key)) {2722 delete attrs[key];2723 }2724 }2725 }2726 }2727 // trigger updates for $attrs in case it's used in component slots2728 trigger(instance, "set" /* SET */, '$attrs');2729 if ( rawProps) {2730 validateProps(props, instance);2731 }2732 }2733 function setFullProps(instance, rawProps, props, attrs) {2734 const [options, needCastKeys] = instance.propsOptions;2735 if (rawProps) {2736 for (const key in rawProps) {2737 const value = rawProps[key];2738 // key, ref are reserved and never passed down2739 if (isReservedProp(key)) {2740 continue;2741 }2742 // prop option names are camelized during normalization, so to support2743 // kebab -> camel conversion here we need to camelize the key.2744 let camelKey;2745 if (options && hasOwn(options, (camelKey = camelize(key)))) {2746 props[camelKey] = value;2747 }2748 else if (!isEmitListener(instance.emitsOptions, key)) {2749 // Any non-declared (either as a prop or an emitted event) props are put2750 // into a separate `attrs` object for spreading. Make sure to preserve2751 // original key casing2752 attrs[key] = value;2753 }2754 }2755 }2756 if (needCastKeys) {2757 const rawCurrentProps = toRaw(props);2758 for (let i = 0; i < needCastKeys.length; i++) {2759 const key = needCastKeys[i];2760 props[key] = resolvePropValue(options, rawCurrentProps, key, rawCurrentProps[key], instance);2761 }2762 } ...

Full Screen

Full Screen

jquery-3.6.0.min.js

Source:jquery-3.6.0.min.js Github

copy

Full Screen

...555 !n && t.mixins.length && t.mixins.forEach(extendEmits), e.extends && extendEmits(e.extends), e.mixins && e.mixins.forEach(extendEmits)556 }557 return s || i ? (w(s) ? s.forEach((e => a[e] = null)) : b(a, s), r.set(e, a), a) : (r.set(e, null), null)558}559function isEmitListener(e, t) {560 return !(!e || !isOn(t)) && (t = t.slice(2).replace(/Once$/, ""), hasOwn(e, t[0].toLowerCase() + t.slice(1)) || hasOwn(e, C(t)) || hasOwn(e, t))561}562let be = null, Re = null;563function setCurrentRenderingInstance(e) {564 const t = be;565 return be = e, Re = e && e.type.__scopeId || null, t566}567function pushScopeId(e) {568 Re = e569}570function popScopeId() {571 Re = null572}573const withScopeId = e => withCtx;574function withCtx(e, t = be, n) {575 if (!t) return e;576 if (e._n) return e;577 const renderFnWithContext = (...n) => {578 renderFnWithContext._d && setBlockTracking(-1);579 const r = setCurrentRenderingInstance(t), o = e(...n);580 return setCurrentRenderingInstance(r), renderFnWithContext._d && setBlockTracking(1), o581 };582 return renderFnWithContext._n = !0, renderFnWithContext._c = !0, renderFnWithContext._d = !0, renderFnWithContext583}584function renderComponentRoot(e) {585 const {586 type: t,587 vnode: n,588 proxy: r,589 withProxy: o,590 props: s,591 propsOptions: [a],592 slots: i,593 attrs: l,594 emit: c,595 render: u,596 renderCache: f,597 data: p,598 setupState: d,599 ctx: m,600 inheritAttrs: g601 } = e;602 let v;603 const y = setCurrentRenderingInstance(e);604 try {605 let e;606 if (4 & n.shapeFlag) {607 const t = o || r;608 v = normalizeVNode(u.call(t, t, f, s, d, p, m)), e = l609 } else {610 const n = t;611 0, v = normalizeVNode(n.length > 1 ? n(s, {612 attrs: l,613 slots: i,614 emit: c615 }) : n(s, null)), e = t.props ? l : getFunctionalFallthrough(l)616 }617 let y = v;618 if (e && !1 !== g) {619 const t = Object.keys(e), {shapeFlag: n} = y;620 t.length && (1 & n || 6 & n) && (a && t.some(isModelListener) && (e = filterModelListeners(e, a)), y = cloneVNode(y, e))621 }622 0, n.dirs && (y.dirs = y.dirs ? y.dirs.concat(n.dirs) : n.dirs), n.transition && (y.transition = n.transition), v = y623 } catch (b) {624 ze.length = 0, handleError(b, e, 1), v = De(He)625 }626 return setCurrentRenderingInstance(y), v627}628const getFunctionalFallthrough = e => {629 let t;630 for (const n in e) ("class" === n || "style" === n || isOn(n)) && ((t || (t = {}))[n] = e[n]);631 return t632}, filterModelListeners = (e, t) => {633 const n = {};634 for (const r in e) isModelListener(r) && r.slice(9) in t || (n[r] = e[r]);635 return n636};637function hasPropsChanged(e, t, n) {638 const r = Object.keys(t);639 if (r.length !== Object.keys(e).length) return !0;640 for (let o = 0; o < r.length; o++) {641 const s = r[o];642 if (t[s] !== e[s] && !isEmitListener(n, s)) return !0643 }644 return !1645}646function provide(e, t) {647 if (Ye) {648 let n = Ye.provides;649 const r = Ye.parent && Ye.parent.provides;650 r === n && (n = Ye.provides = Object.create(r)), n[e] = t651 } else ;652}653function inject(e, t, n = !1) {654 const r = Ye || be;655 if (r) {656 const o = null == r.parent ? r.vnode.appContext && r.vnode.appContext.provides : r.parent.provides;657 if (o && e in o) return o[e];658 if (arguments.length > 1) return n && isFunction(t) ? t.call(r.proxy) : t659 }660}661const we = {};662function watch(e, t, n) {663 return doWatch(e, t, n)664}665function doWatch(e, t, {immediate: n, deep: r, flush: o, onTrack: s, onTrigger: a} = g, i = Ye) {666 let l, c, u = !1, f = !1;667 if (isRef(e) ? (l = () => e.value, u = !!e._shallow) : isReactive(e) ? (l = () => e, r = !0) : w(e) ? (f = !0, u = e.some(isReactive), l = () => e.map((e => isRef(e) ? e.value : isReactive(e) ? traverse(e) : isFunction(e) ? callWithErrorHandling(e, i, 2) : void 0))) : l = isFunction(e) ? t ? () => callWithErrorHandling(e, i, 2) : () => {668 if (!i || !i.isUnmounted) return c && c(), callWithAsyncErrorHandling(e, i, 3, [onInvalidate])669 } : NOOP, t && r) {670 const e = l;671 l = () => traverse(e())672 }673 let onInvalidate = e => {674 c = m.options.onStop = () => {675 callWithErrorHandling(e, i, 4)676 }677 }, p = f ? [] : we;678 const job = () => {679 if (m.active) if (t) {680 const e = m();681 (r || u || (f ? e.some(((e, t) => hasChanged(e, p[t]))) : hasChanged(e, p))) && (c && c(), callWithAsyncErrorHandling(t, i, 3, [e, p === we ? void 0 : p, onInvalidate]), p = e)682 } else m()683 };684 let d;685 job.allowRecurse = !!t, d = "sync" === o ? job : "post" === o ? () => Me(job, i && i.suspense) : () => {686 !i || i.isMounted ? function queuePreFlushCb(e) {687 queueCb(e, fe, ue, pe)688 }(job) : job()689 };690 const m = effect(l, {lazy: !0, onTrack: s, onTrigger: a, scheduler: d});691 return recordInstanceBoundEffect(m, i), t ? n ? job() : p = m() : "post" === o ? Me(m, i && i.suspense) : m(), () => {692 stop(m), i && remove(i.effects, m)693 }694}695function instanceWatch(e, t, n) {696 const r = this.proxy, o = isString$1(e) ? e.includes(".") ? createPathGetter(r, e) : () => r[e] : e.bind(r, r);697 let s;698 return isFunction(t) ? s = t : (s = t.handler, n = t), doWatch(o, s.bind(r), n, this)699}700function createPathGetter(e, t) {701 const n = t.split(".");702 return () => {703 let t = e;704 for (let e = 0; e < n.length && t; e++) t = t[n[e]];705 return t706 }707}708function traverse(e, t = new Set) {709 if (!isObject(e) || t.has(e) || e.__v_skip) return e;710 if (t.add(e), isRef(e)) traverse(e.value, t); else if (w(e)) for (let n = 0; n < e.length; n++) traverse(e[n], t); else if (isSet(e) || isMap(e)) e.forEach((e => {711 traverse(e, t)712 })); else if (isPlainObject(e)) for (const n in e) traverse(e[n], t);713 return e714}715function defineComponent(e) {716 return isFunction(e) ? {setup: e, name: e.name} : e717}718const isAsyncWrapper = e => !!e.type.__asyncLoader;719function defineAsyncComponent(e) {720 isFunction(e) && (e = {loader: e});721 const {722 loader: t,723 loadingComponent: n,724 errorComponent: r,725 delay: o = 200,726 timeout: s,727 suspensible: a = !0,728 onError: i729 } = e;730 let l, c = null, u = 0;731 const load = () => {732 let e;733 return c || (e = c = t().catch((e => {734 if (e = e instanceof Error ? e : new Error(String(e)), i) return new Promise(((t, n) => {735 i(e, (() => t((u++, c = null, load()))), (() => n(e)), u + 1)736 }));737 throw e738 })).then((t => e !== c && c ? c : (t && (t.__esModule || "Module" === t[Symbol.toStringTag]) && (t = t.default), l = t, t))))739 };740 return defineComponent({741 name: "AsyncComponentWrapper", __asyncLoader: load, get __asyncResolved() {742 return l743 }, setup() {744 const e = Ye;745 if (l) return () => createInnerComp(l, e);746 const onError = t => {747 c = null, handleError(t, e, 13, !r)748 };749 if (a && e.suspense) return load().then((t => () => createInnerComp(t, e))).catch((e => (onError(e), () => r ? De(r, {error: e}) : null)));750 const t = ref(!1), i = ref(), u = ref(!!o);751 return o && setTimeout((() => {752 u.value = !1753 }), o), null != s && setTimeout((() => {754 if (!t.value && !i.value) {755 const e = new Error(`Async component timed out after ${s}ms.`);756 onError(e), i.value = e757 }758 }), s), load().then((() => {759 t.value = !0, e.parent && isKeepAlive(e.parent.vnode) && queueJob(e.parent.update)760 })).catch((e => {761 onError(e), i.value = e762 })), () => t.value && l ? createInnerComp(l, e) : i.value && r ? De(r, {error: i.value}) : n && !u.value ? De(n) : void 0763 }764 })765}766function createInnerComp(e, {vnode: {ref: t, props: n, children: r}}) {767 const o = De(e, n, r);768 return o.ref = t, o769}770const isKeepAlive = e => e.type.__isKeepAlive;771function onActivated(e, t) {772 registerKeepAliveHook(e, "a", t)773}774function onDeactivated(e, t) {775 registerKeepAliveHook(e, "da", t)776}777function registerKeepAliveHook(e, t, n = Ye) {778 const r = e.__wdc || (e.__wdc = () => {779 let t = n;780 for (; t;) {781 if (t.isDeactivated) return;782 t = t.parent783 }784 e()785 });786 if (injectHook(t, r, n), n) {787 let e = n.parent;788 for (; e && e.parent;) isKeepAlive(e.parent.vnode) && injectToKeepAliveRoot(r, t, n, e), e = e.parent789 }790}791function injectToKeepAliveRoot(e, t, n, r) {792 const o = injectHook(t, e, r, !0);793 Ce((() => {794 remove(r[t], o)795 }), n)796}797function injectHook(e, t, n = Ye, r = !1) {798 if (n) {799 const o = n[e] || (n[e] = []), s = t.__weh || (t.__weh = (...r) => {800 if (n.isUnmounted) return;801 pauseTracking(), setCurrentInstance(n);802 const o = callWithAsyncErrorHandling(t, n, e, r);803 return setCurrentInstance(null), resetTracking(), o804 });805 return r ? o.unshift(s) : o.push(s), s806 }807}808const createHook = e => (t, n = Ye) => (!Xe || "sp" === e) && injectHook(e, t, n), _e = createHook("bm"),809 ke = createHook("m"), xe = createHook("bu"), Se = createHook("u"), Ee = createHook("bum"), Ce = createHook("um"),810 Ae = createHook("sp"), Oe = createHook("rtg"), Pe = createHook("rtc");811function onErrorCaptured(e, t = Ye) {812 injectHook("ec", e, t)813}814let Te = !0;815function applyOptions(e) {816 const t = resolveMergedOptions(e), n = e.proxy, r = e.ctx;817 Te = !1, t.beforeCreate && callHook(t.beforeCreate, e, "bc");818 const {819 data: o,820 computed: s,821 methods: a,822 watch: i,823 provide: l,824 inject: c,825 created: u,826 beforeMount: f,827 mounted: p,828 beforeUpdate: d,829 updated: m,830 activated: v,831 deactivated: y,832 beforeDestroy: b,833 beforeUnmount: R,834 destroyed: _,835 unmounted: k,836 render: x,837 renderTracked: S,838 renderTriggered: E,839 errorCaptured: C,840 serverPrefetch: A,841 expose: O,842 inheritAttrs: P,843 components: T,844 directives: j,845 filters: N846 } = t;847 if (c && function resolveInjections(e, t, n = NOOP) {848 w(e) && (e = normalizeInject(e));849 for (const r in e) {850 const n = e[r];851 isObject(n) ? t[r] = "default" in n ? inject(n.from || r, n.default, !0) : inject(n.from || r) : t[r] = inject(n)852 }853 }(c, r, null), a) for (const g in a) {854 const e = a[g];855 isFunction(e) && (r[g] = e.bind(n))856 }857 if (o) {858 const t = o.call(n, n);859 isObject(t) && (e.data = reactive(t))860 }861 if (Te = !0, s) for (const g in s) {862 const e = s[g], t = computed({863 get: isFunction(e) ? e.bind(n, n) : isFunction(e.get) ? e.get.bind(n, n) : NOOP,864 set: !isFunction(e) && isFunction(e.set) ? e.set.bind(n) : NOOP865 });866 Object.defineProperty(r, g, {enumerable: !0, configurable: !0, get: () => t.value, set: e => t.value = e})867 }868 if (i) for (const g in i) createWatcher(i[g], r, n, g);869 if (l) {870 const e = isFunction(l) ? l.call(n) : l;871 Reflect.ownKeys(e).forEach((t => {872 provide(t, e[t])873 }))874 }875 function registerLifecycleHook(e, t) {876 w(t) ? t.forEach((t => e(t.bind(n)))) : t && e(t.bind(n))877 }878 if (u && callHook(u, e, "c"), registerLifecycleHook(_e, f), registerLifecycleHook(ke, p), registerLifecycleHook(xe, d), registerLifecycleHook(Se, m), registerLifecycleHook(onActivated, v), registerLifecycleHook(onDeactivated, y), registerLifecycleHook(onErrorCaptured, C), registerLifecycleHook(Pe, S), registerLifecycleHook(Oe, E), registerLifecycleHook(Ee, R), registerLifecycleHook(Ce, k), registerLifecycleHook(Ae, A), w(O)) if (O.length) {879 const t = e.exposed || (e.exposed = proxyRefs({}));880 O.forEach((e => {881 t[e] = function toRef(e, t) {882 return isRef(e[t]) ? e[t] : new ObjectRefImpl(e, t)883 }(n, e)884 }))885 } else e.exposed || (e.exposed = g);886 x && e.render === NOOP && (e.render = x), null != P && (e.inheritAttrs = P), T && (e.components = T), j && (e.directives = j)887}888function callHook(e, t, n) {889 callWithAsyncErrorHandling(w(e) ? e.map((e => e.bind(t.proxy))) : e.bind(t.proxy), t, n)890}891function createWatcher(e, t, n, r) {892 const o = r.includes(".") ? createPathGetter(n, r) : () => n[r];893 if (isString$1(e)) {894 const n = t[e];895 isFunction(n) && watch(o, n)896 } else if (isFunction(e)) watch(o, e.bind(n)); else if (isObject(e)) if (w(e)) e.forEach((e => createWatcher(e, t, n, r))); else {897 const r = isFunction(e.handler) ? e.handler.bind(n) : t[e.handler];898 isFunction(r) && watch(o, r, e)899 }900}901function resolveMergedOptions(e) {902 const t = e.type, {mixins: n, extends: r} = t, {903 mixins: o,904 optionsCache: s,905 config: {optionMergeStrategies: a}906 } = e.appContext, i = s.get(t);907 let l;908 return i ? l = i : o.length || n || r ? (l = {}, o.length && o.forEach((e => mergeOptions$1(l, e, a, !0))), mergeOptions$1(l, t, a)) : l = t, s.set(t, l), l909}910function mergeOptions$1(e, t, n, r = !1) {911 const {mixins: o, extends: s} = t;912 s && mergeOptions$1(e, s, n, !0), o && o.forEach((t => mergeOptions$1(e, t, n, !0)));913 for (const a in t) if (r && "expose" === a) ; else {914 const r = je[a] || n && n[a];915 e[a] = r ? r(e[a], t[a]) : t[a]916 }917 return e918}919const je = {920 data: mergeDataFn,921 props: mergeObjectOptions,922 emits: mergeObjectOptions,923 methods: mergeObjectOptions,924 computed: mergeObjectOptions,925 beforeCreate: mergeAsArray,926 created: mergeAsArray,927 beforeMount: mergeAsArray,928 mounted: mergeAsArray,929 beforeUpdate: mergeAsArray,930 updated: mergeAsArray,931 beforeDestroy: mergeAsArray,932 destroyed: mergeAsArray,933 activated: mergeAsArray,934 deactivated: mergeAsArray,935 errorCaptured: mergeAsArray,936 serverPrefetch: mergeAsArray,937 components: mergeObjectOptions,938 directives: mergeObjectOptions,939 watch: function mergeWatchOptions(e, t) {940 if (!e) return t;941 if (!t) return e;942 const n = b(Object.create(null), e);943 for (const r in t) n[r] = mergeAsArray(e[r], t[r]);944 return n945 },946 provide: mergeDataFn,947 inject: function mergeInject(e, t) {948 return mergeObjectOptions(normalizeInject(e), normalizeInject(t))949 }950};951function mergeDataFn(e, t) {952 return t ? e ? function mergedDataFn() {953 return b(isFunction(e) ? e.call(this, this) : e, isFunction(t) ? t.call(this, this) : t)954 } : t : e955}956function normalizeInject(e) {957 if (w(e)) {958 const t = {};959 for (let n = 0; n < e.length; n++) t[e[n]] = e[n];960 return t961 }962 return e963}964function mergeAsArray(e, t) {965 return e ? [...new Set([].concat(e, t))] : t966}967function mergeObjectOptions(e, t) {968 return e ? b(b(Object.create(null), e), t) : t969}970function initProps(e, t, n, r = !1) {971 const o = {}, s = {};972 def(s, Ue, 1), e.propsDefaults = Object.create(null), setFullProps(e, t, o, s);973 for (const a in e.propsOptions[0]) a in o || (o[a] = void 0);974 n ? e.props = r ? o : function shallowReactive(e) {975 return createReactiveObject(e, !1, q, Z, ne)976 }(o) : e.type.props ? e.props = o : e.props = s, e.attrs = s977}978function setFullProps(e, t, n, r) {979 const [o, s] = e.propsOptions;980 let a, i = !1;981 if (t) for (let l in t) {982 if (k(l)) continue;983 const c = t[l];984 let u;985 o && hasOwn(o, u = S(l)) ? s && s.includes(u) ? (a || (a = {}))[u] = c : n[u] = c : isEmitListener(e.emitsOptions, l) || c !== r[l] && (r[l] = c, i = !0)986 }987 if (s) {988 const t = toRaw(n), r = a || g;989 for (let a = 0; a < s.length; a++) {990 const i = s[a];991 n[i] = resolvePropValue(o, t, i, r[i], e, !hasOwn(r, i))992 }993 }994 return i995}996function resolvePropValue(e, t, n, r, o, s) {997 const a = e[n];998 if (null != a) {999 const e = hasOwn(a, "default");1000 if (e && void 0 === r) {1001 const e = a.default;1002 if (a.type !== Function && isFunction(e)) {1003 const {propsDefaults: s} = o;1004 n in s ? r = s[n] : (setCurrentInstance(o), r = s[n] = e.call(null, t), setCurrentInstance(null))1005 } else r = e1006 }1007 a[0] && (s && !e ? r = !1 : !a[1] || "" !== r && r !== C(n) || (r = !0))1008 }1009 return r1010}1011function normalizePropsOptions(e, t, n = !1) {1012 const r = t.propsCache, o = r.get(e);1013 if (o) return o;1014 const s = e.props, a = {}, i = [];1015 let l = !1;1016 if (!isFunction(e)) {1017 const extendProps = e => {1018 l = !0;1019 const [n, r] = normalizePropsOptions(e, t, !0);1020 b(a, n), r && i.push(...r)1021 };1022 !n && t.mixins.length && t.mixins.forEach(extendProps), e.extends && extendProps(e.extends), e.mixins && e.mixins.forEach(extendProps)1023 }1024 if (!s && !l) return r.set(e, v), v;1025 if (w(s)) for (let u = 0; u < s.length; u++) {1026 const e = S(s[u]);1027 validatePropName(e) && (a[e] = g)1028 } else if (s) for (const u in s) {1029 const e = S(u);1030 if (validatePropName(e)) {1031 const t = s[u], n = a[e] = w(t) || isFunction(t) ? {type: t} : t;1032 if (n) {1033 const t = getTypeIndex(Boolean, n.type), r = getTypeIndex(String, n.type);1034 n[0] = t > -1, n[1] = r < 0 || t < r, (t > -1 || hasOwn(n, "default")) && i.push(e)1035 }1036 }1037 }1038 const c = [a, i];1039 return r.set(e, c), c1040}1041function validatePropName(e) {1042 return "$" !== e[0]1043}1044function getType(e) {1045 const t = e && e.toString().match(/^\s*function (\w+)/);1046 return t ? t[1] : ""1047}1048function isSameType(e, t) {1049 return getType(e) === getType(t)1050}1051function getTypeIndex(e, t) {1052 return w(t) ? t.findIndex((t => isSameType(t, e))) : isFunction(t) && isSameType(t, e) ? 0 : -11053}1054const isInternalKey = e => "_" === e[0] || "$stable" === e,1055 normalizeSlotValue = e => w(e) ? e.map(normalizeVNode) : [normalizeVNode(e)], normalizeSlot$1 = (e, t, n) => {1056 const r = withCtx((e => normalizeSlotValue(t(e))), n);1057 return r._c = !1, r1058 }, normalizeObjectSlots = (e, t, n) => {1059 const r = e._ctx;1060 for (const o in e) {1061 if (isInternalKey(o)) continue;1062 const n = e[o];1063 if (isFunction(n)) t[o] = normalizeSlot$1(0, n, r); else if (null != n) {1064 const e = normalizeSlotValue(n);1065 t[o] = () => e1066 }1067 }1068 }, normalizeVNodeSlots = (e, t) => {1069 const n = normalizeSlotValue(t);1070 e.slots.default = () => n1071 };1072function withDirectives(e, t) {1073 if (null === be) return e;1074 const n = be.proxy, r = e.dirs || (e.dirs = []);1075 for (let o = 0; o < t.length; o++) {1076 let [e, s, a, i = g] = t[o];1077 isFunction(e) && (e = {mounted: e, updated: e}), r.push({1078 dir: e,1079 instance: n,1080 value: s,1081 oldValue: void 0,1082 arg: a,1083 modifiers: i1084 })1085 }1086 return e1087}1088function invokeDirectiveHook(e, t, n, r) {1089 const o = e.dirs, s = t && t.dirs;1090 for (let a = 0; a < o.length; a++) {1091 const i = o[a];1092 s && (i.oldValue = s[a].value);1093 let l = i.dir[r];1094 l && (pauseTracking(), callWithAsyncErrorHandling(l, n, 8, [e.el, i, e, t]), resetTracking())1095 }1096}1097function createAppContext() {1098 return {1099 app: null,1100 config: {1101 isNativeTag: NO,1102 performance: !1,1103 globalProperties: {},1104 optionMergeStrategies: {},1105 errorHandler: void 0,1106 warnHandler: void 0,1107 compilerOptions: {}1108 },1109 mixins: [],1110 components: {},1111 directives: {},1112 provides: Object.create(null),1113 optionsCache: new WeakMap,1114 propsCache: new WeakMap,1115 emitsCache: new WeakMap1116 }1117}1118let Ne = 0;1119function createAppAPI(e, t) {1120 return function createApp2(n, r = null) {1121 null == r || isObject(r) || (r = null);1122 const o = createAppContext(), s = new Set;1123 let a = !1;1124 const i = o.app = {1125 _uid: Ne++,1126 _component: n,1127 _props: r,1128 _container: null,1129 _context: o,1130 _instance: null,1131 version: Ze,1132 get config() {1133 return o.config1134 },1135 set config(e) {1136 },1137 use: (e, ...t) => (s.has(e) || (e && isFunction(e.install) ? (s.add(e), e.install(i, ...t)) : isFunction(e) && (s.add(e), e(i, ...t))), i),1138 mixin: e => (o.mixins.includes(e) || o.mixins.push(e), i),1139 component: (e, t) => t ? (o.components[e] = t, i) : o.components[e],1140 directive: (e, t) => t ? (o.directives[e] = t, i) : o.directives[e],1141 mount(s, l, c) {1142 if (!a) {1143 const u = De(n, r);1144 return u.appContext = o, l && t ? t(u, s) : e(u, s, c), a = !0, i._container = s, s.__vue_app__ = i, u.component.proxy1145 }1146 },1147 unmount() {1148 a && (e(null, i._container), delete i._container.__vue_app__)1149 },1150 provide: (e, t) => (o.provides[e] = t, i)1151 };1152 return i1153 }1154}1155const Ie = {scheduler: queueJob, allowRecurse: !0}, Me = function queueEffectWithSuspense(e, t) {1156 t && t.pendingBranch ? w(e) ? t.effects.push(...e) : t.effects.push(e) : function queuePostFlushCb(e) {1157 queueCb(e, he, de, me)1158 }(e)1159}, setRef = (e, t, n, r, o = !1) => {1160 if (w(e)) return void e.forEach(((e, s) => setRef(e, t && (w(t) ? t[s] : t), n, r, o)));1161 if (isAsyncWrapper(r) && !o) return;1162 const s = 4 & r.shapeFlag ? r.component.exposed || r.component.proxy : r.el, a = o ? null : s, {i, r: l} = e,1163 c = t && t.r, u = i.refs === g ? i.refs = {} : i.refs, f = i.setupState;1164 if (null != c && c !== l && (isString$1(c) ? (u[c] = null, hasOwn(f, c) && (f[c] = null)) : isRef(c) && (c.value = null)), isString$1(l)) {1165 const doSet = () => {1166 u[l] = a, hasOwn(f, l) && (f[l] = a)1167 };1168 a ? (doSet.id = -1, Me(doSet, n)) : doSet()1169 } else if (isRef(l)) {1170 const doSet = () => {1171 l.value = a1172 };1173 a ? (doSet.id = -1, Me(doSet, n)) : doSet()1174 } else isFunction(l) && callWithErrorHandling(l, i, 12, [a, u])1175};1176function createRenderer(e) {1177 return function baseCreateRenderer(e, t) {1178 const {1179 insert: n,1180 remove: r,1181 patchProp: o,1182 forcePatchProp: s,1183 createElement: a,1184 createText: i,1185 createComment: l,1186 setText: c,1187 setElementText: u,1188 parentNode: f,1189 nextSibling: p,1190 setScopeId: d = NOOP,1191 cloneNode: m,1192 insertStaticContent: y1193 } = e, patch = (e, t, n, r = null, o = null, s = null, a = !1, i = null, l = !1) => {1194 e && !isSameVNodeType(e, t) && (r = getNextHostNode(e), unmount(e, o, s, !0), e = null), -2 === t.patchFlag && (l = !1, t.dynamicChildren = null);1195 const {type: c, ref: u, shapeFlag: f} = t;1196 switch (c) {1197 case Ve:1198 processText(e, t, n, r);1199 break;1200 case He:1201 processCommentNode(e, t, n, r);1202 break;1203 case Be:1204 null == e && mountStaticNode(t, n, r, a);1205 break;1206 case Le:1207 processFragment(e, t, n, r, o, s, a, i, l);1208 break;1209 default:1210 1 & f ? processElement(e, t, n, r, o, s, a, i, l) : 6 & f ? processComponent(e, t, n, r, o, s, a, i, l) : (64 & f || 128 & f) && c.process(e, t, n, r, o, s, a, i, l, R)1211 }1212 null != u && o && setRef(u, e && e.ref, s, t || e, !t)1213 }, processText = (e, t, r, o) => {1214 if (null == e) n(t.el = i(t.children), r, o); else {1215 const n = t.el = e.el;1216 t.children !== e.children && c(n, t.children)1217 }1218 }, processCommentNode = (e, t, r, o) => {1219 null == e ? n(t.el = l(t.children || ""), r, o) : t.el = e.el1220 }, mountStaticNode = (e, t, n, r) => {1221 [e.el, e.anchor] = y(e.children, t, n, r, e.el && [e.el, e.anchor])1222 }, moveStaticNode = ({el: e, anchor: t}, r, o) => {1223 let s;1224 for (; e && e !== t;) s = p(e), n(e, r, o), e = s;1225 n(t, r, o)1226 }, removeStaticNode = ({el: e, anchor: t}) => {1227 let n;1228 for (; e && e !== t;) n = p(e), r(e), e = n;1229 r(t)1230 }, processElement = (e, t, n, r, o, s, a, i, l) => {1231 a = a || "svg" === t.type, null == e ? mountElement(t, n, r, o, s, a, i, l) : patchElement(e, t, o, s, a, i, l)1232 }, mountElement = (e, t, r, s, i, l, c, f) => {1233 let p, d;1234 const {type: g, props: v, shapeFlag: y, transition: b, patchFlag: R, dirs: w} = e;1235 if (e.el && void 0 !== m && -1 === R) p = e.el = m(e.el); else {1236 if (p = e.el = a(e.type, l, v && v.is, v), 8 & y ? u(p, e.children) : 16 & y && mountChildren(e.children, p, null, s, i, l && "foreignObject" !== g, c, f || !!e.dynamicChildren), w && invokeDirectiveHook(e, null, s, "created"), v) {1237 for (const t in v) k(t) || o(p, t, null, v[t], l, e.children, s, i, unmountChildren);1238 (d = v.onVnodeBeforeMount) && invokeVNodeHook(d, s, e)1239 }1240 setScopeId(p, e, e.scopeId, c, s)1241 }1242 w && invokeDirectiveHook(e, null, s, "beforeMount");1243 const _ = (!i || i && !i.pendingBranch) && b && !b.persisted;1244 _ && b.beforeEnter(p), n(p, t, r), ((d = v && v.onVnodeMounted) || _ || w) && Me((() => {1245 d && invokeVNodeHook(d, s, e), _ && b.enter(p), w && invokeDirectiveHook(e, null, s, "mounted")1246 }), i)1247 }, setScopeId = (e, t, n, r, o) => {1248 if (n && d(e, n), r) for (let s = 0; s < r.length; s++) d(e, r[s]);1249 if (o) {1250 if (t === o.subTree) {1251 const t = o.vnode;1252 setScopeId(e, t, t.scopeId, t.slotScopeIds, o.parent)1253 }1254 }1255 }, mountChildren = (e, t, n, r, o, s, a, i, l = 0) => {1256 for (let c = l; c < e.length; c++) {1257 const l = e[c] = i ? cloneIfMounted(e[c]) : normalizeVNode(e[c]);1258 patch(null, l, t, n, r, o, s, a, i)1259 }1260 }, patchElement = (e, t, n, r, a, i, l) => {1261 const c = t.el = e.el;1262 let {patchFlag: f, dynamicChildren: p, dirs: d} = t;1263 f |= 16 & e.patchFlag;1264 const m = e.props || g, v = t.props || g;1265 let y;1266 if ((y = v.onVnodeBeforeUpdate) && invokeVNodeHook(y, n, t, e), d && invokeDirectiveHook(t, e, n, "beforeUpdate"), f > 0) {1267 if (16 & f) patchProps(c, t, m, v, n, r, a); else if (2 & f && m.class !== v.class && o(c, "class", null, v.class, a), 4 & f && o(c, "style", m.style, v.style, a), 8 & f) {1268 const i = t.dynamicProps;1269 for (let t = 0; t < i.length; t++) {1270 const l = i[t], u = m[l], f = v[l];1271 (f !== u || s && s(c, l)) && o(c, l, u, f, a, e.children, n, r, unmountChildren)1272 }1273 }1274 1 & f && e.children !== t.children && u(c, t.children)1275 } else l || null != p || patchProps(c, t, m, v, n, r, a);1276 const b = a && "foreignObject" !== t.type;1277 p ? patchBlockChildren(e.dynamicChildren, p, c, n, r, b, i) : l || patchChildren(e, t, c, null, n, r, b, i, !1), ((y = v.onVnodeUpdated) || d) && Me((() => {1278 y && invokeVNodeHook(y, n, t, e), d && invokeDirectiveHook(t, e, n, "updated")1279 }), r)1280 }, patchBlockChildren = (e, t, n, r, o, s, a) => {1281 for (let i = 0; i < t.length; i++) {1282 const l = e[i], c = t[i],1283 u = l.el && (l.type === Le || !isSameVNodeType(l, c) || 6 & l.shapeFlag || 64 & l.shapeFlag) ? f(l.el) : n;1284 patch(l, c, u, null, r, o, s, a, !0)1285 }1286 }, patchProps = (e, t, n, r, a, i, l) => {1287 if (n !== r) {1288 for (const c in r) {1289 if (k(c)) continue;1290 const u = r[c], f = n[c];1291 (u !== f || s && s(e, c)) && o(e, c, f, u, l, t.children, a, i, unmountChildren)1292 }1293 if (n !== g) for (const s in n) k(s) || s in r || o(e, s, n[s], null, l, t.children, a, i, unmountChildren)1294 }1295 }, processFragment = (e, t, r, o, s, a, l, c, u) => {1296 const f = t.el = e ? e.el : i(""), p = t.anchor = e ? e.anchor : i("");1297 let {patchFlag: d, dynamicChildren: m, slotScopeIds: g} = t;1298 m && (u = !0), g && (c = c ? c.concat(g) : g), null == e ? (n(f, r, o), n(p, r, o), mountChildren(t.children, r, p, s, a, l, c, u)) : d > 0 && 64 & d && m && e.dynamicChildren ? (patchBlockChildren(e.dynamicChildren, m, r, s, a, l, c), (null != t.key || s && t === s.subTree) && traverseStaticChildren(e, t, !0)) : patchChildren(e, t, r, p, s, a, l, c, u)1299 }, processComponent = (e, t, n, r, o, s, a, i, l) => {1300 t.slotScopeIds = i, null == e ? 512 & t.shapeFlag ? o.ctx.activate(t, n, r, a, l) : mountComponent(t, n, r, o, s, a, l) : updateComponent(e, t, l)1301 }, mountComponent = (e, t, n, r, o, s, a) => {1302 const i = e.component = function createComponentInstance(e, t, n) {1303 const r = e.type, o = (t ? t.appContext : e.appContext) || Qe, s = {1304 uid: Je++,1305 vnode: e,1306 type: r,1307 parent: t,1308 appContext: o,1309 root: null,1310 next: null,1311 subTree: null,1312 update: null,1313 render: null,1314 proxy: null,1315 exposed: null,1316 withProxy: null,1317 effects: null,1318 provides: t ? t.provides : Object.create(o.provides),1319 accessCache: null,1320 renderCache: [],1321 components: null,1322 directives: null,1323 propsOptions: normalizePropsOptions(r, o),1324 emitsOptions: normalizeEmitsOptions(r, o),1325 emit: null,1326 emitted: null,1327 propsDefaults: g,1328 inheritAttrs: r.inheritAttrs,1329 ctx: g,1330 data: g,1331 props: g,1332 attrs: g,1333 slots: g,1334 refs: g,1335 setupState: g,1336 setupContext: null,1337 suspense: n,1338 suspenseId: n ? n.pendingId : 0,1339 asyncDep: null,1340 asyncResolved: !1,1341 isMounted: !1,1342 isUnmounted: !1,1343 isDeactivated: !1,1344 bc: null,1345 c: null,1346 bm: null,1347 m: null,1348 bu: null,1349 u: null,1350 um: null,1351 bum: null,1352 da: null,1353 a: null,1354 rtg: null,1355 rtc: null,1356 ec: null,1357 sp: null1358 };1359 return s.ctx = {_: s}, s.root = t ? t.root : s, s.emit = emit.bind(null, s), s1360 }(e, r, o);1361 if (isKeepAlive(e) && (i.ctx.renderer = R), function setupComponent(e, t = !1) {1362 Xe = t;1363 const {props: n, children: r} = e.vnode, o = isStatefulComponent(e);1364 initProps(e, n, o, t), ((e, t) => {1365 if (32 & e.vnode.shapeFlag) {1366 const n = t._;1367 n ? (e.slots = toRaw(t), def(t, "_", n)) : normalizeObjectSlots(t, e.slots = {})1368 } else e.slots = {}, t && normalizeVNodeSlots(e, t);1369 def(e.slots, Ue, 1)1370 })(e, r);1371 const s = o ? function setupStatefulComponent(e, t) {1372 const n = e.type;1373 e.accessCache = Object.create(null), e.proxy = function markRaw(e) {1374 return def(e, "__v_skip", !0), e1375 }(new Proxy(e.ctx, qe));1376 const {setup: r} = n;1377 if (r) {1378 const n = e.setupContext = r.length > 1 ? function createSetupContext(e) {1379 const expose = t => {1380 e.exposed = proxyRefs(t)1381 };1382 return {attrs: e.attrs, slots: e.slots, emit: e.emit, expose}1383 }(e) : null;1384 Ye = e, pauseTracking();1385 const o = callWithErrorHandling(r, e, 0, [e.props, n]);1386 if (resetTracking(), Ye = null, isPromise(o)) {1387 if (t) return o.then((t => {1388 handleSetupResult(e, t)1389 })).catch((t => {1390 handleError(t, e, 0)1391 }));1392 e.asyncDep = o1393 } else handleSetupResult(e, o)1394 } else finishComponentSetup(e)1395 }(e, t) : void 0;1396 return Xe = !1, s1397 }(i), i.asyncDep) {1398 if (o && o.registerDep(i, setupRenderEffect), !e.el) {1399 const e = i.subTree = De(He);1400 processCommentNode(null, e, t, n)1401 }1402 } else setupRenderEffect(i, e, t, n, o, s, a)1403 }, updateComponent = (e, t, n) => {1404 const r = t.component = e.component;1405 if (function shouldUpdateComponent(e, t, n) {1406 const {props: r, children: o, component: s} = e, {props: a, children: i, patchFlag: l} = t, c = s.emitsOptions;1407 if (t.dirs || t.transition) return !0;1408 if (!(n && l >= 0)) return !(!o && !i || i && i.$stable) || r !== a && (r ? !a || hasPropsChanged(r, a, c) : !!a);1409 if (1024 & l) return !0;1410 if (16 & l) return r ? hasPropsChanged(r, a, c) : !!a;1411 if (8 & l) {1412 const e = t.dynamicProps;1413 for (let t = 0; t < e.length; t++) {1414 const n = e[t];1415 if (a[n] !== r[n] && !isEmitListener(c, n)) return !01416 }1417 }1418 return !11419 }(e, t, n)) {1420 if (r.asyncDep && !r.asyncResolved) return void updateComponentPreRender(r, t, n);1421 r.next = t, function invalidateJob(e) {1422 const t = le.indexOf(e);1423 t > ce && le.splice(t, 1)1424 }(r.update), r.update()1425 } else t.component = e.component, t.el = e.el, r.vnode = t1426 }, setupRenderEffect = (e, t, n, r, o, s, a) => {1427 e.update = effect((function componentEffect() {1428 if (e.isMounted) {1429 let t, {next: n, bu: r, u: i, parent: l, vnode: c} = e, u = n;...

Full Screen

Full Screen

index.147aad71.js

Source:index.147aad71.js Github

copy

Full Screen

...1064 extend(normalized, raw);1065 }1066 return comp.__emits = normalized;1067}1068function isEmitListener(options, key) {1069 if (!options || !isOn(key)) {1070 return false;1071 }1072 key = key.replace(/Once$/, "");1073 return hasOwn(options, key[2].toLowerCase() + key.slice(3)) || hasOwn(options, key.slice(2));1074}1075let currentRenderingInstance = null;1076function setCurrentRenderingInstance(instance) {1077 currentRenderingInstance = instance;1078}1079let accessedAttrs = false;1080function markAttrsAccessed() {1081 accessedAttrs = true;1082}1083function renderComponentRoot(instance) {1084 const {type: Component, vnode, proxy, withProxy, props, propsOptions: [propsOptions], slots, attrs, emit: emit2, render: render2, renderCache, data, setupState, ctx} = instance;1085 let result;1086 currentRenderingInstance = instance;1087 try {1088 let fallthroughAttrs;1089 if (vnode.shapeFlag & 4) {1090 const proxyToUse = withProxy || proxy;1091 result = normalizeVNode(render2.call(proxyToUse, proxyToUse, renderCache, props, setupState, data, ctx));1092 fallthroughAttrs = attrs;1093 } else {1094 const render3 = Component;1095 if (false)1096 ;1097 result = normalizeVNode(render3.length > 1 ? render3(props, {attrs, slots, emit: emit2}) : render3(props, null));1098 fallthroughAttrs = Component.props ? attrs : getFunctionalFallthrough(attrs);1099 }1100 let root = result;1101 let setRoot = void 0;1102 if (false)1103 ;1104 if (Component.inheritAttrs !== false && fallthroughAttrs) {1105 const keys = Object.keys(fallthroughAttrs);1106 const {shapeFlag} = root;1107 if (keys.length) {1108 if (shapeFlag & 1 || shapeFlag & 6) {1109 if (propsOptions && keys.some(isModelListener)) {1110 fallthroughAttrs = filterModelListeners(fallthroughAttrs, propsOptions);1111 }1112 root = cloneVNode(root, fallthroughAttrs);1113 } else if (false)1114 ;1115 }1116 }1117 if (vnode.dirs) {1118 if (false)1119 ;1120 root.dirs = root.dirs ? root.dirs.concat(vnode.dirs) : vnode.dirs;1121 }1122 if (vnode.transition) {1123 if (false)1124 ;1125 root.transition = vnode.transition;1126 }1127 if (false)1128 ;1129 else {1130 result = root;1131 }1132 } catch (err) {1133 handleError(err, instance, 1);1134 result = createVNode(Comment);1135 }1136 currentRenderingInstance = null;1137 return result;1138}1139const getChildRoot = (vnode) => {1140 if (vnode.type !== Fragment) {1141 return [vnode, void 0];1142 }1143 const rawChildren = vnode.children;1144 const dynamicChildren = vnode.dynamicChildren;1145 const childRoot = filterSingleRoot(rawChildren);1146 if (!childRoot) {1147 return [vnode, void 0];1148 }1149 const index = rawChildren.indexOf(childRoot);1150 const dynamicIndex = dynamicChildren ? dynamicChildren.indexOf(childRoot) : -1;1151 const setRoot = (updatedRoot) => {1152 rawChildren[index] = updatedRoot;1153 if (dynamicChildren) {1154 if (dynamicIndex > -1) {1155 dynamicChildren[dynamicIndex] = updatedRoot;1156 } else if (updatedRoot.patchFlag > 0) {1157 vnode.dynamicChildren = [...dynamicChildren, updatedRoot];1158 }1159 }1160 };1161 return [normalizeVNode(childRoot), setRoot];1162};1163function filterSingleRoot(children) {1164 const filtered = children.filter((child) => {1165 return !(isVNode(child) && child.type === Comment && child.children !== "v-if");1166 });1167 return filtered.length === 1 && isVNode(filtered[0]) ? filtered[0] : null;1168}1169const getFunctionalFallthrough = (attrs) => {1170 let res;1171 for (const key in attrs) {1172 if (key === "class" || key === "style" || isOn(key)) {1173 (res || (res = {}))[key] = attrs[key];1174 }1175 }1176 return res;1177};1178const filterModelListeners = (attrs, props) => {1179 const res = {};1180 for (const key in attrs) {1181 if (!isModelListener(key) || !(key.slice(9) in props)) {1182 res[key] = attrs[key];1183 }1184 }1185 return res;1186};1187const isElementRoot = (vnode) => {1188 return vnode.shapeFlag & 6 || vnode.shapeFlag & 1 || vnode.type === Comment;1189};1190function shouldUpdateComponent(prevVNode, nextVNode, optimized) {1191 const {props: prevProps, children: prevChildren, component} = prevVNode;1192 const {props: nextProps, children: nextChildren, patchFlag} = nextVNode;1193 const emits = component.emitsOptions;1194 if (nextVNode.dirs || nextVNode.transition) {1195 return true;1196 }1197 if (optimized && patchFlag > 0) {1198 if (patchFlag & 1024) {1199 return true;1200 }1201 if (patchFlag & 16) {1202 if (!prevProps) {1203 return !!nextProps;1204 }1205 return hasPropsChanged(prevProps, nextProps, emits);1206 } else if (patchFlag & 8) {1207 const dynamicProps = nextVNode.dynamicProps;1208 for (let i = 0; i < dynamicProps.length; i++) {1209 const key = dynamicProps[i];1210 if (nextProps[key] !== prevProps[key] && !isEmitListener(emits, key)) {1211 return true;1212 }1213 }1214 }1215 } else {1216 if (prevChildren || nextChildren) {1217 if (!nextChildren || !nextChildren.$stable) {1218 return true;1219 }1220 }1221 if (prevProps === nextProps) {1222 return false;1223 }1224 if (!prevProps) {1225 return !!nextProps;1226 }1227 if (!nextProps) {1228 return true;1229 }1230 return hasPropsChanged(prevProps, nextProps, emits);1231 }1232 return false;1233}1234function hasPropsChanged(prevProps, nextProps, emitsOptions) {1235 const nextKeys = Object.keys(nextProps);1236 if (nextKeys.length !== Object.keys(prevProps).length) {1237 return true;1238 }1239 for (let i = 0; i < nextKeys.length; i++) {1240 const key = nextKeys[i];1241 if (nextProps[key] !== prevProps[key] && !isEmitListener(emitsOptions, key)) {1242 return true;1243 }1244 }1245 return false;1246}1247function updateHOCHostEl({vnode, parent}, el) {1248 while (parent && parent.subTree === vnode) {1249 (vnode = parent.vnode).el = el;1250 parent = parent.parent;1251 }1252}1253const isSuspense = (type) => type.__isSuspense;1254function normalizeSuspenseChildren(vnode) {1255 const {shapeFlag, children} = vnode;1256 let content;1257 let fallback;1258 if (shapeFlag & 32) {1259 content = normalizeSuspenseSlot(children.default);1260 fallback = normalizeSuspenseSlot(children.fallback);1261 } else {1262 content = normalizeSuspenseSlot(children);1263 fallback = normalizeVNode(null);1264 }1265 return {1266 content,1267 fallback1268 };1269}1270function normalizeSuspenseSlot(s) {1271 if (isFunction(s)) {1272 s = s();1273 }1274 if (isArray(s)) {1275 const singleChild = filterSingleRoot(s);1276 s = singleChild;1277 }1278 return normalizeVNode(s);1279}1280function queueEffectWithSuspense(fn, suspense) {1281 if (suspense && suspense.pendingBranch) {1282 if (isArray(fn)) {1283 suspense.effects.push(...fn);1284 } else {1285 suspense.effects.push(fn);1286 }1287 } else {1288 queuePostFlushCb(fn);1289 }1290}1291let isRenderingCompiledSlot = 0;1292const setCompiledSlotRendering = (n) => isRenderingCompiledSlot += n;1293function renderSlot(slots, name, props = {}, fallback) {1294 let slot = slots[name];1295 isRenderingCompiledSlot++;1296 const rendered = (openBlock(), createBlock(Fragment, {key: props.key}, slot ? slot(props) : fallback ? fallback() : [], slots._ === 1 ? 64 : -2));1297 isRenderingCompiledSlot--;1298 return rendered;1299}1300function withCtx(fn, ctx = currentRenderingInstance) {1301 if (!ctx)1302 return fn;1303 const renderFnWithContext = (...args) => {1304 if (!isRenderingCompiledSlot) {1305 openBlock(true);1306 }1307 const owner = currentRenderingInstance;1308 setCurrentRenderingInstance(ctx);1309 const res = fn(...args);1310 setCurrentRenderingInstance(owner);1311 if (!isRenderingCompiledSlot) {1312 closeBlock();1313 }1314 return res;1315 };1316 renderFnWithContext._c = true;1317 return renderFnWithContext;1318}1319let currentScopeId = null;1320function initProps(instance, rawProps, isStateful, isSSR = false) {1321 const props = {};1322 const attrs = {};1323 def(attrs, InternalObjectKey, 1);1324 setFullProps(instance, rawProps, props, attrs);1325 if (isStateful) {1326 instance.props = isSSR ? props : shallowReactive(props);1327 } else {1328 if (!instance.type.props) {1329 instance.props = attrs;1330 } else {1331 instance.props = props;1332 }1333 }1334 instance.attrs = attrs;1335}1336function updateProps(instance, rawProps, rawPrevProps, optimized) {1337 const {props, attrs, vnode: {patchFlag}} = instance;1338 const rawCurrentProps = toRaw(props);1339 const [options] = instance.propsOptions;1340 if ((optimized || patchFlag > 0) && !(patchFlag & 16)) {1341 if (patchFlag & 8) {1342 const propsToUpdate = instance.vnode.dynamicProps;1343 for (let i = 0; i < propsToUpdate.length; i++) {1344 const key = propsToUpdate[i];1345 const value = rawProps[key];1346 if (options) {1347 if (hasOwn(attrs, key)) {1348 attrs[key] = value;1349 } else {1350 const camelizedKey = camelize(key);1351 props[camelizedKey] = resolvePropValue(options, rawCurrentProps, camelizedKey, value, instance);1352 }1353 } else {1354 attrs[key] = value;1355 }1356 }1357 }1358 } else {1359 setFullProps(instance, rawProps, props, attrs);1360 let kebabKey;1361 for (const key in rawCurrentProps) {1362 if (!rawProps || !hasOwn(rawProps, key) && ((kebabKey = hyphenate(key)) === key || !hasOwn(rawProps, kebabKey))) {1363 if (options) {1364 if (rawPrevProps && (rawPrevProps[key] !== void 0 || rawPrevProps[kebabKey] !== void 0)) {1365 props[key] = resolvePropValue(options, rawProps || EMPTY_OBJ, key, void 0, instance);1366 }1367 } else {1368 delete props[key];1369 }1370 }1371 }1372 if (attrs !== rawCurrentProps) {1373 for (const key in attrs) {1374 if (!rawProps || !hasOwn(rawProps, key)) {1375 delete attrs[key];1376 }1377 }1378 }1379 }1380 trigger(instance, "set", "$attrs");1381}1382function setFullProps(instance, rawProps, props, attrs) {1383 const [options, needCastKeys] = instance.propsOptions;1384 if (rawProps) {1385 for (const key in rawProps) {1386 const value = rawProps[key];1387 if (isReservedProp(key)) {1388 continue;1389 }1390 let camelKey;1391 if (options && hasOwn(options, camelKey = camelize(key))) {1392 props[camelKey] = value;1393 } else if (!isEmitListener(instance.emitsOptions, key)) {1394 attrs[key] = value;1395 }1396 }1397 }1398 if (needCastKeys) {1399 const rawCurrentProps = toRaw(props);1400 for (let i = 0; i < needCastKeys.length; i++) {1401 const key = needCastKeys[i];1402 props[key] = resolvePropValue(options, rawCurrentProps, key, rawCurrentProps[key], instance);1403 }1404 }1405}1406function resolvePropValue(options, props, key, value, instance) {1407 const opt = options[key];...

Full Screen

Full Screen

render.js

Source:render.js Github

copy

Full Screen

...1946 const dynamicProps = nextVNode.dynamicProps;1947 for (let i = 0; i < dynamicProps.length; i++) {1948 const key = dynamicProps[i];1949 if (nextProps[key] !== prevProps[key] &&1950 !isEmitListener(emits, key)) {1951 return true;1952 }1953 }1954 }1955 }1956 else {1957 // this path is only taken by manually written render functions1958 // so presence of any children leads to a forced update1959 if (prevChildren || nextChildren) {1960 if (!nextChildren || !nextChildren.$stable) {1961 return true;1962 }1963 }1964 if (prevProps === nextProps) {1965 return false;1966 }1967 if (!prevProps) {1968 return !!nextProps;1969 }1970 if (!nextProps) {1971 return true;1972 }1973 return hasPropsChanged(prevProps, nextProps, emits);1974 }1975 return false;1976 }1977 function hasPropsChanged(prevProps, nextProps, emitsOptions) {1978 const nextKeys = Object.keys(nextProps);1979 if (nextKeys.length !== Object.keys(prevProps).length) {1980 return true;1981 }1982 for (let i = 0; i < nextKeys.length; i++) {1983 const key = nextKeys[i];1984 if (nextProps[key] !== prevProps[key] &&1985 !isEmitListener(emitsOptions, key)) {1986 return true;1987 }1988 }1989 return false;1990 }1991 // Check if an incoming prop key is a declared emit event listener.1992 // e.g. With `emits: { click: null }`, props named `onClick` and `onclick` are1993 // both considered matched listeners.1994 function isEmitListener(options, key) {1995 if (!options || !isOn(key)) {1996 return false;1997 }1998 key = key.replace(/Once$/, '');1999 return (hasOwn(options, key[2].toLowerCase() + key.slice(3)) ||2000 hasOwn(options, key.slice(2)));2001 }2002 function invalidateJob(job) {2003 const i = queue.indexOf(job);2004 if (i > -1) {2005 queue[i] = null;2006 }2007 }2008/*...

Full Screen

Full Screen

shouldComponentUpdate.js

Source:shouldComponentUpdate.js Github

copy

Full Screen

...83 const dynamicProps = nextVNode.dynamicProps;84 for (let i = 0; i < dynamicProps.length; i++) {85 const key = dynamicProps[i];86 if (nextProps[key] !== prevProps[key] &&87 !isEmitListener(emits, key)) {88 return true;89 }90 }91 }92 }93 else {94 // this path is only taken by manually written render functions95 // so presence of any children leads to a forced update96 if (prevChildren || nextChildren) {97 if (!nextChildren || !nextChildren.$stable) {98 return true;99 }100 }101 if (prevProps === nextProps) {102 return false;103 }104 if (!prevProps) {105 return !!nextProps;106 }107 if (!nextProps) {108 return true;109 }110 return hasPropsChanged(prevProps, nextProps, emits);111 }112 return false;113}114 function hasPropsChanged(prevProps, nextProps, emitsOptions) {115 const nextKeys = Object.keys(nextProps);116 if (nextKeys.length !== Object.keys(prevProps).length) {117 return true;118 }119 for (let i = 0; i < nextKeys.length; i++) {120 const key = nextKeys[i];121 if (nextProps[key] !== prevProps[key] &&122 !isEmitListener(emitsOptions, key)) {123 return true;124 }125 }126 return false;127 }128 /* FULL_PROPS */129 /*130 * hasDynamicKeys = true;131 * !isStaticExp(key)132 */133 function buildProps(node, context, props = node.props, ssr = false) {134 const { tag, loc: elementLoc } = node;135 const isComponent = node.tagType === 1 /* COMPONENT */;136 let properties = [];...

Full Screen

Full Screen

componentProps.js

Source:componentProps.js Github

copy

Full Screen

...153 props[camelKey] = value154 } else {155 ;(rawCastValues || (rawCastValues = {}))[camelKey] = value156 }157 } else if (!isEmitListener(instance.emitsOptions, key)) {158 if (!(key in attrs) || value !== attrs[key]) {159 attrs[key] = value160 hasAttrsChanged = true161 }162 }163 }164 }165 if (needCastKeys) {166 const rawCurrentProps = toRaw(props)167 const castValues = rawCastValues || EMPTY_OBJ168 for (let i = 0; i < needCastKeys.length; i++) {169 const key = needCastKeys[i]170 props[key] = resolvePropValue(171 options,...

Full Screen

Full Screen

componentRenderUtils.js

Source:componentRenderUtils.js Github

copy

Full Screen

...144 } else if (patchFlag & 8) {145 const dynamicProps = nextVNode.dynamicProps146 for (let i = 0; i < dynamicProps.length; i++) {147 const key = dynamicProps[i]148 if (nextProps[key] !== prevProps[key] && !isEmitListener(emits, key)) {149 return true150 }151 }152 }153 } else {154 if (prevChildren || nextChildren) {155 if (!nextChildren || !nextChildren.$stable) {156 return true157 }158 }159 if (prevProps === nextProps) {160 return false161 }162 if (!prevProps) {163 return !!nextProps164 }165 if (!nextProps) {166 return true167 }168 return hasPropsChanged(prevProps, nextProps, emits)169 }170 return false171}172function hasPropsChanged (prevProps, nextProps, emitsOptions) {173 const nextKeys = Object.keys(nextProps)174 if (nextKeys.length !== Object.keys(prevProps).length) {175 return true176 }177 for (let i = 0; i < nextKeys.length; i++) {178 const key = nextKeys[i]179 if (180 nextProps[key] !== prevProps[key] &&181 !isEmitListener(emitsOptions, key)182 ) {183 return true184 }185 }186 return false187}188export function updateHOCHostEl ({ vnode, parent }, el) {189 while (parent && parent.subTree === vnode) {190 ;(vnode = parent.vnode).el = el191 parent = parent.parent192 }...

Full Screen

Full Screen

componentEmits.js

Source:componentEmits.js Github

copy

Full Screen

1import {2 isFunction,3 isArray,4 isOn,5 hasOwn,6 EMPTY_OBJ,7 toHandlerKey,8 camelize9} from '../shared/index.js'10export function emit (instance, event, ...rawArgs) {11 const props = instance.vnode.props || EMPTY_OBJ12 let args = rawArgs13 const isModelListener = event.startsWith('update:')14 // for v-model update:xxx events, apply modifiers on args15 const modelArg = isModelListener && event.slice(7)16 if (modelArg && modelArg in props) {17 const modifiersKey = `${18 modelArg === 'modelValue' ? 'model' : modelArg19 }Modifiers`20 const { number, trim } = props[modifiersKey] || EMPTY_OBJ21 if (trim) {22 args = rawArgs.map(a => a.trim())23 } else if (number) {24 args = rawArgs.map(toNumber)25 }26 }27 let handlerName28 let handler =29 props[(handlerName = toHandlerKey(event))] ||30 // also try camelCase event handler (#2249)31 props[(handlerName = toHandlerKey(camelize(event)))]32 // for v-model update:xxx events, also trigger kebab-case equivalent33 // for props passed via kebab-case34 if (!handler && isModelListener) {35 handler = props[(handlerName = toHandlerKey(hyphenate(event)))]36 }37 if (handler) {38 handler([...args])39 }40 const onceHandler = props[handlerName + `Once`]41 if (onceHandler) {42 if (!instance.emitted) {43 instance.emitted = {}44 } else if (instance.emitted[handlerName]) {45 return46 }47 instance.emitted[handlerName] = true48 onceHandler(args)49 }50}51export function normalizeEmitsOptions (comp, appContext, asMixin = false) {52 const cache = appContext.emitsCache53 const cached = cache.get(comp)54 if (cached !== undefined) {55 return cached56 }57 const raw = comp.emits58 let normalized = {}59 // apply mixin/extends props60 let hasExtends = false61 if (!isFunction(comp)) {62 const extendEmits = raw => {63 const normalizedFromExtend = normalizeEmitsOptions(raw, appContext, true)64 if (normalizedFromExtend) {65 hasExtends = true66 extend(normalized, normalizedFromExtend)67 }68 }69 if (!asMixin && appContext.mixins.length) {70 appContext.mixins.forEach(extendEmits)71 }72 if (comp.extends) {73 extendEmits(comp.extends)74 }75 if (comp.mixins) {76 comp.mixins.forEach(extendEmits)77 }78 }79 if (!raw && !hasExtends) {80 cache.set(comp, null)81 return null82 }83 if (isArray(raw)) {84 raw.forEach(key => (normalized[key] = null))85 } else {86 extend(normalized, raw)87 }88 cache.set(comp, normalized)89 return normalized90}91export function isEmitListener (options, key) {92 if (!options || !isOn(key)) {93 return false94 }95 key = key.slice(2).replace(/Once$/, '')96 return (97 hasOwn(options, key[0].toLowerCase() + key.slice(1)) || hasOwn(options, key)98 )...

Full Screen

Full Screen

Using AI Code Generation

copy

Full Screen

1const { isEmitListener } = require('playwright/lib/utils/utils');2const { chromium } = require('playwright');3(async () => {4 const browser = await chromium.launch();5 const context = await browser.newContext();6 const page = await context.newPage();7 const [request] = await Promise.all([8 page.waitForEvent('request'),9 ]);10 console.log(isEmitListener(request, 'requestfailed'));11 console.log(isEmitListener(request, 'requestfinished'));12 await browser.close();13})();

Full Screen

Using AI Code Generation

copy

Full Screen

1const { InternalEventEmitter } = require('playwright/lib/utils/events');2const emitter = new InternalEventEmitter();3const listener = () => {};4emitter.on('event', listener);5const { InternalEventEmitter } = require('playwright/lib/utils/events');6const emitter = new InternalEventEmitter();7const listener = () => {};8emitter.on('event', listener);9import { PlaywrightTestConfig } from '@playwright/test';10const config: PlaywrightTestConfig = {11 use: {12 viewport: { width: 1280, height: 720 },13 },14};15export default config;16{17 "scripts": {18 },19 "dependencies": {20 }21}22const { InternalEventEmitter } = require('playwright/lib/utils/events');23console.log(require.resolve('playwright/lib/utils/events'));24import { PlaywrightTestConfig } from '@playwright/test';25const config: PlaywrightTestConfig = {26 use: {27 viewport: { width: 1280,

Full Screen

Using AI Code Generation

copy

Full Screen

1const { InternalEventEmitter } = require('playwright/lib/utils/events');2const emitter = new InternalEventEmitter();3emitter.on('event', () => {});4emitter.on('event', () => {}, true);5emitter.on('event', () => {}, false);6emitter.on('event', () => {}, undefined);7emitter.on('event', () => {}, null);8emitter.on('event', () => {}, 'true');9emitter.on('event', () => {}, 'false');10emitter.on('event', () => {}, 'random');11emitter.on('event', () => {}, 1);12emitter.on('event', () => {}, 0);13emitter.on('event', () => {}, 2);14emitter.on('event', () => {}, {});15emitter.on('event', () => {}, []);16emitter.on('event', () => {}, () => {});17emitter.on('event', () => {}, 0.5);18emitter.on('event', () => {}, 0.0);19emitter.on('event', () => {}, 0.9);20emitter.on('event', () => {}, -0.5);21emitter.on('event', () =>

Full Screen

Using AI Code Generation

copy

Full Screen

1const { InternalEventEmitter } = require('playwright/lib/utils/events');2const { helper } = require('playwright/lib/helper');3const { events } = require('playwright/lib/events');4const emitter = new InternalEventEmitter();5events.forEach(event => {6 emitter.on(event, () => console.log(event));7});8console.log(emitter.isEmitListener('event1', () => console.log('event1')));9helper.addEventListener(emitter, 'event1', () => console.log('event1'));10console.log(emitter.isEmitListener('event1', () => console.log('event1')));11console.log(emitter.isEmitListener('event1', () => console.log('event2')));12console.log(emitter.isEmitListener('event2', () => console.log('event1')));13console.log(emitter.isEmitListener('event1', () => console.log('event3')));14console.log(emitter.isEmitListener('event1', () => console.log('event1')));15console.log(emitter.isEmitListener('event1', () => console.log('event2')));16console.log(emitter.isEmitListener('event2', () => console.log('event1')));17console.log(emitter.isEmitListener('event1', () => console.log('event3')));18console.log(emitter.isEmitListener('event1', () => console.log('event1')));19console.log(emitter.isEmitListener('event

Full Screen

Using AI Code Generation

copy

Full Screen

1const { isEmitListener } = require('playwright/lib/helper');2const { Page } = require('playwright/lib/page');3const { ConsoleMessage } = require('playwright/lib/console');4const { assert } = require('console');5assert(isEmitListener(Page, 'console'), 'Page should have "console" event');6assert(isEmitListener(ConsoleMessage, 'text'), 'ConsoleMessage should have "text" event');7const page = await browser.newPage();8await page.route('**', route => route.continue());9await page.evaluate(() => console.log('hello', 5, {foo: 'bar'}));10await page.close();11assert(isEmitListener(Page, 'console'), 'Page should have "console" event');12assert(isEmitListener(ConsoleMessage, 'text'), 'ConsoleMessage should have "text" event');13const page = await browser.newPage();14await page.route('**', route => route.continue());15await page.evaluate(() => console.log('hello', 5, {foo: 'bar'}));16await page.close();17assert(isEmitListener(Page, 'console'), 'Page should have "console" event');18assert(isEmitListener(ConsoleMessage, 'text'), 'ConsoleMessage should have "text" event');19const page = await browser.newPage();20await page.route('**', route => route.continue());21await page.evaluate(() => console.log('hello', 5, {foo: 'bar'}));22await page.close();23assert(isEmitListener(Page, 'console'), 'Page should have "console" event');24assert(isEmitListener(ConsoleMessage, 'text'), 'ConsoleMessage should have "text" event');25const page = await browser.newPage();26await page.route('**', route => route.continue());27await page.evaluate(() => console.log('hello', 5, {foo:

Full Screen

Using AI Code Generation

copy

Full Screen

1const { Playwright } = require('playwright-core');2console.log(Playwright.isEmitListener('page', 'console'));3const { Playwright } = require('playwright-core');4console.log(Playwright.isEmitListener('page', 'console'));5const { Playwright } = require('playwright-core');6console.log(Playwright.isEmitListener('page', 'console'));7const { Playwright } = require('playwright-core');8console.log(Playwright.isEmitListener('page', 'console'));9const { Playwright } = require('playwright-core');10console.log(Playwright.isEmitListener('page', 'console'));11const { Playwright } = require('playwright-core');12console.log(Playwright.isEmitListener('page', 'console'));13const { Playwright } = require('playwright-core');14console.log(Playwright.isEmitListener('page', 'console'));15const { Playwright } = require('playwright-core');16console.log(Playwright.isEmitListener('page', 'console'));17const { Playwright } = require('playwright-core');18console.log(Playwright.isEmitListener('page', 'console'));19const { Playwright } = require('playwright-core');20console.log(Playwright.isEmitListener('page', 'console'));

Full Screen

Using AI Code Generation

copy

Full Screen

1const { isEmitListener } = require('playwright/lib/internal/inspectorInstrumentation');2const { chromium } = require('playwright');3(async () => {4 const browser = await chromium.launch();5 const context = await browser.newContext();6 const page = await context.newPage();7 const isEmitListenerAttached = isEmitListener(page, 'request');8 console.log('isEmitListenerAttached', isEmitListenerAttached);9 await browser.close();10})();

Full Screen

Using AI Code Generation

copy

Full Screen

1const { isEmitListener } = require('playwright/lib/utils/events');2function emitEvent() {3 if (isEmitListener(this, 'myEvent')) {4 this.emit('myEvent');5 }6}7module.exports = { emitEvent };8const { emitEvent } = require('./test');9const { test } = require('@playwright/test');10test('test', async ({ page }) => {11 emitEvent.call(page, 'myEvent');12});

Full Screen

Playwright tutorial

LambdaTest’s Playwright tutorial will give you a broader idea about the Playwright automation framework, its unique features, and use cases with examples to exceed your understanding of Playwright testing. This tutorial will give A to Z guidance, from installing the Playwright framework to some best practices and advanced concepts.

Chapters:

  1. What is Playwright : Playwright is comparatively new but has gained good popularity. Get to know some history of the Playwright with some interesting facts connected with it.
  2. How To Install Playwright : Learn in detail about what basic configuration and dependencies are required for installing Playwright and run a test. Get a step-by-step direction for installing the Playwright automation framework.
  3. Playwright Futuristic Features: Launched in 2020, Playwright gained huge popularity quickly because of some obliging features such as Playwright Test Generator and Inspector, Playwright Reporter, Playwright auto-waiting mechanism and etc. Read up on those features to master Playwright testing.
  4. What is Component Testing: Component testing in Playwright is a unique feature that allows a tester to test a single component of a web application without integrating them with other elements. Learn how to perform Component testing on the Playwright automation framework.
  5. Inputs And Buttons In Playwright: Every website has Input boxes and buttons; learn about testing inputs and buttons with different scenarios and examples.
  6. Functions and Selectors in Playwright: Learn how to launch the Chromium browser with Playwright. Also, gain a better understanding of some important functions like “BrowserContext,” which allows you to run multiple browser sessions, and “newPage” which interacts with a page.
  7. Handling Alerts and Dropdowns in Playwright : Playwright interact with different types of alerts and pop-ups, such as simple, confirmation, and prompt, and different types of dropdowns, such as single selector and multi-selector get your hands-on with handling alerts and dropdown in Playright testing.
  8. Playwright vs Puppeteer: Get to know about the difference between two testing frameworks and how they are different than one another, which browsers they support, and what features they provide.
  9. Run Playwright Tests on LambdaTest: Playwright testing with LambdaTest leverages test performance to the utmost. You can run multiple Playwright tests in Parallel with the LammbdaTest test cloud. Get a step-by-step guide to run your Playwright test on the LambdaTest platform.
  10. Playwright Python Tutorial: Playwright automation framework support all major languages such as Python, JavaScript, TypeScript, .NET and etc. However, there are various advantages to Python end-to-end testing with Playwright because of its versatile utility. Get the hang of Playwright python testing with this chapter.
  11. Playwright End To End Testing Tutorial: Get your hands on with Playwright end-to-end testing and learn to use some exciting features such as TraceViewer, Debugging, Networking, Component testing, Visual testing, and many more.
  12. Playwright Video Tutorial: Watch the video tutorials on Playwright testing from experts and get a consecutive in-depth explanation of Playwright automation testing.

Run Playwright Internal automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful