@salty-css/core 0.0.1-alpha.17 → 0.0.1-alpha.171

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.
Files changed (64) hide show
  1. package/.saltyrc.schema.json +48 -0
  2. package/README.md +143 -26
  3. package/bin/bin-util.d.ts +1 -1
  4. package/bin/index.cjs +1 -8
  5. package/bin/index.js +2 -119
  6. package/bin/logger.d.ts +1 -0
  7. package/bin/main.cjs +11 -0
  8. package/bin/main.d.ts +1 -0
  9. package/bin/main.js +260 -0
  10. package/compiler/get-files.d.ts +3 -0
  11. package/compiler/index.cjs +1 -11
  12. package/compiler/index.d.ts +26 -4
  13. package/compiler/index.js +18 -172
  14. package/config/define-config.d.ts +1 -1
  15. package/config/index.cjs +1 -1
  16. package/config/index.d.ts +2 -1
  17. package/config/index.js +10 -2
  18. package/css/index.cjs +1 -1
  19. package/css/index.d.ts +4 -1
  20. package/css/index.js +121 -2
  21. package/css/keyframes.d.ts +22 -0
  22. package/css/media.d.ts +87 -0
  23. package/css/merge.d.ts +6 -0
  24. package/css/token.d.ts +1 -0
  25. package/{dash-case-DKzpenwY.cjs → dash-case-BJEkFEGQ.cjs} +1 -1
  26. package/{dash-case-DMQMcCO6.js → dash-case-DBThphLm.js} +2 -2
  27. package/factories/define-global-styles.d.ts +7 -0
  28. package/factories/define-variables.d.ts +15 -0
  29. package/factories/index.cjs +1 -0
  30. package/factories/index.d.ts +2 -0
  31. package/factories/index.js +27 -0
  32. package/generator/index.cjs +1 -1
  33. package/generator/index.js +50 -35
  34. package/generator/parse-modifiers.d.ts +1 -1
  35. package/generator/parse-styles.d.ts +2 -2
  36. package/generator/parse-templates.d.ts +2 -0
  37. package/generator/style-generator.d.ts +8 -0
  38. package/index-BixulVRN.js +397 -0
  39. package/index-C6uCnypW.cjs +29 -0
  40. package/merge-BVm9us1A.js +4 -0
  41. package/merge-DxGoJDHv.cjs +1 -0
  42. package/package.json +12 -2
  43. package/parse-styles-3zK35muR.cjs +7 -0
  44. package/parse-styles-DrLhKtqW.js +75 -0
  45. package/parse-templates-BKvQLGeN.cjs +2 -0
  46. package/parse-templates-BdcpkXBG.js +27 -0
  47. package/react-vanilla-file-CCXbsjIb.js +18 -0
  48. package/react-vanilla-file-CG_WJLam.cjs +15 -0
  49. package/{salty.config-D9ANEDiH.js → salty.config-BhBY_oOk.js} +1 -0
  50. package/{salty.config-BupieCfE.cjs → salty.config-Dk6ZcCxI.cjs} +3 -2
  51. package/server/index.cjs +1 -0
  52. package/server/index.d.ts +1 -0
  53. package/server/index.js +12 -0
  54. package/server/should-restart.d.ts +1 -0
  55. package/templates/salty-reset.d.ts +2 -0
  56. package/types/cli-types.d.ts +10 -0
  57. package/{config → types}/config-types.d.ts +15 -5
  58. package/types/index.d.ts +46 -19
  59. package/util/dot-case.d.ts +1 -0
  60. package/util/index.cjs +1 -1
  61. package/util/index.js +1 -1
  62. package/util/module-type.d.ts +1 -0
  63. package/parse-templates-D4p3pgQR.js +0 -92
  64. package/parse-templates-W0YfTmOT.cjs +0 -8
