@salty-css/core 0.0.1-alpha.99 → 0.0.1
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 +11 -3
- package/README.md +415 -47
- package/bin/index.cjs +3 -1
- package/bin/index.js +2 -2
- package/bin/main.cjs +448 -11
- package/bin/main.js +411 -209
- package/cache/resolve-dynamic-config-cache.cjs +24 -0
- package/cache/resolve-dynamic-config-cache.d.ts +1 -0
- package/cache/resolve-dynamic-config-cache.js +24 -0
- package/class-name-generator-B2Pb2obX.cjs +74 -0
- package/class-name-generator-YeSQe_Ik.js +75 -0
- package/compiler/as-class.cjs +753 -0
- package/compiler/as-class.d.ts +52 -0
- package/compiler/as-class.js +735 -0
- package/compiler/get-files.cjs +25 -0
- package/compiler/get-files.js +25 -0
- package/compiler/get-function-range.cjs +22 -0
- package/compiler/get-function-range.d.ts +1 -0
- package/compiler/get-function-range.js +22 -0
- package/compiler/helpers.cjs +25 -0
- package/compiler/helpers.d.ts +5 -0
- package/compiler/helpers.js +24 -0
- package/config/define-config.d.ts +1 -1
- package/config/index.cjs +16 -1
- package/config/index.d.ts +2 -1
- package/config/index.js +14 -2
- package/css/index.cjs +12 -1
- package/css/index.d.ts +4 -1
- package/css/index.js +10 -2
- package/css/keyframes.cjs +49 -0
- package/css/keyframes.d.ts +22 -0
- package/css/keyframes.js +49 -0
- package/css/media.cjs +93 -0
- package/css/media.d.ts +87 -0
- package/css/media.js +93 -0
- package/css/merge.cjs +15 -0
- package/css/merge.d.ts +7 -0
- package/css/merge.js +15 -0
- package/css/token.cjs +4 -0
- package/css/token.d.ts +1 -0
- package/css/token.js +4 -0
- package/dash-case-DIwKaYgE.cjs +9 -0
- package/dash-case-DblXvymC.js +10 -0
- package/define-templates-CVhhgPnd.js +60 -0
- package/define-templates-Deq1aCbN.cjs +59 -0
- package/factories/define-global-styles.d.ts +7 -0
- package/factories/define-media-query.d.ts +8 -0
- package/factories/define-templates.d.ts +27 -0
- package/factories/define-variables.d.ts +12 -0
- package/factories/index.cjs +37 -0
- package/factories/index.d.ts +4 -0
- package/factories/index.js +37 -0
- package/generators/class-name-generator.d.ts +7 -0
- package/generators/index.cjs +57 -0
- package/generators/index.d.ts +2 -0
- package/generators/index.js +58 -0
- package/generators/styled-generator.d.ts +20 -0
- package/generators/styles-generator.d.ts +22 -0
- package/helpers/color.d.ts +18 -0
- package/helpers/index.cjs +53 -0
- package/helpers/index.d.ts +2 -0
- package/helpers/index.js +53 -0
- package/helpers/viewport-clamp.d.ts +9 -0
- package/index-ByR0nfaf.cjs +4 -0
- package/index-DKz1QXqs.js +4 -0
- package/instances/classname-instance.cjs +31 -0
- package/instances/classname-instance.d.ts +10 -0
- package/instances/classname-instance.js +31 -0
- package/package.json +71 -8
- package/parse-styles-BTIoYnBr.js +232 -0
- package/parse-styles-CA3TP5n1.cjs +231 -0
- package/parsers/index.cjs +58 -0
- package/parsers/index.d.ts +5 -0
- package/parsers/index.js +59 -0
- package/parsers/parse-modifiers.d.ts +3 -0
- package/parsers/parse-styles.d.ts +13 -0
- package/parsers/parse-templates.d.ts +4 -0
- package/parsers/parse-tokens.d.ts +3 -0
- package/parsers/parser-types.d.ts +8 -0
- package/parsers/property-name-check.d.ts +1 -0
- package/parsers/unit-check.d.ts +7 -0
- package/pascal-case-By_l58S-.cjs +7 -0
- package/pascal-case-F3Usi5Wf.js +8 -0
- package/{react-styled-file-CGVf5n1B.js → react-styled-file-B99mwk0w.js} +2 -2
- package/react-styled-file-U02jek-B.cjs +11 -0
- package/react-vanilla-file-Bj6XC8GS.cjs +18 -0
- package/{react-vanilla-file-CCXbsjIb.js → react-vanilla-file-D9px70iK.js} +2 -2
- package/runtime/index.cjs +11 -0
- package/runtime/index.d.ts +7 -0
- package/runtime/index.js +11 -0
- package/salty.config-DjosWdPw.js +4 -0
- package/salty.config-cqavVm2t.cjs +4 -0
- package/server/index.cjs +4 -0
- package/server/index.d.ts +1 -0
- package/server/index.js +4 -0
- package/server/should-restart.d.ts +1 -0
- package/should-restart-CQsyHls3.cjs +17 -0
- package/should-restart-CXIO0jxY.js +18 -0
- package/templates/salty-reset.d.ts +2 -0
- package/to-hash-C05Y906F.cjs +24 -0
- package/to-hash-DAN2LcHK.js +25 -0
- package/types/cli-types.d.ts +10 -0
- package/types/config-types.d.ts +85 -0
- package/types/index.d.ts +44 -23
- package/util/dot-case.d.ts +1 -0
- package/util/index.cjs +14 -1
- package/util/index.js +11 -8
- package/viewport-clamp-CEmzmcSj.cjs +10 -0
- package/viewport-clamp-K553uXu3.js +11 -0
- package/compiler/index.cjs +0 -1
- package/compiler/index.d.ts +0 -16
- package/compiler/index.js +0 -18
- package/config/config-types.d.ts +0 -65
- package/dash-case-DKzpenwY.cjs +0 -1
- package/dash-case-DMQMcCO6.js +0 -19
- package/generator/index.cjs +0 -1
- package/generator/index.d.ts +0 -1
- package/generator/index.js +0 -65
- package/generator/parse-modifiers.d.ts +0 -3
- package/generator/parse-styles.d.ts +0 -2
- package/generator/parse-templates.d.ts +0 -2
- package/generator/parse-tokens.d.ts +0 -2
- package/generator/parser-types.d.ts +0 -4
- package/generator/style-generator.d.ts +0 -33
- package/index-84Wroia-.cjs +0 -1
- package/index-BGaLvshf.js +0 -232
- package/index-BKoD9apd.cjs +0 -11
- package/index-D_732b92.js +0 -4
- package/parse-templates-DUUSaubj.js +0 -96
- package/parse-templates-DVK3iZIl.cjs +0 -8
- package/pascal-case-BQpR5PdN.js +0 -6
- package/pascal-case-iWoaJWwT.cjs +0 -1
- package/react-styled-file-Dkubsz-U.cjs +0 -8
- package/react-vanilla-file-CG_WJLam.cjs +0 -15
- package/salty.config-BhBY_oOk.js +0 -10
- package/salty.config-Dk6ZcCxI.cjs +0 -7
package/util/index.cjs
CHANGED
|
@@ -1 +1,14 @@
|
|
|
1
|
-
"use strict";
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const dashCase = require("../dash-case-DIwKaYgE.cjs");
|
|
4
|
+
const pascalCase = require("../pascal-case-By_l58S-.cjs");
|
|
5
|
+
const toHash = require("../to-hash-C05Y906F.cjs");
|
|
6
|
+
function camelCase(str) {
|
|
7
|
+
if (!str) return "";
|
|
8
|
+
if (typeof str !== "string") return camelCase(String(str));
|
|
9
|
+
return str.replace(/\s/g, "-").replace(/-([a-z])/g, (g) => g[1].toUpperCase());
|
|
10
|
+
}
|
|
11
|
+
exports.dashCase = dashCase.dashCase;
|
|
12
|
+
exports.pascalCase = pascalCase.pascalCase;
|
|
13
|
+
exports.toHash = toHash.toHash;
|
|
14
|
+
exports.camelCase = camelCase;
|
package/util/index.js
CHANGED
|
@@ -1,11 +1,14 @@
|
|
|
1
|
-
import { d
|
|
2
|
-
import { p
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
import { d } from "../dash-case-DblXvymC.js";
|
|
2
|
+
import { p } from "../pascal-case-F3Usi5Wf.js";
|
|
3
|
+
import { t } from "../to-hash-DAN2LcHK.js";
|
|
4
|
+
function camelCase(str) {
|
|
5
|
+
if (!str) return "";
|
|
6
|
+
if (typeof str !== "string") return camelCase(String(str));
|
|
7
|
+
return str.replace(/\s/g, "-").replace(/-([a-z])/g, (g) => g[1].toUpperCase());
|
|
5
8
|
}
|
|
6
9
|
export {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
10
|
+
camelCase,
|
|
11
|
+
d as dashCase,
|
|
12
|
+
p as pascalCase,
|
|
13
|
+
t as toHash
|
|
11
14
|
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
const defineViewportClamp = (config) => (value, min, max) => {
|
|
3
|
+
const { screenSize, axis = "horizontal", minMultiplier = 0.5, maxMultiplier = 1.5, minMaxUnit = "px" } = config;
|
|
4
|
+
const relativeValue = Math.round(value / screenSize * 1e4) / 100;
|
|
5
|
+
const relativeUnit = axis === "vertical" ? "vh" : "vw";
|
|
6
|
+
const minValue = min || Math.round(minMultiplier * value);
|
|
7
|
+
const maxValue = max || Math.round(maxMultiplier * value);
|
|
8
|
+
return `clamp(${minValue}${minMaxUnit}, ${relativeValue}${relativeUnit}, ${maxValue}${minMaxUnit})`;
|
|
9
|
+
};
|
|
10
|
+
exports.defineViewportClamp = defineViewportClamp;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
const defineViewportClamp = (config) => (value, min, max) => {
|
|
2
|
+
const { screenSize, axis = "horizontal", minMultiplier = 0.5, maxMultiplier = 1.5, minMaxUnit = "px" } = config;
|
|
3
|
+
const relativeValue = Math.round(value / screenSize * 1e4) / 100;
|
|
4
|
+
const relativeUnit = axis === "vertical" ? "vh" : "vw";
|
|
5
|
+
const minValue = min || Math.round(minMultiplier * value);
|
|
6
|
+
const maxValue = max || Math.round(maxMultiplier * value);
|
|
7
|
+
return `clamp(${minValue}${minMaxUnit}, ${relativeValue}${relativeUnit}, ${maxValue}${minMaxUnit})`;
|
|
8
|
+
};
|
|
9
|
+
export {
|
|
10
|
+
defineViewportClamp as d
|
|
11
|
+
};
|
package/compiler/index.cjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require("esbuild");require("child_process");require("../dash-case-DKzpenwY.cjs");require("path");require("fs");require("fs/promises");require("../parse-templates-DVK3iZIl.cjs");const e=require("../index-BKoD9apd.cjs");exports.compileSaltyFile=e.compileSaltyFile;exports.generateConfigStyles=e.generateConfigStyles;exports.generateCss=e.generateCss;exports.generateFile=e.generateFile;exports.isSaltyFile=e.isSaltyFile;exports.minimizeFile=e.minimizeFile;exports.saltyFileExtensions=e.saltyFileExtensions;exports.saltyFileRegExp=e.saltyFileRegExp;
|
package/compiler/index.d.ts
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { StyleComponentGenerator } from '../generator/style-generator';
|
|
2
|
-
export declare const saltyFileExtensions: string[];
|
|
3
|
-
export declare const saltyFileRegExp: (additional?: string[]) => RegExp;
|
|
4
|
-
export declare const isSaltyFile: (file: string, additional?: string[]) => boolean;
|
|
5
|
-
export declare const generateConfigStyles: (dirname: string) => Promise<void>;
|
|
6
|
-
export declare const compileSaltyFile: (dirname: string, sourceFilePath: string, outputDirectory: string) => Promise<{
|
|
7
|
-
[key: string]: {
|
|
8
|
-
generator: StyleComponentGenerator;
|
|
9
|
-
isKeyframes?: boolean;
|
|
10
|
-
animationName?: string;
|
|
11
|
-
css?: string;
|
|
12
|
-
};
|
|
13
|
-
}>;
|
|
14
|
-
export declare const generateCss: (dirname: string, prod?: boolean) => Promise<void>;
|
|
15
|
-
export declare const generateFile: (dirname: string, file: string) => Promise<void>;
|
|
16
|
-
export declare const minimizeFile: (dirname: string, file: string, prod?: boolean) => Promise<string | undefined>;
|
package/compiler/index.js
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import "esbuild";
|
|
2
|
-
import "child_process";
|
|
3
|
-
import "../dash-case-DMQMcCO6.js";
|
|
4
|
-
import "path";
|
|
5
|
-
import "fs";
|
|
6
|
-
import "fs/promises";
|
|
7
|
-
import "../parse-templates-DUUSaubj.js";
|
|
8
|
-
import { d as p, c as n, g, e as F, i as y, m as x, s as S, b as c } from "../index-BGaLvshf.js";
|
|
9
|
-
export {
|
|
10
|
-
p as compileSaltyFile,
|
|
11
|
-
n as generateConfigStyles,
|
|
12
|
-
g as generateCss,
|
|
13
|
-
F as generateFile,
|
|
14
|
-
y as isSaltyFile,
|
|
15
|
-
x as minimizeFile,
|
|
16
|
-
S as saltyFileExtensions,
|
|
17
|
-
c as saltyFileRegExp
|
|
18
|
-
};
|
package/config/config-types.d.ts
DELETED
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
import { CssStyles } from '../types';
|
|
2
|
-
import { OrString } from '../types/util-types';
|
|
3
|
-
export type GlobalStyles = Record<string, CssStyles>;
|
|
4
|
-
export type CssVariables = Record<string, unknown>;
|
|
5
|
-
export interface CssResponsiveVariables {
|
|
6
|
-
[key: string]: CssVariables;
|
|
7
|
-
}
|
|
8
|
-
export interface CssConditionalVariables {
|
|
9
|
-
[key: PropertyKey]: {
|
|
10
|
-
[key: PropertyKey]: CssVariables;
|
|
11
|
-
};
|
|
12
|
-
}
|
|
13
|
-
type CssTemplate = CssStyles | {
|
|
14
|
-
[key: PropertyKey]: CssTemplate;
|
|
15
|
-
};
|
|
16
|
-
export interface CssTemplates {
|
|
17
|
-
[key: PropertyKey]: {
|
|
18
|
-
[key: PropertyKey]: CssTemplate;
|
|
19
|
-
};
|
|
20
|
-
}
|
|
21
|
-
export interface CssModifier {
|
|
22
|
-
pattern: RegExp;
|
|
23
|
-
transform: (regexMatch: string) => {
|
|
24
|
-
css?: CssStyles;
|
|
25
|
-
value: string;
|
|
26
|
-
};
|
|
27
|
-
}
|
|
28
|
-
export type CssModifiers = Record<string, CssModifier>;
|
|
29
|
-
export interface SaltyConfig {
|
|
30
|
-
/**
|
|
31
|
-
* The import strategy to use when importing css files.
|
|
32
|
-
* - `root` will import the css file from the root of the project.
|
|
33
|
-
* - `component` will import the css file from the component's directory.
|
|
34
|
-
*/
|
|
35
|
-
importStrategy?: 'root' | 'component';
|
|
36
|
-
/**
|
|
37
|
-
* Base variables that can be used in all styles as they are applied globally to :root.
|
|
38
|
-
*/
|
|
39
|
-
variables?: CssVariables;
|
|
40
|
-
/**
|
|
41
|
-
* Variables that are defined for different media queries.
|
|
42
|
-
*/
|
|
43
|
-
responsiveVariables?: CssResponsiveVariables;
|
|
44
|
-
/**
|
|
45
|
-
* Variables that are defined for different parent selectors (classes or data attributes).
|
|
46
|
-
*/
|
|
47
|
-
conditionalVariables?: CssConditionalVariables;
|
|
48
|
-
/**
|
|
49
|
-
* The global styles that are imported in the root of the project.
|
|
50
|
-
*/
|
|
51
|
-
global?: GlobalStyles;
|
|
52
|
-
/**
|
|
53
|
-
* The templates that can be used in styles to create reusable css.
|
|
54
|
-
*/
|
|
55
|
-
templates?: CssTemplates;
|
|
56
|
-
/**
|
|
57
|
-
* The modifiers that can transform css values.
|
|
58
|
-
*/
|
|
59
|
-
modifiers?: CssModifiers;
|
|
60
|
-
/**
|
|
61
|
-
* Define modules that should not be bundled when generating the css file. This improves the performance of the css generation and can help with issues relared to external packages being imported in an environment that does not support them.
|
|
62
|
-
*/
|
|
63
|
-
externalModules?: ('react' | 'react-dom' | OrString)[];
|
|
64
|
-
}
|
|
65
|
-
export {};
|
package/dash-case-DKzpenwY.cjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
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;
|
package/dash-case-DMQMcCO6.js
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
const n = (e) => String.fromCharCode(e + (e > 25 ? 39 : 97)), o = (e, r) => {
|
|
2
|
-
let t = "", a;
|
|
3
|
-
for (a = Math.abs(e); a > 52; a = a / 52 | 0) t = n(a % 52) + t;
|
|
4
|
-
return t = n(a % 52) + t, t.length < r ? t = t.padStart(r, "a") : t.length > r && (t = t.slice(-r)), t;
|
|
5
|
-
}, i = (e, r) => {
|
|
6
|
-
let t = r.length;
|
|
7
|
-
for (; t; ) e = e * 33 ^ r.charCodeAt(--t);
|
|
8
|
-
return e;
|
|
9
|
-
}, c = (e, r = 3) => {
|
|
10
|
-
const t = i(5381, JSON.stringify(e)) >>> 0;
|
|
11
|
-
return o(t, r);
|
|
12
|
-
};
|
|
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()) : "";
|
|
15
|
-
}
|
|
16
|
-
export {
|
|
17
|
-
s as d,
|
|
18
|
-
c as t
|
|
19
|
-
};
|
package/generator/index.cjs
DELETED
|
@@ -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 o=(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-DVK3iZIl.cjs");class g{constructor(t,s){o(this,"_isProd");o(this,"_callerName");o(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:i=[]}=this.params,r={...t,variants:s,compoundVariants:i};return p.parseStyles(r,`.${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 c=(n=this.params.defaultVariants)==null?void 0:n[e];return c!==void 0?`${e}=${String(c)}`:e}):void 0,i=new Set([]),r=/\{props\.([\w\d]+)\}/gi.exec(JSON.stringify(this.params.base));return r&&r.forEach((e,c,n)=>{const h=n.at(1);h&&i.add(h)}),{element:t,variantKeys:s,propValueKeys:[...i],attr:{"data-component-name":this._isProd?void 0:this._callerName}}}_withBuildContext(t){this._context=t;const{name:s,config:i,prod:r}=t;return this._isProd=r,this._callerName=s,this}}exports.StyleComponentGenerator=g;
|
package/generator/index.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './style-generator';
|
package/generator/index.js
DELETED
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
var p = Object.defineProperty;
|
|
2
|
-
var m = (e, t, s) => t in e ? p(e, t, { enumerable: !0, configurable: !0, writable: !0, value: s }) : e[t] = s;
|
|
3
|
-
var n = (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-DUUSaubj.js";
|
|
6
|
-
class N {
|
|
7
|
-
constructor(t, s) {
|
|
8
|
-
n(this, "_isProd");
|
|
9
|
-
n(this, "_callerName");
|
|
10
|
-
n(this, "_context");
|
|
11
|
-
this.tagName = t, this.params = s;
|
|
12
|
-
}
|
|
13
|
-
get hash() {
|
|
14
|
-
return l(this.params.base || this.params);
|
|
15
|
-
}
|
|
16
|
-
get priority() {
|
|
17
|
-
var t;
|
|
18
|
-
return typeof this.tagName == "function" || typeof this.tagName == "object" ? (((t = this.tagName.generator) == null ? void 0 : t.priority) || 0) + 1 : 0;
|
|
19
|
-
}
|
|
20
|
-
get classNames() {
|
|
21
|
-
const t = [this.hash], { className: s } = this.params;
|
|
22
|
-
return s && t.push(s), t.join(" ");
|
|
23
|
-
}
|
|
24
|
-
get cssClassName() {
|
|
25
|
-
return this.hash;
|
|
26
|
-
}
|
|
27
|
-
get cssDisplayNameVar() {
|
|
28
|
-
return `--${this.hash}-display-name: ${this._callerName};`;
|
|
29
|
-
}
|
|
30
|
-
get templateKeys() {
|
|
31
|
-
var t;
|
|
32
|
-
return (t = this._context) != null && t.config.templates ? g(this._context.config.templates) : [];
|
|
33
|
-
}
|
|
34
|
-
get css() {
|
|
35
|
-
var a;
|
|
36
|
-
const { base: t = {}, variants: s = {}, compoundVariants: i = [] } = this.params, r = { ...t, variants: s, compoundVariants: i };
|
|
37
|
-
return u(r, `.${this.cssClassName}`, this.priority, (a = this._context) == null ? void 0 : a.config);
|
|
38
|
-
}
|
|
39
|
-
get props() {
|
|
40
|
-
const { element: t } = this.params, s = this.params.variants ? Object.keys(this.params.variants).map((a) => {
|
|
41
|
-
var o;
|
|
42
|
-
const c = (o = this.params.defaultVariants) == null ? void 0 : o[a];
|
|
43
|
-
return c !== void 0 ? `${a}=${String(c)}` : a;
|
|
44
|
-
}) : void 0, i = /* @__PURE__ */ new Set([]), r = /\{props\.([\w\d]+)\}/gi.exec(JSON.stringify(this.params.base));
|
|
45
|
-
return r && r.forEach((a, c, o) => {
|
|
46
|
-
const h = o.at(1);
|
|
47
|
-
h && i.add(h);
|
|
48
|
-
}), {
|
|
49
|
-
element: t,
|
|
50
|
-
variantKeys: s,
|
|
51
|
-
propValueKeys: [...i],
|
|
52
|
-
attr: {
|
|
53
|
-
"data-component-name": this._isProd ? void 0 : this._callerName
|
|
54
|
-
}
|
|
55
|
-
};
|
|
56
|
-
}
|
|
57
|
-
_withBuildContext(t) {
|
|
58
|
-
this._context = t;
|
|
59
|
-
const { name: s, config: i, prod: r } = t;
|
|
60
|
-
return this._isProd = r, this._callerName = s, this;
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
export {
|
|
64
|
-
N as StyleComponentGenerator
|
|
65
|
-
};
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import { StyledParams, Tag } from '../types';
|
|
2
|
-
export interface GeneratorProps {
|
|
3
|
-
element?: string;
|
|
4
|
-
variantKeys?: string[];
|
|
5
|
-
propValueKeys?: string[];
|
|
6
|
-
attr: {
|
|
7
|
-
[key: string]: any;
|
|
8
|
-
};
|
|
9
|
-
}
|
|
10
|
-
export declare class StyleComponentGenerator {
|
|
11
|
-
tagName: Tag<any>;
|
|
12
|
-
params: StyledParams;
|
|
13
|
-
_isProd: boolean | undefined;
|
|
14
|
-
_callerName: string | undefined;
|
|
15
|
-
_context: {
|
|
16
|
-
name: string;
|
|
17
|
-
config: any;
|
|
18
|
-
} | undefined;
|
|
19
|
-
constructor(tagName: Tag<any>, params: StyledParams);
|
|
20
|
-
get hash(): string;
|
|
21
|
-
get priority(): number;
|
|
22
|
-
get classNames(): string;
|
|
23
|
-
get cssClassName(): string;
|
|
24
|
-
get cssDisplayNameVar(): string;
|
|
25
|
-
get templateKeys(): string[];
|
|
26
|
-
get css(): string;
|
|
27
|
-
get props(): GeneratorProps;
|
|
28
|
-
_withBuildContext(context: {
|
|
29
|
-
name: string;
|
|
30
|
-
config: any;
|
|
31
|
-
prod: boolean;
|
|
32
|
-
}): this;
|
|
33
|
-
}
|
package/index-84Wroia-.cjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e="/* Empty */";exports.default=e;
|
package/index-BGaLvshf.js
DELETED
|
@@ -1,232 +0,0 @@
|
|
|
1
|
-
import * as H from "esbuild";
|
|
2
|
-
import { execSync as Q } from "child_process";
|
|
3
|
-
import { t as B, d as W } from "./dash-case-DMQMcCO6.js";
|
|
4
|
-
import { join as o } from "path";
|
|
5
|
-
import { existsSync as K, writeFileSync as w, mkdirSync as V, statSync as tt, readdirSync as st, readFileSync as v } from "fs";
|
|
6
|
-
import { readFile as et, writeFile as nt } from "fs/promises";
|
|
7
|
-
import { p as ot, a as rt, b as ct } from "./parse-templates-DUUSaubj.js";
|
|
8
|
-
import { createLogger as at, format as J, transports as it } from "winston";
|
|
9
|
-
const L = (t) => {
|
|
10
|
-
if (!t || t === "/") throw new Error("Could not find package.json file");
|
|
11
|
-
const s = o(t, "package.json");
|
|
12
|
-
return K(s) ? s : L(o(t, ".."));
|
|
13
|
-
}, lt = async (t) => {
|
|
14
|
-
const s = L(t);
|
|
15
|
-
return await et(s, "utf-8").then(JSON.parse).catch(() => {
|
|
16
|
-
});
|
|
17
|
-
}, pt = async (t) => {
|
|
18
|
-
const s = await lt(t);
|
|
19
|
-
if (s)
|
|
20
|
-
return s.type;
|
|
21
|
-
};
|
|
22
|
-
let M;
|
|
23
|
-
const q = async (t) => {
|
|
24
|
-
if (M) return M;
|
|
25
|
-
const s = await pt(t);
|
|
26
|
-
return s === "module" ? M = "esm" : (s === "commonjs" || import.meta.url.endsWith(".cjs")) && (M = "cjs"), M || "esm";
|
|
27
|
-
}, R = at({
|
|
28
|
-
level: "debug",
|
|
29
|
-
format: J.combine(J.colorize(), J.cli()),
|
|
30
|
-
transports: [new it.Console({})]
|
|
31
|
-
}), Ct = (t) => {
|
|
32
|
-
R.error(t);
|
|
33
|
-
}, O = {
|
|
34
|
-
externalModules: []
|
|
35
|
-
}, A = (t) => {
|
|
36
|
-
if (O.externalModules.length > 0) return O.externalModules;
|
|
37
|
-
const s = o(t, "salty.config.ts"), e = v(s, "utf8").match(/externalModules:\s?\[(.*)\]/);
|
|
38
|
-
if (!e) return [];
|
|
39
|
-
const n = e[1].split(",").map((l) => l.replace(/['"`]/g, "").trim());
|
|
40
|
-
return O.externalModules = n, n;
|
|
41
|
-
}, N = (t) => o(t, "./saltygen"), ft = ["salty", "css", "styles", "styled"], ut = (t = []) => new RegExp(`\\.(${[...ft, ...t].join("|")})\\.`), I = (t, s = []) => ut(s).test(t), gt = async (t) => {
|
|
42
|
-
const s = N(t), i = o(t, "salty.config.ts"), e = o(s, "salty.config.js"), n = await q(t), l = A(t);
|
|
43
|
-
await H.build({
|
|
44
|
-
entryPoints: [i],
|
|
45
|
-
minify: !0,
|
|
46
|
-
treeShaking: !0,
|
|
47
|
-
bundle: !0,
|
|
48
|
-
outfile: e,
|
|
49
|
-
format: n,
|
|
50
|
-
external: l
|
|
51
|
-
});
|
|
52
|
-
const S = Date.now(), { config: f } = await import(`${e}?t=${S}`);
|
|
53
|
-
return f;
|
|
54
|
-
}, dt = async (t) => {
|
|
55
|
-
const s = await gt(t), i = /* @__PURE__ */ new Set(), e = (u, a = []) => u ? Object.entries(u).flatMap(([m, p]) => {
|
|
56
|
-
if (!p) return;
|
|
57
|
-
if (typeof p == "object") return e(p, [...a, m]);
|
|
58
|
-
const P = [...a, m].join(".");
|
|
59
|
-
i.add(`"${P}"`);
|
|
60
|
-
const x = [...a.map(W), W(m)].join("-"), { result: y } = ct(p);
|
|
61
|
-
return `--${x}: ${y};`;
|
|
62
|
-
}) : [], n = (u) => u ? Object.entries(u).flatMap(([a, m]) => {
|
|
63
|
-
const p = e(m);
|
|
64
|
-
return a === "base" ? p.join("") : `${a} { ${p.join("")} }`;
|
|
65
|
-
}) : [], l = (u) => u ? Object.entries(u).flatMap(([a, m]) => Object.entries(m).flatMap(([p, P]) => {
|
|
66
|
-
const x = e(P, [a]), y = `.${a}-${p}, [data-${a}="${p}"]`, b = x.join("");
|
|
67
|
-
return `${y} { ${b} }`;
|
|
68
|
-
})) : [], S = e(s.variables), f = n(s.responsiveVariables), C = l(s.conditionalVariables), r = N(t), T = o(r, "css/variables.css"), g = `:root { ${S.join("")} ${f.join("")} } ${C.join("")}`;
|
|
69
|
-
w(T, g);
|
|
70
|
-
const h = o(r, "types/css-tokens.d.ts"), c = `type VariableTokens = ${[...i].join("|") || '""'}; type PropertyValueToken = \`{\${VariableTokens}}\``;
|
|
71
|
-
w(h, c);
|
|
72
|
-
const d = o(r, "css/global.css"), k = ot(s.global, "");
|
|
73
|
-
w(d, k);
|
|
74
|
-
const $ = o(r, "css/templates.css"), j = rt(s.templates);
|
|
75
|
-
w($, j);
|
|
76
|
-
}, _ = async (t, s, i) => {
|
|
77
|
-
const e = B(s), n = o(i, "js", e + ".js"), l = await q(t), S = A(t);
|
|
78
|
-
await H.build({
|
|
79
|
-
entryPoints: [s],
|
|
80
|
-
minify: !0,
|
|
81
|
-
treeShaking: !0,
|
|
82
|
-
bundle: !0,
|
|
83
|
-
outfile: n,
|
|
84
|
-
format: l,
|
|
85
|
-
target: ["es2022"],
|
|
86
|
-
keepNames: !0,
|
|
87
|
-
external: S
|
|
88
|
-
});
|
|
89
|
-
const f = Date.now();
|
|
90
|
-
return await import(`${n}?t=${f}`);
|
|
91
|
-
}, z = async (t) => {
|
|
92
|
-
const s = N(t), i = o(s, "salty.config.js"), { config: e } = await import(i);
|
|
93
|
-
return e;
|
|
94
|
-
}, U = () => {
|
|
95
|
-
try {
|
|
96
|
-
return process.env.NODE_ENV === "production";
|
|
97
|
-
} catch {
|
|
98
|
-
return !1;
|
|
99
|
-
}
|
|
100
|
-
}, Ft = async (t, s = U()) => {
|
|
101
|
-
try {
|
|
102
|
-
s ? R.info("Generating CSS in production mode! 🔥") : R.info("Generating CSS in development mode! 🚀");
|
|
103
|
-
const i = [], e = [], n = N(t), l = o(n, "index.css");
|
|
104
|
-
(() => {
|
|
105
|
-
K(n) && Q("rm -rf " + n), V(n), V(o(n, "css")), V(o(n, "types"));
|
|
106
|
-
})(), await dt(t);
|
|
107
|
-
const f = await z(t);
|
|
108
|
-
async function C(c, d) {
|
|
109
|
-
const k = ["node_modules", "saltygen"], $ = tt(c);
|
|
110
|
-
if ($.isDirectory()) {
|
|
111
|
-
const j = st(c);
|
|
112
|
-
if (k.some((a) => c.includes(a))) return;
|
|
113
|
-
await Promise.all(j.map((a) => C(o(c, a), o(d, a))));
|
|
114
|
-
} else if ($.isFile() && I(c)) {
|
|
115
|
-
const u = await _(t, c, n), a = [];
|
|
116
|
-
Object.entries(u).forEach(([x, y]) => {
|
|
117
|
-
if (y.isKeyframes && y.css) {
|
|
118
|
-
const G = `${y.animationName}.css`, Y = `css/${G}`, Z = o(n, Y);
|
|
119
|
-
i.push(G), w(Z, y.css);
|
|
120
|
-
return;
|
|
121
|
-
}
|
|
122
|
-
if (!y.generator) return;
|
|
123
|
-
const b = y.generator._withBuildContext({
|
|
124
|
-
name: x,
|
|
125
|
-
config: f,
|
|
126
|
-
prod: s
|
|
127
|
-
}), D = `${b.hash}-${b.priority}.css`;
|
|
128
|
-
e[b.priority] || (e[b.priority] = []), e[b.priority].push(D), a.push(D);
|
|
129
|
-
const E = `css/${D}`, X = o(n, E);
|
|
130
|
-
w(X, b.css);
|
|
131
|
-
});
|
|
132
|
-
const m = a.map((x) => `@import url('./${x}');`).join(`
|
|
133
|
-
`), p = B(c, 6), P = o(n, `css/${p}.css`);
|
|
134
|
-
w(P, m);
|
|
135
|
-
}
|
|
136
|
-
}
|
|
137
|
-
await C(t, n);
|
|
138
|
-
const r = i.map((c) => `@import url('./css/${c}');`).join(`
|
|
139
|
-
`);
|
|
140
|
-
let F = `@layer l0, l1, l2, l3, l4, l5, l6, l7, l8;
|
|
141
|
-
|
|
142
|
-
${["variables.css", "global.css", "templates.css"].filter((c) => {
|
|
143
|
-
try {
|
|
144
|
-
return v(o(n, "css", c), "utf8").length > 0;
|
|
145
|
-
} catch {
|
|
146
|
-
return !1;
|
|
147
|
-
}
|
|
148
|
-
}).map((c) => `@import url('./css/${c}');`).join(`
|
|
149
|
-
`)}
|
|
150
|
-
${r}`;
|
|
151
|
-
if (f.importStrategy !== "component") {
|
|
152
|
-
const c = e.flat().map((d) => `@import url('./css/${d}');`).join(`
|
|
153
|
-
`);
|
|
154
|
-
F += c;
|
|
155
|
-
}
|
|
156
|
-
w(l, F);
|
|
157
|
-
} catch (i) {
|
|
158
|
-
console.error(i);
|
|
159
|
-
}
|
|
160
|
-
}, jt = async (t, s) => {
|
|
161
|
-
try {
|
|
162
|
-
const i = [], e = o(t, "./saltygen"), n = o(e, "index.css");
|
|
163
|
-
if (I(s)) {
|
|
164
|
-
const S = await z(t), f = await _(t, s, e);
|
|
165
|
-
Object.entries(f).forEach(([h, F]) => {
|
|
166
|
-
if (!F.generator) return;
|
|
167
|
-
const c = F.generator._withBuildContext({
|
|
168
|
-
name: h,
|
|
169
|
-
config: S
|
|
170
|
-
}), d = `${c.hash}-${c.priority}.css`, k = `css/${d}`, $ = o(e, k);
|
|
171
|
-
i.push(d), w($, c.css);
|
|
172
|
-
});
|
|
173
|
-
const C = v(n, "utf8").split(`
|
|
174
|
-
`), r = i.map((h) => `@import url('../saltygen/css/${h}');`), g = [.../* @__PURE__ */ new Set([...C, ...r])].join(`
|
|
175
|
-
`);
|
|
176
|
-
w(n, g);
|
|
177
|
-
}
|
|
178
|
-
} catch (i) {
|
|
179
|
-
console.error(i);
|
|
180
|
-
}
|
|
181
|
-
}, xt = async (t, s, i = U()) => {
|
|
182
|
-
try {
|
|
183
|
-
const e = o(t, "./saltygen");
|
|
184
|
-
if (I(s)) {
|
|
185
|
-
const l = v(s, "utf8");
|
|
186
|
-
l.replace(/^(?!export\s)const\s.*/gm, (g) => `export ${g}`) !== l && await nt(s, l);
|
|
187
|
-
const f = await z(t), C = await _(t, s, e);
|
|
188
|
-
let r = l;
|
|
189
|
-
Object.entries(C).forEach(([g, h]) => {
|
|
190
|
-
var D;
|
|
191
|
-
if (h.isKeyframes || !h.generator) return;
|
|
192
|
-
const F = h.generator._withBuildContext({
|
|
193
|
-
name: g,
|
|
194
|
-
config: f,
|
|
195
|
-
prod: i
|
|
196
|
-
}), c = new RegExp(`\\s${g}[=\\s]+[^()]+styled\\(([^,]+),`, "g").exec(l);
|
|
197
|
-
if (!c) return console.error("Could not find the original declaration");
|
|
198
|
-
const d = (D = c.at(1)) == null ? void 0 : D.trim(), k = new RegExp(`\\s${g}[=\\s]+styled\\(`, "g").exec(r);
|
|
199
|
-
if (!k) return console.error("Could not find the original declaration");
|
|
200
|
-
const { index: $ } = k;
|
|
201
|
-
let j = !1;
|
|
202
|
-
const u = setTimeout(() => j = !0, 5e3);
|
|
203
|
-
let a = 0, m = !1, p = 0;
|
|
204
|
-
for (; !m && !j; ) {
|
|
205
|
-
const E = r[$ + a];
|
|
206
|
-
E === "(" && p++, E === ")" && p--, p === 0 && E === ")" && (m = !0), a > r.length && (j = !0), a++;
|
|
207
|
-
}
|
|
208
|
-
if (!j) clearTimeout(u);
|
|
209
|
-
else throw new Error("Failed to find the end of the styled call and timed out");
|
|
210
|
-
const P = $ + a, x = r.slice($, P), y = r, b = ` ${g} = styled(${d}, "${F.classNames}", ${JSON.stringify(F.props)});`;
|
|
211
|
-
r = r.replace(x, b), y === r && console.error("Minimize file failed to change content", { name: g, tagName: d });
|
|
212
|
-
});
|
|
213
|
-
const T = B(s, 6);
|
|
214
|
-
return f.importStrategy === "component" && (r = `import '../../saltygen/css/${T}.css';
|
|
215
|
-
${r}`), r = r.replace("{ styled }", "{ styledClient as styled }"), r = r.replace("@salty-css/react/styled", "@salty-css/react/styled-client"), r;
|
|
216
|
-
}
|
|
217
|
-
} catch (e) {
|
|
218
|
-
console.error("Error in minimizeFile:", e);
|
|
219
|
-
}
|
|
220
|
-
};
|
|
221
|
-
export {
|
|
222
|
-
Ct as a,
|
|
223
|
-
ut as b,
|
|
224
|
-
dt as c,
|
|
225
|
-
_ as d,
|
|
226
|
-
jt as e,
|
|
227
|
-
Ft as g,
|
|
228
|
-
I as i,
|
|
229
|
-
R as l,
|
|
230
|
-
xt as m,
|
|
231
|
-
ft as s
|
|
232
|
-
};
|
package/index-BKoD9apd.cjs
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
"use strict";const te=require("esbuild"),se=require("child_process"),N=require("./dash-case-DKzpenwY.cjs"),i=require("path"),l=require("fs"),H=require("fs/promises"),J=require("./parse-templates-DVK3iZIl.cjs"),v=require("winston");var q=typeof document<"u"?document.currentScript:null;function ne(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const n in e)if(n!=="default"){const s=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,s.get?s:{enumerable:!0,get:()=>e[n]})}}return t.default=e,Object.freeze(t)}const U=ne(te),G=e=>{if(!e||e==="/")throw new Error("Could not find package.json file");const t=i.join(e,"package.json");return l.existsSync(t)?t:G(i.join(e,".."))},oe=async e=>{const t=G(e);return await H.readFile(t,"utf-8").then(JSON.parse).catch(()=>{})},ie=async e=>{const t=await oe(e);if(t)return t.type};let T;const L=async e=>{if(T)return T;const t=await ie(e);return t==="module"?T="esm":(t==="commonjs"||(typeof document>"u"?require("url").pathToFileURL(__filename).href:q&&q.tagName.toUpperCase()==="SCRIPT"&&q.src||new URL("index-BKoD9apd.cjs",document.baseURI).href).endsWith(".cjs"))&&(T="cjs"),T||"esm"},O=v.createLogger({level:"debug",format:v.format.combine(v.format.colorize(),v.format.cli()),transports:[new v.transports.Console({})]}),re=e=>{O.error(e)},I={externalModules:[]},W=e=>{if(I.externalModules.length>0)return I.externalModules;const t=i.join(e,"salty.config.ts"),s=l.readFileSync(t,"utf8").match(/externalModules:\s?\[(.*)\]/);if(!s)return[];const o=s[1].split(",").map(u=>u.replace(/['"`]/g,"").trim());return I.externalModules=o,o},V=e=>i.join(e,"./saltygen"),K=["salty","css","styles","styled"],A=(e=[])=>new RegExp(`\\.(${[...K,...e].join("|")})\\.`),R=(e,t=[])=>A(t).test(e),ce=async e=>{const t=V(e),n=i.join(e,"salty.config.ts"),s=i.join(t,"salty.config.js"),o=await L(e),u=W(e);await U.build({entryPoints:[n],minify:!0,treeShaking:!0,bundle:!0,outfile:s,format:o,external:u});const b=Date.now(),{config:p}=await import(`${s}?t=${b}`);return p},X=async e=>{const t=await ce(e),n=new Set,s=(g,a=[])=>g?Object.entries(g).flatMap(([m,f])=>{if(!f)return;if(typeof f=="object")return s(f,[...a,m]);const P=[...a,m].join(".");n.add(`"${P}"`);const x=[...a.map(N.dashCase),N.dashCase(m)].join("-"),{result:h}=J.parseValueTokens(f);return`--${x}: ${h};`}):[],o=g=>g?Object.entries(g).flatMap(([a,m])=>{const f=s(m);return a==="base"?f.join(""):`${a} { ${f.join("")} }`}):[],u=g=>g?Object.entries(g).flatMap(([a,m])=>Object.entries(m).flatMap(([f,P])=>{const x=s(P,[a]),h=`.${a}-${f}, [data-${a}="${f}"]`,w=x.join("");return`${h} { ${w} }`})):[],b=s(t.variables),p=o(t.responsiveVariables),F=u(t.conditionalVariables),r=V(e),E=i.join(r,"css/variables.css"),d=`:root { ${b.join("")} ${p.join("")} } ${F.join("")}`;l.writeFileSync(E,d);const j=i.join(r,"types/css-tokens.d.ts"),c=`type VariableTokens = ${[...n].join("|")||'""'}; type PropertyValueToken = \`{\${VariableTokens}}\``;l.writeFileSync(j,c);const y=i.join(r,"css/global.css"),k=J.parseStyles(t.global,"");l.writeFileSync(y,k);const S=i.join(r,"css/templates.css"),C=J.parseTemplates(t.templates);l.writeFileSync(S,C)},_=async(e,t,n)=>{const s=N.toHash(t),o=i.join(n,"js",s+".js"),u=await L(e),b=W(e);await U.build({entryPoints:[t],minify:!0,treeShaking:!0,bundle:!0,outfile:o,format:u,target:["es2022"],keepNames:!0,external:b});const p=Date.now();return await import(`${o}?t=${p}`)},z=async e=>{const t=V(e),n=i.join(t,"salty.config.js"),{config:s}=await import(n);return s},Y=()=>{try{return process.env.NODE_ENV==="production"}catch{return!1}},ae=async(e,t=Y())=>{try{t?O.info("Generating CSS in production mode! 🔥"):O.info("Generating CSS in development mode! 🚀");const n=[],s=[],o=V(e),u=i.join(o,"index.css");(()=>{l.existsSync(o)&&se.execSync("rm -rf "+o),l.mkdirSync(o),l.mkdirSync(i.join(o,"css")),l.mkdirSync(i.join(o,"types"))})(),await X(e);const p=await z(e);async function F(c,y){const k=["node_modules","saltygen"],S=l.statSync(c);if(S.isDirectory()){const C=l.readdirSync(c);if(k.some(a=>c.includes(a)))return;await Promise.all(C.map(a=>F(i.join(c,a),i.join(y,a))))}else if(S.isFile()&&R(c)){const g=await _(e,c,o),a=[];Object.entries(g).forEach(([x,h])=>{if(h.isKeyframes&&h.css){const B=`${h.animationName}.css`,Q=`css/${B}`,ee=i.join(o,Q);n.push(B),l.writeFileSync(ee,h.css);return}if(!h.generator)return;const w=h.generator._withBuildContext({name:x,config:p,prod:t}),D=`${w.hash}-${w.priority}.css`;s[w.priority]||(s[w.priority]=[]),s[w.priority].push(D),a.push(D);const M=`css/${D}`,Z=i.join(o,M);l.writeFileSync(Z,w.css)});const m=a.map(x=>`@import url('./${x}');`).join(`
|
|
2
|
-
`),f=N.toHash(c,6),P=i.join(o,`css/${f}.css`);l.writeFileSync(P,m)}}await F(e,o);const r=n.map(c=>`@import url('./css/${c}');`).join(`
|
|
3
|
-
`);let $=`@layer l0, l1, l2, l3, l4, l5, l6, l7, l8;
|
|
4
|
-
|
|
5
|
-
${["variables.css","global.css","templates.css"].filter(c=>{try{return l.readFileSync(i.join(o,"css",c),"utf8").length>0}catch{return!1}}).map(c=>`@import url('./css/${c}');`).join(`
|
|
6
|
-
`)}
|
|
7
|
-
${r}`;if(p.importStrategy!=="component"){const c=s.flat().map(y=>`@import url('./css/${y}');`).join(`
|
|
8
|
-
`);$+=c}l.writeFileSync(u,$)}catch(n){console.error(n)}},le=async(e,t)=>{try{const n=[],s=i.join(e,"./saltygen"),o=i.join(s,"index.css");if(R(t)){const b=await z(e),p=await _(e,t,s);Object.entries(p).forEach(([j,$])=>{if(!$.generator)return;const c=$.generator._withBuildContext({name:j,config:b}),y=`${c.hash}-${c.priority}.css`,k=`css/${y}`,S=i.join(s,k);n.push(y),l.writeFileSync(S,c.css)});const F=l.readFileSync(o,"utf8").split(`
|
|
9
|
-
`),r=n.map(j=>`@import url('../saltygen/css/${j}');`),d=[...new Set([...F,...r])].join(`
|
|
10
|
-
`);l.writeFileSync(o,d)}}catch(n){console.error(n)}},ue=async(e,t,n=Y())=>{try{const s=i.join(e,"./saltygen");if(R(t)){const u=l.readFileSync(t,"utf8");u.replace(/^(?!export\s)const\s.*/gm,d=>`export ${d}`)!==u&&await H.writeFile(t,u);const p=await z(e),F=await _(e,t,s);let r=u;Object.entries(F).forEach(([d,j])=>{var D;if(j.isKeyframes||!j.generator)return;const $=j.generator._withBuildContext({name:d,config:p,prod:n}),c=new RegExp(`\\s${d}[=\\s]+[^()]+styled\\(([^,]+),`,"g").exec(u);if(!c)return console.error("Could not find the original declaration");const y=(D=c.at(1))==null?void 0:D.trim(),k=new RegExp(`\\s${d}[=\\s]+styled\\(`,"g").exec(r);if(!k)return console.error("Could not find the original declaration");const{index:S}=k;let C=!1;const g=setTimeout(()=>C=!0,5e3);let a=0,m=!1,f=0;for(;!m&&!C;){const M=r[S+a];M==="("&&f++,M===")"&&f--,f===0&&M===")"&&(m=!0),a>r.length&&(C=!0),a++}if(!C)clearTimeout(g);else throw new Error("Failed to find the end of the styled call and timed out");const P=S+a,x=r.slice(S,P),h=r,w=` ${d} = styled(${y}, "${$.classNames}", ${JSON.stringify($.props)});`;r=r.replace(x,w),h===r&&console.error("Minimize file failed to change content",{name:d,tagName:y})});const E=N.toHash(t,6);return p.importStrategy==="component"&&(r=`import '../../saltygen/css/${E}.css';
|
|
11
|
-
${r}`),r=r.replace("{ styled }","{ styledClient as styled }"),r=r.replace("@salty-css/react/styled","@salty-css/react/styled-client"),r}}catch(s){console.error("Error in minimizeFile:",s)}};exports.compileSaltyFile=_;exports.generateConfigStyles=X;exports.generateCss=ae;exports.generateFile=le;exports.isSaltyFile=R;exports.logError=re;exports.logger=O;exports.minimizeFile=ue;exports.saltyFileExtensions=K;exports.saltyFileRegExp=A;
|
package/index-D_732b92.js
DELETED