Comparing version 1.5.16 to 1.5.17
@@ -139,59 +139,39 @@ // Safari Polyfills | ||
const template = `<${"template" /* Placeholder.template */} id="lbInsertNodes"></${"template" /* Placeholder.template */}>`; | ||
switch (variable) { | ||
case isNode(variable) && variable: { | ||
if (variable === false) { | ||
resolvedVariables.push(String(variable)); | ||
break; | ||
if (isNode(variable)) { | ||
insertNodes.push(variable); | ||
resolvedVariables.push(template); | ||
} | ||
else if (["number", "string" /* Placeholder.string */, "symbol", "boolean", "bigint"].includes(typeof variable) || | ||
Reflect.has(variable, reactiveSymbol)) { | ||
resolvedVariables.push(String(variable)); | ||
} | ||
else if (isFunction(variable) || isEventObject(variable)) { | ||
const funcName = randomText(); | ||
Reflect.set(eventFunctions, funcName, variable); | ||
resolvedVariables.push(funcName); | ||
} | ||
else if (Array.isArray(variable)) { | ||
for (let index = 0; index < variable.length; index++) { | ||
const item = variable[index]; | ||
if (isNode(item)) { | ||
insertNodes.push(item); | ||
variable[index] = template; | ||
} | ||
insertNodes.push(variable); | ||
resolvedVariables.push(template); | ||
break; | ||
} | ||
case ([ | ||
"number", | ||
"string" /* Placeholder.string */, | ||
"symbol", | ||
"boolean", | ||
"bigint", | ||
].includes(typeof variable) || | ||
Reflect.has(variable, reactiveSymbol)) && | ||
variable: | ||
{ | ||
resolvedVariables.push(String(variable)); | ||
break; | ||
resolvedVariables.push(variable.join("")); | ||
} | ||
else if (isObject(variable)) { | ||
let result = ""; | ||
for (const [key, value] of Object.entries(variable)) { | ||
if (isFunction(value) || isEventObject(value)) { | ||
const funcName = randomText(); | ||
Reflect.set(eventFunctions, funcName, value); | ||
result += `${key}="${funcName}"`; | ||
} | ||
case (isFunction(variable) || isEventObject(variable)) && variable: { | ||
const funcName = randomText(); | ||
Reflect.set(eventFunctions, funcName, variable); | ||
resolvedVariables.push(funcName); | ||
break; | ||
} | ||
case Array.isArray(variable) && variable: { | ||
for (let index = 0; index < variable.length; index++) { | ||
const item = variable[index]; | ||
if (isNode(item)) { | ||
insertNodes.push(item); | ||
variable[index] = template; | ||
} | ||
else { | ||
result += `${key}="${value}"`; | ||
} | ||
resolvedVariables.push(variable.join("")); | ||
break; | ||
} | ||
case isObject(variable) && variable: { | ||
let result = ""; | ||
for (const [key, value] of Object.entries(variable)) { | ||
if (isFunction(value) || isEventObject(value)) { | ||
const funcName = randomText(); | ||
Reflect.set(eventFunctions, funcName, value); | ||
result += `${key}="${funcName}"`; | ||
} | ||
else { | ||
result += `${key}="${value}"`; | ||
} | ||
} | ||
resolvedVariables.push(result); | ||
break; | ||
} | ||
resolvedVariables.push(result); | ||
} | ||
/* c8 ignore next 1 */ | ||
} | ||
@@ -198,0 +178,0 @@ // Find elements <html|head|body>, as they cannot be created by the parser. Replace them by fake Custom Elements and replace them afterwards. |
{ | ||
"name": "hydro-js", | ||
"version": "1.5.16", | ||
"version": "1.5.17", | ||
"description": "A lightweight reactive library", | ||
@@ -5,0 +5,0 @@ "type": "module", |
@@ -245,57 +245,38 @@ declare global { | ||
switch (variable) { | ||
case isNode(variable) && variable: { | ||
if (variable === false) { | ||
resolvedVariables.push(String(variable)); | ||
break; | ||
if (isNode(variable)) { | ||
insertNodes.push(variable); | ||
resolvedVariables.push(template); | ||
} else if ( | ||
["number", Placeholder.string, "symbol", "boolean", "bigint"].includes( | ||
typeof variable | ||
) || | ||
Reflect.has(variable, reactiveSymbol) | ||
) { | ||
resolvedVariables.push(String(variable)); | ||
} else if (isFunction(variable) || isEventObject(variable)) { | ||
const funcName = randomText(); | ||
Reflect.set(eventFunctions, funcName, variable); | ||
resolvedVariables.push(funcName); | ||
} else if (Array.isArray(variable)) { | ||
for (let index = 0; index < variable.length; index++) { | ||
const item = variable[index]; | ||
if (isNode(item)) { | ||
insertNodes.push(item); | ||
variable[index] = template; | ||
} | ||
insertNodes.push(variable); | ||
resolvedVariables.push(template); | ||
break; | ||
} | ||
case ([ | ||
"number", | ||
Placeholder.string, | ||
"symbol", | ||
"boolean", | ||
"bigint", | ||
].includes(typeof variable) || | ||
Reflect.has(variable, reactiveSymbol)) && | ||
variable: { | ||
resolvedVariables.push(String(variable)); | ||
break; | ||
} | ||
case (isFunction(variable) || isEventObject(variable)) && variable: { | ||
const funcName = randomText(); | ||
Reflect.set(eventFunctions, funcName, variable); | ||
resolvedVariables.push(funcName); | ||
break; | ||
} | ||
case Array.isArray(variable) && variable: { | ||
for (let index = 0; index < variable.length; index++) { | ||
const item = variable[index]; | ||
if (isNode(item)) { | ||
insertNodes.push(item); | ||
variable[index] = template; | ||
} | ||
resolvedVariables.push(variable.join("")); | ||
} else if (isObject(variable)) { | ||
let result = ""; | ||
for (const [key, value] of Object.entries(variable)) { | ||
if (isFunction(value) || isEventObject(value)) { | ||
const funcName = randomText(); | ||
Reflect.set(eventFunctions, funcName, value); | ||
result += `${key}="${funcName}"`; | ||
} else { | ||
result += `${key}="${value}"`; | ||
} | ||
resolvedVariables.push(variable.join("")); | ||
break; | ||
} | ||
case isObject(variable) && variable: { | ||
let result = ""; | ||
for (const [key, value] of Object.entries(variable)) { | ||
if (isFunction(value) || isEventObject(value)) { | ||
const funcName = randomText(); | ||
Reflect.set(eventFunctions, funcName, value); | ||
result += `${key}="${funcName}"`; | ||
} else { | ||
result += `${key}="${value}"`; | ||
} | ||
} | ||
resolvedVariables.push(result); | ||
break; | ||
} | ||
resolvedVariables.push(result); | ||
} | ||
/* c8 ignore next 1 */ | ||
} | ||
@@ -302,0 +283,0 @@ |
281139
5118