@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.
Files changed (51) hide show
  1. package/dist/cjs/LinearGradient.cjs +53 -63
  2. package/dist/cjs/LinearGradient.native.cjs +76 -0
  3. package/dist/cjs/LinearGradient.native.js +56 -65
  4. package/dist/cjs/LinearGradient.native.js.map +1 -1
  5. package/dist/cjs/index.cjs +15 -18
  6. package/dist/cjs/index.native.cjs +27 -0
  7. package/dist/cjs/index.native.js +15 -17
  8. package/dist/cjs/index.native.js.map +1 -1
  9. package/dist/cjs/linear-gradient.cjs +97 -122
  10. package/dist/cjs/linear-gradient.native.cjs +37 -0
  11. package/dist/cjs/linear-gradient.native.js +22 -26
  12. package/dist/cjs/linear-gradient.native.js.map +1 -1
  13. package/dist/esm/LinearGradient.mjs +42 -47
  14. package/dist/esm/LinearGradient.mjs.map +1 -1
  15. package/dist/esm/LinearGradient.native.js +46 -51
  16. package/dist/esm/LinearGradient.native.js.map +1 -1
  17. package/dist/esm/index.js +2 -2
  18. package/dist/esm/index.mjs +2 -2
  19. package/dist/esm/index.native.js +2 -2
  20. package/dist/esm/linear-gradient.mjs +81 -96
  21. package/dist/esm/linear-gradient.mjs.map +1 -1
  22. package/dist/esm/linear-gradient.native.js +10 -10
  23. package/dist/esm/linear-gradient.native.js.map +1 -1
  24. package/dist/jsx/LinearGradient.mjs +42 -47
  25. package/dist/jsx/LinearGradient.mjs.map +1 -1
  26. package/dist/jsx/LinearGradient.native.cjs +76 -0
  27. package/dist/jsx/LinearGradient.native.js +56 -65
  28. package/dist/jsx/LinearGradient.native.js.map +1 -1
  29. package/dist/jsx/index.js +2 -2
  30. package/dist/jsx/index.mjs +2 -2
  31. package/dist/jsx/index.native.cjs +27 -0
  32. package/dist/jsx/index.native.js +15 -17
  33. package/dist/jsx/index.native.js.map +1 -1
  34. package/dist/jsx/linear-gradient.mjs +81 -96
  35. package/dist/jsx/linear-gradient.mjs.map +1 -1
  36. package/dist/jsx/linear-gradient.native.cjs +37 -0
  37. package/dist/jsx/linear-gradient.native.js +22 -26
  38. package/dist/jsx/linear-gradient.native.js.map +1 -1
  39. package/package.json +9 -8
  40. package/src/LinearGradient.tsx +16 -5
  41. package/types/LinearGradient.d.ts +7 -5
  42. package/types/LinearGradient.d.ts.map +1 -1
  43. package/types/linear-gradient.d.ts +2 -1
  44. package/types/linear-gradient.d.ts.map +1 -1
  45. package/types/linear-gradient.native.d.ts +1 -1
  46. package/types/linear-gradient.native.d.ts.map +1 -1
  47. package/dist/esm/index.js.map +0 -1
  48. package/dist/esm/index.mjs.map +0 -1
  49. package/dist/esm/index.native.js.map +0 -1
  50. package/dist/jsx/index.js.map +0 -1
  51. 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
