lt-ppt 1.0.26 → 1.0.28
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-D8mU98_u.js → InnerApp-BkVsQnm2.js} +9113 -9077
- package/dist/{index-CQot7iN3.js → index-e8Js74-o.js} +1 -1
- package/dist/{index-D5u0ETgN.js → index-vmpIx8K7.js} +1 -1
- package/dist/index.browser-Wq18ov6h.js +24 -0
- package/dist/{lib-B0z78_t3.js → lib-9k4fJaGf.js} +191 -98
- package/dist/lt-ppt.css +1 -1
- package/dist/lt-ppt.es.js +1 -1
- package/dist/lt-ppt.umd.js +128 -128
- package/dist/{screen-CacUF2YF.js → screen-Brvtzttu.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-9k4fJaGf.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 Y, ref as w, defineComponent as Z, computed as q, onMounted as j, onBeforeUnmount as Q, watch as z, openBlock as K, createElementBlock as $, normalizeStyle as ee } from "vue";
|
|
2
|
+
const te = {
|
|
3
3
|
common: {
|
|
4
4
|
close: "关闭",
|
|
5
5
|
cancel: "取消",
|
|
@@ -1148,7 +1148,7 @@ const B = {
|
|
|
1148
1148
|
latex: "公式"
|
|
1149
1149
|
}
|
|
1150
1150
|
}
|
|
1151
|
-
},
|
|
1151
|
+
}, oe = {
|
|
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
|
+
}, U = Symbol("lt-ppt-i18n"), ie = { "zh-CN": te, en: oe };
|
|
2273
|
+
function N(d, c = "") {
|
|
2274
|
+
return Object.entries(d).reduce((s, [i, u]) => {
|
|
2275
|
+
const h = c ? `${c}.${i}` : i;
|
|
2276
|
+
return u && typeof u == "object" && !Array.isArray(u) ? Object.assign(s, N(u, h)) : s[h] = String(u), s;
|
|
2277
2277
|
}, {});
|
|
2278
2278
|
}
|
|
2279
|
-
const
|
|
2280
|
-
Object.entries(
|
|
2279
|
+
const b = Object.fromEntries(
|
|
2280
|
+
Object.entries(ie).map(([d, c]) => [d, N(c)])
|
|
2281
2281
|
);
|
|
2282
|
-
function
|
|
2283
|
-
const
|
|
2284
|
-
return { t: (
|
|
2285
|
-
var
|
|
2286
|
-
return ((
|
|
2287
|
-
}, locale:
|
|
2282
|
+
function ce() {
|
|
2283
|
+
const d = Y(U, { locale: w("zh-CN") });
|
|
2284
|
+
return { t: (s) => {
|
|
2285
|
+
var i, u;
|
|
2286
|
+
return ((i = b[d.locale.value]) == null ? void 0 : i[s]) ?? ((u = b["zh-CN"]) == null ? void 0 : u[s]) ?? s;
|
|
2287
|
+
}, locale: d.locale };
|
|
2288
2288
|
}
|
|
2289
|
-
function
|
|
2290
|
-
return (
|
|
2291
|
-
var
|
|
2292
|
-
return ((
|
|
2289
|
+
function ne(d) {
|
|
2290
|
+
return (c) => {
|
|
2291
|
+
var s, i;
|
|
2292
|
+
return ((s = b[d.value]) == null ? void 0 : s[c]) ?? ((i = b["zh-CN"]) == null ? void 0 : i[c]) ?? c;
|
|
2293
2293
|
};
|
|
2294
2294
|
}
|
|
2295
|
-
function
|
|
2296
|
-
const
|
|
2295
|
+
function ue(d) {
|
|
2296
|
+
const c = w((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 u, h;
|
|
2302
|
+
return ((u = b[c.value]) == null ? void 0 : u[i]) ?? ((h = b["zh-CN"]) == null ? void 0 : h[i]) ?? i;
|
|
2303
2303
|
} }
|
|
2304
2304
|
};
|
|
2305
2305
|
}
|
|
2306
|
-
const
|
|
2306
|
+
const le = /* @__PURE__ */ Z({
|
|
2307
2307
|
__name: "LtPPT",
|
|
2308
2308
|
props: {
|
|
2309
2309
|
initData: {},
|
|
@@ -2316,85 +2316,178 @@ 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, u = s, h = w();
|
|
2325
|
+
let m = null, g = null, k = null, P = null, L = null, x = null, F = null;
|
|
2326
|
+
const v = w(i.locale ?? "zh-CN"), A = w(i.theme ?? "dark"), M = q(() => ({
|
|
2327
|
+
width: i.width,
|
|
2328
|
+
height: i.height
|
|
2329
|
+
})), H = (e) => {
|
|
2330
|
+
var p, r;
|
|
2331
|
+
const t = (p = e.detail) == null ? void 0 : p.element;
|
|
2332
|
+
if (!t || t.type !== "image") return;
|
|
2333
|
+
const n = {
|
|
2334
|
+
element: JSON.parse(JSON.stringify(t))
|
|
2335
|
+
};
|
|
2336
|
+
(r = i.onImageAIEntryClick) == null || r.call(i, n), u("image-ai-entry-click", n);
|
|
2337
|
+
}, G = async () => {
|
|
2338
|
+
if (!h.value || m) return;
|
|
2329
2339
|
const [
|
|
2330
|
-
{ createApp:
|
|
2331
|
-
{ createPinia:
|
|
2332
|
-
{ default:
|
|
2333
|
-
{ default:
|
|
2334
|
-
|
|
2340
|
+
{ createApp: e },
|
|
2341
|
+
{ createPinia: t },
|
|
2342
|
+
{ default: n },
|
|
2343
|
+
{ default: p },
|
|
2344
|
+
r
|
|
2335
2345
|
] = await Promise.all([
|
|
2336
2346
|
import("vue"),
|
|
2337
2347
|
import("./pinia-CVat9nJz.js"),
|
|
2338
|
-
import("./InnerApp-
|
|
2339
|
-
import("./index-
|
|
2340
|
-
import("./index-
|
|
2348
|
+
import("./InnerApp-BkVsQnm2.js"),
|
|
2349
|
+
import("./index-e8Js74-o.js"),
|
|
2350
|
+
import("./index-vmpIx8K7.js")
|
|
2341
2351
|
]);
|
|
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
|
-
|
|
2352
|
+
if (!h.value) return;
|
|
2353
|
+
k = r.useSlidesStore, P = r.useScreenStore, L = r.useMainStore, x = r.useSnapshotStore;
|
|
2354
|
+
const o = document.createElement("div");
|
|
2355
|
+
o.style.width = "100%", o.style.height = "100%", h.value.appendChild(o), m = e(n, {
|
|
2356
|
+
initData: i.initData,
|
|
2357
|
+
onUploadFile: i.onUploadFile,
|
|
2358
|
+
readonly: i.readonly,
|
|
2359
|
+
onChange: i.onChange,
|
|
2360
|
+
onSave: i.onSave,
|
|
2361
|
+
onInitFinished: i.onInitFinished,
|
|
2362
|
+
onReturn: i.onReturn,
|
|
2363
|
+
theme: A.value
|
|
2364
|
+
}), g = t(), m.use(g), m.provide(U, { locale: v }), m.provide("__lt_ppt_theme__", A), m.config.globalProperties.$t = ne(v), m.use(p), m.mount(o);
|
|
2365
|
+
}, V = () => {
|
|
2366
|
+
m && (m.unmount(), m = null, g = null), h.value && (h.value.innerHTML = "");
|
|
2357
2367
|
};
|
|
2358
|
-
|
|
2359
|
-
|
|
2360
|
-
}),
|
|
2361
|
-
|
|
2362
|
-
}),
|
|
2363
|
-
|
|
2364
|
-
}),
|
|
2365
|
-
|
|
2368
|
+
j(() => {
|
|
2369
|
+
F = G();
|
|
2370
|
+
}), Q(() => {
|
|
2371
|
+
V();
|
|
2372
|
+
}), z(() => i.locale, (e) => {
|
|
2373
|
+
v.value = e ?? "zh-CN";
|
|
2374
|
+
}), z(() => i.theme, (e) => {
|
|
2375
|
+
A.value = e ?? "dark";
|
|
2366
2376
|
});
|
|
2367
|
-
const
|
|
2368
|
-
|
|
2377
|
+
const T = () => !g || !k ? null : k(g), R = () => !g || !L ? null : L(g), W = () => !g || !x ? null : x(g), O = async () => (!g && F && await F, !!g), B = (e) => new Promise((t) => {
|
|
2378
|
+
if (typeof Image > "u") {
|
|
2379
|
+
t(null);
|
|
2380
|
+
return;
|
|
2381
|
+
}
|
|
2382
|
+
const n = new Image();
|
|
2383
|
+
n.onload = () => {
|
|
2384
|
+
t({
|
|
2385
|
+
width: n.naturalWidth || n.width,
|
|
2386
|
+
height: n.naturalHeight || n.height
|
|
2387
|
+
});
|
|
2388
|
+
}, n.onerror = () => t(null), n.src = e;
|
|
2389
|
+
}), y = (e, t) => Number.isFinite(e) && e > 0 ? e : t, D = (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, X = async (e, t, n, p, r = { width: 300, height: 200 }) => {
|
|
2390
|
+
const o = await B(e);
|
|
2391
|
+
let l = y(t.width, (o == null ? void 0 : o.width) || r.width), S = y(t.height, (o == null ? void 0 : o.height) || r.height);
|
|
2392
|
+
if (t.width !== void 0 && t.height === void 0 && (o != null && o.width) && o.height)
|
|
2393
|
+
S = l * o.height / o.width;
|
|
2394
|
+
else if (t.height !== void 0 && t.width === void 0 && (o != null && o.width) && o.height)
|
|
2395
|
+
l = S * o.width / o.height;
|
|
2396
|
+
else if (t.width === void 0 && t.height === void 0 && (o != null && o.width) && o.height) {
|
|
2397
|
+
const C = Math.min(1, n / o.width, p / o.height);
|
|
2398
|
+
l = o.width * C, S = o.height * C;
|
|
2399
|
+
}
|
|
2400
|
+
return { width: l, height: S };
|
|
2401
|
+
}, E = async () => {
|
|
2402
|
+
const e = W();
|
|
2403
|
+
e && await e.addSnapshot();
|
|
2404
|
+
}, J = async (e) => {
|
|
2405
|
+
if (!e.src || !await O()) return null;
|
|
2406
|
+
const t = T(), n = R();
|
|
2407
|
+
if (!t || !n || !t.slides.length) return null;
|
|
2408
|
+
const p = D(t, e);
|
|
2409
|
+
if (p === -1) return null;
|
|
2410
|
+
t.slideIndex !== p && t.updateSlideIndex(p);
|
|
2411
|
+
const r = t.viewportSize, o = t.viewportSize * t.viewportRatio, { width: l, height: S } = await X(e.src, e, r, o), { nanoid: C } = await import("./index.browser-Wq18ov6h.js"), a = {
|
|
2412
|
+
type: "image",
|
|
2413
|
+
id: C(10),
|
|
2414
|
+
src: e.src,
|
|
2415
|
+
width: l,
|
|
2416
|
+
height: S,
|
|
2417
|
+
left: e.left ?? (r - l) / 2,
|
|
2418
|
+
top: e.top ?? (o - S) / 2,
|
|
2419
|
+
fixedRatio: e.fixedRatio ?? !0,
|
|
2420
|
+
rotate: e.rotate ?? 0
|
|
2421
|
+
};
|
|
2422
|
+
return t.addElement(a), e.select !== !1 && n.setActiveElementIdList([a.id]), await E(), JSON.parse(JSON.stringify(a));
|
|
2423
|
+
}, _ = (e, t, n) => {
|
|
2424
|
+
var S, C;
|
|
2425
|
+
const p = !!n.slideId || n.slideIndex !== void 0, r = D(e, n), o = n.elementId || (t.activeElementIdList.length === 1 ? t.activeElementIdList[0] : t.handleElementId);
|
|
2426
|
+
if (!o) return null;
|
|
2427
|
+
if (p || !n.elementId) {
|
|
2428
|
+
if (r === -1) return null;
|
|
2429
|
+
const a = (S = e.slides[r]) == null ? void 0 : S.elements.find((f) => f.id === o);
|
|
2430
|
+
return (a == null ? void 0 : a.type) === "image" ? { slideIndex: r, element: a } : null;
|
|
2431
|
+
}
|
|
2432
|
+
const l = (C = e.slides[e.slideIndex]) == null ? void 0 : C.elements.find((a) => a.id === o);
|
|
2433
|
+
if ((l == null ? void 0 : l.type) === "image") return { slideIndex: e.slideIndex, element: l };
|
|
2434
|
+
for (let a = 0; a < e.slides.length; a++) {
|
|
2435
|
+
const f = e.slides[a].elements.find((I) => I.id === o);
|
|
2436
|
+
if ((f == null ? void 0 : f.type) === "image") return { slideIndex: a, element: f };
|
|
2437
|
+
}
|
|
2438
|
+
return null;
|
|
2439
|
+
};
|
|
2440
|
+
return c({
|
|
2369
2441
|
getSlides: () => {
|
|
2370
|
-
const
|
|
2371
|
-
return
|
|
2442
|
+
const e = T();
|
|
2443
|
+
return e ? JSON.parse(JSON.stringify(e.slides)) : [];
|
|
2444
|
+
},
|
|
2445
|
+
getSelectedElements: () => {
|
|
2446
|
+
const e = R();
|
|
2447
|
+
return e ? JSON.parse(JSON.stringify(e.activeElementList)) : [];
|
|
2372
2448
|
},
|
|
2373
|
-
setSlides: (
|
|
2374
|
-
const
|
|
2375
|
-
|
|
2449
|
+
setSlides: (e) => {
|
|
2450
|
+
const t = T();
|
|
2451
|
+
t && t.setSlides(e);
|
|
2376
2452
|
},
|
|
2377
2453
|
startScreening: () => {
|
|
2378
|
-
if (!
|
|
2379
|
-
|
|
2454
|
+
if (!g || !P) return;
|
|
2455
|
+
P(g).setScreening(!0);
|
|
2380
2456
|
},
|
|
2381
2457
|
getCurrentIndex: () => {
|
|
2382
|
-
const
|
|
2383
|
-
return
|
|
2458
|
+
const e = T();
|
|
2459
|
+
return e ? e.slideIndex : 0;
|
|
2460
|
+
},
|
|
2461
|
+
insertImage: J,
|
|
2462
|
+
replaceImage: async (e) => {
|
|
2463
|
+
if (!e.src || !await O()) return null;
|
|
2464
|
+
const t = T(), n = R();
|
|
2465
|
+
if (!t || !n || !t.slides.length) return null;
|
|
2466
|
+
const p = _(t, n, e);
|
|
2467
|
+
if (!p) return null;
|
|
2468
|
+
const { slideIndex: r, element: o } = p, l = { src: e.src };
|
|
2469
|
+
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)) {
|
|
2470
|
+
const a = await B(e.src), f = y(e.width, o.width);
|
|
2471
|
+
let I = y(e.height, o.height);
|
|
2472
|
+
e.height === void 0 && (a != null && a.width) && a.height && (I = f * a.height / a.width), l.width = f, l.height = I, l.left = o.left, l.top = o.top, l.clip = void 0;
|
|
2473
|
+
}
|
|
2474
|
+
const C = t.slides[r].id;
|
|
2475
|
+
return t.updateElement({ id: o.id, props: l, slideId: C }), t.slideIndex !== r && t.updateSlideIndex(r), e.select !== !1 && n.setActiveElementIdList([o.id]), await E(), JSON.parse(JSON.stringify({ ...o, ...l }));
|
|
2384
2476
|
}
|
|
2385
|
-
}), (
|
|
2477
|
+
}), (e, t) => (K(), $("div", {
|
|
2386
2478
|
ref_key: "containerRef",
|
|
2387
|
-
ref:
|
|
2479
|
+
ref: h,
|
|
2388
2480
|
class: "lt-ppt-container",
|
|
2389
|
-
style:
|
|
2390
|
-
|
|
2481
|
+
style: ee(M.value),
|
|
2482
|
+
onImageAiEntryClick: H
|
|
2483
|
+
}, null, 36));
|
|
2391
2484
|
}
|
|
2392
|
-
}),
|
|
2393
|
-
const
|
|
2394
|
-
for (const [
|
|
2395
|
-
|
|
2396
|
-
return
|
|
2397
|
-
},
|
|
2485
|
+
}), ae = (d, c) => {
|
|
2486
|
+
const s = d.__vccOpts || d;
|
|
2487
|
+
for (const [i, u] of c)
|
|
2488
|
+
s[i] = u;
|
|
2489
|
+
return s;
|
|
2490
|
+
}, pe = /* @__PURE__ */ ae(le, [["__scopeId", "data-v-aa99033b"]]), re = [
|
|
2398
2491
|
"SourceHanSans",
|
|
2399
2492
|
"SourceHanSerif",
|
|
2400
2493
|
"WenDingPLSongTi",
|
|
@@ -2423,18 +2516,18 @@ const U = /* @__PURE__ */ I({
|
|
|
2423
2516
|
"Montserrat",
|
|
2424
2517
|
"SourceSansPro",
|
|
2425
2518
|
"Merriweather"
|
|
2426
|
-
],
|
|
2519
|
+
], ge = (d = "/fonts") => {
|
|
2427
2520
|
if (typeof document > "u" || !document.head) return;
|
|
2428
|
-
const
|
|
2429
|
-
|
|
2430
|
-
(
|
|
2521
|
+
const c = d.replace(/\/$/, ""), s = document.createElement("style");
|
|
2522
|
+
s.textContent = re.map(
|
|
2523
|
+
(i) => `@font-face { font-display: swap; font-family: ${i}; src: url('${c}/${i}.woff2') format('woff2'); }`
|
|
2431
2524
|
).join(`
|
|
2432
|
-
`), document.head.appendChild(
|
|
2525
|
+
`), document.head.appendChild(s);
|
|
2433
2526
|
};
|
|
2434
2527
|
export {
|
|
2435
|
-
|
|
2436
|
-
|
|
2437
|
-
|
|
2438
|
-
|
|
2439
|
-
|
|
2528
|
+
pe as L,
|
|
2529
|
+
ae as _,
|
|
2530
|
+
ue as c,
|
|
2531
|
+
ge as l,
|
|
2532
|
+
ce as u
|
|
2440
2533
|
};
|