@sanity/ui 2.15.14 → 2.15.15

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.
@@ -1,7 +1,7 @@
1
1
  import { buildTheme, createColorTheme as createColorTheme$1, hexToRgb as hexToRgb$1, hslToRgb as hslToRgb$1, multiply as multiply$1, parseColor as parseColor$1, rgbToHex as rgbToHex$1, rgbToHsl as rgbToHsl$1, rgba as rgba$1, screen as screen$1, getTheme_v2, getScopedTheme } from "@sanity/ui/theme";
2
2
  import { jsx, jsxs, Fragment } from "react/jsx-runtime";
3
3
  import { c } from "react-compiler-runtime";
4
- import { useState, useEffect, useDebugValue, useMemo, useSyncExternalStore, createContext, useContext, forwardRef, useId, Children, isValidElement, cloneElement, useRef, useImperativeHandle, lazy, Suspense, memo, useCallback, useLayoutEffect } from "react";
4
+ import { useState, useEffect, useDebugValue, useSyncExternalStore, createContext, useContext, forwardRef, useId, Children, isValidElement, cloneElement, useRef, useImperativeHandle, lazy, Suspense, memo, useMemo, useCallback, useLayoutEffect } from "react";
5
5
  import { ThemeProvider as ThemeProvider$1, useTheme as useTheme$1, css, styled, keyframes } from "styled-components";
6
6
  import ReactIs, { isValidElementType } from "react-is";
7
7
  import { SpinnerIcon, CheckmarkIcon, RemoveIcon, ChevronDownIcon, CloseIcon, ChevronRightIcon } from "@sanity/icons";
@@ -306,21 +306,15 @@ function useGlobalKeyDown(onKeyDown) {
306
306
  $[4] === Symbol.for("react.memo_cache_sentinel") ? (t2 = [], $[4] = t2) : t2 = $[4], useEffect(t1, t2);
307
307
  }
308
308
  function useMatchMedia(mediaQueryString, getServerSnapshot2) {
309
- const {
310
- subscribe,
311
- getSnapshot
312
- } = useMemo(() => {
313
- let MEDIA_QUERY_CACHE;
314
- const getMatchMedia = () => (MEDIA_QUERY_CACHE || (MEDIA_QUERY_CACHE = window.matchMedia(mediaQueryString)), MEDIA_QUERY_CACHE);
315
- return {
316
- subscribe: (onStoreChange) => {
317
- const matchMedia = getMatchMedia();
318
- return matchMedia.addEventListener("change", onStoreChange), () => matchMedia.removeEventListener("change", onStoreChange);
319
- },
320
- getSnapshot: () => getMatchMedia().matches
321
- };
322
- }, [mediaQueryString]);
323
- return useDebugValue(mediaQueryString), useSyncExternalStore(subscribe, getSnapshot, getServerSnapshot2);
309
+ const $ = c(4);
310
+ useDebugValue(mediaQueryString);
311
+ let t0;
312
+ $[0] !== mediaQueryString ? (t0 = (onStoreChange) => {
313
+ const media = window.matchMedia(mediaQueryString);
314
+ return media.addEventListener("change", onStoreChange), () => media.removeEventListener("change", onStoreChange);
315
+ }, $[0] = mediaQueryString, $[1] = t0) : t0 = $[1];
316
+ let t1;
317
+ return $[2] !== mediaQueryString ? (t1 = () => window.matchMedia(mediaQueryString).matches, $[2] = mediaQueryString, $[3] = t1) : t1 = $[3], useSyncExternalStore(t0, t1, getServerSnapshot2);
324
318
  }
325
319
  function getGlobalScope() {
326
320
  if (typeof globalThis < "u") return globalThis;