ranui 0.1.10-alpha-24 → 0.1.10-alpha-25
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.
|
@@ -4,7 +4,7 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
4
4
|
import { n as noop, c as create, C as Client, M as MessageCodec } from "./plus-DgJxWGlo.js";
|
|
5
5
|
import { m as message } from "./index-BbW0dxzy.js";
|
|
6
6
|
import "./index-n4X6wdwJ.js";
|
|
7
|
-
const less = ".remove-wap-active-focus{outline:0;-webkit-tap-highlight-color:transparent}.remove-wap-active-focus:active,.remove-wap-active-focus:focus{outline:0;-webkit-tap-highlight-color:transparent}.r-preview-slot{display:block}:host{cursor:pointer}.r-preview-mask{position:fixed;top:0;left:0;width:100vw;height:100vh;background-color:#00000073;z-index:1081}.r-preview-mask .r-preview-loading{position:absolute;top:30vh;left:50vw;transform:translate(-50%);display:flex;flex-flow:column;align-items:center}.r-preview-mask .r-preview-loading-text{color:#fff;font-size:16px}.r-preview-mask .r-preview-options{width:100%;pointer-events:auto;display:flex;flex-flow:row-reverse nowrap;align-items:center;justify-content:space-between}.r-preview-mask .r-preview-options-close{margin:14px;border:none;cursor:pointer;transition:all .3s;-webkit-user-select:none;user-select:none}.r-preview-mask .r-preview-contain{max-width:calc(100vw - 20px);margin:0 auto;display:flex;flex-flow:column nowrap;align-items:center;justify-content:center}.r-preview-mask .r-preview-contain .r-preview-context
|
|
7
|
+
const less = ".remove-wap-active-focus{outline:0;-webkit-tap-highlight-color:transparent}.remove-wap-active-focus:active,.remove-wap-active-focus:focus{outline:0;-webkit-tap-highlight-color:transparent}.r-preview-slot{display:block}:host{cursor:pointer}.r-preview-mask{position:fixed;top:0;left:0;width:100vw;height:100vh;background-color:#00000073;z-index:1081}.r-preview-mask .r-preview-loading{position:absolute;top:30vh;left:50vw;transform:translate(-50%);display:flex;flex-flow:column;align-items:center}.r-preview-mask .r-preview-loading-text{color:#fff;font-size:16px}.r-preview-mask .r-preview-options{width:100%;pointer-events:auto;display:flex;flex-flow:row-reverse nowrap;align-items:center;justify-content:space-between}.r-preview-mask .r-preview-options-close{margin:14px;border:none;cursor:pointer;transition:all .3s;-webkit-user-select:none;user-select:none}.r-preview-mask .r-preview-contain{max-width:calc(100vw - 20px);margin:0 auto;display:flex;flex-flow:column nowrap;align-items:center;justify-content:center}.r-preview-mask .r-preview-contain .r-preview-context{margin:0 auto;height:calc(100vh - 68px);display:flex;flex-flow:column nowrap;justify-content:flex-start;align-items:center;overflow:auto}.r-preview-mask .r-preview-contain .r-preview-context-pdf{width:100%;margin:34px auto;height:100vh;display:flex;flex-flow:column nowrap;justify-content:flex-start;align-items:center;overflow:auto}";
|
|
8
8
|
const PPTX = "application/vnd.openxmlformats-officedocument.presentationml.presentation";
|
|
9
9
|
const PDF = "application/pdf";
|
|
10
10
|
const DOCX = "application/vnd.openxmlformats-officedocument.wordprocessingml.document";
|
|
@@ -14,7 +14,8 @@ const TARGET_ORIGIN = "https://ranuts.github.io/document";
|
|
|
14
14
|
const renderOffice = async (file, options) => {
|
|
15
15
|
var _a;
|
|
16
16
|
try {
|
|
17
|
-
const { iframe, onLoad } = options;
|
|
17
|
+
const { iframe, onLoad, dom } = options;
|
|
18
|
+
dom == null ? void 0 : dom.style.setProperty("display", "none");
|
|
18
19
|
if (!iframe) return;
|
|
19
20
|
Client.removeAll();
|
|
20
21
|
const { id } = Client.connect({
|
|
@@ -44,7 +45,7 @@ const renderOffice = async (file, options) => {
|
|
|
44
45
|
async function Custom() {
|
|
45
46
|
if (typeof document !== "undefined" && !customElements.get("r-preview")) {
|
|
46
47
|
const { warning = noop } = message;
|
|
47
|
-
const { renderPdf } = await import("./pdf-
|
|
48
|
+
const { renderPdf } = await import("./pdf-BKWcQYL4.js");
|
|
48
49
|
const requestUrlToBuffer = (src, options) => {
|
|
49
50
|
if (typeof XMLHttpRequest === "undefined") {
|
|
50
51
|
throw new Error("XMLHttpRequest is not defined");
|
|
@@ -159,13 +160,6 @@ async function Custom() {
|
|
|
159
160
|
const handler = renderFileMap.get(type);
|
|
160
161
|
if (handler && this.previewContext) {
|
|
161
162
|
this.previewContext.style.setProperty("width", "100%");
|
|
162
|
-
if (this.previewContextPdf) {
|
|
163
|
-
this.previewContextPdf.style.setProperty("width", "100%");
|
|
164
|
-
} else {
|
|
165
|
-
this.previewContextPdf = document.createElement("div");
|
|
166
|
-
this.previewContextPdf.setAttribute("class", "r-preview-context-pdf");
|
|
167
|
-
this.previewContext.appendChild(this.previewContextPdf);
|
|
168
|
-
}
|
|
169
163
|
const options = {
|
|
170
164
|
dom: this.previewContextPdf,
|
|
171
165
|
onError: this.onError,
|
|
@@ -194,12 +188,18 @@ async function Custom() {
|
|
|
194
188
|
}
|
|
195
189
|
});
|
|
196
190
|
__publicField(this, "showPreview", () => {
|
|
197
|
-
var _a;
|
|
191
|
+
var _a, _b, _c;
|
|
198
192
|
if (this.src) {
|
|
199
193
|
if (this.preview) {
|
|
200
194
|
this.preview.style.display = "block";
|
|
201
195
|
this.preview.appendChild(this._loadingElement);
|
|
202
|
-
(_a = this.
|
|
196
|
+
if (this.previewContextPdf && ((_a = this.previewContext) == null ? void 0 : _a.contains(this.previewContextPdf))) {
|
|
197
|
+
this.previewContext.removeChild(this.previewContextPdf);
|
|
198
|
+
}
|
|
199
|
+
this.previewContextPdf = document.createElement("div");
|
|
200
|
+
this.previewContextPdf.setAttribute("class", "r-preview-context-pdf");
|
|
201
|
+
(_b = this.previewContext) == null ? void 0 : _b.appendChild(this.previewContextPdf);
|
|
202
|
+
(_c = this._loadingElement) == null ? void 0 : _c.style.setProperty("display", "block");
|
|
203
203
|
} else {
|
|
204
204
|
this.preliminary();
|
|
205
205
|
}
|
package/dist/index.js
CHANGED
|
@@ -3,7 +3,7 @@ import { i as i2 } from "./index-n4X6wdwJ.js";
|
|
|
3
3
|
import { i as i3 } from "./index-BEm1a2pr.js";
|
|
4
4
|
import { i as i4 } from "./index-DvSe_Ms7.js";
|
|
5
5
|
import { i as i5 } from "./index-BbW0dxzy.js";
|
|
6
|
-
import { i as i6 } from "./index-
|
|
6
|
+
import { i as i6 } from "./index-DHI8URkB.js";
|
|
7
7
|
import { i as i7 } from "./index-Bb55l8nf.js";
|
|
8
8
|
import { i as i8 } from "./index-DAxs7Dd2.js";
|
|
9
9
|
import { i as i9 } from "./index-s0ioL3L2.js";
|
|
@@ -120,6 +120,8 @@ const renderPdf = async (file, options) => {
|
|
|
120
120
|
loadScript({ type: "content", content: PDF_JS });
|
|
121
121
|
const pdf = await createReader(file);
|
|
122
122
|
if (pdf) {
|
|
123
|
+
const { dom } = options;
|
|
124
|
+
dom == null ? void 0 : dom.style.setProperty("display", "flex");
|
|
123
125
|
const PDF = new PdfPreview(pdf, options);
|
|
124
126
|
await PDF.pdfPreview();
|
|
125
127
|
await PDF.showTotalPage();
|
package/dist/preview.js
CHANGED