@fluentui/react-portal 9.1.3 → 9.1.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (37) hide show
  1. package/CHANGELOG.json +63 -1
  2. package/CHANGELOG.md +24 -2
  3. package/dist/index.d.ts +1 -1
  4. package/lib/components/Portal/usePortal.js.map +1 -1
  5. package/lib/virtualParent/elementContains.js +7 -2
  6. package/lib/virtualParent/elementContains.js.map +1 -1
  7. package/lib/virtualParent/getParent.js +18 -4
  8. package/lib/virtualParent/getParent.js.map +1 -1
  9. package/lib/virtualParent/index.js +0 -3
  10. package/lib/virtualParent/index.js.map +1 -1
  11. package/lib/virtualParent/setVirtualParent.js +1 -1
  12. package/lib/virtualParent/setVirtualParent.js.map +1 -1
  13. package/lib-amd/components/Portal/usePortal.js.map +1 -1
  14. package/lib-amd/virtualParent/elementContains.js +7 -2
  15. package/lib-amd/virtualParent/elementContains.js.map +1 -1
  16. package/lib-amd/virtualParent/getParent.js +19 -4
  17. package/lib-amd/virtualParent/getParent.js.map +1 -1
  18. package/lib-amd/virtualParent/index.js +1 -4
  19. package/lib-amd/virtualParent/index.js.map +1 -1
  20. package/lib-amd/virtualParent/setVirtualParent.js +1 -1
  21. package/lib-amd/virtualParent/setVirtualParent.js.map +1 -1
  22. package/lib-commonjs/components/Portal/usePortal.js.map +1 -1
  23. package/lib-commonjs/virtualParent/elementContains.js +7 -2
  24. package/lib-commonjs/virtualParent/elementContains.js.map +1 -1
  25. package/lib-commonjs/virtualParent/getParent.js +18 -4
  26. package/lib-commonjs/virtualParent/getParent.js.map +1 -1
  27. package/lib-commonjs/virtualParent/index.js +0 -3
  28. package/lib-commonjs/virtualParent/index.js.map +1 -1
  29. package/lib-commonjs/virtualParent/setVirtualParent.js +1 -1
  30. package/lib-commonjs/virtualParent/setVirtualParent.js.map +1 -1
  31. package/package.json +4 -4
  32. package/lib/virtualParent/getVirtualParent.js +0 -8
  33. package/lib/virtualParent/getVirtualParent.js.map +0 -1
  34. package/lib-amd/virtualParent/getVirtualParent.js +0 -13
  35. package/lib-amd/virtualParent/getVirtualParent.js.map +0 -1
  36. package/lib-commonjs/virtualParent/getVirtualParent.js +0 -15
  37. package/lib-commonjs/virtualParent/getVirtualParent.js.map +0 -1
package/CHANGELOG.json CHANGED
@@ -2,7 +2,69 @@
2
2
  "name": "@fluentui/react-portal",
