@salty-css/core 0.0.1-alpha.26 → 0.0.1-alpha.261
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 +469 -26
- package/bin/index.cjs +1 -8
- package/bin/index.js +2 -131
- package/bin/logger.d.ts +1 -0
- package/bin/main.cjs +11 -0
- package/bin/main.d.ts +1 -0
- package/bin/main.js +263 -0
- package/compiler/get-files.d.ts +3 -0
- package/compiler/get-function-range.d.ts +1 -0
- package/compiler/index.cjs +1 -11
- package/compiler/index.d.ts +19 -11
- package/compiler/index.js +19 -172
- package/config/define-config.d.ts +1 -1
- package/config/index.cjs +1 -1
- package/config/index.d.ts +2 -1
- package/config/index.js +12 -2
- package/css/index.cjs +1 -1
- package/css/index.d.ts +4 -1
- package/css/index.js +10 -2
- package/css/keyframes.cjs +1 -0
- package/css/keyframes.d.ts +22 -0
- package/css/keyframes.js +34 -0
- package/css/media.cjs +1 -0
- package/css/media.d.ts +87 -0
- package/css/media.js +88 -0
- package/css/merge.cjs +1 -0
- package/css/merge.d.ts +7 -0
- package/css/merge.js +5 -0
- package/css/token.cjs +1 -0
- package/css/token.d.ts +1 -0
- package/css/token.js +4 -0
- package/{dash-case-DKzpenwY.cjs → dash-case-BJEkFEGQ.cjs} +1 -1
- package/{dash-case-DMQMcCO6.js → dash-case-DBThphLm.js} +2 -2
- package/define-templates-4A2yHcMF.js +52 -0
- package/define-templates-Cunsb_Tr.cjs +1 -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 +1 -0
- package/factories/index.d.ts +4 -0
- package/factories/index.js +30 -0
- package/generators/class-name-generator.d.ts +6 -0
- package/generators/index.cjs +1 -0
- package/generators/index.d.ts +2 -0
- package/generators/index.js +87 -0
- package/generators/styled-generator.d.ts +19 -0
- package/generators/styles-generator.d.ts +22 -0
- package/helpers/color.d.ts +18 -0
- package/helpers/index.cjs +1 -0
- package/helpers/index.d.ts +2 -0
- package/helpers/index.js +1154 -0
- package/helpers/viewport-clamp.d.ts +8 -0
- package/index-Cpvtq5h9.js +517 -0
- package/index-DV-sarjD.cjs +41 -0
- package/package.json +43 -3
- package/parse-styles-CKmL8EwD.js +150 -0
- package/parse-styles-DZYIEhB4.cjs +5 -0
- package/parsers/index.cjs +2 -0
- package/parsers/index.d.ts +5 -0
- package/parsers/index.js +33 -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/react-vanilla-file-CCXbsjIb.js +18 -0
- package/react-vanilla-file-CG_WJLam.cjs +15 -0
- package/{salty.config-D9ANEDiH.js → salty.config-BhBY_oOk.js} +1 -0
- package/{salty.config-BupieCfE.cjs → salty.config-Dk6ZcCxI.cjs} +3 -2
- package/server/index.cjs +1 -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-B6uSbFR6.cjs +1 -0
- package/should-restart-M_v7QUN8.js +12 -0
- package/templates/salty-reset.d.ts +2 -0
- package/types/cli-types.d.ts +10 -0
- package/types/config-types.d.ts +84 -0
- package/types/index.d.ts +53 -22
- package/util/dot-case.d.ts +1 -0
- package/util/index.cjs +1 -1
- package/util/index.js +1 -1
- package/util/module-type.d.ts +1 -0
- package/viewport-clamp-BOc-8Oph.js +7 -0
- package/viewport-clamp-kY8JqYzm.cjs +1 -0
- package/config/config-types.d.ts +0 -59
- 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/parse-templates-D4p3pgQR.js +0 -92
- package/parse-templates-W0YfTmOT.cjs +0 -8
package/compiler/index.js
CHANGED
|
@@ -1,174 +1,21 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
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-CKmL8EwD.js";
|
|
8
|
+
import "../parsers/index.js";
|
|
9
|
+
import { e as F, d as y, g as x, b as S, i as c, m as f, s as C, c as E } from "../index-Cpvtq5h9.js";
|
|
10
|
+
import "../css/merge.js";
|
|
11
|
+
import "../define-templates-4A2yHcMF.js";
|
|
165
12
|
export {
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
13
|
+
F as compileSaltyFile,
|
|
14
|
+
y as generateConfigStyles,
|
|
15
|
+
x as generateCss,
|
|
16
|
+
S as generateFile,
|
|
17
|
+
c as isSaltyFile,
|
|
18
|
+
f as minimizeFile,
|
|
19
|
+
C as saltyFileExtensions,
|
|
20
|
+
E as saltyFileRegExp
|
|
174
21
|
};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { SaltyConfig } from '
|
|
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
|
|
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
package/config/index.js
CHANGED
|
@@ -1,4 +1,14 @@
|
|
|
1
|
-
|
|
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
|
-
|
|
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
|
|
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
package/css/index.js
CHANGED
|
@@ -1,4 +1,12 @@
|
|
|
1
|
-
|
|
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
|
|
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 m=require("../parse-styles-DZYIEhB4.cjs"),w=require("../dash-case-BJEkFEGQ.cjs"),C=async({animationName:l,params:u,appendInitialStyles:y,...t})=>{const n=l||w.toHash(t),r=async(s={})=>{const{duration:e="500ms",easing:o="ease-in-out",delay:i="0s",iterationCount:S="1",direction:p="normal",fillMode:g="forwards",playState:b="running"}={...u,...s},a=`${n} ${e} ${o} ${i} ${S} ${p} ${g} ${b}`;if(!y)return a;const c=t.from||t["0%"];if(!c)return a;const j=await m.parseAndJoinStyles(c,"");return`${a};${j}`},$=Object.entries(t).map(async([s,e])=>{if(!e)return"";const o=await m.parseAndJoinStyles(e,"");return`${typeof s=="number"?`${s}%`:s}{${o}}`}),d=(await Promise.all($)).join(""),f=`@keyframes ${n} {${d}}`;return Object.assign(r,{toString:r,isKeyframes:!0,animationName:n,css:f,keyframes:t}),r};exports.keyframes=C;
|
|
@@ -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) => Promise<(params?: KeyframesParams) => Promise<string>>;
|
|
22
|
+
export {};
|
package/css/keyframes.js
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { p as m } from "../parse-styles-CKmL8EwD.js";
|
|
2
|
+
import { t as j } from "../dash-case-DBThphLm.js";
|
|
3
|
+
const v = async ({ animationName: $, params: f, appendInitialStyles: l, ...t }) => {
|
|
4
|
+
const r = $ || j(t), o = async (n = {}) => {
|
|
5
|
+
const {
|
|
6
|
+
duration: s = "500ms",
|
|
7
|
+
easing: e = "ease-in-out",
|
|
8
|
+
delay: i = "0s",
|
|
9
|
+
iterationCount: d = "1",
|
|
10
|
+
direction: S = "normal",
|
|
11
|
+
fillMode: g = "forwards",
|
|
12
|
+
playState: w = "running"
|
|
13
|
+
} = { ...f, ...n }, a = `${r} ${s} ${e} ${i} ${d} ${S} ${g} ${w}`;
|
|
14
|
+
if (!l) return a;
|
|
15
|
+
const c = t.from || t["0%"];
|
|
16
|
+
if (!c) return a;
|
|
17
|
+
const b = await m(c, "");
|
|
18
|
+
return `${a};${b}`;
|
|
19
|
+
}, u = Object.entries(t).map(async ([n, s]) => {
|
|
20
|
+
if (!s) return "";
|
|
21
|
+
const e = await m(s, "");
|
|
22
|
+
return `${typeof n == "number" ? `${n}%` : n}{${e}}`;
|
|
23
|
+
}), p = (await Promise.all(u)).join(""), y = `@keyframes ${r} {${p}}`;
|
|
24
|
+
return Object.assign(o, {
|
|
25
|
+
toString: o,
|
|
26
|
+
isKeyframes: !0,
|
|
27
|
+
animationName: r,
|
|
28
|
+
css: y,
|
|
29
|
+
keyframes: t
|
|
30
|
+
}), o;
|
|
31
|
+
};
|
|
32
|
+
export {
|
|
33
|
+
v as keyframes
|
|
34
|
+
};
|
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
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
|
@@ -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=
|
|
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 =
|
|
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(
|
|
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;
|