lt-ppt 1.0.45 → 1.0.47

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.
@@ -1,5 +1,5 @@
1
1
  import { defineStore as d } from "./pinia-CVat9nJz.js";
2
- import { a as r, u as S, d as a } from "./database-DjICjHkl.js";
2
+ import { a as r, u as S, d as a } from "./database-DXLrpgFP.js";
3
3
  const u = d("snapshot", {
4
4
  state: () => ({
5
5
  snapshotCursor: -1,
@@ -1,4 +1,4 @@
1
- import { ImageAIEntryClickParams, InsertImageParams, InsertVideoParams, LtPPTProps, LtPPTMode, ReplaceImageParams, ReplaceVideoParams, SupportedLocale, ThemeMode } from './types/lt-ppt';
1
+ import { ImageAIEntryClickParams, InsertImageFromDragParams, InsertImageParams, InsertVideoParams, LtPPTProps, LtPPTMode, ReplaceImageParams, ReplaceVideoParams, SupportedLocale, ThemeMode } from './types/lt-ppt';
2
2
  import { PPTElement, PPTImageElement, PPTVideoElement, Slide } from './types/slides';
3
3
  declare const _default: import('vue').DefineComponent<LtPPTProps, {
4
4
  getSlides: () => Slide[];
@@ -12,6 +12,7 @@ declare const _default: import('vue').DefineComponent<LtPPTProps, {
12
12
  generateDeafultPPT: () => Promise<File>;
13
13
  setMode: (mode: LtPPTMode) => void;
14
14
  insertImage: (params: InsertImageParams) => Promise<PPTImageElement | null>;
15
+ insertImageFromDrag: (params: InsertImageFromDragParams) => Promise<PPTImageElement | null>;
15
16
  replaceImage: (params: ReplaceImageParams) => Promise<PPTImageElement | null>;
16
17
  insertVideo: (params: InsertVideoParams) => Promise<PPTVideoElement | null>;
17
18
  replaceVideo: (params: ReplaceVideoParams) => Promise<PPTVideoElement | null>;
@@ -1,5 +1,5 @@
1
1
  import { default as LtPPT } from './LtPPT.vue';
2
2
  export { LtPPT };
3
- export type { LtPPTProps, LtPPTInstance, LtPPTMode, InitData, UploadFileParams, CustomImageSource, SaveCallbackParams, ImageAIEntryElement, ImageAIEntryClickParams, InsertImageParams, ReplaceImageParams, InsertVideoParams, ReplaceVideoParams, SupportedLocale, ThemeMode } from './types/lt-ppt';
3
+ export type { LtPPTProps, LtPPTInstance, LtPPTMode, InitData, UploadFileParams, CustomImageSource, SaveCallbackParams, ImageAIEntryElement, ImageAIEntryClickParams, InsertImageParams, InsertImageFromDragParams, ReplaceImageParams, InsertVideoParams, ReplaceVideoParams, SupportedLocale, ThemeMode } from './types/lt-ppt';
4
4
  export type { Slide, PPTElement, PPTImageElement, PPTVideoElement, SlideTheme } from './types/slides';
5
5
  export { loadFonts } from './utils/fonts';
@@ -1607,7 +1607,7 @@ export declare const useSlidesStore: import('pinia').StoreDefinition<"slides", S
1607
1607
  removeSlideProps(data: RemovePropData): void;
1608
1608
  deleteSlide(slideId: string | string[]): void;
1609
1609
  updateSlideIndex(index: number): void;
1610
- addElement(element: PPTElement | PPTElement[]): void;
1610
+ addElement(element: PPTElement | PPTElement[], slideId?: string): void;
1611
1611
  deleteElement(elementId: string | string[]): void;
1612
1612
  updateElement(data: UpdateElementData): void;
1613
1613
  removeElementProps(data: RemovePropData): void;
@@ -60,6 +60,22 @@ export interface InsertImageParams {
60
60
  /** 插入后是否选中该图片,默认 true */
61
61
  select?: boolean;
62
62
  }
63
+ export interface InsertImageFromDragParams {
64
+ /** 图片地址,支持 URL、base64 dataURL、blob URL */
65
+ src: string;
66
+ /** 鼠标释放点的浏览器视口横坐标,可直接传入 DragEvent.clientX */
67
+ clientX: number;
68
+ /** 鼠标释放点的浏览器视口纵坐标,可直接传入 DragEvent.clientY */
69
+ clientY: number;
70
+ /** 图片宽度占 PPT 画布宽度的比例,必须为有限正数,默认 0.2 */
71
+ widthRatio?: number;
72
+ /** 是否锁定宽高比例,默认 true */
73
+ fixedRatio?: boolean;
74
+ /** 旋转角度,默认 0 */
75
+ rotate?: number;
76
+ /** 插入后是否选中该图片,默认 true */
77
+ select?: boolean;
78
+ }
63
79
  export interface ReplaceImageParams {
64
80
  /** 新图片地址,支持 URL、base64 dataURL、blob URL */
65
81
  src: string;
@@ -187,6 +203,8 @@ export interface LtPPTInstance {
187
203
  setMode: (mode: LtPPTMode) => void;
188
204
  /** 向指定页面插入图片 */
189
205
  insertImage: (params: InsertImageParams) => Promise<PPTImageElement | null>;
206
+ /** 在当前页面以拖拽释放点为中心插入图片 */
207
+ insertImageFromDrag: (params: InsertImageFromDragParams) => Promise<PPTImageElement | null>;
190
208
  /** 替换指定图片元素,未指定元素时替换当前选中图片 */
191
209
  replaceImage: (params: ReplaceImageParams) => Promise<PPTImageElement | null>;
192
210
  /** 向指定页面插入视频 */
@@ -3,8 +3,8 @@ var iA = (e, r, t) => r in e ? aA(e, r, { enumerable: !0, configurable: !0, writ
3
3
  var ft = (e, r, t) => iA(e, typeof r != "symbol" ? r + "" : r, t);
4
4
  import { markRaw as ma, openBlock as nt, createElementBlock as gt, createElementVNode as Re, defineComponent as vi, ref as vl, onBeforeMount as oA, onMounted as sA, createBlock as Yr, Transition as lA, withCtx as cA, createCommentVNode as Lr, toDisplayString as q0, createVNode as po, render as ra, normalizeStyle as na, computed as Tt, Fragment as X0, renderList as j0, unref as Xr, normalizeClass as fA } from "vue";
5
5
  import { storeToRefs as Bu } from "./pinia-CVat9nJz.js";
6
- import { g as $l, a as Be, b as uA, _ as e0, l as gl } from "./lib-Bh4ZtdLc.js";
7
- import { a as Du } from "./database-DjICjHkl.js";
6
+ import { g as $l, a as Be, b as uA, _ as e0, l as gl } from "./lib-CGw0UBt0.js";
7
+ import { a as Du } from "./database-DXLrpgFP.js";
8
8
  import { nanoid as xl } from "./index.browser-Wq18ov6h.js";
9
9
  function Ia(e) {
10
10
  throw new Error('Could not dynamically require "' + e + '". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lt-ppt",
3
- "version": "1.0.45",
3
+ "version": "1.0.47",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "main": "./dist/lt-ppt.umd.js",