@fluentui/react-portal 0.0.0-nightly-20220302-0405.1

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 (98) hide show
  1. package/CHANGELOG.json +2010 -0
  2. package/CHANGELOG.md +749 -0
  3. package/LICENSE +15 -0
  4. package/README.md +147 -0
  5. package/Spec.md +254 -0
  6. package/dist/react-portal.d.ts +62 -0
  7. package/lib/Portal.d.ts +1 -0
  8. package/lib/Portal.js +2 -0
  9. package/lib/Portal.js.map +1 -0
  10. package/lib/components/Portal/Portal.d.ts +7 -0
  11. package/lib/components/Portal/Portal.js +13 -0
  12. package/lib/components/Portal/Portal.js.map +1 -0
  13. package/lib/components/Portal/Portal.types.d.ts +22 -0
  14. package/lib/components/Portal/Portal.types.js +2 -0
  15. package/lib/components/Portal/Portal.types.js.map +1 -0
  16. package/lib/components/Portal/index.d.ts +4 -0
  17. package/lib/components/Portal/index.js +5 -0
  18. package/lib/components/Portal/index.js.map +1 -0
  19. package/lib/components/Portal/renderPortal.d.ts +6 -0
  20. package/lib/components/Portal/renderPortal.js +13 -0
  21. package/lib/components/Portal/renderPortal.js.map +1 -0
  22. package/lib/components/Portal/usePortal.d.ts +9 -0
  23. package/lib/components/Portal/usePortal.js +35 -0
  24. package/lib/components/Portal/usePortal.js.map +1 -0
  25. package/lib/components/Portal/usePortalMountNode.d.ts +10 -0
  26. package/lib/components/Portal/usePortalMountNode.js +36 -0
  27. package/lib/components/Portal/usePortalMountNode.js.map +1 -0
  28. package/lib/index.d.ts +2 -0
  29. package/lib/index.js +3 -0
  30. package/lib/index.js.map +1 -0
  31. package/lib/tsdoc-metadata.json +11 -0
  32. package/lib/virtualParent/elementContains.d.ts +7 -0
  33. package/lib/virtualParent/elementContains.js +30 -0
  34. package/lib/virtualParent/elementContains.js.map +1 -0
  35. package/lib/virtualParent/getParent.d.ts +5 -0
  36. package/lib/virtualParent/getParent.js +10 -0
  37. package/lib/virtualParent/getParent.js.map +1 -0
  38. package/lib/virtualParent/getVirtualParent.d.ts +4 -0
  39. package/lib/virtualParent/getVirtualParent.js +15 -0
  40. package/lib/virtualParent/getVirtualParent.js.map +1 -0
  41. package/lib/virtualParent/index.d.ts +5 -0
  42. package/lib/virtualParent/index.js +6 -0
  43. package/lib/virtualParent/index.js.map +1 -0
  44. package/lib/virtualParent/isVirtualElement.d.ts +5 -0
  45. package/lib/virtualParent/isVirtualElement.js +7 -0
  46. package/lib/virtualParent/isVirtualElement.js.map +1 -0
  47. package/lib/virtualParent/setVirtualParent.d.ts +7 -0
  48. package/lib/virtualParent/setVirtualParent.js +20 -0
  49. package/lib/virtualParent/setVirtualParent.js.map +1 -0
  50. package/lib/virtualParent/types.d.ts +5 -0
  51. package/lib/virtualParent/types.js +2 -0
  52. package/lib/virtualParent/types.js.map +1 -0
  53. package/lib-commonjs/Portal.d.ts +1 -0
  54. package/lib-commonjs/Portal.js +10 -0
  55. package/lib-commonjs/Portal.js.map +1 -0
  56. package/lib-commonjs/components/Portal/Portal.d.ts +7 -0
  57. package/lib-commonjs/components/Portal/Portal.js +24 -0
  58. package/lib-commonjs/components/Portal/Portal.js.map +1 -0
  59. package/lib-commonjs/components/Portal/Portal.types.d.ts +22 -0
  60. package/lib-commonjs/components/Portal/Portal.types.js +6 -0
  61. package/lib-commonjs/components/Portal/Portal.types.js.map +1 -0
  62. package/lib-commonjs/components/Portal/index.d.ts +4 -0
  63. package/lib-commonjs/components/Portal/index.js +16 -0
  64. package/lib-commonjs/components/Portal/index.js.map +1 -0
  65. package/lib-commonjs/components/Portal/renderPortal.d.ts +6 -0
  66. package/lib-commonjs/components/Portal/renderPortal.js +24 -0
  67. package/lib-commonjs/components/Portal/renderPortal.js.map +1 -0
  68. package/lib-commonjs/components/Portal/usePortal.d.ts +9 -0
  69. package/lib-commonjs/components/Portal/usePortal.js +48 -0
  70. package/lib-commonjs/components/Portal/usePortal.js.map +1 -0
  71. package/lib-commonjs/components/Portal/usePortalMountNode.d.ts +10 -0
  72. package/lib-commonjs/components/Portal/usePortalMountNode.js +49 -0
  73. package/lib-commonjs/components/Portal/usePortalMountNode.js.map +1 -0
  74. package/lib-commonjs/index.d.ts +2 -0
  75. package/lib-commonjs/index.js +26 -0
  76. package/lib-commonjs/index.js.map +1 -0
  77. package/lib-commonjs/virtualParent/elementContains.d.ts +7 -0
  78. package/lib-commonjs/virtualParent/elementContains.js +40 -0
  79. package/lib-commonjs/virtualParent/elementContains.js.map +1 -0
  80. package/lib-commonjs/virtualParent/getParent.d.ts +5 -0
  81. package/lib-commonjs/virtualParent/getParent.js +20 -0
  82. package/lib-commonjs/virtualParent/getParent.js.map +1 -0
  83. package/lib-commonjs/virtualParent/getVirtualParent.d.ts +4 -0
  84. package/lib-commonjs/virtualParent/getVirtualParent.js +25 -0
  85. package/lib-commonjs/virtualParent/getVirtualParent.js.map +1 -0
  86. package/lib-commonjs/virtualParent/index.d.ts +5 -0
  87. package/lib-commonjs/virtualParent/index.js +18 -0
  88. package/lib-commonjs/virtualParent/index.js.map +1 -0
  89. package/lib-commonjs/virtualParent/isVirtualElement.d.ts +5 -0
  90. package/lib-commonjs/virtualParent/isVirtualElement.js +16 -0
  91. package/lib-commonjs/virtualParent/isVirtualElement.js.map +1 -0
  92. package/lib-commonjs/virtualParent/setVirtualParent.d.ts +7 -0
  93. package/lib-commonjs/virtualParent/setVirtualParent.js +29 -0
  94. package/lib-commonjs/virtualParent/setVirtualParent.js.map +1 -0
  95. package/lib-commonjs/virtualParent/types.d.ts +5 -0
  96. package/lib-commonjs/virtualParent/types.js +6 -0
  97. package/lib-commonjs/virtualParent/types.js.map +1 -0
  98. package/package.json +62 -0
