@tamagui/web 3.0.0-beta.807.1 → 3.0.0-beta.831.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/cjs/config.cjs +1 -1
- package/dist/cjs/config.native.cjs +1 -1
- package/dist/cjs/config.native.js +1 -1
- package/dist/cjs/config.native.js.map +1 -1
- package/dist/cjs/createComponent.cjs +28 -18
- package/dist/cjs/createComponent.native.cjs +30 -20
- package/dist/cjs/createComponent.native.js +30 -20
- package/dist/cjs/createComponent.native.js.map +1 -1
- package/dist/cjs/createStyledHOC.cjs +54 -4
- package/dist/cjs/createStyledHOC.native.cjs +55 -4
- package/dist/cjs/createStyledHOC.native.js +55 -4
- package/dist/cjs/createStyledHOC.native.js.map +1 -1
- package/dist/cjs/createTokens.cjs +1 -1
- package/dist/cjs/createTokens.native.cjs +1 -1
- package/dist/cjs/createTokens.native.js +1 -1
- package/dist/cjs/createTokens.native.js.map +1 -1
- package/dist/cjs/dom/html.cjs +147 -99
- package/dist/cjs/dom/htmlRuntime.native.cjs +6 -2
- package/dist/cjs/dom/htmlRuntime.native.js +6 -2
- package/dist/cjs/dom/htmlRuntime.native.js.map +1 -1
- package/dist/cjs/dom/primitives.native.cjs +16 -13
- package/dist/cjs/dom/primitives.native.js +16 -13
- package/dist/cjs/dom/primitives.native.js.map +1 -1
- package/dist/cjs/helpers/componentDisplayName.cjs +1 -11
- package/dist/cjs/helpers/componentDisplayName.native.cjs +1 -11
- package/dist/cjs/helpers/componentDisplayName.native.js +1 -11
- package/dist/cjs/helpers/componentDisplayName.native.js.map +1 -1
- package/dist/cjs/helpers/directStyleCSS.cjs +101 -104
- package/dist/cjs/helpers/formatDiagnostic.cjs +2 -4
- package/dist/cjs/helpers/formatDiagnostic.native.cjs +2 -4
- package/dist/cjs/helpers/formatDiagnostic.native.js +2 -4
- package/dist/cjs/helpers/formatDiagnostic.native.js.map +1 -1
- package/dist/cjs/helpers/getCSSStylesAtomic.cjs +10 -10
- package/dist/cjs/helpers/getSplitStyles.cjs +168 -600
- package/dist/cjs/helpers/getSplitStyles.native.cjs +168 -762
- package/dist/cjs/helpers/getSplitStyles.native.js +168 -762
- package/dist/cjs/helpers/getSplitStyles.native.js.map +1 -1
- package/dist/cjs/helpers/splitStyleProps.cjs +46 -0
- package/dist/cjs/helpers/splitStyleProps.native.cjs +49 -0
- package/dist/cjs/helpers/splitStyleProps.native.js +51 -0
- package/dist/cjs/helpers/splitStyleProps.native.js.map +1 -0
- package/dist/cjs/helpers/styleStaticConfig.cjs +76 -0
- package/dist/cjs/helpers/styleStaticConfig.native.cjs +79 -0
- package/dist/cjs/helpers/styleStaticConfig.native.js +81 -0
- package/dist/cjs/helpers/styleStaticConfig.native.js.map +1 -0
- package/dist/cjs/helpers/tokenCategories.cjs +32 -71
- package/dist/cjs/helpers/tokenCategories.native.cjs +34 -73
- package/dist/cjs/helpers/tokenCategories.native.js +34 -73
- package/dist/cjs/helpers/tokenCategories.native.js.map +1 -1
- package/dist/cjs/helpers/variantResolvers.cjs +87 -0
- package/dist/cjs/helpers/variantResolvers.native.cjs +140 -0
- package/dist/cjs/helpers/variantResolvers.native.js +142 -0
- package/dist/cjs/helpers/variantResolvers.native.js.map +1 -0
- package/dist/cjs/hooks/useSplitStyles.cjs +2 -2
- package/dist/cjs/hooks/useSplitStyles.native.cjs +2 -2
- package/dist/cjs/hooks/useSplitStyles.native.js +2 -2
- package/dist/cjs/hooks/useSplitStyles.native.js.map +1 -1
- package/dist/cjs/index.cjs +3 -9
- package/dist/cjs/index.native.cjs +3 -9
- package/dist/cjs/index.native.js +3 -9
- package/dist/cjs/index.native.js.map +1 -1
- package/dist/cjs/internal-runtime.cjs +8 -7
- package/dist/cjs/internal-runtime.native.cjs +8 -7
- package/dist/cjs/internal-runtime.native.js +8 -7
- package/dist/cjs/internal-runtime.native.js.map +1 -1
- package/dist/cjs/static-resolve.cjs +6 -5
- package/dist/cjs/static-resolve.native.cjs +6 -5
- package/dist/cjs/static-resolve.native.js +6 -5
- package/dist/cjs/static-resolve.native.js.map +1 -1
- package/dist/cjs/styled.cjs +4 -56
- package/dist/cjs/styled.native.cjs +4 -58
- package/dist/cjs/styled.native.js +4 -58
- package/dist/cjs/styled.native.js.map +1 -1
- package/dist/cjs/types.cjs +1 -21
- package/dist/cjs/types.native.cjs +1 -21
- package/dist/cjs/types.native.js +1 -21
- package/dist/cjs/types.native.js.map +1 -1
- package/dist/cjs/views/Text.cjs +4 -2
- package/dist/cjs/views/Text.native.cjs +4 -2
- package/dist/cjs/views/Text.native.js +4 -2
- package/dist/cjs/views/Text.native.js.map +1 -1
- package/dist/cjs/views/View.cjs +4 -2
- package/dist/cjs/views/View.native.cjs +4 -2
- package/dist/cjs/views/View.native.js +4 -2
- package/dist/cjs/views/View.native.js.map +1 -1
- package/dist/esm/config.mjs +1 -1
- package/dist/esm/config.mjs.map +1 -1
- package/dist/esm/config.native.js +1 -1
- package/dist/esm/config.native.js.map +1 -1
- package/dist/esm/createComponent.mjs +29 -19
- package/dist/esm/createComponent.mjs.map +1 -1
- package/dist/esm/createComponent.native.js +31 -21
- package/dist/esm/createComponent.native.js.map +1 -1
- package/dist/esm/createStyledHOC.mjs +55 -5
- package/dist/esm/createStyledHOC.mjs.map +1 -1
- package/dist/esm/createStyledHOC.native.js +56 -5
- package/dist/esm/createStyledHOC.native.js.map +1 -1
- package/dist/esm/createTokens.mjs +1 -1
- package/dist/esm/createTokens.mjs.map +1 -1
- package/dist/esm/createTokens.native.js +1 -1
- package/dist/esm/createTokens.native.js.map +1 -1
- package/dist/esm/dom/html.mjs +147 -99
- package/dist/esm/dom/html.mjs.map +1 -1
- package/dist/esm/dom/htmlRuntime.native.js +7 -3
- package/dist/esm/dom/htmlRuntime.native.js.map +1 -1
- package/dist/esm/dom/primitives.native.js +16 -13
- package/dist/esm/dom/primitives.native.js.map +1 -1
- package/dist/esm/helpers/componentDisplayName.mjs +1 -8
- package/dist/esm/helpers/componentDisplayName.mjs.map +1 -1
- package/dist/esm/helpers/componentDisplayName.native.js +1 -8
- package/dist/esm/helpers/componentDisplayName.native.js.map +1 -1
- package/dist/esm/helpers/directStyleCSS.mjs +101 -104
- package/dist/esm/helpers/directStyleCSS.mjs.map +1 -1
- package/dist/esm/helpers/formatDiagnostic.mjs +2 -4
- package/dist/esm/helpers/formatDiagnostic.mjs.map +1 -1
- package/dist/esm/helpers/formatDiagnostic.native.js +2 -4
- package/dist/esm/helpers/formatDiagnostic.native.js.map +1 -1
- package/dist/esm/helpers/getCSSStylesAtomic.mjs +10 -10
- package/dist/esm/helpers/getCSSStylesAtomic.mjs.map +1 -1
- package/dist/esm/helpers/getSplitStyles.mjs +166 -594
- package/dist/esm/helpers/getSplitStyles.mjs.map +1 -1
- package/dist/esm/helpers/getSplitStyles.native.js +166 -757
- package/dist/esm/helpers/getSplitStyles.native.js.map +1 -1
- package/dist/esm/helpers/splitStyleProps.mjs +27 -0
- package/dist/esm/helpers/splitStyleProps.mjs.map +1 -0
- package/dist/esm/helpers/splitStyleProps.native.js +28 -0
- package/dist/esm/helpers/splitStyleProps.native.js.map +1 -0
- package/dist/esm/helpers/styleStaticConfig.mjs +57 -0
- package/dist/esm/helpers/styleStaticConfig.mjs.map +1 -0
- package/dist/esm/helpers/styleStaticConfig.native.js +58 -0
- package/dist/esm/helpers/styleStaticConfig.native.js.map +1 -0
- package/dist/esm/helpers/tokenCategories.mjs +33 -72
- package/dist/esm/helpers/tokenCategories.mjs.map +1 -1
- package/dist/esm/helpers/tokenCategories.native.js +35 -74
- package/dist/esm/helpers/tokenCategories.native.js.map +1 -1
- package/dist/esm/helpers/variantResolvers.mjs +65 -0
- package/dist/esm/helpers/variantResolvers.mjs.map +1 -0
- package/dist/esm/helpers/variantResolvers.native.js +116 -0
- package/dist/esm/helpers/variantResolvers.native.js.map +1 -0
- package/dist/esm/hooks/useSplitStyles.mjs +2 -2
- package/dist/esm/hooks/useSplitStyles.mjs.map +1 -1
- package/dist/esm/hooks/useSplitStyles.native.js +2 -2
- package/dist/esm/hooks/useSplitStyles.native.js.map +1 -1
- package/dist/esm/index.js +3 -5
- package/dist/esm/index.mjs +3 -5
- package/dist/esm/index.native.js +3 -5
- package/dist/esm/internal-runtime.mjs +8 -7
- package/dist/esm/internal-runtime.mjs.map +1 -1
- package/dist/esm/internal-runtime.native.js +8 -7
- package/dist/esm/internal-runtime.native.js.map +1 -1
- package/dist/esm/static-resolve.mjs +8 -6
- package/dist/esm/static-resolve.mjs.map +1 -1
- package/dist/esm/static-resolve.native.js +8 -6
- package/dist/esm/static-resolve.native.js.map +1 -1
- package/dist/esm/styled.mjs +6 -57
- package/dist/esm/styled.mjs.map +1 -1
- package/dist/esm/styled.native.js +6 -59
- package/dist/esm/styled.native.js.map +1 -1
- package/dist/esm/types.mjs +1 -18
- package/dist/esm/types.mjs.map +1 -1
- package/dist/esm/types.native.js +1 -18
- package/dist/esm/types.native.js.map +1 -1
- package/dist/esm/views/Text.mjs +4 -2
- package/dist/esm/views/Text.mjs.map +1 -1
- package/dist/esm/views/Text.native.js +4 -2
- package/dist/esm/views/Text.native.js.map +1 -1
- package/dist/esm/views/View.mjs +4 -2
- package/dist/esm/views/View.mjs.map +1 -1
- package/dist/esm/views/View.native.js +4 -2
- package/dist/esm/views/View.native.js.map +1 -1
- package/package.json +15 -15
- package/src/config.ts +1 -1
- package/src/createComponent.tsx +41 -30
- package/src/createStyledHOC.tsx +56 -9
- package/src/createTokens.ts +1 -1
- package/src/dom/html.tsx +778 -877
- package/src/dom/htmlRuntime.native.tsx +7 -3
- package/src/dom/primitives.native.tsx +30 -39
- package/src/helpers/componentDisplayName.ts +0 -11
- package/src/helpers/directStyleCSS.ts +91 -112
- package/src/helpers/formatDiagnostic.ts +2 -4
- package/src/helpers/getCSSStylesAtomic.ts +32 -26
- package/src/helpers/getSplitStyles.tsx +315 -1119
- package/src/helpers/getVariantExtras.tsx +3 -3
- package/src/helpers/splitStyleProps.ts +166 -0
- package/src/helpers/styleFrontend.ts +8 -4
- package/src/helpers/styleStaticConfig.ts +88 -0
- package/src/helpers/tokenCategories.ts +62 -93
- package/src/helpers/variantResolvers.ts +121 -0
- package/src/hooks/useSplitStyles.tsx +17 -2
- package/src/hooks/useTheme.tsx +1 -1
- package/src/index.ts +8 -4
- package/src/internal-runtime.ts +10 -9
- package/src/static-resolve.ts +18 -14
- package/src/styled.tsx +7 -264
- package/src/types.tsx +19 -40
- package/src/views/Text.tsx +6 -7
- package/src/views/View.tsx +6 -7
- package/types/createComponent.d.ts.map +1 -1
- package/types/createStyledHOC.d.ts.map +1 -1
- package/types/dom/html.d.ts.map +1 -1
- package/types/dom/htmlRuntime.native.d.ts.map +1 -1
- package/types/dom/primitives.native.d.ts.map +1 -1
- package/types/helpers/componentDisplayName.d.ts +0 -3
- package/types/helpers/componentDisplayName.d.ts.map +1 -1
- package/types/helpers/directStyleCSS.d.ts.map +1 -1
- package/types/helpers/formatDiagnostic.d.ts.map +1 -1
- package/types/helpers/getCSSStylesAtomic.d.ts +17 -15
- package/types/helpers/getCSSStylesAtomic.d.ts.map +1 -1
- package/types/helpers/getSplitStyles.d.ts +6 -6
- package/types/helpers/getSplitStyles.d.ts.map +1 -1
- package/types/helpers/splitStyleProps.d.ts +44 -0
- package/types/helpers/splitStyleProps.d.ts.map +1 -0
- package/types/helpers/styleFrontend.d.ts +4 -4
- package/types/helpers/styleFrontend.d.ts.map +1 -1
- package/types/helpers/styleStaticConfig.d.ts +19 -0
- package/types/helpers/styleStaticConfig.d.ts.map +1 -0
- package/types/helpers/tokenCategories.d.ts +1 -1
- package/types/helpers/tokenCategories.d.ts.map +1 -1
- package/types/helpers/variantResolvers.d.ts +9 -0
- package/types/helpers/variantResolvers.d.ts.map +1 -0
- package/types/hooks/useSplitStyles.d.ts.map +1 -1
- package/types/index.d.ts +2 -4
- package/types/index.d.ts.map +1 -1
- package/types/internal-runtime.d.ts.map +1 -1
- package/types/static-resolve.d.ts +2 -2
- package/types/static-resolve.d.ts.map +1 -1
- package/types/styled.d.ts +3 -39
- package/types/styled.d.ts.map +1 -1
- package/types/types.d.ts +2 -12
- package/types/types.d.ts.map +1 -1
- package/types/views/Text.d.ts.map +1 -1
- package/types/views/View.d.ts.map +1 -1
- package/dist/cjs/helpers/getDefaultProps.cjs +0 -24
- package/dist/cjs/helpers/getDefaultProps.native.cjs +0 -28
- package/dist/cjs/helpers/getDefaultProps.native.js +0 -30
- package/dist/cjs/helpers/getDefaultProps.native.js.map +0 -1
- package/dist/cjs/helpers/themeable.cjs +0 -92
- package/dist/cjs/helpers/themeable.native.cjs +0 -95
- package/dist/cjs/helpers/themeable.native.js +0 -97
- package/dist/cjs/helpers/themeable.native.js.map +0 -1
- package/dist/cjs/hooks/useProps.cjs +0 -129
- package/dist/cjs/hooks/useProps.native.cjs +0 -135
- package/dist/cjs/hooks/useProps.native.js +0 -137
- package/dist/cjs/hooks/useProps.native.js.map +0 -1
- package/dist/esm/helpers/getDefaultProps.mjs +0 -4
- package/dist/esm/helpers/getDefaultProps.mjs.map +0 -1
- package/dist/esm/helpers/getDefaultProps.native.js +0 -6
- package/dist/esm/helpers/getDefaultProps.native.js.map +0 -1
- package/dist/esm/helpers/themeable.mjs +0 -67
- package/dist/esm/helpers/themeable.mjs.map +0 -1
- package/dist/esm/helpers/themeable.native.js +0 -68
- package/dist/esm/helpers/themeable.native.js.map +0 -1
- package/dist/esm/hooks/useProps.mjs +0 -100
- package/dist/esm/hooks/useProps.mjs.map +0 -1
- package/dist/esm/hooks/useProps.native.js +0 -104
- package/dist/esm/hooks/useProps.native.js.map +0 -1
- package/src/helpers/getDefaultProps.ts +0 -3
- package/src/helpers/themeable.tsx +0 -96
- package/src/hooks/useProps.tsx +0 -186
- package/types/helpers/getDefaultProps.d.ts +0 -3
- package/types/helpers/getDefaultProps.d.ts.map +0 -1
- package/types/helpers/themeable.d.ts +0 -3
- package/types/helpers/themeable.d.ts.map +0 -1
- package/types/hooks/useProps.d.ts +0 -39
- package/types/hooks/useProps.d.ts.map +0 -1
|
@@ -1,79 +1,39 @@
|
|
|
1
1
|
import { isClient, platformMatches } from "@tamagui/constants";
|
|
2
|
-
import { nonAnimatableStyleProps, stylePropsAll, stylePropsText, stylePropsTransform,
|
|
2
|
+
import { nonAnimatableStyleProps, propToTokenCategoryCode, stylePropsAll, stylePropsText, stylePropsTransform, validStyles } from "@tamagui/helpers";
|
|
3
|
+
import { addTransformValue, canonicalStateModifierNames, createTransformAccumulator, finalizeTransformAccumulator, getTransformPartKeys, isContainerSizeQueryText, isModifierName, modifierKindMedia, modifierKindPlatform, modifierKindState, modifierKindTheme, removeTransformValue, scanFlatValue, stateModifierSelectors } from "@tamagui/style-grammar/runtime";
|
|
3
4
|
import { getConfig } from "../config.mjs";
|
|
4
|
-
import { isVariable } from "../createVariable.mjs";
|
|
5
5
|
import { isDevTools } from "../constants/isDevTools.mjs";
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import { addTransformValue, canonicalStateModifierNames, createTransformAccumulator, finalizeTransformAccumulator, getTransformPartKeys, isContainerSizeQueryText, isModifierName, modifierKindMedia, modifierKindPlatform, modifierKindState, modifierKindTheme, removeTransformValue, scanFlatValue, stateModifierSelectors } from "@tamagui/style-grammar/runtime";
|
|
9
|
-
import { warnOnce, warnRefusedValue } from "./warnOnce.mjs";
|
|
6
|
+
import { isVariable } from "../createVariable.mjs";
|
|
7
|
+
import { addComposition, canGenerateCSS, clearFrameAtomic, completeStreamingCSS, directStyleSignature, flushDirectStyles, flushDirectStyles as flushDirectStyles2, requestBorderStyleDefault, streamAtomic } from "./directStyleCSS.mjs";
|
|
10
8
|
import { expandStyle } from "./expandStyle.mjs";
|
|
11
9
|
import { fixStyles } from "./expandStyles.mjs";
|
|
12
|
-
import { styleToCSS } from "./styleToCSS.mjs";
|
|
13
|
-
import { addComposition, canGenerateCSS, clearFrameAtomic, completeStreamingCSS, directStyleSignature, flushDirectStyles, flushDirectStyles as flushDirectStyles2, requestBorderStyleDefault, streamAtomic } from "./directStyleCSS.mjs";
|
|
14
10
|
import { getConfigRevisionState } from "./grammarConfig.mjs";
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
11
|
+
import { mediaKeyMatch, mediaState } from "./mediaState.mjs";
|
|
12
|
+
import { getStyleStaticConfig } from "./styleStaticConfig.mjs";
|
|
13
|
+
import { styleToCSS } from "./styleToCSS.mjs";
|
|
14
|
+
import { getVariantDefinition } from "./variantResolvers.mjs";
|
|
15
|
+
import { warnOnce, warnRefusedValue } from "./warnOnce.mjs";
|
|
16
|
+
import { getVariantExtras } from "./getVariantExtras.mjs";
|
|
17
|
+
import { isObj } from "./isObj.mjs";
|
|
17
18
|
import { log } from "./log.mjs";
|
|
18
|
-
import { normalizeStyle } from "./normalizeStyle.mjs";
|
|
19
19
|
import { normalizeColor } from "./normalizeColor.mjs";
|
|
20
|
+
import { normalizeStyle } from "./normalizeStyle.mjs";
|
|
20
21
|
import { normalizeValueWithProperty } from "./normalizeValueWithProperty.mjs";
|
|
21
|
-
import { getVariantExtras } from "./getVariantExtras.mjs";
|
|
22
22
|
import { isRemValue, resolveRem } from "./resolveRem.mjs";
|
|
23
23
|
import { expandSafeAreaValue, isSafeAreaKey } from "./resolveSafeArea.mjs";
|
|
24
24
|
import { resolveSafeAreaVariable } from "./resolveSafeAreaVariable.mjs";
|
|
25
25
|
import { resolveVariableValue } from "./resolveVariableValue.mjs";
|
|
26
|
-
import { THEME_REF_PREFIX } from "./themeRef.mjs";
|
|
27
|
-
import { getTokenCategoryForProperty, tokenCategoryByProperty } from "./tokenCategories.mjs";
|
|
28
26
|
import { HOC_CLASSNAME_MARKER, skipProps } from "./skipProps.mjs";
|
|
29
27
|
import { styleOriginalValues } from "./styleOriginalValues.mjs";
|
|
30
28
|
import { STYLE_TOKEN_PROVENANCE_KEY, getStyleTokenProvenance, setStyleTokenProvenance } from "./styleProvenance.mjs";
|
|
29
|
+
import { THEME_REF_PREFIX } from "./themeRef.mjs";
|
|
30
|
+
import { getTokenCategoryForProperty } from "./tokenCategories.mjs";
|
|
31
31
|
import { transformsToString } from "./transformsToString.mjs";
|
|
32
32
|
|
|
33
33
|
export * from "./tokenCategories.mjs"
|
|
34
34
|
|
|
35
35
|
const TAMAGUI_CLASS_PROPS = "$$tamaguiClassProps";
|
|
36
36
|
const shouldTrackStyleTokenProvenance = process.env.NODE_ENV === "development" && process.env.TAMAGUI_ENABLE_STYLE_TOKEN_PROVENANCE === "1";
|
|
37
|
-
function compoundMatcherMatches(expected, actual) {
|
|
38
|
-
if (Array.isArray(expected)) {
|
|
39
|
-
for (let index = 0; index < expected.length; index++) if (expected[index] === actual) return true;
|
|
40
|
-
return false;
|
|
41
|
-
}
|
|
42
|
-
return expected === actual;
|
|
43
|
-
}
|
|
44
|
-
function compoundMatcherMatchesPayload(expected, source, start, end) {
|
|
45
|
-
if (Array.isArray(expected)) {
|
|
46
|
-
for (let index = 0; index < expected.length; index++) if (compoundMatcherMatchesPayload(expected[index], source, start, end)) return true;
|
|
47
|
-
return false;
|
|
48
|
-
}
|
|
49
|
-
const expectedValue = typeof expected === "string" ? expected : String(expected);
|
|
50
|
-
if (expectedValue.length !== end - start) return false;
|
|
51
|
-
for (let index = 0; index < expectedValue.length; index++) if (expectedValue.charCodeAt(index) !== source.charCodeAt(start + index)) return false;
|
|
52
|
-
return true;
|
|
53
|
-
}
|
|
54
|
-
const preparedCompoundsKey = /* @__PURE__ */ Symbol();
|
|
55
|
-
function prepareStaticConfigCompounds(staticConfig) {
|
|
56
|
-
const compoundVariants = staticConfig.compoundVariants;
|
|
57
|
-
const preparedConfig = staticConfig;
|
|
58
|
-
if (!compoundVariants?.length) {
|
|
59
|
-
preparedConfig[preparedCompoundsKey] = null;
|
|
60
|
-
return;
|
|
61
|
-
}
|
|
62
|
-
const selectorCounts = [];
|
|
63
|
-
const indexesByKey = /* @__PURE__ */ Object.create(null);
|
|
64
|
-
indexesByKey[preparedCompoundsKey] = selectorCounts;
|
|
65
|
-
for (let index = 0; index < compoundVariants.length; index++) {
|
|
66
|
-
const compoundVariant = compoundVariants[index];
|
|
67
|
-
let selectorCount = 0;
|
|
68
|
-
for (const key in compoundVariant) {
|
|
69
|
-
if (key === "style") continue;
|
|
70
|
-
selectorCount++;
|
|
71
|
-
(indexesByKey[key] ||= []).push(index);
|
|
72
|
-
}
|
|
73
|
-
selectorCounts[index] = selectorCount;
|
|
74
|
-
}
|
|
75
|
-
preparedConfig[preparedCompoundsKey] = indexesByKey;
|
|
76
|
-
}
|
|
77
37
|
const conditionWidth = 4;
|
|
78
38
|
const conditionValueOffset = 0;
|
|
79
39
|
const conditionFlagsOffset = 1;
|
|
@@ -111,15 +71,6 @@ function reserveConditionCursor(cursor) {
|
|
|
111
71
|
conditionNumbers = new Float64Array(length);
|
|
112
72
|
conditionNumbers.set(previous);
|
|
113
73
|
}
|
|
114
|
-
function conditionWrapperCopy(cursor) {
|
|
115
|
-
const wrapper = conditionNumbers[cursor + conditionWrapperOffset];
|
|
116
|
-
const count = wrapper & 7;
|
|
117
|
-
if (!count) return void 0;
|
|
118
|
-
const start = wrapper >> 3;
|
|
119
|
-
const wrappers = new Array(count);
|
|
120
|
-
for (let index = 0; index < count; index++) wrappers[index] = conditionWrappers[start + index];
|
|
121
|
-
return wrappers;
|
|
122
|
-
}
|
|
123
74
|
function setConditionUnresolved(cursor, name = "") {
|
|
124
75
|
conditionNumbers[cursor + conditionFlagsOffset] &= -5;
|
|
125
76
|
if (name) {
|
|
@@ -343,161 +294,8 @@ function acquireConditionKeyCursor(state, key) {
|
|
|
343
294
|
}
|
|
344
295
|
return cursor;
|
|
345
296
|
}
|
|
346
|
-
function combineConditionKeys(state, first, second) {
|
|
347
|
-
if (!first) return second;
|
|
348
|
-
if (!second || first === second) return first;
|
|
349
|
-
const watermark = conditionCursorTop;
|
|
350
|
-
const target = acquireConditionKeyCursor(state, first);
|
|
351
|
-
resolveConditionText(state, target, second);
|
|
352
|
-
commitConditionCursor(state, target);
|
|
353
|
-
const key = conditionTexts[target + conditionKeyOffset] || "";
|
|
354
|
-
releaseConditionCursors(watermark);
|
|
355
|
-
return key;
|
|
356
|
-
}
|
|
357
|
-
function freshCompoundState() {
|
|
358
|
-
return {
|
|
359
|
-
seen: 0,
|
|
360
|
-
failed: false,
|
|
361
|
-
matchedBase: false,
|
|
362
|
-
scanned: false,
|
|
363
|
-
pending: null,
|
|
364
|
-
combinations: null
|
|
365
|
-
};
|
|
366
|
-
}
|
|
367
|
-
function beginCompoundEdges(indexes, states) {
|
|
368
|
-
if (!indexes) return;
|
|
369
|
-
for (let index = 0; index < indexes.length; index++) {
|
|
370
|
-
const state = states[indexes[index]] ||= freshCompoundState();
|
|
371
|
-
state.pending = null;
|
|
372
|
-
state.matchedBase = false;
|
|
373
|
-
state.scanned = false;
|
|
374
|
-
}
|
|
375
|
-
}
|
|
376
|
-
function feedCompoundSegment(state, source, start, end, isBase, valid, conditionKey) {
|
|
377
|
-
if (state.flatCompoundOutputDepth) return;
|
|
378
|
-
const pass = state.flatPass;
|
|
379
|
-
const indexes = pass[passCompoundIndexes];
|
|
380
|
-
const states = pass[passCompoundStates];
|
|
381
|
-
const key = pass[passCompoundKey];
|
|
382
|
-
if (!indexes || !states || !key) return;
|
|
383
|
-
const compoundVariants = state.staticConfig.compoundVariants;
|
|
384
|
-
for (let index = 0; index < indexes.length; index++) {
|
|
385
|
-
const compoundIndex = indexes[index];
|
|
386
|
-
const compoundState = states[compoundIndex] ||= freshCompoundState();
|
|
387
|
-
compoundState.scanned = true;
|
|
388
|
-
if (!valid || start === end || !compoundMatcherMatchesPayload(compoundVariants[compoundIndex][key], source, start, end)) continue;
|
|
389
|
-
if (isBase) compoundState.matchedBase = true;
|
|
390
|
-
else if (!compoundState.matchedBase) (compoundState.pending ||= []).push(conditionKey);
|
|
391
|
-
}
|
|
392
|
-
}
|
|
393
|
-
const compoundOnlyHandler = {
|
|
394
|
-
segment(state, start, end, isBase, valid, source, chainStart, chainEnd, chainValid) {
|
|
395
|
-
if (isBase) {
|
|
396
|
-
feedCompoundSegment(state, source, start, end, true, valid, "");
|
|
397
|
-
return;
|
|
398
|
-
}
|
|
399
|
-
const cursor = state.flatScanCursor;
|
|
400
|
-
if (!chainValid || !cursor || !(conditionNumbers[cursor + conditionFlagsOffset] & conditionResolvedFlag) || !conditionNumbers[cursor + conditionValueOffset]) {
|
|
401
|
-
feedCompoundSegment(state, source, start, end, false, false, "");
|
|
402
|
-
return;
|
|
403
|
-
}
|
|
404
|
-
feedCompoundSegment(state, source, start, end, false, valid, conditionTexts[cursor + conditionKeyOffset] || "");
|
|
405
|
-
},
|
|
406
|
-
modifier(state, start, end, valid, first, source) {
|
|
407
|
-
let cursor = state.flatScanCursor;
|
|
408
|
-
if (!cursor) cursor = state.flatScanCursor = acquireConditionCursor();
|
|
409
|
-
else if (first) resetConditionCursor(cursor, 0);
|
|
410
|
-
if (!valid) {
|
|
411
|
-
setConditionUnresolved(cursor);
|
|
412
|
-
return;
|
|
413
|
-
}
|
|
414
|
-
if (conditionNumbers[cursor + conditionFlagsOffset] & conditionResolvedFlag) resolveConditionModifier(state, cursor, source.slice(start, end));
|
|
415
|
-
},
|
|
416
|
-
chain(state, _start, _end, valid) {
|
|
417
|
-
const cursor = state.flatScanCursor;
|
|
418
|
-
if (cursor) {
|
|
419
|
-
if (!valid) setConditionUnresolved(cursor);
|
|
420
|
-
if (conditionNumbers[cursor + conditionFlagsOffset] & conditionResolvedFlag) commitConditionCursor(state, cursor);
|
|
421
|
-
}
|
|
422
|
-
return true;
|
|
423
|
-
}
|
|
424
|
-
};
|
|
425
|
-
function finishCompoundEdges(pass, key, value, indexes, states) {
|
|
426
|
-
if (!indexes) return;
|
|
427
|
-
const state = pass[passStyleState];
|
|
428
|
-
pass[passCompoundIndexes] = indexes;
|
|
429
|
-
pass[passCompoundKey] = key;
|
|
430
|
-
pass[passCompoundStates] = states;
|
|
431
|
-
let needsScan = false;
|
|
432
|
-
for (let index = 0; index < indexes.length; index++) if (!(states[indexes[index]] ||= freshCompoundState()).scanned) {
|
|
433
|
-
needsScan = true;
|
|
434
|
-
break;
|
|
435
|
-
}
|
|
436
|
-
if (needsScan) if (typeof value === "string") {
|
|
437
|
-
const watermark = conditionCursorTop;
|
|
438
|
-
const previousCursor = state.flatScanCursor;
|
|
439
|
-
state.flatScanCursor = null;
|
|
440
|
-
try {
|
|
441
|
-
scanFlatValue(value, compoundOnlyHandler, state);
|
|
442
|
-
} finally {
|
|
443
|
-
state.flatScanCursor = previousCursor;
|
|
444
|
-
releaseConditionCursors(watermark);
|
|
445
|
-
}
|
|
446
|
-
} else if (value && typeof value === "object" && !Array.isArray(value) && !isVariable(value) && Object.prototype.hasOwnProperty.call(value, "default")) for (const conditionKey in value) {
|
|
447
|
-
const payload = value[conditionKey];
|
|
448
|
-
if (conditionKey === "default") {
|
|
449
|
-
const payloadString = String(payload);
|
|
450
|
-
feedCompoundSegment(state, payloadString, 0, payloadString.length, true, true, "");
|
|
451
|
-
} else {
|
|
452
|
-
const watermark = conditionCursorTop;
|
|
453
|
-
const cursor = acquireConditionCursor();
|
|
454
|
-
resolveConditionText(state, cursor, conditionKey);
|
|
455
|
-
const condition = commitConditionCursor(state, cursor);
|
|
456
|
-
const payloadString = String(payload);
|
|
457
|
-
feedCompoundSegment(state, payloadString, 0, payloadString.length, false, Boolean(condition), condition ? conditionTexts[cursor + conditionKeyOffset] || "" : "");
|
|
458
|
-
releaseConditionCursors(watermark);
|
|
459
|
-
}
|
|
460
|
-
}
|
|
461
|
-
else {
|
|
462
|
-
const variants2 = state.staticConfig.compoundVariants;
|
|
463
|
-
for (let index = 0; index < indexes.length; index++) {
|
|
464
|
-
const compoundIndex = indexes[index];
|
|
465
|
-
const compoundState = states[compoundIndex] ||= freshCompoundState();
|
|
466
|
-
compoundState.scanned = true;
|
|
467
|
-
if (compoundMatcherMatches(variants2[compoundIndex][key], value)) compoundState.matchedBase = true;
|
|
468
|
-
}
|
|
469
|
-
}
|
|
470
|
-
const variants = state.staticConfig.compoundVariants;
|
|
471
|
-
const selectorCounts = state.staticConfig[preparedCompoundsKey][preparedCompoundsKey];
|
|
472
|
-
for (let index = 0; index < indexes.length; index++) {
|
|
473
|
-
const compoundIndex = indexes[index];
|
|
474
|
-
const compoundState = states[compoundIndex];
|
|
475
|
-
if (compoundState.failed) continue;
|
|
476
|
-
const branches = compoundState.matchedBase ? [""] : compoundState.pending;
|
|
477
|
-
if (!branches || !branches.length) {
|
|
478
|
-
compoundState.failed = true;
|
|
479
|
-
continue;
|
|
480
|
-
}
|
|
481
|
-
if (!compoundState.seen) compoundState.combinations = branches;
|
|
482
|
-
else {
|
|
483
|
-
const previous = compoundState.combinations;
|
|
484
|
-
const next = [];
|
|
485
|
-
for (let left = 0; left < previous.length; left++) for (let right = 0; right < branches.length; right++) {
|
|
486
|
-
const conditionKey = combineConditionKeys(state, previous[left], branches[right]);
|
|
487
|
-
if (!next.includes(conditionKey)) next.push(conditionKey);
|
|
488
|
-
}
|
|
489
|
-
compoundState.combinations = next;
|
|
490
|
-
}
|
|
491
|
-
compoundState.seen++;
|
|
492
|
-
if (compoundState.seen !== selectorCounts[compoundIndex]) continue;
|
|
493
|
-
const style = variants[compoundIndex].style;
|
|
494
|
-
if (!isPlainObject(style)) continue;
|
|
495
|
-
const combinations = compoundState.combinations;
|
|
496
|
-
for (let combination = 0; combination < combinations.length; combination++) for (const styleKey in style) contributeProp(pass, styleKey, style[styleKey], void 0, states, combinations[combination]);
|
|
497
|
-
}
|
|
498
|
-
}
|
|
499
297
|
function classifyConditionalObject(value, state, isChain, firstCursor) {
|
|
500
|
-
if (
|
|
298
|
+
if ("default" in value) return -1;
|
|
501
299
|
for (const key in value) {
|
|
502
300
|
if (!key.length) return 0;
|
|
503
301
|
if (!state) return isChain?.(key) ? 1 : 0;
|
|
@@ -523,9 +321,6 @@ const passFrontendContainer = 27;
|
|
|
523
321
|
const passFrontendContainerType = 28;
|
|
524
322
|
const passHocMappedProperties = 29;
|
|
525
323
|
const passHocMappedClasses = 30;
|
|
526
|
-
const passCompoundIndexes = 31;
|
|
527
|
-
const passCompoundKey = 32;
|
|
528
|
-
const passCompoundStates = 33;
|
|
529
324
|
const passParentCursor = 35;
|
|
530
325
|
const passMapSourceKey = 36;
|
|
531
326
|
const passMapFlags = 37;
|
|
@@ -537,92 +332,23 @@ const passHocFlag = 16;
|
|
|
537
332
|
const passTextFlag = 32;
|
|
538
333
|
const passInputFlag = 64;
|
|
539
334
|
const passAsChildStyleFlag = 128;
|
|
540
|
-
const styledDefaultsCache = /* @__PURE__ */ new WeakMap();
|
|
541
|
-
function getStyledDefaults(staticConfig, shorthands) {
|
|
542
|
-
let prepared = styledDefaultsCache.get(staticConfig);
|
|
543
|
-
if (prepared === void 0) {
|
|
544
|
-
let entries = null;
|
|
545
|
-
const defaults = staticConfig.defaultProps;
|
|
546
|
-
if (defaults) for (const key in defaults) {
|
|
547
|
-
if (!(key in stylePropsAll || key in shorthands)) continue;
|
|
548
|
-
const value = defaults[key];
|
|
549
|
-
if (maybeStyleProgram(value)) (entries ||= []).push(key, value);
|
|
550
|
-
}
|
|
551
|
-
prepared = entries;
|
|
552
|
-
styledDefaultsCache.set(staticConfig, prepared);
|
|
553
|
-
}
|
|
554
|
-
return prepared;
|
|
555
|
-
}
|
|
556
|
-
const maybeStyleProgram = (value) => typeof value === "string" ? value.indexOf(":") !== -1 : !!value && typeof value === "object" && !Array.isArray(value) && !isVariable(value);
|
|
557
|
-
function contributeDisplacedStyledDefaults(styledDefaults, processedProps, pass) {
|
|
558
|
-
if (!styledDefaults) return;
|
|
559
|
-
for (let offset = 0; offset < styledDefaults.length; offset += 2) {
|
|
560
|
-
const key = styledDefaults[offset];
|
|
561
|
-
const value = styledDefaults[offset + 1];
|
|
562
|
-
const propValue = processedProps[key];
|
|
563
|
-
if (propValue !== void 0 && propValue !== value) contributeProp(pass, key, value);
|
|
564
|
-
}
|
|
565
|
-
}
|
|
566
|
-
function injectDisplacedStyledDefault(pass, key, value) {
|
|
567
|
-
const defaultValue = pass[4].defaultProps?.[key];
|
|
568
|
-
if (defaultValue === void 0 || value === void 0 || value === defaultValue || maybeStyleProgram(defaultValue)) return;
|
|
569
|
-
const state = pass[passStyleState];
|
|
570
|
-
state.flatWeakContribution = true;
|
|
571
|
-
try {
|
|
572
|
-
contributeProp(pass, key, defaultValue);
|
|
573
|
-
} finally {
|
|
574
|
-
state.flatWeakContribution = false;
|
|
575
|
-
}
|
|
576
|
-
}
|
|
577
335
|
function forEachPropInForwardOrder(pass) {
|
|
578
336
|
const styleState = pass[passStyleState];
|
|
579
|
-
const staticConfig = styleState.staticConfig;
|
|
580
337
|
const processedProps = styleState.props;
|
|
581
|
-
const
|
|
582
|
-
const
|
|
583
|
-
const
|
|
584
|
-
const directState = styleState;
|
|
585
|
-
const preparedCompounds = staticConfig[preparedCompoundsKey];
|
|
586
|
-
if (preparedCompounds === void 0 && staticConfig.compoundVariants?.length) throw new Error("A component with compoundVariants reached style resolution before its static config was prepared.");
|
|
338
|
+
const styleStaticConfig = styleState.flatStyleStaticConfig;
|
|
339
|
+
const baseStyle = styleStaticConfig.baseStyle;
|
|
340
|
+
const baseVariantProps = styleStaticConfig.baseVariantProps;
|
|
587
341
|
const conditionWrapperBase = conditionWrapperTop;
|
|
588
|
-
if (!preparedCompounds) {
|
|
589
|
-
try {
|
|
590
|
-
if (processedBaseStyle) for (const key in processedBaseStyle) contributeProp(pass, key, processedBaseStyle[key]);
|
|
591
|
-
contributeDisplacedStyledDefaults(styledDefaults, processedProps, pass);
|
|
592
|
-
for (const key in processedProps) {
|
|
593
|
-
const value = processedProps[key];
|
|
594
|
-
directState.flatPropSawCondition = false;
|
|
595
|
-
contributeProp(pass, key, value);
|
|
596
|
-
if (directState.flatPropSawCondition) injectDisplacedStyledDefault(pass, key, value);
|
|
597
|
-
}
|
|
598
|
-
} finally {
|
|
599
|
-
releaseConditionPayloads(conditionWrapperBase);
|
|
600
|
-
}
|
|
601
|
-
return;
|
|
602
|
-
}
|
|
603
|
-
const compoundVariants = staticConfig.compoundVariants;
|
|
604
|
-
const compoundStates = new Array(compoundVariants.length);
|
|
605
342
|
try {
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
const selectorCounts = preparedCompounds[preparedCompoundsKey];
|
|
609
|
-
for (let compoundIndex = 0; compoundIndex < compoundVariants.length; compoundIndex++) {
|
|
610
|
-
if (selectorCounts[compoundIndex]) continue;
|
|
611
|
-
const style = compoundVariants[compoundIndex].style;
|
|
612
|
-
if (!isPlainObject(style)) continue;
|
|
613
|
-
for (const key in style) contributeProp(pass, key, style[key]);
|
|
614
|
-
}
|
|
343
|
+
const appliesBaseStyle = baseStyle && !processedProps.asChild;
|
|
344
|
+
if (appliesBaseStyle) for (const key in baseStyle) contributeProp(pass, key, baseVariantProps && Object.hasOwn(baseVariantProps, key) && Object.hasOwn(processedProps, key) ? processedProps[key] : baseStyle[key]);
|
|
615
345
|
for (const key in processedProps) {
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
beginCompoundEdges(compoundIndexes, compoundStates);
|
|
619
|
-
directState.flatPropSawCondition = false;
|
|
620
|
-
contributeProp(pass, key, value, compoundIndexes, compoundStates);
|
|
621
|
-
if (directState.flatPropSawCondition) injectDisplacedStyledDefault(pass, key, value);
|
|
622
|
-
finishCompoundEdges(pass, key, value, compoundIndexes, compoundStates);
|
|
346
|
+
if (appliesBaseStyle && baseVariantProps && Object.hasOwn(baseVariantProps, key)) continue;
|
|
347
|
+
contributeProp(pass, key, processedProps[key]);
|
|
623
348
|
}
|
|
624
|
-
}
|
|
349
|
+
} catch (error) {
|
|
625
350
|
releaseConditionPayloads(conditionWrapperBase);
|
|
351
|
+
throw error;
|
|
626
352
|
}
|
|
627
353
|
}
|
|
628
354
|
function isValidStyleKey(key, validStyles, accept) {
|
|
@@ -710,13 +436,8 @@ function mapContributedProp(styleState, key, val, originalVal, condition) {
|
|
|
710
436
|
viewProps[key] = val;
|
|
711
437
|
}
|
|
712
438
|
}
|
|
713
|
-
function contributeProp(pass, keyOg, valOg,
|
|
439
|
+
function contributeProp(pass, keyOg, valOg, parentConditionKey) {
|
|
714
440
|
const parentWatermark = conditionCursorTop;
|
|
715
|
-
if (compoundIndexes) {
|
|
716
|
-
pass[passCompoundIndexes] = compoundIndexes;
|
|
717
|
-
pass[passCompoundKey] = keyOg;
|
|
718
|
-
pass[passCompoundStates] = compoundStates;
|
|
719
|
-
} else if (pass[passCompoundIndexes]) pass[passCompoundIndexes] = void 0;
|
|
720
441
|
if (parentConditionKey) pass[passParentCursor] = acquireConditionKeyCursor(pass[passStyleState], parentConditionKey);
|
|
721
442
|
try {
|
|
722
443
|
const [styleState, conf, props, viewProps, staticConfig, validStyles, accept, neverSkipProps, variants, inlineProps, parentVariants, styleFrontend, styledContext, styledContextKeys, flags, debug, parentStaticConfig, defaultProps, driverAnimations, driverOutputStyle, elementType] = pass;
|
|
@@ -850,8 +571,8 @@ function contributeProp(pass, keyOg, valOg, compoundIndexes, compoundStates, par
|
|
|
850
571
|
for (const key in normalized) {
|
|
851
572
|
if (normalized[key] == null) continue;
|
|
852
573
|
if (pass[passHocMappedProperties]?.delete(key)) clearDirectStyle(styleState, key);
|
|
853
|
-
if (key === "containerName"
|
|
854
|
-
if (key === "containerType"
|
|
574
|
+
if (key === "containerName") pass[passContainerName] = normalized[key];
|
|
575
|
+
else if (key === "containerType") pass[passContainerType] = normalized[key];
|
|
855
576
|
contributeValue(styleState, key, normalized[key], mergeStyle, styleOriginals?.[key]);
|
|
856
577
|
}
|
|
857
578
|
}
|
|
@@ -889,6 +610,11 @@ function contributeProp(pass, keyOg, valOg, compoundIndexes, compoundStates, par
|
|
|
889
610
|
return;
|
|
890
611
|
}
|
|
891
612
|
}
|
|
613
|
+
if (isValidStyleKeyInit && valInit == null && keyOg in props) {
|
|
614
|
+
clearDirectStyle(styleState, keyInit);
|
|
615
|
+
if (styledContextKeys?.has(keyInit)) (styleState.overriddenContextProps ||= {})[keyInit] = valInit;
|
|
616
|
+
return;
|
|
617
|
+
}
|
|
892
618
|
let isVariant = !isValidStyleKeyInit && variants && keyInit in variants;
|
|
893
619
|
const isStyleLikeKey = isValidStyleKeyInit || isVariant;
|
|
894
620
|
const isStyleProp = isValidStyleKeyInit || isVariant && !noExpand;
|
|
@@ -948,9 +674,9 @@ function contributeProp(pass, keyOg, valOg, compoundIndexes, compoundStates, par
|
|
|
948
674
|
releaseConditionCursors(parentWatermark);
|
|
949
675
|
}
|
|
950
676
|
}
|
|
951
|
-
const getSplitStyles = (props, staticConfig, theme, themeName, componentState, styleProps, parentSplitStyles, componentContext, groupContext, elementType, startedUnhydrated, debug, animationDriver) => {
|
|
677
|
+
const getSplitStyles = (props, staticConfig, theme, themeName, componentState, styleProps, parentSplitStyles, componentContext, groupContext, elementType, startedUnhydrated, debug, animationDriver, styleStaticConfig) => {
|
|
952
678
|
const conf = getConfig();
|
|
953
|
-
|
|
679
|
+
styleStaticConfig ||= getStyleStaticConfig(staticConfig, conf);
|
|
954
680
|
const driver = animationDriver || componentContext?.animationDriver || conf.animations;
|
|
955
681
|
const driverAnimations = driver?.animations;
|
|
956
682
|
const driverInputStyle = driver?.inputStyle;
|
|
@@ -958,7 +684,8 @@ const getSplitStyles = (props, staticConfig, theme, themeName, componentState, s
|
|
|
958
684
|
const resolvedDriver = driver?.isStub ? null : driver;
|
|
959
685
|
if (props.passThrough) return null;
|
|
960
686
|
const { shorthands } = conf;
|
|
961
|
-
const { isHOC, isText, isInput,
|
|
687
|
+
const { isHOC, isText, isInput, inlineProps, parentStaticConfig, acceptsClassName } = staticConfig;
|
|
688
|
+
const variants = styleStaticConfig.variants;
|
|
962
689
|
const viewProps = {};
|
|
963
690
|
const mediaState$1 = styleProps.mediaState || mediaState;
|
|
964
691
|
let shouldDoClasses = !process.env.TAMAGUI_DID_OUTPUT_CSS && acceptsClassName && !styleProps.noClass;
|
|
@@ -967,7 +694,7 @@ const getSplitStyles = (props, staticConfig, theme, themeName, componentState, s
|
|
|
967
694
|
let hasMedia = false;
|
|
968
695
|
let pseudoGroups;
|
|
969
696
|
let mediaGroups;
|
|
970
|
-
const staticPassthroughClassName =
|
|
697
|
+
const staticPassthroughClassName = styleStaticConfig.passthroughClassName || "";
|
|
971
698
|
let className = staticPassthroughClassName;
|
|
972
699
|
if (staticPassthroughClassName) shouldDoClasses = false;
|
|
973
700
|
const validStyles$1 = staticConfig.validStyles || (staticConfig.isText || staticConfig.isInput ? stylePropsText : validStyles);
|
|
@@ -991,6 +718,7 @@ const getSplitStyles = (props, staticConfig, theme, themeName, componentState, s
|
|
|
991
718
|
flatGroupContext: groupContext,
|
|
992
719
|
animationDriver: resolvedDriver
|
|
993
720
|
};
|
|
721
|
+
styleState.flatStyleStaticConfig = styleStaticConfig;
|
|
994
722
|
if (canGenerateCSS && shouldDoClasses && styleProps.canPlatformPseudo) styleState.flatDeferCSS = true;
|
|
995
723
|
if (process.env.NODE_ENV === "development" && (debug === "profile" || globalThis.time)) time`style-state`;
|
|
996
724
|
if (process.env.NODE_ENV === "development" && debug === "verbose" && isClient) {
|
|
@@ -1010,24 +738,21 @@ const getSplitStyles = (props, staticConfig, theme, themeName, componentState, s
|
|
|
1010
738
|
}
|
|
1011
739
|
const { asChild } = props;
|
|
1012
740
|
const { accept, neverSkipProps } = staticConfig;
|
|
1013
|
-
const { noSkip, disableExpandShorthands, noExpand, noClass, noMergeStyle, noNormalize, isAnimated, styledContext
|
|
741
|
+
const { noSkip, disableExpandShorthands, noExpand, noClass, noMergeStyle, noNormalize, isAnimated, styledContext } = styleProps;
|
|
742
|
+
const styledContextKeys = styleStaticConfig.styledContextKeys;
|
|
1014
743
|
const styleFrontend = staticConfig.styleFrontend;
|
|
1015
744
|
let frontendGroup;
|
|
1016
745
|
let frontendContainer;
|
|
1017
746
|
let frontendContainerType;
|
|
1018
747
|
const processedProps = props;
|
|
1019
|
-
const parentVariants = parentStaticConfig
|
|
1020
|
-
const defaultProps = asChild ?
|
|
748
|
+
const parentVariants = parentStaticConfig ? getStyleStaticConfig(parentStaticConfig, conf).variants : void 0;
|
|
749
|
+
const defaultProps = asChild ? styleStaticConfig.defaultProps : void 0;
|
|
1021
750
|
const asChildExceptStyleLike = asChild === "except-style" || asChild === "except-style-web";
|
|
1022
751
|
let containerValue;
|
|
1023
752
|
let containerName;
|
|
1024
753
|
let containerType;
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
const authoredContainerType = processedProps.containerType;
|
|
1028
|
-
containerName = typeof authoredContainerName === "string" && authoredContainerName.indexOf(":") === -1 ? authoredContainerName : void 0;
|
|
1029
|
-
containerType = typeof authoredContainerType === "string" && authoredContainerType.indexOf(":") === -1 ? authoredContainerType : void 0;
|
|
1030
|
-
}
|
|
754
|
+
containerName = processedProps.containerName;
|
|
755
|
+
containerType = processedProps.containerType;
|
|
1031
756
|
let hocMappedClassProperties;
|
|
1032
757
|
let hocMappedClasses;
|
|
1033
758
|
const pass = [
|
|
@@ -1064,38 +789,36 @@ const getSplitStyles = (props, staticConfig, theme, themeName, componentState, s
|
|
|
1064
789
|
hocMappedClasses
|
|
1065
790
|
];
|
|
1066
791
|
styleState.flatPass = pass;
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
if (
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
pseudoGroups
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
}
|
|
1098
|
-
completeStreaming(styleState, mergeStyle);
|
|
792
|
+
let conditionalStates = null;
|
|
793
|
+
let usesSafeArea = false;
|
|
794
|
+
const conditionWrapperBase = conditionWrapperTop;
|
|
795
|
+
try {
|
|
796
|
+
forEachPropInForwardOrder(pass);
|
|
797
|
+
[, , , , , , , , , , , , , , , , , , , , , className, shouldDoClasses, containerValue, containerName, containerType, frontendGroup, frontendContainer, frontendContainerType, hocMappedClassProperties, hocMappedClasses] = pass;
|
|
798
|
+
if (containerValue) {
|
|
799
|
+
containerName ??= typeof containerValue === "string" ? containerValue : void 0;
|
|
800
|
+
containerType ??= "inline-size";
|
|
801
|
+
contributeValue(styleState, containerName ? "container" : "containerType", containerName ? `${containerName} / ${containerType}` : containerType, mergeStyle);
|
|
802
|
+
}
|
|
803
|
+
if (process.env.NODE_ENV === "development" && (debug === "profile" || globalThis.time)) time`split-styles-propsend`;
|
|
804
|
+
conditionalStates = styleState.flatStateKeys || null;
|
|
805
|
+
usesSafeArea = !!styleState.flatUsesSafeArea;
|
|
806
|
+
hasMedia = styleState.flatMediaKeys?.size ? styleState.flatMediaKeys : false;
|
|
807
|
+
pseudoGroups = styleState.flatGroupKeys?.size ? styleState.flatGroupKeys : void 0;
|
|
808
|
+
mediaGroups = styleState.flatGroupMedia?.size ? styleState.flatGroupMedia : void 0;
|
|
809
|
+
if (styleProps.canPlatformPseudo && styleState.flatHasPlatformPseudo) {
|
|
810
|
+
shouldDoClasses = false;
|
|
811
|
+
styleState.flatShouldDoClasses = false;
|
|
812
|
+
if (styleState.transformAccumulator) {
|
|
813
|
+
mergeStyle(styleState, "transform", finalizeTransformAccumulator(styleState.transformAccumulator), true);
|
|
814
|
+
styleState.transformAccumulator = void 0;
|
|
815
|
+
}
|
|
816
|
+
convertDeferredInline(styleState, mergeStyle);
|
|
817
|
+
}
|
|
818
|
+
completeStreaming(styleState, mergeStyle);
|
|
819
|
+
} finally {
|
|
820
|
+
releaseConditionPayloads(conditionWrapperBase);
|
|
821
|
+
}
|
|
1099
822
|
const effectiveTransition = styleState.style?.transition;
|
|
1100
823
|
if (effectiveTransition != null && styleState.style && driverOutputStyle !== "css") delete styleState.style.transition;
|
|
1101
824
|
if (!(noNormalize === false)) {
|
|
@@ -1218,9 +941,9 @@ const getSplitStyles = (props, staticConfig, theme, themeName, componentState, s
|
|
|
1218
941
|
if (process.env.NODE_ENV === "development" && (debug === "profile" || globalThis.time)) time`split-styles-done`;
|
|
1219
942
|
return result;
|
|
1220
943
|
};
|
|
1221
|
-
function mergeStyle(styleState, key, val,
|
|
944
|
+
function mergeStyle(styleState, key, val, disableNormalize = false, originalVal) {
|
|
1222
945
|
const { viewProps, styleProps, staticConfig } = styleState;
|
|
1223
|
-
if (
|
|
946
|
+
if (styleState.flatStyleStaticConfig.styledContextKeys?.has(key)) {
|
|
1224
947
|
styleState.overriddenContextProps ||= {};
|
|
1225
948
|
const originalFromState = styleState.originalContextPropValues?.[key];
|
|
1226
949
|
styleState.overriddenContextProps[key] = originalVal ?? originalFromState ?? val;
|
|
@@ -1245,7 +968,7 @@ function recordStyleTokenProvenance(styleState, key, originalVal) {
|
|
|
1245
968
|
const opacity = slash === -1 ? NaN : Number(tokenName.slice(slash + 1));
|
|
1246
969
|
if (Number.isInteger(opacity) && opacity >= 0 && opacity <= 100) tokenName = tokenName.slice(0, slash);
|
|
1247
970
|
}
|
|
1248
|
-
if (tokenName !== "" && (
|
|
971
|
+
if (tokenName !== "" && (tokenName in styleState.theme || tokenName in (styleState.conf.themes?.[styleState.flatThemeName || ""] || {}) || Object.values(styleState.conf.tokensParsed).some((category) => tokenName in category))) (styleState.tokenProvenance ||= {})[key] = originalVal;
|
|
1249
972
|
else if (styleState.tokenProvenance && key in styleState.tokenProvenance) delete styleState.tokenProvenance[key];
|
|
1250
973
|
}
|
|
1251
974
|
const resolveAcceptedStyle = (styleState, styleIn) => {
|
|
@@ -1267,7 +990,7 @@ const resolveAcceptedStyle = (styleState, styleIn) => {
|
|
|
1267
990
|
childState.flatSingleEntries = void 0;
|
|
1268
991
|
childState.flatSlots = void 0;
|
|
1269
992
|
childState.flatBorderDefaultRequests = void 0;
|
|
1270
|
-
const mergeAccepted = (_state, key, value,
|
|
993
|
+
const mergeAccepted = (_state, key, value, disableNormalize, originalValue) => {
|
|
1271
994
|
styleOut[key] = disableNormalize || styleProps.noNormalize ? value : normalizeValueWithProperty(value, key);
|
|
1272
995
|
const trackedOriginal = styleInOriginalValues?.[key] ?? originalValue;
|
|
1273
996
|
if (trackedOriginal !== void 0) (originalValues ||= {})[key] = trackedOriginal;
|
|
@@ -1295,22 +1018,24 @@ function streamWriteCSS(state, property, value, cursor, original, conditionOverr
|
|
|
1295
1018
|
const identity = cursor ? conditionTexts[cursor + conditionKeyOffset] || "" : "";
|
|
1296
1019
|
if (property.charCodeAt(0) === 116 && property.startsWith("transition")) {
|
|
1297
1020
|
const transitions = direct.flatTransitions ||= [];
|
|
1298
|
-
for (let index = 0; index < transitions.length; index++) if (transitions[index]
|
|
1299
|
-
transitions[index]
|
|
1300
|
-
transitions[index]
|
|
1021
|
+
for (let index = 0; index < transitions.length; index++) if (transitions[index][0] === property && transitions[index][3] === identity) {
|
|
1022
|
+
transitions[index][1] = value;
|
|
1023
|
+
transitions[index][2] = condition;
|
|
1301
1024
|
return;
|
|
1302
1025
|
}
|
|
1303
|
-
transitions.push(
|
|
1026
|
+
transitions.push([
|
|
1304
1027
|
property,
|
|
1305
1028
|
value,
|
|
1306
1029
|
condition,
|
|
1307
1030
|
identity,
|
|
1308
|
-
|
|
1309
|
-
|
|
1310
|
-
|
|
1031
|
+
cursor ? conditionTexts[cursor + conditionSelectorOffset] || "" : "",
|
|
1032
|
+
cursor ? conditionWrappers : void 0,
|
|
1033
|
+
cursor ? conditionNumbers[cursor + conditionWrapperOffset] >> 3 : 0,
|
|
1034
|
+
cursor ? conditionNumbers[cursor + conditionWrapperOffset] & 7 : 0
|
|
1035
|
+
]);
|
|
1311
1036
|
return;
|
|
1312
1037
|
}
|
|
1313
|
-
streamAtomic(state, property, value, condition, identity, cursor ? conditionTexts[cursor + conditionSelectorOffset] || "" : "", cursor ? conditionWrappers : void 0, cursor ? conditionNumbers[cursor + conditionWrapperOffset] >> 3 : 0, cursor ? conditionNumbers[cursor + conditionWrapperOffset] & 7 : 0,
|
|
1038
|
+
streamAtomic(state, property, value, condition, identity, cursor ? conditionTexts[cursor + conditionSelectorOffset] || "" : "", cursor ? conditionWrappers : void 0, cursor ? conditionNumbers[cursor + conditionWrapperOffset] >> 3 : 0, cursor ? conditionNumbers[cursor + conditionWrapperOffset] & 7 : 0, false, original);
|
|
1314
1039
|
}
|
|
1315
1040
|
function streamWriteInline(state, property, value, cursor, merge, original, normalize = false, conditionOverride = -1) {
|
|
1316
1041
|
const direct = state;
|
|
@@ -1318,12 +1043,9 @@ function streamWriteInline(state, property, value, cursor, merge, original, norm
|
|
|
1318
1043
|
const importance = condition ? Math.floor(condition / 256) + 1 : 0;
|
|
1319
1044
|
const used = direct.flatUsed ||= {};
|
|
1320
1045
|
const previous = used[property];
|
|
1321
|
-
if (previous !== void 0)
|
|
1322
|
-
if (previous > importance) return;
|
|
1323
|
-
if (direct.flatWeakContribution === true) return;
|
|
1324
|
-
}
|
|
1046
|
+
if (previous !== void 0 && previous > importance) return;
|
|
1325
1047
|
used[property] = importance;
|
|
1326
|
-
merge(state, property, value,
|
|
1048
|
+
merge(state, property, value, !normalize, original);
|
|
1327
1049
|
}
|
|
1328
1050
|
function streamRetractInline(state, property, cursor) {
|
|
1329
1051
|
const direct = state;
|
|
@@ -1337,17 +1059,12 @@ function streamRetractInline(state, property, cursor) {
|
|
|
1337
1059
|
}
|
|
1338
1060
|
function convertDeferredInline(state, merge) {
|
|
1339
1061
|
const direct = state;
|
|
1340
|
-
const used = direct.flatUsed ||= {};
|
|
1341
1062
|
const consume = (entries) => {
|
|
1342
1063
|
for (let index = 0; index < entries.length; index++) {
|
|
1343
1064
|
const entry = entries[index];
|
|
1344
|
-
const condition = entry
|
|
1065
|
+
const condition = entry[2];
|
|
1345
1066
|
if (condition && !(condition & 1)) continue;
|
|
1346
|
-
|
|
1347
|
-
const previous = used[entry.property];
|
|
1348
|
-
if (previous !== void 0 && previous > importance) continue;
|
|
1349
|
-
used[entry.property] = importance;
|
|
1350
|
-
merge(state, entry.property, entry.value, 1, true, entry.original !== void 0 ? entry.original : entry.value);
|
|
1067
|
+
streamWriteInline(state, entry[0], entry[1], null, merge, entry[8] !== void 0 ? entry[8] : entry[1], false, condition);
|
|
1351
1068
|
}
|
|
1352
1069
|
};
|
|
1353
1070
|
const slots = direct.flatSlots;
|
|
@@ -1383,7 +1100,6 @@ function emitAtParentCondition(state, property, value, merge, originalValue, con
|
|
|
1383
1100
|
}
|
|
1384
1101
|
function emitUnderCondition(state, property, value, cursor, merge, originalValue, contextOnly, warnMode, warnSource) {
|
|
1385
1102
|
const condition = conditionNumbers[cursor + conditionValueOffset];
|
|
1386
|
-
if (merge && property && condition) state.flatPropSawCondition = true;
|
|
1387
1103
|
if (!(conditionNumbers[cursor + conditionFlagsOffset] & conditionResolvedFlag)) {
|
|
1388
1104
|
if (warnMode && process.env.NODE_ENV === "development") warnRefusedValue(property, warnSource, `unknown modifier "${conditionTexts[cursor + conditionUnresolvedNameOffset] || ""}"`);
|
|
1389
1105
|
return 0;
|
|
@@ -1406,7 +1122,6 @@ const directStyleHandler = {
|
|
|
1406
1122
|
segment(state, start, end, isBase, valid, source, chainStart, chainEnd, chainValid, chainCount, _result, failure, failureIndex, property, merge, originalValue, contextOnly) {
|
|
1407
1123
|
if (isBase) {
|
|
1408
1124
|
if (start === end) return;
|
|
1409
|
-
feedCompoundSegment(state, source, start, end, true, valid || failure === "invalid-character" || failure === "stray-comment-close", "");
|
|
1410
1125
|
if (!valid) {
|
|
1411
1126
|
if (failure === "invalid-character" || failure === "stray-comment-close") return 16;
|
|
1412
1127
|
if (process.env.NODE_ENV === "development") warnRefusedValue(property, source, failure === "unterminated-string" ? "an unterminated string" : failure === "unterminated-comment" ? "an unterminated \"/*\" comment" : "an unterminated \"(\"");
|
|
@@ -1429,10 +1144,8 @@ const directStyleHandler = {
|
|
|
1429
1144
|
const right = Number(source.slice(start, end));
|
|
1430
1145
|
if (chainStart < chainEnd && Number.isFinite(left) && left > 0 && Number.isFinite(right) && right > 0) return 12;
|
|
1431
1146
|
}
|
|
1432
|
-
const
|
|
1433
|
-
const cursor = directState.flatScanCursor;
|
|
1147
|
+
const cursor = state.flatScanCursor;
|
|
1434
1148
|
const condition = valid ? emitUnderCondition(state, property, source.slice(start, end), cursor, merge, void 0, contextOnly, 1, source) : conditionNumbers[cursor + conditionFlagsOffset] & conditionResolvedFlag ? conditionNumbers[cursor + conditionValueOffset] : 0;
|
|
1435
|
-
feedCompoundSegment(directState, source, start, end, false, valid && Boolean(condition), condition && directState.flatPass?.[passCompoundIndexes] ? conditionTexts[cursor + conditionKeyOffset] || "" : "");
|
|
1436
1149
|
if (!condition) return;
|
|
1437
1150
|
if (!valid) {
|
|
1438
1151
|
if (process.env.NODE_ENV === "development") warnRefusedValue(property, source, failure === "invalid-character" ? `"${source[failureIndex]}" would end the declaration or rule` : failure === "unterminated-string" ? "an unterminated string" : failure === "unterminated-comment" ? "an unterminated \"/*\" comment" : failure === "stray-comment-close" ? "a stray \"*/\"" : "an unterminated \"(\"");
|
|
@@ -1471,7 +1184,7 @@ const directStyleHandler = {
|
|
|
1471
1184
|
emitAtParentCondition(state, property, source, merge, originalValue ?? source, contextOnly);
|
|
1472
1185
|
hasBase = true;
|
|
1473
1186
|
}
|
|
1474
|
-
if (process.env.NODE_ENV === "development" && !hasBase && result & 4 &&
|
|
1187
|
+
if (process.env.NODE_ENV === "development" && !hasBase && result & 4 && property in propToTokenCategoryCode && splitComponents(source.slice(lastPayloadStart)).length > 1) warnOnce(`${property}="${source}" has multiple values after its first conditional. Write the base value before the first conditional.`);
|
|
1475
1188
|
if ((!canGenerateCSS || !state.flatShouldDoClasses) && result & 2 && !hasBase) {
|
|
1476
1189
|
const value = implicitLifecycleBase(property);
|
|
1477
1190
|
if (value !== null) emitAtParentCondition(state, property, value, merge, value, contextOnly);
|
|
@@ -1602,13 +1315,6 @@ function tokenVariable(state, property, name) {
|
|
|
1602
1315
|
if (category) {
|
|
1603
1316
|
const own = state.conf.tokensParsed[category]?.[lookupName];
|
|
1604
1317
|
if (own) return fillTokenLookup(own, false, lookupName);
|
|
1605
|
-
for (const sibling of [
|
|
1606
|
-
"color",
|
|
1607
|
-
"space",
|
|
1608
|
-
"size",
|
|
1609
|
-
"radius",
|
|
1610
|
-
"zIndex"
|
|
1611
|
-
]) if (sibling !== category && state.conf.tokensParsed[sibling]?.[lookupName]) return;
|
|
1612
1318
|
} else {
|
|
1613
1319
|
const first = lookupName.charCodeAt(0);
|
|
1614
1320
|
if (first >= 48 && first <= 57 || first === 43 || first === 45 || first === 46) return;
|
|
@@ -1665,10 +1371,13 @@ function configuredValue(state, property, raw) {
|
|
|
1665
1371
|
missKey = `${state.flatThemeName || ""}${property}${name}`;
|
|
1666
1372
|
if (misses.has(missKey)) return raw;
|
|
1667
1373
|
}
|
|
1374
|
+
if (process.env.NODE_ENV === "development") {
|
|
1375
|
+
const category = getTokenCategoryForProperty(property);
|
|
1376
|
+
if (category && category !== "color" && state.conf.tokensParsed.color?.[name]) warnOnce(`"${name}" contributes to "color", not "${property}"`);
|
|
1377
|
+
}
|
|
1668
1378
|
const lookup = tokenVariable(state, property, name);
|
|
1669
1379
|
if (!lookup || !isVariable(lookup.value)) {
|
|
1670
1380
|
if (misses) misses.add(missKey);
|
|
1671
|
-
if (process.env.NODE_ENV === "development" && tokenCategoryByProperty[property] && state.conf.tokensParsed.color?.[name]) warnOnce(`"${name}" contributes to "color", not "${property}"; keeping it literal`);
|
|
1672
1381
|
return raw;
|
|
1673
1382
|
}
|
|
1674
1383
|
const resolveValues = !state.flatShouldDoClasses && state.styleProps.resolveValues === "auto" ? "value" : state.styleProps.resolveValues;
|
|
@@ -1788,6 +1497,11 @@ function getDirectDynamicThemeAccess(state) {
|
|
|
1788
1497
|
function emitProperty(state, property, value, cursor, merge, originalValue, contextOnly) {
|
|
1789
1498
|
const direct = state;
|
|
1790
1499
|
const condition = cursor ? conditionNumbers[cursor + conditionValueOffset] : 0;
|
|
1500
|
+
if (value === false && !condition) {
|
|
1501
|
+
clearDirectStyle(state, property);
|
|
1502
|
+
if (direct.flatStyleStaticConfig?.styledContextKeys?.has(property)) (state.overriddenContextProps ||= {})[property] = false;
|
|
1503
|
+
return;
|
|
1504
|
+
}
|
|
1791
1505
|
if (condition & 4) (state.flatEnterKeys ||= /* @__PURE__ */ new Set()).add(property);
|
|
1792
1506
|
if (condition & 8) (state.flatExitKeys ||= /* @__PURE__ */ new Set()).add(property);
|
|
1793
1507
|
cursor && conditionTexts[cursor + conditionThemeOffset];
|
|
@@ -1803,7 +1517,7 @@ function emitProperty(state, property, value, cursor, merge, originalValue, cont
|
|
|
1803
1517
|
}
|
|
1804
1518
|
const shouldPromoteAnimatedStyle = canGenerateCSS && !condition && !state.flatShouldDoClasses && !state.styleProps.noMergeStyle && state.styleProps.isAnimated && state.animationDriver?.inputStyle === "css" && property in nonAnimatableStyleProps;
|
|
1805
1519
|
if (canGenerateCSS && (state.flatShouldDoClasses || shouldPromoteAnimatedStyle)) {
|
|
1806
|
-
if (!condition && state.style &&
|
|
1520
|
+
if (!condition && state.style && !(direct.flatUsed && direct.flatUsed[property])) delete state.style[property];
|
|
1807
1521
|
streamWriteCSS(state, property, value, cursor, originalValue);
|
|
1808
1522
|
return;
|
|
1809
1523
|
}
|
|
@@ -2112,14 +1826,11 @@ function contributeStyleObject(state, property, value, merge, contextOnly) {
|
|
|
2112
1826
|
}
|
|
2113
1827
|
}
|
|
2114
1828
|
function contributeStyleObjectInner(state, property, value, merge, contextOnly) {
|
|
2115
|
-
const
|
|
2116
|
-
const
|
|
2117
|
-
const hasDefault = Object.prototype.hasOwnProperty.call(value, "default");
|
|
1829
|
+
const parent = state.flatPass?.[passParentCursor] || null;
|
|
1830
|
+
const hasDefault = "default" in value;
|
|
2118
1831
|
let hasBase = false;
|
|
2119
1832
|
const base = hasDefault ? value.default : void 0;
|
|
2120
1833
|
if (base != null) {
|
|
2121
|
-
const baseString = String(base);
|
|
2122
|
-
feedCompoundSegment(directState, baseString, 0, baseString.length, true, true, "");
|
|
2123
1834
|
emitAtParentCondition(state, property, base, merge, base, contextOnly);
|
|
2124
1835
|
hasBase = true;
|
|
2125
1836
|
}
|
|
@@ -2139,11 +1850,7 @@ function contributeStyleObjectInner(state, property, value, merge, contextOnly)
|
|
|
2139
1850
|
return false;
|
|
2140
1851
|
}
|
|
2141
1852
|
}
|
|
2142
|
-
if (payload != null)
|
|
2143
|
-
conditions |= emitUnderCondition(state, property, payload, cursor, merge, payload, contextOnly, 1, payload);
|
|
2144
|
-
const payloadString = String(payload);
|
|
2145
|
-
feedCompoundSegment(directState, payloadString, 0, payloadString.length, false, Boolean(condition), condition && directState.flatPass?.[passCompoundIndexes] ? conditionTexts[cursor + conditionKeyOffset] || "" : "");
|
|
2146
|
-
}
|
|
1853
|
+
if (payload != null) conditions |= emitUnderCondition(state, property, payload, cursor, merge, payload, contextOnly, 1, payload);
|
|
2147
1854
|
releaseConditionCursors(watermark);
|
|
2148
1855
|
}
|
|
2149
1856
|
if (!hasDefault && firstCondition) return false;
|
|
@@ -2155,12 +1862,15 @@ function contributeStyleObjectInner(state, property, value, merge, contextOnly)
|
|
|
2155
1862
|
}
|
|
2156
1863
|
function contributeValue(state, property, value, merge, originalValue, contextOnly = false, condition) {
|
|
2157
1864
|
if (isConditionTransport(value)) {
|
|
2158
|
-
if (value
|
|
2159
|
-
|
|
2160
|
-
|
|
1865
|
+
if (value[transportHasBase]) {
|
|
1866
|
+
const base = value[transportBase];
|
|
1867
|
+
contributeValue(state, property, base, merge, base, contextOnly);
|
|
1868
|
+
}
|
|
1869
|
+
for (let offset = transportEntries; offset < value.length;) {
|
|
1870
|
+
const entryValue = value[offset];
|
|
2161
1871
|
const watermark = conditionCursorTop;
|
|
2162
1872
|
try {
|
|
2163
|
-
emitUnderCondition(state, property, entryValue, acquireTransportCursor(state, value
|
|
1873
|
+
emitUnderCondition(state, property, entryValue, acquireTransportCursor(state, value, offset, state.flatPass?.[passParentCursor] || null), merge, entryValue, contextOnly, 2, entryValue);
|
|
2164
1874
|
} finally {
|
|
2165
1875
|
releaseConditionCursors(watermark);
|
|
2166
1876
|
}
|
|
@@ -2185,7 +1895,7 @@ function contributeValue(state, property, value, merge, originalValue, contextOn
|
|
|
2185
1895
|
commitConditionCursor(state, effective);
|
|
2186
1896
|
} else effective = condition;
|
|
2187
1897
|
const isObjectValue = value && typeof value === "object" && !Array.isArray(value) && !isVariable(value);
|
|
2188
|
-
const objectHasDefault = isObjectValue &&
|
|
1898
|
+
const objectHasDefault = isObjectValue && "default" in value;
|
|
2189
1899
|
const firstChild = isObjectValue && !objectHasDefault ? acquireConditionCursor(effective) : null;
|
|
2190
1900
|
if (isObjectValue && classifyConditionalObject(value, state, void 0, firstChild || void 0)) {
|
|
2191
1901
|
let useFirstChild = firstChild !== null;
|
|
@@ -2243,17 +1953,20 @@ function clearDirectStyle(state, property) {
|
|
|
2243
1953
|
if (state.style) delete state.style[atomicKey];
|
|
2244
1954
|
delete state.classNames[atomicKey];
|
|
2245
1955
|
}
|
|
2246
|
-
const
|
|
1956
|
+
const conditionTransportTag = /* @__PURE__ */ Symbol();
|
|
1957
|
+
const transportHasBase = 1;
|
|
1958
|
+
const transportBase = 2;
|
|
1959
|
+
const transportEntries = 3;
|
|
1960
|
+
const transportEntryWidth = 2;
|
|
2247
1961
|
function isConditionTransport(value) {
|
|
2248
|
-
return
|
|
1962
|
+
return Array.isArray(value) && value[0] === conditionTransportTag;
|
|
2249
1963
|
}
|
|
2250
|
-
|
|
2251
|
-
|
|
2252
|
-
entries.push(value, conditionTexts[cursor + conditionKeyOffset] || "");
|
|
1964
|
+
function appendConditionEntry(transport, cursor, value) {
|
|
1965
|
+
transport.push(value, conditionTexts[cursor + conditionKeyOffset] || "");
|
|
2253
1966
|
}
|
|
2254
|
-
function acquireTransportCursor(state,
|
|
1967
|
+
function acquireTransportCursor(state, transport, offset, parent) {
|
|
2255
1968
|
const cursor = acquireConditionCursor(parent);
|
|
2256
|
-
const key =
|
|
1969
|
+
const key = transport[offset + 1];
|
|
2257
1970
|
if (key) resolveConditionText(state, cursor, key);
|
|
2258
1971
|
commitConditionCursor(state, cursor);
|
|
2259
1972
|
return cursor;
|
|
@@ -2262,15 +1975,14 @@ function mergeConditionTransport(state, prev, cursor, value) {
|
|
|
2262
1975
|
let transport;
|
|
2263
1976
|
if (isConditionTransport(prev)) transport = prev;
|
|
2264
1977
|
else {
|
|
2265
|
-
transport =
|
|
2266
|
-
|
|
2267
|
-
|
|
2268
|
-
|
|
2269
|
-
|
|
2270
|
-
conditionTransports.add(transport);
|
|
1978
|
+
transport = [
|
|
1979
|
+
conditionTransportTag,
|
|
1980
|
+
false,
|
|
1981
|
+
void 0
|
|
1982
|
+
];
|
|
2271
1983
|
if (prev != null) {
|
|
2272
1984
|
const isObjectValue = typeof prev === "object" && !Array.isArray(prev) && !isVariable(prev);
|
|
2273
|
-
const objectHasDefault = isObjectValue &&
|
|
1985
|
+
const objectHasDefault = isObjectValue && "default" in prev;
|
|
2274
1986
|
const authoredWatermark = conditionCursorTop;
|
|
2275
1987
|
try {
|
|
2276
1988
|
const firstCursor = isObjectValue && !objectHasDefault ? acquireConditionCursor() : null;
|
|
@@ -2280,8 +1992,8 @@ function mergeConditionTransport(state, prev, cursor, value) {
|
|
|
2280
1992
|
const payload = prev[key];
|
|
2281
1993
|
if (payload == null) continue;
|
|
2282
1994
|
if (key === "default") {
|
|
2283
|
-
transport
|
|
2284
|
-
transport
|
|
1995
|
+
transport[transportHasBase] = true;
|
|
1996
|
+
transport[transportBase] = payload;
|
|
2285
1997
|
continue;
|
|
2286
1998
|
}
|
|
2287
1999
|
const watermark = conditionCursorTop;
|
|
@@ -2291,12 +2003,12 @@ function mergeConditionTransport(state, prev, cursor, value) {
|
|
|
2291
2003
|
resolveConditionText(state, keyCursor, key);
|
|
2292
2004
|
commitConditionCursor(state, keyCursor);
|
|
2293
2005
|
}
|
|
2294
|
-
appendConditionEntry(transport
|
|
2006
|
+
appendConditionEntry(transport, keyCursor, payload);
|
|
2295
2007
|
if (keyCursor !== firstCursor) releaseConditionCursors(watermark);
|
|
2296
2008
|
}
|
|
2297
2009
|
} else {
|
|
2298
|
-
transport
|
|
2299
|
-
transport
|
|
2010
|
+
transport[transportHasBase] = true;
|
|
2011
|
+
transport[transportBase] = prev;
|
|
2300
2012
|
}
|
|
2301
2013
|
} finally {
|
|
2302
2014
|
releaseConditionCursors(authoredWatermark);
|
|
@@ -2304,29 +2016,25 @@ function mergeConditionTransport(state, prev, cursor, value) {
|
|
|
2304
2016
|
}
|
|
2305
2017
|
}
|
|
2306
2018
|
const cursorKey = conditionTexts[cursor + conditionKeyOffset] || "";
|
|
2307
|
-
for (let offset =
|
|
2308
|
-
transport.
|
|
2019
|
+
for (let offset = transportEntries; offset < transport.length; offset += transportEntryWidth) if (transport[offset + 1] === cursorKey) {
|
|
2020
|
+
transport.splice(offset, transportEntryWidth);
|
|
2309
2021
|
break;
|
|
2310
2022
|
}
|
|
2311
|
-
appendConditionEntry(transport
|
|
2023
|
+
appendConditionEntry(transport, cursor, value);
|
|
2312
2024
|
return transport;
|
|
2313
2025
|
}
|
|
2314
2026
|
const variantValueHandler = {
|
|
2315
2027
|
segment(ctx, start, end, isBase, valid, source, chainStart, chainEnd, chainValid) {
|
|
2316
2028
|
const state = ctx[0];
|
|
2317
|
-
const directState = state;
|
|
2318
2029
|
if (start === end) return;
|
|
2319
2030
|
if (isBase) {
|
|
2320
|
-
feedCompoundSegment(directState, source, start, end, true, valid, "");
|
|
2321
2031
|
if (!valid) return;
|
|
2322
2032
|
emitResolvedVariant(ctx[1], source.slice(start, end), state, ctx[2], null);
|
|
2323
2033
|
return;
|
|
2324
2034
|
}
|
|
2325
2035
|
if (!valid || !chainValid) return;
|
|
2326
|
-
const cursor =
|
|
2327
|
-
|
|
2328
|
-
feedCompoundSegment(directState, source, start, end, false, Boolean(condition), condition && directState.flatPass?.[passCompoundIndexes] ? conditionTexts[cursor + conditionKeyOffset] || "" : "");
|
|
2329
|
-
if (!condition) return;
|
|
2036
|
+
const cursor = state.flatScanCursor;
|
|
2037
|
+
if (!(cursor && conditionNumbers[cursor + conditionFlagsOffset] & conditionResolvedFlag ? conditionNumbers[cursor + conditionValueOffset] : 0)) return;
|
|
2330
2038
|
emitResolvedVariant(ctx[1], source.slice(start, end), state, ctx[2], cursor);
|
|
2331
2039
|
},
|
|
2332
2040
|
modifier(ctx, start, end, valid, first, source) {
|
|
@@ -2349,34 +2057,6 @@ const variantValueHandler = {
|
|
|
2349
2057
|
return true;
|
|
2350
2058
|
}
|
|
2351
2059
|
};
|
|
2352
|
-
const contextPropSets = /* @__PURE__ */ new WeakMap();
|
|
2353
|
-
function getContextPropSet(staticConfig) {
|
|
2354
|
-
const cached = contextPropSets.get(staticConfig);
|
|
2355
|
-
if (cached !== void 0) return cached;
|
|
2356
|
-
const contextConfig = staticConfig.context || staticConfig.parentStaticConfig?.context;
|
|
2357
|
-
const inheritedContextPropKeys = !staticConfig.context || staticConfig.context === staticConfig.parentStaticConfig?.context ? staticConfig.parentStaticConfig?.contextProps : void 0;
|
|
2358
|
-
const contextPropKeys = staticConfig.contextProps || inheritedContextPropKeys;
|
|
2359
|
-
let set = null;
|
|
2360
|
-
if (contextConfig?.props) {
|
|
2361
|
-
set ||= /* @__PURE__ */ new Set();
|
|
2362
|
-
for (const key in contextConfig.props) set.add(key);
|
|
2363
|
-
}
|
|
2364
|
-
if (contextPropKeys) {
|
|
2365
|
-
set ||= /* @__PURE__ */ new Set();
|
|
2366
|
-
for (const key of contextPropKeys) set.add(key);
|
|
2367
|
-
}
|
|
2368
|
-
if (contextConfig?.propKeys) {
|
|
2369
|
-
set ||= /* @__PURE__ */ new Set();
|
|
2370
|
-
for (const key of contextConfig.propKeys) set.add(key);
|
|
2371
|
-
}
|
|
2372
|
-
const parentPropKeys = staticConfig.parentStaticConfig?.context?.propKeys;
|
|
2373
|
-
if (parentPropKeys) {
|
|
2374
|
-
set ||= /* @__PURE__ */ new Set();
|
|
2375
|
-
for (const key of parentPropKeys) set.add(key);
|
|
2376
|
-
}
|
|
2377
|
-
contextPropSets.set(staticConfig, set);
|
|
2378
|
-
return set;
|
|
2379
|
-
}
|
|
2380
2060
|
function emitMappedValue(styleState, key, value, originalValue, nestedCondition, parentCondition, fallbackOriginal) {
|
|
2381
2061
|
const nested = nestedCondition;
|
|
2382
2062
|
const parent = parentCondition;
|
|
@@ -2397,8 +2077,8 @@ function emitMappedValue(styleState, key, value, originalValue, nestedCondition,
|
|
|
2397
2077
|
}
|
|
2398
2078
|
const contributeMappedValue = (key, value, styleState, disabled, parentCondition, fallbackOriginal) => {
|
|
2399
2079
|
if (disabled) return emitMappedValue(styleState, key, value, void 0, void 0, parentCondition, fallbackOriginal);
|
|
2400
|
-
const { conf, styleProps
|
|
2401
|
-
const
|
|
2080
|
+
const { conf, styleProps } = styleState;
|
|
2081
|
+
const variants = styleState.flatStyleStaticConfig.variants;
|
|
2402
2082
|
const { disableExpandShorthands, noExpand, resolveValues } = styleProps;
|
|
2403
2083
|
const shorthands = conf.shorthands;
|
|
2404
2084
|
if (!noExpand) {
|
|
@@ -2441,14 +2121,14 @@ const contributeMappedValue = (key, value, styleState, disabled, parentCondition
|
|
|
2441
2121
|
}
|
|
2442
2122
|
};
|
|
2443
2123
|
function resolveVariants(key, value, styleProps, styleState, parentVariantKey) {
|
|
2444
|
-
const variantDefinition = styleState.
|
|
2124
|
+
const variantDefinition = styleState.flatStyleStaticConfig.variants?.[key];
|
|
2445
2125
|
if (isConditionTransport(value)) {
|
|
2446
|
-
if (value
|
|
2447
|
-
for (let offset =
|
|
2448
|
-
const entryValue = value
|
|
2126
|
+
if (value[transportHasBase]) emitResolvedVariant(key, value[transportBase], styleState, parentVariantKey, null);
|
|
2127
|
+
for (let offset = transportEntries; offset < value.length;) {
|
|
2128
|
+
const entryValue = value[offset];
|
|
2449
2129
|
const watermark = conditionCursorTop;
|
|
2450
2130
|
try {
|
|
2451
|
-
emitResolvedVariant(key, entryValue, styleState, parentVariantKey, acquireTransportCursor(styleState, value
|
|
2131
|
+
emitResolvedVariant(key, entryValue, styleState, parentVariantKey, acquireTransportCursor(styleState, value, offset, null));
|
|
2452
2132
|
} finally {
|
|
2453
2133
|
releaseConditionCursors(watermark);
|
|
2454
2134
|
}
|
|
@@ -2474,7 +2154,7 @@ function resolveVariants(key, value, styleProps, styleState, parentVariantKey) {
|
|
|
2474
2154
|
return;
|
|
2475
2155
|
}
|
|
2476
2156
|
const isObjectValue = value && typeof value === "object" && !Array.isArray(value) && !isVariable(value);
|
|
2477
|
-
const objectHasDefault = isObjectValue &&
|
|
2157
|
+
const objectHasDefault = isObjectValue && "default" in value;
|
|
2478
2158
|
const objectWatermark = conditionCursorTop;
|
|
2479
2159
|
try {
|
|
2480
2160
|
const firstCursor = isObjectValue && !objectHasDefault ? acquireConditionCursor() : null;
|
|
@@ -2483,22 +2163,18 @@ function resolveVariants(key, value, styleProps, styleState, parentVariantKey) {
|
|
|
2483
2163
|
for (const objKey in value) {
|
|
2484
2164
|
const payload = value[objKey];
|
|
2485
2165
|
if (payload == null) continue;
|
|
2486
|
-
const directState = styleState;
|
|
2487
|
-
const payloadString = String(payload);
|
|
2488
2166
|
if (objKey === "default") {
|
|
2489
|
-
feedCompoundSegment(directState, payloadString, 0, payloadString.length, true, true, "");
|
|
2490
2167
|
emitResolvedVariant(key, payload, styleState, parentVariantKey, null);
|
|
2491
2168
|
continue;
|
|
2492
2169
|
}
|
|
2493
2170
|
const watermark = conditionCursorTop;
|
|
2494
2171
|
const cursor = useFirstCursor ? firstCursor : acquireConditionCursor();
|
|
2495
|
-
|
|
2172
|
+
conditionNumbers[cursor + conditionValueOffset];
|
|
2496
2173
|
if (useFirstCursor) useFirstCursor = false;
|
|
2497
2174
|
else {
|
|
2498
2175
|
resolveConditionText(styleState, cursor, objKey);
|
|
2499
|
-
|
|
2176
|
+
commitConditionCursor(styleState, cursor);
|
|
2500
2177
|
}
|
|
2501
|
-
if (directState.flatPass?.[passCompoundIndexes]) feedCompoundSegment(directState, payloadString, 0, payloadString.length, false, Boolean(condition), condition ? conditionTexts[cursor + conditionKeyOffset] || "" : "");
|
|
2502
2178
|
emitResolvedVariant(key, payload, styleState, parentVariantKey, cursor);
|
|
2503
2179
|
if (cursor !== firstCursor) releaseConditionCursors(watermark);
|
|
2504
2180
|
}
|
|
@@ -2510,31 +2186,13 @@ function resolveVariants(key, value, styleProps, styleState, parentVariantKey) {
|
|
|
2510
2186
|
emitResolvedVariant(key, value, styleState, parentVariantKey, null);
|
|
2511
2187
|
}
|
|
2512
2188
|
function emitResolvedVariant(key, value, styleState, parentVariantKey, conditionCursor) {
|
|
2513
|
-
const {
|
|
2189
|
+
const { conf, debug } = styleState;
|
|
2514
2190
|
const styleProps = styleState.styleProps;
|
|
2515
|
-
const
|
|
2191
|
+
const variants = styleState.flatStyleStaticConfig.variants;
|
|
2516
2192
|
if (!variants) return;
|
|
2517
2193
|
const variant = variants[key];
|
|
2518
2194
|
let variantValue = getVariantDefinition(variant, value, conf, styleState);
|
|
2519
|
-
if (
|
|
2520
|
-
console.groupCollapsed(`\u2666\uFE0F\u2666\uFE0F\u2666\uFE0F resolve variant ${key}`);
|
|
2521
|
-
console.info({
|
|
2522
|
-
key,
|
|
2523
|
-
value,
|
|
2524
|
-
variantValue,
|
|
2525
|
-
variants
|
|
2526
|
-
});
|
|
2527
|
-
console.groupEnd();
|
|
2528
|
-
}
|
|
2529
|
-
if (!variantValue) {
|
|
2530
|
-
if (process.env.TAMAGUI_WARN_ON_MISSING_VARIANT === "1") {
|
|
2531
|
-
if (typeof value !== "boolean") {
|
|
2532
|
-
const name = styleState.styleProps.displayName || "[UnnamedComponent]";
|
|
2533
|
-
console.warn(`No variant found: ${name} has variant "${key}", but no matching value "${value}"`);
|
|
2534
|
-
}
|
|
2535
|
-
}
|
|
2536
|
-
return;
|
|
2537
|
-
}
|
|
2195
|
+
if (!variantValue) return;
|
|
2538
2196
|
if (typeof variantValue === "function") {
|
|
2539
2197
|
const fn = variantValue;
|
|
2540
2198
|
const extras = getVariantExtras(styleState);
|
|
@@ -2553,24 +2211,18 @@ function emitResolvedVariant(key, value, styleState, parentVariantKey, condition
|
|
|
2553
2211
|
if (process.env.NODE_ENV === "development" && debug === "verbose") console.info(` expanding styles from `, variantValue);
|
|
2554
2212
|
const { noSkip } = styleProps;
|
|
2555
2213
|
const originals = styleOriginalValues.get(variantValue);
|
|
2556
|
-
const
|
|
2557
|
-
|
|
2558
|
-
|
|
2559
|
-
|
|
2560
|
-
|
|
2561
|
-
|
|
2562
|
-
|
|
2563
|
-
|
|
2564
|
-
|
|
2565
|
-
|
|
2566
|
-
styleState.overriddenContextProps[outputKey] = originalValue;
|
|
2567
|
-
styleState.originalContextPropValues ||= {};
|
|
2568
|
-
styleState.originalContextPropValues[outputKey] = originalValue;
|
|
2569
|
-
}
|
|
2570
|
-
contributeMappedValue(outputKey, outputValue, styleState, parentVariantKey === key && outputKey === key, conditionCursor || void 0, originalValue);
|
|
2214
|
+
for (const outputKey in variantValue) {
|
|
2215
|
+
if (!noSkip && outputKey in skipProps) continue;
|
|
2216
|
+
const rawOutputValue = variantValue[outputKey];
|
|
2217
|
+
const outputValue = styleProps.noNormalize ? rawOutputValue : normalizeValueWithProperty(rawOutputValue, conf.shorthands[outputKey] || outputKey);
|
|
2218
|
+
const originalValue = originals?.[outputKey] ?? rawOutputValue;
|
|
2219
|
+
if (styleState.flatStyleStaticConfig.styledContextKeys?.has(outputKey)) {
|
|
2220
|
+
styleState.overriddenContextProps ||= {};
|
|
2221
|
+
styleState.overriddenContextProps[outputKey] = originalValue;
|
|
2222
|
+
styleState.originalContextPropValues ||= {};
|
|
2223
|
+
styleState.originalContextPropValues[outputKey] = originalValue;
|
|
2571
2224
|
}
|
|
2572
|
-
|
|
2573
|
-
directState.flatCompoundOutputDepth--;
|
|
2225
|
+
contributeMappedValue(outputKey, outputValue, styleState, parentVariantKey === key && outputKey === key, conditionCursor || void 0, originalValue);
|
|
2574
2226
|
}
|
|
2575
2227
|
}
|
|
2576
2228
|
function getFontFamilyFromNameOrVariable(input, conf) {
|
|
@@ -2587,86 +2239,6 @@ function getFontFamilyFromNameOrVariable(input, conf) {
|
|
|
2587
2239
|
} else if (typeof input === "string" && input in conf.fontsParsed) return input;
|
|
2588
2240
|
}
|
|
2589
2241
|
const variableToFontNameCache = /* @__PURE__ */ new WeakMap();
|
|
2590
|
-
function getVariantDefinition(variant, value, conf, { theme }) {
|
|
2591
|
-
if (!variant) return;
|
|
2592
|
-
if (value === void 0) return;
|
|
2593
|
-
if (typeof variant === "function") return variant;
|
|
2594
|
-
if (Object.prototype.hasOwnProperty.call(variant, value)) return variant[value];
|
|
2595
|
-
for (const { key, parts } of getCompiledVariantResolvers(variant)) for (const part of parts) if (matchesVariantResolver(part, value, conf, theme)) return variant[key];
|
|
2596
|
-
}
|
|
2597
|
-
const variantResolverNameSet = new Set(variantResolverNames);
|
|
2598
|
-
const variantResolverCache = /* @__PURE__ */ new WeakMap();
|
|
2599
|
-
const preparedStyleStaticConfigs = /* @__PURE__ */ new WeakSet();
|
|
2600
|
-
function prepareStyleStaticConfig(staticConfig) {
|
|
2601
|
-
if (preparedStyleStaticConfigs.has(staticConfig)) return staticConfig;
|
|
2602
|
-
preparedStyleStaticConfigs.add(staticConfig);
|
|
2603
|
-
getContextPropSet(staticConfig);
|
|
2604
|
-
prepareStaticConfigCompounds(staticConfig);
|
|
2605
|
-
const variants = staticConfig.variants;
|
|
2606
|
-
if (variants) for (const key in variants) {
|
|
2607
|
-
const variant = variants[key];
|
|
2608
|
-
if (variant && typeof variant === "object") getCompiledVariantResolvers(variant);
|
|
2609
|
-
}
|
|
2610
|
-
return staticConfig;
|
|
2611
|
-
}
|
|
2612
|
-
function getCompiledVariantResolvers(variant) {
|
|
2613
|
-
let cached = variantResolverCache.get(variant);
|
|
2614
|
-
if (cached) return cached;
|
|
2615
|
-
const compiled = [];
|
|
2616
|
-
for (const key in variant) {
|
|
2617
|
-
const parts = parseVariantResolverKey(key);
|
|
2618
|
-
if (parts) compiled.push({
|
|
2619
|
-
key,
|
|
2620
|
-
parts
|
|
2621
|
-
});
|
|
2622
|
-
}
|
|
2623
|
-
variantResolverCache.set(variant, compiled);
|
|
2624
|
-
return compiled;
|
|
2625
|
-
}
|
|
2626
|
-
function parseVariantResolverKey(key) {
|
|
2627
|
-
if (!key) return null;
|
|
2628
|
-
const parts = [];
|
|
2629
|
-
let start = 0;
|
|
2630
|
-
for (let index = 0; index <= key.length; index++) {
|
|
2631
|
-
if (index !== key.length && key.charCodeAt(index) !== 124) continue;
|
|
2632
|
-
let partStart = start;
|
|
2633
|
-
let partEnd = index;
|
|
2634
|
-
while (partStart < partEnd && key.charCodeAt(partStart) <= 32) partStart++;
|
|
2635
|
-
while (partEnd > partStart && key.charCodeAt(partEnd - 1) <= 32) partEnd--;
|
|
2636
|
-
if (partStart === partEnd) return null;
|
|
2637
|
-
const part = key.slice(partStart, partEnd);
|
|
2638
|
-
if (!variantResolverNameSet.has(part)) return null;
|
|
2639
|
-
parts.push(part);
|
|
2640
|
-
start = index + 1;
|
|
2641
|
-
}
|
|
2642
|
-
return parts;
|
|
2643
|
-
}
|
|
2644
|
-
function hasNumericPrefix(value, suffixLength) {
|
|
2645
|
-
if (value.length <= suffixLength) return false;
|
|
2646
|
-
return Number.isFinite(Number(value.slice(0, value.length - suffixLength)));
|
|
2647
|
-
}
|
|
2648
|
-
function matchesVariantResolver(resolverName, value, conf, theme) {
|
|
2649
|
-
const string = typeof value === "string";
|
|
2650
|
-
const number = typeof value === "number";
|
|
2651
|
-
const rem = string && value.endsWith("rem") && hasNumericPrefix(value, 3);
|
|
2652
|
-
switch (resolverName) {
|
|
2653
|
-
case "Size":
|
|
2654
|
-
case "Space":
|
|
2655
|
-
case "Radius":
|
|
2656
|
-
case "ZIndex": return value === true || number || string || resolverName !== "Size" && isVariable(value);
|
|
2657
|
-
case "Color": return value != null && value in conf.tokensParsed.color || string;
|
|
2658
|
-
case "Theme": return string && !!theme && value in theme;
|
|
2659
|
-
case "FontSize": return value === true || !!conf.fontsParsed.body?.size?.[value] || number || rem;
|
|
2660
|
-
case "FontStyle": return !!conf.fontsParsed.body?.style?.[value] || value === "normal" || value === "italic";
|
|
2661
|
-
case "FontTransform": return !!conf.fontsParsed.body?.transform?.[value] || value === "none" || value === "capitalize" || value === "uppercase" || value === "lowercase";
|
|
2662
|
-
case "FontLineHeight": return !!conf.fontsParsed.body?.lineHeight?.[value] || number || rem;
|
|
2663
|
-
case "FontLetterSpacing": return !!conf.fontsParsed.body?.letterSpacing?.[value] || number || rem;
|
|
2664
|
-
case "number":
|
|
2665
|
-
case "string":
|
|
2666
|
-
case "boolean": return typeof value === resolverName;
|
|
2667
|
-
case "any": return true;
|
|
2668
|
-
}
|
|
2669
|
-
}
|
|
2670
2242
|
|
|
2671
|
-
export { STYLE_TOKEN_PROVENANCE_KEY, clearDirectStyle, contributeStyleString, directStyleSignature, flushDirectStyles2 as flushDirectStyles,
|
|
2243
|
+
export { STYLE_TOKEN_PROVENANCE_KEY, clearDirectStyle, contributeStyleString, directStyleSignature, flushDirectStyles2 as flushDirectStyles, getDirectDynamicThemeAccess, getFontFamilyFromNameOrVariable, getSplitStyles, getStyleStaticConfig, getStyleTokenProvenance, isValidStyleKey, styleOriginalValues };
|
|
2672
2244
|
//# sourceMappingURL=getSplitStyles.mjs.map
|