@tamagui/linear-gradient 1.108.4 → 1.109.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.js +45 -3
- package/dist/cjs/LinearGradient.js.map +2 -2
- package/dist/cjs/LinearGradient.native.js +83 -11
- package/dist/cjs/LinearGradient.native.js.map +3 -3
- package/dist/esm/LinearGradient.js +43 -1
- package/dist/esm/LinearGradient.js.map +1 -1
- package/dist/esm/LinearGradient.mjs +45 -1
- package/dist/esm/LinearGradient.mjs.map +1 -1
- package/dist/esm/LinearGradient.native.js +83 -8
- package/dist/esm/LinearGradient.native.js.map +3 -3
- package/dist/jsx/LinearGradient.js +43 -1
- package/dist/jsx/LinearGradient.js.map +1 -1
- package/dist/jsx/LinearGradient.mjs +45 -1
- package/dist/jsx/LinearGradient.mjs.map +1 -1
- package/dist/jsx/LinearGradient.native.js +83 -8
- package/dist/jsx/LinearGradient.native.js.map +3 -3
- package/package.json +4 -4
- package/src/LinearGradient.tsx +75 -1
- package/types/LinearGradient.d.ts +28 -1
- package/types/LinearGradient.d.ts.map +1 -1
- package/src/LinearGradient-shared.tsx +0 -75
- package/src/LinearGradient.native.tsx +0 -9
|
@@ -2,14 +2,56 @@ var __defProp = Object.defineProperty;
|
|
|
2
2
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
3
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
4
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
-
var
|
|
5
|
+
var __export = (target, all) => {
|
|
6
|
+
for (var name in all)
|
|
7
|
+
__defProp(target, name, { get: all[name], enumerable: !0 });
|
|
8
|
+
}, __copyProps = (to, from, except, desc) => {
|
|
6
9
|
if (from && typeof from == "object" || typeof from == "function")
|
|
7
10
|
for (let key of __getOwnPropNames(from))
|
|
8
11
|
!__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
9
12
|
return to;
|
|
10
|
-
}
|
|
13
|
+
};
|
|
11
14
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: !0 }), mod);
|
|
12
15
|
var LinearGradient_exports = {};
|
|
16
|
+
__export(LinearGradient_exports, {
|
|
17
|
+
LinearGradient: () => LinearGradient
|
|
18
|
+
});
|
|
13
19
|
module.exports = __toCommonJS(LinearGradient_exports);
|
|
14
|
-
|
|
20
|
+
var import_core = require("@tamagui/core"), import_stacks = require("@tamagui/stacks"), import_linear_gradient = require("./linear-gradient"), import_jsx_runtime = require("react/jsx-runtime");
|
|
21
|
+
const LinearGradientFrame = (0, import_core.styled)(import_stacks.YStack, {
|
|
22
|
+
name: "LinearGradient",
|
|
23
|
+
overflow: "hidden",
|
|
24
|
+
position: "relative"
|
|
25
|
+
}), LinearGradient = LinearGradientFrame.styleable(
|
|
26
|
+
(propsIn, ref) => {
|
|
27
|
+
const props = (0, import_core.useProps)(propsIn), { start, end, colors: colorsProp, locations, children, ...stackProps } = props, theme = (0, import_core.useTheme)();
|
|
28
|
+
let colors = props.colors?.map((c) => theme[c]?.get("web") ?? c) || [];
|
|
29
|
+
return process.env.NODE_ENV !== "production" && colors.some((c) => {
|
|
30
|
+
const normalized = (0, import_core.normalizeColor)(c);
|
|
31
|
+
if (!normalized || normalized.startsWith("$"))
|
|
32
|
+
return !0;
|
|
33
|
+
}) && (console.error(
|
|
34
|
+
`LinearGradient: "colors" prop contains invalid color tokens: ${colors} fallback to default colors: ["#000", "#fff"]`
|
|
35
|
+
), colors = ["#000", "#fff"]), /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(LinearGradientFrame, { ref, ...stackProps, children: [
|
|
36
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
37
|
+
import_linear_gradient.LinearGradient,
|
|
38
|
+
{
|
|
39
|
+
start,
|
|
40
|
+
end,
|
|
41
|
+
colors,
|
|
42
|
+
locations,
|
|
43
|
+
style: gradientStyle
|
|
44
|
+
}
|
|
45
|
+
),
|
|
46
|
+
children
|
|
47
|
+
] });
|
|
48
|
+
}
|
|
49
|
+
), gradientStyle = {
|
|
50
|
+
position: "absolute",
|
|
51
|
+
top: 0,
|
|
52
|
+
left: 0,
|
|
53
|
+
right: 0,
|
|
54
|
+
bottom: 0,
|
|
55
|
+
zIndex: 0
|
|
56
|
+
};
|
|
15
57
|
//# sourceMappingURL=LinearGradient.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/LinearGradient.tsx"],
|
|
4
|
-
"mappings": "
|
|
5
|
-
"names": []
|
|
4
|
+
"mappings": ";;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,kBAA2D,0BAC3D,gBAAuB,4BAIvB,yBAAqD,8BA6C/C;AAnCN,MAAM,0BAAsB,oBAAO,sBAAQ;AAAA,EACzC,MAAM;AAAA,EACN,UAAU;AAAA,EACV,UAAU;AACZ,CAAC,GAEY,iBAAiB,oBAAoB;AAAA,EAChD,CAAC,SAAS,QAAQ;AAChB,UAAM,YAAQ,sBAAS,OAAO,GAExB,EAAE,OAAO,KAAK,QAAQ,YAAY,WAAW,UAAU,GAAG,WAAW,IAAI,OACzE,YAAQ,sBAAS;AAEvB,QAAI,SACF,MAAM,QAAQ,IAAI,CAAC,MACT,MAAM,CAAC,GAAG,IAAI,KAAK,KAAgB,CAC5C,KAAK,CAAC;AAET,WAAI,QAAQ,IAAI,aAAa,gBAEzB,OAAO,KAAK,CAAC,MAAM;AACjB,YAAM,iBAAa,4BAAe,CAAC;AACnC,UAAI,CAAC,cAAc,WAAW,WAAW,GAAG;AAC1C,eAAO;AAAA,IAEX,CAAC,MAED,QAAQ;AAAA,MACN,gEAAgE,MAAM;AAAA,IACxE,GACA,SAAS,CAAC,QAAQ,MAAM,IAK1B,6CAAC,uBAAoB,KAAkB,GAAG,YACxC;AAAA;AAAA,QAAC,uBAAAA;AAAA,QAAA;AAAA,UACC;AAAA,UACA;AAAA,UACA;AAAA,UACA;AAAA,UACA,OAAO;AAAA;AAAA,MACT;AAAA,MACC;AAAA,OACH;AAAA,EAEJ;AACF,GAIM,gBAA2B;AAAA,EAC/B,UAAU;AAAA,EACV,KAAK;AAAA,EACL,MAAM;AAAA,EACN,OAAO;AAAA,EACP,QAAQ;AAAA,EACR,QAAQ;AACV;",
|
|
5
|
+
"names": ["ExpoLinearGradient"]
|
|
6
6
|
}
|
|
@@ -13,12 +13,12 @@ var __export = (target, all) => {
|
|
|
13
13
|
return to;
|
|
14
14
|
};
|
|
15
15
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: !0 }), mod);
|
|
16
|
-
var
|
|
17
|
-
__export(
|
|
16
|
+
var LinearGradient_exports = {};
|
|
17
|
+
__export(LinearGradient_exports, {
|
|
18
18
|
LinearGradient: () => LinearGradient
|
|
19
19
|
});
|
|
20
|
-
module.exports = __toCommonJS(
|
|
21
|
-
var import_jsx_runtime = require("react/jsx-runtime");
|
|
20
|
+
module.exports = __toCommonJS(LinearGradient_exports);
|
|
21
|
+
var import_jsx_runtime = require("react/jsx-runtime"), import_core = require("@tamagui/core"), import_stacks = require("@tamagui/stacks"), import_linear_gradient = require("./linear-gradient");
|
|
22
22
|
function _define_property(obj, key, value) {
|
|
23
23
|
return key in obj ? Object.defineProperty(obj, key, {
|
|
24
24
|
value,
|
|
@@ -29,21 +29,93 @@ function _define_property(obj, key, value) {
|
|
|
29
29
|
}
|
|
30
30
|
function _object_spread(target) {
|
|
31
31
|
for (var i = 1; i < arguments.length; i++) {
|
|
32
|
-
var source = arguments[i] != null ? arguments[i] : {},
|
|
33
|
-
typeof Object.getOwnPropertySymbols == "function" && (
|
|
32
|
+
var source = arguments[i] != null ? arguments[i] : {}, ownKeys2 = Object.keys(source);
|
|
33
|
+
typeof Object.getOwnPropertySymbols == "function" && (ownKeys2 = ownKeys2.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
|
|
34
34
|
return Object.getOwnPropertyDescriptor(source, sym).enumerable;
|
|
35
|
-
}))),
|
|
35
|
+
}))), ownKeys2.forEach(function(key) {
|
|
36
36
|
_define_property(target, key, source[key]);
|
|
37
37
|
});
|
|
38
38
|
}
|
|
39
39
|
return target;
|
|
40
40
|
}
|
|
41
|
-
function
|
|
42
|
-
var
|
|
43
|
-
|
|
41
|
+
function ownKeys(object, enumerableOnly) {
|
|
42
|
+
var keys = Object.keys(object);
|
|
43
|
+
if (Object.getOwnPropertySymbols) {
|
|
44
|
+
var symbols = Object.getOwnPropertySymbols(object);
|
|
45
|
+
enumerableOnly && (symbols = symbols.filter(function(sym) {
|
|
46
|
+
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
|
|
47
|
+
})), keys.push.apply(keys, symbols);
|
|
48
|
+
}
|
|
49
|
+
return keys;
|
|
50
|
+
}
|
|
51
|
+
function _object_spread_props(target, source) {
|
|
52
|
+
return source = source ?? {}, Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function(key) {
|
|
53
|
+
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
|
54
|
+
}), target;
|
|
55
|
+
}
|
|
56
|
+
function _object_without_properties(source, excluded) {
|
|
57
|
+
if (source == null) return {};
|
|
58
|
+
var target = _object_without_properties_loose(source, excluded), key, i;
|
|
59
|
+
if (Object.getOwnPropertySymbols) {
|
|
60
|
+
var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
|
|
61
|
+
for (i = 0; i < sourceSymbolKeys.length; i++)
|
|
62
|
+
key = sourceSymbolKeys[i], !(excluded.indexOf(key) >= 0) && Object.prototype.propertyIsEnumerable.call(source, key) && (target[key] = source[key]);
|
|
63
|
+
}
|
|
64
|
+
return target;
|
|
65
|
+
}
|
|
66
|
+
function _object_without_properties_loose(source, excluded) {
|
|
67
|
+
if (source == null) return {};
|
|
68
|
+
var target = {}, sourceKeys = Object.keys(source), key, i;
|
|
69
|
+
for (i = 0; i < sourceKeys.length; i++)
|
|
70
|
+
key = sourceKeys[i], !(excluded.indexOf(key) >= 0) && (target[key] = source[key]);
|
|
71
|
+
return target;
|
|
44
72
|
}
|
|
73
|
+
var LinearGradientFrame = (0, import_core.styled)(import_stacks.YStack, {
|
|
74
|
+
name: "LinearGradient",
|
|
75
|
+
overflow: "hidden",
|
|
76
|
+
position: "relative"
|
|
77
|
+
}), LinearGradient = LinearGradientFrame.styleable(function(propsIn, ref) {
|
|
78
|
+
var _props_colors, props = (0, import_core.useProps)(propsIn), start = props.start, end = props.end, colorsProp = props.colors, locations = props.locations, children = props.children, stackProps = _object_without_properties(props, [
|
|
79
|
+
"start",
|
|
80
|
+
"end",
|
|
81
|
+
"colors",
|
|
82
|
+
"locations",
|
|
83
|
+
"children"
|
|
84
|
+
]), theme = (0, import_core.useTheme)(), colors = ((_props_colors = props.colors) === null || _props_colors === void 0 ? void 0 : _props_colors.map(function(c) {
|
|
85
|
+
var _theme_c, _theme_c_get;
|
|
86
|
+
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;
|
|
87
|
+
})) || [];
|
|
88
|
+
return process.env.NODE_ENV !== "production" && colors.some(function(c) {
|
|
89
|
+
var normalized = (0, import_core.normalizeColor)(c);
|
|
90
|
+
if (!normalized || normalized.startsWith("$"))
|
|
91
|
+
return !0;
|
|
92
|
+
}) && (console.error('LinearGradient: "colors" prop contains invalid color tokens: '.concat(colors, ' fallback to default colors: ["#000", "#fff"]')), colors = [
|
|
93
|
+
"#000",
|
|
94
|
+
"#fff"
|
|
95
|
+
]), /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(LinearGradientFrame, _object_spread_props(_object_spread({
|
|
96
|
+
ref
|
|
97
|
+
}, stackProps), {
|
|
98
|
+
children: [
|
|
99
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_linear_gradient.LinearGradient, {
|
|
100
|
+
start,
|
|
101
|
+
end,
|
|
102
|
+
colors,
|
|
103
|
+
locations,
|
|
104
|
+
style: gradientStyle
|
|
105
|
+
}),
|
|
106
|
+
children
|
|
107
|
+
]
|
|
108
|
+
}));
|
|
109
|
+
}), gradientStyle = {
|
|
110
|
+
position: "absolute",
|
|
111
|
+
top: 0,
|
|
112
|
+
left: 0,
|
|
113
|
+
right: 0,
|
|
114
|
+
bottom: 0,
|
|
115
|
+
zIndex: 0
|
|
116
|
+
};
|
|
45
117
|
// Annotate the CommonJS export names for ESM import in node:
|
|
46
118
|
0 && (module.exports = {
|
|
47
119
|
LinearGradient
|
|
48
120
|
});
|
|
49
|
-
//# sourceMappingURL=LinearGradient.
|
|
121
|
+
//# sourceMappingURL=LinearGradient.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
|
-
"sources": ["../../src/Users/n8/tamagui/code/ui/linear-gradient/src/LinearGradient.
|
|
4
|
-
"mappings": "
|
|
5
|
-
"names": ["LinearGradient", "props", "
|
|
3
|
+
"sources": ["../../src/Users/n8/tamagui/code/ui/linear-gradient/src/LinearGradient.tsx"],
|
|
4
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;uDACA,cAA2D,0BAC3D,gBAAuB,4BAIvB,yBAAqD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAUrD,IAAMA,0BAAsBC,oBAAOC,sBAAQ;EACzCC,MAAM;EACNC,UAAU;EACVC,UAAU;AACZ,CAAA,GAEaC,iBAAiBN,oBAAoBO,UAChD,SAACC,SAASC,KAAAA;MAONC,eANIA,YAAQC,sBAASH,OAAAA,GAEfI,QAAuEF,MAAvEE,OAAOC,MAAgEH,MAAhEG,KAAaC,aAAmDJ,MAA3DK,QAAoBC,YAAuCN,MAAvCM,WAAWC,WAA4BP,MAA5BO,UAAaC,aAAAA,2BAAeR,OAAAA;IAAvEE;IAAOC;IAAKE;IAAoBC;IAAWC;MAC7CE,YAAQC,sBAAAA,GAEVL,WACFL,gBAAAA,MAAMK,YAAM,QAAZL,kBAAAA,SAAAA,SAAAA,cAAcW,IAAI,SAACC,GAAAA;QACTH,UAAAA;AAAR,YAAQA,gBAAAA,WAAAA,MAAMG,CAAAA,OAAE,QAARH,aAAAA,SAAAA,SAAAA,SAAUI,IAAI,KAAA,OAAA,QAAdJ,iBAAAA,SAAAA,eAAmCG;EAC7C,CAAA,MAAM,CAAA;AAER,SAAIE,QAAQC,IAAIC,aAAa,gBAEzBX,OAAOY,KAAK,SAACL,GAAAA;AACX,QAAMM,iBAAaC,4BAAeP,CAAAA;AAClC,QAAI,CAACM,cAAcA,WAAWE,WAAW,GAAA;AACvC,aAAO;EAEX,CAAA,MAEAC,QAAQC,MACL,gEAAsE,OAAPjB,QAAO,+CAAA,CAAA,GAEzEA,SAAS;IAAC;IAAQ;MAKpB,uCAAAkB,MAACjC,qBAAAA,qBAAAA,eAAAA;IAAoBS;KAAqBS,UAAAA,GAAAA;;MACxC,uCAAAgB,KAACC,uBAAAA,gBAAAA;QACCvB;QACAC;QACAE;QACAC;QACAoB,OAAOC;;MAERpB;;;AAGP,CAAA,GAKIoB,gBAA2B;EAC/BhC,UAAU;EACViC,KAAK;EACLC,MAAM;EACNC,OAAO;EACPC,QAAQ;EACRC,QAAQ;AACV;",
|
|
5
|
+
"names": ["LinearGradientFrame", "styled", "YStack", "name", "overflow", "position", "LinearGradient", "styleable", "propsIn", "ref", "props", "useProps", "start", "end", "colorsProp", "colors", "locations", "children", "stackProps", "theme", "useTheme", "map", "c", "get", "process", "env", "NODE_ENV", "some", "normalized", "normalizeColor", "startsWith", "console", "error", "_jsxs", "_jsx", "ExpoLinearGradient", "style", "gradientStyle", "top", "left", "right", "bottom", "zIndex"]
|
|
6
6
|
}
|
|
@@ -1,2 +1,44 @@
|
|
|
1
|
-
|
|
1
|
+
import { normalizeColor, styled, useProps, useTheme } from "@tamagui/core";
|
|
2
|
+
import { YStack } from "@tamagui/stacks";
|
|
3
|
+
import { LinearGradient as ExpoLinearGradient } from "./linear-gradient";
|
|
4
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
5
|
+
const LinearGradientFrame = styled(YStack, {
|
|
6
|
+
name: "LinearGradient",
|
|
7
|
+
overflow: "hidden",
|
|
8
|
+
position: "relative"
|
|
9
|
+
}), LinearGradient = LinearGradientFrame.styleable(
|
|
10
|
+
(propsIn, ref) => {
|
|
11
|
+
const props = useProps(propsIn), { start, end, colors: colorsProp, locations, children, ...stackProps } = props, theme = useTheme();
|
|
12
|
+
let colors = props.colors?.map((c) => theme[c]?.get("web") ?? c) || [];
|
|
13
|
+
return process.env.NODE_ENV !== "production" && colors.some((c) => {
|
|
14
|
+
const normalized = normalizeColor(c);
|
|
15
|
+
if (!normalized || normalized.startsWith("$"))
|
|
16
|
+
return !0;
|
|
17
|
+
}) && (console.error(
|
|
18
|
+
`LinearGradient: "colors" prop contains invalid color tokens: ${colors} fallback to default colors: ["#000", "#fff"]`
|
|
19
|
+
), colors = ["#000", "#fff"]), /* @__PURE__ */ jsxs(LinearGradientFrame, { ref, ...stackProps, children: [
|
|
20
|
+
/* @__PURE__ */ jsx(
|
|
21
|
+
ExpoLinearGradient,
|
|
22
|
+
{
|
|
23
|
+
start,
|
|
24
|
+
end,
|
|
25
|
+
colors,
|
|
26
|
+
locations,
|
|
27
|
+
style: gradientStyle
|
|
28
|
+
}
|
|
29
|
+
),
|
|
30
|
+
children
|
|
31
|
+
] });
|
|
32
|
+
}
|
|
33
|
+
), gradientStyle = {
|
|
34
|
+
position: "absolute",
|
|
35
|
+
top: 0,
|
|
36
|
+
left: 0,
|
|
37
|
+
right: 0,
|
|
38
|
+
bottom: 0,
|
|
39
|
+
zIndex: 0
|
|
40
|
+
};
|
|
41
|
+
export {
|
|
42
|
+
LinearGradient
|
|
43
|
+
};
|
|
2
44
|
//# sourceMappingURL=LinearGradient.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/LinearGradient.tsx"],
|
|
4
|
-
"mappings": "AAAA,cAAc;",
|
|
4
|
+
"mappings": "AACA,SAAS,gBAAgB,QAAQ,UAAU,gBAAgB;AAC3D,SAAS,cAAc;AAIvB,SAAS,kBAAkB,0BAA0B;AA6C/C,SACE,KADF;AAnCN,MAAM,sBAAsB,OAAO,QAAQ;AAAA,EACzC,MAAM;AAAA,EACN,UAAU;AAAA,EACV,UAAU;AACZ,CAAC,GAEY,iBAAiB,oBAAoB;AAAA,EAChD,CAAC,SAAS,QAAQ;AAChB,UAAM,QAAQ,SAAS,OAAO,GAExB,EAAE,OAAO,KAAK,QAAQ,YAAY,WAAW,UAAU,GAAG,WAAW,IAAI,OACzE,QAAQ,SAAS;AAEvB,QAAI,SACF,MAAM,QAAQ,IAAI,CAAC,MACT,MAAM,CAAC,GAAG,IAAI,KAAK,KAAgB,CAC5C,KAAK,CAAC;AAET,WAAI,QAAQ,IAAI,aAAa,gBAEzB,OAAO,KAAK,CAAC,MAAM;AACjB,YAAM,aAAa,eAAe,CAAC;AACnC,UAAI,CAAC,cAAc,WAAW,WAAW,GAAG;AAC1C,eAAO;AAAA,IAEX,CAAC,MAED,QAAQ;AAAA,MACN,gEAAgE,MAAM;AAAA,IACxE,GACA,SAAS,CAAC,QAAQ,MAAM,IAK1B,qBAAC,uBAAoB,KAAkB,GAAG,YACxC;AAAA;AAAA,QAAC;AAAA;AAAA,UACC;AAAA,UACA;AAAA,UACA;AAAA,UACA;AAAA,UACA,OAAO;AAAA;AAAA,MACT;AAAA,MACC;AAAA,OACH;AAAA,EAEJ;AACF,GAIM,gBAA2B;AAAA,EAC/B,UAAU;AAAA,EACV,KAAK;AAAA,EACL,MAAM;AAAA,EACN,OAAO;AAAA,EACP,QAAQ;AAAA,EACR,QAAQ;AACV;",
|
|
5
5
|
"names": []
|
|
6
6
|
}
|
|
@@ -1,2 +1,46 @@
|
|
|
1
|
-
|
|
1
|
+
import { normalizeColor, styled, useProps, useTheme } from "@tamagui/core";
|
|
2
|
+
import { YStack } from "@tamagui/stacks";
|
|
3
|
+
import { LinearGradient as ExpoLinearGradient } from "./linear-gradient.mjs";
|
|
4
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
5
|
+
const LinearGradientFrame = styled(YStack, {
|
|
6
|
+
name: "LinearGradient",
|
|
7
|
+
overflow: "hidden",
|
|
8
|
+
position: "relative"
|
|
9
|
+
}),
|
|
10
|
+
LinearGradient = LinearGradientFrame.styleable((propsIn, ref) => {
|
|
11
|
+
const props = useProps(propsIn),
|
|
12
|
+
{
|
|
13
|
+
start,
|
|
14
|
+
end,
|
|
15
|
+
colors: colorsProp,
|
|
16
|
+
locations,
|
|
17
|
+
children,
|
|
18
|
+
...stackProps
|
|
19
|
+
} = props,
|
|
20
|
+
theme = useTheme();
|
|
21
|
+
let colors = props.colors?.map(c => theme[c]?.get("web") ?? c) || [];
|
|
22
|
+
return process.env.NODE_ENV !== "production" && colors.some(c => {
|
|
23
|
+
const normalized = normalizeColor(c);
|
|
24
|
+
if (!normalized || normalized.startsWith("$")) return !0;
|
|
25
|
+
}) && (console.error(`LinearGradient: "colors" prop contains invalid color tokens: ${colors} fallback to default colors: ["#000", "#fff"]`), colors = ["#000", "#fff"]), /* @__PURE__ */jsxs(LinearGradientFrame, {
|
|
26
|
+
ref,
|
|
27
|
+
...stackProps,
|
|
28
|
+
children: [/* @__PURE__ */jsx(ExpoLinearGradient, {
|
|
29
|
+
start,
|
|
30
|
+
end,
|
|
31
|
+
colors,
|
|
32
|
+
locations,
|
|
33
|
+
style: gradientStyle
|
|
34
|
+
}), children]
|
|
35
|
+
});
|
|
36
|
+
}),
|
|
37
|
+
gradientStyle = {
|
|
38
|
+
position: "absolute",
|
|
39
|
+
top: 0,
|
|
40
|
+
left: 0,
|
|
41
|
+
right: 0,
|
|
42
|
+
bottom: 0,
|
|
43
|
+
zIndex: 0
|
|
44
|
+
};
|
|
45
|
+
export { LinearGradient };
|
|
2
46
|
//# sourceMappingURL=LinearGradient.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":[],"sources":["../../src/LinearGradient.tsx"],"sourcesContent":[null],"mappings":"
|
|
1
|
+
{"version":3,"names":["normalizeColor","styled","useProps","useTheme","YStack","LinearGradient","ExpoLinearGradient","jsx","jsxs","LinearGradientFrame","name","overflow","position","styleable","propsIn","ref","props","start","end","colors","colorsProp","locations","children","stackProps","theme","map","c","get","process","env","NODE_ENV","some","normalized","startsWith","console","error","style","gradientStyle","top","left","right","bottom","zIndex"],"sources":["../../src/LinearGradient.tsx"],"sourcesContent":[null],"mappings":"AACA,SAASA,cAAA,EAAgBC,MAAA,EAAQC,QAAA,EAAUC,QAAA,QAAgB;AAC3D,SAASC,MAAA,QAAc;AAIvB,SAASC,cAAA,IAAkBC,kBAAA,QAA0B;AA6C/C,SACEC,GAAA,EADFC,IAAA;AAnCN,MAAMC,mBAAA,GAAsBR,MAAA,CAAOG,MAAA,EAAQ;IACzCM,IAAA,EAAM;IACNC,QAAA,EAAU;IACVC,QAAA,EAAU;EACZ,CAAC;EAEYP,cAAA,GAAiBI,mBAAA,CAAoBI,SAAA,CAChD,CAACC,OAAA,EAASC,GAAA,KAAQ;IAChB,MAAMC,KAAA,GAAQd,QAAA,CAASY,OAAO;MAExB;QAAEG,KAAA;QAAOC,GAAA;QAAKC,MAAA,EAAQC,UAAA;QAAYC,SAAA;QAAWC,QAAA;QAAU,GAAGC;MAAW,IAAIP,KAAA;MACzEQ,KAAA,GAAQrB,QAAA,CAAS;IAEvB,IAAIgB,MAAA,GACFH,KAAA,CAAMG,MAAA,EAAQM,GAAA,CAAKC,CAAA,IACTF,KAAA,CAAME,CAAC,GAAGC,GAAA,CAAI,KAAK,KAAgBD,CAC5C,KAAK,EAAC;IAET,OAAIE,OAAA,CAAQC,GAAA,CAAIC,QAAA,KAAa,gBAEzBX,MAAA,CAAOY,IAAA,CAAML,CAAA,IAAM;MACjB,MAAMM,UAAA,GAAahC,cAAA,CAAe0B,CAAC;MACnC,IAAI,CAACM,UAAA,IAAcA,UAAA,CAAWC,UAAA,CAAW,GAAG,GAC1C,OAAO;IAEX,CAAC,MAEDC,OAAA,CAAQC,KAAA,CACN,gEAAgEhB,MAAM,+CACxE,GACAA,MAAA,GAAS,CAAC,QAAQ,MAAM,IAK1B,eAAAX,IAAA,CAACC,mBAAA;MAAoBM,GAAA;MAAkB,GAAGQ,UAAA;MACxCD,QAAA,kBAAAf,GAAA,CAACD,kBAAA;QACCW,KAAA;QACAC,GAAA;QACAC,MAAA;QACAE,SAAA;QACAe,KAAA,EAAOC;MAAA,CACT,GACCf,QAAA;IAAA,CACH;EAEJ,CACF;EAIMe,aAAA,GAA2B;IAC/BzB,QAAA,EAAU;IACV0B,GAAA,EAAK;IACLC,IAAA,EAAM;IACNC,KAAA,EAAO;IACPC,MAAA,EAAQ;IACRC,MAAA,EAAQ;EACV","ignoreList":[]}
|
|
@@ -1,4 +1,7 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { normalizeColor, styled, useProps, useTheme } from "@tamagui/core";
|
|
3
|
+
import { YStack } from "@tamagui/stacks";
|
|
4
|
+
import { LinearGradient as ExpoLinearGradient } from "./linear-gradient";
|
|
2
5
|
function _define_property(obj, key, value) {
|
|
3
6
|
return key in obj ? Object.defineProperty(obj, key, {
|
|
4
7
|
value,
|
|
@@ -9,20 +12,92 @@ function _define_property(obj, key, value) {
|
|
|
9
12
|
}
|
|
10
13
|
function _object_spread(target) {
|
|
11
14
|
for (var i = 1; i < arguments.length; i++) {
|
|
12
|
-
var source = arguments[i] != null ? arguments[i] : {},
|
|
13
|
-
typeof Object.getOwnPropertySymbols == "function" && (
|
|
15
|
+
var source = arguments[i] != null ? arguments[i] : {}, ownKeys2 = Object.keys(source);
|
|
16
|
+
typeof Object.getOwnPropertySymbols == "function" && (ownKeys2 = ownKeys2.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
|
|
14
17
|
return Object.getOwnPropertyDescriptor(source, sym).enumerable;
|
|
15
|
-
}))),
|
|
18
|
+
}))), ownKeys2.forEach(function(key) {
|
|
16
19
|
_define_property(target, key, source[key]);
|
|
17
20
|
});
|
|
18
21
|
}
|
|
19
22
|
return target;
|
|
20
23
|
}
|
|
21
|
-
function
|
|
22
|
-
var
|
|
23
|
-
|
|
24
|
+
function ownKeys(object, enumerableOnly) {
|
|
25
|
+
var keys = Object.keys(object);
|
|
26
|
+
if (Object.getOwnPropertySymbols) {
|
|
27
|
+
var symbols = Object.getOwnPropertySymbols(object);
|
|
28
|
+
enumerableOnly && (symbols = symbols.filter(function(sym) {
|
|
29
|
+
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
|
|
30
|
+
})), keys.push.apply(keys, symbols);
|
|
31
|
+
}
|
|
32
|
+
return keys;
|
|
33
|
+
}
|
|
34
|
+
function _object_spread_props(target, source) {
|
|
35
|
+
return source = source ?? {}, Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function(key) {
|
|
36
|
+
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
|
37
|
+
}), target;
|
|
38
|
+
}
|
|
39
|
+
function _object_without_properties(source, excluded) {
|
|
40
|
+
if (source == null) return {};
|
|
41
|
+
var target = _object_without_properties_loose(source, excluded), key, i;
|
|
42
|
+
if (Object.getOwnPropertySymbols) {
|
|
43
|
+
var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
|
|
44
|
+
for (i = 0; i < sourceSymbolKeys.length; i++)
|
|
45
|
+
key = sourceSymbolKeys[i], !(excluded.indexOf(key) >= 0) && Object.prototype.propertyIsEnumerable.call(source, key) && (target[key] = source[key]);
|
|
46
|
+
}
|
|
47
|
+
return target;
|
|
48
|
+
}
|
|
49
|
+
function _object_without_properties_loose(source, excluded) {
|
|
50
|
+
if (source == null) return {};
|
|
51
|
+
var target = {}, sourceKeys = Object.keys(source), key, i;
|
|
52
|
+
for (i = 0; i < sourceKeys.length; i++)
|
|
53
|
+
key = sourceKeys[i], !(excluded.indexOf(key) >= 0) && (target[key] = source[key]);
|
|
54
|
+
return target;
|
|
24
55
|
}
|
|
56
|
+
var LinearGradientFrame = styled(YStack, {
|
|
57
|
+
name: "LinearGradient",
|
|
58
|
+
overflow: "hidden",
|
|
59
|
+
position: "relative"
|
|
60
|
+
}), LinearGradient = LinearGradientFrame.styleable(function(propsIn, ref) {
|
|
61
|
+
var _props_colors, props = useProps(propsIn), start = props.start, end = props.end, colorsProp = props.colors, locations = props.locations, children = props.children, stackProps = _object_without_properties(props, [
|
|
62
|
+
"start",
|
|
63
|
+
"end",
|
|
64
|
+
"colors",
|
|
65
|
+
"locations",
|
|
66
|
+
"children"
|
|
67
|
+
]), theme = useTheme(), colors = ((_props_colors = props.colors) === null || _props_colors === void 0 ? void 0 : _props_colors.map(function(c) {
|
|
68
|
+
var _theme_c, _theme_c_get;
|
|
69
|
+
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;
|
|
70
|
+
})) || [];
|
|
71
|
+
return process.env.NODE_ENV !== "production" && colors.some(function(c) {
|
|
72
|
+
var normalized = normalizeColor(c);
|
|
73
|
+
if (!normalized || normalized.startsWith("$"))
|
|
74
|
+
return !0;
|
|
75
|
+
}) && (console.error('LinearGradient: "colors" prop contains invalid color tokens: '.concat(colors, ' fallback to default colors: ["#000", "#fff"]')), colors = [
|
|
76
|
+
"#000",
|
|
77
|
+
"#fff"
|
|
78
|
+
]), /* @__PURE__ */ _jsxs(LinearGradientFrame, _object_spread_props(_object_spread({
|
|
79
|
+
ref
|
|
80
|
+
}, stackProps), {
|
|
81
|
+
children: [
|
|
82
|
+
/* @__PURE__ */ _jsx(ExpoLinearGradient, {
|
|
83
|
+
start,
|
|
84
|
+
end,
|
|
85
|
+
colors,
|
|
86
|
+
locations,
|
|
87
|
+
style: gradientStyle
|
|
88
|
+
}),
|
|
89
|
+
children
|
|
90
|
+
]
|
|
91
|
+
}));
|
|
92
|
+
}), gradientStyle = {
|
|
93
|
+
position: "absolute",
|
|
94
|
+
top: 0,
|
|
95
|
+
left: 0,
|
|
96
|
+
right: 0,
|
|
97
|
+
bottom: 0,
|
|
98
|
+
zIndex: 0
|
|
99
|
+
};
|
|
25
100
|
export {
|
|
26
101
|
LinearGradient
|
|
27
102
|
};
|
|
28
|
-
//# sourceMappingURL=LinearGradient.
|
|
103
|
+
//# sourceMappingURL=LinearGradient.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
|
-
"sources": ["../../src/Users/n8/tamagui/code/ui/linear-gradient/src/LinearGradient.
|
|
4
|
-
"mappings": ";
|
|
5
|
-
"names": ["LinearGradient", "props", "
|
|
3
|
+
"sources": ["../../src/Users/n8/tamagui/code/ui/linear-gradient/src/LinearGradient.tsx"],
|
|
4
|
+
"mappings": ";AACA,SAASA,gBAAgBC,QAAQC,UAAUC,gBAAgB;AAC3D,SAASC,cAAc;AAIvB,SAASC,kBAAkBC,0BAA0B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAUrD,IAAMC,sBAAsBN,OAAOG,QAAQ;EACzCI,MAAM;EACNC,UAAU;EACVC,UAAU;AACZ,CAAA,GAEaL,iBAAiBE,oBAAoBI,UAChD,SAACC,SAASC,KAAAA;MAONC,eANIA,QAAQZ,SAASU,OAAAA,GAEfG,QAAuED,MAAvEC,OAAOC,MAAgEF,MAAhEE,KAAaC,aAAmDH,MAA3DI,QAAoBC,YAAuCL,MAAvCK,WAAWC,WAA4BN,MAA5BM,UAAaC,aAAAA,2BAAeP,OAAAA;IAAvEC;IAAOC;IAAKE;IAAoBC;IAAWC;MAC7CE,QAAQnB,SAAAA,GAEVe,WACFJ,gBAAAA,MAAMI,YAAM,QAAZJ,kBAAAA,SAAAA,SAAAA,cAAcS,IAAI,SAACC,GAAAA;QACTF,UAAAA;AAAR,YAAQA,gBAAAA,WAAAA,MAAME,CAAAA,OAAE,QAARF,aAAAA,SAAAA,SAAAA,SAAUG,IAAI,KAAA,OAAA,QAAdH,iBAAAA,SAAAA,eAAmCE;EAC7C,CAAA,MAAM,CAAA;AAER,SAAIE,QAAQC,IAAIC,aAAa,gBAEzBV,OAAOW,KAAK,SAACL,GAAAA;AACX,QAAMM,aAAa9B,eAAewB,CAAAA;AAClC,QAAI,CAACM,cAAcA,WAAWC,WAAW,GAAA;AACvC,aAAO;EAEX,CAAA,MAEAC,QAAQC,MACL,gEAAsE,OAAPf,QAAO,+CAAA,CAAA,GAEzEA,SAAS;IAAC;IAAQ;MAKpB,sBAACX,qBAAAA,qBAAAA,eAAAA;IAAoBM;KAAqBQ,UAAAA,GAAAA;;MACxC,qBAACf,oBAAAA;QACCS;QACAC;QACAE;QACAC;QACAe,OAAOC;;MAERf;;;AAGP,CAAA,GAKIe,gBAA2B;EAC/BzB,UAAU;EACV0B,KAAK;EACLC,MAAM;EACNC,OAAO;EACPC,QAAQ;EACRC,QAAQ;AACV;",
|
|
5
|
+
"names": ["normalizeColor", "styled", "useProps", "useTheme", "YStack", "LinearGradient", "ExpoLinearGradient", "LinearGradientFrame", "name", "overflow", "position", "styleable", "propsIn", "ref", "props", "start", "end", "colorsProp", "colors", "locations", "children", "stackProps", "theme", "map", "c", "get", "process", "env", "NODE_ENV", "some", "normalized", "startsWith", "console", "error", "style", "gradientStyle", "top", "left", "right", "bottom", "zIndex"]
|
|
6
6
|
}
|
|
@@ -1,2 +1,44 @@
|
|
|
1
|
-
|
|
1
|
+
import { normalizeColor, styled, useProps, useTheme } from "@tamagui/core";
|
|
2
|
+
import { YStack } from "@tamagui/stacks";
|
|
3
|
+
import { LinearGradient as ExpoLinearGradient } from "./linear-gradient";
|
|
4
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
5
|
+
const LinearGradientFrame = styled(YStack, {
|
|
6
|
+
name: "LinearGradient",
|
|
7
|
+
overflow: "hidden",
|
|
8
|
+
position: "relative"
|
|
9
|
+
}), LinearGradient = LinearGradientFrame.styleable(
|
|
10
|
+
(propsIn, ref) => {
|
|
11
|
+
const props = useProps(propsIn), { start, end, colors: colorsProp, locations, children, ...stackProps } = props, theme = useTheme();
|
|
12
|
+
let colors = props.colors?.map((c) => theme[c]?.get("web") ?? c) || [];
|
|
13
|
+
return process.env.NODE_ENV !== "production" && colors.some((c) => {
|
|
14
|
+
const normalized = normalizeColor(c);
|
|
15
|
+
if (!normalized || normalized.startsWith("$"))
|
|
16
|
+
return !0;
|
|
17
|
+
}) && (console.error(
|
|
18
|
+
`LinearGradient: "colors" prop contains invalid color tokens: ${colors} fallback to default colors: ["#000", "#fff"]`
|
|
19
|
+
), colors = ["#000", "#fff"]), /* @__PURE__ */ jsxs(LinearGradientFrame, { ref, ...stackProps, children: [
|
|
20
|
+
/* @__PURE__ */ jsx(
|
|
21
|
+
ExpoLinearGradient,
|
|
22
|
+
{
|
|
23
|
+
start,
|
|
24
|
+
end,
|
|
25
|
+
colors,
|
|
26
|
+
locations,
|
|
27
|
+
style: gradientStyle
|
|
28
|
+
}
|
|
29
|
+
),
|
|
30
|
+
children
|
|
31
|
+
] });
|
|
32
|
+
}
|
|
33
|
+
), gradientStyle = {
|
|
34
|
+
position: "absolute",
|
|
35
|
+
top: 0,
|
|
36
|
+
left: 0,
|
|
37
|
+
right: 0,
|
|
38
|
+
bottom: 0,
|
|
39
|
+
zIndex: 0
|
|
40
|
+
};
|
|
41
|
+
export {
|
|
42
|
+
LinearGradient
|
|
43
|
+
};
|
|
2
44
|
//# sourceMappingURL=LinearGradient.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/LinearGradient.tsx"],
|
|
4
|
-
"mappings": "AAAA,cAAc;",
|
|
4
|
+
"mappings": "AACA,SAAS,gBAAgB,QAAQ,UAAU,gBAAgB;AAC3D,SAAS,cAAc;AAIvB,SAAS,kBAAkB,0BAA0B;AA6C/C,SACE,KADF;AAnCN,MAAM,sBAAsB,OAAO,QAAQ;AAAA,EACzC,MAAM;AAAA,EACN,UAAU;AAAA,EACV,UAAU;AACZ,CAAC,GAEY,iBAAiB,oBAAoB;AAAA,EAChD,CAAC,SAAS,QAAQ;AAChB,UAAM,QAAQ,SAAS,OAAO,GAExB,EAAE,OAAO,KAAK,QAAQ,YAAY,WAAW,UAAU,GAAG,WAAW,IAAI,OACzE,QAAQ,SAAS;AAEvB,QAAI,SACF,MAAM,QAAQ,IAAI,CAAC,MACT,MAAM,CAAC,GAAG,IAAI,KAAK,KAAgB,CAC5C,KAAK,CAAC;AAET,WAAI,QAAQ,IAAI,aAAa,gBAEzB,OAAO,KAAK,CAAC,MAAM;AACjB,YAAM,aAAa,eAAe,CAAC;AACnC,UAAI,CAAC,cAAc,WAAW,WAAW,GAAG;AAC1C,eAAO;AAAA,IAEX,CAAC,MAED,QAAQ;AAAA,MACN,gEAAgE,MAAM;AAAA,IACxE,GACA,SAAS,CAAC,QAAQ,MAAM,IAK1B,qBAAC,uBAAoB,KAAkB,GAAG,YACxC;AAAA;AAAA,QAAC;AAAA;AAAA,UACC;AAAA,UACA;AAAA,UACA;AAAA,UACA;AAAA,UACA,OAAO;AAAA;AAAA,MACT;AAAA,MACC;AAAA,OACH;AAAA,EAEJ;AACF,GAIM,gBAA2B;AAAA,EAC/B,UAAU;AAAA,EACV,KAAK;AAAA,EACL,MAAM;AAAA,EACN,OAAO;AAAA,EACP,QAAQ;AAAA,EACR,QAAQ;AACV;",
|
|
5
5
|
"names": []
|
|
6
6
|
}
|
|
@@ -1,2 +1,46 @@
|
|
|
1
|
-
|
|
1
|
+
import { normalizeColor, styled, useProps, useTheme } from "@tamagui/core";
|
|
2
|
+
import { YStack } from "@tamagui/stacks";
|
|
3
|
+
import { LinearGradient as ExpoLinearGradient } from "./linear-gradient.mjs";
|
|
4
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
5
|
+
const LinearGradientFrame = styled(YStack, {
|
|
6
|
+
name: "LinearGradient",
|
|
7
|
+
overflow: "hidden",
|
|
8
|
+
position: "relative"
|
|
9
|
+
}),
|
|
10
|
+
LinearGradient = LinearGradientFrame.styleable((propsIn, ref) => {
|
|
11
|
+
const props = useProps(propsIn),
|
|
12
|
+
{
|
|
13
|
+
start,
|
|
14
|
+
end,
|
|
15
|
+
colors: colorsProp,
|
|
16
|
+
locations,
|
|
17
|
+
children,
|
|
18
|
+
...stackProps
|
|
19
|
+
} = props,
|
|
20
|
+
theme = useTheme();
|
|
21
|
+
let colors = props.colors?.map(c => theme[c]?.get("web") ?? c) || [];
|
|
22
|
+
return process.env.NODE_ENV !== "production" && colors.some(c => {
|
|
23
|
+
const normalized = normalizeColor(c);
|
|
24
|
+
if (!normalized || normalized.startsWith("$")) return !0;
|
|
25
|
+
}) && (console.error(`LinearGradient: "colors" prop contains invalid color tokens: ${colors} fallback to default colors: ["#000", "#fff"]`), colors = ["#000", "#fff"]), /* @__PURE__ */jsxs(LinearGradientFrame, {
|
|
26
|
+
ref,
|
|
27
|
+
...stackProps,
|
|
28
|
+
children: [/* @__PURE__ */jsx(ExpoLinearGradient, {
|
|
29
|
+
start,
|
|
30
|
+
end,
|
|
31
|
+
colors,
|
|
32
|
+
locations,
|
|
33
|
+
style: gradientStyle
|
|
34
|
+
}), children]
|
|
35
|
+
});
|
|
36
|
+
}),
|
|
37
|
+
gradientStyle = {
|
|
38
|
+
position: "absolute",
|
|
39
|
+
top: 0,
|
|
40
|
+
left: 0,
|
|
41
|
+
right: 0,
|
|
42
|
+
bottom: 0,
|
|
43
|
+
zIndex: 0
|
|
44
|
+
};
|
|
45
|
+
export { LinearGradient };
|
|
2
46
|
//# sourceMappingURL=LinearGradient.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":[],"sources":["../../src/LinearGradient.tsx"],"sourcesContent":[null],"mappings":"
|
|
1
|
+
{"version":3,"names":["normalizeColor","styled","useProps","useTheme","YStack","LinearGradient","ExpoLinearGradient","jsx","jsxs","LinearGradientFrame","name","overflow","position","styleable","propsIn","ref","props","start","end","colors","colorsProp","locations","children","stackProps","theme","map","c","get","process","env","NODE_ENV","some","normalized","startsWith","console","error","style","gradientStyle","top","left","right","bottom","zIndex"],"sources":["../../src/LinearGradient.tsx"],"sourcesContent":[null],"mappings":"AACA,SAASA,cAAA,EAAgBC,MAAA,EAAQC,QAAA,EAAUC,QAAA,QAAgB;AAC3D,SAASC,MAAA,QAAc;AAIvB,SAASC,cAAA,IAAkBC,kBAAA,QAA0B;AA6C/C,SACEC,GAAA,EADFC,IAAA;AAnCN,MAAMC,mBAAA,GAAsBR,MAAA,CAAOG,MAAA,EAAQ;IACzCM,IAAA,EAAM;IACNC,QAAA,EAAU;IACVC,QAAA,EAAU;EACZ,CAAC;EAEYP,cAAA,GAAiBI,mBAAA,CAAoBI,SAAA,CAChD,CAACC,OAAA,EAASC,GAAA,KAAQ;IAChB,MAAMC,KAAA,GAAQd,QAAA,CAASY,OAAO;MAExB;QAAEG,KAAA;QAAOC,GAAA;QAAKC,MAAA,EAAQC,UAAA;QAAYC,SAAA;QAAWC,QAAA;QAAU,GAAGC;MAAW,IAAIP,KAAA;MACzEQ,KAAA,GAAQrB,QAAA,CAAS;IAEvB,IAAIgB,MAAA,GACFH,KAAA,CAAMG,MAAA,EAAQM,GAAA,CAAKC,CAAA,IACTF,KAAA,CAAME,CAAC,GAAGC,GAAA,CAAI,KAAK,KAAgBD,CAC5C,KAAK,EAAC;IAET,OAAIE,OAAA,CAAQC,GAAA,CAAIC,QAAA,KAAa,gBAEzBX,MAAA,CAAOY,IAAA,CAAML,CAAA,IAAM;MACjB,MAAMM,UAAA,GAAahC,cAAA,CAAe0B,CAAC;MACnC,IAAI,CAACM,UAAA,IAAcA,UAAA,CAAWC,UAAA,CAAW,GAAG,GAC1C,OAAO;IAEX,CAAC,MAEDC,OAAA,CAAQC,KAAA,CACN,gEAAgEhB,MAAM,+CACxE,GACAA,MAAA,GAAS,CAAC,QAAQ,MAAM,IAK1B,eAAAX,IAAA,CAACC,mBAAA;MAAoBM,GAAA;MAAkB,GAAGQ,UAAA;MACxCD,QAAA,kBAAAf,GAAA,CAACD,kBAAA;QACCW,KAAA;QACAC,GAAA;QACAC,MAAA;QACAE,SAAA;QACAe,KAAA,EAAOC;MAAA,CACT,GACCf,QAAA;IAAA,CACH;EAEJ,CACF;EAIMe,aAAA,GAA2B;IAC/BzB,QAAA,EAAU;IACV0B,GAAA,EAAK;IACLC,IAAA,EAAM;IACNC,KAAA,EAAO;IACPC,MAAA,EAAQ;IACRC,MAAA,EAAQ;EACV","ignoreList":[]}
|
|
@@ -1,4 +1,7 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { normalizeColor, styled, useProps, useTheme } from "@tamagui/core";
|
|
3
|
+
import { YStack } from "@tamagui/stacks";
|
|
4
|
+
import { LinearGradient as ExpoLinearGradient } from "./linear-gradient";
|
|
2
5
|
function _define_property(obj, key, value) {
|
|
3
6
|
return key in obj ? Object.defineProperty(obj, key, {
|
|
4
7
|
value,
|
|
@@ -9,20 +12,92 @@ function _define_property(obj, key, value) {
|
|
|
9
12
|
}
|
|
10
13
|
function _object_spread(target) {
|
|
11
14
|
for (var i = 1; i < arguments.length; i++) {
|
|
12
|
-
var source = arguments[i] != null ? arguments[i] : {},
|
|
13
|
-
typeof Object.getOwnPropertySymbols == "function" && (
|
|
15
|
+
var source = arguments[i] != null ? arguments[i] : {}, ownKeys2 = Object.keys(source);
|
|
16
|
+
typeof Object.getOwnPropertySymbols == "function" && (ownKeys2 = ownKeys2.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
|
|
14
17
|
return Object.getOwnPropertyDescriptor(source, sym).enumerable;
|
|
15
|
-
}))),
|
|
18
|
+
}))), ownKeys2.forEach(function(key) {
|
|
16
19
|
_define_property(target, key, source[key]);
|
|
17
20
|
});
|
|
18
21
|
}
|
|
19
22
|
return target;
|
|
20
23
|
}
|
|
21
|
-
function
|
|
22
|
-
var
|
|
23
|
-
|
|
24
|
+
function ownKeys(object, enumerableOnly) {
|
|
25
|
+
var keys = Object.keys(object);
|
|
26
|
+
if (Object.getOwnPropertySymbols) {
|
|
27
|
+
var symbols = Object.getOwnPropertySymbols(object);
|
|
28
|
+
enumerableOnly && (symbols = symbols.filter(function(sym) {
|
|
29
|
+
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
|
|
30
|
+
})), keys.push.apply(keys, symbols);
|
|
31
|
+
}
|
|
32
|
+
return keys;
|
|
33
|
+
}
|
|
34
|
+
function _object_spread_props(target, source) {
|
|
35
|
+
return source = source ?? {}, Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function(key) {
|
|
36
|
+
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
|
37
|
+
}), target;
|
|
38
|
+
}
|
|
39
|
+
function _object_without_properties(source, excluded) {
|
|
40
|
+
if (source == null) return {};
|
|
41
|
+
var target = _object_without_properties_loose(source, excluded), key, i;
|
|
42
|
+
if (Object.getOwnPropertySymbols) {
|
|
43
|
+
var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
|
|
44
|
+
for (i = 0; i < sourceSymbolKeys.length; i++)
|
|
45
|
+
key = sourceSymbolKeys[i], !(excluded.indexOf(key) >= 0) && Object.prototype.propertyIsEnumerable.call(source, key) && (target[key] = source[key]);
|
|
46
|
+
}
|
|
47
|
+
return target;
|
|
48
|
+
}
|
|
49
|
+
function _object_without_properties_loose(source, excluded) {
|
|
50
|
+
if (source == null) return {};
|
|
51
|
+
var target = {}, sourceKeys = Object.keys(source), key, i;
|
|
52
|
+
for (i = 0; i < sourceKeys.length; i++)
|
|
53
|
+
key = sourceKeys[i], !(excluded.indexOf(key) >= 0) && (target[key] = source[key]);
|
|
54
|
+
return target;
|
|
24
55
|
}
|
|
56
|
+
var LinearGradientFrame = styled(YStack, {
|
|
57
|
+
name: "LinearGradient",
|
|
58
|
+
overflow: "hidden",
|
|
59
|
+
position: "relative"
|
|
60
|
+
}), LinearGradient = LinearGradientFrame.styleable(function(propsIn, ref) {
|
|
61
|
+
var _props_colors, props = useProps(propsIn), start = props.start, end = props.end, colorsProp = props.colors, locations = props.locations, children = props.children, stackProps = _object_without_properties(props, [
|
|
62
|
+
"start",
|
|
63
|
+
"end",
|
|
64
|
+
"colors",
|
|
65
|
+
"locations",
|
|
66
|
+
"children"
|
|
67
|
+
]), theme = useTheme(), colors = ((_props_colors = props.colors) === null || _props_colors === void 0 ? void 0 : _props_colors.map(function(c) {
|
|
68
|
+
var _theme_c, _theme_c_get;
|
|
69
|
+
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;
|
|
70
|
+
})) || [];
|
|
71
|
+
return process.env.NODE_ENV !== "production" && colors.some(function(c) {
|
|
72
|
+
var normalized = normalizeColor(c);
|
|
73
|
+
if (!normalized || normalized.startsWith("$"))
|
|
74
|
+
return !0;
|
|
75
|
+
}) && (console.error('LinearGradient: "colors" prop contains invalid color tokens: '.concat(colors, ' fallback to default colors: ["#000", "#fff"]')), colors = [
|
|
76
|
+
"#000",
|
|
77
|
+
"#fff"
|
|
78
|
+
]), /* @__PURE__ */ _jsxs(LinearGradientFrame, _object_spread_props(_object_spread({
|
|
79
|
+
ref
|
|
80
|
+
}, stackProps), {
|
|
81
|
+
children: [
|
|
82
|
+
/* @__PURE__ */ _jsx(ExpoLinearGradient, {
|
|
83
|
+
start,
|
|
84
|
+
end,
|
|
85
|
+
colors,
|
|
86
|
+
locations,
|
|
87
|
+
style: gradientStyle
|
|
88
|
+
}),
|
|
89
|
+
children
|
|
90
|
+
]
|
|
91
|
+
}));
|
|
92
|
+
}), gradientStyle = {
|
|
93
|
+
position: "absolute",
|
|
94
|
+
top: 0,
|
|
95
|
+
left: 0,
|
|
96
|
+
right: 0,
|
|
97
|
+
bottom: 0,
|
|
98
|
+
zIndex: 0
|
|
99
|
+
};
|
|
25
100
|
export {
|
|
26
101
|
LinearGradient
|
|
27
102
|
};
|
|
28
|
-
//# sourceMappingURL=LinearGradient.
|
|
103
|
+
//# sourceMappingURL=LinearGradient.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
|
-
"sources": ["../../src/Users/n8/tamagui/code/ui/linear-gradient/src/LinearGradient.
|
|
4
|
-
"mappings": ";
|
|
5
|
-
"names": ["LinearGradient", "props", "
|
|
3
|
+
"sources": ["../../src/Users/n8/tamagui/code/ui/linear-gradient/src/LinearGradient.tsx"],
|
|
4
|
+
"mappings": ";AACA,SAASA,gBAAgBC,QAAQC,UAAUC,gBAAgB;AAC3D,SAASC,cAAc;AAIvB,SAASC,kBAAkBC,0BAA0B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAUrD,IAAMC,sBAAsBN,OAAOG,QAAQ;EACzCI,MAAM;EACNC,UAAU;EACVC,UAAU;AACZ,CAAA,GAEaL,iBAAiBE,oBAAoBI,UAChD,SAACC,SAASC,KAAAA;MAONC,eANIA,QAAQZ,SAASU,OAAAA,GAEfG,QAAuED,MAAvEC,OAAOC,MAAgEF,MAAhEE,KAAaC,aAAmDH,MAA3DI,QAAoBC,YAAuCL,MAAvCK,WAAWC,WAA4BN,MAA5BM,UAAaC,aAAAA,2BAAeP,OAAAA;IAAvEC;IAAOC;IAAKE;IAAoBC;IAAWC;MAC7CE,QAAQnB,SAAAA,GAEVe,WACFJ,gBAAAA,MAAMI,YAAM,QAAZJ,kBAAAA,SAAAA,SAAAA,cAAcS,IAAI,SAACC,GAAAA;QACTF,UAAAA;AAAR,YAAQA,gBAAAA,WAAAA,MAAME,CAAAA,OAAE,QAARF,aAAAA,SAAAA,SAAAA,SAAUG,IAAI,KAAA,OAAA,QAAdH,iBAAAA,SAAAA,eAAmCE;EAC7C,CAAA,MAAM,CAAA;AAER,SAAIE,QAAQC,IAAIC,aAAa,gBAEzBV,OAAOW,KAAK,SAACL,GAAAA;AACX,QAAMM,aAAa9B,eAAewB,CAAAA;AAClC,QAAI,CAACM,cAAcA,WAAWC,WAAW,GAAA;AACvC,aAAO;EAEX,CAAA,MAEAC,QAAQC,MACL,gEAAsE,OAAPf,QAAO,+CAAA,CAAA,GAEzEA,SAAS;IAAC;IAAQ;MAKpB,sBAACX,qBAAAA,qBAAAA,eAAAA;IAAoBM;KAAqBQ,UAAAA,GAAAA;;MACxC,qBAACf,oBAAAA;QACCS;QACAC;QACAE;QACAC;QACAe,OAAOC;;MAERf;;;AAGP,CAAA,GAKIe,gBAA2B;EAC/BzB,UAAU;EACV0B,KAAK;EACLC,MAAM;EACNC,OAAO;EACPC,QAAQ;EACRC,QAAQ;AACV;",
|
|
5
|
+
"names": ["normalizeColor", "styled", "useProps", "useTheme", "YStack", "LinearGradient", "ExpoLinearGradient", "LinearGradientFrame", "name", "overflow", "position", "styleable", "propsIn", "ref", "props", "start", "end", "colorsProp", "colors", "locations", "children", "stackProps", "theme", "map", "c", "get", "process", "env", "NODE_ENV", "some", "normalized", "startsWith", "console", "error", "style", "gradientStyle", "top", "left", "right", "bottom", "zIndex"]
|
|
6
6
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tamagui/linear-gradient",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.109.1",
|
|
4
4
|
"sideEffects": [
|
|
5
5
|
"*.css"
|
|
6
6
|
],
|
|
@@ -33,11 +33,11 @@
|
|
|
33
33
|
}
|
|
34
34
|
},
|
|
35
35
|
"dependencies": {
|
|
36
|
-
"@tamagui/core": "1.
|
|
37
|
-
"@tamagui/stacks": "1.
|
|
36
|
+
"@tamagui/core": "1.109.1",
|
|
37
|
+
"@tamagui/stacks": "1.109.1"
|
|
38
38
|
},
|
|
39
39
|
"devDependencies": {
|
|
40
|
-
"@tamagui/build": "1.
|
|
40
|
+
"@tamagui/build": "1.109.1",
|
|
41
41
|
"expo-linear-gradient": "~13.0.2",
|
|
42
42
|
"react": "^18.2.0 || ^19.0.0"
|
|
43
43
|
},
|
package/src/LinearGradient.tsx
CHANGED
|
@@ -1 +1,75 @@
|
|
|
1
|
-
|
|
1
|
+
import type { ColorTokens, GetProps, ThemeTokens } from '@tamagui/core'
|
|
2
|
+
import { normalizeColor, styled, useProps, useTheme } from '@tamagui/core'
|
|
3
|
+
import { YStack } from '@tamagui/stacks'
|
|
4
|
+
import type { ViewStyle } from 'react-native'
|
|
5
|
+
|
|
6
|
+
import type { LinearGradientPoint } from './linear-gradient'
|
|
7
|
+
import { LinearGradient as ExpoLinearGradient } from './linear-gradient'
|
|
8
|
+
|
|
9
|
+
// taken from expo-linear-gradient
|
|
10
|
+
export type LinearGradientExtraProps = {
|
|
11
|
+
colors?: (ColorTokens | ThemeTokens | (string & {}))[]
|
|
12
|
+
locations?: number[] | null
|
|
13
|
+
start?: LinearGradientPoint | null
|
|
14
|
+
end?: LinearGradientPoint | null
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
const LinearGradientFrame = styled(YStack, {
|
|
18
|
+
name: 'LinearGradient',
|
|
19
|
+
overflow: 'hidden',
|
|
20
|
+
position: 'relative',
|
|
21
|
+
})
|
|
22
|
+
|
|
23
|
+
export const LinearGradient = LinearGradientFrame.styleable<LinearGradientExtraProps>(
|
|
24
|
+
(propsIn, ref) => {
|
|
25
|
+
const props = useProps(propsIn)
|
|
26
|
+
|
|
27
|
+
const { start, end, colors: colorsProp, locations, children, ...stackProps } = props
|
|
28
|
+
const theme = useTheme()
|
|
29
|
+
|
|
30
|
+
let colors =
|
|
31
|
+
props.colors?.map((c) => {
|
|
32
|
+
return (theme[c]?.get('web') as string) ?? c
|
|
33
|
+
}) || []
|
|
34
|
+
|
|
35
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
36
|
+
if (
|
|
37
|
+
colors.some((c) => {
|
|
38
|
+
const normalized = normalizeColor(c)
|
|
39
|
+
if (!normalized || normalized.startsWith('$')) {
|
|
40
|
+
return true
|
|
41
|
+
}
|
|
42
|
+
})
|
|
43
|
+
) {
|
|
44
|
+
console.error(
|
|
45
|
+
`LinearGradient: "colors" prop contains invalid color tokens: ${colors} fallback to default colors: ["#000", "#fff"]`
|
|
46
|
+
)
|
|
47
|
+
colors = ['#000', '#fff']
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
return (
|
|
52
|
+
<LinearGradientFrame ref={ref as any} {...stackProps}>
|
|
53
|
+
<ExpoLinearGradient
|
|
54
|
+
start={start}
|
|
55
|
+
end={end}
|
|
56
|
+
colors={colors}
|
|
57
|
+
locations={locations}
|
|
58
|
+
style={gradientStyle}
|
|
59
|
+
/>
|
|
60
|
+
{children}
|
|
61
|
+
</LinearGradientFrame>
|
|
62
|
+
)
|
|
63
|
+
}
|
|
64
|
+
)
|
|
65
|
+
|
|
66
|
+
export type LinearGradientProps = GetProps<typeof LinearGradient>
|
|
67
|
+
|
|
68
|
+
const gradientStyle: ViewStyle = {
|
|
69
|
+
position: 'absolute',
|
|
70
|
+
top: 0,
|
|
71
|
+
left: 0,
|
|
72
|
+
right: 0,
|
|
73
|
+
bottom: 0,
|
|
74
|
+
zIndex: 0,
|
|
75
|
+
}
|
|
@@ -1,2 +1,29 @@
|
|
|
1
|
-
|
|
1
|
+
import type { ColorTokens, GetProps, ThemeTokens } from '@tamagui/core';
|
|
2
|
+
import type { LinearGradientPoint } from './linear-gradient';
|
|
3
|
+
export type LinearGradientExtraProps = {
|
|
4
|
+
colors?: (ColorTokens | ThemeTokens | (string & {}))[];
|
|
5
|
+
locations?: number[] | null;
|
|
6
|
+
start?: LinearGradientPoint | null;
|
|
7
|
+
end?: LinearGradientPoint | null;
|
|
8
|
+
};
|
|
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").SizeTokens | undefined;
|
|
11
|
+
fullscreen?: boolean | undefined;
|
|
12
|
+
inset?: number | import("@tamagui/core").SizeTokens | {
|
|
13
|
+
top?: number;
|
|
14
|
+
bottom?: number;
|
|
15
|
+
left?: number;
|
|
16
|
+
right?: number;
|
|
17
|
+
} | undefined;
|
|
18
|
+
}>, keyof LinearGradientExtraProps> & LinearGradientExtraProps, import("@tamagui/core").TamaguiElement, import("@tamagui/core").RNTamaguiViewNonStyleProps & LinearGradientExtraProps, import("@tamagui/core").StackStyleBase, {
|
|
19
|
+
elevation?: number | import("@tamagui/core").SizeTokens | undefined;
|
|
20
|
+
fullscreen?: boolean | undefined;
|
|
21
|
+
inset?: number | import("@tamagui/core").SizeTokens | {
|
|
22
|
+
top?: number;
|
|
23
|
+
bottom?: number;
|
|
24
|
+
left?: number;
|
|
25
|
+
right?: number;
|
|
26
|
+
} | undefined;
|
|
27
|
+
}, import("@tamagui/core").StaticConfigPublic>;
|
|
28
|
+
export type LinearGradientProps = GetProps<typeof LinearGradient>;
|
|
2
29
|
//# sourceMappingURL=LinearGradient.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LinearGradient.d.ts","sourceRoot":"","sources":["../src/LinearGradient.tsx"],"names":[],"mappings":"AAAA,cAAc,
|
|
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;AAKvE,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;;;;;;;;;;;;;;;;;;8CAyC1B,CAAA;AAED,MAAM,MAAM,mBAAmB,GAAG,QAAQ,CAAC,OAAO,cAAc,CAAC,CAAA"}
|
|
@@ -1,75 +0,0 @@
|
|
|
1
|
-
import type { ColorTokens, GetProps, ThemeTokens } from '@tamagui/core'
|
|
2
|
-
import { normalizeColor, styled, useProps, useTheme } from '@tamagui/core'
|
|
3
|
-
import { YStack } from '@tamagui/stacks'
|
|
4
|
-
import type { ViewStyle } from 'react-native'
|
|
5
|
-
|
|
6
|
-
import type { LinearGradientPoint } from './linear-gradient'
|
|
7
|
-
import { LinearGradient as ExpoLinearGradient } from './linear-gradient'
|
|
8
|
-
|
|
9
|
-
// taken from expo-linear-gradient
|
|
10
|
-
export type LinearGradientExtraProps = {
|
|
11
|
-
colors?: (ColorTokens | ThemeTokens | (string & {}))[]
|
|
12
|
-
locations?: number[] | null
|
|
13
|
-
start?: LinearGradientPoint | null
|
|
14
|
-
end?: LinearGradientPoint | null
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
const LinearGradientFrame = styled(YStack, {
|
|
18
|
-
name: 'LinearGradient',
|
|
19
|
-
overflow: 'hidden',
|
|
20
|
-
position: 'relative',
|
|
21
|
-
})
|
|
22
|
-
|
|
23
|
-
export const LinearGradient = LinearGradientFrame.styleable<LinearGradientExtraProps>(
|
|
24
|
-
(propsIn, ref) => {
|
|
25
|
-
const props = useProps(propsIn)
|
|
26
|
-
|
|
27
|
-
const { start, end, colors: colorsProp, locations, children, ...stackProps } = props
|
|
28
|
-
const theme = useTheme()
|
|
29
|
-
|
|
30
|
-
let colors =
|
|
31
|
-
props.colors?.map((c) => {
|
|
32
|
-
return (theme[c]?.get('web') as string) ?? c
|
|
33
|
-
}) || []
|
|
34
|
-
|
|
35
|
-
if (process.env.NODE_ENV !== 'production') {
|
|
36
|
-
if (
|
|
37
|
-
colors.some((c) => {
|
|
38
|
-
const normalized = normalizeColor(c)
|
|
39
|
-
if (!normalized || normalized.startsWith('$')) {
|
|
40
|
-
return true
|
|
41
|
-
}
|
|
42
|
-
})
|
|
43
|
-
) {
|
|
44
|
-
console.error(
|
|
45
|
-
`LinearGradient: "colors" prop contains invalid color tokens: ${colors} fallback to default colors: ["#000", "#fff"]`
|
|
46
|
-
)
|
|
47
|
-
colors = ['#000', '#fff']
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
return (
|
|
52
|
-
<LinearGradientFrame ref={ref as any} {...stackProps}>
|
|
53
|
-
<ExpoLinearGradient
|
|
54
|
-
start={start}
|
|
55
|
-
end={end}
|
|
56
|
-
colors={colors}
|
|
57
|
-
locations={locations}
|
|
58
|
-
style={gradientStyle}
|
|
59
|
-
/>
|
|
60
|
-
{children}
|
|
61
|
-
</LinearGradientFrame>
|
|
62
|
-
)
|
|
63
|
-
}
|
|
64
|
-
)
|
|
65
|
-
|
|
66
|
-
export type LinearGradientProps = GetProps<typeof LinearGradient>
|
|
67
|
-
|
|
68
|
-
const gradientStyle: ViewStyle = {
|
|
69
|
-
position: 'absolute',
|
|
70
|
-
top: 0,
|
|
71
|
-
left: 0,
|
|
72
|
-
right: 0,
|
|
73
|
-
bottom: 0,
|
|
74
|
-
zIndex: 0,
|
|
75
|
-
}
|