@tamagui/helpers 2.6.0 → 2.6.2
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/withStaticProperties.cjs +11 -3
- package/dist/cjs/withStaticProperties.native.js +11 -3
- package/dist/cjs/withStaticProperties.native.js.map +1 -1
- package/dist/esm/withStaticProperties.mjs +11 -3
- package/dist/esm/withStaticProperties.mjs.map +1 -1
- package/dist/esm/withStaticProperties.native.js +11 -3
- package/dist/esm/withStaticProperties.native.js.map +1 -1
- package/package.json +4 -4
- package/src/withStaticProperties.tsx +17 -4
- package/types/withStaticProperties.d.ts.map +1 -1
|
@@ -27,7 +27,15 @@ __export(withStaticProperties_exports, {
|
|
|
27
27
|
module.exports = __toCommonJS(withStaticProperties_exports);
|
|
28
28
|
const Decorated = /* @__PURE__ */Symbol();
|
|
29
29
|
const withStaticProperties = (component, staticProps) => {
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
30
|
+
const out = (() => {
|
|
31
|
+
if (component[Decorated]) {
|
|
32
|
+
return typeof component === "function" ? Object.assign(component.bind(null), component) : {
|
|
33
|
+
...component
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
return component;
|
|
37
|
+
})();
|
|
38
|
+
Object.assign(out, staticProps);
|
|
39
|
+
out[Decorated] = true;
|
|
40
|
+
return out;
|
|
33
41
|
};
|
|
@@ -29,8 +29,16 @@ __export(withStaticProperties_exports, {
|
|
|
29
29
|
module.exports = __toCommonJS(withStaticProperties_exports);
|
|
30
30
|
var Decorated = /* @__PURE__ */Symbol();
|
|
31
31
|
var withStaticProperties = function (component, staticProps) {
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
32
|
+
var out = function () {
|
|
33
|
+
if (component[Decorated]) {
|
|
34
|
+
return typeof component === "function" ? Object.assign(component.bind(null), component) : {
|
|
35
|
+
...component
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
return component;
|
|
39
|
+
}();
|
|
40
|
+
Object.assign(out, staticProps);
|
|
41
|
+
out[Decorated] = true;
|
|
42
|
+
return out;
|
|
35
43
|
};
|
|
36
44
|
//# sourceMappingURL=withStaticProperties.native.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["__toCommonJS","mod","__copyProps","__defProp","value","withStaticProperties_exports","__export","withStaticProperties","module","exports","Decorated","Symbol","component","staticProps","Object","assign"],"sources":["../../src/withStaticProperties.tsx"],"sourcesContent":[null],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,YAAA,GAAAC,GAAA,IAAAC,WAAA,CAAAC,SAAA;EAAAC,KAAA;AAAA,IAAAH,GAAA;AAAA,IAAAI,4BAAA;AAAAC,QAAA,CAAAD,4BAAA;EAAAE,oBAAA,EAAAA,CAAA,KAAAA;AAAA;AAAAC,MAAM,CAAAC,OAAA,GAAAT,YAAY,CAAAK,4BAAO;AAIlB,IAAAK,SAAM,kBACXC,MAAA;
|
|
1
|
+
{"version":3,"names":["__toCommonJS","mod","__copyProps","__defProp","value","withStaticProperties_exports","__export","withStaticProperties","module","exports","Decorated","Symbol","component","staticProps","out","Object","assign","bind"],"sources":["../../src/withStaticProperties.tsx"],"sourcesContent":[null],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,YAAA,GAAAC,GAAA,IAAAC,WAAA,CAAAC,SAAA;EAAAC,KAAA;AAAA,IAAAH,GAAA;AAAA,IAAAI,4BAAA;AAAAC,QAAA,CAAAD,4BAAA;EAAAE,oBAAA,EAAAA,CAAA,KAAAA;AAAA;AAAAC,MAAM,CAAAC,OAAA,GAAAT,YAAY,CAAAK,4BAAO;AAIlB,IAAAK,SAAM,kBACXC,MAAA;AAGA,IAAAJ,oBAAmB,YAAAA,CAAAK,SAAA,EAAAC,WAAA;EACjB,IAAAC,GAAK,eAAkB;IAMrB,IAAAF,SAAO,CAAAF,SAAO;MAGhB,cAAAE,SAAA,kBAAAG,MAAA,CAAAC,MAAA,CAAAJ,SAAA,CAAAK,IAAA,QAAAL,SAAA;QACA,GAAOA;MACN;IAEH;IACA,OAAIA,SAAa;EAEjB;EACFG,MAAA,CAAAC,MAAA,CAAAF,GAAA,EAAAD,WAAA","ignoreList":[]}
|
|
@@ -1,8 +1,16 @@
|
|
|
1
1
|
const Decorated = /* @__PURE__ */Symbol();
|
|
2
2
|
const withStaticProperties = (component, staticProps) => {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
const out = (() => {
|
|
4
|
+
if (component[Decorated]) {
|
|
5
|
+
return typeof component === "function" ? Object.assign(component.bind(null), component) : {
|
|
6
|
+
...component
|
|
7
|
+
};
|
|
8
|
+
}
|
|
9
|
+
return component;
|
|
10
|
+
})();
|
|
11
|
+
Object.assign(out, staticProps);
|
|
12
|
+
out[Decorated] = true;
|
|
13
|
+
return out;
|
|
6
14
|
};
|
|
7
15
|
export { withStaticProperties };
|
|
8
16
|
//# sourceMappingURL=withStaticProperties.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["Decorated","Symbol","withStaticProperties","component","staticProps","Object","assign"],"sources":["../../src/withStaticProperties.tsx"],"sourcesContent":[null],"mappings":"AAAA,MAAMA,SAAA,GAAY,eAAAC,MAAA,CAAO;AAIlB,MAAMC,oBAAA,GAAuBA,CAClCC,SAAA,EACAC,WAAA,KACmB;
|
|
1
|
+
{"version":3,"names":["Decorated","Symbol","withStaticProperties","component","staticProps","out","Object","assign","bind"],"sources":["../../src/withStaticProperties.tsx"],"sourcesContent":[null],"mappings":"AAAA,MAAMA,SAAA,GAAY,eAAAC,MAAA,CAAO;AAIlB,MAAMC,oBAAA,GAAuBA,CAClCC,SAAA,EACAC,WAAA,KACmB;EACnB,MAAMC,GAAA,IAAO,MAAM;IACjB,IAAKF,SAAA,CAAkBH,SAAS,GAAG;MAMjC,OAAO,OAAOG,SAAA,KAAc,aACxBG,MAAA,CAAOC,MAAA,CAAOJ,SAAA,CAAUK,IAAA,CAAK,IAAI,GAAGL,SAAS,IAC7C;QAAE,GAAIA;MAAkB;IAC9B;IACA,OAAOA,SAAA;EACT,GAAG;EAEHG,MAAA,CAAOC,MAAA,CAAOF,GAAA,EAAKD,WAAW;EAC9BC,GAAA,CAAIL,SAAS,IAAI;EAEjB,OAAOK,GAAA;AACT","ignoreList":[]}
|
|
@@ -1,8 +1,16 @@
|
|
|
1
1
|
var Decorated = /* @__PURE__ */Symbol();
|
|
2
2
|
var withStaticProperties = function (component, staticProps) {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
var out = function () {
|
|
4
|
+
if (component[Decorated]) {
|
|
5
|
+
return typeof component === "function" ? Object.assign(component.bind(null), component) : {
|
|
6
|
+
...component
|
|
7
|
+
};
|
|
8
|
+
}
|
|
9
|
+
return component;
|
|
10
|
+
}();
|
|
11
|
+
Object.assign(out, staticProps);
|
|
12
|
+
out[Decorated] = true;
|
|
13
|
+
return out;
|
|
6
14
|
};
|
|
7
15
|
export { withStaticProperties };
|
|
8
16
|
//# sourceMappingURL=withStaticProperties.native.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["Decorated","Symbol","withStaticProperties","component","staticProps","Object","assign"],"sources":["../../src/withStaticProperties.tsx"],"sourcesContent":[null],"mappings":"AAAA,IAAAA,SAAM,kBAAYC,MAAA;AAIX,IAAAC,oBAAM,YAAAA,CACXC,SACA,EAAAC,WACmB;
|
|
1
|
+
{"version":3,"names":["Decorated","Symbol","withStaticProperties","component","staticProps","out","Object","assign","bind"],"sources":["../../src/withStaticProperties.tsx"],"sourcesContent":[null],"mappings":"AAAA,IAAAA,SAAM,kBAAYC,MAAA;AAIX,IAAAC,oBAAM,YAAAA,CACXC,SACA,EAAAC,WACmB;EACnB,IAAAC,GAAM,eAAa;IACjB,IAAKF,SAAA,CAAkBH,SAAS,GAAG;MAMjC,OAAO,OAAOG,SAAA,KAAc,aACxBG,MAAA,CAAOC,MAAA,CAAOJ,SAAA,CAAUK,IAAA,CAAK,IAAI,GAAGL,SAAS,IAC7C;QACN,GAAAA;MACA;IACF;IAEA,OAAOA,SAAO;EACd,GAAI;EAEJG,MAAA,CAAOC,MAAA,CAAAF,GAAA,EAAAD,WAAA;EACTC,GAAA,CAAAL,SAAA","ignoreList":[]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tamagui/helpers",
|
|
3
|
-
"version": "2.6.
|
|
3
|
+
"version": "2.6.2",
|
|
4
4
|
"gitHead": "a49cc7ea6b93ba384e77a4880ae48ac4a5635c14",
|
|
5
5
|
"source": "src/index.ts",
|
|
6
6
|
"files": [
|
|
@@ -35,11 +35,11 @@
|
|
|
35
35
|
"clean:build": "tamagui-build clean:build"
|
|
36
36
|
},
|
|
37
37
|
"dependencies": {
|
|
38
|
-
"@tamagui/constants": "2.6.
|
|
39
|
-
"@tamagui/simple-hash": "2.6.
|
|
38
|
+
"@tamagui/constants": "2.6.2",
|
|
39
|
+
"@tamagui/simple-hash": "2.6.2"
|
|
40
40
|
},
|
|
41
41
|
"devDependencies": {
|
|
42
|
-
"@tamagui/build": "2.6.
|
|
42
|
+
"@tamagui/build": "2.6.2",
|
|
43
43
|
"react": ">=19"
|
|
44
44
|
},
|
|
45
45
|
"peerDependencies": {
|
|
@@ -6,9 +6,22 @@ export const withStaticProperties = <A extends Function, B extends Record<string
|
|
|
6
6
|
component: A,
|
|
7
7
|
staticProps: B
|
|
8
8
|
): Combined<A, B> => {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
9
|
+
const out = (() => {
|
|
10
|
+
if ((component as any)[Decorated]) {
|
|
11
|
+
// never mutate an already-decorated component: assigning onto a shared
|
|
12
|
+
// compound component (e.g. withStaticProperties(Tooltip, { Content }))
|
|
13
|
+
// would replace its sub-components globally, remounting every currently
|
|
14
|
+
// open instance the next time it renders (tamagui.dev promo tooltip
|
|
15
|
+
// jumped mid-hover when a lazy-loaded bento chunk did exactly this)
|
|
16
|
+
return typeof component === 'function'
|
|
17
|
+
? Object.assign(component.bind(null), component)
|
|
18
|
+
: { ...(component as any) }
|
|
19
|
+
}
|
|
20
|
+
return component
|
|
21
|
+
})() as any
|
|
12
22
|
|
|
13
|
-
|
|
23
|
+
Object.assign(out, staticProps)
|
|
24
|
+
out[Decorated] = true
|
|
25
|
+
|
|
26
|
+
return out as any
|
|
14
27
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"withStaticProperties.d.ts","sourceRoot":"","sources":["../src/withStaticProperties.tsx"],"names":[],"mappings":"AAEA,KAAK,QAAQ,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,GAAG,CAAC,CAAA;AAE3B,eAAO,MAAM,oBAAoB,GAAI,CAAC,SAAS,QAAQ,EAAE,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EACpF,WAAW,CAAC,EACZ,aAAa,CAAC,KACb,QAAQ,CAAC,CAAC,EAAE,CAAC,
|
|
1
|
+
{"version":3,"file":"withStaticProperties.d.ts","sourceRoot":"","sources":["../src/withStaticProperties.tsx"],"names":[],"mappings":"AAEA,KAAK,QAAQ,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,GAAG,CAAC,CAAA;AAE3B,eAAO,MAAM,oBAAoB,GAAI,CAAC,SAAS,QAAQ,EAAE,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EACpF,WAAW,CAAC,EACZ,aAAa,CAAC,KACb,QAAQ,CAAC,CAAC,EAAE,CAAC,CAmBf,CAAA"}
|