@chili-publish/studio-sdk 0.133.2 → 0.136.0
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 +1 -1
- package/_bundles/main.js +1 -1
- package/_bundles/main.js.map +1 -1
- package/_bundles/report.html +2 -2
- package/lib/editor-engine.json +1 -1
- package/lib/package.json +1 -1
- package/lib/src/controllers/ConnectorController.d.ts +11 -3
- package/lib/src/controllers/ConnectorController.js +14 -5
- package/lib/src/controllers/ConnectorController.js.map +1 -1
- package/lib/src/controllers/DocumentController.d.ts +1 -17
- package/lib/src/controllers/DocumentController.js +0 -104
- package/lib/src/controllers/DocumentController.js.map +1 -1
- package/lib/src/controllers/VariableController.d.ts +1 -1
- package/lib/src/controllers/VariableController.js.map +1 -1
- package/lib/src/index.d.ts +2 -69
- package/lib/src/index.js +1 -141
- package/lib/src/index.js.map +1 -1
- package/lib/src/interactions/connector.js +9 -7
- package/lib/src/interactions/connector.js.map +1 -1
- package/lib/src/sdk.d.ts +69 -0
- package/lib/src/sdk.js +144 -0
- package/lib/src/sdk.js.map +1 -0
- package/lib/src/tests/controllers/ConnectorController.test.js +7 -0
- package/lib/src/tests/controllers/ConnectorController.test.js.map +1 -1
- package/lib/src/tests/controllers/DocumentController.test.js +0 -131
- package/lib/src/tests/controllers/DocumentController.test.js.map +1 -1
- package/lib/src/tests/controllers/VariableController.test.js +6 -1
- package/lib/src/tests/controllers/VariableController.test.js.map +1 -1
- package/lib/src/tests/index.test.js +1 -1
- package/lib/src/tests/index.test.js.map +1 -1
- package/lib/src/tests/interactions/connector.test.js +7 -1
- package/lib/src/tests/interactions/connector.test.js.map +1 -1
- package/lib/src/types/ConfigurationTypes.d.ts +2 -1
- package/lib/src/types/ConfigurationTypes.js +1 -0
- package/lib/src/types/ConfigurationTypes.js.map +1 -1
- package/lib/src/types/ConnectorTypes.d.ts +36 -4
- package/lib/src/types/ConnectorTypes.js +7 -0
- package/lib/src/types/ConnectorTypes.js.map +1 -1
- package/lib/src/types/VariableTypes.d.ts +5 -3
- package/lib/src/types/VariableTypes.js +1 -0
- package/lib/src/types/VariableTypes.js.map +1 -1
- package/lib/src/utils/enums.d.ts +0 -3
- package/lib/src/utils/enums.js +0 -4
- package/lib/src/utils/enums.js.map +1 -1
- package/package.json +1 -1
- package/lib/src/tests/utils/getFetchUrls.test.d.ts +0 -1
- package/lib/src/tests/utils/getFetchUrls.test.js +0 -10
- package/lib/src/tests/utils/getFetchUrls.test.js.map +0 -1
- package/lib/src/utils/getFetchUrl.d.ts +0 -2
- package/lib/src/utils/getFetchUrl.js +0 -3
- package/lib/src/utils/getFetchUrl.js.map +0 -1
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import { EditorAPI
|
|
1
|
+
import { EditorAPI } from '../types/CommonTypes';
|
|
2
2
|
import type { ChiliDocument } from '../types/DocumentTypes';
|
|
3
|
-
import { DownloadFormats } from '../utils/enums';
|
|
4
3
|
/**
|
|
5
4
|
* The DocumentController is responsible for all communication regarding the Document.
|
|
6
5
|
* Methods inside this controller can be called by `window.SDK.document.{method-name}`
|
|
@@ -22,19 +21,4 @@ export declare class DocumentController {
|
|
|
22
21
|
* @returns the document loaded inside of the canvas
|
|
23
22
|
*/
|
|
24
23
|
load: (doc: ChiliDocument | string) => Promise<import("../types/CommonTypes").EditorResponse<unknown>>;
|
|
25
|
-
/**
|
|
26
|
-
* This method will call an external api to create a download url
|
|
27
|
-
* The video will be generated in the dimensions (and resolution) of the layout.
|
|
28
|
-
* This means that any upscaling (e.g. playing the video full screen on a 4k monitor) will result in interpolation (= quality loss).
|
|
29
|
-
* @param format the format of a downloadable url
|
|
30
|
-
* @param layoutId id of layout to be downloaded
|
|
31
|
-
* @returns the download link
|
|
32
|
-
*/
|
|
33
|
-
getDownloadLink: (format: DownloadFormats, layoutId: Id) => Promise<import("../types/CommonTypes").EditorResponse<string>>;
|
|
34
|
-
/**
|
|
35
|
-
* This method will call an external api endpoint, untill the api endpoint returns a status code 200
|
|
36
|
-
* @param endpoint api endpoint to start polling on
|
|
37
|
-
* @returns true when the endpoint call has successfully been resolved
|
|
38
|
-
*/
|
|
39
|
-
startPollingOnEndpoint: (endpoint: string) => Promise<true | unknown>;
|
|
40
24
|
}
|
|
@@ -19,8 +19,6 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
|
|
|
19
19
|
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
20
20
|
};
|
|
21
21
|
var _DocumentController_editorAPI;
|
|
22
|
-
import { renderURLs } from '../utils/enums';
|
|
23
|
-
import { getFetchURL } from '../utils/getFetchUrl';
|
|
24
22
|
import { getEditorResponseData } from '../utils/EditorResponseData';
|
|
25
23
|
/**
|
|
26
24
|
* The DocumentController is responsible for all communication regarding the Document.
|
|
@@ -54,108 +52,6 @@ export class DocumentController {
|
|
|
54
52
|
return res.loadDocument(doc);
|
|
55
53
|
return res.loadDocument(JSON.stringify(doc)).then((result) => getEditorResponseData(result));
|
|
56
54
|
});
|
|
57
|
-
/**
|
|
58
|
-
* This method will call an external api to create a download url
|
|
59
|
-
* The video will be generated in the dimensions (and resolution) of the layout.
|
|
60
|
-
* This means that any upscaling (e.g. playing the video full screen on a 4k monitor) will result in interpolation (= quality loss).
|
|
61
|
-
* @param format the format of a downloadable url
|
|
62
|
-
* @param layoutId id of layout to be downloaded
|
|
63
|
-
* @returns the download link
|
|
64
|
-
*/
|
|
65
|
-
this.getDownloadLink = (format, layoutId) => __awaiter(this, void 0, void 0, function* () {
|
|
66
|
-
var _a, _b, _c;
|
|
67
|
-
let error = null;
|
|
68
|
-
let PREPARE_DOWNLOAD_URL = null;
|
|
69
|
-
let DOWNLOAD_URL = '';
|
|
70
|
-
const documentResponse = yield this.getCurrentState();
|
|
71
|
-
const FETCH_URL = getFetchURL(format, layoutId);
|
|
72
|
-
try {
|
|
73
|
-
const response = yield fetch(FETCH_URL, {
|
|
74
|
-
method: 'POST',
|
|
75
|
-
headers: {
|
|
76
|
-
'Content-Type': 'application/json',
|
|
77
|
-
},
|
|
78
|
-
body: (_a = documentResponse.data) !== null && _a !== void 0 ? _a : null,
|
|
79
|
-
})
|
|
80
|
-
.then((data) => data.json())
|
|
81
|
-
.catch((err) => {
|
|
82
|
-
if (err.code) {
|
|
83
|
-
error = { code: err.code, error: err.message || err };
|
|
84
|
-
}
|
|
85
|
-
else {
|
|
86
|
-
error = { code: 400, error: err.message || err };
|
|
87
|
-
}
|
|
88
|
-
return error;
|
|
89
|
-
});
|
|
90
|
-
if ((response === null || response === void 0 ? void 0 : response.error) || error) {
|
|
91
|
-
return getEditorResponseData({
|
|
92
|
-
success: false,
|
|
93
|
-
data: DOWNLOAD_URL,
|
|
94
|
-
error,
|
|
95
|
-
status: response.status,
|
|
96
|
-
parsedData: null,
|
|
97
|
-
}, false);
|
|
98
|
-
}
|
|
99
|
-
PREPARE_DOWNLOAD_URL = (response === null || response === void 0 ? void 0 : response.resultUrl) ? renderURLs.BASE_URL + (response === null || response === void 0 ? void 0 : response.resultUrl) : null;
|
|
100
|
-
DOWNLOAD_URL = (response === null || response === void 0 ? void 0 : response.downloadUrl) ? renderURLs.BASE_URL + (response === null || response === void 0 ? void 0 : response.downloadUrl) : '';
|
|
101
|
-
let isFileDownloadable = error;
|
|
102
|
-
try {
|
|
103
|
-
isFileDownloadable = yield this.startPollingOnEndpoint(PREPARE_DOWNLOAD_URL);
|
|
104
|
-
}
|
|
105
|
-
catch (err) {
|
|
106
|
-
error = err;
|
|
107
|
-
}
|
|
108
|
-
if (isFileDownloadable !== true)
|
|
109
|
-
error = isFileDownloadable;
|
|
110
|
-
if (error) {
|
|
111
|
-
return getEditorResponseData({
|
|
112
|
-
success: false,
|
|
113
|
-
data: '',
|
|
114
|
-
error,
|
|
115
|
-
status: (_b = error === null || error === void 0 ? void 0 : error.code) !== null && _b !== void 0 ? _b : 400,
|
|
116
|
-
parsedData: null,
|
|
117
|
-
}, false);
|
|
118
|
-
}
|
|
119
|
-
return getEditorResponseData({
|
|
120
|
-
success: true,
|
|
121
|
-
status: 200,
|
|
122
|
-
data: DOWNLOAD_URL,
|
|
123
|
-
parsedData: null,
|
|
124
|
-
}, false);
|
|
125
|
-
}
|
|
126
|
-
catch (err) {
|
|
127
|
-
error = err;
|
|
128
|
-
return getEditorResponseData({
|
|
129
|
-
success: false,
|
|
130
|
-
data: DOWNLOAD_URL,
|
|
131
|
-
error,
|
|
132
|
-
status: (_c = error === null || error === void 0 ? void 0 : error.code) !== null && _c !== void 0 ? _c : 400,
|
|
133
|
-
parsedData: null,
|
|
134
|
-
}, false);
|
|
135
|
-
}
|
|
136
|
-
});
|
|
137
|
-
/**
|
|
138
|
-
* This method will call an external api endpoint, untill the api endpoint returns a status code 200
|
|
139
|
-
* @param endpoint api endpoint to start polling on
|
|
140
|
-
* @returns true when the endpoint call has successfully been resolved
|
|
141
|
-
*/
|
|
142
|
-
this.startPollingOnEndpoint = (endpoint) => __awaiter(this, void 0, void 0, function* () {
|
|
143
|
-
try {
|
|
144
|
-
const response = yield fetch(endpoint)
|
|
145
|
-
.then((data) => data)
|
|
146
|
-
.catch((err) => err);
|
|
147
|
-
if ((response === null || response === void 0 ? void 0 : response.status) === 202) {
|
|
148
|
-
yield new Promise((resolve) => setTimeout(resolve, 2000));
|
|
149
|
-
return yield this.startPollingOnEndpoint(endpoint);
|
|
150
|
-
}
|
|
151
|
-
else {
|
|
152
|
-
return true;
|
|
153
|
-
}
|
|
154
|
-
}
|
|
155
|
-
catch (err) {
|
|
156
|
-
return err;
|
|
157
|
-
}
|
|
158
|
-
});
|
|
159
55
|
__classPrivateFieldSet(this, _DocumentController_editorAPI, editorAPI, "f");
|
|
160
56
|
}
|
|
161
57
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DocumentController.js","sourceRoot":"","sources":["../../../src/controllers/DocumentController.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"DocumentController.js","sourceRoot":"","sources":["../../../src/controllers/DocumentController.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;AAGA,OAAO,EAAE,qBAAqB,EAAE,MAAM,6BAA6B,CAAC;AACpE;;;GAGG;AAEH,MAAM,OAAO,kBAAkB;IAM3B;;OAEG;IACH,YAAY,SAAoB;QARhC;;WAEG;QACH,gDAAsB;QAStB;;;WAGG;QACH,oBAAe,GAAG,GAAS,EAAE;YACzB,MAAM,GAAG,GAAG,MAAM,uBAAA,IAAI,qCAAW,CAAC;YAClC,OAAO,GAAG,CAAC,uBAAuB,EAAE,CAAC,IAAI,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,qBAAqB,CAAgB,MAAM,CAAC,CAAC,CAAC;QACxG,CAAC,CAAA,CAAC;QAEF;;;;WAIG;QACH,SAAI,GAAG,CAAO,GAA2B,EAAE,EAAE;YACzC,MAAM,GAAG,GAAG,MAAM,uBAAA,IAAI,qCAAW,CAAC;YAClC,IAAI,OAAO,GAAG,KAAK,QAAQ;gBAAE,OAAO,GAAG,CAAC,YAAY,CAAC,GAAG,CAAC,CAAC;YAC1D,OAAO,GAAG,CAAC,YAAY,CAAC,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,qBAAqB,CAAO,MAAM,CAAC,CAAC,CAAC;QACvG,CAAC,CAAA,CAAC;QArBE,uBAAA,IAAI,iCAAc,SAAS,MAAA,CAAC;IAChC,CAAC;CAqBJ"}
|
|
@@ -78,7 +78,7 @@ export declare class VariableController {
|
|
|
78
78
|
* @param value the new value of the variable
|
|
79
79
|
* @returns
|
|
80
80
|
*/
|
|
81
|
-
setValue: (id: Id, value: string | null) => Promise<import("../types/CommonTypes").EditorResponse<null>>;
|
|
81
|
+
setValue: (id: Id, value: string | boolean | null) => Promise<import("../types/CommonTypes").EditorResponse<null>>;
|
|
82
82
|
/**
|
|
83
83
|
* This method creates a copy of a variable
|
|
84
84
|
* @returns
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"VariableController.js","sourceRoot":"","sources":["../../../src/controllers/VariableController.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;AACA,OAAO,EAIH,uBAAuB,GAE1B,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAE,qBAAqB,EAAE,MAAM,6BAA6B,CAAC;AAEpE;;;GAGG;AACH,MAAM,OAAO,kBAAkB;IAM3B;;OAEG;IACH,YAAY,SAAoB;QARhC;;WAEG;QACH,gDAAsB;QAStB;;;WAGG;QACH,WAAM,GAAG,GAAS,EAAE;YAChB,MAAM,GAAG,GAAG,MAAM,uBAAA,IAAI,qCAAW,CAAC;YAClC,OAAO,GAAG,CAAC,YAAY,EAAE,CAAC,IAAI,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,qBAAqB,CAAa,MAAM,CAAC,CAAC,CAAC;QAC1F,CAAC,CAAA,CAAC;QAEF;;;;WAIG;QACH,YAAO,GAAG,CAAO,EAAU,EAAE,EAAE;YAC3B,MAAM,GAAG,GAAG,MAAM,uBAAA,IAAI,qCAAW,CAAC;YAClC,OAAO,GAAG,CAAC,eAAe,CAAC,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,qBAAqB,CAAW,MAAM,CAAC,CAAC,CAAC;QAC7F,CAAC,CAAA,CAAC;QAEF;;;;WAIG;QACH,cAAS,GAAG,CAAO,IAAY,EAAE,EAAE;YAC/B,MAAM,GAAG,GAAG,MAAM,uBAAA,IAAI,qCAAW,CAAC;YAClC,OAAO,GAAG,CAAC,iBAAiB,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,qBAAqB,CAAW,MAAM,CAAC,CAAC,CAAC;QACjG,CAAC,CAAA,CAAC;QAEF;;;;;WAKG;QACH,WAAM,GAAG,CAAO,QAAgB,EAAE,IAAkB,EAAE,EAAE;YACpD,MAAM,GAAG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,EAAU,EAAE,UAAmB,EAAE,EAAE;YACtD,MAAM,GAAG,GAAG,MAAM,uBAAA,IAAI,qCAAW,CAAC;YAClC,OAAO,GAAG,CAAC,qBAAqB,CAAC,EAAE,EAAE,UAAU,CAAC,CAAC,IAAI,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,qBAAqB,CAAO,MAAM,CAAC,CAAC,CAAC;QAC3G,CAAC,CAAA,CAAC;QAEF;;;;;;WAMG;QACH,cAAS,GAAG,CAAO,EAAU,EAAE,MAA4B,EAAE,EAAE;YAC3D,MAAM,KAAK,GACP,MAAM,IAAI,MAAM,CAAC,IAAI,KAAK,uBAAuB,CAAC,cAAc;gBAC5D,CAAC,CAAE,MAA4C,CAAC,OAAO;gBACvD,CAAC,CAAC,IAAI,CAAC;YAEf,OAAO,IAAI,CAAC,QAAQ,CAAC,EAAE,EAAE,KAAK,CAAC,CAAC;QACpC,CAAC,CAAA,CAAC;QAEF;;;;;;WAMG;QACH,8BAAyB,GAAG,CAAO,EAAU,EAAE,WAAmB,EAAE,EAAE;YAClE,MAAM,GAAG,GAAG,MAAM,uBAAA,IAAI,qCAAW,CAAC;YAClC,OAAO,GAAG,CAAC,yBAAyB,CAAC,EAAE,EAAE,WAAW,CAAC,CAAC,IAAI,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,qBAAqB,CAAO,MAAM,CAAC,CAAC,CAAC;QAChH,CAAC,CAAA,CAAC;QAEF;;;;;WAKG;QACH,iBAAY,GAAG,CAAO,EAAU,EAAE,EAAE;YAChC,OAAO,IAAI,CAAC,QAAQ,CAAC,EAAE,EAAE,IAAI,CAAC,CAAC;QACnC,CAAC,CAAA,CAAC;QAlPE,uBAAA,IAAI,iCAAc,SAAS,MAAA,CAAC;IAChC,CAAC;CAkPJ"}
|
package/lib/src/index.d.ts
CHANGED
|
@@ -1,28 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { FrameController } from './controllers/FrameController';
|
|
3
|
-
import { AnimationController } from './controllers/AnimationController';
|
|
4
|
-
import { LayoutController } from './controllers/LayoutController';
|
|
5
|
-
import { PageController } from './controllers/PageController';
|
|
6
|
-
import { UtilsController } from './controllers/UtilsController';
|
|
7
|
-
import { DocumentController } from './controllers/DocumentController';
|
|
8
|
-
import { DebugController } from './controllers/DebugController';
|
|
9
|
-
import type { ConfigType, EditorAPI } from './types/CommonTypes';
|
|
10
|
-
import { VariableController } from './controllers/VariableController';
|
|
11
|
-
import { ToolController } from './controllers/ToolController';
|
|
12
|
-
import { UndoManagerController } from './controllers/UndoManagerController';
|
|
13
|
-
import { TextStyleController } from './controllers/TextStyleController';
|
|
14
|
-
import { ColorStyleController } from './controllers/ColorStyleController';
|
|
15
|
-
import { ParagraphStyleController } from './controllers/ParagraphStyleController';
|
|
16
|
-
import { ConfigurationController } from './controllers/ConfigurationController';
|
|
17
|
-
import { MediaConnectorController } from './controllers/MediaConnectorController';
|
|
18
|
-
import { FontController } from './controllers/FontController';
|
|
19
|
-
import { ConnectorController } from './controllers/ConnectorController';
|
|
20
|
-
import { FontConnectorController } from './controllers/FontConnectorController';
|
|
21
|
-
import { ExperimentController } from './controllers/ExperimentController';
|
|
22
|
-
import { CharacterStyleController } from './controllers/CharacterStyleController';
|
|
23
|
-
import { CanvasController } from './controllers/CanvasController';
|
|
24
|
-
import { ActionController } from './controllers/ActionController';
|
|
25
|
-
import { ShapeController } from './controllers/ShapeController';
|
|
1
|
+
import { SDK } from './sdk';
|
|
26
2
|
export { FramePropertyNames, LayoutPropertyNames, ToolType, DownloadFormats, EnvironmentType } from './utils/enums';
|
|
27
3
|
export { SlideDirections, ShakeDirections, EaseTypes, TweenTypes, BasicAnimationsEmphasisStyles, } from './types/AnimationTypes';
|
|
28
4
|
export { LayoutType } from './types/LayoutTypes';
|
|
@@ -31,7 +7,7 @@ export { VariableType, ImageVariableSourceType } from './types/VariableTypes';
|
|
|
31
7
|
export { DocumentType } from './types/DocumentTypes';
|
|
32
8
|
export type { LayoutPropertiesType, FrameProperties, LayoutWithFrameProperties, LayoutListItemType, } from './types/LayoutTypes';
|
|
33
9
|
export type { FrameLayoutType, FrameType, Frame, TextFrame, ImageFrame, ShapeFrame, ImageFrameSource, ImageFrameVariableSource, ImageFrameUrlSource, } from './types/FrameTypes';
|
|
34
|
-
export type { Variable, GroupVariable, ImageVariable, LongTextVariable, ShortTextVariable, ListVariable, UrlImageVariableSource, MediaConnectorImageVariableSource, ImageVariableSource, } from './types/VariableTypes';
|
|
10
|
+
export type { Variable, GroupVariable, ImageVariable, LongTextVariable, ShortTextVariable, ListVariable, BooleanVariable, UrlImageVariableSource, MediaConnectorImageVariableSource, ImageVariableSource, } from './types/VariableTypes';
|
|
35
11
|
export type { Color, DocumentColor, ColorUpdate } from './types/ColorStyleTypes';
|
|
36
12
|
export type { DocumentError } from './types/DocumentTypes';
|
|
37
13
|
export type { FrameAnimationType, FrameAnimationPropertiesType, EaseTweenCombinationType, AnimationPlaybackType, BasicAnimationsType, } from './types/AnimationTypes';
|
|
@@ -49,47 +25,4 @@ export * from './types/ConnectorTypes';
|
|
|
49
25
|
export { WellKnownConfigurationKeys } from './types/ConfigurationTypes';
|
|
50
26
|
export * from './types/ActionTypes';
|
|
51
27
|
export * from './types/ShapeTypes';
|
|
52
|
-
export declare class SDK {
|
|
53
|
-
config: ConfigType;
|
|
54
|
-
connection: Connection;
|
|
55
|
-
/**
|
|
56
|
-
* @ignore
|
|
57
|
-
*/
|
|
58
|
-
editorAPI: EditorAPI;
|
|
59
|
-
action: ActionController;
|
|
60
|
-
layout: LayoutController;
|
|
61
|
-
frame: FrameController;
|
|
62
|
-
shape: ShapeController;
|
|
63
|
-
connector: ConnectorController;
|
|
64
|
-
mediaConnector: MediaConnectorController;
|
|
65
|
-
fontConnector: FontConnectorController;
|
|
66
|
-
animation: AnimationController;
|
|
67
|
-
document: DocumentController;
|
|
68
|
-
configuration: ConfigurationController;
|
|
69
|
-
variable: VariableController;
|
|
70
|
-
utils: UtilsController;
|
|
71
|
-
tool: ToolController;
|
|
72
|
-
page: PageController;
|
|
73
|
-
debug: DebugController;
|
|
74
|
-
undoManager: UndoManagerController;
|
|
75
|
-
textStyle: TextStyleController;
|
|
76
|
-
paragraphStyle: ParagraphStyleController;
|
|
77
|
-
characterStyle: CharacterStyleController;
|
|
78
|
-
colorStyle: ColorStyleController;
|
|
79
|
-
font: FontController;
|
|
80
|
-
experiment: ExperimentController;
|
|
81
|
-
canvas: CanvasController;
|
|
82
|
-
private subscriber;
|
|
83
|
-
/**
|
|
84
|
-
* The SDK should be configured clientside and it exposes all controllers to work with in other applications
|
|
85
|
-
* @param config The configuration object where the SDK and editor can get configured
|
|
86
|
-
*/
|
|
87
|
-
constructor(config: ConfigType);
|
|
88
|
-
/**
|
|
89
|
-
* This method will initiate the editor, running this will result in the editor restarting
|
|
90
|
-
* It will generate an iframe in the document
|
|
91
|
-
*/
|
|
92
|
-
loadEditor: () => void;
|
|
93
|
-
setConnection: (newConnection: Connection) => void;
|
|
94
|
-
}
|
|
95
28
|
export default SDK;
|
package/lib/src/index.js
CHANGED
|
@@ -1,32 +1,4 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { FrameController } from './controllers/FrameController';
|
|
3
|
-
import { AnimationController } from './controllers/AnimationController';
|
|
4
|
-
import { LayoutController } from './controllers/LayoutController';
|
|
5
|
-
import { PageController } from './controllers/PageController';
|
|
6
|
-
import { UtilsController } from './controllers/UtilsController';
|
|
7
|
-
import { SubscriberController } from './controllers/SubscriberController';
|
|
8
|
-
import { DocumentController } from './controllers/DocumentController';
|
|
9
|
-
import { DebugController } from './controllers/DebugController';
|
|
10
|
-
import { VariableController } from './controllers/VariableController';
|
|
11
|
-
import { ToolController } from './controllers/ToolController';
|
|
12
|
-
import { UndoManagerController } from './controllers/UndoManagerController';
|
|
13
|
-
import { TextStyleController } from './controllers/TextStyleController';
|
|
14
|
-
import { ColorStyleController } from './controllers/ColorStyleController';
|
|
15
|
-
import { ParagraphStyleController } from './controllers/ParagraphStyleController';
|
|
16
|
-
import { ConfigurationController } from './controllers/ConfigurationController';
|
|
17
|
-
import { MediaConnectorController } from './controllers/MediaConnectorController';
|
|
18
|
-
import { WellKnownConfigurationKeys } from './types/ConfigurationTypes';
|
|
19
|
-
import packageInfo from '../package.json';
|
|
20
|
-
import engineInfo from '../editor-engine.json';
|
|
21
|
-
import { FontController } from './controllers/FontController';
|
|
22
|
-
import { ConnectorController } from './controllers/ConnectorController';
|
|
23
|
-
import { FontConnectorController } from './controllers/FontConnectorController';
|
|
24
|
-
import { ExperimentController } from './controllers/ExperimentController';
|
|
25
|
-
import { CharacterStyleController } from './controllers/CharacterStyleController';
|
|
26
|
-
import { CanvasController } from './controllers/CanvasController';
|
|
27
|
-
import { DocumentType } from './types/DocumentTypes';
|
|
28
|
-
import { ActionController } from './controllers/ActionController';
|
|
29
|
-
import { ShapeController } from './controllers/ShapeController';
|
|
1
|
+
import { SDK } from './sdk';
|
|
30
2
|
export { FramePropertyNames, LayoutPropertyNames, ToolType, DownloadFormats, EnvironmentType } from './utils/enums';
|
|
31
3
|
export { SlideDirections, ShakeDirections, EaseTypes, TweenTypes, BasicAnimationsEmphasisStyles, } from './types/AnimationTypes';
|
|
32
4
|
export { LayoutType } from './types/LayoutTypes';
|
|
@@ -41,117 +13,5 @@ export * from './types/ConnectorTypes';
|
|
|
41
13
|
export { WellKnownConfigurationKeys } from './types/ConfigurationTypes';
|
|
42
14
|
export * from './types/ActionTypes';
|
|
43
15
|
export * from './types/ShapeTypes';
|
|
44
|
-
let connection;
|
|
45
|
-
const FIXED_EDITOR_LINK = 'https://studio-cdn.chiligrafx.com/editor/' + engineInfo.current + '/web';
|
|
46
|
-
export class SDK {
|
|
47
|
-
/**
|
|
48
|
-
* The SDK should be configured clientside and it exposes all controllers to work with in other applications
|
|
49
|
-
* @param config The configuration object where the SDK and editor can get configured
|
|
50
|
-
*/
|
|
51
|
-
constructor(config) {
|
|
52
|
-
/**
|
|
53
|
-
* This method will initiate the editor, running this will result in the editor restarting
|
|
54
|
-
* It will generate an iframe in the document
|
|
55
|
-
*/
|
|
56
|
-
this.loadEditor = () => {
|
|
57
|
-
Connect(this.config.editorLink || FIXED_EDITOR_LINK, {
|
|
58
|
-
onActionsChanged: this.subscriber.onActionsChanged,
|
|
59
|
-
onStateChanged: this.subscriber.onStateChanged,
|
|
60
|
-
onDocumentLoaded: this.subscriber.onDocumentLoaded,
|
|
61
|
-
onSelectedFrameContentChanged: this.subscriber.onSelectedFrameContentChanged,
|
|
62
|
-
onSelectedFrameLayoutChanged: this.subscriber.onSelectedFrameLayoutChanged,
|
|
63
|
-
onSelectedLayoutPropertiesChanged: this.subscriber.onSelectedLayoutPropertiesChanged,
|
|
64
|
-
onPageSelectionChanged: this.subscriber.onPageSelectionChanged,
|
|
65
|
-
onScrubberPositionChanged: this.subscriber.onAnimationPlaybackChanged,
|
|
66
|
-
onFrameAnimationsChanged: this.subscriber.onAnimationChanged,
|
|
67
|
-
onVariableListChanged: this.subscriber.onVariableListChanged,
|
|
68
|
-
onSelectedToolChanged: this.subscriber.onSelectedToolChanged,
|
|
69
|
-
onUndoStateChanged: this.subscriber.onUndoStateChanged,
|
|
70
|
-
onSelectedLayoutFramesChanged: this.subscriber.onSelectedLayoutFramesChanged,
|
|
71
|
-
onSelectedTextStyleChanged: this.subscriber.onSelectedTextStyleChanged,
|
|
72
|
-
onColorsChanged: this.subscriber.onColorsChanged,
|
|
73
|
-
onParagraphStylesChanged: this.subscriber.onParagraphStylesChanged,
|
|
74
|
-
onCharacterStylesChanged: this.subscriber.onCharacterStylesChanged,
|
|
75
|
-
onFontsChanged: this.subscriber.onFontsChanged,
|
|
76
|
-
onSelectedLayoutIdChanged: this.subscriber.onSelectedLayoutIdChanged,
|
|
77
|
-
onLayoutsChanged: this.subscriber.onLayoutsChanged,
|
|
78
|
-
onConnectorEvent: this.subscriber.onConnectorEvent,
|
|
79
|
-
onZoomChanged: this.subscriber.onZoomChanged,
|
|
80
|
-
onPageSizeChanged: this.subscriber.onPageSizeChanged,
|
|
81
|
-
onShapeCornerRadiusChanged: this.subscriber.onShapeCornerRadiusChanged,
|
|
82
|
-
onCropActiveFrameIdChanged: this.subscriber.onCropActiveFrameIdChanged,
|
|
83
|
-
}, this.setConnection, this.config.editorId, this.config.studioStyling);
|
|
84
|
-
this.editorAPI = connection === null || connection === void 0 ? void 0 : connection.promise.then((editorAPI) => {
|
|
85
|
-
return editorAPI;
|
|
86
|
-
});
|
|
87
|
-
this.action = new ActionController(this.editorAPI);
|
|
88
|
-
this.layout = new LayoutController(this.editorAPI);
|
|
89
|
-
this.frame = new FrameController(this.editorAPI);
|
|
90
|
-
this.animation = new AnimationController(this.editorAPI);
|
|
91
|
-
this.document = new DocumentController(this.editorAPI);
|
|
92
|
-
this.configuration = new ConfigurationController(this.editorAPI);
|
|
93
|
-
this.variable = new VariableController(this.editorAPI);
|
|
94
|
-
this.utils = new UtilsController();
|
|
95
|
-
this.tool = new ToolController(this.editorAPI);
|
|
96
|
-
this.page = new PageController(this.editorAPI);
|
|
97
|
-
this.debug = new DebugController(this.editorAPI);
|
|
98
|
-
this.undoManager = new UndoManagerController(this.editorAPI);
|
|
99
|
-
this.textStyle = new TextStyleController(this.editorAPI);
|
|
100
|
-
this.colorStyle = new ColorStyleController(this.editorAPI);
|
|
101
|
-
this.paragraphStyle = new ParagraphStyleController(this.editorAPI);
|
|
102
|
-
this.characterStyle = new CharacterStyleController(this.editorAPI);
|
|
103
|
-
this.mediaConnector = new MediaConnectorController(this.editorAPI);
|
|
104
|
-
this.fontConnector = new FontConnectorController(this.editorAPI);
|
|
105
|
-
this.connector = new ConnectorController(this.editorAPI);
|
|
106
|
-
this.font = new FontController(this.editorAPI);
|
|
107
|
-
this.experiment = new ExperimentController(this.editorAPI);
|
|
108
|
-
this.canvas = new CanvasController(this.editorAPI);
|
|
109
|
-
this.shape = new ShapeController(this.editorAPI);
|
|
110
|
-
// as soon as the editor loads, provide it with the SDK version
|
|
111
|
-
// used to make it start. This enables engine compatibility checks
|
|
112
|
-
// on the Flutter side
|
|
113
|
-
this.configuration.setValue(WellKnownConfigurationKeys.GraFxStudioSdkVersion, packageInfo.version);
|
|
114
|
-
// Makes the engine aware which document type it should render, if this call
|
|
115
|
-
// isn't made, the engine will fall back to the type specified in the document.
|
|
116
|
-
//
|
|
117
|
-
// Loading a template JSON and setting the engine to `project` will cause
|
|
118
|
-
// the document JSON structure to be converted to a project on save.
|
|
119
|
-
// Using `getCurrentDocumentState` will also output the converted document.
|
|
120
|
-
this.configuration.setValue(WellKnownConfigurationKeys.GraFxStudioDocumentType, this.config.documentType || DocumentType.template);
|
|
121
|
-
};
|
|
122
|
-
this.setConnection = (newConnection) => {
|
|
123
|
-
connection = newConnection;
|
|
124
|
-
};
|
|
125
|
-
this.config = config;
|
|
126
|
-
this.connection = connection;
|
|
127
|
-
this.editorAPI = connection === null || connection === void 0 ? void 0 : connection.promise.then((child) => {
|
|
128
|
-
return child;
|
|
129
|
-
});
|
|
130
|
-
this.action = new ActionController(this.editorAPI);
|
|
131
|
-
this.layout = new LayoutController(this.editorAPI);
|
|
132
|
-
this.frame = new FrameController(this.editorAPI);
|
|
133
|
-
this.shape = new ShapeController(this.editorAPI);
|
|
134
|
-
this.connector = new ConnectorController(this.editorAPI);
|
|
135
|
-
this.mediaConnector = new MediaConnectorController(this.editorAPI);
|
|
136
|
-
this.fontConnector = new FontConnectorController(this.editorAPI);
|
|
137
|
-
this.animation = new AnimationController(this.editorAPI);
|
|
138
|
-
this.document = new DocumentController(this.editorAPI);
|
|
139
|
-
this.configuration = new ConfigurationController(this.editorAPI);
|
|
140
|
-
this.variable = new VariableController(this.editorAPI);
|
|
141
|
-
this.utils = new UtilsController();
|
|
142
|
-
this.subscriber = new SubscriberController(this.config);
|
|
143
|
-
this.tool = new ToolController(this.editorAPI);
|
|
144
|
-
this.page = new PageController(this.editorAPI);
|
|
145
|
-
this.debug = new DebugController(this.editorAPI);
|
|
146
|
-
this.undoManager = new UndoManagerController(this.editorAPI);
|
|
147
|
-
this.textStyle = new TextStyleController(this.editorAPI);
|
|
148
|
-
this.colorStyle = new ColorStyleController(this.editorAPI);
|
|
149
|
-
this.paragraphStyle = new ParagraphStyleController(this.editorAPI);
|
|
150
|
-
this.characterStyle = new CharacterStyleController(this.editorAPI);
|
|
151
|
-
this.font = new FontController(this.editorAPI);
|
|
152
|
-
this.experiment = new ExperimentController(this.editorAPI);
|
|
153
|
-
this.canvas = new CanvasController(this.editorAPI);
|
|
154
|
-
}
|
|
155
|
-
}
|
|
156
16
|
export default SDK;
|
|
157
17
|
//# sourceMappingURL=index.js.map
|
package/lib/src/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,OAAO,CAAC;AAE5B,OAAO,EAAE,kBAAkB,EAAE,mBAAmB,EAAE,QAAQ,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAEpH,OAAO,EACH,eAAe,EACf,eAAe,EACf,SAAS,EACT,UAAU,EACV,6BAA6B,GAChC,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACjD,OAAO,EACH,SAAS,EACT,aAAa,EACb,aAAa,EACb,aAAa,EACb,aAAa,EACb,OAAO,EACP,kBAAkB,EAClB,mBAAmB,GACtB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,YAAY,EAAE,uBAAuB,EAAE,MAAM,uBAAuB,CAAC;AAC9E,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAmErD,OAAO,EACH,yBAAyB,EACzB,kBAAkB,EAClB,WAAW,EACX,SAAS,EACT,YAAY,EACZ,IAAI,EACJ,SAAS,GACZ,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AACpD,cAAc,6BAA6B,CAAC;AAC5C,cAAc,4BAA4B,CAAC;AAC3C,cAAc,wBAAwB,CAAC;AAEvC,OAAO,EAAE,0BAA0B,EAAE,MAAM,4BAA4B,CAAC;AAExE,cAAc,qBAAqB,CAAC;AAEpC,cAAc,oBAAoB,CAAC;AAEnC,eAAe,GAAG,CAAC"}
|
|
@@ -20,21 +20,23 @@ export const setupFrame = (iframe, editorLink, styling) => {
|
|
|
20
20
|
<head>
|
|
21
21
|
<base href="/" />
|
|
22
22
|
<meta charset="UTF-8"/>
|
|
23
|
-
<!-- use this property to override the location of assets like 'default fonts' and demo document -->
|
|
24
|
-
<meta name="assetBase" content="${link}">
|
|
25
23
|
<!-- use this property to pass the StudioStyling to the engine -->
|
|
26
24
|
<meta name="studio-styling" content=${stylingJson}>
|
|
27
25
|
</head>
|
|
28
26
|
<body>
|
|
29
|
-
<script
|
|
30
|
-
<script
|
|
31
|
-
<script
|
|
32
|
-
|
|
27
|
+
<script src="${link}init.js" async></script>
|
|
28
|
+
<script src="${link}init_engine.js"></script>
|
|
29
|
+
<script>
|
|
30
|
+
initializeStudioEngine({
|
|
31
|
+
assetBase: '${link}',
|
|
32
|
+
entryPointUrl: '${link}main.dart.js',
|
|
33
|
+
});
|
|
34
|
+
</script>
|
|
33
35
|
</body>
|
|
34
36
|
</html>
|
|
35
37
|
`;
|
|
36
38
|
// eslint-disable-next-line no-param-reassign
|
|
37
|
-
iframe.srcdoc = '
|
|
39
|
+
iframe.srcdoc = 'placeholder';
|
|
38
40
|
let iframeDoc = iframe.ownerDocument;
|
|
39
41
|
if (iframe.contentWindow) {
|
|
40
42
|
iframeDoc = iframe.contentWindow.document;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"connector.js","sourceRoot":"","sources":["../../../src/interactions/connector.ts"],"names":[],"mappings":"AAAA,OAAO,EAAc,cAAc,EAAE,MAAM,QAAQ,CAAC;AAIpD,MA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,EAAE,MAAM,CAAC,wBAAwB;YACvD,mBAAmB,EAAE,MAAM,CAAC,qBAAqB;YACjD,mBAAmB,EAAE,MAAM,CAAC,qBAAqB;YACjD,qBAAqB,EAAE,MAAM,CAAC,kBAAkB;YAChD,2BAA2B,EAAE,MAAM,CAAC,6BAA6B;YACjE,wBAAwB,EAAE,MAAM,CAAC,0BAA0B;YAC3D,aAAa,EAAE,MAAM,CAAC,eAAe;YACrC,sBAAsB,EAAE,MAAM,CAAC,wBAAwB;YACvD,sBAAsB,EAAE,MAAM,CAAC,wBAAwB;YACvD,YAAY,EAAE,MAAM,CAAC,cAAc;YACnC,gBAAgB,EAAE,MAAM,CAAC,yBAAyB;YAClD,iBAAiB,EAAE,MAAM,CAAC,gBAAgB;YAC1C,cAAc,EAAE,MAAM,CAAC,gBAAgB;YACvC,WAAW,EAAE,MAAM,CAAC,aAAa;YACjC,eAAe,EAAE,MAAM,CAAC,iBAAiB;YACzC,wBAAwB,EAAE,MAAM,CAAC,0BAA0B;YAC3D,wBAAwB,EAAE,MAAM,CAAC,0BAA0B;SAC9D;KACJ,CAAC,CACL,CAAC;AACN,CAAC,CAAC;AACF,eAAe,OAAO,CAAC"}
|
package/lib/src/sdk.d.ts
ADDED
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { Connection } from 'penpal';
|
|
2
|
+
import type { ConfigType, EditorAPI } from './types/CommonTypes';
|
|
3
|
+
import { ActionController } from './controllers/ActionController';
|
|
4
|
+
import { AnimationController } from './controllers/AnimationController';
|
|
5
|
+
import { CanvasController } from './controllers/CanvasController';
|
|
6
|
+
import { CharacterStyleController } from './controllers/CharacterStyleController';
|
|
7
|
+
import { ColorStyleController } from './controllers/ColorStyleController';
|
|
8
|
+
import { ConfigurationController } from './controllers/ConfigurationController';
|
|
9
|
+
import { ConnectorController } from './controllers/ConnectorController';
|
|
10
|
+
import { DebugController } from './controllers/DebugController';
|
|
11
|
+
import { DocumentController } from './controllers/DocumentController';
|
|
12
|
+
import { ExperimentController } from './controllers/ExperimentController';
|
|
13
|
+
import { FontConnectorController } from './controllers/FontConnectorController';
|
|
14
|
+
import { FontController } from './controllers/FontController';
|
|
15
|
+
import { FrameController } from './controllers/FrameController';
|
|
16
|
+
import { LayoutController } from './controllers/LayoutController';
|
|
17
|
+
import { MediaConnectorController } from './controllers/MediaConnectorController';
|
|
18
|
+
import { PageController } from './controllers/PageController';
|
|
19
|
+
import { ParagraphStyleController } from './controllers/ParagraphStyleController';
|
|
20
|
+
import { TextStyleController } from './controllers/TextStyleController';
|
|
21
|
+
import { ToolController } from './controllers/ToolController';
|
|
22
|
+
import { UndoManagerController } from './controllers/UndoManagerController';
|
|
23
|
+
import { UtilsController } from './controllers/UtilsController';
|
|
24
|
+
import { VariableController } from './controllers/VariableController';
|
|
25
|
+
import { ShapeController } from './controllers/ShapeController';
|
|
26
|
+
export declare class SDK {
|
|
27
|
+
config: ConfigType;
|
|
28
|
+
connection: Connection;
|
|
29
|
+
/**
|
|
30
|
+
* @ignore
|
|
31
|
+
*/
|
|
32
|
+
editorAPI: EditorAPI;
|
|
33
|
+
action: ActionController;
|
|
34
|
+
layout: LayoutController;
|
|
35
|
+
frame: FrameController;
|
|
36
|
+
shape: ShapeController;
|
|
37
|
+
connector: ConnectorController;
|
|
38
|
+
mediaConnector: MediaConnectorController;
|
|
39
|
+
fontConnector: FontConnectorController;
|
|
40
|
+
animation: AnimationController;
|
|
41
|
+
document: DocumentController;
|
|
42
|
+
configuration: ConfigurationController;
|
|
43
|
+
variable: VariableController;
|
|
44
|
+
utils: UtilsController;
|
|
45
|
+
tool: ToolController;
|
|
46
|
+
page: PageController;
|
|
47
|
+
debug: DebugController;
|
|
48
|
+
undoManager: UndoManagerController;
|
|
49
|
+
textSelection: TextStyleController;
|
|
50
|
+
paragraphStyle: ParagraphStyleController;
|
|
51
|
+
characterStyle: CharacterStyleController;
|
|
52
|
+
colorStyle: ColorStyleController;
|
|
53
|
+
font: FontController;
|
|
54
|
+
experiment: ExperimentController;
|
|
55
|
+
canvas: CanvasController;
|
|
56
|
+
private subscriber;
|
|
57
|
+
/**
|
|
58
|
+
* The SDK should be configured clientside and it exposes all controllers to work with in other applications
|
|
59
|
+
* @param config The configuration object where the SDK and editor can get configured
|
|
60
|
+
*/
|
|
61
|
+
constructor(config: ConfigType);
|
|
62
|
+
/**
|
|
63
|
+
* This method will initiate the editor, running this will result in the editor restarting
|
|
64
|
+
* It will generate an iframe in the document
|
|
65
|
+
*/
|
|
66
|
+
loadEditor: () => void;
|
|
67
|
+
setConnection: (newConnection: Connection) => void;
|
|
68
|
+
}
|
|
69
|
+
export default SDK;
|