mirror of
https://github.com/zoriya/yoshiki.git
synced 2025-12-06 07:06:13 +00:00
Add support to undefined values
This commit is contained in:
@@ -20,7 +20,18 @@ export default function Home(props: object) {
|
|||||||
const { css } = useYoshiki();
|
const { css } = useYoshiki();
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div {...css({ display: "flex", paddingLeft: "2rem", paddingRight: "2rem" }, props)}>
|
<div
|
||||||
|
{...css(
|
||||||
|
{
|
||||||
|
display: "flex",
|
||||||
|
paddingLeft: "2rem",
|
||||||
|
paddingRight: "2rem",
|
||||||
|
flexGrow: 1,
|
||||||
|
margin: undefined,
|
||||||
|
},
|
||||||
|
props,
|
||||||
|
)}
|
||||||
|
>
|
||||||
<Head>
|
<Head>
|
||||||
<title>Create Next App</title>
|
<title>Create Next App</title>
|
||||||
<meta name="description" content="Generated by create next app" />
|
<meta name="description" content="Generated by create next app" />
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "yoshiki",
|
"name": "yoshiki",
|
||||||
"version": "0.2.4",
|
"version": "0.2.5",
|
||||||
"author": "Zoe Roux <zoe.roux@sdg.moe> (https://github.com/AnonymusRaccoon)",
|
"author": "Zoe Roux <zoe.roux@sdg.moe> (https://github.com/AnonymusRaccoon)",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"keywords": [
|
"keywords": [
|
||||||
|
|||||||
@@ -33,6 +33,7 @@ const stateMapper: {
|
|||||||
|
|
||||||
const sanitize = (className: unknown) => {
|
const sanitize = (className: unknown) => {
|
||||||
const name = typeof className === "string" ? className : JSON.stringify(className);
|
const name = typeof className === "string" ? className : JSON.stringify(className);
|
||||||
|
if (name === undefined) return "undefined";
|
||||||
return name.replaceAll(/[^\w-_]/g, "");
|
return name.replaceAll(/[^\w-_]/g, "");
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -55,6 +56,8 @@ const generateClass = (
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (value === undefined) return [];
|
||||||
|
|
||||||
preprocessBlock ??= (id) => id;
|
preprocessBlock ??= (id) => id;
|
||||||
const className = `ys-${context}${key}-${sanitize(value)}`;
|
const className = `ys-${context}${key}-${sanitize(value)}`;
|
||||||
const block = Object.entries(prefix(preprocessBlock({ [key]: value })))
|
const block = Object.entries(prefix(preprocessBlock({ [key]: value })))
|
||||||
|
|||||||
Reference in New Issue
Block a user