@fluentui/react-provider 0.0.0-nightly9edaf68d4420211116.1 → 0.0.0-nightlya0aef7969220220228.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.json +261 -20
- package/CHANGELOG.md +66 -13
- package/dist/react-provider.d.ts +12 -15
- package/lib/FluentProvider.js.map +1 -1
- package/lib/components/FluentProvider/FluentProvider.js +8 -8
- package/lib/components/FluentProvider/FluentProvider.js.map +1 -1
- package/lib/components/FluentProvider/FluentProvider.types.d.ts +8 -7
- package/lib/components/FluentProvider/FluentProvider.types.js.map +1 -1
- package/lib/components/FluentProvider/index.js.map +1 -1
- package/lib/components/FluentProvider/renderFluentProvider.d.ts +1 -1
- package/lib/components/FluentProvider/renderFluentProvider.js +7 -4
- package/lib/components/FluentProvider/renderFluentProvider.js.map +1 -1
- package/lib/components/FluentProvider/useFluentProvider.d.ts +4 -5
- package/lib/components/FluentProvider/useFluentProvider.js +31 -6
- package/lib/components/FluentProvider/useFluentProvider.js.map +1 -1
- package/lib/components/FluentProvider/useFluentProviderContextValues.d.ts +1 -1
- package/lib/components/FluentProvider/useFluentProviderContextValues.js +2 -1
- package/lib/components/FluentProvider/useFluentProviderContextValues.js.map +1 -1
- package/lib/components/FluentProvider/useFluentProviderStyles.d.ts +1 -1
- package/lib/components/FluentProvider/useFluentProviderStyles.js +3 -2
- package/lib/components/FluentProvider/useFluentProviderStyles.js.map +1 -1
- package/lib/components/FluentProvider/useThemeStyleTag.js +4 -9
- package/lib/components/FluentProvider/useThemeStyleTag.js.map +1 -1
- package/lib/index.js.map +1 -1
- package/lib-commonjs/FluentProvider.js.map +1 -1
- package/lib-commonjs/components/FluentProvider/FluentProvider.js +4 -4
- package/lib-commonjs/components/FluentProvider/FluentProvider.js.map +1 -1
- package/lib-commonjs/components/FluentProvider/FluentProvider.types.d.ts +8 -7
- package/lib-commonjs/components/FluentProvider/FluentProvider.types.js.map +1 -1
- package/lib-commonjs/components/FluentProvider/index.js.map +1 -1
- package/lib-commonjs/components/FluentProvider/renderFluentProvider.d.ts +1 -1
- package/lib-commonjs/components/FluentProvider/renderFluentProvider.js +10 -7
- package/lib-commonjs/components/FluentProvider/renderFluentProvider.js.map +1 -1
- package/lib-commonjs/components/FluentProvider/useFluentProvider.d.ts +4 -5
- package/lib-commonjs/components/FluentProvider/useFluentProvider.js +36 -11
- package/lib-commonjs/components/FluentProvider/useFluentProvider.js.map +1 -1
- package/lib-commonjs/components/FluentProvider/useFluentProviderContextValues.d.ts +1 -1
- package/lib-commonjs/components/FluentProvider/useFluentProviderContextValues.js +4 -3
- package/lib-commonjs/components/FluentProvider/useFluentProviderContextValues.js.map +1 -1
- package/lib-commonjs/components/FluentProvider/useFluentProviderStyles.d.ts +1 -1
- package/lib-commonjs/components/FluentProvider/useFluentProviderStyles.js +8 -6
- package/lib-commonjs/components/FluentProvider/useFluentProviderStyles.js.map +1 -1
- package/lib-commonjs/components/FluentProvider/useThemeStyleTag.js +4 -10
- package/lib-commonjs/components/FluentProvider/useThemeStyleTag.js.map +1 -1
- package/lib-commonjs/index.js.map +1 -1
- package/package.json +13 -14
- package/lib/common/isConformant.d.ts +0 -4
- package/lib/common/isConformant.js +0 -12
- package/lib/common/isConformant.js.map +0 -1
- package/lib-commonjs/common/isConformant.d.ts +0 -4
- package/lib-commonjs/common/isConformant.js +0 -23
- package/lib-commonjs/common/isConformant.js.map +0 -1
@@ -7,8 +7,6 @@ exports.useThemeStyleTag = void 0;
|
|
7
7
|
|
8
8
|
const react_utilities_1 = /*#__PURE__*/require("@fluentui/react-utilities");
|
9
9
|
|
10
|
-
const react_theme_1 = /*#__PURE__*/require("@fluentui/react-theme");
|
11
|
-
|
12
10
|
const React = /*#__PURE__*/require("react");
|
13
11
|
|
14
12
|
const useFluentProviderStyles_1 = /*#__PURE__*/require("./useFluentProviderStyles");
|
@@ -36,11 +34,10 @@ const useThemeStyleTag = options => {
|
|
36
34
|
return tag;
|
37
35
|
}, [styleTagId, targetDocument]);
|
38
36
|
const cssRule = React.useMemo(() => {
|
39
|
-
const
|
40
|
-
|
41
|
-
cssVarRule += `${cssVar}: ${cssVars[cssVar]}; `;
|
37
|
+
const cssVarsAsString = theme ? Object.keys(theme).reduce((cssVarRule, cssVar) => {
|
38
|
+
cssVarRule += `--${cssVar}: ${theme[cssVar]}; `;
|
42
39
|
return cssVarRule;
|
43
|
-
}, ''); // result: .fluent-provider1 { --css-var: '#fff' }
|
40
|
+
}, '') : ''; // result: .fluent-provider1 { --css-var: '#fff' }
|
44
41
|
|
45
42
|
return `.${styleTagId} { ${cssVarsAsString} }`;
|
46
43
|
}, [theme, styleTagId]);
|
@@ -59,11 +56,8 @@ const useThemeStyleTag = options => {
|
|
59
56
|
|
60
57
|
React.useEffect(() => {
|
61
58
|
return () => {
|
62
|
-
var _a;
|
63
|
-
|
64
59
|
if (styleTag) {
|
65
|
-
|
66
|
-
(_a = styleTag.parentElement) === null || _a === void 0 ? void 0 : _a.removeChild(styleTag);
|
60
|
+
styleTag.remove();
|
67
61
|
}
|
68
62
|
};
|
69
63
|
}, [styleTag]);
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["
|
1
|
+
{"version":3,"sources":["components/FluentProvider/useThemeStyleTag.ts"],"names":[],"mappings":";;;;;;;AAAA,MAAA,iBAAA,gBAAA,OAAA,CAAA,2BAAA,CAAA;;AACA,MAAA,KAAA,gBAAA,OAAA,CAAA,OAAA,CAAA;;AAEA,MAAA,yBAAA,gBAAA,OAAA,CAAA,2BAAA,CAAA;AAEA;;;;AAIG;;;AACI,MAAM,gBAAgB,GAAI,OAAD,IAAmE;AACjG,QAAM;AAAE,IAAA,cAAF;AAAkB,IAAA;AAAlB,MAA4B,OAAlC;AAEA,QAAM,UAAU,GAAG,iBAAA,CAAA,KAAA,CAAM,yBAAA,CAAA,uBAAN,CAAnB;AACA,QAAM,QAAQ,GAAG,KAAK,CAAC,OAAN,CAAc,MAAK;AAClC,QAAI,C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;AAQA,SAAO,UAAP;AACD,CAhDM;;AAAM,OAAA,CAAA,gBAAA,GAAgB,gBAAhB","sourcesContent":["import { useId, usePrevious } from '@fluentui/react-utilities';\nimport * as React from 'react';\nimport type { FluentProviderState } from './FluentProvider.types';\nimport { fluentProviderClassName } from './useFluentProviderStyles';\n\n/**\n * Writes a theme as css variables in a style tag on the provided targetDocument as a rule applied to a CSS class\n *\n * @returns CSS class to apply the rule\n */\nexport const useThemeStyleTag = (options: Pick<FluentProviderState, 'theme' | 'targetDocument'>) => {\n const { targetDocument, theme } = options;\n\n const styleTagId = useId(fluentProviderClassName);\n const styleTag = React.useMemo(() => {\n if (!targetDocument) {\n return null;\n }\n\n const tag = targetDocument.createElement('style');\n tag.setAttribute('id', styleTagId);\n targetDocument.head.appendChild(tag);\n return tag;\n }, [styleTagId, targetDocument]);\n\n const cssRule = React.useMemo(() => {\n const cssVarsAsString = theme\n ? (Object.keys(theme) as (keyof typeof theme)[]).reduce((cssVarRule, cssVar) => {\n cssVarRule += `--${cssVar}: ${theme[cssVar]}; `;\n return cssVarRule;\n }, '')\n : '';\n\n // result: .fluent-provider1 { --css-var: '#fff' }\n return `.${styleTagId} { ${cssVarsAsString} }`;\n }, [theme, styleTagId]);\n const previousCssRule = usePrevious(cssRule);\n\n if (styleTag && previousCssRule !== cssRule) {\n const sheet = styleTag.sheet as CSSStyleSheet;\n\n if (sheet.cssRules.length > 0) {\n sheet.deleteRule(0);\n }\n\n sheet.insertRule(cssRule, 0);\n }\n\n // Removes the style tag from the targetDocument on unmount or change\n React.useEffect(() => {\n return () => {\n if (styleTag) {\n styleTag.remove();\n }\n };\n }, [styleTag]);\n\n return styleTagId;\n};\n"],"sourceRoot":"../src/"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["
|
1
|
+
{"version":3,"sources":["index.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,kBAAA,CAAA,EAAA,OAAA;;AACA,IAAA,uBAAA,gBAAA,OAAA,CAAA,iCAAA,CAAA;;AAAS,MAAA,CAAA,cAAA,CAAA,OAAA,EAAA,WAAA,EAAA;AAAA,EAAA,UAAA,EAAA,IAAA;AAAA,EAAA,GAAA,EAAA,YAAA;AAAA,WAAA,uBAAA,CAAA,SAAA;AAAS;AAAT,CAAA;AAAW,MAAA,CAAA,cAAA,CAAA,OAAA,EAAA,UAAA,EAAA;AAAA,EAAA,UAAA,EAAA,IAAA;AAAA,EAAA,GAAA,EAAA,YAAA;AAAA,WAAA,uBAAA,CAAA,QAAA;AAAQ;AAAR,CAAA","sourcesContent":["export * from './FluentProvider';\nexport { useFluent, useTheme } from '@fluentui/react-shared-contexts';\n"],"sourceRoot":"../src/"}
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@fluentui/react-provider",
|
3
|
-
"version": "0.0.0-
|
3
|
+
"version": "0.0.0-nightlya0aef7969220220228.1",
|
4
4
|
"description": "Fluent UI React provider component",
|
5
5
|
"main": "lib-commonjs/index.js",
|
6
6
|
"module": "lib/index.js",
|
@@ -14,28 +14,27 @@
|
|
14
14
|
"scripts": {
|
15
15
|
"build": "just-scripts build",
|
16
16
|
"bundle-size": "bundle-size measure",
|
17
|
-
"test": "jest",
|
17
|
+
"test": "jest --passWithNoTests",
|
18
18
|
"clean": "just-scripts clean",
|
19
19
|
"code-style": "just-scripts code-style",
|
20
20
|
"just": "just-scripts",
|
21
21
|
"lint": "just-scripts lint",
|
22
22
|
"docs": "api-extractor run --config=config/api-extractor.local.json --local",
|
23
|
-
"build:local": "tsc -p . --module esnext --emitDeclarationOnly && node ../../scripts/typescript/normalize-import --output dist/react-provider/src && yarn docs",
|
24
|
-
"storybook": "
|
25
|
-
"start": "yarn storybook"
|
23
|
+
"build:local": "tsc -p ./tsconfig.lib.json --module esnext --emitDeclarationOnly && node ../../scripts/typescript/normalize-import --output ./dist/packages/react-provider/src && yarn docs",
|
24
|
+
"storybook": "node ../../scripts/storybook/runner",
|
25
|
+
"start": "yarn storybook",
|
26
|
+
"type-check": "tsc -b tsconfig.json"
|
26
27
|
},
|
27
28
|
"devDependencies": {
|
28
|
-
"@fluentui/babel-make-styles": "0.0.0-nightly9edaf68d4420211116.1",
|
29
29
|
"@fluentui/eslint-plugin": "*",
|
30
|
-
"@fluentui/jest-serializer-make-styles": "0.0.0-nightly9edaf68d4420211116.1",
|
31
30
|
"@fluentui/react-conformance": "*",
|
32
|
-
"@fluentui/react-conformance-
|
31
|
+
"@fluentui/react-conformance-griffel": "0.0.0-nightlya0aef7969220220228.1",
|
33
32
|
"@fluentui/scripts": "^1.0.0",
|
34
33
|
"@types/enzyme": "3.10.3",
|
35
34
|
"@types/enzyme-adapter-react-16": "1.0.3",
|
36
|
-
"@types/jest": "24.9.1",
|
37
35
|
"@types/react": "16.9.42",
|
38
36
|
"@types/react-dom": "16.9.10",
|
37
|
+
"@types/react-test-renderer": "^16.0.0",
|
39
38
|
"enzyme": "~3.10.0",
|
40
39
|
"enzyme-adapter-react-16": "^1.15.0",
|
41
40
|
"react": "16.8.6",
|
@@ -43,11 +42,11 @@
|
|
43
42
|
"react-test-renderer": "^16.3.0"
|
44
43
|
},
|
45
44
|
"dependencies": {
|
46
|
-
"@
|
47
|
-
"@fluentui/react-shared-contexts": "0.0.0-
|
48
|
-
"@fluentui/react-tabster": "0.0.0-
|
49
|
-
"@fluentui/react-theme": "0.0.0-
|
50
|
-
"@fluentui/react-utilities": "0.0.0-
|
45
|
+
"@griffel/react": "1.0.0",
|
46
|
+
"@fluentui/react-shared-contexts": "0.0.0-nightlya0aef7969220220228.1",
|
47
|
+
"@fluentui/react-tabster": "0.0.0-nightlya0aef7969220220228.1",
|
48
|
+
"@fluentui/react-theme": "0.0.0-nightlya0aef7969220220228.1",
|
49
|
+
"@fluentui/react-utilities": "0.0.0-nightlya0aef7969220220228.1",
|
51
50
|
"tslib": "^2.1.0"
|
52
51
|
},
|
53
52
|
"peerDependencies": {
|
@@ -1,12 +0,0 @@
|
|
1
|
-
import { isConformant as baseIsConformant } from '@fluentui/react-conformance';
|
2
|
-
import makeStylesTests from '@fluentui/react-conformance-make-styles';
|
3
|
-
export function isConformant(testInfo) {
|
4
|
-
const defaultOptions = {
|
5
|
-
disabledTests: ['has-docblock'],
|
6
|
-
asPropHandlesRef: true,
|
7
|
-
componentPath: module.parent.filename.replace('.test', ''),
|
8
|
-
extraTests: makeStylesTests
|
9
|
-
};
|
10
|
-
baseIsConformant(defaultOptions, testInfo);
|
11
|
-
}
|
12
|
-
//# sourceMappingURL=isConformant.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"sources":["../../src/common/isConformant.ts"],"names":[],"mappings":"AAAA,SAAS,YAAY,IAAI,gBAAzB,QAAiD,6BAAjD;AAEA,OAAO,eAAP,MAA4B,yCAA5B;AAEA,OAAM,SAAU,YAAV,CACJ,QADI,EACqF;AAEzF,QAAM,cAAc,GAAyC;AAC3D,IAAA,aAAa,EAAE,CAAC,cAAD,CAD4C;AAE3D,IAAA,gBAAgB,EAAE,IAFyC;AAG3D,IAAA,aAAa,EAAE,MAAO,CAAC,MAAR,CAAgB,QAAhB,CAAyB,OAAzB,CAAiC,OAAjC,EAA0C,EAA1C,CAH4C;AAI3D,IAAA,UAAU,EAAE;AAJ+C,GAA7D;AAOA,EAAA,gBAAgB,CAAC,cAAD,EAAiB,QAAjB,CAAhB;AACD","sourceRoot":""}
|
@@ -1,23 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
4
|
-
value: true
|
5
|
-
});
|
6
|
-
exports.isConformant = void 0;
|
7
|
-
|
8
|
-
const react_conformance_1 = /*#__PURE__*/require("@fluentui/react-conformance");
|
9
|
-
|
10
|
-
const react_conformance_make_styles_1 = /*#__PURE__*/require("@fluentui/react-conformance-make-styles");
|
11
|
-
|
12
|
-
function isConformant(testInfo) {
|
13
|
-
const defaultOptions = {
|
14
|
-
disabledTests: ['has-docblock'],
|
15
|
-
asPropHandlesRef: true,
|
16
|
-
componentPath: module.parent.filename.replace('.test', ''),
|
17
|
-
extraTests: react_conformance_make_styles_1.default
|
18
|
-
};
|
19
|
-
react_conformance_1.isConformant(defaultOptions, testInfo);
|
20
|
-
}
|
21
|
-
|
22
|
-
exports.isConformant = isConformant;
|
23
|
-
//# sourceMappingURL=isConformant.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"sources":["../../src/common/isConformant.ts"],"names":[],"mappings":";;;;;;;AAAA,MAAA,mBAAA,gBAAA,OAAA,CAAA,6BAAA,CAAA;;AAEA,MAAA,+BAAA,gBAAA,OAAA,CAAA,yCAAA,CAAA;;AAEA,SAAgB,YAAhB,CACE,QADF,EAC2F;AAEzF,QAAM,cAAc,GAAyC;AAC3D,IAAA,aAAa,EAAE,CAAC,cAAD,CAD4C;AAE3D,IAAA,gBAAgB,EAAE,IAFyC;AAG3D,IAAA,aAAa,EAAE,MAAO,CAAC,MAAR,CAAgB,QAAhB,CAAyB,OAAzB,CAAiC,OAAjC,EAA0C,EAA1C,CAH4C;AAI3D,IAAA,UAAU,EAAE,+BAAA,CAAA;AAJ+C,GAA7D;AAOA,EAAA,mBAAA,CAAA,YAAA,CAAiB,cAAjB,EAAiC,QAAjC;AACD;;AAXD,OAAA,CAAA,YAAA,GAAA,YAAA","sourceRoot":""}
|