@tamagui/z-index-stack 2.0.0-rc.4 → 2.0.0-rc.40

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.
Files changed (48) hide show
  1. package/dist/cjs/StackZIndex.cjs +22 -17
  2. package/dist/cjs/StackZIndex.native.js +31 -26
  3. package/dist/cjs/StackZIndex.native.js.map +1 -1
  4. package/dist/cjs/context.cjs +14 -12
  5. package/dist/cjs/context.native.js +15 -13
  6. package/dist/cjs/context.native.js.map +1 -1
  7. package/dist/cjs/index.cjs +7 -5
  8. package/dist/cjs/index.native.js +7 -5
  9. package/dist/cjs/index.native.js.map +1 -1
  10. package/dist/cjs/types.cjs +7 -5
  11. package/dist/cjs/types.native.js +7 -5
  12. package/dist/cjs/types.native.js.map +1 -1
  13. package/dist/cjs/useStackedZIndex.cjs +75 -61
  14. package/dist/cjs/useStackedZIndex.native.js +80 -67
  15. package/dist/cjs/useStackedZIndex.native.js.map +1 -1
  16. package/dist/esm/StackZIndex.mjs +7 -4
  17. package/dist/esm/StackZIndex.mjs.map +1 -1
  18. package/dist/esm/StackZIndex.native.js +14 -11
  19. package/dist/esm/StackZIndex.native.js.map +1 -1
  20. package/dist/esm/context.mjs +2 -2
  21. package/dist/esm/context.mjs.map +1 -1
  22. package/dist/esm/context.native.js +2 -2
  23. package/dist/esm/context.native.js.map +1 -1
  24. package/dist/esm/index.js +3 -3
  25. package/dist/esm/index.js.map +1 -6
  26. package/dist/esm/useStackedZIndex.mjs +61 -49
  27. package/dist/esm/useStackedZIndex.mjs.map +1 -1
  28. package/dist/esm/useStackedZIndex.native.js +66 -55
  29. package/dist/esm/useStackedZIndex.native.js.map +1 -1
  30. package/package.json +5 -8
  31. package/dist/cjs/StackZIndex.js +0 -29
  32. package/dist/cjs/StackZIndex.js.map +0 -6
  33. package/dist/cjs/context.js +0 -23
  34. package/dist/cjs/context.js.map +0 -6
  35. package/dist/cjs/index.js +0 -17
  36. package/dist/cjs/index.js.map +0 -6
  37. package/dist/cjs/types.js +0 -14
  38. package/dist/cjs/types.js.map +0 -6
  39. package/dist/cjs/useStackedZIndex.js +0 -61
  40. package/dist/cjs/useStackedZIndex.js.map +0 -6
  41. package/dist/esm/StackZIndex.js +0 -15
  42. package/dist/esm/StackZIndex.js.map +0 -6
  43. package/dist/esm/context.js +0 -7
  44. package/dist/esm/context.js.map +0 -6
  45. package/dist/esm/types.js +0 -1
  46. package/dist/esm/types.js.map +0 -6
  47. package/dist/esm/useStackedZIndex.js +0 -46
  48. package/dist/esm/useStackedZIndex.js.map +0 -6
@@ -3,29 +3,31 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
3
  var __getOwnPropNames = Object.getOwnPropertyNames;
4
4
  var __hasOwnProp = Object.prototype.hasOwnProperty;
5
5
  var __export = (target, all) => {
6
- for (var name in all) __defProp(target, name, {
7
- get: all[name],
8
- enumerable: !0
9
- });
10
- },
11
- __copyProps = (to, from, except, desc) => {
12
- if (from && typeof from == "object" || typeof from == "function") for (let key of __getOwnPropNames(from)) !__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, {
6
+ for (var name in all) __defProp(target, name, {
7
+ get: all[name],
8
+ enumerable: true
9
+ });
10
+ };
11
+ var __copyProps = (to, from, except, desc) => {
12
+ if (from && typeof from === "object" || typeof from === "function") {
13
+ for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
13
14
  get: () => from[key],
14
15
  enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
15
16
  });
16
- return to;
17
- };
17
+ }
18
+ return to;
19
+ };
18
20
  var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
