@salty-css/core 0.0.1-alpha.30 → 0.0.1-alpha.301

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 (118) hide show
  1. package/.saltyrc.schema.json +48 -0
  2. package/README.md +469 -26
  3. package/bin/index.cjs +3 -1
  4. package/bin/index.js +2 -2
  5. package/bin/main.cjs +445 -8
  6. package/bin/main.js +424 -121
  7. package/cache/resolve-dynamic-config-cache.cjs +13 -0
  8. package/cache/resolve-dynamic-config-cache.d.ts +1 -0
  9. package/cache/resolve-dynamic-config-cache.js +13 -0
  10. package/compiler/get-files.d.ts +3 -0
  11. package/compiler/get-function-range.d.ts +1 -0
  12. package/compiler/helpers.d.ts +2 -0
  13. package/compiler/index.cjs +774 -11
  14. package/compiler/index.d.ts +22 -11
  15. package/compiler/index.js +735 -153
  16. package/config/define-config.d.ts +1 -1
  17. package/config/index.cjs +16 -1
  18. package/config/index.d.ts +2 -1
  19. package/config/index.js +14 -2
  20. package/css/index.cjs +12 -1
  21. package/css/index.d.ts +4 -1
  22. package/css/index.js +10 -2
  23. package/css/keyframes.cjs +49 -0
  24. package/css/keyframes.d.ts +22 -0
  25. package/css/keyframes.js +49 -0
  26. package/css/media.cjs +93 -0
  27. package/css/media.d.ts +87 -0
  28. package/css/media.js +93 -0
  29. package/css/merge.cjs +15 -0
  30. package/css/merge.d.ts +7 -0
  31. package/css/merge.js +15 -0
  32. package/css/token.cjs +4 -0
  33. package/css/token.d.ts +1 -0
  34. package/css/token.js +4 -0
  35. package/dash-case-Cz8wwE9a.cjs +32 -0
  36. package/dash-case-NMk0mXyT.js +33 -0
  37. package/define-templates-CVhhgPnd.js +60 -0
  38. package/define-templates-Deq1aCbN.cjs +59 -0
  39. package/factories/define-global-styles.d.ts +7 -0
  40. package/factories/define-media-query.d.ts +8 -0
  41. package/factories/define-templates.d.ts +27 -0
  42. package/factories/define-variables.d.ts +12 -0
  43. package/factories/index.cjs +37 -0
  44. package/factories/index.d.ts +4 -0
  45. package/factories/index.js +37 -0
  46. package/generators/class-name-generator.d.ts +6 -0
  47. package/generators/index.cjs +121 -0
  48. package/generators/index.d.ts +2 -0
  49. package/generators/index.js +121 -0
  50. package/generators/styled-generator.d.ts +20 -0
  51. package/generators/styles-generator.d.ts +22 -0
  52. package/helpers/color.d.ts +18 -0
  53. package/helpers/index.cjs +53 -0
  54. package/helpers/index.d.ts +2 -0
  55. package/helpers/index.js +53 -0
  56. package/helpers/viewport-clamp.d.ts +9 -0
  57. package/helpers-DM2fbDDz.js +18 -0
  58. package/helpers-wv74jTRI.cjs +18 -0
  59. package/index-ByR0nfaf.cjs +4 -0
  60. package/index-DKz1QXqs.js +4 -0
  61. package/package.json +54 -6
  62. package/parse-styles-CqBQc3eQ.js +232 -0
  63. package/parse-styles-D-p_guRO.cjs +231 -0
  64. package/parsers/index.cjs +57 -0
  65. package/parsers/index.d.ts +5 -0
  66. package/parsers/index.js +58 -0
  67. package/parsers/parse-modifiers.d.ts +3 -0
  68. package/parsers/parse-styles.d.ts +13 -0
  69. package/parsers/parse-templates.d.ts +4 -0
  70. package/parsers/parse-tokens.d.ts +3 -0
  71. package/parsers/parser-types.d.ts +8 -0
  72. package/parsers/property-name-check.d.ts +1 -0
  73. package/parsers/unit-check.d.ts +7 -0
  74. package/pascal-case-By_l58S-.cjs +7 -0
  75. package/pascal-case-F3Usi5Wf.js +8 -0
  76. package/{react-styled-file-CGVf5n1B.js → react-styled-file-B99mwk0w.js} +2 -2
  77. package/react-styled-file-U02jek-B.cjs +11 -0
  78. package/react-vanilla-file-Bj6XC8GS.cjs +18 -0
  79. package/react-vanilla-file-D9px70iK.js +18 -0
  80. package/salty.config-DjosWdPw.js +4 -0
  81. package/salty.config-cqavVm2t.cjs +4 -0
  82. package/server/index.cjs +4 -0
  83. package/server/index.d.ts +1 -0
  84. package/server/index.js +4 -0
  85. package/server/should-restart.d.ts +1 -0
  86. package/should-restart-5jI-bzz0.js +18 -0
  87. package/should-restart-DoaGoD5T.cjs +17 -0
  88. package/templates/salty-reset.d.ts +2 -0
  89. package/types/cli-types.d.ts +10 -0
  90. package/types/config-types.d.ts +85 -0
  91. package/types/index.d.ts +57 -23
  92. package/util/dot-case.d.ts +1 -0
  93. package/util/index.cjs +13 -1
  94. package/util/index.js +10 -8
  95. package/util/module-type.d.ts +1 -0
  96. package/viewport-clamp-CEmzmcSj.cjs +10 -0
  97. package/viewport-clamp-K553uXu3.js +11 -0
  98. package/config/config-types.d.ts +0 -59
  99. package/dash-case-DKzpenwY.cjs +0 -1
  100. package/dash-case-DMQMcCO6.js +0 -19
  101. package/generator/index.cjs +0 -1
  102. package/generator/index.d.ts +0 -1
  103. package/generator/index.js +0 -61
  104. package/generator/parse-modifiers.d.ts +0 -3
  105. package/generator/parse-styles.d.ts +0 -2
  106. package/generator/parse-templates.d.ts +0 -2
  107. package/generator/parse-tokens.d.ts +0 -2
  108. package/generator/parser-types.d.ts +0 -4
  109. package/generator/style-generator.d.ts +0 -28
  110. package/index-84Wroia-.cjs +0 -1
  111. package/index-D_732b92.js +0 -4
  112. package/parse-templates-D4p3pgQR.js +0 -92
  113. package/parse-templates-W0YfTmOT.cjs +0 -8
  114. package/pascal-case-BQpR5PdN.js +0 -6
  115. package/pascal-case-iWoaJWwT.cjs +0 -1
  116. package/react-styled-file-Dkubsz-U.cjs +0 -8
  117. package/salty.config-BupieCfE.cjs +0 -6
  118. package/salty.config-D9ANEDiH.js +0 -9
