@hanzogui/z-index-stack 3.0.2 → 7.3.0

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 (36) hide show
  1. package/LICENSE +40 -19
  2. package/dist/cjs/StackZIndex.cjs +22 -17
  3. package/dist/cjs/StackZIndex.native.js +31 -26
  4. package/dist/cjs/StackZIndex.native.js.map +1 -1
  5. package/dist/cjs/context.cjs +14 -12
  6. package/dist/cjs/context.native.js +15 -13
  7. package/dist/cjs/context.native.js.map +1 -1
  8. package/dist/cjs/index.cjs +7 -5
  9. package/dist/cjs/index.native.js +7 -5
  10. package/dist/cjs/index.native.js.map +1 -1
  11. package/dist/cjs/types.cjs +7 -5
  12. package/dist/cjs/types.native.js +7 -5
  13. package/dist/cjs/types.native.js.map +1 -1
  14. package/dist/cjs/useStackedZIndex.cjs +75 -61
  15. package/dist/cjs/useStackedZIndex.native.js +80 -67
  16. package/dist/cjs/useStackedZIndex.native.js.map +1 -1
  17. package/dist/esm/StackZIndex.mjs +7 -4
  18. package/dist/esm/StackZIndex.mjs.map +1 -1
  19. package/dist/esm/StackZIndex.native.js +14 -11
  20. package/dist/esm/StackZIndex.native.js.map +1 -1
  21. package/dist/esm/context.mjs +2 -2
  22. package/dist/esm/context.mjs.map +1 -1
  23. package/dist/esm/context.native.js +2 -2
  24. package/dist/esm/context.native.js.map +1 -1
  25. package/dist/esm/useStackedZIndex.mjs +61 -49
  26. package/dist/esm/useStackedZIndex.mjs.map +1 -1
  27. package/dist/esm/useStackedZIndex.native.js +66 -55
  28. package/dist/esm/useStackedZIndex.native.js.map +1 -1
  29. package/package.json +9 -7
  30. package/src/useStackedZIndex.tsx +1 -1
  31. package/types/StackZIndex.d.ts +1 -1
  32. package/types/StackZIndex.d.ts.map +1 -0
  33. package/types/context.d.ts.map +1 -0
  34. package/types/index.d.ts.map +1 -0
  35. package/types/types.d.ts.map +1 -0
  36. package/types/useStackedZIndex.d.ts.map +1 -0
package/LICENSE CHANGED
@@ -1,21 +1,42 @@
1
- MIT License
1
+ BSD 3-Clause License
2
+
3
+ Copyright (c) 2026-present, Hanzo AI, Inc.
4
+
5
+ Portions of this software are derived from upstream code originally licensed under
6
+ the MIT License, with the following copyright notices retained per its terms:
2
7
 
3
8
  Copyright (c) 2020 Nate Wienert
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.
9
+ Copyright (c) 2015-present, Nicolas Gallagher.
10
+ Copyright (c) 2015-present, Facebook, Inc.
11
+ Copyright (c) 2021 Radix
12
+ Copyright (c) 2017 Carmelo Pullara
13
+ Copyright (c) 2018 Framer B.V.
14
+ Copyright (c) 2022 WorkOS
15
+
16
+ All rights reserved.
17
+
18
+ Redistribution and use in source and binary forms, with or without
19
+ modification, are permitted provided that the following conditions are met:
20
+
21
+ 1. Redistributions of source code must retain the above copyright notice, this
22
+ list of conditions and the following disclaimer.
23
+
24
+ 2. Redistributions in binary form must reproduce the above copyright notice,
25
+ this list of conditions and the following disclaimer in the documentation
26
+ and/or other materials provided with the distribution.
27
+
28
+ 3. Neither the name of the copyright holder nor the names of its contributors
29
+ may be used to endorse or promote products derived from this software
30
+ without specific prior written permission.
31
+
32
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
33
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
34
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
35
+ ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
36
+ LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
37
+ CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
38
+ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
39
+ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
40
+ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
41
+ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
42
+ POSSIBILITY OF SUCH DAMAGE.
@@ -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.HANZO_GUI_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.GUI_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
+ };