@dajiaoai/algeo-sdk 2.6.0 → 2.6.1
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 +9 -9
- package/dist/algeo-sdk.cjs.js +84 -2
- package/dist/algeo-sdk.esm.js +84 -3
- package/dist/algeo-sdk.umd.js +84 -2
- package/dist/embedded-presentation.d.ts +2 -2
- package/dist/index.d.ts +2 -1
- package/dist/shared.d.ts +10 -10
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -39,15 +39,15 @@ npm install @dajiaoai/algeo-sdk@2.6.0
|
|
|
39
39
|
**unpkg**:
|
|
40
40
|
|
|
41
41
|
```html
|
|
42
|
-
<script src="https://unpkg.com/@dajiaoai/algeo-sdk@2.6.0/dist/algeo-sdk.umd.js"></script>
|
|
43
|
-
<script src="https://unpkg.com/@dajiaoai/algeo-sdk@latest/dist/algeo-sdk.umd.js"></script>
|
|
42
|
+
<script src="https://unpkg.com/@dajiaoai/algeo-sdk@2.6.0/dist/algeo-sdk.umd.min.js"></script>
|
|
43
|
+
<script src="https://unpkg.com/@dajiaoai/algeo-sdk@latest/dist/algeo-sdk.umd.min.js"></script>
|
|
44
44
|
```
|
|
45
45
|
|
|
46
46
|
**jsDelivr**:
|
|
47
47
|
|
|
48
48
|
```html
|
|
49
|
-
<script src="https://cdn.jsdelivr.net/npm/@dajiaoai/algeo-sdk@2.6.0/dist/algeo-sdk.umd.js"></script>
|
|
50
|
-
<script src="https://cdn.jsdelivr.net/npm/@dajiaoai/algeo-sdk@latest/dist/algeo-sdk.umd.js"></script>
|
|
49
|
+
<script src="https://cdn.jsdelivr.net/npm/@dajiaoai/algeo-sdk@2.6.0/dist/algeo-sdk.umd.min.js"></script>
|
|
50
|
+
<script src="https://cdn.jsdelivr.net/npm/@dajiaoai/algeo-sdk@latest/dist/algeo-sdk.umd.min.js"></script>
|
|
51
51
|
```
|
|
52
52
|
|
|
53
53
|
> 生产环境建议使用**具体版本号**,避免自动升级带来的兼容性风险。
|
|
@@ -254,7 +254,7 @@ type AlgeoCreateOptions =
|
|
|
254
254
|
| ---------------- | ------------------------------ | ------ | ------------------------------------------------------ |
|
|
255
255
|
| `auth` | `{ appId: string }` | - | 编辑模式鉴权参数,其中 `appId` 会参与默认路由生成 |
|
|
256
256
|
| `shareId` | `string` | `''` | 编辑模式初始分享 ID,会映射到 `/embed/edit/:appId/:id` |
|
|
257
|
-
| `initialContent` | `
|
|
257
|
+
| `initialContent` | `FileContentLatest` | - | 初始化后自动注入的文件内容 |
|
|
258
258
|
| `ui` | `Partial<AlgeoEditorUiConfig>` | - | 编辑器 UI 开关配置 |
|
|
259
259
|
|
|
260
260
|
**AlgeoPresentationCreateOptions:**
|
|
@@ -322,7 +322,7 @@ const presentation = await create(container, {
|
|
|
322
322
|
|
|
323
323
|
##### `presentation.loadFile(content: FileContent): Promise<LoadFileResult>`
|
|
324
324
|
|
|
325
|
-
加载完整文件数据(覆盖式),需符合
|
|
325
|
+
加载完整文件数据(覆盖式),需符合 FileContentLatest 格式。
|
|
326
326
|
|
|
327
327
|
| 参数 | 类型 | 说明 |
|
|
328
328
|
| --------- | ------------- | ------------ |
|
|
@@ -333,9 +333,9 @@ const presentation = await create(container, {
|
|
|
333
333
|
```typescript
|
|
334
334
|
interface FileContent {
|
|
335
335
|
slides: unknown[]; // 画板数据数组
|
|
336
|
-
messages: unknown[]; //
|
|
336
|
+
messages: unknown[]; // 消息数据(最新版本为会话数组)
|
|
337
337
|
metadata: {
|
|
338
|
-
version: string; // 如 '
|
|
338
|
+
version: string; // 如 '11'
|
|
339
339
|
shareOptions?: unknown;
|
|
340
340
|
};
|
|
341
341
|
}
|
|
@@ -449,7 +449,7 @@ interface FileContent {
|
|
|
449
449
|
| 事件名 | 事件数据 | 说明 |
|
|
450
450
|
| --------------- | ---------------------------------------------------------- | -------------------------------------------------------------------------------- |
|
|
451
451
|
| `ready` | `{ type: 'ready', mode, version }` | iframe 初始化完成 |
|
|
452
|
-
| `contentChange` | `{ type: 'contentChange', source: 'user', content }` | 用户在 iframe 内编辑后回传完整 `
|
|
452
|
+
| `contentChange` | `{ type: 'contentChange', source: 'user', content }` | 用户在 iframe 内编辑后回传完整 `FileContentLatest` |
|
|
453
453
|
| `slideChange` | `{ type: 'slideChange', index }` | 用户在 iframe 内切换画板后回传当前索引 |
|
|
454
454
|
| `save` | `{ type: 'save', stage: 'request' \| 'success', content }` | `stage: 'request'` 时用于宿主处理保存,`stage: 'success'` 时表示保存成功后的通知 |
|
|
455
455
|
|
package/dist/algeo-sdk.cjs.js
CHANGED
|
@@ -3875,6 +3875,10 @@ var fileContentV10MetadataSchema = objectType({
|
|
|
3875
3875
|
version: literalType("10"),
|
|
3876
3876
|
shareOptions: shareOptionsSchema.optional()
|
|
3877
3877
|
});
|
|
3878
|
+
var fileContentV11MetadataSchema = objectType({
|
|
3879
|
+
version: literalType("11"),
|
|
3880
|
+
shareOptions: shareOptionsSchema.optional()
|
|
3881
|
+
});
|
|
3878
3882
|
var definitionV2Schema = objectType({
|
|
3879
3883
|
kind: stringType(),
|
|
3880
3884
|
id: stringType()
|
|
@@ -3883,7 +3887,11 @@ var slideV2Schema = objectType({
|
|
|
3883
3887
|
definitions: arrayType(definitionV2Schema),
|
|
3884
3888
|
uvarMap: arrayType(tupleType([stringType(), numberType()])),
|
|
3885
3889
|
styleSheet: recordType(stringType(), unknownType()),
|
|
3886
|
-
doc: arrayType(unknownType())
|
|
3890
|
+
doc: arrayType(unknownType()),
|
|
3891
|
+
camera: objectType({
|
|
3892
|
+
offset: tupleType([numberType(), numberType()]),
|
|
3893
|
+
scale: numberType()
|
|
3894
|
+
}).optional()
|
|
3887
3895
|
});
|
|
3888
3896
|
var seedChatMessageSchema = objectType({
|
|
3889
3897
|
id: stringType(),
|
|
@@ -3895,9 +3903,82 @@ objectType({
|
|
|
3895
3903
|
messages: arrayType(seedChatMessageSchema),
|
|
3896
3904
|
metadata: fileContentV10MetadataSchema
|
|
3897
3905
|
});
|
|
3906
|
+
objectType({
|
|
3907
|
+
slides: arrayType(slideV2Schema),
|
|
3908
|
+
messages: arrayType(arrayType(seedChatMessageSchema)),
|
|
3909
|
+
metadata: fileContentV11MetadataSchema
|
|
3910
|
+
});
|
|
3911
|
+
function upgradeFromV10ToV11(content) {
|
|
3912
|
+
const normalizeTextStyleOpacityInRecord = (style) => {
|
|
3913
|
+
if (!style) {
|
|
3914
|
+
return {};
|
|
3915
|
+
}
|
|
3916
|
+
return {
|
|
3917
|
+
...style,
|
|
3918
|
+
fillOpacity: style.fillOpacity ? style.fillOpacity * 100 : 100,
|
|
3919
|
+
strokeOpacity: style.strokeOpacity ? style.strokeOpacity * 100 : 100
|
|
3920
|
+
};
|
|
3921
|
+
};
|
|
3922
|
+
const normalizeDistanceMode = (value) => {
|
|
3923
|
+
if (value === "half-pi") {
|
|
3924
|
+
return "half_pi";
|
|
3925
|
+
}
|
|
3926
|
+
return value;
|
|
3927
|
+
};
|
|
3928
|
+
return {
|
|
3929
|
+
slides: content.slides.map((slide) => ({
|
|
3930
|
+
...slide,
|
|
3931
|
+
styleSheet: {
|
|
3932
|
+
...slide.styleSheet,
|
|
3933
|
+
xaxis: {
|
|
3934
|
+
...slide.styleSheet.xaxis,
|
|
3935
|
+
distanceMode: normalizeDistanceMode(
|
|
3936
|
+
slide.styleSheet.xaxis.distanceMode
|
|
3937
|
+
)
|
|
3938
|
+
},
|
|
3939
|
+
yaxis: {
|
|
3940
|
+
...slide.styleSheet.yaxis,
|
|
3941
|
+
distanceMode: normalizeDistanceMode(
|
|
3942
|
+
slide.styleSheet.yaxis.distanceMode
|
|
3943
|
+
)
|
|
3944
|
+
},
|
|
3945
|
+
grid: {
|
|
3946
|
+
...slide.styleSheet.grid,
|
|
3947
|
+
distanceMode: normalizeDistanceMode(
|
|
3948
|
+
slide.styleSheet.grid.distanceMode
|
|
3949
|
+
)
|
|
3950
|
+
},
|
|
3951
|
+
textType: normalizeTextStyleOpacityInRecord(
|
|
3952
|
+
slide.styleSheet.textType
|
|
3953
|
+
),
|
|
3954
|
+
texts: slide.styleSheet.texts.map(([id, style]) => [
|
|
3955
|
+
id,
|
|
3956
|
+
normalizeTextStyleOpacityInRecord(
|
|
3957
|
+
style
|
|
3958
|
+
)
|
|
3959
|
+
])
|
|
3960
|
+
}
|
|
3961
|
+
})),
|
|
3962
|
+
messages: [content.messages],
|
|
3963
|
+
metadata: {
|
|
3964
|
+
...content.metadata,
|
|
3965
|
+
version: "11"
|
|
3966
|
+
}
|
|
3967
|
+
};
|
|
3968
|
+
}
|
|
3969
|
+
function convertToLatest(content) {
|
|
3970
|
+
const version = content.metadata.version;
|
|
3971
|
+
if (version === "11") {
|
|
3972
|
+
return content;
|
|
3973
|
+
}
|
|
3974
|
+
if (version === "10") {
|
|
3975
|
+
return convertToLatest(upgradeFromV10ToV11(content));
|
|
3976
|
+
}
|
|
3977
|
+
throw new Error(`Unsupported FileContent version: ${version}`);
|
|
3978
|
+
}
|
|
3898
3979
|
|
|
3899
3980
|
/** SDK 版本号,构建时由 rollup 注入 */
|
|
3900
|
-
const VERSION = '2.6.
|
|
3981
|
+
const VERSION = '2.6.1';
|
|
3901
3982
|
const DEFAULT_EMBED_BASE = 'https://dajiaoai.com';
|
|
3902
3983
|
const DEFAULT_PRESENTATION_PATH = '/e';
|
|
3903
3984
|
const DEFAULT_EDITOR_PATH = '/embed/edit';
|
|
@@ -4504,6 +4585,7 @@ exports.EMBED_ERROR_CODES = EMBED_ERROR_CODES;
|
|
|
4504
4585
|
exports.EmbeddedEditor = EmbeddedEditor;
|
|
4505
4586
|
exports.EmbeddedPresentation = EmbeddedPresentation;
|
|
4506
4587
|
exports.VERSION = VERSION;
|
|
4588
|
+
exports.convertToLatest = convertToLatest;
|
|
4507
4589
|
exports.create = create;
|
|
4508
4590
|
exports.createEditor = createEditor;
|
|
4509
4591
|
exports.createPresentation = createPresentation;
|
package/dist/algeo-sdk.esm.js
CHANGED
|
@@ -3873,6 +3873,10 @@ var fileContentV10MetadataSchema = objectType({
|
|
|
3873
3873
|
version: literalType("10"),
|
|
3874
3874
|
shareOptions: shareOptionsSchema.optional()
|
|
3875
3875
|
});
|
|
3876
|
+
var fileContentV11MetadataSchema = objectType({
|
|
3877
|
+
version: literalType("11"),
|
|
3878
|
+
shareOptions: shareOptionsSchema.optional()
|
|
3879
|
+
});
|
|
3876
3880
|
var definitionV2Schema = objectType({
|
|
3877
3881
|
kind: stringType(),
|
|
3878
3882
|
id: stringType()
|
|
@@ -3881,7 +3885,11 @@ var slideV2Schema = objectType({
|
|
|
3881
3885
|
definitions: arrayType(definitionV2Schema),
|
|
3882
3886
|
uvarMap: arrayType(tupleType([stringType(), numberType()])),
|
|
3883
3887
|
styleSheet: recordType(stringType(), unknownType()),
|
|
3884
|
-
doc: arrayType(unknownType())
|
|
3888
|
+
doc: arrayType(unknownType()),
|
|
3889
|
+
camera: objectType({
|
|
3890
|
+
offset: tupleType([numberType(), numberType()]),
|
|
3891
|
+
scale: numberType()
|
|
3892
|
+
}).optional()
|
|
3885
3893
|
});
|
|
3886
3894
|
var seedChatMessageSchema = objectType({
|
|
3887
3895
|
id: stringType(),
|
|
@@ -3893,9 +3901,82 @@ objectType({
|
|
|
3893
3901
|
messages: arrayType(seedChatMessageSchema),
|
|
3894
3902
|
metadata: fileContentV10MetadataSchema
|
|
3895
3903
|
});
|
|
3904
|
+
objectType({
|
|
3905
|
+
slides: arrayType(slideV2Schema),
|
|
3906
|
+
messages: arrayType(arrayType(seedChatMessageSchema)),
|
|
3907
|
+
metadata: fileContentV11MetadataSchema
|
|
3908
|
+
});
|
|
3909
|
+
function upgradeFromV10ToV11(content) {
|
|
3910
|
+
const normalizeTextStyleOpacityInRecord = (style) => {
|
|
3911
|
+
if (!style) {
|
|
3912
|
+
return {};
|
|
3913
|
+
}
|
|
3914
|
+
return {
|
|
3915
|
+
...style,
|
|
3916
|
+
fillOpacity: style.fillOpacity ? style.fillOpacity * 100 : 100,
|
|
3917
|
+
strokeOpacity: style.strokeOpacity ? style.strokeOpacity * 100 : 100
|
|
3918
|
+
};
|
|
3919
|
+
};
|
|
3920
|
+
const normalizeDistanceMode = (value) => {
|
|
3921
|
+
if (value === "half-pi") {
|
|
3922
|
+
return "half_pi";
|
|
3923
|
+
}
|
|
3924
|
+
return value;
|
|
3925
|
+
};
|
|
3926
|
+
return {
|
|
3927
|
+
slides: content.slides.map((slide) => ({
|
|
3928
|
+
...slide,
|
|
3929
|
+
styleSheet: {
|
|
3930
|
+
...slide.styleSheet,
|
|
3931
|
+
xaxis: {
|
|
3932
|
+
...slide.styleSheet.xaxis,
|
|
3933
|
+
distanceMode: normalizeDistanceMode(
|
|
3934
|
+
slide.styleSheet.xaxis.distanceMode
|
|
3935
|
+
)
|
|
3936
|
+
},
|
|
3937
|
+
yaxis: {
|
|
3938
|
+
...slide.styleSheet.yaxis,
|
|
3939
|
+
distanceMode: normalizeDistanceMode(
|
|
3940
|
+
slide.styleSheet.yaxis.distanceMode
|
|
3941
|
+
)
|
|
3942
|
+
},
|
|
3943
|
+
grid: {
|
|
3944
|
+
...slide.styleSheet.grid,
|
|
3945
|
+
distanceMode: normalizeDistanceMode(
|
|
3946
|
+
slide.styleSheet.grid.distanceMode
|
|
3947
|
+
)
|
|
3948
|
+
},
|
|
3949
|
+
textType: normalizeTextStyleOpacityInRecord(
|
|
3950
|
+
slide.styleSheet.textType
|
|
3951
|
+
),
|
|
3952
|
+
texts: slide.styleSheet.texts.map(([id, style]) => [
|
|
3953
|
+
id,
|
|
3954
|
+
normalizeTextStyleOpacityInRecord(
|
|
3955
|
+
style
|
|
3956
|
+
)
|
|
3957
|
+
])
|
|
3958
|
+
}
|
|
3959
|
+
})),
|
|
3960
|
+
messages: [content.messages],
|
|
3961
|
+
metadata: {
|
|
3962
|
+
...content.metadata,
|
|
3963
|
+
version: "11"
|
|
3964
|
+
}
|
|
3965
|
+
};
|
|
3966
|
+
}
|
|
3967
|
+
function convertToLatest(content) {
|
|
3968
|
+
const version = content.metadata.version;
|
|
3969
|
+
if (version === "11") {
|
|
3970
|
+
return content;
|
|
3971
|
+
}
|
|
3972
|
+
if (version === "10") {
|
|
3973
|
+
return convertToLatest(upgradeFromV10ToV11(content));
|
|
3974
|
+
}
|
|
3975
|
+
throw new Error(`Unsupported FileContent version: ${version}`);
|
|
3976
|
+
}
|
|
3896
3977
|
|
|
3897
3978
|
/** SDK 版本号,构建时由 rollup 注入 */
|
|
3898
|
-
const VERSION = '2.6.
|
|
3979
|
+
const VERSION = '2.6.1';
|
|
3899
3980
|
const DEFAULT_EMBED_BASE = 'https://dajiaoai.com';
|
|
3900
3981
|
const DEFAULT_PRESENTATION_PATH = '/e';
|
|
3901
3982
|
const DEFAULT_EDITOR_PATH = '/embed/edit';
|
|
@@ -4496,4 +4577,4 @@ async function createPresentation(container, options = {}) {
|
|
|
4496
4577
|
return createPresentationInstance(container, options);
|
|
4497
4578
|
}
|
|
4498
4579
|
|
|
4499
|
-
export { AlgeoError, AlgeoSdk, EMBED_ERROR_CODES, EmbeddedEditor, EmbeddedPresentation, VERSION, create, createEditor, createPresentation };
|
|
4580
|
+
export { AlgeoError, AlgeoSdk, EMBED_ERROR_CODES, EmbeddedEditor, EmbeddedPresentation, VERSION, convertToLatest, create, createEditor, createPresentation };
|
package/dist/algeo-sdk.umd.js
CHANGED
|
@@ -3879,6 +3879,10 @@
|
|
|
3879
3879
|
version: literalType("10"),
|
|
3880
3880
|
shareOptions: shareOptionsSchema.optional()
|
|
3881
3881
|
});
|
|
3882
|
+
var fileContentV11MetadataSchema = objectType({
|
|
3883
|
+
version: literalType("11"),
|
|
3884
|
+
shareOptions: shareOptionsSchema.optional()
|
|
3885
|
+
});
|
|
3882
3886
|
var definitionV2Schema = objectType({
|
|
3883
3887
|
kind: stringType(),
|
|
3884
3888
|
id: stringType()
|
|
@@ -3887,7 +3891,11 @@
|
|
|
3887
3891
|
definitions: arrayType(definitionV2Schema),
|
|
3888
3892
|
uvarMap: arrayType(tupleType([stringType(), numberType()])),
|
|
3889
3893
|
styleSheet: recordType(stringType(), unknownType()),
|
|
3890
|
-
doc: arrayType(unknownType())
|
|
3894
|
+
doc: arrayType(unknownType()),
|
|
3895
|
+
camera: objectType({
|
|
3896
|
+
offset: tupleType([numberType(), numberType()]),
|
|
3897
|
+
scale: numberType()
|
|
3898
|
+
}).optional()
|
|
3891
3899
|
});
|
|
3892
3900
|
var seedChatMessageSchema = objectType({
|
|
3893
3901
|
id: stringType(),
|
|
@@ -3899,9 +3907,82 @@
|
|
|
3899
3907
|
messages: arrayType(seedChatMessageSchema),
|
|
3900
3908
|
metadata: fileContentV10MetadataSchema
|
|
3901
3909
|
});
|
|
3910
|
+
objectType({
|
|
3911
|
+
slides: arrayType(slideV2Schema),
|
|
3912
|
+
messages: arrayType(arrayType(seedChatMessageSchema)),
|
|
3913
|
+
metadata: fileContentV11MetadataSchema
|
|
3914
|
+
});
|
|
3915
|
+
function upgradeFromV10ToV11(content) {
|
|
3916
|
+
const normalizeTextStyleOpacityInRecord = (style) => {
|
|
3917
|
+
if (!style) {
|
|
3918
|
+
return {};
|
|
3919
|
+
}
|
|
3920
|
+
return {
|
|
3921
|
+
...style,
|
|
3922
|
+
fillOpacity: style.fillOpacity ? style.fillOpacity * 100 : 100,
|
|
3923
|
+
strokeOpacity: style.strokeOpacity ? style.strokeOpacity * 100 : 100
|
|
3924
|
+
};
|
|
3925
|
+
};
|
|
3926
|
+
const normalizeDistanceMode = (value) => {
|
|
3927
|
+
if (value === "half-pi") {
|
|
3928
|
+
return "half_pi";
|
|
3929
|
+
}
|
|
3930
|
+
return value;
|
|
3931
|
+
};
|
|
3932
|
+
return {
|
|
3933
|
+
slides: content.slides.map((slide) => ({
|
|
3934
|
+
...slide,
|
|
3935
|
+
styleSheet: {
|
|
3936
|
+
...slide.styleSheet,
|
|
3937
|
+
xaxis: {
|
|
3938
|
+
...slide.styleSheet.xaxis,
|
|
3939
|
+
distanceMode: normalizeDistanceMode(
|
|
3940
|
+
slide.styleSheet.xaxis.distanceMode
|
|
3941
|
+
)
|
|
3942
|
+
},
|
|
3943
|
+
yaxis: {
|
|
3944
|
+
...slide.styleSheet.yaxis,
|
|
3945
|
+
distanceMode: normalizeDistanceMode(
|
|
3946
|
+
slide.styleSheet.yaxis.distanceMode
|
|
3947
|
+
)
|
|
3948
|
+
},
|
|
3949
|
+
grid: {
|
|
3950
|
+
...slide.styleSheet.grid,
|
|
3951
|
+
distanceMode: normalizeDistanceMode(
|
|
3952
|
+
slide.styleSheet.grid.distanceMode
|
|
3953
|
+
)
|
|
3954
|
+
},
|
|
3955
|
+
textType: normalizeTextStyleOpacityInRecord(
|
|
3956
|
+
slide.styleSheet.textType
|
|
3957
|
+
),
|
|
3958
|
+
texts: slide.styleSheet.texts.map(([id, style]) => [
|
|
3959
|
+
id,
|
|
3960
|
+
normalizeTextStyleOpacityInRecord(
|
|
3961
|
+
style
|
|
3962
|
+
)
|
|
3963
|
+
])
|
|
3964
|
+
}
|
|
3965
|
+
})),
|
|
3966
|
+
messages: [content.messages],
|
|
3967
|
+
metadata: {
|
|
3968
|
+
...content.metadata,
|
|
3969
|
+
version: "11"
|
|
3970
|
+
}
|
|
3971
|
+
};
|
|
3972
|
+
}
|
|
3973
|
+
function convertToLatest(content) {
|
|
3974
|
+
const version = content.metadata.version;
|
|
3975
|
+
if (version === "11") {
|
|
3976
|
+
return content;
|
|
3977
|
+
}
|
|
3978
|
+
if (version === "10") {
|
|
3979
|
+
return convertToLatest(upgradeFromV10ToV11(content));
|
|
3980
|
+
}
|
|
3981
|
+
throw new Error(`Unsupported FileContent version: ${version}`);
|
|
3982
|
+
}
|
|
3902
3983
|
|
|
3903
3984
|
/** SDK 版本号,构建时由 rollup 注入 */
|
|
3904
|
-
const VERSION = '2.6.
|
|
3985
|
+
const VERSION = '2.6.1';
|
|
3905
3986
|
const DEFAULT_EMBED_BASE = 'https://dajiaoai.com';
|
|
3906
3987
|
const DEFAULT_PRESENTATION_PATH = '/e';
|
|
3907
3988
|
const DEFAULT_EDITOR_PATH = '/embed/edit';
|
|
@@ -4508,6 +4589,7 @@
|
|
|
4508
4589
|
exports.EmbeddedEditor = EmbeddedEditor;
|
|
4509
4590
|
exports.EmbeddedPresentation = EmbeddedPresentation;
|
|
4510
4591
|
exports.VERSION = VERSION;
|
|
4592
|
+
exports.convertToLatest = convertToLatest;
|
|
4511
4593
|
exports.create = create;
|
|
4512
4594
|
exports.createEditor = createEditor;
|
|
4513
4595
|
exports.createPresentation = createPresentation;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { EmbeddedTarget } from './embedded-target';
|
|
2
|
-
import { AlgeoError, type AlgeoPresentationCreateOptions, type EmbeddedPresentationEventListenerMap, type EmbeddedPresentationEventMap, type EmbeddedPresentationEventName, type
|
|
2
|
+
import { AlgeoError, type AlgeoPresentationCreateOptions, type EmbeddedPresentationEventListenerMap, type EmbeddedPresentationEventMap, type EmbeddedPresentationEventName, type FileContentLatest, type GetSlideCountResult, type LoadFileResult, type LoadShareByIdResult, type ReplResult, type SwitchSlideResult } from './shared';
|
|
3
3
|
export declare class EmbeddedPresentation extends EmbeddedTarget<EmbeddedPresentationEventMap, EmbeddedPresentationEventName, EmbeddedPresentationEventListenerMap> {
|
|
4
4
|
private currentContent?;
|
|
5
5
|
private currentSlideIndex;
|
|
@@ -11,7 +11,7 @@ export declare class EmbeddedPresentation extends EmbeddedTarget<EmbeddedPresent
|
|
|
11
11
|
setWhitelistError(error: AlgeoError): void;
|
|
12
12
|
private ensureWhitelistAccess;
|
|
13
13
|
loadShareById(id: string): Promise<LoadShareByIdResult>;
|
|
14
|
-
loadFile(content:
|
|
14
|
+
loadFile(content: FileContentLatest): Promise<LoadFileResult>;
|
|
15
15
|
switchSlide(index: number): Promise<SwitchSlideResult>;
|
|
16
16
|
getSlideCount(): Promise<GetSlideCountResult>;
|
|
17
17
|
repl(command: string): Promise<ReplResult>;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
export { AlgeoError, EMBED_ERROR_CODES, VERSION } from './shared';
|
|
2
|
-
export type {
|
|
2
|
+
export type { FileContentLatest } from '@dajiaoai/algeo-protocol';
|
|
3
|
+
export { convertToLatest } from '@dajiaoai/algeo-protocol';
|
|
3
4
|
export type { AlgeoCreateOptions, AlgeoEditorAuthOptions, AlgeoEditorCreateOptions, AlgeoEditorSaveResult, AlgeoEditorUiConfig, AlgeoEmbedMode, AlgeoErrorPayload, AlgeoPresentationCreateOptions, ContentChangeEvent, DocumentApi, EmbeddedEditorEventListenerMap, EmbeddedEditorEventMap, EmbeddedEditorEventName, EmbeddedPresentationEventListenerMap, EmbeddedPresentationEventMap, EmbeddedPresentationEventName, ExportSlideImageOptions, ExportedSlideImage, ExportSlideImageResult, GetContentResult, GetSlideCountResult, HistoryApi, LoadFileResult, LoadShareByIdResult, ModeApi, ReadyEvent, ReplResult, SlideChangeEvent, SlideIndexResult, SlidesApi, SwitchSlideResult, SaveEvent, } from './shared';
|
|
4
5
|
export { EmbeddedPresentation } from './embedded-presentation';
|
|
5
6
|
export { EmbeddedEditor } from './embedded-editor';
|
package/dist/shared.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { AlgeoError, type AlgeoErrorPayload, type EmbedReadyMessage, type EmbedResponseMessage, type
|
|
1
|
+
import { AlgeoError, type AlgeoErrorPayload, type EmbedReadyMessage, type EmbedResponseMessage, type FileContentLatest, EMBED_ERROR_CODES } from '@dajiaoai/algeo-protocol';
|
|
2
2
|
/** SDK 版本号,构建时由 rollup 注入 */
|
|
3
3
|
export declare const VERSION = "__ALGEO_SDK_VERSION__";
|
|
4
4
|
/** 从协议层 re-export,供外部使用 */
|
|
5
|
-
export type {
|
|
5
|
+
export type { FileContentLatest, AlgeoErrorPayload };
|
|
6
6
|
export { AlgeoError, EMBED_ERROR_CODES };
|
|
7
7
|
export declare const EMBED_TIMEOUT_MS = 30000;
|
|
8
8
|
export interface AlgeoSdkOptions {
|
|
@@ -33,7 +33,7 @@ export type AlgeoEditorSaveResult = {
|
|
|
33
33
|
export interface AlgeoEditorCreateOptions {
|
|
34
34
|
auth?: AlgeoEditorAuthOptions;
|
|
35
35
|
shareId?: string;
|
|
36
|
-
initialContent?:
|
|
36
|
+
initialContent?: FileContentLatest;
|
|
37
37
|
ui?: AlgeoEditorUiConfig;
|
|
38
38
|
}
|
|
39
39
|
export interface AlgeoPresentationCreateOptions {
|
|
@@ -57,7 +57,7 @@ export interface ReadyEvent {
|
|
|
57
57
|
export interface ContentChangeEvent {
|
|
58
58
|
type: 'contentChange';
|
|
59
59
|
source: 'loadContent' | 'loadFile' | 'loadShareById' | 'initialContent' | 'user';
|
|
60
|
-
content?:
|
|
60
|
+
content?: FileContentLatest;
|
|
61
61
|
shareId?: string;
|
|
62
62
|
}
|
|
63
63
|
export interface SlideChangeEvent {
|
|
@@ -66,19 +66,19 @@ export interface SlideChangeEvent {
|
|
|
66
66
|
}
|
|
67
67
|
export interface SaveRequestEvent {
|
|
68
68
|
type: 'save';
|
|
69
|
-
content:
|
|
69
|
+
content: FileContentLatest;
|
|
70
70
|
stage: 'request';
|
|
71
71
|
}
|
|
72
72
|
export interface SaveSuccessEvent {
|
|
73
73
|
type: 'save';
|
|
74
|
-
content:
|
|
74
|
+
content: FileContentLatest;
|
|
75
75
|
stage: 'success';
|
|
76
76
|
}
|
|
77
77
|
export type SaveEvent = SaveRequestEvent | SaveSuccessEvent;
|
|
78
78
|
export interface SaveRequestMessage {
|
|
79
79
|
type: 'save';
|
|
80
80
|
requestId: string;
|
|
81
|
-
content:
|
|
81
|
+
content: FileContentLatest;
|
|
82
82
|
}
|
|
83
83
|
export interface EmbeddedEditorEventMap {
|
|
84
84
|
ready: ReadyEvent;
|
|
@@ -138,7 +138,7 @@ export interface ExportSlideImageResult {
|
|
|
138
138
|
images: ExportedSlideImage[];
|
|
139
139
|
}
|
|
140
140
|
export interface GetContentResult {
|
|
141
|
-
content:
|
|
141
|
+
content: FileContentLatest;
|
|
142
142
|
}
|
|
143
143
|
export interface GetHistoryStateResult {
|
|
144
144
|
count: number;
|
|
@@ -147,8 +147,8 @@ export interface GetHistoryStateResult {
|
|
|
147
147
|
canRedo: boolean;
|
|
148
148
|
}
|
|
149
149
|
export interface DocumentApi {
|
|
150
|
-
loadContent(content:
|
|
151
|
-
getContent(): Promise<
|
|
150
|
+
loadContent(content: FileContentLatest): Promise<void>;
|
|
151
|
+
getContent(): Promise<FileContentLatest>;
|
|
152
152
|
}
|
|
153
153
|
export interface SlidesApi {
|
|
154
154
|
getCount(): number;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dajiaoai/algeo-sdk",
|
|
3
|
-
"version": "2.6.
|
|
3
|
+
"version": "2.6.1",
|
|
4
4
|
"description": "大角几何内嵌画板 SDK,支持 iframe 挂载与 postMessage 通信",
|
|
5
5
|
"main": "dist/algeo-sdk.cjs.js",
|
|
6
6
|
"module": "dist/algeo-sdk.esm.js",
|
|
@@ -42,6 +42,6 @@
|
|
|
42
42
|
"typescript": "^5.9.3"
|
|
43
43
|
},
|
|
44
44
|
"dependencies": {
|
|
45
|
-
"@dajiaoai/algeo-protocol": "^1.
|
|
45
|
+
"@dajiaoai/algeo-protocol": "^1.4.0"
|
|
46
46
|
}
|
|
47
47
|
}
|