@estjs/shared 0.0.15-beta.7 → 0.0.15-beta.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/shared.cjs.js +2 -1
- package/dist/shared.cjs.js.map +1 -1
- package/dist/shared.d.cts +92 -9
- package/dist/shared.d.ts +92 -9
- package/dist/shared.dev.cjs.js +138 -8
- package/dist/shared.dev.cjs.js.map +1 -1
- package/dist/shared.dev.esm.js +127 -7
- package/dist/shared.dev.esm.js.map +1 -1
- package/dist/shared.esm.js +2 -1
- package/dist/shared.esm.js.map +1 -1
- package/package.json +1 -1
package/dist/shared.dev.cjs.js
CHANGED
|
@@ -42,17 +42,21 @@ __export(src_exports, {
|
|
|
42
42
|
isBooleanAttr: () => isBooleanAttr,
|
|
43
43
|
isBrowser: () => isBrowser,
|
|
44
44
|
isDelegatedEvent: () => isDelegatedEvent,
|
|
45
|
-
isExclude: () => isExclude,
|
|
46
45
|
isFalsy: () => isFalsy,
|
|
47
46
|
isFunction: () => isFunction,
|
|
48
47
|
isHTMLElement: () => isHTMLElement,
|
|
49
48
|
isHTMLTag: () => isHTMLTag,
|
|
49
|
+
isHtmlFormElement: () => isHtmlFormElement,
|
|
50
|
+
isHtmlInputElement: () => isHtmlInputElement,
|
|
51
|
+
isHtmlSelectElement: () => isHtmlSelectElement,
|
|
52
|
+
isHtmlTextAreaElement: () => isHtmlTextAreaElement,
|
|
50
53
|
isKnownHtmlAttr: () => isKnownHtmlAttr,
|
|
51
54
|
isKnownSvgAttr: () => isKnownSvgAttr,
|
|
52
55
|
isMap: () => isMap,
|
|
53
56
|
isMathMLTag: () => isMathMLTag,
|
|
54
57
|
isNaN: () => isNaN,
|
|
55
58
|
isNil: () => isNil,
|
|
59
|
+
isNode: () => isNode,
|
|
56
60
|
isNull: () => isNull,
|
|
57
61
|
isNumber: () => isNumber,
|
|
58
62
|
isObject: () => isObject,
|
|
@@ -69,14 +73,20 @@ __export(src_exports, {
|
|
|
69
73
|
isString: () => isString,
|
|
70
74
|
isStringNumber: () => isStringNumber,
|
|
71
75
|
isSymbol: () => isSymbol,
|
|
76
|
+
isTextNode: () => isTextNode,
|
|
72
77
|
isUndefined: () => isUndefined,
|
|
73
78
|
isVoidTag: () => isVoidTag,
|
|
74
79
|
isWeakMap: () => isWeakMap,
|
|
75
80
|
isWeakSet: () => isWeakSet,
|
|
76
81
|
kebabCase: () => kebabCase,
|
|
77
82
|
noop: () => noop,
|
|
83
|
+
normalizeClassName: () => normalizeClassName,
|
|
84
|
+
normalizeStyle: () => normalizeStyle,
|
|
85
|
+
parseStyleString: () => parseStyleString,
|
|
78
86
|
propsToAttrMap: () => propsToAttrMap,
|
|
79
87
|
startsWith: () => startsWith,
|
|
88
|
+
styleObjectToString: () => styleObjectToString,
|
|
89
|
+
styleToString: () => styleToString,
|
|
80
90
|
warn: () => warn
|
|
81
91
|
});
|
|
82
92
|
module.exports = __toCommonJS(src_exports);
|
|
@@ -182,12 +192,6 @@ var _globalThis;
|
|
|
182
192
|
var getGlobalThis = () => {
|
|
183
193
|
return _globalThis || (_globalThis = typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : {});
|
|
184
194
|
};
|
|
185
|
-
function isExclude(key, exclude) {
|
|
186
|
-
if (!exclude) {
|
|
187
|
-
return false;
|
|
188
|
-
}
|
|
189
|
-
return isArray(exclude) ? exclude.includes(key) : isFunction(exclude) ? exclude(key) : false;
|
|
190
|
-
}
|
|
191
195
|
|
|
192
196
|
// src/string.ts
|
|
193
197
|
var hyphenateRE = /\B([A-Z])/g;
|
|
@@ -330,6 +334,122 @@ var isMathMLTag = /* @__PURE__ */ makeMap(MATH_TAGS);
|
|
|
330
334
|
var isVoidTag = /* @__PURE__ */ makeMap(VOID_TAGS);
|
|
331
335
|
var isSelfClosingTag = /* @__PURE__ */ makeMap(SELFCLOSING_TAGS);
|
|
332
336
|
var isDelegatedEvent = /* @__PURE__ */ makeMap(DELEGATED_EVENTS);
|
|
337
|
+
|
|
338
|
+
// src/dom-types.ts
|
|
339
|
+
function isHtmlInputElement(val) {
|
|
340
|
+
return typeof HTMLInputElement !== "undefined" && val instanceof HTMLInputElement;
|
|
341
|
+
}
|
|
342
|
+
function isHtmlSelectElement(val) {
|
|
343
|
+
return typeof HTMLSelectElement !== "undefined" && val instanceof HTMLSelectElement;
|
|
344
|
+
}
|
|
345
|
+
function isHtmlTextAreaElement(val) {
|
|
346
|
+
return typeof HTMLTextAreaElement !== "undefined" && val instanceof HTMLTextAreaElement;
|
|
347
|
+
}
|
|
348
|
+
function isHtmlFormElement(val) {
|
|
349
|
+
return typeof HTMLFormElement !== "undefined" && val instanceof HTMLFormElement;
|
|
350
|
+
}
|
|
351
|
+
function isTextNode(val) {
|
|
352
|
+
return typeof Text !== "undefined" && val instanceof Text;
|
|
353
|
+
}
|
|
354
|
+
function isNode(val) {
|
|
355
|
+
return typeof Node !== "undefined" && val instanceof Node;
|
|
356
|
+
}
|
|
357
|
+
|
|
358
|
+
// src/normalize.ts
|
|
359
|
+
var STYLE_SEPARATOR_REGEX = /;(?![^(]*\))/g;
|
|
360
|
+
var PROPERTY_VALUE_SEPARATOR_REGEX = /:([\s\S]+)/;
|
|
361
|
+
var STYLE_COMMENT_REGEX = /\/\*[\s\S]*?\*\//g;
|
|
362
|
+
function parseStyleString(cssText) {
|
|
363
|
+
const styleObject = {};
|
|
364
|
+
cssText.replaceAll(STYLE_COMMENT_REGEX, "").split(STYLE_SEPARATOR_REGEX).forEach((styleItem) => {
|
|
365
|
+
if (styleItem) {
|
|
366
|
+
const parts = styleItem.split(PROPERTY_VALUE_SEPARATOR_REGEX);
|
|
367
|
+
if (parts.length > 1) {
|
|
368
|
+
styleObject[parts[0].trim()] = parts[1].trim();
|
|
369
|
+
}
|
|
370
|
+
}
|
|
371
|
+
});
|
|
372
|
+
return styleObject;
|
|
373
|
+
}
|
|
374
|
+
function normalizeStyle(styleValue) {
|
|
375
|
+
if (isArray(styleValue)) {
|
|
376
|
+
const normalizedStyleObject = {};
|
|
377
|
+
for (const styleItem of styleValue) {
|
|
378
|
+
const normalizedItem = isString(styleItem) ? parseStyleString(styleItem) : normalizeStyle(styleItem);
|
|
379
|
+
if (normalizedItem) {
|
|
380
|
+
for (const key in normalizedItem) {
|
|
381
|
+
normalizedStyleObject[key] = normalizedItem[key];
|
|
382
|
+
}
|
|
383
|
+
}
|
|
384
|
+
}
|
|
385
|
+
return normalizedStyleObject;
|
|
386
|
+
}
|
|
387
|
+
if (isString(styleValue) || isObject(styleValue)) {
|
|
388
|
+
return styleValue;
|
|
389
|
+
}
|
|
390
|
+
return void 0;
|
|
391
|
+
}
|
|
392
|
+
function styleToString(styleValue) {
|
|
393
|
+
if (!styleValue) {
|
|
394
|
+
return "";
|
|
395
|
+
}
|
|
396
|
+
if (isString(styleValue)) {
|
|
397
|
+
return styleValue;
|
|
398
|
+
}
|
|
399
|
+
let cssText = "";
|
|
400
|
+
for (const propName in styleValue) {
|
|
401
|
+
const propValue = styleValue[propName];
|
|
402
|
+
if (isString(propValue) || isNumber(propValue)) {
|
|
403
|
+
const normalizedPropName = propName.startsWith("--") ? propName : kebabCase(propName);
|
|
404
|
+
cssText += `${normalizedPropName}:${propValue};`;
|
|
405
|
+
}
|
|
406
|
+
}
|
|
407
|
+
return cssText;
|
|
408
|
+
}
|
|
409
|
+
function normalizeClassName(classValue) {
|
|
410
|
+
if (classValue == null) {
|
|
411
|
+
return "";
|
|
412
|
+
}
|
|
413
|
+
if (isString(classValue)) {
|
|
414
|
+
return classValue.trim();
|
|
415
|
+
}
|
|
416
|
+
if (isArray(classValue)) {
|
|
417
|
+
return classValue.map(normalizeClassName).filter(Boolean).join(" ");
|
|
418
|
+
}
|
|
419
|
+
if (isObject(classValue)) {
|
|
420
|
+
let count = 0;
|
|
421
|
+
for (const key in classValue) {
|
|
422
|
+
if (classValue[key]) count++;
|
|
423
|
+
}
|
|
424
|
+
if (count === 0) return "";
|
|
425
|
+
const result = new Array(count);
|
|
426
|
+
let index = 0;
|
|
427
|
+
for (const key in classValue) {
|
|
428
|
+
if (classValue[key]) {
|
|
429
|
+
result[index++] = key;
|
|
430
|
+
}
|
|
431
|
+
}
|
|
432
|
+
return result.join(" ");
|
|
433
|
+
}
|
|
434
|
+
return String(classValue).trim();
|
|
435
|
+
}
|
|
436
|
+
function styleObjectToString(styleValue) {
|
|
437
|
+
if (!styleValue) {
|
|
438
|
+
return "";
|
|
439
|
+
}
|
|
440
|
+
if (isString(styleValue)) {
|
|
441
|
+
return styleValue;
|
|
442
|
+
}
|
|
443
|
+
let cssText = "";
|
|
444
|
+
for (const propName in styleValue) {
|
|
445
|
+
const propValue = styleValue[propName];
|
|
446
|
+
if (isString(propValue) || isNumber(propValue)) {
|
|
447
|
+
const normalizedPropName = propName.startsWith("--") ? propName : kebabCase(propName);
|
|
448
|
+
cssText += `${normalizedPropName}:${propValue};`;
|
|
449
|
+
}
|
|
450
|
+
}
|
|
451
|
+
return cssText;
|
|
452
|
+
}
|
|
333
453
|
// Annotate the CommonJS export names for ESM import in node:
|
|
334
454
|
0 && (module.exports = {
|
|
335
455
|
EMPTY_ARR,
|
|
@@ -354,17 +474,21 @@ var isDelegatedEvent = /* @__PURE__ */ makeMap(DELEGATED_EVENTS);
|
|
|
354
474
|
isBooleanAttr,
|
|
355
475
|
isBrowser,
|
|
356
476
|
isDelegatedEvent,
|
|
357
|
-
isExclude,
|
|
358
477
|
isFalsy,
|
|
359
478
|
isFunction,
|
|
360
479
|
isHTMLElement,
|
|
361
480
|
isHTMLTag,
|
|
481
|
+
isHtmlFormElement,
|
|
482
|
+
isHtmlInputElement,
|
|
483
|
+
isHtmlSelectElement,
|
|
484
|
+
isHtmlTextAreaElement,
|
|
362
485
|
isKnownHtmlAttr,
|
|
363
486
|
isKnownSvgAttr,
|
|
364
487
|
isMap,
|
|
365
488
|
isMathMLTag,
|
|
366
489
|
isNaN,
|
|
367
490
|
isNil,
|
|
491
|
+
isNode,
|
|
368
492
|
isNull,
|
|
369
493
|
isNumber,
|
|
370
494
|
isObject,
|
|
@@ -381,14 +505,20 @@ var isDelegatedEvent = /* @__PURE__ */ makeMap(DELEGATED_EVENTS);
|
|
|
381
505
|
isString,
|
|
382
506
|
isStringNumber,
|
|
383
507
|
isSymbol,
|
|
508
|
+
isTextNode,
|
|
384
509
|
isUndefined,
|
|
385
510
|
isVoidTag,
|
|
386
511
|
isWeakMap,
|
|
387
512
|
isWeakSet,
|
|
388
513
|
kebabCase,
|
|
389
514
|
noop,
|
|
515
|
+
normalizeClassName,
|
|
516
|
+
normalizeStyle,
|
|
517
|
+
parseStyleString,
|
|
390
518
|
propsToAttrMap,
|
|
391
519
|
startsWith,
|
|
520
|
+
styleObjectToString,
|
|
521
|
+
styleToString,
|
|
392
522
|
warn
|
|
393
523
|
});
|
|
394
524
|
/*! #__NO_SIDE_EFFECTS__ */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts","../src/is.ts","../src/base.ts","../src/string.ts","../src/logger.ts","../src/escape.ts","../src/dom.ts"],"sourcesContent":["// Utility function exports\nexport {\n noop,\n extend,\n hasChanged,\n coerceArray,\n hasOwn,\n startsWith,\n isExclude,\n isOn,\n generateUniqueId,\n isBrowser,\n cacheStringFunction,\n EMPTY_OBJ,\n EMPTY_ARR,\n ExcludeType,\n getGlobalThis,\n} from './base';\n\nexport {\n isString,\n isObject,\n isArray,\n isMap,\n isSet,\n isWeakMap,\n isWeakSet,\n isFunction,\n isNil,\n isNull,\n isPromise,\n isSymbol,\n isFalsy,\n isPlainObject,\n isPrimitive,\n isHTMLElement,\n isStringNumber,\n isNumber,\n isUndefined,\n isBoolean,\n isNaN,\n type StringNumber,\n} from './is';\n\nexport { camelCase, kebabCase, capitalize } from './string';\n\nexport { warn, info, error } from './logger';\n\nexport { escapeHTML, escapeHTMLComment, getEscapedCssVarName } from './escape';\nexport { isHTMLTag, isSVGTag, isMathMLTag, isVoidTag, isSelfClosingTag } from './dom';\nexport {\n isRenderAbleAttrValue,\n isKnownSvgAttr,\n isKnownHtmlAttr,\n isSSRSafeAttrName,\n includeBooleanAttr,\n propsToAttrMap,\n isSpecialBooleanAttr,\n isDelegatedEvent,\n isBooleanAttr,\n} from './dom';\n","import { _toString } from './base';\n\n/**\n * Checks if a value is an object\n * @param {unknown} val - The value to check\n * @returns {boolean} - Returns true if the value is an object, false otherwise\n */\nexport const isObject = (val: unknown): val is Record<any, unknown> =>\n val !== null && typeof val === 'object';\n\n/**\n * Checks if a value is a Promise\n * @template T - The type of the Promise's resolved value\n * @param {unknown} val - The value to check\n * @returns {boolean} - Returns true if the value is a Promise, false otherwise\n */\nexport function isPromise<T = unknown>(val: unknown): val is Promise<T> {\n return _toString.call(val) === '[object Promise]';\n}\n\n/**\n * Checks if a value is an Array\n * @type {(arg: unknown ) => arg is unknown []}\n */\nexport const isArray = Array.isArray;\n\n/**\n * Checks if a value is a string\n * @param {unknown} val - The value to check\n * @returns {boolean} - Returns true if the value is a string, false otherwise\n */\nexport function isString(val: unknown): val is string {\n return typeof val === 'string';\n}\n\n/**\n * Checks if a value is a number\n * @param {unknown} val - The value to check\n * @returns {boolean} - Returns true if the value is a number, false otherwise\n */\nexport function isNumber(val: unknown): val is number {\n return typeof val === 'number';\n}\n/**\n * Checks if a value is null\n * @param {unknown} val - The value to check\n * @returns {boolean} - Returns true if the value is null, false otherwise\n */\nexport function isNull(val: unknown): val is null {\n return val === null;\n}\n\n/**\n * Checks if a value is a Symbol\n * @param {unknown} val - The value to check\n * @returns {boolean} - Returns true if the value is a Symbol, false otherwise\n */\nexport function isSymbol(val: unknown): val is symbol {\n return typeof val === 'symbol';\n}\n\n/**\n * Checks if a value is a Set\n * @param {unknown} val - The value to check\n * @returns {boolean} - Returns true if the value is a Set, false otherwise\n */\nexport function isSet(val: unknown): val is Set<unknown> {\n return _toString.call(val) === '[object Set]';\n}\n\n/**\n * Checks if a value is a WeakMap\n * @param {unknown} val - The value to check\n * @returns {boolean} - Returns true if the value is a WeakMap, false otherwise\n */\nexport function isWeakMap(val: unknown): val is WeakMap<any, unknown> {\n return _toString.call(val) === '[object WeakMap]';\n}\n\n/**\n * Checks if a value is a WeakSet\n * @param {unknown} val - The value to check\n * @returns {boolean} - Returns true if the value is a WeakSet, false otherwise\n */\nexport function isWeakSet(val: unknown): val is WeakSet<any> {\n return _toString.call(val) === '[object WeakSet]';\n}\n\n/**\n * Checks if a value is a Map\n * @param {unknown} val - The value to check\n * @returns {boolean} - Returns true if the value is a Map, false otherwise\n */\nexport function isMap(val: unknown): val is Map<unknown, unknown> {\n return _toString.call(val) === '[object Map]';\n}\n\n/**\n * Checks if a value is null or undefined\n * @param {unknown} val - The value to check\n * @returns {boolean} - Returns true if the value is null or undefined, false otherwise\n */\nexport function isNil(val: unknown): val is null | undefined {\n return val === null || val === undefined;\n}\n\n/**\n * Checks if a value is a function\n * @param {unknown} val - The value to check\n * @returns {boolean} - Returns true if the value is a function, false otherwise\n */\nexport const isFunction = (val: unknown): val is Function => typeof val === 'function';\n\n/**\n * Checks if a value is falsy (false, null, or undefined)\n * @param {unknown} val - The value to check\n * @returns {boolean} - Returns true if the value is falsy, false otherwise\n */\nexport function isFalsy(val: unknown): val is false | null | undefined {\n return val === false || val === null || val === undefined;\n}\n\n/**\n * Checks if a value is a primitive type (string, number, boolean, symbol, null, or undefined)\n * @param {unknown} val - The value to check\n * @returns {boolean} - Returns true if the value is a primitive type, false otherwise\n */\nexport const isPrimitive = (\n val: unknown,\n): val is string | number | boolean | symbol | null | undefined =>\n ['string', 'number', 'boolean', 'symbol', 'undefined'].includes(typeof val) || isNull(val);\n\n/**\n * Checks if a value is an HTMLElement\n * @param {unknown} val - The value to check\n * @returns {boolean} - Returns true if the value is an HTMLElement, false otherwise\n */\nexport function isHTMLElement(val: unknown): val is HTMLElement {\n return val instanceof HTMLElement;\n}\n\n/**\n * Checks if a value is a plain object (created using Object constructor)\n * @param {unknown} val - The value to check\n * @returns {boolean} - Returns true if the value is a plain object, false otherwise\n */\nexport const isPlainObject = (val: unknown): val is object =>\n _toString.call(val) === '[object Object]';\n\n/**\n * String representation of a number\n * @typedef {`${number}`} StringNumber\n */\nexport type StringNumber = `${number}`;\n\n/**\n * Checks if a value is a string representation of a number\n * @param {unknown} val - The value to check\n * @returns {boolean} - Returns true if the value is a string number, false otherwise\n */\nexport function isStringNumber(val: unknown): val is StringNumber {\n if (!isString(val) || val === '') {\n return false;\n }\n return !Number.isNaN(Number(val));\n}\n\n/**\n * Checks if a value is undefined\n * @param {unknown} val - The value to check\n * @returns {boolean} - Returns true if the value is undefined, false otherwise\n */\nexport function isUndefined(val: unknown): val is undefined {\n return typeof val === 'undefined';\n}\n\n/**\n * Checks if a value is a boolean\n * @param {unknown} val - The value to check\n * @returns {boolean} - Returns true if the value is a boolean, false otherwise\n */\nexport function isBoolean(val: unknown): val is boolean {\n return typeof val === 'boolean';\n}\n\nexport function isNaN(val: unknown): val is number {\n return Number.isNaN(val);\n}\n","import { isArray, isFunction, isString } from './is';\n\n/**\n * Reference to Object.prototype.toString\n * @type {Function}\n */\nexport const _toString = Object.prototype.toString;\nconst hasOwnProperty = Object.prototype.hasOwnProperty;\n\n/**\n * Reference to Object.assign\n * @type {Function}\n */\nexport const extend = Object.assign;\n\n/**\n * Checks if an object has a specific property\n * @template T\n * @param {object} val - The target object to check\n * @param {string | symbol} key - The property name to check for\n * @returns {key is keyof T} - Returns true if the object has the property, false otherwise\n */\nexport const hasOwn = (val: object, key: string | symbol): key is keyof typeof val =>\n hasOwnProperty.call(val, key);\n/**\n * Forces a value to be an array\n * @template T - The type of array elements\n * @param {T | T[]} data - The data to convert, can be a single element or an array\n * @returns {T[]} - The resulting array\n */\nexport function coerceArray<T>(data: T | T[]): T[] {\n return isArray(data) ? data : [data];\n}\n\n/**\n * Checks if a value has changed\n * @param {unknown } value - The new value\n * @param {unknown } oldValue - The old value\n * @returns {boolean} - Returns true if the value has changed, false otherwise\n */\nexport const hasChanged = (value: unknown, oldValue: unknown): boolean =>\n !Object.is(value, oldValue);\n\n/**\n * Empty function, used for defaults and placeholders\n * @type {Function}\n */\nexport const noop = Function.prototype as () => void;\n\n/**\n * Checks if a string starts with a specified substring\n *\n * Uses indexOf for better performance in most cases\n * @see https://www.measurethat.net/Benchmarks/Show/12350/0/startswith-vs-test-vs-match-vs-indexof#latest_results_block\n * @param {string} str - The string to check\n * @param {string} searchString - The substring to search for\n * @returns {boolean} - Returns true if the string starts with the substring, false otherwise\n */\nexport function startsWith(str: string, searchString: string): boolean {\n if (!isString(str)) {\n return false;\n }\n return str.indexOf(searchString) === 0;\n}\n\n/**\n * Generates an 8-character random string as a unique identifier\n *\n * Note: Uses Math.random() which is not cryptographically secure.\n * For security-sensitive use cases, consider using crypto.getRandomValues()\n * @returns {string} - The generated unique identifier\n */\nexport function generateUniqueId(): string {\n const characters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';\n let result = '';\n const charactersLength = characters.length;\n for (let i = 0; i < 8; i++) {\n result += characters.charAt(Math.floor(Math.random() * charactersLength));\n }\n return result;\n}\n\n/**\n * Checks if the current environment is a browser\n * @returns {boolean} - Returns true if in a browser environment, false otherwise\n */\nexport function isBrowser(): boolean {\n return typeof window !== 'undefined' && typeof document !== 'undefined';\n}\n\n/**\n * Creates a cached version of a string processing function\n * @template T - The function type\n * @param {T} fn - The string processing function to cache\n * @returns {T} - The cached function\n */\nexport const cacheStringFunction = <T extends (str: string) => string>(fn: T): T => {\n const cache: Record<string, string> = Object.create(null);\n return ((str: string) => {\n const hit = cache[str];\n return hit || (cache[str] = fn(str));\n }) as T;\n};\n\n/**\n * Read-only empty object\n * @type {Readonly<Record<string, unknown >>}\n */\nexport const EMPTY_OBJ: { readonly [key: string]: unknown } = Object.freeze({});\n\n/**\n * Read-only empty array\n * @type {readonly never[]}\n */\nexport const EMPTY_ARR: readonly never[] = Object.freeze([]);\n\n/**\n * Checks if a property name is an event handler (starts with 'on' followed by uppercase letter)\n *\n * Matches patterns like: onClick, onChange, onKeyDown (but not 'onclick' or 'on123')\n * @param {string} key - The property name to check\n * @returns {boolean} - Returns true if the property is an event handler, false otherwise\n */\nexport const isOn = (key: string): boolean =>\n key.charCodeAt(0) === 111 /* o */ &&\n key.charCodeAt(1) === 110 /* n */ &&\n key.charCodeAt(2) >= 65 && // uppercase letter A-Z\n key.charCodeAt(2) <= 90;\n\ndeclare let global: {};\n\nlet _globalThis: unknown;\n/**\n * Gets the global object for the current environment\n * @returns {unknown } - The global object for the current environment\n */\nexport const getGlobalThis = (): unknown => {\n return (\n _globalThis ||\n (_globalThis =\n typeof globalThis !== 'undefined'\n ? globalThis\n : typeof self !== 'undefined'\n ? self\n : typeof window !== 'undefined'\n ? window\n : typeof global !== 'undefined'\n ? global\n : {})\n );\n};\n\nexport type ExcludeType = ((key: string | symbol) => boolean) | (string | symbol)[];\n\n/**\n * Checks if a key should be excluded\n * @param {string | symbol} key - The key to check\n * @param {ExcludeType} [exclude] - The exclusion condition, can be a function or array\n * @returns {boolean} - Returns true if the key should be excluded, false otherwise\n */\nexport function isExclude(key: string | symbol, exclude?: ExcludeType): boolean {\n if (!exclude) {\n return false;\n }\n return isArray(exclude) ? exclude.includes(key) : isFunction(exclude) ? exclude(key) : false;\n}\n","import { cacheStringFunction } from './base';\n\n/**\n * Regular expression for converting camelCase to kebab-case\n * @type {RegExp}\n */\nconst hyphenateRE = /\\B([A-Z])/g;\n\n/**\n * Converts a camelCase string to kebab-case\n * Example: myFunction -> my-function\n * @param {string} str - The camelCase string to convert\n * @returns {string} - The kebab-case string\n */\nexport const kebabCase: (str: string) => string = cacheStringFunction((str: string) =>\n str.replaceAll(hyphenateRE, '-$1').toLowerCase(),\n);\n\n/**\n * Regular expression for converting kebab-case or snake_case to camelCase\n * @type {RegExp}\n */\nconst camelizeRE = /[_-](\\w)/g;\n\n/**\n * Converts a kebab-case or snake_case string to camelCase\n * Example: my-function or my_function -> myFunction\n * @param {string} str - The kebab-case or snake_case string to convert\n * @returns {string} - The camelCase string\n */\nexport const camelCase: (str: string) => string = cacheStringFunction((str: string): string => {\n // Remove leading and trailing hyphens or underscores\n str = str.replaceAll(/^[_-]+|[_-]+$/g, '');\n // Replace consecutive hyphens or underscores with a single hyphen\n str = str.replaceAll(/[_-]+/g, '-');\n // Convert to camelCase\n return str.replaceAll(camelizeRE, (_, c) => c.toUpperCase());\n});\n\n/**\n * Capitalizes the first letter of a string\n * Example: hello -> Hello\n * @template T - The input string type\n * @param {T} str - The string to capitalize\n * @returns {Capitalize<T>} - The capitalized string\n */\nexport const capitalize: <T extends string>(str: T) => Capitalize<T> = cacheStringFunction(\n <T extends string>(str: T) => {\n return (str.charAt(0).toUpperCase() + str.slice(1)) as Capitalize<T>;\n },\n);\n","/**\n * Outputs a warning level log message\n * @param {string} msg - The warning message\n * @param {...unknown } args - Additional arguments to log\n */\nexport function warn(msg: string, ...args: unknown[]): void {\n console.warn(`[Essor warn]: ${msg}`, ...args);\n}\n\n/**\n * Outputs an info level log message\n * @param {string} msg - The info message\n * @param {...unknown } args - Additional arguments to log\n */\nexport function info(msg: string, ...args: unknown[]): void {\n // eslint-disable-next-line no-console\n console.info(`[Essor info]: ${msg}`, ...args);\n}\n\n/**\n * Outputs an error level log message\n * @param {string} msg - The error message\n * @param {...unknown } args - Additional arguments to log\n */\nexport function error(msg: string, ...args: unknown[]): void {\n console.error(`[Essor error]: ${msg}`, ...args);\n}\n","/**\n * Regular expression for matching HTML special characters\n * @type {RegExp}\n */\nconst escapeRE = /[\"&'<>]/;\n\n/**\n * Escapes HTML special characters in a string to their corresponding entity references\n * @param {unknown} string - The string to escapeHTML\n * @returns {string} - The escaped string\n */\nexport function escapeHTML(string: unknown): string {\n const str = `${string}`;\n const match = escapeRE.exec(str);\n\n if (!match) {\n return str;\n }\n\n let html = '';\n let escaped: string;\n let index: number;\n let lastIndex = 0;\n for (index = match.index; index < str.length; index++) {\n switch (str.charCodeAt(index)) {\n case 34: // \"\n escaped = '"';\n break;\n case 38: // &\n escaped = '&';\n break;\n case 39: // '\n escaped = ''';\n break;\n case 60: // <\n escaped = '<';\n break;\n case 62: // >\n escaped = '>';\n break;\n default:\n continue;\n }\n\n if (lastIndex !== index) {\n html += str.slice(lastIndex, index);\n }\n\n lastIndex = index + 1;\n html += escaped;\n }\n\n return lastIndex !== index ? html + str.slice(lastIndex, index) : html;\n}\n\n/**\n * Regular expression for stripping HTML comment markers\n * Reference: https://www.w3.org/TR/html52/syntax.html#comments\n * @type {RegExp}\n */\nconst commentStripRE = /^-?>|<!--|-->|--!>|<!-$/g;\n\n/**\n * Strips special characters from HTML comments\n * @param {string} src - The source string\n * @returns {string} - The cleaned string\n */\nexport function escapeHTMLComment(src: string): string {\n return src.replaceAll(commentStripRE, '');\n}\n\n/**\n * Regular expression for matching special characters in CSS variable names\n * @type {RegExp}\n */\nexport const cssVarNameEscapeSymbolsRE = /[ !\"#$%&'()*+,./:;<=>?@[\\\\\\]^`{|}~]/g;\n\n/**\n * Escapes special characters in CSS variable names\n * @param {string} key - The CSS variable name\n * @param {boolean} doubleEscape - Whether to apply double escaping\n * @returns {string} - The escaped CSS variable name\n */\nexport function getEscapedCssVarName(key: string, doubleEscape: boolean): string {\n return key.replaceAll(cssVarNameEscapeSymbolsRE, s =>\n doubleEscape ? (s === '\"' ? '\\\\\\\\\\\\\"' : `\\\\\\\\${s}`) : `\\\\${s}`,\n );\n}\n","/**\n * Make a map and return a function for checking if a key\n * is in that map.\n * IMPORTANT: all calls of this function must be prefixed with\n * \\/\\*#\\_\\_PURE\\_\\_\\*\\/\n * So that rollup can tree-shake them if necessary.\n */\n\n/*! #__NO_SIDE_EFFECTS__ */\n\nimport { hasOwn } from './base';\nimport { error } from './logger';\n\nexport function makeMap(str: string): (key: string) => boolean {\n const map = Object.create(null);\n for (const key of str.split(',')) {\n map[key] = 1;\n }\n return val => val in map;\n}\n\n/**\n * On the client we only need to offer special cases for boolean attributes that\n * have different names from their corresponding dom properties:\n * - itemscope -> N/A\n * - allowfullscreen -> allowFullscreen\n * - formnovalidate -> formNoValidate\n * - ismap -> isMap\n * - nomodule -> noModule\n * - novalidate -> noValidate\n * - readonly -> readOnly\n */\nconst specialBooleanAttrs =\n 'itemscope,allowfullscreen,formnovalidate,ismap,nomodule,novalidate,readonly';\nexport const isSpecialBooleanAttr: (key: string) => boolean =\n /*@__PURE__*/ makeMap(specialBooleanAttrs);\n\n/**\n * The full list is needed during SSR to produce the correct initial markup.\n */\nexport const isBooleanAttr: (key: string) => boolean = /*@__PURE__*/ makeMap(\n `${specialBooleanAttrs},async,autofocus,autoplay,controls,default,defer,disabled,hidden,inert,loop,open,required,reversed,scoped,seamless,checked,muted,multiple,selected`,\n);\n\n/**\n * Boolean attributes should be included if the value is truthy or ''.\n * e.g. `<select multiple>` compiles to `{ multiple: '' }`\n */\nexport function includeBooleanAttr(value: unknown): boolean {\n return !!value || value === '';\n}\n\nconst unsafeAttrCharRE = /[\\t\\n\\f \"'/=>]/;\nconst attrValidationCache: Record<string, boolean> = {};\n\nexport function isSSRSafeAttrName(name: string): boolean {\n if (hasOwn(attrValidationCache, name)) {\n return attrValidationCache[name];\n }\n const isUnsafe = unsafeAttrCharRE.test(name);\n if (isUnsafe) {\n if (__DEV__) {\n error(`unsafe attribute name: ${name}`);\n }\n }\n return (attrValidationCache[name] = !isUnsafe);\n}\n\nexport const propsToAttrMap: Record<string, string | undefined> = {\n acceptCharset: 'accept-charset',\n className: 'class',\n htmlFor: 'for',\n httpEquiv: 'http-equiv',\n};\n\n/**\n * Known attributes, this is used for stringification of runtime static nodes\n * so that we don't stringify bindings that cannot be set from HTML.\n * Don't also forget to allow `data-*` and `aria-*`!\n * Generated from https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes\n */\nexport const isKnownHtmlAttr: (key: string) => boolean = /*@__PURE__*/ makeMap(\n 'accept,accept-charset,accesskey,action,align,allow,alt,async,' +\n 'autocapitalize,autocomplete,autofocus,autoplay,background,bgcolor,' +\n 'border,buffered,capture,challenge,charset,checked,cite,class,code,' +\n 'codebase,color,cols,colspan,content,contenteditable,contextmenu,controls,' +\n 'coords,crossorigin,csp,data,datetime,decoding,default,defer,dir,dirname,' +\n 'disabled,download,draggable,dropzone,enctype,enterkeyhint,for,form,' +\n 'formaction,formenctype,formmethod,formnovalidate,formtarget,headers,' +\n 'height,hidden,high,href,hreflang,http-equiv,icon,id,importance,inert,integrity,' +\n 'ismap,itemprop,keytype,kind,label,lang,language,loading,list,loop,low,' +\n 'manifest,max,maxlength,minlength,media,min,multiple,muted,name,novalidate,' +\n 'open,optimum,pattern,ping,placeholder,poster,preload,radiogroup,readonly,' +\n 'referrerpolicy,rel,required,reversed,rows,rowspan,sandbox,scope,scoped,' +\n 'selected,shape,size,sizes,slot,span,spellcheck,src,srcdoc,srclang,srcset,' +\n 'start,step,style,summary,tabindex,target,title,translate,type,usemap,' +\n 'value,width,wrap',\n);\n\n/**\n * Generated from https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute\n */\nexport const isKnownSvgAttr: (key: string) => boolean = /*@__PURE__*/ makeMap(\n 'xmlns,accent-height,accumulate,additive,alignment-baseline,alphabetic,amplitude,' +\n 'arabic-form,ascent,attributeName,attributeType,azimuth,baseFrequency,' +\n 'baseline-shift,baseProfile,bbox,begin,bias,by,calcMode,cap-height,class,' +\n 'clip,clipPathUnits,clip-path,clip-rule,color,color-interpolation,' +\n 'color-interpolation-filters,color-profile,color-rendering,' +\n 'contentScriptType,contentStyleType,crossorigin,cursor,cx,cy,d,decelerate,' +\n 'descent,diffuseConstant,direction,display,divisor,dominant-baseline,dur,dx,' +\n 'dy,edgeMode,elevation,enable-background,end,exponent,fill,fill-opacity,' +\n 'fill-rule,filter,filterRes,filterUnits,flood-color,flood-opacity,' +\n 'font-family,font-size,font-size-adjust,font-stretch,font-style,' +\n 'font-variant,font-weight,format,from,fr,fx,fy,g1,g2,glyph-name,' +\n 'glyph-orientation-horizontal,glyph-orientation-vertical,glyphRef,' +\n 'gradientTransform,gradientUnits,hanging,height,href,hreflang,horiz-adv-x,' +\n 'horiz-origin-x,id,ideographic,image-rendering,in,in2,intercept,k,k1,k2,k3,' +\n 'k4,kernelMatrix,kernelUnitLength,kerning,keyPoints,keySplines,keyTimes,' +\n 'lang,lengthAdjust,letter-spacing,lighting-color,limitingConeAngle,local,' +\n 'marker-end,marker-mid,marker-start,markerHeight,markerUnits,markerWidth,' +\n 'mask,maskContentUnits,maskUnits,mathematical,max,media,method,min,mode,' +\n 'name,numOctaves,offset,opacity,operator,order,orient,orientation,origin,' +\n 'overflow,overline-position,overline-thickness,panose-1,paint-order,path,' +\n 'pathLength,patternContentUnits,patternTransform,patternUnits,ping,' +\n 'pointer-events,points,pointsAtX,pointsAtY,pointsAtZ,preserveAlpha,' +\n 'preserveAspectRatio,primitiveUnits,r,radius,referrerPolicy,refX,refY,rel,' +\n 'rendering-intent,repeatCount,repeatDur,requiredExtensions,requiredFeatures,' +\n 'restart,result,rotate,rx,ry,scale,seed,shape-rendering,slope,spacing,' +\n 'specularConstant,specularExponent,speed,spreadMethod,startOffset,' +\n 'stdDeviation,stemh,stemv,stitchTiles,stop-color,stop-opacity,' +\n 'strikethrough-position,strikethrough-thickness,string,stroke,' +\n 'stroke-dasharray,stroke-dashoffset,stroke-linecap,stroke-linejoin,' +\n 'stroke-miterlimit,stroke-opacity,stroke-width,style,surfaceScale,' +\n 'systemLanguage,tabindex,tableValues,target,targetX,targetY,text-anchor,' +\n 'text-decoration,text-rendering,textLength,to,transform,transform-origin,' +\n 'type,u1,u2,underline-position,underline-thickness,unicode,unicode-bidi,' +\n 'unicode-range,units-per-em,v-alphabetic,v-hanging,v-ideographic,' +\n 'v-mathematical,values,vector-effect,version,vert-adv-y,vert-origin-x,' +\n 'vert-origin-y,viewBox,viewTarget,visibility,width,widths,word-spacing,' +\n 'writing-mode,x,x-height,x1,x2,xChannelSelector,xlink:actuate,xlink:arcrole,' +\n 'xlink:href,xlink:role,xlink:show,xlink:title,xlink:type,xmlns:xlink,xml:base,xml:lang,' +\n 'xml:space,y,y1,y2,yChannelSelector,z,zoomAndPan',\n);\n\n/**\n * Shared between server-renderer and runtime-core hydration logic\n */\nexport function isRenderAbleAttrValue(value: unknown): boolean {\n if (value == null) {\n return false;\n }\n const type = typeof value;\n return type === 'string' || type === 'number' || type === 'boolean';\n}\n\n// https://developer.mozilla.org/en-US/docs/Web/HTML/Element\nconst HTML_TAGS =\n 'html,body,base,head,link,meta,style,title,address,article,aside,footer,' +\n 'header,hgroup,h1,h2,h3,h4,h5,h6,nav,section,div,dd,dl,dt,figcaption,' +\n 'figure,picture,hr,img,li,main,ol,p,pre,ul,a,b,abbr,bdi,bdo,br,cite,code,' +\n 'data,dfn,em,i,kbd,mark,q,rp,rt,ruby,s,samp,small,span,strong,sub,sup,' +\n 'time,u,var,wbr,area,audio,map,track,video,embed,object,param,source,' +\n 'canvas,script,noscript,del,ins,caption,col,colgroup,table,thead,tbody,td,' +\n 'th,tr,button,datalist,fieldset,form,input,label,legend,meter,optgroup,' +\n 'option,output,progress,select,textarea,details,dialog,menu,' +\n 'summary,template,blockquote,iframe,tfoot';\n\n// https://developer.mozilla.org/en-US/docs/Web/SVG/Element\nconst SVG_TAGS =\n 'svg,animate,animateMotion,animateTransform,circle,clipPath,color-profile,' +\n 'defs,desc,discard,ellipse,feBlend,feColorMatrix,feComponentTransfer,' +\n 'feComposite,feConvolveMatrix,feDiffuseLighting,feDisplacementMap,' +\n 'feDistantLight,feDropShadow,feFlood,feFuncA,feFuncB,feFuncG,feFuncR,' +\n 'feGaussianBlur,feImage,feMerge,feMergeNode,feMorphology,feOffset,' +\n 'fePointLight,feSpecularLighting,feSpotLight,feTile,feTurbulence,filter,' +\n 'foreignObject,g,hatch,hatchpath,image,line,linearGradient,marker,mask,' +\n 'mesh,meshgradient,meshpatch,meshrow,metadata,mpath,path,pattern,' +\n 'polygon,polyline,radialGradient,rect,set,solidcolor,stop,switch,symbol,' +\n 'text,textPath,title,tspan,unknown,use,view';\n\n// https://www.w3.org/TR/mathml4/ (content elements excluded)\nconst MATH_TAGS =\n 'annotation,annotation-xml,maction,maligngroup,malignmark,math,menclose,' +\n 'merror,mfenced,mfrac,mfraction,mglyph,mi,mlabeledtr,mlongdiv,' +\n 'mmultiscripts,mn,mo,mover,mpadded,mphantom,mprescripts,mroot,mrow,ms,' +\n 'mscarries,mscarry,msgroup,msline,mspace,msqrt,msrow,mstack,mstyle,msub,' +\n 'msubsup,msup,mtable,mtd,mtext,mtr,munder,munderover,none,semantics';\n\nconst DELEGATED_EVENTS =\n 'beforeinput,click,dblclick,contextmenu,focusin,focusout,input,keydown,' +\n 'keyup,mousedown,mousemove,mouseout,mouseover,mouseup,pointerdown,' +\n 'pointermove,pointerout,pointerover,pointerup,touchend,touchmove,touchstart';\n\nconst VOID_TAGS = 'area,base,br,col,embed,hr,img,input,link,meta,param,source,track,wbr';\n\nconst SELFCLOSING_TAGS = 'area,base,br,col,embed,hr,img,input,link,meta,param,source,track,wbr';\n\nexport const isHTMLTag: (key: string) => boolean = /*@__PURE__*/ makeMap(HTML_TAGS);\n\nexport const isSVGTag: (key: string) => boolean = /*@__PURE__*/ makeMap(SVG_TAGS);\n\nexport const isMathMLTag: (key: string) => boolean = /*@__PURE__*/ makeMap(MATH_TAGS);\n\nexport const isVoidTag: (key: string) => boolean = /*@__PURE__*/ makeMap(VOID_TAGS);\n\nexport const isSelfClosingTag: (key: string) => boolean = /*@__PURE__*/ makeMap(SELFCLOSING_TAGS);\n\nexport const isDelegatedEvent: (key: string) => boolean = /*@__PURE__*/ makeMap(DELEGATED_EVENTS);\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AA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ts","../src/base.ts","../src/string.ts","../src/logger.ts","../src/escape.ts","../src/dom.ts","../src/dom-types.ts","../src/normalize.ts"],"sourcesContent":["// Utility function exports\nexport {\n noop,\n extend,\n hasChanged,\n coerceArray,\n hasOwn,\n startsWith,\n isOn,\n generateUniqueId,\n isBrowser,\n cacheStringFunction,\n EMPTY_OBJ,\n EMPTY_ARR,\n getGlobalThis,\n} from './base';\n\nexport {\n isString,\n isObject,\n isArray,\n isMap,\n isSet,\n isWeakMap,\n isWeakSet,\n isFunction,\n isNil,\n isNull,\n isPromise,\n isSymbol,\n isFalsy,\n isPlainObject,\n isPrimitive,\n isHTMLElement,\n isStringNumber,\n isNumber,\n isUndefined,\n isBoolean,\n isNaN,\n type StringNumber,\n} from './is';\n\nexport { camelCase, kebabCase, capitalize } from './string';\n\nexport { warn, info, error } from './logger';\n\nexport { escapeHTML, escapeHTMLComment, getEscapedCssVarName } from './escape';\nexport { isHTMLTag, isSVGTag, isMathMLTag, isVoidTag, isSelfClosingTag } from './dom';\nexport {\n isRenderAbleAttrValue,\n isKnownSvgAttr,\n isKnownHtmlAttr,\n isSSRSafeAttrName,\n includeBooleanAttr,\n propsToAttrMap,\n isSpecialBooleanAttr,\n isDelegatedEvent,\n isBooleanAttr,\n} from './dom';\n\n// DOM type guards\nexport {\n isHtmlInputElement,\n isHtmlSelectElement,\n isHtmlTextAreaElement,\n isHtmlFormElement,\n isTextNode,\n isNode,\n} from './dom-types';\n\n// Normalization utilities\nexport {\n normalizeStyle,\n normalizeClassName,\n styleToString,\n parseStyleString,\n styleObjectToString,\n type NormalizedStyle,\n type StyleValue,\n type ClassValue,\n} from './normalize';\n","import { _toString } from './base';\n\n/**\n * Checks if a value is an object\n * @param {unknown} val - The value to check\n * @returns {boolean} - Returns true if the value is an object, false otherwise\n */\nexport const isObject = (val: unknown): val is Record<any, unknown> =>\n val !== null && typeof val === 'object';\n\n/**\n * Checks if a value is a Promise\n * @template T - The type of the Promise's resolved value\n * @param {unknown} val - The value to check\n * @returns {boolean} - Returns true if the value is a Promise, false otherwise\n */\nexport function isPromise<T = unknown>(val: unknown): val is Promise<T> {\n return _toString.call(val) === '[object Promise]';\n}\n\n/**\n * Checks if a value is an Array\n * @type {(arg: unknown ) => arg is unknown []}\n */\nexport const isArray = Array.isArray;\n\n/**\n * Checks if a value is a string\n * @param {unknown} val - The value to check\n * @returns {boolean} - Returns true if the value is a string, false otherwise\n */\nexport function isString(val: unknown): val is string {\n return typeof val === 'string';\n}\n\n/**\n * Checks if a value is a number\n * @param {unknown} val - The value to check\n * @returns {boolean} - Returns true if the value is a number, false otherwise\n */\nexport function isNumber(val: unknown): val is number {\n return typeof val === 'number';\n}\n/**\n * Checks if a value is null\n * @param {unknown} val - The value to check\n * @returns {boolean} - Returns true if the value is null, false otherwise\n */\nexport function isNull(val: unknown): val is null {\n return val === null;\n}\n\n/**\n * Checks if a value is a Symbol\n * @param {unknown} val - The value to check\n * @returns {boolean} - Returns true if the value is a Symbol, false otherwise\n */\nexport function isSymbol(val: unknown): val is symbol {\n return typeof val === 'symbol';\n}\n\n/**\n * Checks if a value is a Set\n * @param {unknown} val - The value to check\n * @returns {boolean} - Returns true if the value is a Set, false otherwise\n */\nexport function isSet(val: unknown): val is Set<unknown> {\n return _toString.call(val) === '[object Set]';\n}\n\n/**\n * Checks if a value is a WeakMap\n * @param {unknown} val - The value to check\n * @returns {boolean} - Returns true if the value is a WeakMap, false otherwise\n */\nexport function isWeakMap(val: unknown): val is WeakMap<any, unknown> {\n return _toString.call(val) === '[object WeakMap]';\n}\n\n/**\n * Checks if a value is a WeakSet\n * @param {unknown} val - The value to check\n * @returns {boolean} - Returns true if the value is a WeakSet, false otherwise\n */\nexport function isWeakSet(val: unknown): val is WeakSet<any> {\n return _toString.call(val) === '[object WeakSet]';\n}\n\n/**\n * Checks if a value is a Map\n * @param {unknown} val - The value to check\n * @returns {boolean} - Returns true if the value is a Map, false otherwise\n */\nexport function isMap(val: unknown): val is Map<unknown, unknown> {\n return _toString.call(val) === '[object Map]';\n}\n\n/**\n * Checks if a value is null or undefined\n * @param {unknown} val - The value to check\n * @returns {boolean} - Returns true if the value is null or undefined, false otherwise\n */\nexport function isNil(val: unknown): val is null | undefined {\n return val === null || val === undefined;\n}\n\n/**\n * Checks if a value is a function\n * @param {unknown} val - The value to check\n * @returns {boolean} - Returns true if the value is a function, false otherwise\n */\nexport const isFunction = (val: unknown): val is Function => typeof val === 'function';\n\n/**\n * Checks if a value is falsy (false, null, or undefined)\n * @param {unknown} val - The value to check\n * @returns {boolean} - Returns true if the value is falsy, false otherwise\n */\nexport function isFalsy(val: unknown): val is false | null | undefined {\n return val === false || val === null || val === undefined;\n}\n\n/**\n * Checks if a value is a primitive type (string, number, boolean, symbol, null, or undefined)\n * @param {unknown} val - The value to check\n * @returns {boolean} - Returns true if the value is a primitive type, false otherwise\n */\nexport const isPrimitive = (\n val: unknown,\n): val is string | number | boolean | symbol | null | undefined =>\n ['string', 'number', 'boolean', 'symbol', 'undefined'].includes(typeof val) || isNull(val);\n\n/**\n * Checks if a value is an HTMLElement\n * @param {unknown} val - The value to check\n * @returns {boolean} - Returns true if the value is an HTMLElement, false otherwise\n */\nexport function isHTMLElement(val: unknown): val is HTMLElement {\n return val instanceof HTMLElement;\n}\n\n/**\n * Checks if a value is a plain object (created using Object constructor)\n * @param {unknown} val - The value to check\n * @returns {boolean} - Returns true if the value is a plain object, false otherwise\n */\nexport const isPlainObject = (val: unknown): val is object =>\n _toString.call(val) === '[object Object]';\n\n/**\n * String representation of a number\n * @typedef {`${number}`} StringNumber\n */\nexport type StringNumber = `${number}`;\n\n/**\n * Checks if a value is a string representation of a number\n * @param {unknown} val - The value to check\n * @returns {boolean} - Returns true if the value is a string number, false otherwise\n */\nexport function isStringNumber(val: unknown): val is StringNumber {\n if (!isString(val) || val === '') {\n return false;\n }\n return !Number.isNaN(Number(val));\n}\n\n/**\n * Checks if a value is undefined\n * @param {unknown} val - The value to check\n * @returns {boolean} - Returns true if the value is undefined, false otherwise\n */\nexport function isUndefined(val: unknown): val is undefined {\n return typeof val === 'undefined';\n}\n\n/**\n * Checks if a value is a boolean\n * @param {unknown} val - The value to check\n * @returns {boolean} - Returns true if the value is a boolean, false otherwise\n */\nexport function isBoolean(val: unknown): val is boolean {\n return typeof val === 'boolean';\n}\n\nexport function isNaN(val: unknown): val is number {\n return Number.isNaN(val);\n}\n","import { isArray, isString } from './is';\n\n/**\n * Reference to Object.prototype.toString\n * @type {Function}\n */\nexport const _toString = Object.prototype.toString;\nconst hasOwnProperty = Object.prototype.hasOwnProperty;\n\n/**\n * Reference to Object.assign\n * @type {Function}\n */\nexport const extend = Object.assign;\n\n/**\n * Checks if an object has a specific property\n * @template T\n * @param {object} val - The target object to check\n * @param {string | symbol} key - The property name to check for\n * @returns {key is keyof T} - Returns true if the object has the property, false otherwise\n */\nexport const hasOwn = (val: object, key: string | symbol): key is keyof typeof val =>\n hasOwnProperty.call(val, key);\n/**\n * Forces a value to be an array\n * @template T - The type of array elements\n * @param {T | T[]} data - The data to convert, can be a single element or an array\n * @returns {T[]} - The resulting array\n */\nexport function coerceArray<T>(data: T | T[]): T[] {\n return isArray(data) ? data : [data];\n}\n\n/**\n * Checks if a value has changed\n * @param {unknown } value - The new value\n * @param {unknown } oldValue - The old value\n * @returns {boolean} - Returns true if the value has changed, false otherwise\n */\nexport const hasChanged = (value: unknown, oldValue: unknown): boolean =>\n !Object.is(value, oldValue);\n\n/**\n * Empty function, used for defaults and placeholders\n * @type {Function}\n */\nexport const noop = Function.prototype as () => void;\n\n/**\n * Checks if a string starts with a specified substring\n *\n * Uses indexOf for better performance in most cases\n * @see https://www.measurethat.net/Benchmarks/Show/12350/0/startswith-vs-test-vs-match-vs-indexof#latest_results_block\n * @param {string} str - The string to check\n * @param {string} searchString - The substring to search for\n * @returns {boolean} - Returns true if the string starts with the substring, false otherwise\n */\nexport function startsWith(str: string, searchString: string): boolean {\n if (!isString(str)) {\n return false;\n }\n return str.indexOf(searchString) === 0;\n}\n\n/**\n * Generates an 8-character random string as a unique identifier\n *\n * Note: Uses Math.random() which is not cryptographically secure.\n * For security-sensitive use cases, consider using crypto.getRandomValues()\n * @returns {string} - The generated unique identifier\n */\nexport function generateUniqueId(): string {\n const characters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';\n let result = '';\n const charactersLength = characters.length;\n for (let i = 0; i < 8; i++) {\n result += characters.charAt(Math.floor(Math.random() * charactersLength));\n }\n return result;\n}\n\n/**\n * Checks if the current environment is a browser\n * @returns {boolean} - Returns true if in a browser environment, false otherwise\n */\nexport function isBrowser(): boolean {\n return typeof window !== 'undefined' && typeof document !== 'undefined';\n}\n\n/**\n * Creates a cached version of a string processing function\n * @template T - The function type\n * @param {T} fn - The string processing function to cache\n * @returns {T} - The cached function\n */\nexport const cacheStringFunction = <T extends (str: string) => string>(fn: T): T => {\n const cache: Record<string, string> = Object.create(null);\n return ((str: string) => {\n const hit = cache[str];\n return hit || (cache[str] = fn(str));\n }) as T;\n};\n\n/**\n * Read-only empty object\n * @type {Readonly<Record<string, unknown >>}\n */\nexport const EMPTY_OBJ: { readonly [key: string]: unknown } = Object.freeze({});\n\n/**\n * Read-only empty array\n * @type {readonly never[]}\n */\nexport const EMPTY_ARR: readonly never[] = Object.freeze([]);\n\n/**\n * Checks if a property name is an event handler (starts with 'on' followed by uppercase letter)\n *\n * Matches patterns like: onClick, onChange, onKeyDown (but not 'onclick' or 'on123')\n * @param {string} key - The property name to check\n * @returns {boolean} - Returns true if the property is an event handler, false otherwise\n */\nexport const isOn = (key: string): boolean =>\n key.charCodeAt(0) === 111 /* o */ &&\n key.charCodeAt(1) === 110 /* n */ &&\n key.charCodeAt(2) >= 65 && // uppercase letter A-Z\n key.charCodeAt(2) <= 90;\n\ndeclare let global: {};\n\nlet _globalThis: unknown;\n/**\n * Gets the global object for the current environment\n * @returns {unknown } - The global object for the current environment\n */\nexport const getGlobalThis = (): unknown => {\n return (\n _globalThis ||\n (_globalThis =\n typeof globalThis !== 'undefined'\n ? globalThis\n : typeof self !== 'undefined'\n ? self\n : typeof window !== 'undefined'\n ? window\n : typeof global !== 'undefined'\n ? global\n : {})\n );\n};\n","import { cacheStringFunction } from './base';\n\n/**\n * Regular expression for converting camelCase to kebab-case\n * @type {RegExp}\n */\nconst hyphenateRE = /\\B([A-Z])/g;\n\n/**\n * Converts a camelCase string to kebab-case\n * Example: myFunction -> my-function\n * @param {string} str - The camelCase string to convert\n * @returns {string} - The kebab-case string\n */\nexport const kebabCase: (str: string) => string = cacheStringFunction((str: string) =>\n str.replaceAll(hyphenateRE, '-$1').toLowerCase(),\n);\n\n/**\n * Regular expression for converting kebab-case or snake_case to camelCase\n * @type {RegExp}\n */\nconst camelizeRE = /[_-](\\w)/g;\n\n/**\n * Converts a kebab-case or snake_case string to camelCase\n * Example: my-function or my_function -> myFunction\n * @param {string} str - The kebab-case or snake_case string to convert\n * @returns {string} - The camelCase string\n */\nexport const camelCase: (str: string) => string = cacheStringFunction((str: string): string => {\n // Remove leading and trailing hyphens or underscores\n str = str.replaceAll(/^[_-]+|[_-]+$/g, '');\n // Replace consecutive hyphens or underscores with a single hyphen\n str = str.replaceAll(/[_-]+/g, '-');\n // Convert to camelCase\n return str.replaceAll(camelizeRE, (_, c) => c.toUpperCase());\n});\n\n/**\n * Capitalizes the first letter of a string\n * Example: hello -> Hello\n * @template T - The input string type\n * @param {T} str - The string to capitalize\n * @returns {Capitalize<T>} - The capitalized string\n */\nexport const capitalize: <T extends string>(str: T) => Capitalize<T> = cacheStringFunction(\n <T extends string>(str: T) => {\n return (str.charAt(0).toUpperCase() + str.slice(1)) as Capitalize<T>;\n },\n);\n","/**\n * Outputs a warning level log message\n * @param {string} msg - The warning message\n * @param {...unknown } args - Additional arguments to log\n */\nexport function warn(msg: string, ...args: unknown[]): void {\n console.warn(`[Essor warn]: ${msg}`, ...args);\n}\n\n/**\n * Outputs an info level log message\n * @param {string} msg - The info message\n * @param {...unknown } args - Additional arguments to log\n */\nexport function info(msg: string, ...args: unknown[]): void {\n // eslint-disable-next-line no-console\n console.info(`[Essor info]: ${msg}`, ...args);\n}\n\n/**\n * Outputs an error level log message\n * @param {string} msg - The error message\n * @param {...unknown } args - Additional arguments to log\n */\nexport function error(msg: string, ...args: unknown[]): void {\n console.error(`[Essor error]: ${msg}`, ...args);\n}\n","/**\n * Regular expression for matching HTML special characters\n * @type {RegExp}\n */\nconst escapeRE = /[\"&'<>]/;\n\n/**\n * Escapes HTML special characters in a string to their corresponding entity references\n * @param {unknown} string - The string to escapeHTML\n * @returns {string} - The escaped string\n */\nexport function escapeHTML(string: unknown): string {\n const str = `${string}`;\n const match = escapeRE.exec(str);\n\n if (!match) {\n return str;\n }\n\n let html = '';\n let escaped: string;\n let index: number;\n let lastIndex = 0;\n for (index = match.index; index < str.length; index++) {\n switch (str.charCodeAt(index)) {\n case 34: // \"\n escaped = '"';\n break;\n case 38: // &\n escaped = '&';\n break;\n case 39: // '\n escaped = ''';\n break;\n case 60: // <\n escaped = '<';\n break;\n case 62: // >\n escaped = '>';\n break;\n default:\n continue;\n }\n\n if (lastIndex !== index) {\n html += str.slice(lastIndex, index);\n }\n\n lastIndex = index + 1;\n html += escaped;\n }\n\n return lastIndex !== index ? html + str.slice(lastIndex, index) : html;\n}\n\n/**\n * Regular expression for stripping HTML comment markers\n * Reference: https://www.w3.org/TR/html52/syntax.html#comments\n * @type {RegExp}\n */\nconst commentStripRE = /^-?>|<!--|-->|--!>|<!-$/g;\n\n/**\n * Strips special characters from HTML comments\n * @param {string} src - The source string\n * @returns {string} - The cleaned string\n */\nexport function escapeHTMLComment(src: string): string {\n return src.replaceAll(commentStripRE, '');\n}\n\n/**\n * Regular expression for matching special characters in CSS variable names\n * @type {RegExp}\n */\nexport const cssVarNameEscapeSymbolsRE = /[ !\"#$%&'()*+,./:;<=>?@[\\\\\\]^`{|}~]/g;\n\n/**\n * Escapes special characters in CSS variable names\n * @param {string} key - The CSS variable name\n * @param {boolean} doubleEscape - Whether to apply double escaping\n * @returns {string} - The escaped CSS variable name\n */\nexport function getEscapedCssVarName(key: string, doubleEscape: boolean): string {\n return key.replaceAll(cssVarNameEscapeSymbolsRE, s =>\n doubleEscape ? (s === '\"' ? '\\\\\\\\\\\\\"' : `\\\\\\\\${s}`) : `\\\\${s}`,\n );\n}\n","/**\n * Make a map and return a function for checking if a key\n * is in that map.\n * IMPORTANT: all calls of this function must be prefixed with\n * \\/\\*#\\_\\_PURE\\_\\_\\*\\/\n * So that rollup can tree-shake them if necessary.\n */\n\n/*! #__NO_SIDE_EFFECTS__ */\n\nimport { hasOwn } from './base';\nimport { error } from './logger';\n\nexport function makeMap(str: string): (key: string) => boolean {\n const map = Object.create(null);\n for (const key of str.split(',')) {\n map[key] = 1;\n }\n return val => val in map;\n}\n\n/**\n * On the client we only need to offer special cases for boolean attributes that\n * have different names from their corresponding dom properties:\n * - itemscope -> N/A\n * - allowfullscreen -> allowFullscreen\n * - formnovalidate -> formNoValidate\n * - ismap -> isMap\n * - nomodule -> noModule\n * - novalidate -> noValidate\n * - readonly -> readOnly\n */\nconst specialBooleanAttrs =\n 'itemscope,allowfullscreen,formnovalidate,ismap,nomodule,novalidate,readonly';\nexport const isSpecialBooleanAttr: (key: string) => boolean =\n /*@__PURE__*/ makeMap(specialBooleanAttrs);\n\n/**\n * The full list is needed during SSR to produce the correct initial markup.\n */\nexport const isBooleanAttr: (key: string) => boolean = /*@__PURE__*/ makeMap(\n `${specialBooleanAttrs},async,autofocus,autoplay,controls,default,defer,disabled,hidden,inert,loop,open,required,reversed,scoped,seamless,checked,muted,multiple,selected`,\n);\n\n/**\n * Boolean attributes should be included if the value is truthy or ''.\n * e.g. `<select multiple>` compiles to `{ multiple: '' }`\n */\nexport function includeBooleanAttr(value: unknown): boolean {\n return !!value || value === '';\n}\n\nconst unsafeAttrCharRE = /[\\t\\n\\f \"'/=>]/;\nconst attrValidationCache: Record<string, boolean> = {};\n\nexport function isSSRSafeAttrName(name: string): boolean {\n if (hasOwn(attrValidationCache, name)) {\n return attrValidationCache[name];\n }\n const isUnsafe = unsafeAttrCharRE.test(name);\n if (isUnsafe) {\n if (__DEV__) {\n error(`unsafe attribute name: ${name}`);\n }\n }\n return (attrValidationCache[name] = !isUnsafe);\n}\n\nexport const propsToAttrMap: Record<string, string | undefined> = {\n acceptCharset: 'accept-charset',\n className: 'class',\n htmlFor: 'for',\n httpEquiv: 'http-equiv',\n};\n\n/**\n * Known attributes, this is used for stringification of runtime static nodes\n * so that we don't stringify bindings that cannot be set from HTML.\n * Don't also forget to allow `data-*` and `aria-*`!\n * Generated from https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes\n */\nexport const isKnownHtmlAttr: (key: string) => boolean = /*@__PURE__*/ makeMap(\n 'accept,accept-charset,accesskey,action,align,allow,alt,async,' +\n 'autocapitalize,autocomplete,autofocus,autoplay,background,bgcolor,' +\n 'border,buffered,capture,challenge,charset,checked,cite,class,code,' +\n 'codebase,color,cols,colspan,content,contenteditable,contextmenu,controls,' +\n 'coords,crossorigin,csp,data,datetime,decoding,default,defer,dir,dirname,' +\n 'disabled,download,draggable,dropzone,enctype,enterkeyhint,for,form,' +\n 'formaction,formenctype,formmethod,formnovalidate,formtarget,headers,' +\n 'height,hidden,high,href,hreflang,http-equiv,icon,id,importance,inert,integrity,' +\n 'ismap,itemprop,keytype,kind,label,lang,language,loading,list,loop,low,' +\n 'manifest,max,maxlength,minlength,media,min,multiple,muted,name,novalidate,' +\n 'open,optimum,pattern,ping,placeholder,poster,preload,radiogroup,readonly,' +\n 'referrerpolicy,rel,required,reversed,rows,rowspan,sandbox,scope,scoped,' +\n 'selected,shape,size,sizes,slot,span,spellcheck,src,srcdoc,srclang,srcset,' +\n 'start,step,style,summary,tabindex,target,title,translate,type,usemap,' +\n 'value,width,wrap',\n);\n\n/**\n * Generated from https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute\n */\nexport const isKnownSvgAttr: (key: string) => boolean = /*@__PURE__*/ makeMap(\n 'xmlns,accent-height,accumulate,additive,alignment-baseline,alphabetic,amplitude,' +\n 'arabic-form,ascent,attributeName,attributeType,azimuth,baseFrequency,' +\n 'baseline-shift,baseProfile,bbox,begin,bias,by,calcMode,cap-height,class,' +\n 'clip,clipPathUnits,clip-path,clip-rule,color,color-interpolation,' +\n 'color-interpolation-filters,color-profile,color-rendering,' +\n 'contentScriptType,contentStyleType,crossorigin,cursor,cx,cy,d,decelerate,' +\n 'descent,diffuseConstant,direction,display,divisor,dominant-baseline,dur,dx,' +\n 'dy,edgeMode,elevation,enable-background,end,exponent,fill,fill-opacity,' +\n 'fill-rule,filter,filterRes,filterUnits,flood-color,flood-opacity,' +\n 'font-family,font-size,font-size-adjust,font-stretch,font-style,' +\n 'font-variant,font-weight,format,from,fr,fx,fy,g1,g2,glyph-name,' +\n 'glyph-orientation-horizontal,glyph-orientation-vertical,glyphRef,' +\n 'gradientTransform,gradientUnits,hanging,height,href,hreflang,horiz-adv-x,' +\n 'horiz-origin-x,id,ideographic,image-rendering,in,in2,intercept,k,k1,k2,k3,' +\n 'k4,kernelMatrix,kernelUnitLength,kerning,keyPoints,keySplines,keyTimes,' +\n 'lang,lengthAdjust,letter-spacing,lighting-color,limitingConeAngle,local,' +\n 'marker-end,marker-mid,marker-start,markerHeight,markerUnits,markerWidth,' +\n 'mask,maskContentUnits,maskUnits,mathematical,max,media,method,min,mode,' +\n 'name,numOctaves,offset,opacity,operator,order,orient,orientation,origin,' +\n 'overflow,overline-position,overline-thickness,panose-1,paint-order,path,' +\n 'pathLength,patternContentUnits,patternTransform,patternUnits,ping,' +\n 'pointer-events,points,pointsAtX,pointsAtY,pointsAtZ,preserveAlpha,' +\n 'preserveAspectRatio,primitiveUnits,r,radius,referrerPolicy,refX,refY,rel,' +\n 'rendering-intent,repeatCount,repeatDur,requiredExtensions,requiredFeatures,' +\n 'restart,result,rotate,rx,ry,scale,seed,shape-rendering,slope,spacing,' +\n 'specularConstant,specularExponent,speed,spreadMethod,startOffset,' +\n 'stdDeviation,stemh,stemv,stitchTiles,stop-color,stop-opacity,' +\n 'strikethrough-position,strikethrough-thickness,string,stroke,' +\n 'stroke-dasharray,stroke-dashoffset,stroke-linecap,stroke-linejoin,' +\n 'stroke-miterlimit,stroke-opacity,stroke-width,style,surfaceScale,' +\n 'systemLanguage,tabindex,tableValues,target,targetX,targetY,text-anchor,' +\n 'text-decoration,text-rendering,textLength,to,transform,transform-origin,' +\n 'type,u1,u2,underline-position,underline-thickness,unicode,unicode-bidi,' +\n 'unicode-range,units-per-em,v-alphabetic,v-hanging,v-ideographic,' +\n 'v-mathematical,values,vector-effect,version,vert-adv-y,vert-origin-x,' +\n 'vert-origin-y,viewBox,viewTarget,visibility,width,widths,word-spacing,' +\n 'writing-mode,x,x-height,x1,x2,xChannelSelector,xlink:actuate,xlink:arcrole,' +\n 'xlink:href,xlink:role,xlink:show,xlink:title,xlink:type,xmlns:xlink,xml:base,xml:lang,' +\n 'xml:space,y,y1,y2,yChannelSelector,z,zoomAndPan',\n);\n\n/**\n * Shared between server-renderer and runtime-core hydration logic\n */\nexport function isRenderAbleAttrValue(value: unknown): boolean {\n if (value == null) {\n return false;\n }\n const type = typeof value;\n return type === 'string' || type === 'number' || type === 'boolean';\n}\n\n// https://developer.mozilla.org/en-US/docs/Web/HTML/Element\nconst HTML_TAGS =\n 'html,body,base,head,link,meta,style,title,address,article,aside,footer,' +\n 'header,hgroup,h1,h2,h3,h4,h5,h6,nav,section,div,dd,dl,dt,figcaption,' +\n 'figure,picture,hr,img,li,main,ol,p,pre,ul,a,b,abbr,bdi,bdo,br,cite,code,' +\n 'data,dfn,em,i,kbd,mark,q,rp,rt,ruby,s,samp,small,span,strong,sub,sup,' +\n 'time,u,var,wbr,area,audio,map,track,video,embed,object,param,source,' +\n 'canvas,script,noscript,del,ins,caption,col,colgroup,table,thead,tbody,td,' +\n 'th,tr,button,datalist,fieldset,form,input,label,legend,meter,optgroup,' +\n 'option,output,progress,select,textarea,details,dialog,menu,' +\n 'summary,template,blockquote,iframe,tfoot';\n\n// https://developer.mozilla.org/en-US/docs/Web/SVG/Element\nconst SVG_TAGS =\n 'svg,animate,animateMotion,animateTransform,circle,clipPath,color-profile,' +\n 'defs,desc,discard,ellipse,feBlend,feColorMatrix,feComponentTransfer,' +\n 'feComposite,feConvolveMatrix,feDiffuseLighting,feDisplacementMap,' +\n 'feDistantLight,feDropShadow,feFlood,feFuncA,feFuncB,feFuncG,feFuncR,' +\n 'feGaussianBlur,feImage,feMerge,feMergeNode,feMorphology,feOffset,' +\n 'fePointLight,feSpecularLighting,feSpotLight,feTile,feTurbulence,filter,' +\n 'foreignObject,g,hatch,hatchpath,image,line,linearGradient,marker,mask,' +\n 'mesh,meshgradient,meshpatch,meshrow,metadata,mpath,path,pattern,' +\n 'polygon,polyline,radialGradient,rect,set,solidcolor,stop,switch,symbol,' +\n 'text,textPath,title,tspan,unknown,use,view';\n\n// https://www.w3.org/TR/mathml4/ (content elements excluded)\nconst MATH_TAGS =\n 'annotation,annotation-xml,maction,maligngroup,malignmark,math,menclose,' +\n 'merror,mfenced,mfrac,mfraction,mglyph,mi,mlabeledtr,mlongdiv,' +\n 'mmultiscripts,mn,mo,mover,mpadded,mphantom,mprescripts,mroot,mrow,ms,' +\n 'mscarries,mscarry,msgroup,msline,mspace,msqrt,msrow,mstack,mstyle,msub,' +\n 'msubsup,msup,mtable,mtd,mtext,mtr,munder,munderover,none,semantics';\n\nconst DELEGATED_EVENTS =\n 'beforeinput,click,dblclick,contextmenu,focusin,focusout,input,keydown,' +\n 'keyup,mousedown,mousemove,mouseout,mouseover,mouseup,pointerdown,' +\n 'pointermove,pointerout,pointerover,pointerup,touchend,touchmove,touchstart';\n\nconst VOID_TAGS = 'area,base,br,col,embed,hr,img,input,link,meta,param,source,track,wbr';\n\nconst SELFCLOSING_TAGS = 'area,base,br,col,embed,hr,img,input,link,meta,param,source,track,wbr';\n\nexport const isHTMLTag: (key: string) => boolean = /*@__PURE__*/ makeMap(HTML_TAGS);\n\nexport const isSVGTag: (key: string) => boolean = /*@__PURE__*/ makeMap(SVG_TAGS);\n\nexport const isMathMLTag: (key: string) => boolean = /*@__PURE__*/ makeMap(MATH_TAGS);\n\nexport const isVoidTag: (key: string) => boolean = /*@__PURE__*/ makeMap(VOID_TAGS);\n\nexport const isSelfClosingTag: (key: string) => boolean = /*@__PURE__*/ makeMap(SELFCLOSING_TAGS);\n\nexport const isDelegatedEvent: (key: string) => boolean = /*@__PURE__*/ makeMap(DELEGATED_EVENTS);\n","/**\n * Checks if a value is an HTMLInputElement\n * @param val - The value to check\n * @returns true if the value is an HTMLInputElement\n */\nexport function isHtmlInputElement(val: unknown): val is HTMLInputElement {\n return typeof HTMLInputElement !== 'undefined' && val instanceof HTMLInputElement;\n}\n\n/**\n * Checks if a value is an HTMLSelectElement\n * @param val - The value to check\n * @returns true if the value is an HTMLSelectElement\n */\nexport function isHtmlSelectElement(val: unknown): val is HTMLSelectElement {\n return typeof HTMLSelectElement !== 'undefined' && val instanceof HTMLSelectElement;\n}\n\n/**\n * Checks if a value is an HTMLTextAreaElement\n * @param val - The value to check\n * @returns true if the value is an HTMLTextAreaElement\n */\nexport function isHtmlTextAreaElement(val: unknown): val is HTMLTextAreaElement {\n return typeof HTMLTextAreaElement !== 'undefined' && val instanceof HTMLTextAreaElement;\n}\n\n/**\n * Checks if a value is an HTMLFormElement\n * @param val - The value to check\n * @returns true if the value is an HTMLFormElement\n */\nexport function isHtmlFormElement(val: unknown): val is HTMLFormElement {\n return typeof HTMLFormElement !== 'undefined' && val instanceof HTMLFormElement;\n}\n\n/**\n * Checks if a value is a Text node\n * @param val - The value to check\n * @returns true if the value is a Text node\n */\nexport function isTextNode(val: unknown): val is Text {\n return typeof Text !== 'undefined' && val instanceof Text;\n}\n\n/**\n * Checks if a value is a Node\n * @param val - The value to check\n * @returns true if the value is a Node\n */\nexport function isNode(val: unknown): val is Node {\n return typeof Node !== 'undefined' && val instanceof Node;\n}\n","/**\n * Normalization utilities for class names and styles\n * Shared between template (client) and server packages\n */\n\nimport { isArray, isNumber, isObject, isString } from './is';\nimport { kebabCase } from './string';\n\n/**\n * Normalized style object type\n */\nexport type NormalizedStyle = Record<string, string | number>;\n\n/**\n * Style value type that can be normalized\n */\nexport type StyleValue = string | NormalizedStyle | StyleValue[] | null | undefined;\n\n/**\n * Class value type that can be normalized\n */\nexport type ClassValue = string | Record<string, boolean> | ClassValue[] | null | undefined;\n\n// Style parsing related regular expressions\n/** Semicolon separator regex, excludes semicolons within parentheses */\nconst STYLE_SEPARATOR_REGEX = /;(?![^(]*\\))/g;\n/** Property value separator regex */\nconst PROPERTY_VALUE_SEPARATOR_REGEX = /:([\\s\\S]+)/;\n/** Style comment regex */\nconst STYLE_COMMENT_REGEX = /\\/\\*[\\s\\S]*?\\*\\//g;\n\n/**\n * Parse CSS style string into object format\n *\n * @param cssText - CSS style string\n * @returns Normalized style object\n */\nexport function parseStyleString(cssText: string): NormalizedStyle {\n const styleObject: NormalizedStyle = {};\n\n cssText\n .replaceAll(STYLE_COMMENT_REGEX, '')\n .split(STYLE_SEPARATOR_REGEX)\n .forEach(styleItem => {\n if (styleItem) {\n const parts = styleItem.split(PROPERTY_VALUE_SEPARATOR_REGEX);\n if (parts.length > 1) {\n styleObject[parts[0].trim()] = parts[1].trim();\n }\n }\n });\n\n return styleObject;\n}\n\n/**\n * Normalize style value to a unified format\n *\n * @param styleValue - Original style value (object, string, or array)\n * @returns Normalized style object or string\n */\nexport function normalizeStyle(styleValue: unknown): NormalizedStyle | string | undefined {\n // Handle array format styles\n if (isArray(styleValue)) {\n const normalizedStyleObject: NormalizedStyle = {};\n\n for (const styleItem of styleValue) {\n const normalizedItem = isString(styleItem)\n ? parseStyleString(styleItem)\n : (normalizeStyle(styleItem) as NormalizedStyle);\n\n if (normalizedItem) {\n for (const key in normalizedItem) {\n normalizedStyleObject[key] = normalizedItem[key];\n }\n }\n }\n\n return normalizedStyleObject;\n }\n\n // Handle string or object format styles\n if (isString(styleValue) || isObject(styleValue)) {\n return styleValue as NormalizedStyle | string;\n }\n\n return undefined;\n}\n\n/**\n * Convert style object to CSS string\n *\n * @param styleValue - Style object or string\n * @returns Formatted CSS string\n */\nexport function styleToString(styleValue: NormalizedStyle | string | undefined): string {\n if (!styleValue) {\n return '';\n }\n\n if (isString(styleValue)) {\n return styleValue;\n }\n\n let cssText = '';\n for (const propName in styleValue) {\n const propValue = styleValue[propName];\n\n if (isString(propValue) || isNumber(propValue)) {\n // Keep CSS variables as is, convert other properties to kebab-case\n const normalizedPropName = propName.startsWith('--') ? propName : kebabCase(propName);\n cssText += `${normalizedPropName}:${propValue};`;\n }\n }\n\n return cssText;\n}\n\n/**\n * Normalize class value to a unified string format\n *\n * @param classValue - Original class value (string, array, or object)\n * @returns Normalized class name string\n */\nexport function normalizeClassName(classValue: unknown): string {\n if (classValue == null) {\n return '';\n }\n\n if (isString(classValue)) {\n return classValue.trim();\n }\n\n // Handle arrays\n if (isArray(classValue)) {\n return classValue.map(normalizeClassName).filter(Boolean).join(' ');\n }\n\n // Handle objects (conditional classes)\n if (isObject(classValue)) {\n let count = 0;\n for (const key in classValue) {\n if (classValue[key]) count++;\n }\n\n if (count === 0) return '';\n\n const result: string[] = new Array(count);\n let index = 0;\n\n for (const key in classValue) {\n if (classValue[key]) {\n result[index++] = key;\n }\n }\n\n return result.join(' ');\n }\n\n return String(classValue).trim();\n}\n/**\n * Convert style object to CSS string\n *\n * Handle different types of style values, and apply CSS variable and kebab-case transformations\n *\n * @param styleValue Style object or string\n * @returns Formatted CSS string\n */\nexport function styleObjectToString(styleValue: NormalizedStyle | string | undefined): string {\n // Check for empty values\n if (!styleValue) {\n return '';\n }\n\n // Return string values directly\n if (isString(styleValue)) {\n return styleValue;\n }\n\n // Convert object to string\n let cssText = '';\n for (const propName in styleValue) {\n const propValue = styleValue[propName];\n\n // Only process valid string or number values\n if (isString(propValue) || isNumber(propValue)) {\n // Keep CSS variables as is, convert other properties to kebab-case\n const normalizedPropName = propName.startsWith('--') ? propName : kebab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C,YAAY;AACf,WAAO;AAAA,EACT;AAGA,MAAI,SAAS,UAAU,GAAG;AACxB,WAAO;AAAA,EACT;AAGA,MAAI,UAAU;AACd,aAAW,YAAY,YAAY;AACjC,UAAM,YAAY,WAAW,QAAQ;AAGrC,QAAI,SAAS,SAAS,KAAK,SAAS,SAAS,GAAG;AAE9C,YAAM,qBAAqB,SAAS,WAAW,IAAI,IAAI,WAAW,UAAU,QAAQ;AACpF,iBAAW,GAAG,kBAAkB,IAAI,SAAS;AAAA,IAC/C;AAAA,EACF;AAEA,SAAO;AACT;","names":[]}
|
package/dist/shared.dev.esm.js
CHANGED
|
@@ -99,12 +99,6 @@ var _globalThis;
|
|
|
99
99
|
var getGlobalThis = () => {
|
|
100
100
|
return _globalThis || (_globalThis = typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : {});
|
|
101
101
|
};
|
|
102
|
-
function isExclude(key, exclude) {
|
|
103
|
-
if (!exclude) {
|
|
104
|
-
return false;
|
|
105
|
-
}
|
|
106
|
-
return isArray(exclude) ? exclude.includes(key) : isFunction(exclude) ? exclude(key) : false;
|
|
107
|
-
}
|
|
108
102
|
|
|
109
103
|
// src/string.ts
|
|
110
104
|
var hyphenateRE = /\B([A-Z])/g;
|
|
@@ -247,6 +241,122 @@ var isMathMLTag = /* @__PURE__ */ makeMap(MATH_TAGS);
|
|
|
247
241
|
var isVoidTag = /* @__PURE__ */ makeMap(VOID_TAGS);
|
|
248
242
|
var isSelfClosingTag = /* @__PURE__ */ makeMap(SELFCLOSING_TAGS);
|
|
249
243
|
var isDelegatedEvent = /* @__PURE__ */ makeMap(DELEGATED_EVENTS);
|
|
244
|
+
|
|
245
|
+
// src/dom-types.ts
|
|
246
|
+
function isHtmlInputElement(val) {
|
|
247
|
+
return typeof HTMLInputElement !== "undefined" && val instanceof HTMLInputElement;
|
|
248
|
+
}
|
|
249
|
+
function isHtmlSelectElement(val) {
|
|
250
|
+
return typeof HTMLSelectElement !== "undefined" && val instanceof HTMLSelectElement;
|
|
251
|
+
}
|
|
252
|
+
function isHtmlTextAreaElement(val) {
|
|
253
|
+
return typeof HTMLTextAreaElement !== "undefined" && val instanceof HTMLTextAreaElement;
|
|
254
|
+
}
|
|
255
|
+
function isHtmlFormElement(val) {
|
|
256
|
+
return typeof HTMLFormElement !== "undefined" && val instanceof HTMLFormElement;
|
|
257
|
+
}
|
|
258
|
+
function isTextNode(val) {
|
|
259
|
+
return typeof Text !== "undefined" && val instanceof Text;
|
|
260
|
+
}
|
|
261
|
+
function isNode(val) {
|
|
262
|
+
return typeof Node !== "undefined" && val instanceof Node;
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
// src/normalize.ts
|
|
266
|
+
var STYLE_SEPARATOR_REGEX = /;(?![^(]*\))/g;
|
|
267
|
+
var PROPERTY_VALUE_SEPARATOR_REGEX = /:([\s\S]+)/;
|
|
268
|
+
var STYLE_COMMENT_REGEX = /\/\*[\s\S]*?\*\//g;
|
|
269
|
+
function parseStyleString(cssText) {
|
|
270
|
+
const styleObject = {};
|
|
271
|
+
cssText.replaceAll(STYLE_COMMENT_REGEX, "").split(STYLE_SEPARATOR_REGEX).forEach((styleItem) => {
|
|
272
|
+
if (styleItem) {
|
|
273
|
+
const parts = styleItem.split(PROPERTY_VALUE_SEPARATOR_REGEX);
|
|
274
|
+
if (parts.length > 1) {
|
|
275
|
+
styleObject[parts[0].trim()] = parts[1].trim();
|
|
276
|
+
}
|
|
277
|
+
}
|
|
278
|
+
});
|
|
279
|
+
return styleObject;
|
|
280
|
+
}
|
|
281
|
+
function normalizeStyle(styleValue) {
|
|
282
|
+
if (isArray(styleValue)) {
|
|
283
|
+
const normalizedStyleObject = {};
|
|
284
|
+
for (const styleItem of styleValue) {
|
|
285
|
+
const normalizedItem = isString(styleItem) ? parseStyleString(styleItem) : normalizeStyle(styleItem);
|
|
286
|
+
if (normalizedItem) {
|
|
287
|
+
for (const key in normalizedItem) {
|
|
288
|
+
normalizedStyleObject[key] = normalizedItem[key];
|
|
289
|
+
}
|
|
290
|
+
}
|
|
291
|
+
}
|
|
292
|
+
return normalizedStyleObject;
|
|
293
|
+
}
|
|
294
|
+
if (isString(styleValue) || isObject(styleValue)) {
|
|
295
|
+
return styleValue;
|
|
296
|
+
}
|
|
297
|
+
return void 0;
|
|
298
|
+
}
|
|
299
|
+
function styleToString(styleValue) {
|
|
300
|
+
if (!styleValue) {
|
|
301
|
+
return "";
|
|
302
|
+
}
|
|
303
|
+
if (isString(styleValue)) {
|
|
304
|
+
return styleValue;
|
|
305
|
+
}
|
|
306
|
+
let cssText = "";
|
|
307
|
+
for (const propName in styleValue) {
|
|
308
|
+
const propValue = styleValue[propName];
|
|
309
|
+
if (isString(propValue) || isNumber(propValue)) {
|
|
310
|
+
const normalizedPropName = propName.startsWith("--") ? propName : kebabCase(propName);
|
|
311
|
+
cssText += `${normalizedPropName}:${propValue};`;
|
|
312
|
+
}
|
|
313
|
+
}
|
|
314
|
+
return cssText;
|
|
315
|
+
}
|
|
316
|
+
function normalizeClassName(classValue) {
|
|
317
|
+
if (classValue == null) {
|
|
318
|
+
return "";
|
|
319
|
+
}
|
|
320
|
+
if (isString(classValue)) {
|
|
321
|
+
return classValue.trim();
|
|
322
|
+
}
|
|
323
|
+
if (isArray(classValue)) {
|
|
324
|
+
return classValue.map(normalizeClassName).filter(Boolean).join(" ");
|
|
325
|
+
}
|
|
326
|
+
if (isObject(classValue)) {
|
|
327
|
+
let count = 0;
|
|
328
|
+
for (const key in classValue) {
|
|
329
|
+
if (classValue[key]) count++;
|
|
330
|
+
}
|
|
331
|
+
if (count === 0) return "";
|
|
332
|
+
const result = new Array(count);
|
|
333
|
+
let index = 0;
|
|
334
|
+
for (const key in classValue) {
|
|
335
|
+
if (classValue[key]) {
|
|
336
|
+
result[index++] = key;
|
|
337
|
+
}
|
|
338
|
+
}
|
|
339
|
+
return result.join(" ");
|
|
340
|
+
}
|
|
341
|
+
return String(classValue).trim();
|
|
342
|
+
}
|
|
343
|
+
function styleObjectToString(styleValue) {
|
|
344
|
+
if (!styleValue) {
|
|
345
|
+
return "";
|
|
346
|
+
}
|
|
347
|
+
if (isString(styleValue)) {
|
|
348
|
+
return styleValue;
|
|
349
|
+
}
|
|
350
|
+
let cssText = "";
|
|
351
|
+
for (const propName in styleValue) {
|
|
352
|
+
const propValue = styleValue[propName];
|
|
353
|
+
if (isString(propValue) || isNumber(propValue)) {
|
|
354
|
+
const normalizedPropName = propName.startsWith("--") ? propName : kebabCase(propName);
|
|
355
|
+
cssText += `${normalizedPropName}:${propValue};`;
|
|
356
|
+
}
|
|
357
|
+
}
|
|
358
|
+
return cssText;
|
|
359
|
+
}
|
|
250
360
|
export {
|
|
251
361
|
EMPTY_ARR,
|
|
252
362
|
EMPTY_OBJ,
|
|
@@ -270,17 +380,21 @@ export {
|
|
|
270
380
|
isBooleanAttr,
|
|
271
381
|
isBrowser,
|
|
272
382
|
isDelegatedEvent,
|
|
273
|
-
isExclude,
|
|
274
383
|
isFalsy,
|
|
275
384
|
isFunction,
|
|
276
385
|
isHTMLElement,
|
|
277
386
|
isHTMLTag,
|
|
387
|
+
isHtmlFormElement,
|
|
388
|
+
isHtmlInputElement,
|
|
389
|
+
isHtmlSelectElement,
|
|
390
|
+
isHtmlTextAreaElement,
|
|
278
391
|
isKnownHtmlAttr,
|
|
279
392
|
isKnownSvgAttr,
|
|
280
393
|
isMap,
|
|
281
394
|
isMathMLTag,
|
|
282
395
|
isNaN,
|
|
283
396
|
isNil,
|
|
397
|
+
isNode,
|
|
284
398
|
isNull,
|
|
285
399
|
isNumber,
|
|
286
400
|
isObject,
|
|
@@ -297,14 +411,20 @@ export {
|
|
|
297
411
|
isString,
|
|
298
412
|
isStringNumber,
|
|
299
413
|
isSymbol,
|
|
414
|
+
isTextNode,
|
|
300
415
|
isUndefined,
|
|
301
416
|
isVoidTag,
|
|
302
417
|
isWeakMap,
|
|
303
418
|
isWeakSet,
|
|
304
419
|
kebabCase,
|
|
305
420
|
noop,
|
|
421
|
+
normalizeClassName,
|
|
422
|
+
normalizeStyle,
|
|
423
|
+
parseStyleString,
|
|
306
424
|
propsToAttrMap,
|
|
307
425
|
startsWith,
|
|
426
|
+
styleObjectToString,
|
|
427
|
+
styleToString,
|
|
308
428
|
warn
|
|
309
429
|
};
|
|
310
430
|
/*! #__NO_SIDE_EFFECTS__ */
|