@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
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { HashPriority } from "../StyleContext.js";
|
|
2
|
+
import { token2CSSVar } from "./css-variables.js";
|
|
3
|
+
|
|
4
|
+
//#region src/util/index.d.ts
|
|
5
|
+
declare function memoResult<T extends object, R>(callback: () => R, deps: T[]): R;
|
|
6
|
+
/**
|
|
7
|
+
* Flatten token to string, this will auto cache the result when token not change
|
|
8
|
+
*/
|
|
9
|
+
declare function flattenToken(token: any): string;
|
|
10
|
+
/**
|
|
11
|
+
* Convert derivative token to key string
|
|
12
|
+
*/
|
|
13
|
+
declare function token2key(token: any, salt: string): string;
|
|
14
|
+
declare function supportLayer(): boolean;
|
|
15
|
+
declare function supportWhere(): boolean;
|
|
16
|
+
declare function supportLogicProps(): boolean;
|
|
17
|
+
declare const isClientSide: boolean;
|
|
18
|
+
declare function unit(num: string | number): string;
|
|
19
|
+
declare function toStyleStr(style: string, tokenKey?: string, styleId?: string, customizeAttrs?: Record<string, string>, plain?: boolean): string;
|
|
20
|
+
declare function where(options?: {
|
|
21
|
+
hashPriority?: HashPriority;
|
|
22
|
+
hashCls?: string;
|
|
23
|
+
}): string;
|
|
24
|
+
declare function isNonNullable<T>(val: T): val is NonNullable<T>;
|
|
25
|
+
//#endregion
|
|
26
|
+
export { flattenToken, isClientSide, isNonNullable, memoResult, supportLayer, supportLogicProps, supportWhere, toStyleStr, token2CSSVar, token2key, unit, where };
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { ATTR_MARK, ATTR_TOKEN } from "../StyleContext.
|
|
2
|
-
import Theme from "../theme/Theme.
|
|
3
|
-
import "../theme/index.
|
|
4
|
-
import resolveHash_default from "./resolveHash.
|
|
5
|
-
import { token2CSSVar } from "./css-variables.
|
|
1
|
+
import { ATTR_MARK, ATTR_TOKEN } from "../StyleContext.js";
|
|
2
|
+
import Theme from "../theme/Theme.js";
|
|
3
|
+
import "../theme/index.js";
|
|
4
|
+
import resolveHash_default from "./resolveHash.js";
|
|
5
|
+
import { token2CSSVar } from "./css-variables.js";
|
|
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
|
|
|
@@ -66,6 +66,13 @@ function supportSelector(styleStr, handleElement, supportCheck) {
|
|
|
66
66
|
}
|
|
67
67
|
return false;
|
|
68
68
|
}
|
|
69
|
+
let canLayer;
|
|
70
|
+
function supportLayer() {
|
|
71
|
+
if (canLayer === void 0) canLayer = supportSelector(`@layer ${randomSelectorKey} { .${randomSelectorKey} { content: "${checkContent}"!important; } }`, (ele) => {
|
|
72
|
+
ele.className = randomSelectorKey;
|
|
73
|
+
});
|
|
74
|
+
return canLayer;
|
|
75
|
+
}
|
|
69
76
|
let canWhere;
|
|
70
77
|
function supportWhere() {
|
|
71
78
|
if (canWhere === void 0) canWhere = supportSelector(`:where(.${randomSelectorKey}) { content: "${checkContent}"!important; }`, (ele) => {
|
|
@@ -108,4 +115,4 @@ function isNonNullable(val) {
|
|
|
108
115
|
}
|
|
109
116
|
|
|
110
117
|
//#endregion
|
|
111
|
-
export { flattenToken, isClientSide, isNonNullable, memoResult, supportLogicProps, supportWhere, toStyleStr, token2key, unit, where };
|
|
118
|
+
export { flattenToken, isClientSide, isNonNullable, memoResult, supportLayer, supportLogicProps, supportWhere, toStyleStr, token2CSSVar, token2key, unit, where };
|
package/package.json
CHANGED
|
@@ -1,23 +1,28 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@antdv-next/cssinjs",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "1.0.
|
|
4
|
+
"version": "1.0.1",
|
|
5
5
|
"description": "cssinjs solution for ant-design-vue",
|
|
6
|
+
"repository": {
|
|
7
|
+
"type": "git",
|
|
8
|
+
"url": "git+https://github.com/antdv-next/antdv-next.git",
|
|
9
|
+
"directory": "packages/cssinjs"
|
|
10
|
+
},
|
|
6
11
|
"exports": {
|
|
7
12
|
".": {
|
|
8
|
-
"types": "./dist/index.d.
|
|
9
|
-
"import": "./dist/index.
|
|
10
|
-
"default": "./dist/index.
|
|
13
|
+
"types": "./dist/index.d.ts",
|
|
14
|
+
"import": "./dist/index.js",
|
|
15
|
+
"default": "./dist/index.js"
|
|
11
16
|
},
|
|
12
17
|
"./cssinjs-utils": {
|
|
13
|
-
"types": "./dist/cssinjs-utils/index.d.
|
|
14
|
-
"import": "./dist/cssinjs-utils/index.
|
|
15
|
-
"default": "./dist/cssinjs-utils/index.
|
|
18
|
+
"types": "./dist/cssinjs-utils/index.d.ts",
|
|
19
|
+
"import": "./dist/cssinjs-utils/index.js",
|
|
20
|
+
"default": "./dist/cssinjs-utils/index.js"
|
|
16
21
|
},
|
|
17
22
|
"./dist/*": {
|
|
18
|
-
"types": "./dist/*.d.
|
|
19
|
-
"import": "./dist/*.
|
|
20
|
-
"default": "./dist/*.
|
|
23
|
+
"types": "./dist/*.d.ts",
|
|
24
|
+
"import": "./dist/*.js",
|
|
25
|
+
"default": "./dist/*.js"
|
|
21
26
|
}
|
|
22
27
|
},
|
|
23
28
|
"files": [
|
|
@@ -30,7 +35,7 @@
|
|
|
30
35
|
"dependencies": {
|
|
31
36
|
"@emotion/hash": "^0.8.0",
|
|
32
37
|
"@emotion/unitless": "^0.7.5",
|
|
33
|
-
"@v-c/util": "^1.0.
|
|
38
|
+
"@v-c/util": "^1.0.13",
|
|
34
39
|
"csstype": "^3.2.3",
|
|
35
40
|
"defu": "^6.1.4",
|
|
36
41
|
"stylis": "^4.3.6"
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { Ref } from "vue";
|
|
2
|
-
|
|
3
|
-
//#region src/hooks/useGlobalCache.d.ts
|
|
4
|
-
type ExtractStyle<CacheValue> = (cache: CacheValue, effectStyles: Record<string, boolean>, options?: {
|
|
5
|
-
plain?: boolean;
|
|
6
|
-
autoPrefix?: boolean;
|
|
7
|
-
}) => [order: number, styleId: string, style: string] | null;
|
|
8
|
-
//#endregion
|
|
9
|
-
export { ExtractStyle };
|
package/dist/index.d.mts
DELETED
|
@@ -1,35 +0,0 @@
|
|
|
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
|
-
|
|
30
|
-
//#region src/index.d.ts
|
|
31
|
-
declare const _experimental: {
|
|
32
|
-
supportModernCSS: () => boolean;
|
|
33
|
-
};
|
|
34
|
-
//#endregion
|
|
35
|
-
export { type AbstractCalculator, type CSSInterpolation, type CSSObject, CSSUtil, CSSVarRegisterProps, ComponentToken, ComponentTokenKey, type DerivativeFunc, FullToken, GenStyleFn, GetCompUnitless, GetDefaultToken, GetDefaultTokenFn, GetResetStyles, GlobalToken, GlobalTokenWithComponent, Keyframe as Keyframes, type Linter, linter as NaNLinter, OverrideTokenMap, StyleInfo, StyleProvider, type StyleProviderProps, SubStyleComponentProps, Theme, TokenMap, TokenMapKey, type TokenType, TokenWithCommonCls, type Transformer, _experimental, transform as autoPrefixTransformer, collectStyleText, createCache, createTheme, extractStyle, genCalc, genStyleUtils, getComputedToken, transform$1 as legacyLogicalPropertiesTransformer, linter$1 as legacyNotSelectorLinter, linter$2 as logicalPropertiesLinter, merge as mergeToken, linter$3 as parentSelectorLinter, provideStyleContext, transform$2 as px2remTransformer, setStyleCollector, statistic, statisticToken, token2CSSVar, unit, useCSSVarRegister, useCacheToken, useStyleContext, useStyleContextProvide, useStyleRegister };
|
package/dist/linters/index.d.mts
DELETED
|
@@ -1,5 +0,0 @@
|
|
|
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";
|
package/dist/linters/index.mjs
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
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
|
-
|
|
8
|
-
export { };
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { AbstractCalculator } from "./calculator.mjs";
|
|
2
|
-
import { CSSCalculator } from "./CSSCalculator.mjs";
|
|
3
|
-
import { NumCalculator } from "./NumCalculator.mjs";
|
|
4
|
-
|
|
5
|
-
//#region src/theme/calc/index.d.ts
|
|
6
|
-
declare function genCalc(type: 'css' | 'js', unitlessCssVar: Set<string>): (num: number | string | AbstractCalculator) => CSSCalculator | NumCalculator;
|
|
7
|
-
//#endregion
|
|
8
|
-
export { genCalc };
|
package/dist/theme/index.mjs
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import "../StyleContext.mjs";
|
|
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 };
|
package/dist/util/index.d.mts
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
|