@tamagui/helpers 2.6.1 → 2.6.3

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.
@@ -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
- Object.assign(component, staticProps);
31
- component[Decorated] = true;
32
- return component;
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
- Object.assign(component, staticProps);
33
- component[Decorated] = true;
34
- return component;
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;AAIA,IAAAJ,oBAAc,GAAW,SAAAA,CAAAK,SAAW,EAAAC,WAAA;EACpCC,MAAA,CAAAC,MAAU,CAAAH,SAAa,EAAAC,WAAA;EAEvBD,SAAO,CAAAF,SAAA;EACT,OAAAE,SAAA","ignoreList":[]}
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
- Object.assign(component, staticProps);
4
- component[Decorated] = true;
5
- return component;
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;EAEnBC,MAAA,CAAOC,MAAA,CAAOH,SAAA,EAAWC,WAAW;EACpCD,SAAA,CAAUH,SAAS,IAAI;EAEvB,OAAOG,SAAA;AACT","ignoreList":[]}
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
- Object.assign(component, staticProps);
4
- component[Decorated] = true;
5
- return component;
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;EAEnBC,MAAA,CAAOC,MAAA,CAAOH,SAAA,EAAWC,WAAW;EACpCD,SAAA,CAAUH,SAAS,IAAI;EAEvB,OAAOG,SAAA;AACT","ignoreList":[]}
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.1",
3
+ "version": "2.6.3",
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.1",
39
- "@tamagui/simple-hash": "2.6.1"
38
+ "@tamagui/constants": "2.6.3",
39
+ "@tamagui/simple-hash": "2.6.3"
40
40
  },
41
41
  "devDependencies": {
42
- "@tamagui/build": "2.6.1",
42
+ "@tamagui/build": "2.6.3",
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
- // add static properties
10
- Object.assign(component, staticProps)
11
- component[Decorated] = true
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
- return component as any
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,CAMf,CAAA"}
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"}