@antdv-next/cssinjs 1.0.0-beta.1 → 1.0.0-rc.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{Cache.d.ts → Cache.d.mts} +0 -1
- package/dist/{Keyframes.d.ts → Keyframes.d.mts} +1 -1
- package/dist/{StyleContext.d.ts → StyleContext.d.mts} +17 -26
- package/dist/{StyleContext.js → StyleContext.mjs} +6 -2
- package/dist/cssinjs-utils/hooks/{useToken.d.ts → useToken.d.mts} +3 -3
- package/dist/cssinjs-utils/{index.d.ts → index.d.mts} +3 -3
- package/dist/cssinjs-utils/{index.js → index.mjs} +2 -2
- package/dist/cssinjs-utils/interface/{components.d.ts → components.d.mts} +1 -1
- package/dist/cssinjs-utils/util/{genStyleUtils.d.ts → genStyleUtils.d.mts} +11 -15
- package/dist/cssinjs-utils/util/{genStyleUtils.js → genStyleUtils.mjs} +17 -17
- package/dist/cssinjs-utils/util/{getDefaultComponentToken.js → getDefaultComponentToken.mjs} +1 -1
- package/dist/cssinjs-utils/util/{maxmin.js → maxmin.mjs} +1 -1
- package/dist/cssinjs-utils/util/{statistic.d.ts → statistic.d.mts} +1 -1
- package/dist/{extractStyle.d.ts → extractStyle.d.mts} +3 -3
- package/dist/{extractStyle.js → extractStyle.mjs} +8 -8
- package/dist/hooks/{useCSSVarRegister.d.ts → useCSSVarRegister.d.mts} +2 -2
- package/dist/hooks/{useCSSVarRegister.js → useCSSVarRegister.mjs} +6 -6
- package/dist/hooks/{useCacheToken.d.ts → useCacheToken.d.mts} +7 -12
- package/dist/hooks/{useCacheToken.js → useCacheToken.mjs} +8 -8
- package/dist/hooks/{useGlobalCache.js → useGlobalCache.mjs} +5 -2
- package/dist/hooks/{useStyleRegister.d.ts → useStyleRegister.d.mts} +6 -6
- package/dist/hooks/{useStyleRegister.js → useStyleRegister.mjs} +13 -13
- package/dist/{index.d.ts → index.d.mts} +28 -28
- package/dist/{index.js → index.mjs} +24 -24
- package/dist/linters/{NaNLinter.d.ts → NaNLinter.d.mts} +1 -1
- package/dist/linters/{NaNLinter.js → NaNLinter.mjs} +1 -1
- package/dist/linters/{contentQuotesLinter.js → contentQuotesLinter.mjs} +1 -1
- package/dist/linters/{hashedAnimationLinter.js → hashedAnimationLinter.mjs} +1 -1
- package/dist/linters/index.d.mts +5 -0
- package/dist/linters/{index.js → index.mjs} +6 -6
- package/dist/linters/{legacyNotSelectorLinter.d.ts → legacyNotSelectorLinter.d.mts} +1 -1
- package/dist/linters/{legacyNotSelectorLinter.js → legacyNotSelectorLinter.mjs} +1 -1
- package/dist/linters/{logicalPropertiesLinter.d.ts → logicalPropertiesLinter.d.mts} +1 -1
- package/dist/linters/{logicalPropertiesLinter.js → logicalPropertiesLinter.mjs} +1 -1
- package/dist/linters/{parentSelectorLinter.d.ts → parentSelectorLinter.d.mts} +2 -2
- package/dist/linters/{parentSelectorLinter.js → parentSelectorLinter.mjs} +1 -1
- package/dist/theme/{Theme.d.ts → Theme.d.mts} +1 -2
- package/dist/theme/calc/{CSSCalculator.d.ts → CSSCalculator.d.mts} +1 -1
- package/dist/theme/calc/{CSSCalculator.js → CSSCalculator.mjs} +1 -1
- package/dist/theme/calc/{NumCalculator.d.ts → NumCalculator.d.mts} +1 -1
- package/dist/theme/calc/{NumCalculator.js → NumCalculator.mjs} +1 -1
- package/dist/theme/calc/{index.d.ts → index.d.mts} +3 -3
- package/dist/theme/calc/{index.js → index.mjs} +2 -2
- package/dist/theme/{createTheme.d.ts → createTheme.d.mts} +2 -3
- package/dist/theme/{createTheme.js → createTheme.mjs} +2 -2
- package/dist/theme/index.mjs +6 -0
- package/dist/transformers/{autoPrefix.d.ts → autoPrefix.d.mts} +1 -1
- package/dist/transformers/{interface.d.ts → interface.d.mts} +2 -2
- package/dist/transformers/{legacyLogicalProperties.d.ts → legacyLogicalProperties.d.mts} +1 -2
- package/dist/transformers/{px2rem.d.ts → px2rem.d.mts} +1 -1
- package/dist/transformers/{px2rem.js → px2rem.mjs} +3 -0
- package/dist/util/{cacheMapUtil.js → cacheMapUtil.mjs} +4 -4
- package/dist/util/{css-variables.d.ts → css-variables.d.mts} +1 -1
- package/dist/util/{css-variables.js → css-variables.mjs} +1 -1
- package/dist/util/index.d.mts +7 -0
- package/dist/util/{index.js → index.mjs} +7 -7
- package/dist/util/resolveHash.mjs +7 -0
- package/dist/util/resolveUnitless.mjs +7 -0
- package/package.json +15 -15
- package/dist/linters/index.d.ts +0 -5
- package/dist/theme/index.js +0 -6
- package/dist/util/index.d.ts +0 -8
- /package/dist/{Cache.js → Cache.mjs} +0 -0
- /package/dist/{Keyframes.js → Keyframes.mjs} +0 -0
- /package/dist/cssinjs-utils/_util/hooks/{useUniqueMemo.js → useUniqueMemo.mjs} +0 -0
- /package/dist/cssinjs-utils/hooks/{useCSP.d.ts → useCSP.d.mts} +0 -0
- /package/dist/cssinjs-utils/hooks/{useCSP.js → useCSP.mjs} +0 -0
- /package/dist/cssinjs-utils/hooks/{usePrefix.d.ts → usePrefix.d.mts} +0 -0
- /package/dist/cssinjs-utils/util/{getCompVarPrefix.js → getCompVarPrefix.mjs} +0 -0
- /package/dist/cssinjs-utils/util/{getComponentToken.js → getComponentToken.mjs} +0 -0
- /package/dist/cssinjs-utils/util/{statistic.js → statistic.mjs} +0 -0
- /package/dist/hooks/{useGlobalCache.d.ts → useGlobalCache.d.mts} +0 -0
- /package/dist/linters/{interface.d.ts → interface.d.mts} +0 -0
- /package/dist/linters/{utils.js → utils.mjs} +0 -0
- /package/dist/ssr/{styleCollector.d.ts → styleCollector.d.mts} +0 -0
- /package/dist/ssr/{styleCollector.js → styleCollector.mjs} +0 -0
- /package/dist/theme/{Theme.js → Theme.mjs} +0 -0
- /package/dist/theme/{ThemeCache.js → ThemeCache.mjs} +0 -0
- /package/dist/theme/calc/{calculator.d.ts → calculator.d.mts} +0 -0
- /package/dist/theme/calc/{calculator.js → calculator.mjs} +0 -0
- /package/dist/theme/{interface.d.ts → interface.d.mts} +0 -0
- /package/dist/transformers/{autoPrefix.js → autoPrefix.mjs} +0 -0
- /package/dist/transformers/{legacyLogicalProperties.js → legacyLogicalProperties.mjs} +0 -0
|
@@ -1,22 +1,21 @@
|
|
|
1
|
-
import { Linter } from "./linters/interface.
|
|
2
|
-
import "./linters/index.
|
|
3
|
-
import { Entity, KeyType } from "./Cache.
|
|
1
|
+
import { Linter } from "./linters/interface.mjs";
|
|
2
|
+
import "./linters/index.mjs";
|
|
3
|
+
import { Entity, KeyType } from "./Cache.mjs";
|
|
4
4
|
import * as vue0 from "vue";
|
|
5
5
|
import { App, Ref } from "vue";
|
|
6
6
|
|
|
7
7
|
//#region src/StyleContext.d.ts
|
|
8
|
-
|
|
9
8
|
declare function createCache(): vue0.Raw<Entity>;
|
|
10
9
|
declare function useStyleContextProvide(props: Ref<StyleContextProps>): void;
|
|
11
10
|
declare function provideStyleContext(app: App, props: Ref<StyleContextProps>): void;
|
|
12
11
|
declare function useStyleContext(): Ref<{
|
|
13
|
-
autoClear?: boolean
|
|
14
|
-
/** @private Test only. Not work in production. */ | undefined;
|
|
12
|
+
autoClear?: boolean /** @private Test only. Not work in production. */ | undefined;
|
|
15
13
|
mock?: "server" | "client"
|
|
16
14
|
/**
|
|
17
15
|
* Only set when you need ssr to extract style on you own.
|
|
18
16
|
* If not provided, it will auto create <style /> on the end of Provider in server side.
|
|
19
|
-
*/
|
|
17
|
+
*/
|
|
18
|
+
| undefined;
|
|
20
19
|
cache: {
|
|
21
20
|
instanceId: string;
|
|
22
21
|
cache: Map<string, [number, any]> & Omit<Map<string, [number, any]>, keyof Map<any, any>>;
|
|
@@ -28,11 +27,9 @@ declare function useStyleContext(): Ref<{
|
|
|
28
27
|
opUpdate: (keyPathStr: string, valueFn: (origin: [number, any] | null) => [number, any] | null) => void;
|
|
29
28
|
};
|
|
30
29
|
defaultCache: boolean;
|
|
31
|
-
hashPriority?: HashPriority
|
|
32
|
-
/** Tell cssinjs where to inject style in */ | undefined;
|
|
30
|
+
hashPriority?: HashPriority /** Tell cssinjs where to inject style in */ | undefined;
|
|
33
31
|
container?: (Element | ShadowRoot) | undefined;
|
|
34
|
-
ssrInline?: boolean
|
|
35
|
-
/** Transform css before inject in document. Please note that `transformers` do not support dynamic update */ | undefined;
|
|
32
|
+
ssrInline?: boolean /** Transform css before inject in document. Please note that `transformers` do not support dynamic update */ | undefined;
|
|
36
33
|
transformers?: {
|
|
37
34
|
flush?: TransformerFlushCallback<any> | undefined;
|
|
38
35
|
readableType?: undefined | undefined;
|
|
@@ -40,19 +37,17 @@ declare function useStyleContext(): Ref<{
|
|
|
40
37
|
transform?: TransformerTransformCallback<any, any> | undefined;
|
|
41
38
|
writableType?: undefined | undefined;
|
|
42
39
|
}[] | undefined;
|
|
43
|
-
linters?: Linter[]
|
|
44
|
-
/**
|
|
45
|
-
layer?: boolean
|
|
46
|
-
/** Hardcode here since transformer not support take effect on serialize currently */ | undefined;
|
|
40
|
+
linters?: Linter[] /** Wrap css in a layer to avoid global style conflict */ | undefined;
|
|
41
|
+
layer?: boolean /** Hardcode here since transformer not support take effect on serialize currently */ | undefined;
|
|
47
42
|
autoPrefix?: boolean | undefined;
|
|
48
43
|
}, StyleContextProps | {
|
|
49
|
-
autoClear?: boolean
|
|
50
|
-
/** @private Test only. Not work in production. */ | undefined;
|
|
44
|
+
autoClear?: boolean /** @private Test only. Not work in production. */ | undefined;
|
|
51
45
|
mock?: "server" | "client"
|
|
52
46
|
/**
|
|
53
47
|
* Only set when you need ssr to extract style on you own.
|
|
54
48
|
* If not provided, it will auto create <style /> on the end of Provider in server side.
|
|
55
|
-
*/
|
|
49
|
+
*/
|
|
50
|
+
| undefined;
|
|
56
51
|
cache: {
|
|
57
52
|
instanceId: string;
|
|
58
53
|
cache: Map<string, [number, any]> & Omit<Map<string, [number, any]>, keyof Map<any, any>>;
|
|
@@ -64,11 +59,9 @@ declare function useStyleContext(): Ref<{
|
|
|
64
59
|
opUpdate: (keyPathStr: string, valueFn: (origin: [number, any] | null) => [number, any] | null) => void;
|
|
65
60
|
};
|
|
66
61
|
defaultCache: boolean;
|
|
67
|
-
hashPriority?: HashPriority
|
|
68
|
-
/** Tell cssinjs where to inject style in */ | undefined;
|
|
62
|
+
hashPriority?: HashPriority /** Tell cssinjs where to inject style in */ | undefined;
|
|
69
63
|
container?: (Element | ShadowRoot) | undefined;
|
|
70
|
-
ssrInline?: boolean
|
|
71
|
-
/** Transform css before inject in document. Please note that `transformers` do not support dynamic update */ | undefined;
|
|
64
|
+
ssrInline?: boolean /** Transform css before inject in document. Please note that `transformers` do not support dynamic update */ | undefined;
|
|
72
65
|
transformers?: {
|
|
73
66
|
flush?: TransformerFlushCallback<any> | undefined;
|
|
74
67
|
readableType?: undefined | undefined;
|
|
@@ -76,10 +69,8 @@ declare function useStyleContext(): Ref<{
|
|
|
76
69
|
transform?: TransformerTransformCallback<any, any> | undefined;
|
|
77
70
|
writableType?: undefined | undefined;
|
|
78
71
|
}[] | undefined;
|
|
79
|
-
linters?: Linter[]
|
|
80
|
-
/**
|
|
81
|
-
layer?: boolean
|
|
82
|
-
/** Hardcode here since transformer not support take effect on serialize currently */ | undefined;
|
|
72
|
+
linters?: Linter[] /** Wrap css in a layer to avoid global style conflict */ | undefined;
|
|
73
|
+
layer?: boolean /** Hardcode here since transformer not support take effect on serialize currently */ | undefined;
|
|
83
74
|
autoPrefix?: boolean | undefined;
|
|
84
75
|
}>;
|
|
85
76
|
type HashPriority = 'low' | 'high';
|
|
@@ -1,8 +1,12 @@
|
|
|
1
|
-
import Cache_default from "./Cache.
|
|
2
|
-
import { AUTO_PREFIX } from "./transformers/autoPrefix.
|
|
1
|
+
import Cache_default from "./Cache.mjs";
|
|
2
|
+
import { AUTO_PREFIX } from "./transformers/autoPrefix.mjs";
|
|
3
3
|
import { computed, defineComponent, inject, markRaw, provide, ref } from "vue";
|
|
4
4
|
|
|
5
5
|
//#region src/StyleContext.ts
|
|
6
|
+
/**
|
|
7
|
+
* @description Style Context
|
|
8
|
+
* vue3 版本的 Style Context实现
|
|
9
|
+
*/
|
|
6
10
|
const ATTR_TOKEN = "data-token-hash";
|
|
7
11
|
const ATTR_MARK = "data-css-hash";
|
|
8
12
|
const ATTR_CACHE_PATH = "data-cache-path";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { TokenType } from "../../theme/interface.
|
|
2
|
-
import { Theme } from "../../theme/Theme.
|
|
3
|
-
import { GlobalToken, OverrideTokenMap, TokenMap } from "../interface/components.
|
|
1
|
+
import { TokenType } from "../../theme/interface.mjs";
|
|
2
|
+
import { Theme } from "../../theme/Theme.mjs";
|
|
3
|
+
import { GlobalToken, OverrideTokenMap, TokenMap } from "../interface/components.mjs";
|
|
4
4
|
import { Ref } from "vue";
|
|
5
5
|
|
|
6
6
|
//#region src/cssinjs-utils/hooks/useToken.d.ts
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ComponentToken, ComponentTokenKey, GlobalToken, GlobalTokenWithComponent, OverrideTokenMap, TokenMap, TokenMapKey } from "./interface/components.
|
|
2
|
-
import { CSSUtil, CSSVarRegisterProps, FullToken, GenStyleFn, GetCompUnitless, GetDefaultToken, GetDefaultTokenFn, GetResetStyles, StyleInfo, SubStyleComponentProps, TokenWithCommonCls, genStyleUtils } from "./util/genStyleUtils.
|
|
3
|
-
import { merge, statistic, statisticToken } from "./util/statistic.
|
|
1
|
+
import { ComponentToken, ComponentTokenKey, GlobalToken, GlobalTokenWithComponent, OverrideTokenMap, TokenMap, TokenMapKey } from "./interface/components.mjs";
|
|
2
|
+
import { CSSUtil, CSSVarRegisterProps, FullToken, GenStyleFn, GetCompUnitless, GetDefaultToken, GetDefaultTokenFn, GetResetStyles, StyleInfo, SubStyleComponentProps, TokenWithCommonCls, genStyleUtils } from "./util/genStyleUtils.mjs";
|
|
3
|
+
import { merge, statistic, statisticToken } from "./util/statistic.mjs";
|
|
4
4
|
export { type CSSUtil, type CSSVarRegisterProps, type ComponentToken, type ComponentTokenKey, type FullToken, type GenStyleFn, type GetCompUnitless, type GetDefaultToken, type GetDefaultTokenFn, type GetResetStyles, type GlobalToken, type GlobalTokenWithComponent, type OverrideTokenMap, type StyleInfo, type SubStyleComponentProps, type TokenMap, type TokenMapKey, type TokenWithCommonCls, genStyleUtils, merge as mergeToken, statistic, statisticToken };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import statistic_default, { merge, statistic } from "./util/statistic.
|
|
2
|
-
import genStyleUtils_default from "./util/genStyleUtils.
|
|
1
|
+
import statistic_default, { merge, statistic } from "./util/statistic.mjs";
|
|
2
|
+
import genStyleUtils_default from "./util/genStyleUtils.mjs";
|
|
3
3
|
|
|
4
4
|
export { genStyleUtils_default as genStyleUtils, merge as mergeToken, statistic, statistic_default as statisticToken };
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { AbstractCalculator } from "../../theme/calc/calculator.
|
|
2
|
-
import { TokenType } from "../../theme/interface.
|
|
3
|
-
import { ComponentTokenKey, GlobalTokenWithComponent, TokenMap, TokenMapKey } from "../interface/components.
|
|
4
|
-
import { CSSInterpolation, CSSObject, useStyleRegister } from "../../hooks/useStyleRegister.
|
|
5
|
-
import "../../index.
|
|
6
|
-
import { UseCSP } from "../hooks/useCSP.
|
|
7
|
-
import { UsePrefix } from "../hooks/usePrefix.
|
|
8
|
-
import { UseToken } from "../hooks/useToken.
|
|
1
|
+
import { AbstractCalculator } from "../../theme/calc/calculator.mjs";
|
|
2
|
+
import { TokenType } from "../../theme/interface.mjs";
|
|
3
|
+
import { ComponentTokenKey, GlobalTokenWithComponent, TokenMap, TokenMapKey } from "../interface/components.mjs";
|
|
4
|
+
import { CSSInterpolation, CSSObject, useStyleRegister } from "../../hooks/useStyleRegister.mjs";
|
|
5
|
+
import "../../index.mjs";
|
|
6
|
+
import { UseCSP } from "../hooks/useCSP.mjs";
|
|
7
|
+
import { UsePrefix } from "../hooks/usePrefix.mjs";
|
|
8
|
+
import { UseToken } from "../hooks/useToken.mjs";
|
|
9
9
|
import * as vue2 from "vue";
|
|
10
10
|
import { Ref, UnwrapRef } from "vue";
|
|
11
11
|
|
|
@@ -23,13 +23,9 @@ interface CSSUtil {
|
|
|
23
23
|
min: (...values: (number | string)[]) => number | string;
|
|
24
24
|
}
|
|
25
25
|
type TokenWithCommonCls<T> = T & {
|
|
26
|
-
/** Wrap component class with `.` prefix */
|
|
27
|
-
|
|
28
|
-
/**
|
|
29
|
-
prefixCls: string;
|
|
30
|
-
/** Wrap icon class with `.` prefix */
|
|
31
|
-
iconCls: string;
|
|
32
|
-
/** Wrap ant prefixCls class with `.` prefix */
|
|
26
|
+
/** Wrap component class with `.` prefix */componentCls: string; /** Origin prefix which do not have `.` prefix */
|
|
27
|
+
prefixCls: string; /** Wrap icon class with `.` prefix */
|
|
28
|
+
iconCls: string; /** Wrap ant prefixCls class with `.` prefix */
|
|
33
29
|
antCls: string;
|
|
34
30
|
} & CSSUtil;
|
|
35
31
|
type FullToken<CompTokenMap extends TokenMap, AliasToken extends TokenType, C extends TokenMapKey<CompTokenMap>> = TokenWithCommonCls<GlobalTokenWithComponent<CompTokenMap, AliasToken, C>>;
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import calc_default from "../../theme/calc/index.
|
|
2
|
-
import { token2CSSVar } from "../../util/css-variables.
|
|
3
|
-
import useStyleRegister from "../../hooks/useStyleRegister.
|
|
4
|
-
import useCSSVarRegister from "../../hooks/useCSSVarRegister.
|
|
5
|
-
import useUniqueMemo_default from "../_util/hooks/useUniqueMemo.
|
|
6
|
-
import useCSP_default from "../hooks/useCSP.
|
|
7
|
-
import getComponentToken_default from "./getComponentToken.
|
|
8
|
-
import getCompVarPrefix_default from "./getCompVarPrefix.
|
|
9
|
-
import statistic_default, { merge } from "./statistic.
|
|
10
|
-
import getDefaultComponentToken_default from "./getDefaultComponentToken.
|
|
11
|
-
import maxmin_default from "./maxmin.
|
|
12
|
-
import "../../index.
|
|
1
|
+
import calc_default from "../../theme/calc/index.mjs";
|
|
2
|
+
import { token2CSSVar } from "../../util/css-variables.mjs";
|
|
3
|
+
import useStyleRegister from "../../hooks/useStyleRegister.mjs";
|
|
4
|
+
import useCSSVarRegister from "../../hooks/useCSSVarRegister.mjs";
|
|
5
|
+
import useUniqueMemo_default from "../_util/hooks/useUniqueMemo.mjs";
|
|
6
|
+
import useCSP_default from "../hooks/useCSP.mjs";
|
|
7
|
+
import getComponentToken_default from "./getComponentToken.mjs";
|
|
8
|
+
import getCompVarPrefix_default from "./getCompVarPrefix.mjs";
|
|
9
|
+
import statistic_default, { merge } from "./statistic.mjs";
|
|
10
|
+
import getDefaultComponentToken_default from "./getDefaultComponentToken.mjs";
|
|
11
|
+
import maxmin_default from "./maxmin.mjs";
|
|
12
|
+
import "../../index.mjs";
|
|
13
13
|
import { computed, defineComponent } from "vue";
|
|
14
14
|
|
|
15
15
|
//#region src/cssinjs-utils/util/genStyleUtils.ts
|
|
@@ -72,7 +72,7 @@ function genStyleUtils(config) {
|
|
|
72
72
|
const concatComponent = cells.join("-");
|
|
73
73
|
const mergedLayer = config.layer || { name: "antd" };
|
|
74
74
|
return (prefixCls, rootCls) => {
|
|
75
|
-
const { theme,
|
|
75
|
+
const { theme, hashId, token, cssVar, zeroRuntime } = useToken();
|
|
76
76
|
if (computed(() => {
|
|
77
77
|
return zeroRuntime?.value;
|
|
78
78
|
}).value) return hashId;
|
|
@@ -127,14 +127,14 @@ function genStyleUtils(config) {
|
|
|
127
127
|
};
|
|
128
128
|
}), () => {
|
|
129
129
|
if (options.injectStyle === false) return [];
|
|
130
|
-
const { token: proxyToken, flush } = statistic_default(token);
|
|
131
|
-
const defaultComponentToken = getDefaultComponentToken_default(component,
|
|
130
|
+
const { token: proxyToken, flush } = statistic_default(token.value);
|
|
131
|
+
const defaultComponentToken = getDefaultComponentToken_default(component, proxyToken, getDefaultToken);
|
|
132
132
|
const componentCls = `.${prefixCls.value}`;
|
|
133
|
-
const componentToken = getComponentToken_default(component,
|
|
133
|
+
const componentToken = getComponentToken_default(component, proxyToken, defaultComponentToken, { deprecatedTokens: options.deprecatedTokens });
|
|
134
134
|
if (defaultComponentToken && typeof defaultComponentToken === "object") Object.keys(defaultComponentToken).forEach((key) => {
|
|
135
135
|
defaultComponentToken[key] = `var(${token2CSSVar(key, getCompVarPrefix_default(component, cssVar?.value?.prefix))})`;
|
|
136
136
|
});
|
|
137
|
-
const mergedToken = merge(proxyToken
|
|
137
|
+
const mergedToken = merge(proxyToken, {
|
|
138
138
|
componentCls,
|
|
139
139
|
prefixCls: prefixCls.value,
|
|
140
140
|
iconCls: `.${prefix.value.iconPrefixCls}`,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { Entity } from "./Cache.
|
|
2
|
-
import { ExtractStyle } from "./hooks/useGlobalCache.
|
|
3
|
-
import { CSSVarCacheValue } from "./hooks/useCSSVarRegister.
|
|
1
|
+
import { Entity } from "./Cache.mjs";
|
|
2
|
+
import { ExtractStyle } from "./hooks/useGlobalCache.mjs";
|
|
3
|
+
import { CSSVarCacheValue } from "./hooks/useCSSVarRegister.mjs";
|
|
4
4
|
|
|
5
5
|
//#region src/extractStyle.d.ts
|
|
6
6
|
declare const ExtractStyleFns: {
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import { toStyleStr } from "./util/index.
|
|
2
|
-
import { TOKEN_PREFIX, extract } from "./hooks/useCacheToken.
|
|
3
|
-
import { ATTR_CACHE_MAP, serialize } from "./util/cacheMapUtil.
|
|
4
|
-
import { STYLE_PREFIX, extract as extract$
|
|
5
|
-
import { CSS_VAR_PREFIX, extract as extract$
|
|
1
|
+
import { toStyleStr } from "./util/index.mjs";
|
|
2
|
+
import { TOKEN_PREFIX, extract } from "./hooks/useCacheToken.mjs";
|
|
3
|
+
import { ATTR_CACHE_MAP, serialize } from "./util/cacheMapUtil.mjs";
|
|
4
|
+
import { STYLE_PREFIX, extract as extract$1 } from "./hooks/useStyleRegister.mjs";
|
|
5
|
+
import { CSS_VAR_PREFIX, extract as extract$2 } from "./hooks/useCSSVarRegister.mjs";
|
|
6
6
|
|
|
7
7
|
//#region src/extractStyle.ts
|
|
8
8
|
const ExtractStyleFns = {
|
|
9
|
-
[STYLE_PREFIX]: extract$
|
|
9
|
+
[STYLE_PREFIX]: extract$1,
|
|
10
10
|
[TOKEN_PREFIX]: extract,
|
|
11
|
-
[CSS_VAR_PREFIX]: extract$
|
|
11
|
+
[CSS_VAR_PREFIX]: extract$2
|
|
12
12
|
};
|
|
13
13
|
function isNotNull(value) {
|
|
14
14
|
return value !== null;
|
|
@@ -19,7 +19,7 @@ function extractStyle(cache, options) {
|
|
|
19
19
|
"token",
|
|
20
20
|
"cssVar"
|
|
21
21
|
], once = false } = typeof options === "boolean" ? { plain: options } : options || {};
|
|
22
|
-
const matchPrefixRegexp =
|
|
22
|
+
const matchPrefixRegexp = new RegExp(`^(${(typeof types === "string" ? [types] : types).join("|")})%`);
|
|
23
23
|
const styleKeys = Array.from(cache.cache.keys()).filter((key) => matchPrefixRegexp.test(key));
|
|
24
24
|
const effectStyles = {};
|
|
25
25
|
const cachePathMap = {};
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { collectStyleText } from "../ssr/styleCollector.
|
|
2
|
-
import { ATTR_MARK, ATTR_TOKEN, CSS_IN_JS_INSTANCE, useStyleContext } from "../StyleContext.
|
|
3
|
-
import { transformToken } from "../util/css-variables.
|
|
4
|
-
import { isClientSide, toStyleStr } from "../util/index.
|
|
5
|
-
import { useGlobalCache } from "./useGlobalCache.
|
|
6
|
-
import { uniqueHash } from "./useStyleRegister.
|
|
1
|
+
import { collectStyleText } from "../ssr/styleCollector.mjs";
|
|
2
|
+
import { ATTR_MARK, ATTR_TOKEN, CSS_IN_JS_INSTANCE, useStyleContext } from "../StyleContext.mjs";
|
|
3
|
+
import { transformToken } from "../util/css-variables.mjs";
|
|
4
|
+
import { isClientSide, toStyleStr } from "../util/index.mjs";
|
|
5
|
+
import { useGlobalCache } from "./useGlobalCache.mjs";
|
|
6
|
+
import { uniqueHash } from "./useStyleRegister.mjs";
|
|
7
7
|
import canUseDom from "@v-c/util/dist/Dom/canUseDom";
|
|
8
8
|
import { removeCSS, updateCSS } from "@v-c/util/dist/Dom/dynamicCSS";
|
|
9
9
|
import { computed } from "vue";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Theme } from "../theme/Theme.
|
|
2
|
-
import "./useGlobalCache.
|
|
1
|
+
import { Theme } from "../theme/Theme.mjs";
|
|
2
|
+
import "./useGlobalCache.mjs";
|
|
3
3
|
import { Ref } from "vue";
|
|
4
4
|
|
|
5
5
|
//#region src/hooks/useCacheToken.d.ts
|
|
@@ -33,16 +33,11 @@ interface Option<DerivativeToken, DesignToken> {
|
|
|
33
33
|
* Transform token to css variables.
|
|
34
34
|
*/
|
|
35
35
|
cssVar: {
|
|
36
|
-
hashed?: boolean;
|
|
37
|
-
/**
|
|
38
|
-
|
|
39
|
-
/** Tokens that
|
|
40
|
-
|
|
41
|
-
/** Tokens that should not be transformed to css variables */
|
|
42
|
-
ignore?: Record<string, boolean>;
|
|
43
|
-
/** Tokens that preserves origin value */
|
|
44
|
-
preserve?: Record<string, boolean>;
|
|
45
|
-
/** Key for current theme. Useful for customizing and should be unique */
|
|
36
|
+
hashed?: boolean; /** Prefix for css variables */
|
|
37
|
+
prefix?: string; /** Tokens that should not be appended with unit */
|
|
38
|
+
unitless?: Record<string, boolean>; /** Tokens that should not be transformed to css variables */
|
|
39
|
+
ignore?: Record<string, boolean>; /** Tokens that preserves origin value */
|
|
40
|
+
preserve?: Record<string, boolean>; /** Key for current theme. Useful for customizing and should be unique */
|
|
46
41
|
key: string;
|
|
47
42
|
};
|
|
48
43
|
}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { collectStyleText } from "../ssr/styleCollector.
|
|
2
|
-
import { ATTR_MARK, ATTR_TOKEN, CSS_IN_JS_INSTANCE, useStyleContext } from "../StyleContext.
|
|
3
|
-
import
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import
|
|
1
|
+
import { collectStyleText } from "../ssr/styleCollector.mjs";
|
|
2
|
+
import { ATTR_MARK, ATTR_TOKEN, CSS_IN_JS_INSTANCE, useStyleContext } from "../StyleContext.mjs";
|
|
3
|
+
import resolveHash_default from "../util/resolveHash.mjs";
|
|
4
|
+
import { transformToken } from "../util/css-variables.mjs";
|
|
5
|
+
import { flattenToken, memoResult, toStyleStr, token2key } from "../util/index.mjs";
|
|
6
|
+
import { useGlobalCache } from "./useGlobalCache.mjs";
|
|
7
7
|
import canUseDom from "@v-c/util/dist/Dom/canUseDom";
|
|
8
8
|
import { updateCSS } from "@v-c/util/dist/Dom/dynamicCSS";
|
|
9
9
|
import { computed } from "vue";
|
|
@@ -85,7 +85,7 @@ function useCacheToken(theme, tokens, option) {
|
|
|
85
85
|
const mergedDerivativeToken = compute.value ? compute.value(mergedToken.value, override.value, theme.value) : getComputedToken(mergedToken.value, override.value, theme.value, formatToken.value);
|
|
86
86
|
const actualToken = { ...mergedDerivativeToken };
|
|
87
87
|
const mergedSalt = `${salt.value}_${cssVar.value.prefix || ""}`;
|
|
88
|
-
const hashId =
|
|
88
|
+
const hashId = resolveHash_default(mergedSalt);
|
|
89
89
|
const hashCls = `${hashPrefix}-${hashId}`;
|
|
90
90
|
actualToken._tokenKey = token2key(actualToken, mergedSalt);
|
|
91
91
|
const [tokenWithCssVar, cssVarsStr] = transformToken(mergedDerivativeToken, cssVar.value.key, {
|
|
@@ -118,7 +118,7 @@ function useCacheToken(theme, tokens, option) {
|
|
|
118
118
|
return;
|
|
119
119
|
}
|
|
120
120
|
if (!cssVarsStr) return;
|
|
121
|
-
const style = updateCSS(cssVarsStr,
|
|
121
|
+
const style = updateCSS(cssVarsStr, resolveHash_default(`css-var-${themeKey}`), {
|
|
122
122
|
mark: ATTR_MARK,
|
|
123
123
|
prepend: "queue",
|
|
124
124
|
attachTo: styleContext.value.container,
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { pathKey } from "../Cache.
|
|
2
|
-
import { useStyleContext } from "../StyleContext.
|
|
1
|
+
import { pathKey } from "../Cache.mjs";
|
|
2
|
+
import { useStyleContext } from "../StyleContext.mjs";
|
|
3
|
+
import { isClientSide } from "../util/index.mjs";
|
|
3
4
|
import { computed, watch } from "vue";
|
|
4
5
|
|
|
5
6
|
//#region src/hooks/useGlobalCache.ts
|
|
@@ -48,7 +49,9 @@ function useGlobalCache(prefix, keyPath, cacheFn, onCacheRemove, onCacheEffect)
|
|
|
48
49
|
});
|
|
49
50
|
}
|
|
50
51
|
const globalCache = styleContext.value.cache;
|
|
52
|
+
const isServerSide = styleContext.value.mock !== void 0 ? styleContext.value.mock === "server" : !isClientSide;
|
|
51
53
|
onCleanup(() => {
|
|
54
|
+
if (isServerSide) return;
|
|
52
55
|
globalCache.opUpdate(currentPath, (prevCache) => {
|
|
53
56
|
const [times = 0, cache] = prevCache || [];
|
|
54
57
|
if (times - 1 === 0) {
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { Theme } from "../theme/Theme.
|
|
2
|
-
import { Keyframe } from "../Keyframes.
|
|
3
|
-
import "../linters/index.
|
|
4
|
-
import "../StyleContext.
|
|
5
|
-
import "../transformers/interface.
|
|
6
|
-
import "./useGlobalCache.
|
|
1
|
+
import { Theme } from "../theme/Theme.mjs";
|
|
2
|
+
import { Keyframe } from "../Keyframes.mjs";
|
|
3
|
+
import "../linters/index.mjs";
|
|
4
|
+
import "../StyleContext.mjs";
|
|
5
|
+
import "../transformers/interface.mjs";
|
|
6
|
+
import "./useGlobalCache.mjs";
|
|
7
7
|
import { Ref } from "vue";
|
|
8
8
|
import * as CSS from "csstype";
|
|
9
9
|
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import { ATTR_CACHE_PATH, ATTR_MARK, CSS_IN_JS_INSTANCE, useStyleContext } from "../StyleContext.
|
|
2
|
-
import
|
|
3
|
-
import {
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import "../linters/
|
|
7
|
-
import
|
|
8
|
-
import
|
|
1
|
+
import { ATTR_CACHE_PATH, ATTR_MARK, CSS_IN_JS_INSTANCE, useStyleContext } from "../StyleContext.mjs";
|
|
2
|
+
import resolveHash_default from "../util/resolveHash.mjs";
|
|
3
|
+
import { isClientSide, isNonNullable, toStyleStr, where } from "../util/index.mjs";
|
|
4
|
+
import { useGlobalCache } from "./useGlobalCache.mjs";
|
|
5
|
+
import contentQuotesLinter_default from "../linters/contentQuotesLinter.mjs";
|
|
6
|
+
import hashedAnimationLinter_default from "../linters/hashedAnimationLinter.mjs";
|
|
7
|
+
import "../linters/index.mjs";
|
|
8
|
+
import { CSS_FILE_STYLE, existPath, getStyleAndHash } from "../util/cacheMapUtil.mjs";
|
|
9
|
+
import resolveUnitless_default from "../util/resolveUnitless.mjs";
|
|
9
10
|
import { removeCSS, updateCSS } from "@v-c/util/dist/Dom/dynamicCSS";
|
|
10
11
|
import { computed } from "vue";
|
|
11
|
-
import unitless from "@emotion/unitless";
|
|
12
12
|
import { compile, middleware, prefixer, serialize, stringify } from "stylis";
|
|
13
13
|
|
|
14
14
|
//#region src/hooks/useStyleRegister.ts
|
|
@@ -101,7 +101,7 @@ function parseStyle(interpolation, config = {}, { root, injectHash, parentSelect
|
|
|
101
101
|
}));
|
|
102
102
|
const styleName = cssKey.replace(/[A-Z]/g, (match) => `-${match.toLowerCase()}`);
|
|
103
103
|
let formatValue = cssValue;
|
|
104
|
-
if (!
|
|
104
|
+
if (!resolveUnitless_default[cssKey] && typeof formatValue === "number" && formatValue !== 0) formatValue = `${formatValue}px`;
|
|
105
105
|
if (cssKey === "animationName" && cssValue?._keyframe) {
|
|
106
106
|
parseKeyframes(cssValue);
|
|
107
107
|
formatValue = cssValue.getName(hashId);
|
|
@@ -125,7 +125,7 @@ function parseStyle(interpolation, config = {}, { root, injectHash, parentSelect
|
|
|
125
125
|
return [styleStr, effectStyle];
|
|
126
126
|
}
|
|
127
127
|
function uniqueHash(path, styleStr) {
|
|
128
|
-
return
|
|
128
|
+
return resolveHash_default(`${path.join("%")}${styleStr}`);
|
|
129
129
|
}
|
|
130
130
|
const STYLE_PREFIX = "style";
|
|
131
131
|
function useStyleRegister(info, styleFn) {
|
|
@@ -180,11 +180,11 @@ function useStyleRegister(info, styleFn) {
|
|
|
180
180
|
}, (cacheValue) => {
|
|
181
181
|
const [styleStr, styleId, effectStyle, , priority] = cacheValue;
|
|
182
182
|
if (!isMergedClientSide.value || styleStr === CSS_FILE_STYLE) return;
|
|
183
|
-
const { layer: enableLayer
|
|
183
|
+
const { layer: enableLayer, container, autoPrefix, cache } = styleContext.value;
|
|
184
184
|
const { nonce } = info.value;
|
|
185
185
|
const mergedCSSConfig = {
|
|
186
186
|
mark: ATTR_MARK,
|
|
187
|
-
prepend: enableLayer
|
|
187
|
+
prepend: enableLayer ? false : "queue",
|
|
188
188
|
attachTo: container,
|
|
189
189
|
priority
|
|
190
190
|
};
|
|
@@ -1,31 +1,31 @@
|
|
|
1
|
-
import { AbstractCalculator } from "./theme/calc/calculator.
|
|
2
|
-
import { genCalc } from "./theme/calc/index.
|
|
3
|
-
import { DerivativeFunc, TokenType } from "./theme/interface.
|
|
4
|
-
import { Theme } from "./theme/Theme.
|
|
5
|
-
import { createTheme } from "./theme/createTheme.
|
|
6
|
-
import { ComponentToken, ComponentTokenKey, GlobalToken, GlobalTokenWithComponent, OverrideTokenMap, TokenMap, TokenMapKey } from "./cssinjs-utils/interface/components.
|
|
7
|
-
import { Keyframe } from "./Keyframes.
|
|
8
|
-
import { Linter } from "./linters/interface.
|
|
9
|
-
import { linter as linter$1 } from "./linters/legacyNotSelectorLinter.
|
|
10
|
-
import { linter as linter$2 } from "./linters/logicalPropertiesLinter.
|
|
11
|
-
import { linter } from "./linters/NaNLinter.
|
|
12
|
-
import { linter as linter$3 } from "./linters/parentSelectorLinter.
|
|
13
|
-
import "./linters/index.
|
|
14
|
-
import { StyleProvider, StyleProviderProps, createCache, provideStyleContext, useStyleContext, useStyleContextProvide } from "./StyleContext.
|
|
15
|
-
import { Transformer } from "./transformers/interface.
|
|
16
|
-
import { CSSInterpolation, CSSObject, useStyleRegister } from "./hooks/useStyleRegister.
|
|
17
|
-
import { token2CSSVar } from "./util/css-variables.
|
|
18
|
-
import { useCSSVarRegister } from "./hooks/useCSSVarRegister.
|
|
19
|
-
import { extractStyle } from "./extractStyle.
|
|
20
|
-
import { getComputedToken, useCacheToken } from "./hooks/useCacheToken.
|
|
21
|
-
import { collectStyleText, setStyleCollector } from "./ssr/styleCollector.
|
|
22
|
-
import { transform } from "./transformers/autoPrefix.
|
|
23
|
-
import { transform as transform$1 } from "./transformers/legacyLogicalProperties.
|
|
24
|
-
import { transform as transform$2 } from "./transformers/px2rem.
|
|
25
|
-
import { unit } from "./util/index.
|
|
26
|
-
import { CSSUtil, CSSVarRegisterProps, FullToken, GenStyleFn, GetCompUnitless, GetDefaultToken, GetDefaultTokenFn, GetResetStyles, StyleInfo, SubStyleComponentProps, TokenWithCommonCls, genStyleUtils } from "./cssinjs-utils/util/genStyleUtils.
|
|
27
|
-
import { merge, statistic, statisticToken } from "./cssinjs-utils/util/statistic.
|
|
28
|
-
import "./cssinjs-utils/index.
|
|
1
|
+
import { AbstractCalculator } from "./theme/calc/calculator.mjs";
|
|
2
|
+
import { genCalc } from "./theme/calc/index.mjs";
|
|
3
|
+
import { DerivativeFunc, TokenType } from "./theme/interface.mjs";
|
|
4
|
+
import { Theme } from "./theme/Theme.mjs";
|
|
5
|
+
import { createTheme } from "./theme/createTheme.mjs";
|
|
6
|
+
import { ComponentToken, ComponentTokenKey, GlobalToken, GlobalTokenWithComponent, OverrideTokenMap, TokenMap, TokenMapKey } from "./cssinjs-utils/interface/components.mjs";
|
|
7
|
+
import { Keyframe } from "./Keyframes.mjs";
|
|
8
|
+
import { Linter } from "./linters/interface.mjs";
|
|
9
|
+
import { linter as linter$1 } from "./linters/legacyNotSelectorLinter.mjs";
|
|
10
|
+
import { linter as linter$2 } from "./linters/logicalPropertiesLinter.mjs";
|
|
11
|
+
import { linter } from "./linters/NaNLinter.mjs";
|
|
12
|
+
import { linter as linter$3 } from "./linters/parentSelectorLinter.mjs";
|
|
13
|
+
import "./linters/index.mjs";
|
|
14
|
+
import { StyleProvider, StyleProviderProps, createCache, provideStyleContext, useStyleContext, useStyleContextProvide } from "./StyleContext.mjs";
|
|
15
|
+
import { Transformer } from "./transformers/interface.mjs";
|
|
16
|
+
import { CSSInterpolation, CSSObject, useStyleRegister } from "./hooks/useStyleRegister.mjs";
|
|
17
|
+
import { token2CSSVar } from "./util/css-variables.mjs";
|
|
18
|
+
import { useCSSVarRegister } from "./hooks/useCSSVarRegister.mjs";
|
|
19
|
+
import { extractStyle } from "./extractStyle.mjs";
|
|
20
|
+
import { getComputedToken, useCacheToken } from "./hooks/useCacheToken.mjs";
|
|
21
|
+
import { collectStyleText, setStyleCollector } from "./ssr/styleCollector.mjs";
|
|
22
|
+
import { transform } from "./transformers/autoPrefix.mjs";
|
|
23
|
+
import { transform as transform$1 } from "./transformers/legacyLogicalProperties.mjs";
|
|
24
|
+
import { transform as transform$2 } from "./transformers/px2rem.mjs";
|
|
25
|
+
import { unit } from "./util/index.mjs";
|
|
26
|
+
import { CSSUtil, CSSVarRegisterProps, FullToken, GenStyleFn, GetCompUnitless, GetDefaultToken, GetDefaultTokenFn, GetResetStyles, StyleInfo, SubStyleComponentProps, TokenWithCommonCls, genStyleUtils } from "./cssinjs-utils/util/genStyleUtils.mjs";
|
|
27
|
+
import { merge, statistic, statisticToken } from "./cssinjs-utils/util/statistic.mjs";
|
|
28
|
+
import "./cssinjs-utils/index.mjs";
|
|
29
29
|
|
|
30
30
|
//#region src/index.d.ts
|
|
31
31
|
declare const _experimental: {
|
|
@@ -1,27 +1,27 @@
|
|
|
1
|
-
import { collectStyleText, setStyleCollector } from "./ssr/styleCollector.
|
|
2
|
-
import autoPrefix_default from "./transformers/autoPrefix.
|
|
3
|
-
import { StyleProvider, createCache, provideStyleContext, useStyleContext, useStyleContextProvide } from "./StyleContext.
|
|
4
|
-
import calc_default from "./theme/calc/index.
|
|
5
|
-
import Theme from "./theme/Theme.
|
|
6
|
-
import createTheme from "./theme/createTheme.
|
|
7
|
-
import "./theme/index.
|
|
8
|
-
import { token2CSSVar } from "./util/css-variables.
|
|
9
|
-
import { supportLogicProps, supportWhere, unit } from "./util/index.
|
|
10
|
-
import useCacheToken, { getComputedToken } from "./hooks/useCacheToken.
|
|
11
|
-
import legacyNotSelectorLinter_default from "./linters/legacyNotSelectorLinter.
|
|
12
|
-
import logicalPropertiesLinter_default from "./linters/logicalPropertiesLinter.
|
|
13
|
-
import NaNLinter_default from "./linters/NaNLinter.
|
|
14
|
-
import parentSelectorLinter_default from "./linters/parentSelectorLinter.
|
|
15
|
-
import "./linters/index.
|
|
16
|
-
import useStyleRegister from "./hooks/useStyleRegister.
|
|
17
|
-
import useCSSVarRegister from "./hooks/useCSSVarRegister.
|
|
18
|
-
import extractStyle from "./extractStyle.
|
|
19
|
-
import Keyframes_default from "./Keyframes.
|
|
20
|
-
import legacyLogicalProperties_default from "./transformers/legacyLogicalProperties.
|
|
21
|
-
import px2rem_default from "./transformers/px2rem.
|
|
22
|
-
import statistic_default, { merge, statistic } from "./cssinjs-utils/util/statistic.
|
|
23
|
-
import genStyleUtils_default from "./cssinjs-utils/util/genStyleUtils.
|
|
24
|
-
import "./cssinjs-utils/index.
|
|
1
|
+
import { collectStyleText, setStyleCollector } from "./ssr/styleCollector.mjs";
|
|
2
|
+
import autoPrefix_default from "./transformers/autoPrefix.mjs";
|
|
3
|
+
import { StyleProvider, createCache, provideStyleContext, useStyleContext, useStyleContextProvide } from "./StyleContext.mjs";
|
|
4
|
+
import calc_default from "./theme/calc/index.mjs";
|
|
5
|
+
import Theme from "./theme/Theme.mjs";
|
|
6
|
+
import createTheme from "./theme/createTheme.mjs";
|
|
7
|
+
import "./theme/index.mjs";
|
|
8
|
+
import { token2CSSVar } from "./util/css-variables.mjs";
|
|
9
|
+
import { supportLogicProps, supportWhere, unit } from "./util/index.mjs";
|
|
10
|
+
import useCacheToken, { getComputedToken } from "./hooks/useCacheToken.mjs";
|
|
11
|
+
import legacyNotSelectorLinter_default from "./linters/legacyNotSelectorLinter.mjs";
|
|
12
|
+
import logicalPropertiesLinter_default from "./linters/logicalPropertiesLinter.mjs";
|
|
13
|
+
import NaNLinter_default from "./linters/NaNLinter.mjs";
|
|
14
|
+
import parentSelectorLinter_default from "./linters/parentSelectorLinter.mjs";
|
|
15
|
+
import "./linters/index.mjs";
|
|
16
|
+
import useStyleRegister from "./hooks/useStyleRegister.mjs";
|
|
17
|
+
import useCSSVarRegister from "./hooks/useCSSVarRegister.mjs";
|
|
18
|
+
import extractStyle from "./extractStyle.mjs";
|
|
19
|
+
import Keyframes_default from "./Keyframes.mjs";
|
|
20
|
+
import legacyLogicalProperties_default from "./transformers/legacyLogicalProperties.mjs";
|
|
21
|
+
import px2rem_default from "./transformers/px2rem.mjs";
|
|
22
|
+
import statistic_default, { merge, statistic } from "./cssinjs-utils/util/statistic.mjs";
|
|
23
|
+
import genStyleUtils_default from "./cssinjs-utils/util/genStyleUtils.mjs";
|
|
24
|
+
import "./cssinjs-utils/index.mjs";
|
|
25
25
|
|
|
26
26
|
//#region src/index.ts
|
|
27
27
|
const _experimental = { supportModernCSS: () => supportWhere() && supportLogicProps() };
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { Linter } from "./interface.mjs";
|
|
2
|
+
import { linter } from "./legacyNotSelectorLinter.mjs";
|
|
3
|
+
import { linter as linter$1 } from "./logicalPropertiesLinter.mjs";
|
|
4
|
+
import { linter as linter$2 } from "./NaNLinter.mjs";
|
|
5
|
+
import { linter as linter$3 } from "./parentSelectorLinter.mjs";
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import contentQuotesLinter_default from "./contentQuotesLinter.
|
|
2
|
-
import hashedAnimationLinter_default from "./hashedAnimationLinter.
|
|
3
|
-
import legacyNotSelectorLinter_default from "./legacyNotSelectorLinter.
|
|
4
|
-
import logicalPropertiesLinter_default from "./logicalPropertiesLinter.
|
|
5
|
-
import NaNLinter_default from "./NaNLinter.
|
|
6
|
-
import parentSelectorLinter_default from "./parentSelectorLinter.
|
|
1
|
+
import contentQuotesLinter_default from "./contentQuotesLinter.mjs";
|
|
2
|
+
import hashedAnimationLinter_default from "./hashedAnimationLinter.mjs";
|
|
3
|
+
import legacyNotSelectorLinter_default from "./legacyNotSelectorLinter.mjs";
|
|
4
|
+
import logicalPropertiesLinter_default from "./logicalPropertiesLinter.mjs";
|
|
5
|
+
import NaNLinter_default from "./NaNLinter.mjs";
|
|
6
|
+
import parentSelectorLinter_default from "./parentSelectorLinter.mjs";
|
|
7
7
|
|
|
8
8
|
export { };
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import { DerivativeFunc, TokenType } from "./interface.
|
|
1
|
+
import { DerivativeFunc, TokenType } from "./interface.mjs";
|
|
2
2
|
|
|
3
3
|
//#region src/theme/Theme.d.ts
|
|
4
|
-
|
|
5
4
|
/**
|
|
6
5
|
* Theme with algorithms to derive tokens from design tokens.
|
|
7
6
|
* Use `createTheme` first which will help to manage the theme instance cache.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { AbstractCalculator } from "./calculator.
|
|
2
|
-
import { CSSCalculator } from "./CSSCalculator.
|
|
3
|
-
import { NumCalculator } from "./NumCalculator.
|
|
1
|
+
import { AbstractCalculator } from "./calculator.mjs";
|
|
2
|
+
import { CSSCalculator } from "./CSSCalculator.mjs";
|
|
3
|
+
import { NumCalculator } from "./NumCalculator.mjs";
|
|
4
4
|
|
|
5
5
|
//#region src/theme/calc/index.d.ts
|
|
6
6
|
declare function genCalc(type: 'css' | 'js', unitlessCssVar: Set<string>): (num: number | string | AbstractCalculator) => CSSCalculator | NumCalculator;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import CSSCalculator from "./CSSCalculator.
|
|
2
|
-
import NumCalculator from "./NumCalculator.
|
|
1
|
+
import CSSCalculator from "./CSSCalculator.mjs";
|
|
2
|
+
import NumCalculator from "./NumCalculator.mjs";
|
|
3
3
|
|
|
4
4
|
//#region src/theme/calc/index.ts
|
|
5
5
|
function genCalc(type, unitlessCssVar) {
|
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import { DerivativeFunc, TokenType } from "./interface.
|
|
2
|
-
import { Theme } from "./Theme.
|
|
1
|
+
import { DerivativeFunc, TokenType } from "./interface.mjs";
|
|
2
|
+
import { Theme } from "./Theme.mjs";
|
|
3
3
|
|
|
4
4
|
//#region src/theme/createTheme.d.ts
|
|
5
|
-
|
|
6
5
|
/**
|
|
7
6
|
* Same as new Theme, but will always return same one if `derivative` not changed.
|
|
8
7
|
*/
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import { Transformer } from "./interface.
|
|
1
|
+
import { Transformer } from "./interface.mjs";
|
|
2
2
|
|
|
3
3
|
//#region src/transformers/legacyLogicalProperties.d.ts
|
|
4
|
-
|
|
5
4
|
/**
|
|
6
5
|
* Convert css logical properties to legacy properties.
|
|
7
6
|
* Such as: `margin-block-start` to `margin-top`.
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import unitless from "@emotion/unitless";
|
|
2
2
|
|
|
3
3
|
//#region src/transformers/px2rem.ts
|
|
4
|
+
/**
|
|
5
|
+
* respect https://github.com/cuth/postcss-pxtorem
|
|
6
|
+
*/
|
|
4
7
|
const pxRegex = /url\([^)]+\)|var\([^)]+\)|(\d+(?:\.\d+)?|\.\d+)px/g;
|
|
5
8
|
function toFixed(number, precision) {
|
|
6
9
|
const multiplier = 10 ** (precision + 1);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ATTR_MARK } from "../StyleContext.
|
|
1
|
+
import { ATTR_MARK } from "../StyleContext.mjs";
|
|
2
2
|
import canUseDom from "@v-c/util/dist/Dom/canUseDom";
|
|
3
3
|
|
|
4
4
|
//#region src/util/cacheMapUtil.ts
|
|
@@ -8,9 +8,9 @@ const ATTR_CACHE_MAP = "data-ant-cssinjs-cache-path";
|
|
|
8
8
|
* Which means not exist in `<style />` tag.
|
|
9
9
|
*/
|
|
10
10
|
const CSS_FILE_STYLE = "_FILE_STYLE__";
|
|
11
|
-
function serialize(cachePathMap
|
|
12
|
-
return Object.keys(cachePathMap
|
|
13
|
-
return `${path}:${cachePathMap
|
|
11
|
+
function serialize(cachePathMap) {
|
|
12
|
+
return Object.keys(cachePathMap).map((path) => {
|
|
13
|
+
return `${path}:${cachePathMap[path]}`;
|
|
14
14
|
}).join(";");
|
|
15
15
|
}
|
|
16
16
|
let cachePathMap;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { ATTR_MARK, ATTR_TOKEN } from "../StyleContext.
|
|
2
|
-
import Theme from "../theme/Theme.
|
|
3
|
-
import "../theme/index.
|
|
4
|
-
import
|
|
5
|
-
import
|
|
1
|
+
import { ATTR_MARK, ATTR_TOKEN } from "../StyleContext.mjs";
|
|
2
|
+
import Theme from "../theme/Theme.mjs";
|
|
3
|
+
import "../theme/index.mjs";
|
|
4
|
+
import resolveHash_default from "./resolveHash.mjs";
|
|
5
|
+
import { token2CSSVar } from "./css-variables.mjs";
|
|
6
6
|
import canUseDom from "@v-c/util/dist/Dom/canUseDom";
|
|
7
7
|
import { removeCSS, updateCSS } from "@v-c/util/dist/Dom/dynamicCSS";
|
|
8
8
|
|
|
@@ -33,7 +33,7 @@ function flattenToken(token) {
|
|
|
33
33
|
else if (value && typeof value === "object") str += flattenToken(value);
|
|
34
34
|
else str += value;
|
|
35
35
|
});
|
|
36
|
-
str =
|
|
36
|
+
str = resolveHash_default(str);
|
|
37
37
|
flattenTokenCache.set(token, str);
|
|
38
38
|
}
|
|
39
39
|
return str;
|
|
@@ -42,7 +42,7 @@ function flattenToken(token) {
|
|
|
42
42
|
* Convert derivative token to key string
|
|
43
43
|
*/
|
|
44
44
|
function token2key(token, salt) {
|
|
45
|
-
return
|
|
45
|
+
return resolveHash_default(`${salt}_${flattenToken(token)}`);
|
|
46
46
|
}
|
|
47
47
|
const randomSelectorKey = `random-${Date.now()}-${Math.random()}`.replace(/\./g, "");
|
|
48
48
|
const checkContent = "_bAmBoO_";
|
package/package.json
CHANGED
|
@@ -1,23 +1,23 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@antdv-next/cssinjs",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "1.0.0-
|
|
4
|
+
"version": "1.0.0-rc.1",
|
|
5
5
|
"description": "cssinjs solution for ant-design-vue",
|
|
6
6
|
"exports": {
|
|
7
7
|
".": {
|
|
8
|
-
"types": "./dist/index.d.
|
|
9
|
-
"import": "./dist/index.
|
|
10
|
-
"default": "./dist/index.
|
|
8
|
+
"types": "./dist/index.d.mts",
|
|
9
|
+
"import": "./dist/index.mjs",
|
|
10
|
+
"default": "./dist/index.mjs"
|
|
11
11
|
},
|
|
12
12
|
"./cssinjs-utils": {
|
|
13
|
-
"types": "./dist/cssinjs-utils/index.d.
|
|
14
|
-
"import": "./dist/cssinjs-utils/index.
|
|
15
|
-
"default": "./dist/cssinjs-utils/index.
|
|
13
|
+
"types": "./dist/cssinjs-utils/index.d.mts",
|
|
14
|
+
"import": "./dist/cssinjs-utils/index.mjs",
|
|
15
|
+
"default": "./dist/cssinjs-utils/index.mjs"
|
|
16
16
|
},
|
|
17
17
|
"./dist/*": {
|
|
18
|
-
"types": "./dist/*.d.
|
|
19
|
-
"import": "./dist/*.
|
|
20
|
-
"default": "./dist/*.
|
|
18
|
+
"types": "./dist/*.d.mts",
|
|
19
|
+
"import": "./dist/*.mjs",
|
|
20
|
+
"default": "./dist/*.mjs"
|
|
21
21
|
}
|
|
22
22
|
},
|
|
23
23
|
"files": [
|
|
@@ -30,18 +30,18 @@
|
|
|
30
30
|
"dependencies": {
|
|
31
31
|
"@emotion/hash": "^0.8.0",
|
|
32
32
|
"@emotion/unitless": "^0.7.5",
|
|
33
|
-
"@v-c/util": "^1.0.
|
|
33
|
+
"@v-c/util": "^1.0.9",
|
|
34
34
|
"csstype": "^3.2.3",
|
|
35
35
|
"defu": "^6.1.4",
|
|
36
36
|
"stylis": "^4.3.6"
|
|
37
37
|
},
|
|
38
38
|
"devDependencies": {
|
|
39
|
-
"@testing-library/jest-dom": "^
|
|
40
|
-
"@types/node": "^
|
|
39
|
+
"@testing-library/jest-dom": "^6.9.1",
|
|
40
|
+
"@types/node": "^25.0.10",
|
|
41
41
|
"@types/stylis": "^4.2.7",
|
|
42
|
-
"@types/testing-library__jest-dom": "^
|
|
42
|
+
"@types/testing-library__jest-dom": "^6.0.0",
|
|
43
43
|
"@vue/test-utils": "^2.4.6",
|
|
44
|
-
"vue": "^3.5.
|
|
44
|
+
"vue": "^3.5.27"
|
|
45
45
|
},
|
|
46
46
|
"scripts": {
|
|
47
47
|
"test": "vitest run",
|
package/dist/linters/index.d.ts
DELETED
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import { Linter } from "./interface.js";
|
|
2
|
-
import { linter } from "./legacyNotSelectorLinter.js";
|
|
3
|
-
import { linter as linter$1 } from "./logicalPropertiesLinter.js";
|
|
4
|
-
import { linter as linter$2 } from "./NaNLinter.js";
|
|
5
|
-
import { linter as linter$3 } from "./parentSelectorLinter.js";
|
package/dist/theme/index.js
DELETED
package/dist/util/index.d.ts
DELETED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|