@antdv-next/cssinjs 1.0.0-rc.3 → 1.0.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.mts → Cache.d.ts} +2 -1
- package/dist/{Keyframes.d.mts → Keyframes.d.ts} +2 -2
- package/dist/{StyleContext.d.mts → StyleContext.d.ts} +56 -8
- package/dist/{StyleContext.mjs → StyleContext.js} +44 -15
- package/dist/cssinjs-utils/_util/hooks/useUniqueMemo.d.ts +7 -0
- package/dist/cssinjs-utils/hooks/{useCSP.d.mts → useCSP.d.ts} +2 -1
- package/dist/cssinjs-utils/hooks/usePrefix.js +1 -0
- package/dist/cssinjs-utils/hooks/{useToken.d.mts → useToken.d.ts} +4 -4
- package/dist/cssinjs-utils/hooks/useToken.js +1 -0
- package/dist/cssinjs-utils/{index.d.mts → index.d.ts} +3 -3
- package/dist/cssinjs-utils/{index.mjs → index.js} +2 -2
- package/dist/cssinjs-utils/interface/{components.d.mts → components.d.ts} +1 -1
- package/dist/cssinjs-utils/interface/components.js +1 -0
- package/dist/cssinjs-utils/interface/index.d.ts +2 -0
- package/dist/cssinjs-utils/interface/index.js +1 -0
- package/dist/cssinjs-utils/util/{genStyleUtils.d.mts → genStyleUtils.d.ts} +14 -14
- package/dist/cssinjs-utils/util/{genStyleUtils.mjs → genStyleUtils.js} +12 -12
- package/dist/cssinjs-utils/util/getCompVarPrefix.d.ts +4 -0
- package/dist/cssinjs-utils/util/getComponentToken.d.ts +9 -0
- package/dist/cssinjs-utils/util/getDefaultComponentToken.d.ts +8 -0
- package/dist/cssinjs-utils/util/{getDefaultComponentToken.mjs → getDefaultComponentToken.js} +1 -1
- package/dist/cssinjs-utils/util/maxmin.d.ts +10 -0
- package/dist/cssinjs-utils/util/{maxmin.mjs → maxmin.js} +1 -1
- package/dist/cssinjs-utils/util/{statistic.d.mts → statistic.d.ts} +3 -2
- package/dist/cssinjs-utils/util/{statistic.mjs → statistic.js} +2 -1
- package/dist/{extractStyle.d.mts → extractStyle.d.ts} +4 -4
- package/dist/{extractStyle.mjs → extractStyle.js} +5 -5
- package/dist/hooks/{useCSSVarRegister.d.mts → useCSSVarRegister.d.ts} +5 -3
- package/dist/hooks/{useCSSVarRegister.mjs → useCSSVarRegister.js} +7 -7
- package/dist/hooks/{useCacheToken.d.mts → useCacheToken.d.ts} +5 -3
- package/dist/hooks/{useCacheToken.mjs → useCacheToken.js} +7 -7
- package/dist/hooks/useGlobalCache.d.ts +24 -0
- package/dist/hooks/{useGlobalCache.mjs → useGlobalCache.js} +3 -3
- package/dist/hooks/{useStyleRegister.d.mts → useStyleRegister.d.ts} +31 -7
- package/dist/hooks/{useStyleRegister.mjs → useStyleRegister.js} +11 -11
- package/dist/index.d.ts +35 -0
- package/dist/{index.mjs → index.js} +24 -24
- package/dist/linters/{NaNLinter.d.mts → NaNLinter.d.ts} +2 -2
- package/dist/linters/{NaNLinter.mjs → NaNLinter.js} +1 -1
- package/dist/linters/contentQuotesLinter.d.ts +6 -0
- package/dist/linters/{contentQuotesLinter.mjs → contentQuotesLinter.js} +1 -1
- package/dist/linters/hashedAnimationLinter.d.ts +6 -0
- package/dist/linters/{hashedAnimationLinter.mjs → hashedAnimationLinter.js} +1 -1
- package/dist/linters/index.d.ts +8 -0
- package/dist/linters/index.js +8 -0
- package/dist/linters/{interface.d.mts → interface.d.ts} +1 -1
- package/dist/linters/interface.js +1 -0
- package/dist/linters/{legacyNotSelectorLinter.d.mts → legacyNotSelectorLinter.d.ts} +2 -2
- package/dist/linters/{legacyNotSelectorLinter.mjs → legacyNotSelectorLinter.js} +1 -1
- package/dist/linters/{logicalPropertiesLinter.d.mts → logicalPropertiesLinter.d.ts} +2 -2
- package/dist/linters/{logicalPropertiesLinter.mjs → logicalPropertiesLinter.js} +1 -1
- package/dist/linters/{parentSelectorLinter.d.mts → parentSelectorLinter.d.ts} +3 -3
- package/dist/linters/{parentSelectorLinter.mjs → parentSelectorLinter.js} +1 -1
- package/dist/linters/utils.d.ts +6 -0
- package/dist/theme/{Theme.d.mts → Theme.d.ts} +2 -2
- package/dist/theme/ThemeCache.d.ts +23 -0
- package/dist/theme/{ThemeCache.mjs → ThemeCache.js} +1 -1
- package/dist/theme/calc/{CSSCalculator.d.mts → CSSCalculator.d.ts} +2 -2
- package/dist/theme/calc/{CSSCalculator.mjs → CSSCalculator.js} +1 -1
- package/dist/theme/calc/{NumCalculator.d.mts → NumCalculator.d.ts} +2 -2
- package/dist/theme/calc/{NumCalculator.mjs → NumCalculator.js} +1 -1
- package/dist/theme/calc/{calculator.d.mts → calculator.d.ts} +1 -1
- package/dist/theme/calc/index.d.ts +8 -0
- package/dist/theme/calc/{index.mjs → index.js} +2 -2
- package/dist/theme/{createTheme.d.mts → createTheme.d.ts} +3 -3
- package/dist/theme/{createTheme.mjs → createTheme.js} +2 -2
- package/dist/theme/index.d.ts +7 -0
- package/dist/theme/index.js +6 -0
- package/dist/theme/interface.js +1 -0
- package/dist/transformers/autoPrefix.d.ts +7 -0
- package/dist/transformers/{interface.d.mts → interface.d.ts} +2 -2
- package/dist/transformers/interface.js +1 -0
- package/dist/transformers/{legacyLogicalProperties.d.mts → legacyLogicalProperties.d.ts} +2 -2
- package/dist/transformers/{px2rem.d.mts → px2rem.d.ts} +2 -2
- package/dist/util/cacheMapUtil.d.ts +17 -0
- package/dist/util/{cacheMapUtil.mjs → cacheMapUtil.js} +9 -2
- package/dist/util/css-variables.d.ts +21 -0
- package/dist/util/{css-variables.mjs → css-variables.js} +2 -2
- package/dist/util/index.d.ts +26 -0
- package/dist/util/{index.mjs → index.js} +13 -6
- package/dist/util/resolveHash.d.ts +4 -0
- package/dist/util/resolveUnitless.d.ts +4 -0
- package/package.json +16 -11
- package/dist/hooks/useGlobalCache.d.mts +0 -9
- package/dist/index.d.mts +0 -35
- package/dist/linters/index.d.mts +0 -5
- package/dist/linters/index.mjs +0 -8
- package/dist/theme/calc/index.d.mts +0 -8
- package/dist/theme/index.mjs +0 -6
- package/dist/transformers/autoPrefix.d.mts +0 -6
- package/dist/util/css-variables.d.mts +0 -7
- package/dist/util/index.d.mts +0 -7
- /package/dist/{Cache.mjs → Cache.js} +0 -0
- /package/dist/{Keyframes.mjs → Keyframes.js} +0 -0
- /package/dist/cssinjs-utils/_util/hooks/{useUniqueMemo.mjs → useUniqueMemo.js} +0 -0
- /package/dist/cssinjs-utils/hooks/{useCSP.mjs → useCSP.js} +0 -0
- /package/dist/cssinjs-utils/hooks/{usePrefix.d.mts → usePrefix.d.ts} +0 -0
- /package/dist/cssinjs-utils/util/{getCompVarPrefix.mjs → getCompVarPrefix.js} +0 -0
- /package/dist/cssinjs-utils/util/{getComponentToken.mjs → getComponentToken.js} +0 -0
- /package/dist/linters/{utils.mjs → utils.js} +0 -0
- /package/dist/ssr/{styleCollector.d.mts → styleCollector.d.ts} +0 -0
- /package/dist/ssr/{styleCollector.mjs → styleCollector.js} +0 -0
- /package/dist/theme/{Theme.mjs → Theme.js} +0 -0
- /package/dist/theme/calc/{calculator.mjs → calculator.js} +0 -0
- /package/dist/theme/{interface.d.mts → interface.d.ts} +0 -0
- /package/dist/transformers/{autoPrefix.mjs → autoPrefix.js} +0 -0
- /package/dist/transformers/{legacyLogicalProperties.mjs → legacyLogicalProperties.js} +0 -0
- /package/dist/transformers/{px2rem.mjs → px2rem.js} +0 -0
- /package/dist/util/{resolveHash.mjs → resolveHash.js} +0 -0
- /package/dist/util/{resolveUnitless.mjs → resolveUnitless.js} +0 -0
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
type KeyType = string | number;
|
|
3
3
|
type ValueType = [number, any];
|
|
4
4
|
/** Connect key with `SPLIT` */
|
|
5
|
+
declare function pathKey(keys: KeyType[]): string;
|
|
5
6
|
declare class Entity {
|
|
6
7
|
instanceId: string;
|
|
7
8
|
constructor(instanceId: string);
|
|
@@ -18,4 +19,4 @@ declare class Entity {
|
|
|
18
19
|
opUpdate(keyPathStr: string, valueFn: (origin: ValueType | null) => ValueType | null): void;
|
|
19
20
|
}
|
|
20
21
|
//#endregion
|
|
21
|
-
export { Entity,
|
|
22
|
+
export { KeyType, Entity as default, pathKey };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { CSSInterpolation } from "./hooks/useStyleRegister.
|
|
1
|
+
import { CSSInterpolation } from "./hooks/useStyleRegister.js";
|
|
2
2
|
|
|
3
3
|
//#region src/Keyframes.d.ts
|
|
4
4
|
declare class Keyframe {
|
|
@@ -9,4 +9,4 @@ declare class Keyframe {
|
|
|
9
9
|
_keyframe: boolean;
|
|
10
10
|
}
|
|
11
11
|
//#endregion
|
|
12
|
-
export { Keyframe };
|
|
12
|
+
export { Keyframe as default };
|
|
@@ -1,11 +1,15 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import "./linters/
|
|
3
|
-
import
|
|
4
|
-
import * as
|
|
5
|
-
import { App, Ref } from "vue";
|
|
1
|
+
import Entity, { KeyType } from "./Cache.js";
|
|
2
|
+
import { Linter } from "./linters/interface.js";
|
|
3
|
+
import "./linters/index.js";
|
|
4
|
+
import * as vue0 from "vue";
|
|
5
|
+
import { App, PropType, Ref } from "vue";
|
|
6
6
|
|
|
7
7
|
//#region src/StyleContext.d.ts
|
|
8
|
-
declare
|
|
8
|
+
declare const ATTR_TOKEN = "data-token-hash";
|
|
9
|
+
declare const ATTR_MARK = "data-css-hash";
|
|
10
|
+
declare const ATTR_CACHE_PATH = "data-cache-path";
|
|
11
|
+
declare const CSS_IN_JS_INSTANCE = "__cssinjs_instance__";
|
|
12
|
+
declare function createCache(): vue0.Raw<Entity>;
|
|
9
13
|
declare function useStyleContextProvide(props: Ref<StyleContextProps>): void;
|
|
10
14
|
declare function provideStyleContext(app: App, props: Ref<StyleContextProps>): void;
|
|
11
15
|
declare function useStyleContext(): Ref<{
|
|
@@ -104,7 +108,51 @@ interface StyleContextProps {
|
|
|
104
108
|
/** Hardcode here since transformer not support take effect on serialize currently */
|
|
105
109
|
autoPrefix?: boolean;
|
|
106
110
|
}
|
|
111
|
+
declare const styleContextProps: {
|
|
112
|
+
autoClear: {
|
|
113
|
+
type: BooleanConstructor;
|
|
114
|
+
default: undefined;
|
|
115
|
+
};
|
|
116
|
+
mock: {
|
|
117
|
+
type: PropType<"server" | "client">;
|
|
118
|
+
default: undefined;
|
|
119
|
+
};
|
|
120
|
+
cache: {
|
|
121
|
+
type: PropType<Entity>;
|
|
122
|
+
};
|
|
123
|
+
defaultCache: {
|
|
124
|
+
type: BooleanConstructor;
|
|
125
|
+
};
|
|
126
|
+
hashPriority: {
|
|
127
|
+
type: PropType<HashPriority>;
|
|
128
|
+
default: undefined;
|
|
129
|
+
};
|
|
130
|
+
container: {
|
|
131
|
+
type: PropType<Element | ShadowRoot>;
|
|
132
|
+
default: undefined;
|
|
133
|
+
};
|
|
134
|
+
ssrInline: {
|
|
135
|
+
type: BooleanConstructor;
|
|
136
|
+
default: undefined;
|
|
137
|
+
};
|
|
138
|
+
transformers: {
|
|
139
|
+
type: PropType<Transformer[]>;
|
|
140
|
+
default: undefined;
|
|
141
|
+
};
|
|
142
|
+
linters: {
|
|
143
|
+
type: PropType<Linter[]>;
|
|
144
|
+
default: undefined;
|
|
145
|
+
};
|
|
146
|
+
layer: {
|
|
147
|
+
type: BooleanConstructor;
|
|
148
|
+
default: undefined;
|
|
149
|
+
};
|
|
150
|
+
autoPrefix: {
|
|
151
|
+
type: BooleanConstructor;
|
|
152
|
+
default: undefined;
|
|
153
|
+
};
|
|
154
|
+
};
|
|
107
155
|
type StyleProviderProps = StyleContextProps;
|
|
108
|
-
declare const StyleProvider:
|
|
156
|
+
declare const StyleProvider: vue0.DefineSetupFnComponent<Partial<StyleContextProps>, {}, {}, Partial<StyleContextProps> & {}, vue0.PublicProps>;
|
|
109
157
|
//#endregion
|
|
110
|
-
export { StyleProvider, StyleProviderProps, createCache, provideStyleContext, useStyleContext, useStyleContextProvide };
|
|
158
|
+
export { ATTR_CACHE_PATH, ATTR_MARK, ATTR_TOKEN, CSS_IN_JS_INSTANCE, HashPriority, StyleContextProps, StyleProvider, StyleProviderProps, createCache, provideStyleContext, styleContextProps, useStyleContext, useStyleContextProvide };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import Cache_default from "./Cache.
|
|
2
|
-
import { AUTO_PREFIX } from "./transformers/autoPrefix.
|
|
1
|
+
import Cache_default from "./Cache.js";
|
|
2
|
+
import { AUTO_PREFIX } from "./transformers/autoPrefix.js";
|
|
3
3
|
import { computed, defineComponent, inject, markRaw, provide, ref } from "vue";
|
|
4
4
|
|
|
5
5
|
//#region src/StyleContext.ts
|
|
@@ -46,6 +46,46 @@ function provideStyleContext(app, props) {
|
|
|
46
46
|
function useStyleContext() {
|
|
47
47
|
return inject(StyleContextKey, ref(defaultStyleContext));
|
|
48
48
|
}
|
|
49
|
+
const styleContextProps = {
|
|
50
|
+
autoClear: {
|
|
51
|
+
type: Boolean,
|
|
52
|
+
default: void 0
|
|
53
|
+
},
|
|
54
|
+
mock: {
|
|
55
|
+
type: String,
|
|
56
|
+
default: void 0
|
|
57
|
+
},
|
|
58
|
+
cache: { type: Object },
|
|
59
|
+
defaultCache: { type: Boolean },
|
|
60
|
+
hashPriority: {
|
|
61
|
+
type: String,
|
|
62
|
+
default: void 0
|
|
63
|
+
},
|
|
64
|
+
container: {
|
|
65
|
+
type: [Object],
|
|
66
|
+
default: void 0
|
|
67
|
+
},
|
|
68
|
+
ssrInline: {
|
|
69
|
+
type: Boolean,
|
|
70
|
+
default: void 0
|
|
71
|
+
},
|
|
72
|
+
transformers: {
|
|
73
|
+
type: Array,
|
|
74
|
+
default: void 0
|
|
75
|
+
},
|
|
76
|
+
linters: {
|
|
77
|
+
type: Array,
|
|
78
|
+
default: void 0
|
|
79
|
+
},
|
|
80
|
+
layer: {
|
|
81
|
+
type: Boolean,
|
|
82
|
+
default: void 0
|
|
83
|
+
},
|
|
84
|
+
autoPrefix: {
|
|
85
|
+
type: Boolean,
|
|
86
|
+
default: void 0
|
|
87
|
+
}
|
|
88
|
+
};
|
|
49
89
|
const StyleProvider = defineComponent((props, { slots }) => {
|
|
50
90
|
const parentContext = useStyleContext();
|
|
51
91
|
useStyleContextProvide(computed(() => {
|
|
@@ -64,18 +104,7 @@ const StyleProvider = defineComponent((props, { slots }) => {
|
|
|
64
104
|
return () => {
|
|
65
105
|
return slots?.default?.();
|
|
66
106
|
};
|
|
67
|
-
}, { props:
|
|
68
|
-
"cache",
|
|
69
|
-
"hashPriority",
|
|
70
|
-
"defaultCache",
|
|
71
|
-
"autoClear",
|
|
72
|
-
"layer",
|
|
73
|
-
"linters",
|
|
74
|
-
"container",
|
|
75
|
-
"mock",
|
|
76
|
-
"ssrInline",
|
|
77
|
-
"transformers"
|
|
78
|
-
] });
|
|
107
|
+
}, { props: styleContextProps });
|
|
79
108
|
|
|
80
109
|
//#endregion
|
|
81
|
-
export { ATTR_CACHE_PATH, ATTR_MARK, ATTR_TOKEN, CSS_IN_JS_INSTANCE, StyleProvider, createCache, provideStyleContext, useStyleContext, useStyleContextProvide };
|
|
110
|
+
export { ATTR_CACHE_PATH, ATTR_MARK, ATTR_TOKEN, CSS_IN_JS_INSTANCE, StyleProvider, createCache, provideStyleContext, styleContextProps, useStyleContext, useStyleContextProvide };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { TokenType } from "../../theme/interface.
|
|
2
|
-
import
|
|
3
|
-
import { GlobalToken, OverrideTokenMap, TokenMap } from "../interface/components.
|
|
1
|
+
import { TokenType } from "../../theme/interface.js";
|
|
2
|
+
import Theme from "../../theme/Theme.js";
|
|
3
|
+
import { GlobalToken, OverrideTokenMap, TokenMap } from "../interface/components.js";
|
|
4
4
|
import { Ref } from "vue";
|
|
5
5
|
|
|
6
6
|
//#region src/cssinjs-utils/hooks/useToken.d.ts
|
|
@@ -22,4 +22,4 @@ interface UseTokenReturn<CompTokenMap extends TokenMap, AliasToken extends Token
|
|
|
22
22
|
}
|
|
23
23
|
type UseToken<CompTokenMap extends TokenMap, AliasToken extends TokenType, DesignToken extends TokenType> = () => UseTokenReturn<CompTokenMap, AliasToken, DesignToken>;
|
|
24
24
|
//#endregion
|
|
25
|
-
export { UseToken };
|
|
25
|
+
export { TokenMapWithTheme, UseToken, UseTokenReturn };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { };
|
|
@@ -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
|
|
3
|
-
import { merge, statistic
|
|
1
|
+
import { ComponentToken, ComponentTokenKey, GlobalToken, GlobalTokenWithComponent, OverrideTokenMap, TokenMap, TokenMapKey } from "./interface/components.js";
|
|
2
|
+
import genStyleUtils, { CSSUtil, CSSVarRegisterProps, FullToken, GenStyleFn, GetCompUnitless, GetDefaultToken, GetDefaultTokenFn, GetResetStyles, StyleInfo, SubStyleComponentProps, TokenWithCommonCls } from "./util/genStyleUtils.js";
|
|
3
|
+
import statisticToken, { merge, statistic } from "./util/statistic.js";
|
|
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.js";
|
|
2
|
+
import genStyleUtils_default from "./util/genStyleUtils.js";
|
|
3
3
|
|
|
4
4
|
export { genStyleUtils_default as genStyleUtils, merge as mergeToken, statistic, statistic_default as statisticToken };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { };
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { ComponentToken, ComponentTokenKey, GlobalToken, GlobalTokenWithComponent, OverrideTokenMap, TokenMap, TokenMapKey } from "./components.js";
|
|
2
|
+
export { type ComponentToken, type ComponentTokenKey, type GlobalToken, type GlobalTokenWithComponent, type OverrideTokenMap, type TokenMap, type TokenMapKey };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { };
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { TokenType } from "../../theme/interface.
|
|
3
|
-
import { ComponentTokenKey, GlobalTokenWithComponent, TokenMap, TokenMapKey } from "../interface/components.
|
|
4
|
-
import {
|
|
5
|
-
import "
|
|
6
|
-
import {
|
|
7
|
-
import
|
|
8
|
-
import {
|
|
9
|
-
import * as
|
|
1
|
+
import AbstractCalculator from "../../theme/calc/calculator.js";
|
|
2
|
+
import { TokenType } from "../../theme/interface.js";
|
|
3
|
+
import { ComponentTokenKey, GlobalTokenWithComponent, TokenMap, TokenMapKey } from "../interface/components.js";
|
|
4
|
+
import { UseCSP } from "../hooks/useCSP.js";
|
|
5
|
+
import { UsePrefix } from "../hooks/usePrefix.js";
|
|
6
|
+
import { UseToken } from "../hooks/useToken.js";
|
|
7
|
+
import "../../index.js";
|
|
8
|
+
import useStyleRegister, { CSSInterpolation, CSSObject } from "../../hooks/useStyleRegister.js";
|
|
9
|
+
import * as vue2 from "vue";
|
|
10
10
|
import { Ref, UnwrapRef } from "vue";
|
|
11
11
|
|
|
12
12
|
//#region src/cssinjs-utils/util/genStyleUtils.d.ts
|
|
@@ -81,7 +81,7 @@ declare function genStyleUtils<CompTokenMap extends TokenMap, AliasToken extends
|
|
|
81
81
|
* @default true
|
|
82
82
|
*/
|
|
83
83
|
injectStyle?: boolean;
|
|
84
|
-
}) => (prefixCls: Ref<string>, rootCls?: Ref<string | undefined>) => readonly [Ref<string, string>,
|
|
84
|
+
}) => (prefixCls: Ref<string>, rootCls?: Ref<string | undefined>) => readonly [Ref<string, string>, vue2.ComputedRef<string | undefined>];
|
|
85
85
|
genSubStyleComponent: <C extends TokenMapKey<CompTokenMap>>(componentName: C | [C, string], styleFn: GenStyleFn<CompTokenMap, AliasToken, C>, getDefaultToken?: GetDefaultToken<CompTokenMap, AliasToken, C>, options?: {
|
|
86
86
|
resetStyle?: boolean;
|
|
87
87
|
resetFont?: boolean;
|
|
@@ -96,13 +96,13 @@ declare function genStyleUtils<CompTokenMap extends TokenMap, AliasToken extends
|
|
|
96
96
|
order?: number;
|
|
97
97
|
injectStyle?: boolean;
|
|
98
98
|
unitless?: Partial<Record<ComponentTokenKey<CompTokenMap, AliasToken, C>, boolean>>;
|
|
99
|
-
}) =>
|
|
99
|
+
}) => vue2.DefineComponent<vue2.ExtractPropTypes<{
|
|
100
100
|
prefixCls: StringConstructor;
|
|
101
101
|
rootCls: StringConstructor;
|
|
102
|
-
}>, () => null, {}, {}, {},
|
|
102
|
+
}>, () => null, {}, {}, {}, vue2.ComponentOptionsMixin, vue2.ComponentOptionsMixin, {}, string, vue2.PublicProps, Readonly<vue2.ExtractPropTypes<{
|
|
103
103
|
prefixCls: StringConstructor;
|
|
104
104
|
rootCls: StringConstructor;
|
|
105
|
-
}>> & Readonly<{}>, {}, {}, {}, {}, string,
|
|
105
|
+
}>> & Readonly<{}>, {}, {}, {}, {}, string, vue2.ComponentProvideOptions, true, {}, any>;
|
|
106
106
|
genComponentStyleHook: <C extends TokenMapKey<CompTokenMap>>(componentName: C | [C, string], styleFn: GenStyleFn<CompTokenMap, AliasToken, C>, getDefaultToken?: GetDefaultToken<CompTokenMap, AliasToken, C>, options?: {
|
|
107
107
|
resetStyle?: boolean;
|
|
108
108
|
resetFont?: boolean;
|
|
@@ -120,4 +120,4 @@ declare function genStyleUtils<CompTokenMap extends TokenMap, AliasToken extends
|
|
|
120
120
|
}) => (prefixCls: Ref<string>, rootCls?: Ref<string | undefined>) => Ref<string, string>;
|
|
121
121
|
};
|
|
122
122
|
//#endregion
|
|
123
|
-
export { CSSUtil, CSSVarRegisterProps, FullToken, GenStyleFn, GetCompUnitless, GetDefaultToken, GetDefaultTokenFn, GetResetStyles, StyleInfo, SubStyleComponentProps, TokenWithCommonCls, genStyleUtils };
|
|
123
|
+
export { CSSUtil, CSSVarRegisterProps, FullToken, GenStyleFn, GetCompUnitless, GetDefaultToken, GetDefaultTokenFn, GetResetStyles, StyleInfo, SubStyleComponentProps, TokenWithCommonCls, genStyleUtils as default };
|
|
@@ -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.js";
|
|
2
|
+
import { token2CSSVar } from "../../util/css-variables.js";
|
|
3
|
+
import useStyleRegister from "../../hooks/useStyleRegister.js";
|
|
4
|
+
import useCSSVarRegister from "../../hooks/useCSSVarRegister.js";
|
|
5
|
+
import useUniqueMemo_default from "../_util/hooks/useUniqueMemo.js";
|
|
6
|
+
import useCSP_default from "../hooks/useCSP.js";
|
|
7
|
+
import getComponentToken_default from "./getComponentToken.js";
|
|
8
|
+
import getCompVarPrefix_default from "./getCompVarPrefix.js";
|
|
9
|
+
import statistic_default, { merge } from "./statistic.js";
|
|
10
|
+
import getDefaultComponentToken_default from "./getDefaultComponentToken.js";
|
|
11
|
+
import maxmin_default from "./maxmin.js";
|
|
12
|
+
import "../../index.js";
|
|
13
13
|
import { computed, defineComponent } from "vue";
|
|
14
14
|
|
|
15
15
|
//#region src/cssinjs-utils/util/genStyleUtils.ts
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { TokenType } from "../../theme/interface.js";
|
|
2
|
+
import { ComponentTokenKey, GlobalToken, TokenMap, TokenMapKey } from "../interface/components.js";
|
|
3
|
+
|
|
4
|
+
//#region src/cssinjs-utils/util/getComponentToken.d.ts
|
|
5
|
+
declare function getComponentToken<CompTokenMap extends TokenMap, AliasToken extends TokenType, C extends TokenMapKey<CompTokenMap>>(component: C, token: GlobalToken<CompTokenMap, AliasToken>, defaultToken: CompTokenMap[C], options?: {
|
|
6
|
+
deprecatedTokens?: [ComponentTokenKey<CompTokenMap, AliasToken, C>, ComponentTokenKey<CompTokenMap, AliasToken, C>][];
|
|
7
|
+
}): any;
|
|
8
|
+
//#endregion
|
|
9
|
+
export { getComponentToken as default };
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { TokenType } from "../../theme/interface.js";
|
|
2
|
+
import { GlobalToken, TokenMap, TokenMapKey } from "../interface/components.js";
|
|
3
|
+
import { GetDefaultToken } from "./genStyleUtils.js";
|
|
4
|
+
|
|
5
|
+
//#region src/cssinjs-utils/util/getDefaultComponentToken.d.ts
|
|
6
|
+
declare function getDefaultComponentToken<CompTokenMap extends TokenMap, AliasToken extends TokenType, C extends TokenMapKey<CompTokenMap>>(component: C, token: GlobalToken<CompTokenMap, AliasToken>, getDefaultToken: GetDefaultToken<CompTokenMap, AliasToken, C>): CompTokenMap[C] | {};
|
|
7
|
+
//#endregion
|
|
8
|
+
export { getDefaultComponentToken as default };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
//#region src/cssinjs-utils/util/maxmin.d.ts
|
|
2
|
+
declare function genMaxMin(type: 'css' | 'js'): {
|
|
3
|
+
max: (...values: number[]) => number;
|
|
4
|
+
min: (...values: number[]) => number;
|
|
5
|
+
} | {
|
|
6
|
+
max: (...args: (string | number)[]) => string;
|
|
7
|
+
min: (...args: (string | number)[]) => string;
|
|
8
|
+
};
|
|
9
|
+
//#endregion
|
|
10
|
+
export { genMaxMin as default };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { TokenMap } from "../interface/components.
|
|
1
|
+
import { TokenMap } from "../interface/components.js";
|
|
2
2
|
|
|
3
3
|
//#region src/cssinjs-utils/util/statistic.d.ts
|
|
4
4
|
declare function merge<CompTokenMap extends TokenMap>(...objs: Partial<CompTokenMap>[]): CompTokenMap;
|
|
@@ -6,10 +6,11 @@ declare const statistic: Record<string, {
|
|
|
6
6
|
global: string[];
|
|
7
7
|
component: Record<string, string | number>;
|
|
8
8
|
}>;
|
|
9
|
+
declare const _statistic_build_: typeof statistic;
|
|
9
10
|
declare function statisticToken<CompTokenMap extends TokenMap>(token: CompTokenMap): {
|
|
10
11
|
token: CompTokenMap;
|
|
11
12
|
keys: Set<string> | undefined;
|
|
12
13
|
flush: (component: string, componentToken: Record<string, string | number>) => void;
|
|
13
14
|
};
|
|
14
15
|
//#endregion
|
|
15
|
-
export { merge, statistic
|
|
16
|
+
export { _statistic_build_, statisticToken as default, merge, statistic };
|
|
@@ -19,6 +19,7 @@ function merge(...objs) {
|
|
|
19
19
|
return ret;
|
|
20
20
|
}
|
|
21
21
|
const statistic = {};
|
|
22
|
+
const _statistic_build_ = {};
|
|
22
23
|
function noop() {}
|
|
23
24
|
function statisticToken(token) {
|
|
24
25
|
let tokenKeys;
|
|
@@ -49,4 +50,4 @@ function statisticToken(token) {
|
|
|
49
50
|
var statistic_default = statisticToken;
|
|
50
51
|
|
|
51
52
|
//#endregion
|
|
52
|
-
export { statistic_default as default, merge, statistic };
|
|
53
|
+
export { _statistic_build_, statistic_default as default, merge, statistic };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { ExtractStyle } from "./hooks/useGlobalCache.
|
|
3
|
-
import { CSSVarCacheValue } from "./hooks/useCSSVarRegister.
|
|
1
|
+
import Entity from "./Cache.js";
|
|
2
|
+
import { ExtractStyle } from "./hooks/useGlobalCache.js";
|
|
3
|
+
import { CSSVarCacheValue } from "./hooks/useCSSVarRegister.js";
|
|
4
4
|
|
|
5
5
|
//#region src/extractStyle.d.ts
|
|
6
6
|
declare const ExtractStyleFns: {
|
|
@@ -15,4 +15,4 @@ declare function extractStyle(cache: Entity, options?: boolean | {
|
|
|
15
15
|
once?: boolean;
|
|
16
16
|
}): string;
|
|
17
17
|
//#endregion
|
|
18
|
-
export { extractStyle };
|
|
18
|
+
export { extractStyle as default };
|
|
@@ -1,8 +1,8 @@
|
|
|
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$1 } from "./hooks/useStyleRegister.
|
|
5
|
-
import { CSS_VAR_PREFIX, extract as extract$2 } from "./hooks/useCSSVarRegister.
|
|
1
|
+
import { toStyleStr } from "./util/index.js";
|
|
2
|
+
import { TOKEN_PREFIX, extract } from "./hooks/useCacheToken.js";
|
|
3
|
+
import { ATTR_CACHE_MAP, serialize } from "./util/cacheMapUtil.js";
|
|
4
|
+
import { STYLE_PREFIX, extract as extract$1 } from "./hooks/useStyleRegister.js";
|
|
5
|
+
import { CSS_VAR_PREFIX, extract as extract$2 } from "./hooks/useCSSVarRegister.js";
|
|
6
6
|
|
|
7
7
|
//#region src/extractStyle.ts
|
|
8
8
|
const ExtractStyleFns = {
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import "./useGlobalCache.
|
|
2
|
-
import { TokenWithCSSVar } from "../util/css-variables.
|
|
1
|
+
import { ExtractStyle } from "./useGlobalCache.js";
|
|
2
|
+
import { TokenWithCSSVar } from "../util/css-variables.js";
|
|
3
3
|
import { Ref } from "vue";
|
|
4
4
|
|
|
5
5
|
//#region src/hooks/useCSSVarRegister.d.ts
|
|
6
|
+
declare const CSS_VAR_PREFIX = "cssVar";
|
|
6
7
|
type CSSVarCacheValue<V, T extends Record<string, V> = Record<string, V>> = [cssVarToken: TokenWithCSSVar<V, T>, cssVarStr: string, styleId: string, cssVarKey: string];
|
|
7
8
|
interface CSSVarRegisterConfig {
|
|
8
9
|
path: string[];
|
|
@@ -14,6 +15,7 @@ interface CSSVarRegisterConfig {
|
|
|
14
15
|
token: any;
|
|
15
16
|
hashId?: string;
|
|
16
17
|
}
|
|
18
|
+
declare const extract: ExtractStyle<CSSVarCacheValue<any>>;
|
|
17
19
|
declare function useCSSVarRegister<V, T extends Record<string, V>>(config: Ref<CSSVarRegisterConfig>, fn: () => T): Ref<CSSVarCacheValue<V, T>, CSSVarCacheValue<V, T>>;
|
|
18
20
|
//#endregion
|
|
19
|
-
export { CSSVarCacheValue, useCSSVarRegister };
|
|
21
|
+
export { CSSVarCacheValue, CSSVarRegisterConfig, CSS_VAR_PREFIX, useCSSVarRegister as default, extract };
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
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 { ATTR_MARK, ATTR_TOKEN, CSS_IN_JS_INSTANCE, useStyleContext } from "../StyleContext.js";
|
|
2
|
+
import { collectStyleText } from "../ssr/styleCollector.js";
|
|
3
|
+
import { transformToken } from "../util/css-variables.js";
|
|
4
|
+
import { isClientSide, toStyleStr } from "../util/index.js";
|
|
5
|
+
import { useGlobalCache } from "./useGlobalCache.js";
|
|
6
|
+
import { uniqueHash } from "./useStyleRegister.js";
|
|
7
|
+
import { computed } from "vue";
|
|
7
8
|
import canUseDom from "@v-c/util/dist/Dom/canUseDom";
|
|
8
9
|
import { removeCSS, updateCSS } from "@v-c/util/dist/Dom/dynamicCSS";
|
|
9
|
-
import { computed } from "vue";
|
|
10
10
|
|
|
11
11
|
//#region src/hooks/useCSSVarRegister.ts
|
|
12
12
|
const CSS_VAR_PREFIX = "cssVar";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import
|
|
2
|
-
import "./useGlobalCache.
|
|
1
|
+
import Theme from "../theme/Theme.js";
|
|
2
|
+
import { ExtractStyle } from "./useGlobalCache.js";
|
|
3
3
|
import { Ref } from "vue";
|
|
4
4
|
|
|
5
5
|
//#region src/hooks/useCacheToken.d.ts
|
|
@@ -42,7 +42,9 @@ interface Option<DerivativeToken, DesignToken> {
|
|
|
42
42
|
};
|
|
43
43
|
}
|
|
44
44
|
declare function getComputedToken<DerivativeToken = object, DesignToken = DerivativeToken>(originToken: DesignToken, overrideToken: object, theme: Theme<any, any>, format?: (token: DesignToken) => DerivativeToken): any;
|
|
45
|
+
declare const TOKEN_PREFIX = "token";
|
|
45
46
|
type TokenCacheValue<DerivativeToken> = [token: DerivativeToken, hashId: string, realToken: DerivativeToken, cssVarStr: string, cssVarKey: string];
|
|
47
|
+
declare const extract: ExtractStyle<TokenCacheValue<any>>;
|
|
46
48
|
/**
|
|
47
49
|
* Cache theme derivative token as global shared one
|
|
48
50
|
* @param theme Theme entity
|
|
@@ -52,4 +54,4 @@ type TokenCacheValue<DerivativeToken> = [token: DerivativeToken, hashId: string,
|
|
|
52
54
|
*/
|
|
53
55
|
declare function useCacheToken<DerivativeToken = Record<string, any>, DesignToken = DerivativeToken>(theme: Ref<Theme<any, any>>, tokens: Ref<(Partial<DesignToken> | (() => Partial<DesignToken>))[]>, option: Ref<Option<DerivativeToken, DesignToken>>): Ref<TokenCacheValue<DerivativeToken>, TokenCacheValue<DerivativeToken>>;
|
|
54
56
|
//#endregion
|
|
55
|
-
export {
|
|
57
|
+
export { Option, TOKEN_PREFIX, useCacheToken as default, extract, getComputedToken };
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import resolveHash_default from "../util/resolveHash.
|
|
4
|
-
import { transformToken } from "../util/css-variables.
|
|
5
|
-
import { flattenToken, memoResult, toStyleStr, token2key } from "../util/index.
|
|
6
|
-
import { useGlobalCache } from "./useGlobalCache.
|
|
1
|
+
import { ATTR_MARK, ATTR_TOKEN, CSS_IN_JS_INSTANCE, useStyleContext } from "../StyleContext.js";
|
|
2
|
+
import { collectStyleText } from "../ssr/styleCollector.js";
|
|
3
|
+
import resolveHash_default from "../util/resolveHash.js";
|
|
4
|
+
import { transformToken } from "../util/css-variables.js";
|
|
5
|
+
import { flattenToken, memoResult, toStyleStr, token2key } from "../util/index.js";
|
|
6
|
+
import { useGlobalCache } from "./useGlobalCache.js";
|
|
7
|
+
import { computed } from "vue";
|
|
7
8
|
import canUseDom from "@v-c/util/dist/Dom/canUseDom";
|
|
8
9
|
import { updateCSS } from "@v-c/util/dist/Dom/dynamicCSS";
|
|
9
|
-
import { computed } from "vue";
|
|
10
10
|
|
|
11
11
|
//#region src/hooks/useCacheToken.ts
|
|
12
12
|
const EMPTY_OVERRIDE = {};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { KeyType } from "../Cache.js";
|
|
2
|
+
import { Ref } from "vue";
|
|
3
|
+
|
|
4
|
+
//#region src/hooks/useGlobalCache.d.ts
|
|
5
|
+
type ExtractStyle<CacheValue> = (cache: CacheValue, effectStyles: Record<string, boolean>, options?: {
|
|
6
|
+
plain?: boolean;
|
|
7
|
+
autoPrefix?: boolean;
|
|
8
|
+
}) => [order: number, styleId: string, style: string] | null;
|
|
9
|
+
/**
|
|
10
|
+
* Global cache for CSS-in-JS styles
|
|
11
|
+
*
|
|
12
|
+
* This hook manages a reference-counted cache to ensure styles are properly
|
|
13
|
+
* created, shared, and cleaned up across component instances.
|
|
14
|
+
*
|
|
15
|
+
* Key differences from React version:
|
|
16
|
+
* - No useInsertionEffect needed - Vue's watchEffect handles timing naturally
|
|
17
|
+
* - No StrictMode double-mounting issues - Vue doesn't double-mount
|
|
18
|
+
* - HMR handling is simpler - can rely on Vue's reactivity system
|
|
19
|
+
* - Uses onBeforeUnmount for cleanup instead of watch's onCleanup to have
|
|
20
|
+
* better control over cleanup timing (important for Transition animations)
|
|
21
|
+
*/
|
|
22
|
+
declare function useGlobalCache<CacheType>(prefix: Ref<string>, keyPath: Ref<KeyType[]>, cacheFn: () => CacheType, onCacheRemove?: (cache: CacheType, fromHMR: boolean) => void, onCacheEffect?: (cachedValue: CacheType) => void): Ref<CacheType>;
|
|
23
|
+
//#endregion
|
|
24
|
+
export { ExtractStyle, useGlobalCache };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { pathKey } from "../Cache.
|
|
2
|
-
import { useStyleContext } from "../StyleContext.
|
|
3
|
-
import { isClientSide } from "../util/index.
|
|
1
|
+
import { pathKey } from "../Cache.js";
|
|
2
|
+
import { useStyleContext } from "../StyleContext.js";
|
|
3
|
+
import { isClientSide } from "../util/index.js";
|
|
4
4
|
import { computed, onBeforeUnmount, shallowRef, watch } from "vue";
|
|
5
5
|
|
|
6
6
|
//#region src/hooks/useGlobalCache.ts
|