@tamagui/core 1.0.21 → 1.0.23
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/contexts/ButtonInsideButtonContext.js +30 -0
- package/dist/cjs/contexts/ButtonInsideButtonContext.js.map +7 -0
- package/dist/cjs/contexts/ThemeContext.js +30 -0
- package/dist/cjs/contexts/ThemeContext.js.map +7 -0
- package/dist/cjs/helpers/areEqualSets.js +38 -0
- package/dist/cjs/helpers/areEqualSets.js.map +7 -0
- package/dist/cjs/helpers/assignNativePropsToWeb.js +188 -0
- package/dist/cjs/helpers/assignNativePropsToWeb.js.map +7 -0
- package/dist/cjs/helpers/assignNativePropsToWeb.native.js +30 -0
- package/dist/cjs/helpers/assignNativePropsToWeb.native.js.map +7 -0
- package/dist/cjs/helpers/cache.js +43 -0
- package/dist/cjs/helpers/cache.js.map +7 -0
- package/dist/cjs/helpers/calc.js +71 -0
- package/dist/cjs/helpers/calc.js.map +7 -0
- package/dist/cjs/helpers/getFont.js +66 -0
- package/dist/cjs/helpers/getFont.js.map +7 -0
- package/dist/cjs/helpers/getSize.js +44 -0
- package/dist/cjs/helpers/getSize.js.map +7 -0
- package/dist/cjs/helpers/getSplitStyles.js +8 -3
- package/dist/cjs/helpers/getSplitStyles.js.map +2 -2
- package/dist/cjs/helpers/getStackSize.js +46 -0
- package/dist/cjs/helpers/getStackSize.js.map +7 -0
- package/dist/cjs/helpers/startTransition.js +36 -0
- package/dist/cjs/helpers/startTransition.js.map +7 -0
- package/dist/cjs/hooks/useConstant.js +39 -0
- package/dist/cjs/hooks/useConstant.js.map +7 -0
- package/dist/cjs/hooks/useIsMounted.js +40 -0
- package/dist/cjs/hooks/useIsMounted.js.map +7 -0
- package/dist/cjs/hooks/usePressable.js +36 -0
- package/dist/cjs/hooks/usePressable.js.map +7 -0
- package/dist/cjs/hooks/useUnmountEffect.js +32 -0
- package/dist/cjs/hooks/useUnmountEffect.js.map +7 -0
- package/dist/cjs/injectStyles.js +40 -0
- package/dist/cjs/injectStyles.js.map +7 -0
- package/dist/cjs/views/ThemeInverse.js +56 -0
- package/dist/cjs/views/ThemeInverse.js.map +7 -0
- package/dist/cjs/views/ThemeReset.js +69 -0
- package/dist/cjs/views/ThemeReset.js.map +7 -0
- package/dist/esm/contexts/ButtonInsideButtonContext.js +6 -0
- package/dist/esm/contexts/ButtonInsideButtonContext.js.map +7 -0
- package/dist/esm/contexts/ThemeContext.js +6 -0
- package/dist/esm/contexts/ThemeContext.js.map +7 -0
- package/dist/esm/helpers/areEqualSets.js +14 -0
- package/dist/esm/helpers/areEqualSets.js.map +7 -0
- package/dist/esm/helpers/assignNativePropsToWeb.js +164 -0
- package/dist/esm/helpers/assignNativePropsToWeb.js.map +7 -0
- package/dist/esm/helpers/assignNativePropsToWeb.native.js +6 -0
- package/dist/esm/helpers/assignNativePropsToWeb.native.js.map +7 -0
- package/dist/esm/helpers/cache.js +18 -0
- package/dist/esm/helpers/cache.js.map +7 -0
- package/dist/esm/helpers/calc.js +47 -0
- package/dist/esm/helpers/calc.js.map +7 -0
- package/dist/esm/helpers/getFont.js +42 -0
- package/dist/esm/helpers/getFont.js.map +7 -0
- package/dist/esm/helpers/getSize.js +19 -0
- package/dist/esm/helpers/getSize.js.map +7 -0
- package/dist/esm/helpers/getSplitStyles.js +8 -3
- package/dist/esm/helpers/getSplitStyles.js.map +2 -2
- package/dist/esm/helpers/getStackSize.js +22 -0
- package/dist/esm/helpers/getStackSize.js.map +7 -0
- package/dist/esm/helpers/startTransition.js +6 -0
- package/dist/esm/helpers/startTransition.js.map +7 -0
- package/dist/esm/hooks/useConstant.js +15 -0
- package/dist/esm/hooks/useConstant.js.map +7 -0
- package/dist/esm/hooks/useIsMounted.js +16 -0
- package/dist/esm/hooks/useIsMounted.js.map +7 -0
- package/dist/esm/hooks/usePressable.js +12 -0
- package/dist/esm/hooks/usePressable.js.map +7 -0
- package/dist/esm/hooks/useUnmountEffect.js +8 -0
- package/dist/esm/hooks/useUnmountEffect.js.map +7 -0
- package/dist/esm/injectStyles.js +16 -0
- package/dist/esm/injectStyles.js.map +7 -0
- package/dist/esm/views/ThemeInverse.js +32 -0
- package/dist/esm/views/ThemeInverse.js.map +7 -0
- package/dist/esm/views/ThemeReset.js +39 -0
- package/dist/esm/views/ThemeReset.js.map +7 -0
- package/package.json +13 -15
- package/src/helpers/getSplitStyles.tsx +8 -3
|
@@ -0,0 +1,56 @@
|
|
|
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 ThemeInverse_exports = {};
|
|
20
|
+
__export(ThemeInverse_exports, {
|
|
21
|
+
ThemeInverse: () => ThemeInverse
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(ThemeInverse_exports);
|
|
24
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
25
|
+
var import_constants = require("@tamagui/constants");
|
|
26
|
+
var import_react = require("react");
|
|
27
|
+
var import_useTheme = require("../hooks/useTheme");
|
|
28
|
+
var import_Theme = require("./Theme");
|
|
29
|
+
const ThemeInverse = ({
|
|
30
|
+
children,
|
|
31
|
+
disable
|
|
32
|
+
}) => {
|
|
33
|
+
const themeName = (0, import_useTheme.useThemeName)();
|
|
34
|
+
const defaultTheme = (0, import_useTheme.useDefaultThemeName)();
|
|
35
|
+
const [name, setName] = (0, import_react.useState)(null);
|
|
36
|
+
(0, import_constants.useIsomorphicLayoutEffect)(() => {
|
|
37
|
+
if (themeName.startsWith("dark")) {
|
|
38
|
+
setName("light");
|
|
39
|
+
}
|
|
40
|
+
if (themeName.startsWith("light")) {
|
|
41
|
+
setName("dark");
|
|
42
|
+
}
|
|
43
|
+
}, [defaultTheme, themeName]);
|
|
44
|
+
if (disable) {
|
|
45
|
+
return children;
|
|
46
|
+
}
|
|
47
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_Theme.Theme, {
|
|
48
|
+
name,
|
|
49
|
+
children
|
|
50
|
+
});
|
|
51
|
+
};
|
|
52
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
53
|
+
0 && (module.exports = {
|
|
54
|
+
ThemeInverse
|
|
55
|
+
});
|
|
56
|
+
//# sourceMappingURL=ThemeInverse.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/views/ThemeInverse.tsx"],
|
|
4
|
+
"sourcesContent": ["import { useIsomorphicLayoutEffect } from '@tamagui/constants'\nimport React, { useState } from 'react'\n\nimport { useDefaultThemeName, useThemeName } from '../hooks/useTheme'\nimport { Theme } from './Theme'\n\nexport const ThemeInverse = ({\n children,\n disable,\n}: {\n children: React.ReactNode\n disable?: boolean\n}) => {\n const themeName = useThemeName()\n const defaultTheme = useDefaultThemeName()\n const [name, setName] = useState<null | string>(null)\n\n // ssr\n useIsomorphicLayoutEffect(() => {\n if (themeName.startsWith('dark')) {\n setName('light')\n }\n if (themeName.startsWith('light')) {\n setName('dark')\n }\n }, [defaultTheme, themeName])\n\n if (disable) {\n return children as JSX.Element\n }\n\n return <Theme name={name}>{children}</Theme>\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AA+BS;AA/BT,uBAA0C;AAC1C,mBAAgC;AAEhC,sBAAkD;AAClD,mBAAsB;AAEf,MAAM,eAAe,CAAC;AAAA,EAC3B;AAAA,EACA;AACF,MAGM;AACJ,QAAM,gBAAY,8BAAa;AAC/B,QAAM,mBAAe,qCAAoB;AACzC,QAAM,CAAC,MAAM,OAAO,QAAI,uBAAwB,IAAI;AAGpD,kDAA0B,MAAM;AAC9B,QAAI,UAAU,WAAW,MAAM,GAAG;AAChC,cAAQ,OAAO;AAAA,IACjB;AACA,QAAI,UAAU,WAAW,OAAO,GAAG;AACjC,cAAQ,MAAM;AAAA,IAChB;AAAA,EACF,GAAG,CAAC,cAAc,SAAS,CAAC;AAE5B,MAAI,SAAS;AACX,WAAO;AAAA,EACT;AAEA,SAAO,4CAAC;AAAA,IAAM;AAAA,IAAa;AAAA,GAAS;AACtC;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,69 @@
|
|
|
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(
|
|
21
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
22
|
+
mod
|
|
23
|
+
));
|
|
24
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
25
|
+
var ThemeReset_exports = {};
|
|
26
|
+
__export(ThemeReset_exports, {
|
|
27
|
+
ThemeReset: () => ThemeReset
|
|
28
|
+
});
|
|
29
|
+
module.exports = __toCommonJS(ThemeReset_exports);
|
|
30
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
31
|
+
var import_constants = require("@tamagui/constants");
|
|
32
|
+
var import_react = __toESM(require("react"));
|
|
33
|
+
var import_ThemeManager = require("../helpers/ThemeManager");
|
|
34
|
+
var import_Theme = require("./Theme");
|
|
35
|
+
import_react.default["createElement"];
|
|
36
|
+
const ThemeReset = (props) => {
|
|
37
|
+
const themeManager = (0, import_react.useContext)(import_ThemeManager.ThemeManagerContext);
|
|
38
|
+
const [name, setName] = (0, import_react.useState)(null);
|
|
39
|
+
if (import_constants.isClient) {
|
|
40
|
+
(0, import_react.useLayoutEffect)(() => {
|
|
41
|
+
if (!themeManager)
|
|
42
|
+
return;
|
|
43
|
+
if (name !== themeManager.parentName) {
|
|
44
|
+
setName(themeManager.parentName);
|
|
45
|
+
}
|
|
46
|
+
}, [name, themeManager, themeManager == null ? void 0 : themeManager.parentName]);
|
|
47
|
+
(0, import_react.useLayoutEffect)(() => {
|
|
48
|
+
if (!themeManager)
|
|
49
|
+
return;
|
|
50
|
+
return themeManager.onChangeTheme(() => {
|
|
51
|
+
setName(themeManager.parentName);
|
|
52
|
+
});
|
|
53
|
+
}, [themeManager]);
|
|
54
|
+
}
|
|
55
|
+
if (!themeManager || !props.children) {
|
|
56
|
+
return props.children || null;
|
|
57
|
+
}
|
|
58
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_Theme.Theme, {
|
|
59
|
+
className: "tui-theme-reset",
|
|
60
|
+
reset: true,
|
|
61
|
+
name,
|
|
62
|
+
children: props.children
|
|
63
|
+
});
|
|
64
|
+
};
|
|
65
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
66
|
+
0 && (module.exports = {
|
|
67
|
+
ThemeReset
|
|
68
|
+
});
|
|
69
|
+
//# sourceMappingURL=ThemeReset.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/views/ThemeReset.tsx"],
|
|
4
|
+
"sourcesContent": ["import { isClient, isWeb } from '@tamagui/constants'\nimport React, { useContext, useLayoutEffect, useState } from 'react'\n\nimport { ThemeManagerContext } from '../helpers/ThemeManager'\nimport { Theme } from './Theme'\n\n// bugfix esbuild strips react jsx: 'preserve'\nReact['createElement']\n\n// resets the theme to the parent theme\nexport const ThemeReset = (props: { children?: any }) => {\n const themeManager = useContext(ThemeManagerContext)\n const [name, setName] = useState<string | null>(null)\n\n // this component doesn't work with SSR, so must run only client side\n // we could at least prevent more flickering by having the ssr head script\n // that changes to dark initially also go through and change all of these\n if (isClient) {\n useLayoutEffect(() => {\n if (!themeManager) return\n if (name !== themeManager.parentName) {\n setName(themeManager.parentName)\n }\n }, [name, themeManager, themeManager?.parentName])\n\n useLayoutEffect(() => {\n if (!themeManager) return\n return themeManager.onChangeTheme(() => {\n setName(themeManager.parentName)\n })\n }, [themeManager])\n }\n\n if (!themeManager || !props.children) {\n return props.children || null\n }\n\n return (\n <Theme className=\"tui-theme-reset\" reset name={name}>\n {props.children}\n </Theme>\n )\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAsCI;AAtCJ,uBAAgC;AAChC,mBAA6D;AAE7D,0BAAoC;AACpC,mBAAsB;AAGtB,aAAAA,QAAM;AAGC,MAAM,aAAa,CAAC,UAA8B;AACvD,QAAM,mBAAe,yBAAW,uCAAmB;AACnD,QAAM,CAAC,MAAM,OAAO,QAAI,uBAAwB,IAAI;AAKpD,MAAI,2BAAU;AACZ,sCAAgB,MAAM;AACpB,UAAI,CAAC;AAAc;AACnB,UAAI,SAAS,aAAa,YAAY;AACpC,gBAAQ,aAAa,UAAU;AAAA,MACjC;AAAA,IACF,GAAG,CAAC,MAAM,cAAc,6CAAc,UAAU,CAAC;AAEjD,sCAAgB,MAAM;AACpB,UAAI,CAAC;AAAc;AACnB,aAAO,aAAa,cAAc,MAAM;AACtC,gBAAQ,aAAa,UAAU;AAAA,MACjC,CAAC;AAAA,IACH,GAAG,CAAC,YAAY,CAAC;AAAA,EACnB;AAEA,MAAI,CAAC,gBAAgB,CAAC,MAAM,UAAU;AACpC,WAAO,MAAM,YAAY;AAAA,EAC3B;AAEA,SACE,4CAAC;AAAA,IAAM,WAAU;AAAA,IAAkB,OAAK;AAAA,IAAC;AAAA,IACtC,gBAAM;AAAA,GACT;AAEJ;",
|
|
6
|
+
"names": ["React"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/contexts/ButtonInsideButtonContext.tsx"],
|
|
4
|
+
"sourcesContent": ["import { createContext } from 'react'\n\nexport const ButtonInsideButtonContext = createContext(false)\n"],
|
|
5
|
+
"mappings": "AAAA,SAAS,qBAAqB;AAEvB,MAAM,4BAA4B,cAAc,KAAK;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/contexts/ThemeContext.tsx"],
|
|
4
|
+
"sourcesContent": ["import { createContext } from 'react'\n\nimport { ThemeName, Themes } from '../types'\n\nexport const ThemeContext = createContext<{ themes: Themes; defaultTheme: ThemeName } | null>(null)\n"],
|
|
5
|
+
"mappings": "AAAA,SAAS,qBAAqB;AAIvB,MAAM,eAAe,cAAkE,IAAI;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/helpers/areEqualSets.tsx"],
|
|
4
|
+
"sourcesContent": ["export const areEqualSets = (a: Set<string>, b: Set<string>) => {\n if (a.size !== b.size) return false\n for (const val in a) {\n if (!b.has(val)) {\n return false\n }\n }\n return true\n}\n"],
|
|
5
|
+
"mappings": "AAAO,MAAM,eAAe,CAAC,GAAgB,MAAmB;AAC9D,MAAI,EAAE,SAAS,EAAE;AAAM,WAAO;AAC9B,aAAW,OAAO,GAAG;AACnB,QAAI,CAAC,EAAE,IAAI,GAAG,GAAG;AACf,aAAO;AAAA,IACT;AAAA,EACF;AACA,SAAO;AACT;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
import { accessibilityRoleToWebRole, processIDRefList } from "../createComponent";
|
|
2
|
+
function assignNativePropsToWeb(elementType, viewProps, nativeProps) {
|
|
3
|
+
if (!viewProps.role && nativeProps.accessibilityRole) {
|
|
4
|
+
if (nativeProps.accessibilityRole === "none") {
|
|
5
|
+
viewProps.role = "presentation";
|
|
6
|
+
} else {
|
|
7
|
+
const webRole = accessibilityRoleToWebRole[nativeProps.accessibilityRole];
|
|
8
|
+
if (webRole != null) {
|
|
9
|
+
viewProps.role = webRole || nativeProps.accessibilityRole;
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
if (nativeProps.accessibilityActiveDescendant != null) {
|
|
14
|
+
viewProps["aria-activedescendant"] = nativeProps.accessibilityActiveDescendant;
|
|
15
|
+
}
|
|
16
|
+
if (nativeProps.accessibilityAtomic != null) {
|
|
17
|
+
viewProps["aria-atomic"] = nativeProps.accessibilityAtomic;
|
|
18
|
+
}
|
|
19
|
+
if (nativeProps.accessibilityAutoComplete != null) {
|
|
20
|
+
viewProps["aria-autocomplete"] = nativeProps.accessibilityAutoComplete;
|
|
21
|
+
}
|
|
22
|
+
if (nativeProps.accessibilityBusy != null) {
|
|
23
|
+
viewProps["aria-busy"] = nativeProps.accessibilityBusy;
|
|
24
|
+
}
|
|
25
|
+
if (nativeProps.accessibilityChecked != null) {
|
|
26
|
+
viewProps["aria-checked"] = nativeProps.accessibilityChecked;
|
|
27
|
+
}
|
|
28
|
+
if (nativeProps.accessibilityColumnCount != null) {
|
|
29
|
+
viewProps["aria-colcount"] = nativeProps.accessibilityColumnCount;
|
|
30
|
+
}
|
|
31
|
+
if (nativeProps.accessibilityColumnIndex != null) {
|
|
32
|
+
viewProps["aria-colindex"] = nativeProps.accessibilityColumnIndex;
|
|
33
|
+
}
|
|
34
|
+
if (nativeProps.accessibilityColumnSpan != null) {
|
|
35
|
+
viewProps["aria-colspan"] = nativeProps.accessibilityColumnSpan;
|
|
36
|
+
}
|
|
37
|
+
if (nativeProps.accessibilityControls != null) {
|
|
38
|
+
viewProps["aria-controls"] = processIDRefList(nativeProps.accessibilityControls);
|
|
39
|
+
}
|
|
40
|
+
if (nativeProps.accessibilityCurrent != null) {
|
|
41
|
+
viewProps["aria-current"] = nativeProps.accessibilityCurrent;
|
|
42
|
+
}
|
|
43
|
+
if (nativeProps.accessibilityDescribedBy != null) {
|
|
44
|
+
viewProps["aria-describedby"] = processIDRefList(nativeProps.accessibilityDescribedBy);
|
|
45
|
+
}
|
|
46
|
+
if (nativeProps.accessibilityDetails != null) {
|
|
47
|
+
viewProps["aria-details"] = nativeProps.accessibilityDetails;
|
|
48
|
+
}
|
|
49
|
+
if (nativeProps.disabled === true) {
|
|
50
|
+
viewProps["aria-disabled"] = true;
|
|
51
|
+
if (elementType === "button" || elementType === "form" || elementType === "input" || elementType === "select" || elementType === "textarea") {
|
|
52
|
+
viewProps.disabled = true;
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
if (nativeProps.accessibilityErrorMessage != null) {
|
|
56
|
+
viewProps["aria-errormessage"] = nativeProps.accessibilityErrorMessage;
|
|
57
|
+
}
|
|
58
|
+
if (nativeProps.accessibilityExpanded != null) {
|
|
59
|
+
viewProps["aria-expanded"] = nativeProps.accessibilityExpanded;
|
|
60
|
+
}
|
|
61
|
+
if (nativeProps.accessibilityFlowTo != null) {
|
|
62
|
+
viewProps["aria-flowto"] = processIDRefList(nativeProps.accessibilityFlowTo);
|
|
63
|
+
}
|
|
64
|
+
if (nativeProps.accessibilityHasPopup != null) {
|
|
65
|
+
viewProps["aria-haspopup"] = nativeProps.accessibilityHasPopup;
|
|
66
|
+
}
|
|
67
|
+
if (nativeProps.accessibilityHidden === true) {
|
|
68
|
+
viewProps["aria-hidden"] = nativeProps.accessibilityHidden;
|
|
69
|
+
}
|
|
70
|
+
if (nativeProps.accessibilityInvalid != null) {
|
|
71
|
+
viewProps["aria-invalid"] = nativeProps.accessibilityInvalid;
|
|
72
|
+
}
|
|
73
|
+
if (nativeProps.accessibilityKeyShortcuts != null && Array.isArray(nativeProps.accessibilityKeyShortcuts)) {
|
|
74
|
+
viewProps["aria-keyshortcuts"] = nativeProps.accessibilityKeyShortcuts.join(" ");
|
|
75
|
+
}
|
|
76
|
+
if (nativeProps.accessibilityLabel != null) {
|
|
77
|
+
viewProps["aria-label"] = nativeProps.accessibilityLabel;
|
|
78
|
+
}
|
|
79
|
+
if (nativeProps.accessibilityLabelledBy != null) {
|
|
80
|
+
viewProps["aria-labelledby"] = processIDRefList(nativeProps.accessibilityLabelledBy);
|
|
81
|
+
}
|
|
82
|
+
if (nativeProps.accessibilityLevel != null) {
|
|
83
|
+
viewProps["aria-level"] = nativeProps.accessibilityLevel;
|
|
84
|
+
}
|
|
85
|
+
if (nativeProps.accessibilityLiveRegion != null) {
|
|
86
|
+
viewProps["aria-live"] = nativeProps.accessibilityLiveRegion === "none" ? "off" : nativeProps.accessibilityLiveRegion;
|
|
87
|
+
}
|
|
88
|
+
if (nativeProps.accessibilityModal != null) {
|
|
89
|
+
viewProps["aria-modal"] = nativeProps.accessibilityModal;
|
|
90
|
+
}
|
|
91
|
+
if (nativeProps.accessibilityMultiline != null) {
|
|
92
|
+
viewProps["aria-multiline"] = nativeProps.accessibilityMultiline;
|
|
93
|
+
}
|
|
94
|
+
if (nativeProps.accessibilityMultiSelectable != null) {
|
|
95
|
+
viewProps["aria-multiselectable"] = nativeProps.accessibilityMultiSelectable;
|
|
96
|
+
}
|
|
97
|
+
if (nativeProps.accessibilityOrientation != null) {
|
|
98
|
+
viewProps["aria-orientation"] = nativeProps.accessibilityOrientation;
|
|
99
|
+
}
|
|
100
|
+
if (nativeProps.accessibilityOwns != null) {
|
|
101
|
+
viewProps["aria-owns"] = processIDRefList(nativeProps.accessibilityOwns);
|
|
102
|
+
}
|
|
103
|
+
if (nativeProps.accessibilityPlaceholder != null) {
|
|
104
|
+
viewProps["aria-placeholder"] = nativeProps.accessibilityPlaceholder;
|
|
105
|
+
}
|
|
106
|
+
if (nativeProps.accessibilityPosInSet != null) {
|
|
107
|
+
viewProps["aria-posinset"] = nativeProps.accessibilityPosInSet;
|
|
108
|
+
}
|
|
109
|
+
if (nativeProps.accessibilityPressed != null) {
|
|
110
|
+
viewProps["aria-pressed"] = nativeProps.accessibilityPressed;
|
|
111
|
+
}
|
|
112
|
+
if (nativeProps.accessibilityReadOnly != null) {
|
|
113
|
+
viewProps["aria-readonly"] = nativeProps.accessibilityReadOnly;
|
|
114
|
+
if (elementType === "input" || elementType === "select" || elementType === "textarea") {
|
|
115
|
+
viewProps.readOnly = true;
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
if (nativeProps.accessibilityRequired != null) {
|
|
119
|
+
viewProps["aria-required"] = nativeProps.accessibilityRequired;
|
|
120
|
+
if (elementType === "input" || elementType === "select" || elementType === "textarea") {
|
|
121
|
+
viewProps.required = true;
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
if (nativeProps.accessibilityRoleDescription != null) {
|
|
125
|
+
viewProps["aria-roledescription"] = nativeProps.accessibilityRoleDescription;
|
|
126
|
+
}
|
|
127
|
+
if (nativeProps.accessibilityRowCount != null) {
|
|
128
|
+
viewProps["aria-rowcount"] = nativeProps.accessibilityRowCount;
|
|
129
|
+
}
|
|
130
|
+
if (nativeProps.accessibilityRowIndex != null) {
|
|
131
|
+
viewProps["aria-rowindex"] = nativeProps.accessibilityRowIndex;
|
|
132
|
+
}
|
|
133
|
+
if (nativeProps.accessibilityRowSpan != null) {
|
|
134
|
+
viewProps["aria-rowspan"] = nativeProps.accessibilityRowSpan;
|
|
135
|
+
}
|
|
136
|
+
if (nativeProps.accessibilitySelected != null) {
|
|
137
|
+
viewProps["aria-selected"] = nativeProps.accessibilitySelected;
|
|
138
|
+
}
|
|
139
|
+
if (nativeProps.accessibilitySetSize != null) {
|
|
140
|
+
viewProps["aria-setsize"] = nativeProps.accessibilitySetSize;
|
|
141
|
+
}
|
|
142
|
+
if (nativeProps.accessibilitySort != null) {
|
|
143
|
+
viewProps["aria-sort"] = nativeProps.accessibilitySort;
|
|
144
|
+
}
|
|
145
|
+
if (nativeProps.accessibilityValueMax != null) {
|
|
146
|
+
viewProps["aria-valuemax"] = nativeProps.accessibilityValueMax;
|
|
147
|
+
}
|
|
148
|
+
if (nativeProps.accessibilityValueMin != null) {
|
|
149
|
+
viewProps["aria-valuemin"] = nativeProps.accessibilityValueMin;
|
|
150
|
+
}
|
|
151
|
+
if (nativeProps.accessibilityValueNow != null) {
|
|
152
|
+
viewProps["aria-valuenow"] = nativeProps.accessibilityValueNow;
|
|
153
|
+
}
|
|
154
|
+
if (nativeProps.accessibilityValueText != null) {
|
|
155
|
+
viewProps["aria-valuetext"] = nativeProps.accessibilityValueText;
|
|
156
|
+
}
|
|
157
|
+
if (nativeProps.nativeID) {
|
|
158
|
+
viewProps.id = nativeProps.nativeID;
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
export {
|
|
162
|
+
assignNativePropsToWeb
|
|
163
|
+
};
|
|
164
|
+
//# sourceMappingURL=assignNativePropsToWeb.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/helpers/assignNativePropsToWeb.tsx"],
|
|
4
|
+
"sourcesContent": ["import { accessibilityRoleToWebRole, processIDRefList } from '../createComponent'\n\n// adapted from react-native-web\n\nexport function assignNativePropsToWeb(elementType: string, viewProps: any, nativeProps: any) {\n if (!viewProps.role && nativeProps.accessibilityRole) {\n if (nativeProps.accessibilityRole === 'none') {\n viewProps.role = 'presentation'\n } else {\n const webRole = accessibilityRoleToWebRole[nativeProps.accessibilityRole]\n if (webRole != null) {\n viewProps.role = webRole || nativeProps.accessibilityRole\n }\n }\n }\n\n if (nativeProps.accessibilityActiveDescendant != null) {\n viewProps['aria-activedescendant'] = nativeProps.accessibilityActiveDescendant\n }\n if (nativeProps.accessibilityAtomic != null) {\n viewProps['aria-atomic'] = nativeProps.accessibilityAtomic\n }\n if (nativeProps.accessibilityAutoComplete != null) {\n viewProps['aria-autocomplete'] = nativeProps.accessibilityAutoComplete\n }\n if (nativeProps.accessibilityBusy != null) {\n viewProps['aria-busy'] = nativeProps.accessibilityBusy\n }\n if (nativeProps.accessibilityChecked != null) {\n viewProps['aria-checked'] = nativeProps.accessibilityChecked\n }\n if (nativeProps.accessibilityColumnCount != null) {\n viewProps['aria-colcount'] = nativeProps.accessibilityColumnCount\n }\n if (nativeProps.accessibilityColumnIndex != null) {\n viewProps['aria-colindex'] = nativeProps.accessibilityColumnIndex\n }\n if (nativeProps.accessibilityColumnSpan != null) {\n viewProps['aria-colspan'] = nativeProps.accessibilityColumnSpan\n }\n if (nativeProps.accessibilityControls != null) {\n viewProps['aria-controls'] = processIDRefList(nativeProps.accessibilityControls)\n }\n if (nativeProps.accessibilityCurrent != null) {\n viewProps['aria-current'] = nativeProps.accessibilityCurrent\n }\n if (nativeProps.accessibilityDescribedBy != null) {\n viewProps['aria-describedby'] = processIDRefList(nativeProps.accessibilityDescribedBy)\n }\n if (nativeProps.accessibilityDetails != null) {\n viewProps['aria-details'] = nativeProps.accessibilityDetails\n }\n if (nativeProps.disabled === true) {\n viewProps['aria-disabled'] = true\n // Enhance with native semantics\n if (\n elementType === 'button' ||\n elementType === 'form' ||\n elementType === 'input' ||\n elementType === 'select' ||\n elementType === 'textarea'\n ) {\n viewProps.disabled = true\n }\n }\n if (nativeProps.accessibilityErrorMessage != null) {\n viewProps['aria-errormessage'] = nativeProps.accessibilityErrorMessage\n }\n if (nativeProps.accessibilityExpanded != null) {\n viewProps['aria-expanded'] = nativeProps.accessibilityExpanded\n }\n if (nativeProps.accessibilityFlowTo != null) {\n viewProps['aria-flowto'] = processIDRefList(nativeProps.accessibilityFlowTo)\n }\n if (nativeProps.accessibilityHasPopup != null) {\n viewProps['aria-haspopup'] = nativeProps.accessibilityHasPopup\n }\n if (nativeProps.accessibilityHidden === true) {\n viewProps['aria-hidden'] = nativeProps.accessibilityHidden\n }\n if (nativeProps.accessibilityInvalid != null) {\n viewProps['aria-invalid'] = nativeProps.accessibilityInvalid\n }\n if (\n nativeProps.accessibilityKeyShortcuts != null &&\n Array.isArray(nativeProps.accessibilityKeyShortcuts)\n ) {\n viewProps['aria-keyshortcuts'] = nativeProps.accessibilityKeyShortcuts.join(' ')\n }\n if (nativeProps.accessibilityLabel != null) {\n viewProps['aria-label'] = nativeProps.accessibilityLabel\n }\n if (nativeProps.accessibilityLabelledBy != null) {\n viewProps['aria-labelledby'] = processIDRefList(nativeProps.accessibilityLabelledBy)\n }\n if (nativeProps.accessibilityLevel != null) {\n viewProps['aria-level'] = nativeProps.accessibilityLevel\n }\n if (nativeProps.accessibilityLiveRegion != null) {\n viewProps['aria-live'] =\n nativeProps.accessibilityLiveRegion === 'none' ? 'off' : nativeProps.accessibilityLiveRegion\n }\n if (nativeProps.accessibilityModal != null) {\n viewProps['aria-modal'] = nativeProps.accessibilityModal\n }\n if (nativeProps.accessibilityMultiline != null) {\n viewProps['aria-multiline'] = nativeProps.accessibilityMultiline\n }\n if (nativeProps.accessibilityMultiSelectable != null) {\n viewProps['aria-multiselectable'] = nativeProps.accessibilityMultiSelectable\n }\n if (nativeProps.accessibilityOrientation != null) {\n viewProps['aria-orientation'] = nativeProps.accessibilityOrientation\n }\n if (nativeProps.accessibilityOwns != null) {\n viewProps['aria-owns'] = processIDRefList(nativeProps.accessibilityOwns)\n }\n if (nativeProps.accessibilityPlaceholder != null) {\n viewProps['aria-placeholder'] = nativeProps.accessibilityPlaceholder\n }\n if (nativeProps.accessibilityPosInSet != null) {\n viewProps['aria-posinset'] = nativeProps.accessibilityPosInSet\n }\n if (nativeProps.accessibilityPressed != null) {\n viewProps['aria-pressed'] = nativeProps.accessibilityPressed\n }\n if (nativeProps.accessibilityReadOnly != null) {\n viewProps['aria-readonly'] = nativeProps.accessibilityReadOnly\n // Enhance with native semantics\n if (elementType === 'input' || elementType === 'select' || elementType === 'textarea') {\n viewProps.readOnly = true\n }\n }\n if (nativeProps.accessibilityRequired != null) {\n viewProps['aria-required'] = nativeProps.accessibilityRequired\n // Enhance with native semantics\n if (elementType === 'input' || elementType === 'select' || elementType === 'textarea') {\n viewProps.required = true\n }\n }\n if (nativeProps.accessibilityRoleDescription != null) {\n viewProps['aria-roledescription'] = nativeProps.accessibilityRoleDescription\n }\n if (nativeProps.accessibilityRowCount != null) {\n viewProps['aria-rowcount'] = nativeProps.accessibilityRowCount\n }\n if (nativeProps.accessibilityRowIndex != null) {\n viewProps['aria-rowindex'] = nativeProps.accessibilityRowIndex\n }\n if (nativeProps.accessibilityRowSpan != null) {\n viewProps['aria-rowspan'] = nativeProps.accessibilityRowSpan\n }\n if (nativeProps.accessibilitySelected != null) {\n viewProps['aria-selected'] = nativeProps.accessibilitySelected\n }\n if (nativeProps.accessibilitySetSize != null) {\n viewProps['aria-setsize'] = nativeProps.accessibilitySetSize\n }\n if (nativeProps.accessibilitySort != null) {\n viewProps['aria-sort'] = nativeProps.accessibilitySort\n }\n if (nativeProps.accessibilityValueMax != null) {\n viewProps['aria-valuemax'] = nativeProps.accessibilityValueMax\n }\n if (nativeProps.accessibilityValueMin != null) {\n viewProps['aria-valuemin'] = nativeProps.accessibilityValueMin\n }\n if (nativeProps.accessibilityValueNow != null) {\n viewProps['aria-valuenow'] = nativeProps.accessibilityValueNow\n }\n if (nativeProps.accessibilityValueText != null) {\n viewProps['aria-valuetext'] = nativeProps.accessibilityValueText\n }\n\n if (nativeProps.nativeID) {\n viewProps.id = nativeProps.nativeID\n }\n}\n"],
|
|
5
|
+
"mappings": "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",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/helpers/assignNativePropsToWeb.native.tsx"],
|
|
4
|
+
"sourcesContent": ["export function assignNativePropsToWeb(elementType: string, viewProps: any, nativeProps: any) {}\n"],
|
|
5
|
+
"mappings": "AAAO,SAAS,uBAAuB,aAAqB,WAAgB,aAAkB;AAAC;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
class Cache {
|
|
2
|
+
constructor() {
|
|
3
|
+
this.v = {};
|
|
4
|
+
}
|
|
5
|
+
get(key, valStr) {
|
|
6
|
+
var _a;
|
|
7
|
+
return (_a = this.v[key]) == null ? void 0 : _a[valStr];
|
|
8
|
+
}
|
|
9
|
+
set(key, valStr, object) {
|
|
10
|
+
this.v[key] ??= {};
|
|
11
|
+
this.v[key][valStr] = object;
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
const cache = new Cache();
|
|
15
|
+
export {
|
|
16
|
+
cache
|
|
17
|
+
};
|
|
18
|
+
//# sourceMappingURL=cache.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/helpers/cache.ts"],
|
|
4
|
+
"sourcesContent": ["type Value = Object | Array<any> | string | number\n\nexport type Style = { [key: string]: Value }\n\nclass Cache {\n v: Record<string, any> = {}\n\n get(key: string, valStr: string) {\n return this.v[key]?.[valStr]\n }\n\n set(key: string, valStr: string, object: any) {\n this.v[key] ??= {}\n this.v[key][valStr] = object\n }\n}\n\nexport const cache = new Cache()\n"],
|
|
5
|
+
"mappings": "AAIA,MAAM,MAAM;AAAA,EAAZ;AACE,aAAyB,CAAC;AAAA;AAAA,EAE1B,IAAI,KAAa,QAAgB;AAPnC;AAQI,YAAO,UAAK,EAAE,SAAP,mBAAc;AAAA,EACvB;AAAA,EAEA,IAAI,KAAa,QAAgB,QAAa;AAC5C,SAAK,EAAE,SAAS,CAAC;AACjB,SAAK,EAAE,KAAK,UAAU;AAAA,EACxB;AACF;AAEO,MAAM,QAAQ,IAAI,MAAM;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { isWeb } from "@tamagui/constants";
|
|
2
|
+
import { getVariableVariable } from "../createVariable";
|
|
3
|
+
const operators = {
|
|
4
|
+
"+": (a, b) => a + b,
|
|
5
|
+
"-": (a, b) => a - b,
|
|
6
|
+
"/": (a, b) => a / b,
|
|
7
|
+
"*": (a, b) => a * b
|
|
8
|
+
};
|
|
9
|
+
const calc = (...valuesAndOperators) => {
|
|
10
|
+
if (isWeb) {
|
|
11
|
+
let res2 = "calc(";
|
|
12
|
+
for (const cur of valuesAndOperators) {
|
|
13
|
+
if (operators[cur]) {
|
|
14
|
+
res2 += " " + cur + " ";
|
|
15
|
+
} else {
|
|
16
|
+
res2 += convertToVariableOrNumber(cur);
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
return res2 + ")";
|
|
20
|
+
}
|
|
21
|
+
let res = 0;
|
|
22
|
+
let nextOp = null;
|
|
23
|
+
for (const cur of valuesAndOperators) {
|
|
24
|
+
if (operators[cur]) {
|
|
25
|
+
nextOp = operators[cur];
|
|
26
|
+
} else {
|
|
27
|
+
if (nextOp) {
|
|
28
|
+
res = nextOp(res, cur);
|
|
29
|
+
nextOp = null;
|
|
30
|
+
} else {
|
|
31
|
+
res = +cur;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
return res;
|
|
36
|
+
};
|
|
37
|
+
const convertToVariableOrNumber = (v) => {
|
|
38
|
+
const varOrVal = getVariableVariable(v);
|
|
39
|
+
if (typeof varOrVal === "number") {
|
|
40
|
+
return `${varOrVal}px`;
|
|
41
|
+
}
|
|
42
|
+
return varOrVal;
|
|
43
|
+
};
|
|
44
|
+
export {
|
|
45
|
+
calc
|
|
46
|
+
};
|
|
47
|
+
//# sourceMappingURL=calc.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/helpers/calc.ts"],
|
|
4
|
+
"sourcesContent": ["import { isWeb } from '@tamagui/constants'\n\nimport { getVariableVariable } from '../createVariable'\nimport { FontLineHeightTokens, FontSizeTokens, SizeTokens, SpaceTokens } from '../types'\n\n// unused code - not exported\n\n/**\n * Simple calc() that handles native + web\n * on web: outputs a calc() string\n * on native: outputs a plain number\n */\n\nexport type CalcVal =\n | string\n | number\n | SizeTokens\n | SpaceTokens\n | FontSizeTokens\n | FontLineHeightTokens\n\nconst operators = {\n '+': (a: number, b: number) => a + b,\n '-': (a: number, b: number) => a - b,\n '/': (a: number, b: number) => a / b,\n '*': (a: number, b: number) => a * b,\n}\n\ntype Operator = keyof typeof operators\n\nexport const calc = (...valuesAndOperators: (CalcVal | Operator)[]) => {\n if (isWeb) {\n let res = 'calc('\n for (const cur of valuesAndOperators) {\n if (operators[cur as any]) {\n // spaces are significant\n res += ' ' + cur + ' '\n } else {\n res += convertToVariableOrNumber(cur)\n }\n }\n return res + ')'\n }\n\n let res = 0\n let nextOp: any = null\n for (const cur of valuesAndOperators) {\n if (operators[cur as any]) {\n nextOp = operators[cur as any]\n } else {\n if (nextOp) {\n res = nextOp(res, cur)\n nextOp = null\n } else {\n res = +cur\n }\n }\n }\n return res\n}\n\nconst convertToVariableOrNumber = (v: any) => {\n const varOrVal = getVariableVariable(v)\n if (typeof varOrVal === 'number') {\n return `${varOrVal}px`\n }\n return varOrVal\n}\n"],
|
|
5
|
+
"mappings": "AAAA,SAAS,aAAa;AAEtB,SAAS,2BAA2B;AAmBpC,MAAM,YAAY;AAAA,EAChB,KAAK,CAAC,GAAW,MAAc,IAAI;AAAA,EACnC,KAAK,CAAC,GAAW,MAAc,IAAI;AAAA,EACnC,KAAK,CAAC,GAAW,MAAc,IAAI;AAAA,EACnC,KAAK,CAAC,GAAW,MAAc,IAAI;AACrC;AAIO,MAAM,OAAO,IAAI,uBAA+C;AACrE,MAAI,OAAO;AACT,QAAIA,OAAM;AACV,eAAW,OAAO,oBAAoB;AACpC,UAAI,UAAU,MAAa;AAEzB,QAAAA,QAAO,MAAM,MAAM;AAAA,MACrB,OAAO;AACL,QAAAA,QAAO,0BAA0B,GAAG;AAAA,MACtC;AAAA,IACF;AACA,WAAOA,OAAM;AAAA,EACf;AAEA,MAAI,MAAM;AACV,MAAI,SAAc;AAClB,aAAW,OAAO,oBAAoB;AACpC,QAAI,UAAU,MAAa;AACzB,eAAS,UAAU;AAAA,IACrB,OAAO;AACL,UAAI,QAAQ;AACV,cAAM,OAAO,KAAK,GAAG;AACrB,iBAAS;AAAA,MACX,OAAO;AACL,cAAM,CAAC;AAAA,MACT;AAAA,IACF;AAAA,EACF;AACA,SAAO;AACT;AAEA,MAAM,4BAA4B,CAAC,MAAW;AAC5C,QAAM,WAAW,oBAAoB,CAAC;AACtC,MAAI,OAAO,aAAa,UAAU;AAChC,WAAO,GAAG;AAAA,EACZ;AACA,SAAO;AACT;",
|
|
6
|
+
"names": ["res"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { getVariableValue } from "../createVariable";
|
|
2
|
+
const getFont = (val = "$4", { fonts, theme, props }) => {
|
|
3
|
+
var _a, _b, _c;
|
|
4
|
+
const family = getVariableValue(props.fontFamily) || "$body";
|
|
5
|
+
const font = fonts[family] || fonts["$body"];
|
|
6
|
+
if (!font) {
|
|
7
|
+
if (process.env.NODE_ENV === "development") {
|
|
8
|
+
console.warn("\u26A0\uFE0F no font found", { family, fontTokens: Object.keys(fonts), val });
|
|
9
|
+
}
|
|
10
|
+
return {};
|
|
11
|
+
}
|
|
12
|
+
const fontFamily = font.family;
|
|
13
|
+
const fontSize = props.fontSize || font.size[val];
|
|
14
|
+
const lineHeight = props.lineHeight || font.lineHeight[val];
|
|
15
|
+
const fontWeight = props.fontWeight || font.weight[val];
|
|
16
|
+
const letterSpacing = props.letterSpacing || font.letterSpacing[val];
|
|
17
|
+
const fontStyle = props.fontStyle || ((_a = font.style) == null ? void 0 : _a[val]);
|
|
18
|
+
const textTransform = props.textTransform || ((_b = font.transform) == null ? void 0 : _b[val]);
|
|
19
|
+
const color = props.color || ((_c = font.color) == null ? void 0 : _c[val]) || theme.color;
|
|
20
|
+
const style = {
|
|
21
|
+
color,
|
|
22
|
+
fontStyle,
|
|
23
|
+
textTransform,
|
|
24
|
+
fontFamily,
|
|
25
|
+
fontWeight,
|
|
26
|
+
letterSpacing,
|
|
27
|
+
fontSize,
|
|
28
|
+
lineHeight
|
|
29
|
+
};
|
|
30
|
+
if (process.env.NODE_ENV === "development") {
|
|
31
|
+
if (props["debug"]) {
|
|
32
|
+
console.groupCollapsed(" \u{1F539} getFont", val, props["fontWeight"], props["fow"]);
|
|
33
|
+
console.log({ style, props, font });
|
|
34
|
+
console.groupEnd();
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
return style;
|
|
38
|
+
};
|
|
39
|
+
export {
|
|
40
|
+
getFont
|
|
41
|
+
};
|
|
42
|
+
//# sourceMappingURL=getFont.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/helpers/getFont.tsx"],
|
|
4
|
+
"sourcesContent": ["/* eslint-disable no-console */\nimport { 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 if (process.env.NODE_ENV === 'development') {\n console.warn('\u26A0\uFE0F no font found', { family, fontTokens: Object.keys(fonts), val })\n }\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.groupCollapsed(' \uD83D\uDD39 getFont', val, props['fontWeight'], props['fow'])\n console.log({ style, props, font })\n console.groupEnd()\n }\n }\n return style\n}\n"],
|
|
5
|
+
"mappings": "AACA,SAAS,wBAAwB;AAG1B,MAAM,UAA4D,CACvE,MAAM,MACN,EAAE,OAAO,OAAO,MAAM,MACnB;AAPL;AAQE,QAAM,SAAS,iBAAiB,MAAM,UAAU,KAAK;AACrD,QAAM,OAAO,MAAM,WAAW,MAAM;AACpC,MAAI,CAAC,MAAM;AACT,QAAI,QAAQ,IAAI,aAAa,eAAe;AAC1C,cAAQ,KAAK,8BAAoB,EAAE,QAAQ,YAAY,OAAO,KAAK,KAAK,GAAG,IAAI,CAAC;AAAA,IAClF;AACA,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,eAAa,UAAK,UAAL,mBAAa;AAClD,QAAM,gBAAgB,MAAM,mBAAiB,UAAK,cAAL,mBAAiB;AAC9D,QAAM,QAAQ,MAAM,WAAS,UAAK,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,eAAe,uBAAgB,KAAK,MAAM,eAAe,MAAM,MAAM;AAC7E,cAAQ,IAAI,EAAE,OAAO,OAAO,KAAK,CAAC;AAClC,cAAQ,SAAS;AAAA,IACnB;AAAA,EACF;AACA,SAAO;AACT;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { getTokens } from "../config";
|
|
2
|
+
const getSize = (size, shift = 0, bounds = [0]) => {
|
|
3
|
+
return stepTokenUpOrDown(getTokens(true).size, size, shift, bounds);
|
|
4
|
+
};
|
|
5
|
+
const stepTokenUpOrDown = (tokens, current, shift = 0, bounds = [0]) => {
|
|
6
|
+
const sizeNames = Object.keys(tokens);
|
|
7
|
+
const currentKeyNum = (typeof current === "string" ? current.replace("$", "") : current) || "4";
|
|
8
|
+
const nextKeyName = `$${+currentKeyNum + shift}`;
|
|
9
|
+
const min = bounds[0] ?? 0;
|
|
10
|
+
const max = bounds[1] ?? sizeNames.length - 1;
|
|
11
|
+
const index = Math.min(max, Math.max(min, sizeNames.indexOf(nextKeyName)));
|
|
12
|
+
const key = sizeNames[index];
|
|
13
|
+
return tokens[key] || tokens["$4"];
|
|
14
|
+
};
|
|
15
|
+
export {
|
|
16
|
+
getSize,
|
|
17
|
+
stepTokenUpOrDown
|
|
18
|
+
};
|
|
19
|
+
//# sourceMappingURL=getSize.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
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\nexport const stepTokenUpOrDown = (\n tokens: Object,\n current?: SizeTokens | SpaceTokens | string,\n shift = 0,\n bounds = [0]\n) => {\n const sizeNames = Object.keys(tokens)\n const currentKeyNum = (typeof current === 'string' ? current.replace('$', '') : current) || '4'\n const nextKeyName = `$${+currentKeyNum + shift}`\n const min = bounds[0] ?? 0\n const max = bounds[1] ?? sizeNames.length - 1\n const index = Math.min(max, Math.max(min, sizeNames.indexOf(nextKeyName)))\n const key = sizeNames[index]\n return tokens[key] || tokens['$4']\n}\n"],
|
|
5
|
+
"mappings": "AAAA,SAAS,iBAAiB;AAGnB,MAAM,UAAU,CAAC,MAA+B,QAAQ,GAAG,SAAS,CAAC,CAAC,MAAM;AACjF,SAAO,kBAAkB,UAAU,IAAI,EAAE,MAAM,MAAM,OAAO,MAAM;AACpE;AAEO,MAAM,oBAAoB,CAC/B,QACA,SACA,QAAQ,GACR,SAAS,CAAC,CAAC,MACR;AACH,QAAM,YAAY,OAAO,KAAK,MAAM;AACpC,QAAM,iBAAiB,OAAO,YAAY,WAAW,QAAQ,QAAQ,KAAK,EAAE,IAAI,YAAY;AAC5F,QAAM,cAAc,IAAI,CAAC,gBAAgB;AACzC,QAAM,MAAM,OAAO,MAAM;AACzB,QAAM,MAAM,OAAO,MAAM,UAAU,SAAS;AAC5C,QAAM,QAAQ,KAAK,IAAI,KAAK,KAAK,IAAI,KAAK,UAAU,QAAQ,WAAW,CAAC,CAAC;AACzE,QAAM,MAAM,UAAU;AACtB,SAAO,OAAO,QAAQ,OAAO;AAC/B;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -646,16 +646,21 @@ const getSplitStyles = (props, staticConfig, theme, state, parentSplitStyles, la
|
|
|
646
646
|
}
|
|
647
647
|
if (process.env.TAMAGUI_TARGET === "web") {
|
|
648
648
|
if (shouldDoClasses) {
|
|
649
|
+
const retainedStyles = {};
|
|
649
650
|
if (style["$$css"]) {
|
|
650
651
|
} else {
|
|
651
652
|
const atomic = getStylesAtomic(style);
|
|
652
653
|
for (const atomicStyle of atomic) {
|
|
653
654
|
const key = atomicStyle.property;
|
|
654
|
-
|
|
655
|
-
|
|
655
|
+
if (props.animateOnly && props.animateOnly.includes(key)) {
|
|
656
|
+
retainedStyles[key] = style[key];
|
|
657
|
+
} else {
|
|
658
|
+
addStyleToInsertRules(rulesToInsert, atomicStyle);
|
|
659
|
+
mergeClassName(transforms, classNames, key, atomicStyle.identifier);
|
|
660
|
+
}
|
|
656
661
|
}
|
|
657
662
|
if (!IS_STATIC) {
|
|
658
|
-
style =
|
|
663
|
+
style = retainedStyles;
|
|
659
664
|
}
|
|
660
665
|
}
|
|
661
666
|
}
|