@tamagui/core 1.0.0-alpha.36 → 1.0.0-alpha.37

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.
@@ -9,27 +9,31 @@ var __export = (target, all) => {
9
9
  __export(exports, {
10
10
  fixNativeShadow: () => fixNativeShadow
11
11
  });
12
- const matchRgba = /rgba\(\s*([\d\.]{1,})\s*,\s*([\d\.]{1,})\s*,\s*([\d\.]{1,})\s*,\s*([\d\.]{1,})\s*\)$/;
12
+ const matchRgbaHsla = /(rgba|hsla)\(\s*([\d\.]{1,}%?)\s*,\s*([\d\.]{1,}%?)\s*,\s*([\d\.]{1,}%?)\s*,\s*([\d\.]{1,})\s*\)$/;
13
13
  function fixNativeShadow(props) {
14
- if (props.shadowColor) {
15
- if (!!!("shadowOffset" in props)) {
16
- props.shadowOffset = {
17
- width: 0,
18
- height: 0
19
- };
20
- }
21
- if (!!!("shadowOpacity" in props)) {
22
- const c = `${props.shadowColor}`;
23
- if (c[0] === "r" && c[3] === "a") {
24
- const [_, r, g, b, a] = c.match(matchRgba) || [];
25
- if (typeof a !== "string") {
26
- console.warn("non valid rgba", c);
27
- return props;
28
- }
29
- props.shadowColor = `rgb(${r},${g},${b})`;
30
- props.shadowOpacity = +a;
31
- }
14
+ if (!props.shadowColor) {
15
+ return;
16
+ }
17
+ if (!props.shadowOffset) {
18
+ props.shadowOffset = {
19
+ width: 0,
20
+ height: 0
21
+ };
22
+ }
23
+ if ("shadowOpacity" in props) {
24
+ return;
25
+ }
26
+ const c = `${props.shadowColor}`;
27
+ if ((c[0] === "r" || c[0] === "h") && c[3] === "a") {
28
+ const [_, type, _1, _2, _3, a] = c.match(matchRgbaHsla) || [];
29
+ if (typeof a !== "string") {
30
+ console.warn("invalid", c, type);
31
+ return;
32
32
  }
33
+ props.shadowColor = `${type.replace("a", "")}(${_1},${_2},${_3})`;
34
+ props.shadowOpacity = +a;
35
+ } else {
36
+ props.shadowOpacity = 1;
33
37
  }
34
38
  }
35
39
  __name(fixNativeShadow, "fixNativeShadow");
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/helpers/fixNativeShadow.native.tsx"],
4
- "sourcesContent": ["const matchRgba =\n /rgba\\(\\s*([\\d\\.]{1,})\\s*,\\s*([\\d\\.]{1,})\\s*,\\s*([\\d\\.]{1,})\\s*,\\s*([\\d\\.]{1,})\\s*\\)$/\n\nexport function fixNativeShadow(props: any) {\n if (props.shadowColor) {\n if (!!!('shadowOffset' in props)) {\n // fixes some broken shadows\n props.shadowOffset = {\n width: 0,\n height: 0,\n }\n }\n if (!!!('shadowOpacity' in props)) {\n const c = `${props.shadowColor}`\n // react native has issues sometimes with rgba()\n if (c[0] === 'r' && c[3] === 'a') {\n const [_, r, g, b, a] = c.match(matchRgba) || []\n if (typeof a !== 'string') {\n console.warn('non valid rgba', c)\n return props\n }\n props.shadowColor = `rgb(${r},${g},${b})`\n props.shadowOpacity = +a\n }\n }\n }\n}\n"],
5
- "mappings": ";;;;;;;;AAAA;AAAA;AAAA;AAAA,MAAM,YACJ;AAEK,yBAAyB,OAAY;AAC1C,MAAI,MAAM,aAAa;AACrB,QAAI,CAAC,CAAC,CAAE,mBAAkB,QAAQ;AAEhC,YAAM,eAAe;AAAA,QACnB,OAAO;AAAA,QACP,QAAQ;AAAA;AAAA;AAGZ,QAAI,CAAC,CAAC,CAAE,oBAAmB,QAAQ;AACjC,YAAM,IAAI,GAAG,MAAM;AAEnB,UAAI,EAAE,OAAO,OAAO,EAAE,OAAO,KAAK;AAChC,cAAM,CAAC,GAAG,GAAG,GAAG,GAAG,KAAK,EAAE,MAAM,cAAc;AAC9C,YAAI,OAAO,MAAM,UAAU;AACzB,kBAAQ,KAAK,kBAAkB;AAC/B,iBAAO;AAAA;AAET,cAAM,cAAc,OAAO,KAAK,KAAK;AACrC,cAAM,gBAAgB,CAAC;AAAA;AAAA;AAAA;AAAA;AAnBf;",
4
+ "sourcesContent": ["const matchRgbaHsla =\n /(rgba|hsla)\\(\\s*([\\d\\.]{1,}%?)\\s*,\\s*([\\d\\.]{1,}%?)\\s*,\\s*([\\d\\.]{1,}%?)\\s*,\\s*([\\d\\.]{1,})\\s*\\)$/\n\nexport function fixNativeShadow(props: any) {\n if (!props.shadowColor) {\n return\n }\n if (!props.shadowOffset) {\n // fixes some broken shadows\n props.shadowOffset = {\n width: 0,\n height: 0,\n }\n }\n if ('shadowOpacity' in props) {\n return\n }\n const c = `${props.shadowColor}`\n // react native has issues sometimes with rgba()\n // supports rgba + hsla\n if ((c[0] === 'r' || c[0] === 'h') && c[3] === 'a') {\n const [_, type, _1, _2, _3, a] = c.match(matchRgbaHsla) || []\n if (typeof a !== 'string') {\n console.warn('invalid', c, type)\n return\n }\n props.shadowColor = `${type.replace('a', '')}(${_1},${_2},${_3})`\n props.shadowOpacity = +a\n } else {\n props.shadowOpacity = 1\n }\n}\n"],
5
+ "mappings": ";;;;;;;;AAAA;AAAA;AAAA;AAAA,MAAM,gBACJ;AAEK,yBAAyB,OAAY;AAC1C,MAAI,CAAC,MAAM,aAAa;AACtB;AAAA;AAEF,MAAI,CAAC,MAAM,cAAc;AAEvB,UAAM,eAAe;AAAA,MACnB,OAAO;AAAA,MACP,QAAQ;AAAA;AAAA;AAGZ,MAAI,mBAAmB,OAAO;AAC5B;AAAA;AAEF,QAAM,IAAI,GAAG,MAAM;AAGnB,MAAK,GAAE,OAAO,OAAO,EAAE,OAAO,QAAQ,EAAE,OAAO,KAAK;AAClD,UAAM,CAAC,GAAG,MAAM,IAAI,IAAI,IAAI,KAAK,EAAE,MAAM,kBAAkB;AAC3D,QAAI,OAAO,MAAM,UAAU;AACzB,cAAQ,KAAK,WAAW,GAAG;AAC3B;AAAA;AAEF,UAAM,cAAc,GAAG,KAAK,QAAQ,KAAK,OAAO,MAAM,MAAM;AAC5D,UAAM,gBAAgB,CAAC;AAAA,SAClB;AACL,UAAM,gBAAgB;AAAA;AAAA;AA1BV;",
6
6
  "names": []
7
7
  }
@@ -1,26 +1,30 @@
1
1
  var __defProp = Object.defineProperty;
2
2
  var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
3
- const matchRgba = /rgba\(\s*([\d\.]{1,})\s*,\s*([\d\.]{1,})\s*,\s*([\d\.]{1,})\s*,\s*([\d\.]{1,})\s*\)$/;
3
+ const matchRgbaHsla = /(rgba|hsla)\(\s*([\d\.]{1,}%?)\s*,\s*([\d\.]{1,}%?)\s*,\s*([\d\.]{1,}%?)\s*,\s*([\d\.]{1,})\s*\)$/;
4
4
  function fixNativeShadow(props) {
5
- if (props.shadowColor) {
6
- if (!!!("shadowOffset" in props)) {
7
- props.shadowOffset = {
8
- width: 0,
9
- height: 0
10
- };
11
- }
12
- if (!!!("shadowOpacity" in props)) {
13
- const c = `${props.shadowColor}`;
14
- if (c[0] === "r" && c[3] === "a") {
15
- const [_, r, g, b, a] = c.match(matchRgba) || [];
16
- if (typeof a !== "string") {
17
- console.warn("non valid rgba", c);
18
- return props;
19
- }
20
- props.shadowColor = `rgb(${r},${g},${b})`;
21
- props.shadowOpacity = +a;
22
- }
5
+ if (!props.shadowColor) {
6
+ return;
7
+ }
8
+ if (!props.shadowOffset) {
9
+ props.shadowOffset = {
10
+ width: 0,
11
+ height: 0
12
+ };
13
+ }
14
+ if ("shadowOpacity" in props) {
15
+ return;
16
+ }
17
+ const c = `${props.shadowColor}`;
18
+ if ((c[0] === "r" || c[0] === "h") && c[3] === "a") {
19
+ const [_, type, _1, _2, _3, a] = c.match(matchRgbaHsla) || [];
20
+ if (typeof a !== "string") {
21
+ console.warn("invalid", c, type);
22
+ return;
23
23
  }
24
+ props.shadowColor = `${type.replace("a", "")}(${_1},${_2},${_3})`;
25
+ props.shadowOpacity = +a;
26
+ } else {
27
+ props.shadowOpacity = 1;
24
28
  }
25
29
  }
26
30
  __name(fixNativeShadow, "fixNativeShadow");
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/helpers/fixNativeShadow.native.tsx"],
4
- "sourcesContent": ["const matchRgba =\n /rgba\\(\\s*([\\d\\.]{1,})\\s*,\\s*([\\d\\.]{1,})\\s*,\\s*([\\d\\.]{1,})\\s*,\\s*([\\d\\.]{1,})\\s*\\)$/\n\nexport function fixNativeShadow(props: any) {\n if (props.shadowColor) {\n if (!!!('shadowOffset' in props)) {\n // fixes some broken shadows\n props.shadowOffset = {\n width: 0,\n height: 0,\n }\n }\n if (!!!('shadowOpacity' in props)) {\n const c = `${props.shadowColor}`\n // react native has issues sometimes with rgba()\n if (c[0] === 'r' && c[3] === 'a') {\n const [_, r, g, b, a] = c.match(matchRgba) || []\n if (typeof a !== 'string') {\n console.warn('non valid rgba', c)\n return props\n }\n props.shadowColor = `rgb(${r},${g},${b})`\n props.shadowOpacity = +a\n }\n }\n }\n}\n"],
5
- "mappings": ";;AAAA,MAAM,YACJ;AAEK,yBAAyB,OAAY;AAC1C,MAAI,MAAM,aAAa;AACrB,QAAI,CAAC,CAAC,CAAE,mBAAkB,QAAQ;AAEhC,YAAM,eAAe;AAAA,QACnB,OAAO;AAAA,QACP,QAAQ;AAAA;AAAA;AAGZ,QAAI,CAAC,CAAC,CAAE,oBAAmB,QAAQ;AACjC,YAAM,IAAI,GAAG,MAAM;AAEnB,UAAI,EAAE,OAAO,OAAO,EAAE,OAAO,KAAK;AAChC,cAAM,CAAC,GAAG,GAAG,GAAG,GAAG,KAAK,EAAE,MAAM,cAAc;AAC9C,YAAI,OAAO,MAAM,UAAU;AACzB,kBAAQ,KAAK,kBAAkB;AAC/B,iBAAO;AAAA;AAET,cAAM,cAAc,OAAO,KAAK,KAAK;AACrC,cAAM,gBAAgB,CAAC;AAAA;AAAA;AAAA;AAAA;AAnBf;",
4
+ "sourcesContent": ["const matchRgbaHsla =\n /(rgba|hsla)\\(\\s*([\\d\\.]{1,}%?)\\s*,\\s*([\\d\\.]{1,}%?)\\s*,\\s*([\\d\\.]{1,}%?)\\s*,\\s*([\\d\\.]{1,})\\s*\\)$/\n\nexport function fixNativeShadow(props: any) {\n if (!props.shadowColor) {\n return\n }\n if (!props.shadowOffset) {\n // fixes some broken shadows\n props.shadowOffset = {\n width: 0,\n height: 0,\n }\n }\n if ('shadowOpacity' in props) {\n return\n }\n const c = `${props.shadowColor}`\n // react native has issues sometimes with rgba()\n // supports rgba + hsla\n if ((c[0] === 'r' || c[0] === 'h') && c[3] === 'a') {\n const [_, type, _1, _2, _3, a] = c.match(matchRgbaHsla) || []\n if (typeof a !== 'string') {\n console.warn('invalid', c, type)\n return\n }\n props.shadowColor = `${type.replace('a', '')}(${_1},${_2},${_3})`\n props.shadowOpacity = +a\n } else {\n props.shadowOpacity = 1\n }\n}\n"],
5
+ "mappings": ";;AAAA,MAAM,gBACJ;AAEK,yBAAyB,OAAY;AAC1C,MAAI,CAAC,MAAM,aAAa;AACtB;AAAA;AAEF,MAAI,CAAC,MAAM,cAAc;AAEvB,UAAM,eAAe;AAAA,MACnB,OAAO;AAAA,MACP,QAAQ;AAAA;AAAA;AAGZ,MAAI,mBAAmB,OAAO;AAC5B;AAAA;AAEF,QAAM,IAAI,GAAG,MAAM;AAGnB,MAAK,GAAE,OAAO,OAAO,EAAE,OAAO,QAAQ,EAAE,OAAO,KAAK;AAClD,UAAM,CAAC,GAAG,MAAM,IAAI,IAAI,IAAI,KAAK,EAAE,MAAM,kBAAkB;AAC3D,QAAI,OAAO,MAAM,UAAU;AACzB,cAAQ,KAAK,WAAW,GAAG;AAC3B;AAAA;AAEF,UAAM,cAAc,GAAG,KAAK,QAAQ,KAAK,OAAO,MAAM,MAAM;AAC5D,UAAM,gBAAgB,CAAC;AAAA,SAClB;AACL,UAAM,gBAAgB;AAAA;AAAA;AA1BV;",
6
6
  "names": []
7
7
  }
@@ -1,26 +1,30 @@
1
1
  var __defProp = Object.defineProperty;
2
2
  var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
3
- const matchRgba = /rgba\(\s*([\d\.]{1,})\s*,\s*([\d\.]{1,})\s*,\s*([\d\.]{1,})\s*,\s*([\d\.]{1,})\s*\)$/;
3
+ const matchRgbaHsla = /(rgba|hsla)\(\s*([\d\.]{1,}%?)\s*,\s*([\d\.]{1,}%?)\s*,\s*([\d\.]{1,}%?)\s*,\s*([\d\.]{1,})\s*\)$/;
4
4
  function fixNativeShadow(props) {
5
- if (props.shadowColor) {
6
- if (!!!("shadowOffset" in props)) {
7
- props.shadowOffset = {
8
- width: 0,
9
- height: 0
10
- };
11
- }
12
- if (!!!("shadowOpacity" in props)) {
13
- const c = `${props.shadowColor}`;
14
- if (c[0] === "r" && c[3] === "a") {
15
- const [_, r, g, b, a] = c.match(matchRgba) || [];
16
- if (typeof a !== "string") {
17
- console.warn("non valid rgba", c);
18
- return props;
19
- }
20
- props.shadowColor = `rgb(${r},${g},${b})`;
21
- props.shadowOpacity = +a;
22
- }
5
+ if (!props.shadowColor) {
6
+ return;
7
+ }
8
+ if (!props.shadowOffset) {
9
+ props.shadowOffset = {
10
+ width: 0,
11
+ height: 0
12
+ };
13
+ }
14
+ if ("shadowOpacity" in props) {
15
+ return;
16
+ }
17
+ const c = `${props.shadowColor}`;
18
+ if ((c[0] === "r" || c[0] === "h") && c[3] === "a") {
19
+ const [_, type, _1, _2, _3, a] = c.match(matchRgbaHsla) || [];
20
+ if (typeof a !== "string") {
21
+ console.warn("invalid", c, type);
22
+ return;
23
23
  }
24
+ props.shadowColor = `${type.replace("a", "")}(${_1},${_2},${_3})`;
25
+ props.shadowOpacity = +a;
26
+ } else {
27
+ props.shadowOpacity = 1;
24
28
  }
25
29
  }
26
30
  __name(fixNativeShadow, "fixNativeShadow");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tamagui/core",
3
- "version": "1.0.0-alpha.36",
3
+ "version": "1.0.0-alpha.37",
4
4
  "source": "src/index.ts",
5
5
  "main": "dist/cjs",
6
6
  "module": "dist/esm",
@@ -14,10 +14,10 @@
14
14
  "dist"
15
15
  ],
16
16
  "dependencies": {
17
- "@tamagui/helpers": "^1.0.0-alpha.36",
17
+ "@tamagui/helpers": "^1.0.0-alpha.37",
18
18
  "@tamagui/ow": "^0.28.1",
19
- "@tamagui/use-debounce": "^1.0.0-alpha.36",
20
- "@tamagui/use-force-update": "^1.0.0-alpha.36",
19
+ "@tamagui/use-debounce": "^1.0.0-alpha.37",
20
+ "@tamagui/use-force-update": "^1.0.0-alpha.37",
21
21
  "react": "*",
22
22
  "react-dom": "*"
23
23
  },
@@ -25,7 +25,7 @@
25
25
  "react-native-web": "*"
26
26
  },
27
27
  "devDependencies": {
28
- "@tamagui/build": "^1.0.0-alpha.36",
28
+ "@tamagui/build": "^1.0.0-alpha.37",
29
29
  "@types/react": "^17.0.35",
30
30
  "esbuild": "^0.13.12",
31
31
  "react-native-web": "^0.17.5",
@@ -37,5 +37,5 @@
37
37
  "engines": {
38
38
  "node": ">=16"
39
39
  },
40
- "gitHead": "d5b75feefe9694ee2f107b69c1be98a5f107eada"
40
+ "gitHead": "c6357d6e6108b437bb055dad0eae51cd55190143"
41
41
  }
@@ -1,2 +1,2 @@
1
- export declare function fixNativeShadow(props: any): any;
1
+ export declare function fixNativeShadow(props: any): void;
2
2
  //# sourceMappingURL=fixNativeShadow.native.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"fixNativeShadow.native.d.ts","sourceRoot":"","sources":["../../src/helpers/fixNativeShadow.native.tsx"],"names":[],"mappings":"AAGA,wBAAgB,eAAe,CAAC,KAAK,EAAE,GAAG,OAuBzC"}
1
+ {"version":3,"file":"fixNativeShadow.native.d.ts","sourceRoot":"","sources":["../../src/helpers/fixNativeShadow.native.tsx"],"names":[],"mappings":"AAGA,wBAAgB,eAAe,CAAC,KAAK,EAAE,GAAG,QA4BzC"}