@salty-css/react 0.0.1-alpha.260 → 0.0.1-alpha.262

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/index.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const c=require("./keyframes.cjs"),n=require("./media.cjs"),u=r=>`{${r}}`,a=(...r)=>r.flat().reduce((t,e)=>e!=null&&e._current?{...t,...e._current}:{...t,...e},{}),o=(...r)=>r.flat().reduce((t,e)=>({...t,...e._children}),{});exports.keyframes=c.keyframes;exports.MediaQueryFactory=n.MediaQueryFactory;exports.media=n.media;exports.mergeFactories=o;exports.mergeObjects=a;exports.token=u;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("@salty-css/core/css");Object.keys(t).forEach(e=>{e!=="default"&&!Object.prototype.hasOwnProperty.call(exports,e)&&Object.defineProperty(exports,e,{enumerable:!0,get:()=>t[e]})});
package/index.js CHANGED
@@ -1,11 +1 @@
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
- export {
5
- d as MediaQueryFactory,
6
- f as keyframes,
7
- i as media,
8
- u as mergeFactories,
9
- o as mergeObjects,
10
- n as token
11
- };
1
+ export * from "@salty-css/core/css";
package/keyframes.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("./parse-styles-BU5fcwDA.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;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("@salty-css/core/css/keyframes");Object.keys(t).forEach(e=>{e!=="default"&&!Object.prototype.hasOwnProperty.call(exports,e)&&Object.defineProperty(exports,e,{enumerable:!0,get:()=>t[e]})});
package/keyframes.js CHANGED
@@ -1,33 +1 @@
1
- import { t as j, p as m } from "./parse-styles-BRbiYmZ_.js";
2
- const h = async ({ animationName: $, params: l, appendInitialStyles: u, ...t }) => {
3
- const r = $ || j(t), e = async (n = {}) => {
4
- const {
5
- duration: s = "500ms",
6
- easing: o = "ease-in-out",
7
- delay: i = "0s",
8
- iterationCount: d = "1",
9
- direction: S = "normal",
10
- fillMode: g = "forwards",
11
- playState: w = "running"
12
- } = { ...l, ...n }, a = `${r} ${s} ${o} ${i} ${d} ${S} ${g} ${w}`;
13
- if (!u) return a;
14
- const c = t.from || t["0%"];
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
- isKeyframes: !0,
26
- animationName: r,
27
- css: p,
28
- keyframes: t
29
- }), e;
30
- };
31
- export {
32
- h as keyframes
33
- };
1
+ export * from "@salty-css/core/css/keyframes";
package/media.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";var a=Object.defineProperty;var o=(s,e,t)=>e in s?a(s,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):s[e]=t;var i=(s,e,t)=>o(s,typeof e!="symbol"?e+"":e,t);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});class r{constructor(e="@media"){i(this,"next",e=>{const t=new String(e);return Object.assign(t,{get isMedia(){return!0},get and(){return new r(`${e} and`)},get or(){return new r(`${e},`)}}),t});this.base=e}custom(e){return this.next(`${this.base} ${e}`)}minWidth(e){const t=typeof e=="number"?`${e}px`:e,n=`${this.base} (min-width: ${t})`;return this.next(n)}maxWidth(e){const t=typeof e=="number"?`${e}px`:e,n=`${this.base} (max-width: ${t})`;return this.next(n)}minHeight(e){const t=typeof e=="number"?`${e}px`:e,n=`${this.base} (min-height: ${t})`;return this.next(n)}maxHeight(e){const t=typeof e=="number"?`${e}px`:e,n=`${this.base} (max-height: ${t})`;return this.next(n)}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 u=new r;exports.MediaQueryFactory=r;exports.media=u;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("@salty-css/core/css/media");Object.keys(t).forEach(e=>{e!=="default"&&!Object.prototype.hasOwnProperty.call(exports,e)&&Object.defineProperty(exports,e,{enumerable:!0,get:()=>t[e]})});
package/media.js CHANGED
@@ -1,88 +1 @@
1
- var a = Object.defineProperty;
2
- var o = (s, t, e) => t in s ? a(s, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : s[t] = e;
3
- var i = (s, t, e) => o(s, typeof t != "symbol" ? t + "" : t, e);
4
- class r {
5
- constructor(t = "@media") {
6
- i(this, "next", (t) => {
7
- const e = new String(t);
8
- return Object.assign(e, {
9
- get isMedia() {
10
- return !0;
11
- },
12
- get and() {
13
- return new r(`${t} and`);
14
- },
15
- get or() {
16
- return new r(`${t},`);
17
- }
18
- }), e;
19
- });
20
- this.base = t;
21
- }
22
- custom(t) {
23
- return this.next(`${this.base} ${t}`);
24
- }
25
- minWidth(t) {
26
- const e = typeof t == "number" ? `${t}px` : t, n = `${this.base} (min-width: ${e})`;
27
- return this.next(n);
28
- }
29
- maxWidth(t) {
30
- const e = typeof t == "number" ? `${t}px` : t, n = `${this.base} (max-width: ${e})`;
31
- return this.next(n);
32
- }
33
- minHeight(t) {
34
- const e = typeof t == "number" ? `${t}px` : t, n = `${this.base} (min-height: ${e})`;
35
- return this.next(n);
36
- }
37
- maxHeight(t) {
38
- const e = typeof t == "number" ? `${t}px` : t, n = `${this.base} (max-height: ${e})`;
39
- return this.next(n);
40
- }
41
- get portrait() {
42
- const t = `${this.base} (orientation: portrait)`;
43
- return this.next(t);
44
- }
45
- get landscape() {
46
- const t = `${this.base} (orientation: landscape)`;
47
- return this.next(t);
48
- }
49
- prefersColorScheme(t) {
50
- const e = `${this.base} (prefers-color-scheme: ${t})`;
51
- return this.next(e);
52
- }
53
- get dark() {
54
- return this.prefersColorScheme("dark");
55
- }
56
- get light() {
57
- return this.prefersColorScheme("light");
58
- }
59
- get print() {
60
- const t = `${this.base} print`;
61
- return this.next(t);
62
- }
63
- get screen() {
64
- const t = `${this.base} screen`;
65
- return this.next(t);
66
- }
67
- get speech() {
68
- const t = `${this.base} speech`;
69
- return this.next(t);
70
- }
71
- get all() {
72
- const t = `${this.base} all`;
73
- return this.next(t);
74
- }
75
- get not() {
76
- const t = `${this.base} not`;
77
- return this.next(t);
78
- }
79
- get reducedMotion() {
80
- const t = `${this.base} (prefers-reduced-motion: reduce)`;
81
- return this.next(t);
82
- }
83
- }
84
- const u = new r();
85
- export {
86
- r as MediaQueryFactory,
87
- u as media
88
- };
1
+ export * from "@salty-css/core/css/media";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@salty-css/react",
3
- "version": "0.0.1-alpha.260",
3
+ "version": "0.0.1-alpha.262",
4
4
  "main": "./dist/index.js",
5
5
  "module": "./dist/index.mjs",
6
6
  "typings": "./dist/index.d.ts",
@@ -66,7 +66,7 @@
66
66
  }
