@salty-css/react 0.1.0-alpha.3 → 0.1.0-alpha.5
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 +1 -2
- package/dynamic-styles.d.ts +2 -10
- package/dynamic-styles.js +18 -23
- package/package.json +2 -2
package/dynamic-styles.cjs
CHANGED
|
@@ -1,2 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
2
|
-
`)},x=async({as:e,scope:t,styles:s,...c})=>{if(e){const a=o=>typeof e=="string"?j.createElement(e,o):e(o);if(!s)return n.jsx(a,{...c});const i=l(s),u=await r(s,t||`.${i}`),y={...c,className:f.clsx(i,c.className)};return n.jsxs(n.Fragment,{children:[n.jsx("style",{children:u}),n.jsx(a,{...y})]})}if(!s)return null;const m=await r(s,t);return n.jsx("style",{children:m})};exports.DynamicStyles=x;exports.getDynamicStylesClassName=l;exports.getDynamicStylesCss=r;
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),s=require("@salty-css/core/css/dynamic-styles"),u=require("./clsx-C11secjj.cjs"),g=require("react"),S=async({as:n,scope:r,styles:t,...c})=>{if(n){const a=l=>typeof n=="string"?g.createElement(n,l):n(l);if(!t)return e.jsx(a,{...c});const i=s.getDynamicStylesClassName(t),m=await s.getDynamicStylesCss(t,r||`.${i}`),o={...c,className:u.clsx(i,c.className)};return e.jsxs(e.Fragment,{children:[e.jsx("style",{children:m}),e.jsx(a,{...o})]})}if(!t)return null;const y=await s.getDynamicStylesCss(t,r);return e.jsx("style",{children:y})};Object.defineProperty(exports,"getDynamicStylesClassName",{enumerable:!0,get:()=>s.getDynamicStylesClassName});Object.defineProperty(exports,"getDynamicStylesCss",{enumerable:!0,get:()=>s.getDynamicStylesCss});exports.DynamicStyles=S;
|
package/dynamic-styles.d.ts
CHANGED
|
@@ -1,14 +1,7 @@
|
|
|
1
1
|
import { BaseStyles } from '@salty-css/core/types';
|
|
2
|
+
import { getDynamicStylesClassName, getDynamicStylesCss } from '@salty-css/core/css/dynamic-styles';
|
|
2
3
|
import { HTMLAttributes } from 'react';
|
|
3
|
-
|
|
4
|
-
* Create a hash of the dynamic styles that then can be used as scope.
|
|
5
|
-
*/
|
|
6
|
-
export declare const getDynamicStylesClassName: (styles: BaseStyles) => string;
|
|
7
|
-
/**
|
|
8
|
-
* Add any dynamic styles to your app with a custom scope.
|
|
9
|
-
* Note: this works only with server components.
|
|
10
|
-
*/
|
|
11
|
-
export declare const getDynamicStylesCss: (styles: BaseStyles, scope?: string) => Promise<string>;
|
|
4
|
+
export { getDynamicStylesClassName, getDynamicStylesCss };
|
|
12
5
|
type AnyComponent = (...args: any[]) => React.ReactNode;
|
|
13
6
|
interface DynamicStylesProps extends HTMLAttributes<HTMLElement> {
|
|
14
7
|
styles?: BaseStyles;
|
|
@@ -20,4 +13,3 @@ interface DynamicStylesProps extends HTMLAttributes<HTMLElement> {
|
|
|
20
13
|
* Note: this works only with server components.
|
|
21
14
|
*/
|
|
22
15
|
export declare const DynamicStyles: ({ as, scope, styles, ...rest }: DynamicStylesProps) => Promise<import("react/jsx-runtime").JSX.Element | null>;
|
|
23
|
-
export {};
|
package/dynamic-styles.js
CHANGED
|
@@ -1,29 +1,24 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
`);
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
if (!n) return /* @__PURE__ */ s(c, { ...o });
|
|
15
|
-
const e = w(n), l = await i(n, r || `.${e}`), f = { ...o, className: h(e, o.className) };
|
|
16
|
-
return /* @__PURE__ */ p(y, { children: [
|
|
17
|
-
/* @__PURE__ */ s("style", { children: l }),
|
|
18
|
-
/* @__PURE__ */ s(c, { ...f })
|
|
1
|
+
import { jsx as n, jsxs as f, Fragment as p } from "react/jsx-runtime";
|
|
2
|
+
import { getDynamicStylesClassName as g, getDynamicStylesCss as o } from "@salty-css/core/css/dynamic-styles";
|
|
3
|
+
import { getDynamicStylesClassName as w, getDynamicStylesCss as E } from "@salty-css/core/css/dynamic-styles";
|
|
4
|
+
import { c as u } from "./clsx-OuTLNxxd.js";
|
|
5
|
+
import { createElement as x } from "react";
|
|
6
|
+
const d = async ({ as: e, scope: r, styles: t, ...s }) => {
|
|
7
|
+
if (e) {
|
|
8
|
+
const c = (a) => typeof e == "string" ? x(e, a) : e(a);
|
|
9
|
+
if (!t) return /* @__PURE__ */ n(c, { ...s });
|
|
10
|
+
const m = g(t), l = await o(t, r || `.${m}`), y = { ...s, className: u(m, s.className) };
|
|
11
|
+
return /* @__PURE__ */ f(p, { children: [
|
|
12
|
+
/* @__PURE__ */ n("style", { children: l }),
|
|
13
|
+
/* @__PURE__ */ n(c, { ...y })
|
|
19
14
|
] });
|
|
20
15
|
}
|
|
21
|
-
if (!
|
|
22
|
-
const
|
|
23
|
-
return /* @__PURE__ */
|
|
16
|
+
if (!t) return null;
|
|
17
|
+
const i = await o(t, r);
|
|
18
|
+
return /* @__PURE__ */ n("style", { children: i });
|
|
24
19
|
};
|
|
25
20
|
export {
|
|
26
|
-
|
|
21
|
+
d as DynamicStyles,
|
|
27
22
|
w as getDynamicStylesClassName,
|
|
28
|
-
|
|
23
|
+
E as getDynamicStylesCss
|
|
29
24
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@salty-css/react",
|
|
3
|
-
"version": "0.1.0-alpha.
|
|
3
|
+
"version": "0.1.0-alpha.5",
|
|
4
4
|
"main": "./dist/index.js",
|
|
5
5
|
"module": "./dist/index.mjs",
|
|
6
6
|
"typings": "./dist/index.d.ts",
|
|
@@ -78,7 +78,7 @@
|
|
|
78
78
|
}
|
|
79
79
|
},
|
|
80
80
|
"dependencies": {
|
|
81
|
-
"@salty-css/core": "^0.1.0-alpha.
|
|
81
|
+
"@salty-css/core": "^0.1.0-alpha.5",
|
|
82
82
|
"clsx": ">=2.x",
|
|
83
83
|
"react": ">=19.x || >=18.3.x"
|
|
84
84
|
},
|