19
- value: !0
21
+ value: true
20
22
  }), mod);
21
23
  var StackZIndex_exports = {};
22
24
  __export(StackZIndex_exports, {
23
25
  StackZIndexContext: () => StackZIndexContext
24
26
  });
25
27
  module.exports = __toCommonJS(StackZIndex_exports);
26
- var import_react = require("react"),
27
- import_context = require("./context.cjs"),
28
- import_jsx_runtime = require("react/jsx-runtime");
28
+ var import_react = require("react");
29
+ var import_context = require("./context.cjs");
30
+ var import_jsx_runtime = require("react/jsx-runtime");
29
31
  const StackZIndexContext = ({
30
32
  children,
31
33
  zIndex
@@ -35,8 +37,11 @@ const StackZIndexContext = ({
35
37
  value: existing + 1,
36
38
  children
37
39
  });
38
- return typeof zIndex < "u" && (content = /* @__PURE__ */(0, import_jsx_runtime.jsx)(import_context.ZIndexHardcodedContext.Provider, {
39
- value: zIndex,
40
- children: content
41
- })), content;
40
+ if (typeof zIndex !== "undefined") {
41
+ content = /* @__PURE__ */(0, import_jsx_runtime.jsx)(import_context.ZIndexHardcodedContext.Provider, {
42
+ value: zIndex,
43
+ children: content
44
+ });
45
+ }
46
+ return content;
42
47
  };
@@ -5,42 +5,47 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
5
  var __getOwnPropNames = Object.getOwnPropertyNames;
6
6
  var __hasOwnProp = Object.prototype.hasOwnProperty;
7
7
  var __export = (target, all) => {
8
- for (var name in all) __defProp(target, name, {
9
- get: all[name],
10
- enumerable: !0
11
- });
12
- },
13
- __copyProps = (to, from, except, desc) => {
14
- if (from && typeof from == "object" || typeof from == "function") for (let key of __getOwnPropNames(from)) !__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, {
8
+ for (var name in all) __defProp(target, name, {
9
+ get: all[name],
10
+ enumerable: true
11
+ });
12
+ };
13
+ var __copyProps = (to, from, except, desc) => {
14
+ if (from && typeof from === "object" || typeof from === "function") {
15
+ for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
15
16
  get: () => from[key],
16
17
  enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
17
18
  });
18
- return to;
19
- };
19
+ }
20
+ return to;
21
+ };
20
22
  var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
21
- value: !0
23
+ value: true
22
24
  }), mod);
23
25
  var StackZIndex_exports = {};
24
26
  __export(StackZIndex_exports, {
25
27
  StackZIndexContext: () => StackZIndexContext
26
28
  });
27
29
  module.exports = __toCommonJS(StackZIndex_exports);
