@antdv-next/cssinjs 0.0.3 → 1.0.0-alpha.1
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/LICENSE +21 -0
- package/README.md +0 -141
- package/dist/Cache.d.ts +22 -0
- package/dist/Cache.js +45 -0
- package/dist/Keyframes.d.ts +12 -0
- package/dist/Keyframes.js +17 -0
- package/dist/StyleContext.d.ts +118 -0
- package/dist/StyleContext.js +64 -0
- package/dist/cssinjs-utils/_util/hooks/useUniqueMemo.js +62 -0
- package/dist/cssinjs-utils/hooks/useCSP.d.ts +8 -0
- package/dist/cssinjs-utils/hooks/useCSP.js +8 -0
- package/dist/cssinjs-utils/hooks/usePrefix.d.ts +9 -0
- package/dist/cssinjs-utils/hooks/useToken.d.ts +25 -0
- package/dist/cssinjs-utils/index.d.ts +4 -0
- package/dist/cssinjs-utils/index.js +4 -0
- package/dist/cssinjs-utils/interface/components.d.ts +12 -0
- package/dist/cssinjs-utils/util/genStyleUtils.d.ts +127 -0
- package/dist/cssinjs-utils/util/genStyleUtils.js +188 -0
- package/dist/cssinjs-utils/util/getCompVarPrefix.js +8 -0
- package/dist/cssinjs-utils/util/getComponentToken.js +22 -0
- package/dist/cssinjs-utils/util/getDefaultComponentToken.js +11 -0
- package/dist/cssinjs-utils/util/maxmin.js +17 -0
- package/dist/cssinjs-utils/util/statistic.d.ts +15 -0
- package/dist/cssinjs-utils/util/statistic.js +52 -0
- package/dist/extractStyle.d.ts +18 -0
- package/dist/extractStyle.js +54 -0
- package/dist/hooks/useCSSVarRegister.d.ts +19 -0
- package/dist/hooks/useCSSVarRegister.js +74 -0
- package/dist/hooks/useCacheToken.d.ts +60 -0
- package/dist/hooks/useCacheToken.js +120 -0
- package/dist/hooks/useGlobalCache.d.ts +9 -0
- package/dist/hooks/useGlobalCache.js +70 -0
- package/dist/hooks/useStyleRegister.d.ts +47 -0
- package/dist/hooks/useStyleRegister.js +237 -0
- package/dist/index.d.ts +34 -0
- package/dist/index.js +29 -0
- package/dist/linters/NaNLinter.d.ts +6 -0
- package/dist/linters/NaNLinter.js +10 -0
- package/dist/linters/contentQuotesLinter.js +18 -0
- package/dist/linters/hashedAnimationLinter.js +12 -0
- package/dist/linters/index.d.ts +5 -0
- package/dist/linters/index.js +8 -0
- package/dist/linters/interface.d.ts +11 -0
- package/dist/linters/legacyNotSelectorLinter.d.ts +6 -0
- package/dist/linters/legacyNotSelectorLinter.js +20 -0
- package/dist/linters/logicalPropertiesLinter.d.ts +6 -0
- package/dist/linters/logicalPropertiesLinter.js +57 -0
- package/dist/linters/parentSelectorLinter.d.ts +7 -0
- package/dist/linters/parentSelectorLinter.js +12 -0
- package/dist/linters/utils.js +10 -0
- package/dist/theme/Theme.d.ts +16 -0
- package/dist/theme/Theme.js +24 -0
- package/dist/theme/ThemeCache.js +79 -0
- package/dist/theme/calc/CSSCalculator.d.ts +19 -0
- package/dist/theme/calc/CSSCalculator.js +63 -0
- package/dist/theme/calc/NumCalculator.d.ts +14 -0
- package/dist/theme/calc/NumCalculator.js +37 -0
- package/dist/theme/calc/calculator.d.ts +32 -0
- package/dist/theme/calc/calculator.js +6 -0
- package/dist/theme/calc/index.d.ts +8 -0
- package/dist/theme/calc/index.js +12 -0
- package/dist/theme/createTheme.d.ts +11 -0
- package/dist/theme/createTheme.js +16 -0
- package/dist/theme/index.js +6 -0
- package/dist/theme/interface.d.ts +5 -0
- package/dist/transformers/autoPrefix.d.ts +6 -0
- package/dist/transformers/autoPrefix.js +7 -0
- package/dist/transformers/interface.d.ts +9 -0
- package/{es → dist}/transformers/legacyLogicalProperties.d.ts +6 -2
- package/dist/transformers/legacyLogicalProperties.js +123 -0
- package/dist/transformers/px2rem.d.ts +23 -0
- package/dist/transformers/px2rem.js +37 -0
- package/dist/util/cacheMapUtil.js +60 -0
- package/dist/util/css-variables.d.ts +7 -0
- package/dist/util/css-variables.js +35 -0
- package/dist/util/index.d.ts +8 -0
- package/dist/util/index.js +108 -0
- package/package.json +33 -64
- package/dist/cssinjs.umd.js +0 -3
- package/es/Cache.d.ts +0 -20
- package/es/Cache.js +0 -33
- package/es/Keyframes.d.ts +0 -9
- package/es/Keyframes.js +0 -14
- package/es/StyleContext.d.ts +0 -40
- package/es/StyleContext.js +0 -100
- package/es/extractStyle.d.ts +0 -12
- package/es/extractStyle.js +0 -43
- package/es/hooks/useCSSVarRegister.d.ts +0 -21
- package/es/hooks/useCSSVarRegister.js +0 -59
- package/es/hooks/useCacheToken.d.ts +0 -69
- package/es/hooks/useCacheToken.js +0 -106
- package/es/hooks/useEffectCleanupRegister.d.ts +0 -2
- package/es/hooks/useEffectCleanupRegister.js +0 -8
- package/es/hooks/useGlobalCache.d.ts +0 -7
- package/es/hooks/useGlobalCache.js +0 -41
- package/es/hooks/useHMR.d.ts +0 -3
- package/es/hooks/useHMR.js +0 -20
- package/es/hooks/useStyleRegister.d.ts +0 -81
- package/es/hooks/useStyleRegister.js +0 -216
- package/es/index.d.ts +0 -18
- package/es/index.js +0 -44
- package/es/interface.d.ts +0 -2
- package/es/linters/NaNLinter.d.ts +0 -3
- package/es/linters/NaNLinter.js +0 -7
- package/es/linters/contentQuotesLinter.d.ts +0 -3
- package/es/linters/contentQuotesLinter.js +0 -13
- package/es/linters/hashedAnimationLinter.d.ts +0 -3
- package/es/linters/hashedAnimationLinter.js +0 -10
- package/es/linters/index.d.ts +0 -7
- package/es/linters/interface.d.ts +0 -8
- package/es/linters/legacyNotSelectorLinter.d.ts +0 -3
- package/es/linters/legacyNotSelectorLinter.js +0 -14
- package/es/linters/logicalPropertiesLinter.d.ts +0 -3
- package/es/linters/logicalPropertiesLinter.js +0 -61
- package/es/linters/parentSelectorLinter.d.ts +0 -3
- package/es/linters/parentSelectorLinter.js +0 -7
- package/es/linters/utils.d.ts +0 -2
- package/es/linters/utils.js +0 -11
- package/es/theme/Theme.d.ts +0 -11
- package/es/theme/Theme.js +0 -21
- package/es/theme/ThemeCache.d.ts +0 -20
- package/es/theme/ThemeCache.js +0 -74
- package/es/theme/calc/CSSCalculator.d.ts +0 -15
- package/es/theme/calc/CSSCalculator.js +0 -40
- package/es/theme/calc/NumCalculator.d.ts +0 -10
- package/es/theme/calc/NumCalculator.js +0 -25
- package/es/theme/calc/calculator.d.ts +0 -30
- package/es/theme/calc/calculator.js +0 -5
- package/es/theme/calc/index.d.ts +0 -5
- package/es/theme/calc/index.js +0 -9
- package/es/theme/createTheme.d.ts +0 -6
- package/es/theme/createTheme.js +0 -10
- package/es/theme/index.d.ts +0 -6
- package/es/theme/interface.d.ts +0 -2
- package/es/transformers/interface.d.ts +0 -4
- package/es/transformers/legacyLogicalProperties.js +0 -108
- package/es/transformers/px2rem.d.ts +0 -20
- package/es/transformers/px2rem.js +0 -32
- package/es/util/cacheMapUtil.d.ts +0 -14
- package/es/util/cacheMapUtil.js +0 -48
- package/es/util/css-variables.d.ts +0 -20
- package/es/util/css-variables.js +0 -22
- package/es/util/index.d.ts +0 -15
- package/es/util/index.js +0 -85
- package/lib/Cache.d.ts +0 -20
- package/lib/Cache.js +0 -1
- package/lib/Keyframes.d.ts +0 -9
- package/lib/Keyframes.js +0 -1
- package/lib/StyleContext.d.ts +0 -40
- package/lib/StyleContext.js +0 -1
- package/lib/extractStyle.d.ts +0 -12
- package/lib/extractStyle.js +0 -1
- package/lib/hooks/useCSSVarRegister.d.ts +0 -21
- package/lib/hooks/useCSSVarRegister.js +0 -1
- package/lib/hooks/useCacheToken.d.ts +0 -69
- package/lib/hooks/useCacheToken.js +0 -1
- package/lib/hooks/useEffectCleanupRegister.d.ts +0 -2
- package/lib/hooks/useEffectCleanupRegister.js +0 -1
- package/lib/hooks/useGlobalCache.d.ts +0 -7
- package/lib/hooks/useGlobalCache.js +0 -1
- package/lib/hooks/useHMR.d.ts +0 -3
- package/lib/hooks/useHMR.js +0 -1
- package/lib/hooks/useStyleRegister.d.ts +0 -81
- package/lib/hooks/useStyleRegister.js +0 -3
- package/lib/index.d.ts +0 -18
- package/lib/index.js +0 -1
- package/lib/interface.d.ts +0 -2
- package/lib/linters/NaNLinter.d.ts +0 -3
- package/lib/linters/NaNLinter.js +0 -1
- package/lib/linters/contentQuotesLinter.d.ts +0 -3
- package/lib/linters/contentQuotesLinter.js +0 -1
- package/lib/linters/hashedAnimationLinter.d.ts +0 -3
- package/lib/linters/hashedAnimationLinter.js +0 -1
- package/lib/linters/index.d.ts +0 -7
- package/lib/linters/interface.d.ts +0 -8
- package/lib/linters/legacyNotSelectorLinter.d.ts +0 -3
- package/lib/linters/legacyNotSelectorLinter.js +0 -1
- package/lib/linters/logicalPropertiesLinter.d.ts +0 -3
- package/lib/linters/logicalPropertiesLinter.js +0 -1
- package/lib/linters/parentSelectorLinter.d.ts +0 -3
- package/lib/linters/parentSelectorLinter.js +0 -1
- package/lib/linters/utils.d.ts +0 -2
- package/lib/linters/utils.js +0 -1
- package/lib/theme/Theme.d.ts +0 -11
- package/lib/theme/Theme.js +0 -1
- package/lib/theme/ThemeCache.d.ts +0 -20
- package/lib/theme/ThemeCache.js +0 -1
- package/lib/theme/calc/CSSCalculator.d.ts +0 -15
- package/lib/theme/calc/CSSCalculator.js +0 -1
- package/lib/theme/calc/NumCalculator.d.ts +0 -10
- package/lib/theme/calc/NumCalculator.js +0 -1
- package/lib/theme/calc/calculator.d.ts +0 -30
- package/lib/theme/calc/calculator.js +0 -1
- package/lib/theme/calc/index.d.ts +0 -5
- package/lib/theme/calc/index.js +0 -1
- package/lib/theme/createTheme.d.ts +0 -6
- package/lib/theme/createTheme.js +0 -1
- package/lib/theme/index.d.ts +0 -6
- package/lib/theme/interface.d.ts +0 -2
- package/lib/transformers/interface.d.ts +0 -4
- package/lib/transformers/legacyLogicalProperties.d.ts +0 -12
- package/lib/transformers/legacyLogicalProperties.js +0 -1
- package/lib/transformers/px2rem.d.ts +0 -20
- package/lib/transformers/px2rem.js +0 -1
- package/lib/util/cacheMapUtil.d.ts +0 -14
- package/lib/util/cacheMapUtil.js +0 -1
- package/lib/util/css-variables.d.ts +0 -20
- package/lib/util/css-variables.js +0 -1
- package/lib/util/index.d.ts +0 -15
- package/lib/util/index.js +0 -1
|
@@ -1,216 +0,0 @@
|
|
|
1
|
-
import { computed as T, unref as A, createVNode as k, mergeProps as F, Fragment as K } from "vue";
|
|
2
|
-
import V from "@emotion/hash";
|
|
3
|
-
import { updateCSS as H, removeCSS as W } from "@v-c/util/dist/Dom/dynamicCSS";
|
|
4
|
-
import q from "@emotion/unitless";
|
|
5
|
-
import { serialize as U, compile as Y, stringify as G } from "stylis";
|
|
6
|
-
import J from "../linters/contentQuotesLinter.js";
|
|
7
|
-
import Q from "../linters/hashedAnimationLinter.js";
|
|
8
|
-
import "@v-c/util/dist/warning";
|
|
9
|
-
import { useStyleContext as X, ATTR_MARK as O, CSS_IN_JS_INSTANCE as Z, ATTR_TOKEN as x, ATTR_CACHE_PATH as B } from "../StyleContext.js";
|
|
10
|
-
import { isClientSide as R, toStyleStr as M } from "../util/index.js";
|
|
11
|
-
import { CSS_FILE_STYLE as ee, existPath as te, getStyleAndHash as re } from "../util/cacheMapUtil.js";
|
|
12
|
-
import ne from "./useGlobalCache.js";
|
|
13
|
-
const z = "_skip_check_", D = "_multi_value_";
|
|
14
|
-
function b(e) {
|
|
15
|
-
return U(Y(e), G).replace(/\{%%%:[^;];\}/g, ";");
|
|
16
|
-
}
|
|
17
|
-
function ae(e) {
|
|
18
|
-
return typeof e == "object" && e && (z in e || D in e);
|
|
19
|
-
}
|
|
20
|
-
function w(e, f, _) {
|
|
21
|
-
if (!f)
|
|
22
|
-
return e;
|
|
23
|
-
const E = `.${f}`, $ = _ === "low" ? `:where(${E})` : E;
|
|
24
|
-
return e.split(",").map((c) => {
|
|
25
|
-
const N = c.trim().split(/\s+/);
|
|
26
|
-
let h = N[0] || "";
|
|
27
|
-
const r = h.match(/^\w+/)?.[0] || "";
|
|
28
|
-
return h = `${r}${$}${h.slice(r.length)}`, [h, ...N.slice(1)].join(" ");
|
|
29
|
-
}).join(",");
|
|
30
|
-
}
|
|
31
|
-
function L(e, f = {}, {
|
|
32
|
-
root: _,
|
|
33
|
-
injectHash: E,
|
|
34
|
-
parentSelectors: $
|
|
35
|
-
} = {
|
|
36
|
-
root: !0,
|
|
37
|
-
parentSelectors: []
|
|
38
|
-
}) {
|
|
39
|
-
const {
|
|
40
|
-
hashId: y,
|
|
41
|
-
layer: c,
|
|
42
|
-
path: N,
|
|
43
|
-
hashPriority: h,
|
|
44
|
-
transformers: r = [],
|
|
45
|
-
linters: d = []
|
|
46
|
-
} = f;
|
|
47
|
-
let o = "", u = {};
|
|
48
|
-
function j(n) {
|
|
49
|
-
const s = n.getName(y);
|
|
50
|
-
if (!u[s]) {
|
|
51
|
-
const [i] = L(n.style, f, {
|
|
52
|
-
root: !1,
|
|
53
|
-
parentSelectors: $
|
|
54
|
-
});
|
|
55
|
-
u[s] = `@keyframes ${n.getName(y)}${i}`;
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
function g(n, s = []) {
|
|
59
|
-
return n.forEach((i) => {
|
|
60
|
-
Array.isArray(i) ? g(i, s) : i && s.push(i);
|
|
61
|
-
}), s;
|
|
62
|
-
}
|
|
63
|
-
return g(Array.isArray(e) ? e : [e]).forEach((n) => {
|
|
64
|
-
const s = typeof n == "string" && !_ ? {} : n;
|
|
65
|
-
if (typeof s == "string")
|
|
66
|
-
o += `${s}
|
|
67
|
-
`;
|
|
68
|
-
else if (s._keyframe)
|
|
69
|
-
j(s);
|
|
70
|
-
else {
|
|
71
|
-
const i = r.reduce((a, t) => t?.visit?.(a) || a, s);
|
|
72
|
-
Object.keys(i).forEach((a) => {
|
|
73
|
-
const t = i[a];
|
|
74
|
-
if (typeof t == "object" && t && (a !== "animationName" || !t._keyframe) && !ae(t)) {
|
|
75
|
-
let p = !1, l = a.trim(), S = !1;
|
|
76
|
-
(_ || E) && y ? l.startsWith("@") ? p = !0 : l === "&" ? l = w("", y, h) : l = w(a, y, h) : _ && !y && (l === "&" || l === "") && (l = "", S = !0);
|
|
77
|
-
const [v, m] = L(t, f, {
|
|
78
|
-
root: S,
|
|
79
|
-
injectHash: p,
|
|
80
|
-
parentSelectors: [...$, l]
|
|
81
|
-
});
|
|
82
|
-
u = {
|
|
83
|
-
...u,
|
|
84
|
-
...m
|
|
85
|
-
}, o += `${l}${v}`;
|
|
86
|
-
} else {
|
|
87
|
-
let p = function(S, v) {
|
|
88
|
-
process.env.NODE_ENV !== "production" && (typeof t != "object" || !t?.[z]) && [J, Q, ...d].forEach((P) => P(S, v, {
|
|
89
|
-
path: N,
|
|
90
|
-
hashId: y,
|
|
91
|
-
parentSelectors: $
|
|
92
|
-
}));
|
|
93
|
-
const m = S.replace(/[A-Z]/g, (P) => `-${P.toLowerCase()}`);
|
|
94
|
-
let I = v;
|
|
95
|
-
!q[S] && typeof I == "number" && I !== 0 && (I = `${I}px`), S === "animationName" && v?._keyframe && (j(v), I = v.getName(y)), o += `${m}:${I};`;
|
|
96
|
-
};
|
|
97
|
-
const l = t?.value ?? t;
|
|
98
|
-
typeof t == "object" && t?.[D] && Array.isArray(l) ? l.forEach((S) => {
|
|
99
|
-
p(a, S);
|
|
100
|
-
}) : p(a, l);
|
|
101
|
-
}
|
|
102
|
-
});
|
|
103
|
-
}
|
|
104
|
-
}), _ ? c && (o = `@layer ${c.name} {${o}}`, c.dependencies && (u[`@layer ${c.name}`] = c.dependencies.map((n) => `@layer ${n}, ${c.name};`).join(`
|
|
105
|
-
`))) : o = `{${o}}`, [o, u];
|
|
106
|
-
}
|
|
107
|
-
function oe(e, f) {
|
|
108
|
-
return V(`${e.join("%")}${f}`);
|
|
109
|
-
}
|
|
110
|
-
function se() {
|
|
111
|
-
return null;
|
|
112
|
-
}
|
|
113
|
-
const le = "style";
|
|
114
|
-
function Ee(e, f) {
|
|
115
|
-
const _ = T(() => A(e).token), E = T(() => A(e).path), $ = T(() => A(e).hashId), y = T(() => A(e).layer), c = T(() => A(e).nonce), N = T(() => A(e).clientOnly), h = T(() => A(e).order ?? 0), r = X(), d = T(() => _.value._tokenKey), o = [d.value];
|
|
116
|
-
r.value.layer && o.push("layer"), o.push(...E.value);
|
|
117
|
-
const u = r.value.mock;
|
|
118
|
-
let j = R;
|
|
119
|
-
process.env.NODE_ENV !== "production" && u !== void 0 && (j = u === "client");
|
|
120
|
-
const g = ne(
|
|
121
|
-
le,
|
|
122
|
-
o,
|
|
123
|
-
// Create cache if needed
|
|
124
|
-
() => {
|
|
125
|
-
const C = o.join("|");
|
|
126
|
-
if (te(C)) {
|
|
127
|
-
const [p, l] = re(C);
|
|
128
|
-
if (p)
|
|
129
|
-
return [p, d.value, l, {}, N.value, h.value];
|
|
130
|
-
}
|
|
131
|
-
const n = A(f)(), [s, i] = L(n, {
|
|
132
|
-
hashId: $.value,
|
|
133
|
-
hashPriority: r.value.hashPriority,
|
|
134
|
-
layer: r.value.layer ? y.value : void 0,
|
|
135
|
-
path: E.value.join("-"),
|
|
136
|
-
transformers: r.value.transformers,
|
|
137
|
-
linters: r.value.linters
|
|
138
|
-
}), a = b(s), t = oe(o, a);
|
|
139
|
-
return [a, d.value, t, i, N.value, h.value];
|
|
140
|
-
},
|
|
141
|
-
// Remove cache if no need
|
|
142
|
-
([, , C], n) => {
|
|
143
|
-
(n || r.value.autoClear) && R && W(C, {
|
|
144
|
-
mark: O
|
|
145
|
-
});
|
|
146
|
-
},
|
|
147
|
-
// Effect: Inject style here
|
|
148
|
-
([C, n, s, i]) => {
|
|
149
|
-
if (j && C !== ee) {
|
|
150
|
-
const a = {
|
|
151
|
-
mark: O,
|
|
152
|
-
prepend: r.value.layer ? !1 : "queue",
|
|
153
|
-
attachTo: r.value.container,
|
|
154
|
-
priority: h.value
|
|
155
|
-
}, t = typeof c.value == "function" ? c.value() : c.value;
|
|
156
|
-
t && (a.csp = {
|
|
157
|
-
nonce: t
|
|
158
|
-
});
|
|
159
|
-
const p = [], l = [];
|
|
160
|
-
Object.keys(i).forEach((m) => {
|
|
161
|
-
m.startsWith("@layer") ? p.push(m) : l.push(m);
|
|
162
|
-
}), p.forEach((m) => {
|
|
163
|
-
H(b(i[m]), `_layer-${m}`, {
|
|
164
|
-
...a,
|
|
165
|
-
prepend: !0
|
|
166
|
-
});
|
|
167
|
-
});
|
|
168
|
-
const S = r.value.cache, v = H(C, s, a);
|
|
169
|
-
v[Z] = S.instanceId, v.setAttribute(x, A(d)), process.env.NODE_ENV !== "production" && v.setAttribute(B, o.join("|")), l.forEach((m) => {
|
|
170
|
-
H(b(i[m]), `_effect-${m}`, a);
|
|
171
|
-
});
|
|
172
|
-
}
|
|
173
|
-
}
|
|
174
|
-
);
|
|
175
|
-
return (C) => {
|
|
176
|
-
let n;
|
|
177
|
-
const {
|
|
178
|
-
ssrInline: s,
|
|
179
|
-
defaultCache: i
|
|
180
|
-
} = r.value, [a, t, p] = g.value;
|
|
181
|
-
return !s || j || !i ? n = k(se, null, null) : n = // @ts-expect-error this is a private package
|
|
182
|
-
k("style", F({
|
|
183
|
-
[x]: t,
|
|
184
|
-
[O]: p
|
|
185
|
-
}, {
|
|
186
|
-
innerHTML: a
|
|
187
|
-
}), null), k(K, null, [n, C]);
|
|
188
|
-
};
|
|
189
|
-
}
|
|
190
|
-
const $e = (e, f, _) => {
|
|
191
|
-
const [E, $, y, c, N, h] = e, {
|
|
192
|
-
plain: r
|
|
193
|
-
} = _ || {};
|
|
194
|
-
if (N)
|
|
195
|
-
return null;
|
|
196
|
-
let d = E;
|
|
197
|
-
const o = {
|
|
198
|
-
"data-vc-order": "prependQueue",
|
|
199
|
-
"data-vc-priority": `${h}`
|
|
200
|
-
};
|
|
201
|
-
return d = M(E, $, y, o, r), c && Object.keys(c).forEach((u) => {
|
|
202
|
-
if (!f[u]) {
|
|
203
|
-
f[u] = !0;
|
|
204
|
-
const j = b(c[u]), g = M(j, $, `_effect-${u}`, o, r);
|
|
205
|
-
u.startsWith("@layer") ? d = g + d : d += g;
|
|
206
|
-
}
|
|
207
|
-
}), [h, y, d];
|
|
208
|
-
};
|
|
209
|
-
export {
|
|
210
|
-
le as STYLE_PREFIX,
|
|
211
|
-
Ee as default,
|
|
212
|
-
$e as extract,
|
|
213
|
-
b as normalizeStyle,
|
|
214
|
-
L as parseStyle,
|
|
215
|
-
oe as uniqueHash
|
|
216
|
-
};
|
package/es/index.d.ts
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { CSSInterpolation, CSSObject, default as useStyleRegister } from './hooks/useStyleRegister';
|
|
2
|
-
import { Linter, legacyNotSelectorLinter, logicalPropertiesLinter, NaNLinter, parentSelectorLinter } from './linters';
|
|
3
|
-
import { StyleProviderProps, createCache, StyleProvider } from './StyleContext';
|
|
4
|
-
import { AbstractCalculator, DerivativeFunc, TokenType, createTheme, genCalc, Theme } from './theme';
|
|
5
|
-
import { Transformer } from './transformers/interface';
|
|
6
|
-
import { default as extractStyle } from './extractStyle';
|
|
7
|
-
import { default as useCacheToken, getComputedToken } from './hooks/useCacheToken';
|
|
8
|
-
import { default as useCSSVarRegister } from './hooks/useCSSVarRegister';
|
|
9
|
-
import { default as Keyframes } from './Keyframes';
|
|
10
|
-
import { default as legacyLogicalPropertiesTransformer } from './transformers/legacyLogicalProperties';
|
|
11
|
-
import { default as px2remTransformer } from './transformers/px2rem';
|
|
12
|
-
import { unit } from './util';
|
|
13
|
-
import { token2CSSVar } from './util/css-variables';
|
|
14
|
-
export { createCache, createTheme, extractStyle, genCalc, getComputedToken, Keyframes, legacyLogicalPropertiesTransformer, legacyNotSelectorLinter, logicalPropertiesLinter, NaNLinter, parentSelectorLinter, px2remTransformer, StyleProvider, Theme, token2CSSVar, unit, useCacheToken, useCSSVarRegister, useStyleRegister, };
|
|
15
|
-
export type { AbstractCalculator, CSSInterpolation, CSSObject, DerivativeFunc, Linter, StyleProviderProps, TokenType, Transformer, };
|
|
16
|
-
export declare const _experimental: {
|
|
17
|
-
supportModernCSS: () => boolean;
|
|
18
|
-
};
|
package/es/index.js
DELETED
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
import { default as s } from "./extractStyle.js";
|
|
2
|
-
import { getComputedToken as l, default as u } from "./hooks/useCacheToken.js";
|
|
3
|
-
import { default as d } from "./hooks/useCSSVarRegister.js";
|
|
4
|
-
import { default as n } from "./hooks/useStyleRegister.js";
|
|
5
|
-
import { default as S } from "./Keyframes.js";
|
|
6
|
-
import "@v-c/util/dist/warning";
|
|
7
|
-
import { default as C } from "./linters/legacyNotSelectorLinter.js";
|
|
8
|
-
import { default as L } from "./linters/logicalPropertiesLinter.js";
|
|
9
|
-
import { default as h } from "./linters/NaNLinter.js";
|
|
10
|
-
import { default as k } from "./linters/parentSelectorLinter.js";
|
|
11
|
-
import { StyleProvider as R, createCache as V } from "./StyleContext.js";
|
|
12
|
-
import { default as K } from "./theme/calc/index.js";
|
|
13
|
-
import { default as W } from "./theme/createTheme.js";
|
|
14
|
-
import { default as b } from "./theme/Theme.js";
|
|
15
|
-
import { default as q } from "./transformers/legacyLogicalProperties.js";
|
|
16
|
-
import { default as z } from "./transformers/px2rem.js";
|
|
17
|
-
import { supportWhere as e, supportLogicProps as r } from "./util/index.js";
|
|
18
|
-
import { unit as B } from "./util/index.js";
|
|
19
|
-
import { token2CSSVar as E } from "./util/css-variables.js";
|
|
20
|
-
const a = {
|
|
21
|
-
supportModernCSS: () => e() && r()
|
|
22
|
-
};
|
|
23
|
-
export {
|
|
24
|
-
S as Keyframes,
|
|
25
|
-
h as NaNLinter,
|
|
26
|
-
R as StyleProvider,
|
|
27
|
-
b as Theme,
|
|
28
|
-
a as _experimental,
|
|
29
|
-
V as createCache,
|
|
30
|
-
W as createTheme,
|
|
31
|
-
s as extractStyle,
|
|
32
|
-
K as genCalc,
|
|
33
|
-
l as getComputedToken,
|
|
34
|
-
q as legacyLogicalPropertiesTransformer,
|
|
35
|
-
C as legacyNotSelectorLinter,
|
|
36
|
-
L as logicalPropertiesLinter,
|
|
37
|
-
k as parentSelectorLinter,
|
|
38
|
-
z as px2remTransformer,
|
|
39
|
-
E as token2CSSVar,
|
|
40
|
-
B as unit,
|
|
41
|
-
d as useCSSVarRegister,
|
|
42
|
-
u as useCacheToken,
|
|
43
|
-
n as useStyleRegister
|
|
44
|
-
};
|
package/es/interface.d.ts
DELETED
package/es/linters/NaNLinter.js
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { lintWarning as i } from "./utils.js";
|
|
2
|
-
const s = (n, t, e) => {
|
|
3
|
-
if (n === "content") {
|
|
4
|
-
const o = /(attr|counters?|url|(((repeating-)?(linear|radial))|conic)-gradient)\(|(no-)?(open|close)-quote/;
|
|
5
|
-
(typeof t != "string" || !["normal", "none", "initial", "inherit", "unset"].includes(t) && !o.test(t) && (t.charAt(0) !== t.charAt(t.length - 1) || t.charAt(0) !== '"' && t.charAt(0) !== "'")) && i(
|
|
6
|
-
`You seem to be using a value for 'content' without quotes, try replacing it with \`content: '"${t}"'\`.`,
|
|
7
|
-
e
|
|
8
|
-
);
|
|
9
|
-
}
|
|
10
|
-
};
|
|
11
|
-
export {
|
|
12
|
-
s as default
|
|
13
|
-
};
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { lintWarning as n } from "./utils.js";
|
|
2
|
-
const m = (e, i, a) => {
|
|
3
|
-
e === "animation" && a.hashId && i !== "none" && n(
|
|
4
|
-
`You seem to be using hashed animation '${i}', in which case 'animationName' with Keyframe as value is recommended.`,
|
|
5
|
-
a
|
|
6
|
-
);
|
|
7
|
-
};
|
|
8
|
-
export {
|
|
9
|
-
m as default
|
|
10
|
-
};
|
package/es/linters/index.d.ts
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
export { default as contentQuotesLinter } from './contentQuotesLinter';
|
|
2
|
-
export { default as hashedAnimationLinter } from './hashedAnimationLinter';
|
|
3
|
-
export type { Linter } from './interface';
|
|
4
|
-
export { default as legacyNotSelectorLinter } from './legacyNotSelectorLinter';
|
|
5
|
-
export { default as logicalPropertiesLinter } from './logicalPropertiesLinter';
|
|
6
|
-
export { default as NaNLinter } from './NaNLinter';
|
|
7
|
-
export { default as parentSelectorLinter } from './parentSelectorLinter';
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { lintWarning as l } from "./utils.js";
|
|
2
|
-
function s(n) {
|
|
3
|
-
return (n.match(/:not\(([^)]*)\)/)?.[1] || "").split(/(\[[^[]*\])|(?=[.#])/).filter((o) => o).length > 1;
|
|
4
|
-
}
|
|
5
|
-
function a(n) {
|
|
6
|
-
return n.parentSelectors.reduce((e, t) => e ? t.includes("&") ? t.replace(/&/g, e) : `${e} ${t}` : t, "");
|
|
7
|
-
}
|
|
8
|
-
const i = (n, e, t) => {
|
|
9
|
-
const r = a(t).match(/:not\([^)]*\)/g) || [];
|
|
10
|
-
r.length > 0 && r.some(s) && l("Concat ':not' selector not support in legacy browsers.", t);
|
|
11
|
-
};
|
|
12
|
-
export {
|
|
13
|
-
i as default
|
|
14
|
-
};
|
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
import { lintWarning as a } from "./utils.js";
|
|
2
|
-
const p = (o, r, i) => {
|
|
3
|
-
switch (o) {
|
|
4
|
-
case "marginLeft":
|
|
5
|
-
case "marginRight":
|
|
6
|
-
case "paddingLeft":
|
|
7
|
-
case "paddingRight":
|
|
8
|
-
case "left":
|
|
9
|
-
case "right":
|
|
10
|
-
case "borderLeft":
|
|
11
|
-
case "borderLeftWidth":
|
|
12
|
-
case "borderLeftStyle":
|
|
13
|
-
case "borderLeftColor":
|
|
14
|
-
case "borderRight":
|
|
15
|
-
case "borderRightWidth":
|
|
16
|
-
case "borderRightStyle":
|
|
17
|
-
case "borderRightColor":
|
|
18
|
-
case "borderTopLeftRadius":
|
|
19
|
-
case "borderTopRightRadius":
|
|
20
|
-
case "borderBottomLeftRadius":
|
|
21
|
-
case "borderBottomRightRadius":
|
|
22
|
-
a(
|
|
23
|
-
`You seem to be using non-logical property '${o}' which is not compatible with RTL mode. Please use logical properties and values instead. For more information: https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Logical_Properties.`,
|
|
24
|
-
i
|
|
25
|
-
);
|
|
26
|
-
return;
|
|
27
|
-
case "margin":
|
|
28
|
-
case "padding":
|
|
29
|
-
case "borderWidth":
|
|
30
|
-
case "borderStyle":
|
|
31
|
-
if (typeof r == "string") {
|
|
32
|
-
const s = r.split(" ").map((n) => n.trim());
|
|
33
|
-
s.length === 4 && s[1] !== s[3] && a(
|
|
34
|
-
`You seem to be using '${o}' property with different left ${o} and right ${o}, which is not compatible with RTL mode. Please use logical properties and values instead. For more information: https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Logical_Properties.`,
|
|
35
|
-
i
|
|
36
|
-
);
|
|
37
|
-
}
|
|
38
|
-
return;
|
|
39
|
-
case "clear":
|
|
40
|
-
case "textAlign":
|
|
41
|
-
(r === "left" || r === "right") && a(
|
|
42
|
-
`You seem to be using non-logical value '${r}' of ${o}, which is not compatible with RTL mode. Please use logical properties and values instead. For more information: https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Logical_Properties.`,
|
|
43
|
-
i
|
|
44
|
-
);
|
|
45
|
-
return;
|
|
46
|
-
// @ts-expect-error THIS IS A TEST
|
|
47
|
-
case "borderRadius":
|
|
48
|
-
typeof r == "string" && r.split("/").map((t) => t.trim()).reduce((t, l) => {
|
|
49
|
-
if (t)
|
|
50
|
-
return t;
|
|
51
|
-
const e = l.split(" ").map((d) => d.trim());
|
|
52
|
-
return e.length >= 2 && e[0] !== e[1] || e.length === 3 && e[1] !== e[2] || e.length === 4 && e[2] !== e[3] ? !0 : t;
|
|
53
|
-
}, !1) && a(
|
|
54
|
-
`You seem to be using non-logical value '${r}' of ${o}, which is not compatible with RTL mode. Please use logical properties and values instead. For more information: https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Logical_Properties.`,
|
|
55
|
-
i
|
|
56
|
-
);
|
|
57
|
-
}
|
|
58
|
-
};
|
|
59
|
-
export {
|
|
60
|
-
p as default
|
|
61
|
-
};
|
package/es/linters/utils.d.ts
DELETED
package/es/linters/utils.js
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import i from "@v-c/util/dist/warning";
|
|
2
|
-
function a(t, e) {
|
|
3
|
-
const { path: n, parentSelectors: r } = e;
|
|
4
|
-
i(
|
|
5
|
-
!1,
|
|
6
|
-
`[Ant Design CSS-in-JS] ${n ? `Error in ${n}: ` : ""}${t}${r.length ? ` Selector: ${r.join(" | ")}` : ""}`
|
|
7
|
-
);
|
|
8
|
-
}
|
|
9
|
-
export {
|
|
10
|
-
a as lintWarning
|
|
11
|
-
};
|
package/es/theme/Theme.d.ts
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { DerivativeFunc, TokenType } from './interface';
|
|
2
|
-
/**
|
|
3
|
-
* Theme with algorithms to derive tokens from design tokens.
|
|
4
|
-
* Use `createTheme` first which will help to manage the theme instance cache.
|
|
5
|
-
*/
|
|
6
|
-
export default class Theme<DesignToken extends TokenType, DerivativeToken extends TokenType> {
|
|
7
|
-
private derivatives;
|
|
8
|
-
readonly id: number;
|
|
9
|
-
constructor(derivatives: DerivativeFunc<DesignToken, DerivativeToken> | DerivativeFunc<DesignToken, DerivativeToken>[]);
|
|
10
|
-
getDerivativeToken(token: DesignToken): DerivativeToken;
|
|
11
|
-
}
|
package/es/theme/Theme.js
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { warning as n } from "@v-c/util/dist/warning";
|
|
2
|
-
let t = 0;
|
|
3
|
-
class s {
|
|
4
|
-
derivatives;
|
|
5
|
-
id;
|
|
6
|
-
constructor(e) {
|
|
7
|
-
this.derivatives = Array.isArray(e) ? e : [e], this.id = t, e.length === 0 && n(
|
|
8
|
-
e.length > 0,
|
|
9
|
-
"[Ant Design CSS-in-JS] Theme should have at least one derivative function."
|
|
10
|
-
), t += 1;
|
|
11
|
-
}
|
|
12
|
-
getDerivativeToken(e) {
|
|
13
|
-
return this.derivatives.reduce(
|
|
14
|
-
(i, r) => r(e, i),
|
|
15
|
-
void 0
|
|
16
|
-
);
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
export {
|
|
20
|
-
s as default
|
|
21
|
-
};
|
package/es/theme/ThemeCache.d.ts
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { DerivativeFunc } from './interface';
|
|
2
|
-
import { default as Theme } from './Theme';
|
|
3
|
-
type DerivativeOptions = DerivativeFunc<any, any>[];
|
|
4
|
-
export declare function sameDerivativeOption(left: DerivativeOptions, right: DerivativeOptions): boolean;
|
|
5
|
-
export default class ThemeCache {
|
|
6
|
-
static MAX_CACHE_SIZE: number;
|
|
7
|
-
static MAX_CACHE_OFFSET: number;
|
|
8
|
-
private readonly cache;
|
|
9
|
-
private keys;
|
|
10
|
-
private cacheCallTimes;
|
|
11
|
-
constructor();
|
|
12
|
-
size(): number;
|
|
13
|
-
private internalGet;
|
|
14
|
-
get(derivativeOption: DerivativeOptions): Theme<any, any> | undefined;
|
|
15
|
-
has(derivativeOption: DerivativeOptions): boolean;
|
|
16
|
-
set(derivativeOption: DerivativeOptions, value: Theme<any, any>): void;
|
|
17
|
-
private deleteByPath;
|
|
18
|
-
delete(derivativeOption: DerivativeOptions): Theme<any, any> | undefined;
|
|
19
|
-
}
|
|
20
|
-
export {};
|
package/es/theme/ThemeCache.js
DELETED
|
@@ -1,74 +0,0 @@
|
|
|
1
|
-
function u(c, e) {
|
|
2
|
-
if (c.length !== e.length)
|
|
3
|
-
return !1;
|
|
4
|
-
for (let s = 0; s < c.length; s++)
|
|
5
|
-
if (c[s] !== e[s])
|
|
6
|
-
return !1;
|
|
7
|
-
return !0;
|
|
8
|
-
}
|
|
9
|
-
class n {
|
|
10
|
-
static MAX_CACHE_SIZE = 20;
|
|
11
|
-
static MAX_CACHE_OFFSET = 5;
|
|
12
|
-
cache;
|
|
13
|
-
keys;
|
|
14
|
-
cacheCallTimes;
|
|
15
|
-
constructor() {
|
|
16
|
-
this.cache = /* @__PURE__ */ new Map(), this.keys = [], this.cacheCallTimes = 0;
|
|
17
|
-
}
|
|
18
|
-
size() {
|
|
19
|
-
return this.keys.length;
|
|
20
|
-
}
|
|
21
|
-
internalGet(e, s = !1) {
|
|
22
|
-
let t = { map: this.cache };
|
|
23
|
-
return e.forEach((a) => {
|
|
24
|
-
t ? t = t?.map?.get(a) : t = void 0;
|
|
25
|
-
}), t?.value && s && (t.value[1] = this.cacheCallTimes++), t?.value;
|
|
26
|
-
}
|
|
27
|
-
get(e) {
|
|
28
|
-
return this.internalGet(e, !0)?.[0];
|
|
29
|
-
}
|
|
30
|
-
has(e) {
|
|
31
|
-
return !!this.internalGet(e);
|
|
32
|
-
}
|
|
33
|
-
set(e, s) {
|
|
34
|
-
if (!this.has(e)) {
|
|
35
|
-
if (this.size() + 1 > n.MAX_CACHE_SIZE + n.MAX_CACHE_OFFSET) {
|
|
36
|
-
const [a] = this.keys.reduce(
|
|
37
|
-
(h, l) => {
|
|
38
|
-
const [, i] = h;
|
|
39
|
-
return this.internalGet(l)[1] < i ? [l, this.internalGet(l)[1]] : h;
|
|
40
|
-
},
|
|
41
|
-
[this.keys[0], this.cacheCallTimes]
|
|
42
|
-
);
|
|
43
|
-
this.delete(a);
|
|
44
|
-
}
|
|
45
|
-
this.keys.push(e);
|
|
46
|
-
}
|
|
47
|
-
let t = this.cache;
|
|
48
|
-
e.forEach((a, h) => {
|
|
49
|
-
if (h === e.length - 1)
|
|
50
|
-
t.set(a, { value: [s, this.cacheCallTimes++] });
|
|
51
|
-
else {
|
|
52
|
-
const l = t.get(a);
|
|
53
|
-
l ? l.map || (l.map = /* @__PURE__ */ new Map()) : t.set(a, { map: /* @__PURE__ */ new Map() }), t = t.get(a).map;
|
|
54
|
-
}
|
|
55
|
-
});
|
|
56
|
-
}
|
|
57
|
-
deleteByPath(e, s) {
|
|
58
|
-
const t = e.get(s[0]);
|
|
59
|
-
if (s.length === 1)
|
|
60
|
-
return t.map ? e.set(s[0], { map: t.map }) : e.delete(s[0]), t.value?.[0];
|
|
61
|
-
const a = this.deleteByPath(t.map, s.slice(1));
|
|
62
|
-
return (!t.map || t.map.size === 0) && !t.value && e.delete(s[0]), a;
|
|
63
|
-
}
|
|
64
|
-
delete(e) {
|
|
65
|
-
if (this.has(e))
|
|
66
|
-
return this.keys = this.keys.filter(
|
|
67
|
-
(s) => !u(s, e)
|
|
68
|
-
), this.deleteByPath(this.cache, e);
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
export {
|
|
72
|
-
n as default,
|
|
73
|
-
u as sameDerivativeOption
|
|
74
|
-
};
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { default as AbstractCalculator } from './calculator';
|
|
2
|
-
export default class CSSCalculator extends AbstractCalculator {
|
|
3
|
-
result: string;
|
|
4
|
-
unitlessCssVar: Set<string>;
|
|
5
|
-
lowPriority?: boolean;
|
|
6
|
-
constructor(num: number | string | AbstractCalculator, unitlessCssVar: Set<string>);
|
|
7
|
-
add(num: number | string | AbstractCalculator): this;
|
|
8
|
-
sub(num: number | string | AbstractCalculator): this;
|
|
9
|
-
mul(num: number | string | AbstractCalculator): this;
|
|
10
|
-
div(num: number | string | AbstractCalculator): this;
|
|
11
|
-
getResult(force?: boolean): string;
|
|
12
|
-
equal(options?: {
|
|
13
|
-
unit?: boolean;
|
|
14
|
-
}): string;
|
|
15
|
-
}
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import h from "./calculator.js";
|
|
2
|
-
const u = "CALC_UNIT", f = new RegExp(u, "g");
|
|
3
|
-
function l(r) {
|
|
4
|
-
return typeof r == "number" ? `${r}${u}` : r;
|
|
5
|
-
}
|
|
6
|
-
class e extends h {
|
|
7
|
-
result = "";
|
|
8
|
-
unitlessCssVar;
|
|
9
|
-
lowPriority;
|
|
10
|
-
constructor(t, i) {
|
|
11
|
-
super();
|
|
12
|
-
const s = typeof t;
|
|
13
|
-
this.unitlessCssVar = i, t instanceof e ? this.result = `(${t.result})` : s === "number" ? this.result = l(t) : s === "string" && (this.result = t);
|
|
14
|
-
}
|
|
15
|
-
add(t) {
|
|
16
|
-
return t instanceof e ? this.result = `${this.result} + ${t.getResult()}` : (typeof t == "number" || typeof t == "string") && (this.result = `${this.result} + ${l(t)}`), this.lowPriority = !0, this;
|
|
17
|
-
}
|
|
18
|
-
sub(t) {
|
|
19
|
-
return t instanceof e ? this.result = `${this.result} - ${t.getResult()}` : (typeof t == "number" || typeof t == "string") && (this.result = `${this.result} - ${l(t)}`), this.lowPriority = !0, this;
|
|
20
|
-
}
|
|
21
|
-
mul(t) {
|
|
22
|
-
return this.lowPriority && (this.result = `(${this.result})`), t instanceof e ? this.result = `${this.result} * ${t.getResult(!0)}` : (typeof t == "number" || typeof t == "string") && (this.result = `${this.result} * ${t}`), this.lowPriority = !1, this;
|
|
23
|
-
}
|
|
24
|
-
div(t) {
|
|
25
|
-
return this.lowPriority && (this.result = `(${this.result})`), t instanceof e ? this.result = `${this.result} / ${t.getResult(!0)}` : (typeof t == "number" || typeof t == "string") && (this.result = `${this.result} / ${t}`), this.lowPriority = !1, this;
|
|
26
|
-
}
|
|
27
|
-
getResult(t) {
|
|
28
|
-
return this.lowPriority || t ? `(${this.result})` : this.result;
|
|
29
|
-
}
|
|
30
|
-
equal(t) {
|
|
31
|
-
const { unit: i } = t || {};
|
|
32
|
-
let s = !0;
|
|
33
|
-
return typeof i == "boolean" ? s = i : Array.from(this.unitlessCssVar).some(
|
|
34
|
-
(o) => this.result.includes(o)
|
|
35
|
-
) && (s = !1), this.result = this.result.replace(f, s ? "px" : ""), typeof this.lowPriority < "u" ? `calc(${this.result})` : this.result;
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
export {
|
|
39
|
-
e as default
|
|
40
|
-
};
|