67
67
  },
68
68
  "dependencies": {
69
- "@salty-css/core": "^0.0.1-alpha.260",
69
+ "@salty-css/core": "^0.0.1-alpha.262",
70
70
  "clsx": ">=2.x",
71
71
  "react": ">=19.x || >=18.3.x"
72
72
  }
package/styled-client.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const l=require("./element-factory-Dt_Z9aHy.cjs"),n=(e,t,r)=>l.elementFactory(e,t,r);exports.styledClient=n;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const l=require("./element-factory-CjfyYeUL.cjs"),n=(e,t,r)=>l.elementFactory(e,t,r);exports.styledClient=n;
package/styled-client.js CHANGED
@@ -1,4 +1,4 @@
1
- import { e as o } from "./element-factory-DrGBPkh2.js";
1
+ import { e as o } from "./element-factory-BQLlIRVO.js";
2
2
  const l = (e, t, r) => o(e, t, r);
3
3
  export {
4
4
  l as styledClient
package/styled.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const h=require("./styles-generator-E48FU2R-.cjs"),g=require("./parse-tokens-BnDwbP7V.cjs"),b=require("./element-factory-Dt_Z9aHy.cjs");class v extends h.StylesGenerator{constructor(e,t){super(t),this.tagName=e,this._params=t}get priority(){var e;return this.params.priority?this.params.priority: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:r=[],defaultVariants:d={},defaultProps:l={},passProps:u}=this.params,{callerName:y,isProduction:m}=this.buildContext,n=new Set([]),i=s=>{const a=d[s];a!==void 0?n.add(`${s}=${String(a)}`):n.add(s)};Object.keys(t).forEach(i),r.map(s=>Object.keys(s).forEach(i));const c=new Set([]);if(this.params.base){const s=JSON.stringify(this.params.base).match(/\{-?props\.([^}]+)\}/gi);s&&s.forEach(a=>{const p=a.replace(/\{(?:-)?props\.([^}]+)\}/gi,"$1"),f=g.dashCase(p);p&&c.add(f)})}return{element:e,variantKeys:[...n],propValueKeys:[...c],passProps:u,defaultProps:l,attr:{"data-component-name":m?void 0:y}}}}const S=(o,e)=>{const t=new v(o,e),r=b.elementFactory(o,t.cssClassName,t.clientProps,{"data-unoptimized-client-component":!0});return Object.assign(r,{generator:t}),r};exports.styled=S;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("@salty-css/core/generators"),s=require("./element-factory-CjfyYeUL.cjs"),c=(t,r)=>{const e=new o.StyledGenerator(t,r),n=s.elementFactory(t,e.cssClassName,e.clientProps,{"data-unoptimized-client-component":!0});return Object.assign(n,{generator:e}),n};exports.styled=c;
package/styled.js CHANGED
@@ -1,48 +1,13 @@
1
- import { S as y } from "./styles-generator-Cz2vkKB0.js";
2
- import { d as g } from "./parse-tokens-Cbbbt7eO.js";
3
- import { e as v } from "./element-factory-DrGBPkh2.js";
4
- class b extends y {
5
- constructor(e, t) {
6
- super(t), this.tagName = e, this._params = t;
7
- }
8
- get priority() {
9
- var e;
10
- return this.params.priority ? this.params.priority : typeof this.tagName == "function" || typeof this.tagName == "object" ? (((e = this.tagName.generator) == null ? void 0 : e.priority) || 0) + 1 : 0;
11
- }
12
- get clientProps() {
13
- const { element: e, variants: t = {}, compoundVariants: s = [], defaultVariants: d = {}, defaultProps: m = {}, passProps: l } = this.params, { callerName: f, isProduction: u } = this.buildContext, i = /* @__PURE__ */ new Set([]), n = (a) => {
14
- const r = d[a];
15
- r !== void 0 ? i.add(`${a}=${String(r)}`) : i.add(a);
16
- };
17
- Object.keys(t).forEach(n), s.map((a) => Object.keys(a).forEach(n));
18
- const c = /* @__PURE__ */ new Set([]);
19
- if (this.params.base) {
20
- const a = JSON.stringify(this.params.base).match(/\{-?props\.([^}]+)\}/gi);
21
- a && a.forEach((r) => {
22
- const p = r.replace(/\{(?:-)?props\.([^}]+)\}/gi, "$1"), h = g(p);
23
- p && c.add(h);
24
- });
25
- }
26
- return {
27
- element: e,
28
- variantKeys: [...i],
29
- propValueKeys: [...c],
30
- passProps: l,
31
- defaultProps: m,
32
- attr: {
33
- "data-component-name": u ? void 0 : f
34
- }
35
- };
36
- }
37
- }
38
- const K = (o, e) => {
39
- const t = new b(o, e), s = v(o, t.cssClassName, t.clientProps, {
1
+ import { StyledGenerator as r } from "@salty-css/core/generators";
2
+ import { e as s } from "./element-factory-BQLlIRVO.js";
3
+ const i = (t, o) => {
4
+ const e = new r(t, o), n = s(t, e.cssClassName, e.clientProps, {
40
5
  "data-unoptimized-client-component": !0
41
6
  });
42
- return Object.assign(s, {
43
- generator: t
44
- }), s;
7
+ return Object.assign(n, {
8
+ generator: e
9
+ }), n;
45
10
  };
46
11
  export {
47
- K as styled
12
+ i as styled
48
13
  };
@@ -1,67 +0,0 @@
1
- import { forwardRef as v, createElement as C } from "react";
2
- import { p as g, d as N } from "./parse-tokens-Cbbbt7eO.js";
3
- function K(s) {
4
- var i, e, t = "";
5
- if (typeof s == "string" || typeof s == "number") t += s;
6
- else if (typeof s == "object") if (Array.isArray(s)) {
7
- var d = s.length;
8
- for (i = 0; i < d; i++) s[i] && (e = K(s[i])) && (t && (t += " "), t += e);
9
- } else for (e in s) s[e] && (t && (t += " "), t += e);
10
- return t;
11
- }
12
- function A() {
13
- for (var s, i, e = 0, t = "", d = arguments.length; e < d; e++) (s = arguments[e]) && (i = K(s)) && (t && (t += " "), t += i);
14
- return t;
15
- }
16
- const R = ["passProps"], x = (s, i = "", e = {}, t) => {
17
- const j = v(({
18
- extend: o = s,
19
- element: S = e.element,
20
- className: O = "",
21
- children: $,
22
- passProps: u = e.passProps,
23
- _vks: l = /* @__PURE__ */ new Set(),
24
- ...r
25
- }, w) => {
26
- const f = { passProps: u };
27
- e.attr && Object.assign(f, e.attr), t && Object.assign(f, t), e.defaultProps && Object.assign(r, e.defaultProps), r && Object.assign(f, r);
28
- const b = /* @__PURE__ */ new Set([...i.split(" "), ...O.split(" ")]), y = typeof o == "function" || typeof o == "object", h = y && "isStyled" in o, E = y ? o : S || o;
29
- if (!E) throw new Error("No element provided");
30
- const m = f.style || {};
31
- f.style || (f.style = m), Object.entries(m).forEach(([n, a]) => {
32
- const c = g(a);
33
- c && (m[n] = c.transformed);
34
- }), e.propValueKeys && e.propValueKeys.forEach((n) => {
35
- const a = `css-${n}`, c = r[a];
36
- if (c === void 0) return;
37
- const p = `--props-${N(n)}`;
38
- m[p] = c, l && l.add(a);
39
- }), e.variantKeys && e.variantKeys.forEach((n) => {
40
- const [a, c] = n.split("=");
41
- r[a] !== void 0 ? (b.add(`${a}-${r[a]}`), l && l.add(a)) : c !== void 0 && b.add(`${a}-${c}`);
42
- }), l && (!y || !h) ? l.forEach((n) => {
43
- if (!u) return delete f[n];
44
- if (u !== !0 && !u.includes(n))
45
- return delete f[n];
46
- }) : h && Object.assign(f, { _vks: l }), h || R.forEach((n) => delete f[n]);
47
- const V = A(...b);
48
- return C(
49
- E,
50
- {
51
- element: y ? S : void 0,
52
- className: V,
53
- ref: w,
54
- ...f
55
- },
56
- $
57
- );
58
- });
59
- return Object.assign(j, {
60
- isStyled: !0,
61
- className: i,
62
- toString: () => `.${i}`
63
- }), j;
64
- };
65
- export {
66
- x as e
67
- };
@@ -1 +0,0 @@
1
- "use strict";const K=require("react"),O=require("./parse-tokens-BnDwbP7V.cjs");function $(s){var i,e,t="";if(typeof s=="string"||typeof s=="number")t+=s;else if(typeof s=="object")if(Array.isArray(s)){var o=s.length;for(i=0;i<o;i++)s[i]&&(e=$(s[i]))&&(t&&(t+=" "),t+=e)}else for(e in s)s[e]&&(t&&(t+=" "),t+=e);return t}function q(){for(var s,i,e=0,t="",o=arguments.length;e<o;e++)(s=arguments[e])&&(i=$(s))&&(t&&(t+=" "),t+=i);return t}const N=["passProps"],A=(s,i="",e={},t)=>{const o=({extend:u=s,element:S=e.element,className:w="",children:V,passProps:d=e.passProps,_vks:r=new Set,...l},v)=>{const f={passProps:d};e.attr&&Object.assign(f,e.attr),t&&Object.assign(f,t),e.defaultProps&&Object.assign(l,e.defaultProps),l&&Object.assign(f,l);const b=new Set([...i.split(" "),...w.split(" ")]),y=typeof u=="function"||typeof u=="object",h=y&&"isStyled"in u,E=y?u:S||u;if(!E)throw new Error("No element provided");const m=f.style||{};f.style||(f.style=m),Object.entries(m).forEach(([n,a])=>{const c=O.parseVariableTokens(a);c&&(m[n]=c.transformed)}),e.propValueKeys&&e.propValueKeys.forEach(n=>{const a=`css-${n}`,c=l[a];if(c===void 0)return;const g=`--props-${O.dashCase(n)}`;m[g]=c,r&&r.add(a)}),e.variantKeys&&e.variantKeys.forEach(n=>{const[a,c]=n.split("=");l[a]!==void 0?(b.add(`${a}-${l[a]}`),r&&r.add(a)):c!==void 0&&b.add(`${a}-${c}`)}),r&&(!y||!h)?r.forEach(n=>{if(!d)return delete f[n];if(d!==!0&&!d.includes(n))return delete f[n]}):h&&Object.assign(f,{_vks:r}),h||N.forEach(n=>delete f[n]);const C=q(...b);return K.createElement(E,{element:y?S:void 0,className:C,ref:v,...f},V)},j=K.forwardRef(o);return Object.assign(j,{isStyled:!0,className:i,toString:()=>`.${i}`}),j};exports.elementFactory=A;
@@ -1,155 +0,0 @@
1
- import { d as W, a as M } from "./parse-tokens-Cbbbt7eO.js";
2
- import { d as U } from "./viewport-clamp-BOc-8Oph.js";
3
- const H = (r) => (s) => {
4
- if (typeof s != "string" || !r) return;
5
- let t = s;
6
- const a = [];
7
- return Object.values(r).forEach((o) => {
8
- const { pattern: b, transform: m } = o;
9
- t = t.replace(b, (C) => {
10
- const { value: j, css: E } = m(C);
11
- return E && a.push(E), j;
12
- });
13
- }), { transformed: t, additionalCss: a };
14
- }, z = (r) => String.fromCharCode(r + (r > 25 ? 39 : 97)), J = (r, s) => {
15
- let t = "", a;
16
- for (a = Math.abs(r); a > 52; a = a / 52 | 0) t = z(a % 52) + t;
17
- return t = z(a % 52) + t, t.length < s ? t = t.padStart(s, "a") : t.length > s && (t = t.slice(-s)), t;
18
- }, Q = (r, s) => {
19
- let t = s.length;
20
- for (; t; ) r = r * 33 ^ s.charCodeAt(--t);
21
- return r;
22
- }, L = (r, s = 5) => {
23
- const t = Q(5381, JSON.stringify(r)) >>> 0;
24
- return J(t, s);
25
- }, T = [
26
- "top",
27
- "right",
28
- "bottom",
29
- "left",
30
- "min-width",
31
- /.*width.*/,
32
- /^[^line]*height.*/,
33
- // Exclude line-height
34
- /padding.*/,
35
- /margin.*/,
36
- /border.*/,
37
- /inset.*/,
38
- /.*radius.*/,
39
- /.*spacing.*/,
40
- /.*gap.*/,
41
- /.*indent.*/,
42
- /.*offset.*/,
43
- /.*size.*/,
44
- /.*thickness.*/,
45
- /.*font-size.*/
46
- ], _ = (r, s, t) => {
47
- if (T.some((o) => typeof o == "string" ? o === r : o.test(r))) {
48
- const o = (t == null ? void 0 : t.defaultUnit) || "px";
49
- if (o.startsWith("viewport-clamp:"))
50
- try {
51
- const m = o.split(":")[1];
52
- return U({
53
- screenSize: parseInt(m)
54
- })(Number(s));
55
- } catch (m) {
56
- throw console.error(m), new Error(`Invalid viewport-clamp value: ${o}`);
57
- }
58
- return `${s}${o}`;
59
- }
60
- return `${s}`;
61
- }, q = ["Webkit", "Moz", "ms", "O"], F = (r) => r.startsWith("-") ? r : q.some((s) => r.startsWith(s)) ? `-${W(r)}` : W(r), $ = async (r, s = "", t, a = !1) => {
62
- if (!r) throw new Error("No styles provided to parseStyles function!");
63
- const o = /* @__PURE__ */ new Set(), b = Object.entries(r), m = async ([f, e]) => {
64
- var S;
65
- const n = f.trim().replace(/^\?+/g, ""), y = F(n), u = (c, p = ";") => `${y}:${c}${p}`, P = { scope: s, config: t };
66
- if (typeof e == "function") return m([f, e(P)]);
67
- if (e instanceof Promise) return m([f, await e]);
68
- if (t != null && t.templates && t.templatePaths[n])
69
- try {
70
- const [c, p] = t.templatePaths[n].split(";;"), i = await import(p), l = p.includes("salty.config"), d = l ? i[c].templates : i[c], w = l ? d[n] : d.params[n];
71
- if (d && typeof w == "function") {
72
- const v = await w(e), [h] = await $(v, "");
73
- return h;
74
- }
75
- } catch (c) {
76
- console.error(`Error loading template "${n}" from path "${t.templatePaths[n]}"`, c);
77
- return;
78
- }
79
- if (t != null && t.templates && t.templates[n]) {
80
- if (a) return;
81
- const p = e.split(".").reduce((i, l) => i[l], t.templates[n]);
82
- if (p) {
83
- const [i] = await $(p, "");
84
- return i;
85
- }
86
- console.warn(`Template "${n}" with path of "${e}" was not found in config!`);
87
- return;
88
- }
89
- if (typeof e == "object") {
90
- if (!e) return;
91
- if (e.isColor) return u(e.toString());
92
- if (n === "defaultVariants") return;
93
- if (n === "variants") {
94
- const i = Object.entries(e);
95
- for (const [l, d] of i) {
96
- if (!d) continue;
97
- const w = Object.entries(d);
98
- for (const [v, h] of w) {
99
- if (!h) continue;
100
- const A = `${s}.${l}-${v}`;
101
- (await $(h, A, t)).forEach((I) => o.add(I));
102
- }
103
- }
104
- return;
105
- }
106
- if (n === "compoundVariants") {
107
- for (const i of e) {
108
- const { css: l, ...d } = i, w = Object.entries(d).reduce((h, [A, N]) => `${h}.${A}-${N}`, s);
109
- (await $(l, w, t)).forEach((h) => o.add(h));
110
- }
111
- return;
112
- }
113
- if (n.startsWith("@")) {
114
- const i = ((S = t == null ? void 0 : t.mediaQueries) == null ? void 0 : S[n]) || n, l = await V(e, s, t), d = `${i} { ${l} }`;
115
- o.add(d);
116
- return;
117
- }
118
- const c = f.includes("&") ? n.replaceAll("&", s) : n.startsWith(":") ? `${s}${n}` : `${s} ${n}`;
119
- (await $(e, c, t)).forEach((i) => o.add(i));
120
- return;
121
- }
122
- if (typeof e == "number") {
123
- const c = _(y, e, t);
124
- return u(c);
125
- }
126
- if (typeof e != "string")
127
- if ("toString" in e) e = e.toString();
128
- else throw new Error(`Invalid value type for property ${y}`);
129
- return u(e);
130
- }, C = b.map(m), { modifiers: j } = t || {}, E = [M(), H(j)], x = (await Promise.all(C).then((f) => Promise.all(
131
- f.map((e) => E.reduce(async (n, y) => {
132
- const u = await n;
133
- if (!u) return u;
134
- const P = await y(u);
135
- if (!P) return u;
136
- const { transformed: S, additionalCss: c } = P;
137
- let p = "";
138
- if (c)
139
- for (const i of c)
140
- p += await V(i, "");
141
- return `${p}${S}`;
142
- }, Promise.resolve(e)))
143
- ))).filter((f) => f !== void 0).join(`
144
- `);
145
- if (!x.trim()) return Array.from(o);
146
- const O = s ? `${s} {
147
- ${x}
148
- }` : x;
149
- return o.has(O) ? Array.from(o) : [O, ...o];
150
- }, V = async (r, s, t, a = !1) => (await $(r, s, t, a)).join(`
151
- `);
152
- export {
153
- V as p,
154
- L as t
155
- };
@@ -1,5 +0,0 @@
1
- "use strict";const x=require("./parse-tokens-BnDwbP7V.cjs"),H=require("./viewport-clamp-kY8JqYzm.cjs"),I=r=>s=>{if(typeof s!="string"||!r)return;let t=s;const a=[];return Object.values(r).forEach(o=>{const{pattern:C,transform:f}=o;t=t.replace(C,b=>{const{value:j,css:E}=f(b);return E&&a.push(E),j})}),{transformed:t,additionalCss:a}},V=r=>String.fromCharCode(r+(r>25?39:97)),J=(r,s)=>{let t="",a;for(a=Math.abs(r);a>52;a=a/52|0)t=V(a%52)+t;return t=V(a%52)+t,t.length<s?t=t.padStart(s,"a"):t.length>s&&(t=t.slice(-s)),t},M=(r,s)=>{let t=s.length;for(;t;)r=r*33^s.charCodeAt(--t);return r},T=(r,s=5)=>{const t=M(5381,JSON.stringify(r))>>>0;return J(t,s)},U=["top","right","bottom","left","min-width",/.*width.*/,/^[^line]*height.*/,/padding.*/,/margin.*/,/border.*/,/inset.*/,/.*radius.*/,/.*spacing.*/,/.*gap.*/,/.*indent.*/,/.*offset.*/,/.*size.*/,/.*thickness.*/,/.*font-size.*/],Q=(r,s,t)=>{if(U.some(o=>typeof o=="string"?o===r:o.test(r))){const o=(t==null?void 0:t.defaultUnit)||"px";if(o.startsWith("viewport-clamp:"))try{const f=o.split(":")[1];return H.defineViewportClamp({screenSize:parseInt(f)})(Number(s))}catch(f){throw console.error(f),new Error(`Invalid viewport-clamp value: ${o}`)}return`${s}${o}`}return`${s}`},_=["Webkit","Moz","ms","O"],F=r=>r.startsWith("-")?r:_.some(s=>r.startsWith(s))?`-${x.dashCase(r)}`:x.dashCase(r),$=async(r,s="",t,a=!1)=>{if(!r)throw new Error("No styles provided to parseStyles function!");const o=new Set,C=Object.entries(r),f=async([m,e])=>{var S;const n=m.trim().replace(/^\?+/g,""),y=F(n),u=(c,p=";")=>`${y}:${c}${p}`,P={scope:s,config:t};if(typeof e=="function")return f([m,e(P)]);if(e instanceof Promise)return f([m,await e]);if(t!=null&&t.templates&&t.templatePaths[n])try{const[c,p]=t.templatePaths[n].split(";;"),i=await import(p),l=p.includes("salty.config"),d=l?i[c].templates:i[c],w=l?d[n]:d.params[n];if(d&&typeof w=="function"){const v=await w(e),[h]=await $(v,"");return h}}catch(c){console.error(`Error loading template "${n}" from path "${t.templatePaths[n]}"`,c);return}if(t!=null&&t.templates&&t.templates[n]){if(a)return;const p=e.split(".").reduce((i,l)=>i[l],t.templates[n]);if(p){const[i]=await $(p,"");return i}console.warn(`Template "${n}" with path of "${e}" was not found in config!`);return}if(typeof e=="object"){if(!e)return;if(e.isColor)return u(e.toString());if(n==="defaultVariants")return;if(n==="variants"){const i=Object.entries(e);for(const[l,d]of i){if(!d)continue;const w=Object.entries(d);for(const[v,h]of w){if(!h)continue;const O=`${s}.${l}-${v}`;(await $(h,O,t)).forEach(q=>o.add(q))}}return}if(n==="compoundVariants"){for(const i of e){const{css:l,...d}=i,w=Object.entries(d).reduce((h,[O,z])=>`${h}.${O}-${z}`,s);(await $(l,w,t)).forEach(h=>o.add(h))}return}if(n.startsWith("@")){const i=((S=t==null?void 0:t.mediaQueries)==null?void 0:S[n])||n,l=await N(e,s,t),d=`${i} { ${l} }`;o.add(d);return}const c=m.includes("&")?n.replaceAll("&",s):n.startsWith(":")?`${s}${n}`:`${s} ${n}`;(await $(e,c,t)).forEach(i=>o.add(i));return}if(typeof e=="number"){const c=Q(y,e,t);return u(c)}if(typeof e!="string")if("toString"in e)e=e.toString();else throw new Error(`Invalid value type for property ${y}`);return u(e)},b=C.map(f),{modifiers:j}=t||{},E=[x.parseValueTokens(),I(j)],A=(await Promise.all(b).then(m=>Promise.all(m.map(e=>E.reduce(async(n,y)=>{const u=await n;if(!u)return u;const P=await y(u);if(!P)return u;const{transformed:S,additionalCss:c}=P;let p="";if(c)for(const i of c)p+=await N(i,"");return`${p}${S}`},Promise.resolve(e)))))).filter(m=>m!==void 0).join(`
2
- `);if(!A.trim())return Array.from(o);const W=s?`${s} {
3
- ${A}
4
- }`:A;return o.has(W)?Array.from(o):[W,...o]},N=async(r,s,t,a=!1)=>(await $(r,s,t,a)).join(`
5
- `);exports.parseAndJoinStyles=N;exports.toHash=T;
@@ -1 +0,0 @@
1
- "use strict";function s(e){return e?typeof e!="string"?s(String(e)):e.replace(/[\s.]/g,"-").replace(/[A-Z](?:(?=[^A-Z])|[A-Z]*(?=[A-Z][^A-Z]|$))/g,(r,t)=>(t>0?"-":"")+r.toLowerCase()):""}const a=e=>r=>typeof r!="string"||!/\{[^{}]+\}/g.test(r)?void 0:{transformed:r.replace(/\{([^{}]+)\}/g,(...o)=>{const n=s(o[1].replaceAll(".","-"));return n.startsWith("-")?`-${n}`:`var(--${n})`})},i=a();exports.dashCase=s;exports.parseValueTokens=a;exports.parseVariableTokens=i;
@@ -1,12 +0,0 @@
1
- function a(e) {
2
- return e ? typeof e != "string" ? a(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
- const o = (e) => (r) => typeof r != "string" || !/\{[^{}]+\}/g.test(r) ? void 0 : { transformed: r.replace(/\{([^{}]+)\}/g, (...s) => {
5
- const t = a(s[1].replaceAll(".", "-"));
6
- return t.startsWith("-") ? `-${t}` : `var(--${t})`;
7
- }) }, c = o();
8
- export {
9
- o as a,
10
- a as d,
11
- c as p
12
- };
@@ -1,47 +0,0 @@
1
- var c = Object.defineProperty;
2
- var l = (a, s, t) => s in a ? c(a, s, { enumerable: !0, configurable: !0, writable: !0, value: t }) : a[s] = t;
3
- var o = (a, s, t) => l(a, typeof s != "symbol" ? s + "" : s, t);
4
- import { t as n, p as d } from "./parse-styles-BRbiYmZ_.js";
5
- import { d as h } from "./parse-tokens-Cbbbt7eO.js";
6
- class C {
7
- constructor(s) {
8
- o(this, "buildContext", {});
9
- this.params = s;
10
- }
11
- get priority() {
12
- return 0;
13
- }
14
- get isRoot() {
15
- return this.priority === 0;
16
- }
17
- get hash() {
18
- const { base: s, variants: t, compoundVariants: e } = this.params;
19
- return n({ base: s, variants: t, compoundVariants: e });
20
- }
21
- get cssClassName() {
22
- return this.hash;
23
- }
24
- get classNames() {
25
- const s = /* @__PURE__ */ new Set([this.cssClassName]), { className: t } = this.params;
26
- return typeof t == "string" && s.add(t), typeof t == "object" && t.forEach((e) => s.add(e)), this.getTemplateClasses().forEach((e) => s.add(e)), this.buildContext.classNames && this.buildContext.classNames.forEach((e) => s.add(e)), [...s].join(" ");
27
- }
28
- get cssFileName() {
29
- const { callerName: s } = this.buildContext;
30
- return s ? `cl_${h(s)}-${this.hash}.css` : `${this.hash}.css`;
31
- }
32
- get css() {
33
- const { base: s = {}, variants: t = {}, compoundVariants: e = [] } = this.params, { config: r } = this.buildContext, i = { ...s, variants: t, compoundVariants: e };
34
- return d(i, `.${this.cssClassName}`, r, this.isRoot);
35
- }
36
- getTemplateClasses(s = this.buildContext.config) {
37
- if (!(s != null && s.templates) || !this.params.base || this.priority > 0) return [];
38
- const t = Object.keys(s.templates);
39
- return Object.entries(this.params.base).reduce((e, [r, i]) => (t.includes(r) && e.push("t_" + n(h(`${r}-${i}`), 4)), e), []);
40
- }
41
- _withBuildContext(s) {
42
- return this.buildContext = s, this;
43
- }
44
- }
45
- export {
46
- C as S
47
- };
@@ -1 +0,0 @@
1
- "use strict";var c=Object.defineProperty;var l=(a,s,t)=>s in a?c(a,s,{enumerable:!0,configurable:!0,writable:!0,value:t}):a[s]=t;var o=(a,s,t)=>l(a,typeof s!="symbol"?s+"":s,t);const n=require("./parse-styles-BU5fcwDA.cjs"),h=require("./parse-tokens-BnDwbP7V.cjs");class u{constructor(s){o(this,"buildContext",{});this.params=s}get priority(){return 0}get isRoot(){return this.priority===0}get hash(){const{base:s,variants:t,compoundVariants:e}=this.params;return n.toHash({base:s,variants:t,compoundVariants:e})}get cssClassName(){return this.hash}get classNames(){const s=new Set([this.cssClassName]),{className:t}=this.params;return typeof t=="string"&&s.add(t),typeof t=="object"&&t.forEach(e=>s.add(e)),this.getTemplateClasses().forEach(e=>s.add(e)),this.buildContext.classNames&&this.buildContext.classNames.forEach(e=>s.add(e)),[...s].join(" ")}get cssFileName(){const{callerName:s}=this.buildContext;return s?`cl_${h.dashCase(s)}-${this.hash}.css`:`${this.hash}.css`}get css(){const{base:s={},variants:t={},compoundVariants:e=[]}=this.params,{config:r}=this.buildContext,i={...s,variants:t,compoundVariants:e};return n.parseAndJoinStyles(i,`.${this.cssClassName}`,r,this.isRoot)}getTemplateClasses(s=this.buildContext.config){if(!(s!=null&&s.templates)||!this.params.base||this.priority>0)return[];const t=Object.keys(s.templates);return Object.entries(this.params.base).reduce((e,[r,i])=>(t.includes(r)&&e.push("t_"+n.toHash(h.dashCase(`${r}-${i}`),4)),e),[])}_withBuildContext(s){return this.buildContext=s,this}}exports.StylesGenerator=u;
@@ -1,7 +0,0 @@
1
- const p = (e) => (t) => {
2
- const { screenSize: n, axis: i = "horizontal", minMultiplier: a = 0.5, maxMultiplier: r = 1.5 } = e, o = Math.round(t / n * 1e4) / 100, l = i === "vertical" ? "vh" : "vw", c = Math.round(a * t), s = Math.round(r * t);
3
- return `clamp(${c}px, ${o}${l}, ${s}px)`;
4
- };
5
- export {
6
- p as d
7
- };
@@ -1 +0,0 @@
1
- "use strict";const p=e=>t=>{const{screenSize:i,axis:n="horizontal",minMultiplier:r=.5,maxMultiplier:a=1.5}=e,o=Math.round(t/i*1e4)/100,l=n==="vertical"?"vh":"vw",c=Math.round(r*t),s=Math.round(a*t);return`clamp(${c}px, ${o}${l}, ${s}px)`};exports.defineViewportClamp=p;