@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,3 @@
1
1
  import { LinearGradient } from "./LinearGradient.native.js";
2
- export { LinearGradient };
3
- //# sourceMappingURL=index.native.js.map
2
+
3
+ export { LinearGradient };
@@ -2,110 +2,95 @@ import { normalizeColor } from "@tamagui/core";
2
2
  import * as React from "react";
3
3
  import { View } from "react-native-web";
4
4
  import { jsx } from "react/jsx-runtime";
5
+
5
6
  function needsDimensionAwareAngle(start, end) {
6
- if (!start && !end) return false;
7
- const startX = start?.[0] ?? 0.5;
8
- const endX = end?.[0] ?? 0.5;
9
- return startX !== endX;
7
+ if (!start && !end) return false;
8
+ const startX = start?.[0] ?? .5;
9
+ const endX = end?.[0] ?? .5;
10
+ return startX !== endX;
10
11
  }
11
- function LinearGradient({
12
- colors,
13
- locations,
14
- start,
15
- end,
16
- ...props
17
- }) {
18
- const normalizedStart = start ? Array.isArray(start) ? start : [start.x, start.y] : void 0;
19
- const normalizedEnd = end ? Array.isArray(end) ? end : [end.x, end.y] : void 0;
20
- const needsLayout = needsDimensionAwareAngle(normalizedStart, normalizedEnd);
21
- const [{
22
- height,
23
- width
24
- }, setLayout] = React.useState({
25
- height: 1,
26
- width: 1
27
- });
28
- const linearGradientBackgroundImage = React.useMemo(() => {
29
- return getLinearGradientBackgroundImage(
30
- // @ts-expect-error ok
31
- colors, locations, normalizedStart, normalizedEnd, width, height);
32
- }, [colors, locations, normalizedStart, normalizedEnd, width, height]);
33
- if (!needsLayout) {
34
- return /* @__PURE__ */jsx(View, {
35
- ...props,
36
- onLayout: props.onLayout,
37
- style: [props.style,
38
- // @ts-ignore: [ts] Property 'backgroundImage' does not exist on type 'ViewStyle'.
39
- {
40
- backgroundImage: linearGradientBackgroundImage
41
- }]
42
- });
43
- }
44
- return /* @__PURE__ */jsx(View, {
45
- ...props,
46
- style: [props.style,
47
- // @ts-ignore: [ts] Property 'backgroundImage' does not exist on type 'ViewStyle'.
48
- {
49
- backgroundImage: linearGradientBackgroundImage
50
- }],
51
- onLayout: event => {
52
- const {
53
- width: width2,
54
- height: height2
55
- } = event.nativeEvent.layout;
56
- setLayout(oldLayout => {
57
- if (width2 !== oldLayout.width || height2 !== oldLayout.height) {
58
- return {
59
- height: height2,
60
- width: width2
61
- };
62
- }
63
- return oldLayout;
64
- });
65
- if (props.onLayout) {
66
- props.onLayout(event);
67
- }
68
- }
69
- });
12
+ function LinearGradient({ colors, locations, start, end, ...props }) {
13
+ const normalizedStart = start ? Array.isArray(start) ? start : [start.x, start.y] : void 0;
14
+ const normalizedEnd = end ? Array.isArray(end) ? end : [end.x, end.y] : void 0;
15
+ const needsLayout = needsDimensionAwareAngle(normalizedStart, normalizedEnd);
16
+ const [{ height, width }, setLayout] = React.useState({
17
+ height: 1,
18
+ width: 1
19
+ });
20
+ const linearGradientBackgroundImage = React.useMemo(() => {
21
+ return getLinearGradientBackgroundImage(colors, locations, normalizedStart, normalizedEnd, width, height);
22
+ }, [
23
+ colors,
24
+ locations,
25
+ normalizedStart,
26
+ normalizedEnd,
27
+ width,
28
+ height
29
+ ]);
30
+ if (!needsLayout) {
31
+ return /* @__PURE__ */ jsx(View, {
32
+ ...props,
33
+ onLayout: props.onLayout,
34
+ style: [props.style, { backgroundImage: linearGradientBackgroundImage }]
35
+ });
36
+ }
37
+ return /* @__PURE__ */ jsx(View, {
38
+ ...props,
39
+ style: [props.style, { backgroundImage: linearGradientBackgroundImage }],
40
+ onLayout: (event) => {
41
+ const { width: width2, height: height2 } = event.nativeEvent.layout;
42
+ setLayout((oldLayout) => {
43
+ if (width2 !== oldLayout.width || height2 !== oldLayout.height) {
44
+ return {
45
+ height: height2,
46
+ width: width2
47
+ };
48
+ }
49
+ return oldLayout;
50
+ });
51
+ if (props.onLayout) {
52
+ props.onLayout(event);
53
+ }
54
+ }
55
+ });
70
56
  }
71
57
  function getLinearGradientBackgroundImage(colors, locations, startPoint, endPoint, width = 1, height = 1) {
72
- const gradientColors = calculateGradientColors(
73
- // @ts-expect-error TODO fix numbers
74
- colors, locations);
75
- const angle = calculatePseudoAngle(width, height, startPoint, endPoint);
76
- return `linear-gradient(${angle}deg, ${gradientColors.join(", ")})`;
58
+ const gradientColors = calculateGradientColors(colors, locations);
59
+ const angle = calculatePseudoAngle(width, height, startPoint, endPoint);
60
+ return `linear-gradient(${angle}deg, ${gradientColors.join(", ")})`;
77
61
  }
78
62
  function calculatePseudoAngle(width, height, startPoint, endPoint) {
79
- const getControlPoints = () => {
80
- let correctedStartPoint = [0, 0];
81
- if (Array.isArray(startPoint)) {
82
- correctedStartPoint = [startPoint[0] != null ? startPoint[0] : 0, startPoint[1] != null ? startPoint[1] : 0];
83
- }
84
- let correctedEndPoint = [0, 1];
85
- if (Array.isArray(endPoint)) {
86
- correctedEndPoint = [endPoint[0] != null ? endPoint[0] : 0, endPoint[1] != null ? endPoint[1] : 1];
87
- }
88
- return [correctedStartPoint, correctedEndPoint];
89
- };
90
- const [start, end] = getControlPoints();
91
- start[0] *= width;
92
- end[0] *= width;
93
- start[1] *= height;
94
- end[1] *= height;
95
- const py = end[1] - start[1];
96
- const px = end[0] - start[0];
97
- return 90 + Math.atan2(py, px) * 180 / Math.PI;
63
+ const getControlPoints = () => {
64
+ let correctedStartPoint = [0, 0];
65
+ if (Array.isArray(startPoint)) {
66
+ correctedStartPoint = [startPoint[0] != null ? startPoint[0] : 0, startPoint[1] != null ? startPoint[1] : 0];
67
+ }
68
+ let correctedEndPoint = [0, 1];
69
+ if (Array.isArray(endPoint)) {
70
+ correctedEndPoint = [endPoint[0] != null ? endPoint[0] : 0, endPoint[1] != null ? endPoint[1] : 1];
71
+ }
72
+ return [correctedStartPoint, correctedEndPoint];
73
+ };
74
+ const [start, end] = getControlPoints();
75
+ start[0] *= width;
76
+ end[0] *= width;
77
+ start[1] *= height;
78
+ end[1] *= height;
79
+ const py = end[1] - start[1];
80
+ const px = end[0] - start[0];
81
+ return 90 + Math.atan2(py, px) * 180 / Math.PI;
98
82
  }
99
83
  function calculateGradientColors(colors, locations) {
100
- return colors.map((color, index) => {
101
- const output = normalizeColor(color);
102
- if (locations && locations[index] !== void 0) {
103
- const location = Math.max(0, Math.min(1, locations[index]));
104
- const percentage = location * 100;
105
- return `${output} ${percentage}%`;
106
- }
107
- return output;
108
- });
84
+ return colors.map((color, index) => {
85
+ const output = normalizeColor(color);
86
+ if (locations && locations[index] !== void 0) {
87
+ const location = Math.max(0, Math.min(1, locations[index]));
88
+ const percentage = location * 100;
89
+ return `${output} ${percentage}%`;
90
+ }
91
+ return output;
92
+ });
109
93
  }
94
+
110
95
  export { LinearGradient };
111
96
  //# sourceMappingURL=linear-gradient.mjs.map
@@ -1 +1 @@
1
- {"version":3,"names":["normalizeColor","React","View","jsx","needsDimensionAwareAngle","start","end","startX","endX","LinearGradient","colors","locations","props","normalizedStart","Array","isArray","x","y","normalizedEnd","needsLayout","height","width","setLayout","useState","linearGradientBackgroundImage","useMemo","getLinearGradientBackgroundImage","onLayout","style","backgroundImage","event","width2","height2","nativeEvent","layout","oldLayout","startPoint","endPoint","gradientColors","calculateGradientColors","angle","calculatePseudoAngle","join","getControlPoints","correctedStartPoint","correctedEndPoint","py","px","Math","atan2","PI","map","color","index","output","location","max","min","percentage"],"sources":["../../src/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AA,GAAStD,cAAA,CAAeoD,KAAK;IACnC,IAAIzC,SAAA,IAAaA,SAAA,CAAU0C,KAAK,MAAM,QAAW;MAC/C,MAAME,QAAA,GAAWP,IAAA,CAAKQ,GAAA,CAAI,GAAGR,IAAA,CAAKS,GAAA,CAAI,GAAG9C,SAAA,CAAU0C,KAAK,CAAC,CAAC;MAE1D,MAAMK,UAAA,GAAaH,QAAA,GAAW;MAC9B,OAAO,GAAGD,MAAM,IAAII,UAAU;IAChC;IACA,OAAOJ,MAAA;EACT,CAAC;AACH","ignoreList":[]}
1
+ {"version":3,"file":"linear-gradient.js","names":[],"sources":["esm/linear-gradient.js"],"sourcesContent":["import { normalizeColor } from \"@tamagui/core\";\nimport * as React from \"react\";\nimport { View } from \"react-native-web\";\nimport { jsx } from \"react/jsx-runtime\";\nfunction needsDimensionAwareAngle(start, end) {\n if (!start && !end) return false;\n const startX = start?.[0] ?? 0.5;\n const endX = end?.[0] ?? 0.5;\n return startX !== endX;\n}\nfunction LinearGradient({\n colors,\n locations,\n start,\n end,\n ...props\n}) {\n const normalizedStart = start ? Array.isArray(start) ? start : [start.x, start.y] : void 0;\n const normalizedEnd = end ? Array.isArray(end) ? end : [end.x, end.y] : void 0;\n const needsLayout = needsDimensionAwareAngle(\n normalizedStart,\n normalizedEnd\n );\n const [{ height, width }, setLayout] = React.useState({\n height: 1,\n width: 1\n });\n const linearGradientBackgroundImage = React.useMemo(() => {\n return getLinearGradientBackgroundImage(\n // @ts-expect-error ok\n colors,\n locations,\n normalizedStart,\n normalizedEnd,\n width,\n height\n );\n }, [colors, locations, normalizedStart, normalizedEnd, width, height]);\n if (!needsLayout) {\n return /* @__PURE__ */ jsx(\n View,\n {\n ...props,\n onLayout: props.onLayout,\n style: [\n props.style,\n // @ts-ignore: [ts] Property 'backgroundImage' does not exist on type 'ViewStyle'.\n { backgroundImage: linearGradientBackgroundImage }\n ]\n }\n );\n }\n return /* @__PURE__ */ jsx(\n View,\n {\n ...props,\n style: [\n props.style,\n // @ts-ignore: [ts] Property 'backgroundImage' does not exist on type 'ViewStyle'.\n { backgroundImage: linearGradientBackgroundImage }\n ],\n onLayout: (event) => {\n const { width: width2, height: height2 } = event.nativeEvent.layout;\n setLayout((oldLayout) => {\n if (width2 !== oldLayout.width || height2 !== oldLayout.height) {\n return { height: height2, width: width2 };\n }\n return oldLayout;\n });\n if (props.onLayout) {\n props.onLayout(event);\n }\n }\n }\n );\n}\nfunction getLinearGradientBackgroundImage(colors, locations, startPoint, endPoint, width = 1, height = 1) {\n const gradientColors = calculateGradientColors(\n // @ts-expect-error TODO fix numbers\n colors,\n locations\n );\n const angle = calculatePseudoAngle(width, height, startPoint, endPoint);\n return `linear-gradient(${angle}deg, ${gradientColors.join(\", \")})`;\n}\nfunction calculatePseudoAngle(width, height, startPoint, endPoint) {\n const getControlPoints = () => {\n let correctedStartPoint = [0, 0];\n if (Array.isArray(startPoint)) {\n correctedStartPoint = [\n startPoint[0] != null ? startPoint[0] : 0,\n startPoint[1] != null ? startPoint[1] : 0\n ];\n }\n let correctedEndPoint = [0, 1];\n if (Array.isArray(endPoint)) {\n correctedEndPoint = [\n endPoint[0] != null ? endPoint[0] : 0,\n endPoint[1] != null ? endPoint[1] : 1\n ];\n }\n return [correctedStartPoint, correctedEndPoint];\n };\n const [start, end] = getControlPoints();\n start[0] *= width;\n end[0] *= width;\n start[1] *= height;\n end[1] *= height;\n const py = end[1] - start[1];\n const px = end[0] - start[0];\n return 90 + Math.atan2(py, px) * 180 / Math.PI;\n}\nfunction calculateGradientColors(colors, locations) {\n return colors.map((color, index) => {\n const output = normalizeColor(color);\n if (locations && locations[index] !== void 0) {\n const location = Math.max(0, Math.min(1, locations[index]));\n const percentage = location * 100;\n return `${output} ${percentage}%`;\n }\n return output;\n });\n}\nexport {\n LinearGradient\n};\n//# sourceMappingURL=linear-gradient.js.map\n"],"mappings":";;;;;;AAIA,SAAS,yBAAyB,OAAO,KAAK;CAC5C,IAAI,CAAC,SAAS,CAAC,KAAK,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
2
2
  import { getLinearGradient } from "@tamagui/native";
3
+
3
4
  function LinearGradient(props) {
4
- var state = getLinearGradient().state;
5
- if (state.enabled && state.Component) {
6
- var ExpoLinearGradient = state.Component;
7
- return /* @__PURE__ */_jsx(ExpoLinearGradient, {
8
- ...props
9
- });
10
- }
11
- console.warn(`Warning: Must call import '@tamagui/native/setup-expo-linear-gradient' at root`);
12
- return;
5
+ var state = getLinearGradient().state;
6
+ if (state.enabled && state.Component) {
7
+ var ExpoLinearGradient = state.Component;
8
+ return /* @__PURE__ */ jsx(ExpoLinearGradient, { ...props });
9
+ }
10
+ console.warn(`Warning: Must call import '@tamagui/native/setup-expo-linear-gradient' at root`);
11
+ return;
13
12
  }
13
+
14
14
  export { LinearGradient };
15
15
  //# sourceMappingURL=linear-gradient.native.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["jsx","_jsx","getLinearGradient","LinearGradient","props","state","enabled","Component","ExpoLinearGradient","console","warn"],"sources":["../../src/linear-gradient.native.tsx"],"sourcesContent":[null],"mappings":"AAAA,SAASA,GAAA,IAAOC,IAAA,QAAY;AAC5B,SAASC,iBAAA,QAAyB;AAC3B,SAASC,eAAeC,KAAA,EAAO;EAClC,IAAIC,KAAA,GAAQH,iBAAA,CAAkB,EAAEG,KAAA;EAChC,IAAIA,KAAA,CAAMC,OAAA,IAAWD,KAAA,CAAME,SAAA,EAAW;IAClC,IAAIC,kBAAA,GAAqBH,KAAA,CAAME,SAAA;IAC/B,OAAqB,eAAAN,IAAA,CAAKO,kBAAA,EAAoB;MAC1C,GAAGJ;IACP,CAAC;EACL;EACAK,OAAA,CAAQC,IAAA,CAAK,gFAAgF;EAC7F;AACJ","ignoreList":[]}
1
+ {"version":3,"file":"linear-gradient.native.js","names":[],"sources":["esm/linear-gradient.native.js"],"sourcesContent":["import { jsx as _jsx } from \"react/jsx-runtime\";\nimport { getLinearGradient } from \"@tamagui/native\";\nfunction LinearGradient(props) {\n var state = getLinearGradient().state;\n if (state.enabled && state.Component) {\n var ExpoLinearGradient = state.Component;\n return /* @__PURE__ */ _jsx(ExpoLinearGradient, {\n ...props\n });\n }\n console.warn(`Warning: Must call import '@tamagui/native/setup-expo-linear-gradient' at root`);\n return;\n}\nexport {\n LinearGradient\n};\n//# sourceMappingURL=linear-gradient.native.js.map\n"],"mappings":";;;;AAEA,SAAS,eAAe,OAAO;CAC7B,IAAI,QAAQ,kBAAkB,EAAE;CAChC,IAAI,MAAM,WAAW,MAAM,WAAW;EACpC,IAAI,qBAAqB,MAAM;EAC/B,OAAuB,oBAAK,oBAAoB,EAC9C,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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A;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":["jsx/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"}
@@ -0,0 +1,76 @@
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 LinearGradient_exports = {};
25
+ __export(LinearGradient_exports, { LinearGradient: () => LinearGradient });
26
+ module.exports = __toCommonJS(LinearGradient_exports);
27
+ var import_jsx_runtime = require("react/jsx-runtime");
28
+ var import_core = require("@tamagui/core");
29
+ var import_stacks = require("@tamagui/stacks");
30
+ var import_linear_gradient = require("./linear-gradient.native.js");
31
+ var LinearGradientFrame = (0, import_core.styled)(import_stacks.YStack, {
32
+ displayName: "LinearGradient",
33
+ overflow: "hidden",
34
+ position: "relative"
35
+ });
36
+ var LinearGradient = (0, import_core.createStyledHOC)(LinearGradientFrame, function(propsIn, ref) {
37
+ var _props_colors;
38
+ var props = (0, import_core.useProps)(propsIn);
39
+ var { start, end, colors: colorsProp, locations, children, ...stackProps } = props;
40
+ var theme = (0, import_core.useTheme)();
41
+ var colors = ((_props_colors = props.colors) === null || _props_colors === void 0 ? void 0 : _props_colors.map(function(c) {
42
+ var _theme_c;
43
+ var _theme_c_get;
44
+ 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;
45
+ })) || [];
46
+ if (process.env.NODE_ENV !== "production") {
47
+ if (colors.some(function(c) {
48
+ var normalized = (0, import_core.normalizeColor)(c);
49
+ if (!normalized) {
50
+ return true;
51
+ }
52
+ })) {
53
+ console.error(`LinearGradient: "colors" prop contains invalid color tokens: ${colors} fallback to default colors: ["#000", "#fff"]`);
54
+ colors = ["#000", "#fff"];
55
+ }
56
+ }
57
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(LinearGradientFrame, {
58
+ ref,
59
+ ...stackProps,
60
+ children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_linear_gradient.LinearGradient, {
61
+ start,
62
+ end,
63
+ colors,
64
+ locations,
65
+ style: gradientStyle
66
+ }), children]
67
+ });
68
+ });
69
+ var gradientStyle = {
70
+ position: "absolute",
71
+ top: 0,
72
+ left: 0,
73
+ right: 0,
74
+ bottom: 0,
75
+ zIndex: 0
76
+ };
@@ -1,87 +1,78 @@
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 LinearGradient_exports = {};
26
- __export(LinearGradient_exports, {
27
- LinearGradient: () => LinearGradient
28
- });
25
+ __export(LinearGradient_exports, { LinearGradient: () => LinearGradient });
29
26
  module.exports = __toCommonJS(LinearGradient_exports);
30
27
  var import_jsx_runtime = require("react/jsx-runtime");
31
28
  var import_core = require("@tamagui/core");
32
29
  var import_stacks = require("@tamagui/stacks");
33
30
  var import_linear_gradient = require("./linear-gradient.native.js");
34
31
  var LinearGradientFrame = (0, import_core.styled)(import_stacks.YStack, {
35
- name: "LinearGradient",
36
- overflow: "hidden",
37
- position: "relative"
32
+ displayName: "LinearGradient",
33
+ overflow: "hidden",
34
+ position: "relative"
38
35
  });
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) {
58
- var normalized = (0, import_core.normalizeColor)(c);
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
- });
36
+ var LinearGradient = (0, import_core.createStyledHOC)(LinearGradientFrame, function(propsIn, ref) {
37
+ var _props_colors;
38
+ var props = (0, import_core.useProps)(propsIn);
39
+ var { start, end, colors: colorsProp, locations, children, ...stackProps } = props;
40
+ var theme = (0, import_core.useTheme)();
41
+ var colors = ((_props_colors = props.colors) === null || _props_colors === void 0 ? void 0 : _props_colors.map(function(c) {
42
+ var _theme_c;
43
+ var _theme_c_get;
44
+ 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;
45
+ })) || [];
46
+ if (process.env.NODE_ENV !== "production") {
47
+ if (colors.some(function(c) {
48
+ var normalized = (0, import_core.normalizeColor)(c);
49
+ if (!normalized) {
50
+ return true;
51
+ }
52
+ })) {
53
+ console.error(`LinearGradient: "colors" prop contains invalid color tokens: ${colors} fallback to default colors: ["#000", "#fff"]`);
54
+ colors = ["#000", "#fff"];
55
+ }
56
+ }
57
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(LinearGradientFrame, {
58
+ ref,
59
+ ...stackProps,
60
+ children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_linear_gradient.LinearGradient, {
61
+ start,
62
+ end,
63
+ colors,
64
+ locations,
65
+ style: gradientStyle
66
+ }), children]
67
+ });
78
68
  });
79
69
  var gradientStyle = {
80
- position: "absolute",
81
- top: 0,
82
- left: 0,
83
- right: 0,
84
- bottom: 0,
85
- zIndex: 0
70
+ position: "absolute",
71
+ top: 0,
72
+ left: 0,
73
+ right: 0,
74
+ bottom: 0,
75
+ zIndex: 0
86
76
  };
77
+
87
78
  //# sourceMappingURL=LinearGradient.native.js.map