@salty-css/core 0.0.1-alpha.30 → 0.0.1-alpha.300

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 (103) hide show
  1. package/.saltyrc.schema.json +48 -0
  2. package/README.md +469 -26
  3. package/bin/main.cjs +8 -5
  4. package/bin/main.js +230 -108
  5. package/cache/resolve-dynamic-config-cache.cjs +1 -0
  6. package/cache/resolve-dynamic-config-cache.d.ts +1 -0
  7. package/cache/resolve-dynamic-config-cache.js +11 -0
  8. package/compiler/get-files.d.ts +3 -0
  9. package/compiler/get-function-range.d.ts +1 -0
  10. package/compiler/helpers.d.ts +2 -0
  11. package/compiler/index.cjs +1 -11
  12. package/compiler/index.d.ts +19 -11
  13. package/compiler/index.js +20 -172
  14. package/config/define-config.d.ts +1 -1
  15. package/config/index.cjs +1 -1
  16. package/config/index.d.ts +2 -1
  17. package/config/index.js +12 -2
  18. package/css/index.cjs +1 -1
  19. package/css/index.d.ts +4 -1
  20. package/css/index.js +10 -2
  21. package/css/keyframes.cjs +1 -0
  22. package/css/keyframes.d.ts +22 -0
  23. package/css/keyframes.js +39 -0
  24. package/css/media.cjs +1 -0
  25. package/css/media.d.ts +87 -0
  26. package/css/media.js +88 -0
  27. package/css/merge.cjs +1 -0
  28. package/css/merge.d.ts +7 -0
  29. package/css/merge.js +5 -0
  30. package/css/token.cjs +1 -0
  31. package/css/token.d.ts +1 -0
  32. package/css/token.js +4 -0
  33. package/{dash-case-DKzpenwY.cjs → dash-case-BJEkFEGQ.cjs} +1 -1
  34. package/{dash-case-DMQMcCO6.js → dash-case-DBThphLm.js} +2 -2
  35. package/define-templates-4A2yHcMF.js +52 -0
  36. package/define-templates-Cunsb_Tr.cjs +1 -0
  37. package/factories/define-global-styles.d.ts +7 -0
  38. package/factories/define-media-query.d.ts +8 -0
  39. package/factories/define-templates.d.ts +27 -0
  40. package/factories/define-variables.d.ts +12 -0
  41. package/factories/index.cjs +1 -0
  42. package/factories/index.d.ts +4 -0
  43. package/factories/index.js +30 -0
  44. package/generators/class-name-generator.d.ts +6 -0
  45. package/generators/index.cjs +1 -0
  46. package/generators/index.d.ts +2 -0
  47. package/generators/index.js +88 -0
  48. package/generators/styled-generator.d.ts +20 -0
  49. package/generators/styles-generator.d.ts +22 -0
  50. package/helpers/color.d.ts +18 -0
  51. package/helpers/index.cjs +1 -0
  52. package/helpers/index.d.ts +2 -0
  53. package/helpers/index.js +1183 -0
  54. package/helpers/viewport-clamp.d.ts +9 -0
  55. package/helpers-CC5pFyba.cjs +1 -0
  56. package/helpers-nHqH4L9L.js +11 -0
  57. package/index-CituHO0U.js +524 -0
  58. package/index-ol1Q_xul.cjs +41 -0
  59. package/package.json +54 -6
  60. package/parse-styles-B1E0JeC7.cjs +5 -0
  61. package/parse-styles-y_-drahL.js +161 -0
  62. package/parsers/index.cjs +2 -0
  63. package/parsers/index.d.ts +5 -0
  64. package/parsers/index.js +33 -0
  65. package/parsers/parse-modifiers.d.ts +3 -0
  66. package/parsers/parse-styles.d.ts +13 -0
  67. package/parsers/parse-templates.d.ts +4 -0
  68. package/parsers/parse-tokens.d.ts +3 -0
  69. package/parsers/parser-types.d.ts +8 -0
  70. package/parsers/property-name-check.d.ts +1 -0
  71. package/parsers/unit-check.d.ts +7 -0
  72. package/react-vanilla-file-CCXbsjIb.js +18 -0
  73. package/react-vanilla-file-CG_WJLam.cjs +15 -0
  74. package/{salty.config-D9ANEDiH.js → salty.config-BhBY_oOk.js} +1 -0
  75. package/{salty.config-BupieCfE.cjs → salty.config-Dk6ZcCxI.cjs} +3 -2
  76. package/server/index.cjs +1 -0
  77. package/server/index.d.ts +1 -0
  78. package/server/index.js +4 -0
  79. package/server/should-restart.d.ts +1 -0
  80. package/should-restart-C6VJ-qaY.js +12 -0
  81. package/should-restart-DAhvRrtu.cjs +1 -0
  82. package/templates/salty-reset.d.ts +2 -0
  83. package/types/cli-types.d.ts +10 -0
  84. package/types/config-types.d.ts +85 -0
  85. package/types/index.d.ts +57 -23
  86. package/util/dot-case.d.ts +1 -0
  87. package/util/index.cjs +1 -1
  88. package/util/index.js +1 -1
  89. package/util/module-type.d.ts +1 -0
  90. package/viewport-clamp-CaYwREKc.js +7 -0
  91. package/viewport-clamp-mq_DFtRR.cjs +1 -0
  92. package/config/config-types.d.ts +0 -59
  93. package/generator/index.cjs +0 -1
  94. package/generator/index.d.ts +0 -1
  95. package/generator/index.js +0 -61
  96. package/generator/parse-modifiers.d.ts +0 -3
  97. package/generator/parse-styles.d.ts +0 -2
  98. package/generator/parse-templates.d.ts +0 -2
  99. package/generator/parse-tokens.d.ts +0 -2
  100. package/generator/parser-types.d.ts +0 -4
  101. package/generator/style-generator.d.ts +0 -28
  102. package/parse-templates-D4p3pgQR.js +0 -92
  103. package/parse-templates-W0YfTmOT.cjs +0 -8
