@tamagui/linear-gradient 2.7.7 → 3.0.0-beta.643.1
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/LinearGradient.cjs +53 -63
- package/dist/cjs/LinearGradient.native.cjs +76 -0
- package/dist/cjs/LinearGradient.native.js +56 -65
- package/dist/cjs/LinearGradient.native.js.map +1 -1
- package/dist/cjs/index.cjs +15 -18
- package/dist/cjs/index.native.cjs +27 -0
- package/dist/cjs/index.native.js +15 -17
- package/dist/cjs/index.native.js.map +1 -1
- package/dist/cjs/linear-gradient.cjs +97 -122
- package/dist/cjs/linear-gradient.native.cjs +37 -0
- package/dist/cjs/linear-gradient.native.js +22 -26
- package/dist/cjs/linear-gradient.native.js.map +1 -1
- package/dist/esm/LinearGradient.mjs +42 -47
- package/dist/esm/LinearGradient.mjs.map +1 -1
- package/dist/esm/LinearGradient.native.js +46 -51
- package/dist/esm/LinearGradient.native.js.map +1 -1
- package/dist/esm/index.js +2 -2
- package/dist/esm/index.mjs +2 -2
- package/dist/esm/index.native.js +2 -2
- package/dist/esm/linear-gradient.mjs +81 -96
- package/dist/esm/linear-gradient.mjs.map +1 -1
- package/dist/esm/linear-gradient.native.js +10 -10
- package/dist/esm/linear-gradient.native.js.map +1 -1
- package/dist/jsx/LinearGradient.mjs +42 -47
- package/dist/jsx/LinearGradient.mjs.map +1 -1
- package/dist/jsx/LinearGradient.native.cjs +76 -0
- package/dist/jsx/LinearGradient.native.js +56 -65
- package/dist/jsx/LinearGradient.native.js.map +1 -1
- package/dist/jsx/index.js +2 -2
- package/dist/jsx/index.mjs +2 -2
- package/dist/jsx/index.native.cjs +27 -0
- package/dist/jsx/index.native.js +15 -17
- package/dist/jsx/index.native.js.map +1 -1
- package/dist/jsx/linear-gradient.mjs +81 -96
- package/dist/jsx/linear-gradient.mjs.map +1 -1
- package/dist/jsx/linear-gradient.native.cjs +37 -0
- package/dist/jsx/linear-gradient.native.js +22 -26
- package/dist/jsx/linear-gradient.native.js.map +1 -1
- package/package.json +9 -8
- package/src/LinearGradient.tsx +16 -5
- package/types/LinearGradient.d.ts +7 -5
- package/types/LinearGradient.d.ts.map +1 -1
- package/types/linear-gradient.d.ts +2 -1
- package/types/linear-gradient.d.ts.map +1 -1
- package/types/linear-gradient.native.d.ts +1 -1
- package/types/linear-gradient.native.d.ts.map +1 -1
- package/dist/esm/index.js.map +0 -1
- package/dist/esm/index.mjs.map +0 -1
- package/dist/esm/index.native.js.map +0 -1
- package/dist/jsx/index.js.map +0 -1
- package/dist/jsx/index.mjs.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"LinearGradient.native.js","names":[],"sources":["jsx/LinearGradient.native.js"],"sourcesContent":["\"use strict\";\nvar __defProp = Object.defineProperty;\nvar __getOwnPropDesc = Object.getOwnPropertyDescriptor;\nvar __getOwnPropNames = Object.getOwnPropertyNames;\nvar __hasOwnProp = Object.prototype.hasOwnProperty;\nvar __export = (target, all) => {\n for (var name in all)\n __defProp(target, name, { get: all[name], enumerable: true });\n};\nvar __copyProps = (to, from, except, desc) => {\n if (from && typeof from === \"object\" || typeof from === \"function\") {\n for (let key of __getOwnPropNames(from))\n if (!__hasOwnProp.call(to, key) && key !== except)\n __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });\n }\n return to;\n};\nvar __toCommonJS = (mod) => __copyProps(__defProp({}, \"__esModule\", { value: true }), mod);\nvar LinearGradient_exports = {};\n__export(LinearGradient_exports, {\n LinearGradient: () => LinearGradient\n});\nmodule.exports = __toCommonJS(LinearGradient_exports);\nvar import_jsx_runtime = require(\"react/jsx-runtime\");\nvar import_core = require(\"@tamagui/core\");\nvar import_stacks = require(\"@tamagui/stacks\");\nvar import_linear_gradient = require(\"./linear-gradient\");\nvar LinearGradientFrame = (0, import_core.styled)(import_stacks.YStack, {\n displayName: \"LinearGradient\",\n overflow: \"hidden\",\n position: \"relative\"\n});\nvar LinearGradient = (0, import_core.createStyledHOC)(LinearGradientFrame, function(propsIn, ref) {\n var _props_colors;\n var props = (0, import_core.useProps)(propsIn);\n var { start, end, colors: colorsProp, locations, children, ...stackProps } = props;\n var theme = (0, import_core.useTheme)();\n var colors = ((_props_colors = props.colors) === null || _props_colors === void 0 ? void 0 : _props_colors.map(function(c) {\n var _theme_c;\n var _theme_c_get;\n return (_theme_c_get = (_theme_c = theme[c]) === null || _theme_c === void 0 ? void 0 : _theme_c.get(\"web\")) !== null && _theme_c_get !== void 0 ? _theme_c_get : c;\n })) || [];\n if (process.env.NODE_ENV !== \"production\") {\n if (colors.some(function(c) {\n var normalized = (0, import_core.normalizeColor)(c);\n if (!normalized) {\n return true;\n }\n })) {\n console.error(`LinearGradient: \"colors\" prop contains invalid color tokens: ${colors} fallback to default colors: [\"#000\", \"#fff\"]`);\n colors = [\n \"#000\",\n \"#fff\"\n ];\n }\n }\n return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(LinearGradientFrame, {\n ref,\n ...stackProps,\n children: [\n /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_linear_gradient.LinearGradient, {\n start,\n end,\n colors,\n locations,\n style: gradientStyle\n }),\n children\n ]\n });\n});\nvar gradientStyle = {\n position: \"absolute\",\n top: 0,\n left: 0,\n right: 0,\n bottom: 0,\n zIndex: 0\n};\n//# sourceMappingURL=LinearGradient.js.map\n"],"mappings":";;;;AACA,IAAI,YAAY,OAAO;AACvB,IAAI,mBAAmB,OAAO;AAC9B,IAAI,oBAAoB,OAAO;AAC/B,IAAI,eAAe,OAAO,UAAU;AACpC,IAAI,YAAY,QAAQ,QAAQ;CAC9B,KAAK,IAAI,QAAQ,KACf,UAAU,QAAQ,MAAM;EAAE,KAAK,IAAI;EAAO,YAAY;CAAK,CAAC;AAChE;AACA,IAAI,eAAe,IAAI,MAAM,QAAQ,SAAS;CAC5C,IAAI,QAAQ,OAAO,SAAS,YAAY,OAAO,SAAS,YAAY;EAClE,KAAK,IAAI,OAAO,kBAAkB,IAAI,GACpC,IAAI,CAAC,aAAa,KAAK,IAAI,GAAG,KAAK,QAAQ,QACzC,UAAU,IAAI,KAAK;GAAE,WAAW,KAAK;GAAM,YAAY,EAAE,OAAO,iBAAiB,MAAM,GAAG,MAAM,KAAK;EAAW,CAAC;CACvH;CACA,OAAO;AACT;AACA,IAAI,gBAAgB,QAAQ,YAAY,UAAU,CAAC,GAAG,cAAc,EAAE,OAAO,KAAK,CAAC,GAAG,GAAG;AACzF,IAAI,yBAAyB,CAAC;AAC9B,SAAS,wBAAwB,EAC/B,sBAAsB,eACxB,CAAC;AACD,OAAO,UAAU,aAAa,sBAAsB;AACpD,IAAI,qBAAqB,QAAQ,mBAAmB;AACpD,IAAI,cAAc,QAAQ,eAAe;AACzC,IAAI,gBAAgB,QAAQ,iBAAiB;AAC7C,IAAI,yBAAyB,QAAQ,6BAAmB;AACxD,IAAI,uBAAuB,GAAG,YAAY,QAAQ,cAAc,QAAQ;CACtE,aAAa;CACb,UAAU;CACV,UAAU;AACZ,CAAC;AACD,IAAI,kBAAkB,GAAG,YAAY,iBAAiB,qBAAqB,SAAS,SAAS,KAAK;CAChG,IAAI;CACJ,IAAI,SAAS,GAAG,YAAY,UAAU,OAAO;CAC7C,IAAI,EAAE,OAAO,KAAK,QAAQ,YAAY,WAAW,UAAU,GAAG,eAAe;CAC7E,IAAI,SAAS,GAAG,YAAY,UAAU;CACtC,IAAI,WAAW,gBAAgB,MAAM,YAAY,QAAQ,kBAAkB,KAAK,IAAI,KAAK,IAAI,cAAc,IAAI,SAAS,GAAG;EACzH,IAAI;EACJ,IAAI;EACJ,QAAQ,gBAAgB,WAAW,MAAM,QAAQ,QAAQ,aAAa,KAAK,IAAI,KAAK,IAAI,SAAS,IAAI,KAAK,OAAO,QAAQ,iBAAiB,KAAK,IAAI,eAAe;CACpK,CAAC,MAAM,CAAC;CACR,IAAI,QAAQ,IAAI,aAAa,cAAc;EACzC,IAAI,OAAO,KAAK,SAAS,GAAG;GAC1B,IAAI,cAAc,GAAG,YAAY,gBAAgB,CAAC;GAClD,IAAI,CAAC,YAAY;IACf,OAAO;GACT;EACF,CAAC,GAAG;GACF,QAAQ,MAAM,gEAAgE,OAAO,8CAA8C;GACnI,SAAS,CACP,QACA,MACF;EACF;CACF;CACA,OAAuB,iBAAC,GAAG,mBAAmB,MAAM,qBAAqB;EACvE;EACA,GAAG;EACH,UAAU,CACQ,iBAAC,GAAG,mBAAmB,KAAK,uBAAuB,gBAAgB;GACjF;GACA;GACA;GACA;GACA,OAAO;EACT,CAAC,GACD,QACF;CACF,CAAC;AACH,CAAC;AACD,IAAI,gBAAgB;CAClB,UAAU;CACV,KAAK;CACL,MAAM;CACN,OAAO;CACP,QAAQ;CACR,QAAQ;AACV"}
|
package/dist/jsx/index.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { LinearGradient } from "./LinearGradient.mjs";
|
|
2
|
-
|
|
3
|
-
|
|
2
|
+
|
|
3
|
+
export { LinearGradient };
|
package/dist/jsx/index.mjs
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { LinearGradient } from "./LinearGradient.mjs";
|
|
2
|
-
|
|
3
|
-
|
|
2
|
+
|
|
3
|
+
export { LinearGradient };
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
var __defProp = Object.defineProperty;
|
|
5
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
6
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all) __defProp(target, name, {
|
|
10
|
+
get: all[name],
|
|
11
|
+
enumerable: true
|
|
12
|
+
});
|
|
13
|
+
};
|
|
14
|
+
var __copyProps = (to, from, except, desc) => {
|
|
15
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
16
|
+
for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
17
|
+
get: () => from[key],
|
|
18
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
return to;
|
|
22
|
+
};
|
|
23
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
24
|
+
var index_exports = {};
|
|
25
|
+
__export(index_exports, { LinearGradient: () => import_LinearGradient.LinearGradient });
|
|
26
|
+
module.exports = __toCommonJS(index_exports);
|
|
27
|
+
var import_LinearGradient = require("./LinearGradient.native.js");
|
package/dist/jsx/index.native.js
CHANGED
|
@@ -1,31 +1,29 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
|
|
3
4
|
var __defProp = Object.defineProperty;
|
|
4
5
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
6
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
7
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
8
|
var __export = (target, all) => {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
9
|
+
for (var name in all) __defProp(target, name, {
|
|
10
|
+
get: all[name],
|
|
11
|
+
enumerable: true
|
|
12
|
+
});
|
|
12
13
|
};
|
|
13
14
|
var __copyProps = (to, from, except, desc) => {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
15
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
16
|
+
for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
17
|
+
get: () => from[key],
|
|
18
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
return to;
|
|
21
22
|
};
|
|
22
|
-
var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
|
|
23
|
-
value: true
|
|
24
|
-
}), mod);
|
|
23
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
25
24
|
var index_exports = {};
|
|
26
|
-
__export(index_exports, {
|
|
27
|
-
LinearGradient: () => import_LinearGradient.LinearGradient
|
|
28
|
-
});
|
|
25
|
+
__export(index_exports, { LinearGradient: () => import_LinearGradient.LinearGradient });
|
|
29
26
|
module.exports = __toCommonJS(index_exports);
|
|
30
27
|
var import_LinearGradient = require("./LinearGradient.native.js");
|
|
28
|
+
|
|
31
29
|
//# sourceMappingURL=index.native.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"index.native.js","names":[],"sources":["jsx/index.native.js"],"sourcesContent":["\"use strict\";\nvar __defProp = Object.defineProperty;\nvar __getOwnPropDesc = Object.getOwnPropertyDescriptor;\nvar __getOwnPropNames = Object.getOwnPropertyNames;\nvar __hasOwnProp = Object.prototype.hasOwnProperty;\nvar __export = (target, all) => {\n for (var name in all)\n __defProp(target, name, { get: all[name], enumerable: true });\n};\nvar __copyProps = (to, from, except, desc) => {\n if (from && typeof from === \"object\" || typeof from === \"function\") {\n for (let key of __getOwnPropNames(from))\n if (!__hasOwnProp.call(to, key) && key !== except)\n __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });\n }\n return to;\n};\nvar __toCommonJS = (mod) => __copyProps(__defProp({}, \"__esModule\", { value: true }), mod);\nvar index_exports = {};\n__export(index_exports, {\n LinearGradient: () => import_LinearGradient.LinearGradient\n});\nmodule.exports = __toCommonJS(index_exports);\nvar import_LinearGradient = require(\"./LinearGradient\");\n//# sourceMappingURL=index.js.map\n"],"mappings":";;;;AACA,IAAI,YAAY,OAAO;AACvB,IAAI,mBAAmB,OAAO;AAC9B,IAAI,oBAAoB,OAAO;AAC/B,IAAI,eAAe,OAAO,UAAU;AACpC,IAAI,YAAY,QAAQ,QAAQ;CAC9B,KAAK,IAAI,QAAQ,KACf,UAAU,QAAQ,MAAM;EAAE,KAAK,IAAI;EAAO,YAAY;CAAK,CAAC;AAChE;AACA,IAAI,eAAe,IAAI,MAAM,QAAQ,SAAS;CAC5C,IAAI,QAAQ,OAAO,SAAS,YAAY,OAAO,SAAS,YAAY;EAClE,KAAK,IAAI,OAAO,kBAAkB,IAAI,GACpC,IAAI,CAAC,aAAa,KAAK,IAAI,GAAG,KAAK,QAAQ,QACzC,UAAU,IAAI,KAAK;GAAE,WAAW,KAAK;GAAM,YAAY,EAAE,OAAO,iBAAiB,MAAM,GAAG,MAAM,KAAK;EAAW,CAAC;CACvH;CACA,OAAO;AACT;AACA,IAAI,gBAAgB,QAAQ,YAAY,UAAU,CAAC,GAAG,cAAc,EAAE,OAAO,KAAK,CAAC,GAAG,GAAG;AACzF,IAAI,gBAAgB,CAAC;AACrB,SAAS,eAAe,EACtB,sBAAsB,sBAAsB,eAC9C,CAAC;AACD,OAAO,UAAU,aAAa,aAAa;AAC3C,IAAI,wBAAwB,QAAQ,4BAAkB"}
|
|
@@ -2,110 +2,95 @@ import { normalizeColor } from "@tamagui/core";
|
|
|
2
2
|
import * as React from "react";
|
|
3
3
|
import { View } from "react-native-web";
|
|
4
4
|
import { jsx } from "react/jsx-runtime";
|
|
5
|
+
|
|
5
6
|
function needsDimensionAwareAngle(start, end) {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
7
|
+
if (!start && !end) return false;
|
|
8
|
+
const startX = start?.[0] ?? .5;
|
|
9
|
+
const endX = end?.[0] ?? .5;
|
|
10
|
+
return startX !== endX;
|
|
10
11
|
}
|
|
11
|
-
function LinearGradient({
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
} = event.nativeEvent.layout;
|
|
56
|
-
setLayout(oldLayout => {
|
|
57
|
-
if (width2 !== oldLayout.width || height2 !== oldLayout.height) {
|
|
58
|
-
return {
|
|
59
|
-
height: height2,
|
|
60
|
-
width: width2
|
|
61
|
-
};
|
|
62
|
-
}
|
|
63
|
-
return oldLayout;
|
|
64
|
-
});
|
|
65
|
-
if (props.onLayout) {
|
|
66
|
-
props.onLayout(event);
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
});
|
|
12
|
+
function LinearGradient({ colors, locations, start, end, ...props }) {
|
|
13
|
+
const normalizedStart = start ? Array.isArray(start) ? start : [start.x, start.y] : void 0;
|
|
14
|
+
const normalizedEnd = end ? Array.isArray(end) ? end : [end.x, end.y] : void 0;
|
|
15
|
+
const needsLayout = needsDimensionAwareAngle(normalizedStart, normalizedEnd);
|
|
16
|
+
const [{ height, width }, setLayout] = React.useState({
|
|
17
|
+
height: 1,
|
|
18
|
+
width: 1
|
|
19
|
+
});
|
|
20
|
+
const linearGradientBackgroundImage = React.useMemo(() => {
|
|
21
|
+
return getLinearGradientBackgroundImage(colors, locations, normalizedStart, normalizedEnd, width, height);
|
|
22
|
+
}, [
|
|
23
|
+
colors,
|
|
24
|
+
locations,
|
|
25
|
+
normalizedStart,
|
|
26
|
+
normalizedEnd,
|
|
27
|
+
width,
|
|
28
|
+
height
|
|
29
|
+
]);
|
|
30
|
+
if (!needsLayout) {
|
|
31
|
+
return /* @__PURE__ */ jsx(View, {
|
|
32
|
+
...props,
|
|
33
|
+
onLayout: props.onLayout,
|
|
34
|
+
style: [props.style, { backgroundImage: linearGradientBackgroundImage }]
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
return /* @__PURE__ */ jsx(View, {
|
|
38
|
+
...props,
|
|
39
|
+
style: [props.style, { backgroundImage: linearGradientBackgroundImage }],
|
|
40
|
+
onLayout: (event) => {
|
|
41
|
+
const { width: width2, height: height2 } = event.nativeEvent.layout;
|
|
42
|
+
setLayout((oldLayout) => {
|
|
43
|
+
if (width2 !== oldLayout.width || height2 !== oldLayout.height) {
|
|
44
|
+
return {
|
|
45
|
+
height: height2,
|
|
46
|
+
width: width2
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
return oldLayout;
|
|
50
|
+
});
|
|
51
|
+
if (props.onLayout) {
|
|
52
|
+
props.onLayout(event);
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
});
|
|
70
56
|
}
|
|
71
57
|
function getLinearGradientBackgroundImage(colors, locations, startPoint, endPoint, width = 1, height = 1) {
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
const angle = calculatePseudoAngle(width, height, startPoint, endPoint);
|
|
76
|
-
return `linear-gradient(${angle}deg, ${gradientColors.join(", ")})`;
|
|
58
|
+
const gradientColors = calculateGradientColors(colors, locations);
|
|
59
|
+
const angle = calculatePseudoAngle(width, height, startPoint, endPoint);
|
|
60
|
+
return `linear-gradient(${angle}deg, ${gradientColors.join(", ")})`;
|
|
77
61
|
}
|
|
78
62
|
function calculatePseudoAngle(width, height, startPoint, endPoint) {
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
63
|
+
const getControlPoints = () => {
|
|
64
|
+
let correctedStartPoint = [0, 0];
|
|
65
|
+
if (Array.isArray(startPoint)) {
|
|
66
|
+
correctedStartPoint = [startPoint[0] != null ? startPoint[0] : 0, startPoint[1] != null ? startPoint[1] : 0];
|
|
67
|
+
}
|
|
68
|
+
let correctedEndPoint = [0, 1];
|
|
69
|
+
if (Array.isArray(endPoint)) {
|
|
70
|
+
correctedEndPoint = [endPoint[0] != null ? endPoint[0] : 0, endPoint[1] != null ? endPoint[1] : 1];
|
|
71
|
+
}
|
|
72
|
+
return [correctedStartPoint, correctedEndPoint];
|
|
73
|
+
};
|
|
74
|
+
const [start, end] = getControlPoints();
|
|
75
|
+
start[0] *= width;
|
|
76
|
+
end[0] *= width;
|
|
77
|
+
start[1] *= height;
|
|
78
|
+
end[1] *= height;
|
|
79
|
+
const py = end[1] - start[1];
|
|
80
|
+
const px = end[0] - start[0];
|
|
81
|
+
return 90 + Math.atan2(py, px) * 180 / Math.PI;
|
|
98
82
|
}
|
|
99
83
|
function calculateGradientColors(colors, locations) {
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
84
|
+
return colors.map((color, index) => {
|
|
85
|
+
const output = normalizeColor(color);
|
|
86
|
+
if (locations && locations[index] !== void 0) {
|
|
87
|
+
const location = Math.max(0, Math.min(1, locations[index]));
|
|
88
|
+
const percentage = location * 100;
|
|
89
|
+
return `${output} ${percentage}%`;
|
|
90
|
+
}
|
|
91
|
+
return output;
|
|
92
|
+
});
|
|
109
93
|
}
|
|
94
|
+
|
|
110
95
|
export { LinearGradient };
|
|
111
96
|
//# sourceMappingURL=linear-gradient.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"linear-gradient.js","names":[],"sources":["jsx/linear-gradient.js"],"sourcesContent":["import { normalizeColor } from \"@tamagui/core\";\nimport * as React from \"react\";\nimport { View } from \"react-native-web\";\nimport { jsx } from \"react/jsx-runtime\";\nfunction needsDimensionAwareAngle(start, end) {\n if (!start && !end) return false;\n const startX = start?.[0] ?? 0.5;\n const endX = end?.[0] ?? 0.5;\n return startX !== endX;\n}\nfunction LinearGradient({\n colors,\n locations,\n start,\n end,\n ...props\n}) {\n const normalizedStart = start ? Array.isArray(start) ? start : [start.x, start.y] : void 0;\n const normalizedEnd = end ? Array.isArray(end) ? end : [end.x, end.y] : void 0;\n const needsLayout = needsDimensionAwareAngle(\n normalizedStart,\n normalizedEnd\n );\n const [{ height, width }, setLayout] = React.useState({\n height: 1,\n width: 1\n });\n const linearGradientBackgroundImage = React.useMemo(() => {\n return getLinearGradientBackgroundImage(\n // @ts-expect-error ok\n colors,\n locations,\n normalizedStart,\n normalizedEnd,\n width,\n height\n );\n }, [colors, locations, normalizedStart, normalizedEnd, width, height]);\n if (!needsLayout) {\n return /* @__PURE__ */ jsx(\n View,\n {\n ...props,\n onLayout: props.onLayout,\n style: [\n props.style,\n // @ts-ignore: [ts] Property 'backgroundImage' does not exist on type 'ViewStyle'.\n { backgroundImage: linearGradientBackgroundImage }\n ]\n }\n );\n }\n return /* @__PURE__ */ jsx(\n View,\n {\n ...props,\n style: [\n props.style,\n // @ts-ignore: [ts] Property 'backgroundImage' does not exist on type 'ViewStyle'.\n { backgroundImage: linearGradientBackgroundImage }\n ],\n onLayout: (event) => {\n const { width: width2, height: height2 } = event.nativeEvent.layout;\n setLayout((oldLayout) => {\n if (width2 !== oldLayout.width || height2 !== oldLayout.height) {\n return { height: height2, width: width2 };\n }\n return oldLayout;\n });\n if (props.onLayout) {\n props.onLayout(event);\n }\n }\n }\n );\n}\nfunction getLinearGradientBackgroundImage(colors, locations, startPoint, endPoint, width = 1, height = 1) {\n const gradientColors = calculateGradientColors(\n // @ts-expect-error TODO fix numbers\n colors,\n locations\n );\n const angle = calculatePseudoAngle(width, height, startPoint, endPoint);\n return `linear-gradient(${angle}deg, ${gradientColors.join(\", \")})`;\n}\nfunction calculatePseudoAngle(width, height, startPoint, endPoint) {\n const getControlPoints = () => {\n let correctedStartPoint = [0, 0];\n if (Array.isArray(startPoint)) {\n correctedStartPoint = [\n startPoint[0] != null ? startPoint[0] : 0,\n startPoint[1] != null ? startPoint[1] : 0\n ];\n }\n let correctedEndPoint = [0, 1];\n if (Array.isArray(endPoint)) {\n correctedEndPoint = [\n endPoint[0] != null ? endPoint[0] : 0,\n endPoint[1] != null ? endPoint[1] : 1\n ];\n }\n return [correctedStartPoint, correctedEndPoint];\n };\n const [start, end] = getControlPoints();\n start[0] *= width;\n end[0] *= width;\n start[1] *= height;\n end[1] *= height;\n const py = end[1] - start[1];\n const px = end[0] - start[0];\n return 90 + Math.atan2(py, px) * 180 / Math.PI;\n}\nfunction calculateGradientColors(colors, locations) {\n return colors.map((color, index) => {\n const output = normalizeColor(color);\n if (locations && locations[index] !== void 0) {\n const location = Math.max(0, Math.min(1, locations[index]));\n const percentage = location * 100;\n return `${output} ${percentage}%`;\n }\n return output;\n });\n}\nexport {\n LinearGradient\n};\n//# sourceMappingURL=linear-gradient.js.map\n"],"mappings":"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"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
var __defProp = Object.defineProperty;
|
|
5
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
6
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all) __defProp(target, name, {
|
|
10
|
+
get: all[name],
|
|
11
|
+
enumerable: true
|
|
12
|
+
});
|
|
13
|
+
};
|
|
14
|
+
var __copyProps = (to, from, except, desc) => {
|
|
15
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
16
|
+
for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
17
|
+
get: () => from[key],
|
|
18
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
return to;
|
|
22
|
+
};
|
|
23
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
24
|
+
var linear_gradient_native_exports = {};
|
|
25
|
+
__export(linear_gradient_native_exports, { LinearGradient: () => LinearGradient });
|
|
26
|
+
module.exports = __toCommonJS(linear_gradient_native_exports);
|
|
27
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
28
|
+
var import_native = require("@tamagui/native");
|
|
29
|
+
function LinearGradient(props) {
|
|
30
|
+
var state = (0, import_native.getLinearGradient)().state;
|
|
31
|
+
if (state.enabled && state.Component) {
|
|
32
|
+
var ExpoLinearGradient = state.Component;
|
|
33
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ExpoLinearGradient, { ...props });
|
|
34
|
+
}
|
|
35
|
+
console.warn(`Warning: Must call import '@tamagui/native/setup-expo-linear-gradient' at root`);
|
|
36
|
+
return;
|
|
37
|
+
}
|
|
@@ -1,43 +1,39 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
|
|
3
4
|
var __defProp = Object.defineProperty;
|
|
4
5
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
6
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
7
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
8
|
var __export = (target, all) => {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
9
|
+
for (var name in all) __defProp(target, name, {
|
|
10
|
+
get: all[name],
|
|
11
|
+
enumerable: true
|
|
12
|
+
});
|
|
12
13
|
};
|
|
13
14
|
var __copyProps = (to, from, except, desc) => {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
15
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
16
|
+
for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
17
|
+
get: () => from[key],
|
|
18
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
return to;
|
|
21
22
|
};
|
|
22
|
-
var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
|
|
23
|
-
value: true
|
|
24
|
-
}), mod);
|
|
23
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
25
24
|
var linear_gradient_native_exports = {};
|
|
26
|
-
__export(linear_gradient_native_exports, {
|
|
27
|
-
LinearGradient: () => LinearGradient
|
|
28
|
-
});
|
|
25
|
+
__export(linear_gradient_native_exports, { LinearGradient: () => LinearGradient });
|
|
29
26
|
module.exports = __toCommonJS(linear_gradient_native_exports);
|
|
30
27
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
31
28
|
var import_native = require("@tamagui/native");
|
|
32
29
|
function LinearGradient(props) {
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
console.warn(`Warning: Must call import '@tamagui/native/setup-expo-linear-gradient' at root`);
|
|
41
|
-
return;
|
|
30
|
+
var state = (0, import_native.getLinearGradient)().state;
|
|
31
|
+
if (state.enabled && state.Component) {
|
|
32
|
+
var ExpoLinearGradient = state.Component;
|
|
33
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ExpoLinearGradient, { ...props });
|
|
34
|
+
}
|
|
35
|
+
console.warn(`Warning: Must call import '@tamagui/native/setup-expo-linear-gradient' at root`);
|
|
36
|
+
return;
|
|
42
37
|
}
|
|
38
|
+
|
|
43
39
|
//# sourceMappingURL=linear-gradient.native.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"linear-gradient.native.js","names":[],"sources":["jsx/linear-gradient.native.js"],"sourcesContent":["\"use strict\";\nvar __defProp = Object.defineProperty;\nvar __getOwnPropDesc = Object.getOwnPropertyDescriptor;\nvar __getOwnPropNames = Object.getOwnPropertyNames;\nvar __hasOwnProp = Object.prototype.hasOwnProperty;\nvar __export = (target, all) => {\n for (var name in all)\n __defProp(target, name, { get: all[name], enumerable: true });\n};\nvar __copyProps = (to, from, except, desc) => {\n if (from && typeof from === \"object\" || typeof from === \"function\") {\n for (let key of __getOwnPropNames(from))\n if (!__hasOwnProp.call(to, key) && key !== except)\n __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });\n }\n return to;\n};\nvar __toCommonJS = (mod) => __copyProps(__defProp({}, \"__esModule\", { value: true }), mod);\nvar linear_gradient_native_exports = {};\n__export(linear_gradient_native_exports, {\n LinearGradient: () => LinearGradient\n});\nmodule.exports = __toCommonJS(linear_gradient_native_exports);\nvar import_jsx_runtime = require(\"react/jsx-runtime\");\nvar import_native = require(\"@tamagui/native\");\nfunction LinearGradient(props) {\n var state = (0, import_native.getLinearGradient)().state;\n if (state.enabled && state.Component) {\n var ExpoLinearGradient = state.Component;\n return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ExpoLinearGradient, {\n ...props\n });\n }\n console.warn(`Warning: Must call import '@tamagui/native/setup-expo-linear-gradient' at root`);\n return;\n}\n//# sourceMappingURL=linear-gradient.native.js.map\n"],"mappings":";;;;AACA,IAAI,YAAY,OAAO;AACvB,IAAI,mBAAmB,OAAO;AAC9B,IAAI,oBAAoB,OAAO;AAC/B,IAAI,eAAe,OAAO,UAAU;AACpC,IAAI,YAAY,QAAQ,QAAQ;CAC9B,KAAK,IAAI,QAAQ,KACf,UAAU,QAAQ,MAAM;EAAE,KAAK,IAAI;EAAO,YAAY;CAAK,CAAC;AAChE;AACA,IAAI,eAAe,IAAI,MAAM,QAAQ,SAAS;CAC5C,IAAI,QAAQ,OAAO,SAAS,YAAY,OAAO,SAAS,YAAY;EAClE,KAAK,IAAI,OAAO,kBAAkB,IAAI,GACpC,IAAI,CAAC,aAAa,KAAK,IAAI,GAAG,KAAK,QAAQ,QACzC,UAAU,IAAI,KAAK;GAAE,WAAW,KAAK;GAAM,YAAY,EAAE,OAAO,iBAAiB,MAAM,GAAG,MAAM,KAAK;EAAW,CAAC;CACvH;CACA,OAAO;AACT;AACA,IAAI,gBAAgB,QAAQ,YAAY,UAAU,CAAC,GAAG,cAAc,EAAE,OAAO,KAAK,CAAC,GAAG,GAAG;AACzF,IAAI,iCAAiC,CAAC;AACtC,SAAS,gCAAgC,EACvC,sBAAsB,eACxB,CAAC;AACD,OAAO,UAAU,aAAa,8BAA8B;AAC5D,IAAI,qBAAqB,QAAQ,mBAAmB;AACpD,IAAI,gBAAgB,QAAQ,iBAAiB;AAC7C,SAAS,eAAe,OAAO;CAC7B,IAAI,SAAS,GAAG,cAAc,mBAAmB,EAAE;CACnD,IAAI,MAAM,WAAW,MAAM,WAAW;EACpC,IAAI,qBAAqB,MAAM;EAC/B,OAAuB,iBAAC,GAAG,mBAAmB,KAAK,oBAAoB,EACrE,GAAG,MACL,CAAC;CACH;CACA,QAAQ,KAAK,gFAAgF;CAC7F;AACF"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tamagui/linear-gradient",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "3.0.0-beta.643.1",
|
|
4
4
|
"source": "src/index.ts",
|
|
5
5
|
"files": [
|
|
6
6
|
"src",
|
|
@@ -34,18 +34,19 @@
|
|
|
34
34
|
"clean:build": "tamagui-build clean:build"
|
|
35
35
|
},
|
|
36
36
|
"dependencies": {
|
|
37
|
-
"@tamagui/core": "
|
|
38
|
-
"@tamagui/native": "
|
|
39
|
-
"@tamagui/stacks": "
|
|
37
|
+
"@tamagui/core": "3.0.0-beta.643.1",
|
|
38
|
+
"@tamagui/native": "3.0.0-beta.643.1",
|
|
39
|
+
"@tamagui/stacks": "3.0.0-beta.643.1"
|
|
40
40
|
},
|
|
41
41
|
"devDependencies": {
|
|
42
|
-
"@tamagui/build": "
|
|
43
|
-
"expo-linear-gradient": "~
|
|
42
|
+
"@tamagui/build": "3.0.0-beta.643.1",
|
|
43
|
+
"expo-linear-gradient": "~57.0.1",
|
|
44
44
|
"react": ">=19",
|
|
45
|
-
"react-native": "0.
|
|
45
|
+
"react-native": "0.86.2"
|
|
46
46
|
},
|
|
47
47
|
"peerDependencies": {
|
|
48
|
-
"react": ">=19"
|
|
48
|
+
"react": ">=19",
|
|
49
|
+
"react-native-web": "*"
|
|
49
50
|
},
|
|
50
51
|
"module:jsx": "dist/jsx",
|
|
51
52
|
"repository": {
|
package/src/LinearGradient.tsx
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
import type { ColorTokens, GetProps, ThemeTokens } from '@tamagui/core'
|
|
2
|
-
import {
|
|
2
|
+
import {
|
|
3
|
+
createStyledHOC,
|
|
4
|
+
normalizeColor,
|
|
5
|
+
styled,
|
|
6
|
+
useProps,
|
|
7
|
+
useTheme,
|
|
8
|
+
} from '@tamagui/core'
|
|
3
9
|
import { YStack } from '@tamagui/stacks'
|
|
4
10
|
import type { ViewStyle } from 'react-native'
|
|
5
11
|
|
|
@@ -15,13 +21,18 @@ export type LinearGradientExtraProps = {
|
|
|
15
21
|
}
|
|
16
22
|
|
|
17
23
|
const LinearGradientFrame = styled(YStack, {
|
|
18
|
-
|
|
24
|
+
displayName: 'LinearGradient',
|
|
19
25
|
overflow: 'hidden',
|
|
20
26
|
position: 'relative',
|
|
21
27
|
})
|
|
22
28
|
|
|
23
|
-
export const LinearGradient =
|
|
24
|
-
|
|
29
|
+
export const LinearGradient = createStyledHOC(
|
|
30
|
+
LinearGradientFrame,
|
|
31
|
+
(
|
|
32
|
+
propsIn: Omit<GetProps<typeof LinearGradientFrame>, keyof LinearGradientExtraProps> &
|
|
33
|
+
LinearGradientExtraProps,
|
|
34
|
+
ref
|
|
35
|
+
) => {
|
|
25
36
|
const props = useProps(propsIn)
|
|
26
37
|
|
|
27
38
|
const { start, end, colors: colorsProp, locations, children, ...stackProps } = props
|
|
@@ -36,7 +47,7 @@ export const LinearGradient = LinearGradientFrame.styleable<LinearGradientExtraP
|
|
|
36
47
|
if (
|
|
37
48
|
colors.some((c) => {
|
|
38
49
|
const normalized = normalizeColor(c)
|
|
39
|
-
if (!normalized
|
|
50
|
+
if (!normalized) {
|
|
40
51
|
return true
|
|
41
52
|
}
|
|
42
53
|
})
|
|
@@ -7,11 +7,13 @@ export type LinearGradientExtraProps = {
|
|
|
7
7
|
end?: LinearGradientPoint | null;
|
|
8
8
|
};
|
|
9
9
|
export declare const LinearGradient: import("@tamagui/core").TamaguiComponent<Omit<import("@tamagui/core").GetFinalProps<import("@tamagui/core").RNTamaguiViewNonStyleProps, import("@tamagui/core").StackStyleBase, {
|
|
10
|
-
elevation?: number | import("@tamagui/core").
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
10
|
+
elevation?: number | import("@tamagui/core").Size | undefined;
|
|
11
|
+
}>, "alignContent" | "alignItems" | "alignSelf" | "animateOnly" | "animatePresence" | "aspectRatio" | "backdropFilter" | "backfaceVisibility" | "background" | "backgroundAttachment" | "backgroundBlendMode" | "backgroundClip" | "backgroundColor" | "backgroundImage" | "backgroundOrigin" | "backgroundPosition" | "backgroundRepeat" | "backgroundSize" | "blockSize" | "border" | "borderBlock" | "borderBlockColor" | "borderBlockEndColor" | "borderBlockEndStyle" | "borderBlockEndWidth" | "borderBlockStartColor" | "borderBlockStartStyle" | "borderBlockStartWidth" | "borderBlockStyle" | "borderBlockWidth" | "borderBottomColor" | "borderBottomEndRadius" | "borderBottomLeftRadius" | "borderBottomRightRadius" | "borderBottomStartRadius" | "borderBottomWidth" | "borderColor" | "borderCurve" | "borderEndColor" | "borderEndEndRadius" | "borderEndStartRadius" | "borderEndWidth" | "borderImage" | "borderInline" | "borderInlineColor" | "borderInlineEndColor" | "borderInlineEndStyle" | "borderInlineEndWidth" | "borderInlineStartColor" | "borderInlineStartStyle" | "borderInlineStartWidth" | "borderInlineStyle" | "borderInlineWidth" | "borderLeftColor" | "borderLeftWidth" | "borderRadius" | "borderRightColor" | "borderRightWidth" | "borderStartColor" | "borderStartEndRadius" | "borderStartStartRadius" | "borderStartWidth" | "borderStyle" | "borderTopColor" | "borderTopEndRadius" | "borderTopLeftRadius" | "borderTopRightRadius" | "borderTopStartRadius" | "borderTopWidth" | "borderWidth" | "bottom" | "boxShadow" | "boxSizing" | "caretColor" | "clipPath" | "color" | "columnGap" | "contain" | "containerName" | "containerType" | "cursor" | "direction" | "display" | "elevation" | "experimental_backgroundImage" | "experimental_backgroundPosition" | "experimental_backgroundRepeat" | "experimental_backgroundSize" | "filter" | "flex" | "flexBasis" | "flexDirection" | "flexGrow" | "flexShrink" | "flexWrap" | "float" | "gap" | "gridColumn" | "gridColumnEnd" | "gridColumnGap" | "gridColumnStart" | "gridRow" | "gridRowEnd" | "gridRowGap" | "gridRowStart" | "gridTemplateAreas" | "gridTemplateColumns" | "height" | "inlineSize" | "inset" | "insetBlock" | "insetBlockEnd" | "insetBlockStart" | "insetInline" | "insetInlineEnd" | "insetInlineStart" | "isolation" | "justifyContent" | "left" | "margin" | "marginBlock" | "marginBlockEnd" | "marginBlockStart" | "marginBottom" | "marginEnd" | "marginHorizontal" | "marginInline" | "marginInlineEnd" | "marginInlineStart" | "marginLeft" | "marginRight" | "marginStart" | "marginTop" | "marginVertical" | "mask" | "maskBorder" | "maskBorderMode" | "maskBorderOutset" | "maskBorderRepeat" | "maskBorderSlice" | "maskBorderSource" | "maskBorderWidth" | "maskClip" | "maskComposite" | "maskImage" | "maskMode" | "maskOrigin" | "maskPosition" | "maskRepeat" | "maskSize" | "maskType" | "matrix" | "maxBlockSize" | "maxHeight" | "maxInlineSize" | "maxWidth" | "minBlockSize" | "minHeight" | "minInlineSize" | "minWidth" | "mixBlendMode" | "objectFit" | "onTransition" | "opacity" | "outline" | "outlineColor" | "outlineOffset" | "outlineStyle" | "outlineWidth" | "overflow" | "overflowBlock" | "overflowInline" | "overflowWrap" | "overflowX" | "overflowY" | "padding" | "paddingBlock" | "paddingBlockEnd" | "paddingBlockStart" | "paddingBottom" | "paddingEnd" | "paddingHorizontal" | "paddingInline" | "paddingInlineEnd" | "paddingInlineStart" | "paddingLeft" | "paddingRight" | "paddingStart" | "paddingTop" | "paddingVertical" | "passThrough" | "perspective" | "pointerEvents" | "position" | "resize" | "right" | "rotate" | "rotateX" | "rotateY" | "rotateZ" | "rotation" | "rowGap" | "scale" | "scaleX" | "scaleY" | "shadowColor" | "shadowOffset" | "shadowOpacity" | "shadowRadius" | "skewX" | "skewY" | "textEmphasis" | "textWrap" | "top" | "transform" | "transformMatrix" | "transformOrigin" | "transformStyle" | "transition" | "translateX" | "translateY" | "userSelect" | "verticalAlign" | "visibility" | "width" | "wordWrap" | "x" | "y" | "zIndex" | keyof LinearGradientExtraProps | keyof import("@tamagui/core").RNTamaguiViewNonStyleProps> & Omit<import("@tamagui/core").GetFinalProps<import("@tamagui/core").RNTamaguiViewNonStyleProps, import("@tamagui/core").StackStyleBase, {
|
|
12
|
+
elevation?: number | import("@tamagui/core").Size | undefined;
|
|
13
|
+
}>, keyof LinearGradientExtraProps> & LinearGradientExtraProps, import("react-native").View | (HTMLElement & import("@tamagui/core").TamaguiElementMethods), import("@tamagui/core").RNTamaguiViewNonStyleProps & Omit<import("@tamagui/core").GetFinalProps<import("@tamagui/core").RNTamaguiViewNonStyleProps, import("@tamagui/core").StackStyleBase, {
|
|
14
|
+
elevation?: number | import("@tamagui/core").Size | undefined;
|
|
15
|
+
}>, keyof LinearGradientExtraProps> & LinearGradientExtraProps, import("@tamagui/core").StackStyleBase, {
|
|
16
|
+
elevation?: number | import("@tamagui/core").Size | undefined;
|
|
15
17
|
}, import("@tamagui/core").StaticConfigPublic>;
|
|
16
18
|
export type LinearGradientProps = GetProps<typeof LinearGradient>;
|
|
17
19
|
//# sourceMappingURL=LinearGradient.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LinearGradient.d.ts","sourceRoot":"","sources":["../src/LinearGradient.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,eAAe,CAAA;
|
|
1
|
+
{"version":3,"file":"LinearGradient.d.ts","sourceRoot":"","sources":["../src/LinearGradient.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,eAAe,CAAA;AAWvE,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAA;AAI5D,MAAM,MAAM,wBAAwB,GAAG;IACrC,MAAM,CAAC,EAAE,CAAC,WAAW,GAAG,WAAW,GAAG,CAAC,MAAM,GAAG,EAAE,CAAC,CAAC,EAAE,CAAA;IACtD,SAAS,CAAC,EAAE,MAAM,EAAE,GAAG,IAAI,CAAA;IAC3B,KAAK,CAAC,EAAE,mBAAmB,GAAG,IAAI,CAAA;IAClC,GAAG,CAAC,EAAE,mBAAmB,GAAG,IAAI,CAAA;CACjC,CAAA;AAQD,eAAO,MAAM,cAAc;;;;;;;;8CA8C1B,CAAA;AAED,MAAM,MAAM,mBAAmB,GAAG,QAAQ,CAAC,OAAO,cAAc,CAAC,CAAA"}
|