@fluentui/global-context 9.0.0-beta.28 → 9.0.0-beta.29

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,36 @@
2
2
  "name": "@fluentui/global-context",
3
3
  "entries": [
4
4
  {
5
- "date": "Thu, 25 May 2023 09:57:45 GMT",
5
+ "date": "Wed, 31 May 2023 06:42:51 GMT",
6
+ "tag": "@fluentui/global-context_v9.0.0-beta.29",
7
+ "version": "9.0.0-beta.29",
8
+ "comments": {
9
+ "none": [
10
+ {
11
+ "author": "martinhochel@microsoft.com",
12
+ "package": "@fluentui/global-context",
13
+ "commit": "4b637ced41e430bf8d79c7fc67c103d5efdfd3a8",
14
+ "comment": "fix: tweak type errors exposed in ts 4.5"
15
+ }
16
+ ],
17
+ "prerelease": [
18
+ {
19
+ "author": "beachball",
20
+ "package": "@fluentui/global-context",
21
+ "comment": "Bump @fluentui/react-context-selector to v9.1.22",
22
+ "commit": "17ca96c6b7f684f36a5c63e40e78b4986a86c713"
23
+ },
24
+ {
25
+ "author": "beachball",
26
+ "package": "@fluentui/global-context",
27
+ "comment": "Bump @fluentui/react-utilities to v9.9.2",
28
+ "commit": "17ca96c6b7f684f36a5c63e40e78b4986a86c713"
29
+ }
30
+ ]
31
+ }
32
+ },
33
+ {
34
+ "date": "Thu, 25 May 2023 10:00:48 GMT",
6
35
  "tag": "@fluentui/global-context_v9.0.0-beta.28",
7
36
  "version": "9.0.0-beta.28",
8
37
  "comments": {
package/CHANGELOG.md CHANGED
@@ -1,12 +1,22 @@
1
1
  # Change Log - @fluentui/global-context
2
2
 
3
- This log was last generated on Thu, 25 May 2023 09:57:45 GMT and should not be manually modified.
3
+ This log was last generated on Wed, 31 May 2023 06:42:51 GMT and should not be manually modified.
4
4
 
5
5
  <!-- Start content -->
6
6
 
7
+ ## [9.0.0-beta.29](https://github.com/microsoft/fluentui/tree/@fluentui/global-context_v9.0.0-beta.29)
8
+
9
+ Wed, 31 May 2023 06:42:51 GMT
10
+ [Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/global-context_v9.0.0-beta.28..@fluentui/global-context_v9.0.0-beta.29)
11
+
12
+ ### Changes
13
+
14
+ - Bump @fluentui/react-context-selector to v9.1.22 ([PR #28054](https://github.com/microsoft/fluentui/pull/28054) by beachball)
15
+ - Bump @fluentui/react-utilities to v9.9.2 ([PR #28054](https://github.com/microsoft/fluentui/pull/28054) by beachball)
16
+
7
17
  ## [9.0.0-beta.28](https://github.com/microsoft/fluentui/tree/@fluentui/global-context_v9.0.0-beta.28)
8
18
 
9
- Thu, 25 May 2023 09:57:45 GMT
19
+ Thu, 25 May 2023 10:00:48 GMT
10
20
  [Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/global-context_v9.0.0-beta.27..@fluentui/global-context_v9.0.0-beta.28)
11
21
 
12
22
  ### Changes
@@ -2,7 +2,7 @@ import * as React from 'react';
2
2
  import { createContext as baseCreateContext } from '@fluentui/react-context-selector';
3
3
  import { canUseDOM } from '@fluentui/react-utilities';
4
4
  import { getMajorVersion } from './utils';
5
- const isBrowser = /*#__PURE__*/canUseDOM();
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
8
8
  // Useful for clearning global object during SSR reloads
@@ -10,14 +10,13 @@ export const SYMBOL_NAMESPACE = 'global-context-selector:';
10
10
  // During SSR the global object persists with the server process
11
11
  // Clean out the global object during server reload during development
12
12
  if (!isBrowser && process.env.NODE_ENV !== 'production') {
13
- const globalSymbols = /*#__PURE__*/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
- // @ts-expect-error - Indexing object with symbols not supported until TS 4.4
18
- delete globalObject[sym];
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,19 +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
- export const createContext = (defaultValue, name, packageName, packageVersion) => {
36
- // Symbol guaranteed to be unique for the entire runtime
37
- const sym = Symbol.for(`${SYMBOL_NAMESPACE}${packageName}/${name}/@${getMajorVersion(packageVersion)}`);
38
- // Objects keyed with symbols are not visible with console.log
39
- // Object symbol properties can't be iterated with `for` or `Object.keys`
40
- const globalSymbols = Object.getOwnPropertySymbols(globalObject);
41
- if (!globalSymbols.includes(sym)) {
42
- // @ts-expect-error - Indexing object with symbols not supported until TS 4.4
43
- // eslint-disable-next-line @fluentui/no-context-default-value
44
- globalObject[sym] = baseCreateContext(defaultValue);
45
- }
46
- // @ts-expect-error - Indexing object with symbols not supported until TS 4.4
47
- 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];
48
44
  };
49
- //# sourceMappingURL=global-context-selector.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["React","createContext","baseCreateContext","canUseDOM","getMajorVersion","isBrowser","globalObject","window","global","SYMBOL_NAMESPACE","process","env","NODE_ENV","globalSymbols","Object","getOwnPropertySymbols","forEach","sym","_Symbol_keyFor","Symbol","keyFor","startsWith","defaultValue","name","packageName","packageVersion","for","includes"],"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 ? 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"],"mappings":"AAAA,YAAYA,KAAA,MAAW;AACvB,SAASC,aAAA,IAAiBC,iBAAiB,QAAQ;AACnD,SAASC,SAAS,QAAQ;AAC1B,SAASC,eAAe,QAAQ;AAGhC,MAAMC,SAAA,gBAAYF,SAAA;AAClB,MAAMG,YAAA,GAA6BD,SAAA,GAAYE,MAAA,GAASC,MAAM;AAE9D;AACA;AACA,OAAO,MAAMC,gBAAA,GAAmB;AAEhC;AACA;AACA,IAAI,CAACJ,SAAA,IAAaK,OAAA,CAAQC,GAAG,CAACC,QAAQ,KAAK,cAAc;EACvD,MAAMC,aAAA,gBAAgBC,MAAA,CAAOC,qBAAqB,CAACT,YAAA;EACnDO,aAAA,CAAcG,OAAO,CAACC,GAAA,IAAO;QACvBC,cAAA;IAAJ,IAAI,CAAAA,cAAA,GAAAC,MAAA,CAAOC,MAAM,CAACH,GAAA,eAAdC,cAAA,uBAAAA,cAAA,CAAoBG,UAAA,CAAWZ,gBAAA,GAAmB;MACpD;MACA,OAAOH,YAAY,CAACW,GAAA,CAAI;IAC1B;EACF;AACF;AAEA;;;;;;;;;;;;;AAaA,OAAO,MAAMhB,aAAA,GAAgBA,CAAIqB,YAAA,EAAiBC,IAAA,EAAcC,WAAA,EAAqBC,cAAA,KAA2B;EAC9G;EACA,MAAMR,GAAA,GAAME,MAAA,CAAOO,GAAG,CAAE,GAAEjB,gBAAiB,GAAEe,WAAY,IAAGD,IAAK,KAAInB,eAAA,CAAgBqB,cAAA,CAAgB,EAAC;EAEtG;EACA;EACA,MAAMZ,aAAA,GAAgBC,MAAA,CAAOC,qBAAqB,CAACT,YAAA;EACnD,IAAI,CAACO,aAAA,CAAcc,QAAQ,CAACV,GAAA,GAAM;IAChC;IACA;IACAX,YAAY,CAACW,GAAA,CAAI,GAAGf,iBAAA,CAAkBoB,YAAA;EACxC;EAEA;EACA,OAAOhB,YAAY,CAACW,GAAA,CAAI;AAC1B"}
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,MAAM;AAE9D,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,MAAO;YACvBC;QAAJ,IAAIA,CAAAA,iBAAAA,OAAOC,MAAM,CAACF,kBAAdC,4BAAAA,KAAAA,IAAAA,eAAoBE,WAAWX,mBAAmB;YACpD,OAAOH,YAAY,CAACW,IAAI;QAC1B,CAAC;IACH;AACF,CAAC;AAED;;;;;;;;;;;;CAYC,GACD,OAAO,MAAMhB,gBAAgB,CAAIoB,cAAiBC,MAAcC,aAAqBC,iBAA2B;IAC9G,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,CAAC;IAED,OAAOf,YAAY,CAACW,IAAI;AAC1B,EAAE"}
@@ -1,7 +1,7 @@
1
1
  import * as React from 'react';
2
2
  import { canUseDOM } from '@fluentui/react-utilities';
3
3
  import { getMajorVersion } from './utils';
4
- const isBrowser = /*#__PURE__*/canUseDOM();
4
+ const isBrowser = canUseDOM();
5
5
  const globalObject = isBrowser ? window : global;
6
6
  // Identifier for the symbol, for easy idenfitifaction of symbols created by this util
7
7
  // Useful for clearning global object during SSR reloads
@@ -9,14 +9,13 @@ export const SYMBOL_NAMESPACE = 'global-context:';
9
9
  // During SSR the global object persists with the server process
10
10
  // Clean out the global object during server reload during development
11
11
  if (!isBrowser && process.env.NODE_ENV !== 'production') {
12
- const globalSymbols = /*#__PURE__*/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
- // @ts-expect-error - Indexing object with symbols not supported until TS 4.4
17
- delete globalObject[sym];
18
- }
19
- });
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
+ });
20
19
  }
21
20
  /**
22
21
  * Wrapper around @see React.createContext that implements context registration
@@ -30,19 +29,15 @@ if (!isBrowser && process.env.NODE_ENV !== 'production') {
30
29
  * @param packageName - name of the npm package where the module is used
31
30
  * @param packageVersion - version of the npm package where the module is used
32
31
  * @returns @see React.createContext
33
- */
34
- export const createContext = (defaultValue, name, packageName, packageVersion) => {
35
- // Symbol guaranteed to be unique for the entire runtime
36
- const sym = Symbol.for(`${SYMBOL_NAMESPACE}${packageName}/${name}/@${getMajorVersion(packageVersion)}`);
37
- // Objects keyed with symbols are not visible with console.log
38
- // Object symbol properties can't be iterated with `for` or `Object.keys`
39
- const globalSymbols = Object.getOwnPropertySymbols(globalObject);
40
- if (!globalSymbols.includes(sym)) {
41
- // @ts-expect-error - Indexing object with symbols not supported until TS 4.4
42
- // eslint-disable-next-line @fluentui/no-context-default-value
43
- globalObject[sym] = /*#__PURE__*/React.createContext(defaultValue);
44
- }
45
- // @ts-expect-error - Indexing object with symbols not supported until TS 4.4
46
- 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];
47
43
  };
48
- //# sourceMappingURL=global-context.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["React","canUseDOM","getMajorVersion","isBrowser","globalObject","window","global","SYMBOL_NAMESPACE","process","env","NODE_ENV","globalSymbols","Object","getOwnPropertySymbols","forEach","sym","_Symbol_keyFor","Symbol","keyFor","startsWith","createContext","defaultValue","name","packageName","packageVersion","for","includes"],"sources":["../src/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 // @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"],"mappings":"AAAA,YAAYA,KAAA,MAAW;AACvB,SAASC,SAAS,QAAQ;AAE1B,SAASC,eAAe,QAAQ;AAEhC,MAAMC,SAAA,gBAAYF,SAAA;AAClB,MAAMG,YAAA,GAA6BD,SAAA,GAAYE,MAAA,GAASC,MAAM;AAE9D;AACA;AACA,OAAO,MAAMC,gBAAA,GAAmB;AAEhC;AACA;AACA,IAAI,CAACJ,SAAA,IAAaK,OAAA,CAAQC,GAAG,CAACC,QAAQ,KAAK,cAAc;EACvD,MAAMC,aAAA,gBAAgBC,MAAA,CAAOC,qBAAqB,CAACT,YAAA;EACnDO,aAAA,CAAcG,OAAO,CAACC,GAAA,IAAO;QACvBC,cAAA;IAAJ,IAAI,CAAAA,cAAA,GAAAC,MAAA,CAAOC,MAAM,CAACH,GAAA,eAAdC,cAAA,uBAAAA,cAAA,CAAoBG,UAAA,CAAWZ,gBAAA,GAAmB;MACpD;MACA,OAAOH,YAAY,CAACW,GAAA,CAAI;IAC1B;EACF;AACF;AAEA;;;;;;;;;;;;;AAaA,OAAO,MAAMK,aAAA,GAAgBA,CAAIC,YAAA,EAAiBC,IAAA,EAAcC,WAAA,EAAqBC,cAAA,KAA2B;EAC9G;EACA,MAAMT,GAAA,GAAME,MAAA,CAAOQ,GAAG,CAAE,GAAElB,gBAAiB,GAAEgB,WAAY,IAAGD,IAAK,KAAIpB,eAAA,CAAgBsB,cAAA,CAAgB,EAAC;EAEtG;EACA;EACA,MAAMb,aAAA,GAAgBC,MAAA,CAAOC,qBAAqB,CAACT,YAAA;EACnD,IAAI,CAACO,aAAA,CAAce,QAAQ,CAACX,GAAA,GAAM;IAChC;IACA;IACAX,YAAY,CAACW,GAAA,CAAI,gBAAGf,KAAA,CAAMoB,aAAa,CAACC,YAAA;EAC1C;EAEA;EACA,OAAOjB,YAAY,CAACW,GAAA,CAAI;AAC1B"}
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,MAAM;AAE9D,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,MAAO;YACvBC;QAAJ,IAAIA,CAAAA,iBAAAA,OAAOC,MAAM,CAACF,kBAAdC,4BAAAA,KAAAA,IAAAA,eAAoBE,WAAWX,mBAAmB;YACpD,OAAOH,YAAY,CAACW,IAAI;QAC1B,CAAC;IACH;AACF,CAAC;AAED;;;;;;;;;;;;CAYC,GACD,OAAO,MAAMI,gBAAgB,CAAIC,cAAiBC,MAAcC,aAAqBC,iBAA2B;IAC9G,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,CAAC;IAED,OAAOhB,YAAY,CAACW,IAAI;AAC1B,EAAE"}
package/lib/index.js CHANGED
@@ -1,3 +1,2 @@
1
1
  export { createContext } from './global-context';
2
2
  export { createContext as createContextSelector } from './global-context-selector';
3
- //# sourceMappingURL=index.js.map
package/lib/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"names":["createContext","createContextSelector"],"sources":["../src/index.ts"],"sourcesContent":["export { createContext } from './global-context';\nexport { createContext as createContextSelector } from './global-context-selector';\n"],"mappings":"AAAA,SAASA,aAAa,QAAQ;AAC9B,SAASA,aAAA,IAAiBC,qBAAqB,QAAQ"}
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
1
  import * as React from 'react';
