@fluentui/react-utilities 0.0.0-nightly-20240523-0405.1 → 0.0.0-nightly-20240524-0405.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,19 +1,19 @@
1
1
  # Change Log - @fluentui/react-utilities
2
2
 
3
- This log was last generated on Thu, 23 May 2024 04:21:03 GMT and should not be manually modified.
3
+ This log was last generated on Fri, 24 May 2024 04:21:12 GMT and should not be manually modified.
4
4
 
5
5
  <!-- Start content -->
6
6
 
7
- ## [0.0.0-nightly-20240523-0405.1](https://github.com/microsoft/fluentui/tree/@fluentui/react-utilities_v0.0.0-nightly-20240523-0405.1)
7
+ ## [0.0.0-nightly-20240524-0405.1](https://github.com/microsoft/fluentui/tree/@fluentui/react-utilities_v0.0.0-nightly-20240524-0405.1)
8
8
 
9
- Thu, 23 May 2024 04:21:03 GMT
10
- [Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-utilities_v9.18.9..@fluentui/react-utilities_v0.0.0-nightly-20240523-0405.1)
9
+ Fri, 24 May 2024 04:21:12 GMT
10
+ [Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-utilities_v9.18.9..@fluentui/react-utilities_v0.0.0-nightly-20240524-0405.1)
11
11
 
12
12
  ### Changes
13
13
 