28
- var import_jsx_runtime = require("react/jsx-runtime"),
29
- import_react = require("react"),
30
- import_context = require("./context.native.js"),
31
- StackZIndexContext = function (param) {
32
- var {
33
- children,
34
- zIndex
35
- } = param,
36
- existing = (0, import_react.useContext)(import_context.ZIndexStackContext),
37
- content = /* @__PURE__ */(0, import_jsx_runtime.jsx)(import_context.ZIndexStackContext.Provider, {
38
- value: existing + 1,
39
- children
40
- });
41
- return typeof zIndex < "u" && (content = /* @__PURE__ */(0, import_jsx_runtime.jsx)(import_context.ZIndexHardcodedContext.Provider, {
30
+ var import_jsx_runtime = require("react/jsx-runtime");
31
+ var import_react = require("react");
32
+ var import_context = require("./context.native.js");
33
+ var StackZIndexContext = function (param) {
34
+ var {
35
+ children,
36
+ zIndex
37
+ } = param;
38
+ var existing = (0, import_react.useContext)(import_context.ZIndexStackContext);
39
+ var content = /* @__PURE__ */(0, import_jsx_runtime.jsx)(import_context.ZIndexStackContext.Provider, {
40
+ value: existing + 1,
41
+ children
42
+ });
43
+ if (typeof zIndex !== "undefined") {
44
+ content = /* @__PURE__ */(0, import_jsx_runtime.jsx)(import_context.ZIndexHardcodedContext.Provider, {
42
45
  value: zIndex,
43
46
  children: content
44
- })), content;
45
- };
47
+ });
48
+ }
49
+ return content;
50
+ };
46
51
  //# sourceMappingURL=StackZIndex.native.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["__toCommonJS","mod","__copyProps","__defProp","value","StackZIndex_exports","__export","StackZIndexContext","module","exports","import_jsx_runtime","require","import_react","import_context","param","children","zIndex","existing","useContext","ZIndexStackContext","content","jsx","Provider","ZIndexHardcodedContext"],"sources":["../../src/StackZIndex.tsx"],"sourcesContent":[null],"mappings":";;;;;;;;;;;;;;;;;;;AAAA,IAAAA,YAAA,GAAAC,GAAA,IAAAC,WAAA,CAAAC,SAAA;EAAAC,KAAA;AAAA,IAAAH,GAAA;AAAA,IAAAI,mBAAA;AAAAC,QAAA,CAAAD,mBAAA;EAAAE,kBAAA,EAAAA,CAAA,KAAAA;AAAA;AAAAC,MAAA,CAAAC,OAAA,GAAAT,YAA2B,CAAAK,mBAC3B;AAEO,IAAAK,kBAAM,GAAAC,OAAsB;EAAAC,YAAA,GAAAD,OAAA;EAAAE,cAAA,GAAAF,OAAA;EAAAJ,kBAAA,YAAAA,CAAAO,KAAA;IACjC;QAAAC,QAAA;QAAAC;MAAA,IAAAF,KAAA;MAAAG,QAAA,OAAAL,YAAA,CAAAM,UAAA,EAAAL,cAAA,CAAAM,kBAAA;MAAAC,OAAA,sBAAAV,kBAAA,CAAAW,GAAA,EAAAR,cAAA,CAAAM,kBAAA,CAAAG,QAAA;QACAlB,KAAA,EAAAa,QAAA;QACFF;MAIE;IAEA,OAAI,OACFC,MAAA,WAAAI,OAAA,mBAAC,GAAAV,kBAAA,CAAAW,GAAA,EAAAR,cAAmB,CAAAU,sBAA2B,CAAAD,QAC5C;MAILlB,KAAI,EAAAY,MAAO;MASbD,QAAA,EAAAK","ignoreList":[]}
