@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
|
@@ -23,7 +23,8 @@ __export(insertStyleRule_exports, {
|
|
|
23
23
|
getInsertedRules: () => getInsertedRules,
|
|
24
24
|
insertStyleRule: () => insertStyleRule,
|
|
25
25
|
insertedTransforms: () => insertedTransforms,
|
|
26
|
-
updateInserted: () => updateInserted
|
|
26
|
+
updateInserted: () => updateInserted,
|
|
27
|
+
updateInsertedCache: () => updateInsertedCache
|
|
27
28
|
});
|
|
28
29
|
module.exports = __toCommonJS(insertStyleRule_exports);
|
|
29
30
|
const allSelectors = {};
|
|
@@ -32,25 +33,30 @@ const insertedTransforms = {};
|
|
|
32
33
|
const getAllSelectors = /* @__PURE__ */ __name(() => allSelectors, "getAllSelectors");
|
|
33
34
|
const getInsertedRules = /* @__PURE__ */ __name(() => Object.values(insertedSelectors), "getInsertedRules");
|
|
34
35
|
const getAllTransforms = /* @__PURE__ */ __name(() => insertedTransforms, "getAllTransforms");
|
|
35
|
-
function addTransform(identifier, rule) {
|
|
36
|
-
const s =
|
|
36
|
+
function addTransform(identifier, css, rule) {
|
|
37
|
+
const s = css.indexOf("transform:");
|
|
37
38
|
if (s === -1) {
|
|
38
|
-
|
|
39
|
+
if (process.env.NODE_ENV === "development") {
|
|
40
|
+
console.groupCollapsed(`\u274C Invalid transform, likely used deg/% improperly ${identifier}`);
|
|
41
|
+
console.log("rule:", rule);
|
|
42
|
+
console.trace();
|
|
43
|
+
console.groupEnd();
|
|
44
|
+
} else {
|
|
45
|
+
console.error(`Missing transform`, identifier, css, rule);
|
|
46
|
+
}
|
|
39
47
|
return;
|
|
40
48
|
}
|
|
41
49
|
const startI = s + "transform:".length;
|
|
42
|
-
const endI =
|
|
43
|
-
const value =
|
|
44
|
-
console.log("add", identifier, value);
|
|
50
|
+
const endI = css.indexOf(";");
|
|
51
|
+
const value = css.slice(startI, endI);
|
|
45
52
|
insertedTransforms[identifier] = value;
|
|
46
53
|
}
|
|
47
54
|
__name(addTransform, "addTransform");
|
|
48
|
-
let hasInsertedSinceUpdate = true;
|
|
49
55
|
const isClient = typeof document !== "undefined";
|
|
56
|
+
let hasInsertedSinceUpdate = true;
|
|
50
57
|
function updateInserted() {
|
|
51
|
-
if (!isClient)
|
|
58
|
+
if (!isClient)
|
|
52
59
|
return;
|
|
53
|
-
}
|
|
54
60
|
if (!hasInsertedSinceUpdate) {
|
|
55
61
|
console.warn("hasnt inserted since");
|
|
56
62
|
return;
|
|
@@ -72,9 +78,11 @@ function updateInserted() {
|
|
|
72
78
|
if (!(rule instanceof CSSStyleRule))
|
|
73
79
|
continue;
|
|
74
80
|
const identifier = rule.selectorText.slice(1);
|
|
75
|
-
allSelectors[identifier]
|
|
76
|
-
|
|
77
|
-
|
|
81
|
+
if (!allSelectors[identifier]) {
|
|
82
|
+
allSelectors[identifier] = process.env.NODE_ENV === "development" ? rule.cssText : true;
|
|
83
|
+
if (identifier.startsWith("_transform")) {
|
|
84
|
+
addTransform(identifier, rule.cssText, rule);
|
|
85
|
+
}
|
|
78
86
|
}
|
|
79
87
|
}
|
|
80
88
|
}
|
|
@@ -83,26 +91,33 @@ function updateInserted() {
|
|
|
83
91
|
}
|
|
84
92
|
__name(updateInserted, "updateInserted");
|
|
85
93
|
updateInserted();
|
|
86
|
-
const
|
|
87
|
-
function
|
|
88
|
-
if (
|
|
94
|
+
const sheet = isClient ? document.head.appendChild(document.createElement("style")).sheet : null;
|
|
95
|
+
function updateInsertedCache(identifier, rule) {
|
|
96
|
+
if (insertedSelectors[identifier])
|
|
89
97
|
return;
|
|
90
|
-
}
|
|
91
|
-
hasInsertedSinceUpdate = true;
|
|
92
|
-
if (identifier === "_transform-1abwpjw") {
|
|
93
|
-
console.trace("inserting", identifier, rule);
|
|
94
|
-
}
|
|
95
98
|
insertedSelectors[identifier] = rule;
|
|
96
|
-
allSelectors[identifier] = process.env.NODE_ENV === "development" ? rule : true;
|
|
97
99
|
if (identifier.startsWith("_transform")) {
|
|
98
100
|
addTransform(identifier, rule);
|
|
99
101
|
}
|
|
100
|
-
|
|
102
|
+
}
|
|
103
|
+
__name(updateInsertedCache, "updateInsertedCache");
|
|
104
|
+
function insertStyleRule(identifier, rule) {
|
|
105
|
+
if (allSelectors[identifier])
|
|
101
106
|
return;
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
107
|
+
hasInsertedSinceUpdate = true;
|
|
108
|
+
updateInsertedCache(identifier, rule);
|
|
109
|
+
allSelectors[identifier] = process.env.NODE_ENV === "development" ? rule : true;
|
|
110
|
+
sheet == null ? void 0 : sheet.insertRule(rule, sheet.cssRules.length);
|
|
106
111
|
}
|
|
107
112
|
__name(insertStyleRule, "insertStyleRule");
|
|
113
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
114
|
+
0 && (module.exports = {
|
|
115
|
+
getAllSelectors,
|
|
116
|
+
getAllTransforms,
|
|
117
|
+
getInsertedRules,
|
|
118
|
+
insertStyleRule,
|
|
119
|
+
insertedTransforms,
|
|
120
|
+
updateInserted,
|
|
121
|
+
updateInsertedCache
|
|
122
|
+
});
|
|
108
123
|
//# sourceMappingURL=insertStyleRule.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/helpers/insertStyleRule.tsx"],
|
|
4
|
-
"sourcesContent": ["// this needs to check if its inserted already? 99% of the time it is\n// this should avoid re-inserts, but need to test the perf trade-offs\n// i tested with the site itself and the initial insert was trivial\n\nconst allSelectors = {}\nconst insertedSelectors = {}\nexport const insertedTransforms = {}\n\nexport const getAllSelectors = () => allSelectors\nexport const getInsertedRules = () => Object.values(insertedSelectors)\nexport const getAllTransforms = () => insertedTransforms\n\n// keep transforms in map for merging later\nfunction addTransform(identifier: string,
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAIA,MAAM,eAAe,CAAC;AACtB,MAAM,oBAAoB,CAAC;AACpB,MAAM,qBAAqB,CAAC;AAE5B,MAAM,kBAAkB,6BAAM,cAAN;AACxB,MAAM,mBAAmB,6BAAM,OAAO,OAAO,iBAAiB,GAArC;AACzB,MAAM,mBAAmB,6BAAM,oBAAN;AAGhC,sBAAsB,YAAoB,
|
|
4
|
+
"sourcesContent": ["// this needs to check if its inserted already? 99% of the time it is\n// this should avoid re-inserts, but need to test the perf trade-offs\n// i tested with the site itself and the initial insert was trivial\n\nconst allSelectors = {}\nconst insertedSelectors = {}\nexport const insertedTransforms = {}\n\nexport const getAllSelectors = () => allSelectors\nexport const getInsertedRules = () => Object.values(insertedSelectors)\nexport const getAllTransforms = () => insertedTransforms\n\n// keep transforms in map for merging later\nfunction addTransform(identifier: string, css: string, rule?: CSSRule) {\n const s = css.indexOf('transform:')\n if (s === -1) {\n if (process.env.NODE_ENV === 'development') {\n console.groupCollapsed(`\u274C Invalid transform, likely used deg/% improperly ${identifier}`)\n console.log('rule:', rule)\n console.trace()\n console.groupEnd()\n } else {\n console.error(`Missing transform`, identifier, css, rule)\n }\n return\n }\n const startI = s + 'transform:'.length\n const endI = css.indexOf(';')\n const value = css.slice(startI, endI)\n insertedTransforms[identifier] = value\n}\n\nconst isClient = typeof document !== 'undefined'\n\n// gets existing ones (client side)\n// takes ~0.1ms for a fairly large page\n// used now for three things:\n// 1. debugging at dev time\n// 2. avoid duplicate insert styles at runtime\n// 3. used now for merging transforms atomically\nlet hasInsertedSinceUpdate = true\n\nexport function updateInserted() {\n if (!isClient) return\n if (!hasInsertedSinceUpdate) {\n console.warn('hasnt inserted since')\n return\n }\n const sheets = document.styleSheets\n if (!sheets) return\n for (let i = 0; i < sheets.length; i++) {\n const rules = sheets[i].cssRules\n const firstRule = rules[0]\n if (!(firstRule instanceof CSSStyleRule)) continue\n const firstSelector = firstRule.selectorText\n if (!firstSelector) continue\n if (firstSelector === ':root' || firstSelector.startsWith('._')) {\n for (let i = 0; i < rules.length; i++) {\n const rule = rules.item(i)\n if (!(rule instanceof CSSStyleRule)) continue\n const identifier = rule.selectorText.slice(1)\n if (!allSelectors[identifier]) {\n allSelectors[identifier] = process.env.NODE_ENV === 'development' ? rule.cssText : true\n if (identifier.startsWith('_transform')) {\n addTransform(identifier, rule.cssText, rule)\n }\n }\n }\n }\n }\n hasInsertedSinceUpdate = false\n}\n\nupdateInserted()\n\nconst sheet = isClient ? document.head.appendChild(document.createElement('style')).sheet : null\n\nexport function updateInsertedCache(identifier: string, rule: string) {\n if (insertedSelectors[identifier]) return\n insertedSelectors[identifier] = rule\n if (identifier.startsWith('_transform')) {\n addTransform(identifier, rule)\n }\n}\n\nexport function insertStyleRule(identifier: string, rule: string) {\n if (allSelectors[identifier]) return\n hasInsertedSinceUpdate = true\n updateInsertedCache(identifier, rule)\n allSelectors[identifier] = process.env.NODE_ENV === 'development' ? rule : true\n sheet?.insertRule(rule, sheet.cssRules.length)\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAIA,MAAM,eAAe,CAAC;AACtB,MAAM,oBAAoB,CAAC;AACpB,MAAM,qBAAqB,CAAC;AAE5B,MAAM,kBAAkB,6BAAM,cAAN;AACxB,MAAM,mBAAmB,6BAAM,OAAO,OAAO,iBAAiB,GAArC;AACzB,MAAM,mBAAmB,6BAAM,oBAAN;AAGhC,sBAAsB,YAAoB,KAAa,MAAgB;AACrE,QAAM,IAAI,IAAI,QAAQ,YAAY;AAClC,MAAI,MAAM,IAAI;AACZ,QAAI,QAAQ,IAAI,aAAa,eAAe;AAC1C,cAAQ,eAAe,0DAAqD,YAAY;AACxF,cAAQ,IAAI,SAAS,IAAI;AACzB,cAAQ,MAAM;AACd,cAAQ,SAAS;AAAA,IACnB,OAAO;AACL,cAAQ,MAAM,qBAAqB,YAAY,KAAK,IAAI;AAAA,IAC1D;AACA;AAAA,EACF;AACA,QAAM,SAAS,IAAI,aAAa;AAChC,QAAM,OAAO,IAAI,QAAQ,GAAG;AAC5B,QAAM,QAAQ,IAAI,MAAM,QAAQ,IAAI;AACpC,qBAAmB,cAAc;AACnC;AAjBS;AAmBT,MAAM,WAAW,OAAO,aAAa;AAQrC,IAAI,yBAAyB;AAEtB,0BAA0B;AAC/B,MAAI,CAAC;AAAU;AACf,MAAI,CAAC,wBAAwB;AAC3B,YAAQ,KAAK,sBAAsB;AACnC;AAAA,EACF;AACA,QAAM,SAAS,SAAS;AACxB,MAAI,CAAC;AAAQ;AACb,WAAS,IAAI,GAAG,IAAI,OAAO,QAAQ,KAAK;AACtC,UAAM,QAAQ,OAAO,GAAG;AACxB,UAAM,YAAY,MAAM;AACxB,QAAI,CAAE,sBAAqB;AAAe;AAC1C,UAAM,gBAAgB,UAAU;AAChC,QAAI,CAAC;AAAe;AACpB,QAAI,kBAAkB,WAAW,cAAc,WAAW,IAAI,GAAG;AAC/D,eAAS,KAAI,GAAG,KAAI,MAAM,QAAQ,MAAK;AACrC,cAAM,OAAO,MAAM,KAAK,EAAC;AACzB,YAAI,CAAE,iBAAgB;AAAe;AACrC,cAAM,aAAa,KAAK,aAAa,MAAM,CAAC;AAC5C,YAAI,CAAC,aAAa,aAAa;AAC7B,uBAAa,cAAc,QAAQ,IAAI,aAAa,gBAAgB,KAAK,UAAU;AACnF,cAAI,WAAW,WAAW,YAAY,GAAG;AACvC,yBAAa,YAAY,KAAK,SAAS,IAAI;AAAA,UAC7C;AAAA,QACF;AAAA,MACF;AAAA,IACF;AAAA,EACF;AACA,2BAAyB;AAC3B;AA7BgB;AA+BhB,eAAe;AAEf,MAAM,QAAQ,WAAW,SAAS,KAAK,YAAY,SAAS,cAAc,OAAO,CAAC,EAAE,QAAQ;AAErF,6BAA6B,YAAoB,MAAc;AACpE,MAAI,kBAAkB;AAAa;AACnC,oBAAkB,cAAc;AAChC,MAAI,WAAW,WAAW,YAAY,GAAG;AACvC,iBAAa,YAAY,IAAI;AAAA,EAC/B;AACF;AANgB;AAQT,yBAAyB,YAAoB,MAAc;AAChE,MAAI,aAAa;AAAa;AAC9B,2BAAyB;AACzB,sBAAoB,YAAY,IAAI;AACpC,eAAa,cAAc,QAAQ,IAAI,aAAa,gBAAgB,OAAO;AAC3E,iCAAO,WAAW,MAAM,MAAM,SAAS;AACzC;AANgB;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -22,4 +22,8 @@ __export(isObj_exports, {
|
|
|
22
22
|
});
|
|
23
23
|
module.exports = __toCommonJS(isObj_exports);
|
|
24
24
|
const isObj = /* @__PURE__ */ __name((x) => x && !Array.isArray(x) && typeof x === "object", "isObj");
|
|
25
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
26
|
+
0 && (module.exports = {
|
|
27
|
+
isObj
|
|
28
|
+
});
|
|
25
29
|
//# sourceMappingURL=isObj.js.map
|
|
@@ -26,4 +26,8 @@ const isTamaguiElement = /* @__PURE__ */ __name((child) => {
|
|
|
26
26
|
var _a;
|
|
27
27
|
return (0, import_react.isValidElement)(child) && !!((_a = child.type["staticConfig"]) == null ? void 0 : _a.parsed);
|
|
28
28
|
}, "isTamaguiElement");
|
|
29
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
30
|
+
0 && (module.exports = {
|
|
31
|
+
isTamaguiElement
|
|
32
|
+
});
|
|
29
33
|
//# sourceMappingURL=isTamaguiElement.js.map
|
|
@@ -33,4 +33,8 @@ const matchMedia = typeof window !== "undefined" && window.matchMedia || /* @__P
|
|
|
33
33
|
matches: false
|
|
34
34
|
};
|
|
35
35
|
}, "matchMediaFallback");
|
|
36
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
37
|
+
0 && (module.exports = {
|
|
38
|
+
matchMedia
|
|
39
|
+
});
|
|
36
40
|
//# sourceMappingURL=matchMedia.js.map
|
|
@@ -27,4 +27,8 @@ module.exports = __toCommonJS(matchMedia_native_exports);
|
|
|
27
27
|
var import_MediaQueryList = __toESM(require("@expo/match-media/build/MediaQueryList.js"));
|
|
28
28
|
const matchMedia = /* @__PURE__ */ __name((media) => new import_MediaQueryList.default(media), "matchMedia");
|
|
29
29
|
globalThis["matchMedia"] = matchMedia;
|
|
30
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
31
|
+
0 && (module.exports = {
|
|
32
|
+
matchMedia
|
|
33
|
+
});
|
|
30
34
|
//# sourceMappingURL=matchMedia.native.js.map
|
|
@@ -2,6 +2,7 @@ var __defProp = Object.defineProperty;
|
|
|
2
2
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
3
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
4
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
5
6
|
var __export = (target, all) => {
|
|
6
7
|
for (var name in all)
|
|
7
8
|
__defProp(target, name, { get: all[name], enumerable: true });
|
|
@@ -15,23 +16,14 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
15
16
|
return to;
|
|
16
17
|
};
|
|
17
18
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
-
var
|
|
19
|
-
__export(
|
|
20
|
-
|
|
19
|
+
var nativeGestureHandler_exports = {};
|
|
20
|
+
__export(nativeGestureHandler_exports, {
|
|
21
|
+
BaseButton: () => BaseButton
|
|
21
22
|
});
|
|
22
|
-
module.exports = __toCommonJS(
|
|
23
|
-
const
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
name: "active",
|
|
30
|
-
priority: 2
|
|
31
|
-
},
|
|
32
|
-
hoverStyle: {
|
|
33
|
-
name: "hover",
|
|
34
|
-
priority: 1
|
|
35
|
-
}
|
|
36
|
-
};
|
|
37
|
-
//# sourceMappingURL=pseudos.js.map
|
|
23
|
+
module.exports = __toCommonJS(nativeGestureHandler_exports);
|
|
24
|
+
const BaseButton = /* @__PURE__ */ __name((props) => props.children, "BaseButton");
|
|
25
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
26
|
+
0 && (module.exports = {
|
|
27
|
+
BaseButton
|
|
28
|
+
});
|
|
29
|
+
//# sourceMappingURL=nativeGestureHandler.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/helpers/nativeGestureHandler.ts"],
|
|
4
|
+
"sourcesContent": ["export const BaseButton = (props: any) => props.children\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAO,MAAM,aAAa,wBAAC,UAAe,MAAM,UAAtB;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __copyProps = (to, from, except, desc) => {
|
|
6
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
7
|
+
for (let key of __getOwnPropNames(from))
|
|
8
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
9
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
10
|
+
}
|
|
11
|
+
return to;
|
|
12
|
+
};
|
|
13
|
+
var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
|
|
14
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
15
|
+
var nativeGestureHandler_native_exports = {};
|
|
16
|
+
module.exports = __toCommonJS(nativeGestureHandler_native_exports);
|
|
17
|
+
__reExport(nativeGestureHandler_native_exports, require("react-native-gesture-handler"), module.exports);
|
|
18
|
+
//# sourceMappingURL=nativeGestureHandler.native.js.map
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var proxyThemeVariables_exports = {};
|
|
20
|
+
__export(proxyThemeVariables_exports, {
|
|
21
|
+
proxyThemeVariables: () => proxyThemeVariables
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(proxyThemeVariables_exports);
|
|
24
|
+
function proxyThemeVariables(obj) {
|
|
25
|
+
return new Proxy(obj, {
|
|
26
|
+
has(target, key) {
|
|
27
|
+
return Reflect.has(target, removeStarting$(key));
|
|
28
|
+
},
|
|
29
|
+
get(target, key) {
|
|
30
|
+
return Reflect.get(target, removeStarting$(key));
|
|
31
|
+
}
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
__name(proxyThemeVariables, "proxyThemeVariables");
|
|
35
|
+
const removeStarting$ = /* @__PURE__ */ __name((str) => typeof str === "string" && str[0] === "$" ? str.slice(1) : str, "removeStarting$");
|
|
36
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
37
|
+
0 && (module.exports = {
|
|
38
|
+
proxyThemeVariables
|
|
39
|
+
});
|
|
40
|
+
//# sourceMappingURL=proxyThemeVariables.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/helpers/proxyThemeVariables.tsx"],
|
|
4
|
+
"sourcesContent": ["export function proxyThemeVariables<A extends Object>(obj: A): A {\n return new Proxy<A>(obj, {\n has(target, key) {\n return Reflect.has(target, removeStarting$(key))\n },\n get(target, key) {\n return Reflect.get(target, removeStarting$(key))\n },\n })\n}\n\nconst removeStarting$ = (str: string | symbol) =>\n typeof str === 'string' && str[0] === '$' ? str.slice(1) : str\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAO,6BAA+C,KAAW;AAC/D,SAAO,IAAI,MAAS,KAAK;AAAA,IACvB,IAAI,QAAQ,KAAK;AACf,aAAO,QAAQ,IAAI,QAAQ,gBAAgB,GAAG,CAAC;AAAA,IACjD;AAAA,IACA,IAAI,QAAQ,KAAK;AACf,aAAO,QAAQ,IAAI,QAAQ,gBAAgB,GAAG,CAAC;AAAA,IACjD;AAAA,EACF,CAAC;AACH;AATgB;AAWhB,MAAM,kBAAkB,wBAAC,QACvB,OAAO,QAAQ,YAAY,IAAI,OAAO,MAAM,IAAI,MAAM,CAAC,IAAI,KADrC;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -56,15 +56,16 @@ module.exports = __toCommonJS(themeable_exports);
|
|
|
56
56
|
var import_react = __toESM(require("react"));
|
|
57
57
|
var import_Theme = require("../views/Theme");
|
|
58
58
|
var import_ThemeInverse = require("../views/ThemeInverse");
|
|
59
|
-
function themeable(component) {
|
|
59
|
+
function themeable(component, opts) {
|
|
60
60
|
const withThemeComponent = (0, import_react.forwardRef)(/* @__PURE__ */ __name(function WithTheme(_a, ref) {
|
|
61
61
|
var _b = _a, { themeInverse, theme } = _b, rest = __objRest(_b, ["themeInverse", "theme"]);
|
|
62
62
|
const element = import_react.default.createElement(component, __spreadProps(__spreadValues({}, rest), { ref }));
|
|
63
63
|
if (themeInverse) {
|
|
64
64
|
return /* @__PURE__ */ import_react.default.createElement(import_ThemeInverse.ThemeInverse, null, element);
|
|
65
65
|
}
|
|
66
|
-
if (theme) {
|
|
66
|
+
if (theme || opts) {
|
|
67
67
|
return /* @__PURE__ */ import_react.default.createElement(import_Theme.Theme, {
|
|
68
|
+
componentName: opts == null ? void 0 : opts.componentName,
|
|
68
69
|
name: theme || null
|
|
69
70
|
}, element);
|
|
70
71
|
}
|
|
@@ -75,4 +76,8 @@ function themeable(component) {
|
|
|
75
76
|
return withTheme;
|
|
76
77
|
}
|
|
77
78
|
__name(themeable, "themeable");
|
|
79
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
80
|
+
0 && (module.exports = {
|
|
81
|
+
themeable
|
|
82
|
+
});
|
|
78
83
|
//# sourceMappingURL=themeable.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/helpers/themeable.tsx"],
|
|
4
|
-
"sourcesContent": ["import React, { forwardRef } from 'react'\n\nimport { ThemeName } from '../types'\nimport { Theme } from '../views/Theme'\nimport { ThemeInverse } from '../views/ThemeInverse'\n\nexport type ThemeableProps = {\n theme?: ThemeName | string | null\n themeInverse?: boolean\n}\n\nexport function themeable<Component extends (props: any) => any>(component: Component) {\n const withThemeComponent = forwardRef(function WithTheme(\n { themeInverse, theme, ...rest }: any,\n ref\n ) {\n const element = React.createElement(component, { ...rest, ref } as any)\n if (themeInverse) {\n return <ThemeInverse>{element}</ThemeInverse>\n }\n if (theme) {\n return <Theme name={(theme as any) || null}
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAAkC;AAGlC,mBAAsB;AACtB,0BAA6B;AAOtB,
|
|
4
|
+
"sourcesContent": ["import React, { forwardRef } from 'react'\n\nimport { ThemeName } from '../types'\nimport { Theme } from '../views/Theme'\nimport { ThemeInverse } from '../views/ThemeInverse'\n\nexport type ThemeableProps = {\n theme?: ThemeName | string | null\n themeInverse?: boolean\n}\n\nexport function themeable<Component extends (props: any) => any>(\n component: Component,\n opts?: { componentName?: string }\n) {\n const withThemeComponent = forwardRef(function WithTheme(\n { themeInverse, theme, ...rest }: any,\n ref\n ) {\n const element = React.createElement(component, { ...rest, ref } as any)\n if (themeInverse) {\n return <ThemeInverse>{element}</ThemeInverse>\n }\n if (theme || opts) {\n return (\n <Theme componentName={opts?.componentName} name={(theme as any) || null}>\n {element}\n </Theme>\n )\n }\n return element\n })\n\n const withTheme: any = withThemeComponent\n withTheme.displayName = `Themed(${\n (component as any)?.displayName || (component as any)?.name || 'Anonymous'\n })`\n\n return withTheme as Component extends (props: infer P) => infer R\n ? (\n props: Omit<P, 'theme' | 'themeInverse'> & {\n theme?: ThemeName | null\n themeInverse?: boolean\n }\n ) => R\n : unknown\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAAkC;AAGlC,mBAAsB;AACtB,0BAA6B;AAOtB,mBACL,WACA,MACA;AACA,QAAM,qBAAqB,6BAAW,0CACpC,IACA,KACA;AAFA,iBAAE,gBAAc,UAAhB,IAA0B,iBAA1B,IAA0B,CAAxB,gBAAc;AAGhB,UAAM,UAAU,qBAAM,cAAc,WAAW,iCAAK,OAAL,EAAW,IAAI,EAAQ;AACtE,QAAI,cAAc;AAChB,aAAO,mDAAC,wCAAc,OAAQ;AAAA,IAChC;AACA,QAAI,SAAS,MAAM;AACjB,aACE,mDAAC;AAAA,QAAM,eAAe,6BAAM;AAAA,QAAe,MAAO,SAAiB;AAAA,SAChE,OACH;AAAA,IAEJ;AACA,WAAO;AAAA,EACT,GAhBsC,YAgBrC;AAED,QAAM,YAAiB;AACvB,YAAU,cAAc,UACrB,wCAAmB,gBAAgB,wCAAmB,SAAQ;AAGjE,SAAO;AAQT;AAnCgB;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,8 +1,34 @@
|
|
|
1
1
|
var __defProp = Object.defineProperty;
|
|
2
2
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
3
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
4
5
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
7
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
8
|
+
var __spreadValues = (a, b) => {
|
|
9
|
+
for (var prop in b || (b = {}))
|
|
10
|
+
if (__hasOwnProp.call(b, prop))
|
|
11
|
+
__defNormalProp(a, prop, b[prop]);
|
|
12
|
+
if (__getOwnPropSymbols)
|
|
13
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
|
14
|
+
if (__propIsEnum.call(b, prop))
|
|
15
|
+
__defNormalProp(a, prop, b[prop]);
|
|
16
|
+
}
|
|
17
|
+
return a;
|
|
18
|
+
};
|
|
5
19
|
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
20
|
+
var __objRest = (source, exclude) => {
|
|
21
|
+
var target = {};
|
|
22
|
+
for (var prop in source)
|
|
23
|
+
if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
24
|
+
target[prop] = source[prop];
|
|
25
|
+
if (source != null && __getOwnPropSymbols)
|
|
26
|
+
for (var prop of __getOwnPropSymbols(source)) {
|
|
27
|
+
if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
|
|
28
|
+
target[prop] = source[prop];
|
|
29
|
+
}
|
|
30
|
+
return target;
|
|
31
|
+
};
|
|
6
32
|
var __export = (target, all) => {
|
|
7
33
|
for (var name in all)
|
|
8
34
|
__defProp(target, name, { get: all[name], enumerable: true });
|
|
@@ -26,7 +52,8 @@ module.exports = __toCommonJS(validate_exports);
|
|
|
26
52
|
const { default: ow } = require("@tamagui/ow/dev-only");
|
|
27
53
|
let Config;
|
|
28
54
|
let Tokens;
|
|
29
|
-
let
|
|
55
|
+
let FontRequired;
|
|
56
|
+
let FontOptional;
|
|
30
57
|
const validateConfig = /* @__PURE__ */ __name((conf) => {
|
|
31
58
|
if (!conf) {
|
|
32
59
|
console.warn("no conf?");
|
|
@@ -47,12 +74,26 @@ const validateTokens = /* @__PURE__ */ __name((tokens) => {
|
|
|
47
74
|
}, "validateTokens");
|
|
48
75
|
const validateFont = /* @__PURE__ */ __name((font) => {
|
|
49
76
|
try {
|
|
50
|
-
|
|
77
|
+
const _a = font, { style, transform, color } = _a, required = __objRest(_a, ["style", "transform", "color"]);
|
|
78
|
+
ow(required, FontRequired);
|
|
79
|
+
ow({ style, transform, color }, FontOptional);
|
|
51
80
|
} catch (err) {
|
|
52
81
|
console.warn("Given font:\n", JSON.stringify(font, null, 2), err);
|
|
53
82
|
}
|
|
54
83
|
}, "validateFont");
|
|
55
84
|
if (process.env.NODE_ENV === "development") {
|
|
85
|
+
const fontReq = {
|
|
86
|
+
family: ow.string,
|
|
87
|
+
size: ow.object.nonEmpty.valuesOfType(ow.number),
|
|
88
|
+
lineHeight: ow.object.nonEmpty.valuesOfType(ow.number),
|
|
89
|
+
weight: ow.object.nonEmpty.valuesOfType(ow.string),
|
|
90
|
+
letterSpacing: ow.object.nonEmpty.valuesOfType(ow.number)
|
|
91
|
+
};
|
|
92
|
+
const fontOpt = {
|
|
93
|
+
style: ow.optional.object.valuesOfType(ow.string),
|
|
94
|
+
transform: ow.optional.object.valuesOfType(ow.string),
|
|
95
|
+
color: ow.optional.object.valuesOfType(ow.string)
|
|
96
|
+
};
|
|
56
97
|
Config = ow.object.exactShape({
|
|
57
98
|
defaultTheme: ow.optional.string,
|
|
58
99
|
disableRootThemeClass: ow.optional.boolean,
|
|
@@ -60,17 +101,12 @@ if (process.env.NODE_ENV === "development") {
|
|
|
60
101
|
themes: ow.object.valuesOfType(ow.object),
|
|
61
102
|
tokens: ow.object.valuesOfType(ow.object),
|
|
62
103
|
media: ow.object.valuesOfType(ow.object),
|
|
63
|
-
animations: ow.object.valuesOfType(ow.object)
|
|
64
|
-
|
|
65
|
-
Font = ow.object.exactShape({
|
|
66
|
-
family: ow.string,
|
|
67
|
-
size: ow.object.nonEmpty.valuesOfType(ow.number),
|
|
68
|
-
lineHeight: ow.object.nonEmpty.valuesOfType(ow.number),
|
|
69
|
-
weight: ow.object.nonEmpty.valuesOfType(ow.string),
|
|
70
|
-
letterSpacing: ow.object.nonEmpty.valuesOfType(ow.number)
|
|
104
|
+
animations: ow.object.valuesOfType(ow.object),
|
|
105
|
+
fonts: ow.object.valuesOfType(ow.object.partialShape(__spreadValues(__spreadValues({}, fontReq), fontOpt)))
|
|
71
106
|
});
|
|
107
|
+
FontRequired = ow.object.exactShape(fontReq);
|
|
108
|
+
FontOptional = ow.object.partialShape(fontOpt);
|
|
72
109
|
Tokens = ow.object.exactShape({
|
|
73
|
-
font: ow.object.valuesOfType(Font),
|
|
74
110
|
size: ow.object.nonEmpty.valuesOfType(ow.number),
|
|
75
111
|
space: ow.object.nonEmpty.valuesOfType(ow.number),
|
|
76
112
|
zIndex: ow.object.nonEmpty.valuesOfType(ow.number),
|
|
@@ -78,4 +114,10 @@ if (process.env.NODE_ENV === "development") {
|
|
|
78
114
|
color: ow.object.nonEmpty.valuesOfType(ow.string)
|
|
79
115
|
});
|
|
80
116
|
}
|
|
117
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
118
|
+
0 && (module.exports = {
|
|
119
|
+
validateConfig,
|
|
120
|
+
validateFont,
|
|
121
|
+
validateTokens
|
|
122
|
+
});
|
|
81
123
|
//# sourceMappingURL=validate.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/helpers/validate.ts"],
|
|
4
|
-
"sourcesContent": ["// published a patched version that works on native\n// @ts-ignore\nconst { default: ow } = require('@tamagui/ow/dev-only')\n\nlet Config: any\nlet Tokens: any\nlet
|
|
5
|
-
"mappings": "
|
|
4
|
+
"sourcesContent": ["// published a patched version that works on native\n// @ts-ignore\nconst { default: ow } = require('@tamagui/ow/dev-only')\n\nlet Config: any\nlet Tokens: any\nlet FontRequired: any\nlet FontOptional: any\n\nexport const validateConfig = (conf: any) => {\n if (!conf) {\n console.warn('no conf?')\n return\n }\n try {\n ow(conf, Config)\n } catch (err: any) {\n console.warn('Given config:\\n', JSON.stringify(conf, null, 2), err)\n }\n}\n\nexport const validateTokens = (tokens: any) => {\n try {\n ow(tokens, Tokens)\n } catch (err: any) {\n console.warn('Given tokens:\\n', JSON.stringify(tokens, null, 2), err)\n }\n}\n\nexport const validateFont = (font: any) => {\n try {\n const { style, transform, color, ...required } = font\n ow(required, FontRequired)\n ow({ style, transform, color }, FontOptional)\n } catch (err: any) {\n console.warn('Given font:\\n', JSON.stringify(font, null, 2), err)\n }\n}\n\nif (process.env.NODE_ENV === 'development') {\n const fontReq = {\n family: ow.string,\n size: ow.object.nonEmpty.valuesOfType(ow.number),\n lineHeight: ow.object.nonEmpty.valuesOfType(ow.number),\n weight: ow.object.nonEmpty.valuesOfType(ow.string),\n letterSpacing: ow.object.nonEmpty.valuesOfType(ow.number),\n }\n const fontOpt = {\n style: ow.optional.object.valuesOfType(ow.string),\n transform: ow.optional.object.valuesOfType(ow.string),\n color: ow.optional.object.valuesOfType(ow.string),\n }\n\n Config = ow.object.exactShape({\n defaultTheme: ow.optional.string,\n disableRootThemeClass: ow.optional.boolean,\n shorthands: ow.optional.object.valuesOfType(ow.string),\n themes: ow.object.valuesOfType(ow.object),\n tokens: ow.object.valuesOfType(ow.object),\n media: ow.object.valuesOfType(ow.object),\n animations: ow.object.valuesOfType(ow.object),\n fonts: ow.object.valuesOfType(\n ow.object.partialShape({\n ...fontReq,\n ...fontOpt,\n })\n ),\n })\n\n FontRequired = ow.object.exactShape(fontReq)\n FontOptional = ow.object.partialShape(fontOpt)\n\n Tokens = ow.object.exactShape({\n size: ow.object.nonEmpty.valuesOfType(ow.number),\n space: ow.object.nonEmpty.valuesOfType(ow.number),\n zIndex: ow.object.nonEmpty.valuesOfType(ow.number),\n radius: ow.object.nonEmpty.valuesOfType(ow.number),\n color: ow.object.nonEmpty.valuesOfType(ow.string),\n })\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA,MAAM,EAAE,SAAS,OAAO,QAAQ,sBAAsB;AAEtD,IAAI;AACJ,IAAI;AACJ,IAAI;AACJ,IAAI;AAEG,MAAM,iBAAiB,wBAAC,SAAc;AAC3C,MAAI,CAAC,MAAM;AACT,YAAQ,KAAK,UAAU;AACvB;AAAA,EACF;AACA,MAAI;AACF,OAAG,MAAM,MAAM;AAAA,EACjB,SAAS,KAAP;AACA,YAAQ,KAAK,mBAAmB,KAAK,UAAU,MAAM,MAAM,CAAC,GAAG,GAAG;AAAA,EACpE;AACF,GAV8B;AAYvB,MAAM,iBAAiB,wBAAC,WAAgB;AAC7C,MAAI;AACF,OAAG,QAAQ,MAAM;AAAA,EACnB,SAAS,KAAP;AACA,YAAQ,KAAK,mBAAmB,KAAK,UAAU,QAAQ,MAAM,CAAC,GAAG,GAAG;AAAA,EACtE;AACF,GAN8B;AAQvB,MAAM,eAAe,wBAAC,SAAc;AACzC,MAAI;AACF,UAAiD,WAAzC,SAAO,WAAW,UAAuB,IAAb,qBAAa,IAAb,CAA5B,SAAO,aAAW;AAC1B,OAAG,UAAU,YAAY;AACzB,OAAG,EAAE,OAAO,WAAW,MAAM,GAAG,YAAY;AAAA,EAC9C,SAAS,KAAP;AACA,YAAQ,KAAK,iBAAiB,KAAK,UAAU,MAAM,MAAM,CAAC,GAAG,GAAG;AAAA,EAClE;AACF,GAR4B;AAU5B,IAAI,QAAQ,IAAI,aAAa,eAAe;AAC1C,QAAM,UAAU;AAAA,IACd,QAAQ,GAAG;AAAA,IACX,MAAM,GAAG,OAAO,SAAS,aAAa,GAAG,MAAM;AAAA,IAC/C,YAAY,GAAG,OAAO,SAAS,aAAa,GAAG,MAAM;AAAA,IACrD,QAAQ,GAAG,OAAO,SAAS,aAAa,GAAG,MAAM;AAAA,IACjD,eAAe,GAAG,OAAO,SAAS,aAAa,GAAG,MAAM;AAAA,EAC1D;AACA,QAAM,UAAU;AAAA,IACd,OAAO,GAAG,SAAS,OAAO,aAAa,GAAG,MAAM;AAAA,IAChD,WAAW,GAAG,SAAS,OAAO,aAAa,GAAG,MAAM;AAAA,IACpD,OAAO,GAAG,SAAS,OAAO,aAAa,GAAG,MAAM;AAAA,EAClD;AAEA,WAAS,GAAG,OAAO,WAAW;AAAA,IAC5B,cAAc,GAAG,SAAS;AAAA,IAC1B,uBAAuB,GAAG,SAAS;AAAA,IACnC,YAAY,GAAG,SAAS,OAAO,aAAa,GAAG,MAAM;AAAA,IACrD,QAAQ,GAAG,OAAO,aAAa,GAAG,MAAM;AAAA,IACxC,QAAQ,GAAG,OAAO,aAAa,GAAG,MAAM;AAAA,IACxC,OAAO,GAAG,OAAO,aAAa,GAAG,MAAM;AAAA,IACvC,YAAY,GAAG,OAAO,aAAa,GAAG,MAAM;AAAA,IAC5C,OAAO,GAAG,OAAO,aACf,GAAG,OAAO,aAAa,kCAClB,UACA,QACJ,CACH;AAAA,EACF,CAAC;AAED,iBAAe,GAAG,OAAO,WAAW,OAAO;AAC3C,iBAAe,GAAG,OAAO,aAAa,OAAO;AAE7C,WAAS,GAAG,OAAO,WAAW;AAAA,IAC5B,MAAM,GAAG,OAAO,SAAS,aAAa,GAAG,MAAM;AAAA,IAC/C,OAAO,GAAG,OAAO,SAAS,aAAa,GAAG,MAAM;AAAA,IAChD,QAAQ,GAAG,OAAO,SAAS,aAAa,GAAG,MAAM;AAAA,IACjD,QAAQ,GAAG,OAAO,SAAS,aAAa,GAAG,MAAM;AAAA,IACjD,OAAO,GAAG,OAAO,SAAS,aAAa,GAAG,MAAM;AAAA,EAClD,CAAC;AACH;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -25,4 +25,8 @@ const withStaticProperties = /* @__PURE__ */ __name(function(component, staticPr
|
|
|
25
25
|
Object.assign(component, staticProps);
|
|
26
26
|
return component;
|
|
27
27
|
}, "withStaticProperties");
|
|
28
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
29
|
+
0 && (module.exports = {
|
|
30
|
+
withStaticProperties
|
|
31
|
+
});
|
|
28
32
|
//# sourceMappingURL=withStaticProperties.js.map
|
|
@@ -32,4 +32,8 @@ function wrapThemeManagerContext(children, themeManager) {
|
|
|
32
32
|
}, children) : children;
|
|
33
33
|
}
|
|
34
34
|
__name(wrapThemeManagerContext, "wrapThemeManagerContext");
|
|
35
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
36
|
+
0 && (module.exports = {
|
|
37
|
+
wrapThemeManagerContext
|
|
38
|
+
});
|
|
35
39
|
//# sourceMappingURL=wrapThemeManagerContext.js.map
|
|
@@ -221,4 +221,8 @@ function loadMediaQueryFeature() {
|
|
|
221
221
|
});
|
|
222
222
|
}
|
|
223
223
|
__name(loadMediaQueryFeature, "loadMediaQueryFeature");
|
|
224
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
225
|
+
0 && (module.exports = {
|
|
226
|
+
useFeatures
|
|
227
|
+
});
|
|
224
228
|
//# sourceMappingURL=useFeatures.js.map
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, mod));
|
|
21
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
22
|
+
var useId_exports = {};
|
|
23
|
+
__export(useId_exports, {
|
|
24
|
+
useId: () => useId
|
|
25
|
+
});
|
|
26
|
+
module.exports = __toCommonJS(useId_exports);
|
|
27
|
+
var React = __toESM(require("react"));
|
|
28
|
+
var import_platform = require("../constants/platform");
|
|
29
|
+
let serverHandoffComplete = false;
|
|
30
|
+
let id = 0;
|
|
31
|
+
function genId() {
|
|
32
|
+
return ++id;
|
|
33
|
+
}
|
|
34
|
+
__name(genId, "genId");
|
|
35
|
+
function useId(providedId) {
|
|
36
|
+
if (typeof React.useId === "function") {
|
|
37
|
+
let id3 = React.useId(providedId);
|
|
38
|
+
return providedId != null ? providedId : id3;
|
|
39
|
+
}
|
|
40
|
+
let initialId = providedId ?? (serverHandoffComplete ? genId() : null);
|
|
41
|
+
let [id2, setId] = React.useState(initialId);
|
|
42
|
+
(0, import_platform.useIsomorphicLayoutEffect)(() => {
|
|
43
|
+
if (id2 === null) {
|
|
44
|
+
setId(genId());
|
|
45
|
+
}
|
|
46
|
+
}, []);
|
|
47
|
+
React.useEffect(() => {
|
|
48
|
+
if (serverHandoffComplete === false) {
|
|
49
|
+
serverHandoffComplete = true;
|
|
50
|
+
}
|
|
51
|
+
}, []);
|
|
52
|
+
return providedId ?? id2 ?? void 0;
|
|
53
|
+
}
|
|
54
|
+
__name(useId, "useId");
|
|
55
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
56
|
+
0 && (module.exports = {
|
|
57
|
+
useId
|
|
58
|
+
});
|
|
59
|
+
//# sourceMappingURL=useId.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/hooks/useId.tsx"],
|
|
4
|
+
"sourcesContent": ["/*\n * Welcome to @reach/auto-id!\n\n * Let's see if we can make sense of why this hook exists and its\n * implementation.\n *\n * Some background:\n * 1. Accessibility APIs rely heavily on element IDs\n * 2. Requiring developers to put IDs on every element in Reach UI is both\n * cumbersome and error-prone\n * 3. With a component model, we can generate IDs for them!\n *\n * Solution 1: Generate random IDs.\n *\n * This works great as long as you don't server render your app. When React (in\n * the client) tries to reuse the markup from the server, the IDs won't match\n * and React will then recreate the entire DOM tree.\n *\n * Solution 2: Increment an integer\n *\n * This sounds great. Since we're rendering the exact same tree on the server\n * and client, we can increment a counter and get a deterministic result between\n * client and server. Also, JS integers can go up to nine-quadrillion. I'm\n * pretty sure the tab will be closed before an app never needs\n * 10 quadrillion IDs!\n *\n * Problem solved, right?\n *\n * Ah, but there's a catch! React's concurrent rendering makes this approach\n * non-deterministic. While the client and server will end up with the same\n * elements in the end, depending on suspense boundaries (and possibly some user\n * input during the initial render) the incrementing integers won't always match\n * up.\n *\n * Solution 3: Don't use IDs at all on the server; patch after first render.\n *\n * What we've done here is solution 2 with some tricks. With this approach, the\n * ID returned is an empty string on the first render. This way the server and\n * client have the same markup no matter how wild the concurrent rendering may\n * have gotten.\n *\n * After the render, we patch up the components with an incremented ID. This\n * causes a double render on any components with `useId`. Shouldn't be a problem\n * since the components using this hook should be small, and we're only updating\n * the ID attribute on the DOM, nothing big is happening.\n *\n * It doesn't have to be an incremented number, though--we could do generate\n * random strings instead, but incrementing a number is probably the cheapest\n * thing we can do.\n *\n * Additionally, we only do this patchup on the very first client render ever.\n * Any calls to `useId` that happen dynamically in the client will be\n * populated immediately with a value. So, we only get the double render after\n * server hydration and never again, SO BACK OFF ALRIGHT?\n */\n\nimport * as React from 'react'\n\nimport { useIsomorphicLayoutEffect } from '../constants/platform'\n\nlet serverHandoffComplete = false\nlet id = 0\nfunction genId() {\n return ++id\n}\n\n/* eslint-disable react-hooks/rules-of-hooks */\n\n/**\n * useId\n *\n * Autogenerate IDs to facilitate WAI-ARIA and server rendering.\n *\n * Note: The returned ID will initially be `null` and will update after a\n * component mounts. Users may need to supply their own ID if they need\n * consistent values for SSR.\n *\n * @see Docs https://reach.tech/auto-id\n */\nfunction useId(idFromProps: string): string\nfunction useId(idFromProps: number): number\nfunction useId(idFromProps: string | number): string | number\nfunction useId(idFromProps: string | undefined | null): string | undefined\nfunction useId(idFromProps: number | undefined | null): number | undefined\nfunction useId(idFromProps: string | number | undefined | null): string | number | undefined\nfunction useId(): string | undefined\n\nfunction useId(providedId?: number | string | undefined | null) {\n // TODO: Remove error flag when updating internal deps to React 18. None of\n // our tricks will play well with concurrent rendering anyway.\n // @ts-expect-error\n if (typeof React.useId === 'function') {\n // @ts-expect-error\n let id = React.useId(providedId)\n return providedId != null ? providedId : id\n }\n\n // If this instance isn't part of the initial render, we don't have to do the\n // double render/patch-up dance. We can just generate the ID and return it.\n let initialId = providedId ?? (serverHandoffComplete ? genId() : null)\n let [id, setId] = React.useState(initialId)\n\n useIsomorphicLayoutEffect(() => {\n if (id === null) {\n // Patch the ID after render. We do this in `useLayoutEffect` to avoid any\n // rendering flicker, though it'll make the first render slower (unlikely\n // to matter, but you're welcome to measure your app and let us know if\n // it's a problem).\n setId(genId())\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [])\n\n React.useEffect(() => {\n if (serverHandoffComplete === false) {\n // Flag all future uses of `useId` to skip the update dance. This is in\n // `useEffect` because it goes after `useLayoutEffect`, ensuring we don't\n // accidentally bail out of the patch-up dance prematurely.\n serverHandoffComplete = true\n }\n }, [])\n\n return providedId ?? id ?? undefined\n}\n\nexport { useId }\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAwDA,YAAuB;AAEvB,sBAA0C;AAE1C,IAAI,wBAAwB;AAC5B,IAAI,KAAK;AACT,iBAAiB;AACf,SAAO,EAAE;AACX;AAFS;AAyBT,eAAe,YAAiD;AAI9D,MAAI,OAAO,MAAM,UAAU,YAAY;AAErC,QAAI,MAAK,MAAM,MAAM,UAAU;AAC/B,WAAO,cAAc,OAAO,aAAa;AAAA,EAC3C;AAIA,MAAI,YAAY,cAAe,yBAAwB,MAAM,IAAI;AACjE,MAAI,CAAC,KAAI,SAAS,MAAM,SAAS,SAAS;AAE1C,iDAA0B,MAAM;AAC9B,QAAI,QAAO,MAAM;AAKf,YAAM,MAAM,CAAC;AAAA,IACf;AAAA,EAEF,GAAG,CAAC,CAAC;AAEL,QAAM,UAAU,MAAM;AACpB,QAAI,0BAA0B,OAAO;AAInC,8BAAwB;AAAA,IAC1B;AAAA,EACF,GAAG,CAAC,CAAC;AAEL,SAAO,cAAc,OAAM;AAC7B;AApCS;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|