@sanity/ui 2.12.0-canary.0 → 2.12.0-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/_chunks-cjs/_visual-editing.js +21 -306
- package/dist/_chunks-cjs/_visual-editing.js.map +1 -1
- package/dist/_chunks-cjs/refractor.js +27 -0
- package/dist/_chunks-cjs/refractor.js.map +1 -0
- package/dist/_chunks-es/_visual-editing.mjs +15 -302
- package/dist/_chunks-es/_visual-editing.mjs.map +1 -1
- package/dist/_chunks-es/refractor.mjs +26 -0
- package/dist/_chunks-es/refractor.mjs.map +1 -0
- package/dist/_legacy/_visual-editing.esm.js +15 -302
- package/dist/_legacy/_visual-editing.esm.js.map +1 -1
- package/dist/_legacy/refractor.esm.js +26 -0
- package/dist/_legacy/refractor.esm.js.map +1 -0
- package/package.json +2 -2
- package/src/core/primitives/code/code.tsx +7 -7
- package/src/core/primitives/code/refractor.tsx +19 -0
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var jsxRuntime = require("react/jsx-runtime"), reactCompilerRuntime = require("react-compiler-runtime"), Refractor = require("react-refractor");
|
|
3
|
+
function _interopDefaultCompat(e) {
|
|
4
|
+
return e && typeof e == "object" && "default" in e ? e : { default: e };
|
|
5
|
+
}
|
|
6
|
+
var Refractor__default = /* @__PURE__ */ _interopDefaultCompat(Refractor);
|
|
7
|
+
function LazyRefractor(props) {
|
|
8
|
+
const $ = reactCompilerRuntime.c(13), {
|
|
9
|
+
language: languageProp,
|
|
10
|
+
value
|
|
11
|
+
} = props, language = typeof languageProp == "string" ? languageProp : void 0;
|
|
12
|
+
let t0;
|
|
13
|
+
$[0] !== language ? (t0 = language ? Refractor__default.default.hasLanguage(language) : !1, $[0] = language, $[1] = t0) : t0 = $[1];
|
|
14
|
+
const registered = t0;
|
|
15
|
+
let t1;
|
|
16
|
+
$[2] !== language || $[3] !== registered || $[4] !== value ? (t1 = !(language && registered) && /* @__PURE__ */ jsxRuntime.jsx("code", { children: value }), $[2] = language, $[3] = registered, $[4] = value, $[5] = t1) : t1 = $[5];
|
|
17
|
+
let t2;
|
|
18
|
+
$[6] !== language || $[7] !== registered || $[8] !== value ? (t2 = language && registered && /* @__PURE__ */ jsxRuntime.jsx(Refractor__default.default, { inline: !0, language, value }), $[6] = language, $[7] = registered, $[8] = value, $[9] = t2) : t2 = $[9];
|
|
19
|
+
let t3;
|
|
20
|
+
return $[10] !== t1 || $[11] !== t2 ? (t3 = /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
21
|
+
t1,
|
|
22
|
+
t2
|
|
23
|
+
] }), $[10] = t1, $[11] = t2, $[12] = t3) : t3 = $[12], t3;
|
|
24
|
+
}
|
|
25
|
+
LazyRefractor.displayName = "LazyRefractor";
|
|
26
|
+
exports.default = LazyRefractor;
|
|
27
|
+
//# sourceMappingURL=refractor.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"refractor.js","sources":["../../src/core/primitives/code/refractor.tsx"],"sourcesContent":["import Refractor from 'react-refractor'\n\nexport default function LazyRefractor(\n props: Partial<Pick<React.ComponentProps<typeof Refractor>, 'language'>> &\n Pick<React.ComponentProps<typeof Refractor>, 'value'>,\n) {\n const {language: languageProp, value} = props\n const language = typeof languageProp === 'string' ? languageProp : undefined\n const registered = language ? Refractor.hasLanguage(language as any) : false\n\n return (\n <>\n {!(language && registered) && <code>{value}</code>}\n {language && registered && <Refractor inline language={language} value={value} />}\n </>\n )\n}\n\nLazyRefractor.displayName = 'LazyRefractor'\n"],"names":["LazyRefractor","props","$","_c","language","languageProp","value","undefined","t0","Refractor","hasLanguage","registered","t1","t2","jsx","t3","displayName"],"mappings":";;;;;;AAEA,SAAeA,cAAAC,OAAA;AAAAC,QAAAA,IAAAC,uBAAA,EAAA,GAIb;AAAA,IAAAC,UAAAC;AAAAA,IAAAC;AAAAA,EAAAA,IAAwCL,OACxCG,WAAiB,OAAOC,gBAAiB,WAAWA,eAAYE;AAAYC,MAAAA;AAAAN,WAAAE,YACzDI,KAAAJ,WAAWK,mBAAAA,QAAAC,YAAsBN,QAAe,IAAS,IAAAF,OAAAE,UAAAF,OAAAM,MAAAA,KAAAN,EAAA,CAAA;AAA5E,QAAAS,aAAmBH;AAAyDI,MAAAA;AAAAV,IAAAE,CAAAA,MAAAA,YAAAF,SAAAS,cAAAT,EAAA,CAAA,MAAAI,SAIvEM,KAAA,EAAER,YAAYO,sDAAsBL,EAAAA,UAAAA,MAAAA,CAAM,GAAOJ,OAAAE,UAAAF,OAAAS,YAAAT,OAAAI,OAAAJ,OAAAU,MAAAA,KAAAV,EAAA,CAAA;AAAAW,MAAAA;AAAAX,IAAAE,CAAAA,MAAAA,YAAAF,SAAAS,cAAAT,EAAA,CAAA,MAAAI,SACjDO,KAAAT,YAAYO,cAAeG,2BAAA,IAAAL,4BAAA,EAAU,QAAA,IAAiBL,UAAiBE,OAAS,GAAAJ,OAAAE,UAAAF,OAAAS,YAAAT,OAAAI,OAAAJ,OAAAW,MAAAA,KAAAX,EAAA,CAAA;AAAAa,MAAAA;AAAAb,SAAAA,EAAAU,EAAAA,MAAAA,MAAAV,UAAAW,MAFnFE,KACGH,2BAAAA,KAAAA,WAAAA,UAAAA,EAAAA,UAAAA;AAAAA,IAAAA;AAAAA,IACAC;AAAAA,EAAAA,EAAgF,CAAA,GAChFX,QAAAU,IAAAV,QAAAW,IAAAX,QAAAa,MAAAA,KAAAb,EAAA,EAAA,GAHHa;AAGG;AAIPf,cAAcgB,cAAc;;"}
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { jsx, jsxs, Fragment } from "react/jsx-runtime";
|
|
2
2
|
import { c } from "react-compiler-runtime";
|
|
3
|
-
import { useState, useEffect, useDebugValue, useMemo, useSyncExternalStore, createContext, useContext, forwardRef, useId, Children, isValidElement, cloneElement, useRef, useImperativeHandle, memo, useCallback, useLayoutEffect } from "react";
|
|
3
|
+
import { useState, useEffect, useDebugValue, useMemo, useSyncExternalStore, createContext, useContext, forwardRef, useId, Children, isValidElement, cloneElement, useRef, useImperativeHandle, lazy, Suspense, memo, useCallback, useLayoutEffect } from "react";
|
|
4
4
|
import { ThemeProvider as ThemeProvider$1, useTheme as useTheme$1, css, styled, keyframes } from "styled-components";
|
|
5
5
|
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";
|
|
6
6
|
import ReactIs, { isValidElementType } from "react-is";
|
|
7
7
|
import { SpinnerIcon, CheckmarkIcon, RemoveIcon, ChevronDownIcon, CloseIcon, ChevronRightIcon } from "@sanity/icons";
|
|
8
|
-
import Refractor from "react-refractor";
|
|
9
8
|
import { detectOverflow, flip, offset, shift, arrow, hide, useFloating, autoUpdate } from "@floating-ui/react-dom";
|
|
10
9
|
import { motion, AnimatePresence } from "framer-motion";
|
|
10
|
+
import { ResizeObserver } from "@juggle/resize-observer";
|
|
11
11
|
import { createPortal } from "react-dom";
|
|
12
12
|
import { useEffectEvent } from "use-effect-event";
|
|
13
13
|
const createColorTheme = createColorTheme$1, hexToRgb = hexToRgb$1, hslToRgb = hslToRgb$1, multiply = multiply$1, parseColor = parseColor$1, rgbToHex = rgbToHex$1, rgbToHsl = rgbToHsl$1, rgba = rgba$1, screen = screen$1, studioTheme = buildTheme(), EMPTY_ARRAY = [], EMPTY_RECORD = {}, POPOVER_MOTION_CONTENT_OPACITY_PROPERTY = "--motion-content-opacity", POPOVER_MOTION_PROPS = {
|
|
@@ -200,290 +200,6 @@ function useCustomValidity(ref, customValidity) {
|
|
|
200
200
|
let t1;
|
|
201
201
|
$[3] !== customValidity || $[4] !== ref ? (t1 = [customValidity, ref], $[3] = customValidity, $[4] = ref, $[5] = t1) : t1 = $[5], useEffect(t0, t1);
|
|
202
202
|
}
|
|
203
|
-
var resizeObservers = [], hasActiveObservations = function() {
|
|
204
|
-
return resizeObservers.some(function(ro) {
|
|
205
|
-
return ro.activeTargets.length > 0;
|
|
206
|
-
});
|
|
207
|
-
}, hasSkippedObservations = function() {
|
|
208
|
-
return resizeObservers.some(function(ro) {
|
|
209
|
-
return ro.skippedTargets.length > 0;
|
|
210
|
-
});
|
|
211
|
-
}, msg = "ResizeObserver loop completed with undelivered notifications.", deliverResizeLoopError = function() {
|
|
212
|
-
var event;
|
|
213
|
-
typeof ErrorEvent == "function" ? event = new ErrorEvent("error", {
|
|
214
|
-
message: msg
|
|
215
|
-
}) : (event = document.createEvent("Event"), event.initEvent("error", !1, !1), event.message = msg), window.dispatchEvent(event);
|
|
216
|
-
}, ResizeObserverBoxOptions;
|
|
217
|
-
(function(ResizeObserverBoxOptions2) {
|
|
218
|
-
ResizeObserverBoxOptions2.BORDER_BOX = "border-box", ResizeObserverBoxOptions2.CONTENT_BOX = "content-box", ResizeObserverBoxOptions2.DEVICE_PIXEL_CONTENT_BOX = "device-pixel-content-box";
|
|
219
|
-
})(ResizeObserverBoxOptions || (ResizeObserverBoxOptions = {}));
|
|
220
|
-
var freeze = function(obj) {
|
|
221
|
-
return Object.freeze(obj);
|
|
222
|
-
}, ResizeObserverSize = /* @__PURE__ */ function() {
|
|
223
|
-
function ResizeObserverSize2(inlineSize, blockSize) {
|
|
224
|
-
this.inlineSize = inlineSize, this.blockSize = blockSize, freeze(this);
|
|
225
|
-
}
|
|
226
|
-
return ResizeObserverSize2;
|
|
227
|
-
}(), DOMRectReadOnly = function() {
|
|
228
|
-
function DOMRectReadOnly2(x, y, width, height) {
|
|
229
|
-
return this.x = x, this.y = y, this.width = width, this.height = height, this.top = this.y, this.left = this.x, this.bottom = this.top + this.height, this.right = this.left + this.width, freeze(this);
|
|
230
|
-
}
|
|
231
|
-
return DOMRectReadOnly2.prototype.toJSON = function() {
|
|
232
|
-
var _a = this, x = _a.x, y = _a.y, top = _a.top, right = _a.right, bottom = _a.bottom, left = _a.left, width = _a.width, height = _a.height;
|
|
233
|
-
return {
|
|
234
|
-
x,
|
|
235
|
-
y,
|
|
236
|
-
top,
|
|
237
|
-
right,
|
|
238
|
-
bottom,
|
|
239
|
-
left,
|
|
240
|
-
width,
|
|
241
|
-
height
|
|
242
|
-
};
|
|
243
|
-
}, DOMRectReadOnly2.fromRect = function(rectangle) {
|
|
244
|
-
return new DOMRectReadOnly2(rectangle.x, rectangle.y, rectangle.width, rectangle.height);
|
|
245
|
-
}, DOMRectReadOnly2;
|
|
246
|
-
}(), isSVG = function(target) {
|
|
247
|
-
return target instanceof SVGElement && "getBBox" in target;
|
|
248
|
-
}, isHidden = function(target) {
|
|
249
|
-
if (isSVG(target)) {
|
|
250
|
-
var _a = target.getBBox(), width = _a.width, height = _a.height;
|
|
251
|
-
return !width && !height;
|
|
252
|
-
}
|
|
253
|
-
var _b = target, offsetWidth = _b.offsetWidth, offsetHeight = _b.offsetHeight;
|
|
254
|
-
return !(offsetWidth || offsetHeight || target.getClientRects().length);
|
|
255
|
-
}, isElement = function(obj) {
|
|
256
|
-
var _a;
|
|
257
|
-
if (obj instanceof Element)
|
|
258
|
-
return !0;
|
|
259
|
-
var scope = (_a = obj?.ownerDocument) === null || _a === void 0 ? void 0 : _a.defaultView;
|
|
260
|
-
return !!(scope && obj instanceof scope.Element);
|
|
261
|
-
}, isReplacedElement = function(target) {
|
|
262
|
-
switch (target.tagName) {
|
|
263
|
-
case "INPUT":
|
|
264
|
-
if (target.type !== "image")
|
|
265
|
-
break;
|
|
266
|
-
case "VIDEO":
|
|
267
|
-
case "AUDIO":
|
|
268
|
-
case "EMBED":
|
|
269
|
-
case "OBJECT":
|
|
270
|
-
case "CANVAS":
|
|
271
|
-
case "IFRAME":
|
|
272
|
-
case "IMG":
|
|
273
|
-
return !0;
|
|
274
|
-
}
|
|
275
|
-
return !1;
|
|
276
|
-
}, global$1 = typeof window < "u" ? window : {}, cache = /* @__PURE__ */ new WeakMap(), scrollRegexp = /auto|scroll/, verticalRegexp = /^tb|vertical/, IE = /msie|trident/i.test(global$1.navigator && global$1.navigator.userAgent), parseDimension = function(pixel) {
|
|
277
|
-
return parseFloat(pixel || "0");
|
|
278
|
-
}, size$1 = function(inlineSize, blockSize, switchSizes) {
|
|
279
|
-
return inlineSize === void 0 && (inlineSize = 0), blockSize === void 0 && (blockSize = 0), switchSizes === void 0 && (switchSizes = !1), new ResizeObserverSize((switchSizes ? blockSize : inlineSize) || 0, (switchSizes ? inlineSize : blockSize) || 0);
|
|
280
|
-
}, zeroBoxes = freeze({
|
|
281
|
-
devicePixelContentBoxSize: size$1(),
|
|
282
|
-
borderBoxSize: size$1(),
|
|
283
|
-
contentBoxSize: size$1(),
|
|
284
|
-
contentRect: new DOMRectReadOnly(0, 0, 0, 0)
|
|
285
|
-
}), calculateBoxSizes = function(target, forceRecalculation) {
|
|
286
|
-
if (forceRecalculation === void 0 && (forceRecalculation = !1), cache.has(target) && !forceRecalculation)
|
|
287
|
-
return cache.get(target);
|
|
288
|
-
if (isHidden(target))
|
|
289
|
-
return cache.set(target, zeroBoxes), zeroBoxes;
|
|
290
|
-
var cs = getComputedStyle(target), svg = isSVG(target) && target.ownerSVGElement && target.getBBox(), removePadding = !IE && cs.boxSizing === "border-box", switchSizes = verticalRegexp.test(cs.writingMode || ""), canScrollVertically = !svg && scrollRegexp.test(cs.overflowY || ""), canScrollHorizontally = !svg && scrollRegexp.test(cs.overflowX || ""), paddingTop = svg ? 0 : parseDimension(cs.paddingTop), paddingRight = svg ? 0 : parseDimension(cs.paddingRight), paddingBottom = svg ? 0 : parseDimension(cs.paddingBottom), paddingLeft = svg ? 0 : parseDimension(cs.paddingLeft), borderTop2 = svg ? 0 : parseDimension(cs.borderTopWidth), borderRight2 = svg ? 0 : parseDimension(cs.borderRightWidth), borderBottom2 = svg ? 0 : parseDimension(cs.borderBottomWidth), borderLeft2 = svg ? 0 : parseDimension(cs.borderLeftWidth), horizontalPadding = paddingLeft + paddingRight, verticalPadding = paddingTop + paddingBottom, horizontalBorderArea = borderLeft2 + borderRight2, verticalBorderArea = borderTop2 + borderBottom2, horizontalScrollbarThickness = canScrollHorizontally ? target.offsetHeight - verticalBorderArea - target.clientHeight : 0, verticalScrollbarThickness = canScrollVertically ? target.offsetWidth - horizontalBorderArea - target.clientWidth : 0, widthReduction = removePadding ? horizontalPadding + horizontalBorderArea : 0, heightReduction = removePadding ? verticalPadding + verticalBorderArea : 0, contentWidth = svg ? svg.width : parseDimension(cs.width) - widthReduction - verticalScrollbarThickness, contentHeight = svg ? svg.height : parseDimension(cs.height) - heightReduction - horizontalScrollbarThickness, borderBoxWidth = contentWidth + horizontalPadding + verticalScrollbarThickness + horizontalBorderArea, borderBoxHeight = contentHeight + verticalPadding + horizontalScrollbarThickness + verticalBorderArea, boxes = freeze({
|
|
291
|
-
devicePixelContentBoxSize: size$1(Math.round(contentWidth * devicePixelRatio), Math.round(contentHeight * devicePixelRatio), switchSizes),
|
|
292
|
-
borderBoxSize: size$1(borderBoxWidth, borderBoxHeight, switchSizes),
|
|
293
|
-
contentBoxSize: size$1(contentWidth, contentHeight, switchSizes),
|
|
294
|
-
contentRect: new DOMRectReadOnly(paddingLeft, paddingTop, contentWidth, contentHeight)
|
|
295
|
-
});
|
|
296
|
-
return cache.set(target, boxes), boxes;
|
|
297
|
-
}, calculateBoxSize = function(target, observedBox, forceRecalculation) {
|
|
298
|
-
var _a = calculateBoxSizes(target, forceRecalculation), borderBoxSize = _a.borderBoxSize, contentBoxSize = _a.contentBoxSize, devicePixelContentBoxSize = _a.devicePixelContentBoxSize;
|
|
299
|
-
switch (observedBox) {
|
|
300
|
-
case ResizeObserverBoxOptions.DEVICE_PIXEL_CONTENT_BOX:
|
|
301
|
-
return devicePixelContentBoxSize;
|
|
302
|
-
case ResizeObserverBoxOptions.BORDER_BOX:
|
|
303
|
-
return borderBoxSize;
|
|
304
|
-
default:
|
|
305
|
-
return contentBoxSize;
|
|
306
|
-
}
|
|
307
|
-
}, ResizeObserverEntry = /* @__PURE__ */ function() {
|
|
308
|
-
function ResizeObserverEntry2(target) {
|
|
309
|
-
var boxes = calculateBoxSizes(target);
|
|
310
|
-
this.target = target, this.contentRect = boxes.contentRect, this.borderBoxSize = freeze([boxes.borderBoxSize]), this.contentBoxSize = freeze([boxes.contentBoxSize]), this.devicePixelContentBoxSize = freeze([boxes.devicePixelContentBoxSize]);
|
|
311
|
-
}
|
|
312
|
-
return ResizeObserverEntry2;
|
|
313
|
-
}(), calculateDepthForNode = function(node) {
|
|
314
|
-
if (isHidden(node))
|
|
315
|
-
return 1 / 0;
|
|
316
|
-
for (var depth = 0, parent = node.parentNode; parent; )
|
|
317
|
-
depth += 1, parent = parent.parentNode;
|
|
318
|
-
return depth;
|
|
319
|
-
}, broadcastActiveObservations = function() {
|
|
320
|
-
var shallowestDepth = 1 / 0, callbacks2 = [];
|
|
321
|
-
resizeObservers.forEach(function(ro) {
|
|
322
|
-
if (ro.activeTargets.length !== 0) {
|
|
323
|
-
var entries = [];
|
|
324
|
-
ro.activeTargets.forEach(function(ot) {
|
|
325
|
-
var entry = new ResizeObserverEntry(ot.target), targetDepth = calculateDepthForNode(ot.target);
|
|
326
|
-
entries.push(entry), ot.lastReportedSize = calculateBoxSize(ot.target, ot.observedBox), targetDepth < shallowestDepth && (shallowestDepth = targetDepth);
|
|
327
|
-
}), callbacks2.push(function() {
|
|
328
|
-
ro.callback.call(ro.observer, entries, ro.observer);
|
|
329
|
-
}), ro.activeTargets.splice(0, ro.activeTargets.length);
|
|
330
|
-
}
|
|
331
|
-
});
|
|
332
|
-
for (var _i = 0, callbacks_1 = callbacks2; _i < callbacks_1.length; _i++) {
|
|
333
|
-
var callback = callbacks_1[_i];
|
|
334
|
-
callback();
|
|
335
|
-
}
|
|
336
|
-
return shallowestDepth;
|
|
337
|
-
}, gatherActiveObservationsAtDepth = function(depth) {
|
|
338
|
-
resizeObservers.forEach(function(ro) {
|
|
339
|
-
ro.activeTargets.splice(0, ro.activeTargets.length), ro.skippedTargets.splice(0, ro.skippedTargets.length), ro.observationTargets.forEach(function(ot) {
|
|
340
|
-
ot.isActive() && (calculateDepthForNode(ot.target) > depth ? ro.activeTargets.push(ot) : ro.skippedTargets.push(ot));
|
|
341
|
-
});
|
|
342
|
-
});
|
|
343
|
-
}, process = function() {
|
|
344
|
-
var depth = 0;
|
|
345
|
-
for (gatherActiveObservationsAtDepth(depth); hasActiveObservations(); )
|
|
346
|
-
depth = broadcastActiveObservations(), gatherActiveObservationsAtDepth(depth);
|
|
347
|
-
return hasSkippedObservations() && deliverResizeLoopError(), depth > 0;
|
|
348
|
-
}, trigger, callbacks = [], notify = function() {
|
|
349
|
-
return callbacks.splice(0).forEach(function(cb) {
|
|
350
|
-
return cb();
|
|
351
|
-
});
|
|
352
|
-
}, queueMicroTask = function(callback) {
|
|
353
|
-
if (!trigger) {
|
|
354
|
-
var toggle_1 = 0, el_1 = document.createTextNode(""), config = {
|
|
355
|
-
characterData: !0
|
|
356
|
-
};
|
|
357
|
-
new MutationObserver(function() {
|
|
358
|
-
return notify();
|
|
359
|
-
}).observe(el_1, config), trigger = function() {
|
|
360
|
-
el_1.textContent = "".concat(toggle_1 ? toggle_1-- : toggle_1++);
|
|
361
|
-
};
|
|
362
|
-
}
|
|
363
|
-
callbacks.push(callback), trigger();
|
|
364
|
-
}, queueResizeObserver = function(cb) {
|
|
365
|
-
queueMicroTask(function() {
|
|
366
|
-
requestAnimationFrame(cb);
|
|
367
|
-
});
|
|
368
|
-
}, watching = 0, isWatching = function() {
|
|
369
|
-
return !!watching;
|
|
370
|
-
}, CATCH_PERIOD = 250, observerConfig = {
|
|
371
|
-
attributes: !0,
|
|
372
|
-
characterData: !0,
|
|
373
|
-
childList: !0,
|
|
374
|
-
subtree: !0
|
|
375
|
-
}, events = ["resize", "load", "transitionend", "animationend", "animationstart", "animationiteration", "keyup", "keydown", "mouseup", "mousedown", "mouseover", "mouseout", "blur", "focus"], time = function(timeout) {
|
|
376
|
-
return timeout === void 0 && (timeout = 0), Date.now() + timeout;
|
|
377
|
-
}, scheduled = !1, Scheduler = function() {
|
|
378
|
-
function Scheduler2() {
|
|
379
|
-
var _this = this;
|
|
380
|
-
this.stopped = !0, this.listener = function() {
|
|
381
|
-
return _this.schedule();
|
|
382
|
-
};
|
|
383
|
-
}
|
|
384
|
-
return Scheduler2.prototype.run = function(timeout) {
|
|
385
|
-
var _this = this;
|
|
386
|
-
if (timeout === void 0 && (timeout = CATCH_PERIOD), !scheduled) {
|
|
387
|
-
scheduled = !0;
|
|
388
|
-
var until = time(timeout);
|
|
389
|
-
queueResizeObserver(function() {
|
|
390
|
-
var elementsHaveResized = !1;
|
|
391
|
-
try {
|
|
392
|
-
elementsHaveResized = process();
|
|
393
|
-
} finally {
|
|
394
|
-
if (scheduled = !1, timeout = until - time(), !isWatching())
|
|
395
|
-
return;
|
|
396
|
-
elementsHaveResized ? _this.run(1e3) : timeout > 0 ? _this.run(timeout) : _this.start();
|
|
397
|
-
}
|
|
398
|
-
});
|
|
399
|
-
}
|
|
400
|
-
}, Scheduler2.prototype.schedule = function() {
|
|
401
|
-
this.stop(), this.run();
|
|
402
|
-
}, Scheduler2.prototype.observe = function() {
|
|
403
|
-
var _this = this, cb = function() {
|
|
404
|
-
return _this.observer && _this.observer.observe(document.body, observerConfig);
|
|
405
|
-
};
|
|
406
|
-
document.body ? cb() : global$1.addEventListener("DOMContentLoaded", cb);
|
|
407
|
-
}, Scheduler2.prototype.start = function() {
|
|
408
|
-
var _this = this;
|
|
409
|
-
this.stopped && (this.stopped = !1, this.observer = new MutationObserver(this.listener), this.observe(), events.forEach(function(name) {
|
|
410
|
-
return global$1.addEventListener(name, _this.listener, !0);
|
|
411
|
-
}));
|
|
412
|
-
}, Scheduler2.prototype.stop = function() {
|
|
413
|
-
var _this = this;
|
|
414
|
-
this.stopped || (this.observer && this.observer.disconnect(), events.forEach(function(name) {
|
|
415
|
-
return global$1.removeEventListener(name, _this.listener, !0);
|
|
416
|
-
}), this.stopped = !0);
|
|
417
|
-
}, Scheduler2;
|
|
418
|
-
}(), scheduler = new Scheduler(), updateCount = function(n) {
|
|
419
|
-
!watching && n > 0 && scheduler.start(), watching += n, !watching && scheduler.stop();
|
|
420
|
-
}, skipNotifyOnElement = function(target) {
|
|
421
|
-
return !isSVG(target) && !isReplacedElement(target) && getComputedStyle(target).display === "inline";
|
|
422
|
-
}, ResizeObservation = function() {
|
|
423
|
-
function ResizeObservation2(target, observedBox) {
|
|
424
|
-
this.target = target, this.observedBox = observedBox || ResizeObserverBoxOptions.CONTENT_BOX, this.lastReportedSize = {
|
|
425
|
-
inlineSize: 0,
|
|
426
|
-
blockSize: 0
|
|
427
|
-
};
|
|
428
|
-
}
|
|
429
|
-
return ResizeObservation2.prototype.isActive = function() {
|
|
430
|
-
var size2 = calculateBoxSize(this.target, this.observedBox, !0);
|
|
431
|
-
return skipNotifyOnElement(this.target) && (this.lastReportedSize = size2), this.lastReportedSize.inlineSize !== size2.inlineSize || this.lastReportedSize.blockSize !== size2.blockSize;
|
|
432
|
-
}, ResizeObservation2;
|
|
433
|
-
}(), ResizeObserverDetail = /* @__PURE__ */ function() {
|
|
434
|
-
function ResizeObserverDetail2(resizeObserver, callback) {
|
|
435
|
-
this.activeTargets = [], this.skippedTargets = [], this.observationTargets = [], this.observer = resizeObserver, this.callback = callback;
|
|
436
|
-
}
|
|
437
|
-
return ResizeObserverDetail2;
|
|
438
|
-
}(), observerMap = /* @__PURE__ */ new WeakMap(), getObservationIndex = function(observationTargets, target) {
|
|
439
|
-
for (var i = 0; i < observationTargets.length; i += 1)
|
|
440
|
-
if (observationTargets[i].target === target)
|
|
441
|
-
return i;
|
|
442
|
-
return -1;
|
|
443
|
-
}, ResizeObserverController = function() {
|
|
444
|
-
function ResizeObserverController2() {
|
|
445
|
-
}
|
|
446
|
-
return ResizeObserverController2.connect = function(resizeObserver, callback) {
|
|
447
|
-
var detail = new ResizeObserverDetail(resizeObserver, callback);
|
|
448
|
-
observerMap.set(resizeObserver, detail);
|
|
449
|
-
}, ResizeObserverController2.observe = function(resizeObserver, target, options) {
|
|
450
|
-
var detail = observerMap.get(resizeObserver), firstObservation = detail.observationTargets.length === 0;
|
|
451
|
-
getObservationIndex(detail.observationTargets, target) < 0 && (firstObservation && resizeObservers.push(detail), detail.observationTargets.push(new ResizeObservation(target, options && options.box)), updateCount(1), scheduler.schedule());
|
|
452
|
-
}, ResizeObserverController2.unobserve = function(resizeObserver, target) {
|
|
453
|
-
var detail = observerMap.get(resizeObserver), index = getObservationIndex(detail.observationTargets, target), lastObservation = detail.observationTargets.length === 1;
|
|
454
|
-
index >= 0 && (lastObservation && resizeObservers.splice(resizeObservers.indexOf(detail), 1), detail.observationTargets.splice(index, 1), updateCount(-1));
|
|
455
|
-
}, ResizeObserverController2.disconnect = function(resizeObserver) {
|
|
456
|
-
var _this = this, detail = observerMap.get(resizeObserver);
|
|
457
|
-
detail.observationTargets.slice().forEach(function(ot) {
|
|
458
|
-
return _this.unobserve(resizeObserver, ot.target);
|
|
459
|
-
}), detail.activeTargets.splice(0, detail.activeTargets.length);
|
|
460
|
-
}, ResizeObserverController2;
|
|
461
|
-
}(), ResizeObserver = function() {
|
|
462
|
-
function ResizeObserver2(callback) {
|
|
463
|
-
if (arguments.length === 0)
|
|
464
|
-
throw new TypeError("Failed to construct 'ResizeObserver': 1 argument required, but only 0 present.");
|
|
465
|
-
if (typeof callback != "function")
|
|
466
|
-
throw new TypeError("Failed to construct 'ResizeObserver': The callback provided as parameter 1 is not a function.");
|
|
467
|
-
ResizeObserverController.connect(this, callback);
|
|
468
|
-
}
|
|
469
|
-
return ResizeObserver2.prototype.observe = function(target, options) {
|
|
470
|
-
if (arguments.length === 0)
|
|
471
|
-
throw new TypeError("Failed to execute 'observe' on 'ResizeObserver': 1 argument required, but only 0 present.");
|
|
472
|
-
if (!isElement(target))
|
|
473
|
-
throw new TypeError("Failed to execute 'observe' on 'ResizeObserver': parameter 1 is not of type 'Element");
|
|
474
|
-
ResizeObserverController.observe(this, target, options);
|
|
475
|
-
}, ResizeObserver2.prototype.unobserve = function(target) {
|
|
476
|
-
if (arguments.length === 0)
|
|
477
|
-
throw new TypeError("Failed to execute 'unobserve' on 'ResizeObserver': 1 argument required, but only 0 present.");
|
|
478
|
-
if (!isElement(target))
|
|
479
|
-
throw new TypeError("Failed to execute 'unobserve' on 'ResizeObserver': parameter 1 is not of type 'Element");
|
|
480
|
-
ResizeObserverController.unobserve(this, target);
|
|
481
|
-
}, ResizeObserver2.prototype.disconnect = function() {
|
|
482
|
-
ResizeObserverController.disconnect(this);
|
|
483
|
-
}, ResizeObserver2.toString = function() {
|
|
484
|
-
return "function ResizeObserver () { [polyfill code] }";
|
|
485
|
-
}, ResizeObserver2;
|
|
486
|
-
}();
|
|
487
203
|
const _ResizeObserver = typeof document < "u" && typeof window < "u" && window.ResizeObserver ? window.ResizeObserver : ResizeObserver, _elementSizeObserver = _createElementSizeObserver();
|
|
488
204
|
function _createElementRectValueListener() {
|
|
489
205
|
return {
|
|
@@ -2745,32 +2461,29 @@ function codeBaseStyle() {
|
|
|
2745
2461
|
}
|
|
2746
2462
|
`;
|
|
2747
2463
|
}
|
|
2748
|
-
const StyledCode = /* @__PURE__ */ styled.pre.withConfig({
|
|
2464
|
+
const LazyRefractor = lazy(() => import("./refractor.mjs")), StyledCode = /* @__PURE__ */ styled.pre.withConfig({
|
|
2749
2465
|
displayName: "StyledCode",
|
|
2750
2466
|
componentId: "sc-4dymyn-0"
|
|
2751
2467
|
})(codeBaseStyle, responsiveCodeFontStyle), Code = forwardRef(function(props, ref) {
|
|
2752
|
-
const $ = c(
|
|
2753
|
-
let children,
|
|
2468
|
+
const $ = c(20);
|
|
2469
|
+
let children, language, restProps, t0, weight;
|
|
2754
2470
|
$[0] !== props ? ({
|
|
2755
2471
|
children,
|
|
2756
|
-
language
|
|
2472
|
+
language,
|
|
2757
2473
|
size: t0,
|
|
2758
2474
|
weight,
|
|
2759
2475
|
...restProps
|
|
2760
|
-
} = props, $[0] = props, $[1] = children, $[2] =
|
|
2761
|
-
const
|
|
2762
|
-
let
|
|
2763
|
-
$[6] !==
|
|
2764
|
-
const
|
|
2765
|
-
let t3;
|
|
2766
|
-
$[8] !== children || $[9] !== language || $[10] !== registered ? (t3 = !(language && registered) && /* @__PURE__ */ jsx("code", { children }), $[8] = children, $[9] = language, $[10] = registered, $[11] = t3) : t3 = $[11];
|
|
2476
|
+
} = props, $[0] = props, $[1] = children, $[2] = language, $[3] = restProps, $[4] = t0, $[5] = weight) : (children = $[1], language = $[2], restProps = $[3], t0 = $[4], weight = $[5]);
|
|
2477
|
+
const t1 = useArrayProp(t0 === void 0 ? 2 : t0);
|
|
2478
|
+
let t2;
|
|
2479
|
+
$[6] !== children ? (t2 = /* @__PURE__ */ jsx("code", { children }), $[6] = children, $[7] = t2) : t2 = $[7];
|
|
2480
|
+
const t3 = String(children);
|
|
2767
2481
|
let t4;
|
|
2768
|
-
$[
|
|
2482
|
+
$[8] !== language || $[9] !== t3 ? (t4 = /* @__PURE__ */ jsx(LazyRefractor, { language, value: t3 }), $[8] = language, $[9] = t3, $[10] = t4) : t4 = $[10];
|
|
2769
2483
|
let t5;
|
|
2770
|
-
|
|
2771
|
-
|
|
2772
|
-
|
|
2773
|
-
] }), $[16] = ref, $[17] = restProps, $[18] = t2, $[19] = t3, $[20] = t4, $[21] = weight, $[22] = t5) : t5 = $[22], t5;
|
|
2484
|
+
$[11] !== t2 || $[12] !== t4 ? (t5 = /* @__PURE__ */ jsx(Suspense, { fallback: t2, children: t4 }), $[11] = t2, $[12] = t4, $[13] = t5) : t5 = $[13];
|
|
2485
|
+
let t6;
|
|
2486
|
+
return $[14] !== ref || $[15] !== restProps || $[16] !== t1 || $[17] !== t5 || $[18] !== weight ? (t6 = /* @__PURE__ */ jsx(StyledCode, { "data-ui": "Code", ...restProps, $size: t1, $weight: weight, ref, children: t5 }), $[14] = ref, $[15] = restProps, $[16] = t1, $[17] = t5, $[18] = weight, $[19] = t6) : t6 = $[19], t6;
|
|
2774
2487
|
});
|
|
2775
2488
|
Code.displayName = "ForwardRef(Code)";
|
|
2776
2489
|
const BASE_STYLE$1 = {
|