@tamagui/web 3.0.0-beta.1341.1 → 3.0.0-beta.1348.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.
@@ -24,16 +24,17 @@ __export(mergeProps_exports, {
24
24
  mergeProps: () => mergeProps
25
25
  });
26
26
  module.exports = __toCommonJS(mergeProps_exports);
27
+ const mergeLayer = (out, layer) => {
28
+ for (const key in layer) {
29
+ const value = layer[key];
30
+ if (value === void 0 && key in out) continue;
31
+ out[key] = value;
32
+ }
33
+ };
27
34
  const mergeProps = (defaultProps, props) => {
28
35
  const out = {};
29
- for (const key in defaultProps) {
30
- if (key in props && props[key] !== void 0) continue;
31
- out[key] = defaultProps[key];
32
- }
33
- for (const key in props) {
34
- if (props[key] === void 0 && key in defaultProps) continue;
35
- out[key] = props[key];
36
- }
36
+ mergeLayer(out, defaultProps);
37
+ mergeLayer(out, props);
37
38
  return out;
38
39
  };
39
40
  const mergeComponentProps = (defaultProps, contextProps, props) => {
@@ -41,29 +42,16 @@ const mergeComponentProps = (defaultProps, contextProps, props) => {
41
42
  if (!defaultProps && !contextProps) {
42
43
  return [props, overriddenContext];
43
44
  }
44
- if (defaultProps && !contextProps) {
45
- return [mergeProps(defaultProps, props), overriddenContext];
46
- }
47
45
  const out = {};
48
- for (const key in defaultProps) {
49
- if (key in props && props[key] !== void 0) continue;
50
- out[key] = defaultProps[key];
51
- }
52
- for (const key in contextProps) {
53
- if (key in props && props[key] !== void 0) continue;
54
- const contextValue = contextProps[key];
55
- if (contextValue !== void 0) {
56
- out[key] = contextValue;
57
- }
58
- }
46
+ if (defaultProps) mergeLayer(out, defaultProps);
47
+ if (contextProps) mergeLayer(out, contextProps);
59
48
  for (const key in props) {
60
- if (props[key] === void 0 && (defaultProps && key in defaultProps || contextProps && key in contextProps)) {
61
- continue;
62
- }
63
- out[key] = props[key];
49
+ const value = props[key];
50
+ if (value === void 0 && key in out) continue;
51
+ out[key] = value;
64
52
  if (contextProps && key in contextProps) {
65
53
  overriddenContext ||= {};
66
- overriddenContext[key] = props[key];
54
+ overriddenContext[key] = value;
67
55
  }
68
56
  }
69
57
  return [out, overriddenContext];
@@ -26,16 +26,17 @@ __export(mergeProps_exports, {
26
26
  mergeProps: () => mergeProps
27
27
  });
28
28
  module.exports = __toCommonJS(mergeProps_exports);
29
+ var mergeLayer = function(out, layer) {
30
+ for (var key in layer) {
31
+ var value = layer[key];
32
+ if (value === void 0 && key in out) continue;
33
+ out[key] = value;
34
+ }
35
+ };
29
36
  var mergeProps = function(defaultProps, props) {
30
37
  var out = {};
31
- for (var key in defaultProps) {
32
- if (key in props && props[key] !== void 0) continue;
33
- out[key] = defaultProps[key];
34
- }
35
- for (var key1 in props) {
36
- if (props[key1] === void 0 && key1 in defaultProps) continue;
37
- out[key1] = props[key1];
38
- }
38
+ mergeLayer(out, defaultProps);
39
+ mergeLayer(out, props);
39
40
  return out;
40
41
  };
41
42
  var mergeComponentProps = function(defaultProps, contextProps, props) {
@@ -43,29 +44,16 @@ var mergeComponentProps = function(defaultProps, contextProps, props) {
43
44
  if (!defaultProps && !contextProps) {
44
45
  return [props, overriddenContext];
45
46
  }
46
- if (defaultProps && !contextProps) {
47
- return [mergeProps(defaultProps, props), overriddenContext];
48
- }
49
47
  var out = {};
50
- for (var key in defaultProps) {
51
- if (key in props && props[key] !== void 0) continue;
52
- out[key] = defaultProps[key];
53
- }
54
- for (var key1 in contextProps) {
55
- if (key1 in props && props[key1] !== void 0) continue;
56
- var contextValue = contextProps[key1];
57
- if (contextValue !== void 0) {
58
- out[key1] = contextValue;
59
- }
60
- }
61
- for (var key2 in props) {
62
- if (props[key2] === void 0 && (defaultProps && key2 in defaultProps || contextProps && key2 in contextProps)) {
63
- continue;
64
- }
65
- out[key2] = props[key2];
66
- if (contextProps && key2 in contextProps) {
48
+ if (defaultProps) mergeLayer(out, defaultProps);
49
+ if (contextProps) mergeLayer(out, contextProps);
50
+ for (var key in props) {
51
+ var value = props[key];
52
+ if (value === void 0 && key in out) continue;
53
+ out[key] = value;
54
+ if (contextProps && key in contextProps) {
67
55
  overriddenContext || (overriddenContext = {});
68
- overriddenContext[key2] = props[key2];
56
+ overriddenContext[key] = value;
69
57
  }
70
58
  }
71
59
  return [out, overriddenContext];
@@ -26,16 +26,17 @@ __export(mergeProps_exports, {
26
26
  mergeProps: () => mergeProps
27
27
  });
28
28
  module.exports = __toCommonJS(mergeProps_exports);
29
+ var mergeLayer = function(out, layer) {
30
+ for (var key in layer) {
31
+ var value = layer[key];
32
+ if (value === void 0 && key in out) continue;
33
+ out[key] = value;
34
+ }
35
+ };
29
36
  var mergeProps = function(defaultProps, props) {
30
37
  var out = {};
31
- for (var key in defaultProps) {
32
- if (key in props && props[key] !== void 0) continue;
33
- out[key] = defaultProps[key];
34
- }
35
- for (var key1 in props) {
36
- if (props[key1] === void 0 && key1 in defaultProps) continue;
37
- out[key1] = props[key1];
38
- }
38
+ mergeLayer(out, defaultProps);
39
+ mergeLayer(out, props);
39
40
  return out;
40
41
  };
41
42
  var mergeComponentProps = function(defaultProps, contextProps, props) {
@@ -43,29 +44,16 @@ var mergeComponentProps = function(defaultProps, contextProps, props) {
43
44
  if (!defaultProps && !contextProps) {
44
45
  return [props, overriddenContext];
45
46
  }
46
- if (defaultProps && !contextProps) {
47
- return [mergeProps(defaultProps, props), overriddenContext];
48
- }
49
47
  var out = {};
50
- for (var key in defaultProps) {
51
- if (key in props && props[key] !== void 0) continue;
52
- out[key] = defaultProps[key];
53
- }
54
- for (var key1 in contextProps) {
55
- if (key1 in props && props[key1] !== void 0) continue;
56
- var contextValue = contextProps[key1];
57
- if (contextValue !== void 0) {
58
- out[key1] = contextValue;
59
- }
60
- }
61
- for (var key2 in props) {
62
- if (props[key2] === void 0 && (defaultProps && key2 in defaultProps || contextProps && key2 in contextProps)) {
63
- continue;
64
- }
65
- out[key2] = props[key2];
66
- if (contextProps && key2 in contextProps) {
48
+ if (defaultProps) mergeLayer(out, defaultProps);
49
+ if (contextProps) mergeLayer(out, contextProps);
50
+ for (var key in props) {
51
+ var value = props[key];
52
+ if (value === void 0 && key in out) continue;
53
+ out[key] = value;
54
+ if (contextProps && key in contextProps) {
67
55
  overriddenContext || (overriddenContext = {});
68
- overriddenContext[key2] = props[key2];
56
+ overriddenContext[key] = value;
69
57
  }
70
58
  }
71
59
  return [out, overriddenContext];
@@ -1 +1 @@
1
- {"version":3,"file":"mergeProps.native.js","names":[],"sources":["cjs/helpers/mergeProps.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 mergeProps_exports = {};\n__export(mergeProps_exports, {\n mergeComponentProps: () => mergeComponentProps,\n mergeProps: () => mergeProps\n});\nmodule.exports = __toCommonJS(mergeProps_exports);\nvar mergeProps = function(defaultProps, props) {\n var out = {};\n for (var key in defaultProps) {\n if (key in props && props[key] !== void 0) continue;\n out[key] = defaultProps[key];\n }\n for (var key1 in props) {\n if (props[key1] === void 0 && key1 in defaultProps) continue;\n out[key1] = props[key1];\n }\n return out;\n};\nvar mergeComponentProps = function(defaultProps, contextProps, props) {\n var overriddenContext = null;\n if (!defaultProps && !contextProps) {\n return [\n props,\n overriddenContext\n ];\n }\n if (defaultProps && !contextProps) {\n return [\n mergeProps(defaultProps, props),\n overriddenContext\n ];\n }\n var out = {};\n for (var key in defaultProps) {\n if (key in props && props[key] !== void 0) continue;\n out[key] = defaultProps[key];\n }\n for (var key1 in contextProps) {\n if (key1 in props && props[key1] !== void 0) continue;\n var contextValue = contextProps[key1];\n if (contextValue !== void 0) {\n out[key1] = contextValue;\n }\n }\n for (var key2 in props) {\n if (props[key2] === void 0 && (defaultProps && key2 in defaultProps || contextProps && key2 in contextProps)) {\n continue;\n }\n out[key2] = props[key2];\n if (contextProps && key2 in contextProps) {\n overriddenContext || (overriddenContext = {});\n overriddenContext[key2] = props[key2];\n }\n }\n return [\n out,\n overriddenContext\n ];\n};\n//# sourceMappingURL=mergeProps.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,qBAAqB,CAAC;AAC1B,SAAS,oBAAoB;CAC3B,2BAA2B;CAC3B,kBAAkB;AACpB,CAAC;AACD,OAAO,UAAU,aAAa,kBAAkB;AAChD,IAAI,aAAa,SAAS,cAAc,OAAO;CAC7C,IAAI,MAAM,CAAC;CACX,KAAK,IAAI,OAAO,cAAc;EAC5B,IAAI,OAAO,SAAS,MAAM,SAAS,KAAK,GAAG;EAC3C,IAAI,OAAO,aAAa;CAC1B;CACA,KAAK,IAAI,QAAQ,OAAO;EACtB,IAAI,MAAM,UAAU,KAAK,KAAK,QAAQ,cAAc;EACpD,IAAI,QAAQ,MAAM;CACpB;CACA,OAAO;AACT;AACA,IAAI,sBAAsB,SAAS,cAAc,cAAc,OAAO;CACpE,IAAI,oBAAoB;CACxB,IAAI,CAAC,gBAAgB,CAAC,cAAc;EAClC,OAAO,CACL,OACA,iBACF;CACF;CACA,IAAI,gBAAgB,CAAC,cAAc;EACjC,OAAO,CACL,WAAW,cAAc,KAAK,GAC9B,iBACF;CACF;CACA,IAAI,MAAM,CAAC;CACX,KAAK,IAAI,OAAO,cAAc;EAC5B,IAAI,OAAO,SAAS,MAAM,SAAS,KAAK,GAAG;EAC3C,IAAI,OAAO,aAAa;CAC1B;CACA,KAAK,IAAI,QAAQ,cAAc;EAC7B,IAAI,QAAQ,SAAS,MAAM,UAAU,KAAK,GAAG;EAC7C,IAAI,eAAe,aAAa;EAChC,IAAI,iBAAiB,KAAK,GAAG;GAC3B,IAAI,QAAQ;EACd;CACF;CACA,KAAK,IAAI,QAAQ,OAAO;EACtB,IAAI,MAAM,UAAU,KAAK,MAAM,gBAAgB,QAAQ,gBAAgB,gBAAgB,QAAQ,eAAe;GAC5G;EACF;EACA,IAAI,QAAQ,MAAM;EAClB,IAAI,gBAAgB,QAAQ,cAAc;GACxC,sBAAsB,oBAAoB,CAAC;GAC3C,kBAAkB,QAAQ,MAAM;EAClC;CACF;CACA,OAAO,CACL,KACA,iBACF;AACF"}
1
+ {"version":3,"file":"mergeProps.native.js","names":[],"sources":["cjs/helpers/mergeProps.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 mergeProps_exports = {};\n__export(mergeProps_exports, {\n mergeComponentProps: () => mergeComponentProps,\n mergeProps: () => mergeProps\n});\nmodule.exports = __toCommonJS(mergeProps_exports);\nvar mergeLayer = function(out, layer) {\n for (var key in layer) {\n var value = layer[key];\n if (value === void 0 && key in out) continue;\n out[key] = value;\n }\n};\nvar mergeProps = function(defaultProps, props) {\n var out = {};\n mergeLayer(out, defaultProps);\n mergeLayer(out, props);\n return out;\n};\nvar mergeComponentProps = function(defaultProps, contextProps, props) {\n var overriddenContext = null;\n if (!defaultProps && !contextProps) {\n return [\n props,\n overriddenContext\n ];\n }\n var out = {};\n if (defaultProps) mergeLayer(out, defaultProps);\n if (contextProps) mergeLayer(out, contextProps);\n for (var key in props) {\n var value = props[key];\n if (value === void 0 && key in out) continue;\n out[key] = value;\n if (contextProps && key in contextProps) {\n overriddenContext || (overriddenContext = {});\n overriddenContext[key] = value;\n }\n }\n return [\n out,\n overriddenContext\n ];\n};\n//# sourceMappingURL=mergeProps.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,qBAAqB,CAAC;AAC1B,SAAS,oBAAoB;CAC3B,2BAA2B;CAC3B,kBAAkB;AACpB,CAAC;AACD,OAAO,UAAU,aAAa,kBAAkB;AAChD,IAAI,aAAa,SAAS,KAAK,OAAO;CACpC,KAAK,IAAI,OAAO,OAAO;EACrB,IAAI,QAAQ,MAAM;EAClB,IAAI,UAAU,KAAK,KAAK,OAAO,KAAK;EACpC,IAAI,OAAO;CACb;AACF;AACA,IAAI,aAAa,SAAS,cAAc,OAAO;CAC7C,IAAI,MAAM,CAAC;CACX,WAAW,KAAK,YAAY;CAC5B,WAAW,KAAK,KAAK;CACrB,OAAO;AACT;AACA,IAAI,sBAAsB,SAAS,cAAc,cAAc,OAAO;CACpE,IAAI,oBAAoB;CACxB,IAAI,CAAC,gBAAgB,CAAC,cAAc;EAClC,OAAO,CACL,OACA,iBACF;CACF;CACA,IAAI,MAAM,CAAC;CACX,IAAI,cAAc,WAAW,KAAK,YAAY;CAC9C,IAAI,cAAc,WAAW,KAAK,YAAY;CAC9C,KAAK,IAAI,OAAO,OAAO;EACrB,IAAI,QAAQ,MAAM;EAClB,IAAI,UAAU,KAAK,KAAK,OAAO,KAAK;EACpC,IAAI,OAAO;EACX,IAAI,gBAAgB,OAAO,cAAc;GACvC,sBAAsB,oBAAoB,CAAC;GAC3C,kBAAkB,OAAO;EAC3B;CACF;CACA,OAAO,CACL,KACA,iBACF;AACF"}
@@ -1,13 +1,14 @@
1
+ const mergeLayer = (out, layer) => {
2
+ for (const key in layer) {
3
+ const value = layer[key];
4
+ if (value === void 0 && key in out) continue;
5
+ out[key] = value;
6
+ }
7
+ };
1
8
  const mergeProps = (defaultProps, props) => {
2
9
  const out = {};
3
- for (const key in defaultProps) {
4
- if (key in props && props[key] !== void 0) continue;
5
- out[key] = defaultProps[key];
6
- }
7
- for (const key in props) {
8
- if (props[key] === void 0 && key in defaultProps) continue;
9
- out[key] = props[key];
10
- }
10
+ mergeLayer(out, defaultProps);
11
+ mergeLayer(out, props);
11
12
  return out;
12
13
  };
13
14
  const mergeComponentProps = (defaultProps, contextProps, props) => {
@@ -15,29 +16,16 @@ const mergeComponentProps = (defaultProps, contextProps, props) => {
15
16
  if (!defaultProps && !contextProps) {
16
17
  return [props, overriddenContext];
17
18
  }
18
- if (defaultProps && !contextProps) {
19
- return [mergeProps(defaultProps, props), overriddenContext];
20
- }
21
19
  const out = {};
22
- for (const key in defaultProps) {
23
- if (key in props && props[key] !== void 0) continue;
24
- out[key] = defaultProps[key];
25
- }
26
- for (const key in contextProps) {
27
- if (key in props && props[key] !== void 0) continue;
28
- const contextValue = contextProps[key];
29
- if (contextValue !== void 0) {
30
- out[key] = contextValue;
31
- }
32
- }
20
+ if (defaultProps) mergeLayer(out, defaultProps);
21
+ if (contextProps) mergeLayer(out, contextProps);
33
22
  for (const key in props) {
34
- if (props[key] === void 0 && (defaultProps && key in defaultProps || contextProps && key in contextProps)) {
35
- continue;
36
- }
37
- out[key] = props[key];
23
+ const value = props[key];
24
+ if (value === void 0 && key in out) continue;
25
+ out[key] = value;
38
26
  if (contextProps && key in contextProps) {
39
27
  overriddenContext ||= {};
40
- overriddenContext[key] = props[key];
28
+ overriddenContext[key] = value;
41
29
  }
42
30
  }
43
31
  return [out, overriddenContext];
@@ -1 +1 @@
1
- {"version":3,"file":"mergeProps.js","names":[],"sources":["esm/helpers/mergeProps.js"],"sourcesContent":["const mergeProps = (defaultProps, props) => {\n const out = {};\n for (const key in defaultProps) {\n if (key in props && props[key] !== void 0) continue;\n out[key] = defaultProps[key];\n }\n for (const key in props) {\n if (props[key] === void 0 && key in defaultProps) continue;\n out[key] = props[key];\n }\n return out;\n};\nconst mergeComponentProps = (defaultProps, contextProps, props) => {\n let overriddenContext = null;\n if (!defaultProps && !contextProps) {\n return [props, overriddenContext];\n }\n if (defaultProps && !contextProps) {\n return [mergeProps(defaultProps, props), overriddenContext];\n }\n const out = {};\n for (const key in defaultProps) {\n if (key in props && props[key] !== void 0) continue;\n out[key] = defaultProps[key];\n }\n for (const key in contextProps) {\n if (key in props && props[key] !== void 0) continue;\n const contextValue = contextProps[key];\n if (contextValue !== void 0) {\n out[key] = contextValue;\n }\n }\n for (const key in props) {\n if (props[key] === void 0 && (defaultProps && key in defaultProps || contextProps && key in contextProps)) {\n continue;\n }\n out[key] = props[key];\n if (contextProps && key in contextProps) {\n overriddenContext ||= {};\n overriddenContext[key] = props[key];\n }\n }\n return [out, overriddenContext];\n};\nexport {\n mergeComponentProps,\n mergeProps\n};\n//# sourceMappingURL=mergeProps.js.map\n"],"mappings":";AAAA,MAAM,cAAc,cAAc,UAAU;CAC1C,MAAM,MAAM,CAAC;CACb,KAAK,MAAM,OAAO,cAAc;EAC9B,IAAI,OAAO,SAAS,MAAM,SAAS,KAAK,GAAG;EAC3C,IAAI,OAAO,aAAa;CAC1B;CACA,KAAK,MAAM,OAAO,OAAO;EACvB,IAAI,MAAM,SAAS,KAAK,KAAK,OAAO,cAAc;EAClD,IAAI,OAAO,MAAM;CACnB;CACA,OAAO;AACT;AACA,MAAM,uBAAuB,cAAc,cAAc,UAAU;CACjE,IAAI,oBAAoB;CACxB,IAAI,CAAC,gBAAgB,CAAC,cAAc;EAClC,OAAO,CAAC,OAAO,iBAAiB;CAClC;CACA,IAAI,gBAAgB,CAAC,cAAc;EACjC,OAAO,CAAC,WAAW,cAAc,KAAK,GAAG,iBAAiB;CAC5D;CACA,MAAM,MAAM,CAAC;CACb,KAAK,MAAM,OAAO,cAAc;EAC9B,IAAI,OAAO,SAAS,MAAM,SAAS,KAAK,GAAG;EAC3C,IAAI,OAAO,aAAa;CAC1B;CACA,KAAK,MAAM,OAAO,cAAc;EAC9B,IAAI,OAAO,SAAS,MAAM,SAAS,KAAK,GAAG;EAC3C,MAAM,eAAe,aAAa;EAClC,IAAI,iBAAiB,KAAK,GAAG;GAC3B,IAAI,OAAO;EACb;CACF;CACA,KAAK,MAAM,OAAO,OAAO;EACvB,IAAI,MAAM,SAAS,KAAK,MAAM,gBAAgB,OAAO,gBAAgB,gBAAgB,OAAO,eAAe;GACzG;EACF;EACA,IAAI,OAAO,MAAM;EACjB,IAAI,gBAAgB,OAAO,cAAc;GACvC,sBAAsB,CAAC;GACvB,kBAAkB,OAAO,MAAM;EACjC;CACF;CACA,OAAO,CAAC,KAAK,iBAAiB;AAChC"}
1
+ {"version":3,"file":"mergeProps.js","names":[],"sources":["esm/helpers/mergeProps.js"],"sourcesContent":["const mergeLayer = (out, layer) => {\n for (const key in layer) {\n const value = layer[key];\n if (value === void 0 && key in out) continue;\n out[key] = value;\n }\n};\nconst mergeProps = (defaultProps, props) => {\n const out = {};\n mergeLayer(out, defaultProps);\n mergeLayer(out, props);\n return out;\n};\nconst mergeComponentProps = (defaultProps, contextProps, props) => {\n let overriddenContext = null;\n if (!defaultProps && !contextProps) {\n return [props, overriddenContext];\n }\n const out = {};\n if (defaultProps) mergeLayer(out, defaultProps);\n if (contextProps) mergeLayer(out, contextProps);\n for (const key in props) {\n const value = props[key];\n if (value === void 0 && key in out) continue;\n out[key] = value;\n if (contextProps && key in contextProps) {\n overriddenContext ||= {};\n overriddenContext[key] = value;\n }\n }\n return [out, overriddenContext];\n};\nexport {\n mergeComponentProps,\n mergeProps\n};\n//# sourceMappingURL=mergeProps.js.map\n"],"mappings":";AAAA,MAAM,cAAc,KAAK,UAAU;CACjC,KAAK,MAAM,OAAO,OAAO;EACvB,MAAM,QAAQ,MAAM;EACpB,IAAI,UAAU,KAAK,KAAK,OAAO,KAAK;EACpC,IAAI,OAAO;CACb;AACF;AACA,MAAM,cAAc,cAAc,UAAU;CAC1C,MAAM,MAAM,CAAC;CACb,WAAW,KAAK,YAAY;CAC5B,WAAW,KAAK,KAAK;CACrB,OAAO;AACT;AACA,MAAM,uBAAuB,cAAc,cAAc,UAAU;CACjE,IAAI,oBAAoB;CACxB,IAAI,CAAC,gBAAgB,CAAC,cAAc;EAClC,OAAO,CAAC,OAAO,iBAAiB;CAClC;CACA,MAAM,MAAM,CAAC;CACb,IAAI,cAAc,WAAW,KAAK,YAAY;CAC9C,IAAI,cAAc,WAAW,KAAK,YAAY;CAC9C,KAAK,MAAM,OAAO,OAAO;EACvB,MAAM,QAAQ,MAAM;EACpB,IAAI,UAAU,KAAK,KAAK,OAAO,KAAK;EACpC,IAAI,OAAO;EACX,IAAI,gBAAgB,OAAO,cAAc;GACvC,sBAAsB,CAAC;GACvB,kBAAkB,OAAO;EAC3B;CACF;CACA,OAAO,CAAC,KAAK,iBAAiB;AAChC"}
@@ -1,13 +1,14 @@
1
+ var mergeLayer = function(out, layer) {
2
+ for (var key in layer) {
3
+ var value = layer[key];
4
+ if (value === void 0 && key in out) continue;
5
+ out[key] = value;
6
+ }
7
+ };
1
8
  var mergeProps = function(defaultProps, props) {
2
9
  var out = {};
3
- for (var key in defaultProps) {
4
- if (key in props && props[key] !== void 0) continue;
5
- out[key] = defaultProps[key];
6
- }
7
- for (var key1 in props) {
8
- if (props[key1] === void 0 && key1 in defaultProps) continue;
9
- out[key1] = props[key1];
10
- }
10
+ mergeLayer(out, defaultProps);
11
+ mergeLayer(out, props);
11
12
  return out;
12
13
  };
13
14
  var mergeComponentProps = function(defaultProps, contextProps, props) {
@@ -15,29 +16,16 @@ var mergeComponentProps = function(defaultProps, contextProps, props) {
15
16
  if (!defaultProps && !contextProps) {
16
17
  return [props, overriddenContext];
17
18
  }
18
- if (defaultProps && !contextProps) {
19
- return [mergeProps(defaultProps, props), overriddenContext];
20
- }
21
19
  var out = {};
22
- for (var key in defaultProps) {
23
- if (key in props && props[key] !== void 0) continue;
24
- out[key] = defaultProps[key];
25
- }
26
- for (var key1 in contextProps) {
27
- if (key1 in props && props[key1] !== void 0) continue;
28
- var contextValue = contextProps[key1];
29
- if (contextValue !== void 0) {
30
- out[key1] = contextValue;
31
- }
32
- }
33
- for (var key2 in props) {
34
- if (props[key2] === void 0 && (defaultProps && key2 in defaultProps || contextProps && key2 in contextProps)) {
35
- continue;
36
- }
37
- out[key2] = props[key2];
38
- if (contextProps && key2 in contextProps) {
20
+ if (defaultProps) mergeLayer(out, defaultProps);
21
+ if (contextProps) mergeLayer(out, contextProps);
22
+ for (var key in props) {
23
+ var value = props[key];
24
+ if (value === void 0 && key in out) continue;
25
+ out[key] = value;
26
+ if (contextProps && key in contextProps) {
39
27
  overriddenContext || (overriddenContext = {});
40
- overriddenContext[key2] = props[key2];
28
+ overriddenContext[key] = value;
41
29
  }
42
30
  }
43
31
  return [out, overriddenContext];
@@ -1 +1 @@
1
- {"version":3,"file":"mergeProps.native.js","names":[],"sources":["esm/helpers/mergeProps.native.js"],"sourcesContent":["var mergeProps = function(defaultProps, props) {\n var out = {};\n for (var key in defaultProps) {\n if (key in props && props[key] !== void 0) continue;\n out[key] = defaultProps[key];\n }\n for (var key1 in props) {\n if (props[key1] === void 0 && key1 in defaultProps) continue;\n out[key1] = props[key1];\n }\n return out;\n};\nvar mergeComponentProps = function(defaultProps, contextProps, props) {\n var overriddenContext = null;\n if (!defaultProps && !contextProps) {\n return [\n props,\n overriddenContext\n ];\n }\n if (defaultProps && !contextProps) {\n return [\n mergeProps(defaultProps, props),\n overriddenContext\n ];\n }\n var out = {};\n for (var key in defaultProps) {\n if (key in props && props[key] !== void 0) continue;\n out[key] = defaultProps[key];\n }\n for (var key1 in contextProps) {\n if (key1 in props && props[key1] !== void 0) continue;\n var contextValue = contextProps[key1];\n if (contextValue !== void 0) {\n out[key1] = contextValue;\n }\n }\n for (var key2 in props) {\n if (props[key2] === void 0 && (defaultProps && key2 in defaultProps || contextProps && key2 in contextProps)) {\n continue;\n }\n out[key2] = props[key2];\n if (contextProps && key2 in contextProps) {\n overriddenContext || (overriddenContext = {});\n overriddenContext[key2] = props[key2];\n }\n }\n return [\n out,\n overriddenContext\n ];\n};\nexport {\n mergeComponentProps,\n mergeProps\n};\n//# sourceMappingURL=mergeProps.js.map\n"],"mappings":";AAAA,IAAI,aAAa,SAAS,cAAc,OAAO;CAC7C,IAAI,MAAM,CAAC;CACX,KAAK,IAAI,OAAO,cAAc;EAC5B,IAAI,OAAO,SAAS,MAAM,SAAS,KAAK,GAAG;EAC3C,IAAI,OAAO,aAAa;CAC1B;CACA,KAAK,IAAI,QAAQ,OAAO;EACtB,IAAI,MAAM,UAAU,KAAK,KAAK,QAAQ,cAAc;EACpD,IAAI,QAAQ,MAAM;CACpB;CACA,OAAO;AACT;AACA,IAAI,sBAAsB,SAAS,cAAc,cAAc,OAAO;CACpE,IAAI,oBAAoB;CACxB,IAAI,CAAC,gBAAgB,CAAC,cAAc;EAClC,OAAO,CACL,OACA,iBACF;CACF;CACA,IAAI,gBAAgB,CAAC,cAAc;EACjC,OAAO,CACL,WAAW,cAAc,KAAK,GAC9B,iBACF;CACF;CACA,IAAI,MAAM,CAAC;CACX,KAAK,IAAI,OAAO,cAAc;EAC5B,IAAI,OAAO,SAAS,MAAM,SAAS,KAAK,GAAG;EAC3C,IAAI,OAAO,aAAa;CAC1B;CACA,KAAK,IAAI,QAAQ,cAAc;EAC7B,IAAI,QAAQ,SAAS,MAAM,UAAU,KAAK,GAAG;EAC7C,IAAI,eAAe,aAAa;EAChC,IAAI,iBAAiB,KAAK,GAAG;GAC3B,IAAI,QAAQ;EACd;CACF;CACA,KAAK,IAAI,QAAQ,OAAO;EACtB,IAAI,MAAM,UAAU,KAAK,MAAM,gBAAgB,QAAQ,gBAAgB,gBAAgB,QAAQ,eAAe;GAC5G;EACF;EACA,IAAI,QAAQ,MAAM;EAClB,IAAI,gBAAgB,QAAQ,cAAc;GACxC,sBAAsB,oBAAoB,CAAC;GAC3C,kBAAkB,QAAQ,MAAM;EAClC;CACF;CACA,OAAO,CACL,KACA,iBACF;AACF"}
1
+ {"version":3,"file":"mergeProps.native.js","names":[],"sources":["esm/helpers/mergeProps.native.js"],"sourcesContent":["var mergeLayer = function(out, layer) {\n for (var key in layer) {\n var value = layer[key];\n if (value === void 0 && key in out) continue;\n out[key] = value;\n }\n};\nvar mergeProps = function(defaultProps, props) {\n var out = {};\n mergeLayer(out, defaultProps);\n mergeLayer(out, props);\n return out;\n};\nvar mergeComponentProps = function(defaultProps, contextProps, props) {\n var overriddenContext = null;\n if (!defaultProps && !contextProps) {\n return [\n props,\n overriddenContext\n ];\n }\n var out = {};\n if (defaultProps) mergeLayer(out, defaultProps);\n if (contextProps) mergeLayer(out, contextProps);\n for (var key in props) {\n var value = props[key];\n if (value === void 0 && key in out) continue;\n out[key] = value;\n if (contextProps && key in contextProps) {\n overriddenContext || (overriddenContext = {});\n overriddenContext[key] = value;\n }\n }\n return [\n out,\n overriddenContext\n ];\n};\nexport {\n mergeComponentProps,\n mergeProps\n};\n//# sourceMappingURL=mergeProps.js.map\n"],"mappings":";AAAA,IAAI,aAAa,SAAS,KAAK,OAAO;CACpC,KAAK,IAAI,OAAO,OAAO;EACrB,IAAI,QAAQ,MAAM;EAClB,IAAI,UAAU,KAAK,KAAK,OAAO,KAAK;EACpC,IAAI,OAAO;CACb;AACF;AACA,IAAI,aAAa,SAAS,cAAc,OAAO;CAC7C,IAAI,MAAM,CAAC;CACX,WAAW,KAAK,YAAY;CAC5B,WAAW,KAAK,KAAK;CACrB,OAAO;AACT;AACA,IAAI,sBAAsB,SAAS,cAAc,cAAc,OAAO;CACpE,IAAI,oBAAoB;CACxB,IAAI,CAAC,gBAAgB,CAAC,cAAc;EAClC,OAAO,CACL,OACA,iBACF;CACF;CACA,IAAI,MAAM,CAAC;CACX,IAAI,cAAc,WAAW,KAAK,YAAY;CAC9C,IAAI,cAAc,WAAW,KAAK,YAAY;CAC9C,KAAK,IAAI,OAAO,OAAO;EACrB,IAAI,QAAQ,MAAM;EAClB,IAAI,UAAU,KAAK,KAAK,OAAO,KAAK;EACpC,IAAI,OAAO;EACX,IAAI,gBAAgB,OAAO,cAAc;GACvC,sBAAsB,oBAAoB,CAAC;GAC3C,kBAAkB,OAAO;EAC3B;CACF;CACA,OAAO,CACL,KACA,iBACF;AACF"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tamagui/web",
3
- "version": "3.0.0-beta.1341.1",
3
+ "version": "3.0.0-beta.1348.1",
4
4
  "license": "MIT",
5
5
  "author": {
6
6
  "name": "Nate Wienert"
@@ -100,23 +100,23 @@
100
100
  "test:web": "vitest --typecheck --run"
101
101
  },
102
102
  "dependencies": {
103
- "@tamagui/animation-helpers": "3.0.0-beta.1341.1",
104
- "@tamagui/compose-refs": "3.0.0-beta.1341.1",
105
- "@tamagui/constants": "3.0.0-beta.1341.1",
106
- "@tamagui/dom": "3.0.0-beta.1341.1",
107
- "@tamagui/helpers": "3.0.0-beta.1341.1",
108
- "@tamagui/is-equal-shallow": "3.0.0-beta.1341.1",
109
- "@tamagui/native": "3.0.0-beta.1341.1",
110
- "@tamagui/normalize-css-color": "3.0.0-beta.1341.1",
111
- "@tamagui/react-native-types": "3.0.0-beta.1341.1",
112
- "@tamagui/style-grammar": "3.0.0-beta.1341.1",
113
- "@tamagui/types": "3.0.0-beta.1341.1",
114
- "@tamagui/use-did-finish-ssr": "3.0.0-beta.1341.1",
115
- "@tamagui/use-event": "3.0.0-beta.1341.1",
116
- "@tamagui/use-force-update": "3.0.0-beta.1341.1"
103
+ "@tamagui/animation-helpers": "3.0.0-beta.1348.1",
104
+ "@tamagui/compose-refs": "3.0.0-beta.1348.1",
105
+ "@tamagui/constants": "3.0.0-beta.1348.1",
106
+ "@tamagui/dom": "3.0.0-beta.1348.1",
107
+ "@tamagui/helpers": "3.0.0-beta.1348.1",
108
+ "@tamagui/is-equal-shallow": "3.0.0-beta.1348.1",
109
+ "@tamagui/native": "3.0.0-beta.1348.1",
110
+ "@tamagui/normalize-css-color": "3.0.0-beta.1348.1",
111
+ "@tamagui/react-native-types": "3.0.0-beta.1348.1",
112
+ "@tamagui/style-grammar": "3.0.0-beta.1348.1",
113
+ "@tamagui/types": "3.0.0-beta.1348.1",
114
+ "@tamagui/use-did-finish-ssr": "3.0.0-beta.1348.1",
115
+ "@tamagui/use-event": "3.0.0-beta.1348.1",
116
+ "@tamagui/use-force-update": "3.0.0-beta.1348.1"
117
117
  },
118
118
  "devDependencies": {
119
- "@tamagui/build": "3.0.0-beta.1341.1",
119
+ "@tamagui/build": "3.0.0-beta.1348.1",
120
120
  "@testing-library/react": "^16.1.0",
121
121
  "csstype": "^3.0.10",
122
122
  "react": "19.2.3",
@@ -1,53 +1,31 @@
1
- /**
2
- * Preserves prop ordering, so that the order most closely matches the last spread objects
3
- * Useful for having { ...defaultProps, ...props } that ensure props ordering is always kept
4
- *
5
- * Honestly this is somehwat backwards logically from Object.assign, reason was that we typically
6
- * are merging defaultProps, givenProps, but we started using it elsewhere and now its a bit confusing
7
- * Should look into refactoring this to match common usage
8
- *
9
- * Given:
10
- * mergeProps({ a: 1, b: 2 }, { b: 1, a: 2 })
11
- * The final key order will be:
12
- * b, a
13
- *
14
- */
15
-
16
1
  export type GenericProps = Record<string, any>
17
2
 
18
- export const mergeProps = (defaultProps: object, props: object) => {
19
- const out: GenericProps = {}
20
-
21
- // in general objects keys are sorted by order of insertion
22
- // we merge "defaultProps" first as they should come first
23
- // (so Object.keys(finalProps) will list [...defaultPropKeys] first)
24
- // but we ignore any keys from props, and merge it after, that way
25
- // final order is [...defaultPropKeys, ...propKeys]
26
-
27
- // an explicit undefined is absent (React defaultProps semantics): a default
28
- // stands instead of being clobbered by it
29
-
30
- // ⚠️ keep in sync with mergeComponentProps logic
31
-
32
- for (const key in defaultProps) {
33
- if (key in props && props[key] !== undefined) continue
34
- out[key] = defaultProps[key]
35
- }
36
-
37
- for (const key in props) {
38
- if (props[key] === undefined && key in defaultProps) continue
39
- out[key] = props[key]
3
+ // layers merge in order (defaults, styled context, the caller's props), so key
4
+ // order in the result follows that order. one rule for every layer: an
5
+ // undefined value never replaces what a lower layer set (React defaultProps
6
+ // semantics); it lands only when nothing set the key, which keeps `key in
7
+ // props` true for a caller who passed the key.
8
+ const mergeLayer = (out: GenericProps, layer: object) => {
9
+ for (const key in layer) {
10
+ const value = layer[key]
11
+ if (value === undefined && key in out) continue
12
+ out[key] = value
40
13
  }
14
+ }
41
15
 
16
+ export const mergeProps = (defaultProps: object, props: object) => {
17
+ const out: GenericProps = {}
18
+ mergeLayer(out, defaultProps)
19
+ mergeLayer(out, props)
42
20
  return out
43
21
  }
44
22
 
45
- // merge props but also handles defaultProps + styledContext
23
+ // same merge with a styled-context layer between defaults and props. also
24
+ // reports which context keys the caller's props overrode, in prop order, so
25
+ // the component can stop publishing those to its own descendants.
46
26
  export const mergeComponentProps = (
47
- // this is "a" in mergeProps
48
27
  defaultProps: object | null | undefined,
49
- contextProps: object | undefined,
50
- // this is "b" in mergeProps
28
+ contextProps: object | null | undefined,
51
29
  props: object
52
30
  ) => {
53
31
  let overriddenContext: GenericProps | null = null
@@ -56,46 +34,17 @@ export const mergeComponentProps = (
56
34
  return [props, overriddenContext] as const
57
35
  }
58
36
 
59
- if (defaultProps && !contextProps) {
60
- return [mergeProps(defaultProps, props), overriddenContext] as const
61
- }
62
-
63
- // the only unique case is contextProps, we need to track overrides and do something a bit tricky
64
- // since we respect prop order for styles, we want to preserve the object key order in overriddenContext
65
-
66
37
  const out: GenericProps = {}
67
-
68
- // ⚠️ keep in sync with mergeProps logic
69
- // same logic as mergeProps but tracking overrides!
70
-
71
- for (const key in defaultProps) {
72
- if (key in props && props[key] !== undefined) continue
73
- out[key] = defaultProps[key]
74
- }
75
-
76
- // styled context props go after defaultProps but before props
77
- for (const key in contextProps) {
78
- if (key in props && props[key] !== undefined) continue
79
- const contextValue = contextProps[key]
80
- // don't merge undefined context values to preserve inheritance
81
- if (contextValue !== undefined) {
82
- out[key] = contextValue
83
- }
84
- }
38
+ if (defaultProps) mergeLayer(out, defaultProps)
39
+ if (contextProps) mergeLayer(out, contextProps)
85
40
 
86
41
  for (const key in props) {
87
- // an explicit undefined is absent (React defaultProps semantics): a default
88
- // or context value already placed above stands instead of being clobbered
89
- if (
90
- props[key] === undefined &&
91
- ((defaultProps && key in defaultProps) || (contextProps && key in contextProps))
92
- ) {
93
- continue
94
- }
95
- out[key] = props[key]
42
+ const value = props[key]
43
+ if (value === undefined && key in out) continue
44
+ out[key] = value
96
45
  if (contextProps && key in contextProps) {
97
46
  overriddenContext ||= {}
98
- overriddenContext[key] = props[key]
47
+ overriddenContext[key] = value
99
48
  }
100
49
  }
101
50
 
@@ -1,18 +1,4 @@
1
- /**
2
- * Preserves prop ordering, so that the order most closely matches the last spread objects
3
- * Useful for having { ...defaultProps, ...props } that ensure props ordering is always kept
4
- *
5
- * Honestly this is somehwat backwards logically from Object.assign, reason was that we typically
6
- * are merging defaultProps, givenProps, but we started using it elsewhere and now its a bit confusing
7
- * Should look into refactoring this to match common usage
8
- *
9
- * Given:
10
- * mergeProps({ a: 1, b: 2 }, { b: 1, a: 2 })
11
- * The final key order will be:
12
- * b, a
13
- *
14
- */
15
1
  export type GenericProps = Record<string, any>;
16
2
  export declare const mergeProps: (defaultProps: object, props: object) => GenericProps;
17
- export declare const mergeComponentProps: (defaultProps: object | null | undefined, contextProps: object | undefined, props: object) => readonly [object, null] | readonly [GenericProps, GenericProps | null];
3
+ export declare const mergeComponentProps: (defaultProps: object | null | undefined, contextProps: object | null | undefined, props: object) => readonly [object, null] | readonly [GenericProps, GenericProps | null];
18
4
  //# sourceMappingURL=mergeProps.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"mergeProps.d.ts","sourceRoot":"","sources":["../../src/helpers/mergeProps.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,MAAM,MAAM,YAAY,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAA;AAE9C,eAAO,MAAM,UAAU,iBAAkB,MAAM,SAAS,MAAM,iBAyB7D,CAAA;AAGD,eAAO,MAAM,mBAAmB,iBAEhB,MAAM,GAAG,IAAI,GAAG,SAAS,gBACzB,MAAM,GAAG,SAAS,SAEzB,MAAM,2EAoDd,CAAA"}
1
+ {"version":3,"file":"mergeProps.d.ts","sourceRoot":"","sources":["../../src/helpers/mergeProps.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,YAAY,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAA;AAe9C,eAAO,MAAM,UAAU,iBAAkB,MAAM,SAAS,MAAM,iBAK7D,CAAA;AAKD,eAAO,MAAM,mBAAmB,iBAChB,MAAM,GAAG,IAAI,GAAG,SAAS,gBACzB,MAAM,GAAG,IAAI,GAAG,SAAS,SAChC,MAAM,2EAuBd,CAAA"}