@underverse-ui/underverse 1.0.103 → 1.0.105
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 +37 -2
- package/dist/index.cjs +115 -7
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +9 -1
- package/dist/index.d.ts +9 -1
- package/dist/index.js +176 -68
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -6082,11 +6082,21 @@ var Sheet = ({
|
|
|
6082
6082
|
closeOnEscape = true,
|
|
6083
6083
|
header,
|
|
6084
6084
|
footer,
|
|
6085
|
-
overlayOpacity
|
|
6085
|
+
overlayOpacity,
|
|
6086
|
+
resizable = false,
|
|
6087
|
+
minSize = 280,
|
|
6088
|
+
maxSize,
|
|
6089
|
+
onResize
|
|
6086
6090
|
}) => {
|
|
6087
6091
|
const [mounted, setMounted] = React19.useState(false);
|
|
6088
6092
|
const [isAnimating, setIsAnimating] = React19.useState(true);
|
|
6089
6093
|
const [isVisible, setIsVisible] = React19.useState(false);
|
|
6094
|
+
const [isResizing, setIsResizing] = React19.useState(false);
|
|
6095
|
+
const [sheetSize, setSheetSize] = React19.useState(null);
|
|
6096
|
+
const sheetRef = React19.useRef(null);
|
|
6097
|
+
const resizeStateRef = React19.useRef(null);
|
|
6098
|
+
const isHorizontalSheet = side === "left" || side === "right";
|
|
6099
|
+
const canResize = resizable && size !== "full";
|
|
6090
6100
|
React19.useEffect(() => {
|
|
6091
6101
|
setMounted(true);
|
|
6092
6102
|
}, []);
|
|
@@ -6133,6 +6143,68 @@ var Sheet = ({
|
|
|
6133
6143
|
const handleClose = () => {
|
|
6134
6144
|
onOpenChange(false);
|
|
6135
6145
|
};
|
|
6146
|
+
const clampResizeSize = React19.useCallback((nextSize) => {
|
|
6147
|
+
const viewportSize = isHorizontalSheet ? window.innerWidth : window.innerHeight;
|
|
6148
|
+
const resolvedMaxSize = maxSize ?? Math.round(viewportSize * 0.9);
|
|
6149
|
+
return Math.min(Math.max(nextSize, minSize), resolvedMaxSize);
|
|
6150
|
+
}, [isHorizontalSheet, maxSize, minSize]);
|
|
6151
|
+
const endResize = React19.useCallback(() => {
|
|
6152
|
+
if (!resizeStateRef.current) return;
|
|
6153
|
+
resizeStateRef.current = null;
|
|
6154
|
+
setIsResizing(false);
|
|
6155
|
+
document.body.style.cursor = "";
|
|
6156
|
+
document.body.style.userSelect = "";
|
|
6157
|
+
}, []);
|
|
6158
|
+
const handleResizePointerMove = React19.useCallback((event) => {
|
|
6159
|
+
const resizeState = resizeStateRef.current;
|
|
6160
|
+
if (!resizeState || event.pointerId !== resizeState.pointerId) return;
|
|
6161
|
+
const delta = isHorizontalSheet ? side === "right" ? resizeState.startClientX - event.clientX : event.clientX - resizeState.startClientX : side === "bottom" ? resizeState.startClientY - event.clientY : event.clientY - resizeState.startClientY;
|
|
6162
|
+
const nextSize = clampResizeSize(Math.round(resizeState.startSize + delta));
|
|
6163
|
+
setSheetSize(nextSize);
|
|
6164
|
+
onResize?.(nextSize);
|
|
6165
|
+
}, [clampResizeSize, isHorizontalSheet, onResize, side]);
|
|
6166
|
+
const handleResizePointerUp = React19.useCallback((event) => {
|
|
6167
|
+
const resizeState = resizeStateRef.current;
|
|
6168
|
+
if (!resizeState || event.pointerId !== resizeState.pointerId) return;
|
|
6169
|
+
endResize();
|
|
6170
|
+
}, [endResize]);
|
|
6171
|
+
React19.useEffect(() => {
|
|
6172
|
+
if (!isResizing) return void 0;
|
|
6173
|
+
window.addEventListener("pointermove", handleResizePointerMove);
|
|
6174
|
+
window.addEventListener("pointerup", handleResizePointerUp);
|
|
6175
|
+
window.addEventListener("pointercancel", handleResizePointerUp);
|
|
6176
|
+
return () => {
|
|
6177
|
+
window.removeEventListener("pointermove", handleResizePointerMove);
|
|
6178
|
+
window.removeEventListener("pointerup", handleResizePointerUp);
|
|
6179
|
+
window.removeEventListener("pointercancel", handleResizePointerUp);
|
|
6180
|
+
};
|
|
6181
|
+
}, [handleResizePointerMove, handleResizePointerUp, isResizing]);
|
|
6182
|
+
React19.useEffect(() => {
|
|
6183
|
+
if (!open) endResize();
|
|
6184
|
+
}, [endResize, open]);
|
|
6185
|
+
React19.useEffect(() => endResize, [endResize]);
|
|
6186
|
+
const handleResizePointerDown = (event) => {
|
|
6187
|
+
if (!canResize || !sheetRef.current) return;
|
|
6188
|
+
const rect = sheetRef.current.getBoundingClientRect();
|
|
6189
|
+
const startSize = isHorizontalSheet ? rect.width : rect.height;
|
|
6190
|
+
resizeStateRef.current = {
|
|
6191
|
+
pointerId: event.pointerId,
|
|
6192
|
+
startClientX: event.clientX,
|
|
6193
|
+
startClientY: event.clientY,
|
|
6194
|
+
startSize
|
|
6195
|
+
};
|
|
6196
|
+
setIsResizing(true);
|
|
6197
|
+
event.currentTarget.setPointerCapture(event.pointerId);
|
|
6198
|
+
document.body.style.cursor = isHorizontalSheet ? "col-resize" : "row-resize";
|
|
6199
|
+
document.body.style.userSelect = "none";
|
|
6200
|
+
event.preventDefault();
|
|
6201
|
+
event.stopPropagation();
|
|
6202
|
+
};
|
|
6203
|
+
const sheetInlineStyle = {
|
|
6204
|
+
transform: open && !isAnimating ? "translate(0, 0)" : side === "right" ? "translateX(100%)" : side === "left" ? "translateX(-100%)" : side === "top" ? "translateY(-100%)" : "translateY(100%)",
|
|
6205
|
+
transition: "transform 300ms cubic-bezier(0.4, 0, 0.2, 1)",
|
|
6206
|
+
...sheetSize !== null ? isHorizontalSheet ? { width: `${sheetSize}px` } : { height: `${sheetSize}px` } : {}
|
|
6207
|
+
};
|
|
6136
6208
|
if (!mounted || !open && !isVisible) return null;
|
|
6137
6209
|
const sheetContent = /* @__PURE__ */ jsxs16("div", { className: "fixed inset-0 z-50", children: [
|
|
6138
6210
|
/* @__PURE__ */ jsx23(
|
|
@@ -6150,6 +6222,7 @@ var Sheet = ({
|
|
|
6150
6222
|
/* @__PURE__ */ jsxs16(
|
|
6151
6223
|
"div",
|
|
6152
6224
|
{
|
|
6225
|
+
ref: sheetRef,
|
|
6153
6226
|
className: cn(
|
|
6154
6227
|
"fixed flex flex-col bg-background text-foreground shadow-2xl",
|
|
6155
6228
|
"border-border/50 transition-all duration-300 ease-out",
|
|
@@ -6164,11 +6237,28 @@ var Sheet = ({
|
|
|
6164
6237
|
open && !isAnimating ? animationStyles[side].animate : animationStyles[side].initial,
|
|
6165
6238
|
className
|
|
6166
6239
|
),
|
|
6167
|
-
style:
|
|
6168
|
-
transform: open && !isAnimating ? "translate(0, 0)" : side === "right" ? "translateX(100%)" : side === "left" ? "translateX(-100%)" : side === "top" ? "translateY(-100%)" : "translateY(100%)",
|
|
6169
|
-
transition: "transform 300ms cubic-bezier(0.4, 0, 0.2, 1)"
|
|
6170
|
-
},
|
|
6240
|
+
style: sheetInlineStyle,
|
|
6171
6241
|
children: [
|
|
6242
|
+
canResize && /* @__PURE__ */ jsx23(
|
|
6243
|
+
"button",
|
|
6244
|
+
{
|
|
6245
|
+
type: "button",
|
|
6246
|
+
"aria-label": "Resize sheet",
|
|
6247
|
+
className: cn(
|
|
6248
|
+
"absolute z-10 bg-transparent outline-none transition-colors",
|
|
6249
|
+
"after:absolute after:rounded-full after:bg-border after:opacity-0 after:transition-opacity hover:after:opacity-100 focus-visible:after:opacity-100",
|
|
6250
|
+
isHorizontalSheet ? "top-0 h-full w-3 cursor-col-resize after:top-1/2 after:h-12 after:w-1 after:-translate-y-1/2" : "left-0 h-3 w-full cursor-row-resize after:left-1/2 after:h-1 after:w-12 after:-translate-x-1/2",
|
|
6251
|
+
side === "right" && "-left-1.5 after:left-1/2",
|
|
6252
|
+
side === "left" && "-right-1.5 after:right-1/2",
|
|
6253
|
+
side === "bottom" && "-top-1.5 after:top-1/2",
|
|
6254
|
+
side === "top" && "-bottom-1.5 after:bottom-1/2"
|
|
6255
|
+
),
|
|
6256
|
+
onPointerDown: handleResizePointerDown,
|
|
6257
|
+
onPointerMove: (event) => handleResizePointerMove(event.nativeEvent),
|
|
6258
|
+
onPointerUp: (event) => handleResizePointerUp(event.nativeEvent),
|
|
6259
|
+
onPointerCancel: (event) => handleResizePointerUp(event.nativeEvent)
|
|
6260
|
+
}
|
|
6261
|
+
),
|
|
6172
6262
|
(title || description || header || showClose) && /* @__PURE__ */ jsx23("div", { className: "shrink-0 border-b border-border/50", children: header || /* @__PURE__ */ jsxs16("div", { className: "flex items-center justify-between p-4", children: [
|
|
6173
6263
|
/* @__PURE__ */ jsxs16("div", { className: "flex-1", children: [
|
|
6174
6264
|
title && /* @__PURE__ */ jsx23("h2", { className: "text-lg font-semibold text-foreground", children: title }),
|
|
@@ -7925,7 +8015,7 @@ Section.displayName = "Section";
|
|
|
7925
8015
|
var Section_default = Section;
|
|
7926
8016
|
|
|
7927
8017
|
// src/components/ScrollArea.tsx
|
|
7928
|
-
import { forwardRef as forwardRef7, useRef as
|
|
8018
|
+
import { forwardRef as forwardRef7, useRef as useRef12 } from "react";
|
|
7929
8019
|
import { jsx as jsx32 } from "react/jsx-runtime";
|
|
7930
8020
|
var variantClasses2 = {
|
|
7931
8021
|
default: "bg-background",
|
|
@@ -7944,7 +8034,7 @@ var ScrollArea = forwardRef7(
|
|
|
7944
8034
|
useOverlayScrollbar = false,
|
|
7945
8035
|
...props
|
|
7946
8036
|
}, ref) => {
|
|
7947
|
-
const viewportRef =
|
|
8037
|
+
const viewportRef = useRef12(null);
|
|
7948
8038
|
useOverlayScrollbarTarget(viewportRef, { enabled: useOverlayScrollbar });
|
|
7949
8039
|
return /* @__PURE__ */ jsx32(
|
|
7950
8040
|
"div",
|
|
@@ -7960,11 +8050,11 @@ var ScrollArea = forwardRef7(
|
|
|
7960
8050
|
ScrollArea.displayName = "ScrollArea";
|
|
7961
8051
|
|
|
7962
8052
|
// src/components/OverlayScrollArea.tsx
|
|
7963
|
-
import { forwardRef as forwardRef8, useRef as
|
|
8053
|
+
import { forwardRef as forwardRef8, useRef as useRef13 } from "react";
|
|
7964
8054
|
import { jsx as jsx33 } from "react/jsx-runtime";
|
|
7965
8055
|
var OverlayScrollArea = forwardRef8(
|
|
7966
8056
|
({ className, viewportClassName, viewportProps, enabled = true, overflowHidden = true, overlayScrollbarOptions, children, ...props }, ref) => {
|
|
7967
|
-
const viewportRef =
|
|
8057
|
+
const viewportRef = useRef13(null);
|
|
7968
8058
|
useOverlayScrollbarTarget(viewportRef, {
|
|
7969
8059
|
enabled,
|
|
7970
8060
|
...overlayScrollbarOptions
|
|
@@ -16942,7 +17032,7 @@ function OverlayControls({
|
|
|
16942
17032
|
}
|
|
16943
17033
|
|
|
16944
17034
|
// src/components/CategoryTreeSelect.tsx
|
|
16945
|
-
import { useEffect as useEffect25, useId as useId11, useMemo as useMemo19, useRef as
|
|
17035
|
+
import { useEffect as useEffect25, useId as useId11, useMemo as useMemo19, useRef as useRef20, useState as useState31 } from "react";
|
|
16946
17036
|
import { ChevronRight as ChevronRight6, ChevronDown as ChevronDown5, FolderTree, Layers, Search as Search6, SearchX as SearchX3, X as X14 } from "lucide-react";
|
|
16947
17037
|
import { jsx as jsx49, jsxs as jsxs39 } from "react/jsx-runtime";
|
|
16948
17038
|
var defaultLabels = {
|
|
@@ -17070,8 +17160,8 @@ function CategoryTreeSelect(props) {
|
|
|
17070
17160
|
);
|
|
17071
17161
|
const [query, setQuery] = useState31("");
|
|
17072
17162
|
const [localRequiredError, setLocalRequiredError] = useState31();
|
|
17073
|
-
const searchInputRef =
|
|
17074
|
-
const dropdownViewportRef =
|
|
17163
|
+
const searchInputRef = useRef20(null);
|
|
17164
|
+
const dropdownViewportRef = useRef20(null);
|
|
17075
17165
|
useOverlayScrollbarTarget(dropdownViewportRef, { enabled: useOverlayScrollbar });
|
|
17076
17166
|
const autoId = useId11();
|
|
17077
17167
|
const resolvedId = id ? String(id) : `category-tree-select-${autoId}`;
|
|
@@ -17642,7 +17732,7 @@ function CategoryTreeSelect(props) {
|
|
|
17642
17732
|
}
|
|
17643
17733
|
|
|
17644
17734
|
// src/components/ImageUpload.tsx
|
|
17645
|
-
import { useState as useState32, useRef as
|
|
17735
|
+
import { useState as useState32, useRef as useRef21, useCallback as useCallback16 } from "react";
|
|
17646
17736
|
import { Upload, X as X15, Image as ImageIcon, Loader2 as Loader25, Check as Check7 } from "lucide-react";
|
|
17647
17737
|
import { jsx as jsx50, jsxs as jsxs40 } from "react/jsx-runtime";
|
|
17648
17738
|
function ImageUpload({
|
|
@@ -17663,7 +17753,7 @@ function ImageUpload({
|
|
|
17663
17753
|
const [isDragging, setIsDragging] = useState32(false);
|
|
17664
17754
|
const [uploading, setUploading] = useState32(false);
|
|
17665
17755
|
const [uploadedImages, setUploadedImages] = useState32([]);
|
|
17666
|
-
const fileInputRef =
|
|
17756
|
+
const fileInputRef = useRef21(null);
|
|
17667
17757
|
const { addToast } = useToast();
|
|
17668
17758
|
const t = useSmartTranslations("OCR.imageUpload");
|
|
17669
17759
|
const previewSizes = {
|
|
@@ -17671,7 +17761,7 @@ function ImageUpload({
|
|
|
17671
17761
|
md: "w-24 h-24",
|
|
17672
17762
|
lg: "w-32 h-32"
|
|
17673
17763
|
};
|
|
17674
|
-
const handleDragOver =
|
|
17764
|
+
const handleDragOver = useCallback16(
|
|
17675
17765
|
(e) => {
|
|
17676
17766
|
e.preventDefault();
|
|
17677
17767
|
if (!disabled) {
|
|
@@ -17680,11 +17770,11 @@ function ImageUpload({
|
|
|
17680
17770
|
},
|
|
17681
17771
|
[disabled]
|
|
17682
17772
|
);
|
|
17683
|
-
const handleDragLeave =
|
|
17773
|
+
const handleDragLeave = useCallback16((e) => {
|
|
17684
17774
|
e.preventDefault();
|
|
17685
17775
|
setIsDragging(false);
|
|
17686
17776
|
}, []);
|
|
17687
|
-
const handleFiles =
|
|
17777
|
+
const handleFiles = useCallback16(
|
|
17688
17778
|
async (files) => {
|
|
17689
17779
|
if (files.length === 0) return;
|
|
17690
17780
|
const validFiles = files.filter((file) => {
|
|
@@ -17751,7 +17841,7 @@ function ImageUpload({
|
|
|
17751
17841
|
},
|
|
17752
17842
|
[maxSize, addToast, onUpload]
|
|
17753
17843
|
);
|
|
17754
|
-
const handleDrop =
|
|
17844
|
+
const handleDrop = useCallback16(
|
|
17755
17845
|
(e) => {
|
|
17756
17846
|
e.preventDefault();
|
|
17757
17847
|
setIsDragging(false);
|
|
@@ -17761,7 +17851,7 @@ function ImageUpload({
|
|
|
17761
17851
|
},
|
|
17762
17852
|
[disabled, handleFiles]
|
|
17763
17853
|
);
|
|
17764
|
-
const handleFileSelect =
|
|
17854
|
+
const handleFileSelect = useCallback16(
|
|
17765
17855
|
(e) => {
|
|
17766
17856
|
const files = Array.from(e.target.files || []);
|
|
17767
17857
|
handleFiles(files);
|
|
@@ -17881,7 +17971,7 @@ import {
|
|
|
17881
17971
|
Trash2,
|
|
17882
17972
|
Upload as Upload2
|
|
17883
17973
|
} from "lucide-react";
|
|
17884
|
-
import { useCallback as
|
|
17974
|
+
import { useCallback as useCallback17, useMemo as useMemo20, useRef as useRef22, useState as useState33 } from "react";
|
|
17885
17975
|
import { Fragment as Fragment16, jsx as jsx51, jsxs as jsxs41 } from "react/jsx-runtime";
|
|
17886
17976
|
var formatFileSize = (bytes) => {
|
|
17887
17977
|
if (bytes === 0) return "0 Bytes";
|
|
@@ -17990,7 +18080,7 @@ function FileUpload({
|
|
|
17990
18080
|
}) {
|
|
17991
18081
|
const [isDragging, setIsDragging] = useState33(false);
|
|
17992
18082
|
const [files, setFiles] = useState33(initialFiles);
|
|
17993
|
-
const fileInputRef =
|
|
18083
|
+
const fileInputRef = useRef22(null);
|
|
17994
18084
|
const { addToast } = useToast();
|
|
17995
18085
|
const t = useSmartTranslations("FileUpload");
|
|
17996
18086
|
const sizeConfig = useMemo20(
|
|
@@ -18026,7 +18116,7 @@ function FileUpload({
|
|
|
18026
18116
|
[]
|
|
18027
18117
|
);
|
|
18028
18118
|
const currentSize = sizeConfig[size];
|
|
18029
|
-
const handleDragOver =
|
|
18119
|
+
const handleDragOver = useCallback17(
|
|
18030
18120
|
(e) => {
|
|
18031
18121
|
e.preventDefault();
|
|
18032
18122
|
e.stopPropagation();
|
|
@@ -18036,12 +18126,12 @@ function FileUpload({
|
|
|
18036
18126
|
},
|
|
18037
18127
|
[disabled]
|
|
18038
18128
|
);
|
|
18039
|
-
const handleDragLeave =
|
|
18129
|
+
const handleDragLeave = useCallback17((e) => {
|
|
18040
18130
|
e.preventDefault();
|
|
18041
18131
|
e.stopPropagation();
|
|
18042
18132
|
setIsDragging(false);
|
|
18043
18133
|
}, []);
|
|
18044
|
-
const processFiles =
|
|
18134
|
+
const processFiles = useCallback17(
|
|
18045
18135
|
async (fileList) => {
|
|
18046
18136
|
if (fileList.length === 0) return;
|
|
18047
18137
|
const remainingSlots = maxFiles - files.length;
|
|
@@ -18114,7 +18204,7 @@ function FileUpload({
|
|
|
18114
18204
|
},
|
|
18115
18205
|
[files, maxFiles, maxSize, uploadHandler, onUpload, onChange, addToast, t]
|
|
18116
18206
|
);
|
|
18117
|
-
const handleDrop =
|
|
18207
|
+
const handleDrop = useCallback17(
|
|
18118
18208
|
(e) => {
|
|
18119
18209
|
e.preventDefault();
|
|
18120
18210
|
e.stopPropagation();
|
|
@@ -18125,7 +18215,7 @@ function FileUpload({
|
|
|
18125
18215
|
},
|
|
18126
18216
|
[disabled, processFiles]
|
|
18127
18217
|
);
|
|
18128
|
-
const handleFileSelect =
|
|
18218
|
+
const handleFileSelect = useCallback17(
|
|
18129
18219
|
(e) => {
|
|
18130
18220
|
const selectedFiles = Array.from(e.target.files || []);
|
|
18131
18221
|
processFiles(selectedFiles);
|
|
@@ -18135,7 +18225,7 @@ function FileUpload({
|
|
|
18135
18225
|
},
|
|
18136
18226
|
[processFiles]
|
|
18137
18227
|
);
|
|
18138
|
-
const handleRemove =
|
|
18228
|
+
const handleRemove = useCallback17(
|
|
18139
18229
|
(fileId) => {
|
|
18140
18230
|
setFiles((prev) => {
|
|
18141
18231
|
const fileToRemove = prev.find((f) => f.id === fileId);
|
|
@@ -18153,7 +18243,7 @@ function FileUpload({
|
|
|
18153
18243
|
const handleBrowseClick = () => {
|
|
18154
18244
|
fileInputRef.current?.click();
|
|
18155
18245
|
};
|
|
18156
|
-
const handleRetry =
|
|
18246
|
+
const handleRetry = useCallback17(
|
|
18157
18247
|
(fileEntry) => {
|
|
18158
18248
|
if (!uploadHandler || !fileEntry.file) return;
|
|
18159
18249
|
processFiles([fileEntry.file]);
|
|
@@ -20481,7 +20571,7 @@ function ColorPicker({
|
|
|
20481
20571
|
}
|
|
20482
20572
|
|
|
20483
20573
|
// src/components/MusicPlayer.tsx
|
|
20484
|
-
import { useState as useState39, useRef as
|
|
20574
|
+
import { useState as useState39, useRef as useRef24, useEffect as useEffect29 } from "react";
|
|
20485
20575
|
import { Play as Play2, Pause as Pause2, SkipForward, SkipBack, Volume2 as Volume22, VolumeX as VolumeX2, List as List2, X as X17 } from "lucide-react";
|
|
20486
20576
|
import { jsx as jsx58, jsxs as jsxs48 } from "react/jsx-runtime";
|
|
20487
20577
|
var DEFAULT_PLAYLIST = [
|
|
@@ -20610,7 +20700,7 @@ var MusicPlayer = ({
|
|
|
20610
20700
|
const [volume, setVolume] = useState39(1);
|
|
20611
20701
|
const [isMuted, setIsMuted] = useState39(false);
|
|
20612
20702
|
const [showPlaylist, setShowPlaylist] = useState39(initialShowPlaylist);
|
|
20613
|
-
const audioRef =
|
|
20703
|
+
const audioRef = useRef24(null);
|
|
20614
20704
|
const currentSong = playlist[currentSongIndex];
|
|
20615
20705
|
useEffect29(() => {
|
|
20616
20706
|
if (audioRef.current) {
|
|
@@ -22859,7 +22949,7 @@ function AccessDenied({
|
|
|
22859
22949
|
|
|
22860
22950
|
// src/components/ThemeToggleHeadless.tsx
|
|
22861
22951
|
import { Moon as Moon2, Sun as Sun2, Monitor } from "lucide-react";
|
|
22862
|
-
import { useRef as
|
|
22952
|
+
import { useRef as useRef25, useState as useState40 } from "react";
|
|
22863
22953
|
import { createPortal as createPortal6 } from "react-dom";
|
|
22864
22954
|
import { Fragment as Fragment23, jsx as jsx71, jsxs as jsxs60 } from "react/jsx-runtime";
|
|
22865
22955
|
function ThemeToggleHeadless({
|
|
@@ -22870,7 +22960,7 @@ function ThemeToggleHeadless({
|
|
|
22870
22960
|
}) {
|
|
22871
22961
|
const [isOpen, setIsOpen] = useState40(false);
|
|
22872
22962
|
const isHydrated = useHydrated();
|
|
22873
|
-
const triggerRef =
|
|
22963
|
+
const triggerRef = useRef25(null);
|
|
22874
22964
|
const [dropdownPosition, setDropdownPosition] = useState40(null);
|
|
22875
22965
|
const themes = [
|
|
22876
22966
|
{ value: "light", label: labels?.light ?? "Light", icon: Sun2 },
|
|
@@ -22960,7 +23050,7 @@ function ThemeToggleHeadless({
|
|
|
22960
23050
|
}
|
|
22961
23051
|
|
|
22962
23052
|
// src/components/LanguageSwitcherHeadless.tsx
|
|
22963
|
-
import { useRef as
|
|
23053
|
+
import { useRef as useRef26, useState as useState41 } from "react";
|
|
22964
23054
|
import { createPortal as createPortal7 } from "react-dom";
|
|
22965
23055
|
import { Globe } from "lucide-react";
|
|
22966
23056
|
import { Fragment as Fragment24, jsx as jsx72, jsxs as jsxs61 } from "react/jsx-runtime";
|
|
@@ -22973,7 +23063,7 @@ function LanguageSwitcherHeadless({
|
|
|
22973
23063
|
}) {
|
|
22974
23064
|
const [isOpen, setIsOpen] = useState41(false);
|
|
22975
23065
|
const [dropdownPosition, setDropdownPosition] = useState41(null);
|
|
22976
|
-
const triggerButtonRef =
|
|
23066
|
+
const triggerButtonRef = useRef26(null);
|
|
22977
23067
|
const currentLanguage = locales.find((l) => l.code === currentLocale) || locales[0];
|
|
22978
23068
|
const calculatePosition = () => {
|
|
22979
23069
|
const rect = triggerButtonRef.current?.getBoundingClientRect();
|
|
@@ -23109,7 +23199,7 @@ function useLocale2() {
|
|
|
23109
23199
|
}
|
|
23110
23200
|
|
|
23111
23201
|
// src/components/UEditor/UEditor.tsx
|
|
23112
|
-
import React76, { useEffect as useEffect36, useImperativeHandle as useImperativeHandle3, useMemo as useMemo24, useRef as
|
|
23202
|
+
import React76, { useEffect as useEffect36, useImperativeHandle as useImperativeHandle3, useMemo as useMemo24, useRef as useRef34 } from "react";
|
|
23113
23203
|
import { useEditor, EditorContent } from "@tiptap/react";
|
|
23114
23204
|
|
|
23115
23205
|
// src/components/UEditor/extensions.ts
|
|
@@ -23148,7 +23238,7 @@ import { common, createLowlight } from "lowlight";
|
|
|
23148
23238
|
import { Extension } from "@tiptap/core";
|
|
23149
23239
|
import Suggestion from "@tiptap/suggestion";
|
|
23150
23240
|
import { ReactRenderer } from "@tiptap/react";
|
|
23151
|
-
import React66, { forwardRef as forwardRef14, useEffect as useEffect31, useImperativeHandle, useRef as
|
|
23241
|
+
import React66, { forwardRef as forwardRef14, useEffect as useEffect31, useImperativeHandle, useRef as useRef27 } from "react";
|
|
23152
23242
|
import {
|
|
23153
23243
|
FileCode as FileCode2,
|
|
23154
23244
|
Heading1,
|
|
@@ -23354,7 +23444,7 @@ function buildSlashCommandItems({
|
|
|
23354
23444
|
}
|
|
23355
23445
|
var SlashCommandList = forwardRef14((props, ref) => {
|
|
23356
23446
|
const [selectedIndex, setSelectedIndex] = useResettingIndex2(props.items);
|
|
23357
|
-
const listRef =
|
|
23447
|
+
const listRef = useRef27(null);
|
|
23358
23448
|
useEffect31(() => {
|
|
23359
23449
|
const selectedElement = listRef.current?.querySelector(`[data-index="${selectedIndex}"]`);
|
|
23360
23450
|
selectedElement?.scrollIntoView({ block: "nearest" });
|
|
@@ -23856,7 +23946,7 @@ var UEditorPlaceholder = Extension4.create({
|
|
|
23856
23946
|
});
|
|
23857
23947
|
|
|
23858
23948
|
// src/components/UEditor/resizable-image.tsx
|
|
23859
|
-
import { useEffect as useEffect32, useRef as
|
|
23949
|
+
import { useEffect as useEffect32, useRef as useRef28, useState as useState42 } from "react";
|
|
23860
23950
|
import Image3 from "@tiptap/extension-image";
|
|
23861
23951
|
import { mergeAttributes } from "@tiptap/core";
|
|
23862
23952
|
import { NodeViewWrapper, ReactNodeViewRenderer } from "@tiptap/react";
|
|
@@ -23905,8 +23995,8 @@ function getImageLayoutStyles(layout) {
|
|
|
23905
23995
|
}
|
|
23906
23996
|
function ResizableImageNodeView(props) {
|
|
23907
23997
|
const { node, selected, updateAttributes, editor, getPos } = props;
|
|
23908
|
-
const wrapperRef =
|
|
23909
|
-
const imgRef =
|
|
23998
|
+
const wrapperRef = useRef28(null);
|
|
23999
|
+
const imgRef = useRef28(null);
|
|
23910
24000
|
const [isHovered, setIsHovered] = useState42(false);
|
|
23911
24001
|
const [isResizing, setIsResizing] = useState42(false);
|
|
23912
24002
|
const widthAttr = toNullableNumber(node.attrs["width"]);
|
|
@@ -23914,7 +24004,7 @@ function ResizableImageNodeView(props) {
|
|
|
23914
24004
|
const textAlign = String(node.attrs["textAlign"] ?? "");
|
|
23915
24005
|
const imageLayout = parseImageLayout(node.attrs["imageLayout"]);
|
|
23916
24006
|
const preserveAspectByDefault = imageLayout === "left" || imageLayout === "right";
|
|
23917
|
-
const dragStateRef =
|
|
24007
|
+
const dragStateRef = useRef28(null);
|
|
23918
24008
|
useEffect32(() => {
|
|
23919
24009
|
const img = imgRef.current;
|
|
23920
24010
|
if (!img) return;
|
|
@@ -24571,7 +24661,7 @@ function buildUEditorExtensions({
|
|
|
24571
24661
|
}
|
|
24572
24662
|
|
|
24573
24663
|
// src/components/UEditor/toolbar.tsx
|
|
24574
|
-
import React71, { useRef as
|
|
24664
|
+
import React71, { useRef as useRef30, useState as useState44 } from "react";
|
|
24575
24665
|
import {
|
|
24576
24666
|
AlignCenter,
|
|
24577
24667
|
AlignJustify,
|
|
@@ -24763,7 +24853,7 @@ function deleteSelectedImage(editor) {
|
|
|
24763
24853
|
}
|
|
24764
24854
|
|
|
24765
24855
|
// src/components/UEditor/inputs.tsx
|
|
24766
|
-
import { useEffect as useEffect33, useRef as
|
|
24856
|
+
import { useEffect as useEffect33, useRef as useRef29, useState as useState43 } from "react";
|
|
24767
24857
|
import { Check as Check10, X as X19 } from "lucide-react";
|
|
24768
24858
|
import { jsx as jsx78, jsxs as jsxs66 } from "react/jsx-runtime";
|
|
24769
24859
|
function normalizeUrl(raw) {
|
|
@@ -24776,7 +24866,7 @@ var LinkInput = ({
|
|
|
24776
24866
|
}) => {
|
|
24777
24867
|
const t = useSmartTranslations("UEditor");
|
|
24778
24868
|
const [url, setUrl] = useState43(initialUrl);
|
|
24779
|
-
const inputRef =
|
|
24869
|
+
const inputRef = useRef29(null);
|
|
24780
24870
|
useEffect33(() => {
|
|
24781
24871
|
inputRef.current?.focus();
|
|
24782
24872
|
inputRef.current?.select();
|
|
@@ -24806,7 +24896,7 @@ var ImageInput = ({ onSubmit, onCancel }) => {
|
|
|
24806
24896
|
const t = useSmartTranslations("UEditor");
|
|
24807
24897
|
const [url, setUrl] = useState43("");
|
|
24808
24898
|
const [alt, setAlt] = useState43("");
|
|
24809
|
-
const inputRef =
|
|
24899
|
+
const inputRef = useRef29(null);
|
|
24810
24900
|
useEffect33(() => {
|
|
24811
24901
|
inputRef.current?.focus();
|
|
24812
24902
|
}, []);
|
|
@@ -25011,8 +25101,8 @@ var EditorToolbar = ({
|
|
|
25011
25101
|
const { textColors, highlightColors } = useEditorColors();
|
|
25012
25102
|
const [showImageInput, setShowImageInput] = useState44(false);
|
|
25013
25103
|
const [isTableMenuOpen, setIsTableMenuOpen] = useState44(false);
|
|
25014
|
-
const tableCommandAnchorPosRef =
|
|
25015
|
-
const fileInputRef =
|
|
25104
|
+
const tableCommandAnchorPosRef = useRef30(null);
|
|
25105
|
+
const fileInputRef = useRef30(null);
|
|
25016
25106
|
const [isUploadingImage, setIsUploadingImage] = useState44(false);
|
|
25017
25107
|
const [imageUploadError, setImageUploadError] = useState44(null);
|
|
25018
25108
|
const [fontSizeDraft, setFontSizeDraft] = useState44("");
|
|
@@ -25830,7 +25920,7 @@ var EditorToolbar = ({
|
|
|
25830
25920
|
};
|
|
25831
25921
|
|
|
25832
25922
|
// src/components/UEditor/menus.tsx
|
|
25833
|
-
import { useCallback as
|
|
25923
|
+
import { useCallback as useCallback20, useEffect as useEffect34, useMemo as useMemo23, useRef as useRef31, useState as useState45 } from "react";
|
|
25834
25924
|
import { createPortal as createPortal8 } from "react-dom";
|
|
25835
25925
|
import {
|
|
25836
25926
|
AlignCenter as AlignCenter2,
|
|
@@ -25854,7 +25944,7 @@ var FloatingSlashCommandMenu = ({ editor, onClose }) => {
|
|
|
25854
25944
|
const t = useSmartTranslations("UEditor");
|
|
25855
25945
|
const messages = useMemo23(() => buildSlashCommandMessages(t), [t]);
|
|
25856
25946
|
const items = useMemo23(() => buildSlashCommandItems({ query: "", messages }), [messages]);
|
|
25857
|
-
const listRef =
|
|
25947
|
+
const listRef = useRef31(null);
|
|
25858
25948
|
useEffect34(() => {
|
|
25859
25949
|
const handleKeyDown2 = (event) => {
|
|
25860
25950
|
if (event.key === "Escape") {
|
|
@@ -26119,10 +26209,10 @@ var CustomBubbleMenu = ({
|
|
|
26119
26209
|
const BUBBLE_MENU_OFFSET = 16;
|
|
26120
26210
|
const [isVisible, setIsVisible] = useState45(false);
|
|
26121
26211
|
const [position, setPosition] = useState45({ top: 0, left: 0 });
|
|
26122
|
-
const menuRef =
|
|
26123
|
-
const keepOpenRef =
|
|
26124
|
-
const showTimeoutRef =
|
|
26125
|
-
const setKeepOpen =
|
|
26212
|
+
const menuRef = useRef31(null);
|
|
26213
|
+
const keepOpenRef = useRef31(false);
|
|
26214
|
+
const showTimeoutRef = useRef31(null);
|
|
26215
|
+
const setKeepOpen = useCallback20((next) => {
|
|
26126
26216
|
keepOpenRef.current = next;
|
|
26127
26217
|
if (next) setIsVisible(true);
|
|
26128
26218
|
}, []);
|
|
@@ -31962,10 +32052,10 @@ var UEDITOR_PROSEMIRROR_CLASS_NAME = cn(
|
|
|
31962
32052
|
);
|
|
31963
32053
|
|
|
31964
32054
|
// src/components/UEditor/use-table-interactions.ts
|
|
31965
|
-
import React75, { useEffect as useEffect35, useRef as
|
|
32055
|
+
import React75, { useEffect as useEffect35, useRef as useRef33 } from "react";
|
|
31966
32056
|
|
|
31967
32057
|
// src/components/UEditor/use-table-row-resize.ts
|
|
31968
|
-
import React74, { useRef as
|
|
32058
|
+
import React74, { useRef as useRef32 } from "react";
|
|
31969
32059
|
function useTableRowResize({
|
|
31970
32060
|
editor,
|
|
31971
32061
|
setHoveredTableCell,
|
|
@@ -31974,8 +32064,8 @@ function useTableRowResize({
|
|
|
31974
32064
|
clearAllTableResizeHover,
|
|
31975
32065
|
scheduleTableLayoutSync
|
|
31976
32066
|
}) {
|
|
31977
|
-
const commitFrameRef =
|
|
31978
|
-
const stateRef =
|
|
32067
|
+
const commitFrameRef = useRef32(null);
|
|
32068
|
+
const stateRef = useRef32(null);
|
|
31979
32069
|
const commitPreview = React74.useCallback(() => {
|
|
31980
32070
|
if (!editor) return;
|
|
31981
32071
|
const state = stateRef.current;
|
|
@@ -32128,13 +32218,14 @@ function useTableRowResize({
|
|
|
32128
32218
|
|
|
32129
32219
|
// src/components/UEditor/use-table-interactions.ts
|
|
32130
32220
|
function useUEditorTableInteractions(editor) {
|
|
32131
|
-
const editorContentRef =
|
|
32132
|
-
const tableColumnGuideRef =
|
|
32133
|
-
const tableRowGuideRef =
|
|
32134
|
-
const activeTableCellHighlightRef =
|
|
32135
|
-
const hoveredTableCellRef =
|
|
32136
|
-
const activeTableCellRef =
|
|
32137
|
-
const
|
|
32221
|
+
const editorContentRef = useRef33(null);
|
|
32222
|
+
const tableColumnGuideRef = useRef33(null);
|
|
32223
|
+
const tableRowGuideRef = useRef33(null);
|
|
32224
|
+
const activeTableCellHighlightRef = useRef33(null);
|
|
32225
|
+
const hoveredTableCellRef = useRef33(null);
|
|
32226
|
+
const activeTableCellRef = useRef33(null);
|
|
32227
|
+
const suppressActiveCellHighlightRef = useRef33(false);
|
|
32228
|
+
const tableLayoutSyncFrameRef = useRef33(null);
|
|
32138
32229
|
const setEditorResizeCursor = React75.useCallback((cursor) => {
|
|
32139
32230
|
const proseMirror = editorContentRef.current?.querySelector(".ProseMirror");
|
|
32140
32231
|
if (proseMirror) {
|
|
@@ -32164,7 +32255,7 @@ function useUEditorTableInteractions(editor) {
|
|
|
32164
32255
|
const surface = editorContentRef.current;
|
|
32165
32256
|
const highlight = activeTableCellHighlightRef.current;
|
|
32166
32257
|
if (!highlight) return;
|
|
32167
|
-
if (!surface || !cell) {
|
|
32258
|
+
if (suppressActiveCellHighlightRef.current || !surface || !cell) {
|
|
32168
32259
|
highlight.style.display = "none";
|
|
32169
32260
|
return;
|
|
32170
32261
|
}
|
|
@@ -32324,16 +32415,31 @@ function useUEditorTableInteractions(editor) {
|
|
|
32324
32415
|
const row = cell.closest("tr");
|
|
32325
32416
|
const table = cell.closest("table");
|
|
32326
32417
|
if (!(row instanceof HTMLTableRowElement) || !(table instanceof HTMLTableElement)) return;
|
|
32327
|
-
beginResize(event, table, row, cell)
|
|
32418
|
+
if (beginResize(event, table, row, cell)) {
|
|
32419
|
+
suppressActiveCellHighlightRef.current = true;
|
|
32420
|
+
updateActiveCellHighlight(null);
|
|
32421
|
+
}
|
|
32328
32422
|
};
|
|
32329
32423
|
const handlePointerMove = (event) => {
|
|
32330
32424
|
handleRowResizePointerMove(event);
|
|
32331
32425
|
};
|
|
32332
32426
|
const handlePointerUp = (event) => {
|
|
32427
|
+
const wasRowResizing = isRowResizing();
|
|
32333
32428
|
handleRowResizePointerUp(event);
|
|
32429
|
+
if (wasRowResizing) {
|
|
32430
|
+
suppressActiveCellHighlightRef.current = false;
|
|
32431
|
+
requestAnimationFrame(() => {
|
|
32432
|
+
updateActiveCellHighlight(activeTableCellRef.current);
|
|
32433
|
+
});
|
|
32434
|
+
}
|
|
32334
32435
|
};
|
|
32335
32436
|
const handleWindowBlur = () => {
|
|
32437
|
+
const wasRowResizing = isRowResizing();
|
|
32336
32438
|
cancelResize();
|
|
32439
|
+
if (wasRowResizing) {
|
|
32440
|
+
suppressActiveCellHighlightRef.current = false;
|
|
32441
|
+
updateActiveCellHighlight(activeTableCellRef.current);
|
|
32442
|
+
}
|
|
32337
32443
|
};
|
|
32338
32444
|
proseMirror.addEventListener("mousemove", handleEditorMouseMove);
|
|
32339
32445
|
proseMirror.addEventListener("mouseleave", handleEditorMouseLeave);
|
|
@@ -32377,6 +32483,7 @@ function useUEditorTableInteractions(editor) {
|
|
|
32377
32483
|
tableLayoutSyncFrameRef.current = null;
|
|
32378
32484
|
}
|
|
32379
32485
|
cleanupRowResize();
|
|
32486
|
+
suppressActiveCellHighlightRef.current = false;
|
|
32380
32487
|
document.body.style.cursor = "";
|
|
32381
32488
|
clearActiveTableCell();
|
|
32382
32489
|
clearHoveredTableCell();
|
|
@@ -32424,8 +32531,8 @@ var UEditor = React76.forwardRef(({
|
|
|
32424
32531
|
}, ref) => {
|
|
32425
32532
|
const t = useSmartTranslations("UEditor");
|
|
32426
32533
|
const effectivePlaceholder = placeholder ?? t("placeholder");
|
|
32427
|
-
const inFlightPrepareRef =
|
|
32428
|
-
const lastAppliedContentRef =
|
|
32534
|
+
const inFlightPrepareRef = useRef34(null);
|
|
32535
|
+
const lastAppliedContentRef = useRef34(content ?? "");
|
|
32429
32536
|
const extensions = useMemo24(
|
|
32430
32537
|
() => buildUEditorExtensions({
|
|
32431
32538
|
placeholder: effectivePlaceholder,
|
|
@@ -32595,6 +32702,7 @@ var UEditor = React76.forwardRef(({
|
|
|
32595
32702
|
{
|
|
32596
32703
|
ref: activeTableCellHighlightRef,
|
|
32597
32704
|
"aria-hidden": "true",
|
|
32705
|
+
"data-ueditor-active-cell-highlight": "",
|
|
32598
32706
|
className: "pointer-events-none hidden absolute z-20 rounded-[2px] border-2 border-primary bg-primary/10 transition-[left,top,width,height] duration-100"
|
|
32599
32707
|
}
|
|
32600
32708
|
),
|