@salty-css/core 0.0.1-alpha.19 → 0.0.1-alpha.190
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/.saltyrc.schema.json +48 -0
- package/README.md +143 -26
- package/bin/index.cjs +1 -8
- package/bin/index.js +2 -129
- package/bin/logger.d.ts +1 -0
- package/bin/main.cjs +11 -0
- package/bin/main.d.ts +1 -0
- package/bin/main.js +260 -0
- package/compiler/get-files.d.ts +3 -0
- package/compiler/index.cjs +1 -11
- package/compiler/index.d.ts +38 -6
- package/compiler/index.js +17 -172
- package/config/define-config.d.ts +1 -1
- package/config/index.cjs +1 -1
- package/config/index.d.ts +2 -1
- package/config/index.js +9 -2
- package/css/index.cjs +1 -1
- package/css/index.d.ts +4 -1
- package/css/index.js +9 -2
- package/css/keyframes.cjs +1 -0
- package/css/keyframes.d.ts +22 -0
- package/css/keyframes.js +34 -0
- package/css/media.cjs +1 -0
- package/css/media.d.ts +87 -0
- package/css/media.js +88 -0
- package/css/merge.cjs +1 -0
- package/css/merge.d.ts +6 -0
- package/css/merge.js +4 -0
- package/css/token.cjs +1 -0
- package/css/token.d.ts +1 -0
- package/css/token.js +4 -0
- package/{dash-case-DKzpenwY.cjs → dash-case-BJEkFEGQ.cjs} +1 -1
- package/{dash-case-DMQMcCO6.js → dash-case-DBThphLm.js} +2 -2
- package/factories/define-global-styles.d.ts +7 -0
- package/factories/define-templates.d.ts +10 -0
- package/factories/define-variables.d.ts +12 -0
- package/factories/index.d.ts +3 -0
- package/generators/class-name-generator.d.ts +6 -0
- package/generators/index.cjs +1 -0
- package/generators/index.d.ts +2 -0
- package/generators/index.js +75 -0
- package/generators/styled-generator.d.ts +19 -0
- package/generators/styles-generator.d.ts +18 -0
- package/index-BiZBc7HK.js +452 -0
- package/index-ptxZPIoq.cjs +31 -0
- package/package.json +28 -2
- package/parse-styles-3zK35muR.cjs +7 -0
- package/parse-styles-DrLhKtqW.js +75 -0
- package/parsers/index.cjs +1 -0
- package/parsers/index.d.ts +5 -0
- package/parsers/index.js +35 -0
- package/{generator → parsers}/parse-modifiers.d.ts +1 -1
- package/parsers/parse-styles.d.ts +2 -0
- package/parsers/parse-templates.d.ts +4 -0
- package/{generator → parsers}/parser-types.d.ts +1 -1
- package/react-vanilla-file-CCXbsjIb.js +18 -0
- package/react-vanilla-file-CG_WJLam.cjs +15 -0
- package/{salty.config-D9ANEDiH.js → salty.config-BhBY_oOk.js} +1 -0
- package/{salty.config-BupieCfE.cjs → salty.config-Dk6ZcCxI.cjs} +3 -2
- package/server/index.cjs +1 -0
- package/server/index.d.ts +1 -0
- package/server/index.js +12 -0
- package/server/should-restart.d.ts +1 -0
- package/templates/salty-reset.d.ts +2 -0
- package/types/cli-types.d.ts +10 -0
- package/types/config-types.d.ts +68 -0
- package/types/index.d.ts +49 -22
- package/util/dot-case.d.ts +1 -0
- package/util/index.cjs +1 -1
- package/util/index.js +1 -1
- package/util/module-type.d.ts +1 -0
- package/config/config-types.d.ts +0 -59
- package/generator/index.cjs +0 -1
- package/generator/index.d.ts +0 -1
- package/generator/index.js +0 -61
- package/generator/parse-styles.d.ts +0 -2
- package/generator/parse-templates.d.ts +0 -2
- package/generator/style-generator.d.ts +0 -28
- package/parse-templates-D4p3pgQR.js +0 -92
- package/parse-templates-W0YfTmOT.cjs +0 -8
- /package/{generator → parsers}/parse-tokens.d.ts +0 -0
package/css/keyframes.js
ADDED
@@ -0,0 +1,34 @@
|
|
1
|
+
import { p as c } from "../parse-styles-DrLhKtqW.js";
|
2
|
+
import { t as j } from "../dash-case-DBThphLm.js";
|
3
|
+
const O = ({ animationName: u, params: f, appendInitialStyles: p, ...t }) => {
|
4
|
+
const o = u || j(t), e = (r = {}) => {
|
5
|
+
const {
|
6
|
+
duration: n = "500ms",
|
7
|
+
easing: s = "ease-in-out",
|
8
|
+
delay: a = "0s",
|
9
|
+
iterationCount: i = "1",
|
10
|
+
direction: y = "normal",
|
11
|
+
fillMode: g = "forwards",
|
12
|
+
playState: S = "running"
|
13
|
+
} = { ...f, ...r }, m = `${o} ${n} ${s} ${a} ${i} ${y} ${g} ${S}`;
|
14
|
+
if (!p) return m;
|
15
|
+
const $ = t.from || t["0%"];
|
16
|
+
if (!$) return m;
|
17
|
+
const b = c($, "");
|
18
|
+
return `${m};${b}`;
|
19
|
+
}, l = Object.entries(t).reduce((r, [n, s]) => {
|
20
|
+
if (!s) return r;
|
21
|
+
const a = c(s, ""), i = typeof n == "number" ? `${n}%` : n;
|
22
|
+
return `${r}${i}{${a}}`;
|
23
|
+
}, ""), d = `@keyframes ${o} {${l}}`;
|
24
|
+
return Object.assign(e, {
|
25
|
+
toString: e,
|
26
|
+
isKeyframes: !0,
|
27
|
+
animationName: o,
|
28
|
+
css: d,
|
29
|
+
keyframes: t
|
30
|
+
}), e;
|
31
|
+
};
|
32
|
+
export {
|
33
|
+
O as keyframes
|
34
|
+
};
|
package/css/media.cjs
ADDED
@@ -0,0 +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;
|
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/media.js
ADDED
@@ -0,0 +1,88 @@
|
|
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
|
+
};
|
package/css/merge.cjs
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const u=(...t)=>t.flat().reduce((e,r)=>r!=null&&r._current?{...e,...r._current}:{...e,...r},{});exports.mergeStyles=u;
|
package/css/merge.d.ts
ADDED
package/css/merge.js
ADDED
package/css/token.cjs
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=e=>`{${e}}`;exports.token=t;
|
package/css/token.d.ts
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
export declare const token: <T extends VariableTokens>(token: T) => string;
|
package/css/token.js
ADDED
@@ -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=
|
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 =
|
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(
|
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,10 @@
|
|
1
|
+
import { CssTemplates } from '../types/config-types';
|
2
|
+
export interface TemplatesFactoryParams {
|
3
|
+
templates?: CssTemplates;
|
4
|
+
}
|
5
|
+
export declare class TemplatesFactory {
|
6
|
+
_current: TemplatesFactoryParams;
|
7
|
+
constructor(_current: TemplatesFactoryParams);
|
8
|
+
get isDefineTemplates(): boolean;
|
9
|
+
}
|
10
|
+
export declare const defineTemplates: (templates: CssTemplates) => TemplatesFactory;
|
@@ -0,0 +1,12 @@
|
|
1
|
+
import { SaltyVariables } from '../types/config-types';
|
2
|
+
export declare class VariablesFactory {
|
3
|
+
_current: SaltyVariables;
|
4
|
+
constructor(_current: SaltyVariables);
|
5
|
+
get isDefineVariables(): boolean;
|
6
|
+
}
|
7
|
+
/**
|
8
|
+
* Base level variables that can be used in all styles as they are applied globally to :root.
|
9
|
+
@param responsive Variables that are defined for different media queries.
|
10
|
+
@param conditional Variables that are defined for different parent selectors (classes or data attributes).
|
11
|
+
*/
|
12
|
+
export declare const defineVariables: (variables: SaltyVariables) => VariablesFactory;
|
@@ -0,0 +1,6 @@
|
|
1
|
+
import { StylesGenerator } from './styles-generator';
|
2
|
+
import { StyledParams } from '../types';
|
3
|
+
export declare class ClassNameGenerator<const STYLE_PARAMS extends StyledParams = StyledParams> extends StylesGenerator<STYLE_PARAMS> {
|
4
|
+
_params: STYLE_PARAMS;
|
5
|
+
constructor(_params: STYLE_PARAMS);
|
6
|
+
}
|
@@ -0,0 +1 @@
|
|
1
|
+
"use strict";var b=Object.defineProperty;var N=(e,s,t)=>s in e?b(e,s,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[s]=t;var u=(e,s,t)=>N(e,typeof s!="symbol"?s+"":s,t);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const C=require("../parse-styles-3zK35muR.cjs"),m=require("../dash-case-BJEkFEGQ.cjs");class f{constructor(s){u(this,"buildContext",{});this.params=s}get hash(){return m.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_${m.dashCase(s)}-${this.hash}.css`:`${this.hash}.css`}get css(){const{base:s={},variants:t={},compoundVariants:n=[]}=this.params,{config:i}=this.buildContext,o={...s,variants:t,compoundVariants:n};return C.parseStyles(o,`.${this.cssClassName}`,i)}_withBuildContext(s){return this.buildContext=s,this}}class S extends f{constructor(s){super(s),this._params=s}}class v extends f{constructor(s,t){super(t),this.tagName=s,this._params=t}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 clientProps(){const{element:s,variants:t={},compoundVariants:n=[],defaultVariants:i={},defaultProps:o={},passProps:h}=this.params,{callerName:y,isProduction:g}=this.buildContext,c=new Set([]),l=a=>{const r=i[a];r!==void 0?c.add(`${a}=${String(r)}`):c.add(a)};Object.keys(t).forEach(l),n.map(a=>Object.keys(a).forEach(l));const d=new Set([]);if(this.params.base){const a=JSON.stringify(this.params.base).match(/\{props\.([\w\d]+)\}/gi);a&&a.forEach(r=>{const p=r.replace(/\{props\.([\w\d]+)\}/gi,"$1");p&&d.add(p)})}return{element:s,variantKeys:[...c],propValueKeys:[...d],passProps:h,defaultProps:o,attr:{"data-component-name":g?void 0:y}}}}exports.ClassNameGenerator=S;exports.StyledGenerator=v;
|
@@ -0,0 +1,75 @@
|
|
1
|
+
var y = Object.defineProperty;
|
2
|
+
var b = (e, s, t) => s in e ? y(e, s, { enumerable: !0, configurable: !0, writable: !0, value: t }) : e[s] = t;
|
3
|
+
var u = (e, s, t) => b(e, typeof s != "symbol" ? s + "" : s, t);
|
4
|
+
import { p as N } from "../parse-styles-DrLhKtqW.js";
|
5
|
+
import { t as C, d as x } from "../dash-case-DBThphLm.js";
|
6
|
+
class m {
|
7
|
+
constructor(s) {
|
8
|
+
u(this, "buildContext", {});
|
9
|
+
this.params = s;
|
10
|
+
}
|
11
|
+
get hash() {
|
12
|
+
return C(this.params.base || this.params);
|
13
|
+
}
|
14
|
+
get cssClassName() {
|
15
|
+
return this.hash;
|
16
|
+
}
|
17
|
+
get classNames() {
|
18
|
+
const s = [this.hash], { className: t } = this.params;
|
19
|
+
return typeof t == "string" && s.push(t), typeof t == "object" && s.push(...t), s.join(" ");
|
20
|
+
}
|
21
|
+
get cssFileName() {
|
22
|
+
const { callerName: s } = this.buildContext;
|
23
|
+
return s ? `cl_${x(s)}-${this.hash}.css` : `${this.hash}.css`;
|
24
|
+
}
|
25
|
+
get css() {
|
26
|
+
const { base: s = {}, variants: t = {}, compoundVariants: i = [] } = this.params, { config: n } = this.buildContext, o = { ...s, variants: t, compoundVariants: i };
|
27
|
+
return N(o, `.${this.cssClassName}`, n);
|
28
|
+
}
|
29
|
+
_withBuildContext(s) {
|
30
|
+
return this.buildContext = s, this;
|
31
|
+
}
|
32
|
+
}
|
33
|
+
class $ extends m {
|
34
|
+
constructor(s) {
|
35
|
+
super(s), this._params = s;
|
36
|
+
}
|
37
|
+
}
|
38
|
+
class j extends m {
|
39
|
+
constructor(s, t) {
|
40
|
+
super(t), this.tagName = s, this._params = t;
|
41
|
+
}
|
42
|
+
get priority() {
|
43
|
+
var s;
|
44
|
+
return typeof this.tagName == "function" || typeof this.tagName == "object" ? (((s = this.tagName.generator) == null ? void 0 : s.priority) || 0) + 1 : 0;
|
45
|
+
}
|
46
|
+
get clientProps() {
|
47
|
+
const { element: s, variants: t = {}, compoundVariants: i = [], defaultVariants: n = {}, defaultProps: o = {}, passProps: h } = this.params, { callerName: f, isProduction: g } = this.buildContext, c = /* @__PURE__ */ new Set([]), p = (a) => {
|
48
|
+
const r = n[a];
|
49
|
+
r !== void 0 ? c.add(`${a}=${String(r)}`) : c.add(a);
|
50
|
+
};
|
51
|
+
Object.keys(t).forEach(p), i.map((a) => Object.keys(a).forEach(p));
|
52
|
+
const d = /* @__PURE__ */ new Set([]);
|
53
|
+
if (this.params.base) {
|
54
|
+
const a = JSON.stringify(this.params.base).match(/\{props\.([\w\d]+)\}/gi);
|
55
|
+
a && a.forEach((r) => {
|
56
|
+
const l = r.replace(/\{props\.([\w\d]+)\}/gi, "$1");
|
57
|
+
l && d.add(l);
|
58
|
+
});
|
59
|
+
}
|
60
|
+
return {
|
61
|
+
element: s,
|
62
|
+
variantKeys: [...c],
|
63
|
+
propValueKeys: [...d],
|
64
|
+
passProps: h,
|
65
|
+
defaultProps: o,
|
66
|
+
attr: {
|
67
|
+
"data-component-name": g ? void 0 : f
|
68
|
+
}
|
69
|
+
};
|
70
|
+
}
|
71
|
+
}
|
72
|
+
export {
|
73
|
+
$ as ClassNameGenerator,
|
74
|
+
j as StyledGenerator
|
75
|
+
};
|
@@ -0,0 +1,19 @@
|
|
1
|
+
import { StylesGenerator } from './styles-generator';
|
2
|
+
import { StyledParams, Tag } from '../types';
|
3
|
+
export interface StyledGeneratorClientProps {
|
4
|
+
element?: string;
|
5
|
+
variantKeys?: string[];
|
6
|
+
propValueKeys?: string[];
|
7
|
+
passProps?: boolean | string | string[];
|
8
|
+
defaultProps?: Record<PropertyKey, unknown>;
|
9
|
+
attr: {
|
10
|
+
[key: string]: any;
|
11
|
+
};
|
12
|
+
}
|
13
|
+
export declare class StyledGenerator<const STYLE_PARAMS extends StyledParams = StyledParams> extends StylesGenerator<STYLE_PARAMS> {
|
14
|
+
tagName: Tag<any>;
|
15
|
+
_params: STYLE_PARAMS;
|
16
|
+
constructor(tagName: Tag<any>, _params: STYLE_PARAMS);
|
17
|
+
get priority(): number;
|
18
|
+
get clientProps(): StyledGeneratorClientProps;
|
19
|
+
}
|
@@ -0,0 +1,18 @@
|
|
1
|
+
import { StyledParams } from '../types';
|
2
|
+
import { SaltyConfig } from '../types/config-types';
|
3
|
+
export interface StylesGeneratorBuildTimeProps {
|
4
|
+
callerName?: string;
|
5
|
+
isProduction?: boolean;
|
6
|
+
config?: SaltyConfig;
|
7
|
+
}
|
8
|
+
export declare class StylesGenerator<const STYLE_PARAMS extends StyledParams = StyledParams> {
|
9
|
+
params: STYLE_PARAMS;
|
10
|
+
buildContext: StylesGeneratorBuildTimeProps;
|
11
|
+
constructor(params: STYLE_PARAMS);
|
12
|
+
get hash(): string;
|
13
|
+
get cssClassName(): string;
|
14
|
+
get classNames(): string;
|
15
|
+
get cssFileName(): string;
|
16
|
+
get css(): string;
|
17
|
+
_withBuildContext(context: StylesGeneratorBuildTimeProps): this;
|
18
|
+
}
|