@salty-css/core 0.0.1-alpha.300 → 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.
- package/.saltyrc.schema.json +1 -1
- package/bin/index.cjs +3 -1
- package/bin/index.js +2 -2
- package/bin/main.cjs +445 -11
- package/bin/main.js +405 -224
- package/cache/resolve-dynamic-config-cache.cjs +13 -1
- package/cache/resolve-dynamic-config-cache.js +10 -8
- package/compiler/index.cjs +774 -1
- package/compiler/index.d.ts +3 -0
- package/compiler/index.js +754 -20
- package/config/index.cjs +16 -1
- package/config/index.js +14 -12
- package/css/index.cjs +12 -1
- package/css/index.js +10 -10
- package/css/keyframes.cjs +49 -1
- package/css/keyframes.js +44 -34
- package/css/media.cjs +93 -1
- package/css/media.js +54 -49
- package/css/merge.cjs +15 -1
- package/css/merge.js +13 -3
- package/css/token.cjs +4 -1
- package/css/token.js +2 -2
- package/dash-case-Cz8wwE9a.cjs +32 -0
- package/dash-case-NMk0mXyT.js +33 -0
- package/define-templates-CVhhgPnd.js +60 -0
- package/define-templates-Deq1aCbN.cjs +59 -0
- package/factories/index.cjs +37 -1
- package/factories/index.js +27 -20
- package/generators/index.cjs +121 -1
- package/generators/index.js +82 -49
- package/helpers/index.cjs +53 -1
- package/helpers/index.js +40 -1170
- package/helpers-DM2fbDDz.js +18 -0
- package/helpers-wv74jTRI.cjs +18 -0
- package/index-ByR0nfaf.cjs +4 -0
- package/index-DKz1QXqs.js +4 -0
- package/package.json +1 -1
- package/parse-styles-CqBQc3eQ.js +232 -0
- package/parse-styles-D-p_guRO.cjs +231 -0
- package/parsers/index.cjs +57 -2
- package/parsers/index.js +55 -30
- 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/salty.config-DjosWdPw.js +4 -0
- package/salty.config-cqavVm2t.cjs +4 -0
- package/server/index.cjs +4 -1
- package/server/index.js +2 -2
- package/should-restart-5jI-bzz0.js +18 -0
- package/should-restart-DoaGoD5T.cjs +17 -0
- package/util/index.cjs +13 -1
- package/util/index.js +10 -8
- package/viewport-clamp-CEmzmcSj.cjs +10 -0
- package/viewport-clamp-K553uXu3.js +11 -0
- package/dash-case-BJEkFEGQ.cjs +0 -1
- package/dash-case-DBThphLm.js +0 -19
- package/define-templates-4A2yHcMF.js +0 -52
- package/define-templates-Cunsb_Tr.cjs +0 -1
- package/helpers-CC5pFyba.cjs +0 -1
- package/helpers-nHqH4L9L.js +0 -11
- package/index-84Wroia-.cjs +0 -1
- package/index-CituHO0U.js +0 -524
- package/index-D_732b92.js +0 -4
- package/index-ol1Q_xul.cjs +0 -41
- package/parse-styles-B1E0JeC7.cjs +0 -5
- package/parse-styles-y_-drahL.js +0 -161
- 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/should-restart-C6VJ-qaY.js +0 -12
- package/should-restart-DAhvRrtu.cjs +0 -1
- package/viewport-clamp-CaYwREKc.js +0 -7
- package/viewport-clamp-mq_DFtRR.cjs +0 -1
@@ -0,0 +1,7 @@
|
|
1
|
+
"use strict";
|
2
|
+
function pascalCase(str) {
|
3
|
+
if (!str) return "";
|
4
|
+
if (typeof str !== "string") return pascalCase(String(str));
|
5
|
+
return str.replace(/\s/g, "-").replace(/[-_]([a-z0-9])/g, (g) => g[1].toUpperCase()).replace(/^[a-z]/, (g) => g.toUpperCase());
|
6
|
+
}
|
7
|
+
exports.pascalCase = pascalCase;
|
@@ -0,0 +1,8 @@
|
|
1
|
+
function pascalCase(str) {
|
2
|
+
if (!str) return "";
|
3
|
+
if (typeof str !== "string") return pascalCase(String(str));
|
4
|
+
return str.replace(/\s/g, "-").replace(/[-_]([a-z0-9])/g, (g) => g[1].toUpperCase()).replace(/^[a-z]/, (g) => g.toUpperCase());
|
5
|
+
}
|
6
|
+
export {
|
7
|
+
pascalCase as p
|
8
|
+
};
|
@@ -1,4 +1,4 @@
|
|
1
|
-
const
|
1
|
+
const reactStyledFile = `import { styled } from "@salty-css/react/styled";
|
2
2
|
|
3
3
|
export const <%- name %> = styled('<%- tag %>', {
|
4
4
|
<% if(className) { %>className: '<%- className %>',<% } %>
|
@@ -7,5 +7,5 @@ export const <%- name %> = styled('<%- tag %>', {
|
|
7
7
|
}
|
8
8
|
})`;
|
9
9
|
export {
|
10
|
-
|
10
|
+
reactStyledFile as default
|
11
11
|
};
|
@@ -0,0 +1,11 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
3
|
+
const reactStyledFile = `import { styled } from "@salty-css/react/styled";
|
4
|
+
|
5
|
+
export const <%- name %> = styled('<%- tag %>', {
|
6
|
+
<% if(className) { %>className: '<%- className %>',<% } %>
|
7
|
+
base: {
|
8
|
+
// Add your styles here
|
9
|
+
}
|
10
|
+
})`;
|
11
|
+
exports.default = reactStyledFile;
|
@@ -0,0 +1,18 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
3
|
+
const reactVanillaFile = `import { <%- styledComponentName %> } from "./<%- fileName %>.css";
|
4
|
+
|
5
|
+
interface <%- componentName %>Props {
|
6
|
+
text?: string;
|
7
|
+
}
|
8
|
+
|
9
|
+
export const <%- componentName %> = ({ text = 'Lorem ipsum' }: <%- componentName %>Props) => {
|
10
|
+
return (
|
11
|
+
<<%- styledComponentName %>>
|
12
|
+
{text}
|
13
|
+
</<%- styledComponentName %>>
|
14
|
+
);
|
15
|
+
};
|
16
|
+
|
17
|
+
export default <%- componentName %>;`;
|
18
|
+
exports.default = reactVanillaFile;
|
@@ -1,4 +1,4 @@
|
|
1
|
-
const
|
1
|
+
const reactVanillaFile = `import { <%- styledComponentName %> } from "./<%- fileName %>.css";
|
2
2
|
|
3
3
|
interface <%- componentName %>Props {
|
4
4
|
text?: string;
|
@@ -14,5 +14,5 @@ export const <%- componentName %> = ({ text = 'Lorem ipsum' }: <%- componentName
|
|
14
14
|
|
15
15
|
export default <%- componentName %>;`;
|
16
16
|
export {
|
17
|
-
|
17
|
+
reactVanillaFile as default
|
18
18
|
};
|
@@ -0,0 +1,4 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
3
|
+
const salty_config = "import { defineConfig } from '@salty-css/core/config';\n\nexport const config = defineConfig({\n // Add your custom config here\n externalModules: ['react', 'react-dom']\n});\n";
|
4
|
+
exports.default = salty_config;
|
package/server/index.cjs
CHANGED
@@ -1 +1,4 @@
|
|
1
|
-
"use strict";
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
3
|
+
const shouldRestart = require("../should-restart-DoaGoD5T.cjs");
|
4
|
+
exports.checkShouldRestart = shouldRestart.checkShouldRestart;
|
package/server/index.js
CHANGED
@@ -0,0 +1,18 @@
|
|
1
|
+
import { readFile } from "fs/promises";
|
2
|
+
import { isSaltyFile } from "./compiler/index.js";
|
3
|
+
const checkShouldRestart = async (filename) => {
|
4
|
+
if (!filename) return false;
|
5
|
+
if (filename.includes("node_modules")) return false;
|
6
|
+
if (filename.includes("saltygen")) return false;
|
7
|
+
const isConfig = filename.includes("salty.config");
|
8
|
+
if (isConfig) return true;
|
9
|
+
const isSalty = isSaltyFile(filename);
|
10
|
+
if (!isSalty) return false;
|
11
|
+
const contents = await readFile(filename, "utf-8");
|
12
|
+
if (/.+define[A-Z]\w+/.test(contents)) return true;
|
13
|
+
if (/.+keyframes\(.+/.test(contents)) return true;
|
14
|
+
return false;
|
15
|
+
};
|
16
|
+
export {
|
17
|
+
checkShouldRestart as c
|
18
|
+
};
|
@@ -0,0 +1,17 @@
|
|
1
|
+
"use strict";
|
2
|
+
const promises = require("fs/promises");
|
3
|
+
const compiler_index = require("./compiler/index.cjs");
|
4
|
+
const checkShouldRestart = async (filename) => {
|
5
|
+
if (!filename) return false;
|
6
|
+
if (filename.includes("node_modules")) return false;
|
7
|
+
if (filename.includes("saltygen")) return false;
|
8
|
+
const isConfig = filename.includes("salty.config");
|
9
|
+
if (isConfig) return true;
|
10
|
+
const isSalty = compiler_index.isSaltyFile(filename);
|
11
|
+
if (!isSalty) return false;
|
12
|
+
const contents = await promises.readFile(filename, "utf-8");
|
13
|
+
if (/.+define[A-Z]\w+/.test(contents)) return true;
|
14
|
+
if (/.+keyframes\(.+/.test(contents)) return true;
|
15
|
+
return false;
|
16
|
+
};
|
17
|
+
exports.checkShouldRestart = checkShouldRestart;
|
package/util/index.cjs
CHANGED
@@ -1 +1,13 @@
|
|
1
|
-
"use strict";
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
3
|
+
const dashCase = require("../dash-case-Cz8wwE9a.cjs");
|
4
|
+
const pascalCase = require("../pascal-case-By_l58S-.cjs");
|
5
|
+
function camelCase(str) {
|
6
|
+
if (!str) return "";
|
7
|
+
if (typeof str !== "string") return camelCase(String(str));
|
8
|
+
return str.replace(/\s/g, "-").replace(/-([a-z])/g, (g) => g[1].toUpperCase());
|
9
|
+
}
|
10
|
+
exports.dashCase = dashCase.dashCase;
|
11
|
+
exports.toHash = dashCase.toHash;
|
12
|
+
exports.pascalCase = pascalCase.pascalCase;
|
13
|
+
exports.camelCase = camelCase;
|
package/util/index.js
CHANGED
@@ -1,11 +1,13 @@
|
|
1
|
-
import { d
|
2
|
-
import { p
|
3
|
-
function
|
4
|
-
|
1
|
+
import { d, t } from "../dash-case-NMk0mXyT.js";
|
2
|
+
import { p } from "../pascal-case-F3Usi5Wf.js";
|
3
|
+
function camelCase(str) {
|
4
|
+
if (!str) return "";
|
5
|
+
if (typeof str !== "string") return camelCase(String(str));
|
6
|
+
return str.replace(/\s/g, "-").replace(/-([a-z])/g, (g) => g[1].toUpperCase());
|
5
7
|
}
|
6
8
|
export {
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
9
|
+
camelCase,
|
10
|
+
d as dashCase,
|
11
|
+
p as pascalCase,
|
12
|
+
t as toHash
|
11
13
|
};
|
@@ -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/dash-case-BJEkFEGQ.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=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;
|
package/dash-case-DBThphLm.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 = 5) => {
|
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
|
-
};
|
@@ -1,52 +0,0 @@
|
|
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
|
-
};
|
@@ -1 +0,0 @@
|
|
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;
|
package/helpers-CC5pFyba.cjs
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
"use strict";const i=require("path");var n=typeof document<"u"?document.currentScript:null;const c=()=>{let{pathname:e}=new URL(typeof document>"u"?require("url").pathToFileURL(__filename).href:n&&n.tagName.toUpperCase()==="SCRIPT"&&n.src||new URL("helpers-CC5pFyba.cjs",document.baseURI).href);for(;/core\/?(src\/)?$/.test(e)===!1;)e=i.join(e,"../");return e},o=async(e,t=10,r=0)=>r>=t?e:e instanceof Promise?await o(await e,r+1,t):typeof e=="function"&&"_shouldResolve"in e?await o(await e(),r+1,t):e;exports.getCorePackageRoot=c;exports.resolveExportValue=o;
|
package/helpers-nHqH4L9L.js
DELETED
@@ -1,11 +0,0 @@
|
|
1
|
-
import { join as i } from "path";
|
2
|
-
const a = () => {
|
3
|
-
let { pathname: t } = new URL(import.meta.url);
|
4
|
-
for (; /core\/?(src\/)?$/.test(t) === !1; )
|
5
|
-
t = i(t, "../");
|
6
|
-
return t;
|
7
|
-
}, n = async (t, r = 10, o = 0) => o >= r ? t : t instanceof Promise ? await n(await t, o + 1, r) : typeof t == "function" && "_shouldResolve" in t ? await n(await t(), o + 1, r) : t;
|
8
|
-
export {
|
9
|
-
a as g,
|
10
|
-
n as r
|
11
|
-
};
|
package/index-84Wroia-.cjs
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e="/* Empty */";exports.default=e;
|