@salty-css/core 0.0.1-alpha.32 → 0.0.1-alpha.321
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 +48 -0
- package/README.md +440 -38
- package/bin/index.cjs +3 -1
- package/bin/index.js +2 -2
- package/bin/main.cjs +448 -8
- package/bin/main.js +426 -135
- package/cache/resolve-dynamic-config-cache.cjs +13 -0
- package/cache/resolve-dynamic-config-cache.d.ts +1 -0
- package/cache/resolve-dynamic-config-cache.js +13 -0
- package/class-name-generator-7NA8gtKo.cjs +73 -0
- package/class-name-generator-D7IidIMe.js +74 -0
- package/compiler/as-class.cjs +752 -0
- package/compiler/as-class.d.ts +52 -0
- package/compiler/as-class.js +734 -0
- package/compiler/get-files.cjs +25 -0
- package/compiler/get-files.d.ts +3 -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/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 +73 -9
- package/parse-styles-CS97_e4S.js +232 -0
- package/parse-styles-gRr_iCy7.cjs +231 -0
- package/parsers/index.cjs +57 -0
- package/parsers/index.d.ts +5 -0
- package/parsers/index.js +58 -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-D9px70iK.js +18 -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-DSoCPs8D.js +33 -0
- package/to-hash-DT2ImSPA.cjs +32 -0
- package/types/cli-types.d.ts +10 -0
- package/types/config-types.d.ts +85 -0
- package/types/index.d.ts +57 -23
- package/util/dot-case.d.ts +1 -0
- package/util/index.cjs +13 -1
- package/util/index.js +10 -8
- package/util/module-type.d.ts +1 -0
- package/viewport-clamp-CEmzmcSj.cjs +10 -0
- package/viewport-clamp-K553uXu3.js +11 -0
- package/compiler/index.cjs +0 -11
- package/compiler/index.d.ts +0 -16
- package/compiler/index.js +0 -174
- package/config/config-types.d.ts +0 -59
- 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 -61
- 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 -28
- package/index-84Wroia-.cjs +0 -1
- package/index-D_732b92.js +0 -4
- package/parse-templates-D4p3pgQR.js +0 -92
- package/parse-templates-W0YfTmOT.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/salty.config-BupieCfE.cjs +0 -6
- package/salty.config-D9ANEDiH.js +0 -9
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
4
|
+
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
5
|
+
const parseStyles = require("./parse-styles-gRr_iCy7.cjs");
|
|
6
|
+
const toHash = require("./to-hash-DT2ImSPA.cjs");
|
|
7
|
+
class StylesGenerator {
|
|
8
|
+
constructor(params) {
|
|
9
|
+
__publicField(this, "buildContext", {});
|
|
10
|
+
this.params = params;
|
|
11
|
+
}
|
|
12
|
+
get priority() {
|
|
13
|
+
return 0;
|
|
14
|
+
}
|
|
15
|
+
get isRoot() {
|
|
16
|
+
return this.priority === 0;
|
|
17
|
+
}
|
|
18
|
+
get hash() {
|
|
19
|
+
const { base, variants, compoundVariants, anyOfVariants } = this.params;
|
|
20
|
+
return toHash.toHash({ base, variants, compoundVariants, anyOfVariants });
|
|
21
|
+
}
|
|
22
|
+
get cssClassName() {
|
|
23
|
+
return this.hash;
|
|
24
|
+
}
|
|
25
|
+
get classNames() {
|
|
26
|
+
const classNames = /* @__PURE__ */ new Set([this.cssClassName]);
|
|
27
|
+
const { className } = this.params;
|
|
28
|
+
if (typeof className == "string") classNames.add(className);
|
|
29
|
+
if (typeof className == "object") className.forEach((c) => classNames.add(c));
|
|
30
|
+
this.getTemplateClasses().forEach((c) => classNames.add(c));
|
|
31
|
+
if (this.buildContext.classNames) this.buildContext.classNames.forEach((c) => classNames.add(c));
|
|
32
|
+
return [...classNames].join(" ");
|
|
33
|
+
}
|
|
34
|
+
get cssFileName() {
|
|
35
|
+
const { callerName } = this.buildContext;
|
|
36
|
+
if (callerName) {
|
|
37
|
+
const dasherized = toHash.dashCase(callerName);
|
|
38
|
+
return `cl_${dasherized}-${this.hash}.css`;
|
|
39
|
+
}
|
|
40
|
+
return `${this.hash}.css`;
|
|
41
|
+
}
|
|
42
|
+
get css() {
|
|
43
|
+
const { base = {}, variants = {}, compoundVariants = [], anyOfVariants = [] } = this.params;
|
|
44
|
+
const { config } = this.buildContext;
|
|
45
|
+
const combinedStyles = { ...base, variants, compoundVariants, anyOfVariants };
|
|
46
|
+
const css = parseStyles.parseAndJoinStyles(combinedStyles, `.${this.cssClassName}`, config, this.isRoot);
|
|
47
|
+
return css;
|
|
48
|
+
}
|
|
49
|
+
getTemplateClasses(config = this.buildContext.config) {
|
|
50
|
+
if (!(config == null ? void 0 : config.templates) || !this.params.base || this.priority > 0) return [];
|
|
51
|
+
const templateKeys = Object.keys(config.templates);
|
|
52
|
+
return Object.entries(this.params.base).reduce((acc, [key, value]) => {
|
|
53
|
+
if (templateKeys.includes(key)) acc.push("t_" + toHash.toHash(toHash.dashCase(`${key}-${value}`), 4));
|
|
54
|
+
return acc;
|
|
55
|
+
}, []);
|
|
56
|
+
}
|
|
57
|
+
_withBuildContext(context) {
|
|
58
|
+
this.buildContext = context;
|
|
59
|
+
return this;
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
class ClassNameGenerator extends StylesGenerator {
|
|
63
|
+
constructor(_params) {
|
|
64
|
+
super(_params);
|
|
65
|
+
this._params = _params;
|
|
66
|
+
}
|
|
67
|
+
get priority() {
|
|
68
|
+
if (this.params.priority) return this.params.priority;
|
|
69
|
+
return 0;
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
exports.ClassNameGenerator = ClassNameGenerator;
|
|
73
|
+
exports.StylesGenerator = StylesGenerator;
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
3
|
+
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
4
|
+
import { p as parseAndJoinStyles } from "./parse-styles-CS97_e4S.js";
|
|
5
|
+
import { t as toHash, d as dashCase } from "./to-hash-DSoCPs8D.js";
|
|
6
|
+
class StylesGenerator {
|
|
7
|
+
constructor(params) {
|
|
8
|
+
__publicField(this, "buildContext", {});
|
|
9
|
+
this.params = params;
|
|
10
|
+
}
|
|
11
|
+
get priority() {
|
|
12
|
+
return 0;
|
|
13
|
+
}
|
|
14
|
+
get isRoot() {
|
|
15
|
+
return this.priority === 0;
|
|
16
|
+
}
|
|
17
|
+
get hash() {
|
|
18
|
+
const { base, variants, compoundVariants, anyOfVariants } = this.params;
|
|
19
|
+
return toHash({ base, variants, compoundVariants, anyOfVariants });
|
|
20
|
+
}
|
|
21
|
+
get cssClassName() {
|
|
22
|
+
return this.hash;
|
|
23
|
+
}
|
|
24
|
+
get classNames() {
|
|
25
|
+
const classNames = /* @__PURE__ */ new Set([this.cssClassName]);
|
|
26
|
+
const { className } = this.params;
|
|
27
|
+
if (typeof className == "string") classNames.add(className);
|
|
28
|
+
if (typeof className == "object") className.forEach((c) => classNames.add(c));
|
|
29
|
+
this.getTemplateClasses().forEach((c) => classNames.add(c));
|
|
30
|
+
if (this.buildContext.classNames) this.buildContext.classNames.forEach((c) => classNames.add(c));
|
|
31
|
+
return [...classNames].join(" ");
|
|
32
|
+
}
|
|
33
|
+
get cssFileName() {
|
|
34
|
+
const { callerName } = this.buildContext;
|
|
35
|
+
if (callerName) {
|
|
36
|
+
const dasherized = dashCase(callerName);
|
|
37
|
+
return `cl_${dasherized}-${this.hash}.css`;
|
|
38
|
+
}
|
|
39
|
+
return `${this.hash}.css`;
|
|
40
|
+
}
|
|
41
|
+
get css() {
|
|
42
|
+
const { base = {}, variants = {}, compoundVariants = [], anyOfVariants = [] } = this.params;
|
|
43
|
+
const { config } = this.buildContext;
|
|
44
|
+
const combinedStyles = { ...base, variants, compoundVariants, anyOfVariants };
|
|
45
|
+
const css = parseAndJoinStyles(combinedStyles, `.${this.cssClassName}`, config, this.isRoot);
|
|
46
|
+
return css;
|
|
47
|
+
}
|
|
48
|
+
getTemplateClasses(config = this.buildContext.config) {
|
|
49
|
+
if (!(config == null ? void 0 : config.templates) || !this.params.base || this.priority > 0) return [];
|
|
50
|
+
const templateKeys = Object.keys(config.templates);
|
|
51
|
+
return Object.entries(this.params.base).reduce((acc, [key, value]) => {
|
|
52
|
+
if (templateKeys.includes(key)) acc.push("t_" + toHash(dashCase(`${key}-${value}`), 4));
|
|
53
|
+
return acc;
|
|
54
|
+
}, []);
|
|
55
|
+
}
|
|
56
|
+
_withBuildContext(context) {
|
|
57
|
+
this.buildContext = context;
|
|
58
|
+
return this;
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
class ClassNameGenerator extends StylesGenerator {
|
|
62
|
+
constructor(_params) {
|
|
63
|
+
super(_params);
|
|
64
|
+
this._params = _params;
|
|
65
|
+
}
|
|
66
|
+
get priority() {
|
|
67
|
+
if (this.params.priority) return this.params.priority;
|
|
68
|
+
return 0;
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
export {
|
|
72
|
+
ClassNameGenerator as C,
|
|
73
|
+
StylesGenerator as S
|
|
74
|
+
};
|