@tamagui/linear-gradient 2.0.0-rc.4 → 2.0.0-rc.40
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 +64 -52
- package/dist/cjs/LinearGradient.native.js +68 -57
- package/dist/cjs/LinearGradient.native.js.map +1 -1
- package/dist/cjs/index.cjs +12 -10
- package/dist/cjs/index.native.js +12 -10
- package/dist/cjs/index.native.js.map +1 -1
- package/dist/cjs/linear-gradient.cjs +90 -65
- package/dist/cjs/linear-gradient.native.js +16 -13
- package/dist/cjs/linear-gradient.native.js.map +1 -1
- package/dist/esm/LinearGradient.mjs +48 -38
- package/dist/esm/LinearGradient.mjs.map +1 -1
- package/dist/esm/LinearGradient.native.js +51 -42
- package/dist/esm/LinearGradient.native.js.map +1 -1
- package/dist/esm/index.js +2 -6
- package/dist/esm/index.js.map +1 -6
- package/dist/esm/linear-gradient.mjs +62 -39
- package/dist/esm/linear-gradient.mjs.map +1 -1
- package/dist/esm/linear-gradient.native.js +2 -1
- package/dist/esm/linear-gradient.native.js.map +1 -1
- package/dist/jsx/LinearGradient.mjs +48 -38
- package/dist/jsx/LinearGradient.mjs.map +1 -1
- package/dist/jsx/LinearGradient.native.js +68 -57
- package/dist/jsx/LinearGradient.native.js.map +1 -1
- package/dist/jsx/index.js +2 -6
- package/dist/jsx/index.js.map +1 -6
- package/dist/jsx/index.native.js +12 -10
- package/dist/jsx/linear-gradient.mjs +62 -39
- package/dist/jsx/linear-gradient.mjs.map +1 -1
- package/dist/jsx/linear-gradient.native.js +16 -13
- package/dist/jsx/linear-gradient.native.js.map +1 -1
- package/package.json +10 -13
- package/dist/cjs/LinearGradient.js +0 -57
- package/dist/cjs/LinearGradient.js.map +0 -6
- package/dist/cjs/index.js +0 -21
- package/dist/cjs/index.js.map +0 -6
- package/dist/cjs/linear-gradient.js +0 -118
- package/dist/cjs/linear-gradient.js.map +0 -6
- package/dist/esm/LinearGradient.js +0 -44
- package/dist/esm/LinearGradient.js.map +0 -6
- package/dist/esm/linear-gradient.js +0 -97
- package/dist/esm/linear-gradient.js.map +0 -6
- package/dist/jsx/LinearGradient.js +0 -44
- package/dist/jsx/LinearGradient.js.map +0 -6
- package/dist/jsx/linear-gradient.js +0 -97
- package/dist/jsx/linear-gradient.js.map +0 -6
|
@@ -3,67 +3,79 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
|
3
3
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
4
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
5
|
var __export = (target, all) => {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
6
|
+
for (var name in all) __defProp(target, name, {
|
|
7
|
+
get: all[name],
|
|
8
|
+
enumerable: true
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
+
for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
13
14
|
get: () => from[key],
|
|
14
15
|
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
15
16
|
});
|
|
16
|
-
|
|
17
|
-
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
18
20
|
var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
|
|
19
|
-
value:
|
|
21
|
+
value: true
|
|
20
22
|
}), mod);
|
|
21
23
|
var LinearGradient_exports = {};
|
|
22
24
|
__export(LinearGradient_exports, {
|
|
23
25
|
LinearGradient: () => LinearGradient
|
|
24
26
|
});
|
|
25
27
|
module.exports = __toCommonJS(LinearGradient_exports);
|
|
26
|
-
var import_core = require("@tamagui/core")
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
28
|
+
var import_core = require("@tamagui/core");
|
|
29
|
+
var import_stacks = require("@tamagui/stacks");
|
|
30
|
+
var import_linear_gradient = require("./linear-gradient.cjs");
|
|
31
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
30
32
|
const LinearGradientFrame = (0, import_core.styled)(import_stacks.YStack, {
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
return
|
|
33
|
+
name: "LinearGradient",
|
|
34
|
+
overflow: "hidden",
|
|
35
|
+
position: "relative"
|
|
36
|
+
});
|
|
37
|
+
const LinearGradient = LinearGradientFrame.styleable((propsIn, ref) => {
|
|
38
|
+
const props = (0, import_core.useProps)(propsIn);
|
|
39
|
+
const {
|
|
40
|
+
start,
|
|
41
|
+
end,
|
|
42
|
+
colors: colorsProp,
|
|
43
|
+
locations,
|
|
44
|
+
children,
|
|
45
|
+
...stackProps
|
|
46
|
+
} = props;
|
|
47
|
+
const theme = (0, import_core.useTheme)();
|
|
48
|
+
let colors = props.colors?.map(c => {
|
|
49
|
+
return theme[c]?.get("web") ?? c;
|
|
50
|
+
}) || [];
|
|
51
|
+
if (process.env.NODE_ENV !== "production") {
|
|
52
|
+
if (colors.some(c => {
|
|
48
53
|
const normalized = (0, import_core.normalizeColor)(c);
|
|
49
|
-
if (!normalized || normalized.startsWith("$"))
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
54
|
+
if (!normalized || normalized.startsWith("$")) {
|
|
55
|
+
return true;
|
|
56
|
+
}
|
|
57
|
+
})) {
|
|
58
|
+
console.error(`LinearGradient: "colors" prop contains invalid color tokens: ${colors} fallback to default colors: ["#000", "#fff"]`);
|
|
59
|
+
colors = ["#000", "#fff"];
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
return /* @__PURE__ */(0, import_jsx_runtime.jsxs)(LinearGradientFrame, {
|
|
63
|
+
ref,
|
|
64
|
+
...stackProps,
|
|
65
|
+
children: [/* @__PURE__ */(0, import_jsx_runtime.jsx)(import_linear_gradient.LinearGradient, {
|
|
66
|
+
start,
|
|
67
|
+
end,
|
|
68
|
+
colors,
|
|
69
|
+
locations,
|
|
70
|
+
style: gradientStyle
|
|
71
|
+
}), children]
|
|
72
|
+
});
|
|
73
|
+
});
|
|
74
|
+
const gradientStyle = {
|
|
75
|
+
position: "absolute",
|
|
76
|
+
top: 0,
|
|
77
|
+
left: 0,
|
|
78
|
+
right: 0,
|
|
79
|
+
bottom: 0,
|
|
80
|
+
zIndex: 0
|
|
81
|
+
};
|
|
@@ -5,72 +5,83 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
|
5
5
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
6
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
7
|
var __export = (target, all) => {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
8
|
+
for (var name in all) __defProp(target, name, {
|
|
9
|
+
get: all[name],
|
|
10
|
+
enumerable: true
|
|
11
|
+
});
|
|
12
|
+
};
|
|
13
|
+
var __copyProps = (to, from, except, desc) => {
|
|
14
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
15
|
+
for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
15
16
|
get: () => from[key],
|
|
16
17
|
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
17
18
|
});
|
|
18
|
-
|
|
19
|
-
|
|
19
|
+
}
|
|
20
|
+
return to;
|
|
21
|
+
};
|
|
20
22
|
var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
|
|
21
|
-
value:
|
|
23
|
+
value: true
|
|
22
24
|
}), mod);
|
|
23
25
|
var LinearGradient_exports = {};
|
|
24
26
|
__export(LinearGradient_exports, {
|
|
25
27
|
LinearGradient: () => LinearGradient
|
|
26
28
|
});
|
|
27
29
|
module.exports = __toCommonJS(LinearGradient_exports);
|
|
28
|
-
var import_jsx_runtime = require("react/jsx-runtime")
|
|
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
|
-
|
|
30
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
31
|
+
var import_core = require("@tamagui/core");
|
|
32
|
+
var import_stacks = require("@tamagui/stacks");
|
|
33
|
+
var import_linear_gradient = require("./linear-gradient.native.js");
|
|
34
|
+
var LinearGradientFrame = (0, import_core.styled)(import_stacks.YStack, {
|
|
35
|
+
name: "LinearGradient",
|
|
36
|
+
overflow: "hidden",
|
|
37
|
+
position: "relative"
|
|
38
|
+
});
|
|
39
|
+
var LinearGradient = LinearGradientFrame.styleable(function (propsIn, ref) {
|
|
40
|
+
var _props_colors;
|
|
41
|
+
var props = (0, import_core.useProps)(propsIn);
|
|
42
|
+
var {
|
|
43
|
+
start,
|
|
44
|
+
end,
|
|
45
|
+
colors: colorsProp,
|
|
46
|
+
locations,
|
|
47
|
+
children,
|
|
48
|
+
...stackProps
|
|
49
|
+
} = props;
|
|
50
|
+
var theme = (0, import_core.useTheme)();
|
|
51
|
+
var colors = ((_props_colors = props.colors) === null || _props_colors === void 0 ? void 0 : _props_colors.map(function (c) {
|
|
52
|
+
var _theme_c;
|
|
53
|
+
var _theme_c_get;
|
|
54
|
+
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;
|
|
55
|
+
})) || [];
|
|
56
|
+
if (process.env.NODE_ENV !== "production") {
|
|
57
|
+
if (colors.some(function (c) {
|
|
54
58
|
var normalized = (0, import_core.normalizeColor)(c);
|
|
55
|
-
if (!normalized || normalized.startsWith("$"))
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
59
|
+
if (!normalized || normalized.startsWith("$")) {
|
|
60
|
+
return true;
|
|
61
|
+
}
|
|
62
|
+
})) {
|
|
63
|
+
console.error(`LinearGradient: "colors" prop contains invalid color tokens: ${colors} fallback to default colors: ["#000", "#fff"]`);
|
|
64
|
+
colors = ["#000", "#fff"];
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
return /* @__PURE__ */(0, import_jsx_runtime.jsxs)(LinearGradientFrame, {
|
|
68
|
+
ref,
|
|
69
|
+
...stackProps,
|
|
70
|
+
children: [/* @__PURE__ */(0, import_jsx_runtime.jsx)(import_linear_gradient.LinearGradient, {
|
|
71
|
+
start,
|
|
72
|
+
end,
|
|
73
|
+
colors,
|
|
74
|
+
locations,
|
|
75
|
+
style: gradientStyle
|
|
76
|
+
}), children]
|
|
77
|
+
});
|
|
78
|
+
});
|
|
79
|
+
var gradientStyle = {
|
|
80
|
+
position: "absolute",
|
|
81
|
+
top: 0,
|
|
82
|
+
left: 0,
|
|
83
|
+
right: 0,
|
|
84
|
+
bottom: 0,
|
|
85
|
+
zIndex: 0
|
|
86
|
+
};
|
|
76
87
|
//# sourceMappingURL=LinearGradient.native.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["__toCommonJS","mod","__copyProps","__defProp","value","LinearGradient_exports","__export","LinearGradient","module","exports","import_jsx_runtime","require","import_core","import_stacks","import_linear_gradient","LinearGradientFrame","styled","YStack","name","overflow","position","styleable","propsIn","ref","_props_colors","props","useProps","start","end","colors","colorsProp","locations","children","stackProps","theme","useTheme","map","c","_theme_c","_theme_c_get","get","process","env","NODE_ENV","some","normalized","normalizeColor","startsWith","console","error","jsxs","jsx","style","gradientStyle","top","left"
|
|
1
|
+
{"version":3,"names":["__toCommonJS","mod","__copyProps","__defProp","value","LinearGradient_exports","__export","LinearGradient","module","exports","import_jsx_runtime","require","import_core","import_stacks","import_linear_gradient","LinearGradientFrame","styled","YStack","name","overflow","position","styleable","propsIn","ref","_props_colors","props","useProps","start","end","colors","colorsProp","locations","children","stackProps","theme","useTheme","map","c","_theme_c","_theme_c_get","get","process","env","NODE_ENV","some","normalized","normalizeColor","startsWith","console","error","jsxs","jsx","style","gradientStyle","top","left"],"sources":["../../src/LinearGradient.tsx"],"sourcesContent":[null],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,YAAA,GAAAC,GAAA,IAAAC,WAAA,CAAAC,SAAA;EAAAC,KAAA;AAAA,IAAAH,GAAA;AAAA,IAAAI,sBAAA;AAAAC,QAAA,CAAAD,sBAAA;EAAAE,cAAA,EAAAA,CAAA,KAAAA;AAAA;AACAC,MAAA,CAAAC,OAAA,GAAAT,YAA2D,CAAAK,sBAAA;AAC3D,IAAAK,kBAAuB,GAAAC,OAAA;AAIvB,IAAAC,WAAA,GAAAD,OAAA,gBAAqD;AA6C/C,IAAAE,aAAA,GAAAF,OAAA;AAnCN,IAAAG,sBAAM,GAAAH,OAAsB,8BAAO;AAAQ,IACzCI,mBAAM,OAAAH,WAAA,CAAAI,MAAA,EAAAH,aAAA,CAAAI,MAAA;EACNC,IAAA,kBAAU;EACVC,QAAA,EAAU;EACXC,QAAA;AAEM;AAA2C,IAC/Cb,cAAS,GAAQQ,mBAAA,CAAAM,SAAA,WAAAC,OAAA,EAAAC,GAAA;EAChB,IAAAC,aAAM;EAEN,IAAAC,KAAM,GAAE,IAAAb,WAAY,CAAAc,QAAQ,EAAAJ,OAAY;EACxC;IAAAK,KAAM;IAAAC,GAAA;IAAAC,MAAQ,EAAAC,UAAA;IAAAC,SAAS;IAAAC,QAAA;IAAA,GAAAC;EAAA,IAAAR,KAAA;EAEvB,IAAAS,KAAI,OACFtB,WAAM,CAAAuB,QAAa;EACjB,IAAAN,MAAA,GAAQ,EAAAL,aAAc,GAAKC,KAAgB,CAAAI,MAAA,cAAAL,aAAA,uBAAAA,aAAA,CAAAY,GAAA,WAAAC,CAAA;IAC7C,IAACC,QAAM;IAET,IAAIC,YAAY;IACd,OACE,CAAAA,YAAa,IAAAD,QAAM,GAAAJ,KAAA,CAAAG,CAAA,eAAAC,QAAA,uBAAAA,QAAA,CAAAE,GAAA,qBAAAD,YAAA,cAAAA,YAAA,GAAAF,CAAA;EACjB;EACA,IAAAI,OAAK,CAAAC,GAAA,CAAAC,QAAA,KAAc,YAAW;IAC5B,IAAAd,MAAA,CAAAe,IAAO,WAAAP,CAAA;MAAA,IACTQ,UAAA,OAAAjC,WAAA,CAAAkC,cAAA,EAAAT,CAAA;MACF,IACA,CAAAQ,UAAA,IAAAA,UAAA,CAAAE,UAAA;QACA,WAAQ;MAAA;IACgE,IACxE;MACAC,OAAA,CAAAC,KAAU,iEAAcpB,MAAA;MAC1BA,MAAA,IACF,QAEA,MACE,CACE;IAAA;EAAC;EAAA,sBACC,IAAAnB,kBAAA,CAAAwC,IAAA,EAAAnC,mBAAA;IAAAQ,GAAA;IACA,GAAAU,UACA;IAAAD,QACA,kBACO,IAAAtB,kBAAA,CAAAyC,GAAA,EAAArC,sBAAA,CAAAP,cAAA;MAAAoB,KAAA;MACTC,GAAA;MACCC,MAAA;MACHE,SAAA;MAEJqB,KAAA,EAAAC;IACF,IAIMrB,QAAA;EAEJ;AAAK,EACL;AAAM,IACNqB,aAAO;EACPjC,QAAQ;EACRkC,GAAA;EACFC,IAAA","ignoreList":[]}
|
package/dist/cjs/index.cjs
CHANGED
|
@@ -3,20 +3,22 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
|
3
3
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
4
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
5
|
var __export = (target, all) => {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
6
|
+
for (var name in all) __defProp(target, name, {
|
|
7
|
+
get: all[name],
|
|
8
|
+
enumerable: true
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
+
for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
13
14
|
get: () => from[key],
|
|
14
15
|
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
15
16
|
});
|
|
16
|
-
|
|
17
|
-
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
18
20
|
var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
|
|
19
|
-
value:
|
|
21
|
+
value: true
|
|
20
22
|
}), mod);
|
|
21
23
|
var index_exports = {};
|
|
22
24
|
__export(index_exports, {
|
package/dist/cjs/index.native.js
CHANGED
|
@@ -5,20 +5,22 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
|
5
5
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
6
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
7
|
var __export = (target, all) => {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
8
|
+
for (var name in all) __defProp(target, name, {
|
|
9
|
+
get: all[name],
|
|
10
|
+
enumerable: true
|
|
11
|
+
});
|
|
12
|
+
};
|
|
13
|
+
var __copyProps = (to, from, except, desc) => {
|
|
14
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
15
|
+
for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
15
16
|
get: () => from[key],
|
|
16
17
|
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
17
18
|
});
|
|
18
|
-
|
|
19
|
-
|
|
19
|
+
}
|
|
20
|
+
return to;
|
|
21
|
+
};
|
|
20
22
|
var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
|
|
21
|
-
value:
|
|
23
|
+
value: true
|
|
22
24
|
}), mod);
|
|
23
25
|
var index_exports = {};
|
|
24
26
|
__export(index_exports, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["__toCommonJS","mod","__copyProps","__defProp","value","index_exports","__export","LinearGradient","import_LinearGradient","module","exports"],"sources":["../../src/index.ts"],"sourcesContent":[null],"mappings":"
|
|
1
|
+
{"version":3,"names":["__toCommonJS","mod","__copyProps","__defProp","value","index_exports","__export","LinearGradient","import_LinearGradient","module","exports"],"sources":["../../src/index.ts"],"sourcesContent":[null],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,YAAA,GAAAC,GAAA,IAAAC,WAAA,CAAAC,SAAA;EAAAC,KAAA;AAAA,IAAAH,GAAA;AAAA,IAAAI,aAAA;AAAAC,QAAA,CAAAD,aAAA;EAAAE,cAAA,EAAAA,CAAA,KAAAC,qBAAA,CAAAD;AAAA;AAAAE,MAAA,CAAAC,OAAA,GAAAV,YAIO,CAAAK,aAAA","ignoreList":[]}
|
|
@@ -2,46 +2,48 @@ var __create = Object.create;
|
|
|
2
2
|
var __defProp = Object.defineProperty;
|
|
3
3
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
4
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __getProtoOf = Object.getPrototypeOf
|
|
6
|
-
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
7
|
var __export = (target, all) => {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
8
|
+
for (var name in all) __defProp(target, name, {
|
|
9
|
+
get: all[name],
|
|
10
|
+
enumerable: true
|
|
11
|
+
});
|
|
12
|
+
};
|
|
13
|
+
var __copyProps = (to, from, except, desc) => {
|
|
14
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
15
|
+
for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
15
16
|
get: () => from[key],
|
|
16
17
|
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
17
18
|
});
|
|
18
|
-
|
|
19
|
-
|
|
19
|
+
}
|
|
20
|
+
return to;
|
|
21
|
+
};
|
|
20
22
|
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
23
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
24
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
25
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
26
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
27
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
|
|
28
|
+
value: mod,
|
|
29
|
+
enumerable: true
|
|
30
|
+
}) : target, mod));
|
|
31
|
+
var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
|
|
32
|
+
value: true
|
|
33
|
+
}), mod);
|
|
32
34
|
var linear_gradient_exports = {};
|
|
33
35
|
__export(linear_gradient_exports, {
|
|
34
36
|
LinearGradient: () => LinearGradient
|
|
35
37
|
});
|
|
36
38
|
module.exports = __toCommonJS(linear_gradient_exports);
|
|
37
|
-
var import_core = require("@tamagui/core")
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
39
|
+
var import_core = require("@tamagui/core");
|
|
40
|
+
var React = __toESM(require("react"), 1);
|
|
41
|
+
var import_react_native = require("react-native-web");
|
|
42
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
41
43
|
function needsDimensionAwareAngle(start, end) {
|
|
42
|
-
if (!start && !end) return
|
|
43
|
-
const startX = start?.[0] ?? 0.5
|
|
44
|
-
|
|
44
|
+
if (!start && !end) return false;
|
|
45
|
+
const startX = start?.[0] ?? 0.5;
|
|
46
|
+
const endX = end?.[0] ?? 0.5;
|
|
45
47
|
return startX !== endX;
|
|
46
48
|
}
|
|
47
49
|
function LinearGradient({
|
|
@@ -51,20 +53,33 @@ function LinearGradient({
|
|
|
51
53
|
end,
|
|
52
54
|
...props
|
|
53
55
|
}) {
|
|
54
|
-
const normalizedStart = start ? Array.isArray(start) ? start : [start.x, start.y] : void 0
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
56
|
+
const normalizedStart = start ? Array.isArray(start) ? start : [start.x, start.y] : void 0;
|
|
57
|
+
const normalizedEnd = end ? Array.isArray(end) ? end : [end.x, end.y] : void 0;
|
|
58
|
+
const needsLayout = needsDimensionAwareAngle(normalizedStart, normalizedEnd);
|
|
59
|
+
const [{
|
|
60
|
+
height,
|
|
61
|
+
width
|
|
62
|
+
}, setLayout] = React.useState({
|
|
63
|
+
height: 1,
|
|
64
|
+
width: 1
|
|
65
|
+
});
|
|
66
|
+
const linearGradientBackgroundImage = React.useMemo(() => {
|
|
67
|
+
return getLinearGradientBackgroundImage(
|
|
65
68
|
// @ts-expect-error ok
|
|
66
|
-
colors, locations, normalizedStart, normalizedEnd, width, height)
|
|
67
|
-
|
|
69
|
+
colors, locations, normalizedStart, normalizedEnd, width, height);
|
|
70
|
+
}, [colors, locations, normalizedStart, normalizedEnd, width, height]);
|
|
71
|
+
if (!needsLayout) {
|
|
72
|
+
return /* @__PURE__ */(0, import_jsx_runtime.jsx)(import_react_native.View, {
|
|
73
|
+
...props,
|
|
74
|
+
onLayout: props.onLayout,
|
|
75
|
+
style: [props.style,
|
|
76
|
+
// @ts-ignore: [ts] Property 'backgroundImage' does not exist on type 'ViewStyle'.
|
|
77
|
+
{
|
|
78
|
+
backgroundImage: linearGradientBackgroundImage
|
|
79
|
+
}]
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
return /* @__PURE__ */(0, import_jsx_runtime.jsx)(import_react_native.View, {
|
|
68
83
|
...props,
|
|
69
84
|
style: [props.style,
|
|
70
85
|
// @ts-ignore: [ts] Property 'backgroundImage' does not exist on type 'ViewStyle'.
|
|
@@ -76,45 +91,55 @@ function LinearGradient({
|
|
|
76
91
|
width: width2,
|
|
77
92
|
height: height2
|
|
78
93
|
} = event.nativeEvent.layout;
|
|
79
|
-
setLayout(oldLayout =>
|
|
80
|
-
height
|
|
81
|
-
|
|
82
|
-
|
|
94
|
+
setLayout(oldLayout => {
|
|
95
|
+
if (width2 !== oldLayout.width || height2 !== oldLayout.height) {
|
|
96
|
+
return {
|
|
97
|
+
height: height2,
|
|
98
|
+
width: width2
|
|
99
|
+
};
|
|
100
|
+
}
|
|
101
|
+
return oldLayout;
|
|
102
|
+
});
|
|
103
|
+
if (props.onLayout) {
|
|
104
|
+
props.onLayout(event);
|
|
105
|
+
}
|
|
83
106
|
}
|
|
84
|
-
}) : /* @__PURE__ */(0, import_jsx_runtime.jsx)(import_react_native.View, {
|
|
85
|
-
...props,
|
|
86
|
-
onLayout: props.onLayout,
|
|
87
|
-
style: [props.style,
|
|
88
|
-
// @ts-ignore: [ts] Property 'backgroundImage' does not exist on type 'ViewStyle'.
|
|
89
|
-
{
|
|
90
|
-
backgroundImage: linearGradientBackgroundImage
|
|
91
|
-
}]
|
|
92
107
|
});
|
|
93
108
|
}
|
|
94
109
|
function getLinearGradientBackgroundImage(colors, locations, startPoint, endPoint, width = 1, height = 1) {
|
|
95
110
|
const gradientColors = calculateGradientColors(
|
|
96
111
|
// @ts-expect-error TODO fix numbers
|
|
97
112
|
colors, locations);
|
|
98
|
-
|
|
113
|
+
const angle = calculatePseudoAngle(width, height, startPoint, endPoint);
|
|
114
|
+
return `linear-gradient(${angle}deg, ${gradientColors.join(", ")})`;
|
|
99
115
|
}
|
|
100
116
|
function calculatePseudoAngle(width, height, startPoint, endPoint) {
|
|
101
117
|
const getControlPoints = () => {
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
118
|
+
let correctedStartPoint = [0, 0];
|
|
119
|
+
if (Array.isArray(startPoint)) {
|
|
120
|
+
correctedStartPoint = [startPoint[0] != null ? startPoint[0] : 0, startPoint[1] != null ? startPoint[1] : 0];
|
|
121
|
+
}
|
|
122
|
+
let correctedEndPoint = [0, 1];
|
|
123
|
+
if (Array.isArray(endPoint)) {
|
|
124
|
+
correctedEndPoint = [endPoint[0] != null ? endPoint[0] : 0, endPoint[1] != null ? endPoint[1] : 1];
|
|
125
|
+
}
|
|
126
|
+
return [correctedStartPoint, correctedEndPoint];
|
|
127
|
+
};
|
|
128
|
+
const [start, end] = getControlPoints();
|
|
129
|
+
start[0] *= width;
|
|
130
|
+
end[0] *= width;
|
|
131
|
+
start[1] *= height;
|
|
132
|
+
end[1] *= height;
|
|
133
|
+
const py = end[1] - start[1];
|
|
134
|
+
const px = end[0] - start[0];
|
|
111
135
|
return 90 + Math.atan2(py, px) * 180 / Math.PI;
|
|
112
136
|
}
|
|
113
137
|
function calculateGradientColors(colors, locations) {
|
|
114
138
|
return colors.map((color, index) => {
|
|
115
139
|
const output = (0, import_core.normalizeColor)(color);
|
|
116
140
|
if (locations && locations[index] !== void 0) {
|
|
117
|
-
const
|
|
141
|
+
const location = Math.max(0, Math.min(1, locations[index]));
|
|
142
|
+
const percentage = location * 100;
|
|
118
143
|
return `${output} ${percentage}%`;
|
|
119
144
|
}
|
|
120
145
|
return output;
|
|
@@ -5,28 +5,30 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
|
5
5
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
6
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
7
|
var __export = (target, all) => {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
8
|
+
for (var name in all) __defProp(target, name, {
|
|
9
|
+
get: all[name],
|
|
10
|
+
enumerable: true
|
|
11
|
+
});
|
|
12
|
+
};
|
|
13
|
+
var __copyProps = (to, from, except, desc) => {
|
|
14
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
15
|
+
for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
15
16
|
get: () => from[key],
|
|
16
17
|
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
17
18
|
});
|
|
18
|
-
|
|
19
|
-
|
|
19
|
+
}
|
|
20
|
+
return to;
|
|
21
|
+
};
|
|
20
22
|
var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
|
|
21
|
-
value:
|
|
23
|
+
value: true
|
|
22
24
|
}), mod);
|
|
23
25
|
var linear_gradient_native_exports = {};
|
|
24
26
|
__export(linear_gradient_native_exports, {
|
|
25
27
|
LinearGradient: () => LinearGradient
|
|
26
28
|
});
|
|
27
29
|
module.exports = __toCommonJS(linear_gradient_native_exports);
|
|
28
|
-
var import_jsx_runtime = require("react/jsx-runtime")
|
|
29
|
-
|
|
30
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
31
|
+
var import_native = require("@tamagui/native");
|
|
30
32
|
function LinearGradient(props) {
|
|
31
33
|
var state = (0, import_native.getLinearGradient)().state;
|
|
32
34
|
if (state.enabled && state.Component) {
|
|
@@ -35,6 +37,7 @@ function LinearGradient(props) {
|
|
|
35
37
|
...props
|
|
36
38
|
});
|
|
37
39
|
}
|
|
38
|
-
console.warn(
|
|
40
|
+
console.warn(`Warning: Must call import '@tamagui/native/setup-expo-linear-gradient' at root`);
|
|
41
|
+
return;
|
|
39
42
|
}
|
|
40
43
|
//# sourceMappingURL=linear-gradient.native.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["linear_gradient_native_exports","__export","LinearGradient","module","exports","__toCommonJS","import_jsx_runtime","require","import_native","props","state","getLinearGradient","enabled","Component","ExpoLinearGradient","jsx","console","warn"],"sources":["../../src/linear-gradient.native.tsx"],"sourcesContent":[null],"mappings":"
|
|
1
|
+
{"version":3,"names":["linear_gradient_native_exports","__export","LinearGradient","module","exports","__toCommonJS","import_jsx_runtime","require","import_native","props","state","getLinearGradient","enabled","Component","ExpoLinearGradient","jsx","console","warn"],"sources":["../../src/linear-gradient.native.tsx"],"sourcesContent":[null],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,8BAAA;AAAAC,QAAA,CAAAD,8BAAA;EAAAE,cAAA,EAAAA,CAAA,KAAAA;AAAA;AAAAC,MAAA,CAAAC,OAAA,GAAAC,YAAA,CAAAL,8BAAA;AAAA,IAAAM,kBAAA,GAA4BC,OAAA;AAC5B,IAAAC,aAAA,GAAkCD,OAAA;AAC3B,SAASL,eAAeO,KAAA,EAAO;EAClC,IAAIC,KAAA,OAAQF,aAAA,CAAAG,iBAAA,EAAkB,EAAED,KAAA;EAChC,IAAIA,KAAA,CAAME,OAAA,IAAWF,KAAA,CAAMG,SAAA,EAAW;IAClC,IAAIC,kBAAA,GAAqBJ,KAAA,CAAMG,SAAA;IAC/B,OAAqB,mBAAAP,kBAAA,CAAAS,GAAA,EAAKD,kBAAA,EAAoB;MAC1C,GAAGL;IACP,CAAC;EACL;EACAO,OAAA,CAAQC,IAAA,CAAK,gFAAgF;EAC7F;AACJ","ignoreList":[]}
|