@tamagui/core 1.0.0-beta.153 → 1.0.0-beta.16
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/README.md +1 -0
- package/dist/cjs/Tamagui.js +13 -1
- package/dist/cjs/Tamagui.js.map +2 -2
- package/dist/cjs/ThemeContext.js +4 -0
- package/dist/cjs/ThemeManager.js +30 -14
- package/dist/cjs/ThemeManager.js.map +2 -2
- package/dist/cjs/conf.js +10 -1
- package/dist/cjs/conf.js.map +2 -2
- package/dist/cjs/constants/constants.js +6 -0
- package/dist/cjs/constants/platform.js +15 -0
- package/dist/cjs/constants/platform.js.map +2 -2
- package/dist/cjs/constants/rnw.js +4 -0
- package/dist/cjs/contexts/ButtonInsideButtonContext.js +4 -0
- package/dist/cjs/createComponent.js +191 -113
- package/dist/cjs/createComponent.js.map +2 -2
- package/dist/cjs/createFont.js +4 -0
- package/dist/cjs/createShorthands.js +4 -0
- package/dist/cjs/createTamagui.js +48 -27
- package/dist/cjs/createTamagui.js.map +2 -2
- package/dist/cjs/createTheme.js +4 -0
- package/dist/cjs/createTokens.js +7 -6
- package/dist/cjs/createTokens.js.map +2 -2
- package/dist/cjs/createVariable.js +18 -2
- package/dist/cjs/createVariable.js.map +2 -2
- package/dist/cjs/helpers/RNComponents.js +4 -0
- package/dist/cjs/helpers/addStylesUsingClassname.js +8 -0
- package/dist/cjs/helpers/addStylesUsingClassname.js.map +2 -2
- package/dist/cjs/helpers/areEqualSets.js +4 -0
- package/dist/cjs/helpers/createMediaStyle.js +5 -2
- package/dist/cjs/helpers/createMediaStyle.js.map +2 -2
- package/dist/cjs/helpers/createPropMapper.js +53 -22
- package/dist/cjs/helpers/createPropMapper.js.map +2 -2
- package/dist/cjs/helpers/createShallowUpdate.js +4 -0
- package/dist/cjs/helpers/createTamaguiProvider.js +4 -0
- package/dist/cjs/helpers/extendStaticConfig.js +9 -6
- package/dist/cjs/helpers/extendStaticConfig.js.map +2 -2
- package/dist/cjs/helpers/fixNativeShadow.js +4 -0
- package/dist/cjs/helpers/fixNativeShadow.native.js +10 -9
- package/dist/cjs/helpers/fixNativeShadow.native.js.map +2 -2
- package/dist/cjs/helpers/getButtonSize.js +45 -0
- package/dist/cjs/helpers/getButtonSize.js.map +7 -0
- package/dist/cjs/helpers/getExpandedShorthands.js +4 -0
- package/dist/cjs/helpers/getSize.js +35 -0
- package/dist/cjs/helpers/getSize.js.map +7 -0
- package/dist/cjs/helpers/getSplitStyles.js +137 -55
- package/dist/cjs/helpers/getSplitStyles.js.map +2 -2
- package/dist/cjs/helpers/getStylesAtomic.js +20 -3
- package/dist/cjs/helpers/getStylesAtomic.js.map +2 -2
- package/dist/cjs/helpers/getStylesAtomic.native.js +4 -0
- package/dist/cjs/helpers/getTextSize.js +56 -0
- package/dist/cjs/helpers/getTextSize.js.map +7 -0
- package/dist/cjs/helpers/insertStyleRule.js +42 -27
- package/dist/cjs/helpers/insertStyleRule.js.map +2 -2
- package/dist/cjs/helpers/isObj.js +4 -0
- package/dist/cjs/helpers/isTamaguiElement.js +4 -0
- package/dist/cjs/helpers/matchMedia.js +4 -0
- package/dist/cjs/helpers/matchMedia.native.js +4 -0
- package/dist/cjs/{constants/pseudos.js → helpers/nativeGestureHandler.js} +11 -19
- package/dist/cjs/helpers/nativeGestureHandler.js.map +7 -0
- package/dist/cjs/helpers/nativeGestureHandler.native.js +18 -0
- package/dist/cjs/helpers/nativeGestureHandler.native.js.map +7 -0
- package/dist/cjs/helpers/proxyThemeVariables.js +40 -0
- package/dist/cjs/helpers/proxyThemeVariables.js.map +7 -0
- package/dist/cjs/helpers/themeable.js +7 -2
- package/dist/cjs/helpers/themeable.js.map +2 -2
- package/dist/cjs/helpers/validate.js +53 -11
- package/dist/cjs/helpers/validate.js.map +2 -2
- package/dist/cjs/helpers/withStaticProperties.js +4 -0
- package/dist/cjs/helpers/wrapThemeManagerContext.js +4 -0
- package/dist/cjs/hooks/useConstant.js +4 -0
- package/dist/cjs/hooks/useFeatures.js +4 -0
- package/dist/cjs/hooks/useId.js +59 -0
- package/dist/cjs/hooks/useId.js.map +7 -0
- package/dist/cjs/hooks/useIsMounted.js +4 -0
- package/dist/cjs/hooks/useIsTouchDevice.js +8 -4
- package/dist/cjs/hooks/useIsTouchDevice.js.map +2 -2
- package/dist/cjs/hooks/useMedia.js +14 -0
- package/dist/cjs/hooks/useMedia.js.map +2 -2
- package/dist/cjs/hooks/usePressable.js +4 -0
- package/dist/cjs/hooks/usePrevious.js +1 -0
- package/dist/cjs/{createShallowUpdate.js.map → hooks/usePrevious.js.map} +0 -0
- package/dist/cjs/hooks/useTheme.js +30 -16
- package/dist/cjs/hooks/useTheme.js.map +2 -2
- package/dist/cjs/hooks/useUnmountEffect.js +4 -0
- package/dist/cjs/index.js +24 -6
- package/dist/cjs/index.js.map +2 -2
- package/dist/cjs/nativeGestureHandler.native.js +18 -0
- package/dist/cjs/nativeGestureHandler.native.js.map +7 -0
- package/dist/cjs/static.js +3 -0
- package/dist/cjs/static.js.map +2 -2
- package/dist/cjs/styled.js +11 -5
- package/dist/cjs/styled.js.map +2 -2
- package/dist/cjs/types.js.map +1 -1
- package/dist/cjs/views/Slot.js +134 -0
- package/dist/cjs/views/Slot.js.map +7 -0
- package/dist/cjs/views/Stack.js +4 -0
- package/dist/cjs/views/Text.js +13 -14
- package/dist/cjs/views/Text.js.map +2 -2
- package/dist/cjs/views/TextAncestorContext.js +6 -0
- package/dist/cjs/views/Theme.js +7 -3
- package/dist/cjs/views/Theme.js.map +2 -2
- package/dist/cjs/views/ThemeInverse.js +10 -1
- package/dist/cjs/views/ThemeInverse.js.map +2 -2
- package/dist/cjs/views/ThemeProvider.js +6 -1
- package/dist/cjs/views/ThemeProvider.js.map +2 -2
- package/dist/cjs/views/ThemeReset.js +4 -0
- package/dist/esm/Tamagui.js +8 -2
- package/dist/esm/Tamagui.js.map +2 -2
- package/dist/esm/ThemeManager.js +21 -11
- package/dist/esm/ThemeManager.js.map +2 -2
- package/dist/esm/conf.js +0 -1
- package/dist/esm/conf.js.map +2 -2
- package/dist/esm/constants/platform.js +2 -0
- package/dist/esm/constants/platform.js.map +2 -2
- package/dist/esm/createComponent.js +187 -122
- package/dist/esm/createComponent.js.map +2 -2
- package/dist/esm/createTamagui.js +45 -28
- package/dist/esm/createTamagui.js.map +2 -2
- package/dist/esm/createTokens.js +2 -6
- package/dist/esm/createTokens.js.map +2 -2
- package/dist/esm/createVariable.js +8 -2
- package/dist/esm/createVariable.js.map +2 -2
- package/dist/esm/helpers/addStylesUsingClassname.js +4 -1
- package/dist/esm/helpers/addStylesUsingClassname.js.map +2 -2
- package/dist/esm/helpers/createMediaStyle.js +0 -2
- package/dist/esm/helpers/createMediaStyle.js.map +2 -2
- package/dist/esm/helpers/createPropMapper.js +50 -22
- package/dist/esm/helpers/createPropMapper.js.map +2 -2
- package/dist/esm/helpers/extendStaticConfig.js +9 -6
- package/dist/esm/helpers/extendStaticConfig.js.map +2 -2
- package/dist/esm/helpers/fixNativeShadow.native.js +7 -9
- package/dist/esm/helpers/fixNativeShadow.native.js.map +2 -2
- package/dist/esm/helpers/getButtonSize.js +24 -0
- package/dist/esm/helpers/getButtonSize.js.map +7 -0
- package/dist/esm/helpers/getSize.js +13 -0
- package/dist/esm/helpers/getSize.js.map +7 -0
- package/dist/esm/helpers/getSplitStyles.js +136 -57
- package/dist/esm/helpers/getSplitStyles.js.map +2 -2
- package/dist/esm/helpers/getStylesAtomic.js +15 -3
- package/dist/esm/helpers/getStylesAtomic.js.map +2 -2
- package/dist/esm/helpers/getTextSize.js +34 -0
- package/dist/esm/helpers/getTextSize.js.map +7 -0
- package/dist/esm/helpers/insertStyleRule.js +32 -27
- package/dist/esm/helpers/insertStyleRule.js.map +2 -2
- package/dist/esm/helpers/nativeGestureHandler.js +7 -0
- package/dist/esm/helpers/nativeGestureHandler.js.map +7 -0
- package/dist/esm/helpers/nativeGestureHandler.native.js +2 -0
- package/dist/esm/helpers/nativeGestureHandler.native.js.map +7 -0
- package/dist/esm/helpers/proxyThemeVariables.js +18 -0
- package/dist/esm/helpers/proxyThemeVariables.js.map +7 -0
- package/dist/esm/helpers/themeable.js +3 -2
- package/dist/esm/helpers/themeable.js.map +2 -2
- package/dist/esm/helpers/validate.js +24 -11
- package/dist/esm/helpers/validate.js.map +2 -2
- package/dist/esm/hooks/useId.js +35 -0
- package/dist/esm/hooks/useId.js.map +7 -0
- package/dist/esm/hooks/useIsTouchDevice.js +6 -6
- package/dist/esm/hooks/useIsTouchDevice.js.map +2 -2
- package/dist/esm/hooks/useMedia.js +3 -0
- package/dist/esm/hooks/useMedia.js.map +2 -2
- package/dist/esm/hooks/usePrevious.js +1 -0
- package/dist/esm/{createShallowUpdate.js.map → hooks/usePrevious.js.map} +0 -0
- package/dist/esm/hooks/useTheme.js +22 -16
- package/dist/esm/hooks/useTheme.js.map +2 -2
- package/dist/esm/index.js +13 -6
- package/dist/esm/index.js.map +2 -2
- package/dist/esm/nativeGestureHandler.native.js +2 -0
- package/dist/esm/nativeGestureHandler.native.js.map +7 -0
- package/dist/esm/static.js +3 -0
- package/dist/esm/static.js.map +2 -2
- package/dist/esm/styled.js +7 -5
- package/dist/esm/styled.js.map +2 -2
- package/dist/esm/views/Slot.js +82 -0
- package/dist/esm/views/Slot.js.map +7 -0
- package/dist/esm/views/Text.js +9 -14
- package/dist/esm/views/Text.js.map +2 -2
- package/dist/esm/views/Theme.js +3 -3
- package/dist/esm/views/Theme.js.map +2 -2
- package/dist/esm/views/ThemeInverse.js +6 -2
- package/dist/esm/views/ThemeInverse.js.map +2 -2
- package/dist/esm/views/ThemeProvider.js +2 -1
- package/dist/esm/views/ThemeProvider.js.map +2 -2
- package/dist/jsx/Tamagui.js +8 -2
- package/dist/jsx/ThemeManager.js +21 -11
- package/dist/jsx/conf.js +0 -1
- package/dist/jsx/constants/platform.js +2 -0
- package/dist/jsx/createComponent.js +173 -113
- package/dist/jsx/createTamagui.js +45 -28
- package/dist/jsx/createTokens.js +2 -6
- package/dist/jsx/createVariable.js +8 -2
- package/dist/jsx/helpers/addStylesUsingClassname.js +4 -1
- package/dist/jsx/helpers/createMediaStyle.js +0 -2
- package/dist/jsx/helpers/createPropMapper.js +50 -22
- package/dist/jsx/helpers/extendStaticConfig.js +9 -6
- package/dist/jsx/helpers/fixNativeShadow.native.js +7 -9
- package/dist/jsx/helpers/getButtonSize.js +23 -0
- package/dist/jsx/helpers/getSize.js +12 -0
- package/dist/jsx/helpers/getSplitStyles.js +136 -57
- package/dist/jsx/helpers/getStylesAtomic.js +15 -3
- package/dist/jsx/helpers/getTextSize.js +33 -0
- package/dist/jsx/helpers/insertStyleRule.js +32 -27
- package/dist/jsx/helpers/nativeGestureHandler.js +6 -0
- package/dist/jsx/helpers/nativeGestureHandler.native.js +1 -0
- package/dist/jsx/helpers/proxyThemeVariables.js +17 -0
- package/dist/jsx/helpers/themeable.js +3 -3
- package/dist/jsx/helpers/validate.js +24 -11
- package/dist/jsx/hooks/useId.js +34 -0
- package/dist/jsx/hooks/useIsTouchDevice.js +6 -6
- package/dist/jsx/hooks/useMedia.js +3 -0
- package/dist/jsx/{createShallowUpdate.js → hooks/usePrevious.js} +0 -0
- package/dist/jsx/hooks/useTheme.js +22 -16
- package/dist/jsx/index.js +13 -6
- package/dist/jsx/nativeGestureHandler.native.js +1 -0
- package/dist/jsx/static.js +3 -0
- package/dist/jsx/styled.js +7 -5
- package/dist/jsx/views/Slot.js +75 -0
- package/dist/jsx/views/Text.js +9 -14
- package/dist/jsx/views/Theme.js +4 -4
- package/dist/jsx/views/ThemeInverse.js +6 -1
- package/dist/jsx/views/ThemeProvider.js +2 -2
- package/package.json +8 -6
- package/types/Tamagui.d.ts +16 -1
- package/types/Tamagui.d.ts.map +1 -1
- package/types/ThemeManager.d.ts +3 -3
- package/types/ThemeManager.d.ts.map +1 -1
- package/types/conf.d.ts +2 -0
- package/types/conf.d.ts.map +1 -1
- package/types/constants/platform.d.ts +1 -0
- package/types/constants/platform.d.ts.map +1 -1
- package/types/createComponent.d.ts +3 -4
- package/types/createComponent.d.ts.map +1 -1
- package/types/createTamagui.d.ts +3 -1
- package/types/createTamagui.d.ts.map +1 -1
- package/types/createTokens.d.ts +0 -26
- package/types/createTokens.d.ts.map +1 -1
- package/types/createVariable.d.ts +1 -0
- package/types/createVariable.d.ts.map +1 -1
- package/types/helpers/addStylesUsingClassname.d.ts.map +1 -1
- package/types/helpers/createMediaStyle.d.ts.map +1 -1
- package/types/helpers/createPropMapper.d.ts +1 -1
- package/types/helpers/createPropMapper.d.ts.map +1 -1
- package/types/helpers/extendStaticConfig.d.ts +2 -2
- package/types/helpers/extendStaticConfig.d.ts.map +1 -1
- package/types/helpers/fixNativeShadow.native.d.ts +2 -1
- package/types/helpers/fixNativeShadow.native.d.ts.map +1 -1
- package/types/helpers/getButtonSize.d.ts +8 -0
- package/types/helpers/getButtonSize.d.ts.map +1 -0
- package/types/helpers/getSize.d.ts +3 -0
- package/types/helpers/getSize.d.ts.map +1 -0
- package/types/helpers/getSplitStyles.d.ts +14 -6
- package/types/helpers/getSplitStyles.d.ts.map +1 -1
- package/types/helpers/getStylesAtomic.d.ts.map +1 -1
- package/types/helpers/getTextSize.d.ts +3 -0
- package/types/helpers/getTextSize.d.ts.map +1 -0
- package/types/helpers/insertStyleRule.d.ts +2 -1
- package/types/helpers/insertStyleRule.d.ts.map +1 -1
- package/types/helpers/nativeGestureHandler.d.ts +2 -0
- package/types/helpers/nativeGestureHandler.d.ts.map +1 -0
- package/types/helpers/nativeGestureHandler.native.d.ts +2 -0
- package/types/helpers/nativeGestureHandler.native.d.ts.map +1 -0
- package/types/helpers/proxyThemeVariables.d.ts +2 -0
- package/types/helpers/proxyThemeVariables.d.ts.map +1 -0
- package/types/helpers/themeable.d.ts +3 -1
- package/types/helpers/themeable.d.ts.map +1 -1
- package/types/helpers/validate.d.ts.map +1 -1
- package/types/hooks/useId.d.ts +9 -0
- package/types/hooks/useId.d.ts.map +1 -0
- package/types/hooks/useMedia.d.ts +2 -6
- package/types/hooks/useMedia.d.ts.map +1 -1
- package/types/hooks/usePrevious.d.ts +1 -0
- package/types/hooks/usePrevious.d.ts.map +1 -0
- package/types/hooks/useTheme.d.ts +1 -1
- package/types/hooks/useTheme.d.ts.map +1 -1
- package/types/index.d.ts +11 -6
- package/types/index.d.ts.map +1 -1
- package/types/nativeGestureHandler.native.d.ts +2 -0
- package/types/nativeGestureHandler.native.d.ts.map +1 -0
- package/types/static.d.ts +3 -0
- package/types/static.d.ts.map +1 -1
- package/types/styled.d.ts +12 -3
- package/types/styled.d.ts.map +1 -1
- package/types/types.d.ts +86 -46
- package/types/types.d.ts.map +1 -1
- package/types/views/Slot.d.ts +9 -0
- package/types/views/Slot.d.ts.map +1 -0
- package/types/views/Text.d.ts.map +1 -1
- package/types/views/Theme.d.ts +1 -0
- package/types/views/Theme.d.ts.map +1 -1
- package/types/views/ThemeInverse.d.ts.map +1 -1
- package/types/views/ThemeProvider.d.ts +1 -0
- package/types/views/ThemeProvider.d.ts.map +1 -1
- package/LICENSE +0 -21
- package/dist/cjs/constants/pseudos.js.map +0 -7
- package/dist/cjs/createShallowUpdate.js +0 -1
- package/dist/cjs/devtools.js +0 -32
- package/dist/cjs/devtools.js.map +0 -7
- package/dist/cjs/spacedChildren.js +0 -86
- package/dist/cjs/spacedChildren.js.map +0 -7
- package/dist/cjs/tamagui-base.css +0 -8
- package/dist/cjs/tamagui-base.css.map +0 -7
- package/dist/esm/constants/pseudos.js +0 -18
- package/dist/esm/constants/pseudos.js.map +0 -7
- package/dist/esm/createShallowUpdate.js +0 -1
- package/dist/esm/devtools.js +0 -14
- package/dist/esm/devtools.js.map +0 -7
- package/dist/esm/spacedChildren.js +0 -52
- package/dist/esm/spacedChildren.js.map +0 -7
- package/dist/esm/tamagui-base.css +0 -8
- package/dist/esm/tamagui-base.css.map +0 -7
- package/dist/jsx/constants/pseudos.js +0 -17
- package/dist/jsx/devtools.js +0 -13
- package/dist/jsx/spacedChildren.js +0 -44
- package/dist/jsx/tamagui-base.css +0 -7
- package/types/spacedChildren.d.ts +0 -9
- package/types/spacedChildren.d.ts.map +0 -1
|
@@ -6,25 +6,30 @@ const insertedTransforms = {};
|
|
|
6
6
|
const getAllSelectors = /* @__PURE__ */ __name(() => allSelectors, "getAllSelectors");
|
|
7
7
|
const getInsertedRules = /* @__PURE__ */ __name(() => Object.values(insertedSelectors), "getInsertedRules");
|
|
8
8
|
const getAllTransforms = /* @__PURE__ */ __name(() => insertedTransforms, "getAllTransforms");
|
|
9
|
-
function addTransform(identifier, rule) {
|
|
10
|
-
const s =
|
|
9
|
+
function addTransform(identifier, css, rule) {
|
|
10
|
+
const s = css.indexOf("transform:");
|
|
11
11
|
if (s === -1) {
|
|
12
|
-
|
|
12
|
+
if (process.env.NODE_ENV === "development") {
|
|
13
|
+
console.groupCollapsed(`\u274C Invalid transform, likely used deg/% improperly ${identifier}`);
|
|
14
|
+
console.log("rule:", rule);
|
|
15
|
+
console.trace();
|
|
16
|
+
console.groupEnd();
|
|
17
|
+
} else {
|
|
18
|
+
console.error(`Missing transform`, identifier, css, rule);
|
|
19
|
+
}
|
|
13
20
|
return;
|
|
14
21
|
}
|
|
15
22
|
const startI = s + "transform:".length;
|
|
16
|
-
const endI =
|
|
17
|
-
const value =
|
|
18
|
-
console.log("add", identifier, value);
|
|
23
|
+
const endI = css.indexOf(";");
|
|
24
|
+
const value = css.slice(startI, endI);
|
|
19
25
|
insertedTransforms[identifier] = value;
|
|
20
26
|
}
|
|
21
27
|
__name(addTransform, "addTransform");
|
|
22
|
-
let hasInsertedSinceUpdate = true;
|
|
23
28
|
const isClient = typeof document !== "undefined";
|
|
29
|
+
let hasInsertedSinceUpdate = true;
|
|
24
30
|
function updateInserted() {
|
|
25
|
-
if (!isClient)
|
|
31
|
+
if (!isClient)
|
|
26
32
|
return;
|
|
27
|
-
}
|
|
28
33
|
if (!hasInsertedSinceUpdate) {
|
|
29
34
|
console.warn("hasnt inserted since");
|
|
30
35
|
return;
|
|
@@ -46,9 +51,11 @@ function updateInserted() {
|
|
|
46
51
|
if (!(rule instanceof CSSStyleRule))
|
|
47
52
|
continue;
|
|
48
53
|
const identifier = rule.selectorText.slice(1);
|
|
49
|
-
allSelectors[identifier]
|
|
50
|
-
|
|
51
|
-
|
|
54
|
+
if (!allSelectors[identifier]) {
|
|
55
|
+
allSelectors[identifier] = process.env.NODE_ENV === "development" ? rule.cssText : true;
|
|
56
|
+
if (identifier.startsWith("_transform")) {
|
|
57
|
+
addTransform(identifier, rule.cssText, rule);
|
|
58
|
+
}
|
|
52
59
|
}
|
|
53
60
|
}
|
|
54
61
|
}
|
|
@@ -57,26 +64,23 @@ function updateInserted() {
|
|
|
57
64
|
}
|
|
58
65
|
__name(updateInserted, "updateInserted");
|
|
59
66
|
updateInserted();
|
|
60
|
-
const
|
|
61
|
-
function
|
|
62
|
-
if (
|
|
67
|
+
const sheet = isClient ? document.head.appendChild(document.createElement("style")).sheet : null;
|
|
68
|
+
function updateInsertedCache(identifier, rule) {
|
|
69
|
+
if (insertedSelectors[identifier])
|
|
63
70
|
return;
|
|
64
|
-
}
|
|
65
|
-
hasInsertedSinceUpdate = true;
|
|
66
|
-
if (identifier === "_transform-1abwpjw") {
|
|
67
|
-
console.trace("inserting", identifier, rule);
|
|
68
|
-
}
|
|
69
71
|
insertedSelectors[identifier] = rule;
|
|
70
|
-
allSelectors[identifier] = process.env.NODE_ENV === "development" ? rule : true;
|
|
71
72
|
if (identifier.startsWith("_transform")) {
|
|
72
73
|
addTransform(identifier, rule);
|
|
73
74
|
}
|
|
74
|
-
|
|
75
|
+
}
|
|
76
|
+
__name(updateInsertedCache, "updateInsertedCache");
|
|
77
|
+
function insertStyleRule(identifier, rule) {
|
|
78
|
+
if (allSelectors[identifier])
|
|
75
79
|
return;
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
+
hasInsertedSinceUpdate = true;
|
|
81
|
+
updateInsertedCache(identifier, rule);
|
|
82
|
+
allSelectors[identifier] = process.env.NODE_ENV === "development" ? rule : true;
|
|
83
|
+
sheet == null ? void 0 : sheet.insertRule(rule, sheet.cssRules.length);
|
|
80
84
|
}
|
|
81
85
|
__name(insertStyleRule, "insertStyleRule");
|
|
82
86
|
export {
|
|
@@ -85,5 +89,6 @@ export {
|
|
|
85
89
|
getInsertedRules,
|
|
86
90
|
insertStyleRule,
|
|
87
91
|
insertedTransforms,
|
|
88
|
-
updateInserted
|
|
92
|
+
updateInserted,
|
|
93
|
+
updateInsertedCache
|
|
89
94
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "react-native-gesture-handler";
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
3
|
+
function proxyThemeVariables(obj) {
|
|
4
|
+
return new Proxy(obj, {
|
|
5
|
+
has(target, key) {
|
|
6
|
+
return Reflect.has(target, removeStarting$(key));
|
|
7
|
+
},
|
|
8
|
+
get(target, key) {
|
|
9
|
+
return Reflect.get(target, removeStarting$(key));
|
|
10
|
+
}
|
|
11
|
+
});
|
|
12
|
+
}
|
|
13
|
+
__name(proxyThemeVariables, "proxyThemeVariables");
|
|
14
|
+
const removeStarting$ = /* @__PURE__ */ __name((str) => typeof str === "string" && str[0] === "$" ? str.slice(1) : str, "removeStarting$");
|
|
15
|
+
export {
|
|
16
|
+
proxyThemeVariables
|
|
17
|
+
};
|
|
@@ -3,14 +3,14 @@ var __name = (target, value) => __defProp(target, "name", { value, configurable:
|
|
|
3
3
|
import React, { forwardRef } from "react";
|
|
4
4
|
import { Theme } from "../views/Theme";
|
|
5
5
|
import { ThemeInverse } from "../views/ThemeInverse";
|
|
6
|
-
function themeable(component) {
|
|
6
|
+
function themeable(component, opts) {
|
|
7
7
|
const withThemeComponent = forwardRef(/* @__PURE__ */ __name(function WithTheme({ themeInverse, theme, ...rest }, ref) {
|
|
8
8
|
const element = React.createElement(component, { ...rest, ref });
|
|
9
9
|
if (themeInverse) {
|
|
10
10
|
return <ThemeInverse>{element}</ThemeInverse>;
|
|
11
11
|
}
|
|
12
|
-
if (theme) {
|
|
13
|
-
return <Theme name={theme || null}>{element}</Theme>;
|
|
12
|
+
if (theme || opts) {
|
|
13
|
+
return <Theme componentName={opts == null ? void 0 : opts.componentName} name={theme || null}>{element}</Theme>;
|
|
14
14
|
}
|
|
15
15
|
return element;
|
|
16
16
|
}, "WithTheme"));
|
|
@@ -3,7 +3,8 @@ var __name = (target, value) => __defProp(target, "name", { value, configurable:
|
|
|
3
3
|
const { default: ow } = require("@tamagui/ow/dev-only");
|
|
4
4
|
let Config;
|
|
5
5
|
let Tokens;
|
|
6
|
-
let
|
|
6
|
+
let FontRequired;
|
|
7
|
+
let FontOptional;
|
|
7
8
|
const validateConfig = /* @__PURE__ */ __name((conf) => {
|
|
8
9
|
if (!conf) {
|
|
9
10
|
console.warn("no conf?");
|
|
@@ -24,12 +25,26 @@ const validateTokens = /* @__PURE__ */ __name((tokens) => {
|
|
|
24
25
|
}, "validateTokens");
|
|
25
26
|
const validateFont = /* @__PURE__ */ __name((font) => {
|
|
26
27
|
try {
|
|
27
|
-
|
|
28
|
+
const { style, transform, color, ...required } = font;
|
|
29
|
+
ow(required, FontRequired);
|
|
30
|
+
ow({ style, transform, color }, FontOptional);
|
|
28
31
|
} catch (err) {
|
|
29
32
|
console.warn("Given font:\n", JSON.stringify(font, null, 2), err);
|
|
30
33
|
}
|
|
31
34
|
}, "validateFont");
|
|
32
35
|
if (process.env.NODE_ENV === "development") {
|
|
36
|
+
const fontReq = {
|
|
37
|
+
family: ow.string,
|
|
38
|
+
size: ow.object.nonEmpty.valuesOfType(ow.number),
|
|
39
|
+
lineHeight: ow.object.nonEmpty.valuesOfType(ow.number),
|
|
40
|
+
weight: ow.object.nonEmpty.valuesOfType(ow.string),
|
|
41
|
+
letterSpacing: ow.object.nonEmpty.valuesOfType(ow.number)
|
|
42
|
+
};
|
|
43
|
+
const fontOpt = {
|
|
44
|
+
style: ow.optional.object.valuesOfType(ow.string),
|
|
45
|
+
transform: ow.optional.object.valuesOfType(ow.string),
|
|
46
|
+
color: ow.optional.object.valuesOfType(ow.string)
|
|
47
|
+
};
|
|
33
48
|
Config = ow.object.exactShape({
|
|
34
49
|
defaultTheme: ow.optional.string,
|
|
35
50
|
disableRootThemeClass: ow.optional.boolean,
|
|
@@ -37,17 +52,15 @@ if (process.env.NODE_ENV === "development") {
|
|
|
37
52
|
themes: ow.object.valuesOfType(ow.object),
|
|
38
53
|
tokens: ow.object.valuesOfType(ow.object),
|
|
39
54
|
media: ow.object.valuesOfType(ow.object),
|
|
40
|
-
animations: ow.object.valuesOfType(ow.object)
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
lineHeight: ow.object.nonEmpty.valuesOfType(ow.number),
|
|
46
|
-
weight: ow.object.nonEmpty.valuesOfType(ow.string),
|
|
47
|
-
letterSpacing: ow.object.nonEmpty.valuesOfType(ow.number)
|
|
55
|
+
animations: ow.object.valuesOfType(ow.object),
|
|
56
|
+
fonts: ow.object.valuesOfType(ow.object.partialShape({
|
|
57
|
+
...fontReq,
|
|
58
|
+
...fontOpt
|
|
59
|
+
}))
|
|
48
60
|
});
|
|
61
|
+
FontRequired = ow.object.exactShape(fontReq);
|
|
62
|
+
FontOptional = ow.object.partialShape(fontOpt);
|
|
49
63
|
Tokens = ow.object.exactShape({
|
|
50
|
-
font: ow.object.valuesOfType(Font),
|
|
51
64
|
size: ow.object.nonEmpty.valuesOfType(ow.number),
|
|
52
65
|
space: ow.object.nonEmpty.valuesOfType(ow.number),
|
|
53
66
|
zIndex: ow.object.nonEmpty.valuesOfType(ow.number),
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
3
|
+
import * as React from "react";
|
|
4
|
+
import { useIsomorphicLayoutEffect } from "../constants/platform";
|
|
5
|
+
let serverHandoffComplete = false;
|
|
6
|
+
let id = 0;
|
|
7
|
+
function genId() {
|
|
8
|
+
return ++id;
|
|
9
|
+
}
|
|
10
|
+
__name(genId, "genId");
|
|
11
|
+
function useId(providedId) {
|
|
12
|
+
var _a;
|
|
13
|
+
if (typeof React.useId === "function") {
|
|
14
|
+
let id3 = React.useId(providedId);
|
|
15
|
+
return providedId != null ? providedId : id3;
|
|
16
|
+
}
|
|
17
|
+
let initialId = providedId != null ? providedId : serverHandoffComplete ? genId() : null;
|
|
18
|
+
let [id2, setId] = React.useState(initialId);
|
|
19
|
+
useIsomorphicLayoutEffect(() => {
|
|
20
|
+
if (id2 === null) {
|
|
21
|
+
setId(genId());
|
|
22
|
+
}
|
|
23
|
+
}, []);
|
|
24
|
+
React.useEffect(() => {
|
|
25
|
+
if (serverHandoffComplete === false) {
|
|
26
|
+
serverHandoffComplete = true;
|
|
27
|
+
}
|
|
28
|
+
}, []);
|
|
29
|
+
return (_a = providedId != null ? providedId : id2) != null ? _a : void 0;
|
|
30
|
+
}
|
|
31
|
+
__name(useId, "useId");
|
|
32
|
+
export {
|
|
33
|
+
useId
|
|
34
|
+
};
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
var __defProp = Object.defineProperty;
|
|
2
2
|
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
3
|
-
import {
|
|
4
|
-
import { isTouchDevice } from "../constants/platform";
|
|
3
|
+
import { useState } from "react";
|
|
4
|
+
import { isTouchDevice, useIsomorphicLayoutEffect } from "../constants/platform";
|
|
5
5
|
const useIsTouchDevice = /* @__PURE__ */ __name(() => {
|
|
6
6
|
const [touchOnly, setTouchOnly] = useState(false);
|
|
7
|
-
|
|
8
|
-
|
|
7
|
+
useIsomorphicLayoutEffect(() => {
|
|
8
|
+
if (isTouchDevice) {
|
|
9
9
|
setTouchOnly(true);
|
|
10
|
-
}
|
|
11
|
-
}
|
|
10
|
+
}
|
|
11
|
+
}, []);
|
|
12
12
|
return touchOnly;
|
|
13
13
|
}, "useIsTouchDevice");
|
|
14
14
|
export {
|
|
@@ -107,6 +107,9 @@ const useMedia = /* @__PURE__ */ __name(() => {
|
|
|
107
107
|
const st = state.current;
|
|
108
108
|
return new Proxy(mediaState, {
|
|
109
109
|
get(target, key) {
|
|
110
|
+
if (key[0] !== "$") {
|
|
111
|
+
key = `$${key}`;
|
|
112
|
+
}
|
|
110
113
|
if (!(key in mediaState)) {
|
|
111
114
|
return Reflect.get(target, key);
|
|
112
115
|
}
|
|
File without changes
|
|
@@ -51,6 +51,11 @@ const useTheme = /* @__PURE__ */ __name((themeName, componentName, props, forceU
|
|
|
51
51
|
get(_, key) {
|
|
52
52
|
if (!name || key === "__proto__" || typeof key === "symbol") {
|
|
53
53
|
if (key === GetThemeManager) {
|
|
54
|
+
if (process.env.NODE_ENV === "development") {
|
|
55
|
+
if (props["debug"]) {
|
|
56
|
+
console.log("did change", { themeName, didChangeTheme, name, componentName }, themeManager == null ? void 0 : themeManager.parentName);
|
|
57
|
+
}
|
|
58
|
+
}
|
|
54
59
|
if (!didChangeTheme) {
|
|
55
60
|
return null;
|
|
56
61
|
}
|
|
@@ -58,6 +63,9 @@ const useTheme = /* @__PURE__ */ __name((themeName, componentName, props, forceU
|
|
|
58
63
|
}
|
|
59
64
|
return Reflect.get(_, key);
|
|
60
65
|
}
|
|
66
|
+
if (typeof key !== "string" || key === "$typeof") {
|
|
67
|
+
return Reflect.get(_, key);
|
|
68
|
+
}
|
|
61
69
|
if (process.env.NODE_ENV === "development") {
|
|
62
70
|
if (key === "__state") {
|
|
63
71
|
return state.current;
|
|
@@ -73,25 +81,23 @@ const useTheme = /* @__PURE__ */ __name((themeName, componentName, props, forceU
|
|
|
73
81
|
console.error("No themeManager");
|
|
74
82
|
return;
|
|
75
83
|
}
|
|
76
|
-
if (
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
if (
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
if (
|
|
85
|
-
|
|
86
|
-
console.log(" \xBB tracking theme key", key);
|
|
87
|
-
}
|
|
84
|
+
if (key[0] === "$") {
|
|
85
|
+
key = key.slice(1);
|
|
86
|
+
}
|
|
87
|
+
const val = themeManager.getValue(key);
|
|
88
|
+
if (val) {
|
|
89
|
+
if (state.current.isRendering) {
|
|
90
|
+
state.current.keys.add(key);
|
|
91
|
+
if (process.env.NODE_ENV === "development") {
|
|
92
|
+
if ((props == null ? void 0 : props["debug"]) === "verbose") {
|
|
93
|
+
console.log(" \xBB tracking theme key", key);
|
|
88
94
|
}
|
|
89
95
|
}
|
|
90
|
-
return val;
|
|
91
|
-
}
|
|
92
|
-
if (process.env.NODE_ENV === "development") {
|
|
93
|
-
console.log(`No theme value "${String(key)}" in ${name}`);
|
|
94
96
|
}
|
|
97
|
+
return val;
|
|
98
|
+
}
|
|
99
|
+
if (process.env.NODE_ENV === "development") {
|
|
100
|
+
console.log(`No theme value "${String(key)}" in ${name}`);
|
|
95
101
|
}
|
|
96
102
|
return Reflect.get(_, key);
|
|
97
103
|
}
|
package/dist/jsx/index.js
CHANGED
|
@@ -8,36 +8,43 @@ import { createTokens } from "./createTokens";
|
|
|
8
8
|
export * from "./createVariable";
|
|
9
9
|
export * from "./styled";
|
|
10
10
|
export * from "./types";
|
|
11
|
+
import { RNWTextProps, RNWViewProps } from "./types-rnw";
|
|
11
12
|
import { getHasConfigured, getConfig, getThemes, getTokens, onConfiguredOnce } from "./conf";
|
|
12
13
|
export * from "./constants/constants";
|
|
13
14
|
export * from "./constants/platform";
|
|
14
15
|
export * from "./constants/rnw";
|
|
16
|
+
export * from "./helpers/getButtonSize";
|
|
15
17
|
export * from "./helpers/getExpandedShorthands";
|
|
18
|
+
export * from "./helpers/getSize";
|
|
16
19
|
export * from "./helpers/getSplitStyles";
|
|
17
20
|
export * from "./helpers/getStylesAtomic";
|
|
21
|
+
export * from "./helpers/getTextSize";
|
|
18
22
|
export * from "./helpers/isObj";
|
|
19
23
|
export * from "./helpers/isTamaguiElement";
|
|
20
24
|
export * from "./helpers/matchMedia";
|
|
21
25
|
export * from "./helpers/themeable";
|
|
22
26
|
export * from "./helpers/withStaticProperties";
|
|
23
27
|
export * from "./contexts/ButtonInsideButtonContext";
|
|
24
|
-
export * from "./hooks/useIsTouchDevice";
|
|
25
28
|
export * from "./hooks/useConstant";
|
|
26
|
-
export * from "./hooks/
|
|
29
|
+
export * from "./hooks/useId";
|
|
30
|
+
export * from "./hooks/useIsMounted";
|
|
31
|
+
export * from "./hooks/useIsTouchDevice";
|
|
27
32
|
export * from "./hooks/useMedia";
|
|
33
|
+
export * from "./hooks/usePressable";
|
|
28
34
|
export * from "./hooks/useTheme";
|
|
29
|
-
export * from "./hooks/useIsMounted";
|
|
30
35
|
export * from "./hooks/useUnmountEffect";
|
|
31
|
-
export * from "@tamagui/use-force-update";
|
|
32
36
|
export * from "./views/Stack";
|
|
33
37
|
export * from "./views/Text";
|
|
38
|
+
export * from "./views/TextAncestorContext";
|
|
34
39
|
export * from "./views/Theme";
|
|
35
|
-
export * from "./views/ThemeReset";
|
|
36
40
|
export * from "./views/ThemeInverse";
|
|
37
41
|
export * from "./views/ThemeProvider";
|
|
38
|
-
export * from "./views/
|
|
42
|
+
export * from "./views/ThemeReset";
|
|
43
|
+
export * from "@tamagui/use-force-update";
|
|
39
44
|
export * from "@tamagui/helpers";
|
|
40
45
|
export {
|
|
46
|
+
RNWTextProps,
|
|
47
|
+
RNWViewProps,
|
|
41
48
|
createTokens,
|
|
42
49
|
getConfig,
|
|
43
50
|
getHasConfigured,
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "react-native-gesture-handler";
|
package/dist/jsx/static.js
CHANGED
|
@@ -3,11 +3,14 @@ export * from "./createComponent";
|
|
|
3
3
|
export * from "./createFont";
|
|
4
4
|
export * from "./createTokens";
|
|
5
5
|
export * from "./createTamagui";
|
|
6
|
+
export * from "./createVariable";
|
|
6
7
|
export * from "./constants/constants";
|
|
7
8
|
export * from "./hooks/useMedia";
|
|
8
9
|
export * from "./hooks/useTheme";
|
|
9
10
|
export * from "./helpers/isObj";
|
|
10
11
|
export * from "./helpers/getStylesAtomic";
|
|
12
|
+
export * from "./helpers/proxyThemeVariables";
|
|
11
13
|
export * from "./helpers/getSplitStyles";
|
|
12
14
|
export * from "@tamagui/helpers";
|
|
13
15
|
export * from "./constants/rnw";
|
|
16
|
+
export * from "./types";
|
package/dist/jsx/styled.js
CHANGED
|
@@ -2,18 +2,19 @@ var __defProp = Object.defineProperty;
|
|
|
2
2
|
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
3
3
|
import { Image, Text, TextInput } from "react-native";
|
|
4
4
|
import { createComponent } from "./createComponent";
|
|
5
|
-
import { extendStaticConfig } from "./helpers/extendStaticConfig";
|
|
6
5
|
import { RNComponents } from "./helpers/RNComponents";
|
|
7
6
|
function styled(Component, options, staticExtractionOptions) {
|
|
8
7
|
const staticConfigProps = (() => {
|
|
8
|
+
var _a;
|
|
9
9
|
if (options) {
|
|
10
10
|
const { variants, name, defaultVariants, ...defaultProps } = options;
|
|
11
11
|
if (defaultVariants) {
|
|
12
12
|
Object.assign(defaultProps, defaultVariants);
|
|
13
13
|
}
|
|
14
|
-
const isReactNativeWeb = RNComponents.has(Component);
|
|
14
|
+
const isReactNativeWeb = "staticConfig" in Component ? Component.staticConfig.isReactNativeWeb : RNComponents.has(Component);
|
|
15
|
+
const reactNativeWebComponent = isReactNativeWeb ? ((_a = Component["staticConfig"]) == null ? void 0 : _a.reactNativeWebComponent) || Component : null;
|
|
15
16
|
const isTamagui = !isReactNativeWeb && "staticConfig" in Component;
|
|
16
|
-
const Comp = Component;
|
|
17
|
+
const Comp = reactNativeWebComponent || Component;
|
|
17
18
|
const isImage = !!(defaultProps.isImage || (!isTamagui ? Comp === Image : false));
|
|
18
19
|
const isInput = !!(defaultProps.isInput || (!isTamagui ? Comp === TextInput : false));
|
|
19
20
|
const isText = !!(defaultProps.isText || (!isTamagui ? isInput || Comp === Text : false));
|
|
@@ -25,8 +26,10 @@ function styled(Component, options, staticExtractionOptions) {
|
|
|
25
26
|
isTamagui,
|
|
26
27
|
variants,
|
|
27
28
|
defaultProps,
|
|
29
|
+
defaultVariants,
|
|
28
30
|
componentName: name,
|
|
29
31
|
isReactNativeWeb,
|
|
32
|
+
reactNativeWebComponent,
|
|
30
33
|
isInput,
|
|
31
34
|
isText,
|
|
32
35
|
isImage
|
|
@@ -35,8 +38,7 @@ function styled(Component, options, staticExtractionOptions) {
|
|
|
35
38
|
}
|
|
36
39
|
return {};
|
|
37
40
|
})();
|
|
38
|
-
const
|
|
39
|
-
const component = createComponent(config);
|
|
41
|
+
const component = createComponent(staticConfigProps, Component);
|
|
40
42
|
return component;
|
|
41
43
|
}
|
|
42
44
|
__name(styled, "styled");
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
3
|
+
import { composeRefs } from "@tamagui/compose-refs";
|
|
4
|
+
import * as React from "react";
|
|
5
|
+
const Slot = React.forwardRef((props, forwardedRef) => {
|
|
6
|
+
const { children, ...slotProps } = props;
|
|
7
|
+
if (React.Children.toArray(children).some(isSlottable)) {
|
|
8
|
+
return <>{React.Children.map(children, (child) => {
|
|
9
|
+
return isSlottable(child) ? <SlotClone {...slotProps} ref={forwardedRef}>{child.props.children}</SlotClone> : child;
|
|
10
|
+
})}</>;
|
|
11
|
+
}
|
|
12
|
+
return <SlotClone {...slotProps} ref={forwardedRef}>{children}</SlotClone>;
|
|
13
|
+
});
|
|
14
|
+
Slot.displayName = "Slot";
|
|
15
|
+
const SlotClone = React.forwardRef((props, forwardedRef) => {
|
|
16
|
+
const { children, ...slotProps } = props;
|
|
17
|
+
if (React.isValidElement(children)) {
|
|
18
|
+
return React.cloneElement(children, {
|
|
19
|
+
...mergeProps(children, slotProps),
|
|
20
|
+
ref: composeRefs(forwardedRef, children.ref)
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
return React.Children.count(children) > 1 ? React.Children.only(null) : null;
|
|
24
|
+
});
|
|
25
|
+
SlotClone.displayName = "SlotClone";
|
|
26
|
+
const Slottable = /* @__PURE__ */ __name(({ children }) => {
|
|
27
|
+
return <>{children}</>;
|
|
28
|
+
}, "Slottable");
|
|
29
|
+
function isSlottable(child) {
|
|
30
|
+
return React.isValidElement(child);
|
|
31
|
+
}
|
|
32
|
+
__name(isSlottable, "isSlottable");
|
|
33
|
+
const pressMap = {
|
|
34
|
+
onPress: "onClick",
|
|
35
|
+
onPressOut: "onMouseOut",
|
|
36
|
+
onPressIn: "onMouseIn"
|
|
37
|
+
};
|
|
38
|
+
function mergeProps(child, slotProps) {
|
|
39
|
+
const childProps = child.props;
|
|
40
|
+
const overrideProps = { ...childProps };
|
|
41
|
+
const isHTMLChild = typeof child.type === "string";
|
|
42
|
+
if (isHTMLChild) {
|
|
43
|
+
for (const key in pressMap) {
|
|
44
|
+
if (key in slotProps) {
|
|
45
|
+
slotProps[pressMap[key]] = slotProps[key];
|
|
46
|
+
delete slotProps[key];
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
for (let propName in childProps) {
|
|
51
|
+
const slotPropValue = slotProps[propName];
|
|
52
|
+
const childPropValue = childProps[propName];
|
|
53
|
+
if (isHTMLChild && pressMap[propName]) {
|
|
54
|
+
propName = pressMap[propName];
|
|
55
|
+
delete overrideProps[propName];
|
|
56
|
+
}
|
|
57
|
+
const isHandler = /^on[A-Z]/.test(propName);
|
|
58
|
+
if (isHandler) {
|
|
59
|
+
overrideProps[propName] = (...args) => {
|
|
60
|
+
childPropValue == null ? void 0 : childPropValue(...args);
|
|
61
|
+
slotPropValue == null ? void 0 : slotPropValue(...args);
|
|
62
|
+
};
|
|
63
|
+
} else if (propName === "style") {
|
|
64
|
+
overrideProps[propName] = { ...slotPropValue, ...childPropValue };
|
|
65
|
+
} else if (propName === "className") {
|
|
66
|
+
overrideProps[propName] = [slotPropValue, childPropValue].filter(Boolean).join(" ");
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
return { ...slotProps, ...overrideProps };
|
|
70
|
+
}
|
|
71
|
+
__name(mergeProps, "mergeProps");
|
|
72
|
+
export {
|
|
73
|
+
Slot,
|
|
74
|
+
Slottable
|
|
75
|
+
};
|
package/dist/jsx/views/Text.js
CHANGED
|
@@ -11,15 +11,18 @@ const Text = createComponent({
|
|
|
11
11
|
componentName: "Text",
|
|
12
12
|
isText: true,
|
|
13
13
|
defaultProps: {
|
|
14
|
-
display:
|
|
15
|
-
boxSizing: "border-box",
|
|
14
|
+
display: "flex",
|
|
16
15
|
fontFamily: "System",
|
|
17
|
-
|
|
16
|
+
...isWeb && {
|
|
17
|
+
display: "inline",
|
|
18
|
+
boxSizing: "border-box",
|
|
19
|
+
wordWrap: "break-word"
|
|
20
|
+
}
|
|
18
21
|
},
|
|
19
22
|
variants: {
|
|
20
23
|
numberOfLines: {
|
|
21
|
-
1: ellipseStyle,
|
|
22
|
-
":number": (
|
|
24
|
+
1: isWeb ? ellipseStyle : { numberOfLines: 1 },
|
|
25
|
+
":number": (numberOfLines) => isWeb ? numberOfLines >= 1 ? { WebkitLineClamp: numberOfLines } : null : { numberOfLines }
|
|
23
26
|
},
|
|
24
27
|
selectable: {
|
|
25
28
|
true: {
|
|
@@ -45,15 +48,7 @@ const Text = createComponent({
|
|
|
45
48
|
deoptProps: new Set(isWeb ? [] : ["ellipse"]),
|
|
46
49
|
validStyles: {
|
|
47
50
|
...validStyles,
|
|
48
|
-
...stylePropsTextOnly
|
|
49
|
-
...isWeb && {
|
|
50
|
-
userSelect: true,
|
|
51
|
-
textOverflow: true,
|
|
52
|
-
whiteSpace: true,
|
|
53
|
-
wordWrap: true,
|
|
54
|
-
selectable: true,
|
|
55
|
-
cursor: true
|
|
56
|
-
}
|
|
51
|
+
...stylePropsTextOnly
|
|
57
52
|
}
|
|
58
53
|
});
|
|
59
54
|
export {
|
package/dist/jsx/views/Theme.js
CHANGED
|
@@ -3,11 +3,11 @@ var __name = (target, value) => __defProp(target, "name", { value, configurable:
|
|
|
3
3
|
import React, { memo, useMemo } from "react";
|
|
4
4
|
import { isWeb } from "../constants/platform";
|
|
5
5
|
import { wrapThemeManagerContext } from "../helpers/wrapThemeManagerContext";
|
|
6
|
-
import { useChangeThemeEffect } from "../
|
|
6
|
+
import { useChangeThemeEffect } from "../hooks/useTheme";
|
|
7
7
|
React["createElement"];
|
|
8
8
|
const Theme = memo(/* @__PURE__ */ __name(function Theme2(props) {
|
|
9
9
|
var _a, _b;
|
|
10
|
-
const { name, theme, themeManager, themes, className } = useChangeThemeEffect(props.name,
|
|
10
|
+
const { name, theme, themeManager, themes, className } = useChangeThemeEffect(props.name, props.componentName, props);
|
|
11
11
|
if (!themes || !name || !theme) {
|
|
12
12
|
if (name && !theme && process.env.NODE_ENV === "development") {
|
|
13
13
|
console.warn(`No theme found by name ${name}`);
|
|
@@ -16,13 +16,13 @@ const Theme = memo(/* @__PURE__ */ __name(function Theme2(props) {
|
|
|
16
16
|
}
|
|
17
17
|
const contents = useMemo(() => wrapThemeManagerContext(props.children, themeManager), [props.children, themeManager]);
|
|
18
18
|
if (isWeb) {
|
|
19
|
-
return <
|
|
19
|
+
return <span className={[
|
|
20
20
|
`tui_Theme`,
|
|
21
21
|
...!props.disableThemeClass ? [props.className, className].filter(Boolean) : []
|
|
22
22
|
].join(" ")} style={{
|
|
23
23
|
display: "contents",
|
|
24
24
|
color: (_b = (_a = themes[name]) == null ? void 0 : _a.color) == null ? void 0 : _b.toString()
|
|
25
|
-
}}>{contents}</
|
|
25
|
+
}}>{contents}</span>;
|
|
26
26
|
}
|
|
27
27
|
return contents;
|
|
28
28
|
}, "Theme"));
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
var __defProp = Object.defineProperty;
|
|
2
2
|
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
3
|
+
import { useState } from "react";
|
|
4
|
+
import { useIsomorphicLayoutEffect } from "../constants/platform";
|
|
3
5
|
import { useDefaultThemeName, useThemeName } from "../hooks/useTheme";
|
|
4
6
|
import { Theme } from "./Theme";
|
|
5
7
|
let inversions = {
|
|
@@ -13,7 +15,10 @@ __name(setThemeInversions, "setThemeInversions");
|
|
|
13
15
|
const ThemeInverse = /* @__PURE__ */ __name((props) => {
|
|
14
16
|
const themeName = useThemeName();
|
|
15
17
|
const defaultTheme = useDefaultThemeName();
|
|
16
|
-
const name
|
|
18
|
+
const [name, setName] = useState(null);
|
|
19
|
+
useIsomorphicLayoutEffect(() => {
|
|
20
|
+
setName(inversions[themeName] || inversions[defaultTheme || ""] || null);
|
|
21
|
+
}, [defaultTheme, themeName]);
|
|
17
22
|
return <Theme name={name}>{props.children}</Theme>;
|
|
18
23
|
}, "ThemeInverse");
|
|
19
24
|
export {
|
|
@@ -20,7 +20,7 @@ const ThemeProvider = /* @__PURE__ */ __name((props) => {
|
|
|
20
20
|
return () => {
|
|
21
21
|
document.body.classList.remove(cn);
|
|
22
22
|
};
|
|
23
|
-
}, []);
|
|
23
|
+
}, [props.disableRootThemeClass]);
|
|
24
24
|
}
|
|
25
25
|
const themeContext = useMemo(() => {
|
|
26
26
|
return {
|
|
@@ -28,7 +28,7 @@ const ThemeProvider = /* @__PURE__ */ __name((props) => {
|
|
|
28
28
|
defaultTheme: props.defaultTheme
|
|
29
29
|
};
|
|
30
30
|
}, [props.themes]);
|
|
31
|
-
return <ThemeContext.Provider value={themeContext}><Theme name={props.defaultTheme} disableThemeClass={props.disableRootThemeClass}>{props.children}</Theme></ThemeContext.Provider>;
|
|
31
|
+
return <ThemeContext.Provider value={themeContext}><Theme className={props.className} name={props.defaultTheme} disableThemeClass={props.disableRootThemeClass}>{props.children}</Theme></ThemeContext.Provider>;
|
|
32
32
|
}, "ThemeProvider");
|
|
33
33
|
export {
|
|
34
34
|
ThemeProvider
|