@sanity/ui 2.3.6-canary.1 → 2.3.6-canary.2

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,6 +1,6 @@
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
- import { createContext, useContext, useMemo, forwardRef, useId, useState, useEffect, useCallback, Children, isValidElement, cloneElement, useRef, useSyncExternalStore, useImperativeHandle, Component, memo, useReducer, Fragment as Fragment$1, startTransition } from "react";
3
+ import { createContext, useContext, forwardRef, useMemo, useId, useState, useEffect, useCallback, Children, isValidElement, cloneElement, useRef, useSyncExternalStore, useImperativeHandle, Component, memo, useReducer, Fragment as Fragment$1, startTransition } from "react";
4
4
  import { isValidElementType } from "react-is";
5
5
  import { ThemeProvider as ThemeProvider$1, useTheme as useTheme$1, css, styled, keyframes } from "styled-components";
6
6
  import { c } from "react/compiler-runtime";
@@ -165,18 +165,42 @@ function createGlobalScopedContext(key2, defaultValue) {
165
165
  const key$8 = Symbol.for("@sanity/ui/context/theme"), ThemeContext = createGlobalScopedContext(key$8, null);
166
166
  function ThemeProvider(props) {
167
167
  var _a;
168
- const parentTheme = useContext(ThemeContext), {
169
- children,
170
- // scheme = parentTheme?.scheme || 'light',
171
- theme: rootTheme = (parentTheme == null ? void 0 : parentTheme.theme) || null,
172
- tone = (parentTheme == null ? void 0 : parentTheme.tone) || "default"
173
- } = props, scheme = (_a = props.scheme) != null ? _a : (parentTheme == null ? void 0 : parentTheme.scheme) || "light", themeContext = useMemo(() => rootTheme ? {
174
- version: 0,
175
- theme: rootTheme,
176
- scheme,
177
- tone
178
- } : null, [rootTheme, scheme, tone]), theme = useMemo(() => rootTheme ? getScopedTheme(rootTheme, scheme, tone) : null, [scheme, rootTheme, tone]);
179
- return theme ? /* @__PURE__ */ jsx(ThemeContext.Provider, { value: themeContext, children: /* @__PURE__ */ jsx(ThemeProvider$1, { theme, children }) }) : /* @__PURE__ */ jsx("pre", { children: 'ThemeProvider: no "theme" property provided' });
168
+ const $ = c(15), {
169
+ children
170
+ } = props, parentTheme = useContext(ThemeContext), scheme = (_a = props.scheme) != null ? _a : (parentTheme == null ? void 0 : parentTheme.scheme) || "light", rootTheme = (parentTheme == null ? void 0 : parentTheme.theme) || null, tone = (parentTheme == null ? void 0 : parentTheme.tone) || "default";
171
+ let t0;
172
+ bb0: {
173
+ if (!rootTheme) {
174
+ t0 = null;
175
+ break bb0;
176
+ }
177
+ let t12;
178
+ $[0] !== rootTheme || $[1] !== scheme || $[2] !== tone ? (t12 = {
179
+ version: 0,
180
+ theme: rootTheme,
181
+ scheme,
182
+ tone
183
+ }, $[0] = rootTheme, $[1] = scheme, $[2] = tone, $[3] = t12) : t12 = $[3], t0 = t12;
184
+ }
185
+ const themeContext = t0;
186
+ let t1;
187
+ bb1: {
188
+ if (!rootTheme) {
189
+ t1 = null;
190
+ break bb1;
191
+ }
192
+ let t22;
193
+ $[4] !== rootTheme || $[5] !== scheme || $[6] !== tone ? (t22 = getScopedTheme(rootTheme, scheme, tone), $[4] = rootTheme, $[5] = scheme, $[6] = tone, $[7] = t22) : t22 = $[7], t1 = t22;
194
+ }
195
+ const theme = t1;
196
+ if (!theme) {
197
+ let t22;
198
+ return $[8] === Symbol.for("react.memo_cache_sentinel") ? (t22 = /* @__PURE__ */ jsx("pre", { children: 'ThemeProvider: no "theme" property provided' }), $[8] = t22) : t22 = $[8], t22;
199
+ }
200
+ let t2;
201
+ $[9] !== theme || $[10] !== children ? (t2 = /* @__PURE__ */ jsx(ThemeProvider$1, { theme, children }), $[9] = theme, $[10] = children, $[11] = t2) : t2 = $[11];
202
+ let t3;
203
+ return $[12] !== themeContext || $[13] !== t2 ? (t3 = /* @__PURE__ */ jsx(ThemeContext.Provider, { value: themeContext, children: t2 }), $[12] = themeContext, $[13] = t2, $[14] = t3) : t3 = $[14], t3;
180
204
  }
181
205
  function useRootTheme() {
182
206
  const value = useContext(ThemeContext);