@@ -0,0 +1,36 @@
1
+ import * as React from 'react';
2
+ import { useIsomorphicLayoutEffect } from '@fluentui/react-utilities';
3
+ import { useThemeClassName, useFluent } from '@fluentui/react-shared-contexts';
4
+ import { useKeyboardNavAttribute } from '@fluentui/react-tabster';
5
+ /**
6
+ * Creates a new element on a document.body to mount portals
7
+ */
8
+
9
+ export const usePortalMountNode = options => {
10
+ const themeClassName = useThemeClassName();
11
+ const {
12
+ targetDocument,
13
+ dir
14
+ } = useFluent();
15
+ const element = React.useMemo(() => {
16
+ if (targetDocument === undefined || options.disabled) {
17
+ return undefined;
18
+ }
19
+
20
+ const newElement = targetDocument.createElement('div');
21
+ newElement.setAttribute('class', themeClassName);
22
+ newElement.setAttribute('dir', dir);
23
+ targetDocument.body.appendChild(newElement);
24
+ return newElement;
25
+ }, [targetDocument, themeClassName, dir, options.disabled]);
26
+ useKeyboardNavAttribute().current = element;
27
+ useIsomorphicLayoutEffect(() => {
28
+ return () => {
29
+ var _a;
30
+
31
+ (_a = element === null || element === void 0 ? void 0 : element.parentElement) === null || _a === void 0 ? void 0 : _a.removeChild(element);
32
+ };
33
+ }, [element]);
34
+ return element;
35
+ };
36
+ //# sourceMappingURL=usePortalMountNode.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["components/Portal/usePortalMountNode.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAZ,MAAuB,OAAvB;AACA,SAAS,yBAAT,QAA0C,2BAA1C;AACA,SAAS,iBAAT,EAA4B,SAA5B,QAA6C,iCAA7C;AACA,SAAS,uBAAT,QAAwC,yBAAxC;AASA;;AAEG;;AACH,OAAO,MAAM,kBAAkB,GAAI,OAAD,IAAuC;AACvE,QAAM,cAAc,GAAG,iBAAiB,EAAxC;AACA,QAAM;AAAE,IAAA,cAAF;AAAkB,IAAA;AAAlB,MAA0B,SAAS,EAAzC;AAEA,QAAM,OAAO,GAAG,KAAK,CAAC,OAAN,CAAc,MAAK;AACjC,QAAI,cAAc,KAAK,SAAnB,IAAgC,OAAO,CAAC,QAA5C,EAAsD;AACpD,aAAO,SAAP;AACD;;AAED,UAAM,UAAU,GAAG,cAAc,CAAC,aAAf,CAA6B,KAA7B,CAAnB;AACA,IAAA,UAAU,CAAC,YAAX,CAAwB,OAAxB,EAAiC,cAAjC;AACA,IAAA,UAAU,CAAC,YAAX,CAAwB,KAAxB,EAA+B,GAA/B;AACA,IAAA,cAAc,CAAC,IAAf,CAAoB,WAApB,CAAgC,UAAhC;AAEA,WAAO,UAAP;AACD,GAXe,EAWb,CAAC,cAAD,EAAiB,cAAjB,EAAiC,GAAjC,EAAsC,OAAO,CAAC,QAA9C,CAXa,CAAhB;AAaC,EAAA,uBAAuB,GAA2C,OAAlE,GAA4E,OAA5E;AAED,EAAA,yBAAyB,CAAC,MAAK;AAC7B,WAAO,MAAK;;;AACV,OAAA,EAAA,GAAA,OAAO,KAAA,IAAP,IAAA,OAAO,KAAA,KAAA,CAAP,GAAO,KAAA,CAAP,GAAA,OAAO,CAAE,aAAT,MAAsB,IAAtB,IAAsB,EAAA,KAAA,KAAA,CAAtB,GAAsB,KAAA,CAAtB,GAAsB,EAAA,CAAE,WAAF,CAAc,OAAd,CAAtB;AACD,KAFD;AAGD,GAJwB,EAItB,CAAC,OAAD,CAJsB,CAAzB;AAMA,SAAO,OAAP;AACD,CA1BM","sourcesContent":["import * as React from 'react';\nimport { useIsomorphicLayoutEffect } from '@fluentui/react-utilities';\nimport { useThemeClassName, useFluent } from '@fluentui/react-shared-contexts';\nimport { useKeyboardNavAttribute } from '@fluentui/react-tabster';\n\nexport type UsePortalMountNodeOptions = {\n /**\n * Since hooks cannot be called conditionally use this flag to disable creating the node\n */\n disabled?: boolean;\n};\n\n/**\n * Creates a new element on a document.body to mount portals\n */\nexport const usePortalMountNode = (options: UsePortalMountNodeOptions) => {\n const themeClassName = useThemeClassName();\n const { targetDocument, dir } = useFluent();\n\n const element = React.useMemo(() => {\n if (targetDocument === undefined || options.disabled) {\n return undefined;\n }\n\n const newElement = targetDocument.createElement('div');\n newElement.setAttribute('class', themeClassName);\n newElement.setAttribute('dir', dir);\n targetDocument.body.appendChild(newElement);\n\n return newElement;\n }, [targetDocument, themeClassName, dir, options.disabled]);\n\n (useKeyboardNavAttribute() as React.MutableRefObject<HTMLElement>).current = element!;\n\n useIsomorphicLayoutEffect(() => {\n return () => {\n element?.parentElement?.removeChild(element);\n };\n }, [element]);\n\n return element;\n};\n"],"sourceRoot":"../src/"}
package/lib/index.d.ts ADDED
@@ -0,0 +1,2 @@
1
+ export * from './components/Portal/index';
2
+ export { elementContains, setVirtualParent } from './virtualParent/index';
package/lib/index.js ADDED
@@ -0,0 +1,3 @@
1
+ export * from './components/Portal/index';
2
+ export { elementContains, setVirtualParent } from './virtualParent/index';
3
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"../src/","sources":["index.ts"],"names":[],"mappings":"AAAA,cAAc,2BAA2B,CAAC;AAC1C,OAAO,EAAE,eAAe,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC","sourcesContent":["export * from './components/Portal/index';\nexport { elementContains, setVirtualParent } from './virtualParent/index';\n"]}
@@ -0,0 +1,11 @@
1
+ // This file is read by tools that parse documentation comments conforming to the TSDoc standard.
2
+ // It should be published with your NPM package. It should not be tracked by Git.
3
+ {
4
+ "tsdocVersion": "0.12",
5
+ "toolPackages": [
6
+ {
7
+ "packageName": "@microsoft/api-extractor",
8
+ "packageVersion": "7.18.1"
9
+ }
10
+ ]
11
+ }
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Similar functionality to `element.contains` DOM API for use with out of order DOM elements that
3
+ * checks the virtual parent hierarchy. If a virtual parents exists, it is chosen over the actual parent
4
+ *
5
+ * @returns true if the child can find the parent in its virtual hierarchy
6
+ */
7
+ export declare function elementContains(parent: HTMLElement | null, child: HTMLElement | null): boolean;
@@ -0,0 +1,30 @@
1
+ import { getParent } from './getParent';
2
+ /**
3
+ * Similar functionality to `element.contains` DOM API for use with out of order DOM elements that
4
+ * checks the virtual parent hierarchy. If a virtual parents exists, it is chosen over the actual parent
5
+ *
6
+ * @returns true if the child can find the parent in its virtual hierarchy
7
+ */
8
+
9
+ export function elementContains(parent, child) {
10
+ if (!parent || !child) {
11
+ return false;
12
+ }
13
+
14
+ if (parent === child) {
15
+ return true;
16
+ } else {
17
+ while (child) {
18
+ const nextParent = getParent(child);
19
+
20
+ if (nextParent === parent) {
21
+ return true;
22
+ }
23
+
24
+ child = nextParent;
25
+ }
26
+ }
27
+
28
+ return false;
29
+ }
30
+ //# sourceMappingURL=elementContains.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["virtualParent/elementContains.ts"],"names":[],"mappings":"AAAA,SAAS,SAAT,QAA0B,aAA1B;AACA;;;;;AAKG;;AACH,OAAM,SAAU,eAAV,CAA0B,MAA1B,EAAsD,KAAtD,EAA+E;AACnF,MAAI,CAAC,MAAD,IAAW,CAAC,KAAhB,EAAuB;AACrB,WAAO,KAAP;AACD;;AAED,MAAI,MAAM,KAAK,KAAf,EAAsB;AACpB,WAAO,IAAP;AACD,GAFD,MAEO;AACL,WAAO,KAAP,EAAc;AACZ,YAAM,UAAU,GAAuB,SAAS,CAAC,KAAD,CAAhD;;AAEA,UAAI,UAAU,KAAK,MAAnB,EAA2B;AACzB,eAAO,IAAP;AACD;;AAED,MAAA,KAAK,GAAG,UAAR;AACD;AACF;;AAED,SAAO,KAAP;AACD","sourcesContent":["import { getParent } from './getParent';\n/**\n * Similar functionality to `element.contains` DOM API for use with out of order DOM elements that\n * checks the virtual parent hierarchy. If a virtual parents exists, it is chosen over the actual parent\n *\n * @returns true if the child can find the parent in its virtual hierarchy\n */\nexport function elementContains(parent: HTMLElement | null, child: HTMLElement | null): boolean {\n if (!parent || !child) {\n return false;\n }\n\n if (parent === child) {\n return true;\n } else {\n while (child) {\n const nextParent: HTMLElement | null = getParent(child);\n\n if (nextParent === parent) {\n return true;\n }\n\n child = nextParent;\n }\n }\n\n return false;\n}\n"],"sourceRoot":"../src/"}
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Gets the element which is the parent of a given element.
3
+ * This method prefers the virtual parent over real DOM parent when present.
4
+ */
5
+ export declare function getParent(child: HTMLElement | null): HTMLElement | null;
@@ -0,0 +1,10 @@
1
+ import { getVirtualParent } from './getVirtualParent';
2
+ /**
3
+ * Gets the element which is the parent of a given element.
4
+ * This method prefers the virtual parent over real DOM parent when present.
5
+ */
6
+
7
+ export function getParent(child) {
8
+ return child && getVirtualParent(child) || (child === null || child === void 0 ? void 0 : child.parentNode);
9
+ }
10
+ //# sourceMappingURL=getParent.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["virtualParent/getParent.ts"],"names":[],"mappings":"AAAA,SAAS,gBAAT,QAAiC,oBAAjC;AAEA;;;AAGG;;AACH,OAAM,SAAU,SAAV,CAAoB,KAApB,EAA6C;AACjD,SAAQ,KAAK,IAAI,gBAAgB,CAAC,KAAD,CAA1B,KAAuC,KAAK,KAAA,IAAL,IAAA,KAAK,KAAA,KAAA,CAAL,GAAK,KAAA,CAAL,GAAA,KAAK,CAAE,UAA9C,CAAP;AACD","sourcesContent":["import { getVirtualParent } from './getVirtualParent';\n\n/**\n * Gets the element which is the parent of a given element.\n * This method prefers the virtual parent over real DOM parent when present.\n */\nexport function getParent(child: HTMLElement | null): HTMLElement | null {\n return (child && getVirtualParent(child)) || (child?.parentNode as HTMLElement | null);\n}\n"],"sourceRoot":"../src/"}
@@ -0,0 +1,4 @@
1
+ /**
2
+ * Gets the virtual parent given the child element, if it exists.
3
+ */
4
+ export declare function getVirtualParent(child: HTMLElement): HTMLElement | undefined;
@@ -0,0 +1,15 @@
1
+ import { isVirtualElement } from './isVirtualElement';
2
+ /**
3
+ * Gets the virtual parent given the child element, if it exists.
4
+ */
5
+
6
+ export function getVirtualParent(child) {
7
+ let parent;
8
+
9
+ if (isVirtualElement(child)) {
10
+ parent = child._virtual.parent;
11
+ }
12
+
13
+ return parent;
14
+ }
15
+ //# sourceMappingURL=getVirtualParent.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["virtualParent/getVirtualParent.ts"],"names":[],"mappings":"AAAA,SAAS,gBAAT,QAAiC,oBAAjC;AACA;;AAEG;;AACH,OAAM,SAAU,gBAAV,CAA2B,KAA3B,EAA6C;AACjD,MAAI,MAAJ;;AACA,MAAI,gBAAgB,CAAC,KAAD,CAApB,EAA6B;AAC3B,IAAA,MAAM,GAAG,KAAK,CAAC,QAAN,CAAe,MAAxB;AACD;;AACD,SAAO,MAAP;AACD","sourcesContent":["import { isVirtualElement } from './isVirtualElement';\n/**\n * Gets the virtual parent given the child element, if it exists.\n */\nexport function getVirtualParent(child: HTMLElement): HTMLElement | undefined {\n let parent: HTMLElement | undefined;\n if (isVirtualElement(child)) {\n parent = child._virtual.parent;\n }\n return parent;\n}\n"],"sourceRoot":"../src/"}
@@ -0,0 +1,5 @@
1
+ export * from './elementContains';
2
+ export * from './getParent';
3
+ export * from './getVirtualParent';
4
+ export * from './isVirtualElement';
5
+ export * from './setVirtualParent';
@@ -0,0 +1,6 @@
1
+ export * from './elementContains';
2
+ export * from './getParent';
3
+ export * from './getVirtualParent';
4
+ export * from './isVirtualElement';
5
+ export * from './setVirtualParent';
6
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"../src/","sources":["virtualParent/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAC;AAClC,cAAc,aAAa,CAAC;AAC5B,cAAc,oBAAoB,CAAC;AACnC,cAAc,oBAAoB,CAAC;AACnC,cAAc,oBAAoB,CAAC","sourcesContent":["export * from './elementContains';\nexport * from './getParent';\nexport * from './getVirtualParent';\nexport * from './isVirtualElement';\nexport * from './setVirtualParent';\n"]}
@@ -0,0 +1,5 @@
1
+ import type { VirtualElement } from './types';
2
+ /**
3
+ * Determines whether or not an element has the virtual hierarchy extension.
4
+ */
5
+ export declare function isVirtualElement(element: HTMLElement | VirtualElement): element is VirtualElement;
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Determines whether or not an element has the virtual hierarchy extension.
3
+ */
4
+ export function isVirtualElement(element) {
5
+ return element && !!element._virtual;
6
+ }
7
+ //# sourceMappingURL=isVirtualElement.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["virtualParent/isVirtualElement.ts"],"names":[],"mappings":"AAEA;;AAEG;AACH,OAAM,SAAU,gBAAV,CAA2B,OAA3B,EAAgE;AACpE,SAAO,OAAO,IAAI,CAAC,CAAkB,OAAQ,CAAC,QAA9C;AACD","sourcesContent":["import type { VirtualElement } from './types';\n\n/**\n * Determines whether or not an element has the virtual hierarchy extension.\n */\nexport function isVirtualElement(element: HTMLElement | VirtualElement): element is VirtualElement {\n return element && !!(<VirtualElement>element)._virtual;\n}\n"],"sourceRoot":"../src/"}
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Sets the virtual parent of an element.
3
+ *
4
+ * @param child - Theme element to set the virtual parent
5
+ * @param parent - The virtual parent, use `undefined` to remove a virtual parent relationship
6
+ */
7
+ export declare function setVirtualParent(child: HTMLElement, parent?: HTMLElement): void;
@@ -0,0 +1,20 @@
1
+ /**
2
+ * Sets the virtual parent of an element.
3
+ *
4
+ * @param child - Theme element to set the virtual parent
5
+ * @param parent - The virtual parent, use `undefined` to remove a virtual parent relationship
6
+ */
7
+ export function setVirtualParent(child, parent) {
8
+ if (!child) {
9
+ return;
10
+ }
11
+
12
+ const virtualChild = child;
13
+
14
+ if (!virtualChild._virtual) {
15
+ virtualChild._virtual = {};
16
+ }
17
+
18
+ virtualChild._virtual.parent = parent || undefined;
19
+ }
20
+ //# sourceMappingURL=setVirtualParent.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["virtualParent/setVirtualParent.ts"],"names":[],"mappings":"AAEA;;;;;AAKG;AACH,OAAM,SAAU,gBAAV,CAA2B,KAA3B,EAA+C,MAA/C,EAAmE;AACvE,MAAI,CAAC,KAAL,EAAY;AACV;AACD;;AAED,QAAM,YAAY,GAAmB,KAArC;;AAEA,MAAI,CAAC,YAAY,CAAC,QAAlB,EAA4B;AAC1B,IAAA,YAAY,CAAC,QAAb,GAAwB,EAAxB;AACD;;AAED,EAAA,YAAY,CAAC,QAAb,CAAsB,MAAtB,GAA+B,MAAM,IAAI,SAAzC;AACD","sourcesContent":["import type { VirtualElement } from './types';\n\n/**\n * Sets the virtual parent of an element.\n *\n * @param child - Theme element to set the virtual parent\n * @param parent - The virtual parent, use `undefined` to remove a virtual parent relationship\n */\nexport function setVirtualParent(child: HTMLElement, parent?: HTMLElement): void {\n if (!child) {\n return;\n }\n\n const virtualChild = <VirtualElement>child;\n\n if (!virtualChild._virtual) {\n virtualChild._virtual = {};\n }\n\n virtualChild._virtual.parent = parent || undefined;\n}\n"],"sourceRoot":"../src/"}
@@ -0,0 +1,5 @@
1
+ export interface VirtualElement extends HTMLElement {
2
+ _virtual: {
3
+ parent?: HTMLElement;
4
+ };
5
+ }
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"../src/","sources":["virtualParent/types.ts"],"names":[],"mappings":"","sourcesContent":["export interface VirtualElement extends HTMLElement {\n _virtual: {\n parent?: HTMLElement;\n };\n}\n"]}
@@ -0,0 +1 @@
1
+ export * from './components/Portal/index';
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+
7
+ const tslib_1 = /*#__PURE__*/require("tslib");
8
+
9
+ tslib_1.__exportStar(require("./components/Portal/index"), exports);
10
+ //# sourceMappingURL=Portal.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["Portal.ts"],"names":[],"mappings":";;;;;;;;AAAA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,2BAAA,CAAA,EAAA,OAAA","sourcesContent":["export * from './components/Portal/index';\n"],"sourceRoot":"../src/"}
@@ -0,0 +1,7 @@
1
+ import * as React from 'react';
2
+ import type { PortalProps } from './Portal.types';
3
+ /**
4
+ * A portal provides a way to render children into a DOM node
5
+ * that exists outside the DOM hierarchy of the parent component.
6
+ */
7
+ export declare const Portal: React.FC<PortalProps>;
@@ -0,0 +1,24 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.Portal = void 0;
7
+
8
+ const usePortal_1 = /*#__PURE__*/require("./usePortal");
9
+
10
+ const renderPortal_1 = /*#__PURE__*/require("./renderPortal");
11
+ /**
12
+ * A portal provides a way to render children into a DOM node
13
+ * that exists outside the DOM hierarchy of the parent component.
14
+ */
15
+
16
+
17
+ const Portal = props => {
18
+ const state = usePortal_1.usePortal_unstable(props);
19
+ return renderPortal_1.renderPortal_unstable(state);
20
+ };
21
+
22
+ exports.Portal = Portal;
23
+ exports.Portal.displayName = 'Portal';
24
+ //# sourceMappingURL=Portal.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["components/Portal/Portal.tsx"],"names":[],"mappings":";;;;;;;AAEA,MAAA,WAAA,gBAAA,OAAA,CAAA,aAAA,CAAA;;AACA,MAAA,cAAA,gBAAA,OAAA,CAAA,gBAAA,CAAA;AAGA;;;AAGG;;;AACI,MAAM,MAAM,GAA0B,KAAK,IAAG;AACnD,QAAM,KAAK,GAAG,WAAA,CAAA,kBAAA,CAAmB,KAAnB,CAAd;AAEA,SAAO,cAAA,CAAA,qBAAA,CAAsB,KAAtB,CAAP;AACD,CAJM;;AAAM,OAAA,CAAA,MAAA,GAAM,MAAN;AAMb,OAAA,CAAA,MAAA,CAAO,WAAP,GAAqB,QAArB","sourcesContent":["import * as React from 'react';\n\nimport { usePortal_unstable } from './usePortal';\nimport { renderPortal_unstable } from './renderPortal';\nimport type { PortalProps } from './Portal.types';\n\n/**\n * A portal provides a way to render children into a DOM node\n * that exists outside the DOM hierarchy of the parent component.\n */\nexport const Portal: React.FC<PortalProps> = props => {\n const state = usePortal_unstable(props);\n\n return renderPortal_unstable(state);\n};\n\nPortal.displayName = 'Portal';\n"],"sourceRoot":"../src/"}
@@ -0,0 +1,22 @@
1
+ import * as React from 'react';
2
+ declare type PortalCommons = {
3
+ /**
4
+ * React children
5
+ */
6
+ children: React.ReactNode;
7
+ /**
8
+ * Where the portal children are mounted on DOM
9
+ * @defaultValue a new element on document.body without any styling
10
+ */
11
+ mountNode: HTMLDivElement | undefined;
12
+ };
13
+ export declare type PortalProps = Partial<PortalCommons>;
14
+ export declare type PortalState = PortalCommons & {
15
+ /** Indicates if a Portal should be rendered. */
16
+ shouldRender: boolean;
17
+ /**
18
+ * Ref to the root span element as virtual parent
19
+ */
20
+ virtualParentRootRef: React.MutableRefObject<HTMLSpanElement | null>;
21
+ };
22
+ export {};
@@ -0,0 +1,6 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ //# sourceMappingURL=Portal.types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"names":[],"mappings":"","sourceRoot":"../src/"}
@@ -0,0 +1,4 @@
1
+ export * from './Portal';
2
+ export * from './Portal.types';
3
+ export * from './renderPortal';
4
+ export * from './usePortal';
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+
7
+ const tslib_1 = /*#__PURE__*/require("tslib");
8
+
9
+ tslib_1.__exportStar(require("./Portal"), exports);
10
+
11
+ tslib_1.__exportStar(require("./Portal.types"), exports);
12
+
13
+ tslib_1.__exportStar(require("./renderPortal"), exports);
14
+
15
+ tslib_1.__exportStar(require("./usePortal"), exports);
16
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["components/Portal/index.ts"],"names":[],"mappings":";;;;;;;;AAAA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,UAAA,CAAA,EAAA,OAAA;;AACA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,gBAAA,CAAA,EAAA,OAAA;;AACA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,gBAAA,CAAA,EAAA,OAAA;;AACA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,aAAA,CAAA,EAAA,OAAA","sourcesContent":["export * from './Portal';\nexport * from './Portal.types';\nexport * from './renderPortal';\nexport * from './usePortal';\n"],"sourceRoot":"../src/"}
@@ -0,0 +1,6 @@
1
+ import * as React from 'react';
2
+ import type { PortalState } from './Portal.types';
3
+ /**
4
+ * Render the final JSX of Portal
5
+ */
6
+ export declare const renderPortal_unstable: (state: PortalState) => React.ReactElement;
@@ -0,0 +1,24 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.renderPortal_unstable = void 0;
7
+
8
+ const ReactDOM = /*#__PURE__*/require("react-dom");
9
+
10
+ const React = /*#__PURE__*/require("react");
11
+ /**
12
+ * Render the final JSX of Portal
13
+ */
14
+
15
+
16
+ const renderPortal_unstable = state => {
17
+ return React.createElement("span", {
18
+ hidden: true,
19
+ ref: state.virtualParentRootRef
20
+ }, state.shouldRender && state.mountNode && ReactDOM.createPortal(state.children, state.mountNode));
21
+ };
22
+
23
+ exports.renderPortal_unstable = renderPortal_unstable;
24
+ //# sourceMappingURL=renderPortal.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["components/Portal/renderPortal.tsx"],"names":[],"mappings":";;;;;;;AAAA,MAAA,QAAA,gBAAA,OAAA,CAAA,WAAA,CAAA;;AACA,MAAA,KAAA,gBAAA,OAAA,CAAA,OAAA,CAAA;AAGA;;AAEG;;;AACI,MAAM,qBAAqB,GAAI,KAAD,IAA2C;AAC9E,SACE,KAAA,CAAA,aAAA,CAAA,MAAA,EAAA;AAAM,IAAA,MAAM,EAAA,IAAZ;AAAa,IAAA,GAAG,EAAE,KAAK,CAAC;AAAxB,GAAA,EACG,KAAK,CAAC,YAAN,IAAsB,KAAK,CAAC,SAA5B,IAAyC,QAAQ,CAAC,YAAT,CAAsB,KAAK,CAAC,QAA5B,EAAsC,KAAK,CAAC,SAA5C,CAD5C,CADF;AAKD,CANM;;AAAM,OAAA,CAAA,qBAAA,GAAqB,qBAArB","sourcesContent":["import * as ReactDOM from 'react-dom';\nimport * as React from 'react';\nimport type { PortalState } from './Portal.types';\n\n/**\n * Render the final JSX of Portal\n */\nexport const renderPortal_unstable = (state: PortalState): React.ReactElement => {\n return (\n <span hidden ref={state.virtualParentRootRef}>\n {state.shouldRender && state.mountNode && ReactDOM.createPortal(state.children, state.mountNode)}\n </span>\n );\n};\n"],"sourceRoot":"../src/"}
@@ -0,0 +1,9 @@
1
+ import type { PortalProps, PortalState } from './Portal.types';
2
+ /**
3
+ * Create the state required to render Portal.
4
+ *
5
+ * The returned state can be modified with hooks such as usePortalStyles, before being passed to renderPortal_unstable.
6
+ *
7
+ * @param props - props from this instance of Portal
8
+ */
9
+ export declare const usePortal_unstable: (props: PortalProps) => PortalState;
@@ -0,0 +1,48 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.usePortal_unstable = void 0;
7
+
8
+ const React = /*#__PURE__*/require("react");
9
+
10
+ const react_utilities_1 = /*#__PURE__*/require("@fluentui/react-utilities");
11
+
12
+ const usePortalMountNode_1 = /*#__PURE__*/require("./usePortalMountNode");
13
+
14
+ const index_1 = /*#__PURE__*/require("../../virtualParent/index");
15
+ /**
16
+ * Create the state required to render Portal.
17
+ *
18
+ * The returned state can be modified with hooks such as usePortalStyles, before being passed to renderPortal_unstable.
19
+ *
20
+ * @param props - props from this instance of Portal
21
+ */
22
+
23
+
24
+ const usePortal_unstable = props => {
25
+ const {
26
+ children,
27
+ mountNode
28
+ } = props;
29
+ const virtualParentRootRef = React.useRef(null);
30
+ const fallbackMountNode = usePortalMountNode_1.usePortalMountNode({
31
+ disabled: !!mountNode
32
+ });
33
+ const state = {
34
+ children,
35
+ mountNode: mountNode !== null && mountNode !== void 0 ? mountNode : fallbackMountNode,
36
+ shouldRender: !react_utilities_1.useIsSSR(),
37
+ virtualParentRootRef
38
+ };
39
+ React.useEffect(() => {
40
+ if (state.virtualParentRootRef.current && state.mountNode) {
41
+ index_1.setVirtualParent(state.mountNode, state.virtualParentRootRef.current);
42
+ }
43
+ }, [state.virtualParentRootRef, state.mountNode]);
44
+ return state;
45
+ };
46
+
47
+ exports.usePortal_unstable = usePortal_unstable;
48
+ //# sourceMappingURL=usePortal.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["components/Portal/usePortal.ts"],"names":[],"mappings":";;;;;;;AAAA,MAAA,KAAA,gBAAA,OAAA,CAAA,OAAA,CAAA;;AACA,MAAA,iBAAA,gBAAA,OAAA,CAAA,2BAAA,CAAA;;AACA,MAAA,oBAAA,gBAAA,OAAA,CAAA,sBAAA,CAAA;;AACA,MAAA,OAAA,gBAAA,OAAA,CAAA,2BAAA,CAAA;AAGA;;;;;;AAMG;;;AACI,MAAM,kBAAkB,GAAI,KAAD,IAAoC;AACpE,QAAM;AAAE,IAAA,QAAF;AAAY,IAAA;AAAZ,MAA0B,KAAhC;AAEA,QAAM,oBAAoB,GAAG,KAAK,CAAC,MAAN,CAA8B,IAA9B,CAA7B;AACA,QAAM,iBAAiB,GAAG,oBAAA,CAAA,kBAAA,CAAmB;AAAE,IAAA,QAAQ,EAAE,CAAC,CAAC;AAAd,GAAnB,CAA1B;AAEA,QAAM,KAAK,GAAgB;AACzB,IAAA,QADyB;AAEzB,IAAA,SAAS,EAAE,SAAS,KAAA,IAAT,IAAA,SAAS,KAAA,KAAA,CAAT,GAAA,SAAA,GAAa,iBAFC;AAGzB,IAAA,YAAY,EAAE,CAAC,iBAAA,CAAA,QAAA,EAHU;AAIzB,IAAA;AAJyB,GAA3B;AAOA,EAAA,KAAK,CAAC,SAAN,CAAgB,MAAK;AACnB,QAAI,KAAK,CAAC,oBAAN,CAA2B,OAA3B,IAAsC,KAAK,CAAC,SAAhD,EAA2D;AACzD,MAAA,OAAA,CAAA,gBAAA,CAAiB,KAAK,CAAC,SAAvB,EAAkC,KAAK,CAAC,oBAAN,CAA2B,OAA7D;AACD;AACF,GAJD,EAIG,CAAC,KAAK,CAAC,oBAAP,EAA6B,KAAK,CAAC,SAAnC,CAJH;AAMA,SAAO,KAAP;AACD,CApBM;;AAAM,OAAA,CAAA,kBAAA,GAAkB,kBAAlB","sourcesContent":["import * as React from 'react';\nimport { useIsSSR } from '@fluentui/react-utilities';\nimport { usePortalMountNode } from './usePortalMountNode';\nimport { setVirtualParent } from '../../virtualParent/index';\nimport type { PortalProps, PortalState } from './Portal.types';\n\n/**\n * Create the state required to render Portal.\n *\n * The returned state can be modified with hooks such as usePortalStyles, before being passed to renderPortal_unstable.\n *\n * @param props - props from this instance of Portal\n */\nexport const usePortal_unstable = (props: PortalProps): PortalState => {\n const { children, mountNode } = props;\n\n const virtualParentRootRef = React.useRef<HTMLSpanElement>(null);\n const fallbackMountNode = usePortalMountNode({ disabled: !!mountNode });\n\n const state: PortalState = {\n children,\n mountNode: mountNode ?? fallbackMountNode,\n shouldRender: !useIsSSR(),\n virtualParentRootRef,\n };\n\n React.useEffect(() => {\n if (state.virtualParentRootRef.current && state.mountNode) {\n setVirtualParent(state.mountNode, state.virtualParentRootRef.current);\n }\n }, [state.virtualParentRootRef, state.mountNode]);\n\n return state;\n};\n"],"sourceRoot":"../src/"}
@@ -0,0 +1,10 @@
1
+ export declare type UsePortalMountNodeOptions = {
2
+ /**
3
+ * Since hooks cannot be called conditionally use this flag to disable creating the node
4
+ */
5
+ disabled?: boolean;
6
+ };
7
+ /**
8
+ * Creates a new element on a document.body to mount portals
9
+ */
10
+ export declare const usePortalMountNode: (options: UsePortalMountNodeOptions) => HTMLDivElement | undefined;
@@ -0,0 +1,49 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.usePortalMountNode = void 0;
7
+
8
+ const React = /*#__PURE__*/require("react");
9
+
10
+ const react_utilities_1 = /*#__PURE__*/require("@fluentui/react-utilities");
11
+
12
+ const react_shared_contexts_1 = /*#__PURE__*/require("@fluentui/react-shared-contexts");
13
+
14
+ const react_tabster_1 = /*#__PURE__*/require("@fluentui/react-tabster");
15
+ /**
16
+ * Creates a new element on a document.body to mount portals
17
+ */
18
+
19
+
20
+ const usePortalMountNode = options => {
21
+ const themeClassName = react_shared_contexts_1.useThemeClassName();
22
+ const {
23
+ targetDocument,
24
+ dir
25
+ } = react_shared_contexts_1.useFluent();
26
+ const element = React.useMemo(() => {
27
+ if (targetDocument === undefined || options.disabled) {
28
+ return undefined;
29
+ }
30
+
31
+ const newElement = targetDocument.createElement('div');
32
+ newElement.setAttribute('class', themeClassName);
33
+ newElement.setAttribute('dir', dir);
34
+ targetDocument.body.appendChild(newElement);
35
+ return newElement;
36
+ }, [targetDocument, themeClassName, dir, options.disabled]);
37
+ react_tabster_1.useKeyboardNavAttribute().current = element;
38
+ react_utilities_1.useIsomorphicLayoutEffect(() => {
39
+ return () => {
40
+ var _a;
41
+
42
+ (_a = element === null || element === void 0 ? void 0 : element.parentElement) === null || _a === void 0 ? void 0 : _a.removeChild(element);
43
+ };
44
+ }, [element]);
45
+ return element;
46
+ };
47
+
48
+ exports.usePortalMountNode = usePortalMountNode;
49
+ //# sourceMappingURL=usePortalMountNode.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["components/Portal/usePortalMountNode.ts"],"names":[],"mappings":";;;;;;;AAAA,MAAA,KAAA,gBAAA,OAAA,CAAA,OAAA,CAAA;;AACA,MAAA,iBAAA,gBAAA,OAAA,CAAA,2BAAA,CAAA;;AACA,MAAA,uBAAA,gBAAA,OAAA,CAAA,iCAAA,CAAA;;AACA,MAAA,eAAA,gBAAA,OAAA,CAAA,yBAAA,CAAA;AASA;;AAEG;;;AACI,MAAM,kBAAkB,GAAI,OAAD,IAAuC;AACvE,QAAM,cAAc,GAAG,uBAAA,CAAA,iBAAA,EAAvB;AACA,QAAM;AAAE,IAAA,cAAF;AAAkB,IAAA;AAAlB,MAA0B,uBAAA,CAAA,SAAA,EAAhC;AAEA,QAAM,OAAO,GAAG,KAAK,CAAC,OAAN,CAAc,MAAK;AACjC,QAAI,cAAc,KAAK,SAAnB,IAAgC,OAAO,CAAC,QAA5C,EAAsD;AACpD,aAAO,SAAP;AACD;;AAED,UAAM,UAAU,GAAG,cAAc,CAAC,aAAf,CAA6B,KAA7B,CAAnB;AACA,IAAA,UAAU,CAAC,YAAX,CAAwB,OAAxB,EAAiC,cAAjC;AACA,IAAA,UAAU,CAAC,YAAX,CAAwB,KAAxB,EAA+B,GAA/B;AACA,IAAA,cAAc,CAAC,IAAf,CAAoB,WAApB,CAAgC,UAAhC;AAEA,WAAO,UAAP;AACD,GAXe,EAWb,CAAC,cAAD,EAAiB,cAAjB,EAAiC,GAAjC,EAAsC,OAAO,CAAC,QAA9C,CAXa,CAAhB;AAaC,EAAA,eAAA,CAAA,uBAAA,GAAkE,OAAlE,GAA4E,OAA5E;AAED,EAAA,iBAAA,CAAA,yBAAA,CAA0B,MAAK;AAC7B,WAAO,MAAK;;;AACV,OAAA,EAAA,GAAA,OAAO,KAAA,IAAP,IAAA,OAAO,KAAA,KAAA,CAAP,GAAO,KAAA,CAAP,GAAA,OAAO,CAAE,aAAT,MAAsB,IAAtB,IAAsB,EAAA,KAAA,KAAA,CAAtB,GAAsB,KAAA,CAAtB,GAAsB,EAAA,CAAE,WAAF,CAAc,OAAd,CAAtB;AACD,KAFD;AAGD,GAJD,EAIG,CAAC,OAAD,CAJH;AAMA,SAAO,OAAP;AACD,CA1BM;;AAAM,OAAA,CAAA,kBAAA,GAAkB,kBAAlB","sourcesContent":["import * as React from 'react';\nimport { useIsomorphicLayoutEffect } from '@fluentui/react-utilities';\nimport { useThemeClassName, useFluent } from '@fluentui/react-shared-contexts';\nimport { useKeyboardNavAttribute } from '@fluentui/react-tabster';\n\nexport type UsePortalMountNodeOptions = {\n /**\n * Since hooks cannot be called conditionally use this flag to disable creating the node\n */\n disabled?: boolean;\n};\n\n/**\n * Creates a new element on a document.body to mount portals\n */\nexport const usePortalMountNode = (options: UsePortalMountNodeOptions) => {\n const themeClassName = useThemeClassName();\n const { targetDocument, dir } = useFluent();\n\n const element = React.useMemo(() => {\n if (targetDocument === undefined || options.disabled) {\n return undefined;\n }\n\n const newElement = targetDocument.createElement('div');\n newElement.setAttribute('class', themeClassName);\n newElement.setAttribute('dir', dir);\n targetDocument.body.appendChild(newElement);\n\n return newElement;\n }, [targetDocument, themeClassName, dir, options.disabled]);\n\n (useKeyboardNavAttribute() as React.MutableRefObject<HTMLElement>).current = element!;\n\n useIsomorphicLayoutEffect(() => {\n return () => {\n element?.parentElement?.removeChild(element);\n };\n }, [element]);\n\n return element;\n};\n"],"sourceRoot":"../src/"}
@@ -0,0 +1,2 @@
1
+ export * from './components/Portal/index';
2
+ export { elementContains, setVirtualParent } from './virtualParent/index';
@@ -0,0 +1,26 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.setVirtualParent = exports.elementContains = void 0;
7
+
8
+ const tslib_1 = /*#__PURE__*/require("tslib");
9
+
10
+ tslib_1.__exportStar(require("./components/Portal/index"), exports);
11
+
12
+ var index_1 = /*#__PURE__*/require("./virtualParent/index");
13
+
14
+ Object.defineProperty(exports, "elementContains", {
15
+ enumerable: true,
16
+ get: function () {
17
+ return index_1.elementContains;
18
+ }
19
+ });
20
+ Object.defineProperty(exports, "setVirtualParent", {
21
+ enumerable: true,
22
+ get: function () {
23
+ return index_1.setVirtualParent;
24
+ }
25
+ });
26
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["index.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,2BAAA,CAAA,EAAA,OAAA;;AACA,IAAA,OAAA,gBAAA,OAAA,CAAA,uBAAA,CAAA;;AAAS,MAAA,CAAA,cAAA,CAAA,OAAA,EAAA,iBAAA,EAAA;AAAA,EAAA,UAAA,EAAA,IAAA;AAAA,EAAA,GAAA,EAAA,YAAA;AAAA,WAAA,OAAA,CAAA,eAAA;AAAe;AAAf,CAAA;AAAiB,MAAA,CAAA,cAAA,CAAA,OAAA,EAAA,kBAAA,EAAA;AAAA,EAAA,UAAA,EAAA,IAAA;AAAA,EAAA,GAAA,EAAA,YAAA;AAAA,WAAA,OAAA,CAAA,gBAAA;AAAgB;AAAhB,CAAA","sourcesContent":["export * from './components/Portal/index';\nexport { elementContains, setVirtualParent } from './virtualParent/index';\n"],"sourceRoot":"../src/"}
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Similar functionality to `element.contains` DOM API for use with out of order DOM elements that
3
+ * checks the virtual parent hierarchy. If a virtual parents exists, it is chosen over the actual parent
4
+ *
5
+ * @returns true if the child can find the parent in its virtual hierarchy
6
+ */
7
+ export declare function elementContains(parent: HTMLElement | null, child: HTMLElement | null): boolean;