@salty-css/core 0.0.1-alpha.21 → 0.0.1-alpha.211

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 (93) hide show
  1. package/.saltyrc.schema.json +48 -0
  2. package/README.md +143 -26
  3. package/bin/index.cjs +1 -21
  4. package/bin/index.js +2 -5799
  5. package/bin/logger.d.ts +1 -0
  6. package/bin/main.cjs +11 -0
  7. package/bin/main.d.ts +1 -0
  8. package/bin/main.js +260 -0
  9. package/compiler/get-files.d.ts +3 -0
  10. package/compiler/index.cjs +1 -11
  11. package/compiler/index.d.ts +19 -11
  12. package/compiler/index.js +18 -172
  13. package/config/define-config.d.ts +1 -1
  14. package/config/index.cjs +1 -1
  15. package/config/index.d.ts +2 -1
  16. package/config/index.js +12 -2
  17. package/css/index.cjs +1 -1
  18. package/css/index.d.ts +4 -1
  19. package/css/index.js +10 -2
  20. package/css/keyframes.cjs +1 -0
  21. package/css/keyframes.d.ts +22 -0
  22. package/css/keyframes.js +34 -0
  23. package/css/media.cjs +1 -0
  24. package/css/media.d.ts +87 -0
  25. package/css/media.js +88 -0
  26. package/css/merge.cjs +1 -0
  27. package/css/merge.d.ts +7 -0
  28. package/css/merge.js +5 -0
  29. package/css/token.cjs +1 -0
  30. package/css/token.d.ts +1 -0
  31. package/css/token.js +4 -0
  32. package/{dash-case-DKzpenwY.cjs → dash-case-BJEkFEGQ.cjs} +1 -1
  33. package/{dash-case-DMQMcCO6.js → dash-case-DBThphLm.js} +2 -2
  34. package/define-templates-4A2yHcMF.js +52 -0
  35. package/define-templates-Cunsb_Tr.cjs +1 -0
  36. package/factories/define-global-styles.d.ts +7 -0
  37. package/factories/define-media-query.d.ts +8 -0
  38. package/factories/define-templates.d.ts +27 -0
  39. package/factories/define-variables.d.ts +12 -0
  40. package/factories/index.d.ts +4 -0
  41. package/generators/class-name-generator.d.ts +6 -0
  42. package/generators/index.cjs +1 -0
  43. package/generators/index.d.ts +2 -0
  44. package/generators/index.js +86 -0
  45. package/generators/styled-generator.d.ts +19 -0
  46. package/generators/styles-generator.d.ts +22 -0
  47. package/helpers/color.d.ts +18 -0
  48. package/helpers/index.cjs +1 -0
  49. package/helpers/index.d.ts +1 -0
  50. package/helpers/index.js +1152 -0
  51. package/index-B6M9WK93.cjs +38 -0
  52. package/index-B_bv7TCc.js +503 -0
  53. package/package.json +34 -2
  54. package/parse-styles-C6OYNcYI.cjs +5 -0
  55. package/parse-styles-Cc_Ir3PV.js +132 -0
  56. package/parsers/index.cjs +1 -0
  57. package/parsers/index.d.ts +5 -0
  58. package/parsers/index.js +30 -0
  59. package/parsers/parse-modifiers.d.ts +3 -0
  60. package/parsers/parse-styles.d.ts +13 -0
  61. package/parsers/parse-templates.d.ts +4 -0
  62. package/parsers/parse-tokens.d.ts +3 -0
  63. package/parsers/parser-types.d.ts +8 -0
  64. package/parsers/property-name-check.d.ts +1 -0
  65. package/parsers/unit-check.d.ts +7 -0
  66. package/react-vanilla-file-CCXbsjIb.js +18 -0
  67. package/react-vanilla-file-CG_WJLam.cjs +15 -0
  68. package/{salty.config-D9ANEDiH.js → salty.config-BhBY_oOk.js} +1 -0
  69. package/{salty.config-BupieCfE.cjs → salty.config-Dk6ZcCxI.cjs} +3 -2
  70. package/server/index.cjs +1 -0
  71. package/server/index.d.ts +1 -0
  72. package/server/index.js +12 -0
  73. package/server/should-restart.d.ts +1 -0
  74. package/templates/salty-reset.d.ts +2 -0
  75. package/types/cli-types.d.ts +10 -0
  76. package/types/config-types.d.ts +84 -0
  77. package/types/index.d.ts +52 -22
  78. package/util/dot-case.d.ts +1 -0
  79. package/util/index.cjs +1 -1
  80. package/util/index.js +1 -1
  81. package/util/module-type.d.ts +1 -0
  82. package/config/config-types.d.ts +0 -59
  83. package/generator/index.cjs +0 -1
  84. package/generator/index.d.ts +0 -1
  85. package/generator/index.js +0 -61
  86. package/generator/parse-modifiers.d.ts +0 -3
  87. package/generator/parse-styles.d.ts +0 -2
  88. package/generator/parse-templates.d.ts +0 -2
  89. package/generator/parse-tokens.d.ts +0 -2
  90. package/generator/parser-types.d.ts +0 -4
  91. package/generator/style-generator.d.ts +0 -28
  92. package/parse-templates-D4p3pgQR.js +0 -92
  93. package/parse-templates-W0YfTmOT.cjs +0 -8
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const m=require("../parse-styles-C6OYNcYI.cjs"),w=require("../dash-case-BJEkFEGQ.cjs"),C=async({animationName:l,params:u,appendInitialStyles:y,...t})=>{const n=l||w.toHash(t),r=async(s={})=>{const{duration:e="500ms",easing:o="ease-in-out",delay:i="0s",iterationCount:S="1",direction:p="normal",fillMode:g="forwards",playState:b="running"}={...u,...s},a=`${n} ${e} ${o} ${i} ${S} ${p} ${g} ${b}`;if(!y)return a;const c=t.from||t["0%"];if(!c)return a;const j=await m.parseAndJoinStyles(c,"");return`${a};${j}`},$=Object.entries(t).map(async([s,e])=>{if(!e)return"";const o=await m.parseAndJoinStyles(e,"");return`${typeof s=="number"?`${s}%`:s}{${o}}`}),d=(await Promise.all($)).join(""),f=`@keyframes ${n} {${d}}`;return Object.assign(r,{toString:r,isKeyframes:!0,animationName:n,css:f,keyframes:t}),r};exports.keyframes=C;
@@ -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) => Promise<(params?: KeyframesParams) => Promise<string>>;
22
+ export {};
@@ -0,0 +1,34 @@
1
+ import { p as m } from "../parse-styles-Cc_Ir3PV.js";
2
+ import { t as j } from "../dash-case-DBThphLm.js";
3
+ const v = async ({ animationName: $, params: f, appendInitialStyles: l, ...t }) => {
4
+ const r = $ || j(t), o = async (n = {}) => {
5
+ const {
6
+ duration: s = "500ms",
7
+ easing: e = "ease-in-out",
8
+ delay: i = "0s",
9
+ iterationCount: d = "1",
10
+ direction: S = "normal",
11
+ fillMode: g = "forwards",
12
+ playState: w = "running"
13
+ } = { ...f, ...n }, a = `${r} ${s} ${e} ${i} ${d} ${S} ${g} ${w}`;
14
+ if (!l) return a;
15
+ const c = t.from || t["0%"];
16
+ if (!c) return a;
17
+ const b = await m(c, "");
18
+ return `${a};${b}`;
19
+ }, u = Object.entries(t).map(async ([n, s]) => {
20
+ if (!s) return "";
21
+ const e = await m(s, "");
22
+ return `${typeof n == "number" ? `${n}%` : n}{${e}}`;
23
+ }), p = (await Promise.all(u)).join(""), y = `@keyframes ${r} {${p}}`;
24
+ return Object.assign(o, {
25
+ toString: o,
26
+ isKeyframes: !0,
27
+ animationName: r,
28
+ css: y,
29
+ keyframes: t
30
+ }), o;
31
+ };
32
+ export {
33
+ v 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 n=(...t)=>t.flat().reduce((e,r)=>r!=null&&r._current?{...e,...r._current}:{...e,...r},{}),u=(...t)=>t.flat().reduce((e,r)=>({...e,...r._children}),{});exports.mergeFactories=u;exports.mergeObjects=n;
package/css/merge.d.ts ADDED
@@ -0,0 +1,7 @@
1
+ interface StyleFactory {
2
+ _current: Record<string, any>;
3
+ _children: Record<string, any>;
4
+ }
5
+ export declare const mergeObjects: <T = any>(...styles: any[]) => T;
6
+ export declare const mergeFactories: <T extends StyleFactory>(...factories: T[][]) => T;
7
+ export {};
package/css/merge.js ADDED
@@ -0,0 +1,5 @@
1
+ const u = (...n) => n.flat().reduce((e, r) => r != null && r._current ? { ...e, ...r._current } : { ...e, ...r }, {}), t = (...n) => n.flat().reduce((e, r) => ({ ...e, ...r._children }), {});
2
+ export {
3
+ t as mergeFactories,
4
+ u as mergeObjects
5
+ };
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
@@ -0,0 +1,4 @@
1
+ const t = (o) => `{${o}}`;
2
+ export {
3
+ t as token
4
+ };
@@ -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,52 @@
1
+ var n = Object.defineProperty;
2
+ var h = (e, t, r) => t in e ? n(e, t, { enumerable: !0, configurable: !0, writable: !0, value: r }) : e[t] = r;
3
+ var s = (e, t, r) => h(e, typeof t != "symbol" ? t + "" : t, r);
4
+ class i {
5
+ constructor(t) {
6
+ s(this, "_path");
7
+ this.params = t;
8
+ }
9
+ get _current() {
10
+ return this.params.template;
11
+ }
12
+ get isDefineTemplate() {
13
+ return !0;
14
+ }
15
+ _setPath(t) {
16
+ return this._path = t, this;
17
+ }
18
+ }
19
+ class p {
20
+ constructor(t) {
21
+ s(this, "_path");
22
+ s(this, "templates", []);
23
+ this.params = t, Object.entries(t).forEach(([r, a]) => {
24
+ this.templates.push(
25
+ new i({
26
+ name: r,
27
+ template: a
28
+ })
29
+ );
30
+ });
31
+ }
32
+ get _current() {
33
+ return this.params;
34
+ }
35
+ get _children() {
36
+ return Object.fromEntries(
37
+ this.templates.map((t) => [t.params.name, t])
38
+ );
39
+ }
40
+ get isDefineTemplates() {
41
+ return !0;
42
+ }
43
+ _setPath(t) {
44
+ return this._path = t, this.templates.forEach((r) => r._setPath(t)), this;
45
+ }
46
+ }
47
+ const m = (e) => new p(e);
48
+ export {
49
+ i as T,
50
+ p as a,
51
+ m as d
52
+ };
@@ -0,0 +1 @@
1
+ "use strict";var i=Object.defineProperty;var p=(e,t,r)=>t in e?i(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r;var s=(e,t,r)=>p(e,typeof t!="symbol"?t+"":t,r);class a{constructor(t){s(this,"_path");this.params=t}get _current(){return this.params.template}get isDefineTemplate(){return!0}_setPath(t){return this._path=t,this}}class n{constructor(t){s(this,"_path");s(this,"templates",[]);this.params=t,Object.entries(t).forEach(([r,h])=>{this.templates.push(new a({name:r,template:h}))})}get _current(){return this.params}get _children(){return Object.fromEntries(this.templates.map(t=>[t.params.name,t]))}get isDefineTemplates(){return!0}_setPath(t){return this._path=t,this.templates.forEach(r=>r._setPath(t)),this}}const c=e=>new n(e);exports.TemplateFactory=a;exports.TemplatesFactory=n;exports.defineTemplates=c;
@@ -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,8 @@
1
+ import { MediaQueryFactory } from '../css/media';
2
+ type MediaDefinitionCallback = (media: MediaQueryFactory) => ReturnType<MediaQueryFactory['next']>;
3
+ export declare const defineMediaQuery: (mediaFactory: MediaDefinitionCallback) => string & {
4
+ isMedia: boolean;
5
+ and: MediaQueryFactory;
6
+ or: MediaQueryFactory;
7
+ };
8
+ export {};
@@ -0,0 +1,27 @@
1
+ import { CssTemplateFunction, CssTemplateObject, CssTemplates } from '../types/config-types';
2
+ export interface TemplateFactoryParams {
3
+ name: string;
4
+ template: CssTemplateObject | CssTemplateFunction;
5
+ }
6
+ export declare class TemplateFactory {
7
+ params: TemplateFactoryParams;
8
+ _path?: string;
9
+ constructor(params: TemplateFactoryParams);
10
+ get _current(): CssTemplateObject | CssTemplateFunction;
11
+ get isDefineTemplate(): boolean;
12
+ _setPath(path: string): this;
13
+ }
14
+ export type TemplatesFactoryParams = CssTemplates;
15
+ export declare class TemplatesFactory {
16
+ params: TemplatesFactoryParams;
17
+ _path?: string;
18
+ private templates;
19
+ constructor(params: TemplatesFactoryParams);
20
+ get _current(): CssTemplates;
21
+ get _children(): {
22
+ [k: string]: TemplateFactory;
23
+ };
24
+ get isDefineTemplates(): boolean;
25
+ _setPath(path: string): this;
26
+ }
27
+ export declare const defineTemplates: (templates: TemplatesFactoryParams) => 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,4 @@
1
+ export * from './define-global-styles';
2
+ export * from './define-media-query';
3
+ export * from './define-variables';
4
+ export * from './define-templates';
@@ -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 g=Object.defineProperty;var C=(a,t,s)=>t in a?g(a,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):a[t]=s;var m=(a,t,s)=>C(a,typeof t!="symbol"?t+"":t,s);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const N=require("../parse-styles-C6OYNcYI.cjs"),c=require("../dash-case-BJEkFEGQ.cjs");class f{constructor(t){m(this,"buildContext",{});this.params=t}get priority(){return 0}get isRoot(){return this.priority===0}get hash(){return c.toHash(this.params.base||this.params)}get cssClassName(){return this.hash}get classNames(){const t=new Set([this.cssClassName]),{className:s}=this.params;return typeof s=="string"&&t.add(s),typeof s=="object"&&s.forEach(e=>t.add(e)),this.getTemplateClasses().forEach(e=>t.add(e)),this.buildContext.classNames&&this.buildContext.classNames.forEach(e=>t.add(e)),[...t].join(" ")}get cssFileName(){const{callerName:t}=this.buildContext;return t?`cl_${c.dashCase(t)}-${this.hash}.css`:`${this.hash}.css`}get css(){const{base:t={},variants:s={},compoundVariants:e=[]}=this.params,{config:i}=this.buildContext,n={...t,variants:s,compoundVariants:e};return N.parseAndJoinStyles(n,`.${this.cssClassName}`,i,this.isRoot)}getTemplateClasses(t=this.buildContext.config){if(!(t!=null&&t.templates)||!this.params.base||this.priority>0)return[];const s=Object.keys(t.templates);return Object.entries(this.params.base).reduce((e,[i,n])=>(s.includes(i)&&e.push("t_"+c.toHash(c.dashCase(`${i}-${n}`),4)),e),[])}_withBuildContext(t){return this.buildContext=t,this}}class S extends f{constructor(t){super(t),this._params=t}}class x extends f{constructor(t,s){super(s),this.tagName=t,this._params=s}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 clientProps(){const{element:t,variants:s={},compoundVariants:e=[],defaultVariants:i={},defaultProps:n={},passProps:d}=this.params,{callerName:y,isProduction:b}=this.buildContext,h=new Set([]),l=r=>{const o=i[r];o!==void 0?h.add(`${r}=${String(o)}`):h.add(r)};Object.keys(s).forEach(l),e.map(r=>Object.keys(r).forEach(l));const p=new Set([]);if(this.params.base){const r=JSON.stringify(this.params.base).match(/\{props\.([\w\d]+)\}/gi);r&&r.forEach(o=>{const u=o.replace(/\{props\.([\w\d]+)\}/gi,"$1");u&&p.add(u)})}return{element:t,variantKeys:[...h],propValueKeys:[...p],passProps:d,defaultProps:n,attr:{"data-component-name":b?void 0:y}}}}exports.ClassNameGenerator=S;exports.StyledGenerator=x;
@@ -0,0 +1,2 @@
1
+ export * from './class-name-generator';
2
+ export * from './styled-generator';
@@ -0,0 +1,86 @@
1
+ var N = Object.defineProperty;
2
+ var C = (a, t, s) => t in a ? N(a, t, { enumerable: !0, configurable: !0, writable: !0, value: s }) : a[t] = s;
3
+ var u = (a, t, s) => C(a, typeof t != "symbol" ? t + "" : t, s);
4
+ import { p as x } from "../parse-styles-Cc_Ir3PV.js";
5
+ import { t as m, d as f } from "../dash-case-DBThphLm.js";
6
+ class y {
7
+ constructor(t) {
8
+ u(this, "buildContext", {});
9
+ this.params = t;
10
+ }
11
+ get priority() {
12
+ return 0;
13
+ }
14
+ get isRoot() {
15
+ return this.priority === 0;
16
+ }
17
+ get hash() {
18
+ return m(this.params.base || this.params);
19
+ }
20
+ get cssClassName() {
21
+ return this.hash;
22
+ }
23
+ get classNames() {
24
+ const t = /* @__PURE__ */ new Set([this.cssClassName]), { className: s } = this.params;
25
+ return typeof s == "string" && t.add(s), typeof s == "object" && s.forEach((e) => t.add(e)), this.getTemplateClasses().forEach((e) => t.add(e)), this.buildContext.classNames && this.buildContext.classNames.forEach((e) => t.add(e)), [...t].join(" ");
26
+ }
27
+ get cssFileName() {
28
+ const { callerName: t } = this.buildContext;
29
+ return t ? `cl_${f(t)}-${this.hash}.css` : `${this.hash}.css`;
30
+ }
31
+ get css() {
32
+ const { base: t = {}, variants: s = {}, compoundVariants: e = [] } = this.params, { config: i } = this.buildContext, n = { ...t, variants: s, compoundVariants: e };
33
+ return x(n, `.${this.cssClassName}`, i, this.isRoot);
34
+ }
35
+ getTemplateClasses(t = this.buildContext.config) {
36
+ if (!(t != null && t.templates) || !this.params.base || this.priority > 0) return [];
37
+ const s = Object.keys(t.templates);
38
+ return Object.entries(this.params.base).reduce((e, [i, n]) => (s.includes(i) && e.push("t_" + m(f(`${i}-${n}`), 4)), e), []);
39
+ }
40
+ _withBuildContext(t) {
41
+ return this.buildContext = t, this;
42
+ }
43
+ }
44
+ class v extends y {
45
+ constructor(t) {
46
+ super(t), this._params = t;
47
+ }
48
+ }
49
+ class V extends y {
50
+ constructor(t, s) {
51
+ super(s), this.tagName = t, this._params = s;
52
+ }
53
+ get priority() {
54
+ var t;
55
+ return typeof this.tagName == "function" || typeof this.tagName == "object" ? (((t = this.tagName.generator) == null ? void 0 : t.priority) || 0) + 1 : 0;
56
+ }
57
+ get clientProps() {
58
+ const { element: t, variants: s = {}, compoundVariants: e = [], defaultVariants: i = {}, defaultProps: n = {}, passProps: h } = this.params, { callerName: b, isProduction: g } = this.buildContext, c = /* @__PURE__ */ new Set([]), d = (r) => {
59
+ const o = i[r];
60
+ o !== void 0 ? c.add(`${r}=${String(o)}`) : c.add(r);
61
+ };
62
+ Object.keys(s).forEach(d), e.map((r) => Object.keys(r).forEach(d));
63
+ const p = /* @__PURE__ */ new Set([]);
64
+ if (this.params.base) {
65
+ const r = JSON.stringify(this.params.base).match(/\{props\.([\w\d]+)\}/gi);
66
+ r && r.forEach((o) => {
67
+ const l = o.replace(/\{props\.([\w\d]+)\}/gi, "$1");
68
+ l && p.add(l);
69
+ });
70
+ }
71
+ return {
72
+ element: t,
73
+ variantKeys: [...c],
74
+ propValueKeys: [...p],
75
+ passProps: h,
76
+ defaultProps: n,
77
+ attr: {
78
+ "data-component-name": g ? void 0 : b
79
+ }
80
+ };
81
+ }
82
+ }
83
+ export {
84
+ v as ClassNameGenerator,
85
+ V as StyledGenerator
86
+ };
@@ -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,22 @@
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
+ classNames?: string[];
8
+ }
9
+ export declare class StylesGenerator<const STYLE_PARAMS extends StyledParams = StyledParams> {
10
+ params: STYLE_PARAMS;
11
+ buildContext: StylesGeneratorBuildTimeProps;
12
+ constructor(params: STYLE_PARAMS);
13
+ get priority(): number;
14
+ get isRoot(): boolean;
15
+ get hash(): string;
16
+ get cssClassName(): string;
17
+ get classNames(): string;
18
+ get cssFileName(): string;
19
+ get css(): Promise<string>;
20
+ getTemplateClasses(config?: SaltyConfig | undefined): string[];
21
+ _withBuildContext(context: StylesGeneratorBuildTimeProps): this;
22
+ }
@@ -0,0 +1,18 @@
1
+ import { CachedConfig } from '../config';
2
+ import { ColorInstance, ColorLike } from 'color';
3
+ declare global {
4
+ const saltyConfig: CachedConfig;
5
+ }
6
+ type BaseColor = Omit<ColorLike, string> | PropertyValueToken;
7
+ declare class Color {
8
+ base: BaseColor;
9
+ isColor: boolean;
10
+ currentColor: ColorInstance;
11
+ constructor(base: BaseColor);
12
+ private _createProxy;
13
+ private _resolveBaseColor;
14
+ _handleColorMethod(method: keyof ColorInstance): any;
15
+ toString(): string;
16
+ }
17
+ export declare const color: (value: BaseColor) => Color & ColorInstance;
18
+ export {};