@fluentui/global-context 9.0.0-beta.99 → 9.74.3-experimental.esm.20260709-49ee7a20cf.0

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.md CHANGED
@@ -1,12 +1,64 @@
1
1
  # Change Log - @fluentui/global-context
2
2
 
3
- This log was last generated on Thu, 22 Jan 2026 17:01:44 GMT and should not be manually modified.
3
+ This log was last generated on Thu, 09 Jul 2026 17:33:58 GMT and should not be manually modified.
4
4
 
5
5
  <!-- Start content -->
6
6
 
7
+ ## [9.74.3-experimental.esm.20260709-49ee7a20cf.0](https://github.com/microsoft/fluentui/tree/@fluentui/global-context_v9.74.3-experimental.esm.20260709-49ee7a20cf.0)
8
+
9
+ Thu, 09 Jul 2026 17:33:58 GMT
10
+ [Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/global-context_v9.0.0-beta.103..@fluentui/global-context_v9.74.3-experimental.esm.20260709-49ee7a20cf.0)
11
+
12
+ ### Changes
13
+
14
+ - Release 9.74.3-experimental.esm.20260709-49ee7a20cf ([commit](https://github.com/microsoft/fluentui/commit/not available) by fluentui-internal@service.microsoft.com)
15
+ - Bump @fluentui/react-context-selector to v9.74.3-experimental.esm.20260709-49ee7a20cf.0 ([commit](https://github.com/microsoft/fluentui/commit/175a26e0c520dd90a54578d1185a3b0b6c446e15) by beachball)
16
+ - Bump @fluentui/react-utilities to v9.74.3-experimental.esm.20260709-49ee7a20cf.0 ([commit](https://github.com/microsoft/fluentui/commit/175a26e0c520dd90a54578d1185a3b0b6c446e15) by beachball)
17
+
18
+ ## [9.0.0-beta.103](https://github.com/microsoft/fluentui/tree/@fluentui/global-context_v9.0.0-beta.103)
19
+
20
+ Wed, 24 Jun 2026 11:10:10 GMT
21
+ [Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/global-context_v9.0.0-beta.102..@fluentui/global-context_v9.0.0-beta.103)
22
+
23
+ ### Changes
24
+
25
+ - Bump @fluentui/react-context-selector to v9.2.18 ([commit](https://github.com/microsoft/fluentui/commit/a4b871ca80c1f16f35ab4229def4fe02be7f30ea) by beachball)
26
+ - Bump @fluentui/react-utilities to v9.26.5 ([commit](https://github.com/microsoft/fluentui/commit/a4b871ca80c1f16f35ab4229def4fe02be7f30ea) by beachball)
27
+
28
+ ## [9.0.0-beta.102](https://github.com/microsoft/fluentui/tree/@fluentui/global-context_v9.0.0-beta.102)
29
+
30
+ Tue, 26 May 2026 09:39:41 GMT
31
+ [Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/global-context_v9.0.0-beta.101..@fluentui/global-context_v9.0.0-beta.102)
32
+
33
+ ### Changes
34
+
35
+ - Bump @fluentui/react-context-selector to v9.2.17 ([PR #36246](https://github.com/microsoft/fluentui/pull/36246) by beachball)
36
+ - Bump @fluentui/react-utilities to v9.26.4 ([PR #36246](https://github.com/microsoft/fluentui/pull/36246) by beachball)
37
+
38
+ ## [9.0.0-beta.101](https://github.com/microsoft/fluentui/tree/@fluentui/global-context_v9.0.0-beta.101)
39
+
40
+ Thu, 23 Apr 2026 14:21:21 GMT
41
+ [Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/global-context_v9.0.0-beta.100..@fluentui/global-context_v9.0.0-beta.101)
42
+
43
+ ### Changes
44
+
45
+ - Bump @fluentui/react-context-selector to v9.2.16 ([PR #36035](https://github.com/microsoft/fluentui/pull/36035) by beachball)
46
+ - Bump @fluentui/react-utilities to v9.26.3 ([PR #36035](https://github.com/microsoft/fluentui/pull/36035) by beachball)
47
+
48
+ ## [9.0.0-beta.100](https://github.com/microsoft/fluentui/tree/@fluentui/global-context_v9.0.0-beta.100)
49
+
50
+ Wed, 25 Feb 2026 13:32:28 GMT
51
+ [Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/global-context_v9.0.0-beta.99..@fluentui/global-context_v9.0.0-beta.100)
52
+
53
+ ### Changes
54
+
55
+ - fix: add missing "use client" directive to client components and styles ([PR #35719](https://github.com/microsoft/fluentui/pull/35719) by dmytrokirpa@microsoft.com)
56
+ - Bump @fluentui/react-context-selector to v9.2.15 ([PR #35782](https://github.com/microsoft/fluentui/pull/35782) by beachball)
57
+ - Bump @fluentui/react-utilities to v9.26.2 ([PR #35782](https://github.com/microsoft/fluentui/pull/35782) by beachball)
58
+
7
59
  ## [9.0.0-beta.99](https://github.com/microsoft/fluentui/tree/@fluentui/global-context_v9.0.0-beta.99)
8
60
 
9
- Thu, 22 Jan 2026 17:01:44 GMT
61
+ Thu, 22 Jan 2026 17:07:00 GMT
10
62
  [Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/global-context_v9.0.0-beta.98..@fluentui/global-context_v9.0.0-beta.99)
11
63
 
12
64
  ### Changes
@@ -0,0 +1,33 @@
1
+ import * as React_2 from 'react';
2
+
3
+ /**
4
+ * Wrapper around @see React.createContext that implements context registration
5
+ * in the globalThis object to avoid duplicate contexts. Contexts are keyed with
6
+ * a unique sybmol for the package name, version and name of the context.
7
+ *
8
+ * @see {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Symbol}
9
+ *
10
+ * @param defaultValue - @see React.createContext
11
+ * @param name - name of the context
12
+ * @param packageName - name of the npm package where the module is used
13
+ * @param packageVersion - version of the npm package where the module is used
14
+ * @returns @see React.createContext
15
+ */
16
+ export declare const createContext: <T>(defaultValue: T, name: string, packageName: string, packageVersion: string) => React_2.Context<T>;
17
+
18
+ /**
19
+ * Wrapper around @see createContext from \@fluentui/react-context-selector that implements context registration
20
+ * in the globalThis object to avoid duplicate contexts. Contexts are keyed with
21
+ * a unique sybmol for the package name, version and name of the context.
22
+ *
23
+ * @see {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Symbol}
24
+ *
25
+ * @param defaultValue - @see React.createContext
26
+ * @param name - name of the context
27
+ * @param packageName - name of the npm package where the module is used
28
+ * @param packageVersion - version of the npm package where the module is used
29
+ * @returns @see React.createContext
30
+ */
31
+ export declare const createContextSelector: <T>(defaultValue: T, name: string, packageName: string, packageVersion: string) => React_2.Context<T>;
32
+
33
+ export { }
@@ -1,7 +1,7 @@
1
- import * as React from 'react';
2
- import { createContext as baseCreateContext } from '@fluentui/react-context-selector';
3
- import { canUseDOM } from '@fluentui/react-utilities';
4
- import { getMajorVersion } from './utils';
1
+ 'use client';
2
+ import { createContext as baseCreateContext } from "@fluentui/react-context-selector";
3
+ import { canUseDOM } from "@fluentui/react-utilities";
4
+ import { getMajorVersion } from "./utils.js";
5
5
  const isBrowser = canUseDOM();
6
6
  const globalObject = isBrowser ? window : global;
7
7
  // Identifier for the symbol, for easy idenfitifaction of symbols created by this util
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/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\n ? // eslint-disable-next-line @nx/workspace-no-restricted-globals\n window\n : 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>(\n defaultValue: T,\n name: string,\n packageName: string,\n packageVersion: string,\n): React.Context<T> => {\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,YAE/BE,SACAC;AAEJ,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,CAC3BoB,cACAC,MACAC,aACAC;IAEA,wDAAwD;IACxD,MAAMP,MAAMC,OAAOO,GAAG,CAAC,GAAGhB,mBAAmBc,YAAY,CAAC,EAAED,KAAK,EAAE,EAAElB,gBAAgBoB,iBAAiB;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"}
1
+ {"version":3,"sources":["../src/global-context-selector.ts"],"sourcesContent":["'use client';\n\nimport type * as React from 'react';\nimport { createContext as baseCreateContext } from '@fluentui/react-context-selector';\nimport { canUseDOM } from '@fluentui/react-utilities';\nimport { getMajorVersion } from './utils';\nimport type { GlobalObject } from './types';\n\nconst isBrowser = canUseDOM();\nconst globalObject: GlobalObject = isBrowser\n ? // eslint-disable-next-line @nx/workspace-no-restricted-globals\n window\n : 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>(\n defaultValue: T,\n name: string,\n packageName: string,\n packageVersion: string,\n): React.Context<T> => {\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":["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;AAGA,SAASA,iBAAiBC,iBAAiB,QAAQ,mCAAmC;AACtF,SAASC,SAAS,QAAQ,4BAA4B;AACtD,SAASC,eAAe,QAAQ,aAAU;AAG1C,MAAMC,YAAYF;AAClB,MAAMG,eAA6BD,YAE/BE,SACAC;AAEJ,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,CAC3BoB,cACAC,MACAC,aACAC;IAEA,wDAAwD;IACxD,MAAMP,MAAMC,OAAOO,GAAG,CAAC,GAAGhB,mBAAmBc,YAAY,CAAC,EAAED,KAAK,EAAE,EAAElB,gBAAgBoB,iBAAiB;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"}
@@ -1,7 +1,7 @@
1
1
  'use client';
2
- import * as React from 'react';
3
- import { canUseDOM } from '@fluentui/react-utilities';
4
- import { getMajorVersion } from './utils';
2
+ import * as React from "react";
3
+ import { canUseDOM } from "@fluentui/react-utilities";
4
+ import { getMajorVersion } from "./utils.js";
5
5
  const isBrowser = canUseDOM();
6
6
  const globalObject = isBrowser ? window : global;
7
7
  // Identifier for the symbol, for easy idenfitifaction of symbols created by this util
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/global-context.ts"],"sourcesContent":["'use client';\n\nimport * 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\n ? // eslint-disable-next-line @nx/workspace-no-restricted-globals\n window\n : 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>(\n defaultValue: T,\n name: string,\n packageName: string,\n packageVersion: string,\n): React.Context<T> => {\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;AAEA,YAAYA,WAAW,QAAQ;AAC/B,SAASC,SAAS,QAAQ,4BAA4B;AAEtD,SAASC,eAAe,QAAQ,UAAU;AAE1C,MAAMC,YAAYF;AAClB,MAAMG,eAA6BD,YAE/BE,SACAC;AAEJ,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,CAC3BC,cACAC,MACAC,aACAC;IAEA,wDAAwD;IACxD,MAAMR,MAAMC,OAAOQ,GAAG,CAAC,GAAGjB,mBAAmBe,YAAY,CAAC,EAAED,KAAK,EAAE,EAAEnB,gBAAgBqB,iBAAiB;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"}
1
+ {"version":3,"sources":["../src/global-context.ts"],"sourcesContent":["'use client';\n\nimport * as React from 'react';\nimport { canUseDOM } from '@fluentui/react-utilities';\nimport type { GlobalObject } from './types';\nimport { getMajorVersion } from './utils';\n\nconst isBrowser = canUseDOM();\nconst globalObject: GlobalObject = isBrowser\n ? // eslint-disable-next-line @nx/workspace-no-restricted-globals\n window\n : 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>(\n defaultValue: T,\n name: string,\n packageName: string,\n packageVersion: string,\n): React.Context<T> => {\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;AAEA,YAAYA,WAAW,QAAQ;AAC/B,SAASC,SAAS,QAAQ,4BAA4B;AAEtD,SAASC,eAAe,QAAQ,aAAU;AAE1C,MAAMC,YAAYF;AAClB,MAAMG,eAA6BD,YAE/BE,SACAC;AAEJ,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,CAC3BC,cACAC,MACAC,aACAC;IAEA,wDAAwD;IACxD,MAAMR,MAAMC,OAAOQ,GAAG,CAAC,GAAGjB,mBAAmBe,YAAY,CAAC,EAAED,KAAK,EAAE,EAAEnB,gBAAgBqB,iBAAiB;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
@@ -1,2 +1,2 @@
1
- export { createContext } from './global-context';
2
- export { createContext as createContextSelector } from './global-context-selector';
1
+ export { createContext } from "./global-context.js";
2
+ export { createContext as createContextSelector } from "./global-context-selector.js";
package/lib/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/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"}
1
+ {"version":3,"sources":["../src/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,sBAAmB;AACjD,SAASA,iBAAiBC,qBAAqB,QAAQ,+BAA4B"}
package/lib/types.js CHANGED
@@ -1 +1 @@
1
- import * as React from 'react';
1
+ export { };
package/lib/types.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/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"}
1
+ {"version":3,"sources":["../src/types.ts"],"sourcesContent":["import type * as React from 'react';\n\nexport type GlobalObject = typeof globalThis & Record<symbol, React.Context<unknown>>;\n"],"names":[],"mappings":"AAEA,WAAsF"}
@@ -1,3 +1,4 @@
1
+ 'use client';
1
2
  "use strict";
2
3
  Object.defineProperty(exports, "__esModule", {
3
4
  value: true
@@ -16,11 +17,9 @@ _export(exports, {
16
17
  return createContext;
17
18
  }
18
19
  });
19
- const _interop_require_wildcard = require("@swc/helpers/_/_interop_require_wildcard");
20
- const _react = /*#__PURE__*/ _interop_require_wildcard._(require("react"));
21
20
  const _reactcontextselector = require("@fluentui/react-context-selector");
22
21
  const _reactutilities = require("@fluentui/react-utilities");
23
- const _utils = require("./utils");
22
+ const _utils = require("./utils.cjs");
24
23
  const isBrowser = (0, _reactutilities.canUseDOM)();
25
24
  const globalObject = isBrowser ? window : global;
26
25
  const SYMBOL_NAMESPACE = 'global-context-selector:';
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/global-context-selector.ts"],"sourcesContent":["'use client';\n\nimport type * as React from 'react';\nimport { createContext as baseCreateContext } from '@fluentui/react-context-selector';\nimport { canUseDOM } from '@fluentui/react-utilities';\nimport { getMajorVersion } from './utils';\nimport type { GlobalObject } from './types';\n\nconst isBrowser = canUseDOM();\nconst globalObject: GlobalObject = isBrowser\n ? // eslint-disable-next-line @nx/workspace-no-restricted-globals\n window\n : 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>(\n defaultValue: T,\n name: string,\n packageName: string,\n packageVersion: string,\n): React.Context<T> => {\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":["SYMBOL_NAMESPACE","createContext","isBrowser","canUseDOM","globalObject","window","global","process","env","NODE_ENV","globalSymbols","Object","getOwnPropertySymbols","forEach","sym","Symbol","keyFor","startsWith","defaultValue","name","packageName","packageVersion","for","getMajorVersion","includes","baseCreateContext"],"mappings":"AAAA;;;;;;;;;;;;IAgBaA,gBAAgB;eAAhBA;;IA0BAC,aAAa;eAAbA;;;sCAvCsC;gCACzB;uBACM;AAGhC,MAAMC,YAAYC,IAAAA,yBAAS;AAC3B,MAAMC,eAA6BF,YAE/BG,SACAC;AAIG,MAAMN,mBAAmB;AAEhC,gEAAgE;AAChE,sEAAsE;AACtE,IAAI,CAACE,aAAaK,QAAQC,GAAG,CAACC,QAAQ,KAAK,cAAc;IACvD,MAAMC,gBAAgBC,OAAOC,qBAAqB,CAACR;IACnDM,cAAcG,OAAO,CAACC,CAAAA;YAChBC;QAAJ,KAAIA,iBAAAA,OAAOC,MAAM,CAACF,kBAAdC,qCAAAA,eAAoBE,UAAU,CAACjB,mBAAmB;YACpD,OAAOI,YAAY,CAACU,IAAI;QAC1B;IACF;AACF;AAeO,MAAMb,gBAAgB,CAC3BiB,cACAC,MACAC,aACAC;IAEA,wDAAwD;IACxD,MAAMP,MAAMC,OAAOO,GAAG,CAAC,GAAGtB,mBAAmBoB,YAAY,CAAC,EAAED,KAAK,EAAE,EAAEI,IAAAA,sBAAe,EAACF,iBAAiB;IAEtG,8DAA8D;IAC9D,yEAAyE;IACzE,MAAMX,gBAAgBC,OAAOC,qBAAqB,CAACR;IACnD,IAAI,CAACM,cAAcc,QAAQ,CAACV,MAAM;QAChC,8DAA8D;QAC9DV,YAAY,CAACU,IAAI,GAAGW,IAAAA,mCAAiB,EAAUP;IACjD;IAEA,OAAOd,YAAY,CAACU,IAAI;AAC1B"}
@@ -20,7 +20,7 @@ _export(exports, {
20
20
  const _interop_require_wildcard = require("@swc/helpers/_/_interop_require_wildcard");
21
21
  const _react = /*#__PURE__*/ _interop_require_wildcard._(require("react"));
22
22
  const _reactutilities = require("@fluentui/react-utilities");
23
- const _utils = require("./utils");
23
+ const _utils = require("./utils.cjs");
24
24
  const isBrowser = (0, _reactutilities.canUseDOM)();
25
25
  const globalObject = isBrowser ? window : global;
26
26
  const SYMBOL_NAMESPACE = 'global-context:';
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/global-context.ts"],"sourcesContent":["'use client';\n\nimport * as React from 'react';\nimport { canUseDOM } from '@fluentui/react-utilities';\nimport type { GlobalObject } from './types';\nimport { getMajorVersion } from './utils';\n\nconst isBrowser = canUseDOM();\nconst globalObject: GlobalObject = isBrowser\n ? // eslint-disable-next-line @nx/workspace-no-restricted-globals\n window\n : 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>(\n defaultValue: T,\n name: string,\n packageName: string,\n packageVersion: string,\n): React.Context<T> => {\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":["SYMBOL_NAMESPACE","createContext","isBrowser","canUseDOM","globalObject","window","global","process","env","NODE_ENV","globalSymbols","Object","getOwnPropertySymbols","forEach","sym","Symbol","keyFor","startsWith","defaultValue","name","packageName","packageVersion","for","getMajorVersion","includes","React"],"mappings":"AAAA;;;;;;;;;;;;IAeaA,gBAAgB;eAAhBA;;IA0BAC,aAAa;eAAbA;;;;iEAvCU;gCACG;uBAEM;AAEhC,MAAMC,YAAYC,IAAAA,yBAAS;AAC3B,MAAMC,eAA6BF,YAE/BG,SACAC;AAIG,MAAMN,mBAAmB;AAEhC,gEAAgE;AAChE,sEAAsE;AACtE,IAAI,CAACE,aAAaK,QAAQC,GAAG,CAACC,QAAQ,KAAK,cAAc;IACvD,MAAMC,gBAAgBC,OAAOC,qBAAqB,CAACR;IACnDM,cAAcG,OAAO,CAACC,CAAAA;YAChBC;QAAJ,KAAIA,iBAAAA,OAAOC,MAAM,CAACF,kBAAdC,qCAAAA,eAAoBE,UAAU,CAACjB,mBAAmB;YACpD,OAAOI,YAAY,CAACU,IAAI;QAC1B;IACF;AACF;AAeO,MAAMb,gBAAgB,CAC3BiB,cACAC,MACAC,aACAC;IAEA,wDAAwD;IACxD,MAAMP,MAAMC,OAAOO,GAAG,CAAC,GAAGtB,mBAAmBoB,YAAY,CAAC,EAAED,KAAK,EAAE,EAAEI,IAAAA,sBAAe,EAACF,iBAAiB;IAEtG,8DAA8D;IAC9D,yEAAyE;IACzE,MAAMX,gBAAgBC,OAAOC,qBAAqB,CAACR;IACnD,IAAI,CAACM,cAAcc,QAAQ,CAACV,MAAM;QAChC,8DAA8D;QAC9DV,YAAY,CAACU,IAAI,GAAGW,OAAMxB,aAAa,CAAUiB;IACnD;IAEA,OAAOd,YAAY,CAACU,IAAI;AAC1B"}
@@ -16,5 +16,5 @@ _export(exports, {
16
16
  return _globalcontextselector.createContext;
17
17
  }
18
18
  });
19
- const _globalcontext = require("./global-context");
20
- const _globalcontextselector = require("./global-context-selector");
19
+ const _globalcontext = require("./global-context.cjs");
20
+ const _globalcontextselector = require("./global-context-selector.cjs");
@@ -0,0 +1,4 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", {
3
+ value: true
4
+ });
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"names":[],"mappings":""}
package/package.json CHANGED
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "name": "@fluentui/global-context",
3
- "version": "9.0.0-beta.99",
3
+ "version": "9.74.3-experimental.esm.20260709-49ee7a20cf.0",
4
4
  "description": "Extension of React createContext to be a true singleton on the global scope",
5
- "main": "lib-commonjs/index.js",
5
+ "main": "lib-commonjs/index.cjs",
6
6
  "module": "lib/index.js",
7
7
  "typings": "./dist/index.d.ts",
8
8
  "sideEffects": false,
@@ -12,8 +12,8 @@
12
12
  },
13
13
  "license": "MIT",
14
14
  "dependencies": {
15
- "@fluentui/react-context-selector": "^9.2.14",
16
- "@fluentui/react-utilities": "^9.26.1",
15
+ "@fluentui/react-context-selector": "9.74.3-experimental.esm.20260709-49ee7a20cf.0",
16
+ "@fluentui/react-utilities": "9.74.3-experimental.esm.20260709-49ee7a20cf.0",
17
17
  "@swc/helpers": "^0.5.1"
18
18
  },
19
19
  "peerDependencies": {
@@ -22,26 +22,26 @@
22
22
  "react": ">=16.14.0 <20.0.0",
23
23
  "react-dom": ">=16.14.0 <20.0.0"
24
24
  },
25
- "beachball": {
26
- "disallowedChangeTypes": [
27
- "major",
28
- "minor",
29
- "patch"
30
- ]
31
- },
25
+ "beachball": {},
32
26
  "exports": {
33
27
  ".": {
34
- "types": "./dist/index.d.ts",
35
- "node": "./lib-commonjs/index.js",
36
- "import": "./lib/index.js",
37
- "require": "./lib-commonjs/index.js"
28
+ "import": {
29
+ "types": "./dist/index.d.ts",
30
+ "default": "./lib/index.js"
31
+ },
32
+ "require": {
33
+ "types": "./dist/index.d.cts",
34
+ "default": "./lib-commonjs/index.cjs"
35
+ }
38
36
  },
39
37
  "./package.json": "./package.json"
40
38
  },
41
39
  "files": [
42
40
  "*.md",
43
41
  "dist/*.d.ts",
42
+ "dist/*.d.cts",
44
43
  "lib",
45
44
  "lib-commonjs"
46
- ]
45
+ ],
46
+ "type": "module"
47
47
  }
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/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\n ? // eslint-disable-next-line @nx/workspace-no-restricted-globals\n window\n : 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>(\n defaultValue: T,\n name: string,\n packageName: string,\n packageVersion: string,\n): React.Context<T> => {\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":["SYMBOL_NAMESPACE","createContext","isBrowser","canUseDOM","globalObject","window","global","process","env","NODE_ENV","globalSymbols","Object","getOwnPropertySymbols","forEach","sym","Symbol","keyFor","startsWith","defaultValue","name","packageName","packageVersion","for","getMajorVersion","includes","baseCreateContext"],"mappings":";;;;;;;;;;;IAcaA,gBAAgB;eAAhBA;;IA0BAC,aAAa;eAAbA;;;;iEAxCU;sCAC4B;gCACzB;uBACM;AAGhC,MAAMC,YAAYC,IAAAA,yBAAS;AAC3B,MAAMC,eAA6BF,YAE/BG,SACAC;AAIG,MAAMN,mBAAmB;AAEhC,gEAAgE;AAChE,sEAAsE;AACtE,IAAI,CAACE,aAAaK,QAAQC,GAAG,CAACC,QAAQ,KAAK,cAAc;IACvD,MAAMC,gBAAgBC,OAAOC,qBAAqB,CAACR;IACnDM,cAAcG,OAAO,CAACC,CAAAA;YAChBC;QAAJ,KAAIA,iBAAAA,OAAOC,MAAM,CAACF,kBAAdC,qCAAAA,eAAoBE,UAAU,CAACjB,mBAAmB;YACpD,OAAOI,YAAY,CAACU,IAAI;QAC1B;IACF;AACF;AAeO,MAAMb,gBAAgB,CAC3BiB,cACAC,MACAC,aACAC;IAEA,wDAAwD;IACxD,MAAMP,MAAMC,OAAOO,GAAG,CAAC,GAAGtB,mBAAmBoB,YAAY,CAAC,EAAED,KAAK,EAAE,EAAEI,IAAAA,sBAAe,EAACF,iBAAiB;IAEtG,8DAA8D;IAC9D,yEAAyE;IACzE,MAAMX,gBAAgBC,OAAOC,qBAAqB,CAACR;IACnD,IAAI,CAACM,cAAcc,QAAQ,CAACV,MAAM;QAChC,8DAA8D;QAC9DV,YAAY,CAACU,IAAI,GAAGW,IAAAA,mCAAiB,EAAUP;IACjD;IAEA,OAAOd,YAAY,CAACU,IAAI;AAC1B"}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/global-context.ts"],"sourcesContent":["'use client';\n\nimport * 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\n ? // eslint-disable-next-line @nx/workspace-no-restricted-globals\n window\n : 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>(\n defaultValue: T,\n name: string,\n packageName: string,\n packageVersion: string,\n): React.Context<T> => {\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":["SYMBOL_NAMESPACE","createContext","isBrowser","canUseDOM","globalObject","window","global","process","env","NODE_ENV","globalSymbols","Object","getOwnPropertySymbols","forEach","sym","Symbol","keyFor","startsWith","defaultValue","name","packageName","packageVersion","for","getMajorVersion","includes","React"],"mappings":"AAAA;;;;;;;;;;;;IAeaA,gBAAgB;eAAhBA;;IA0BAC,aAAa;eAAbA;;;;iEAvCU;gCACG;uBAEM;AAEhC,MAAMC,YAAYC,IAAAA,yBAAS;AAC3B,MAAMC,eAA6BF,YAE/BG,SACAC;AAIG,MAAMN,mBAAmB;AAEhC,gEAAgE;AAChE,sEAAsE;AACtE,IAAI,CAACE,aAAaK,QAAQC,GAAG,CAACC,QAAQ,KAAK,cAAc;IACvD,MAAMC,gBAAgBC,OAAOC,qBAAqB,CAACR;IACnDM,cAAcG,OAAO,CAACC,CAAAA;YAChBC;QAAJ,KAAIA,iBAAAA,OAAOC,MAAM,CAACF,kBAAdC,qCAAAA,eAAoBE,UAAU,CAACjB,mBAAmB;YACpD,OAAOI,YAAY,CAACU,IAAI;QAC1B;IACF;AACF;AAeO,MAAMb,gBAAgB,CAC3BiB,cACAC,MACAC,aACAC;IAEA,wDAAwD;IACxD,MAAMP,MAAMC,OAAOO,GAAG,CAAC,GAAGtB,mBAAmBoB,YAAY,CAAC,EAAED,KAAK,EAAE,EAAEI,IAAAA,sBAAe,EAACF,iBAAiB;IAEtG,8DAA8D;IAC9D,yEAAyE;IACzE,MAAMX,gBAAgBC,OAAOC,qBAAqB,CAACR;IACnD,IAAI,CAACM,cAAcc,QAAQ,CAACV,MAAM;QAChC,8DAA8D;QAC9DV,YAAY,CAACU,IAAI,GAAGW,OAAMxB,aAAa,CAAUiB;IACnD;IAEA,OAAOd,YAAY,CAACU,IAAI;AAC1B"}
@@ -1,6 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", {
3
- value: true
4
- });
5
- const _interop_require_wildcard = require("@swc/helpers/_/_interop_require_wildcard");
6
- const _react = /*#__PURE__*/ _interop_require_wildcard._(require("react"));
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/types.ts"],"sourcesContent":["import * as React from 'react';\n\nexport type GlobalObject = typeof globalThis & Record<symbol, React.Context<unknown>>;\n"],"names":[],"mappings":";;;;;iEAAuB"}
File without changes
File without changes
File without changes