@salty-css/react 0.0.1-alpha.200 → 0.0.1-alpha.202
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/class-name.cjs +1 -1
- package/class-name.js +1 -1
- package/config.cjs +1 -1
- package/config.js +61 -22
- package/{element-factory-C7JVLDq7.js → element-factory-BqXNML99.js} +3 -3
- package/{element-factory-D4kpeFoW.cjs → element-factory-xzOUBIyk.cjs} +1 -1
- package/index.cjs +1 -1
- package/index.js +8 -7
- package/keyframes.cjs +1 -1
- package/keyframes.js +25 -25
- package/package.json +2 -2
- package/parse-styles-B4STzGjG.cjs +3 -0
- package/parse-styles-DqV7Jbst.js +129 -0
- package/parse-tokens-CNGyn07A.cjs +1 -0
- package/parse-tokens-CdNpUjpp.js +11 -0
- package/styled-client.cjs +1 -1
- package/styled-client.js +1 -1
- package/styled.cjs +1 -1
- package/styled.js +2 -2
- package/{styles-generator-Bae0y6su.js → styles-generator-8VCE7njI.js} +7 -7
- package/{styles-generator-DAkA4JnC.cjs → styles-generator-Bf-aF7sl.cjs} +1 -1
- package/parse-styles-hwxJnxKJ.cjs +0 -7
- package/parse-styles-p4rBqcpk.js +0 -118
- package/parse-tokens-YUi047xd.js +0 -8
- package/parse-tokens-p68muVgG.cjs +0 -1
package/class-name.cjs
CHANGED
@@ -1 +1 @@
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("./styles-generator-
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("./styles-generator-Bf-aF7sl.cjs");class a extends r.StylesGenerator{constructor(e){super(e),this._params=e}}const n=s=>{const e=new a(s),t=new String(e.cssClassName);return Object.assign(t,{get isClassName(){return!0},factory:e}),t};exports.className=n;
|
package/class-name.js
CHANGED
package/config.cjs
CHANGED
@@ -1 +1 @@
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
1
|
+
"use strict";var o=Object.defineProperty;var u=(t,e,r)=>e in t?o(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r;var s=(t,e,r)=>u(t,typeof e!="symbol"?e+"":e,r);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const h=require("./media.cjs"),m=t=>t;class a{constructor(e){this._current=e}get isGlobalDefine(){return!0}}const p=t=>new a(t),f=t=>t(h.media);class n{constructor(e){this._current=e}get isDefineVariables(){return!0}}const d=t=>new n(t);class i{constructor(e){s(this,"_path");this.params=e}get _current(){return this.params.template}get isDefineTemplate(){return!0}_setPath(e){return this._path=e,this}}class l{constructor(e){s(this,"_path");s(this,"templates",[]);this.params=e,Object.entries(e).forEach(([r,c])=>{this.templates.push(new i({name:r,template:c}))})}get _current(){return this.params}get _children(){return Object.fromEntries(this.templates.map(e=>[e.params.name,e]))}get isDefineTemplates(){return!0}_setPath(e){return this._path=e,this.templates.forEach(r=>r._setPath(e)),this}}const y=t=>new l(t);exports.GlobalStylesFactory=a;exports.TemplateFactory=i;exports.TemplatesFactory=l;exports.VariablesFactory=n;exports.defineConfig=m;exports.defineGlobalStyles=p;exports.defineMediaQuery=f;exports.defineTemplates=y;exports.defineVariables=d;
|
package/config.js
CHANGED
@@ -1,39 +1,78 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
1
|
+
var n = Object.defineProperty;
|
2
|
+
var i = (e, t, r) => t in e ? n(e, t, { enumerable: !0, configurable: !0, writable: !0, value: r }) : e[t] = r;
|
3
|
+
var s = (e, t, r) => i(e, typeof t != "symbol" ? t + "" : t, r);
|
4
|
+
import { media as c } from "./media.js";
|
5
|
+
const f = (e) => e;
|
6
|
+
class u {
|
7
|
+
constructor(t) {
|
8
|
+
this._current = t;
|
6
9
|
}
|
7
10
|
get isGlobalDefine() {
|
8
11
|
return !0;
|
9
12
|
}
|
10
13
|
}
|
11
|
-
const
|
12
|
-
class
|
13
|
-
constructor(
|
14
|
-
this._current =
|
14
|
+
const _ = (e) => new u(e), b = (e) => e(c);
|
15
|
+
class o {
|
16
|
+
constructor(t) {
|
17
|
+
this._current = t;
|
15
18
|
}
|
16
19
|
get isDefineVariables() {
|
17
20
|
return !0;
|
18
21
|
}
|
19
22
|
}
|
20
|
-
const
|
21
|
-
class
|
22
|
-
constructor(
|
23
|
-
this
|
23
|
+
const d = (e) => new o(e);
|
24
|
+
class l {
|
25
|
+
constructor(t) {
|
26
|
+
s(this, "_path");
|
27
|
+
this.params = t;
|
28
|
+
}
|
29
|
+
get _current() {
|
30
|
+
return this.params.template;
|
31
|
+
}
|
32
|
+
get isDefineTemplate() {
|
33
|
+
return !0;
|
34
|
+
}
|
35
|
+
_setPath(t) {
|
36
|
+
return this._path = t, this;
|
37
|
+
}
|
38
|
+
}
|
39
|
+
class h {
|
40
|
+
constructor(t) {
|
41
|
+
s(this, "_path");
|
42
|
+
s(this, "templates", []);
|
43
|
+
this.params = t, Object.entries(t).forEach(([r, a]) => {
|
44
|
+
this.templates.push(
|
45
|
+
new l({
|
46
|
+
name: r,
|
47
|
+
template: a
|
48
|
+
})
|
49
|
+
);
|
50
|
+
});
|
51
|
+
}
|
52
|
+
get _current() {
|
53
|
+
return this.params;
|
54
|
+
}
|
55
|
+
get _children() {
|
56
|
+
return Object.fromEntries(
|
57
|
+
this.templates.map((t) => [t.params.name, t])
|
58
|
+
);
|
24
59
|
}
|
25
60
|
get isDefineTemplates() {
|
26
61
|
return !0;
|
27
62
|
}
|
63
|
+
_setPath(t) {
|
64
|
+
return this._path = t, this.templates.forEach((r) => r._setPath(t)), this;
|
65
|
+
}
|
28
66
|
}
|
29
|
-
const
|
67
|
+
const g = (e) => new h(e);
|
30
68
|
export {
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
69
|
+
u as GlobalStylesFactory,
|
70
|
+
l as TemplateFactory,
|
71
|
+
h as TemplatesFactory,
|
72
|
+
o as VariablesFactory,
|
73
|
+
f as defineConfig,
|
74
|
+
_ as defineGlobalStyles,
|
75
|
+
b as defineMediaQuery,
|
76
|
+
g as defineTemplates,
|
77
|
+
d as defineVariables
|
39
78
|
};
|
@@ -1,5 +1,5 @@
|
|
1
1
|
import { forwardRef as g, createElement as p } from "react";
|
2
|
-
import {
|
2
|
+
import { d as N, p as A } from "./parse-tokens-CdNpUjpp.js";
|
3
3
|
function K(n) {
|
4
4
|
var s, e, t = "";
|
5
5
|
if (typeof n == "string" || typeof n == "number") t += n;
|
@@ -29,12 +29,12 @@ const F = ["passProps"], x = (n, s, e, t) => {
|
|
29
29
|
if (!E) throw new Error("No element provided");
|
30
30
|
const m = f.style || {};
|
31
31
|
f.style || (f.style = m), Object.entries(m).forEach(([i, a]) => {
|
32
|
-
const { result: l } =
|
32
|
+
const { result: l } = A(a);
|
33
33
|
m[i] = l;
|
34
34
|
}), e.propValueKeys && e.propValueKeys.forEach((i) => {
|
35
35
|
const a = `css-${i}`, l = r[a];
|
36
36
|
if (l === void 0) return;
|
37
|
-
const C = `--props-${
|
37
|
+
const C = `--props-${N(i)}`;
|
38
38
|
m[C] = l, c && c.add(a);
|
39
39
|
}), e.variantKeys && e.variantKeys.forEach((i) => {
|
40
40
|
const [a, l] = i.split("=");
|
@@ -1 +1 @@
|
|
1
|
-
"use strict";const K=require("react"),O=require("./parse-tokens-
|
1
|
+
"use strict";const K=require("react"),O=require("./parse-tokens-CNGyn07A.cjs");function $(n){var s,e,t="";if(typeof n=="string"||typeof n=="number")t+=n;else if(typeof n=="object")if(Array.isArray(n)){var u=n.length;for(s=0;s<u;s++)n[s]&&(e=$(n[s]))&&(t&&(t+=" "),t+=e)}else for(e in n)n[e]&&(t&&(t+=" "),t+=e);return t}function q(){for(var n,s,e=0,t="",u=arguments.length;e<u;e++)(n=arguments[e])&&(s=$(n))&&(t&&(t+=" "),t+=s);return t}const A=["passProps"],F=(n,s,e,t)=>{const u=({extend:d=n,element:S=e.element,className:w="",children:V,passProps:o=e.passProps,_vks:c=new Set,...r},C)=>{const f={passProps:o};e.attr&&Object.assign(f,e.attr),t&&Object.assign(f,t),e.defaultProps&&Object.assign(r,e.defaultProps),r&&Object.assign(f,r);const b=new Set(w.split(" ")),y=typeof d=="function"||typeof d=="object",h=y&&"isStyled"in d,E=y?d:S||d;if(!E)throw new Error("No element provided");const m=f.style||{};f.style||(f.style=m),Object.entries(m).forEach(([i,a])=>{const{result:l}=O.parseValueTokens(a);m[i]=l}),e.propValueKeys&&e.propValueKeys.forEach(i=>{const a=`css-${i}`,l=r[a];if(l===void 0)return;const N=`--props-${O.dashCase(i)}`;m[N]=l,c&&c.add(a)}),e.variantKeys&&e.variantKeys.forEach(i=>{const[a,l]=i.split("=");r[a]!==void 0?(b.add(`${a}-${r[a]}`),c&&c.add(a)):l!==void 0&&b.add(`${a}-${l}`)}),c&&(!y||!h)?c.forEach(i=>{if(!o)return delete f[i];if(o!==!0&&!o.includes(i))return delete f[i]}):h&&Object.assign(f,{_vks:c}),h||A.forEach(i=>delete f[i]);const g=q(s,...b);return K.createElement(E,{element:y?S:void 0,className:g,ref:C,...f},V)},j=K.forwardRef(u);return Object.assign(j,{isStyled:!0,className:s,toString:()=>`.${s}`}),j};exports.elementFactory=F;
|
package/index.cjs
CHANGED
@@ -1 +1 @@
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const u=require("./keyframes.cjs"),n=require("./media.cjs"),a=r=>`{${r}}`,o=(...r)=>r.flat().reduce((t,e)=>e!=null&&e._current?{...t,...e._current}:{...t,...e},{});exports.keyframes=u.keyframes;exports.MediaQueryFactory=n.MediaQueryFactory;exports.media=n.media;exports.mergeStyles=o;exports.token=a;
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const u=require("./keyframes.cjs"),n=require("./media.cjs"),a=r=>`{${r}}`,o=(...r)=>r.flat().reduce((t,e)=>e!=null&&e._current?{...t,...e._current}:{...t,...e},{}),c=(...r)=>r.flat().reduce((t,e)=>({...t,...e._children}),{});exports.keyframes=u.keyframes;exports.MediaQueryFactory=n.MediaQueryFactory;exports.media=n.media;exports.mergeFactories=c;exports.mergeStyles=o;exports.token=a;
|
package/index.js
CHANGED
@@ -1,10 +1,11 @@
|
|
1
|
-
import { keyframes as
|
2
|
-
import { MediaQueryFactory as
|
3
|
-
const n = (e) => `{${e}}`,
|
1
|
+
import { keyframes as f } from "./keyframes.js";
|
2
|
+
import { MediaQueryFactory as d, media as i } from "./media.js";
|
3
|
+
const n = (e) => `{${e}}`, o = (...e) => e.flat().reduce((t, r) => r != null && r._current ? { ...t, ...r._current } : { ...t, ...r }, {}), u = (...e) => e.flat().reduce((t, r) => ({ ...t, ...r._children }), {});
|
4
4
|
export {
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
5
|
+
d as MediaQueryFactory,
|
6
|
+
f as keyframes,
|
7
|
+
i as media,
|
8
|
+
u as mergeFactories,
|
9
|
+
o as mergeStyles,
|
9
10
|
n as token
|
10
11
|
};
|
package/keyframes.cjs
CHANGED
@@ -1 +1 @@
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("./parse-styles-B4STzGjG.cjs"),w=async({animationName:l,params:u,appendInitialStyles:y,...t})=>{const e=l||i.toHash(t),r=async(n={})=>{const{duration:s="500ms",easing:o="ease-in-out",delay:c="0s",iterationCount:S="1",direction:p="normal",fillMode:g="forwards",playState:b="running"}={...u,...n},a=`${e} ${s} ${o} ${c} ${S} ${p} ${g} ${b}`;if(!y)return a;const m=t.from||t["0%"];if(!m)return a;const j=await i.parseAndJoinStyles(m,"");return`${a};${j}`},$=Object.entries(t).map(async([n,s])=>{if(!s)return"";const o=await i.parseAndJoinStyles(s,"");return`${typeof n=="number"?`${n}%`:n}{${o}}`}),d=(await Promise.all($)).join(""),f=`@keyframes ${e} {${d}}`;return Object.assign(r,{toString:r,isKeyframes:!0,animationName:e,css:f,keyframes:t}),r};exports.keyframes=w;
|
package/keyframes.js
CHANGED
@@ -1,33 +1,33 @@
|
|
1
|
-
import { t as j, p as m } from "./parse-styles-
|
2
|
-
const
|
3
|
-
const
|
1
|
+
import { t as j, p as m } from "./parse-styles-DqV7Jbst.js";
|
2
|
+
const h = async ({ animationName: $, params: l, appendInitialStyles: u, ...t }) => {
|
3
|
+
const r = $ || j(t), e = async (n = {}) => {
|
4
4
|
const {
|
5
|
-
duration:
|
6
|
-
easing:
|
7
|
-
delay:
|
8
|
-
iterationCount:
|
9
|
-
direction:
|
5
|
+
duration: s = "500ms",
|
6
|
+
easing: o = "ease-in-out",
|
7
|
+
delay: i = "0s",
|
8
|
+
iterationCount: d = "1",
|
9
|
+
direction: S = "normal",
|
10
10
|
fillMode: g = "forwards",
|
11
|
-
playState:
|
12
|
-
} = { ...
|
13
|
-
if (!
|
11
|
+
playState: w = "running"
|
12
|
+
} = { ...l, ...n }, a = `${r} ${s} ${o} ${i} ${d} ${S} ${g} ${w}`;
|
13
|
+
if (!u) return a;
|
14
14
|
const c = t.from || t["0%"];
|
15
|
-
if (!c) return
|
16
|
-
const b = m(c, "");
|
17
|
-
return `${
|
18
|
-
},
|
19
|
-
if (!
|
20
|
-
const
|
21
|
-
return `${
|
22
|
-
}, ""),
|
23
|
-
return Object.assign(
|
24
|
-
toString:
|
15
|
+
if (!c) return a;
|
16
|
+
const b = await m(c, "");
|
17
|
+
return `${a};${b}`;
|
18
|
+
}, f = Object.entries(t).map(async ([n, s]) => {
|
19
|
+
if (!s) return "";
|
20
|
+
const o = await m(s, "");
|
21
|
+
return `${typeof n == "number" ? `${n}%` : n}{${o}}`;
|
22
|
+
}), y = (await Promise.all(f)).join(""), p = `@keyframes ${r} {${y}}`;
|
23
|
+
return Object.assign(e, {
|
24
|
+
toString: e,
|
25
25
|
isKeyframes: !0,
|
26
|
-
animationName:
|
27
|
-
css:
|
26
|
+
animationName: r,
|
27
|
+
css: p,
|
28
28
|
keyframes: t
|
29
|
-
}),
|
29
|
+
}), e;
|
30
30
|
};
|
31
31
|
export {
|
32
|
-
|
32
|
+
h as keyframes
|
33
33
|
};
|
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.202",
|
4
4
|
"main": "./dist/index.js",
|
5
5
|
"module": "./dist/index.mjs",
|
6
6
|
"typings": "./dist/index.d.ts",
|
@@ -62,7 +62,7 @@
|
|
62
62
|
}
|
63
63
|
},
|
64
64
|
"dependencies": {
|
65
|
-
"@salty-css/core": "^0.0.1-alpha.
|
65
|
+
"@salty-css/core": "^0.0.1-alpha.202",
|
66
66
|
"clsx": ">=2.x",
|
67
67
|
"react": ">=19.x || >=18.3.x"
|
68
68
|
}
|
@@ -0,0 +1,3 @@
|
|
1
|
+
"use strict";const S=require("./parse-tokens-CNGyn07A.cjs"),J=e=>s=>{if(typeof s!="string"||!e)return;let t=s;const n=[];return Object.values(e).forEach(d=>{const{pattern:b,transform:C}=d;t=t.replace(b,P=>{const{value:A,css:p}=C(P);return p&&n.push(p),A})}),{transformed:t,additionalCss:n}},V=e=>String.fromCharCode(e+(e>25?39:97)),M=(e,s)=>{let t="",n;for(n=Math.abs(e);n>52;n=n/52|0)t=V(n%52)+t;return t=V(n%52)+t,t.length<s?t=t.padStart(s,"a"):t.length>s&&(t=t.slice(-s)),t},T=(e,s)=>{let t=s.length;for(;t;)e=e*33^s.charCodeAt(--t);return e},U=(e,s=5)=>{const t=T(5381,JSON.stringify(e))>>>0;return M(t,s)},q=["top","right","bottom","left","min-width",/.*width.*/,/^[^line]*height.*/,/padding.*/,/margin.*/,/border.*/,/inset.*/,/.*radius.*/,/.*spacing.*/,/.*gap.*/,/.*indent.*/,/.*offset.*/,/.*size.*/,/.*thickness.*/,/.*font-size.*/],Q=(e,s,t)=>{if(q.some(d=>typeof d=="string"?d===e:d.test(e))){const d=(t==null?void 0:t.defaultUnit)||"px";return`${s}${d}`}return`${s}`},_=["Webkit","Moz","ms","O"],F=e=>e.startsWith("-")?e:_.some(s=>e.startsWith(s))?`-${S.dashCase(e)}`:S.dashCase(e),$=async(e,s="",t)=>{if(!e)throw new Error("No styles provided to parseStyles function!");const n=new Set,b=Object.entries(e).map(async([w,r])=>{var y;const i=w.trim(),m=F(i),c=(a,f=";")=>`${m}:${a}${f}`;if(typeof r=="function"&&(r=r({scope:s,config:t})),r instanceof Promise&&(r=await r),t!=null&&t.templates&&t.templates[i]){const f=r.split(".").reduce((o,u)=>o[u],t.templates[i]);if(f){const[o]=await $(f,"");return o}console.warn(`Template "${i}" with path of "${r}" was not found in config!`);return}if(typeof r=="object"){if(!r)return;if(r.isColor)return c(r.toString());if(i==="defaultVariants")return;if(i==="variants"){const o=Object.entries(r);for(const[u,h]of o){if(!h)return;const E=Object.entries(h);for(const[N,l]of E){if(!l)return;const O=`${s}.${u}-${N}`;(await $(l,O,t)).forEach(H=>n.add(H))}}return}if(i==="compoundVariants"){for(const o of r){const{css:u,...h}=o,E=Object.entries(h).reduce((l,[O,W])=>`${l}.${O}-${W}`,s);(await $(u,E,t)).forEach(l=>n.add(l))}return}if(i.startsWith("@")){const o=((y=t==null?void 0:t.mediaQueries)==null?void 0:y[i])||i,u=await x(r,s,t),h=`${o} { ${u} }`;n.add(h);return}const a=w.includes("&")?i.replace("&",s):i.startsWith(":")?`${s}${i}`:`${s} ${i}`;(await $(r,a,t)).forEach(o=>n.add(o));return}if(typeof r=="number"){const a=Q(m,r,t);return c(a)}if(typeof r!="string")if("toString"in r)r=r.toString();else throw new Error(`Invalid value type for property ${m}`);return c(r)}),{modifiers:C}=t||{},P=[S.parseValueTokens(),J(C)],p=(await Promise.all(b).then(w=>Promise.all(w.map(r=>P.reduce(async(i,m)=>{const c=await i;if(!c)return c;const j=await m(c);if(!j)return c;const{transformed:y,additionalCss:a}=j;let f="";if(a)for(const o of a)f+=await x(o,"");return`${f}${y}`},Promise.resolve(r)))))).join(`
|
2
|
+
`);if(!p.trim())return n;const z=s?`${s} { ${p} }`:p;return n.add(z),n},x=async(e,s,t)=>[...await $(e,s,t)].join(`
|
3
|
+
`);exports.parseAndJoinStyles=x;exports.toHash=U;
|
@@ -0,0 +1,129 @@
|
|
1
|
+
import { d as W, p as U } from "./parse-tokens-CdNpUjpp.js";
|
2
|
+
const H = (e) => (s) => {
|
3
|
+
if (typeof s != "string" || !e) return;
|
4
|
+
let t = s;
|
5
|
+
const n = [];
|
6
|
+
return Object.values(e).forEach((d) => {
|
7
|
+
const { pattern: b, transform: C } = d;
|
8
|
+
t = t.replace(b, (P) => {
|
9
|
+
const { value: x, css: u } = C(P);
|
10
|
+
return u && n.push(u), x;
|
11
|
+
});
|
12
|
+
}), { transformed: t, additionalCss: n };
|
13
|
+
}, A = (e) => String.fromCharCode(e + (e > 25 ? 39 : 97)), J = (e, s) => {
|
14
|
+
let t = "", n;
|
15
|
+
for (n = Math.abs(e); n > 52; n = n / 52 | 0) t = A(n % 52) + t;
|
16
|
+
return t = A(n % 52) + t, t.length < s ? t = t.padStart(s, "a") : t.length > s && (t = t.slice(-s)), t;
|
17
|
+
}, Q = (e, s) => {
|
18
|
+
let t = s.length;
|
19
|
+
for (; t; ) e = e * 33 ^ s.charCodeAt(--t);
|
20
|
+
return e;
|
21
|
+
}, B = (e, s = 5) => {
|
22
|
+
const t = Q(5381, JSON.stringify(e)) >>> 0;
|
23
|
+
return J(t, s);
|
24
|
+
}, T = [
|
25
|
+
"top",
|
26
|
+
"right",
|
27
|
+
"bottom",
|
28
|
+
"left",
|
29
|
+
"min-width",
|
30
|
+
/.*width.*/,
|
31
|
+
/^[^line]*height.*/,
|
32
|
+
// Exclude line-height
|
33
|
+
/padding.*/,
|
34
|
+
/margin.*/,
|
35
|
+
/border.*/,
|
36
|
+
/inset.*/,
|
37
|
+
/.*radius.*/,
|
38
|
+
/.*spacing.*/,
|
39
|
+
/.*gap.*/,
|
40
|
+
/.*indent.*/,
|
41
|
+
/.*offset.*/,
|
42
|
+
/.*size.*/,
|
43
|
+
/.*thickness.*/,
|
44
|
+
/.*font-size.*/
|
45
|
+
], _ = (e, s, t) => {
|
46
|
+
if (T.some((d) => typeof d == "string" ? d === e : d.test(e))) {
|
47
|
+
const d = (t == null ? void 0 : t.defaultUnit) || "px";
|
48
|
+
return `${s}${d}`;
|
49
|
+
}
|
50
|
+
return `${s}`;
|
51
|
+
}, q = ["Webkit", "Moz", "ms", "O"], F = (e) => e.startsWith("-") ? e : q.some((s) => e.startsWith(s)) ? `-${W(e)}` : W(e), $ = async (e, s = "", t) => {
|
52
|
+
if (!e) throw new Error("No styles provided to parseStyles function!");
|
53
|
+
const n = /* @__PURE__ */ new Set(), b = Object.entries(e).map(async ([w, r]) => {
|
54
|
+
var y;
|
55
|
+
const i = w.trim(), l = F(i), c = (a, f = ";") => `${l}:${a}${f}`;
|
56
|
+
if (typeof r == "function" && (r = r({ scope: s, config: t })), r instanceof Promise && (r = await r), t != null && t.templates && t.templates[i]) {
|
57
|
+
const f = r.split(".").reduce((o, p) => o[p], t.templates[i]);
|
58
|
+
if (f) {
|
59
|
+
const [o] = await $(f, "");
|
60
|
+
return o;
|
61
|
+
}
|
62
|
+
console.warn(`Template "${i}" with path of "${r}" was not found in config!`);
|
63
|
+
return;
|
64
|
+
}
|
65
|
+
if (typeof r == "object") {
|
66
|
+
if (!r) return;
|
67
|
+
if (r.isColor) return c(r.toString());
|
68
|
+
if (i === "defaultVariants") return;
|
69
|
+
if (i === "variants") {
|
70
|
+
const o = Object.entries(r);
|
71
|
+
for (const [p, m] of o) {
|
72
|
+
if (!m) return;
|
73
|
+
const E = Object.entries(m);
|
74
|
+
for (const [N, h] of E) {
|
75
|
+
if (!h) return;
|
76
|
+
const O = `${s}.${p}-${N}`;
|
77
|
+
(await $(h, O, t)).forEach((M) => n.add(M));
|
78
|
+
}
|
79
|
+
}
|
80
|
+
return;
|
81
|
+
}
|
82
|
+
if (i === "compoundVariants") {
|
83
|
+
for (const o of r) {
|
84
|
+
const { css: p, ...m } = o, E = Object.entries(m).reduce((h, [O, S]) => `${h}.${O}-${S}`, s);
|
85
|
+
(await $(p, E, t)).forEach((h) => n.add(h));
|
86
|
+
}
|
87
|
+
return;
|
88
|
+
}
|
89
|
+
if (i.startsWith("@")) {
|
90
|
+
const o = ((y = t == null ? void 0 : t.mediaQueries) == null ? void 0 : y[i]) || i, p = await V(r, s, t), m = `${o} { ${p} }`;
|
91
|
+
n.add(m);
|
92
|
+
return;
|
93
|
+
}
|
94
|
+
const a = w.includes("&") ? i.replace("&", s) : i.startsWith(":") ? `${s}${i}` : `${s} ${i}`;
|
95
|
+
(await $(r, a, t)).forEach((o) => n.add(o));
|
96
|
+
return;
|
97
|
+
}
|
98
|
+
if (typeof r == "number") {
|
99
|
+
const a = _(l, r, t);
|
100
|
+
return c(a);
|
101
|
+
}
|
102
|
+
if (typeof r != "string")
|
103
|
+
if ("toString" in r) r = r.toString();
|
104
|
+
else throw new Error(`Invalid value type for property ${l}`);
|
105
|
+
return c(r);
|
106
|
+
}), { modifiers: C } = t || {}, P = [U(), H(C)], u = (await Promise.all(b).then((w) => Promise.all(
|
107
|
+
w.map((r) => P.reduce(async (i, l) => {
|
108
|
+
const c = await i;
|
109
|
+
if (!c) return c;
|
110
|
+
const j = await l(c);
|
111
|
+
if (!j) return c;
|
112
|
+
const { transformed: y, additionalCss: a } = j;
|
113
|
+
let f = "";
|
114
|
+
if (a)
|
115
|
+
for (const o of a)
|
116
|
+
f += await V(o, "");
|
117
|
+
return `${f}${y}`;
|
118
|
+
}, Promise.resolve(r)))
|
119
|
+
))).join(`
|
120
|
+
`);
|
121
|
+
if (!u.trim()) return n;
|
122
|
+
const z = s ? `${s} { ${u} }` : u;
|
123
|
+
return n.add(z), n;
|
124
|
+
}, V = async (e, s, t) => [...await $(e, s, t)].join(`
|
125
|
+
`);
|
126
|
+
export {
|
127
|
+
V as p,
|
128
|
+
B as t
|
129
|
+
};
|
@@ -0,0 +1 @@
|
|
1
|
+
"use strict";function t(e){return e?typeof e!="string"?t(String(e)):e.replace(/[\s.]/g,"-").replace(/[A-Z](?:(?=[^A-Z])|[A-Z]*(?=[A-Z][^A-Z]|$))/g,(n,s)=>(s>0?"-":"")+n.toLowerCase()):""}const o=e=>n=>typeof n!="string"||!/\{[^{}]+\}/g.test(n)?void 0:{transformed:n.replace(/\{([^{}]+)\}/g,(...a)=>{const r=t(a[1].replaceAll(".","-"));return e&&!e.includes(r)&&console.warn(`Token ${r} might not exist`),`var(--${r})`})};exports.dashCase=t;exports.parseValueTokens=o;
|
@@ -0,0 +1,11 @@
|
|
1
|
+
function o(e) {
|
2
|
+
return e ? typeof e != "string" ? o(String(e)) : e.replace(/[\s.]/g, "-").replace(/[A-Z](?:(?=[^A-Z])|[A-Z]*(?=[A-Z][^A-Z]|$))/g, (n, t) => (t > 0 ? "-" : "") + n.toLowerCase()) : "";
|
3
|
+
}
|
4
|
+
const i = (e) => (n) => typeof n != "string" || !/\{[^{}]+\}/g.test(n) ? void 0 : { transformed: n.replace(/\{([^{}]+)\}/g, (...s) => {
|
5
|
+
const r = o(s[1].replaceAll(".", "-"));
|
6
|
+
return e && !e.includes(r) && console.warn(`Token ${r} might not exist`), `var(--${r})`;
|
7
|
+
}) };
|
8
|
+
export {
|
9
|
+
o as d,
|
10
|
+
i as p
|
11
|
+
};
|
package/styled-client.cjs
CHANGED
@@ -1 +1 @@
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const l=require("./element-factory-
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const l=require("./element-factory-xzOUBIyk.cjs"),n=(e,t,r)=>l.elementFactory(e,t,r);exports.styledClient=n;
|
package/styled-client.js
CHANGED
package/styled.cjs
CHANGED
@@ -1 +1 @@
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const m=require("./styles-generator-
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const m=require("./styles-generator-Bf-aF7sl.cjs"),g=require("./element-factory-xzOUBIyk.cjs");class h extends m.StylesGenerator{constructor(e,t){super(t),this.tagName=e,this._params=t}get priority(){var e;return typeof this.tagName=="function"||typeof this.tagName=="object"?(((e=this.tagName.generator)==null?void 0:e.priority)||0)+1:0}get clientProps(){const{element:e,variants:t={},compoundVariants:a=[],defaultVariants:d={},defaultProps:l={},passProps:u}=this.params,{callerName:y,isProduction:f}=this.buildContext,o=new Set([]),i=s=>{const r=d[s];r!==void 0?o.add(`${s}=${String(r)}`):o.add(s)};Object.keys(t).forEach(i),a.map(s=>Object.keys(s).forEach(i));const c=new Set([]);if(this.params.base){const s=JSON.stringify(this.params.base).match(/\{props\.([\w\d]+)\}/gi);s&&s.forEach(r=>{const p=r.replace(/\{props\.([\w\d]+)\}/gi,"$1");p&&c.add(p)})}return{element:e,variantKeys:[...o],propValueKeys:[...c],passProps:u,defaultProps:l,attr:{"data-component-name":f?void 0:y}}}}const b=(n,e)=>{const t=new h(n,e),a=g.elementFactory(n,t.cssClassName,t.clientProps,{"data-unoptimized-client-component":!0});return Object.assign(a,{generator:t}),a};exports.styled=b;
|
package/styled.js
CHANGED
@@ -1,5 +1,5 @@
|
|
1
|
-
import { S as y } from "./styles-generator-
|
2
|
-
import { e as h } from "./element-factory-
|
1
|
+
import { S as y } from "./styles-generator-8VCE7njI.js";
|
2
|
+
import { e as h } from "./element-factory-BqXNML99.js";
|
3
3
|
class g extends y {
|
4
4
|
constructor(e, t) {
|
5
5
|
super(t), this.tagName = e, this._params = t;
|
@@ -1,8 +1,8 @@
|
|
1
|
-
var
|
2
|
-
var
|
3
|
-
var e = (a, s, t) =>
|
4
|
-
import { t as c, p as l } from "./parse-styles-
|
5
|
-
import { d as m } from "./parse-tokens-
|
1
|
+
var n = Object.defineProperty;
|
2
|
+
var o = (a, s, t) => s in a ? n(a, s, { enumerable: !0, configurable: !0, writable: !0, value: t }) : a[s] = t;
|
3
|
+
var e = (a, s, t) => o(a, typeof s != "symbol" ? s + "" : s, t);
|
4
|
+
import { t as c, p as l } from "./parse-styles-DqV7Jbst.js";
|
5
|
+
import { d as m } from "./parse-tokens-CdNpUjpp.js";
|
6
6
|
class f {
|
7
7
|
constructor(s) {
|
8
8
|
e(this, "buildContext", {});
|
@@ -23,8 +23,8 @@ class f {
|
|
23
23
|
return s ? `cl_${m(s)}-${this.hash}.css` : `${this.hash}.css`;
|
24
24
|
}
|
25
25
|
get css() {
|
26
|
-
const { base: s = {}, variants: t = {}, compoundVariants:
|
27
|
-
return l(h, `.${this.cssClassName}`,
|
26
|
+
const { base: s = {}, variants: t = {}, compoundVariants: i = [] } = this.params, { config: r } = this.buildContext, h = { ...s, variants: t, compoundVariants: i };
|
27
|
+
return l(h, `.${this.cssClassName}`, r);
|
28
28
|
}
|
29
29
|
_withBuildContext(s) {
|
30
30
|
return this.buildContext = s, this;
|
@@ -1 +1 @@
|
|
1
|
-
"use strict";var h=Object.defineProperty;var o=(e,s,t)=>s in e?h(e,s,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[s]=t;var a=(e,s,t)=>o(e,typeof s!="symbol"?s+"":s,t);const r=require("./parse-styles-
|
1
|
+
"use strict";var h=Object.defineProperty;var o=(e,s,t)=>s in e?h(e,s,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[s]=t;var a=(e,s,t)=>o(e,typeof s!="symbol"?s+"":s,t);const r=require("./parse-styles-B4STzGjG.cjs"),l=require("./parse-tokens-CNGyn07A.cjs");class u{constructor(s){a(this,"buildContext",{});this.params=s}get hash(){return r.toHash(this.params.base||this.params)}get cssClassName(){return this.hash}get classNames(){const s=[this.hash],{className:t}=this.params;return typeof t=="string"&&s.push(t),typeof t=="object"&&s.push(...t),s.join(" ")}get cssFileName(){const{callerName:s}=this.buildContext;return s?`cl_${l.dashCase(s)}-${this.hash}.css`:`${this.hash}.css`}get css(){const{base:s={},variants:t={},compoundVariants:i=[]}=this.params,{config:n}=this.buildContext,c={...s,variants:t,compoundVariants:i};return r.parseAndJoinStyles(c,`.${this.cssClassName}`,n)}_withBuildContext(s){return this.buildContext=s,this}}exports.StylesGenerator=u;
|
@@ -1,7 +0,0 @@
|
|
1
|
-
"use strict";const y=require("./parse-tokens-p68muVgG.cjs"),z=(r,s)=>{if(typeof r!="string")return{result:r};if(!s)return{result:r};const t=[];return Object.values(s).forEach(n=>{const{pattern:p,transform:j}=n;r=r.replace(p,o=>{const{value:$,css:e}=j(o);return e&&t.push(e),$})}),{result:r,additionalCss:t}},E=r=>String.fromCharCode(r+(r>25?39:97)),A=(r,s)=>{let t="",n;for(n=Math.abs(r);n>52;n=n/52|0)t=E(n%52)+t;return t=E(n%52)+t,t.length<s?t=t.padStart(s,"a"):t.length>s&&(t=t.slice(-s)),t},C=(r,s)=>{let t=s.length;for(;t;)r=r*33^s.charCodeAt(--t);return r},H=(r,s=5)=>{const t=C(5381,JSON.stringify(r))>>>0;return A(t,s)},M=["top","right","bottom","left","min-width",/.*width.*/,/^[^line]*height.*/,/padding.*/,/margin.*/,/border.*/,/inset.*/,/.*radius.*/,/.*spacing.*/,/.*gap.*/,/.*indent.*/,/.*offset.*/,/.*size.*/,/.*thickness.*/,/.*font-size.*/],T=(r,s,t)=>{if(M.some(p=>typeof p=="string"?p===r:p.test(r))){const p=(t==null?void 0:t.defaultUnit)||"px";return`${s}${p}`}return`${s}`},U=["Webkit","Moz","ms","O"],q=r=>r.startsWith("-")?r:U.some(s=>r.startsWith(s))?`-${y.dashCase(r)}`:y.dashCase(r),c=(r,s,t)=>{if(!r)return"";const n=[],p=Object.entries(r).reduce((o,[$,e])=>{var P;const i=$.trim(),w=q(i),O=(h,f=";")=>o=`${o}${h}${f}`,b=h=>O(`${w}:${h}`);if(typeof e=="function"&&(e=e()),typeof e=="object"){if(!e)return o;if(e.isColor)return b(e.toString()),o;if(i==="variants")return Object.entries(e).forEach(([u,a])=>{a&&Object.entries(a).forEach(([d,m])=>{if(!m)return;const l=`${s}.${u}-${d}`,S=c(m,l,t);n.push(S)})}),o;if(i==="defaultVariants")return o;if(i==="compoundVariants")return e.forEach(u=>{const{css:a,...d}=u,m=Object.entries(d).reduce((S,[N,x])=>`${S}.${N}-${x}`,s),l=c(a,m,t);n.push(l)}),o;if(i.startsWith("@")){const u=((P=t==null?void 0:t.mediaQueries)==null?void 0:P[i])||i,a=c(e,s,t),d=`${u} {
|
2
|
-
${a.replace(`
|
3
|
-
`,`
|
4
|
-
`)}
|
5
|
-
}`;return n.push(d),o}const h=$.includes("&")?i.replace("&",s):i.startsWith(":")?`${s}${i}`:`${s} ${i}`,f=c(e,h,t);return n.push(f),o}if(t!=null&&t.templates&&t.templates[i]){const f=e.split(".").reduce((u,a)=>u[a],t.templates[i]);if(f){const u=c(f,"");return`${o}${u}`}return console.warn(`Template "${i}" with path of "${e}" was not found in config!`),o}if(typeof e=="number"){const h=T(w,e,t);return b(h)}if(typeof e!="string")if("toString"in e)e=e.toString();else return o;const{modifiers:V}=t||{},W=function*(){yield y.parseValueTokens(e),yield z(e,V)}();for(const{result:h,additionalCss:f=[]}of W)e=h,f.forEach(u=>{const a=c(u,"");O(a,"")});return b(e)},"");return p?s?[`${s} { ${p} }`,...n].join(`
|
6
|
-
`):p:n.join(`
|
7
|
-
`)};exports.parseStyles=c;exports.toHash=H;
|
package/parse-styles-p4rBqcpk.js
DELETED
@@ -1,118 +0,0 @@
|
|
1
|
-
import { d as P, p as z } from "./parse-tokens-YUi047xd.js";
|
2
|
-
const A = (r, s) => {
|
3
|
-
if (typeof r != "string") return { result: r };
|
4
|
-
if (!s) return { result: r };
|
5
|
-
const t = [];
|
6
|
-
return Object.values(s).forEach((n) => {
|
7
|
-
const { pattern: p, transform: j } = n;
|
8
|
-
r = r.replace(p, (o) => {
|
9
|
-
const { value: $, css: e } = j(o);
|
10
|
-
return e && t.push(e), $;
|
11
|
-
});
|
12
|
-
}), { result: r, additionalCss: t };
|
13
|
-
}, E = (r) => String.fromCharCode(r + (r > 25 ? 39 : 97)), M = (r, s) => {
|
14
|
-
let t = "", n;
|
15
|
-
for (n = Math.abs(r); n > 52; n = n / 52 | 0) t = E(n % 52) + t;
|
16
|
-
return t = E(n % 52) + t, t.length < s ? t = t.padStart(s, "a") : t.length > s && (t = t.slice(-s)), t;
|
17
|
-
}, U = (r, s) => {
|
18
|
-
let t = s.length;
|
19
|
-
for (; t; ) r = r * 33 ^ s.charCodeAt(--t);
|
20
|
-
return r;
|
21
|
-
}, _ = (r, s = 5) => {
|
22
|
-
const t = U(5381, JSON.stringify(r)) >>> 0;
|
23
|
-
return M(t, s);
|
24
|
-
}, C = [
|
25
|
-
"top",
|
26
|
-
"right",
|
27
|
-
"bottom",
|
28
|
-
"left",
|
29
|
-
"min-width",
|
30
|
-
/.*width.*/,
|
31
|
-
/^[^line]*height.*/,
|
32
|
-
// Exclude line-height
|
33
|
-
/padding.*/,
|
34
|
-
/margin.*/,
|
35
|
-
/border.*/,
|
36
|
-
/inset.*/,
|
37
|
-
/.*radius.*/,
|
38
|
-
/.*spacing.*/,
|
39
|
-
/.*gap.*/,
|
40
|
-
/.*indent.*/,
|
41
|
-
/.*offset.*/,
|
42
|
-
/.*size.*/,
|
43
|
-
/.*thickness.*/,
|
44
|
-
/.*font-size.*/
|
45
|
-
], H = (r, s, t) => {
|
46
|
-
if (C.some((p) => typeof p == "string" ? p === r : p.test(r))) {
|
47
|
-
const p = (t == null ? void 0 : t.defaultUnit) || "px";
|
48
|
-
return `${s}${p}`;
|
49
|
-
}
|
50
|
-
return `${s}`;
|
51
|
-
}, Q = ["Webkit", "Moz", "ms", "O"], T = (r) => r.startsWith("-") ? r : Q.some((s) => r.startsWith(s)) ? `-${P(r)}` : P(r), d = (r, s, t) => {
|
52
|
-
if (!r) return "";
|
53
|
-
const n = [], p = Object.entries(r).reduce((o, [$, e]) => {
|
54
|
-
var O;
|
55
|
-
const i = $.trim(), y = T(i), w = (f, a = ";") => o = `${o}${f}${a}`, b = (f) => w(`${y}:${f}`);
|
56
|
-
if (typeof e == "function" && (e = e()), typeof e == "object") {
|
57
|
-
if (!e) return o;
|
58
|
-
if (e.isColor)
|
59
|
-
return b(e.toString()), o;
|
60
|
-
if (i === "variants")
|
61
|
-
return Object.entries(e).forEach(([u, h]) => {
|
62
|
-
h && Object.entries(h).forEach(([c, m]) => {
|
63
|
-
if (!m) return;
|
64
|
-
const l = `${s}.${u}-${c}`, S = d(m, l, t);
|
65
|
-
n.push(S);
|
66
|
-
});
|
67
|
-
}), o;
|
68
|
-
if (i === "defaultVariants")
|
69
|
-
return o;
|
70
|
-
if (i === "compoundVariants")
|
71
|
-
return e.forEach((u) => {
|
72
|
-
const { css: h, ...c } = u, m = Object.entries(c).reduce((S, [x, N]) => `${S}.${x}-${N}`, s), l = d(h, m, t);
|
73
|
-
n.push(l);
|
74
|
-
}), o;
|
75
|
-
if (i.startsWith("@")) {
|
76
|
-
const u = ((O = t == null ? void 0 : t.mediaQueries) == null ? void 0 : O[i]) || i, h = d(e, s, t), c = `${u} {
|
77
|
-
${h.replace(`
|
78
|
-
`, `
|
79
|
-
`)}
|
80
|
-
}`;
|
81
|
-
return n.push(c), o;
|
82
|
-
}
|
83
|
-
const f = $.includes("&") ? i.replace("&", s) : i.startsWith(":") ? `${s}${i}` : `${s} ${i}`, a = d(e, f, t);
|
84
|
-
return n.push(a), o;
|
85
|
-
}
|
86
|
-
if (t != null && t.templates && t.templates[i]) {
|
87
|
-
const a = e.split(".").reduce((u, h) => u[h], t.templates[i]);
|
88
|
-
if (a) {
|
89
|
-
const u = d(a, "");
|
90
|
-
return `${o}${u}`;
|
91
|
-
}
|
92
|
-
return console.warn(`Template "${i}" with path of "${e}" was not found in config!`), o;
|
93
|
-
}
|
94
|
-
if (typeof e == "number") {
|
95
|
-
const f = H(y, e, t);
|
96
|
-
return b(f);
|
97
|
-
}
|
98
|
-
if (typeof e != "string")
|
99
|
-
if ("toString" in e) e = e.toString();
|
100
|
-
else return o;
|
101
|
-
const { modifiers: V } = t || {}, W = function* () {
|
102
|
-
yield z(e), yield A(e, V);
|
103
|
-
}();
|
104
|
-
for (const { result: f, additionalCss: a = [] } of W)
|
105
|
-
e = f, a.forEach((u) => {
|
106
|
-
const h = d(u, "");
|
107
|
-
w(h, "");
|
108
|
-
});
|
109
|
-
return b(e);
|
110
|
-
}, "");
|
111
|
-
return p ? s ? [`${s} { ${p} }`, ...n].join(`
|
112
|
-
`) : p : n.join(`
|
113
|
-
`);
|
114
|
-
};
|
115
|
-
export {
|
116
|
-
d as p,
|
117
|
-
_ as t
|
118
|
-
};
|
package/parse-tokens-YUi047xd.js
DELETED
@@ -1,8 +0,0 @@
|
|
1
|
-
function n(e) {
|
2
|
-
return e ? typeof e != "string" ? n(String(e)) : e.replace(/[\s.]/g, "-").replace(/[A-Z](?:(?=[^A-Z])|[A-Z]*(?=[A-Z][^A-Z]|$))/g, (r, t) => (t > 0 ? "-" : "") + r.toLowerCase()) : "";
|
3
|
-
}
|
4
|
-
const o = (e) => typeof e != "string" ? { result: e } : /\{[^{}]+\}/g.test(e) ? { result: e.replace(/\{([^{}]+)\}/g, (...s) => `var(--${n(s[1].replaceAll(".", "-"))})`) } : { result: e };
|
5
|
-
export {
|
6
|
-
n as d,
|
7
|
-
o as p
|
8
|
-
};
|
@@ -1 +0,0 @@
|
|
1
|
-
"use strict";function r(e){return e?typeof e!="string"?r(String(e)):e.replace(/[\s.]/g,"-").replace(/[A-Z](?:(?=[^A-Z])|[A-Z]*(?=[A-Z][^A-Z]|$))/g,(t,s)=>(s>0?"-":"")+t.toLowerCase()):""}const a=e=>typeof e!="string"?{result:e}:/\{[^{}]+\}/g.test(e)?{result:e.replace(/\{([^{}]+)\}/g,(...n)=>`var(--${r(n[1].replaceAll(".","-"))})`)}:{result:e};exports.dashCase=r;exports.parseValueTokens=a;
|