@fluentui/react-portal 9.74.7-experimental.cli-api.20261006-ccaa611d58.0 → 9.75.0-experimental.css-modules.20261031-810ab07afb.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (41) hide show
  1. package/CHANGELOG.md +28 -8
  2. package/lib/components/Portal/Portal.js.map +1 -1
  3. package/lib/components/Portal/Portal.module.css +9 -0
  4. package/lib/components/Portal/Portal.types.js.map +1 -1
  5. package/lib/components/Portal/index.js.map +1 -1
  6. package/lib/components/Portal/renderPortal.js.map +1 -1
  7. package/lib/components/Portal/usePortal.js.map +1 -1
  8. package/lib/components/Portal/usePortalMountNode.js +2 -4
  9. package/lib/components/Portal/usePortalMountNode.js.map +1 -1
  10. package/lib/components/Portal/usePortalMountNodeStyles.styles.css.js +5 -0
  11. package/lib/components/Portal/usePortalMountNodeStyles.styles.css.js.map +1 -0
  12. package/lib/components/Portal/usePortalMountNodeStyles.styles.js +7 -3
  13. package/lib/components/Portal/usePortalMountNodeStyles.styles.js.map +1 -1
  14. package/lib/components/Portal/usePortalMountNodeStyles.styles.raw.css.js +5 -0
  15. package/lib/components/Portal/usePortalMountNodeStyles.styles.raw.css.js.map +1 -0
  16. package/lib/components/Portal/usePortalMountNodeStyles.styles.raw.js +6 -2
  17. package/lib/components/Portal/usePortalMountNodeStyles.styles.raw.js.map +1 -1
  18. package/lib/utils/toMountNodeProps.js.map +1 -1
  19. package/lib-commonjs/Portal.cjs +4 -4
  20. package/lib-commonjs/components/Portal/Portal.cjs.map +1 -1
  21. package/lib-commonjs/components/Portal/Portal.module.css +9 -0
  22. package/lib-commonjs/components/Portal/Portal.types.cjs.map +1 -1
  23. package/lib-commonjs/components/Portal/index.cjs +4 -4
  24. package/lib-commonjs/components/Portal/index.cjs.map +1 -1
  25. package/lib-commonjs/components/Portal/renderPortal.cjs.map +1 -1
  26. package/lib-commonjs/components/Portal/usePortal.cjs.map +1 -1
  27. package/lib-commonjs/components/Portal/usePortalMountNode.cjs +1 -3
  28. package/lib-commonjs/components/Portal/usePortalMountNode.cjs.map +1 -1
  29. package/lib-commonjs/components/Portal/usePortalMountNodeStyles.styles.cjs +6 -2
  30. package/lib-commonjs/components/Portal/usePortalMountNodeStyles.styles.cjs.map +1 -1
  31. package/lib-commonjs/components/Portal/usePortalMountNodeStyles.styles.css.cjs +16 -0
  32. package/lib-commonjs/components/Portal/usePortalMountNodeStyles.styles.css.cjs.map +1 -0
  33. package/lib-commonjs/components/Portal/usePortalMountNodeStyles.styles.raw.cjs +6 -2
  34. package/lib-commonjs/components/Portal/usePortalMountNodeStyles.styles.raw.cjs.map +1 -1
  35. package/lib-commonjs/components/Portal/usePortalMountNodeStyles.styles.raw.css.cjs +16 -0
  36. package/lib-commonjs/components/Portal/usePortalMountNodeStyles.styles.raw.css.cjs.map +1 -0
  37. package/lib-commonjs/index.cjs +7 -7
  38. package/lib-commonjs/utils/toMountNodeProps.cjs.map +1 -1
  39. package/package.json +11 -11
  40. package/dist/metadata/api/api-root.json +0 -1
  41. package/dist/metadata/index.json +0 -1
package/CHANGELOG.md CHANGED
@@ -1,20 +1,40 @@
1
1
  # Change Log - @fluentui/react-portal
2
2
 
3
- <!-- This log was last generated on Tue, 06 Oct 2026 11:40:28 GMT and should not be manually modified. -->
3
+ <!-- This log was last generated on Sat, 31 Oct 2026 11:08:51 GMT and should not be manually modified. -->
4
4
 
5
5
  <!-- Start content -->
6
6
 
7
- ## [9.74.7-experimental.cli-api.20261006-ccaa611d58.0](https://github.com/microsoft/fluentui/tree/@fluentui/react-portal_v9.74.7-experimental.cli-api.20261006-ccaa611d58.0)
7
+ ## [9.75.0-experimental.css-modules.20261031-810ab07afb.0](https://github.com/microsoft/fluentui/tree/@fluentui/react-portal_v9.75.0-experimental.css-modules.20261031-810ab07afb.0)
8
8
 
9
- Tue, 06 Oct 2026 11:40:28 GMT
10
- [Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-portal_v9.8.15..@fluentui/react-portal_v9.74.7-experimental.cli-api.20261006-ccaa611d58.0)
9
+ Sat, 31 Oct 2026 11:08:51 GMT
11
10
 
12
11
  ### Changes
13
12
 