- for (var name in all) __defProp(target, name, {
9
- get: all[name],
10
- enumerable: true
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
- 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, {
16
- get: () => from[key],
17
- enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
18
- });
19
- }
20
- return to;
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
- // 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
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
- if (!start && !end) return false;
45
- const startX = start?.[0] ?? 0.5;
46
- const endX = end?.[0] ?? 0.5;
47
- return startX !== endX;
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
- colors,
51
- locations,
52
- start,
53
- end,
54
- ...props
55
- }) {
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(
68
- // @ts-expect-error ok
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, {
83
- ...props,
84
- style: [props.style,
85
- // @ts-ignore: [ts] Property 'backgroundImage' does not exist on type 'ViewStyle'.
86
- {
87
- backgroundImage: linearGradientBackgroundImage
88
- }],
89
- onLayout: event => {
90
- const {
91
- width: width2,
92
- height: height2
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
- const gradientColors = calculateGradientColors(
111
- // @ts-expect-error TODO fix numbers
112
- colors, locations);
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
- const getControlPoints = () => {
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];
135
- return 90 + Math.atan2(py, px) * 180 / Math.PI;
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
- return colors.map((color, index) => {
139
- const output = (0, import_core.normalizeColor)(color);
140
- if (locations && locations[index] !== void 0) {
141
- const location = Math.max(0, Math.min(1, locations[index]));
142
- const percentage = location * 100;
143
- return `${output} ${percentage}%`;
144
- }
145
- return output;
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
- for (var name in all) __defProp(target, name, {
9
- get: all[name],
10
- enumerable: true
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
- 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, {
16
- get: () => from[key],
17
- enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
18
- });
19
- }
20
- return to;
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
- var state = (0, import_native.getLinearGradient)().state;
34
- if (state.enabled && state.Component) {
35
- var ExpoLinearGradient = state.Component;
36
- return /* @__PURE__ */(0, import_jsx_runtime.jsx)(ExpoLinearGradient, {
37
- ...props
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,"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":[]}
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 ExpoLinearGradient } from "./linear-gradient.mjs";
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
- name: "LinearGradient",
7
- overflow: "hidden",
8
- position: "relative"
7
+ displayName: "LinearGradient",
8
+ overflow: "hidden",
9
+ position: "relative"
9
10
  });
10
- const LinearGradient = LinearGradientFrame.styleable((propsIn, ref) => {
11
- const props = useProps(propsIn);
12
- const {
13
- start,
14
- end,
15
- colors: colorsProp,
16
- locations,
17
- children,
18
- ...stackProps
19
- } = props;
20
- const theme = useTheme();
21
- let colors = props.colors?.map(c => {
22
- return theme[c]?.get("web") ?? c;
23
- }) || [];
24
- if (process.env.NODE_ENV !== "production") {
25
- if (colors.some(c => {
26
- const normalized = normalizeColor(c);
27
- if (!normalized || normalized.startsWith("$")) {
28
- return true;
29
- }
30
- })) {
31
- console.error(`LinearGradient: "colors" prop contains invalid color tokens: ${colors} fallback to default colors: ["#000", "#fff"]`);
32
- colors = ["#000", "#fff"];
33
- }
34
- }
35
- return /* @__PURE__ */jsxs(LinearGradientFrame, {
36
- ref,
37
- ...stackProps,
38
- children: [/* @__PURE__ */jsx(ExpoLinearGradient, {
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
- position: "absolute",
49
- top: 0,
50
- left: 0,
51
- right: 0,
52
- bottom: 0,
53
- zIndex: 0
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":["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;EACzCM,IAAA,EAAM;EACNC,QAAA,EAAU;EACVC,QAAA,EAAU;AACZ,CAAC;AAEM,MAAMP,cAAA,GAAiBI,mBAAA,CAAoBI,SAAA,CAChD,CAACC,OAAA,EAASC,GAAA,KAAQ;EAChB,MAAMC,KAAA,GAAQd,QAAA,CAASY,OAAO;EAE9B,MAAM;IAAEG,KAAA;IAAOC,GAAA;IAAKC,MAAA,EAAQC,UAAA;IAAYC,SAAA;IAAWC,QAAA;IAAU,GAAGC;EAAW,IAAIP,KAAA;EAC/E,MAAMQ,KAAA,GAAQrB,QAAA,CAAS;EAEvB,IAAIgB,MAAA,GACFH,KAAA,CAAMG,MAAA,EAAQM,GAAA,CAAKC,CAAA,IAAM;IACvB,OAAQF,KAAA,CAAME,CAAC,GAAGC,GAAA,CAAI,KAAK,KAAgBD,CAAA;EAC7C,CAAC,KAAK,EAAC;EAET,IAAIE,OAAA,CAAQC,GAAA,CAAIC,QAAA,KAAa,cAAc;IACzC,IACEX,MAAA,CAAOY,IAAA,CAAML,CAAA,IAAM;MACjB,MAAMM,UAAA,GAAahC,cAAA,CAAe0B,CAAC;MACnC,IAAI,CAACM,UAAA,IAAcA,UAAA,CAAWC,UAAA,CAAW,GAAG,GAAG;QAC7C,OAAO;MACT;IACF,CAAC,GACD;MACAC,OAAA,CAAQC,KAAA,CACN,gEAAgEhB,MAAM,+CACxE;MACAA,MAAA,GAAS,CAAC,QAAQ,MAAM;IAC1B;EACF;EAEA,OACE,eAAAX,IAAA,CAACC,mBAAA;IAAoBM,GAAA;IAAkB,GAAGQ,UAAA;IACxCD,QAAA,kBAAAf,GAAA,CAACD,kBAAA;MACCW,KAAA;MACAC,GAAA;MACAC,MAAA;MACAE,SAAA;MACAe,KAAA,EAAOC;IAAA,CACT,GACCf,QAAA;EAAA,CACH;AAEJ,CACF;AAIA,MAAMe,aAAA,GAA2B;EAC/BzB,QAAA,EAAU;EACV0B,GAAA,EAAK;EACLC,IAAA,EAAM;EACNC,KAAA,EAAO;EACPC,MAAA,EAAQ;EACRC,MAAA,EAAQ;AACV","ignoreList":[]}
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 as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
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 ExpoLinearGradient } from "./linear-gradient.native.js";
4
+ import { LinearGradient as LinearGradient$1 } from "./linear-gradient.native.js";
5
+
5
6
  var LinearGradientFrame = styled(YStack, {
6
- name: "LinearGradient",
7
- overflow: "hidden",
8
- position: "relative"
7
+ displayName: "LinearGradient",
8
+ overflow: "hidden",
9
+ position: "relative"
9
10
  });
10
- var LinearGradient = LinearGradientFrame.styleable(function (propsIn, ref) {
11
- var _props_colors;
12
- var props = useProps(propsIn);
13
- var {
14
- start,
15
- end,
16
- colors: colorsProp,
17
- locations,
18
- children,
19
- ...stackProps
20
- } = props;
21
- var theme = useTheme();
22
- var colors = ((_props_colors = props.colors) === null || _props_colors === void 0 ? void 0 : _props_colors.map(function (c) {
23
- var _theme_c;
24
- var _theme_c_get;
25
- 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;
26
- })) || [];
27
- if (process.env.NODE_ENV !== "production") {
28
- if (colors.some(function (c) {
29
- var normalized = normalizeColor(c);
30
- if (!normalized || normalized.startsWith("$")) {
31
- return true;
32
- }
33
- })) {
34
- console.error(`LinearGradient: "colors" prop contains invalid color tokens: ${colors} fallback to default colors: ["#000", "#fff"]`);
35
- colors = ["#000", "#fff"];
36
- }
37
- }
38
- return /* @__PURE__ */_jsxs(LinearGradientFrame, {
39
- ref,
40
- ...stackProps,
41
- children: [/* @__PURE__ */_jsx(ExpoLinearGradient, {
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
- position: "absolute",
52
- top: 0,
53
- left: 0,
54
- right: 0,
55
- bottom: 0,
56
- zIndex: 0
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":["jsx","_jsx","jsxs","_jsxs","normalizeColor","styled","useProps","useTheme","YStack","LinearGradient","ExpoLinearGradient","LinearGradientFrame","name","overflow","position","styleable","propsIn","ref","_props_colors","props","start","end","colors","colorsProp","locations","children","stackProps","theme","map","c","_theme_c","_theme_c_get","get","process","env","NODE_ENV","some","normalized","startsWith","console","error","style","gradientStyle","top","left","right"],"sources":["../../src/LinearGradient.tsx"],"sourcesContent":[null],"mappings":"AACA,SAASA,GAAA,IAAAC,IAAA,EAAAC,IAAgB,IAAAC,KAAQ,QAAU,mBAAgB;AAC3D,SAASC,cAAc,EAAAC,MAAA,EAAAC,QAAA,EAAAC,QAAA;AAIvB,SAASC,MAAA,yBAAkB;AA6CrB,SACEC,cADF,IAAAC,kBAAA;AAnCN,IAAAC,mBAAM,GAAAN,MAAsB,CAAAG,MAAO;EACjCI,IAAA,EAAM;EACNC,QAAA,EAAU;EACVC,QAAA,EAAU;AACZ,CAAC;AAEM,IAAAL,cAAM,GAAAE,mBAAiB,CAAAI,SAAoB,WAAAC,OAAA,EAAAC,GAAA;EAChD,IAACC,aAAS;EACR,IAAAC,KAAM,GAAAb,QAAQ,CAAAU,OAAS;EAEvB;IAAAI,KAAQ;IAAAC,GAAA;IAAOC,MAAK,EAAAC,UAAQ;IAAAC,SAAY;IAAAC,QAAW;IAAA,GAAAC;EAAa,IAAWP,KAAI;EAC/E,IAAAQ,KAAM,GAAApB,QAAQ;EAEd,IAAAe,MAAI,KACFJ,aAAM,GAAQC,KAAK,CAAAG,MAAM,cAAAJ,aAAA,uBAAAA,aAAA,CAAAU,GAAA,WAAAC,CAAA;IACvB,IAAAC,QAAQ;IACV,IAACC,YAAM;IAET,OAAI,CAAAA,YAAY,IAAAD,QAAa,GAAAH,KAAA,CAAAE,CAAA,CAAc,cAAAC,QAAA,uBAAAA,QAAA,CAAAE,GAAA,qBAAAD,YAAA,cAAAA,YAAA,GAAAF,CAAA;EACzC,SACE;EACE,IAAAI,OAAA,CAAMC,GAAA,CAAAC,QAAA,KAAa,YAAgB;IACnC,IAAAb,MAAK,CAAAc,IAAA,WAAcP,CAAA;MACjB,IAAAQ,UAAO,GAAAjC,cAAA,CAAAyB,CAAA;MAAA,IACT,CAAAQ,UAAA,IAAAA,UAAA,CAAAC,UAAA;QACD,OACD;MACA;IAAQ;MACgEC,OACxE,CAAAC,KAAA,iEAAAlB,MAAA;MACAA,MAAA,IACF,QACF,OAEA;IAEI;EAAA;EAAC,sBAAAnB,KAAA,CAAAQ,mBAAA;IAAAM,GAAA;IACC,GAAAS,UACA;IAAAD,QACA,kBACAxB,IAAA,CAAAS,kBAAA;MAAAU,KACA;MAAOC,GAAA;MACTC,MAAA;MACCE,SAAA;MACHiB,KAAA,EAAAC;IAEJ,IACFjB,QAAA;EAKE;AAAU,EACV;AAAK,IACLiB,aAAM;EACN5B,QAAO;EACP6B,GAAA;EACAC,IAAA;EACFC,KAAA","ignoreList":[]}
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
- export { LinearGradient };
3
- //# sourceMappingURL=index.js.map
2
+
3
+ export { LinearGradient };
@@ -1,3 +1,3 @@
1
1
  import { LinearGradient } from "./LinearGradient.mjs";
2
- export { LinearGradient };
3
- //# sourceMappingURL=index.mjs.map
2
+
3
+ export { LinearGradient };