@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,3 +1,4 @@
|
|
|
1
|
+
|
|
1
2
|
var __create = Object.create;
|
|
2
3
|
var __defProp = Object.defineProperty;
|
|
3
4
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
@@ -5,143 +6,117 @@ var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
|
5
6
|
var __getProtoOf = Object.getPrototypeOf;
|
|
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 __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
23
|
-
|
|
24
|
-
|
|
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
|
|
23
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
|
|
24
|
+
value: mod,
|
|
25
|
+
enumerable: true
|
|
30
26
|
}) : target, mod));
|
|
31
|
-
var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
|
|
32
|
-
value: true
|
|
33
|
-
}), mod);
|
|
27
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
34
28
|
var linear_gradient_exports = {};
|
|
35
|
-
__export(linear_gradient_exports, {
|
|
36
|
-
LinearGradient: () => LinearGradient
|
|
37
|
-
});
|
|
29
|
+
__export(linear_gradient_exports, { LinearGradient: () => LinearGradient });
|
|
38
30
|
module.exports = __toCommonJS(linear_gradient_exports);
|
|
39
31
|
var import_core = require("@tamagui/core");
|
|
40
32
|
var React = __toESM(require("react"), 1);
|
|
41
33
|
var import_react_native = require("react-native-web");
|
|
42
34
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
43
35
|
function needsDimensionAwareAngle(start, end) {
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
36
|
+
if (!start && !end) return false;
|
|
37
|
+
const startX = start?.[0] ?? .5;
|
|
38
|
+
const endX = end?.[0] ?? .5;
|
|
39
|
+
return startX !== endX;
|
|
48
40
|
}
|
|
49
|
-
function LinearGradient({
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
} = event.nativeEvent.layout;
|
|
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
|
-
}
|
|
106
|
-
}
|
|
107
|
-
});
|
|
41
|
+
function LinearGradient({ colors, locations, start, end, ...props }) {
|
|
42
|
+
const normalizedStart = start ? Array.isArray(start) ? start : [start.x, start.y] : void 0;
|
|
43
|
+
const normalizedEnd = end ? Array.isArray(end) ? end : [end.x, end.y] : void 0;
|
|
44
|
+
const needsLayout = needsDimensionAwareAngle(normalizedStart, normalizedEnd);
|
|
45
|
+
const [{ height, width }, setLayout] = React.useState({
|
|
46
|
+
height: 1,
|
|
47
|
+
width: 1
|
|
48
|
+
});
|
|
49
|
+
const linearGradientBackgroundImage = React.useMemo(() => {
|
|
50
|
+
return getLinearGradientBackgroundImage(colors, locations, normalizedStart, normalizedEnd, width, height);
|
|
51
|
+
}, [
|
|
52
|
+
colors,
|
|
53
|
+
locations,
|
|
54
|
+
normalizedStart,
|
|
55
|
+
normalizedEnd,
|
|
56
|
+
width,
|
|
57
|
+
height
|
|
58
|
+
]);
|
|
59
|
+
if (!needsLayout) {
|
|
60
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react_native.View, {
|
|
61
|
+
...props,
|
|
62
|
+
onLayout: props.onLayout,
|
|
63
|
+
style: [props.style, { backgroundImage: linearGradientBackgroundImage }]
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react_native.View, {
|
|
67
|
+
...props,
|
|
68
|
+
style: [props.style, { backgroundImage: linearGradientBackgroundImage }],
|
|
69
|
+
onLayout: (event) => {
|
|
70
|
+
const { width: width2, height: height2 } = event.nativeEvent.layout;
|
|
71
|
+
setLayout((oldLayout) => {
|
|
72
|
+
if (width2 !== oldLayout.width || height2 !== oldLayout.height) {
|
|
73
|
+
return {
|
|
74
|
+
height: height2,
|
|
75
|
+
width: width2
|
|
76
|
+
};
|
|
77
|
+
}
|
|
78
|
+
return oldLayout;
|
|
79
|
+
});
|
|
80
|
+
if (props.onLayout) {
|
|
81
|
+
props.onLayout(event);
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
});
|
|
108
85
|
}
|
|
109
86
|
function getLinearGradientBackgroundImage(colors, locations, startPoint, endPoint, width = 1, height = 1) {
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
const angle = calculatePseudoAngle(width, height, startPoint, endPoint);
|
|
114
|
-
return `linear-gradient(${angle}deg, ${gradientColors.join(", ")})`;
|
|
87
|
+
const gradientColors = calculateGradientColors(colors, locations);
|
|
88
|
+
const angle = calculatePseudoAngle(width, height, startPoint, endPoint);
|
|
89
|
+
return `linear-gradient(${angle}deg, ${gradientColors.join(", ")})`;
|
|
115
90
|
}
|
|
116
91
|
function calculatePseudoAngle(width, height, startPoint, endPoint) {
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
92
|
+
const getControlPoints = () => {
|
|
93
|
+
let correctedStartPoint = [0, 0];
|
|
94
|
+
if (Array.isArray(startPoint)) {
|
|
95
|
+
correctedStartPoint = [startPoint[0] != null ? startPoint[0] : 0, startPoint[1] != null ? startPoint[1] : 0];
|
|
96
|
+
}
|
|
97
|
+
let correctedEndPoint = [0, 1];
|
|
98
|
+
if (Array.isArray(endPoint)) {
|
|
99
|
+
correctedEndPoint = [endPoint[0] != null ? endPoint[0] : 0, endPoint[1] != null ? endPoint[1] : 1];
|
|
100
|
+
}
|
|
101
|
+
return [correctedStartPoint, correctedEndPoint];
|
|
102
|
+
};
|
|
103
|
+
const [start, end] = getControlPoints();
|
|
104
|
+
start[0] *= width;
|
|
105
|
+
end[0] *= width;
|
|
106
|
+
start[1] *= height;
|
|
107
|
+
end[1] *= height;
|
|
108
|
+
const py = end[1] - start[1];
|
|
109
|
+
const px = end[0] - start[0];
|
|
110
|
+
return 90 + Math.atan2(py, px) * 180 / Math.PI;
|
|
136
111
|
}
|
|
137
112
|
function calculateGradientColors(colors, locations) {
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
}
|
|
113
|
+
return colors.map((color, index) => {
|
|
114
|
+
const output = (0, import_core.normalizeColor)(color);
|
|
115
|
+
if (locations && locations[index] !== void 0) {
|
|
116
|
+
const location = Math.max(0, Math.min(1, locations[index]));
|
|
117
|
+
const percentage = location * 100;
|
|
118
|
+
return `${output} ${percentage}%`;
|
|
119
|
+
}
|
|
120
|
+
return output;
|
|
121
|
+
});
|
|
122
|
+
}
|
|
@@ -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":["cjs/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"}
|
|
@@ -1,56 +1,51 @@
|
|
|
1
|
-
import { normalizeColor, styled, useProps, useTheme } from "@tamagui/core";
|
|
1
|
+
import { createStyledHOC, normalizeColor, styled, useProps, useTheme } from "@tamagui/core";
|
|
2
2
|
import { YStack } from "@tamagui/stacks";
|
|
3
|
-
import { LinearGradient as
|
|
3
|
+
import { LinearGradient as LinearGradient$1 } from "./linear-gradient.mjs";
|
|
4
4
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
5
|
+
|
|
5
6
|
const LinearGradientFrame = styled(YStack, {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
7
|
+
displayName: "LinearGradient",
|
|
8
|
+
overflow: "hidden",
|
|
9
|
+
position: "relative"
|
|
9
10
|
});
|
|
10
|
-
const LinearGradient = LinearGradientFrame
|
|
11
|
-
|
|
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
|
-
start,
|
|
40
|
-
end,
|
|
41
|
-
colors,
|
|
42
|
-
locations,
|
|
43
|
-
style: gradientStyle
|
|
44
|
-
}), children]
|
|
45
|
-
});
|
|
11
|
+
const LinearGradient = createStyledHOC(LinearGradientFrame, (propsIn, ref) => {
|
|
12
|
+
const props = useProps(propsIn);
|
|
13
|
+
const { start, end, colors: colorsProp, locations, children, ...stackProps } = props;
|
|
14
|
+
const theme = useTheme();
|
|
15
|
+
let colors = props.colors?.map((c) => {
|
|
16
|
+
return theme[c]?.get("web") ?? c;
|
|
17
|
+
}) || [];
|
|
18
|
+
if (process.env.NODE_ENV !== "production") {
|
|
19
|
+
if (colors.some((c) => {
|
|
20
|
+
const normalized = normalizeColor(c);
|
|
21
|
+
if (!normalized) {
|
|
22
|
+
return true;
|
|
23
|
+
}
|
|
24
|
+
})) {
|
|
25
|
+
console.error(`LinearGradient: "colors" prop contains invalid color tokens: ${colors} fallback to default colors: ["#000", "#fff"]`);
|
|
26
|
+
colors = ["#000", "#fff"];
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
return /* @__PURE__ */ jsxs(LinearGradientFrame, {
|
|
30
|
+
ref,
|
|
31
|
+
...stackProps,
|
|
32
|
+
children: [/* @__PURE__ */ jsx(LinearGradient$1, {
|
|
33
|
+
start,
|
|
34
|
+
end,
|
|
35
|
+
colors,
|
|
36
|
+
locations,
|
|
37
|
+
style: gradientStyle
|
|
38
|
+
}), children]
|
|
39
|
+
});
|
|
46
40
|
});
|
|
47
41
|
const gradientStyle = {
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
42
|
+
position: "absolute",
|
|
43
|
+
top: 0,
|
|
44
|
+
left: 0,
|
|
45
|
+
right: 0,
|
|
46
|
+
bottom: 0,
|
|
47
|
+
zIndex: 0
|
|
54
48
|
};
|
|
49
|
+
|
|
55
50
|
export { LinearGradient };
|
|
56
51
|
//# sourceMappingURL=LinearGradient.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["
|
|
1
|
+
{"version":3,"file":"LinearGradient.js","names":["ExpoLinearGradient"],"sources":["esm/LinearGradient.js"],"sourcesContent":["import {\n createStyledHOC,\n normalizeColor,\n styled,\n useProps,\n useTheme\n} from \"@tamagui/core\";\nimport { YStack } from \"@tamagui/stacks\";\nimport { LinearGradient as ExpoLinearGradient } from \"./linear-gradient\";\nimport { jsx, jsxs } from \"react/jsx-runtime\";\nconst LinearGradientFrame = styled(YStack, {\n displayName: \"LinearGradient\",\n overflow: \"hidden\",\n position: \"relative\"\n});\nconst LinearGradient = createStyledHOC(\n LinearGradientFrame,\n (propsIn, ref) => {\n const props = useProps(propsIn);\n const { start, end, colors: colorsProp, locations, children, ...stackProps } = props;\n const theme = useTheme();\n let colors = props.colors?.map((c) => {\n return theme[c]?.get(\"web\") ?? c;\n }) || [];\n if (process.env.NODE_ENV !== \"production\") {\n if (colors.some((c) => {\n const normalized = normalizeColor(c);\n if (!normalized) {\n return true;\n }\n })) {\n console.error(\n `LinearGradient: \"colors\" prop contains invalid color tokens: ${colors} fallback to default colors: [\"#000\", \"#fff\"]`\n );\n colors = [\"#000\", \"#fff\"];\n }\n }\n return /* @__PURE__ */ jsxs(LinearGradientFrame, { ref, ...stackProps, children: [\n /* @__PURE__ */ jsx(\n ExpoLinearGradient,\n {\n start,\n end,\n colors,\n locations,\n style: gradientStyle\n }\n ),\n children\n ] });\n }\n);\nconst gradientStyle = {\n position: \"absolute\",\n top: 0,\n left: 0,\n right: 0,\n bottom: 0,\n zIndex: 0\n};\nexport {\n LinearGradient\n};\n//# sourceMappingURL=LinearGradient.js.map\n"],"mappings":";;;;;;AAUA,MAAM,sBAAsB,OAAO,QAAQ;CACzC,aAAa;CACb,UAAU;CACV,UAAU;AACZ,CAAC;AACD,MAAM,iBAAiB,gBACrB,sBACC,SAAS,QAAQ;CAChB,MAAM,QAAQ,SAAS,OAAO;CAC9B,MAAM,EAAE,OAAO,KAAK,QAAQ,YAAY,WAAW,UAAU,GAAG,eAAe;CAC/E,MAAM,QAAQ,SAAS;CACvB,IAAI,SAAS,MAAM,QAAQ,KAAK,MAAM;EACpC,OAAO,MAAM,IAAI,IAAI,KAAK,KAAK;CACjC,CAAC,KAAK,CAAC;CACP,IAAI,QAAQ,IAAI,aAAa,cAAc;EACzC,IAAI,OAAO,MAAM,MAAM;GACrB,MAAM,aAAa,eAAe,CAAC;GACnC,IAAI,CAAC,YAAY;IACf,OAAO;GACT;EACF,CAAC,GAAG;GACF,QAAQ,MACN,gEAAgE,OAAO,8CACzE;GACA,SAAS,CAAC,QAAQ,MAAM;EAC1B;CACF;CACA,OAAuB,qBAAK,qBAAqB;EAAE;EAAK,GAAG;EAAY,UAAU,CAC/D,oBACdA,kBACA;GACE;GACA;GACA;GACA;GACA,OAAO;EACT,CACF,GACA,QACF;CAAE,CAAC;AACL,CACF;AACA,MAAM,gBAAgB;CACpB,UAAU;CACV,KAAK;CACL,MAAM;CACN,OAAO;CACP,QAAQ;CACR,QAAQ;AACV"}
|
|
@@ -1,59 +1,54 @@
|
|
|
1
|
-
import { jsx
|
|
2
|
-
import { normalizeColor, styled, useProps, useTheme } from "@tamagui/core";
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { createStyledHOC, normalizeColor, styled, useProps, useTheme } from "@tamagui/core";
|
|
3
3
|
import { YStack } from "@tamagui/stacks";
|
|
4
|
-
import { LinearGradient as
|
|
4
|
+
import { LinearGradient as LinearGradient$1 } from "./linear-gradient.native.js";
|
|
5
|
+
|
|
5
6
|
var LinearGradientFrame = styled(YStack, {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
7
|
+
displayName: "LinearGradient",
|
|
8
|
+
overflow: "hidden",
|
|
9
|
+
position: "relative"
|
|
9
10
|
});
|
|
10
|
-
var LinearGradient = LinearGradientFrame
|
|
11
|
-
|
|
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
|
-
start,
|
|
43
|
-
end,
|
|
44
|
-
colors,
|
|
45
|
-
locations,
|
|
46
|
-
style: gradientStyle
|
|
47
|
-
}), children]
|
|
48
|
-
});
|
|
11
|
+
var LinearGradient = createStyledHOC(LinearGradientFrame, function(propsIn, ref) {
|
|
12
|
+
var _props_colors;
|
|
13
|
+
var props = useProps(propsIn);
|
|
14
|
+
var { start, end, colors: colorsProp, locations, children, ...stackProps } = props;
|
|
15
|
+
var theme = useTheme();
|
|
16
|
+
var colors = ((_props_colors = props.colors) === null || _props_colors === void 0 ? void 0 : _props_colors.map(function(c) {
|
|
17
|
+
var _theme_c;
|
|
18
|
+
var _theme_c_get;
|
|
19
|
+
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;
|
|
20
|
+
})) || [];
|
|
21
|
+
if (process.env.NODE_ENV !== "production") {
|
|
22
|
+
if (colors.some(function(c) {
|
|
23
|
+
var normalized = normalizeColor(c);
|
|
24
|
+
if (!normalized) {
|
|
25
|
+
return true;
|
|
26
|
+
}
|
|
27
|
+
})) {
|
|
28
|
+
console.error(`LinearGradient: "colors" prop contains invalid color tokens: ${colors} fallback to default colors: ["#000", "#fff"]`);
|
|
29
|
+
colors = ["#000", "#fff"];
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
return /* @__PURE__ */ jsxs(LinearGradientFrame, {
|
|
33
|
+
ref,
|
|
34
|
+
...stackProps,
|
|
35
|
+
children: [/* @__PURE__ */ jsx(LinearGradient$1, {
|
|
36
|
+
start,
|
|
37
|
+
end,
|
|
38
|
+
colors,
|
|
39
|
+
locations,
|
|
40
|
+
style: gradientStyle
|
|
41
|
+
}), children]
|
|
42
|
+
});
|
|
49
43
|
});
|
|
50
44
|
var gradientStyle = {
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
45
|
+
position: "absolute",
|
|
46
|
+
top: 0,
|
|
47
|
+
left: 0,
|
|
48
|
+
right: 0,
|
|
49
|
+
bottom: 0,
|
|
50
|
+
zIndex: 0
|
|
57
51
|
};
|
|
52
|
+
|
|
58
53
|
export { LinearGradient };
|
|
59
54
|
//# sourceMappingURL=LinearGradient.native.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["
|
|
1
|
+
{"version":3,"file":"LinearGradient.native.js","names":["ExpoLinearGradient"],"sources":["esm/LinearGradient.native.js"],"sourcesContent":["import { jsx as _jsx, jsxs as _jsxs } from \"react/jsx-runtime\";\nimport { createStyledHOC, normalizeColor, styled, useProps, useTheme } from \"@tamagui/core\";\nimport { YStack } from \"@tamagui/stacks\";\nimport { LinearGradient as ExpoLinearGradient } from \"./linear-gradient\";\nvar LinearGradientFrame = styled(YStack, {\n displayName: \"LinearGradient\",\n overflow: \"hidden\",\n position: \"relative\"\n});\nvar LinearGradient = createStyledHOC(LinearGradientFrame, function(propsIn, ref) {\n var _props_colors;\n var props = useProps(propsIn);\n var { start, end, colors: colorsProp, locations, children, ...stackProps } = props;\n var theme = 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 = 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__ */ _jsxs(LinearGradientFrame, {\n ref,\n ...stackProps,\n children: [\n /* @__PURE__ */ _jsx(ExpoLinearGradient, {\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};\nexport {\n LinearGradient\n};\n//# sourceMappingURL=LinearGradient.js.map\n"],"mappings":";;;;;;AAIA,IAAI,sBAAsB,OAAO,QAAQ;CACvC,aAAa;CACb,UAAU;CACV,UAAU;AACZ,CAAC;AACD,IAAI,iBAAiB,gBAAgB,qBAAqB,SAAS,SAAS,KAAK;CAC/E,IAAI;CACJ,IAAI,QAAQ,SAAS,OAAO;CAC5B,IAAI,EAAE,OAAO,KAAK,QAAQ,YAAY,WAAW,UAAU,GAAG,eAAe;CAC7E,IAAI,QAAQ,SAAS;CACrB,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,aAAa,eAAe,CAAC;GACjC,IAAI,CAAC,YAAY;IACf,OAAO;GACT;EACF,CAAC,GAAG;GACF,QAAQ,MAAM,gEAAgE,OAAO,8CAA8C;GACnI,SAAS,CACP,QACA,MACF;EACF;CACF;CACA,OAAuB,qBAAM,qBAAqB;EAChD;EACA,GAAG;EACH,UAAU,CACQ,oBAAKA,kBAAoB;GACvC;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/esm/index.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { LinearGradient } from "./LinearGradient.mjs";
|
|
2
|
-
|
|
3
|
-
|
|
2
|
+
|
|
3
|
+
export { LinearGradient };
|
package/dist/esm/index.mjs
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { LinearGradient } from "./LinearGradient.mjs";
|
|
2
|
-
|
|
3
|
-
|
|
2
|
+
|
|
3
|
+
export { LinearGradient };
|