@fluentui/react-context-selector 9.0.0-nightly.d730088d7f.0 → 9.0.0-rc.10
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 +282 -8
- package/CHANGELOG.md +154 -48
- package/dist/{react-context-selector.d.ts → index.d.ts} +0 -0
- package/{lib → dist}/tsdoc-metadata.json +0 -0
- package/lib/createContext.js +53 -40
- package/lib/createContext.js.map +1 -1
- package/lib/index.js +0 -1
- package/lib/index.js.map +1 -1
- package/lib/types.js.map +1 -1
- package/lib/useContextSelector.js +66 -49
- package/lib/useContextSelector.js.map +1 -1
- package/lib/useHasParentContext.js +8 -5
- package/lib/useHasParentContext.js.map +1 -1
- package/lib-commonjs/createContext.js +64 -44
- package/lib-commonjs/createContext.js.map +1 -1
- package/lib-commonjs/index.js +31 -9
- package/lib-commonjs/index.js.map +1 -1
- package/lib-commonjs/types.js +4 -1
- package/lib-commonjs/types.js.map +1 -1
- package/lib-commonjs/useContextSelector.js +76 -52
- package/lib-commonjs/useContextSelector.js.map +1 -1
- package/lib-commonjs/useHasParentContext.js +16 -7
- package/lib-commonjs/useHasParentContext.js.map +1 -1
- package/package.json +19 -20
- package/lib/createContext.d.ts +0 -2
- package/lib/index.d.ts +0 -4
- package/lib/types.d.ts +0 -19
- package/lib/useContextSelector.d.ts +0 -7
- package/lib/useHasParentContext.d.ts +0 -9
- package/lib-commonjs/createContext.d.ts +0 -2
- package/lib-commonjs/index.d.ts +0 -4
- package/lib-commonjs/types.d.ts +0 -19
- package/lib-commonjs/useContextSelector.d.ts +0 -7
- package/lib-commonjs/useHasParentContext.d.ts +0 -9
package/CHANGELOG.md
CHANGED
@@ -1,22 +1,128 @@
|
|
1
1
|
# Change Log - @fluentui/react-context-selector
|
2
2
|
|
3
|
-
This log was last generated on
|
3
|
+
This log was last generated on Tue, 31 May 2022 21:26:44 GMT and should not be manually modified.
|
4
4
|
|
5
5
|
<!-- Start content -->
|
6
6
|
|
7
|
-
## [9.0.0-
|
7
|
+
## [9.0.0-rc.10](https://github.com/microsoft/fluentui/tree/@fluentui/react-context-selector_v9.0.0-rc.10)
|
8
8
|
|
9
|
-
|
10
|
-
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-context-selector_v9.0.0-
|
9
|
+
Tue, 31 May 2022 21:26:44 GMT
|
10
|
+
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-context-selector_v9.0.0-rc.9..@fluentui/react-context-selector_v9.0.0-rc.10)
|
11
11
|
|
12
12
|
### Changes
|
13
13
|
|
14
|
-
-
|
15
|
-
|
14
|
+
- Bump @fluentui/react-utilities to v9.0.0-rc.10 ([PR #23325](https://github.com/microsoft/fluentui/pull/23325) by beachball)
|
15
|
+
|
16
|
+
## [9.0.0-rc.9](https://github.com/microsoft/fluentui/tree/@fluentui/react-context-selector_v9.0.0-rc.9)
|
17
|
+
|
18
|
+
Mon, 23 May 2022 12:14:24 GMT
|
19
|
+
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-context-selector_v9.0.0-rc.8..@fluentui/react-context-selector_v9.0.0-rc.9)
|
20
|
+
|
21
|
+
### Changes
|
22
|
+
|
23
|
+
- Bump @fluentui/react-utilities to v9.0.0-rc.9 ([PR #23030](https://github.com/microsoft/fluentui/pull/23030) by beachball)
|
24
|
+
|
25
|
+
## [9.0.0-rc.8](https://github.com/microsoft/fluentui/tree/@fluentui/react-context-selector_v9.0.0-rc.8)
|
26
|
+
|
27
|
+
Thu, 05 May 2022 18:26:23 GMT
|
28
|
+
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-context-selector_v9.0.0-rc.7..@fluentui/react-context-selector_v9.0.0-rc.8)
|
29
|
+
|
30
|
+
### Changes
|
31
|
+
|
32
|
+
- feat: ship rolluped only dts ([PR #22823](https://github.com/microsoft/fluentui/pull/22823) by martinhochel@microsoft.com)
|
33
|
+
- Removing star exports. ([PR #22801](https://github.com/microsoft/fluentui/pull/22801) by humberto_makoto@hotmail.com)
|
34
|
+
- Bump @fluentui/react-utilities to v9.0.0-rc.8 ([PR #22857](https://github.com/microsoft/fluentui/pull/22857) by beachball)
|
35
|
+
|
36
|
+
## [9.0.0-rc.7](https://github.com/microsoft/fluentui/tree/@fluentui/react-context-selector_v9.0.0-rc.7)
|
37
|
+
|
38
|
+
Wed, 04 May 2022 13:26:42 GMT
|
39
|
+
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-context-selector_v9.0.0-rc.6..@fluentui/react-context-selector_v9.0.0-rc.7)
|
40
|
+
|
41
|
+
### Changes
|
42
|
+
|
43
|
+
- Bump @fluentui/react-utilities to v9.0.0-rc.7 ([PR #22786](https://github.com/microsoft/fluentui/pull/22786) by beachball)
|
44
|
+
|
45
|
+
## [9.0.0-rc.6](https://github.com/microsoft/fluentui/tree/@fluentui/react-context-selector_v9.0.0-rc.6)
|
46
|
+
|
47
|
+
Tue, 19 Apr 2022 19:17:22 GMT
|
48
|
+
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-context-selector_v9.0.0-rc.5..@fluentui/react-context-selector_v9.0.0-rc.6)
|
49
|
+
|
50
|
+
### Changes
|
51
|
+
|
52
|
+
- Move `scheduler` to a peer dependency and allow appropriate versions for React 16 or 17 ([PR #21769](https://github.com/microsoft/fluentui/pull/21769) by elcraig@microsoft.com)
|
53
|
+
- Bump @fluentui/react-utilities to v9.0.0-rc.6 ([PR #21995](https://github.com/microsoft/fluentui/pull/21995) by beachball)
|
54
|
+
|
55
|
+
## [9.0.0-rc.5](https://github.com/microsoft/fluentui/tree/@fluentui/react-context-selector_v9.0.0-rc.5)
|
56
|
+
|
57
|
+
Fri, 04 Mar 2022 05:17:36 GMT
|
58
|
+
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-context-selector_v9.0.0-rc.4..@fluentui/react-context-selector_v9.0.0-rc.5)
|
59
|
+
|
60
|
+
### Changes
|
61
|
+
|
62
|
+
- Adding explicit export maps on all consumer packages for FUIR 8 and 9. ([PR #21508](https://github.com/microsoft/fluentui/pull/21508) by dzearing@microsoft.com)
|
63
|
+
- Bump @fluentui/react-utilities to v9.0.0-rc.5 ([PR #21947](https://github.com/microsoft/fluentui/pull/21947) by beachball)
|
64
|
+
|
65
|
+
## [9.0.0-rc.4](https://github.com/microsoft/fluentui/tree/@fluentui/react-context-selector_v9.0.0-rc.4)
|
66
|
+
|
67
|
+
Tue, 01 Mar 2022 02:17:40 GMT
|
68
|
+
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-context-selector_v9.0.0-rc.3..@fluentui/react-context-selector_v9.0.0-rc.4)
|
69
|
+
|
70
|
+
### Changes
|
71
|
+
|
72
|
+
- Bump @fluentui/react-utilities to v9.0.0-rc.4 ([PR #21884](https://github.com/microsoft/fluentui/pull/21884) by beachball)
|
73
|
+
|
74
|
+
## [9.0.0-rc.3](https://github.com/microsoft/fluentui/tree/@fluentui/react-context-selector_v9.0.0-rc.3)
|
75
|
+
|
76
|
+
Fri, 18 Feb 2022 13:35:31 GMT
|
77
|
+
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-context-selector_v9.0.0-rc.1..@fluentui/react-context-selector_v9.0.0-rc.3)
|
78
|
+
|
79
|
+
### Changes
|
80
|
+
|
81
|
+
- fix: Source maps contain original source code ([PR #21690](https://github.com/microsoft/fluentui/pull/21690) by lingfangao@hotmail.com)
|
82
|
+
- Bump @fluentui/react-utilities to v9.0.0-rc.3 ([PR #21800](https://github.com/microsoft/fluentui/pull/21800) by beachball)
|
83
|
+
|
84
|
+
## [9.0.0-rc.1](https://github.com/microsoft/fluentui/tree/@fluentui/react-context-selector_v9.0.0-rc.1)
|
85
|
+
|
86
|
+
Thu, 10 Feb 2022 08:51:09 GMT
|
87
|
+
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-context-selector_v9.0.0-beta.4..@fluentui/react-context-selector_v9.0.0-rc.1)
|
88
|
+
|
89
|
+
### Changes
|
90
|
+
|
91
|
+
- Bump Fluent UI packages to 9.0.0-rc ([PR #21623](https://github.com/microsoft/fluentui/pull/21623) by lingfangao@hotmail.com)
|
92
|
+
- Allow React 17 in peerDependencies. ([PR #21544](https://github.com/microsoft/fluentui/pull/21544) by tristan.watanabe@gmail.com)
|
93
|
+
- Bump @fluentui/react-utilities to v9.0.0-rc.1 ([commit](https://github.com/microsoft/fluentui/commit/e6c855f6d9019d6c73668d15fc9bc3a13291a6c8) by beachball)
|
94
|
+
|
95
|
+
## [9.0.0-beta.4](https://github.com/microsoft/fluentui/tree/@fluentui/react-context-selector_v9.0.0-beta.4)
|
96
|
+
|
97
|
+
Thu, 25 Nov 2021 08:34:13 GMT
|
98
|
+
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-context-selector_v9.0.0-beta.3..@fluentui/react-context-selector_v9.0.0-beta.4)
|
99
|
+
|
100
|
+
### Changes
|
101
|
+
|
102
|
+
- Bump @fluentui/react-utilities to v9.0.0-beta.4 ([PR #20762](https://github.com/microsoft/fluentui/pull/20762) by beachball)
|
103
|
+
|
104
|
+
## [9.0.0-beta.3](https://github.com/microsoft/fluentui/tree/@fluentui/react-context-selector_v9.0.0-beta.3)
|
105
|
+
|
106
|
+
Fri, 12 Nov 2021 13:25:22 GMT
|
107
|
+
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-context-selector_v9.0.0-beta.2..@fluentui/react-context-selector_v9.0.0-beta.3)
|
108
|
+
|
109
|
+
### Changes
|
110
|
+
|
111
|
+
- Updated beta and RC components to ES2019 ([PR #20405](https://github.com/microsoft/fluentui/pull/20405) by gcox@microsoft.com)
|
112
|
+
- Bump @fluentui/react-utilities to v9.0.0-beta.3 ([PR #20583](https://github.com/microsoft/fluentui/pull/20583) by beachball)
|
113
|
+
|
114
|
+
## [9.0.0-beta.2](https://github.com/microsoft/fluentui/tree/@fluentui/react-context-selector_v9.0.0-beta.2)
|
115
|
+
|
116
|
+
Wed, 27 Oct 2021 12:14:24 GMT
|
117
|
+
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-context-selector_v9.0.0-beta.1..@fluentui/react-context-selector_v9.0.0-beta.2)
|
118
|
+
|
119
|
+
### Changes
|
120
|
+
|
121
|
+
- Bump @fluentui/react-utilities to v9.0.0-beta.2 ([PR #20353](https://github.com/microsoft/fluentui/pull/20353) by beachball)
|
16
122
|
|
17
123
|
## [9.0.0-beta.1](https://github.com/microsoft/fluentui/tree/@fluentui/react-context-selector_v9.0.0-beta.1)
|
18
124
|
|
19
|
-
Wed, 06 Oct 2021 10:37:22 GMT
|
125
|
+
Wed, 06 Oct 2021 10:37:22 GMT
|
20
126
|
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-context-selector_v9.0.0-alpha.39..@fluentui/react-context-selector_v9.0.0-beta.1)
|
21
127
|
|
22
128
|
### Changes
|
@@ -26,7 +132,7 @@ Wed, 06 Oct 2021 10:37:22 GMT
|
|
26
132
|
|
27
133
|
## [9.0.0-alpha.39](https://github.com/microsoft/fluentui/tree/@fluentui/react-context-selector_v9.0.0-alpha.39)
|
28
134
|
|
29
|
-
Tue, 05 Oct 2021 09:28:07 GMT
|
135
|
+
Tue, 05 Oct 2021 09:28:07 GMT
|
30
136
|
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-context-selector_v9.0.0-alpha.38..@fluentui/react-context-selector_v9.0.0-alpha.39)
|
31
137
|
|
32
138
|
### Changes
|
@@ -35,7 +141,7 @@ Tue, 05 Oct 2021 09:28:07 GMT
|
|
35
141
|
|
36
142
|
## [9.0.0-alpha.38](https://github.com/microsoft/fluentui/tree/@fluentui/react-context-selector_v9.0.0-alpha.38)
|
37
143
|
|
38
|
-
Fri, 01 Oct 2021 14:13:08 GMT
|
144
|
+
Fri, 01 Oct 2021 14:13:08 GMT
|
39
145
|
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-context-selector_v9.0.0-alpha.36..@fluentui/react-context-selector_v9.0.0-alpha.38)
|
40
146
|
|
41
147
|
### Changes
|
@@ -45,7 +151,7 @@ Fri, 01 Oct 2021 14:13:08 GMT
|
|
45
151
|
|
46
152
|
## [9.0.0-alpha.36](https://github.com/microsoft/fluentui/tree/@fluentui/react-context-selector_v9.0.0-alpha.36)
|
47
153
|
|
48
|
-
Mon, 27 Sep 2021 08:06:00 GMT
|
154
|
+
Mon, 27 Sep 2021 08:06:00 GMT
|
49
155
|
[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)
|
50
156
|
|
51
157
|
### Changes
|
@@ -54,7 +160,7 @@ Mon, 27 Sep 2021 08:06:00 GMT
|
|
54
160
|
|
55
161
|
## [9.0.0-alpha.35](https://github.com/microsoft/fluentui/tree/@fluentui/react-context-selector_v9.0.0-alpha.35)
|
56
162
|
|
57
|
-
Fri, 24 Sep 2021 09:17:17 GMT
|
163
|
+
Fri, 24 Sep 2021 09:17:17 GMT
|
58
164
|
[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)
|
59
165
|
|
60
166
|
### Changes
|
@@ -63,7 +169,7 @@ Fri, 24 Sep 2021 09:17:17 GMT
|
|
63
169
|
|
64
170
|
## [9.0.0-alpha.34](https://github.com/microsoft/fluentui/tree/@fluentui/react-context-selector_v9.0.0-alpha.34)
|
65
171
|
|
66
|
-
Thu, 23 Sep 2021 08:21:34 GMT
|
172
|
+
Thu, 23 Sep 2021 08:21:34 GMT
|
67
173
|
[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)
|
68
174
|
|
69
175
|
### Changes
|
@@ -72,7 +178,7 @@ Thu, 23 Sep 2021 08:21:34 GMT
|
|
72
178
|
|
73
179
|
## [9.0.0-alpha.33](https://github.com/microsoft/fluentui/tree/@fluentui/react-context-selector_v9.0.0-alpha.33)
|
74
180
|
|
75
|
-
Wed, 22 Sep 2021 10:10:07 GMT
|
181
|
+
Wed, 22 Sep 2021 10:10:07 GMT
|
76
182
|
[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)
|
77
183
|
|
78
184
|
### Changes
|
@@ -81,7 +187,7 @@ Wed, 22 Sep 2021 10:10:07 GMT
|
|
81
187
|
|
82
188
|
## [9.0.0-alpha.32](https://github.com/microsoft/fluentui/tree/@fluentui/react-context-selector_v9.0.0-alpha.32)
|
83
189
|
|
84
|
-
Fri, 17 Sep 2021 07:35:26 GMT
|
190
|
+
Fri, 17 Sep 2021 07:35:26 GMT
|
85
191
|
[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)
|
86
192
|
|
87
193
|
### Changes
|
@@ -90,7 +196,7 @@ Fri, 17 Sep 2021 07:35:26 GMT
|
|
90
196
|
|
91
197
|
## [9.0.0-alpha.31](https://github.com/microsoft/fluentui/tree/@fluentui/react-context-selector_v9.0.0-alpha.31)
|
92
198
|
|
93
|
-
Thu, 16 Sep 2021 07:38:39 GMT
|
199
|
+
Thu, 16 Sep 2021 07:38:39 GMT
|
94
200
|
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-context-selector_v9.0.0-alpha.30..@fluentui/react-context-selector_v9.0.0-alpha.31)
|
95
201
|
|
96
202
|
### Changes
|
@@ -99,7 +205,7 @@ Thu, 16 Sep 2021 07:38:39 GMT
|
|
99
205
|
|
100
206
|
## [9.0.0-alpha.30](https://github.com/microsoft/fluentui/tree/@fluentui/react-context-selector_v9.0.0-alpha.30)
|
101
207
|
|
102
|
-
Tue, 14 Sep 2021 20:09:02 GMT
|
208
|
+
Tue, 14 Sep 2021 20:09:02 GMT
|
103
209
|
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-context-selector_v9.0.0-alpha.29..@fluentui/react-context-selector_v9.0.0-alpha.30)
|
104
210
|
|
105
211
|
### Changes
|
@@ -108,7 +214,7 @@ Tue, 14 Sep 2021 20:09:02 GMT
|
|
108
214
|
|
109
215
|
## [9.0.0-alpha.29](https://github.com/microsoft/fluentui/tree/@fluentui/react-context-selector_v9.0.0-alpha.29)
|
110
216
|
|
111
|
-
Fri, 10 Sep 2021 16:31:53 GMT
|
217
|
+
Fri, 10 Sep 2021 16:31:53 GMT
|
112
218
|
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-context-selector_v9.0.0-alpha.28..@fluentui/react-context-selector_v9.0.0-alpha.29)
|
113
219
|
|
114
220
|
### Changes
|
@@ -118,7 +224,7 @@ Fri, 10 Sep 2021 16:31:53 GMT
|
|
118
224
|
|
119
225
|
## [9.0.0-alpha.28](https://github.com/microsoft/fluentui/tree/@fluentui/react-context-selector_v9.0.0-alpha.28)
|
120
226
|
|
121
|
-
Fri, 10 Sep 2021 07:39:51 GMT
|
227
|
+
Fri, 10 Sep 2021 07:39:51 GMT
|
122
228
|
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-context-selector_v9.0.0-alpha.27..@fluentui/react-context-selector_v9.0.0-alpha.28)
|
123
229
|
|
124
230
|
### Changes
|
@@ -127,7 +233,7 @@ Fri, 10 Sep 2021 07:39:51 GMT
|
|
127
233
|
|
128
234
|
## [9.0.0-alpha.27](https://github.com/microsoft/fluentui/tree/@fluentui/react-context-selector_v9.0.0-alpha.27)
|
129
235
|
|
130
|
-
Mon, 06 Sep 2021 07:34:53 GMT
|
236
|
+
Mon, 06 Sep 2021 07:34:53 GMT
|
131
237
|
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-context-selector_v9.0.0-alpha.26..@fluentui/react-context-selector_v9.0.0-alpha.27)
|
132
238
|
|
133
239
|
### Changes
|
@@ -136,7 +242,7 @@ Mon, 06 Sep 2021 07:34:53 GMT
|
|
136
242
|
|
137
243
|
## [9.0.0-alpha.26](https://github.com/microsoft/fluentui/tree/@fluentui/react-context-selector_v9.0.0-alpha.26)
|
138
244
|
|
139
|
-
Wed, 01 Sep 2021 07:39:56 GMT
|
245
|
+
Wed, 01 Sep 2021 07:39:56 GMT
|
140
246
|
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-context-selector_v9.0.0-alpha.25..@fluentui/react-context-selector_v9.0.0-alpha.26)
|
141
247
|
|
142
248
|
### Changes
|
@@ -145,7 +251,7 @@ Wed, 01 Sep 2021 07:39:56 GMT
|
|
145
251
|
|
146
252
|
## [9.0.0-alpha.25](https://github.com/microsoft/fluentui/tree/@fluentui/react-context-selector_v9.0.0-alpha.25)
|
147
253
|
|
148
|
-
Tue, 31 Aug 2021 07:37:47 GMT
|
254
|
+
Tue, 31 Aug 2021 07:37:47 GMT
|
149
255
|
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-context-selector_v9.0.0-alpha.24..@fluentui/react-context-selector_v9.0.0-alpha.25)
|
150
256
|
|
151
257
|
### Changes
|
@@ -154,7 +260,7 @@ Tue, 31 Aug 2021 07:37:47 GMT
|
|
154
260
|
|
155
261
|
## [9.0.0-alpha.24](https://github.com/microsoft/fluentui/tree/@fluentui/react-context-selector_v9.0.0-alpha.24)
|
156
262
|
|
157
|
-
Fri, 20 Aug 2021 07:37:28 GMT
|
263
|
+
Fri, 20 Aug 2021 07:37:28 GMT
|
158
264
|
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-context-selector_v9.0.0-alpha.23..@fluentui/react-context-selector_v9.0.0-alpha.24)
|
159
265
|
|
160
266
|
### Changes
|
@@ -163,7 +269,7 @@ Fri, 20 Aug 2021 07:37:28 GMT
|
|
163
269
|
|
164
270
|
## [9.0.0-alpha.23](https://github.com/microsoft/fluentui/tree/@fluentui/react-context-selector_v9.0.0-alpha.23)
|
165
271
|
|
166
|
-
Thu, 19 Aug 2021 07:41:35 GMT
|
272
|
+
Thu, 19 Aug 2021 07:41:35 GMT
|
167
273
|
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-context-selector_v9.0.0-alpha.22..@fluentui/react-context-selector_v9.0.0-alpha.23)
|
168
274
|
|
169
275
|
### Changes
|
@@ -172,7 +278,7 @@ Thu, 19 Aug 2021 07:41:35 GMT
|
|
172
278
|
|
173
279
|
## [9.0.0-alpha.22](https://github.com/microsoft/fluentui/tree/@fluentui/react-context-selector_v9.0.0-alpha.22)
|
174
280
|
|
175
|
-
Fri, 06 Aug 2021 07:35:14 GMT
|
281
|
+
Fri, 06 Aug 2021 07:35:14 GMT
|
176
282
|
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-context-selector_v9.0.0-alpha.21..@fluentui/react-context-selector_v9.0.0-alpha.22)
|
177
283
|
|
178
284
|
### Changes
|
@@ -181,7 +287,7 @@ Fri, 06 Aug 2021 07:35:14 GMT
|
|
181
287
|
|
182
288
|
## [9.0.0-alpha.21](https://github.com/microsoft/fluentui/tree/@fluentui/react-context-selector_v9.0.0-alpha.21)
|
183
289
|
|
184
|
-
Tue, 03 Aug 2021 07:39:30 GMT
|
290
|
+
Tue, 03 Aug 2021 07:39:30 GMT
|
185
291
|
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-context-selector_v9.0.0-alpha.20..@fluentui/react-context-selector_v9.0.0-alpha.21)
|
186
292
|
|
187
293
|
### Patches
|
@@ -195,7 +301,7 @@ Tue, 03 Aug 2021 07:39:30 GMT
|
|
195
301
|
|
196
302
|
## [9.0.0-alpha.20](https://github.com/microsoft/fluentui/tree/@fluentui/react-context-selector_v9.0.0-alpha.20)
|
197
303
|
|
198
|
-
Mon, 02 Aug 2021 07:36:20 GMT
|
304
|
+
Mon, 02 Aug 2021 07:36:20 GMT
|
199
305
|
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-context-selector_v9.0.0-alpha.19..@fluentui/react-context-selector_v9.0.0-alpha.20)
|
200
306
|
|
201
307
|
### Changes
|
@@ -204,7 +310,7 @@ Mon, 02 Aug 2021 07:36:20 GMT
|
|
204
310
|
|
205
311
|
## [9.0.0-alpha.19](https://github.com/microsoft/fluentui/tree/@fluentui/react-context-selector_v9.0.0-alpha.19)
|
206
312
|
|
207
|
-
Fri, 23 Jul 2021 07:38:19 GMT
|
313
|
+
Fri, 23 Jul 2021 07:38:19 GMT
|
208
314
|
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-context-selector_v9.0.0-alpha.18..@fluentui/react-context-selector_v9.0.0-alpha.19)
|
209
315
|
|
210
316
|
### Changes
|
@@ -213,7 +319,7 @@ Fri, 23 Jul 2021 07:38:19 GMT
|
|
213
319
|
|
214
320
|
## [9.0.0-alpha.18](https://github.com/microsoft/fluentui/tree/@fluentui/react-context-selector_v9.0.0-alpha.18)
|
215
321
|
|
216
|
-
Thu, 22 Jul 2021 07:36:55 GMT
|
322
|
+
Thu, 22 Jul 2021 07:36:55 GMT
|
217
323
|
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-context-selector_v9.0.0-alpha.17..@fluentui/react-context-selector_v9.0.0-alpha.18)
|
218
324
|
|
219
325
|
### Changes
|
@@ -222,7 +328,7 @@ Thu, 22 Jul 2021 07:36:55 GMT
|
|
222
328
|
|
223
329
|
## [9.0.0-alpha.17](https://github.com/microsoft/fluentui/tree/@fluentui/react-context-selector_v9.0.0-alpha.17)
|
224
330
|
|
225
|
-
Thu, 15 Jul 2021 07:36:18 GMT
|
331
|
+
Thu, 15 Jul 2021 07:36:18 GMT
|
226
332
|
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-context-selector_v9.0.0-alpha.16..@fluentui/react-context-selector_v9.0.0-alpha.17)
|
227
333
|
|
228
334
|
### Changes
|
@@ -231,7 +337,7 @@ Thu, 15 Jul 2021 07:36:18 GMT
|
|
231
337
|
|
232
338
|
## [9.0.0-alpha.16](https://github.com/microsoft/fluentui/tree/@fluentui/react-context-selector_v9.0.0-alpha.16)
|
233
339
|
|
234
|
-
Fri, 09 Jul 2021 07:39:31 GMT
|
340
|
+
Fri, 09 Jul 2021 07:39:31 GMT
|
235
341
|
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-context-selector_v9.0.0-alpha.15..@fluentui/react-context-selector_v9.0.0-alpha.16)
|
236
342
|
|
237
343
|
### Patches
|
@@ -245,7 +351,7 @@ Fri, 09 Jul 2021 07:39:31 GMT
|
|
245
351
|
|
246
352
|
## [9.0.0-alpha.15](https://github.com/microsoft/fluentui/tree/@fluentui/react-context-selector_v9.0.0-alpha.15)
|
247
353
|
|
248
|
-
Fri, 02 Jul 2021 23:15:55 GMT
|
354
|
+
Fri, 02 Jul 2021 23:15:55 GMT
|
249
355
|
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-context-selector_v9.0.0-alpha.14..@fluentui/react-context-selector_v9.0.0-alpha.15)
|
250
356
|
|
251
357
|
### Changes
|
@@ -254,7 +360,7 @@ Fri, 02 Jul 2021 23:15:55 GMT
|
|
254
360
|
|
255
361
|
## [9.0.0-alpha.14](https://github.com/microsoft/fluentui/tree/@fluentui/react-context-selector_v9.0.0-alpha.14)
|
256
362
|
|
257
|
-
Fri, 02 Jul 2021 07:37:06 GMT
|
363
|
+
Fri, 02 Jul 2021 07:37:06 GMT
|
258
364
|
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-context-selector_v9.0.0-alpha.13..@fluentui/react-context-selector_v9.0.0-alpha.14)
|
259
365
|
|
260
366
|
### Changes
|
@@ -263,7 +369,7 @@ Fri, 02 Jul 2021 07:37:06 GMT
|
|
263
369
|
|
264
370
|
## [9.0.0-alpha.13](https://github.com/microsoft/fluentui/tree/@fluentui/react-context-selector_v9.0.0-alpha.13)
|
265
371
|
|
266
|
-
Tue, 15 Jun 2021 07:40:20 GMT
|
372
|
+
Tue, 15 Jun 2021 07:40:20 GMT
|
267
373
|
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-context-selector_v9.0.0-alpha.12..@fluentui/react-context-selector_v9.0.0-alpha.13)
|
268
374
|
|
269
375
|
### Changes
|
@@ -272,7 +378,7 @@ Tue, 15 Jun 2021 07:40:20 GMT
|
|
272
378
|
|
273
379
|
## [9.0.0-alpha.12](https://github.com/microsoft/fluentui/tree/@fluentui/react-context-selector_v9.0.0-alpha.12)
|
274
380
|
|
275
|
-
Mon, 07 Jun 2021 07:38:15 GMT
|
381
|
+
Mon, 07 Jun 2021 07:38:15 GMT
|
276
382
|
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-context-selector_v9.0.0-alpha.11..@fluentui/react-context-selector_v9.0.0-alpha.12)
|
277
383
|
|
278
384
|
### Patches
|
@@ -286,7 +392,7 @@ Mon, 07 Jun 2021 07:38:15 GMT
|
|
286
392
|
|
287
393
|
## [9.0.0-alpha.11](https://github.com/microsoft/fluentui/tree/@fluentui/react-context-selector_v9.0.0-alpha.11)
|
288
394
|
|
289
|
-
Fri, 04 Jun 2021 07:37:23 GMT
|
395
|
+
Fri, 04 Jun 2021 07:37:23 GMT
|
290
396
|
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-context-selector_v9.0.0-alpha.10..@fluentui/react-context-selector_v9.0.0-alpha.11)
|
291
397
|
|
292
398
|
### Changes
|
@@ -295,7 +401,7 @@ Fri, 04 Jun 2021 07:37:23 GMT
|
|
295
401
|
|
296
402
|
## [9.0.0-alpha.10](https://github.com/microsoft/fluentui/tree/@fluentui/react-context-selector_v9.0.0-alpha.10)
|
297
403
|
|
298
|
-
Wed, 26 May 2021 07:35:43 GMT
|
404
|
+
Wed, 26 May 2021 07:35:43 GMT
|
299
405
|
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-context-selector_v9.0.0-alpha.9..@fluentui/react-context-selector_v9.0.0-alpha.10)
|
300
406
|
|
301
407
|
### Changes
|
@@ -304,7 +410,7 @@ Wed, 26 May 2021 07:35:43 GMT
|
|
304
410
|
|
305
411
|
## [9.0.0-alpha.9](https://github.com/microsoft/fluentui/tree/@fluentui/react-context-selector_v9.0.0-alpha.9)
|
306
412
|
|
307
|
-
Fri, 21 May 2021 07:34:54 GMT
|
413
|
+
Fri, 21 May 2021 07:34:54 GMT
|
308
414
|
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-context-selector_v9.0.0-alpha.8..@fluentui/react-context-selector_v9.0.0-alpha.9)
|
309
415
|
|
310
416
|
### Changes
|
@@ -313,7 +419,7 @@ Fri, 21 May 2021 07:34:54 GMT
|
|
313
419
|
|
314
420
|
## [9.0.0-alpha.8](https://github.com/microsoft/fluentui/tree/@fluentui/react-context-selector_v9.0.0-alpha.8)
|
315
421
|
|
316
|
-
Thu, 20 May 2021 07:41:54 GMT
|
422
|
+
Thu, 20 May 2021 07:41:54 GMT
|
317
423
|
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-context-selector_v9.0.0-alpha.7..@fluentui/react-context-selector_v9.0.0-alpha.8)
|
318
424
|
|
319
425
|
### Patches
|
@@ -327,7 +433,7 @@ Thu, 20 May 2021 07:41:54 GMT
|
|
327
433
|
|
328
434
|
## [9.0.0-alpha.7](https://github.com/microsoft/fluentui/tree/@fluentui/react-context-selector_v9.0.0-alpha.7)
|
329
435
|
|
330
|
-
Wed, 19 May 2021 07:34:20 GMT
|
436
|
+
Wed, 19 May 2021 07:34:20 GMT
|
331
437
|
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-context-selector_v9.0.0-alpha.6..@fluentui/react-context-selector_v9.0.0-alpha.7)
|
332
438
|
|
333
439
|
### Changes
|
@@ -336,7 +442,7 @@ Wed, 19 May 2021 07:34:20 GMT
|
|
336
442
|
|
337
443
|
## [9.0.0-alpha.6](https://github.com/microsoft/fluentui/tree/@fluentui/react-context-selector_v9.0.0-alpha.6)
|
338
444
|
|
339
|
-
Mon, 03 May 2021 07:45:19 GMT
|
445
|
+
Mon, 03 May 2021 07:45:19 GMT
|
340
446
|
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-context-selector_v9.0.0-alpha.5..@fluentui/react-context-selector_v9.0.0-alpha.6)
|
341
447
|
|
342
448
|
### Changes
|
@@ -345,7 +451,7 @@ Mon, 03 May 2021 07:45:19 GMT
|
|
345
451
|
|
346
452
|
## [9.0.0-alpha.5](https://github.com/microsoft/fluentui/tree/@fluentui/react-context-selector_v9.0.0-alpha.5)
|
347
453
|
|
348
|
-
Fri, 30 Apr 2021 07:42:23 GMT
|
454
|
+
Fri, 30 Apr 2021 07:42:23 GMT
|
349
455
|
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-context-selector_v9.0.0-alpha.4..@fluentui/react-context-selector_v9.0.0-alpha.5)
|
350
456
|
|
351
457
|
### Patches
|
@@ -359,7 +465,7 @@ Fri, 30 Apr 2021 07:42:23 GMT
|
|
359
465
|
|
360
466
|
## [9.0.0-alpha.4](https://github.com/microsoft/fluentui/tree/@fluentui/react-context-selector_v9.0.0-alpha.4)
|
361
467
|
|
362
|
-
Fri, 23 Apr 2021 07:37:10 GMT
|
468
|
+
Fri, 23 Apr 2021 07:37:10 GMT
|
363
469
|
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-context-selector_v9.0.0-alpha.3..@fluentui/react-context-selector_v9.0.0-alpha.4)
|
364
470
|
|
365
471
|
### Patches
|
@@ -373,7 +479,7 @@ Fri, 23 Apr 2021 07:37:10 GMT
|
|
373
479
|
|
374
480
|
## [9.0.0-alpha.3](https://github.com/microsoft/fluentui/tree/@fluentui/react-context-selector_v9.0.0-alpha.3)
|
375
481
|
|
376
|
-
Thu, 22 Apr 2021 07:33:28 GMT
|
482
|
+
Thu, 22 Apr 2021 07:33:28 GMT
|
377
483
|
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-context-selector_v9.0.0-alpha.2..@fluentui/react-context-selector_v9.0.0-alpha.3)
|
378
484
|
|
379
485
|
### Changes
|
@@ -382,7 +488,7 @@ Thu, 22 Apr 2021 07:33:28 GMT
|
|
382
488
|
|
383
489
|
## [9.0.0-alpha.2](https://github.com/microsoft/fluentui/tree/@fluentui/react-context-selector_v9.0.0-alpha.2)
|
384
490
|
|
385
|
-
Wed, 31 Mar 2021 00:53:43 GMT
|
491
|
+
Wed, 31 Mar 2021 00:53:43 GMT
|
386
492
|
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-context-selector_v9.0.0-alpha.1..@fluentui/react-context-selector_v9.0.0-alpha.2)
|
387
493
|
|
388
494
|
### Patches
|
@@ -392,7 +498,7 @@ Wed, 31 Mar 2021 00:53:43 GMT
|
|
392
498
|
|
393
499
|
## [9.0.0-alpha.1](https://github.com/microsoft/fluentui/tree/@fluentui/react-context-selector_v9.0.0-alpha.1)
|
394
500
|
|
395
|
-
Tue, 30 Mar 2021 07:34:45 GMT
|
501
|
+
Tue, 30 Mar 2021 07:34:45 GMT
|
396
502
|
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-context-selector_v0.53.4..@fluentui/react-context-selector_v9.0.0-alpha.1)
|
397
503
|
|
398
504
|
### Changes
|
@@ -402,7 +508,7 @@ Tue, 30 Mar 2021 07:34:45 GMT
|
|
402
508
|
|
403
509
|
## [0.53.4](https://github.com/microsoft/fluentui/tree/@fluentui/react-context-selector_v0.53.4)
|
404
510
|
|
405
|
-
Mon, 15 Mar 2021 07:36:20 GMT
|
511
|
+
Mon, 15 Mar 2021 07:36:20 GMT
|
406
512
|
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-context-selector_v0.53.3..@fluentui/react-context-selector_v0.53.4)
|
407
513
|
|
408
514
|
### Patches
|
@@ -411,7 +517,7 @@ Mon, 15 Mar 2021 07:36:20 GMT
|
|
411
517
|
|
412
518
|
## [0.53.3](https://github.com/microsoft/fluentui/tree/@fluentui/react-context-selector_v0.53.3)
|
413
519
|
|
414
|
-
Fri, 26 Feb 2021 01:16:27 GMT
|
520
|
+
Fri, 26 Feb 2021 01:16:27 GMT
|
415
521
|
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-context-selector_v0.53.2..@fluentui/react-context-selector_v0.53.3)
|
416
522
|
|
417
523
|
### Patches
|
@@ -420,7 +526,7 @@ Fri, 26 Feb 2021 01:16:27 GMT
|
|
420
526
|
|
421
527
|
## [0.53.2](https://github.com/microsoft/fluentui/tree/@fluentui/react-context-selector_v0.53.2)
|
422
528
|
|
423
|
-
Mon, 22 Feb 2021 12:26:22 GMT
|
529
|
+
Mon, 22 Feb 2021 12:26:22 GMT
|
424
530
|
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-context-selector_v0.53.0..@fluentui/react-context-selector_v0.53.2)
|
425
531
|
|
426
532
|
### Patches
|
File without changes
|
File without changes
|
package/lib/createContext.js
CHANGED
@@ -1,47 +1,60 @@
|
|
1
1
|
import { useIsomorphicLayoutEffect } from '@fluentui/react-utilities';
|
2
2
|
import * as React from 'react';
|
3
3
|
import { unstable_NormalPriority as NormalPriority, unstable_runWithPriority as runWithPriority } from 'scheduler';
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
valueRef.current = props.value;
|
21
|
-
versionRef.current += 1;
|
22
|
-
runWithPriority(NormalPriority, function () {
|
23
|
-
contextValue.current.listeners.forEach(function (listener) {
|
24
|
-
listener([versionRef.current, props.value]);
|
25
|
-
});
|
26
|
-
});
|
27
|
-
}, [props.value]);
|
28
|
-
return React.createElement(Original, { value: contextValue.current }, props.children);
|
29
|
-
};
|
30
|
-
/* istanbul ignore else */
|
31
|
-
if (process.env.NODE_ENV !== 'production') {
|
32
|
-
Provider.displayName = 'ContextSelector.Provider';
|
4
|
+
|
5
|
+
const createProvider = Original => {
|
6
|
+
const Provider = props => {
|
7
|
+
// Holds an actual "props.value"
|
8
|
+
const valueRef = React.useRef(props.value); // Used to sync context updates and avoid stale values, can be considered as render/effect counter of Provider.
|
9
|
+
|
10
|
+
const versionRef = React.useRef(0); // A stable object, is used to avoid context updates via mutation of its values.
|
11
|
+
|
12
|
+
const contextValue = React.useRef();
|
13
|
+
|
14
|
+
if (!contextValue.current) {
|
15
|
+
contextValue.current = {
|
16
|
+
value: valueRef,
|
17
|
+
version: versionRef,
|
18
|
+
listeners: []
|
19
|
+
};
|
33
20
|
}
|
34
|
-
|
21
|
+
|
22
|
+
useIsomorphicLayoutEffect(() => {
|
23
|
+
valueRef.current = props.value;
|
24
|
+
versionRef.current += 1;
|
25
|
+
runWithPriority(NormalPriority, () => {
|
26
|
+
contextValue.current.listeners.forEach(listener => {
|
27
|
+
listener([versionRef.current, props.value]);
|
28
|
+
});
|
29
|
+
});
|
30
|
+
}, [props.value]);
|
31
|
+
return /*#__PURE__*/React.createElement(Original, {
|
32
|
+
value: contextValue.current
|
33
|
+
}, props.children);
|
34
|
+
};
|
35
|
+
/* istanbul ignore else */
|
36
|
+
|
37
|
+
|
38
|
+
if (process.env.NODE_ENV !== 'production') {
|
39
|
+
Provider.displayName = 'ContextSelector.Provider';
|
40
|
+
}
|
41
|
+
|
42
|
+
return Provider;
|
35
43
|
};
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
}
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
44
|
+
|
45
|
+
export const createContext = defaultValue => {
|
46
|
+
const context = /*#__PURE__*/React.createContext({
|
47
|
+
value: {
|
48
|
+
current: defaultValue
|
49
|
+
},
|
50
|
+
version: {
|
51
|
+
current: -1
|
52
|
+
},
|
53
|
+
listeners: []
|
54
|
+
});
|
55
|
+
context.Provider = createProvider(context.Provider); // We don't support Consumer API
|
56
|
+
|
57
|
+
delete context.Consumer;
|
58
|
+
return context;
|
46
59
|
};
|
47
60
|
//# sourceMappingURL=createContext.js.map
|
package/lib/createContext.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"
|
1
|
+
{"version":3,"sources":["createContext.ts"],"names":[],"mappings":"AAAA,SAAS,yBAAT,QAA0C,2BAA1C;AACA,OAAO,KAAK,KAAZ,MAAuB,OAAvB;AACA,SAAS,uBAAuB,IAAI,cAApC,EAAoD,wBAAwB,IAAI,eAAhF,QAAuG,WAAvG;;AAIA,MAAM,cAAc,GAAW,QAAR,IAAyD;AAC9E,QAAM,QAAQ,GAAyC,KAAK,IAAG;AAC7D;AACA,UAAM,QAAQ,GAAG,KAAK,CAAC,MAAN,CAAa,KAAK,CAAC,KAAnB,CAAjB,CAF6D,CAG7D;;AACA,UAAM,UAAU,GAAG,KAAK,CAAC,MAAN,CAAa,CAAb,CAAnB,CAJ6D,CAM7D;;AACA,UAAM,YAAY,GAAG,KAAK,CAAC,MAAN,EAArB;;AAEA,QAAI,CAAC,YAAY,CAAC,OAAlB,EAA2B;AACzB,MAAA,YAAY,CAAC,OAAb,GAAuB;AACrB,QAAA,KAAK,EAAE,QADc;AAErB,QAAA,OAAO,EAAE,UAFY;AAGrB,QAAA,SAAS,EAAE;AAHU,OAAvB;AAKD;;AAED,IAAA,yBAAyB,CAAC,MAAK;AAC7B,MAAA,QAAQ,CAAC,OAAT,GAAmB,KAAK,CAAC,KAAzB;AACA,MAAA,UAAU,CAAC,OAAX,IAAsB,CAAtB;AAEA,MAAA,eAAe,CAAC,cAAD,EAAiB,MAAK;AAClC,QAAA,YAAY,CAAC,OAAb,CAA6C,SAA7C,CAAuD,OAAvD,CAA+D,QAAQ,IAAG;AACzE,UAAA,QAAQ,CAAC,CAAC,UAAU,CAAC,OAAZ,EAAqB,KAAK,CAAC,KAA3B,CAAD,CAAR;AACD,SAFA;AAGF,OAJc,CAAf;AAKD,KATwB,EAStB,CAAC,KAAK,CAAC,KAAP,CATsB,CAAzB;AAWA,wBAAO,KAAK,CAAC,aAAN,CAAoB,QAApB,EAA8B;AAAE,MAAA,KAAK,EAAE,YAAY,CAAC;AAAtB,KAA9B,EAA+D,KAAK,CAAC,QAArE,CAAP;AACD,GA7BD;AA+BA;;;AACA,MAAI,OAAO,CAAC,GAAR,CAAY,QAAZ,KAAyB,YAA7B,EAA2C;AACzC,IAAA,QAAQ,CAAC,WAAT,GAAuB,0BAAvB;AACD;;AAED,SAAQ,QAAR;AACD,CAtCD;;AAwCA,OAAO,MAAM,aAAa,GAAW,YAAR,IAA+C;AAC1E,QAAM,OAAO,gBAAG,KAAK,CAAC,aAAN,CAAyC;AACvD,IAAA,KAAK,EAAE;AAAE,MAAA,OAAO,EAAE;AAAX,KADgD;AAEvD,IAAA,OAAO,EAAE;AAAE,MAAA,OAAO,EAAE,CAAC;AAAZ,KAF8C;AAGvD,IAAA,SAAS,EAAE;AAH4C,GAAzC,CAAhB;AAMA,EAAA,OAAO,CAAC,QAAR,GAAmB,cAAc,CAAQ,OAAO,CAAC,QAAhB,CAAjC,CAP0E,CAS1E;;AACA,SAAS,OAAsC,CAAC,QAAhD;AAEA,SAAQ,OAAR;AACD,CAbM","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"],"sourceRoot":"../src/"}
|
package/lib/index.js
CHANGED
package/lib/index.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"../src/","sources":["index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC","sourcesContent":["export { createContext } from './createContext';\nexport { useContextSelector } from './useContextSelector';\nexport { useHasParentContext } from './useHasParentContext';\n// eslint-disable-next-line @fluentui/ban-context-export\nexport type { Context, ContextSelector, ContextValue, ContextValues, ContextVersion } from './types';\n"]}
|
package/lib/types.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["
|
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"]}
|