@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.
Files changed (210) 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 +118 -0
  8. package/dist/StyleContext.js +64 -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 +74 -0
  29. package/dist/hooks/useCacheToken.d.ts +60 -0
  30. package/dist/hooks/useCacheToken.js +120 -0
  31. package/dist/hooks/useGlobalCache.d.ts +9 -0
  32. package/dist/hooks/useGlobalCache.js +70 -0
  33. package/dist/hooks/useStyleRegister.d.ts +47 -0
  34. package/dist/hooks/useStyleRegister.js +237 -0
  35. package/dist/index.d.ts +34 -0
  36. package/dist/index.js +29 -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/theme/Theme.d.ts +16 -0
  52. package/dist/theme/Theme.js +24 -0
  53. package/dist/theme/ThemeCache.js +79 -0
  54. package/dist/theme/calc/CSSCalculator.d.ts +19 -0
  55. package/dist/theme/calc/CSSCalculator.js +63 -0
  56. package/dist/theme/calc/NumCalculator.d.ts +14 -0
  57. package/dist/theme/calc/NumCalculator.js +37 -0
  58. package/dist/theme/calc/calculator.d.ts +32 -0
  59. package/dist/theme/calc/calculator.js +6 -0
  60. package/dist/theme/calc/index.d.ts +8 -0
  61. package/dist/theme/calc/index.js +12 -0
  62. package/dist/theme/createTheme.d.ts +11 -0
  63. package/dist/theme/createTheme.js +16 -0
  64. package/dist/theme/index.js +6 -0
  65. package/dist/theme/interface.d.ts +5 -0
  66. package/dist/transformers/autoPrefix.d.ts +6 -0
  67. package/dist/transformers/autoPrefix.js +7 -0
  68. package/dist/transformers/interface.d.ts +9 -0
  69. package/{es → dist}/transformers/legacyLogicalProperties.d.ts +6 -2
  70. package/dist/transformers/legacyLogicalProperties.js +123 -0
  71. package/dist/transformers/px2rem.d.ts +23 -0
  72. package/dist/transformers/px2rem.js +37 -0
  73. package/dist/util/cacheMapUtil.js +60 -0
  74. package/dist/util/css-variables.d.ts +7 -0
  75. package/dist/util/css-variables.js +35 -0
  76. package/dist/util/index.d.ts +8 -0
  77. package/dist/util/index.js +108 -0
  78. package/package.json +33 -64
  79. package/dist/cssinjs.umd.js +0 -3
  80. package/es/Cache.d.ts +0 -20
  81. package/es/Cache.js +0 -33
  82. package/es/Keyframes.d.ts +0 -9
  83. package/es/Keyframes.js +0 -14
  84. package/es/StyleContext.d.ts +0 -40
  85. package/es/StyleContext.js +0 -100
  86. package/es/extractStyle.d.ts +0 -12
  87. package/es/extractStyle.js +0 -43
  88. package/es/hooks/useCSSVarRegister.d.ts +0 -21
  89. package/es/hooks/useCSSVarRegister.js +0 -59
  90. package/es/hooks/useCacheToken.d.ts +0 -69
  91. package/es/hooks/useCacheToken.js +0 -106
  92. package/es/hooks/useEffectCleanupRegister.d.ts +0 -2
  93. package/es/hooks/useEffectCleanupRegister.js +0 -8
  94. package/es/hooks/useGlobalCache.d.ts +0 -7
  95. package/es/hooks/useGlobalCache.js +0 -41
  96. package/es/hooks/useHMR.d.ts +0 -3
  97. package/es/hooks/useHMR.js +0 -20
  98. package/es/hooks/useStyleRegister.d.ts +0 -81
  99. package/es/hooks/useStyleRegister.js +0 -216
  100. package/es/index.d.ts +0 -18
  101. package/es/index.js +0 -44
  102. package/es/interface.d.ts +0 -2
  103. package/es/linters/NaNLinter.d.ts +0 -3
  104. package/es/linters/NaNLinter.js +0 -7
  105. package/es/linters/contentQuotesLinter.d.ts +0 -3
  106. package/es/linters/contentQuotesLinter.js +0 -13
  107. package/es/linters/hashedAnimationLinter.d.ts +0 -3
  108. package/es/linters/hashedAnimationLinter.js +0 -10
  109. package/es/linters/index.d.ts +0 -7
  110. package/es/linters/interface.d.ts +0 -8
  111. package/es/linters/legacyNotSelectorLinter.d.ts +0 -3
  112. package/es/linters/legacyNotSelectorLinter.js +0 -14
  113. package/es/linters/logicalPropertiesLinter.d.ts +0 -3
  114. package/es/linters/logicalPropertiesLinter.js +0 -61
  115. package/es/linters/parentSelectorLinter.d.ts +0 -3
  116. package/es/linters/parentSelectorLinter.js +0 -7
  117. package/es/linters/utils.d.ts +0 -2
  118. package/es/linters/utils.js +0 -11
  119. package/es/theme/Theme.d.ts +0 -11
  120. package/es/theme/Theme.js +0 -21
  121. package/es/theme/ThemeCache.d.ts +0 -20
  122. package/es/theme/ThemeCache.js +0 -74
  123. package/es/theme/calc/CSSCalculator.d.ts +0 -15
  124. package/es/theme/calc/CSSCalculator.js +0 -40
  125. package/es/theme/calc/NumCalculator.d.ts +0 -10
  126. package/es/theme/calc/NumCalculator.js +0 -25
  127. package/es/theme/calc/calculator.d.ts +0 -30
  128. package/es/theme/calc/calculator.js +0 -5
  129. package/es/theme/calc/index.d.ts +0 -5
  130. package/es/theme/calc/index.js +0 -9
  131. package/es/theme/createTheme.d.ts +0 -6
  132. package/es/theme/createTheme.js +0 -10
  133. package/es/theme/index.d.ts +0 -6
  134. package/es/theme/interface.d.ts +0 -2
  135. package/es/transformers/interface.d.ts +0 -4
  136. package/es/transformers/legacyLogicalProperties.js +0 -108
  137. package/es/transformers/px2rem.d.ts +0 -20
  138. package/es/transformers/px2rem.js +0 -32
  139. package/es/util/cacheMapUtil.d.ts +0 -14
  140. package/es/util/cacheMapUtil.js +0 -48
  141. package/es/util/css-variables.d.ts +0 -20
  142. package/es/util/css-variables.js +0 -22
  143. package/es/util/index.d.ts +0 -15
  144. package/es/util/index.js +0 -85
  145. package/lib/Cache.d.ts +0 -20
  146. package/lib/Cache.js +0 -1
  147. package/lib/Keyframes.d.ts +0 -9
  148. package/lib/Keyframes.js +0 -1
  149. package/lib/StyleContext.d.ts +0 -40
  150. package/lib/StyleContext.js +0 -1
  151. package/lib/extractStyle.d.ts +0 -12
  152. package/lib/extractStyle.js +0 -1
  153. package/lib/hooks/useCSSVarRegister.d.ts +0 -21
  154. package/lib/hooks/useCSSVarRegister.js +0 -1
  155. package/lib/hooks/useCacheToken.d.ts +0 -69
  156. package/lib/hooks/useCacheToken.js +0 -1
  157. package/lib/hooks/useEffectCleanupRegister.d.ts +0 -2
  158. package/lib/hooks/useEffectCleanupRegister.js +0 -1
  159. package/lib/hooks/useGlobalCache.d.ts +0 -7
  160. package/lib/hooks/useGlobalCache.js +0 -1
  161. package/lib/hooks/useHMR.d.ts +0 -3
  162. package/lib/hooks/useHMR.js +0 -1
  163. package/lib/hooks/useStyleRegister.d.ts +0 -81
  164. package/lib/hooks/useStyleRegister.js +0 -3
  165. package/lib/index.d.ts +0 -18
  166. package/lib/index.js +0 -1
  167. package/lib/interface.d.ts +0 -2
  168. package/lib/linters/NaNLinter.d.ts +0 -3
  169. package/lib/linters/NaNLinter.js +0 -1
  170. package/lib/linters/contentQuotesLinter.d.ts +0 -3
  171. package/lib/linters/contentQuotesLinter.js +0 -1
  172. package/lib/linters/hashedAnimationLinter.d.ts +0 -3
  173. package/lib/linters/hashedAnimationLinter.js +0 -1
  174. package/lib/linters/index.d.ts +0 -7
  175. package/lib/linters/interface.d.ts +0 -8
  176. package/lib/linters/legacyNotSelectorLinter.d.ts +0 -3
  177. package/lib/linters/legacyNotSelectorLinter.js +0 -1
  178. package/lib/linters/logicalPropertiesLinter.d.ts +0 -3
  179. package/lib/linters/logicalPropertiesLinter.js +0 -1
  180. package/lib/linters/parentSelectorLinter.d.ts +0 -3
  181. package/lib/linters/parentSelectorLinter.js +0 -1
  182. package/lib/linters/utils.d.ts +0 -2
  183. package/lib/linters/utils.js +0 -1
  184. package/lib/theme/Theme.d.ts +0 -11
  185. package/lib/theme/Theme.js +0 -1
  186. package/lib/theme/ThemeCache.d.ts +0 -20
  187. package/lib/theme/ThemeCache.js +0 -1
  188. package/lib/theme/calc/CSSCalculator.d.ts +0 -15
  189. package/lib/theme/calc/CSSCalculator.js +0 -1
  190. package/lib/theme/calc/NumCalculator.d.ts +0 -10
  191. package/lib/theme/calc/NumCalculator.js +0 -1
  192. package/lib/theme/calc/calculator.d.ts +0 -30
  193. package/lib/theme/calc/calculator.js +0 -1
  194. package/lib/theme/calc/index.d.ts +0 -5
  195. package/lib/theme/calc/index.js +0 -1
  196. package/lib/theme/createTheme.d.ts +0 -6
  197. package/lib/theme/createTheme.js +0 -1
  198. package/lib/theme/index.d.ts +0 -6
  199. package/lib/theme/interface.d.ts +0 -2
  200. package/lib/transformers/interface.d.ts +0 -4
  201. package/lib/transformers/legacyLogicalProperties.d.ts +0 -12
  202. package/lib/transformers/legacyLogicalProperties.js +0 -1
  203. package/lib/transformers/px2rem.d.ts +0 -20
  204. package/lib/transformers/px2rem.js +0 -1
  205. package/lib/util/cacheMapUtil.d.ts +0 -14
  206. package/lib/util/cacheMapUtil.js +0 -1
  207. package/lib/util/css-variables.d.ts +0 -20
  208. package/lib/util/css-variables.js +0 -1
  209. package/lib/util/index.d.ts +0 -15
  210. package/lib/util/index.js +0 -1