1
+ {"version":3,"names":["__toCommonJS","mod","__copyProps","__defProp","value","StackZIndex_exports","__export","StackZIndexContext","module","exports","import_jsx_runtime","require","import_react","import_context","param","children","zIndex","existing","useContext","ZIndexStackContext","content","jsx","Provider","ZIndexHardcodedContext"],"sources":["../../src/StackZIndex.tsx"],"sourcesContent":[null],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,YAAA,GAAAC,GAAA,IAAAC,WAAA,CAAAC,SAAA;EAAAC,KAAA;AAAA,IAAAH,GAAA;AAAA,IAAAI,mBAAA;AAAAC,QAAA,CAAAD,mBAAA;EAAAE,kBAAA,EAAAA,CAAA,KAAAA;AAAA;AAAAC,MAAA,CAAAC,OAAA,GAAAT,YAA2B,CAAAK,mBAAA;AAC3B,IAAAK,kBAA2D,GAAAC,OAAA;AAYvD,IAAAC,YAAA,GAAAD,OAAA;AAVG,IAAAE,cAAM,GAAAF,OAAsB;AAAA,IACjCJ,kBAAA,YAAAA,CAAAO,KAAA;EACA;IAAAC,QAAA;IAAAC;EAAA,IAAAF,KAAA;EACF,IAGMG,QAAA,OAAAL,YAAA,CAAAM,UAAA,EAAAL,cAAA,CAAAM,kBAAA;EACJ,IAAAC,OAAM,kBAAW,IAAAV,kBAAW,CAAAW,GAAA,EAAAR,cAAA,CAAAM,kBAAkB,CAAAG,QAAA;IAE9ClB,KAAI,EAAAa,QACF;IAKFF;EACE;EAKF,WAAAC,MAAA;IAEAI,OAAO,sBAAAV,kBAAA,CAAAW,GAAA,EAAAR,cAAA,CAAAU,sBAAA,CAAAD,QAAA;MACTlB,KAAA,EAAAY,MAAA","ignoreList":[]}
@@ -3,20 +3,22 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
3
  var __getOwnPropNames = Object.getOwnPropertyNames;
4
4
  var __hasOwnProp = Object.prototype.hasOwnProperty;
5
5
  var __export = (target, all) => {
6
- for (var name in all) __defProp(target, name, {
7
- get: all[name],
8
- enumerable: !0
9
- });
10
- },
11
- __copyProps = (to, from, except, desc) => {
12
- if (from && typeof from == "object" || typeof from == "function") for (let key of __getOwnPropNames(from)) !__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, {
6
+ for (var name in all) __defProp(target, name, {
7
+ get: all[name],
8
+ enumerable: true
9
+ });
10
+ };
11
+ var __copyProps = (to, from, except, desc) => {
12
+ if (from && typeof from === "object" || typeof from === "function") {
13
+ for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
13
14
  get: () => from[key],
14
15
  enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
15
16
  });
16
- return to;
17
- };
17
+ }
18
+ return to;
19
+ };
18
20
  var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
19
- value: !0
21
+ value: true
20
22
  }), mod);
21
23
  var context_exports = {};
22
24
  __export(context_exports, {
@@ -25,5 +27,5 @@ __export(context_exports, {
25
27
  });
26
28
  module.exports = __toCommonJS(context_exports);
27
29
  var import_react = require("react");
28
- const ZIndexStackContext = (0, import_react.createContext)(1),
29
- ZIndexHardcodedContext = (0, import_react.createContext)(void 0);
30
+ const ZIndexStackContext = (0, import_react.createContext)(1);
31
+ const ZIndexHardcodedContext = (0, import_react.createContext)(void 0);
@@ -5,20 +5,22 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
5
  var __getOwnPropNames = Object.getOwnPropertyNames;
6
6
  var __hasOwnProp = Object.prototype.hasOwnProperty;
7
7
  var __export = (target, all) => {
8
- for (var name in all) __defProp(target, name, {
9
- get: all[name],
10
- enumerable: !0
11
- });
12
- },
13
- __copyProps = (to, from, except, desc) => {
14
- if (from && typeof from == "object" || typeof from == "function") for (let key of __getOwnPropNames(from)) !__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, {
8
+ for (var name in all) __defProp(target, name, {
9
+ get: all[name],
10
+ enumerable: true
11
+ });
12
+ };
13
+ var __copyProps = (to, from, except, desc) => {
14
+ if (from && typeof from === "object" || typeof from === "function") {
15
+ for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
15
16
  get: () => from[key],
16
17
  enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
17
18
  });
18
- return to;
19
- };
19
+ }
20
+ return to;
21
+ };
20
22
  var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
21
- value: !0
23
+ value: true
22
24
  }), mod);
23
25
  var context_exports = {};
