@fluentui/global-context 9.0.0-beta.38 → 9.0.0-beta.39
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 +34 -1
- package/CHANGELOG.md +14 -2
- package/lib/global-context-selector.js.map +1 -1
- package/lib/global-context.js.map +1 -1
- package/lib/utils.js.map +1 -1
- package/lib-commonjs/global-context-selector.js +12 -8
- package/lib-commonjs/global-context-selector.js.map +1 -1
- package/lib-commonjs/global-context.js +10 -6
- package/lib-commonjs/global-context.js.map +1 -1
- package/lib-commonjs/index.js +8 -4
- package/lib-commonjs/index.js.map +1 -1
- package/lib-commonjs/types.js +2 -2
- package/lib-commonjs/types.js.map +1 -1
- package/lib-commonjs/utils.js +3 -1
- package/lib-commonjs/utils.js.map +1 -1
- package/package.json +8 -8
package/CHANGELOG.json
CHANGED
|
@@ -2,7 +2,40 @@
|
|
|
2
2
|
"name": "@fluentui/global-context",
|
|
3
3
|
"entries": [
|
|
4
4
|
{
|
|
5
|
-
"date": "Tue,
|
|
5
|
+
"date": "Tue, 05 Sep 2023 13:23:18 GMT",
|
|
6
|
+
"tag": "@fluentui/global-context_v9.0.0-beta.39",
|
|
7
|
+
"version": "9.0.0-beta.39",
|
|
8
|
+
"comments": {
|
|
9
|
+
"prerelease": [
|
|
10
|
+
{
|
|
11
|
+
"author": "bernardo.sunderhus@gmail.com",
|
|
12
|
+
"package": "@fluentui/global-context",
|
|
13
|
+
"commit": "b93c2ac22355b6cb6f33dd509c6cd9c21f4fffc8",
|
|
14
|
+
"comment": "bumps @swc/helpers version to 0.5.1"
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
"author": "bernardo.sunderhus@gmail.com",
|
|
18
|
+
"package": "@fluentui/global-context",
|
|
19
|
+
"commit": "eea6d93a62249ba4fba3347fb291c67ee1a3fb24",
|
|
20
|
+
"comment": "bumps react peer dependencies to v16.14.0"
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
"author": "beachball",
|
|
24
|
+
"package": "@fluentui/global-context",
|
|
25
|
+
"comment": "Bump @fluentui/react-context-selector to v9.1.32",
|
|
26
|
+
"commit": "0bf811dbcaaa6b78743537d142fe4d348b457045"
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
"author": "beachball",
|
|
30
|
+
"package": "@fluentui/global-context",
|
|
31
|
+
"comment": "Bump @fluentui/react-utilities to v9.13.1",
|
|
32
|
+
"commit": "0bf811dbcaaa6b78743537d142fe4d348b457045"
|
|
33
|
+
}
|
|
34
|
+
]
|
|
35
|
+
}
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
"date": "Tue, 29 Aug 2023 12:57:36 GMT",
|
|
6
39
|
"tag": "@fluentui/global-context_v9.0.0-beta.38",
|
|
7
40
|
"version": "9.0.0-beta.38",
|
|
8
41
|
"comments": {
|
package/CHANGELOG.md
CHANGED
|
@@ -1,12 +1,24 @@
|
|
|
1
1
|
# Change Log - @fluentui/global-context
|
|
2
2
|
|
|
3
|
-
This log was last generated on Tue,
|
|
3
|
+
This log was last generated on Tue, 05 Sep 2023 13:23:18 GMT and should not be manually modified.
|
|
4
4
|
|
|
5
5
|
<!-- Start content -->
|
|
6
6
|
|
|
7
|
+
## [9.0.0-beta.39](https://github.com/microsoft/fluentui/tree/@fluentui/global-context_v9.0.0-beta.39)
|
|
8
|
+
|
|
9
|
+
Tue, 05 Sep 2023 13:23:18 GMT
|
|
10
|
+
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/global-context_v9.0.0-beta.38..@fluentui/global-context_v9.0.0-beta.39)
|
|
11
|
+
|
|
12
|
+
### Changes
|
|
13
|
+
|
|
14
|
+
- bumps @swc/helpers version to 0.5.1 ([PR #28989](https://github.com/microsoft/fluentui/pull/28989) by bernardo.sunderhus@gmail.com)
|
|
15
|
+
- bumps react peer dependencies to v16.14.0 ([PR #28959](https://github.com/microsoft/fluentui/pull/28959) by bernardo.sunderhus@gmail.com)
|
|
16
|
+
- Bump @fluentui/react-context-selector to v9.1.32 ([PR #27840](https://github.com/microsoft/fluentui/pull/27840) by beachball)
|
|
17
|
+
- Bump @fluentui/react-utilities to v9.13.1 ([PR #27840](https://github.com/microsoft/fluentui/pull/27840) by beachball)
|
|
18
|
+
|
|
7
19
|
## [9.0.0-beta.38](https://github.com/microsoft/fluentui/tree/@fluentui/global-context_v9.0.0-beta.38)
|
|
8
20
|
|
|
9
|
-
Tue, 29 Aug 2023 12:
|
|
21
|
+
Tue, 29 Aug 2023 12:57:36 GMT
|
|
10
22
|
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/global-context_v9.0.0-beta.37..@fluentui/global-context_v9.0.0-beta.38)
|
|
11
23
|
|
|
12
24
|
### Changes
|
|
@@ -1 +1 @@
|
|
|
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
|
|
1
|
+
{"version":3,"sources":["global-context-selector.ts"],"sourcesContent":["import * as React from 'react';\nimport { createContext as baseCreateContext } from '@fluentui/react-context-selector';\nimport { canUseDOM } from '@fluentui/react-utilities';\nimport { getMajorVersion } from './utils';\nimport { GlobalObject } from './types';\n\nconst isBrowser = canUseDOM();\nconst globalObject: GlobalObject = isBrowser ? window : global;\n\n// Identifier for the symbol, for easy idenfitifaction of symbols created by this util\n// Useful for clearning global object during SSR reloads\nexport const SYMBOL_NAMESPACE = 'global-context-selector:';\n\n// During SSR the global object persists with the server process\n// Clean out the global object during server reload during development\nif (!isBrowser && process.env.NODE_ENV !== 'production') {\n const globalSymbols = Object.getOwnPropertySymbols(globalObject);\n globalSymbols.forEach(sym => {\n if (Symbol.keyFor(sym)?.startsWith(SYMBOL_NAMESPACE)) {\n delete globalObject[sym];\n }\n });\n}\n\n/**\n * Wrapper around @see createContext from \\@fluentui/react-context-selector that implements context registration\n * in the globalThis object to avoid duplicate contexts. Contexts are keyed with\n * a unique sybmol for the package name, version and name of the context.\n *\n * @see {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Symbol}\n *\n * @param defaultValue - @see React.createContext\n * @param name - name of the context\n * @param packageName - name of the npm package where the module is used\n * @param packageVersion - version of the npm package where the module is used\n * @returns @see React.createContext\n */\nexport const createContext = <T>(defaultValue: T, name: string, packageName: string, packageVersion: string) => {\n // Symbol guaranteed to be unique for the entire runtime\n const sym = Symbol.for(`${SYMBOL_NAMESPACE}${packageName}/${name}/@${getMajorVersion(packageVersion)}`);\n\n // Objects keyed with symbols are not visible with console.log\n // Object symbol properties can't be iterated with `for` or `Object.keys`\n const globalSymbols = Object.getOwnPropertySymbols(globalObject);\n if (!globalSymbols.includes(sym)) {\n // eslint-disable-next-line @fluentui/no-context-default-value\n globalObject[sym] = baseCreateContext<unknown>(defaultValue);\n }\n\n return globalObject[sym] as React.Context<T>;\n};\n"],"names":["React","createContext","baseCreateContext","canUseDOM","getMajorVersion","isBrowser","globalObject","window","global","SYMBOL_NAMESPACE","process","env","NODE_ENV","globalSymbols","Object","getOwnPropertySymbols","forEach","sym","Symbol","keyFor","startsWith","defaultValue","name","packageName","packageVersion","for","includes"],"mappings":"AAAA,YAAYA,WAAW,QAAQ;AAC/B,SAASC,iBAAiBC,iBAAiB,QAAQ,mCAAmC;AACtF,SAASC,SAAS,QAAQ,4BAA4B;AACtD,SAASC,eAAe,QAAQ,UAAU;AAG1C,MAAMC,YAAYF;AAClB,MAAMG,eAA6BD,YAAYE,SAASC;AAExD,sFAAsF;AACtF,wDAAwD;AACxD,OAAO,MAAMC,mBAAmB,2BAA2B;AAE3D,gEAAgE;AAChE,sEAAsE;AACtE,IAAI,CAACJ,aAAaK,QAAQC,GAAG,CAACC,QAAQ,KAAK,cAAc;IACvD,MAAMC,gBAAgBC,OAAOC,qBAAqB,CAACT;IACnDO,cAAcG,OAAO,CAACC,CAAAA;YAChBC;QAAJ,KAAIA,iBAAAA,OAAOC,MAAM,CAACF,kBAAdC,qCAAAA,eAAoBE,UAAU,CAACX,mBAAmB;YACpD,OAAOH,YAAY,CAACW,IAAI;QAC1B;IACF;AACF;AAEA;;;;;;;;;;;;CAYC,GACD,OAAO,MAAMhB,gBAAgB,CAAIoB,cAAiBC,MAAcC,aAAqBC;IACnF,wDAAwD;IACxD,MAAMP,MAAMC,OAAOO,GAAG,CAAC,CAAC,EAAEhB,iBAAiB,EAAEc,YAAY,CAAC,EAAED,KAAK,EAAE,EAAElB,gBAAgBoB,gBAAgB,CAAC;IAEtG,8DAA8D;IAC9D,yEAAyE;IACzE,MAAMX,gBAAgBC,OAAOC,qBAAqB,CAACT;IACnD,IAAI,CAACO,cAAca,QAAQ,CAACT,MAAM;QAChC,8DAA8D;QAC9DX,YAAY,CAACW,IAAI,GAAGf,kBAA2BmB;IACjD;IAEA,OAAOf,YAAY,CAACW,IAAI;AAC1B,EAAE"}
|
|
@@ -1 +1 @@
|
|
|
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
|
|
1
|
+
{"version":3,"sources":["global-context.ts"],"sourcesContent":["import * as React from 'react';\nimport { canUseDOM } from '@fluentui/react-utilities';\nimport { GlobalObject } from './types';\nimport { getMajorVersion } from './utils';\n\nconst isBrowser = canUseDOM();\nconst globalObject: GlobalObject = isBrowser ? window : global;\n\n// Identifier for the symbol, for easy idenfitifaction of symbols created by this util\n// Useful for clearning global object during SSR reloads\nexport const SYMBOL_NAMESPACE = 'global-context:';\n\n// During SSR the global object persists with the server process\n// Clean out the global object during server reload during development\nif (!isBrowser && process.env.NODE_ENV !== 'production') {\n const globalSymbols = Object.getOwnPropertySymbols(globalObject);\n globalSymbols.forEach(sym => {\n if (Symbol.keyFor(sym)?.startsWith(SYMBOL_NAMESPACE)) {\n delete globalObject[sym];\n }\n });\n}\n\n/**\n * Wrapper around @see React.createContext that implements context registration\n * in the globalThis object to avoid duplicate contexts. Contexts are keyed with\n * a unique sybmol for the package name, version and name of the context.\n *\n * @see {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Symbol}\n *\n * @param defaultValue - @see React.createContext\n * @param name - name of the context\n * @param packageName - name of the npm package where the module is used\n * @param packageVersion - version of the npm package where the module is used\n * @returns @see React.createContext\n */\nexport const createContext = <T>(defaultValue: T, name: string, packageName: string, packageVersion: string) => {\n // Symbol guaranteed to be unique for the entire runtime\n const sym = Symbol.for(`${SYMBOL_NAMESPACE}${packageName}/${name}/@${getMajorVersion(packageVersion)}`);\n\n // Objects keyed with symbols are not visible with console.log\n // Object symbol properties can't be iterated with `for` or `Object.keys`\n const globalSymbols = Object.getOwnPropertySymbols(globalObject);\n if (!globalSymbols.includes(sym)) {\n // eslint-disable-next-line @fluentui/no-context-default-value\n globalObject[sym] = React.createContext<unknown>(defaultValue);\n }\n\n return globalObject[sym] as React.Context<T>;\n};\n"],"names":["React","canUseDOM","getMajorVersion","isBrowser","globalObject","window","global","SYMBOL_NAMESPACE","process","env","NODE_ENV","globalSymbols","Object","getOwnPropertySymbols","forEach","sym","Symbol","keyFor","startsWith","createContext","defaultValue","name","packageName","packageVersion","for","includes"],"mappings":"AAAA,YAAYA,WAAW,QAAQ;AAC/B,SAASC,SAAS,QAAQ,4BAA4B;AAEtD,SAASC,eAAe,QAAQ,UAAU;AAE1C,MAAMC,YAAYF;AAClB,MAAMG,eAA6BD,YAAYE,SAASC;AAExD,sFAAsF;AACtF,wDAAwD;AACxD,OAAO,MAAMC,mBAAmB,kBAAkB;AAElD,gEAAgE;AAChE,sEAAsE;AACtE,IAAI,CAACJ,aAAaK,QAAQC,GAAG,CAACC,QAAQ,KAAK,cAAc;IACvD,MAAMC,gBAAgBC,OAAOC,qBAAqB,CAACT;IACnDO,cAAcG,OAAO,CAACC,CAAAA;YAChBC;QAAJ,KAAIA,iBAAAA,OAAOC,MAAM,CAACF,kBAAdC,qCAAAA,eAAoBE,UAAU,CAACX,mBAAmB;YACpD,OAAOH,YAAY,CAACW,IAAI;QAC1B;IACF;AACF;AAEA;;;;;;;;;;;;CAYC,GACD,OAAO,MAAMI,gBAAgB,CAAIC,cAAiBC,MAAcC,aAAqBC;IACnF,wDAAwD;IACxD,MAAMR,MAAMC,OAAOQ,GAAG,CAAC,CAAC,EAAEjB,iBAAiB,EAAEe,YAAY,CAAC,EAAED,KAAK,EAAE,EAAEnB,gBAAgBqB,gBAAgB,CAAC;IAEtG,8DAA8D;IAC9D,yEAAyE;IACzE,MAAMZ,gBAAgBC,OAAOC,qBAAqB,CAACT;IACnD,IAAI,CAACO,cAAcc,QAAQ,CAACV,MAAM;QAChC,8DAA8D;QAC9DX,YAAY,CAACW,IAAI,GAAGf,MAAMmB,aAAa,CAAUC;IACnD;IAEA,OAAOhB,YAAY,CAACW,IAAI;AAC1B,EAAE"}
|
package/lib/utils.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
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
|
|
1
|
+
{"version":3,"sources":["utils.ts"],"sourcesContent":["/**\n * @param version - semver version string\n * @returns The major version number\n */\nexport function getMajorVersion(version: string) {\n return Number(version.split('.')[0]);\n}\n"],"names":["getMajorVersion","version","Number","split"],"mappings":"AAAA;;;CAGC,GACD,OAAO,SAASA,gBAAgBC,OAAe;IAC7C,OAAOC,OAAOD,QAAQE,KAAK,CAAC,IAAI,CAAC,EAAE;AACrC"}
|
|
@@ -9,15 +9,19 @@ function _export(target, all) {
|
|
|
9
9
|
});
|
|
10
10
|
}
|
|
11
11
|
_export(exports, {
|
|
12
|
-
SYMBOL_NAMESPACE: ()
|
|
13
|
-
|
|
12
|
+
SYMBOL_NAMESPACE: function() {
|
|
13
|
+
return SYMBOL_NAMESPACE;
|
|
14
|
+
},
|
|
15
|
+
createContext: function() {
|
|
16
|
+
return createContext;
|
|
17
|
+
}
|
|
14
18
|
});
|
|
15
|
-
const
|
|
16
|
-
const _react = /*#__PURE__*/
|
|
17
|
-
const
|
|
18
|
-
const
|
|
19
|
+
const _interop_require_wildcard = require("@swc/helpers/_/_interop_require_wildcard");
|
|
20
|
+
const _react = /*#__PURE__*/ _interop_require_wildcard._(require("react"));
|
|
21
|
+
const _reactcontextselector = require("@fluentui/react-context-selector");
|
|
22
|
+
const _reactutilities = require("@fluentui/react-utilities");
|
|
19
23
|
const _utils = require("./utils");
|
|
20
|
-
const isBrowser = (0,
|
|
24
|
+
const isBrowser = (0, _reactutilities.canUseDOM)();
|
|
21
25
|
const globalObject = isBrowser ? window : global;
|
|
22
26
|
const SYMBOL_NAMESPACE = 'global-context-selector:';
|
|
23
27
|
// During SSR the global object persists with the server process
|
|
@@ -39,7 +43,7 @@ const createContext = (defaultValue, name, packageName, packageVersion)=>{
|
|
|
39
43
|
const globalSymbols = Object.getOwnPropertySymbols(globalObject);
|
|
40
44
|
if (!globalSymbols.includes(sym)) {
|
|
41
45
|
// eslint-disable-next-line @fluentui/no-context-default-value
|
|
42
|
-
globalObject[sym] = (0,
|
|
46
|
+
globalObject[sym] = (0, _reactcontextselector.createContext)(defaultValue);
|
|
43
47
|
}
|
|
44
48
|
return globalObject[sym];
|
|
45
49
|
};
|
|
@@ -1 +1 @@
|
|
|
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
|
|
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;eAAhBA;;IAwBIC,aAAa;eAAbA;;;;iEAhCM;sCAC4B;gCACzB;uBACM;AAChC,MAAMC,YAAYC,IAAAA,yBAAS;AAC3B,MAAMC,eAAeF,YAAYG,SAASC;AAGnC,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;QACnB,IAAIC;QACJ,IAAI,AAACA,CAAAA,iBAAiBC,OAAOC,MAAM,CAACH,IAAG,MAAO,QAAQC,mBAAmB,KAAK,IAAI,KAAK,IAAIA,eAAeG,UAAU,CAAClB,mBAAmB;YACpI,OAAOI,YAAY,CAACU,IAAI;QAC5B;IACJ;AACJ;AAaW,MAAMb,gBAAgB,CAACkB,cAAcC,MAAMC,aAAaC;IAC/D,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;IACA,OAAOf,YAAY,CAACU,IAAI;AAC5B"}
|
|
@@ -9,14 +9,18 @@ function _export(target, all) {
|
|
|
9
9
|
});
|
|
10
10
|
}
|
|
11
11
|
_export(exports, {
|
|
12
|
-
SYMBOL_NAMESPACE: ()
|
|
13
|
-
|
|
12
|
+
SYMBOL_NAMESPACE: function() {
|
|
13
|
+
return SYMBOL_NAMESPACE;
|
|
14
|
+
},
|
|
15
|
+
createContext: function() {
|
|
16
|
+
return createContext;
|
|
17
|
+
}
|
|
14
18
|
});
|
|
15
|
-
const
|
|
16
|
-
const _react = /*#__PURE__*/
|
|
17
|
-
const
|
|
19
|
+
const _interop_require_wildcard = require("@swc/helpers/_/_interop_require_wildcard");
|
|
20
|
+
const _react = /*#__PURE__*/ _interop_require_wildcard._(require("react"));
|
|
21
|
+
const _reactutilities = require("@fluentui/react-utilities");
|
|
18
22
|
const _utils = require("./utils");
|
|
19
|
-
const isBrowser = (0,
|
|
23
|
+
const isBrowser = (0, _reactutilities.canUseDOM)();
|
|
20
24
|
const globalObject = isBrowser ? window : global;
|
|
21
25
|
const SYMBOL_NAMESPACE = 'global-context:';
|
|
22
26
|
// During SSR the global object persists with the server process
|
|
@@ -1 +1 @@
|
|
|
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
|
|
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;eAAhBA;;IAwBIC,aAAa;eAAbA;;;;iEA/BM;gCACG;uBACM;AAChC,MAAMC,YAAYC,IAAAA,yBAAS;AAC3B,MAAMC,eAAeF,YAAYG,SAASC;AAGnC,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;QACnB,IAAIC;QACJ,IAAI,AAACA,CAAAA,iBAAiBC,OAAOC,MAAM,CAACH,IAAG,MAAO,QAAQC,mBAAmB,KAAK,IAAI,KAAK,IAAIA,eAAeG,UAAU,CAAClB,mBAAmB;YACpI,OAAOI,YAAY,CAACU,IAAI;QAC5B;IACJ;AACJ;AAaW,MAAMb,gBAAgB,CAACkB,cAAcC,MAAMC,aAAaC;IAC/D,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;IACA,OAAOf,YAAY,CAACU,IAAI;AAC5B"}
|
package/lib-commonjs/index.js
CHANGED
|
@@ -9,8 +9,12 @@ function _export(target, all) {
|
|
|
9
9
|
});
|
|
10
10
|
}
|
|
11
11
|
_export(exports, {
|
|
12
|
-
createContext: ()
|
|
13
|
-
|
|
12
|
+
createContext: function() {
|
|
13
|
+
return _globalcontext.createContext;
|
|
14
|
+
},
|
|
15
|
+
createContextSelector: function() {
|
|
16
|
+
return _globalcontextselector.createContext;
|
|
17
|
+
}
|
|
14
18
|
});
|
|
15
|
-
const
|
|
16
|
-
const
|
|
19
|
+
const _globalcontext = require("./global-context");
|
|
20
|
+
const _globalcontextselector = require("./global-context-selector");
|
|
@@ -1 +1 @@
|
|
|
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,
|
|
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;eAAbA,4BAAa;;IACIC,qBAAqB;eAAtCD,oCAAa;;;+BADQ;uCACyB"}
|
package/lib-commonjs/types.js
CHANGED
|
@@ -2,5 +2,5 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", {
|
|
3
3
|
value: true
|
|
4
4
|
});
|
|
5
|
-
const
|
|
6
|
-
const _react = /*#__PURE__*/
|
|
5
|
+
const _interop_require_wildcard = require("@swc/helpers/_/_interop_require_wildcard");
|
|
6
|
+
const _react = /*#__PURE__*/ _interop_require_wildcard._(require("react"));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["types.js"],"sourcesContent":["import * as React from 'react';\n"],"names":[],"mappings":";;;;;
|
|
1
|
+
{"version":3,"sources":["types.js"],"sourcesContent":["import * as React from 'react';\n"],"names":[],"mappings":";;;;;iEAAuB"}
|
package/lib-commonjs/utils.js
CHANGED
|
@@ -7,7 +7,9 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
7
7
|
});
|
|
8
8
|
Object.defineProperty(exports, "getMajorVersion", {
|
|
9
9
|
enumerable: true,
|
|
10
|
-
get: ()
|
|
10
|
+
get: function() {
|
|
11
|
+
return getMajorVersion;
|
|
12
|
+
}
|
|
11
13
|
});
|
|
12
14
|
function getMajorVersion(version) {
|
|
13
15
|
return Number(version.split('.')[0]);
|
|
@@ -1 +1 @@
|
|
|
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
|
|
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;;;eAAAA;;;AAAT,SAASA,gBAAgBC,OAAO;IACvC,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.
|
|
3
|
+
"version": "9.0.0-beta.39",
|
|
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,15 +32,15 @@
|
|
|
32
32
|
"@fluentui/scripts-tasks": "*"
|
|
33
33
|
},
|
|
34
34
|
"dependencies": {
|
|
35
|
-
"@fluentui/react-context-selector": "^9.1.
|
|
36
|
-
"@fluentui/react-utilities": "^9.13.
|
|
37
|
-
"@swc/helpers": "^0.
|
|
35
|
+
"@fluentui/react-context-selector": "^9.1.32",
|
|
36
|
+
"@fluentui/react-utilities": "^9.13.1",
|
|
37
|
+
"@swc/helpers": "^0.5.1"
|
|
38
38
|
},
|
|
39
39
|
"peerDependencies": {
|
|
40
|
-
"@types/react": ">=16.
|
|
41
|
-
"@types/react-dom": ">=16.
|
|
42
|
-
"react": ">=16.
|
|
43
|
-
"react-dom": ">=16.
|
|
40
|
+
"@types/react": ">=16.14.0 <19.0.0",
|
|
41
|
+
"@types/react-dom": ">=16.14.0 <19.0.0",
|
|
42
|
+
"react": ">=16.14.0 <19.0.0",
|
|
43
|
+
"react-dom": ">=16.14.0 <19.0.0",
|
|
44
44
|
"scheduler": "^0.19.0 || ^0.20.0"
|
|
45
45
|
},
|
|
46
46
|
"beachball": {
|