@fluentui/react-context-selector 9.0.0-alpha.32 → 9.0.0-alpha.36
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 +82 -1
- package/CHANGELOG.md +38 -2
- package/lib/createContext.js.map +1 -1
- package/lib/index.js.map +1 -1
- package/lib/types.js.map +1 -1
- package/lib/useContextSelector.js.map +1 -1
- package/lib/useHasParentContext.js.map +1 -1
- package/lib-commonjs/createContext.js.map +1 -1
- package/lib-commonjs/index.js.map +1 -1
- package/lib-commonjs/types.js.map +1 -1
- package/lib-commonjs/useContextSelector.js.map +1 -1
- package/lib-commonjs/useHasParentContext.js.map +1 -1
- package/package.json +3 -3
- package/lib-amd/createContext.d.ts +0 -2
- package/lib-amd/createContext.js +0 -48
- package/lib-amd/createContext.js.map +0 -1
- package/lib-amd/index.d.ts +0 -4
- package/lib-amd/index.js +0 -10
- package/lib-amd/index.js.map +0 -1
- package/lib-amd/types.d.ts +0 -19
- package/lib-amd/types.js +0 -5
- package/lib-amd/types.js.map +0 -1
- package/lib-amd/useContextSelector.d.ts +0 -7
- package/lib-amd/useContextSelector.js +0 -71
- package/lib-amd/useContextSelector.js.map +0 -1
- package/lib-amd/useHasParentContext.d.ts +0 -9
- package/lib-amd/useHasParentContext.js +0 -21
- package/lib-amd/useHasParentContext.js.map +0 -1
package/CHANGELOG.json
CHANGED
@@ -2,7 +2,88 @@
|
|
2
2
|
"name": "@fluentui/react-context-selector",
|
3
3
|
"entries": [
|
4
4
|
{
|
5
|
-
"date": "
|
5
|
+
"date": "Mon, 27 Sep 2021 08:04:28 GMT",
|
6
|
+
"tag": "@fluentui/react-context-selector_v9.0.0-alpha.36",
|
7
|
+
"version": "9.0.0-alpha.36",
|
8
|
+
"comments": {
|
9
|
+
"prerelease": [
|
10
|
+
{
|
11
|
+
"author": "beachball",
|
12
|
+
"package": "@fluentui/react-context-selector",
|
13
|
+
"comment": "Bump @fluentui/react-utilities to v9.0.0-alpha.53",
|
14
|
+
"commit": "7a6d4d03fc1157272a6641fd05fc27f51ba1cc0e"
|
15
|
+
}
|
16
|
+
]
|
17
|
+
}
|
18
|
+
},
|
19
|
+
{
|
20
|
+
"date": "Fri, 24 Sep 2021 09:17:17 GMT",
|
21
|
+
"tag": "@fluentui/react-context-selector_v9.0.0-alpha.35",
|
22
|
+
"version": "9.0.0-alpha.35",
|
23
|
+
"comments": {
|
24
|
+
"prerelease": [
|
25
|
+
{
|
26
|
+
"author": "beachball",
|
27
|
+
"package": "@fluentui/react-context-selector",
|
28
|
+
"comment": "Bump @fluentui/react-utilities to v9.0.0-alpha.52",
|
29
|
+
"commit": "0d26909912889432060fd4c87b2f4a45017e1532"
|
30
|
+
}
|
31
|
+
]
|
32
|
+
}
|
33
|
+
},
|
34
|
+
{
|
35
|
+
"date": "Thu, 23 Sep 2021 08:21:34 GMT",
|
36
|
+
"tag": "@fluentui/react-context-selector_v9.0.0-alpha.34",
|
37
|
+
"version": "9.0.0-alpha.34",
|
38
|
+
"comments": {
|
39
|
+
"prerelease": [
|
40
|
+
{
|
41
|
+
"author": "beachball",
|
42
|
+
"package": "@fluentui/react-context-selector",
|
43
|
+
"comment": "Bump @fluentui/react-utilities to v9.0.0-alpha.51",
|
44
|
+
"commit": "95682da34c48813f7658032ae490d21d2f363b90"
|
45
|
+
}
|
46
|
+
]
|
47
|
+
}
|
48
|
+
},
|
49
|
+
{
|
50
|
+
"date": "Wed, 22 Sep 2021 10:10:07 GMT",
|
51
|
+
"tag": "@fluentui/react-context-selector_v9.0.0-alpha.33",
|
52
|
+
"version": "9.0.0-alpha.33",
|
53
|
+
"comments": {
|
54
|
+
"prerelease": [
|
55
|
+
{
|
56
|
+
"author": "beachball",
|
57
|
+
"package": "@fluentui/react-context-selector",
|
58
|
+
"comment": "Bump @fluentui/react-utilities to v9.0.0-alpha.50",
|
59
|
+
"commit": "bc3f1ec72fc7784a558b0dd6598ee0662f4649c1"
|
60
|
+
}
|
61
|
+
]
|
62
|
+
}
|
63
|
+
},
|
64
|
+
{
|
65
|
+
"date": "Mon, 20 Sep 2021 07:36:26 GMT",
|
66
|
+
"tag": "@fluentui/react-context-selector_v9.0.0-alpha.32",
|
67
|
+
"version": "9.0.0-alpha.32",
|
68
|
+
"comments": {
|
69
|
+
"none": [
|
70
|
+
{
|
71
|
+
"author": "lingfangao@hotmail.com",
|
72
|
+
"package": "@fluentui/react-context-selector",
|
73
|
+
"comment": "chore: use versioon eslint-plugin and react-conformance in dev dependencies",
|
74
|
+
"commit": "b8a304770f77c0353553a152dad34421070400a6"
|
75
|
+
},
|
76
|
+
{
|
77
|
+
"author": "lingfangao@hotmail.com",
|
78
|
+
"package": "@fluentui/react-context-selector",
|
79
|
+
"commit": "b8a304770f77c0353553a152dad34421070400a6",
|
80
|
+
"comment": "Bump @fluentui/react-context-selector to v9.0.0-alpha.32"
|
81
|
+
}
|
82
|
+
]
|
83
|
+
}
|
84
|
+
},
|
85
|
+
{
|
86
|
+
"date": "Fri, 17 Sep 2021 07:35:26 GMT",
|
6
87
|
"tag": "@fluentui/react-context-selector_v9.0.0-alpha.32",
|
7
88
|
"version": "9.0.0-alpha.32",
|
8
89
|
"comments": {
|
package/CHANGELOG.md
CHANGED
@@ -1,12 +1,48 @@
|
|
1
1
|
# Change Log - @fluentui/react-context-selector
|
2
2
|
|
3
|
-
This log was last generated on
|
3
|
+
This log was last generated on Mon, 27 Sep 2021 08:04:28 GMT and should not be manually modified.
|
4
4
|
|
5
5
|
<!-- Start content -->
|
6
6
|
|
7
|
+
## [9.0.0-alpha.36](https://github.com/microsoft/fluentui/tree/@fluentui/react-context-selector_v9.0.0-alpha.36)
|
8
|
+
|
9
|
+
Mon, 27 Sep 2021 08:04:28 GMT
|
10
|
+
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-context-selector_v9.0.0-alpha.35..@fluentui/react-context-selector_v9.0.0-alpha.36)
|
11
|
+
|
12
|
+
### Changes
|
13
|
+
|
14
|
+
- Bump @fluentui/react-utilities to v9.0.0-alpha.53 ([commit](https://github.com/microsoft/fluentui/commit/7a6d4d03fc1157272a6641fd05fc27f51ba1cc0e) by beachball)
|
15
|
+
|
16
|
+
## [9.0.0-alpha.35](https://github.com/microsoft/fluentui/tree/@fluentui/react-context-selector_v9.0.0-alpha.35)
|
17
|
+
|
18
|
+
Fri, 24 Sep 2021 09:17:17 GMT
|
19
|
+
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-context-selector_v9.0.0-alpha.34..@fluentui/react-context-selector_v9.0.0-alpha.35)
|
20
|
+
|
21
|
+
### Changes
|
22
|
+
|
23
|
+
- Bump @fluentui/react-utilities to v9.0.0-alpha.52 ([PR #19950](https://github.com/microsoft/fluentui/pull/19950) by beachball)
|
24
|
+
|
25
|
+
## [9.0.0-alpha.34](https://github.com/microsoft/fluentui/tree/@fluentui/react-context-selector_v9.0.0-alpha.34)
|
26
|
+
|
27
|
+
Thu, 23 Sep 2021 08:21:34 GMT
|
28
|
+
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-context-selector_v9.0.0-alpha.33..@fluentui/react-context-selector_v9.0.0-alpha.34)
|
29
|
+
|
30
|
+
### Changes
|
31
|
+
|
32
|
+
- Bump @fluentui/react-utilities to v9.0.0-alpha.51 ([commit](https://github.com/microsoft/fluentui/commit/95682da34c48813f7658032ae490d21d2f363b90) by beachball)
|
33
|
+
|
34
|
+
## [9.0.0-alpha.33](https://github.com/microsoft/fluentui/tree/@fluentui/react-context-selector_v9.0.0-alpha.33)
|
35
|
+
|
36
|
+
Wed, 22 Sep 2021 10:10:07 GMT
|
37
|
+
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-context-selector_v9.0.0-alpha.32..@fluentui/react-context-selector_v9.0.0-alpha.33)
|
38
|
+
|
39
|
+
### Changes
|
40
|
+
|
41
|
+
- Bump @fluentui/react-utilities to v9.0.0-alpha.50 ([commit](https://github.com/microsoft/fluentui/commit/bc3f1ec72fc7784a558b0dd6598ee0662f4649c1) by beachball)
|
42
|
+
|
7
43
|
## [9.0.0-alpha.32](https://github.com/microsoft/fluentui/tree/@fluentui/react-context-selector_v9.0.0-alpha.32)
|
8
44
|
|
9
|
-
Fri, 17 Sep 2021 07:
|
45
|
+
Fri, 17 Sep 2021 07:35:26 GMT
|
10
46
|
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-context-selector_v9.0.0-alpha.31..@fluentui/react-context-selector_v9.0.0-alpha.32)
|
11
47
|
|
12
48
|
### Changes
|
package/lib/createContext.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"createContext.js","sourceRoot":"
|
1
|
+
{"version":3,"file":"createContext.js","sourceRoot":"","sources":["../src/createContext.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,yBAAyB,EAAE,MAAM,2BAA2B,CAAC;AACtE,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,uBAAuB,IAAI,cAAc,EAAE,wBAAwB,IAAI,eAAe,EAAE,MAAM,WAAW,CAAC;AAInH,IAAM,cAAc,GAAG,UAAQ,QAA6C;IAC1E,IAAM,QAAQ,GAAyC,UAAA,KAAK;QAC1D,gCAAgC;QAChC,IAAM,QAAQ,GAAG,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;QAC3C,+GAA+G;QAC/G,IAAM,UAAU,GAAG,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;QAEnC,gFAAgF;QAChF,IAAM,YAAY,GAAG,KAAK,CAAC,MAAM,EAAuB,CAAC;QAEzD,IAAI,CAAC,YAAY,CAAC,OAAO,EAAE;YACzB,YAAY,CAAC,OAAO,GAAG;gBACrB,KAAK,EAAE,QAAQ;gBACf,OAAO,EAAE,UAAU;gBACnB,SAAS,EAAE,EAAE;aACd,CAAC;SACH;QAED,yBAAyB,CAAC;YACxB,QAAQ,CAAC,OAAO,GAAG,KAAK,CAAC,KAAK,CAAC;YA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EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAC5D,cAAc,SAAS,CAAC"}
|
package/lib/types.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":""}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"useContextSelector.js","sourceRoot":"
|
1
|
+
{"version":3,"file":"useContextSelector.js","sourceRoot":"","sources":["../src/useContextSelector.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,yBAAyB,EAAE,MAAM,2BAA2B,CAAC;AACtE,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAa/B;;;;GAIG;AACH,MAAM,CAAC,IAAM,kBAAkB,GAAG,UAChC,OAAuB,EACvB,QAA+C;IAE/C,IAAM,YAAY,GAAG,KAAK,CAAC,UAAU,CAAE,OAAmD,CAAC,CAAC;IAGjF,IAAS,KAAK,GAGrB,YAAY,cAHS,EACH,OAAO,GAEzB,YAAY,gBAFa,EAC3B,SAAS,GACP,YAAY,UADL,CACM;IACjB,IAAM,QAAQ,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC;IAE3B,IAAA,KAAoB,KAAK,CAAC,UAAU,CACxC,UACE,SAAmF,EACnF,OAEoC;QAEpC,IAAI,CAAC,OAAO,EAAE;YACZ,kDAAkD;YAClD,OAAO,CAAC,KAAK,EAAE,QAAQ,CAAU,CAAC;SACnC;QAED,IAAI,OAAO,CAAC,CAAC,CAAC,IAAI,OAAO,EAAE;YACzB,IAAI,QAAQ,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,QAAQ,CAAC,EAAE;gBACpC,OAAO,SAAS,CAAC,CAAC,WAAW;aAC9B;YAED,OAAO,CAAC,KAAK,EA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,EAAE,CAAC,CAAM,EAAE,CAAM;IACxB,OAAO,CACL,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,sCAAsC;KACzG,CAAC;AACJ,CAAC;AAED,8DAA8D;AAC9D,IAAM,QAAQ;AACZ,6DAA6D;AAC7D,2DAA2D;AAC3D,OAAO,MAAM,CAAC,EAAE,KAAK,UAAU,CAAC,CAAC,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"useHasParentContext.js","sourceRoot":"
|
1
|
+
{"version":3,"file":"useHasParentContext.js","sourceRoot":"","sources":["../src/useHasParentContext.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAG/B;;;;;;GAMG;AACH,MAAM,UAAU,mBAAmB,CAAQ,OAAuB;IAChE,IAAM,YAAY,GAAG,KAAK,CAAC,UAAU,CAAE,OAAmD,CAAC,CAAC;IAE5F,IAAI,YAAY,CAAC,OAAO,EAAE;QACxB,OAAO,YAAY,CAAC,OAAO,CAAC,OAAO,KAAK,CAAC,CAAC,CAAC;KAC5C;IAED,OAAO,KAAK,CAAC;AACf,CAAC"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"createContext.js","sourceRoot":"
|
1
|
+
{"version":3,"file":"createContext.js","sourceRoot":"","sources":["../src/createContext.ts"],"names":[],"mappings":";;;AAAA,6DAAsE;AACtE,6BAA+B;AAC/B,uCAAmH;AAInH,IAAM,cAAc,GAAG,UAAQ,QAA6C;IAC1E,IAAM,QAAQ,GAAyC,UAAA,KAAK;QAC1D,gCAAgC;QAChC,IAAM,QAAQ,GAAG,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,KAA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O,EAAE,CAAC,CAAC,EAAE;QACxB,SAAS,EAAE,EAAE;KACd,CAAC,CAAC;IAEH,OAAO,CAAC,QAAQ,GAAG,cAAc,CAAQ,OAAO,CAAC,QAAQ,CAAC,CAAC;IAE3D,gCAAgC;IAChC,OAAS,OAAsC,CAAC,QAAQ,CAAC;IAEzD,OAAQ,OAAqC,CAAC;AAChD,CAAC,CAAC;AAbW,QAAA,aAAa,iBAaxB"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;AAAA,iDAAgD;AAAvC,8GAAA,aAAa,OAAA;AACtB,2DAA0D;AAAjD,wHAAA,kBAAkB,OAAA;AAC3B,6DAA4D;AAAnD,0HAAA,mBAAmB,OAAA;AAC5B,kDAAwB"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":""}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"useContextSelector.js","sourceRoot":"
|
1
|
+
{"version":3,"file":"useContextSelector.js","sourceRoot":"","sources":["../src/useContextSelector.ts"],"names":[],"mappings":";;;AAAA,6DAAsE;AACtE,6BAA+B;AAa/B;;;;GAIG;AACI,IAAM,kBAAkB,GAAG,UAChC,OAAuB,EACvB,QAA+C;IAE/C,IAAM,YAAY,GAAG,KAAK,CAAC,UAAU,CAAE,OAAmD,CAAC,CAAC;IAGjF,IAAS,KAAK,GAGrB,YAAY,cAHS,EACH,OAAO,GAEzB,YAAY,gBAFa,EAC3B,SAAS,GACP,YAAY,UADL,CACM;IACjB,IAAM,QAAQ,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC;IAE3B,IAAA,KAAoB,KAAK,CAAC,UAAU,CACxC,UACE,SAAmF,EACnF,OAEoC;QAEpC,IAAI,CAAC,OAA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,SAAS,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;YAC1C,SAAS,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC;QAC7B,CAAC,CAAC;IACJ,CAAC,EAAE,CAAC,SAAS,CAAC,CAAC,CAAC;IAEhB,OAAO,KAAK,CAAC,CAAC,CAAkB,CAAC;AACnC,CAAC,CAAC;AAvEW,QAAA,kBAAkB,sBAuE7B;AAEF;;;GAGG;AACH,8DAA8D;AAC9D,SAAS,EAAE,CAAC,CAAM,EAAE,CAAM;IACxB,OAAO,CACL,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,sCAAsC;KACzG,CAAC;AACJ,CAAC;AAED,8DAA8D;AAC9D,IAAM,QAAQ;AACZ,6DAA6D;AAC7D,2DAA2D;AAC3D,OAAO,MAAM,CAAC,EAAE,KAAK,UAAU,CAAC,CAAC,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"useHasParentContext.js","sourceRoot":"
|
1
|
+
{"version":3,"file":"useHasParentContext.js","sourceRoot":"","sources":["../src/useHasParentContext.ts"],"names":[],"mappings":";;;AAAA,6BAA+B;AAG/B;;;;;;GAMG;AACH,SAAgB,mBAAmB,CAAQ,OAAuB;IAChE,IAAM,YAAY,GAAG,KAAK,CAAC,UAAU,CAAE,OAAmD,CAAC,CAAC;IAE5F,IAAI,YAAY,CAAC,OAAO,EAAE;QACxB,OAAO,YAAY,CAAC,OAAO,CAAC,OAAO,KAAK,CAAC,CAAC,CAAC;KAC5C;IAED,OAAO,KAAK,CAAC;AACf,CAAC;AARD,kDAQC"}
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@fluentui/react-context-selector",
|
3
|
-
"version": "9.0.0-alpha.
|
3
|
+
"version": "9.0.0-alpha.36",
|
4
4
|
"description": "React useContextSelector hook in userland",
|
5
5
|
"main": "lib-commonjs/index.js",
|
6
6
|
"module": "lib/index.js",
|
@@ -22,7 +22,7 @@
|
|
22
22
|
"build:local": "tsc -p . --module esnext --emitDeclarationOnly && node ../../scripts/typescript/normalize-import --output dist/react-context-selector/src && yarn docs"
|
23
23
|
},
|
24
24
|
"devDependencies": {
|
25
|
-
"@fluentui/eslint-plugin": "
|
25
|
+
"@fluentui/eslint-plugin": "*",
|
26
26
|
"@fluentui/scripts": "^1.0.0",
|
27
27
|
"@types/scheduler": "^0.16.1",
|
28
28
|
"@types/react": "16.9.42",
|
@@ -34,7 +34,7 @@
|
|
34
34
|
"react-test-renderer": "^16.3.0"
|
35
35
|
},
|
36
36
|
"dependencies": {
|
37
|
-
"@fluentui/react-utilities": "9.0.0-alpha.
|
37
|
+
"@fluentui/react-utilities": "9.0.0-alpha.53",
|
38
38
|
"scheduler": "^0.20.1",
|
39
39
|
"tslib": "^2.1.0"
|
40
40
|
},
|
package/lib-amd/createContext.js
DELETED
@@ -1,48 +0,0 @@
|
|
1
|
-
define(["require", "exports", "@fluentui/react-utilities", "react", "scheduler"], function (require, exports, react_utilities_1, React, scheduler_1) {
|
2
|
-
"use strict";
|
3
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
4
|
-
exports.createContext = void 0;
|
5
|
-
var createProvider = function (Original) {
|
6
|
-
var Provider = function (props) {
|
7
|
-
// Holds an actual "props.value"
|
8
|
-
var valueRef = React.useRef(props.value);
|
9
|
-
// Used to sync context updates and avoid stale values, can be considered as render/effect counter of Provider.
|
10
|
-
var versionRef = React.useRef(0);
|
11
|
-
// A stable object, is used to avoid context updates via mutation of its values.
|
12
|
-
var contextValue = React.useRef();
|
13
|
-
if (!contextValue.current) {
|
14
|
-
contextValue.current = {
|
15
|
-
value: valueRef,
|
16
|
-
version: versionRef,
|
17
|
-
listeners: [],
|
18
|
-
};
|
19
|
-
}
|
20
|
-
react_utilities_1.useIsomorphicLayoutEffect(function () {
|
21
|
-
valueRef.current = props.value;
|
22
|
-
versionRef.current += 1;
|
23
|
-
scheduler_1.unstable_runWithPriority(scheduler_1.unstable_NormalPriority, function () {
|
24
|
-
contextValue.current.listeners.forEach(function (listener) {
|
25
|
-
listener([versionRef.current, props.value]);
|
26
|
-
});
|
27
|
-
});
|
28
|
-
}, [props.value]);
|
29
|
-
return React.createElement(Original, { value: contextValue.current }, props.children);
|
30
|
-
};
|
31
|
-
/* istanbul ignore else */
|
32
|
-
|
33
|
-
return Provider;
|
34
|
-
};
|
35
|
-
var createContext = function (defaultValue) {
|
36
|
-
var context = React.createContext({
|
37
|
-
value: { current: defaultValue },
|
38
|
-
version: { current: -1 },
|
39
|
-
listeners: [],
|
40
|
-
});
|
41
|
-
context.Provider = createProvider(context.Provider);
|
42
|
-
// We don't support Consumer API
|
43
|
-
delete context.Consumer;
|
44
|
-
return context;
|
45
|
-
};
|
46
|
-
exports.createContext = createContext;
|
47
|
-
});
|
48
|
-
//# sourceMappingURL=createContext.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"createContext.js","sourceRoot":"../src/","sources":["createContext.ts"],"names":[],"mappings":";;;;IAMA,IAAM,cAAc,GAAG,UAAQ,QAA6C;QAC1E,IAAM,QAAQ,GAAyC,UAAA,KAAK;YAC1D,gCAAgC;YAChC,IAAM,QAAQ,GAAG,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;YAC3C,+GAA+G;YAC/G,IAAM,UAAU,GAAG,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;YAEnC,gFAAgF;YAChF,IAAM,YAAY,GAAG,KAAK,CAAC,MAAM,EAAuB,CAAC;YAEzD,IAAI,CAAC,YAAY,CAAC,OAAO,EAAE;gBACzB,YAAY,CAAC,OAAO,GAAG;oBACrB,K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AbW,QAAA,aAAa,iBAaxB","sourcesContent":["import { useIsomorphicLayoutEffect } from '@fluentui/react-utilities';\nimport * as React from 'react';\nimport { unstable_NormalPriority as NormalPriority, unstable_runWithPriority as runWithPriority } from 'scheduler';\n\nimport { Context, ContextValue } from './types';\n\nconst createProvider = <Value>(Original: React.Provider<ContextValue<Value>>) => {\n const Provider: React.FC<React.ProviderProps<Value>> = props => {\n // Holds an actual \"props.value\"\n const valueRef = React.useRef(props.value);\n // Used to sync context updates and avoid stale values, can be considered as render/effect counter of Provider.\n const versionRef = React.useRef(0);\n\n // A stable object, is used to avoid context updates via mutation of its values.\n const contextValue = React.useRef<ContextValue<Value>>();\n\n if (!contextValue.current) {\n contextValue.current = {\n value: valueRef,\n version: versionRef,\n listeners: [],\n };\n }\n\n useIsomorphicLayoutEffect(() => {\n valueRef.current = props.value;\n versionRef.current += 1;\n\n runWithPriority(NormalPriority, () => {\n (contextValue.current as ContextValue<Value>).listeners.forEach(listener => {\n listener([versionRef.current, props.value]);\n });\n });\n }, [props.value]);\n\n return React.createElement(Original, { value: contextValue.current }, props.children);\n };\n\n /* istanbul ignore else */\n if (process.env.NODE_ENV !== 'production') {\n Provider.displayName = 'ContextSelector.Provider';\n }\n\n return (Provider as unknown) as React.Provider<ContextValue<Value>>;\n};\n\nexport const createContext = <Value>(defaultValue: Value): Context<Value> => {\n const context = React.createContext<ContextValue<Value>>({\n value: { current: defaultValue },\n version: { current: -1 },\n listeners: [],\n });\n\n context.Provider = createProvider<Value>(context.Provider);\n\n // We don't support Consumer API\n delete ((context as unknown) as Context<Value>).Consumer;\n\n return (context as unknown) as Context<Value>;\n};\n"]}
|
package/lib-amd/index.d.ts
DELETED
package/lib-amd/index.js
DELETED
@@ -1,10 +0,0 @@
|
|
1
|
-
define(["require", "exports", "tslib", "./createContext", "./useContextSelector", "./useHasParentContext", "./types"], function (require, exports, tslib_1, createContext_1, useContextSelector_1, useHasParentContext_1, types_1) {
|
2
|
-
"use strict";
|
3
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
4
|
-
exports.useHasParentContext = exports.useContextSelector = exports.createContext = void 0;
|
5
|
-
Object.defineProperty(exports, "createContext", { enumerable: true, get: function () { return createContext_1.createContext; } });
|
6
|
-
Object.defineProperty(exports, "useContextSelector", { enumerable: true, get: function () { return useContextSelector_1.useContextSelector; } });
|
7
|
-
Object.defineProperty(exports, "useHasParentContext", { enumerable: true, get: function () { return useHasParentContext_1.useHasParentContext; } });
|
8
|
-
tslib_1.__exportStar(types_1, exports);
|
9
|
-
});
|
10
|
-
//# sourceMappingURL=index.js.map
|
package/lib-amd/index.js.map
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"../src/","sources":["index.ts"],"names":[],"mappings":";;;;IAAS,8GAAA,aAAa,OAAA;IACb,wHAAA,kBAAkB,OAAA;IAClB,0HAAA,mBAAmB,OAAA;IAC5B,uCAAwB","sourcesContent":["export { createContext } from './createContext';\nexport { useContextSelector } from './useContextSelector';\nexport { useHasParentContext } from './useHasParentContext';\nexport * from './types';\n"]}
|
package/lib-amd/types.d.ts
DELETED
@@ -1,19 +0,0 @@
|
|
1
|
-
import * as React from 'react';
|
2
|
-
export declare type Context<Value> = React.Context<Value> & {
|
3
|
-
Provider: React.FC<React.ProviderProps<Value>>;
|
4
|
-
Consumer: never;
|
5
|
-
};
|
6
|
-
export declare type ContextSelector<Value, SelectedValue> = (value: Value) => SelectedValue;
|
7
|
-
export declare type ContextVersion = number;
|
8
|
-
export declare type ContextValue<Value> = {
|
9
|
-
/** Holds a set of subscribers from components. */
|
10
|
-
listeners: ((payload: readonly [ContextVersion, Value]) => void)[];
|
11
|
-
/** Holds an actual value of React's context that will be propagated down for computations. */
|
12
|
-
value: React.MutableRefObject<Value>;
|
13
|
-
/** A version field is used to sync a context value and consumers. */
|
14
|
-
version: React.MutableRefObject<ContextVersion>;
|
15
|
-
};
|
16
|
-
export declare type ContextValues<Value> = ContextValue<Value> & {
|
17
|
-
/** List of listners to publish changes */
|
18
|
-
listeners: ((payload: readonly [ContextVersion, Record<string, Value>]) => void)[];
|
19
|
-
};
|
package/lib-amd/types.js
DELETED
package/lib-amd/types.js.map
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"../src/","sources":["types.ts"],"names":[],"mappings":"","sourcesContent":["import * as React from 'react';\n\nexport type Context<Value> = React.Context<Value> & {\n Provider: React.FC<React.ProviderProps<Value>>;\n Consumer: never;\n};\n\nexport type ContextSelector<Value, SelectedValue> = (value: Value) => SelectedValue;\n\nexport type ContextVersion = number;\n\nexport type ContextValue<Value> = {\n /** Holds a set of subscribers from components. */\n listeners: ((payload: readonly [ContextVersion, Value]) => void)[];\n\n /** Holds an actual value of React's context that will be propagated down for computations. */\n value: React.MutableRefObject<Value>;\n\n /** A version field is used to sync a context value and consumers. */\n version: React.MutableRefObject<ContextVersion>;\n};\n\nexport type ContextValues<Value> = ContextValue<Value> & {\n /** List of listners to publish changes */\n listeners: ((payload: readonly [ContextVersion, Record<string, Value>]) => void)[];\n};\n"]}
|
@@ -1,7 +0,0 @@
|
|
1
|
-
import { Context, ContextSelector } from './types';
|
2
|
-
/**
|
3
|
-
* This hook returns context selected value by selector.
|
4
|
-
* It will only accept context created by `createContext`.
|
5
|
-
* It will trigger re-render if only the selected value is referencially changed.
|
6
|
-
*/
|
7
|
-
export declare const useContextSelector: <Value, SelectedValue>(context: Context<Value>, selector: ContextSelector<Value, SelectedValue>) => SelectedValue;
|
@@ -1,71 +0,0 @@
|
|
1
|
-
define(["require", "exports", "@fluentui/react-utilities", "react"], function (require, exports, react_utilities_1, React) {
|
2
|
-
"use strict";
|
3
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
4
|
-
exports.useContextSelector = void 0;
|
5
|
-
/**
|
6
|
-
* This hook returns context selected value by selector.
|
7
|
-
* It will only accept context created by `createContext`.
|
8
|
-
* It will trigger re-render if only the selected value is referencially changed.
|
9
|
-
*/
|
10
|
-
var useContextSelector = function (context, selector) {
|
11
|
-
var contextValue = React.useContext(context);
|
12
|
-
var value = contextValue.value.current, version = contextValue.version.current, listeners = contextValue.listeners;
|
13
|
-
var selected = selector(value);
|
14
|
-
var _a = React.useReducer(function (prevState, payload) {
|
15
|
-
if (!payload) {
|
16
|
-
// early bail out when is dispatched during render
|
17
|
-
return [value, selected];
|
18
|
-
}
|
19
|
-
if (payload[0] <= version) {
|
20
|
-
if (objectIs(prevState[1], selected)) {
|
21
|
-
return prevState; // bail out
|
22
|
-
}
|
23
|
-
return [value, selected];
|
24
|
-
}
|
25
|
-
try {
|
26
|
-
if (objectIs(prevState[0], payload[1])) {
|
27
|
-
return prevState; // do not update
|
28
|
-
}
|
29
|
-
var nextSelected = selector(payload[1]);
|
30
|
-
if (objectIs(prevState[1], nextSelected)) {
|
31
|
-
return prevState; // do not update
|
32
|
-
}
|
33
|
-
return [payload[1], nextSelected];
|
34
|
-
}
|
35
|
-
catch (e) {
|
36
|
-
// ignored (stale props or some other reason)
|
37
|
-
}
|
38
|
-
// explicitly spread to enforce typing
|
39
|
-
return [prevState[0], prevState[1]]; // schedule update
|
40
|
-
}, [value, selected]), state = _a[0], dispatch = _a[1];
|
41
|
-
if (!objectIs(state[1], selected)) {
|
42
|
-
// schedule re-render
|
43
|
-
// this is safe because it's self contained
|
44
|
-
dispatch(undefined);
|
45
|
-
}
|
46
|
-
react_utilities_1.useIsomorphicLayoutEffect(function () {
|
47
|
-
listeners.push(dispatch);
|
48
|
-
return function () {
|
49
|
-
var index = listeners.indexOf(dispatch);
|
50
|
-
listeners.splice(index, 1);
|
51
|
-
};
|
52
|
-
}, [listeners]);
|
53
|
-
return state[1];
|
54
|
-
};
|
55
|
-
exports.useContextSelector = useContextSelector;
|
56
|
-
/**
|
57
|
-
* inlined Object.is polyfill to avoid requiring consumers ship their own
|
58
|
-
* https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is
|
59
|
-
*/
|
60
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
61
|
-
function is(x, y) {
|
62
|
-
return ((x === y && (x !== 0 || 1 / x === 1 / y)) || (x !== x && y !== y) // eslint-disable-line no-self-compare
|
63
|
-
);
|
64
|
-
}
|
65
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
66
|
-
var objectIs =
|
67
|
-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
68
|
-
// @ts-ignore fallback to native if it exists (not in IE11)
|
69
|
-
typeof Object.is === 'function' ? Object.is : is;
|
70
|
-
});
|
71
|
-
//# sourceMappingURL=useContextSelector.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"useContextSelector.js","sourceRoot":"../src/","sources":["useContextSelector.ts"],"names":[],"mappings":";;;;IAcA;;;;OAIG;IACI,IAAM,kBAAkB,GAAG,UAChC,OAAuB,EACvB,QAA+C;QAE/C,IAAM,YAAY,GAAG,KAAK,CAAC,UAAU,CAAE,OAAmD,CAAC,CAAC;QAGjF,IAAS,KAAK,GAGrB,YAAY,cAHS,EACH,OAAO,GAEzB,YAAY,gBAFa,EAC3B,SAAS,GACP,YAAY,UADL,CACM;QACjB,IAAM,QAAQ,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC;QAE3B,IAAA,KAAoB,KAAK,CAAC,UAAU,CACxC,UACE,SAAmF,EACnF,OAEoC;YAEpC,IAAI,CAAC,OAAO,EAAE;gBACZ,kDAAkD;gBAClD,OAAO,CAAC,KAAK,EAAE,QAAQ,CAAU,CAAC;aACnC;YAED,IAAI,OAAO,CAAC,CAAC,CAAC,IAAI,OAAO,EAAE;gBACzB,IAAI,QAAQ,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,QAAQ,CAAC,EAAE;oBACpC,OAAO,SAAS,CAAC,CAAC,WAAW;iBAC9B;gBAED,OAAO,CAAC,KAAK,EAAE,QAAQ,CAAU,CAAC;aACnC;YAED,IAAI;gBACF,IAAI,QAAQ,CAAC,SAAS,CAAC,CA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OAAO,CACL,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,sCAAsC;SACzG,CAAC;IACJ,CAAC;IAED,8DAA8D;IAC9D,IAAM,QAAQ;IACZ,6DAA6D;IAC7D,2DAA2D;IAC3D,OAAO,MAAM,CAAC,EAAE,KAAK,UAAU,CAAC,CAAC,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC","sourcesContent":["import { useIsomorphicLayoutEffect } from '@fluentui/react-utilities';\nimport * as React from 'react';\n\nimport { Context, ContextSelector, ContextValue, ContextVersion } from './types';\n\n/**\n * Narrowing React.Reducer type to be more easily usable below.\n * No need to export this as it's for internal reducer usage.\n */\ntype ContextReducer<Value, SelectedValue> = React.Reducer<\n readonly [Value, SelectedValue],\n undefined | readonly [ContextVersion, Value]\n>;\n\n/**\n * This hook returns context selected value by selector.\n * It will only accept context created by `createContext`.\n * It will trigger re-render if only the selected value is referencially changed.\n */\nexport const useContextSelector = <Value, SelectedValue>(\n context: Context<Value>,\n selector: ContextSelector<Value, SelectedValue>,\n): SelectedValue => {\n const contextValue = React.useContext((context as unknown) as Context<ContextValue<Value>>);\n\n const {\n value: { current: value },\n version: { current: version },\n listeners,\n } = contextValue;\n const selected = selector(value);\n\n const [state, dispatch] = React.useReducer<ContextReducer<Value, SelectedValue>>(\n (\n prevState: readonly [Value /* contextValue */, SelectedValue /* selector(value) */],\n payload:\n | undefined // undefined from render below\n | readonly [ContextVersion, Value], // from provider effect\n ): readonly [Value, SelectedValue] => {\n if (!payload) {\n // early bail out when is dispatched during render\n return [value, selected] as const;\n }\n\n if (payload[0] <= version) {\n if (objectIs(prevState[1], selected)) {\n return prevState; // bail out\n }\n\n return [value, selected] as const;\n }\n\n try {\n if (objectIs(prevState[0], payload[1])) {\n return prevState; // do not update\n }\n\n const nextSelected = selector(payload[1]);\n\n if (objectIs(prevState[1], nextSelected)) {\n return prevState; // do not update\n }\n\n return [payload[1], nextSelected] as const;\n } catch (e) {\n // ignored (stale props or some other reason)\n }\n\n // explicitly spread to enforce typing\n return [prevState[0], prevState[1]] as const; // schedule update\n },\n [value, selected] as const,\n );\n\n if (!objectIs(state[1], selected)) {\n // schedule re-render\n // this is safe because it's self contained\n dispatch(undefined);\n }\n\n useIsomorphicLayoutEffect(() => {\n listeners.push(dispatch);\n\n return () => {\n const index = listeners.indexOf(dispatch);\n listeners.splice(index, 1);\n };\n }, [listeners]);\n\n return state[1] as SelectedValue;\n};\n\n/**\n * inlined Object.is polyfill to avoid requiring consumers ship their own\n * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is\n */\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nfunction is(x: any, y: any) {\n return (\n (x === y && (x !== 0 || 1 / x === 1 / y)) || (x !== x && y !== y) // eslint-disable-line no-self-compare\n );\n}\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nconst objectIs: (x: any, y: any) => boolean =\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore fallback to native if it exists (not in IE11)\n typeof Object.is === 'function' ? Object.is : is;\n"]}
|
@@ -1,9 +0,0 @@
|
|
1
|
-
import { Context } from './types';
|
2
|
-
/**
|
3
|
-
* Utility hook for contexts created by react-context-selector to determine if a parent context exists
|
4
|
-
* WARNING: This hook will not work for native React contexts
|
5
|
-
*
|
6
|
-
* @param context - context created by react-context-selector
|
7
|
-
* @returns whether the hook is wrapped by a parent context
|
8
|
-
*/
|
9
|
-
export declare function useHasParentContext<Value>(context: Context<Value>): boolean;
|
@@ -1,21 +0,0 @@
|
|
1
|
-
define(["require", "exports", "react"], function (require, exports, React) {
|
2
|
-
"use strict";
|
3
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
4
|
-
exports.useHasParentContext = void 0;
|
5
|
-
/**
|
6
|
-
* Utility hook for contexts created by react-context-selector to determine if a parent context exists
|
7
|
-
* WARNING: This hook will not work for native React contexts
|
8
|
-
*
|
9
|
-
* @param context - context created by react-context-selector
|
10
|
-
* @returns whether the hook is wrapped by a parent context
|
11
|
-
*/
|
12
|
-
function useHasParentContext(context) {
|
13
|
-
var contextValue = React.useContext(context);
|
14
|
-
if (contextValue.version) {
|
15
|
-
return contextValue.version.current !== -1;
|
16
|
-
}
|
17
|
-
return false;
|
18
|
-
}
|
19
|
-
exports.useHasParentContext = useHasParentContext;
|
20
|
-
});
|
21
|
-
//# sourceMappingURL=useHasParentContext.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"useHasParentContext.js","sourceRoot":"../src/","sources":["useHasParentContext.ts"],"names":[],"mappings":";;;;IAGA;;;;;;OAMG;IACH,SAAgB,mBAAmB,CAAQ,OAAuB;QAChE,IAAM,YAAY,GAAG,KAAK,CAAC,UAAU,CAAE,OAAmD,CAAC,CAAC;QAE5F,IAAI,YAAY,CAAC,OAAO,EAAE;YACxB,OAAO,YAAY,CAAC,OAAO,CAAC,OAAO,KAAK,CAAC,CAAC,CAAC;SAC5C;QAED,OAAO,KAAK,CAAC;IACf,CAAC;IARD,kDAQC","sourcesContent":["import * as React from 'react';\nimport { Context, ContextValue } from './types';\n\n/**\n * Utility hook for contexts created by react-context-selector to determine if a parent context exists\n * WARNING: This hook will not work for native React contexts\n *\n * @param context - context created by react-context-selector\n * @returns whether the hook is wrapped by a parent context\n */\nexport function useHasParentContext<Value>(context: Context<Value>) {\n const contextValue = React.useContext((context as unknown) as Context<ContextValue<Value>>);\n\n if (contextValue.version) {\n return contextValue.version.current !== -1;\n }\n\n return false;\n}\n"]}
|