package/css/index.js CHANGED
@@ -1,4 +1,123 @@
1
- const t = (o) => `{${o}}`;
1
+ var y = Object.defineProperty;
2
+ var w = (s, t, e) => t in s ? y(s, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : s[t] = e;
3
+ var p = (s, t, e) => w(s, typeof t != "symbol" ? t + "" : t, e);
4
+ import { p as g } from "../parse-styles-DrLhKtqW.js";
5
+ import { t as C } from "../dash-case-DBThphLm.js";
6
+ import { m as K } from "../merge-BVm9us1A.js";
7
+ const k = ({ animationName: s, params: t, appendInitialStyles: e, ...n }) => {
8
+ const c = s || C(n), u = (o = {}) => {
9
+ const {
10
+ duration: r = "500ms",
11
+ easing: i = "ease-in-out",
12
+ delay: h = "0s",
13
+ iterationCount: $ = "1",
14
+ direction: d = "normal",
15
+ fillMode: f = "forwards",
16
+ playState: v = "running"
17
+ } = { ...t, ...o }, m = `${c} ${r} ${i} ${h} ${$} ${d} ${f} ${v}`;
18
+ if (!e) return m;
19
+ const l = n.from || n["0%"];
20
+ if (!l) return m;
21
+ const S = g(l, "");
22
+ return `${m};${S}`;
23
+ }, x = Object.entries(n).reduce((o, [r, i]) => {
24
+ if (!i) return o;
25
+ const h = g(i, ""), $ = typeof r == "number" ? `${r}%` : r;
26
+ return `${o}${$}{${h}}`;
27
+ }, ""), b = `@keyframes ${c} {${x}}`;
28
+ return Object.assign(u, {
29
+ toString: u,
30
+ isKeyframes: !0,
31
+ animationName: c,
32
+ css: b,
33
+ keyframes: n
34
+ }), u;
35
+ };
36
+ class a {
37
+ constructor(t = "@media") {
38
+ p(this, "next", (t) => {
39
+ const e = new String(t);
40
+ return Object.assign(e, {
41
+ get isMedia() {
42
+ return !0;
43
+ },
44
+ get and() {
45
+ return new a(`${t} and`);
46
+ },
47
+ get or() {
48
+ return new a(`${t},`);
49
+ }
50
+ }), e;
51
+ });
52
+ this.base = t;
53
+ }
54
+ custom(t) {
55
+ return this.next(`${this.base} ${t}`);
56
+ }
57
+ minWidth(t) {
58
+ const e = typeof t == "number" ? `${t}px` : t, n = `${this.base} (min-width: ${e})`;
59
+ return this.next(n);
60
+ }
61
+ maxWidth(t) {
62
+ const e = typeof t == "number" ? `${t}px` : t, n = `${this.base} (max-width: ${e})`;
63
+ return this.next(n);
64
+ }
65
+ minHeight(t) {
66
+ const e = typeof t == "number" ? `${t}px` : t, n = `${this.base} (min-height: ${e})`;
67
+ return this.next(n);
68
+ }
69
+ maxHeight(t) {
70
+ const e = typeof t == "number" ? `${t}px` : t, n = `${this.base} (max-height: ${e})`;
71
+ return this.next(n);
72
+ }
73
+ get portrait() {
74
+ const t = `${this.base} (orientation: portrait)`;
75
+ return this.next(t);
76
+ }
77
+ get landscape() {
78
+ const t = `${this.base} (orientation: landscape)`;
79
+ return this.next(t);
80
+ }
81
+ prefersColorScheme(t) {
82
+ const e = `${this.base} (prefers-color-scheme: ${t})`;
83
+ return this.next(e);
84
+ }
85
+ get dark() {
86
+ return this.prefersColorScheme("dark");
87
+ }
88
+ get light() {
89
+ return this.prefersColorScheme("light");
90
+ }
91
+ get print() {
92
+ const t = `${this.base} print`;
93
+ return this.next(t);
94
+ }
95
+ get screen() {
96
+ const t = `${this.base} screen`;
97
+ return this.next(t);
98
+ }
99
+ get speech() {
100
+ const t = `${this.base} speech`;
101
+ return this.next(t);
102
+ }
103
+ get all() {
104
+ const t = `${this.base} all`;
105
+ return this.next(t);
106
+ }
107
+ get not() {
108
+ const t = `${this.base} not`;
109
+ return this.next(t);
110
+ }
111
+ get reducedMotion() {
112
+ const t = `${this.base} (prefers-reduced-motion: reduce)`;
113
+ return this.next(t);
114
+ }
115
+ }
116
+ const M = new a(), N = (s) => `{${s}}`;
2
117
  export {
3
- t as token
118
+ a as MediaQueryFactory,
119
+ k as keyframes,
120
+ M as media,
121
+ K as mergeStyles,
122
+ N as token
4
123
  };
@@ -0,0 +1,22 @@
1
+ import { CssStyles, StyleValue } from '../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/css/media.d.ts ADDED
@@ -0,0 +1,87 @@
1
+ import { OrString, OrNumber } from '../types/util-types';
2
+ export declare class MediaQueryFactory {
3
+ private base;
4
+ constructor(base?: string);
5
+ private next;
6
+ custom(value: string): string & {
7
+ isMedia: boolean;
8
+ and: MediaQueryFactory;
9
+ or: MediaQueryFactory;
10
+ };
11
+ minWidth(width: OrString | OrNumber): string & {
12
+ isMedia: boolean;
13
+ and: MediaQueryFactory;
14
+ or: MediaQueryFactory;
15
+ };
16
+ maxWidth(width: OrString | OrNumber): string & {
17
+ isMedia: boolean;
18
+ and: MediaQueryFactory;
19
+ or: MediaQueryFactory;
20
+ };
21
+ minHeight(height: OrString | OrNumber): string & {
22
+ isMedia: boolean;
23
+ and: MediaQueryFactory;
24
+ or: MediaQueryFactory;
25
+ };
26
+ maxHeight(height: OrString | OrNumber): string & {
27
+ isMedia: boolean;
28
+ and: MediaQueryFactory;
29
+ or: MediaQueryFactory;
30
+ };
31
+ get portrait(): string & {
32
+ isMedia: boolean;
33
+ and: MediaQueryFactory;
34
+ or: MediaQueryFactory;
35
+ };
36
+ get landscape(): string & {
37
+ isMedia: boolean;
38
+ and: MediaQueryFactory;
39
+ or: MediaQueryFactory;
40
+ };
41
+ prefersColorScheme(scheme: 'dark' | 'light' | OrString): string & {
42
+ isMedia: boolean;
43
+ and: MediaQueryFactory;
44
+ or: MediaQueryFactory;
45
+ };
46
+ get dark(): string & {
47
+ isMedia: boolean;
48
+ and: MediaQueryFactory;
49
+ or: MediaQueryFactory;
50
+ };
51
+ get light(): string & {
52
+ isMedia: boolean;
53
+ and: MediaQueryFactory;
54
+ or: MediaQueryFactory;
55
+ };
56
+ get print(): string & {
57
+ isMedia: boolean;
58
+ and: MediaQueryFactory;
59
+ or: MediaQueryFactory;
60
+ };
61
+ get screen(): string & {
62
+ isMedia: boolean;
63
+ and: MediaQueryFactory;
64
+ or: MediaQueryFactory;
65
+ };
66
+ get speech(): string & {
67
+ isMedia: boolean;
68
+ and: MediaQueryFactory;
69
+ or: MediaQueryFactory;
70
+ };
71
+ get all(): string & {
72
+ isMedia: boolean;
73
+ and: MediaQueryFactory;
74
+ or: MediaQueryFactory;
75
+ };
76
+ get not(): string & {
77
+ isMedia: boolean;
78
+ and: MediaQueryFactory;
79
+ or: MediaQueryFactory;
80
+ };
81
+ get reducedMotion(): string & {
82
+ isMedia: boolean;
83
+ and: MediaQueryFactory;
84
+ or: MediaQueryFactory;
85
+ };
86
+ }
87
+ export declare const media: MediaQueryFactory;
package/css/merge.d.ts ADDED
@@ -0,0 +1,6 @@
1
+ import { CSSinJS } from '../types';
2
+ interface StyleFactory {
3
+ _current: Record<string, any>;
4
+ }
5
+ export declare const mergeStyles: <T extends StyleFactory | CSSinJS>(...styles: T[]) => {};
6
+ export {};
package/css/token.d.ts ADDED
@@ -0,0 +1 @@
1
+ export declare const token: <T extends VariableTokens>(token: T) => string;
@@ -1 +1 @@
1
- "use strict";const n=e=>String.fromCharCode(e+(e>25?39:97)),i=(e,r)=>{let t="",a;for(a=Math.abs(e);a>52;a=a/52|0)t=n(a%52)+t;return t=n(a%52)+t,t.length<r?t=t.padStart(r,"a"):t.length>r&&(t=t.slice(-r)),t},o=(e,r)=>{let t=r.length;for(;t;)e=e*33^r.charCodeAt(--t);return e},c=(e,r=3)=>{const t=o(5381,JSON.stringify(e))>>>0;return i(t,r)};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()):""}exports.dashCase=s;exports.toHash=c;
1
+ "use strict";const n=e=>String.fromCharCode(e+(e>25?39:97)),i=(e,r)=>{let t="",a;for(a=Math.abs(e);a>52;a=a/52|0)t=n(a%52)+t;return t=n(a%52)+t,t.length<r?t=t.padStart(r,"a"):t.length>r&&(t=t.slice(-r)),t},o=(e,r)=>{let t=r.length;for(;t;)e=e*33^r.charCodeAt(--t);return e},c=(e,r=5)=>{const t=o(5381,JSON.stringify(e))>>>0;return i(t,r)};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()):""}exports.dashCase=s;exports.toHash=c;
@@ -6,12 +6,12 @@ const n = (e) => String.fromCharCode(e + (e > 25 ? 39 : 97)), o = (e, r) => {
6
6
  let t = r.length;
7
7
  for (; t; ) e = e * 33 ^ r.charCodeAt(--t);
8
8
  return e;
9
- }, c = (e, r = 3) => {
9
+ }, c = (e, r = 5) => {
10
10
  const t = i(5381, JSON.stringify(e)) >>> 0;
11
11
  return o(t, r);
12
12
  };