3
3
  "entries": [
4
4
  {
5
- "date": "Mon, 23 Jan 2023 16:41:43 GMT",
5
+ "date": "Tue, 31 Jan 2023 19:50:42 GMT",
6
+ "tag": "@fluentui/react-portal_v9.1.5",
7
+ "version": "9.1.5",
8
+ "comments": {
9
+ "patch": [
10
+ {
11
+ "author": "beachball",
12
+ "package": "@fluentui/react-portal",
13
+ "comment": "Bump @fluentui/react-tabster to v9.4.2",
14
+ "commit": "22477ef4202cd24add6ebf823196b5888c9d8083"
15
+ },
16
+ {
17
+ "author": "beachball",
18
+ "package": "@fluentui/react-portal",
19
+ "comment": "Bump @fluentui/react-utilities to v9.5.1",
20
+ "commit": "22477ef4202cd24add6ebf823196b5888c9d8083"
21
+ }
22
+ ]
23
+ }
24
+ },
25
+ {
26
+ "date": "Thu, 26 Jan 2023 13:30:57 GMT",
27
+ "tag": "@fluentui/react-portal_v9.1.4",
28
+ "version": "9.1.4",
29
+ "comments": {
30
+ "none": [
31
+ {
32
+ "author": "miroslav.stastny@microsoft.com",
33
+ "package": "@fluentui/react-portal",
34
+ "commit": "6f29c8f65b2db6125efbd2a7ec2d7abdd0f44601",
35
+ "comment": "Lint based re-format"
36
+ }
37
+ ],
38
+ "patch": [
39
+ {
40
+ "author": "olfedias@microsoft.com",
41
+ "package": "@fluentui/react-portal",
42
+ "commit": "17ce027879486fa8d2a775864cb119fb194fab8b",
43
+ "comment": "fix: update elementContains() to handle circular references"
44
+ },
45
+ {
46
+ "author": "beachball",
47
+ "package": "@fluentui/react-portal",
48
+ "comment": "Bump @fluentui/react-shared-contexts to v9.2.0",
49
+ "commit": "403e1370f1effca7d3db131eda381abf31cf66b1"
50
+ },
51
+ {
52
+ "author": "beachball",
53
+ "package": "@fluentui/react-portal",
54
+ "comment": "Bump @fluentui/react-tabster to v9.4.1",
55
+ "commit": "403e1370f1effca7d3db131eda381abf31cf66b1"
56
+ },
57
+ {
58
+ "author": "beachball",
59
+ "package": "@fluentui/react-portal",
60
+ "comment": "Bump @fluentui/react-utilities to v9.5.0",
61
+ "commit": "403e1370f1effca7d3db131eda381abf31cf66b1"
62
+ }
63
+ ]
64
+ }
65
+ },
66
+ {
67
+ "date": "Mon, 23 Jan 2023 16:43:11 GMT",
6
68
  "tag": "@fluentui/react-portal_v9.1.3",
7
69
  "version": "9.1.3",
8
70
  "comments": {
package/CHANGELOG.md CHANGED
@@ -1,12 +1,34 @@
1
1
  # Change Log - @fluentui/react-portal
2
2
 
3
- This log was last generated on Mon, 23 Jan 2023 16:41:43 GMT and should not be manually modified.
3
+ This log was last generated on Tue, 31 Jan 2023 19:50:42 GMT and should not be manually modified.
4
4
 
5
5
  <!-- Start content -->
6
6
 
7
+ ## [9.1.5](https://github.com/microsoft/fluentui/tree/@fluentui/react-portal_v9.1.5)
8
+
9
+ Tue, 31 Jan 2023 19:50:42 GMT
10
+ [Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-portal_v9.1.4..@fluentui/react-portal_v9.1.5)
11
+
12
+ ### Patches
13
+
14
+ - Bump @fluentui/react-tabster to v9.4.2 ([PR #26491](https://github.com/microsoft/fluentui/pull/26491) by beachball)
15
+ - Bump @fluentui/react-utilities to v9.5.1 ([PR #26491](https://github.com/microsoft/fluentui/pull/26491) by beachball)
16
+
17
+ ## [9.1.4](https://github.com/microsoft/fluentui/tree/@fluentui/react-portal_v9.1.4)
18
+
19
+ Thu, 26 Jan 2023 13:30:57 GMT
20
+ [Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-portal_v9.1.3..@fluentui/react-portal_v9.1.4)
21
+
22
+ ### Patches
23
+
24
+ - fix: update elementContains() to handle circular references ([PR #26483](https://github.com/microsoft/fluentui/pull/26483) by olfedias@microsoft.com)
25
+ - Bump @fluentui/react-shared-contexts to v9.2.0 ([PR #26496](https://github.com/microsoft/fluentui/pull/26496) by beachball)
26
+ - Bump @fluentui/react-tabster to v9.4.1 ([PR #26496](https://github.com/microsoft/fluentui/pull/26496) by beachball)
27
+ - Bump @fluentui/react-utilities to v9.5.0 ([PR #26496](https://github.com/microsoft/fluentui/pull/26496) by beachball)
28
+
7
29
  ## [9.1.3](https://github.com/microsoft/fluentui/tree/@fluentui/react-portal_v9.1.3)
8
30
 
9
- Mon, 23 Jan 2023 16:41:43 GMT
31
+ Mon, 23 Jan 2023 16:43:11 GMT
10
32
  [Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-portal_v9.1.2..@fluentui/react-portal_v9.1.3)
11
33
 
12
34
  ### Patches
package/dist/index.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import * as React_2 from 'react';
2
2
 
3
3
  /**
4
- * Similar functionality to `element.contains` DOM API for use with out of order DOM elements that
4
+ * Similar functionality to `element.contains` DOM API for use without of order DOM elements that
5
5
  * checks the virtual parent hierarchy. If a virtual parents exists, it is chosen over the actual parent
6
6
  *
7
7
  * @returns true if the child can find the parent in its virtual hierarchy
@@ -1 +1 @@
1
- {"version":3,"mappings":"AAAA,OAAO,KAAKA,KAAK,MAAM,OAAO;AAC9B,SAASC,kBAAkB,QAAQ,sBAAsB;AACzD,SAASC,gBAAgB,QAAQ,2BAA2B;AAG5D;;;;;;;AAOA,OAAO,MAAMC,kBAAkB,GAAIC,KAAkB,IAAiB;EACpE,MAAM;IAAEC,QAAQ;IAAEC;EAAS,CAAE,GAAGF,KAAK;EAErC,MAAMG,oBAAoB,GAAGP,KAAK,CAACQ,MAAM,CAAkB,IAAI,CAAC;EAChE,MAAMC,iBAAiB,GAAGR,kBAAkB,CAAC;IAAES,QAAQ,EAAE,CAAC,CAACJ;EAAS,CAAE,CAAC;EAEvE,MAAMK,KAAK,GAAgB;IACzBN,QAAQ;IACRC,SAAS,EAAEA,SAAS,aAATA,SAAS,cAATA,SAAS,GAAIG,iBAAiB;IACzCF;GACD;EAEDP,KAAK,CAACY,SAAS,CAAC,MAAK;IACnB,IAAID,KAAK,CAACJ,oBAAoB,CAACM,OAAO,IAAIF,KAAK,CAACL,SAAS,EAAE;MACzDJ,gBAAgB,CAACS,KAAK,CAACL,SAAS,EAAEK,KAAK,CAACJ,oBAAoB,CAACM,OAAO,CAAC;;IAEvE,OAAO,MAAK;MACV,IAAIF,KAAK,CAACL,SAAS,EAAE;QAACJ,gBAAgB,CAACS,KAAK,CAACL,SAAS,EAAEQ,SAAS,CAAC;;IACpE,CAAC;EACH,CAAC,EAAE,CAACH,KAAK,CAACJ,oBAAoB,EAAEI,KAAK,CAACL,SAAS,CAAC,CAAC;EAEjD,OAAOK,KAAK;AACd,CAAC","names":["React","usePortalMountNode","setVirtualParent","usePortal_unstable","props","children","mountNode","virtualParentRootRef","useRef","fallbackMountNode","disabled","state","useEffect","current","undefined"],"sourceRoot":"../src/","sources":["packages/react-components/react-portal/src/components/Portal/usePortal.ts"],"sourcesContent":["import * as React from 'react';\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 virtualParentRootRef,\n };\n\n React.useEffect(() => {\n if (state.virtualParentRootRef.current && state.mountNode) {\n setVirtualParent(state.mountNode, state.virtualParentRootRef.current);\n }\n return () => {\n if (state.mountNode) {setVirtualParent(state.mountNode, undefined);}\n };\n }, [state.virtualParentRootRef, state.mountNode]);\n\n return state;\n};\n"]}
1
+ {"version":3,"mappings":"AAAA,OAAO,KAAKA,KAAK,MAAM,OAAO;AAC9B,SAASC,kBAAkB,QAAQ,sBAAsB;AACzD,SAASC,gBAAgB,QAAQ,2BAA2B;AAG5D;;;;;;;AAOA,OAAO,MAAMC,kBAAkB,GAAIC,KAAkB,IAAiB;EACpE,MAAM;IAAEC,QAAQ;IAAEC;EAAS,CAAE,GAAGF,KAAK;EAErC,MAAMG,oBAAoB,GAAGP,KAAK,CAACQ,MAAM,CAAkB,IAAI,CAAC;EAChE,MAAMC,iBAAiB,GAAGR,kBAAkB,CAAC;IAAES,QAAQ,EAAE,CAAC,CAACJ;EAAS,CAAE,CAAC;EAEvE,MAAMK,KAAK,GAAgB;IACzBN,QAAQ;IACRC,SAAS,EAAEA,SAAS,aAATA,SAAS,cAATA,SAAS,GAAIG,iBAAiB;IACzCF;GACD;EAEDP,KAAK,CAACY,SAAS,CAAC,MAAK;IACnB,IAAID,KAAK,CAACJ,oBAAoB,CAACM,OAAO,IAAIF,KAAK,CAACL,SAAS,EAAE;MACzDJ,gBAAgB,CAACS,KAAK,CAACL,SAAS,EAAEK,KAAK,CAACJ,oBAAoB,CAACM,OAAO,CAAC;;IAEvE,OAAO,MAAK;MACV,IAAIF,KAAK,CAACL,SAAS,EAAE;QACnBJ,gBAAgB,CAACS,KAAK,CAACL,SAAS,EAAEQ,SAAS,CAAC;;IAEhD,CAAC;EACH,CAAC,EAAE,CAACH,KAAK,CAACJ,oBAAoB,EAAEI,KAAK,CAACL,SAAS,CAAC,CAAC;EAEjD,OAAOK,KAAK;AACd,CAAC","names":["React","usePortalMountNode","setVirtualParent","usePortal_unstable","props","children","mountNode","virtualParentRootRef","useRef","fallbackMountNode","disabled","state","useEffect","current","undefined"],"sourceRoot":"../src/","sources":["packages/react-components/react-portal/src/components/Portal/usePortal.ts"],"sourcesContent":["import * as React from 'react';\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 virtualParentRootRef,\n };\n\n React.useEffect(() => {\n if (state.virtualParentRootRef.current && state.mountNode) {\n setVirtualParent(state.mountNode, state.virtualParentRootRef.current);\n }\n return () => {\n if (state.mountNode) {\n setVirtualParent(state.mountNode, undefined);\n }\n };\n }, [state.virtualParentRootRef, state.mountNode]);\n\n return state;\n};\n"]}
@@ -1,6 +1,6 @@
1
1
  import { getParent } from './getParent';
2
2
  /**
3
- * Similar functionality to `element.contains` DOM API for use with out of order DOM elements that
3
+ * Similar functionality to `element.contains` DOM API for use without of order DOM elements that
4
4
  * checks the virtual parent hierarchy. If a virtual parents exists, it is chosen over the actual parent
5
5
  *
6
6
  * @returns true if the child can find the parent in its virtual hierarchy
@@ -12,8 +12,13 @@ export function elementContains(parent, child) {
12
12
  if (parent === child) {
13
13
  return true;
14
14
  } else {
15
+ // Tracks references of nodes that have been visited to prevent infinite loops
16
+ const set = new WeakSet();
15
17
  while (child) {
16
- const nextParent = getParent(child);
18
+ const nextParent = getParent(child, {
19
+ skipVirtual: set.has(child)
20
+ });
21
+ set.add(child);
17
22
  if (nextParent === parent) {
18
23
  return true;
19
24
  }
@@ -1 +1 @@
1
- {"version":3,"mappings":"AAAA,SAASA,SAAS,QAAQ,aAAa;AACvC;;;;;;AAMA,OAAM,SAAUC,eAAe,CAACC,MAAmB,EAAEC,KAAkB;EACrE,IAAI,CAACD,MAAM,IAAI,CAACC,KAAK,EAAE;IACrB,OAAO,KAAK;;EAGd,IAAID,MAAM,KAAKC,KAAK,EAAE;IACpB,OAAO,IAAI;GACZ,MAAM;IACL,OAAOA,KAAK,EAAE;MACZ,MAAMC,UAAU,GAAGJ,SAAS,CAACG,KAAK,CAAC;MAEnC,IAAIC,UAAU,KAAKF,MAAM,EAAE;QACzB,OAAO,IAAI;;MAGbC,KAAK,GAAGC,UAAU;;;EAItB,OAAO,KAAK;AACd","names":["getParent","elementContains","parent","child","nextParent"],"sourceRoot":"../src/","sources":["packages/react-components/react-portal/src/virtualParent/elementContains.ts"],"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: Node | null, child: Node | 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 = getParent(child);\n\n if (nextParent === parent) {\n return true;\n }\n\n child = nextParent;\n }\n }\n\n return false;\n}\n"]}
1
+ {"version":3,"mappings":"AAAA,SAASA,SAAS,QAAQ,aAAa;AAEvC;;;;;;AAMA,OAAM,SAAUC,eAAe,CAACC,MAAmB,EAAEC,KAAkB;EACrE,IAAI,CAACD,MAAM,IAAI,CAACC,KAAK,EAAE;IACrB,OAAO,KAAK;;EAGd,IAAID,MAAM,KAAKC,KAAK,EAAE;IACpB,OAAO,IAAI;GACZ,MAAM;IACL;IACA,MAAMC,GAAG,GAAG,IAAIC,OAAO,EAAQ;IAE/B,OAAOF,KAAK,EAAE;MACZ,MAAMG,UAAU,GAAgBN,SAAS,CAACG,KAAK,EAAE;QAC/CI,WAAW,EAAEH,GAAG,CAACI,GAAG,CAACL,KAAK;OAC3B,CAAC;MACFC,GAAG,CAACK,GAAG,CAACN,KAAK,CAAC;MAEd,IAAIG,UAAU,KAAKJ,MAAM,EAAE;QACzB,OAAO,IAAI;;MAGbC,KAAK,GAAGG,UAAU;;;EAItB,OAAO,KAAK;AACd","names":["getParent","elementContains","parent","child","set","WeakSet","nextParent","skipVirtual","has","add"],"sourceRoot":"../src/","sources":["packages/react-components/react-portal/src/virtualParent/elementContains.ts"],"sourcesContent":["import { getParent } from './getParent';\n\n/**\n * Similar functionality to `element.contains` DOM API for use without 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: Node | null, child: Node | null): boolean {\n if (!parent || !child) {\n return false;\n }\n\n if (parent === child) {\n return true;\n } else {\n // Tracks references of nodes that have been visited to prevent infinite loops\n const set = new WeakSet<Node>();\n\n while (child) {\n const nextParent: Node | null = getParent(child, {\n skipVirtual: set.has(child),\n });\n set.add(child);\n\n if (nextParent === parent) {\n return true;\n }\n\n child = nextParent;\n }\n }\n\n return false;\n}\n"]}
@@ -1,10 +1,24 @@
1
- import { getVirtualParent } from './getVirtualParent';
1
+ import { isVirtualElement } from './isVirtualElement';
2
+ /**
3
+ * Gets the virtual parent given the child element, if it exists.
4
+ */
5
+ function getVirtualParent(child) {
6
+ return isVirtualElement(child) ? child._virtual.parent || null : null;
7
+ }
2
8
  /**
3
9
  * Gets the element which is the parent of a given element.
4
10
  * This method prefers the virtual parent over real DOM parent when present.
5
11
  */
6
- export function getParent(child) {
7
- var _a;
8
- return (_a = child && getVirtualParent(child) || (child === null || child === void 0 ? void 0 : child.parentNode)) !== null && _a !== void 0 ? _a : null;
12
+ export function getParent(child, options = {}) {
13
+ if (!child) {
14
+ return null;
15
+ }
16
+ if (!options.skipVirtual) {
17
+ const virtualParent = getVirtualParent(child);
18
+ if (virtualParent) {
19
+ return virtualParent;
20
+ }
21
+ }
22
+ return (child === null || child === void 0 ? void 0 : child.parentNode) || null;
9
23
  }
10
24
  //# sourceMappingURL=getParent.js.map
@@ -1 +1 @@
1
- {"version":3,"mappings":"AAAA,SAASA,gBAAgB,QAAQ,oBAAoB;AAErD;;;;AAIA,OAAM,SAAUC,SAAS,CAACC,KAAkB;;EAC1C,OAAO,MAAEA,KAAK,IAAIF,gBAAgB,CAACE,KAAK,CAAC,KAAKA,KAAK,aAALA,KAAK,uBAALA,KAAK,CAAEC,UAAU,CAAC,mCAAI,IAAI;AAC1E","names":["getVirtualParent","getParent","child","parentNode"],"sourceRoot":"../src/","sources":["packages/react-components/react-portal/src/virtualParent/getParent.ts"],"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: Node | null): Node | null {\n return ((child && getVirtualParent(child)) || child?.parentNode) ?? null;\n}\n"]}
1
+ {"version":3,"mappings":"AAAA,SAASA,gBAAgB,QAAQ,oBAAoB;AASrD;;;AAGA,SAASC,gBAAgB,CAACC,KAAW;EACnC,OAAOF,gBAAgB,CAACE,KAAK,CAAC,GAAGA,KAAK,CAACC,QAAQ,CAACC,MAAM,IAAI,IAAI,GAAG,IAAI;AACvE;AAEA;;;;AAIA,OAAM,SAAUC,SAAS,CAACH,KAAkB,EAAEI,UAA4B,EAAE;EAC1E,IAAI,CAACJ,KAAK,EAAE;IACV,OAAO,IAAI;;EAGb,IAAI,CAACI,OAAO,CAACC,WAAW,EAAE;IACxB,MAAMC,aAAa,GAAGP,gBAAgB,CAACC,KAAK,CAAC;IAE7C,IAAIM,aAAa,EAAE;MACjB,OAAOA,aAAa;;;EAIxB,OAAO,MAAK,aAALN,KAAK,uBAALA,KAAK,CAAEO,UAAU,KAAI,IAAI;AAClC","names":["isVirtualElement","getVirtualParent","child","_virtual","parent","getParent","options","skipVirtual","virtualParent","parentNode"],"sourceRoot":"../src/","sources":["packages/react-components/react-portal/src/virtualParent/getParent.ts"],"sourcesContent":["import { isVirtualElement } from './isVirtualElement';\n\ntype GetParentOptions = {\n /**\n * Indicates if getParent() should ignore a virtual parent.\n */\n skipVirtual?: boolean;\n};\n\n/**\n * Gets the virtual parent given the child element, if it exists.\n */\nfunction getVirtualParent(child: Node): Node | null {\n return isVirtualElement(child) ? child._virtual.parent || null : null;\n}\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: Node | null, options: GetParentOptions = {}): Node | null {\n if (!child) {\n return null;\n }\n\n if (!options.skipVirtual) {\n const virtualParent = getVirtualParent(child);\n\n if (virtualParent) {\n return virtualParent;\n }\n }\n\n return child?.parentNode || null;\n}\n"]}
@@ -1,6 +1,3 @@
1
1
  export * from './elementContains';
2
- export * from './getParent';
3
- export * from './getVirtualParent';
4
- export * from './isVirtualElement';
5
2
  export * from './setVirtualParent';
6
3
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"../src/","sources":["packages/react-components/react-portal/src/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"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"../src/","sources":["packages/react-components/react-portal/src/virtualParent/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAC;AAClC,cAAc,oBAAoB,CAAC","sourcesContent":["export * from './elementContains';\nexport * from './setVirtualParent';\n"]}
@@ -12,6 +12,6 @@ export function setVirtualParent(child, parent) {
12
12
  if (!virtualChild._virtual) {
13
13
  virtualChild._virtual = {};
14
14
  }
15
- virtualChild._virtual.parent = parent || undefined;
15
+ virtualChild._virtual.parent = parent;
16
16
  }
17
17
  //# sourceMappingURL=setVirtualParent.js.map
@@ -1 +1 @@
1
- {"version":3,"mappings":"AAEA;;;;;;AAMA,OAAM,SAAUA,gBAAgB,CAACC,KAAW,EAAEC,MAAa;EACzD,IAAI,CAACD,KAAK,EAAE;IACV;;EAGF,MAAME,YAAY,GAAGF,KAAuB;EAE5C,IAAI,CAACE,YAAY,CAACC,QAAQ,EAAE;IAC1BD,YAAY,CAACC,QAAQ,GAAG,EAAE;;EAG5BD,YAAY,CAACC,QAAQ,CAACF,MAAM,GAAGA,MAAM,IAAIG,SAAS;AACpD","names":["setVirtualParent","child","parent","virtualChild","_virtual","undefined"],"sourceRoot":"../src/","sources":["packages/react-components/react-portal/src/virtualParent/setVirtualParent.ts"],"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: Node, parent?: Node): void {\n if (!child) {\n return;\n }\n\n const virtualChild = child as VirtualElement;\n\n if (!virtualChild._virtual) {\n virtualChild._virtual = {};\n }\n\n virtualChild._virtual.parent = parent || undefined;\n}\n"]}
1
+ {"version":3,"mappings":"AAEA;;;;;;AAMA,OAAM,SAAUA,gBAAgB,CAACC,KAAW,EAAEC,MAAa;EACzD,IAAI,CAACD,KAAK,EAAE;IACV;;EAGF,MAAME,YAAY,GAAGF,KAAuB;EAE5C,IAAI,CAACE,YAAY,CAACC,QAAQ,EAAE;IAC1BD,YAAY,CAACC,QAAQ,GAAG,EAAE;;EAG5BD,YAAY,CAACC,QAAQ,CAACF,MAAM,GAAGA,MAAM;AACvC","names":["setVirtualParent","child","parent","virtualChild","_virtual"],"sourceRoot":"../src/","sources":["packages/react-components/react-portal/src/virtualParent/setVirtualParent.ts"],"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: Node, parent?: Node): void {\n if (!child) {\n return;\n }\n\n const virtualChild = child as VirtualElement;\n\n if (!virtualChild._virtual) {\n virtualChild._virtual = {};\n }\n\n virtualChild._virtual.parent = parent;\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"usePortal.js","sourceRoot":"","sources":["../../../../../../../../../packages/react-components/react-portal/src/components/Portal/usePortal.ts"],"names":[],"mappings":";;;;IAKA;;;;;;OAMG;IACI,IAAM,kBAAkB,GAAG,UAAC,KAAkB;QAC3C,IAAA,QAAQ,GAAgB,KAAK,SAArB,EAAE,SAAS,GAAK,KAAK,UAAV,CAAW;QAEtC,IAAM,oBAAoB,GAAG,KAAK,CAAC,MAAM,CAAkB,IAAI,CAAC,CAAC;QACjE,IAAM,iBAAiB,GAAG,uCAAkB,CAAC,EAAE,QAAQ,EAAE,CAAC,CAAC,SAAS,EAAE,CAAC,CAAC;QAExE,IAAM,KAAK,GAAgB;YACzB,QAAQ,UAAA;YACR,SAAS,EAAE,SAAS,aAAT,SAAS,cAAT,SAAS,GAAI,iBAAiB;YACzC,oBAAoB,sBAAA;SACrB,CAAC;QAEF,KAAK,CAAC,SAAS,CAAC;YACd,IAAI,KAAK,CAAC,oBAAoB,CAAC,OAAO,IAAI,KAAK,CAAC,SAAS,EAAE;gBACzD,wBAAgB,CAAC,KAAK,CAAC,SAAS,EAAE,KAAK,CAAC,oBAAoB,CAAC,OAAO,CAAC,CAAC;aACvE;YACD,OAAO;gBACL,IAAI,KAAK,CAAC,SAAS,EAAE;oBAAC,wBAAgB,CAAC,KAAK,CAAC,SAAS,EAAE,SAAS,CAAC,CAAC;iBAAC;YACtE,CAAC,CAAC;QACJ,CAAC,EAAE,CAAC,KAAK,CAAC,oBAAoB,EAAE,KAAK,CAAC,SAAS,CAAC,CAAC,CAAC;QAElD,OAAO,KAAK,CAAC;IACf,CAAC,CAAC;IAtBW,QAAA,kBAAkB,sBAsB7B","sourcesContent":["import * as React from 'react';\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 virtualParentRootRef,\n };\n\n React.useEffect(() => {\n if (state.virtualParentRootRef.current && state.mountNode) {\n setVirtualParent(state.mountNode, state.virtualParentRootRef.current);\n }\n return () => {\n if (state.mountNode) {setVirtualParent(state.mountNode, undefined);}\n };\n }, [state.virtualParentRootRef, state.mountNode]);\n\n return state;\n};\n"]}
1
+ {"version":3,"file":"usePortal.js","sourceRoot":"","sources":["../../../../../../../../../packages/react-components/react-portal/src/components/Portal/usePortal.ts"],"names":[],"mappings":";;;;IAKA;;;;;;OAMG;IACI,IAAM,kBAAkB,GAAG,UAAC,KAAkB;QAC3C,IAAA,QAAQ,GAAgB,KAAK,SAArB,EAAE,SAAS,GAAK,KAAK,UAAV,CAAW;QAEtC,IAAM,oBAAoB,GAAG,KAAK,CAAC,MAAM,CAAkB,IAAI,CAAC,CAAC;QACjE,IAAM,iBAAiB,GAAG,uCAAkB,CAAC,EAAE,QAAQ,EAAE,CAAC,CAAC,SAAS,EAAE,CAAC,CAAC;QAExE,IAAM,KAAK,GAAgB;YACzB,QAAQ,UAAA;YACR,SAAS,EAAE,SAAS,aAAT,SAAS,cAAT,SAAS,GAAI,iBAAiB;YACzC,oBAAoB,sBAAA;SACrB,CAAC;QAEF,KAAK,CAAC,SAAS,CAAC;YACd,IAAI,KAAK,CAAC,oBAAoB,CAAC,OAAO,IAAI,KAAK,CAAC,SAAS,EAAE;gBACzD,wBAAgB,CAAC,KAAK,CAAC,SAAS,EAAE,KAAK,CAAC,oBAAoB,CAAC,OAAO,CAAC,CAAC;aACvE;YACD,OAAO;gBACL,IAAI,KAAK,CAAC,SAAS,EAAE;oBACnB,wBAAgB,CAAC,KAAK,CAAC,SAAS,EAAE,SAAS,CAAC,CAAC;iBAC9C;YACH,CAAC,CAAC;QACJ,CAAC,EAAE,CAAC,KAAK,CAAC,oBAAoB,EAAE,KAAK,CAAC,SAAS,CAAC,CAAC,CAAC;QAElD,OAAO,KAAK,CAAC;IACf,CAAC,CAAC;IAxBW,QAAA,kBAAkB,sBAwB7B","sourcesContent":["import * as React from 'react';\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 virtualParentRootRef,\n };\n\n React.useEffect(() => {\n if (state.virtualParentRootRef.current && state.mountNode) {\n setVirtualParent(state.mountNode, state.virtualParentRootRef.current);\n }\n return () => {\n if (state.mountNode) {\n setVirtualParent(state.mountNode, undefined);\n }\n };\n }, [state.virtualParentRootRef, state.mountNode]);\n\n return state;\n};\n"]}
@@ -3,7 +3,7 @@ define(["require", "exports", "./getParent"], function (require, exports, getPar
3
3
  Object.defineProperty(exports, "__esModule", { value: true });
4
4
  exports.elementContains = void 0;
5
5
  /**
6
- * Similar functionality to `element.contains` DOM API for use with out of order DOM elements that
6
+ * Similar functionality to `element.contains` DOM API for use without of order DOM elements that
7
7
  * checks the virtual parent hierarchy. If a virtual parents exists, it is chosen over the actual parent
8
8
  *
9
9
  * @returns true if the child can find the parent in its virtual hierarchy
@@ -16,8 +16,13 @@ define(["require", "exports", "./getParent"], function (require, exports, getPar
16
16
  return true;
17
17
  }
18
18
  else {
19
+ // Tracks references of nodes that have been visited to prevent infinite loops
20
+ var set = new WeakSet();
19
21
  while (child) {
20
- var nextParent = getParent_1.getParent(child);
22
+ var nextParent = getParent_1.getParent(child, {
23
+ skipVirtual: set.has(child),
24
+ });
25
+ set.add(child);
21
26
  if (nextParent === parent) {
22
27
  return true;
23
28
  }
@@ -1 +1 @@
1
- {"version":3,"file":"elementContains.js","sourceRoot":"","sources":["../../../../../../../../packages/react-components/react-portal/src/virtualParent/elementContains.ts"],"names":[],"mappings":";;;;IACA;;;;;OAKG;IACH,SAAgB,eAAe,CAAC,MAAmB,EAAE,KAAkB;QACrE,IAAI,CAAC,MAAM,IAAI,CAAC,KAAK,EAAE;YACrB,OAAO,KAAK,CAAC;SACd;QAED,IAAI,MAAM,KAAK,KAAK,EAAE;YACpB,OAAO,IAAI,CAAC;SACb;aAAM;YACL,OAAO,KAAK,EAAE;gBACZ,IAAM,UAAU,GAAG,qBAAS,CAAC,KAAK,CAAC,CAAC;gBAEpC,IAAI,UAAU,KAAK,MAAM,EAAE;oBACzB,OAAO,IAAI,CAAC;iBACb;gBAED,KAAK,GAAG,UAAU,CAAC;aACpB;SACF;QAED,OAAO,KAAK,CAAC;IACf,CAAC;IApBD,0CAoBC","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: Node | null, child: Node | 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 = getParent(child);\n\n if (nextParent === parent) {\n return true;\n }\n\n child = nextParent;\n }\n }\n\n return false;\n}\n"]}
1
+ {"version":3,"file":"elementContains.js","sourceRoot":"","sources":["../../../../../../../../packages/react-components/react-portal/src/virtualParent/elementContains.ts"],"names":[],"mappings":";;;;IAEA;;;;;OAKG;IACH,SAAgB,eAAe,CAAC,MAAmB,EAAE,KAAkB;QACrE,IAAI,CAAC,MAAM,IAAI,CAAC,KAAK,EAAE;YACrB,OAAO,KAAK,CAAC;SACd;QAED,IAAI,MAAM,KAAK,KAAK,EAAE;YACpB,OAAO,IAAI,CAAC;SACb;aAAM;YACL,8EAA8E;YAC9E,IAAM,GAAG,GAAG,IAAI,OAAO,EAAQ,CAAC;YAEhC,OAAO,KAAK,EAAE;gBACZ,IAAM,UAAU,GAAgB,qBAAS,CAAC,KAAK,EAAE;oBAC/C,WAAW,EAAE,GAAG,CAAC,GAAG,CAAC,KAAK,CAAC;iBAC5B,CAAC,CAAC;gBACH,GAAG,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;gBAEf,IAAI,UAAU,KAAK,MAAM,EAAE;oBACzB,OAAO,IAAI,CAAC;iBACb;gBAED,KAAK,GAAG,UAAU,CAAC;aACpB;SACF;QAED,OAAO,KAAK,CAAC;IACf,CAAC;IA1BD,0CA0BC","sourcesContent":["import { getParent } from './getParent';\n\n/**\n * Similar functionality to `element.contains` DOM API for use without 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: Node | null, child: Node | null): boolean {\n if (!parent || !child) {\n return false;\n }\n\n if (parent === child) {\n return true;\n } else {\n // Tracks references of nodes that have been visited to prevent infinite loops\n const set = new WeakSet<Node>();\n\n while (child) {\n const nextParent: Node | null = getParent(child, {\n skipVirtual: set.has(child),\n });\n set.add(child);\n\n if (nextParent === parent) {\n return true;\n }\n\n child = nextParent;\n }\n }\n\n return false;\n}\n"]}
@@ -1,14 +1,29 @@
1
- define(["require", "exports", "./getVirtualParent"], function (require, exports, getVirtualParent_1) {
1
+ define(["require", "exports", "./isVirtualElement"], function (require, exports, isVirtualElement_1) {
2
2
  "use strict";
3
3
  Object.defineProperty(exports, "__esModule", { value: true });
4
4
  exports.getParent = void 0;
5
+ /**
6
+ * Gets the virtual parent given the child element, if it exists.
7
+ */
8
+ function getVirtualParent(child) {
9
+ return isVirtualElement_1.isVirtualElement(child) ? child._virtual.parent || null : null;
10
+ }
5
11
  /**
6
12
  * Gets the element which is the parent of a given element.
7
13
  * This method prefers the virtual parent over real DOM parent when present.
8
14
  */
9
- function getParent(child) {
10
- var _a;
11
- return (_a = ((child && getVirtualParent_1.getVirtualParent(child)) || (child === null || child === void 0 ? void 0 : child.parentNode))) !== null && _a !== void 0 ? _a : null;
15
+ function getParent(child, options) {
16
+ if (options === void 0) { options = {}; }
17
+ if (!child) {
18
+ return null;
19
+ }
20
+ if (!options.skipVirtual) {
21
+ var virtualParent = getVirtualParent(child);
22
+ if (virtualParent) {
23
+ return virtualParent;
24
+ }
25
+ }
26
+ return (child === null || child === void 0 ? void 0 : child.parentNode) || null;
12
27
  }
13
28
  exports.getParent = getParent;
14
29
  });
@@ -1 +1 @@
1
- {"version":3,"file":"getParent.js","sourceRoot":"","sources":["../../../../../../../../packages/react-components/react-portal/src/virtualParent/getParent.ts"],"names":[],"mappings":";;;;IAEA;;;OAGG;IACH,SAAgB,SAAS,CAAC,KAAkB;;QAC1C,OAAO,MAAA,CAAC,CAAC,KAAK,IAAI,mCAAgB,CAAC,KAAK,CAAC,CAAC,KAAI,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,UAAU,CAAA,CAAC,mCAAI,IAAI,CAAC;IAC3E,CAAC;IAFD,8BAEC","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: Node | null): Node | null {\n return ((child && getVirtualParent(child)) || child?.parentNode) ?? null;\n}\n"]}
1
+ {"version":3,"file":"getParent.js","sourceRoot":"","sources":["../../../../../../../../packages/react-components/react-portal/src/virtualParent/getParent.ts"],"names":[],"mappings":";;;;IASA;;OAEG;IACH,SAAS,gBAAgB,CAAC,KAAW;QACnC,OAAO,mCAAgB,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,QAAQ,CAAC,MAAM,IAAI,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC;IACxE,CAAC;IAED;;;OAGG;IACH,SAAgB,SAAS,CAAC,KAAkB,EAAE,OAA8B;QAA9B,wBAAA,EAAA,YAA8B;QAC1E,IAAI,CAAC,KAAK,EAAE;YACV,OAAO,IAAI,CAAC;SACb;QAED,IAAI,CAAC,OAAO,CAAC,WAAW,EAAE;YACxB,IAAM,aAAa,GAAG,gBAAgB,CAAC,KAAK,CAAC,CAAC;YAE9C,IAAI,aAAa,EAAE;gBACjB,OAAO,aAAa,CAAC;aACtB;SACF;QAED,OAAO,CAAA,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,UAAU,KAAI,IAAI,CAAC;IACnC,CAAC;IAdD,8BAcC","sourcesContent":["import { isVirtualElement } from './isVirtualElement';\n\ntype GetParentOptions = {\n /**\n * Indicates if getParent() should ignore a virtual parent.\n */\n skipVirtual?: boolean;\n};\n\n/**\n * Gets the virtual parent given the child element, if it exists.\n */\nfunction getVirtualParent(child: Node): Node | null {\n return isVirtualElement(child) ? child._virtual.parent || null : null;\n}\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: Node | null, options: GetParentOptions = {}): Node | null {\n if (!child) {\n return null;\n }\n\n if (!options.skipVirtual) {\n const virtualParent = getVirtualParent(child);\n\n if (virtualParent) {\n return virtualParent;\n }\n }\n\n return child?.parentNode || null;\n}\n"]}
@@ -1,10 +1,7 @@
1
- define(["require", "exports", "tslib", "./elementContains", "./getParent", "./getVirtualParent", "./isVirtualElement", "./setVirtualParent"], function (require, exports, tslib_1, elementContains_1, getParent_1, getVirtualParent_1, isVirtualElement_1, setVirtualParent_1) {
1
+ define(["require", "exports", "tslib", "./elementContains", "./setVirtualParent"], function (require, exports, tslib_1, elementContains_1, setVirtualParent_1) {
2
2
  "use strict";
3
3
  Object.defineProperty(exports, "__esModule", { value: true });
4
4
  tslib_1.__exportStar(elementContains_1, exports);
5
- tslib_1.__exportStar(getParent_1, exports);
6
- tslib_1.__exportStar(getVirtualParent_1, exports);
7
- tslib_1.__exportStar(isVirtualElement_1, exports);
8
5
  tslib_1.__exportStar(setVirtualParent_1, exports);
9
6
  });
10
7
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../../../packages/react-components/react-portal/src/virtualParent/index.ts"],"names":[],"mappings":";;;IAAA,iDAAkC;IAClC,2CAA4B;IAC5B,kDAAmC;IACnC,kDAAmC;IACnC,kDAAmC","sourcesContent":["export * from './elementContains';\nexport * from './getParent';\nexport * from './getVirtualParent';\nexport * from './isVirtualElement';\nexport * from './setVirtualParent';\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../../../packages/react-components/react-portal/src/virtualParent/index.ts"],"names":[],"mappings":";;;IAAA,iDAAkC;IAClC,kDAAmC","sourcesContent":["export * from './elementContains';\nexport * from './setVirtualParent';\n"]}
@@ -16,7 +16,7 @@ define(["require", "exports"], function (require, exports) {
16
16
  if (!virtualChild._virtual) {
17
17
  virtualChild._virtual = {};
18
18
  }
19
- virtualChild._virtual.parent = parent || undefined;
19
+ virtualChild._virtual.parent = parent;
20
20
  }
21
21
  exports.setVirtualParent = setVirtualParent;
22
22
  });
@@ -1 +1 @@
1
- {"version":3,"file":"setVirtualParent.js","sourceRoot":"","sources":["../../../../../../../../packages/react-components/react-portal/src/virtualParent/setVirtualParent.ts"],"names":[],"mappings":";;;;IAEA;;;;;OAKG;IACH,SAAgB,gBAAgB,CAAC,KAAW,EAAE,MAAa;QACzD,IAAI,CAAC,KAAK,EAAE;YACV,OAAO;SACR;QAED,IAAM,YAAY,GAAG,KAAuB,CAAC;QAE7C,IAAI,CAAC,YAAY,CAAC,QAAQ,EAAE;YAC1B,YAAY,CAAC,QAAQ,GAAG,EAAE,CAAC;SAC5B;QAED,YAAY,CAAC,QAAQ,CAAC,MAAM,GAAG,MAAM,IAAI,SAAS,CAAC;IACrD,CAAC;IAZD,4CAYC","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: Node, parent?: Node): void {\n if (!child) {\n return;\n }\n\n const virtualChild = child as VirtualElement;\n\n if (!virtualChild._virtual) {\n virtualChild._virtual = {};\n }\n\n virtualChild._virtual.parent = parent || undefined;\n}\n"]}
1
+ {"version":3,"file":"setVirtualParent.js","sourceRoot":"","sources":["../../../../../../../../packages/react-components/react-portal/src/virtualParent/setVirtualParent.ts"],"names":[],"mappings":";;;;IAEA;;;;;OAKG;IACH,SAAgB,gBAAgB,CAAC,KAAW,EAAE,MAAa;QACzD,IAAI,CAAC,KAAK,EAAE;YACV,OAAO;SACR;QAED,IAAM,YAAY,GAAG,KAAuB,CAAC;QAE7C,IAAI,CAAC,YAAY,CAAC,QAAQ,EAAE;YAC1B,YAAY,CAAC,QAAQ,GAAG,EAAE,CAAC;SAC5B;QAED,YAAY,CAAC,QAAQ,CAAC,MAAM,GAAG,MAAM,CAAC;IACxC,CAAC;IAZD,4CAYC","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: Node, parent?: Node): void {\n if (!child) {\n return;\n }\n\n const virtualChild = child as VirtualElement;\n\n if (!virtualChild._virtual) {\n virtualChild._virtual = {};\n }\n\n virtualChild._virtual.parent = parent;\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"mappings":";;;;;;AAAA;AACA;AACA;AAGA;;;;;;;AAOO,MAAMA,kBAAkB,GAAIC,KAAkB,IAAiB;EACpE,MAAM;IAAEC,QAAQ;IAAEC;EAAS,CAAE,GAAGF,KAAK;EAErC,MAAMG,oBAAoB,GAAGC,KAAK,CAACC,MAAM,CAAkB,IAAI,CAAC;EAChE,MAAMC,iBAAiB,GAAGC,uCAAkB,CAAC;IAAEC,QAAQ,EAAE,CAAC,CAACN;EAAS,CAAE,CAAC;EAEvE,MAAMO,KAAK,GAAgB;IACzBR,QAAQ;IACRC,SAAS,EAAEA,SAAS,aAATA,SAAS,cAATA,SAAS,GAAII,iBAAiB;IACzCH;GACD;EAEDC,KAAK,CAACM,SAAS,CAAC,MAAK;IACnB,IAAID,KAAK,CAACN,oBAAoB,CAACQ,OAAO,IAAIF,KAAK,CAACP,SAAS,EAAE;MACzDU,wBAAgB,CAACH,KAAK,CAACP,SAAS,EAAEO,KAAK,CAACN,oBAAoB,CAACQ,OAAO,CAAC;;IAEvE,OAAO,MAAK;MACV,IAAIF,KAAK,CAACP,SAAS,EAAE;QAACU,wBAAgB,CAACH,KAAK,CAACP,SAAS,EAAEW,SAAS,CAAC;;IACpE,CAAC;EACH,CAAC,EAAE,CAACJ,KAAK,CAACN,oBAAoB,EAAEM,KAAK,CAACP,SAAS,CAAC,CAAC;EAEjD,OAAOO,KAAK;AACd,CAAC;AAtBYK,0BAAkB","names":["usePortal_unstable","props","children","mountNode","virtualParentRootRef","React","useRef","fallbackMountNode","usePortalMountNode_1","disabled","state","useEffect","current","index_1","undefined","exports"],"sourceRoot":"../src/","sources":["packages/react-components/react-portal/src/components/Portal/usePortal.ts"],"sourcesContent":["import * as React from 'react';\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 virtualParentRootRef,\n };\n\n React.useEffect(() => {\n if (state.virtualParentRootRef.current && state.mountNode) {\n setVirtualParent(state.mountNode, state.virtualParentRootRef.current);\n }\n return () => {\n if (state.mountNode) {setVirtualParent(state.mountNode, undefined);}\n };\n }, [state.virtualParentRootRef, state.mountNode]);\n\n return state;\n};\n"]}
1
+ {"version":3,"mappings":";;;;;;AAAA;AACA;AACA;AAGA;;;;;;;AAOO,MAAMA,kBAAkB,GAAIC,KAAkB,IAAiB;EACpE,MAAM;IAAEC,QAAQ;IAAEC;EAAS,CAAE,GAAGF,KAAK;EAErC,MAAMG,oBAAoB,GAAGC,KAAK,CAACC,MAAM,CAAkB,IAAI,CAAC;EAChE,MAAMC,iBAAiB,GAAGC,uCAAkB,CAAC;IAAEC,QAAQ,EAAE,CAAC,CAACN;EAAS,CAAE,CAAC;EAEvE,MAAMO,KAAK,GAAgB;IACzBR,QAAQ;IACRC,SAAS,EAAEA,SAAS,aAATA,SAAS,cAATA,SAAS,GAAII,iBAAiB;IACzCH;GACD;EAEDC,KAAK,CAACM,SAAS,CAAC,MAAK;IACnB,IAAID,KAAK,CAACN,oBAAoB,CAACQ,OAAO,IAAIF,KAAK,CAACP,SAAS,EAAE;MACzDU,wBAAgB,CAACH,KAAK,CAACP,SAAS,EAAEO,KAAK,CAACN,oBAAoB,CAACQ,OAAO,CAAC;;IAEvE,OAAO,MAAK;MACV,IAAIF,KAAK,CAACP,SAAS,EAAE;QACnBU,wBAAgB,CAACH,KAAK,CAACP,SAAS,EAAEW,SAAS,CAAC;;IAEhD,CAAC;EACH,CAAC,EAAE,CAACJ,KAAK,CAACN,oBAAoB,EAAEM,KAAK,CAACP,SAAS,CAAC,CAAC;EAEjD,OAAOO,KAAK;AACd,CAAC;AAxBYK,0BAAkB","names":["usePortal_unstable","props","children","mountNode","virtualParentRootRef","React","useRef","fallbackMountNode","usePortalMountNode_1","disabled","state","useEffect","current","index_1","undefined","exports"],"sourceRoot":"../src/","sources":["packages/react-components/react-portal/src/components/Portal/usePortal.ts"],"sourcesContent":["import * as React from 'react';\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 virtualParentRootRef,\n };\n\n React.useEffect(() => {\n if (state.virtualParentRootRef.current && state.mountNode) {\n setVirtualParent(state.mountNode, state.virtualParentRootRef.current);\n }\n return () => {\n if (state.mountNode) {\n setVirtualParent(state.mountNode, undefined);\n }\n };\n }, [state.virtualParentRootRef, state.mountNode]);\n\n return state;\n};\n"]}
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", {
6
6
  exports.elementContains = void 0;
7
7
  const getParent_1 = /*#__PURE__*/require("./getParent");
8
8
  /**
9
- * Similar functionality to `element.contains` DOM API for use with out of order DOM elements that
9
+ * Similar functionality to `element.contains` DOM API for use without of order DOM elements that
10
10
  * checks the virtual parent hierarchy. If a virtual parents exists, it is chosen over the actual parent
11
11
  *
12
12
  * @returns true if the child can find the parent in its virtual hierarchy
@@ -18,8 +18,13 @@ function elementContains(parent, child) {
18
18
  if (parent === child) {
19
19
  return true;
20
20
  } else {
21
+ // Tracks references of nodes that have been visited to prevent infinite loops
22
+ const set = new WeakSet();
21
23
  while (child) {
22
- const nextParent = getParent_1.getParent(child);
24
+ const nextParent = getParent_1.getParent(child, {
25
+ skipVirtual: set.has(child)
26
+ });
27
+ set.add(child);
23
28
  if (nextParent === parent) {
24
29
  return true;
25
30
  }
@@ -1 +1 @@
1
- {"version":3,"mappings":";;;;;;AAAA;AACA;;;;;;AAMA,SAAgBA,eAAe,CAACC,MAAmB,EAAEC,KAAkB;EACrE,IAAI,CAACD,MAAM,IAAI,CAACC,KAAK,EAAE;IACrB,OAAO,KAAK;;EAGd,IAAID,MAAM,KAAKC,KAAK,EAAE;IACpB,OAAO,IAAI;GACZ,MAAM;IACL,OAAOA,KAAK,EAAE;MACZ,MAAMC,UAAU,GAAGC,qBAAS,CAACF,KAAK,CAAC;MAEnC,IAAIC,UAAU,KAAKF,MAAM,EAAE;QACzB,OAAO,IAAI;;MAGbC,KAAK,GAAGC,UAAU;;;EAItB,OAAO,KAAK;AACd;AApBAE","names":["elementContains","parent","child","nextParent","getParent_1","exports"],"sourceRoot":"../src/","sources":["packages/react-components/react-portal/src/virtualParent/elementContains.ts"],"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: Node | null, child: Node | 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 = getParent(child);\n\n if (nextParent === parent) {\n return true;\n }\n\n child = nextParent;\n }\n }\n\n return false;\n}\n"]}
1
+ {"version":3,"mappings":";;;;;;AAAA;AAEA;;;;;;AAMA,SAAgBA,eAAe,CAACC,MAAmB,EAAEC,KAAkB;EACrE,IAAI,CAACD,MAAM,IAAI,CAACC,KAAK,EAAE;IACrB,OAAO,KAAK;;EAGd,IAAID,MAAM,KAAKC,KAAK,EAAE;IACpB,OAAO,IAAI;GACZ,MAAM;IACL;IACA,MAAMC,GAAG,GAAG,IAAIC,OAAO,EAAQ;IAE/B,OAAOF,KAAK,EAAE;MACZ,MAAMG,UAAU,GAAgBC,qBAAS,CAACJ,KAAK,EAAE;QAC/CK,WAAW,EAAEJ,GAAG,CAACK,GAAG,CAACN,KAAK;OAC3B,CAAC;MACFC,GAAG,CAACM,GAAG,CAACP,KAAK,CAAC;MAEd,IAAIG,UAAU,KAAKJ,MAAM,EAAE;QACzB,OAAO,IAAI;;MAGbC,KAAK,GAAGG,UAAU;;;EAItB,OAAO,KAAK;AACd;AA1BAK","names":["elementContains","parent","child","set","WeakSet","nextParent","getParent_1","skipVirtual","has","add","exports"],"sourceRoot":"../src/","sources":["packages/react-components/react-portal/src/virtualParent/elementContains.ts"],"sourcesContent":["import { getParent } from './getParent';\n\n/**\n * Similar functionality to `element.contains` DOM API for use without 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: Node | null, child: Node | null): boolean {\n if (!parent || !child) {\n return false;\n }\n\n if (parent === child) {\n return true;\n } else {\n // Tracks references of nodes that have been visited to prevent infinite loops\n const set = new WeakSet<Node>();\n\n while (child) {\n const nextParent: Node | null = getParent(child, {\n skipVirtual: set.has(child),\n });\n set.add(child);\n\n if (nextParent === parent) {\n return true;\n }\n\n child = nextParent;\n }\n }\n\n return false;\n}\n"]}
@@ -4,14 +4,28 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.getParent = void 0;
7
- const getVirtualParent_1 = /*#__PURE__*/require("./getVirtualParent");
7
+ const isVirtualElement_1 = /*#__PURE__*/require("./isVirtualElement");
8
+ /**
9
+ * Gets the virtual parent given the child element, if it exists.
10
+ */
11
+ function getVirtualParent(child) {
12
+ return isVirtualElement_1.isVirtualElement(child) ? child._virtual.parent || null : null;
13
+ }
8
14
  /**
9
15
  * Gets the element which is the parent of a given element.
10
16
  * This method prefers the virtual parent over real DOM parent when present.
11
17
  */
12
- function getParent(child) {
13
- var _a;
14
- return (_a = child && getVirtualParent_1.getVirtualParent(child) || (child === null || child === void 0 ? void 0 : child.parentNode)) !== null && _a !== void 0 ? _a : null;
18
+ function getParent(child, options = {}) {
19
+ if (!child) {
20
+ return null;
21
+ }
22
+ if (!options.skipVirtual) {
23
+ const virtualParent = getVirtualParent(child);
24
+ if (virtualParent) {
25
+ return virtualParent;
26
+ }
27
+ }
28
+ return (child === null || child === void 0 ? void 0 : child.parentNode) || null;
15
29
  }
16
30
  exports.getParent = getParent;
17
31
  //# sourceMappingURL=getParent.js.map
@@ -1 +1 @@
1
- {"version":3,"mappings":";;;;;;AAAA;AAEA;;;;AAIA,SAAgBA,SAAS,CAACC,KAAkB;;EAC1C,OAAO,MAAEA,KAAK,IAAIC,mCAAgB,CAACD,KAAK,CAAC,KAAKA,KAAK,aAALA,KAAK,uBAALA,KAAK,CAAEE,UAAU,CAAC,mCAAI,IAAI;AAC1E;AAFAC","names":["getParent","child","getVirtualParent_1","parentNode","exports"],"sourceRoot":"../src/","sources":["packages/react-components/react-portal/src/virtualParent/getParent.ts"],"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: Node | null): Node | null {\n return ((child && getVirtualParent(child)) || child?.parentNode) ?? null;\n}\n"]}
1
+ {"version":3,"mappings":";;;;;;AAAA;AASA;;;AAGA,SAASA,gBAAgB,CAACC,KAAW;EACnC,OAAOC,mCAAgB,CAACD,KAAK,CAAC,GAAGA,KAAK,CAACE,QAAQ,CAACC,MAAM,IAAI,IAAI,GAAG,IAAI;AACvE;AAEA;;;;AAIA,SAAgBC,SAAS,CAACJ,KAAkB,EAAEK,UAA4B,EAAE;EAC1E,IAAI,CAACL,KAAK,EAAE;IACV,OAAO,IAAI;;EAGb,IAAI,CAACK,OAAO,CAACC,WAAW,EAAE;IACxB,MAAMC,aAAa,GAAGR,gBAAgB,CAACC,KAAK,CAAC;IAE7C,IAAIO,aAAa,EAAE;MACjB,OAAOA,aAAa;;;EAIxB,OAAO,MAAK,aAALP,KAAK,uBAALA,KAAK,CAAEQ,UAAU,KAAI,IAAI;AAClC;AAdAC","names":["getVirtualParent","child","isVirtualElement_1","_virtual","parent","getParent","options","skipVirtual","virtualParent","parentNode","exports"],"sourceRoot":"../src/","sources":["packages/react-components/react-portal/src/virtualParent/getParent.ts"],"sourcesContent":["import { isVirtualElement } from './isVirtualElement';\n\ntype GetParentOptions = {\n /**\n * Indicates if getParent() should ignore a virtual parent.\n */\n skipVirtual?: boolean;\n};\n\n/**\n * Gets the virtual parent given the child element, if it exists.\n */\nfunction getVirtualParent(child: Node): Node | null {\n return isVirtualElement(child) ? child._virtual.parent || null : null;\n}\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: Node | null, options: GetParentOptions = {}): Node | null {\n if (!child) {\n return null;\n }\n\n if (!options.skipVirtual) {\n const virtualParent = getVirtualParent(child);\n\n if (virtualParent) {\n return virtualParent;\n }\n }\n\n return child?.parentNode || null;\n}\n"]}
@@ -5,8 +5,5 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  const tslib_1 = /*#__PURE__*/require("tslib");
7
7
  tslib_1.__exportStar(require("./elementContains"), exports);
8
- tslib_1.__exportStar(require("./getParent"), exports);
9
- tslib_1.__exportStar(require("./getVirtualParent"), exports);
10
- tslib_1.__exportStar(require("./isVirtualElement"), exports);
11
8
  tslib_1.__exportStar(require("./setVirtualParent"), exports);
12
9
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"mappings":";;;;;;AAAAA;AACAA;AACAA;AACAA;AACAA","names":["tslib_1"],"sourceRoot":"../src/","sources":["packages/react-components/react-portal/src/virtualParent/index.ts"],"sourcesContent":["export * from './elementContains';\nexport * from './getParent';\nexport * from './getVirtualParent';\nexport * from './isVirtualElement';\nexport * from './setVirtualParent';\n"]}
1
+ {"version":3,"mappings":";;;;;;AAAAA;AACAA","names":["tslib_1"],"sourceRoot":"../src/","sources":["packages/react-components/react-portal/src/virtualParent/index.ts"],"sourcesContent":["export * from './elementContains';\nexport * from './setVirtualParent';\n"]}
@@ -18,7 +18,7 @@ function setVirtualParent(child, parent) {
18
18
  if (!virtualChild._virtual) {
19
19
  virtualChild._virtual = {};
20
20
  }
21
- virtualChild._virtual.parent = parent || undefined;
21
+ virtualChild._virtual.parent = parent;
22
22
  }
23
23
  exports.setVirtualParent = setVirtualParent;
24
24
  //# sourceMappingURL=setVirtualParent.js.map
@@ -1 +1 @@
1
- {"version":3,"mappings":";;;;;;AAEA;;;;;;AAMA,SAAgBA,gBAAgB,CAACC,KAAW,EAAEC,MAAa;EACzD,IAAI,CAACD,KAAK,EAAE;IACV;;EAGF,MAAME,YAAY,GAAGF,KAAuB;EAE5C,IAAI,CAACE,YAAY,CAACC,QAAQ,EAAE;IAC1BD,YAAY,CAACC,QAAQ,GAAG,EAAE;;EAG5BD,YAAY,CAACC,QAAQ,CAACF,MAAM,GAAGA,MAAM,IAAIG,SAAS;AACpD;AAZAC","names":["setVirtualParent","child","parent","virtualChild","_virtual","undefined","exports"],"sourceRoot":"../src/","sources":["packages/react-components/react-portal/src/virtualParent/setVirtualParent.ts"],"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: Node, parent?: Node): void {\n if (!child) {\n return;\n }\n\n const virtualChild = child as VirtualElement;\n\n if (!virtualChild._virtual) {\n virtualChild._virtual = {};\n }\n\n virtualChild._virtual.parent = parent || undefined;\n}\n"]}
1
+ {"version":3,"mappings":";;;;;;AAEA;;;;;;AAMA,SAAgBA,gBAAgB,CAACC,KAAW,EAAEC,MAAa;EACzD,IAAI,CAACD,KAAK,EAAE;IACV;;EAGF,MAAME,YAAY,GAAGF,KAAuB;EAE5C,IAAI,CAACE,YAAY,CAACC,QAAQ,EAAE;IAC1BD,YAAY,CAACC,QAAQ,GAAG,EAAE;;EAG5BD,YAAY,CAACC,QAAQ,CAACF,MAAM,GAAGA,MAAM;AACvC;AAZAG","names":["setVirtualParent","child","parent","virtualChild","_virtual","exports"],"sourceRoot":"../src/","sources":["packages/react-components/react-portal/src/virtualParent/setVirtualParent.ts"],"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: Node, parent?: Node): void {\n if (!child) {\n return;\n }\n\n const virtualChild = child as VirtualElement;\n\n if (!virtualChild._virtual) {\n virtualChild._virtual = {};\n }\n\n virtualChild._virtual.parent = parent;\n}\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fluentui/react-portal",
3
- "version": "9.1.3",
3
+ "version": "9.1.5",
4
4
  "description": "A utility component that creates portals compatible with Fluent UI",
5
5
  "main": "lib-commonjs/index.js",
6
6
  "module": "lib/index.js",
@@ -31,9 +31,9 @@
31
31
  "@fluentui/scripts-tasks": "*"
32
32
  },
33
33
  "dependencies": {
34
- "@fluentui/react-shared-contexts": "^9.1.5",
35
- "@fluentui/react-tabster": "^9.4.0",
36
- "@fluentui/react-utilities": "^9.4.0",
34
+ "@fluentui/react-shared-contexts": "^9.2.0",
35
+ "@fluentui/react-tabster": "^9.4.2",
36
+ "@fluentui/react-utilities": "^9.5.1",
37
37
  "@griffel/react": "^1.5.2",
38
38
  "tslib": "^2.1.0",
39
39
  "use-disposable": "^1.0.1"
@@ -1,8 +0,0 @@
1
- import { isVirtualElement } from './isVirtualElement';
2
- /**
3
- * Gets the virtual parent given the child element, if it exists.
4
- */
5
- export function getVirtualParent(child) {
6
- return isVirtualElement(child) ? child._virtual.parent : undefined;
7
- }
8
- //# sourceMappingURL=getVirtualParent.js.map
@@ -1 +0,0 @@
1
- {"version":3,"mappings":"AAAA,SAASA,gBAAgB,QAAQ,oBAAoB;AACrD;;;AAGA,OAAM,SAAUC,gBAAgB,CAACC,KAAW;EAC1C,OAAOF,gBAAgB,CAACE,KAAK,CAAC,GAAGA,KAAK,CAACC,QAAQ,CAACC,MAAM,GAAGC,SAAS;AACpE","names":["isVirtualElement","getVirtualParent","child","_virtual","parent","undefined"],"sourceRoot":"../src/","sources":["packages/react-components/react-portal/src/virtualParent/getVirtualParent.ts"],"sourcesContent":["import { isVirtualElement } from './isVirtualElement';\n/**\n * Gets the virtual parent given the child element, if it exists.\n */\nexport function getVirtualParent(child: Node): Node | undefined {\n return isVirtualElement(child) ? child._virtual.parent : undefined;\n}\n"]}
@@ -1,13 +0,0 @@
1
- define(["require", "exports", "./isVirtualElement"], function (require, exports, isVirtualElement_1) {
2
- "use strict";
3
- Object.defineProperty(exports, "__esModule", { value: true });
4
- exports.getVirtualParent = void 0;
5
- /**
6
- * Gets the virtual parent given the child element, if it exists.
7
- */
8
- function getVirtualParent(child) {
9
- return isVirtualElement_1.isVirtualElement(child) ? child._virtual.parent : undefined;
10
- }
11
- exports.getVirtualParent = getVirtualParent;
12
- });
13
- //# sourceMappingURL=getVirtualParent.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"getVirtualParent.js","sourceRoot":"","sources":["../../../../../../../../packages/react-components/react-portal/src/virtualParent/getVirtualParent.ts"],"names":[],"mappings":";;;;IACA;;OAEG;IACH,SAAgB,gBAAgB,CAAC,KAAW;QAC1C,OAAO,mCAAgB,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC,SAAS,CAAC;IACrE,CAAC;IAFD,4CAEC","sourcesContent":["import { isVirtualElement } from './isVirtualElement';\n/**\n * Gets the virtual parent given the child element, if it exists.\n */\nexport function getVirtualParent(child: Node): Node | undefined {\n return isVirtualElement(child) ? child._virtual.parent : undefined;\n}\n"]}
@@ -1,15 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.getVirtualParent = void 0;
7
- const isVirtualElement_1 = /*#__PURE__*/require("./isVirtualElement");
8
- /**
9
- * Gets the virtual parent given the child element, if it exists.
10
- */
11
- function getVirtualParent(child) {
12
- return isVirtualElement_1.isVirtualElement(child) ? child._virtual.parent : undefined;
13
- }
14
- exports.getVirtualParent = getVirtualParent;
15
- //# sourceMappingURL=getVirtualParent.js.map
@@ -1 +0,0 @@
1
- {"version":3,"mappings":";;;;;;AAAA;AACA;;;AAGA,SAAgBA,gBAAgB,CAACC,KAAW;EAC1C,OAAOC,mCAAgB,CAACD,KAAK,CAAC,GAAGA,KAAK,CAACE,QAAQ,CAACC,MAAM,GAAGC,SAAS;AACpE;AAFAC","names":["getVirtualParent","child","isVirtualElement_1","_virtual","parent","undefined","exports"],"sourceRoot":"../src/","sources":["packages/react-components/react-portal/src/virtualParent/getVirtualParent.ts"],"sourcesContent":["import { isVirtualElement } from './isVirtualElement';\n/**\n * Gets the virtual parent given the child element, if it exists.\n */\nexport function getVirtualParent(child: Node): Node | undefined {\n return isVirtualElement(child) ? child._virtual.parent : undefined;\n}\n"]}