@fluentui/react-portal 0.0.0-nightly-20230125-0418.1 → 0.0.0-nightly-20230127-0417.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.
package/CHANGELOG.json CHANGED
@@ -2,9 +2,9 @@
2
2
  "name": "@fluentui/react-portal",
3
3
  "entries": [
4
4
  {
5
- "date": "Wed, 25 Jan 2023 04:25:40 GMT",
6
- "tag": "@fluentui/react-portal_v0.0.0-nightly-20230125-0418.1",
7
- "version": "0.0.0-nightly-20230125-0418.1",
5
+ "date": "Fri, 27 Jan 2023 04:24:32 GMT",
6
+ "tag": "@fluentui/react-portal_v0.0.0-nightly-20230127-0417.1",
7
+ "version": "0.0.0-nightly-20230127-0417.1",
8
8
  "comments": {
9
9
  "prerelease": [
10
10
  {
@@ -16,20 +16,61 @@
16
16
  {
17
17
  "author": "beachball",
18
18
  "package": "@fluentui/react-portal",
19
- "comment": "Bump @fluentui/react-shared-contexts to v0.0.0-nightly-20230125-0418.1",
20
- "commit": "9ae3c86be8e1491c190d1b0c746d9ff238c36f75"
19
+ "comment": "Bump @fluentui/react-shared-contexts to v0.0.0-nightly-20230127-0417.1",
20
+ "commit": "5512c8f181263f8f51c0f89f8e750f27e1de4f57"
21
21
  },
22
22
  {
23
23
  "author": "beachball",
24
24
  "package": "@fluentui/react-portal",
25
- "comment": "Bump @fluentui/react-tabster to v0.0.0-nightly-20230125-0418.1",
26
- "commit": "9ae3c86be8e1491c190d1b0c746d9ff238c36f75"
25
+ "comment": "Bump @fluentui/react-tabster to v0.0.0-nightly-20230127-0417.1",
26
+ "commit": "5512c8f181263f8f51c0f89f8e750f27e1de4f57"
27
27
  },
28
28
  {
29
29
  "author": "beachball",
30
30
  "package": "@fluentui/react-portal",
31
- "comment": "Bump @fluentui/react-utilities to v0.0.0-nightly-20230125-0418.1",
32
- "commit": "9ae3c86be8e1491c190d1b0c746d9ff238c36f75"
31
+ "comment": "Bump @fluentui/react-utilities to v0.0.0-nightly-20230127-0417.1",
32
+ "commit": "5512c8f181263f8f51c0f89f8e750f27e1de4f57"
33
+ }
34
+ ]
35
+ }
36
+ },
37
+ {
38
+ "date": "Thu, 26 Jan 2023 13:30:57 GMT",
39
+ "tag": "@fluentui/react-portal_v9.1.4",
40
+ "version": "9.1.4",
41
+ "comments": {
42
+ "none": [
43
+ {
44
+ "author": "miroslav.stastny@microsoft.com",
45
+ "package": "@fluentui/react-portal",
46
+ "commit": "6f29c8f65b2db6125efbd2a7ec2d7abdd0f44601",
47
+ "comment": "Lint based re-format"
48
+ }
49
+ ],
50
+ "patch": [
51
+ {
52
+ "author": "olfedias@microsoft.com",
53
+ "package": "@fluentui/react-portal",
54
+ "commit": "17ce027879486fa8d2a775864cb119fb194fab8b",
55
+ "comment": "fix: update elementContains() to handle circular references"
56
+ },
57
+ {
58
+ "author": "beachball",
59
+ "package": "@fluentui/react-portal",
60
+ "comment": "Bump @fluentui/react-shared-contexts to v9.2.0",
61
+ "commit": "403e1370f1effca7d3db131eda381abf31cf66b1"
62
+ },
63
+ {
64
+ "author": "beachball",
65
+ "package": "@fluentui/react-portal",
66
+ "comment": "Bump @fluentui/react-tabster to v9.4.1",
67
+ "commit": "403e1370f1effca7d3db131eda381abf31cf66b1"
68
+ },
69
+ {
70
+ "author": "beachball",
71
+ "package": "@fluentui/react-portal",
72
+ "comment": "Bump @fluentui/react-utilities to v9.5.0",
73
+ "commit": "403e1370f1effca7d3db131eda381abf31cf66b1"
33
74
  }
34
75
  ]
35
76
  }
package/CHANGELOG.md CHANGED
@@ -1,20 +1,32 @@
1
1
  # Change Log - @fluentui/react-portal
2
2
 
3
- This log was last generated on Wed, 25 Jan 2023 04:25:40 GMT and should not be manually modified.
3
+ This log was last generated on Fri, 27 Jan 2023 04:24:32 GMT and should not be manually modified.
4
4
 
5
5
  <!-- Start content -->
6
6
 
7
- ## [0.0.0-nightly-20230125-0418.1](https://github.com/microsoft/fluentui/tree/@fluentui/react-portal_v0.0.0-nightly-20230125-0418.1)
7
+ ## [0.0.0-nightly-20230127-0417.1](https://github.com/microsoft/fluentui/tree/@fluentui/react-portal_v0.0.0-nightly-20230127-0417.1)
8
8
 
9
- Wed, 25 Jan 2023 04:25:40 GMT
10
- [Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-portal_v9.1.3..@fluentui/react-portal_v0.0.0-nightly-20230125-0418.1)
9
+ Fri, 27 Jan 2023 04:24:32 GMT
10
+ [Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-portal_v9.1.4..@fluentui/react-portal_v0.0.0-nightly-20230127-0417.1)
11
11
 
12
12
  ### Changes
13
13
 
14
14
  - Release nightly v9 ([commit](https://github.com/microsoft/fluentui/commit/not available) by fluentui-internal@service.microsoft.com)
15
- - Bump @fluentui/react-shared-contexts to v0.0.0-nightly-20230125-0418.1 ([commit](https://github.com/microsoft/fluentui/commit/9ae3c86be8e1491c190d1b0c746d9ff238c36f75) by beachball)
16
- - Bump @fluentui/react-tabster to v0.0.0-nightly-20230125-0418.1 ([commit](https://github.com/microsoft/fluentui/commit/9ae3c86be8e1491c190d1b0c746d9ff238c36f75) by beachball)
17
- - Bump @fluentui/react-utilities to v0.0.0-nightly-20230125-0418.1 ([commit](https://github.com/microsoft/fluentui/commit/9ae3c86be8e1491c190d1b0c746d9ff238c36f75) by beachball)
15
+ - Bump @fluentui/react-shared-contexts to v0.0.0-nightly-20230127-0417.1 ([commit](https://github.com/microsoft/fluentui/commit/5512c8f181263f8f51c0f89f8e750f27e1de4f57) by beachball)
16
+ - Bump @fluentui/react-tabster to v0.0.0-nightly-20230127-0417.1 ([commit](https://github.com/microsoft/fluentui/commit/5512c8f181263f8f51c0f89f8e750f27e1de4f57) by beachball)
17
+ - Bump @fluentui/react-utilities to v0.0.0-nightly-20230127-0417.1 ([commit](https://github.com/microsoft/fluentui/commit/5512c8f181263f8f51c0f89f8e750f27e1de4f57) by beachball)
18
+
19
+ ## [9.1.4](https://github.com/microsoft/fluentui/tree/@fluentui/react-portal_v9.1.4)
20
+
21
+ Thu, 26 Jan 2023 13:30:57 GMT
22
+ [Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-portal_v9.1.3..@fluentui/react-portal_v9.1.4)
23
+
24
+ ### Patches
25
+
26
+ - fix: update elementContains() to handle circular references ([PR #26483](https://github.com/microsoft/fluentui/pull/26483) by olfedias@microsoft.com)
27
+ - Bump @fluentui/react-shared-contexts to v9.2.0 ([PR #26496](https://github.com/microsoft/fluentui/pull/26496) by beachball)
28
+ - Bump @fluentui/react-tabster to v9.4.1 ([PR #26496](https://github.com/microsoft/fluentui/pull/26496) by beachball)
29
+ - Bump @fluentui/react-utilities to v9.5.0 ([PR #26496](https://github.com/microsoft/fluentui/pull/26496) by beachball)
18
30
 
19
31
  ## [9.1.3](https://github.com/microsoft/fluentui/tree/@fluentui/react-portal_v9.1.3)
20
32
 
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":"","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":"","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":"","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":"","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":"","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":"","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":"","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":"","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":"","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":"","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,"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":"","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":"","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":"","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":"","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":"","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":"","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":"","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":"","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":"","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":"","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": "0.0.0-nightly-20230125-0418.1",
3
+ "version": "0.0.0-nightly-20230127-0417.1",
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": "0.0.0-nightly-20230125-0418.1",
35
- "@fluentui/react-tabster": "0.0.0-nightly-20230125-0418.1",
36
- "@fluentui/react-utilities": "0.0.0-nightly-20230125-0418.1",
34
+ "@fluentui/react-shared-contexts": "0.0.0-nightly-20230127-0417.1",
35
+ "@fluentui/react-tabster": "0.0.0-nightly-20230127-0417.1",
36
+ "@fluentui/react-utilities": "0.0.0-nightly-20230127-0417.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":"","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,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":"","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"]}