@tamagui/z-index-stack 1.125.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 (58) hide show
  1. package/LICENSE +21 -0
  2. package/dist/cjs/StackZIndex.cjs +42 -0
  3. package/dist/cjs/StackZIndex.js +29 -0
  4. package/dist/cjs/StackZIndex.js.map +6 -0
  5. package/dist/cjs/StackZIndex.native.js +35 -0
  6. package/dist/cjs/StackZIndex.native.js.map +6 -0
  7. package/dist/cjs/context.cjs +29 -0
  8. package/dist/cjs/context.js +23 -0
  9. package/dist/cjs/context.js.map +6 -0
  10. package/dist/cjs/context.native.js +28 -0
  11. package/dist/cjs/context.native.js.map +6 -0
  12. package/dist/cjs/index.cjs +20 -0
  13. package/dist/cjs/index.js +17 -0
  14. package/dist/cjs/index.js.map +6 -0
  15. package/dist/cjs/index.native.js +24 -0
  16. package/dist/cjs/index.native.js.map +6 -0
  17. package/dist/cjs/useStackedZIndex.cjs +54 -0
  18. package/dist/cjs/useStackedZIndex.js +45 -0
  19. package/dist/cjs/useStackedZIndex.js.map +6 -0
  20. package/dist/cjs/useStackedZIndex.native.js +54 -0
  21. package/dist/cjs/useStackedZIndex.native.js.map +6 -0
  22. package/dist/esm/StackZIndex.js +15 -0
  23. package/dist/esm/StackZIndex.js.map +6 -0
  24. package/dist/esm/StackZIndex.mjs +19 -0
  25. package/dist/esm/StackZIndex.mjs.map +1 -0
  26. package/dist/esm/StackZIndex.native.js +17 -0
  27. package/dist/esm/StackZIndex.native.js.map +6 -0
  28. package/dist/esm/context.js +7 -0
  29. package/dist/esm/context.js.map +6 -0
  30. package/dist/esm/context.mjs +5 -0
  31. package/dist/esm/context.mjs.map +1 -0
  32. package/dist/esm/context.native.js +7 -0
  33. package/dist/esm/context.native.js.map +6 -0
  34. package/dist/esm/index.js +4 -0
  35. package/dist/esm/index.js.map +6 -0
  36. package/dist/esm/index.mjs +4 -0
  37. package/dist/esm/index.mjs.map +1 -0
  38. package/dist/esm/index.native.js +4 -0
  39. package/dist/esm/index.native.js.map +6 -0
  40. package/dist/esm/useStackedZIndex.js +30 -0
  41. package/dist/esm/useStackedZIndex.js.map +6 -0
  42. package/dist/esm/useStackedZIndex.mjs +31 -0
  43. package/dist/esm/useStackedZIndex.mjs.map +1 -0
  44. package/dist/esm/useStackedZIndex.native.js +35 -0
  45. package/dist/esm/useStackedZIndex.native.js.map +6 -0
  46. package/package.json +40 -0
  47. package/src/StackZIndex.tsx +25 -0
  48. package/src/context.ts +7 -0
  49. package/src/index.ts +3 -0
  50. package/src/useStackedZIndex.tsx +53 -0
  51. package/types/StackZIndex.d.ts +5 -0
  52. package/types/StackZIndex.d.ts.map +1 -0
  53. package/types/context.d.ts +3 -0
  54. package/types/context.d.ts.map +1 -0
  55. package/types/index.d.ts +4 -0
  56. package/types/index.d.ts.map +1 -0
  57. package/types/useStackedZIndex.d.ts +5 -0
  58. package/types/useStackedZIndex.d.ts.map +1 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ 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.
