@fluentui/global-context 9.0.0-beta.3 → 9.0.0-beta.5

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 CHANGED
@@ -2,7 +2,78 @@
2
2
  "name": "@fluentui/global-context",
3
3
  "entries": [
4
4
  {
5
- "date": "Thu, 14 Jul 2022 21:18:42 GMT",
5
+ "date": "Thu, 13 Oct 2022 10:59:42 GMT",
6
+ "tag": "@fluentui/global-context_v9.0.0-beta.5",
7
+ "version": "9.0.0-beta.5",
8
+ "comments": {
9
+ "prerelease": [
10
+ {
11
+ "author": "beachball",
12
+ "package": "@fluentui/global-context",
13
+ "comment": "Bump @fluentui/react-context-selector to v9.0.4",
14
+ "commit": "cd05c21e62ff37812d614330eb70f97fd978c97a"
15
+ },
16
+ {
17
+ "author": "beachball",
18
+ "package": "@fluentui/global-context",
19
+ "comment": "Bump @fluentui/react-utilities to v9.1.1",
20
+ "commit": "cd05c21e62ff37812d614330eb70f97fd978c97a"
21
+ }
22
+ ]
23
+ }
24
+ },
25
+ {
26
+ "date": "Thu, 15 Sep 2022 09:49:44 GMT",
27
+ "tag": "@fluentui/global-context_v9.0.0-beta.4",
28
+ "version": "9.0.0-beta.4",
29
+ "comments": {
30
+ "none": [
31
+ {
32
+ "author": "martinhochel@microsoft.com",
33
+ "package": "@fluentui/global-context",
34
+ "commit": "e6cf183695d6d67a24e038c49a876224e5ed35e5",
35
+ "comment": "chore: update package scaffold"
36
+ },
37
+ {
38
+ "author": "martinhochel@microsoft.com",
39
+ "package": "@fluentui/global-context",
40
+ "commit": "ba9444d594f3a960cc590eae5237c08bf7c5a07f",
41
+ "comment": "chore: consume cypress.config from it's package boundary"
42
+ }
43
+ ],
44
+ "prerelease": [
45
+ {
46
+ "author": "beachball",
47
+ "package": "@fluentui/global-context",
48
+ "comment": "Bump @fluentui/react-context-selector to v9.0.3",
49
+ "commit": "a33448fe4a0f4117686c378f80b893d1406d95a8"
50
+ },
51
+ {
52
+ "author": "beachball",
53
+ "package": "@fluentui/global-context",
54
+ "comment": "Bump @fluentui/react-utilities to v9.1.0",
55
+ "commit": "a33448fe4a0f4117686c378f80b893d1406d95a8"
56
+ }
57
+ ]
58
+ }
59
+ },
60
+ {
61
+ "date": "Wed, 03 Aug 2022 16:03:35 GMT",
62
+ "tag": "@fluentui/global-context_v9.0.0-beta.3",
63
+ "version": "9.0.0-beta.3",
64
+ "comments": {
65
+ "none": [
66
+ {
67
+ "author": "bernardo.sunderhus@gmail.com",
68
+ "package": "@fluentui/global-context",
69
+ "commit": "d966ea3d9169f2e8d69f0d2a4daf86fe4ca328d6",
70
+ "comment": "disables eslint rule @fluentui/no-context-default-value for local component context"
71
+ }
72
+ ]
73
+ }
74
+ },
75
+ {
76
+ "date": "Thu, 14 Jul 2022 21:21:07 GMT",
6
77
  "tag": "@fluentui/global-context_v9.0.0-beta.3",
7
78
  "version": "9.0.0-beta.3",
8
79
  "comments": {
@@ -17,13 +88,13 @@
17
88
  "author": "beachball",
18
89
  "package": "@fluentui/global-context",
19
90
  "comment": "Bump @fluentui/react-context-selector to v9.0.2",
20
- "commit": "802bc4e3730a88b0fc61b5bf42ef7fc6b6543fe2"
91
+ "commit": "79b513146194367544160f364b0a7dd749ed93e4"
21
92
  },
22
93
  {
23
94
  "author": "beachball",
24
95
  "package": "@fluentui/global-context",
25
96
  "comment": "Bump @fluentui/react-utilities to v9.0.2",
26
- "commit": "802bc4e3730a88b0fc61b5bf42ef7fc6b6543fe2"
97
+ "commit": "79b513146194367544160f364b0a7dd749ed93e4"
27
98
  }
28
99
  ]
29
100
  }
package/CHANGELOG.md CHANGED
@@ -1,19 +1,39 @@
1
1
  # Change Log - @fluentui/global-context
2
2
 
3
- This log was last generated on Thu, 14 Jul 2022 21:18:42 GMT and should not be manually modified.
3
+ This log was last generated on Thu, 13 Oct 2022 10:59:42 GMT and should not be manually modified.
4
4
 