14
- - Release 9.74.7-experimental.cli-api.20261006-ccaa611d58 ([commit](https://github.com/microsoft/fluentui/commit/undefined) by 257645319+office-ogx-auth-helper[bot]@users.noreply.github.com)
15
- - Bump @fluentui/react-shared-contexts to v9.74.7-experimental.cli-api.20261006-ccaa611d58.0 ([commit](https://github.com/microsoft/fluentui/commit/undefined) by beachball)
16
- - Bump @fluentui/react-tabster to v9.74.7-experimental.cli-api.20261006-ccaa611d58.0 ([commit](https://github.com/microsoft/fluentui/commit/undefined) by beachball)
17
- - Bump @fluentui/react-utilities to v9.74.7-experimental.cli-api.20261006-ccaa611d58.0 ([commit](https://github.com/microsoft/fluentui/commit/undefined) by beachball)
13
+ - Release 9.75.0-experimental.css-modules.20261031-810ab07afb ([commit](https://github.com/microsoft/fluentui/commit/undefined) by 257645319+office-ogx-auth-helper[bot]@users.noreply.github.com)
14
+ - Bump @fluentui/react-shared-contexts to v9.75.0-experimental.css-modules.20261031-810ab07afb.0 ([commit](https://github.com/microsoft/fluentui/commit/undefined) by beachball)
15
+ - Bump @fluentui/react-tabster to v9.75.0-experimental.css-modules.20261031-810ab07afb.0 ([commit](https://github.com/microsoft/fluentui/commit/undefined) by beachball)
16
+ - Bump @fluentui/react-utilities to v9.75.0-experimental.css-modules.20261031-810ab07afb.0 ([commit](https://github.com/microsoft/fluentui/commit/undefined) by beachball)
17
+
18
+ ## [9.8.17](https://github.com/microsoft/fluentui/tree/@fluentui/react-portal_v9.8.17)
19
+
20
+ Mon, 19 Oct 2026 16:49:01 GMT
21
+
22
+ ### Patches
23
+
24
+ - Bump @fluentui/react-tabster to v9.26.19 ([commit](https://github.com/microsoft/fluentui/commit/undefined) by beachball)
25
+ - Bump @fluentui/react-utilities to v9.27.0 ([commit](https://github.com/microsoft/fluentui/commit/undefined) by beachball)
26
+
27
+ ## [9.8.16](https://github.com/microsoft/fluentui/tree/@fluentui/react-portal_v9.8.16)
28
+
29
+ Tue, 22 Sep 2026 11:25:39 GMT
30
+ [Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-portal_v9.8.15..@fluentui/react-portal_v9.8.16)
31
+
32
+ ### Patches
33
+
34
+ - fix: remove unused @types/react-dom peer dependency, mark @types/react as optional ([PR #36559](https://github.com/microsoft/fluentui/pull/36559) by martinhochel@microsoft.com)
35
+ - Bump @fluentui/react-shared-contexts to v9.26.4 ([commit](https://github.com/microsoft/fluentui/commit/undefined) by beachball)
36
+ - Bump @fluentui/react-tabster to v9.26.18 ([commit](https://github.com/microsoft/fluentui/commit/undefined) by beachball)
37
+ - Bump @fluentui/react-utilities to v9.26.7 ([commit](https://github.com/microsoft/fluentui/commit/undefined) by beachball)
18
38
 
19
39
  ## [9.8.15](https://github.com/microsoft/fluentui/tree/@fluentui/react-portal_v9.8.15)
20
40
 
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/components/Portal/Portal.tsx"],"sourcesContent":["'use client';\n\nimport type * as React from 'react';\n\nimport { usePortal_unstable } from './usePortal';\nimport { renderPortal_unstable } from './renderPortal';\nimport type { PortalProps } from './Portal.types';\n\n/**\n * A portal provides a way to render children into a DOM node\n * that exists outside the DOM hierarchy of the parent component.\n */\nexport const Portal: React.FC<PortalProps> = props => {\n const state = usePortal_unstable(props);\n\n return renderPortal_unstable(state);\n};\n\nPortal.displayName = 'Portal';\n"],"names":["usePortal_unstable","renderPortal_unstable","Portal","props","state","displayName"],"mappings":"AAAA;AAIA,SAASA,kBAAkB,QAAQ,iBAAc;AACjD,SAASC,qBAAqB,QAAQ,oBAAiB;AAGvD;;;CAGC,GACD,OAAO,MAAMC,SAAgCC,CAAAA;IAC3C,MAAMC,QAAQJ,mBAAmBG;IAEjC,OAAOF,sBAAsBG;AAC/B,EAAE;AAEFF,OAAOG,WAAW,GAAG"}
1
+ {"version":3,"sources":["../../../src/components/Portal/Portal.tsx"],"sourcesContent":["'use client';\n\nimport type * as React from 'react';\n\nimport { usePortal_unstable } from './usePortal';\nimport { renderPortal_unstable } from './renderPortal';\nimport type { PortalProps } from './Portal.types';\n\n/**\n * A portal provides a way to render children into a DOM node\n * that exists outside the DOM hierarchy of the parent component.\n */\nexport const Portal: React.FC<PortalProps> = props => {\n const state = usePortal_unstable(props);\n\n return renderPortal_unstable(state);\n};\n\nPortal.displayName = 'Portal';\n"],"names":["usePortal_unstable","renderPortal_unstable","Portal","props","state","displayName"],"mappings":"AAAA;AAIA,SAASA,kBAAkB,QAAQ,iBAAc;AACjD,SAASC,qBAAqB,QAAQ,oBAAiB;AAGvD;;;CAGC,GACD,OAAO,MAAMC,SAAgCC,CAAAA;IAC3C,MAAMC,QAAQJ,mBAAmBG;IAEjC,OAAOF,sBAAsBG;AAC/B,EAAE;AAEFF,OAAOG,WAAW,GAAG"}
@@ -0,0 +1,9 @@
1
+ @layer fluentui {
2
+ .root {
3
+ position: absolute;
4
+ top: 0;
5
+ left: 0;
6
+ right: 0;
7
+ z-index: 1000000;
8
+ }
9
+ }
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/components/Portal/Portal.types.ts"],"sourcesContent":["import type * as React from 'react';\n\nexport type PortalProps = {\n /**\n * React children\n */\n children?: React.ReactNode;\n\n /**\n * Where the portal children are mounted on DOM\n *\n * @default a new element on document.body without any styling\n */\n mountNode?: HTMLElement | null | { element?: HTMLElement | null; className?: string };\n};\n\nexport type PortalState = Pick<PortalProps, 'children'> & {\n mountNode: HTMLElement | null | undefined;\n\n /**\n * Ref to the root span element as virtual parent\n */\n virtualParentRootRef: // eslint-disable-next-line @typescript-eslint/no-deprecated\n React.MutableRefObject<HTMLSpanElement | null>;\n};\n"],"names":[],"mappings":"AAgBA,WAQE"}
1
+ {"version":3,"sources":["../../../src/components/Portal/Portal.types.ts"],"sourcesContent":["import type * as React from 'react';\n\nexport type PortalProps = {\n /**\n * React children\n */\n children?: React.ReactNode;\n\n /**\n * Where the portal children are mounted on DOM\n *\n * @default a new element on document.body without any styling\n */\n mountNode?: HTMLElement | null | { element?: HTMLElement | null; className?: string };\n};\n\nexport type PortalState = Pick<PortalProps, 'children'> & {\n mountNode: HTMLElement | null | undefined;\n\n /**\n * Ref to the root span element as virtual parent\n */\n virtualParentRootRef: // eslint-disable-next-line @typescript-eslint/no-deprecated\n React.MutableRefObject<HTMLSpanElement | null>;\n};\n"],"names":[],"mappings":"AAgBA,WAQE"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/components/Portal/index.ts"],"sourcesContent":["export { Portal } from './Portal';\nexport type { PortalProps, PortalState } from './Portal.types';\nexport { renderPortal_unstable } from './renderPortal';\nexport { usePortal_unstable } from './usePortal';\n"],"names":["Portal","renderPortal_unstable","usePortal_unstable"],"mappings":"AAAA,SAASA,MAAM,QAAQ,cAAW;AAElC,SAASC,qBAAqB,QAAQ,oBAAiB;AACvD,SAASC,kBAAkB,QAAQ,iBAAc"}
1
+ {"version":3,"sources":["../../../src/components/Portal/index.ts"],"sourcesContent":["export { Portal } from './Portal';\nexport type { PortalProps, PortalState } from './Portal.types';\nexport { renderPortal_unstable } from './renderPortal';\nexport { usePortal_unstable } from './usePortal';\n"],"names":["Portal","renderPortal_unstable","usePortal_unstable"],"mappings":"AAAA,SAASA,MAAM,QAAQ,cAAW;AAElC,SAASC,qBAAqB,QAAQ,oBAAiB;AACvD,SAASC,kBAAkB,QAAQ,iBAAc"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/components/Portal/renderPortal.tsx"],"sourcesContent":["import * as ReactDOM from 'react-dom';\nimport * as React from 'react';\nimport type { PortalState } from './Portal.types';\n\n/**\n * Render the final JSX of Portal\n */\nexport const renderPortal_unstable = (state: PortalState): React.ReactElement => {\n return (\n <span hidden ref={state.virtualParentRootRef}>\n {state.mountNode &&\n ReactDOM.createPortal(\n <>\n {state.children}\n {/* Heads up!\n * This node exists only to ensure that the portal is not empty as we rely on that in `usePortalMountNode`\n * hook for React 18+.\n */}\n <span hidden />\n </>,\n state.mountNode,\n )}\n </span>\n );\n};\n"],"names":["ReactDOM","React","renderPortal_unstable","state","span","hidden","ref","virtualParentRootRef","mountNode","createPortal","children"],"mappings":"AAAA,YAAYA,cAAc,YAAY;AACtC,YAAYC,WAAW,QAAQ;AAG/B;;CAEC,GACD,OAAO,MAAMC,wBAAwB,CAACC;IACpC,qBACE,oBAACC;QAAKC,QAAAA;QAAOC,KAAKH,MAAMI,oBAAoB;OACzCJ,MAAMK,SAAS,kBACdR,SAASS,YAAY,eACnB,0CACGN,MAAMO,QAAQ,gBAKf,oBAACN;QAAKC,QAAAA;SAERF,MAAMK,SAAS;AAIzB,EAAE"}
1
+ {"version":3,"sources":["../../../src/components/Portal/renderPortal.tsx"],"sourcesContent":["import * as ReactDOM from 'react-dom';\nimport * as React from 'react';\nimport type { PortalState } from './Portal.types';\n\n/**\n * Render the final JSX of Portal\n */\nexport const renderPortal_unstable = (state: PortalState): React.ReactElement => {\n return (\n <span hidden ref={state.virtualParentRootRef}>\n {state.mountNode &&\n ReactDOM.createPortal(\n <>\n {state.children}\n {/* Heads up!\n * This node exists only to ensure that the portal is not empty as we rely on that in `usePortalMountNode`\n * hook for React 18+.\n */}\n <span hidden />\n </>,\n state.mountNode,\n )}\n </span>\n );\n};\n"],"names":["ReactDOM","React","renderPortal_unstable","state","span","hidden","ref","virtualParentRootRef","mountNode","createPortal","children"],"mappings":"AAAA,YAAYA,cAAc,YAAY;AACtC,YAAYC,WAAW,QAAQ;AAG/B;;CAEC,GACD,OAAO,MAAMC,wBAAwB,CAACC;IACpC,qBACE,oBAACC;QAAKC,QAAAA;QAAOC,KAAKH,MAAMI,oBAAoB;OACzCJ,MAAMK,SAAS,kBACdR,SAASS,YAAY,eACnB,0CACGN,MAAMO,QAAQ,gBAKf,oBAACN;QAAKC,QAAAA;SAERF,MAAMK,SAAS;AAIzB,EAAE"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/components/Portal/usePortal.ts"],"sourcesContent":["'use client';\n\nimport { setVirtualParent } from '@fluentui/react-utilities';\nimport * as React from 'react';\n\nimport { toMountNodeProps } from '../../utils/toMountNodeProps';\nimport { usePortalMountNode } from './usePortalMountNode';\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 { element, className } = toMountNodeProps(props.mountNode);\n\n const virtualParentRootRef = React.useRef<HTMLSpanElement>(null);\n const fallbackElement = usePortalMountNode({ disabled: !!element, className });\n\n const mountNode = element ?? fallbackElement;\n const state: PortalState = {\n children: props.children,\n mountNode,\n virtualParentRootRef,\n };\n\n React.useEffect(() => {\n if (!mountNode) {\n return;\n }\n\n const virtualParent = virtualParentRootRef.current;\n\n // By default, we create a mount node for portal on `document.body` (see usePortalMountNode()) and have following structure:\n //\n // <body>\n // <!-- ⚛️ application root -->\n // <div id=\"root\">\n // <!-- ⬇️ portal node rendered in a tree to anchor (virtual parent node) -->\n // <span aria-hidden=\"true\"></span>\n // </div>\n // <div id=\"portal-mount-node\">\n // <!-- 🧩portal content -->\n // </div>\n // </body>\n //\n // To make sure that `.elementContains()` works correctly, we link a virtual parent to a portal node (a virtual parent node becomes a parent of mount node):\n // virtual.contains(mountNode) === false\n // (while we need ⬇️⬇️⬇️)\n // elementsContains(virtualParent, mountNode) === true\n // elementsContains(mountNode, virtualParent) === false\n //\n // For more details, check docs for virtual parent utils.\n //\n // However, if a user provides a custom mount node (via `props`) the structure could be different:\n //\n // <body>\n // <!-- application root -->\n // <div id=\"root\">\n // <div id=\"portal-mount-node\">\n // <!-- 🧩portal content -->\n //\n // <span aria-hidden=\"true\"></span>\n // </div>\n // </div>\n // </body>\n //\n // A mount node in this case contains portal's content and a virtual parent node. In this case nodes linking is redundant and the check below avoids it.\n //\n // Otherwise, there is a circular reference - both elements are parents of each other:\n // elementsContains(mountNode, virtualParent) === true\n // elementsContains(virtualParent, mountNode) === true\n const isVirtualParentInsideChild = mountNode.contains(virtualParent);\n\n if (virtualParent && !isVirtualParentInsideChild) {\n setVirtualParent(mountNode, virtualParent);\n\n return () => {\n setVirtualParent(mountNode, undefined);\n };\n }\n }, [virtualParentRootRef, mountNode]);\n\n return state;\n};\n"],"names":["setVirtualParent","React","toMountNodeProps","usePortalMountNode","usePortal_unstable","props","element","className","mountNode","virtualParentRootRef","useRef","fallbackElement","disabled","state","children","useEffect","virtualParent","current","isVirtualParentInsideChild","contains","undefined"],"mappings":"AAAA;AAEA,SAASA,gBAAgB,QAAQ,4BAA4B;AAC7D,YAAYC,WAAW,QAAQ;AAE/B,SAASC,gBAAgB,QAAQ,kCAA+B;AAChE,SAASC,kBAAkB,QAAQ,0BAAuB;AAG1D;;;;;;CAMC,GACD,OAAO,MAAMC,qBAAqB,CAACC;IACjC,MAAM,EAAEC,OAAO,EAAEC,SAAS,EAAE,GAAGL,iBAAiBG,MAAMG,SAAS;IAE/D,MAAMC,uBAAuBR,MAAMS,MAAM,CAAkB;IAC3D,MAAMC,kBAAkBR,mBAAmB;QAAES,UAAU,CAAC,CAACN;QAASC;IAAU;IAE5E,MAAMC,YAAYF,oBAAAA,qBAAAA,UAAWK;IAC7B,MAAME,QAAqB;QACzBC,UAAUT,MAAMS,QAAQ;QACxBN;QACAC;IACF;IAEAR,MAAMc,SAAS,CAAC;QACd,IAAI,CAACP,WAAW;YACd;QACF;QAEA,MAAMQ,gBAAgBP,qBAAqBQ,OAAO;QAElD,4HAA4H;QAC5H,EAAE;QACF,SAAS;QACT,iCAAiC;QACjC,oBAAoB;QACpB,iFAAiF;QACjF,uCAAuC;QACvC,WAAW;QACX,iCAAiC;QACjC,gCAAgC;QAChC,WAAW;QACX,UAAU;QACV,EAAE;QACF,4JAA4J;QAC5J,0CAA0C;QAC1C,2BAA2B;QAC3B,wDAAwD;QACxD,yDAAyD;QACzD,EAAE;QACF,yDAAyD;QACzD,EAAE;QACF,kGAAkG;QAClG,EAAE;QACF,SAAS;QACT,8BAA8B;QAC9B,oBAAoB;QACpB,mCAAmC;QACnC,kCAAkC;QAClC,EAAE;QACF,yCAAyC;QACzC,aAAa;QACb,WAAW;QACX,UAAU;QACV,EAAE;QACF,wJAAwJ;QACxJ,EAAE;QACF,sFAAsF;QACtF,wDAAwD;QACxD,wDAAwD;QACxD,MAAMC,6BAA6BV,UAAUW,QAAQ,CAACH;QAEtD,IAAIA,iBAAiB,CAACE,4BAA4B;YAChDlB,iBAAiBQ,WAAWQ;YAE5B,OAAO;gBACLhB,iBAAiBQ,WAAWY;YAC9B;QACF;IACF,GAAG;QAACX;QAAsBD;KAAU;IAEpC,OAAOK;AACT,EAAE"}
1
+ {"version":3,"sources":["../../../src/components/Portal/usePortal.ts"],"sourcesContent":["'use client';\n\nimport { setVirtualParent } from '@fluentui/react-utilities';\nimport * as React from 'react';\n\nimport { toMountNodeProps } from '../../utils/toMountNodeProps';\nimport { usePortalMountNode } from './usePortalMountNode';\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 { element, className } = toMountNodeProps(props.mountNode);\n\n const virtualParentRootRef = React.useRef<HTMLSpanElement>(null);\n const fallbackElement = usePortalMountNode({ disabled: !!element, className });\n\n const mountNode = element ?? fallbackElement;\n const state: PortalState = {\n children: props.children,\n mountNode,\n virtualParentRootRef,\n };\n\n React.useEffect(() => {\n if (!mountNode) {\n return;\n }\n\n const virtualParent = virtualParentRootRef.current;\n\n // By default, we create a mount node for portal on `document.body` (see usePortalMountNode()) and have following structure:\n //\n // <body>\n // <!-- ⚛️ application root -->\n // <div id=\"root\">\n // <!-- ⬇️ portal node rendered in a tree to anchor (virtual parent node) -->\n // <span aria-hidden=\"true\"></span>\n // </div>\n // <div id=\"portal-mount-node\">\n // <!-- 🧩portal content -->\n // </div>\n // </body>\n //\n // To make sure that `.elementContains()` works correctly, we link a virtual parent to a portal node (a virtual parent node becomes a parent of mount node):\n // virtual.contains(mountNode) === false\n // (while we need ⬇️⬇️⬇️)\n // elementsContains(virtualParent, mountNode) === true\n // elementsContains(mountNode, virtualParent) === false\n //\n // For more details, check docs for virtual parent utils.\n //\n // However, if a user provides a custom mount node (via `props`) the structure could be different:\n //\n // <body>\n // <!-- application root -->\n // <div id=\"root\">\n // <div id=\"portal-mount-node\">\n // <!-- 🧩portal content -->\n //\n // <span aria-hidden=\"true\"></span>\n // </div>\n // </div>\n // </body>\n //\n // A mount node in this case contains portal's content and a virtual parent node. In this case nodes linking is redundant and the check below avoids it.\n //\n // Otherwise, there is a circular reference - both elements are parents of each other:\n // elementsContains(mountNode, virtualParent) === true\n // elementsContains(virtualParent, mountNode) === true\n const isVirtualParentInsideChild = mountNode.contains(virtualParent);\n\n if (virtualParent && !isVirtualParentInsideChild) {\n setVirtualParent(mountNode, virtualParent);\n\n return () => {\n setVirtualParent(mountNode, undefined);\n };\n }\n }, [virtualParentRootRef, mountNode]);\n\n return state;\n};\n"],"names":["setVirtualParent","React","toMountNodeProps","usePortalMountNode","usePortal_unstable","props","element","className","mountNode","virtualParentRootRef","useRef","fallbackElement","disabled","state","children","useEffect","virtualParent","current","isVirtualParentInsideChild","contains","undefined"],"mappings":"AAAA;AAEA,SAASA,gBAAgB,QAAQ,4BAA4B;AAC7D,YAAYC,WAAW,QAAQ;AAE/B,SAASC,gBAAgB,QAAQ,kCAA+B;AAChE,SAASC,kBAAkB,QAAQ,0BAAuB;AAG1D;;;;;;CAMC,GACD,OAAO,MAAMC,qBAAqB,CAACC;IACjC,MAAM,EAAEC,OAAO,EAAEC,SAAS,EAAE,GAAGL,iBAAiBG,MAAMG,SAAS;IAE/D,MAAMC,uBAAuBR,MAAMS,MAAM,CAAkB;IAC3D,MAAMC,kBAAkBR,mBAAmB;QAAES,UAAU,CAAC,CAACN;QAASC;IAAU;IAE5E,MAAMC,YAAYF,oBAAAA,qBAAAA,UAAWK;IAC7B,MAAME,QAAqB;QACzBC,UAAUT,MAAMS,QAAQ;QACxBN;QACAC;IACF;IAEAR,MAAMc,SAAS,CAAC;QACd,IAAI,CAACP,WAAW;YACd;QACF;QAEA,MAAMQ,gBAAgBP,qBAAqBQ,OAAO;QAElD,4HAA4H;QAC5H,EAAE;QACF,SAAS;QACT,iCAAiC;QACjC,oBAAoB;QACpB,iFAAiF;QACjF,uCAAuC;QACvC,WAAW;QACX,iCAAiC;QACjC,gCAAgC;QAChC,WAAW;QACX,UAAU;QACV,EAAE;QACF,4JAA4J;QAC5J,0CAA0C;QAC1C,2BAA2B;QAC3B,wDAAwD;QACxD,yDAAyD;QACzD,EAAE;QACF,yDAAyD;QACzD,EAAE;QACF,kGAAkG;QAClG,EAAE;QACF,SAAS;QACT,8BAA8B;QAC9B,oBAAoB;QACpB,mCAAmC;QACnC,kCAAkC;QAClC,EAAE;QACF,yCAAyC;QACzC,aAAa;QACb,WAAW;QACX,UAAU;QACV,EAAE;QACF,wJAAwJ;QACxJ,EAAE;QACF,sFAAsF;QACtF,wDAAwD;QACxD,wDAAwD;QACxD,MAAMC,6BAA6BV,UAAUW,QAAQ,CAACH;QAEtD,IAAIA,iBAAiB,CAACE,4BAA4B;YAChDlB,iBAAiBQ,WAAWQ;YAE5B,OAAO;gBACLhB,iBAAiBQ,WAAWY;YAC9B;QACF;IACF,GAAG;QAACX;QAAsBD;KAAU;IAEpC,OAAOK;AACT,EAAE"}
@@ -1,9 +1,8 @@
1
1
  'use client';
2
2
  import * as React from "react";
3
3
  import { useThemeClassName_unstable as useThemeClassName, useFluent_unstable as useFluent, usePortalMountNode as usePortalMountNodeContext } from "@fluentui/react-shared-contexts";
4
- import { mergeClasses } from "@griffel/react";
5
4
  import { useFocusVisible } from "@fluentui/react-tabster";
6
- import { usePortalMountNodeStylesStyles } from "./usePortalMountNodeStyles.styles.js";
5
+ import { usePortalMountNodeClassName } from "./usePortalMountNodeStyles.styles.js";
7
6
  const useInsertionEffect = React['useInsertion' + 'Effect'];
8
7
  /**
9
8
  * Legacy element factory for React 17 and below. It's not safe for concurrent rendering.
@@ -192,13 +191,12 @@ const initializeElementFactory = ()=>{
192
191
  const mountNode = usePortalMountNodeContext();
193
192
  // eslint-disable-next-line @typescript-eslint/no-deprecated
194
193
  const focusVisibleRef = useFocusVisible();
195
- const classes = usePortalMountNodeStylesStyles();
196
194
  const themeClassName = useThemeClassName();
197
195
  const factoryOptions = {
198
196
  dir,
199
197
  disabled: options.disabled,
200
198
  focusVisibleRef,
201
- className: mergeClasses(themeClassName, classes.root, options.className),
199
+ className: usePortalMountNodeClassName(themeClassName, options.className),
202
200
  targetNode: mountNode !== null && mountNode !== void 0 ? mountNode : targetDocument === null || targetDocument === void 0 ? void 0 : targetDocument.body
203
201
  };
204
202
  return useElementFactory(factoryOptions);
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/components/Portal/usePortalMountNode.ts"],"sourcesContent":["'use client';\n\nimport * as React from 'react';\nimport {\n useThemeClassName_unstable as useThemeClassName,\n useFluent_unstable as useFluent,\n usePortalMountNode as usePortalMountNodeContext,\n} from '@fluentui/react-shared-contexts';\nimport { mergeClasses } from '@griffel/react';\nimport { useFocusVisible } from '@fluentui/react-tabster';\n\nimport { usePortalMountNodeStylesStyles } from './usePortalMountNodeStyles.styles';\n\nconst useInsertionEffect = (React as never)['useInsertion' + 'Effect'] as typeof React.useLayoutEffect | undefined;\n\nexport type UsePortalMountNodeOptions = {\n /**\n * Since hooks cannot be called conditionally use this flag to disable creating the node\n */\n disabled?: boolean;\n\n className?: string;\n};\n\ntype UseElementFactoryOptions = {\n className: string;\n dir: string;\n disabled: boolean | undefined;\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n focusVisibleRef: React.MutableRefObject<HTMLElement | null>;\n targetNode: HTMLElement | ShadowRoot | undefined;\n};\ntype UseElementFactory = (options: UseElementFactoryOptions) => HTMLDivElement | null;\n\n/**\n * Legacy element factory for React 17 and below. It's not safe for concurrent rendering.\n *\n * Creates a new element on a \"document.body\" to mount portals.\n */\nconst useLegacyElementFactory: UseElementFactory = options => {\n const { className, dir, focusVisibleRef, targetNode } = options;\n\n const targetElement = React.useMemo(() => {\n if (targetNode === undefined || options.disabled) {\n return null;\n }\n\n const element = targetNode.ownerDocument.createElement('div');\n targetNode.appendChild(element);\n\n return element;\n }, [targetNode, options.disabled]);\n\n // Heads up!\n // This useMemo() call is intentional for React 17 & below.\n //\n // We don't want to re-create the portal element when its attributes change. This also cannot not be done in an effect\n // because, changing the value of CSS variables after an initial mount will trigger interesting CSS side effects like\n // transitions.\n // eslint-disable-next-line react-hooks/void-use-memo\n React.useMemo(() => {\n if (!targetElement) {\n return;\n }\n\n // eslint-disable-next-line react-hooks/immutability\n targetElement.className = className;\n targetElement.setAttribute('dir', dir);\n targetElement.setAttribute('data-portal-node', 'true');\n\n // eslint-disable-next-line react-hooks/refs\n focusVisibleRef.current = targetElement;\n }, [className, dir, targetElement, focusVisibleRef]);\n\n React.useEffect(() => {\n return () => {\n targetElement?.remove();\n };\n }, [targetElement]);\n\n return targetElement;\n};\n\nconst initializeElementFactory = () => {\n let currentElement: HTMLDivElement | undefined = undefined;\n\n function get(targetRoot: HTMLElement | ShadowRoot, forceCreation: boolean): HTMLDivElement | undefined {\n if (currentElement) {\n return currentElement;\n }\n\n if (forceCreation) {\n currentElement = targetRoot.ownerDocument.createElement('div');\n targetRoot.appendChild(currentElement);\n }\n\n return currentElement;\n }\n\n function dispose() {\n if (currentElement) {\n currentElement.remove();\n currentElement = undefined;\n }\n }\n\n return {\n get,\n dispose,\n };\n};\n\n/**\n * This is a modern element factory for React 18 and above. It is safe for concurrent rendering.\n *\n * It abuses the fact that React will mount DOM once (unlike hooks), so by using a proxy we can intercept:\n * - the `remove()` method (we call it in `useEffect()`) and remove the element only when the portal is unmounted\n * - all other methods (and properties) will be called by React once a portal is mounted\n */\nconst useModernElementFactory: UseElementFactory = options => {\n 'use no memo'; // justified: compiler would optimize dispose — manual opt-out to preserve runtime behavior\n\n const { className, dir, focusVisibleRef, targetNode } = options;\n\n const [elementFactory] = React.useState(initializeElementFactory);\n\n const elementProxy = React.useMemo(() => {\n if (targetNode === undefined || options.disabled) {\n return null;\n }\n\n return new Proxy({} as HTMLDivElement, {\n get(_, property: keyof HTMLDivElement) {\n // Heads up!\n // `createPortal()` performs a check for `nodeType` property to determine if the mount node is a valid DOM node\n // before mounting the portal. We hardcode the value to `Node.ELEMENT_NODE` to pass this check and avoid\n // premature node creation\n if (property === 'nodeType') {\n // Can't use the `Node.ELEMENT_NODE` as it's a browser API and not available in all environments, e.g SSR\n return 1; // `Node.ELEMENT_NODE`\n }\n\n // Heads up!\n // We intercept the `remove()` method to remove the mount node only when portal has been unmounted already.\n if (property === 'remove') {\n const targetElement = elementFactory.get(targetNode, false);\n\n if (targetElement) {\n // If the mountElement has children, the portal is still mounted, otherwise we can dispose of it\n const portalHasNoChildren = targetElement.childNodes.length === 0;\n\n if (portalHasNoChildren) {\n elementFactory.dispose();\n }\n }\n\n return () => {\n // Always return a no-op function to avoid errors in the code\n };\n }\n\n const targetElement = elementFactory.get(targetNode, true);\n const targetProperty = targetElement ? targetElement[property] : undefined;\n\n if (typeof targetProperty === 'function') {\n return targetProperty.bind(targetElement);\n }\n\n return targetProperty;\n },\n\n set(_, property: keyof HTMLDivElement | '_virtual' | 'focusVisible', value) {\n const ignoredProperty = property === '_virtual' || property === 'focusVisible';\n\n // We should use the `elementFactory.get(targetNode, !ignoredProperty)`,\n // but TypeScript requires a literal `true` or `false` for the overload signature.\n // This workaround ensures the correct overload is called and avoids TypeScript errors.\n const targetElement = ignoredProperty\n ? elementFactory.get(targetNode, false)\n : elementFactory.get(targetNode, true);\n\n if (ignoredProperty && !targetElement) {\n // We ignore the `_virtual` and `focusVisible` properties to avoid conflicts with the proxy\n return true;\n }\n\n if (targetElement) {\n Object.assign(targetElement, { [property]: value });\n return true;\n }\n\n return false;\n },\n });\n }, [elementFactory, targetNode, options.disabled]);\n\n useInsertionEffect!(() => {\n if (!elementProxy) {\n return;\n }\n\n const classesToApply = className.split(' ').filter(Boolean);\n\n elementProxy.classList.add(...classesToApply);\n elementProxy.setAttribute('dir', dir);\n elementProxy.setAttribute('data-portal-node', 'true');\n\n focusVisibleRef.current = elementProxy;\n\n return () => {\n elementProxy.classList.remove(...classesToApply);\n elementProxy.removeAttribute('dir');\n };\n }, [className, dir, elementProxy, focusVisibleRef]);\n\n React.useEffect(() => {\n return () => {\n elementProxy?.remove();\n };\n }, [elementProxy]);\n\n return elementProxy;\n};\n\n/**\n * Element factory based on the React version.\n *\n * React 17 and below:\n * - useLegacyElementFactory\n *\n * React 18 and above:\n * - useModernElementFactory\n */\nconst useElementFactory = useInsertionEffect ? useModernElementFactory : useLegacyElementFactory;\n\n/**\n * Creates a new element on a \"document.body\" to mount portals.\n */\nexport const usePortalMountNode = (options: UsePortalMountNodeOptions): HTMLElement | null => {\n ('use no memo'); // justified: compiler would optimize usePortalMountNode — manual opt-out to preserve runtime behavior\n\n const { targetDocument, dir } = useFluent();\n const mountNode = usePortalMountNodeContext();\n\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n const focusVisibleRef = useFocusVisible<HTMLDivElement>() as React.MutableRefObject<HTMLElement | null>;\n const classes = usePortalMountNodeStylesStyles();\n const themeClassName = useThemeClassName();\n\n const factoryOptions: UseElementFactoryOptions = {\n dir,\n disabled: options.disabled,\n focusVisibleRef,\n\n className: mergeClasses(themeClassName, classes.root, options.className),\n targetNode: mountNode ?? targetDocument?.body,\n };\n\n return useElementFactory(factoryOptions);\n};\n"],"names":["React","useThemeClassName_unstable","useThemeClassName","useFluent_unstable","useFluent","usePortalMountNode","usePortalMountNodeContext","mergeClasses","useFocusVisible","usePortalMountNodeStylesStyles","useInsertionEffect","useLegacyElementFactory","options","className","dir","focusVisibleRef","targetNode","targetElement","useMemo","undefined","disabled","element","ownerDocument","createElement","appendChild","setAttribute","current","useEffect","remove","initializeElementFactory","currentElement","get","targetRoot","forceCreation","dispose","useModernElementFactory","elementFactory","useState","elementProxy","Proxy","_","property","portalHasNoChildren","childNodes","length","targetProperty","bind","set","value","ignoredProperty","Object","assign","classesToApply","split","filter","Boolean","classList","add","removeAttribute","useElementFactory","targetDocument","mountNode","classes","themeClassName","factoryOptions","root","body"],"mappings":"AAAA;AAEA,YAAYA,WAAW,QAAQ;AAC/B,SACEC,8BAA8BC,iBAAiB,EAC/CC,sBAAsBC,SAAS,EAC/BC,sBAAsBC,yBAAyB,QAC1C,kCAAkC;AACzC,SAASC,YAAY,QAAQ,iBAAiB;AAC9C,SAASC,eAAe,QAAQ,0BAA0B;AAE1D,SAASC,8BAA8B,QAAQ,uCAAoC;AAEnF,MAAMC,qBAAqB,AAACV,KAAe,CAAC,iBAAiB,SAAS;AAqBtE;;;;CAIC,GACD,MAAMW,0BAA6CC,CAAAA;IACjD,MAAM,EAAEC,SAAS,EAAEC,GAAG,EAAEC,eAAe,EAAEC,UAAU,EAAE,GAAGJ;IAExD,MAAMK,gBAAgBjB,MAAMkB,OAAO,CAAC;QAClC,IAAIF,eAAeG,aAAaP,QAAQQ,QAAQ,EAAE;YAChD,OAAO;QACT;QAEA,MAAMC,UAAUL,WAAWM,aAAa,CAACC,aAAa,CAAC;QACvDP,WAAWQ,WAAW,CAACH;QAEvB,OAAOA;IACT,GAAG;QAACL;QAAYJ,QAAQQ,QAAQ;KAAC;IAEjC,YAAY;IACZ,2DAA2D;IAC3D,EAAE;IACF,sHAAsH;IACtH,qHAAqH;IACrH,eAAe;IACf,qDAAqD;IACrDpB,MAAMkB,OAAO,CAAC;QACZ,IAAI,CAACD,eAAe;YAClB;QACF;QAEA,oDAAoD;QACpDA,cAAcJ,SAAS,GAAGA;QAC1BI,cAAcQ,YAAY,CAAC,OAAOX;QAClCG,cAAcQ,YAAY,CAAC,oBAAoB;QAE/C,4CAA4C;QAC5CV,gBAAgBW,OAAO,GAAGT;IAC5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QAAcvB;KAAgB;IAElDf,MAAM2B,SAAS,CAAC;QACd,OAAO;YACLW,yBAAAA,mCAAAA,aAAcV,MAAM;QACtB;IACF,GAAG;QAACU;KAAa;IAEjB,OAAOA;AACT;AAEA;;;;;;;;CAQC,GACD,MAAMqB,oBAAoBjD,qBAAqByB,0BAA0BxB;AAEzE;;CAEC,GACD,OAAO,MAAMN,qBAAqB,CAACO;IAChC,eAAgB,sGAAsG;IAEvH,MAAM,EAAEgD,cAAc,EAAE9C,GAAG,EAAE,GAAGV;IAChC,MAAMyD,YAAYvD;IAElB,4DAA4D;IAC5D,MAAMS,kBAAkBP;IACxB,MAAMsD,UAAUrD;IAChB,MAAMsD,iBAAiB7D;IAEvB,MAAM8D,iBAA2C;QAC/ClD;QACAM,UAAUR,QAAQQ,QAAQ;QAC1BL;QAEAF,WAAWN,aAAawD,gBAAgBD,QAAQG,IAAI,EAAErD,QAAQC,SAAS;QACvEG,YAAY6C,sBAAAA,uBAAAA,YAAaD,2BAAAA,qCAAAA,eAAgBM,IAAI;IAC/C;IAEA,OAAOP,kBAAkBK;AAC3B,EAAE"}
1
+ {"version":3,"sources":["../../../src/components/Portal/usePortalMountNode.ts"],"sourcesContent":["'use client';\n\nimport * as React from 'react';\nimport {\n useThemeClassName_unstable as useThemeClassName,\n useFluent_unstable as useFluent,\n usePortalMountNode as usePortalMountNodeContext,\n} from '@fluentui/react-shared-contexts';\nimport { useFocusVisible } from '@fluentui/react-tabster';\n\nimport { usePortalMountNodeClassName } from './usePortalMountNodeStyles.styles';\n\nconst useInsertionEffect = (React as never)['useInsertion' + 'Effect'] as typeof React.useLayoutEffect | undefined;\n\nexport type UsePortalMountNodeOptions = {\n /**\n * Since hooks cannot be called conditionally use this flag to disable creating the node\n */\n disabled?: boolean;\n\n className?: string;\n};\n\ntype UseElementFactoryOptions = {\n className: string;\n dir: string;\n disabled: boolean | undefined;\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n focusVisibleRef: React.MutableRefObject<HTMLElement | null>;\n targetNode: HTMLElement | ShadowRoot | undefined;\n};\ntype UseElementFactory = (options: UseElementFactoryOptions) => HTMLDivElement | null;\n\n/**\n * Legacy element factory for React 17 and below. It's not safe for concurrent rendering.\n *\n * Creates a new element on a \"document.body\" to mount portals.\n */\nconst useLegacyElementFactory: UseElementFactory = options => {\n const { className, dir, focusVisibleRef, targetNode } = options;\n\n const targetElement = React.useMemo(() => {\n if (targetNode === undefined || options.disabled) {\n return null;\n }\n\n const element = targetNode.ownerDocument.createElement('div');\n targetNode.appendChild(element);\n\n return element;\n }, [targetNode, options.disabled]);\n\n // Heads up!\n // This useMemo() call is intentional for React 17 & below.\n //\n // We don't want to re-create the portal element when its attributes change. This also cannot not be done in an effect\n // because, changing the value of CSS variables after an initial mount will trigger interesting CSS side effects like\n // transitions.\n // eslint-disable-next-line react-hooks/void-use-memo\n React.useMemo(() => {\n if (!targetElement) {\n return;\n }\n\n // eslint-disable-next-line react-hooks/immutability\n targetElement.className = className;\n targetElement.setAttribute('dir', dir);\n targetElement.setAttribute('data-portal-node', 'true');\n\n // eslint-disable-next-line react-hooks/refs\n focusVisibleRef.current = targetElement;\n }, [className, dir, targetElement, focusVisibleRef]);\n\n React.useEffect(() => {\n return () => {\n targetElement?.remove();\n };\n }, [targetElement]);\n\n return targetElement;\n};\n\nconst initializeElementFactory = () => {\n let currentElement: HTMLDivElement | undefined = undefined;\n\n function get(targetRoot: HTMLElement | ShadowRoot, forceCreation: boolean): HTMLDivElement | undefined {\n if (currentElement) {\n return currentElement;\n }\n\n if (forceCreation) {\n currentElement = targetRoot.ownerDocument.createElement('div');\n targetRoot.appendChild(currentElement);\n }\n\n return currentElement;\n }\n\n function dispose() {\n if (currentElement) {\n currentElement.remove();\n currentElement = undefined;\n }\n }\n\n return {\n get,\n dispose,\n };\n};\n\n/**\n * This is a modern element factory for React 18 and above. It is safe for concurrent rendering.\n *\n * It abuses the fact that React will mount DOM once (unlike hooks), so by using a proxy we can intercept:\n * - the `remove()` method (we call it in `useEffect()`) and remove the element only when the portal is unmounted\n * - all other methods (and properties) will be called by React once a portal is mounted\n */\nconst useModernElementFactory: UseElementFactory = options => {\n 'use no memo'; // justified: compiler would optimize dispose — manual opt-out to preserve runtime behavior\n\n const { className, dir, focusVisibleRef, targetNode } = options;\n\n const [elementFactory] = React.useState(initializeElementFactory);\n\n const elementProxy = React.useMemo(() => {\n if (targetNode === undefined || options.disabled) {\n return null;\n }\n\n return new Proxy({} as HTMLDivElement, {\n get(_, property: keyof HTMLDivElement) {\n // Heads up!\n // `createPortal()` performs a check for `nodeType` property to determine if the mount node is a valid DOM node\n // before mounting the portal. We hardcode the value to `Node.ELEMENT_NODE` to pass this check and avoid\n // premature node creation\n if (property === 'nodeType') {\n // Can't use the `Node.ELEMENT_NODE` as it's a browser API and not available in all environments, e.g SSR\n return 1; // `Node.ELEMENT_NODE`\n }\n\n // Heads up!\n // We intercept the `remove()` method to remove the mount node only when portal has been unmounted already.\n if (property === 'remove') {\n const targetElement = elementFactory.get(targetNode, false);\n\n if (targetElement) {\n // If the mountElement has children, the portal is still mounted, otherwise we can dispose of it\n const portalHasNoChildren = targetElement.childNodes.length === 0;\n\n if (portalHasNoChildren) {\n elementFactory.dispose();\n }\n }\n\n return () => {\n // Always return a no-op function to avoid errors in the code\n };\n }\n\n const targetElement = elementFactory.get(targetNode, true);\n const targetProperty = targetElement ? targetElement[property] : undefined;\n\n if (typeof targetProperty === 'function') {\n return targetProperty.bind(targetElement);\n }\n\n return targetProperty;\n },\n\n set(_, property: keyof HTMLDivElement | '_virtual' | 'focusVisible', value) {\n const ignoredProperty = property === '_virtual' || property === 'focusVisible';\n\n // We should use the `elementFactory.get(targetNode, !ignoredProperty)`,\n // but TypeScript requires a literal `true` or `false` for the overload signature.\n // This workaround ensures the correct overload is called and avoids TypeScript errors.\n const targetElement = ignoredProperty\n ? elementFactory.get(targetNode, false)\n : elementFactory.get(targetNode, true);\n\n if (ignoredProperty && !targetElement) {\n // We ignore the `_virtual` and `focusVisible` properties to avoid conflicts with the proxy\n return true;\n }\n\n if (targetElement) {\n Object.assign(targetElement, { [property]: value });\n return true;\n }\n\n return false;\n },\n });\n }, [elementFactory, targetNode, options.disabled]);\n\n useInsertionEffect!(() => {\n if (!elementProxy) {\n return;\n }\n\n const classesToApply = className.split(' ').filter(Boolean);\n\n elementProxy.classList.add(...classesToApply);\n elementProxy.setAttribute('dir', dir);\n elementProxy.setAttribute('data-portal-node', 'true');\n\n focusVisibleRef.current = elementProxy;\n\n return () => {\n elementProxy.classList.remove(...classesToApply);\n elementProxy.removeAttribute('dir');\n };\n }, [className, dir, elementProxy, focusVisibleRef]);\n\n React.useEffect(() => {\n return () => {\n elementProxy?.remove();\n };\n }, [elementProxy]);\n\n return elementProxy;\n};\n\n/**\n * Element factory based on the React version.\n *\n * React 17 and below:\n * - useLegacyElementFactory\n *\n * React 18 and above:\n * - useModernElementFactory\n */\nconst useElementFactory = useInsertionEffect ? useModernElementFactory : useLegacyElementFactory;\n\n/**\n * Creates a new element on a \"document.body\" to mount portals.\n */\nexport const usePortalMountNode = (options: UsePortalMountNodeOptions): HTMLElement | null => {\n ('use no memo'); // justified: compiler would optimize usePortalMountNode — manual opt-out to preserve runtime behavior\n\n const { targetDocument, dir } = useFluent();\n const mountNode = usePortalMountNodeContext();\n\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n const focusVisibleRef = useFocusVisible<HTMLDivElement>() as React.MutableRefObject<HTMLElement | null>;\n const themeClassName = useThemeClassName();\n\n const factoryOptions: UseElementFactoryOptions = {\n dir,\n disabled: options.disabled,\n focusVisibleRef,\n\n className: usePortalMountNodeClassName(themeClassName, options.className),\n targetNode: mountNode ?? targetDocument?.body,\n };\n\n return useElementFactory(factoryOptions);\n};\n"],"names":["React","useThemeClassName_unstable","useThemeClassName","useFluent_unstable","useFluent","usePortalMountNode","usePortalMountNodeContext","useFocusVisible","usePortalMountNodeClassName","useInsertionEffect","useLegacyElementFactory","options","className","dir","focusVisibleRef","targetNode","targetElement","useMemo","undefined","disabled","element","ownerDocument","createElement","appendChild","setAttribute","current","useEffect","remove","initializeElementFactory","currentElement","get","targetRoot","forceCreation","dispose","useModernElementFactory","elementFactory","useState","elementProxy","Proxy","_","property","portalHasNoChildren","childNodes","length","targetProperty","bind","set","value","ignoredProperty","Object","assign","classesToApply","split","filter","Boolean","classList","add","removeAttribute","useElementFactory","targetDocument","mountNode","themeClassName","factoryOptions","body"],"mappings":"AAAA;AAEA,YAAYA,WAAW,QAAQ;AAC/B,SACEC,8BAA8BC,iBAAiB,EAC/CC,sBAAsBC,SAAS,EAC/BC,sBAAsBC,yBAAyB,QAC1C,kCAAkC;AACzC,SAASC,eAAe,QAAQ,0BAA0B;AAE1D,SAASC,2BAA2B,QAAQ,uCAAoC;AAEhF,MAAMC,qBAAqB,AAACT,KAAe,CAAC,iBAAiB,SAAS;AAqBtE;;;;CAIC,GACD,MAAMU,0BAA6CC,CAAAA;IACjD,MAAM,EAAEC,SAAS,EAAEC,GAAG,EAAEC,eAAe,EAAEC,UAAU,EAAE,GAAGJ;IAExD,MAAMK,gBAAgBhB,MAAMiB,OAAO,CAAC;QAClC,IAAIF,eAAeG,aAAaP,QAAQQ,QAAQ,EAAE;YAChD,OAAO;QACT;QAEA,MAAMC,UAAUL,WAAWM,aAAa,CAACC,aAAa,CAAC;QACvDP,WAAWQ,WAAW,CAACH;QAEvB,OAAOA;IACT,GAAG;QAACL;QAAYJ,QAAQQ,QAAQ;KAAC;IAEjC,YAAY;IACZ,2DAA2D;IAC3D,EAAE;IACF,sHAAsH;IACtH,qHAAqH;IACrH,eAAe;IACf,qDAAqD;IACrDnB,MAAMiB,OAAO,CAAC;QACZ,IAAI,CAACD,eAAe;YAClB;QACF;QAEA,oDAAoD;QACpDA,cAAcJ,SAAS,GAAGA;QAC1BI,cAAcQ,YAAY,CAAC,OAAOX;QAClCG,cAAcQ,YAAY,CAAC,oBAAoB;QAE/C,4CAA4C;QAC5CV,gBAAgBW,OAAO,GAAGT;IAC5B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AAcvB;KAAgB;IAElDd,MAAM0B,SAAS,CAAC;QACd,OAAO;YACLW,yBAAAA,mCAAAA,aAAcV,MAAM;QACtB;IACF,GAAG;QAACU;KAAa;IAEjB,OAAOA;AACT;AAEA;;;;;;;;CAQC,GACD,MAAMqB,oBAAoBjD,qBAAqByB,0BAA0BxB;AAEzE;;CAEC,GACD,OAAO,MAAML,qBAAqB,CAACM;IAChC,eAAgB,sGAAsG;IAEvH,MAAM,EAAEgD,cAAc,EAAE9C,GAAG,EAAE,GAAGT;IAChC,MAAMwD,YAAYtD;IAElB,4DAA4D;IAC5D,MAAMQ,kBAAkBP;IACxB,MAAMsD,iBAAiB3D;IAEvB,MAAM4D,iBAA2C;QAC/CjD;QACAM,UAAUR,QAAQQ,QAAQ;QAC1BL;QAEAF,WAAWJ,4BAA4BqD,gBAAgBlD,QAAQC,SAAS;QACxEG,UAAU,EAAE6C,sBAAAA,uBAAAA,YAAaD,2BAAAA,qCAAAA,eAAgBI,IAAI;IAC/C;IAEA,OAAOL,kBAAkBI;AAC3B,EAAE"}
@@ -0,0 +1,5 @@
1
+ import styles from "./Portal.module.css";
2
+ import { clsx } from "clsx";
3
+ export const usePortalMountNodeClassName = (themeClassName, className)=>{
4
+ return clsx(themeClassName, styles.root, className);
5
+ };
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/components/Portal/usePortalMountNodeStyles.styles.css.ts"],"sourcesContent":["import styles from './Portal.module.css';\nimport { clsx } from 'clsx';\n\nexport const usePortalMountNodeClassName = (themeClassName: string, className?: string): string => {\n return clsx(themeClassName, styles.root, className);\n};\n"],"names":["styles","clsx","usePortalMountNodeClassName","themeClassName","className","root"],"mappings":"AAAA,OAAOA,YAAY,sBAAsB;AACzC,SAASC,IAAI,QAAQ,OAAO;AAE5B,OAAO,MAAMC,8BAA8B,CAACC,gBAAwBC;IAClE,OAAOH,KAAKE,gBAAgBH,OAAOK,IAAI,EAAED;AAC3C,EAAE"}
@@ -1,7 +1,7 @@
1
1
  'use client';
2
2
 
3
- import { __styles } from "@griffel/react";
4
- export const usePortalMountNodeStylesStyles = /*#__PURE__*/__styles({
3
+ import { __styles, mergeClasses } from "@griffel/react";
4
+ const usePortalMountNodeStylesStyles = /*#__PURE__*/__styles({
5
5
  root: {
6
6
  qhf8xq: "f1euv43f",
7
7
  Bhzewxz: "f15twtuk",
@@ -11,4 +11,8 @@ export const usePortalMountNodeStylesStyles = /*#__PURE__*/__styles({
11
11
  }
12
12
  }, {
13
13
  d: [".f1euv43f{position:absolute;}", ".f15twtuk{top:0;}", ".f1vgc2s3{left:0;}", ".f1e31b4d{right:0;}", ".f494woh{z-index:1000000;}"]
14
- });
14
+ });
15
+ export const usePortalMountNodeClassName = (themeClassName, className) => {
16
+ const styles = usePortalMountNodeStylesStyles();
17
+ return mergeClasses(themeClassName, styles.root, className);
18
+ };
@@ -1 +1 @@
1
- {"version":3,"names":["__styles","usePortalMountNodeStylesStyles","root","qhf8xq","Bhzewxz","oyh7mz","j35jbq","Bj3rh1h","d"],"sources":["usePortalMountNodeStyles.styles.js"],"sourcesContent":["'use client';\nimport { makeStyles } from \"@griffel/react\";\nexport const usePortalMountNodeStylesStyles = makeStyles({\n root: {\n // Creates new stacking context to prevent z-index issues\n // https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_positioned_layout/Understanding_z-index/Stacking_context\n //\n // Also keeps a portal on top of a page to prevent scrollbars from appearing\n position: 'absolute',\n top: 0,\n left: 0,\n right: 0,\n zIndex: 1000000\n }\n});\n"],"mappings":"AAAA,YAAY;;AACZ,SAAAA,QAAA,QAA2B,gBAAgB;AAC3C,OAAO,MAAMC,8BAA8B,gBAAGD,QAAA;EAAAE,IAAA;IAAAC,MAAA;IAAAC,OAAA;IAAAC,MAAA;IAAAC,MAAA;IAAAC,OAAA;EAAA;AAAA;EAAAC,CAAA;AAAA,CAY7C,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["__styles","mergeClasses","usePortalMountNodeStylesStyles","root","qhf8xq","Bhzewxz","oyh7mz","j35jbq","Bj3rh1h","d","usePortalMountNodeClassName","themeClassName","className","styles"],"sources":["usePortalMountNodeStyles.styles.js"],"sourcesContent":["'use client';\nimport { makeStyles, mergeClasses } from \"@griffel/react\";\nconst usePortalMountNodeStylesStyles = makeStyles({\n root: {\n // Creates new stacking context to prevent z-index issues\n // https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_positioned_layout/Understanding_z-index/Stacking_context\n //\n // Also keeps a portal on top of a page to prevent scrollbars from appearing\n position: 'absolute',\n top: 0,\n left: 0,\n right: 0,\n zIndex: 1000000\n }\n});\nexport const usePortalMountNodeClassName = (themeClassName, className)=>{\n const styles = usePortalMountNodeStylesStyles();\n return mergeClasses(themeClassName, styles.root, className);\n};\n"],"mappings":"AAAA,YAAY;;AACZ,SAAAA,QAAA,EAAqBC,YAAY,QAAQ,gBAAgB;AACzD,MAAMC,8BAA8B,gBAAGF,QAAA;EAAAG,IAAA;IAAAC,MAAA;IAAAC,OAAA;IAAAC,MAAA;IAAAC,MAAA;IAAAC,OAAA;EAAA;AAAA;EAAAC,CAAA;AAAA,CAYtC,CAAC;AACF,OAAO,MAAMC,2BAA2B,GAAGA,CAACC,cAAc,EAAEC,SAAS,KAAG;EACpE,MAAMC,MAAM,GAAGX,8BAA8B,CAAC,CAAC;EAC/C,OAAOD,YAAY,CAACU,cAAc,EAAEE,MAAM,CAACV,IAAI,EAAES,SAAS,CAAC;AAC/D,CAAC","ignoreList":[]}
@@ -0,0 +1,5 @@
1
+ import styles from "./Portal.module.css";
2
+ import { clsx } from "clsx";
3
+ export const usePortalMountNodeClassName = (themeClassName, className)=>{
4
+ return clsx(themeClassName, styles.root, className);
5
+ };
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/components/Portal/usePortalMountNodeStyles.styles.css.ts"],"sourcesContent":["import styles from './Portal.module.css';\nimport { clsx } from 'clsx';\n\nexport const usePortalMountNodeClassName = (themeClassName: string, className?: string): string => {\n return clsx(themeClassName, styles.root, className);\n};\n"],"names":["styles","clsx","usePortalMountNodeClassName","themeClassName","className","root"],"mappings":"AAAA,OAAOA,YAAY,sBAAsB;AACzC,SAASC,IAAI,QAAQ,OAAO;AAE5B,OAAO,MAAMC,8BAA8B,CAACC,gBAAwBC;IAClE,OAAOH,KAAKE,gBAAgBH,OAAOK,IAAI,EAAED;AAC3C,EAAE"}
@@ -1,6 +1,6 @@
1
1
  'use client';
2
- import { makeStyles } from "@griffel/react";
3
- export const usePortalMountNodeStylesStyles = makeStyles({
2
+ import { makeStyles, mergeClasses } from "@griffel/react";
3
+ const usePortalMountNodeStylesStyles = makeStyles({
4
4
  root: {
5
5
  // Creates new stacking context to prevent z-index issues
6
6
  // https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_positioned_layout/Understanding_z-index/Stacking_context
@@ -13,3 +13,7 @@ export const usePortalMountNodeStylesStyles = makeStyles({
13
13
  zIndex: 1000000
14
14
  }
15
15
  });
16
+ export const usePortalMountNodeClassName = (themeClassName, className)=>{
17
+ const styles = usePortalMountNodeStylesStyles();
18
+ return mergeClasses(themeClassName, styles.root, className);
19
+ };
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/components/Portal/usePortalMountNodeStyles.styles.ts"],"sourcesContent":["'use client';\n\nimport { makeStyles } from '@griffel/react';\n\nexport const usePortalMountNodeStylesStyles = makeStyles({\n root: {\n // Creates new stacking context to prevent z-index issues\n // https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_positioned_layout/Understanding_z-index/Stacking_context\n //\n // Also keeps a portal on top of a page to prevent scrollbars from appearing\n position: 'absolute',\n top: 0,\n left: 0,\n right: 0,\n\n zIndex: 1000000,\n },\n});\n"],"names":["makeStyles","usePortalMountNodeStylesStyles","root","position","top","left","right","zIndex"],"mappings":"AAAA;AAEA,SAASA,UAAU,QAAQ,iBAAiB;AAE5C,OAAO,MAAMC,iCAAiCD,WAAW;IACvDE,MAAM;QACJ,yDAAyD;QACzD,gHAAgH;QAChH,EAAE;QACF,4EAA4E;QAC5EC,UAAU;QACVC,KAAK;QACLC,MAAM;QACNC,OAAO;QAEPC,QAAQ;IACV;AACF,GAAG"}
1
+ {"version":3,"sources":["../../../src/components/Portal/usePortalMountNodeStyles.styles.ts"],"sourcesContent":["'use client';\n\nimport { makeStyles, mergeClasses } from '@griffel/react';\n\nconst usePortalMountNodeStylesStyles = makeStyles({\n root: {\n // Creates new stacking context to prevent z-index issues\n // https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_positioned_layout/Understanding_z-index/Stacking_context\n //\n // Also keeps a portal on top of a page to prevent scrollbars from appearing\n position: 'absolute',\n top: 0,\n left: 0,\n right: 0,\n\n zIndex: 1000000,\n },\n});\n\nexport const usePortalMountNodeClassName = (themeClassName: string, className?: string): string => {\n const styles = usePortalMountNodeStylesStyles();\n\n return mergeClasses(themeClassName, styles.root, className);\n};\n"],"names":["makeStyles","mergeClasses","usePortalMountNodeStylesStyles","root","position","top","left","right","zIndex","usePortalMountNodeClassName","themeClassName","className","styles"],"mappings":"AAAA;AAEA,SAASA,UAAU,EAAEC,YAAY,QAAQ,iBAAiB;AAE1D,MAAMC,iCAAiCF,WAAW;IAChDG,MAAM;QACJ,yDAAyD;QACzD,gHAAgH;QAChH,EAAE;QACF,4EAA4E;QAC5EC,UAAU;QACVC,KAAK;QACLC,MAAM;QACNC,OAAO;QAEPC,QAAQ;IACV;AACF;AAEA,OAAO,MAAMC,8BAA8B,CAACC,gBAAwBC;IAClE,MAAMC,SAASV;IAEf,OAAOD,aAAaS,gBAAgBE,OAAOT,IAAI,EAAEQ;AACnD,EAAE"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/utils/toMountNodeProps.ts"],"sourcesContent":["import { isHTMLElement } from '@fluentui/react-utilities';\nimport type { PortalProps } from '../Portal';\n\n/**\n * The function that normalizes the `mountNode` prop into an object with element and className props.\n *\n * @param mountNode - an HTML element or an object with props\n */\nexport function toMountNodeProps(mountNode: PortalProps['mountNode']): {\n element?: HTMLElement | null;\n className?: string;\n} {\n if (isHTMLElement(mountNode)) {\n return { element: mountNode };\n }\n\n if (typeof mountNode === 'object') {\n if (mountNode === null) {\n return { element: null };\n }\n\n return mountNode;\n }\n\n return {};\n}\n"],"names":["isHTMLElement","toMountNodeProps","mountNode","element"],"mappings":"AAAA,SAASA,aAAa,QAAQ,4BAA4B;AAG1D;;;;CAIC,GACD,OAAO,SAASC,iBAAiBC,SAAmC;IAIlE,IAAIF,cAAcE,YAAY;QAC5B,OAAO;YAAEC,SAASD;QAAU;IAC9B;IAEA,IAAI,OAAOA,cAAc,UAAU;QACjC,IAAIA,cAAc,MAAM;YACtB,OAAO;gBAAEC,SAAS;YAAK;QACzB;QAEA,OAAOD;IACT;IAEA,OAAO,CAAC;AACV"}
1
+ {"version":3,"sources":["../../src/utils/toMountNodeProps.ts"],"sourcesContent":["import { isHTMLElement } from '@fluentui/react-utilities';\nimport type { PortalProps } from '../Portal';\n\n/**\n * The function that normalizes the `mountNode` prop into an object with element and className props.\n *\n * @param mountNode - an HTML element or an object with props\n */\nexport function toMountNodeProps(mountNode: PortalProps['mountNode']): {\n element?: HTMLElement | null;\n className?: string;\n} {\n if (isHTMLElement(mountNode)) {\n return { element: mountNode };\n }\n\n if (typeof mountNode === 'object') {\n if (mountNode === null) {\n return { element: null };\n }\n\n return mountNode;\n }\n\n return {};\n}\n"],"names":["isHTMLElement","toMountNodeProps","mountNode","element"],"mappings":"AAAA,SAASA,aAAa,QAAQ,4BAA4B;AAG1D;;;;CAIC,GACD,OAAO,SAASC,iBAAiBC,SAAmC;IAIlE,IAAIF,cAAcE,YAAY;QAC5B,OAAO;YAAEC,SAASD;QAAU;IAC9B;IAEA,IAAI,OAAOA,cAAc,UAAU;QACjC,IAAIA,cAAc,MAAM;YACtB,OAAO;gBAAEC,SAAS;YAAK;QACzB;QAEA,OAAOD;IACT;IAEA,OAAO,CAAC;AACV"}
@@ -5,17 +5,17 @@ Object.defineProperty(exports, "__esModule", {
5
5
  function _export(target, all) {
6
6
  for(var name in all)Object.defineProperty(target, name, {
7
7
  enumerable: true,
8
- get: all[name]
8
+ get: Object.getOwnPropertyDescriptor(all, name).get
9
9
  });
10
10
  }
11
11
  _export(exports, {
12
- Portal: function() {
12
+ get Portal () {
13
13
  return _index.Portal;
14
14
  },
15
- renderPortal_unstable: function() {
15
+ get renderPortal_unstable () {
16
16
  return _index.renderPortal_unstable;
17
17
  },
18
- usePortal_unstable: function() {
18
+ get usePortal_unstable () {
19
19
  return _index.usePortal_unstable;
20
20
  }
21
21
  });
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/components/Portal/Portal.tsx"],"sourcesContent":["'use client';\n\nimport type * as React from 'react';\n\nimport { usePortal_unstable } from './usePortal';\nimport { renderPortal_unstable } from './renderPortal';\nimport type { PortalProps } from './Portal.types';\n\n/**\n * A portal provides a way to render children into a DOM node\n * that exists outside the DOM hierarchy of the parent component.\n */\nexport const Portal: React.FC<PortalProps> = props => {\n const state = usePortal_unstable(props);\n\n return renderPortal_unstable(state);\n};\n\nPortal.displayName = 'Portal';\n"],"names":["usePortal_unstable","renderPortal_unstable","Portal","props","state","displayName"],"mappings":"AAAA;;;;;;;;;;;2BAImC,iBAAc;8BACX,oBAAiB;AAOhD,MAAME,SAAgCC,CAAAA;IAC3C,MAAMC,YAAQJ,6BAAAA,EAAmBG;IAEjC,WAAOF,mCAAAA,EAAsBG;AAC/B,EAAE;AAEFF,OAAOG,WAAW,GAAG"}
1
+ {"version":3,"sources":["../../../src/components/Portal/Portal.tsx"],"sourcesContent":["'use client';\n\nimport type * as React from 'react';\n\nimport { usePortal_unstable } from './usePortal';\nimport { renderPortal_unstable } from './renderPortal';\nimport type { PortalProps } from './Portal.types';\n\n/**\n * A portal provides a way to render children into a DOM node\n * that exists outside the DOM hierarchy of the parent component.\n */\nexport const Portal: React.FC<PortalProps> = props => {\n const state = usePortal_unstable(props);\n\n return renderPortal_unstable(state);\n};\n\nPortal.displayName = 'Portal';\n"],"names":["usePortal_unstable","renderPortal_unstable","Portal","props","state","displayName"],"mappings":"AAAA;;;;;;;;;;;2BAImC,iBAAc;8BACX,oBAAiB;AAOhD,MAAME,SAAgCC,CAAAA;IAC3C,MAAMC,YAAQJ,6BAAAA,EAAmBG;IAEjC,WAAOF,mCAAAA,EAAsBG;AAC/B,EAAE;AAEFF,OAAOG,WAAW,GAAG"}
@@ -0,0 +1,9 @@
1
+ @layer fluentui {
2
+ .root {
3
+ position: absolute;
4
+ top: 0;
5
+ left: 0;
6
+ right: 0;
7
+ z-index: 1000000;
8
+ }
9
+ }
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/components/Portal/Portal.types.ts"],"sourcesContent":["import type * as React from 'react';\n\nexport type PortalProps = {\n /**\n * React children\n */\n children?: React.ReactNode;\n\n /**\n * Where the portal children are mounted on DOM\n *\n * @default a new element on document.body without any styling\n */\n mountNode?: HTMLElement | null | { element?: HTMLElement | null; className?: string };\n};\n\nexport type PortalState = Pick<PortalProps, 'children'> & {\n mountNode: HTMLElement | null | undefined;\n\n /**\n * Ref to the root span element as virtual parent\n */\n virtualParentRootRef: // eslint-disable-next-line @typescript-eslint/no-deprecated\n React.MutableRefObject<HTMLSpanElement | null>;\n};\n"],"names":[],"mappings":""}
1
+ {"version":3,"sources":["../../../src/components/Portal/Portal.types.ts"],"sourcesContent":["import type * as React from 'react';\n\nexport type PortalProps = {\n /**\n * React children\n */\n children?: React.ReactNode;\n\n /**\n * Where the portal children are mounted on DOM\n *\n * @default a new element on document.body without any styling\n */\n mountNode?: HTMLElement | null | { element?: HTMLElement | null; className?: string };\n};\n\nexport type PortalState = Pick<PortalProps, 'children'> & {\n mountNode: HTMLElement | null | undefined;\n\n /**\n * Ref to the root span element as virtual parent\n */\n virtualParentRootRef: // eslint-disable-next-line @typescript-eslint/no-deprecated\n React.MutableRefObject<HTMLSpanElement | null>;\n};\n"],"names":[],"mappings":""}
@@ -5,17 +5,17 @@ Object.defineProperty(exports, "__esModule", {
5
5
  function _export(target, all) {
6
6
  for(var name in all)Object.defineProperty(target, name, {
7
7
  enumerable: true,
8
- get: all[name]
8
+ get: Object.getOwnPropertyDescriptor(all, name).get
9
9
  });
10
10
  }
11
11
  _export(exports, {
12
- Portal: function() {
12
+ get Portal () {
13
13
  return _Portal.Portal;
14
14
  },
15
- renderPortal_unstable: function() {
15
+ get renderPortal_unstable () {
16
16
  return _renderPortal.renderPortal_unstable;
17
17
  },
18
- usePortal_unstable: function() {
18
+ get usePortal_unstable () {
19
19
  return _usePortal.usePortal_unstable;
20
20
  }
21
21
  });
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/components/Portal/index.ts"],"sourcesContent":["export { Portal } from './Portal';\nexport type { PortalProps, PortalState } from './Portal.types';\nexport { renderPortal_unstable } from './renderPortal';\nexport { usePortal_unstable } from './usePortal';\n"],"names":["Portal","renderPortal_unstable","usePortal_unstable"],"mappings":";;;;;;;;;;;;eAASA,cAAM;;;eAENC,mCAAqB;;;eACrBC,6BAAkB;;;wBAHJ,cAAW;8BAEI,oBAAiB;2BACpB,iBAAc"}
1
+ {"version":3,"sources":["../../../src/components/Portal/index.ts"],"sourcesContent":["export { Portal } from './Portal';\nexport type { PortalProps, PortalState } from './Portal.types';\nexport { renderPortal_unstable } from './renderPortal';\nexport { usePortal_unstable } from './usePortal';\n"],"names":["Portal","renderPortal_unstable","usePortal_unstable"],"mappings":";;;;;;;;;;;;eAASA,cAAM;;;eAENC,mCAAqB;;;eACrBC,6BAAkB;;;wBAHJ,cAAW;8BAEI,oBAAiB;2BACpB,iBAAc"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/components/Portal/renderPortal.tsx"],"sourcesContent":["import * as ReactDOM from 'react-dom';\nimport * as React from 'react';\nimport type { PortalState } from './Portal.types';\n\n/**\n * Render the final JSX of Portal\n */\nexport const renderPortal_unstable = (state: PortalState): React.ReactElement => {\n return (\n <span hidden ref={state.virtualParentRootRef}>\n {state.mountNode &&\n ReactDOM.createPortal(\n <>\n {state.children}\n {/* Heads up!\n * This node exists only to ensure that the portal is not empty as we rely on that in `usePortalMountNode`\n * hook for React 18+.\n */}\n <span hidden />\n </>,\n state.mountNode,\n )}\n </span>\n );\n};\n"],"names":["ReactDOM","React","renderPortal_unstable","state","span","hidden","ref","virtualParentRootRef","mountNode","createPortal","children"],"mappings":";;;;+BAOaE;;;;;;;oEAPa,YAAY;iEACf,QAAQ;AAMxB,8BAA8B,CAACC;IACpC,OAAA,WAAA,GACE,OAAA,aAAA,CAACC,QAAAA;QAAKC,QAAAA;QAAOC,KAAKH,MAAMI,oBAAoB;OACzCJ,MAAMK,SAAS,IAAA,WAAA,GACdR,UAASS,YAAY,CAAA,WAAA,GACnB,OAAA,aAAA,CAAA,OAAA,QAAA,EAAA,MACGN,MAAMO,QAAQ,EAAA,WAAA,GAKf,OAAA,aAAA,CAACN,QAAAA;QAAKC,QAAAA;SAERF,MAAMK,SAAS;AAIzB,EAAE"}
1
+ {"version":3,"sources":["../../../src/components/Portal/renderPortal.tsx"],"sourcesContent":["import * as ReactDOM from 'react-dom';\nimport * as React from 'react';\nimport type { PortalState } from './Portal.types';\n\n/**\n * Render the final JSX of Portal\n */\nexport const renderPortal_unstable = (state: PortalState): React.ReactElement => {\n return (\n <span hidden ref={state.virtualParentRootRef}>\n {state.mountNode &&\n ReactDOM.createPortal(\n <>\n {state.children}\n {/* Heads up!\n * This node exists only to ensure that the portal is not empty as we rely on that in `usePortalMountNode`\n * hook for React 18+.\n */}\n <span hidden />\n </>,\n state.mountNode,\n )}\n </span>\n );\n};\n"],"names":["ReactDOM","React","renderPortal_unstable","state","span","hidden","ref","virtualParentRootRef","mountNode","createPortal","children"],"mappings":";;;;+BAOaE;;;;;;;oEAPa,YAAY;iEACf,QAAQ;AAMxB,8BAA8B,CAACC;IACpC,OAAA,WAAA,GACE,OAAA,aAAA,CAACC,QAAAA;QAAKC,QAAAA;QAAOC,KAAKH,MAAMI,oBAAoB;OACzCJ,MAAMK,SAAS,IAAA,WAAA,GACdR,UAASS,YAAY,CAAA,WAAA,GACnB,OAAA,aAAA,CAAA,OAAA,QAAA,EAAA,MACGN,MAAMO,QAAQ,EAAA,WAAA,GAKf,OAAA,aAAA,CAACN,QAAAA;QAAKC,QAAAA;SAERF,MAAMK,SAAS;AAIzB,EAAE"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/components/Portal/usePortal.ts"],"sourcesContent":["'use client';\n\nimport { setVirtualParent } from '@fluentui/react-utilities';\nimport * as React from 'react';\n\nimport { toMountNodeProps } from '../../utils/toMountNodeProps';\nimport { usePortalMountNode } from './usePortalMountNode';\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 { element, className } = toMountNodeProps(props.mountNode);\n\n const virtualParentRootRef = React.useRef<HTMLSpanElement>(null);\n const fallbackElement = usePortalMountNode({ disabled: !!element, className });\n\n const mountNode = element ?? fallbackElement;\n const state: PortalState = {\n children: props.children,\n mountNode,\n virtualParentRootRef,\n };\n\n React.useEffect(() => {\n if (!mountNode) {\n return;\n }\n\n const virtualParent = virtualParentRootRef.current;\n\n // By default, we create a mount node for portal on `document.body` (see usePortalMountNode()) and have following structure:\n //\n // <body>\n // <!-- ⚛️ application root -->\n // <div id=\"root\">\n // <!-- ⬇️ portal node rendered in a tree to anchor (virtual parent node) -->\n // <span aria-hidden=\"true\"></span>\n // </div>\n // <div id=\"portal-mount-node\">\n // <!-- 🧩portal content -->\n // </div>\n // </body>\n //\n // To make sure that `.elementContains()` works correctly, we link a virtual parent to a portal node (a virtual parent node becomes a parent of mount node):\n // virtual.contains(mountNode) === false\n // (while we need ⬇️⬇️⬇️)\n // elementsContains(virtualParent, mountNode) === true\n // elementsContains(mountNode, virtualParent) === false\n //\n // For more details, check docs for virtual parent utils.\n //\n // However, if a user provides a custom mount node (via `props`) the structure could be different:\n //\n // <body>\n // <!-- application root -->\n // <div id=\"root\">\n // <div id=\"portal-mount-node\">\n // <!-- 🧩portal content -->\n //\n // <span aria-hidden=\"true\"></span>\n // </div>\n // </div>\n // </body>\n //\n // A mount node in this case contains portal's content and a virtual parent node. In this case nodes linking is redundant and the check below avoids it.\n //\n // Otherwise, there is a circular reference - both elements are parents of each other:\n // elementsContains(mountNode, virtualParent) === true\n // elementsContains(virtualParent, mountNode) === true\n const isVirtualParentInsideChild = mountNode.contains(virtualParent);\n\n if (virtualParent && !isVirtualParentInsideChild) {\n setVirtualParent(mountNode, virtualParent);\n\n return () => {\n setVirtualParent(mountNode, undefined);\n };\n }\n }, [virtualParentRootRef, mountNode]);\n\n return state;\n};\n"],"names":["setVirtualParent","React","toMountNodeProps","usePortalMountNode","usePortal_unstable","props","element","className","mountNode","virtualParentRootRef","useRef","fallbackElement","disabled","state","children","useEffect","virtualParent","current","isVirtualParentInsideChild","contains","undefined"],"mappings":"AAAA;;;;;+BAgBaI;;;;;;;gCAdoB,4BAA4B;iEACtC,QAAQ;kCAEE,kCAA+B;oCAC7B,0BAAuB;AAUnD,2BAA2B,CAACC;IACjC,MAAM,EAAEC,OAAO,EAAEC,SAAS,EAAE,OAAGL,kCAAAA,EAAiBG,MAAMG,SAAS;IAE/D,MAAMC,uBAAuBR,OAAMS,MAAM,CAAkB;IAC3D,MAAMC,sBAAkBR,sCAAAA,EAAmB;QAAES,UAAU,CAAC,CAACN;QAASC;IAAU;IAE5E,MAAMC,YAAYF,YAAAA,QAAAA,YAAAA,KAAAA,IAAAA,UAAWK;IAC7B,MAAME,QAAqB;QACzBC,UAAUT,MAAMS,QAAQ;QACxBN;QACAC;IACF;IAEAR,OAAMc,SAAS,CAAC;QACd,IAAI,CAACP,WAAW;YACd;QACF;QAEA,MAAMQ,gBAAgBP,qBAAqBQ,OAAO;QAElD,4HAA4H;QAC5H,EAAE;QACF,SAAS;QACT,iCAAiC;QACjC,oBAAoB;QACpB,iFAAiF;QACjF,uCAAuC;QACvC,WAAW;QACX,iCAAiC;QACjC,gCAAgC;QAChC,WAAW;QACX,UAAU;QACV,EAAE;QACF,4JAA4J;QAC5J,0CAA0C;QAC1C,2BAA2B;QAC3B,wDAAwD;QACxD,yDAAyD;QACzD,EAAE;QACF,yDAAyD;QACzD,EAAE;QACF,kGAAkG;QAClG,EAAE;QACF,SAAS;QACT,8BAA8B;QAC9B,oBAAoB;QACpB,mCAAmC;QACnC,kCAAkC;QAClC,EAAE;QACF,yCAAyC;QACzC,aAAa;QACb,WAAW;QACX,UAAU;QACV,EAAE;QACF,wJAAwJ;QACxJ,EAAE;QACF,sFAAsF;QACtF,wDAAwD;QACxD,wDAAwD;QACxD,MAAMC,6BAA6BV,UAAUW,QAAQ,CAACH;QAEtD,IAAIA,iBAAiB,CAACE,4BAA4B;YAChDlB,oCAAAA,EAAiBQ,WAAWQ;YAE5B,OAAO;oBACLhB,gCAAAA,EAAiBQ,WAAWY;YAC9B;QACF;IACF,GAAG;QAACX;QAAsBD;KAAU;IAEpC,OAAOK;AACT,EAAE"}
1
+ {"version":3,"sources":["../../../src/components/Portal/usePortal.ts"],"sourcesContent":["'use client';\n\nimport { setVirtualParent } from '@fluentui/react-utilities';\nimport * as React from 'react';\n\nimport { toMountNodeProps } from '../../utils/toMountNodeProps';\nimport { usePortalMountNode } from './usePortalMountNode';\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 { element, className } = toMountNodeProps(props.mountNode);\n\n const virtualParentRootRef = React.useRef<HTMLSpanElement>(null);\n const fallbackElement = usePortalMountNode({ disabled: !!element, className });\n\n const mountNode = element ?? fallbackElement;\n const state: PortalState = {\n children: props.children,\n mountNode,\n virtualParentRootRef,\n };\n\n React.useEffect(() => {\n if (!mountNode) {\n return;\n }\n\n const virtualParent = virtualParentRootRef.current;\n\n // By default, we create a mount node for portal on `document.body` (see usePortalMountNode()) and have following structure:\n //\n // <body>\n // <!-- ⚛️ application root -->\n // <div id=\"root\">\n // <!-- ⬇️ portal node rendered in a tree to anchor (virtual parent node) -->\n // <span aria-hidden=\"true\"></span>\n // </div>\n // <div id=\"portal-mount-node\">\n // <!-- 🧩portal content -->\n // </div>\n // </body>\n //\n // To make sure that `.elementContains()` works correctly, we link a virtual parent to a portal node (a virtual parent node becomes a parent of mount node):\n // virtual.contains(mountNode) === false\n // (while we need ⬇️⬇️⬇️)\n // elementsContains(virtualParent, mountNode) === true\n // elementsContains(mountNode, virtualParent) === false\n //\n // For more details, check docs for virtual parent utils.\n //\n // However, if a user provides a custom mount node (via `props`) the structure could be different:\n //\n // <body>\n // <!-- application root -->\n // <div id=\"root\">\n // <div id=\"portal-mount-node\">\n // <!-- 🧩portal content -->\n //\n // <span aria-hidden=\"true\"></span>\n // </div>\n // </div>\n // </body>\n //\n // A mount node in this case contains portal's content and a virtual parent node. In this case nodes linking is redundant and the check below avoids it.\n //\n // Otherwise, there is a circular reference - both elements are parents of each other:\n // elementsContains(mountNode, virtualParent) === true\n // elementsContains(virtualParent, mountNode) === true\n const isVirtualParentInsideChild = mountNode.contains(virtualParent);\n\n if (virtualParent && !isVirtualParentInsideChild) {\n setVirtualParent(mountNode, virtualParent);\n\n return () => {\n setVirtualParent(mountNode, undefined);\n };\n }\n }, [virtualParentRootRef, mountNode]);\n\n return state;\n};\n"],"names":["setVirtualParent","React","toMountNodeProps","usePortalMountNode","usePortal_unstable","props","element","className","mountNode","virtualParentRootRef","useRef","fallbackElement","disabled","state","children","useEffect","virtualParent","current","isVirtualParentInsideChild","contains","undefined"],"mappings":"AAAA;;;;;+BAgBaI;;;;;;;gCAdoB,4BAA4B;iEACtC,QAAQ;kCAEE,kCAA+B;oCAC7B,0BAAuB;AAUnD,2BAA2B,CAACC;IACjC,MAAM,EAAEC,OAAO,EAAEC,SAAS,EAAE,OAAGL,kCAAAA,EAAiBG,MAAMG,SAAS;IAE/D,MAAMC,uBAAuBR,OAAMS,MAAM,CAAkB;IAC3D,MAAMC,sBAAkBR,sCAAAA,EAAmB;QAAES,UAAU,CAAC,CAACN;QAASC;IAAU;IAE5E,MAAMC,YAAYF,YAAAA,QAAAA,YAAAA,KAAAA,IAAAA,UAAWK;IAC7B,MAAME,QAAqB;QACzBC,UAAUT,MAAMS,QAAQ;QACxBN;QACAC;IACF;IAEAR,OAAMc,SAAS,CAAC;QACd,IAAI,CAACP,WAAW;YACd;QACF;QAEA,MAAMQ,gBAAgBP,qBAAqBQ,OAAO;QAElD,4HAA4H;QAC5H,EAAE;QACF,SAAS;QACT,iCAAiC;QACjC,oBAAoB;QACpB,iFAAiF;QACjF,uCAAuC;QACvC,WAAW;QACX,iCAAiC;QACjC,gCAAgC;QAChC,WAAW;QACX,UAAU;QACV,EAAE;QACF,4JAA4J;QAC5J,0CAA0C;QAC1C,2BAA2B;QAC3B,wDAAwD;QACxD,yDAAyD;QACzD,EAAE;QACF,yDAAyD;QACzD,EAAE;QACF,kGAAkG;QAClG,EAAE;QACF,SAAS;QACT,8BAA8B;QAC9B,oBAAoB;QACpB,mCAAmC;QACnC,kCAAkC;QAClC,EAAE;QACF,yCAAyC;QACzC,aAAa;QACb,WAAW;QACX,UAAU;QACV,EAAE;QACF,wJAAwJ;QACxJ,EAAE;QACF,sFAAsF;QACtF,wDAAwD;QACxD,wDAAwD;QACxD,MAAMC,6BAA6BV,UAAUW,QAAQ,CAACH;QAEtD,IAAIA,iBAAiB,CAACE,4BAA4B;YAChDlB,oCAAAA,EAAiBQ,WAAWQ;YAE5B,OAAO;oBACLhB,gCAAAA,EAAiBQ,WAAWY;YAC9B;QACF;IACF,GAAG;QAACX;QAAsBD;KAAU;IAEpC,OAAOK;AACT,EAAE"}
@@ -12,7 +12,6 @@ Object.defineProperty(exports, "usePortalMountNode", {
12
12
  const _interop_require_wildcard = require("@swc/helpers/_/_interop_require_wildcard");
13
13
  const _react = /*#__PURE__*/ _interop_require_wildcard._(require("react"));
14
14
  const _reactsharedcontexts = require("@fluentui/react-shared-contexts");
15
- const _react1 = require("@griffel/react");
16
15
  const _reacttabster = require("@fluentui/react-tabster");
17
16
  const _usePortalMountNodeStylesstyles = require("./usePortalMountNodeStyles.styles.cjs");
18
17
  const useInsertionEffect = _react['useInsertion' + 'Effect'];
@@ -201,13 +200,12 @@ const usePortalMountNode = (options)=>{
201
200
  const mountNode = (0, _reactsharedcontexts.usePortalMountNode)();
202
201
  // eslint-disable-next-line @typescript-eslint/no-deprecated
203
202
  const focusVisibleRef = (0, _reacttabster.useFocusVisible)();
204
- const classes = (0, _usePortalMountNodeStylesstyles.usePortalMountNodeStylesStyles)();
205
203
  const themeClassName = (0, _reactsharedcontexts.useThemeClassName_unstable)();
206
204
  const factoryOptions = {
207
205
  dir,
208
206
  disabled: options.disabled,
209
207
  focusVisibleRef,
210
- className: (0, _react1.mergeClasses)(themeClassName, classes.root, options.className),
208
+ className: (0, _usePortalMountNodeStylesstyles.usePortalMountNodeClassName)(themeClassName, options.className),
211
209
  targetNode: mountNode !== null && mountNode !== void 0 ? mountNode : targetDocument === null || targetDocument === void 0 ? void 0 : targetDocument.body
212
210
  };
213
211
  return useElementFactory(factoryOptions);
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/components/Portal/usePortalMountNode.ts"],"sourcesContent":["'use client';\n\nimport * as React from 'react';\nimport {\n useThemeClassName_unstable as useThemeClassName,\n useFluent_unstable as useFluent,\n usePortalMountNode as usePortalMountNodeContext,\n} from '@fluentui/react-shared-contexts';\nimport { mergeClasses } from '@griffel/react';\nimport { useFocusVisible } from '@fluentui/react-tabster';\n\nimport { usePortalMountNodeStylesStyles } from './usePortalMountNodeStyles.styles';\n\nconst useInsertionEffect = (React as never)['useInsertion' + 'Effect'] as typeof React.useLayoutEffect | undefined;\n\nexport type UsePortalMountNodeOptions = {\n /**\n * Since hooks cannot be called conditionally use this flag to disable creating the node\n */\n disabled?: boolean;\n\n className?: string;\n};\n\ntype UseElementFactoryOptions = {\n className: string;\n dir: string;\n disabled: boolean | undefined;\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n focusVisibleRef: React.MutableRefObject<HTMLElement | null>;\n targetNode: HTMLElement | ShadowRoot | undefined;\n};\ntype UseElementFactory = (options: UseElementFactoryOptions) => HTMLDivElement | null;\n\n/**\n * Legacy element factory for React 17 and below. It's not safe for concurrent rendering.\n *\n * Creates a new element on a \"document.body\" to mount portals.\n */\nconst useLegacyElementFactory: UseElementFactory = options => {\n const { className, dir, focusVisibleRef, targetNode } = options;\n\n const targetElement = React.useMemo(() => {\n if (targetNode === undefined || options.disabled) {\n return null;\n }\n\n const element = targetNode.ownerDocument.createElement('div');\n targetNode.appendChild(element);\n\n return element;\n }, [targetNode, options.disabled]);\n\n // Heads up!\n // This useMemo() call is intentional for React 17 & below.\n //\n // We don't want to re-create the portal element when its attributes change. This also cannot not be done in an effect\n // because, changing the value of CSS variables after an initial mount will trigger interesting CSS side effects like\n // transitions.\n // eslint-disable-next-line react-hooks/void-use-memo\n React.useMemo(() => {\n if (!targetElement) {\n return;\n }\n\n // eslint-disable-next-line react-hooks/immutability\n targetElement.className = className;\n targetElement.setAttribute('dir', dir);\n targetElement.setAttribute('data-portal-node', 'true');\n\n // eslint-disable-next-line react-hooks/refs\n focusVisibleRef.current = targetElement;\n }, [className, dir, targetElement, focusVisibleRef]);\n\n React.useEffect(() => {\n return () => {\n targetElement?.remove();\n };\n }, [targetElement]);\n\n return targetElement;\n};\n\nconst initializeElementFactory = () => {\n let currentElement: HTMLDivElement | undefined = undefined;\n\n function get(targetRoot: HTMLElement | ShadowRoot, forceCreation: boolean): HTMLDivElement | undefined {\n if (currentElement) {\n return currentElement;\n }\n\n if (forceCreation) {\n currentElement = targetRoot.ownerDocument.createElement('div');\n targetRoot.appendChild(currentElement);\n }\n\n return currentElement;\n }\n\n function dispose() {\n if (currentElement) {\n currentElement.remove();\n currentElement = undefined;\n }\n }\n\n return {\n get,\n dispose,\n };\n};\n\n/**\n * This is a modern element factory for React 18 and above. It is safe for concurrent rendering.\n *\n * It abuses the fact that React will mount DOM once (unlike hooks), so by using a proxy we can intercept:\n * - the `remove()` method (we call it in `useEffect()`) and remove the element only when the portal is unmounted\n * - all other methods (and properties) will be called by React once a portal is mounted\n */\nconst useModernElementFactory: UseElementFactory = options => {\n 'use no memo'; // justified: compiler would optimize dispose — manual opt-out to preserve runtime behavior\n\n const { className, dir, focusVisibleRef, targetNode } = options;\n\n const [elementFactory] = React.useState(initializeElementFactory);\n\n const elementProxy = React.useMemo(() => {\n if (targetNode === undefined || options.disabled) {\n return null;\n }\n\n return new Proxy({} as HTMLDivElement, {\n get(_, property: keyof HTMLDivElement) {\n // Heads up!\n // `createPortal()` performs a check for `nodeType` property to determine if the mount node is a valid DOM node\n // before mounting the portal. We hardcode the value to `Node.ELEMENT_NODE` to pass this check and avoid\n // premature node creation\n if (property === 'nodeType') {\n // Can't use the `Node.ELEMENT_NODE` as it's a browser API and not available in all environments, e.g SSR\n return 1; // `Node.ELEMENT_NODE`\n }\n\n // Heads up!\n // We intercept the `remove()` method to remove the mount node only when portal has been unmounted already.\n if (property === 'remove') {\n const targetElement = elementFactory.get(targetNode, false);\n\n if (targetElement) {\n // If the mountElement has children, the portal is still mounted, otherwise we can dispose of it\n const portalHasNoChildren = targetElement.childNodes.length === 0;\n\n if (portalHasNoChildren) {\n elementFactory.dispose();\n }\n }\n\n return () => {\n // Always return a no-op function to avoid errors in the code\n };\n }\n\n const targetElement = elementFactory.get(targetNode, true);\n const targetProperty = targetElement ? targetElement[property] : undefined;\n\n if (typeof targetProperty === 'function') {\n return targetProperty.bind(targetElement);\n }\n\n return targetProperty;\n },\n\n set(_, property: keyof HTMLDivElement | '_virtual' | 'focusVisible', value) {\n const ignoredProperty = property === '_virtual' || property === 'focusVisible';\n\n // We should use the `elementFactory.get(targetNode, !ignoredProperty)`,\n // but TypeScript requires a literal `true` or `false` for the overload signature.\n // This workaround ensures the correct overload is called and avoids TypeScript errors.\n const targetElement = ignoredProperty\n ? elementFactory.get(targetNode, false)\n : elementFactory.get(targetNode, true);\n\n if (ignoredProperty && !targetElement) {\n // We ignore the `_virtual` and `focusVisible` properties to avoid conflicts with the proxy\n return true;\n }\n\n if (targetElement) {\n Object.assign(targetElement, { [property]: value });\n return true;\n }\n\n return false;\n },\n });\n }, [elementFactory, targetNode, options.disabled]);\n\n useInsertionEffect!(() => {\n if (!elementProxy) {\n return;\n }\n\n const classesToApply = className.split(' ').filter(Boolean);\n\n elementProxy.classList.add(...classesToApply);\n elementProxy.setAttribute('dir', dir);\n elementProxy.setAttribute('data-portal-node', 'true');\n\n focusVisibleRef.current = elementProxy;\n\n return () => {\n elementProxy.classList.remove(...classesToApply);\n elementProxy.removeAttribute('dir');\n };\n }, [className, dir, elementProxy, focusVisibleRef]);\n\n React.useEffect(() => {\n return () => {\n elementProxy?.remove();\n };\n }, [elementProxy]);\n\n return elementProxy;\n};\n\n/**\n * Element factory based on the React version.\n *\n * React 17 and below:\n * - useLegacyElementFactory\n *\n * React 18 and above:\n * - useModernElementFactory\n */\nconst useElementFactory = useInsertionEffect ? useModernElementFactory : useLegacyElementFactory;\n\n/**\n * Creates a new element on a \"document.body\" to mount portals.\n */\nexport const usePortalMountNode = (options: UsePortalMountNodeOptions): HTMLElement | null => {\n ('use no memo'); // justified: compiler would optimize usePortalMountNode — manual opt-out to preserve runtime behavior\n\n const { targetDocument, dir } = useFluent();\n const mountNode = usePortalMountNodeContext();\n\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n const focusVisibleRef = useFocusVisible<HTMLDivElement>() as React.MutableRefObject<HTMLElement | null>;\n const classes = usePortalMountNodeStylesStyles();\n const themeClassName = useThemeClassName();\n\n const factoryOptions: UseElementFactoryOptions = {\n dir,\n disabled: options.disabled,\n focusVisibleRef,\n\n className: mergeClasses(themeClassName, classes.root, options.className),\n targetNode: mountNode ?? targetDocument?.body,\n };\n\n return useElementFactory(factoryOptions);\n};\n"],"names":["React","useThemeClassName_unstable","useThemeClassName","useFluent_unstable","useFluent","usePortalMountNode","usePortalMountNodeContext","mergeClasses","useFocusVisible","usePortalMountNodeStylesStyles","useInsertionEffect","useLegacyElementFactory","options","className","dir","focusVisibleRef","targetNode","targetElement","useMemo","undefined","disabled","element","ownerDocument","createElement","appendChild","setAttribute","current","useEffect","remove","initializeElementFactory","currentElement","get","targetRoot","forceCreation","dispose","useModernElementFactory","elementFactory","useState","elementProxy","Proxy","_","property","portalHasNoChildren","childNodes","length","targetProperty","bind","set","value","ignoredProperty","Object","assign","classesToApply","split","filter","Boolean","classList","add","removeAttribute","useElementFactory","targetDocument","mountNode","classes","themeClassName","factoryOptions","root","body"],"mappings":"AAAA;;;;;;;;eA8OaK;;;;iEA5OU,QAAQ;qCAKxB,kCAAkC;wBACZ,iBAAiB;8BACd,0BAA0B;gDAEX,uCAAoC;AAEnF,MAAMK,qBAAsBV,MAAe,CAAC,iBAAiB,SAAS;AAqBtE;;;;CAIC,GACD,MAAMW,0BAA6CC,CAAAA;IACjD,MAAM,EAAEC,SAAS,EAAEC,GAAG,EAAEC,eAAe,EAAEC,UAAU,EAAE,GAAGJ;IAExD,MAAMK,gBAAgBjB,OAAMkB,OAAO,CAAC;QAClC,IAAIF,eAAeG,aAAaP,QAAQQ,QAAQ,EAAE;YAChD,OAAO;QACT;QAEA,MAAMC,UAAUL,WAAWM,aAAa,CAACC,aAAa,CAAC;QACvDP,WAAWQ,WAAW,CAACH;QAEvB,OAAOA;IACT,GAAG;QAACL;QAAYJ,QAAQQ,QAAQ;KAAC;IAEjC,YAAY;IACZ,2DAA2D;IAC3D,EAAE;IACF,sHAAsH;IACtH,qHAAqH;IACrH,eAAe;IACf,qDAAqD;IACrDpB,OAAMkB,OAAO,CAAC;QACZ,IAAI,CAACD,eAAe;YAClB;QACF;QAEA,oDAAoD;QACpDA,cAAcJ,SAAS,GAAGA;QAC1BI,cAAcQ,YAAY,CAAC,OAAOX;QAClCG,cAAcQ,YAAY,CAAC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AAS,CAAC5B,MAAM,IAAIwB;YACjCd,aAAaoB,eAAe,CAAC;QAC/B;IACF,GAAG;QAAC7C;QAAWC;QAAKwB;QAAcvB;KAAgB;IAElDf,OAAM2B,SAAS,CAAC;QACd,OAAO;YACLW,iBAAAA,QAAAA,iBAAAA,KAAAA,IAAAA,KAAAA,IAAAA,aAAcV,MAAM;QACtB;IACF,GAAG;QAACU;KAAa;IAEjB,OAAOA;AACT;AAEA;;;;;;;;CAQC,GACD,MAAMqB,oBAAoBjD,qBAAqByB,0BAA0BxB;AAKlE,2BAA2B,CAACC;IAChC,eAAgB,sGAAsG;IAEvH,MAAM,EAAEgD,cAAc,EAAE9C,GAAG,EAAE,OAAGV,uCAAAA;IAChC,MAAMyD,gBAAYvD,uCAAAA;IAElB,4DAA4D;IAC5D,MAAMS,kBAAkBP,iCAAAA;IACxB,MAAMsD,cAAUrD,8DAAAA;IAChB,MAAMsD,qBAAiB7D,+CAAAA;IAEvB,MAAM8D,iBAA2C;QAC/ClD;QACAM,UAAUR,QAAQQ,QAAQ;QAC1BL;QAEAF,WAAWN,wBAAAA,EAAawD,gBAAgBD,QAAQG,IAAI,EAAErD,QAAQC,SAAS;QACvEG,YAAY6C,cAAAA,QAAAA,cAAAA,KAAAA,IAAAA,YAAaD,mBAAAA,QAAAA,mBAAAA,KAAAA,IAAAA,KAAAA,IAAAA,eAAgBM,IAAI;IAC/C;IAEA,OAAOP,kBAAkBK;AAC3B,EAAE"}
1
+ {"version":3,"sources":["../../../src/components/Portal/usePortalMountNode.ts"],"sourcesContent":["'use client';\n\nimport * as React from 'react';\nimport {\n useThemeClassName_unstable as useThemeClassName,\n useFluent_unstable as useFluent,\n usePortalMountNode as usePortalMountNodeContext,\n} from '@fluentui/react-shared-contexts';\nimport { useFocusVisible } from '@fluentui/react-tabster';\n\nimport { usePortalMountNodeClassName } from './usePortalMountNodeStyles.styles';\n\nconst useInsertionEffect = (React as never)['useInsertion' + 'Effect'] as typeof React.useLayoutEffect | undefined;\n\nexport type UsePortalMountNodeOptions = {\n /**\n * Since hooks cannot be called conditionally use this flag to disable creating the node\n */\n disabled?: boolean;\n\n className?: string;\n};\n\ntype UseElementFactoryOptions = {\n className: string;\n dir: string;\n disabled: boolean | undefined;\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n focusVisibleRef: React.MutableRefObject<HTMLElement | null>;\n targetNode: HTMLElement | ShadowRoot | undefined;\n};\ntype UseElementFactory = (options: UseElementFactoryOptions) => HTMLDivElement | null;\n\n/**\n * Legacy element factory for React 17 and below. It's not safe for concurrent rendering.\n *\n * Creates a new element on a \"document.body\" to mount portals.\n */\nconst useLegacyElementFactory: UseElementFactory = options => {\n const { className, dir, focusVisibleRef, targetNode } = options;\n\n const targetElement = React.useMemo(() => {\n if (targetNode === undefined || options.disabled) {\n return null;\n }\n\n const element = targetNode.ownerDocument.createElement('div');\n targetNode.appendChild(element);\n\n return element;\n }, [targetNode, options.disabled]);\n\n // Heads up!\n // This useMemo() call is intentional for React 17 & below.\n //\n // We don't want to re-create the portal element when its attributes change. This also cannot not be done in an effect\n // because, changing the value of CSS variables after an initial mount will trigger interesting CSS side effects like\n // transitions.\n // eslint-disable-next-line react-hooks/void-use-memo\n React.useMemo(() => {\n if (!targetElement) {\n return;\n }\n\n // eslint-disable-next-line react-hooks/immutability\n targetElement.className = className;\n targetElement.setAttribute('dir', dir);\n targetElement.setAttribute('data-portal-node', 'true');\n\n // eslint-disable-next-line react-hooks/refs\n focusVisibleRef.current = targetElement;\n }, [className, dir, targetElement, focusVisibleRef]);\n\n React.useEffect(() => {\n return () => {\n targetElement?.remove();\n };\n }, [targetElement]);\n\n return targetElement;\n};\n\nconst initializeElementFactory = () => {\n let currentElement: HTMLDivElement | undefined = undefined;\n\n function get(targetRoot: HTMLElement | ShadowRoot, forceCreation: boolean): HTMLDivElement | undefined {\n if (currentElement) {\n return currentElement;\n }\n\n if (forceCreation) {\n currentElement = targetRoot.ownerDocument.createElement('div');\n targetRoot.appendChild(currentElement);\n }\n\n return currentElement;\n }\n\n function dispose() {\n if (currentElement) {\n currentElement.remove();\n currentElement = undefined;\n }\n }\n\n return {\n get,\n dispose,\n };\n};\n\n/**\n * This is a modern element factory for React 18 and above. It is safe for concurrent rendering.\n *\n * It abuses the fact that React will mount DOM once (unlike hooks), so by using a proxy we can intercept:\n * - the `remove()` method (we call it in `useEffect()`) and remove the element only when the portal is unmounted\n * - all other methods (and properties) will be called by React once a portal is mounted\n */\nconst useModernElementFactory: UseElementFactory = options => {\n 'use no memo'; // justified: compiler would optimize dispose — manual opt-out to preserve runtime behavior\n\n const { className, dir, focusVisibleRef, targetNode } = options;\n\n const [elementFactory] = React.useState(initializeElementFactory);\n\n const elementProxy = React.useMemo(() => {\n if (targetNode === undefined || options.disabled) {\n return null;\n }\n\n return new Proxy({} as HTMLDivElement, {\n get(_, property: keyof HTMLDivElement) {\n // Heads up!\n // `createPortal()` performs a check for `nodeType` property to determine if the mount node is a valid DOM node\n // before mounting the portal. We hardcode the value to `Node.ELEMENT_NODE` to pass this check and avoid\n // premature node creation\n if (property === 'nodeType') {\n // Can't use the `Node.ELEMENT_NODE` as it's a browser API and not available in all environments, e.g SSR\n return 1; // `Node.ELEMENT_NODE`\n }\n\n // Heads up!\n // We intercept the `remove()` method to remove the mount node only when portal has been unmounted already.\n if (property === 'remove') {\n const targetElement = elementFactory.get(targetNode, false);\n\n if (targetElement) {\n // If the mountElement has children, the portal is still mounted, otherwise we can dispose of it\n const portalHasNoChildren = targetElement.childNodes.length === 0;\n\n if (portalHasNoChildren) {\n elementFactory.dispose();\n }\n }\n\n return () => {\n // Always return a no-op function to avoid errors in the code\n };\n }\n\n const targetElement = elementFactory.get(targetNode, true);\n const targetProperty = targetElement ? targetElement[property] : undefined;\n\n if (typeof targetProperty === 'function') {\n return targetProperty.bind(targetElement);\n }\n\n return targetProperty;\n },\n\n set(_, property: keyof HTMLDivElement | '_virtual' | 'focusVisible', value) {\n const ignoredProperty = property === '_virtual' || property === 'focusVisible';\n\n // We should use the `elementFactory.get(targetNode, !ignoredProperty)`,\n // but TypeScript requires a literal `true` or `false` for the overload signature.\n // This workaround ensures the correct overload is called and avoids TypeScript errors.\n const targetElement = ignoredProperty\n ? elementFactory.get(targetNode, false)\n : elementFactory.get(targetNode, true);\n\n if (ignoredProperty && !targetElement) {\n // We ignore the `_virtual` and `focusVisible` properties to avoid conflicts with the proxy\n return true;\n }\n\n if (targetElement) {\n Object.assign(targetElement, { [property]: value });\n return true;\n }\n\n return false;\n },\n });\n }, [elementFactory, targetNode, options.disabled]);\n\n useInsertionEffect!(() => {\n if (!elementProxy) {\n return;\n }\n\n const classesToApply = className.split(' ').filter(Boolean);\n\n elementProxy.classList.add(...classesToApply);\n elementProxy.setAttribute('dir', dir);\n elementProxy.setAttribute('data-portal-node', 'true');\n\n focusVisibleRef.current = elementProxy;\n\n return () => {\n elementProxy.classList.remove(...classesToApply);\n elementProxy.removeAttribute('dir');\n };\n }, [className, dir, elementProxy, focusVisibleRef]);\n\n React.useEffect(() => {\n return () => {\n elementProxy?.remove();\n };\n }, [elementProxy]);\n\n return elementProxy;\n};\n\n/**\n * Element factory based on the React version.\n *\n * React 17 and below:\n * - useLegacyElementFactory\n *\n * React 18 and above:\n * - useModernElementFactory\n */\nconst useElementFactory = useInsertionEffect ? useModernElementFactory : useLegacyElementFactory;\n\n/**\n * Creates a new element on a \"document.body\" to mount portals.\n */\nexport const usePortalMountNode = (options: UsePortalMountNodeOptions): HTMLElement | null => {\n ('use no memo'); // justified: compiler would optimize usePortalMountNode — manual opt-out to preserve runtime behavior\n\n const { targetDocument, dir } = useFluent();\n const mountNode = usePortalMountNodeContext();\n\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n const focusVisibleRef = useFocusVisible<HTMLDivElement>() as React.MutableRefObject<HTMLElement | null>;\n const themeClassName = useThemeClassName();\n\n const factoryOptions: UseElementFactoryOptions = {\n dir,\n disabled: options.disabled,\n focusVisibleRef,\n\n className: usePortalMountNodeClassName(themeClassName, options.className),\n targetNode: mountNode ?? targetDocument?.body,\n };\n\n return useElementFactory(factoryOptions);\n};\n"],"names":["React","useThemeClassName_unstable","useThemeClassName","useFluent_unstable","useFluent","usePortalMountNode","usePortalMountNodeContext","useFocusVisible","usePortalMountNodeClassName","useInsertionEffect","useLegacyElementFactory","options","className","dir","focusVisibleRef","targetNode","targetElement","useMemo","undefined","disabled","element","ownerDocument","createElement","appendChild","setAttribute","current","useEffect","remove","initializeElementFactory","currentElement","get","targetRoot","forceCreation","dispose","useModernElementFactory","elementFactory","useState","elementProxy","Proxy","_","property","portalHasNoChildren","childNodes","length","targetProperty","bind","set","value","ignoredProperty","Object","assign","classesToApply","split","filter","Boolean","classList","add","removeAttribute","useElementFactory","targetDocument","mountNode","themeClassName","factoryOptions","body"],"mappings":"AAAA;;;;;;;;eA6OaK;;;;iEA3OU,QAAQ;qCAKxB,kCAAkC;8BACT,0BAA0B;gDAEd,uCAAoC;AAEhF,MAAMI,qBAAsBT,MAAe,CAAC,iBAAiB,SAAS;AAqBtE;;;;CAIC,GACD,MAAMU,0BAA6CC,CAAAA;IACjD,MAAM,EAAEC,SAAS,EAAEC,GAAG,EAAEC,eAAe,EAAEC,UAAU,EAAE,GAAGJ;IAExD,MAAMK,gBAAgBhB,OAAMiB,OAAO,CAAC;QAClC,IAAIF,eAAeG,aAAaP,QAAQQ,QAAQ,EAAE;YAChD,OAAO;QACT;QAEA,MAAMC,UAAUL,WAAWM,aAAa,CAACC,aAAa,CAAC;QACvDP,WAAWQ,WAAW,CAACH;QAEvB,OAAOA;IACT,GAAG;QAACL;QAAYJ,QAAQQ,QAAQ;KAAC;IAEjC,YAAY;IACZ,2DAA2D;IAC3D,EAAE;IACF,sHAAsH;IACtH,qHAAqH;IACrH,eAAe;IACf,qDAAqD;IACrDnB,OAAMiB,OAAO,CAAC;QACZ,IAAI,CAACD,eAAe;YAClB;QACF;QAEA,oDAAoD;QACpDA,cAAcJ,SAAS,GAAGA;QAC1BI,cAAcQ,YAAY,CAA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,GAAGY;QAE1B,OAAO;YACLA,aAAakB,SAAS,CAAC5B,MAAM,IAAIwB;YACjCd,aAAaoB,eAAe,CAAC;QAC/B;IACF,GAAG;QAAC7C;QAAWC;QAAKwB;QAAcvB;KAAgB;IAElDd,OAAM0B,SAAS,CAAC;QACd,OAAO;YACLW,iBAAAA,QAAAA,iBAAAA,KAAAA,IAAAA,KAAAA,IAAAA,aAAcV,MAAM;QACtB;IACF,GAAG;QAACU;KAAa;IAEjB,OAAOA;AACT;AAEA;;;;;;;;CAQC,GACD,MAAMqB,oBAAoBjD,qBAAqByB,0BAA0BxB;AAKlE,2BAA2B,CAACC;IAChC,eAAgB,sGAAsG;IAEvH,MAAM,EAAEgD,cAAc,EAAE9C,GAAG,EAAE,OAAGT,uCAAAA;IAChC,MAAMwD,YAAYtD,2CAAAA;IAElB,4DAA4D;IAC5D,MAAMQ,sBAAkBP,6BAAAA;IACxB,MAAMsD,qBAAiB3D,+CAAAA;IAEvB,MAAM4D,iBAA2C;QAC/CjD;QACAM,UAAUR,QAAQQ,QAAQ;QAC1BL;QAEAF,eAAWJ,2DAAAA,EAA4BqD,gBAAgBlD,QAAQC,SAAS;QACxEG,UAAU,EAAE6C,cAAAA,QAAAA,cAAAA,KAAAA,IAAAA,YAAaD,mBAAAA,QAAAA,mBAAAA,KAAAA,IAAAA,KAAAA,IAAAA,eAAgBI,IAAI;IAC/C;IAEA,OAAOL,kBAAkBI;AAC3B,EAAE"}
@@ -3,10 +3,10 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- Object.defineProperty(exports, "usePortalMountNodeStylesStyles", {
6
+ Object.defineProperty(exports, "usePortalMountNodeClassName", {
7
7
  enumerable: true,
8
8
  get: function() {
9
- return usePortalMountNodeStylesStyles;
9
+ return usePortalMountNodeClassName;
10
10
  }
11
11
  });
12
12
  const _react = require("@griffel/react");
@@ -33,3 +33,7 @@ const usePortalMountNodeStylesStyles = /*#__PURE__*/ (0, _react.__styles)({
33
33
  ".f494woh{z-index:1000000;}"
34
34
  ]
35
35
  });
36
+ const usePortalMountNodeClassName = (themeClassName, className)=>{
37
+ const styles = usePortalMountNodeStylesStyles();
38
+ return (0, _react.mergeClasses)(themeClassName, styles.root, className);
39
+ };
@@ -1 +1 @@
1
- {"version":3,"sources":["usePortalMountNodeStyles.styles.js"],"sourcesContent":["'use client';\nimport { makeStyles } from \"@griffel/react\";\nexport const usePortalMountNodeStylesStyles = makeStyles({\n root: {\n // Creates new stacking context to prevent z-index issues\n // https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_positioned_layout/Understanding_z-index/Stacking_context\n //\n // Also keeps a portal on top of a page to prevent scrollbars from appearing\n position: 'absolute',\n top: 0,\n left: 0,\n right: 0,\n zIndex: 1000000\n }\n});\n"],"names":["__styles","usePortalMountNodeStylesStyles","root","qhf8xq","Bhzewxz","oyh7mz","j35jbq","Bj3rh1h","d"],"mappings":"AAAA,YAAY;;;;;;;;;;;uBACe,gBAAgB;AACpC,MAAMC,8BAA8B,GAAA,WAAA,OAAGD,eAAA,EAAA;IAAAE,IAAA,EAAA;QAAAC,MAAA,EAAA;QAAAC,OAAA,EAAA;QAAAC,MAAA,EAAA;YAAA;YAAA;SAAA;QAAAC,MAAA,EAAA;YAAA;YAAA;SAAA;QAAAC,OAAA,EAAA;IAAA;AAAA,GAAA;IAAAC,CAAA,EAAA;QAAA;QAAA;QAAA;QAAA;QAAA;KAAA;AAAA,CAY7C,CAAC"}
1
+ {"version":3,"sources":["usePortalMountNodeStyles.styles.js"],"sourcesContent":["'use client';\nimport { makeStyles, mergeClasses } from \"@griffel/react\";\nconst usePortalMountNodeStylesStyles = makeStyles({\n root: {\n // Creates new stacking context to prevent z-index issues\n // https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_positioned_layout/Understanding_z-index/Stacking_context\n //\n // Also keeps a portal on top of a page to prevent scrollbars from appearing\n position: 'absolute',\n top: 0,\n left: 0,\n right: 0,\n zIndex: 1000000\n }\n});\nexport const usePortalMountNodeClassName = (themeClassName, className)=>{\n const styles = usePortalMountNodeStylesStyles();\n return mergeClasses(themeClassName, styles.root, className);\n};\n"],"names":["__styles","mergeClasses","usePortalMountNodeStylesStyles","root","qhf8xq","Bhzewxz","oyh7mz","j35jbq","Bj3rh1h","d","usePortalMountNodeClassName","themeClassName","className","styles"],"mappings":"AAAA,YAAY;;;;;;;;;;;uBAC6B,gBAAgB;AACzD,MAAME,8BAA8B,GAAA,WAAA,OAAGF,eAAA,EAAA;IAAAG,IAAA,EAAA;QAAAC,MAAA,EAAA;QAAAC,OAAA,EAAA;QAAAC,MAAA,EAAA;YAAA;YAAA;SAAA;QAAAC,MAAA,EAAA;YAAA;YAAA;SAAA;QAAAC,OAAA,EAAA;IAAA;AAAA,GAAA;IAAAC,CAAA,EAAA;QAAA;QAAA;QAAA;QAAA;QAAA;KAAA;AAAA,CAYtC,CAAC;AACK,MAAMC,2BAA2B,GAAGA,CAACC,cAAc,EAAEC,SAAS,KAAG;IACpE,MAAMC,MAAM,GAAGX,8BAA8B,CAAC,CAAC;IAC/C,WAAOD,mBAAY,EAACU,cAAc,EAAEE,MAAM,CAACV,IAAI,EAAES,SAAS,CAAC;AAC/D,CAAC"}
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", {
3
+ value: true
4
+ });
5
+ Object.defineProperty(exports, "usePortalMountNodeClassName", {
6
+ enumerable: true,
7
+ get: function() {
8
+ return usePortalMountNodeClassName;
9
+ }
10
+ });
11
+ const _interop_require_default = require("@swc/helpers/_/_interop_require_default");
12
+ const _Portalmodulecss = /*#__PURE__*/ _interop_require_default._(require("./Portal.module.css"));
13
+ const _clsx = require("clsx");
14
+ const usePortalMountNodeClassName = (themeClassName, className)=>{
15
+ return (0, _clsx.clsx)(themeClassName, _Portalmodulecss.default.root, className);
16
+ };
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/components/Portal/usePortalMountNodeStyles.styles.css.ts"],"sourcesContent":["import styles from './Portal.module.css';\nimport { clsx } from 'clsx';\n\nexport const usePortalMountNodeClassName = (themeClassName: string, className?: string): string => {\n return clsx(themeClassName, styles.root, className);\n};\n"],"names":["styles","clsx","usePortalMountNodeClassName","themeClassName","className","root"],"mappings":";;;;;;;;;;;0EAAmB,sBAAsB;sBACpB,OAAO;AAErB,MAAME,8BAA8B,CAACC,gBAAwBC;IAClE,WAAOH,UAAAA,EAAKE,gBAAgBH,wBAAAA,CAAOK,IAAI,EAAED;AAC3C,EAAE"}
@@ -3,10 +3,10 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- Object.defineProperty(exports, "usePortalMountNodeStylesStyles", {
6
+ Object.defineProperty(exports, "usePortalMountNodeClassName", {
7
7
  enumerable: true,
8
8
  get: function() {
9
- return usePortalMountNodeStylesStyles;
9
+ return usePortalMountNodeClassName;
10
10
  }
11
11
  });
12
12
  const _react = require("@griffel/react");
@@ -23,3 +23,7 @@ const usePortalMountNodeStylesStyles = (0, _react.makeStyles)({
23
23
  zIndex: 1000000
24
24
  }
25
25
  });
26
+ const usePortalMountNodeClassName = (themeClassName, className)=>{
27
+ const styles = usePortalMountNodeStylesStyles();
28
+ return (0, _react.mergeClasses)(themeClassName, styles.root, className);
29
+ };
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/components/Portal/usePortalMountNodeStyles.styles.ts"],"sourcesContent":["'use client';\n\nimport { makeStyles } from '@griffel/react';\n\nexport const usePortalMountNodeStylesStyles = makeStyles({\n root: {\n // Creates new stacking context to prevent z-index issues\n // https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_positioned_layout/Understanding_z-index/Stacking_context\n //\n // Also keeps a portal on top of a page to prevent scrollbars from appearing\n position: 'absolute',\n top: 0,\n left: 0,\n right: 0,\n\n zIndex: 1000000,\n },\n});\n"],"names":["makeStyles","usePortalMountNodeStylesStyles","root","position","top","left","right","zIndex"],"mappings":"AAAA;;;;;;;;;;;uBAE2B,iBAAiB;AAErC,MAAMC,qCAAiCD,iBAAAA,EAAW;IACvDE,MAAM;QACJ,yDAAyD;QACzD,gHAAgH;QAChH,EAAE;QACF,4EAA4E;QAC5EC,UAAU;QACVC,KAAK;QACLC,MAAM;QACNC,OAAO;QAEPC,QAAQ;IACV;AACF,GAAG"}
1
+ {"version":3,"sources":["../../../src/components/Portal/usePortalMountNodeStyles.styles.ts"],"sourcesContent":["'use client';\n\nimport { makeStyles, mergeClasses } from '@griffel/react';\n\nconst usePortalMountNodeStylesStyles = makeStyles({\n root: {\n // Creates new stacking context to prevent z-index issues\n // https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_positioned_layout/Understanding_z-index/Stacking_context\n //\n // Also keeps a portal on top of a page to prevent scrollbars from appearing\n position: 'absolute',\n top: 0,\n left: 0,\n right: 0,\n\n zIndex: 1000000,\n },\n});\n\nexport const usePortalMountNodeClassName = (themeClassName: string, className?: string): string => {\n const styles = usePortalMountNodeStylesStyles();\n\n return mergeClasses(themeClassName, styles.root, className);\n};\n"],"names":["makeStyles","mergeClasses","usePortalMountNodeStylesStyles","root","position","top","left","right","zIndex","usePortalMountNodeClassName","themeClassName","className","styles"],"mappings":"AAAA;;;;;;;;;;;uBAEyC,iBAAiB;AAE1D,MAAME,qCAAiCF,iBAAAA,EAAW;IAChDG,MAAM;QACJ,yDAAyD;QACzD,gHAAgH;QAChH,EAAE;QACF,4EAA4E;QAC5EC,UAAU;QACVC,KAAK;QACLC,MAAM;QACNC,OAAO;QAEPC,QAAQ;IACV;AACF;AAEO,MAAMC,8BAA8B,CAACC,gBAAwBC;IAClE,MAAMC,SAASV;IAEf,WAAOD,mBAAAA,EAAaS,gBAAgBE,OAAOT,IAAI,EAAEQ;AACnD,EAAE"}
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", {
3
+ value: true
4
+ });
5
+ Object.defineProperty(exports, "usePortalMountNodeClassName", {
6
+ enumerable: true,
7
+ get: function() {
8
+ return usePortalMountNodeClassName;
9
+ }
10
+ });
11
+ const _interop_require_default = require("@swc/helpers/_/_interop_require_default");
12
+ const _Portalmodulecss = /*#__PURE__*/ _interop_require_default._(require("./Portal.module.css"));
13
+ const _clsx = require("clsx");
14
+ const usePortalMountNodeClassName = (themeClassName, className)=>{
15
+ return (0, _clsx.clsx)(themeClassName, _Portalmodulecss.default.root, className);
16
+ };
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/components/Portal/usePortalMountNodeStyles.styles.css.ts"],"sourcesContent":["import styles from './Portal.module.css';\nimport { clsx } from 'clsx';\n\nexport const usePortalMountNodeClassName = (themeClassName: string, className?: string): string => {\n return clsx(themeClassName, styles.root, className);\n};\n"],"names":["styles","clsx","usePortalMountNodeClassName","themeClassName","className","root"],"mappings":";;;;;;;;;;;0EAAmB,sBAAsB;sBACpB,OAAO;AAErB,MAAME,8BAA8B,CAACC,gBAAwBC;IAClE,WAAOH,UAAAA,EAAKE,gBAAgBH,wBAAAA,CAAOK,IAAI,EAAED;AAC3C,EAAE"}
@@ -5,26 +5,26 @@ Object.defineProperty(exports, "__esModule", {
5
5
  function _export(target, all) {
6
6
  for(var name in all)Object.defineProperty(target, name, {
7
7
  enumerable: true,
8
- get: all[name]
8
+ get: Object.getOwnPropertyDescriptor(all, name).get
9
9
  });
10
10
  }
11
11
  _export(exports, {
12
- Portal: function() {
12
+ get Portal () {
13
13
  return _index.Portal;
14
14
  },
15
- elementContains: function() {
15
+ get elementContains () {
16
16
  return _reactutilities.elementContains;
17
17
  },
18
- renderPortal_unstable: function() {
18
+ get renderPortal_unstable () {
19
19
  return _index.renderPortal_unstable;
20
20
  },
21
- setVirtualParent: function() {
21
+ get setVirtualParent () {
22
22
  return _reactutilities.setVirtualParent;
23
23
  },
24
- toMountNodeProps: function() {
24
+ get toMountNodeProps () {
25
25
  return _toMountNodeProps.toMountNodeProps;
26
26
  },
27
- usePortal_unstable: function() {
27
+ get usePortal_unstable () {
28
28
  return _index.usePortal_unstable;
29
29
  }
30
30
  });
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/utils/toMountNodeProps.ts"],"sourcesContent":["import { isHTMLElement } from '@fluentui/react-utilities';\nimport type { PortalProps } from '../Portal';\n\n/**\n * The function that normalizes the `mountNode` prop into an object with element and className props.\n *\n * @param mountNode - an HTML element or an object with props\n */\nexport function toMountNodeProps(mountNode: PortalProps['mountNode']): {\n element?: HTMLElement | null;\n className?: string;\n} {\n if (isHTMLElement(mountNode)) {\n return { element: mountNode };\n }\n\n if (typeof mountNode === 'object') {\n if (mountNode === null) {\n return { element: null };\n }\n\n return mountNode;\n }\n\n return {};\n}\n"],"names":["isHTMLElement","toMountNodeProps","mountNode","element"],"mappings":";;;;+BAQgBC;;;;;;gCARc,4BAA4B;AAQnD,0BAA0BC,SAAmC;IAIlE,QAAIF,6BAAAA,EAAcE,YAAY;QAC5B,OAAO;YAAEC,SAASD;QAAU;IAC9B;IAEA,IAAI,OAAOA,cAAc,UAAU;QACjC,IAAIA,cAAc,MAAM;YACtB,OAAO;gBAAEC,SAAS;YAAK;QACzB;QAEA,OAAOD;IACT;IAEA,OAAO,CAAC;AACV"}
1
+ {"version":3,"sources":["../../src/utils/toMountNodeProps.ts"],"sourcesContent":["import { isHTMLElement } from '@fluentui/react-utilities';\nimport type { PortalProps } from '../Portal';\n\n/**\n * The function that normalizes the `mountNode` prop into an object with element and className props.\n *\n * @param mountNode - an HTML element or an object with props\n */\nexport function toMountNodeProps(mountNode: PortalProps['mountNode']): {\n element?: HTMLElement | null;\n className?: string;\n} {\n if (isHTMLElement(mountNode)) {\n return { element: mountNode };\n }\n\n if (typeof mountNode === 'object') {\n if (mountNode === null) {\n return { element: null };\n }\n\n return mountNode;\n }\n\n return {};\n}\n"],"names":["isHTMLElement","toMountNodeProps","mountNode","element"],"mappings":";;;;+BAQgBC;;;;;;gCARc,4BAA4B;AAQnD,0BAA0BC,SAAmC;IAIlE,QAAIF,6BAAAA,EAAcE,YAAY;QAC5B,OAAO;YAAEC,SAASD;QAAU;IAC9B;IAEA,IAAI,OAAOA,cAAc,UAAU;QACjC,IAAIA,cAAc,MAAM;YACtB,OAAO;gBAAEC,SAAS;YAAK;QACzB;QAEA,OAAOD;IACT;IAEA,OAAO,CAAC;AACV"}
package/package.json CHANGED
@@ -1,22 +1,25 @@
1
1
  {
2
2
  "name": "@fluentui/react-portal",
3
- "version": "9.74.7-experimental.cli-api.20261006-ccaa611d58.0",
3
+ "version": "9.75.0-experimental.css-modules.20261031-810ab07afb.0",
4
4
  "description": "A utility component that creates portals compatible with Fluent UI",
5
5
  "main": "lib-commonjs/index.cjs",
6
6
  "module": "lib/index.js",
7
7
  "typings": "./dist/index.d.ts",
8
- "sideEffects": false,
8
+ "sideEffects": [
9
+ "**/*.css"
10
+ ],
9
11
  "repository": {
10
12
  "type": "git",
11
13
  "url": "https://github.com/microsoft/fluentui"
12
14
  },
13
15
  "license": "MIT",
14
16
  "dependencies": {
15
- "@fluentui/react-shared-contexts": "9.74.7-experimental.cli-api.20261006-ccaa611d58.0",
16
- "@fluentui/react-tabster": "9.74.7-experimental.cli-api.20261006-ccaa611d58.0",
17
- "@fluentui/react-utilities": "9.74.7-experimental.cli-api.20261006-ccaa611d58.0",
17
+ "@fluentui/react-shared-contexts": "9.75.0-experimental.css-modules.20261031-810ab07afb.0",
18
+ "@fluentui/react-tabster": "9.75.0-experimental.css-modules.20261031-810ab07afb.0",
19
+ "@fluentui/react-utilities": "9.75.0-experimental.css-modules.20261031-810ab07afb.0",
18
20
  "@griffel/react": "^1.5.32",
19
- "@swc/helpers": "^0.5.1"
21
+ "@swc/helpers": "^0.5.1",
22
+ "clsx": "^2.1.1"
20
23
  },
21
24
  "peerDependencies": {
22
25
  "@types/react": ">=16.14.0 <20.0.0",
@@ -40,7 +43,6 @@
40
43
  "default": "./lib-commonjs/index.cjs"
41
44
  }
42
45
  },
43
- "./metadata.json": "./dist/metadata/index.json",
44
46
  "./package.json": "./package.json"
45
47
  },
46
48
  "files": [
@@ -48,9 +50,7 @@
48
50
  "dist/*.d.ts",
49
51
  "dist/*.d.cts",
50
52
  "lib",
51
- "lib-commonjs",
52
- "dist/metadata"
53
+ "lib-commonjs"
53
54
  ],
54
- "type": "module",
55
- "fluentuiCatalog": "./metadata.json"
55
+ "type": "module"
56
56
  }
@@ -1 +0,0 @@
1
- {"completeness":{"status":"complete"},"declarationInputs":[{"conditions":["types","import"],"fingerprint":{"algorithm":"sha256","value":"acaae36652346e6e081a605eed966b610baa5ee4c5478815dc525c43f973d594"},"path":"dist/index.d.ts"},{"conditions":["types","require"],"fingerprint":{"algorithm":"sha256","value":"acaae36652346e6e081a605eed966b610baa5ee4c5478815dc525c43f973d594"},"path":"dist/index.d.cts"}],"dependencyInputs":[{"conditions":["types","import"],"declarationFingerprint":{"algorithm":"sha256","value":"0ff1b165090b491f5e1407ae680b9a0bc3806dc56827ec85f93c57390491e732"},"declarationPath":"index.d.ts","entrypoint":".","package":{"name":"@types/react","version":"19.2.2"},"requested":"react"},{"conditions":["types","import"],"declarationFingerprint":{"algorithm":"sha256","value":"4fd3f3422b2d2a3dfd5cdd0f387b3a8ec45f006c6ea896a4cb41264c2100bb2c"},"declarationPath":"lib/lib.dom.d.ts","entrypoint":".","package":{"name":"typescript","version":"5.7.3"},"requested":"typescript"},{"conditions":["types","import"],"declarationFingerprint":{"algorithm":"sha256","value":"eb27b444251c8b068b168c5e0aa338fe952e84f28d9632a03f93ad292ca6b2f2"},"declarationPath":"dist/index.d.ts","entrypoint":".","package":{"name":"@fluentui/react-utilities","version":"9.74.7-experimental.cli-api.20261006-ccaa611d58.0"},"requested":"@fluentui/react-utilities"},{"conditions":["types","require"],"declarationFingerprint":{"algorithm":"sha256","value":"0ff1b165090b491f5e1407ae680b9a0bc3806dc56827ec85f93c57390491e732"},"declarationPath":"index.d.ts","entrypoint":".","package":{"name":"@types/react","version":"19.2.2"},"requested":"react"},{"conditions":["types","require"],"declarationFingerprint":{"algorithm":"sha256","value":"4fd3f3422b2d2a3dfd5cdd0f387b3a8ec45f006c6ea896a4cb41264c2100bb2c"},"declarationPath":"lib/lib.dom.d.ts","entrypoint":".","package":{"name":"typescript","version":"5.7.3"},"requested":"typescript"},{"conditions":["types","require"],"declarationFingerprint":{"algorithm":"sha256","value":"eb27b444251c8b068b168c5e0aa338fe952e84f28d9632a03f93ad292ca6b2f2"},"declarationPath":"dist/index.d.cts","entrypoint":".","package":{"name":"@fluentui/react-utilities","version":"9.74.7-experimental.cli-api.20261006-ccaa611d58.0"},"requested":"@fluentui/react-utilities"}],"diagnostics":[],"generator":{"name":"@fluentui/api-metadata","version":"0.0.0"},"kind":"api-record","package":{"name":"@fluentui/react-portal","version":"9.74.7-experimental.cli-api.20261006-ccaa611d58.0"},"recordId":"api:root","schema":{"major":1,"revision":5},"symbols":[{"classifications":[{"confidence":"heuristic","evidence":["no stronger product facet matched"],"facet":"utility"}],"declarations":[{"documentation":"A portal provides a way to render children into a DOM node\nthat exists outside the DOM hierarchy of the parent component.","id":"symbol:Portal:declaration:0","kind":"variable","namespaces":["value"],"signatures":[{"id":"signature:call:0","kind":"call","overload":0,"parameters":[{"name":"props","optional":false,"rest":false,"type":{"references":[],"text":"PortalProps"}}],"returnType":{"references":[],"text":"React_2.ReactNode | Promise<React_2.ReactNode>"},"typeParameters":[]}],"source":{"end":374,"file":"dist/index.d.ts","start":343},"type":{"references":[{"end":10,"start":0,"status":"resolved","target":{"entrypoint":".","export":"*","kind":"dependency","namespace":"type","package":"react"}},{"end":22,"start":11,"status":"resolved","target":{"kind":"local","symbol":"symbol:PortalProps"}}],"text":"React_2.FC<PortalProps>"}}],"effectiveType":{"members":[{"declarationPackages":["@types/react"],"documentation":"Used in debugging messages. You might want to set it\nexplicitly if you want to display a different name for\ndebugging purposes.","kind":"property","name":"displayName","optional":true,"readonly":false,"sources":[{"kind":"local","symbol":"symbol:Portal"}],"status":{"status":"complete"},"type":{"references":[],"text":"string"}},{"declarationPackages":["@types/react"],"deprecated":"Only kept in types for backwards compatibility. Will be removed in a future major release.","documentation":"Ignored by React.","kind":"property","name":"propTypes","optional":true,"readonly":false,"sources":[{"kind":"local","symbol":"symbol:Portal"}],"status":{"status":"complete"},"type":{"references":[],"text":"any"}}],"signatures":[{"id":"signature:call:0","kind":"call","overload":0,"parameters":[{"name":"props","optional":false,"rest":false,"type":{"references":[],"text":"PortalProps"}}],"returnType":{"references":[],"text":"React_2.ReactNode | Promise<React_2.ReactNode>"},"typeParameters":[]}],"status":{"reasons":["checker-rendered effective type expressions do not include semantic reference spans"],"status":"partial"},"type":{"references":[],"text":"React_2.FC<PortalProps>"}},"fingerprint":{"algorithm":"sha256","value":"b57f65897439e7beec634dbae210ace0527b813ea7d5996e94d668a73003db07"},"id":"symbol:Portal","name":"Portal","namespaces":["value"],"relationships":[],"type":{"references":[{"end":10,"start":0,"status":"resolved","target":{"entrypoint":".","export":"*","kind":"dependency","namespace":"type","package":"react"}},{"end":22,"start":11,"status":"resolved","target":{"kind":"local","symbol":"symbol:PortalProps"}}],"text":"React_2.FC<PortalProps>"}},{"classifications":[{"confidence":"heuristic","evidence":["export name ends with Props"],"facet":"props"}],"declarations":[{"id":"symbol:PortalProps:declaration:0","kind":"type-alias","namespaces":["type"],"relationships":[{"kind":"alias","type":{"references":[{"end":72,"start":55,"status":"resolved","target":{"entrypoint":".","export":"*","kind":"dependency","namespace":"type","package":"react"}},{"end":243,"start":232,"status":"resolved","target":{"entrypoint":".","export":"HTMLElement","kind":"dependency","namespace":"type","package":"typescript"}},{"end":284,"start":273,"status":"resolved","target":{"entrypoint":".","export":"HTMLElement","kind":"dependency","namespace":"type","package":"typescript"}}],"text":"{\n /**\n * React children\n */\n children?: React_2.ReactNode;\n /**\n * Where the portal children are mounted on DOM\n *\n * @default a new element on document.body without any styling\n */\n mountNode?: HTMLElement | null | {\n element?: HTMLElement | null;\n className?: string;\n };\n}"}},{"kind":"union","type":{"references":[{"end":11,"start":0,"status":"resolved","target":{"entrypoint":".","export":"HTMLElement","kind":"dependency","namespace":"type","package":"typescript"}},{"end":52,"start":41,"status":"resolved","target":{"entrypoint":".","export":"HTMLElement","kind":"dependency","namespace":"type","package":"typescript"}}],"text":"HTMLElement | null | {\n element?: HTMLElement | null;\n className?: string;\n }"}},{"kind":"union","type":{"references":[{"end":11,"start":0,"status":"resolved","target":{"entrypoint":".","export":"HTMLElement","kind":"dependency","namespace":"type","package":"typescript"}}],"text":"HTMLElement | null"}}],"source":{"end":741,"file":"dist/index.d.ts","start":377},"type":{"references":[{"end":86,"start":69,"status":"resolved","target":{"entrypoint":".","export":"*","kind":"dependency","namespace":"type","package":"react"}},{"end":257,"start":246,"status":"resolved","target":{"entrypoint":".","export":"HTMLElement","kind":"dependency","namespace":"type","package":"typescript"}},{"end":298,"start":287,"status":"resolved","target":{"entrypoint":".","export":"HTMLElement","kind":"dependency","namespace":"type","package":"typescript"}}],"text":"PortalProps = {\n /**\n * React children\n */\n children?: React_2.ReactNode;\n /**\n * Where the portal children are mounted on DOM\n *\n * @default a new element on document.body without any styling\n */\n mountNode?: HTMLElement | null | {\n element?: HTMLElement | null;\n className?: string;\n };\n}"}}],"effectiveType":{"members":[{"declarationPackages":["@fluentui/react-portal"],"documentation":"React children","kind":"property","name":"children","optional":true,"readonly":false,"sources":[{"kind":"local","symbol":"symbol:PortalProps"}],"status":{"status":"complete"},"type":{"references":[],"text":"React_2.ReactNode"}},{"declarationPackages":["@fluentui/react-portal"],"defaultValue":"a new element on document.body without any styling","documentation":"Where the portal children are mounted on DOM","kind":"property","name":"mountNode","optional":true,"readonly":false,"sources":[{"kind":"local","symbol":"symbol:PortalProps"}],"status":{"status":"complete"},"type":{"references":[],"text":"HTMLElement | { element?: HTMLElement | null; className?: string; }"}}],"signatures":[],"status":{"reasons":["checker-rendered effective type expressions do not include semantic reference spans"],"status":"partial"},"type":{"references":[],"text":"PortalProps"}},"fingerprint":{"algorithm":"sha256","value":"18511abf1227c96c988ecb91b638cc9cff07b8ff5135aa204b5371a806691369"},"id":"symbol:PortalProps","name":"PortalProps","namespaces":["type"],"relationships":[{"kind":"alias","type":{"references":[{"end":72,"start":55,"status":"resolved","target":{"entrypoint":".","export":"*","kind":"dependency","namespace":"type","package":"react"}},{"end":243,"start":232,"status":"resolved","target":{"entrypoint":".","export":"HTMLElement","kind":"dependency","namespace":"type","package":"typescript"}},{"end":284,"start":273,"status":"resolved","target":{"entrypoint":".","export":"HTMLElement","kind":"dependency","namespace":"type","package":"typescript"}}],"text":"{\n /**\n * React children\n */\n children?: React_2.ReactNode;\n /**\n * Where the portal children are mounted on DOM\n *\n * @default a new element on document.body without any styling\n */\n mountNode?: HTMLElement | null | {\n element?: HTMLElement | null;\n className?: string;\n };\n}"}},{"kind":"union","type":{"references":[{"end":11,"start":0,"status":"resolved","target":{"entrypoint":".","export":"HTMLElement","kind":"dependency","namespace":"type","package":"typescript"}},{"end":52,"start":41,"status":"resolved","target":{"entrypoint":".","export":"HTMLElement","kind":"dependency","namespace":"type","package":"typescript"}}],"text":"HTMLElement | null | {\n element?: HTMLElement | null;\n className?: string;\n }"}},{"kind":"union","type":{"references":[{"end":11,"start":0,"status":"resolved","target":{"entrypoint":".","export":"HTMLElement","kind":"dependency","namespace":"type","package":"typescript"}}],"text":"HTMLElement | null"}}],"type":{"references":[{"end":86,"start":69,"status":"resolved","target":{"entrypoint":".","export":"*","kind":"dependency","namespace":"type","package":"react"}},{"end":257,"start":246,"status":"resolved","target":{"entrypoint":".","export":"HTMLElement","kind":"dependency","namespace":"type","package":"typescript"}},{"end":298,"start":287,"status":"resolved","target":{"entrypoint":".","export":"HTMLElement","kind":"dependency","namespace":"type","package":"typescript"}}],"text":"PortalProps = {\n /**\n * React children\n */\n children?: React_2.ReactNode;\n /**\n * Where the portal children are mounted on DOM\n *\n * @default a new element on document.body without any styling\n */\n mountNode?: HTMLElement | null | {\n element?: HTMLElement | null;\n className?: string;\n };\n}"}},{"classifications":[{"confidence":"heuristic","evidence":["export name ends with State"],"facet":"state"}],"declarations":[{"id":"symbol:PortalState:declaration:0","kind":"type-alias","namespaces":["type"],"relationships":[{"kind":"alias","type":{"references":[{"end":16,"start":5,"status":"resolved","target":{"kind":"local","symbol":"symbol:PortalProps"}},{"end":60,"start":49,"status":"resolved","target":{"entrypoint":".","export":"HTMLElement","kind":"dependency","namespace":"type","package":"typescript"}},{"end":201,"start":177,"status":"resolved","target":{"entrypoint":".","export":"*","kind":"dependency","namespace":"type","package":"react"}},{"end":217,"start":202,"status":"resolved","target":{"entrypoint":".","export":"HTMLSpanElement","kind":"dependency","namespace":"type","package":"typescript"}}],"text":"Pick<PortalProps, 'children'> & {\n mountNode: HTMLElement | null | undefined;\n /**\n * Ref to the root span element as virtual parent\n */\n virtualParentRootRef: React_2.MutableRefObject<HTMLSpanElement | null>;\n}"}},{"kind":"intersection","type":{"references":[{"end":16,"start":5,"status":"resolved","target":{"kind":"local","symbol":"symbol:PortalProps"}},{"end":60,"start":49,"status":"resolved","target":{"entrypoint":".","export":"HTMLElement","kind":"dependency","namespace":"type","package":"typescript"}},{"end":201,"start":177,"status":"resolved","target":{"entrypoint":".","export":"*","kind":"dependency","namespace":"type","package":"react"}},{"end":217,"start":202,"status":"resolved","target":{"entrypoint":".","export":"HTMLSpanElement","kind":"dependency","namespace":"type","package":"typescript"}}],"text":"Pick<PortalProps, 'children'> & {\n mountNode: HTMLElement | null | undefined;\n /**\n * Ref to the root span element as virtual parent\n */\n virtualParentRootRef: React_2.MutableRefObject<HTMLSpanElement | null>;\n}"}},{"kind":"union","type":{"references":[{"end":11,"start":0,"status":"resolved","target":{"entrypoint":".","export":"HTMLElement","kind":"dependency","namespace":"type","package":"typescript"}}],"text":"HTMLElement | null | undefined"}},{"kind":"union","type":{"references":[{"end":15,"start":0,"status":"resolved","target":{"entrypoint":".","export":"HTMLSpanElement","kind":"dependency","namespace":"type","package":"typescript"}}],"text":"HTMLSpanElement | null"}}],"source":{"end":1006,"file":"dist/index.d.ts","start":743},"type":{"references":[{"end":30,"start":19,"status":"resolved","target":{"kind":"local","symbol":"symbol:PortalProps"}},{"end":74,"start":63,"status":"resolved","target":{"entrypoint":".","export":"HTMLElement","kind":"dependency","namespace":"type","package":"typescript"}},{"end":215,"start":191,"status":"resolved","target":{"entrypoint":".","export":"*","kind":"dependency","namespace":"type","package":"react"}},{"end":231,"start":216,"status":"resolved","target":{"entrypoint":".","export":"HTMLSpanElement","kind":"dependency","namespace":"type","package":"typescript"}}],"text":"PortalState = Pick<PortalProps, 'children'> & {\n mountNode: HTMLElement | null | undefined;\n /**\n * Ref to the root span element as virtual parent\n */\n virtualParentRootRef: React_2.MutableRefObject<HTMLSpanElement | null>;\n}"}}],"effectiveType":{"members":[{"declarationPackages":["@fluentui/react-portal"],"documentation":"React children","kind":"property","name":"children","optional":true,"readonly":false,"sources":[{"kind":"local","symbol":"symbol:PortalState"}],"status":{"status":"complete"},"type":{"references":[],"text":"React_2.ReactNode"}},{"declarationPackages":["@fluentui/react-portal"],"kind":"property","name":"mountNode","optional":false,"readonly":false,"sources":[{"kind":"local","symbol":"symbol:PortalState"}],"status":{"status":"complete"},"type":{"references":[],"text":"HTMLElement"}},{"declarationPackages":["@fluentui/react-portal"],"documentation":"Ref to the root span element as virtual parent","kind":"property","name":"virtualParentRootRef","optional":false,"readonly":false,"sources":[{"kind":"local","symbol":"symbol:PortalState"}],"status":{"status":"complete"},"type":{"references":[],"text":"React_2.MutableRefObject<HTMLSpanElement>"}}],"signatures":[],"status":{"reasons":["checker-rendered effective type expressions do not include semantic reference spans"],"status":"partial"},"type":{"references":[],"text":"PortalState"}},"fingerprint":{"algorithm":"sha256","value":"7b800cbb55138f5c9f86d49b83062f19cf6575a0cf177d53e65d4e32d4b0c270"},"id":"symbol:PortalState","name":"PortalState","namespaces":["type"],"relationships":[{"kind":"alias","type":{"references":[{"end":16,"start":5,"status":"resolved","target":{"kind":"local","symbol":"symbol:PortalProps"}},{"end":60,"start":49,"status":"resolved","target":{"entrypoint":".","export":"HTMLElement","kind":"dependency","namespace":"type","package":"typescript"}},{"end":201,"start":177,"status":"resolved","target":{"entrypoint":".","export":"*","kind":"dependency","namespace":"type","package":"react"}},{"end":217,"start":202,"status":"resolved","target":{"entrypoint":".","export":"HTMLSpanElement","kind":"dependency","namespace":"type","package":"typescript"}}],"text":"Pick<PortalProps, 'children'> & {\n mountNode: HTMLElement | null | undefined;\n /**\n * Ref to the root span element as virtual parent\n */\n virtualParentRootRef: React_2.MutableRefObject<HTMLSpanElement | null>;\n}"}},{"kind":"intersection","type":{"references":[{"end":16,"start":5,"status":"resolved","target":{"kind":"local","symbol":"symbol:PortalProps"}},{"end":60,"start":49,"status":"resolved","target":{"entrypoint":".","export":"HTMLElement","kind":"dependency","namespace":"type","package":"typescript"}},{"end":201,"start":177,"status":"resolved","target":{"entrypoint":".","export":"*","kind":"dependency","namespace":"type","package":"react"}},{"end":217,"start":202,"status":"resolved","target":{"entrypoint":".","export":"HTMLSpanElement","kind":"dependency","namespace":"type","package":"typescript"}}],"text":"Pick<PortalProps, 'children'> & {\n mountNode: HTMLElement | null | undefined;\n /**\n * Ref to the root span element as virtual parent\n */\n virtualParentRootRef: React_2.MutableRefObject<HTMLSpanElement | null>;\n}"}},{"kind":"union","type":{"references":[{"end":11,"start":0,"status":"resolved","target":{"entrypoint":".","export":"HTMLElement","kind":"dependency","namespace":"type","package":"typescript"}}],"text":"HTMLElement | null | undefined"}},{"kind":"union","type":{"references":[{"end":15,"start":0,"status":"resolved","target":{"entrypoint":".","export":"HTMLSpanElement","kind":"dependency","namespace":"type","package":"typescript"}}],"text":"HTMLSpanElement | null"}}],"type":{"references":[{"end":30,"start":19,"status":"resolved","target":{"kind":"local","symbol":"symbol:PortalProps"}},{"end":74,"start":63,"status":"resolved","target":{"entrypoint":".","export":"HTMLElement","kind":"dependency","namespace":"type","package":"typescript"}},{"end":215,"start":191,"status":"resolved","target":{"entrypoint":".","export":"*","kind":"dependency","namespace":"type","package":"react"}},{"end":231,"start":216,"status":"resolved","target":{"entrypoint":".","export":"HTMLSpanElement","kind":"dependency","namespace":"type","package":"typescript"}}],"text":"PortalState = Pick<PortalProps, 'children'> & {\n mountNode: HTMLElement | null | undefined;\n /**\n * Ref to the root span element as virtual parent\n */\n virtualParentRootRef: React_2.MutableRefObject<HTMLSpanElement | null>;\n}"}},{"classifications":[{"confidence":"heuristic","evidence":["export name follows the renderX convention"],"facet":"render"}],"declarations":[{"documentation":"Render the final JSX of Portal","id":"symbol:renderPortal_unstable:declaration:0","kind":"variable","namespaces":["value"],"signatures":[{"documentation":"Render the final JSX of Portal","id":"signature:call:0","kind":"call","overload":0,"parameters":[{"name":"state","optional":false,"rest":false,"type":{"references":[],"text":"PortalState"}}],"returnType":{"references":[],"text":"React_2.ReactElement<unknown, string | React_2.JSXElementConstructor<any>>"},"source":{"end":1138,"file":"dist/index.d.ts","start":1094},"typeParameters":[]}],"source":{"end":1138,"file":"dist/index.d.ts","start":1071},"type":{"references":[{"end":19,"start":8,"status":"resolved","target":{"kind":"local","symbol":"symbol:PortalState"}},{"end":44,"start":24,"status":"resolved","target":{"entrypoint":".","export":"*","kind":"dependency","namespace":"type","package":"react"}}],"text":"(state: PortalState) => React_2.ReactElement"}}],"effectiveType":{"members":[],"signatures":[{"documentation":"Render the final JSX of Portal","id":"signature:call:0","kind":"call","overload":0,"parameters":[{"name":"state","optional":false,"rest":false,"type":{"references":[],"text":"PortalState"}}],"returnType":{"references":[],"text":"React_2.ReactElement<unknown, string | React_2.JSXElementConstructor<any>>"},"source":{"end":1138,"file":"dist/index.d.ts","start":1094},"typeParameters":[]}],"status":{"reasons":["checker-rendered effective type expressions do not include semantic reference spans"],"status":"partial"},"type":{"references":[],"text":"(state: PortalState) => React_2.ReactElement"}},"fingerprint":{"algorithm":"sha256","value":"1856f425a8bb6108006b7c326f773c200aaceb494a4b70e98567baf03e9790e9"},"id":"symbol:renderPortal_unstable","name":"renderPortal_unstable","namespaces":["value"],"relationships":[],"type":{"references":[{"end":19,"start":8,"status":"resolved","target":{"kind":"local","symbol":"symbol:PortalState"}},{"end":44,"start":24,"status":"resolved","target":{"entrypoint":".","export":"*","kind":"dependency","namespace":"type","package":"react"}}],"text":"(state: PortalState) => React_2.ReactElement"}},{"classifications":[{"confidence":"heuristic","evidence":["export name ends with Props"],"facet":"props"}],"declarations":[{"documentation":"The function that normalizes the `mountNode` prop into an object with element and className props.","id":"symbol:toMountNodeProps:declaration:0","kind":"function","namespaces":["value"],"signatures":[{"documentation":"The function that normalizes the `mountNode` prop into an object with element and className props.","id":"signature:call:0","kind":"call","overload":0,"parameters":[{"name":"mountNode","optional":false,"rest":false,"type":{"references":[{"end":11,"start":0,"status":"resolved","target":{"kind":"local","symbol":"symbol:PortalProps"}}],"text":"PortalProps['mountNode']"}}],"returnType":{"references":[{"end":27,"start":16,"status":"resolved","target":{"entrypoint":".","export":"HTMLElement","kind":"dependency","namespace":"type","package":"typescript"}}],"text":"{\n element?: HTMLElement | null;\n className?: string;\n}"},"source":{"end":1486,"file":"dist/index.d.ts","start":1345},"typeParameters":[]}],"source":{"end":1486,"file":"dist/index.d.ts","start":1345}}],"effectiveType":{"members":[],"signatures":[{"documentation":"The function that normalizes the `mountNode` prop into an object with element and className props.","id":"signature:call:0","kind":"call","overload":0,"parameters":[{"name":"mountNode","optional":false,"rest":false,"type":{"references":[],"text":"HTMLElement | { element?: HTMLElement | null; className?: string; }"}}],"returnType":{"references":[],"text":"{ element?: HTMLElement | null; className?: string; }"},"source":{"end":1486,"file":"dist/index.d.ts","start":1345},"typeParameters":[]}],"status":{"reasons":["checker-rendered effective type expressions do not include semantic reference spans"],"status":"partial"},"type":{"references":[],"text":"(mountNode: PortalProps[\"mountNode\"]) => { element?: HTMLElement | null; className?: string; }"}},"fingerprint":{"algorithm":"sha256","value":"519903d6430044fbfa9f2468dc158b1096205488da579f9334e667d41d3a085b"},"id":"symbol:toMountNodeProps","name":"toMountNodeProps","namespaces":["value"],"relationships":[]},{"classifications":[{"confidence":"heuristic","evidence":["export name follows the useX hook convention"],"facet":"hook"}],"declarations":[{"documentation":"Create the state required to render Portal.\n\nThe returned state can be modified with hooks such as usePortalStyles, before being passed to renderPortal_unstable.","id":"symbol:usePortal_unstable:declaration:0","kind":"variable","namespaces":["value"],"signatures":[{"documentation":"Create the state required to render Portal.\n\nThe returned state can be modified with hooks such as usePortalStyles, before being passed to renderPortal_unstable.","id":"signature:call:0","kind":"call","overload":0,"parameters":[{"name":"props","optional":false,"rest":false,"type":{"references":[],"text":"PortalProps"}}],"returnType":{"references":[],"text":"PortalState"},"source":{"end":1798,"file":"dist/index.d.ts","start":1763},"typeParameters":[]}],"source":{"end":1798,"file":"dist/index.d.ts","start":1743},"type":{"references":[{"end":19,"start":8,"status":"resolved","target":{"kind":"local","symbol":"symbol:PortalProps"}},{"end":35,"start":24,"status":"resolved","target":{"kind":"local","symbol":"symbol:PortalState"}}],"text":"(props: PortalProps) => PortalState"}}],"effectiveType":{"members":[],"signatures":[{"documentation":"Create the state required to render Portal.\n\nThe returned state can be modified with hooks such as usePortalStyles, before being passed to renderPortal_unstable.","id":"signature:call:0","kind":"call","overload":0,"parameters":[{"name":"props","optional":false,"rest":false,"type":{"references":[],"text":"PortalProps"}}],"returnType":{"references":[],"text":"PortalState"},"source":{"end":1798,"file":"dist/index.d.ts","start":1763},"typeParameters":[]}],"status":{"reasons":["checker-rendered effective type expressions do not include semantic reference spans"],"status":"partial"},"type":{"references":[],"text":"(props: PortalProps) => PortalState"}},"fingerprint":{"algorithm":"sha256","value":"d76e623247521ac7c8830fbf572ff7784257c4b2636a7333db613bea34160887"},"id":"symbol:usePortal_unstable","name":"usePortal_unstable","namespaces":["value"],"relationships":[],"type":{"references":[{"end":19,"start":8,"status":"resolved","target":{"kind":"local","symbol":"symbol:PortalProps"}},{"end":35,"start":24,"status":"resolved","target":{"kind":"local","symbol":"symbol:PortalState"}}],"text":"(props: PortalProps) => PortalState"}}]}
@@ -1 +0,0 @@
1
- {"capabilities":{"api":{"status":"supported"},"effectiveTypes":{"reasons":["checker-derived type strings do not carry semantic reference spans"],"status":"partial"},"guidance":{"reasons":["guidance is outside the declaration generator MVP"],"status":"unsupported"},"search":{"reasons":["search is outside the declaration generator MVP"],"status":"unsupported"}},"completeness":{"api":{"status":"complete"},"guidance":{"reasons":["not generated"],"status":"unavailable"},"search":{"reasons":["not generated"],"status":"unavailable"}},"declarationInputs":[{"conditions":["types","require"],"fingerprint":{"algorithm":"sha256","value":"acaae36652346e6e081a605eed966b610baa5ee4c5478815dc525c43f973d594"},"path":"dist/index.d.cts"},{"conditions":["types","import"],"fingerprint":{"algorithm":"sha256","value":"acaae36652346e6e081a605eed966b610baa5ee4c5478815dc525c43f973d594"},"path":"dist/index.d.ts"}],"diagnostics":[],"exports":[{"classifications":[{"confidence":"heuristic","evidence":["no stronger product facet matched"],"facet":"utility"}],"conditions":["types","import"],"declarationInputs":["dist/index.d.ts"],"entrypoint":".","export":"elementContains","exportKind":"named","id":"route:root:elementContains:value:types-import","importedName":"elementContains","namespace":"value","target":{"buildPackage":{"name":"@fluentui/react-utilities","version":"9.74.7-experimental.cli-api.20261006-ccaa611d58.0"},"dependencyRole":"dependency","entrypoint":".","export":"elementContains","kind":"dependency","namespace":"value","package":"@fluentui/react-utilities","range":"9.74.7-experimental.cli-api.20261006-ccaa611d58.0","requested":"@fluentui/react-utilities"},"typeOnly":false},{"classifications":[{"confidence":"heuristic","evidence":["no stronger product facet matched"],"facet":"utility"}],"conditions":["types","require"],"declarationInputs":["dist/index.d.cts"],"entrypoint":".","export":"elementContains","exportKind":"named","id":"route:root:elementContains:value:types-require","importedName":"elementContains","namespace":"value","target":{"buildPackage":{"name":"@fluentui/react-utilities","version":"9.74.7-experimental.cli-api.20261006-ccaa611d58.0"},"dependencyRole":"dependency","entrypoint":".","export":"elementContains","kind":"dependency","namespace":"value","package":"@fluentui/react-utilities","range":"9.74.7-experimental.cli-api.20261006-ccaa611d58.0","requested":"@fluentui/react-utilities"},"typeOnly":false},{"classifications":[{"confidence":"heuristic","evidence":["no stronger product facet matched"],"facet":"utility"}],"conditions":["types","import"],"declarationInputs":["dist/index.d.ts"],"entrypoint":".","export":"Portal","exportKind":"named","id":"route:root:Portal:value:types-import","namespace":"value","target":{"kind":"local","record":"api:root","symbol":"symbol:Portal"},"typeOnly":false},{"classifications":[{"confidence":"heuristic","evidence":["no stronger product facet matched"],"facet":"utility"}],"conditions":["types","require"],"declarationInputs":["dist/index.d.cts"],"entrypoint":".","export":"Portal","exportKind":"named","id":"route:root:Portal:value:types-require","namespace":"value","target":{"kind":"local","record":"api:root","symbol":"symbol:Portal"},"typeOnly":false},{"classifications":[{"confidence":"heuristic","evidence":["export name ends with Props"],"facet":"props"}],"conditions":["types","import"],"declarationInputs":["dist/index.d.ts"],"entrypoint":".","export":"PortalProps","exportKind":"named","id":"route:root:PortalProps:type:types-import","namespace":"type","target":{"kind":"local","record":"api:root","symbol":"symbol:PortalProps"},"typeOnly":true},{"classifications":[{"confidence":"heuristic","evidence":["export name ends with Props"],"facet":"props"}],"conditions":["types","require"],"declarationInputs":["dist/index.d.cts"],"entrypoint":".","export":"PortalProps","exportKind":"named","id":"route:root:PortalProps:type:types-require","namespace":"type","target":{"kind":"local","record":"api:root","symbol":"symbol:PortalProps"},"typeOnly":true},{"classifications":[{"confidence":"heuristic","evidence":["export name ends with State"],"facet":"state"}],"conditions":["types","import"],"declarationInputs":["dist/index.d.ts"],"entrypoint":".","export":"PortalState","exportKind":"named","id":"route:root:PortalState:type:types-import","namespace":"type","target":{"kind":"local","record":"api:root","symbol":"symbol:PortalState"},"typeOnly":true},{"classifications":[{"confidence":"heuristic","evidence":["export name ends with State"],"facet":"state"}],"conditions":["types","require"],"declarationInputs":["dist/index.d.cts"],"entrypoint":".","export":"PortalState","exportKind":"named","id":"route:root:PortalState:type:types-require","namespace":"type","target":{"kind":"local","record":"api:root","symbol":"symbol:PortalState"},"typeOnly":true},{"classifications":[{"confidence":"heuristic","evidence":["export name follows the renderX convention"],"facet":"render"}],"conditions":["types","import"],"declarationInputs":["dist/index.d.ts"],"entrypoint":".","export":"renderPortal_unstable","exportKind":"named","id":"route:root:renderPortal_unstable:value:types-import","namespace":"value","target":{"kind":"local","record":"api:root","symbol":"symbol:renderPortal_unstable"},"typeOnly":false},{"classifications":[{"confidence":"heuristic","evidence":["export name follows the renderX convention"],"facet":"render"}],"conditions":["types","require"],"declarationInputs":["dist/index.d.cts"],"entrypoint":".","export":"renderPortal_unstable","exportKind":"named","id":"route:root:renderPortal_unstable:value:types-require","namespace":"value","target":{"kind":"local","record":"api:root","symbol":"symbol:renderPortal_unstable"},"typeOnly":false},{"classifications":[{"confidence":"heuristic","evidence":["no stronger product facet matched"],"facet":"utility"}],"conditions":["types","import"],"declarationInputs":["dist/index.d.ts"],"entrypoint":".","export":"setVirtualParent","exportKind":"named","id":"route:root:setVirtualParent:value:types-import","importedName":"setVirtualParent","namespace":"value","target":{"buildPackage":{"name":"@fluentui/react-utilities","version":"9.74.7-experimental.cli-api.20261006-ccaa611d58.0"},"dependencyRole":"dependency","entrypoint":".","export":"setVirtualParent","kind":"dependency","namespace":"value","package":"@fluentui/react-utilities","range":"9.74.7-experimental.cli-api.20261006-ccaa611d58.0","requested":"@fluentui/react-utilities"},"typeOnly":false},{"classifications":[{"confidence":"heuristic","evidence":["no stronger product facet matched"],"facet":"utility"}],"conditions":["types","require"],"declarationInputs":["dist/index.d.cts"],"entrypoint":".","export":"setVirtualParent","exportKind":"named","id":"route:root:setVirtualParent:value:types-require","importedName":"setVirtualParent","namespace":"value","target":{"buildPackage":{"name":"@fluentui/react-utilities","version":"9.74.7-experimental.cli-api.20261006-ccaa611d58.0"},"dependencyRole":"dependency","entrypoint":".","export":"setVirtualParent","kind":"dependency","namespace":"value","package":"@fluentui/react-utilities","range":"9.74.7-experimental.cli-api.20261006-ccaa611d58.0","requested":"@fluentui/react-utilities"},"typeOnly":false},{"classifications":[{"confidence":"heuristic","evidence":["export name ends with Props"],"facet":"props"}],"conditions":["types","import"],"declarationInputs":["dist/index.d.ts"],"entrypoint":".","export":"toMountNodeProps","exportKind":"named","id":"route:root:toMountNodeProps:value:types-import","namespace":"value","target":{"kind":"local","record":"api:root","symbol":"symbol:toMountNodeProps"},"typeOnly":false},{"classifications":[{"confidence":"heuristic","evidence":["export name ends with Props"],"facet":"props"}],"conditions":["types","require"],"declarationInputs":["dist/index.d.cts"],"entrypoint":".","export":"toMountNodeProps","exportKind":"named","id":"route:root:toMountNodeProps:value:types-require","namespace":"value","target":{"kind":"local","record":"api:root","symbol":"symbol:toMountNodeProps"},"typeOnly":false},{"classifications":[{"confidence":"heuristic","evidence":["export name follows the useX hook convention"],"facet":"hook"}],"conditions":["types","import"],"declarationInputs":["dist/index.d.ts"],"entrypoint":".","export":"usePortal_unstable","exportKind":"named","id":"route:root:usePortal_unstable:value:types-import","namespace":"value","target":{"kind":"local","record":"api:root","symbol":"symbol:usePortal_unstable"},"typeOnly":false},{"classifications":[{"confidence":"heuristic","evidence":["export name follows the useX hook convention"],"facet":"hook"}],"conditions":["types","require"],"declarationInputs":["dist/index.d.cts"],"entrypoint":".","export":"usePortal_unstable","exportKind":"named","id":"route:root:usePortal_unstable:value:types-require","namespace":"value","target":{"kind":"local","record":"api:root","symbol":"symbol:usePortal_unstable"},"typeOnly":false}],"generator":{"name":"@fluentui/api-metadata","version":"0.0.0"},"kind":"package-index","package":{"name":"@fluentui/react-portal","version":"9.74.7-experimental.cli-api.20261006-ccaa611d58.0"},"records":[{"fingerprint":{"algorithm":"sha256","value":"cb2bf980075f30f80784ed9b765c315581cd161b9c16ea42c97f629d38a47903"},"id":"api:root","kind":"api","path":"api/api-root.json","symbols":["symbol:Portal","symbol:PortalProps","symbol:PortalState","symbol:renderPortal_unstable","symbol:toMountNodeProps","symbol:usePortal_unstable"]}],"schema":{"major":1,"revision":5},"system":"fluent-v9"}