@underverse-ui/underverse 2.0.13 → 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.
Files changed (31) hide show
  1. package/api-reference.json +1 -1
  2. package/dist/{EmojiPicker-FFNIUMI3.js → EmojiPicker-3X2S7XPP.js} +4 -4
  3. package/dist/{chunk-R7ZKNCWR.js → chunk-D22TNGE5.js} +3 -3
  4. package/dist/{chunk-PYC5EY5W.js → chunk-EPBYGZHZ.js} +106 -62
  5. package/dist/chunk-EPBYGZHZ.js.map +1 -0
  6. package/dist/{chunk-HEYNAGQD.js → chunk-HTGAV4IG.js} +3 -3
  7. package/dist/{chunk-WDY3QWOW.js → chunk-NWVDNVLR.js} +231 -158
  8. package/dist/chunk-NWVDNVLR.js.map +1 -0
  9. package/dist/{chunk-VNSCI3OK.js → chunk-SKCO2GFM.js} +2 -2
  10. package/dist/{chunk-MMMCBJ2L.js → chunk-WEGE3MZ5.js} +109 -67
  11. package/dist/chunk-WEGE3MZ5.js.map +1 -0
  12. package/dist/index.cjs +3173 -3009
  13. package/dist/index.cjs.map +1 -1
  14. package/dist/index.d.cts +16 -0
  15. package/dist/index.d.ts +16 -0
  16. package/dist/index.js +6 -6
  17. package/dist/{menu-bar-SVX36W4S.js → menu-bar-YMEOEYJS.js} +4 -4
  18. package/dist/ueditor.cjs +1142 -978
  19. package/dist/ueditor.cjs.map +1 -1
  20. package/dist/ueditor.d.cts +2 -0
  21. package/dist/ueditor.d.ts +2 -0
  22. package/dist/ueditor.js +4 -4
  23. package/package.json +1 -1
  24. package/dist/chunk-MMMCBJ2L.js.map +0 -1
  25. package/dist/chunk-PYC5EY5W.js.map +0 -1
  26. package/dist/chunk-WDY3QWOW.js.map +0 -1
  27. /package/dist/{EmojiPicker-FFNIUMI3.js.map → EmojiPicker-3X2S7XPP.js.map} +0 -0
  28. /package/dist/{chunk-R7ZKNCWR.js.map → chunk-D22TNGE5.js.map} +0 -0
  29. /package/dist/{chunk-HEYNAGQD.js.map → chunk-HTGAV4IG.js.map} +0 -0
  30. /package/dist/{chunk-VNSCI3OK.js.map → chunk-SKCO2GFM.js.map} +0 -0
  31. /package/dist/{menu-bar-SVX36W4S.js.map → menu-bar-YMEOEYJS.js.map} +0 -0
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "package": "@underverse-ui/underverse",
3
- "version": "2.0.13",
3
+ "version": "2.0.15",
4
4
  "sourceEntry": "src/index.ts",
5
5
  "totalExports": 257,
6
6
  "exports": [
@@ -2,13 +2,13 @@
2
2
  import {
3
3
  EmojiPicker,
4
4
  EmojiPicker_default
5
- } from "./chunk-HEYNAGQD.js";
6
- import "./chunk-VNSCI3OK.js";
5
+ } from "./chunk-HTGAV4IG.js";
6
+ import "./chunk-SKCO2GFM.js";
7
7
  import "./chunk-4TYW5K4J.js";
8
- import "./chunk-PYC5EY5W.js";
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-FFNIUMI3.js.map
14
+ //# sourceMappingURL=EmojiPicker-3X2S7XPP.js.map
@@ -1,11 +1,11 @@
1
1
  import {
2
2
  getPanelBorderRadiusClass,
3
3
  useUnderverseUIConfig
4
- } from "./chunk-MMMCBJ2L.js";
4
+ } from "./chunk-WEGE3MZ5.js";
5
5
  import {
6
6
  cn,
7
7
  useGlobalI18n
8
- } from "./chunk-PYC5EY5W.js";
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-R7ZKNCWR.js.map
199
+ //# sourceMappingURL=chunk-D22TNGE5.js.map
@@ -260,7 +260,9 @@ var en_default = {
260
260
  imageWidthMd: "Image Width Medium",
261
261
  imageWidthLg: "Image Width Large",
262
262
  imageResetSize: "Reset Image Size",
263
- imageDelete: "Delete Image"
263
+ imageDelete: "Delete Image",
264
+ hideMenuBar: "Hide menu bar",
265
+ showMenuBar: "Show menu bar"
264
266
  },
