@fluentui/global-context 9.0.0-beta.4 → 9.0.0-beta.41
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 +954 -1
- package/CHANGELOG.md +379 -2
- package/README.md +1 -1
- package/lib/global-context-selector.js +24 -33
- package/lib/global-context-selector.js.map +1 -1
- package/lib/global-context.js +23 -33
- package/lib/global-context.js.map +1 -1
- package/lib/index.js +0 -1
- package/lib/index.js.map +1 -1
- package/lib/types.js +1 -2
- package/lib/types.js.map +1 -1
- package/lib/utils.js +2 -4
- package/lib/utils.js.map +1 -1
- package/lib-commonjs/global-context-selector.js +42 -58
- package/lib-commonjs/global-context-selector.js.map +1 -1
- package/lib-commonjs/global-context.js +41 -58
- package/lib-commonjs/global-context.js.map +1 -1
- package/lib-commonjs/index.js +16 -21
- package/lib-commonjs/index.js.map +1 -1
- package/lib-commonjs/types.js +3 -3
- package/lib-commonjs/types.js.map +1 -1
- package/lib-commonjs/utils.js +11 -12
- package/lib-commonjs/utils.js.map +1 -1
- package/package.json +25 -14
package/CHANGELOG.md
CHANGED
|
@@ -1,12 +1,389 @@
|
|
|
1
1
|
# Change Log - @fluentui/global-context
|
|
2
2
|
|
|
3
|
-
This log was last generated on
|
|
3
|
+
This log was last generated on Wed, 06 Sep 2023 13:27:23 GMT and should not be manually modified.
|
|
4
4
|
|
|
5
5
|
<!-- Start content -->
|
|
6
6
|
|
|
7
|
+
## [9.0.0-beta.41](https://github.com/microsoft/fluentui/tree/@fluentui/global-context_v9.0.0-beta.41)
|
|
8
|
+
|
|
9
|
+
Wed, 06 Sep 2023 13:27:23 GMT
|
|
10
|
+
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/global-context_v9.0.0-beta.40..@fluentui/global-context_v9.0.0-beta.41)
|
|
11
|
+
|
|
12
|
+
### Changes
|
|
13
|
+
|
|
14
|
+
- Bump @fluentui/react-context-selector to v9.1.34 ([PR #28988](https://github.com/microsoft/fluentui/pull/28988) by beachball)
|
|
15
|
+
- Bump @fluentui/react-utilities to v9.13.3 ([PR #28988](https://github.com/microsoft/fluentui/pull/28988) by beachball)
|
|
16
|
+
|
|
17
|
+
## [9.0.0-beta.40](https://github.com/microsoft/fluentui/tree/@fluentui/global-context_v9.0.0-beta.40)
|
|
18
|
+
|
|
19
|
+
Tue, 05 Sep 2023 15:39:04 GMT
|
|
20
|
+
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/global-context_v9.0.0-beta.39..@fluentui/global-context_v9.0.0-beta.40)
|
|
21
|
+
|
|
22
|
+
### Changes
|
|
23
|
+
|
|
24
|
+
- Bump @fluentui/react-context-selector to v9.1.33 ([PR #29055](https://github.com/microsoft/fluentui/pull/29055) by beachball)
|
|
25
|
+
- Bump @fluentui/react-utilities to v9.13.2 ([PR #29055](https://github.com/microsoft/fluentui/pull/29055) by beachball)
|
|
26
|
+
|
|
27
|
+
## [9.0.0-beta.39](https://github.com/microsoft/fluentui/tree/@fluentui/global-context_v9.0.0-beta.39)
|
|
28
|
+
|
|
29
|
+
Tue, 05 Sep 2023 13:29:13 GMT
|
|
30
|
+
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/global-context_v9.0.0-beta.38..@fluentui/global-context_v9.0.0-beta.39)
|
|
31
|
+
|
|
32
|
+
### Changes
|
|
33
|
+
|
|
34
|
+
- bumps @swc/helpers version to 0.5.1 ([PR #28989](https://github.com/microsoft/fluentui/pull/28989) by bernardo.sunderhus@gmail.com)
|
|
35
|
+
- bumps react peer dependencies to v16.14.0 ([PR #28959](https://github.com/microsoft/fluentui/pull/28959) by bernardo.sunderhus@gmail.com)
|
|
36
|
+
- Bump @fluentui/react-context-selector to v9.1.32 ([PR #29056](https://github.com/microsoft/fluentui/pull/29056) by beachball)
|
|
37
|
+
- Bump @fluentui/react-utilities to v9.13.1 ([PR #29056](https://github.com/microsoft/fluentui/pull/29056) by beachball)
|
|
38
|
+
|
|
39
|
+
## [9.0.0-beta.38](https://github.com/microsoft/fluentui/tree/@fluentui/global-context_v9.0.0-beta.38)
|
|
40
|
+
|
|
41
|
+
Tue, 29 Aug 2023 12:57:36 GMT
|
|
42
|
+
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/global-context_v9.0.0-beta.37..@fluentui/global-context_v9.0.0-beta.38)
|
|
43
|
+
|
|
44
|
+
### Changes
|
|
45
|
+
|
|
46
|
+
- Bump @fluentui/react-context-selector to v9.1.31 ([PR #29005](https://github.com/microsoft/fluentui/pull/29005) by beachball)
|
|
47
|
+
- Bump @fluentui/react-utilities to v9.13.0 ([PR #29005](https://github.com/microsoft/fluentui/pull/29005) by beachball)
|
|
48
|
+
|
|
49
|
+
## [9.0.0-beta.37](https://github.com/microsoft/fluentui/tree/@fluentui/global-context_v9.0.0-beta.37)
|
|
50
|
+
|
|
51
|
+
Thu, 24 Aug 2023 10:26:35 GMT
|
|
52
|
+
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/global-context_v9.0.0-beta.36..@fluentui/global-context_v9.0.0-beta.37)
|
|
53
|
+
|
|
54
|
+
### Changes
|
|
55
|
+
|
|
56
|
+
- Bump @fluentui/react-context-selector to v9.1.30 ([PR #28973](https://github.com/microsoft/fluentui/pull/28973) by beachball)
|
|
57
|
+
- Bump @fluentui/react-utilities to v9.12.0 ([PR #28973](https://github.com/microsoft/fluentui/pull/28973) by beachball)
|
|
58
|
+
|
|
59
|
+
## [9.0.0-beta.36](https://github.com/microsoft/fluentui/tree/@fluentui/global-context_v9.0.0-beta.36)
|
|
60
|
+
|
|
61
|
+
Wed, 23 Aug 2023 12:01:49 GMT
|
|
62
|
+
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/global-context_v9.0.0-beta.35..@fluentui/global-context_v9.0.0-beta.36)
|
|
63
|
+
|
|
64
|
+
### Changes
|
|
65
|
+
|
|
66
|
+
- Bump @fluentui/react-context-selector to v9.1.29 ([PR #28957](https://github.com/microsoft/fluentui/pull/28957) by beachball)
|
|
67
|
+
- Bump @fluentui/react-utilities to v9.11.2 ([PR #28957](https://github.com/microsoft/fluentui/pull/28957) by beachball)
|
|
68
|
+
|
|
69
|
+
## [9.0.0-beta.35](https://github.com/microsoft/fluentui/tree/@fluentui/global-context_v9.0.0-beta.35)
|
|
70
|
+
|
|
71
|
+
Fri, 11 Aug 2023 12:14:26 GMT
|
|
72
|
+
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/global-context_v9.0.0-beta.34..@fluentui/global-context_v9.0.0-beta.35)
|
|
73
|
+
|
|
74
|
+
### Changes
|
|
75
|
+
|
|
76
|
+
- Bump @fluentui/react-context-selector to v9.1.28 ([PR #28808](https://github.com/microsoft/fluentui/pull/28808) by beachball)
|
|
77
|
+
- Bump @fluentui/react-utilities to v9.11.1 ([PR #28808](https://github.com/microsoft/fluentui/pull/28808) by beachball)
|
|
78
|
+
|
|
79
|
+
## [9.0.0-beta.34](https://github.com/microsoft/fluentui/tree/@fluentui/global-context_v9.0.0-beta.34)
|
|
80
|
+
|
|
81
|
+
Fri, 04 Aug 2023 08:52:58 GMT
|
|
82
|
+
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/global-context_v9.0.0-beta.33..@fluentui/global-context_v9.0.0-beta.34)
|
|
83
|
+
|
|
84
|
+
### Changes
|
|
85
|
+
|
|
86
|
+
- Bump @fluentui/react-context-selector to v9.1.27 ([commit](https://github.com/microsoft/fluentui/commit/0bf7d9438c1d0ff90cd2b28bc4cceb4f807afbca) by beachball)
|
|
87
|
+
- Bump @fluentui/react-utilities to v9.11.0 ([commit](https://github.com/microsoft/fluentui/commit/0bf7d9438c1d0ff90cd2b28bc4cceb4f807afbca) by beachball)
|
|
88
|
+
|
|
89
|
+
## [9.0.0-beta.33](https://github.com/microsoft/fluentui/tree/@fluentui/global-context_v9.0.0-beta.33)
|
|
90
|
+
|
|
91
|
+
Mon, 03 Jul 2023 11:57:14 GMT
|
|
92
|
+
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/global-context_v9.0.0-beta.32..@fluentui/global-context_v9.0.0-beta.33)
|
|
93
|
+
|
|
94
|
+
### Changes
|
|
95
|
+
|
|
96
|
+
- Bump @fluentui/react-context-selector to v9.1.26 ([PR #28412](https://github.com/microsoft/fluentui/pull/28412) by beachball)
|
|
97
|
+
- Bump @fluentui/react-utilities to v9.10.1 ([PR #28412](https://github.com/microsoft/fluentui/pull/28412) by beachball)
|
|
98
|
+
|
|
99
|
+
## [9.0.0-beta.32](https://github.com/microsoft/fluentui/tree/@fluentui/global-context_v9.0.0-beta.32)
|
|
100
|
+
|
|
101
|
+
Wed, 28 Jun 2023 11:12:21 GMT
|
|
102
|
+
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/global-context_v9.0.0-beta.31..@fluentui/global-context_v9.0.0-beta.32)
|
|
103
|
+
|
|
104
|
+
### Changes
|
|
105
|
+
|
|
106
|
+
- Bump @fluentui/react-context-selector to v9.1.25 ([PR #28320](https://github.com/microsoft/fluentui/pull/28320) by beachball)
|
|
107
|
+
- Bump @fluentui/react-utilities to v9.10.0 ([PR #28320](https://github.com/microsoft/fluentui/pull/28320) by beachball)
|
|
108
|
+
|
|
109
|
+
## [9.0.0-beta.31](https://github.com/microsoft/fluentui/tree/@fluentui/global-context_v9.0.0-beta.31)
|
|
110
|
+
|
|
111
|
+
Mon, 26 Jun 2023 09:53:55 GMT
|
|
112
|
+
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/global-context_v9.0.0-beta.30..@fluentui/global-context_v9.0.0-beta.31)
|
|
113
|
+
|
|
114
|
+
### Changes
|
|
115
|
+
|
|
116
|
+
- Bump @fluentui/react-context-selector to v9.1.24 ([PR #28296](https://github.com/microsoft/fluentui/pull/28296) by beachball)
|
|
117
|
+
- Bump @fluentui/react-utilities to v9.9.4 ([PR #28296](https://github.com/microsoft/fluentui/pull/28296) by beachball)
|
|
118
|
+
|
|
119
|
+
## [9.0.0-beta.30](https://github.com/microsoft/fluentui/tree/@fluentui/global-context_v9.0.0-beta.30)
|
|
120
|
+
|
|
121
|
+
Tue, 20 Jun 2023 12:39:07 GMT
|
|
122
|
+
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/global-context_v9.0.0-beta.29..@fluentui/global-context_v9.0.0-beta.30)
|
|
123
|
+
|
|
124
|
+
### Changes
|
|
125
|
+
|
|
126
|
+
- Bump @fluentui/react-context-selector to v9.1.23 ([PR #28229](https://github.com/microsoft/fluentui/pull/28229) by beachball)
|
|
127
|
+
- Bump @fluentui/react-utilities to v9.9.3 ([PR #28229](https://github.com/microsoft/fluentui/pull/28229) by beachball)
|
|
128
|
+
|
|
129
|
+
## [9.0.0-beta.29](https://github.com/microsoft/fluentui/tree/@fluentui/global-context_v9.0.0-beta.29)
|
|
130
|
+
|
|
131
|
+
Wed, 31 May 2023 06:46:08 GMT
|
|
132
|
+
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/global-context_v9.0.0-beta.28..@fluentui/global-context_v9.0.0-beta.29)
|
|
133
|
+
|
|
134
|
+
### Changes
|
|
135
|
+
|
|
136
|
+
- Bump @fluentui/react-context-selector to v9.1.22 ([PR #28054](https://github.com/microsoft/fluentui/pull/28054) by beachball)
|
|
137
|
+
- Bump @fluentui/react-utilities to v9.9.2 ([PR #28054](https://github.com/microsoft/fluentui/pull/28054) by beachball)
|
|
138
|
+
|
|
139
|
+
## [9.0.0-beta.28](https://github.com/microsoft/fluentui/tree/@fluentui/global-context_v9.0.0-beta.28)
|
|
140
|
+
|
|
141
|
+
Thu, 25 May 2023 10:00:48 GMT
|
|
142
|
+
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/global-context_v9.0.0-beta.27..@fluentui/global-context_v9.0.0-beta.28)
|
|
143
|
+
|
|
144
|
+
### Changes
|
|
145
|
+
|
|
146
|
+
- Bump @fluentui/react-context-selector to v9.1.21 ([PR #27988](https://github.com/microsoft/fluentui/pull/27988) by beachball)
|
|
147
|
+
- Bump @fluentui/react-utilities to v9.9.1 ([PR #27988](https://github.com/microsoft/fluentui/pull/27988) by beachball)
|
|
148
|
+
|
|
149
|
+
## [9.0.0-beta.27](https://github.com/microsoft/fluentui/tree/@fluentui/global-context_v9.0.0-beta.27)
|
|
150
|
+
|
|
151
|
+
Thu, 18 May 2023 00:39:00 GMT
|
|
152
|
+
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/global-context_v9.0.0-beta.26..@fluentui/global-context_v9.0.0-beta.27)
|
|
153
|
+
|
|
154
|
+
### Changes
|
|
155
|
+
|
|
156
|
+
- Bump @fluentui/react-context-selector to v9.1.20 ([PR #27834](https://github.com/microsoft/fluentui/pull/27834) by beachball)
|
|
157
|
+
- Bump @fluentui/react-utilities to v9.9.0 ([PR #27834](https://github.com/microsoft/fluentui/pull/27834) by beachball)
|
|
158
|
+
|
|
159
|
+
## [9.0.0-beta.26](https://github.com/microsoft/fluentui/tree/@fluentui/global-context_v9.0.0-beta.26)
|
|
160
|
+
|
|
161
|
+
Fri, 12 May 2023 20:28:08 GMT
|
|
162
|
+
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/global-context_v9.0.0-beta.25..@fluentui/global-context_v9.0.0-beta.26)
|
|
163
|
+
|
|
164
|
+
### Changes
|
|
165
|
+
|
|
166
|
+
- chore: exclude .swcrc from being published ([PR #27740](https://github.com/microsoft/fluentui/pull/27740) by olfedias@microsoft.com)
|
|
167
|
+
- Bump @fluentui/react-context-selector to v9.1.19 ([PR #27827](https://github.com/microsoft/fluentui/pull/27827) by beachball)
|
|
168
|
+
- Bump @fluentui/react-utilities to v9.8.1 ([PR #27827](https://github.com/microsoft/fluentui/pull/27827) by beachball)
|
|
169
|
+
|
|
170
|
+
## [9.0.0-beta.25](https://github.com/microsoft/fluentui/tree/@fluentui/global-context_v9.0.0-beta.25)
|
|
171
|
+
|
|
172
|
+
Mon, 17 Apr 2023 17:54:02 GMT
|
|
173
|
+
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/global-context_v9.0.0-beta.24..@fluentui/global-context_v9.0.0-beta.25)
|
|
174
|
+
|
|
175
|
+
### Changes
|
|
176
|
+
|
|
177
|
+
- Bump @fluentui/react-context-selector to v9.1.18 ([PR #27564](https://github.com/microsoft/fluentui/pull/27564) by beachball)
|
|
178
|
+
- Bump @fluentui/react-utilities to v9.8.0 ([PR #27564](https://github.com/microsoft/fluentui/pull/27564) by beachball)
|
|
179
|
+
|
|
180
|
+
## [9.0.0-beta.24](https://github.com/microsoft/fluentui/tree/@fluentui/global-context_v9.0.0-beta.24)
|
|
181
|
+
|
|
182
|
+
Wed, 12 Apr 2023 09:31:45 GMT
|
|
183
|
+
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/global-context_v9.0.0-beta.23..@fluentui/global-context_v9.0.0-beta.24)
|
|
184
|
+
|
|
185
|
+
### Changes
|
|
186
|
+
|
|
187
|
+
- Bump @fluentui/react-context-selector to v9.1.17 ([PR #27274](https://github.com/microsoft/fluentui/pull/27274) by beachball)
|
|
188
|
+
- Bump @fluentui/react-utilities to v9.7.4 ([PR #27274](https://github.com/microsoft/fluentui/pull/27274) by beachball)
|
|
189
|
+
|
|
190
|
+
## [9.0.0-beta.23](https://github.com/microsoft/fluentui/tree/@fluentui/global-context_v9.0.0-beta.23)
|
|
191
|
+
|
|
192
|
+
Tue, 04 Apr 2023 18:44:50 GMT
|
|
193
|
+
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/global-context_v9.0.0-beta.22..@fluentui/global-context_v9.0.0-beta.23)
|
|
194
|
+
|
|
195
|
+
### Changes
|
|
196
|
+
|
|
197
|
+
- Bump @fluentui/react-context-selector to v9.1.16 ([PR #27434](https://github.com/microsoft/fluentui/pull/27434) by beachball)
|
|
198
|
+
- Bump @fluentui/react-utilities to v9.7.3 ([PR #27434](https://github.com/microsoft/fluentui/pull/27434) by beachball)
|
|
199
|
+
|
|
200
|
+
## [9.0.0-beta.22](https://github.com/microsoft/fluentui/tree/@fluentui/global-context_v9.0.0-beta.22)
|
|
201
|
+
|
|
202
|
+
Tue, 21 Mar 2023 21:23:18 GMT
|
|
203
|
+
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/global-context_v9.0.0-beta.21..@fluentui/global-context_v9.0.0-beta.22)
|
|
204
|
+
|
|
205
|
+
### Changes
|
|
206
|
+
|
|
207
|
+
- chore: migrate to swc transpilation approach. ([PR #27250](https://github.com/microsoft/fluentui/pull/27250) by tristan.watanabe@gmail.com)
|
|
208
|
+
- fix: add node field to package.json exports map. ([PR #27154](https://github.com/microsoft/fluentui/pull/27154) by tristan.watanabe@gmail.com)
|
|
209
|
+
- Bump @fluentui/react-context-selector to v9.1.15 ([PR #27271](https://github.com/microsoft/fluentui/pull/27271) by beachball)
|
|
210
|
+
- Bump @fluentui/react-utilities to v9.7.2 ([PR #27271](https://github.com/microsoft/fluentui/pull/27271) by beachball)
|
|
211
|
+
|
|
212
|
+
## [9.0.0-beta.21](https://github.com/microsoft/fluentui/tree/@fluentui/global-context_v9.0.0-beta.21)
|
|
213
|
+
|
|
214
|
+
Thu, 16 Mar 2023 14:36:59 GMT
|
|
215
|
+
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/global-context_v9.0.0-beta.20..@fluentui/global-context_v9.0.0-beta.21)
|
|
216
|
+
|
|
217
|
+
### Changes
|
|
218
|
+
|
|
219
|
+
- Bump @fluentui/react-context-selector to v9.1.14 ([PR #27229](https://github.com/microsoft/fluentui/pull/27229) by beachball)
|
|
220
|
+
- Bump @fluentui/react-utilities to v9.7.1 ([PR #27229](https://github.com/microsoft/fluentui/pull/27229) by beachball)
|
|
221
|
+
|
|
222
|
+
## [9.0.0-beta.20](https://github.com/microsoft/fluentui/tree/@fluentui/global-context_v9.0.0-beta.20)
|
|
223
|
+
|
|
224
|
+
Mon, 13 Mar 2023 08:58:26 GMT
|
|
225
|
+
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/global-context_v9.0.0-beta.19..@fluentui/global-context_v9.0.0-beta.20)
|
|
226
|
+
|
|
227
|
+
### Changes
|
|
228
|
+
|
|
229
|
+
- Bump @fluentui/react-context-selector to v9.1.13 ([PR #27161](https://github.com/microsoft/fluentui/pull/27161) by beachball)
|
|
230
|
+
- Bump @fluentui/react-utilities to v9.7.0 ([PR #27161](https://github.com/microsoft/fluentui/pull/27161) by beachball)
|
|
231
|
+
|
|
232
|
+
## [9.0.0-beta.19](https://github.com/microsoft/fluentui/tree/@fluentui/global-context_v9.0.0-beta.19)
|
|
233
|
+
|
|
234
|
+
Fri, 10 Mar 2023 07:14:01 GMT
|
|
235
|
+
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/global-context_v9.0.0-beta.18..@fluentui/global-context_v9.0.0-beta.19)
|
|
236
|
+
|
|
237
|
+
### Changes
|
|
238
|
+
|
|
239
|
+
- Bump @fluentui/react-context-selector to v9.1.12 ([PR #27157](https://github.com/microsoft/fluentui/pull/27157) by beachball)
|
|
240
|
+
- Bump @fluentui/react-utilities to v9.6.2 ([PR #27157](https://github.com/microsoft/fluentui/pull/27157) by beachball)
|
|
241
|
+
|
|
242
|
+
## [9.0.0-beta.18](https://github.com/microsoft/fluentui/tree/@fluentui/global-context_v9.0.0-beta.18)
|
|
243
|
+
|
|
244
|
+
Wed, 08 Mar 2023 17:42:51 GMT
|
|
245
|
+
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/global-context_v9.0.0-beta.17..@fluentui/global-context_v9.0.0-beta.18)
|
|
246
|
+
|
|
247
|
+
### Changes
|
|
248
|
+
|
|
249
|
+
- Bump @fluentui/react-context-selector to v9.1.11 ([PR #27127](https://github.com/microsoft/fluentui/pull/27127) by beachball)
|
|
250
|
+
- Bump @fluentui/react-utilities to v9.6.1 ([PR #27127](https://github.com/microsoft/fluentui/pull/27127) by beachball)
|
|
251
|
+
|
|
252
|
+
## [9.0.0-beta.17](https://github.com/microsoft/fluentui/tree/@fluentui/global-context_v9.0.0-beta.17)
|
|
253
|
+
|
|
254
|
+
Wed, 15 Feb 2023 11:44:52 GMT
|
|
255
|
+
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/global-context_v9.0.0-beta.16..@fluentui/global-context_v9.0.0-beta.17)
|
|
256
|
+
|
|
257
|
+
### Changes
|
|
258
|
+
|
|
259
|
+
- Bump @fluentui/react-context-selector to v9.1.10 ([PR #26845](https://github.com/microsoft/fluentui/pull/26845) by beachball)
|
|
260
|
+
- Bump @fluentui/react-utilities to v9.6.0 ([PR #26845](https://github.com/microsoft/fluentui/pull/26845) by beachball)
|
|
261
|
+
|
|
262
|
+
## [9.0.0-beta.16](https://github.com/microsoft/fluentui/tree/@fluentui/global-context_v9.0.0-beta.16)
|
|
263
|
+
|
|
264
|
+
Mon, 13 Feb 2023 23:43:14 GMT
|
|
265
|
+
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/global-context_v9.0.0-beta.15..@fluentui/global-context_v9.0.0-beta.16)
|
|
266
|
+
|
|
267
|
+
### Changes
|
|
268
|
+
|
|
269
|
+
- Bump @fluentui/react-context-selector to v9.1.9 ([PR #26814](https://github.com/microsoft/fluentui/pull/26814) by beachball)
|
|
270
|
+
- Bump @fluentui/react-utilities to v9.5.3 ([PR #26814](https://github.com/microsoft/fluentui/pull/26814) by beachball)
|
|
271
|
+
|
|
272
|
+
## [9.0.0-beta.15](https://github.com/microsoft/fluentui/tree/@fluentui/global-context_v9.0.0-beta.15)
|
|
273
|
+
|
|
274
|
+
Fri, 10 Feb 2023 08:50:02 GMT
|
|
275
|
+
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/global-context_v9.0.0-beta.14..@fluentui/global-context_v9.0.0-beta.15)
|
|
276
|
+
|
|
277
|
+
### Changes
|
|
278
|
+
|
|
279
|
+
- Bump @fluentui/react-context-selector to v9.1.8 ([commit](https://github.com/microsoft/fluentui/commit/cc62f050f8231e8f21a2cf7dddf33003e0ba3931) by beachball)
|
|
280
|
+
- Bump @fluentui/react-utilities to v9.5.2 ([commit](https://github.com/microsoft/fluentui/commit/cc62f050f8231e8f21a2cf7dddf33003e0ba3931) by beachball)
|
|
281
|
+
|
|
282
|
+
## [9.0.0-beta.14](https://github.com/microsoft/fluentui/tree/@fluentui/global-context_v9.0.0-beta.14)
|
|
283
|
+
|
|
284
|
+
Tue, 31 Jan 2023 19:53:58 GMT
|
|
285
|
+
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/global-context_v9.0.0-beta.13..@fluentui/global-context_v9.0.0-beta.14)
|
|
286
|
+
|
|
287
|
+
### Changes
|
|
288
|
+
|
|
289
|
+
- Bump @fluentui/react-context-selector to v9.1.7 ([PR #26557](https://github.com/microsoft/fluentui/pull/26557) by beachball)
|
|
290
|
+
- Bump @fluentui/react-utilities to v9.5.1 ([PR #26557](https://github.com/microsoft/fluentui/pull/26557) by beachball)
|
|
291
|
+
|
|
292
|
+
## [9.0.0-beta.13](https://github.com/microsoft/fluentui/tree/@fluentui/global-context_v9.0.0-beta.13)
|
|
293
|
+
|
|
294
|
+
Thu, 26 Jan 2023 13:31:03 GMT
|
|
295
|
+
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/global-context_v9.0.0-beta.12..@fluentui/global-context_v9.0.0-beta.13)
|
|
296
|
+
|
|
297
|
+
### Changes
|
|
298
|
+
|
|
299
|
+
- Bump @fluentui/react-context-selector to v9.1.6 ([PR #26496](https://github.com/microsoft/fluentui/pull/26496) by beachball)
|
|
300
|
+
- Bump @fluentui/react-utilities to v9.5.0 ([PR #26496](https://github.com/microsoft/fluentui/pull/26496) by beachball)
|
|
301
|
+
|
|
302
|
+
## [9.0.0-beta.12](https://github.com/microsoft/fluentui/tree/@fluentui/global-context_v9.0.0-beta.12)
|
|
303
|
+
|
|
304
|
+
Mon, 09 Jan 2023 14:34:54 GMT
|
|
305
|
+
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/global-context_v9.0.0-beta.11..@fluentui/global-context_v9.0.0-beta.12)
|
|
306
|
+
|
|
307
|
+
### Changes
|
|
308
|
+
|
|
309
|
+
- Bump @fluentui/react-context-selector to v9.1.5 ([PR #26255](https://github.com/microsoft/fluentui/pull/26255) by beachball)
|
|
310
|
+
- Bump @fluentui/react-utilities to v9.4.0 ([PR #26255](https://github.com/microsoft/fluentui/pull/26255) by beachball)
|
|
311
|
+
|
|
312
|
+
## [9.0.0-beta.11](https://github.com/microsoft/fluentui/tree/@fluentui/global-context_v9.0.0-beta.11)
|
|
313
|
+
|
|
314
|
+
Wed, 04 Jan 2023 01:40:46 GMT
|
|
315
|
+
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/global-context_v9.0.0-beta.10..@fluentui/global-context_v9.0.0-beta.11)
|
|
316
|
+
|
|
317
|
+
### Changes
|
|
318
|
+
|
|
319
|
+
- Bump @fluentui/react-context-selector to v9.1.4 ([PR #26114](https://github.com/microsoft/fluentui/pull/26114) by beachball)
|
|
320
|
+
- Bump @fluentui/react-utilities to v9.3.1 ([PR #26114](https://github.com/microsoft/fluentui/pull/26114) by beachball)
|
|
321
|
+
|
|
322
|
+
## [9.0.0-beta.10](https://github.com/microsoft/fluentui/tree/@fluentui/global-context_v9.0.0-beta.10)
|
|
323
|
+
|
|
324
|
+
Tue, 20 Dec 2022 14:59:34 GMT
|
|
325
|
+
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/global-context_v9.0.0-beta.9..@fluentui/global-context_v9.0.0-beta.10)
|
|
326
|
+
|
|
327
|
+
### Changes
|
|
328
|
+
|
|
329
|
+
- Bump @fluentui/react-context-selector to v9.1.3 ([PR #26047](https://github.com/microsoft/fluentui/pull/26047) by beachball)
|
|
330
|
+
- Bump @fluentui/react-utilities to v9.3.0 ([PR #26047](https://github.com/microsoft/fluentui/pull/26047) by beachball)
|
|
331
|
+
|
|
332
|
+
## [9.0.0-beta.9](https://github.com/microsoft/fluentui/tree/@fluentui/global-context_v9.0.0-beta.9)
|
|
333
|
+
|
|
334
|
+
Thu, 17 Nov 2022 23:05:31 GMT
|
|
335
|
+
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/global-context_v9.0.0-beta.8..@fluentui/global-context_v9.0.0-beta.9)
|
|
336
|
+
|
|
337
|
+
### Changes
|
|
338
|
+
|
|
339
|
+
- Bump @fluentui/react-context-selector to v9.1.2 ([PR #25683](https://github.com/microsoft/fluentui/pull/25683) by beachball)
|
|
340
|
+
- Bump @fluentui/react-utilities to v9.2.2 ([PR #25683](https://github.com/microsoft/fluentui/pull/25683) by beachball)
|
|
341
|
+
|
|
342
|
+
## [9.0.0-beta.8](https://github.com/microsoft/fluentui/tree/@fluentui/global-context_v9.0.0-beta.8)
|
|
343
|
+
|
|
344
|
+
Fri, 11 Nov 2022 14:57:50 GMT
|
|
345
|
+
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/global-context_v9.0.0-beta.7..@fluentui/global-context_v9.0.0-beta.8)
|
|
346
|
+
|
|
347
|
+
### Changes
|
|
348
|
+
|
|
349
|
+
- fix: create valid export maps ([PR #25558](https://github.com/microsoft/fluentui/pull/25558) by martinhochel@microsoft.com)
|
|
350
|
+
- Bump @fluentui/react-context-selector to v9.1.1 ([PR #25615](https://github.com/microsoft/fluentui/pull/25615) by beachball)
|
|
351
|
+
- Bump @fluentui/react-utilities to v9.2.1 ([PR #25615](https://github.com/microsoft/fluentui/pull/25615) by beachball)
|
|
352
|
+
|
|
353
|
+
## [9.0.0-beta.7](https://github.com/microsoft/fluentui/tree/@fluentui/global-context_v9.0.0-beta.7)
|
|
354
|
+
|
|
355
|
+
Wed, 02 Nov 2022 11:58:07 GMT
|
|
356
|
+
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/global-context_v9.0.0-beta.6..@fluentui/global-context_v9.0.0-beta.7)
|
|
357
|
+
|
|
358
|
+
### Changes
|
|
359
|
+
|
|
360
|
+
- Bump @fluentui/react-context-selector to v9.1.0 ([PR #25456](https://github.com/microsoft/fluentui/pull/25456) by beachball)
|
|
361
|
+
- Bump @fluentui/react-utilities to v9.2.0 ([PR #25456](https://github.com/microsoft/fluentui/pull/25456) by beachball)
|
|
362
|
+
|
|
363
|
+
## [9.0.0-beta.6](https://github.com/microsoft/fluentui/tree/@fluentui/global-context_v9.0.0-beta.6)
|
|
364
|
+
|
|
365
|
+
Thu, 20 Oct 2022 08:39:56 GMT
|
|
366
|
+
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/global-context_v9.0.0-beta.5..@fluentui/global-context_v9.0.0-beta.6)
|
|
367
|
+
|
|
368
|
+
### Changes
|
|
369
|
+
|
|
370
|
+
- chore: Bump peer deps to support React 18 ([PR #24972](https://github.com/microsoft/fluentui/pull/24972) by mgodbolt@microsoft.com)
|
|
371
|
+
- Bump @fluentui/react-context-selector to v9.0.5 ([PR #25265](https://github.com/microsoft/fluentui/pull/25265) by beachball)
|
|
372
|
+
- Bump @fluentui/react-utilities to v9.1.2 ([PR #25265](https://github.com/microsoft/fluentui/pull/25265) by beachball)
|
|
373
|
+
|
|
374
|
+
## [9.0.0-beta.5](https://github.com/microsoft/fluentui/tree/@fluentui/global-context_v9.0.0-beta.5)
|
|
375
|
+
|
|
376
|
+
Thu, 13 Oct 2022 11:03:06 GMT
|
|
377
|
+
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/global-context_v9.0.0-beta.4..@fluentui/global-context_v9.0.0-beta.5)
|
|
378
|
+
|
|
379
|
+
### Changes
|
|
380
|
+
|
|
381
|
+
- Bump @fluentui/react-context-selector to v9.0.4 ([PR #25181](https://github.com/microsoft/fluentui/pull/25181) by beachball)
|
|
382
|
+
- Bump @fluentui/react-utilities to v9.1.1 ([PR #25181](https://github.com/microsoft/fluentui/pull/25181) by beachball)
|
|
383
|
+
|
|
7
384
|
## [9.0.0-beta.4](https://github.com/microsoft/fluentui/tree/@fluentui/global-context_v9.0.0-beta.4)
|
|
8
385
|
|
|
9
|
-
Thu, 15 Sep 2022 09:
|
|
386
|
+
Thu, 15 Sep 2022 09:49:44 GMT
|
|
10
387
|
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/global-context_v9.0.0-beta.3..@fluentui/global-context_v9.0.0-beta.4)
|
|
11
388
|
|
|
12
389
|
### Changes
|
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# @fluentui/global-context
|
|
2
2
|
|
|
3
|
-
**Global Context for [Fluent UI React](https://
|
|
3
|
+
**Global Context for [Fluent UI React](https://react.fluentui.dev)**
|
|
4
4
|
|
|
5
5
|
This package contains a shim for `React.createContext` API that will register the context object to the global
|
|
6
6
|
scope (`window` for browsers, `global` for nodejs). This means that contexts will be real singletons.
|
|
@@ -1,23 +1,22 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
1
2
|
import { createContext as baseCreateContext } from '@fluentui/react-context-selector';
|
|
2
3
|
import { canUseDOM } from '@fluentui/react-utilities';
|
|
3
4
|
import { getMajorVersion } from './utils';
|
|
4
|
-
const isBrowser =
|
|
5
|
-
const globalObject = isBrowser ? window : global;
|
|
5
|
+
const isBrowser = canUseDOM();
|
|
6
|
+
const globalObject = isBrowser ? window : global;
|
|
7
|
+
// Identifier for the symbol, for easy idenfitifaction of symbols created by this util
|
|
6
8
|
// Useful for clearning global object during SSR reloads
|
|
7
|
-
|
|
8
|
-
|
|
9
|
+
export const SYMBOL_NAMESPACE = 'global-context-selector:';
|
|
10
|
+
// During SSR the global object persists with the server process
|
|
9
11
|
// Clean out the global object during server reload during development
|
|
10
|
-
|
|
11
12
|
if (!isBrowser && process.env.NODE_ENV !== 'production') {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
}
|
|
20
|
-
});
|
|
13
|
+
const globalSymbols = Object.getOwnPropertySymbols(globalObject);
|
|
14
|
+
globalSymbols.forEach((sym)=>{
|
|
15
|
+
var _Symbol_keyFor;
|
|
16
|
+
if ((_Symbol_keyFor = Symbol.keyFor(sym)) === null || _Symbol_keyFor === void 0 ? void 0 : _Symbol_keyFor.startsWith(SYMBOL_NAMESPACE)) {
|
|
17
|
+
delete globalObject[sym];
|
|
18
|
+
}
|
|
19
|
+
});
|
|
21
20
|
}
|
|
22
21
|
/**
|
|
23
22
|
* Wrapper around @see createContext from \@fluentui/react-context-selector that implements context registration
|
|
@@ -31,23 +30,15 @@ if (!isBrowser && process.env.NODE_ENV !== 'production') {
|
|
|
31
30
|
* @param packageName - name of the npm package where the module is used
|
|
32
31
|
* @param packageVersion - version of the npm package where the module is used
|
|
33
32
|
* @returns @see React.createContext
|
|
34
|
-
*/
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
// @ts-expect-error - Indexing object with symbols not supported until TS 4.4
|
|
46
|
-
// eslint-disable-next-line @fluentui/no-context-default-value
|
|
47
|
-
globalObject[sym] = baseCreateContext(defaultValue);
|
|
48
|
-
} // @ts-expect-error - Indexing object with symbols not supported until TS 4.4
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
return globalObject[sym];
|
|
33
|
+
*/ export const createContext = (defaultValue, name, packageName, packageVersion)=>{
|
|
34
|
+
// Symbol guaranteed to be unique for the entire runtime
|
|
35
|
+
const sym = Symbol.for(`${SYMBOL_NAMESPACE}${packageName}/${name}/@${getMajorVersion(packageVersion)}`);
|
|
36
|
+
// Objects keyed with symbols are not visible with console.log
|
|
37
|
+
// Object symbol properties can't be iterated with `for` or `Object.keys`
|
|
38
|
+
const globalSymbols = Object.getOwnPropertySymbols(globalObject);
|
|
39
|
+
if (!globalSymbols.includes(sym)) {
|
|
40
|
+
// eslint-disable-next-line @fluentui/no-context-default-value
|
|
41
|
+
globalObject[sym] = baseCreateContext(defaultValue);
|
|
42
|
+
}
|
|
43
|
+
return globalObject[sym];
|
|
52
44
|
};
|
|
53
|
-
//# sourceMappingURL=global-context-selector.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["global-context-selector.ts"],"
|
|
1
|
+
{"version":3,"sources":["global-context-selector.ts"],"sourcesContent":["import * as React from 'react';\nimport { createContext as baseCreateContext } from '@fluentui/react-context-selector';\nimport { canUseDOM } from '@fluentui/react-utilities';\nimport { getMajorVersion } from './utils';\nimport { GlobalObject } from './types';\n\nconst isBrowser = canUseDOM();\nconst globalObject: GlobalObject = isBrowser ? window : global;\n\n// Identifier for the symbol, for easy idenfitifaction of symbols created by this util\n// Useful for clearning global object during SSR reloads\nexport const SYMBOL_NAMESPACE = 'global-context-selector:';\n\n// During SSR the global object persists with the server process\n// Clean out the global object during server reload during development\nif (!isBrowser && process.env.NODE_ENV !== 'production') {\n const globalSymbols = Object.getOwnPropertySymbols(globalObject);\n globalSymbols.forEach(sym => {\n if (Symbol.keyFor(sym)?.startsWith(SYMBOL_NAMESPACE)) {\n delete globalObject[sym];\n }\n });\n}\n\n/**\n * Wrapper around @see createContext from \\@fluentui/react-context-selector that implements context registration\n * in the globalThis object to avoid duplicate contexts. Contexts are keyed with\n * a unique sybmol for the package name, version and name of the context.\n *\n * @see {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Symbol}\n *\n * @param defaultValue - @see React.createContext\n * @param name - name of the context\n * @param packageName - name of the npm package where the module is used\n * @param packageVersion - version of the npm package where the module is used\n * @returns @see React.createContext\n */\nexport const createContext = <T>(defaultValue: T, name: string, packageName: string, packageVersion: string) => {\n // Symbol guaranteed to be unique for the entire runtime\n const sym = Symbol.for(`${SYMBOL_NAMESPACE}${packageName}/${name}/@${getMajorVersion(packageVersion)}`);\n\n // Objects keyed with symbols are not visible with console.log\n // Object symbol properties can't be iterated with `for` or `Object.keys`\n const globalSymbols = Object.getOwnPropertySymbols(globalObject);\n if (!globalSymbols.includes(sym)) {\n // eslint-disable-next-line @fluentui/no-context-default-value\n globalObject[sym] = baseCreateContext<unknown>(defaultValue);\n }\n\n return globalObject[sym] as React.Context<T>;\n};\n"],"names":["React","createContext","baseCreateContext","canUseDOM","getMajorVersion","isBrowser","globalObject","window","global","SYMBOL_NAMESPACE","process","env","NODE_ENV","globalSymbols","Object","getOwnPropertySymbols","forEach","sym","Symbol","keyFor","startsWith","defaultValue","name","packageName","packageVersion","for","includes"],"mappings":"AAAA,YAAYA,WAAW,QAAQ;AAC/B,SAASC,iBAAiBC,iBAAiB,QAAQ,mCAAmC;AACtF,SAASC,SAAS,QAAQ,4BAA4B;AACtD,SAASC,eAAe,QAAQ,UAAU;AAG1C,MAAMC,YAAYF;AAClB,MAAMG,eAA6BD,YAAYE,SAASC;AAExD,sFAAsF;AACtF,wDAAwD;AACxD,OAAO,MAAMC,mBAAmB,2BAA2B;AAE3D,gEAAgE;AAChE,sEAAsE;AACtE,IAAI,CAACJ,aAAaK,QAAQC,GAAG,CAACC,QAAQ,KAAK,cAAc;IACvD,MAAMC,gBAAgBC,OAAOC,qBAAqB,CAACT;IACnDO,cAAcG,OAAO,CAACC,CAAAA;YAChBC;QAAJ,KAAIA,iBAAAA,OAAOC,MAAM,CAACF,kBAAdC,qCAAAA,eAAoBE,UAAU,CAACX,mBAAmB;YACpD,OAAOH,YAAY,CAACW,IAAI;QAC1B;IACF;AACF;AAEA;;;;;;;;;;;;CAYC,GACD,OAAO,MAAMhB,gBAAgB,CAAIoB,cAAiBC,MAAcC,aAAqBC;IACnF,wDAAwD;IACxD,MAAMP,MAAMC,OAAOO,GAAG,CAAC,CAAC,EAAEhB,iBAAiB,EAAEc,YAAY,CAAC,EAAED,KAAK,EAAE,EAAElB,gBAAgBoB,gBAAgB,CAAC;IAEtG,8DAA8D;IAC9D,yEAAyE;IACzE,MAAMX,gBAAgBC,OAAOC,qBAAqB,CAACT;IACnD,IAAI,CAACO,cAAca,QAAQ,CAACT,MAAM;QAChC,8DAA8D;QAC9DX,YAAY,CAACW,IAAI,GAAGf,kBAA2BmB;IACjD;IAEA,OAAOf,YAAY,CAACW,IAAI;AAC1B,EAAE"}
|
package/lib/global-context.js
CHANGED
|
@@ -1,23 +1,21 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { canUseDOM } from '@fluentui/react-utilities';
|
|
3
3
|
import { getMajorVersion } from './utils';
|
|
4
|
-
const isBrowser =
|
|
5
|
-
const globalObject = isBrowser ? window : global;
|
|
4
|
+
const isBrowser = canUseDOM();
|
|
5
|
+
const globalObject = isBrowser ? window : global;
|
|
6
|
+
// Identifier for the symbol, for easy idenfitifaction of symbols created by this util
|
|
6
7
|
// Useful for clearning global object during SSR reloads
|
|
7
|
-
|
|
8
|
-
|
|
8
|
+
export const SYMBOL_NAMESPACE = 'global-context:';
|
|
9
|
+
// During SSR the global object persists with the server process
|
|
9
10
|
// Clean out the global object during server reload during development
|
|
10
|
-
|
|
11
11
|
if (!isBrowser && process.env.NODE_ENV !== 'production') {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
}
|
|
20
|
-
});
|
|
12
|
+
const globalSymbols = Object.getOwnPropertySymbols(globalObject);
|
|
13
|
+
globalSymbols.forEach((sym)=>{
|
|
14
|
+
var _Symbol_keyFor;
|
|
15
|
+
if ((_Symbol_keyFor = Symbol.keyFor(sym)) === null || _Symbol_keyFor === void 0 ? void 0 : _Symbol_keyFor.startsWith(SYMBOL_NAMESPACE)) {
|
|
16
|
+
delete globalObject[sym];
|
|
17
|
+
}
|
|
18
|
+
});
|
|
21
19
|
}
|
|
22
20
|
/**
|
|
23
21
|
* Wrapper around @see React.createContext that implements context registration
|
|
@@ -31,23 +29,15 @@ if (!isBrowser && process.env.NODE_ENV !== 'production') {
|
|
|
31
29
|
* @param packageName - name of the npm package where the module is used
|
|
32
30
|
* @param packageVersion - version of the npm package where the module is used
|
|
33
31
|
* @returns @see React.createContext
|
|
34
|
-
*/
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
// @ts-expect-error - Indexing object with symbols not supported until TS 4.4
|
|
46
|
-
// eslint-disable-next-line @fluentui/no-context-default-value
|
|
47
|
-
globalObject[sym] = /*#__PURE__*/React.createContext(defaultValue);
|
|
48
|
-
} // @ts-expect-error - Indexing object with symbols not supported until TS 4.4
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
return globalObject[sym];
|
|
32
|
+
*/ export const createContext = (defaultValue, name, packageName, packageVersion)=>{
|
|
33
|
+
// Symbol guaranteed to be unique for the entire runtime
|
|
34
|
+
const sym = Symbol.for(`${SYMBOL_NAMESPACE}${packageName}/${name}/@${getMajorVersion(packageVersion)}`);
|
|
35
|
+
// Objects keyed with symbols are not visible with console.log
|
|
36
|
+
// Object symbol properties can't be iterated with `for` or `Object.keys`
|
|
37
|
+
const globalSymbols = Object.getOwnPropertySymbols(globalObject);
|
|
38
|
+
if (!globalSymbols.includes(sym)) {
|
|
39
|
+
// eslint-disable-next-line @fluentui/no-context-default-value
|
|
40
|
+
globalObject[sym] = React.createContext(defaultValue);
|
|
41
|
+
}
|
|
42
|
+
return globalObject[sym];
|
|
52
43
|
};
|
|
53
|
-
//# sourceMappingURL=global-context.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["global-context.ts"],"
|
|
1
|
+
{"version":3,"sources":["global-context.ts"],"sourcesContent":["import * as React from 'react';\nimport { canUseDOM } from '@fluentui/react-utilities';\nimport { GlobalObject } from './types';\nimport { getMajorVersion } from './utils';\n\nconst isBrowser = canUseDOM();\nconst globalObject: GlobalObject = isBrowser ? window : global;\n\n// Identifier for the symbol, for easy idenfitifaction of symbols created by this util\n// Useful for clearning global object during SSR reloads\nexport const SYMBOL_NAMESPACE = 'global-context:';\n\n// During SSR the global object persists with the server process\n// Clean out the global object during server reload during development\nif (!isBrowser && process.env.NODE_ENV !== 'production') {\n const globalSymbols = Object.getOwnPropertySymbols(globalObject);\n globalSymbols.forEach(sym => {\n if (Symbol.keyFor(sym)?.startsWith(SYMBOL_NAMESPACE)) {\n delete globalObject[sym];\n }\n });\n}\n\n/**\n * Wrapper around @see React.createContext that implements context registration\n * in the globalThis object to avoid duplicate contexts. Contexts are keyed with\n * a unique sybmol for the package name, version and name of the context.\n *\n * @see {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Symbol}\n *\n * @param defaultValue - @see React.createContext\n * @param name - name of the context\n * @param packageName - name of the npm package where the module is used\n * @param packageVersion - version of the npm package where the module is used\n * @returns @see React.createContext\n */\nexport const createContext = <T>(defaultValue: T, name: string, packageName: string, packageVersion: string) => {\n // Symbol guaranteed to be unique for the entire runtime\n const sym = Symbol.for(`${SYMBOL_NAMESPACE}${packageName}/${name}/@${getMajorVersion(packageVersion)}`);\n\n // Objects keyed with symbols are not visible with console.log\n // Object symbol properties can't be iterated with `for` or `Object.keys`\n const globalSymbols = Object.getOwnPropertySymbols(globalObject);\n if (!globalSymbols.includes(sym)) {\n // eslint-disable-next-line @fluentui/no-context-default-value\n globalObject[sym] = React.createContext<unknown>(defaultValue);\n }\n\n return globalObject[sym] as React.Context<T>;\n};\n"],"names":["React","canUseDOM","getMajorVersion","isBrowser","globalObject","window","global","SYMBOL_NAMESPACE","process","env","NODE_ENV","globalSymbols","Object","getOwnPropertySymbols","forEach","sym","Symbol","keyFor","startsWith","createContext","defaultValue","name","packageName","packageVersion","for","includes"],"mappings":"AAAA,YAAYA,WAAW,QAAQ;AAC/B,SAASC,SAAS,QAAQ,4BAA4B;AAEtD,SAASC,eAAe,QAAQ,UAAU;AAE1C,MAAMC,YAAYF;AAClB,MAAMG,eAA6BD,YAAYE,SAASC;AAExD,sFAAsF;AACtF,wDAAwD;AACxD,OAAO,MAAMC,mBAAmB,kBAAkB;AAElD,gEAAgE;AAChE,sEAAsE;AACtE,IAAI,CAACJ,aAAaK,QAAQC,GAAG,CAACC,QAAQ,KAAK,cAAc;IACvD,MAAMC,gBAAgBC,OAAOC,qBAAqB,CAACT;IACnDO,cAAcG,OAAO,CAACC,CAAAA;YAChBC;QAAJ,KAAIA,iBAAAA,OAAOC,MAAM,CAACF,kBAAdC,qCAAAA,eAAoBE,UAAU,CAACX,mBAAmB;YACpD,OAAOH,YAAY,CAACW,IAAI;QAC1B;IACF;AACF;AAEA;;;;;;;;;;;;CAYC,GACD,OAAO,MAAMI,gBAAgB,CAAIC,cAAiBC,MAAcC,aAAqBC;IACnF,wDAAwD;IACxD,MAAMR,MAAMC,OAAOQ,GAAG,CAAC,CAAC,EAAEjB,iBAAiB,EAAEe,YAAY,CAAC,EAAED,KAAK,EAAE,EAAEnB,gBAAgBqB,gBAAgB,CAAC;IAEtG,8DAA8D;IAC9D,yEAAyE;IACzE,MAAMZ,gBAAgBC,OAAOC,qBAAqB,CAACT;IACnD,IAAI,CAACO,cAAcc,QAAQ,CAACV,MAAM;QAChC,8DAA8D;QAC9DX,YAAY,CAACW,IAAI,GAAGf,MAAMmB,aAAa,CAAUC;IACnD;IAEA,OAAOhB,YAAY,CAACW,IAAI;AAC1B,EAAE"}
|
package/lib/index.js
CHANGED
package/lib/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"sources":["index.ts"],"sourcesContent":["export { createContext } from './global-context';\nexport { createContext as createContextSelector } from './global-context-selector';\n"],"names":["createContext","createContextSelector"],"mappings":"AAAA,SAASA,aAAa,QAAQ,mBAAmB;AACjD,SAASA,iBAAiBC,qBAAqB,QAAQ,4BAA4B"}
|
package/lib/types.js
CHANGED
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
//# sourceMappingURL=types.js.map
|
|
1
|
+
import * as React from 'react';
|
package/lib/types.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"sources":["types.ts"],"sourcesContent":["import * as React from 'react';\n\nexport type GlobalObject = typeof globalThis & Record<symbol, React.Context<unknown>>;\n"],"names":["React"],"mappings":"AAAA,YAAYA,WAAW,QAAQ"}
|
package/lib/utils.js
CHANGED
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @param version - semver version string
|
|
3
3
|
* @returns The major version number
|
|
4
|
-
*/
|
|
5
|
-
|
|
6
|
-
return Number(version.split('.')[0]);
|
|
4
|
+
*/ export function getMajorVersion(version) {
|
|
5
|
+
return Number(version.split('.')[0]);
|
|
7
6
|
}
|
|
8
|
-
//# sourceMappingURL=utils.js.map
|
package/lib/utils.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["utils.ts"],"
|
|
1
|
+
{"version":3,"sources":["utils.ts"],"sourcesContent":["/**\n * @param version - semver version string\n * @returns The major version number\n */\nexport function getMajorVersion(version: string) {\n return Number(version.split('.')[0]);\n}\n"],"names":["getMajorVersion","version","Number","split"],"mappings":"AAAA;;;CAGC,GACD,OAAO,SAASA,gBAAgBC,OAAe;IAC7C,OAAOC,OAAOD,QAAQE,KAAK,CAAC,IAAI,CAAC,EAAE;AACrC"}
|