@antdv-next/cssinjs 0.0.3 → 1.0.0-alpha.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (212) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +0 -141
  3. package/dist/Cache.d.ts +22 -0
  4. package/dist/Cache.js +45 -0
  5. package/dist/Keyframes.d.ts +12 -0
  6. package/dist/Keyframes.js +17 -0
  7. package/dist/StyleContext.d.ts +119 -0
  8. package/dist/StyleContext.js +67 -0
  9. package/dist/cssinjs-utils/_util/hooks/useUniqueMemo.js +62 -0
  10. package/dist/cssinjs-utils/hooks/useCSP.d.ts +8 -0
  11. package/dist/cssinjs-utils/hooks/useCSP.js +8 -0
  12. package/dist/cssinjs-utils/hooks/usePrefix.d.ts +9 -0
  13. package/dist/cssinjs-utils/hooks/useToken.d.ts +25 -0
  14. package/dist/cssinjs-utils/index.d.ts +4 -0
  15. package/dist/cssinjs-utils/index.js +4 -0
  16. package/dist/cssinjs-utils/interface/components.d.ts +12 -0
  17. package/dist/cssinjs-utils/util/genStyleUtils.d.ts +127 -0
  18. package/dist/cssinjs-utils/util/genStyleUtils.js +188 -0
  19. package/dist/cssinjs-utils/util/getCompVarPrefix.js +8 -0
  20. package/dist/cssinjs-utils/util/getComponentToken.js +22 -0
  21. package/dist/cssinjs-utils/util/getDefaultComponentToken.js +11 -0
  22. package/dist/cssinjs-utils/util/maxmin.js +17 -0
  23. package/dist/cssinjs-utils/util/statistic.d.ts +15 -0
  24. package/dist/cssinjs-utils/util/statistic.js +52 -0
  25. package/dist/extractStyle.d.ts +18 -0
  26. package/dist/extractStyle.js +54 -0
  27. package/dist/hooks/useCSSVarRegister.d.ts +19 -0
  28. package/dist/hooks/useCSSVarRegister.js +86 -0
  29. package/dist/hooks/useCacheToken.d.ts +60 -0
  30. package/dist/hooks/useCacheToken.js +133 -0
  31. package/dist/hooks/useGlobalCache.d.ts +9 -0
  32. package/dist/hooks/useGlobalCache.js +68 -0
  33. package/dist/hooks/useStyleRegister.d.ts +47 -0
  34. package/dist/hooks/useStyleRegister.js +237 -0
  35. package/dist/index.d.ts +35 -0
  36. package/dist/index.js +30 -0
  37. package/dist/linters/NaNLinter.d.ts +6 -0
  38. package/dist/linters/NaNLinter.js +10 -0
  39. package/dist/linters/contentQuotesLinter.js +18 -0
  40. package/dist/linters/hashedAnimationLinter.js +12 -0
  41. package/dist/linters/index.d.ts +5 -0
  42. package/dist/linters/index.js +8 -0
  43. package/dist/linters/interface.d.ts +11 -0
  44. package/dist/linters/legacyNotSelectorLinter.d.ts +6 -0
  45. package/dist/linters/legacyNotSelectorLinter.js +20 -0
  46. package/dist/linters/logicalPropertiesLinter.d.ts +6 -0
  47. package/dist/linters/logicalPropertiesLinter.js +57 -0
  48. package/dist/linters/parentSelectorLinter.d.ts +7 -0
  49. package/dist/linters/parentSelectorLinter.js +12 -0
  50. package/dist/linters/utils.js +10 -0
  51. package/dist/ssr/styleCollector.d.ts +8 -0
  52. package/dist/ssr/styleCollector.js +11 -0
  53. package/dist/theme/Theme.d.ts +16 -0
  54. package/dist/theme/Theme.js +24 -0
  55. package/dist/theme/ThemeCache.js +79 -0
  56. package/dist/theme/calc/CSSCalculator.d.ts +19 -0
  57. package/dist/theme/calc/CSSCalculator.js +63 -0
  58. package/dist/theme/calc/NumCalculator.d.ts +14 -0
  59. package/dist/theme/calc/NumCalculator.js +37 -0
  60. package/dist/theme/calc/calculator.d.ts +32 -0
  61. package/dist/theme/calc/calculator.js +6 -0
  62. package/dist/theme/calc/index.d.ts +8 -0
  63. package/dist/theme/calc/index.js +12 -0
  64. package/dist/theme/createTheme.d.ts +11 -0
  65. package/dist/theme/createTheme.js +16 -0
  66. package/dist/theme/index.js +6 -0
  67. package/dist/theme/interface.d.ts +5 -0
  68. package/dist/transformers/autoPrefix.d.ts +6 -0
  69. package/dist/transformers/autoPrefix.js +7 -0
  70. package/dist/transformers/interface.d.ts +9 -0
  71. package/{es → dist}/transformers/legacyLogicalProperties.d.ts +6 -2
  72. package/dist/transformers/legacyLogicalProperties.js +123 -0
  73. package/dist/transformers/px2rem.d.ts +23 -0
  74. package/dist/transformers/px2rem.js +37 -0
  75. package/dist/util/cacheMapUtil.js +60 -0
  76. package/dist/util/css-variables.d.ts +7 -0
  77. package/dist/util/css-variables.js +35 -0
  78. package/dist/util/index.d.ts +8 -0
  79. package/dist/util/index.js +108 -0
  80. package/package.json +33 -64
  81. package/dist/cssinjs.umd.js +0 -3
  82. package/es/Cache.d.ts +0 -20
  83. package/es/Cache.js +0 -33
  84. package/es/Keyframes.d.ts +0 -9
  85. package/es/Keyframes.js +0 -14
  86. package/es/StyleContext.d.ts +0 -40
  87. package/es/StyleContext.js +0 -100
  88. package/es/extractStyle.d.ts +0 -12
  89. package/es/extractStyle.js +0 -43
  90. package/es/hooks/useCSSVarRegister.d.ts +0 -21
  91. package/es/hooks/useCSSVarRegister.js +0 -59
  92. package/es/hooks/useCacheToken.d.ts +0 -69
  93. package/es/hooks/useCacheToken.js +0 -106
  94. package/es/hooks/useEffectCleanupRegister.d.ts +0 -2
  95. package/es/hooks/useEffectCleanupRegister.js +0 -8
  96. package/es/hooks/useGlobalCache.d.ts +0 -7
  97. package/es/hooks/useGlobalCache.js +0 -41
  98. package/es/hooks/useHMR.d.ts +0 -3
  99. package/es/hooks/useHMR.js +0 -20
  100. package/es/hooks/useStyleRegister.d.ts +0 -81
  101. package/es/hooks/useStyleRegister.js +0 -216
  102. package/es/index.d.ts +0 -18
  103. package/es/index.js +0 -44
  104. package/es/interface.d.ts +0 -2
  105. package/es/linters/NaNLinter.d.ts +0 -3
  106. package/es/linters/NaNLinter.js +0 -7
  107. package/es/linters/contentQuotesLinter.d.ts +0 -3
  108. package/es/linters/contentQuotesLinter.js +0 -13
  109. package/es/linters/hashedAnimationLinter.d.ts +0 -3
  110. package/es/linters/hashedAnimationLinter.js +0 -10
  111. package/es/linters/index.d.ts +0 -7
  112. package/es/linters/interface.d.ts +0 -8
  113. package/es/linters/legacyNotSelectorLinter.d.ts +0 -3
  114. package/es/linters/legacyNotSelectorLinter.js +0 -14
  115. package/es/linters/logicalPropertiesLinter.d.ts +0 -3
  116. package/es/linters/logicalPropertiesLinter.js +0 -61
  117. package/es/linters/parentSelectorLinter.d.ts +0 -3
  118. package/es/linters/parentSelectorLinter.js +0 -7
  119. package/es/linters/utils.d.ts +0 -2
  120. package/es/linters/utils.js +0 -11
  121. package/es/theme/Theme.d.ts +0 -11
  122. package/es/theme/Theme.js +0 -21
  123. package/es/theme/ThemeCache.d.ts +0 -20
  124. package/es/theme/ThemeCache.js +0 -74
  125. package/es/theme/calc/CSSCalculator.d.ts +0 -15
  126. package/es/theme/calc/CSSCalculator.js +0 -40
  127. package/es/theme/calc/NumCalculator.d.ts +0 -10
  128. package/es/theme/calc/NumCalculator.js +0 -25
  129. package/es/theme/calc/calculator.d.ts +0 -30
  130. package/es/theme/calc/calculator.js +0 -5
  131. package/es/theme/calc/index.d.ts +0 -5
  132. package/es/theme/calc/index.js +0 -9
  133. package/es/theme/createTheme.d.ts +0 -6
  134. package/es/theme/createTheme.js +0 -10
  135. package/es/theme/index.d.ts +0 -6
  136. package/es/theme/interface.d.ts +0 -2
  137. package/es/transformers/interface.d.ts +0 -4
  138. package/es/transformers/legacyLogicalProperties.js +0 -108
  139. package/es/transformers/px2rem.d.ts +0 -20
  140. package/es/transformers/px2rem.js +0 -32
  141. package/es/util/cacheMapUtil.d.ts +0 -14
  142. package/es/util/cacheMapUtil.js +0 -48
  143. package/es/util/css-variables.d.ts +0 -20
  144. package/es/util/css-variables.js +0 -22
  145. package/es/util/index.d.ts +0 -15
  146. package/es/util/index.js +0 -85
  147. package/lib/Cache.d.ts +0 -20
  148. package/lib/Cache.js +0 -1
  149. package/lib/Keyframes.d.ts +0 -9
  150. package/lib/Keyframes.js +0 -1
  151. package/lib/StyleContext.d.ts +0 -40
  152. package/lib/StyleContext.js +0 -1
  153. package/lib/extractStyle.d.ts +0 -12
  154. package/lib/extractStyle.js +0 -1
  155. package/lib/hooks/useCSSVarRegister.d.ts +0 -21
  156. package/lib/hooks/useCSSVarRegister.js +0 -1
  157. package/lib/hooks/useCacheToken.d.ts +0 -69
  158. package/lib/hooks/useCacheToken.js +0 -1
  159. package/lib/hooks/useEffectCleanupRegister.d.ts +0 -2
  160. package/lib/hooks/useEffectCleanupRegister.js +0 -1
  161. package/lib/hooks/useGlobalCache.d.ts +0 -7
  162. package/lib/hooks/useGlobalCache.js +0 -1
  163. package/lib/hooks/useHMR.d.ts +0 -3
  164. package/lib/hooks/useHMR.js +0 -1
  165. package/lib/hooks/useStyleRegister.d.ts +0 -81
  166. package/lib/hooks/useStyleRegister.js +0 -3
  167. package/lib/index.d.ts +0 -18
  168. package/lib/index.js +0 -1
  169. package/lib/interface.d.ts +0 -2
  170. package/lib/linters/NaNLinter.d.ts +0 -3
  171. package/lib/linters/NaNLinter.js +0 -1
  172. package/lib/linters/contentQuotesLinter.d.ts +0 -3
  173. package/lib/linters/contentQuotesLinter.js +0 -1
  174. package/lib/linters/hashedAnimationLinter.d.ts +0 -3
  175. package/lib/linters/hashedAnimationLinter.js +0 -1
  176. package/lib/linters/index.d.ts +0 -7
  177. package/lib/linters/interface.d.ts +0 -8
  178. package/lib/linters/legacyNotSelectorLinter.d.ts +0 -3
  179. package/lib/linters/legacyNotSelectorLinter.js +0 -1
  180. package/lib/linters/logicalPropertiesLinter.d.ts +0 -3
  181. package/lib/linters/logicalPropertiesLinter.js +0 -1
  182. package/lib/linters/parentSelectorLinter.d.ts +0 -3
  183. package/lib/linters/parentSelectorLinter.js +0 -1
  184. package/lib/linters/utils.d.ts +0 -2
  185. package/lib/linters/utils.js +0 -1
  186. package/lib/theme/Theme.d.ts +0 -11
  187. package/lib/theme/Theme.js +0 -1
  188. package/lib/theme/ThemeCache.d.ts +0 -20
  189. package/lib/theme/ThemeCache.js +0 -1
  190. package/lib/theme/calc/CSSCalculator.d.ts +0 -15
  191. package/lib/theme/calc/CSSCalculator.js +0 -1
  192. package/lib/theme/calc/NumCalculator.d.ts +0 -10
  193. package/lib/theme/calc/NumCalculator.js +0 -1
  194. package/lib/theme/calc/calculator.d.ts +0 -30
  195. package/lib/theme/calc/calculator.js +0 -1
  196. package/lib/theme/calc/index.d.ts +0 -5
  197. package/lib/theme/calc/index.js +0 -1
  198. package/lib/theme/createTheme.d.ts +0 -6
  199. package/lib/theme/createTheme.js +0 -1
  200. package/lib/theme/index.d.ts +0 -6
  201. package/lib/theme/interface.d.ts +0 -2
  202. package/lib/transformers/interface.d.ts +0 -4
  203. package/lib/transformers/legacyLogicalProperties.d.ts +0 -12
  204. package/lib/transformers/legacyLogicalProperties.js +0 -1
  205. package/lib/transformers/px2rem.d.ts +0 -20
  206. package/lib/transformers/px2rem.js +0 -1
  207. package/lib/util/cacheMapUtil.d.ts +0 -14
  208. package/lib/util/cacheMapUtil.js +0 -1
  209. package/lib/util/css-variables.d.ts +0 -20
  210. package/lib/util/css-variables.js +0 -1
  211. package/lib/util/index.d.ts +0 -15
  212. package/lib/util/index.js +0 -1