package/compiler/index.js CHANGED
@@ -1,174 +1,22 @@
1
- import * as I from "esbuild";
2
- import { execSync as H } from "child_process";
3
- import { t as T, d as R } from "../dash-case-DMQMcCO6.js";
4
- import { join as o } from "path";
5
- import { writeFileSync as $, existsSync as K, mkdirSync as V, statSync as z, readdirSync as G, readFileSync as M } from "fs";
6
- import { writeFile as J } from "fs/promises";
7
- import { p as q, a as A, b as L } from "../parse-templates-D4p3pgQR.js";
8
- const N = (s) => o(s, "./saltygen"), U = ["salty", "css", "styles", "styled"], W = (s = []) => new RegExp(`\\.(${[...U, ...s].join("|")})\\.`), v = (s, e = []) => W(e).test(s), X = async (s) => {
9
- const e = N(s), n = o(s, "salty.config.ts"), t = o(e, "salty.config.js");
10
- await I.build({
11
- entryPoints: [n],
12
- minify: !0,
13
- treeShaking: !0,
14
- bundle: !0,
15
- outfile: t,
16
- format: "esm",
17
- external: ["react"]
18
- });
19
- const c = Date.now(), { config: S } = await import(`${t}?t=${c}`);
20
- return S;
21
- }, Y = async (s) => {
22
- const e = await X(s), n = /* @__PURE__ */ new Set(), t = (u, l = []) => u ? Object.entries(u).flatMap(([p, r]) => {
23
- if (!r) return;
24
- if (typeof r == "object") return t(r, [...l, p]);
25
- const x = [...l, p].join(".");
26
- n.add(`"${x}"`);
27
- const C = [...l.map(R), R(p)].join("-"), { result: D } = L(r);
28
- return `--${C}: ${D};`;
29
- }) : [], c = (u) => u ? Object.entries(u).flatMap(([l, p]) => {
30
- const r = t(p);
31
- return l === "base" ? r.join("") : `${l} { ${r.join("")} }`;
32
- }) : [], S = (u) => u ? Object.entries(u).flatMap(([l, p]) => Object.entries(p).flatMap(([r, x]) => {
33
- const C = t(x, [l]), D = `.${l}-${r}, [data-${l}="${r}"]`, P = C.join("");
34
- return `${D} { ${P} }`;
35
- })) : [], d = t(e.variables), w = c(e.responsiveVariables), a = S(e.conditionalVariables), b = N(s), f = o(b, "css/variables.css"), i = `:root { ${d.join("")} ${w.join("")} } ${a.join("")}`;
36
- $(f, i);
37
- const y = o(b, "types/css-tokens.d.ts"), m = `type VariableTokens = ${[...n].join("|")}; type PropertyValueToken = \`{\${VariableTokens}}\``;
38
- $(y, m);
39
- const g = o(b, "css/global.css"), F = q(e.global, "");
40
- $(g, F);
41
- const j = o(b, "css/templates.css"), k = A(e.templates);
42
- $(j, k);
43
- }, E = async (s, e) => {
44
- const n = T(s), t = o(e, "js", n + ".js");
45
- await I.build({
46
- entryPoints: [s],
47
- minify: !0,
48
- treeShaking: !0,
49
- bundle: !0,
50
- outfile: t,
51
- format: "esm",
52
- target: ["es2022"],
53
- keepNames: !0,
54
- external: ["react"]
55
- });
56
- const c = Date.now();
57
- return await import(`${t}?t=${c}`);
58
- }, O = async (s) => {
59
- const e = N(s), n = o(e, "salty.config.js"), { config: t } = await import(n);
60
- return t;
61
- }, ot = async (s) => {
62
- try {
63
- const e = [], n = [], t = N(s), c = o(t, "index.css");
64
- (() => {
65
- K(t) && H("rm -rf " + t), V(t), V(o(t, "css")), V(o(t, "types"));
66
- })(), await Y(s);
67
- const d = await O(s);
68
- async function w(i, y) {
69
- const h = z(i);
70
- if (h.isDirectory()) {
71
- const m = G(i);
72
- await Promise.all(m.map((g) => w(o(i, g), o(y, g))));
73
- } else if (h.isFile() && v(i)) {
74
- const g = await E(i, t), F = [];
75
- Object.entries(g).forEach(([l, p]) => {
76
- if (p.isKeyframes && p.css) {
77
- const P = `${p.animationName}.css`, _ = `css/${P}`, B = o(t, _);
78
- e.push(P), $(B, p.css);
79
- return;
80
- }
81
- if (!p.generator) return;
82
- const r = p.generator._withBuildContext({
83
- name: l,
84
- config: d
85
- }), x = `${r.hash}-${r.priority}.css`;
86
- n[r.priority] || (n[r.priority] = []), n[r.priority].push(x), F.push(x);
87
- const C = `css/${x}`, D = o(t, C);
88
- $(D, r.css);
89
- });
90
- const j = F.map((l) => `@import url('./${l}');`).join(`
91
- `), k = T(i, 6), u = o(t, `css/${k}.css`);
92
- $(u, j);
93
- }
94
- }
95
- await w(s, t);
96
- const a = e.map((i) => `@import url('./css/${i}');`).join(`
97
- `);
98
- let f = `@layer l0, l1, l2, l3, l4, l5, l6, l7, l8;
99
-
100
- ${["@import url('./css/variables.css');", "@import url('./css/global.css');", "@import url('./css/templates.css');"].join(`
101
- `)}
102
- ${a}`;
103
- if (d.importStrategy !== "component") {
104
- const i = n.flat().map((y) => `@import url('./css/${y}');`).join(`
105
- `);
106
- f += i;
107
- }
108
- $(c, f);
109
- } catch (e) {
110
- console.error(e);
111
- }
112
- }, it = async (s, e) => {
113
- try {
114
- const n = [], t = o(s, "./saltygen"), c = o(t, "index.css");
115
- if (v(e)) {
116
- const d = await O(s), w = await E(e, t);
117
- Object.entries(w).forEach(([y, h]) => {
118
- if (!h.generator) return;
119
- const m = h.generator._withBuildContext({
120
- name: y,
121
- config: d
122
- }), g = `${m.hash}-${m.priority}.css`, F = `css/${g}`, j = o(t, F);
123
- n.push(g), $(j, m.css);
124
- });
125
- const a = M(c, "utf8").split(`
126
- `), b = n.map((y) => `@import url('../saltygen/css/${y}');`), i = [.../* @__PURE__ */ new Set([...a, ...b])].join(`
127
- `);
128
- $(c, i);
129
- }
130
- } catch (n) {
131
- console.error(n);
132
- }
133
- }, rt = async (s, e) => {
134
- try {
135
- const n = o(s, "./saltygen");
136
- if (v(e)) {
137
- const c = M(e, "utf8");
138
- c.replace(/^(?!export\s)const\s.*/gm, (f) => `export ${f}`) !== c && await J(e, c);
139
- const d = await O(s), w = await E(e, n);
140
- let a = c;
141
- Object.entries(w).forEach(([f, i]) => {
142
- var j;
143
- if (i.isKeyframes) {
144
- console.log("value", i);
145
- return;
146
- }
147
- if (!i.generator) return;
148
- const y = i.generator._withBuildContext({
149
- name: f,
150
- config: d
151
- }), h = new RegExp(`${f}[=\\s]+[^()]+styled\\(([^,]+),`, "g").exec(c);
152
- if (!h)
153
- return console.error("Could not find the original declaration");
154
- const m = (j = h.at(1)) == null ? void 0 : j.trim(), g = `${f} = styled(${m}, "${y.classNames}", "${y._callerName}", ${JSON.stringify(y.props)});`, F = new RegExp(`${f}[=\\s]+[^()]+styled\\(([^,]+),[^;]+;`, "g");
155
- a = a.replace(F, g);
156
- });
157
- const b = T(e, 6);
158
- return d.importStrategy === "component" && (a = `import '../../saltygen/css/${b}.css';
159
- ${a}`), a = a.replace("{ styled }", "{ styledClient as styled }"), a = a.replace("@salty-css/react/styled", "@salty-css/react/styled-client"), a;
160
- }
161
- } catch (n) {
162
- console.error(n);
163
- }
164
- };
1
+ import "esbuild";
2
+ import "child_process";
3
+ import "../dash-case-DBThphLm.js";
4
+ import "path";
5
+ import "fs";
6
+ import "fs/promises";
7
+ import "../parse-styles-y_-drahL.js";
8
+ import "../parsers/index.js";
9
+ import { e as y, d as x, g as S, b as c, i as f, m as C, s as E, c as b } from "../index-CituHO0U.js";
10
+ import "../css/merge.js";
11
+ import "../define-templates-4A2yHcMF.js";
12
+ import "../helpers-nHqH4L9L.js";
165
13
  export {
166
- E as compileSaltyFile,
167
- Y as generateConfigStyles,
168
- ot as generateCss,
169
- it as generateFile,
170
- v as isSaltyFile,
171
- rt as minimizeFile,
172
- U as saltyFileExtensions,
173
- W as saltyFileRegExp
14
+ y as compileSaltyFile,
15
+ x as generateConfigStyles,
16
+ S as generateCss,
17
+ c as generateFile,
18
+ f as isSaltyFile,
19
+ C as minimizeFile,
20
+ E as saltyFileExtensions,
21
+ b as saltyFileRegExp
174
22
  };
