@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.
- package/dist/index.compiled.mjs +37 -13
- package/dist/index.compiled.mjs.map +1 -1
- package/dist/index.esm.js +1 -6
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +1 -6
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1 -6
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/src/core/theme/themeProvider.tsx +3 -6
package/dist/index.compiled.mjs
CHANGED
|
@@ -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,
|
|
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
|
|
169
|
-
children
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
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);
|