24
26
  __export(context_exports, {
@@ -26,7 +28,7 @@ __export(context_exports, {
26
28
  ZIndexStackContext: () => ZIndexStackContext
27
29
  });
28
30
  module.exports = __toCommonJS(context_exports);
29
- var import_react = require("react"),
30
- ZIndexStackContext = (0, import_react.createContext)(1),
31
- ZIndexHardcodedContext = (0, import_react.createContext)(void 0);
31
+ var import_react = require("react");
32
+ var ZIndexStackContext = (0, import_react.createContext)(1);
33
+ var ZIndexHardcodedContext = (0, import_react.createContext)(void 0);
32
34
  //# sourceMappingURL=context.native.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["__toCommonJS","mod","__copyProps","__defProp","value","context_exports","__export","ZIndexHardcodedContext","ZIndexStackContext","module","exports","import_react","require","createContext"],"sources":["../../src/context.ts"],"sourcesContent":[null],"mappings":";;;;;;;;;;;;;;;;;;;AAAA,IAAAA,YAAA,GAAAC,GAAA,IAAAC,WAAA,CAAAC,SAAA;EAAAC,KAAA;AAAA,IAAAH,GAAA;AAAA,IAAAI,eAAA;AAAAC,QAAA,CAAAD,eAAA;EAAAE,sBAAA,EAAAA,CAAA,KAAAA,sBAAA;EAAAC,kBAAA,EAAAA,CAAA,KAAAA;AAAA;AAAAC,MAAA,CAAAC,OAAA,GAAAV,YAA8B,CAAAK,eAAA;AAGvB,IAAAM,YAAM,GAAAC,OAAA,QAAqB;EAAAJ,kBAAA,IAAc,CAAC,EAAAG,YAGpC,CAAAE,aAAA,IAAyB;EAAAN,sBAAA,IAAkC,GAAAI,YAAS,CAAAE,aAAA","ignoreList":[]}
1
+ {"version":3,"names":["__toCommonJS","mod","__copyProps","__defProp","value","context_exports","__export","ZIndexHardcodedContext","ZIndexStackContext","module","exports","import_react","require","createContext"],"sources":["../../src/context.ts"],"sourcesContent":[null],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,YAAA,GAAAC,GAAA,IAAAC,WAAA,CAAAC,SAAA;EAAAC,KAAA;AAAA,IAAAH,GAAA;AAAA,IAAAI,eAAA;AAAAC,QAAA,CAAAD,eAAA;EAAAE,sBAAA,EAAAA,CAAA,KAAAA,sBAAA;EAAAC,kBAAA,EAAAA,CAAA,KAAAA;AAAA;AAAAC,MAAA,CAAAC,OAAA,GAAAV,YAA8B,CAAAK,eAAA;AAGvB,IAAAM,YAAM,GAAAC,OAAA,QAAqB;AAG3B,IAAAJ,kBAAM,OAAAG,YAAyB,CAAAE,aAAA","ignoreList":[]}
@@ -3,15 +3,17 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
3
  var __getOwnPropNames = Object.getOwnPropertyNames;
4
4
  var __hasOwnProp = Object.prototype.hasOwnProperty;
5
5
  var __copyProps = (to, from, except, desc) => {
6
- if (from && typeof from == "object" || typeof from == "function") for (let key of __getOwnPropNames(from)) !__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, {
6
+ if (from && typeof from === "object" || typeof from === "function") {
7
+ for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
7
8
  get: () => from[key],
8
9
  enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
9
10
  });
10
- return to;
11
- },
12
- __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
11
+ }
12
+ return to;
13
+ };
14
+ var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
13
15
  var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
14
- value: !0
16
+ value: true
15
17
  }), mod);
16
18
  var index_exports = {};
17
19
  module.exports = __toCommonJS(index_exports);
@@ -5,15 +5,17 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
5
  var __getOwnPropNames = Object.getOwnPropertyNames;
6
6
  var __hasOwnProp = Object.prototype.hasOwnProperty;
7
7
  var __copyProps = (to, from, except, desc) => {
8
- if (from && typeof from == "object" || typeof from == "function") for (let key of __getOwnPropNames(from)) !__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, {
8
+ if (from && typeof from === "object" || typeof from === "function") {
9
+ for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
9
10
  get: () => from[key],
10
11
  enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
11
12
  });
12
- return to;
13
- },
14
- __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
13
+ }
14
+ return to;
15
+ };
16
+ var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
15
17
  var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
16
- value: !0
18
+ value: true
17
19
  }), mod);
