@fluentui/react-portal-compat 9.0.45 → 9.0.47
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.swcrc +30 -0
- package/CHANGELOG.json +61 -1
- package/CHANGELOG.md +25 -2
- package/lib/PortalCompatProvider.js +19 -15
- package/lib/PortalCompatProvider.js.map +1 -1
- package/lib/index.js.map +1 -1
- package/lib-amd/PortalCompatProvider.js +48 -21
- package/lib-amd/PortalCompatProvider.js.map +1 -1
- package/lib-amd/index.js +14 -4
- package/lib-amd/index.js.map +1 -1
- package/lib-commonjs/PortalCompatProvider.js +58 -50
- package/lib-commonjs/PortalCompatProvider.js.map +1 -1
- package/lib-commonjs/index.js +6 -8
- package/lib-commonjs/index.js.map +1 -1
- package/package.json +9 -8
package/.swcrc
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json.schemastore.org/swcrc",
|
|
3
|
+
"exclude": [
|
|
4
|
+
"/testing",
|
|
5
|
+
"/**/*.cy.ts",
|
|
6
|
+
"/**/*.cy.tsx",
|
|
7
|
+
"/**/*.spec.ts",
|
|
8
|
+
"/**/*.spec.tsx",
|
|
9
|
+
"/**/*.test.ts",
|
|
10
|
+
"/**/*.test.tsx"
|
|
11
|
+
],
|
|
12
|
+
"jsc": {
|
|
13
|
+
"parser": {
|
|
14
|
+
"syntax": "typescript",
|
|
15
|
+
"tsx": true,
|
|
16
|
+
"decorators": false,
|
|
17
|
+
"dynamicImport": false
|
|
18
|
+
},
|
|
19
|
+
"externalHelpers": true,
|
|
20
|
+
"transform": {
|
|
21
|
+
"react": {
|
|
22
|
+
"runtime": "classic",
|
|
23
|
+
"useSpread": true
|
|
24
|
+
}
|
|
25
|
+
},
|
|
26
|
+
"target": "es2019"
|
|
27
|
+
},
|
|
28
|
+
"minify": false,
|
|
29
|
+
"sourceMaps": true
|
|
30
|
+
}
|
package/CHANGELOG.json
CHANGED
|
@@ -2,7 +2,67 @@
|
|
|
2
2
|
"name": "@fluentui/react-portal-compat",
|
|
3
3
|
"entries": [
|
|
4
4
|
{
|
|
5
|
-
"date": "
|
|
5
|
+
"date": "Fri, 24 Mar 2023 10:15:04 GMT",
|
|
6
|
+
"tag": "@fluentui/react-portal-compat_v9.0.47",
|
|
7
|
+
"version": "9.0.47",
|
|
8
|
+
"comments": {
|
|
9
|
+
"patch": [
|
|
10
|
+
{
|
|
11
|
+
"author": "beachball",
|
|
12
|
+
"package": "@fluentui/react-portal-compat",
|
|
13
|
+
"comment": "Bump @fluentui/react-components to v9.18.4",
|
|
14
|
+
"commit": "8253bc378281d56e6b4e3a454c185e2ef3672d1d"
|
|
15
|
+
}
|
|
16
|
+
]
|
|
17
|
+
}
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
"date": "Tue, 21 Mar 2023 21:23:44 GMT",
|
|
21
|
+
"tag": "@fluentui/react-portal-compat_v9.0.46",
|
|
22
|
+
"version": "9.0.46",
|
|
23
|
+
"comments": {
|
|
24
|
+
"patch": [
|
|
25
|
+
{
|
|
26
|
+
"author": "tristan.watanabe@gmail.com",
|
|
27
|
+
"package": "@fluentui/react-portal-compat",
|
|
28
|
+
"commit": "2fac1a139149bd13b76b1306207bc988dca9c72c",
|
|
29
|
+
"comment": "chore: migrate to swc transpilation approach."
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
"author": "tristan.watanabe@gmail.com",
|
|
33
|
+
"package": "@fluentui/react-portal-compat",
|
|
34
|
+
"commit": "ead1c6d4c2ac3f3596b62b8cbc07b0a03041f11f",
|
|
35
|
+
"comment": "fix: add node field to package.json exports map."
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
"author": "beachball",
|
|
39
|
+
"package": "@fluentui/react-portal-compat",
|
|
40
|
+
"comment": "Bump @fluentui/react-portal-compat-context to v9.0.5",
|
|
41
|
+
"commit": "b7a26f6263c80e3253c6b8338c33b73bae33e2b5"
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
"author": "beachball",
|
|
45
|
+
"package": "@fluentui/react-portal-compat",
|
|
46
|
+
"comment": "Bump @fluentui/react-tabster to v9.6.1",
|
|
47
|
+
"commit": "b7a26f6263c80e3253c6b8338c33b73bae33e2b5"
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
"author": "beachball",
|
|
51
|
+
"package": "@fluentui/react-portal-compat",
|
|
52
|
+
"comment": "Bump @fluentui/react-components to v9.18.3",
|
|
53
|
+
"commit": "b7a26f6263c80e3253c6b8338c33b73bae33e2b5"
|
|
54
|
+
},
|
|
55
|
+
{
|
|
56
|
+
"author": "beachball",
|
|
57
|
+
"package": "@fluentui/react-portal-compat",
|
|
58
|
+
"comment": "Bump @fluentui/react-shared-contexts to v9.3.2",
|
|
59
|
+
"commit": "b7a26f6263c80e3253c6b8338c33b73bae33e2b5"
|
|
60
|
+
}
|
|
61
|
+
]
|
|
62
|
+
}
|
|
63
|
+
},
|
|
64
|
+
{
|
|
65
|
+
"date": "Thu, 16 Mar 2023 14:36:59 GMT",
|
|
6
66
|
"tag": "@fluentui/react-portal-compat_v9.0.45",
|
|
7
67
|
"version": "9.0.45",
|
|
8
68
|
"comments": {
|
package/CHANGELOG.md
CHANGED
|
@@ -1,12 +1,35 @@
|
|
|
1
1
|
# Change Log - @fluentui/react-portal-compat
|
|
2
2
|
|
|
3
|
-
This log was last generated on
|
|
3
|
+
This log was last generated on Fri, 24 Mar 2023 10:15:04 GMT and should not be manually modified.
|
|
4
4
|
|
|
5
5
|
<!-- Start content -->
|
|
6
6
|
|
|
7
|
+
## [9.0.47](https://github.com/microsoft/fluentui/tree/@fluentui/react-portal-compat_v9.0.47)
|
|
8
|
+
|
|
9
|
+
Fri, 24 Mar 2023 10:15:04 GMT
|
|
10
|
+
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-portal-compat_v9.0.46..@fluentui/react-portal-compat_v9.0.47)
|
|
11
|
+
|
|
12
|
+
### Patches
|
|
13
|
+
|
|
14
|
+
- Bump @fluentui/react-components to v9.18.4 ([PR #27317](https://github.com/microsoft/fluentui/pull/27317) by beachball)
|
|
15
|
+
|
|
16
|
+
## [9.0.46](https://github.com/microsoft/fluentui/tree/@fluentui/react-portal-compat_v9.0.46)
|
|
17
|
+
|
|
18
|
+
Tue, 21 Mar 2023 21:23:44 GMT
|
|
19
|
+
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-portal-compat_v9.0.45..@fluentui/react-portal-compat_v9.0.46)
|
|
20
|
+
|
|
21
|
+
### Patches
|
|
22
|
+
|
|
23
|
+
- chore: migrate to swc transpilation approach. ([PR #27250](https://github.com/microsoft/fluentui/pull/27250) by tristan.watanabe@gmail.com)
|
|
24
|
+
- fix: add node field to package.json exports map. ([PR #27154](https://github.com/microsoft/fluentui/pull/27154) by tristan.watanabe@gmail.com)
|
|
25
|
+
- Bump @fluentui/react-portal-compat-context to v9.0.5 ([PR #27271](https://github.com/microsoft/fluentui/pull/27271) by beachball)
|
|
26
|
+
- Bump @fluentui/react-tabster to v9.6.1 ([PR #27271](https://github.com/microsoft/fluentui/pull/27271) by beachball)
|
|
27
|
+
- Bump @fluentui/react-components to v9.18.3 ([PR #27271](https://github.com/microsoft/fluentui/pull/27271) by beachball)
|
|
28
|
+
- Bump @fluentui/react-shared-contexts to v9.3.2 ([PR #27271](https://github.com/microsoft/fluentui/pull/27271) by beachball)
|
|
29
|
+
|
|
7
30
|
## [9.0.45](https://github.com/microsoft/fluentui/tree/@fluentui/react-portal-compat_v9.0.45)
|
|
8
31
|
|
|
9
|
-
Thu, 16 Mar 2023 14:
|
|
32
|
+
Thu, 16 Mar 2023 14:36:59 GMT
|
|
10
33
|
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-portal-compat_v9.0.44..@fluentui/react-portal-compat_v9.0.45)
|
|
11
34
|
|
|
12
35
|
### Patches
|
|
@@ -2,28 +2,28 @@ import * as React from 'react';
|
|
|
2
2
|
import { fluentProviderClassNames, useThemeClassName } from '@fluentui/react-components';
|
|
3
3
|
import { PortalCompatContextProvider } from '@fluentui/react-portal-compat-context';
|
|
4
4
|
import { applyFocusVisiblePolyfill } from '@fluentui/react-tabster';
|
|
5
|
-
|
|
6
|
-
export
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
5
|
+
const CLASS_NAME_REGEX = /*#__PURE__*/new RegExp(`(${fluentProviderClassNames.root}\\d+)`);
|
|
6
|
+
export const PortalCompatProvider = props => {
|
|
7
|
+
const {
|
|
8
|
+
children
|
|
9
|
+
} = props;
|
|
10
|
+
const themeClassName = useThemeClassName();
|
|
11
|
+
const cssVariablesClassName = React.useMemo(
|
|
10
12
|
// "themeClassName" may contain multiple classes while we want to add only a class that hosts CSS variables
|
|
11
13
|
// Keep in sync with "packages/react-provider/src/components/FluentProvider/useFluentProviderThemeStyleTag.ts"
|
|
12
|
-
|
|
13
|
-
var
|
|
14
|
-
return (
|
|
14
|
+
() => {
|
|
15
|
+
var _themeClassName_match;
|
|
16
|
+
return (_themeClassName_match = themeClassName.match(CLASS_NAME_REGEX)) === null || _themeClassName_match === void 0 ? void 0 : _themeClassName_match[1];
|
|
15
17
|
}, [themeClassName]);
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
return undefined;
|
|
19
|
-
};
|
|
18
|
+
const registerPortalEl = React.useCallback(element => {
|
|
19
|
+
let disposeFocusVisiblePolyfill = () => undefined;
|
|
20
20
|
if (cssVariablesClassName) {
|
|
21
21
|
element.classList.add(cssVariablesClassName);
|
|
22
22
|
if (element.ownerDocument.defaultView) {
|
|
23
23
|
disposeFocusVisiblePolyfill = applyFocusVisiblePolyfill(element, element.ownerDocument.defaultView);
|
|
24
24
|
}
|
|
25
25
|
}
|
|
26
|
-
return
|
|
26
|
+
return () => {
|
|
27
27
|
if (cssVariablesClassName) {
|
|
28
28
|
element.classList.remove(cssVariablesClassName);
|
|
29
29
|
}
|
|
@@ -33,10 +33,14 @@ export var PortalCompatProvider = function (props) {
|
|
|
33
33
|
if (process.env.NODE_ENV !== 'production') {
|
|
34
34
|
// This if statement technically breaks the rules of hooks, but ENV variables never change during app lifecycle
|
|
35
35
|
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
36
|
-
React.useEffect(
|
|
36
|
+
React.useEffect(() => {
|
|
37
37
|
if (themeClassName === '') {
|
|
38
38
|
// eslint-disable-next-line no-console
|
|
39
|
-
console.warn(
|
|
39
|
+
console.warn(`
|
|
40
|
+
PortalCompatProvider: "useThemeClassName()" hook returned an empty string
|
|
41
|
+
=============================================
|
|
42
|
+
Make sure that PortalCompatProvider is rendered inside FluentProvider as a child.
|
|
43
|
+
`);
|
|
40
44
|
}
|
|
41
45
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
42
46
|
}, []);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["React","fluentProviderClassNames","useThemeClassName","PortalCompatContextProvider","applyFocusVisiblePolyfill","CLASS_NAME_REGEX","RegExp","root","PortalCompatProvider","props","children","themeClassName","cssVariablesClassName","useMemo","
|
|
1
|
+
{"version":3,"names":["React","fluentProviderClassNames","useThemeClassName","PortalCompatContextProvider","applyFocusVisiblePolyfill","CLASS_NAME_REGEX","RegExp","root","PortalCompatProvider","props","children","themeClassName","cssVariablesClassName","useMemo","_themeClassName_match","match","registerPortalEl","useCallback","element","disposeFocusVisiblePolyfill","undefined","classList","add","ownerDocument","defaultView","remove","process","env","NODE_ENV","useEffect","console","warn","createElement","value"],"sources":["../src/PortalCompatProvider.tsx"],"sourcesContent":["import * as React from 'react';\nimport { fluentProviderClassNames, useThemeClassName } from '@fluentui/react-components';\nimport { PortalCompatContextProvider } from '@fluentui/react-portal-compat-context';\nimport { applyFocusVisiblePolyfill } from '@fluentui/react-tabster';\n\nimport type { RegisterPortalFn } from '@fluentui/react-portal-compat-context';\n\nconst CLASS_NAME_REGEX = new RegExp(`(${fluentProviderClassNames.root}\\\\d+)`);\n\nexport const PortalCompatProvider: React.FC = props => {\n const { children } = props;\n\n const themeClassName = useThemeClassName();\n const cssVariablesClassName = React.useMemo<string | undefined>(\n // \"themeClassName\" may contain multiple classes while we want to add only a class that hosts CSS variables\n // Keep in sync with \"packages/react-provider/src/components/FluentProvider/useFluentProviderThemeStyleTag.ts\"\n () => themeClassName.match(CLASS_NAME_REGEX)?.[1],\n [themeClassName],\n );\n\n const registerPortalEl = React.useCallback<RegisterPortalFn>(\n element => {\n let disposeFocusVisiblePolyfill: () => void = () => undefined;\n if (cssVariablesClassName) {\n element.classList.add(cssVariablesClassName);\n if (element.ownerDocument.defaultView) {\n disposeFocusVisiblePolyfill = applyFocusVisiblePolyfill(element, element.ownerDocument.defaultView);\n }\n }\n\n return () => {\n if (cssVariablesClassName) {\n element.classList.remove(cssVariablesClassName);\n }\n disposeFocusVisiblePolyfill();\n };\n },\n [cssVariablesClassName],\n );\n\n if (process.env.NODE_ENV !== 'production') {\n // This if statement technically breaks the rules of hooks, but ENV variables never change during app lifecycle\n // eslint-disable-next-line react-hooks/rules-of-hooks\n React.useEffect(() => {\n if (themeClassName === '') {\n // eslint-disable-next-line no-console\n console.warn(`\n PortalCompatProvider: \"useThemeClassName()\" hook returned an empty string\n =============================================\n Make sure that PortalCompatProvider is rendered inside FluentProvider as a child.\n `);\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, []);\n }\n\n return <PortalCompatContextProvider value={registerPortalEl}>{children}</PortalCompatContextProvider>;\n};\n"],"mappings":"AAAA,YAAYA,KAAA,MAAW;AACvB,SAASC,wBAAwB,EAAEC,iBAAiB,QAAQ;AAC5D,SAASC,2BAA2B,QAAQ;AAC5C,SAASC,yBAAyB,QAAQ;AAI1C,MAAMC,gBAAA,gBAAmB,IAAIC,MAAA,CAAQ,IAAGL,wBAAA,CAAyBM,IAAK,OAAM;AAE5E,OAAO,MAAMC,oBAAA,GAAiCC,KAAA,IAAS;EACrD,MAAM;IAAEC;EAAQ,CAAE,GAAGD,KAAA;EAErB,MAAME,cAAA,GAAiBT,iBAAA;EACvB,MAAMU,qBAAA,GAAwBZ,KAAA,CAAMa,OAAO;EACzC;EACA;EACA;QAAMC,qBAAA;IAAA,QAAAA,qBAAA,GAAAH,cAAA,CAAeI,KAAK,CAACV,gBAAA,eAArBS,qBAAA,uBAAAA,qBAAwC,CAAC,EAAE;KACjD,CAACH,cAAA,CAAe;EAGlB,MAAMK,gBAAA,GAAmBhB,KAAA,CAAMiB,WAAW,CACxCC,OAAA,IAAW;IACT,IAAIC,2BAAA,GAA0CA,CAAA,KAAMC,SAAA;IACpD,IAAIR,qBAAA,EAAuB;MACzBM,OAAA,CAAQG,SAAS,CAACC,GAAG,CAACV,qBAAA;MACtB,IAAIM,OAAA,CAAQK,aAAa,CAACC,WAAW,EAAE;QACrCL,2BAAA,GAA8Bf,yBAAA,CAA0Bc,OAAA,EAASA,OAAA,CAAQK,aAAa,CAACC,WAAW;MACpG;IACF;IAEA,OAAO,MAAM;MACX,IAAIZ,qBAAA,EAAuB;QACzBM,OAAA,CAAQG,SAAS,CAACI,MAAM,CAACb,qBAAA;MAC3B;MACAO,2BAAA;IACF;EACF,GACA,CAACP,qBAAA,CAAsB;EAGzB,IAAIc,OAAA,CAAQC,GAAG,CAACC,QAAQ,KAAK,cAAc;IACzC;IACA;IACA5B,KAAA,CAAM6B,SAAS,CAAC,MAAM;MACpB,IAAIlB,cAAA,KAAmB,IAAI;QACzB;QACAmB,OAAA,CAAQC,IAAI,CAAE;;;;OAIf;MACD;MACA;IACF,GAAG,EAAE;EACP;EAEA,oBAAO/B,KAAA,CAAAgC,aAAA,CAAC7B,2BAAA;IAA4B8B,KAAA,EAAOjB;KAAmBN,QAAA;AAChE"}
|
package/lib/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"names":["PortalCompatProvider"],"sources":["../src/index.ts"],"sourcesContent":["export { PortalCompatProvider } from './PortalCompatProvider';\n"],"mappings":"AAAA,SAASA,oBAAoB,QAAQ"}
|
|
@@ -1,43 +1,70 @@
|
|
|
1
|
-
define([
|
|
1
|
+
define([
|
|
2
|
+
"require",
|
|
3
|
+
"exports",
|
|
4
|
+
"@swc/helpers/src/_interop_require_wildcard.mjs",
|
|
5
|
+
"react",
|
|
6
|
+
"@fluentui/react-components",
|
|
7
|
+
"@fluentui/react-portal-compat-context",
|
|
8
|
+
"@fluentui/react-tabster"
|
|
9
|
+
], function(require, exports, _interopRequireWildcard, _react, _reactComponents, _reactPortalCompatContext, _reactTabster) {
|
|
2
10
|
"use strict";
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
+
Object.defineProperty(exports, "__esModule", {
|
|
12
|
+
value: true
|
|
13
|
+
});
|
|
14
|
+
Object.defineProperty(exports, "PortalCompatProvider", {
|
|
15
|
+
enumerable: true,
|
|
16
|
+
get: ()=>PortalCompatProvider
|
|
17
|
+
});
|
|
18
|
+
_interopRequireWildcard = _interopRequireWildcard.default;
|
|
19
|
+
_react = /*#__PURE__*/ _interopRequireWildcard(_react);
|
|
20
|
+
const CLASS_NAME_REGEX = /*#__PURE__*/ new RegExp(`(${_reactComponents.fluentProviderClassNames.root}\\d+)`);
|
|
21
|
+
const PortalCompatProvider = (props)=>{
|
|
22
|
+
const { children } = props;
|
|
23
|
+
const themeClassName = (0, _reactComponents.useThemeClassName)();
|
|
24
|
+
const cssVariablesClassName = _react.useMemo(// "themeClassName" may contain multiple classes while we want to add only a class that hosts CSS variables
|
|
11
25
|
// Keep in sync with "packages/react-provider/src/components/FluentProvider/useFluentProviderThemeStyleTag.ts"
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
26
|
+
()=>{
|
|
27
|
+
var _themeClassName_match;
|
|
28
|
+
return (_themeClassName_match = themeClassName.match(CLASS_NAME_REGEX)) === null || _themeClassName_match === void 0 ? void 0 : _themeClassName_match[1];
|
|
29
|
+
}, [
|
|
30
|
+
themeClassName
|
|
31
|
+
]);
|
|
32
|
+
const registerPortalEl = _react.useCallback((element)=>{
|
|
33
|
+
let disposeFocusVisiblePolyfill = ()=>undefined;
|
|
15
34
|
if (cssVariablesClassName) {
|
|
16
35
|
element.classList.add(cssVariablesClassName);
|
|
17
36
|
if (element.ownerDocument.defaultView) {
|
|
18
|
-
disposeFocusVisiblePolyfill =
|
|
37
|
+
disposeFocusVisiblePolyfill = (0, _reactTabster.applyFocusVisiblePolyfill)(element, element.ownerDocument.defaultView);
|
|
19
38
|
}
|
|
20
39
|
}
|
|
21
|
-
return
|
|
40
|
+
return ()=>{
|
|
22
41
|
if (cssVariablesClassName) {
|
|
23
42
|
element.classList.remove(cssVariablesClassName);
|
|
24
43
|
}
|
|
25
44
|
disposeFocusVisiblePolyfill();
|
|
26
45
|
};
|
|
27
|
-
}, [
|
|
46
|
+
}, [
|
|
47
|
+
cssVariablesClassName
|
|
48
|
+
]);
|
|
28
49
|
if (process.env.NODE_ENV !== 'production') {
|
|
29
50
|
// This if statement technically breaks the rules of hooks, but ENV variables never change during app lifecycle
|
|
30
51
|
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
31
|
-
|
|
52
|
+
_react.useEffect(()=>{
|
|
32
53
|
if (themeClassName === '') {
|
|
33
54
|
// eslint-disable-next-line no-console
|
|
34
|
-
console.warn(
|
|
55
|
+
console.warn(`
|
|
56
|
+
PortalCompatProvider: "useThemeClassName()" hook returned an empty string
|
|
57
|
+
=============================================
|
|
58
|
+
Make sure that PortalCompatProvider is rendered inside FluentProvider as a child.
|
|
59
|
+
`);
|
|
35
60
|
}
|
|
36
|
-
|
|
61
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
37
62
|
}, []);
|
|
38
63
|
}
|
|
39
|
-
return
|
|
40
|
-
|
|
41
|
-
|
|
64
|
+
return /*#__PURE__*/ _react.createElement(_reactPortalCompatContext.PortalCompatContextProvider, {
|
|
65
|
+
value: registerPortalEl
|
|
66
|
+
}, children);
|
|
67
|
+
}; //# sourceMappingURL=PortalCompatProvider.js.map
|
|
42
68
|
});
|
|
69
|
+
|
|
43
70
|
//# sourceMappingURL=PortalCompatProvider.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"sources":["../lib/PortalCompatProvider.js"],"sourcesContent":["import * as React from 'react';\nimport { fluentProviderClassNames, useThemeClassName } from '@fluentui/react-components';\nimport { PortalCompatContextProvider } from '@fluentui/react-portal-compat-context';\nimport { applyFocusVisiblePolyfill } from '@fluentui/react-tabster';\nconst CLASS_NAME_REGEX = /*#__PURE__*/new RegExp(`(${fluentProviderClassNames.root}\\\\d+)`);\nexport const PortalCompatProvider = props => {\n const {\n children\n } = props;\n const themeClassName = useThemeClassName();\n const cssVariablesClassName = React.useMemo(\n // \"themeClassName\" may contain multiple classes while we want to add only a class that hosts CSS variables\n // Keep in sync with \"packages/react-provider/src/components/FluentProvider/useFluentProviderThemeStyleTag.ts\"\n () => {\n var _themeClassName_match;\n return (_themeClassName_match = themeClassName.match(CLASS_NAME_REGEX)) === null || _themeClassName_match === void 0 ? void 0 : _themeClassName_match[1];\n }, [themeClassName]);\n const registerPortalEl = React.useCallback(element => {\n let disposeFocusVisiblePolyfill = () => undefined;\n if (cssVariablesClassName) {\n element.classList.add(cssVariablesClassName);\n if (element.ownerDocument.defaultView) {\n disposeFocusVisiblePolyfill = applyFocusVisiblePolyfill(element, element.ownerDocument.defaultView);\n }\n }\n return () => {\n if (cssVariablesClassName) {\n element.classList.remove(cssVariablesClassName);\n }\n disposeFocusVisiblePolyfill();\n };\n }, [cssVariablesClassName]);\n if (process.env.NODE_ENV !== 'production') {\n // This if statement technically breaks the rules of hooks, but ENV variables never change during app lifecycle\n // eslint-disable-next-line react-hooks/rules-of-hooks\n React.useEffect(() => {\n if (themeClassName === '') {\n // eslint-disable-next-line no-console\n console.warn(`\n PortalCompatProvider: \"useThemeClassName()\" hook returned an empty string\n =============================================\n Make sure that PortalCompatProvider is rendered inside FluentProvider as a child.\n `);\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, []);\n }\n return /*#__PURE__*/React.createElement(PortalCompatContextProvider, {\n value: registerPortalEl\n }, children);\n};\n//# sourceMappingURL=PortalCompatProvider.js.map"],"names":["PortalCompatProvider","CLASS_NAME_REGEX","RegExp","fluentProviderClassNames","root","props","children","themeClassName","useThemeClassName","cssVariablesClassName","React","useMemo","_themeClassName_match","match","registerPortalEl","useCallback","element","disposeFocusVisiblePolyfill","undefined","classList","add","ownerDocument","defaultView","applyFocusVisiblePolyfill","remove","process","env","NODE_ENV","useEffect","console","warn","createElement","PortalCompatContextProvider","value"],"mappings":";;;;IAAuB;IACqC;IAChB;IACF;;;;;;mCAE7BA;;iBAAAA;;;;IADb,MAAMC,mBAAmB,WAAW,GAAE,IAAIC,OAAO,CAAC,CAAC,EAAEC,yCAAwB,CAACC,IAAI,CAAC,KAAK,CAAC;IAClF,MAAMJ,uBAAuBK,CAAAA,QAAS;QAC3C,MAAM,EACJC,SAAQ,EACT,GAAGD;QACJ,MAAME,iBAAiBC,IAAAA,kCAAiB;QACxC,MAAMC,wBAAwBC,OAAMC,OAAO,CAC3C,2GAA2G;QAC3G,8GAA8G;QAC9G,IAAM;YACJ,IAAIC;YACJ,OAAO,AAACA,CAAAA,wBAAwBL,eAAeM,KAAK,CAACZ,iBAAgB,MAAO,IAAI,IAAIW,0BAA0B,KAAK,IAAI,KAAK,IAAIA,qBAAqB,CAAC,EAAE;QAC1J,GAAG;YAACL;SAAe;QACnB,MAAMO,mBAAmBJ,OAAMK,WAAW,CAACC,CAAAA,UAAW;YACpD,IAAIC,8BAA8B,IAAMC;YACxC,IAAIT,uBAAuB;gBACzBO,QAAQG,SAAS,CAACC,GAAG,CAACX;gBACtB,IAAIO,QAAQK,aAAa,CAACC,WAAW,EAAE;oBACrCL,8BAA8BM,IAAAA,uCAAyB,EAACP,SAASA,QAAQK,aAAa,CAACC,WAAW;gBACpG,CAAC;YACH,CAAC;YACD,OAAO,IAAM;gBACX,IAAIb,uBAAuB;oBACzBO,QAAQG,SAAS,CAACK,MAAM,CAACf;gBAC3B,CAAC;gBACDQ;YACF;QACF,GAAG;YAACR;SAAsB;QAC1B,IAAIgB,QAAQC,GAAG,CAACC,QAAQ,KAAK,cAAc;YACzC,+GAA+G;YAC/G,sDAAsD;YACtDjB,OAAMkB,SAAS,CAAC,IAAM;gBACpB,IAAIrB,mBAAmB,IAAI;oBACzB,sCAAsC;oBACtCsB,QAAQC,IAAI,CAAC,CAAC;;;;MAIhB,CAAC;gBACD,CAAC;YACD,uDAAuD;YACzD,GAAG,EAAE;QACP,CAAC;QACD,OAAO,WAAW,GAAEpB,OAAMqB,aAAa,CAACC,qDAA2B,EAAE;YACnEC,OAAOnB;QACT,GAAGR;IACL,GACA,gDAAgD"}
|
package/lib-amd/index.js
CHANGED
|
@@ -1,7 +1,17 @@
|
|
|
1
|
-
define([
|
|
1
|
+
define([
|
|
2
|
+
"require",
|
|
3
|
+
"exports",
|
|
4
|
+
"./PortalCompatProvider"
|
|
5
|
+
], function(require, exports, _portalCompatProvider) {
|
|
2
6
|
"use strict";
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
|
|
5
|
-
|
|
7
|
+
Object.defineProperty(exports, "__esModule", {
|
|
8
|
+
value: true
|
|
9
|
+
});
|
|
10
|
+
Object.defineProperty(exports, "PortalCompatProvider", {
|
|
11
|
+
enumerable: true,
|
|
12
|
+
get: ()=>_portalCompatProvider.PortalCompatProvider
|
|
13
|
+
});
|
|
6
14
|
});
|
|
15
|
+
//# sourceMappingURL=index.js.map
|
|
16
|
+
|
|
7
17
|
//# sourceMappingURL=index.js.map
|
package/lib-amd/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"sources":["../lib/index.js"],"sourcesContent":["export { PortalCompatProvider } from './PortalCompatProvider';\n//# sourceMappingURL=index.js.map"],"names":["PortalCompatProvider"],"mappings":";;;IAAqC;;;;;;mCAA5BA;;iBAAAA,0CAAoB;;;CAC7B,iCAAiC"}
|
|
@@ -1,55 +1,63 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
2
|
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
Object.defineProperty(exports, "PortalCompatProvider", {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: ()=>PortalCompatProvider
|
|
5
8
|
});
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
9
|
+
const _interopRequireWildcard = require("@swc/helpers/lib/_interop_require_wildcard.js").default;
|
|
10
|
+
const _react = /*#__PURE__*/ _interopRequireWildcard(require("react"));
|
|
11
|
+
const _reactComponents = require("@fluentui/react-components");
|
|
12
|
+
const _reactPortalCompatContext = require("@fluentui/react-portal-compat-context");
|
|
13
|
+
const _reactTabster = require("@fluentui/react-tabster");
|
|
14
|
+
const CLASS_NAME_REGEX = /*#__PURE__*/ new RegExp(`(${_reactComponents.fluentProviderClassNames.root}\\d+)`);
|
|
15
|
+
const PortalCompatProvider = (props)=>{
|
|
16
|
+
const { children } = props;
|
|
17
|
+
const themeClassName = (0, _reactComponents.useThemeClassName)();
|
|
18
|
+
const cssVariablesClassName = _react.useMemo(// "themeClassName" may contain multiple classes while we want to add only a class that hosts CSS variables
|
|
19
|
+
// Keep in sync with "packages/react-provider/src/components/FluentProvider/useFluentProviderThemeStyleTag.ts"
|
|
20
|
+
()=>{
|
|
21
|
+
var _themeClassName_match;
|
|
22
|
+
return (_themeClassName_match = themeClassName.match(CLASS_NAME_REGEX)) === null || _themeClassName_match === void 0 ? void 0 : _themeClassName_match[1];
|
|
23
|
+
}, [
|
|
24
|
+
themeClassName
|
|
25
|
+
]);
|
|
26
|
+
const registerPortalEl = _react.useCallback((element)=>{
|
|
27
|
+
let disposeFocusVisiblePolyfill = ()=>undefined;
|
|
28
|
+
if (cssVariablesClassName) {
|
|
29
|
+
element.classList.add(cssVariablesClassName);
|
|
30
|
+
if (element.ownerDocument.defaultView) {
|
|
31
|
+
disposeFocusVisiblePolyfill = (0, _reactTabster.applyFocusVisiblePolyfill)(element, element.ownerDocument.defaultView);
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
return ()=>{
|
|
35
|
+
if (cssVariablesClassName) {
|
|
36
|
+
element.classList.remove(cssVariablesClassName);
|
|
37
|
+
}
|
|
38
|
+
disposeFocusVisiblePolyfill();
|
|
39
|
+
};
|
|
40
|
+
}, [
|
|
41
|
+
cssVariablesClassName
|
|
42
|
+
]);
|
|
43
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
44
|
+
// This if statement technically breaks the rules of hooks, but ENV variables never change during app lifecycle
|
|
45
|
+
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
46
|
+
_react.useEffect(()=>{
|
|
47
|
+
if (themeClassName === '') {
|
|
48
|
+
// eslint-disable-next-line no-console
|
|
49
|
+
console.warn(`
|
|
50
|
+
PortalCompatProvider: "useThemeClassName()" hook returned an empty string
|
|
51
|
+
=============================================
|
|
52
|
+
Make sure that PortalCompatProvider is rendered inside FluentProvider as a child.
|
|
53
|
+
`);
|
|
54
|
+
}
|
|
55
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
56
|
+
}, []);
|
|
31
57
|
}
|
|
32
|
-
return
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
};
|
|
38
|
-
}, [cssVariablesClassName]);
|
|
39
|
-
if (process.env.NODE_ENV !== 'production') {
|
|
40
|
-
// This if statement technically breaks the rules of hooks, but ENV variables never change during app lifecycle
|
|
41
|
-
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
42
|
-
React.useEffect(function () {
|
|
43
|
-
if (themeClassName === '') {
|
|
44
|
-
// eslint-disable-next-line no-console
|
|
45
|
-
console.warn("\n PortalCompatProvider: \"useThemeClassName()\" hook returned an empty string\n =============================================\n Make sure that PortalCompatProvider is rendered inside FluentProvider as a child.\n ");
|
|
46
|
-
}
|
|
47
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
48
|
-
}, []);
|
|
49
|
-
}
|
|
50
|
-
return React.createElement(react_portal_compat_context_1.PortalCompatContextProvider, {
|
|
51
|
-
value: registerPortalEl
|
|
52
|
-
}, children);
|
|
53
|
-
};
|
|
54
|
-
exports.PortalCompatProvider = PortalCompatProvider;
|
|
58
|
+
return /*#__PURE__*/ _react.createElement(_reactPortalCompatContext.PortalCompatContextProvider, {
|
|
59
|
+
value: registerPortalEl
|
|
60
|
+
}, children);
|
|
61
|
+
}; //# sourceMappingURL=PortalCompatProvider.js.map
|
|
62
|
+
|
|
55
63
|
//# sourceMappingURL=PortalCompatProvider.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"sources":["../lib/PortalCompatProvider.js"],"sourcesContent":["import * as React from 'react';\nimport { fluentProviderClassNames, useThemeClassName } from '@fluentui/react-components';\nimport { PortalCompatContextProvider } from '@fluentui/react-portal-compat-context';\nimport { applyFocusVisiblePolyfill } from '@fluentui/react-tabster';\nconst CLASS_NAME_REGEX = /*#__PURE__*/new RegExp(`(${fluentProviderClassNames.root}\\\\d+)`);\nexport const PortalCompatProvider = props => {\n const {\n children\n } = props;\n const themeClassName = useThemeClassName();\n const cssVariablesClassName = React.useMemo(\n // \"themeClassName\" may contain multiple classes while we want to add only a class that hosts CSS variables\n // Keep in sync with \"packages/react-provider/src/components/FluentProvider/useFluentProviderThemeStyleTag.ts\"\n () => {\n var _themeClassName_match;\n return (_themeClassName_match = themeClassName.match(CLASS_NAME_REGEX)) === null || _themeClassName_match === void 0 ? void 0 : _themeClassName_match[1];\n }, [themeClassName]);\n const registerPortalEl = React.useCallback(element => {\n let disposeFocusVisiblePolyfill = () => undefined;\n if (cssVariablesClassName) {\n element.classList.add(cssVariablesClassName);\n if (element.ownerDocument.defaultView) {\n disposeFocusVisiblePolyfill = applyFocusVisiblePolyfill(element, element.ownerDocument.defaultView);\n }\n }\n return () => {\n if (cssVariablesClassName) {\n element.classList.remove(cssVariablesClassName);\n }\n disposeFocusVisiblePolyfill();\n };\n }, [cssVariablesClassName]);\n if (process.env.NODE_ENV !== 'production') {\n // This if statement technically breaks the rules of hooks, but ENV variables never change during app lifecycle\n // eslint-disable-next-line react-hooks/rules-of-hooks\n React.useEffect(() => {\n if (themeClassName === '') {\n // eslint-disable-next-line no-console\n console.warn(`\n PortalCompatProvider: \"useThemeClassName()\" hook returned an empty string\n =============================================\n Make sure that PortalCompatProvider is rendered inside FluentProvider as a child.\n `);\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, []);\n }\n return /*#__PURE__*/React.createElement(PortalCompatContextProvider, {\n value: registerPortalEl\n }, children);\n};\n//# sourceMappingURL=PortalCompatProvider.js.map"],"names":["PortalCompatProvider","CLASS_NAME_REGEX","RegExp","fluentProviderClassNames","root","props","children","themeClassName","useThemeClassName","cssVariablesClassName","React","useMemo","_themeClassName_match","match","registerPortalEl","useCallback","element","disposeFocusVisiblePolyfill","undefined","classList","add","ownerDocument","defaultView","applyFocusVisiblePolyfill","remove","process","env","NODE_ENV","useEffect","console","warn","createElement","PortalCompatContextProvider","value"],"mappings":";;;;+BAKaA;;aAAAA;;;6DALU;iCACqC;0CAChB;8BACF;AAC1C,MAAMC,mBAAmB,WAAW,GAAE,IAAIC,OAAO,CAAC,CAAC,EAAEC,yCAAwB,CAACC,IAAI,CAAC,KAAK,CAAC;AAClF,MAAMJ,uBAAuBK,CAAAA,QAAS;IAC3C,MAAM,EACJC,SAAQ,EACT,GAAGD;IACJ,MAAME,iBAAiBC,IAAAA,kCAAiB;IACxC,MAAMC,wBAAwBC,OAAMC,OAAO,CAC3C,2GAA2G;IAC3G,8GAA8G;IAC9G,IAAM;QACJ,IAAIC;QACJ,OAAO,AAACA,CAAAA,wBAAwBL,eAAeM,KAAK,CAACZ,iBAAgB,MAAO,IAAI,IAAIW,0BAA0B,KAAK,IAAI,KAAK,IAAIA,qBAAqB,CAAC,EAAE;IAC1J,GAAG;QAACL;KAAe;IACnB,MAAMO,mBAAmBJ,OAAMK,WAAW,CAACC,CAAAA,UAAW;QACpD,IAAIC,8BAA8B,IAAMC;QACxC,IAAIT,uBAAuB;YACzBO,QAAQG,SAAS,CAACC,GAAG,CAACX;YACtB,IAAIO,QAAQK,aAAa,CAACC,WAAW,EAAE;gBACrCL,8BAA8BM,IAAAA,uCAAyB,EAACP,SAASA,QAAQK,aAAa,CAACC,WAAW;YACpG,CAAC;QACH,CAAC;QACD,OAAO,IAAM;YACX,IAAIb,uBAAuB;gBACzBO,QAAQG,SAAS,CAACK,MAAM,CAACf;YAC3B,CAAC;YACDQ;QACF;IACF,GAAG;QAACR;KAAsB;IAC1B,IAAIgB,QAAQC,GAAG,CAACC,QAAQ,KAAK,cAAc;QACzC,+GAA+G;QAC/G,sDAAsD;QACtDjB,OAAMkB,SAAS,CAAC,IAAM;YACpB,IAAIrB,mBAAmB,IAAI;gBACzB,sCAAsC;gBACtCsB,QAAQC,IAAI,CAAC,CAAC;;;;MAIhB,CAAC;YACD,CAAC;QACD,uDAAuD;QACzD,GAAG,EAAE;IACP,CAAC;IACD,OAAO,WAAW,GAAEpB,OAAMqB,aAAa,CAACC,qDAA2B,EAAE;QACnEC,OAAOnB;IACT,GAAGR;AACL,GACA,gDAAgD"}
|
package/lib-commonjs/index.js
CHANGED
|
@@ -1,14 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
2
|
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
|
|
3
|
+
value: true
|
|
5
4
|
});
|
|
6
|
-
exports.PortalCompatProvider = void 0;
|
|
7
|
-
var PortalCompatProvider_1 = /*#__PURE__*/require("./PortalCompatProvider");
|
|
8
5
|
Object.defineProperty(exports, "PortalCompatProvider", {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
return PortalCompatProvider_1.PortalCompatProvider;
|
|
12
|
-
}
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: ()=>_portalCompatProvider.PortalCompatProvider
|
|
13
8
|
});
|
|
9
|
+
const _portalCompatProvider = require("./PortalCompatProvider");
|
|
10
|
+
//# sourceMappingURL=index.js.map
|
|
11
|
+
|
|
14
12
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"sources":["../lib/index.js"],"sourcesContent":["export { PortalCompatProvider } from './PortalCompatProvider';\n//# sourceMappingURL=index.js.map"],"names":["PortalCompatProvider"],"mappings":";;;;+BAASA;;aAAAA,0CAAoB;;sCAAQ;CACrC,iCAAiC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fluentui/react-portal-compat",
|
|
3
|
-
"version": "9.0.
|
|
3
|
+
"version": "9.0.47",
|
|
4
4
|
"description": "A package that contains compatibility layer for React Portals",
|
|
5
5
|
"main": "lib-commonjs/index.js",
|
|
6
6
|
"module": "lib/index.js",
|
|
@@ -22,23 +22,23 @@
|
|
|
22
22
|
"lint": "just-scripts lint",
|
|
23
23
|
"test": "jest --passWithNoTests",
|
|
24
24
|
"type-check": "tsc -b tsconfig.json",
|
|
25
|
-
"generate-api": "
|
|
25
|
+
"generate-api": "just-scripts generate-api"
|
|
26
26
|
},
|
|
27
27
|
"devDependencies": {
|
|
28
28
|
"@fluentui/eslint-plugin": "*",
|
|
29
|
-
"@fluentui/react-components": "^9.18.
|
|
30
|
-
"@fluentui/react-shared-contexts": "^9.3.
|
|
29
|
+
"@fluentui/react-components": "^9.18.4",
|
|
30
|
+
"@fluentui/react-shared-contexts": "^9.3.3",
|
|
31
31
|
"@fluentui/scripts-api-extractor": "*",
|
|
32
32
|
"@fluentui/scripts-cypress": "*",
|
|
33
33
|
"@fluentui/scripts-tasks": "*"
|
|
34
34
|
},
|
|
35
35
|
"dependencies": {
|
|
36
|
-
"@fluentui/react-portal-compat-context": "^9.0.
|
|
37
|
-
"@fluentui/react-tabster": "^9.6.
|
|
38
|
-
"
|
|
36
|
+
"@fluentui/react-portal-compat-context": "^9.0.5",
|
|
37
|
+
"@fluentui/react-tabster": "^9.6.2",
|
|
38
|
+
"@swc/helpers": "^0.4.14"
|
|
39
39
|
},
|
|
40
40
|
"peerDependencies": {
|
|
41
|
-
"@fluentui/react-components": "^9.18.
|
|
41
|
+
"@fluentui/react-components": "^9.18.4",
|
|
42
42
|
"@types/react": ">=16.8.0 <19.0.0",
|
|
43
43
|
"react": ">=16.8.0 <19.0.0"
|
|
44
44
|
},
|
|
@@ -51,6 +51,7 @@
|
|
|
51
51
|
"exports": {
|
|
52
52
|
".": {
|
|
53
53
|
"types": "./dist/index.d.ts",
|
|
54
|
+
"node": "./lib-commonjs/index.js",
|
|
54
55
|
"import": "./lib/index.js",
|
|
55
56
|
"require": "./lib-commonjs/index.js"
|
|
56
57
|
},
|