@sanity/ui 2.1.3-canary.0 → 2.1.3

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/dist/index.d.mts CHANGED
@@ -2466,7 +2466,7 @@ export declare const Tooltip: ForwardRefExoticComponent<
2466
2466
  /**
2467
2467
  * @beta
2468
2468
  */
2469
- export declare const TooltipDelayGroupContext: React.Context<TooltipDelayGroupContextValue | null>
2469
+ export declare const TooltipDelayGroupContext: Context<TooltipDelayGroupContextValue | null>
2470
2470
 
2471
2471
  /**
2472
2472
  * @beta
package/dist/index.d.ts CHANGED
@@ -2466,7 +2466,7 @@ export declare const Tooltip: ForwardRefExoticComponent<
2466
2466
  /**
2467
2467
  * @beta
2468
2468
  */
2469
- export declare const TooltipDelayGroupContext: React.Context<TooltipDelayGroupContextValue | null>
2469
+ export declare const TooltipDelayGroupContext: Context<TooltipDelayGroupContextValue | null>
2470
2470
 
2471
2471
  /**
2472
2472
  * @beta
package/dist/index.esm.js CHANGED
@@ -2821,9 +2821,10 @@ const Root$k = styled.div(
2821
2821
  /* @__PURE__ */ jsx(StrokePath, { d: strokePath, mask: "url(#stroke-mask)", strokeWidth: strokeWidth * 2 }),
2822
2822
  /* @__PURE__ */ jsx(ShapePath, { d: fillPath })
2823
2823
  ] }) });
2824
- }), key$7 = Symbol.for("@sanity/ui/context/boundaryElement");
2825
- globalScope[key$7] = globalScope[key$7] || createContext(null);
2826
- const BoundaryElementContext = globalScope[key$7];
2824
+ }), key$7 = Symbol.for("@sanity/ui/context/boundaryElement"), BoundaryElementContext = createGlobalScopedContext(
2825
+ key$7,
2826
+ null
2827
+ );
2827
2828
  function BoundaryElementProvider(props) {
2828
2829
  const { children, element } = props, value = useMemo(() => ({ version: 0, element }), [element]);
2829
2830
  return /* @__PURE__ */ jsx(BoundaryElementContext.Provider, { value, children });
@@ -2911,9 +2912,7 @@ function getLayerContext(contextValue) {
2911
2912
  return contextValue;
2912
2913
  throw new Error("could not get layer context");
2913
2914
  }
2914
- const key$6 = Symbol.for("@sanity/ui/context/layer");
2915
- globalScope[key$6] = globalScope[key$6] || createContext(null);
2916
- const LayerContext = globalScope[key$6];
2915
+ const key$6 = Symbol.for("@sanity/ui/context/layer"), LayerContext = createGlobalScopedContext(key$6, null);
2917
2916
  function useLayer() {
2918
2917
  const value = useContext(LayerContext);
2919
2918
  if (!value)
@@ -3067,9 +3066,7 @@ const defaultContextValue = {
3067
3066
  get element() {
3068
3067
  return typeof document > "u" ? null : (globalScope[elementKey] || (globalScope[elementKey] = document.createElement("div"), globalScope[elementKey].setAttribute("data-portal", ""), document.body.appendChild(globalScope[elementKey])), globalScope[elementKey]);
3069
3068
  }
3070
- };
3071
- globalScope[key$5] = globalScope[key$5] || createContext(defaultContextValue);
3072
- const PortalContext = globalScope[key$5];
3069
+ }, PortalContext = createGlobalScopedContext(key$5, defaultContextValue);
3073
3070
  function usePortal() {
3074
3071
  const value = useContext(PortalContext);
3075
3072
  if (!value)
@@ -4324,9 +4321,7 @@ const DEFAULT_TOOLTIP_ARROW_WIDTH = 15, DEFAULT_TOOLTIP_ARROW_HEIGHT = 6, DEFAUL
4324
4321
  })
4325
4322
  );
4326
4323
  TooltipCard.displayName = "TooltipCard";
4327
- const key$4 = Symbol.for("@sanity/ui/context/tooltipDelayGroup");
4328
- globalScope[key$4] = globalScope[key$4] || createContext(null);
4329
- const TooltipDelayGroupContext = globalScope[key$4];
4324
+ const key$4 = Symbol.for("@sanity/ui/context/tooltipDelayGroup"), TooltipDelayGroupContext = createGlobalScopedContext(key$4, null);
4330
4325
  function useTooltipDelayGroup() {
4331
4326
  return useContext(TooltipDelayGroupContext);
4332
4327
  }
@@ -5298,9 +5293,7 @@ const Root$6 = styled.kbd`
5298
5293
  `, Hotkeys = forwardRef(function(props, ref) {
5299
5294
  const { fontSize: fontSize2, keys, padding, radius, space: spaceProp = 0.5, ...restProps } = props, space = useArrayProp(spaceProp);
5300
5295
  return !keys || keys.length === 0 ? /* @__PURE__ */ jsx(Fragment, {}) : /* @__PURE__ */ jsx(Root$6, { "data-ui": "Hotkeys", ...restProps, ref, children: /* @__PURE__ */ jsx(Inline, { as: "span", space, children: keys.map((key2, i) => /* @__PURE__ */ jsx(Key, { fontSize: fontSize2, padding, radius, children: key2 }, i)) }) });
5301
- }), key$2 = Symbol.for("@sanity/ui/context/menu");
5302
- globalScope[key$2] = globalScope[key$2] || createContext(null);
5303
- const MenuContext = globalScope[key$2];
5296
+ }), key$2 = Symbol.for("@sanity/ui/context/menu"), MenuContext = createGlobalScopedContext(key$2, null);
5304
5297
  function _isFocusable(element) {
5305
5298
  return isHTMLAnchorElement(element) && element.getAttribute("data-disabled") !== "true" || isHTMLButtonElement(element) && !element.disabled;
5306
5299
  }
@@ -6237,9 +6230,7 @@ function useMounted() {
6237
6230
  );
6238
6231
  }
6239
6232
  const subscribe = () => () => {
6240
- }, key$1 = Symbol.for("@sanity/ui/context/toast");
6241
- globalScope[key$1] = globalScope[key$1] || createContext(null);
6242
- const ToastContext = globalScope[key$1], Root$1 = styled(Layer)`
6233
+ }, key$1 = Symbol.for("@sanity/ui/context/toast"), ToastContext = createGlobalScopedContext(key$1, null), Root$1 = styled(Layer)`
6243
6234
  position: fixed;
6244
6235
  top: 0;
6245
6236
  left: 0;
@@ -6397,9 +6388,7 @@ function _focusItemElement(el) {
6397
6388
  firstChild && firstChild instanceof HTMLElement && firstChild.focus();
6398
6389
  }
6399
6390
  }
6400
- const key = Symbol.for("@sanity/ui/context/tree");
6401
- globalScope[key] = globalScope[key] || createContext(null);
6402
- const TreeContext = globalScope[key], Tree = memo(
6391
+ const key = Symbol.for("@sanity/ui/context/tree"), TreeContext = createGlobalScopedContext(key, null), Tree = memo(
6403
6392
  forwardRef(function(props, ref) {
6404
6393
  const { children, space = 1, onFocus, ...restProps } = props, forwardedRef = useForwardedRef(ref), [focusedElement, setFocusedElement] = useState(null), focusedElementRef = useRef(focusedElement), path = useMemo(() => [], []), [itemElements, setItemElements] = useState([]), [state, setState] = useState({}), stateRef = useRef(state);
6405
6394
  useEffect(() => {