@tamagui/core 1.0.1-beta.150 → 1.0.1-beta.153
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/Tamagui.js +4 -1
- package/dist/cjs/Tamagui.js.map +1 -1
- package/dist/cjs/addTheme.js.map +1 -1
- package/dist/cjs/constants/platform.js.map +1 -1
- package/dist/cjs/constants/platform.native.js.map +1 -1
- package/dist/cjs/contexts/ButtonInsideButtonContext.js.map +1 -1
- package/dist/cjs/contexts/FontLanguageContext.js.map +1 -1
- package/dist/cjs/contexts/TextAncestorContext.js +6 -7
- package/dist/cjs/contexts/TextAncestorContext.js.map +2 -2
- package/dist/cjs/contexts/ThemeContext.js.map +1 -1
- package/dist/cjs/createComponent.js +194 -87
- package/dist/cjs/createComponent.js.map +3 -3
- package/dist/cjs/createFont.js +2 -1
- package/dist/cjs/createFont.js.map +2 -2
- package/dist/cjs/createShorthands.js.map +1 -1
- package/dist/cjs/createTamagui.js +5 -3
- package/dist/cjs/createTamagui.js.map +2 -2
- package/dist/cjs/createTokens.js.map +1 -1
- package/dist/cjs/createVariable.js +3 -1
- package/dist/cjs/createVariable.js.map +2 -2
- package/dist/cjs/createVariables.js.map +1 -1
- package/dist/cjs/helpers/ThemeManager.js.map +2 -2
- package/dist/cjs/helpers/assignNativePropsToWeb.js.map +1 -1
- package/dist/cjs/helpers/assignNativePropsToWeb.native.js.map +1 -1
- package/dist/cjs/helpers/calc.js.map +2 -2
- package/dist/cjs/helpers/createMediaStyle.js +10 -4
- package/dist/cjs/helpers/createMediaStyle.js.map +2 -2
- package/dist/cjs/helpers/createPropMapper.js +89 -9
- package/dist/cjs/helpers/createPropMapper.js.map +1 -1
- package/dist/cjs/helpers/createShallowUpdate.js +12 -9
- package/dist/cjs/helpers/createShallowUpdate.js.map +1 -1
- package/dist/cjs/helpers/cssHash.js.map +1 -1
- package/dist/cjs/helpers/expandStyle.js.map +2 -2
- package/dist/cjs/helpers/expandStyles.js.map +1 -1
- package/dist/cjs/helpers/extendStaticConfig.js +10 -7
- package/dist/cjs/helpers/extendStaticConfig.js.map +1 -1
- package/dist/cjs/helpers/getAnimationDriver.js.map +1 -1
- package/dist/cjs/helpers/getExpandedShorthands.js.map +1 -1
- package/dist/cjs/helpers/getFont.js.map +1 -1
- package/dist/cjs/helpers/getSize.js.map +1 -1
- package/dist/cjs/helpers/getSplitStyles.js +43 -4
- package/dist/cjs/helpers/getSplitStyles.js.map +3 -3
- package/dist/cjs/helpers/getStackSize.js.map +1 -1
- package/dist/cjs/helpers/getStylesAtomic.js +8 -2
- package/dist/cjs/helpers/getStylesAtomic.js.map +2 -2
- package/dist/cjs/helpers/getStylesAtomic.native.js.map +1 -1
- package/dist/cjs/helpers/getThemeCSSRules.js +7 -3
- package/dist/cjs/helpers/getThemeCSSRules.js.map +1 -1
- package/dist/cjs/helpers/getThemeCSSRules.native.js.map +1 -1
- package/dist/cjs/helpers/getVariantExtras.js +9 -7
- package/dist/cjs/helpers/getVariantExtras.js.map +1 -1
- package/dist/cjs/helpers/insertStyleRule.js.map +2 -2
- package/dist/cjs/helpers/isTamaguiComponent.js.map +1 -1
- package/dist/cjs/helpers/isTamaguiElement.js.map +1 -1
- package/dist/cjs/helpers/matchMedia.js.map +1 -1
- package/dist/cjs/helpers/matchMedia.native.js +4 -1
- package/dist/cjs/helpers/matchMedia.native.js.map +2 -2
- package/dist/cjs/helpers/mergeProps.js.map +1 -1
- package/dist/cjs/helpers/mergeTransform.js.map +1 -1
- package/dist/cjs/helpers/normalizeColor.js +4 -1
- package/dist/cjs/helpers/normalizeColor.js.map +2 -2
- package/dist/cjs/helpers/normalizeValueWithProperty.js.map +1 -1
- package/dist/cjs/helpers/proxyThemeVariables.js.map +1 -1
- package/dist/cjs/helpers/registerCSSVariable.js.map +1 -1
- package/dist/cjs/helpers/startTransition.js +4 -1
- package/dist/cjs/helpers/startTransition.js.map +2 -2
- package/dist/cjs/helpers/themeable.js +12 -5
- package/dist/cjs/helpers/themeable.js.map +2 -2
- package/dist/cjs/helpers/themes.js.map +1 -1
- package/dist/cjs/hooks/useConstant.js.map +1 -1
- package/dist/cjs/hooks/useIsMounted.js.map +1 -1
- package/dist/cjs/hooks/useIsSSR.js.map +1 -1
- package/dist/cjs/hooks/useIsTouchDevice.js.map +1 -1
- package/dist/cjs/hooks/useMedia.js +10 -7
- package/dist/cjs/hooks/useMedia.js.map +2 -2
- package/dist/cjs/hooks/usePressable.js.map +1 -1
- package/dist/cjs/hooks/useSafeRef.js.map +1 -1
- package/dist/cjs/hooks/useServerHooks.js.map +1 -1
- package/dist/cjs/hooks/useTheme.js +6 -1
- package/dist/cjs/hooks/useTheme.js.map +2 -2
- package/dist/cjs/hooks/useUnmountEffect.js.map +1 -1
- package/dist/cjs/injectStyles.js.map +1 -1
- package/dist/cjs/insertFont.js +3 -1
- package/dist/cjs/insertFont.js.map +2 -2
- package/dist/cjs/styled.js +3 -1
- package/dist/cjs/styled.js.map +1 -1
- package/dist/cjs/types.js.map +1 -1
- package/dist/cjs/updateTheme.js +7 -4
- package/dist/cjs/updateTheme.js.map +1 -1
- package/dist/cjs/views/FontLanguage.js +5 -7
- package/dist/cjs/views/FontLanguage.js.map +1 -1
- package/dist/cjs/views/FontLanguage.native.js +6 -7
- package/dist/cjs/views/FontLanguage.native.js.map +1 -1
- package/dist/cjs/views/Slot.js +16 -8
- package/dist/cjs/views/Slot.js.map +1 -1
- package/dist/cjs/views/Stack.js.map +1 -1
- package/dist/cjs/views/TamaguiProvider.js +21 -12
- package/dist/cjs/views/TamaguiProvider.js.map +1 -1
- package/dist/cjs/views/Text.js.map +1 -1
- package/dist/cjs/views/Theme.js +25 -11
- package/dist/cjs/views/Theme.js.map +2 -2
- package/dist/cjs/views/ThemeInverse.js +6 -7
- package/dist/cjs/views/ThemeInverse.js.map +1 -1
- package/dist/cjs/views/ThemeProvider.js +14 -8
- package/dist/cjs/views/ThemeProvider.js.map +2 -2
- package/dist/cjs/views/ThemeReset.js +9 -4
- package/dist/cjs/views/ThemeReset.js.map +2 -2
- package/dist/esm/Tamagui.js.map +1 -1
- package/dist/esm/addTheme.js.map +1 -1
- package/dist/esm/constants/constants.js.map +1 -1
- package/dist/esm/constants/platform.js.map +1 -1
- package/dist/esm/constants/platform.native.js.map +1 -1
- package/dist/esm/contexts/ButtonInsideButtonContext.js.map +1 -1
- package/dist/esm/contexts/FontLanguageContext.js.map +1 -1
- package/dist/esm/contexts/TextAncestorContext.js +6 -4
- package/dist/esm/contexts/TextAncestorContext.js.map +1 -1
- package/dist/esm/contexts/ThemeContext.js.map +1 -1
- package/dist/esm/createComponent.js +190 -86
- package/dist/esm/createComponent.js.map +3 -3
- package/dist/esm/createFont.js +2 -1
- package/dist/esm/createFont.js.map +2 -2
- package/dist/esm/createShorthands.js.map +1 -1
- package/dist/esm/createTamagui.js +5 -3
- package/dist/esm/createTamagui.js.map +2 -2
- package/dist/esm/createTokens.js.map +1 -1
- package/dist/esm/createVariable.js +3 -1
- package/dist/esm/createVariable.js.map +2 -2
- package/dist/esm/createVariables.js.map +1 -1
- package/dist/esm/helpers/RNComponents.js.map +1 -1
- package/dist/esm/helpers/ThemeManager.js.map +2 -2
- package/dist/esm/helpers/assignNativePropsToWeb.js.map +1 -1
- package/dist/esm/helpers/assignNativePropsToWeb.native.js.map +1 -1
- package/dist/esm/helpers/calc.js.map +2 -2
- package/dist/esm/helpers/createMediaStyle.js +10 -4
- package/dist/esm/helpers/createMediaStyle.js.map +2 -2
- package/dist/esm/helpers/createPropMapper.js +89 -9
- package/dist/esm/helpers/createPropMapper.js.map +1 -1
- package/dist/esm/helpers/createShallowUpdate.js +12 -9
- package/dist/esm/helpers/createShallowUpdate.js.map +1 -1
- package/dist/esm/helpers/cssHash.js.map +1 -1
- package/dist/esm/helpers/expandStyle.js.map +2 -2
- package/dist/esm/helpers/expandStyles.js.map +1 -1
- package/dist/esm/helpers/extendStaticConfig.js +10 -7
- package/dist/esm/helpers/extendStaticConfig.js.map +1 -1
- package/dist/esm/helpers/getAnimationDriver.js.map +1 -1
- package/dist/esm/helpers/getExpandedShorthands.js.map +1 -1
- package/dist/esm/helpers/getFont.js.map +1 -1
- package/dist/esm/helpers/getSize.js.map +1 -1
- package/dist/esm/helpers/getSplitStyles.js +43 -4
- package/dist/esm/helpers/getSplitStyles.js.map +3 -3
- package/dist/esm/helpers/getStackSize.js.map +1 -1
- package/dist/esm/helpers/getStylesAtomic.js +4 -1
- package/dist/esm/helpers/getStylesAtomic.js.map +1 -1
- package/dist/esm/helpers/getStylesAtomic.native.js.map +1 -1
- package/dist/esm/helpers/getThemeCSSRules.js +7 -3
- package/dist/esm/helpers/getThemeCSSRules.js.map +1 -1
- package/dist/esm/helpers/getThemeCSSRules.native.js.map +1 -1
- package/dist/esm/helpers/getVariantExtras.js +9 -7
- package/dist/esm/helpers/getVariantExtras.js.map +1 -1
- package/dist/esm/helpers/insertStyleRule.js.map +2 -2
- package/dist/esm/helpers/isTamaguiComponent.js.map +1 -1
- package/dist/esm/helpers/isTamaguiElement.js.map +1 -1
- package/dist/esm/helpers/matchMedia.js.map +1 -1
- package/dist/esm/helpers/matchMedia.native.js.map +1 -1
- package/dist/esm/helpers/mergeProps.js.map +1 -1
- package/dist/esm/helpers/normalizeColor.js.map +1 -1
- package/dist/esm/helpers/normalizeValueWithProperty.js.map +1 -1
- package/dist/esm/helpers/proxyThemeVariables.js.map +1 -1
- package/dist/esm/helpers/registerCSSVariable.js.map +1 -1
- package/dist/esm/helpers/startTransition.js.map +1 -1
- package/dist/esm/helpers/themeable.js +8 -4
- package/dist/esm/helpers/themeable.js.map +1 -1
- package/dist/esm/helpers/themes.js.map +1 -1
- package/dist/esm/hooks/useConstant.js.map +1 -1
- package/dist/esm/hooks/useId.js.map +1 -1
- package/dist/esm/hooks/useIsMounted.js.map +1 -1
- package/dist/esm/hooks/useIsSSR.js.map +1 -1
- package/dist/esm/hooks/useIsTouchDevice.js.map +1 -1
- package/dist/esm/hooks/useMedia.js +10 -7
- package/dist/esm/hooks/useMedia.js.map +2 -2
- package/dist/esm/hooks/usePressable.js.map +1 -1
- package/dist/esm/hooks/useSafeRef.js.map +1 -1
- package/dist/esm/hooks/useServerHooks.js.map +1 -1
- package/dist/esm/hooks/useTheme.js +6 -1
- package/dist/esm/hooks/useTheme.js.map +2 -2
- package/dist/esm/hooks/useUnmountEffect.js.map +1 -1
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/injectStyles.js.map +1 -1
- package/dist/esm/insertFont.js +3 -1
- package/dist/esm/insertFont.js.map +2 -2
- package/dist/esm/static.js.map +1 -1
- package/dist/esm/styled.js +3 -1
- package/dist/esm/styled.js.map +1 -1
- package/dist/esm/updateTheme.js +7 -4
- package/dist/esm/updateTheme.js.map +1 -1
- package/dist/esm/views/FontLanguage.js +5 -4
- package/dist/esm/views/FontLanguage.js.map +1 -1
- package/dist/esm/views/FontLanguage.native.js +6 -4
- package/dist/esm/views/FontLanguage.native.js.map +1 -1
- package/dist/esm/views/Slot.js +12 -7
- package/dist/esm/views/Slot.js.map +1 -1
- package/dist/esm/views/Stack.js.map +1 -1
- package/dist/esm/views/TamaguiProvider.js +17 -11
- package/dist/esm/views/TamaguiProvider.js.map +1 -1
- package/dist/esm/views/Text.js.map +1 -1
- package/dist/esm/views/Theme.js +21 -10
- package/dist/esm/views/Theme.js.map +2 -2
- package/dist/esm/views/ThemeInverse.js +6 -4
- package/dist/esm/views/ThemeInverse.js.map +1 -1
- package/dist/esm/views/ThemeProvider.js +10 -7
- package/dist/esm/views/ThemeProvider.js.map +1 -1
- package/dist/esm/views/ThemeReset.js +5 -3
- package/dist/esm/views/ThemeReset.js.map +1 -1
- package/package.json +10 -10
- package/src/createComponent.tsx +28 -1
- package/src/createFont.ts +4 -1
- package/src/createVariable.ts +2 -1
- package/src/helpers/createMediaStyle.ts +2 -2
- package/src/helpers/getSplitStyles.tsx +3 -0
- package/src/insertFont.ts +2 -1
- package/src/types.tsx +4 -3
- package/types/createVariable.d.ts +1 -1
- package/types/types.d.ts +8 -1
- package/src/helpers/cssHash.ts +0 -28
package/dist/esm/views/Theme.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
1
2
|
import React, { memo, useMemo } from "react";
|
|
2
3
|
import { isWeb } from "../constants/platform";
|
|
3
4
|
import { variableToString } from "../createVariable";
|
|
@@ -6,9 +7,16 @@ import { useChangeThemeEffect } from "../hooks/useTheme";
|
|
|
6
7
|
React["createElement"];
|
|
7
8
|
const Theme = memo(function Theme2(props) {
|
|
8
9
|
var _a;
|
|
9
|
-
const { name, theme, themeManager, themes, className } = useChangeThemeEffect(
|
|
10
|
+
const { name, theme, themeManager, themes, className } = useChangeThemeEffect(
|
|
11
|
+
props.name,
|
|
12
|
+
props.componentName,
|
|
13
|
+
props
|
|
14
|
+
);
|
|
10
15
|
const missingTheme = !themes || !name || !theme;
|
|
11
|
-
const contents = useMemo(
|
|
16
|
+
const contents = useMemo(
|
|
17
|
+
() => missingTheme ? null : wrapThemeManagerContext(props.children, themeManager),
|
|
18
|
+
[missingTheme, props.children, themeManager]
|
|
19
|
+
);
|
|
12
20
|
if (missingTheme) {
|
|
13
21
|
if (name && !theme && process.env.NODE_ENV === "development") {
|
|
14
22
|
console.warn(`No theme found by name ${name}`);
|
|
@@ -16,22 +24,25 @@ const Theme = memo(function Theme2(props) {
|
|
|
16
24
|
return props.children;
|
|
17
25
|
}
|
|
18
26
|
if (isWeb) {
|
|
19
|
-
return /* @__PURE__ */
|
|
27
|
+
return /* @__PURE__ */ jsx("span", {
|
|
20
28
|
className: (!props.disableThemeClass ? [props.className, className].filter(Boolean) : []).join(" "),
|
|
21
29
|
style: {
|
|
22
30
|
display: "contents",
|
|
23
31
|
color: variableToString((_a = themes[name]) == null ? void 0 : _a.color)
|
|
24
|
-
}
|
|
25
|
-
|
|
32
|
+
},
|
|
33
|
+
children: contents
|
|
34
|
+
});
|
|
26
35
|
}
|
|
27
36
|
return contents;
|
|
28
37
|
});
|
|
29
38
|
function wrapThemeManagerContext(children, themeManager, shouldSetChildrenThemeToParent) {
|
|
30
|
-
return themeManager ? /* @__PURE__ */
|
|
31
|
-
value: themeManager
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
39
|
+
return themeManager ? /* @__PURE__ */ jsx(ThemeManagerContext.Provider, {
|
|
40
|
+
value: themeManager,
|
|
41
|
+
children: shouldSetChildrenThemeToParent ? /* @__PURE__ */ jsx(Theme, {
|
|
42
|
+
name: themeManager.parentName,
|
|
43
|
+
children
|
|
44
|
+
}) : children
|
|
45
|
+
}) : children;
|
|
35
46
|
}
|
|
36
47
|
export {
|
|
37
48
|
Theme,
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/views/Theme.tsx"],
|
|
4
4
|
"sourcesContent": ["import React, { memo, useMemo } from 'react'\n\nimport { isWeb } from '../constants/platform'\nimport { variableToString } from '../createVariable'\nimport { ThemeManager, ThemeManagerContext } from '../helpers/ThemeManager'\nimport { ThemeProps, useChangeThemeEffect } from '../hooks/useTheme'\n\n// bugfix esbuild strips react jsx: 'preserve'\nReact['createElement']\n\nexport const Theme = memo(function Theme(props: ThemeProps) {\n const { name, theme, themeManager, themes, className } = useChangeThemeEffect(\n props.name,\n props.componentName,\n props\n )\n\n const missingTheme = !themes || !name || !theme\n\n // memo here, changing theme without re-rendering all children is a critical optimization\n // may require some effort of end user to memoize but without this memo they'd have no option\n const contents = useMemo(\n () => (missingTheme ? null : wrapThemeManagerContext(props.children, themeManager)),\n [missingTheme, props.children, themeManager]\n )\n\n if (missingTheme) {\n if (name && !theme && process.env.NODE_ENV === 'development') {\n // eslint-disable-next-line no-console\n console.warn(`No theme found by name ${name}`)\n }\n return props.children\n }\n\n if (isWeb) {\n return (\n <span\n className={(!props.disableThemeClass\n ? [props.className, className].filter(Boolean)\n : []\n ).join(' ')}\n style={{\n display: 'contents',\n // in order to provide currentColor, set color by default\n color: variableToString(themes[name]?.color),\n }}\n >\n {contents}\n </span>\n )\n }\n\n return contents\n})\n\nexport function wrapThemeManagerContext(\n children: any,\n themeManager?: ThemeManager | null,\n shouldSetChildrenThemeToParent?: boolean\n) {\n return themeManager ? (\n <ThemeManagerContext.Provider value={themeManager}>\n {shouldSetChildrenThemeToParent ? (\n <Theme name={themeManager.parentName}>{children}</Theme>\n ) : (\n children\n )}\n </ThemeManagerContext.Provider>\n ) : (\n children\n )\n}\n"],
|
|
5
|
-
"mappings": "
|
|
6
|
-
"names": []
|
|
5
|
+
"mappings": "AAoCM;AApCN,OAAO,SAAS,MAAM,eAAe;AAErC,SAAS,aAAa;AACtB,SAAS,wBAAwB;AACjC,SAAuB,2BAA2B;AAClD,SAAqB,4BAA4B;AAGjD,MAAM;AAEC,MAAM,QAAQ,KAAK,SAASA,OAAM,OAAmB;AAV5D;AAWE,QAAM,EAAE,MAAM,OAAO,cAAc,QAAQ,UAAU,IAAI;AAAA,IACvD,MAAM;AAAA,IACN,MAAM;AAAA,IACN;AAAA,EACF;AAEA,QAAM,eAAe,CAAC,UAAU,CAAC,QAAQ,CAAC;AAI1C,QAAM,WAAW;AAAA,IACf,MAAO,eAAe,OAAO,wBAAwB,MAAM,UAAU,YAAY;AAAA,IACjF,CAAC,cAAc,MAAM,UAAU,YAAY;AAAA,EAC7C;AAEA,MAAI,cAAc;AAChB,QAAI,QAAQ,CAAC,SAAS,QAAQ,IAAI,aAAa,eAAe;AAE5D,cAAQ,KAAK,0BAA0B,MAAM;AAAA,IAC/C;AACA,WAAO,MAAM;AAAA,EACf;AAEA,MAAI,OAAO;AACT,WACE,oBAAC;AAAA,MACC,YAAY,CAAC,MAAM,oBACf,CAAC,MAAM,WAAW,SAAS,EAAE,OAAO,OAAO,IAC3C,CAAC,GACH,KAAK,GAAG;AAAA,MACV,OAAO;AAAA,QACL,SAAS;AAAA,QAET,OAAO,kBAAiB,YAAO,UAAP,mBAAc,KAAK;AAAA,MAC7C;AAAA,MAEC;AAAA,KACH;AAAA,EAEJ;AAEA,SAAO;AACT,CAAC;AAEM,SAAS,wBACd,UACA,cACA,gCACA;AACA,SAAO,eACL,oBAAC,oBAAoB,UAApB;AAAA,IAA6B,OAAO;AAAA,IAClC,2CACC,oBAAC;AAAA,MAAM,MAAM,aAAa;AAAA,MAAa;AAAA,KAAS,IAEhD;AAAA,GAEJ,IAEA;AAEJ;",
|
|
6
|
+
"names": ["Theme"]
|
|
7
7
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useState } from "react";
|
|
2
3
|
import { useIsomorphicLayoutEffect } from "../constants/platform";
|
|
3
4
|
import { useDefaultThemeName, useThemeName } from "../hooks/useTheme";
|
|
4
5
|
import { Theme } from "./Theme";
|
|
@@ -20,9 +21,10 @@ const ThemeInverse = ({
|
|
|
20
21
|
if (disable) {
|
|
21
22
|
return children;
|
|
22
23
|
}
|
|
23
|
-
return /* @__PURE__ */
|
|
24
|
-
name
|
|
25
|
-
|
|
24
|
+
return /* @__PURE__ */ jsx(Theme, {
|
|
25
|
+
name,
|
|
26
|
+
children
|
|
27
|
+
});
|
|
26
28
|
};
|
|
27
29
|
export {
|
|
28
30
|
ThemeInverse
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/views/ThemeInverse.tsx"],
|
|
4
4
|
"sourcesContent": ["import React, { useState } from 'react'\n\nimport { useIsomorphicLayoutEffect } from '../constants/platform'\nimport { useDefaultThemeName, useThemeName } from '../hooks/useTheme'\nimport { Theme } from './Theme'\n\nexport const ThemeInverse = ({\n children,\n disable,\n}: {\n children: React.ReactNode\n disable?: boolean\n}) => {\n const themeName = useThemeName()\n const defaultTheme = useDefaultThemeName()\n const [name, setName] = useState<null | string>(null)\n\n // ssr\n useIsomorphicLayoutEffect(() => {\n if (themeName.startsWith('dark')) {\n setName('light')\n }\n if (themeName.startsWith('light')) {\n setName('dark')\n }\n }, [defaultTheme, themeName])\n\n if (disable) {\n return children as JSX.Element\n }\n\n return <Theme name={name}>{children}</Theme>\n}\n"],
|
|
5
|
-
"mappings": "
|
|
5
|
+
"mappings": "AA+BS;AA/BT,SAAgB,gBAAgB;AAEhC,SAAS,iCAAiC;AAC1C,SAAS,qBAAqB,oBAAoB;AAClD,SAAS,aAAa;AAEf,MAAM,eAAe,CAAC;AAAA,EAC3B;AAAA,EACA;AACF,MAGM;AACJ,QAAM,YAAY,aAAa;AAC/B,QAAM,eAAe,oBAAoB;AACzC,QAAM,CAAC,MAAM,OAAO,IAAI,SAAwB,IAAI;AAGpD,4BAA0B,MAAM;AAC9B,QAAI,UAAU,WAAW,MAAM,GAAG;AAChC,cAAQ,OAAO;AAAA,IACjB;AACA,QAAI,UAAU,WAAW,OAAO,GAAG;AACjC,cAAQ,MAAM;AAAA,IAChB;AAAA,EACF,GAAG,CAAC,cAAc,SAAS,CAAC;AAE5B,MAAI,SAAS;AACX,WAAO;AAAA,EACT;AAEA,SAAO,oBAAC;AAAA,IAAM;AAAA,IAAa;AAAA,GAAS;AACtC;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
1
2
|
import React, { useLayoutEffect, useMemo } from "react";
|
|
2
3
|
import { getConfig, getHasConfigured } from "../config";
|
|
3
4
|
import { THEME_CLASSNAME_PREFIX } from "../constants/constants";
|
|
@@ -31,13 +32,15 @@ const ThemeProvider = (props) => {
|
|
|
31
32
|
defaultTheme: props.defaultTheme
|
|
32
33
|
};
|
|
33
34
|
}, [props.defaultTheme]);
|
|
34
|
-
return /* @__PURE__ */
|
|
35
|
-
value: themeContext
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
35
|
+
return /* @__PURE__ */ jsx(ThemeContext.Provider, {
|
|
36
|
+
value: themeContext,
|
|
37
|
+
children: /* @__PURE__ */ jsx(Theme, {
|
|
38
|
+
className: props.className,
|
|
39
|
+
name: props.defaultTheme,
|
|
40
|
+
disableThemeClass: props.disableRootThemeClass,
|
|
41
|
+
children: props.children
|
|
42
|
+
})
|
|
43
|
+
});
|
|
41
44
|
};
|
|
42
45
|
export {
|
|
43
46
|
ThemeProvider
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/views/ThemeProvider.tsx"],
|
|
4
4
|
"sourcesContent": ["import React, { useLayoutEffect, useMemo } from 'react'\n\nimport { getConfig, getHasConfigured } from '../config'\nimport { THEME_CLASSNAME_PREFIX } from '../constants/constants'\nimport { ThemeContext } from '../contexts/ThemeContext'\nimport { Theme } from './Theme'\n\n// bugfix esbuild strips react jsx: 'preserve'\nReact['createElement']\n\nexport type ThemeProviderProps = {\n className?: string\n defaultTheme: string\n disableRootThemeClass?: boolean\n themeClassNameOnRoot?: boolean\n children?: any\n reset?: boolean\n}\n\nexport const ThemeProvider = (props: ThemeProviderProps) => {\n if (process.env.NODE_ENV === 'development') {\n if (!getHasConfigured()) {\n throw new Error(`Missing configureThemes() call, add to your root file`)\n }\n }\n\n // ensure theme is attached to root body node as well to work with modals by default\n if (typeof document !== 'undefined') {\n useLayoutEffect(() => {\n if (props.disableRootThemeClass) {\n return\n }\n const cn = `${THEME_CLASSNAME_PREFIX}${props.defaultTheme}`\n const target = props.themeClassNameOnRoot ? document.documentElement : document.body\n target.classList.add(cn)\n return () => {\n target.classList.remove(cn)\n }\n }, [props.defaultTheme, props.disableRootThemeClass, props.themeClassNameOnRoot])\n }\n\n const themeContext = useMemo(() => {\n return {\n get themes() {\n return getConfig().themes\n },\n defaultTheme: props.defaultTheme,\n }\n }, [props.defaultTheme])\n\n return (\n <ThemeContext.Provider value={themeContext}>\n <Theme\n className={props.className}\n name={props.defaultTheme}\n disableThemeClass={props.disableRootThemeClass}\n >\n {props.children}\n </Theme>\n </ThemeContext.Provider>\n )\n}\n"],
|
|
5
|
-
"mappings": "
|
|
5
|
+
"mappings": "AAoDM;AApDN,OAAO,SAAS,iBAAiB,eAAe;AAEhD,SAAS,WAAW,wBAAwB;AAC5C,SAAS,8BAA8B;AACvC,SAAS,oBAAoB;AAC7B,SAAS,aAAa;AAGtB,MAAM;AAWC,MAAM,gBAAgB,CAAC,UAA8B;AAC1D,MAAI,QAAQ,IAAI,aAAa,eAAe;AAC1C,QAAI,CAAC,iBAAiB,GAAG;AACvB,YAAM,IAAI,MAAM,uDAAuD;AAAA,IACzE;AAAA,EACF;AAGA,MAAI,OAAO,aAAa,aAAa;AACnC,oBAAgB,MAAM;AACpB,UAAI,MAAM,uBAAuB;AAC/B;AAAA,MACF;AACA,YAAM,KAAK,GAAG,yBAAyB,MAAM;AAC7C,YAAM,SAAS,MAAM,uBAAuB,SAAS,kBAAkB,SAAS;AAChF,aAAO,UAAU,IAAI,EAAE;AACvB,aAAO,MAAM;AACX,eAAO,UAAU,OAAO,EAAE;AAAA,MAC5B;AAAA,IACF,GAAG,CAAC,MAAM,cAAc,MAAM,uBAAuB,MAAM,oBAAoB,CAAC;AAAA,EAClF;AAEA,QAAM,eAAe,QAAQ,MAAM;AACjC,WAAO;AAAA,MACL,IAAI,SAAS;AACX,eAAO,UAAU,EAAE;AAAA,MACrB;AAAA,MACA,cAAc,MAAM;AAAA,IACtB;AAAA,EACF,GAAG,CAAC,MAAM,YAAY,CAAC;AAEvB,SACE,oBAAC,aAAa,UAAb;AAAA,IAAsB,OAAO;AAAA,IAC5B,8BAAC;AAAA,MACC,WAAW,MAAM;AAAA,MACjB,MAAM,MAAM;AAAA,MACZ,mBAAmB,MAAM;AAAA,MAExB,gBAAM;AAAA,KACT;AAAA,GACF;AAEJ;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
1
2
|
import React, { useContext, useLayoutEffect, useState } from "react";
|
|
2
3
|
import { isWeb } from "../constants/platform";
|
|
3
4
|
import { ThemeManagerContext } from "../helpers/ThemeManager";
|
|
@@ -25,11 +26,12 @@ const ThemeReset = (props) => {
|
|
|
25
26
|
if (!themeManager || !props.children) {
|
|
26
27
|
return props.children || null;
|
|
27
28
|
}
|
|
28
|
-
return /* @__PURE__ */
|
|
29
|
+
return /* @__PURE__ */ jsx(Theme, {
|
|
29
30
|
className: "tui-theme-reset",
|
|
30
31
|
reset: true,
|
|
31
|
-
name
|
|
32
|
-
|
|
32
|
+
name,
|
|
33
|
+
children: props.children
|
|
34
|
+
});
|
|
33
35
|
};
|
|
34
36
|
export {
|
|
35
37
|
ThemeReset
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/views/ThemeReset.tsx"],
|
|
4
4
|
"sourcesContent": ["import React, { useContext, useLayoutEffect, useState } from 'react'\n\nimport { isWeb } from '../constants/platform'\nimport { ThemeManagerContext } from '../helpers/ThemeManager'\nimport { Theme } from './Theme'\n\n// bugfix esbuild strips react jsx: 'preserve'\nReact['createElement']\n\n// resets the theme to the parent theme\nexport const ThemeReset = (props: { children?: any }) => {\n const themeManager = useContext(ThemeManagerContext)\n const [name, setName] = useState<string | null>(null)\n\n // this component doesn't work with SSR, so must run only client side\n // we could at least prevent more flickering by having the ssr head script\n // that changes to dark initially also go through and change all of these\n if (!isWeb || typeof document !== 'undefined') {\n useLayoutEffect(() => {\n if (!themeManager) return\n if (name !== themeManager.parentName) {\n setName(themeManager.parentName)\n }\n }, [themeManager?.parentName])\n\n useLayoutEffect(() => {\n if (!themeManager) return\n return themeManager.onChangeTheme(() => {\n setName(themeManager.parentName)\n })\n }, [])\n }\n\n if (!themeManager || !props.children) {\n return props.children || null\n }\n\n return (\n <Theme className=\"tui-theme-reset\" reset name={name}>\n {props.children}\n </Theme>\n )\n}\n"],
|
|
5
|
-
"mappings": "
|
|
5
|
+
"mappings": "AAsCI;AAtCJ,OAAO,SAAS,YAAY,iBAAiB,gBAAgB;AAE7D,SAAS,aAAa;AACtB,SAAS,2BAA2B;AACpC,SAAS,aAAa;AAGtB,MAAM;AAGC,MAAM,aAAa,CAAC,UAA8B;AACvD,QAAM,eAAe,WAAW,mBAAmB;AACnD,QAAM,CAAC,MAAM,OAAO,IAAI,SAAwB,IAAI;AAKpD,MAAI,CAAC,SAAS,OAAO,aAAa,aAAa;AAC7C,oBAAgB,MAAM;AACpB,UAAI,CAAC;AAAc;AACnB,UAAI,SAAS,aAAa,YAAY;AACpC,gBAAQ,aAAa,UAAU;AAAA,MACjC;AAAA,IACF,GAAG,CAAC,6CAAc,UAAU,CAAC;AAE7B,oBAAgB,MAAM;AACpB,UAAI,CAAC;AAAc;AACnB,aAAO,aAAa,cAAc,MAAM;AACtC,gBAAQ,aAAa,UAAU;AAAA,MACjC,CAAC;AAAA,IACH,GAAG,CAAC,CAAC;AAAA,EACP;AAEA,MAAI,CAAC,gBAAgB,CAAC,MAAM,UAAU;AACpC,WAAO,MAAM,YAAY;AAAA,EAC3B;AAEA,SACE,oBAAC;AAAA,IAAM,WAAU;AAAA,IAAkB,OAAK;AAAA,IAAC;AAAA,IACtC,gBAAM;AAAA,GACT;AAEJ;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tamagui/core",
|
|
3
|
-
"version": "1.0.1-beta.
|
|
3
|
+
"version": "1.0.1-beta.153",
|
|
4
4
|
"source": "src/index.ts",
|
|
5
5
|
"main": "dist/cjs",
|
|
6
6
|
"module": "dist/esm",
|
|
@@ -27,14 +27,14 @@
|
|
|
27
27
|
],
|
|
28
28
|
"dependencies": {
|
|
29
29
|
"@expo/match-media": "^0.3.0",
|
|
30
|
-
"@tamagui/compose-refs": "^1.0.1-beta.
|
|
31
|
-
"@tamagui/helpers": "^1.0.1-beta.
|
|
32
|
-
"@tamagui/normalize-css-color-lite": "^1.0.1-beta.
|
|
33
|
-
"@tamagui/rnw": "^1.0.1-beta.
|
|
34
|
-
"@tamagui/rnw-lite": "^1.0.1-beta.
|
|
35
|
-
"@tamagui/use-debounce": "^1.0.1-beta.
|
|
36
|
-
"@tamagui/use-event": "^1.0.1-beta.
|
|
37
|
-
"@tamagui/use-force-update": "^1.0.1-beta.
|
|
30
|
+
"@tamagui/compose-refs": "^1.0.1-beta.153",
|
|
31
|
+
"@tamagui/helpers": "^1.0.1-beta.153",
|
|
32
|
+
"@tamagui/normalize-css-color-lite": "^1.0.1-beta.153",
|
|
33
|
+
"@tamagui/rnw": "^1.0.1-beta.153",
|
|
34
|
+
"@tamagui/rnw-lite": "^1.0.1-beta.153",
|
|
35
|
+
"@tamagui/use-debounce": "^1.0.1-beta.153",
|
|
36
|
+
"@tamagui/use-event": "^1.0.1-beta.153",
|
|
37
|
+
"@tamagui/use-force-update": "^1.0.1-beta.153",
|
|
38
38
|
"expo-screen-orientation": "^4.3.0",
|
|
39
39
|
"hyphenate-style-name": "^1.0.4"
|
|
40
40
|
},
|
|
@@ -43,7 +43,7 @@
|
|
|
43
43
|
"react-dom": "*"
|
|
44
44
|
},
|
|
45
45
|
"devDependencies": {
|
|
46
|
-
"@tamagui/build": "^1.0.1-beta.
|
|
46
|
+
"@tamagui/build": "^1.0.1-beta.153",
|
|
47
47
|
"@types/react": "^18.0.15",
|
|
48
48
|
"csstype": "^3.0.10",
|
|
49
49
|
"esbuild": "^0.14.49",
|
package/src/createComponent.tsx
CHANGED
|
@@ -707,7 +707,34 @@ export function createComponent<
|
|
|
707
707
|
}
|
|
708
708
|
|
|
709
709
|
viewProps.style = style
|
|
710
|
-
}
|
|
710
|
+
}
|
|
711
|
+
|
|
712
|
+
if (process.env.TAMAGUI_TARGET === 'native') {
|
|
713
|
+
// swap out the right family based on weight/style
|
|
714
|
+
if (splitStyles.fontFamily) {
|
|
715
|
+
const faceInfo = config.fontsParsed[splitStyles.fontFamily]?.face
|
|
716
|
+
if (faceInfo) {
|
|
717
|
+
const [weight, style] = (() => {
|
|
718
|
+
let weight: string | undefined
|
|
719
|
+
let style: string | undefined
|
|
720
|
+
for (let i = styles.length; i >= 0; i--) {
|
|
721
|
+
weight ??= styles[i]?.fontWeight
|
|
722
|
+
style ??= styles[i]?.fontStyle
|
|
723
|
+
}
|
|
724
|
+
return [weight || '400', style || 'normal'] as const
|
|
725
|
+
})()
|
|
726
|
+
const overrideFace = faceInfo[weight]?.[style]?.val
|
|
727
|
+
if (overrideFace) {
|
|
728
|
+
for (const style of styles) {
|
|
729
|
+
if (style?.fontFamily) {
|
|
730
|
+
style.fontFamily = overrideFace
|
|
731
|
+
}
|
|
732
|
+
}
|
|
733
|
+
}
|
|
734
|
+
}
|
|
735
|
+
}
|
|
736
|
+
|
|
737
|
+
// assign styles
|
|
711
738
|
viewProps.style = styles
|
|
712
739
|
}
|
|
713
740
|
|
package/src/createFont.ts
CHANGED
|
@@ -4,8 +4,11 @@ export const createFont = <A extends GenericFont>(font: A): A => {
|
|
|
4
4
|
// fills in any missing values based on size keys being standard
|
|
5
5
|
const sizeKeys = Object.keys(font.size)
|
|
6
6
|
|
|
7
|
+
// fill in intermediate values
|
|
7
8
|
for (const key in font) {
|
|
8
|
-
if (key === 'size' || key === 'family')
|
|
9
|
+
if (key === 'size' || key === 'family' || key === 'face') {
|
|
10
|
+
continue
|
|
11
|
+
}
|
|
9
12
|
const section = font[key] as Object
|
|
10
13
|
const keys = Object.keys(section)
|
|
11
14
|
|
package/src/createVariable.ts
CHANGED
|
@@ -36,9 +36,10 @@ export const createVariable = <A extends string | number = any>(props: VariableI
|
|
|
36
36
|
}
|
|
37
37
|
|
|
38
38
|
// on the client maybe we can change the prototype of variable object toString to keep backwards compat
|
|
39
|
-
export function variableToString(vrble?: any) {
|
|
39
|
+
export function variableToString(vrble?: any, getValue = false) {
|
|
40
40
|
if (!vrble) return ''
|
|
41
41
|
if (isVariable(vrble)) {
|
|
42
|
+
if (getValue) return `${vrble.val}`
|
|
42
43
|
return `${isWeb ? vrble.variable : vrble.val}`
|
|
43
44
|
}
|
|
44
45
|
return `${vrble}`
|
|
@@ -27,9 +27,9 @@ export const createMediaStyle = (
|
|
|
27
27
|
ogPrefix,
|
|
28
28
|
`${ogPrefix}${MEDIA_SEP}${mediaKey}${negKey}${MEDIA_SEP}`
|
|
29
29
|
)}`
|
|
30
|
-
const screenStr = negate ? 'not all' : '
|
|
30
|
+
const screenStr = negate ? 'not all and' : ''
|
|
31
31
|
const mediaSelector = mediaObjectToString(mediaQueries[mediaKey])
|
|
32
|
-
const mediaQuery = `${screenStr}
|
|
32
|
+
const mediaQuery = `${screenStr} ${mediaSelector}`
|
|
33
33
|
const styleInner = rules.map((rule) => rule.replace(identifier, nextIdentifier)).join(';')
|
|
34
34
|
// combines media queries if they already exist
|
|
35
35
|
let styleRule = ''
|
package/src/insertFont.ts
CHANGED
|
@@ -27,7 +27,7 @@ export function parseFont<A extends GenericFont>(definition: A): DeepVariableObj
|
|
|
27
27
|
const parsed: any = {}
|
|
28
28
|
for (const attrKey in definition) {
|
|
29
29
|
const attr = definition[attrKey]
|
|
30
|
-
if (attrKey === 'family') {
|
|
30
|
+
if (attrKey === 'family' || attrKey === 'face') {
|
|
31
31
|
parsed[attrKey] = attr
|
|
32
32
|
continue
|
|
33
33
|
}
|
|
@@ -48,6 +48,7 @@ export function registerFontVariables(parsedFont: any) {
|
|
|
48
48
|
const response: string[] = []
|
|
49
49
|
|
|
50
50
|
for (const fkey in parsedFont) {
|
|
51
|
+
if (fkey === 'face') continue
|
|
51
52
|
if (fkey === 'family') {
|
|
52
53
|
const val = parsedFont[fkey] as Variable
|
|
53
54
|
registerCSSVariable(val)
|
package/src/types.tsx
CHANGED
|
@@ -336,6 +336,8 @@ export type GenericFont<Key extends number | string = number | string> = {
|
|
|
336
336
|
style?: Partial<{ [key in Key]: TextStyle['fontStyle'] | Variable }>
|
|
337
337
|
transform?: Partial<{ [key in Key]: TextStyle['textTransform'] | Variable }>
|
|
338
338
|
color?: Partial<{ [key in Key]: string | Variable }>
|
|
339
|
+
// for native use only, lets you map to alternative fonts
|
|
340
|
+
face?: { [key in FontWeightSteps]: { normal?: string; italic?: string } }
|
|
339
341
|
}
|
|
340
342
|
|
|
341
343
|
// media
|
|
@@ -429,9 +431,8 @@ export type RadiusTokens = GetTokenString<keyof Tokens['radius']> | number
|
|
|
429
431
|
export type FontTokens = GetTokenString<keyof TamaguiConfig['fonts']>
|
|
430
432
|
export type FontSizeTokens = GetTokenString<GetTokenFontKeysFor<'size'>> | number
|
|
431
433
|
export type FontLineHeightTokens = `$${GetTokenFontKeysFor<'lineHeight'>}` | number
|
|
432
|
-
export type
|
|
433
|
-
|
|
434
|
-
| `${1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9}00`
|
|
434
|
+
export type FontWeightSteps = `${1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9}00`
|
|
435
|
+
export type FontWeightTokens = `$${GetTokenFontKeysFor<'weight'>}` | FontWeightSteps
|
|
435
436
|
export type FontColorTokens = `$${GetTokenFontKeysFor<'color'>}` | number
|
|
436
437
|
export type FontLetterSpacingTokens = `$${GetTokenFontKeysFor<'letterSpacing'>}` | number
|
|
437
438
|
export type FontStyleTokens = `$${GetTokenFontKeysFor<'style'>}` | TextStyle['fontStyle']
|
|
@@ -18,7 +18,7 @@ export declare const createVariable: <A extends string | number = any>(props: Va
|
|
|
18
18
|
isFloating?: boolean | undefined;
|
|
19
19
|
__isVar__: boolean;
|
|
20
20
|
};
|
|
21
|
-
export declare function variableToString(vrble?: any): string;
|
|
21
|
+
export declare function variableToString(vrble?: any, getValue?: boolean): string;
|
|
22
22
|
export declare function isVariable(v: Variable | any): v is Variable;
|
|
23
23
|
export declare function getVariableValue(v: Variable | any): any;
|
|
24
24
|
export declare function getVariableName(v: Variable | any): any;
|
package/types/types.d.ts
CHANGED
|
@@ -205,6 +205,12 @@ export declare type GenericFont<Key extends number | string = number | string> =
|
|
|
205
205
|
color?: Partial<{
|
|
206
206
|
[key in Key]: string | Variable;
|
|
207
207
|
}>;
|
|
208
|
+
face?: {
|
|
209
|
+
[key in FontWeightSteps]: {
|
|
210
|
+
normal?: string;
|
|
211
|
+
italic?: string;
|
|
212
|
+
};
|
|
213
|
+
};
|
|
208
214
|
};
|
|
209
215
|
export declare type MediaQueryObject = {
|
|
210
216
|
[key: string]: string | number | string;
|
|
@@ -264,7 +270,8 @@ export declare type RadiusTokens = GetTokenString<keyof Tokens['radius']> | numb
|
|
|
264
270
|
export declare type FontTokens = GetTokenString<keyof TamaguiConfig['fonts']>;
|
|
265
271
|
export declare type FontSizeTokens = GetTokenString<GetTokenFontKeysFor<'size'>> | number;
|
|
266
272
|
export declare type FontLineHeightTokens = `$${GetTokenFontKeysFor<'lineHeight'>}` | number;
|
|
267
|
-
export declare type
|
|
273
|
+
export declare type FontWeightSteps = `${1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9}00`;
|
|
274
|
+
export declare type FontWeightTokens = `$${GetTokenFontKeysFor<'weight'>}` | FontWeightSteps;
|
|
268
275
|
export declare type FontColorTokens = `$${GetTokenFontKeysFor<'color'>}` | number;
|
|
269
276
|
export declare type FontLetterSpacingTokens = `$${GetTokenFontKeysFor<'letterSpacing'>}` | number;
|
|
270
277
|
export declare type FontStyleTokens = `$${GetTokenFontKeysFor<'style'>}` | TextStyle['fontStyle'];
|
package/src/helpers/cssHash.ts
DELETED
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import { simpleHash } from '@tamagui/helpers'
|
|
2
|
-
|
|
3
|
-
// not sure it's worth the extra weight, could be dev time though
|
|
4
|
-
// affordances for simple values
|
|
5
|
-
export function cssHash(val: string, maxLen = 10) {
|
|
6
|
-
if (val.length < maxLen) {
|
|
7
|
-
let res = ''
|
|
8
|
-
for (let i = 0; i < val.length; i++) {
|
|
9
|
-
const char = val[i]
|
|
10
|
-
if (specials[char]) {
|
|
11
|
-
res += specials[char]
|
|
12
|
-
} else {
|
|
13
|
-
res += validCSS.test(char) ? char : '_' + char.charCodeAt(0).toString()
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
return res
|
|
17
|
-
}
|
|
18
|
-
return simpleHash(val)
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
const validCSS = /[a-z0-9]/i
|
|
22
|
-
|
|
23
|
-
const specials = {
|
|
24
|
-
'.': 'dot',
|
|
25
|
-
',': '_',
|
|
26
|
-
'%': 'pct',
|
|
27
|
-
'-': 'neg',
|
|
28
|
-
}
|