@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,92 @@
|
|
|
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 _PageController_editorAPI;
|
|
22
|
+
import { getEditorResponseData } from '../utils/EditorResponseData';
|
|
23
|
+
import { getCalculatedValue } from '../utils/getCalculatedValue';
|
|
24
|
+
/**
|
|
25
|
+
* The PageController is responsible for all communication regarding Pages.
|
|
26
|
+
* Methods inside this controller can be called by `window.SDK.page.{method-name}`
|
|
27
|
+
*/
|
|
28
|
+
export class PageController {
|
|
29
|
+
/**
|
|
30
|
+
* @ignore
|
|
31
|
+
*/
|
|
32
|
+
constructor(editorAPI) {
|
|
33
|
+
/**
|
|
34
|
+
* @ignore
|
|
35
|
+
*/
|
|
36
|
+
_PageController_editorAPI.set(this, void 0);
|
|
37
|
+
/**
|
|
38
|
+
* This method returns the list of pages
|
|
39
|
+
* @returns
|
|
40
|
+
*/
|
|
41
|
+
this.getPages = () => __awaiter(this, void 0, void 0, function* () {
|
|
42
|
+
const res = yield __classPrivateFieldGet(this, _PageController_editorAPI, "f");
|
|
43
|
+
return res.getPages().then((result) => getEditorResponseData(result));
|
|
44
|
+
});
|
|
45
|
+
/**
|
|
46
|
+
* This method returns a page by its id
|
|
47
|
+
* @param pageId The ID of a specific page
|
|
48
|
+
* @returns
|
|
49
|
+
*/
|
|
50
|
+
this.getPageById = (pageId) => __awaiter(this, void 0, void 0, function* () {
|
|
51
|
+
const res = yield __classPrivateFieldGet(this, _PageController_editorAPI, "f");
|
|
52
|
+
return res.getPageById(pageId).then((result) => getEditorResponseData(result));
|
|
53
|
+
});
|
|
54
|
+
/**
|
|
55
|
+
* This method will set the width of the page to a specific value.
|
|
56
|
+
* This only works if the document is a project.
|
|
57
|
+
* @param pageId The ID of a specific page
|
|
58
|
+
* @param value The string value that will be calculated (f.e. 1+1 will result in 2) The notation is in pixels
|
|
59
|
+
* @returns
|
|
60
|
+
*/
|
|
61
|
+
this.setPageWidth = (pageId, value) => __awaiter(this, void 0, void 0, function* () {
|
|
62
|
+
const res = yield __classPrivateFieldGet(this, _PageController_editorAPI, "f");
|
|
63
|
+
const calc = getCalculatedValue(value);
|
|
64
|
+
if (calc === null || calc === Infinity) {
|
|
65
|
+
return null;
|
|
66
|
+
}
|
|
67
|
+
return res
|
|
68
|
+
.setPageWidth(pageId, parseFloat(calc.toString()))
|
|
69
|
+
.then((result) => getEditorResponseData(result));
|
|
70
|
+
});
|
|
71
|
+
/**
|
|
72
|
+
* This method will set the height of the page to a specific value.
|
|
73
|
+
* This only works if the document is a project.
|
|
74
|
+
* @param pageId The ID of a specific page
|
|
75
|
+
* @param value The string value that will be calculated (f.e. 1+1 will result in 2) The notation is in pixels
|
|
76
|
+
* @returns
|
|
77
|
+
*/
|
|
78
|
+
this.setPageHeight = (pageId, value) => __awaiter(this, void 0, void 0, function* () {
|
|
79
|
+
const res = yield __classPrivateFieldGet(this, _PageController_editorAPI, "f");
|
|
80
|
+
const calc = getCalculatedValue(value);
|
|
81
|
+
if (calc === null || calc === Infinity) {
|
|
82
|
+
return null;
|
|
83
|
+
}
|
|
84
|
+
return res
|
|
85
|
+
.setPageHeight(pageId, parseFloat(calc.toString()))
|
|
86
|
+
.then((result) => getEditorResponseData(result));
|
|
87
|
+
});
|
|
88
|
+
__classPrivateFieldSet(this, _PageController_editorAPI, editorAPI, "f");
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
_PageController_editorAPI = new WeakMap();
|
|
92
|
+
//# sourceMappingURL=PageController.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PageController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AqB,CAAO,MAAM,CAAC,CAAC,CAAC;QAC/D,CAAC,CAAA,CAAC;QAEF;;;;;;WAMG;QACH,kBAAa,GAAG,CAAO,MAAU,EAAE,KAAa,EAAE,EAAE;YAChD,MAAM,GAAG,GAAG,MAAM,uBAAA,IAAI,iCAAW,CAAC;YAClC,MAAM,IAAI,GAAG,kBAAkB,CAAC,KAAK,CAAC,CAAC;YAEvC,IAAI,IAAI,KAAK,IAAI,IAAI,IAAI,KAAK,QAAQ,EAAE;gBACpC,OAAO,IAAI,CAAC;aACf;YAED,OAAO,GAAG;iBACL,aAAa,CAAC,MAAM,EAAE,UAAU,CAAC,IAAI,CAAC,QAAQ,EAAE,CAAC,CAAC;iBAClD,IAAI,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,qBAAqB,CAAO,MAAM,CAAC,CAAC,CAAC;QAC/D,CAAC,CAAA,CAAC;QA5DE,uBAAA,IAAI,6BAAc,SAAS,MAAA,CAAC;IAChC,CAAC;CA4DJ"}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { EditorAPI } from '../types/CommonTypes';
|
|
2
|
+
import { ParagraphStyle, ParagraphStyleUpdate } from '../types/ParagraphStyleTypes';
|
|
3
|
+
/**
|
|
4
|
+
* The ParagraphStyleController is responsible for all communication regarding paragraph styles.
|
|
5
|
+
* Methods inside this controller can be called by `window.SDK.paragraphStyle.{method-name}`
|
|
6
|
+
*/
|
|
7
|
+
export declare class ParagraphStyleController {
|
|
8
|
+
#private;
|
|
9
|
+
/**
|
|
10
|
+
* @ignore
|
|
11
|
+
*/
|
|
12
|
+
constructor(editorAPI: EditorAPI);
|
|
13
|
+
/**
|
|
14
|
+
* This method returns the list of paragraph styles
|
|
15
|
+
* @returns
|
|
16
|
+
*/
|
|
17
|
+
getParagraphStyles: () => Promise<import("../types/CommonTypes").EditorResponse<ParagraphStyle[]>>;
|
|
18
|
+
/**
|
|
19
|
+
* This method returns a paragraph style by id
|
|
20
|
+
* @param paragraphStyleId The ID of a specific paragraph style
|
|
21
|
+
* @returns
|
|
22
|
+
*/
|
|
23
|
+
getParagraphStyleById: (paragraphStyleId: string) => Promise<import("../types/CommonTypes").EditorResponse<ParagraphStyle>>;
|
|
24
|
+
/**
|
|
25
|
+
* This method create a new paragraph style
|
|
26
|
+
* @returns the new created paragraph style id
|
|
27
|
+
*/
|
|
28
|
+
createParagraphStyle: () => Promise<import("../types/CommonTypes").EditorResponse<string>>;
|
|
29
|
+
/**
|
|
30
|
+
* This method duplicates a paragraph style
|
|
31
|
+
* @param paragraphStyleId The ID of a specific paragraph style
|
|
32
|
+
* @returns the new paragraph style id
|
|
33
|
+
*/
|
|
34
|
+
duplicateParagraphStyle: (paragraphStyleId: string) => Promise<import("../types/CommonTypes").EditorResponse<string>>;
|
|
35
|
+
/**
|
|
36
|
+
* This method updates a paragraph style
|
|
37
|
+
* @param id The ID of a specific paragraph style
|
|
38
|
+
* @param paragraphStyle The new paragraph style properties
|
|
39
|
+
* @returns
|
|
40
|
+
*/
|
|
41
|
+
updateParagraphStyle: (id: string, paragraphStyle: ParagraphStyleUpdate) => Promise<import("../types/CommonTypes").EditorResponse<null>>;
|
|
42
|
+
/**
|
|
43
|
+
* This method renames a paragraph style
|
|
44
|
+
* @param id The ID of a specific paragraph style
|
|
45
|
+
* @param name The new name of the paragraph style
|
|
46
|
+
* @returns
|
|
47
|
+
*/
|
|
48
|
+
renameParagraphStyle: (id: string, name: string) => Promise<import("../types/CommonTypes").EditorResponse<null>>;
|
|
49
|
+
/**
|
|
50
|
+
* This method removes a paragraph style
|
|
51
|
+
* @param id The ID of a specific paragraph style
|
|
52
|
+
* @returns
|
|
53
|
+
*/
|
|
54
|
+
removeParagraphStyle: (id: string) => Promise<import("../types/CommonTypes").EditorResponse<null>>;
|
|
55
|
+
/**
|
|
56
|
+
* This method changes positions of paragraph styles
|
|
57
|
+
* @param order The position of the paragraph styles
|
|
58
|
+
* @param paragraphStyleIds The list of paragraph styles ids
|
|
59
|
+
* @returns
|
|
60
|
+
*/
|
|
61
|
+
moveParagraphStyles: (order: number, paragraphStyleIds: string[]) => Promise<import("../types/CommonTypes").EditorResponse<null>>;
|
|
62
|
+
}
|
|
@@ -0,0 +1,117 @@
|
|
|
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 _ParagraphStyleController_editorAPI;
|
|
22
|
+
import { getEditorResponseData } from '../utils/EditorResponseData';
|
|
23
|
+
/**
|
|
24
|
+
* The ParagraphStyleController is responsible for all communication regarding paragraph styles.
|
|
25
|
+
* Methods inside this controller can be called by `window.SDK.paragraphStyle.{method-name}`
|
|
26
|
+
*/
|
|
27
|
+
export class ParagraphStyleController {
|
|
28
|
+
/**
|
|
29
|
+
* @ignore
|
|
30
|
+
*/
|
|
31
|
+
constructor(editorAPI) {
|
|
32
|
+
/**
|
|
33
|
+
* @ignore
|
|
34
|
+
*/
|
|
35
|
+
_ParagraphStyleController_editorAPI.set(this, void 0);
|
|
36
|
+
/**
|
|
37
|
+
* This method returns the list of paragraph styles
|
|
38
|
+
* @returns
|
|
39
|
+
*/
|
|
40
|
+
this.getParagraphStyles = () => __awaiter(this, void 0, void 0, function* () {
|
|
41
|
+
const res = yield __classPrivateFieldGet(this, _ParagraphStyleController_editorAPI, "f");
|
|
42
|
+
return res.getParagraphStyles().then((result) => getEditorResponseData(result));
|
|
43
|
+
});
|
|
44
|
+
/**
|
|
45
|
+
* This method returns a paragraph style by id
|
|
46
|
+
* @param paragraphStyleId The ID of a specific paragraph style
|
|
47
|
+
* @returns
|
|
48
|
+
*/
|
|
49
|
+
this.getParagraphStyleById = (paragraphStyleId) => __awaiter(this, void 0, void 0, function* () {
|
|
50
|
+
const res = yield __classPrivateFieldGet(this, _ParagraphStyleController_editorAPI, "f");
|
|
51
|
+
return res
|
|
52
|
+
.getParagraphStyleById(paragraphStyleId)
|
|
53
|
+
.then((result) => getEditorResponseData(result));
|
|
54
|
+
});
|
|
55
|
+
/**
|
|
56
|
+
* This method create a new paragraph style
|
|
57
|
+
* @returns the new created paragraph style id
|
|
58
|
+
*/
|
|
59
|
+
this.createParagraphStyle = () => __awaiter(this, void 0, void 0, function* () {
|
|
60
|
+
const res = yield __classPrivateFieldGet(this, _ParagraphStyleController_editorAPI, "f");
|
|
61
|
+
return res.createParagraphStyle().then((result) => getEditorResponseData(result));
|
|
62
|
+
});
|
|
63
|
+
/**
|
|
64
|
+
* This method duplicates a paragraph style
|
|
65
|
+
* @param paragraphStyleId The ID of a specific paragraph style
|
|
66
|
+
* @returns the new paragraph style id
|
|
67
|
+
*/
|
|
68
|
+
this.duplicateParagraphStyle = (paragraphStyleId) => __awaiter(this, void 0, void 0, function* () {
|
|
69
|
+
const res = yield __classPrivateFieldGet(this, _ParagraphStyleController_editorAPI, "f");
|
|
70
|
+
return res.duplicateParagraphStyle(paragraphStyleId).then((result) => getEditorResponseData(result));
|
|
71
|
+
});
|
|
72
|
+
/**
|
|
73
|
+
* This method updates a paragraph style
|
|
74
|
+
* @param id The ID of a specific paragraph style
|
|
75
|
+
* @param paragraphStyle The new paragraph style properties
|
|
76
|
+
* @returns
|
|
77
|
+
*/
|
|
78
|
+
this.updateParagraphStyle = (id, paragraphStyle) => __awaiter(this, void 0, void 0, function* () {
|
|
79
|
+
const res = yield __classPrivateFieldGet(this, _ParagraphStyleController_editorAPI, "f");
|
|
80
|
+
return res
|
|
81
|
+
.updateParagraphStyle(id, JSON.stringify(paragraphStyle))
|
|
82
|
+
.then((result) => getEditorResponseData(result));
|
|
83
|
+
});
|
|
84
|
+
/**
|
|
85
|
+
* This method renames a paragraph style
|
|
86
|
+
* @param id The ID of a specific paragraph style
|
|
87
|
+
* @param name The new name of the paragraph style
|
|
88
|
+
* @returns
|
|
89
|
+
*/
|
|
90
|
+
this.renameParagraphStyle = (id, name) => __awaiter(this, void 0, void 0, function* () {
|
|
91
|
+
const res = yield __classPrivateFieldGet(this, _ParagraphStyleController_editorAPI, "f");
|
|
92
|
+
return res.renameParagraphStyle(id, name).then((result) => getEditorResponseData(result));
|
|
93
|
+
});
|
|
94
|
+
/**
|
|
95
|
+
* This method removes a paragraph style
|
|
96
|
+
* @param id The ID of a specific paragraph style
|
|
97
|
+
* @returns
|
|
98
|
+
*/
|
|
99
|
+
this.removeParagraphStyle = (id) => __awaiter(this, void 0, void 0, function* () {
|
|
100
|
+
const res = yield __classPrivateFieldGet(this, _ParagraphStyleController_editorAPI, "f");
|
|
101
|
+
return res.removeParagraphStyle(id).then((result) => getEditorResponseData(result));
|
|
102
|
+
});
|
|
103
|
+
/**
|
|
104
|
+
* This method changes positions of paragraph styles
|
|
105
|
+
* @param order The position of the paragraph styles
|
|
106
|
+
* @param paragraphStyleIds The list of paragraph styles ids
|
|
107
|
+
* @returns
|
|
108
|
+
*/
|
|
109
|
+
this.moveParagraphStyles = (order, paragraphStyleIds) => __awaiter(this, void 0, void 0, function* () {
|
|
110
|
+
const res = yield __classPrivateFieldGet(this, _ParagraphStyleController_editorAPI, "f");
|
|
111
|
+
return res.moveParagraphStyles(order, paragraphStyleIds).then((result) => getEditorResponseData(result));
|
|
112
|
+
});
|
|
113
|
+
__classPrivateFieldSet(this, _ParagraphStyleController_editorAPI, editorAPI, "f");
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
_ParagraphStyleController_editorAPI = new WeakMap();
|
|
117
|
+
//# sourceMappingURL=ParagraphStyleController.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ParagraphStyleController.js","sourceRoot":"","sources":["../../../src/controllers/ParagraphStyleController.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;AAEA,OAAO,EAAE,qBAAqB,EAAE,MAAM,6BAA6B,CAAC;AAEpE;;;GAGG;AACH,MAAM,OAAO,wBAAwB;IAMjC;;OAEG;IACH,YAAY,SAAoB;QARhC;;WAEG;QACH,sDAAsB;QAStB;;;WAGG;QACH,uBAAkB,GAAG,GAAS,EAAE;YAC5B,MAAM,GAAG,GAAG,MAAM,uBAAA,IAAI,2CAAW,CAAC;YAClC,OAAO,GAAG,CAAC,kBAAkB,EAAE,CAAC,IAAI,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,qBAAqB,CAAmB,MAAM,CAAC,CAAC,CAAC;QACtG,CAAC,CAAA,CAAC;QAEF;;;;WAIG;QACH,0BAAqB,GAAG,CAAO,gBAAwB,EAAE,EAAE;YACvD,MAAM,GAAG,GAAG,MAAM,uBA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E,EAAE,IAAI,CAAC,CAAC,IAAI,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,qBAAqB,CAAO,MAAM,CAAC,CAAC,CAAC;QACpG,CAAC,CAAA,CAAC;QAEF;;;;WAIG;QACH,yBAAoB,GAAG,CAAO,EAAU,EAAE,EAAE;YACxC,MAAM,GAAG,GAAG,MAAM,uBAAA,IAAI,2CAAW,CAAC;YAClC,OAAO,GAAG,CAAC,oBAAoB,CAAC,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,qBAAqB,CAAO,MAAM,CAAC,CAAC,CAAC;QAC9F,CAAC,CAAA,CAAC;QAEF;;;;;WAKG;QACH,wBAAmB,GAAG,CAAO,KAAa,EAAE,iBAA2B,EAAE,EAAE;YACvE,MAAM,GAAG,GAAG,MAAM,uBAAA,IAAI,2CAAW,CAAC;YAClC,OAAO,GAAG,CAAC,mBAAmB,CAAC,KAAK,EAAE,iBAAiB,CAAC,CAAC,IAAI,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,qBAAqB,CAAO,MAAM,CAAC,CAAC,CAAC;QACnH,CAAC,CAAA,CAAC;QAtFE,uBAAA,IAAI,uCAAc,SAAS,MAAA,CAAC;IAChC,CAAC;CAsFJ"}
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
import { EditorAPI, Id } from '../types/CommonTypes';
|
|
2
|
+
import { ColorUsage } from '../types/ColorStyleTypes';
|
|
3
|
+
/**
|
|
4
|
+
* The ShapeController is responsible for all communication regarding Shapes.
|
|
5
|
+
* Methods inside this controller can be called by `window.SDK.shape.{method-name}`
|
|
6
|
+
*/
|
|
7
|
+
export declare class ShapeController {
|
|
8
|
+
#private;
|
|
9
|
+
/**
|
|
10
|
+
* @ignore
|
|
11
|
+
*/
|
|
12
|
+
constructor(editorAPI: EditorAPI);
|
|
13
|
+
/**
|
|
14
|
+
* This method updates properties of the shape
|
|
15
|
+
* @param shapeFrameId The ID of the shapeFrame that needs to get updated.
|
|
16
|
+
* @param properties A property to update
|
|
17
|
+
* @returns
|
|
18
|
+
*/
|
|
19
|
+
private setShapeProperties;
|
|
20
|
+
/**
|
|
21
|
+
* This method will set the visibility of the shape fill.
|
|
22
|
+
* @param shapeFrameId The ID of the shapeFrame that needs to get updated.
|
|
23
|
+
* @param enableFill Whether the shape fill is visible.
|
|
24
|
+
* @returns
|
|
25
|
+
*/
|
|
26
|
+
setEnableFill: (shapeFrameId: Id, enableFill: boolean) => Promise<import("../types/CommonTypes").EditorResponse<null>>;
|
|
27
|
+
/**
|
|
28
|
+
* This method will set the shape fill color of a specified shape frame.
|
|
29
|
+
* @param shapeFrameId The ID of the shapeFrame that needs to get updated.
|
|
30
|
+
* @param fillColor The new shape fill color that you want to set to the shapeFrame.
|
|
31
|
+
* @returns
|
|
32
|
+
*/
|
|
33
|
+
setFillColor: (shapeFrameId: Id, fillColor: ColorUsage) => Promise<import("../types/CommonTypes").EditorResponse<null>>;
|
|
34
|
+
/**
|
|
35
|
+
* This method will set the visibility of the shape stroke.
|
|
36
|
+
* @param shapeFrameId The ID of the shapeFrame that needs to get updated.
|
|
37
|
+
* @param enableStroke Whether the shape stroke is visible.
|
|
38
|
+
* @returns
|
|
39
|
+
*/
|
|
40
|
+
setEnableStroke: (shapeFrameId: Id, enableStroke: boolean) => Promise<import("../types/CommonTypes").EditorResponse<null>>;
|
|
41
|
+
/**
|
|
42
|
+
* This method will set the shape stroke color of a specified shape frame.
|
|
43
|
+
* @param shapeFrameId The ID of the shapeFrame that needs to get updated.
|
|
44
|
+
* @param strokeColor The new shape stroke color that you want to set to the shapeFrame.
|
|
45
|
+
* @returns
|
|
46
|
+
*/
|
|
47
|
+
setStrokeColor: (shapeFrameId: Id, strokeColor: ColorUsage) => Promise<import("../types/CommonTypes").EditorResponse<null>>;
|
|
48
|
+
/**
|
|
49
|
+
* This method will set the shape stroke weight of a specified shape frame.
|
|
50
|
+
* @param shapeFrameId The ID of the shapeFrame that needs to get updated.
|
|
51
|
+
* @param strokeWeight The new shape stroke weight that you want to set to the shapeFrame.
|
|
52
|
+
* @returns
|
|
53
|
+
*/
|
|
54
|
+
setStrokeWeight: (shapeFrameId: Id, strokeWeight: number) => Promise<import("../types/CommonTypes").EditorResponse<null>>;
|
|
55
|
+
/**
|
|
56
|
+
* This method will set the flag to change the way the rectangle shape corners will be changed: all at once or separately.
|
|
57
|
+
* @param shapeFrameId The ID of the shapeFrame that needs to get updated.
|
|
58
|
+
* @param allCornersSame The new flag that you want to set to the shapeFrame.
|
|
59
|
+
* @returns
|
|
60
|
+
*/
|
|
61
|
+
setFlagAllCornersSame: (shapeFrameId: Id, allCornersSame: boolean) => Promise<import("../types/CommonTypes").EditorResponse<null>>;
|
|
62
|
+
/**
|
|
63
|
+
* This method updates radii of the rectangle and polygon shapes
|
|
64
|
+
* @param shapeFrameId The ID of the shapeFrame that needs to get updated.
|
|
65
|
+
* @param radius A radius object to update a desired corner;
|
|
66
|
+
* @returns
|
|
67
|
+
*/
|
|
68
|
+
private setShapeCorners;
|
|
69
|
+
/**
|
|
70
|
+
* This method will set the radius for all corners of the rectangle and polygon shapes
|
|
71
|
+
* @param shapeFrameId The ID of the shapeFrame that needs to get updated.
|
|
72
|
+
* @param radius A radius to update all corners at once;
|
|
73
|
+
* @returns
|
|
74
|
+
*/
|
|
75
|
+
setRadiusAll: (shapeFrameId: Id, radius: number) => Promise<import("../types/CommonTypes").EditorResponse<null>>;
|
|
76
|
+
/**
|
|
77
|
+
* This method will set the radius for the top left corner of the rectangle shape
|
|
78
|
+
* @param shapeFrameId The ID of the shapeFrame that needs to get updated.
|
|
79
|
+
* @param radius A radius to update the top left corner;
|
|
80
|
+
* @returns
|
|
81
|
+
*/
|
|
82
|
+
setRadiusTopLeft: (shapeFrameId: Id, radius: number) => Promise<import("../types/CommonTypes").EditorResponse<null>>;
|
|
83
|
+
/**
|
|
84
|
+
* This method will set the radius for the bottom left corner of the rectangle shape
|
|
85
|
+
* @param shapeFrameId The ID of the shapeFrame that needs to get updated.
|
|
86
|
+
* @param radius A radius to update the bottom left corner;
|
|
87
|
+
* @returns
|
|
88
|
+
*/
|
|
89
|
+
setRadiusBottomLeft: (shapeFrameId: Id, radius: number) => Promise<import("../types/CommonTypes").EditorResponse<null>>;
|
|
90
|
+
/**
|
|
91
|
+
* This method will set the radius for the top right corner of the rectangle shape
|
|
92
|
+
* @param shapeFrameId The ID of the shapeFrame that needs to get updated.
|
|
93
|
+
* @param radius A radius to update the top right corner;
|
|
94
|
+
* @returns
|
|
95
|
+
*/
|
|
96
|
+
setRadiusTopRight: (shapeFrameId: Id, radius: number) => Promise<import("../types/CommonTypes").EditorResponse<null>>;
|
|
97
|
+
/**
|
|
98
|
+
* This method will set the radius for the bottom right corner of the rectangle shape
|
|
99
|
+
* @param shapeFrameId The ID of the shapeFrame that needs to get updated.
|
|
100
|
+
* @param radius A radius to update the bottom right corner;
|
|
101
|
+
* @returns
|
|
102
|
+
*/
|
|
103
|
+
setRadiusBottomRight: (shapeFrameId: Id, radius: number) => Promise<import("../types/CommonTypes").EditorResponse<null>>;
|
|
104
|
+
}
|
|
@@ -0,0 +1,174 @@
|
|
|
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 _ShapeController_editorAPI;
|
|
22
|
+
import { getEditorResponseData } from '../utils/EditorResponseData';
|
|
23
|
+
/**
|
|
24
|
+
* The ShapeController is responsible for all communication regarding Shapes.
|
|
25
|
+
* Methods inside this controller can be called by `window.SDK.shape.{method-name}`
|
|
26
|
+
*/
|
|
27
|
+
export class ShapeController {
|
|
28
|
+
/**
|
|
29
|
+
* @ignore
|
|
30
|
+
*/
|
|
31
|
+
constructor(editorAPI) {
|
|
32
|
+
/**
|
|
33
|
+
* @ignore
|
|
34
|
+
*/
|
|
35
|
+
_ShapeController_editorAPI.set(this, void 0);
|
|
36
|
+
/**
|
|
37
|
+
* This method updates properties of the shape
|
|
38
|
+
* @param shapeFrameId The ID of the shapeFrame that needs to get updated.
|
|
39
|
+
* @param properties A property to update
|
|
40
|
+
* @returns
|
|
41
|
+
*/
|
|
42
|
+
this.setShapeProperties = (shapeFrameId, properties) => __awaiter(this, void 0, void 0, function* () {
|
|
43
|
+
const res = yield __classPrivateFieldGet(this, _ShapeController_editorAPI, "f");
|
|
44
|
+
return res
|
|
45
|
+
.setShapeProperties(shapeFrameId, JSON.stringify(properties))
|
|
46
|
+
.then((result) => getEditorResponseData(result));
|
|
47
|
+
});
|
|
48
|
+
/**
|
|
49
|
+
* This method will set the visibility of the shape fill.
|
|
50
|
+
* @param shapeFrameId The ID of the shapeFrame that needs to get updated.
|
|
51
|
+
* @param enableFill Whether the shape fill is visible.
|
|
52
|
+
* @returns
|
|
53
|
+
*/
|
|
54
|
+
this.setEnableFill = (shapeFrameId, enableFill) => __awaiter(this, void 0, void 0, function* () {
|
|
55
|
+
const properties = { enableFill: enableFill };
|
|
56
|
+
return this.setShapeProperties(shapeFrameId, properties);
|
|
57
|
+
});
|
|
58
|
+
/**
|
|
59
|
+
* This method will set the shape fill color of a specified shape frame.
|
|
60
|
+
* @param shapeFrameId The ID of the shapeFrame that needs to get updated.
|
|
61
|
+
* @param fillColor The new shape fill color that you want to set to the shapeFrame.
|
|
62
|
+
* @returns
|
|
63
|
+
*/
|
|
64
|
+
this.setFillColor = (shapeFrameId, fillColor) => __awaiter(this, void 0, void 0, function* () {
|
|
65
|
+
const properties = { fillColor: fillColor };
|
|
66
|
+
return this.setShapeProperties(shapeFrameId, properties);
|
|
67
|
+
});
|
|
68
|
+
/**
|
|
69
|
+
* This method will set the visibility of the shape stroke.
|
|
70
|
+
* @param shapeFrameId The ID of the shapeFrame that needs to get updated.
|
|
71
|
+
* @param enableStroke Whether the shape stroke is visible.
|
|
72
|
+
* @returns
|
|
73
|
+
*/
|
|
74
|
+
this.setEnableStroke = (shapeFrameId, enableStroke) => __awaiter(this, void 0, void 0, function* () {
|
|
75
|
+
const properties = { enableStroke: enableStroke };
|
|
76
|
+
return this.setShapeProperties(shapeFrameId, properties);
|
|
77
|
+
});
|
|
78
|
+
/**
|
|
79
|
+
* This method will set the shape stroke color of a specified shape frame.
|
|
80
|
+
* @param shapeFrameId The ID of the shapeFrame that needs to get updated.
|
|
81
|
+
* @param strokeColor The new shape stroke color that you want to set to the shapeFrame.
|
|
82
|
+
* @returns
|
|
83
|
+
*/
|
|
84
|
+
this.setStrokeColor = (shapeFrameId, strokeColor) => __awaiter(this, void 0, void 0, function* () {
|
|
85
|
+
const properties = { strokeColor: strokeColor };
|
|
86
|
+
return this.setShapeProperties(shapeFrameId, properties);
|
|
87
|
+
});
|
|
88
|
+
/**
|
|
89
|
+
* This method will set the shape stroke weight of a specified shape frame.
|
|
90
|
+
* @param shapeFrameId The ID of the shapeFrame that needs to get updated.
|
|
91
|
+
* @param strokeWeight The new shape stroke weight that you want to set to the shapeFrame.
|
|
92
|
+
* @returns
|
|
93
|
+
*/
|
|
94
|
+
this.setStrokeWeight = (shapeFrameId, strokeWeight) => __awaiter(this, void 0, void 0, function* () {
|
|
95
|
+
const properties = { strokeWeight: strokeWeight };
|
|
96
|
+
return this.setShapeProperties(shapeFrameId, properties);
|
|
97
|
+
});
|
|
98
|
+
/**
|
|
99
|
+
* This method will set the flag to change the way the rectangle shape corners will be changed: all at once or separately.
|
|
100
|
+
* @param shapeFrameId The ID of the shapeFrame that needs to get updated.
|
|
101
|
+
* @param allCornersSame The new flag that you want to set to the shapeFrame.
|
|
102
|
+
* @returns
|
|
103
|
+
*/
|
|
104
|
+
this.setFlagAllCornersSame = (shapeFrameId, allCornersSame) => __awaiter(this, void 0, void 0, function* () {
|
|
105
|
+
const properties = { allCornersSame: allCornersSame };
|
|
106
|
+
return this.setShapeProperties(shapeFrameId, properties);
|
|
107
|
+
});
|
|
108
|
+
/**
|
|
109
|
+
* This method updates radii of the rectangle and polygon shapes
|
|
110
|
+
* @param shapeFrameId The ID of the shapeFrame that needs to get updated.
|
|
111
|
+
* @param radius A radius object to update a desired corner;
|
|
112
|
+
* @returns
|
|
113
|
+
*/
|
|
114
|
+
this.setShapeCorners = (shapeFrameId, radius) => __awaiter(this, void 0, void 0, function* () {
|
|
115
|
+
const res = yield __classPrivateFieldGet(this, _ShapeController_editorAPI, "f");
|
|
116
|
+
return res
|
|
117
|
+
.setShapeCorners(shapeFrameId, JSON.stringify(radius))
|
|
118
|
+
.then((result) => getEditorResponseData(result));
|
|
119
|
+
});
|
|
120
|
+
/**
|
|
121
|
+
* This method will set the radius for all corners of the rectangle and polygon shapes
|
|
122
|
+
* @param shapeFrameId The ID of the shapeFrame that needs to get updated.
|
|
123
|
+
* @param radius A radius to update all corners at once;
|
|
124
|
+
* @returns
|
|
125
|
+
*/
|
|
126
|
+
this.setRadiusAll = (shapeFrameId, radius) => __awaiter(this, void 0, void 0, function* () {
|
|
127
|
+
const cornerRadius = { radiusAll: radius };
|
|
128
|
+
return this.setShapeCorners(shapeFrameId, cornerRadius);
|
|
129
|
+
});
|
|
130
|
+
/**
|
|
131
|
+
* This method will set the radius for the top left corner of the rectangle shape
|
|
132
|
+
* @param shapeFrameId The ID of the shapeFrame that needs to get updated.
|
|
133
|
+
* @param radius A radius to update the top left corner;
|
|
134
|
+
* @returns
|
|
135
|
+
*/
|
|
136
|
+
this.setRadiusTopLeft = (shapeFrameId, radius) => __awaiter(this, void 0, void 0, function* () {
|
|
137
|
+
const cornerRadius = { topLeft: radius };
|
|
138
|
+
return this.setShapeCorners(shapeFrameId, cornerRadius);
|
|
139
|
+
});
|
|
140
|
+
/**
|
|
141
|
+
* This method will set the radius for the bottom left corner of the rectangle shape
|
|
142
|
+
* @param shapeFrameId The ID of the shapeFrame that needs to get updated.
|
|
143
|
+
* @param radius A radius to update the bottom left corner;
|
|
144
|
+
* @returns
|
|
145
|
+
*/
|
|
146
|
+
this.setRadiusBottomLeft = (shapeFrameId, radius) => __awaiter(this, void 0, void 0, function* () {
|
|
147
|
+
const cornerRadius = { bottomLeft: radius };
|
|
148
|
+
return this.setShapeCorners(shapeFrameId, cornerRadius);
|
|
149
|
+
});
|
|
150
|
+
/**
|
|
151
|
+
* This method will set the radius for the top right corner of the rectangle shape
|
|
152
|
+
* @param shapeFrameId The ID of the shapeFrame that needs to get updated.
|
|
153
|
+
* @param radius A radius to update the top right corner;
|
|
154
|
+
* @returns
|
|
155
|
+
*/
|
|
156
|
+
this.setRadiusTopRight = (shapeFrameId, radius) => __awaiter(this, void 0, void 0, function* () {
|
|
157
|
+
const cornerRadius = { topRight: radius };
|
|
158
|
+
return this.setShapeCorners(shapeFrameId, cornerRadius);
|
|
159
|
+
});
|
|
160
|
+
/**
|
|
161
|
+
* This method will set the radius for the bottom right corner of the rectangle shape
|
|
162
|
+
* @param shapeFrameId The ID of the shapeFrame that needs to get updated.
|
|
163
|
+
* @param radius A radius to update the bottom right corner;
|
|
164
|
+
* @returns
|
|
165
|
+
*/
|
|
166
|
+
this.setRadiusBottomRight = (shapeFrameId, radius) => __awaiter(this, void 0, void 0, function* () {
|
|
167
|
+
const cornerRadius = { bottomRight: radius };
|
|
168
|
+
return this.setShapeCorners(shapeFrameId, cornerRadius);
|
|
169
|
+
});
|
|
170
|
+
__classPrivateFieldSet(this, _ShapeController_editorAPI, editorAPI, "f");
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
_ShapeController_editorAPI = new WeakMap();
|
|
174
|
+
//# sourceMappingURL=ShapeController.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ShapeController.js","sourceRoot":"","sources":["../../../src/controllers/ShapeController.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;AAGA,OAAO,EAAE,qBAAqB,EAAE,MAAM,6BAA6B,CAAC;AAEpE;;;GAGG;AACH,MAAM,OAAO,eAAe;IAMxB;;OAEG;IACH,YAAY,SAAoB;QARhC;;WAEG;QACH,6CAAsB;QAStB;;;;;WAKG;QACK,uBAAkB,GAAG,CAAO,YAAgB,EAAE,UAA2B,EAAE,EAAE;YACjF,MAAM,GAAG,GAAG,MAAM,uBAAA,IAAI,kCAAW,CAAC;YAClC,OAAO,GAAG;iBACL,kBAAkB,CAAC,YAAY,EAAE,IAAI,CAAC,SAAS,CAAC,UAAU,CAAC,CAAC;iBAC5D,IAAI,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,qBAAqB,CAAO,MAAM,CAAC,CAAC,CAAC;QAC/D,CAAC,CAAA,CAAC;QAEF;;;;;WAKG;QACH,kBAAa,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