2
- //# sourceMappingURL=types.js.map
package/lib/types.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"names":["React"],"sources":["../src/types.ts"],"sourcesContent":["import * as React from 'react';\n\nexport type GlobalObject = typeof globalThis & Record<symbol, React.Context<unknown>>;\n"],"mappings":"AAAA,YAAYA,KAAA,MAAW"}
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,7 +1,6 @@
1
1
  /**
2
2
  * @param version - semver version string
3
3
  * @returns The major version number
4
- */export function getMajorVersion(version) {
5
- return Number(version.split('.')[0]);
4
+ */ export function getMajorVersion(version) {
5
+ return Number(version.split('.')[0]);
6
6
  }
7
- //# sourceMappingURL=utils.js.map
package/lib/utils.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"names":["getMajorVersion","version","Number","split"],"sources":["../src/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"],"mappings":"AAAA;;;GAIA,OAAO,SAASA,gBAAgBC,OAAe,EAAE;EAC/C,OAAOC,MAAA,CAAOD,OAAA,CAAQE,KAAK,CAAC,IAAI,CAAC,EAAE;AACrC"}
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,EAAE;IAC/C,OAAOC,OAAOD,QAAQE,KAAK,CAAC,IAAI,CAAC,EAAE;AACrC,CAAC"}
@@ -17,17 +17,16 @@ const _react = /*#__PURE__*/ _interopRequireWildcard(require("react"));
17
17
  const _reactContextSelector = require("@fluentui/react-context-selector");
