@bigbinary/neetoui 5.2.9 → 5.2.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/formik.cjs.js +51 -12
- package/formik.cjs.js.map +1 -1
- package/formik.js +52 -13
- package/formik.js.map +1 -1
- package/index.cjs.js +57 -15
- package/index.cjs.js.map +1 -1
- package/index.d.ts +1 -0
- package/index.js +58 -16
- package/index.js.map +1 -1
- package/layouts.cjs.js.map +1 -1
- package/layouts.js.map +1 -1
- package/managers.cjs.js +26 -2
- package/managers.cjs.js.map +1 -1
- package/managers.js +26 -2
- package/managers.js.map +1 -1
- package/package.json +1 -1
package/managers.cjs.js
CHANGED
|
@@ -57,25 +57,45 @@ var OverlayManager = /*#__PURE__*/function () {
|
|
|
57
57
|
_classCallCheck(this, OverlayManager);
|
|
58
58
|
this.overlays = [];
|
|
59
59
|
this.previouslyFocusedElements = [];
|
|
60
|
+
this.subscribers = new Set();
|
|
60
61
|
this.add = this.add.bind(this);
|
|
61
62
|
this.remove = this.remove.bind(this);
|
|
62
63
|
this.isTopOverlay = this.isTopOverlay.bind(this);
|
|
63
64
|
this.hasOverlays = this.hasOverlays.bind(this);
|
|
64
65
|
this.getFinalFocusInOverlay = this.getFinalFocusInOverlay.bind(this);
|
|
65
66
|
this.getTopMostOverlay = this.getTopMostOverlay.bind(this);
|
|
67
|
+
this.subscribe = this.subscribe.bind(this);
|
|
66
68
|
}
|
|
67
69
|
_createClass(OverlayManager, [{
|
|
70
|
+
key: "subscribe",
|
|
71
|
+
value: function subscribe(callback) {
|
|
72
|
+
var _this = this;
|
|
73
|
+
this.subscribers.add(callback);
|
|
74
|
+
return function () {
|
|
75
|
+
return _this.subscribers["delete"](callback);
|
|
76
|
+
};
|
|
77
|
+
}
|
|
78
|
+
}, {
|
|
68
79
|
key: "add",
|
|
69
80
|
value: function add(overlay, elementToFocus) {
|
|
70
81
|
this.overlays.push(overlay);
|
|
71
82
|
this.previouslyFocusedElements.push(elementToFocus);
|
|
83
|
+
this.subscribers.forEach(function (subscriber) {
|
|
84
|
+
return subscriber();
|
|
85
|
+
});
|
|
72
86
|
}
|
|
73
87
|
}, {
|
|
74
88
|
key: "remove",
|
|
75
|
-
value: function remove(overlay) {
|
|
89
|
+
value: function remove(overlay, elementToFocus) {
|
|
76
90
|
this.overlays = this.overlays.filter(function (_overlay) {
|
|
77
91
|
return _overlay !== overlay;
|
|
78
92
|
});
|
|
93
|
+
this.previouslyFocusedElements = this.previouslyFocusedElements.filter(function (_elementToFocus) {
|
|
94
|
+
return _elementToFocus !== elementToFocus;
|
|
95
|
+
});
|
|
96
|
+
this.subscribers.forEach(function (subscriber) {
|
|
97
|
+
return subscriber();
|
|
98
|
+
});
|
|
79
99
|
}
|
|
80
100
|
}, {
|
|
81
101
|
key: "isTopOverlay",
|
|
@@ -91,7 +111,11 @@ var OverlayManager = /*#__PURE__*/function () {
|
|
|
91
111
|
}, {
|
|
92
112
|
key: "getFinalFocusInOverlay",
|
|
93
113
|
value: function getFinalFocusInOverlay() {
|
|
94
|
-
|
|
114
|
+
var finalFocus = this.previouslyFocusedElements.pop();
|
|
115
|
+
this.subscribers.forEach(function (subscriber) {
|
|
116
|
+
return subscriber();
|
|
117
|
+
});
|
|
118
|
+
return finalFocus;
|
|
95
119
|
}
|
|
96
120
|
}, {
|
|
97
121
|
key: "getTopMostOverlay",
|
package/managers.cjs.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"managers.cjs.js","sources":["node_modules/@babel/runtime/helpers/esm/classCallCheck.js","node_modules/@babel/runtime/helpers/esm/typeof.js","node_modules/@babel/runtime/helpers/esm/toPrimitive.js","node_modules/@babel/runtime/helpers/esm/toPropertyKey.js","node_modules/@babel/runtime/helpers/esm/createClass.js","src/managers/overlayManager.js"],"sourcesContent":["export default function _classCallCheck(instance, Constructor) {\n if (!(instance instanceof Constructor)) {\n throw new TypeError(\"Cannot call a class as a function\");\n }\n}","export default function _typeof(obj) {\n \"@babel/helpers - typeof\";\n\n return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (obj) {\n return typeof obj;\n } : function (obj) {\n return obj && \"function\" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj;\n }, _typeof(obj);\n}","import _typeof from \"./typeof.js\";\nexport default function _toPrimitive(input, hint) {\n if (_typeof(input) !== \"object\" || input === null) return input;\n var prim = input[Symbol.toPrimitive];\n if (prim !== undefined) {\n var res = prim.call(input, hint || \"default\");\n if (_typeof(res) !== \"object\") return res;\n throw new TypeError(\"@@toPrimitive must return a primitive value.\");\n }\n return (hint === \"string\" ? String : Number)(input);\n}","import _typeof from \"./typeof.js\";\nimport toPrimitive from \"./toPrimitive.js\";\nexport default function _toPropertyKey(arg) {\n var key = toPrimitive(arg, \"string\");\n return _typeof(key) === \"symbol\" ? key : String(key);\n}","import toPropertyKey from \"./toPropertyKey.js\";\nfunction _defineProperties(target, props) {\n for (var i = 0; i < props.length; i++) {\n var descriptor = props[i];\n descriptor.enumerable = descriptor.enumerable || false;\n descriptor.configurable = true;\n if (\"value\" in descriptor) descriptor.writable = true;\n Object.defineProperty(target, toPropertyKey(descriptor.key), descriptor);\n }\n}\nexport default function _createClass(Constructor, protoProps, staticProps) {\n if (protoProps) _defineProperties(Constructor.prototype, protoProps);\n if (staticProps) _defineProperties(Constructor, staticProps);\n Object.defineProperty(Constructor, \"prototype\", {\n writable: false\n });\n return Constructor;\n}","class OverlayManager {\n constructor() {\n this.overlays = [];\n this.previouslyFocusedElements = [];\n this.add = this.add.bind(this);\n this.remove = this.remove.bind(this);\n this.isTopOverlay = this.isTopOverlay.bind(this);\n this.hasOverlays = this.hasOverlays.bind(this);\n this.getFinalFocusInOverlay = this.getFinalFocusInOverlay.bind(this);\n this.getTopMostOverlay = this.getTopMostOverlay.bind(this);\n }\n\n add(overlay, elementToFocus) {\n this.overlays.push(overlay);\n this.previouslyFocusedElements.push(elementToFocus);\n }\n\n remove(overlay) {\n this.overlays = this.overlays.filter(_overlay => _overlay !== overlay);\n }\n\n isTopOverlay(overlay) {\n const topMostOverlay = this.overlays[this.overlays.length - 1];\n\n return topMostOverlay === overlay;\n }\n\n hasOverlays() {\n return this.overlays.length > 0;\n }\n\n getFinalFocusInOverlay() {\n
|
|
1
|
+
{"version":3,"file":"managers.cjs.js","sources":["node_modules/@babel/runtime/helpers/esm/classCallCheck.js","node_modules/@babel/runtime/helpers/esm/typeof.js","node_modules/@babel/runtime/helpers/esm/toPrimitive.js","node_modules/@babel/runtime/helpers/esm/toPropertyKey.js","node_modules/@babel/runtime/helpers/esm/createClass.js","src/managers/overlayManager.js"],"sourcesContent":["export default function _classCallCheck(instance, Constructor) {\n if (!(instance instanceof Constructor)) {\n throw new TypeError(\"Cannot call a class as a function\");\n }\n}","export default function _typeof(obj) {\n \"@babel/helpers - typeof\";\n\n return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (obj) {\n return typeof obj;\n } : function (obj) {\n return obj && \"function\" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj;\n }, _typeof(obj);\n}","import _typeof from \"./typeof.js\";\nexport default function _toPrimitive(input, hint) {\n if (_typeof(input) !== \"object\" || input === null) return input;\n var prim = input[Symbol.toPrimitive];\n if (prim !== undefined) {\n var res = prim.call(input, hint || \"default\");\n if (_typeof(res) !== \"object\") return res;\n throw new TypeError(\"@@toPrimitive must return a primitive value.\");\n }\n return (hint === \"string\" ? String : Number)(input);\n}","import _typeof from \"./typeof.js\";\nimport toPrimitive from \"./toPrimitive.js\";\nexport default function _toPropertyKey(arg) {\n var key = toPrimitive(arg, \"string\");\n return _typeof(key) === \"symbol\" ? key : String(key);\n}","import toPropertyKey from \"./toPropertyKey.js\";\nfunction _defineProperties(target, props) {\n for (var i = 0; i < props.length; i++) {\n var descriptor = props[i];\n descriptor.enumerable = descriptor.enumerable || false;\n descriptor.configurable = true;\n if (\"value\" in descriptor) descriptor.writable = true;\n Object.defineProperty(target, toPropertyKey(descriptor.key), descriptor);\n }\n}\nexport default function _createClass(Constructor, protoProps, staticProps) {\n if (protoProps) _defineProperties(Constructor.prototype, protoProps);\n if (staticProps) _defineProperties(Constructor, staticProps);\n Object.defineProperty(Constructor, \"prototype\", {\n writable: false\n });\n return Constructor;\n}","class OverlayManager {\n constructor() {\n this.overlays = [];\n this.previouslyFocusedElements = [];\n this.subscribers = new Set();\n this.add = this.add.bind(this);\n this.remove = this.remove.bind(this);\n this.isTopOverlay = this.isTopOverlay.bind(this);\n this.hasOverlays = this.hasOverlays.bind(this);\n this.getFinalFocusInOverlay = this.getFinalFocusInOverlay.bind(this);\n this.getTopMostOverlay = this.getTopMostOverlay.bind(this);\n this.subscribe = this.subscribe.bind(this);\n }\n\n subscribe(callback) {\n this.subscribers.add(callback);\n\n return () => this.subscribers.delete(callback);\n }\n\n add(overlay, elementToFocus) {\n this.overlays.push(overlay);\n this.previouslyFocusedElements.push(elementToFocus);\n\n this.subscribers.forEach(subscriber => subscriber());\n }\n\n remove(overlay, elementToFocus) {\n this.overlays = this.overlays.filter(_overlay => _overlay !== overlay);\n this.previouslyFocusedElements = this.previouslyFocusedElements.filter(\n _elementToFocus => _elementToFocus !== elementToFocus\n );\n\n this.subscribers.forEach(subscriber => subscriber());\n }\n\n isTopOverlay(overlay) {\n const topMostOverlay = this.overlays[this.overlays.length - 1];\n\n return topMostOverlay === overlay;\n }\n\n hasOverlays() {\n return this.overlays.length > 0;\n }\n\n getFinalFocusInOverlay() {\n const finalFocus = this.previouslyFocusedElements.pop();\n this.subscribers.forEach(subscriber => subscriber());\n\n return finalFocus;\n }\n\n getTopMostOverlay() {\n return this.overlays[this.overlays.length - 1];\n }\n}\n\nexport const manager = new OverlayManager();\n"],"names":["toPrimitive","toPropertyKey","OverlayManager","_classCallCheck","overlays","previouslyFocusedElements","subscribers","Set","add","bind","remove","isTopOverlay","hasOverlays","getFinalFocusInOverlay","getTopMostOverlay","subscribe","_createClass","key","value","callback","_this","overlay","elementToFocus","push","forEach","subscriber","filter","_overlay","_elementToFocus","topMostOverlay","length","finalFocus","pop","manager"],"mappings":";;;;AAAe,SAAS,eAAe,CAAC,QAAQ,EAAE,WAAW,EAAE;AAC/D,EAAE,IAAI,EAAE,QAAQ,YAAY,WAAW,CAAC,EAAE;AAC1C,IAAI,MAAM,IAAI,SAAS,CAAC,mCAAmC,CAAC,CAAC;AAC7D,GAAG;AACH;;ACJe,SAAS,OAAO,CAAC,GAAG,EAAE;AACrC,EAAE,yBAAyB,CAAC;AAC5B;AACA,EAAE,OAAO,OAAO,GAAG,UAAU,IAAI,OAAO,MAAM,IAAI,QAAQ,IAAI,OAAO,MAAM,CAAC,QAAQ,GAAG,UAAU,GAAG,EAAE;AACtG,IAAI,OAAO,OAAO,GAAG,CAAC;AACtB,GAAG,GAAG,UAAU,GAAG,EAAE;AACrB,IAAI,OAAO,GAAG,IAAI,UAAU,IAAI,OAAO,MAAM,IAAI,GAAG,CAAC,WAAW,KAAK,MAAM,IAAI,GAAG,KAAK,MAAM,CAAC,SAAS,GAAG,QAAQ,GAAG,OAAO,GAAG,CAAC;AAChI,GAAG,EAAE,OAAO,CAAC,GAAG,CAAC,CAAC;AAClB;;ACPe,SAAS,YAAY,CAAC,KAAK,EAAE,IAAI,EAAE;AAClD,EAAE,IAAI,OAAO,CAAC,KAAK,CAAC,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,EAAE,OAAO,KAAK,CAAC;AAClE,EAAE,IAAI,IAAI,GAAG,KAAK,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC;AACvC,EAAE,IAAI,IAAI,KAAK,SAAS,EAAE;AAC1B,IAAI,IAAI,GAAG,GAAG,IAAI,CAAC,IAAI,CAAC,KAAK,EAAE,IAAI,IAAI,SAAS,CAAC,CAAC;AAClD,IAAI,IAAI,OAAO,CAAC,GAAG,CAAC,KAAK,QAAQ,EAAE,OAAO,GAAG,CAAC;AAC9C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CAAC,CAAC,CAAA;MAE9D,OAAOD,cAAc,KAAKR,OAAO,CAAA;AACnC,KAAA;AAAC,GAAA,EAAA;IAAAJ,GAAA,EAAA,aAAA;IAAAC,KAAA,EAED,SAAAN,WAAAA,GAAc;AACZ,MAAA,OAAO,IAAI,CAACR,QAAQ,CAAC0B,MAAM,GAAG,CAAC,CAAA;AACjC,KAAA;AAAC,GAAA,EAAA;IAAAb,GAAA,EAAA,wBAAA;IAAAC,KAAA,EAED,SAAAL,sBAAAA,GAAyB;AACvB,MAAA,IAAMkB,UAAU,GAAG,IAAI,CAAC1B,yBAAyB,CAAC2B,GAAG,EAAE,CAAA;AACvD,MAAA,IAAI,CAAC1B,WAAW,CAACkB,OAAO,CAAC,UAAAC,UAAU,EAAA;AAAA,QAAA,OAAIA,UAAU,EAAE,CAAA;OAAC,CAAA,CAAA;AAEpD,MAAA,OAAOM,UAAU,CAAA;AACnB,KAAA;AAAC,GAAA,EAAA;IAAAd,GAAA,EAAA,mBAAA;IAAAC,KAAA,EAED,SAAAJ,iBAAAA,GAAoB;MAClB,OAAO,IAAI,CAACV,QAAQ,CAAC,IAAI,CAACA,QAAQ,CAAC0B,MAAM,GAAG,CAAC,CAAC,CAAA;AAChD,KAAA;AAAC,GAAA,CAAA,CAAA,CAAA;AAAA,EAAA,OAAA5B,cAAA,CAAA;AAAA,CAAA,EAAA,CAAA;AAGU+B,IAAAA,OAAO,GAAG,IAAI/B,cAAc;;;;"}
|
package/managers.js
CHANGED
|
@@ -53,25 +53,45 @@ var OverlayManager = /*#__PURE__*/function () {
|
|
|
53
53
|
_classCallCheck(this, OverlayManager);
|
|
54
54
|
this.overlays = [];
|
|
55
55
|
this.previouslyFocusedElements = [];
|
|
56
|
+
this.subscribers = new Set();
|
|
56
57
|
this.add = this.add.bind(this);
|
|
57
58
|
this.remove = this.remove.bind(this);
|
|
58
59
|
this.isTopOverlay = this.isTopOverlay.bind(this);
|
|
59
60
|
this.hasOverlays = this.hasOverlays.bind(this);
|
|
60
61
|
this.getFinalFocusInOverlay = this.getFinalFocusInOverlay.bind(this);
|
|
61
62
|
this.getTopMostOverlay = this.getTopMostOverlay.bind(this);
|
|
63
|
+
this.subscribe = this.subscribe.bind(this);
|
|
62
64
|
}
|
|
63
65
|
_createClass(OverlayManager, [{
|
|
66
|
+
key: "subscribe",
|
|
67
|
+
value: function subscribe(callback) {
|
|
68
|
+
var _this = this;
|
|
69
|
+
this.subscribers.add(callback);
|
|
70
|
+
return function () {
|
|
71
|
+
return _this.subscribers["delete"](callback);
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
}, {
|
|
64
75
|
key: "add",
|
|
65
76
|
value: function add(overlay, elementToFocus) {
|
|
66
77
|
this.overlays.push(overlay);
|
|
67
78
|
this.previouslyFocusedElements.push(elementToFocus);
|
|
79
|
+
this.subscribers.forEach(function (subscriber) {
|
|
80
|
+
return subscriber();
|
|
81
|
+
});
|
|
68
82
|
}
|
|
69
83
|
}, {
|
|
70
84
|
key: "remove",
|
|
71
|
-
value: function remove(overlay) {
|
|
85
|
+
value: function remove(overlay, elementToFocus) {
|
|
72
86
|
this.overlays = this.overlays.filter(function (_overlay) {
|
|
73
87
|
return _overlay !== overlay;
|
|
74
88
|
});
|
|
89
|
+
this.previouslyFocusedElements = this.previouslyFocusedElements.filter(function (_elementToFocus) {
|
|
90
|
+
return _elementToFocus !== elementToFocus;
|
|
91
|
+
});
|
|
92
|
+
this.subscribers.forEach(function (subscriber) {
|
|
93
|
+
return subscriber();
|
|
94
|
+
});
|
|
75
95
|
}
|
|
76
96
|
}, {
|
|
77
97
|
key: "isTopOverlay",
|
|
@@ -87,7 +107,11 @@ var OverlayManager = /*#__PURE__*/function () {
|
|
|
87
107
|
}, {
|
|
88
108
|
key: "getFinalFocusInOverlay",
|
|
89
109
|
value: function getFinalFocusInOverlay() {
|
|
90
|
-
|
|
110
|
+
var finalFocus = this.previouslyFocusedElements.pop();
|
|
111
|
+
this.subscribers.forEach(function (subscriber) {
|
|
112
|
+
return subscriber();
|
|
113
|
+
});
|
|
114
|
+
return finalFocus;
|
|
91
115
|
}
|
|
92
116
|
}, {
|
|
93
117
|
key: "getTopMostOverlay",
|
package/managers.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"managers.js","sources":["node_modules/@babel/runtime/helpers/esm/classCallCheck.js","node_modules/@babel/runtime/helpers/esm/typeof.js","node_modules/@babel/runtime/helpers/esm/toPrimitive.js","node_modules/@babel/runtime/helpers/esm/toPropertyKey.js","node_modules/@babel/runtime/helpers/esm/createClass.js","src/managers/overlayManager.js"],"sourcesContent":["export default function _classCallCheck(instance, Constructor) {\n if (!(instance instanceof Constructor)) {\n throw new TypeError(\"Cannot call a class as a function\");\n }\n}","export default function _typeof(obj) {\n \"@babel/helpers - typeof\";\n\n return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (obj) {\n return typeof obj;\n } : function (obj) {\n return obj && \"function\" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj;\n }, _typeof(obj);\n}","import _typeof from \"./typeof.js\";\nexport default function _toPrimitive(input, hint) {\n if (_typeof(input) !== \"object\" || input === null) return input;\n var prim = input[Symbol.toPrimitive];\n if (prim !== undefined) {\n var res = prim.call(input, hint || \"default\");\n if (_typeof(res) !== \"object\") return res;\n throw new TypeError(\"@@toPrimitive must return a primitive value.\");\n }\n return (hint === \"string\" ? String : Number)(input);\n}","import _typeof from \"./typeof.js\";\nimport toPrimitive from \"./toPrimitive.js\";\nexport default function _toPropertyKey(arg) {\n var key = toPrimitive(arg, \"string\");\n return _typeof(key) === \"symbol\" ? key : String(key);\n}","import toPropertyKey from \"./toPropertyKey.js\";\nfunction _defineProperties(target, props) {\n for (var i = 0; i < props.length; i++) {\n var descriptor = props[i];\n descriptor.enumerable = descriptor.enumerable || false;\n descriptor.configurable = true;\n if (\"value\" in descriptor) descriptor.writable = true;\n Object.defineProperty(target, toPropertyKey(descriptor.key), descriptor);\n }\n}\nexport default function _createClass(Constructor, protoProps, staticProps) {\n if (protoProps) _defineProperties(Constructor.prototype, protoProps);\n if (staticProps) _defineProperties(Constructor, staticProps);\n Object.defineProperty(Constructor, \"prototype\", {\n writable: false\n });\n return Constructor;\n}","class OverlayManager {\n constructor() {\n this.overlays = [];\n this.previouslyFocusedElements = [];\n this.add = this.add.bind(this);\n this.remove = this.remove.bind(this);\n this.isTopOverlay = this.isTopOverlay.bind(this);\n this.hasOverlays = this.hasOverlays.bind(this);\n this.getFinalFocusInOverlay = this.getFinalFocusInOverlay.bind(this);\n this.getTopMostOverlay = this.getTopMostOverlay.bind(this);\n }\n\n add(overlay, elementToFocus) {\n this.overlays.push(overlay);\n this.previouslyFocusedElements.push(elementToFocus);\n }\n\n remove(overlay) {\n this.overlays = this.overlays.filter(_overlay => _overlay !== overlay);\n }\n\n isTopOverlay(overlay) {\n const topMostOverlay = this.overlays[this.overlays.length - 1];\n\n return topMostOverlay === overlay;\n }\n\n hasOverlays() {\n return this.overlays.length > 0;\n }\n\n getFinalFocusInOverlay() {\n
|
|
1
|
+
{"version":3,"file":"managers.js","sources":["node_modules/@babel/runtime/helpers/esm/classCallCheck.js","node_modules/@babel/runtime/helpers/esm/typeof.js","node_modules/@babel/runtime/helpers/esm/toPrimitive.js","node_modules/@babel/runtime/helpers/esm/toPropertyKey.js","node_modules/@babel/runtime/helpers/esm/createClass.js","src/managers/overlayManager.js"],"sourcesContent":["export default function _classCallCheck(instance, Constructor) {\n if (!(instance instanceof Constructor)) {\n throw new TypeError(\"Cannot call a class as a function\");\n }\n}","export default function _typeof(obj) {\n \"@babel/helpers - typeof\";\n\n return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (obj) {\n return typeof obj;\n } : function (obj) {\n return obj && \"function\" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj;\n }, _typeof(obj);\n}","import _typeof from \"./typeof.js\";\nexport default function _toPrimitive(input, hint) {\n if (_typeof(input) !== \"object\" || input === null) return input;\n var prim = input[Symbol.toPrimitive];\n if (prim !== undefined) {\n var res = prim.call(input, hint || \"default\");\n if (_typeof(res) !== \"object\") return res;\n throw new TypeError(\"@@toPrimitive must return a primitive value.\");\n }\n return (hint === \"string\" ? String : Number)(input);\n}","import _typeof from \"./typeof.js\";\nimport toPrimitive from \"./toPrimitive.js\";\nexport default function _toPropertyKey(arg) {\n var key = toPrimitive(arg, \"string\");\n return _typeof(key) === \"symbol\" ? key : String(key);\n}","import toPropertyKey from \"./toPropertyKey.js\";\nfunction _defineProperties(target, props) {\n for (var i = 0; i < props.length; i++) {\n var descriptor = props[i];\n descriptor.enumerable = descriptor.enumerable || false;\n descriptor.configurable = true;\n if (\"value\" in descriptor) descriptor.writable = true;\n Object.defineProperty(target, toPropertyKey(descriptor.key), descriptor);\n }\n}\nexport default function _createClass(Constructor, protoProps, staticProps) {\n if (protoProps) _defineProperties(Constructor.prototype, protoProps);\n if (staticProps) _defineProperties(Constructor, staticProps);\n Object.defineProperty(Constructor, \"prototype\", {\n writable: false\n });\n return Constructor;\n}","class OverlayManager {\n constructor() {\n this.overlays = [];\n this.previouslyFocusedElements = [];\n this.subscribers = new Set();\n this.add = this.add.bind(this);\n this.remove = this.remove.bind(this);\n this.isTopOverlay = this.isTopOverlay.bind(this);\n this.hasOverlays = this.hasOverlays.bind(this);\n this.getFinalFocusInOverlay = this.getFinalFocusInOverlay.bind(this);\n this.getTopMostOverlay = this.getTopMostOverlay.bind(this);\n this.subscribe = this.subscribe.bind(this);\n }\n\n subscribe(callback) {\n this.subscribers.add(callback);\n\n return () => this.subscribers.delete(callback);\n }\n\n add(overlay, elementToFocus) {\n this.overlays.push(overlay);\n this.previouslyFocusedElements.push(elementToFocus);\n\n this.subscribers.forEach(subscriber => subscriber());\n }\n\n remove(overlay, elementToFocus) {\n this.overlays = this.overlays.filter(_overlay => _overlay !== overlay);\n this.previouslyFocusedElements = this.previouslyFocusedElements.filter(\n _elementToFocus => _elementToFocus !== elementToFocus\n );\n\n this.subscribers.forEach(subscriber => subscriber());\n }\n\n isTopOverlay(overlay) {\n const topMostOverlay = this.overlays[this.overlays.length - 1];\n\n return topMostOverlay === overlay;\n }\n\n hasOverlays() {\n return this.overlays.length > 0;\n }\n\n getFinalFocusInOverlay() {\n const finalFocus = this.previouslyFocusedElements.pop();\n this.subscribers.forEach(subscriber => subscriber());\n\n return finalFocus;\n }\n\n getTopMostOverlay() {\n return this.overlays[this.overlays.length - 1];\n }\n}\n\nexport const manager = new OverlayManager();\n"],"names":["toPrimitive","toPropertyKey","OverlayManager","_classCallCheck","overlays","previouslyFocusedElements","subscribers","Set","add","bind","remove","isTopOverlay","hasOverlays","getFinalFocusInOverlay","getTopMostOverlay","subscribe","_createClass","key","value","callback","_this","overlay","elementToFocus","push","forEach","subscriber","filter","_overlay","_elementToFocus","topMostOverlay","length","finalFocus","pop","manager"],"mappings":"AAAe,SAAS,eAAe,CAAC,QAAQ,EAAE,WAAW,EAAE;AAC/D,EAAE,IAAI,EAAE,QAAQ,YAAY,WAAW,CAAC,EAAE;AAC1C,IAAI,MAAM,IAAI,SAAS,CAAC,mCAAmC,CAAC,CAAC;AAC7D,GAAG;AACH;;ACJe,SAAS,OAAO,CAAC,GAAG,EAAE;AACrC,EAAE,yBAAyB,CAAC;AAC5B;AACA,EAAE,OAAO,OAAO,GAAG,UAAU,IAAI,OAAO,MAAM,IAAI,QAAQ,IAAI,OAAO,MAAM,CAAC,QAAQ,GAAG,UAAU,GAAG,EAAE;AACtG,IAAI,OAAO,OAAO,GAAG,CAAC;AACtB,GAAG,GAAG,UAAU,GAAG,EAAE;AACrB,IAAI,OAAO,GAAG,IAAI,UAAU,IAAI,OAAO,MAAM,IAAI,GAAG,CAAC,WAAW,KAAK,MAAM,IAAI,GAAG,KAAK,MAAM,CAAC,SAAS,GAAG,QAAQ,GAAG,OAAO,GAAG,CAAC;AAChI,GAAG,EAAE,OAAO,CAAC,GAAG,CA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