@chili-publish/studio-sdk 0.121.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/LICENSE +21 -0
- package/README.md +89 -0
- package/_bundles/main.js +3 -0
- package/_bundles/main.js.LICENSE.txt +14 -0
- package/_bundles/main.js.map +1 -0
- package/_bundles/report.html +38 -0
- package/lib/editor-engine.json +3 -0
- package/lib/package.json +89 -0
- package/lib/src/controllers/ActionController.d.ts +38 -0
- package/lib/src/controllers/ActionController.js +79 -0
- package/lib/src/controllers/ActionController.js.map +1 -0
- package/lib/src/controllers/AnimationController.d.ts +70 -0
- package/lib/src/controllers/AnimationController.js +135 -0
- package/lib/src/controllers/AnimationController.js.map +1 -0
- package/lib/src/controllers/CanvasController.d.ts +34 -0
- package/lib/src/controllers/CanvasController.js +71 -0
- package/lib/src/controllers/CanvasController.js.map +1 -0
- package/lib/src/controllers/CharacterStyleController.d.ts +55 -0
- package/lib/src/controllers/CharacterStyleController.js +107 -0
- package/lib/src/controllers/CharacterStyleController.js.map +1 -0
- package/lib/src/controllers/ColorStyleController.d.ts +62 -0
- package/lib/src/controllers/ColorStyleController.js +113 -0
- package/lib/src/controllers/ColorStyleController.js.map +1 -0
- package/lib/src/controllers/ConfigurationController.d.ts +27 -0
- package/lib/src/controllers/ConfigurationController.js +60 -0
- package/lib/src/controllers/ConfigurationController.js.map +1 -0
- package/lib/src/controllers/ConnectorController.d.ts +90 -0
- package/lib/src/controllers/ConnectorController.js +196 -0
- package/lib/src/controllers/ConnectorController.js.map +1 -0
- package/lib/src/controllers/DebugController.d.ts +33 -0
- package/lib/src/controllers/DebugController.js +72 -0
- package/lib/src/controllers/DebugController.js.map +1 -0
- package/lib/src/controllers/DocumentController.d.ts +40 -0
- package/lib/src/controllers/DocumentController.js +163 -0
- package/lib/src/controllers/DocumentController.js.map +1 -0
- package/lib/src/controllers/ExperimentController.d.ts +39 -0
- package/lib/src/controllers/ExperimentController.js +83 -0
- package/lib/src/controllers/ExperimentController.js.map +1 -0
- package/lib/src/controllers/FontConnectorController.d.ts +95 -0
- package/lib/src/controllers/FontConnectorController.js +168 -0
- package/lib/src/controllers/FontConnectorController.js.map +1 -0
- package/lib/src/controllers/FontController.d.ts +50 -0
- package/lib/src/controllers/FontController.js +95 -0
- package/lib/src/controllers/FontController.js.map +1 -0
- package/lib/src/controllers/FrameController.d.ts +369 -0
- package/lib/src/controllers/FrameController.js +599 -0
- package/lib/src/controllers/FrameController.js.map +1 -0
- package/lib/src/controllers/LayoutController.d.ts +103 -0
- package/lib/src/controllers/LayoutController.js +190 -0
- package/lib/src/controllers/LayoutController.js.map +1 -0
- package/lib/src/controllers/MediaConnectorController.d.ts +95 -0
- package/lib/src/controllers/MediaConnectorController.js +170 -0
- package/lib/src/controllers/MediaConnectorController.js.map +1 -0
- package/lib/src/controllers/PageController.d.ts +40 -0
- package/lib/src/controllers/PageController.js +92 -0
- package/lib/src/controllers/PageController.js.map +1 -0
- package/lib/src/controllers/ParagraphStyleController.d.ts +62 -0
- package/lib/src/controllers/ParagraphStyleController.js +117 -0
- package/lib/src/controllers/ParagraphStyleController.js.map +1 -0
- package/lib/src/controllers/ShapeController.d.ts +104 -0
- package/lib/src/controllers/ShapeController.js +174 -0
- package/lib/src/controllers/ShapeController.js.map +1 -0
- package/lib/src/controllers/SubscriberController.d.ts +143 -0
- package/lib/src/controllers/SubscriberController.js +213 -0
- package/lib/src/controllers/SubscriberController.js.map +1 -0
- package/lib/src/controllers/TextStyleController.d.ts +31 -0
- package/lib/src/controllers/TextStyleController.js +71 -0
- package/lib/src/controllers/TextStyleController.js.map +1 -0
- package/lib/src/controllers/ToolController.d.ts +54 -0
- package/lib/src/controllers/ToolController.js +104 -0
- package/lib/src/controllers/ToolController.js.map +1 -0
- package/lib/src/controllers/UndoManagerController.d.ts +22 -0
- package/lib/src/controllers/UndoManagerController.js +56 -0
- package/lib/src/controllers/UndoManagerController.js.map +1 -0
- package/lib/src/controllers/UtilsController.d.ts +20 -0
- package/lib/src/controllers/UtilsController.js +35 -0
- package/lib/src/controllers/UtilsController.js.map +1 -0
- package/lib/src/controllers/VariableController.d.ts +117 -0
- package/lib/src/controllers/VariableController.js +205 -0
- package/lib/src/controllers/VariableController.js.map +1 -0
- package/lib/src/index.d.ts +93 -0
- package/lib/src/index.js +154 -0
- package/lib/src/index.js.map +1 -0
- package/lib/src/interactions/connector.d.ts +31 -0
- package/lib/src/interactions/connector.js +99 -0
- package/lib/src/interactions/connector.js.map +1 -0
- package/lib/src/setupTests.d.ts +1 -0
- package/lib/src/setupTests.js +2 -0
- package/lib/src/setupTests.js.map +1 -0
- package/lib/src/tests/__mocks__/FrameProperties.d.ts +52 -0
- package/lib/src/tests/__mocks__/FrameProperties.js +20 -0
- package/lib/src/tests/__mocks__/FrameProperties.js.map +1 -0
- package/lib/src/tests/__mocks__/MockImageFrameSource.d.ts +4 -0
- package/lib/src/tests/__mocks__/MockImageFrameSource.js +15 -0
- package/lib/src/tests/__mocks__/MockImageFrameSource.js.map +1 -0
- package/lib/src/tests/__mocks__/animations.d.ts +2 -0
- package/lib/src/tests/__mocks__/animations.js +10 -0
- package/lib/src/tests/__mocks__/animations.js.map +1 -0
- package/lib/src/tests/__mocks__/config.d.ts +5 -0
- package/lib/src/tests/__mocks__/config.js +31 -0
- package/lib/src/tests/__mocks__/config.js.map +1 -0
- package/lib/src/tests/__mocks__/mockDocument.d.ts +1 -0
- package/lib/src/tests/__mocks__/mockDocument.js +2 -0
- package/lib/src/tests/__mocks__/mockDocument.js.map +1 -0
- package/lib/src/tests/controllers/ActionController.test.d.ts +1 -0
- package/lib/src/tests/controllers/ActionController.test.js +61 -0
- package/lib/src/tests/controllers/ActionController.test.js.map +1 -0
- package/lib/src/tests/controllers/AnimationController.test.d.ts +1 -0
- package/lib/src/tests/controllers/AnimationController.test.js +91 -0
- package/lib/src/tests/controllers/AnimationController.test.js.map +1 -0
- package/lib/src/tests/controllers/CanvasController.test.d.ts +1 -0
- package/lib/src/tests/controllers/CanvasController.test.js +50 -0
- package/lib/src/tests/controllers/CanvasController.test.js.map +1 -0
- package/lib/src/tests/controllers/CharacterStyleController.test.d.ts +1 -0
- package/lib/src/tests/controllers/CharacterStyleController.test.js +125 -0
- package/lib/src/tests/controllers/CharacterStyleController.test.js.map +1 -0
- package/lib/src/tests/controllers/ColorStyleController.test.d.ts +1 -0
- package/lib/src/tests/controllers/ColorStyleController.test.js +83 -0
- package/lib/src/tests/controllers/ColorStyleController.test.js.map +1 -0
- package/lib/src/tests/controllers/ConfigurationConnectorController.test.d.ts +1 -0
- package/lib/src/tests/controllers/ConfigurationConnectorController.test.js +39 -0
- package/lib/src/tests/controllers/ConfigurationConnectorController.test.js.map +1 -0
- package/lib/src/tests/controllers/ConnectorController.test.d.ts +1 -0
- package/lib/src/tests/controllers/ConnectorController.test.js +77 -0
- package/lib/src/tests/controllers/ConnectorController.test.js.map +1 -0
- package/lib/src/tests/controllers/DebugController.test.d.ts +1 -0
- package/lib/src/tests/controllers/DebugController.test.js +47 -0
- package/lib/src/tests/controllers/DebugController.test.js.map +1 -0
- package/lib/src/tests/controllers/DocumentController.test.d.ts +1 -0
- package/lib/src/tests/controllers/DocumentController.test.js +170 -0
- package/lib/src/tests/controllers/DocumentController.test.js.map +1 -0
- package/lib/src/tests/controllers/ExperimentController.test.d.ts +1 -0
- package/lib/src/tests/controllers/ExperimentController.test.js +53 -0
- package/lib/src/tests/controllers/ExperimentController.test.js.map +1 -0
- package/lib/src/tests/controllers/FontConnectorController.test.d.ts +1 -0
- package/lib/src/tests/controllers/FontConnectorController.test.js +109 -0
- package/lib/src/tests/controllers/FontConnectorController.test.js.map +1 -0
- package/lib/src/tests/controllers/FontController.test.d.ts +1 -0
- package/lib/src/tests/controllers/FontController.test.js +73 -0
- package/lib/src/tests/controllers/FontController.test.js.map +1 -0
- package/lib/src/tests/controllers/FrameController.test.d.ts +1 -0
- package/lib/src/tests/controllers/FrameController.test.js +408 -0
- package/lib/src/tests/controllers/FrameController.test.js.map +1 -0
- package/lib/src/tests/controllers/LayoutController.test.d.ts +1 -0
- package/lib/src/tests/controllers/LayoutController.test.js +144 -0
- package/lib/src/tests/controllers/LayoutController.test.js.map +1 -0
- package/lib/src/tests/controllers/MediaConnectorController.test.d.ts +1 -0
- package/lib/src/tests/controllers/MediaConnectorController.test.js +109 -0
- package/lib/src/tests/controllers/MediaConnectorController.test.js.map +1 -0
- package/lib/src/tests/controllers/PageController.test.d.ts +1 -0
- package/lib/src/tests/controllers/PageController.test.js +58 -0
- package/lib/src/tests/controllers/PageController.test.js.map +1 -0
- package/lib/src/tests/controllers/ParagraphStyleController.test.d.ts +1 -0
- package/lib/src/tests/controllers/ParagraphStyleController.test.js +139 -0
- package/lib/src/tests/controllers/ParagraphStyleController.test.js.map +1 -0
- package/lib/src/tests/controllers/ShapeController.test.d.ts +1 -0
- package/lib/src/tests/controllers/ShapeController.test.js +102 -0
- package/lib/src/tests/controllers/ShapeController.test.js.map +1 -0
- package/lib/src/tests/controllers/SubscriberContoller.test.d.ts +1 -0
- package/lib/src/tests/controllers/SubscriberContoller.test.js +201 -0
- package/lib/src/tests/controllers/SubscriberContoller.test.js.map +1 -0
- package/lib/src/tests/controllers/TextStyleController.test.d.ts +1 -0
- package/lib/src/tests/controllers/TextStyleController.test.js +43 -0
- package/lib/src/tests/controllers/TextStyleController.test.js.map +1 -0
- package/lib/src/tests/controllers/ToolController.test.d.ts +1 -0
- package/lib/src/tests/controllers/ToolController.test.js +72 -0
- package/lib/src/tests/controllers/ToolController.test.js.map +1 -0
- package/lib/src/tests/controllers/UndoManagerController.test.d.ts +1 -0
- package/lib/src/tests/controllers/UndoManagerController.test.js +35 -0
- package/lib/src/tests/controllers/UndoManagerController.test.js.map +1 -0
- package/lib/src/tests/controllers/UtilsController.test.d.ts +1 -0
- package/lib/src/tests/controllers/UtilsController.test.js +33 -0
- package/lib/src/tests/controllers/UtilsController.test.js.map +1 -0
- package/lib/src/tests/controllers/VariableController.test.d.ts +1 -0
- package/lib/src/tests/controllers/VariableController.test.js +161 -0
- package/lib/src/tests/controllers/VariableController.test.js.map +1 -0
- package/lib/src/tests/index.test.d.ts +1 -0
- package/lib/src/tests/index.test.js +26 -0
- package/lib/src/tests/index.test.js.map +1 -0
- package/lib/src/tests/interactions/connector.test.d.ts +1 -0
- package/lib/src/tests/interactions/connector.test.js +24 -0
- package/lib/src/tests/interactions/connector.test.js.map +1 -0
- package/lib/src/tests/utils/editorResponseData.test.d.ts +1 -0
- package/lib/src/tests/utils/editorResponseData.test.js +48 -0
- package/lib/src/tests/utils/editorResponseData.test.js.map +1 -0
- package/lib/src/tests/utils/getClaculatedValue.test.d.ts +1 -0
- package/lib/src/tests/utils/getClaculatedValue.test.js +78 -0
- package/lib/src/tests/utils/getClaculatedValue.test.js.map +1 -0
- package/lib/src/tests/utils/getFetchUrls.test.d.ts +1 -0
- package/lib/src/tests/utils/getFetchUrls.test.js +10 -0
- package/lib/src/tests/utils/getFetchUrls.test.js.map +1 -0
- package/lib/src/tests/utils/round.test.d.ts +1 -0
- package/lib/src/tests/utils/round.test.js +16 -0
- package/lib/src/tests/utils/round.test.js.map +1 -0
- package/lib/src/types/ActionTypes.d.ts +63 -0
- package/lib/src/types/ActionTypes.js +29 -0
- package/lib/src/types/ActionTypes.js.map +1 -0
- package/lib/src/types/AnimationTypes.d.ts +111 -0
- package/lib/src/types/AnimationTypes.js +49 -0
- package/lib/src/types/AnimationTypes.js.map +1 -0
- package/lib/src/types/CharacterStyleTypes.d.ts +65 -0
- package/lib/src/types/CharacterStyleTypes.js +2 -0
- package/lib/src/types/CharacterStyleTypes.js.map +1 -0
- package/lib/src/types/ColorStyleTypes.d.ts +73 -0
- package/lib/src/types/ColorStyleTypes.js +24 -0
- package/lib/src/types/ColorStyleTypes.js.map +1 -0
- package/lib/src/types/CommonTypes.d.ts +92 -0
- package/lib/src/types/CommonTypes.js +2 -0
- package/lib/src/types/CommonTypes.js.map +1 -0
- package/lib/src/types/ConfigurationTypes.d.ts +6 -0
- package/lib/src/types/ConfigurationTypes.js +8 -0
- package/lib/src/types/ConfigurationTypes.js.map +1 -0
- package/lib/src/types/ConnectorTypes.d.ts +115 -0
- package/lib/src/types/ConnectorTypes.js +94 -0
- package/lib/src/types/ConnectorTypes.js.map +1 -0
- package/lib/src/types/DebugTypes.d.ts +25 -0
- package/lib/src/types/DebugTypes.js +8 -0
- package/lib/src/types/DebugTypes.js.map +1 -0
- package/lib/src/types/DocumentTypes.d.ts +180 -0
- package/lib/src/types/DocumentTypes.js +17 -0
- package/lib/src/types/DocumentTypes.js.map +1 -0
- package/lib/src/types/FontConnectorTypes.d.ts +20 -0
- package/lib/src/types/FontConnectorTypes.js +6 -0
- package/lib/src/types/FontConnectorTypes.js.map +1 -0
- package/lib/src/types/FontTypes.d.ts +15 -0
- package/lib/src/types/FontTypes.js +2 -0
- package/lib/src/types/FontTypes.js.map +1 -0
- package/lib/src/types/FrameTypes.d.ts +156 -0
- package/lib/src/types/FrameTypes.js +63 -0
- package/lib/src/types/FrameTypes.js.map +1 -0
- package/lib/src/types/LayoutTypes.d.ts +61 -0
- package/lib/src/types/LayoutTypes.js +6 -0
- package/lib/src/types/LayoutTypes.js.map +1 -0
- package/lib/src/types/MediaConnectorTypes.d.ts +20 -0
- package/lib/src/types/MediaConnectorTypes.js +6 -0
- package/lib/src/types/MediaConnectorTypes.js.map +1 -0
- package/lib/src/types/PageTypes.d.ts +12 -0
- package/lib/src/types/PageTypes.js +2 -0
- package/lib/src/types/PageTypes.js.map +1 -0
- package/lib/src/types/ParagraphStyleTypes.d.ts +79 -0
- package/lib/src/types/ParagraphStyleTypes.js +2 -0
- package/lib/src/types/ParagraphStyleTypes.js.map +1 -0
- package/lib/src/types/ShapeTypes.d.ts +26 -0
- package/lib/src/types/ShapeTypes.js +13 -0
- package/lib/src/types/ShapeTypes.js.map +1 -0
- package/lib/src/types/TextStyleTypes.d.ts +131 -0
- package/lib/src/types/TextStyleTypes.js +68 -0
- package/lib/src/types/TextStyleTypes.js.map +1 -0
- package/lib/src/types/VariableTypes.d.ts +45 -0
- package/lib/src/types/VariableTypes.js +13 -0
- package/lib/src/types/VariableTypes.js.map +1 -0
- package/lib/src/utils/EditorResponseData.d.ts +3 -0
- package/lib/src/utils/EditorResponseData.js +16 -0
- package/lib/src/utils/EditorResponseData.js.map +1 -0
- package/lib/src/utils/enums.d.ts +30 -0
- package/lib/src/utils/enums.js +36 -0
- package/lib/src/utils/enums.js.map +1 -0
- package/lib/src/utils/getCalculatedValue.d.ts +2 -0
- package/lib/src/utils/getCalculatedValue.js +20 -0
- package/lib/src/utils/getCalculatedValue.js.map +1 -0
- package/lib/src/utils/getFetchUrl.d.ts +2 -0
- package/lib/src/utils/getFetchUrl.js +3 -0
- package/lib/src/utils/getFetchUrl.js.map +1 -0
- package/package.json +89 -0
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
|
|
11
|
+
if (kind === "m") throw new TypeError("Private method is not writable");
|
|
12
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
|
13
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
14
|
+
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
|
15
|
+
};
|
|
16
|
+
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
|
17
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
18
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
19
|
+
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
20
|
+
};
|
|
21
|
+
var _ExperimentController_editorAPI;
|
|
22
|
+
import { getEditorResponseData } from '../utils/EditorResponseData';
|
|
23
|
+
import { ImageSourceTypeEnum } from '../types/FrameTypes';
|
|
24
|
+
/**
|
|
25
|
+
* The ExperimentController contains all SDK functions that are considered for addition,
|
|
26
|
+
* or functions we want to keep open for changing definitions. This is a sneak peak
|
|
27
|
+
* into future versions of the SDK. Never build production code relying on functions in
|
|
28
|
+
* this controller.
|
|
29
|
+
*/
|
|
30
|
+
export class ExperimentController {
|
|
31
|
+
/**
|
|
32
|
+
* @ignore
|
|
33
|
+
*/
|
|
34
|
+
constructor(editorAPI) {
|
|
35
|
+
/**
|
|
36
|
+
* @ignore
|
|
37
|
+
*/
|
|
38
|
+
_ExperimentController_editorAPI.set(this, void 0);
|
|
39
|
+
/**
|
|
40
|
+
* This method will assign an image from a variable to the correct ImageFrame
|
|
41
|
+
* @param imageFrameId The ID of the imageFrame where an image needs to be assigned to
|
|
42
|
+
* @param variableId The ID of the variable which contains the image
|
|
43
|
+
* @returns
|
|
44
|
+
*/
|
|
45
|
+
this.insertImageVariableToFrame = (imageFrameId, variableId) => __awaiter(this, void 0, void 0, function* () {
|
|
46
|
+
const res = yield __classPrivateFieldGet(this, _ExperimentController_editorAPI, "f");
|
|
47
|
+
const src = { variableId: variableId, sourceType: ImageSourceTypeEnum.variable };
|
|
48
|
+
return res
|
|
49
|
+
.setImageSource(imageFrameId, JSON.stringify(src))
|
|
50
|
+
.then((result) => getEditorResponseData(result));
|
|
51
|
+
});
|
|
52
|
+
/**
|
|
53
|
+
* This method will insert a text variable in the selected frame. Calling this method
|
|
54
|
+
* requires that the selected frame is in text editing mode.
|
|
55
|
+
* @param variableId The ID of the variable to be inserted.
|
|
56
|
+
* @returns
|
|
57
|
+
*/
|
|
58
|
+
this.insertTextVariable = (variableId) => __awaiter(this, void 0, void 0, function* () {
|
|
59
|
+
const res = yield __classPrivateFieldGet(this, _ExperimentController_editorAPI, "f");
|
|
60
|
+
return res.insertTextVariable(variableId).then((result) => getEditorResponseData(result));
|
|
61
|
+
});
|
|
62
|
+
/**
|
|
63
|
+
* This method will enter text editing mode on the provided frame.
|
|
64
|
+
* @param frameId The ID frame to enter text edit mode on.
|
|
65
|
+
* @returns
|
|
66
|
+
*/
|
|
67
|
+
this.enterTextEditMode = (frameId) => __awaiter(this, void 0, void 0, function* () {
|
|
68
|
+
const res = yield __classPrivateFieldGet(this, _ExperimentController_editorAPI, "f");
|
|
69
|
+
return res.enterTextEditMode(frameId).then((result) => getEditorResponseData(result));
|
|
70
|
+
});
|
|
71
|
+
/**
|
|
72
|
+
* This method will exit text editing mode.
|
|
73
|
+
* @returns
|
|
74
|
+
*/
|
|
75
|
+
this.exitTextEditMode = () => __awaiter(this, void 0, void 0, function* () {
|
|
76
|
+
const res = yield __classPrivateFieldGet(this, _ExperimentController_editorAPI, "f");
|
|
77
|
+
return res.exitTextEditMode().then((result) => getEditorResponseData(result));
|
|
78
|
+
});
|
|
79
|
+
__classPrivateFieldSet(this, _ExperimentController_editorAPI, editorAPI, "f");
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
_ExperimentController_editorAPI = new WeakMap();
|
|
83
|
+
//# sourceMappingURL=ExperimentController.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ExperimentController.js","sourceRoot":"","sources":["../../../src/controllers/ExperimentController.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;AACA,O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S,EAAE;YAC1B,MAAM,GAAG,GAAG,MAAM,uBAAA,IAAI,uCAAW,CAAC;YAClC,OAAO,GAAG,CAAC,gBAAgB,EAAE,CAAC,IAAI,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,qBAAqB,CAAO,MAAM,CAAC,CAAC,CAAC;QACxF,CAAC,CAAA,CAAC;QA7CE,uBAAA,IAAI,mCAAc,SAAS,MAAA,CAAC;IAChC,CAAC;CA6CJ"}
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import { ConnectorOptions, EditorAPI, EditorResponse, MetaData } from '../types/CommonTypes';
|
|
2
|
+
import { DeprecatedMediaType, ConnectorCapabilities, MediaType, QueryOptions, QueryPage } from '../types/ConnectorTypes';
|
|
3
|
+
import { Font, FontDownloadType } from '../types/FontConnectorTypes';
|
|
4
|
+
/**
|
|
5
|
+
* The FontConnectorController is responsible for all communication regarding Font connectors.
|
|
6
|
+
* Methods inside this controller can be called by `window.SDK.FontConnector.{method-name}`
|
|
7
|
+
*
|
|
8
|
+
* The way CHILI Studio handles different sources of Font is called 'FontConnectors'. A FontConnectors is an
|
|
9
|
+
* implementation of a set of capabilities we need to interact with a certain Digital Asset Management system.
|
|
10
|
+
* In essence a connector is the combination of a Javascript snippet and some metadata. The Javascript snippet
|
|
11
|
+
* is loaded in the studio engine using a sandboxed Javascript execution engine (QuickJs). This allows us to
|
|
12
|
+
* execute the Font connector both on web using webassembly and on the server side during e.g. animation output
|
|
13
|
+
* generation.
|
|
14
|
+
* This controller is an interface to the running connector instance inside the studio engine.
|
|
15
|
+
*/
|
|
16
|
+
export declare class FontConnectorController {
|
|
17
|
+
#private;
|
|
18
|
+
/**
|
|
19
|
+
* @ignore
|
|
20
|
+
*/
|
|
21
|
+
constructor(editorAPI: EditorAPI);
|
|
22
|
+
/**
|
|
23
|
+
* Query a specific FontConnector for data using both standardized queryOptions and the dynamic
|
|
24
|
+
* context as parameters. This call returns an array of Font items.
|
|
25
|
+
* @param connectorId unique Id of the Font connector
|
|
26
|
+
* @param queryOptions stringified instance of `QueryOptions`
|
|
27
|
+
* @param context stringified `Map<string, string>` of dynamic options
|
|
28
|
+
*/
|
|
29
|
+
query: (connectorId: string, queryOptions: QueryOptions, context: MetaData) => Promise<EditorResponse<QueryPage<Font>>>;
|
|
30
|
+
/**
|
|
31
|
+
* Returns a single font using a specific FontConnector.
|
|
32
|
+
*
|
|
33
|
+
* The connector needs to list `detail` as a supported capability.
|
|
34
|
+
* @param connectorId unique Id of the Font connector
|
|
35
|
+
* @param fontId unique id of the Font
|
|
36
|
+
*/
|
|
37
|
+
detail: (connectorId: string, fontId: string) => Promise<EditorResponse<Font>>;
|
|
38
|
+
/**
|
|
39
|
+
* The combination of a `connectorId` and `FontId` is typically enough for a Font connector to
|
|
40
|
+
* perform the download of this asset. The `download` endpoint is capable of relaying this information to the
|
|
41
|
+
* Font connector instance running in the editor engine.
|
|
42
|
+
* @param connectorId unique Id of the Font connector
|
|
43
|
+
* @param FontId unique Id of the Font to download
|
|
44
|
+
* @param downloadType hint to the Font connector about desired quality of the downloaded Font
|
|
45
|
+
* @param context dynamic map of additional options potentially used by the connector
|
|
46
|
+
*/
|
|
47
|
+
download: (connectorId: string, FontId: string, downloadType: FontDownloadType, context: MetaData) => Promise<Uint8Array>;
|
|
48
|
+
/**
|
|
49
|
+
* Depending on the connector capabilities, this api method allows you to upload new Font to the
|
|
50
|
+
* connector's backend.
|
|
51
|
+
* @param connectorId unique Id of the Font connector
|
|
52
|
+
* @param FontId unique Id of the Font to upload
|
|
53
|
+
* @param blob byte array representation of the Font to upload
|
|
54
|
+
*/
|
|
55
|
+
upload: (connectorId: string, FontId: string, blob: Uint8Array) => Promise<EditorResponse<null>>;
|
|
56
|
+
/**
|
|
57
|
+
* Depending on the connector capabilities, removes Font identified by `FontId` from the connector's backend storage
|
|
58
|
+
* @param connectorId unique Id of the Font connector
|
|
59
|
+
* @param FontId unique Id of the Font to download
|
|
60
|
+
*/
|
|
61
|
+
remove: (connectorId: string, FontId: string) => Promise<EditorResponse<null>>;
|
|
62
|
+
/**
|
|
63
|
+
* Depending on the connector capabilities, copies Font identified by `FontId` to a new Font item on the
|
|
64
|
+
* connector's backend
|
|
65
|
+
* @param connectorId unique Id of the Font connector
|
|
66
|
+
* @param FontId unique Id of the Font to download
|
|
67
|
+
* @param newName name of the copied Font on the connector's backend
|
|
68
|
+
*/
|
|
69
|
+
copy: (connectorId: string, FontId: string, newName: string) => Promise<EditorResponse<null>>;
|
|
70
|
+
/**
|
|
71
|
+
* All connectors have a certain set of queryOptions they allow to be passed in the query context. This
|
|
72
|
+
* method allows you to discover what options are available for a given connector. If you want to use any of these
|
|
73
|
+
* options, they need to be passed in the `context` parameter of the `query` api method.
|
|
74
|
+
* @param connectorId unique Id of the Font connector
|
|
75
|
+
*/
|
|
76
|
+
getQueryOptions: (connectorId: string) => Promise<EditorResponse<ConnectorOptions>>;
|
|
77
|
+
/**
|
|
78
|
+
* All connectors have a certain set of downloadOptions they allow to be passed in the download context. This
|
|
79
|
+
* method allows you to discover what options are available for a given connector. If you want to use any of these
|
|
80
|
+
* options, they need to be passed in the `context` parameter of the `download` api method.
|
|
81
|
+
* @param connectorId unique Id of the Font connector
|
|
82
|
+
*/
|
|
83
|
+
getDownloadOptions: (connectorId: string) => Promise<EditorResponse<ConnectorOptions>>;
|
|
84
|
+
/**
|
|
85
|
+
* This method returns what capabilities the selected connector has. It gives an indication what methods can
|
|
86
|
+
* be used successfully for a certain connector.
|
|
87
|
+
* @param connectorId unique Id of the Font connector
|
|
88
|
+
*/
|
|
89
|
+
getCapabilities: (connectorId: string) => Promise<EditorResponse<ConnectorCapabilities>>;
|
|
90
|
+
/**
|
|
91
|
+
* This method will parse the deprecatedFontType to the new Font type. This method will be removed once the deprecatedFontType is out of use
|
|
92
|
+
* @param deprecatedType is 0 or 1
|
|
93
|
+
*/
|
|
94
|
+
parseDeprecatedFontType: (deprecatedType: DeprecatedMediaType) => MediaType | undefined;
|
|
95
|
+
}
|
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
|
|
11
|
+
if (kind === "m") throw new TypeError("Private method is not writable");
|
|
12
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
|
13
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
14
|
+
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
|
15
|
+
};
|
|
16
|
+
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
|
17
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
18
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
19
|
+
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
20
|
+
};
|
|
21
|
+
var _FontConnectorController_editorAPI, _FontConnectorController_blobAPI;
|
|
22
|
+
import { getEditorResponseData } from '../utils/EditorResponseData';
|
|
23
|
+
import { DeprecatedMediaType, MediaType, } from '../types/ConnectorTypes';
|
|
24
|
+
/**
|
|
25
|
+
* The FontConnectorController is responsible for all communication regarding Font connectors.
|
|
26
|
+
* Methods inside this controller can be called by `window.SDK.FontConnector.{method-name}`
|
|
27
|
+
*
|
|
28
|
+
* The way CHILI Studio handles different sources of Font is called 'FontConnectors'. A FontConnectors is an
|
|
29
|
+
* implementation of a set of capabilities we need to interact with a certain Digital Asset Management system.
|
|
30
|
+
* In essence a connector is the combination of a Javascript snippet and some metadata. The Javascript snippet
|
|
31
|
+
* is loaded in the studio engine using a sandboxed Javascript execution engine (QuickJs). This allows us to
|
|
32
|
+
* execute the Font connector both on web using webassembly and on the server side during e.g. animation output
|
|
33
|
+
* generation.
|
|
34
|
+
* This controller is an interface to the running connector instance inside the studio engine.
|
|
35
|
+
*/
|
|
36
|
+
export class FontConnectorController {
|
|
37
|
+
/**
|
|
38
|
+
* @ignore
|
|
39
|
+
*/
|
|
40
|
+
constructor(editorAPI) {
|
|
41
|
+
/**
|
|
42
|
+
* @ignore
|
|
43
|
+
*/
|
|
44
|
+
_FontConnectorController_editorAPI.set(this, void 0);
|
|
45
|
+
_FontConnectorController_blobAPI.set(this, void 0);
|
|
46
|
+
/**
|
|
47
|
+
* Query a specific FontConnector for data using both standardized queryOptions and the dynamic
|
|
48
|
+
* context as parameters. This call returns an array of Font items.
|
|
49
|
+
* @param connectorId unique Id of the Font connector
|
|
50
|
+
* @param queryOptions stringified instance of `QueryOptions`
|
|
51
|
+
* @param context stringified `Map<string, string>` of dynamic options
|
|
52
|
+
*/
|
|
53
|
+
this.query = (connectorId, queryOptions, context) => __awaiter(this, void 0, void 0, function* () {
|
|
54
|
+
const res = yield __classPrivateFieldGet(this, _FontConnectorController_editorAPI, "f");
|
|
55
|
+
return res
|
|
56
|
+
.fontConnectorQuery(connectorId, JSON.stringify(queryOptions), JSON.stringify(context))
|
|
57
|
+
.then((result) => getEditorResponseData(result));
|
|
58
|
+
});
|
|
59
|
+
/**
|
|
60
|
+
* Returns a single font using a specific FontConnector.
|
|
61
|
+
*
|
|
62
|
+
* The connector needs to list `detail` as a supported capability.
|
|
63
|
+
* @param connectorId unique Id of the Font connector
|
|
64
|
+
* @param fontId unique id of the Font
|
|
65
|
+
*/
|
|
66
|
+
this.detail = (connectorId, fontId) => __awaiter(this, void 0, void 0, function* () {
|
|
67
|
+
const res = yield __classPrivateFieldGet(this, _FontConnectorController_editorAPI, "f");
|
|
68
|
+
return res.fontConnectorDetail(connectorId, fontId).then((result) => getEditorResponseData(result));
|
|
69
|
+
});
|
|
70
|
+
/**
|
|
71
|
+
* The combination of a `connectorId` and `FontId` is typically enough for a Font connector to
|
|
72
|
+
* perform the download of this asset. The `download` endpoint is capable of relaying this information to the
|
|
73
|
+
* Font connector instance running in the editor engine.
|
|
74
|
+
* @param connectorId unique Id of the Font connector
|
|
75
|
+
* @param FontId unique Id of the Font to download
|
|
76
|
+
* @param downloadType hint to the Font connector about desired quality of the downloaded Font
|
|
77
|
+
* @param context dynamic map of additional options potentially used by the connector
|
|
78
|
+
*/
|
|
79
|
+
this.download = (connectorId, FontId, downloadType, context) => __awaiter(this, void 0, void 0, function* () {
|
|
80
|
+
const res = yield __classPrivateFieldGet(this, _FontConnectorController_blobAPI, "f");
|
|
81
|
+
return res
|
|
82
|
+
.fontConnectorDownload(connectorId, FontId, downloadType, JSON.stringify(context))
|
|
83
|
+
.then((result) => { var _a; return (_a = result) !== null && _a !== void 0 ? _a : result; });
|
|
84
|
+
});
|
|
85
|
+
/**
|
|
86
|
+
* Depending on the connector capabilities, this api method allows you to upload new Font to the
|
|
87
|
+
* connector's backend.
|
|
88
|
+
* @param connectorId unique Id of the Font connector
|
|
89
|
+
* @param FontId unique Id of the Font to upload
|
|
90
|
+
* @param blob byte array representation of the Font to upload
|
|
91
|
+
*/
|
|
92
|
+
this.upload = (connectorId, FontId, blob) => __awaiter(this, void 0, void 0, function* () {
|
|
93
|
+
const res = yield __classPrivateFieldGet(this, _FontConnectorController_editorAPI, "f");
|
|
94
|
+
return res.fontConnectorUpload(connectorId, FontId, blob).then((result) => getEditorResponseData(result));
|
|
95
|
+
});
|
|
96
|
+
/**
|
|
97
|
+
* Depending on the connector capabilities, removes Font identified by `FontId` from the connector's backend storage
|
|
98
|
+
* @param connectorId unique Id of the Font connector
|
|
99
|
+
* @param FontId unique Id of the Font to download
|
|
100
|
+
*/
|
|
101
|
+
this.remove = (connectorId, FontId) => __awaiter(this, void 0, void 0, function* () {
|
|
102
|
+
const res = yield __classPrivateFieldGet(this, _FontConnectorController_editorAPI, "f");
|
|
103
|
+
return res.fontConnectorRemove(connectorId, FontId).then((result) => getEditorResponseData(result));
|
|
104
|
+
});
|
|
105
|
+
/**
|
|
106
|
+
* Depending on the connector capabilities, copies Font identified by `FontId` to a new Font item on the
|
|
107
|
+
* connector's backend
|
|
108
|
+
* @param connectorId unique Id of the Font connector
|
|
109
|
+
* @param FontId unique Id of the Font to download
|
|
110
|
+
* @param newName name of the copied Font on the connector's backend
|
|
111
|
+
*/
|
|
112
|
+
this.copy = (connectorId, FontId, newName) => __awaiter(this, void 0, void 0, function* () {
|
|
113
|
+
const res = yield __classPrivateFieldGet(this, _FontConnectorController_editorAPI, "f");
|
|
114
|
+
return res
|
|
115
|
+
.fontConnectorCopy(connectorId, FontId, newName)
|
|
116
|
+
.then((result) => getEditorResponseData(result));
|
|
117
|
+
});
|
|
118
|
+
/**
|
|
119
|
+
* All connectors have a certain set of queryOptions they allow to be passed in the query context. This
|
|
120
|
+
* method allows you to discover what options are available for a given connector. If you want to use any of these
|
|
121
|
+
* options, they need to be passed in the `context` parameter of the `query` api method.
|
|
122
|
+
* @param connectorId unique Id of the Font connector
|
|
123
|
+
*/
|
|
124
|
+
this.getQueryOptions = (connectorId) => __awaiter(this, void 0, void 0, function* () {
|
|
125
|
+
const res = yield __classPrivateFieldGet(this, _FontConnectorController_editorAPI, "f");
|
|
126
|
+
return res
|
|
127
|
+
.fontConnectorGetQueryOptions(connectorId)
|
|
128
|
+
.then((result) => getEditorResponseData(result));
|
|
129
|
+
});
|
|
130
|
+
/**
|
|
131
|
+
* All connectors have a certain set of downloadOptions they allow to be passed in the download context. This
|
|
132
|
+
* method allows you to discover what options are available for a given connector. If you want to use any of these
|
|
133
|
+
* options, they need to be passed in the `context` parameter of the `download` api method.
|
|
134
|
+
* @param connectorId unique Id of the Font connector
|
|
135
|
+
*/
|
|
136
|
+
this.getDownloadOptions = (connectorId) => __awaiter(this, void 0, void 0, function* () {
|
|
137
|
+
const res = yield __classPrivateFieldGet(this, _FontConnectorController_editorAPI, "f");
|
|
138
|
+
return res
|
|
139
|
+
.fontConnectorGetDownloadOptions(connectorId)
|
|
140
|
+
.then((result) => getEditorResponseData(result));
|
|
141
|
+
});
|
|
142
|
+
/**
|
|
143
|
+
* This method returns what capabilities the selected connector has. It gives an indication what methods can
|
|
144
|
+
* be used successfully for a certain connector.
|
|
145
|
+
* @param connectorId unique Id of the Font connector
|
|
146
|
+
*/
|
|
147
|
+
this.getCapabilities = (connectorId) => __awaiter(this, void 0, void 0, function* () {
|
|
148
|
+
const res = yield __classPrivateFieldGet(this, _FontConnectorController_editorAPI, "f");
|
|
149
|
+
return res
|
|
150
|
+
.fontConnectorGetCapabilities(connectorId)
|
|
151
|
+
.then((result) => getEditorResponseData(result));
|
|
152
|
+
});
|
|
153
|
+
/**
|
|
154
|
+
* This method will parse the deprecatedFontType to the new Font type. This method will be removed once the deprecatedFontType is out of use
|
|
155
|
+
* @param deprecatedType is 0 or 1
|
|
156
|
+
*/
|
|
157
|
+
this.parseDeprecatedFontType = (deprecatedType) => {
|
|
158
|
+
if (deprecatedType === DeprecatedMediaType.file)
|
|
159
|
+
return MediaType.file;
|
|
160
|
+
if (deprecatedType === DeprecatedMediaType.collection)
|
|
161
|
+
return MediaType.collection;
|
|
162
|
+
};
|
|
163
|
+
__classPrivateFieldSet(this, _FontConnectorController_editorAPI, editorAPI, "f");
|
|
164
|
+
__classPrivateFieldSet(this, _FontConnectorController_blobAPI, editorAPI, "f");
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
_FontConnectorController_editorAPI = new WeakMap(), _FontConnectorController_blobAPI = new WeakMap();
|
|
168
|
+
//# sourceMappingURL=FontConnectorController.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FontConnectorController.js","sourceRoot":"","sources":["../../../src/controllers/FontConnectorController.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;AACA,OAAO,EAAE,qBAAqB,EAAE,MAAM,6BAA6B,CAAC;AACpE,OAAO,EACH,mBAAmB,EAEnB,SAAS,GAGZ,MAAM,yBAAyB,CAAC;AAIjC;;;;;;;;;;;GAWG;AACH,MAAM,OAAO,uBAAuB;IAOhC;;OAEG;IACH,YAAY,SAAoB;QAThC;;WAEG;QACH,qDAAsB;QACtB,mDAAuB;QAUvB;;;;;;WAMG;QACH,UAAK,GAAG,CAAO,WAAmB,EAAE,YAA0B,EAAE,OAAiB,EAAE,EAAE;YACjF,MAAM,GAAG,GAAG,MAAM,uBAAA,IAAI,0CAAW,CAAC;YAClC,OAAO,GAAG;iBACL,kBAAkB,CAAC,WAAW,EAAE,IAAI,CAAC,SAAS,CAAC,YAAY,CAAC,EAAE,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC;iBACtF,IAAI,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,qBAAqB,CAAkB,MAAM,CAAC,CAAC,CAAC;QAC1E,CAAC,CAAA,CAAC;QAEF;;;;;;WAMG;QACH,WAAM,GAAG,CAAO,WAAmB,EAAE,MAAc,EAAE,EAAE;YACnD,MAAM,GAAG,GAAG,MAAM,uBAAA,IAAI,0CAAW,CAAC;YAClC,OAAO,GAAG,CAAC,mBAAmB,CAAC,WAAW,EAAE,MAAM,CAAC,CAAC,IAAI,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,qBAAqB,CAAO,MAAM,CAAC,CAAC,CAAC;QAC9G,CAAC,CAAA,CAAC;QAEF;;;;;;;;WAQG;QACH,aAAQ,GAAG,CACP,WAAmB,EACnB,MAAc,EACd,YAA8B,EAC9B,O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5D,CAAC;CAmIJ"}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { EditorAPI, Id } from '../types/CommonTypes';
|
|
2
|
+
import { AddDocumentFont, DocumentFont } from '../types/FontTypes';
|
|
3
|
+
/**
|
|
4
|
+
* The FontController is responsible for all communication regarding font styles.
|
|
5
|
+
* Methods inside this controller can be called by `window.SDK.font.{method-name}`
|
|
6
|
+
*/
|
|
7
|
+
export declare class FontController {
|
|
8
|
+
#private;
|
|
9
|
+
/**
|
|
10
|
+
* @ignore
|
|
11
|
+
*/
|
|
12
|
+
constructor(editorAPI: EditorAPI);
|
|
13
|
+
/**
|
|
14
|
+
* This method returns the list of fonts
|
|
15
|
+
* @returns
|
|
16
|
+
*/
|
|
17
|
+
getFonts: () => Promise<import("../types/CommonTypes").EditorResponse<DocumentFont[]>>;
|
|
18
|
+
/**
|
|
19
|
+
* This method returns a font by id
|
|
20
|
+
* @param fontId The ID of a specific font
|
|
21
|
+
* @returns
|
|
22
|
+
*/
|
|
23
|
+
getFontById: (fontId: Id) => Promise<import("../types/CommonTypes").EditorResponse<DocumentFont>>;
|
|
24
|
+
/**
|
|
25
|
+
* This method returns the default font.
|
|
26
|
+
* Be aware that the default font will not change during the entire lifetime of the SDK session.
|
|
27
|
+
* It is not necessary to call this more than once in an integration, this value can be safely stored during the lifetime of this SDK session.
|
|
28
|
+
* @returns
|
|
29
|
+
*/
|
|
30
|
+
getDefaultFont: () => Promise<import("../types/CommonTypes").EditorResponse<DocumentFont>>;
|
|
31
|
+
/**
|
|
32
|
+
* This method removes a font
|
|
33
|
+
* @param id The ID of a specific font
|
|
34
|
+
* @returns
|
|
35
|
+
*/
|
|
36
|
+
removeFont: (id: Id) => Promise<import("../types/CommonTypes").EditorResponse<null>>;
|
|
37
|
+
/**
|
|
38
|
+
* This method adds a font
|
|
39
|
+
* @param connectorId unique Id of the font connector
|
|
40
|
+
* @param font The font object
|
|
41
|
+
* @returns
|
|
42
|
+
*/
|
|
43
|
+
addFont: (connectorId: Id, font: AddDocumentFont) => Promise<import("../types/CommonTypes").EditorResponse<null>>;
|
|
44
|
+
/**
|
|
45
|
+
* Check if the font is used anywhere in the document
|
|
46
|
+
* @param fontKey The ID of the font to check
|
|
47
|
+
* @returns Whether the font is used
|
|
48
|
+
*/
|
|
49
|
+
isFontUsed: (fontKey: string) => Promise<import("../types/CommonTypes").EditorResponse<boolean>>;
|
|
50
|
+
}
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
|
|
11
|
+
if (kind === "m") throw new TypeError("Private method is not writable");
|
|
12
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
|
13
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
14
|
+
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
|
15
|
+
};
|
|
16
|
+
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
|
17
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
18
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
19
|
+
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
20
|
+
};
|
|
21
|
+
var _FontController_editorAPI;
|
|
22
|
+
import { getEditorResponseData } from '../utils/EditorResponseData';
|
|
23
|
+
/**
|
|
24
|
+
* The FontController is responsible for all communication regarding font styles.
|
|
25
|
+
* Methods inside this controller can be called by `window.SDK.font.{method-name}`
|
|
26
|
+
*/
|
|
27
|
+
export class FontController {
|
|
28
|
+
/**
|
|
29
|
+
* @ignore
|
|
30
|
+
*/
|
|
31
|
+
constructor(editorAPI) {
|
|
32
|
+
/**
|
|
33
|
+
* @ignore
|
|
34
|
+
*/
|
|
35
|
+
_FontController_editorAPI.set(this, void 0);
|
|
36
|
+
/**
|
|
37
|
+
* This method returns the list of fonts
|
|
38
|
+
* @returns
|
|
39
|
+
*/
|
|
40
|
+
this.getFonts = () => __awaiter(this, void 0, void 0, function* () {
|
|
41
|
+
const res = yield __classPrivateFieldGet(this, _FontController_editorAPI, "f");
|
|
42
|
+
return res.getFonts().then((result) => getEditorResponseData(result));
|
|
43
|
+
});
|
|
44
|
+
/**
|
|
45
|
+
* This method returns a font by id
|
|
46
|
+
* @param fontId The ID of a specific font
|
|
47
|
+
* @returns
|
|
48
|
+
*/
|
|
49
|
+
this.getFontById = (fontId) => __awaiter(this, void 0, void 0, function* () {
|
|
50
|
+
const res = yield __classPrivateFieldGet(this, _FontController_editorAPI, "f");
|
|
51
|
+
return res.getFontById(fontId).then((result) => getEditorResponseData(result));
|
|
52
|
+
});
|
|
53
|
+
/**
|
|
54
|
+
* This method returns the default font.
|
|
55
|
+
* Be aware that the default font will not change during the entire lifetime of the SDK session.
|
|
56
|
+
* It is not necessary to call this more than once in an integration, this value can be safely stored during the lifetime of this SDK session.
|
|
57
|
+
* @returns
|
|
58
|
+
*/
|
|
59
|
+
this.getDefaultFont = () => __awaiter(this, void 0, void 0, function* () {
|
|
60
|
+
const res = yield __classPrivateFieldGet(this, _FontController_editorAPI, "f");
|
|
61
|
+
return res.getDefaultFont().then((result) => getEditorResponseData(result));
|
|
62
|
+
});
|
|
63
|
+
/**
|
|
64
|
+
* This method removes a font
|
|
65
|
+
* @param id The ID of a specific font
|
|
66
|
+
* @returns
|
|
67
|
+
*/
|
|
68
|
+
this.removeFont = (id) => __awaiter(this, void 0, void 0, function* () {
|
|
69
|
+
const res = yield __classPrivateFieldGet(this, _FontController_editorAPI, "f");
|
|
70
|
+
return res.removeFont(id).then((result) => getEditorResponseData(result));
|
|
71
|
+
});
|
|
72
|
+
/**
|
|
73
|
+
* This method adds a font
|
|
74
|
+
* @param connectorId unique Id of the font connector
|
|
75
|
+
* @param font The font object
|
|
76
|
+
* @returns
|
|
77
|
+
*/
|
|
78
|
+
this.addFont = (connectorId, font) => __awaiter(this, void 0, void 0, function* () {
|
|
79
|
+
const res = yield __classPrivateFieldGet(this, _FontController_editorAPI, "f");
|
|
80
|
+
return res.addFont(connectorId, JSON.stringify(font)).then((result) => getEditorResponseData(result));
|
|
81
|
+
});
|
|
82
|
+
/**
|
|
83
|
+
* Check if the font is used anywhere in the document
|
|
84
|
+
* @param fontKey The ID of the font to check
|
|
85
|
+
* @returns Whether the font is used
|
|
86
|
+
*/
|
|
87
|
+
this.isFontUsed = (fontKey) => __awaiter(this, void 0, void 0, function* () {
|
|
88
|
+
const res = yield __classPrivateFieldGet(this, _FontController_editorAPI, "f");
|
|
89
|
+
return res.isFontUsed(fontKey).then((result) => getEditorResponseData(result));
|
|
90
|
+
});
|
|
91
|
+
__classPrivateFieldSet(this, _FontController_editorAPI, editorAPI, "f");
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
_FontController_editorAPI = new WeakMap();
|
|
95
|
+
//# sourceMappingURL=FontController.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FontController.js","sourceRoot":"","sources":["../../../src/controllers/FontController.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;AAEA,OAAO,EAAE,qBAAqB,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