18
20
  var index_exports = {};
19
21
  module.exports = __toCommonJS(index_exports);
@@ -1 +1 @@
1
- {"version":3,"names":["__toCommonJS","mod","__copyProps","__defProp","value","index_exports","module","exports","__reExport","require"],"sources":["../../src/index.ts"],"sourcesContent":[null],"mappings":";;;;;;;;;;;;;;AAAA,IAAAA,YAAA,GAAAC,GAAA,IAAAC,WAAA,CAAAC,SAAA;EAAAC,KAAA;AAAA,IAAAH,GAAA;AAAA,IAAAI,aAAA;AAAAC,MAAA,CAAAC,OAAA,GAAAP,YAAc,CAAAK,aAAA;AACdG,UAAA,CAAAH,aAAA,EAAcI,OAAA,+BADd,GAAAH,MAAA,CAAAC,OAAA;AAEAC,UAAA,CAAAH,aAAA,EAAcI,OAAA,0BAFd,GAAAH,MAAA,CAAAC,OAAA","ignoreList":[]}
1
+ {"version":3,"names":["__toCommonJS","mod","__copyProps","__defProp","value","index_exports","module","exports","__reExport","require"],"sources":["../../src/index.ts"],"sourcesContent":[null],"mappings":";;;;;;;;;;;;;;;;AAAA,IAAAA,YAAA,GAAAC,GAAA,IAAAC,WAAA,CAAAC,SAAA;EAAAC,KAAA;AAAA,IAAAH,GAAA;AAAA,IAAAI,aAAA;AAAAC,MAAA,CAAAC,OAAA,GAAAP,YAAc,CAAAK,aAAA;AACdG,UAAA,CAAAH,aAAA,EAAcI,OAAA,+BADd,GAAAH,MAAA,CAAAC,OAAA;AAEAC,UAAA,CAAAH,aAAA,EAAcI,OAAA,0BAFd,GAAAH,MAAA,CAAAC,OAAA","ignoreList":[]}
@@ -3,14 +3,16 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
3
  var __getOwnPropNames = Object.getOwnPropertyNames;
4
4
  var __hasOwnProp = Object.prototype.hasOwnProperty;
5
5
  var __copyProps = (to, from, except, desc) => {
6
- if (from && typeof from == "object" || typeof from == "function") for (let key of __getOwnPropNames(from)) !__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, {
7
- get: () => from[key],
8
- enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
9
- });
6
+ if (from && typeof from === "object" || typeof from === "function") {
7
+ for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
8
+ get: () => from[key],
9
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
10
+ });
11
+ }
10
12
  return to;
11
13
  };
12
14
  var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
13
- value: !0
15
+ value: true
14
16
  }), mod);
15
17
  var types_exports = {};
16
18
  module.exports = __toCommonJS(types_exports);
@@ -5,14 +5,16 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
5
  var __getOwnPropNames = Object.getOwnPropertyNames;
6
6
  var __hasOwnProp = Object.prototype.hasOwnProperty;
7
7
  var __copyProps = (to, from, except, desc) => {
8
- if (from && typeof from == "object" || typeof from == "function") for (let key of __getOwnPropNames(from)) !__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, {
9
- get: () => from[key],
10
- enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
11
- });
8
+ if (from && typeof from === "object" || typeof from === "function") {
9
+ for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
10
+ get: () => from[key],
11
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
12
+ });
13
+ }
12
14
  return to;
13
15
  };
14
16
  var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
15
- value: !0
17
+ value: true
16
18
  }), mod);
17
19
  var types_exports = {};
18
20
  module.exports = __toCommonJS(types_exports);
