@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,103 @@
|
|
|
1
|
+
import type { EditorAPI, EditorResponse, Id } from '../types/CommonTypes';
|
|
2
|
+
import { Layout } from '../types/LayoutTypes';
|
|
3
|
+
/**
|
|
4
|
+
* The LayoutController is responsible for all communication regarding Layouts.
|
|
5
|
+
* Methods inside this controller can be called by `window.SDK.layout.{method-name}`
|
|
6
|
+
*/
|
|
7
|
+
export declare class LayoutController {
|
|
8
|
+
#private;
|
|
9
|
+
/**
|
|
10
|
+
* @ignore
|
|
11
|
+
*/
|
|
12
|
+
constructor(editorAPI: EditorAPI);
|
|
13
|
+
/**
|
|
14
|
+
* This method returns the list of layouts
|
|
15
|
+
* @returns
|
|
16
|
+
*/
|
|
17
|
+
getLayouts: () => Promise<EditorResponse<Layout[]>>;
|
|
18
|
+
/**
|
|
19
|
+
* This method returns a layout by its id
|
|
20
|
+
* @param id The ID of a specific layout
|
|
21
|
+
* @returns
|
|
22
|
+
*/
|
|
23
|
+
getLayoutById: (id: Id) => Promise<EditorResponse<Layout>>;
|
|
24
|
+
/**
|
|
25
|
+
* This method returns a layout by its name
|
|
26
|
+
* @param name The name of a specific layout
|
|
27
|
+
* @returns
|
|
28
|
+
*/
|
|
29
|
+
getLayoutByName: (name: string) => Promise<EditorResponse<Layout>>;
|
|
30
|
+
/**
|
|
31
|
+
* This method returns the selected layout
|
|
32
|
+
* @returns
|
|
33
|
+
*/
|
|
34
|
+
getSelectedLayout: () => Promise<EditorResponse<Layout>>;
|
|
35
|
+
/**
|
|
36
|
+
* This method will remove a specific layout
|
|
37
|
+
* @param layoutId The ID of a specific layout
|
|
38
|
+
* @returns
|
|
39
|
+
*/
|
|
40
|
+
removeLayout: (layoutId: Id) => Promise<EditorResponse<null>>;
|
|
41
|
+
/**
|
|
42
|
+
* This method will add a new child layout (a new layout is always child of a root / parentlayout)
|
|
43
|
+
* @param parentId The ID of a specific layout, being the parent
|
|
44
|
+
* @returns
|
|
45
|
+
*/
|
|
46
|
+
addLayout: (parentId: Id) => Promise<EditorResponse<number>>;
|
|
47
|
+
/**
|
|
48
|
+
* This method will update the name of a specific layout
|
|
49
|
+
* @param layoutId The ID of a specific layout
|
|
50
|
+
* @param layoutName The new name that the layout should receive
|
|
51
|
+
* @returns
|
|
52
|
+
*/
|
|
53
|
+
setLayoutName: (layoutId: Id, layoutName: string) => Promise<EditorResponse<null>>;
|
|
54
|
+
/**
|
|
55
|
+
* This method will select a specific layout
|
|
56
|
+
* @param layoutId The ID of a specific layout
|
|
57
|
+
* @returns
|
|
58
|
+
*/
|
|
59
|
+
selectLayout: (layoutId: Id) => Promise<EditorResponse<null>>;
|
|
60
|
+
/**
|
|
61
|
+
* This method will duplicate a specific layout
|
|
62
|
+
* @param layoutId The ID of a specific layout
|
|
63
|
+
* @returns
|
|
64
|
+
*/
|
|
65
|
+
duplicateLayout: (layoutId: Id) => Promise<EditorResponse<number>>;
|
|
66
|
+
/**
|
|
67
|
+
* This method will reset a specific layout to its original value
|
|
68
|
+
* @param layoutId The ID of a specific layout
|
|
69
|
+
* @returns
|
|
70
|
+
*/
|
|
71
|
+
resetLayout: (layoutId: Id) => Promise<EditorResponse<null>>;
|
|
72
|
+
/**
|
|
73
|
+
* This method will set the height of the layout to a specific value
|
|
74
|
+
* @param layoutId The ID of a specific layout
|
|
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
|
+
setLayoutHeight: (layoutId: Id, value: string) => Promise<EditorResponse<null> | null>;
|
|
79
|
+
/**
|
|
80
|
+
* This method will set the width of the layout to a specific value
|
|
81
|
+
* @param layoutId The ID of a specific layout
|
|
82
|
+
* @param value The string value that will be calculated (f.e. 1+1 will result in 2) The notation is in pixels
|
|
83
|
+
* @returns
|
|
84
|
+
*/
|
|
85
|
+
setLayoutWidth: (layoutId: Id, value: string) => Promise<EditorResponse<null> | null>;
|
|
86
|
+
/**
|
|
87
|
+
* This method will reset the height of a specific layout to its original value
|
|
88
|
+
* @param layoutId The ID of a specific layout
|
|
89
|
+
* @returns
|
|
90
|
+
*/
|
|
91
|
+
resetLayoutHeight: (layoutId: Id) => Promise<EditorResponse<null>>;
|
|
92
|
+
/**
|
|
93
|
+
* This method will reset the width of a specific layout to its original value
|
|
94
|
+
* @param layoutId The ID of a specific layout
|
|
95
|
+
* @returns
|
|
96
|
+
*/
|
|
97
|
+
resetLayoutWidth: (layoutId: Id) => Promise<EditorResponse<null>>;
|
|
98
|
+
/**
|
|
99
|
+
* This method returns a UInt8Array containing a PNG encoded image of the currently selected layout.
|
|
100
|
+
* @returns UInt8Array snapshot of the current layout
|
|
101
|
+
*/
|
|
102
|
+
getSelectedLayoutSnapshot: () => Promise<Uint8Array>;
|
|
103
|
+
}
|
|
@@ -0,0 +1,190 @@
|
|
|
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 _LayoutController_editorAPI, _LayoutController_blobAPI;
|
|
22
|
+
import { getCalculatedValue } from '../utils/getCalculatedValue';
|
|
23
|
+
import { getEditorResponseData } from '../utils/EditorResponseData';
|
|
24
|
+
/**
|
|
25
|
+
* The LayoutController is responsible for all communication regarding Layouts.
|
|
26
|
+
* Methods inside this controller can be called by `window.SDK.layout.{method-name}`
|
|
27
|
+
*/
|
|
28
|
+
export class LayoutController {
|
|
29
|
+
/**
|
|
30
|
+
* @ignore
|
|
31
|
+
*/
|
|
32
|
+
constructor(editorAPI) {
|
|
33
|
+
/**
|
|
34
|
+
* @ignore
|
|
35
|
+
*/
|
|
36
|
+
_LayoutController_editorAPI.set(this, void 0);
|
|
37
|
+
_LayoutController_blobAPI.set(this, void 0);
|
|
38
|
+
/**
|
|
39
|
+
* This method returns the list of layouts
|
|
40
|
+
* @returns
|
|
41
|
+
*/
|
|
42
|
+
this.getLayouts = () => __awaiter(this, void 0, void 0, function* () {
|
|
43
|
+
const res = yield __classPrivateFieldGet(this, _LayoutController_editorAPI, "f");
|
|
44
|
+
return res.getLayouts().then((result) => getEditorResponseData(result));
|
|
45
|
+
});
|
|
46
|
+
/**
|
|
47
|
+
* This method returns a layout by its id
|
|
48
|
+
* @param id The ID of a specific layout
|
|
49
|
+
* @returns
|
|
50
|
+
*/
|
|
51
|
+
this.getLayoutById = (id) => __awaiter(this, void 0, void 0, function* () {
|
|
52
|
+
const res = yield __classPrivateFieldGet(this, _LayoutController_editorAPI, "f");
|
|
53
|
+
return res.getLayoutById(id).then((result) => getEditorResponseData(result));
|
|
54
|
+
});
|
|
55
|
+
/**
|
|
56
|
+
* This method returns a layout by its name
|
|
57
|
+
* @param name The name of a specific layout
|
|
58
|
+
* @returns
|
|
59
|
+
*/
|
|
60
|
+
this.getLayoutByName = (name) => __awaiter(this, void 0, void 0, function* () {
|
|
61
|
+
const res = yield __classPrivateFieldGet(this, _LayoutController_editorAPI, "f");
|
|
62
|
+
return res.getLayoutByName(name).then((result) => getEditorResponseData(result));
|
|
63
|
+
});
|
|
64
|
+
/**
|
|
65
|
+
* This method returns the selected layout
|
|
66
|
+
* @returns
|
|
67
|
+
*/
|
|
68
|
+
this.getSelectedLayout = () => __awaiter(this, void 0, void 0, function* () {
|
|
69
|
+
const res = yield __classPrivateFieldGet(this, _LayoutController_editorAPI, "f");
|
|
70
|
+
return res.getSelectedLayout().then((result) => getEditorResponseData(result));
|
|
71
|
+
});
|
|
72
|
+
/**
|
|
73
|
+
* This method will remove a specific layout
|
|
74
|
+
* @param layoutId The ID of a specific layout
|
|
75
|
+
* @returns
|
|
76
|
+
*/
|
|
77
|
+
this.removeLayout = (layoutId) => __awaiter(this, void 0, void 0, function* () {
|
|
78
|
+
const res = yield __classPrivateFieldGet(this, _LayoutController_editorAPI, "f");
|
|
79
|
+
return res.removeLayout(layoutId).then((result) => getEditorResponseData(result));
|
|
80
|
+
});
|
|
81
|
+
/**
|
|
82
|
+
* This method will add a new child layout (a new layout is always child of a root / parentlayout)
|
|
83
|
+
* @param parentId The ID of a specific layout, being the parent
|
|
84
|
+
* @returns
|
|
85
|
+
*/
|
|
86
|
+
this.addLayout = (parentId) => __awaiter(this, void 0, void 0, function* () {
|
|
87
|
+
const res = yield __classPrivateFieldGet(this, _LayoutController_editorAPI, "f");
|
|
88
|
+
return res.addLayout(parentId).then((result) => getEditorResponseData(result));
|
|
89
|
+
});
|
|
90
|
+
/**
|
|
91
|
+
* This method will update the name of a specific layout
|
|
92
|
+
* @param layoutId The ID of a specific layout
|
|
93
|
+
* @param layoutName The new name that the layout should receive
|
|
94
|
+
* @returns
|
|
95
|
+
*/
|
|
96
|
+
this.setLayoutName = (layoutId, layoutName) => __awaiter(this, void 0, void 0, function* () {
|
|
97
|
+
const res = yield __classPrivateFieldGet(this, _LayoutController_editorAPI, "f");
|
|
98
|
+
return res.renameLayout(layoutId, layoutName).then((result) => getEditorResponseData(result));
|
|
99
|
+
});
|
|
100
|
+
/**
|
|
101
|
+
* This method will select a specific layout
|
|
102
|
+
* @param layoutId The ID of a specific layout
|
|
103
|
+
* @returns
|
|
104
|
+
*/
|
|
105
|
+
this.selectLayout = (layoutId) => __awaiter(this, void 0, void 0, function* () {
|
|
106
|
+
const res = yield __classPrivateFieldGet(this, _LayoutController_editorAPI, "f");
|
|
107
|
+
return res.selectLayout(layoutId).then((result) => getEditorResponseData(result));
|
|
108
|
+
});
|
|
109
|
+
/**
|
|
110
|
+
* This method will duplicate a specific layout
|
|
111
|
+
* @param layoutId The ID of a specific layout
|
|
112
|
+
* @returns
|
|
113
|
+
*/
|
|
114
|
+
this.duplicateLayout = (layoutId) => __awaiter(this, void 0, void 0, function* () {
|
|
115
|
+
const res = yield __classPrivateFieldGet(this, _LayoutController_editorAPI, "f");
|
|
116
|
+
return res.duplicateLayout(layoutId).then((result) => getEditorResponseData(result));
|
|
117
|
+
});
|
|
118
|
+
/**
|
|
119
|
+
* This method will reset a specific layout to its original value
|
|
120
|
+
* @param layoutId The ID of a specific layout
|
|
121
|
+
* @returns
|
|
122
|
+
*/
|
|
123
|
+
this.resetLayout = (layoutId) => __awaiter(this, void 0, void 0, function* () {
|
|
124
|
+
const res = yield __classPrivateFieldGet(this, _LayoutController_editorAPI, "f");
|
|
125
|
+
return res.resetLayout(layoutId).then((result) => getEditorResponseData(result));
|
|
126
|
+
});
|
|
127
|
+
/**
|
|
128
|
+
* This method will set the height of the layout to a specific value
|
|
129
|
+
* @param layoutId The ID of a specific layout
|
|
130
|
+
* @param value The string value that will be calculated (f.e. 1+1 will result in 2) The notation is in pixels
|
|
131
|
+
* @returns
|
|
132
|
+
*/
|
|
133
|
+
this.setLayoutHeight = (layoutId, value) => __awaiter(this, void 0, void 0, function* () {
|
|
134
|
+
const res = yield __classPrivateFieldGet(this, _LayoutController_editorAPI, "f");
|
|
135
|
+
const calc = getCalculatedValue(value);
|
|
136
|
+
if (calc === null || calc === Infinity) {
|
|
137
|
+
return null;
|
|
138
|
+
}
|
|
139
|
+
return res
|
|
140
|
+
.setLayoutHeight(layoutId, parseFloat(calc.toString()))
|
|
141
|
+
.then((result) => getEditorResponseData(result));
|
|
142
|
+
});
|
|
143
|
+
/**
|
|
144
|
+
* This method will set the width of the layout to a specific value
|
|
145
|
+
* @param layoutId The ID of a specific layout
|
|
146
|
+
* @param value The string value that will be calculated (f.e. 1+1 will result in 2) The notation is in pixels
|
|
147
|
+
* @returns
|
|
148
|
+
*/
|
|
149
|
+
this.setLayoutWidth = (layoutId, value) => __awaiter(this, void 0, void 0, function* () {
|
|
150
|
+
const res = yield __classPrivateFieldGet(this, _LayoutController_editorAPI, "f");
|
|
151
|
+
const calc = getCalculatedValue(value);
|
|
152
|
+
if (calc === null || calc === Infinity) {
|
|
153
|
+
return null;
|
|
154
|
+
}
|
|
155
|
+
return res
|
|
156
|
+
.setLayoutWidth(layoutId, parseFloat(calc.toString()))
|
|
157
|
+
.then((result) => getEditorResponseData(result));
|
|
158
|
+
});
|
|
159
|
+
/**
|
|
160
|
+
* This method will reset the height of a specific layout to its original value
|
|
161
|
+
* @param layoutId The ID of a specific layout
|
|
162
|
+
* @returns
|
|
163
|
+
*/
|
|
164
|
+
this.resetLayoutHeight = (layoutId) => __awaiter(this, void 0, void 0, function* () {
|
|
165
|
+
const res = yield __classPrivateFieldGet(this, _LayoutController_editorAPI, "f");
|
|
166
|
+
return res.resetLayoutHeight(layoutId).then((result) => getEditorResponseData(result));
|
|
167
|
+
});
|
|
168
|
+
/**
|
|
169
|
+
* This method will reset the width of a specific layout to its original value
|
|
170
|
+
* @param layoutId The ID of a specific layout
|
|
171
|
+
* @returns
|
|
172
|
+
*/
|
|
173
|
+
this.resetLayoutWidth = (layoutId) => __awaiter(this, void 0, void 0, function* () {
|
|
174
|
+
const res = yield __classPrivateFieldGet(this, _LayoutController_editorAPI, "f");
|
|
175
|
+
return res.resetLayoutWidth(layoutId).then((result) => getEditorResponseData(result));
|
|
176
|
+
});
|
|
177
|
+
/**
|
|
178
|
+
* This method returns a UInt8Array containing a PNG encoded image of the currently selected layout.
|
|
179
|
+
* @returns UInt8Array snapshot of the current layout
|
|
180
|
+
*/
|
|
181
|
+
this.getSelectedLayoutSnapshot = () => __awaiter(this, void 0, void 0, function* () {
|
|
182
|
+
const res = yield __classPrivateFieldGet(this, _LayoutController_blobAPI, "f");
|
|
183
|
+
return res.getPageSnapshot().then((result) => { var _a; return (_a = result) !== null && _a !== void 0 ? _a : result; });
|
|
184
|
+
});
|
|
185
|
+
__classPrivateFieldSet(this, _LayoutController_editorAPI, editorAPI, "f");
|
|
186
|
+
__classPrivateFieldSet(this, _LayoutController_blobAPI, editorAPI, "f");
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
_LayoutController_editorAPI = new WeakMap(), _LayoutController_blobAPI = new WeakMap();
|
|
190
|
+
//# sourceMappingURL=LayoutController.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"LayoutController.js","sourceRoot":"","sources":["../../../src/controllers/LayoutController.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;AACA,OAAO,EAAE,kBAAkB,EAAE,MAAM,6BAA6B,CAAC;AACjE,OAAO,EAAE,qBAAqB,EAAE,MAAM,6BAA6B,CAAC;AAIpE;;;GAGG;AACH,MAAM,OAAO,gBAAgB;IAOzB;;OAEG;IACH,YAAY,SAAoB;QAThC;;WAEG;QACH,8CAAsB;QACtB,4CAAuB;QAUvB;;;WAGG;QACH,eAAU,GAAG,GAAS,EAAE;YACpB,MAAM,GAAG,GAAG,MAAM,uBAAA,IAAI,mCAAW,CAAC;YAClC,OAAO,GAAG,CAAC,UAAU,EAAE,CAAC,IAAI,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,qBAAqB,CAAW,MAAM,CAAC,CAAC,CAAC;QACtF,CAAC,CAAA,CAAC;QAEF;;;;WAIG;QACH,kBAAa,GAAG,CAAO,EAAM,EAAE,EAAE;YAC7B,MAAM,GAAG,GAAG,MAAM,uBAAA,IAAI,mCAAW,CAAC;YAClC,OAAO,GAAG,CAAC,aAAa,CAAC,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,qBAAqB,CAAS,MAAM,CAAC,CAAC,CAAC;QACzF,CAAC,CAAA,CAAC;QAEF;;;;WAIG;QACH,oBAAe,GAAG,CAAO,IAAY,EAAE,EAAE;YACrC,MAAM,GAAG,GAAG,MAAM,uBAAA,IAAI,mCAAW,CAAC;YAClC,OAAO,GAAG,CAAC,eAAe,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,qBAAqB,CAAS,MAAM,CAAC,CAAC,CAAC;QAC7F,CAAC,CAAA,CAAC;QAEF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C;QAC9G,CAAC,CAAA,CAAC;QArKE,uBAAA,IAAI,+BAAc,SAAS,MAAA,CAAC;QAC5B,uBAAA,IAAI,6BAAY,SAAuC,MAAA,CAAC;IAC5D,CAAC;CAoKJ"}
|
|
@@ -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 { Media, MediaDownloadType } from '../types/MediaConnectorTypes';
|
|
4
|
+
/**
|
|
5
|
+
* The MediaConnectorController is responsible for all communication regarding media connectors.
|
|
6
|
+
* Methods inside this controller can be called by `window.SDK.mediaConnector.{method-name}`
|
|
7
|
+
*
|
|
8
|
+
* The way CHILI Studio handles different sources of media is called 'MediaConnectors'. A MediaConnectors 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 media 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 MediaConnectorController {
|
|
17
|
+
#private;
|
|
18
|
+
/**
|
|
19
|
+
* @ignore
|
|
20
|
+
*/
|
|
21
|
+
constructor(editorAPI: EditorAPI);
|
|
22
|
+
/**
|
|
23
|
+
* Query a specific MediaConnector for data using both standardized queryOptions and the dynamic
|
|
24
|
+
* context as parameters. This call returns an array of Media items.
|
|
25
|
+
* @param connectorId unique Id of the media 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<Media>>>;
|
|
30
|
+
/**
|
|
31
|
+
* Returns a single media using a specific MediaConnector.
|
|
32
|
+
*
|
|
33
|
+
* The connector needs to list `detail` as a supported capability.
|
|
34
|
+
* @param connectorId unique Id of the Media connector
|
|
35
|
+
* @param mediaId unique id of the Media
|
|
36
|
+
*/
|
|
37
|
+
detail: (connectorId: string, mediaId: string) => Promise<EditorResponse<Media>>;
|
|
38
|
+
/**
|
|
39
|
+
* The combination of a `connectorId` and `mediaId` is typically enough for a media connector to
|
|
40
|
+
* perform the download of this asset. The `download` endpoint is capable of relaying this information to the
|
|
41
|
+
* media connector instance running in the editor engine.
|
|
42
|
+
* @param connectorId unique Id of the media connector
|
|
43
|
+
* @param mediaId unique Id of the media to download
|
|
44
|
+
* @param downloadType hint to the media connector about desired quality of the downloaded media
|
|
45
|
+
* @param context dynamic map of additional options potentially used by the connector
|
|
46
|
+
*/
|
|
47
|
+
download: (connectorId: string, mediaId: string, downloadType: MediaDownloadType, context: MetaData) => Promise<Uint8Array>;
|
|
48
|
+
/**
|
|
49
|
+
* Depending on the connector capabilities, this api method allows you to upload new media to the
|
|
50
|
+
* connector's backend.
|
|
51
|
+
* @param connectorId unique Id of the media connector
|
|
52
|
+
* @param mediaId unique Id of the media to upload
|
|
53
|
+
* @param blob byte array representation of the media to upload
|
|
54
|
+
*/
|
|
55
|
+
upload: (connectorId: string, mediaId: string, blob: Uint8Array) => Promise<EditorResponse<null>>;
|
|
56
|
+
/**
|
|
57
|
+
* Depending on the connector capabilities, removes media identified by `mediaId` from the connector's backend storage
|
|
58
|
+
* @param connectorId unique Id of the media connector
|
|
59
|
+
* @param mediaId unique Id of the media to download
|
|
60
|
+
*/
|
|
61
|
+
remove: (connectorId: string, mediaId: string) => Promise<EditorResponse<null>>;
|
|
62
|
+
/**
|
|
63
|
+
* Depending on the connector capabilities, copies media identified by `mediaId` to a new media item on the
|
|
64
|
+
* connector's backend
|
|
65
|
+
* @param connectorId unique Id of the media connector
|
|
66
|
+
* @param mediaId unique Id of the media to download
|
|
67
|
+
* @param newName name of the copied media on the connector's backend
|
|
68
|
+
*/
|
|
69
|
+
copy: (connectorId: string, mediaId: 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 media 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 media 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 media connector
|
|
88
|
+
*/
|
|
89
|
+
getCapabilities: (connectorId: string) => Promise<EditorResponse<ConnectorCapabilities>>;
|
|
90
|
+
/**
|
|
91
|
+
* This method will parse the deprecatedMediaType to the new media type. This method will be removed once the deprecatedMediaType is out of use
|
|
92
|
+
* @param deprecatedType is 0 or 1
|
|
93
|
+
*/
|
|
94
|
+
parseDeprecatedMediaType: (deprecatedType: DeprecatedMediaType) => MediaType | undefined;
|
|
95
|
+
}
|
|
@@ -0,0 +1,170 @@
|
|
|
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 _MediaConnectorController_editorAPI, _MediaConnectorController_blobAPI;
|
|
22
|
+
import { getEditorResponseData } from '../utils/EditorResponseData';
|
|
23
|
+
import { DeprecatedMediaType, MediaType, } from '../types/ConnectorTypes';
|
|
24
|
+
/**
|
|
25
|
+
* The MediaConnectorController is responsible for all communication regarding media connectors.
|
|
26
|
+
* Methods inside this controller can be called by `window.SDK.mediaConnector.{method-name}`
|
|
27
|
+
*
|
|
28
|
+
* The way CHILI Studio handles different sources of media is called 'MediaConnectors'. A MediaConnectors 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 media 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 MediaConnectorController {
|
|
37
|
+
/**
|
|
38
|
+
* @ignore
|
|
39
|
+
*/
|
|
40
|
+
constructor(editorAPI) {
|
|
41
|
+
/**
|
|
42
|
+
* @ignore
|
|
43
|
+
*/
|
|
44
|
+
_MediaConnectorController_editorAPI.set(this, void 0);
|
|
45
|
+
_MediaConnectorController_blobAPI.set(this, void 0);
|
|
46
|
+
/**
|
|
47
|
+
* Query a specific MediaConnector for data using both standardized queryOptions and the dynamic
|
|
48
|
+
* context as parameters. This call returns an array of Media items.
|
|
49
|
+
* @param connectorId unique Id of the media 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, _MediaConnectorController_editorAPI, "f");
|
|
55
|
+
return res
|
|
56
|
+
.mediaConnectorQuery(connectorId, JSON.stringify(queryOptions), JSON.stringify(context))
|
|
57
|
+
.then((result) => getEditorResponseData(result));
|
|
58
|
+
});
|
|
59
|
+
/**
|
|
60
|
+
* Returns a single media using a specific MediaConnector.
|
|
61
|
+
*
|
|
62
|
+
* The connector needs to list `detail` as a supported capability.
|
|
63
|
+
* @param connectorId unique Id of the Media connector
|
|
64
|
+
* @param mediaId unique id of the Media
|
|
65
|
+
*/
|
|
66
|
+
this.detail = (connectorId, mediaId) => __awaiter(this, void 0, void 0, function* () {
|
|
67
|
+
const res = yield __classPrivateFieldGet(this, _MediaConnectorController_editorAPI, "f");
|
|
68
|
+
return res.mediaConnectorDetail(connectorId, mediaId).then((result) => getEditorResponseData(result));
|
|
69
|
+
});
|
|
70
|
+
/**
|
|
71
|
+
* The combination of a `connectorId` and `mediaId` is typically enough for a media connector to
|
|
72
|
+
* perform the download of this asset. The `download` endpoint is capable of relaying this information to the
|
|
73
|
+
* media connector instance running in the editor engine.
|
|
74
|
+
* @param connectorId unique Id of the media connector
|
|
75
|
+
* @param mediaId unique Id of the media to download
|
|
76
|
+
* @param downloadType hint to the media connector about desired quality of the downloaded media
|
|
77
|
+
* @param context dynamic map of additional options potentially used by the connector
|
|
78
|
+
*/
|
|
79
|
+
this.download = (connectorId, mediaId, downloadType, context) => __awaiter(this, void 0, void 0, function* () {
|
|
80
|
+
const res = yield __classPrivateFieldGet(this, _MediaConnectorController_blobAPI, "f");
|
|
81
|
+
return res
|
|
82
|
+
.mediaConnectorDownload(connectorId, mediaId, 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 media to the
|
|
87
|
+
* connector's backend.
|
|
88
|
+
* @param connectorId unique Id of the media connector
|
|
89
|
+
* @param mediaId unique Id of the media to upload
|
|
90
|
+
* @param blob byte array representation of the media to upload
|
|
91
|
+
*/
|
|
92
|
+
this.upload = (connectorId, mediaId, blob) => __awaiter(this, void 0, void 0, function* () {
|
|
93
|
+
const res = yield __classPrivateFieldGet(this, _MediaConnectorController_editorAPI, "f");
|
|
94
|
+
return res
|
|
95
|
+
.mediaConnectorUpload(connectorId, mediaId, blob)
|
|
96
|
+
.then((result) => getEditorResponseData(result));
|
|
97
|
+
});
|
|
98
|
+
/**
|
|
99
|
+
* Depending on the connector capabilities, removes media identified by `mediaId` from the connector's backend storage
|
|
100
|
+
* @param connectorId unique Id of the media connector
|
|
101
|
+
* @param mediaId unique Id of the media to download
|
|
102
|
+
*/
|
|
103
|
+
this.remove = (connectorId, mediaId) => __awaiter(this, void 0, void 0, function* () {
|
|
104
|
+
const res = yield __classPrivateFieldGet(this, _MediaConnectorController_editorAPI, "f");
|
|
105
|
+
return res.mediaConnectorRemove(connectorId, mediaId).then((result) => getEditorResponseData(result));
|
|
106
|
+
});
|
|
107
|
+
/**
|
|
108
|
+
* Depending on the connector capabilities, copies media identified by `mediaId` to a new media item on the
|
|
109
|
+
* connector's backend
|
|
110
|
+
* @param connectorId unique Id of the media connector
|
|
111
|
+
* @param mediaId unique Id of the media to download
|
|
112
|
+
* @param newName name of the copied media on the connector's backend
|
|
113
|
+
*/
|
|
114
|
+
this.copy = (connectorId, mediaId, newName) => __awaiter(this, void 0, void 0, function* () {
|
|
115
|
+
const res = yield __classPrivateFieldGet(this, _MediaConnectorController_editorAPI, "f");
|
|
116
|
+
return res
|
|
117
|
+
.mediaConnectorCopy(connectorId, mediaId, newName)
|
|
118
|
+
.then((result) => getEditorResponseData(result));
|
|
119
|
+
});
|
|
120
|
+
/**
|
|
121
|
+
* All connectors have a certain set of queryOptions they allow to be passed in the query context. This
|
|
122
|
+
* method allows you to discover what options are available for a given connector. If you want to use any of these
|
|
123
|
+
* options, they need to be passed in the `context` parameter of the `query` api method.
|
|
124
|
+
* @param connectorId unique Id of the media connector
|
|
125
|
+
*/
|
|
126
|
+
this.getQueryOptions = (connectorId) => __awaiter(this, void 0, void 0, function* () {
|
|
127
|
+
const res = yield __classPrivateFieldGet(this, _MediaConnectorController_editorAPI, "f");
|
|
128
|
+
return res
|
|
129
|
+
.mediaConnectorGetQueryOptions(connectorId)
|
|
130
|
+
.then((result) => getEditorResponseData(result));
|
|
131
|
+
});
|
|
132
|
+
/**
|
|
133
|
+
* All connectors have a certain set of downloadOptions they allow to be passed in the download context. This
|
|
134
|
+
* method allows you to discover what options are available for a given connector. If you want to use any of these
|
|
135
|
+
* options, they need to be passed in the `context` parameter of the `download` api method.
|
|
136
|
+
* @param connectorId unique Id of the media connector
|
|
137
|
+
*/
|
|
138
|
+
this.getDownloadOptions = (connectorId) => __awaiter(this, void 0, void 0, function* () {
|
|
139
|
+
const res = yield __classPrivateFieldGet(this, _MediaConnectorController_editorAPI, "f");
|
|
140
|
+
return res
|
|
141
|
+
.mediaConnectorGetDownloadOptions(connectorId)
|
|
142
|
+
.then((result) => getEditorResponseData(result));
|
|
143
|
+
});
|
|
144
|
+
/**
|
|
145
|
+
* This method returns what capabilities the selected connector has. It gives an indication what methods can
|
|
146
|
+
* be used successfully for a certain connector.
|
|
147
|
+
* @param connectorId unique Id of the media connector
|
|
148
|
+
*/
|
|
149
|
+
this.getCapabilities = (connectorId) => __awaiter(this, void 0, void 0, function* () {
|
|
150
|
+
const res = yield __classPrivateFieldGet(this, _MediaConnectorController_editorAPI, "f");
|
|
151
|
+
return res
|
|
152
|
+
.mediaConnectorGetCapabilities(connectorId)
|
|
153
|
+
.then((result) => getEditorResponseData(result));
|
|
154
|
+
});
|
|
155
|
+
/**
|
|
156
|
+
* This method will parse the deprecatedMediaType to the new media type. This method will be removed once the deprecatedMediaType is out of use
|
|
157
|
+
* @param deprecatedType is 0 or 1
|
|
158
|
+
*/
|
|
159
|
+
this.parseDeprecatedMediaType = (deprecatedType) => {
|
|
160
|
+
if (deprecatedType === DeprecatedMediaType.file)
|
|
161
|
+
return MediaType.file;
|
|
162
|
+
if (deprecatedType === DeprecatedMediaType.collection)
|
|
163
|
+
return MediaType.collection;
|
|
164
|
+
};
|
|
165
|
+
__classPrivateFieldSet(this, _MediaConnectorController_editorAPI, editorAPI, "f");
|
|
166
|
+
__classPrivateFieldSet(this, _MediaConnectorController_blobAPI, editorAPI, "f");
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
_MediaConnectorController_editorAPI = new WeakMap(), _MediaConnectorController_blobAPI = new WeakMap();
|
|
170
|
+
//# sourceMappingURL=MediaConnectorController.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MediaConnectorController.js","sourceRoot":"","sources":["../../../src/controllers/MediaConnectorController.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,wBAAwB;IAOjC;;OAEG;IACH,YAAY,SAAoB;QAThC;;WAEG;QACH,sDAAsB;QACtB,oDAAuB;QAUvB;;;;;;WAMG;QACH,UAAK,GAAG,CAAO,WAAmB,EAAE,YAA0B,EAAE,OAAiB,EAAE,EAAE;YACjF,MAAM,GAAG,GAAG,MAAM,uBAAA,IAAI,2CAAW,CAAC;YAClC,OAAO,GAAG;iBACL,mBAAmB,CAAC,WAAW,EAAE,IAAI,CAAC,SAAS,CAAC,YAAY,CAAC,EAAE,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC;iBACvF,IAAI,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,qBAAqB,CAAmB,MAAM,CAAC,CAAC,CAAC;QAC3E,CAAC,CAAA,CAAC;QAEF;;;;;;WAMG;QACH,WAAM,GAAG,CAAO,WAAmB,EAAE,OAAe,EAAE,EAAE;YACpD,MAAM,GAAG,GAAG,MAAM,uBAAA,IAAI,2CAAW,CAAC;YAClC,OAAO,GAAG,CAAC,oBAAoB,CAAC,WAAW,EAAE,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,qBAAqB,CAAQ,MAAM,CAAC,CAAC,CAAC;QACjH,CAAC,CAAA,CAAC;QAEF;;;;;;;;WAQG;QACH,aAAQ,GAAG,CACP,WAAmB,EACnB,OAAe,EACf,YAA+B,EAC/B,OAAiB,EACE,EAAE;YACrB,MAAM,GAAG,GAAG,MAAM,uBAAA,IAAI,yCAAS,CAAC;YA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} from '../types/CommonTypes';
|
|
2
|
+
import { Page } from '../types/PageTypes';
|
|
3
|
+
/**
|
|
4
|
+
* The PageController is responsible for all communication regarding Pages.
|
|
5
|
+
* Methods inside this controller can be called by `window.SDK.page.{method-name}`
|
|
6
|
+
*/
|
|
7
|
+
export declare class PageController {
|
|
8
|
+
#private;
|
|
9
|
+
/**
|
|
10
|
+
* @ignore
|
|
11
|
+
*/
|
|
12
|
+
constructor(editorAPI: EditorAPI);
|
|
13
|
+
/**
|
|
14
|
+
* This method returns the list of pages
|
|
15
|
+
* @returns
|
|
16
|
+
*/
|
|
17
|
+
getPages: () => Promise<import("../types/CommonTypes").EditorResponse<Page[]>>;
|
|
18
|
+
/**
|
|
19
|
+
* This method returns a page by its id
|
|
20
|
+
* @param pageId The ID of a specific page
|
|
21
|
+
* @returns
|
|
22
|
+
*/
|
|
23
|
+
getPageById: (pageId: Id) => Promise<import("../types/CommonTypes").EditorResponse<Page>>;
|
|
24
|
+
/**
|
|
25
|
+
* This method will set the width of the page to a specific value.
|
|
26
|
+
* This only works if the document is a project.
|
|
27
|
+
* @param pageId The ID of a specific page
|
|
28
|
+
* @param value The string value that will be calculated (f.e. 1+1 will result in 2) The notation is in pixels
|
|
29
|
+
* @returns
|
|
30
|
+
*/
|
|
31
|
+
setPageWidth: (pageId: Id, value: string) => Promise<import("../types/CommonTypes").EditorResponse<null> | null>;
|
|
32
|
+
/**
|
|
33
|
+
* This method will set the height of the page to a specific value.
|
|
34
|
+
* This only works if the document is a project.
|
|
35
|
+
* @param pageId The ID of a specific page
|
|
36
|
+
* @param value The string value that will be calculated (f.e. 1+1 will result in 2) The notation is in pixels
|
|
37
|
+
* @returns
|
|
38
|
+
*/
|
|
39
|
+
setPageHeight: (pageId: Id, value: string) => Promise<import("../types/CommonTypes").EditorResponse<null> | null>;
|
|
40
|
+
}
|