@@ -0,0 +1,42 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
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, {
13
+ get: () => from[key],
14
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
15
+ });
16
+ return to;
17
+ };
18
+ var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
19
+ value: !0
20
+ }), mod);
21
+ var StackZIndex_exports = {};
22
+ __export(StackZIndex_exports, {
23
+ StackZIndexContext: () => StackZIndexContext
24
+ });
25
+ 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");
29
+ const StackZIndexContext = ({
30
+ children,
31
+ zIndex
32
+ }) => {
33
+ const existing = (0, import_react.useContext)(import_context.ZIndexStackContext);
34
+ let content = /* @__PURE__ */(0, import_jsx_runtime.jsx)(import_context.ZIndexStackContext.Provider, {
35
+ value: existing + 1,
36
+ children
37
+ });
38
+ return typeof zIndex < "u" && (content = /* @__PURE__ */(0, import_jsx_runtime.jsx)(import_context.ZIndexHardcodedContext.Provider, {
39
+ value: zIndex,
40
+ children: content
41
+ })), content;
42
+ };
@@ -0,0 +1,29 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __export = (target, all) => {
6
+ for (var name in all)
7
+ __defProp(target, name, { get: all[name], enumerable: !0 });
8
+ }, __copyProps = (to, from, except, desc) => {
9
+ if (from && typeof from == "object" || typeof from == "function")
10
+ for (let key of __getOwnPropNames(from))
11
+ !__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
12
+ return to;
13
+ };
14
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: !0 }), mod);
15
+ var StackZIndex_exports = {};
16
+ __export(StackZIndex_exports, {
17
+ StackZIndexContext: () => StackZIndexContext
18
+ });
19
+ module.exports = __toCommonJS(StackZIndex_exports);
20
+ var import_react = require("react"), import_context = require("./context"), import_jsx_runtime = require("react/jsx-runtime");
21
+ const StackZIndexContext = ({
22
+ children,
23
+ zIndex
24
+ }) => {
25
+ const existing = (0, import_react.useContext)(import_context.ZIndexStackContext);
26
+ let content = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_context.ZIndexStackContext.Provider, { value: existing + 1, children });
27
+ return typeof zIndex < "u" && (content = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_context.ZIndexHardcodedContext.Provider, { value: zIndex, children: content })), content;
28
+ };
29
+ //# sourceMappingURL=StackZIndex.js.map
@@ -0,0 +1,6 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/StackZIndex.tsx"],
4
+ "mappings": ";;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAA2B,kBAC3B,iBAA2D,sBASvD;AAPG,MAAM,qBAAqB,CAAC;AAAA,EACjC;AAAA,EACA;AACF,MAAsD;AACpD,QAAM,eAAW,yBAAW,iCAAkB;AAE9C,MAAI,UACF,4CAAC,kCAAmB,UAAnB,EAA4B,OAAO,WAAW,GAC5C,UACH;AAGF,SAAI,OAAO,SAAW,QACpB,UACE,4CAAC,sCAAuB,UAAvB,EAAgC,OAAO,QACrC,mBACH,IAIG;AACT;",
5
+ "names": []
6
+ }
@@ -0,0 +1,35 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: !0 });
9
+ }, __copyProps = (to, from, except, desc) => {
10
+ if (from && typeof from == "object" || typeof from == "function")
11
+ for (let key of __getOwnPropNames(from))
12
+ !__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
13
+ return to;
14
+ };
15
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: !0 }), mod);
16
+ var StackZIndex_exports = {};
17
+ __export(StackZIndex_exports, {
18
+ StackZIndexContext: () => StackZIndexContext
19
+ });
20
+ module.exports = __toCommonJS(StackZIndex_exports);
21
+ var import_jsx_runtime = require("react/jsx-runtime"), import_react = require("react"), import_context = require("./context"), StackZIndexContext = function(param) {
22
+ var { children, zIndex } = param, existing = (0, import_react.useContext)(import_context.ZIndexStackContext), content = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_context.ZIndexStackContext.Provider, {
23
+ value: existing + 1,
24
+ children
25
+ });
26
+ return typeof zIndex < "u" && (content = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_context.ZIndexHardcodedContext.Provider, {
27
+ value: zIndex,
28
+ children: content
29
+ })), content;
30
+ };
31
+ // Annotate the CommonJS export names for ESM import in node:
32
+ 0 && (module.exports = {
33
+ StackZIndexContext
34
+ });
35
+ //# sourceMappingURL=StackZIndex.js.map
@@ -0,0 +1,6 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/Users/n8/tamagui/code/ui/z-index-stack/src/StackZIndex.tsx"],
4
+ "mappings": ";;;;;;;;;;;;;;;;;;;;uDAAA,eAA2B,kBAC3B,iBAA2D,sBAE9CA,qBAAqB,SAAA,OAAA;MAAC,EACjCC,UACAC,OAAM,IACyC,OACzCC,eAAWC,yBAAWC,iCAAAA,GAExBC,UACF,uCAAAC,KAACF,kCAAmBG,UAAQ;IAACC,OAAON,WAAW;;;AAKjD,SAAI,OAAOD,SAAW,QACpBI,UACE,uCAAAC,KAACG,sCAAuBF,UAAQ;IAACC,OAAOP;cACrCI;OAKAA;AACT;",
5
+ "names": ["StackZIndexContext", "children", "zIndex", "existing", "useContext", "ZIndexStackContext", "content", "_jsx", "Provider", "value", "ZIndexHardcodedContext"]
6
+ }
@@ -0,0 +1,29 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
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, {
13
+ get: () => from[key],
14
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
15
+ });
16
+ return to;
17
+ };
18
+ var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
19
+ value: !0
20
+ }), mod);
21
+ var context_exports = {};
22
+ __export(context_exports, {
23
+ ZIndexHardcodedContext: () => ZIndexHardcodedContext,
24
+ ZIndexStackContext: () => ZIndexStackContext
25
+ });
26
+ module.exports = __toCommonJS(context_exports);
27
+ var import_react = require("react");
28
+ const ZIndexStackContext = (0, import_react.createContext)(1),
29
+ ZIndexHardcodedContext = (0, import_react.createContext)(void 0);
@@ -0,0 +1,23 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __export = (target, all) => {
6
+ for (var name in all)
7
+ __defProp(target, name, { get: all[name], enumerable: !0 });
8
+ }, __copyProps = (to, from, except, desc) => {
9
+ if (from && typeof from == "object" || typeof from == "function")
10
+ for (let key of __getOwnPropNames(from))
11
+ !__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
12
+ return to;
13
+ };
14
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: !0 }), mod);
15
+ var context_exports = {};
16
+ __export(context_exports, {
17
+ ZIndexHardcodedContext: () => ZIndexHardcodedContext,
18
+ ZIndexStackContext: () => ZIndexStackContext
19
+ });
20
+ module.exports = __toCommonJS(context_exports);
21
+ var import_react = require("react");
22
+ const ZIndexStackContext = (0, import_react.createContext)(1), ZIndexHardcodedContext = (0, import_react.createContext)(void 0);
23
+ //# sourceMappingURL=context.js.map
@@ -0,0 +1,6 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/context.ts"],
4
+ "mappings": ";;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAA8B;AAGvB,MAAM,yBAAqB,4BAAc,CAAC,GAGpC,6BAAyB,4BAAkC,MAAS;",
5
+ "names": []
6
+ }
@@ -0,0 +1,28 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: !0 });
9
+ }, __copyProps = (to, from, except, desc) => {
10
+ if (from && typeof from == "object" || typeof from == "function")
11
+ for (let key of __getOwnPropNames(from))
12
+ !__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
13
+ return to;
14
+ };
15
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: !0 }), mod);
16
+ var context_exports = {};
17
+ __export(context_exports, {
18
+ ZIndexHardcodedContext: () => ZIndexHardcodedContext,
19
+ ZIndexStackContext: () => ZIndexStackContext
20
+ });
21
+ module.exports = __toCommonJS(context_exports);
22
+ var import_react = require("react"), ZIndexStackContext = (0, import_react.createContext)(1), ZIndexHardcodedContext = (0, import_react.createContext)(void 0);
23
+ // Annotate the CommonJS export names for ESM import in node:
24
+ 0 && (module.exports = {
25
+ ZIndexHardcodedContext,
26
+ ZIndexStackContext
27
+ });
28
+ //# sourceMappingURL=context.js.map
@@ -0,0 +1,6 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/Users/n8/tamagui/code/ui/z-index-stack/src/context.ts"],
4
+ "mappings": ";;;;;;;;;;;;;;;AAAA;;;;;;mBAA8B,kBAGjBA,yBAAqBC,4BAAc,CAAA,GAGnCC,6BAAyBD,4BAAkCE,MAAAA;",
5
+ "names": ["ZIndexStackContext", "createContext", "ZIndexHardcodedContext", "undefined"]
6
+ }
@@ -0,0 +1,20 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
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
+ });
10
+ return to;
11
+ },
12
+ __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
13
+ var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
14
+ value: !0
15
+ }), mod);
16
+ var index_exports = {};
17
+ module.exports = __toCommonJS(index_exports);
18
+ __reExport(index_exports, require("./useStackedZIndex.cjs"), module.exports);
19
+ __reExport(index_exports, require("./StackZIndex.cjs"), module.exports);
20
+ __reExport(index_exports, require("./context.cjs"), module.exports);
@@ -0,0 +1,17 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __copyProps = (to, from, except, desc) => {
6
+ if (from && typeof from == "object" || typeof from == "function")
7
+ for (let key of __getOwnPropNames(from))
8
+ !__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
9
+ return to;
10
+ }, __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
11
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: !0 }), mod);
12
+ var index_exports = {};
13
+ module.exports = __toCommonJS(index_exports);
14
+ __reExport(index_exports, require("./useStackedZIndex"), module.exports);
15
+ __reExport(index_exports, require("./StackZIndex"), module.exports);
16
+ __reExport(index_exports, require("./context"), module.exports);
17
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1,6 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/index.ts"],
4
+ "mappings": ";;;;;;;;;;;AAAA;AAAA;AAAA,0BAAc,+BAAd;AACA,0BAAc,0BADd;AAEA,0BAAc,sBAFd;",
5
+ "names": []
6
+ }
@@ -0,0 +1,24 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __copyProps = (to, from, except, desc) => {
7
+ if (from && typeof from == "object" || typeof from == "function")
8
+ for (let key of __getOwnPropNames(from))
9
+ !__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
10
+ return to;
11
+ }, __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
12
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: !0 }), mod);
13
+ var index_exports = {};
14
+ module.exports = __toCommonJS(index_exports);
15
+ __reExport(index_exports, require("./useStackedZIndex"), module.exports);
16
+ __reExport(index_exports, require("./StackZIndex"), module.exports);
17
+ __reExport(index_exports, require("./context"), module.exports);
18
+ // Annotate the CommonJS export names for ESM import in node:
19
+ 0 && (module.exports = {
20
+ ...require("./useStackedZIndex"),
21
+ ...require("./StackZIndex"),
22
+ ...require("./context")
23
+ });
24
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1,6 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/Users/n8/tamagui/code/ui/z-index-stack/src/index.ts"],
4
+ "mappings": ";;;;;;;;;;;;AAAA;;0BAAc,+BAAd;AACA,0BAAc,0BADd;AAEA,0BAAc,sBAFd;",
5
+ "names": []
6
+ }
@@ -0,0 +1,54 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
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, {
13
+ get: () => from[key],
14
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
15
+ });
16
+ return to;
17
+ };
18
+ var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
19
+ value: !0
20
+ }), mod);
21
+ var useStackedZIndex_exports = {};
22
+ __export(useStackedZIndex_exports, {
23
+ useStackedZIndex: () => useStackedZIndex
24
+ });
25
+ module.exports = __toCommonJS(useStackedZIndex_exports);
26
+ var import_react = require("react"),
27
+ import_context = require("./context.cjs");
28
+ const ZIndicesByContext = {},
29
+ useStackedZIndex = props => {
30
+ const {
31
+ stackZIndex,
32
+ zIndex: zIndexProp
33
+ } = props,
34
+ id = (0, import_react.useId)(),
35
+ stackingContextLevel = (0, import_react.useContext)(import_context.ZIndexStackContext),
36
+ hardcoded = (0, import_react.useContext)(import_context.ZIndexHardcodedContext);
37
+ ZIndicesByContext[stackingContextLevel] ||= {};
38
+ const stackContext = ZIndicesByContext[stackingContextLevel],
39
+ zIndex = (0, import_react.useMemo)(() => {
40
+ if (typeof zIndexProp == "number") return zIndexProp;
41
+ if (stackZIndex) {
42
+ if (hardcoded) return hardcoded + 1;
43
+ const highest = Object.values(stackContext).reduce((acc, cur) => Math.max(acc, cur), 0),
44
+ found = stackingContextLevel * 5e3 + highest + 1;
45
+ return typeof stackZIndex == "number" ? stackZIndex + found : found;
46
+ }
47
+ return 1;
48
+ }, [stackingContextLevel, zIndexProp, stackZIndex]);
49
+ return (0, import_react.useEffect)(() => {
50
+ if (stackZIndex) return stackContext[id] = zIndex, () => {
51
+ delete stackContext[id];
52
+ };
53
+ }, [zIndex]), zIndex;
54
+ };
@@ -0,0 +1,45 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __export = (target, all) => {
6
+ for (var name in all)
7
+ __defProp(target, name, { get: all[name], enumerable: !0 });
8
+ }, __copyProps = (to, from, except, desc) => {
9
+ if (from && typeof from == "object" || typeof from == "function")
10
+ for (let key of __getOwnPropNames(from))
11
+ !__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
12
+ return to;
13
+ };
14
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: !0 }), mod);
15
+ var useStackedZIndex_exports = {};
16
+ __export(useStackedZIndex_exports, {
17
+ useStackedZIndex: () => useStackedZIndex
18
+ });
19
+ module.exports = __toCommonJS(useStackedZIndex_exports);
20
+ var import_react = require("react"), import_context = require("./context");
21
+ const ZIndicesByContext = {}, useStackedZIndex = (props) => {
22
+ const { stackZIndex, zIndex: zIndexProp } = props, id = (0, import_react.useId)(), stackingContextLevel = (0, import_react.useContext)(import_context.ZIndexStackContext), hardcoded = (0, import_react.useContext)(import_context.ZIndexHardcodedContext);
23
+ ZIndicesByContext[stackingContextLevel] ||= {};
24
+ const stackContext = ZIndicesByContext[stackingContextLevel], zIndex = (0, import_react.useMemo)(() => {
25
+ if (typeof zIndexProp == "number")
26
+ return zIndexProp;
27
+ if (stackZIndex) {
28
+ if (hardcoded)
29
+ return hardcoded + 1;
30
+ const highest = Object.values(stackContext).reduce(
31
+ (acc, cur) => Math.max(acc, cur),
32
+ 0
33
+ ), found = stackingContextLevel * 5e3 + highest + 1;
34
+ return typeof stackZIndex == "number" ? stackZIndex + found : found;
35
+ }
36
+ return 1;
37
+ }, [stackingContextLevel, zIndexProp, stackZIndex]);
38
+ return (0, import_react.useEffect)(() => {
39
+ if (stackZIndex)
40
+ return stackContext[id] = zIndex, () => {
41
+ delete stackContext[id];
42
+ };
43
+ }, [zIndex]), zIndex;
44
+ };
45
+ //# sourceMappingURL=useStackedZIndex.js.map
@@ -0,0 +1,6 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/useStackedZIndex.tsx"],
4
+ "mappings": ";;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAAsD,kBACtD,iBAA2D;AAG3D,MAAM,oBAA4D,CAAC,GAEtD,mBAAmB,CAAC,UAG3B;AACJ,QAAM,EAAE,aAAa,QAAQ,WAAW,IAAI,OACtC,SAAK,oBAAM,GACX,2BAAuB,yBAAW,iCAAkB,GACpD,gBAAY,yBAAW,qCAAsB;AAEnD,oBAAkB,oBAAoB,MAAM,CAAC;AAC7C,QAAM,eAAe,kBAAkB,oBAAoB,GAErD,aAAS,sBAAQ,MAAM;AAC3B,QAAI,OAAO,cAAe;AACxB,aAAO;AAET,QAAI,aAAa;AACf,UAAI;AACF,eAAO,YAAY;AAGrB,YAAM,UAAU,OAAO,OAAO,YAAY,EAAE;AAAA,QAC1C,CAAC,KAAK,QAAQ,KAAK,IAAI,KAAK,GAAG;AAAA,QAC/B;AAAA,MACF,GAGM,QAAQ,uBAAuB,MAAO,UAAU;AAGtD,aAAO,OAAO,eAAgB,WAAW,cAAc,QAAQ;AAAA,IACjE;AAEA,WAAO;AAAA,EACT,GAAG,CAAC,sBAAsB,YAAY,WAAW,CAAC;AAElD,qCAAU,MAAM;AACd,QAAI;AACF,0BAAa,EAAE,IAAI,QACZ,MAAM;AACX,eAAO,aAAa,EAAE;AAAA,MACxB;AAAA,EAEJ,GAAG,CAAC,MAAM,CAAC,GAEJ;AACT;",
5
+ "names": []
6
+ }
@@ -0,0 +1,54 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: !0 });
9
+ }, __copyProps = (to, from, except, desc) => {
10
+ if (from && typeof from == "object" || typeof from == "function")
11
+ for (let key of __getOwnPropNames(from))
12
+ !__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
13
+ return to;
14
+ };
15
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: !0 }), mod);
16
+ var useStackedZIndex_exports = {};
17
+ __export(useStackedZIndex_exports, {
18
+ useStackedZIndex: () => useStackedZIndex
19
+ });
20
+ module.exports = __toCommonJS(useStackedZIndex_exports);
21
+ var import_react = require("react"), import_context = require("./context"), ZIndicesByContext = {}, useStackedZIndex = function(props) {
22
+ var _ZIndicesByContext, _stackingContextLevel, { stackZIndex, zIndex: zIndexProp } = props, id = (0, import_react.useId)(), stackingContextLevel = (0, import_react.useContext)(import_context.ZIndexStackContext), hardcoded = (0, import_react.useContext)(import_context.ZIndexHardcodedContext);
23
+ (_ZIndicesByContext = ZIndicesByContext)[_stackingContextLevel = stackingContextLevel] || (_ZIndicesByContext[_stackingContextLevel] = {});
24
+ var stackContext = ZIndicesByContext[stackingContextLevel], zIndex = (0, import_react.useMemo)(function() {
25
+ if (typeof zIndexProp == "number")
26
+ return zIndexProp;
27
+ if (stackZIndex) {
28
+ if (hardcoded)
29
+ return hardcoded + 1;
30
+ var highest = Object.values(stackContext).reduce(function(acc, cur) {
31
+ return Math.max(acc, cur);
32
+ }, 0), found = stackingContextLevel * 5e3 + highest + 1;
33
+ return typeof stackZIndex == "number" ? stackZIndex + found : found;
34
+ }
35
+ return 1;
36
+ }, [
37
+ stackingContextLevel,
38
+ zIndexProp,
39
+ stackZIndex
40
+ ]);
41
+ return (0, import_react.useEffect)(function() {
42
+ if (stackZIndex)
43
+ return stackContext[id] = zIndex, function() {
44
+ delete stackContext[id];
45
+ };
46
+ }, [
47
+ zIndex
48
+ ]), zIndex;
49
+ };
50
+ // Annotate the CommonJS export names for ESM import in node:
51
+ 0 && (module.exports = {
52
+ useStackedZIndex
53
+ });
54
+ //# sourceMappingURL=useStackedZIndex.js.map
@@ -0,0 +1,6 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/Users/n8/tamagui/code/ui/z-index-stack/src/useStackedZIndex.tsx"],
4
+ "mappings": ";;;;;;;;;;;;;;;AAAA;;;;;mBAAsD,kBACtD,iBAA2D,sBAGrDA,oBAA4D,CAAC,GAEtDC,mBAAmB,SAACC,OAAAA;MAS/BF,oBAAkBG,uBALZ,EAAEC,aAAaC,QAAQC,WAAU,IAAKJ,OACtCK,SAAKC,oBAAAA,GACLL,2BAAuBM,yBAAWC,iCAAAA,GAClCC,gBAAYF,yBAAWG,qCAAAA;AAE7BZ,GAAAA,qBAAAA,mBAAkBG,wBAAAA,oBAAAA,MAAlBH,mBAAkBG,qBAAAA,IAA0B,CAAC;AAC7C,MAAMU,eAAeb,kBAAkBG,oBAAAA,GAEjCE,aAASS,sBAAQ,WAAA;AACrB,QAAI,OAAOR,cAAe;AACxB,aAAOA;AAET,QAAIF,aAAa;AACf,UAAIO;AACF,eAAOA,YAAY;AAGrB,UAAMI,UAAUC,OAAOC,OAAOJ,YAAAA,EAAcK,OAC1C,SAACC,KAAKC,KAAAA;eAAQC,KAAKC,IAAIH,KAAKC,GAAAA;SAC5B,CAAA,GAIIG,QAAQpB,uBAAuB,MAAOY,UAAU;AAGtD,aAAO,OAAOX,eAAgB,WAAWA,cAAcmB,QAAQA;IACjE;AAEA,WAAO;EACT,GAAG;IAACpB;IAAsBG;IAAYF;GAAY;AAElDoB,qCAAU,WAAA;AACR,QAAIpB;AACFS,0BAAaN,EAAAA,IAAMF,QACZ,WAAA;AACL,eAAOQ,aAAaN,EAAAA;MACtB;EAEJ,GAAG;IAACF;GAAO,GAEJA;AACT;",
5
+ "names": ["ZIndicesByContext", "useStackedZIndex", "props", "stackingContextLevel", "stackZIndex", "zIndex", "zIndexProp", "id", "useId", "useContext", "ZIndexStackContext", "hardcoded", "ZIndexHardcodedContext", "stackContext", "useMemo", "highest", "Object", "values", "reduce", "acc", "cur", "Math", "max", "found", "useEffect"]
6
+ }
@@ -0,0 +1,15 @@
1
+ import { useContext } from "react";
2
+ import { ZIndexHardcodedContext, ZIndexStackContext } from "./context";
3
+ import { jsx } from "react/jsx-runtime";
4
+ const StackZIndexContext = ({
5
+ children,
6
+ zIndex
7
+ }) => {
8
+ const existing = useContext(ZIndexStackContext);
9
+ let content = /* @__PURE__ */ jsx(ZIndexStackContext.Provider, { value: existing + 1, children });
10
+ return typeof zIndex < "u" && (content = /* @__PURE__ */ jsx(ZIndexHardcodedContext.Provider, { value: zIndex, children: content })), content;
11
+ };
12
+ export {
13
+ StackZIndexContext
14
+ };
15
+ //# sourceMappingURL=StackZIndex.js.map
@@ -0,0 +1,6 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/StackZIndex.tsx"],
4
+ "mappings": "AAAA,SAAS,kBAAkB;AAC3B,SAAS,wBAAwB,0BAA0B;AASvD;AAPG,MAAM,qBAAqB,CAAC;AAAA,EACjC;AAAA,EACA;AACF,MAAsD;AACpD,QAAM,WAAW,WAAW,kBAAkB;AAE9C,MAAI,UACF,oBAAC,mBAAmB,UAAnB,EAA4B,OAAO,WAAW,GAC5C,UACH;AAGF,SAAI,OAAO,SAAW,QACpB,UACE,oBAAC,uBAAuB,UAAvB,EAAgC,OAAO,QACrC,mBACH,IAIG;AACT;",
5
+ "names": []
6
+ }
@@ -0,0 +1,19 @@
1
+ import { useContext } from "react";
2
+ import { ZIndexHardcodedContext, ZIndexStackContext } from "./context.mjs";
3
+ import { jsx } from "react/jsx-runtime";
4
+ const StackZIndexContext = ({
5
+ children,
6
+ zIndex
7
+ }) => {
8
+ const existing = useContext(ZIndexStackContext);
9
+ let content = /* @__PURE__ */jsx(ZIndexStackContext.Provider, {
10
+ value: existing + 1,
11
+ children
12
+ });
13
+ return typeof zIndex < "u" && (content = /* @__PURE__ */jsx(ZIndexHardcodedContext.Provider, {
14
+ value: zIndex,
15
+ children: content
16
+ })), content;
17
+ };
18
+ export { StackZIndexContext };
19
+ //# sourceMappingURL=StackZIndex.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["useContext","ZIndexHardcodedContext","ZIndexStackContext","jsx","StackZIndexContext","children","zIndex","existing","content","Provider","value"],"sources":["../../src/StackZIndex.tsx"],"sourcesContent":[null],"mappings":"AAAA,SAASA,UAAA,QAAkB;AAC3B,SAASC,sBAAA,EAAwBC,kBAAA,QAA0B;AASvD,SAAAC,GAAA;AAPG,MAAMC,kBAAA,GAAqBA,CAAC;EACjCC,QAAA;EACAC;AACF,MAAsD;EACpD,MAAMC,QAAA,GAAWP,UAAA,CAAWE,kBAAkB;EAE9C,IAAIM,OAAA,GACF,eAAAL,GAAA,CAACD,kBAAA,CAAmBO,QAAA,EAAnB;IAA4BC,KAAA,EAAOH,QAAA,GAAW;IAC5CF;EAAA,CACH;EAGF,OAAI,OAAOC,MAAA,GAAW,QACpBE,OAAA,GACE,eAAAL,GAAA,CAACF,sBAAA,CAAuBQ,QAAA,EAAvB;IAAgCC,KAAA,EAAOJ,MAAA;IACrCD,QAAA,EAAAG;EAAA,CACH,IAIGA,OAAA;AACT","ignoreList":[]}
@@ -0,0 +1,17 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { useContext } from "react";
3
+ import { ZIndexHardcodedContext, ZIndexStackContext } from "./context";
4
+ var StackZIndexContext = function(param) {
5
+ var { children, zIndex } = param, existing = useContext(ZIndexStackContext), content = /* @__PURE__ */ _jsx(ZIndexStackContext.Provider, {
6
+ value: existing + 1,
7
+ children
8
+ });
9
+ return typeof zIndex < "u" && (content = /* @__PURE__ */ _jsx(ZIndexHardcodedContext.Provider, {
10
+ value: zIndex,
11
+ children: content
12
+ })), content;
13
+ };
14
+ export {
15
+ StackZIndexContext
16
+ };
17
+ //# sourceMappingURL=StackZIndex.js.map
@@ -0,0 +1,6 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/Users/n8/tamagui/code/ui/z-index-stack/src/StackZIndex.tsx"],
4
+ "mappings": ";AAAA,SAASA,kBAAkB;AAC3B,SAASC,wBAAwBC,0BAA0B;AAEpD,IAAMC,qBAAqB,SAAA,OAAA;MAAC,EACjCC,UACAC,OAAM,IACyC,OACzCC,WAAWN,WAAWE,kBAAAA,GAExBK,UACF,qBAACL,mBAAmBM,UAAQ;IAACC,OAAOH,WAAW;;;AAKjD,SAAI,OAAOD,SAAW,QACpBE,UACE,qBAACN,uBAAuBO,UAAQ;IAACC,OAAOJ;cACrCE;OAKAA;AACT;",
5
+ "names": ["useContext", "ZIndexHardcodedContext", "ZIndexStackContext", "StackZIndexContext", "children", "zIndex", "existing", "content", "Provider", "value"]
6
+ }
@@ -0,0 +1,7 @@
1
+ import { createContext } from "react";
2
+ const ZIndexStackContext = createContext(1), ZIndexHardcodedContext = createContext(void 0);
3
+ export {
4
+ ZIndexHardcodedContext,
5
+ ZIndexStackContext
6
+ };
7
+ //# sourceMappingURL=context.js.map
@@ -0,0 +1,6 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/context.ts"],
4
+ "mappings": "AAAA,SAAS,qBAAqB;AAGvB,MAAM,qBAAqB,cAAc,CAAC,GAGpC,yBAAyB,cAAkC,MAAS;",
5
+ "names": []
6
+ }
@@ -0,0 +1,5 @@
1
+ import { createContext } from "react";
2
+ const ZIndexStackContext = createContext(1),
3
+ ZIndexHardcodedContext = createContext(void 0);
4
+ export { ZIndexHardcodedContext, ZIndexStackContext };
5
+ //# sourceMappingURL=context.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["createContext","ZIndexStackContext","ZIndexHardcodedContext"],"sources":["../../src/context.ts"],"sourcesContent":[null],"mappings":"AAAA,SAASA,aAAA,QAAqB;AAGvB,MAAMC,kBAAA,GAAqBD,aAAA,CAAc,CAAC;EAGpCE,sBAAA,GAAyBF,aAAA,CAAkC,MAAS","ignoreList":[]}
@@ -0,0 +1,7 @@
1
+ import { createContext } from "react";
2
+ var ZIndexStackContext = createContext(1), ZIndexHardcodedContext = createContext(void 0);
3
+ export {
4
+ ZIndexHardcodedContext,
5
+ ZIndexStackContext
6
+ };
7
+ //# sourceMappingURL=context.js.map
@@ -0,0 +1,6 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/Users/n8/tamagui/code/ui/z-index-stack/src/context.ts"],
4
+ "mappings": "AAAA,SAASA,qBAAqB;AAGvB,IAAMC,qBAAqBD,cAAc,CAAA,GAGnCE,yBAAyBF,cAAkCG,MAAAA;",
5
+ "names": ["createContext", "ZIndexStackContext", "ZIndexHardcodedContext", "undefined"]
6
+ }
@@ -0,0 +1,4 @@
1
+ export * from "./useStackedZIndex";
2
+ export * from "./StackZIndex";
3
+ export * from "./context";
4
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1,6 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/index.ts"],
4
+ "mappings": "AAAA,cAAc;AACd,cAAc;AACd,cAAc;",
5
+ "names": []
6
+ }
@@ -0,0 +1,4 @@
1
+ export * from "./useStackedZIndex.mjs";
2
+ export * from "./StackZIndex.mjs";
3
+ export * from "./context.mjs";
4
+ //# sourceMappingURL=index.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":[],"sources":["../../src/index.ts"],"sourcesContent":[null],"mappings":"AAAA,cAAc;AACd,cAAc;AACd,cAAc","ignoreList":[]}
@@ -0,0 +1,4 @@
1
+ export * from "./useStackedZIndex";
2
+ export * from "./StackZIndex";
3
+ export * from "./context";
4
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1,6 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/Users/n8/tamagui/code/ui/z-index-stack/src/index.ts"],
4
+ "mappings": "AAAA,cAAc;AACd,cAAc;AACd,cAAc;",
5
+ "names": []
6
+ }
@@ -0,0 +1,30 @@
1
+ import { useContext, useEffect, useId, useMemo } from "react";
2
+ import { ZIndexHardcodedContext, ZIndexStackContext } from "./context";
3
+ const ZIndicesByContext = {}, useStackedZIndex = (props) => {
4
+ const { stackZIndex, zIndex: zIndexProp } = props, id = useId(), stackingContextLevel = useContext(ZIndexStackContext), hardcoded = useContext(ZIndexHardcodedContext);
5
+ ZIndicesByContext[stackingContextLevel] ||= {};
6
+ const stackContext = ZIndicesByContext[stackingContextLevel], zIndex = useMemo(() => {
7
+ if (typeof zIndexProp == "number")
8
+ return zIndexProp;
9
+ if (stackZIndex) {
10
+ if (hardcoded)
11
+ return hardcoded + 1;
12
+ const highest = Object.values(stackContext).reduce(
13
+ (acc, cur) => Math.max(acc, cur),
14
+ 0
15
+ ), found = stackingContextLevel * 5e3 + highest + 1;
16
+ return typeof stackZIndex == "number" ? stackZIndex + found : found;
17
+ }
18
+ return 1;
19
+ }, [stackingContextLevel, zIndexProp, stackZIndex]);
20
+ return useEffect(() => {
21
+ if (stackZIndex)
22
+ return stackContext[id] = zIndex, () => {
23
+ delete stackContext[id];
24
+ };
25
+ }, [zIndex]), zIndex;
26
+ };
27
+ export {
28
+ useStackedZIndex
29
+ };
30
+ //# sourceMappingURL=useStackedZIndex.js.map
@@ -0,0 +1,6 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/useStackedZIndex.tsx"],
4
+ "mappings": "AAAA,SAAS,YAAY,WAAW,OAAO,eAAe;AACtD,SAAS,wBAAwB,0BAA0B;AAG3D,MAAM,oBAA4D,CAAC,GAEtD,mBAAmB,CAAC,UAG3B;AACJ,QAAM,EAAE,aAAa,QAAQ,WAAW,IAAI,OACtC,KAAK,MAAM,GACX,uBAAuB,WAAW,kBAAkB,GACpD,YAAY,WAAW,sBAAsB;AAEnD,oBAAkB,oBAAoB,MAAM,CAAC;AAC7C,QAAM,eAAe,kBAAkB,oBAAoB,GAErD,SAAS,QAAQ,MAAM;AAC3B,QAAI,OAAO,cAAe;AACxB,aAAO;AAET,QAAI,aAAa;AACf,UAAI;AACF,eAAO,YAAY;AAGrB,YAAM,UAAU,OAAO,OAAO,YAAY,EAAE;AAAA,QAC1C,CAAC,KAAK,QAAQ,KAAK,IAAI,KAAK,GAAG;AAAA,QAC/B;AAAA,MACF,GAGM,QAAQ,uBAAuB,MAAO,UAAU;AAGtD,aAAO,OAAO,eAAgB,WAAW,cAAc,QAAQ;AAAA,IACjE;AAEA,WAAO;AAAA,EACT,GAAG,CAAC,sBAAsB,YAAY,WAAW,CAAC;AAElD,mBAAU,MAAM;AACd,QAAI;AACF,0BAAa,EAAE,IAAI,QACZ,MAAM;AACX,eAAO,aAAa,EAAE;AAAA,MACxB;AAAA,EAEJ,GAAG,CAAC,MAAM,CAAC,GAEJ;AACT;",
5
+ "names": []
6
+ }
@@ -0,0 +1,31 @@
1
+ import { useContext, useEffect, useId, useMemo } from "react";
2
+ import { ZIndexHardcodedContext, ZIndexStackContext } from "./context.mjs";
3
+ const ZIndicesByContext = {},
4
+ useStackedZIndex = props => {
5
+ const {
6
+ stackZIndex,
7
+ zIndex: zIndexProp
8
+ } = props,
9
+ id = useId(),
10
+ stackingContextLevel = useContext(ZIndexStackContext),
11
+ hardcoded = useContext(ZIndexHardcodedContext);
12
+ ZIndicesByContext[stackingContextLevel] ||= {};
13
+ const stackContext = ZIndicesByContext[stackingContextLevel],
14
+ zIndex = useMemo(() => {
15
+ if (typeof zIndexProp == "number") return zIndexProp;
16
+ if (stackZIndex) {
17
+ if (hardcoded) return hardcoded + 1;
18
+ const highest = Object.values(stackContext).reduce((acc, cur) => Math.max(acc, cur), 0),
19
+ found = stackingContextLevel * 5e3 + highest + 1;
20
+ return typeof stackZIndex == "number" ? stackZIndex + found : found;
21
+ }
22
+ return 1;
23
+ }, [stackingContextLevel, zIndexProp, stackZIndex]);
24
+ return useEffect(() => {
25
+ if (stackZIndex) return stackContext[id] = zIndex, () => {
26
+ delete stackContext[id];
27
+ };
28
+ }, [zIndex]), zIndex;
29
+ };
30
+ export { useStackedZIndex };
31
+ //# sourceMappingURL=useStackedZIndex.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["useContext","useEffect","useId","useMemo","ZIndexHardcodedContext","ZIndexStackContext","ZIndicesByContext","useStackedZIndex","props","stackZIndex","zIndex","zIndexProp","id","stackingContextLevel","hardcoded","stackContext","highest","Object","values","reduce","acc","cur","Math","max","found"],"sources":["../../src/useStackedZIndex.tsx"],"sourcesContent":[null],"mappings":"AAAA,SAASA,UAAA,EAAYC,SAAA,EAAWC,KAAA,EAAOC,OAAA,QAAe;AACtD,SAASC,sBAAA,EAAwBC,kBAAA,QAA0B;AAG3D,MAAMC,iBAAA,GAA4D,CAAC;EAEtDC,gBAAA,GAAoBC,KAAA,IAG3B;IACJ,MAAM;QAAEC,WAAA;QAAaC,MAAA,EAAQC;MAAW,IAAIH,KAAA;MACtCI,EAAA,GAAKV,KAAA,CAAM;MACXW,oBAAA,GAAuBb,UAAA,CAAWK,kBAAkB;MACpDS,SAAA,GAAYd,UAAA,CAAWI,sBAAsB;IAEnDE,iBAAA,CAAkBO,oBAAoB,MAAM,CAAC;IAC7C,MAAME,YAAA,GAAeT,iBAAA,CAAkBO,oBAAoB;MAErDH,MAAA,GAASP,OAAA,CAAQ,MAAM;QAC3B,IAAI,OAAOQ,UAAA,IAAe,UACxB,OAAOA,UAAA;QAET,IAAIF,WAAA,EAAa;UACf,IAAIK,SAAA,EACF,OAAOA,SAAA,GAAY;UAGrB,MAAME,OAAA,GAAUC,MAAA,CAAOC,MAAA,CAAOH,YAAY,EAAEI,MAAA,CAC1C,CAACC,GAAA,EAAKC,GAAA,KAAQC,IAAA,CAAKC,GAAA,CAAIH,GAAA,EAAKC,GAAG,GAC/B,CACF;YAGMG,KAAA,GAAQX,oBAAA,GAAuB,MAAOG,OAAA,GAAU;UAGtD,OAAO,OAAOP,WAAA,IAAgB,WAAWA,WAAA,GAAce,KAAA,GAAQA,KAAA;QACjE;QAEA,OAAO;MACT,GAAG,CAACX,oBAAA,EAAsBF,UAAA,EAAYF,WAAW,CAAC;IAElD,OAAAR,SAAA,CAAU,MAAM;MACd,IAAIQ,WAAA,EACF,OAAAM,YAAA,CAAaH,EAAE,IAAIF,MAAA,EACZ,MAAM;QACX,OAAOK,YAAA,CAAaH,EAAE;MACxB;IAEJ,GAAG,CAACF,MAAM,CAAC,GAEJA,MAAA;EACT","ignoreList":[]}
@@ -0,0 +1,35 @@
1
+ import { useContext, useEffect, useId, useMemo } from "react";
2
+ import { ZIndexHardcodedContext, ZIndexStackContext } from "./context";
3
+ var ZIndicesByContext = {}, useStackedZIndex = function(props) {
4
+ var _ZIndicesByContext, _stackingContextLevel, { stackZIndex, zIndex: zIndexProp } = props, id = useId(), stackingContextLevel = useContext(ZIndexStackContext), hardcoded = useContext(ZIndexHardcodedContext);
5
+ (_ZIndicesByContext = ZIndicesByContext)[_stackingContextLevel = stackingContextLevel] || (_ZIndicesByContext[_stackingContextLevel] = {});
6
+ var stackContext = ZIndicesByContext[stackingContextLevel], zIndex = useMemo(function() {
7
+ if (typeof zIndexProp == "number")
8
+ return zIndexProp;
9
+ if (stackZIndex) {
10
+ if (hardcoded)
11
+ return hardcoded + 1;
12
+ var highest = Object.values(stackContext).reduce(function(acc, cur) {
13
+ return Math.max(acc, cur);
14
+ }, 0), found = stackingContextLevel * 5e3 + highest + 1;
15
+ return typeof stackZIndex == "number" ? stackZIndex + found : found;
16
+ }
17
+ return 1;
18
+ }, [
19
+ stackingContextLevel,
20
+ zIndexProp,
21
+ stackZIndex
22
+ ]);
23
+ return useEffect(function() {
24
+ if (stackZIndex)
25
+ return stackContext[id] = zIndex, function() {
26
+ delete stackContext[id];
27
+ };
28
+ }, [
29
+ zIndex
30
+ ]), zIndex;
31
+ };
32
+ export {
33
+ useStackedZIndex
34
+ };
35
+ //# sourceMappingURL=useStackedZIndex.js.map
@@ -0,0 +1,6 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/Users/n8/tamagui/code/ui/z-index-stack/src/useStackedZIndex.tsx"],
4
+ "mappings": "AAAA,SAASA,YAAYC,WAAWC,OAAOC,eAAe;AACtD,SAASC,wBAAwBC,0BAA0B;AAG3D,IAAMC,oBAA4D,CAAC,GAEtDC,mBAAmB,SAACC,OAAAA;MAS/BF,oBAAkBG,uBALZ,EAAEC,aAAaC,QAAQC,WAAU,IAAKJ,OACtCK,KAAKX,MAAAA,GACLO,uBAAuBT,WAAWK,kBAAAA,GAClCS,YAAYd,WAAWI,sBAAAA;AAE7BE,GAAAA,qBAAAA,mBAAkBG,wBAAAA,oBAAAA,MAAlBH,mBAAkBG,qBAAAA,IAA0B,CAAC;AAC7C,MAAMM,eAAeT,kBAAkBG,oBAAAA,GAEjCE,SAASR,QAAQ,WAAA;AACrB,QAAI,OAAOS,cAAe;AACxB,aAAOA;AAET,QAAIF,aAAa;AACf,UAAII;AACF,eAAOA,YAAY;AAGrB,UAAME,UAAUC,OAAOC,OAAOH,YAAAA,EAAcI,OAC1C,SAACC,KAAKC,KAAAA;eAAQC,KAAKC,IAAIH,KAAKC,GAAAA;SAC5B,CAAA,GAIIG,QAAQf,uBAAuB,MAAOO,UAAU;AAGtD,aAAO,OAAON,eAAgB,WAAWA,cAAcc,QAAQA;IACjE;AAEA,WAAO;EACT,GAAG;IAACf;IAAsBG;IAAYF;GAAY;AAElDT,mBAAU,WAAA;AACR,QAAIS;AACFK,0BAAaF,EAAAA,IAAMF,QACZ,WAAA;AACL,eAAOI,aAAaF,EAAAA;MACtB;EAEJ,GAAG;IAACF;GAAO,GAEJA;AACT;",
5
+ "names": ["useContext", "useEffect", "useId", "useMemo", "ZIndexHardcodedContext", "ZIndexStackContext", "ZIndicesByContext", "useStackedZIndex", "props", "stackingContextLevel", "stackZIndex", "zIndex", "zIndexProp", "id", "hardcoded", "stackContext", "highest", "Object", "values", "reduce", "acc", "cur", "Math", "max", "found"]
6
+ }
package/package.json ADDED
@@ -0,0 +1,40 @@
1
+ {
2
+ "name": "@tamagui/z-index-stack",
3
+ "version": "1.125.0",
4
+ "source": "src/index.ts",
5
+ "types": "./types/index.d.ts",
6
+ "main": "dist/cjs",
7
+ "module": "dist/esm",
8
+ "files": [
9
+ "src",
10
+ "types",
11
+ "dist"
12
+ ],
13
+ "scripts": {
14
+ "build": "tamagui-build",
15
+ "watch": "tamagui-build --watch",
16
+ "lint": "biome check src",
17
+ "lint:fix": "biome check --write src",
18
+ "clean": "tamagui-build clean",
19
+ "clean:build": "tamagui-build clean:build"
20
+ },
21
+ "exports": {
22
+ "./package.json": "./package.json",
23
+ ".": {
24
+ "react-native": {
25
+ "import": "./dist/esm/index.native.js",
26
+ "require": "./dist/cjs/index.native.js"
27
+ },
28
+ "types": "./types/index.d.ts",
29
+ "import": "./dist/esm/index.mjs",
30
+ "require": "./dist/cjs/index.cjs",
31
+ "default": "./dist/cjs/index.native.js"
32
+ }
33
+ },
34
+ "devDependencies": {
35
+ "@tamagui/build": "1.125.0"
36
+ },
37
+ "publishConfig": {
38
+ "access": "public"
39
+ }
40
+ }
@@ -0,0 +1,25 @@
1
+ import { useContext } from 'react'
2
+ import { ZIndexHardcodedContext, ZIndexStackContext } from './context'
3
+
4
+ export const StackZIndexContext = ({
5
+ children,
6
+ zIndex,
7
+ }: { children: React.ReactNode; zIndex?: number }) => {
8
+ const existing = useContext(ZIndexStackContext)
9
+
10
+ let content = (
11
+ <ZIndexStackContext.Provider value={existing + 1}>
12
+ {children}
13
+ </ZIndexStackContext.Provider>
14
+ )
15
+
16
+ if (typeof zIndex !== 'undefined') {
17
+ content = (
18
+ <ZIndexHardcodedContext.Provider value={zIndex}>
19
+ {content}
20
+ </ZIndexHardcodedContext.Provider>
21
+ )
22
+ }
23
+
24
+ return content
25
+ }
package/src/context.ts ADDED
@@ -0,0 +1,7 @@
1
+ import { createContext } from 'react'
2
+
3
+ // stacks vertically through tree, based on nesting
4
+ export const ZIndexStackContext = createContext(1)
5
+
6
+ // if setting to overriden z index
7
+ export const ZIndexHardcodedContext = createContext<number | undefined>(undefined)
package/src/index.ts ADDED
@@ -0,0 +1,3 @@
1
+ export * from './useStackedZIndex'
2
+ export * from './StackZIndex'
3
+ export * from './context'
@@ -0,0 +1,53 @@
1
+ import { useContext, useEffect, useId, useMemo } from 'react'
2
+ import { ZIndexHardcodedContext, ZIndexStackContext } from './context'
3
+
4
+ // this stacks horizontally - just based on which mounted last within a stacking context
5
+ const ZIndicesByContext: Record<number, Record<string, number>> = {}
6
+
7
+ export const useStackedZIndex = (props: {
8
+ zIndex?: number
9
+ stackZIndex?: boolean | number
10
+ }) => {
11
+ const { stackZIndex, zIndex: zIndexProp } = props
12
+ const id = useId()
13
+ const stackingContextLevel = useContext(ZIndexStackContext)
14
+ const hardcoded = useContext(ZIndexHardcodedContext)
15
+
16
+ ZIndicesByContext[stackingContextLevel] ||= {}
17
+ const stackContext = ZIndicesByContext[stackingContextLevel]
18
+
19
+ const zIndex = useMemo(() => {
20
+ if (typeof zIndexProp === 'number') {
21
+ return zIndexProp
22
+ }
23
+ if (stackZIndex) {
24
+ if (hardcoded) {
25
+ return hardcoded + 1
26
+ }
27
+
28
+ const highest = Object.values(stackContext).reduce(
29
+ (acc, cur) => Math.max(acc, cur),
30
+ 0
31
+ )
32
+
33
+ // each context level elevates 5k
34
+ const found = stackingContextLevel * 5000 + highest + 1
35
+
36
+ // setting stackZIndex to a number lets you increase it further
37
+ return typeof stackZIndex === 'number' ? stackZIndex + found : found
38
+ }
39
+
40
+ return 1
41
+ }, [stackingContextLevel, zIndexProp, stackZIndex])
42
+
43
+ useEffect(() => {
44
+ if (stackZIndex) {
45
+ stackContext[id] = zIndex
46
+ return () => {
47
+ delete stackContext[id]
48
+ }
49
+ }
50
+ }, [zIndex])
51
+
52
+ return zIndex
53
+ }
@@ -0,0 +1,5 @@
1
+ export declare const StackZIndexContext: ({ children, zIndex, }: {
2
+ children: React.ReactNode;
3
+ zIndex?: number;
4
+ }) => import("react/jsx-runtime").JSX.Element;
5
+ //# sourceMappingURL=StackZIndex.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"StackZIndex.d.ts","sourceRoot":"","sources":["../src/StackZIndex.tsx"],"names":[],"mappings":"AAGA,eAAO,MAAM,kBAAkB,0BAG5B;IAAE,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAAC,MAAM,CAAC,EAAE,MAAM,CAAA;CAAE,4CAkBhD,CAAA"}
@@ -0,0 +1,3 @@
1
+ export declare const ZIndexStackContext: import("react").Context<number>;
2
+ export declare const ZIndexHardcodedContext: import("react").Context<number | undefined>;
3
+ //# sourceMappingURL=context.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../src/context.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,kBAAkB,iCAAmB,CAAA;AAGlD,eAAO,MAAM,sBAAsB,6CAA+C,CAAA"}
@@ -0,0 +1,4 @@
1
+ export * from './useStackedZIndex';
2
+ export * from './StackZIndex';
3
+ export * from './context';
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,CAAA;AAClC,cAAc,eAAe,CAAA;AAC7B,cAAc,WAAW,CAAA"}
@@ -0,0 +1,5 @@
1
+ export declare const useStackedZIndex: (props: {
2
+ zIndex?: number;
3
+ stackZIndex?: boolean | number;
4
+ }) => number;
5
+ //# sourceMappingURL=useStackedZIndex.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useStackedZIndex.d.ts","sourceRoot":"","sources":["../src/useStackedZIndex.tsx"],"names":[],"mappings":"AAMA,eAAO,MAAM,gBAAgB,UAAW;IACtC,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,WAAW,CAAC,EAAE,OAAO,GAAG,MAAM,CAAA;CAC/B,WA2CA,CAAA"}