13
13
  function s(e) {
14
- 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()) : "";
14
+ 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()) : "";
15
15
  }
16
16
  export {
17
17
  s as d,
@@ -0,0 +1,7 @@
1
+ import { GlobalStyles } from '../types/config-types';
2
+ export declare class GlobalStylesFactory {
3
+ _current: GlobalStyles;
4
+ constructor(_current: GlobalStyles);
5
+ get isGlobalDefine(): boolean;
6
+ }
7
+ export declare const defineGlobalStyles: (styles: GlobalStyles) => GlobalStylesFactory;
@@ -0,0 +1,15 @@
1
+ import { CssConditionalVariables, CssResponsiveVariables, CssVariables } from '../types/config-types';
2
+ export interface VariablesFactoryParams {
3
+ variables?: CssVariables;
4
+ responsiveVariables?: CssResponsiveVariables;
5
+ conditionalVariables?: CssConditionalVariables;
6
+ }
7
+ export declare class VariablesFactory {
8
+ _current: VariablesFactoryParams;
9
+ constructor(_current: VariablesFactoryParams);
10
+ get isDefineVariables(): boolean;
11
+ }
12
+ export declare const defineVariables: (variables: VariablesFactoryParams) => VariablesFactory;
13
+ export declare const defineStaticVariables: (variables: CssVariables) => VariablesFactory;
14
+ export declare const defineResponsiveVariables: (responsiveVariables: CssResponsiveVariables) => VariablesFactory;
15
+ export declare const defineConditionalVariables: (conditionalVariables: CssConditionalVariables) => VariablesFactory;
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});class n{constructor(r){this._current=r}get isGlobalDefine(){return!0}}const a=e=>new n(e);class t{constructor(r){this._current=r}get isDefineVariables(){return!0}}const i=e=>new t(e),s=e=>new t({variables:e}),l=e=>new t({responsiveVariables:e}),o=e=>new t({conditionalVariables:e});exports.GlobalStylesFactory=n;exports.VariablesFactory=t;exports.defineConditionalVariables=o;exports.defineGlobalStyles=a;exports.defineResponsiveVariables=l;exports.defineStaticVariables=s;exports.defineVariables=i;
@@ -0,0 +1,2 @@
1
+ export * from './define-global-styles';
2
+ export * from './define-variables';
@@ -0,0 +1,27 @@
1
+ class n {
2
+ constructor(t) {
3
+ this._current = t;
4
+ }
5
+ get isGlobalDefine() {
6
+ return !0;
7
+ }
8
+ }
9
+ const s = (e) => new n(e);
10
+ class r {
11
+ constructor(t) {
12
+ this._current = t;
13
+ }
14
+ get isDefineVariables() {
15
+ return !0;
16
+ }
17
+ }
18
+ const a = (e) => new r(e), i = (e) => new r({ variables: e }), o = (e) => new r({ responsiveVariables: e }), l = (e) => new r({ conditionalVariables: e });
19
+ export {
20
+ n as GlobalStylesFactory,
21
+ r as VariablesFactory,
22
+ l as defineConditionalVariables,
23
+ s as defineGlobalStyles,
24
+ o as defineResponsiveVariables,
25
+ i as defineStaticVariables,
26
+ a as defineVariables
27
+ };
@@ -1 +1 @@
1
- "use strict";var m=Object.defineProperty;var l=(a,t,s)=>t in a?m(a,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):a[t]=s;var c=(a,t,s)=>l(a,typeof t!="symbol"?t+"":t,s);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const u=require("../dash-case-DKzpenwY.cjs"),p=require("../parse-templates-W0YfTmOT.cjs");class g{constructor(t,s){c(this,"_callerName");c(this,"_context");this.tagName=t,this.params=s}get hash(){return u.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?p.getTemplateKeys(this._context.config.templates):[]}get css(){var e;const{base:t={},variants:s={},compoundVariants:r=[]}=this.params,i={...t,variants:s,compoundVariants:r};return p.parseStyles(i,`.${this.cssClassName}`,this.priority,(e=this._context)==null?void 0:e.config)}get props(){const{element:t}=this.params,s=this.params.variants?Object.keys(this.params.variants).map(e=>{var n;const o=(n=this.params.defaultVariants)==null?void 0:n[e];return o!==void 0?`${e}=${String(o)}`:e}):void 0,r=new Set([]),i=/\{props\.([\w\d]+)\}/gi.exec(JSON.stringify(this.params.base));return i&&i.forEach((e,o,n)=>{const h=n.at(1);h&&r.add(h)}),{element:t,variantKeys:s,propValueKeys:[...r]}}_withBuildContext(t){this._context=t;const{name:s,config:r}=t;return this._callerName=s,this}}exports.StyleComponentGenerator=g;
1
+ "use strict";var g=Object.defineProperty;var y=(a,s,t)=>s in a?g(a,s,{enumerable:!0,configurable:!0,writable:!0,value:t}):a[s]=t;var c=(a,s,t)=>y(a,typeof s!="symbol"?s+"":s,t);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const u=require("../dash-case-BJEkFEGQ.cjs"),f=require("../parse-templates-BKvQLGeN.cjs"),N=require("../parse-styles-3zK35muR.cjs");class _{constructor(s,t){c(this,"_isProd");c(this,"_callerName");c(this,"_context");this.tagName=s,this.params=t}get hash(){return u.toHash(this.params.base||this.params)}get priority(){var s;return typeof this.tagName=="function"||typeof this.tagName=="object"?(((s=this.tagName.generator)==null?void 0:s.priority)||0)+1:0}get classNames(){const s=[this.hash],{className:t}=this.params;return t&&s.push(t),s.join(" ")}get cssClassName(){return this.hash}get cssDisplayNameVar(){return`--${this.hash}-display-name: ${this._callerName};`}get cssFileName(){return this._callerName?`c_${u.dashCase(this._callerName)}-${this.hash}-${this.priority}.css`:`${this.hash}-${this.priority}.css`}get templateKeys(){var s;return(s=this._context)!=null&&s.config.templates?f.getTemplateKeys(this._context.config.templates):[]}get css(){var n;const{base:s={},variants:t={},compoundVariants:i=[]}=this.params,r={...s,variants:t,compoundVariants:i};return N.parseStyles(r,`.${this.cssClassName}`,(n=this._context)==null?void 0:n.config)}get props(){const{element:s,variants:t={},compoundVariants:i=[],defaultVariants:r={},defaultProps:p={},passProps:n}=this.params,h=new Set([]),l=e=>{const o=r[e];o!==void 0?h.add(`${e}=${String(o)}`):h.add(e)};Object.keys(t).forEach(l),i.map(e=>Object.keys(e).forEach(l));const m=new Set([]);if(this.params.base){const e=JSON.stringify(this.params.base).match(/\{props\.([\w\d]+)\}/gi);e&&e.forEach(o=>{const d=o.replace(/\{props\.([\w\d]+)\}/gi,"$1");d&&m.add(d)})}return{element:s,variantKeys:[...h],propValueKeys:[...m],passProps:n,defaultProps:p,attr:{"data-component-name":this._isProd?void 0:this._callerName}}}_withBuildContext(s){this._context=s;const{name:t,config:i,prod:r}=s;return this._isProd=r,this._callerName=t,this}}exports.StyleComponentGenerator=_;
@@ -1,24 +1,26 @@
1
- var h = Object.defineProperty;
2
- var m = (e, t, s) => t in e ? h(e, t, { enumerable: !0, configurable: !0, writable: !0, value: s }) : e[t] = s;
3
- var c = (e, t, s) => m(e, typeof t != "symbol" ? t + "" : t, s);
4
- import { t as l } from "../dash-case-DMQMcCO6.js";
5
- import { g, p as u } from "../parse-templates-D4p3pgQR.js";
6
- class d {
7
- constructor(t, s) {
1
+ var f = Object.defineProperty;
2
+ var u = (a, s, t) => s in a ? f(a, s, { enumerable: !0, configurable: !0, writable: !0, value: t }) : a[s] = t;
3
+ var c = (a, s, t) => u(a, typeof s != "symbol" ? s + "" : s, t);
4
+ import { t as g, d as y } from "../dash-case-DBThphLm.js";
5
+ import { g as N } from "../parse-templates-BdcpkXBG.js";
6
+ import { p as _ } from "../parse-styles-DrLhKtqW.js";
7
+ class K {
8
+ constructor(s, t) {
9
+ c(this, "_isProd");
8
10
  c(this, "_callerName");
9
11
  c(this, "_context");
10
- this.tagName = t, this.params = s;
12
+ this.tagName = s, this.params = t;
11
13
  }
12
14
  get hash() {
13
- return l(this.params.base || this.params);
15
+ return g(this.params.base || this.params);
14
16
  }
15
17
  get priority() {
16
- var t;
17
- return typeof this.tagName == "function" || typeof this.tagName == "object" ? (((t = this.tagName.generator) == null ? void 0 : t.priority) || 0) + 1 : 0;
18
+ var s;
19
+ return typeof this.tagName == "function" || typeof this.tagName == "object" ? (((s = this.tagName.generator) == null ? void 0 : s.priority) || 0) + 1 : 0;
18
20
  }
19
21
  get classNames() {
20
- const t = [this.hash], { className: s } = this.params;
21
- return s && t.push(s), t.join(" ");
22
+ const s = [this.hash], { className: t } = this.params;
23
+ return t && s.push(t), s.join(" ");
22
24
  }
23
25
  get cssClassName() {
24
26
  return this.hash;
@@ -26,36 +28,49 @@ class d {
26
28
  get cssDisplayNameVar() {
27
29
  return `--${this.hash}-display-name: ${this._callerName};`;
28
30
  }
31
+ get cssFileName() {
32
+ return this._callerName ? `c_${y(this._callerName)}-${this.hash}-${this.priority}.css` : `${this.hash}-${this.priority}.css`;
33
+ }
29
34
  get templateKeys() {
30
- var t;
31
- return (t = this._context) != null && t.config.templates ? g(this._context.config.templates) : [];
35
+ var s;
36
+ return (s = this._context) != null && s.config.templates ? N(this._context.config.templates) : [];
32
37
  }
33
38
  get css() {
34
- var a;
35
- const { base: t = {}, variants: s = {}, compoundVariants: r = [] } = this.params, i = { ...t, variants: s, compoundVariants: r };
36
- return u(i, `.${this.cssClassName}`, this.priority, (a = this._context) == null ? void 0 : a.config);
39
+ var n;
40
+ const { base: s = {}, variants: t = {}, compoundVariants: i = [] } = this.params, r = { ...s, variants: t, compoundVariants: i };
41
+ return _(r, `.${this.cssClassName}`, (n = this._context) == null ? void 0 : n.config);
37
42
  }
38
43
  get props() {
39
- const { element: t } = this.params, s = this.params.variants ? Object.keys(this.params.variants).map((a) => {
40
- var n;
41
- const o = (n = this.params.defaultVariants) == null ? void 0 : n[a];
42
- return o !== void 0 ? `${a}=${String(o)}` : a;
43
- }) : void 0, r = /* @__PURE__ */ new Set([]), i = /\{props\.([\w\d]+)\}/gi.exec(JSON.stringify(this.params.base));
44
- return i && i.forEach((a, o, n) => {
45
- const p = n.at(1);
46
- p && r.add(p);
47
- }), {
48
- element: t,
49
- variantKeys: s,
50
- propValueKeys: [...r]
44
+ const { element: s, variants: t = {}, compoundVariants: i = [], defaultVariants: r = {}, defaultProps: p = {}, passProps: n } = this.params, h = /* @__PURE__ */ new Set([]), m = (e) => {
45
+ const o = r[e];
46
+ o !== void 0 ? h.add(`${e}=${String(o)}`) : h.add(e);
47
+ };
48
+ Object.keys(t).forEach(m), i.map((e) => Object.keys(e).forEach(m));
49
+ const l = /* @__PURE__ */ new Set([]);
50
+ if (this.params.base) {
51
+ const e = JSON.stringify(this.params.base).match(/\{props\.([\w\d]+)\}/gi);
52
+ e && e.forEach((o) => {
53
+ const d = o.replace(/\{props\.([\w\d]+)\}/gi, "$1");
54
+ d && l.add(d);
55
+ });
56
+ }
57
+ return {
58
+ element: s,
59
+ variantKeys: [...h],
60
+ propValueKeys: [...l],
61
+ passProps: n,
62
+ defaultProps: p,
63
+ attr: {
64
+ "data-component-name": this._isProd ? void 0 : this._callerName
65
+ }
51
66
  };
52
67
  }
53
- _withBuildContext(t) {
54
- this._context = t;
55
- const { name: s, config: r } = t;
56
- return this._callerName = s, this;
68
+ _withBuildContext(s) {
69
+ this._context = s;
70
+ const { name: t, config: i, prod: r } = s;
71
+ return this._isProd = r, this._callerName = t, this;
57
72
  }
58
73
  }
59
74
  export {
60
- d as StyleComponentGenerator
75
+ K as StyleComponentGenerator
61
76
  };
@@ -1,3 +1,3 @@
1
- import { CssModifiers } from '../config/config-types';
1
+ import { CssModifiers } from '../types/config-types';
2
2
  import { ValueParserReturnValue } from './parser-types';
3
3
  export declare const parseValueModifiers: (value: string, modifiers?: CssModifiers) => ValueParserReturnValue;
@@ -1,2 +1,2 @@
1
- import { SaltyConfig } from '../config/config-types';
2
- export declare const parseStyles: <T extends object>(styles: T, currentClass: string, layer?: number, config?: SaltyConfig | undefined) => string;
1
+ import { SaltyConfig } from '../types/config-types';
2
+ export declare const parseStyles: <T extends object>(styles: T, currentClass: string, config?: SaltyConfig | undefined) => string;
@@ -1,2 +1,4 @@
1
1
  export declare const parseTemplates: <T extends object>(obj: T, path?: PropertyKey[]) => string;
2
2
  export declare const getTemplateKeys: <T extends object>(templates: T) => string[];
3
+ export declare const getTemplateTypes: <T extends object>(templates: T) => Record<string, string>;
4
+ export declare const getTemplateTokens: <T extends object>(templates: T, parent?: string, templateTokens?: Set<string>) => string[];
@@ -3,10 +3,16 @@ export interface GeneratorProps {
3
3
  element?: string;
4
4
  variantKeys?: string[];
5
5
  propValueKeys?: string[];
6
+ passProps?: boolean | string | string[];
7
+ defaultProps?: Record<PropertyKey, unknown>;
8
+ attr: {
9
+ [key: string]: any;
10
+ };
6
11
  }
7
12
  export declare class StyleComponentGenerator {
8
13
  tagName: Tag<any>;
9
14
  params: StyledParams;
15
+ _isProd: boolean | undefined;
10
16
  _callerName: string | undefined;
11
17
  _context: {
12
18
  name: string;
@@ -18,11 +24,13 @@ export declare class StyleComponentGenerator {
18
24
  get classNames(): string;
19
25
  get cssClassName(): string;
20
26
  get cssDisplayNameVar(): string;
27
+ get cssFileName(): string;
21
28
  get templateKeys(): string[];
22
29
  get css(): string;
23
30
  get props(): GeneratorProps;
24
31
  _withBuildContext(context: {
25
32
  name: string;
26
33
  config: any;
34
+ prod: boolean;
27
35
  }): this;
28
36
  }