@@ -1,2 +1,2 @@
1
- import { SaltyConfig } from './config-types';
1
+ import { SaltyConfig } from '../types/config-types';
2
2
  export declare const defineConfig: <T extends SaltyConfig>(config: T) => T;
package/config/index.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=e=>e;exports.defineConfig=n;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("../factories/index.cjs"),a=require("../define-templates-Cunsb_Tr.cjs"),i=t=>t;exports.GlobalStylesFactory=e.GlobalStylesFactory;exports.VariablesFactory=e.VariablesFactory;exports.defineGlobalStyles=e.defineGlobalStyles;exports.defineMediaQuery=e.defineMediaQuery;exports.defineVariables=e.defineVariables;exports.TemplateFactory=a.TemplateFactory;exports.TemplatesFactory=a.TemplatesFactory;exports.defineTemplates=a.defineTemplates;exports.defineConfig=i;
package/config/index.d.ts CHANGED
@@ -1,2 +1,3 @@
1
- export * from './config-types';
2
1
  export * from './define-config';
2
+ export * from '../factories';
3
+ export * from '../types/config-types';
package/config/index.js CHANGED
@@ -1,4 +1,14 @@
1
- const n = (e) => e;
1
+ import { GlobalStylesFactory as o, VariablesFactory as l, defineGlobalStyles as s, defineMediaQuery as i, defineVariables as f } from "../factories/index.js";
2
+ import { T as d, a as y, d as p } from "../define-templates-4A2yHcMF.js";
3
+ const a = (e) => e;
2
4
  export {
3
- n as defineConfig
5
+ o as GlobalStylesFactory,
6
+ d as TemplateFactory,
7
+ y as TemplatesFactory,
8
+ l as VariablesFactory,
9
+ a as defineConfig,
10
+ s as defineGlobalStyles,
11
+ i as defineMediaQuery,
12
+ p as defineTemplates,
13
+ f as defineVariables
4
14
  };