@@ -1,81 +0,0 @@
1
- import { VueNode } from '@v-c/util/dist/type';
2
- import { MaybeRef } from 'vue';
3
- import { Theme, Transformer } from '..';
4
- import { default as Keyframes } from '../Keyframes';
5
- import { Linter } from '../linters';
6
- import { HashPriority } from '../StyleContext';
7
- import { ExtractStyle } from './useGlobalCache';
8
- import type * as CSS from 'csstype';
9
- declare const SKIP_CHECK = "_skip_check_";
10
- declare const MULTI_VALUE = "_multi_value_";
11
- export interface LayerConfig {
12
- name: string;
13
- dependencies?: string[];
14
- }
15
- export type CSSProperties = Omit<CSS.PropertiesFallback<number | string>, 'animationName'> & {
16
- animationName?: CSS.PropertiesFallback<number | string>['animationName'] | Keyframes;
17
- };
18
- export type CSSPropertiesWithMultiValues = {
19
- [K in keyof CSSProperties]: CSSProperties[K] | readonly Extract<CSSProperties[K], string>[] | {
20
- [SKIP_CHECK]?: boolean;
21
- [MULTI_VALUE]?: boolean;
22
- value: CSSProperties[K] | CSSProperties[K][];
23
- };
24
- };
25
- export type CSSPseudos = {
26
- [K in CSS.Pseudos]?: CSSObject;
27
- };
28
- type ArrayCSSInterpolation = readonly CSSInterpolation[];
29
- export type InterpolationPrimitive = null | undefined | boolean | number | string | CSSObject;
30
- export type CSSInterpolation = InterpolationPrimitive | ArrayCSSInterpolation | Keyframes;
31
- export type CSSOthersObject = Record<string, CSSInterpolation>;
32
- export interface CSSObject extends CSSPropertiesWithMultiValues, CSSPseudos, CSSOthersObject {
33
- }
34
- export declare function normalizeStyle(styleStr: string): string;
35
- export interface ParseConfig {
36
- hashId?: string;
37
- hashPriority?: HashPriority;
38
- layer?: LayerConfig;
39
- path?: string;
40
- transformers?: Transformer[];
41
- linters?: Linter[];
42
- }
43
- export interface ParseInfo {
44
- root?: boolean;
45
- injectHash?: boolean;
46
- parentSelectors: string[];
47
- }
48
- export declare function parseStyle(interpolation: CSSInterpolation, config?: ParseConfig, { root, injectHash, parentSelectors }?: ParseInfo): [
49
- parsedStr: string,
50
- effectStyle: Record<string, string>
51
- ];
52
- export declare function uniqueHash(path: (string | number)[], styleStr: string): string;
53
- export declare const STYLE_PREFIX = "style";
54
- type StyleCacheValue = [
55
- styleStr: string,
56
- tokenKey: string,
57
- styleId: string,
58
- effectStyle: Record<string, string>,
59
- clientOnly: boolean | undefined,
60
- order: number
61
- ];
62
- /**
63
- * Register a style to the global style sheet.
64
- */
65
- export default function useStyleRegister(info: MaybeRef<{
66
- theme: Theme<any, any>;
67
- token: any;
68
- path: string[];
69
- hashId?: string;
70
- layer?: LayerConfig;
71
- nonce?: string | (() => string);
72
- clientOnly?: boolean;
73
- /**
74
- * Tell cssinjs the insert order of style.
75
- * It's useful when you need to insert style
76
- * before other style to overwrite for the same selector priority.
77
- */
78
- order?: number;
79
- }>, styleFn: MaybeRef<() => CSSInterpolation>): (node: VueNode) => any;
80
- export declare const extract: ExtractStyle<StyleCacheValue>;
81
- export {};
@@ -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
@@ -1,2 +0,0 @@
1
- import { MaybeRef } from 'vue';
2
- export type { MaybeRef, };
@@ -1,3 +0,0 @@
1
- import { Linter } from './interface';
2
- declare const linter: Linter;
3
- export default linter;
@@ -1,7 +0,0 @@
1
- import { lintWarning as n } from "./utils.js";
2
- const N = (r, t, i) => {
3
- (typeof t == "string" && /NaN/.test(t) || Number.isNaN(t)) && n(`Unexpected 'NaN' in property '${r}: ${t}'.`, i);
4
- };
5
- export {
6
- N as default
7
- };
@@ -1,3 +0,0 @@
1
- import { Linter } from './interface';
2
- declare const linter: Linter;
3
- export default linter;
@@ -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,3 +0,0 @@
1
- import { Linter } from './interface';
2
- declare const linter: Linter;
3
- export default linter;
@@ -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,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,8 +0,0 @@
1
- export interface LinterInfo {
2
- path?: string;
3
- hashId?: string;
4
- parentSelectors: string[];
5
- }
6
- export interface Linter {
7
- (key: string, value: string | number, info: LinterInfo): void;
8
- }
@@ -1,3 +0,0 @@
1
- import { Linter } from './interface';
2
- declare const linter: Linter;
3
- export default linter;
@@ -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,3 +0,0 @@
1
- import { Linter } from './interface';
2
- declare const linter: Linter;
3
- export default linter;
@@ -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
- };
@@ -1,3 +0,0 @@
1
- import { Linter } from './interface';
2
- declare const linter: Linter;
3
- export default linter;
@@ -1,7 +0,0 @@
1
- import { lintWarning as s } from "./utils.js";
2
- const i = (r, l, e) => {
3
- e.parentSelectors.some((t) => t.split(",").some((o) => o.split("&").length > 2)) && s("Should not use more than one `&` in a selector.", e);
4
- };
5
- export {
6
- i as default
7
- };
@@ -1,2 +0,0 @@
1
- import { LinterInfo } from './interface';
2
- export declare function lintWarning(message: string, info: LinterInfo): void;
@@ -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
- };
@@ -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
- };
@@ -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 {};