@tamagui/helpers-tamagui 1.14.1 → 1.14.2
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/getSpace.js +34 -1
- package/dist/cjs/getSpace.js.map +2 -2
- package/dist/cjs/index.js +22 -1
- package/dist/cjs/index.js.map +2 -2
- package/dist/cjs/prevent.js +28 -1
- package/dist/cjs/prevent.js.map +2 -2
- package/dist/cjs/useCurrentColor.js +32 -1
- package/dist/cjs/useCurrentColor.js.map +2 -2
- package/dist/cjs/useGetThemedIcon.js +44 -1
- package/dist/cjs/useGetThemedIcon.js.map +2 -2
- package/dist/esm/getSpace.js +10 -1
- package/dist/esm/getSpace.js.map +2 -2
- package/dist/esm/getSpace.mjs +10 -1
- package/dist/esm/getSpace.mjs.map +2 -2
- package/dist/esm/index.js +5 -1
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/index.mjs +5 -1
- package/dist/esm/index.mjs.map +1 -1
- package/dist/esm/prevent.js +4 -1
- package/dist/esm/prevent.js.map +2 -2
- package/dist/esm/prevent.mjs +4 -1
- package/dist/esm/prevent.mjs.map +2 -2
- package/dist/esm/useCurrentColor.js +11 -1
- package/dist/esm/useCurrentColor.js.map +2 -2
- package/dist/esm/useCurrentColor.mjs +11 -1
- package/dist/esm/useCurrentColor.mjs.map +2 -2
- package/dist/esm/useGetThemedIcon.js +20 -1
- package/dist/esm/useGetThemedIcon.js.map +2 -2
- package/dist/esm/useGetThemedIcon.mjs +20 -1
- package/dist/esm/useGetThemedIcon.mjs.map +2 -2
- package/package.json +4 -4
package/dist/cjs/getSpace.js
CHANGED
|
@@ -1,2 +1,35 @@
|
|
|
1
|
-
"use strict";
|
|
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 getSpace_exports = {};
|
|
20
|
+
__export(getSpace_exports, {
|
|
21
|
+
getSpace: () => getSpace
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(getSpace_exports);
|
|
24
|
+
var import_core = require("@tamagui/core");
|
|
25
|
+
const getSpace = (token, sizeUpOrDownBy = 0) => {
|
|
26
|
+
const spaces = (0, import_core.getTokens)().space;
|
|
27
|
+
const spaceNames = Object.keys(spaces);
|
|
28
|
+
const key = spaceNames[Math.max(0, spaceNames.indexOf(String(token || "$true")) + sizeUpOrDownBy)];
|
|
29
|
+
return spaces[key] || spaces["$true"];
|
|
30
|
+
};
|
|
31
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
32
|
+
0 && (module.exports = {
|
|
33
|
+
getSpace
|
|
34
|
+
});
|
|
2
35
|
//# sourceMappingURL=getSpace.js.map
|
package/dist/cjs/getSpace.js.map
CHANGED
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/getSpace.tsx"],
|
|
4
4
|
"sourcesContent": ["import { SpaceTokens, getTokens } from '@tamagui/core'\n\nexport const getSpace = (token?: SpaceTokens | undefined, sizeUpOrDownBy = 0) => {\n const spaces = getTokens().space\n const spaceNames = Object.keys(spaces)\n const key =\n spaceNames[Math.max(0, spaceNames.indexOf(String(token || '$true')) + sizeUpOrDownBy)]\n return (spaces[key] || spaces['$true']) as SpaceTokens\n}\n"],
|
|
5
|
-
"mappings": "
|
|
6
|
-
"names": [
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBAAuC;AAEhC,MAAM,WAAW,CAAC,OAAiC,iBAAiB,MAAM;AAC/E,QAAM,aAAS,uBAAU,EAAE;AAC3B,QAAM,aAAa,OAAO,KAAK,MAAM;AACrC,QAAM,MACJ,WAAW,KAAK,IAAI,GAAG,WAAW,QAAQ,OAAO,SAAS,OAAO,CAAC,IAAI,cAAc,CAAC;AACvF,SAAQ,OAAO,GAAG,KAAK,OAAO,OAAO;AACvC;",
|
|
6
|
+
"names": []
|
|
7
7
|
}
|
package/dist/cjs/index.js
CHANGED
|
@@ -1,2 +1,23 @@
|
|
|
1
|
-
"use strict";
|
|
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 src_exports = {};
|
|
17
|
+
module.exports = __toCommonJS(src_exports);
|
|
18
|
+
__reExport(src_exports, require("@tamagui/helpers"), module.exports);
|
|
19
|
+
__reExport(src_exports, require("./prevent"), module.exports);
|
|
20
|
+
__reExport(src_exports, require("./getSpace"), module.exports);
|
|
21
|
+
__reExport(src_exports, require("./useCurrentColor"), module.exports);
|
|
22
|
+
__reExport(src_exports, require("./useGetThemedIcon"), module.exports);
|
|
2
23
|
//# sourceMappingURL=index.js.map
|
package/dist/cjs/index.js.map
CHANGED
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/index.ts"],
|
|
4
4
|
"sourcesContent": ["export * from '@tamagui/helpers'\nexport * from './prevent'\nexport * from './getSpace'\nexport * from './useCurrentColor'\nexport * from './useGetThemedIcon'\n"],
|
|
5
|
-
"mappings": "
|
|
6
|
-
"names": [
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;AAAA;AAAA;AAAA,wBAAc,6BAAd;AACA,wBAAc,sBADd;AAEA,wBAAc,uBAFd;AAGA,wBAAc,8BAHd;AAIA,wBAAc,+BAJd;",
|
|
6
|
+
"names": []
|
|
7
7
|
}
|
package/dist/cjs/prevent.js
CHANGED
|
@@ -1,2 +1,29 @@
|
|
|
1
|
-
"use strict";
|
|
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 prevent_exports = {};
|
|
20
|
+
__export(prevent_exports, {
|
|
21
|
+
prevent: () => prevent
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(prevent_exports);
|
|
24
|
+
const prevent = (e) => [e.preventDefault(), e.stopPropagation()];
|
|
25
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
26
|
+
0 && (module.exports = {
|
|
27
|
+
prevent
|
|
28
|
+
});
|
|
2
29
|
//# sourceMappingURL=prevent.js.map
|
package/dist/cjs/prevent.js.map
CHANGED
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/prevent.tsx"],
|
|
4
4
|
"sourcesContent": ["export const prevent = (e) => [e.preventDefault(), e.stopPropagation()]\n"],
|
|
5
|
-
"mappings": "
|
|
6
|
-
"names": [
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAO,MAAM,UAAU,CAAC,MAAM,CAAC,EAAE,eAAe,GAAG,EAAE,gBAAgB,CAAC;",
|
|
6
|
+
"names": []
|
|
7
7
|
}
|
|
@@ -1,2 +1,33 @@
|
|
|
1
|
-
"use strict";
|
|
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 useCurrentColor_exports = {};
|
|
20
|
+
__export(useCurrentColor_exports, {
|
|
21
|
+
useCurrentColor: () => useCurrentColor
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(useCurrentColor_exports);
|
|
24
|
+
var import_core = require("@tamagui/core");
|
|
25
|
+
const useCurrentColor = (colorProp) => {
|
|
26
|
+
const theme = (0, import_core.useTheme)();
|
|
27
|
+
return (0, import_core.variableToString)(theme[colorProp] || colorProp || theme.color);
|
|
28
|
+
};
|
|
29
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
30
|
+
0 && (module.exports = {
|
|
31
|
+
useCurrentColor
|
|
32
|
+
});
|
|
2
33
|
//# sourceMappingURL=useCurrentColor.js.map
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/useCurrentColor.tsx"],
|
|
4
4
|
"sourcesContent": ["import {\n ColorTokens,\n UnionableString,\n Variable,\n useTheme,\n variableToString,\n} from '@tamagui/core'\nimport type { TextStyle } from 'react-native'\n\nexport const useCurrentColor = (colorProp: ColorProp) => {\n const theme = useTheme()\n return variableToString(theme[colorProp as any] || colorProp || theme.color)\n}\n\nexport type ColorProp =\n | UnionableString\n | Variable\n | ColorTokens\n | TextStyle['color']\n | undefined\n"],
|
|
5
|
-
"mappings": "
|
|
6
|
-
"names": [
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBAMO;AAGA,MAAM,kBAAkB,CAAC,cAAyB;AACvD,QAAM,YAAQ,sBAAS;AACvB,aAAO,8BAAiB,MAAM,SAAgB,KAAK,aAAa,MAAM,KAAK;AAC7E;",
|
|
6
|
+
"names": []
|
|
7
7
|
}
|
|
@@ -1,2 +1,45 @@
|
|
|
1
|
-
"use strict";
|
|
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 useGetThemedIcon_exports = {};
|
|
20
|
+
__export(useGetThemedIcon_exports, {
|
|
21
|
+
useGetThemedIcon: () => useGetThemedIcon
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(useGetThemedIcon_exports);
|
|
24
|
+
var import_react = require("react");
|
|
25
|
+
var import_useCurrentColor = require("./useCurrentColor");
|
|
26
|
+
const useGetThemedIcon = (props) => {
|
|
27
|
+
const color = (0, import_useCurrentColor.useCurrentColor)(props.color);
|
|
28
|
+
return (el) => {
|
|
29
|
+
if (!el)
|
|
30
|
+
return el;
|
|
31
|
+
if ((0, import_react.isValidElement)(el)) {
|
|
32
|
+
return (0, import_react.cloneElement)(el, {
|
|
33
|
+
...props,
|
|
34
|
+
// @ts-expect-error
|
|
35
|
+
...el.props
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
return (0, import_react.createElement)(el, props);
|
|
39
|
+
};
|
|
40
|
+
};
|
|
41
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
42
|
+
0 && (module.exports = {
|
|
43
|
+
useGetThemedIcon
|
|
44
|
+
});
|
|
2
45
|
//# sourceMappingURL=useGetThemedIcon.js.map
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/useGetThemedIcon.tsx"],
|
|
4
4
|
"sourcesContent": ["import { cloneElement, createElement, isValidElement } from 'react'\n\nimport { ColorProp, useCurrentColor } from './useCurrentColor'\n\nexport const useGetThemedIcon = (props: { color: ColorProp; size: number }) => {\n const color = useCurrentColor(props.color)\n return (el: any) => {\n if (!el) return el\n if (isValidElement(el)) {\n return cloneElement(el, {\n ...props,\n // @ts-expect-error\n ...el.props,\n })\n }\n return createElement(el, props)\n }\n}\n"],
|
|
5
|
-
"mappings": "
|
|
6
|
-
"names": [
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAA4D;AAE5D,6BAA2C;AAEpC,MAAM,mBAAmB,CAAC,UAA8C;AAC7E,QAAM,YAAQ,wCAAgB,MAAM,KAAK;AACzC,SAAO,CAAC,OAAY;AAClB,QAAI,CAAC;AAAI,aAAO;AAChB,YAAI,6BAAe,EAAE,GAAG;AACtB,iBAAO,2BAAa,IAAI;AAAA,QACtB,GAAG;AAAA;AAAA,QAEH,GAAG,GAAG;AAAA,MACR,CAAC;AAAA,IACH;AACA,eAAO,4BAAc,IAAI,KAAK;AAAA,EAChC;AACF;",
|
|
6
|
+
"names": []
|
|
7
7
|
}
|
package/dist/esm/getSpace.js
CHANGED
|
@@ -1,2 +1,11 @@
|
|
|
1
|
-
import{getTokens
|
|
1
|
+
import { getTokens } from "@tamagui/core";
|
|
2
|
+
const getSpace = (token, sizeUpOrDownBy = 0) => {
|
|
3
|
+
const spaces = getTokens().space;
|
|
4
|
+
const spaceNames = Object.keys(spaces);
|
|
5
|
+
const key = spaceNames[Math.max(0, spaceNames.indexOf(String(token || "$true")) + sizeUpOrDownBy)];
|
|
6
|
+
return spaces[key] || spaces["$true"];
|
|
7
|
+
};
|
|
8
|
+
export {
|
|
9
|
+
getSpace
|
|
10
|
+
};
|
|
2
11
|
//# sourceMappingURL=getSpace.js.map
|
package/dist/esm/getSpace.js.map
CHANGED
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/getSpace.tsx"],
|
|
4
4
|
"sourcesContent": ["import { SpaceTokens, getTokens } from '@tamagui/core'\n\nexport const getSpace = (token?: SpaceTokens | undefined, sizeUpOrDownBy = 0) => {\n const spaces = getTokens().space\n const spaceNames = Object.keys(spaces)\n const key =\n spaceNames[Math.max(0, spaceNames.indexOf(String(token || '$true')) + sizeUpOrDownBy)]\n return (spaces[key] || spaces['$true']) as SpaceTokens\n}\n"],
|
|
5
|
-
"mappings": "AAAA,
|
|
6
|
-
"names": [
|
|
5
|
+
"mappings": "AAAA,SAAsB,iBAAiB;AAEhC,MAAM,WAAW,CAAC,OAAiC,iBAAiB,MAAM;AAC/E,QAAM,SAAS,UAAU,EAAE;AAC3B,QAAM,aAAa,OAAO,KAAK,MAAM;AACrC,QAAM,MACJ,WAAW,KAAK,IAAI,GAAG,WAAW,QAAQ,OAAO,SAAS,OAAO,CAAC,IAAI,cAAc,CAAC;AACvF,SAAQ,OAAO,GAAG,KAAK,OAAO,OAAO;AACvC;",
|
|
6
|
+
"names": []
|
|
7
7
|
}
|
package/dist/esm/getSpace.mjs
CHANGED
|
@@ -1,2 +1,11 @@
|
|
|
1
|
-
import{getTokens
|
|
1
|
+
import { getTokens } from "@tamagui/core";
|
|
2
|
+
const getSpace = (token, sizeUpOrDownBy = 0) => {
|
|
3
|
+
const spaces = getTokens().space;
|
|
4
|
+
const spaceNames = Object.keys(spaces);
|
|
5
|
+
const key = spaceNames[Math.max(0, spaceNames.indexOf(String(token || "$true")) + sizeUpOrDownBy)];
|
|
6
|
+
return spaces[key] || spaces["$true"];
|
|
7
|
+
};
|
|
8
|
+
export {
|
|
9
|
+
getSpace
|
|
10
|
+
};
|
|
2
11
|
//# sourceMappingURL=getSpace.mjs.map
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/getSpace.tsx"],
|
|
4
4
|
"sourcesContent": ["import { SpaceTokens, getTokens } from '@tamagui/core'\n\nexport const getSpace = (token?: SpaceTokens | undefined, sizeUpOrDownBy = 0) => {\n const spaces = getTokens().space\n const spaceNames = Object.keys(spaces)\n const key =\n spaceNames[Math.max(0, spaceNames.indexOf(String(token || '$true')) + sizeUpOrDownBy)]\n return (spaces[key] || spaces['$true']) as SpaceTokens\n}\n"],
|
|
5
|
-
"mappings": "AAAA,
|
|
6
|
-
"names": [
|
|
5
|
+
"mappings": "AAAA,SAAsB,iBAAiB;AAEhC,MAAM,WAAW,CAAC,OAAiC,iBAAiB,MAAM;AAC/E,QAAM,SAAS,UAAU,EAAE;AAC3B,QAAM,aAAa,OAAO,KAAK,MAAM;AACrC,QAAM,MACJ,WAAW,KAAK,IAAI,GAAG,WAAW,QAAQ,OAAO,SAAS,OAAO,CAAC,IAAI,cAAc,CAAC;AACvF,SAAQ,OAAO,GAAG,KAAK,OAAO,OAAO;AACvC;",
|
|
6
|
+
"names": []
|
|
7
7
|
}
|
package/dist/esm/index.js
CHANGED
|
@@ -1,2 +1,6 @@
|
|
|
1
|
-
export*from"@tamagui/helpers";
|
|
1
|
+
export * from "@tamagui/helpers";
|
|
2
|
+
export * from "./prevent";
|
|
3
|
+
export * from "./getSpace";
|
|
4
|
+
export * from "./useCurrentColor";
|
|
5
|
+
export * from "./useGetThemedIcon";
|
|
2
6
|
//# sourceMappingURL=index.js.map
|
package/dist/esm/index.js.map
CHANGED
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/index.ts"],
|
|
4
4
|
"sourcesContent": ["export * from '@tamagui/helpers'\nexport * from './prevent'\nexport * from './getSpace'\nexport * from './useCurrentColor'\nexport * from './useGetThemedIcon'\n"],
|
|
5
|
-
"mappings": "AAAA,
|
|
5
|
+
"mappings": "AAAA,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/dist/esm/index.mjs
CHANGED
|
@@ -1,2 +1,6 @@
|
|
|
1
|
-
export*from"@tamagui/helpers";
|
|
1
|
+
export * from "@tamagui/helpers";
|
|
2
|
+
export * from "./prevent";
|
|
3
|
+
export * from "./getSpace";
|
|
4
|
+
export * from "./useCurrentColor";
|
|
5
|
+
export * from "./useGetThemedIcon";
|
|
2
6
|
//# sourceMappingURL=index.mjs.map
|
package/dist/esm/index.mjs.map
CHANGED
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/index.ts"],
|
|
4
4
|
"sourcesContent": ["export * from '@tamagui/helpers'\nexport * from './prevent'\nexport * from './getSpace'\nexport * from './useCurrentColor'\nexport * from './useGetThemedIcon'\n"],
|
|
5
|
-
"mappings": "AAAA,
|
|
5
|
+
"mappings": "AAAA,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/dist/esm/prevent.js
CHANGED
package/dist/esm/prevent.js.map
CHANGED
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/prevent.tsx"],
|
|
4
4
|
"sourcesContent": ["export const prevent = (e) => [e.preventDefault(), e.stopPropagation()]\n"],
|
|
5
|
-
"mappings": "AAAO,
|
|
6
|
-
"names": [
|
|
5
|
+
"mappings": "AAAO,MAAM,UAAU,CAAC,MAAM,CAAC,EAAE,eAAe,GAAG,EAAE,gBAAgB,CAAC;",
|
|
6
|
+
"names": []
|
|
7
7
|
}
|
package/dist/esm/prevent.mjs
CHANGED
package/dist/esm/prevent.mjs.map
CHANGED
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/prevent.tsx"],
|
|
4
4
|
"sourcesContent": ["export const prevent = (e) => [e.preventDefault(), e.stopPropagation()]\n"],
|
|
5
|
-
"mappings": "AAAO,
|
|
6
|
-
"names": [
|
|
5
|
+
"mappings": "AAAO,MAAM,UAAU,CAAC,MAAM,CAAC,EAAE,eAAe,GAAG,EAAE,gBAAgB,CAAC;",
|
|
6
|
+
"names": []
|
|
7
7
|
}
|
|
@@ -1,2 +1,12 @@
|
|
|
1
|
-
import
|
|
1
|
+
import {
|
|
2
|
+
useTheme,
|
|
3
|
+
variableToString
|
|
4
|
+
} from "@tamagui/core";
|
|
5
|
+
const useCurrentColor = (colorProp) => {
|
|
6
|
+
const theme = useTheme();
|
|
7
|
+
return variableToString(theme[colorProp] || colorProp || theme.color);
|
|
8
|
+
};
|
|
9
|
+
export {
|
|
10
|
+
useCurrentColor
|
|
11
|
+
};
|
|
2
12
|
//# sourceMappingURL=useCurrentColor.js.map
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/useCurrentColor.tsx"],
|
|
4
4
|
"sourcesContent": ["import {\n ColorTokens,\n UnionableString,\n Variable,\n useTheme,\n variableToString,\n} from '@tamagui/core'\nimport type { TextStyle } from 'react-native'\n\nexport const useCurrentColor = (colorProp: ColorProp) => {\n const theme = useTheme()\n return variableToString(theme[colorProp as any] || colorProp || theme.color)\n}\n\nexport type ColorProp =\n | UnionableString\n | Variable\n | ColorTokens\n | TextStyle['color']\n | undefined\n"],
|
|
5
|
-
"mappings": "AAAA,
|
|
6
|
-
"names": [
|
|
5
|
+
"mappings": "AAAA;AAAA,EAIE;AAAA,EACA;AAAA,OACK;AAGA,MAAM,kBAAkB,CAAC,cAAyB;AACvD,QAAM,QAAQ,SAAS;AACvB,SAAO,iBAAiB,MAAM,SAAgB,KAAK,aAAa,MAAM,KAAK;AAC7E;",
|
|
6
|
+
"names": []
|
|
7
7
|
}
|
|
@@ -1,2 +1,12 @@
|
|
|
1
|
-
import
|
|
1
|
+
import {
|
|
2
|
+
useTheme,
|
|
3
|
+
variableToString
|
|
4
|
+
} from "@tamagui/core";
|
|
5
|
+
const useCurrentColor = (colorProp) => {
|
|
6
|
+
const theme = useTheme();
|
|
7
|
+
return variableToString(theme[colorProp] || colorProp || theme.color);
|
|
8
|
+
};
|
|
9
|
+
export {
|
|
10
|
+
useCurrentColor
|
|
11
|
+
};
|
|
2
12
|
//# sourceMappingURL=useCurrentColor.mjs.map
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/useCurrentColor.tsx"],
|
|
4
4
|
"sourcesContent": ["import {\n ColorTokens,\n UnionableString,\n Variable,\n useTheme,\n variableToString,\n} from '@tamagui/core'\nimport type { TextStyle } from 'react-native'\n\nexport const useCurrentColor = (colorProp: ColorProp) => {\n const theme = useTheme()\n return variableToString(theme[colorProp as any] || colorProp || theme.color)\n}\n\nexport type ColorProp =\n | UnionableString\n | Variable\n | ColorTokens\n | TextStyle['color']\n | undefined\n"],
|
|
5
|
-
"mappings": "AAAA,
|
|
6
|
-
"names": [
|
|
5
|
+
"mappings": "AAAA;AAAA,EAIE;AAAA,EACA;AAAA,OACK;AAGA,MAAM,kBAAkB,CAAC,cAAyB;AACvD,QAAM,QAAQ,SAAS;AACvB,SAAO,iBAAiB,MAAM,SAAgB,KAAK,aAAa,MAAM,KAAK;AAC7E;",
|
|
6
|
+
"names": []
|
|
7
7
|
}
|
|
@@ -1,2 +1,21 @@
|
|
|
1
|
-
import{cloneElement
|
|
1
|
+
import { cloneElement, createElement, isValidElement } from "react";
|
|
2
|
+
import { useCurrentColor } from "./useCurrentColor";
|
|
3
|
+
const useGetThemedIcon = (props) => {
|
|
4
|
+
const color = useCurrentColor(props.color);
|
|
5
|
+
return (el) => {
|
|
6
|
+
if (!el)
|
|
7
|
+
return el;
|
|
8
|
+
if (isValidElement(el)) {
|
|
9
|
+
return cloneElement(el, {
|
|
10
|
+
...props,
|
|
11
|
+
// @ts-expect-error
|
|
12
|
+
...el.props
|
|
13
|
+
});
|
|
14
|
+
}
|
|
15
|
+
return createElement(el, props);
|
|
16
|
+
};
|
|
17
|
+
};
|
|
18
|
+
export {
|
|
19
|
+
useGetThemedIcon
|
|
20
|
+
};
|
|
2
21
|
//# sourceMappingURL=useGetThemedIcon.js.map
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/useGetThemedIcon.tsx"],
|
|
4
4
|
"sourcesContent": ["import { cloneElement, createElement, isValidElement } from 'react'\n\nimport { ColorProp, useCurrentColor } from './useCurrentColor'\n\nexport const useGetThemedIcon = (props: { color: ColorProp; size: number }) => {\n const color = useCurrentColor(props.color)\n return (el: any) => {\n if (!el) return el\n if (isValidElement(el)) {\n return cloneElement(el, {\n ...props,\n // @ts-expect-error\n ...el.props,\n })\n }\n return createElement(el, props)\n }\n}\n"],
|
|
5
|
-
"mappings": "AAAA,
|
|
6
|
-
"names": [
|
|
5
|
+
"mappings": "AAAA,SAAS,cAAc,eAAe,sBAAsB;AAE5D,SAAoB,uBAAuB;AAEpC,MAAM,mBAAmB,CAAC,UAA8C;AAC7E,QAAM,QAAQ,gBAAgB,MAAM,KAAK;AACzC,SAAO,CAAC,OAAY;AAClB,QAAI,CAAC;AAAI,aAAO;AAChB,QAAI,eAAe,EAAE,GAAG;AACtB,aAAO,aAAa,IAAI;AAAA,QACtB,GAAG;AAAA;AAAA,QAEH,GAAG,GAAG;AAAA,MACR,CAAC;AAAA,IACH;AACA,WAAO,cAAc,IAAI,KAAK;AAAA,EAChC;AACF;",
|
|
6
|
+
"names": []
|
|
7
7
|
}
|
|
@@ -1,2 +1,21 @@
|
|
|
1
|
-
import{cloneElement
|
|
1
|
+
import { cloneElement, createElement, isValidElement } from "react";
|
|
2
|
+
import { useCurrentColor } from "./useCurrentColor";
|
|
3
|
+
const useGetThemedIcon = (props) => {
|
|
4
|
+
const color = useCurrentColor(props.color);
|
|
5
|
+
return (el) => {
|
|
6
|
+
if (!el)
|
|
7
|
+
return el;
|
|
8
|
+
if (isValidElement(el)) {
|
|
9
|
+
return cloneElement(el, {
|
|
10
|
+
...props,
|
|
11
|
+
// @ts-expect-error
|
|
12
|
+
...el.props
|
|
13
|
+
});
|
|
14
|
+
}
|
|
15
|
+
return createElement(el, props);
|
|
16
|
+
};
|
|
17
|
+
};
|
|
18
|
+
export {
|
|
19
|
+
useGetThemedIcon
|
|
20
|
+
};
|
|
2
21
|
//# sourceMappingURL=useGetThemedIcon.mjs.map
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/useGetThemedIcon.tsx"],
|
|
4
4
|
"sourcesContent": ["import { cloneElement, createElement, isValidElement } from 'react'\n\nimport { ColorProp, useCurrentColor } from './useCurrentColor'\n\nexport const useGetThemedIcon = (props: { color: ColorProp; size: number }) => {\n const color = useCurrentColor(props.color)\n return (el: any) => {\n if (!el) return el\n if (isValidElement(el)) {\n return cloneElement(el, {\n ...props,\n // @ts-expect-error\n ...el.props,\n })\n }\n return createElement(el, props)\n }\n}\n"],
|
|
5
|
-
"mappings": "AAAA,
|
|
6
|
-
"names": [
|
|
5
|
+
"mappings": "AAAA,SAAS,cAAc,eAAe,sBAAsB;AAE5D,SAAoB,uBAAuB;AAEpC,MAAM,mBAAmB,CAAC,UAA8C;AAC7E,QAAM,QAAQ,gBAAgB,MAAM,KAAK;AACzC,SAAO,CAAC,OAAY;AAClB,QAAI,CAAC;AAAI,aAAO;AAChB,QAAI,eAAe,EAAE,GAAG;AACtB,aAAO,aAAa,IAAI;AAAA,QACtB,GAAG;AAAA;AAAA,QAEH,GAAG,GAAG;AAAA,MACR,CAAC;AAAA,IACH;AACA,WAAO,cAAc,IAAI,KAAK;AAAA,EAChC;AACF;",
|
|
6
|
+
"names": []
|
|
7
7
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tamagui/helpers-tamagui",
|
|
3
|
-
"version": "1.14.
|
|
3
|
+
"version": "1.14.2",
|
|
4
4
|
"source": "src/index.ts",
|
|
5
5
|
"types": "./types/index.d.ts",
|
|
6
6
|
"main": "dist/cjs",
|
|
@@ -19,11 +19,11 @@
|
|
|
19
19
|
"clean:build": "tamagui-build clean:build"
|
|
20
20
|
},
|
|
21
21
|
"dependencies": {
|
|
22
|
-
"@tamagui/core": "1.14.
|
|
23
|
-
"@tamagui/helpers": "1.14.
|
|
22
|
+
"@tamagui/core": "1.14.2",
|
|
23
|
+
"@tamagui/helpers": "1.14.2"
|
|
24
24
|
},
|
|
25
25
|
"devDependencies": {
|
|
26
|
-
"@tamagui/build": "1.14.
|
|
26
|
+
"@tamagui/build": "1.14.2",
|
|
27
27
|
"react": "^18.2.0",
|
|
28
28
|
"react-native": "^0.71.4",
|
|
29
29
|
"vitest": "^0.26.3"
|