@underverse-ui/underverse 2.0.14 → 2.0.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.
- package/api-reference.json +1 -1
- package/dist/{EmojiPicker-CGMUDB4I.js → EmojiPicker-3X2S7XPP.js} +4 -4
- package/dist/{chunk-DCFQGH3K.js → chunk-D22TNGE5.js} +3 -3
- package/dist/{chunk-PV2G2XME.js → chunk-EPBYGZHZ.js} +94 -58
- package/dist/chunk-EPBYGZHZ.js.map +1 -0
- package/dist/{chunk-N2S6RI4Y.js → chunk-HTGAV4IG.js} +3 -3
- package/dist/{chunk-PDYEK7HL.js → chunk-NWVDNVLR.js} +224 -157
- package/dist/chunk-NWVDNVLR.js.map +1 -0
- package/dist/{chunk-DXLSCUYA.js → chunk-SKCO2GFM.js} +2 -2
- package/dist/{chunk-3Q5EE2ZA.js → chunk-WEGE3MZ5.js} +85 -65
- package/dist/chunk-WEGE3MZ5.js.map +1 -0
- package/dist/index.cjs +3137 -3007
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +6 -6
- package/dist/{menu-bar-55SAOAX6.js → menu-bar-YMEOEYJS.js} +4 -4
- package/dist/ueditor.cjs +1106 -976
- package/dist/ueditor.cjs.map +1 -1
- package/dist/ueditor.d.cts +2 -0
- package/dist/ueditor.d.ts +2 -0
- package/dist/ueditor.js +4 -4
- package/package.json +1 -1
- package/dist/chunk-3Q5EE2ZA.js.map +0 -1
- package/dist/chunk-PDYEK7HL.js.map +0 -1
- package/dist/chunk-PV2G2XME.js.map +0 -1
- /package/dist/{EmojiPicker-CGMUDB4I.js.map → EmojiPicker-3X2S7XPP.js.map} +0 -0
- /package/dist/{chunk-DCFQGH3K.js.map → chunk-D22TNGE5.js.map} +0 -0
- /package/dist/{chunk-N2S6RI4Y.js.map → chunk-HTGAV4IG.js.map} +0 -0
- /package/dist/{chunk-DXLSCUYA.js.map → chunk-SKCO2GFM.js.map} +0 -0
- /package/dist/{menu-bar-55SAOAX6.js.map → menu-bar-YMEOEYJS.js.map} +0 -0
package/api-reference.json
CHANGED
|
@@ -2,13 +2,13 @@
|
|
|
2
2
|
import {
|
|
3
3
|
EmojiPicker,
|
|
4
4
|
EmojiPicker_default
|
|
5
|
-
} from "./chunk-
|
|
6
|
-
import "./chunk-
|
|
5
|
+
} from "./chunk-HTGAV4IG.js";
|
|
6
|
+
import "./chunk-SKCO2GFM.js";
|
|
7
7
|
import "./chunk-4TYW5K4J.js";
|
|
8
|
-
import "./chunk-
|
|
8
|
+
import "./chunk-EPBYGZHZ.js";
|
|
9
9
|
import "./chunk-NSBPE2FW.js";
|
|
10
10
|
export {
|
|
11
11
|
EmojiPicker,
|
|
12
12
|
EmojiPicker_default as default
|
|
13
13
|
};
|
|
14
|
-
//# sourceMappingURL=EmojiPicker-
|
|
14
|
+
//# sourceMappingURL=EmojiPicker-3X2S7XPP.js.map
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import {
|
|
2
2
|
getPanelBorderRadiusClass,
|
|
3
3
|
useUnderverseUIConfig
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-WEGE3MZ5.js";
|
|
5
5
|
import {
|
|
6
6
|
cn,
|
|
7
7
|
useGlobalI18n
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-EPBYGZHZ.js";
|
|
9
9
|
|
|
10
10
|
// src/components/Modal.tsx
|
|
11
11
|
import * as React from "react";
|
|
@@ -196,4 +196,4 @@ var Modal_default = Modal;
|
|
|
196
196
|
export {
|
|
197
197
|
Modal_default
|
|
198
198
|
};
|
|
199
|
-
//# sourceMappingURL=chunk-
|
|
199
|
+
//# sourceMappingURL=chunk-D22TNGE5.js.map
|
|
@@ -2145,7 +2145,7 @@ function useSmartLocale() {
|
|
|
2145
2145
|
}
|
|
2146
2146
|
|
|
2147
2147
|
// src/components/Tooltip.tsx
|
|
2148
|
-
import * as
|
|
2148
|
+
import * as React6 from "react";
|
|
2149
2149
|
import { createPortal } from "react-dom";
|
|
2150
2150
|
|
|
2151
2151
|
// src/hooks/useHydrated.ts
|
|
@@ -2178,8 +2178,33 @@ function mergeRefs(...refs) {
|
|
|
2178
2178
|
};
|
|
2179
2179
|
}
|
|
2180
2180
|
|
|
2181
|
+
// src/components/UEditor/portal-context.tsx
|
|
2182
|
+
import * as React5 from "react";
|
|
2183
|
+
import { jsx as jsx5 } from "react/jsx-runtime";
|
|
2184
|
+
var UEditorPortalContext = React5.createContext(void 0);
|
|
2185
|
+
function UEditorPortalProvider({
|
|
2186
|
+
children,
|
|
2187
|
+
getPortalContainer
|
|
2188
|
+
}) {
|
|
2189
|
+
return /* @__PURE__ */ jsx5(UEditorPortalContext.Provider, { value: getPortalContainer, children });
|
|
2190
|
+
}
|
|
2191
|
+
function useUEditorPortalContainerGetter() {
|
|
2192
|
+
return React5.useContext(UEditorPortalContext);
|
|
2193
|
+
}
|
|
2194
|
+
function resolveUEditorPortalContainer(getPortalContainer) {
|
|
2195
|
+
if (typeof document === "undefined") return null;
|
|
2196
|
+
if (getPortalContainer) {
|
|
2197
|
+
try {
|
|
2198
|
+
const container = getPortalContainer();
|
|
2199
|
+
if (container) return container;
|
|
2200
|
+
} catch {
|
|
2201
|
+
}
|
|
2202
|
+
}
|
|
2203
|
+
return document.body;
|
|
2204
|
+
}
|
|
2205
|
+
|
|
2181
2206
|
// src/components/Tooltip.tsx
|
|
2182
|
-
import { Fragment as Fragment2, jsx as
|
|
2207
|
+
import { Fragment as Fragment2, jsx as jsx6, jsxs } from "react/jsx-runtime";
|
|
2183
2208
|
var variantStyles = {
|
|
2184
2209
|
default: "bg-popover text-popover-foreground border-border/50",
|
|
2185
2210
|
info: "bg-info text-info-foreground border-info/20",
|
|
@@ -2232,7 +2257,7 @@ function computeTooltipPosition(args) {
|
|
|
2232
2257
|
top = clamp(top, padding, viewport.height - contentSize.height - padding);
|
|
2233
2258
|
return { top, left, side };
|
|
2234
2259
|
}
|
|
2235
|
-
var Tooltip =
|
|
2260
|
+
var Tooltip = React6.forwardRef(({
|
|
2236
2261
|
children,
|
|
2237
2262
|
content,
|
|
2238
2263
|
placement = "top",
|
|
@@ -2243,27 +2268,31 @@ var Tooltip = React5.forwardRef(({
|
|
|
2243
2268
|
asChild = true,
|
|
2244
2269
|
...triggerPassthroughProps
|
|
2245
2270
|
}, forwardedRef) => {
|
|
2246
|
-
const [isOpen, setIsOpen] =
|
|
2271
|
+
const [isOpen, setIsOpen] = React6.useState(false);
|
|
2247
2272
|
const isMounted = useHydrated();
|
|
2248
|
-
const triggerRef =
|
|
2249
|
-
const positionerRef =
|
|
2250
|
-
const panelRef =
|
|
2251
|
-
const timeoutRef =
|
|
2252
|
-
const lastAppliedRef =
|
|
2253
|
-
const openedByPointerRef =
|
|
2254
|
-
const triggerSelector =
|
|
2273
|
+
const triggerRef = React6.useRef(null);
|
|
2274
|
+
const positionerRef = React6.useRef(null);
|
|
2275
|
+
const panelRef = React6.useRef(null);
|
|
2276
|
+
const timeoutRef = React6.useRef(void 0);
|
|
2277
|
+
const lastAppliedRef = React6.useRef(null);
|
|
2278
|
+
const openedByPointerRef = React6.useRef(false);
|
|
2279
|
+
const triggerSelector = React6.useId();
|
|
2280
|
+
const getPortalContainer = useUEditorPortalContainerGetter();
|
|
2281
|
+
const portalContainer = isOpen ? resolveUEditorPortalContainer(getPortalContainer) : null;
|
|
2282
|
+
const portalDocument = portalContainer?.ownerDocument ?? null;
|
|
2283
|
+
const portalWindow = portalDocument?.defaultView ?? null;
|
|
2255
2284
|
const delayOpen = typeof delay === "object" ? delay.open || 700 : delay;
|
|
2256
2285
|
const delayClose = typeof delay === "object" ? delay.close || 300 : delay;
|
|
2257
2286
|
const offset = 8;
|
|
2258
2287
|
const padding = 8;
|
|
2259
|
-
|
|
2288
|
+
React6.useLayoutEffect(() => {
|
|
2260
2289
|
if (typeof document === "undefined") return;
|
|
2261
2290
|
const triggerEl = document.querySelector(`[data-underverse-tooltip-trigger="${triggerSelector}"]`);
|
|
2262
2291
|
if (triggerEl) {
|
|
2263
2292
|
triggerRef.current = triggerEl;
|
|
2264
2293
|
}
|
|
2265
2294
|
}, [children, triggerSelector]);
|
|
2266
|
-
const updatePosition =
|
|
2295
|
+
const updatePosition = React6.useCallback(() => {
|
|
2267
2296
|
const triggerEl = triggerRef.current;
|
|
2268
2297
|
const positionerEl = positionerRef.current;
|
|
2269
2298
|
const panelEl = panelRef.current;
|
|
@@ -2280,7 +2309,10 @@ var Tooltip = React5.forwardRef(({
|
|
|
2280
2309
|
placement,
|
|
2281
2310
|
offset,
|
|
2282
2311
|
padding,
|
|
2283
|
-
viewport: {
|
|
2312
|
+
viewport: {
|
|
2313
|
+
width: portalWindow?.innerWidth ?? window.innerWidth,
|
|
2314
|
+
height: portalWindow?.innerHeight ?? window.innerHeight
|
|
2315
|
+
}
|
|
2284
2316
|
});
|
|
2285
2317
|
const top = Math.round(next.top);
|
|
2286
2318
|
const left = Math.round(next.left);
|
|
@@ -2291,7 +2323,7 @@ var Tooltip = React5.forwardRef(({
|
|
|
2291
2323
|
positionerEl.style.transform = `translate3d(${left}px, ${top}px, 0)`;
|
|
2292
2324
|
panelEl.style.transformOrigin = getTransformOrigin(next.side);
|
|
2293
2325
|
if (positionerEl.style.visibility !== "visible") positionerEl.style.visibility = "visible";
|
|
2294
|
-
}, [placement]);
|
|
2326
|
+
}, [placement, portalWindow]);
|
|
2295
2327
|
const handleMouseEnter = () => {
|
|
2296
2328
|
if (disabled) return;
|
|
2297
2329
|
openedByPointerRef.current = true;
|
|
@@ -2306,7 +2338,7 @@ var Tooltip = React5.forwardRef(({
|
|
|
2306
2338
|
setIsOpen(false);
|
|
2307
2339
|
}, delayClose);
|
|
2308
2340
|
};
|
|
2309
|
-
const closeNow =
|
|
2341
|
+
const closeNow = React6.useCallback(() => {
|
|
2310
2342
|
clearTimeout(timeoutRef.current);
|
|
2311
2343
|
openedByPointerRef.current = false;
|
|
2312
2344
|
setIsOpen(false);
|
|
@@ -2320,58 +2352,59 @@ var Tooltip = React5.forwardRef(({
|
|
|
2320
2352
|
openedByPointerRef.current = false;
|
|
2321
2353
|
setIsOpen(false);
|
|
2322
2354
|
};
|
|
2323
|
-
|
|
2355
|
+
React6.useEffect(() => {
|
|
2324
2356
|
return () => clearTimeout(timeoutRef.current);
|
|
2325
2357
|
}, []);
|
|
2326
|
-
|
|
2358
|
+
React6.useEffect(() => {
|
|
2327
2359
|
if (isOpen) return;
|
|
2328
2360
|
clearTimeout(timeoutRef.current);
|
|
2329
2361
|
}, [isOpen]);
|
|
2330
|
-
|
|
2331
|
-
if (!isOpen) {
|
|
2362
|
+
React6.useLayoutEffect(() => {
|
|
2363
|
+
if (!isOpen || !portalWindow) {
|
|
2332
2364
|
lastAppliedRef.current = null;
|
|
2333
2365
|
return;
|
|
2334
2366
|
}
|
|
2335
2367
|
updatePosition();
|
|
2336
2368
|
let raf1 = 0;
|
|
2337
2369
|
let raf2 = 0;
|
|
2338
|
-
raf1 =
|
|
2370
|
+
raf1 = portalWindow.requestAnimationFrame(() => {
|
|
2339
2371
|
updatePosition();
|
|
2340
|
-
raf2 =
|
|
2372
|
+
raf2 = portalWindow.requestAnimationFrame(() => updatePosition());
|
|
2341
2373
|
});
|
|
2342
2374
|
return () => {
|
|
2343
|
-
cancelAnimationFrame(raf1);
|
|
2344
|
-
cancelAnimationFrame(raf2);
|
|
2375
|
+
portalWindow.cancelAnimationFrame(raf1);
|
|
2376
|
+
portalWindow.cancelAnimationFrame(raf2);
|
|
2345
2377
|
};
|
|
2346
|
-
}, [isOpen, updatePosition]);
|
|
2347
|
-
|
|
2348
|
-
if (!isOpen) return;
|
|
2378
|
+
}, [isOpen, portalWindow, updatePosition]);
|
|
2379
|
+
React6.useEffect(() => {
|
|
2380
|
+
if (!isOpen || !portalDocument || !portalWindow) return;
|
|
2349
2381
|
let raf = 0;
|
|
2350
2382
|
const handler = () => {
|
|
2351
|
-
cancelAnimationFrame(raf);
|
|
2352
|
-
raf =
|
|
2383
|
+
portalWindow.cancelAnimationFrame(raf);
|
|
2384
|
+
raf = portalWindow.requestAnimationFrame(() => updatePosition());
|
|
2353
2385
|
};
|
|
2354
2386
|
handler();
|
|
2355
|
-
|
|
2356
|
-
|
|
2357
|
-
|
|
2387
|
+
portalWindow.addEventListener("resize", handler);
|
|
2388
|
+
portalWindow.addEventListener("scroll", handler, true);
|
|
2389
|
+
portalDocument.addEventListener("scroll", handler, true);
|
|
2358
2390
|
return () => {
|
|
2359
|
-
cancelAnimationFrame(raf);
|
|
2360
|
-
|
|
2361
|
-
|
|
2362
|
-
|
|
2391
|
+
portalWindow.cancelAnimationFrame(raf);
|
|
2392
|
+
portalWindow.removeEventListener("resize", handler);
|
|
2393
|
+
portalWindow.removeEventListener("scroll", handler, true);
|
|
2394
|
+
portalDocument.removeEventListener("scroll", handler, true);
|
|
2363
2395
|
};
|
|
2364
|
-
}, [isOpen, updatePosition]);
|
|
2365
|
-
|
|
2366
|
-
if (!isOpen) return;
|
|
2367
|
-
|
|
2368
|
-
|
|
2396
|
+
}, [isOpen, portalDocument, portalWindow, updatePosition]);
|
|
2397
|
+
React6.useEffect(() => {
|
|
2398
|
+
if (!isOpen || !portalWindow) return;
|
|
2399
|
+
const ResizeObserverCtor = portalWindow.ResizeObserver;
|
|
2400
|
+
if (!ResizeObserverCtor) return;
|
|
2401
|
+
const ro = new ResizeObserverCtor(() => updatePosition());
|
|
2369
2402
|
if (triggerRef.current) ro.observe(triggerRef.current);
|
|
2370
2403
|
if (panelRef.current) ro.observe(panelRef.current);
|
|
2371
2404
|
return () => ro.disconnect();
|
|
2372
|
-
}, [isOpen, updatePosition]);
|
|
2373
|
-
|
|
2374
|
-
if (!isOpen) return;
|
|
2405
|
+
}, [isOpen, portalWindow, updatePosition]);
|
|
2406
|
+
React6.useEffect(() => {
|
|
2407
|
+
if (!isOpen || !portalDocument) return;
|
|
2375
2408
|
const handleDocumentKeyDown = (event) => {
|
|
2376
2409
|
if (event.key === "Escape") closeNow();
|
|
2377
2410
|
};
|
|
@@ -2387,15 +2420,15 @@ var Tooltip = React5.forwardRef(({
|
|
|
2387
2420
|
const insideTrigger = event.clientX >= rect.left - tolerance && event.clientX <= rect.right + tolerance && event.clientY >= rect.top - tolerance && event.clientY <= rect.bottom + tolerance;
|
|
2388
2421
|
if (!insideTrigger) closeNow();
|
|
2389
2422
|
};
|
|
2390
|
-
|
|
2391
|
-
|
|
2392
|
-
|
|
2423
|
+
portalDocument.addEventListener("pointerdown", closeNow, true);
|
|
2424
|
+
portalDocument.addEventListener("keydown", handleDocumentKeyDown);
|
|
2425
|
+
portalDocument.addEventListener("pointermove", handleDocumentPointerMove, true);
|
|
2393
2426
|
return () => {
|
|
2394
|
-
|
|
2395
|
-
|
|
2396
|
-
|
|
2427
|
+
portalDocument.removeEventListener("pointerdown", closeNow, true);
|
|
2428
|
+
portalDocument.removeEventListener("keydown", handleDocumentKeyDown);
|
|
2429
|
+
portalDocument.removeEventListener("pointermove", handleDocumentPointerMove, true);
|
|
2397
2430
|
};
|
|
2398
|
-
}, [closeNow, isOpen]);
|
|
2431
|
+
}, [closeNow, isOpen, portalDocument]);
|
|
2399
2432
|
const childProps = children.props;
|
|
2400
2433
|
const childRef = childProps.ref;
|
|
2401
2434
|
const passthroughRef = mergeRefs(forwardedRef, childRef, (node) => {
|
|
@@ -2403,7 +2436,7 @@ var Tooltip = React5.forwardRef(({
|
|
|
2403
2436
|
});
|
|
2404
2437
|
if (disabled || !content) {
|
|
2405
2438
|
if (!asChild) return children;
|
|
2406
|
-
return
|
|
2439
|
+
return React6.cloneElement(children, {
|
|
2407
2440
|
...triggerPassthroughProps,
|
|
2408
2441
|
ref: passthroughRef
|
|
2409
2442
|
});
|
|
@@ -2460,11 +2493,11 @@ var Tooltip = React5.forwardRef(({
|
|
|
2460
2493
|
}
|
|
2461
2494
|
)
|
|
2462
2495
|
};
|
|
2463
|
-
const trigger = asChild ?
|
|
2496
|
+
const trigger = asChild ? React6.cloneElement(children, triggerProps) : /* @__PURE__ */ jsx6("span", { ...triggerProps, children });
|
|
2464
2497
|
return /* @__PURE__ */ jsxs(Fragment2, { children: [
|
|
2465
2498
|
trigger,
|
|
2466
|
-
isMounted && isOpen && createPortal(
|
|
2467
|
-
/* @__PURE__ */
|
|
2499
|
+
isMounted && isOpen && portalContainer && createPortal(
|
|
2500
|
+
/* @__PURE__ */ jsx6(
|
|
2468
2501
|
"div",
|
|
2469
2502
|
{
|
|
2470
2503
|
ref: positionerRef,
|
|
@@ -2478,7 +2511,7 @@ var Tooltip = React5.forwardRef(({
|
|
|
2478
2511
|
pointerEvents: "none",
|
|
2479
2512
|
willChange: "transform"
|
|
2480
2513
|
},
|
|
2481
|
-
children: /* @__PURE__ */
|
|
2514
|
+
children: /* @__PURE__ */ jsx6(
|
|
2482
2515
|
"div",
|
|
2483
2516
|
{
|
|
2484
2517
|
ref: panelRef,
|
|
@@ -2499,7 +2532,7 @@ var Tooltip = React5.forwardRef(({
|
|
|
2499
2532
|
)
|
|
2500
2533
|
}
|
|
2501
2534
|
),
|
|
2502
|
-
|
|
2535
|
+
portalContainer
|
|
2503
2536
|
)
|
|
2504
2537
|
] });
|
|
2505
2538
|
});
|
|
@@ -2532,6 +2565,9 @@ export {
|
|
|
2532
2565
|
chainEventHandlers,
|
|
2533
2566
|
setRefValue,
|
|
2534
2567
|
mergeRefs,
|
|
2568
|
+
UEditorPortalProvider,
|
|
2569
|
+
useUEditorPortalContainerGetter,
|
|
2570
|
+
resolveUEditorPortalContainer,
|
|
2535
2571
|
Tooltip
|
|
2536
2572
|
};
|
|
2537
|
-
//# sourceMappingURL=chunk-
|
|
2573
|
+
//# sourceMappingURL=chunk-EPBYGZHZ.js.map
|