5
5
  <!-- Start content -->
6
6
 
7
+ ## [9.0.0-beta.5](https://github.com/microsoft/fluentui/tree/@fluentui/global-context_v9.0.0-beta.5)
8
+
9
+ Thu, 13 Oct 2022 10:59:42 GMT
10
+ [Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/global-context_v9.0.0-beta.4..@fluentui/global-context_v9.0.0-beta.5)
11
+
12
+ ### Changes
13
+
14
+ - Bump @fluentui/react-context-selector to v9.0.4 ([PR #25181](https://github.com/microsoft/fluentui/pull/25181) by beachball)
15
+ - Bump @fluentui/react-utilities to v9.1.1 ([PR #25181](https://github.com/microsoft/fluentui/pull/25181) by beachball)
16
+
17
+ ## [9.0.0-beta.4](https://github.com/microsoft/fluentui/tree/@fluentui/global-context_v9.0.0-beta.4)
18
+
19
+ Thu, 15 Sep 2022 09:49:44 GMT
20
+ [Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/global-context_v9.0.0-beta.3..@fluentui/global-context_v9.0.0-beta.4)
21
+
22
+ ### Changes
23
+
24
+ - Bump @fluentui/react-context-selector to v9.0.3 ([PR #24808](https://github.com/microsoft/fluentui/pull/24808) by beachball)
25
+ - Bump @fluentui/react-utilities to v9.1.0 ([PR #24808](https://github.com/microsoft/fluentui/pull/24808) by beachball)
26
+
7
27
  ## [9.0.0-beta.3](https://github.com/microsoft/fluentui/tree/@fluentui/global-context_v9.0.0-beta.3)
8
28
 
9
- Thu, 14 Jul 2022 21:18:42 GMT
29
+ Thu, 14 Jul 2022 21:21:07 GMT
10
30
  [Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/global-context_v9.0.0-beta.2..@fluentui/global-context_v9.0.0-beta.3)
11
31
 
12
32
  ### Changes
13
33
 
14
34
  - fix: Fixing bad version bump of @fluentui/react-utilities. ([PR #23920](https://github.com/microsoft/fluentui/pull/23920) by Humberto.Morimoto@microsoft.com)
15
- - Bump @fluentui/react-context-selector to v9.0.2 ([PR #23920](https://github.com/microsoft/fluentui/pull/23920) by beachball)
16
- - Bump @fluentui/react-utilities to v9.0.2 ([PR #23920](https://github.com/microsoft/fluentui/pull/23920) by beachball)
35
+ - Bump @fluentui/react-context-selector to v9.0.2 ([PR #23918](https://github.com/microsoft/fluentui/pull/23918) by beachball)
36
+ - Bump @fluentui/react-utilities to v9.0.2 ([PR #23918](https://github.com/microsoft/fluentui/pull/23918) by beachball)
17
37
 
18
38
  ## [9.0.0-beta.2](https://github.com/microsoft/fluentui/tree/@fluentui/global-context_v9.0.0-beta.2)
19
39
 
@@ -43,6 +43,7 @@ export const createContext = (defaultValue, name, packageName, packageVersion) =
43
43
 
44
44
  if (!globalSymbols.includes(sym)) {
45
45
  // @ts-expect-error - Indexing object with symbols not supported until TS 4.4
46
+ // eslint-disable-next-line @fluentui/no-context-default-value
46
47
  globalObject[sym] = baseCreateContext(defaultValue);
47
48
  } // @ts-expect-error - Indexing object with symbols not supported until TS 4.4
48
49
 
@@ -1 +1 @@
1
- {"version":3,"sources":["global-context-selector.ts"],"names":[],"mappings":"AACA,SAAS,aAAa,IAAI,iBAA1B,QAAmD,kCAAnD;AACA,SAAS,SAAT,QAA0B,2BAA1B;AACA,SAAS,eAAT,QAAgC,SAAhC;AAGA,MAAM,SAAS,gBAAG,SAAS,EAA3B;AACA,MAAM,YAAY,GAAiB,SAAS,GAAG,MAAH,GAAY,MAAxD,C,CAEA;AACA;;AACA,OAAO,MAAM,gBAAgB,GAAG,0BAAzB,C,CAEP;AACA;;AACA,IAAI,CAAC,SAAD,IAAc,OAAO,CAAC,GAAR,CAAY,QAAZ,KAAyB,YAA3C,EAAyD;EACvD,MAAM,aAAa,gBAAG,MAAM,CAAC,qBAAP,CAA6B,YAA7B,CAAtB;EACA,aAAa,CAAC,OAAd,CAAsB,GAAG,IAAG;;;IAC1B,IAAI,CAAA,EAAA,GAAA,MAAM,CAAC,MAAP,CAAc,GAAd,CAAA,MAAkB,IAAlB,IAAkB,EAAA,KAAA,KAAA,CAAlB,GAAkB,KAAA,CAAlB,GAAkB,EAAA,CAAE,UAAF,CAAa,gBAAb,CAAtB,EAAsD;MACpD;MACA,OAAO,YAAY,CAAC,GAAD,CAAnB;IACD;EACF,CALD;AAMD;AAED;;;;;;;;;;;;AAYG;;;AACH,OAAO,MAAM,aAAa,GAAG,CAAI,YAAJ,EAAqB,IAArB,EAAmC,WAAnC,EAAwD,cAAxD,KAAkF;EAC7G;EACA,MAAM,GAAG,GAAG,MAAM,CAAC,GAAP,CAAW,GAAG,gBAAgB,GAAG,WAAW,IAAI,IAAI,KAAK,eAAe,CAAC,cAAD,CAAgB,EAAxF,CAAZ,CAF6G,CAI7G;EACA;;EACA,MAAM,aAAa,GAAG,MAAM,CAAC,qBAAP,CAA6B,YAA7B,CAAtB;;EACA,IAAI,CAAC,aAAa,CAAC,QAAd,CAAuB,GAAvB,CAAL,EAAkC;IAChC;IACA,YAAY,CAAC,GAAD,CAAZ,GAAoB,iBAAiB,CAAC,YAAD,CAArC;EACD,CAV4G,CAY7G;;;EACA,OAAO,YAAY,CAAC,GAAD,CAAnB;AACD,CAdM","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 // @ts-expect-error - Indexing object with symbols not supported until TS 4.4\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 // @ts-expect-error - Indexing object with symbols not supported until TS 4.4\n globalObject[sym] = baseCreateContext(defaultValue);\n }\n\n // @ts-expect-error - Indexing object with symbols not supported until TS 4.4\n return globalObject[sym] as React.Context<T>;\n};\n"],"sourceRoot":"../src/"}
1
+ {"version":3,"sources":["global-context-selector.ts"],"names":[],"mappings":"AACA,SAAS,aAAa,IAAI,iBAA1B,QAAmD,kCAAnD;AACA,SAAS,SAAT,QAA0B,2BAA1B;AACA,SAAS,eAAT,QAAgC,SAAhC;AAGA,MAAM,SAAS,gBAAG,SAAS,EAA3B;AACA,MAAM,YAAY,GAAiB,SAAS,GAAG,MAAH,GAAY,MAAxD,C,CAEA;AACA;;AACA,OAAO,MAAM,gBAAgB,GAAG,0BAAzB,C,CAEP;AACA;;AACA,IAAI,CAAC,SAAD,IAAc,OAAO,CAAC,GAAR,CAAY,QAAZ,KAAyB,YAA3C,EAAyD;EACvD,MAAM,aAAa,gBAAG,MAAM,CAAC,qBAAP,CAA6B,YAA7B,CAAtB;EACA,aAAa,CAAC,OAAd,CAAsB,GAAG,IAAG;;;IAC1B,IAAI,CAAA,EAAA,GAAA,MAAM,CAAC,MAAP,CAAc,GAAd,CAAA,MAAkB,IAAlB,IAAkB,EAAA,KAAA,KAAA,CAAlB,GAAkB,KAAA,CAAlB,GAAkB,EAAA,CAAE,UAAF,CAAa,gBAAb,CAAtB,EAAsD;MACpD;MACA,OAAO,YAAY,CAAC,GAAD,CAAnB;IACD;EACF,CALD;AAMD;AAED;;;;;;;;;;;;AAYG;;;AACH,OAAO,MAAM,aAAa,GAAG,CAAI,YAAJ,EAAqB,IAArB,EAAmC,WAAnC,EAAwD,cAAxD,KAAkF;EAC7G;EACA,MAAM,GAAG,GAAG,MAAM,CAAC,GAAP,CAAW,GAAG,gBAAgB,GAAG,WAAW,IAAI,IAAI,KAAK,eAAe,CAAC,cAAD,CAAgB,EAAxF,CAAZ,CAF6G,CAI7G;EACA;;EACA,MAAM,aAAa,GAAG,MAAM,CAAC,qBAAP,CAA6B,YAA7B,CAAtB;;EACA,IAAI,CAAC,aAAa,CAAC,QAAd,CAAuB,GAAvB,CAAL,EAAkC;IAChC;IACA;IACA,YAAY,CAAC,GAAD,CAAZ,GAAoB,iBAAiB,CAAC,YAAD,CAArC;EACD,CAX4G,CAa7G;;;EACA,OAAO,YAAY,CAAC,GAAD,CAAnB;AACD,CAfM","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 // @ts-expect-error - Indexing object with symbols not supported until TS 4.4\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 // @ts-expect-error - Indexing object with symbols not supported until TS 4.4\n // eslint-disable-next-line @fluentui/no-context-default-value\n globalObject[sym] = baseCreateContext(defaultValue);\n }\n\n // @ts-expect-error - Indexing object with symbols not supported until TS 4.4\n return globalObject[sym] as React.Context<T>;\n};\n"],"sourceRoot":"../src/"}
@@ -43,6 +43,7 @@ export const createContext = (defaultValue, name, packageName, packageVersion) =
43
43
 
44
44
  if (!globalSymbols.includes(sym)) {
45
45
  // @ts-expect-error - Indexing object with symbols not supported until TS 4.4
46
+ // eslint-disable-next-line @fluentui/no-context-default-value
46
47
  globalObject[sym] = /*#__PURE__*/React.createContext(defaultValue);
47
48
  } // @ts-expect-error - Indexing object with symbols not supported until TS 4.4
48
49
 
@@ -1 +1 @@
1
- {"version":3,"sources":["global-context.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAZ,MAAuB,OAAvB;AACA,SAAS,SAAT,QAA0B,2BAA1B;AAEA,SAAS,eAAT,QAAgC,SAAhC;AAEA,MAAM,SAAS,gBAAG,SAAS,EAA3B;AACA,MAAM,YAAY,GAAiB,SAAS,GAAG,MAAH,GAAY,MAAxD,C,CAEA;AACA;;AACA,OAAO,MAAM,gBAAgB,GAAG,iBAAzB,C,CAEP;AACA;;AACA,IAAI,CAAC,SAAD,IAAc,OAAO,CAAC,GAAR,CAAY,QAAZ,KAAyB,YAA3C,EAAyD;EACvD,MAAM,aAAa,gBAAG,MAAM,CAAC,qBAAP,CAA6B,YAA7B,CAAtB;EACA,aAAa,CAAC,OAAd,CAAsB,GAAG,IAAG;;;IAC1B,IAAI,CAAA,EAAA,GAAA,MAAM,CAAC,MAAP,CAAc,GAAd,CAAA,MAAkB,IAAlB,IAAkB,EAAA,KAAA,KAAA,CAAlB,GAAkB,KAAA,CAAlB,GAAkB,EAAA,CAAE,UAAF,CAAa,gBAAb,CAAtB,EAAsD;MACpD;MACA,OAAO,YAAY,CAAC,GAAD,CAAnB;IACD;EACF,CALD;AAMD;AAED;;;;;;;;;;;;AAYG;;;AACH,OAAO,MAAM,aAAa,GAAG,CAAI,YAAJ,EAAqB,IAArB,EAAmC,WAAnC,EAAwD,cAAxD,KAAkF;EAC7G;EACA,MAAM,GAAG,GAAG,MAAM,CAAC,GAAP,CAAW,GAAG,gBAAgB,GAAG,WAAW,IAAI,IAAI,KAAK,eAAe,CAAC,cAAD,CAAgB,EAAxF,CAAZ,CAF6G,CAI7G;EACA;;EACA,MAAM,aAAa,GAAG,MAAM,CAAC,qBAAP,CAA6B,YAA7B,CAAtB;;EACA,IAAI,CAAC,aAAa,CAAC,QAAd,CAAuB,GAAvB,CAAL,EAAkC;IAChC;IACA,YAAY,CAAC,GAAD,CAAZ,gBAAoB,KAAK,CAAC,aAAN,CAAoB,YAApB,CAApB;EACD,CAV4G,CAY7G;;;EACA,OAAO,YAAY,CAAC,GAAD,CAAnB;AACD,CAdM","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 // @ts-expect-error - Indexing object with symbols not supported until TS 4.4\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 // @ts-expect-error - Indexing object with symbols not supported until TS 4.4\n globalObject[sym] = React.createContext(defaultValue);\n }\n\n // @ts-expect-error - Indexing object with symbols not supported until TS 4.4\n return globalObject[sym] as React.Context<T>;\n};\n"],"sourceRoot":"../src/"}
1
+ {"version":3,"sources":["global-context.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAZ,MAAuB,OAAvB;AACA,SAAS,SAAT,QAA0B,2BAA1B;AAEA,SAAS,eAAT,QAAgC,SAAhC;AAEA,MAAM,SAAS,gBAAG,SAAS,EAA3B;AACA,MAAM,YAAY,GAAiB,SAAS,GAAG,MAAH,GAAY,MAAxD,C,CAEA;AACA;;AACA,OAAO,MAAM,gBAAgB,GAAG,iBAAzB,C,CAEP;AACA;;AACA,IAAI,CAAC,SAAD,IAAc,OAAO,CAAC,GAAR,CAAY,QAAZ,KAAyB,YAA3C,EAAyD;EACvD,MAAM,aAAa,gBAAG,MAAM,CAAC,qBAAP,CAA6B,YAA7B,CAAtB;EACA,aAAa,CAAC,OAAd,CAAsB,GAAG,IAAG;;;IAC1B,IAAI,CAAA,EAAA,GAAA,MAAM,CAAC,MAAP,CAAc,GAAd,CAAA,MAAkB,IAAlB,IAAkB,EAAA,KAAA,KAAA,CAAlB,GAAkB,KAAA,CAAlB,GAAkB,EAAA,CAAE,UAAF,CAAa,gBAAb,CAAtB,EAAsD;MACpD;MACA,OAAO,YAAY,CAAC,GAAD,CAAnB;IACD;EACF,CALD;AAMD;AAED;;;;;;;;;;;;AAYG;;;AACH,OAAO,MAAM,aAAa,GAAG,CAAI,YAAJ,EAAqB,IAArB,EAAmC,WAAnC,EAAwD,cAAxD,KAAkF;EAC7G;EACA,MAAM,GAAG,GAAG,MAAM,CAAC,GAAP,CAAW,GAAG,gBAAgB,GAAG,WAAW,IAAI,IAAI,KAAK,eAAe,CAAC,cAAD,CAAgB,EAAxF,CAAZ,CAF6G,CAI7G;EACA;;EACA,MAAM,aAAa,GAAG,MAAM,CAAC,qBAAP,CAA6B,YAA7B,CAAtB;;EACA,IAAI,CAAC,aAAa,CAAC,QAAd,CAAuB,GAAvB,CAAL,EAAkC;IAChC;IACA;IACA,YAAY,CAAC,GAAD,CAAZ,gBAAoB,KAAK,CAAC,aAAN,CAAoB,YAApB,CAApB;EACD,CAX4G,CAa7G;;;EACA,OAAO,YAAY,CAAC,GAAD,CAAnB;AACD,CAfM","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 // @ts-expect-error - Indexing object with symbols not supported until TS 4.4\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 // @ts-expect-error - Indexing object with symbols not supported until TS 4.4\n // eslint-disable-next-line @fluentui/no-context-default-value\n globalObject[sym] = React.createContext(defaultValue);\n }\n\n // @ts-expect-error - Indexing object with symbols not supported until TS 4.4\n return globalObject[sym] as React.Context<T>;\n};\n"],"sourceRoot":"../src/"}
@@ -53,6 +53,7 @@ const createContext = (defaultValue, name, packageName, packageVersion) => {
53
53
 
54
54
  if (!globalSymbols.includes(sym)) {
55
55
  // @ts-expect-error - Indexing object with symbols not supported until TS 4.4
56
+ // eslint-disable-next-line @fluentui/no-context-default-value
56
57
  globalObject[sym] = react_context_selector_1.createContext(defaultValue);
57
58
  } // @ts-expect-error - Indexing object with symbols not supported until TS 4.4
58
59
 
@@ -1 +1 @@
1
- {"version":3,"sources":["global-context-selector.ts"],"names":[],"mappings":";;;;;;;AACA,MAAA,wBAAA,gBAAA,OAAA,CAAA,kCAAA,CAAA;;AACA,MAAA,iBAAA,gBAAA,OAAA,CAAA,2BAAA,CAAA;;AACA,MAAA,OAAA,gBAAA,OAAA,CAAA,SAAA,CAAA;;AAGA,MAAM,SAAS,gBAAG,iBAAA,CAAA,SAAA,EAAlB;AACA,MAAM,YAAY,GAAiB,SAAS,GAAG,MAAH,GAAY,MAAxD,C,CAEA;AACA;;AACa,OAAA,CAAA,gBAAA,GAAmB,0BAAnB,C,CAEb;AACA;;AACA,IAAI,CAAC,SAAD,IAAc,OAAO,CAAC,GAAR,CAAY,QAAZ,KAAyB,YAA3C,EAAyD;EACvD,MAAM,aAAa,gBAAG,MAAM,CAAC,qBAAP,CAA6B,YAA7B,CAAtB;EACA,aAAa,CAAC,OAAd,CAAsB,GAAG,IAAG;;;IAC1B,IAAI,CAAA,EAAA,GAAA,MAAM,CAAC,MAAP,CAAc,GAAd,CAAA,MAAkB,IAAlB,IAAkB,EAAA,KAAA,KAAA,CAAlB,GAAkB,KAAA,CAAlB,GAAkB,EAAA,CAAE,UAAF,CAAa,OAAA,CAAA,gBAAb,CAAtB,EAAsD;MACpD;MACA,OAAO,YAAY,CAAC,GAAD,CAAnB;IACD;EACF,CALD;AAMD;AAED;;;;;;;;;;;;AAYG;;;AACI,MAAM,aAAa,GAAG,CAAI,YAAJ,EAAqB,IAArB,EAAmC,WAAnC,EAAwD,cAAxD,KAAkF;EAC7G;EACA,MAAM,GAAG,GAAG,MAAM,CAAC,GAAP,CAAW,GAAG,OAAA,CAAA,gBAAgB,GAAG,WAAW,IAAI,IAAI,KAAK,OAAA,CAAA,eAAA,CAAgB,cAAhB,CAA+B,EAAxF,CAAZ,CAF6G,CAI7G;EACA;;EACA,MAAM,aAAa,GAAG,MAAM,CAAC,qBAAP,CAA6B,YAA7B,CAAtB;;EACA,IAAI,CAAC,aAAa,CAAC,QAAd,CAAuB,GAAvB,CAAL,EAAkC;IAChC;IACA,YAAY,CAAC,GAAD,CAAZ,GAAoB,wBAAA,CAAA,aAAA,CAAkB,YAAlB,CAApB;EACD,CAV4G,CAY7G;;;EACA,OAAO,YAAY,CAAC,GAAD,CAAnB;AACD,CAdM;;AAAM,OAAA,CAAA,aAAA,GAAa,aAAb","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 // @ts-expect-error - Indexing object with symbols not supported until TS 4.4\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 // @ts-expect-error - Indexing object with symbols not supported until TS 4.4\n globalObject[sym] = baseCreateContext(defaultValue);\n }\n\n // @ts-expect-error - Indexing object with symbols not supported until TS 4.4\n return globalObject[sym] as React.Context<T>;\n};\n"],"sourceRoot":"../src/"}
1
+ {"version":3,"sources":["global-context-selector.ts"],"names":[],"mappings":";;;;;;;AACA,MAAA,wBAAA,gBAAA,OAAA,CAAA,kCAAA,CAAA;;AACA,MAAA,iBAAA,gBAAA,OAAA,CAAA,2BAAA,CAAA;;AACA,MAAA,OAAA,gBAAA,OAAA,CAAA,SAAA,CAAA;;AAGA,MAAM,SAAS,gBAAG,iBAAA,CAAA,SAAA,EAAlB;AACA,MAAM,YAAY,GAAiB,SAAS,GAAG,MAAH,GAAY,MAAxD,C,CAEA;AACA;;AACa,OAAA,CAAA,gBAAA,GAAmB,0BAAnB,C,CAEb;AACA;;AACA,IAAI,CAAC,SAAD,IAAc,OAAO,CAAC,GAAR,CAAY,QAAZ,KAAyB,YAA3C,EAAyD;EACvD,MAAM,aAAa,gBAAG,MAAM,CAAC,qBAAP,CAA6B,YAA7B,CAAtB;EACA,aAAa,CAAC,OAAd,CAAsB,GAAG,IAAG;;;IAC1B,IAAI,CAAA,EAAA,GAAA,MAAM,CAAC,MAAP,CAAc,GAAd,CAAA,MAAkB,IAAlB,IAAkB,EAAA,KAAA,KAAA,CAAlB,GAAkB,KAAA,CAAlB,GAAkB,EAAA,CAAE,UAAF,CAAa,OAAA,CAAA,gBAAb,CAAtB,EAAsD;MACpD;MACA,OAAO,YAAY,CAAC,GAAD,CAAnB;IACD;EACF,CALD;AAMD;AAED;;;;;;;;;;;;AAYG;;;AACI,MAAM,aAAa,GAAG,CAAI,YAAJ,EAAqB,IAArB,EAAmC,WAAnC,EAAwD,cAAxD,KAAkF;EAC7G;EACA,MAAM,GAAG,GAAG,MAAM,CAAC,GAAP,CAAW,GAAG,OAAA,CAAA,gBAAgB,GAAG,WAAW,IAAI,IAAI,KAAK,OAAA,CAAA,eAAA,CAAgB,cAAhB,CAA+B,EAAxF,CAAZ,CAF6G,CAI7G;EACA;;EACA,MAAM,aAAa,GAAG,MAAM,CAAC,qBAAP,CAA6B,YAA7B,CAAtB;;EACA,IAAI,CAAC,aAAa,CAAC,QAAd,CAAuB,GAAvB,CAAL,EAAkC;IAChC;IACA;IACA,YAAY,CAAC,GAAD,CAAZ,GAAoB,wBAAA,CAAA,aAAA,CAAkB,YAAlB,CAApB;EACD,CAX4G,CAa7G;;;EACA,OAAO,YAAY,CAAC,GAAD,CAAnB;AACD,CAfM;;AAAM,OAAA,CAAA,aAAA,GAAa,aAAb","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 // @ts-expect-error - Indexing object with symbols not supported until TS 4.4\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 // @ts-expect-error - Indexing object with symbols not supported until TS 4.4\n // eslint-disable-next-line @fluentui/no-context-default-value\n globalObject[sym] = baseCreateContext(defaultValue);\n }\n\n // @ts-expect-error - Indexing object with symbols not supported until TS 4.4\n return globalObject[sym] as React.Context<T>;\n};\n"],"sourceRoot":"../src/"}
@@ -53,6 +53,7 @@ const createContext = (defaultValue, name, packageName, packageVersion) => {
53
53
 
54
54
  if (!globalSymbols.includes(sym)) {
55
55
  // @ts-expect-error - Indexing object with symbols not supported until TS 4.4
56
+ // eslint-disable-next-line @fluentui/no-context-default-value
56
57
  globalObject[sym] = React.createContext(defaultValue);
57
58
  } // @ts-expect-error - Indexing object with symbols not supported until TS 4.4
58
59
 
@@ -1 +1 @@
1
- {"version":3,"sources":["global-context.ts"],"names":[],"mappings":";;;;;;;AAAA,MAAA,KAAA,gBAAA,OAAA,CAAA,OAAA,CAAA;;AACA,MAAA,iBAAA,gBAAA,OAAA,CAAA,2BAAA,CAAA;;AAEA,MAAA,OAAA,gBAAA,OAAA,CAAA,SAAA,CAAA;;AAEA,MAAM,SAAS,gBAAG,iBAAA,CAAA,SAAA,EAAlB;AACA,MAAM,YAAY,GAAiB,SAAS,GAAG,MAAH,GAAY,MAAxD,C,CAEA;AACA;;AACa,OAAA,CAAA,gBAAA,GAAmB,iBAAnB,C,CAEb;AACA;;AACA,IAAI,CAAC,SAAD,IAAc,OAAO,CAAC,GAAR,CAAY,QAAZ,KAAyB,YAA3C,EAAyD;EACvD,MAAM,aAAa,gBAAG,MAAM,CAAC,qBAAP,CAA6B,YAA7B,CAAtB;EACA,aAAa,CAAC,OAAd,CAAsB,GAAG,IAAG;;;IAC1B,IAAI,CAAA,EAAA,GAAA,MAAM,CAAC,MAAP,CAAc,GAAd,CAAA,MAAkB,IAAlB,IAAkB,EAAA,KAAA,KAAA,CAAlB,GAAkB,KAAA,CAAlB,GAAkB,EAAA,CAAE,UAAF,CAAa,OAAA,CAAA,gBAAb,CAAtB,EAAsD;MACpD;MACA,OAAO,YAAY,CAAC,GAAD,CAAnB;IACD;EACF,CALD;AAMD;AAED;;;;;;;;;;;;AAYG;;;AACI,MAAM,aAAa,GAAG,CAAI,YAAJ,EAAqB,IAArB,EAAmC,WAAnC,EAAwD,cAAxD,KAAkF;EAC7G;EACA,MAAM,GAAG,GAAG,MAAM,CAAC,GAAP,CAAW,GAAG,OAAA,CAAA,gBAAgB,GAAG,WAAW,IAAI,IAAI,KAAK,OAAA,CAAA,eAAA,CAAgB,cAAhB,CAA+B,EAAxF,CAAZ,CAF6G,CAI7G;EACA;;EACA,MAAM,aAAa,GAAG,MAAM,CAAC,qBAAP,CAA6B,YAA7B,CAAtB;;EACA,IAAI,CAAC,aAAa,CAAC,QAAd,CAAuB,GAAvB,CAAL,EAAkC;IAChC;IACA,YAAY,CAAC,GAAD,CAAZ,GAAoB,KAAK,CAAC,aAAN,CAAoB,YAApB,CAApB;EACD,CAV4G,CAY7G;;;EACA,OAAO,YAAY,CAAC,GAAD,CAAnB;AACD,CAdM;;AAAM,OAAA,CAAA,aAAA,GAAa,aAAb","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 // @ts-expect-error - Indexing object with symbols not supported until TS 4.4\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 // @ts-expect-error - Indexing object with symbols not supported until TS 4.4\n globalObject[sym] = React.createContext(defaultValue);\n }\n\n // @ts-expect-error - Indexing object with symbols not supported until TS 4.4\n return globalObject[sym] as React.Context<T>;\n};\n"],"sourceRoot":"../src/"}
1
+ {"version":3,"sources":["global-context.ts"],"names":[],"mappings":";;;;;;;AAAA,MAAA,KAAA,gBAAA,OAAA,CAAA,OAAA,CAAA;;AACA,MAAA,iBAAA,gBAAA,OAAA,CAAA,2BAAA,CAAA;;AAEA,MAAA,OAAA,gBAAA,OAAA,CAAA,SAAA,CAAA;;AAEA,MAAM,SAAS,gBAAG,iBAAA,CAAA,SAAA,EAAlB;AACA,MAAM,YAAY,GAAiB,SAAS,GAAG,MAAH,GAAY,MAAxD,C,CAEA;AACA;;AACa,OAAA,CAAA,gBAAA,GAAmB,iBAAnB,C,CAEb;AACA;;AACA,IAAI,CAAC,SAAD,IAAc,OAAO,CAAC,GAAR,CAAY,QAAZ,KAAyB,YAA3C,EAAyD;EACvD,MAAM,aAAa,gBAAG,MAAM,CAAC,qBAAP,CAA6B,YAA7B,CAAtB;EACA,aAAa,CAAC,OAAd,CAAsB,GAAG,IAAG;;;IAC1B,IAAI,CAAA,EAAA,GAAA,MAAM,CAAC,MAAP,CAAc,GAAd,CAAA,MAAkB,IAAlB,IAAkB,EAAA,KAAA,KAAA,CAAlB,GAAkB,KAAA,CAAlB,GAAkB,EAAA,CAAE,UAAF,CAAa,OAAA,CAAA,gBAAb,CAAtB,EAAsD;MACpD;MACA,OAAO,YAAY,CAAC,GAAD,CAAnB;IACD;EACF,CALD;AAMD;AAED;;;;;;;;;;;;AAYG;;;AACI,MAAM,aAAa,GAAG,CAAI,YAAJ,EAAqB,IAArB,EAAmC,WAAnC,EAAwD,cAAxD,KAAkF;EAC7G;EACA,MAAM,GAAG,GAAG,MAAM,CAAC,GAAP,CAAW,GAAG,OAAA,CAAA,gBAAgB,GAAG,WAAW,IAAI,IAAI,KAAK,OAAA,CAAA,eAAA,CAAgB,cAAhB,CAA+B,EAAxF,CAAZ,CAF6G,CAI7G;EACA;;EACA,MAAM,aAAa,GAAG,MAAM,CAAC,qBAAP,CAA6B,YAA7B,CAAtB;;EACA,IAAI,CAAC,aAAa,CAAC,QAAd,CAAuB,GAAvB,CAAL,EAAkC;IAChC;IACA;IACA,YAAY,CAAC,GAAD,CAAZ,GAAoB,KAAK,CAAC,aAAN,CAAoB,YAApB,CAApB;EACD,CAX4G,CAa7G;;;EACA,OAAO,YAAY,CAAC,GAAD,CAAnB;AACD,CAfM;;AAAM,OAAA,CAAA,aAAA,GAAa,aAAb","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 // @ts-expect-error - Indexing object with symbols not supported until TS 4.4\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 // @ts-expect-error - Indexing object with symbols not supported until TS 4.4\n // eslint-disable-next-line @fluentui/no-context-default-value\n globalObject[sym] = React.createContext(defaultValue);\n }\n\n // @ts-expect-error - Indexing object with symbols not supported until TS 4.4\n return globalObject[sym] as React.Context<T>;\n};\n"],"sourceRoot":"../src/"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fluentui/global-context",
3
- "version": "9.0.0-beta.3",
3
+ "version": "9.0.0-beta.5",
4
4
  "description": "Extension of React createContext to be a true singleton on the global scope",
5
5
  "main": "lib-commonjs/index.js",
6
6
  "module": "lib/index.js",
@@ -16,15 +16,13 @@
16
16
  "bundle-size": "bundle-size measure",
17
17
  "clean": "just-scripts clean",
18
18
  "code-style": "just-scripts code-style",
19
- "e2e": "yarn cypress run --component",
20
- "e2e:local": "yarn cypress open --component",
19
+ "e2e": "cypress run --component",
20
+ "e2e:local": "cypress open --component",
21
21
  "just": "just-scripts",
22
22
  "lint": "just-scripts lint",
23
- "start": "yarn storybook",
24
23
  "test": "jest --passWithNoTests",
25
24
  "docs": "api-extractor run --config=config/api-extractor.local.json --local",
26
25
  "build:local": "tsc -p ./tsconfig.lib.json --module esnext --emitDeclarationOnly && node ../../../scripts/typescript/normalize-import --output ./dist/types/packages/react-components/global-context/src && yarn docs",
27
- "storybook": "node ../../../scripts/storybook/runner",
28
26
  "type-check": "tsc -b tsconfig.json"
29
27
  },
30
28
  "devDependencies": {
@@ -32,8 +30,8 @@
32
30
  "@fluentui/scripts": "^1.0.0"
33
31
  },
34
32
  "dependencies": {
35
- "@fluentui/react-context-selector": "^9.0.2",
36
- "@fluentui/react-utilities": "^9.0.2",
33
+ "@fluentui/react-context-selector": "^9.0.4",
34
+ "@fluentui/react-utilities": "^9.1.1",
37
35
  "tslib": "^2.1.0"
38
36
  },
39
37
  "peerDependencies": {
@@ -1,11 +0,0 @@
1
- // This file is read by tools that parse documentation comments conforming to the TSDoc standard.
2
- // It should be published with your NPM package. It should not be tracked by Git.
3
- {
4
- "tsdocVersion": "0.12",
5
- "toolPackages": [
6
- {
7
- "packageName": "@microsoft/api-extractor",
8
- "packageVersion": "7.18.1"
9
- }
10
- ]
11
- }