@salty-css/react 0.0.1-alpha.1 → 0.0.1-alpha.11

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/README.md CHANGED
@@ -54,8 +54,10 @@ export const IndexPage = () => {
54
54
  import { styled } from '@salty-css/react/styled';
55
55
 
56
56
  export const Wrapper = styled('div', {
57
- display: 'block',
58
- padding: '2vw',
57
+ base: {
58
+ display: 'block',
59
+ padding: '2vw',
60
+ },
59
61
  });
60
62
  ```
61
63
 
@@ -65,22 +67,24 @@ export const Wrapper = styled('div', {
65
67
  import { styled } from '@salty-css/react/styled';
66
68
 
67
69
  export const Button = styled('button', {
68
- display: 'block',
69
- padding: `0.6em 1.2em`,
70
- border: '1px solid currentColor',
71
- background: 'transparent',
72
- color: 'currentColor/40',
73
- cursor: 'pointer',
74
- transition: '200ms',
75
- textDecoration: 'none',
76
- '&:hover': {
77
- background: 'black',
78
- borderColor: 'black',
79
- color: 'white',
80
- },
81
- '&:disabled': {
82
- opacity: 0.25,
83
- pointerEvents: 'none',
70
+ base: {
71
+ display: 'block',
72
+ padding: `0.6em 1.2em`,
73
+ border: '1px solid currentColor',
74
+ background: 'transparent',
75
+ color: 'currentColor/40',
76
+ cursor: 'pointer',
77
+ transition: '200ms',
78
+ textDecoration: 'none',
79
+ '&:hover': {
80
+ background: 'black',
81
+ borderColor: 'black',
82
+ color: 'white',
83
+ },
84
+ '&:disabled': {
85
+ opacity: 0.25,
86
+ pointerEvents: 'none',
87
+ },
84
88
  },
85
89
  variants: {
86
90
  variant: {
@@ -0,0 +1,6 @@
1
+ function t(e) {
2
+ return e ? typeof e != "string" ? String(e) : e.replace(/\s/g, "-").replace(/[A-Z](?:(?=[^A-Z])|[A-Z]*(?=[A-Z][^A-Z]|$))/g, (r, n) => (n > 0 ? "-" : "") + r.toLowerCase()) : "";
3
+ }
4
+ export {
5
+ t as d
6
+ };
@@ -0,0 +1 @@
1
+ "use strict";function t(e){return e?typeof e!="string"?String(e):e.replace(/\s/g,"-").replace(/[A-Z](?:(?=[^A-Z])|[A-Z]*(?=[A-Z][^A-Z]|$))/g,(r,n)=>(n>0?"-":"")+r.toLowerCase()):""}exports.dashCase=t;
@@ -0,0 +1 @@
1
+ "use strict";const w=require("react"),N=require("./dash-case-BSxADP5V.cjs");function E(t){var n,o,e="";if(typeof t=="string"||typeof t=="number")e+=t;else if(typeof t=="object")if(Array.isArray(t)){var f=t.length;for(n=0;n<f;n++)t[n]&&(o=E(t[n]))&&(e&&(e+=" "),e+=o)}else for(o in t)t[o]&&(e&&(e+=" "),e+=o);return e}function q(){for(var t,n,o=0,e="",f=arguments.length;o<f;o++)(t=arguments[o])&&(n=E(t))&&(e&&(e+=" "),e+=n);return e}const A=["passVariantProps"],F=(t,n,o,e,f)=>{const $=({extend:c=t,element:b=o,className:p="",children:C,passVariantProps:j,cssValues:u,_vks:a=new Set,...d},O)=>{const s={passVariantProps:j};f&&Object.assign(s,f),d&&Object.assign(s,d);const g=new Set(p.split(" ")),l=typeof c=="function"||typeof c=="object",m=l&&"isStyled"in c,S=l?c:b||c;if(!S)throw new Error("No element provided");u&&(console.log(u),s.style||(s.style={}),Object.entries(u).forEach(([i,r])=>{const y=`--${N.dashCase(i)}`;s.style[y]=r})),e&&e.forEach(i=>{const[r,y]=i.split("=");d[r]!==void 0?(g.add(`${r}-${d[r]}`),l?a&&a.add(r):delete s[r]):y!==void 0&&g.add(`${r}-${y}`)}),a&&(!l||!m&&!j)?a.forEach(i=>delete s[i]):m&&Object.assign(s,{_vks:a}),m||A.forEach(i=>delete s[i]);const v=q(n,...g);return w.createElement(S,{element:l?b:void 0,className:v,ref:O,...s},C)},h=w.forwardRef($);return Object.assign(h,{isStyled:!0,className:n,toString:()=>`.${n}`}),h};exports.elementFactory=F;
@@ -0,0 +1,49 @@
1
+ import { forwardRef as C, createElement as v } from "react";
2
+ import { d as N } from "./dash-case-BLMDQfZk.js";
3
+ function S(t) {
4
+ var o, n, e = "";
5
+ if (typeof t == "string" || typeof t == "number") e += t;
6
+ else if (typeof t == "object") if (Array.isArray(t)) {
7
+ var f = t.length;
8
+ for (o = 0; o < f; o++) t[o] && (n = S(t[o])) && (e && (e += " "), e += n);
9
+ } else for (n in t) t[n] && (e && (e += " "), e += n);
10
+ return e;
11
+ }
12
+ function A() {
13
+ for (var t, o, n = 0, e = "", f = arguments.length; n < f; n++) (t = arguments[n]) && (o = S(t)) && (e && (e += " "), e += o);
14
+ return e;
15
+ }
16
+ const K = ["passVariantProps"], x = (t, o, n, e, f) => {
17
+ const b = C(({ extend: a = t, element: h = n, className: w = "", children: E, passVariantProps: j, cssValues: m, _vks: l = /* @__PURE__ */ new Set(), ...d }, $) => {
18
+ const r = { passVariantProps: j };
19
+ f && Object.assign(r, f), d && Object.assign(r, d);
20
+ const g = new Set(w.split(" ")), c = typeof a == "function" || typeof a == "object", u = c && "isStyled" in a, p = c ? a : h || a;
21
+ if (!p) throw new Error("No element provided");
22
+ m && (console.log(m), r.style || (r.style = {}), Object.entries(m).forEach(([i, s]) => {
23
+ const y = `--${N(i)}`;
24
+ r.style[y] = s;
25
+ })), e && e.forEach((i) => {
26
+ const [s, y] = i.split("=");
27
+ d[s] !== void 0 ? (g.add(`${s}-${d[s]}`), c ? l && l.add(s) : delete r[s]) : y !== void 0 && g.add(`${s}-${y}`);
28
+ }), l && (!c || !u && !j) ? l.forEach((i) => delete r[i]) : u && Object.assign(r, { _vks: l }), u || K.forEach((i) => delete r[i]);
29
+ const O = A(o, ...g);
30
+ return v(
31
+ p,
32
+ {
33
+ element: c ? h : void 0,
34
+ className: O,
35
+ ref: $,
36
+ ...r
37
+ },
38
+ E
39
+ );
40
+ });
41
+ return Object.assign(b, {
42
+ isStyled: !0,
43
+ className: o,
44
+ toString: () => `.${o}`
45
+ }), b;
46
+ };
47
+ export {
48
+ x as e
49
+ };
@@ -0,0 +1,2 @@
1
+ import { StyledComponentProps, Tag } from '../../core/src/types';
2
+ export declare const elementFactory: (tagName: Tag<any>, _className: string, _element?: string, _variantKeys?: string[], _additionalProps?: Record<PropertyKey, any>) => import('react').ForwardRefExoticComponent<Omit<StyledComponentProps, "ref"> & import('react').RefAttributes<any>>;
package/keyframes.cjs ADDED
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const c=require("./parse-styles-CsUEXYf5.cjs"),b=({animationName:u,params:l,appendInitialStyles:m,...t})=>{const s=u||c.toHash(t),n=(r={})=>{const{duration:e="500ms",easing:o="ease-in-out",delay:a="0s",iterationCount:i="1",direction:S="normal",fillMode:d="forwards",playState:p="running"}={...l,...r},$=`${s} ${e} ${o} ${a} ${i} ${S} ${d} ${p}`;if(!m)return $;const g=c.parseStyles(t.from||t["0%"],"");return`${$};${g}`},y=Object.entries(t).reduce((r,[e,o])=>{const a=c.parseStyles(o,""),i=typeof e=="number"?`${e}%`:e;return`${r}${i}{${a}}`},""),f=`@keyframes ${s} {${y}}`;return Object.assign(n,{toString:n,isKeyframes:!0,animationName:s,css:f,keyframes:t}),n};exports.keyframes=b;
package/keyframes.d.ts ADDED
@@ -0,0 +1,22 @@
1
+ import { CssStyles, StyleValue } from '../../core/src/types';
2
+ type KeyframeKeys = number | 'from' | 'to' | `${number}%`;
3
+ type Keyframes = {
4
+ [key in KeyframeKeys]: CssStyles;
5
+ };
6
+ interface KeyframesConfig {
7
+ animationName?: string;
8
+ appendInitialStyles?: boolean;
9
+ params?: KeyframesParams;
10
+ }
11
+ interface KeyframesParams {
12
+ duration?: string;
13
+ delay?: string;
14
+ iterationCount?: string | number;
15
+ easing?: StyleValue<'animationTimingFunction'>;
16
+ direction?: StyleValue<'animationDirection'>;
17
+ fillMode?: StyleValue<'animationFillMode'>;
18
+ playState?: StyleValue<'animationPlayState'>;
19
+ }
20
+ type KeyframesProps = Keyframes & KeyframesConfig;
21
+ export declare const keyframes: ({ animationName: _name, params: _params, appendInitialStyles, ...keyframes }: KeyframesProps) => (params?: KeyframesParams) => string;
22
+ export {};
package/keyframes.js ADDED
@@ -0,0 +1,30 @@
1
+ import { t as b, p as c } from "./parse-styles-jRJiQaik.js";
2
+ const C = ({ animationName: m, params: u, appendInitialStyles: f, ...t }) => {
3
+ const s = m || b(t), e = (r = {}) => {
4
+ const {
5
+ duration: n = "500ms",
6
+ easing: o = "ease-in-out",
7
+ delay: a = "0s",
8
+ iterationCount: i = "1",
9
+ direction: d = "normal",
10
+ fillMode: y = "forwards",
11
+ playState: S = "running"
12
+ } = { ...u, ...r }, $ = `${s} ${n} ${o} ${a} ${i} ${d} ${y} ${S}`;
13
+ if (!f) return $;
14
+ const g = c(t.from || t["0%"], "");
15
+ return `${$};${g}`;
16
+ }, l = Object.entries(t).reduce((r, [n, o]) => {
17
+ const a = c(o, ""), i = typeof n == "number" ? `${n}%` : n;
18
+ return `${r}${i}{${a}}`;
19
+ }, ""), p = `@keyframes ${s} {${l}}`;
20
+ return Object.assign(e, {
21
+ toString: e,
22
+ isKeyframes: !0,
23
+ animationName: s,
24
+ css: p,
25
+ keyframes: t
26
+ }), e;
27
+ };
28
+ export {
29
+ C as keyframes
30
+ };
package/media.cjs ADDED
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});class n{constructor(e="@media"){this.base=e,this.next=t=>{const s=new String(t);return Object.assign(s,{get and(){return new n(`${t} and`)},get or(){return new n(`${t},`)}}),s}}custom(e){return this.next(`${this.base} ${e}`)}minWidth(e){const t=typeof e=="number"?`${e}px`:e,s=`${this.base} (min-width: ${t})`;return this.next(s)}maxWidth(e){const t=typeof e=="number"?`${e}px`:e,s=`${this.base} (max-width: ${t})`;return this.next(s)}minHeight(e){const t=typeof e=="number"?`${e}px`:e,s=`${this.base} (min-height: ${t})`;return this.next(s)}maxHeight(e){const t=typeof e=="number"?`${e}px`:e,s=`${this.base} (max-height: ${t})`;return this.next(s)}get portrait(){const e=`${this.base} (orientation: portrait)`;return this.next(e)}get landscape(){const e=`${this.base} (orientation: landscape)`;return this.next(e)}prefersColorScheme(e){const t=`${this.base} (prefers-color-scheme: ${e})`;return this.next(t)}get dark(){return this.prefersColorScheme("dark")}get light(){return this.prefersColorScheme("light")}get print(){const e=`${this.base} print`;return this.next(e)}get screen(){const e=`${this.base} screen`;return this.next(e)}get speech(){const e=`${this.base} speech`;return this.next(e)}get all(){const e=`${this.base} all`;return this.next(e)}get not(){const e=`${this.base} not`;return this.next(e)}get reducedMotion(){const e=`${this.base} (prefers-reduced-motion: reduce)`;return this.next(e)}}const r=new n;exports.MediaQueryFactory=n;exports.media=r;
package/media.d.ts ADDED
@@ -0,0 +1,71 @@
1
+ import { OrNumber, OrString } from '../../core/src/types/util-types';
2
+ export declare class MediaQueryFactory {
3
+ private base;
4
+ constructor(base?: string);
5
+ private next;
6
+ custom(value: string): string & {
7
+ and: MediaQueryFactory;
8
+ or: MediaQueryFactory;
9
+ };
10
+ minWidth(width: OrString | OrNumber): string & {
11
+ and: MediaQueryFactory;
12
+ or: MediaQueryFactory;
13
+ };
14
+ maxWidth(width: OrString | OrNumber): string & {
15
+ and: MediaQueryFactory;
16
+ or: MediaQueryFactory;
17
+ };
18
+ minHeight(height: OrString | OrNumber): string & {
19
+ and: MediaQueryFactory;
20
+ or: MediaQueryFactory;
21
+ };
22
+ maxHeight(height: OrString | OrNumber): string & {
23
+ and: MediaQueryFactory;
24
+ or: MediaQueryFactory;
25
+ };
26
+ get portrait(): string & {
27
+ and: MediaQueryFactory;
28
+ or: MediaQueryFactory;
29
+ };
30
+ get landscape(): string & {
31
+ and: MediaQueryFactory;
32
+ or: MediaQueryFactory;
33
+ };
34
+ prefersColorScheme(scheme: 'dark' | 'light' | OrString): string & {
35
+ and: MediaQueryFactory;
36
+ or: MediaQueryFactory;
37
+ };
38
+ get dark(): string & {
39
+ and: MediaQueryFactory;
40
+ or: MediaQueryFactory;
41
+ };
42
+ get light(): string & {
43
+ and: MediaQueryFactory;
44
+ or: MediaQueryFactory;
45
+ };
46
+ get print(): string & {
47
+ and: MediaQueryFactory;
48
+ or: MediaQueryFactory;
49
+ };
50
+ get screen(): string & {
51
+ and: MediaQueryFactory;
52
+ or: MediaQueryFactory;
53
+ };
54
+ get speech(): string & {
55
+ and: MediaQueryFactory;
56
+ or: MediaQueryFactory;
57
+ };
58
+ get all(): string & {
59
+ and: MediaQueryFactory;
60
+ or: MediaQueryFactory;
61
+ };
62
+ get not(): string & {
63
+ and: MediaQueryFactory;
64
+ or: MediaQueryFactory;
65
+ };
66
+ get reducedMotion(): string & {
67
+ and: MediaQueryFactory;
68
+ or: MediaQueryFactory;
69
+ };
70
+ }
71
+ export declare const media: MediaQueryFactory;
package/media.js ADDED
@@ -0,0 +1,81 @@
1
+ class n {
2
+ constructor(t = "@media") {
3
+ this.base = t, this.next = (e) => {
4
+ const s = new String(e);
5
+ return Object.assign(s, {
6
+ get and() {
7
+ return new n(`${e} and`);
8
+ },
9
+ get or() {
10
+ return new n(`${e},`);
11
+ }
12
+ }), s;
13
+ };
14
+ }
15
+ custom(t) {
16
+ return this.next(`${this.base} ${t}`);
17
+ }
18
+ minWidth(t) {
19
+ const e = typeof t == "number" ? `${t}px` : t, s = `${this.base} (min-width: ${e})`;
20
+ return this.next(s);
21
+ }
22
+ maxWidth(t) {
23
+ const e = typeof t == "number" ? `${t}px` : t, s = `${this.base} (max-width: ${e})`;
24
+ return this.next(s);
25
+ }
26
+ minHeight(t) {
27
+ const e = typeof t == "number" ? `${t}px` : t, s = `${this.base} (min-height: ${e})`;
28
+ return this.next(s);
29
+ }
30
+ maxHeight(t) {
31
+ const e = typeof t == "number" ? `${t}px` : t, s = `${this.base} (max-height: ${e})`;
32
+ return this.next(s);
33
+ }
34
+ get portrait() {
35
+ const t = `${this.base} (orientation: portrait)`;
36
+ return this.next(t);
37
+ }
38
+ get landscape() {
39
+ const t = `${this.base} (orientation: landscape)`;
40
+ return this.next(t);
41
+ }
42
+ prefersColorScheme(t) {
43
+ const e = `${this.base} (prefers-color-scheme: ${t})`;
44
+ return this.next(e);
45
+ }
46
+ get dark() {
47
+ return this.prefersColorScheme("dark");
48
+ }
49
+ get light() {
50
+ return this.prefersColorScheme("light");
51
+ }
52
+ get print() {
53
+ const t = `${this.base} print`;
54
+ return this.next(t);
55
+ }
56
+ get screen() {
57
+ const t = `${this.base} screen`;
58
+ return this.next(t);
59
+ }
60
+ get speech() {
61
+ const t = `${this.base} speech`;
62
+ return this.next(t);
63
+ }
64
+ get all() {
65
+ const t = `${this.base} all`;
66
+ return this.next(t);
67
+ }
68
+ get not() {
69
+ const t = `${this.base} not`;
70
+ return this.next(t);
71
+ }
72
+ get reducedMotion() {
73
+ const t = `${this.base} (prefers-reduced-motion: reduce)`;
74
+ return this.next(t);
75
+ }
76
+ }
77
+ const r = new n();
78
+ export {
79
+ n as MediaQueryFactory,
80
+ r as media
81
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@salty-css/react",
3
- "version": "0.0.1-alpha.1",
3
+ "version": "0.0.1-alpha.11",
4
4
  "main": "./dist/index.js",
5
5
  "module": "./dist/index.mjs",
6
6
  "typings": "./dist/index.d.ts",
@@ -15,10 +15,11 @@
15
15
  "url": "https://github.com/margarita-form/salty-css/issues"
16
16
  },
17
17
  "files": [
18
- "dist",
18
+ "**/*",
19
19
  "!**/*.tsbuildinfo"
20
20
  ],
21
21
  "nx": {
22
+ "sourceRoot": "libs/react/src",
22
23
  "name": "react"
23
24
  },
24
25
  "exports": {
@@ -0,0 +1,7 @@
1
+ "use strict";const V=require("./dash-case-BSxADP5V.cjs"),E=r=>String.fromCharCode(r+(r>25?39:97)),P=(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},T=(r,s)=>{let t=s.length;for(;t;)r=r*33^s.charCodeAt(--t);return r},W=(r,s=3)=>{const t=T(5381,JSON.stringify(r))>>>0;return P(t,s)},q=(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:$}=n;r=r.replace(p,d=>{const{value:i,css:l}=$(d);return l&&t.push(l),i})}),{result:r,additionalCss:t}},M=r=>typeof r!="string"?{result:r}:/\{[^{}]+\}/g.test(r)?{result:r.replace(/\{([^{}]+)\}/g,(...n)=>`var(--${V.dashCase(n[1].replaceAll(".","-"))})`)}:{result:r},a=(r,s,t,n)=>{const p=[],$=Object.entries(r).reduce((i,[l,e])=>{const o=l.trim();if(typeof e=="function"&&(e=e()),typeof e=="object"){if(!e)return i;if(o==="variants")return Object.entries(e).forEach(([f,c])=>{c&&Object.entries(c).forEach(([m,b])=>{if(!b)return;const y=`${s}.${f}-${m}`,S=a(b,y,t);p.push(S)})}),i;if(o==="defaultVariants")return i;if(o==="compoundVariants")return e.forEach(f=>{const{css:c,...m}=f,b=Object.entries(m).reduce((S,[H,N])=>`${S}.${H}-${N}`,s),y=a(c,b,t);p.push(y)}),i;if(o.startsWith("@")){const f=a(e,s,t),c=`${o} {
2
+ ${f.replace(`
3
+ `,`
4
+ `)}
5
+ }`;return p.push(c),i}const u=l.includes("&")?o.replace("&",s):o.startsWith(":")?`${s}${o}`:`${s} ${o}`,h=a(e,u,t);return p.push(h),i}if(n!=null&&n.templates&&n.templates[o]){const h=e.split(".").reduce((c,m)=>c[m],n.templates[o]),f=a(h,"");return`${i}${f}`}const g=o.startsWith("-")?o:V.dashCase(o),j=(u,h=";")=>i=`${i}${u}${h}`,O=u=>j(`${g}:${u}`);if(typeof e=="number")return O(e);if(typeof e!="string")if("toString"in e)e=e.toString();else return i;const{modifiers:A}=n||{},k=function*(){yield M(e),yield q(e,A)}();for(const{result:u,additionalCss:h=[]}of k)e=u,h.forEach(f=>{const c=a(f,"");j(c,"")});return O(e)},"");if(!$)return p.join(`
6
+ `);if(!s)return $;let d="";return t!==void 0?d=`@layer l${t} { ${s} { ${$} } }`:d=`${s} { ${$} }`,[d,...p].join(`
7
+ `)};exports.parseStyles=a;exports.toHash=W;
@@ -0,0 +1,84 @@
1
+ import { d as V } from "./dash-case-BLMDQfZk.js";
2
+ const E = (r) => String.fromCharCode(r + (r > 25 ? 39 : 97)), T = (r, s) => {
3
+ let t = "", n;
4
+ for (n = Math.abs(r); n > 52; n = n / 52 | 0) t = E(n % 52) + t;
5
+ return t = E(n % 52) + t, t.length < s ? t = t.padStart(s, "a") : t.length > s && (t = t.slice(-s)), t;
6
+ }, W = (r, s) => {
7
+ let t = s.length;
8
+ for (; t; ) r = r * 33 ^ s.charCodeAt(--t);
9
+ return r;
10
+ }, x = (r, s = 3) => {
11
+ const t = W(5381, JSON.stringify(r)) >>> 0;
12
+ return T(t, s);
13
+ }, H = (r, s) => {
14
+ if (typeof r != "string") return { result: r };
15
+ if (!s) return { result: r };
16
+ const t = [];
17
+ return Object.values(s).forEach((n) => {
18
+ const { pattern: c, transform: a } = n;
19
+ r = r.replace(c, (d) => {
20
+ const { value: i, css: m } = a(d);
21
+ return m && t.push(m), i;
22
+ });
23
+ }), { result: r, additionalCss: t };
24
+ }, M = (r) => typeof r != "string" ? { result: r } : /\{[^{}]+\}/g.test(r) ? { result: r.replace(/\{([^{}]+)\}/g, (...n) => `var(--${V(n[1].replaceAll(".", "-"))})`) } : { result: r }, $ = (r, s, t, n) => {
25
+ const c = [], a = Object.entries(r).reduce((i, [m, e]) => {
26
+ const o = m.trim();
27
+ if (typeof e == "function" && (e = e()), typeof e == "object") {
28
+ if (!e) return i;
29
+ if (o === "variants")
30
+ return Object.entries(e).forEach(([f, p]) => {
31
+ p && Object.entries(p).forEach(([l, b]) => {
32
+ if (!b) return;
33
+ const j = `${s}.${f}-${l}`, y = $(b, j, t);
34
+ c.push(y);
35
+ });
36
+ }), i;
37
+ if (o === "defaultVariants")
38
+ return i;
39
+ if (o === "compoundVariants")
40
+ return e.forEach((f) => {
41
+ const { css: p, ...l } = f, b = Object.entries(l).reduce((y, [N, P]) => `${y}.${N}-${P}`, s), j = $(p, b, t);
42
+ c.push(j);
43
+ }), i;
44
+ if (o.startsWith("@")) {
45
+ const f = $(e, s, t), p = `${o} {
46
+ ${f.replace(`
47
+ `, `
48
+ `)}
49
+ }`;
50
+ return c.push(p), i;
51
+ }
52
+ const u = m.includes("&") ? o.replace("&", s) : o.startsWith(":") ? `${s}${o}` : `${s} ${o}`, h = $(e, u, t);
53
+ return c.push(h), i;
54
+ }
55
+ if (n != null && n.templates && n.templates[o]) {
56
+ const h = e.split(".").reduce((p, l) => p[l], n.templates[o]), f = $(h, "");
57
+ return `${i}${f}`;
58
+ }
59
+ const g = o.startsWith("-") ? o : V(o), S = (u, h = ";") => i = `${i}${u}${h}`, O = (u) => S(`${g}:${u}`);
60
+ if (typeof e == "number") return O(e);
61
+ if (typeof e != "string")
62
+ if ("toString" in e) e = e.toString();
63
+ else return i;
64
+ const { modifiers: A } = n || {}, k = function* () {
65
+ yield M(e), yield H(e, A);
66
+ }();
67
+ for (const { result: u, additionalCss: h = [] } of k)
68
+ e = u, h.forEach((f) => {
69
+ const p = $(f, "");
70
+ S(p, "");
71
+ });
72
+ return O(e);
73
+ }, "");
74
+ if (!a) return c.join(`
75
+ `);
76
+ if (!s) return a;
77
+ let d = "";
78
+ return t !== void 0 ? d = `@layer l${t} { ${s} { ${a} } }` : d = `${s} { ${a} }`, [d, ...c].join(`
79
+ `);
80
+ };
81
+ export {
82
+ $ as p,
83
+ x as t
84
+ };
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const l=require("./element-factory-BCMNslLa.cjs"),a=(e,t,n,o,r)=>l.elementFactory(e,t,o,r,{"data-component-name":n});exports.styledClient=a;
@@ -0,0 +1,2 @@
1
+ import { Tag } from '../../core/src/types';
2
+ export declare const styledClient: (tagName: Tag<any>, className: string, callerName?: string, element?: string, variantKeys?: string[]) => import('react').ForwardRefExoticComponent<Omit<import('../../core/src/types').StyledComponentProps, "ref"> & import('react').RefAttributes<any>>;
@@ -0,0 +1,7 @@
1
+ import { e as a } from "./element-factory-CwnAXm6m.js";
2
+ const c = (e, t, n, o, r) => a(e, t, o, r, {
3
+ "data-component-name": n
4
+ });
5
+ export {
6
+ c as styledClient
7
+ };
package/styled.cjs ADDED
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("./parse-styles-CsUEXYf5.cjs"),o=require("./element-factory-BCMNslLa.cjs"),c=a=>Object.keys(a);class p{constructor(t,s){this.tagName=t,this.params=s}get hash(){return i.toHash(this.params.base||this.params)}get priority(){var t;return typeof this.tagName=="function"||typeof this.tagName=="object"?(((t=this.tagName.generator)==null?void 0:t.priority)||0)+1:0}get classNames(){const t=[this.hash],{className:s}=this.params;return s&&t.push(s),t.join(" ")}get cssClassName(){return this.hash}get cssDisplayNameVar(){return`--${this.hash}-display-name: ${this._callerName};`}get templateKeys(){var t;return(t=this._context)!=null&&t.config.templates?c(this._context.config.templates):[]}get css(){var r;const{base:t={},variants:s={},compoundVariants:e=[]}=this.params,n={...t,variants:s,compoundVariants:e};return i.parseStyles(n,`.${this.cssClassName}`,this.priority,(r=this._context)==null?void 0:r.config)}get props(){const{element:t}=this.params,s=this.params.variants?Object.keys(this.params.variants).map(e=>{var r;const n=(r=this.params.defaultVariants)==null?void 0:r[e];return n!==void 0?`${e}=${String(n)}`:e}):void 0;return{element:t,variantKeys:s}}_withBuildContext(t){this._context=t;const{name:s,config:e}=t;return this._callerName=s,this}}const h=(a,t)=>{const s=new p(a,t),e=o.elementFactory(a,s.cssClassName,s.props.element,s.props.variantKeys,{"data-unoptimized-client-component":!0});return Object.assign(e,{generator:s}),e};exports.styled=h;
package/styled.d.ts ADDED
@@ -0,0 +1,5 @@
1
+ import { AllHTMLAttributes, ReactDOM, ReactNode } from 'react';
2
+ import { Tag, StyledComponentProps, CreateElementProps, VariantProps, ParentComponentProps, StyledParams, CssRuntimeValues } from '../../core/src/types';
3
+ export declare const styled: <const PROPS extends StyledComponentProps, const TAG extends Tag<Required<PROPS>>, const STYLE_PARAMS extends StyledParams>(tagName: TAG, params: STYLE_PARAMS) => ((props: (CreateElementProps & ParentComponentProps<TAG>) | (TAG extends string ? {
4
+ ref: any;
5
+ } : never) | CssRuntimeValues | VariantProps<STYLE_PARAMS> | (TAG extends keyof ReactDOM ? ReactDOM[TAG] extends (...props: infer R) => any ? R[0] : TAG extends string ? AllHTMLAttributes<HTMLElement> : never : TAG extends string ? AllHTMLAttributes<HTMLElement> : never)) => ReactNode) & string;
package/styled.js ADDED
@@ -0,0 +1,61 @@
1
+ import { t as i, p as o } from "./parse-styles-jRJiQaik.js";
2
+ import { e as c } from "./element-factory-CwnAXm6m.js";
3
+ const p = (a) => Object.keys(a);
4
+ class m {
5
+ constructor(t, s) {
6
+ this.tagName = t, this.params = s;
7
+ }
8
+ get hash() {
9
+ return i(this.params.base || this.params);
10
+ }
11
+ get priority() {
12
+ var t;
13
+ return typeof this.tagName == "function" || typeof this.tagName == "object" ? (((t = this.tagName.generator) == null ? void 0 : t.priority) || 0) + 1 : 0;
14
+ }
15
+ get classNames() {
16
+ const t = [this.hash], { className: s } = this.params;
17
+ return s && t.push(s), t.join(" ");
18
+ }
19
+ get cssClassName() {
20
+ return this.hash;
21
+ }
22
+ get cssDisplayNameVar() {
23
+ return `--${this.hash}-display-name: ${this._callerName};`;
24
+ }
25
+ get templateKeys() {
26
+ var t;
27
+ return (t = this._context) != null && t.config.templates ? p(this._context.config.templates) : [];
28
+ }
29
+ get css() {
30
+ var r;
31
+ const { base: t = {}, variants: s = {}, compoundVariants: e = [] } = this.params, n = { ...t, variants: s, compoundVariants: e };
32
+ return o(n, `.${this.cssClassName}`, this.priority, (r = this._context) == null ? void 0 : r.config);
33
+ }
34
+ get props() {
35
+ const { element: t } = this.params, s = this.params.variants ? Object.keys(this.params.variants).map((e) => {
36
+ var r;
37
+ const n = (r = this.params.defaultVariants) == null ? void 0 : r[e];
38
+ return n !== void 0 ? `${e}=${String(n)}` : e;
39
+ }) : void 0;
40
+ return {
41
+ element: t,
42
+ variantKeys: s
43
+ };
44
+ }
45
+ _withBuildContext(t) {
46
+ this._context = t;
47
+ const { name: s, config: e } = t;
48
+ return this._callerName = s, this;
49
+ }
50
+ }
51
+ const u = (a, t) => {
52
+ const s = new m(a, t), e = c(a, s.cssClassName, s.props.element, s.props.variantKeys, {
53
+ "data-unoptimized-client-component": !0
54
+ });
55
+ return Object.assign(e, {
56
+ generator: s
57
+ }), e;
58
+ };
59
+ export {
60
+ u as styled
61
+ };