@dajiaoai/algeo-sdk 2.13.2 → 2.13.4
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/README.md +16 -1
- package/dist/algeo-sdk.cjs.js +4 -1
- package/dist/algeo-sdk.esm.js +4 -1
- package/dist/algeo-sdk.umd.js +4 -1
- package/dist/index.d.ts +1 -1
- package/dist/shared.d.ts +13 -5
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -570,6 +570,7 @@ interface FileContent {
|
|
|
570
570
|
| `getCount()` | 获取当前已知画板数量 |
|
|
571
571
|
| `getCurrentIndex()` | 获取当前已知画板索引 |
|
|
572
572
|
| `getViewBounds(index?)` | 异步获取指定或当前画板的有限画布导出视野 `{ left, top, right, bottom, scale }`;可直接传给 `exportImage`;无限画布返回 `null` |
|
|
573
|
+
| `setViewBounds(options)` | 设置指定或当前画板的有限画布边界 |
|
|
573
574
|
| `switchTo(index)` | 切换画板 |
|
|
574
575
|
| `add()` | 在末尾新增画板 |
|
|
575
576
|
| `addAt(index)` | 在指定位置新增画板 |
|
|
@@ -579,6 +580,20 @@ interface FileContent {
|
|
|
579
580
|
| `exportImage(options)` | 按 `view` / `contain` / `size` 模式导出 PNG、JPG 或 SVG,返回 `ExportedSlideImage[]` |
|
|
580
581
|
| `exportLatex(options?)` | 将画板导出为 LaTeX/TikZ 源码,返回 `ExportedLatex[]` |
|
|
581
582
|
|
|
583
|
+
##### `editor.slides.setViewBounds(options)`
|
|
584
|
+
|
|
585
|
+
设置有限画布的世界坐标边界。参数与 MCP 保持一致,使用 `left`、`top`、`bottom`、`right`;`index` 省略时设置当前画板。
|
|
586
|
+
|
|
587
|
+
```ts
|
|
588
|
+
await editor.slides.setViewBounds({
|
|
589
|
+
left: -10,
|
|
590
|
+
top: 6,
|
|
591
|
+
bottom: -6,
|
|
592
|
+
right: 10,
|
|
593
|
+
index: 1,
|
|
594
|
+
});
|
|
595
|
+
```
|
|
596
|
+
|
|
582
597
|
##### `editor.slides.exportImage(options)`
|
|
583
598
|
|
|
584
599
|
所有模式均读取文件中的 `camera.scale`;文件未提供时默认为 `50`。`slideIndices` 使用从 `1` 开始的画板索引,省略时导出全部画板。
|
|
@@ -590,7 +605,7 @@ const images = await editor.slides.exportImage({
|
|
|
590
605
|
mode: 'view',
|
|
591
606
|
slideIndices: [1],
|
|
592
607
|
format: 'png',
|
|
593
|
-
viewBound: { left: -5, top:
|
|
608
|
+
viewBound: { left: -5, top: 5, right: 5, bottom: -5, scale: 50 },
|
|
594
609
|
pixelRatio: 2,
|
|
595
610
|
});
|
|
596
611
|
```
|
package/dist/algeo-sdk.cjs.js
CHANGED
|
@@ -4011,7 +4011,7 @@ function convertToLatest(content) {
|
|
|
4011
4011
|
}
|
|
4012
4012
|
|
|
4013
4013
|
/** SDK 版本号,构建时由 rollup 注入 */
|
|
4014
|
-
const VERSION = '2.13.
|
|
4014
|
+
const VERSION = '2.13.4';
|
|
4015
4015
|
const DEFAULT_EMBED_BASE = 'https://dajiaoai.com';
|
|
4016
4016
|
const DEFAULT_PRESENTATION_PATH = '/embed/present';
|
|
4017
4017
|
const DEFAULT_EDITOR_PATH = '/embed/edit';
|
|
@@ -4521,6 +4521,9 @@ class EmbeddedEditor extends EmbeddedTarget {
|
|
|
4521
4521
|
});
|
|
4522
4522
|
return result.viewBounds;
|
|
4523
4523
|
},
|
|
4524
|
+
setViewBounds: async (options) => {
|
|
4525
|
+
await this.post('setViewBounds', { ...options });
|
|
4526
|
+
},
|
|
4524
4527
|
switchTo: async (index) => {
|
|
4525
4528
|
await this.switchTo(index);
|
|
4526
4529
|
},
|
package/dist/algeo-sdk.esm.js
CHANGED
|
@@ -4009,7 +4009,7 @@ function convertToLatest(content) {
|
|
|
4009
4009
|
}
|
|
4010
4010
|
|
|
4011
4011
|
/** SDK 版本号,构建时由 rollup 注入 */
|
|
4012
|
-
const VERSION = '2.13.
|
|
4012
|
+
const VERSION = '2.13.4';
|
|
4013
4013
|
const DEFAULT_EMBED_BASE = 'https://dajiaoai.com';
|
|
4014
4014
|
const DEFAULT_PRESENTATION_PATH = '/embed/present';
|
|
4015
4015
|
const DEFAULT_EDITOR_PATH = '/embed/edit';
|
|
@@ -4519,6 +4519,9 @@ class EmbeddedEditor extends EmbeddedTarget {
|
|
|
4519
4519
|
});
|
|
4520
4520
|
return result.viewBounds;
|
|
4521
4521
|
},
|
|
4522
|
+
setViewBounds: async (options) => {
|
|
4523
|
+
await this.post('setViewBounds', { ...options });
|
|
4524
|
+
},
|
|
4522
4525
|
switchTo: async (index) => {
|
|
4523
4526
|
await this.switchTo(index);
|
|
4524
4527
|
},
|
package/dist/algeo-sdk.umd.js
CHANGED
|
@@ -4015,7 +4015,7 @@
|
|
|
4015
4015
|
}
|
|
4016
4016
|
|
|
4017
4017
|
/** SDK 版本号,构建时由 rollup 注入 */
|
|
4018
|
-
const VERSION = '2.13.
|
|
4018
|
+
const VERSION = '2.13.4';
|
|
4019
4019
|
const DEFAULT_EMBED_BASE = 'https://dajiaoai.com';
|
|
4020
4020
|
const DEFAULT_PRESENTATION_PATH = '/embed/present';
|
|
4021
4021
|
const DEFAULT_EDITOR_PATH = '/embed/edit';
|
|
@@ -4525,6 +4525,9 @@
|
|
|
4525
4525
|
});
|
|
4526
4526
|
return result.viewBounds;
|
|
4527
4527
|
},
|
|
4528
|
+
setViewBounds: async (options) => {
|
|
4529
|
+
await this.post('setViewBounds', { ...options });
|
|
4530
|
+
},
|
|
4528
4531
|
switchTo: async (index) => {
|
|
4529
4532
|
await this.switchTo(index);
|
|
4530
4533
|
},
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export { AlgeoError, EMBED_ERROR_CODES, VERSION } from './shared';
|
|
2
2
|
export type { FileContentLatest } from '@dajiaoai/algeo-protocol';
|
|
3
3
|
export { convertToLatest } from '@dajiaoai/algeo-protocol';
|
|
4
|
-
export type { AiApi, AiCancelEvent, AiRawSseEventV1, AiRequestEvent, AiRunPayloadV1, AiStreamEventV1, AlgeoCreateOptions, AlgeoEditorAuthOptions, AlgeoEditorCreateOptions, AlgeoEditorSaveResult, AlgeoEditorUiConfig, AlgeoEmbedMode, AlgeoErrorPayload, AlgeoFontConfig, AlgeoFontFormat, AlgeoFontOption, AlgeoFontResource, AlgeoFontSource, AlgeoPresentationCreateOptions, AlgeoPresentationUiConfig, ContentChangeEvent, DocumentApi, EmbeddedEditorEventListenerMap, EmbeddedEditorEventMap, EmbeddedEditorEventName, EmbeddedPresentationEventListenerMap, EmbeddedPresentationEventMap, EmbeddedPresentationEventName, ExportImageFormat, ExportImageOptions, ExportImageSizeMode, ExportImageViewMode, ExportImageContainMode, ExportViewBound, ExportViewBounds, ExportViewCamera3D, ExportPadding, ExportSlideImageOptions, ExportedSlideImage, ExportSlideImageResult, ExportLatexOptions, ExportedLatex, ExportLatexResult, GetContentResult, GetSlideCountResult, HistoryApi, LoadFileResult, LoadShareByIdResult, ModeApi, PresentationModeApi, ReadyEvent, ResourceLibraryItem, ResourceLibraryPageInfo, ResourceLibraryProvider, ResourceLibraryQuery, ResourceLibraryQueryContext, ResourceLibraryResult, ReplResult, SlideChangeEvent, SlideIndexResult, SlidesApi, SwitchSlideResult, SaveEvent, } from './shared';
|
|
4
|
+
export type { AiApi, AiCancelEvent, AiRawSseEventV1, AiRequestEvent, AiRunPayloadV1, AiStreamEventV1, AlgeoCreateOptions, AlgeoEditorAuthOptions, AlgeoEditorCreateOptions, AlgeoEditorSaveResult, AlgeoEditorUiConfig, AlgeoEmbedMode, AlgeoErrorPayload, AlgeoFontConfig, AlgeoFontFormat, AlgeoFontOption, AlgeoFontResource, AlgeoFontSource, AlgeoPresentationCreateOptions, AlgeoPresentationUiConfig, ContentChangeEvent, DocumentApi, EmbeddedEditorEventListenerMap, EmbeddedEditorEventMap, EmbeddedEditorEventName, EmbeddedPresentationEventListenerMap, EmbeddedPresentationEventMap, EmbeddedPresentationEventName, ExportImageFormat, ExportImageOptions, ExportImageSizeMode, ExportImageViewMode, ExportImageContainMode, ExportViewBound, ExportViewBounds, ExportViewCamera3D, ExportPadding, ExportSlideImageOptions, ExportedSlideImage, ExportSlideImageResult, ExportLatexOptions, ExportedLatex, ExportLatexResult, GetContentResult, GetSlideCountResult, HistoryApi, LoadFileResult, LoadShareByIdResult, ModeApi, PresentationModeApi, ReadyEvent, ResourceLibraryItem, ResourceLibraryPageInfo, ResourceLibraryProvider, ResourceLibraryQuery, ResourceLibraryQueryContext, ResourceLibraryResult, ReplResult, SetViewBoundsOptions, SlideChangeEvent, SlideIndexResult, SlidesApi, SwitchSlideResult, SaveEvent, } from './shared';
|
|
5
5
|
export { EmbeddedPresentation } from './embedded-presentation';
|
|
6
6
|
export { EmbeddedEditor } from './embedded-editor';
|
|
7
7
|
export { AlgeoSdk, create, createEditor, createPresentation, type EmbeddedInstance, } from './sdk';
|
package/dist/shared.d.ts
CHANGED
|
@@ -245,6 +245,17 @@ export interface GetViewBoundsResult {
|
|
|
245
245
|
/** 与 ExportImageViewMode.viewBound 格式一致,可直接传给 exportImage。 */
|
|
246
246
|
viewBounds: ExportViewBound | null;
|
|
247
247
|
}
|
|
248
|
+
/**
|
|
249
|
+
* 设置有限画布的世界坐标边界。未指定 index 时作用于当前画板。
|
|
250
|
+
* 坐标字段与 MCP 保持一致。
|
|
251
|
+
*/
|
|
252
|
+
export interface SetViewBoundsOptions {
|
|
253
|
+
left: number;
|
|
254
|
+
top: number;
|
|
255
|
+
bottom: number;
|
|
256
|
+
right: number;
|
|
257
|
+
index?: number;
|
|
258
|
+
}
|
|
248
259
|
export interface ReplResult {
|
|
249
260
|
output: string;
|
|
250
261
|
}
|
|
@@ -319,7 +330,7 @@ export interface ExportImageSizeMode extends ExportImageBaseOptions {
|
|
|
319
330
|
/**
|
|
320
331
|
* 场景二(view):viewBound 的四条边界均为世界坐标。
|
|
321
332
|
* scale 省略时从文件的 camera.scale 读取。
|
|
322
|
-
* 输出像素 = (right - left,
|
|
333
|
+
* 输出像素 = (right - left, top - bottom) x viewBound.scale x pixelRatio。
|
|
323
334
|
*/
|
|
324
335
|
export interface ExportImageViewMode extends ExportImageBaseOptions {
|
|
325
336
|
mode: 'view';
|
|
@@ -407,11 +418,8 @@ export interface DocumentApi {
|
|
|
407
418
|
export interface SlidesApi {
|
|
408
419
|
getCount(): number;
|
|
409
420
|
getCurrentIndex(): number;
|
|
410
|
-
/**
|
|
411
|
-
* 获取有限画布的导出视野。index 为 0-based,省略时读取当前画板;
|
|
412
|
-
* 无限画布返回 null,结果可直接作为 exportImage 的 viewBound。
|
|
413
|
-
*/
|
|
414
421
|
getViewBounds(index?: number): Promise<ExportViewBound | null>;
|
|
422
|
+
setViewBounds(options: SetViewBoundsOptions): Promise<void>;
|
|
415
423
|
switchTo(index: number): Promise<void>;
|
|
416
424
|
add(): Promise<SlideIndexResult>;
|
|
417
425
|
addAt(index: number): Promise<SlideIndexResult>;
|