265
267
  slashCommand: {
266
268
  basicBlocks: "Basic Blocks",
@@ -713,7 +715,9 @@ var vi_default = {
713
715
  imageWidthMd: "\u1EA2nh V\u1EEBa",
714
716
  imageWidthLg: "\u1EA2nh L\u1EDBn",
715
717
  imageResetSize: "\u0110\u1EB7t L\u1EA1i K\xEDch Th\u01B0\u1EDBc \u1EA2nh",
716
- imageDelete: "X\xF3a \u1EA2nh"
718
+ imageDelete: "X\xF3a \u1EA2nh",
719
+ hideMenuBar: "\u1EA8n thanh menu",
720
+ showMenuBar: "Hi\u1EC7n thanh menu"
717
721
  },
718
722
  slashCommand: {
719
723
  basicBlocks: "Kh\u1ED1i c\u01A1 b\u1EA3n",
@@ -1166,7 +1170,9 @@ var ko_default = {
1166
1170
  imageWidthMd: "\uC911\uAC04 \uC774\uBBF8\uC9C0",
1167
1171
  imageWidthLg: "\uD070 \uC774\uBBF8\uC9C0",
1168
1172
  imageResetSize: "\uC774\uBBF8\uC9C0 \uD06C\uAE30 \uCD08\uAE30\uD654",
1169
- imageDelete: "\uC774\uBBF8\uC9C0 \uC0AD\uC81C"
1173
+ imageDelete: "\uC774\uBBF8\uC9C0 \uC0AD\uC81C",
1174
+ hideMenuBar: "\uBA54\uB274 \uBAA8\uC74C \uC228\uAE30\uAE30",
1175
+ showMenuBar: "\uBA54\uB274 \uBAA8\uC74C \uD45C\uC2DC"
1170
1176
  },
1171
1177
  slashCommand: {
1172
1178
  basicBlocks: "\uAE30\uBCF8 \uBE14\uB85D",
@@ -1619,7 +1625,9 @@ var ja_default = {
1619
1625
  imageWidthMd: "\u753B\u50CF\uFF08\u4E2D\uFF09",
1620
1626
  imageWidthLg: "\u753B\u50CF\uFF08\u5927\uFF09",
1621
1627
  imageResetSize: "\u753B\u50CF\u30B5\u30A4\u30BA\u3092\u30EA\u30BB\u30C3\u30C8",
1622
- imageDelete: "\u753B\u50CF\u3092\u524A\u9664"
1628
+ imageDelete: "\u753B\u50CF\u3092\u524A\u9664",
1629
+ hideMenuBar: "\u30E1\u30CB\u30E5\u30FC\u30D0\u30FC\u3092\u975E\u8868\u793A",
1630
+ showMenuBar: "\u30E1\u30CB\u30E5\u30FC\u30D0\u30FC\u3092\u8868\u793A"
1623
1631
  },
1624
1632
  slashCommand: {
1625
1633
  basicBlocks: "\u57FA\u672C\u30D6\u30ED\u30C3\u30AF",
@@ -2137,7 +2145,7 @@ function useSmartLocale() {
2137
2145
  }
2138
2146
 
2139
2147
  // src/components/Tooltip.tsx
2140
- import * as React5 from "react";
2148
+ import * as React6 from "react";
2141
2149
  import { createPortal } from "react-dom";
2142
2150
 
2143
2151
  // src/hooks/useHydrated.ts
@@ -2170,8 +2178,33 @@ function mergeRefs(...refs) {
2170
2178
  };
2171
2179
  }
2172
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
+
2173
2206
  // src/components/Tooltip.tsx
2174
- import { Fragment as Fragment2, jsx as jsx5, jsxs } from "react/jsx-runtime";
2207
+ import { Fragment as Fragment2, jsx as jsx6, jsxs } from "react/jsx-runtime";
2175
2208
  var variantStyles = {
2176
2209
  default: "bg-popover text-popover-foreground border-border/50",
2177
2210
  info: "bg-info text-info-foreground border-info/20",
@@ -2224,7 +2257,7 @@ function computeTooltipPosition(args) {
2224
2257
  top = clamp(top, padding, viewport.height - contentSize.height - padding);
2225
2258
  return { top, left, side };
2226
2259
  }
2227
- var Tooltip = React5.forwardRef(({
2260
+ var Tooltip = React6.forwardRef(({
2228
2261
  children,
2229
2262
  content,
2230
2263
  placement = "top",
@@ -2235,27 +2268,31 @@ var Tooltip = React5.forwardRef(({
2235
2268
  asChild = true,
2236
2269
  ...triggerPassthroughProps
2237
2270
  }, forwardedRef) => {
2238
- const [isOpen, setIsOpen] = React5.useState(false);
2271
+ const [isOpen, setIsOpen] = React6.useState(false);
2239
2272
  const isMounted = useHydrated();
2240
- const triggerRef = React5.useRef(null);
2241
- const positionerRef = React5.useRef(null);
2242
- const panelRef = React5.useRef(null);
2243
- const timeoutRef = React5.useRef(void 0);
2244
- const lastAppliedRef = React5.useRef(null);
2245
- const openedByPointerRef = React5.useRef(false);
2246
- const triggerSelector = React5.useId();
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;
2247
2284
  const delayOpen = typeof delay === "object" ? delay.open || 700 : delay;
2248
2285
  const delayClose = typeof delay === "object" ? delay.close || 300 : delay;
2249
2286
  const offset = 8;
2250
2287
  const padding = 8;
2251
- React5.useLayoutEffect(() => {
2288
+ React6.useLayoutEffect(() => {
2252
2289
  if (typeof document === "undefined") return;
2253
2290
  const triggerEl = document.querySelector(`[data-underverse-tooltip-trigger="${triggerSelector}"]`);
2254
2291
  if (triggerEl) {
2255
2292
  triggerRef.current = triggerEl;
2256
2293
  }
2257
2294
  }, [children, triggerSelector]);
2258
- const updatePosition = React5.useCallback(() => {
2295
+ const updatePosition = React6.useCallback(() => {
2259
2296
  const triggerEl = triggerRef.current;
2260
2297
  const positionerEl = positionerRef.current;
2261
2298
  const panelEl = panelRef.current;
@@ -2272,7 +2309,10 @@ var Tooltip = React5.forwardRef(({
2272
2309
  placement,
2273
2310
  offset,
2274
2311
  padding,
2275
- viewport: { width: window.innerWidth, height: window.innerHeight }
2312
+ viewport: {
2313
+ width: portalWindow?.innerWidth ?? window.innerWidth,
2314
+ height: portalWindow?.innerHeight ?? window.innerHeight
2315
+ }
2276
2316
  });
2277
2317
  const top = Math.round(next.top);
2278
2318
  const left = Math.round(next.left);
@@ -2283,7 +2323,7 @@ var Tooltip = React5.forwardRef(({
2283
2323
  positionerEl.style.transform = `translate3d(${left}px, ${top}px, 0)`;
2284
2324
  panelEl.style.transformOrigin = getTransformOrigin(next.side);
2285
2325
  if (positionerEl.style.visibility !== "visible") positionerEl.style.visibility = "visible";
2286
- }, [placement]);
2326
+ }, [placement, portalWindow]);
2287
2327
  const handleMouseEnter = () => {
2288
2328
  if (disabled) return;
2289
2329
  openedByPointerRef.current = true;
@@ -2298,7 +2338,7 @@ var Tooltip = React5.forwardRef(({
2298
2338
  setIsOpen(false);
2299
2339
  }, delayClose);
2300
2340
  };
2301
- const closeNow = React5.useCallback(() => {
2341
+ const closeNow = React6.useCallback(() => {
2302
2342
  clearTimeout(timeoutRef.current);
2303
2343
  openedByPointerRef.current = false;
2304
2344
  setIsOpen(false);
@@ -2312,58 +2352,59 @@ var Tooltip = React5.forwardRef(({
2312
2352
  openedByPointerRef.current = false;
2313
2353
  setIsOpen(false);
2314
2354
  };
2315
- React5.useEffect(() => {
2355
+ React6.useEffect(() => {
2316
2356
  return () => clearTimeout(timeoutRef.current);
2317
2357
  }, []);
2318
- React5.useEffect(() => {
2358
+ React6.useEffect(() => {
2319
2359
  if (isOpen) return;
2320
2360
  clearTimeout(timeoutRef.current);
2321
2361
  }, [isOpen]);
2322
- React5.useLayoutEffect(() => {
2323
- if (!isOpen) {
2362
+ React6.useLayoutEffect(() => {
2363
+ if (!isOpen || !portalWindow) {
2324
2364
  lastAppliedRef.current = null;
2325
2365
  return;
2326
2366
  }
2327
2367
  updatePosition();
2328
2368
  let raf1 = 0;
2329
2369
  let raf2 = 0;
2330
- raf1 = window.requestAnimationFrame(() => {
2370
+ raf1 = portalWindow.requestAnimationFrame(() => {
2331
2371
  updatePosition();
2332
- raf2 = window.requestAnimationFrame(() => updatePosition());
2372
+ raf2 = portalWindow.requestAnimationFrame(() => updatePosition());
2333
2373
  });
2334
2374
  return () => {
2335
- cancelAnimationFrame(raf1);
2336
- cancelAnimationFrame(raf2);
2375
+ portalWindow.cancelAnimationFrame(raf1);
2376
+ portalWindow.cancelAnimationFrame(raf2);
2337
2377
  };
2338
- }, [isOpen, updatePosition]);
2339
- React5.useEffect(() => {
2340
- if (!isOpen) return;
2378
+ }, [isOpen, portalWindow, updatePosition]);
2379
+ React6.useEffect(() => {
2380
+ if (!isOpen || !portalDocument || !portalWindow) return;
2341
2381
  let raf = 0;
2342
2382
  const handler = () => {
2343
- cancelAnimationFrame(raf);
2344
- raf = window.requestAnimationFrame(() => updatePosition());
2383
+ portalWindow.cancelAnimationFrame(raf);
2384
+ raf = portalWindow.requestAnimationFrame(() => updatePosition());
2345
2385
  };
2346
2386
  handler();
2347
- window.addEventListener("resize", handler);
2348
- window.addEventListener("scroll", handler, true);
2349
- document.addEventListener("scroll", handler, true);
2387
+ portalWindow.addEventListener("resize", handler);
2388
+ portalWindow.addEventListener("scroll", handler, true);
2389
+ portalDocument.addEventListener("scroll", handler, true);
2350
2390
  return () => {
2351
- cancelAnimationFrame(raf);
2352
- window.removeEventListener("resize", handler);
2353
- window.removeEventListener("scroll", handler, true);
2354
- document.removeEventListener("scroll", handler, true);
2391
+ portalWindow.cancelAnimationFrame(raf);
2392
+ portalWindow.removeEventListener("resize", handler);
2393
+ portalWindow.removeEventListener("scroll", handler, true);
2394
+ portalDocument.removeEventListener("scroll", handler, true);
2355
2395
  };
2356
- }, [isOpen, updatePosition]);
2357
- React5.useEffect(() => {
2358
- if (!isOpen) return;
2359
- if (typeof ResizeObserver === "undefined") return;
2360
- const ro = new ResizeObserver(() => updatePosition());
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());
2361
2402
  if (triggerRef.current) ro.observe(triggerRef.current);
2362
2403
  if (panelRef.current) ro.observe(panelRef.current);
2363
2404
  return () => ro.disconnect();
2364
- }, [isOpen, updatePosition]);
2365
- React5.useEffect(() => {
2366
- if (!isOpen) return;
2405
+ }, [isOpen, portalWindow, updatePosition]);
2406
+ React6.useEffect(() => {
2407
+ if (!isOpen || !portalDocument) return;
2367
2408
  const handleDocumentKeyDown = (event) => {
2368
2409
  if (event.key === "Escape") closeNow();
2369
2410
  };
@@ -2379,15 +2420,15 @@ var Tooltip = React5.forwardRef(({
2379
2420
  const insideTrigger = event.clientX >= rect.left - tolerance && event.clientX <= rect.right + tolerance && event.clientY >= rect.top - tolerance && event.clientY <= rect.bottom + tolerance;
2380
2421
  if (!insideTrigger) closeNow();
2381
2422
  };
2382
- document.addEventListener("pointerdown", closeNow, true);
2383
- document.addEventListener("keydown", handleDocumentKeyDown);
2384
- document.addEventListener("pointermove", handleDocumentPointerMove, true);
2423
+ portalDocument.addEventListener("pointerdown", closeNow, true);
2424
+ portalDocument.addEventListener("keydown", handleDocumentKeyDown);
2425
+ portalDocument.addEventListener("pointermove", handleDocumentPointerMove, true);
2385
2426
  return () => {
2386
- document.removeEventListener("pointerdown", closeNow, true);
2387
- document.removeEventListener("keydown", handleDocumentKeyDown);
2388
- document.removeEventListener("pointermove", handleDocumentPointerMove, true);
2427
+ portalDocument.removeEventListener("pointerdown", closeNow, true);
2428
+ portalDocument.removeEventListener("keydown", handleDocumentKeyDown);
2429
+ portalDocument.removeEventListener("pointermove", handleDocumentPointerMove, true);
2389
2430
  };
2390
- }, [closeNow, isOpen]);
2431
+ }, [closeNow, isOpen, portalDocument]);
2391
2432
  const childProps = children.props;
2392
2433
  const childRef = childProps.ref;
2393
2434
  const passthroughRef = mergeRefs(forwardedRef, childRef, (node) => {
@@ -2395,7 +2436,7 @@ var Tooltip = React5.forwardRef(({
2395
2436
  });
2396
2437
  if (disabled || !content) {
2397
2438
  if (!asChild) return children;
2398
- return React5.cloneElement(children, {
2439
+ return React6.cloneElement(children, {
2399
2440
  ...triggerPassthroughProps,
2400
2441
  ref: passthroughRef
2401
2442
  });
@@ -2452,11 +2493,11 @@ var Tooltip = React5.forwardRef(({
2452
2493
  }
2453
2494
  )
2454
2495
  };
2455
- const trigger = asChild ? React5.cloneElement(children, triggerProps) : /* @__PURE__ */ jsx5("span", { ...triggerProps, children });
2496
+ const trigger = asChild ? React6.cloneElement(children, triggerProps) : /* @__PURE__ */ jsx6("span", { ...triggerProps, children });
2456
2497
  return /* @__PURE__ */ jsxs(Fragment2, { children: [
2457
2498
  trigger,
2458
- isMounted && isOpen && createPortal(
2459
- /* @__PURE__ */ jsx5(
2499
+ isMounted && isOpen && portalContainer && createPortal(
2500
+ /* @__PURE__ */ jsx6(
2460
2501
  "div",
2461
2502
  {
2462
2503
  ref: positionerRef,
@@ -2470,7 +2511,7 @@ var Tooltip = React5.forwardRef(({
2470
2511
  pointerEvents: "none",
2471
2512
  willChange: "transform"
2472
2513
  },
2473
- children: /* @__PURE__ */ jsx5(
2514
+ children: /* @__PURE__ */ jsx6(
2474
2515
  "div",
2475
2516
  {
2476
2517
  ref: panelRef,
@@ -2491,7 +2532,7 @@ var Tooltip = React5.forwardRef(({
2491
2532
  )
2492
2533
  }
2493
2534
  ),
2494
- document.body
2535
+ portalContainer
2495
2536
  )
2496
2537
  ] });
2497
2538
  });
@@ -2524,6 +2565,9 @@ export {
2524
2565
  chainEventHandlers,
2525
2566
  setRefValue,
2526
2567
  mergeRefs,
2568
+ UEditorPortalProvider,
2569
+ useUEditorPortalContainerGetter,
2570
+ resolveUEditorPortalContainer,
2527
2571
  Tooltip
2528
2572
  };
2529
- //# sourceMappingURL=chunk-PYC5EY5W.js.map
2573
+ //# sourceMappingURL=chunk-EPBYGZHZ.js.map