@sqsoffice/slide 0.0.0-stage → 0.1.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/LICENSE +202 -0
- package/README.md +81 -2
- package/dist/THIRD-PARTY-NOTICES.txt +19871 -0
- package/dist/api-CLyi4j4N.js +4030 -0
- package/dist/api.js +1 -0
- package/dist/assets/engine/files-worker.js +1 -0
- package/dist/assets/engine/host-artifact-jgAXg8CH.js +1 -0
- package/dist/assets/engine/host-load-wasm-DyYR5qIL.js +1 -0
- package/dist/assets/engine/host-manifest.json +42 -0
- package/dist/assets/engine/host-pdf-import-BOPMPpUS.js +1 -0
- package/dist/assets/engine/host.js +1 -0
- package/dist/assets/engine/manifest.json +66 -0
- package/dist/assets/engine/office_web.js +1491 -0
- package/dist/assets/engine/office_web_bg.wasm +4 -0
- package/dist/assets/engine/worker.js +1 -0
- package/dist/assets/fonts/source-han-sans/2.005/LICENSE.txt +96 -0
- package/dist/assets/fonts/source-han-sans/2.005/SourceHanSansCN-Bold.otf +0 -0
- package/dist/assets/fonts/source-han-sans/2.005/SourceHanSansCN-Regular.otf +0 -0
- package/dist/assets/fonts/source-han-sans/2.005/manifest.json +20 -0
- package/dist/index.js +835 -0
- package/dist/package-manifest.json +181 -0
- package/dist/style.css +2 -0
- package/dist/types/app/lib/automation/protocol.d.ts +25 -0
- package/dist/types/app/lib/engine/client.d.ts +129 -0
- package/dist/types/app/lib/engine/docx.d.ts +67 -0
- package/dist/types/app/lib/engine/grid.d.ts +330 -0
- package/dist/types/app/lib/engine/image.d.ts +15 -0
- package/dist/types/app/lib/engine/markdown.d.ts +220 -0
- package/dist/types/app/lib/engine/pdf-import.d.ts +18 -0
- package/dist/types/app/lib/engine/pdf-ocr.d.ts +70 -0
- package/dist/types/app/lib/engine/pdf-output.d.ts +22 -0
- package/dist/types/app/lib/engine/pdf.d.ts +191 -0
- package/dist/types/app/lib/engine/presentation-clipboard.d.ts +26 -0
- package/dist/types/app/lib/engine/presentation-media.d.ts +156 -0
- package/dist/types/app/lib/engine/presentation.d.ts +145 -0
- package/dist/types/app/lib/engine/printing.d.ts +91 -0
- package/dist/types/app/lib/engine/protocol.d.ts +233 -0
- package/dist/types/app/lib/engine/script.d.ts +46 -0
- package/dist/types/app/lib/engine/sheet-clipboard.d.ts +42 -0
- package/dist/types/app/lib/engine/sheet-validation.d.ts +19 -0
- package/dist/types/app/lib/engine/view.d.ts +186 -0
- package/dist/types/app/lib/files/session.d.ts +114 -0
- package/dist/types/app/lib/files/storage.d.ts +20 -0
- package/dist/types/packages/slide/api.d.ts +4 -0
- package/dist/types/packages/slide/index.d.ts +5 -0
- package/dist/types/sdk/types.d.ts +59 -0
- package/package.json +40 -3
package/dist/index.js
ADDED
|
@@ -0,0 +1,835 @@
|
|
|
1
|
+
import { A as e, B as t, C as n, D as r, E as i, F as a, H as o, I as s, L as c, M as l, N as u, O as d, P as f, R as p, S as ee, T as m, V as te, _ as ne, a as h, b as re, c as ie, d as g, f as ae, g as oe, h as _, i as se, j as v, k as y, l as b, m as x, n as S, o as C, p as w, r as T, s as E, t as D, u as O, v as ce, w as le, x as ue, y as k, z as A } from "./api-CLyi4j4N.js";
|
|
2
|
+
// node_modules/@vue/runtime-dom/dist/runtime-dom.esm-bundler.js
|
|
3
|
+
var j = void 0, de = typeof window < "u" && window.trustedTypes;
|
|
4
|
+
if (de) try {
|
|
5
|
+
j = /* @__PURE__ */ de.createPolicy("vue", { createHTML: (e) => e });
|
|
6
|
+
} catch {}
|
|
7
|
+
var M = j ? (e) => j.createHTML(e) : (e) => e, fe = "http://www.w3.org/2000/svg", pe = "http://www.w3.org/1998/Math/MathML", N = typeof document < "u" ? document : null, me = N && /* @__PURE__ */ N.createElement("template"), he = {
|
|
8
|
+
insert: (e, t, n) => {
|
|
9
|
+
t.insertBefore(e, n || null);
|
|
10
|
+
},
|
|
11
|
+
remove: (e) => {
|
|
12
|
+
let t = e.parentNode;
|
|
13
|
+
t && t.removeChild(e);
|
|
14
|
+
},
|
|
15
|
+
createElement: (e, t, n, r) => {
|
|
16
|
+
let i = t === "svg" ? N.createElementNS(fe, e) : t === "mathml" ? N.createElementNS(pe, e) : n ? N.createElement(e, { is: n }) : N.createElement(e);
|
|
17
|
+
return e === "select" && r && r.multiple != null && i.setAttribute("multiple", r.multiple), i;
|
|
18
|
+
},
|
|
19
|
+
createText: (e) => N.createTextNode(e),
|
|
20
|
+
createComment: (e) => N.createComment(e),
|
|
21
|
+
setText: (e, t) => {
|
|
22
|
+
e.nodeValue = t;
|
|
23
|
+
},
|
|
24
|
+
setElementText: (e, t) => {
|
|
25
|
+
e.textContent = t;
|
|
26
|
+
},
|
|
27
|
+
parentNode: (e) => e.parentNode,
|
|
28
|
+
nextSibling: (e) => e.nextSibling,
|
|
29
|
+
querySelector: (e) => N.querySelector(e),
|
|
30
|
+
setScopeId(e, t) {
|
|
31
|
+
e.setAttribute(t, "");
|
|
32
|
+
},
|
|
33
|
+
insertStaticContent(e, t, n, r, i, a) {
|
|
34
|
+
let o = n ? n.previousSibling : t.lastChild;
|
|
35
|
+
if (i && (i === a || i.nextSibling)) for (; t.insertBefore(i.cloneNode(!0), n), i !== a && (i = i.nextSibling););
|
|
36
|
+
else {
|
|
37
|
+
me.innerHTML = M(r === "svg" ? `<svg>${e}</svg>` : r === "mathml" ? `<math>${e}</math>` : e);
|
|
38
|
+
let i = me.content;
|
|
39
|
+
if (r === "svg" || r === "mathml") {
|
|
40
|
+
let e = i.firstChild;
|
|
41
|
+
for (; e.firstChild;) i.appendChild(e.firstChild);
|
|
42
|
+
i.removeChild(e);
|
|
43
|
+
}
|
|
44
|
+
t.insertBefore(i, n);
|
|
45
|
+
}
|
|
46
|
+
return [o ? o.nextSibling : t.firstChild, n ? n.previousSibling : t.lastChild];
|
|
47
|
+
}
|
|
48
|
+
}, P = /* @__PURE__ */ Symbol("_vtc");
|
|
49
|
+
function ge(e, t, n) {
|
|
50
|
+
let r = e[P];
|
|
51
|
+
r && (t = (t ? [t, ...r] : [...r]).join(" ")), t == null ? e.removeAttribute("class") : n ? e.setAttribute("class", t) : e.className = t;
|
|
52
|
+
}
|
|
53
|
+
var F = /* @__PURE__ */ Symbol("_vod"), _e = /* @__PURE__ */ Symbol("_vsh"), I = /* @__PURE__ */ Symbol(""), L = /(?:^|;)\s*display\s*:/;
|
|
54
|
+
function ve(e, t, n) {
|
|
55
|
+
let r = e.style, i = c(n), a = !1;
|
|
56
|
+
if (n && !i) {
|
|
57
|
+
if (t) {
|
|
58
|
+
if (c(t)) for (let e of t.split(";")) {
|
|
59
|
+
let t = e.slice(0, e.indexOf(":")).trim();
|
|
60
|
+
n[t] ?? z(r, t, "");
|
|
61
|
+
}
|
|
62
|
+
else for (let e in t) n[e] ?? z(r, e, "");
|
|
63
|
+
}
|
|
64
|
+
for (let i in n) {
|
|
65
|
+
i === "display" && (a = !0);
|
|
66
|
+
let o = n[i];
|
|
67
|
+
o == null ? z(r, i, "") : U(e, i, !c(t) && t ? t[i] : void 0, o) || z(r, i, o);
|
|
68
|
+
}
|
|
69
|
+
} else if (i) {
|
|
70
|
+
if (t !== n) {
|
|
71
|
+
let e = r[I];
|
|
72
|
+
e && (n += ";" + e), r.cssText = n, a = L.test(n);
|
|
73
|
+
}
|
|
74
|
+
} else t && e.removeAttribute("style");
|
|
75
|
+
F in e && (i && t === n || (e[F] = a ? r.display : ""), e[_e] && (r.display = "none"));
|
|
76
|
+
}
|
|
77
|
+
var R = /\s*!important$/;
|
|
78
|
+
function z(e, t, n) {
|
|
79
|
+
if (l(n)) n.forEach((n) => z(e, t, n));
|
|
80
|
+
else if (n ??= "", t.startsWith("--")) R.test(n) ? e.setProperty(t, n.replace(R, ""), "important") : e.setProperty(t, n);
|
|
81
|
+
else {
|
|
82
|
+
let r = H(e, t);
|
|
83
|
+
R.test(n) ? e.setProperty(y(r), n.replace(R, ""), "important") : e[r] = n;
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
var B = [
|
|
87
|
+
"Webkit",
|
|
88
|
+
"Moz",
|
|
89
|
+
"ms"
|
|
90
|
+
], V = {};
|
|
91
|
+
function H(e, t) {
|
|
92
|
+
let n = V[t];
|
|
93
|
+
if (n) return n;
|
|
94
|
+
let a = i(t);
|
|
95
|
+
if (a !== "filter" && a in e) return V[t] = a;
|
|
96
|
+
a = r(a);
|
|
97
|
+
for (let n = 0; n < B.length; n++) {
|
|
98
|
+
let r = B[n] + a;
|
|
99
|
+
if (r in e) return V[t] = r;
|
|
100
|
+
}
|
|
101
|
+
return t;
|
|
102
|
+
}
|
|
103
|
+
function U(e, t, n, r) {
|
|
104
|
+
return e.tagName === "TEXTAREA" && (t === "width" || t === "height") && c(r) && n === r;
|
|
105
|
+
}
|
|
106
|
+
var W = "http://www.w3.org/1999/xlink";
|
|
107
|
+
function G(t, n, r, i, a, o = s(n)) {
|
|
108
|
+
i && n.startsWith("xlink:") ? r == null ? t.removeAttributeNS(W, n.slice(6, n.length)) : t.setAttributeNS(W, n, r) : r == null || o && !e(r) ? t.removeAttribute(n) : t.setAttribute(n, o ? "" : p(r) ? String(r) : r);
|
|
109
|
+
}
|
|
110
|
+
function K(t, n, r, i, a) {
|
|
111
|
+
if (n === "innerHTML" || n === "textContent") {
|
|
112
|
+
r != null && (t[n] = n === "innerHTML" ? M(r) : r);
|
|
113
|
+
return;
|
|
114
|
+
}
|
|
115
|
+
let o = t.tagName;
|
|
116
|
+
if (n === "value" && o !== "PROGRESS" && !o.includes("-")) {
|
|
117
|
+
let e = o === "OPTION" ? t.getAttribute("value") || "" : t.value, i = r == null ? t.type === "checkbox" ? "on" : "" : String(r);
|
|
118
|
+
e === i && "_value" in t || (t.value = i), r ?? t.removeAttribute(n), t._value = r;
|
|
119
|
+
return;
|
|
120
|
+
}
|
|
121
|
+
let s = !1;
|
|
122
|
+
if (r === "" || r == null) {
|
|
123
|
+
let i = typeof t[n];
|
|
124
|
+
i === "boolean" ? r = e(r) : r == null && i === "string" ? (r = "", s = !0) : i === "number" && (r = 0, s = !0);
|
|
125
|
+
}
|
|
126
|
+
try {
|
|
127
|
+
t[n] = r;
|
|
128
|
+
} catch {}
|
|
129
|
+
s && t.removeAttribute(a || n);
|
|
130
|
+
}
|
|
131
|
+
function q(e, t, n, r) {
|
|
132
|
+
e.addEventListener(t, n, r);
|
|
133
|
+
}
|
|
134
|
+
function ye(e, t, n, r) {
|
|
135
|
+
e.removeEventListener(t, n, r);
|
|
136
|
+
}
|
|
137
|
+
var be = /* @__PURE__ */ Symbol("_vei");
|
|
138
|
+
function xe(e, t, n, r, i = null) {
|
|
139
|
+
let a = e[be] || (e[be] = {}), o = a[t];
|
|
140
|
+
if (r && o) o.value = r;
|
|
141
|
+
else {
|
|
142
|
+
let [n, s] = J(t);
|
|
143
|
+
r ? q(e, n, a[t] = Te(r, i), s) : o && (ye(e, n, o, s), a[t] = void 0);
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
var Se = /(Once|Passive|Capture)$/, Ce = /^on:?(?:Once|Passive|Capture)$/;
|
|
147
|
+
function J(e) {
|
|
148
|
+
let t, n;
|
|
149
|
+
for (; (n = e.match(Se)) && !Ce.test(e);) t ||= {}, e = e.slice(0, e.length - n[1].length), t[n[1].toLowerCase()] = !0;
|
|
150
|
+
return [e[2] === ":" ? e.slice(3) : y(e.slice(2)), t];
|
|
151
|
+
}
|
|
152
|
+
var Y = 0, we = /* @__PURE__ */ Promise.resolve(), X = () => Y ||= (we.then(() => Y = 0), Date.now());
|
|
153
|
+
function Te(e, t) {
|
|
154
|
+
let n = (e) => {
|
|
155
|
+
if (!e._vts) e._vts = Date.now();
|
|
156
|
+
else if (e._vts <= n.attached) return;
|
|
157
|
+
let r = n.value;
|
|
158
|
+
if (l(r)) {
|
|
159
|
+
let n = e.stopImmediatePropagation;
|
|
160
|
+
e.stopImmediatePropagation = () => {
|
|
161
|
+
n.call(e), e._stopped = !0;
|
|
162
|
+
};
|
|
163
|
+
let i = r.slice(), a = [e];
|
|
164
|
+
for (let n = 0; n < i.length && !e._stopped; n++) {
|
|
165
|
+
let e = i[n];
|
|
166
|
+
e && h(e, t, 5, a);
|
|
167
|
+
}
|
|
168
|
+
} else h(r, t, 5, [e]);
|
|
169
|
+
};
|
|
170
|
+
return n.value = e, n.attached = X(), n;
|
|
171
|
+
}
|
|
172
|
+
var Ee = (e) => e.charCodeAt(0) === 111 && e.charCodeAt(1) === 110 && e.charCodeAt(2) > 96 && e.charCodeAt(2) < 123, De = (e, t, n, r, o, s) => {
|
|
173
|
+
let l = o === "svg";
|
|
174
|
+
t === "class" ? ge(e, r, l) : t === "style" ? ve(e, n, r) : a(t) ? f(t) || xe(e, t, n, r, s) : (t[0] === "." ? (t = t.slice(1), 1) : t[0] === "^" ? (t = t.slice(1), 0) : Oe(e, t, r, l)) ? (K(e, t, r), e.tagName.includes("-") || t !== "value" && t !== "checked" && t !== "selected" || G(e, t, r, l, s, t !== "value")) : e._isVueCE && (Z(e, t) || e._def.__asyncLoader && (/[A-Z]/.test(t) || !c(r))) ? K(e, i(t), r, s, t) : (t === "true-value" ? e._trueValue = r : t === "false-value" && (e._falseValue = r), G(e, t, r, l));
|
|
175
|
+
};
|
|
176
|
+
function Oe(e, t, n, r) {
|
|
177
|
+
if (r) return !!(t === "innerHTML" || t === "textContent" || t in e && Ee(t) && u(n));
|
|
178
|
+
if (t === "spellcheck" || t === "draggable" || t === "translate" || t === "autocorrect" || t === "sandbox" && e.tagName === "IFRAME" || t === "form" || t === "list" && e.tagName === "INPUT" || t === "type" && e.tagName === "TEXTAREA") return !1;
|
|
179
|
+
if (t === "width" || t === "height") {
|
|
180
|
+
let t = e.tagName;
|
|
181
|
+
if (t === "IMG" || t === "VIDEO" || t === "CANVAS" || t === "SOURCE") return !1;
|
|
182
|
+
}
|
|
183
|
+
return Ee(t) && c(n) ? !1 : t in e;
|
|
184
|
+
}
|
|
185
|
+
function Z(e, t) {
|
|
186
|
+
let n = e._def.props;
|
|
187
|
+
if (!n) return !1;
|
|
188
|
+
let r = i(t);
|
|
189
|
+
return Array.isArray(n) ? n.some((e) => i(e) === r) : Object.keys(n).some((e) => i(e) === r);
|
|
190
|
+
}
|
|
191
|
+
var ke = (e) => {
|
|
192
|
+
let t = e.props["onUpdate:modelValue"] || !1;
|
|
193
|
+
return l(t) ? (e) => v(t, e) : t;
|
|
194
|
+
};
|
|
195
|
+
function Ae(e) {
|
|
196
|
+
e.target.composing = !0;
|
|
197
|
+
}
|
|
198
|
+
function je(e) {
|
|
199
|
+
let t = e.target;
|
|
200
|
+
t.composing && (t.composing = !1, t.dispatchEvent(new Event("input")));
|
|
201
|
+
}
|
|
202
|
+
var Me = /* @__PURE__ */ Symbol("_assign"), Ne = /* @__PURE__ */ Symbol("_initialValue");
|
|
203
|
+
function Pe(e, t, n) {
|
|
204
|
+
return t && (e = e.trim()), n && (e = A(e)), e;
|
|
205
|
+
}
|
|
206
|
+
var Fe = {
|
|
207
|
+
created(e, { modifiers: { lazy: t, trim: n, number: r } }, i) {
|
|
208
|
+
e.parentNode && (e.type === "text" ? e[Ne] = e.defaultValue.replace(/[\r\n]/g, "") : e.type === "textarea" && (e[Ne] = e.defaultValue.replace(/\r\n?/g, "\n"))), e[Me] = ke(i);
|
|
209
|
+
let a = r || i.props && i.props.type === "number";
|
|
210
|
+
q(e, t ? "change" : "input", (t) => {
|
|
211
|
+
t.target.composing || e[Me](Pe(e.value, n, a));
|
|
212
|
+
}), (n || a) && q(e, "change", () => {
|
|
213
|
+
e.value = Pe(e.value, n, a);
|
|
214
|
+
}), t || (q(e, "compositionstart", Ae), q(e, "compositionend", je), q(e, "change", je));
|
|
215
|
+
},
|
|
216
|
+
mounted(e, { value: t, modifiers: { trim: n, number: r } }) {
|
|
217
|
+
let i = t ?? "", a = e[Ne];
|
|
218
|
+
delete e[Ne], a !== void 0 && (e.type === "text" || e.type === "textarea") && e.value !== a ? e[Me](Pe(e.value, n, r)) : e.value = i;
|
|
219
|
+
},
|
|
220
|
+
beforeUpdate(e, { value: t, oldValue: n, modifiers: { lazy: r, trim: i, number: a } }, o) {
|
|
221
|
+
if (e[Me] = ke(o), e.composing) return;
|
|
222
|
+
let s = (a || e.type === "number") && !/^0\d/.test(e.value) ? A(e.value) : e.value, c = t ?? "";
|
|
223
|
+
if (s === c) return;
|
|
224
|
+
let l = e.getRootNode();
|
|
225
|
+
(l instanceof Document || l instanceof ShadowRoot) && l.activeElement === e && e.type !== "range" && (r && t === n || i && e.value.trim() === c) || (e.value = c);
|
|
226
|
+
}
|
|
227
|
+
}, Ie = [
|
|
228
|
+
"ctrl",
|
|
229
|
+
"shift",
|
|
230
|
+
"alt",
|
|
231
|
+
"meta"
|
|
232
|
+
], Le = {
|
|
233
|
+
stop: (e) => e.stopPropagation(),
|
|
234
|
+
prevent: (e) => e.preventDefault(),
|
|
235
|
+
self: (e) => e.target !== e.currentTarget,
|
|
236
|
+
ctrl: (e) => !e.ctrlKey,
|
|
237
|
+
shift: (e) => !e.shiftKey,
|
|
238
|
+
alt: (e) => !e.altKey,
|
|
239
|
+
meta: (e) => !e.metaKey,
|
|
240
|
+
left: (e) => "button" in e && e.button !== 0,
|
|
241
|
+
middle: (e) => "button" in e && e.button !== 1,
|
|
242
|
+
right: (e) => "button" in e && e.button !== 2,
|
|
243
|
+
exact: (e, t) => Ie.some((n) => e[`${n}Key`] && !t.includes(n))
|
|
244
|
+
}, Re = (e, t) => {
|
|
245
|
+
if (!e) return e;
|
|
246
|
+
let n = e._withMods ||= {}, r = t.join(".");
|
|
247
|
+
return n[r] || (n[r] = ((n, ...r) => {
|
|
248
|
+
for (let e = 0; e < t.length; e++) {
|
|
249
|
+
let r = Le[t[e]];
|
|
250
|
+
if (r && r(n, t)) return;
|
|
251
|
+
}
|
|
252
|
+
return e(n, ...r);
|
|
253
|
+
}));
|
|
254
|
+
}, ze = /* @__PURE__ */ d({ patchProp: De }, he), Be;
|
|
255
|
+
function Ve() {
|
|
256
|
+
return Be ||= g(ze);
|
|
257
|
+
}
|
|
258
|
+
var He = ((...e) => {
|
|
259
|
+
let t = Ve().createApp(...e), { mount: n } = t;
|
|
260
|
+
return t.mount = (e) => {
|
|
261
|
+
let r = We(e);
|
|
262
|
+
if (!r) return;
|
|
263
|
+
let i = t._component;
|
|
264
|
+
u(i) || i.render || i.template || (i.template = r.innerHTML), r.nodeType === 1 && (r.textContent = "");
|
|
265
|
+
let a = n(r, !1, Ue(r));
|
|
266
|
+
return r instanceof Element && (r.removeAttribute("v-cloak"), r.setAttribute("data-v-app", "")), a;
|
|
267
|
+
}, t;
|
|
268
|
+
});
|
|
269
|
+
function Ue(e) {
|
|
270
|
+
if (e instanceof SVGElement) return "svg";
|
|
271
|
+
if (typeof MathMLElement == "function" && e instanceof MathMLElement) return "mathml";
|
|
272
|
+
}
|
|
273
|
+
function We(e) {
|
|
274
|
+
return c(e) ? document.querySelector(e) : e;
|
|
275
|
+
}
|
|
276
|
+
// node_modules/lucide-vue-next/dist/esm/shared/src/utils.js
|
|
277
|
+
var Ge = (e) => e.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase(), Ke = (e) => e.replace(/^([A-Z])|[\s-_]+(\w)/g, (e, t, n) => n ? n.toUpperCase() : t.toLowerCase()), qe = (e) => {
|
|
278
|
+
let t = Ke(e);
|
|
279
|
+
return t.charAt(0).toUpperCase() + t.slice(1);
|
|
280
|
+
}, Je = (...e) => e.filter((e, t, n) => !!e && e.trim() !== "" && n.indexOf(e) === t).join(" ").trim(), Ye = (e) => e === "", Q = {
|
|
281
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
282
|
+
width: 24,
|
|
283
|
+
height: 24,
|
|
284
|
+
viewBox: "0 0 24 24",
|
|
285
|
+
fill: "none",
|
|
286
|
+
stroke: "currentColor",
|
|
287
|
+
"stroke-width": 2,
|
|
288
|
+
"stroke-linecap": "round",
|
|
289
|
+
"stroke-linejoin": "round"
|
|
290
|
+
}, Xe = ({ name: e, iconNode: t, absoluteStrokeWidth: n, "absolute-stroke-width": r, strokeWidth: i, "stroke-width": a, size: o = Q.width, color: s = Q.stroke, ...c }, { slots: l }) => _("svg", {
|
|
291
|
+
...Q,
|
|
292
|
+
...c,
|
|
293
|
+
width: o,
|
|
294
|
+
height: o,
|
|
295
|
+
stroke: s,
|
|
296
|
+
"stroke-width": Ye(n) || Ye(r) || n === !0 || r === !0 ? Number(i || a || Q["stroke-width"]) * 24 / Number(o) : i || a || Q["stroke-width"],
|
|
297
|
+
class: Je("lucide", c.class, ...e ? [`lucide-${Ge(qe(e))}-icon`, `lucide-${Ge(e)}`] : ["lucide-icon"])
|
|
298
|
+
}, [...t.map((e) => _(...e)), ...l.default ? [l.default()] : []]), $ = (e, t) => (n, { slots: r, attrs: i }) => _(Xe, {
|
|
299
|
+
...i,
|
|
300
|
+
...n,
|
|
301
|
+
iconNode: t,
|
|
302
|
+
name: e
|
|
303
|
+
}, r), Ze = $("chevron-left", [["path", {
|
|
304
|
+
d: "m15 18-6-6 6-6",
|
|
305
|
+
key: "1wnfg3"
|
|
306
|
+
}]]), Qe = $("chevron-right", [["path", {
|
|
307
|
+
d: "m9 18 6-6-6-6",
|
|
308
|
+
key: "mthhwq"
|
|
309
|
+
}]]), $e = $("folder-open", [["path", {
|
|
310
|
+
d: "m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2",
|
|
311
|
+
key: "usdka0"
|
|
312
|
+
}]]), et = $("lock-keyhole", [
|
|
313
|
+
["circle", {
|
|
314
|
+
cx: "12",
|
|
315
|
+
cy: "16",
|
|
316
|
+
r: "1",
|
|
317
|
+
key: "1au0dj"
|
|
318
|
+
}],
|
|
319
|
+
["rect", {
|
|
320
|
+
x: "3",
|
|
321
|
+
y: "10",
|
|
322
|
+
width: "18",
|
|
323
|
+
height: "12",
|
|
324
|
+
rx: "2",
|
|
325
|
+
key: "6s8ecr"
|
|
326
|
+
}],
|
|
327
|
+
["path", {
|
|
328
|
+
d: "M7 10V7a5 5 0 0 1 10 0v3",
|
|
329
|
+
key: "1pqi11"
|
|
330
|
+
}]
|
|
331
|
+
]), tt = $("maximize", [
|
|
332
|
+
["path", {
|
|
333
|
+
d: "M8 3H5a2 2 0 0 0-2 2v3",
|
|
334
|
+
key: "1dcmit"
|
|
335
|
+
}],
|
|
336
|
+
["path", {
|
|
337
|
+
d: "M21 8V5a2 2 0 0 0-2-2h-3",
|
|
338
|
+
key: "1e4gt3"
|
|
339
|
+
}],
|
|
340
|
+
["path", {
|
|
341
|
+
d: "M3 16v3a2 2 0 0 0 2 2h3",
|
|
342
|
+
key: "wsl5sc"
|
|
343
|
+
}],
|
|
344
|
+
["path", {
|
|
345
|
+
d: "M16 21h3a2 2 0 0 0 2-2v-3",
|
|
346
|
+
key: "18trek"
|
|
347
|
+
}]
|
|
348
|
+
]), nt = $("minus", [["path", {
|
|
349
|
+
d: "M5 12h14",
|
|
350
|
+
key: "1ays0h"
|
|
351
|
+
}]]), rt = $("plus", [["path", {
|
|
352
|
+
d: "M5 12h14",
|
|
353
|
+
key: "1ays0h"
|
|
354
|
+
}], ["path", {
|
|
355
|
+
d: "M12 5v14",
|
|
356
|
+
key: "s699le"
|
|
357
|
+
}]]), it = $("x", [["path", {
|
|
358
|
+
d: "M18 6 6 18",
|
|
359
|
+
key: "1bl5f8"
|
|
360
|
+
}], ["path", {
|
|
361
|
+
d: "m6 6 12 12",
|
|
362
|
+
key: "d8bk6v"
|
|
363
|
+
}]]), at = /* @__PURE__ */ x({
|
|
364
|
+
__name: "viewer-tile",
|
|
365
|
+
props: {
|
|
366
|
+
session: {},
|
|
367
|
+
render: { type: Function },
|
|
368
|
+
documentId: {},
|
|
369
|
+
revision: {},
|
|
370
|
+
grid: { type: Boolean },
|
|
371
|
+
index: {},
|
|
372
|
+
x: {},
|
|
373
|
+
y: {},
|
|
374
|
+
width: {},
|
|
375
|
+
height: {},
|
|
376
|
+
ratio: {}
|
|
377
|
+
},
|
|
378
|
+
emits: ["error"],
|
|
379
|
+
setup(e, { emit: t }) {
|
|
380
|
+
let r = e, i = t, a = n(), o, s = 0;
|
|
381
|
+
return ue(() => [
|
|
382
|
+
a.value,
|
|
383
|
+
r.documentId,
|
|
384
|
+
r.revision,
|
|
385
|
+
r.grid,
|
|
386
|
+
r.index,
|
|
387
|
+
r.x,
|
|
388
|
+
r.y,
|
|
389
|
+
r.width,
|
|
390
|
+
r.height,
|
|
391
|
+
r.ratio
|
|
392
|
+
], async () => {
|
|
393
|
+
o?.abort();
|
|
394
|
+
let e = ++s, t = a.value;
|
|
395
|
+
if (!t || r.session.changingFile || r.session.state.id !== r.documentId) return;
|
|
396
|
+
let n = o = new AbortController(), c = {
|
|
397
|
+
x: r.x / r.ratio,
|
|
398
|
+
y: r.y / r.ratio,
|
|
399
|
+
width: r.width,
|
|
400
|
+
height: r.height,
|
|
401
|
+
scale: r.ratio
|
|
402
|
+
}, l = r.grid ? {
|
|
403
|
+
kind: "grid_tile",
|
|
404
|
+
tile: {
|
|
405
|
+
...c,
|
|
406
|
+
sheet: r.index
|
|
407
|
+
}
|
|
408
|
+
} : {
|
|
409
|
+
kind: "tile",
|
|
410
|
+
tile: {
|
|
411
|
+
...c,
|
|
412
|
+
page: r.index
|
|
413
|
+
}
|
|
414
|
+
};
|
|
415
|
+
try {
|
|
416
|
+
let i = await r.render(l, r.revision, n.signal);
|
|
417
|
+
if (n.signal.aborted || e !== s || r.session.state.id !== r.documentId) return;
|
|
418
|
+
let a = t.getContext("2d");
|
|
419
|
+
if (!a) throw Error("当前浏览器无法创建文档画布。");
|
|
420
|
+
t.width = i.value.width, t.height = i.value.height, a.putImageData(new ImageData(new Uint8ClampedArray(i.value.pixels), i.value.width, i.value.height), 0, 0);
|
|
421
|
+
} catch (t) {
|
|
422
|
+
!n.signal.aborted && e === s && !(t instanceof T && [
|
|
423
|
+
"cancelled",
|
|
424
|
+
"worker_restarted",
|
|
425
|
+
"busy"
|
|
426
|
+
].includes(t.code)) && i("error", t);
|
|
427
|
+
}
|
|
428
|
+
}, { flush: "post" }), ne(() => {
|
|
429
|
+
s++, o?.abort();
|
|
430
|
+
}), (e, t) => (k(), O("canvas", {
|
|
431
|
+
ref_key: "canvas",
|
|
432
|
+
ref: a,
|
|
433
|
+
"aria-hidden": "true"
|
|
434
|
+
}, null, 512));
|
|
435
|
+
}
|
|
436
|
+
}), ot = ["aria-label"], st = { class: "viewer-toolbar" }, ct = ["disabled"], lt = ["accept"], ut = ["title"], dt = ["disabled"], ft = {
|
|
437
|
+
class: "page-count",
|
|
438
|
+
"aria-live": "polite"
|
|
439
|
+
}, pt = ["disabled"], mt = ["disabled"], ht = { class: "zoom" }, gt = ["disabled"], _t = ["disabled"], vt = {
|
|
440
|
+
key: 0,
|
|
441
|
+
class: "viewer-error",
|
|
442
|
+
role: "alert"
|
|
443
|
+
}, yt = ["aria-busy"], bt = ["role", "aria-label"], xt = {
|
|
444
|
+
key: 1,
|
|
445
|
+
class: "viewer-empty",
|
|
446
|
+
role: "status"
|
|
447
|
+
}, St = { class: "viewer-footer" }, Ct = { key: 0 }, wt = ["value", "disabled"], Tt = ["value"], Et = { key: 1 }, Dt = { role: "status" }, Ot = {
|
|
448
|
+
key: 1,
|
|
449
|
+
class: "viewer-prompt-backdrop"
|
|
450
|
+
}, kt = {
|
|
451
|
+
key: 0,
|
|
452
|
+
role: "alert"
|
|
453
|
+
}, At = { class: "prompt-actions" }, jt = {
|
|
454
|
+
key: 0,
|
|
455
|
+
type: "submit"
|
|
456
|
+
}, Mt = /*#__PURE__*/ ((e, t) => {
|
|
457
|
+
let n = e.__vccOpts || e;
|
|
458
|
+
for (let [e, r] of t) n[e] = r;
|
|
459
|
+
return n;
|
|
460
|
+
})(/* @__PURE__ */ x({
|
|
461
|
+
__name: "Viewer",
|
|
462
|
+
props: {
|
|
463
|
+
workspace: {},
|
|
464
|
+
kind: {}
|
|
465
|
+
},
|
|
466
|
+
setup(e) {
|
|
467
|
+
let r = e, i = n(), a = n(), s = C(() => r.workspace.state.value), c = C(() => r.workspace.error.value), l = C(() => r.workspace.prompt.value), u = n(""), d = n(!1), f = n(0), p = n(0), h = n(!0), g = n(100), _ = le([]), v = le(), y = le(), x = n(0), S = n(0), D = n(800), A = n(600), j = n(1), de = n(0), M = r.workspace.session, fe = C(() => ({
|
|
468
|
+
pdf: ".pdf",
|
|
469
|
+
word: ".doc,.docx,.sds.zip",
|
|
470
|
+
grid: ".xls,.xlsx,.csv,.tsv,.sxs.zip",
|
|
471
|
+
slide: ".ppt,.pptx"
|
|
472
|
+
})[r.kind]), pe = C(() => ({
|
|
473
|
+
pdf: "PDF",
|
|
474
|
+
word: "文字",
|
|
475
|
+
grid: "表格",
|
|
476
|
+
slide: "演示"
|
|
477
|
+
})[r.kind]), N = C(() => g.value / 100 * 4 / 3), me = C(() => N.value * j.value), he = C(() => y.value?.sheets.find((e) => e.index === f.value)), P = C(() => r.kind === "grid" ? he.value?.width ?? 0 : v.value?.width ?? 0), ge = C(() => r.kind === "grid" ? he.value?.height ?? 0 : v.value?.height ?? 0), F = C(() => Math.ceil(P.value * N.value)), _e = C(() => Math.ceil(ge.value * N.value)), I = C(() => r.kind === "grid" ? 0 : Math.max(20, (D.value - F.value) / 2)), L = C(() => r.kind === "grid" ? 0 : 20), ve = C(() => P.value > 0 && ge.value > 0), R = C(() => f.value + 1 < p.value || !h.value), z = C(() => d.value || r.workspace.busy.value), B = !1, V, H, U = 0, W, G = !1, K = !1, q = !1, ye, be = Promise.resolve(), xe = C(() => {
|
|
478
|
+
let e = Math.ceil(P.value * me.value), t = Math.ceil(ge.value * me.value), n = Math.max(0, Math.floor((x.value - I.value) * j.value / 768)), r = Math.min(Math.ceil(e / 768), Math.ceil((x.value + D.value - I.value) * j.value / 768)), i = Math.max(0, Math.floor((S.value - L.value) * j.value / 768)), a = Math.min(Math.ceil(t / 768), Math.ceil((S.value + A.value - L.value) * j.value / 768)), o = [];
|
|
479
|
+
for (let s = i; s < a; s++) for (let i = n; i < r; i++) {
|
|
480
|
+
let n = i * 768, r = s * 768;
|
|
481
|
+
o.push({
|
|
482
|
+
key: `${n}:${r}`,
|
|
483
|
+
x: n,
|
|
484
|
+
y: r,
|
|
485
|
+
width: Math.min(768, e - n),
|
|
486
|
+
height: Math.min(768, t - r)
|
|
487
|
+
});
|
|
488
|
+
}
|
|
489
|
+
return o;
|
|
490
|
+
});
|
|
491
|
+
function Se(e) {
|
|
492
|
+
B && !(e instanceof T && [
|
|
493
|
+
"cancelled",
|
|
494
|
+
"busy",
|
|
495
|
+
"worker_restarted"
|
|
496
|
+
].includes(e.code)) && r.workspace.showError(e);
|
|
497
|
+
}
|
|
498
|
+
function Ce(e, t, n) {
|
|
499
|
+
let r = be.then(() => {
|
|
500
|
+
if (!B || n.aborted) throw new T("cancelled", "图块已离开视口");
|
|
501
|
+
if (q) throw new T("worker_restarted", "文档引擎正在恢复");
|
|
502
|
+
return M.view(e, { expectedRevision: t });
|
|
503
|
+
});
|
|
504
|
+
return be = r.then(() => {}, () => {}), r;
|
|
505
|
+
}
|
|
506
|
+
function J() {
|
|
507
|
+
i.value && (D.value = i.value.clientWidth, A.value = i.value.clientHeight, j.value = Math.min(2, window.devicePixelRatio || 1));
|
|
508
|
+
}
|
|
509
|
+
function Y() {
|
|
510
|
+
x.value = i.value?.scrollLeft ?? 0, S.value = i.value?.scrollTop ?? 0, r.kind === "grid" && we();
|
|
511
|
+
}
|
|
512
|
+
function we() {
|
|
513
|
+
clearTimeout(W), W = setTimeout(() => {
|
|
514
|
+
B && s.value.name && X();
|
|
515
|
+
}, 80);
|
|
516
|
+
}
|
|
517
|
+
async function X() {
|
|
518
|
+
if (B && s.value.name && (K = !0, !(G || q || M.changingFile))) {
|
|
519
|
+
G = !0, d.value = !0;
|
|
520
|
+
try {
|
|
521
|
+
do {
|
|
522
|
+
K = !1;
|
|
523
|
+
let e = H = new AbortController(), t = U, n = s.value.id, i = s.value.revision, a = f.value, o = {
|
|
524
|
+
signal: e.signal,
|
|
525
|
+
expectedRevision: i
|
|
526
|
+
}, c = () => B && !q && !e.signal.aborted && t === U && s.value.id === n && s.value.revision === i && f.value === a;
|
|
527
|
+
try {
|
|
528
|
+
if (r.kind === "word") {
|
|
529
|
+
for (; !_.value[a];) {
|
|
530
|
+
let e = await M.view({
|
|
531
|
+
kind: "layout",
|
|
532
|
+
pageBudget: 2
|
|
533
|
+
}, o);
|
|
534
|
+
if (!c()) break;
|
|
535
|
+
let t = e.value.reset_from === null ? [..._.value] : _.value.slice(0, e.value.reset_from);
|
|
536
|
+
for (let n of e.value.pages) t[n.index] = n;
|
|
537
|
+
if (_.value = t, p.value = e.value.known_pages, h.value = e.value.complete, h.value) break;
|
|
538
|
+
}
|
|
539
|
+
c() && (v.value = _.value[a]);
|
|
540
|
+
} else if (r.kind === "pdf") {
|
|
541
|
+
let e = await M.view({
|
|
542
|
+
kind: "pdf_state",
|
|
543
|
+
page: a,
|
|
544
|
+
from: a,
|
|
545
|
+
limit: 1
|
|
546
|
+
}, o);
|
|
547
|
+
c() && (v.value = e.value.page ?? void 0, p.value = e.value.page_count);
|
|
548
|
+
} else if (r.kind === "slide") {
|
|
549
|
+
let e = await M.view({
|
|
550
|
+
kind: "presentation_state",
|
|
551
|
+
slide: a,
|
|
552
|
+
from: a,
|
|
553
|
+
limit: 1
|
|
554
|
+
}, o);
|
|
555
|
+
c() && (p.value = e.value.slide_count, v.value = p.value ? {
|
|
556
|
+
index: a,
|
|
557
|
+
width: e.value.width,
|
|
558
|
+
height: e.value.height
|
|
559
|
+
} : void 0);
|
|
560
|
+
} else {
|
|
561
|
+
let e = await M.view({
|
|
562
|
+
kind: "grid_layout",
|
|
563
|
+
sheet: a,
|
|
564
|
+
x: x.value / N.value,
|
|
565
|
+
y: S.value / N.value,
|
|
566
|
+
width: D.value / N.value,
|
|
567
|
+
height: A.value / N.value
|
|
568
|
+
}, o);
|
|
569
|
+
c() && (y.value = e.value, p.value = e.value.sheets.length);
|
|
570
|
+
}
|
|
571
|
+
} catch (e) {
|
|
572
|
+
c() && Se(e);
|
|
573
|
+
} finally {
|
|
574
|
+
H === e && (H = void 0);
|
|
575
|
+
}
|
|
576
|
+
} while (B && K && !q && !M.changingFile);
|
|
577
|
+
} finally {
|
|
578
|
+
G = !1, d.value = q;
|
|
579
|
+
}
|
|
580
|
+
}
|
|
581
|
+
}
|
|
582
|
+
async function Te(e) {
|
|
583
|
+
z.value || e < 0 || h.value && e >= p.value || (H?.abort(), U++, r.kind !== "grid" && (v.value = void 0), f.value = e, i.value?.scrollTo(0, 0), Y(), await X());
|
|
584
|
+
}
|
|
585
|
+
function Ee(e) {
|
|
586
|
+
let t = Number(e.target.value);
|
|
587
|
+
Number.isInteger(t) && Te(t);
|
|
588
|
+
}
|
|
589
|
+
async function De(e) {
|
|
590
|
+
let t = e.target, n = t.files?.[0];
|
|
591
|
+
t.value = "", n && await r.workspace.run(() => M.openFile(n));
|
|
592
|
+
}
|
|
593
|
+
function Oe() {
|
|
594
|
+
P.value && (g.value = Math.max(25, Math.min(300, Math.floor((D.value - 40) / P.value * 75))));
|
|
595
|
+
}
|
|
596
|
+
function Z(e) {
|
|
597
|
+
u.value = "", l.value?.resolve(e);
|
|
598
|
+
}
|
|
599
|
+
return ue(l, () => {
|
|
600
|
+
u.value = "";
|
|
601
|
+
}), ue([
|
|
602
|
+
() => s.value.id,
|
|
603
|
+
() => s.value.name,
|
|
604
|
+
() => s.value.revision
|
|
605
|
+
], async () => {
|
|
606
|
+
H?.abort(), U++, v.value = void 0, _.value = [], y.value = void 0, f.value = 0, p.value = 0, h.value = r.kind !== "word", i.value?.scrollTo(0, 0), Y(), await oe(), await X();
|
|
607
|
+
}), ue([
|
|
608
|
+
g,
|
|
609
|
+
D,
|
|
610
|
+
A
|
|
611
|
+
], () => {
|
|
612
|
+
r.kind === "grid" && we();
|
|
613
|
+
}), ce(() => {
|
|
614
|
+
B = !0, ye = M.subscribe((e, t) => {
|
|
615
|
+
t?.phase === "recovering" ? (q = !0, U++, K = !0, d.value = !0) : t?.phase === "ready" && q ? (q = !1, v.value = void 0, _.value = [], y.value = void 0, de.value++, X()) : (t?.phase === "failed" || t?.phase === "closed") && (q = !1, K = !1, d.value = !1, t.phase === "failed" && Se(/* @__PURE__ */ Error("文档引擎恢复失败,请重新打开文件。")));
|
|
616
|
+
}), J(), V = new ResizeObserver(J), i.value && V.observe(i.value), window.addEventListener("resize", J), X();
|
|
617
|
+
}), ne(() => {
|
|
618
|
+
B = !1, U++, H?.abort(), ye?.(), clearTimeout(W), V?.disconnect(), window.removeEventListener("resize", J), Z();
|
|
619
|
+
}), (n, r) => (k(), O("section", {
|
|
620
|
+
class: "office-viewer",
|
|
621
|
+
"aria-label": `${pe.value}浏览器`
|
|
622
|
+
}, [
|
|
623
|
+
E("header", st, [
|
|
624
|
+
E("button", {
|
|
625
|
+
type: "button",
|
|
626
|
+
title: "打开文件",
|
|
627
|
+
"aria-label": "打开文件",
|
|
628
|
+
disabled: z.value,
|
|
629
|
+
onClick: r[0] ||= (e) => a.value?.click()
|
|
630
|
+
}, [w(m($e), { size: 18 })], 8, ct),
|
|
631
|
+
E("input", {
|
|
632
|
+
ref_key: "picker",
|
|
633
|
+
ref: a,
|
|
634
|
+
class: "file-input",
|
|
635
|
+
type: "file",
|
|
636
|
+
accept: fe.value,
|
|
637
|
+
onChange: De
|
|
638
|
+
}, null, 40, lt),
|
|
639
|
+
E("strong", {
|
|
640
|
+
class: "file-name",
|
|
641
|
+
title: s.value.name
|
|
642
|
+
}, o(s.value.name || `${pe.value}浏览器`), 9, ut),
|
|
643
|
+
r[10] ||= E("span", { class: "readonly-label" }, "只读", -1),
|
|
644
|
+
e.kind === "grid" ? b("v-if", !0) : (k(), O(se, { key: 0 }, [
|
|
645
|
+
E("button", {
|
|
646
|
+
type: "button",
|
|
647
|
+
title: "上一页",
|
|
648
|
+
"aria-label": "上一页",
|
|
649
|
+
disabled: z.value || f.value === 0,
|
|
650
|
+
onClick: r[1] ||= (e) => Te(f.value - 1)
|
|
651
|
+
}, [w(m(Ze), { size: 18 })], 8, dt),
|
|
652
|
+
E("span", ft, o(p.value ? f.value + 1 : 0) + " / " + o(p.value) + o(h.value ? "" : "+"), 1),
|
|
653
|
+
E("button", {
|
|
654
|
+
type: "button",
|
|
655
|
+
title: "下一页",
|
|
656
|
+
"aria-label": "下一页",
|
|
657
|
+
disabled: z.value || !R.value,
|
|
658
|
+
onClick: r[2] ||= (e) => Te(f.value + 1)
|
|
659
|
+
}, [w(m(Qe), { size: 18 })], 8, pt)
|
|
660
|
+
], 64)),
|
|
661
|
+
E("button", {
|
|
662
|
+
type: "button",
|
|
663
|
+
title: "缩小",
|
|
664
|
+
"aria-label": "缩小",
|
|
665
|
+
disabled: g.value <= 25,
|
|
666
|
+
onClick: r[3] ||= (e) => g.value = Math.max(25, g.value - 25)
|
|
667
|
+
}, [w(m(nt), { size: 18 })], 8, mt),
|
|
668
|
+
E("span", ht, o(g.value) + "%", 1),
|
|
669
|
+
E("button", {
|
|
670
|
+
type: "button",
|
|
671
|
+
title: "放大",
|
|
672
|
+
"aria-label": "放大",
|
|
673
|
+
disabled: g.value >= 300,
|
|
674
|
+
onClick: r[4] ||= (e) => g.value = Math.min(300, g.value + 25)
|
|
675
|
+
}, [w(m(rt), { size: 18 })], 8, gt),
|
|
676
|
+
E("button", {
|
|
677
|
+
type: "button",
|
|
678
|
+
title: "适合宽度",
|
|
679
|
+
"aria-label": "适合宽度",
|
|
680
|
+
disabled: !ve.value,
|
|
681
|
+
onClick: Oe
|
|
682
|
+
}, [w(m(tt), { size: 18 })], 8, _t)
|
|
683
|
+
]),
|
|
684
|
+
c.value ? (k(), O("div", vt, [E("span", null, o(c.value), 1), E("button", {
|
|
685
|
+
type: "button",
|
|
686
|
+
"aria-label": "关闭错误提示",
|
|
687
|
+
onClick: r[5] ||= (t) => e.workspace.clearError()
|
|
688
|
+
}, [w(m(it), { size: 16 })])])) : b("v-if", !0),
|
|
689
|
+
E("div", {
|
|
690
|
+
ref_key: "viewport",
|
|
691
|
+
ref: i,
|
|
692
|
+
class: "viewer-viewport",
|
|
693
|
+
tabindex: "0",
|
|
694
|
+
"aria-busy": d.value,
|
|
695
|
+
onScrollPassive: Y
|
|
696
|
+
}, [ve.value ? (k(), O("div", {
|
|
697
|
+
key: 0,
|
|
698
|
+
class: "viewer-stage",
|
|
699
|
+
style: te({
|
|
700
|
+
width: `${Math.max(D.value, F.value + I.value * 2)}px`,
|
|
701
|
+
height: `${Math.max(A.value, _e.value + L.value * 2)}px`
|
|
702
|
+
})
|
|
703
|
+
}, [E("div", {
|
|
704
|
+
class: t(["viewer-page", { "viewer-grid": e.kind === "grid" }]),
|
|
705
|
+
style: te({
|
|
706
|
+
left: `${I.value}px`,
|
|
707
|
+
top: `${L.value}px`,
|
|
708
|
+
width: `${F.value}px`,
|
|
709
|
+
height: `${_e.value}px`
|
|
710
|
+
}),
|
|
711
|
+
role: e.kind === "grid" ? "img" : "document",
|
|
712
|
+
"aria-label": e.kind === "grid" ? `${he.value?.name ?? ""}工作表` : `第 ${f.value + 1} 页`
|
|
713
|
+
}, [(k(!0), O(se, null, re(xe.value, (t) => (k(), ie(at, {
|
|
714
|
+
key: `${s.value.id}:${f.value}:${de.value}:${t.key}`,
|
|
715
|
+
session: m(M),
|
|
716
|
+
render: Ce,
|
|
717
|
+
"document-id": s.value.id,
|
|
718
|
+
revision: s.value.revision,
|
|
719
|
+
grid: e.kind === "grid",
|
|
720
|
+
index: f.value,
|
|
721
|
+
x: t.x,
|
|
722
|
+
y: t.y,
|
|
723
|
+
width: t.width,
|
|
724
|
+
height: t.height,
|
|
725
|
+
ratio: me.value,
|
|
726
|
+
style: te({
|
|
727
|
+
left: `${t.x / j.value}px`,
|
|
728
|
+
top: `${t.y / j.value}px`,
|
|
729
|
+
width: `${t.width / j.value}px`,
|
|
730
|
+
height: `${t.height / j.value}px`
|
|
731
|
+
}),
|
|
732
|
+
onError: Se
|
|
733
|
+
}, null, 8, [
|
|
734
|
+
"session",
|
|
735
|
+
"document-id",
|
|
736
|
+
"revision",
|
|
737
|
+
"grid",
|
|
738
|
+
"index",
|
|
739
|
+
"x",
|
|
740
|
+
"y",
|
|
741
|
+
"width",
|
|
742
|
+
"height",
|
|
743
|
+
"ratio",
|
|
744
|
+
"style"
|
|
745
|
+
]))), 128))], 14, bt)], 4)) : (k(), O("div", xt, o(d.value ? "正在加载文档…" : s.value.name ? "暂无可显示的页面" : "选择文件开始浏览"), 1))], 40, yt),
|
|
746
|
+
E("footer", St, [e.kind === "grid" && y.value?.sheets.length ? (k(), O("label", Ct, [r[11] ||= ae("工作表", -1), E("select", {
|
|
747
|
+
value: f.value,
|
|
748
|
+
disabled: z.value,
|
|
749
|
+
onChange: Ee
|
|
750
|
+
}, [(k(!0), O(se, null, re(y.value.sheets, (e) => (k(), O("option", {
|
|
751
|
+
key: e.id,
|
|
752
|
+
value: e.index
|
|
753
|
+
}, o(e.name), 9, Tt))), 128))], 40, wt)])) : (k(), O("span", Et, o(pe.value) + "浏览", 1)), E("span", Dt, o(d.value ? "正在加载…" : "只读模式"), 1)]),
|
|
754
|
+
l.value ? (k(), O("div", Ot, [E("form", {
|
|
755
|
+
class: "viewer-prompt",
|
|
756
|
+
role: "dialog",
|
|
757
|
+
"aria-modal": "true",
|
|
758
|
+
"aria-label": "输入文件密码",
|
|
759
|
+
onSubmit: r[9] ||= Re((e) => Z(u.value), ["prevent"])
|
|
760
|
+
}, [
|
|
761
|
+
E("strong", null, [w(m(et), { size: 18 }), ae(o(l.value.kind === "password" ? "输入 PDF 密码" : "确认打开文件"), 1)]),
|
|
762
|
+
E("p", null, o(l.value.name), 1),
|
|
763
|
+
l.value.kind === "password" ? (k(), O(se, { key: 0 }, [l.value.retry ? (k(), O("p", kt, "密码不正确,请重新输入。")) : b("v-if", !0), ee(E("input", {
|
|
764
|
+
"onUpdate:modelValue": r[6] ||= (e) => u.value = e,
|
|
765
|
+
type: "password",
|
|
766
|
+
"aria-label": "PDF 密码",
|
|
767
|
+
autocomplete: "off",
|
|
768
|
+
autofocus: "",
|
|
769
|
+
maxlength: "2048"
|
|
770
|
+
}, null, 512), [[Fe, u.value]])], 64)) : b("v-if", !0),
|
|
771
|
+
E("div", At, [E("button", {
|
|
772
|
+
type: "button",
|
|
773
|
+
onClick: r[7] ||= (e) => Z()
|
|
774
|
+
}, "取消"), l.value.kind === "password" ? (k(), O("button", jt, "解锁文件")) : (k(), O("button", {
|
|
775
|
+
key: 1,
|
|
776
|
+
type: "button",
|
|
777
|
+
onClick: r[8] ||= (e) => Z("discard")
|
|
778
|
+
}, "继续"))])
|
|
779
|
+
], 32)])) : b("v-if", !0)
|
|
780
|
+
], 8, ot));
|
|
781
|
+
}
|
|
782
|
+
}), [["__scopeId", "data-v-6d5a4ba8"]]);
|
|
783
|
+
// sdk/mount.ts
|
|
784
|
+
async function Nt(e, t, n, r) {
|
|
785
|
+
let i = typeof n == "string" ? document.querySelector(n) : n;
|
|
786
|
+
if (!i) throw Error("Office mount container was not found");
|
|
787
|
+
if (i.childNodes.length) throw Error("Office mount container must be empty");
|
|
788
|
+
let a = S(t, r), o = document.createElement("div");
|
|
789
|
+
o.className = "sqsoffice", o.dataset.package = t, i.append(o);
|
|
790
|
+
let s = null, c = !1, l = He({ render: () => _(e, {
|
|
791
|
+
ref: (e) => {
|
|
792
|
+
s = e;
|
|
793
|
+
},
|
|
794
|
+
workspace: a.workspace,
|
|
795
|
+
kind: t,
|
|
796
|
+
assetBase: a.assetBase
|
|
797
|
+
}) });
|
|
798
|
+
l.provide("sqsoffice-asset-base", a.assetBase);
|
|
799
|
+
async function u() {
|
|
800
|
+
c || (a.workspace.prompt.value?.resolve(), a.workspace.session.changingFile && (a.workspace.session.cancelOpen(), await new Promise((e) => {
|
|
801
|
+
let t = a.workspace.session.subscribe(() => {
|
|
802
|
+
a.workspace.session.changingFile || (t(), e());
|
|
803
|
+
});
|
|
804
|
+
a.workspace.session.changingFile || (t(), e());
|
|
805
|
+
})), await a.api.close({ discard: !0 }), c = !0, l.unmount(), o.remove());
|
|
806
|
+
}
|
|
807
|
+
try {
|
|
808
|
+
l.mount(o), r.file && await a.api.open(r.file);
|
|
809
|
+
} catch (e) {
|
|
810
|
+
throw await u(), e;
|
|
811
|
+
}
|
|
812
|
+
return {
|
|
813
|
+
api: a.api,
|
|
814
|
+
async open(e) {
|
|
815
|
+
if (c) throw Error("Office component has been destroyed");
|
|
816
|
+
return await s?.flushInput?.(), a.api.open(e);
|
|
817
|
+
},
|
|
818
|
+
async flush() {
|
|
819
|
+
await s?.flushInput?.();
|
|
820
|
+
},
|
|
821
|
+
destroy: u
|
|
822
|
+
};
|
|
823
|
+
}
|
|
824
|
+
// packages/slide/index.ts
|
|
825
|
+
async function Pt(e, t = {}) {
|
|
826
|
+
return Nt(Mt, "slide", e, {
|
|
827
|
+
...t,
|
|
828
|
+
assetBase: t.assetBase ?? new URL(
|
|
829
|
+
/* @vite-ignore */
|
|
830
|
+
"./assets/",
|
|
831
|
+
import.meta.url
|
|
832
|
+
).pathname
|
|
833
|
+
});
|
|
834
|
+
}
|
|
835
|
+
export { T as EngineError, D as createApi, Pt as mount };
|