@@ -0,0 +1,37 @@
1
+ import unitless from "@emotion/unitless";
2
+
3
+ //#region src/transformers/px2rem.ts
4
+ const pxRegex = /url\([^)]+\)|var\([^)]+\)|(\d+(?:\.\d+)?|\.\d+)px/g;
5
+ function toFixed(number, precision) {
6
+ const multiplier = 10 ** (precision + 1);
7
+ const wholeNumber = Math.floor(number * multiplier);
8
+ return Math.round(wholeNumber / 10) * 10 / multiplier;
9
+ }
10
+ function transform(options = {}) {
11
+ const { rootValue = 16, precision = 5, mediaQuery = false } = options;
12
+ const pxReplace = (m, $1) => {
13
+ if (!$1) return m;
14
+ const pixels = Number.parseFloat($1);
15
+ if (pixels <= 1) return m;
16
+ return `${toFixed(pixels / rootValue, precision)}rem`;
17
+ };
18
+ const visit = (cssObj) => {
19
+ const clone = { ...cssObj };
20
+ Object.entries(cssObj).forEach(([key, value]) => {
21
+ if (typeof value === "string" && value.includes("px")) clone[key] = value.replace(pxRegex, pxReplace);
22
+ if (!unitless[key] && typeof value === "number" && value !== 0) clone[key] = `${value}px`.replace(pxRegex, pxReplace);
23
+ const mergedKey = key.trim();
24
+ if (mergedKey.startsWith("@") && mergedKey.includes("px") && mediaQuery) {
25
+ const newKey = key.replace(pxRegex, pxReplace);
26
+ clone[newKey] = clone[key];
27
+ delete clone[key];
28
+ }
29
+ });
30
+ return clone;
31
+ };
32
+ return { visit };
33
+ }
34
+ var px2rem_default = transform;
35
+
36
+ //#endregion
37
+ export { px2rem_default as default };
@@ -0,0 +1,60 @@
1
+ import { ATTR_MARK } from "../StyleContext.js";
2
+ import canUseDom from "@v-c/util/dist/Dom/canUseDom";
3
+
4
+ //#region src/util/cacheMapUtil.ts
5
+ const ATTR_CACHE_MAP = "data-ant-cssinjs-cache-path";
6
+ /**
7
+ * This marks style from the css file.
8
+ * Which means not exist in `<style />` tag.
9
+ */
10
+ const CSS_FILE_STYLE = "_FILE_STYLE__";
11
+ function serialize(cachePathMap$1) {
12
+ return Object.keys(cachePathMap$1).map((path) => {
13
+ return `${path}:${cachePathMap$1[path]}`;
14
+ }).join(";");
15
+ }
16
+ let cachePathMap;
17
+ let fromCSSFile = true;
18
+ function prepare() {
19
+ if (!cachePathMap) {
20
+ cachePathMap = {};
21
+ if (canUseDom()) {
22
+ const div = document.createElement("div");
23
+ div.className = ATTR_CACHE_MAP;
24
+ div.style.position = "fixed";
25
+ div.style.visibility = "hidden";
26
+ div.style.top = "-9999px";
27
+ document.body.appendChild(div);
28
+ let content = getComputedStyle(div).content || "";
29
+ content = content.replace(/^"/, "").replace(/"$/, "");
30
+ content.split(";").forEach((item) => {
31
+ const [path, hash] = item.split(":");
32
+ cachePathMap[path] = hash;
33
+ });
34
+ const inlineMapStyle = document.querySelector(`style[${ATTR_CACHE_MAP}]`);
35
+ if (inlineMapStyle) {
36
+ fromCSSFile = false;
37
+ inlineMapStyle.parentNode?.removeChild(inlineMapStyle);
38
+ }
39
+ document.body.removeChild(div);
40
+ }
41
+ }
42
+ }
43
+ function existPath(path) {
44
+ prepare();
45
+ return !!cachePathMap[path];
46
+ }
47
+ function getStyleAndHash(path) {
48
+ const hash = cachePathMap[path];
49
+ let styleStr = null;
50
+ if (hash && canUseDom()) if (fromCSSFile) styleStr = CSS_FILE_STYLE;
51
+ else {
52
+ const style = document.querySelector(`style[${ATTR_MARK}="${cachePathMap[path]}"]`);
53
+ if (style) styleStr = style.innerHTML;
54
+ else delete cachePathMap[path];
55
+ }
56
+ return [styleStr, hash];
57
+ }
58
+
59
+ //#endregion
60
+ export { ATTR_CACHE_MAP, CSS_FILE_STYLE, existPath, getStyleAndHash, serialize };
@@ -0,0 +1,7 @@
1
+ import "../StyleContext.js";
2
+
3
+ //#region src/util/css-variables.d.ts
4
+ declare function token2CSSVar(token: string, prefix?: string): string;
5
+ type TokenWithCSSVar<V, T extends Record<string, V> = Record<string, V>> = { [key in keyof T]?: string | V };
6
+ //#endregion
7
+ export { TokenWithCSSVar, token2CSSVar };
@@ -0,0 +1,35 @@
1
+ import { where } from "./index.js";
2
+
3
+ //#region src/util/css-variables.ts
4
+ function token2CSSVar(token, prefix = "") {
5
+ return `--${prefix ? `${prefix}-` : ""}${token}`.replace(/([a-z0-9])([A-Z])/g, "$1-$2").replace(/([A-Z]+)([A-Z][a-z0-9]+)/g, "$1-$2").replace(/([a-z])([A-Z0-9])/g, "$1-$2").toLowerCase();
6
+ }
7
+ function serializeCSSVar(cssVars, hashId, options) {
8
+ const { hashCls, hashPriority = "low" } = options || {};
9
+ if (!Object.keys(cssVars).length) return "";
10
+ return `${where({
11
+ hashCls,
12
+ hashPriority
13
+ })}.${hashId}${options?.scope ? `.${options.scope}` : ""}{${Object.entries(cssVars).map(([key, value]) => `${key}:${value};`).join("")}}`;
14
+ }
15
+ function transformToken(token, themeKey, config) {
16
+ const { hashCls, hashPriority = "low", prefix, unitless, ignore, preserve } = config || {};
17
+ const cssVars = {};
18
+ const result = {};
19
+ Object.entries(token).forEach(([key, value]) => {
20
+ if (preserve?.[key]) result[key] = value;
21
+ else if ((typeof value === "string" || typeof value === "number") && !ignore?.[key]) {
22
+ const cssVar = token2CSSVar(key, prefix);
23
+ cssVars[cssVar] = typeof value === "number" && !unitless?.[key] ? `${value}px` : String(value);
24
+ result[key] = `var(${cssVar})`;
25
+ }
26
+ });
27
+ return [result, serializeCSSVar(cssVars, themeKey, {
28
+ scope: config?.scope,
29
+ hashCls,
30
+ hashPriority
31
+ })];
32
+ }
33
+
34
+ //#endregion
35
+ export { token2CSSVar, transformToken };
@@ -0,0 +1,8 @@
1
+ import "../StyleContext.js";
2
+ import { token2CSSVar } from "./css-variables.js";
3
+
4
+ //#region src/util/index.d.ts
5
+
6
+ declare function unit(num: string | number): string;
7
+ //#endregion
8
+ export { unit };
@@ -0,0 +1,108 @@
1
+ import { ATTR_MARK, ATTR_TOKEN } from "../StyleContext.js";
2
+ import Theme from "../theme/Theme.js";
3
+ import "../theme/index.js";
4
+ import { token2CSSVar } from "./css-variables.js";
5
+ import hash from "@emotion/hash";
6
+ import { removeCSS, updateCSS } from "@v-c/util/dist/Dom/dynamicCSS";
7
+ import canUseDom from "@v-c/util/dist/Dom/canUseDom";
8
+
9
+ //#region src/util/index.ts
10
+ const resultCache = /* @__PURE__ */ new WeakMap();
11
+ const RESULT_VALUE = {};
12
+ function memoResult(callback, deps) {
13
+ let current = resultCache;
14
+ for (let i = 0; i < deps.length; i += 1) {
15
+ const dep = deps[i];
16
+ if (!current.has(dep)) current.set(dep, /* @__PURE__ */ new WeakMap());
17
+ current = current.get(dep);
18
+ }
19
+ if (!current.has(RESULT_VALUE)) current.set(RESULT_VALUE, callback());
20
+ return current.get(RESULT_VALUE);
21
+ }
22
+ const flattenTokenCache = /* @__PURE__ */ new WeakMap();
23
+ /**
24
+ * Flatten token to string, this will auto cache the result when token not change
25
+ */
26
+ function flattenToken(token) {
27
+ let str = flattenTokenCache.get(token) || "";
28
+ if (!str) {
29
+ Object.keys(token).forEach((key) => {
30
+ const value = token[key];
31
+ str += key;
32
+ if (value instanceof Theme) str += value.id;
33
+ else if (value && typeof value === "object") str += flattenToken(value);
34
+ else str += value;
35
+ });
36
+ str = hash(str);
37
+ flattenTokenCache.set(token, str);
38
+ }
39
+ return str;
40
+ }
41
+ /**
42
+ * Convert derivative token to key string
43
+ */
44
+ function token2key(token, salt) {
45
+ return hash(`${salt}_${flattenToken(token)}`);
46
+ }
47
+ const randomSelectorKey = `random-${Date.now()}-${Math.random()}`.replace(/\./g, "");
48
+ const checkContent = "_bAmBoO_";
49
+ function supportSelector(styleStr, handleElement, supportCheck) {
50
+ if (canUseDom()) {
51
+ updateCSS(styleStr, randomSelectorKey);
52
+ const ele = document.createElement("div");
53
+ ele.style.position = "fixed";
54
+ ele.style.left = "0";
55
+ ele.style.top = "0";
56
+ handleElement?.(ele);
57
+ document.body.appendChild(ele);
58
+ if (process.env.NODE_ENV !== "production") {
59
+ ele.innerHTML = "Test";
60
+ ele.style.zIndex = "9999999";
61
+ }
62
+ const support = supportCheck ? supportCheck(ele) : getComputedStyle(ele).content?.includes(checkContent);
63
+ ele.parentNode?.removeChild(ele);
64
+ removeCSS(randomSelectorKey);
65
+ return support;
66
+ }
67
+ return false;
68
+ }
69
+ let canWhere;
70
+ function supportWhere() {
71
+ if (canWhere === void 0) canWhere = supportSelector(`:where(.${randomSelectorKey}) { content: "${checkContent}"!important; }`, (ele) => {
72
+ ele.className = randomSelectorKey;
73
+ });
74
+ return canWhere;
75
+ }
76
+ let canLogic;
77
+ function supportLogicProps() {
78
+ if (canLogic === void 0) canLogic = supportSelector(`.${randomSelectorKey} { inset-block: 93px !important; }`, (ele) => {
79
+ ele.className = randomSelectorKey;
80
+ }, (ele) => getComputedStyle(ele).bottom === "93px");
81
+ return canLogic;
82
+ }
83
+ const isClientSide = canUseDom();
84
+ function unit(num) {
85
+ if (typeof num === "number") return `${num}px`;
86
+ return num;
87
+ }
88
+ function toStyleStr(style, tokenKey, styleId, customizeAttrs = {}, plain = false) {
89
+ if (plain) return style;
90
+ const attrs = {
91
+ ...customizeAttrs,
92
+ [ATTR_TOKEN]: tokenKey,
93
+ [ATTR_MARK]: styleId
94
+ };
95
+ return `<style ${Object.keys(attrs).map((attr) => {
96
+ const val = attrs[attr];
97
+ return val ? `${attr}="${val}"` : null;
98
+ }).filter((v) => v).join(" ")}>${style}</style>`;
99
+ }
100
+ function where(options) {
101
+ const { hashCls, hashPriority = "low" } = options || {};
102
+ if (!hashCls) return "";
103
+ const hashSelector = `.${hashCls}`;
104
+ return hashPriority === "low" ? `:where(${hashSelector})` : hashSelector;
105
+ }
106
+
107
+ //#endregion
108
+ export { flattenToken, isClientSide, memoResult, supportLogicProps, supportWhere, toStyleStr, token2key, unit, where };
package/package.json CHANGED
@@ -1,87 +1,56 @@
1
1
  {
2
2
  "name": "@antdv-next/cssinjs",
3
3
  "type": "module",
4
- "version": "0.0.3",
5
- "description": "Component level cssinjs resolution for antdv-next",
6
- "author": {
7
- "name": "aibayanyu20",
8
- "email": "aibayanyu@qq.com"
4
+ "version": "1.0.0-alpha.1",
5
+ "description": "cssinjs solution for ant-design-vue",
6
+ "exports": {
7
+ ".": {
8
+ "types": "./dist/index.d.ts",
9
+ "import": "./dist/index.js",
10
+ "default": "./dist/index.js"
11
+ },
12
+ "./cssinjs-utils": {
13
+ "types": "./dist/cssinjs-utils/index.d.ts",
14
+ "import": "./dist/cssinjs-utils/index.js",
15
+ "default": "./dist/cssinjs-utils/index.js"
16
+ },
17
+ "./dist/*": {
18
+ "types": "./dist/*.d.ts",
19
+ "import": "./dist/*.js",
20
+ "default": "./dist/*.js"
21
+ }
9
22
  },
10
- "publishConfig": {
11
- "access": "public"
12
- },
13
- "license": "MIT",
14
- "homepage": "https://github.com/antdv-next/cssinjs",
15
- "repository": {
16
- "type": "git",
17
- "url": "git@github.com:antdv-next/cssinjs.git"
18
- },
19
- "bugs": {
20
- "url": "https://github.com/antdv-next/cssinjs/issues"
21
- },
22
- "keywords": [
23
- "cssinjs",
24
- "antd",
25
- "antdv",
26
- "ant-design",
27
- "ant-design-vue",
28
- "vue",
29
- "antdv-next"
30
- ],
31
- "main": "./es/index.js",
32
- "types": "./es/index.d.ts",
33
23
  "files": [
34
24
  "dist",
35
- "es",
36
- "lib"
25
+ "package.json"
37
26
  ],
38
27
  "peerDependencies": {
39
- "vue": "^3.0.0"
28
+ "vue": ">=3.2.0"
40
29
  },
41
30
  "dependencies": {
42
31
  "@emotion/hash": "^0.8.0",
43
32
  "@emotion/unitless": "^0.7.5",
44
- "@v-c/util": "^0.0.2",
45
- "csstype": "^3.1.3",
33
+ "@v-c/util": "^1.0.6",
34
+ "csstype": "^3.2.3",
35
+ "defu": "^6.1.4",
46
36
  "stylis": "^4.3.6"
47
37
  },
48
38
  "devDependencies": {
49
- "@antfu/eslint-config": "^4.18.0",
50
- "@ctrl/tinycolor": "^4.1.0",
51
39
  "@testing-library/jest-dom": "^5.17.0",
52
- "@types/node": "^22.16.5",
40
+ "@types/node": "^24.10.3",
53
41
  "@types/stylis": "^4.2.7",
54
42
  "@types/testing-library__jest-dom": "^5.14.9",
55
- "@vitejs/plugin-vue": "^6.0.0",
56
- "@vitejs/plugin-vue-jsx": "^5.0.1",
57
- "@vitest/coverage-v8": "^2.1.9",
58
43
  "@vue/test-utils": "^2.4.6",
59
- "bumpp": "^10.2.0",
60
- "classnames": "^2.5.1",
61
- "eslint": "^9.31.0",
62
- "jsdom": "^25.0.1",
63
- "postcss": "^8.5.6",
64
- "typescript": "^5.8.3",
65
- "vite": "^7.0.5",
66
- "vite-plugin-dts": "^5.0.0-beta.4",
67
- "vite-plugin-vitepress-demo": "^2.2.1",
68
- "vitepress": "^2.0.0-alpha.8",
69
- "vitest": "^3.2.4",
70
- "vue": "^3.5.18",
71
- "vue-tsc": "^3.0.3"
44
+ "vue": "^3.5.25"
72
45
  },
73
46
  "scripts": {
74
- "docs:dev": "vitepress dev docs",
75
- "docs:build": "vitepress build docs",
76
- "docs:preview": "vitepress preview docs",
77
- "build:umd": "vite build --config vite.umd.config.ts",
78
- "build:module": "vite build",
79
- "build": "pnpm build:module && pnpm build:umd",
80
- "test": "vitest --watch=false",
81
- "test:watch": "vitest",
82
- "coverage": "vitest run --coverage",
83
- "lint": "eslint . --fix",
84
- "release": "bumpp",
85
- "prepublish": "pnpm build"
47
+ "test": "vitest run",
48
+ "test:watch": "vitest watch",
49
+ "test:ui": "vitest --ui",
50
+ "test:coverage": "vitest run --coverage",
51
+ "prepublish": "pnpm build",
52
+ "build": "tsdown",
53
+ "dev": "tsdown --watch",
54
+ "bump": "bumpp --commit \"chore(release): @antdv-next/cssinjs %s\" --push --tag \"@antdv-next/cssinjs@%s\""
86
55
  }
87
56
  }
@@ -1,3 +0,0 @@
1
- (function(T,c){typeof exports=="object"&&typeof module<"u"?c(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],c):(T=typeof globalThis<"u"?globalThis:T||self,c(T.cssinjs={},T.Vue))})(this,function(T,c){"use strict";function Y(e){for(var t=0,r,n=0,o=e.length;o>=4;++n,o-=4)r=e.charCodeAt(n)&255|(e.charCodeAt(++n)&255)<<8|(e.charCodeAt(++n)&255)<<16|(e.charCodeAt(++n)&255)<<24,r=(r&65535)*1540483477+((r>>>16)*59797<<16),r^=r>>>24,t=(r&65535)*1540483477+((r>>>16)*59797<<16)^(t&65535)*1540483477+((t>>>16)*59797<<16);switch(o){case 3:t^=(e.charCodeAt(n+2)&255)<<16;case 2:t^=(e.charCodeAt(n+1)&255)<<8;case 1:t^=e.charCodeAt(n)&255,t=(t&65535)*1540483477+((t>>>16)*59797<<16)}return t^=t>>>13,t=(t&65535)*1540483477+((t>>>16)*59797<<16),((t^t>>>15)>>>0).toString(36)}function Q(){return!!(typeof window<"u"&&window.document&&window.document.createElement)}function St(e,t){if(!e)return!1;if(e.contains)return e.contains(t);let r=t;for(;r;){if(r===e)return!0;r=r.parentNode}return!1}const Me="data-vc-order",Ve="data-vc-priority",Ct="vc-util-key",he=new Map;function Oe({mark:e}={}){return e?e.startsWith("data-")?e:`data-${e}`:Ct}function re(e){return e.attachTo?e.attachTo:document.querySelector("head")||document.body}function $t(e){return e==="queue"?"prependQueue":e?"prepend":"append"}function je(e){return Array.from((he.get(e)||e).children).filter(t=>t.tagName==="STYLE")}function We(e,t={}){if(!Q())return null;const{csp:r,prepend:n,priority:o=0}=t,i=$t(n),l=i==="prependQueue",s=document.createElement("style");s.setAttribute(Me,i),l&&o&&s.setAttribute(Ve,`${o}`),r!=null&&r.nonce&&(s.nonce=r?.nonce),s.innerHTML=e;const a=re(t),{firstChild:u}=a;if(n){if(l){const p=je(a).filter(f=>{if(!["prepend","prependQueue"].includes(f.getAttribute(Me)))return!1;const C=Number(f.getAttribute(Ve)||0);return o>=C});if(p.length)return a.insertBefore(s,p[p.length-1].nextSibling),s}a.insertBefore(s,u)}else a.appendChild(s);return s}function He(e,t={}){const r=re(t);return je(r).find(n=>n.getAttribute(Oe(t))===e)}function pe(e,t={}){const r=He(e,t);r&&re(t).removeChild(r)}function Et(e,t){const r=he.get(e);if(!r||!St(document,r)){const n=We("",t),{parentNode:o}=n;he.set(e,o),e.removeChild(n)}}function W(e,t,r={}){var n,o,i;const l=re(r);Et(l,r);const s=He(t,r);if(s)return(n=r.csp)!=null&&n.nonce&&s.nonce!==((o=r.csp)==null?void 0:o.nonce)&&(s.nonce=(i=r.csp)==null?void 0:i.nonce),s.innerHTML!==e&&(s.innerHTML=e),s;const a=We(e,r);return a.setAttribute(Oe(r),t),a}const kt="%";function me(e){return e.join(kt)}class Tt{instanceId;constructor(t){this.instanceId=t}cache=new Map;get(t){return this.opGet(me(t))}opGet(t){return this.cache.get(t)||null}update(t,r){return this.opUpdate(me(t),r)}opUpdate(t,r){const n=this.cache.get(t),o=r(n);o===null?this.cache.delete(t):this.cache.set(t,o)}}const H="data-token-hash",R="data-css-hash",vt="data-cache-path",P="__cssinjs_instance__";function ye(){const e=Math.random().toString(12).slice(2);if(typeof document<"u"&&document.head&&document.body){const t=document.body.querySelectorAll(`style[${R}]`)||[],{firstChild:r}=document.head;Array.from(t).forEach(o=>{o[P]=o[P]||e,o[P]===e&&document.head.insertBefore(o,r)});const n={};Array.from(document.querySelectorAll(`style[${R}]`)).forEach(o=>{const i=o.getAttribute(R);n[i]?o[P]===e&&o.parentNode?.removeChild(o):n[i]=!0})}return new Tt(e)}const Ke=Symbol("StyleContext"),wt={hashPriority:"low",cache:ye(),defaultCache:!0},At=c.defineComponent((e,{slots:t})=>{const r=X(),n=c.computed(()=>{const o=e,i={...r.value};Object.keys(o).forEach(s=>{const a=o[s];o[s]!==void 0&&(i[s]=a)});const{cache:l}=o;return i.cache=i.cache||ye(),i.defaultCache=!l&&r.value.defaultCache,i});return c.provide(Ke,n),()=>t.default?.()},{name:"StyleProvider",name:"StyleProvider",inheritAttrs:!1,props:{autoClear:{type:Boolean,default:void 0},mock:{type:String,default:void 0},cache:{type:Object,default:void 0},defaultCache:{type:Boolean,default:void 0},hashPriority:{type:String,default:void 0},container:{type:Object,default:void 0},ssrInline:{type:Boolean,default:void 0},transformers:{type:Array,default:void 0},linters:{type:Array,default:void 0},layer:{type:Boolean,default:void 0}}});function X(){return c.inject(Ke,c.computed(()=>wt))}class De{}const Ue="CALC_UNIT",xt=new RegExp(Ue,"g");function ge(e){return typeof e=="number"?`${e}${Ue}`:e}class M extends De{result="";unitlessCssVar;lowPriority;constructor(t,r){super();const n=typeof t;this.unitlessCssVar=r,t instanceof M?this.result=`(${t.result})`:n==="number"?this.result=ge(t):n==="string"&&(this.result=t)}add(t){return t instanceof M?this.result=`${this.result} + ${t.getResult()}`:(typeof t=="number"||typeof t=="string")&&(this.result=`${this.result} + ${ge(t)}`),this.lowPriority=!0,this}sub(t){return t instanceof M?this.result=`${this.result} - ${t.getResult()}`:(typeof t=="number"||typeof t=="string")&&(this.result=`${this.result} - ${ge(t)}`),this.lowPriority=!0,this}mul(t){return this.lowPriority&&(this.result=`(${this.result})`),t instanceof M?this.result=`${this.result} * ${t.getResult(!0)}`:(typeof t=="number"||typeof t=="string")&&(this.result=`${this.result} * ${t}`),this.lowPriority=!1,this}div(t){return this.lowPriority&&(this.result=`(${this.result})`),t instanceof M?this.result=`${this.result} / ${t.getResult(!0)}`:(typeof t=="number"||typeof t=="string")&&(this.result=`${this.result} / ${t}`),this.lowPriority=!1,this}getResult(t){return this.lowPriority||t?`(${this.result})`:this.result}equal(t){const{unit:r}=t||{};let n=!0;return typeof r=="boolean"?n=r:Array.from(this.unitlessCssVar).some(o=>this.result.includes(o))&&(n=!1),this.result=this.result.replace(xt,n?"px":""),typeof this.lowPriority<"u"?`calc(${this.result})`:this.result}}class V extends De{result=0;constructor(t){super(),t instanceof V?this.result=t.result:typeof t=="number"&&(this.result=t)}add(t){return t instanceof V?this.result+=t.result:typeof t=="number"&&(this.result+=t),this}sub(t){return t instanceof V?this.result-=t.result:typeof t=="number"&&(this.result-=t),this}mul(t){return t instanceof V?this.result*=t.result:typeof t=="number"&&(this.result*=t),this}div(t){return t instanceof V?this.result/=t.result:typeof t=="number"&&(this.result/=t),this}equal(){return this.result}}function Rt(e,t){const r=e==="css"?M:V;return n=>new r(n,t)}let be={};const Se=[];function _t(e){Se.push(e)}function ze(e,t){if(process.env.NODE_ENV!=="production"&&!e&&console!==void 0){const r=Se.reduce((n,o)=>o(n??"","warning"),t);r&&console.error(`Warning: ${r}`)}}function Nt(e,t){if(process.env.NODE_ENV!=="production"&&!e&&console!==void 0){const r=Se.reduce((n,o)=>o(n??"","note"),t);r&&console.warn(`Note: ${r}`)}}function Lt(){be={}}function Fe(e,t,r){!t&&!be[r]&&(e(!1,r),be[r]=!0)}function ne(e,t){Fe(ze,e,t)}function It(e,t){Fe(Nt,e,t)}ne.preMessage=_t,ne.resetWarned=Lt,ne.noteOnce=It;let Ge=0;class Ce{derivatives;id;constructor(t){this.derivatives=Array.isArray(t)?t:[t],this.id=Ge,t.length===0&&ze(t.length>0,"[Ant Design CSS-in-JS] Theme should have at least one derivative function."),Ge+=1}getDerivativeToken(t){return this.derivatives.reduce((r,n)=>n(t,r),void 0)}}function Pt(e,t){if(e.length!==t.length)return!1;for(let r=0;r<e.length;r++)if(e[r]!==t[r])return!1;return!0}class oe{static MAX_CACHE_SIZE=20;static MAX_CACHE_OFFSET=5;cache;keys;cacheCallTimes;constructor(){this.cache=new Map,this.keys=[],this.cacheCallTimes=0}size(){return this.keys.length}internalGet(t,r=!1){let n={map:this.cache};return t.forEach(o=>{n?n=n?.map?.get(o):n=void 0}),n?.value&&r&&(n.value[1]=this.cacheCallTimes++),n?.value}get(t){return this.internalGet(t,!0)?.[0]}has(t){return!!this.internalGet(t)}set(t,r){if(!this.has(t)){if(this.size()+1>oe.MAX_CACHE_SIZE+oe.MAX_CACHE_OFFSET){const[o]=this.keys.reduce((i,l)=>{const[,s]=i;return this.internalGet(l)[1]<s?[l,this.internalGet(l)[1]]:i},[this.keys[0],this.cacheCallTimes]);this.delete(o)}this.keys.push(t)}let n=this.cache;t.forEach((o,i)=>{if(i===t.length-1)n.set(o,{value:[r,this.cacheCallTimes++]});else{const l=n.get(o);l?l.map||(l.map=new Map):n.set(o,{map:new Map}),n=n.get(o).map}})}deleteByPath(t,r){const n=t.get(r[0]);if(r.length===1)return n.map?t.set(r[0],{map:n.map}):t.delete(r[0]),n.value?.[0];const o=this.deleteByPath(n.map,r.slice(1));return(!n.map||n.map.size===0)&&!n.value&&t.delete(r[0]),o}delete(t){if(this.has(t))return this.keys=this.keys.filter(r=>!Pt(r,t)),this.deleteByPath(this.cache,t)}}const $e=new oe;function Bt(e){const t=Array.isArray(e)?e:[e];return $e.has(t)||$e.set(t,new Ce(t)),$e.get(t)}const Mt=new WeakMap,Ee={};function Vt(e,t){let r=Mt;for(let n=0;n<t.length;n+=1){const o=t[n];r.has(o)||r.set(o,new WeakMap),r=r.get(o)}return r.has(Ee)||r.set(Ee,e()),r.get(Ee)}const qe=new WeakMap;function Z(e,t=!1){let r=qe.get(e)||"";return r||(Object.keys(e).forEach(n=>{const o=e[n];r+=n,o instanceof Ce?r+=o.id:o&&typeof o=="object"?r+=Z(o,t):r+=o}),t&&(r=Y(r)),qe.set(e,r)),r}function Ye(e,t){return Y(`${t}_${Z(e,!0)}`)}const K=`random-${Date.now()}-${Math.random()}`.replace(/\./g,""),Qe="_bAmBoO_";function Xe(e,t,r){if(Q()){W(e,K);const n=document.createElement("div");n.style.position="fixed",n.style.left="0",n.style.top="0",t?.(n),document.body.appendChild(n),process.env.NODE_ENV!=="production"&&(n.innerHTML="Test",n.style.zIndex="9999999");const o=r?r(n):getComputedStyle(n).content?.includes(Qe);return n.parentNode?.removeChild(n),pe(K),o}return!1}let ke;function Ot(){return ke===void 0&&(ke=Xe(`:where(.${K}) { content: "${Qe}"!important; }`,e=>{e.className=K})),ke}let Te;function jt(){return Te===void 0&&(Te=Xe(`.${K} { inset-block: 93px !important; }`,e=>{e.className=K},e=>getComputedStyle(e).bottom==="93px")),Te}const ve=Q();function Wt(e){return typeof e=="number"?`${e}px`:e}function J(e,t,r,n={},o=!1){if(o)return e;const i={...n,[H]:t,[R]:r};return`<style ${Object.keys(i).map(s=>{const a=i[s];return a?`${s}="${a}"`:null}).filter(s=>s).join(" ")}>${e}</style>`}function Ze(e,t=""){return`--${t?`${t}-`:""}${e}`.replace(/([a-z0-9])([A-Z])/g,"$1-$2").replace(/([A-Z]+)([A-Z][a-z0-9]+)/g,"$1-$2").replace(/([a-z])([A-Z0-9])/g,"$1-$2").toLowerCase()}function Ht(e,t,r){return Object.keys(e).length?`.${t}${r?.scope?`.${r.scope}`:""}{${Object.entries(e).map(([n,o])=>`${n}:${o};`).join("")}}`:""}function Je(e,t,r){const n={},o={};return Object.entries(e).forEach(([i,l])=>{if(r?.preserve?.[i])o[i]=l;else if((typeof l=="string"||typeof l=="number")&&!r?.ignore?.[i]){const s=Ze(i,r?.prefix);n[s]=typeof l=="number"&&!r?.unitless?.[i]?`${l}px`:String(l),o[i]=`var(${s})`}}),[o,Ht(n,t,{scope:r?.scope})]}function Kt(){return function(e){e()}}function Dt(){return!1}let we=!1;function Ut(){return we}const zt=process.env.NODE_ENV==="production"?Dt:Ut;if(process.env.NODE_ENV!=="production"&&typeof module<"u"&&module&&module.hot&&typeof window<"u"){const e=window;if(typeof e.webpackHotUpdate=="function"){const t=e.webpackHotUpdate;e.webpackHotUpdate=(...r)=>(we=!0,setTimeout(()=>{we=!1},0),t(...r))}}function Ae(e,t,r,n,o){const i=X(),l=c.computed(()=>[c.unref(e),...c.unref(t)]),s=c.computed(()=>me(l.value)),a=Kt(),u=[],p=zt(),f=S=>{i.value.cache.opUpdate(s.value,b=>{const[y=0,h]=b||[void 0,void 0];let $=h;process.env.NODE_ENV!=="production"&&h&&p&&(n?.($,p),$=null);const E=$||r(),v=[y,E];return S?S(v):v})},C=c.shallowRef();C.value=i.value.cache.opGet(s.value),process.env.NODE_ENV!=="production"&&!C.value&&(f(),C.value=i.value.cache.opGet(s.value));const d=c.computed(()=>C.value[1]);return c.watch(s,(S,m)=>{const b=i.value.cache;o?.(d.value),f(([y,h])=>(y===0&&o?.(d.value),[y+1,h])),m&&b.opUpdate(m,y=>{const[h=0,$]=y||[];return h-1===0?(a(()=>{n?.($,!1)}),null):[h-1,$]}),C.value=b.opGet(s.value),u.push(()=>{n?.(C.value[1],!1)})},{immediate:!0,flush:"post"}),c.onBeforeUnmount(()=>{u.map(S=>S())}),d}const Ft={},Gt=process.env.NODE_ENV!=="production"?"css-dev-only-do-not-override":"css",O=new Map;function qt(e){O.set(e,(O.get(e)||0)+1)}function Yt(e,t){typeof document<"u"&&document.querySelectorAll(`style[${H}="${e}"]`).forEach(n=>{n[P]===t&&n.parentNode?.removeChild(n)})}const Qt=0;function Xt(e,t){O.set(e,(O.get(e)||0)-1);const r=Array.from(O.keys()),n=r.filter(o=>(O.get(o)||0)<=0);r.length-n.length>Qt&&n.forEach(o=>{Yt(o,t),O.delete(o)})}function et(e,t,r,n){let i={...r.getDerivativeToken(e),...t};return n&&(i=n(i)),i}const tt="token";function Zt(e,t,r=c.ref({})){const n=X(),o=c.computed(()=>c.unref(r).salt??""),i=c.computed(()=>c.unref(r).override??Ft),l=c.unref(r).formatToken,s=c.unref(r).getComputedToken,a=c.computed(()=>c.unref(r).cssVar),u=c.computed(()=>Vt(()=>Object.assign({},...c.unref(t)),c.unref(t))),p=c.computed(()=>Z(u.value)),f=c.computed(()=>Z(i.value)),C=c.computed(()=>a.value?Z(a.value):"");return Ae(tt,c.computed(()=>[o.value,c.unref(e).id,p.value,f.value,C.value]),()=>{let d=s?s(u.value,i.value,c.unref(e)):et(u.value,i.value,c.unref(e),l);const S={...d};let m="";a.value&&([d,m]=Je(d,a.value.key,{prefix:a.value.prefix,ignore:a.value.ignore,unitless:a.value.unitless,preserve:a.value.preserve}));const b=Ye(d,o.value);d._tokenKey=b,S._tokenKey=Ye(S,o.value);const y=a.value?.key??b;d._themeKey=y,qt(y);const h=`${Gt}-${Y(b)}`;return d._hashId=h,[d,h,S,m,a.value?.key||""]},d=>{Xt(d[0]._themeKey,n.value.cache.instanceId)},([d,,,S])=>{if(a.value&&S){const m=W(S,Y(`css-variables-${d._themeKey}`),{mark:R,prepend:"queue",attachTo:n.value.container,priority:-999});m[P]=n.value.cache.instanceId,m.setAttribute(H,d._themeKey)}})}const Jt=(e,t,r)=>{const[,,n,o,i]=e,{plain:l}=r||{};if(!o)return null;const s=n._tokenKey,a=-999,u={"data-vc-order":"prependQueue","data-vc-priority":`${a}`},p=J(o,i,s,u,l);return[a,s,p]};var rt={animationIterationCount:1,borderImageOutset:1,borderImageSlice:1,borderImageWidth:1,boxFlex:1,boxFlexGroup:1,boxOrdinalGroup:1,columnCount:1,columns:1,flex:1,flexGrow:1,flexPositive:1,flexShrink:1,flexNegative:1,flexOrder:1,gridRow:1,gridRowEnd:1,gridRowSpan:1,gridRowStart:1,gridColumn:1,gridColumnEnd:1,gridColumnSpan:1,gridColumnStart:1,msGridRow:1,msGridRowSpan:1,msGridColumn:1,msGridColumnSpan:1,fontWeight:1,lineHeight:1,opacity:1,order:1,orphans:1,tabSize:1,widows:1,zIndex:1,zoom:1,WebkitLineClamp:1,fillOpacity:1,floodOpacity:1,stopOpacity:1,strokeDasharray:1,strokeDashoffset:1,strokeMiterlimit:1,strokeOpacity:1,strokeWidth:1},nt="comm",ot="rule",st="decl",er="@import",tr="@namespace",rr="@keyframes",nr="@layer",it=Math.abs,xe=String.fromCharCode;function at(e){return e.trim()}function se(e,t,r){return e.replace(t,r)}function or(e,t,r){return e.indexOf(t,r)}function D(e,t){return e.charCodeAt(t)|0}function U(e,t,r){return e.slice(t,r)}function L(e){return e.length}function sr(e){return e.length}function ie(e,t){return t.push(e),e}var ae=1,z=1,ct=0,x=0,w=0,F="";function Re(e,t,r,n,o,i,l,s){return{value:e,root:t,parent:r,type:n,props:o,children:i,line:ae,column:z,length:l,return:"",siblings:s}}function ir(){return w}function ar(){return w=x>0?D(F,--x):0,z--,w===10&&(z=1,ae--),w}function _(){return w=x<ct?D(F,x++):0,z++,w===10&&(z=1,ae++),w}function B(){return D(F,x)}function ce(){return x}function le(e,t){return U(F,e,t)}function ee(e){switch(e){case 0:case 9:case 10:case 13:case 32:return 5;case 33:case 43:case 44:case 47:case 62:case 64:case 126:case 59:case 123:case 125:return 4;case 58:return 3;case 34:case 39:case 40:case 91:return 2;case 41:case 93:return 1}return 0}function cr(e){return ae=z=1,ct=L(F=e),x=0,[]}function lr(e){return F="",e}function _e(e){return at(le(x-1,Ne(e===91?e+2:e===40?e+1:e)))}function ur(e){for(;(w=B())&&w<33;)_();return ee(e)>2||ee(w)>3?"":" "}function fr(e,t){for(;--t&&_()&&!(w<48||w>102||w>57&&w<65||w>70&&w<97););return le(e,ce()+(t<6&&B()==32&&_()==32))}function Ne(e){for(;_();)switch(w){case e:return x;case 34:case 39:e!==34&&e!==39&&Ne(w);break;case 40:e===41&&Ne(e);break;case 92:_();break}return x}function dr(e,t){for(;_()&&e+w!==57;)if(e+w===84&&B()===47)break;return"/*"+le(t,x-1)+"*"+xe(e===47?e:_())}function hr(e){for(;!ee(B());)_();return le(e,x)}function pr(e){return lr(ue("",null,null,null,[""],e=cr(e),0,[0],e))}function ue(e,t,r,n,o,i,l,s,a){for(var u=0,p=0,f=l,C=0,d=0,S=0,m=1,b=1,y=1,h=0,$="",E=o,v=i,k=n,g=$;b;)switch(S=h,h=_()){case 40:if(S!=108&&D(g,f-1)==58){or(g+=se(_e(h),"&","&\f"),"&\f",it(u?s[u-1]:0))!=-1&&(y=-1);break}case 34:case 39:case 91:g+=_e(h);break;case 9:case 10:case 13:case 32:g+=ur(S);break;case 92:g+=fr(ce()-1,7);continue;case 47:switch(B()){case 42:case 47:ie(mr(dr(_(),ce()),t,r,a),a),(ee(S||1)==5||ee(B()||1)==5)&&L(g)&&U(g,-1,void 0)!==" "&&(g+=" ");break;default:g+="/"}break;case 123*m:s[u++]=L(g)*y;case 125*m:case 59:case 0:switch(h){case 0:case 125:b=0;case 59+p:y==-1&&(g=se(g,/\f/g,"")),d>0&&(L(g)-f||m===0&&S===47)&&ie(d>32?ut(g+";",n,r,f-1,a):ut(se(g," ","")+";",n,r,f-2,a),a);break;case 59:g+=";";default:if(ie(k=lt(g,t,r,u,p,o,s,$,E=[],v=[],f,i),i),h===123)if(p===0)ue(g,t,k,k,E,i,f,s,v);else{switch(C){case 99:if(D(g,3)===110)break;case 108:if(D(g,2)===97)break;default:p=0;case 100:case 109:case 115:}p?ue(e,k,k,n&&ie(lt(e,k,k,0,0,o,s,$,o,E=[],f,v),v),o,v,f,s,n?E:v):ue(g,k,k,k,[""],v,0,s,v)}}u=p=d=0,m=y=1,$=g="",f=l;break;case 58:f=1+L(g),d=S;default:if(m<1){if(h==123)--m;else if(h==125&&m++==0&&ar()==125)continue}switch(g+=xe(h),h*m){case 38:y=p>0?1:(g+="\f",-1);break;case 44:s[u++]=(L(g)-1)*y,y=1;break;case 64:B()===45&&(g+=_e(_())),C=B(),p=f=L($=g+=hr(ce())),h++;break;case 45:S===45&&L(g)==2&&(m=0)}}return i}function lt(e,t,r,n,o,i,l,s,a,u,p,f){for(var C=o-1,d=o===0?i:[""],S=sr(d),m=0,b=0,y=0;m<n;++m)for(var h=0,$=U(e,C+1,C=it(b=l[m])),E=e;h<S;++h)(E=at(b>0?d[h]+" "+$:se($,/&\f/g,d[h])))&&(a[y++]=E);return Re(e,t,r,o===0?ot:s,a,u,p,f)}function mr(e,t,r,n){return Re(e,t,r,nt,xe(ir()),U(e,2,-2),0,n)}function ut(e,t,r,n,o){return Re(e,t,r,st,U(e,0,n),U(e,n+1,-1),n,o)}function Le(e,t){for(var r="",n=0;n<e.length;n++)r+=t(e[n],n,e,t)||"";return r}function yr(e,t,r,n){switch(e.type){case nr:if(e.children.length)break;case er:case tr:case st:return e.return=e.return||e.value;case nt:return"";case rr:return e.return=e.value+"{"+Le(e.children,n)+"}";case ot:if(!L(e.value=e.props.join(",")))return""}return L(r=Le(e.children,n))?e.return=e.value+"{"+r+"}":""}function I(e,t){const{path:r,parentSelectors:n}=t;ne(!1,`[Ant Design CSS-in-JS] ${r?`Error in ${r}: `:""}${e}${n.length?` Selector: ${n.join(" | ")}`:""}`)}const gr=(e,t,r)=>{if(e==="content"){const n=/(attr|counters?|url|(((repeating-)?(linear|radial))|conic)-gradient)\(|(no-)?(open|close)-quote/;(typeof t!="string"||!["normal","none","initial","inherit","unset"].includes(t)&&!n.test(t)&&(t.charAt(0)!==t.charAt(t.length-1)||t.charAt(0)!=='"'&&t.charAt(0)!=="'"))&&I(`You seem to be using a value for 'content' without quotes, try replacing it with \`content: '"${t}"'\`.`,r)}},br=(e,t,r)=>{e==="animation"&&r.hashId&&t!=="none"&&I(`You seem to be using hashed animation '${t}', in which case 'animationName' with Keyframe as value is recommended.`,r)};function Sr(e){return(e.match(/:not\(([^)]*)\)/)?.[1]||"").split(/(\[[^[]*\])|(?=[.#])/).filter(n=>n).length>1}function Cr(e){return e.parentSelectors.reduce((t,r)=>t?r.includes("&")?r.replace(/&/g,t):`${t} ${r}`:r,"")}const $r=(e,t,r)=>{const o=Cr(r).match(/:not\([^)]*\)/g)||[];o.length>0&&o.some(Sr)&&I("Concat ':not' selector not support in legacy browsers.",r)},Er=(e,t,r)=>{switch(e){case"marginLeft":case"marginRight":case"paddingLeft":case"paddingRight":case"left":case"right":case"borderLeft":case"borderLeftWidth":case"borderLeftStyle":case"borderLeftColor":case"borderRight":case"borderRightWidth":case"borderRightStyle":case"borderRightColor":case"borderTopLeftRadius":case"borderTopRightRadius":case"borderBottomLeftRadius":case"borderBottomRightRadius":I(`You seem to be using non-logical property '${e}' 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.`,r);return;case"margin":case"padding":case"borderWidth":case"borderStyle":if(typeof t=="string"){const n=t.split(" ").map(o=>o.trim());n.length===4&&n[1]!==n[3]&&I(`You seem to be using '${e}' property with different left ${e} and right ${e}, 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.`,r)}return;case"clear":case"textAlign":(t==="left"||t==="right")&&I(`You seem to be using non-logical value '${t}' of ${e}, 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.`,r);return;case"borderRadius":typeof t=="string"&&t.split("/").map(i=>i.trim()).reduce((i,l)=>{if(i)return i;const s=l.split(" ").map(a=>a.trim());return s.length>=2&&s[0]!==s[1]||s.length===3&&s[1]!==s[2]||s.length===4&&s[2]!==s[3]?!0:i},!1)&&I(`You seem to be using non-logical value '${t}' of ${e}, 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.`,r)}},kr=(e,t,r)=>{(typeof t=="string"&&/NaN/.test(t)||Number.isNaN(t))&&I(`Unexpected 'NaN' in property '${e}: ${t}'.`,r)},Tr=(e,t,r)=>{r.parentSelectors.some(n=>n.split(",").some(i=>i.split("&").length>2))&&I("Should not use more than one `&` in a selector.",r)},te="data-ant-cssinjs-cache-path",ft="_FILE_STYLE__";function vr(e){return Object.keys(e).map(t=>{const r=e[t];return`${t}:${r}`}).join(";")}let j,dt=!0;function wr(){if(!j&&(j={},Q())){const e=document.createElement("div");e.className=te,e.style.position="fixed",e.style.visibility="hidden",e.style.top="-9999px",document.body.appendChild(e);let t=getComputedStyle(e).content||"";t=t.replace(/^"/,"").replace(/"$/,""),t.split(";").forEach(n=>{const[o,i]=n.split(":");j[o]=i});const r=document.querySelector(`style[${te}]`);r&&(dt=!1,r.parentNode?.removeChild(r)),document.body.removeChild(e)}}function Ar(e){return wr(),!!j[e]}function xr(e){const t=j[e];let r=null;if(t&&Q())if(dt)r=ft;else{const n=document.querySelector(`style[${R}="${j[e]}"]`);n?r=n.innerHTML:delete j[e]}return[r,t]}const ht="_skip_check_",pt="_multi_value_";function fe(e){return Le(pr(e),yr).replace(/\{%%%:[^;];\}/g,";")}function Rr(e){return typeof e=="object"&&e&&(ht in e||pt in e)}function mt(e,t,r){if(!t)return e;const n=`.${t}`,o=r==="low"?`:where(${n})`:n;return e.split(",").map(l=>{const s=l.trim().split(/\s+/);let a=s[0]||"";const u=a.match(/^\w+/)?.[0]||"";return a=`${u}${o}${a.slice(u.length)}`,[a,...s.slice(1)].join(" ")}).join(",")}function Ie(e,t={},{root:r,injectHash:n,parentSelectors:o}={root:!0,parentSelectors:[]}){const{hashId:i,layer:l,path:s,hashPriority:a,transformers:u=[],linters:p=[]}=t;let f="",C={};function d(b){const y=b.getName(i);if(!C[y]){const[h]=Ie(b.style,t,{root:!1,parentSelectors:o});C[y]=`@keyframes ${b.getName(i)}${h}`}}function S(b,y=[]){return b.forEach(h=>{Array.isArray(h)?S(h,y):h&&y.push(h)}),y}return S(Array.isArray(e)?e:[e]).forEach(b=>{const y=typeof b=="string"&&!r?{}:b;if(typeof y=="string")f+=`${y}
2
- `;else if(y._keyframe)d(y);else{const h=u.reduce(($,E)=>E?.visit?.($)||$,y);Object.keys(h).forEach($=>{const E=h[$];if(typeof E=="object"&&E&&($!=="animationName"||!E._keyframe)&&!Rr(E)){let v=!1,k=$.trim(),g=!1;(r||n)&&i?k.startsWith("@")?v=!0:k==="&"?k=mt("",i,a):k=mt($,i,a):r&&!i&&(k==="&"||k==="")&&(k="",g=!0);const[N,A]=Ie(E,t,{root:g,injectHash:v,parentSelectors:[...o,k]});C={...C,...A},f+=`${k}${N}`}else{let v=function(g,N){process.env.NODE_ENV!=="production"&&(typeof E!="object"||!E?.[ht])&&[gr,br,...p].forEach(Be=>Be(g,N,{path:s,hashId:i,parentSelectors:o}));const A=g.replace(/[A-Z]/g,Be=>`-${Be.toLowerCase()}`);let q=N;!rt[g]&&typeof q=="number"&&q!==0&&(q=`${q}px`),g==="animationName"&&N?._keyframe&&(d(N),q=N.getName(i)),f+=`${A}:${q};`};const k=E?.value??E;typeof E=="object"&&E?.[pt]&&Array.isArray(k)?k.forEach(g=>{v($,g)}):v($,k)}})}}),r?l&&(f=`@layer ${l.name} {${f}}`,l.dependencies&&(C[`@layer ${l.name}`]=l.dependencies.map(b=>`@layer ${b}, ${l.name};`).join(`
3
- `))):f=`{${f}}`,[f,C]}function yt(e,t){return Y(`${e.join("%")}${t}`)}function _r(){return null}const gt="style";function Nr(e,t){const r=c.computed(()=>c.unref(e).token),n=c.computed(()=>c.unref(e).path),o=c.computed(()=>c.unref(e).hashId),i=c.computed(()=>c.unref(e).layer),l=c.computed(()=>c.unref(e).nonce),s=c.computed(()=>c.unref(e).clientOnly),a=c.computed(()=>c.unref(e).order??0),u=X(),p=c.computed(()=>r.value._tokenKey),f=[p.value];u.value.layer&&f.push("layer"),f.push(...n.value);const C=u.value.mock;let d=ve;process.env.NODE_ENV!=="production"&&C!==void 0&&(d=C==="client");const S=Ae(gt,f,()=>{const m=f.join("|");if(Ar(m)){const[v,k]=xr(m);if(v)return[v,p.value,k,{},s.value,a.value]}const b=c.unref(t)(),[y,h]=Ie(b,{hashId:o.value,hashPriority:u.value.hashPriority,layer:u.value.layer?i.value:void 0,path:n.value.join("-"),transformers:u.value.transformers,linters:u.value.linters}),$=fe(y),E=yt(f,$);return[$,p.value,E,h,s.value,a.value]},([,,m],b)=>{(b||u.value.autoClear)&&ve&&pe(m,{mark:R})},([m,b,y,h])=>{if(d&&m!==ft){const $={mark:R,prepend:u.value.layer?!1:"queue",attachTo:u.value.container,priority:a.value},E=typeof l.value=="function"?l.value():l.value;E&&($.csp={nonce:E});const v=[],k=[];Object.keys(h).forEach(A=>{A.startsWith("@layer")?v.push(A):k.push(A)}),v.forEach(A=>{W(fe(h[A]),`_layer-${A}`,{...$,prepend:!0})});const g=u.value.cache,N=W(m,y,$);N[P]=g.instanceId,N.setAttribute(H,c.unref(p)),process.env.NODE_ENV!=="production"&&N.setAttribute(vt,f.join("|")),k.forEach(A=>{W(fe(h[A]),`_effect-${A}`,$)})}});return m=>{let b;const{ssrInline:y,defaultCache:h}=u.value,[$,E,v]=S.value;return!y||d||!h?b=c.createVNode(_r,null,null):b=c.createVNode("style",c.mergeProps({[H]:E,[R]:v},{innerHTML:$}),null),c.createVNode(c.Fragment,null,[b,m])}}const Lr=(e,t,r)=>{const[n,o,i,l,s,a]=e,{plain:u}=r||{};if(s)return null;let p=n;const f={"data-vc-order":"prependQueue","data-vc-priority":`${a}`};return p=J(n,o,i,f,u),l&&Object.keys(l).forEach(C=>{if(!t[C]){t[C]=!0;const d=fe(l[C]),S=J(d,o,`_effect-${C}`,f,u);C.startsWith("@layer")?p=S+p:p+=S}}),[a,i,p]},bt="cssVar";function Ir(e,t){const r=X(),n=c.computed(()=>c.unref(e).path),o=c.computed(()=>c.unref(e).key),i=c.computed(()=>c.unref(e).prefix),l=c.computed(()=>c.unref(e).unitless),s=c.computed(()=>c.unref(e).ignore),a=c.computed(()=>c.unref(e).scope),u=c.computed(()=>c.unref(e).token),p=c.computed(()=>u.value._tokenKey),f=c.computed(()=>[...n.value,o.value,a.value,p.value]);return Ae(bt,f,()=>{const d=c.unref(t)(),[S,m]=Je(d,o.value,{prefix:i.value,unitless:l.value,ignore:s.value,scope:a.value}),b=yt(f.value,m);return[S,m,b,o.value]},([,,d])=>{ve&&pe(d,{mark:R})},([,d,S])=>{if(!d)return;const{container:m,cache:{instanceId:b}}=r.value,y=W(d,S,{mark:R,prepend:"queue",attachTo:m,priority:-999});y[P]=b,y.setAttribute(H,o)})}const Pr=(e,t,r)=>{const[,n,o,i]=e,{plain:l}=r||{};if(!n)return null;const s=-999,a={"data-vc-order":"prependQueue","data-vc-priority":`${s}`},u=J(n,i,o,a,l);return[s,o,u]},Br={[gt]:Lr,[tt]:Jt,[bt]:Pr};function Mr(e){return e!==null}function Vr(e,t){const{plain:r=!1,types:n=["style","token","cssVar"]}=typeof t=="boolean"?{plain:t}:t||{},o=new RegExp(`^(${(typeof n=="string"?[n]:n).join("|")})%`),i=Array.from(e.cache.keys()).filter(u=>o.test(u)),l={},s={};let a="";return i.map(u=>{const p=u.replace(o,"").replace(/%/g,"|"),[f]=u.split("%"),C=Br[f],d=C(e.cache.get(u)[1],l,{plain:r});if(!d)return null;const[S,m,b]=d;return u.startsWith("style")&&(s[p]=m),[S,b]}).filter(Mr).sort(([u],[p])=>u-p).forEach(([,u])=>{a+=u}),a+=J(`.${te}{content:"${vr(s)}";}`,void 0,void 0,{[te]:te},r),a}class Or{name;style;constructor(t,r){this.name=t,this.style=r}getName(t=""){return t?`${t}-${this.name}`:this.name}_keyframe=!0}function jr(e){if(typeof e=="number")return[[e],!1];const t=String(e).trim(),r=t.match(/(.*)(!important)/),n=(r?r[1]:t).trim().split(/\s+/);let o=[],i=0;return[n.reduce((l,s)=>{if(s.includes("(")||s.includes(")")){const a=s.split("(").length-1,u=s.split(")").length-1;i+=a-u}return i>=0&&o.push(s),i===0&&(l.push(o.join(" ")),o=[]),l},[]),!!r]}function G(e){return e.notSplit=!0,e}const Wr={inset:["top","right","bottom","left"],insetBlock:["top","bottom"],insetBlockStart:["top"],insetBlockEnd:["bottom"],insetInline:["left","right"],insetInlineStart:["left"],insetInlineEnd:["right"],marginBlock:["marginTop","marginBottom"],marginBlockStart:["marginTop"],marginBlockEnd:["marginBottom"],marginInline:["marginLeft","marginRight"],marginInlineStart:["marginLeft"],marginInlineEnd:["marginRight"],paddingBlock:["paddingTop","paddingBottom"],paddingBlockStart:["paddingTop"],paddingBlockEnd:["paddingBottom"],paddingInline:["paddingLeft","paddingRight"],paddingInlineStart:["paddingLeft"],paddingInlineEnd:["paddingRight"],borderBlock:G(["borderTop","borderBottom"]),borderBlockStart:G(["borderTop"]),borderBlockEnd:G(["borderBottom"]),borderInline:G(["borderLeft","borderRight"]),borderInlineStart:G(["borderLeft"]),borderInlineEnd:G(["borderRight"]),borderBlockWidth:["borderTopWidth","borderBottomWidth"],borderBlockStartWidth:["borderTopWidth"],borderBlockEndWidth:["borderBottomWidth"],borderInlineWidth:["borderLeftWidth","borderRightWidth"],borderInlineStartWidth:["borderLeftWidth"],borderInlineEndWidth:["borderRightWidth"],borderBlockStyle:["borderTopStyle","borderBottomStyle"],borderBlockStartStyle:["borderTopStyle"],borderBlockEndStyle:["borderBottomStyle"],borderInlineStyle:["borderLeftStyle","borderRightStyle"],borderInlineStartStyle:["borderLeftStyle"],borderInlineEndStyle:["borderRightStyle"],borderBlockColor:["borderTopColor","borderBottomColor"],borderBlockStartColor:["borderTopColor"],borderBlockEndColor:["borderBottomColor"],borderInlineColor:["borderLeftColor","borderRightColor"],borderInlineStartColor:["borderLeftColor"],borderInlineEndColor:["borderRightColor"],borderStartStartRadius:["borderTopLeftRadius"],borderStartEndRadius:["borderTopRightRadius"],borderEndStartRadius:["borderBottomLeftRadius"],borderEndEndRadius:["borderBottomRightRadius"]};function de(e,t){let r=e;return t&&(r=`${r} !important`),{_skip_check_:!0,value:r}}const Hr={visit:e=>{const t={};return Object.keys(e).forEach(r=>{const n=e[r],o=Wr[r];if(o&&(typeof n=="number"||typeof n=="string")){const[i,l]=jr(n);o.length&&o.notSplit?o.forEach(s=>{t[s]=de(n,l)}):o.length===1?t[o[0]]=de(i[0],l):o.length===2?o.forEach((s,a)=>{t[s]=de(i[a]??i[0],l)}):o.length===4?o.forEach((s,a)=>{t[s]=de(i[a]??i[a-2]??i[0],l)}):t[r]=n}else t[r]=n}),t}},Pe=/url\([^)]+\)|var\([^)]+\)|(\d+(?:\.\d+)?|\.\d+)px/g;function Kr(e,t){const r=10**(t+1),n=Math.floor(e*r);return Math.round(n/10)*10/r}function Dr(e={}){const{rootValue:t=16,precision:r=5,mediaQuery:n=!1}=e,o=(l,s)=>{if(!s)return l;const a=Number.parseFloat(s);return a<=1?l:`${Kr(a/t,r)}rem`};return{visit:l=>{const s={...l};return Object.entries(l).forEach(([a,u])=>{if(typeof u=="string"&&u.includes("px")){const f=u.replace(Pe,o);s[a]=f}!rt[a]&&typeof u=="number"&&u!==0&&(s[a]=`${u}px`.replace(Pe,o));const p=a.trim();if(p.startsWith("@")&&p.includes("px")&&n){const f=a.replace(Pe,o);s[f]=s[a],delete s[a]}}),s}}}const Ur={supportModernCSS:()=>Ot()&&jt()};T.Keyframes=Or,T.NaNLinter=kr,T.StyleProvider=At,T.Theme=Ce,T._experimental=Ur,T.createCache=ye,T.createTheme=Bt,T.extractStyle=Vr,T.genCalc=Rt,T.getComputedToken=et,T.legacyLogicalPropertiesTransformer=Hr,T.legacyNotSelectorLinter=$r,T.logicalPropertiesLinter=Er,T.parentSelectorLinter=Tr,T.px2remTransformer=Dr,T.token2CSSVar=Ze,T.unit=Wt,T.useCSSVarRegister=Ir,T.useCacheToken=Zt,T.useStyleRegister=Nr,Object.defineProperty(T,Symbol.toStringTag,{value:"Module"})});
package/es/Cache.d.ts DELETED
@@ -1,20 +0,0 @@
1
- export type KeyType = string | number;
2
- type ValueType = [number, any];
3
- /** Connect key with `SPLIT` */
4
- export declare function pathKey(keys: KeyType[]): string;
5
- declare class Entity {
6
- instanceId: string;
7
- constructor(instanceId: string);
8
- /**
9
- * @private
10
- * Internal cache map. Do not access this directly
11
- */
12
- cache: Map<string, ValueType>;
13
- get(keys: KeyType[]): ValueType | null;
14
- /** A fast get cache with `get` concat. */
15
- opGet(keyPathStr: string): ValueType | null;
16
- update(keys: KeyType[], valueFn: (origin: ValueType | null) => ValueType | null): void;
17
- /** A fast get cache with `get` concat. */
18
- opUpdate(keyPathStr: string, valueFn: (origin: ValueType | null) => ValueType | null): void;
19
- }
20
- export default Entity;
package/es/Cache.js DELETED
@@ -1,33 +0,0 @@
1
- function s(n) {
2
- return n.join("%");
3
- }
4
- class i {
5
- instanceId;
6
- constructor(e) {
7
- this.instanceId = e;
8
- }
9
- /**
10
- * @private
11
- * Internal cache map. Do not access this directly
12
- */
13
- cache = /* @__PURE__ */ new Map();
14
- get(e) {
15
- return this.opGet(s(e));
16
- }
17
- /** A fast get cache with `get` concat. */
18
- opGet(e) {
19
- return this.cache.get(e) || null;
20
- }
21
- update(e, t) {
22
- return this.opUpdate(s(e), t);
23
- }
24
- /** A fast get cache with `get` concat. */
25
- opUpdate(e, t) {
26
- const a = this.cache.get(e), c = t(a);
27
- c === null ? this.cache.delete(e) : this.cache.set(e, c);
28
- }
29
- }
30
- export {
31
- i as default,
32
- s as pathKey
33
- };
package/es/Keyframes.d.ts DELETED
@@ -1,9 +0,0 @@
1
- import { CSSInterpolation } from './hooks/useStyleRegister';
2
- declare class Keyframe {
3
- private readonly name;
4
- style: CSSInterpolation;
5
- constructor(name: string, style: CSSInterpolation);
6
- getName(hashId?: string): string;
7
- _keyframe: boolean;
8
- }
9
- export default Keyframe;
package/es/Keyframes.js DELETED
@@ -1,14 +0,0 @@
1
- class s {
2
- name;
3
- style;
4
- constructor(e, t) {
5
- this.name = e, this.style = t;
6
- }
7
- getName(e = "") {
8
- return e ? `${e}-${this.name}` : this.name;
9
- }
10
- _keyframe = !0;
11
- }
12
- export {
13
- s as default
14
- };
@@ -1,40 +0,0 @@
1
- import { ComputedRef } from 'vue';
2
- import { Linter } from './linters';
3
- import { Transformer } from './transformers/interface';
4
- import { default as CacheEntity } from './Cache';
5
- export declare const ATTR_TOKEN = "data-token-hash";
6
- export declare const ATTR_MARK = "data-css-hash";
7
- export declare const ATTR_CACHE_PATH = "data-cache-path";
8
- export declare const CSS_IN_JS_INSTANCE = "__cssinjs_instance__";
9
- export declare function createCache(): CacheEntity;
10
- export type HashPriority = 'low' | 'high';
11
- export interface StyleContextProps {
12
- autoClear?: boolean;
13
- mock?: 'server' | 'client';
14
- /**
15
- * Only set when you need ssr to extract style on you own.
16
- * If not provided, it will auto create <style /> on the end of Provider in server side.
17
- */
18
- cache: CacheEntity;
19
- /** Tell children that this context is default generated context */
20
- defaultCache: boolean;
21
- /** Use `:where` selector to reduce hashId css selector priority */
22
- hashPriority?: HashPriority;
23
- /** Tell cssinjs where to inject style in */
24
- container?: Element | ShadowRoot;
25
- /** Component wil render inline `<style />` for fallback in SSR. Not recommend. */
26
- ssrInline?: boolean;
27
- /** Transform css before inject in document. Please note that `transformers` do not support dynamic update */
28
- transformers?: Transformer[];
29
- /**
30
- * Linters to lint css before inject in document.
31
- * Styles will be linted after transforming.
32
- * Please note that `linters` do not support dynamic update.
33
- */
34
- linters?: Linter[];
35
- /** Wrap css in a layer to avoid global style conflict */
36
- layer?: boolean;
37
- }
38
- export type StyleProviderProps = Partial<StyleContextProps>;
39
- export declare const StyleProvider: import('vue').DefineSetupFnComponent<Partial<StyleContextProps>, {}, {}, Partial<StyleContextProps> & {}, import('vue').PublicProps>;
40
- export declare function useStyleContext(): ComputedRef<StyleContextProps>;