@vue/shared
Advanced tools
+511
-480
| /** | ||
| * @vue/shared v3.6.0-beta.4 | ||
| * (c) 2018-present Yuxi (Evan) You and Vue contributors | ||
| * @license MIT | ||
| **/ | ||
| 'use strict'; | ||
| * @vue/shared v3.6.0-beta.5 | ||
| * (c) 2018-present Yuxi (Evan) You and Vue contributors | ||
| * @license MIT | ||
| **/ | ||
| Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: 'Module' } }); | ||
| Object.defineProperty(exports, '__esModule', { value: true }); | ||
| // @__NO_SIDE_EFFECTS__ | ||
| //#region packages/shared/src/makeMap.ts | ||
| /** | ||
| * Make a map and return a function for checking if a key | ||
| * is in that map. | ||
| * IMPORTANT: all calls of this function must be prefixed with | ||
| * \/\*#\_\_PURE\_\_\*\/ | ||
| * So that they can be tree-shaken if necessary. | ||
| */ | ||
| /* @__NO_SIDE_EFFECTS__ */ | ||
| function makeMap(str) { | ||
| const map = /* @__PURE__ */ Object.create(null); | ||
| for (const key of str.split(",")) map[key] = 1; | ||
| return (val) => val in map; | ||
| const map = Object.create(null); | ||
| for (const key of str.split(",")) map[key] = 1; | ||
| return (val) => val in map; | ||
| } | ||
| const EMPTY_OBJ = Object.freeze({}) ; | ||
| const EMPTY_ARR = Object.freeze([]) ; | ||
| const NOOP = () => { | ||
| }; | ||
| //#endregion | ||
| //#region packages/shared/src/general.ts | ||
| const EMPTY_OBJ = Object.freeze({}); | ||
| const EMPTY_ARR = Object.freeze([]); | ||
| const NOOP = () => {}; | ||
| /** | ||
| * Always return true. | ||
| */ | ||
| const YES = () => true; | ||
| /** | ||
| * Always return false. | ||
| */ | ||
| const NO = () => false; | ||
| const isOn = (key) => key.charCodeAt(0) === 111 && key.charCodeAt(1) === 110 && // uppercase letter | ||
| (key.charCodeAt(2) > 122 || key.charCodeAt(2) < 97); | ||
| const isNativeOn = (key) => key.charCodeAt(0) === 111 && key.charCodeAt(1) === 110 && // lowercase letter | ||
| key.charCodeAt(2) > 96 && key.charCodeAt(2) < 123; | ||
| const isOn = (key) => key.charCodeAt(0) === 111 && key.charCodeAt(1) === 110 && (key.charCodeAt(2) > 122 || key.charCodeAt(2) < 97); | ||
| const isNativeOn = (key) => key.charCodeAt(0) === 111 && key.charCodeAt(1) === 110 && key.charCodeAt(2) > 96 && key.charCodeAt(2) < 123; | ||
| const isModelListener = (key) => key.startsWith("onUpdate:"); | ||
| const extend = Object.assign; | ||
| const remove = (arr, el) => { | ||
| const i = arr.indexOf(el); | ||
| if (i > -1) { | ||
| arr.splice(i, 1); | ||
| } | ||
| const i = arr.indexOf(el); | ||
| if (i > -1) arr.splice(i, 1); | ||
| }; | ||
@@ -47,3 +56,3 @@ const hasOwnProperty = Object.prototype.hasOwnProperty; | ||
| const isPromise = (val) => { | ||
| return (isObject(val) || isFunction(val)) && isFunction(val.then) && isFunction(val.catch); | ||
| return (isObject(val) || isFunction(val)) && isFunction(val.then) && isFunction(val.catch); | ||
| }; | ||
@@ -53,231 +62,264 @@ const objectToString = Object.prototype.toString; | ||
| const toRawType = (value) => { | ||
| return toTypeString(value).slice(8, -1); | ||
| return toTypeString(value).slice(8, -1); | ||
| }; | ||
| const isPlainObject = (val) => toTypeString(val) === "[object Object]"; | ||
| const isIntegerKey = (key) => isString(key) && key !== "NaN" && key[0] !== "-" && "" + parseInt(key, 10) === key; | ||
| const isReservedProp = /* @__PURE__ */ makeMap( | ||
| // the leading comma is intentional so empty string "" is also included | ||
| ",key,ref,ref_for,ref_key,onVnodeBeforeMount,onVnodeMounted,onVnodeBeforeUpdate,onVnodeUpdated,onVnodeBeforeUnmount,onVnodeUnmounted" | ||
| ); | ||
| const isReservedProp = /* @__PURE__ */ makeMap(",key,ref,ref_for,ref_key,onVnodeBeforeMount,onVnodeMounted,onVnodeBeforeUpdate,onVnodeUpdated,onVnodeBeforeUnmount,onVnodeUnmounted"); | ||
| const isBuiltInTag = /* @__PURE__ */ makeMap("slot,component"); | ||
| const isBuiltInDirective = /* @__PURE__ */ makeMap( | ||
| "bind,cloak,else-if,else,for,html,if,model,on,once,pre,show,slot,text,memo" | ||
| ); | ||
| const isBuiltInDirective = /* @__PURE__ */ makeMap("bind,cloak,else-if,else,for,html,if,model,on,once,pre,show,slot,text,memo"); | ||
| const cacheStringFunction = (fn) => { | ||
| const cache = /* @__PURE__ */ Object.create(null); | ||
| return ((str) => { | ||
| const hit = cache[str]; | ||
| return hit || (cache[str] = fn(str)); | ||
| }); | ||
| const cache = Object.create(null); | ||
| return ((str) => { | ||
| return cache[str] || (cache[str] = fn(str)); | ||
| }); | ||
| }; | ||
| const camelizeRE = /-(\w)/g; | ||
| const camelizeReplacer = (_, c) => c ? c.toUpperCase() : ""; | ||
| const camelize = cacheStringFunction( | ||
| (str) => str.replace(camelizeRE, camelizeReplacer) | ||
| ); | ||
| /** | ||
| * @private | ||
| */ | ||
| const camelize = cacheStringFunction((str) => str.replace(camelizeRE, camelizeReplacer)); | ||
| const hyphenateRE = /\B([A-Z])/g; | ||
| const hyphenate = cacheStringFunction( | ||
| (str) => str.replace(hyphenateRE, "-$1").toLowerCase() | ||
| ); | ||
| /** | ||
| * @private | ||
| */ | ||
| const hyphenate = cacheStringFunction((str) => str.replace(hyphenateRE, "-$1").toLowerCase()); | ||
| /** | ||
| * @private | ||
| */ | ||
| const capitalize = cacheStringFunction((str) => { | ||
| return str.charAt(0).toUpperCase() + str.slice(1); | ||
| return str.charAt(0).toUpperCase() + str.slice(1); | ||
| }); | ||
| const toHandlerKey = cacheStringFunction( | ||
| (str) => { | ||
| const s = str ? `on${capitalize(str)}` : ``; | ||
| return s; | ||
| } | ||
| ); | ||
| /** | ||
| * @private | ||
| */ | ||
| const toHandlerKey = cacheStringFunction((str) => { | ||
| return str ? `on${capitalize(str)}` : ``; | ||
| }); | ||
| /** | ||
| * #13070 When v-model and v-model:model directives are used together, | ||
| * they will generate the same modelModifiers prop, | ||
| * so a `$` suffix is added to avoid conflicts. | ||
| * @private | ||
| */ | ||
| const getModifierPropName = (name) => { | ||
| return `${name === "modelValue" || name === "model-value" ? "model" : name}Modifiers${name === "model" ? "$" : ""}`; | ||
| return `${name === "modelValue" || name === "model-value" ? "model" : name}Modifiers${name === "model" ? "$" : ""}`; | ||
| }; | ||
| const hasChanged = (value, oldValue) => !Object.is(value, oldValue); | ||
| const invokeArrayFns = (fns, ...arg) => { | ||
| for (let i = 0; i < fns.length; i++) { | ||
| fns[i](...arg); | ||
| } | ||
| for (let i = 0; i < fns.length; i++) fns[i](...arg); | ||
| }; | ||
| const def = (obj, key, value, writable = false) => { | ||
| Object.defineProperty(obj, key, { | ||
| configurable: true, | ||
| enumerable: false, | ||
| writable, | ||
| value | ||
| }); | ||
| Object.defineProperty(obj, key, { | ||
| configurable: true, | ||
| enumerable: false, | ||
| writable, | ||
| value | ||
| }); | ||
| }; | ||
| /** | ||
| * "123-foo" will be parsed to 123 | ||
| * This is used for the .number modifier in v-model | ||
| */ | ||
| const looseToNumber = (val) => { | ||
| const n = parseFloat(val); | ||
| return isNaN(n) ? val : n; | ||
| const n = parseFloat(val); | ||
| return isNaN(n) ? val : n; | ||
| }; | ||
| /** | ||
| * Only concerns number-like strings | ||
| * "123-foo" will be returned as-is | ||
| */ | ||
| const toNumber = (val) => { | ||
| const n = isString(val) ? Number(val) : NaN; | ||
| return isNaN(n) ? val : n; | ||
| const n = isString(val) ? Number(val) : NaN; | ||
| return isNaN(n) ? val : n; | ||
| }; | ||
| let _globalThis; | ||
| const getGlobalThis = () => { | ||
| return _globalThis || (_globalThis = typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : {}); | ||
| return _globalThis || (_globalThis = typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : {}); | ||
| }; | ||
| const identRE = /^[_$a-zA-Z\xA0-\uFFFF][_$a-zA-Z0-9\xA0-\uFFFF]*$/; | ||
| function genPropsAccessExp(name) { | ||
| return identRE.test(name) ? `__props.${name}` : `__props[${JSON.stringify(name)}]`; | ||
| return identRE.test(name) ? `__props.${name}` : `__props[${JSON.stringify(name)}]`; | ||
| } | ||
| function genCacheKey(source, options) { | ||
| return source + JSON.stringify( | ||
| options, | ||
| (_, val) => typeof val === "function" ? val.toString() : val | ||
| ); | ||
| return source + JSON.stringify(options, (_, val) => typeof val === "function" ? val.toString() : val); | ||
| } | ||
| function canSetValueDirectly(tagName) { | ||
| return tagName !== "PROGRESS" && // custom elements may use _value internally | ||
| !tagName.includes("-"); | ||
| return tagName !== "PROGRESS" && !tagName.includes("-"); | ||
| } | ||
| //#endregion | ||
| //#region packages/shared/src/patchFlags.ts | ||
| /** | ||
| * Patch flags are optimization hints generated by the compiler. | ||
| * when a block with dynamicChildren is encountered during diff, the algorithm | ||
| * enters "optimized mode". In this mode, we know that the vdom is produced by | ||
| * a render function generated by the compiler, so the algorithm only needs to | ||
| * handle updates explicitly marked by these patch flags. | ||
| * | ||
| * Patch flags can be combined using the | bitwise operator and can be checked | ||
| * using the & operator, e.g. | ||
| * | ||
| * ```js | ||
| * const flag = TEXT | CLASS | ||
| * if (flag & TEXT) { ... } | ||
| * ``` | ||
| * | ||
| * Check the `patchElement` function in '../../runtime-core/src/renderer.ts' to see how the | ||
| * flags are handled during diff. | ||
| */ | ||
| const PatchFlags = { | ||
| "TEXT": 1, | ||
| "1": "TEXT", | ||
| "CLASS": 2, | ||
| "2": "CLASS", | ||
| "STYLE": 4, | ||
| "4": "STYLE", | ||
| "PROPS": 8, | ||
| "8": "PROPS", | ||
| "FULL_PROPS": 16, | ||
| "16": "FULL_PROPS", | ||
| "NEED_HYDRATION": 32, | ||
| "32": "NEED_HYDRATION", | ||
| "STABLE_FRAGMENT": 64, | ||
| "64": "STABLE_FRAGMENT", | ||
| "KEYED_FRAGMENT": 128, | ||
| "128": "KEYED_FRAGMENT", | ||
| "UNKEYED_FRAGMENT": 256, | ||
| "256": "UNKEYED_FRAGMENT", | ||
| "NEED_PATCH": 512, | ||
| "512": "NEED_PATCH", | ||
| "DYNAMIC_SLOTS": 1024, | ||
| "1024": "DYNAMIC_SLOTS", | ||
| "DEV_ROOT_FRAGMENT": 2048, | ||
| "2048": "DEV_ROOT_FRAGMENT", | ||
| "CACHED": -1, | ||
| "-1": "CACHED", | ||
| "BAIL": -2, | ||
| "-2": "BAIL" | ||
| "TEXT": 1, | ||
| "1": "TEXT", | ||
| "CLASS": 2, | ||
| "2": "CLASS", | ||
| "STYLE": 4, | ||
| "4": "STYLE", | ||
| "PROPS": 8, | ||
| "8": "PROPS", | ||
| "FULL_PROPS": 16, | ||
| "16": "FULL_PROPS", | ||
| "NEED_HYDRATION": 32, | ||
| "32": "NEED_HYDRATION", | ||
| "STABLE_FRAGMENT": 64, | ||
| "64": "STABLE_FRAGMENT", | ||
| "KEYED_FRAGMENT": 128, | ||
| "128": "KEYED_FRAGMENT", | ||
| "UNKEYED_FRAGMENT": 256, | ||
| "256": "UNKEYED_FRAGMENT", | ||
| "NEED_PATCH": 512, | ||
| "512": "NEED_PATCH", | ||
| "DYNAMIC_SLOTS": 1024, | ||
| "1024": "DYNAMIC_SLOTS", | ||
| "DEV_ROOT_FRAGMENT": 2048, | ||
| "2048": "DEV_ROOT_FRAGMENT", | ||
| "CACHED": -1, | ||
| "-1": "CACHED", | ||
| "BAIL": -2, | ||
| "-2": "BAIL" | ||
| }; | ||
| /** | ||
| * dev only flag -> name mapping | ||
| */ | ||
| const PatchFlagNames = { | ||
| [1]: `TEXT`, | ||
| [2]: `CLASS`, | ||
| [4]: `STYLE`, | ||
| [8]: `PROPS`, | ||
| [16]: `FULL_PROPS`, | ||
| [32]: `NEED_HYDRATION`, | ||
| [64]: `STABLE_FRAGMENT`, | ||
| [128]: `KEYED_FRAGMENT`, | ||
| [256]: `UNKEYED_FRAGMENT`, | ||
| [512]: `NEED_PATCH`, | ||
| [1024]: `DYNAMIC_SLOTS`, | ||
| [2048]: `DEV_ROOT_FRAGMENT`, | ||
| [-1]: `CACHED`, | ||
| [-2]: `BAIL` | ||
| [1]: `TEXT`, | ||
| [2]: `CLASS`, | ||
| [4]: `STYLE`, | ||
| [8]: `PROPS`, | ||
| [16]: `FULL_PROPS`, | ||
| [32]: `NEED_HYDRATION`, | ||
| [64]: `STABLE_FRAGMENT`, | ||
| [128]: `KEYED_FRAGMENT`, | ||
| [256]: `UNKEYED_FRAGMENT`, | ||
| [512]: `NEED_PATCH`, | ||
| [1024]: `DYNAMIC_SLOTS`, | ||
| [2048]: `DEV_ROOT_FRAGMENT`, | ||
| [-1]: `CACHED`, | ||
| [-2]: `BAIL` | ||
| }; | ||
| //#endregion | ||
| //#region packages/shared/src/shapeFlags.ts | ||
| const ShapeFlags = { | ||
| "ELEMENT": 1, | ||
| "1": "ELEMENT", | ||
| "FUNCTIONAL_COMPONENT": 2, | ||
| "2": "FUNCTIONAL_COMPONENT", | ||
| "STATEFUL_COMPONENT": 4, | ||
| "4": "STATEFUL_COMPONENT", | ||
| "TEXT_CHILDREN": 8, | ||
| "8": "TEXT_CHILDREN", | ||
| "ARRAY_CHILDREN": 16, | ||
| "16": "ARRAY_CHILDREN", | ||
| "SLOTS_CHILDREN": 32, | ||
| "32": "SLOTS_CHILDREN", | ||
| "TELEPORT": 64, | ||
| "64": "TELEPORT", | ||
| "SUSPENSE": 128, | ||
| "128": "SUSPENSE", | ||
| "COMPONENT_SHOULD_KEEP_ALIVE": 256, | ||
| "256": "COMPONENT_SHOULD_KEEP_ALIVE", | ||
| "COMPONENT_KEPT_ALIVE": 512, | ||
| "512": "COMPONENT_KEPT_ALIVE", | ||
| "COMPONENT": 6, | ||
| "6": "COMPONENT" | ||
| "ELEMENT": 1, | ||
| "1": "ELEMENT", | ||
| "FUNCTIONAL_COMPONENT": 2, | ||
| "2": "FUNCTIONAL_COMPONENT", | ||
| "STATEFUL_COMPONENT": 4, | ||
| "4": "STATEFUL_COMPONENT", | ||
| "TEXT_CHILDREN": 8, | ||
| "8": "TEXT_CHILDREN", | ||
| "ARRAY_CHILDREN": 16, | ||
| "16": "ARRAY_CHILDREN", | ||
| "SLOTS_CHILDREN": 32, | ||
| "32": "SLOTS_CHILDREN", | ||
| "TELEPORT": 64, | ||
| "64": "TELEPORT", | ||
| "SUSPENSE": 128, | ||
| "128": "SUSPENSE", | ||
| "COMPONENT_SHOULD_KEEP_ALIVE": 256, | ||
| "256": "COMPONENT_SHOULD_KEEP_ALIVE", | ||
| "COMPONENT_KEPT_ALIVE": 512, | ||
| "512": "COMPONENT_KEPT_ALIVE", | ||
| "COMPONENT": 6, | ||
| "6": "COMPONENT" | ||
| }; | ||
| //#endregion | ||
| //#region packages/shared/src/slotFlags.ts | ||
| const SlotFlags = { | ||
| "STABLE": 1, | ||
| "1": "STABLE", | ||
| "DYNAMIC": 2, | ||
| "2": "DYNAMIC", | ||
| "FORWARDED": 3, | ||
| "3": "FORWARDED" | ||
| "STABLE": 1, | ||
| "1": "STABLE", | ||
| "DYNAMIC": 2, | ||
| "2": "DYNAMIC", | ||
| "FORWARDED": 3, | ||
| "3": "FORWARDED" | ||
| }; | ||
| /** | ||
| * Dev only | ||
| */ | ||
| const slotFlagsText = { | ||
| [1]: "STABLE", | ||
| [2]: "DYNAMIC", | ||
| [3]: "FORWARDED" | ||
| [1]: "STABLE", | ||
| [2]: "DYNAMIC", | ||
| [3]: "FORWARDED" | ||
| }; | ||
| //#endregion | ||
| //#region packages/shared/src/globalsAllowList.ts | ||
| const GLOBALS_ALLOWED = "Infinity,undefined,NaN,isFinite,isNaN,parseFloat,parseInt,decodeURI,decodeURIComponent,encodeURI,encodeURIComponent,Math,Number,Date,Array,Object,Boolean,String,RegExp,Map,Set,JSON,Intl,BigInt,console,Error,Symbol"; | ||
| const isGloballyAllowed = /* @__PURE__ */ makeMap(GLOBALS_ALLOWED); | ||
| /** @deprecated use `isGloballyAllowed` instead */ | ||
| const isGloballyWhitelisted = isGloballyAllowed; | ||
| //#endregion | ||
| //#region packages/shared/src/codeframe.ts | ||
| const range = 2; | ||
| function generateCodeFrame(source, start = 0, end = source.length) { | ||
| start = Math.max(0, Math.min(start, source.length)); | ||
| end = Math.max(0, Math.min(end, source.length)); | ||
| if (start > end) return ""; | ||
| let lines = source.split(/(\r?\n)/); | ||
| const newlineSequences = lines.filter((_, idx) => idx % 2 === 1); | ||
| lines = lines.filter((_, idx) => idx % 2 === 0); | ||
| let count = 0; | ||
| const res = []; | ||
| for (let i = 0; i < lines.length; i++) { | ||
| count += lines[i].length + (newlineSequences[i] && newlineSequences[i].length || 0); | ||
| if (count >= start) { | ||
| for (let j = i - range; j <= i + range || end > count; j++) { | ||
| if (j < 0 || j >= lines.length) continue; | ||
| const line = j + 1; | ||
| res.push( | ||
| `${line}${" ".repeat(Math.max(3 - String(line).length, 0))}| ${lines[j]}` | ||
| ); | ||
| const lineLength = lines[j].length; | ||
| const newLineSeqLength = newlineSequences[j] && newlineSequences[j].length || 0; | ||
| if (j === i) { | ||
| const pad = start - (count - (lineLength + newLineSeqLength)); | ||
| const length = Math.max( | ||
| 1, | ||
| end > count ? lineLength - pad : end - start | ||
| ); | ||
| res.push(` | ` + " ".repeat(pad) + "^".repeat(length)); | ||
| } else if (j > i) { | ||
| if (end > count) { | ||
| const length = Math.max(Math.min(end - count, lineLength), 1); | ||
| res.push(` | ` + "^".repeat(length)); | ||
| } | ||
| count += lineLength + newLineSeqLength; | ||
| } | ||
| } | ||
| break; | ||
| } | ||
| } | ||
| return res.join("\n"); | ||
| start = Math.max(0, Math.min(start, source.length)); | ||
| end = Math.max(0, Math.min(end, source.length)); | ||
| if (start > end) return ""; | ||
| let lines = source.split(/(\r?\n)/); | ||
| const newlineSequences = lines.filter((_, idx) => idx % 2 === 1); | ||
| lines = lines.filter((_, idx) => idx % 2 === 0); | ||
| let count = 0; | ||
| const res = []; | ||
| for (let i = 0; i < lines.length; i++) { | ||
| count += lines[i].length + (newlineSequences[i] && newlineSequences[i].length || 0); | ||
| if (count >= start) { | ||
| for (let j = i - range; j <= i + range || end > count; j++) { | ||
| if (j < 0 || j >= lines.length) continue; | ||
| const line = j + 1; | ||
| res.push(`${line}${" ".repeat(Math.max(3 - String(line).length, 0))}| ${lines[j]}`); | ||
| const lineLength = lines[j].length; | ||
| const newLineSeqLength = newlineSequences[j] && newlineSequences[j].length || 0; | ||
| if (j === i) { | ||
| const pad = start - (count - (lineLength + newLineSeqLength)); | ||
| const length = Math.max(1, end > count ? lineLength - pad : end - start); | ||
| res.push(` | ` + " ".repeat(pad) + "^".repeat(length)); | ||
| } else if (j > i) { | ||
| if (end > count) { | ||
| const length = Math.max(Math.min(end - count, lineLength), 1); | ||
| res.push(` | ` + "^".repeat(length)); | ||
| } | ||
| count += lineLength + newLineSeqLength; | ||
| } | ||
| } | ||
| break; | ||
| } | ||
| } | ||
| return res.join("\n"); | ||
| } | ||
| //#endregion | ||
| //#region packages/shared/src/normalizeProp.ts | ||
| function normalizeStyle(value) { | ||
| if (isArray(value)) { | ||
| const res = {}; | ||
| for (let i = 0; i < value.length; i++) { | ||
| const item = value[i]; | ||
| const normalized = isString(item) ? parseStringStyle(item) : normalizeStyle(item); | ||
| if (normalized) { | ||
| for (const key in normalized) { | ||
| res[key] = normalized[key]; | ||
| } | ||
| } | ||
| } | ||
| return res; | ||
| } else if (isString(value) || isObject(value)) { | ||
| return value; | ||
| } | ||
| if (isArray(value)) { | ||
| const res = {}; | ||
| for (let i = 0; i < value.length; i++) { | ||
| const item = value[i]; | ||
| const normalized = isString(item) ? parseStringStyle(item) : normalizeStyle(item); | ||
| if (normalized) for (const key in normalized) res[key] = normalized[key]; | ||
| } | ||
| return res; | ||
| } else if (isString(value) || isObject(value)) return value; | ||
| } | ||
@@ -288,56 +330,46 @@ const listDelimiterRE = /;(?![^(]*\))/g; | ||
| function parseStringStyle(cssText) { | ||
| const ret = {}; | ||
| cssText.replace(styleCommentRE, "").split(listDelimiterRE).forEach((item) => { | ||
| if (item) { | ||
| const tmp = item.split(propertyDelimiterRE); | ||
| tmp.length > 1 && (ret[tmp[0].trim()] = tmp[1].trim()); | ||
| } | ||
| }); | ||
| return ret; | ||
| const ret = {}; | ||
| cssText.replace(styleCommentRE, "").split(listDelimiterRE).forEach((item) => { | ||
| if (item) { | ||
| const tmp = item.split(propertyDelimiterRE); | ||
| tmp.length > 1 && (ret[tmp[0].trim()] = tmp[1].trim()); | ||
| } | ||
| }); | ||
| return ret; | ||
| } | ||
| function stringifyStyle(styles) { | ||
| if (!styles) return ""; | ||
| if (isString(styles)) return styles; | ||
| let ret = ""; | ||
| for (const key in styles) { | ||
| const value = styles[key]; | ||
| if (isString(value) || typeof value === "number") { | ||
| const normalizedKey = key.startsWith(`--`) ? key : hyphenate(key); | ||
| ret += `${normalizedKey}:${value};`; | ||
| } | ||
| } | ||
| return ret; | ||
| if (!styles) return ""; | ||
| if (isString(styles)) return styles; | ||
| let ret = ""; | ||
| for (const key in styles) { | ||
| const value = styles[key]; | ||
| if (isString(value) || typeof value === "number") { | ||
| const normalizedKey = key.startsWith(`--`) ? key : hyphenate(key); | ||
| ret += `${normalizedKey}:${value};`; | ||
| } | ||
| } | ||
| return ret; | ||
| } | ||
| function normalizeClass(value) { | ||
| let res = ""; | ||
| if (isString(value)) { | ||
| res = value; | ||
| } else if (isArray(value)) { | ||
| for (let i = 0; i < value.length; i++) { | ||
| const normalized = normalizeClass(value[i]); | ||
| if (normalized) { | ||
| res += normalized + " "; | ||
| } | ||
| } | ||
| } else if (isObject(value)) { | ||
| for (const name in value) { | ||
| if (value[name]) { | ||
| res += name + " "; | ||
| } | ||
| } | ||
| } | ||
| return res.trim(); | ||
| let res = ""; | ||
| if (isString(value)) res = value; | ||
| else if (isArray(value)) for (let i = 0; i < value.length; i++) { | ||
| const normalized = normalizeClass(value[i]); | ||
| if (normalized) res += normalized + " "; | ||
| } | ||
| else if (isObject(value)) { | ||
| for (const name in value) if (value[name]) res += name + " "; | ||
| } | ||
| return res.trim(); | ||
| } | ||
| function normalizeProps(props) { | ||
| if (!props) return null; | ||
| let { class: klass, style } = props; | ||
| if (klass && !isString(klass)) { | ||
| props.class = normalizeClass(klass); | ||
| } | ||
| if (style) { | ||
| props.style = normalizeStyle(style); | ||
| } | ||
| return props; | ||
| if (!props) return null; | ||
| let { class: klass, style } = props; | ||
| if (klass && !isString(klass)) props.class = normalizeClass(klass); | ||
| if (style) props.style = normalizeStyle(style); | ||
| return props; | ||
| } | ||
| //#endregion | ||
| //#region packages/shared/src/domTagConfig.ts | ||
| const HTML_TAGS = "html,body,base,head,link,meta,style,title,address,article,aside,footer,header,hgroup,h1,h2,h3,h4,h5,h6,nav,section,div,dd,dl,dt,figcaption,figure,picture,hr,img,li,main,ol,p,pre,ul,a,b,abbr,bdi,bdo,br,cite,code,data,dfn,em,i,kbd,mark,q,rp,rt,ruby,s,samp,small,span,strong,sub,sup,time,u,var,wbr,area,audio,map,track,video,embed,object,param,source,canvas,script,noscript,del,ins,caption,col,colgroup,table,thead,tbody,td,th,tr,button,datalist,fieldset,form,input,label,legend,meter,optgroup,option,output,progress,select,textarea,details,dialog,menu,summary,template,blockquote,iframe,tfoot"; | ||
@@ -351,18 +383,68 @@ const SVG_TAGS = "svg,animate,animateMotion,animateTransform,circle,clipPath,color-profile,defs,desc,discard,ellipse,feBlend,feColorMatrix,feComponentTransfer,feComposite,feConvolveMatrix,feDiffuseLighting,feDisplacementMap,feDistantLight,feDropShadow,feFlood,feFuncA,feFuncB,feFuncG,feFuncR,feGaussianBlur,feImage,feMerge,feMergeNode,feMorphology,feOffset,fePointLight,feSpecularLighting,feSpotLight,feTile,feTurbulence,filter,foreignObject,g,hatch,hatchpath,image,line,linearGradient,marker,mask,mesh,meshgradient,meshpatch,meshrow,metadata,mpath,path,pattern,polygon,polyline,radialGradient,rect,set,solidcolor,stop,switch,symbol,text,textPath,title,tspan,unknown,use,view"; | ||
| const BLOCK_TAGS = "address,article,aside,blockquote,dd,details,dialog,div,dl,dt,fieldset,figcaption,figure,footer,form,h1,h2,h3,h4,h5,h6,header,hgroup,hr,li,main,menu,nav,ol,p,pre,section,table,ul"; | ||
| /** | ||
| * Compiler only. | ||
| * Do NOT use in runtime code paths unless behind `__DEV__` flag. | ||
| */ | ||
| const isHTMLTag = /* @__PURE__ */ makeMap(HTML_TAGS); | ||
| /** | ||
| * Compiler only. | ||
| * Do NOT use in runtime code paths unless behind `__DEV__` flag. | ||
| */ | ||
| const isSVGTag = /* @__PURE__ */ makeMap(SVG_TAGS); | ||
| /** | ||
| * Compiler only. | ||
| * Do NOT use in runtime code paths unless behind `__DEV__` flag. | ||
| */ | ||
| const isMathMLTag = /* @__PURE__ */ makeMap(MATH_TAGS); | ||
| /** | ||
| * Compiler only. | ||
| * Do NOT use in runtime code paths unless behind `__DEV__` flag. | ||
| */ | ||
| const isVoidTag = /* @__PURE__ */ makeMap(VOID_TAGS); | ||
| /** | ||
| * Compiler only. | ||
| * Do NOT use in runtime code paths unless behind `__DEV__` flag. | ||
| */ | ||
| const isFormattingTag = /* @__PURE__ */ makeMap(FORMATTING_TAGS); | ||
| /** | ||
| * Compiler only. | ||
| * Do NOT use in runtime code paths unless behind `__DEV__` flag. | ||
| */ | ||
| const isAlwaysCloseTag = /* @__PURE__ */ makeMap(ALWAYS_CLOSE_TAGS); | ||
| /** | ||
| * Compiler only. | ||
| * Do NOT use in runtime code paths unless behind `__DEV__` flag. | ||
| */ | ||
| const isInlineTag = /* @__PURE__ */ makeMap(INLINE_TAGS); | ||
| /** | ||
| * Compiler only. | ||
| * Do NOT use in runtime code paths unless behind `__DEV__` flag. | ||
| */ | ||
| const isBlockTag = /* @__PURE__ */ makeMap(BLOCK_TAGS); | ||
| //#endregion | ||
| //#region packages/shared/src/domAttrConfig.ts | ||
| /** | ||
| * On the client we only need to offer special cases for boolean attributes that | ||
| * have different names from their corresponding dom properties: | ||
| * - itemscope -> N/A | ||
| * - allowfullscreen -> allowFullscreen | ||
| * - formnovalidate -> formNoValidate | ||
| * - ismap -> isMap | ||
| * - nomodule -> noModule | ||
| * - novalidate -> noValidate | ||
| * - readonly -> readOnly | ||
| */ | ||
| const specialBooleanAttrs = `itemscope,allowfullscreen,formnovalidate,ismap,nomodule,novalidate,readonly`; | ||
| const isSpecialBooleanAttr = /* @__PURE__ */ makeMap(specialBooleanAttrs); | ||
| const isBooleanAttr = /* @__PURE__ */ makeMap( | ||
| specialBooleanAttrs + `,async,autofocus,autoplay,controls,default,defer,disabled,hidden,inert,loop,open,required,reversed,scoped,seamless,checked,muted,multiple,selected` | ||
| ); | ||
| /** | ||
| * The full list is needed during SSR to produce the correct initial markup. | ||
| */ | ||
| const isBooleanAttr = /* @__PURE__ */ makeMap(specialBooleanAttrs + ",async,autofocus,autoplay,controls,default,defer,disabled,hidden,inert,loop,open,required,reversed,scoped,seamless,checked,muted,multiple,selected"); | ||
| /** | ||
| * Boolean attributes should be included if the value is truthy or ''. | ||
| * e.g. `<select multiple>` compiles to `{ multiple: '' }` | ||
| */ | ||
| function includeBooleanAttr(value) { | ||
| return !!value || value === ""; | ||
| return !!value || value === ""; | ||
| } | ||
@@ -372,276 +454,225 @@ const unsafeAttrCharRE = /[>/="'\u0009\u000a\u000c\u0020]/; | ||
| function isSSRSafeAttrName(name) { | ||
| if (attrValidationCache.hasOwnProperty(name)) { | ||
| return attrValidationCache[name]; | ||
| } | ||
| const isUnsafe = unsafeAttrCharRE.test(name); | ||
| if (isUnsafe) { | ||
| console.error(`unsafe attribute name: ${name}`); | ||
| } | ||
| return attrValidationCache[name] = !isUnsafe; | ||
| if (attrValidationCache.hasOwnProperty(name)) return attrValidationCache[name]; | ||
| const isUnsafe = unsafeAttrCharRE.test(name); | ||
| if (isUnsafe) console.error(`unsafe attribute name: ${name}`); | ||
| return attrValidationCache[name] = !isUnsafe; | ||
| } | ||
| const propsToAttrMap = { | ||
| acceptCharset: "accept-charset", | ||
| className: "class", | ||
| htmlFor: "for", | ||
| httpEquiv: "http-equiv" | ||
| acceptCharset: "accept-charset", | ||
| className: "class", | ||
| htmlFor: "for", | ||
| httpEquiv: "http-equiv" | ||
| }; | ||
| const isKnownHtmlAttr = /* @__PURE__ */ makeMap( | ||
| `accept,accept-charset,accesskey,action,align,allow,alt,async,autocapitalize,autocomplete,autofocus,autoplay,background,bgcolor,border,buffered,capture,challenge,charset,checked,cite,class,code,codebase,color,cols,colspan,content,contenteditable,contextmenu,controls,coords,crossorigin,csp,data,datetime,decoding,default,defer,dir,dirname,disabled,download,draggable,dropzone,enctype,enterkeyhint,for,form,formaction,formenctype,formmethod,formnovalidate,formtarget,headers,height,hidden,high,href,hreflang,http-equiv,icon,id,importance,inert,integrity,ismap,itemprop,keytype,kind,label,lang,language,loading,list,loop,low,manifest,max,maxlength,minlength,media,min,multiple,muted,name,novalidate,open,optimum,pattern,ping,placeholder,poster,preload,radiogroup,readonly,referrerpolicy,rel,required,reversed,rows,rowspan,sandbox,scope,scoped,selected,shape,size,sizes,slot,span,spellcheck,src,srcdoc,srclang,srcset,start,step,style,summary,tabindex,target,title,translate,type,usemap,value,width,wrap` | ||
| ); | ||
| const isKnownSvgAttr = /* @__PURE__ */ makeMap( | ||
| `xmlns,accent-height,accumulate,additive,alignment-baseline,alphabetic,amplitude,arabic-form,ascent,attributeName,attributeType,azimuth,baseFrequency,baseline-shift,baseProfile,bbox,begin,bias,by,calcMode,cap-height,class,clip,clipPathUnits,clip-path,clip-rule,color,color-interpolation,color-interpolation-filters,color-profile,color-rendering,contentScriptType,contentStyleType,crossorigin,cursor,cx,cy,d,decelerate,descent,diffuseConstant,direction,display,divisor,dominant-baseline,dur,dx,dy,edgeMode,elevation,enable-background,end,exponent,fill,fill-opacity,fill-rule,filter,filterRes,filterUnits,flood-color,flood-opacity,font-family,font-size,font-size-adjust,font-stretch,font-style,font-variant,font-weight,format,from,fr,fx,fy,g1,g2,glyph-name,glyph-orientation-horizontal,glyph-orientation-vertical,glyphRef,gradientTransform,gradientUnits,hanging,height,href,hreflang,horiz-adv-x,horiz-origin-x,id,ideographic,image-rendering,in,in2,intercept,k,k1,k2,k3,k4,kernelMatrix,kernelUnitLength,kerning,keyPoints,keySplines,keyTimes,lang,lengthAdjust,letter-spacing,lighting-color,limitingConeAngle,local,marker-end,marker-mid,marker-start,markerHeight,markerUnits,markerWidth,mask,maskContentUnits,maskUnits,mathematical,max,media,method,min,mode,name,numOctaves,offset,opacity,operator,order,orient,orientation,origin,overflow,overline-position,overline-thickness,panose-1,paint-order,path,pathLength,patternContentUnits,patternTransform,patternUnits,ping,pointer-events,points,pointsAtX,pointsAtY,pointsAtZ,preserveAlpha,preserveAspectRatio,primitiveUnits,r,radius,referrerPolicy,refX,refY,rel,rendering-intent,repeatCount,repeatDur,requiredExtensions,requiredFeatures,restart,result,rotate,rx,ry,scale,seed,shape-rendering,slope,spacing,specularConstant,specularExponent,speed,spreadMethod,startOffset,stdDeviation,stemh,stemv,stitchTiles,stop-color,stop-opacity,strikethrough-position,strikethrough-thickness,string,stroke,stroke-dasharray,stroke-dashoffset,stroke-linecap,stroke-linejoin,stroke-miterlimit,stroke-opacity,stroke-width,style,surfaceScale,systemLanguage,tabindex,tableValues,target,targetX,targetY,text-anchor,text-decoration,text-rendering,textLength,to,transform,transform-origin,type,u1,u2,underline-position,underline-thickness,unicode,unicode-bidi,unicode-range,units-per-em,v-alphabetic,v-hanging,v-ideographic,v-mathematical,values,vector-effect,version,vert-adv-y,vert-origin-x,vert-origin-y,viewBox,viewTarget,visibility,width,widths,word-spacing,writing-mode,x,x-height,x1,x2,xChannelSelector,xlink:actuate,xlink:arcrole,xlink:href,xlink:role,xlink:show,xlink:title,xlink:type,xmlns:xlink,xml:base,xml:lang,xml:space,y,y1,y2,yChannelSelector,z,zoomAndPan` | ||
| ); | ||
| const isKnownMathMLAttr = /* @__PURE__ */ makeMap( | ||
| `accent,accentunder,actiontype,align,alignmentscope,altimg,altimg-height,altimg-valign,altimg-width,alttext,bevelled,close,columnsalign,columnlines,columnspan,denomalign,depth,dir,display,displaystyle,encoding,equalcolumns,equalrows,fence,fontstyle,fontweight,form,frame,framespacing,groupalign,height,href,id,indentalign,indentalignfirst,indentalignlast,indentshift,indentshiftfirst,indentshiftlast,indextype,justify,largetop,largeop,lquote,lspace,mathbackground,mathcolor,mathsize,mathvariant,maxsize,minlabelspacing,mode,other,overflow,position,rowalign,rowlines,rowspan,rquote,rspace,scriptlevel,scriptminsize,scriptsizemultiplier,selection,separator,separators,shift,side,src,stackalign,stretchy,subscriptshift,superscriptshift,symmetric,voffset,width,widths,xlink:href,xlink:show,xlink:type,xmlns` | ||
| ); | ||
| /** | ||
| * Known attributes, this is used for stringification of runtime static nodes | ||
| * so that we don't stringify bindings that cannot be set from HTML. | ||
| * Don't also forget to allow `data-*` and `aria-*`! | ||
| * Generated from https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes | ||
| */ | ||
| const isKnownHtmlAttr = /* @__PURE__ */ makeMap("accept,accept-charset,accesskey,action,align,allow,alt,async,autocapitalize,autocomplete,autofocus,autoplay,background,bgcolor,border,buffered,capture,challenge,charset,checked,cite,class,code,codebase,color,cols,colspan,content,contenteditable,contextmenu,controls,coords,crossorigin,csp,data,datetime,decoding,default,defer,dir,dirname,disabled,download,draggable,dropzone,enctype,enterkeyhint,for,form,formaction,formenctype,formmethod,formnovalidate,formtarget,headers,height,hidden,high,href,hreflang,http-equiv,icon,id,importance,inert,integrity,ismap,itemprop,keytype,kind,label,lang,language,loading,list,loop,low,manifest,max,maxlength,minlength,media,min,multiple,muted,name,novalidate,open,optimum,pattern,ping,placeholder,poster,preload,radiogroup,readonly,referrerpolicy,rel,required,reversed,rows,rowspan,sandbox,scope,scoped,selected,shape,size,sizes,slot,span,spellcheck,src,srcdoc,srclang,srcset,start,step,style,summary,tabindex,target,title,translate,type,usemap,value,width,wrap"); | ||
| /** | ||
| * Generated from https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute | ||
| */ | ||
| const isKnownSvgAttr = /* @__PURE__ */ makeMap("xmlns,accent-height,accumulate,additive,alignment-baseline,alphabetic,amplitude,arabic-form,ascent,attributeName,attributeType,azimuth,baseFrequency,baseline-shift,baseProfile,bbox,begin,bias,by,calcMode,cap-height,class,clip,clipPathUnits,clip-path,clip-rule,color,color-interpolation,color-interpolation-filters,color-profile,color-rendering,contentScriptType,contentStyleType,crossorigin,cursor,cx,cy,d,decelerate,descent,diffuseConstant,direction,display,divisor,dominant-baseline,dur,dx,dy,edgeMode,elevation,enable-background,end,exponent,fill,fill-opacity,fill-rule,filter,filterRes,filterUnits,flood-color,flood-opacity,font-family,font-size,font-size-adjust,font-stretch,font-style,font-variant,font-weight,format,from,fr,fx,fy,g1,g2,glyph-name,glyph-orientation-horizontal,glyph-orientation-vertical,glyphRef,gradientTransform,gradientUnits,hanging,height,href,hreflang,horiz-adv-x,horiz-origin-x,id,ideographic,image-rendering,in,in2,intercept,k,k1,k2,k3,k4,kernelMatrix,kernelUnitLength,kerning,keyPoints,keySplines,keyTimes,lang,lengthAdjust,letter-spacing,lighting-color,limitingConeAngle,local,marker-end,marker-mid,marker-start,markerHeight,markerUnits,markerWidth,mask,maskContentUnits,maskUnits,mathematical,max,media,method,min,mode,name,numOctaves,offset,opacity,operator,order,orient,orientation,origin,overflow,overline-position,overline-thickness,panose-1,paint-order,path,pathLength,patternContentUnits,patternTransform,patternUnits,ping,pointer-events,points,pointsAtX,pointsAtY,pointsAtZ,preserveAlpha,preserveAspectRatio,primitiveUnits,r,radius,referrerPolicy,refX,refY,rel,rendering-intent,repeatCount,repeatDur,requiredExtensions,requiredFeatures,restart,result,rotate,rx,ry,scale,seed,shape-rendering,slope,spacing,specularConstant,specularExponent,speed,spreadMethod,startOffset,stdDeviation,stemh,stemv,stitchTiles,stop-color,stop-opacity,strikethrough-position,strikethrough-thickness,string,stroke,stroke-dasharray,stroke-dashoffset,stroke-linecap,stroke-linejoin,stroke-miterlimit,stroke-opacity,stroke-width,style,surfaceScale,systemLanguage,tabindex,tableValues,target,targetX,targetY,text-anchor,text-decoration,text-rendering,textLength,to,transform,transform-origin,type,u1,u2,underline-position,underline-thickness,unicode,unicode-bidi,unicode-range,units-per-em,v-alphabetic,v-hanging,v-ideographic,v-mathematical,values,vector-effect,version,vert-adv-y,vert-origin-x,vert-origin-y,viewBox,viewTarget,visibility,width,widths,word-spacing,writing-mode,x,x-height,x1,x2,xChannelSelector,xlink:actuate,xlink:arcrole,xlink:href,xlink:role,xlink:show,xlink:title,xlink:type,xmlns:xlink,xml:base,xml:lang,xml:space,y,y1,y2,yChannelSelector,z,zoomAndPan"); | ||
| /** | ||
| * Generated from https://developer.mozilla.org/en-US/docs/Web/MathML/Attribute | ||
| */ | ||
| const isKnownMathMLAttr = /* @__PURE__ */ makeMap("accent,accentunder,actiontype,align,alignmentscope,altimg,altimg-height,altimg-valign,altimg-width,alttext,bevelled,close,columnsalign,columnlines,columnspan,denomalign,depth,dir,display,displaystyle,encoding,equalcolumns,equalrows,fence,fontstyle,fontweight,form,frame,framespacing,groupalign,height,href,id,indentalign,indentalignfirst,indentalignlast,indentshift,indentshiftfirst,indentshiftlast,indextype,justify,largetop,largeop,lquote,lspace,mathbackground,mathcolor,mathsize,mathvariant,maxsize,minlabelspacing,mode,other,overflow,position,rowalign,rowlines,rowspan,rquote,rspace,scriptlevel,scriptminsize,scriptsizemultiplier,selection,separator,separators,shift,side,src,stackalign,stretchy,subscriptshift,superscriptshift,symmetric,voffset,width,widths,xlink:href,xlink:show,xlink:type,xmlns"); | ||
| /** | ||
| * Shared between server-renderer and runtime-core hydration logic | ||
| */ | ||
| function isRenderableAttrValue(value) { | ||
| if (value == null) { | ||
| return false; | ||
| } | ||
| const type = typeof value; | ||
| return type === "string" || type === "number" || type === "boolean"; | ||
| if (value == null) return false; | ||
| const type = typeof value; | ||
| return type === "string" || type === "number" || type === "boolean"; | ||
| } | ||
| function shouldSetAsAttr(tagName, key) { | ||
| if (key === "spellcheck" || key === "draggable" || key === "translate" || key === "autocorrect") { | ||
| return true; | ||
| } | ||
| if (key === "form") { | ||
| return true; | ||
| } | ||
| if (key === "list" && tagName === "INPUT") { | ||
| return true; | ||
| } | ||
| if (key === "type" && tagName === "TEXTAREA") { | ||
| return true; | ||
| } | ||
| if ((key === "width" || key === "height") && (tagName === "IMG" || tagName === "VIDEO" || tagName === "CANVAS" || tagName === "SOURCE")) { | ||
| return true; | ||
| } | ||
| if (key === "sandbox" && tagName === "IFRAME") { | ||
| return true; | ||
| } | ||
| return false; | ||
| if (key === "spellcheck" || key === "draggable" || key === "translate" || key === "autocorrect") return true; | ||
| if (key === "form") return true; | ||
| if (key === "list" && tagName === "INPUT") return true; | ||
| if (key === "type" && tagName === "TEXTAREA") return true; | ||
| if ((key === "width" || key === "height") && (tagName === "IMG" || tagName === "VIDEO" || tagName === "CANVAS" || tagName === "SOURCE")) return true; | ||
| if (key === "sandbox" && tagName === "IFRAME") return true; | ||
| return false; | ||
| } | ||
| //#endregion | ||
| //#region packages/shared/src/domNamespace.ts | ||
| const Namespaces = { | ||
| "HTML": 0, | ||
| "0": "HTML", | ||
| "SVG": 1, | ||
| "1": "SVG", | ||
| "MATH_ML": 2, | ||
| "2": "MATH_ML" | ||
| "HTML": 0, | ||
| "0": "HTML", | ||
| "SVG": 1, | ||
| "1": "SVG", | ||
| "MATH_ML": 2, | ||
| "2": "MATH_ML" | ||
| }; | ||
| //#endregion | ||
| //#region packages/shared/src/escapeHtml.ts | ||
| const escapeRE = /["'&<>]/; | ||
| function escapeHtml(string) { | ||
| const str = "" + string; | ||
| const match = escapeRE.exec(str); | ||
| if (!match) { | ||
| return str; | ||
| } | ||
| let html = ""; | ||
| let escaped; | ||
| let index; | ||
| let lastIndex = 0; | ||
| for (index = match.index; index < str.length; index++) { | ||
| switch (str.charCodeAt(index)) { | ||
| case 34: | ||
| escaped = """; | ||
| break; | ||
| case 38: | ||
| escaped = "&"; | ||
| break; | ||
| case 39: | ||
| escaped = "'"; | ||
| break; | ||
| case 60: | ||
| escaped = "<"; | ||
| break; | ||
| case 62: | ||
| escaped = ">"; | ||
| break; | ||
| default: | ||
| continue; | ||
| } | ||
| if (lastIndex !== index) { | ||
| html += str.slice(lastIndex, index); | ||
| } | ||
| lastIndex = index + 1; | ||
| html += escaped; | ||
| } | ||
| return lastIndex !== index ? html + str.slice(lastIndex, index) : html; | ||
| const str = "" + string; | ||
| const match = escapeRE.exec(str); | ||
| if (!match) return str; | ||
| let html = ""; | ||
| let escaped; | ||
| let index; | ||
| let lastIndex = 0; | ||
| for (index = match.index; index < str.length; index++) { | ||
| switch (str.charCodeAt(index)) { | ||
| case 34: | ||
| escaped = """; | ||
| break; | ||
| case 38: | ||
| escaped = "&"; | ||
| break; | ||
| case 39: | ||
| escaped = "'"; | ||
| break; | ||
| case 60: | ||
| escaped = "<"; | ||
| break; | ||
| case 62: | ||
| escaped = ">"; | ||
| break; | ||
| default: continue; | ||
| } | ||
| if (lastIndex !== index) html += str.slice(lastIndex, index); | ||
| lastIndex = index + 1; | ||
| html += escaped; | ||
| } | ||
| return lastIndex !== index ? html + str.slice(lastIndex, index) : html; | ||
| } | ||
| const commentStripRE = /^-?>|<!--|-->|--!>|<!-$/g; | ||
| function escapeHtmlComment(src) { | ||
| return src.replace(commentStripRE, ""); | ||
| return src.replace(commentStripRE, ""); | ||
| } | ||
| const cssVarNameEscapeSymbolsRE = /[ !"#$%&'()*+,./:;<=>?@[\\\]^`{|}~]/g; | ||
| function getEscapedCssVarName(key, doubleEscape) { | ||
| return key.replace( | ||
| cssVarNameEscapeSymbolsRE, | ||
| (s) => doubleEscape ? s === '"' ? '\\\\\\"' : `\\\\${s}` : `\\${s}` | ||
| ); | ||
| return key.replace(cssVarNameEscapeSymbolsRE, (s) => doubleEscape ? s === "\"" ? "\\\\\\\"" : `\\\\${s}` : `\\${s}`); | ||
| } | ||
| //#endregion | ||
| //#region packages/shared/src/looseEqual.ts | ||
| function looseCompareArrays(a, b) { | ||
| if (a.length !== b.length) return false; | ||
| let equal = true; | ||
| for (let i = 0; equal && i < a.length; i++) { | ||
| equal = looseEqual(a[i], b[i]); | ||
| } | ||
| return equal; | ||
| if (a.length !== b.length) return false; | ||
| let equal = true; | ||
| for (let i = 0; equal && i < a.length; i++) equal = looseEqual(a[i], b[i]); | ||
| return equal; | ||
| } | ||
| function looseEqual(a, b) { | ||
| if (a === b) return true; | ||
| let aValidType = isDate(a); | ||
| let bValidType = isDate(b); | ||
| if (aValidType || bValidType) { | ||
| return aValidType && bValidType ? a.getTime() === b.getTime() : false; | ||
| } | ||
| aValidType = isSymbol(a); | ||
| bValidType = isSymbol(b); | ||
| if (aValidType || bValidType) { | ||
| return a === b; | ||
| } | ||
| aValidType = isArray(a); | ||
| bValidType = isArray(b); | ||
| if (aValidType || bValidType) { | ||
| return aValidType && bValidType ? looseCompareArrays(a, b) : false; | ||
| } | ||
| aValidType = isObject(a); | ||
| bValidType = isObject(b); | ||
| if (aValidType || bValidType) { | ||
| if (!aValidType || !bValidType) { | ||
| return false; | ||
| } | ||
| const aKeysCount = Object.keys(a).length; | ||
| const bKeysCount = Object.keys(b).length; | ||
| if (aKeysCount !== bKeysCount) { | ||
| return false; | ||
| } | ||
| for (const key in a) { | ||
| const aHasKey = a.hasOwnProperty(key); | ||
| const bHasKey = b.hasOwnProperty(key); | ||
| if (aHasKey && !bHasKey || !aHasKey && bHasKey || !looseEqual(a[key], b[key])) { | ||
| return false; | ||
| } | ||
| } | ||
| } | ||
| return String(a) === String(b); | ||
| if (a === b) return true; | ||
| let aValidType = isDate(a); | ||
| let bValidType = isDate(b); | ||
| if (aValidType || bValidType) return aValidType && bValidType ? a.getTime() === b.getTime() : false; | ||
| aValidType = isSymbol(a); | ||
| bValidType = isSymbol(b); | ||
| if (aValidType || bValidType) return a === b; | ||
| aValidType = isArray(a); | ||
| bValidType = isArray(b); | ||
| if (aValidType || bValidType) return aValidType && bValidType ? looseCompareArrays(a, b) : false; | ||
| aValidType = isObject(a); | ||
| bValidType = isObject(b); | ||
| if (aValidType || bValidType) { | ||
| if (!aValidType || !bValidType) return false; | ||
| if (Object.keys(a).length !== Object.keys(b).length) return false; | ||
| for (const key in a) { | ||
| const aHasKey = a.hasOwnProperty(key); | ||
| const bHasKey = b.hasOwnProperty(key); | ||
| if (aHasKey && !bHasKey || !aHasKey && bHasKey || !looseEqual(a[key], b[key])) return false; | ||
| } | ||
| } | ||
| return String(a) === String(b); | ||
| } | ||
| function looseIndexOf(arr, val) { | ||
| return arr.findIndex((item) => looseEqual(item, val)); | ||
| return arr.findIndex((item) => looseEqual(item, val)); | ||
| } | ||
| //#endregion | ||
| //#region packages/shared/src/toDisplayString.ts | ||
| const isRef = (val) => { | ||
| return !!(val && val["__v_isRef"] === true); | ||
| return !!(val && val["__v_isRef"] === true); | ||
| }; | ||
| /** | ||
| * For converting {{ interpolation }} values to displayed strings. | ||
| * @private | ||
| */ | ||
| const toDisplayString = (val) => { | ||
| switch (typeof val) { | ||
| case "string": | ||
| return val; | ||
| case "object": | ||
| if (val) { | ||
| if (isRef(val)) { | ||
| return toDisplayString(val.value); | ||
| } else if (isArray(val) || val.toString === objectToString || !isFunction(val.toString)) { | ||
| return JSON.stringify(val, replacer, 2); | ||
| } | ||
| } | ||
| default: | ||
| return val == null ? "" : String(val); | ||
| } | ||
| switch (typeof val) { | ||
| case "string": return val; | ||
| case "object": if (val) { | ||
| if (isRef(val)) return toDisplayString(val.value); | ||
| else if (isArray(val) || val.toString === objectToString || !isFunction(val.toString)) return JSON.stringify(val, replacer, 2); | ||
| } | ||
| default: return val == null ? "" : String(val); | ||
| } | ||
| }; | ||
| const replacer = (_key, val) => { | ||
| if (isRef(val)) { | ||
| return replacer(_key, val.value); | ||
| } else if (isMap(val)) { | ||
| return { | ||
| [`Map(${val.size})`]: [...val.entries()].reduce( | ||
| (entries, [key, val2], i) => { | ||
| entries[stringifySymbol(key, i) + " =>"] = val2; | ||
| return entries; | ||
| }, | ||
| {} | ||
| ) | ||
| }; | ||
| } else if (isSet(val)) { | ||
| return { | ||
| [`Set(${val.size})`]: [...val.values()].map((v) => stringifySymbol(v)) | ||
| }; | ||
| } else if (isSymbol(val)) { | ||
| return stringifySymbol(val); | ||
| } else if (isObject(val) && !isArray(val) && !isPlainObject(val)) { | ||
| return String(val); | ||
| } | ||
| return val; | ||
| if (isRef(val)) return replacer(_key, val.value); | ||
| else if (isMap(val)) return { [`Map(${val.size})`]: [...val.entries()].reduce((entries, [key, val], i) => { | ||
| entries[stringifySymbol(key, i) + " =>"] = val; | ||
| return entries; | ||
| }, {}) }; | ||
| else if (isSet(val)) return { [`Set(${val.size})`]: [...val.values()].map((v) => stringifySymbol(v)) }; | ||
| else if (isSymbol(val)) return stringifySymbol(val); | ||
| else if (isObject(val) && !isArray(val) && !isPlainObject(val)) return String(val); | ||
| return val; | ||
| }; | ||
| const stringifySymbol = (v, i = "") => { | ||
| var _a; | ||
| return ( | ||
| // Symbol.description in es2019+ so we need to cast here to pass | ||
| // the lib: es2016 check | ||
| isSymbol(v) ? `Symbol(${(_a = v.description) != null ? _a : i})` : v | ||
| ); | ||
| var _description; | ||
| return isSymbol(v) ? `Symbol(${(_description = v.description) !== null && _description !== void 0 ? _description : i})` : v; | ||
| }; | ||
| //#endregion | ||
| //#region packages/shared/src/subSequence.ts | ||
| function getSequence(arr) { | ||
| const p = arr.slice(); | ||
| const result = [0]; | ||
| let i, j, u, v, c; | ||
| const len = arr.length; | ||
| for (i = 0; i < len; i++) { | ||
| const arrI = arr[i]; | ||
| if (arrI !== 0) { | ||
| j = result[result.length - 1]; | ||
| if (arr[j] < arrI) { | ||
| p[i] = j; | ||
| result.push(i); | ||
| continue; | ||
| } | ||
| u = 0; | ||
| v = result.length - 1; | ||
| while (u < v) { | ||
| c = u + v >> 1; | ||
| if (arr[result[c]] < arrI) { | ||
| u = c + 1; | ||
| } else { | ||
| v = c; | ||
| } | ||
| } | ||
| if (arrI < arr[result[u]]) { | ||
| if (u > 0) { | ||
| p[i] = result[u - 1]; | ||
| } | ||
| result[u] = i; | ||
| } | ||
| } | ||
| } | ||
| u = result.length; | ||
| v = result[u - 1]; | ||
| while (u-- > 0) { | ||
| result[u] = v; | ||
| v = p[v]; | ||
| } | ||
| return result; | ||
| const p = arr.slice(); | ||
| const result = [0]; | ||
| let i, j, u, v, c; | ||
| const len = arr.length; | ||
| for (i = 0; i < len; i++) { | ||
| const arrI = arr[i]; | ||
| if (arrI !== 0) { | ||
| j = result[result.length - 1]; | ||
| if (arr[j] < arrI) { | ||
| p[i] = j; | ||
| result.push(i); | ||
| continue; | ||
| } | ||
| u = 0; | ||
| v = result.length - 1; | ||
| while (u < v) { | ||
| c = u + v >> 1; | ||
| if (arr[result[c]] < arrI) u = c + 1; | ||
| else v = c; | ||
| } | ||
| if (arrI < arr[result[u]]) { | ||
| if (u > 0) p[i] = result[u - 1]; | ||
| result[u] = i; | ||
| } | ||
| } | ||
| } | ||
| u = result.length; | ||
| v = result[u - 1]; | ||
| while (u-- > 0) { | ||
| result[u] = v; | ||
| v = p[v]; | ||
| } | ||
| return result; | ||
| } | ||
| //#endregion | ||
| //#region packages/shared/src/cssVars.ts | ||
| /** | ||
| * Normalize CSS var value created by `v-bind` in `<style>` block | ||
| * See https://github.com/vuejs/core/pull/12461#issuecomment-2495804664 | ||
| */ | ||
| function normalizeCssVarValue(value) { | ||
| if (value == null) { | ||
| return "initial"; | ||
| } | ||
| if (typeof value === "string") { | ||
| return value === "" ? " " : value; | ||
| } | ||
| if (typeof value !== "number" || !Number.isFinite(value)) { | ||
| { | ||
| console.warn( | ||
| "[Vue warn] Invalid value used for CSS binding. Expected a string or a finite number but received:", | ||
| value | ||
| ); | ||
| } | ||
| } | ||
| return String(value); | ||
| if (value == null) return "initial"; | ||
| if (typeof value === "string") return value === "" ? " " : value; | ||
| if (typeof value !== "number" || !Number.isFinite(value)) console.warn("[Vue warn] Invalid value used for CSS binding. Expected a string or a finite number but received:", value); | ||
| return String(value); | ||
| } | ||
| //#endregion | ||
| exports.EMPTY_ARR = EMPTY_ARR; | ||
@@ -731,2 +762,2 @@ exports.EMPTY_OBJ = EMPTY_OBJ; | ||
| exports.toRawType = toRawType; | ||
| exports.toTypeString = toTypeString; | ||
| exports.toTypeString = toTypeString; |
+509
-470
| /** | ||
| * @vue/shared v3.6.0-beta.4 | ||
| * (c) 2018-present Yuxi (Evan) You and Vue contributors | ||
| * @license MIT | ||
| **/ | ||
| 'use strict'; | ||
| * @vue/shared v3.6.0-beta.5 | ||
| * (c) 2018-present Yuxi (Evan) You and Vue contributors | ||
| * @license MIT | ||
| **/ | ||
| Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: 'Module' } }); | ||
| Object.defineProperty(exports, '__esModule', { value: true }); | ||
| // @__NO_SIDE_EFFECTS__ | ||
| //#region packages/shared/src/makeMap.ts | ||
| /** | ||
| * Make a map and return a function for checking if a key | ||
| * is in that map. | ||
| * IMPORTANT: all calls of this function must be prefixed with | ||
| * \/\*#\_\_PURE\_\_\*\/ | ||
| * So that they can be tree-shaken if necessary. | ||
| */ | ||
| /* @__NO_SIDE_EFFECTS__ */ | ||
| function makeMap(str) { | ||
| const map = /* @__PURE__ */ Object.create(null); | ||
| for (const key of str.split(",")) map[key] = 1; | ||
| return (val) => val in map; | ||
| const map = Object.create(null); | ||
| for (const key of str.split(",")) map[key] = 1; | ||
| return (val) => val in map; | ||
| } | ||
| //#endregion | ||
| //#region packages/shared/src/general.ts | ||
| const EMPTY_OBJ = {}; | ||
| const EMPTY_ARR = []; | ||
| const NOOP = () => { | ||
| }; | ||
| const NOOP = () => {}; | ||
| /** | ||
| * Always return true. | ||
| */ | ||
| const YES = () => true; | ||
| /** | ||
| * Always return false. | ||
| */ | ||
| const NO = () => false; | ||
| const isOn = (key) => key.charCodeAt(0) === 111 && key.charCodeAt(1) === 110 && // uppercase letter | ||
| (key.charCodeAt(2) > 122 || key.charCodeAt(2) < 97); | ||
| const isNativeOn = (key) => key.charCodeAt(0) === 111 && key.charCodeAt(1) === 110 && // lowercase letter | ||
| key.charCodeAt(2) > 96 && key.charCodeAt(2) < 123; | ||
| const isOn = (key) => key.charCodeAt(0) === 111 && key.charCodeAt(1) === 110 && (key.charCodeAt(2) > 122 || key.charCodeAt(2) < 97); | ||
| const isNativeOn = (key) => key.charCodeAt(0) === 111 && key.charCodeAt(1) === 110 && key.charCodeAt(2) > 96 && key.charCodeAt(2) < 123; | ||
| const isModelListener = (key) => key.startsWith("onUpdate:"); | ||
| const extend = Object.assign; | ||
| const remove = (arr, el) => { | ||
| const i = arr.indexOf(el); | ||
| if (i > -1) { | ||
| arr.splice(i, 1); | ||
| } | ||
| const i = arr.indexOf(el); | ||
| if (i > -1) arr.splice(i, 1); | ||
| }; | ||
@@ -47,3 +56,3 @@ const hasOwnProperty = Object.prototype.hasOwnProperty; | ||
| const isPromise = (val) => { | ||
| return (isObject(val) || isFunction(val)) && isFunction(val.then) && isFunction(val.catch); | ||
| return (isObject(val) || isFunction(val)) && isFunction(val.then) && isFunction(val.catch); | ||
| }; | ||
@@ -53,231 +62,264 @@ const objectToString = Object.prototype.toString; | ||
| const toRawType = (value) => { | ||
| return toTypeString(value).slice(8, -1); | ||
| return toTypeString(value).slice(8, -1); | ||
| }; | ||
| const isPlainObject = (val) => toTypeString(val) === "[object Object]"; | ||
| const isIntegerKey = (key) => isString(key) && key !== "NaN" && key[0] !== "-" && "" + parseInt(key, 10) === key; | ||
| const isReservedProp = /* @__PURE__ */ makeMap( | ||
| // the leading comma is intentional so empty string "" is also included | ||
| ",key,ref,ref_for,ref_key,onVnodeBeforeMount,onVnodeMounted,onVnodeBeforeUpdate,onVnodeUpdated,onVnodeBeforeUnmount,onVnodeUnmounted" | ||
| ); | ||
| const isReservedProp = /* @__PURE__ */ makeMap(",key,ref,ref_for,ref_key,onVnodeBeforeMount,onVnodeMounted,onVnodeBeforeUpdate,onVnodeUpdated,onVnodeBeforeUnmount,onVnodeUnmounted"); | ||
| const isBuiltInTag = /* @__PURE__ */ makeMap("slot,component"); | ||
| const isBuiltInDirective = /* @__PURE__ */ makeMap( | ||
| "bind,cloak,else-if,else,for,html,if,model,on,once,pre,show,slot,text,memo" | ||
| ); | ||
| const isBuiltInDirective = /* @__PURE__ */ makeMap("bind,cloak,else-if,else,for,html,if,model,on,once,pre,show,slot,text,memo"); | ||
| const cacheStringFunction = (fn) => { | ||
| const cache = /* @__PURE__ */ Object.create(null); | ||
| return ((str) => { | ||
| const hit = cache[str]; | ||
| return hit || (cache[str] = fn(str)); | ||
| }); | ||
| const cache = Object.create(null); | ||
| return ((str) => { | ||
| return cache[str] || (cache[str] = fn(str)); | ||
| }); | ||
| }; | ||
| const camelizeRE = /-(\w)/g; | ||
| const camelizeReplacer = (_, c) => c ? c.toUpperCase() : ""; | ||
| const camelize = cacheStringFunction( | ||
| (str) => str.replace(camelizeRE, camelizeReplacer) | ||
| ); | ||
| /** | ||
| * @private | ||
| */ | ||
| const camelize = cacheStringFunction((str) => str.replace(camelizeRE, camelizeReplacer)); | ||
| const hyphenateRE = /\B([A-Z])/g; | ||
| const hyphenate = cacheStringFunction( | ||
| (str) => str.replace(hyphenateRE, "-$1").toLowerCase() | ||
| ); | ||
| /** | ||
| * @private | ||
| */ | ||
| const hyphenate = cacheStringFunction((str) => str.replace(hyphenateRE, "-$1").toLowerCase()); | ||
| /** | ||
| * @private | ||
| */ | ||
| const capitalize = cacheStringFunction((str) => { | ||
| return str.charAt(0).toUpperCase() + str.slice(1); | ||
| return str.charAt(0).toUpperCase() + str.slice(1); | ||
| }); | ||
| const toHandlerKey = cacheStringFunction( | ||
| (str) => { | ||
| const s = str ? `on${capitalize(str)}` : ``; | ||
| return s; | ||
| } | ||
| ); | ||
| /** | ||
| * @private | ||
| */ | ||
| const toHandlerKey = cacheStringFunction((str) => { | ||
| return str ? `on${capitalize(str)}` : ``; | ||
| }); | ||
| /** | ||
| * #13070 When v-model and v-model:model directives are used together, | ||
| * they will generate the same modelModifiers prop, | ||
| * so a `$` suffix is added to avoid conflicts. | ||
| * @private | ||
| */ | ||
| const getModifierPropName = (name) => { | ||
| return `${name === "modelValue" || name === "model-value" ? "model" : name}Modifiers${name === "model" ? "$" : ""}`; | ||
| return `${name === "modelValue" || name === "model-value" ? "model" : name}Modifiers${name === "model" ? "$" : ""}`; | ||
| }; | ||
| const hasChanged = (value, oldValue) => !Object.is(value, oldValue); | ||
| const invokeArrayFns = (fns, ...arg) => { | ||
| for (let i = 0; i < fns.length; i++) { | ||
| fns[i](...arg); | ||
| } | ||
| for (let i = 0; i < fns.length; i++) fns[i](...arg); | ||
| }; | ||
| const def = (obj, key, value, writable = false) => { | ||
| Object.defineProperty(obj, key, { | ||
| configurable: true, | ||
| enumerable: false, | ||
| writable, | ||
| value | ||
| }); | ||
| Object.defineProperty(obj, key, { | ||
| configurable: true, | ||
| enumerable: false, | ||
| writable, | ||
| value | ||
| }); | ||
| }; | ||
| /** | ||
| * "123-foo" will be parsed to 123 | ||
| * This is used for the .number modifier in v-model | ||
| */ | ||
| const looseToNumber = (val) => { | ||
| const n = parseFloat(val); | ||
| return isNaN(n) ? val : n; | ||
| const n = parseFloat(val); | ||
| return isNaN(n) ? val : n; | ||
| }; | ||
| /** | ||
| * Only concerns number-like strings | ||
| * "123-foo" will be returned as-is | ||
| */ | ||
| const toNumber = (val) => { | ||
| const n = isString(val) ? Number(val) : NaN; | ||
| return isNaN(n) ? val : n; | ||
| const n = isString(val) ? Number(val) : NaN; | ||
| return isNaN(n) ? val : n; | ||
| }; | ||
| let _globalThis; | ||
| const getGlobalThis = () => { | ||
| return _globalThis || (_globalThis = typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : {}); | ||
| return _globalThis || (_globalThis = typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : {}); | ||
| }; | ||
| const identRE = /^[_$a-zA-Z\xA0-\uFFFF][_$a-zA-Z0-9\xA0-\uFFFF]*$/; | ||
| function genPropsAccessExp(name) { | ||
| return identRE.test(name) ? `__props.${name}` : `__props[${JSON.stringify(name)}]`; | ||
| return identRE.test(name) ? `__props.${name}` : `__props[${JSON.stringify(name)}]`; | ||
| } | ||
| function genCacheKey(source, options) { | ||
| return source + JSON.stringify( | ||
| options, | ||
| (_, val) => typeof val === "function" ? val.toString() : val | ||
| ); | ||
| return source + JSON.stringify(options, (_, val) => typeof val === "function" ? val.toString() : val); | ||
| } | ||
| function canSetValueDirectly(tagName) { | ||
| return tagName !== "PROGRESS" && // custom elements may use _value internally | ||
| !tagName.includes("-"); | ||
| return tagName !== "PROGRESS" && !tagName.includes("-"); | ||
| } | ||
| //#endregion | ||
| //#region packages/shared/src/patchFlags.ts | ||
| /** | ||
| * Patch flags are optimization hints generated by the compiler. | ||
| * when a block with dynamicChildren is encountered during diff, the algorithm | ||
| * enters "optimized mode". In this mode, we know that the vdom is produced by | ||
| * a render function generated by the compiler, so the algorithm only needs to | ||
| * handle updates explicitly marked by these patch flags. | ||
| * | ||
| * Patch flags can be combined using the | bitwise operator and can be checked | ||
| * using the & operator, e.g. | ||
| * | ||
| * ```js | ||
| * const flag = TEXT | CLASS | ||
| * if (flag & TEXT) { ... } | ||
| * ``` | ||
| * | ||
| * Check the `patchElement` function in '../../runtime-core/src/renderer.ts' to see how the | ||
| * flags are handled during diff. | ||
| */ | ||
| const PatchFlags = { | ||
| "TEXT": 1, | ||
| "1": "TEXT", | ||
| "CLASS": 2, | ||
| "2": "CLASS", | ||
| "STYLE": 4, | ||
| "4": "STYLE", | ||
| "PROPS": 8, | ||
| "8": "PROPS", | ||
| "FULL_PROPS": 16, | ||
| "16": "FULL_PROPS", | ||
| "NEED_HYDRATION": 32, | ||
| "32": "NEED_HYDRATION", | ||
| "STABLE_FRAGMENT": 64, | ||
| "64": "STABLE_FRAGMENT", | ||
| "KEYED_FRAGMENT": 128, | ||
| "128": "KEYED_FRAGMENT", | ||
| "UNKEYED_FRAGMENT": 256, | ||
| "256": "UNKEYED_FRAGMENT", | ||
| "NEED_PATCH": 512, | ||
| "512": "NEED_PATCH", | ||
| "DYNAMIC_SLOTS": 1024, | ||
| "1024": "DYNAMIC_SLOTS", | ||
| "DEV_ROOT_FRAGMENT": 2048, | ||
| "2048": "DEV_ROOT_FRAGMENT", | ||
| "CACHED": -1, | ||
| "-1": "CACHED", | ||
| "BAIL": -2, | ||
| "-2": "BAIL" | ||
| "TEXT": 1, | ||
| "1": "TEXT", | ||
| "CLASS": 2, | ||
| "2": "CLASS", | ||
| "STYLE": 4, | ||
| "4": "STYLE", | ||
| "PROPS": 8, | ||
| "8": "PROPS", | ||
| "FULL_PROPS": 16, | ||
| "16": "FULL_PROPS", | ||
| "NEED_HYDRATION": 32, | ||
| "32": "NEED_HYDRATION", | ||
| "STABLE_FRAGMENT": 64, | ||
| "64": "STABLE_FRAGMENT", | ||
| "KEYED_FRAGMENT": 128, | ||
| "128": "KEYED_FRAGMENT", | ||
| "UNKEYED_FRAGMENT": 256, | ||
| "256": "UNKEYED_FRAGMENT", | ||
| "NEED_PATCH": 512, | ||
| "512": "NEED_PATCH", | ||
| "DYNAMIC_SLOTS": 1024, | ||
| "1024": "DYNAMIC_SLOTS", | ||
| "DEV_ROOT_FRAGMENT": 2048, | ||
| "2048": "DEV_ROOT_FRAGMENT", | ||
| "CACHED": -1, | ||
| "-1": "CACHED", | ||
| "BAIL": -2, | ||
| "-2": "BAIL" | ||
| }; | ||
| /** | ||
| * dev only flag -> name mapping | ||
| */ | ||
| const PatchFlagNames = { | ||
| [1]: `TEXT`, | ||
| [2]: `CLASS`, | ||
| [4]: `STYLE`, | ||
| [8]: `PROPS`, | ||
| [16]: `FULL_PROPS`, | ||
| [32]: `NEED_HYDRATION`, | ||
| [64]: `STABLE_FRAGMENT`, | ||
| [128]: `KEYED_FRAGMENT`, | ||
| [256]: `UNKEYED_FRAGMENT`, | ||
| [512]: `NEED_PATCH`, | ||
| [1024]: `DYNAMIC_SLOTS`, | ||
| [2048]: `DEV_ROOT_FRAGMENT`, | ||
| [-1]: `CACHED`, | ||
| [-2]: `BAIL` | ||
| [1]: `TEXT`, | ||
| [2]: `CLASS`, | ||
| [4]: `STYLE`, | ||
| [8]: `PROPS`, | ||
| [16]: `FULL_PROPS`, | ||
| [32]: `NEED_HYDRATION`, | ||
| [64]: `STABLE_FRAGMENT`, | ||
| [128]: `KEYED_FRAGMENT`, | ||
| [256]: `UNKEYED_FRAGMENT`, | ||
| [512]: `NEED_PATCH`, | ||
| [1024]: `DYNAMIC_SLOTS`, | ||
| [2048]: `DEV_ROOT_FRAGMENT`, | ||
| [-1]: `CACHED`, | ||
| [-2]: `BAIL` | ||
| }; | ||
| //#endregion | ||
| //#region packages/shared/src/shapeFlags.ts | ||
| const ShapeFlags = { | ||
| "ELEMENT": 1, | ||
| "1": "ELEMENT", | ||
| "FUNCTIONAL_COMPONENT": 2, | ||
| "2": "FUNCTIONAL_COMPONENT", | ||
| "STATEFUL_COMPONENT": 4, | ||
| "4": "STATEFUL_COMPONENT", | ||
| "TEXT_CHILDREN": 8, | ||
| "8": "TEXT_CHILDREN", | ||
| "ARRAY_CHILDREN": 16, | ||
| "16": "ARRAY_CHILDREN", | ||
| "SLOTS_CHILDREN": 32, | ||
| "32": "SLOTS_CHILDREN", | ||
| "TELEPORT": 64, | ||
| "64": "TELEPORT", | ||
| "SUSPENSE": 128, | ||
| "128": "SUSPENSE", | ||
| "COMPONENT_SHOULD_KEEP_ALIVE": 256, | ||
| "256": "COMPONENT_SHOULD_KEEP_ALIVE", | ||
| "COMPONENT_KEPT_ALIVE": 512, | ||
| "512": "COMPONENT_KEPT_ALIVE", | ||
| "COMPONENT": 6, | ||
| "6": "COMPONENT" | ||
| "ELEMENT": 1, | ||
| "1": "ELEMENT", | ||
| "FUNCTIONAL_COMPONENT": 2, | ||
| "2": "FUNCTIONAL_COMPONENT", | ||
| "STATEFUL_COMPONENT": 4, | ||
| "4": "STATEFUL_COMPONENT", | ||
| "TEXT_CHILDREN": 8, | ||
| "8": "TEXT_CHILDREN", | ||
| "ARRAY_CHILDREN": 16, | ||
| "16": "ARRAY_CHILDREN", | ||
| "SLOTS_CHILDREN": 32, | ||
| "32": "SLOTS_CHILDREN", | ||
| "TELEPORT": 64, | ||
| "64": "TELEPORT", | ||
| "SUSPENSE": 128, | ||
| "128": "SUSPENSE", | ||
| "COMPONENT_SHOULD_KEEP_ALIVE": 256, | ||
| "256": "COMPONENT_SHOULD_KEEP_ALIVE", | ||
| "COMPONENT_KEPT_ALIVE": 512, | ||
| "512": "COMPONENT_KEPT_ALIVE", | ||
| "COMPONENT": 6, | ||
| "6": "COMPONENT" | ||
| }; | ||
| //#endregion | ||
| //#region packages/shared/src/slotFlags.ts | ||
| const SlotFlags = { | ||
| "STABLE": 1, | ||
| "1": "STABLE", | ||
| "DYNAMIC": 2, | ||
| "2": "DYNAMIC", | ||
| "FORWARDED": 3, | ||
| "3": "FORWARDED" | ||
| "STABLE": 1, | ||
| "1": "STABLE", | ||
| "DYNAMIC": 2, | ||
| "2": "DYNAMIC", | ||
| "FORWARDED": 3, | ||
| "3": "FORWARDED" | ||
| }; | ||
| /** | ||
| * Dev only | ||
| */ | ||
| const slotFlagsText = { | ||
| [1]: "STABLE", | ||
| [2]: "DYNAMIC", | ||
| [3]: "FORWARDED" | ||
| [1]: "STABLE", | ||
| [2]: "DYNAMIC", | ||
| [3]: "FORWARDED" | ||
| }; | ||
| //#endregion | ||
| //#region packages/shared/src/globalsAllowList.ts | ||
| const GLOBALS_ALLOWED = "Infinity,undefined,NaN,isFinite,isNaN,parseFloat,parseInt,decodeURI,decodeURIComponent,encodeURI,encodeURIComponent,Math,Number,Date,Array,Object,Boolean,String,RegExp,Map,Set,JSON,Intl,BigInt,console,Error,Symbol"; | ||
| const isGloballyAllowed = /* @__PURE__ */ makeMap(GLOBALS_ALLOWED); | ||
| /** @deprecated use `isGloballyAllowed` instead */ | ||
| const isGloballyWhitelisted = isGloballyAllowed; | ||
| //#endregion | ||
| //#region packages/shared/src/codeframe.ts | ||
| const range = 2; | ||
| function generateCodeFrame(source, start = 0, end = source.length) { | ||
| start = Math.max(0, Math.min(start, source.length)); | ||
| end = Math.max(0, Math.min(end, source.length)); | ||
| if (start > end) return ""; | ||
| let lines = source.split(/(\r?\n)/); | ||
| const newlineSequences = lines.filter((_, idx) => idx % 2 === 1); | ||
| lines = lines.filter((_, idx) => idx % 2 === 0); | ||
| let count = 0; | ||
| const res = []; | ||
| for (let i = 0; i < lines.length; i++) { | ||
| count += lines[i].length + (newlineSequences[i] && newlineSequences[i].length || 0); | ||
| if (count >= start) { | ||
| for (let j = i - range; j <= i + range || end > count; j++) { | ||
| if (j < 0 || j >= lines.length) continue; | ||
| const line = j + 1; | ||
| res.push( | ||
| `${line}${" ".repeat(Math.max(3 - String(line).length, 0))}| ${lines[j]}` | ||
| ); | ||
| const lineLength = lines[j].length; | ||
| const newLineSeqLength = newlineSequences[j] && newlineSequences[j].length || 0; | ||
| if (j === i) { | ||
| const pad = start - (count - (lineLength + newLineSeqLength)); | ||
| const length = Math.max( | ||
| 1, | ||
| end > count ? lineLength - pad : end - start | ||
| ); | ||
| res.push(` | ` + " ".repeat(pad) + "^".repeat(length)); | ||
| } else if (j > i) { | ||
| if (end > count) { | ||
| const length = Math.max(Math.min(end - count, lineLength), 1); | ||
| res.push(` | ` + "^".repeat(length)); | ||
| } | ||
| count += lineLength + newLineSeqLength; | ||
| } | ||
| } | ||
| break; | ||
| } | ||
| } | ||
| return res.join("\n"); | ||
| start = Math.max(0, Math.min(start, source.length)); | ||
| end = Math.max(0, Math.min(end, source.length)); | ||
| if (start > end) return ""; | ||
| let lines = source.split(/(\r?\n)/); | ||
| const newlineSequences = lines.filter((_, idx) => idx % 2 === 1); | ||
| lines = lines.filter((_, idx) => idx % 2 === 0); | ||
| let count = 0; | ||
| const res = []; | ||
| for (let i = 0; i < lines.length; i++) { | ||
| count += lines[i].length + (newlineSequences[i] && newlineSequences[i].length || 0); | ||
| if (count >= start) { | ||
| for (let j = i - range; j <= i + range || end > count; j++) { | ||
| if (j < 0 || j >= lines.length) continue; | ||
| const line = j + 1; | ||
| res.push(`${line}${" ".repeat(Math.max(3 - String(line).length, 0))}| ${lines[j]}`); | ||
| const lineLength = lines[j].length; | ||
| const newLineSeqLength = newlineSequences[j] && newlineSequences[j].length || 0; | ||
| if (j === i) { | ||
| const pad = start - (count - (lineLength + newLineSeqLength)); | ||
| const length = Math.max(1, end > count ? lineLength - pad : end - start); | ||
| res.push(` | ` + " ".repeat(pad) + "^".repeat(length)); | ||
| } else if (j > i) { | ||
| if (end > count) { | ||
| const length = Math.max(Math.min(end - count, lineLength), 1); | ||
| res.push(` | ` + "^".repeat(length)); | ||
| } | ||
| count += lineLength + newLineSeqLength; | ||
| } | ||
| } | ||
| break; | ||
| } | ||
| } | ||
| return res.join("\n"); | ||
| } | ||
| //#endregion | ||
| //#region packages/shared/src/normalizeProp.ts | ||
| function normalizeStyle(value) { | ||
| if (isArray(value)) { | ||
| const res = {}; | ||
| for (let i = 0; i < value.length; i++) { | ||
| const item = value[i]; | ||
| const normalized = isString(item) ? parseStringStyle(item) : normalizeStyle(item); | ||
| if (normalized) { | ||
| for (const key in normalized) { | ||
| res[key] = normalized[key]; | ||
| } | ||
| } | ||
| } | ||
| return res; | ||
| } else if (isString(value) || isObject(value)) { | ||
| return value; | ||
| } | ||
| if (isArray(value)) { | ||
| const res = {}; | ||
| for (let i = 0; i < value.length; i++) { | ||
| const item = value[i]; | ||
| const normalized = isString(item) ? parseStringStyle(item) : normalizeStyle(item); | ||
| if (normalized) for (const key in normalized) res[key] = normalized[key]; | ||
| } | ||
| return res; | ||
| } else if (isString(value) || isObject(value)) return value; | ||
| } | ||
@@ -288,56 +330,46 @@ const listDelimiterRE = /;(?![^(]*\))/g; | ||
| function parseStringStyle(cssText) { | ||
| const ret = {}; | ||
| cssText.replace(styleCommentRE, "").split(listDelimiterRE).forEach((item) => { | ||
| if (item) { | ||
| const tmp = item.split(propertyDelimiterRE); | ||
| tmp.length > 1 && (ret[tmp[0].trim()] = tmp[1].trim()); | ||
| } | ||
| }); | ||
| return ret; | ||
| const ret = {}; | ||
| cssText.replace(styleCommentRE, "").split(listDelimiterRE).forEach((item) => { | ||
| if (item) { | ||
| const tmp = item.split(propertyDelimiterRE); | ||
| tmp.length > 1 && (ret[tmp[0].trim()] = tmp[1].trim()); | ||
| } | ||
| }); | ||
| return ret; | ||
| } | ||
| function stringifyStyle(styles) { | ||
| if (!styles) return ""; | ||
| if (isString(styles)) return styles; | ||
| let ret = ""; | ||
| for (const key in styles) { | ||
| const value = styles[key]; | ||
| if (isString(value) || typeof value === "number") { | ||
| const normalizedKey = key.startsWith(`--`) ? key : hyphenate(key); | ||
| ret += `${normalizedKey}:${value};`; | ||
| } | ||
| } | ||
| return ret; | ||
| if (!styles) return ""; | ||
| if (isString(styles)) return styles; | ||
| let ret = ""; | ||
| for (const key in styles) { | ||
| const value = styles[key]; | ||
| if (isString(value) || typeof value === "number") { | ||
| const normalizedKey = key.startsWith(`--`) ? key : hyphenate(key); | ||
| ret += `${normalizedKey}:${value};`; | ||
| } | ||
| } | ||
| return ret; | ||
| } | ||
| function normalizeClass(value) { | ||
| let res = ""; | ||
| if (isString(value)) { | ||
| res = value; | ||
| } else if (isArray(value)) { | ||
| for (let i = 0; i < value.length; i++) { | ||
| const normalized = normalizeClass(value[i]); | ||
| if (normalized) { | ||
| res += normalized + " "; | ||
| } | ||
| } | ||
| } else if (isObject(value)) { | ||
| for (const name in value) { | ||
| if (value[name]) { | ||
| res += name + " "; | ||
| } | ||
| } | ||
| } | ||
| return res.trim(); | ||
| let res = ""; | ||
| if (isString(value)) res = value; | ||
| else if (isArray(value)) for (let i = 0; i < value.length; i++) { | ||
| const normalized = normalizeClass(value[i]); | ||
| if (normalized) res += normalized + " "; | ||
| } | ||
| else if (isObject(value)) { | ||
| for (const name in value) if (value[name]) res += name + " "; | ||
| } | ||
| return res.trim(); | ||
| } | ||
| function normalizeProps(props) { | ||
| if (!props) return null; | ||
| let { class: klass, style } = props; | ||
| if (klass && !isString(klass)) { | ||
| props.class = normalizeClass(klass); | ||
| } | ||
| if (style) { | ||
| props.style = normalizeStyle(style); | ||
| } | ||
| return props; | ||
| if (!props) return null; | ||
| let { class: klass, style } = props; | ||
| if (klass && !isString(klass)) props.class = normalizeClass(klass); | ||
| if (style) props.style = normalizeStyle(style); | ||
| return props; | ||
| } | ||
| //#endregion | ||
| //#region packages/shared/src/domTagConfig.ts | ||
| const HTML_TAGS = "html,body,base,head,link,meta,style,title,address,article,aside,footer,header,hgroup,h1,h2,h3,h4,h5,h6,nav,section,div,dd,dl,dt,figcaption,figure,picture,hr,img,li,main,ol,p,pre,ul,a,b,abbr,bdi,bdo,br,cite,code,data,dfn,em,i,kbd,mark,q,rp,rt,ruby,s,samp,small,span,strong,sub,sup,time,u,var,wbr,area,audio,map,track,video,embed,object,param,source,canvas,script,noscript,del,ins,caption,col,colgroup,table,thead,tbody,td,th,tr,button,datalist,fieldset,form,input,label,legend,meter,optgroup,option,output,progress,select,textarea,details,dialog,menu,summary,template,blockquote,iframe,tfoot"; | ||
@@ -351,18 +383,68 @@ const SVG_TAGS = "svg,animate,animateMotion,animateTransform,circle,clipPath,color-profile,defs,desc,discard,ellipse,feBlend,feColorMatrix,feComponentTransfer,feComposite,feConvolveMatrix,feDiffuseLighting,feDisplacementMap,feDistantLight,feDropShadow,feFlood,feFuncA,feFuncB,feFuncG,feFuncR,feGaussianBlur,feImage,feMerge,feMergeNode,feMorphology,feOffset,fePointLight,feSpecularLighting,feSpotLight,feTile,feTurbulence,filter,foreignObject,g,hatch,hatchpath,image,line,linearGradient,marker,mask,mesh,meshgradient,meshpatch,meshrow,metadata,mpath,path,pattern,polygon,polyline,radialGradient,rect,set,solidcolor,stop,switch,symbol,text,textPath,title,tspan,unknown,use,view"; | ||
| const BLOCK_TAGS = "address,article,aside,blockquote,dd,details,dialog,div,dl,dt,fieldset,figcaption,figure,footer,form,h1,h2,h3,h4,h5,h6,header,hgroup,hr,li,main,menu,nav,ol,p,pre,section,table,ul"; | ||
| /** | ||
| * Compiler only. | ||
| * Do NOT use in runtime code paths unless behind `__DEV__` flag. | ||
| */ | ||
| const isHTMLTag = /* @__PURE__ */ makeMap(HTML_TAGS); | ||
| /** | ||
| * Compiler only. | ||
| * Do NOT use in runtime code paths unless behind `__DEV__` flag. | ||
| */ | ||
| const isSVGTag = /* @__PURE__ */ makeMap(SVG_TAGS); | ||
| /** | ||
| * Compiler only. | ||
| * Do NOT use in runtime code paths unless behind `__DEV__` flag. | ||
| */ | ||
| const isMathMLTag = /* @__PURE__ */ makeMap(MATH_TAGS); | ||
| /** | ||
| * Compiler only. | ||
| * Do NOT use in runtime code paths unless behind `__DEV__` flag. | ||
| */ | ||
| const isVoidTag = /* @__PURE__ */ makeMap(VOID_TAGS); | ||
| /** | ||
| * Compiler only. | ||
| * Do NOT use in runtime code paths unless behind `__DEV__` flag. | ||
| */ | ||
| const isFormattingTag = /* @__PURE__ */ makeMap(FORMATTING_TAGS); | ||
| /** | ||
| * Compiler only. | ||
| * Do NOT use in runtime code paths unless behind `__DEV__` flag. | ||
| */ | ||
| const isAlwaysCloseTag = /* @__PURE__ */ makeMap(ALWAYS_CLOSE_TAGS); | ||
| /** | ||
| * Compiler only. | ||
| * Do NOT use in runtime code paths unless behind `__DEV__` flag. | ||
| */ | ||
| const isInlineTag = /* @__PURE__ */ makeMap(INLINE_TAGS); | ||
| /** | ||
| * Compiler only. | ||
| * Do NOT use in runtime code paths unless behind `__DEV__` flag. | ||
| */ | ||
| const isBlockTag = /* @__PURE__ */ makeMap(BLOCK_TAGS); | ||
| //#endregion | ||
| //#region packages/shared/src/domAttrConfig.ts | ||
| /** | ||
| * On the client we only need to offer special cases for boolean attributes that | ||
| * have different names from their corresponding dom properties: | ||
| * - itemscope -> N/A | ||
| * - allowfullscreen -> allowFullscreen | ||
| * - formnovalidate -> formNoValidate | ||
| * - ismap -> isMap | ||
| * - nomodule -> noModule | ||
| * - novalidate -> noValidate | ||
| * - readonly -> readOnly | ||
| */ | ||
| const specialBooleanAttrs = `itemscope,allowfullscreen,formnovalidate,ismap,nomodule,novalidate,readonly`; | ||
| const isSpecialBooleanAttr = /* @__PURE__ */ makeMap(specialBooleanAttrs); | ||
| const isBooleanAttr = /* @__PURE__ */ makeMap( | ||
| specialBooleanAttrs + `,async,autofocus,autoplay,controls,default,defer,disabled,hidden,inert,loop,open,required,reversed,scoped,seamless,checked,muted,multiple,selected` | ||
| ); | ||
| /** | ||
| * The full list is needed during SSR to produce the correct initial markup. | ||
| */ | ||
| const isBooleanAttr = /* @__PURE__ */ makeMap(specialBooleanAttrs + ",async,autofocus,autoplay,controls,default,defer,disabled,hidden,inert,loop,open,required,reversed,scoped,seamless,checked,muted,multiple,selected"); | ||
| /** | ||
| * Boolean attributes should be included if the value is truthy or ''. | ||
| * e.g. `<select multiple>` compiles to `{ multiple: '' }` | ||
| */ | ||
| function includeBooleanAttr(value) { | ||
| return !!value || value === ""; | ||
| return !!value || value === ""; | ||
| } | ||
@@ -372,268 +454,225 @@ const unsafeAttrCharRE = /[>/="'\u0009\u000a\u000c\u0020]/; | ||
| function isSSRSafeAttrName(name) { | ||
| if (attrValidationCache.hasOwnProperty(name)) { | ||
| return attrValidationCache[name]; | ||
| } | ||
| const isUnsafe = unsafeAttrCharRE.test(name); | ||
| if (isUnsafe) { | ||
| console.error(`unsafe attribute name: ${name}`); | ||
| } | ||
| return attrValidationCache[name] = !isUnsafe; | ||
| if (attrValidationCache.hasOwnProperty(name)) return attrValidationCache[name]; | ||
| const isUnsafe = unsafeAttrCharRE.test(name); | ||
| if (isUnsafe) console.error(`unsafe attribute name: ${name}`); | ||
| return attrValidationCache[name] = !isUnsafe; | ||
| } | ||
| const propsToAttrMap = { | ||
| acceptCharset: "accept-charset", | ||
| className: "class", | ||
| htmlFor: "for", | ||
| httpEquiv: "http-equiv" | ||
| acceptCharset: "accept-charset", | ||
| className: "class", | ||
| htmlFor: "for", | ||
| httpEquiv: "http-equiv" | ||
| }; | ||
| const isKnownHtmlAttr = /* @__PURE__ */ makeMap( | ||
| `accept,accept-charset,accesskey,action,align,allow,alt,async,autocapitalize,autocomplete,autofocus,autoplay,background,bgcolor,border,buffered,capture,challenge,charset,checked,cite,class,code,codebase,color,cols,colspan,content,contenteditable,contextmenu,controls,coords,crossorigin,csp,data,datetime,decoding,default,defer,dir,dirname,disabled,download,draggable,dropzone,enctype,enterkeyhint,for,form,formaction,formenctype,formmethod,formnovalidate,formtarget,headers,height,hidden,high,href,hreflang,http-equiv,icon,id,importance,inert,integrity,ismap,itemprop,keytype,kind,label,lang,language,loading,list,loop,low,manifest,max,maxlength,minlength,media,min,multiple,muted,name,novalidate,open,optimum,pattern,ping,placeholder,poster,preload,radiogroup,readonly,referrerpolicy,rel,required,reversed,rows,rowspan,sandbox,scope,scoped,selected,shape,size,sizes,slot,span,spellcheck,src,srcdoc,srclang,srcset,start,step,style,summary,tabindex,target,title,translate,type,usemap,value,width,wrap` | ||
| ); | ||
| const isKnownSvgAttr = /* @__PURE__ */ makeMap( | ||
| `xmlns,accent-height,accumulate,additive,alignment-baseline,alphabetic,amplitude,arabic-form,ascent,attributeName,attributeType,azimuth,baseFrequency,baseline-shift,baseProfile,bbox,begin,bias,by,calcMode,cap-height,class,clip,clipPathUnits,clip-path,clip-rule,color,color-interpolation,color-interpolation-filters,color-profile,color-rendering,contentScriptType,contentStyleType,crossorigin,cursor,cx,cy,d,decelerate,descent,diffuseConstant,direction,display,divisor,dominant-baseline,dur,dx,dy,edgeMode,elevation,enable-background,end,exponent,fill,fill-opacity,fill-rule,filter,filterRes,filterUnits,flood-color,flood-opacity,font-family,font-size,font-size-adjust,font-stretch,font-style,font-variant,font-weight,format,from,fr,fx,fy,g1,g2,glyph-name,glyph-orientation-horizontal,glyph-orientation-vertical,glyphRef,gradientTransform,gradientUnits,hanging,height,href,hreflang,horiz-adv-x,horiz-origin-x,id,ideographic,image-rendering,in,in2,intercept,k,k1,k2,k3,k4,kernelMatrix,kernelUnitLength,kerning,keyPoints,keySplines,keyTimes,lang,lengthAdjust,letter-spacing,lighting-color,limitingConeAngle,local,marker-end,marker-mid,marker-start,markerHeight,markerUnits,markerWidth,mask,maskContentUnits,maskUnits,mathematical,max,media,method,min,mode,name,numOctaves,offset,opacity,operator,order,orient,orientation,origin,overflow,overline-position,overline-thickness,panose-1,paint-order,path,pathLength,patternContentUnits,patternTransform,patternUnits,ping,pointer-events,points,pointsAtX,pointsAtY,pointsAtZ,preserveAlpha,preserveAspectRatio,primitiveUnits,r,radius,referrerPolicy,refX,refY,rel,rendering-intent,repeatCount,repeatDur,requiredExtensions,requiredFeatures,restart,result,rotate,rx,ry,scale,seed,shape-rendering,slope,spacing,specularConstant,specularExponent,speed,spreadMethod,startOffset,stdDeviation,stemh,stemv,stitchTiles,stop-color,stop-opacity,strikethrough-position,strikethrough-thickness,string,stroke,stroke-dasharray,stroke-dashoffset,stroke-linecap,stroke-linejoin,stroke-miterlimit,stroke-opacity,stroke-width,style,surfaceScale,systemLanguage,tabindex,tableValues,target,targetX,targetY,text-anchor,text-decoration,text-rendering,textLength,to,transform,transform-origin,type,u1,u2,underline-position,underline-thickness,unicode,unicode-bidi,unicode-range,units-per-em,v-alphabetic,v-hanging,v-ideographic,v-mathematical,values,vector-effect,version,vert-adv-y,vert-origin-x,vert-origin-y,viewBox,viewTarget,visibility,width,widths,word-spacing,writing-mode,x,x-height,x1,x2,xChannelSelector,xlink:actuate,xlink:arcrole,xlink:href,xlink:role,xlink:show,xlink:title,xlink:type,xmlns:xlink,xml:base,xml:lang,xml:space,y,y1,y2,yChannelSelector,z,zoomAndPan` | ||
| ); | ||
| const isKnownMathMLAttr = /* @__PURE__ */ makeMap( | ||
| `accent,accentunder,actiontype,align,alignmentscope,altimg,altimg-height,altimg-valign,altimg-width,alttext,bevelled,close,columnsalign,columnlines,columnspan,denomalign,depth,dir,display,displaystyle,encoding,equalcolumns,equalrows,fence,fontstyle,fontweight,form,frame,framespacing,groupalign,height,href,id,indentalign,indentalignfirst,indentalignlast,indentshift,indentshiftfirst,indentshiftlast,indextype,justify,largetop,largeop,lquote,lspace,mathbackground,mathcolor,mathsize,mathvariant,maxsize,minlabelspacing,mode,other,overflow,position,rowalign,rowlines,rowspan,rquote,rspace,scriptlevel,scriptminsize,scriptsizemultiplier,selection,separator,separators,shift,side,src,stackalign,stretchy,subscriptshift,superscriptshift,symmetric,voffset,width,widths,xlink:href,xlink:show,xlink:type,xmlns` | ||
| ); | ||
| /** | ||
| * Known attributes, this is used for stringification of runtime static nodes | ||
| * so that we don't stringify bindings that cannot be set from HTML. | ||
| * Don't also forget to allow `data-*` and `aria-*`! | ||
| * Generated from https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes | ||
| */ | ||
| const isKnownHtmlAttr = /* @__PURE__ */ makeMap("accept,accept-charset,accesskey,action,align,allow,alt,async,autocapitalize,autocomplete,autofocus,autoplay,background,bgcolor,border,buffered,capture,challenge,charset,checked,cite,class,code,codebase,color,cols,colspan,content,contenteditable,contextmenu,controls,coords,crossorigin,csp,data,datetime,decoding,default,defer,dir,dirname,disabled,download,draggable,dropzone,enctype,enterkeyhint,for,form,formaction,formenctype,formmethod,formnovalidate,formtarget,headers,height,hidden,high,href,hreflang,http-equiv,icon,id,importance,inert,integrity,ismap,itemprop,keytype,kind,label,lang,language,loading,list,loop,low,manifest,max,maxlength,minlength,media,min,multiple,muted,name,novalidate,open,optimum,pattern,ping,placeholder,poster,preload,radiogroup,readonly,referrerpolicy,rel,required,reversed,rows,rowspan,sandbox,scope,scoped,selected,shape,size,sizes,slot,span,spellcheck,src,srcdoc,srclang,srcset,start,step,style,summary,tabindex,target,title,translate,type,usemap,value,width,wrap"); | ||
| /** | ||
| * Generated from https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute | ||
| */ | ||
| const isKnownSvgAttr = /* @__PURE__ */ makeMap("xmlns,accent-height,accumulate,additive,alignment-baseline,alphabetic,amplitude,arabic-form,ascent,attributeName,attributeType,azimuth,baseFrequency,baseline-shift,baseProfile,bbox,begin,bias,by,calcMode,cap-height,class,clip,clipPathUnits,clip-path,clip-rule,color,color-interpolation,color-interpolation-filters,color-profile,color-rendering,contentScriptType,contentStyleType,crossorigin,cursor,cx,cy,d,decelerate,descent,diffuseConstant,direction,display,divisor,dominant-baseline,dur,dx,dy,edgeMode,elevation,enable-background,end,exponent,fill,fill-opacity,fill-rule,filter,filterRes,filterUnits,flood-color,flood-opacity,font-family,font-size,font-size-adjust,font-stretch,font-style,font-variant,font-weight,format,from,fr,fx,fy,g1,g2,glyph-name,glyph-orientation-horizontal,glyph-orientation-vertical,glyphRef,gradientTransform,gradientUnits,hanging,height,href,hreflang,horiz-adv-x,horiz-origin-x,id,ideographic,image-rendering,in,in2,intercept,k,k1,k2,k3,k4,kernelMatrix,kernelUnitLength,kerning,keyPoints,keySplines,keyTimes,lang,lengthAdjust,letter-spacing,lighting-color,limitingConeAngle,local,marker-end,marker-mid,marker-start,markerHeight,markerUnits,markerWidth,mask,maskContentUnits,maskUnits,mathematical,max,media,method,min,mode,name,numOctaves,offset,opacity,operator,order,orient,orientation,origin,overflow,overline-position,overline-thickness,panose-1,paint-order,path,pathLength,patternContentUnits,patternTransform,patternUnits,ping,pointer-events,points,pointsAtX,pointsAtY,pointsAtZ,preserveAlpha,preserveAspectRatio,primitiveUnits,r,radius,referrerPolicy,refX,refY,rel,rendering-intent,repeatCount,repeatDur,requiredExtensions,requiredFeatures,restart,result,rotate,rx,ry,scale,seed,shape-rendering,slope,spacing,specularConstant,specularExponent,speed,spreadMethod,startOffset,stdDeviation,stemh,stemv,stitchTiles,stop-color,stop-opacity,strikethrough-position,strikethrough-thickness,string,stroke,stroke-dasharray,stroke-dashoffset,stroke-linecap,stroke-linejoin,stroke-miterlimit,stroke-opacity,stroke-width,style,surfaceScale,systemLanguage,tabindex,tableValues,target,targetX,targetY,text-anchor,text-decoration,text-rendering,textLength,to,transform,transform-origin,type,u1,u2,underline-position,underline-thickness,unicode,unicode-bidi,unicode-range,units-per-em,v-alphabetic,v-hanging,v-ideographic,v-mathematical,values,vector-effect,version,vert-adv-y,vert-origin-x,vert-origin-y,viewBox,viewTarget,visibility,width,widths,word-spacing,writing-mode,x,x-height,x1,x2,xChannelSelector,xlink:actuate,xlink:arcrole,xlink:href,xlink:role,xlink:show,xlink:title,xlink:type,xmlns:xlink,xml:base,xml:lang,xml:space,y,y1,y2,yChannelSelector,z,zoomAndPan"); | ||
| /** | ||
| * Generated from https://developer.mozilla.org/en-US/docs/Web/MathML/Attribute | ||
| */ | ||
| const isKnownMathMLAttr = /* @__PURE__ */ makeMap("accent,accentunder,actiontype,align,alignmentscope,altimg,altimg-height,altimg-valign,altimg-width,alttext,bevelled,close,columnsalign,columnlines,columnspan,denomalign,depth,dir,display,displaystyle,encoding,equalcolumns,equalrows,fence,fontstyle,fontweight,form,frame,framespacing,groupalign,height,href,id,indentalign,indentalignfirst,indentalignlast,indentshift,indentshiftfirst,indentshiftlast,indextype,justify,largetop,largeop,lquote,lspace,mathbackground,mathcolor,mathsize,mathvariant,maxsize,minlabelspacing,mode,other,overflow,position,rowalign,rowlines,rowspan,rquote,rspace,scriptlevel,scriptminsize,scriptsizemultiplier,selection,separator,separators,shift,side,src,stackalign,stretchy,subscriptshift,superscriptshift,symmetric,voffset,width,widths,xlink:href,xlink:show,xlink:type,xmlns"); | ||
| /** | ||
| * Shared between server-renderer and runtime-core hydration logic | ||
| */ | ||
| function isRenderableAttrValue(value) { | ||
| if (value == null) { | ||
| return false; | ||
| } | ||
| const type = typeof value; | ||
| return type === "string" || type === "number" || type === "boolean"; | ||
| if (value == null) return false; | ||
| const type = typeof value; | ||
| return type === "string" || type === "number" || type === "boolean"; | ||
| } | ||
| function shouldSetAsAttr(tagName, key) { | ||
| if (key === "spellcheck" || key === "draggable" || key === "translate" || key === "autocorrect") { | ||
| return true; | ||
| } | ||
| if (key === "form") { | ||
| return true; | ||
| } | ||
| if (key === "list" && tagName === "INPUT") { | ||
| return true; | ||
| } | ||
| if (key === "type" && tagName === "TEXTAREA") { | ||
| return true; | ||
| } | ||
| if ((key === "width" || key === "height") && (tagName === "IMG" || tagName === "VIDEO" || tagName === "CANVAS" || tagName === "SOURCE")) { | ||
| return true; | ||
| } | ||
| if (key === "sandbox" && tagName === "IFRAME") { | ||
| return true; | ||
| } | ||
| return false; | ||
| if (key === "spellcheck" || key === "draggable" || key === "translate" || key === "autocorrect") return true; | ||
| if (key === "form") return true; | ||
| if (key === "list" && tagName === "INPUT") return true; | ||
| if (key === "type" && tagName === "TEXTAREA") return true; | ||
| if ((key === "width" || key === "height") && (tagName === "IMG" || tagName === "VIDEO" || tagName === "CANVAS" || tagName === "SOURCE")) return true; | ||
| if (key === "sandbox" && tagName === "IFRAME") return true; | ||
| return false; | ||
| } | ||
| //#endregion | ||
| //#region packages/shared/src/domNamespace.ts | ||
| const Namespaces = { | ||
| "HTML": 0, | ||
| "0": "HTML", | ||
| "SVG": 1, | ||
| "1": "SVG", | ||
| "MATH_ML": 2, | ||
| "2": "MATH_ML" | ||
| "HTML": 0, | ||
| "0": "HTML", | ||
| "SVG": 1, | ||
| "1": "SVG", | ||
| "MATH_ML": 2, | ||
| "2": "MATH_ML" | ||
| }; | ||
| //#endregion | ||
| //#region packages/shared/src/escapeHtml.ts | ||
| const escapeRE = /["'&<>]/; | ||
| function escapeHtml(string) { | ||
| const str = "" + string; | ||
| const match = escapeRE.exec(str); | ||
| if (!match) { | ||
| return str; | ||
| } | ||
| let html = ""; | ||
| let escaped; | ||
| let index; | ||
| let lastIndex = 0; | ||
| for (index = match.index; index < str.length; index++) { | ||
| switch (str.charCodeAt(index)) { | ||
| case 34: | ||
| escaped = """; | ||
| break; | ||
| case 38: | ||
| escaped = "&"; | ||
| break; | ||
| case 39: | ||
| escaped = "'"; | ||
| break; | ||
| case 60: | ||
| escaped = "<"; | ||
| break; | ||
| case 62: | ||
| escaped = ">"; | ||
| break; | ||
| default: | ||
| continue; | ||
| } | ||
| if (lastIndex !== index) { | ||
| html += str.slice(lastIndex, index); | ||
| } | ||
| lastIndex = index + 1; | ||
| html += escaped; | ||
| } | ||
| return lastIndex !== index ? html + str.slice(lastIndex, index) : html; | ||
| const str = "" + string; | ||
| const match = escapeRE.exec(str); | ||
| if (!match) return str; | ||
| let html = ""; | ||
| let escaped; | ||
| let index; | ||
| let lastIndex = 0; | ||
| for (index = match.index; index < str.length; index++) { | ||
| switch (str.charCodeAt(index)) { | ||
| case 34: | ||
| escaped = """; | ||
| break; | ||
| case 38: | ||
| escaped = "&"; | ||
| break; | ||
| case 39: | ||
| escaped = "'"; | ||
| break; | ||
| case 60: | ||
| escaped = "<"; | ||
| break; | ||
| case 62: | ||
| escaped = ">"; | ||
| break; | ||
| default: continue; | ||
| } | ||
| if (lastIndex !== index) html += str.slice(lastIndex, index); | ||
| lastIndex = index + 1; | ||
| html += escaped; | ||
| } | ||
| return lastIndex !== index ? html + str.slice(lastIndex, index) : html; | ||
| } | ||
| const commentStripRE = /^-?>|<!--|-->|--!>|<!-$/g; | ||
| function escapeHtmlComment(src) { | ||
| return src.replace(commentStripRE, ""); | ||
| return src.replace(commentStripRE, ""); | ||
| } | ||
| const cssVarNameEscapeSymbolsRE = /[ !"#$%&'()*+,./:;<=>?@[\\\]^`{|}~]/g; | ||
| function getEscapedCssVarName(key, doubleEscape) { | ||
| return key.replace( | ||
| cssVarNameEscapeSymbolsRE, | ||
| (s) => doubleEscape ? s === '"' ? '\\\\\\"' : `\\\\${s}` : `\\${s}` | ||
| ); | ||
| return key.replace(cssVarNameEscapeSymbolsRE, (s) => doubleEscape ? s === "\"" ? "\\\\\\\"" : `\\\\${s}` : `\\${s}`); | ||
| } | ||
| //#endregion | ||
| //#region packages/shared/src/looseEqual.ts | ||
| function looseCompareArrays(a, b) { | ||
| if (a.length !== b.length) return false; | ||
| let equal = true; | ||
| for (let i = 0; equal && i < a.length; i++) { | ||
| equal = looseEqual(a[i], b[i]); | ||
| } | ||
| return equal; | ||
| if (a.length !== b.length) return false; | ||
| let equal = true; | ||
| for (let i = 0; equal && i < a.length; i++) equal = looseEqual(a[i], b[i]); | ||
| return equal; | ||
| } | ||
| function looseEqual(a, b) { | ||
| if (a === b) return true; | ||
| let aValidType = isDate(a); | ||
| let bValidType = isDate(b); | ||
| if (aValidType || bValidType) { | ||
| return aValidType && bValidType ? a.getTime() === b.getTime() : false; | ||
| } | ||
| aValidType = isSymbol(a); | ||
| bValidType = isSymbol(b); | ||
| if (aValidType || bValidType) { | ||
| return a === b; | ||
| } | ||
| aValidType = isArray(a); | ||
| bValidType = isArray(b); | ||
| if (aValidType || bValidType) { | ||
| return aValidType && bValidType ? looseCompareArrays(a, b) : false; | ||
| } | ||
| aValidType = isObject(a); | ||
| bValidType = isObject(b); | ||
| if (aValidType || bValidType) { | ||
| if (!aValidType || !bValidType) { | ||
| return false; | ||
| } | ||
| const aKeysCount = Object.keys(a).length; | ||
| const bKeysCount = Object.keys(b).length; | ||
| if (aKeysCount !== bKeysCount) { | ||
| return false; | ||
| } | ||
| for (const key in a) { | ||
| const aHasKey = a.hasOwnProperty(key); | ||
| const bHasKey = b.hasOwnProperty(key); | ||
| if (aHasKey && !bHasKey || !aHasKey && bHasKey || !looseEqual(a[key], b[key])) { | ||
| return false; | ||
| } | ||
| } | ||
| } | ||
| return String(a) === String(b); | ||
| if (a === b) return true; | ||
| let aValidType = isDate(a); | ||
| let bValidType = isDate(b); | ||
| if (aValidType || bValidType) return aValidType && bValidType ? a.getTime() === b.getTime() : false; | ||
| aValidType = isSymbol(a); | ||
| bValidType = isSymbol(b); | ||
| if (aValidType || bValidType) return a === b; | ||
| aValidType = isArray(a); | ||
| bValidType = isArray(b); | ||
| if (aValidType || bValidType) return aValidType && bValidType ? looseCompareArrays(a, b) : false; | ||
| aValidType = isObject(a); | ||
| bValidType = isObject(b); | ||
| if (aValidType || bValidType) { | ||
| if (!aValidType || !bValidType) return false; | ||
| if (Object.keys(a).length !== Object.keys(b).length) return false; | ||
| for (const key in a) { | ||
| const aHasKey = a.hasOwnProperty(key); | ||
| const bHasKey = b.hasOwnProperty(key); | ||
| if (aHasKey && !bHasKey || !aHasKey && bHasKey || !looseEqual(a[key], b[key])) return false; | ||
| } | ||
| } | ||
| return String(a) === String(b); | ||
| } | ||
| function looseIndexOf(arr, val) { | ||
| return arr.findIndex((item) => looseEqual(item, val)); | ||
| return arr.findIndex((item) => looseEqual(item, val)); | ||
| } | ||
| //#endregion | ||
| //#region packages/shared/src/toDisplayString.ts | ||
| const isRef = (val) => { | ||
| return !!(val && val["__v_isRef"] === true); | ||
| return !!(val && val["__v_isRef"] === true); | ||
| }; | ||
| /** | ||
| * For converting {{ interpolation }} values to displayed strings. | ||
| * @private | ||
| */ | ||
| const toDisplayString = (val) => { | ||
| switch (typeof val) { | ||
| case "string": | ||
| return val; | ||
| case "object": | ||
| if (val) { | ||
| if (isRef(val)) { | ||
| return toDisplayString(val.value); | ||
| } else if (isArray(val) || val.toString === objectToString || !isFunction(val.toString)) { | ||
| return JSON.stringify(val, replacer, 2); | ||
| } | ||
| } | ||
| default: | ||
| return val == null ? "" : String(val); | ||
| } | ||
| switch (typeof val) { | ||
| case "string": return val; | ||
| case "object": if (val) { | ||
| if (isRef(val)) return toDisplayString(val.value); | ||
| else if (isArray(val) || val.toString === objectToString || !isFunction(val.toString)) return JSON.stringify(val, replacer, 2); | ||
| } | ||
| default: return val == null ? "" : String(val); | ||
| } | ||
| }; | ||
| const replacer = (_key, val) => { | ||
| if (isRef(val)) { | ||
| return replacer(_key, val.value); | ||
| } else if (isMap(val)) { | ||
| return { | ||
| [`Map(${val.size})`]: [...val.entries()].reduce( | ||
| (entries, [key, val2], i) => { | ||
| entries[stringifySymbol(key, i) + " =>"] = val2; | ||
| return entries; | ||
| }, | ||
| {} | ||
| ) | ||
| }; | ||
| } else if (isSet(val)) { | ||
| return { | ||
| [`Set(${val.size})`]: [...val.values()].map((v) => stringifySymbol(v)) | ||
| }; | ||
| } else if (isSymbol(val)) { | ||
| return stringifySymbol(val); | ||
| } else if (isObject(val) && !isArray(val) && !isPlainObject(val)) { | ||
| return String(val); | ||
| } | ||
| return val; | ||
| if (isRef(val)) return replacer(_key, val.value); | ||
| else if (isMap(val)) return { [`Map(${val.size})`]: [...val.entries()].reduce((entries, [key, val], i) => { | ||
| entries[stringifySymbol(key, i) + " =>"] = val; | ||
| return entries; | ||
| }, {}) }; | ||
| else if (isSet(val)) return { [`Set(${val.size})`]: [...val.values()].map((v) => stringifySymbol(v)) }; | ||
| else if (isSymbol(val)) return stringifySymbol(val); | ||
| else if (isObject(val) && !isArray(val) && !isPlainObject(val)) return String(val); | ||
| return val; | ||
| }; | ||
| const stringifySymbol = (v, i = "") => { | ||
| var _a; | ||
| return ( | ||
| // Symbol.description in es2019+ so we need to cast here to pass | ||
| // the lib: es2016 check | ||
| isSymbol(v) ? `Symbol(${(_a = v.description) != null ? _a : i})` : v | ||
| ); | ||
| var _description; | ||
| return isSymbol(v) ? `Symbol(${(_description = v.description) !== null && _description !== void 0 ? _description : i})` : v; | ||
| }; | ||
| //#endregion | ||
| //#region packages/shared/src/subSequence.ts | ||
| function getSequence(arr) { | ||
| const p = arr.slice(); | ||
| const result = [0]; | ||
| let i, j, u, v, c; | ||
| const len = arr.length; | ||
| for (i = 0; i < len; i++) { | ||
| const arrI = arr[i]; | ||
| if (arrI !== 0) { | ||
| j = result[result.length - 1]; | ||
| if (arr[j] < arrI) { | ||
| p[i] = j; | ||
| result.push(i); | ||
| continue; | ||
| } | ||
| u = 0; | ||
| v = result.length - 1; | ||
| while (u < v) { | ||
| c = u + v >> 1; | ||
| if (arr[result[c]] < arrI) { | ||
| u = c + 1; | ||
| } else { | ||
| v = c; | ||
| } | ||
| } | ||
| if (arrI < arr[result[u]]) { | ||
| if (u > 0) { | ||
| p[i] = result[u - 1]; | ||
| } | ||
| result[u] = i; | ||
| } | ||
| } | ||
| } | ||
| u = result.length; | ||
| v = result[u - 1]; | ||
| while (u-- > 0) { | ||
| result[u] = v; | ||
| v = p[v]; | ||
| } | ||
| return result; | ||
| const p = arr.slice(); | ||
| const result = [0]; | ||
| let i, j, u, v, c; | ||
| const len = arr.length; | ||
| for (i = 0; i < len; i++) { | ||
| const arrI = arr[i]; | ||
| if (arrI !== 0) { | ||
| j = result[result.length - 1]; | ||
| if (arr[j] < arrI) { | ||
| p[i] = j; | ||
| result.push(i); | ||
| continue; | ||
| } | ||
| u = 0; | ||
| v = result.length - 1; | ||
| while (u < v) { | ||
| c = u + v >> 1; | ||
| if (arr[result[c]] < arrI) u = c + 1; | ||
| else v = c; | ||
| } | ||
| if (arrI < arr[result[u]]) { | ||
| if (u > 0) p[i] = result[u - 1]; | ||
| result[u] = i; | ||
| } | ||
| } | ||
| } | ||
| u = result.length; | ||
| v = result[u - 1]; | ||
| while (u-- > 0) { | ||
| result[u] = v; | ||
| v = p[v]; | ||
| } | ||
| return result; | ||
| } | ||
| //#endregion | ||
| //#region packages/shared/src/cssVars.ts | ||
| /** | ||
| * Normalize CSS var value created by `v-bind` in `<style>` block | ||
| * See https://github.com/vuejs/core/pull/12461#issuecomment-2495804664 | ||
| */ | ||
| function normalizeCssVarValue(value) { | ||
| if (value == null) { | ||
| return "initial"; | ||
| } | ||
| if (typeof value === "string") { | ||
| return value === "" ? " " : value; | ||
| } | ||
| return String(value); | ||
| if (value == null) return "initial"; | ||
| if (typeof value === "string") return value === "" ? " " : value; | ||
| if (typeof value !== "number" || !Number.isFinite(value)) {} | ||
| return String(value); | ||
| } | ||
| //#endregion | ||
| exports.EMPTY_ARR = EMPTY_ARR; | ||
@@ -723,2 +762,2 @@ exports.EMPTY_OBJ = EMPTY_OBJ; | ||
| exports.toRawType = toRawType; | ||
| exports.toTypeString = toTypeString; | ||
| exports.toTypeString = toTypeString; |
+264
-252
@@ -0,12 +1,14 @@ | ||
| //#region temp/packages/shared/src/makeMap.d.ts | ||
| /** | ||
| * Make a map and return a function for checking if a key | ||
| * is in that map. | ||
| * IMPORTANT: all calls of this function must be prefixed with | ||
| * \/\*#\_\_PURE\_\_\*\/ | ||
| * So that rollup can tree-shake them if necessary. | ||
| */ | ||
| * Make a map and return a function for checking if a key | ||
| * is in that map. | ||
| * IMPORTANT: all calls of this function must be prefixed with | ||
| * \/\*#\_\_PURE\_\_\*\/ | ||
| * So that they can be tree-shaken if necessary. | ||
| */ | ||
| export declare function makeMap(str: string): (key: string) => boolean; | ||
| //#endregion | ||
| //#region temp/packages/shared/src/general.d.ts | ||
| export declare const EMPTY_OBJ: { | ||
| readonly [key: string]: any; | ||
| readonly [key: string]: any; | ||
| }; | ||
@@ -16,8 +18,8 @@ export declare const EMPTY_ARR: readonly never[]; | ||
| /** | ||
| * Always return true. | ||
| */ | ||
| * Always return true. | ||
| */ | ||
| export declare const YES: () => boolean; | ||
| /** | ||
| * Always return false. | ||
| */ | ||
| * Always return false. | ||
| */ | ||
| export declare const NO: () => boolean; | ||
@@ -49,23 +51,23 @@ export declare const isOn: (key: string) => boolean; | ||
| /** | ||
| * @private | ||
| */ | ||
| * @private | ||
| */ | ||
| export declare const camelize: (str: string) => string; | ||
| /** | ||
| * @private | ||
| */ | ||
| * @private | ||
| */ | ||
| export declare const hyphenate: (str: string) => string; | ||
| /** | ||
| * @private | ||
| */ | ||
| * @private | ||
| */ | ||
| export declare const capitalize: <T extends string>(str: T) => Capitalize<T>; | ||
| /** | ||
| * @private | ||
| */ | ||
| export declare const toHandlerKey: <T extends string>(str: T) => T extends '' ? '' : `on${Capitalize<T>}`; | ||
| * @private | ||
| */ | ||
| export declare const toHandlerKey: <T extends string>(str: T) => T extends "" ? "" : `on${Capitalize<T>}`; | ||
| /** | ||
| * #13070 When v-model and v-model:model directives are used together, | ||
| * they will generate the same modelModifiers prop, | ||
| * so a `$` suffix is added to avoid conflicts. | ||
| * @private | ||
| */ | ||
| * #13070 When v-model and v-model:model directives are used together, | ||
| * they will generate the same modelModifiers prop, | ||
| * so a `$` suffix is added to avoid conflicts. | ||
| * @private | ||
| */ | ||
| export declare const getModifierPropName: (name: string) => string; | ||
@@ -76,10 +78,10 @@ export declare const hasChanged: (value: any, oldValue: any) => boolean; | ||
| /** | ||
| * "123-foo" will be parsed to 123 | ||
| * This is used for the .number modifier in v-model | ||
| */ | ||
| * "123-foo" will be parsed to 123 | ||
| * This is used for the .number modifier in v-model | ||
| */ | ||
| export declare const looseToNumber: (val: any) => any; | ||
| /** | ||
| * Only concerns number-like strings | ||
| * "123-foo" will be returned as-is | ||
| */ | ||
| * Only concerns number-like strings | ||
| * "123-foo" will be returned as-is | ||
| */ | ||
| export declare const toNumber: (val: any) => any; | ||
@@ -90,165 +92,171 @@ export declare const getGlobalThis: () => any; | ||
| export declare function canSetValueDirectly(tagName: string): boolean; | ||
| //#endregion | ||
| //#region temp/packages/shared/src/patchFlags.d.ts | ||
| /** | ||
| * Patch flags are optimization hints generated by the compiler. | ||
| * when a block with dynamicChildren is encountered during diff, the algorithm | ||
| * enters "optimized mode". In this mode, we know that the vdom is produced by | ||
| * a render function generated by the compiler, so the algorithm only needs to | ||
| * handle updates explicitly marked by these patch flags. | ||
| * | ||
| * Patch flags can be combined using the | bitwise operator and can be checked | ||
| * using the & operator, e.g. | ||
| * | ||
| * ```js | ||
| * const flag = TEXT | CLASS | ||
| * if (flag & TEXT) { ... } | ||
| * ``` | ||
| * | ||
| * Check the `patchElement` function in '../../runtime-core/src/renderer.ts' to see how the | ||
| * flags are handled during diff. | ||
| */ | ||
| * Patch flags are optimization hints generated by the compiler. | ||
| * when a block with dynamicChildren is encountered during diff, the algorithm | ||
| * enters "optimized mode". In this mode, we know that the vdom is produced by | ||
| * a render function generated by the compiler, so the algorithm only needs to | ||
| * handle updates explicitly marked by these patch flags. | ||
| * | ||
| * Patch flags can be combined using the | bitwise operator and can be checked | ||
| * using the & operator, e.g. | ||
| * | ||
| * ```js | ||
| * const flag = TEXT | CLASS | ||
| * if (flag & TEXT) { ... } | ||
| * ``` | ||
| * | ||
| * Check the `patchElement` function in '../../runtime-core/src/renderer.ts' to see how the | ||
| * flags are handled during diff. | ||
| */ | ||
| export declare enum PatchFlags { | ||
| /** | ||
| * Indicates an element with dynamic textContent (children fast path) | ||
| */ | ||
| TEXT = 1, | ||
| /** | ||
| * Indicates an element with dynamic class binding. | ||
| */ | ||
| CLASS = 2, | ||
| /** | ||
| * Indicates an element with dynamic style | ||
| * The compiler pre-compiles static string styles into static objects | ||
| * + detects and hoists inline static objects | ||
| * e.g. `style="color: red"` and `:style="{ color: 'red' }"` both get hoisted | ||
| * as: | ||
| * ```js | ||
| * const style = { color: 'red' } | ||
| * render() { return e('div', { style }) } | ||
| * ``` | ||
| */ | ||
| STYLE = 4, | ||
| /** | ||
| * Indicates an element that has non-class/style dynamic props. | ||
| * Can also be on a component that has any dynamic props (includes | ||
| * class/style). when this flag is present, the vnode also has a dynamicProps | ||
| * array that contains the keys of the props that may change so the runtime | ||
| * can diff them faster (without having to worry about removed props) | ||
| */ | ||
| PROPS = 8, | ||
| /** | ||
| * Indicates an element with props with dynamic keys. When keys change, a full | ||
| * diff is always needed to remove the old key. This flag is mutually | ||
| * exclusive with CLASS, STYLE and PROPS. | ||
| */ | ||
| FULL_PROPS = 16, | ||
| /** | ||
| * Indicates an element that requires props hydration | ||
| * (but not necessarily patching) | ||
| * e.g. event listeners & v-bind with prop modifier | ||
| */ | ||
| NEED_HYDRATION = 32, | ||
| /** | ||
| * Indicates a fragment whose children order doesn't change. | ||
| */ | ||
| STABLE_FRAGMENT = 64, | ||
| /** | ||
| * Indicates a fragment with keyed or partially keyed children | ||
| */ | ||
| KEYED_FRAGMENT = 128, | ||
| /** | ||
| * Indicates a fragment with unkeyed children. | ||
| */ | ||
| UNKEYED_FRAGMENT = 256, | ||
| /** | ||
| * Indicates an element that only needs non-props patching, e.g. ref or | ||
| * directives (onVnodeXXX hooks). since every patched vnode checks for refs | ||
| * and onVnodeXXX hooks, it simply marks the vnode so that a parent block | ||
| * will track it. | ||
| */ | ||
| NEED_PATCH = 512, | ||
| /** | ||
| * Indicates a component with dynamic slots (e.g. slot that references a v-for | ||
| * iterated value, or dynamic slot names). | ||
| * Components with this flag are always force updated. | ||
| */ | ||
| DYNAMIC_SLOTS = 1024, | ||
| /** | ||
| * Indicates a fragment that was created only because the user has placed | ||
| * comments at the root level of a template. This is a dev-only flag since | ||
| * comments are stripped in production. | ||
| */ | ||
| DEV_ROOT_FRAGMENT = 2048, | ||
| /** | ||
| * SPECIAL FLAGS ------------------------------------------------------------- | ||
| * Special flags are negative integers. They are never matched against using | ||
| * bitwise operators (bitwise matching should only happen in branches where | ||
| * patchFlag > 0), and are mutually exclusive. When checking for a special | ||
| * flag, simply check patchFlag === FLAG. | ||
| */ | ||
| /** | ||
| * Indicates a cached static vnode. This is also a hint for hydration to skip | ||
| * the entire sub tree since static content never needs to be updated. | ||
| */ | ||
| CACHED = -1, | ||
| /** | ||
| * A special flag that indicates that the diffing algorithm should bail out | ||
| * of optimized mode. For example, on block fragments created by renderSlot() | ||
| * when encountering non-compiler generated slots (i.e. manually written | ||
| * render functions, which should always be fully diffed) | ||
| * OR manually cloneVNodes | ||
| */ | ||
| BAIL = -2 | ||
| /** | ||
| * Indicates an element with dynamic textContent (children fast path) | ||
| */ | ||
| TEXT = 1, | ||
| /** | ||
| * Indicates an element with dynamic class binding. | ||
| */ | ||
| CLASS = 2, | ||
| /** | ||
| * Indicates an element with dynamic style | ||
| * The compiler pre-compiles static string styles into static objects | ||
| * + detects and hoists inline static objects | ||
| * e.g. `style="color: red"` and `:style="{ color: 'red' }"` both get hoisted | ||
| * as: | ||
| * ```js | ||
| * const style = { color: 'red' } | ||
| * render() { return e('div', { style }) } | ||
| * ``` | ||
| */ | ||
| STYLE = 4, | ||
| /** | ||
| * Indicates an element that has non-class/style dynamic props. | ||
| * Can also be on a component that has any dynamic props (includes | ||
| * class/style). when this flag is present, the vnode also has a dynamicProps | ||
| * array that contains the keys of the props that may change so the runtime | ||
| * can diff them faster (without having to worry about removed props) | ||
| */ | ||
| PROPS = 8, | ||
| /** | ||
| * Indicates an element with props with dynamic keys. When keys change, a full | ||
| * diff is always needed to remove the old key. This flag is mutually | ||
| * exclusive with CLASS, STYLE and PROPS. | ||
| */ | ||
| FULL_PROPS = 16, | ||
| /** | ||
| * Indicates an element that requires props hydration | ||
| * (but not necessarily patching) | ||
| * e.g. event listeners & v-bind with prop modifier | ||
| */ | ||
| NEED_HYDRATION = 32, | ||
| /** | ||
| * Indicates a fragment whose children order doesn't change. | ||
| */ | ||
| STABLE_FRAGMENT = 64, | ||
| /** | ||
| * Indicates a fragment with keyed or partially keyed children | ||
| */ | ||
| KEYED_FRAGMENT = 128, | ||
| /** | ||
| * Indicates a fragment with unkeyed children. | ||
| */ | ||
| UNKEYED_FRAGMENT = 256, | ||
| /** | ||
| * Indicates an element that only needs non-props patching, e.g. ref or | ||
| * directives (onVnodeXXX hooks). since every patched vnode checks for refs | ||
| * and onVnodeXXX hooks, it simply marks the vnode so that a parent block | ||
| * will track it. | ||
| */ | ||
| NEED_PATCH = 512, | ||
| /** | ||
| * Indicates a component with dynamic slots (e.g. slot that references a v-for | ||
| * iterated value, or dynamic slot names). | ||
| * Components with this flag are always force updated. | ||
| */ | ||
| DYNAMIC_SLOTS = 1024, | ||
| /** | ||
| * Indicates a fragment that was created only because the user has placed | ||
| * comments at the root level of a template. This is a dev-only flag since | ||
| * comments are stripped in production. | ||
| */ | ||
| DEV_ROOT_FRAGMENT = 2048, | ||
| /** | ||
| * SPECIAL FLAGS ------------------------------------------------------------- | ||
| * Special flags are negative integers. They are never matched against using | ||
| * bitwise operators (bitwise matching should only happen in branches where | ||
| * patchFlag > 0), and are mutually exclusive. When checking for a special | ||
| * flag, simply check patchFlag === FLAG. | ||
| */ | ||
| /** | ||
| * Indicates a cached static vnode. This is also a hint for hydration to skip | ||
| * the entire sub tree since static content never needs to be updated. | ||
| */ | ||
| CACHED = -1, | ||
| /** | ||
| * A special flag that indicates that the diffing algorithm should bail out | ||
| * of optimized mode. For example, on block fragments created by renderSlot() | ||
| * when encountering non-compiler generated slots (i.e. manually written | ||
| * render functions, which should always be fully diffed) | ||
| * OR manually cloneVNodes | ||
| */ | ||
| BAIL = -2 | ||
| } | ||
| /** | ||
| * dev only flag -> name mapping | ||
| */ | ||
| * dev only flag -> name mapping | ||
| */ | ||
| export declare const PatchFlagNames: Record<PatchFlags, string>; | ||
| //#endregion | ||
| //#region temp/packages/shared/src/shapeFlags.d.ts | ||
| export declare enum ShapeFlags { | ||
| ELEMENT = 1, | ||
| FUNCTIONAL_COMPONENT = 2, | ||
| STATEFUL_COMPONENT = 4, | ||
| TEXT_CHILDREN = 8, | ||
| ARRAY_CHILDREN = 16, | ||
| SLOTS_CHILDREN = 32, | ||
| TELEPORT = 64, | ||
| SUSPENSE = 128, | ||
| COMPONENT_SHOULD_KEEP_ALIVE = 256, | ||
| COMPONENT_KEPT_ALIVE = 512, | ||
| COMPONENT = 6 | ||
| ELEMENT = 1, | ||
| FUNCTIONAL_COMPONENT = 2, | ||
| STATEFUL_COMPONENT = 4, | ||
| TEXT_CHILDREN = 8, | ||
| ARRAY_CHILDREN = 16, | ||
| SLOTS_CHILDREN = 32, | ||
| TELEPORT = 64, | ||
| SUSPENSE = 128, | ||
| COMPONENT_SHOULD_KEEP_ALIVE = 256, | ||
| COMPONENT_KEPT_ALIVE = 512, | ||
| COMPONENT = 6 | ||
| } | ||
| //#endregion | ||
| //#region temp/packages/shared/src/slotFlags.d.ts | ||
| export declare enum SlotFlags { | ||
| /** | ||
| * Stable slots that only reference slot props or context state. The slot | ||
| * can fully capture its own dependencies so when passed down the parent won't | ||
| * need to force the child to update. | ||
| */ | ||
| STABLE = 1, | ||
| /** | ||
| * Slots that reference scope variables (v-for or an outer slot prop), or | ||
| * has conditional structure (v-if, v-for). The parent will need to force | ||
| * the child to update because the slot does not fully capture its dependencies. | ||
| */ | ||
| DYNAMIC = 2, | ||
| /** | ||
| * `<slot/>` being forwarded into a child component. Whether the parent needs | ||
| * to update the child is dependent on what kind of slots the parent itself | ||
| * received. This has to be refined at runtime, when the child's vnode | ||
| * is being created (in `normalizeChildren`) | ||
| */ | ||
| FORWARDED = 3 | ||
| /** | ||
| * Stable slots that only reference slot props or context state. The slot | ||
| * can fully capture its own dependencies so when passed down the parent won't | ||
| * need to force the child to update. | ||
| */ | ||
| STABLE = 1, | ||
| /** | ||
| * Slots that reference scope variables (v-for or an outer slot prop), or | ||
| * has conditional structure (v-if, v-for). The parent will need to force | ||
| * the child to update because the slot does not fully capture its dependencies. | ||
| */ | ||
| DYNAMIC = 2, | ||
| /** | ||
| * `<slot/>` being forwarded into a child component. Whether the parent needs | ||
| * to update the child is dependent on what kind of slots the parent itself | ||
| * received. This has to be refined at runtime, when the child's vnode | ||
| * is being created (in `normalizeChildren`) | ||
| */ | ||
| FORWARDED = 3 | ||
| } | ||
| /** | ||
| * Dev only | ||
| */ | ||
| * Dev only | ||
| */ | ||
| export declare const slotFlagsText: Record<SlotFlags, string>; | ||
| //#endregion | ||
| //#region temp/packages/shared/src/globalsAllowList.d.ts | ||
| export declare const isGloballyAllowed: (key: string) => boolean; | ||
| /** @deprecated use `isGloballyAllowed` instead */ | ||
| export declare const isGloballyWhitelisted: (key: string) => boolean; | ||
| //#endregion | ||
| //#region temp/packages/shared/src/codeframe.d.ts | ||
| export declare function generateCodeFrame(source: string, start?: number, end?: number): string; | ||
| //#endregion | ||
| //#region temp/packages/shared/src/normalizeProp.d.ts | ||
| export type NormalizedStyle = Record<string, unknown>; | ||
@@ -260,53 +268,55 @@ export declare function normalizeStyle(value: unknown): NormalizedStyle | string | undefined; | ||
| export declare function normalizeProps(props: Record<string, any> | null): Record<string, any> | null; | ||
| //#endregion | ||
| //#region temp/packages/shared/src/domTagConfig.d.ts | ||
| /** | ||
| * Compiler only. | ||
| * Do NOT use in runtime code paths unless behind `__DEV__` flag. | ||
| */ | ||
| * Compiler only. | ||
| * Do NOT use in runtime code paths unless behind `__DEV__` flag. | ||
| */ | ||
| export declare const isHTMLTag: (key: string) => boolean; | ||
| /** | ||
| * Compiler only. | ||
| * Do NOT use in runtime code paths unless behind `__DEV__` flag. | ||
| */ | ||
| * Compiler only. | ||
| * Do NOT use in runtime code paths unless behind `__DEV__` flag. | ||
| */ | ||
| export declare const isSVGTag: (key: string) => boolean; | ||
| /** | ||
| * Compiler only. | ||
| * Do NOT use in runtime code paths unless behind `__DEV__` flag. | ||
| */ | ||
| * Compiler only. | ||
| * Do NOT use in runtime code paths unless behind `__DEV__` flag. | ||
| */ | ||
| export declare const isMathMLTag: (key: string) => boolean; | ||
| /** | ||
| * Compiler only. | ||
| * Do NOT use in runtime code paths unless behind `__DEV__` flag. | ||
| */ | ||
| * Compiler only. | ||
| * Do NOT use in runtime code paths unless behind `__DEV__` flag. | ||
| */ | ||
| export declare const isVoidTag: (key: string) => boolean; | ||
| /** | ||
| * Compiler only. | ||
| * Do NOT use in runtime code paths unless behind `__DEV__` flag. | ||
| */ | ||
| * Compiler only. | ||
| * Do NOT use in runtime code paths unless behind `__DEV__` flag. | ||
| */ | ||
| export declare const isFormattingTag: (key: string) => boolean; | ||
| /** | ||
| * Compiler only. | ||
| * Do NOT use in runtime code paths unless behind `__DEV__` flag. | ||
| */ | ||
| * Compiler only. | ||
| * Do NOT use in runtime code paths unless behind `__DEV__` flag. | ||
| */ | ||
| export declare const isAlwaysCloseTag: (key: string) => boolean; | ||
| /** | ||
| * Compiler only. | ||
| * Do NOT use in runtime code paths unless behind `__DEV__` flag. | ||
| */ | ||
| * Compiler only. | ||
| * Do NOT use in runtime code paths unless behind `__DEV__` flag. | ||
| */ | ||
| export declare const isInlineTag: (key: string) => boolean; | ||
| /** | ||
| * Compiler only. | ||
| * Do NOT use in runtime code paths unless behind `__DEV__` flag. | ||
| */ | ||
| * Compiler only. | ||
| * Do NOT use in runtime code paths unless behind `__DEV__` flag. | ||
| */ | ||
| export declare const isBlockTag: (key: string) => boolean; | ||
| //#endregion | ||
| //#region temp/packages/shared/src/domAttrConfig.d.ts | ||
| export declare const isSpecialBooleanAttr: (key: string) => boolean; | ||
| /** | ||
| * The full list is needed during SSR to produce the correct initial markup. | ||
| */ | ||
| * The full list is needed during SSR to produce the correct initial markup. | ||
| */ | ||
| export declare const isBooleanAttr: (key: string) => boolean; | ||
| /** | ||
| * Boolean attributes should be included if the value is truthy or ''. | ||
| * e.g. `<select multiple>` compiles to `{ multiple: '' }` | ||
| */ | ||
| * Boolean attributes should be included if the value is truthy or ''. | ||
| * e.g. `<select multiple>` compiles to `{ multiple: '' }` | ||
| */ | ||
| export declare function includeBooleanAttr(value: unknown): boolean; | ||
@@ -316,29 +326,31 @@ export declare function isSSRSafeAttrName(name: string): boolean; | ||
| /** | ||
| * Known attributes, this is used for stringification of runtime static nodes | ||
| * so that we don't stringify bindings that cannot be set from HTML. | ||
| * Don't also forget to allow `data-*` and `aria-*`! | ||
| * Generated from https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes | ||
| */ | ||
| * Known attributes, this is used for stringification of runtime static nodes | ||
| * so that we don't stringify bindings that cannot be set from HTML. | ||
| * Don't also forget to allow `data-*` and `aria-*`! | ||
| * Generated from https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes | ||
| */ | ||
| export declare const isKnownHtmlAttr: (key: string) => boolean; | ||
| /** | ||
| * Generated from https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute | ||
| */ | ||
| * Generated from https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute | ||
| */ | ||
| export declare const isKnownSvgAttr: (key: string) => boolean; | ||
| /** | ||
| * Generated from https://developer.mozilla.org/en-US/docs/Web/MathML/Attribute | ||
| */ | ||
| * Generated from https://developer.mozilla.org/en-US/docs/Web/MathML/Attribute | ||
| */ | ||
| export declare const isKnownMathMLAttr: (key: string) => boolean; | ||
| /** | ||
| * Shared between server-renderer and runtime-core hydration logic | ||
| */ | ||
| * Shared between server-renderer and runtime-core hydration logic | ||
| */ | ||
| export declare function isRenderableAttrValue(value: unknown): boolean; | ||
| export declare function shouldSetAsAttr(tagName: string, key: string): boolean; | ||
| //#endregion | ||
| //#region temp/packages/shared/src/domNamespace.d.ts | ||
| export type Namespace = number; | ||
| export declare enum Namespaces { | ||
| HTML = 0, | ||
| SVG = 1, | ||
| MATH_ML = 2 | ||
| HTML = 0, | ||
| SVG = 1, | ||
| MATH_ML = 2 | ||
| } | ||
| //#endregion | ||
| //#region temp/packages/shared/src/escapeHtml.d.ts | ||
| export declare function escapeHtml(string: unknown): string; | ||
@@ -348,38 +360,38 @@ export declare function escapeHtmlComment(src: string): string; | ||
| export declare function getEscapedCssVarName(key: string, doubleEscape: boolean): string; | ||
| //#endregion | ||
| //#region temp/packages/shared/src/looseEqual.d.ts | ||
| export declare function looseEqual(a: any, b: any): boolean; | ||
| export declare function looseIndexOf(arr: any[], val: any): number; | ||
| //#endregion | ||
| //#region temp/packages/shared/src/toDisplayString.d.ts | ||
| /** | ||
| * For converting {{ interpolation }} values to displayed strings. | ||
| * @private | ||
| */ | ||
| * For converting {{ interpolation }} values to displayed strings. | ||
| * @private | ||
| */ | ||
| export declare const toDisplayString: (val: unknown) => string; | ||
| export type Prettify<T> = { | ||
| [K in keyof T]: T[K]; | ||
| } & {}; | ||
| export type UnionToIntersection<U> = (U extends any ? (k: U) => void : never) extends (k: infer I) => void ? I : never; | ||
| export type LooseRequired<T> = { | ||
| [P in keyof (T & Required<T>)]: T[P]; | ||
| }; | ||
| //#endregion | ||
| //#region temp/packages/shared/src/typeUtils.d.ts | ||
| export type Prettify<T> = { [K in keyof T]: T[K] } & {}; | ||
| export type UnionToIntersection<U> = (U extends any ? (k: U) => void : never) extends ((k: infer I) => void) ? I : never; | ||
| export type LooseRequired<T> = { [P in keyof (T & Required<T>)]: T[P] }; | ||
| export type IfAny<T, Y, N> = 0 extends 1 & T ? Y : N; | ||
| export type IsKeyValues<T, K = string> = IfAny<T, false, T extends object ? (keyof T extends K ? true : false) : false>; | ||
| /** | ||
| * Utility for extracting the parameters from a function overload (for typed emits) | ||
| * https://github.com/microsoft/TypeScript/issues/32164#issuecomment-1146737709 | ||
| */ | ||
| * Utility for extracting the parameters from a function overload (for typed emits) | ||
| * https://github.com/microsoft/TypeScript/issues/32164#issuecomment-1146737709 | ||
| */ | ||
| export type OverloadParameters<T extends (...args: any[]) => any> = Parameters<OverloadUnion<T>>; | ||
| type OverloadProps<TOverload> = Pick<TOverload, keyof TOverload>; | ||
| type OverloadUnionRecursive<TOverload, TPartialOverload = unknown> = TOverload extends (...args: infer TArgs) => infer TReturn ? TPartialOverload extends TOverload ? never : OverloadUnionRecursive<TPartialOverload & TOverload, TPartialOverload & ((...args: TArgs) => TReturn) & OverloadProps<TOverload>> | ((...args: TArgs) => TReturn) : never; | ||
| type OverloadUnion<TOverload extends (...args: any[]) => any> = Exclude<OverloadUnionRecursive<(() => never) & TOverload>, TOverload extends () => never ? never : () => never>; | ||
| type OverloadUnionRecursive<TOverload, TPartialOverload = unknown> = TOverload extends ((...args: infer TArgs) => infer TReturn) ? TPartialOverload extends TOverload ? never : OverloadUnionRecursive<TPartialOverload & TOverload, TPartialOverload & ((...args: TArgs) => TReturn) & OverloadProps<TOverload>> | ((...args: TArgs) => TReturn) : never; | ||
| type OverloadUnion<TOverload extends (...args: any[]) => any> = Exclude<OverloadUnionRecursive<(() => never) & TOverload>, TOverload extends (() => never) ? never : () => never>; | ||
| //#endregion | ||
| //#region temp/packages/shared/src/subSequence.d.ts | ||
| export declare function getSequence(arr: number[]): number[]; | ||
| //#endregion | ||
| //#region temp/packages/shared/src/cssVars.d.ts | ||
| /** | ||
| * Normalize CSS var value created by `v-bind` in `<style>` block | ||
| * See https://github.com/vuejs/core/pull/12461#issuecomment-2495804664 | ||
| */ | ||
| * Normalize CSS var value created by `v-bind` in `<style>` block | ||
| * See https://github.com/vuejs/core/pull/12461#issuecomment-2495804664 | ||
| */ | ||
| export declare function normalizeCssVarValue(value: unknown): string; | ||
| //#endregion |
+510
-475
| /** | ||
| * @vue/shared v3.6.0-beta.4 | ||
| * (c) 2018-present Yuxi (Evan) You and Vue contributors | ||
| * @license MIT | ||
| **/ | ||
| // @__NO_SIDE_EFFECTS__ | ||
| * @vue/shared v3.6.0-beta.5 | ||
| * (c) 2018-present Yuxi (Evan) You and Vue contributors | ||
| * @license MIT | ||
| **/ | ||
| //#region packages/shared/src/makeMap.ts | ||
| /** | ||
| * Make a map and return a function for checking if a key | ||
| * is in that map. | ||
| * IMPORTANT: all calls of this function must be prefixed with | ||
| * \/\*#\_\_PURE\_\_\*\/ | ||
| * So that they can be tree-shaken if necessary. | ||
| */ | ||
| /* @__NO_SIDE_EFFECTS__ */ | ||
| function makeMap(str) { | ||
| const map = /* @__PURE__ */ Object.create(null); | ||
| for (const key of str.split(",")) map[key] = 1; | ||
| return (val) => val in map; | ||
| const map = Object.create(null); | ||
| for (const key of str.split(",")) map[key] = 1; | ||
| return (val) => val in map; | ||
| } | ||
| //#endregion | ||
| //#region packages/shared/src/general.ts | ||
| const EMPTY_OBJ = !!(process.env.NODE_ENV !== "production") ? Object.freeze({}) : {}; | ||
| const EMPTY_ARR = !!(process.env.NODE_ENV !== "production") ? Object.freeze([]) : []; | ||
| const NOOP = () => { | ||
| }; | ||
| const NOOP = () => {}; | ||
| /** | ||
| * Always return true. | ||
| */ | ||
| const YES = () => true; | ||
| /** | ||
| * Always return false. | ||
| */ | ||
| const NO = () => false; | ||
| const isOn = (key) => key.charCodeAt(0) === 111 && key.charCodeAt(1) === 110 && // uppercase letter | ||
| (key.charCodeAt(2) > 122 || key.charCodeAt(2) < 97); | ||
| const isNativeOn = (key) => key.charCodeAt(0) === 111 && key.charCodeAt(1) === 110 && // lowercase letter | ||
| key.charCodeAt(2) > 96 && key.charCodeAt(2) < 123; | ||
| const isOn = (key) => key.charCodeAt(0) === 111 && key.charCodeAt(1) === 110 && (key.charCodeAt(2) > 122 || key.charCodeAt(2) < 97); | ||
| const isNativeOn = (key) => key.charCodeAt(0) === 111 && key.charCodeAt(1) === 110 && key.charCodeAt(2) > 96 && key.charCodeAt(2) < 123; | ||
| const isModelListener = (key) => key.startsWith("onUpdate:"); | ||
| const extend = Object.assign; | ||
| const remove = (arr, el) => { | ||
| const i = arr.indexOf(el); | ||
| if (i > -1) { | ||
| arr.splice(i, 1); | ||
| } | ||
| const i = arr.indexOf(el); | ||
| if (i > -1) arr.splice(i, 1); | ||
| }; | ||
@@ -43,3 +54,3 @@ const hasOwnProperty = Object.prototype.hasOwnProperty; | ||
| const isPromise = (val) => { | ||
| return (isObject(val) || isFunction(val)) && isFunction(val.then) && isFunction(val.catch); | ||
| return (isObject(val) || isFunction(val)) && isFunction(val.then) && isFunction(val.catch); | ||
| }; | ||
@@ -49,231 +60,264 @@ const objectToString = Object.prototype.toString; | ||
| const toRawType = (value) => { | ||
| return toTypeString(value).slice(8, -1); | ||
| return toTypeString(value).slice(8, -1); | ||
| }; | ||
| const isPlainObject = (val) => toTypeString(val) === "[object Object]"; | ||
| const isIntegerKey = (key) => isString(key) && key !== "NaN" && key[0] !== "-" && "" + parseInt(key, 10) === key; | ||
| const isReservedProp = /* @__PURE__ */ makeMap( | ||
| // the leading comma is intentional so empty string "" is also included | ||
| ",key,ref,ref_for,ref_key,onVnodeBeforeMount,onVnodeMounted,onVnodeBeforeUpdate,onVnodeUpdated,onVnodeBeforeUnmount,onVnodeUnmounted" | ||
| ); | ||
| const isReservedProp = /* @__PURE__ */ makeMap(",key,ref,ref_for,ref_key,onVnodeBeforeMount,onVnodeMounted,onVnodeBeforeUpdate,onVnodeUpdated,onVnodeBeforeUnmount,onVnodeUnmounted"); | ||
| const isBuiltInTag = /* @__PURE__ */ makeMap("slot,component"); | ||
| const isBuiltInDirective = /* @__PURE__ */ makeMap( | ||
| "bind,cloak,else-if,else,for,html,if,model,on,once,pre,show,slot,text,memo" | ||
| ); | ||
| const isBuiltInDirective = /* @__PURE__ */ makeMap("bind,cloak,else-if,else,for,html,if,model,on,once,pre,show,slot,text,memo"); | ||
| const cacheStringFunction = (fn) => { | ||
| const cache = /* @__PURE__ */ Object.create(null); | ||
| return ((str) => { | ||
| const hit = cache[str]; | ||
| return hit || (cache[str] = fn(str)); | ||
| }); | ||
| const cache = Object.create(null); | ||
| return ((str) => { | ||
| return cache[str] || (cache[str] = fn(str)); | ||
| }); | ||
| }; | ||
| const camelizeRE = /-(\w)/g; | ||
| const camelizeReplacer = (_, c) => c ? c.toUpperCase() : ""; | ||
| const camelize = cacheStringFunction( | ||
| (str) => str.replace(camelizeRE, camelizeReplacer) | ||
| ); | ||
| /** | ||
| * @private | ||
| */ | ||
| const camelize = cacheStringFunction((str) => str.replace(camelizeRE, camelizeReplacer)); | ||
| const hyphenateRE = /\B([A-Z])/g; | ||
| const hyphenate = cacheStringFunction( | ||
| (str) => str.replace(hyphenateRE, "-$1").toLowerCase() | ||
| ); | ||
| /** | ||
| * @private | ||
| */ | ||
| const hyphenate = cacheStringFunction((str) => str.replace(hyphenateRE, "-$1").toLowerCase()); | ||
| /** | ||
| * @private | ||
| */ | ||
| const capitalize = cacheStringFunction((str) => { | ||
| return str.charAt(0).toUpperCase() + str.slice(1); | ||
| return str.charAt(0).toUpperCase() + str.slice(1); | ||
| }); | ||
| const toHandlerKey = cacheStringFunction( | ||
| (str) => { | ||
| const s = str ? `on${capitalize(str)}` : ``; | ||
| return s; | ||
| } | ||
| ); | ||
| /** | ||
| * @private | ||
| */ | ||
| const toHandlerKey = cacheStringFunction((str) => { | ||
| return str ? `on${capitalize(str)}` : ``; | ||
| }); | ||
| /** | ||
| * #13070 When v-model and v-model:model directives are used together, | ||
| * they will generate the same modelModifiers prop, | ||
| * so a `$` suffix is added to avoid conflicts. | ||
| * @private | ||
| */ | ||
| const getModifierPropName = (name) => { | ||
| return `${name === "modelValue" || name === "model-value" ? "model" : name}Modifiers${name === "model" ? "$" : ""}`; | ||
| return `${name === "modelValue" || name === "model-value" ? "model" : name}Modifiers${name === "model" ? "$" : ""}`; | ||
| }; | ||
| const hasChanged = (value, oldValue) => !Object.is(value, oldValue); | ||
| const invokeArrayFns = (fns, ...arg) => { | ||
| for (let i = 0; i < fns.length; i++) { | ||
| fns[i](...arg); | ||
| } | ||
| for (let i = 0; i < fns.length; i++) fns[i](...arg); | ||
| }; | ||
| const def = (obj, key, value, writable = false) => { | ||
| Object.defineProperty(obj, key, { | ||
| configurable: true, | ||
| enumerable: false, | ||
| writable, | ||
| value | ||
| }); | ||
| Object.defineProperty(obj, key, { | ||
| configurable: true, | ||
| enumerable: false, | ||
| writable, | ||
| value | ||
| }); | ||
| }; | ||
| /** | ||
| * "123-foo" will be parsed to 123 | ||
| * This is used for the .number modifier in v-model | ||
| */ | ||
| const looseToNumber = (val) => { | ||
| const n = parseFloat(val); | ||
| return isNaN(n) ? val : n; | ||
| const n = parseFloat(val); | ||
| return isNaN(n) ? val : n; | ||
| }; | ||
| /** | ||
| * Only concerns number-like strings | ||
| * "123-foo" will be returned as-is | ||
| */ | ||
| const toNumber = (val) => { | ||
| const n = isString(val) ? Number(val) : NaN; | ||
| return isNaN(n) ? val : n; | ||
| const n = isString(val) ? Number(val) : NaN; | ||
| return isNaN(n) ? val : n; | ||
| }; | ||
| let _globalThis; | ||
| const getGlobalThis = () => { | ||
| return _globalThis || (_globalThis = typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : {}); | ||
| return _globalThis || (_globalThis = typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : {}); | ||
| }; | ||
| const identRE = /^[_$a-zA-Z\xA0-\uFFFF][_$a-zA-Z0-9\xA0-\uFFFF]*$/; | ||
| function genPropsAccessExp(name) { | ||
| return identRE.test(name) ? `__props.${name}` : `__props[${JSON.stringify(name)}]`; | ||
| return identRE.test(name) ? `__props.${name}` : `__props[${JSON.stringify(name)}]`; | ||
| } | ||
| function genCacheKey(source, options) { | ||
| return source + JSON.stringify( | ||
| options, | ||
| (_, val) => typeof val === "function" ? val.toString() : val | ||
| ); | ||
| return source + JSON.stringify(options, (_, val) => typeof val === "function" ? val.toString() : val); | ||
| } | ||
| function canSetValueDirectly(tagName) { | ||
| return tagName !== "PROGRESS" && // custom elements may use _value internally | ||
| !tagName.includes("-"); | ||
| return tagName !== "PROGRESS" && !tagName.includes("-"); | ||
| } | ||
| //#endregion | ||
| //#region packages/shared/src/patchFlags.ts | ||
| /** | ||
| * Patch flags are optimization hints generated by the compiler. | ||
| * when a block with dynamicChildren is encountered during diff, the algorithm | ||
| * enters "optimized mode". In this mode, we know that the vdom is produced by | ||
| * a render function generated by the compiler, so the algorithm only needs to | ||
| * handle updates explicitly marked by these patch flags. | ||
| * | ||
| * Patch flags can be combined using the | bitwise operator and can be checked | ||
| * using the & operator, e.g. | ||
| * | ||
| * ```js | ||
| * const flag = TEXT | CLASS | ||
| * if (flag & TEXT) { ... } | ||
| * ``` | ||
| * | ||
| * Check the `patchElement` function in '../../runtime-core/src/renderer.ts' to see how the | ||
| * flags are handled during diff. | ||
| */ | ||
| const PatchFlags = { | ||
| "TEXT": 1, | ||
| "1": "TEXT", | ||
| "CLASS": 2, | ||
| "2": "CLASS", | ||
| "STYLE": 4, | ||
| "4": "STYLE", | ||
| "PROPS": 8, | ||
| "8": "PROPS", | ||
| "FULL_PROPS": 16, | ||
| "16": "FULL_PROPS", | ||
| "NEED_HYDRATION": 32, | ||
| "32": "NEED_HYDRATION", | ||
| "STABLE_FRAGMENT": 64, | ||
| "64": "STABLE_FRAGMENT", | ||
| "KEYED_FRAGMENT": 128, | ||
| "128": "KEYED_FRAGMENT", | ||
| "UNKEYED_FRAGMENT": 256, | ||
| "256": "UNKEYED_FRAGMENT", | ||
| "NEED_PATCH": 512, | ||
| "512": "NEED_PATCH", | ||
| "DYNAMIC_SLOTS": 1024, | ||
| "1024": "DYNAMIC_SLOTS", | ||
| "DEV_ROOT_FRAGMENT": 2048, | ||
| "2048": "DEV_ROOT_FRAGMENT", | ||
| "CACHED": -1, | ||
| "-1": "CACHED", | ||
| "BAIL": -2, | ||
| "-2": "BAIL" | ||
| "TEXT": 1, | ||
| "1": "TEXT", | ||
| "CLASS": 2, | ||
| "2": "CLASS", | ||
| "STYLE": 4, | ||
| "4": "STYLE", | ||
| "PROPS": 8, | ||
| "8": "PROPS", | ||
| "FULL_PROPS": 16, | ||
| "16": "FULL_PROPS", | ||
| "NEED_HYDRATION": 32, | ||
| "32": "NEED_HYDRATION", | ||
| "STABLE_FRAGMENT": 64, | ||
| "64": "STABLE_FRAGMENT", | ||
| "KEYED_FRAGMENT": 128, | ||
| "128": "KEYED_FRAGMENT", | ||
| "UNKEYED_FRAGMENT": 256, | ||
| "256": "UNKEYED_FRAGMENT", | ||
| "NEED_PATCH": 512, | ||
| "512": "NEED_PATCH", | ||
| "DYNAMIC_SLOTS": 1024, | ||
| "1024": "DYNAMIC_SLOTS", | ||
| "DEV_ROOT_FRAGMENT": 2048, | ||
| "2048": "DEV_ROOT_FRAGMENT", | ||
| "CACHED": -1, | ||
| "-1": "CACHED", | ||
| "BAIL": -2, | ||
| "-2": "BAIL" | ||
| }; | ||
| /** | ||
| * dev only flag -> name mapping | ||
| */ | ||
| const PatchFlagNames = { | ||
| [1]: `TEXT`, | ||
| [2]: `CLASS`, | ||
| [4]: `STYLE`, | ||
| [8]: `PROPS`, | ||
| [16]: `FULL_PROPS`, | ||
| [32]: `NEED_HYDRATION`, | ||
| [64]: `STABLE_FRAGMENT`, | ||
| [128]: `KEYED_FRAGMENT`, | ||
| [256]: `UNKEYED_FRAGMENT`, | ||
| [512]: `NEED_PATCH`, | ||
| [1024]: `DYNAMIC_SLOTS`, | ||
| [2048]: `DEV_ROOT_FRAGMENT`, | ||
| [-1]: `CACHED`, | ||
| [-2]: `BAIL` | ||
| [1]: `TEXT`, | ||
| [2]: `CLASS`, | ||
| [4]: `STYLE`, | ||
| [8]: `PROPS`, | ||
| [16]: `FULL_PROPS`, | ||
| [32]: `NEED_HYDRATION`, | ||
| [64]: `STABLE_FRAGMENT`, | ||
| [128]: `KEYED_FRAGMENT`, | ||
| [256]: `UNKEYED_FRAGMENT`, | ||
| [512]: `NEED_PATCH`, | ||
| [1024]: `DYNAMIC_SLOTS`, | ||
| [2048]: `DEV_ROOT_FRAGMENT`, | ||
| [-1]: `CACHED`, | ||
| [-2]: `BAIL` | ||
| }; | ||
| //#endregion | ||
| //#region packages/shared/src/shapeFlags.ts | ||
| const ShapeFlags = { | ||
| "ELEMENT": 1, | ||
| "1": "ELEMENT", | ||
| "FUNCTIONAL_COMPONENT": 2, | ||
| "2": "FUNCTIONAL_COMPONENT", | ||
| "STATEFUL_COMPONENT": 4, | ||
| "4": "STATEFUL_COMPONENT", | ||
| "TEXT_CHILDREN": 8, | ||
| "8": "TEXT_CHILDREN", | ||
| "ARRAY_CHILDREN": 16, | ||
| "16": "ARRAY_CHILDREN", | ||
| "SLOTS_CHILDREN": 32, | ||
| "32": "SLOTS_CHILDREN", | ||
| "TELEPORT": 64, | ||
| "64": "TELEPORT", | ||
| "SUSPENSE": 128, | ||
| "128": "SUSPENSE", | ||
| "COMPONENT_SHOULD_KEEP_ALIVE": 256, | ||
| "256": "COMPONENT_SHOULD_KEEP_ALIVE", | ||
| "COMPONENT_KEPT_ALIVE": 512, | ||
| "512": "COMPONENT_KEPT_ALIVE", | ||
| "COMPONENT": 6, | ||
| "6": "COMPONENT" | ||
| "ELEMENT": 1, | ||
| "1": "ELEMENT", | ||
| "FUNCTIONAL_COMPONENT": 2, | ||
| "2": "FUNCTIONAL_COMPONENT", | ||
| "STATEFUL_COMPONENT": 4, | ||
| "4": "STATEFUL_COMPONENT", | ||
| "TEXT_CHILDREN": 8, | ||
| "8": "TEXT_CHILDREN", | ||
| "ARRAY_CHILDREN": 16, | ||
| "16": "ARRAY_CHILDREN", | ||
| "SLOTS_CHILDREN": 32, | ||
| "32": "SLOTS_CHILDREN", | ||
| "TELEPORT": 64, | ||
| "64": "TELEPORT", | ||
| "SUSPENSE": 128, | ||
| "128": "SUSPENSE", | ||
| "COMPONENT_SHOULD_KEEP_ALIVE": 256, | ||
| "256": "COMPONENT_SHOULD_KEEP_ALIVE", | ||
| "COMPONENT_KEPT_ALIVE": 512, | ||
| "512": "COMPONENT_KEPT_ALIVE", | ||
| "COMPONENT": 6, | ||
| "6": "COMPONENT" | ||
| }; | ||
| //#endregion | ||
| //#region packages/shared/src/slotFlags.ts | ||
| const SlotFlags = { | ||
| "STABLE": 1, | ||
| "1": "STABLE", | ||
| "DYNAMIC": 2, | ||
| "2": "DYNAMIC", | ||
| "FORWARDED": 3, | ||
| "3": "FORWARDED" | ||
| "STABLE": 1, | ||
| "1": "STABLE", | ||
| "DYNAMIC": 2, | ||
| "2": "DYNAMIC", | ||
| "FORWARDED": 3, | ||
| "3": "FORWARDED" | ||
| }; | ||
| /** | ||
| * Dev only | ||
| */ | ||
| const slotFlagsText = { | ||
| [1]: "STABLE", | ||
| [2]: "DYNAMIC", | ||
| [3]: "FORWARDED" | ||
| [1]: "STABLE", | ||
| [2]: "DYNAMIC", | ||
| [3]: "FORWARDED" | ||
| }; | ||
| //#endregion | ||
| //#region packages/shared/src/globalsAllowList.ts | ||
| const GLOBALS_ALLOWED = "Infinity,undefined,NaN,isFinite,isNaN,parseFloat,parseInt,decodeURI,decodeURIComponent,encodeURI,encodeURIComponent,Math,Number,Date,Array,Object,Boolean,String,RegExp,Map,Set,JSON,Intl,BigInt,console,Error,Symbol"; | ||
| const isGloballyAllowed = /* @__PURE__ */ makeMap(GLOBALS_ALLOWED); | ||
| /** @deprecated use `isGloballyAllowed` instead */ | ||
| const isGloballyWhitelisted = isGloballyAllowed; | ||
| //#endregion | ||
| //#region packages/shared/src/codeframe.ts | ||
| const range = 2; | ||
| function generateCodeFrame(source, start = 0, end = source.length) { | ||
| start = Math.max(0, Math.min(start, source.length)); | ||
| end = Math.max(0, Math.min(end, source.length)); | ||
| if (start > end) return ""; | ||
| let lines = source.split(/(\r?\n)/); | ||
| const newlineSequences = lines.filter((_, idx) => idx % 2 === 1); | ||
| lines = lines.filter((_, idx) => idx % 2 === 0); | ||
| let count = 0; | ||
| const res = []; | ||
| for (let i = 0; i < lines.length; i++) { | ||
| count += lines[i].length + (newlineSequences[i] && newlineSequences[i].length || 0); | ||
| if (count >= start) { | ||
| for (let j = i - range; j <= i + range || end > count; j++) { | ||
| if (j < 0 || j >= lines.length) continue; | ||
| const line = j + 1; | ||
| res.push( | ||
| `${line}${" ".repeat(Math.max(3 - String(line).length, 0))}| ${lines[j]}` | ||
| ); | ||
| const lineLength = lines[j].length; | ||
| const newLineSeqLength = newlineSequences[j] && newlineSequences[j].length || 0; | ||
| if (j === i) { | ||
| const pad = start - (count - (lineLength + newLineSeqLength)); | ||
| const length = Math.max( | ||
| 1, | ||
| end > count ? lineLength - pad : end - start | ||
| ); | ||
| res.push(` | ` + " ".repeat(pad) + "^".repeat(length)); | ||
| } else if (j > i) { | ||
| if (end > count) { | ||
| const length = Math.max(Math.min(end - count, lineLength), 1); | ||
| res.push(` | ` + "^".repeat(length)); | ||
| } | ||
| count += lineLength + newLineSeqLength; | ||
| } | ||
| } | ||
| break; | ||
| } | ||
| } | ||
| return res.join("\n"); | ||
| start = Math.max(0, Math.min(start, source.length)); | ||
| end = Math.max(0, Math.min(end, source.length)); | ||
| if (start > end) return ""; | ||
| let lines = source.split(/(\r?\n)/); | ||
| const newlineSequences = lines.filter((_, idx) => idx % 2 === 1); | ||
| lines = lines.filter((_, idx) => idx % 2 === 0); | ||
| let count = 0; | ||
| const res = []; | ||
| for (let i = 0; i < lines.length; i++) { | ||
| count += lines[i].length + (newlineSequences[i] && newlineSequences[i].length || 0); | ||
| if (count >= start) { | ||
| for (let j = i - range; j <= i + range || end > count; j++) { | ||
| if (j < 0 || j >= lines.length) continue; | ||
| const line = j + 1; | ||
| res.push(`${line}${" ".repeat(Math.max(3 - String(line).length, 0))}| ${lines[j]}`); | ||
| const lineLength = lines[j].length; | ||
| const newLineSeqLength = newlineSequences[j] && newlineSequences[j].length || 0; | ||
| if (j === i) { | ||
| const pad = start - (count - (lineLength + newLineSeqLength)); | ||
| const length = Math.max(1, end > count ? lineLength - pad : end - start); | ||
| res.push(` | ` + " ".repeat(pad) + "^".repeat(length)); | ||
| } else if (j > i) { | ||
| if (end > count) { | ||
| const length = Math.max(Math.min(end - count, lineLength), 1); | ||
| res.push(` | ` + "^".repeat(length)); | ||
| } | ||
| count += lineLength + newLineSeqLength; | ||
| } | ||
| } | ||
| break; | ||
| } | ||
| } | ||
| return res.join("\n"); | ||
| } | ||
| //#endregion | ||
| //#region packages/shared/src/normalizeProp.ts | ||
| function normalizeStyle(value) { | ||
| if (isArray(value)) { | ||
| const res = {}; | ||
| for (let i = 0; i < value.length; i++) { | ||
| const item = value[i]; | ||
| const normalized = isString(item) ? parseStringStyle(item) : normalizeStyle(item); | ||
| if (normalized) { | ||
| for (const key in normalized) { | ||
| res[key] = normalized[key]; | ||
| } | ||
| } | ||
| } | ||
| return res; | ||
| } else if (isString(value) || isObject(value)) { | ||
| return value; | ||
| } | ||
| if (isArray(value)) { | ||
| const res = {}; | ||
| for (let i = 0; i < value.length; i++) { | ||
| const item = value[i]; | ||
| const normalized = isString(item) ? parseStringStyle(item) : normalizeStyle(item); | ||
| if (normalized) for (const key in normalized) res[key] = normalized[key]; | ||
| } | ||
| return res; | ||
| } else if (isString(value) || isObject(value)) return value; | ||
| } | ||
@@ -284,56 +328,46 @@ const listDelimiterRE = /;(?![^(]*\))/g; | ||
| function parseStringStyle(cssText) { | ||
| const ret = {}; | ||
| cssText.replace(styleCommentRE, "").split(listDelimiterRE).forEach((item) => { | ||
| if (item) { | ||
| const tmp = item.split(propertyDelimiterRE); | ||
| tmp.length > 1 && (ret[tmp[0].trim()] = tmp[1].trim()); | ||
| } | ||
| }); | ||
| return ret; | ||
| const ret = {}; | ||
| cssText.replace(styleCommentRE, "").split(listDelimiterRE).forEach((item) => { | ||
| if (item) { | ||
| const tmp = item.split(propertyDelimiterRE); | ||
| tmp.length > 1 && (ret[tmp[0].trim()] = tmp[1].trim()); | ||
| } | ||
| }); | ||
| return ret; | ||
| } | ||
| function stringifyStyle(styles) { | ||
| if (!styles) return ""; | ||
| if (isString(styles)) return styles; | ||
| let ret = ""; | ||
| for (const key in styles) { | ||
| const value = styles[key]; | ||
| if (isString(value) || typeof value === "number") { | ||
| const normalizedKey = key.startsWith(`--`) ? key : hyphenate(key); | ||
| ret += `${normalizedKey}:${value};`; | ||
| } | ||
| } | ||
| return ret; | ||
| if (!styles) return ""; | ||
| if (isString(styles)) return styles; | ||
| let ret = ""; | ||
| for (const key in styles) { | ||
| const value = styles[key]; | ||
| if (isString(value) || typeof value === "number") { | ||
| const normalizedKey = key.startsWith(`--`) ? key : hyphenate(key); | ||
| ret += `${normalizedKey}:${value};`; | ||
| } | ||
| } | ||
| return ret; | ||
| } | ||
| function normalizeClass(value) { | ||
| let res = ""; | ||
| if (isString(value)) { | ||
| res = value; | ||
| } else if (isArray(value)) { | ||
| for (let i = 0; i < value.length; i++) { | ||
| const normalized = normalizeClass(value[i]); | ||
| if (normalized) { | ||
| res += normalized + " "; | ||
| } | ||
| } | ||
| } else if (isObject(value)) { | ||
| for (const name in value) { | ||
| if (value[name]) { | ||
| res += name + " "; | ||
| } | ||
| } | ||
| } | ||
| return res.trim(); | ||
| let res = ""; | ||
| if (isString(value)) res = value; | ||
| else if (isArray(value)) for (let i = 0; i < value.length; i++) { | ||
| const normalized = normalizeClass(value[i]); | ||
| if (normalized) res += normalized + " "; | ||
| } | ||
| else if (isObject(value)) { | ||
| for (const name in value) if (value[name]) res += name + " "; | ||
| } | ||
| return res.trim(); | ||
| } | ||
| function normalizeProps(props) { | ||
| if (!props) return null; | ||
| let { class: klass, style } = props; | ||
| if (klass && !isString(klass)) { | ||
| props.class = normalizeClass(klass); | ||
| } | ||
| if (style) { | ||
| props.style = normalizeStyle(style); | ||
| } | ||
| return props; | ||
| if (!props) return null; | ||
| let { class: klass, style } = props; | ||
| if (klass && !isString(klass)) props.class = normalizeClass(klass); | ||
| if (style) props.style = normalizeStyle(style); | ||
| return props; | ||
| } | ||
| //#endregion | ||
| //#region packages/shared/src/domTagConfig.ts | ||
| const HTML_TAGS = "html,body,base,head,link,meta,style,title,address,article,aside,footer,header,hgroup,h1,h2,h3,h4,h5,h6,nav,section,div,dd,dl,dt,figcaption,figure,picture,hr,img,li,main,ol,p,pre,ul,a,b,abbr,bdi,bdo,br,cite,code,data,dfn,em,i,kbd,mark,q,rp,rt,ruby,s,samp,small,span,strong,sub,sup,time,u,var,wbr,area,audio,map,track,video,embed,object,param,source,canvas,script,noscript,del,ins,caption,col,colgroup,table,thead,tbody,td,th,tr,button,datalist,fieldset,form,input,label,legend,meter,optgroup,option,output,progress,select,textarea,details,dialog,menu,summary,template,blockquote,iframe,tfoot"; | ||
@@ -347,18 +381,68 @@ const SVG_TAGS = "svg,animate,animateMotion,animateTransform,circle,clipPath,color-profile,defs,desc,discard,ellipse,feBlend,feColorMatrix,feComponentTransfer,feComposite,feConvolveMatrix,feDiffuseLighting,feDisplacementMap,feDistantLight,feDropShadow,feFlood,feFuncA,feFuncB,feFuncG,feFuncR,feGaussianBlur,feImage,feMerge,feMergeNode,feMorphology,feOffset,fePointLight,feSpecularLighting,feSpotLight,feTile,feTurbulence,filter,foreignObject,g,hatch,hatchpath,image,line,linearGradient,marker,mask,mesh,meshgradient,meshpatch,meshrow,metadata,mpath,path,pattern,polygon,polyline,radialGradient,rect,set,solidcolor,stop,switch,symbol,text,textPath,title,tspan,unknown,use,view"; | ||
| const BLOCK_TAGS = "address,article,aside,blockquote,dd,details,dialog,div,dl,dt,fieldset,figcaption,figure,footer,form,h1,h2,h3,h4,h5,h6,header,hgroup,hr,li,main,menu,nav,ol,p,pre,section,table,ul"; | ||
| /** | ||
| * Compiler only. | ||
| * Do NOT use in runtime code paths unless behind `!!(process.env.NODE_ENV !== 'production')` flag. | ||
| */ | ||
| const isHTMLTag = /* @__PURE__ */ makeMap(HTML_TAGS); | ||
| /** | ||
| * Compiler only. | ||
| * Do NOT use in runtime code paths unless behind `!!(process.env.NODE_ENV !== 'production')` flag. | ||
| */ | ||
| const isSVGTag = /* @__PURE__ */ makeMap(SVG_TAGS); | ||
| /** | ||
| * Compiler only. | ||
| * Do NOT use in runtime code paths unless behind `!!(process.env.NODE_ENV !== 'production')` flag. | ||
| */ | ||
| const isMathMLTag = /* @__PURE__ */ makeMap(MATH_TAGS); | ||
| /** | ||
| * Compiler only. | ||
| * Do NOT use in runtime code paths unless behind `!!(process.env.NODE_ENV !== 'production')` flag. | ||
| */ | ||
| const isVoidTag = /* @__PURE__ */ makeMap(VOID_TAGS); | ||
| /** | ||
| * Compiler only. | ||
| * Do NOT use in runtime code paths unless behind `!!(process.env.NODE_ENV !== 'production')` flag. | ||
| */ | ||
| const isFormattingTag = /* @__PURE__ */ makeMap(FORMATTING_TAGS); | ||
| /** | ||
| * Compiler only. | ||
| * Do NOT use in runtime code paths unless behind `!!(process.env.NODE_ENV !== 'production')` flag. | ||
| */ | ||
| const isAlwaysCloseTag = /* @__PURE__ */ makeMap(ALWAYS_CLOSE_TAGS); | ||
| /** | ||
| * Compiler only. | ||
| * Do NOT use in runtime code paths unless behind `!!(process.env.NODE_ENV !== 'production')` flag. | ||
| */ | ||
| const isInlineTag = /* @__PURE__ */ makeMap(INLINE_TAGS); | ||
| /** | ||
| * Compiler only. | ||
| * Do NOT use in runtime code paths unless behind `!!(process.env.NODE_ENV !== 'production')` flag. | ||
| */ | ||
| const isBlockTag = /* @__PURE__ */ makeMap(BLOCK_TAGS); | ||
| //#endregion | ||
| //#region packages/shared/src/domAttrConfig.ts | ||
| /** | ||
| * On the client we only need to offer special cases for boolean attributes that | ||
| * have different names from their corresponding dom properties: | ||
| * - itemscope -> N/A | ||
| * - allowfullscreen -> allowFullscreen | ||
| * - formnovalidate -> formNoValidate | ||
| * - ismap -> isMap | ||
| * - nomodule -> noModule | ||
| * - novalidate -> noValidate | ||
| * - readonly -> readOnly | ||
| */ | ||
| const specialBooleanAttrs = `itemscope,allowfullscreen,formnovalidate,ismap,nomodule,novalidate,readonly`; | ||
| const isSpecialBooleanAttr = /* @__PURE__ */ makeMap(specialBooleanAttrs); | ||
| const isBooleanAttr = /* @__PURE__ */ makeMap( | ||
| specialBooleanAttrs + `,async,autofocus,autoplay,controls,default,defer,disabled,hidden,inert,loop,open,required,reversed,scoped,seamless,checked,muted,multiple,selected` | ||
| ); | ||
| /** | ||
| * The full list is needed during SSR to produce the correct initial markup. | ||
| */ | ||
| const isBooleanAttr = /* @__PURE__ */ makeMap(specialBooleanAttrs + ",async,autofocus,autoplay,controls,default,defer,disabled,hidden,inert,loop,open,required,reversed,scoped,seamless,checked,muted,multiple,selected"); | ||
| /** | ||
| * Boolean attributes should be included if the value is truthy or ''. | ||
| * e.g. `<select multiple>` compiles to `{ multiple: '' }` | ||
| */ | ||
| function includeBooleanAttr(value) { | ||
| return !!value || value === ""; | ||
| return !!value || value === ""; | ||
| } | ||
@@ -368,276 +452,227 @@ const unsafeAttrCharRE = /[>/="'\u0009\u000a\u000c\u0020]/; | ||
| function isSSRSafeAttrName(name) { | ||
| if (attrValidationCache.hasOwnProperty(name)) { | ||
| return attrValidationCache[name]; | ||
| } | ||
| const isUnsafe = unsafeAttrCharRE.test(name); | ||
| if (isUnsafe) { | ||
| console.error(`unsafe attribute name: ${name}`); | ||
| } | ||
| return attrValidationCache[name] = !isUnsafe; | ||
| if (attrValidationCache.hasOwnProperty(name)) return attrValidationCache[name]; | ||
| const isUnsafe = unsafeAttrCharRE.test(name); | ||
| if (isUnsafe) console.error(`unsafe attribute name: ${name}`); | ||
| return attrValidationCache[name] = !isUnsafe; | ||
| } | ||
| const propsToAttrMap = { | ||
| acceptCharset: "accept-charset", | ||
| className: "class", | ||
| htmlFor: "for", | ||
| httpEquiv: "http-equiv" | ||
| acceptCharset: "accept-charset", | ||
| className: "class", | ||
| htmlFor: "for", | ||
| httpEquiv: "http-equiv" | ||
| }; | ||
| const isKnownHtmlAttr = /* @__PURE__ */ makeMap( | ||
| `accept,accept-charset,accesskey,action,align,allow,alt,async,autocapitalize,autocomplete,autofocus,autoplay,background,bgcolor,border,buffered,capture,challenge,charset,checked,cite,class,code,codebase,color,cols,colspan,content,contenteditable,contextmenu,controls,coords,crossorigin,csp,data,datetime,decoding,default,defer,dir,dirname,disabled,download,draggable,dropzone,enctype,enterkeyhint,for,form,formaction,formenctype,formmethod,formnovalidate,formtarget,headers,height,hidden,high,href,hreflang,http-equiv,icon,id,importance,inert,integrity,ismap,itemprop,keytype,kind,label,lang,language,loading,list,loop,low,manifest,max,maxlength,minlength,media,min,multiple,muted,name,novalidate,open,optimum,pattern,ping,placeholder,poster,preload,radiogroup,readonly,referrerpolicy,rel,required,reversed,rows,rowspan,sandbox,scope,scoped,selected,shape,size,sizes,slot,span,spellcheck,src,srcdoc,srclang,srcset,start,step,style,summary,tabindex,target,title,translate,type,usemap,value,width,wrap` | ||
| ); | ||
| const isKnownSvgAttr = /* @__PURE__ */ makeMap( | ||
| `xmlns,accent-height,accumulate,additive,alignment-baseline,alphabetic,amplitude,arabic-form,ascent,attributeName,attributeType,azimuth,baseFrequency,baseline-shift,baseProfile,bbox,begin,bias,by,calcMode,cap-height,class,clip,clipPathUnits,clip-path,clip-rule,color,color-interpolation,color-interpolation-filters,color-profile,color-rendering,contentScriptType,contentStyleType,crossorigin,cursor,cx,cy,d,decelerate,descent,diffuseConstant,direction,display,divisor,dominant-baseline,dur,dx,dy,edgeMode,elevation,enable-background,end,exponent,fill,fill-opacity,fill-rule,filter,filterRes,filterUnits,flood-color,flood-opacity,font-family,font-size,font-size-adjust,font-stretch,font-style,font-variant,font-weight,format,from,fr,fx,fy,g1,g2,glyph-name,glyph-orientation-horizontal,glyph-orientation-vertical,glyphRef,gradientTransform,gradientUnits,hanging,height,href,hreflang,horiz-adv-x,horiz-origin-x,id,ideographic,image-rendering,in,in2,intercept,k,k1,k2,k3,k4,kernelMatrix,kernelUnitLength,kerning,keyPoints,keySplines,keyTimes,lang,lengthAdjust,letter-spacing,lighting-color,limitingConeAngle,local,marker-end,marker-mid,marker-start,markerHeight,markerUnits,markerWidth,mask,maskContentUnits,maskUnits,mathematical,max,media,method,min,mode,name,numOctaves,offset,opacity,operator,order,orient,orientation,origin,overflow,overline-position,overline-thickness,panose-1,paint-order,path,pathLength,patternContentUnits,patternTransform,patternUnits,ping,pointer-events,points,pointsAtX,pointsAtY,pointsAtZ,preserveAlpha,preserveAspectRatio,primitiveUnits,r,radius,referrerPolicy,refX,refY,rel,rendering-intent,repeatCount,repeatDur,requiredExtensions,requiredFeatures,restart,result,rotate,rx,ry,scale,seed,shape-rendering,slope,spacing,specularConstant,specularExponent,speed,spreadMethod,startOffset,stdDeviation,stemh,stemv,stitchTiles,stop-color,stop-opacity,strikethrough-position,strikethrough-thickness,string,stroke,stroke-dasharray,stroke-dashoffset,stroke-linecap,stroke-linejoin,stroke-miterlimit,stroke-opacity,stroke-width,style,surfaceScale,systemLanguage,tabindex,tableValues,target,targetX,targetY,text-anchor,text-decoration,text-rendering,textLength,to,transform,transform-origin,type,u1,u2,underline-position,underline-thickness,unicode,unicode-bidi,unicode-range,units-per-em,v-alphabetic,v-hanging,v-ideographic,v-mathematical,values,vector-effect,version,vert-adv-y,vert-origin-x,vert-origin-y,viewBox,viewTarget,visibility,width,widths,word-spacing,writing-mode,x,x-height,x1,x2,xChannelSelector,xlink:actuate,xlink:arcrole,xlink:href,xlink:role,xlink:show,xlink:title,xlink:type,xmlns:xlink,xml:base,xml:lang,xml:space,y,y1,y2,yChannelSelector,z,zoomAndPan` | ||
| ); | ||
| const isKnownMathMLAttr = /* @__PURE__ */ makeMap( | ||
| `accent,accentunder,actiontype,align,alignmentscope,altimg,altimg-height,altimg-valign,altimg-width,alttext,bevelled,close,columnsalign,columnlines,columnspan,denomalign,depth,dir,display,displaystyle,encoding,equalcolumns,equalrows,fence,fontstyle,fontweight,form,frame,framespacing,groupalign,height,href,id,indentalign,indentalignfirst,indentalignlast,indentshift,indentshiftfirst,indentshiftlast,indextype,justify,largetop,largeop,lquote,lspace,mathbackground,mathcolor,mathsize,mathvariant,maxsize,minlabelspacing,mode,other,overflow,position,rowalign,rowlines,rowspan,rquote,rspace,scriptlevel,scriptminsize,scriptsizemultiplier,selection,separator,separators,shift,side,src,stackalign,stretchy,subscriptshift,superscriptshift,symmetric,voffset,width,widths,xlink:href,xlink:show,xlink:type,xmlns` | ||
| ); | ||
| /** | ||
| * Known attributes, this is used for stringification of runtime static nodes | ||
| * so that we don't stringify bindings that cannot be set from HTML. | ||
| * Don't also forget to allow `data-*` and `aria-*`! | ||
| * Generated from https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes | ||
| */ | ||
| const isKnownHtmlAttr = /* @__PURE__ */ makeMap("accept,accept-charset,accesskey,action,align,allow,alt,async,autocapitalize,autocomplete,autofocus,autoplay,background,bgcolor,border,buffered,capture,challenge,charset,checked,cite,class,code,codebase,color,cols,colspan,content,contenteditable,contextmenu,controls,coords,crossorigin,csp,data,datetime,decoding,default,defer,dir,dirname,disabled,download,draggable,dropzone,enctype,enterkeyhint,for,form,formaction,formenctype,formmethod,formnovalidate,formtarget,headers,height,hidden,high,href,hreflang,http-equiv,icon,id,importance,inert,integrity,ismap,itemprop,keytype,kind,label,lang,language,loading,list,loop,low,manifest,max,maxlength,minlength,media,min,multiple,muted,name,novalidate,open,optimum,pattern,ping,placeholder,poster,preload,radiogroup,readonly,referrerpolicy,rel,required,reversed,rows,rowspan,sandbox,scope,scoped,selected,shape,size,sizes,slot,span,spellcheck,src,srcdoc,srclang,srcset,start,step,style,summary,tabindex,target,title,translate,type,usemap,value,width,wrap"); | ||
| /** | ||
| * Generated from https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute | ||
| */ | ||
| const isKnownSvgAttr = /* @__PURE__ */ makeMap("xmlns,accent-height,accumulate,additive,alignment-baseline,alphabetic,amplitude,arabic-form,ascent,attributeName,attributeType,azimuth,baseFrequency,baseline-shift,baseProfile,bbox,begin,bias,by,calcMode,cap-height,class,clip,clipPathUnits,clip-path,clip-rule,color,color-interpolation,color-interpolation-filters,color-profile,color-rendering,contentScriptType,contentStyleType,crossorigin,cursor,cx,cy,d,decelerate,descent,diffuseConstant,direction,display,divisor,dominant-baseline,dur,dx,dy,edgeMode,elevation,enable-background,end,exponent,fill,fill-opacity,fill-rule,filter,filterRes,filterUnits,flood-color,flood-opacity,font-family,font-size,font-size-adjust,font-stretch,font-style,font-variant,font-weight,format,from,fr,fx,fy,g1,g2,glyph-name,glyph-orientation-horizontal,glyph-orientation-vertical,glyphRef,gradientTransform,gradientUnits,hanging,height,href,hreflang,horiz-adv-x,horiz-origin-x,id,ideographic,image-rendering,in,in2,intercept,k,k1,k2,k3,k4,kernelMatrix,kernelUnitLength,kerning,keyPoints,keySplines,keyTimes,lang,lengthAdjust,letter-spacing,lighting-color,limitingConeAngle,local,marker-end,marker-mid,marker-start,markerHeight,markerUnits,markerWidth,mask,maskContentUnits,maskUnits,mathematical,max,media,method,min,mode,name,numOctaves,offset,opacity,operator,order,orient,orientation,origin,overflow,overline-position,overline-thickness,panose-1,paint-order,path,pathLength,patternContentUnits,patternTransform,patternUnits,ping,pointer-events,points,pointsAtX,pointsAtY,pointsAtZ,preserveAlpha,preserveAspectRatio,primitiveUnits,r,radius,referrerPolicy,refX,refY,rel,rendering-intent,repeatCount,repeatDur,requiredExtensions,requiredFeatures,restart,result,rotate,rx,ry,scale,seed,shape-rendering,slope,spacing,specularConstant,specularExponent,speed,spreadMethod,startOffset,stdDeviation,stemh,stemv,stitchTiles,stop-color,stop-opacity,strikethrough-position,strikethrough-thickness,string,stroke,stroke-dasharray,stroke-dashoffset,stroke-linecap,stroke-linejoin,stroke-miterlimit,stroke-opacity,stroke-width,style,surfaceScale,systemLanguage,tabindex,tableValues,target,targetX,targetY,text-anchor,text-decoration,text-rendering,textLength,to,transform,transform-origin,type,u1,u2,underline-position,underline-thickness,unicode,unicode-bidi,unicode-range,units-per-em,v-alphabetic,v-hanging,v-ideographic,v-mathematical,values,vector-effect,version,vert-adv-y,vert-origin-x,vert-origin-y,viewBox,viewTarget,visibility,width,widths,word-spacing,writing-mode,x,x-height,x1,x2,xChannelSelector,xlink:actuate,xlink:arcrole,xlink:href,xlink:role,xlink:show,xlink:title,xlink:type,xmlns:xlink,xml:base,xml:lang,xml:space,y,y1,y2,yChannelSelector,z,zoomAndPan"); | ||
| /** | ||
| * Generated from https://developer.mozilla.org/en-US/docs/Web/MathML/Attribute | ||
| */ | ||
| const isKnownMathMLAttr = /* @__PURE__ */ makeMap("accent,accentunder,actiontype,align,alignmentscope,altimg,altimg-height,altimg-valign,altimg-width,alttext,bevelled,close,columnsalign,columnlines,columnspan,denomalign,depth,dir,display,displaystyle,encoding,equalcolumns,equalrows,fence,fontstyle,fontweight,form,frame,framespacing,groupalign,height,href,id,indentalign,indentalignfirst,indentalignlast,indentshift,indentshiftfirst,indentshiftlast,indextype,justify,largetop,largeop,lquote,lspace,mathbackground,mathcolor,mathsize,mathvariant,maxsize,minlabelspacing,mode,other,overflow,position,rowalign,rowlines,rowspan,rquote,rspace,scriptlevel,scriptminsize,scriptsizemultiplier,selection,separator,separators,shift,side,src,stackalign,stretchy,subscriptshift,superscriptshift,symmetric,voffset,width,widths,xlink:href,xlink:show,xlink:type,xmlns"); | ||
| /** | ||
| * Shared between server-renderer and runtime-core hydration logic | ||
| */ | ||
| function isRenderableAttrValue(value) { | ||
| if (value == null) { | ||
| return false; | ||
| } | ||
| const type = typeof value; | ||
| return type === "string" || type === "number" || type === "boolean"; | ||
| if (value == null) return false; | ||
| const type = typeof value; | ||
| return type === "string" || type === "number" || type === "boolean"; | ||
| } | ||
| function shouldSetAsAttr(tagName, key) { | ||
| if (key === "spellcheck" || key === "draggable" || key === "translate" || key === "autocorrect") { | ||
| return true; | ||
| } | ||
| if (key === "form") { | ||
| return true; | ||
| } | ||
| if (key === "list" && tagName === "INPUT") { | ||
| return true; | ||
| } | ||
| if (key === "type" && tagName === "TEXTAREA") { | ||
| return true; | ||
| } | ||
| if ((key === "width" || key === "height") && (tagName === "IMG" || tagName === "VIDEO" || tagName === "CANVAS" || tagName === "SOURCE")) { | ||
| return true; | ||
| } | ||
| if (key === "sandbox" && tagName === "IFRAME") { | ||
| return true; | ||
| } | ||
| return false; | ||
| if (key === "spellcheck" || key === "draggable" || key === "translate" || key === "autocorrect") return true; | ||
| if (key === "form") return true; | ||
| if (key === "list" && tagName === "INPUT") return true; | ||
| if (key === "type" && tagName === "TEXTAREA") return true; | ||
| if ((key === "width" || key === "height") && (tagName === "IMG" || tagName === "VIDEO" || tagName === "CANVAS" || tagName === "SOURCE")) return true; | ||
| if (key === "sandbox" && tagName === "IFRAME") return true; | ||
| return false; | ||
| } | ||
| //#endregion | ||
| //#region packages/shared/src/domNamespace.ts | ||
| const Namespaces = { | ||
| "HTML": 0, | ||
| "0": "HTML", | ||
| "SVG": 1, | ||
| "1": "SVG", | ||
| "MATH_ML": 2, | ||
| "2": "MATH_ML" | ||
| "HTML": 0, | ||
| "0": "HTML", | ||
| "SVG": 1, | ||
| "1": "SVG", | ||
| "MATH_ML": 2, | ||
| "2": "MATH_ML" | ||
| }; | ||
| //#endregion | ||
| //#region packages/shared/src/escapeHtml.ts | ||
| const escapeRE = /["'&<>]/; | ||
| function escapeHtml(string) { | ||
| const str = "" + string; | ||
| const match = escapeRE.exec(str); | ||
| if (!match) { | ||
| return str; | ||
| } | ||
| let html = ""; | ||
| let escaped; | ||
| let index; | ||
| let lastIndex = 0; | ||
| for (index = match.index; index < str.length; index++) { | ||
| switch (str.charCodeAt(index)) { | ||
| case 34: | ||
| escaped = """; | ||
| break; | ||
| case 38: | ||
| escaped = "&"; | ||
| break; | ||
| case 39: | ||
| escaped = "'"; | ||
| break; | ||
| case 60: | ||
| escaped = "<"; | ||
| break; | ||
| case 62: | ||
| escaped = ">"; | ||
| break; | ||
| default: | ||
| continue; | ||
| } | ||
| if (lastIndex !== index) { | ||
| html += str.slice(lastIndex, index); | ||
| } | ||
| lastIndex = index + 1; | ||
| html += escaped; | ||
| } | ||
| return lastIndex !== index ? html + str.slice(lastIndex, index) : html; | ||
| const str = "" + string; | ||
| const match = escapeRE.exec(str); | ||
| if (!match) return str; | ||
| let html = ""; | ||
| let escaped; | ||
| let index; | ||
| let lastIndex = 0; | ||
| for (index = match.index; index < str.length; index++) { | ||
| switch (str.charCodeAt(index)) { | ||
| case 34: | ||
| escaped = """; | ||
| break; | ||
| case 38: | ||
| escaped = "&"; | ||
| break; | ||
| case 39: | ||
| escaped = "'"; | ||
| break; | ||
| case 60: | ||
| escaped = "<"; | ||
| break; | ||
| case 62: | ||
| escaped = ">"; | ||
| break; | ||
| default: continue; | ||
| } | ||
| if (lastIndex !== index) html += str.slice(lastIndex, index); | ||
| lastIndex = index + 1; | ||
| html += escaped; | ||
| } | ||
| return lastIndex !== index ? html + str.slice(lastIndex, index) : html; | ||
| } | ||
| const commentStripRE = /^-?>|<!--|-->|--!>|<!-$/g; | ||
| function escapeHtmlComment(src) { | ||
| return src.replace(commentStripRE, ""); | ||
| return src.replace(commentStripRE, ""); | ||
| } | ||
| const cssVarNameEscapeSymbolsRE = /[ !"#$%&'()*+,./:;<=>?@[\\\]^`{|}~]/g; | ||
| function getEscapedCssVarName(key, doubleEscape) { | ||
| return key.replace( | ||
| cssVarNameEscapeSymbolsRE, | ||
| (s) => doubleEscape ? s === '"' ? '\\\\\\"' : `\\\\${s}` : `\\${s}` | ||
| ); | ||
| return key.replace(cssVarNameEscapeSymbolsRE, (s) => doubleEscape ? s === "\"" ? "\\\\\\\"" : `\\\\${s}` : `\\${s}`); | ||
| } | ||
| //#endregion | ||
| //#region packages/shared/src/looseEqual.ts | ||
| function looseCompareArrays(a, b) { | ||
| if (a.length !== b.length) return false; | ||
| let equal = true; | ||
| for (let i = 0; equal && i < a.length; i++) { | ||
| equal = looseEqual(a[i], b[i]); | ||
| } | ||
| return equal; | ||
| if (a.length !== b.length) return false; | ||
| let equal = true; | ||
| for (let i = 0; equal && i < a.length; i++) equal = looseEqual(a[i], b[i]); | ||
| return equal; | ||
| } | ||
| function looseEqual(a, b) { | ||
| if (a === b) return true; | ||
| let aValidType = isDate(a); | ||
| let bValidType = isDate(b); | ||
| if (aValidType || bValidType) { | ||
| return aValidType && bValidType ? a.getTime() === b.getTime() : false; | ||
| } | ||
| aValidType = isSymbol(a); | ||
| bValidType = isSymbol(b); | ||
| if (aValidType || bValidType) { | ||
| return a === b; | ||
| } | ||
| aValidType = isArray(a); | ||
| bValidType = isArray(b); | ||
| if (aValidType || bValidType) { | ||
| return aValidType && bValidType ? looseCompareArrays(a, b) : false; | ||
| } | ||
| aValidType = isObject(a); | ||
| bValidType = isObject(b); | ||
| if (aValidType || bValidType) { | ||
| if (!aValidType || !bValidType) { | ||
| return false; | ||
| } | ||
| const aKeysCount = Object.keys(a).length; | ||
| const bKeysCount = Object.keys(b).length; | ||
| if (aKeysCount !== bKeysCount) { | ||
| return false; | ||
| } | ||
| for (const key in a) { | ||
| const aHasKey = a.hasOwnProperty(key); | ||
| const bHasKey = b.hasOwnProperty(key); | ||
| if (aHasKey && !bHasKey || !aHasKey && bHasKey || !looseEqual(a[key], b[key])) { | ||
| return false; | ||
| } | ||
| } | ||
| } | ||
| return String(a) === String(b); | ||
| if (a === b) return true; | ||
| let aValidType = isDate(a); | ||
| let bValidType = isDate(b); | ||
| if (aValidType || bValidType) return aValidType && bValidType ? a.getTime() === b.getTime() : false; | ||
| aValidType = isSymbol(a); | ||
| bValidType = isSymbol(b); | ||
| if (aValidType || bValidType) return a === b; | ||
| aValidType = isArray(a); | ||
| bValidType = isArray(b); | ||
| if (aValidType || bValidType) return aValidType && bValidType ? looseCompareArrays(a, b) : false; | ||
| aValidType = isObject(a); | ||
| bValidType = isObject(b); | ||
| if (aValidType || bValidType) { | ||
| if (!aValidType || !bValidType) return false; | ||
| if (Object.keys(a).length !== Object.keys(b).length) return false; | ||
| for (const key in a) { | ||
| const aHasKey = a.hasOwnProperty(key); | ||
| const bHasKey = b.hasOwnProperty(key); | ||
| if (aHasKey && !bHasKey || !aHasKey && bHasKey || !looseEqual(a[key], b[key])) return false; | ||
| } | ||
| } | ||
| return String(a) === String(b); | ||
| } | ||
| function looseIndexOf(arr, val) { | ||
| return arr.findIndex((item) => looseEqual(item, val)); | ||
| return arr.findIndex((item) => looseEqual(item, val)); | ||
| } | ||
| //#endregion | ||
| //#region packages/shared/src/toDisplayString.ts | ||
| const isRef = (val) => { | ||
| return !!(val && val["__v_isRef"] === true); | ||
| return !!(val && val["__v_isRef"] === true); | ||
| }; | ||
| /** | ||
| * For converting {{ interpolation }} values to displayed strings. | ||
| * @private | ||
| */ | ||
| const toDisplayString = (val) => { | ||
| switch (typeof val) { | ||
| case "string": | ||
| return val; | ||
| case "object": | ||
| if (val) { | ||
| if (isRef(val)) { | ||
| return toDisplayString(val.value); | ||
| } else if (isArray(val) || val.toString === objectToString || !isFunction(val.toString)) { | ||
| return JSON.stringify(val, replacer, 2); | ||
| } | ||
| } | ||
| default: | ||
| return val == null ? "" : String(val); | ||
| } | ||
| switch (typeof val) { | ||
| case "string": return val; | ||
| case "object": if (val) { | ||
| if (isRef(val)) return toDisplayString(val.value); | ||
| else if (isArray(val) || val.toString === objectToString || !isFunction(val.toString)) return JSON.stringify(val, replacer, 2); | ||
| } | ||
| default: return val == null ? "" : String(val); | ||
| } | ||
| }; | ||
| const replacer = (_key, val) => { | ||
| if (isRef(val)) { | ||
| return replacer(_key, val.value); | ||
| } else if (isMap(val)) { | ||
| return { | ||
| [`Map(${val.size})`]: [...val.entries()].reduce( | ||
| (entries, [key, val2], i) => { | ||
| entries[stringifySymbol(key, i) + " =>"] = val2; | ||
| return entries; | ||
| }, | ||
| {} | ||
| ) | ||
| }; | ||
| } else if (isSet(val)) { | ||
| return { | ||
| [`Set(${val.size})`]: [...val.values()].map((v) => stringifySymbol(v)) | ||
| }; | ||
| } else if (isSymbol(val)) { | ||
| return stringifySymbol(val); | ||
| } else if (isObject(val) && !isArray(val) && !isPlainObject(val)) { | ||
| return String(val); | ||
| } | ||
| return val; | ||
| if (isRef(val)) return replacer(_key, val.value); | ||
| else if (isMap(val)) return { [`Map(${val.size})`]: [...val.entries()].reduce((entries, [key, val], i) => { | ||
| entries[stringifySymbol(key, i) + " =>"] = val; | ||
| return entries; | ||
| }, {}) }; | ||
| else if (isSet(val)) return { [`Set(${val.size})`]: [...val.values()].map((v) => stringifySymbol(v)) }; | ||
| else if (isSymbol(val)) return stringifySymbol(val); | ||
| else if (isObject(val) && !isArray(val) && !isPlainObject(val)) return String(val); | ||
| return val; | ||
| }; | ||
| const stringifySymbol = (v, i = "") => { | ||
| var _a; | ||
| return ( | ||
| // Symbol.description in es2019+ so we need to cast here to pass | ||
| // the lib: es2016 check | ||
| isSymbol(v) ? `Symbol(${(_a = v.description) != null ? _a : i})` : v | ||
| ); | ||
| var _description; | ||
| return isSymbol(v) ? `Symbol(${(_description = v.description) !== null && _description !== void 0 ? _description : i})` : v; | ||
| }; | ||
| //#endregion | ||
| //#region packages/shared/src/subSequence.ts | ||
| function getSequence(arr) { | ||
| const p = arr.slice(); | ||
| const result = [0]; | ||
| let i, j, u, v, c; | ||
| const len = arr.length; | ||
| for (i = 0; i < len; i++) { | ||
| const arrI = arr[i]; | ||
| if (arrI !== 0) { | ||
| j = result[result.length - 1]; | ||
| if (arr[j] < arrI) { | ||
| p[i] = j; | ||
| result.push(i); | ||
| continue; | ||
| } | ||
| u = 0; | ||
| v = result.length - 1; | ||
| while (u < v) { | ||
| c = u + v >> 1; | ||
| if (arr[result[c]] < arrI) { | ||
| u = c + 1; | ||
| } else { | ||
| v = c; | ||
| } | ||
| } | ||
| if (arrI < arr[result[u]]) { | ||
| if (u > 0) { | ||
| p[i] = result[u - 1]; | ||
| } | ||
| result[u] = i; | ||
| } | ||
| } | ||
| } | ||
| u = result.length; | ||
| v = result[u - 1]; | ||
| while (u-- > 0) { | ||
| result[u] = v; | ||
| v = p[v]; | ||
| } | ||
| return result; | ||
| const p = arr.slice(); | ||
| const result = [0]; | ||
| let i, j, u, v, c; | ||
| const len = arr.length; | ||
| for (i = 0; i < len; i++) { | ||
| const arrI = arr[i]; | ||
| if (arrI !== 0) { | ||
| j = result[result.length - 1]; | ||
| if (arr[j] < arrI) { | ||
| p[i] = j; | ||
| result.push(i); | ||
| continue; | ||
| } | ||
| u = 0; | ||
| v = result.length - 1; | ||
| while (u < v) { | ||
| c = u + v >> 1; | ||
| if (arr[result[c]] < arrI) u = c + 1; | ||
| else v = c; | ||
| } | ||
| if (arrI < arr[result[u]]) { | ||
| if (u > 0) p[i] = result[u - 1]; | ||
| result[u] = i; | ||
| } | ||
| } | ||
| } | ||
| u = result.length; | ||
| v = result[u - 1]; | ||
| while (u-- > 0) { | ||
| result[u] = v; | ||
| v = p[v]; | ||
| } | ||
| return result; | ||
| } | ||
| //#endregion | ||
| //#region packages/shared/src/cssVars.ts | ||
| /** | ||
| * Normalize CSS var value created by `v-bind` in `<style>` block | ||
| * See https://github.com/vuejs/core/pull/12461#issuecomment-2495804664 | ||
| */ | ||
| function normalizeCssVarValue(value) { | ||
| if (value == null) { | ||
| return "initial"; | ||
| } | ||
| if (typeof value === "string") { | ||
| return value === "" ? " " : value; | ||
| } | ||
| if (typeof value !== "number" || !Number.isFinite(value)) { | ||
| if (!!(process.env.NODE_ENV !== "production")) { | ||
| console.warn( | ||
| "[Vue warn] Invalid value used for CSS binding. Expected a string or a finite number but received:", | ||
| value | ||
| ); | ||
| } | ||
| } | ||
| return String(value); | ||
| if (value == null) return "initial"; | ||
| if (typeof value === "string") return value === "" ? " " : value; | ||
| if (typeof value !== "number" || !Number.isFinite(value)) { | ||
| if (!!(process.env.NODE_ENV !== "production")) console.warn("[Vue warn] Invalid value used for CSS binding. Expected a string or a finite number but received:", value); | ||
| } | ||
| return String(value); | ||
| } | ||
| export { EMPTY_ARR, EMPTY_OBJ, NO, NOOP, Namespaces, PatchFlagNames, PatchFlags, ShapeFlags, SlotFlags, YES, camelize, canSetValueDirectly, capitalize, cssVarNameEscapeSymbolsRE, def, escapeHtml, escapeHtmlComment, extend, genCacheKey, genPropsAccessExp, generateCodeFrame, getEscapedCssVarName, getGlobalThis, getModifierPropName, getSequence, hasChanged, hasOwn, hyphenate, includeBooleanAttr, invokeArrayFns, isAlwaysCloseTag, isArray, isBlockTag, isBooleanAttr, isBuiltInDirective, isBuiltInTag, isDate, isFormattingTag, isFunction, isGloballyAllowed, isGloballyWhitelisted, isHTMLTag, isInlineTag, isIntegerKey, isKnownHtmlAttr, isKnownMathMLAttr, isKnownSvgAttr, isMap, isMathMLTag, isModelListener, isNativeOn, isObject, isOn, isPlainObject, isPromise, isRegExp, isRenderableAttrValue, isReservedProp, isSSRSafeAttrName, isSVGTag, isSet, isSpecialBooleanAttr, isString, isSymbol, isVoidTag, looseEqual, looseIndexOf, looseToNumber, makeMap, normalizeClass, normalizeCssVarValue, normalizeProps, normalizeStyle, objectToString, parseStringStyle, propsToAttrMap, remove, shouldSetAsAttr, slotFlagsText, stringifyStyle, toDisplayString, toHandlerKey, toNumber, toRawType, toTypeString }; | ||
| //#endregion | ||
| export { EMPTY_ARR, EMPTY_OBJ, NO, NOOP, Namespaces, PatchFlagNames, PatchFlags, ShapeFlags, SlotFlags, YES, camelize, canSetValueDirectly, capitalize, cssVarNameEscapeSymbolsRE, def, escapeHtml, escapeHtmlComment, extend, genCacheKey, genPropsAccessExp, generateCodeFrame, getEscapedCssVarName, getGlobalThis, getModifierPropName, getSequence, hasChanged, hasOwn, hyphenate, includeBooleanAttr, invokeArrayFns, isAlwaysCloseTag, isArray, isBlockTag, isBooleanAttr, isBuiltInDirective, isBuiltInTag, isDate, isFormattingTag, isFunction, isGloballyAllowed, isGloballyWhitelisted, isHTMLTag, isInlineTag, isIntegerKey, isKnownHtmlAttr, isKnownMathMLAttr, isKnownSvgAttr, isMap, isMathMLTag, isModelListener, isNativeOn, isObject, isOn, isPlainObject, isPromise, isRegExp, isRenderableAttrValue, isReservedProp, isSSRSafeAttrName, isSVGTag, isSet, isSpecialBooleanAttr, isString, isSymbol, isVoidTag, looseEqual, looseIndexOf, looseToNumber, makeMap, normalizeClass, normalizeCssVarValue, normalizeProps, normalizeStyle, objectToString, parseStringStyle, propsToAttrMap, remove, shouldSetAsAttr, slotFlagsText, stringifyStyle, toDisplayString, toHandlerKey, toNumber, toRawType, toTypeString }; |
+1
-1
| { | ||
| "name": "@vue/shared", | ||
| "version": "3.6.0-beta.4", | ||
| "version": "3.6.0-beta.5", | ||
| "description": "internal utils shared across @vue packages", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 1 instance in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 1 instance in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
109268
9.44%2600
5.39%21
-12.5%