@@ -1 +1 @@
1
- {"version":3,"names":["__toCommonJS","mod","__copyProps","__defProp","value","types_exports"],"sources":["../../src/types.ts"],"sourcesContent":[null],"mappings":";;;;;;;;;;;;;AAAA,IAAAA,YAAA,GAAAC,GAAA,IAAAC,WAAA,CAAAC,SAAA;EAAAC,KAAA;AAAA,IAAAH,GAAA;AAAA,IAAAI,aAAA","ignoreList":[]}
1
+ {"version":3,"names":["__toCommonJS","mod","__copyProps","__defProp","value","types_exports"],"sources":["../../src/types.ts"],"sourcesContent":[null],"mappings":";;;;;;;;;;;;;;;AAAA,IAAAA,YAAA,GAAAC,GAAA,IAAAC,WAAA,CAAAC,SAAA;EAAAC,KAAA;AAAA,IAAAH,GAAA;AAAA,IAAAI,aAAA","ignoreList":[]}
@@ -3,78 +3,92 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
3
  var __getOwnPropNames = Object.getOwnPropertyNames;
4
4
  var __hasOwnProp = Object.prototype.hasOwnProperty;
5
5
  var __export = (target, all) => {
6
- for (var name in all) __defProp(target, name, {
7
- get: all[name],
8
- enumerable: !0
9
- });
10
- },
11
- __copyProps = (to, from, except, desc) => {
12
- if (from && typeof from == "object" || typeof from == "function") for (let key of __getOwnPropNames(from)) !__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, {
6
+ for (var name in all) __defProp(target, name, {
7
+ get: all[name],
8
+ enumerable: true
9
+ });
10
+ };
11
+ var __copyProps = (to, from, except, desc) => {
12
+ if (from && typeof from === "object" || typeof from === "function") {
13
+ for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
13
14
  get: () => from[key],
14
15
  enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
15
16
  });
16
- return to;
17
- };
17
+ }
18
+ return to;
19
+ };
18
20
  var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
19
- value: !0
21
+ value: true
20
22
  }), mod);
21
23
  var useStackedZIndex_exports = {};
22
24
  __export(useStackedZIndex_exports, {
23
25
  useStackedZIndex: () => useStackedZIndex
24
26
  });
25
27
  module.exports = __toCommonJS(useStackedZIndex_exports);
