@salty-css/core 0.0.1-alpha.23 → 0.0.1-alpha.230

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 (95) hide show
  1. package/.saltyrc.schema.json +48 -0
  2. package/README.md +463 -26
  3. package/bin/index.cjs +1 -8
  4. package/bin/index.js +2 -129
  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/get-function-range.d.ts +1 -0
  11. package/compiler/index.cjs +1 -11
  12. package/compiler/index.d.ts +19 -11
  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 +12 -2
  18. package/css/index.cjs +1 -1
  19. package/css/index.d.ts +4 -1
  20. package/css/index.js +10 -2
  21. package/css/keyframes.cjs +1 -0
  22. package/css/keyframes.d.ts +22 -0
  23. package/css/keyframes.js +34 -0
  24. package/css/media.cjs +1 -0
  25. package/css/media.d.ts +87 -0
  26. package/css/media.js +88 -0
  27. package/css/merge.cjs +1 -0
  28. package/css/merge.d.ts +7 -0
  29. package/css/merge.js +5 -0
  30. package/css/token.cjs +1 -0
  31. package/css/token.d.ts +1 -0
  32. package/css/token.js +4 -0
  33. package/{dash-case-DKzpenwY.cjs → dash-case-BJEkFEGQ.cjs} +1 -1
  34. package/{dash-case-DMQMcCO6.js → dash-case-DBThphLm.js} +2 -2
  35. package/define-templates-4A2yHcMF.js +52 -0
  36. package/define-templates-Cunsb_Tr.cjs +1 -0
  37. package/factories/define-global-styles.d.ts +7 -0
  38. package/factories/define-media-query.d.ts +8 -0
  39. package/factories/define-templates.d.ts +27 -0
  40. package/factories/define-variables.d.ts +12 -0
  41. package/factories/index.d.ts +4 -0
  42. package/generators/class-name-generator.d.ts +6 -0
  43. package/generators/index.cjs +1 -0
  44. package/generators/index.d.ts +2 -0
  45. package/generators/index.js +86 -0
  46. package/generators/styled-generator.d.ts +19 -0
  47. package/generators/styles-generator.d.ts +22 -0
  48. package/helpers/color.d.ts +18 -0
  49. package/helpers/index.cjs +1 -0
  50. package/helpers/index.d.ts +2 -0
  51. package/helpers/index.js +1156 -0
  52. package/helpers/viewport-clamp.d.ts +8 -0
  53. package/index-CuYozIxT.js +507 -0
  54. package/index-q4N-TRZZ.cjs +38 -0
  55. package/package.json +34 -2
  56. package/parse-styles-3N79AOBO.cjs +5 -0
  57. package/parse-styles-Bo7fQ_SV.js +134 -0
  58. package/parsers/index.cjs +1 -0
  59. package/parsers/index.d.ts +5 -0
  60. package/parsers/index.js +30 -0
  61. package/parsers/parse-modifiers.d.ts +3 -0
  62. package/parsers/parse-styles.d.ts +13 -0
  63. package/parsers/parse-templates.d.ts +4 -0
  64. package/parsers/parse-tokens.d.ts +3 -0
  65. package/parsers/parser-types.d.ts +8 -0
  66. package/parsers/property-name-check.d.ts +1 -0
  67. package/parsers/unit-check.d.ts +7 -0
  68. package/react-vanilla-file-CCXbsjIb.js +18 -0
  69. package/react-vanilla-file-CG_WJLam.cjs +15 -0
  70. package/{salty.config-D9ANEDiH.js → salty.config-BhBY_oOk.js} +1 -0
  71. package/{salty.config-BupieCfE.cjs → salty.config-Dk6ZcCxI.cjs} +3 -2
  72. package/server/index.cjs +1 -0
  73. package/server/index.d.ts +1 -0
  74. package/server/index.js +12 -0
  75. package/server/should-restart.d.ts +1 -0
  76. package/templates/salty-reset.d.ts +2 -0
  77. package/types/cli-types.d.ts +10 -0
  78. package/types/config-types.d.ts +84 -0
  79. package/types/index.d.ts +53 -22
  80. package/util/dot-case.d.ts +1 -0
  81. package/util/index.cjs +1 -1
  82. package/util/index.js +1 -1
  83. package/util/module-type.d.ts +1 -0
  84. package/config/config-types.d.ts +0 -59
  85. package/generator/index.cjs +0 -1
  86. package/generator/index.d.ts +0 -1
  87. package/generator/index.js +0 -61
  88. package/generator/parse-modifiers.d.ts +0 -3
  89. package/generator/parse-styles.d.ts +0 -2
  90. package/generator/parse-templates.d.ts +0 -2
  91. package/generator/parse-tokens.d.ts +0 -2
  92. package/generator/parser-types.d.ts +0 -4
  93. package/generator/style-generator.d.ts +0 -28
  94. package/parse-templates-D4p3pgQR.js +0 -92
  95. package/parse-templates-W0YfTmOT.cjs +0 -8
@@ -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,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;