@fluentui/react-context-selector 9.2.17 → 9.2.19
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 +21 -2
- package/dist/index.d.cts +51 -0
- package/lib/createContext.js +3 -3
- package/lib/index.js +3 -3
- package/lib/index.js.map +1 -1
- package/lib/useContextSelector.js +2 -2
- package/lib/useHasParentContext.js +1 -1
- package/lib-commonjs/{index.js → index.cjs} +3 -3
- package/package.json +14 -8
- /package/lib-commonjs/{createContext.js → createContext.cjs} +0 -0
- /package/lib-commonjs/{createContext.js.map → createContext.cjs.map} +0 -0
- /package/lib-commonjs/{index.js.map → index.cjs.map} +0 -0
- /package/lib-commonjs/{types.js → types.cjs} +0 -0
- /package/lib-commonjs/{types.js.map → types.cjs.map} +0 -0
- /package/lib-commonjs/{useContextSelector.js → useContextSelector.cjs} +0 -0
- /package/lib-commonjs/{useContextSelector.js.map → useContextSelector.cjs.map} +0 -0
- /package/lib-commonjs/{useHasParentContext.js → useHasParentContext.cjs} +0 -0
- /package/lib-commonjs/{useHasParentContext.js.map → useHasParentContext.cjs.map} +0 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,12 +1,31 @@
|
|
|
1
1
|
# Change Log - @fluentui/react-context-selector
|
|
2
2
|
|
|
3
|
-
This log was last generated on Tue,
|
|
3
|
+
<!-- This log was last generated on Tue, 11 Aug 2026 17:16:03 GMT and should not be manually modified. -->
|
|
4
4
|
|
|
5
5
|
<!-- Start content -->
|
|
6
6
|
|
|
7
|
+
## [9.2.19](https://github.com/microsoft/fluentui/tree/@fluentui/react-context-selector_v9.2.19)
|
|
8
|
+
|
|
9
|
+
Tue, 11 Aug 2026 17:16:03 GMT
|
|
10
|
+
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-context-selector_v9.2.18..@fluentui/react-context-selector_v9.2.19)
|
|
11
|
+
|
|
12
|
+
### Patches
|
|
13
|
+
|
|
14
|
+
- Ship ESM-first (type:module): valid ESM under lib/, CommonJS under lib-commonjs/*.cjs, and drop the `node` export condition - bare-Node `import` resolves ESM, `require` resolves CJS; node-targeted bundlers tree-shake. ([PR #36327](https://github.com/microsoft/fluentui/pull/36327) by martinhochel@microsoft.com)
|
|
15
|
+
- Bump @fluentui/react-utilities to v9.26.6 ([commit](https://github.com/microsoft/fluentui/commit/undefined) by beachball)
|
|
16
|
+
|
|
17
|
+
## [9.2.18](https://github.com/microsoft/fluentui/tree/@fluentui/react-context-selector_v9.2.18)
|
|
18
|
+
|
|
19
|
+
Wed, 24 Jun 2026 11:10:10 GMT
|
|
20
|
+
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-context-selector_v9.2.17..@fluentui/react-context-selector_v9.2.18)
|
|
21
|
+
|
|
22
|
+
### Patches
|
|
23
|
+
|
|
24
|
+
- Bump @fluentui/react-utilities to v9.26.5 ([commit](https://github.com/microsoft/fluentui/commit/a4b871ca80c1f16f35ab4229def4fe02be7f30ea) by beachball)
|
|
25
|
+
|
|
7
26
|
## [9.2.17](https://github.com/microsoft/fluentui/tree/@fluentui/react-context-selector_v9.2.17)
|
|
8
27
|
|
|
9
|
-
Tue, 26 May 2026 09:
|
|
28
|
+
Tue, 26 May 2026 09:39:54 GMT
|
|
10
29
|
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-context-selector_v9.2.16..@fluentui/react-context-selector_v9.2.17)
|
|
11
30
|
|
|
12
31
|
### Patches
|
package/dist/index.d.cts
ADDED
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import type * as React_2 from 'react';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* @internal
|
|
5
|
+
*/
|
|
6
|
+
export declare type Context<Value> = React_2.Context<Value> & {
|
|
7
|
+
Provider: React_2.FC<React_2.ProviderProps<Value>>;
|
|
8
|
+
Consumer: never;
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
export declare type ContextSelector<Value, SelectedValue> = (value: Value) => SelectedValue;
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* @internal
|
|
15
|
+
*/
|
|
16
|
+
export declare type ContextValue<Value> = {
|
|
17
|
+
/** Holds a set of subscribers from components. */
|
|
18
|
+
listeners: ((payload: Value) => void)[];
|
|
19
|
+
/** Holds an actual value of React's context that will be propagated down for computations. */
|
|
20
|
+
value: {
|
|
21
|
+
current: Value;
|
|
22
|
+
};
|
|
23
|
+
/** Indicates if a context holds default value. */
|
|
24
|
+
isDefault?: boolean;
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* @internal
|
|
29
|
+
*/
|
|
30
|
+
export declare const createContext: <Value>(defaultValue: Value) => Context<Value>;
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* This hook returns context selected value by selector.
|
|
34
|
+
* It will only accept context created by `createContext`.
|
|
35
|
+
* It will trigger re-render if only the selected value is referentially changed.
|
|
36
|
+
*
|
|
37
|
+
* @internal
|
|
38
|
+
*/
|
|
39
|
+
export declare const useContextSelector: <Value, SelectedValue>(context: Context<Value>, selectorFn: ContextSelector<Value, SelectedValue>) => SelectedValue;
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* Utility hook for contexts created by react-context-selector to determine if a parent context exists
|
|
43
|
+
* WARNING: This hook will not work for native React contexts
|
|
44
|
+
*
|
|
45
|
+
* @internal
|
|
46
|
+
* @param context - context created by react-context-selector
|
|
47
|
+
* @returns whether the hook is wrapped by a parent context
|
|
48
|
+
*/
|
|
49
|
+
export declare function useHasParentContext<Value>(context: Context<Value>): boolean;
|
|
50
|
+
|
|
51
|
+
export { }
|
package/lib/createContext.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use client';
|
|
2
|
-
import { useIsomorphicLayoutEffect } from
|
|
3
|
-
import * as React from
|
|
4
|
-
import { unstable_NormalPriority as NormalPriority, unstable_runWithPriority as runWithPriority } from
|
|
2
|
+
import { useIsomorphicLayoutEffect } from "@fluentui/react-utilities";
|
|
3
|
+
import * as React from "react";
|
|
4
|
+
import { unstable_NormalPriority as NormalPriority, unstable_runWithPriority as runWithPriority } from "scheduler";
|
|
5
5
|
const createProvider = (Original)=>{
|
|
6
6
|
const Provider = (props)=>{
|
|
7
7
|
// Holds an actual "props.value"
|
package/lib/index.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export { createContext } from
|
|
2
|
-
export { useContextSelector } from
|
|
3
|
-
export { useHasParentContext } from
|
|
1
|
+
export { createContext } from "./createContext.js";
|
|
2
|
+
export { useContextSelector } from "./useContextSelector.js";
|
|
3
|
+
export { useHasParentContext } from "./useHasParentContext.js";
|
package/lib/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts"],"sourcesContent":["export { createContext } from './createContext';\nexport { useContextSelector } from './useContextSelector';\nexport { useHasParentContext } from './useHasParentContext';\n// eslint-disable-next-line @fluentui/ban-context-export\nexport type { Context, ContextSelector, ContextValue } from './types';\n"],"names":["createContext","useContextSelector","useHasParentContext"],"mappings":"AAAA,SAASA,aAAa,QAAQ,
|
|
1
|
+
{"version":3,"sources":["../src/index.ts"],"sourcesContent":["export { createContext } from './createContext';\nexport { useContextSelector } from './useContextSelector';\nexport { useHasParentContext } from './useHasParentContext';\n// eslint-disable-next-line @fluentui/ban-context-export\nexport type { Context, ContextSelector, ContextValue } from './types';\n"],"names":["createContext","useContextSelector","useHasParentContext"],"mappings":"AAAA,SAASA,aAAa,QAAQ,qBAAkB;AAChD,SAASC,kBAAkB,QAAQ,0BAAuB;AAC1D,SAASC,mBAAmB,QAAQ,2BAAwB"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use client';
|
|
2
|
-
import { useIsomorphicLayoutEffect } from
|
|
3
|
-
import * as React from
|
|
2
|
+
import { useIsomorphicLayoutEffect } from "@fluentui/react-utilities";
|
|
3
|
+
import * as React from "react";
|
|
4
4
|
/**
|
|
5
5
|
* This hook returns context selected value by selector.
|
|
6
6
|
* It will only accept context created by `createContext`.
|
|
@@ -19,6 +19,6 @@ _export(exports, {
|
|
|
19
19
|
return _useHasParentContext.useHasParentContext;
|
|
20
20
|
}
|
|
21
21
|
});
|
|
22
|
-
const _createContext = require("./createContext");
|
|
23
|
-
const _useContextSelector = require("./useContextSelector");
|
|
24
|
-
const _useHasParentContext = require("./useHasParentContext");
|
|
22
|
+
const _createContext = require("./createContext.cjs");
|
|
23
|
+
const _useContextSelector = require("./useContextSelector.cjs");
|
|
24
|
+
const _useHasParentContext = require("./useHasParentContext.cjs");
|
package/package.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fluentui/react-context-selector",
|
|
3
|
-
"version": "9.2.
|
|
3
|
+
"version": "9.2.19",
|
|
4
4
|
"description": "React useContextSelector hook in userland",
|
|
5
|
-
"main": "lib-commonjs/index.
|
|
5
|
+
"main": "lib-commonjs/index.cjs",
|
|
6
6
|
"module": "lib/index.js",
|
|
7
7
|
"typings": "./dist/index.d.ts",
|
|
8
8
|
"sideEffects": false,
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
},
|
|
13
13
|
"license": "MIT",
|
|
14
14
|
"dependencies": {
|
|
15
|
-
"@fluentui/react-utilities": "^9.26.
|
|
15
|
+
"@fluentui/react-utilities": "^9.26.6",
|
|
16
16
|
"@swc/helpers": "^0.5.1"
|
|
17
17
|
},
|
|
18
18
|
"devDependencies": {
|
|
@@ -33,17 +33,23 @@
|
|
|
33
33
|
},
|
|
34
34
|
"exports": {
|
|
35
35
|
".": {
|
|
36
|
-
"
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
36
|
+
"import": {
|
|
37
|
+
"types": "./dist/index.d.ts",
|
|
38
|
+
"default": "./lib/index.js"
|
|
39
|
+
},
|
|
40
|
+
"require": {
|
|
41
|
+
"types": "./dist/index.d.cts",
|
|
42
|
+
"default": "./lib-commonjs/index.cjs"
|
|
43
|
+
}
|
|
40
44
|
},
|
|
41
45
|
"./package.json": "./package.json"
|
|
42
46
|
},
|
|
43
47
|
"files": [
|
|
44
48
|
"*.md",
|
|
45
49
|
"dist/*.d.ts",
|
|
50
|
+
"dist/*.d.cts",
|
|
46
51
|
"lib",
|
|
47
52
|
"lib-commonjs"
|
|
48
|
-
]
|
|
53
|
+
],
|
|
54
|
+
"type": "module"
|
|
49
55
|
}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|