@antdv-next/cssinjs 0.0.2 → 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/dist/transformers/legacyLogicalProperties.d.ts +16 -0
- 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 -63
- package/dist/cssinjs.umd.js +0 -3
- package/es/Cache.js +0 -33
- package/es/Keyframes.js +0 -14
- package/es/StyleContext.js +0 -100
- package/es/extractStyle.js +0 -43
- package/es/hooks/useCSSVarRegister.js +0 -59
- package/es/hooks/useCacheToken.js +0 -106
- package/es/hooks/useEffectCleanupRegister.js +0 -8
- package/es/hooks/useGlobalCache.js +0 -41
- package/es/hooks/useHMR.js +0 -20
- package/es/hooks/useStyleRegister.js +0 -216
- package/es/index.js +0 -44
- package/es/linters/NaNLinter.js +0 -7
- package/es/linters/contentQuotesLinter.js +0 -13
- package/es/linters/hashedAnimationLinter.js +0 -10
- package/es/linters/legacyNotSelectorLinter.js +0 -14
- package/es/linters/logicalPropertiesLinter.js +0 -61
- package/es/linters/parentSelectorLinter.js +0 -7
- package/es/linters/utils.js +0 -11
- package/es/theme/Theme.js +0 -21
- package/es/theme/ThemeCache.js +0 -74
- package/es/theme/calc/CSSCalculator.js +0 -40
- package/es/theme/calc/NumCalculator.js +0 -25
- package/es/theme/calc/calculator.js +0 -5
- package/es/theme/calc/index.js +0 -9
- package/es/theme/createTheme.js +0 -10
- package/es/transformers/legacyLogicalProperties.js +0 -108
- package/es/transformers/px2rem.js +0 -32
- package/es/util/cacheMapUtil.js +0 -48
- package/es/util/css-variables.js +0 -22
- package/es/util/index.js +0 -85
- package/lib/Cache.js +0 -1
- package/lib/Keyframes.js +0 -1
- package/lib/StyleContext.js +0 -1
- package/lib/extractStyle.js +0 -1
- package/lib/hooks/useCSSVarRegister.js +0 -1
- package/lib/hooks/useCacheToken.js +0 -1
- package/lib/hooks/useEffectCleanupRegister.js +0 -1
- package/lib/hooks/useGlobalCache.js +0 -1
- package/lib/hooks/useHMR.js +0 -1
- package/lib/hooks/useStyleRegister.js +0 -3
- package/lib/index.js +0 -1
- package/lib/linters/NaNLinter.js +0 -1
- package/lib/linters/contentQuotesLinter.js +0 -1
- package/lib/linters/hashedAnimationLinter.js +0 -1
- package/lib/linters/legacyNotSelectorLinter.js +0 -1
- package/lib/linters/logicalPropertiesLinter.js +0 -1
- package/lib/linters/parentSelectorLinter.js +0 -1
- package/lib/linters/utils.js +0 -1
- package/lib/theme/Theme.js +0 -1
- package/lib/theme/ThemeCache.js +0 -1
- package/lib/theme/calc/CSSCalculator.js +0 -1
- package/lib/theme/calc/NumCalculator.js +0 -1
- package/lib/theme/calc/calculator.js +0 -1
- package/lib/theme/calc/index.js +0 -1
- package/lib/theme/createTheme.js +0 -1
- package/lib/transformers/legacyLogicalProperties.js +0 -1
- package/lib/transformers/px2rem.js +0 -1
- package/lib/util/cacheMapUtil.js +0 -1
- package/lib/util/css-variables.js +0 -1
- package/lib/util/index.js +0 -1
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
import { updateCSS as h, removeCSS as C } from "@v-c/util/dist/Dom/dynamicCSS";
|
|
2
|
-
import { computed as t, unref as r } from "vue";
|
|
3
|
-
import { useStyleContext as _, ATTR_MARK as k, CSS_IN_JS_INSTANCE as x, ATTR_TOKEN as A } from "../StyleContext.js";
|
|
4
|
-
import { toStyleStr as I, isClientSide as R } from "../util/index.js";
|
|
5
|
-
import { transformToken as K } from "../util/css-variables.js";
|
|
6
|
-
import N from "./useGlobalCache.js";
|
|
7
|
-
import { uniqueHash as V } from "./useStyleRegister.js";
|
|
8
|
-
const E = "cssVar";
|
|
9
|
-
function O(e, y) {
|
|
10
|
-
const l = _(), n = t(() => r(e).path), o = t(() => r(e).key), i = t(() => r(e).prefix), p = t(() => r(e).unitless), a = t(() => r(e).ignore), c = t(() => r(e).scope), m = t(() => r(e).token), T = t(() => m.value._tokenKey), d = t(() => [...n.value, o.value, c.value, T.value]);
|
|
11
|
-
return N(
|
|
12
|
-
E,
|
|
13
|
-
d,
|
|
14
|
-
() => {
|
|
15
|
-
const s = r(y)(), [S, u] = K(s, o.value, {
|
|
16
|
-
prefix: i.value,
|
|
17
|
-
unitless: p.value,
|
|
18
|
-
ignore: a.value,
|
|
19
|
-
scope: c.value
|
|
20
|
-
}), v = V(d.value, u);
|
|
21
|
-
return [S, u, v, o.value];
|
|
22
|
-
},
|
|
23
|
-
([, , s]) => {
|
|
24
|
-
R && C(s, { mark: k });
|
|
25
|
-
},
|
|
26
|
-
([, s, S]) => {
|
|
27
|
-
if (!s)
|
|
28
|
-
return;
|
|
29
|
-
const { container: u, cache: { instanceId: v } } = l.value, f = h(s, S, {
|
|
30
|
-
mark: k,
|
|
31
|
-
prepend: "queue",
|
|
32
|
-
attachTo: u,
|
|
33
|
-
priority: -999
|
|
34
|
-
});
|
|
35
|
-
f[x] = v, f.setAttribute(A, o);
|
|
36
|
-
}
|
|
37
|
-
);
|
|
38
|
-
}
|
|
39
|
-
const Q = (e, y, l) => {
|
|
40
|
-
const [, n, o, i] = e, { plain: p } = l || {};
|
|
41
|
-
if (!n)
|
|
42
|
-
return null;
|
|
43
|
-
const a = -999, c = {
|
|
44
|
-
"data-vc-order": "prependQueue",
|
|
45
|
-
"data-vc-priority": `${a}`
|
|
46
|
-
}, m = I(
|
|
47
|
-
n,
|
|
48
|
-
i,
|
|
49
|
-
o,
|
|
50
|
-
c,
|
|
51
|
-
p
|
|
52
|
-
);
|
|
53
|
-
return [a, o, m];
|
|
54
|
-
};
|
|
55
|
-
export {
|
|
56
|
-
E as CSS_VAR_PREFIX,
|
|
57
|
-
O as default,
|
|
58
|
-
Q as extract
|
|
59
|
-
};
|
|
@@ -1,106 +0,0 @@
|
|
|
1
|
-
import _ from "@emotion/hash";
|
|
2
|
-
import { updateCSS as N } from "@v-c/util/dist/Dom/dynamicCSS";
|
|
3
|
-
import { ref as x, computed as u, unref as c } from "vue";
|
|
4
|
-
import { useStyleContext as A, ATTR_MARK as R, CSS_IN_JS_INSTANCE as K, ATTR_TOKEN as E } from "../StyleContext.js";
|
|
5
|
-
import { memoResult as O, flattenToken as p, token2key as g, toStyleStr as D } from "../util/index.js";
|
|
6
|
-
import { transformToken as V } from "../util/css-variables.js";
|
|
7
|
-
import $ from "./useGlobalCache.js";
|
|
8
|
-
const b = {}, L = process.env.NODE_ENV !== "production" ? "css-dev-only-do-not-override" : "css", i = /* @__PURE__ */ new Map();
|
|
9
|
-
function M(e) {
|
|
10
|
-
i.set(e, (i.get(e) || 0) + 1);
|
|
11
|
-
}
|
|
12
|
-
function P(e, l) {
|
|
13
|
-
typeof document < "u" && document.querySelectorAll(`style[${E}="${e}"]`).forEach((t) => {
|
|
14
|
-
t[K] === l && t.parentNode?.removeChild(t);
|
|
15
|
-
});
|
|
16
|
-
}
|
|
17
|
-
const q = 0;
|
|
18
|
-
function H(e, l) {
|
|
19
|
-
i.set(e, (i.get(e) || 0) - 1);
|
|
20
|
-
const n = Array.from(i.keys()), t = n.filter((s) => (i.get(s) || 0) <= 0);
|
|
21
|
-
n.length - t.length > q && t.forEach((s) => {
|
|
22
|
-
P(s, l), i.delete(s);
|
|
23
|
-
});
|
|
24
|
-
}
|
|
25
|
-
function j(e, l, n, t) {
|
|
26
|
-
let a = {
|
|
27
|
-
...n.getDerivativeToken(e),
|
|
28
|
-
...l
|
|
29
|
-
};
|
|
30
|
-
return t && (a = t(a)), a;
|
|
31
|
-
}
|
|
32
|
-
const w = "token";
|
|
33
|
-
function B(e, l, n = x({})) {
|
|
34
|
-
const t = A(), s = u(() => c(n).salt ?? ""), a = u(() => c(n).override ?? b), y = c(n).formatToken, d = c(n).getComputedToken, o = u(() => c(n).cssVar), f = u(() => O(() => Object.assign({}, ...c(l)), c(l))), T = u(() => p(f.value)), C = u(() => p(a.value)), I = u(() => o.value ? p(o.value) : "");
|
|
35
|
-
return $(
|
|
36
|
-
w,
|
|
37
|
-
u(() => [s.value, c(e).id, T.value, C.value, I.value]),
|
|
38
|
-
() => {
|
|
39
|
-
let r = d ? d(f.value, a.value, c(e)) : j(f.value, a.value, c(e), y);
|
|
40
|
-
const v = { ...r };
|
|
41
|
-
let m = "";
|
|
42
|
-
o.value && ([r, m] = V(
|
|
43
|
-
r,
|
|
44
|
-
o.value.key,
|
|
45
|
-
{
|
|
46
|
-
prefix: o.value.prefix,
|
|
47
|
-
ignore: o.value.ignore,
|
|
48
|
-
unitless: o.value.unitless,
|
|
49
|
-
preserve: o.value.preserve
|
|
50
|
-
}
|
|
51
|
-
));
|
|
52
|
-
const k = g(r, s.value);
|
|
53
|
-
r._tokenKey = k, v._tokenKey = g(v, s.value);
|
|
54
|
-
const h = o.value?.key ?? k;
|
|
55
|
-
r._themeKey = h, M(h);
|
|
56
|
-
const S = `${L}-${_(k)}`;
|
|
57
|
-
return r._hashId = S, [
|
|
58
|
-
r,
|
|
59
|
-
S,
|
|
60
|
-
v,
|
|
61
|
-
m,
|
|
62
|
-
o.value?.key || ""
|
|
63
|
-
];
|
|
64
|
-
},
|
|
65
|
-
(r) => {
|
|
66
|
-
H(r[0]._themeKey, t.value.cache.instanceId);
|
|
67
|
-
},
|
|
68
|
-
([r, , , v]) => {
|
|
69
|
-
if (o.value && v) {
|
|
70
|
-
const m = N(
|
|
71
|
-
v,
|
|
72
|
-
_(`css-variables-${r._themeKey}`),
|
|
73
|
-
{
|
|
74
|
-
mark: R,
|
|
75
|
-
prepend: "queue",
|
|
76
|
-
attachTo: t.value.container,
|
|
77
|
-
priority: -999
|
|
78
|
-
}
|
|
79
|
-
);
|
|
80
|
-
m[K] = t.value.cache.instanceId, m.setAttribute(E, r._themeKey);
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
);
|
|
84
|
-
}
|
|
85
|
-
const U = (e, l, n) => {
|
|
86
|
-
const [, , t, s, a] = e, { plain: y } = n || {};
|
|
87
|
-
if (!s)
|
|
88
|
-
return null;
|
|
89
|
-
const d = t._tokenKey, o = -999, f = {
|
|
90
|
-
"data-vc-order": "prependQueue",
|
|
91
|
-
"data-vc-priority": `${o}`
|
|
92
|
-
}, T = D(
|
|
93
|
-
s,
|
|
94
|
-
a,
|
|
95
|
-
d,
|
|
96
|
-
f,
|
|
97
|
-
y
|
|
98
|
-
);
|
|
99
|
-
return [o, d, T];
|
|
100
|
-
};
|
|
101
|
-
export {
|
|
102
|
-
w as TOKEN_PREFIX,
|
|
103
|
-
B as default,
|
|
104
|
-
U as extract,
|
|
105
|
-
j as getComputedToken
|
|
106
|
-
};
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
import { computed as i, unref as x, shallowRef as U, watch as y, onBeforeUnmount as _ } from "vue";
|
|
2
|
-
import { pathKey as w } from "../Cache.js";
|
|
3
|
-
import { useStyleContext as D } from "../StyleContext.js";
|
|
4
|
-
import H from "./useEffectCleanupRegister.js";
|
|
5
|
-
import M from "./useHMR.js";
|
|
6
|
-
function K(b, g, E, s, f) {
|
|
7
|
-
const l = D(), G = i(() => [x(b), ...x(g)]), c = i(() => w(G.value)), N = H(), v = [], h = M(), m = (u) => {
|
|
8
|
-
l.value.cache.opUpdate(c.value, (n) => {
|
|
9
|
-
const [o = 0, e] = n || [void 0, void 0];
|
|
10
|
-
let a = e;
|
|
11
|
-
process.env.NODE_ENV !== "production" && e && h && (s?.(a, h), a = null);
|
|
12
|
-
const d = a || E(), C = [o, d];
|
|
13
|
-
return u ? u(C) : C;
|
|
14
|
-
});
|
|
15
|
-
}, t = U();
|
|
16
|
-
t.value = l.value.cache.opGet(c.value), process.env.NODE_ENV !== "production" && !t.value && (m(), t.value = l.value.cache.opGet(c.value));
|
|
17
|
-
const r = i(() => t.value[1]);
|
|
18
|
-
return y(
|
|
19
|
-
c,
|
|
20
|
-
(u, p) => {
|
|
21
|
-
const n = l.value.cache;
|
|
22
|
-
f?.(r.value), m(([o, e]) => (o === 0 && f?.(r.value), [o + 1, e])), p && n.opUpdate(p, (o) => {
|
|
23
|
-
const [e = 0, a] = o || [];
|
|
24
|
-
return e - 1 === 0 ? (N(() => {
|
|
25
|
-
s?.(a, !1);
|
|
26
|
-
}), null) : [e - 1, a];
|
|
27
|
-
}), t.value = n.opGet(c.value), v.push(() => {
|
|
28
|
-
s?.(t.value[1], !1);
|
|
29
|
-
});
|
|
30
|
-
},
|
|
31
|
-
{
|
|
32
|
-
immediate: !0,
|
|
33
|
-
flush: "post"
|
|
34
|
-
}
|
|
35
|
-
), _(() => {
|
|
36
|
-
v.map((u) => u());
|
|
37
|
-
}), r;
|
|
38
|
-
}
|
|
39
|
-
export {
|
|
40
|
-
K as default
|
|
41
|
-
};
|
package/es/hooks/useHMR.js
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
function u() {
|
|
2
|
-
return !1;
|
|
3
|
-
}
|
|
4
|
-
let o = !1;
|
|
5
|
-
function d() {
|
|
6
|
-
return o;
|
|
7
|
-
}
|
|
8
|
-
const p = process.env.NODE_ENV === "production" ? u : d;
|
|
9
|
-
if (process.env.NODE_ENV !== "production" && typeof module < "u" && module && module.hot && typeof window < "u") {
|
|
10
|
-
const e = window;
|
|
11
|
-
if (typeof e.webpackHotUpdate == "function") {
|
|
12
|
-
const t = e.webpackHotUpdate;
|
|
13
|
-
e.webpackHotUpdate = (...n) => (o = !0, setTimeout(() => {
|
|
14
|
-
o = !1;
|
|
15
|
-
}, 0), t(...n));
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
export {
|
|
19
|
-
p as default
|
|
20
|
-
};
|
|
@@ -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.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/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
|
-
};
|
|
@@ -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.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.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
|
-
};
|