package/css/index.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=e=>`{${e}}`;exports.token=t;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("./keyframes.cjs"),e=require("./media.cjs"),t=require("./token.cjs"),r=require("./merge.cjs");exports.keyframes=s.keyframes;exports.MediaQueryFactory=e.MediaQueryFactory;exports.media=e.media;exports.token=t.token;exports.mergeFactories=r.mergeFactories;exports.mergeObjects=r.mergeObjects;
package/css/index.d.ts CHANGED
@@ -1 +1,4 @@
1
- export declare const token: <T extends VariableTokens>(token: T) => string;
1
+ export * from './keyframes';
2
+ export * from './media';
3
+ export * from './token';
4
+ export * from './merge';
package/css/index.js CHANGED
@@ -1,4 +1,12 @@
1
- const t = (o) => `{${o}}`;
1
+ import { keyframes as o } from "./keyframes.js";
2
+ import { MediaQueryFactory as t, media as a } from "./media.js";
3
+ import { token as p } from "./token.js";
4
+ import { mergeFactories as c, mergeObjects as i } from "./merge.js";
2
5
  export {
3
- t as token
6
+ t as MediaQueryFactory,
7
+ o as keyframes,
8
+ a as media,
9
+ c as mergeFactories,
10
+ i as mergeObjects,
11
+ p as token
4
12
  };
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const u=require("../parse-styles-B1E0JeC7.cjs"),O=require("../dash-case-BJEkFEGQ.cjs"),h=({animationName:l,params:y,appendInitialStyles:$,...t})=>{const i=async(d={})=>{const n=l||O.toHash(t),r=async()=>{const{duration:s="500ms",easing:e="ease-in-out",delay:o="0s",iterationCount:c="1",direction:g="normal",fillMode:b="forwards",playState:j="running"}={...y,...d},a=`${n} ${s} ${e} ${o} ${c} ${g} ${b} ${j}`;if(!$)return a;const m=t.from||t["0%"];if(!m)return a;const w=await u.parseAndJoinStyles(m,"");return`${a};${w}`},f=Object.entries(t).map(async([s,e])=>{if(!e)return"";const o=await u.parseAndJoinStyles(e,"");return`${typeof s=="number"?`${s}%`:s}{${o}}`}),S=(await Promise.all(f)).join(""),p=`@keyframes ${n} {${S}}`;return Object.assign(r,{toString:r,isKeyframes:!0,animationName:n,css:p,keyframes:t}),r};return Object.assign(i,{_shouldResolve:!0}),i};exports.keyframes=h;
@@ -0,0 +1,22 @@
1
+ import { CssStyles, StyleValue } from '../types';
2
+ type KeyframeKeys = number | 'from' | 'to' | `${number}%`;
3
+ type Keyframes = {
4
+ [key in KeyframeKeys]?: CssStyles;
5
+ };
6
+ interface KeyframesConfig {
7
+ animationName?: string;
8
+ appendInitialStyles?: boolean;
9
+ params?: KeyframesParams;
10
+ }
11
+ interface KeyframesParams {
12
+ duration?: string;
13
+ delay?: string;
14
+ iterationCount?: string | number;
15
+ easing?: StyleValue<'animationTimingFunction'>;
16
+ direction?: StyleValue<'animationDirection'>;
17
+ fillMode?: StyleValue<'animationFillMode'>;
18
+ playState?: StyleValue<'animationPlayState'>;
19
+ }
20
+ type KeyframesProps = Keyframes & KeyframesConfig;
21
+ export declare const keyframes: ({ animationName: _name, params: _params, appendInitialStyles, ...keyframes }: KeyframesProps) => (params?: KeyframesParams) => Promise<() => Promise<string>>;
22
+ export {};
@@ -0,0 +1,39 @@
1
+ import { p as $ } from "../parse-styles-y_-drahL.js";
2
+ import { t as O } from "../dash-case-DBThphLm.js";
3
+ const N = ({ animationName: u, params: f, appendInitialStyles: l, ...t }) => {
4
+ const i = async (y = {}) => {
5
+ const r = u || O(t), e = async () => {
6
+ const {
7
+ duration: s = "500ms",
8
+ easing: n = "ease-in-out",
9
+ delay: o = "0s",
10
+ iterationCount: c = "1",
11
+ direction: S = "normal",
12
+ fillMode: b = "forwards",
13
+ playState: j = "running"
14
+ } = { ...f, ...y }, a = `${r} ${s} ${n} ${o} ${c} ${S} ${b} ${j}`;
15
+ if (!l) return a;
16
+ const m = t.from || t["0%"];
17
+ if (!m) return a;
18
+ const w = await $(m, "");
19
+ return `${a};${w}`;
20
+ }, d = Object.entries(t).map(async ([s, n]) => {
21
+ if (!n) return "";
22
+ const o = await $(n, "");
23
+ return `${typeof s == "number" ? `${s}%` : s}{${o}}`;
24
+ }), p = (await Promise.all(d)).join(""), g = `@keyframes ${r} {${p}}`;
25
+ return Object.assign(e, {
26
+ toString: e,
27
+ isKeyframes: !0,
28
+ animationName: r,
29
+ css: g,
30
+ keyframes: t
31
+ }), e;
32
+ };
33
+ return Object.assign(i, {
34
+ _shouldResolve: !0
35
+ }), i;
36
+ };
37
+ export {
38
+ N as keyframes
39
+ };
package/css/media.cjs ADDED
@@ -0,0 +1 @@
1
+ "use strict";var a=Object.defineProperty;var o=(s,e,t)=>e in s?a(s,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):s[e]=t;var i=(s,e,t)=>o(s,typeof e!="symbol"?e+"":e,t);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});class r{constructor(e="@media"){i(this,"next",e=>{const t=new String(e);return Object.assign(t,{get isMedia(){return!0},get and(){return new r(`${e} and`)},get or(){return new r(`${e},`)}}),t});this.base=e}custom(e){return this.next(`${this.base} ${e}`)}minWidth(e){const t=typeof e=="number"?`${e}px`:e,n=`${this.base} (min-width: ${t})`;return this.next(n)}maxWidth(e){const t=typeof e=="number"?`${e}px`:e,n=`${this.base} (max-width: ${t})`;return this.next(n)}minHeight(e){const t=typeof e=="number"?`${e}px`:e,n=`${this.base} (min-height: ${t})`;return this.next(n)}maxHeight(e){const t=typeof e=="number"?`${e}px`:e,n=`${this.base} (max-height: ${t})`;return this.next(n)}get portrait(){const e=`${this.base} (orientation: portrait)`;return this.next(e)}get landscape(){const e=`${this.base} (orientation: landscape)`;return this.next(e)}prefersColorScheme(e){const t=`${this.base} (prefers-color-scheme: ${e})`;return this.next(t)}get dark(){return this.prefersColorScheme("dark")}get light(){return this.prefersColorScheme("light")}get print(){const e=`${this.base} print`;return this.next(e)}get screen(){const e=`${this.base} screen`;return this.next(e)}get speech(){const e=`${this.base} speech`;return this.next(e)}get all(){const e=`${this.base} all`;return this.next(e)}get not(){const e=`${this.base} not`;return this.next(e)}get reducedMotion(){const e=`${this.base} (prefers-reduced-motion: reduce)`;return this.next(e)}}const u=new r;exports.MediaQueryFactory=r;exports.media=u;
package/css/media.d.ts ADDED
@@ -0,0 +1,87 @@
1
+ import { OrString, OrNumber } from '../types/util-types';
2
+ export declare class MediaQueryFactory {
3
+ private base;
4
+ constructor(base?: string);
5
+ private next;
6
+ custom(value: string): string & {
7
+ isMedia: boolean;
8
+ and: MediaQueryFactory;
9
+ or: MediaQueryFactory;
10
+ };
11
+ minWidth(width: OrString | OrNumber): string & {
12
+ isMedia: boolean;
13
+ and: MediaQueryFactory;
14
+ or: MediaQueryFactory;
15
+ };
16
+ maxWidth(width: OrString | OrNumber): string & {
17
+ isMedia: boolean;
18
+ and: MediaQueryFactory;
19
+ or: MediaQueryFactory;
20
+ };
21
+ minHeight(height: OrString | OrNumber): string & {
22
+ isMedia: boolean;
23
+ and: MediaQueryFactory;
24
+ or: MediaQueryFactory;
25
+ };
26
+ maxHeight(height: OrString | OrNumber): string & {
27
+ isMedia: boolean;
28
+ and: MediaQueryFactory;
29
+ or: MediaQueryFactory;
30
+ };
31
+ get portrait(): string & {
32
+ isMedia: boolean;
33
+ and: MediaQueryFactory;
34
+ or: MediaQueryFactory;
35
+ };
36
+ get landscape(): string & {
37
+ isMedia: boolean;
38
+ and: MediaQueryFactory;
39
+ or: MediaQueryFactory;
40
+ };
41
+ prefersColorScheme(scheme: 'dark' | 'light' | OrString): string & {
42
+ isMedia: boolean;
43
+ and: MediaQueryFactory;
44
+ or: MediaQueryFactory;
45
+ };
46
+ get dark(): string & {
47
+ isMedia: boolean;
48
+ and: MediaQueryFactory;
49
+ or: MediaQueryFactory;
50
+ };
51
+ get light(): string & {
52
+ isMedia: boolean;
53
+ and: MediaQueryFactory;
54
+ or: MediaQueryFactory;
55
+ };
56
+ get print(): string & {
57
+ isMedia: boolean;
58
+ and: MediaQueryFactory;
59
+ or: MediaQueryFactory;
60
+ };
61
+ get screen(): string & {
62
+ isMedia: boolean;
63
+ and: MediaQueryFactory;
64
+ or: MediaQueryFactory;
65
+ };
66
+ get speech(): string & {
67
+ isMedia: boolean;
68
+ and: MediaQueryFactory;
69
+ or: MediaQueryFactory;
70
+ };
71
+ get all(): string & {
72
+ isMedia: boolean;
73
+ and: MediaQueryFactory;
74
+ or: MediaQueryFactory;
75
+ };
76
+ get not(): string & {
77
+ isMedia: boolean;
78
+ and: MediaQueryFactory;
79
+ or: MediaQueryFactory;
80
+ };
81
+ get reducedMotion(): string & {
82
+ isMedia: boolean;
83
+ and: MediaQueryFactory;
84
+ or: MediaQueryFactory;
85
+ };
86
+ }
87
+ export declare const media: MediaQueryFactory;
package/css/media.js ADDED
@@ -0,0 +1,88 @@
1
+ var a = Object.defineProperty;
2
+ var o = (s, t, e) => t in s ? a(s, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : s[t] = e;
3
+ var i = (s, t, e) => o(s, typeof t != "symbol" ? t + "" : t, e);
4
+ class r {
5
+ constructor(t = "@media") {
6
+ i(this, "next", (t) => {
7
+ const e = new String(t);
8
+ return Object.assign(e, {
9
+ get isMedia() {
10
+ return !0;
11
+ },
12
+ get and() {
13
+ return new r(`${t} and`);
14
+ },
15
+ get or() {
16
+ return new r(`${t},`);
17
+ }
18
+ }), e;
19
+ });
20
+ this.base = t;
21
+ }
22
+ custom(t) {
23
+ return this.next(`${this.base} ${t}`);
24
+ }
25
+ minWidth(t) {
26
+ const e = typeof t == "number" ? `${t}px` : t, n = `${this.base} (min-width: ${e})`;
27
+ return this.next(n);
28
+ }
29
+ maxWidth(t) {
30
+ const e = typeof t == "number" ? `${t}px` : t, n = `${this.base} (max-width: ${e})`;
31
+ return this.next(n);
32
+ }
33
+ minHeight(t) {
34
+ const e = typeof t == "number" ? `${t}px` : t, n = `${this.base} (min-height: ${e})`;
35
+ return this.next(n);
36
+ }
37
+ maxHeight(t) {
38
+ const e = typeof t == "number" ? `${t}px` : t, n = `${this.base} (max-height: ${e})`;
39
+ return this.next(n);
40
+ }
41
+ get portrait() {
42
+ const t = `${this.base} (orientation: portrait)`;
43
+ return this.next(t);
44
+ }
45
+ get landscape() {
46
+ const t = `${this.base} (orientation: landscape)`;
47
+ return this.next(t);
48
+ }
49
+ prefersColorScheme(t) {
50
+ const e = `${this.base} (prefers-color-scheme: ${t})`;
51
+ return this.next(e);
52
+ }
53
+ get dark() {
54
+ return this.prefersColorScheme("dark");
55
+ }
56
+ get light() {
57
+ return this.prefersColorScheme("light");
58
+ }
59
+ get print() {
60
+ const t = `${this.base} print`;
61
+ return this.next(t);
62
+ }
63
+ get screen() {
64
+ const t = `${this.base} screen`;
65
+ return this.next(t);
66
+ }
67
+ get speech() {
68
+ const t = `${this.base} speech`;
69
+ return this.next(t);
70
+ }
71
+ get all() {
72
+ const t = `${this.base} all`;
73
+ return this.next(t);
74
+ }
75
+ get not() {
76
+ const t = `${this.base} not`;
77
+ return this.next(t);
78
+ }
79
+ get reducedMotion() {
80
+ const t = `${this.base} (prefers-reduced-motion: reduce)`;
81
+ return this.next(t);
82
+ }
83
+ }
84
+ const u = new r();
85
+ export {
86
+ r as MediaQueryFactory,
87
+ u as media
88
+ };
package/css/merge.cjs ADDED
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=(...t)=>t.flat().reduce((e,r)=>r!=null&&r._current?{...e,...r._current}:{...e,...r},{}),u=(...t)=>t.flat().reduce((e,r)=>({...e,...r._children}),{});exports.mergeFactories=u;exports.mergeObjects=n;
package/css/merge.d.ts ADDED
@@ -0,0 +1,7 @@
1
+ interface StyleFactory {
2
+ _current: Record<string, any>;
3
+ _children: Record<string, any>;
4
+ }
5
+ export declare const mergeObjects: <T = any>(...styles: any[]) => T;
6
+ export declare const mergeFactories: <T extends StyleFactory>(...factories: T[][]) => T;
7
+ export {};
package/css/merge.js ADDED
@@ -0,0 +1,5 @@
1
+ const u = (...n) => n.flat().reduce((e, r) => r != null && r._current ? { ...e, ...r._current } : { ...e, ...r }, {}), t = (...n) => n.flat().reduce((e, r) => ({ ...e, ...r._children }), {});
2
+ export {
3
+ t as mergeFactories,
4
+ u as mergeObjects
5
+ };
package/css/token.cjs ADDED
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=e=>`{${e}}`;exports.token=t;
package/css/token.d.ts ADDED
@@ -0,0 +1 @@
1
+ export declare const token: <T extends VariableTokens>(token: T) => string;
package/css/token.js ADDED
@@ -0,0 +1,4 @@
1
+ const t = (o) => `{${o}}`;
2
+ export {
3
+ t as token
4
+ };
@@ -1 +1 @@
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;
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;
@@ -6,12 +6,12 @@ const n = (e) => String.fromCharCode(e + (e > 25 ? 39 : 97)), o = (e, r) => {
6
6
  let t = r.length;
7
7
  for (; t; ) e = e * 33 ^ r.charCodeAt(--t);
8
8
  return e;
9
- }, c = (e, r = 3) => {
9
+ }, c = (e, r = 5) => {
10
10
  const t = i(5381, JSON.stringify(e)) >>> 0;
11
11
  return o(t, r);
12
12
  };
13
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()) : "";
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
15
  }
16
16
  export {
17
17
  s as d,
@@ -0,0 +1,52 @@
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
+ };
@@ -0,0 +1 @@
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;
@@ -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;