@salty-css/react 0.0.1-alpha.273 → 0.0.1-alpha.275
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/dynamic-styles.cjs +2 -2
- package/dynamic-styles.d.ts +3 -4
- package/dynamic-styles.js +17 -16
- package/package.json +2 -2
package/dynamic-styles.cjs
CHANGED
@@ -1,2 +1,2 @@
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
2
|
-
`),
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("react/jsx-runtime"),o=require("@salty-css/core/parsers"),m=require("@salty-css/core/util"),S=require("./clsx-C11secjj.cjs"),i=s=>m.toHash(s),r=async(s,a)=>(await o.parseStyles(s,a)).join(`
|
2
|
+
`),j=async({as:s,scope:a,styles:e,...n})=>{if(s){if(!e)return t.jsx(s,{...n});const c=i(e),u=await r(e,a||`.${c}`),y={...n,className:S.clsx(c,n.className)};return t.jsxs(t.Fragment,{children:[t.jsx("style",{children:u}),t.jsx(s,{...y})]})}if(!e)return null;const l=await r(e,a);return t.jsx("style",{children:l})};exports.DynamicStyles=j;exports.getDynamicStylesClassName=i;exports.getDynamicStylesCss=r;
|
package/dynamic-styles.d.ts
CHANGED
@@ -3,13 +3,12 @@ import { HTMLAttributes } from 'react';
|
|
3
3
|
/**
|
4
4
|
* Create a hash of the dynamic styles that then can be used as scope.
|
5
5
|
*/
|
6
|
-
export declare const
|
7
|
-
export declare const useDynamicStylesClassName: (styles: BaseStyles) => string;
|
6
|
+
export declare const getDynamicStylesClassName: (styles: BaseStyles) => string;
|
8
7
|
/**
|
9
8
|
* Add any dynamic styles to your app with a custom scope.
|
10
9
|
* Note: this works only with server components.
|
11
10
|
*/
|
12
|
-
export declare const
|
11
|
+
export declare const getDynamicStylesCss: (styles: BaseStyles, scope?: string) => Promise<string>;
|
13
12
|
interface DynamicStylesProps extends HTMLAttributes<HTMLElement> {
|
14
13
|
scope?: string;
|
15
14
|
as?: (...args: any[]) => React.ReactNode;
|
@@ -19,5 +18,5 @@ interface DynamicStylesProps extends HTMLAttributes<HTMLElement> {
|
|
19
18
|
* Add any dynamic styles to your app with a custom scope.
|
20
19
|
* Note: this works only with server components.
|
21
20
|
*/
|
22
|
-
export declare const DynamicStyles: ({ as: Component, scope, styles, ...rest }: DynamicStylesProps) => Promise<import("react/jsx-runtime").JSX.Element>;
|
21
|
+
export declare const DynamicStyles: ({ as: Component, scope, styles, ...rest }: DynamicStylesProps) => Promise<import("react/jsx-runtime").JSX.Element | null>;
|
23
22
|
export {};
|
package/dynamic-styles.js
CHANGED
@@ -1,22 +1,23 @@
|
|
1
|
-
import {
|
2
|
-
import { parseStyles as
|
3
|
-
import { toHash as
|
4
|
-
import { c as
|
5
|
-
const
|
6
|
-
`),
|
7
|
-
const e = await d(t, a);
|
1
|
+
import { jsx as t, jsxs as l, Fragment as f } from "react/jsx-runtime";
|
2
|
+
import { parseStyles as p } from "@salty-css/core/parsers";
|
3
|
+
import { toHash as u } from "@salty-css/core/util";
|
4
|
+
import { c as y } from "./clsx-OuTLNxxd.js";
|
5
|
+
const d = (s) => u(s), e = async (s, a) => (await p(s, a)).join(`
|
6
|
+
`), g = async ({ as: s, scope: a, styles: r, ...c }) => {
|
8
7
|
if (s) {
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
/* @__PURE__ */
|
8
|
+
if (!r) return /* @__PURE__ */ t(s, { ...c });
|
9
|
+
const n = d(r), o = await e(r, a || `.${n}`), m = { ...c, className: y(n, c.className) };
|
10
|
+
return /* @__PURE__ */ l(f, { children: [
|
11
|
+
/* @__PURE__ */ t("style", { children: o }),
|
12
|
+
/* @__PURE__ */ t(s, { ...m })
|
13
13
|
] });
|
14
14
|
}
|
15
|
-
|
15
|
+
if (!r) return null;
|
16
|
+
const i = await e(r, a);
|
17
|
+
return /* @__PURE__ */ t("style", { children: i });
|
16
18
|
};
|
17
19
|
export {
|
18
|
-
|
19
|
-
d as
|
20
|
-
|
21
|
-
p as useDynamicStylesHash
|
20
|
+
g as DynamicStyles,
|
21
|
+
d as getDynamicStylesClassName,
|
22
|
+
e as getDynamicStylesCss
|
22
23
|
};
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@salty-css/react",
|
3
|
-
"version": "0.0.1-alpha.
|
3
|
+
"version": "0.0.1-alpha.275",
|
4
4
|
"main": "./dist/index.js",
|
5
5
|
"module": "./dist/index.mjs",
|
6
6
|
"typings": "./dist/index.d.ts",
|
@@ -70,7 +70,7 @@
|
|
70
70
|
}
|
71
71
|
},
|
72
72
|
"dependencies": {
|
73
|
-
"@salty-css/core": "^0.0.1-alpha.
|
73
|
+
"@salty-css/core": "^0.0.1-alpha.275",
|
74
74
|
"clsx": ">=2.x",
|
75
75
|
"react": ">=19.x || >=18.3.x"
|
76
76
|
}
|