18
18
  const _reactUtilities = require("@fluentui/react-utilities");
19
19
  const _utils = require("./utils");
20
- const isBrowser = /*#__PURE__*/ (0, _reactUtilities.canUseDOM)();
20
+ const isBrowser = (0, _reactUtilities.canUseDOM)();
21
21
  const globalObject = isBrowser ? window : global;
22
22
  const SYMBOL_NAMESPACE = 'global-context-selector:';
23
23
  // During SSR the global object persists with the server process
24
24
  // Clean out the global object during server reload during development
25
25
  if (!isBrowser && process.env.NODE_ENV !== 'production') {
26
- const globalSymbols = /*#__PURE__*/ Object.getOwnPropertySymbols(globalObject);
26
+ const globalSymbols = Object.getOwnPropertySymbols(globalObject);
27
27
  globalSymbols.forEach((sym)=>{
28
28
  var _Symbol_keyFor;
29
29
  if ((_Symbol_keyFor = Symbol.keyFor(sym)) === null || _Symbol_keyFor === void 0 ? void 0 : _Symbol_keyFor.startsWith(SYMBOL_NAMESPACE)) {
30
- // @ts-expect-error - Indexing object with symbols not supported until TS 4.4
31
30
  delete globalObject[sym];
32
31
  }
33
32
  });
@@ -39,12 +38,8 @@ const createContext = (defaultValue, name, packageName, packageVersion)=>{
39
38
  // Object symbol properties can't be iterated with `for` or `Object.keys`
40
39
  const globalSymbols = Object.getOwnPropertySymbols(globalObject);
41
40
  if (!globalSymbols.includes(sym)) {
42
- // @ts-expect-error - Indexing object with symbols not supported until TS 4.4
43
41
  // eslint-disable-next-line @fluentui/no-context-default-value
44
42
  globalObject[sym] = (0, _reactContextSelector.createContext)(defaultValue);
45
43
  }
46
- // @ts-expect-error - Indexing object with symbols not supported until TS 4.4
47
44
  return globalObject[sym];
48
- }; //# sourceMappingURL=global-context-selector.js.map
49
-
50
- //# sourceMappingURL=global-context-selector.js.map
45
+ };
@@ -1 +1 @@
1
- {"version":3,"sources":["../lib/global-context-selector.js"],"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';\nconst isBrowser = /*#__PURE__*/canUseDOM();\nconst globalObject = isBrowser ? window : global;\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// 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 = /*#__PURE__*/Object.getOwnPropertySymbols(globalObject);\n globalSymbols.forEach(sym => {\n var _Symbol_keyFor;\n if ((_Symbol_keyFor = Symbol.keyFor(sym)) === null || _Symbol_keyFor === void 0 ? void 0 : _Symbol_keyFor.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 * 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 = (defaultValue, name, packageName, packageVersion) => {\n // Symbol guaranteed to be unique for the entire runtime\n const sym = Symbol.for(`${SYMBOL_NAMESPACE}${packageName}/${name}/@${getMajorVersion(packageVersion)}`);\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 // @ts-expect-error - Indexing object with symbols not supported until TS 4.4\n return globalObject[sym];\n};\n//# sourceMappingURL=global-context-selector.js.map"],"names":["SYMBOL_NAMESPACE","createContext","isBrowser","canUseDOM","globalObject","window","global","process","env","NODE_ENV","globalSymbols","Object","getOwnPropertySymbols","forEach","sym","_Symbol_keyFor","Symbol","keyFor","startsWith","defaultValue","name","packageName","packageVersion","for","getMajorVersion","includes","baseCreateContext"],"mappings":";;;;;;;;;;;IAQaA,gBAAgB,MAAhBA;IA0BAC,aAAa,MAAbA;;;6DAlCU;sCAC4B;gCACzB;uBACM;AAChC,MAAMC,YAAY,WAAW,GAAEC,IAAAA,yBAAS;AACxC,MAAMC,eAAeF,YAAYG,SAASC,MAAM;AAGzC,MAAMN,mBAAmB;AAChC,gEAAgE;AAChE,sEAAsE;AACtE,IAAI,CAACE,aAAaK,QAAQC,GAAG,CAACC,QAAQ,KAAK,cAAc;IACvD,MAAMC,gBAAgB,WAAW,GAAEC,OAAOC,qBAAqB,CAACR;IAChEM,cAAcG,OAAO,CAACC,CAAAA,MAAO;QAC3B,IAAIC;QACJ,IAAI,AAACA,CAAAA,iBAAiBC,OAAOC,MAAM,CAACH,IAAG,MAAO,IAAI,IAAIC,mBAAmB,KAAK,IAAI,KAAK,IAAIA,eAAeG,UAAU,CAAClB,iBAAiB,EAAE;YACtI,6EAA6E;YAC7E,OAAOI,YAAY,CAACU,IAAI;QAC1B,CAAC;IACH;AACF,CAAC;AAcM,MAAMb,gBAAgB,CAACkB,cAAcC,MAAMC,aAAaC,iBAAmB;IAChF,wDAAwD;IACxD,MAAMR,MAAME,OAAOO,GAAG,CAAC,CAAC,EAAEvB,iBAAiB,EAAEqB,YAAY,CAAC,EAAED,KAAK,EAAE,EAAEI,IAAAA,sBAAe,EAACF,gBAAgB,CAAC;IACtG,8DAA8D;IAC9D,yEAAyE;IACzE,MAAMZ,gBAAgBC,OAAOC,qBAAqB,CAACR;IACnD,IAAI,CAACM,cAAce,QAAQ,CAACX,MAAM;QAChC,6EAA6E;QAC7E,8DAA8D;QAC9DV,YAAY,CAACU,IAAI,GAAGY,IAAAA,mCAAiB,EAACP;IACxC,CAAC;IACD,6EAA6E;IAC7E,OAAOf,YAAY,CAACU,IAAI;AAC1B,GACA,mDAAmD"}
1
+ {"version":3,"sources":["global-context-selector.js"],"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';\nconst isBrowser = canUseDOM();\nconst globalObject = isBrowser ? window : global;\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// 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 var _Symbol_keyFor;\n if ((_Symbol_keyFor = Symbol.keyFor(sym)) === null || _Symbol_keyFor === void 0 ? void 0 : _Symbol_keyFor.startsWith(SYMBOL_NAMESPACE)) {\n delete globalObject[sym];\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 */ export const createContext = (defaultValue, name, packageName, packageVersion)=>{\n // Symbol guaranteed to be unique for the entire runtime\n const sym = Symbol.for(`${SYMBOL_NAMESPACE}${packageName}/${name}/@${getMajorVersion(packageVersion)}`);\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(defaultValue);\n }\n return globalObject[sym];\n};\n"],"names":["SYMBOL_NAMESPACE","createContext","isBrowser","canUseDOM","globalObject","window","global","process","env","NODE_ENV","globalSymbols","Object","getOwnPropertySymbols","forEach","sym","_Symbol_keyFor","Symbol","keyFor","startsWith","defaultValue","name","packageName","packageVersion","for","getMajorVersion","includes","baseCreateContext"],"mappings":";;;;;;;;;;;IAQaA,gBAAgB,MAAhBA;IAwBIC,aAAa,MAAbA;;;6DAhCM;sCAC4B;gCACzB;uBACM;AAChC,MAAMC,YAAYC,IAAAA,yBAAS;AAC3B,MAAMC,eAAeF,YAAYG,SAASC,MAAM;AAGzC,MAAMN,mBAAmB;AAChC,gEAAgE;AAChE,sEAAsE;AACtE,IAAI,CAACE,aAAaK,QAAQC,GAAG,CAACC,QAAQ,KAAK,cAAc;IACrD,MAAMC,gBAAgBC,OAAOC,qBAAqB,CAACR;IACnDM,cAAcG,OAAO,CAAC,CAACC,MAAM;QACzB,IAAIC;QACJ,IAAI,AAACA,CAAAA,iBAAiBC,OAAOC,MAAM,CAACH,IAAG,MAAO,IAAI,IAAIC,mBAAmB,KAAK,IAAI,KAAK,IAAIA,eAAeG,UAAU,CAAClB,iBAAiB,EAAE;YACpI,OAAOI,YAAY,CAACU,IAAI;QAC5B,CAAC;IACL;AACJ,CAAC;AAaU,MAAMb,gBAAgB,CAACkB,cAAcC,MAAMC,aAAaC,iBAAiB;IAChF,wDAAwD;IACxD,MAAMR,MAAME,OAAOO,GAAG,CAAC,CAAC,EAAEvB,iBAAiB,EAAEqB,YAAY,CAAC,EAAED,KAAK,EAAE,EAAEI,IAAAA,sBAAe,EAACF,gBAAgB,CAAC;IACtG,8DAA8D;IAC9D,yEAAyE;IACzE,MAAMZ,gBAAgBC,OAAOC,qBAAqB,CAACR;IACnD,IAAI,CAACM,cAAce,QAAQ,CAACX,MAAM;QAC9B,8DAA8D;QAC9DV,YAAY,CAACU,IAAI,GAAGY,IAAAA,mCAAiB,EAACP;IAC1C,CAAC;IACD,OAAOf,YAAY,CAACU,IAAI;AAC5B"}
@@ -16,17 +16,16 @@ const _interopRequireWildcard = require("@swc/helpers/lib/_interop_require_wildc
16
16
  const _react = /*#__PURE__*/ _interopRequireWildcard(require("react"));
17
17
  const _reactUtilities = require("@fluentui/react-utilities");
18
18
  const _utils = require("./utils");
19
- const isBrowser = /*#__PURE__*/ (0, _reactUtilities.canUseDOM)();
19
+ const isBrowser = (0, _reactUtilities.canUseDOM)();
20
20
  const globalObject = isBrowser ? window : global;
21
21
  const SYMBOL_NAMESPACE = 'global-context:';
22
22
  // During SSR the global object persists with the server process
23
23
  // Clean out the global object during server reload during development
24
24
  if (!isBrowser && process.env.NODE_ENV !== 'production') {
25
- const globalSymbols = /*#__PURE__*/ Object.getOwnPropertySymbols(globalObject);
25
+ const globalSymbols = Object.getOwnPropertySymbols(globalObject);
26
26
  globalSymbols.forEach((sym)=>{
27
27
  var _Symbol_keyFor;
28
28
  if ((_Symbol_keyFor = Symbol.keyFor(sym)) === null || _Symbol_keyFor === void 0 ? void 0 : _Symbol_keyFor.startsWith(SYMBOL_NAMESPACE)) {
29
- // @ts-expect-error - Indexing object with symbols not supported until TS 4.4
30
29
  delete globalObject[sym];
31
30
  }
32
31
  });
@@ -38,12 +37,8 @@ const createContext = (defaultValue, name, packageName, packageVersion)=>{
38
37
  // Object symbol properties can't be iterated with `for` or `Object.keys`
39
38
  const globalSymbols = Object.getOwnPropertySymbols(globalObject);
40
39
  if (!globalSymbols.includes(sym)) {
41
- // @ts-expect-error - Indexing object with symbols not supported until TS 4.4
42
40
  // eslint-disable-next-line @fluentui/no-context-default-value
43
41
  globalObject[sym] = /*#__PURE__*/ _react.createContext(defaultValue);
44
42
  }
45
- // @ts-expect-error - Indexing object with symbols not supported until TS 4.4
46
43
  return globalObject[sym];
47
- }; //# sourceMappingURL=global-context.js.map
48
-
49
- //# sourceMappingURL=global-context.js.map
44
+ };
@@ -1 +1 @@
1
- {"version":3,"sources":["../lib/global-context.js"],"sourcesContent":["import * as React from 'react';\nimport { canUseDOM } from '@fluentui/react-utilities';\nimport { getMajorVersion } from './utils';\nconst isBrowser = /*#__PURE__*/canUseDOM();\nconst globalObject = isBrowser ? window : global;\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// 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 = /*#__PURE__*/Object.getOwnPropertySymbols(globalObject);\n globalSymbols.forEach(sym => {\n var _Symbol_keyFor;\n if ((_Symbol_keyFor = Symbol.keyFor(sym)) === null || _Symbol_keyFor === void 0 ? void 0 : _Symbol_keyFor.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 * 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 = (defaultValue, name, packageName, packageVersion) => {\n // Symbol guaranteed to be unique for the entire runtime\n const sym = Symbol.for(`${SYMBOL_NAMESPACE}${packageName}/${name}/@${getMajorVersion(packageVersion)}`);\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] = /*#__PURE__*/React.createContext(defaultValue);\n }\n // @ts-expect-error - Indexing object with symbols not supported until TS 4.4\n return globalObject[sym];\n};\n//# sourceMappingURL=global-context.js.map"],"names":["SYMBOL_NAMESPACE","createContext","isBrowser","canUseDOM","globalObject","window","global","process","env","NODE_ENV","globalSymbols","Object","getOwnPropertySymbols","forEach","sym","_Symbol_keyFor","Symbol","keyFor","startsWith","defaultValue","name","packageName","packageVersion","for","getMajorVersion","includes","React"],"mappings":";;;;;;;;;;;IAOaA,gBAAgB,MAAhBA;IA0BAC,aAAa,MAAbA;;;6DAjCU;gCACG;uBACM;AAChC,MAAMC,YAAY,WAAW,GAAEC,IAAAA,yBAAS;AACxC,MAAMC,eAAeF,YAAYG,SAASC,MAAM;AAGzC,MAAMN,mBAAmB;AAChC,gEAAgE;AAChE,sEAAsE;AACtE,IAAI,CAACE,aAAaK,QAAQC,GAAG,CAACC,QAAQ,KAAK,cAAc;IACvD,MAAMC,gBAAgB,WAAW,GAAEC,OAAOC,qBAAqB,CAACR;IAChEM,cAAcG,OAAO,CAACC,CAAAA,MAAO;QAC3B,IAAIC;QACJ,IAAI,AAACA,CAAAA,iBAAiBC,OAAOC,MAAM,CAACH,IAAG,MAAO,IAAI,IAAIC,mBAAmB,KAAK,IAAI,KAAK,IAAIA,eAAeG,UAAU,CAAClB,iBAAiB,EAAE;YACtI,6EAA6E;YAC7E,OAAOI,YAAY,CAACU,IAAI;QAC1B,CAAC;IACH;AACF,CAAC;AAcM,MAAMb,gBAAgB,CAACkB,cAAcC,MAAMC,aAAaC,iBAAmB;IAChF,wDAAwD;IACxD,MAAMR,MAAME,OAAOO,GAAG,CAAC,CAAC,EAAEvB,iBAAiB,EAAEqB,YAAY,CAAC,EAAED,KAAK,EAAE,EAAEI,IAAAA,sBAAe,EAACF,gBAAgB,CAAC;IACtG,8DAA8D;IAC9D,yEAAyE;IACzE,MAAMZ,gBAAgBC,OAAOC,qBAAqB,CAACR;IACnD,IAAI,CAACM,cAAce,QAAQ,CAACX,MAAM;QAChC,6EAA6E;QAC7E,8DAA8D;QAC9DV,YAAY,CAACU,IAAI,GAAG,WAAW,GAAEY,OAAMzB,aAAa,CAACkB;IACvD,CAAC;IACD,6EAA6E;IAC7E,OAAOf,YAAY,CAACU,IAAI;AAC1B,GACA,0CAA0C"}
1
+ {"version":3,"sources":["global-context.js"],"sourcesContent":["import * as React from 'react';\nimport { canUseDOM } from '@fluentui/react-utilities';\nimport { getMajorVersion } from './utils';\nconst isBrowser = canUseDOM();\nconst globalObject = isBrowser ? window : global;\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// 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 var _Symbol_keyFor;\n if ((_Symbol_keyFor = Symbol.keyFor(sym)) === null || _Symbol_keyFor === void 0 ? void 0 : _Symbol_keyFor.startsWith(SYMBOL_NAMESPACE)) {\n delete globalObject[sym];\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 */ export const createContext = (defaultValue, name, packageName, packageVersion)=>{\n // Symbol guaranteed to be unique for the entire runtime\n const sym = Symbol.for(`${SYMBOL_NAMESPACE}${packageName}/${name}/@${getMajorVersion(packageVersion)}`);\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(defaultValue);\n }\n return globalObject[sym];\n};\n"],"names":["SYMBOL_NAMESPACE","createContext","isBrowser","canUseDOM","globalObject","window","global","process","env","NODE_ENV","globalSymbols","Object","getOwnPropertySymbols","forEach","sym","_Symbol_keyFor","Symbol","keyFor","startsWith","defaultValue","name","packageName","packageVersion","for","getMajorVersion","includes","React"],"mappings":";;;;;;;;;;;IAOaA,gBAAgB,MAAhBA;IAwBIC,aAAa,MAAbA;;;6DA/BM;gCACG;uBACM;AAChC,MAAMC,YAAYC,IAAAA,yBAAS;AAC3B,MAAMC,eAAeF,YAAYG,SAASC,MAAM;AAGzC,MAAMN,mBAAmB;AAChC,gEAAgE;AAChE,sEAAsE;AACtE,IAAI,CAACE,aAAaK,QAAQC,GAAG,CAACC,QAAQ,KAAK,cAAc;IACrD,MAAMC,gBAAgBC,OAAOC,qBAAqB,CAACR;IACnDM,cAAcG,OAAO,CAAC,CAACC,MAAM;QACzB,IAAIC;QACJ,IAAI,AAACA,CAAAA,iBAAiBC,OAAOC,MAAM,CAACH,IAAG,MAAO,IAAI,IAAIC,mBAAmB,KAAK,IAAI,KAAK,IAAIA,eAAeG,UAAU,CAAClB,iBAAiB,EAAE;YACpI,OAAOI,YAAY,CAACU,IAAI;QAC5B,CAAC;IACL;AACJ,CAAC;AAaU,MAAMb,gBAAgB,CAACkB,cAAcC,MAAMC,aAAaC,iBAAiB;IAChF,wDAAwD;IACxD,MAAMR,MAAME,OAAOO,GAAG,CAAC,CAAC,EAAEvB,iBAAiB,EAAEqB,YAAY,CAAC,EAAED,KAAK,EAAE,EAAEI,IAAAA,sBAAe,EAACF,gBAAgB,CAAC;IACtG,8DAA8D;IAC9D,yEAAyE;IACzE,MAAMZ,gBAAgBC,OAAOC,qBAAqB,CAACR;IACnD,IAAI,CAACM,cAAce,QAAQ,CAACX,MAAM;QAC9B,8DAA8D;QAC9DV,YAAY,CAACU,IAAI,iBAAGY,OAAMzB,aAAa,CAACkB;IAC5C,CAAC;IACD,OAAOf,YAAY,CAACU,IAAI;AAC5B"}
@@ -14,6 +14,3 @@ _export(exports, {
14
14
  });
15
15
  const _globalContext = require("./global-context");
16
16
  const _globalContextSelector = require("./global-context-selector");
17
- //# sourceMappingURL=index.js.map
18
-
19
- //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../lib/index.js"],"sourcesContent":["export { createContext } from './global-context';\nexport { createContext as createContextSelector } from './global-context-selector';\n//# sourceMappingURL=index.js.map"],"names":["createContext","createContextSelector"],"mappings":";;;;;;;;;;;IAASA,aAAa,MAAbA,4BAAa;IACIC,qBAAqB,MAAtCD,oCAAa;;+BADQ;uCACyB;CACvD,iCAAiC"}
1
+ {"version":3,"sources":["index.js"],"sourcesContent":["export { createContext } from './global-context';\nexport { createContext as createContextSelector } from './global-context-selector';\n"],"names":["createContext","createContextSelector"],"mappings":";;;;;;;;;;;IAASA,aAAa,MAAbA,4BAAa;IACIC,qBAAqB,MAAtCD,oCAAa;;+BADQ;uCACyB"}
@@ -4,6 +4,3 @@ Object.defineProperty(exports, "__esModule", {
4
4
  });
5
5
  const _interopRequireWildcard = require("@swc/helpers/lib/_interop_require_wildcard.js").default;
6
6
  const _react = /*#__PURE__*/ _interopRequireWildcard(require("react"));
7
- //# sourceMappingURL=types.js.map
8
-
9
- //# sourceMappingURL=types.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../lib/types.js"],"sourcesContent":["import * as React from 'react';\n//# sourceMappingURL=types.js.map"],"names":[],"mappings":";;;;;6DAAuB;CACvB,iCAAiC"}
1
+ {"version":3,"sources":["types.js"],"sourcesContent":["import * as React from 'react';\n"],"names":[],"mappings":";;;;;6DAAuB"}
@@ -11,6 +11,4 @@ Object.defineProperty(exports, "getMajorVersion", {
11
11
  });
12
12
  function getMajorVersion(version) {
13
13
  return Number(version.split('.')[0]);
14
- } //# sourceMappingURL=utils.js.map
15
-
16
- //# sourceMappingURL=utils.js.map
14
+ }
@@ -1 +1 @@
1
- {"version":3,"sources":["../lib/utils.js"],"sourcesContent":["/**\n * @param version - semver version string\n * @returns The major version number\n */export function getMajorVersion(version) {\n return Number(version.split('.')[0]);\n}\n//# sourceMappingURL=utils.js.map"],"names":["getMajorVersion","version","Number","split"],"mappings":"AAAA;;;CAGC;;;;+BAAkBA;;aAAAA;;AAAT,SAASA,gBAAgBC,OAAO,EAAE;IAC1C,OAAOC,OAAOD,QAAQE,KAAK,CAAC,IAAI,CAAC,EAAE;AACrC,EACA,iCAAiC"}
1
+ {"version":3,"sources":["utils.js"],"sourcesContent":["/**\n * @param version - semver version string\n * @returns The major version number\n */ export function getMajorVersion(version) {\n return Number(version.split('.')[0]);\n}\n"],"names":["getMajorVersion","version","Number","split"],"mappings":"AAAA;;;CAGC;;;;+BAAmBA;;aAAAA;;AAAT,SAASA,gBAAgBC,OAAO,EAAE;IACzC,OAAOC,OAAOD,QAAQE,KAAK,CAAC,IAAI,CAAC,EAAE;AACvC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fluentui/global-context",
3
- "version": "9.0.0-beta.28",
3
+ "version": "9.0.0-beta.29",
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",
@@ -32,8 +32,8 @@
32
32
  "@fluentui/scripts-tasks": "*"
33
33
  },
34
34
  "dependencies": {
35
- "@fluentui/react-context-selector": "^9.1.21",
36
- "@fluentui/react-utilities": "^9.9.1",
35
+ "@fluentui/react-context-selector": "^9.1.22",
36
+ "@fluentui/react-utilities": "^9.9.2",
37
37
  "@swc/helpers": "^0.4.14"
38
38
  },
39
39
  "peerDependencies": {