@zag-js/core
Advanced tools
Comparing version 0.0.0-dev-20240402190741 to 0.0.0-dev-20240403170757
@@ -867,2 +867,21 @@ "use strict"; | ||
var clsx = (...args) => args.map((str) => str?.trim?.()).filter(Boolean).join(" "); | ||
var CSS_REGEX = /((?:--)?(?:\w+-?)+)\s*:\s*([^;]*)/g; | ||
var serialize = (style) => { | ||
const res = {}; | ||
let match; | ||
while (match = CSS_REGEX.exec(style)) { | ||
res[match[1]] = match[2]; | ||
} | ||
return res; | ||
}; | ||
var css = (a, b) => { | ||
if (isString(a)) { | ||
if (isString(b)) | ||
return `${a};${b}`; | ||
a = serialize(a); | ||
} else if (isString(b)) { | ||
b = serialize(b); | ||
} | ||
return Object.assign({}, a ?? {}, b ?? {}); | ||
}; | ||
var eventRegex = /^on[A-Z]/; | ||
@@ -882,3 +901,3 @@ function mergeProps(...args) { | ||
if (key === "style") { | ||
result[key] = Object.assign({}, result[key] ?? {}, props[key] ?? {}); | ||
result[key] = css(result[key], props[key]); | ||
continue; | ||
@@ -885,0 +904,0 @@ } |
{ | ||
"name": "@zag-js/core", | ||
"version": "0.0.0-dev-20240402190741", | ||
"version": "0.0.0-dev-20240403170757", | ||
"description": "A minimal implementation of xstate fsm for UI machines", | ||
@@ -30,7 +30,7 @@ "keywords": [ | ||
"klona": "2.0.6", | ||
"@zag-js/store": "0.0.0-dev-20240402190741" | ||
"@zag-js/store": "0.0.0-dev-20240403170757" | ||
}, | ||
"devDependencies": { | ||
"clean-package": "2.2.0", | ||
"@zag-js/utils": "0.0.0-dev-20240402190741" | ||
"@zag-js/utils": "0.0.0-dev-20240403170757" | ||
}, | ||
@@ -37,0 +37,0 @@ "clean-package": "../../clean-package.config.json", |
@@ -1,2 +0,2 @@ | ||
import { callAll } from "@zag-js/utils" | ||
import { callAll, isString } from "@zag-js/utils" | ||
@@ -13,2 +13,26 @@ interface Props { | ||
const CSS_REGEX = /((?:--)?(?:\w+-?)+)\s*:\s*([^;]*)/g | ||
const serialize = (style: string): Record<string, string> => { | ||
const res: Record<string, string> = {} | ||
let match: RegExpExecArray | null | ||
while ((match = CSS_REGEX.exec(style))) { | ||
res[match[1]!] = match[2]! | ||
} | ||
return res | ||
} | ||
const css = ( | ||
a: Record<string, string> | string | undefined, | ||
b: Record<string, string> | string | undefined, | ||
): Record<string, string> | string => { | ||
if (isString(a)) { | ||
if (isString(b)) return `${a};${b}` | ||
a = serialize(a) | ||
} else if (isString(b)) { | ||
b = serialize(b) | ||
} | ||
return Object.assign({}, a ?? {}, b ?? {}) | ||
} | ||
type TupleTypes<T extends any[]> = T[number] | ||
@@ -36,3 +60,3 @@ | ||
if (key === "style") { | ||
result[key] = Object.assign({}, result[key] ?? {}, props[key] ?? {}) | ||
result[key] = css(result[key], props[key]) | ||
continue | ||
@@ -39,0 +63,0 @@ } |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
295828
3561
+ Added@zag-js/store@0.0.0-dev-20240403170757(transitive)
- Removed@zag-js/store@0.0.0-dev-20240402190741(transitive)