@fluentui/react-context-selector 9.0.0-alpha.9 → 9.0.0-beta.4
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 +724 -1
- package/CHANGELOG.md +318 -2
- package/README.md +20 -0
- package/dist/react-context-selector.d.ts +9 -0
- package/lib/createContext.js +53 -40
- package/lib/createContext.js.map +1 -1
- package/lib/index.d.ts +1 -0
- package/lib/index.js +1 -0
- package/lib/index.js.map +1 -1
- package/lib/tsdoc-metadata.json +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.d.ts +9 -0
- package/lib/useHasParentContext.js +19 -0
- package/lib/useHasParentContext.js.map +1 -0
- package/lib-commonjs/createContext.js +64 -44
- package/lib-commonjs/createContext.js.map +1 -1
- package/lib-commonjs/index.d.ts +1 -0
- package/lib-commonjs/index.js +35 -7
- 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.d.ts +9 -0
- package/lib-commonjs/useHasParentContext.js +29 -0
- package/lib-commonjs/useHasParentContext.js.map +1 -0
- package/package.json +7 -7
- package/config/api-extractor.json +0 -3
- package/config/tests.js +0 -1
- package/etc/react-context-selector.api.md +0 -42
- package/just.config.ts +0 -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 -3
- package/lib-amd/index.js +0 -9
- 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/CHANGELOG.md
CHANGED
@@ -1,12 +1,328 @@
|
|
1
1
|
# Change Log - @fluentui/react-context-selector
|
2
2
|
|
3
|
-
This log was last generated on
|
3
|
+
This log was last generated on Thu, 25 Nov 2021 08:31:31 GMT and should not be manually modified.
|
4
4
|
|
5
5
|
<!-- Start content -->
|
6
6
|
|
7
|
+
## [9.0.0-beta.4](https://github.com/microsoft/fluentui/tree/@fluentui/react-context-selector_v9.0.0-beta.4)
|
8
|
+
|
9
|
+
Thu, 25 Nov 2021 08:31:31 GMT
|
10
|
+
[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)
|
11
|
+
|
12
|
+
### Changes
|
13
|
+
|
14
|
+
- Bump @fluentui/react-utilities to v9.0.0-beta.4 ([PR #20609](https://github.com/microsoft/fluentui/pull/20609) by beachball)
|
15
|
+
|
16
|
+
## [9.0.0-beta.3](https://github.com/microsoft/fluentui/tree/@fluentui/react-context-selector_v9.0.0-beta.3)
|
17
|
+
|
18
|
+
Fri, 12 Nov 2021 13:25:22 GMT
|
19
|
+
[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)
|
20
|
+
|
21
|
+
### Changes
|
22
|
+
|
23
|
+
- Updated beta and RC components to ES2019 ([PR #20405](https://github.com/microsoft/fluentui/pull/20405) by gcox@microsoft.com)
|
24
|
+
- Bump @fluentui/react-utilities to v9.0.0-beta.3 ([PR #20583](https://github.com/microsoft/fluentui/pull/20583) by beachball)
|
25
|
+
|
26
|
+
## [9.0.0-beta.2](https://github.com/microsoft/fluentui/tree/@fluentui/react-context-selector_v9.0.0-beta.2)
|
27
|
+
|
28
|
+
Wed, 27 Oct 2021 12:14:24 GMT
|
29
|
+
[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)
|
30
|
+
|
31
|
+
### Changes
|
32
|
+
|
33
|
+
- Bump @fluentui/react-utilities to v9.0.0-beta.2 ([PR #20353](https://github.com/microsoft/fluentui/pull/20353) by beachball)
|
34
|
+
|
35
|
+
## [9.0.0-beta.1](https://github.com/microsoft/fluentui/tree/@fluentui/react-context-selector_v9.0.0-beta.1)
|
36
|
+
|
37
|
+
Wed, 06 Oct 2021 10:37:22 GMT
|
38
|
+
[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)
|
39
|
+
|
40
|
+
### Changes
|
41
|
+
|
42
|
+
- Bump all v9 components to beta prerelease tag ([PR #20106](https://github.com/microsoft/fluentui/pull/20106) by lingfangao@hotmail.com)
|
43
|
+
- Bump @fluentui/react-utilities to v9.0.0-beta.1 ([PR #20106](https://github.com/microsoft/fluentui/pull/20106) by beachball)
|
44
|
+
|
45
|
+
## [9.0.0-alpha.39](https://github.com/microsoft/fluentui/tree/@fluentui/react-context-selector_v9.0.0-alpha.39)
|
46
|
+
|
47
|
+
Tue, 05 Oct 2021 09:28:07 GMT
|
48
|
+
[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)
|
49
|
+
|
50
|
+
### Changes
|
51
|
+
|
52
|
+
- Bump @fluentui/react-utilities to v9.0.0-alpha.56 ([PR #20081](https://github.com/microsoft/fluentui/pull/20081) by beachball)
|
53
|
+
|
54
|
+
## [9.0.0-alpha.38](https://github.com/microsoft/fluentui/tree/@fluentui/react-context-selector_v9.0.0-alpha.38)
|
55
|
+
|
56
|
+
Fri, 01 Oct 2021 14:13:08 GMT
|
57
|
+
[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)
|
58
|
+
|
59
|
+
### Changes
|
60
|
+
|
61
|
+
- Bump v9 prerelease versions to rerelease ([PR #20069](https://github.com/microsoft/fluentui/pull/20069) by lingfangao@hotmail.com)
|
62
|
+
- Bump @fluentui/react-utilities to v9.0.0-alpha.55 ([PR #20069](https://github.com/microsoft/fluentui/pull/20069) by beachball)
|
63
|
+
|
64
|
+
## [9.0.0-alpha.36](https://github.com/microsoft/fluentui/tree/@fluentui/react-context-selector_v9.0.0-alpha.36)
|
65
|
+
|
66
|
+
Mon, 27 Sep 2021 08:06:00 GMT
|
67
|
+
[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)
|
68
|
+
|
69
|
+
### Changes
|
70
|
+
|
71
|
+
- Bump @fluentui/react-utilities to v9.0.0-alpha.53 ([PR #19981](https://github.com/microsoft/fluentui/pull/19981) by beachball)
|
72
|
+
|
73
|
+
## [9.0.0-alpha.35](https://github.com/microsoft/fluentui/tree/@fluentui/react-context-selector_v9.0.0-alpha.35)
|
74
|
+
|
75
|
+
Fri, 24 Sep 2021 09:17:17 GMT
|
76
|
+
[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)
|
77
|
+
|
78
|
+
### Changes
|
79
|
+
|
80
|
+
- Bump @fluentui/react-utilities to v9.0.0-alpha.52 ([PR #19950](https://github.com/microsoft/fluentui/pull/19950) by beachball)
|
81
|
+
|
82
|
+
## [9.0.0-alpha.34](https://github.com/microsoft/fluentui/tree/@fluentui/react-context-selector_v9.0.0-alpha.34)
|
83
|
+
|
84
|
+
Thu, 23 Sep 2021 08:21:34 GMT
|
85
|
+
[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)
|
86
|
+
|
87
|
+
### Changes
|
88
|
+
|
89
|
+
- Bump @fluentui/react-utilities to v9.0.0-alpha.51 ([commit](https://github.com/microsoft/fluentui/commit/95682da34c48813f7658032ae490d21d2f363b90) by beachball)
|
90
|
+
|
91
|
+
## [9.0.0-alpha.33](https://github.com/microsoft/fluentui/tree/@fluentui/react-context-selector_v9.0.0-alpha.33)
|
92
|
+
|
93
|
+
Wed, 22 Sep 2021 10:10:07 GMT
|
94
|
+
[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)
|
95
|
+
|
96
|
+
### Changes
|
97
|
+
|
98
|
+
- Bump @fluentui/react-utilities to v9.0.0-alpha.50 ([commit](https://github.com/microsoft/fluentui/commit/bc3f1ec72fc7784a558b0dd6598ee0662f4649c1) by beachball)
|
99
|
+
|
100
|
+
## [9.0.0-alpha.32](https://github.com/microsoft/fluentui/tree/@fluentui/react-context-selector_v9.0.0-alpha.32)
|
101
|
+
|
102
|
+
Fri, 17 Sep 2021 07:35:26 GMT
|
103
|
+
[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)
|
104
|
+
|
105
|
+
### Changes
|
106
|
+
|
107
|
+
- Bump @fluentui/react-context-selector to v9.0.0-alpha.32 ([PR #19840](https://github.com/microsoft/fluentui/pull/19840) by Humberto.Morimoto@microsoft.com)
|
108
|
+
|
109
|
+
## [9.0.0-alpha.31](https://github.com/microsoft/fluentui/tree/@fluentui/react-context-selector_v9.0.0-alpha.31)
|
110
|
+
|
111
|
+
Thu, 16 Sep 2021 07:38:39 GMT
|
112
|
+
[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)
|
113
|
+
|
114
|
+
### Changes
|
115
|
+
|
116
|
+
- Bump @fluentui/react-context-selector to v9.0.0-alpha.31 ([PR #19815](https://github.com/microsoft/fluentui/pull/19815) by behowell@microsoft.com)
|
117
|
+
|
118
|
+
## [9.0.0-alpha.30](https://github.com/microsoft/fluentui/tree/@fluentui/react-context-selector_v9.0.0-alpha.30)
|
119
|
+
|
120
|
+
Tue, 14 Sep 2021 20:09:02 GMT
|
121
|
+
[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)
|
122
|
+
|
123
|
+
### Changes
|
124
|
+
|
125
|
+
- Bump @fluentui/react-context-selector to v9.0.0-alpha.30 ([PR #19155](https://github.com/microsoft/fluentui/pull/19155) by bsunderhus@microsoft.com)
|
126
|
+
|
127
|
+
## [9.0.0-alpha.29](https://github.com/microsoft/fluentui/tree/@fluentui/react-context-selector_v9.0.0-alpha.29)
|
128
|
+
|
129
|
+
Fri, 10 Sep 2021 16:31:53 GMT
|
130
|
+
[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)
|
131
|
+
|
132
|
+
### Changes
|
133
|
+
|
134
|
+
- chore(v9): Move all internal v9 dependencies from caret to fixed version ([PR #19748](https://github.com/microsoft/fluentui/pull/19748) by lingfangao@hotmail.com)
|
135
|
+
- Bump @fluentui/react-context-selector to v9.0.0-alpha.29 ([PR #19748](https://github.com/microsoft/fluentui/pull/19748) by lingfangao@hotmail.com)
|
136
|
+
|
137
|
+
## [9.0.0-alpha.28](https://github.com/microsoft/fluentui/tree/@fluentui/react-context-selector_v9.0.0-alpha.28)
|
138
|
+
|
139
|
+
Fri, 10 Sep 2021 07:39:51 GMT
|
140
|
+
[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)
|
141
|
+
|
142
|
+
### Changes
|
143
|
+
|
144
|
+
- Bump @fluentui/react-utilities to v9.0.0-alpha.45 ([PR #19642](https://github.com/microsoft/fluentui/pull/19642) by behowell@microsoft.com)
|
145
|
+
|
146
|
+
## [9.0.0-alpha.27](https://github.com/microsoft/fluentui/tree/@fluentui/react-context-selector_v9.0.0-alpha.27)
|
147
|
+
|
148
|
+
Mon, 06 Sep 2021 07:34:53 GMT
|
149
|
+
[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)
|
150
|
+
|
151
|
+
### Changes
|
152
|
+
|
153
|
+
- Bump @fluentui/react-utilities to v9.0.0-alpha.44 ([PR #19640](https://github.com/microsoft/fluentui/pull/19640) by lingfangao@hotmail.com)
|
154
|
+
|
155
|
+
## [9.0.0-alpha.26](https://github.com/microsoft/fluentui/tree/@fluentui/react-context-selector_v9.0.0-alpha.26)
|
156
|
+
|
157
|
+
Wed, 01 Sep 2021 07:39:56 GMT
|
158
|
+
[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)
|
159
|
+
|
160
|
+
### Changes
|
161
|
+
|
162
|
+
- Bump @fluentui/react-utilities to v9.0.0-alpha.43 ([PR #19483](https://github.com/microsoft/fluentui/pull/19483) by bsunderhus@microsoft.com)
|
163
|
+
|
164
|
+
## [9.0.0-alpha.25](https://github.com/microsoft/fluentui/tree/@fluentui/react-context-selector_v9.0.0-alpha.25)
|
165
|
+
|
166
|
+
Tue, 31 Aug 2021 07:37:47 GMT
|
167
|
+
[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)
|
168
|
+
|
169
|
+
### Changes
|
170
|
+
|
171
|
+
- Bump @fluentui/react-utilities to v9.0.0-alpha.42 ([PR #19556](https://github.com/microsoft/fluentui/pull/19556) by lingfan.gao@microsoft.com)
|
172
|
+
|
173
|
+
## [9.0.0-alpha.24](https://github.com/microsoft/fluentui/tree/@fluentui/react-context-selector_v9.0.0-alpha.24)
|
174
|
+
|
175
|
+
Fri, 20 Aug 2021 07:37:28 GMT
|
176
|
+
[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)
|
177
|
+
|
178
|
+
### Changes
|
179
|
+
|
180
|
+
- Update .npmignore ([PR #19441](https://github.com/microsoft/fluentui/pull/19441) by elcraig@microsoft.com)
|
181
|
+
|
182
|
+
## [9.0.0-alpha.23](https://github.com/microsoft/fluentui/tree/@fluentui/react-context-selector_v9.0.0-alpha.23)
|
183
|
+
|
184
|
+
Thu, 19 Aug 2021 07:41:35 GMT
|
185
|
+
[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)
|
186
|
+
|
187
|
+
### Changes
|
188
|
+
|
189
|
+
- Bump @fluentui/react-utilities to v9.0.0-alpha.39 ([PR #19273](https://github.com/microsoft/fluentui/pull/19273) by bsunderhus@microsoft.com)
|
190
|
+
|
191
|
+
## [9.0.0-alpha.22](https://github.com/microsoft/fluentui/tree/@fluentui/react-context-selector_v9.0.0-alpha.22)
|
192
|
+
|
193
|
+
Fri, 06 Aug 2021 07:35:14 GMT
|
194
|
+
[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)
|
195
|
+
|
196
|
+
### Changes
|
197
|
+
|
198
|
+
- Bump @fluentui/react-utilities to v9.0.0-alpha.38 ([PR #19189](https://github.com/microsoft/fluentui/pull/19189) by bsunderhus@microsoft.com)
|
199
|
+
|
200
|
+
## [9.0.0-alpha.21](https://github.com/microsoft/fluentui/tree/@fluentui/react-context-selector_v9.0.0-alpha.21)
|
201
|
+
|
202
|
+
Tue, 03 Aug 2021 07:39:30 GMT
|
203
|
+
[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)
|
204
|
+
|
205
|
+
### Patches
|
206
|
+
|
207
|
+
- Bump @fluentui/eslint-plugin to v1.3.3 ([PR #19169](https://github.com/microsoft/fluentui/pull/19169) by behowell@microsoft.com)
|
208
|
+
- Bump @fluentui/scripts to v1.0.0 ([PR #19169](https://github.com/microsoft/fluentui/pull/19169) by behowell@microsoft.com)
|
209
|
+
|
210
|
+
### Changes
|
211
|
+
|
212
|
+
- Bump @fluentui/react-utilities to v9.0.0-alpha.37 ([PR #19169](https://github.com/microsoft/fluentui/pull/19169) by behowell@microsoft.com)
|
213
|
+
|
214
|
+
## [9.0.0-alpha.20](https://github.com/microsoft/fluentui/tree/@fluentui/react-context-selector_v9.0.0-alpha.20)
|
215
|
+
|
216
|
+
Mon, 02 Aug 2021 07:36:20 GMT
|
217
|
+
[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)
|
218
|
+
|
219
|
+
### Changes
|
220
|
+
|
221
|
+
- Bump @fluentui/react-utilities to v9.0.0-alpha.36 ([PR #19204](https://github.com/microsoft/fluentui/pull/19204) by lingfan.gao@microsoft.com)
|
222
|
+
|
223
|
+
## [9.0.0-alpha.19](https://github.com/microsoft/fluentui/tree/@fluentui/react-context-selector_v9.0.0-alpha.19)
|
224
|
+
|
225
|
+
Fri, 23 Jul 2021 07:38:19 GMT
|
226
|
+
[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)
|
227
|
+
|
228
|
+
### Changes
|
229
|
+
|
230
|
+
- Bump @fluentui/react-utilities to v9.0.0-alpha.35 ([PR #18610](https://github.com/microsoft/fluentui/pull/18610) by behowell@microsoft.com)
|
231
|
+
|
232
|
+
## [9.0.0-alpha.18](https://github.com/microsoft/fluentui/tree/@fluentui/react-context-selector_v9.0.0-alpha.18)
|
233
|
+
|
234
|
+
Thu, 22 Jul 2021 07:36:55 GMT
|
235
|
+
[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)
|
236
|
+
|
237
|
+
### Changes
|
238
|
+
|
239
|
+
- Bump @fluentui/react-utilities to v9.0.0-alpha.34 ([PR #19023](https://github.com/microsoft/fluentui/pull/19023) by behowell@microsoft.com)
|
240
|
+
|
241
|
+
## [9.0.0-alpha.17](https://github.com/microsoft/fluentui/tree/@fluentui/react-context-selector_v9.0.0-alpha.17)
|
242
|
+
|
243
|
+
Thu, 15 Jul 2021 07:36:18 GMT
|
244
|
+
[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)
|
245
|
+
|
246
|
+
### Changes
|
247
|
+
|
248
|
+
- feat(useHasParentContext): new hook to determine if a context provider exists as parent ([PR #18812](https://github.com/microsoft/fluentui/pull/18812) by lingfan.gao@microsoft.com)
|
249
|
+
|
250
|
+
## [9.0.0-alpha.16](https://github.com/microsoft/fluentui/tree/@fluentui/react-context-selector_v9.0.0-alpha.16)
|
251
|
+
|
252
|
+
Fri, 09 Jul 2021 07:39:31 GMT
|
253
|
+
[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)
|
254
|
+
|
255
|
+
### Patches
|
256
|
+
|
257
|
+
- Bump @fluentui/eslint-plugin to v1.3.2 ([PR #18808](https://github.com/microsoft/fluentui/pull/18808) by martinhochel@microsoft.com)
|
258
|
+
- Bump @fluentui/scripts to v1.0.0 ([PR #18808](https://github.com/microsoft/fluentui/pull/18808) by martinhochel@microsoft.com)
|
259
|
+
|
260
|
+
### Changes
|
261
|
+
|
262
|
+
- Bump @fluentui/react-utilities to v9.0.0-alpha.32 ([PR #18808](https://github.com/microsoft/fluentui/pull/18808) by martinhochel@microsoft.com)
|
263
|
+
|
264
|
+
## [9.0.0-alpha.15](https://github.com/microsoft/fluentui/tree/@fluentui/react-context-selector_v9.0.0-alpha.15)
|
265
|
+
|
266
|
+
Fri, 02 Jul 2021 23:15:55 GMT
|
267
|
+
[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)
|
268
|
+
|
269
|
+
### Changes
|
270
|
+
|
271
|
+
- Bump @fluentui/react-utilities to v9.0.0-alpha.31 ([PR #18721](https://github.com/microsoft/fluentui/pull/18721) by bsunderhus@microsoft.com)
|
272
|
+
|
273
|
+
## [9.0.0-alpha.14](https://github.com/microsoft/fluentui/tree/@fluentui/react-context-selector_v9.0.0-alpha.14)
|
274
|
+
|
275
|
+
Fri, 02 Jul 2021 07:37:06 GMT
|
276
|
+
[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)
|
277
|
+
|
278
|
+
### Changes
|
279
|
+
|
280
|
+
- Bump @fluentui/react-utilities to v9.0.0-alpha.30 ([PR #18796](https://github.com/microsoft/fluentui/pull/18796) by bsunderhus@microsoft.com)
|
281
|
+
|
282
|
+
## [9.0.0-alpha.13](https://github.com/microsoft/fluentui/tree/@fluentui/react-context-selector_v9.0.0-alpha.13)
|
283
|
+
|
284
|
+
Tue, 15 Jun 2021 07:40:20 GMT
|
285
|
+
[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)
|
286
|
+
|
287
|
+
### Changes
|
288
|
+
|
289
|
+
- Bump @fluentui/react-utilities to v9.0.0-alpha.29 ([PR #18521](https://github.com/microsoft/fluentui/pull/18521) by behowell@microsoft.com)
|
290
|
+
|
291
|
+
## [9.0.0-alpha.12](https://github.com/microsoft/fluentui/tree/@fluentui/react-context-selector_v9.0.0-alpha.12)
|
292
|
+
|
293
|
+
Mon, 07 Jun 2021 07:38:15 GMT
|
294
|
+
[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)
|
295
|
+
|
296
|
+
### Patches
|
297
|
+
|
298
|
+
- Bump @fluentui/eslint-plugin to v1.3.1 ([PR #18437](https://github.com/microsoft/fluentui/pull/18437) by martinhochel@microsoft.com)
|
299
|
+
- Bump @fluentui/scripts to v1.0.0 ([PR #18437](https://github.com/microsoft/fluentui/pull/18437) by martinhochel@microsoft.com)
|
300
|
+
|
301
|
+
### Changes
|
302
|
+
|
303
|
+
- Bump @fluentui/react-utilities to v9.0.0-alpha.28 ([PR #18437](https://github.com/microsoft/fluentui/pull/18437) by martinhochel@microsoft.com)
|
304
|
+
|
305
|
+
## [9.0.0-alpha.11](https://github.com/microsoft/fluentui/tree/@fluentui/react-context-selector_v9.0.0-alpha.11)
|
306
|
+
|
307
|
+
Fri, 04 Jun 2021 07:37:23 GMT
|
308
|
+
[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)
|
309
|
+
|
310
|
+
### Changes
|
311
|
+
|
312
|
+
- Bump @fluentui/react-utilities to v9.0.0-alpha.27 ([PR #18168](https://github.com/microsoft/fluentui/pull/18168) by Humberto.Morimoto@microsoft.com)
|
313
|
+
|
314
|
+
## [9.0.0-alpha.10](https://github.com/microsoft/fluentui/tree/@fluentui/react-context-selector_v9.0.0-alpha.10)
|
315
|
+
|
316
|
+
Wed, 26 May 2021 07:35:43 GMT
|
317
|
+
[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)
|
318
|
+
|
319
|
+
### Changes
|
320
|
+
|
321
|
+
- Bump @fluentui/react-utilities to v9.0.0-alpha.25 ([PR #18323](https://github.com/microsoft/fluentui/pull/18323) by lingfan.gao@microsoft.com)
|
322
|
+
|
7
323
|
## [9.0.0-alpha.9](https://github.com/microsoft/fluentui/tree/@fluentui/react-context-selector_v9.0.0-alpha.9)
|
8
324
|
|
9
|
-
Fri, 21 May 2021 07:
|
325
|
+
Fri, 21 May 2021 07:34:54 GMT
|
10
326
|
[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)
|
11
327
|
|
12
328
|
### Changes
|
package/README.md
CHANGED
@@ -25,6 +25,8 @@ yarn add @fluentui/react-context-selector
|
|
25
25
|
|
26
26
|
## Usage
|
27
27
|
|
28
|
+
### Getting started
|
29
|
+
|
28
30
|
```tsx
|
29
31
|
import * as React from 'react';
|
30
32
|
import { createContext, useContextSelector, ContextSelector } from '@fluentui/react-context-selector';
|
@@ -86,6 +88,24 @@ export default function App() {
|
|
86
88
|
}
|
87
89
|
```
|
88
90
|
|
91
|
+
### useHasParentContext
|
92
|
+
|
93
|
+
This helper hook will allow you to know if a component is wrapped by a context selector provider
|
94
|
+
|
95
|
+
```tsx
|
96
|
+
const Foo = () => {
|
97
|
+
// An easy way to test if a context provider is wrapped around this component
|
98
|
+
// since it's more complicated to compare with a default context value
|
99
|
+
const isWrappedWithContext = useHasParentContext(CounterContext);
|
100
|
+
|
101
|
+
if (isWrappedWithContext) {
|
102
|
+
return <div>I am inside context selector provider</div>;
|
103
|
+
} else {
|
104
|
+
return <div>I can only use default context value</div>;
|
105
|
+
}
|
106
|
+
};
|
107
|
+
```
|
108
|
+
|
89
109
|
## Technical memo
|
90
110
|
|
91
111
|
React context by nature triggers propagation of component re-rendering if a value is changed. To avoid this, this library uses undocumented feature of `calculateChangedBits`. It then uses a subscription model to force update when a component needs to re-render.
|
@@ -32,4 +32,13 @@ export declare const createContext: <Value>(defaultValue: Value) => Context<Valu
|
|
32
32
|
*/
|
33
33
|
export declare const useContextSelector: <Value, SelectedValue>(context: Context<Value>, selector: ContextSelector<Value, SelectedValue>) => SelectedValue;
|
34
34
|
|
35
|
+
/**
|
36
|
+
* Utility hook for contexts created by react-context-selector to determine if a parent context exists
|
37
|
+
* WARNING: This hook will not work for native React contexts
|
38
|
+
*
|
39
|
+
* @param context - context created by react-context-selector
|
40
|
+
* @returns whether the hook is wrapped by a parent context
|
41
|
+
*/
|
42
|
+
export declare function useHasParentContext<Value>(context: Context<Value>): boolean;
|
43
|
+
|
35
44
|
export { }
|
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":["../src/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","sourceRoot":""}
|
package/lib/index.d.ts
CHANGED
package/lib/index.js
CHANGED
package/lib/index.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/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;AAC5D,cAAc,SAAS,CAAC"}
|
package/lib/tsdoc-metadata.json
CHANGED
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":""}
|