@tamagui/web 3.0.0-beta.1342.1 → 3.0.0-beta.1349.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/helpers/mergeProps.cjs +15 -27
- package/dist/cjs/helpers/mergeProps.native.cjs +17 -29
- package/dist/cjs/helpers/mergeProps.native.js +17 -29
- package/dist/cjs/helpers/mergeProps.native.js.map +1 -1
- package/dist/esm/helpers/mergeProps.mjs +15 -27
- package/dist/esm/helpers/mergeProps.mjs.map +1 -1
- package/dist/esm/helpers/mergeProps.native.js +17 -29
- package/dist/esm/helpers/mergeProps.native.js.map +1 -1
- package/package.json +16 -16
- package/src/helpers/mergeProps.ts +25 -76
- package/types/helpers/mergeProps.d.ts +1 -15
- package/types/helpers/mergeProps.d.ts.map +1 -1
|
@@ -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
|
-
|
|
30
|
-
|
|
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
|
-
|
|
49
|
-
|
|
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
|
-
|
|
61
|
-
|
|
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] =
|
|
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
|
-
|
|
32
|
-
|
|
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
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
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[
|
|
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
|
-
|
|
32
|
-
|
|
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
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
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[
|
|
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
|
|
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
|
-
|
|
4
|
-
|
|
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
|
-
|
|
23
|
-
|
|
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
|
-
|
|
35
|
-
|
|
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] =
|
|
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
|
|
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
|
-
|
|
4
|
-
|
|
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
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
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[
|
|
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
|
|
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.
|
|
3
|
+
"version": "3.0.0-beta.1349.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.
|
|
104
|
-
"@tamagui/compose-refs": "3.0.0-beta.
|
|
105
|
-
"@tamagui/constants": "3.0.0-beta.
|
|
106
|
-
"@tamagui/dom": "3.0.0-beta.
|
|
107
|
-
"@tamagui/helpers": "3.0.0-beta.
|
|
108
|
-
"@tamagui/is-equal-shallow": "3.0.0-beta.
|
|
109
|
-
"@tamagui/native": "3.0.0-beta.
|
|
110
|
-
"@tamagui/normalize-css-color": "3.0.0-beta.
|
|
111
|
-
"@tamagui/react-native-types": "3.0.0-beta.
|
|
112
|
-
"@tamagui/style-grammar": "3.0.0-beta.
|
|
113
|
-
"@tamagui/types": "3.0.0-beta.
|
|
114
|
-
"@tamagui/use-did-finish-ssr": "3.0.0-beta.
|
|
115
|
-
"@tamagui/use-event": "3.0.0-beta.
|
|
116
|
-
"@tamagui/use-force-update": "3.0.0-beta.
|
|
103
|
+
"@tamagui/animation-helpers": "3.0.0-beta.1349.1",
|
|
104
|
+
"@tamagui/compose-refs": "3.0.0-beta.1349.1",
|
|
105
|
+
"@tamagui/constants": "3.0.0-beta.1349.1",
|
|
106
|
+
"@tamagui/dom": "3.0.0-beta.1349.1",
|
|
107
|
+
"@tamagui/helpers": "3.0.0-beta.1349.1",
|
|
108
|
+
"@tamagui/is-equal-shallow": "3.0.0-beta.1349.1",
|
|
109
|
+
"@tamagui/native": "3.0.0-beta.1349.1",
|
|
110
|
+
"@tamagui/normalize-css-color": "3.0.0-beta.1349.1",
|
|
111
|
+
"@tamagui/react-native-types": "3.0.0-beta.1349.1",
|
|
112
|
+
"@tamagui/style-grammar": "3.0.0-beta.1349.1",
|
|
113
|
+
"@tamagui/types": "3.0.0-beta.1349.1",
|
|
114
|
+
"@tamagui/use-did-finish-ssr": "3.0.0-beta.1349.1",
|
|
115
|
+
"@tamagui/use-event": "3.0.0-beta.1349.1",
|
|
116
|
+
"@tamagui/use-force-update": "3.0.0-beta.1349.1"
|
|
117
117
|
},
|
|
118
118
|
"devDependencies": {
|
|
119
|
-
"@tamagui/build": "3.0.0-beta.
|
|
119
|
+
"@tamagui/build": "3.0.0-beta.1349.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
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
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
|
|
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
|
-
|
|
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
|
-
|
|
88
|
-
|
|
89
|
-
|
|
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] =
|
|
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
|
|
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"}
|