@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
@@ -0,0 +1,59 @@
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
+ class TemplateFactory {
6
+ constructor(params) {
7
+ __publicField(this, "_path");
8
+ this.params = params;
9
+ }
10
+ get _current() {
11
+ return this.params.template;
12
+ }
13
+ get isDefineTemplate() {
14
+ return true;
15
+ }
16
+ _setPath(path) {
17
+ this._path = path;
18
+ return this;
19
+ }
20
+ }
21
+ class TemplatesFactory {
22
+ constructor(params) {
23
+ __publicField(this, "_path");
24
+ __publicField(this, "templates", []);
25
+ this.params = params;
26
+ Object.entries(params).forEach(([name, template]) => {
27
+ this.templates.push(
28
+ new TemplateFactory({
29
+ name,
30
+ template
31
+ })
32
+ );
33
+ });
34
+ }
35
+ get _current() {
36
+ return this.params;
37
+ }
38
+ get _children() {
39
+ return Object.fromEntries(
40
+ this.templates.map((template) => {
41
+ return [template.params.name, template];
42
+ })
43
+ );
44
+ }
45
+ get isDefineTemplates() {
46
+ return true;
47
+ }
48
+ _setPath(path) {
49
+ this._path = path;
50
+ this.templates.forEach((template) => template._setPath(path));
51
+ return this;
52
+ }
53
+ }
54
+ const defineTemplates = (templates) => {
55
+ return new TemplatesFactory(templates);
56
+ };
57
+ exports.TemplateFactory = TemplateFactory;
58
+ exports.TemplatesFactory = TemplatesFactory;
59
+ exports.defineTemplates = defineTemplates;
@@ -0,0 +1,7 @@
1
+ import { GlobalStyles } from '../types/config-types';
2
+ export declare class GlobalStylesFactory {
3
+ _current: GlobalStyles;
4
+ constructor(_current: GlobalStyles);
5
+ get isGlobalDefine(): boolean;
6
+ }
7
+ export declare const defineGlobalStyles: (styles: GlobalStyles) => GlobalStylesFactory;
@@ -0,0 +1,8 @@
1
+ import { MediaQueryFactory } from '../css/media';
2
+ type MediaDefinitionCallback = (media: MediaQueryFactory) => ReturnType<MediaQueryFactory['next']>;
3
+ export declare const defineMediaQuery: (mediaFactory: MediaDefinitionCallback) => string & {
4
+ isMedia: boolean;
5
+ and: MediaQueryFactory;
6
+ or: MediaQueryFactory;
7
+ };
8
+ export {};
@@ -0,0 +1,27 @@
1
+ import { CssTemplateFunction, CssTemplateObject, CssTemplates } from '../types/config-types';
2
+ export interface TemplateFactoryParams {
3
+ name: string;
4
+ template: CssTemplateObject | CssTemplateFunction;
5
+ }
6
+ export declare class TemplateFactory {
7
+ params: TemplateFactoryParams;
8
+ _path?: string;
9
+ constructor(params: TemplateFactoryParams);
10
+ get _current(): CssTemplateObject | CssTemplateFunction;
11
+ get isDefineTemplate(): boolean;
12
+ _setPath(path: string): this;
13
+ }
14
+ export type TemplatesFactoryParams = CssTemplates;
15
+ export declare class TemplatesFactory {
16
+ params: TemplatesFactoryParams;
17
+ _path?: string;
18
+ private templates;
19
+ constructor(params: TemplatesFactoryParams);
20
+ get _current(): CssTemplates;
21
+ get _children(): {
22
+ [k: string]: TemplateFactory;
23
+ };
24
+ get isDefineTemplates(): boolean;
25
+ _setPath(path: string): this;
26
+ }
27
+ export declare const defineTemplates: (templates: TemplatesFactoryParams) => TemplatesFactory;
@@ -0,0 +1,12 @@
1
+ import { SaltyVariables } from '../types/config-types';
2
+ export declare class VariablesFactory {
3
+ _current: SaltyVariables;
4
+ constructor(_current: SaltyVariables);
5
+ get isDefineVariables(): boolean;
6
+ }
7
+ /**
8
+ * Base level variables that can be used in all styles as they are applied globally to :root.
9
+ @param responsive Variables that are defined for different media queries.
10
+ @param conditional Variables that are defined for different parent selectors (classes or data attributes).
11
+ */
12
+ export declare const defineVariables: (variables: SaltyVariables) => VariablesFactory;
@@ -0,0 +1,37 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
+ const css_media = require("../css/media.cjs");
4
+ const defineTemplates = require("../define-templates-Deq1aCbN.cjs");
5
+ class GlobalStylesFactory {
6
+ constructor(_current) {
7
+ this._current = _current;
8
+ }
9
+ get isGlobalDefine() {
10
+ return true;
11
+ }
12
+ }
13
+ const defineGlobalStyles = (styles) => {
14
+ return new GlobalStylesFactory(styles);
15
+ };
16
+ const defineMediaQuery = (mediaFactory) => {
17
+ return mediaFactory(css_media.media);
18
+ };
19
+ class VariablesFactory {
20
+ constructor(_current) {
21
+ this._current = _current;
22
+ }
23
+ get isDefineVariables() {
24
+ return true;
25
+ }
26
+ }
27
+ const defineVariables = (variables) => {
28
+ return new VariablesFactory(variables);
29
+ };
30
+ exports.TemplateFactory = defineTemplates.TemplateFactory;
31
+ exports.TemplatesFactory = defineTemplates.TemplatesFactory;
32
+ exports.defineTemplates = defineTemplates.defineTemplates;
33
+ exports.GlobalStylesFactory = GlobalStylesFactory;
34
+ exports.VariablesFactory = VariablesFactory;
35
+ exports.defineGlobalStyles = defineGlobalStyles;
36
+ exports.defineMediaQuery = defineMediaQuery;
37
+ exports.defineVariables = defineVariables;
@@ -0,0 +1,4 @@
1
+ export * from './define-global-styles';
2
+ export * from './define-media-query';
3
+ export * from './define-variables';
4
+ export * from './define-templates';
@@ -0,0 +1,37 @@
1
+ import { media } from "../css/media.js";
2
+ import { T, a, d } from "../define-templates-CVhhgPnd.js";
3
+ class GlobalStylesFactory {
4
+ constructor(_current) {
5
+ this._current = _current;
6
+ }
7
+ get isGlobalDefine() {
8
+ return true;
9
+ }
10
+ }
11
+ const defineGlobalStyles = (styles) => {
12
+ return new GlobalStylesFactory(styles);
13
+ };
14
+ const defineMediaQuery = (mediaFactory) => {
15
+ return mediaFactory(media);
16
+ };
17
+ class VariablesFactory {
18
+ constructor(_current) {
19
+ this._current = _current;
20
+ }
21
+ get isDefineVariables() {
22
+ return true;
23
+ }
24
+ }
25
+ const defineVariables = (variables) => {
26
+ return new VariablesFactory(variables);
27
+ };
28
+ export {
29
+ GlobalStylesFactory,
30
+ T as TemplateFactory,
31
+ a as TemplatesFactory,
32
+ VariablesFactory,
33
+ defineGlobalStyles,
34
+ defineMediaQuery,
35
+ d as defineTemplates,
36
+ defineVariables
37
+ };
@@ -0,0 +1,6 @@
1
+ import { StylesGenerator } from './styles-generator';
2
+ import { StyledParams } from '../types';
3
+ export declare class ClassNameGenerator<const STYLE_PARAMS extends StyledParams = StyledParams> extends StylesGenerator<STYLE_PARAMS> {
4
+ _params: STYLE_PARAMS;
5
+ constructor(_params: STYLE_PARAMS);
6
+ }
@@ -0,0 +1,121 @@
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
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
6
+ const parseStyles = require("../parse-styles-D-p_guRO.cjs");
7
+ const dashCase = require("../dash-case-Cz8wwE9a.cjs");
8
+ class StylesGenerator {
9
+ constructor(params) {
10
+ __publicField(this, "buildContext", {});
11
+ this.params = params;
12
+ }
13
+ get priority() {
14
+ return 0;
15
+ }
16
+ get isRoot() {
17
+ return this.priority === 0;
18
+ }
19
+ get hash() {
20
+ const { base, variants, compoundVariants, anyOfVariants } = this.params;
21
+ return dashCase.toHash({ base, variants, compoundVariants, anyOfVariants });
22
+ }
23
+ get cssClassName() {
24
+ return this.hash;
25
+ }
26
+ get classNames() {
27
+ const classNames = /* @__PURE__ */ new Set([this.cssClassName]);
28
+ const { className } = this.params;
29
+ if (typeof className == "string") classNames.add(className);
30
+ if (typeof className == "object") className.forEach((c) => classNames.add(c));
31
+ this.getTemplateClasses().forEach((c) => classNames.add(c));
32
+ if (this.buildContext.classNames) this.buildContext.classNames.forEach((c) => classNames.add(c));
33
+ return [...classNames].join(" ");
34
+ }
35
+ get cssFileName() {
36
+ const { callerName } = this.buildContext;
37
+ if (callerName) {
38
+ const dasherized = dashCase.dashCase(callerName);
39
+ return `cl_${dasherized}-${this.hash}.css`;
40
+ }
41
+ return `${this.hash}.css`;
42
+ }
43
+ get css() {
44
+ const { base = {}, variants = {}, compoundVariants = [], anyOfVariants = [] } = this.params;
45
+ const { config } = this.buildContext;
46
+ const combinedStyles = { ...base, variants, compoundVariants, anyOfVariants };
47
+ const css = parseStyles.parseAndJoinStyles(combinedStyles, `.${this.cssClassName}`, config, this.isRoot);
48
+ return css;
49
+ }
50
+ getTemplateClasses(config = this.buildContext.config) {
51
+ if (!(config == null ? void 0 : config.templates) || !this.params.base || this.priority > 0) return [];
52
+ const templateKeys = Object.keys(config.templates);
53
+ return Object.entries(this.params.base).reduce((acc, [key, value]) => {
54
+ if (templateKeys.includes(key)) acc.push("t_" + dashCase.toHash(dashCase.dashCase(`${key}-${value}`), 4));
55
+ return acc;
56
+ }, []);
57
+ }
58
+ _withBuildContext(context) {
59
+ this.buildContext = context;
60
+ return this;
61
+ }
62
+ }
63
+ class ClassNameGenerator extends StylesGenerator {
64
+ constructor(_params) {
65
+ super(_params);
66
+ this._params = _params;
67
+ }
68
+ }
69
+ class StyledGenerator extends StylesGenerator {
70
+ constructor(tagName, _params) {
71
+ super(_params);
72
+ this.tagName = tagName;
73
+ this._params = _params;
74
+ }
75
+ get priority() {
76
+ var _a;
77
+ if (this.params.priority) return this.params.priority;
78
+ if (typeof this.tagName === "function" || typeof this.tagName === "object") {
79
+ const prev = ((_a = this.tagName.generator) == null ? void 0 : _a.priority) || 0;
80
+ return prev + 1;
81
+ }
82
+ return 0;
83
+ }
84
+ get clientProps() {
85
+ const { element, variants = {}, compoundVariants = [], anyOfVariants = [], defaultVariants = {}, defaultProps = {}, passProps } = this.params;
86
+ const { callerName, isProduction } = this.buildContext;
87
+ const variantKeys = /* @__PURE__ */ new Set([]);
88
+ const addVariantKey = (name) => {
89
+ const defaultVariant = defaultVariants[name];
90
+ if (defaultVariant !== void 0) variantKeys.add(`${name}=${String(defaultVariant)}`);
91
+ else variantKeys.add(name);
92
+ };
93
+ Object.keys(variants).forEach(addVariantKey);
94
+ compoundVariants.map((cv) => Object.keys(cv).forEach(addVariantKey));
95
+ anyOfVariants.map((cv) => Object.keys(cv).forEach(addVariantKey));
96
+ const propValueKeys = /* @__PURE__ */ new Set([]);
97
+ if (this.params.base) {
98
+ const matches = JSON.stringify(this.params.base).match(/\{-?props\.([^}]+)\}/gi);
99
+ if (matches) {
100
+ matches.forEach((match) => {
101
+ const value = match.replace(/\{(?:-)?props\.([^}]+)\}/gi, "$1");
102
+ const dashed = dashCase.dashCase(value);
103
+ if (value) propValueKeys.add(dashed);
104
+ });
105
+ }
106
+ }
107
+ return {
108
+ element,
109
+ hash: this.hash,
110
+ variantKeys: [...variantKeys],
111
+ propValueKeys: [...propValueKeys],
112
+ passProps,
113
+ defaultProps,
114
+ attr: {
115
+ "data-component-name": !isProduction ? callerName : void 0
116
+ }
117
+ };
118
+ }
119
+ }
120
+ exports.ClassNameGenerator = ClassNameGenerator;
121
+ exports.StyledGenerator = StyledGenerator;
@@ -0,0 +1,2 @@
1
+ export * from './class-name-generator';
2
+ export * from './styled-generator';
@@ -0,0 +1,121 @@
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-CqBQc3eQ.js";
5
+ import { t as toHash, d as dashCase } from "../dash-case-NMk0mXyT.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
+ }
67
+ class StyledGenerator extends StylesGenerator {
68
+ constructor(tagName, _params) {
69
+ super(_params);
70
+ this.tagName = tagName;
71
+ this._params = _params;
72
+ }
73
+ get priority() {
74
+ var _a;
75
+ if (this.params.priority) return this.params.priority;
76
+ if (typeof this.tagName === "function" || typeof this.tagName === "object") {
77
+ const prev = ((_a = this.tagName.generator) == null ? void 0 : _a.priority) || 0;
78
+ return prev + 1;
79
+ }
80
+ return 0;
81
+ }
82
+ get clientProps() {
83
+ const { element, variants = {}, compoundVariants = [], anyOfVariants = [], defaultVariants = {}, defaultProps = {}, passProps } = this.params;
84
+ const { callerName, isProduction } = this.buildContext;
85
+ const variantKeys = /* @__PURE__ */ new Set([]);
86
+ const addVariantKey = (name) => {
87
+ const defaultVariant = defaultVariants[name];
88
+ if (defaultVariant !== void 0) variantKeys.add(`${name}=${String(defaultVariant)}`);
89
+ else variantKeys.add(name);
90
+ };
91
+ Object.keys(variants).forEach(addVariantKey);
92
+ compoundVariants.map((cv) => Object.keys(cv).forEach(addVariantKey));
93
+ anyOfVariants.map((cv) => Object.keys(cv).forEach(addVariantKey));
94
+ const propValueKeys = /* @__PURE__ */ new Set([]);
95
+ if (this.params.base) {
96
+ const matches = JSON.stringify(this.params.base).match(/\{-?props\.([^}]+)\}/gi);
97
+ if (matches) {
98
+ matches.forEach((match) => {
99
+ const value = match.replace(/\{(?:-)?props\.([^}]+)\}/gi, "$1");
100
+ const dashed = dashCase(value);
101
+ if (value) propValueKeys.add(dashed);
102
+ });
103
+ }
104
+ }
105
+ return {
106
+ element,
107
+ hash: this.hash,
108
+ variantKeys: [...variantKeys],
109
+ propValueKeys: [...propValueKeys],
110
+ passProps,
111
+ defaultProps,
112
+ attr: {
113
+ "data-component-name": !isProduction ? callerName : void 0
114
+ }
115
+ };
116
+ }
117
+ }
118
+ export {
119
+ ClassNameGenerator,
120
+ StyledGenerator
121
+ };
@@ -0,0 +1,20 @@
1
+ import { StylesGenerator } from './styles-generator';
2
+ import { StyledParams, Tag } from '../types';
3
+ export interface StyledGeneratorClientProps {
4
+ element?: string;
5
+ hash?: string;
6
+ variantKeys?: string[];
7
+ propValueKeys?: string[];
8
+ passProps?: boolean | string | string[];
9
+ defaultProps?: Record<PropertyKey, unknown>;
10
+ attr?: {
11
+ [key: string]: any;
12
+ };
13
+ }
14
+ export declare class StyledGenerator<const STYLE_PARAMS extends StyledParams = StyledParams> extends StylesGenerator<STYLE_PARAMS> {
15
+ tagName: Tag<any>;
16
+ _params: STYLE_PARAMS;
17
+ constructor(tagName: Tag<any>, _params: STYLE_PARAMS);
18
+ get priority(): number;
19
+ get clientProps(): StyledGeneratorClientProps;
20
+ }
@@ -0,0 +1,22 @@
1
+ import { StyledParams } from '../types';
2
+ import { CachedConfig, SaltyConfig } from '../types/config-types';
3
+ export interface StylesGeneratorBuildTimeProps {
4
+ callerName?: string;
5
+ isProduction?: boolean;
6
+ config?: SaltyConfig & CachedConfig;
7
+ classNames?: string[];
8
+ }
9
+ export declare class StylesGenerator<const STYLE_PARAMS extends StyledParams = StyledParams> {
10
+ params: STYLE_PARAMS;
11
+ buildContext: StylesGeneratorBuildTimeProps;
12
+ constructor(params: STYLE_PARAMS);
13
+ get priority(): number;
14
+ get isRoot(): boolean;
15
+ get hash(): string;
16
+ get cssClassName(): string;
17
+ get classNames(): string;
18
+ get cssFileName(): string;
19
+ get css(): Promise<string>;
20
+ getTemplateClasses(config?: (SaltyConfig & CachedConfig) | undefined): string[];
21
+ _withBuildContext(context: StylesGeneratorBuildTimeProps): this;
22
+ }
@@ -0,0 +1,18 @@
1
+ import { CachedConfig } from '../config';
2
+ import { ColorInstance, ColorLike } from 'color';
3
+ declare global {
4
+ const saltyConfig: CachedConfig;
5
+ }
6
+ type BaseColor = Omit<ColorLike, string> | PropertyValueToken;
7
+ declare class Color {
8
+ base: BaseColor;
9
+ isColor: boolean;
10
+ currentColor: ColorInstance;
11
+ constructor(base: BaseColor);
12
+ private _createProxy;
13
+ private _resolveBaseColor;
14
+ _handleColorMethod(method: keyof ColorInstance): any;
15
+ toString(): string;
16
+ }
17
+ export declare const color: (value: BaseColor) => Color & ColorInstance;
18
+ export {};
@@ -0,0 +1,53 @@
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
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
6
+ const colorFunction = require("color");
7
+ const viewportClamp = require("../viewport-clamp-CEmzmcSj.cjs");
8
+ class Color {
9
+ constructor(base) {
10
+ __publicField(this, "isColor", true);
11
+ __publicField(this, "currentColor");
12
+ this.base = base;
13
+ const colorValue = this._resolveBaseColor(base);
14
+ this.currentColor = colorFunction(colorValue);
15
+ return this._createProxy();
16
+ }
17
+ _createProxy() {
18
+ return new Proxy(this, {
19
+ get(target, prop) {
20
+ if (prop in target) return target[prop];
21
+ if (prop in target.currentColor) return target._handleColorMethod(prop);
22
+ return target[prop];
23
+ }
24
+ });
25
+ }
26
+ _resolveBaseColor(base) {
27
+ if (typeof base !== "string") return base;
28
+ const isToken = /\{[^{}]+\}/g.test(base);
29
+ if (!isToken) return base;
30
+ if (typeof saltyConfig === "undefined") return "transparent";
31
+ const { staticVariables } = saltyConfig;
32
+ if (!staticVariables) return "transparent";
33
+ const tokenPath = base.replace(/^\{|\}$/g, "").split(".");
34
+ const value = tokenPath.reduce((acc, key) => acc[key], staticVariables);
35
+ return value;
36
+ }
37
+ _handleColorMethod(method) {
38
+ const color2 = this.currentColor;
39
+ if (typeof color2[method] !== "function") return color2[method];
40
+ return (...args) => {
41
+ this.currentColor = color2[method](...args);
42
+ return this._createProxy();
43
+ };
44
+ }
45
+ toString() {
46
+ return this.currentColor.toString();
47
+ }
48
+ }
49
+ const color = (value) => {
50
+ return new Color(value);
51
+ };
52
+ exports.defineViewportClamp = viewportClamp.defineViewportClamp;
53
+ exports.color = color;
@@ -0,0 +1,2 @@
1
+ export * from './color';
2
+ export * from './viewport-clamp';
@@ -0,0 +1,53 @@
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 colorFunction from "color";
5
+ import { d } from "../viewport-clamp-K553uXu3.js";
6
+ class Color {
7
+ constructor(base) {
8
+ __publicField(this, "isColor", true);
9
+ __publicField(this, "currentColor");
10
+ this.base = base;
11
+ const colorValue = this._resolveBaseColor(base);
12
+ this.currentColor = colorFunction(colorValue);
13
+ return this._createProxy();
14
+ }
15
+ _createProxy() {
16
+ return new Proxy(this, {
17
+ get(target, prop) {
18
+ if (prop in target) return target[prop];
19
+ if (prop in target.currentColor) return target._handleColorMethod(prop);
20
+ return target[prop];
21
+ }
22
+ });
23
+ }
24
+ _resolveBaseColor(base) {
25
+ if (typeof base !== "string") return base;
26
+ const isToken = /\{[^{}]+\}/g.test(base);
27
+ if (!isToken) return base;
28
+ if (typeof saltyConfig === "undefined") return "transparent";
29
+ const { staticVariables } = saltyConfig;
30
+ if (!staticVariables) return "transparent";
31
+ const tokenPath = base.replace(/^\{|\}$/g, "").split(".");
32
+ const value = tokenPath.reduce((acc, key) => acc[key], staticVariables);
33
+ return value;
34
+ }
35
+ _handleColorMethod(method) {
36
+ const color2 = this.currentColor;
37
+ if (typeof color2[method] !== "function") return color2[method];
38
+ return (...args) => {
39
+ this.currentColor = color2[method](...args);
40
+ return this._createProxy();
41
+ };
42
+ }
43
+ toString() {
44
+ return this.currentColor.toString();
45
+ }
46
+ }
47
+ const color = (value) => {
48
+ return new Color(value);
49
+ };
50
+ export {
51
+ color,
52
+ d as defineViewportClamp
53
+ };
@@ -0,0 +1,9 @@
1
+ interface ViewportClampConfig {
2
+ screenSize: number;
3
+ axis?: 'vertical' | 'horizontal';
4
+ minMultiplier?: number;
5
+ maxMultiplier?: number;
6
+ minMaxUnit?: string;
7
+ }
8
+ export declare const defineViewportClamp: (config: ViewportClampConfig) => (value: number, min?: number | undefined, max?: number | undefined) => string;
9
+ export {};
@@ -0,0 +1,18 @@
1
+ import { join } from "path";
2
+ const getCorePackageRoot = () => {
3
+ let { pathname } = new URL(import.meta.url);
4
+ while (/core\/?(src\/)?$/.test(pathname) === false) {
5
+ pathname = join(pathname, "../");
6
+ }
7
+ return pathname;
8
+ };
9
+ const resolveExportValue = async (value, maxLevel = 10, _level = 0) => {
10
+ if (_level >= maxLevel) return value;
11
+ if (value instanceof Promise) return await resolveExportValue(await value, _level + 1, maxLevel);
12
+ if (typeof value === "function" && "_shouldResolve" in value) return await resolveExportValue(await value(), _level + 1, maxLevel);
13
+ return value;
14
+ };
15
+ export {
16
+ getCorePackageRoot as g,
17
+ resolveExportValue as r
18
+ };