@solid-primitives/props
Advanced tools
Comparing version 3.0.5 to 3.0.6
@@ -69,3 +69,2 @@ import { $PROXY, createMemo, mergeProps } from 'solid-js'; | ||
var extractCSSregex = /([^:; ]*):\s*([^;]*)/g; | ||
var isEventListenerKey = (key) => key[0] === "o" && key[1] === "n" && key.length > 2 && key[2] !== ":" && !key.startsWith("oncapture:"); | ||
function stringStyleToObject(style) { | ||
@@ -106,23 +105,11 @@ const object = {}; | ||
for (const key in propsObj) { | ||
if (!isEventListenerKey(key)) | ||
continue; | ||
const v = propsObj[key]; | ||
const name = key.toLowerCase(); | ||
let callback; | ||
if (typeof v === "function") | ||
callback = v; | ||
else if (Array.isArray(v)) { | ||
if (v.length === 1) | ||
callback = v[0]; | ||
if (key[0] === "o" && key[1] === "n" && key[2]) { | ||
const v = propsObj[key]; | ||
const name = key.toLowerCase(); | ||
const callback = typeof v === "function" ? v : Array.isArray(v) ? v.length === 1 ? v[0] : v[0].bind(void 0, v[1]) : void 0; | ||
if (callback) | ||
listeners[name] ? listeners[name].push(callback) : listeners[name] = [callback]; | ||
else | ||
callback = v[0].bind(void 0, v[1]); | ||
} else { | ||
delete listeners[name]; | ||
continue; | ||
delete listeners[name]; | ||
} | ||
const callbacks = listeners[name]; | ||
if (!callbacks) | ||
listeners[name] = [callback]; | ||
else | ||
callbacks.push(callback); | ||
} | ||
@@ -147,5 +134,5 @@ } | ||
} | ||
if (isEventListenerKey(key)) { | ||
if (key[0] === "o" && key[1] === "n" && key[2]) { | ||
const callbacks = listeners[key.toLowerCase()]; | ||
return Array.isArray(callbacks) ? chain(callbacks) : Reflect.get(merge, key); | ||
return callbacks ? chain(callbacks) : Reflect.get(merge, key); | ||
} | ||
@@ -152,0 +139,0 @@ if (key === "class" || key === "className") |
{ | ||
"name": "@solid-primitives/props", | ||
"version": "3.0.5", | ||
"version": "3.0.6", | ||
"description": "Library of primitives focused around component props.", | ||
@@ -5,0 +5,0 @@ "author": "Damian Tarnawski <gthetarnav@gmail.com>", |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
20871
395