@@ -1 +0,0 @@
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 +0,0 @@
1
- export * from './style-generator';
@@ -1,61 +0,0 @@
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) {
8
- c(this, "_callerName");
9
- c(this, "_context");
10
- this.tagName = t, this.params = s;
11
- }
12
- get hash() {
13
- return l(this.params.base || this.params);
14
- }
15
- 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
- }
19
- get classNames() {
20
- const t = [this.hash], { className: s } = this.params;
21
- return s && t.push(s), t.join(" ");
22
- }
23
- get cssClassName() {
24
- return this.hash;
25
- }
26
- get cssDisplayNameVar() {
27
- return `--${this.hash}-display-name: ${this._callerName};`;
28
- }
29
- get templateKeys() {
30
- var t;
31
- return (t = this._context) != null && t.config.templates ? g(this._context.config.templates) : [];
32
- }
33
- 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);
37
- }
38
- 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]
51
- };
52
- }
53
- _withBuildContext(t) {
54
- this._context = t;
55
- const { name: s, config: r } = t;
56
- return this._callerName = s, this;
57
- }
58
- }
59
- export {
60
- d as StyleComponentGenerator
61
- };
@@ -1,3 +0,0 @@
1
- import { CssModifiers } from '../config/config-types';
2
- import { ValueParserReturnValue } from './parser-types';
3
- export declare const parseValueModifiers: (value: string, modifiers?: CssModifiers) => ValueParserReturnValue;
@@ -1,2 +0,0 @@
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,2 +0,0 @@
1
- export declare const parseTemplates: <T extends object>(obj: T, path?: PropertyKey[]) => string;
2
- export declare const getTemplateKeys: <T extends object>(templates: T) => string[];
@@ -1,2 +0,0 @@
1
- import { ValueParserReturnValue } from './parser-types';
2
- export declare const parseValueTokens: (value: string) => ValueParserReturnValue;
@@ -1,4 +0,0 @@
1
- export interface ValueParserReturnValue {
2
- result: string;
3
- additionalCss?: Object[];
4
- }
@@ -1,28 +0,0 @@
1
- import { StyledParams, Tag } from '../types';
2
- export interface GeneratorProps {
3
- element?: string;
4
- variantKeys?: string[];
5
- propValueKeys?: string[];
6
- }
7
- export declare class StyleComponentGenerator {
8
- tagName: Tag<any>;
9
- params: StyledParams;
10
- _callerName: string | undefined;
11
- _context: {
12
- name: string;
13
- config: any;
14
- } | undefined;
15
- constructor(tagName: Tag<any>, params: StyledParams);
16
- get hash(): string;
17
- get priority(): number;
18
- get classNames(): string;
19
- get cssClassName(): string;
20
- get cssDisplayNameVar(): string;
21
- get templateKeys(): string[];
22
- get css(): string;
23
- get props(): GeneratorProps;
24
- _withBuildContext(context: {
25
- name: string;
26
- config: any;
27
- }): this;
28
- }
@@ -1 +0,0 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e="/* Empty */";exports.default=e;
package/index-D_732b92.js DELETED
@@ -1,4 +0,0 @@
1
- const t = "/* Empty */";
2
- export {
3
- t as default
4
- };
@@ -1,92 +0,0 @@
1
- import { d as O } from "./dash-case-DMQMcCO6.js";
2
- const N = (t, r) => {
3
- if (typeof t != "string") return { result: t };
4
- if (!r) return { result: t };
5
- const e = [];
6
- return Object.values(r).forEach((n) => {
7
- const { pattern: o, transform: c } = n;
8
- t = t.replace(o, (h) => {
9
- const { value: i, css: m } = c(h);
10
- return m && e.push(m), i;
11
- });
12
- }), { result: t, additionalCss: e };
13
- }, P = (t) => typeof t != "string" ? { result: t } : /\{[^{}]+\}/g.test(t) ? { result: t.replace(/\{([^{}]+)\}/g, (...n) => `var(--${O(n[1].replaceAll(".", "-"))})`) } : { result: t }, d = (t, r, e, n) => {
14
- if (!t) return "";
15
- const o = [], c = Object.entries(t).reduce((i, [m, s]) => {
16
- const p = m.trim();
17
- if (typeof s == "function" && (s = s()), typeof s == "object") {
18
- if (!s) return i;
19
- if (p === "variants")
20
- return Object.entries(s).forEach(([u, f]) => {
21
- f && Object.entries(f).forEach(([b, j]) => {
22
- if (!j) return;
23
- const l = `${r}.${u}-${b}`, y = d(j, l, e);
24
- o.push(y);
25
- });
26
- }), i;
27
- if (p === "defaultVariants")
28
- return i;
29
- if (p === "compoundVariants")
30
- return s.forEach((u) => {
31
- const { css: f, ...b } = u, j = Object.entries(b).reduce((y, [V, W]) => `${y}.${V}-${W}`, r), l = d(f, j, e);
32
- o.push(l);
33
- }), i;
34
- if (p.startsWith("@")) {
35
- const u = d(s, r, e), f = `${p} {
36
- ${u.replace(`
37
- `, `
38
- `)}
39
- }`;
40
- return o.push(f), i;
41
- }
42
- const $ = m.includes("&") ? p.replace("&", r) : p.startsWith(":") ? `${r}${p}` : `${r} ${p}`, a = d(s, $, e);
43
- return o.push(a), i;
44
- }
45
- if (n != null && n.templates && n.templates[p]) {
46
- const a = s.split(".").reduce((f, b) => f[b], n.templates[p]), u = d(a, "");
47
- return `${i}${u}`;
48
- }
49
- const g = p.startsWith("-") ? p : O(p), E = ($, a = ";") => i = `${i}${$}${a}`, S = ($) => E(`${g}:${$}`);
50
- if (typeof s == "number") return S(s);
51
- if (typeof s != "string")
52
- if ("toString" in s) s = s.toString();
53
- else return i;
54
- const { modifiers: k } = n || {}, T = function* () {
55
- yield P(s), yield N(s, k);
56
- }();
57
- for (const { result: $, additionalCss: a = [] } of T)
58
- s = $, a.forEach((u) => {
59
- const f = d(u, "");
60
- E(f, "");
61
- });
62
- return S(s);
63
- }, "");
64
- if (!c) return o.join(`
65
- `);
66
- if (!r) return c;
67
- let h = "";
68
- return e !== void 0 ? h = `@layer l${e} { ${r} { ${c} } }` : h = `${r} { ${c} }`, [h, ...o].join(`
69
- `);
70
- }, _ = (t, r = []) => {
71
- if (!t) return "";
72
- const e = [], n = {};
73
- if (Object.entries(t).forEach(([o, c]) => {
74
- if (typeof c == "object") {
75
- if (!c) return;
76
- const h = o.trim(), i = _(c, [...r, h]);
77
- e.push(i);
78
- } else
79
- n[o] = c;
80
- }), Object.keys(n).length) {
81
- const o = r.map(O).join("-"), c = d(n, `.${o}`);
82
- e.push(c);
83
- }
84
- return e.join(`
85
- `);
86
- }, A = (t) => Object.keys(t);
87
- export {
88
- _ as a,
89
- P as b,
90
- A as g,
91
- d as p
92
- };
@@ -1,8 +0,0 @@
1
- "use strict";const O=require("./dash-case-DKzpenwY.cjs"),N=(t,e)=>{if(typeof t!="string")return{result:t};if(!e)return{result:t};const r=[];return Object.values(e).forEach(n=>{const{pattern:o,transform:c}=n;t=t.replace(o,a=>{const{value:i,css:l}=c(a);return l&&r.push(l),i})}),{result:t,additionalCss:r}},k=t=>typeof t!="string"?{result:t}:/\{[^{}]+\}/g.test(t)?{result:t.replace(/\{([^{}]+)\}/g,(...n)=>`var(--${O.dashCase(n[1].replaceAll(".","-"))})`)}:{result:t},h=(t,e,r,n)=>{if(!t)return"";const o=[],c=Object.entries(t).reduce((i,[l,s])=>{const p=l.trim();if(typeof s=="function"&&(s=s()),typeof s=="object"){if(!s)return i;if(p==="variants")return Object.entries(s).forEach(([u,f])=>{f&&Object.entries(f).forEach(([m,j])=>{if(!j)return;const y=`${e}.${u}-${m}`,b=h(j,y,r);o.push(b)})}),i;if(p==="defaultVariants")return i;if(p==="compoundVariants")return s.forEach(u=>{const{css:f,...m}=u,j=Object.entries(m).reduce((b,[q,K])=>`${b}.${q}-${K}`,e),y=h(f,j,r);o.push(y)}),i;if(p.startsWith("@")){const u=h(s,e,r),f=`${p} {
2
- ${u.replace(`
3
- `,`
4
- `)}
5
- }`;return o.push(f),i}const $=l.includes("&")?p.replace("&",e):p.startsWith(":")?`${e}${p}`:`${e} ${p}`,d=h(s,$,r);return o.push(d),i}if(n!=null&&n.templates&&n.templates[p]){const d=s.split(".").reduce((f,m)=>f[m],n.templates[p]),u=h(d,"");return`${i}${u}`}const V=p.startsWith("-")?p:O.dashCase(p),T=($,d=";")=>i=`${i}${$}${d}`,S=$=>T(`${V}:${$}`);if(typeof s=="number")return S(s);if(typeof s!="string")if("toString"in s)s=s.toString();else return i;const{modifiers:g}=n||{},W=function*(){yield k(s),yield N(s,g)}();for(const{result:$,additionalCss:d=[]}of W)s=$,d.forEach(u=>{const f=h(u,"");T(f,"")});return S(s)},"");if(!c)return o.join(`
6
- `);if(!e)return c;let a="";return r!==void 0?a=`@layer l${r} { ${e} { ${c} } }`:a=`${e} { ${c} }`,[a,...o].join(`
7
- `)},E=(t,e=[])=>{if(!t)return"";const r=[],n={};if(Object.entries(t).forEach(([o,c])=>{if(typeof c=="object"){if(!c)return;const a=o.trim(),i=E(c,[...e,a]);r.push(i)}else n[o]=c}),Object.keys(n).length){const o=e.map(O.dashCase).join("-"),c=h(n,`.${o}`);r.push(c)}return r.join(`
8
- `)},P=t=>Object.keys(t);exports.getTemplateKeys=P;exports.parseStyles=h;exports.parseTemplates=E;exports.parseValueTokens=k;
@@ -1,6 +0,0 @@
1
- function p(e) {
2
- return e ? typeof e != "string" ? p(String(e)) : e.replace(/\s/g, "-").replace(/[-_]([a-z0-9])/g, (a) => a[1].toUpperCase()).replace(/^[a-z]/, (a) => a.toUpperCase()) : "";
3
- }
4
- export {
5
- p
6
- };
@@ -1 +0,0 @@
1
- "use strict";function r(e){return e?typeof e!="string"?r(String(e)):e.replace(/\s/g,"-").replace(/[-_]([a-z0-9])/g,a=>a[1].toUpperCase()).replace(/^[a-z]/,a=>a.toUpperCase()):""}exports.pascalCase=r;
@@ -1,8 +0,0 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=`import { styled } from "@salty-css/react/styled";
2
-
3
- export const <%- name %> = styled('<%- tag %>', {
4
- <% if(className) { %>className: '<%- className %>',<% } %>
5
- base: {
6
- // Add your styles here
7
- }
8
- })`;exports.default=e;
@@ -1,6 +0,0 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=`import { defineConfig } from '@salty-css/core/config';
2
-
3
- export const config = defineConfig({
4
- // Add your custom config here
5
- });
6
- `;exports.default=o;
@@ -1,9 +0,0 @@
1
- const n = `import { defineConfig } from '@salty-css/core/config';
2
-
3
- export const config = defineConfig({
4
- // Add your custom config here
5
- });
6
- `;
7
- export {
8
- n as default
9
- };