@cherrystudio/file-preview 0.2.3 → 0.2.5
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/README.md +6 -6
- package/dist/{Combination-i8Z9CJHc.js → Combination-CBuGcY5S.js} +2 -2
- package/dist/{FilePreviewTooLarge-DC7vPyMI.js → FilePreviewTooLarge-CZHFMl0w.js} +1 -1
- package/dist/{FilePreviewToolbarButton-ptqwCTnz.js → FilePreviewToolbarButton-BUzQxFLX.js} +27 -6
- package/dist/{ImageFilePreview-C_P1iIEi.js → ImageFilePreview-JR2KQf2x.js} +6 -6
- package/dist/{PdfFilePreview-CbrMcPzo.js → PdfFilePreview-B34-QmrL.js} +26 -11
- package/dist/{PowerPointFilePreview-9E6kUy_A.js → PowerPointFilePreview-NukTW9aw.js} +6 -6
- package/dist/{RtfFilePreview-Bgl6lmWy.js → RtfFilePreview-Bdy8iPf9.js} +3 -3
- package/dist/{SpreadsheetFilePreview-PWFG3UY3.js → SpreadsheetFilePreview-jB17TCNJ.js} +5 -5
- package/dist/{WordFilePreview-Do062CDe.js → WordFilePreview-YznLhQcq.js} +13 -8
- package/dist/{circle-alert-sByhBDN4.js → circle-alert-DOgmM2Zn.js} +1 -1
- package/dist/{imageFilePreviewPlugin-D6hV1Hm1.js → imageFilePreviewPlugin-C02W1uyU.js} +1 -1
- package/dist/react.js +8 -8
- package/dist/{rotate-ccw-Bx-jjhVm.js → rotate-ccw-q9GRRcYM.js} +1 -1
- package/dist/styles.css +167 -64
- package/dist/useTranslation-ezxuF2DX.js +5332 -0
- package/dist/{zoom-out-B2XJ64Kx.js → zoom-out-DYpR5v9K.js} +1 -1
- package/package.json +1 -1
- package/dist/useTranslation-BJY4EKsz.js +0 -3631
package/README.md
CHANGED
|
@@ -193,12 +193,12 @@ Escape, the close button, the backdrop, and selecting an internal destination di
|
|
|
193
193
|
it. Explicitly selecting either PDF layout also keeps page-width zoom in sync with
|
|
194
194
|
container resizing; manual zoom is preserved.
|
|
195
195
|
|
|
196
|
-
DOCX `fit-width`
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
196
|
+
DOCX `fit-width` fits the widest page to the pane, permits scales below 50%, and
|
|
197
|
+
never enlarges beyond 200%. It follows container resizing until the user zooms using
|
|
198
|
+
the toolbar or a pinch; Reset resumes fitting. No orientation message is needed for
|
|
199
|
+
DOCX. `normalizeSymbolBullets` is read when opening the document: it maps known
|
|
200
|
+
single-character Symbol/Wingdings bullet markers to Unicode and removes their legacy
|
|
201
|
+
font override. Other fonts, unknown symbols and numbered lists are preserved.
|
|
202
202
|
|
|
203
203
|
`bottomInset: 'content'` adds trailing space inside PDF, DOCX and PPTX document scroll
|
|
204
204
|
containers, in unscaled host CSS pixels. Both PDF outline layouts receive trailing
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { b as useComposedRefs } from "./useTranslation-
|
|
2
|
-
import { v as useCallbackRef$1, y as Primitive } from "./FilePreviewToolbarButton-
|
|
1
|
+
import { b as useComposedRefs } from "./useTranslation-ezxuF2DX.js";
|
|
2
|
+
import { v as useCallbackRef$1, y as Primitive } from "./FilePreviewToolbarButton-BUzQxFLX.js";
|
|
3
3
|
import * as React$1 from "react";
|
|
4
4
|
import { useState } from "react";
|
|
5
5
|
import { jsx } from "react/jsx-runtime";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as usePreviewHost, d as EmptyState, h as FileWarning, t as useTranslation } from "./useTranslation-
|
|
1
|
+
import { a as usePreviewHost, d as EmptyState, h as FileWarning, t as useTranslation } from "./useTranslation-ezxuF2DX.js";
|
|
2
2
|
import { jsx } from "react/jsx-runtime";
|
|
3
3
|
//#region src/formatFileSize.ts
|
|
4
4
|
function formatFileSize(size) {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { b as useComposedRefs, f as Button, p as cn, v as createSlot, y as createSlottable } from "./useTranslation-
|
|
1
|
+
import { b as useComposedRefs, f as Button, p as cn, v as createSlot, y as createSlottable } from "./useTranslation-ezxuF2DX.js";
|
|
2
2
|
import * as React$1 from "react";
|
|
3
3
|
import { useLayoutEffect } from "react";
|
|
4
4
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
@@ -2584,21 +2584,40 @@ function isFunction(value) {
|
|
|
2584
2584
|
//#endregion
|
|
2585
2585
|
//#region ../ui/src/components/primitives/portal-container.tsx
|
|
2586
2586
|
var PortalContainerContext = React$1.createContext(null);
|
|
2587
|
+
var TooltipPortalContainerContext = React$1.createContext(null);
|
|
2588
|
+
var TooltipZIndexContext = React$1.createContext(void 0);
|
|
2587
2589
|
var DialogPortalContainerContext = React$1.createContext(null);
|
|
2588
2590
|
/**
|
|
2589
2591
|
* Overlays should portal into the nearest provided container, usually dialog
|
|
2590
2592
|
* content, so Radix focus traps and dismiss layers treat nested overlays as
|
|
2591
2593
|
* inside the same interaction boundary.
|
|
2594
|
+
*
|
|
2595
|
+
* @param tooltipContainer - Portal target for tooltips, which never take focus and so
|
|
2596
|
+
* can live outside a container that clips them. Defaults to `container`.
|
|
2597
|
+
* @param tooltipZIndex - z-index for tooltips portaled outside `container`, so they stack
|
|
2598
|
+
* above the surface that owns them. Omitted, tooltips keep their own z-index.
|
|
2592
2599
|
*/
|
|
2593
|
-
function PortalContainerProvider({ container, children }) {
|
|
2600
|
+
function PortalContainerProvider({ container, tooltipContainer = container, tooltipZIndex, children }) {
|
|
2594
2601
|
return /* @__PURE__ */ jsx(PortalContainerContext, {
|
|
2595
2602
|
value: container,
|
|
2596
|
-
children
|
|
2603
|
+
children: /* @__PURE__ */ jsx(TooltipPortalContainerContext, {
|
|
2604
|
+
value: tooltipContainer,
|
|
2605
|
+
children: /* @__PURE__ */ jsx(TooltipZIndexContext, {
|
|
2606
|
+
value: tooltipZIndex,
|
|
2607
|
+
children
|
|
2608
|
+
})
|
|
2609
|
+
})
|
|
2597
2610
|
});
|
|
2598
2611
|
}
|
|
2599
2612
|
function usePortalContainer() {
|
|
2600
2613
|
return React$1.use(PortalContainerContext);
|
|
2601
2614
|
}
|
|
2615
|
+
function useTooltipPortalContainer() {
|
|
2616
|
+
return React$1.use(TooltipPortalContainerContext);
|
|
2617
|
+
}
|
|
2618
|
+
function useTooltipZIndex() {
|
|
2619
|
+
return React$1.use(TooltipZIndexContext);
|
|
2620
|
+
}
|
|
2602
2621
|
/**
|
|
2603
2622
|
* Dialogs use a page-level portal target so they remain attached to their owning
|
|
2604
2623
|
* tab without inheriting the transformed content node of a parent dialog.
|
|
@@ -3358,11 +3377,12 @@ function TooltipTrigger({ onFocus, ...props }) {
|
|
|
3358
3377
|
...props
|
|
3359
3378
|
});
|
|
3360
3379
|
}
|
|
3361
|
-
var contentStyles = "z-[80] w-fit max-w-80 origin-(--radix-tooltip-content-transform-origin) rounded-md bg-neutral-
|
|
3362
|
-
var arrowStyles = "z-[80] -translate-y-px fill-neutral-
|
|
3380
|
+
var contentStyles = "z-[80] w-fit max-w-80 origin-(--radix-tooltip-content-transform-origin) rounded-md bg-neutral-100 px-3 py-1.5 text-neutral-900 text-xs leading-relaxed whitespace-normal break-words data-[state*=open]:animate-in data-[state*=open]:fade-in-0 data-[state*=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 dark:bg-neutral-900 dark:text-neutral-50 [-webkit-app-region:no-drag]";
|
|
3381
|
+
var arrowStyles = "z-[80] -translate-y-px fill-neutral-100 stroke-neutral-100 stroke-2 dark:fill-neutral-900 dark:stroke-neutral-900 [paint-order:stroke_fill]";
|
|
3363
3382
|
var Tooltip = ({ children, content, title, placement, delay = 0, sideOffset = 8, showArrow = true, fullWidthTrigger = false, classNames, className, isDisabled, isOpen, onOpenChange, onClick, portalContainer, asChild = false }) => {
|
|
3364
3383
|
const tooltipContent = content ?? title;
|
|
3365
|
-
const defaultPortalContainer =
|
|
3384
|
+
const defaultPortalContainer = useTooltipPortalContainer();
|
|
3385
|
+
const zIndex = useTooltipZIndex();
|
|
3366
3386
|
const surfaceActive = React$1.use(TooltipSurfaceContext);
|
|
3367
3387
|
const disabled = !tooltipContent || isDisabled || !surfaceActive;
|
|
3368
3388
|
const { contentVisible, effectiveOpen, handleOpenChange } = useTooltipController(isOpen, onOpenChange, false, disabled);
|
|
@@ -3400,6 +3420,7 @@ var Tooltip = ({ children, content, title, placement, delay = 0, sideOffset = 8,
|
|
|
3400
3420
|
align,
|
|
3401
3421
|
sideOffset,
|
|
3402
3422
|
className: cn(contentStyles, classNames?.content, className),
|
|
3423
|
+
style: zIndex ? { zIndex } : void 0,
|
|
3403
3424
|
children: [tooltipContent, showArrow && /* @__PURE__ */ jsx(Arrow2, {
|
|
3404
3425
|
width: 12,
|
|
3405
3426
|
height: 6,
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { r as readPreviewDocument, t as PreviewError } from "./source-Rx3etU3y.js";
|
|
2
|
-
import { _ as cva, a as usePreviewHost, b as useComposedRefs, d as EmptyState, g as createLucideIcon, m as LoaderCircle, p as cn, r as FilePreviewLayout, s as FilePreviewToolbar, t as useTranslation, v as createSlot } from "./useTranslation-
|
|
3
|
-
import { n as ZoomIn, t as ZoomOut } from "./zoom-out-
|
|
4
|
-
import { S as composeEventHandlers, a as usePortalContainer, b as dispatchDiscreteCustomEvent, c as Portal$1, d as Content, f as Root2$1, g as DismissableLayer, h as useLayoutEffect2, l as Anchor, m as useId$1, o as useControllableState, p as createPopperScope, s as Presence, t as FilePreviewToolbarButton, u as Arrow, v as useCallbackRef, x as createContextScope, y as Primitive } from "./FilePreviewToolbarButton-
|
|
5
|
-
import { i as useFocusGuards, n as hideOthers, r as FocusScope, t as ReactRemoveScroll } from "./Combination-
|
|
6
|
-
import { t as imageFilePreviewPlugin } from "./imageFilePreviewPlugin-
|
|
7
|
-
import { t as FilePreviewTooLarge } from "./FilePreviewTooLarge-
|
|
2
|
+
import { _ as cva, a as usePreviewHost, b as useComposedRefs, d as EmptyState, g as createLucideIcon, m as LoaderCircle, p as cn, r as FilePreviewLayout, s as FilePreviewToolbar, t as useTranslation, v as createSlot } from "./useTranslation-ezxuF2DX.js";
|
|
3
|
+
import { n as ZoomIn, t as ZoomOut } from "./zoom-out-DYpR5v9K.js";
|
|
4
|
+
import { S as composeEventHandlers, a as usePortalContainer, b as dispatchDiscreteCustomEvent, c as Portal$1, d as Content, f as Root2$1, g as DismissableLayer, h as useLayoutEffect2, l as Anchor, m as useId$1, o as useControllableState, p as createPopperScope, s as Presence, t as FilePreviewToolbarButton, u as Arrow, v as useCallbackRef, x as createContextScope, y as Primitive } from "./FilePreviewToolbarButton-BUzQxFLX.js";
|
|
5
|
+
import { i as useFocusGuards, n as hideOthers, r as FocusScope, t as ReactRemoveScroll } from "./Combination-CBuGcY5S.js";
|
|
6
|
+
import { t as imageFilePreviewPlugin } from "./imageFilePreviewPlugin-C02W1uyU.js";
|
|
7
|
+
import { t as FilePreviewTooLarge } from "./FilePreviewTooLarge-CZHFMl0w.js";
|
|
8
8
|
import * as React$1 from "react";
|
|
9
9
|
import { useCallback, useEffect, useLayoutEffect, useMemo, useRef, useState } from "react";
|
|
10
10
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { i as readPreviewRange, n as assertPreviewRange, t as PreviewError } from "./source-Rx3etU3y.js";
|
|
2
|
-
import { a as usePreviewHost, b as useComposedRefs, d as EmptyState, f as Button, g as createLucideIcon, h as FileWarning, m as LoaderCircle, o as usePreviewLogger, p as cn, r as FilePreviewLayout, s as FilePreviewToolbar, t as useTranslation, u as
|
|
3
|
-
import { n as ChevronRight, r as ChevronLeft, t as RotateCcw } from "./rotate-ccw-
|
|
4
|
-
import { t as CircleAlert } from "./circle-alert-
|
|
5
|
-
import { n as ZoomIn, t as ZoomOut } from "./zoom-out-
|
|
6
|
-
import { S as composeEventHandlers, _ as useDismissableLayerSurface, c as Portal, g as DismissableLayer, i as useDialogPortalContainer, m as useId$1, o as useControllableState, r as PortalContainerProvider, s as Presence, t as FilePreviewToolbarButton, x as createContextScope, y as Primitive } from "./FilePreviewToolbarButton-
|
|
7
|
-
import { i as useFocusGuards, n as hideOthers, r as FocusScope, t as ReactRemoveScroll } from "./Combination-
|
|
2
|
+
import { a as usePreviewHost, b as useComposedRefs, d as EmptyState, f as Button, g as createLucideIcon, h as FileWarning, m as LoaderCircle, o as usePreviewLogger, p as cn, r as FilePreviewLayout, s as FilePreviewToolbar, t as useTranslation, u as ScrollArea, v as createSlot } from "./useTranslation-ezxuF2DX.js";
|
|
3
|
+
import { n as ChevronRight, r as ChevronLeft, t as RotateCcw } from "./rotate-ccw-q9GRRcYM.js";
|
|
4
|
+
import { t as CircleAlert } from "./circle-alert-DOgmM2Zn.js";
|
|
5
|
+
import { n as ZoomIn, t as ZoomOut } from "./zoom-out-DYpR5v9K.js";
|
|
6
|
+
import { S as composeEventHandlers, _ as useDismissableLayerSurface, c as Portal, g as DismissableLayer, i as useDialogPortalContainer, m as useId$1, o as useControllableState, r as PortalContainerProvider, s as Presence, t as FilePreviewToolbarButton, x as createContextScope, y as Primitive } from "./FilePreviewToolbarButton-BUzQxFLX.js";
|
|
7
|
+
import { i as useFocusGuards, n as hideOthers, r as FocusScope, t as ReactRemoveScroll } from "./Combination-CBuGcY5S.js";
|
|
8
8
|
import { t as createPreviewSelection } from "./selection-B0INvh6t.js";
|
|
9
9
|
import { t as attachTouchPinch } from "./touchPinch-C4fl-9fg.js";
|
|
10
10
|
import * as React$1 from "react";
|
|
@@ -334,13 +334,22 @@ var dialogContentSizeClass = {
|
|
|
334
334
|
lg: "sm:max-w-xl",
|
|
335
335
|
xl: "sm:max-w-[720px]"
|
|
336
336
|
};
|
|
337
|
-
function DialogContent({ className, children, closeLabel = "Close", closeOnOverlayClick = true, showCloseButton = true, motion = "directional", overlayClassName, onPointerDown, size = "default", ref, ...props }) {
|
|
337
|
+
function DialogContent({ className, children, closeLabel = "Close", closeOnOverlayClick = true, showCloseButton = true, motion = "directional", overlayClassName, onPointerDown, size = "default", style, ref, ...props }) {
|
|
338
|
+
const dialogPortalContainer = useDialogPortalContainer();
|
|
338
339
|
const [contentElement, setContentElement] = React$1.useState(null);
|
|
340
|
+
const [contentZIndex, setContentZIndex] = React$1.useState();
|
|
339
341
|
const handleRef = React$1.useCallback((node) => {
|
|
340
342
|
setContentElement(node);
|
|
341
343
|
if (typeof ref === "function") ref(node);
|
|
342
344
|
else if (ref) ref.current = node;
|
|
343
345
|
}, [ref]);
|
|
346
|
+
React$1.useLayoutEffect(() => {
|
|
347
|
+
if (contentElement) setContentZIndex(getComputedStyle(contentElement).zIndex);
|
|
348
|
+
}, [
|
|
349
|
+
contentElement,
|
|
350
|
+
className,
|
|
351
|
+
style
|
|
352
|
+
]);
|
|
344
353
|
return /* @__PURE__ */ jsxs(DialogPortal, {
|
|
345
354
|
"data-slot": "dialog-portal",
|
|
346
355
|
children: [/* @__PURE__ */ jsx(DialogClose, {
|
|
@@ -354,11 +363,14 @@ function DialogContent({ className, children, closeLabel = "Close", closeOnOverl
|
|
|
354
363
|
}), /* @__PURE__ */ jsx(DialogContent$1, {
|
|
355
364
|
ref: handleRef,
|
|
356
365
|
"data-slot": "dialog-content",
|
|
357
|
-
className: cn("fixed top-[50%] left-[50%] z-[80] grid w-full max-w-[calc(100%-2rem)] translate-x-[-50%] translate-y-[-50%] gap-4 rounded-3xl border-0 bg-card p-6 text-card-foreground shadow-xl [-webkit-app-region:no-drag]", "data-[state=open]:animate-in data-[state=open]:ease-[cubic-bezier(0.16,1,0.3,1)] data-[state=open]:animation-duration-[260ms] data-[state=open]:fade-in-0
|
|
366
|
+
className: cn("fixed top-[50%] left-[50%] z-[80] grid w-full max-w-[calc(100%-2rem)] translate-x-[-50%] translate-y-[-50%] gap-4 rounded-3xl border-0 bg-card p-6 text-card-foreground shadow-xl [-webkit-app-region:no-drag]", "data-[state=open]:animate-in data-[state=open]:ease-[cubic-bezier(0.16,1,0.3,1)] data-[state=open]:animation-duration-[260ms] data-[state=open]:fade-in-0", "data-[state=closed]:animate-out data-[state=closed]:ease-[cubic-bezier(0.4,0,1,1)] data-[state=closed]:animation-duration-[200ms] data-[state=closed]:fade-out-0", motion === "directional" && "data-[state=closed]:slide-out-to-bottom-4 data-[state=open]:slide-in-from-bottom-4", "fill-mode-both motion-reduce:animate-none", dialogContentSizeClass[size], className),
|
|
358
367
|
onPointerDown: composeEventHandlers(onPointerDown, (event) => event.stopPropagation(), { checkForDefaultPrevented: false }),
|
|
368
|
+
style,
|
|
359
369
|
...props,
|
|
360
370
|
children: /* @__PURE__ */ jsxs(PortalContainerProvider, {
|
|
361
371
|
container: contentElement,
|
|
372
|
+
tooltipContainer: dialogPortalContainer,
|
|
373
|
+
tooltipZIndex: contentZIndex,
|
|
362
374
|
children: [children, showCloseButton && /* @__PURE__ */ jsxs(DialogClose, {
|
|
363
375
|
"data-slot": "dialog-close",
|
|
364
376
|
className: "absolute top-4 right-4 rounded-md opacity-70 transition-opacity hover:opacity-100 focus:outline-hidden focus-visible:bg-accent focus-visible:opacity-100 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
|
|
@@ -29047,9 +29059,12 @@ function PdfOutline({ className, items, onNavigate, status }) {
|
|
|
29047
29059
|
children: [/* @__PURE__ */ jsx("h2", {
|
|
29048
29060
|
className: "flex h-10 shrink-0 items-center border-border-subtle border-b px-3 font-medium text-sm",
|
|
29049
29061
|
children: t("file_preview.pdf.outline.title")
|
|
29050
|
-
}), /* @__PURE__ */ jsx(
|
|
29051
|
-
className: "min-h-0 flex-1
|
|
29052
|
-
|
|
29062
|
+
}), /* @__PURE__ */ jsx(ScrollArea, {
|
|
29063
|
+
className: "min-h-0 flex-1",
|
|
29064
|
+
viewportProps: {
|
|
29065
|
+
className: "px-2 py-2",
|
|
29066
|
+
style: options?.bottomInset === "content" ? { paddingBottom: "calc(0.5rem + var(--file-preview-bottom-inset, 0px))" } : void 0
|
|
29067
|
+
},
|
|
29053
29068
|
children: status === "loading" ? /* @__PURE__ */ jsx("p", {
|
|
29054
29069
|
role: "status",
|
|
29055
29070
|
className: "px-2 py-1 text-muted-foreground text-xs",
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { i as __toESM } from "./rolldown-runtime-B-lAHAz2.js";
|
|
2
2
|
import { r as readPreviewDocument, t as PreviewError } from "./source-Rx3etU3y.js";
|
|
3
|
-
import { a as usePreviewHost, d as EmptyState, h as FileWarning, m as LoaderCircle, o as usePreviewLogger, r as FilePreviewLayout, s as FilePreviewToolbar, t as useTranslation } from "./useTranslation-
|
|
4
|
-
import { n as ChevronRight, r as ChevronLeft, t as RotateCcw } from "./rotate-ccw-
|
|
5
|
-
import { t as CircleAlert } from "./circle-alert-
|
|
6
|
-
import { n as ZoomIn, t as ZoomOut } from "./zoom-out-
|
|
7
|
-
import { t as FilePreviewToolbarButton } from "./FilePreviewToolbarButton-
|
|
8
|
-
import { t as FilePreviewTooLarge } from "./FilePreviewTooLarge-
|
|
3
|
+
import { a as usePreviewHost, d as EmptyState, h as FileWarning, m as LoaderCircle, o as usePreviewLogger, r as FilePreviewLayout, s as FilePreviewToolbar, t as useTranslation } from "./useTranslation-ezxuF2DX.js";
|
|
4
|
+
import { n as ChevronRight, r as ChevronLeft, t as RotateCcw } from "./rotate-ccw-q9GRRcYM.js";
|
|
5
|
+
import { t as CircleAlert } from "./circle-alert-DOgmM2Zn.js";
|
|
6
|
+
import { n as ZoomIn, t as ZoomOut } from "./zoom-out-DYpR5v9K.js";
|
|
7
|
+
import { t as FilePreviewToolbarButton } from "./FilePreviewToolbarButton-BUzQxFLX.js";
|
|
8
|
+
import { t as FilePreviewTooLarge } from "./FilePreviewTooLarge-CZHFMl0w.js";
|
|
9
9
|
import { t as createPreviewSelection } from "./selection-B0INvh6t.js";
|
|
10
10
|
import { t as require_jszip_min } from "./jszip.min-uwqlc4KL.js";
|
|
11
11
|
import { useCallback, useEffect, useLayoutEffect, useRef, useState } from "react";
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { i as __toESM, t as __commonJSMin } from "./rolldown-runtime-B-lAHAz2.js";
|
|
2
2
|
import { r as readPreviewDocument, t as PreviewError } from "./source-Rx3etU3y.js";
|
|
3
|
-
import { a as usePreviewHost, d as EmptyState, m as LoaderCircle, r as FilePreviewLayout, t as useTranslation } from "./useTranslation-
|
|
4
|
-
import { t as CircleAlert } from "./circle-alert-
|
|
5
|
-
import { t as FilePreviewTooLarge } from "./FilePreviewTooLarge-
|
|
3
|
+
import { a as usePreviewHost, d as EmptyState, m as LoaderCircle, r as FilePreviewLayout, t as useTranslation } from "./useTranslation-ezxuF2DX.js";
|
|
4
|
+
import { t as CircleAlert } from "./circle-alert-DOgmM2Zn.js";
|
|
5
|
+
import { t as FilePreviewTooLarge } from "./FilePreviewTooLarge-CZHFMl0w.js";
|
|
6
6
|
import { useEffect, useRef, useState } from "react";
|
|
7
7
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
8
8
|
//#region ../../node_modules/.pnpm/rtf.js@3.0.9_patch_hash=8f9a6825a5d8d1e4c4a5911165dc7e3398199e30ca7abc009df7bd0c612f3d24/node_modules/rtf.js/dist/EMFJS.bundle.js
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import "./documentAnchor-J7GGLU15.js";
|
|
2
2
|
import { r as readPreviewDocument, t as PreviewError } from "./source-Rx3etU3y.js";
|
|
3
|
-
import { _ as cva, a as usePreviewHost, d as EmptyState, m as LoaderCircle, o as usePreviewLogger, p as cn, r as FilePreviewLayout, t as useTranslation } from "./useTranslation-
|
|
4
|
-
import { t as CircleAlert } from "./circle-alert-
|
|
5
|
-
import { n as ZoomIn, t as ZoomOut } from "./zoom-out-
|
|
6
|
-
import { t as FilePreviewToolbarButton } from "./FilePreviewToolbarButton-
|
|
7
|
-
import { t as FilePreviewTooLarge } from "./FilePreviewTooLarge-
|
|
3
|
+
import { _ as cva, a as usePreviewHost, d as EmptyState, m as LoaderCircle, o as usePreviewLogger, p as cn, r as FilePreviewLayout, t as useTranslation } from "./useTranslation-ezxuF2DX.js";
|
|
4
|
+
import { t as CircleAlert } from "./circle-alert-DOgmM2Zn.js";
|
|
5
|
+
import { n as ZoomIn, t as ZoomOut } from "./zoom-out-DYpR5v9K.js";
|
|
6
|
+
import { t as FilePreviewToolbarButton } from "./FilePreviewToolbarButton-BUzQxFLX.js";
|
|
7
|
+
import { t as FilePreviewTooLarge } from "./FilePreviewTooLarge-CZHFMl0w.js";
|
|
8
8
|
import { n as normalizeSelectionText, t as createPreviewSelection } from "./selection-B0INvh6t.js";
|
|
9
9
|
import * as React$1 from "react";
|
|
10
10
|
import React, { memo, useCallback, useEffect, useLayoutEffect, useMemo, useRef, useState } from "react";
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { i as __toESM } from "./rolldown-runtime-B-lAHAz2.js";
|
|
2
2
|
import { r as readPreviewDocument, t as PreviewError } from "./source-Rx3etU3y.js";
|
|
3
|
-
import { a as usePreviewHost, d as EmptyState, m as LoaderCircle, r as FilePreviewLayout, s as FilePreviewToolbar, t as useTranslation } from "./useTranslation-
|
|
4
|
-
import { n as ChevronRight, r as ChevronLeft, t as RotateCcw } from "./rotate-ccw-
|
|
5
|
-
import { t as CircleAlert } from "./circle-alert-
|
|
6
|
-
import { n as ZoomIn, t as ZoomOut } from "./zoom-out-
|
|
7
|
-
import { t as FilePreviewToolbarButton } from "./FilePreviewToolbarButton-
|
|
8
|
-
import { t as FilePreviewTooLarge } from "./FilePreviewTooLarge-
|
|
3
|
+
import { a as usePreviewHost, d as EmptyState, m as LoaderCircle, r as FilePreviewLayout, s as FilePreviewToolbar, t as useTranslation } from "./useTranslation-ezxuF2DX.js";
|
|
4
|
+
import { n as ChevronRight, r as ChevronLeft, t as RotateCcw } from "./rotate-ccw-q9GRRcYM.js";
|
|
5
|
+
import { t as CircleAlert } from "./circle-alert-DOgmM2Zn.js";
|
|
6
|
+
import { n as ZoomIn, t as ZoomOut } from "./zoom-out-DYpR5v9K.js";
|
|
7
|
+
import { t as FilePreviewToolbarButton } from "./FilePreviewToolbarButton-BUzQxFLX.js";
|
|
8
|
+
import { t as FilePreviewTooLarge } from "./FilePreviewTooLarge-CZHFMl0w.js";
|
|
9
9
|
import { t as createPreviewSelection } from "./selection-B0INvh6t.js";
|
|
10
10
|
import { t as attachTouchPinch } from "./touchPinch-C4fl-9fg.js";
|
|
11
11
|
import { t as require_jszip_min } from "./jszip.min-uwqlc4KL.js";
|
|
@@ -3877,7 +3877,7 @@ function WordFilePreview({ sourceId, fileName, document: previewDocument, onSele
|
|
|
3877
3877
|
if (!fitWidth || !container || !body || pageCount <= 0) return;
|
|
3878
3878
|
const fit = () => {
|
|
3879
3879
|
const width = body.offsetWidth;
|
|
3880
|
-
if (container.clientWidth > 0 && width > 0) setFitZoom(Math.min(
|
|
3880
|
+
if (container.clientWidth > 0 && width > 0) setFitZoom(Math.min(DOCX_PREVIEW_MAX_ZOOM, container.clientWidth / width));
|
|
3881
3881
|
};
|
|
3882
3882
|
fit();
|
|
3883
3883
|
const observer = new ResizeObserver(fit);
|
|
@@ -3957,7 +3957,12 @@ function WordFilePreview({ sourceId, fileName, document: previewDocument, onSele
|
|
|
3957
3957
|
normalizeSymbolBullets
|
|
3958
3958
|
});
|
|
3959
3959
|
if (!isCurrent()) return;
|
|
3960
|
-
stagingBody.querySelector(`.${docxClassName}-wrapper`)
|
|
3960
|
+
const wrapper = stagingBody.querySelector(`.${docxClassName}-wrapper`);
|
|
3961
|
+
if (wrapper) {
|
|
3962
|
+
wrapper.classList.add("docx-preview-wrapper");
|
|
3963
|
+
wrapper.style.background = "transparent";
|
|
3964
|
+
wrapper.style.padding = "0";
|
|
3965
|
+
}
|
|
3961
3966
|
const pages = getRenderedPages(stagingBody);
|
|
3962
3967
|
pages.forEach((page, index) => {
|
|
3963
3968
|
page.id = `docx-preview-page-${index + 1}`;
|
|
@@ -23,7 +23,7 @@ var imageFilePreviewPlugin = {
|
|
|
23
23
|
"image/vnd.microsoft.icon",
|
|
24
24
|
"image/svg+xml"
|
|
25
25
|
],
|
|
26
|
-
load: () => import("./ImageFilePreview-
|
|
26
|
+
load: () => import("./ImageFilePreview-JR2KQf2x.js")
|
|
27
27
|
};
|
|
28
28
|
//#endregion
|
|
29
29
|
export { imageFilePreviewPlugin as t };
|
package/dist/react.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { n as assertPreviewRange, t as PreviewError } from "./source-Rx3etU3y.js";
|
|
2
|
-
import { a as usePreviewHost, c as FilePreviewToolbarPortalHost, d as EmptyState, g as createLucideIcon, h as FileWarning, i as PreviewHostContext, l as FilePreviewToolbarPortalProvider, m as LoaderCircle, n as I18nContext, p as cn, r as FilePreviewLayout, s as FilePreviewToolbar, t as useTranslation } from "./useTranslation-
|
|
3
|
-
import { n as DialogPortalContainerProvider, r as PortalContainerProvider, t as FilePreviewToolbarButton } from "./FilePreviewToolbarButton-
|
|
4
|
-
import { t as imageFilePreviewPlugin } from "./imageFilePreviewPlugin-
|
|
2
|
+
import { a as usePreviewHost, c as FilePreviewToolbarPortalHost, d as EmptyState, g as createLucideIcon, h as FileWarning, i as PreviewHostContext, l as FilePreviewToolbarPortalProvider, m as LoaderCircle, n as I18nContext, p as cn, r as FilePreviewLayout, s as FilePreviewToolbar, t as useTranslation } from "./useTranslation-ezxuF2DX.js";
|
|
3
|
+
import { n as DialogPortalContainerProvider, r as PortalContainerProvider, t as FilePreviewToolbarButton } from "./FilePreviewToolbarButton-BUzQxFLX.js";
|
|
4
|
+
import { t as imageFilePreviewPlugin } from "./imageFilePreviewPlugin-C02W1uyU.js";
|
|
5
5
|
import { Component, Suspense, createContext, createElement, lazy, useCallback, useEffect, useLayoutEffect, useMemo, useRef, useState } from "react";
|
|
6
6
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
7
7
|
/**
|
|
@@ -32,14 +32,14 @@ var plugins = [
|
|
|
32
32
|
id: "pdf",
|
|
33
33
|
extensions: ["pdf"],
|
|
34
34
|
mediaTypes: ["application/pdf"],
|
|
35
|
-
load: () => import("./PdfFilePreview-
|
|
35
|
+
load: () => import("./PdfFilePreview-B34-QmrL.js"),
|
|
36
36
|
supportsSelectionReference: true
|
|
37
37
|
},
|
|
38
38
|
{
|
|
39
39
|
id: "powerpoint",
|
|
40
40
|
extensions: ["pptx"],
|
|
41
41
|
mediaTypes: ["application/vnd.openxmlformats-officedocument.presentationml.presentation"],
|
|
42
|
-
load: () => import("./PowerPointFilePreview-
|
|
42
|
+
load: () => import("./PowerPointFilePreview-NukTW9aw.js"),
|
|
43
43
|
supportsSelectionReference: true
|
|
44
44
|
},
|
|
45
45
|
{
|
|
@@ -50,20 +50,20 @@ var plugins = [
|
|
|
50
50
|
"text/rtf",
|
|
51
51
|
"application/x-rtf"
|
|
52
52
|
],
|
|
53
|
-
load: () => import("./RtfFilePreview-
|
|
53
|
+
load: () => import("./RtfFilePreview-Bdy8iPf9.js")
|
|
54
54
|
},
|
|
55
55
|
{
|
|
56
56
|
id: "spreadsheet",
|
|
57
57
|
extensions: ["xlsx"],
|
|
58
58
|
mediaTypes: ["application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"],
|
|
59
|
-
load: () => import("./SpreadsheetFilePreview-
|
|
59
|
+
load: () => import("./SpreadsheetFilePreview-jB17TCNJ.js"),
|
|
60
60
|
supportsSelectionReference: true
|
|
61
61
|
},
|
|
62
62
|
{
|
|
63
63
|
id: "word",
|
|
64
64
|
extensions: ["docx"],
|
|
65
65
|
mediaTypes: ["application/vnd.openxmlformats-officedocument.wordprocessingml.document"],
|
|
66
|
-
load: () => import("./WordFilePreview-
|
|
66
|
+
load: () => import("./WordFilePreview-YznLhQcq.js"),
|
|
67
67
|
supportsSelectionReference: true
|
|
68
68
|
}
|
|
69
69
|
];
|