lt-ppt 1.0.27 → 1.0.29
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/dist/{InnerApp-E5ZhY2Xz.js → InnerApp-BVIJgQPL.js} +9343 -9305
- package/dist/{index-CuBMdS2l.js → index-C0mC3XB7.js} +1 -1
- package/dist/{index-B_s4tGTz.js → index-CGIfpvl8.js} +1 -1
- package/dist/index.browser-Wq18ov6h.js +24 -0
- package/dist/{lib-idBHkf9x.js → lib-DZHSlxO6.js} +199 -98
- package/dist/lt-ppt.css +1 -1
- package/dist/lt-ppt.es.js +1 -1
- package/dist/lt-ppt.umd.js +125 -125
- package/dist/{screen-BAckUFpK.js → screen-BFHrqx9g.js} +558 -575
- package/dist/types/src/LtPPT.vue.d.ts +10 -3
- package/dist/types/src/lib.d.ts +2 -2
- package/dist/types/src/types/lt-ppt.d.ts +57 -1
- package/package.json +1 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { defineComponent as k, resolveComponent as P, openBlock as d, createElementBlock as c, Fragment as x, renderList as A, withModifiers as p, normalizeClass as L, createElementVNode as C, toDisplayString as I, createCommentVNode as v, createBlock as O, computed as S, normalizeStyle as U, createVNode as D, render as w } from "vue";
|
|
2
|
-
import { _ as b } from "./lib-
|
|
2
|
+
import { _ as b } from "./lib-DZHSlxO6.js";
|
|
3
3
|
import { t as G } from "./tippy.esm-Dos-q4Dz.js";
|
|
4
4
|
const R = { class: "menu-content" }, X = ["onClick"], V = { class: "text" }, W = {
|
|
5
5
|
key: 0,
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
const m = "useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";
|
|
2
|
+
let s = (t) => crypto.getRandomValues(new Uint8Array(t)), d = (t, e, l) => {
|
|
3
|
+
let r = (2 << Math.log2(t.length - 1)) - 1, o = -~(1.6 * r * e / t.length);
|
|
4
|
+
return (u = e) => {
|
|
5
|
+
let n = "";
|
|
6
|
+
for (; ; ) {
|
|
7
|
+
let h = l(o), a = o | 0;
|
|
8
|
+
for (; a--; )
|
|
9
|
+
if (n += t[h[a] & r] || "", n.length >= u) return n;
|
|
10
|
+
}
|
|
11
|
+
};
|
|
12
|
+
}, g = (t, e = 21) => d(t, e | 0, s), i = (t = 21) => {
|
|
13
|
+
let e = "", l = crypto.getRandomValues(new Uint8Array(t |= 0));
|
|
14
|
+
for (; t--; )
|
|
15
|
+
e += m[l[t] & 63];
|
|
16
|
+
return e;
|
|
17
|
+
};
|
|
18
|
+
export {
|
|
19
|
+
g as customAlphabet,
|
|
20
|
+
d as customRandom,
|
|
21
|
+
i as nanoid,
|
|
22
|
+
s as random,
|
|
23
|
+
m as urlAlphabet
|
|
24
|
+
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { inject as
|
|
2
|
-
const
|
|
1
|
+
import { inject as Q, ref as y, defineComponent as K, getCurrentInstance as $, computed as U, onMounted as ee, onBeforeUnmount as te, watch as N, openBlock as oe, createElementBlock as ie, normalizeStyle as ne } from "vue";
|
|
2
|
+
const le = {
|
|
3
3
|
common: {
|
|
4
4
|
close: "关闭",
|
|
5
5
|
cancel: "取消",
|
|
@@ -1148,7 +1148,7 @@ const B = {
|
|
|
1148
1148
|
latex: "公式"
|
|
1149
1149
|
}
|
|
1150
1150
|
}
|
|
1151
|
-
},
|
|
1151
|
+
}, ae = {
|
|
1152
1152
|
common: {
|
|
1153
1153
|
close: "Close",
|
|
1154
1154
|
cancel: "Cancel",
|
|
@@ -2269,41 +2269,41 @@ const B = {
|
|
|
2269
2269
|
latex: "Formula"
|
|
2270
2270
|
}
|
|
2271
2271
|
}
|
|
2272
|
-
},
|
|
2273
|
-
function
|
|
2274
|
-
return Object.entries(
|
|
2275
|
-
const
|
|
2276
|
-
return
|
|
2272
|
+
}, M = Symbol("lt-ppt-i18n"), re = { "zh-CN": le, en: ae };
|
|
2273
|
+
function H(d, c = "") {
|
|
2274
|
+
return Object.entries(d).reduce((s, [i, p]) => {
|
|
2275
|
+
const S = c ? `${c}.${i}` : i;
|
|
2276
|
+
return p && typeof p == "object" && !Array.isArray(p) ? Object.assign(s, H(p, S)) : s[S] = String(p), s;
|
|
2277
2277
|
}, {});
|
|
2278
2278
|
}
|
|
2279
|
-
const
|
|
2280
|
-
Object.entries(
|
|
2279
|
+
const T = Object.fromEntries(
|
|
2280
|
+
Object.entries(re).map(([d, c]) => [d, H(c)])
|
|
2281
2281
|
);
|
|
2282
|
-
function
|
|
2283
|
-
const
|
|
2284
|
-
return { t: (
|
|
2285
|
-
var
|
|
2286
|
-
return ((
|
|
2287
|
-
}, locale:
|
|
2282
|
+
function he() {
|
|
2283
|
+
const d = Q(M, { locale: y("zh-CN") });
|
|
2284
|
+
return { t: (s) => {
|
|
2285
|
+
var i, p;
|
|
2286
|
+
return ((i = T[d.locale.value]) == null ? void 0 : i[s]) ?? ((p = T["zh-CN"]) == null ? void 0 : p[s]) ?? s;
|
|
2287
|
+
}, locale: d.locale };
|
|
2288
2288
|
}
|
|
2289
|
-
function
|
|
2290
|
-
return (
|
|
2291
|
-
var
|
|
2292
|
-
return ((
|
|
2289
|
+
function de(d) {
|
|
2290
|
+
return (c) => {
|
|
2291
|
+
var s, i;
|
|
2292
|
+
return ((s = T[d.value]) == null ? void 0 : s[c]) ?? ((i = T["zh-CN"]) == null ? void 0 : i[c]) ?? c;
|
|
2293
2293
|
};
|
|
2294
2294
|
}
|
|
2295
|
-
function
|
|
2296
|
-
const
|
|
2295
|
+
function me(d) {
|
|
2296
|
+
const c = y((d == null ? void 0 : d.locale) ?? "zh-CN");
|
|
2297
2297
|
return {
|
|
2298
2298
|
install() {
|
|
2299
2299
|
},
|
|
2300
|
-
global: { locale:
|
|
2301
|
-
var
|
|
2302
|
-
return ((
|
|
2300
|
+
global: { locale: c, t: (i) => {
|
|
2301
|
+
var p, S;
|
|
2302
|
+
return ((p = T[c.value]) == null ? void 0 : p[i]) ?? ((S = T["zh-CN"]) == null ? void 0 : S[i]) ?? i;
|
|
2303
2303
|
} }
|
|
2304
2304
|
};
|
|
2305
2305
|
}
|
|
2306
|
-
const
|
|
2306
|
+
const se = /* @__PURE__ */ K({
|
|
2307
2307
|
__name: "LtPPT",
|
|
2308
2308
|
props: {
|
|
2309
2309
|
initData: {},
|
|
@@ -2316,85 +2316,186 @@ const U = /* @__PURE__ */ I({
|
|
|
2316
2316
|
height: { default: "100%" },
|
|
2317
2317
|
readonly: { type: Boolean, default: !1 },
|
|
2318
2318
|
theme: { default: "dark" },
|
|
2319
|
-
onReturn: {}
|
|
2320
|
-
|
|
2321
|
-
|
|
2322
|
-
|
|
2323
|
-
|
|
2324
|
-
const
|
|
2325
|
-
|
|
2326
|
-
|
|
2327
|
-
|
|
2328
|
-
|
|
2319
|
+
onReturn: {},
|
|
2320
|
+
onImageAIEntryClick: {}
|
|
2321
|
+
},
|
|
2322
|
+
emits: ["image-ai-entry-click"],
|
|
2323
|
+
setup(d, { expose: c, emit: s }) {
|
|
2324
|
+
const i = d, p = s, S = $(), b = y();
|
|
2325
|
+
let h = null, g = null, P = null, L = null, x = null, v = null, A = null;
|
|
2326
|
+
const F = y(i.locale ?? "zh-CN"), R = y(i.theme ?? "dark"), G = U(() => ({
|
|
2327
|
+
width: i.width,
|
|
2328
|
+
height: i.height
|
|
2329
|
+
})), V = () => {
|
|
2330
|
+
const e = (S == null ? void 0 : S.vnode.props) || {};
|
|
2331
|
+
return !!(e.onImageAIEntryClick || e.onImageAiEntryClick);
|
|
2332
|
+
}, W = U(() => !!i.onImageAIEntryClick || V()), X = (e) => {
|
|
2333
|
+
var u, r;
|
|
2334
|
+
const t = (u = e.detail) == null ? void 0 : u.element;
|
|
2335
|
+
if (!t || t.type !== "image") return;
|
|
2336
|
+
const n = {
|
|
2337
|
+
element: JSON.parse(JSON.stringify(t))
|
|
2338
|
+
};
|
|
2339
|
+
(r = i.onImageAIEntryClick) == null || r.call(i, n), p("image-ai-entry-click", n);
|
|
2340
|
+
}, _ = async () => {
|
|
2341
|
+
if (!b.value || h) return;
|
|
2329
2342
|
const [
|
|
2330
|
-
{ createApp:
|
|
2331
|
-
{ createPinia:
|
|
2332
|
-
{ default:
|
|
2333
|
-
{ default:
|
|
2334
|
-
|
|
2343
|
+
{ createApp: e },
|
|
2344
|
+
{ createPinia: t },
|
|
2345
|
+
{ default: n },
|
|
2346
|
+
{ default: u },
|
|
2347
|
+
r
|
|
2335
2348
|
] = await Promise.all([
|
|
2336
2349
|
import("vue"),
|
|
2337
2350
|
import("./pinia-CVat9nJz.js"),
|
|
2338
|
-
import("./InnerApp-
|
|
2339
|
-
import("./index-
|
|
2340
|
-
import("./index-
|
|
2351
|
+
import("./InnerApp-BVIJgQPL.js"),
|
|
2352
|
+
import("./index-CGIfpvl8.js"),
|
|
2353
|
+
import("./index-C0mC3XB7.js")
|
|
2341
2354
|
]);
|
|
2342
|
-
if (!
|
|
2343
|
-
|
|
2344
|
-
const
|
|
2345
|
-
|
|
2346
|
-
initData:
|
|
2347
|
-
onUploadFile:
|
|
2348
|
-
readonly:
|
|
2349
|
-
onChange:
|
|
2350
|
-
onSave:
|
|
2351
|
-
onInitFinished:
|
|
2352
|
-
onReturn:
|
|
2353
|
-
theme:
|
|
2354
|
-
}),
|
|
2355
|
-
},
|
|
2356
|
-
|
|
2355
|
+
if (!b.value) return;
|
|
2356
|
+
P = r.useSlidesStore, L = r.useScreenStore, x = r.useMainStore, v = r.useSnapshotStore;
|
|
2357
|
+
const o = document.createElement("div");
|
|
2358
|
+
o.style.width = "100%", o.style.height = "100%", b.value.appendChild(o), h = e(n, {
|
|
2359
|
+
initData: i.initData,
|
|
2360
|
+
onUploadFile: i.onUploadFile,
|
|
2361
|
+
readonly: i.readonly,
|
|
2362
|
+
onChange: i.onChange,
|
|
2363
|
+
onSave: i.onSave,
|
|
2364
|
+
onInitFinished: i.onInitFinished,
|
|
2365
|
+
onReturn: i.onReturn,
|
|
2366
|
+
theme: R.value
|
|
2367
|
+
}), g = t(), h.use(g), h.provide(M, { locale: F }), h.provide("__lt_ppt_theme__", R), h.provide("__lt_ppt_image_ai_entry_enabled__", W), h.config.globalProperties.$t = de(F), h.use(u), h.mount(o);
|
|
2368
|
+
}, J = () => {
|
|
2369
|
+
h && (h.unmount(), h = null, g = null), b.value && (b.value.innerHTML = "");
|
|
2357
2370
|
};
|
|
2358
|
-
|
|
2359
|
-
|
|
2360
|
-
}),
|
|
2361
|
-
|
|
2362
|
-
}),
|
|
2363
|
-
|
|
2364
|
-
}),
|
|
2365
|
-
|
|
2371
|
+
ee(() => {
|
|
2372
|
+
A = _();
|
|
2373
|
+
}), te(() => {
|
|
2374
|
+
J();
|
|
2375
|
+
}), N(() => i.locale, (e) => {
|
|
2376
|
+
F.value = e ?? "zh-CN";
|
|
2377
|
+
}), N(() => i.theme, (e) => {
|
|
2378
|
+
R.value = e ?? "dark";
|
|
2366
2379
|
});
|
|
2367
|
-
const
|
|
2368
|
-
|
|
2380
|
+
const w = () => !g || !P ? null : P(g), O = () => !g || !x ? null : x(g), Y = () => !g || !v ? null : v(g), B = async () => (!g && A && await A, !!g), D = (e) => new Promise((t) => {
|
|
2381
|
+
if (typeof Image > "u") {
|
|
2382
|
+
t(null);
|
|
2383
|
+
return;
|
|
2384
|
+
}
|
|
2385
|
+
const n = new Image();
|
|
2386
|
+
n.decoding = "sync", n.onload = async () => {
|
|
2387
|
+
var u;
|
|
2388
|
+
try {
|
|
2389
|
+
await ((u = n.decode) == null ? void 0 : u.call(n));
|
|
2390
|
+
} catch {
|
|
2391
|
+
}
|
|
2392
|
+
t({
|
|
2393
|
+
width: n.naturalWidth || n.width,
|
|
2394
|
+
height: n.naturalHeight || n.height
|
|
2395
|
+
});
|
|
2396
|
+
}, n.onerror = () => t(null), n.src = e;
|
|
2397
|
+
}), I = (e, t) => Number.isFinite(e) && e > 0 ? e : t, E = (e, t) => t.slideId ? e.slides.findIndex((n) => n.id === t.slideId) : t.slideIndex !== void 0 ? Number.isInteger(t.slideIndex) && t.slideIndex >= 0 && t.slideIndex < e.slides.length ? t.slideIndex : -1 : e.slideIndex, Z = async (e, t, n, u, r = { width: 300, height: 200 }) => {
|
|
2398
|
+
const o = await D(e);
|
|
2399
|
+
let l = I(t.width, (o == null ? void 0 : o.width) || r.width), m = I(t.height, (o == null ? void 0 : o.height) || r.height);
|
|
2400
|
+
if (t.width !== void 0 && t.height === void 0 && (o != null && o.width) && o.height)
|
|
2401
|
+
m = l * o.height / o.width;
|
|
2402
|
+
else if (t.height !== void 0 && t.width === void 0 && (o != null && o.width) && o.height)
|
|
2403
|
+
l = m * o.width / o.height;
|
|
2404
|
+
else if (t.width === void 0 && t.height === void 0 && (o != null && o.width) && o.height) {
|
|
2405
|
+
const C = Math.min(1, n / o.width, u / o.height);
|
|
2406
|
+
l = o.width * C, m = o.height * C;
|
|
2407
|
+
}
|
|
2408
|
+
return { width: l, height: m };
|
|
2409
|
+
}, z = async () => {
|
|
2410
|
+
const e = Y();
|
|
2411
|
+
e && await e.addSnapshot();
|
|
2412
|
+
}, q = async (e) => {
|
|
2413
|
+
if (!e.src || !await B()) return null;
|
|
2414
|
+
const t = w(), n = O();
|
|
2415
|
+
if (!t || !n || !t.slides.length) return null;
|
|
2416
|
+
const u = E(t, e);
|
|
2417
|
+
if (u === -1) return null;
|
|
2418
|
+
t.slideIndex !== u && t.updateSlideIndex(u);
|
|
2419
|
+
const r = t.viewportSize, o = t.viewportSize * t.viewportRatio, { width: l, height: m } = await Z(e.src, e, r, o), { nanoid: C } = await import("./index.browser-Wq18ov6h.js"), a = {
|
|
2420
|
+
type: "image",
|
|
2421
|
+
id: C(10),
|
|
2422
|
+
src: e.src,
|
|
2423
|
+
width: l,
|
|
2424
|
+
height: m,
|
|
2425
|
+
left: e.left ?? (r - l) / 2,
|
|
2426
|
+
top: e.top ?? (o - m) / 2,
|
|
2427
|
+
fixedRatio: e.fixedRatio ?? !0,
|
|
2428
|
+
rotate: e.rotate ?? 0
|
|
2429
|
+
};
|
|
2430
|
+
return t.addElement(a), e.select !== !1 && n.setActiveElementIdList([a.id]), await z(), JSON.parse(JSON.stringify(a));
|
|
2431
|
+
}, j = (e, t, n) => {
|
|
2432
|
+
var m, C;
|
|
2433
|
+
const u = !!n.slideId || n.slideIndex !== void 0, r = E(e, n), o = n.elementId || (t.activeElementIdList.length === 1 ? t.activeElementIdList[0] : t.handleElementId);
|
|
2434
|
+
if (!o) return null;
|
|
2435
|
+
if (u || !n.elementId) {
|
|
2436
|
+
if (r === -1) return null;
|
|
2437
|
+
const a = (m = e.slides[r]) == null ? void 0 : m.elements.find((f) => f.id === o);
|
|
2438
|
+
return (a == null ? void 0 : a.type) === "image" ? { slideIndex: r, element: a } : null;
|
|
2439
|
+
}
|
|
2440
|
+
const l = (C = e.slides[e.slideIndex]) == null ? void 0 : C.elements.find((a) => a.id === o);
|
|
2441
|
+
if ((l == null ? void 0 : l.type) === "image") return { slideIndex: e.slideIndex, element: l };
|
|
2442
|
+
for (let a = 0; a < e.slides.length; a++) {
|
|
2443
|
+
const f = e.slides[a].elements.find((k) => k.id === o);
|
|
2444
|
+
if ((f == null ? void 0 : f.type) === "image") return { slideIndex: a, element: f };
|
|
2445
|
+
}
|
|
2446
|
+
return null;
|
|
2447
|
+
};
|
|
2448
|
+
return c({
|
|
2369
2449
|
getSlides: () => {
|
|
2370
|
-
const
|
|
2371
|
-
return
|
|
2450
|
+
const e = w();
|
|
2451
|
+
return e ? JSON.parse(JSON.stringify(e.slides)) : [];
|
|
2452
|
+
},
|
|
2453
|
+
getSelectedElements: () => {
|
|
2454
|
+
const e = O();
|
|
2455
|
+
return e ? JSON.parse(JSON.stringify(e.activeElementList)) : [];
|
|
2372
2456
|
},
|
|
2373
|
-
setSlides: (
|
|
2374
|
-
const
|
|
2375
|
-
|
|
2457
|
+
setSlides: (e) => {
|
|
2458
|
+
const t = w();
|
|
2459
|
+
t && t.setSlides(e);
|
|
2376
2460
|
},
|
|
2377
2461
|
startScreening: () => {
|
|
2378
|
-
if (!
|
|
2379
|
-
|
|
2462
|
+
if (!g || !L) return;
|
|
2463
|
+
L(g).setScreening(!0);
|
|
2380
2464
|
},
|
|
2381
2465
|
getCurrentIndex: () => {
|
|
2382
|
-
const
|
|
2383
|
-
return
|
|
2466
|
+
const e = w();
|
|
2467
|
+
return e ? e.slideIndex : 0;
|
|
2468
|
+
},
|
|
2469
|
+
insertImage: q,
|
|
2470
|
+
replaceImage: async (e) => {
|
|
2471
|
+
if (!e.src || !await B()) return null;
|
|
2472
|
+
const t = w(), n = O();
|
|
2473
|
+
if (!t || !n || !t.slides.length) return null;
|
|
2474
|
+
const u = j(t, n, e);
|
|
2475
|
+
if (!u) return null;
|
|
2476
|
+
const { slideIndex: r, element: o } = u, l = { src: e.src };
|
|
2477
|
+
if (e.fixedRatio !== void 0 && (l.fixedRatio = e.fixedRatio), e.resetClip && (l.clip = void 0), !(e.keepSize === !0 && e.width === void 0 && e.height === void 0)) {
|
|
2478
|
+
const a = await D(e.src), f = I(e.width, o.width);
|
|
2479
|
+
let k = I(e.height, o.height);
|
|
2480
|
+
e.height === void 0 && (a != null && a.width) && a.height && (k = f * a.height / a.width), l.width = f, l.height = k, l.left = o.left, l.top = o.top, l.clip = void 0;
|
|
2481
|
+
}
|
|
2482
|
+
const C = t.slides[r].id;
|
|
2483
|
+
return t.updateElement({ id: o.id, props: l, slideId: C }), t.slideIndex !== r && t.updateSlideIndex(r), e.select !== !1 && n.setActiveElementIdList([o.id]), await z(), JSON.parse(JSON.stringify({ ...o, ...l }));
|
|
2384
2484
|
}
|
|
2385
|
-
}), (
|
|
2485
|
+
}), (e, t) => (oe(), ie("div", {
|
|
2386
2486
|
ref_key: "containerRef",
|
|
2387
|
-
ref:
|
|
2487
|
+
ref: b,
|
|
2388
2488
|
class: "lt-ppt-container",
|
|
2389
|
-
style:
|
|
2390
|
-
|
|
2489
|
+
style: ne(G.value),
|
|
2490
|
+
onImageAiEntryClick: X
|
|
2491
|
+
}, null, 36));
|
|
2391
2492
|
}
|
|
2392
|
-
}),
|
|
2393
|
-
const
|
|
2394
|
-
for (const [
|
|
2395
|
-
|
|
2396
|
-
return
|
|
2397
|
-
},
|
|
2493
|
+
}), ce = (d, c) => {
|
|
2494
|
+
const s = d.__vccOpts || d;
|
|
2495
|
+
for (const [i, p] of c)
|
|
2496
|
+
s[i] = p;
|
|
2497
|
+
return s;
|
|
2498
|
+
}, Se = /* @__PURE__ */ ce(se, [["__scopeId", "data-v-6903105f"]]), ue = [
|
|
2398
2499
|
"SourceHanSans",
|
|
2399
2500
|
"SourceHanSerif",
|
|
2400
2501
|
"WenDingPLSongTi",
|
|
@@ -2423,18 +2524,18 @@ const U = /* @__PURE__ */ I({
|
|
|
2423
2524
|
"Montserrat",
|
|
2424
2525
|
"SourceSansPro",
|
|
2425
2526
|
"Merriweather"
|
|
2426
|
-
],
|
|
2527
|
+
], Ce = (d = "/fonts") => {
|
|
2427
2528
|
if (typeof document > "u" || !document.head) return;
|
|
2428
|
-
const
|
|
2429
|
-
|
|
2430
|
-
(
|
|
2529
|
+
const c = d.replace(/\/$/, ""), s = document.createElement("style");
|
|
2530
|
+
s.textContent = ue.map(
|
|
2531
|
+
(i) => `@font-face { font-display: swap; font-family: ${i}; src: url('${c}/${i}.woff2') format('woff2'); }`
|
|
2431
2532
|
).join(`
|
|
2432
|
-
`), document.head.appendChild(
|
|
2533
|
+
`), document.head.appendChild(s);
|
|
2433
2534
|
};
|
|
2434
2535
|
export {
|
|
2435
|
-
|
|
2436
|
-
|
|
2437
|
-
|
|
2438
|
-
|
|
2439
|
-
|
|
2536
|
+
Se as L,
|
|
2537
|
+
ce as _,
|
|
2538
|
+
me as c,
|
|
2539
|
+
Ce as l,
|
|
2540
|
+
he as u
|
|
2440
2541
|
};
|