14
14
  - Release nightly v9 ([commit](https://github.com/microsoft/fluentui/commit/not available) by fluentui-internal@service.microsoft.com)
15
- - Bump @fluentui/keyboard-keys to v0.0.0-nightly-20240523-0405.1 ([commit](https://github.com/microsoft/fluentui/commit/3887e8a821be5ba372892da287733bd1f4eead41) by beachball)
16
- - Bump @fluentui/react-shared-contexts to v0.0.0-nightly-20240523-0405.1 ([commit](https://github.com/microsoft/fluentui/commit/3887e8a821be5ba372892da287733bd1f4eead41) by beachball)
15
+ - Bump @fluentui/keyboard-keys to v0.0.0-nightly-20240524-0405.1 ([commit](https://github.com/microsoft/fluentui/commit/2ff89649b3fa7496c5277542b79a039dd293bcdd) by beachball)
16
+ - Bump @fluentui/react-shared-contexts to v0.0.0-nightly-20240524-0405.1 ([commit](https://github.com/microsoft/fluentui/commit/2ff89649b3fa7496c5277542b79a039dd293bcdd) by beachball)
17
17
 
18
18
  ## [9.18.9](https://github.com/microsoft/fluentui/tree/@fluentui/react-utilities_v9.18.9)
19
19
 
@@ -1,5 +1,5 @@
1
- import { canUseDOM } from '../ssr/canUseDOM';
2
1
  import { useBrowserTimer } from './useBrowserTimer';
2
+ import { useFluent_unstable as useFluent } from '@fluentui/react-shared-contexts';
3
3
  const setAnimationFrameNoop = (callback)=>{
4
4
  callback(0);
5
5
  return 0;
@@ -13,9 +13,9 @@ const cancelAnimationFrameNoop = (handle)=>handle;
13
13
  *
14
14
  * @returns A pair of [requestAnimationFrame, cancelAnimationFrame] that are stable between renders.
15
15
  */ export function useAnimationFrame() {
16
- const isDOM = canUseDOM();
17
- // TODO: figure it out a way to not call global.requestAnimationFrame and instead infer window from some context
18
- const setAnimationFrame = isDOM ? requestAnimationFrame : setAnimationFrameNoop;
19
- const clearAnimationFrame = isDOM ? cancelAnimationFrame : cancelAnimationFrameNoop;
16
+ const { targetDocument } = useFluent();
17
+ const win = targetDocument === null || targetDocument === void 0 ? void 0 : targetDocument.defaultView;
18
+ const setAnimationFrame = win ? win.requestAnimationFrame : setAnimationFrameNoop;
19
+ const clearAnimationFrame = win ? win.cancelAnimationFrame : cancelAnimationFrameNoop;
20
20
  return useBrowserTimer(setAnimationFrame, clearAnimationFrame);
21
21
  }
@@ -1 +1 @@
1
- {"version":3,"sources":["useAnimationFrame.ts"],"sourcesContent":["import { canUseDOM } from '../ssr/canUseDOM';\nimport { useBrowserTimer } from './useBrowserTimer';\n\nconst setAnimationFrameNoop = (callback: FrameRequestCallback) => {\n callback(0);\n return 0;\n};\nconst cancelAnimationFrameNoop = (handle: number) => handle;\n\n/**\n * @internal\n * Helper to manage a browser requestAnimationFrame.\n * Ensures that the requestAnimationFrame isn't set multiple times at once and is cleaned up\n * when the component is unloaded.\n *\n * @returns A pair of [requestAnimationFrame, cancelAnimationFrame] that are stable between renders.\n */\nexport function useAnimationFrame() {\n const isDOM = canUseDOM();\n\n // TODO: figure it out a way to not call global.requestAnimationFrame and instead infer window from some context\n const setAnimationFrame = isDOM ? requestAnimationFrame : setAnimationFrameNoop;\n const clearAnimationFrame = isDOM ? cancelAnimationFrame : cancelAnimationFrameNoop;\n\n return useBrowserTimer(setAnimationFrame, clearAnimationFrame);\n}\n"],"names":["canUseDOM","useBrowserTimer","setAnimationFrameNoop","callback","cancelAnimationFrameNoop","handle","useAnimationFrame","isDOM","setAnimationFrame","requestAnimationFrame","clearAnimationFrame","cancelAnimationFrame"],"mappings":"AAAA,SAASA,SAAS,QAAQ,mBAAmB;AAC7C,SAASC,eAAe,QAAQ,oBAAoB;AAEpD,MAAMC,wBAAwB,CAACC;IAC7BA,SAAS;IACT,OAAO;AACT;AACA,MAAMC,2BAA2B,CAACC,SAAmBA;AAErD;;;;;;;CAOC,GACD,OAAO,SAASC;IACd,MAAMC,QAAQP;IAEd,gHAAgH;IAChH,MAAMQ,oBAAoBD,QAAQE,wBAAwBP;IAC1D,MAAMQ,sBAAsBH,QAAQI,uBAAuBP;IAE3D,OAAOH,gBAAgBO,mBAAmBE;AAC5C"}
1
+ {"version":3,"sources":["useAnimationFrame.ts"],"sourcesContent":["import { useBrowserTimer } from './useBrowserTimer';\nimport { useFluent_unstable as useFluent } from '@fluentui/react-shared-contexts';\n\nconst setAnimationFrameNoop = (callback: FrameRequestCallback) => {\n callback(0);\n return 0;\n};\nconst cancelAnimationFrameNoop = (handle: number) => handle;\n\n/**\n * @internal\n * Helper to manage a browser requestAnimationFrame.\n * Ensures that the requestAnimationFrame isn't set multiple times at once and is cleaned up\n * when the component is unloaded.\n *\n * @returns A pair of [requestAnimationFrame, cancelAnimationFrame] that are stable between renders.\n */\nexport function useAnimationFrame() {\n const { targetDocument } = useFluent();\n const win = targetDocument?.defaultView;\n\n const setAnimationFrame = win ? win.requestAnimationFrame : setAnimationFrameNoop;\n const clearAnimationFrame = win ? win.cancelAnimationFrame : cancelAnimationFrameNoop;\n\n return useBrowserTimer(setAnimationFrame, clearAnimationFrame);\n}\n"],"names":["useBrowserTimer","useFluent_unstable","useFluent","setAnimationFrameNoop","callback","cancelAnimationFrameNoop","handle","useAnimationFrame","targetDocument","win","defaultView","setAnimationFrame","requestAnimationFrame","clearAnimationFrame","cancelAnimationFrame"],"mappings":"AAAA,SAASA,eAAe,QAAQ,oBAAoB;AACpD,SAASC,sBAAsBC,SAAS,QAAQ,kCAAkC;AAElF,MAAMC,wBAAwB,CAACC;IAC7BA,SAAS;IACT,OAAO;AACT;AACA,MAAMC,2BAA2B,CAACC,SAAmBA;AAErD;;;;;;;CAOC,GACD,OAAO,SAASC;IACd,MAAM,EAAEC,cAAc,EAAE,GAAGN;IAC3B,MAAMO,MAAMD,2BAAAA,qCAAAA,eAAgBE,WAAW;IAEvC,MAAMC,oBAAoBF,MAAMA,IAAIG,qBAAqB,GAAGT;IAC5D,MAAMU,sBAAsBJ,MAAMA,IAAIK,oBAAoB,GAAGT;IAE7D,OAAOL,gBAAgBW,mBAAmBE;AAC5C"}
@@ -1,4 +1,7 @@
1
1
  import { useBrowserTimer } from './useBrowserTimer';
2
+ import { useFluent_unstable as useFluent } from '@fluentui/react-shared-contexts';
3
+ const setTimeoutNoop = (_callback)=>-1;
4
+ const clearTimeoutNoop = (_handle)=>undefined;
2
5
  /**
3
6
  * @internal
4
7
  * Helper to manage a browser timeout.
@@ -7,6 +10,9 @@ import { useBrowserTimer } from './useBrowserTimer';
7
10
  *
8
11
  * @returns A pair of [setTimeout, clearTimeout] that are stable between renders.
9
12
  */ export function useTimeout() {
10
- // TODO: figure it out a way to not call global.setTimeout and instead infer window from some context
11
- return useBrowserTimer(setTimeout, clearTimeout);
13
+ const { targetDocument } = useFluent();
14
+ const win = targetDocument === null || targetDocument === void 0 ? void 0 : targetDocument.defaultView;
15
+ const setTimerFn = win ? win.setTimeout : setTimeoutNoop;
16
+ const clearTimerFn = win ? win.clearTimeout : clearTimeoutNoop;
17
+ return useBrowserTimer(setTimerFn, clearTimerFn);
12
18
  }
@@ -1 +1 @@
1
- {"version":3,"sources":["useTimeout.ts"],"sourcesContent":["import { useBrowserTimer } from './useBrowserTimer';\n\n/**\n * @internal\n * Helper to manage a browser timeout.\n * Ensures that the timeout isn't set multiple times at once and is cleaned up\n * when the component is unloaded.\n *\n * @returns A pair of [setTimeout, clearTimeout] that are stable between renders.\n */\nexport function useTimeout() {\n // TODO: figure it out a way to not call global.setTimeout and instead infer window from some context\n return useBrowserTimer(setTimeout, clearTimeout);\n}\n"],"names":["useBrowserTimer","useTimeout","setTimeout","clearTimeout"],"mappings":"AAAA,SAASA,eAAe,QAAQ,oBAAoB;AAEpD;;;;;;;CAOC,GACD,OAAO,SAASC;IACd,qGAAqG;IACrG,OAAOD,gBAAgBE,YAAYC;AACrC"}
1
+ {"version":3,"sources":["useTimeout.ts"],"sourcesContent":["import { useBrowserTimer } from './useBrowserTimer';\nimport { useFluent_unstable as useFluent } from '@fluentui/react-shared-contexts';\n\nconst setTimeoutNoop = (_callback: Function) => -1;\nconst clearTimeoutNoop = (_handle: number) => undefined;\n\n/**\n * @internal\n * Helper to manage a browser timeout.\n * Ensures that the timeout isn't set multiple times at once and is cleaned up\n * when the component is unloaded.\n *\n * @returns A pair of [setTimeout, clearTimeout] that are stable between renders.\n */\nexport function useTimeout() {\n const { targetDocument } = useFluent();\n const win = targetDocument?.defaultView;\n\n const setTimerFn = win ? win.setTimeout : setTimeoutNoop;\n const clearTimerFn = win ? win.clearTimeout : clearTimeoutNoop;\n\n return useBrowserTimer(setTimerFn, clearTimerFn);\n}\n"],"names":["useBrowserTimer","useFluent_unstable","useFluent","setTimeoutNoop","_callback","clearTimeoutNoop","_handle","undefined","useTimeout","targetDocument","win","defaultView","setTimerFn","setTimeout","clearTimerFn","clearTimeout"],"mappings":"AAAA,SAASA,eAAe,QAAQ,oBAAoB;AACpD,SAASC,sBAAsBC,SAAS,QAAQ,kCAAkC;AAElF,MAAMC,iBAAiB,CAACC,YAAwB,CAAC;AACjD,MAAMC,mBAAmB,CAACC,UAAoBC;AAE9C;;;;;;;CAOC,GACD,OAAO,SAASC;IACd,MAAM,EAAEC,cAAc,EAAE,GAAGP;IAC3B,MAAMQ,MAAMD,2BAAAA,qCAAAA,eAAgBE,WAAW;IAEvC,MAAMC,aAAaF,MAAMA,IAAIG,UAAU,GAAGV;IAC1C,MAAMW,eAAeJ,MAAMA,IAAIK,YAAY,GAAGV;IAE9C,OAAOL,gBAAgBY,YAAYE;AACrC"}
@@ -8,17 +8,17 @@ Object.defineProperty(exports, "useAnimationFrame", {
8
8
  return useAnimationFrame;
9
9
  }
10
10
  });
11
- const _canUseDOM = require("../ssr/canUseDOM");
12
11
  const _useBrowserTimer = require("./useBrowserTimer");
12
+ const _reactsharedcontexts = require("@fluentui/react-shared-contexts");
13
13
  const setAnimationFrameNoop = (callback)=>{
14
14
  callback(0);
15
15
  return 0;
16
16
  };
17
17
  const cancelAnimationFrameNoop = (handle)=>handle;
18
18
  function useAnimationFrame() {
19
- const isDOM = (0, _canUseDOM.canUseDOM)();
20
- // TODO: figure it out a way to not call global.requestAnimationFrame and instead infer window from some context
21
- const setAnimationFrame = isDOM ? requestAnimationFrame : setAnimationFrameNoop;
22
- const clearAnimationFrame = isDOM ? cancelAnimationFrame : cancelAnimationFrameNoop;
19
+ const { targetDocument } = (0, _reactsharedcontexts.useFluent_unstable)();
20
+ const win = targetDocument === null || targetDocument === void 0 ? void 0 : targetDocument.defaultView;
21
+ const setAnimationFrame = win ? win.requestAnimationFrame : setAnimationFrameNoop;
22
+ const clearAnimationFrame = win ? win.cancelAnimationFrame : cancelAnimationFrameNoop;
23
23
  return (0, _useBrowserTimer.useBrowserTimer)(setAnimationFrame, clearAnimationFrame);
24
24
  }
@@ -1 +1 @@
1
- {"version":3,"sources":["useAnimationFrame.js"],"sourcesContent":["import { canUseDOM } from '../ssr/canUseDOM';\nimport { useBrowserTimer } from './useBrowserTimer';\nconst setAnimationFrameNoop = (callback)=>{\n callback(0);\n return 0;\n};\nconst cancelAnimationFrameNoop = (handle)=>handle;\n/**\n * @internal\n * Helper to manage a browser requestAnimationFrame.\n * Ensures that the requestAnimationFrame isn't set multiple times at once and is cleaned up\n * when the component is unloaded.\n *\n * @returns A pair of [requestAnimationFrame, cancelAnimationFrame] that are stable between renders.\n */ export function useAnimationFrame() {\n const isDOM = canUseDOM();\n // TODO: figure it out a way to not call global.requestAnimationFrame and instead infer window from some context\n const setAnimationFrame = isDOM ? requestAnimationFrame : setAnimationFrameNoop;\n const clearAnimationFrame = isDOM ? cancelAnimationFrame : cancelAnimationFrameNoop;\n return useBrowserTimer(setAnimationFrame, clearAnimationFrame);\n}\n"],"names":["useAnimationFrame","setAnimationFrameNoop","callback","cancelAnimationFrameNoop","handle","isDOM","canUseDOM","setAnimationFrame","requestAnimationFrame","clearAnimationFrame","cancelAnimationFrame","useBrowserTimer"],"mappings":";;;;+BAcoBA;;;eAAAA;;;2BAdM;iCACM;AAChC,MAAMC,wBAAwB,CAACC;IAC3BA,SAAS;IACT,OAAO;AACX;AACA,MAAMC,2BAA2B,CAACC,SAASA;AAQhC,SAASJ;IAChB,MAAMK,QAAQC,IAAAA,oBAAS;IACvB,gHAAgH;IAChH,MAAMC,oBAAoBF,QAAQG,wBAAwBP;IAC1D,MAAMQ,sBAAsBJ,QAAQK,uBAAuBP;IAC3D,OAAOQ,IAAAA,gCAAe,EAACJ,mBAAmBE;AAC9C"}
1
+ {"version":3,"sources":["useAnimationFrame.js"],"sourcesContent":["import { useBrowserTimer } from './useBrowserTimer';\nimport { useFluent_unstable as useFluent } from '@fluentui/react-shared-contexts';\nconst setAnimationFrameNoop = (callback)=>{\n callback(0);\n return 0;\n};\nconst cancelAnimationFrameNoop = (handle)=>handle;\n/**\n * @internal\n * Helper to manage a browser requestAnimationFrame.\n * Ensures that the requestAnimationFrame isn't set multiple times at once and is cleaned up\n * when the component is unloaded.\n *\n * @returns A pair of [requestAnimationFrame, cancelAnimationFrame] that are stable between renders.\n */ export function useAnimationFrame() {\n const { targetDocument } = useFluent();\n const win = targetDocument === null || targetDocument === void 0 ? void 0 : targetDocument.defaultView;\n const setAnimationFrame = win ? win.requestAnimationFrame : setAnimationFrameNoop;\n const clearAnimationFrame = win ? win.cancelAnimationFrame : cancelAnimationFrameNoop;\n return useBrowserTimer(setAnimationFrame, clearAnimationFrame);\n}\n"],"names":["useAnimationFrame","setAnimationFrameNoop","callback","cancelAnimationFrameNoop","handle","targetDocument","useFluent","win","defaultView","setAnimationFrame","requestAnimationFrame","clearAnimationFrame","cancelAnimationFrame","useBrowserTimer"],"mappings":";;;;+BAcoBA;;;eAAAA;;;iCAdY;qCACgB;AAChD,MAAMC,wBAAwB,CAACC;IAC3BA,SAAS;IACT,OAAO;AACX;AACA,MAAMC,2BAA2B,CAACC,SAASA;AAQhC,SAASJ;IAChB,MAAM,EAAEK,cAAc,EAAE,GAAGC,IAAAA,uCAAS;IACpC,MAAMC,MAAMF,mBAAmB,QAAQA,mBAAmB,KAAK,IAAI,KAAK,IAAIA,eAAeG,WAAW;IACtG,MAAMC,oBAAoBF,MAAMA,IAAIG,qBAAqB,GAAGT;IAC5D,MAAMU,sBAAsBJ,MAAMA,IAAIK,oBAAoB,GAAGT;IAC7D,OAAOU,IAAAA,gCAAe,EAACJ,mBAAmBE;AAC9C"}
@@ -9,7 +9,13 @@ Object.defineProperty(exports, "useTimeout", {
9
9
  }
10
10
  });
11
11
  const _useBrowserTimer = require("./useBrowserTimer");
12
+ const _reactsharedcontexts = require("@fluentui/react-shared-contexts");
13
+ const setTimeoutNoop = (_callback)=>-1;
14
+ const clearTimeoutNoop = (_handle)=>undefined;
12
15
  function useTimeout() {
13
- // TODO: figure it out a way to not call global.setTimeout and instead infer window from some context
14
- return (0, _useBrowserTimer.useBrowserTimer)(setTimeout, clearTimeout);
16
+ const { targetDocument } = (0, _reactsharedcontexts.useFluent_unstable)();
17
+ const win = targetDocument === null || targetDocument === void 0 ? void 0 : targetDocument.defaultView;
18
+ const setTimerFn = win ? win.setTimeout : setTimeoutNoop;
19
+ const clearTimerFn = win ? win.clearTimeout : clearTimeoutNoop;
20
+ return (0, _useBrowserTimer.useBrowserTimer)(setTimerFn, clearTimerFn);
15
21
  }
@@ -1 +1 @@
1
- {"version":3,"sources":["useTimeout.js"],"sourcesContent":["import { useBrowserTimer } from './useBrowserTimer';\n/**\n * @internal\n * Helper to manage a browser timeout.\n * Ensures that the timeout isn't set multiple times at once and is cleaned up\n * when the component is unloaded.\n *\n * @returns A pair of [setTimeout, clearTimeout] that are stable between renders.\n */ export function useTimeout() {\n // TODO: figure it out a way to not call global.setTimeout and instead infer window from some context\n return useBrowserTimer(setTimeout, clearTimeout);\n}\n"],"names":["useTimeout","useBrowserTimer","setTimeout","clearTimeout"],"mappings":";;;;+BAQoBA;;;eAAAA;;;iCARY;AAQrB,SAASA;IAChB,qGAAqG;IACrG,OAAOC,IAAAA,gCAAe,EAACC,YAAYC;AACvC"}
1
+ {"version":3,"sources":["useTimeout.js"],"sourcesContent":["import { useBrowserTimer } from './useBrowserTimer';\nimport { useFluent_unstable as useFluent } from '@fluentui/react-shared-contexts';\nconst setTimeoutNoop = (_callback)=>-1;\nconst clearTimeoutNoop = (_handle)=>undefined;\n/**\n * @internal\n * Helper to manage a browser timeout.\n * Ensures that the timeout isn't set multiple times at once and is cleaned up\n * when the component is unloaded.\n *\n * @returns A pair of [setTimeout, clearTimeout] that are stable between renders.\n */ export function useTimeout() {\n const { targetDocument } = useFluent();\n const win = targetDocument === null || targetDocument === void 0 ? void 0 : targetDocument.defaultView;\n const setTimerFn = win ? win.setTimeout : setTimeoutNoop;\n const clearTimerFn = win ? win.clearTimeout : clearTimeoutNoop;\n return useBrowserTimer(setTimerFn, clearTimerFn);\n}\n"],"names":["useTimeout","setTimeoutNoop","_callback","clearTimeoutNoop","_handle","undefined","targetDocument","useFluent","win","defaultView","setTimerFn","setTimeout","clearTimerFn","clearTimeout","useBrowserTimer"],"mappings":";;;;+BAWoBA;;;eAAAA;;;iCAXY;qCACgB;AAChD,MAAMC,iBAAiB,CAACC,YAAY,CAAC;AACrC,MAAMC,mBAAmB,CAACC,UAAUC;AAQzB,SAASL;IAChB,MAAM,EAAEM,cAAc,EAAE,GAAGC,IAAAA,uCAAS;IACpC,MAAMC,MAAMF,mBAAmB,QAAQA,mBAAmB,KAAK,IAAI,KAAK,IAAIA,eAAeG,WAAW;IACtG,MAAMC,aAAaF,MAAMA,IAAIG,UAAU,GAAGV;IAC1C,MAAMW,eAAeJ,MAAMA,IAAIK,YAAY,GAAGV;IAC9C,OAAOW,IAAAA,gCAAe,EAACJ,YAAYE;AACvC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fluentui/react-utilities",
3
- "version": "0.0.0-nightly-20240523-0405.1",
3
+ "version": "0.0.0-nightly-20240524-0405.1",
4
4
  "description": "A set of general React-specific utilities.",
5
5
  "main": "lib-commonjs/index.js",
6
6
  "module": "lib/index.js",
@@ -31,8 +31,8 @@
31
31
  "@fluentui/scripts-tasks": "*"
32
32
  },
33
33
  "dependencies": {
34
- "@fluentui/keyboard-keys": "0.0.0-nightly-20240523-0405.1",
35
- "@fluentui/react-shared-contexts": "0.0.0-nightly-20240523-0405.1",
34
+ "@fluentui/keyboard-keys": "0.0.0-nightly-20240524-0405.1",
35
+ "@fluentui/react-shared-contexts": "0.0.0-nightly-20240524-0405.1",
36
36
  "@swc/helpers": "^0.5.1"
37
37
  },
38
38
  "peerDependencies": {