26
- var import_react = require("react"),
27
- import_context = require("./context.cjs");
28
- const ZIndicesByContext = {},
29
- CurrentPortalZIndices = {},
30
- useStackedZIndex = props => {
31
- if (process.env.TAMAGUI_STACK_Z_INDEX_GLOBAL) {
32
- const {
33
- stackZIndex,
34
- zIndex: zIndexProp
35
- } = props,
36
- id = (0, import_react.useId)(),
37
- zIndex = (0, import_react.useMemo)(() => {
38
- if (stackZIndex && stackZIndex !== "global" && zIndexProp === void 0) {
39
- const highest = Object.values(CurrentPortalZIndices).reduce((acc, cur) => Math.max(acc, cur), 0);
40
- return Math.max(stackZIndex === !0 ? 1 : stackZIndex, highest + 1);
41
- }
42
- return zIndexProp ?? 1e3;
43
- }, [stackZIndex]);
44
- return (0, import_react.useEffect)(() => {
45
- if (typeof stackZIndex == "number") return CurrentPortalZIndices[id] = stackZIndex, () => {
28
+ var import_react = require("react");
29
+ var import_context = require("./context.cjs");
30
+ const ZIndicesByContext = {};
31
+ const CurrentPortalZIndices = {};
32
+ const useStackedZIndex = props => {
33
+ if (process.env.TAMAGUI_STACK_Z_INDEX_GLOBAL) {
34
+ const {
35
+ stackZIndex,
36
+ zIndex: zIndexProp
37
+ } = props;
38
+ const id = (0, import_react.useId)();
39
+ const zIndex = (0, import_react.useMemo)(() => {
40
+ if (stackZIndex && stackZIndex !== "global" && zIndexProp === void 0) {
41
+ const highest = Object.values(CurrentPortalZIndices).reduce((acc, cur) => Math.max(acc, cur), 0);
42
+ return Math.max(stackZIndex === true ? 1 : stackZIndex, highest + 1);
43
+ }
44
+ return zIndexProp ?? 1e3;
45
+ }, [stackZIndex]);
46
+ (0, import_react.useEffect)(() => {
47
+ if (typeof stackZIndex === "number") {
48
+ CurrentPortalZIndices[id] = stackZIndex;
49
+ return () => {
46
50
  delete CurrentPortalZIndices[id];
47
51
  };
48
- }, [stackZIndex]), zIndex;
49
- } else {
50
- const {
51
- stackZIndex,
52
- zIndex: zIndexProp
53
- } = props,
54
- id = (0, import_react.useId)(),
55
- stackingContextLevel = (0, import_react.useContext)(import_context.ZIndexStackContext),
56
- stackLayer = stackZIndex === "global" ? 0 : stackingContextLevel,
57
- hardcoded = (0, import_react.useContext)(import_context.ZIndexHardcodedContext);
58
- ZIndicesByContext[stackLayer] ||= {};
59
- const stackContext = ZIndicesByContext[stackLayer],
60
- zIndex = (0, import_react.useMemo)(() => {
61
- if (typeof zIndexProp == "number") return zIndexProp;
62
- if (stackZIndex) {
63
- if (hardcoded) return hardcoded + 1;
64
- const entries = Object.values(stackContext),
65
- baseForLayer = stackLayer * 5e3,
66
- nextLayerBase = (stackLayer + 1) * 5e3,
67
- validEntries = entries.filter(z => z < nextLayerBase),
68
- highest = validEntries.length > 0 ? Math.max(...validEntries) : baseForLayer,
69
- nextZIndex = highest === baseForLayer ? baseForLayer + 1 : highest + 1;
70
- return typeof stackZIndex == "number" ? stackZIndex + nextZIndex : nextZIndex;
71
- }
72
- return 1;
73
- }, [stackLayer, zIndexProp, stackZIndex]);
74
- return (0, import_react.useEffect)(() => {
75
- if (stackZIndex) return stackContext[id] = zIndex, () => {
52
+ }
53
+ }, [stackZIndex]);
54
+ return zIndex;
55
+ } else {
56
+ const {
57
+ stackZIndex,
58
+ zIndex: zIndexProp
59
+ } = props;
60
+ const id = (0, import_react.useId)();
61
+ const stackingContextLevel = (0, import_react.useContext)(import_context.ZIndexStackContext);
62
+ const stackLayer = stackZIndex === "global" ? 0 : stackingContextLevel;
63
+ const hardcoded = (0, import_react.useContext)(import_context.ZIndexHardcodedContext);
64
+ ZIndicesByContext[stackLayer] ||= {};
65
+ const stackContext = ZIndicesByContext[stackLayer];
66
+ const zIndex = (0, import_react.useMemo)(() => {
67
+ if (typeof zIndexProp === "number") {
68
+ return zIndexProp;
69
+ }
70
+ if (stackZIndex) {
71
+ if (hardcoded) {
72
+ return hardcoded + 1;
73
+ }
74
+ const entries = Object.values(stackContext);
75
+ const baseForLayer = stackLayer * 5e3;
76
+ const nextLayerBase = (stackLayer + 1) * 5e3;
77
+ const validEntries = entries.filter(z => z < nextLayerBase);
78
+ const highest = validEntries.length > 0 ? Math.max(...validEntries) : baseForLayer;
79
+ const nextZIndex = highest === baseForLayer ? baseForLayer + 1 : highest + 1;
80
+ return typeof stackZIndex === "number" ? stackZIndex + nextZIndex : nextZIndex;
81
+ }
82
+ return 1;
83
+ }, [stackLayer, zIndexProp, stackZIndex]);
84
+ (0, import_react.useEffect)(() => {
85
+ if (stackZIndex) {
86
+ stackContext[id] = zIndex;
87
+ return () => {
76
88
  delete stackContext[id];
77
89
  };
78
- }, [zIndex]), zIndex;
79
- }
80
- };
90
+ }
91
+ }, [zIndex]);
92
+ return zIndex;
93
+ }
94
+ };