@fluentui/react-utilities 9.8.0 → 9.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.json +71 -1
- package/CHANGELOG.md +24 -2
- package/dist/index.d.ts +36 -9
- package/lib/hooks/useControllableState.js +21 -32
- package/lib/hooks/useControllableState.js.map +1 -1
- package/lib/index.js +1 -1
- package/lib/index.js.map +1 -1
- package/lib/utils/index.js +1 -0
- package/lib/utils/index.js.map +1 -1
- package/lib/utils/priorityQueue.js +93 -0
- package/lib/utils/priorityQueue.js.map +1 -0
- package/lib-commonjs/hooks/useControllableState.js +16 -27
- package/lib-commonjs/hooks/useControllableState.js.map +1 -1
- package/lib-commonjs/index.js +1 -0
- package/lib-commonjs/index.js.map +1 -1
- package/lib-commonjs/utils/index.js +1 -0
- package/lib-commonjs/utils/index.js.map +1 -1
- package/lib-commonjs/utils/priorityQueue.js +102 -0
- package/lib-commonjs/utils/priorityQueue.js.map +1 -0
- package/package.json +4 -3
- package/.swcrc +0 -30
package/CHANGELOG.json
CHANGED
@@ -2,7 +2,77 @@
|
|
2
2
|
"name": "@fluentui/react-utilities",
|
3
3
|
"entries": [
|
4
4
|
{
|
5
|
-
"date": "
|
5
|
+
"date": "Thu, 18 May 2023 00:35:49 GMT",
|
6
|
+
"tag": "@fluentui/react-utilities_v9.9.0",
|
7
|
+
"version": "9.9.0",
|
8
|
+
"comments": {
|
9
|
+
"minor": [
|
10
|
+
{
|
11
|
+
"author": "lingfangao@hotmail.com",
|
12
|
+
"package": "@fluentui/react-utilities",
|
13
|
+
"commit": "bdc00a85606c5a225be1df2a24db1ccecbc65b64",
|
14
|
+
"comment": "feat: Implement a priority queue"
|
15
|
+
}
|
16
|
+
],
|
17
|
+
"none": [
|
18
|
+
{
|
19
|
+
"author": "olfedias@microsoft.com",
|
20
|
+
"package": "@fluentui/react-utilities",
|
21
|
+
"commit": "06cd515eda59a3078bfe32f9cc7c1f281cd20208",
|
22
|
+
"comment": "chore: add test-ssr script to v9 packages"
|
23
|
+
}
|
24
|
+
]
|
25
|
+
}
|
26
|
+
},
|
27
|
+
{
|
28
|
+
"date": "Fri, 12 May 2023 20:28:04 GMT",
|
29
|
+
"tag": "@fluentui/react-utilities_v9.8.1",
|
30
|
+
"version": "9.8.1",
|
31
|
+
"comments": {
|
32
|
+
"patch": [
|
33
|
+
{
|
34
|
+
"author": "bernardo.sunderhus@gmail.com",
|
35
|
+
"package": "@fluentui/react-utilities",
|
36
|
+
"commit": "88ff00c2979ecd025f725fa3fc4e4d370f95cfc4",
|
37
|
+
"comment": "feat: defers useControllableState state to initializer method"
|
38
|
+
},
|
39
|
+
{
|
40
|
+
"author": "bernardo.sunderhus@gmail.com",
|
41
|
+
"package": "@fluentui/react-utilities",
|
42
|
+
"commit": "f0b05741d812ad90c52754b0b4035d5554cf2aa0",
|
43
|
+
"comment": "chore: updates useControllableState comments"
|
44
|
+
},
|
45
|
+
{
|
46
|
+
"author": "olfedias@microsoft.com",
|
47
|
+
"package": "@fluentui/react-utilities",
|
48
|
+
"commit": "c28decb23d191a0daaaf6d5d1832429715102129",
|
49
|
+
"comment": "chore: exclude .swcrc from being published"
|
50
|
+
},
|
51
|
+
{
|
52
|
+
"author": "bernardo.sunderhus@gmail.com",
|
53
|
+
"package": "@fluentui/react-utilities",
|
54
|
+
"commit": "557ffca71ff7767a4d595b6fcc55ad4a1fe02360",
|
55
|
+
"comment": "chore: simplifies useControllableState hook internals"
|
56
|
+
},
|
57
|
+
{
|
58
|
+
"author": "beachball",
|
59
|
+
"package": "@fluentui/react-utilities",
|
60
|
+
"comment": "Bump @fluentui/keyboard-keys to v9.0.3",
|
61
|
+
"commit": "79c08ce5bbf6387b2b18ba4c3d2d5681e0177d4b"
|
62
|
+
}
|
63
|
+
],
|
64
|
+
"none": [
|
65
|
+
{
|
66
|
+
"author": "martinhochel@microsoft.com",
|
67
|
+
"package": "@fluentui/react-utilities",
|
68
|
+
"commit": "dbda7fa69e3000aaf8dd4a061e254ebd35198b8e",
|
69
|
+
"comment": "fix: update npmignore files to fix npm8/node16 regression how npm publish works"
|
70
|
+
}
|
71
|
+
]
|
72
|
+
}
|
73
|
+
},
|
74
|
+
{
|
75
|
+
"date": "Mon, 17 Apr 2023 17:54:02 GMT",
|
6
76
|
"tag": "@fluentui/react-utilities_v9.8.0",
|
7
77
|
"version": "9.8.0",
|
8
78
|
"comments": {
|
package/CHANGELOG.md
CHANGED
@@ -1,12 +1,34 @@
|
|
1
1
|
# Change Log - @fluentui/react-utilities
|
2
2
|
|
3
|
-
This log was last generated on
|
3
|
+
This log was last generated on Thu, 18 May 2023 00:35:49 GMT and should not be manually modified.
|
4
4
|
|
5
5
|
<!-- Start content -->
|
6
6
|
|
7
|
+
## [9.9.0](https://github.com/microsoft/fluentui/tree/@fluentui/react-utilities_v9.9.0)
|
8
|
+
|
9
|
+
Thu, 18 May 2023 00:35:49 GMT
|
10
|
+
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-utilities_v9.8.1..@fluentui/react-utilities_v9.9.0)
|
11
|
+
|
12
|
+
### Minor changes
|
13
|
+
|
14
|
+
- feat: Implement a priority queue ([PR #27848](https://github.com/microsoft/fluentui/pull/27848) by lingfangao@hotmail.com)
|
15
|
+
|
16
|
+
## [9.8.1](https://github.com/microsoft/fluentui/tree/@fluentui/react-utilities_v9.8.1)
|
17
|
+
|
18
|
+
Fri, 12 May 2023 20:28:04 GMT
|
19
|
+
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-utilities_v9.8.0..@fluentui/react-utilities_v9.8.1)
|
20
|
+
|
21
|
+
### Patches
|
22
|
+
|
23
|
+
- feat: defers useControllableState state to initializer method ([PR #27717](https://github.com/microsoft/fluentui/pull/27717) by bernardo.sunderhus@gmail.com)
|
24
|
+
- chore: updates useControllableState comments ([PR #27754](https://github.com/microsoft/fluentui/pull/27754) by bernardo.sunderhus@gmail.com)
|
25
|
+
- chore: exclude .swcrc from being published ([PR #27740](https://github.com/microsoft/fluentui/pull/27740) by olfedias@microsoft.com)
|
26
|
+
- chore: simplifies useControllableState hook internals ([PR #27702](https://github.com/microsoft/fluentui/pull/27702) by bernardo.sunderhus@gmail.com)
|
27
|
+
- Bump @fluentui/keyboard-keys to v9.0.3 ([PR #27827](https://github.com/microsoft/fluentui/pull/27827) by beachball)
|
28
|
+
|
7
29
|
## [9.8.0](https://github.com/microsoft/fluentui/tree/@fluentui/react-utilities_v9.8.0)
|
8
30
|
|
9
|
-
Mon, 17 Apr 2023 17:
|
31
|
+
Mon, 17 Apr 2023 17:54:02 GMT
|
10
32
|
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-utilities_v9.7.4..@fluentui/react-utilities_v9.8.0)
|
11
33
|
|
12
34
|
### Minor changes
|
package/dist/index.d.ts
CHANGED
@@ -51,6 +51,13 @@ export declare type ComponentState<Slots extends SlotPropsRecord> = {
|
|
51
51
|
[Key in keyof Slots]: ReplaceNullWithUndefined<Exclude<Slots[Key], SlotShorthandValue | (Key extends 'root' ? null : never)>>;
|
52
52
|
};
|
53
53
|
|
54
|
+
/**
|
55
|
+
* @internal
|
56
|
+
* @param compare - comparison function for items
|
57
|
+
* @returns Priority queue implemented with a min heap
|
58
|
+
*/
|
59
|
+
export declare function createPriorityQueue<T>(compare: PriorityQueueCompareFn<T>): PriorityQueue<T>;
|
60
|
+
|
54
61
|
/**
|
55
62
|
* HTML element types that are not allowed to have children.
|
56
63
|
*
|
@@ -356,6 +363,25 @@ declare type ObscureEventName = 'onLostPointerCaptureCapture';
|
|
356
363
|
*/
|
357
364
|
export declare function omit<TObj extends Record<string, any>, Exclusions extends (keyof TObj)[]>(obj: TObj, exclusions: Exclusions): Omit<TObj, Exclusions[number]>;
|
358
365
|
|
366
|
+
/**
|
367
|
+
* @internal
|
368
|
+
*/
|
369
|
+
export declare interface PriorityQueue<T> {
|
370
|
+
all: () => T[];
|
371
|
+
clear: () => void;
|
372
|
+
contains: (item: T) => boolean;
|
373
|
+
dequeue: () => T;
|
374
|
+
enqueue: (item: T) => void;
|
375
|
+
peek: () => T | null;
|
376
|
+
remove: (item: T) => void;
|
377
|
+
size: () => number;
|
378
|
+
}
|
379
|
+
|
380
|
+
/**
|
381
|
+
* @internal
|
382
|
+
*/
|
383
|
+
declare type PriorityQueueCompareFn<T> = (a: T, b: T) => number;
|
384
|
+
|
359
385
|
/**
|
360
386
|
* Removes the 'ref' prop from the given Props type, leaving unions intact (such as the discriminated union created by
|
361
387
|
* IntrinsicSlotProps). This allows IntrinsicSlotProps to be used with React.forwardRef.
|
@@ -515,18 +541,19 @@ export declare type UnknownSlotProps = Pick<React_2.HTMLAttributes<HTMLElement>,
|
|
515
541
|
/**
|
516
542
|
* @internal
|
517
543
|
*
|
518
|
-
* A `useState
|
544
|
+
* A [`useState`](https://reactjs.org/docs/hooks-reference.html#usestate)-like hook
|
545
|
+
* to manage a value that could be either `controlled` or `uncontrolled`,
|
519
546
|
* such as a checked state or text input string.
|
520
547
|
*
|
521
|
-
*
|
522
|
-
*
|
548
|
+
* @see https://react.dev/learn/sharing-state-between-components#controlled-and-uncontrolled-components for more details on `controlled`/`uncontrolled`
|
549
|
+
*
|
550
|
+
* @returns an array of the current value and an updater (dispatcher) function.
|
551
|
+
* The updater function is referentially stable (won't change during the component's lifecycle).
|
552
|
+
* It can take either a new value, or a function which is passed the previous value and returns the new value.
|
553
|
+
*
|
554
|
+
* ❗️❗️ Calls to the dispatcher will only modify the state if the state is `uncontrolled`.
|
555
|
+
* Meaning that if a state is `controlled`, calls to the dispatcher do not modify the state.
|
523
556
|
*
|
524
|
-
* @returns Same as [`useState`](https://reactjs.org/docs/hooks-reference.html#usestate): an array
|
525
|
-
* of the current value and an updater (dispatch) function. The updater function is referentially
|
526
|
-
* stable (won't change during the component's lifecycle). It can take either a new value, or a
|
527
|
-
* function which is passed the previous value and returns the new value. Unlike `setState`, calls
|
528
|
-
* to the updater function will only be respected if the component is uncontrolled.
|
529
|
-
* @see https://reactjs.org/docs/uncontrolled-components.html
|
530
557
|
*/
|
531
558
|
export declare const useControllableState: <State>(options: UseControllableStateOptions<State>) => [State, React_2.Dispatch<React_2.SetStateAction<State>>];
|
532
559
|
|
@@ -1,46 +1,35 @@
|
|
1
1
|
import * as React from 'react';
|
2
|
-
function isFactoryDispatch(newState) {
|
3
|
-
return typeof newState === 'function';
|
4
|
-
}
|
5
2
|
/**
|
6
3
|
* @internal
|
7
4
|
*
|
8
|
-
* A `useState
|
5
|
+
* A [`useState`](https://reactjs.org/docs/hooks-reference.html#usestate)-like hook
|
6
|
+
* to manage a value that could be either `controlled` or `uncontrolled`,
|
9
7
|
* such as a checked state or text input string.
|
10
8
|
*
|
11
|
-
*
|
12
|
-
*
|
9
|
+
* @see https://react.dev/learn/sharing-state-between-components#controlled-and-uncontrolled-components for more details on `controlled`/`uncontrolled`
|
10
|
+
*
|
11
|
+
* @returns an array of the current value and an updater (dispatcher) function.
|
12
|
+
* The updater function is referentially stable (won't change during the component's lifecycle).
|
13
|
+
* It can take either a new value, or a function which is passed the previous value and returns the new value.
|
14
|
+
*
|
15
|
+
* ❗️❗️ Calls to the dispatcher will only modify the state if the state is `uncontrolled`.
|
16
|
+
* Meaning that if a state is `controlled`, calls to the dispatcher do not modify the state.
|
13
17
|
*
|
14
|
-
* @returns Same as [`useState`](https://reactjs.org/docs/hooks-reference.html#usestate): an array
|
15
|
-
* of the current value and an updater (dispatch) function. The updater function is referentially
|
16
|
-
* stable (won't change during the component's lifecycle). It can take either a new value, or a
|
17
|
-
* function which is passed the previous value and returns the new value. Unlike `setState`, calls
|
18
|
-
* to the updater function will only be respected if the component is uncontrolled.
|
19
|
-
* @see https://reactjs.org/docs/uncontrolled-components.html
|
20
18
|
*/
|
21
19
|
export const useControllableState = options => {
|
22
|
-
const
|
23
|
-
|
24
|
-
|
25
|
-
const state = isControlled ? options.state : internalState;
|
26
|
-
const stateRef = React.useRef(state);
|
27
|
-
React.useEffect(() => {
|
28
|
-
stateRef.current = state;
|
29
|
-
}, [state]);
|
30
|
-
// To match the behavior of the setter returned by React.useState, this callback's identity
|
31
|
-
// should never change. This means it MUST NOT directly reference variables that can change.
|
32
|
-
const setState = React.useCallback(newState => {
|
33
|
-
// React dispatch can use a factory
|
34
|
-
// https://reactjs.org/docs/hooks-reference.html#functional-updates
|
35
|
-
if (isFactoryDispatch(newState)) {
|
36
|
-
stateRef.current = newState(stateRef.current);
|
37
|
-
} else {
|
38
|
-
stateRef.current = newState;
|
20
|
+
const [internalState, setInternalState] = React.useState(() => {
|
21
|
+
if (options.defaultState === undefined) {
|
22
|
+
return options.initialState;
|
39
23
|
}
|
40
|
-
|
41
|
-
}
|
42
|
-
return [state,
|
24
|
+
return isInitializer(options.defaultState) ? options.defaultState() : options.defaultState;
|
25
|
+
});
|
26
|
+
return useIsControlled(options.state) ? [options.state, noop] : [internalState, setInternalState];
|
43
27
|
};
|
28
|
+
function isInitializer(value) {
|
29
|
+
return typeof value === 'function';
|
30
|
+
}
|
31
|
+
function noop() {
|
32
|
+
/* noop */}
|
44
33
|
/**
|
45
34
|
* Helper hook to handle previous comparison of controlled/uncontrolled
|
46
35
|
* Prints an error when isControlled value switches between subsequent renders
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["React","
|
1
|
+
{"version":3,"names":["React","useControllableState","options","internalState","setInternalState","useState","defaultState","undefined","initialState","isInitializer","useIsControlled","state","noop","value","controlledValue","isControlled","process","env","NODE_ENV","useEffect","error","Error","controlWarning","undefinedWarning","console","stack","join"],"sources":["../../src/hooks/useControllableState.ts"],"sourcesContent":["import * as React from 'react';\n\n/**\n * @internal\n */\nexport type UseControllableStateOptions<State> = {\n /**\n * User-provided default state or initializer, for uncontrolled usage.\n */\n defaultState?: State | (() => State);\n /**\n * User-provided controlled state. `undefined` means internal state will be used.\n */\n state: State | undefined;\n /**\n * Used as the initial state if `state` and `defaultState` are both `undefined`.\n * If `undefined` is the correct initial state, pass that here.\n */\n initialState: State;\n};\n\n/**\n * @internal\n *\n * A [`useState`](https://reactjs.org/docs/hooks-reference.html#usestate)-like hook\n * to manage a value that could be either `controlled` or `uncontrolled`,\n * such as a checked state or text input string.\n *\n * @see https://react.dev/learn/sharing-state-between-components#controlled-and-uncontrolled-components for more details on `controlled`/`uncontrolled`\n *\n * @returns an array of the current value and an updater (dispatcher) function.\n * The updater function is referentially stable (won't change during the component's lifecycle).\n * It can take either a new value, or a function which is passed the previous value and returns the new value.\n *\n * ❗️❗️ Calls to the dispatcher will only modify the state if the state is `uncontrolled`.\n * Meaning that if a state is `controlled`, calls to the dispatcher do not modify the state.\n *\n */\nexport const useControllableState = <State>(\n options: UseControllableStateOptions<State>,\n): [State, React.Dispatch<React.SetStateAction<State>>] => {\n const [internalState, setInternalState] = React.useState<State>(() => {\n if (options.defaultState === undefined) {\n return options.initialState;\n }\n return isInitializer(options.defaultState) ? options.defaultState() : options.defaultState;\n });\n return useIsControlled(options.state) ? [options.state, noop] : [internalState, setInternalState];\n};\n\nfunction isInitializer<State>(value: State | (() => State)): value is () => State {\n return typeof value === 'function';\n}\n\nfunction noop() {\n /* noop */\n}\n\n/**\n * Helper hook to handle previous comparison of controlled/uncontrolled\n * Prints an error when isControlled value switches between subsequent renders\n * @returns - whether the value is controlled\n */\nconst useIsControlled = <V>(controlledValue: V | undefined): controlledValue is V => {\n const [isControlled] = React.useState<boolean>(() => controlledValue !== undefined);\n\n if (process.env.NODE_ENV !== 'production') {\n // We don't want these warnings in production even though it is against native behaviour\n // eslint-disable-next-line react-hooks/rules-of-hooks\n React.useEffect(() => {\n if (isControlled !== (controlledValue !== undefined)) {\n const error = new Error();\n\n const controlWarning = isControlled\n ? 'a controlled value to be uncontrolled'\n : 'an uncontrolled value to be controlled';\n\n const undefinedWarning = isControlled ? 'defined to an undefined' : 'undefined to a defined';\n\n // eslint-disable-next-line no-console\n console.error(\n [\n // Default react error\n 'A component is changing ' + controlWarning + '. This is likely caused by the value',\n 'changing from ' + undefinedWarning + ' value, which should not happen.',\n 'Decide between using a controlled or uncontrolled input element for the lifetime of the component.',\n 'More info: https://reactjs.org/link/controlled-components',\n error.stack,\n ].join(' '),\n );\n }\n }, [isControlled, controlledValue]);\n }\n\n return isControlled;\n};\n"],"mappings":"AAAA,YAAYA,KAAA,MAAW;AAqBvB;;;;;;;;;;;;;;;;;AAiBA,OAAO,MAAMC,oBAAA,GACXC,OAAA,IACyD;EACzD,MAAM,CAACC,aAAA,EAAeC,gBAAA,CAAiB,GAAGJ,KAAA,CAAMK,QAAQ,CAAQ,MAAM;IACpE,IAAIH,OAAA,CAAQI,YAAY,KAAKC,SAAA,EAAW;MACtC,OAAOL,OAAA,CAAQM,YAAY;IAC7B;IACA,OAAOC,aAAA,CAAcP,OAAA,CAAQI,YAAY,IAAIJ,OAAA,CAAQI,YAAY,KAAKJ,OAAA,CAAQI,YAAY;EAC5F;EACA,OAAOI,eAAA,CAAgBR,OAAA,CAAQS,KAAK,IAAI,CAACT,OAAA,CAAQS,KAAK,EAAEC,IAAA,CAAK,GAAG,CAACT,aAAA,EAAeC,gBAAA,CAAiB;AACnG;AAEA,SAASK,cAAqBI,KAA4B,EAAwB;EAChF,OAAO,OAAOA,KAAA,KAAU;AAC1B;AAEA,SAASD,KAAA,EAAO;EACd;AAGF;;;;;AAKA,MAAMF,eAAA,GAAsBI,eAAA,IAAyD;EACnF,MAAM,CAACC,YAAA,CAAa,GAAGf,KAAA,CAAMK,QAAQ,CAAU,MAAMS,eAAA,KAAoBP,SAAA;EAEzE,IAAIS,OAAA,CAAQC,GAAG,CAACC,QAAQ,KAAK,cAAc;IACzC;IACA;IACAlB,KAAA,CAAMmB,SAAS,CAAC,MAAM;MACpB,IAAIJ,YAAA,MAAkBD,eAAA,KAAoBP,SAAQ,GAAI;QACpD,MAAMa,KAAA,GAAQ,IAAIC,KAAA;QAElB,MAAMC,cAAA,GAAiBP,YAAA,GACnB,0CACA,wCAAwC;QAE5C,MAAMQ,gBAAA,GAAmBR,YAAA,GAAe,4BAA4B,wBAAwB;QAE5F;QACAS,OAAA,CAAQJ,KAAK,CACX;QACE;QACA,6BAA6BE,cAAA,GAAiB,wCAC9C,mBAAmBC,gBAAA,GAAmB,oCACtC,sGACA,6DACAH,KAAA,CAAMK,KAAK,CACZ,CAACC,IAAI,CAAC;MAEX;IACF,GAAG,CAACX,YAAA,EAAcD,eAAA,CAAgB;EACpC;EAEA,OAAOC,YAAA;AACT"}
|
package/lib/index.js
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
export { getSlots, getSlotsNext, resolveShorthand, isResolvedShorthand, SLOT_RENDER_FUNCTION_SYMBOL } from './compose/index';
|
2
2
|
export { IdPrefixProvider, resetIdsForTests, useControllableState, useEventCallback, useFirstMount, useForceUpdate, useId, useIsomorphicLayoutEffect, useMergedRefs, useOnClickOutside, useOnScrollOutside, usePrevious, useScrollbarWidth, useTimeout } from './hooks/index';
|
3
3
|
export { canUseDOM, useIsSSR, SSRProvider } from './ssr/index';
|
4
|
-
export { clamp, getNativeElementProps, getPartitionedNativeProps, getRTLSafeKey, mergeCallbacks, isHTMLElement, isInteractiveHTMLElement, omit } from './utils/index';
|
4
|
+
export { clamp, getNativeElementProps, getPartitionedNativeProps, getRTLSafeKey, mergeCallbacks, isHTMLElement, isInteractiveHTMLElement, omit, createPriorityQueue } from './utils/index';
|
5
5
|
export { applyTriggerPropsToChildren, getTriggerChild, isFluentTrigger } from './trigger/index';
|
6
6
|
export { isTouchEvent, isMouseEvent, getEventClientCoords } from './events/index';
|
7
7
|
//# sourceMappingURL=index.js.map
|
package/lib/index.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["getSlots","getSlotsNext","resolveShorthand","isResolvedShorthand","SLOT_RENDER_FUNCTION_SYMBOL","IdPrefixProvider","resetIdsForTests","useControllableState","useEventCallback","useFirstMount","useForceUpdate","useId","useIsomorphicLayoutEffect","useMergedRefs","useOnClickOutside","useOnScrollOutside","usePrevious","useScrollbarWidth","useTimeout","canUseDOM","useIsSSR","SSRProvider","clamp","getNativeElementProps","getPartitionedNativeProps","getRTLSafeKey","mergeCallbacks","isHTMLElement","isInteractiveHTMLElement","omit","applyTriggerPropsToChildren","getTriggerChild","isFluentTrigger","isTouchEvent","isMouseEvent","getEventClientCoords"],"sources":["../src/index.ts"],"sourcesContent":["export {\n getSlots,\n getSlotsNext,\n resolveShorthand,\n isResolvedShorthand,\n SLOT_RENDER_FUNCTION_SYMBOL,\n} from './compose/index';\nexport type {\n ExtractSlotProps,\n ComponentProps,\n ComponentState,\n ForwardRefComponent,\n ResolveShorthandFunction,\n ResolveShorthandOptions,\n Slot,\n Slots,\n SlotClassNames,\n SlotPropsRecord,\n SlotRenderFunction,\n SlotShorthandValue,\n UnknownSlotProps,\n} from './compose/index';\n\nexport {\n IdPrefixProvider,\n resetIdsForTests,\n useControllableState,\n useEventCallback,\n useFirstMount,\n useForceUpdate,\n useId,\n useIsomorphicLayoutEffect,\n useMergedRefs,\n useOnClickOutside,\n useOnScrollOutside,\n usePrevious,\n useScrollbarWidth,\n useTimeout,\n} from './hooks/index';\nexport type { RefObjectFunction, UseControllableStateOptions, UseOnClickOrScrollOutsideOptions } from './hooks/index';\n\nexport { canUseDOM, useIsSSR, SSRProvider } from './ssr/index';\n\nexport {\n clamp,\n getNativeElementProps,\n getPartitionedNativeProps,\n getRTLSafeKey,\n mergeCallbacks,\n isHTMLElement,\n isInteractiveHTMLElement,\n omit,\n} from './utils/index';\n\nexport { applyTriggerPropsToChildren, getTriggerChild, isFluentTrigger } from './trigger/index';\n\nexport type { FluentTriggerComponent, TriggerProps } from './trigger/index';\n\n/**\n * Event utils\n */\nexport type { NativeTouchOrMouseEvent, ReactTouchOrMouseEvent, TouchOrMouseEvent } from './events/index';\nexport { isTouchEvent, isMouseEvent, getEventClientCoords } from './events/index';\n"],"mappings":"AAAA,SACEA,QAAQ,EACRC,YAAY,EACZC,gBAAgB,EAChBC,mBAAmB,EACnBC,2BAA2B,QACtB;AAiBP,SACEC,gBAAgB,EAChBC,gBAAgB,EAChBC,oBAAoB,EACpBC,gBAAgB,EAChBC,aAAa,EACbC,cAAc,EACdC,KAAK,EACLC,yBAAyB,EACzBC,aAAa,EACbC,iBAAiB,EACjBC,kBAAkB,EAClBC,WAAW,EACXC,iBAAiB,EACjBC,UAAU,QACL;AAGP,SAASC,SAAS,EAAEC,QAAQ,EAAEC,WAAW,QAAQ;AAEjD,SACEC,KAAK,EACLC,qBAAqB,EACrBC,yBAAyB,EACzBC,aAAa,EACbC,cAAc,EACdC,aAAa,EACbC,wBAAwB,EACxBC,IAAI,
|
1
|
+
{"version":3,"names":["getSlots","getSlotsNext","resolveShorthand","isResolvedShorthand","SLOT_RENDER_FUNCTION_SYMBOL","IdPrefixProvider","resetIdsForTests","useControllableState","useEventCallback","useFirstMount","useForceUpdate","useId","useIsomorphicLayoutEffect","useMergedRefs","useOnClickOutside","useOnScrollOutside","usePrevious","useScrollbarWidth","useTimeout","canUseDOM","useIsSSR","SSRProvider","clamp","getNativeElementProps","getPartitionedNativeProps","getRTLSafeKey","mergeCallbacks","isHTMLElement","isInteractiveHTMLElement","omit","createPriorityQueue","applyTriggerPropsToChildren","getTriggerChild","isFluentTrigger","isTouchEvent","isMouseEvent","getEventClientCoords"],"sources":["../src/index.ts"],"sourcesContent":["export {\n getSlots,\n getSlotsNext,\n resolveShorthand,\n isResolvedShorthand,\n SLOT_RENDER_FUNCTION_SYMBOL,\n} from './compose/index';\nexport type {\n ExtractSlotProps,\n ComponentProps,\n ComponentState,\n ForwardRefComponent,\n ResolveShorthandFunction,\n ResolveShorthandOptions,\n Slot,\n Slots,\n SlotClassNames,\n SlotPropsRecord,\n SlotRenderFunction,\n SlotShorthandValue,\n UnknownSlotProps,\n} from './compose/index';\n\nexport {\n IdPrefixProvider,\n resetIdsForTests,\n useControllableState,\n useEventCallback,\n useFirstMount,\n useForceUpdate,\n useId,\n useIsomorphicLayoutEffect,\n useMergedRefs,\n useOnClickOutside,\n useOnScrollOutside,\n usePrevious,\n useScrollbarWidth,\n useTimeout,\n} from './hooks/index';\nexport type { RefObjectFunction, UseControllableStateOptions, UseOnClickOrScrollOutsideOptions } from './hooks/index';\n\nexport { canUseDOM, useIsSSR, SSRProvider } from './ssr/index';\n\nexport {\n clamp,\n getNativeElementProps,\n getPartitionedNativeProps,\n getRTLSafeKey,\n mergeCallbacks,\n isHTMLElement,\n isInteractiveHTMLElement,\n omit,\n createPriorityQueue,\n} from './utils/index';\n\nexport type { PriorityQueue } from './utils/priorityQueue';\n\nexport { applyTriggerPropsToChildren, getTriggerChild, isFluentTrigger } from './trigger/index';\n\nexport type { FluentTriggerComponent, TriggerProps } from './trigger/index';\n\n/**\n * Event utils\n */\nexport type { NativeTouchOrMouseEvent, ReactTouchOrMouseEvent, TouchOrMouseEvent } from './events/index';\nexport { isTouchEvent, isMouseEvent, getEventClientCoords } from './events/index';\n"],"mappings":"AAAA,SACEA,QAAQ,EACRC,YAAY,EACZC,gBAAgB,EAChBC,mBAAmB,EACnBC,2BAA2B,QACtB;AAiBP,SACEC,gBAAgB,EAChBC,gBAAgB,EAChBC,oBAAoB,EACpBC,gBAAgB,EAChBC,aAAa,EACbC,cAAc,EACdC,KAAK,EACLC,yBAAyB,EACzBC,aAAa,EACbC,iBAAiB,EACjBC,kBAAkB,EAClBC,WAAW,EACXC,iBAAiB,EACjBC,UAAU,QACL;AAGP,SAASC,SAAS,EAAEC,QAAQ,EAAEC,WAAW,QAAQ;AAEjD,SACEC,KAAK,EACLC,qBAAqB,EACrBC,yBAAyB,EACzBC,aAAa,EACbC,cAAc,EACdC,aAAa,EACbC,wBAAwB,EACxBC,IAAI,EACJC,mBAAmB,QACd;AAIP,SAASC,2BAA2B,EAAEC,eAAe,EAAEC,eAAe,QAAQ;AAQ9E,SAASC,YAAY,EAAEC,YAAY,EAAEC,oBAAoB,QAAQ"}
|
package/lib/utils/index.js
CHANGED
package/lib/utils/index.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":[],"sources":["../../src/utils/index.ts"],"sourcesContent":["export * from './clamp';\nexport * from './getNativeElementProps';\nexport * from './getRTLSafeKey';\nexport * from './mergeCallbacks';\nexport * from './omit';\nexport * from './properties';\nexport * from './isHTMLElement';\nexport * from './isInteractiveHTMLElement';\n"],"mappings":"AAAA,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc"}
|
1
|
+
{"version":3,"names":[],"sources":["../../src/utils/index.ts"],"sourcesContent":["export * from './clamp';\nexport * from './getNativeElementProps';\nexport * from './getRTLSafeKey';\nexport * from './mergeCallbacks';\nexport * from './omit';\nexport * from './properties';\nexport * from './isHTMLElement';\nexport * from './isInteractiveHTMLElement';\nexport * from './priorityQueue';\n"],"mappings":"AAAA,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc"}
|
@@ -0,0 +1,93 @@
|
|
1
|
+
/**
|
2
|
+
* @internal
|
3
|
+
*/ /**
|
4
|
+
* @internal
|
5
|
+
* @param compare - comparison function for items
|
6
|
+
* @returns Priority queue implemented with a min heap
|
7
|
+
*/export function createPriorityQueue(compare) {
|
8
|
+
const arr = [];
|
9
|
+
let size = 0;
|
10
|
+
const swap = (a, b) => {
|
11
|
+
const tmp = arr[a];
|
12
|
+
arr[a] = arr[b];
|
13
|
+
arr[b] = tmp;
|
14
|
+
};
|
15
|
+
const heapify = i => {
|
16
|
+
let smallest = i;
|
17
|
+
const l = left(i);
|
18
|
+
const r = right(i);
|
19
|
+
if (l < size && compare(arr[l], arr[smallest]) < 0) {
|
20
|
+
smallest = l;
|
21
|
+
}
|
22
|
+
if (r < size && compare(arr[r], arr[smallest]) < 0) {
|
23
|
+
smallest = r;
|
24
|
+
}
|
25
|
+
if (smallest !== i) {
|
26
|
+
swap(smallest, i);
|
27
|
+
heapify(smallest);
|
28
|
+
}
|
29
|
+
};
|
30
|
+
const dequeue = () => {
|
31
|
+
if (size === 0) {
|
32
|
+
throw new Error('Priority queue empty');
|
33
|
+
}
|
34
|
+
const res = arr[0];
|
35
|
+
arr[0] = arr[--size];
|
36
|
+
heapify(0);
|
37
|
+
return res;
|
38
|
+
};
|
39
|
+
const peek = () => {
|
40
|
+
if (size === 0) {
|
41
|
+
return null;
|
42
|
+
}
|
43
|
+
return arr[0];
|
44
|
+
};
|
45
|
+
const enqueue = item => {
|
46
|
+
arr[size++] = item;
|
47
|
+
let i = size - 1;
|
48
|
+
let p = parent(i);
|
49
|
+
while (i > 0 && compare(arr[p], arr[i]) > 0) {
|
50
|
+
swap(p, i);
|
51
|
+
i = p;
|
52
|
+
p = parent(i);
|
53
|
+
}
|
54
|
+
};
|
55
|
+
const contains = item => {
|
56
|
+
const index = arr.indexOf(item);
|
57
|
+
return index >= 0 && index < size;
|
58
|
+
};
|
59
|
+
const remove = item => {
|
60
|
+
const i = arr.indexOf(item);
|
61
|
+
if (i === -1 || i >= size) {
|
62
|
+
return;
|
63
|
+
}
|
64
|
+
arr[i] = arr[--size];
|
65
|
+
heapify(i);
|
66
|
+
};
|
67
|
+
const clear = () => {
|
68
|
+
size = 0;
|
69
|
+
};
|
70
|
+
const all = () => {
|
71
|
+
return arr.slice(0, size);
|
72
|
+
};
|
73
|
+
return {
|
74
|
+
all,
|
75
|
+
clear,
|
76
|
+
contains,
|
77
|
+
dequeue,
|
78
|
+
enqueue,
|
79
|
+
peek,
|
80
|
+
remove,
|
81
|
+
size: () => size
|
82
|
+
};
|
83
|
+
}
|
84
|
+
const left = i => {
|
85
|
+
return 2 * i + 1;
|
86
|
+
};
|
87
|
+
const right = i => {
|
88
|
+
return 2 * i + 2;
|
89
|
+
};
|
90
|
+
const parent = i => {
|
91
|
+
return Math.floor((i - 1) / 2);
|
92
|
+
};
|
93
|
+
//# sourceMappingURL=priorityQueue.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"names":["createPriorityQueue","compare","arr","size","swap","a","b","tmp","heapify","i","smallest","l","left","r","right","dequeue","Error","res","peek","enqueue","item","p","parent","contains","index","indexOf","remove","clear","all","slice","Math","floor"],"sources":["../../src/utils/priorityQueue.ts"],"sourcesContent":["/**\n * @internal\n */\nexport type PriorityQueueCompareFn<T> = (a: T, b: T) => number;\n\n/**\n * @internal\n */\nexport interface PriorityQueue<T> {\n all: () => T[];\n clear: () => void;\n contains: (item: T) => boolean;\n dequeue: () => T;\n enqueue: (item: T) => void;\n peek: () => T | null;\n remove: (item: T) => void;\n size: () => number;\n}\n\n/**\n * @internal\n * @param compare - comparison function for items\n * @returns Priority queue implemented with a min heap\n */\nexport function createPriorityQueue<T>(compare: PriorityQueueCompareFn<T>): PriorityQueue<T> {\n const arr: T[] = [];\n let size = 0;\n\n const swap = (a: number, b: number) => {\n const tmp = arr[a];\n arr[a] = arr[b];\n arr[b] = tmp;\n };\n\n const heapify = (i: number) => {\n let smallest = i;\n const l = left(i);\n const r = right(i);\n\n if (l < size && compare(arr[l], arr[smallest]) < 0) {\n smallest = l;\n }\n\n if (r < size && compare(arr[r], arr[smallest]) < 0) {\n smallest = r;\n }\n\n if (smallest !== i) {\n swap(smallest, i);\n heapify(smallest);\n }\n };\n\n const dequeue = () => {\n if (size === 0) {\n throw new Error('Priority queue empty');\n }\n\n const res = arr[0];\n arr[0] = arr[--size];\n heapify(0);\n\n return res;\n };\n\n const peek = () => {\n if (size === 0) {\n return null;\n }\n\n return arr[0];\n };\n\n const enqueue = (item: T) => {\n arr[size++] = item;\n let i = size - 1;\n let p = parent(i);\n while (i > 0 && compare(arr[p], arr[i]) > 0) {\n swap(p, i);\n i = p;\n p = parent(i);\n }\n };\n\n const contains = (item: T) => {\n const index = arr.indexOf(item);\n return index >= 0 && index < size;\n };\n\n const remove = (item: T) => {\n const i = arr.indexOf(item);\n\n if (i === -1 || i >= size) {\n return;\n }\n\n arr[i] = arr[--size];\n heapify(i);\n };\n\n const clear = () => {\n size = 0;\n };\n\n const all = () => {\n return arr.slice(0, size);\n };\n\n return {\n all,\n clear,\n contains,\n dequeue,\n enqueue,\n peek,\n remove,\n size: () => size,\n };\n}\n\nconst left = (i: number) => {\n return 2 * i + 1;\n};\n\nconst right = (i: number) => {\n return 2 * i + 2;\n};\n\nconst parent = (i: number) => {\n return Math.floor((i - 1) / 2);\n};\n"],"mappings":"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"}
|
@@ -8,37 +8,26 @@ Object.defineProperty(exports, "useControllableState", {
|
|
8
8
|
});
|
9
9
|
const _interopRequireWildcard = require("@swc/helpers/lib/_interop_require_wildcard.js").default;
|
10
10
|
const _react = /*#__PURE__*/ _interopRequireWildcard(require("react"));
|
11
|
-
function isFactoryDispatch(newState) {
|
12
|
-
return typeof newState === 'function';
|
13
|
-
}
|
14
11
|
const useControllableState = (options)=>{
|
15
|
-
const
|
16
|
-
|
17
|
-
|
18
|
-
const state = isControlled ? options.state : internalState;
|
19
|
-
const stateRef = _react.useRef(state);
|
20
|
-
_react.useEffect(()=>{
|
21
|
-
stateRef.current = state;
|
22
|
-
}, [
|
23
|
-
state
|
24
|
-
]);
|
25
|
-
// To match the behavior of the setter returned by React.useState, this callback's identity
|
26
|
-
// should never change. This means it MUST NOT directly reference variables that can change.
|
27
|
-
const setState = _react.useCallback((newState)=>{
|
28
|
-
// React dispatch can use a factory
|
29
|
-
// https://reactjs.org/docs/hooks-reference.html#functional-updates
|
30
|
-
if (isFactoryDispatch(newState)) {
|
31
|
-
stateRef.current = newState(stateRef.current);
|
32
|
-
} else {
|
33
|
-
stateRef.current = newState;
|
12
|
+
const [internalState, setInternalState] = _react.useState(()=>{
|
13
|
+
if (options.defaultState === undefined) {
|
14
|
+
return options.initialState;
|
34
15
|
}
|
35
|
-
|
36
|
-
}
|
37
|
-
return [
|
38
|
-
state,
|
39
|
-
|
16
|
+
return isInitializer(options.defaultState) ? options.defaultState() : options.defaultState;
|
17
|
+
});
|
18
|
+
return useIsControlled(options.state) ? [
|
19
|
+
options.state,
|
20
|
+
noop
|
21
|
+
] : [
|
22
|
+
internalState,
|
23
|
+
setInternalState
|
40
24
|
];
|
41
25
|
};
|
26
|
+
function isInitializer(value) {
|
27
|
+
return typeof value === 'function';
|
28
|
+
}
|
29
|
+
function noop() {
|
30
|
+
/* noop */ }
|
42
31
|
/**
|
43
32
|
* Helper hook to handle previous comparison of controlled/uncontrolled
|
44
33
|
* Prints an error when isControlled value switches between subsequent renders
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["../../lib/hooks/useControllableState.js"],"sourcesContent":["import * as React from 'react';\
|
1
|
+
{"version":3,"sources":["../../lib/hooks/useControllableState.js"],"sourcesContent":["import * as React from 'react';\n/**\n * @internal\n *\n * A [`useState`](https://reactjs.org/docs/hooks-reference.html#usestate)-like hook\n * to manage a value that could be either `controlled` or `uncontrolled`,\n * such as a checked state or text input string.\n *\n * @see https://react.dev/learn/sharing-state-between-components#controlled-and-uncontrolled-components for more details on `controlled`/`uncontrolled`\n *\n * @returns an array of the current value and an updater (dispatcher) function.\n * The updater function is referentially stable (won't change during the component's lifecycle).\n * It can take either a new value, or a function which is passed the previous value and returns the new value.\n *\n * ❗️❗️ Calls to the dispatcher will only modify the state if the state is `uncontrolled`.\n * Meaning that if a state is `controlled`, calls to the dispatcher do not modify the state.\n *\n */\nexport const useControllableState = options => {\n const [internalState, setInternalState] = React.useState(() => {\n if (options.defaultState === undefined) {\n return options.initialState;\n }\n return isInitializer(options.defaultState) ? options.defaultState() : options.defaultState;\n });\n return useIsControlled(options.state) ? [options.state, noop] : [internalState, setInternalState];\n};\nfunction isInitializer(value) {\n return typeof value === 'function';\n}\nfunction noop() {\n /* noop */}\n/**\n * Helper hook to handle previous comparison of controlled/uncontrolled\n * Prints an error when isControlled value switches between subsequent renders\n * @returns - whether the value is controlled\n */\nconst useIsControlled = controlledValue => {\n const [isControlled] = React.useState(() => controlledValue !== undefined);\n if (process.env.NODE_ENV !== 'production') {\n // We don't want these warnings in production even though it is against native behaviour\n // eslint-disable-next-line react-hooks/rules-of-hooks\n React.useEffect(() => {\n if (isControlled !== (controlledValue !== undefined)) {\n const error = new Error();\n const controlWarning = isControlled ? 'a controlled value to be uncontrolled' : 'an uncontrolled value to be controlled';\n const undefinedWarning = isControlled ? 'defined to an undefined' : 'undefined to a defined';\n // eslint-disable-next-line no-console\n console.error([\n // Default react error\n 'A component is changing ' + controlWarning + '. This is likely caused by the value', 'changing from ' + undefinedWarning + ' value, which should not happen.', 'Decide between using a controlled or uncontrolled input element for the lifetime of the component.', 'More info: https://reactjs.org/link/controlled-components', error.stack].join(' '));\n }\n }, [isControlled, controlledValue]);\n }\n return isControlled;\n};\n//# sourceMappingURL=useControllableState.js.map"],"names":["useControllableState","options","internalState","setInternalState","React","useState","defaultState","undefined","initialState","isInitializer","useIsControlled","state","noop","value","controlledValue","isControlled","process","env","NODE_ENV","useEffect","error","Error","controlWarning","undefinedWarning","console","stack","join"],"mappings":";;;;+BAkBaA;;aAAAA;;;6DAlBU;AAkBhB,MAAMA,uBAAuBC,CAAAA,UAAW;IAC7C,MAAM,CAACC,eAAeC,iBAAiB,GAAGC,OAAMC,QAAQ,CAAC,IAAM;QAC7D,IAAIJ,QAAQK,YAAY,KAAKC,WAAW;YACtC,OAAON,QAAQO,YAAY;QAC7B,CAAC;QACD,OAAOC,cAAcR,QAAQK,YAAY,IAAIL,QAAQK,YAAY,KAAKL,QAAQK,YAAY;IAC5F;IACA,OAAOI,gBAAgBT,QAAQU,KAAK,IAAI;QAACV,QAAQU,KAAK;QAAEC;KAAK,GAAG;QAACV;QAAeC;KAAiB;AACnG;AACA,SAASM,cAAcI,KAAK,EAAE;IAC5B,OAAO,OAAOA,UAAU;AAC1B;AACA,SAASD,OAAO;AACd,QAAQ,GAAE;AACZ;;;;CAIC,GACD,MAAMF,kBAAkBI,CAAAA,kBAAmB;IACzC,MAAM,CAACC,aAAa,GAAGX,OAAMC,QAAQ,CAAC,IAAMS,oBAAoBP;IAChE,IAAIS,QAAQC,GAAG,CAACC,QAAQ,KAAK,cAAc;QACzC,wFAAwF;QACxF,sDAAsD;QACtDd,OAAMe,SAAS,CAAC,IAAM;YACpB,IAAIJ,iBAAkBD,CAAAA,oBAAoBP,SAAQ,GAAI;gBACpD,MAAMa,QAAQ,IAAIC;gBAClB,MAAMC,iBAAiBP,eAAe,0CAA0C,wCAAwC;gBACxH,MAAMQ,mBAAmBR,eAAe,4BAA4B,wBAAwB;gBAC5F,sCAAsC;gBACtCS,QAAQJ,KAAK,CAAC;oBACd,sBAAsB;oBACtB,6BAA6BE,iBAAiB;oBAAwC,mBAAmBC,mBAAmB;oBAAoC;oBAAsG;oBAA6DH,MAAMK,KAAK;iBAAC,CAACC,IAAI,CAAC;YACvV,CAAC;QACH,GAAG;YAACX;YAAcD;SAAgB;IACpC,CAAC;IACD,OAAOC;AACT,GACA,gDAAgD"}
|
package/lib-commonjs/index.js
CHANGED
@@ -39,6 +39,7 @@ _export(exports, {
|
|
39
39
|
isHTMLElement: ()=>_index3.isHTMLElement,
|
40
40
|
isInteractiveHTMLElement: ()=>_index3.isInteractiveHTMLElement,
|
41
41
|
omit: ()=>_index3.omit,
|
42
|
+
createPriorityQueue: ()=>_index3.createPriorityQueue,
|
42
43
|
applyTriggerPropsToChildren: ()=>_index4.applyTriggerPropsToChildren,
|
43
44
|
getTriggerChild: ()=>_index4.getTriggerChild,
|
44
45
|
isFluentTrigger: ()=>_index4.isFluentTrigger,
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["../lib/index.js"],"sourcesContent":["export { getSlots, getSlotsNext, resolveShorthand, isResolvedShorthand, SLOT_RENDER_FUNCTION_SYMBOL } from './compose/index';\nexport { IdPrefixProvider, resetIdsForTests, useControllableState, useEventCallback, useFirstMount, useForceUpdate, useId, useIsomorphicLayoutEffect, useMergedRefs, useOnClickOutside, useOnScrollOutside, usePrevious, useScrollbarWidth, useTimeout } from './hooks/index';\nexport { canUseDOM, useIsSSR, SSRProvider } from './ssr/index';\nexport { clamp, getNativeElementProps, getPartitionedNativeProps, getRTLSafeKey, mergeCallbacks, isHTMLElement, isInteractiveHTMLElement, omit } from './utils/index';\nexport { applyTriggerPropsToChildren, getTriggerChild, isFluentTrigger } from './trigger/index';\nexport { isTouchEvent, isMouseEvent, getEventClientCoords } from './events/index';\n//# sourceMappingURL=index.js.map"],"names":["getSlots","getSlotsNext","resolveShorthand","isResolvedShorthand","SLOT_RENDER_FUNCTION_SYMBOL","IdPrefixProvider","resetIdsForTests","useControllableState","useEventCallback","useFirstMount","useForceUpdate","useId","useIsomorphicLayoutEffect","useMergedRefs","useOnClickOutside","useOnScrollOutside","usePrevious","useScrollbarWidth","useTimeout","canUseDOM","useIsSSR","SSRProvider","clamp","getNativeElementProps","getPartitionedNativeProps","getRTLSafeKey","mergeCallbacks","isHTMLElement","isInteractiveHTMLElement","omit","applyTriggerPropsToChildren","getTriggerChild","isFluentTrigger","isTouchEvent","isMouseEvent","getEventClientCoords"],"mappings":";;;;;;;;;;;IAASA,QAAQ,MAARA,eAAQ;IAAEC,YAAY,MAAZA,mBAAY;IAAEC,gBAAgB,MAAhBA,uBAAgB;IAAEC,mBAAmB,MAAnBA,0BAAmB;IAAEC,2BAA2B,MAA3BA,kCAA2B;IAC1FC,gBAAgB,MAAhBA,wBAAgB;IAAEC,gBAAgB,MAAhBA,wBAAgB;IAAEC,oBAAoB,MAApBA,4BAAoB;IAAEC,gBAAgB,MAAhBA,wBAAgB;IAAEC,aAAa,MAAbA,qBAAa;IAAEC,cAAc,MAAdA,sBAAc;IAAEC,KAAK,MAALA,aAAK;IAAEC,yBAAyB,MAAzBA,iCAAyB;IAAEC,aAAa,MAAbA,qBAAa;IAAEC,iBAAiB,MAAjBA,yBAAiB;IAAEC,kBAAkB,MAAlBA,0BAAkB;IAAEC,WAAW,MAAXA,mBAAW;IAAEC,iBAAiB,MAAjBA,yBAAiB;IAAEC,UAAU,MAAVA,kBAAU;IAC7OC,SAAS,MAATA,iBAAS;IAAEC,QAAQ,MAARA,gBAAQ;IAAEC,WAAW,MAAXA,mBAAW;IAChCC,KAAK,MAALA,aAAK;IAAEC,qBAAqB,MAArBA,6BAAqB;IAAEC,yBAAyB,MAAzBA,iCAAyB;IAAEC,aAAa,MAAbA,qBAAa;IAAEC,cAAc,MAAdA,sBAAc;IAAEC,aAAa,MAAbA,qBAAa;IAAEC,wBAAwB,MAAxBA,gCAAwB;IAAEC,IAAI,MAAJA,YAAI;
|
1
|
+
{"version":3,"sources":["../lib/index.js"],"sourcesContent":["export { getSlots, getSlotsNext, resolveShorthand, isResolvedShorthand, SLOT_RENDER_FUNCTION_SYMBOL } from './compose/index';\nexport { IdPrefixProvider, resetIdsForTests, useControllableState, useEventCallback, useFirstMount, useForceUpdate, useId, useIsomorphicLayoutEffect, useMergedRefs, useOnClickOutside, useOnScrollOutside, usePrevious, useScrollbarWidth, useTimeout } from './hooks/index';\nexport { canUseDOM, useIsSSR, SSRProvider } from './ssr/index';\nexport { clamp, getNativeElementProps, getPartitionedNativeProps, getRTLSafeKey, mergeCallbacks, isHTMLElement, isInteractiveHTMLElement, omit, createPriorityQueue } from './utils/index';\nexport { applyTriggerPropsToChildren, getTriggerChild, isFluentTrigger } from './trigger/index';\nexport { isTouchEvent, isMouseEvent, getEventClientCoords } from './events/index';\n//# sourceMappingURL=index.js.map"],"names":["getSlots","getSlotsNext","resolveShorthand","isResolvedShorthand","SLOT_RENDER_FUNCTION_SYMBOL","IdPrefixProvider","resetIdsForTests","useControllableState","useEventCallback","useFirstMount","useForceUpdate","useId","useIsomorphicLayoutEffect","useMergedRefs","useOnClickOutside","useOnScrollOutside","usePrevious","useScrollbarWidth","useTimeout","canUseDOM","useIsSSR","SSRProvider","clamp","getNativeElementProps","getPartitionedNativeProps","getRTLSafeKey","mergeCallbacks","isHTMLElement","isInteractiveHTMLElement","omit","createPriorityQueue","applyTriggerPropsToChildren","getTriggerChild","isFluentTrigger","isTouchEvent","isMouseEvent","getEventClientCoords"],"mappings":";;;;;;;;;;;IAASA,QAAQ,MAARA,eAAQ;IAAEC,YAAY,MAAZA,mBAAY;IAAEC,gBAAgB,MAAhBA,uBAAgB;IAAEC,mBAAmB,MAAnBA,0BAAmB;IAAEC,2BAA2B,MAA3BA,kCAA2B;IAC1FC,gBAAgB,MAAhBA,wBAAgB;IAAEC,gBAAgB,MAAhBA,wBAAgB;IAAEC,oBAAoB,MAApBA,4BAAoB;IAAEC,gBAAgB,MAAhBA,wBAAgB;IAAEC,aAAa,MAAbA,qBAAa;IAAEC,cAAc,MAAdA,sBAAc;IAAEC,KAAK,MAALA,aAAK;IAAEC,yBAAyB,MAAzBA,iCAAyB;IAAEC,aAAa,MAAbA,qBAAa;IAAEC,iBAAiB,MAAjBA,yBAAiB;IAAEC,kBAAkB,MAAlBA,0BAAkB;IAAEC,WAAW,MAAXA,mBAAW;IAAEC,iBAAiB,MAAjBA,yBAAiB;IAAEC,UAAU,MAAVA,kBAAU;IAC7OC,SAAS,MAATA,iBAAS;IAAEC,QAAQ,MAARA,gBAAQ;IAAEC,WAAW,MAAXA,mBAAW;IAChCC,KAAK,MAALA,aAAK;IAAEC,qBAAqB,MAArBA,6BAAqB;IAAEC,yBAAyB,MAAzBA,iCAAyB;IAAEC,aAAa,MAAbA,qBAAa;IAAEC,cAAc,MAAdA,sBAAc;IAAEC,aAAa,MAAbA,qBAAa;IAAEC,wBAAwB,MAAxBA,gCAAwB;IAAEC,IAAI,MAAJA,YAAI;IAAEC,mBAAmB,MAAnBA,2BAAmB;IAC1JC,2BAA2B,MAA3BA,mCAA2B;IAAEC,eAAe,MAAfA,uBAAe;IAAEC,eAAe,MAAfA,uBAAe;IAC7DC,YAAY,MAAZA,oBAAY;IAAEC,YAAY,MAAZA,oBAAY;IAAEC,oBAAoB,MAApBA,4BAAoB;;uBALkD;wBACmJ;wBAC7M;wBAC0H;wBAC7F;wBACb;CACjE,iCAAiC"}
|
@@ -11,6 +11,7 @@ _exportStar(require("./omit"), exports);
|
|
11
11
|
_exportStar(require("./properties"), exports);
|
12
12
|
_exportStar(require("./isHTMLElement"), exports);
|
13
13
|
_exportStar(require("./isInteractiveHTMLElement"), exports);
|
14
|
+
_exportStar(require("./priorityQueue"), exports);
|
14
15
|
//# sourceMappingURL=index.js.map
|
15
16
|
|
16
17
|
//# sourceMappingURL=index.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["../../lib/utils/index.js"],"sourcesContent":["export * from './clamp';\nexport * from './getNativeElementProps';\nexport * from './getRTLSafeKey';\nexport * from './mergeCallbacks';\nexport * from './omit';\nexport * from './properties';\nexport * from './isHTMLElement';\nexport * from './isInteractiveHTMLElement';\n//# sourceMappingURL=index.js.map"],"names":[],"mappings":";;;;;oBAAc;oBACA;oBACA;oBACA;oBACA;oBACA;oBACA;oBACA;CACd,iCAAiC"}
|
1
|
+
{"version":3,"sources":["../../lib/utils/index.js"],"sourcesContent":["export * from './clamp';\nexport * from './getNativeElementProps';\nexport * from './getRTLSafeKey';\nexport * from './mergeCallbacks';\nexport * from './omit';\nexport * from './properties';\nexport * from './isHTMLElement';\nexport * from './isInteractiveHTMLElement';\nexport * from './priorityQueue';\n//# sourceMappingURL=index.js.map"],"names":[],"mappings":";;;;;oBAAc;oBACA;oBACA;oBACA;oBACA;oBACA;oBACA;oBACA;oBACA;CACd,iCAAiC"}
|
@@ -0,0 +1,102 @@
|
|
1
|
+
/**
|
2
|
+
* @internal
|
3
|
+
*/ /**
|
4
|
+
* @internal
|
5
|
+
* @param compare - comparison function for items
|
6
|
+
* @returns Priority queue implemented with a min heap
|
7
|
+
*/ "use strict";
|
8
|
+
Object.defineProperty(exports, "__esModule", {
|
9
|
+
value: true
|
10
|
+
});
|
11
|
+
Object.defineProperty(exports, "createPriorityQueue", {
|
12
|
+
enumerable: true,
|
13
|
+
get: ()=>createPriorityQueue
|
14
|
+
});
|
15
|
+
function createPriorityQueue(compare) {
|
16
|
+
const arr = [];
|
17
|
+
let size = 0;
|
18
|
+
const swap = (a, b)=>{
|
19
|
+
const tmp = arr[a];
|
20
|
+
arr[a] = arr[b];
|
21
|
+
arr[b] = tmp;
|
22
|
+
};
|
23
|
+
const heapify = (i)=>{
|
24
|
+
let smallest = i;
|
25
|
+
const l = left(i);
|
26
|
+
const r = right(i);
|
27
|
+
if (l < size && compare(arr[l], arr[smallest]) < 0) {
|
28
|
+
smallest = l;
|
29
|
+
}
|
30
|
+
if (r < size && compare(arr[r], arr[smallest]) < 0) {
|
31
|
+
smallest = r;
|
32
|
+
}
|
33
|
+
if (smallest !== i) {
|
34
|
+
swap(smallest, i);
|
35
|
+
heapify(smallest);
|
36
|
+
}
|
37
|
+
};
|
38
|
+
const dequeue = ()=>{
|
39
|
+
if (size === 0) {
|
40
|
+
throw new Error('Priority queue empty');
|
41
|
+
}
|
42
|
+
const res = arr[0];
|
43
|
+
arr[0] = arr[--size];
|
44
|
+
heapify(0);
|
45
|
+
return res;
|
46
|
+
};
|
47
|
+
const peek = ()=>{
|
48
|
+
if (size === 0) {
|
49
|
+
return null;
|
50
|
+
}
|
51
|
+
return arr[0];
|
52
|
+
};
|
53
|
+
const enqueue = (item)=>{
|
54
|
+
arr[size++] = item;
|
55
|
+
let i = size - 1;
|
56
|
+
let p = parent(i);
|
57
|
+
while(i > 0 && compare(arr[p], arr[i]) > 0){
|
58
|
+
swap(p, i);
|
59
|
+
i = p;
|
60
|
+
p = parent(i);
|
61
|
+
}
|
62
|
+
};
|
63
|
+
const contains = (item)=>{
|
64
|
+
const index = arr.indexOf(item);
|
65
|
+
return index >= 0 && index < size;
|
66
|
+
};
|
67
|
+
const remove = (item)=>{
|
68
|
+
const i = arr.indexOf(item);
|
69
|
+
if (i === -1 || i >= size) {
|
70
|
+
return;
|
71
|
+
}
|
72
|
+
arr[i] = arr[--size];
|
73
|
+
heapify(i);
|
74
|
+
};
|
75
|
+
const clear = ()=>{
|
76
|
+
size = 0;
|
77
|
+
};
|
78
|
+
const all = ()=>{
|
79
|
+
return arr.slice(0, size);
|
80
|
+
};
|
81
|
+
return {
|
82
|
+
all,
|
83
|
+
clear,
|
84
|
+
contains,
|
85
|
+
dequeue,
|
86
|
+
enqueue,
|
87
|
+
peek,
|
88
|
+
remove,
|
89
|
+
size: ()=>size
|
90
|
+
};
|
91
|
+
}
|
92
|
+
const left = (i)=>{
|
93
|
+
return 2 * i + 1;
|
94
|
+
};
|
95
|
+
const right = (i)=>{
|
96
|
+
return 2 * i + 2;
|
97
|
+
};
|
98
|
+
const parent = (i)=>{
|
99
|
+
return Math.floor((i - 1) / 2);
|
100
|
+
}; //# sourceMappingURL=priorityQueue.js.map
|
101
|
+
|
102
|
+
//# sourceMappingURL=priorityQueue.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"sources":["../../lib/utils/priorityQueue.js"],"sourcesContent":["/**\n * @internal\n */ /**\n * @internal\n * @param compare - comparison function for items\n * @returns Priority queue implemented with a min heap\n */export function createPriorityQueue(compare) {\n const arr = [];\n let size = 0;\n const swap = (a, b) => {\n const tmp = arr[a];\n arr[a] = arr[b];\n arr[b] = tmp;\n };\n const heapify = i => {\n let smallest = i;\n const l = left(i);\n const r = right(i);\n if (l < size && compare(arr[l], arr[smallest]) < 0) {\n smallest = l;\n }\n if (r < size && compare(arr[r], arr[smallest]) < 0) {\n smallest = r;\n }\n if (smallest !== i) {\n swap(smallest, i);\n heapify(smallest);\n }\n };\n const dequeue = () => {\n if (size === 0) {\n throw new Error('Priority queue empty');\n }\n const res = arr[0];\n arr[0] = arr[--size];\n heapify(0);\n return res;\n };\n const peek = () => {\n if (size === 0) {\n return null;\n }\n return arr[0];\n };\n const enqueue = item => {\n arr[size++] = item;\n let i = size - 1;\n let p = parent(i);\n while (i > 0 && compare(arr[p], arr[i]) > 0) {\n swap(p, i);\n i = p;\n p = parent(i);\n }\n };\n const contains = item => {\n const index = arr.indexOf(item);\n return index >= 0 && index < size;\n };\n const remove = item => {\n const i = arr.indexOf(item);\n if (i === -1 || i >= size) {\n return;\n }\n arr[i] = arr[--size];\n heapify(i);\n };\n const clear = () => {\n size = 0;\n };\n const all = () => {\n return arr.slice(0, size);\n };\n return {\n all,\n clear,\n contains,\n dequeue,\n enqueue,\n peek,\n remove,\n size: () => size\n };\n}\nconst left = i => {\n return 2 * i + 1;\n};\nconst right = i => {\n return 2 * i + 2;\n};\nconst parent = i => {\n return Math.floor((i - 1) / 2);\n};\n//# sourceMappingURL=priorityQueue.js.map"],"names":["createPriorityQueue","compare","arr","size","swap","a","b","tmp","heapify","i","smallest","l","left","r","right","dequeue","Error","res","peek","enqueue","item","p","parent","contains","index","indexOf","remove","clear","all","slice","Math","floor"],"mappings":"AAAA;;CAEC,GAAG;;;;IAIA;;;;+BAAkBA;;aAAAA;;AAAT,SAASA,oBAAoBC,OAAO,EAAE;IACjD,MAAMC,MAAM,EAAE;IACd,IAAIC,OAAO;IACX,MAAMC,OAAO,CAACC,GAAGC,IAAM;QACrB,MAAMC,MAAML,GAAG,CAACG,EAAE;QAClBH,GAAG,CAACG,EAAE,GAAGH,GAAG,CAACI,EAAE;QACfJ,GAAG,CAACI,EAAE,GAAGC;IACX;IACA,MAAMC,UAAUC,CAAAA,IAAK;QACnB,IAAIC,WAAWD;QACf,MAAME,IAAIC,KAAKH;QACf,MAAMI,IAAIC,MAAML;QAChB,IAAIE,IAAIR,QAAQF,QAAQC,GAAG,CAACS,EAAE,EAAET,GAAG,CAACQ,SAAS,IAAI,GAAG;YAClDA,WAAWC;QACb,CAAC;QACD,IAAIE,IAAIV,QAAQF,QAAQC,GAAG,CAACW,EAAE,EAAEX,GAAG,CAACQ,SAAS,IAAI,GAAG;YAClDA,WAAWG;QACb,CAAC;QACD,IAAIH,aAAaD,GAAG;YAClBL,KAAKM,UAAUD;YACfD,QAAQE;QACV,CAAC;IACH;IACA,MAAMK,UAAU,IAAM;QACpB,IAAIZ,SAAS,GAAG;YACd,MAAM,IAAIa,MAAM,wBAAwB;QAC1C,CAAC;QACD,MAAMC,MAAMf,GAAG,CAAC,EAAE;QAClBA,GAAG,CAAC,EAAE,GAAGA,GAAG,CAAC,EAAEC,KAAK;QACpBK,QAAQ;QACR,OAAOS;IACT;IACA,MAAMC,OAAO,IAAM;QACjB,IAAIf,SAAS,GAAG;YACd,OAAO,IAAI;QACb,CAAC;QACD,OAAOD,GAAG,CAAC,EAAE;IACf;IACA,MAAMiB,UAAUC,CAAAA,OAAQ;QACtBlB,GAAG,CAACC,OAAO,GAAGiB;QACd,IAAIX,IAAIN,OAAO;QACf,IAAIkB,IAAIC,OAAOb;QACf,MAAOA,IAAI,KAAKR,QAAQC,GAAG,CAACmB,EAAE,EAAEnB,GAAG,CAACO,EAAE,IAAI,EAAG;YAC3CL,KAAKiB,GAAGZ;YACRA,IAAIY;YACJA,IAAIC,OAAOb;QACb;IACF;IACA,MAAMc,WAAWH,CAAAA,OAAQ;QACvB,MAAMI,QAAQtB,IAAIuB,OAAO,CAACL;QAC1B,OAAOI,SAAS,KAAKA,QAAQrB;IAC/B;IACA,MAAMuB,SAASN,CAAAA,OAAQ;QACrB,MAAMX,IAAIP,IAAIuB,OAAO,CAACL;QACtB,IAAIX,MAAM,CAAC,KAAKA,KAAKN,MAAM;YACzB;QACF,CAAC;QACDD,GAAG,CAACO,EAAE,GAAGP,GAAG,CAAC,EAAEC,KAAK;QACpBK,QAAQC;IACV;IACA,MAAMkB,QAAQ,IAAM;QAClBxB,OAAO;IACT;IACA,MAAMyB,MAAM,IAAM;QAChB,OAAO1B,IAAI2B,KAAK,CAAC,GAAG1B;IACtB;IACA,OAAO;QACLyB;QACAD;QACAJ;QACAR;QACAI;QACAD;QACAQ;QACAvB,MAAM,IAAMA;IACd;AACF;AACA,MAAMS,OAAOH,CAAAA,IAAK;IAChB,OAAO,IAAIA,IAAI;AACjB;AACA,MAAMK,QAAQL,CAAAA,IAAK;IACjB,OAAO,IAAIA,IAAI;AACjB;AACA,MAAMa,SAASb,CAAAA,IAAK;IAClB,OAAOqB,KAAKC,KAAK,CAAC,AAACtB,CAAAA,IAAI,CAAA,IAAK;AAC9B,GACA,yCAAyC"}
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@fluentui/react-utilities",
|
3
|
-
"version": "9.
|
3
|
+
"version": "9.9.0",
|
4
4
|
"description": "A set of general React-specific utilities.",
|
5
5
|
"main": "lib-commonjs/index.js",
|
6
6
|
"module": "lib/index.js",
|
@@ -20,7 +20,8 @@
|
|
20
20
|
"lint": "just-scripts lint",
|
21
21
|
"test": "jest --passWithNoTests",
|
22
22
|
"type-check": "tsc -b tsconfig.json",
|
23
|
-
"generate-api": "just-scripts generate-api"
|
23
|
+
"generate-api": "just-scripts generate-api",
|
24
|
+
"test-ssr": "test-ssr ./stories/**/*.stories.tsx"
|
24
25
|
},
|
25
26
|
"devDependencies": {
|
26
27
|
"@fluentui/eslint-plugin": "*",
|
@@ -28,7 +29,7 @@
|
|
28
29
|
"@fluentui/scripts-tasks": "*"
|
29
30
|
},
|
30
31
|
"dependencies": {
|
31
|
-
"@fluentui/keyboard-keys": "^9.0.
|
32
|
+
"@fluentui/keyboard-keys": "^9.0.3",
|
32
33
|
"@swc/helpers": "^0.4.14"
|
33
34
|
},
|
34
35
|
"peerDependencies": {
|
package/.swcrc
DELETED
@@ -1,30 +0,0 @@
|
|
1
|
-
{
|
2
|
-
"$schema": "https://json.schemastore.org/swcrc",
|
3
|
-
"exclude": [
|
4
|
-
"/testing",
|
5
|
-
"/**/*.cy.ts",
|
6
|
-
"/**/*.cy.tsx",
|
7
|
-
"/**/*.spec.ts",
|
8
|
-
"/**/*.spec.tsx",
|
9
|
-
"/**/*.test.ts",
|
10
|
-
"/**/*.test.tsx"
|
11
|
-
],
|
12
|
-
"jsc": {
|
13
|
-
"parser": {
|
14
|
-
"syntax": "typescript",
|
15
|
-
"tsx": true,
|
16
|
-
"decorators": false,
|
17
|
-
"dynamicImport": false
|
18
|
-
},
|
19
|
-
"externalHelpers": true,
|
20
|
-
"transform": {
|
21
|
-
"react": {
|
22
|
-
"runtime": "classic",
|
23
|
-
"useSpread": true
|
24
|
-
}
|
25
|
-
},
|
26
|
-
"target": "es2019"
|
27
|
-
},
|
28
|
-
"minify": false,
|
29
|
-
"sourceMaps": true
|
30
|
-
}
|