@tamagui/core 1.0.5 → 1.0.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/helpers/ThemeManager.js +4 -24
- package/dist/cjs/helpers/ThemeManager.js.map +2 -2
- package/dist/esm/helpers/ThemeManager.js +4 -5
- package/dist/esm/helpers/ThemeManager.js.map +2 -2
- package/package.json +10 -10
- package/src/helpers/ThemeManager.tsx +4 -4
- package/types/helpers/ThemeManager.d.ts +1 -1
- package/dist/cjs/Pressability.js +0 -32
- package/dist/cjs/Pressability.js.map +0 -7
- package/dist/cjs/Pressability.native.js +0 -32
- package/dist/cjs/Pressability.native.js.map +0 -7
- package/dist/cjs/ThemeContext.js +0 -30
- package/dist/cjs/ThemeContext.js.map +0 -7
- package/dist/cjs/ThemeManager.js +0 -211
- package/dist/cjs/ThemeManager.js.map +0 -7
- package/dist/cjs/conf.js +0 -70
- package/dist/cjs/conf.js.map +0 -7
- package/dist/cjs/constants/platform.js +0 -59
- package/dist/cjs/constants/platform.js.map +0 -7
- package/dist/cjs/constants/platform.native.js +0 -62
- package/dist/cjs/constants/platform.native.js.map +0 -7
- package/dist/cjs/constants/rnw.native.js +0 -28
- package/dist/cjs/constants/rnw.native.js.map +0 -7
- package/dist/cjs/contexts/ButtonInsideButtonContext.js +0 -30
- package/dist/cjs/contexts/ButtonInsideButtonContext.js.map +0 -7
- package/dist/cjs/contexts/ThemeContext.js +0 -30
- package/dist/cjs/contexts/ThemeContext.js.map +0 -7
- package/dist/cjs/defaultComponentState.js +0 -2
- package/dist/cjs/defaultComponentState.js.map +0 -7
- package/dist/cjs/helpers/Unwrap.js +0 -29
- package/dist/cjs/helpers/Unwrap.js.map +0 -7
- package/dist/cjs/helpers/areEqualSets.js +0 -38
- package/dist/cjs/helpers/areEqualSets.js.map +0 -7
- package/dist/cjs/helpers/assignNativePropsToWeb.js +0 -188
- package/dist/cjs/helpers/assignNativePropsToWeb.js.map +0 -7
- package/dist/cjs/helpers/assignNativePropsToWeb.native.js +0 -30
- package/dist/cjs/helpers/assignNativePropsToWeb.native.js.map +0 -7
- package/dist/cjs/helpers/cache.js +0 -39
- package/dist/cjs/helpers/cache.js.map +0 -7
- package/dist/cjs/helpers/calc.js +0 -71
- package/dist/cjs/helpers/calc.js.map +0 -7
- package/dist/cjs/helpers/createShallowUpdate.js +0 -41
- package/dist/cjs/helpers/createShallowUpdate.js.map +0 -7
- package/dist/cjs/helpers/createTamaguiProvider.js +0 -65
- package/dist/cjs/helpers/createTamaguiProvider.js.map +0 -7
- package/dist/cjs/helpers/cssHash.js +0 -51
- package/dist/cjs/helpers/cssHash.js.map +0 -7
- package/dist/cjs/helpers/expandStyle.test.js +0 -10
- package/dist/cjs/helpers/expandStyle.test.js.map +0 -7
- package/dist/cjs/helpers/getFont.js +0 -62
- package/dist/cjs/helpers/getFont.js.map +0 -7
- package/dist/cjs/helpers/getSize.js +0 -48
- package/dist/cjs/helpers/getSize.js.map +0 -7
- package/dist/cjs/helpers/getStackSize.js +0 -46
- package/dist/cjs/helpers/getStackSize.js.map +0 -7
- package/dist/cjs/helpers/nativeGestureHandler.native.js +0 -19
- package/dist/cjs/helpers/nativeGestureHandler.native.js.map +0 -7
- package/dist/cjs/helpers/startTransition.js +0 -33
- package/dist/cjs/helpers/startTransition.js.map +0 -7
- package/dist/cjs/helpers/validate.js +0 -2
- package/dist/cjs/helpers/validate.js.map +0 -7
- package/dist/cjs/helpers/wrapThemeManagerContext.js +0 -37
- package/dist/cjs/helpers/wrapThemeManagerContext.js.map +0 -7
- package/dist/cjs/hooks/useConstant.js +0 -36
- package/dist/cjs/hooks/useConstant.js.map +0 -7
- package/dist/cjs/hooks/useFeatures.js +0 -201
- package/dist/cjs/hooks/useFeatures.js.map +0 -7
- package/dist/cjs/hooks/useIsMounted.js +0 -40
- package/dist/cjs/hooks/useIsMounted.js.map +0 -7
- package/dist/cjs/hooks/useIsSSR.js +0 -42
- package/dist/cjs/hooks/useIsSSR.js.map +0 -7
- package/dist/cjs/hooks/usePressable.js +0 -36
- package/dist/cjs/hooks/usePressable.js.map +0 -7
- package/dist/cjs/hooks/usePrevious.js +0 -1
- package/dist/cjs/hooks/usePrevious.js.map +0 -7
- package/dist/cjs/hooks/useUnmountEffect.js +0 -32
- package/dist/cjs/hooks/useUnmountEffect.js.map +0 -7
- package/dist/cjs/injectStyles.js +0 -40
- package/dist/cjs/injectStyles.js.map +0 -7
- package/dist/cjs/views/TextAncestorContext.js +0 -44
- package/dist/cjs/views/TextAncestorContext.js.map +0 -7
- package/dist/cjs/views/ThemeInverse.js +0 -55
- package/dist/cjs/views/ThemeInverse.js.map +0 -7
- package/dist/cjs/views/ThemeReset.js +0 -64
- package/dist/cjs/views/ThemeReset.js.map +0 -7
- package/dist/esm/Pressability.js +0 -7
- package/dist/esm/Pressability.js.map +0 -7
- package/dist/esm/Pressability.native.js +0 -7
- package/dist/esm/Pressability.native.js.map +0 -7
- package/dist/esm/ThemeContext.js +0 -6
- package/dist/esm/ThemeContext.js.map +0 -7
- package/dist/esm/ThemeManager.js +0 -185
- package/dist/esm/ThemeManager.js.map +0 -7
- package/dist/esm/conf.js +0 -39
- package/dist/esm/conf.js.map +0 -7
- package/dist/esm/constants/platform.js +0 -26
- package/dist/esm/constants/platform.js.map +0 -7
- package/dist/esm/constants/platform.native.js +0 -28
- package/dist/esm/constants/platform.native.js.map +0 -7
- package/dist/esm/constants/rnw.native.js +0 -5
- package/dist/esm/constants/rnw.native.js.map +0 -7
- package/dist/esm/contexts/ButtonInsideButtonContext.js +0 -6
- package/dist/esm/contexts/ButtonInsideButtonContext.js.map +0 -7
- package/dist/esm/contexts/ThemeContext.js +0 -6
- package/dist/esm/contexts/ThemeContext.js.map +0 -7
- package/dist/esm/defaultComponentState.js +0 -1
- package/dist/esm/defaultComponentState.js.map +0 -7
- package/dist/esm/helpers/Unwrap.js +0 -5
- package/dist/esm/helpers/Unwrap.js.map +0 -7
- package/dist/esm/helpers/areEqualSets.js +0 -14
- package/dist/esm/helpers/areEqualSets.js.map +0 -7
- package/dist/esm/helpers/assignNativePropsToWeb.js +0 -164
- package/dist/esm/helpers/assignNativePropsToWeb.js.map +0 -7
- package/dist/esm/helpers/assignNativePropsToWeb.native.js +0 -6
- package/dist/esm/helpers/assignNativePropsToWeb.native.js.map +0 -7
- package/dist/esm/helpers/cache.js +0 -15
- package/dist/esm/helpers/cache.js.map +0 -7
- package/dist/esm/helpers/calc.js +0 -47
- package/dist/esm/helpers/calc.js.map +0 -7
- package/dist/esm/helpers/createShallowUpdate.js +0 -17
- package/dist/esm/helpers/createShallowUpdate.js.map +0 -7
- package/dist/esm/helpers/createTamaguiProvider.js +0 -38
- package/dist/esm/helpers/createTamaguiProvider.js.map +0 -7
- package/dist/esm/helpers/cssHash.js +0 -27
- package/dist/esm/helpers/cssHash.js.map +0 -7
- package/dist/esm/helpers/expandStyle.test.js +0 -9
- package/dist/esm/helpers/expandStyle.test.js.map +0 -7
- package/dist/esm/helpers/getFont.js +0 -38
- package/dist/esm/helpers/getFont.js.map +0 -7
- package/dist/esm/helpers/getSize.js +0 -23
- package/dist/esm/helpers/getSize.js.map +0 -7
- package/dist/esm/helpers/getStackSize.js +0 -22
- package/dist/esm/helpers/getStackSize.js.map +0 -7
- package/dist/esm/helpers/nativeGestureHandler.native.js +0 -2
- package/dist/esm/helpers/nativeGestureHandler.native.js.map +0 -7
- package/dist/esm/helpers/startTransition.js +0 -6
- package/dist/esm/helpers/startTransition.js.map +0 -7
- package/dist/esm/helpers/validate.js +0 -1
- package/dist/esm/helpers/validate.js.map +0 -7
- package/dist/esm/helpers/wrapThemeManagerContext.js +0 -11
- package/dist/esm/helpers/wrapThemeManagerContext.js.map +0 -7
- package/dist/esm/hooks/useConstant.js +0 -12
- package/dist/esm/hooks/useConstant.js.map +0 -7
- package/dist/esm/hooks/useFeatures.js +0 -174
- package/dist/esm/hooks/useFeatures.js.map +0 -7
- package/dist/esm/hooks/useIsMounted.js +0 -16
- package/dist/esm/hooks/useIsMounted.js.map +0 -7
- package/dist/esm/hooks/useIsSSR.js +0 -18
- package/dist/esm/hooks/useIsSSR.js.map +0 -7
- package/dist/esm/hooks/usePressable.js +0 -12
- package/dist/esm/hooks/usePressable.js.map +0 -7
- package/dist/esm/hooks/usePrevious.js +0 -1
- package/dist/esm/hooks/usePrevious.js.map +0 -7
- package/dist/esm/hooks/useUnmountEffect.js +0 -8
- package/dist/esm/hooks/useUnmountEffect.js.map +0 -7
- package/dist/esm/injectStyles.js +0 -16
- package/dist/esm/injectStyles.js.map +0 -7
- package/dist/esm/views/TextAncestorContext.js +0 -15
- package/dist/esm/views/TextAncestorContext.js.map +0 -7
- package/dist/esm/views/ThemeInverse.js +0 -27
- package/dist/esm/views/ThemeInverse.js.map +0 -7
- package/dist/esm/views/ThemeReset.js +0 -37
- package/dist/esm/views/ThemeReset.js.map +0 -7
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
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 getFont_exports = {};
|
|
20
|
-
__export(getFont_exports, {
|
|
21
|
-
getFont: () => getFont
|
|
22
|
-
});
|
|
23
|
-
module.exports = __toCommonJS(getFont_exports);
|
|
24
|
-
var import_createVariable = require("../createVariable");
|
|
25
|
-
const getFont = (val = "$4", { fonts, theme, props }) => {
|
|
26
|
-
var _a, _b, _c;
|
|
27
|
-
const family = (0, import_createVariable.getVariableValue)(props.fontFamily) || "$body";
|
|
28
|
-
const font = fonts[family] || fonts["$body"];
|
|
29
|
-
if (!font) {
|
|
30
|
-
console.warn("\u26A0\uFE0F no font found", { family, fontTokens: Object.keys(fonts), val });
|
|
31
|
-
return {};
|
|
32
|
-
}
|
|
33
|
-
const fontFamily = font.family;
|
|
34
|
-
const fontSize = props.fontSize || font.size[val];
|
|
35
|
-
const lineHeight = props.lineHeight || font.lineHeight[val];
|
|
36
|
-
const fontWeight = props.fontWeight || font.weight[val];
|
|
37
|
-
const letterSpacing = props.letterSpacing || font.letterSpacing[val];
|
|
38
|
-
const fontStyle = props.fontStyle || ((_a = font.style) == null ? void 0 : _a[val]);
|
|
39
|
-
const textTransform = props.textTransform || ((_b = font.transform) == null ? void 0 : _b[val]);
|
|
40
|
-
const color = props.color || ((_c = font.color) == null ? void 0 : _c[val]) || theme.color;
|
|
41
|
-
const style = {
|
|
42
|
-
color,
|
|
43
|
-
fontStyle,
|
|
44
|
-
textTransform,
|
|
45
|
-
fontFamily,
|
|
46
|
-
fontWeight,
|
|
47
|
-
letterSpacing,
|
|
48
|
-
fontSize,
|
|
49
|
-
lineHeight
|
|
50
|
-
};
|
|
51
|
-
if (process.env.NODE_ENV === "development") {
|
|
52
|
-
if (props["debug"]) {
|
|
53
|
-
console.log("getFont", val, style, "from props", props);
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
return style;
|
|
57
|
-
};
|
|
58
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
59
|
-
0 && (module.exports = {
|
|
60
|
-
getFont
|
|
61
|
-
});
|
|
62
|
-
//# sourceMappingURL=getFont.js.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../src/helpers/getFont.tsx"],
|
|
4
|
-
"sourcesContent": ["import { getVariableValue } from '../createVariable'\nimport { FontSizeTokens, TextProps, VariantSpreadFunction } from '../types'\n\nexport const getFont: VariantSpreadFunction<TextProps, FontSizeTokens> = (\n val = '$4',\n { fonts, theme, props }\n) => {\n const family = getVariableValue(props.fontFamily) || '$body'\n const font = fonts[family] || fonts['$body']\n if (!font) {\n console.warn('\u26A0\uFE0F no font found', { family, fontTokens: Object.keys(fonts), val })\n return {} as any\n }\n const fontFamily = font.family\n const fontSize = props.fontSize || font.size[val]\n const lineHeight = props.lineHeight || font.lineHeight[val]\n const fontWeight = props.fontWeight || font.weight[val]\n const letterSpacing = props.letterSpacing || font.letterSpacing[val]\n const fontStyle = props.fontStyle || font.style?.[val]\n const textTransform = props.textTransform || font.transform?.[val]\n const color = props.color || font.color?.[val] || theme.color\n const style = {\n color,\n fontStyle,\n textTransform,\n fontFamily,\n fontWeight,\n letterSpacing,\n fontSize,\n lineHeight,\n }\n if (process.env.NODE_ENV === 'development') {\n if (props['debug']) {\n console.log('getFont', val, style, 'from props', props)\n }\n }\n return style\n}\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,4BAAiC;AAG1B,MAAM,UAA4D,CACvE,MAAM,MACN,EAAE,OAAO,OAAO,YACb;AANL;AAOE,QAAM,SAAS,4CAAiB,MAAM,UAAU,KAAK;AACrD,QAAM,OAAO,MAAM,WAAW,MAAM;AACpC,MAAI,CAAC,MAAM;AACT,YAAQ,KAAK,8BAAoB,EAAE,QAAQ,YAAY,OAAO,KAAK,KAAK,GAAG,IAAI,CAAC;AAChF,WAAO,CAAC;AAAA,EACV;AACA,QAAM,aAAa,KAAK;AACxB,QAAM,WAAW,MAAM,YAAY,KAAK,KAAK;AAC7C,QAAM,aAAa,MAAM,cAAc,KAAK,WAAW;AACvD,QAAM,aAAa,MAAM,cAAc,KAAK,OAAO;AACnD,QAAM,gBAAgB,MAAM,iBAAiB,KAAK,cAAc;AAChE,QAAM,YAAY,MAAM,aAAa,YAAK,UAAL,mBAAa;AAClD,QAAM,gBAAgB,MAAM,iBAAiB,YAAK,cAAL,mBAAiB;AAC9D,QAAM,QAAQ,MAAM,SAAS,YAAK,UAAL,mBAAa,SAAQ,MAAM;AACxD,QAAM,QAAQ;AAAA,IACZ;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF;AACA,MAAI,QAAQ,IAAI,aAAa,eAAe;AAC1C,QAAI,MAAM,UAAU;AAClB,cAAQ,IAAI,WAAW,KAAK,OAAO,cAAc,KAAK;AAAA,IACxD;AAAA,EACF;AACA,SAAO;AACT;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
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 getSize_exports = {};
|
|
20
|
-
__export(getSize_exports, {
|
|
21
|
-
getSize: () => getSize,
|
|
22
|
-
stepTokenUpOrDown: () => stepTokenUpOrDown
|
|
23
|
-
});
|
|
24
|
-
module.exports = __toCommonJS(getSize_exports);
|
|
25
|
-
var import_config = require("../config");
|
|
26
|
-
const getSize = (size, shift = 0, bounds = [0]) => {
|
|
27
|
-
return stepTokenUpOrDown((0, import_config.getTokens)(true).size, size, shift, bounds);
|
|
28
|
-
};
|
|
29
|
-
const cache = /* @__PURE__ */ new WeakMap();
|
|
30
|
-
const stepTokenUpOrDown = (tokens, current, shift = 0, bounds = [0]) => {
|
|
31
|
-
if (!cache.has(tokens)) {
|
|
32
|
-
cache.set(tokens, Object.keys(tokens));
|
|
33
|
-
}
|
|
34
|
-
const sizeNames = cache.get(tokens);
|
|
35
|
-
const currentKey = current || "$true";
|
|
36
|
-
const min = bounds[0] ?? 0;
|
|
37
|
-
const max = bounds[1] ?? sizeNames.length - 1;
|
|
38
|
-
const currentIndex = sizeNames.indexOf(currentKey);
|
|
39
|
-
const index = Math.min(max, Math.max(min, currentIndex + shift));
|
|
40
|
-
const key = sizeNames[index];
|
|
41
|
-
return tokens[key] || tokens["$true"];
|
|
42
|
-
};
|
|
43
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
44
|
-
0 && (module.exports = {
|
|
45
|
-
getSize,
|
|
46
|
-
stepTokenUpOrDown
|
|
47
|
-
});
|
|
48
|
-
//# sourceMappingURL=getSize.js.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../src/helpers/getSize.ts"],
|
|
4
|
-
"sourcesContent": ["import { getTokens } from '../config'\nimport { SizeTokens, SpaceTokens } from '../types'\n\nexport const getSize = (size?: SizeTokens | undefined, shift = 0, bounds = [0]) => {\n return stepTokenUpOrDown(getTokens(true).size, size, shift, bounds)\n}\n\nconst cache = new WeakMap()\n\nexport const stepTokenUpOrDown = (\n tokens: Object,\n current?: SizeTokens | SpaceTokens | string,\n shift = 0,\n bounds = [0]\n) => {\n if (!cache.has(tokens)) {\n cache.set(tokens, Object.keys(tokens))\n }\n const sizeNames = cache.get(tokens)!\n const currentKey = current || '$true'\n const min = bounds[0] ?? 0\n const max = bounds[1] ?? sizeNames.length - 1\n const currentIndex = sizeNames.indexOf(currentKey)\n const index = Math.min(max, Math.max(min, currentIndex + shift))\n const key = sizeNames[index]\n return tokens[key] || tokens['$true']\n}\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,oBAA0B;AAGnB,MAAM,UAAU,CAAC,MAA+B,QAAQ,GAAG,SAAS,CAAC,CAAC,MAAM;AACjF,SAAO,sBAAkB,yBAAU,IAAI,EAAE,MAAM,MAAM,OAAO,MAAM;AACpE;AAEA,MAAM,QAAQ,oBAAI,QAAQ;AAEnB,MAAM,oBAAoB,CAC/B,QACA,SACA,QAAQ,GACR,SAAS,CAAC,CAAC,MACR;AACH,MAAI,CAAC,MAAM,IAAI,MAAM,GAAG;AACtB,UAAM,IAAI,QAAQ,OAAO,KAAK,MAAM,CAAC;AAAA,EACvC;AACA,QAAM,YAAY,MAAM,IAAI,MAAM;AAClC,QAAM,aAAa,WAAW;AAC9B,QAAM,MAAM,OAAO,MAAM;AACzB,QAAM,MAAM,OAAO,MAAM,UAAU,SAAS;AAC5C,QAAM,eAAe,UAAU,QAAQ,UAAU;AACjD,QAAM,QAAQ,KAAK,IAAI,KAAK,KAAK,IAAI,KAAK,eAAe,KAAK,CAAC;AAC/D,QAAM,MAAM,UAAU;AACtB,SAAO,OAAO,QAAQ,OAAO;AAC/B;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
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 getStackSize_exports = {};
|
|
20
|
-
__export(getStackSize_exports, {
|
|
21
|
-
getButtonSize: () => getButtonSize
|
|
22
|
-
});
|
|
23
|
-
module.exports = __toCommonJS(getStackSize_exports);
|
|
24
|
-
var import_getSize = require("./getSize");
|
|
25
|
-
const getButtonSize = (val, { tokens }) => {
|
|
26
|
-
if (typeof val === "number") {
|
|
27
|
-
return {
|
|
28
|
-
paddingHorizontal: val * 0.25,
|
|
29
|
-
height: val,
|
|
30
|
-
borderRadius: val * 0.2
|
|
31
|
-
};
|
|
32
|
-
}
|
|
33
|
-
const ySize = (0, import_getSize.getSize)(val, 0);
|
|
34
|
-
const xSize = (0, import_getSize.stepTokenUpOrDown)(tokens.space, val);
|
|
35
|
-
const radiusToken = tokens.radius[val] ?? tokens.radius["$4"];
|
|
36
|
-
return {
|
|
37
|
-
paddingHorizontal: xSize,
|
|
38
|
-
height: ySize,
|
|
39
|
-
borderRadius: radiusToken
|
|
40
|
-
};
|
|
41
|
-
};
|
|
42
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
43
|
-
0 && (module.exports = {
|
|
44
|
-
getButtonSize
|
|
45
|
-
});
|
|
46
|
-
//# sourceMappingURL=getStackSize.js.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../src/helpers/getStackSize.ts"],
|
|
4
|
-
"sourcesContent": ["import { SizeTokens, VariantSpreadExtras } from '../types'\nimport { getSize, stepTokenUpOrDown } from './getSize'\n\nexport type ScaleVariantExtras = Pick<VariantSpreadExtras<any>, 'tokens' | 'props' | 'fonts'>\n\nexport const getButtonSize = (val: SizeTokens | number, { tokens }: VariantSpreadExtras<any>) => {\n if (typeof val === 'number') {\n return {\n paddingHorizontal: val * 0.25,\n height: val,\n borderRadius: val * 0.2,\n }\n }\n const ySize = getSize(val, 0)\n const xSize = stepTokenUpOrDown(tokens.space, val)\n const radiusToken = tokens.radius[val] ?? tokens.radius['$4']\n return {\n paddingHorizontal: xSize,\n height: ySize,\n borderRadius: radiusToken,\n }\n}\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,qBAA2C;AAIpC,MAAM,gBAAgB,CAAC,KAA0B,EAAE,aAAuC;AAC/F,MAAI,OAAO,QAAQ,UAAU;AAC3B,WAAO;AAAA,MACL,mBAAmB,MAAM;AAAA,MACzB,QAAQ;AAAA,MACR,cAAc,MAAM;AAAA,IACtB;AAAA,EACF;AACA,QAAM,QAAQ,4BAAQ,KAAK,CAAC;AAC5B,QAAM,QAAQ,sCAAkB,OAAO,OAAO,GAAG;AACjD,QAAM,cAAc,OAAO,OAAO,QAAQ,OAAO,OAAO;AACxD,SAAO;AAAA,IACL,mBAAmB;AAAA,IACnB,QAAQ;AAAA,IACR,cAAc;AAAA,EAChB;AACF;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __copyProps = (to, from, except, desc) => {
|
|
7
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
8
|
-
for (let key of __getOwnPropNames(from))
|
|
9
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
10
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
11
|
-
}
|
|
12
|
-
return to;
|
|
13
|
-
};
|
|
14
|
-
var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
|
|
15
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
16
|
-
var nativeGestureHandler_native_exports = {};
|
|
17
|
-
module.exports = __toCommonJS(nativeGestureHandler_native_exports);
|
|
18
|
-
__reExport(nativeGestureHandler_native_exports, require("react-native-gesture-handler"), module.exports);
|
|
19
|
-
//# sourceMappingURL=nativeGestureHandler.native.js.map
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __create = Object.create;
|
|
3
|
-
var __defProp = Object.defineProperty;
|
|
4
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
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 startTransition_exports = {};
|
|
23
|
-
__export(startTransition_exports, {
|
|
24
|
-
startTransition: () => startTransition
|
|
25
|
-
});
|
|
26
|
-
module.exports = __toCommonJS(startTransition_exports);
|
|
27
|
-
var import_react = __toESM(require("react"));
|
|
28
|
-
const startTransition = import_react.default.startTransition || ((cb) => cb());
|
|
29
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
30
|
-
0 && (module.exports = {
|
|
31
|
-
startTransition
|
|
32
|
-
});
|
|
33
|
-
//# sourceMappingURL=startTransition.js.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../src/helpers/startTransition.ts"],
|
|
4
|
-
"sourcesContent": ["import React from 'react'\n\n// backwards compat\nexport const startTransition = React.startTransition || ((cb) => cb())\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAAkB;AAGX,MAAM,kBAAkB,qBAAM,mBAAoB,EAAC,OAAO,GAAG;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
|
@@ -1,37 +0,0 @@
|
|
|
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 __export = (target, all) => {
|
|
8
|
-
for (var name in all)
|
|
9
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
-
};
|
|
11
|
-
var __copyProps = (to, from, except, desc) => {
|
|
12
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
-
for (let key of __getOwnPropNames(from))
|
|
14
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
-
}
|
|
17
|
-
return to;
|
|
18
|
-
};
|
|
19
|
-
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));
|
|
20
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
21
|
-
var wrapThemeManagerContext_exports = {};
|
|
22
|
-
__export(wrapThemeManagerContext_exports, {
|
|
23
|
-
wrapThemeManagerContext: () => wrapThemeManagerContext
|
|
24
|
-
});
|
|
25
|
-
module.exports = __toCommonJS(wrapThemeManagerContext_exports);
|
|
26
|
-
var import_react = __toESM(require("react"));
|
|
27
|
-
var import_ThemeManager = require("../ThemeManager");
|
|
28
|
-
function wrapThemeManagerContext(children, themeManager) {
|
|
29
|
-
return themeManager ? /* @__PURE__ */ import_react.default.createElement(import_ThemeManager.ThemeManagerContext.Provider, {
|
|
30
|
-
value: themeManager
|
|
31
|
-
}, children) : children;
|
|
32
|
-
}
|
|
33
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
34
|
-
0 && (module.exports = {
|
|
35
|
-
wrapThemeManagerContext
|
|
36
|
-
});
|
|
37
|
-
//# sourceMappingURL=wrapThemeManagerContext.js.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../src/helpers/wrapThemeManagerContext.tsx"],
|
|
4
|
-
"sourcesContent": ["import React, { useEffect } from 'react'\n\nimport { ThemeManager, ThemeManagerContext } from '../ThemeManager'\n\nexport function wrapThemeManagerContext(children: any, themeManager?: ThemeManager | null) {\n return themeManager ? (\n <ThemeManagerContext.Provider value={themeManager}>{children}</ThemeManagerContext.Provider>\n ) : (\n children\n )\n}\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAAiC;AAEjC,0BAAkD;AAE3C,iCAAiC,UAAe,cAAoC;AACzF,SAAO,eACL,mDAAC,wCAAoB,UAApB;AAAA,IAA6B,OAAO;AAAA,KAAe,QAAS,IAE7D;AAEJ;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
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 useConstant_exports = {};
|
|
20
|
-
__export(useConstant_exports, {
|
|
21
|
-
useConstant: () => useConstant
|
|
22
|
-
});
|
|
23
|
-
module.exports = __toCommonJS(useConstant_exports);
|
|
24
|
-
var import_react = require("react");
|
|
25
|
-
function useConstant(fn) {
|
|
26
|
-
const ref = (0, import_react.useRef)();
|
|
27
|
-
if (!ref.current) {
|
|
28
|
-
ref.current = { v: fn() };
|
|
29
|
-
}
|
|
30
|
-
return ref.current.v;
|
|
31
|
-
}
|
|
32
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
33
|
-
0 && (module.exports = {
|
|
34
|
-
useConstant
|
|
35
|
-
});
|
|
36
|
-
//# sourceMappingURL=useConstant.js.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../src/hooks/useConstant.tsx"],
|
|
4
|
-
"sourcesContent": ["import { useRef } from 'react'\n\ntype ResultBox<T> = { v: T }\nexport function useConstant<T>(fn: () => T): T {\n const ref = useRef<ResultBox<T>>()\n if (!ref.current) {\n ref.current = { v: fn() }\n }\n return ref.current.v\n}\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAAuB;AAGhB,qBAAwB,IAAgB;AAC7C,QAAM,MAAM,yBAAqB;AACjC,MAAI,CAAC,IAAI,SAAS;AAChB,QAAI,UAAU,EAAE,GAAG,GAAG,EAAE;AAAA,EAC1B;AACA,SAAO,IAAI,QAAQ;AACrB;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
|
@@ -1,201 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __create = Object.create;
|
|
3
|
-
var __defProp = Object.defineProperty;
|
|
4
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
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 useFeatures_exports = {};
|
|
23
|
-
__export(useFeatures_exports, {
|
|
24
|
-
useFeatures: () => useFeatures
|
|
25
|
-
});
|
|
26
|
-
module.exports = __toCommonJS(useFeatures_exports);
|
|
27
|
-
var import_react = __toESM(require("react"));
|
|
28
|
-
var import_conf = require("../conf");
|
|
29
|
-
var import_platform = require("../constants/platform");
|
|
30
|
-
var import_getSplitStyles = require("../helpers/getSplitStyles");
|
|
31
|
-
var import_useMedia = require("./useMedia");
|
|
32
|
-
const createDefinition = ({
|
|
33
|
-
Component,
|
|
34
|
-
propNames
|
|
35
|
-
}) => ({
|
|
36
|
-
isEnabled: (props) => propNames.some((name) => !!props[name]),
|
|
37
|
-
Component
|
|
38
|
-
});
|
|
39
|
-
let featureDefinitions = null;
|
|
40
|
-
let tamaguiConfig;
|
|
41
|
-
const useFeatures = (props, utils) => {
|
|
42
|
-
if (!featureDefinitions) {
|
|
43
|
-
featureDefinitions = loadFeatures();
|
|
44
|
-
}
|
|
45
|
-
const elements = [];
|
|
46
|
-
const enabled = {};
|
|
47
|
-
for (const name in featureDefinitions) {
|
|
48
|
-
const { isEnabled, Component } = featureDefinitions[name];
|
|
49
|
-
if (isEnabled(props) && Component) {
|
|
50
|
-
enabled[name] = true;
|
|
51
|
-
elements.push(/* @__PURE__ */ import_react.default.createElement(Component, {
|
|
52
|
-
key: name,
|
|
53
|
-
...props,
|
|
54
|
-
_utils: utils
|
|
55
|
-
}));
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
return {
|
|
59
|
-
elements,
|
|
60
|
-
enabled
|
|
61
|
-
};
|
|
62
|
-
};
|
|
63
|
-
function loadFeatures() {
|
|
64
|
-
return {
|
|
65
|
-
animation: loadAnimationFeature(),
|
|
66
|
-
mediaQuery: loadMediaQueryFeature()
|
|
67
|
-
};
|
|
68
|
-
}
|
|
69
|
-
function loadAnimationFeature() {
|
|
70
|
-
tamaguiConfig = tamaguiConfig || (0, import_conf.getConfig)();
|
|
71
|
-
return createDefinition({
|
|
72
|
-
Component: ({ _utils, ...props }) => {
|
|
73
|
-
const {
|
|
74
|
-
state,
|
|
75
|
-
useAnimations,
|
|
76
|
-
pseudos,
|
|
77
|
-
style: inStyle,
|
|
78
|
-
setStateShallow,
|
|
79
|
-
staticConfig,
|
|
80
|
-
theme,
|
|
81
|
-
onDidAnimate
|
|
82
|
-
} = _utils;
|
|
83
|
-
if (!useAnimations) {
|
|
84
|
-
console.error("no useAnimations hook provided");
|
|
85
|
-
return null;
|
|
86
|
-
}
|
|
87
|
-
const propsWithAnimation = props;
|
|
88
|
-
const res = useAnimations(propsWithAnimation, {
|
|
89
|
-
state,
|
|
90
|
-
pseudos,
|
|
91
|
-
onDidAnimate,
|
|
92
|
-
staticConfig,
|
|
93
|
-
getStyle({ isExiting, isEntering, exitVariant, enterVariant } = {}) {
|
|
94
|
-
var _a, _b, _c, _d;
|
|
95
|
-
const style = inStyle || {};
|
|
96
|
-
const enterStyle = isEntering ? enterVariant && ((_a = staticConfig.variants) == null ? void 0 : _a[enterVariant]["true"]) ? (0, import_getSplitStyles.getSubStyle)("", (_b = staticConfig.variants) == null ? void 0 : _b[enterVariant]["true"], staticConfig, theme, props, state, tamaguiConfig) || pseudos.enterStyle : pseudos.enterStyle : null;
|
|
97
|
-
const exitStyle = isExiting ? exitVariant && ((_c = staticConfig.variants) == null ? void 0 : _c[exitVariant]["true"]) ? (0, import_getSplitStyles.getSubStyle)("", (_d = staticConfig.variants) == null ? void 0 : _d[exitVariant]["true"], staticConfig, theme, props, state, tamaguiConfig) || pseudos.exitStyle : pseudos.exitStyle : null;
|
|
98
|
-
ensureBaseHasDefaults(style, enterStyle, pseudos.hoverStyle, pseudos.focusStyle, pseudos.pressStyle, pseudos.pressStyle);
|
|
99
|
-
enterStyle && merge(style, enterStyle);
|
|
100
|
-
state.hover && pseudos.hoverStyle && merge(style, pseudos.hoverStyle);
|
|
101
|
-
state.focus && pseudos.focusStyle && merge(style, pseudos.focusStyle);
|
|
102
|
-
state.press && pseudos.pressStyle && merge(style, pseudos.pressStyle);
|
|
103
|
-
exitStyle && merge(style, exitStyle);
|
|
104
|
-
return style;
|
|
105
|
-
}
|
|
106
|
-
});
|
|
107
|
-
(0, import_platform.useIsomorphicLayoutEffect)(() => {
|
|
108
|
-
setStateShallow({
|
|
109
|
-
animation: res
|
|
110
|
-
});
|
|
111
|
-
}, [res]);
|
|
112
|
-
return null;
|
|
113
|
-
},
|
|
114
|
-
propNames: ["animation"]
|
|
115
|
-
});
|
|
116
|
-
}
|
|
117
|
-
const defaults = {
|
|
118
|
-
left: 0,
|
|
119
|
-
right: 0,
|
|
120
|
-
top: 0,
|
|
121
|
-
bottom: 0,
|
|
122
|
-
opacity: 1,
|
|
123
|
-
translateX: 0,
|
|
124
|
-
translateY: 0,
|
|
125
|
-
skew: 0,
|
|
126
|
-
skewX: 0,
|
|
127
|
-
skewY: 0,
|
|
128
|
-
scale: 1,
|
|
129
|
-
rotate: "0deg",
|
|
130
|
-
rotateY: "0deg",
|
|
131
|
-
rotateX: "0deg"
|
|
132
|
-
};
|
|
133
|
-
function ensureBaseHasDefaults(base, ...pseudos) {
|
|
134
|
-
for (const pseudo of pseudos) {
|
|
135
|
-
if (!pseudo)
|
|
136
|
-
continue;
|
|
137
|
-
for (const key in pseudo) {
|
|
138
|
-
const val = pseudo[key];
|
|
139
|
-
if (key === "transform") {
|
|
140
|
-
for (const t of val) {
|
|
141
|
-
const tkey = Object.keys(t)[0];
|
|
142
|
-
const defaultVal = defaults[tkey];
|
|
143
|
-
const tDefaultVal = { [tkey]: defaultVal };
|
|
144
|
-
if (!base.transform) {
|
|
145
|
-
base.transform = [tDefaultVal];
|
|
146
|
-
} else {
|
|
147
|
-
if (!base.transform.find((x) => x[tkey])) {
|
|
148
|
-
base.transform.push(tDefaultVal);
|
|
149
|
-
}
|
|
150
|
-
}
|
|
151
|
-
}
|
|
152
|
-
} else {
|
|
153
|
-
if (!(key in base)) {
|
|
154
|
-
base[key] = defaults[key];
|
|
155
|
-
}
|
|
156
|
-
}
|
|
157
|
-
}
|
|
158
|
-
}
|
|
159
|
-
}
|
|
160
|
-
function merge(base, next) {
|
|
161
|
-
if (!next.transform || !base.transform) {
|
|
162
|
-
Object.assign(base, next);
|
|
163
|
-
return;
|
|
164
|
-
}
|
|
165
|
-
const { transform, ...rest } = next;
|
|
166
|
-
Object.assign(base, rest);
|
|
167
|
-
for (const t of transform) {
|
|
168
|
-
const key = Object.keys(t)[0];
|
|
169
|
-
const existing = base.transform.find((x) => key in x);
|
|
170
|
-
if (existing) {
|
|
171
|
-
existing[key] = t[key];
|
|
172
|
-
} else {
|
|
173
|
-
base.transform.push(t);
|
|
174
|
-
}
|
|
175
|
-
}
|
|
176
|
-
}
|
|
177
|
-
function loadMediaQueryFeature() {
|
|
178
|
-
const mediaPropNames = Object.keys(import_useMedia.mediaState);
|
|
179
|
-
return createDefinition({
|
|
180
|
-
Component: (props) => {
|
|
181
|
-
const mediaKeys = mediaPropNames.filter((x) => x in props);
|
|
182
|
-
(0, import_platform.useIsomorphicLayoutEffect)(() => {
|
|
183
|
-
for (const key of mediaKeys) {
|
|
184
|
-
(0, import_useMedia.addMediaQueryListener)(key, props._utils.forceUpdate);
|
|
185
|
-
}
|
|
186
|
-
return () => {
|
|
187
|
-
for (const key of mediaKeys) {
|
|
188
|
-
(0, import_useMedia.removeMediaQueryListener)(key, props._utils.forceUpdate);
|
|
189
|
-
}
|
|
190
|
-
};
|
|
191
|
-
}, [mediaKeys.join(",")]);
|
|
192
|
-
return null;
|
|
193
|
-
},
|
|
194
|
-
propNames: mediaPropNames
|
|
195
|
-
});
|
|
196
|
-
}
|
|
197
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
198
|
-
0 && (module.exports = {
|
|
199
|
-
useFeatures
|
|
200
|
-
});
|
|
201
|
-
//# sourceMappingURL=useFeatures.js.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../src/hooks/useFeatures.tsx"],
|
|
4
|
-
"sourcesContent": ["import React from 'react'\nimport { RefObject } from 'react'\nimport { View, ViewStyle } from 'react-native'\n\nimport { getConfig } from '../conf'\nimport { useIsomorphicLayoutEffect } from '../constants/platform'\nimport { getSubStyle } from '../helpers/getSplitStyles'\nimport {\n PseudoStyles,\n SplitStyleState,\n StaticConfigParsed,\n TamaguiComponentState,\n TamaguiInternalConfig,\n UseAnimationHook,\n UseAnimationProps,\n} from '../types'\nimport { addMediaQueryListener, mediaState, removeMediaQueryListener } from './useMedia'\n\ntype FeatureDefinition = {\n isEnabled: (props: any) => boolean\n Component: any\n}\n\ntype FeatureUtils = {\n forceUpdate: Function\n state: SplitStyleState\n setStateShallow: (next: Partial<TamaguiComponentState>) => void\n useAnimations?: UseAnimationHook\n pseudos: PseudoStyles\n style: ViewStyle | null | undefined\n staticConfig: StaticConfigParsed\n theme: any\n onDidAnimate?: () => void\n hostRef: RefObject<HTMLElement | View>\n}\n\nconst createDefinition = ({\n Component,\n propNames,\n}: {\n Component: (props: { _utils: FeatureUtils; [key: string]: any }) => void\n propNames: string[]\n}): FeatureDefinition => ({\n isEnabled: (props: any) => propNames.some((name) => !!props[name]),\n Component,\n})\n\nlet featureDefinitions: Record<string, FeatureDefinition> | null = null\nlet tamaguiConfig: TamaguiInternalConfig\n\ntype FeatureKeys = keyof ReturnType<typeof loadFeatures>\n\nexport const useFeatures = (props: any, utils?: FeatureUtils) => {\n if (!featureDefinitions) {\n featureDefinitions = loadFeatures()\n }\n const elements: JSX.Element[] = []\n const enabled: { [key in FeatureKeys]?: boolean } = {}\n for (const name in featureDefinitions) {\n const { isEnabled, Component } = featureDefinitions[name]\n if (isEnabled(props) && Component) {\n enabled[name] = true\n elements.push(<Component key={name} {...props} _utils={utils} />)\n }\n }\n return {\n elements,\n enabled,\n }\n}\n\nfunction loadFeatures() {\n return {\n // loads animations and sets state with the results\n animation: loadAnimationFeature(),\n\n // will update the parent whenever media query changes\n // no need on web, media queries are inserted and run in css\n mediaQuery: loadMediaQueryFeature(),\n } as const\n}\n\nfunction loadAnimationFeature() {\n tamaguiConfig = tamaguiConfig || getConfig()\n\n return createDefinition({\n Component: ({ _utils, ...props }) => {\n const {\n state,\n useAnimations,\n pseudos,\n style: inStyle,\n setStateShallow,\n staticConfig,\n theme,\n onDidAnimate,\n } = _utils\n\n if (!useAnimations) {\n console.error('no useAnimations hook provided')\n return null\n }\n\n // we always have .animation set\n const propsWithAnimation = props as UseAnimationProps\n\n const res = useAnimations(propsWithAnimation, {\n state,\n pseudos,\n onDidAnimate,\n staticConfig,\n getStyle({ isExiting, isEntering, exitVariant, enterVariant } = {}) {\n // we have to merge such that transforms keys all exist\n const style = inStyle || {}\n\n const enterStyle = isEntering\n ? enterVariant && staticConfig.variants?.[enterVariant]['true']\n ? getSubStyle(\n '',\n staticConfig.variants?.[enterVariant]['true'],\n staticConfig,\n theme,\n props,\n state,\n tamaguiConfig\n ) || pseudos.enterStyle\n : null || pseudos.enterStyle\n : null\n\n const exitStyle = isExiting\n ? exitVariant && staticConfig.variants?.[exitVariant]['true']\n ? getSubStyle(\n '',\n staticConfig.variants?.[exitVariant]['true'],\n staticConfig,\n theme,\n props,\n state,\n tamaguiConfig\n ) || pseudos.exitStyle\n : null || pseudos.exitStyle\n : null\n\n // if you have hoverStyle={{ scale: 1.1 }} and don't have scale set on the base style\n // no animation will run! this is really confusing. this will look at all variants,\n // and fill in base styles if they don't exist. eg:\n // input:\n // base: {}\n // hoverStyle: { scale: 2 }\n // enterStyle: { x: 100 }\n // output:\n // base: { x: 0, scale: 1 }\n ensureBaseHasDefaults(\n style,\n enterStyle,\n pseudos.hoverStyle,\n pseudos.focusStyle,\n pseudos.pressStyle,\n pseudos.pressStyle\n )\n\n enterStyle && merge(style, enterStyle)\n state.hover && pseudos.hoverStyle && merge(style, pseudos.hoverStyle)\n state.focus && pseudos.focusStyle && merge(style, pseudos.focusStyle)\n state.press && pseudos.pressStyle && merge(style, pseudos.pressStyle)\n exitStyle && merge(style, exitStyle)\n\n return style\n },\n //, delay\n })\n\n useIsomorphicLayoutEffect(() => {\n setStateShallow({\n animation: res,\n })\n }, [res])\n\n return null\n },\n propNames: ['animation'],\n })\n}\n\nconst defaults = {\n left: 0,\n right: 0,\n top: 0,\n bottom: 0,\n opacity: 1,\n translateX: 0,\n translateY: 0,\n skew: 0,\n skewX: 0,\n skewY: 0,\n scale: 1,\n rotate: '0deg',\n rotateY: '0deg',\n rotateX: '0deg',\n}\n\nfunction ensureBaseHasDefaults(base: ViewStyle, ...pseudos: (ViewStyle | null | undefined)[]) {\n for (const pseudo of pseudos) {\n if (!pseudo) continue\n for (const key in pseudo) {\n const val = pseudo[key]\n if (key === 'transform') {\n for (const t of val) {\n const tkey = Object.keys(t)[0]\n const defaultVal = defaults[tkey]\n const tDefaultVal = { [tkey]: defaultVal } as any\n if (!base.transform) {\n base.transform = [tDefaultVal]\n } else {\n if (!base.transform.find((x) => x[tkey])) {\n base.transform.push(tDefaultVal)\n }\n }\n }\n } else {\n if (!(key in base)) {\n base[key] = defaults[key]\n }\n }\n }\n }\n}\n\nfunction merge(base: ViewStyle, next: ViewStyle) {\n if (!next.transform || !base.transform) {\n Object.assign(base, next)\n return\n }\n const { transform, ...rest } = next\n Object.assign(base, rest)\n for (const t of transform) {\n const key = Object.keys(t)[0]\n const existing = base.transform.find((x) => key in x)\n if (existing) {\n existing[key] = t[key]\n } else {\n base.transform.push(t)\n }\n }\n}\n\nfunction loadMediaQueryFeature() {\n const mediaPropNames = Object.keys(mediaState)\n\n return createDefinition({\n Component: (props: any) => {\n const mediaKeys = mediaPropNames.filter((x) => x in props)\n\n useIsomorphicLayoutEffect(() => {\n for (const key of mediaKeys) {\n addMediaQueryListener(key, props._utils.forceUpdate)\n }\n return () => {\n for (const key of mediaKeys) {\n removeMediaQueryListener(key, props._utils.forceUpdate)\n }\n }\n }, [mediaKeys.join(',')])\n\n return null\n },\n propNames: mediaPropNames,\n })\n}\n\n// TODO\n// measureLayout: createDefinition({\n// Component: (props) => {\n// console.log('measure', props)\n// return null\n// },\n// propNames: ['onLayout'],\n// }),\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAAkB;AAIlB,kBAA0B;AAC1B,sBAA0C;AAC1C,4BAA4B;AAU5B,sBAA4E;AAoB5E,MAAM,mBAAmB,CAAC;AAAA,EACxB;AAAA,EACA;AAAA,MAIwB;AAAA,EACxB,WAAW,CAAC,UAAe,UAAU,KAAK,CAAC,SAAS,CAAC,CAAC,MAAM,KAAK;AAAA,EACjE;AACF;AAEA,IAAI,qBAA+D;AACnE,IAAI;AAIG,MAAM,cAAc,CAAC,OAAY,UAAyB;AAC/D,MAAI,CAAC,oBAAoB;AACvB,yBAAqB,aAAa;AAAA,EACpC;AACA,QAAM,WAA0B,CAAC;AACjC,QAAM,UAA8C,CAAC;AACrD,aAAW,QAAQ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|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
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 useIsMounted_exports = {};
|
|
20
|
-
__export(useIsMounted_exports, {
|
|
21
|
-
useIsMounted: () => useIsMounted
|
|
22
|
-
});
|
|
23
|
-
module.exports = __toCommonJS(useIsMounted_exports);
|
|
24
|
-
var import_react = require("react");
|
|
25
|
-
var import_platform = require("../constants/platform");
|
|
26
|
-
function useIsMounted() {
|
|
27
|
-
const isMounted = (0, import_react.useRef)(false);
|
|
28
|
-
(0, import_platform.useIsomorphicLayoutEffect)(() => {
|
|
29
|
-
isMounted.current = true;
|
|
30
|
-
return () => {
|
|
31
|
-
isMounted.current = false;
|
|
32
|
-
};
|
|
33
|
-
}, []);
|
|
34
|
-
return isMounted;
|
|
35
|
-
}
|
|
36
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
37
|
-
0 && (module.exports = {
|
|
38
|
-
useIsMounted
|
|
39
|
-
});
|
|
40
|
-
//# sourceMappingURL=useIsMounted.js.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../src/hooks/useIsMounted.ts"],
|
|
4
|
-
"sourcesContent": ["import { useRef } from 'react'\n\nimport { useIsomorphicLayoutEffect } from '../constants/platform'\n\nexport function useIsMounted() {\n const isMounted = useRef(false)\n\n useIsomorphicLayoutEffect(() => {\n isMounted.current = true\n\n return () => {\n isMounted.current = false\n }\n }, [])\n\n return isMounted\n}\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAAuB;AAEvB,sBAA0C;AAEnC,wBAAwB;AAC7B,QAAM,YAAY,yBAAO,KAAK;AAE9B,iDAA0B,MAAM;AAC9B,cAAU,UAAU;AAEpB,WAAO,MAAM;AACX,gBAAU,UAAU;AAAA,IACtB;AAAA,EACF,GAAG,CAAC,CAAC;AAEL,SAAO;AACT;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|