@cherrystudio/file-preview 0.1.3 → 0.2.0
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 +23 -5
- package/dist/{Combination-BLg27FvF.js → Combination-i8Z9CJHc.js} +2 -1
- package/dist/{FilePreviewTooLarge-DkHa6toZ.js → FilePreviewTooLarge-DC7vPyMI.js} +1 -1
- package/dist/{useTranslation-DMhY277o.js → FilePreviewToolbarButton-ptqwCTnz.js} +11 -3634
- package/dist/{ImageFilePreview-Be0jdBJ-.js → ImageFilePreview-Cbw6HzIR.js} +6 -5
- package/dist/{PdfFilePreview-D3Ie0_mm.js → PdfFilePreview-DqnRzmwY.js} +7 -5
- package/dist/{PowerPointFilePreview-CyQHTp4B.js → PowerPointFilePreview-CO_N6c1I.js} +7 -5
- package/dist/RtfFilePreview-Bgl6lmWy.js +21434 -0
- package/dist/{SpreadsheetFilePreview-DJdoyeis.js → SpreadsheetFilePreview-GKeQwJL3.js} +6 -4
- package/dist/{WordFilePreview-Tvm-vK91.js → WordFilePreview-IfWcWbwn.js} +7 -5
- package/dist/circle-alert-sByhBDN4.js +31 -0
- package/dist/{imageFilePreviewPlugin-CYLM2bwR.js → imageFilePreviewPlugin-Cif3MLQd.js} +1 -1
- package/dist/react.js +17 -6
- package/dist/{rotate-ccw-YWx7RzY9.js → rotate-ccw-Bx-jjhVm.js} +1 -1
- package/dist/{selection-CQPD5a6C.js → selection-B0INvh6t.js} +1 -31
- package/dist/styles.css +44 -1
- package/dist/useTranslation-BJY4EKsz.js +3631 -0
- package/dist/{zoom-out-DLOQGt1e.js → zoom-out-B2XJ64Kx.js} +1 -1
- package/package.json +2 -1
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import "./documentAnchor-J7GGLU15.js";
|
|
2
2
|
import { r as readPreviewDocument, t as PreviewError } from "./source-Rx3etU3y.js";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import { n as ZoomIn, t as ZoomOut } from "./zoom-out-
|
|
6
|
-
import { t as
|
|
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-BJY4EKsz.js";
|
|
4
|
+
import { t as CircleAlert } from "./circle-alert-sByhBDN4.js";
|
|
5
|
+
import { n as ZoomIn, t as ZoomOut } from "./zoom-out-B2XJ64Kx.js";
|
|
6
|
+
import { t as FilePreviewToolbarButton } from "./FilePreviewToolbarButton-ptqwCTnz.js";
|
|
7
|
+
import { t as FilePreviewTooLarge } from "./FilePreviewTooLarge-DC7vPyMI.js";
|
|
8
|
+
import { n as normalizeSelectionText, t as createPreviewSelection } from "./selection-B0INvh6t.js";
|
|
7
9
|
import * as React$1 from "react";
|
|
8
10
|
import React, { memo, useCallback, useEffect, useMemo, useRef, useState } from "react";
|
|
9
11
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
@@ -1,10 +1,12 @@
|
|
|
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 {
|
|
4
|
-
import { n as ChevronRight, r as ChevronLeft, t as RotateCcw } from "./rotate-ccw-
|
|
5
|
-
import {
|
|
6
|
-
import { n as ZoomIn, t as ZoomOut } from "./zoom-out-
|
|
7
|
-
import { t as
|
|
3
|
+
import { a as usePreviewHost, d as EmptyState, m as LoaderCircle, r as FilePreviewLayout, s as FilePreviewToolbar, t as useTranslation } from "./useTranslation-BJY4EKsz.js";
|
|
4
|
+
import { n as ChevronRight, r as ChevronLeft, t as RotateCcw } from "./rotate-ccw-Bx-jjhVm.js";
|
|
5
|
+
import { t as CircleAlert } from "./circle-alert-sByhBDN4.js";
|
|
6
|
+
import { n as ZoomIn, t as ZoomOut } from "./zoom-out-B2XJ64Kx.js";
|
|
7
|
+
import { t as FilePreviewToolbarButton } from "./FilePreviewToolbarButton-ptqwCTnz.js";
|
|
8
|
+
import { t as FilePreviewTooLarge } from "./FilePreviewTooLarge-DC7vPyMI.js";
|
|
9
|
+
import { t as createPreviewSelection } from "./selection-B0INvh6t.js";
|
|
8
10
|
import { t as attachTouchPinch } from "./touchPinch-C4fl-9fg.js";
|
|
9
11
|
import { t as require_jszip_min } from "./jszip.min-uwqlc4KL.js";
|
|
10
12
|
import { useCallback, useEffect, useId, useLayoutEffect, useRef, useState } from "react";
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { g as createLucideIcon } from "./useTranslation-BJY4EKsz.js";
|
|
2
|
+
/**
|
|
3
|
+
* @license lucide-react v0.545.0 - ISC
|
|
4
|
+
*
|
|
5
|
+
* This source code is licensed under the ISC license.
|
|
6
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
7
|
+
*/
|
|
8
|
+
var CircleAlert = createLucideIcon("circle-alert", [
|
|
9
|
+
["circle", {
|
|
10
|
+
cx: "12",
|
|
11
|
+
cy: "12",
|
|
12
|
+
r: "10",
|
|
13
|
+
key: "1mglay"
|
|
14
|
+
}],
|
|
15
|
+
["line", {
|
|
16
|
+
x1: "12",
|
|
17
|
+
x2: "12",
|
|
18
|
+
y1: "8",
|
|
19
|
+
y2: "12",
|
|
20
|
+
key: "1pkeuh"
|
|
21
|
+
}],
|
|
22
|
+
["line", {
|
|
23
|
+
x1: "12",
|
|
24
|
+
x2: "12.01",
|
|
25
|
+
y1: "16",
|
|
26
|
+
y2: "16",
|
|
27
|
+
key: "4dfq90"
|
|
28
|
+
}]
|
|
29
|
+
]);
|
|
30
|
+
//#endregion
|
|
31
|
+
export { CircleAlert as t };
|
|
@@ -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-Cbw6HzIR.js")
|
|
27
27
|
};
|
|
28
28
|
//#endregion
|
|
29
29
|
export { imageFilePreviewPlugin as t };
|
package/dist/react.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { n as assertPreviewRange, t as PreviewError } from "./source-Rx3etU3y.js";
|
|
2
|
-
import {
|
|
3
|
-
import { t as
|
|
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-BJY4EKsz.js";
|
|
3
|
+
import { n as DialogPortalContainerProvider, r as PortalContainerProvider, t as FilePreviewToolbarButton } from "./FilePreviewToolbarButton-ptqwCTnz.js";
|
|
4
|
+
import { t as imageFilePreviewPlugin } from "./imageFilePreviewPlugin-Cif3MLQd.js";
|
|
4
5
|
import { Component, Suspense, createContext, createElement, lazy, useCallback, useEffect, useMemo, useRef, useState } from "react";
|
|
5
6
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
6
7
|
/**
|
|
@@ -31,28 +32,38 @@ var plugins = [
|
|
|
31
32
|
id: "pdf",
|
|
32
33
|
extensions: ["pdf"],
|
|
33
34
|
mediaTypes: ["application/pdf"],
|
|
34
|
-
load: () => import("./PdfFilePreview-
|
|
35
|
+
load: () => import("./PdfFilePreview-DqnRzmwY.js"),
|
|
35
36
|
supportsSelectionReference: true
|
|
36
37
|
},
|
|
37
38
|
{
|
|
38
39
|
id: "powerpoint",
|
|
39
40
|
extensions: ["pptx"],
|
|
40
41
|
mediaTypes: ["application/vnd.openxmlformats-officedocument.presentationml.presentation"],
|
|
41
|
-
load: () => import("./PowerPointFilePreview-
|
|
42
|
+
load: () => import("./PowerPointFilePreview-CO_N6c1I.js"),
|
|
42
43
|
supportsSelectionReference: true
|
|
43
44
|
},
|
|
45
|
+
{
|
|
46
|
+
id: "rtf",
|
|
47
|
+
extensions: ["rtf"],
|
|
48
|
+
mediaTypes: [
|
|
49
|
+
"application/rtf",
|
|
50
|
+
"text/rtf",
|
|
51
|
+
"application/x-rtf"
|
|
52
|
+
],
|
|
53
|
+
load: () => import("./RtfFilePreview-Bgl6lmWy.js")
|
|
54
|
+
},
|
|
44
55
|
{
|
|
45
56
|
id: "spreadsheet",
|
|
46
57
|
extensions: ["xlsx"],
|
|
47
58
|
mediaTypes: ["application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"],
|
|
48
|
-
load: () => import("./SpreadsheetFilePreview-
|
|
59
|
+
load: () => import("./SpreadsheetFilePreview-GKeQwJL3.js"),
|
|
49
60
|
supportsSelectionReference: true
|
|
50
61
|
},
|
|
51
62
|
{
|
|
52
63
|
id: "word",
|
|
53
64
|
extensions: ["docx"],
|
|
54
65
|
mediaTypes: ["application/vnd.openxmlformats-officedocument.wordprocessingml.document"],
|
|
55
|
-
load: () => import("./WordFilePreview-
|
|
66
|
+
load: () => import("./WordFilePreview-IfWcWbwn.js"),
|
|
56
67
|
supportsSelectionReference: true
|
|
57
68
|
}
|
|
58
69
|
];
|
|
@@ -1,34 +1,4 @@
|
|
|
1
1
|
import { n as SELECTION_EXCERPT_MAX_LENGTH } from "./documentAnchor-J7GGLU15.js";
|
|
2
|
-
import { R as createLucideIcon } from "./useTranslation-DMhY277o.js";
|
|
3
|
-
/**
|
|
4
|
-
* @license lucide-react v0.545.0 - ISC
|
|
5
|
-
*
|
|
6
|
-
* This source code is licensed under the ISC license.
|
|
7
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
8
|
-
*/
|
|
9
|
-
var CircleAlert = createLucideIcon("circle-alert", [
|
|
10
|
-
["circle", {
|
|
11
|
-
cx: "12",
|
|
12
|
-
cy: "12",
|
|
13
|
-
r: "10",
|
|
14
|
-
key: "1mglay"
|
|
15
|
-
}],
|
|
16
|
-
["line", {
|
|
17
|
-
x1: "12",
|
|
18
|
-
x2: "12",
|
|
19
|
-
y1: "8",
|
|
20
|
-
y2: "12",
|
|
21
|
-
key: "1pkeuh"
|
|
22
|
-
}],
|
|
23
|
-
["line", {
|
|
24
|
-
x1: "12",
|
|
25
|
-
x2: "12.01",
|
|
26
|
-
y1: "16",
|
|
27
|
-
y2: "16",
|
|
28
|
-
key: "4dfq90"
|
|
29
|
-
}]
|
|
30
|
-
]);
|
|
31
|
-
//#endregion
|
|
32
2
|
//#region src/selection.ts
|
|
33
3
|
var SELECTION_WHITESPACE = /[\t\n\v\f\r \u0085\u00a0\u1680\u2000-\u200a\u2028\u2029\u202f\u205f\u3000\ufeff\u001c-\u001f]+/g;
|
|
34
4
|
function normalizeSelectionText(text) {
|
|
@@ -44,4 +14,4 @@ function createPreviewSelection(input) {
|
|
|
44
14
|
} : null;
|
|
45
15
|
}
|
|
46
16
|
//#endregion
|
|
47
|
-
export { normalizeSelectionText as n,
|
|
17
|
+
export { normalizeSelectionText as n, createPreviewSelection as t };
|
package/dist/styles.css
CHANGED
|
@@ -70,6 +70,7 @@
|
|
|
70
70
|
--container-md: 28rem;
|
|
71
71
|
--container-lg: 32rem;
|
|
72
72
|
--container-xl: 36rem;
|
|
73
|
+
--container-4xl: 56rem;
|
|
73
74
|
--text-xs: .75rem;
|
|
74
75
|
--text-xs--line-height: calc(1 / .75);
|
|
75
76
|
--text-sm: .875rem;
|
|
@@ -532,6 +533,10 @@
|
|
|
532
533
|
min-height: calc(var(--spacing) * 11);
|
|
533
534
|
}
|
|
534
535
|
|
|
536
|
+
:where(.file-preview-root):is(.min-h-48), :where(.file-preview-root) .min-h-48 {
|
|
537
|
+
min-height: calc(var(--spacing) * 48);
|
|
538
|
+
}
|
|
539
|
+
|
|
535
540
|
:where(.file-preview-root):is(.min-h-full), :where(.file-preview-root) .min-h-full {
|
|
536
541
|
min-height: 100%;
|
|
537
542
|
}
|
|
@@ -560,6 +565,10 @@
|
|
|
560
565
|
width: 100vw;
|
|
561
566
|
}
|
|
562
567
|
|
|
568
|
+
:where(.file-preview-root):is(.max-w-4xl), :where(.file-preview-root) .max-w-4xl {
|
|
569
|
+
max-width: var(--container-4xl);
|
|
570
|
+
}
|
|
571
|
+
|
|
563
572
|
:where(.file-preview-root):is(.max-w-80), :where(.file-preview-root) .max-w-80 {
|
|
564
573
|
max-width: calc(var(--spacing) * 80);
|
|
565
574
|
}
|
|
@@ -1002,6 +1011,10 @@
|
|
|
1002
1011
|
background-color: #0000;
|
|
1003
1012
|
}
|
|
1004
1013
|
|
|
1014
|
+
:where(.file-preview-root):is(.bg-white), :where(.file-preview-root) .bg-white {
|
|
1015
|
+
background-color: var(--cs-white);
|
|
1016
|
+
}
|
|
1017
|
+
|
|
1005
1018
|
:where(.file-preview-root):is(.fill-current), :where(.file-preview-root) .fill-current {
|
|
1006
1019
|
fill: currentColor;
|
|
1007
1020
|
}
|
|
@@ -1180,6 +1193,10 @@
|
|
|
1180
1193
|
overflow-wrap: break-word;
|
|
1181
1194
|
}
|
|
1182
1195
|
|
|
1196
|
+
:where(.file-preview-root):is(.wrap-anywhere), :where(.file-preview-root) .wrap-anywhere {
|
|
1197
|
+
overflow-wrap: anywhere;
|
|
1198
|
+
}
|
|
1199
|
+
|
|
1183
1200
|
:where(.file-preview-root):is(.whitespace-normal), :where(.file-preview-root) .whitespace-normal {
|
|
1184
1201
|
white-space: normal;
|
|
1185
1202
|
}
|
|
@@ -1188,6 +1205,10 @@
|
|
|
1188
1205
|
white-space: nowrap;
|
|
1189
1206
|
}
|
|
1190
1207
|
|
|
1208
|
+
:where(.file-preview-root):is(.text-black), :where(.file-preview-root) .text-black {
|
|
1209
|
+
color: var(--cs-black);
|
|
1210
|
+
}
|
|
1211
|
+
|
|
1191
1212
|
:where(.file-preview-root):is(.text-card-foreground), :where(.file-preview-root) .text-card-foreground {
|
|
1192
1213
|
color: var(--card-foreground);
|
|
1193
1214
|
}
|
|
@@ -1656,12 +1677,17 @@
|
|
|
1656
1677
|
opacity: 1;
|
|
1657
1678
|
}
|
|
1658
1679
|
|
|
1680
|
+
:where(.file-preview-root):is(.focus-visible\:ring-1:focus-visible), :where(.file-preview-root) .focus-visible\:ring-1:focus-visible {
|
|
1681
|
+
--fp-tw-ring-shadow: var(--fp-tw-ring-inset, ) 0 0 0 calc(1px + var(--fp-tw-ring-offset-width)) var(--fp-tw-ring-color, currentcolor);
|
|
1682
|
+
box-shadow: var(--fp-tw-inset-shadow), var(--fp-tw-inset-ring-shadow), var(--fp-tw-ring-offset-shadow), var(--fp-tw-ring-shadow), var(--fp-tw-shadow);
|
|
1683
|
+
}
|
|
1684
|
+
|
|
1659
1685
|
:where(.file-preview-root):is(.focus-visible\:ring-2:focus-visible), :where(.file-preview-root) .focus-visible\:ring-2:focus-visible {
|
|
1660
1686
|
--fp-tw-ring-shadow: var(--fp-tw-ring-inset, ) 0 0 0 calc(2px + var(--fp-tw-ring-offset-width)) var(--fp-tw-ring-color, currentcolor);
|
|
1661
1687
|
box-shadow: var(--fp-tw-inset-shadow), var(--fp-tw-inset-ring-shadow), var(--fp-tw-ring-offset-shadow), var(--fp-tw-ring-shadow), var(--fp-tw-shadow);
|
|
1662
1688
|
}
|
|
1663
1689
|
|
|
1664
|
-
:where(.file-preview-root):is(.focus-visible\:ring-ring\/50:focus-visible), :where(.file-preview-root) .focus-visible\:ring-ring\/50:focus-visible {
|
|
1690
|
+
:where(.file-preview-root):is(.focus-visible\:ring-ring:focus-visible), :where(.file-preview-root) .focus-visible\:ring-ring:focus-visible, :where(.file-preview-root):is(.focus-visible\:ring-ring\/50:focus-visible), :where(.file-preview-root) .focus-visible\:ring-ring\/50:focus-visible {
|
|
1665
1691
|
--fp-tw-ring-color: var(--ring);
|
|
1666
1692
|
}
|
|
1667
1693
|
|
|
@@ -1671,6 +1697,11 @@
|
|
|
1671
1697
|
}
|
|
1672
1698
|
}
|
|
1673
1699
|
|
|
1700
|
+
:where(.file-preview-root):is(.focus-visible\:outline-none:focus-visible), :where(.file-preview-root) .focus-visible\:outline-none:focus-visible {
|
|
1701
|
+
--fp-tw-outline-style: none;
|
|
1702
|
+
outline-style: none;
|
|
1703
|
+
}
|
|
1704
|
+
|
|
1674
1705
|
:where(.file-preview-root):is(.focus-visible\:ring-inset:focus-visible), :where(.file-preview-root) .focus-visible\:ring-inset:focus-visible {
|
|
1675
1706
|
--fp-tw-ring-inset: inset;
|
|
1676
1707
|
}
|
|
@@ -2087,6 +2118,14 @@
|
|
|
2087
2118
|
outline-color: var(--primary);
|
|
2088
2119
|
}
|
|
2089
2120
|
|
|
2121
|
+
.\[\&_a\]\:underline a {
|
|
2122
|
+
text-decoration-line: underline;
|
|
2123
|
+
}
|
|
2124
|
+
|
|
2125
|
+
.\[\&_img\]\:max-w-full img {
|
|
2126
|
+
max-width: 100%;
|
|
2127
|
+
}
|
|
2128
|
+
|
|
2090
2129
|
.\[\&_p\[data-docx-picked\=true\]\]\:bg-primary\/15 p[data-docx-picked="true"] {
|
|
2091
2130
|
background-color: var(--primary);
|
|
2092
2131
|
}
|
|
@@ -2134,6 +2173,10 @@
|
|
|
2134
2173
|
height: 18px !important;
|
|
2135
2174
|
}
|
|
2136
2175
|
|
|
2176
|
+
.\[\&_svg\]\:max-w-full svg {
|
|
2177
|
+
max-width: 100%;
|
|
2178
|
+
}
|
|
2179
|
+
|
|
2137
2180
|
.\[\&_svg\]\:shrink-0 svg {
|
|
2138
2181
|
flex-shrink: 0;
|
|
2139
2182
|
}
|