@chili-publish/studio-sdk 1.44.0 → 1.45.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/_bundles/main.js +2 -2
- package/_bundles/main.js.map +1 -1
- package/lib/src/controllers/BrandKitController.cjs.js +13 -64
- package/lib/src/controllers/BrandKitController.cjs.js.map +1 -1
- package/lib/src/controllers/BrandKitController.d.ts +22 -30
- package/lib/src/controllers/BrandKitController.es.js +13 -64
- package/lib/src/controllers/BrandKitController.es.js.map +1 -1
- package/lib/src/controllers/ComponentController.cjs.js.map +1 -1
- package/lib/src/controllers/ComponentController.d.ts +1 -1
- package/lib/src/controllers/ComponentController.es.js.map +1 -1
- package/lib/src/controllers/ConnectorController.cjs.js.map +1 -1
- package/lib/src/controllers/ConnectorController.d.ts +5 -5
- package/lib/src/controllers/ConnectorController.es.js.map +1 -1
- package/lib/src/exceptions/AsyncExceptions.cjs.js.map +1 -1
- package/lib/src/exceptions/AsyncExceptions.d.ts +1 -0
- package/lib/src/exceptions/AsyncExceptions.es.js.map +1 -1
- package/lib/src/exceptions/Helpers.cjs.js.map +1 -1
- package/lib/src/exceptions/Helpers.es.js.map +1 -1
- package/lib/src/index.cjs.js +3 -2
- package/lib/src/index.cjs.js.map +1 -1
- package/lib/src/index.d.ts +2 -1
- package/lib/src/index.es.js +2 -1
- package/lib/src/next/NextInitiator.cjs.js +0 -2
- package/lib/src/next/NextInitiator.cjs.js.map +1 -1
- package/lib/src/next/NextInitiator.d.ts +0 -2
- package/lib/src/next/NextInitiator.es.js +0 -2
- package/lib/src/next/NextInitiator.es.js.map +1 -1
- package/lib/src/next/index.d.ts +0 -1
- package/lib/src/sdk/editor-engine.json.cjs.js +1 -1
- package/lib/src/sdk/editor-engine.json.es.js +1 -1
- package/lib/src/sdk/package.json.cjs.js +1 -1
- package/lib/src/sdk/package.json.es.js +1 -1
- package/lib/src/sdk.cjs.js +116 -78
- package/lib/src/sdk.cjs.js.map +1 -1
- package/lib/src/sdk.d.ts +52 -34
- package/lib/src/sdk.es.js +116 -78
- package/lib/src/sdk.es.js.map +1 -1
- package/lib/src/types/BrandKitTypes.d.ts +70 -108
- package/lib/src/types/ColorStyleTypes.cjs.js +10 -0
- package/lib/src/types/ColorStyleTypes.cjs.js.map +1 -1
- package/lib/src/types/ColorStyleTypes.es.js +10 -0
- package/lib/src/types/ColorStyleTypes.es.js.map +1 -1
- package/lib/src/types/CommonTypes.cjs.js +1 -0
- package/lib/src/types/CommonTypes.cjs.js.map +1 -1
- package/lib/src/types/CommonTypes.d.ts +2 -1
- package/lib/src/types/CommonTypes.es.js +1 -0
- package/lib/src/types/CommonTypes.es.js.map +1 -1
- package/lib/src/types/ConnectorTypes.cjs.js +6 -2
- package/lib/src/types/ConnectorTypes.cjs.js.map +1 -1
- package/lib/src/types/ConnectorTypes.d.ts +10 -1
- package/lib/src/types/ConnectorTypes.es.js +6 -2
- package/lib/src/types/ConnectorTypes.es.js.map +1 -1
- package/lib/src/types/FrameTypes.cjs.js.map +1 -1
- package/lib/src/types/FrameTypes.d.ts +1 -4
- package/lib/src/types/FrameTypes.es.js.map +1 -1
- package/lib/src/types/MethodInvocationTypes.d.ts +27 -0
- package/lib/src/utils/EngineEventTrigger.cjs.js +4 -1
- package/lib/src/utils/EngineEventTrigger.cjs.js.map +1 -1
- package/lib/src/utils/EngineEventTrigger.d.ts +2 -1
- package/lib/src/utils/EngineEventTrigger.es.js +5 -2
- package/lib/src/utils/EngineEventTrigger.es.js.map +1 -1
- package/lib/src/utils/MethodInstrumentation.cjs.js +176 -0
- package/lib/src/utils/MethodInstrumentation.cjs.js.map +1 -0
- package/lib/src/utils/MethodInstrumentation.d.ts +10 -0
- package/lib/src/utils/MethodInstrumentation.es.js +176 -0
- package/lib/src/utils/MethodInstrumentation.es.js.map +1 -0
- package/lib/src/utils/SdkEvent.cjs.js +29 -0
- package/lib/src/utils/SdkEvent.cjs.js.map +1 -0
- package/lib/src/utils/SdkEvent.d.ts +13 -0
- package/lib/src/utils/SdkEvent.es.js +29 -0
- package/lib/src/utils/SdkEvent.es.js.map +1 -0
- package/lib/src/utils/SdkEvents.cjs.js +11 -0
- package/lib/src/utils/SdkEvents.cjs.js.map +1 -0
- package/lib/src/utils/SdkEvents.d.ts +19 -0
- package/lib/src/utils/SdkEvents.es.js +11 -0
- package/lib/src/utils/SdkEvents.es.js.map +1 -0
- package/package.json +1 -1
- package/lib/src/next/controllers/BrandKitController.cjs.js +0 -34
- package/lib/src/next/controllers/BrandKitController.cjs.js.map +0 -1
- package/lib/src/next/controllers/BrandKitController.d.ts +0 -24
- package/lib/src/next/controllers/BrandKitController.es.js +0 -34
- package/lib/src/next/controllers/BrandKitController.es.js.map +0 -1
- package/lib/src/next/types/BrandKitTypes.d.ts +0 -52
- package/lib/src/utils/BrandKitAdapter.cjs.js +0 -42
- package/lib/src/utils/BrandKitAdapter.cjs.js.map +0 -1
- package/lib/src/utils/BrandKitAdapter.d.ts +0 -9
- package/lib/src/utils/BrandKitAdapter.es.js +0 -42
- package/lib/src/utils/BrandKitAdapter.es.js.map +0 -1
package/lib/src/sdk.cjs.js
CHANGED
|
@@ -43,19 +43,34 @@ const GradientStyleController = require("./controllers/GradientStyleController.c
|
|
|
43
43
|
const ComponentConnectorController = require("./controllers/ComponentConnectorController.cjs.js");
|
|
44
44
|
const ComponentController = require("./controllers/ComponentController.cjs.js");
|
|
45
45
|
const ComponentGridController = require("./controllers/ComponentGridController.cjs.js");
|
|
46
|
+
const MethodInstrumentation = require("./utils/MethodInstrumentation.cjs.js");
|
|
47
|
+
const SdkEvents = require("./utils/SdkEvents.cjs.js");
|
|
46
48
|
const ENGINE_DOMAIN = "studio-cdn.chiligrafx.com";
|
|
47
49
|
const FIXED_EDITOR_LINK = `https://${ENGINE_DOMAIN}/editor/${editorEngine.default.current}/web`;
|
|
48
50
|
let connection;
|
|
51
|
+
const PENDING_INSTRUMENTATION = Symbol("pendingInstrumentation");
|
|
52
|
+
const markForInstrumentation = (controller) => {
|
|
53
|
+
Object.defineProperty(controller, PENDING_INSTRUMENTATION, {
|
|
54
|
+
value: true,
|
|
55
|
+
enumerable: false,
|
|
56
|
+
configurable: true
|
|
57
|
+
});
|
|
58
|
+
};
|
|
59
|
+
const isPendingInstrumentation = (value) => {
|
|
60
|
+
return typeof value === "object" && value !== null && value[PENDING_INSTRUMENTATION] === true;
|
|
61
|
+
};
|
|
49
62
|
class SDK {
|
|
50
63
|
/**
|
|
51
64
|
* The SDK should be configured clientside and it exposes all controllers to work with in other applications
|
|
52
65
|
* @param config The configuration object where the SDK and editor can get configured
|
|
53
66
|
*/
|
|
54
67
|
constructor(config) {
|
|
68
|
+
var _a;
|
|
55
69
|
this.localConfig = /* @__PURE__ */ new Map();
|
|
56
70
|
this.dataItemMappingTools = new DataItemMappingTools.DataItemMappingTools();
|
|
71
|
+
this.methodListeners = new MethodInstrumentation.MethodListenerRegistry();
|
|
57
72
|
this.loadEditor = () => {
|
|
58
|
-
var
|
|
73
|
+
var _a2;
|
|
59
74
|
Connector.default(
|
|
60
75
|
this.config.editorLink || FIXED_EDITOR_LINK,
|
|
61
76
|
{
|
|
@@ -73,8 +88,8 @@ class SDK {
|
|
|
73
88
|
onScrubberPositionChanged: this.subscriber.onAnimationPlaybackChanged,
|
|
74
89
|
onFrameAnimationsChanged: this.subscriber.onAnimationChanged,
|
|
75
90
|
onVariableListChanged: (state) => {
|
|
76
|
-
var
|
|
77
|
-
if ((
|
|
91
|
+
var _a3;
|
|
92
|
+
if ((_a3 = this.enabledNextSubscribers) == null ? void 0 : _a3.onVariableListChanged) {
|
|
78
93
|
this.next.subscriber.onVariableListChanged(state);
|
|
79
94
|
} else {
|
|
80
95
|
this.subscriber.onVariableListChanged(state);
|
|
@@ -92,8 +107,8 @@ class SDK {
|
|
|
92
107
|
onLayoutsChanged: this.subscriber.onLayoutsChanged,
|
|
93
108
|
onConnectorEvent: this.subscriber.onConnectorEvent,
|
|
94
109
|
onConnectorsChanged: (state) => {
|
|
95
|
-
var
|
|
96
|
-
if ((
|
|
110
|
+
var _a3;
|
|
111
|
+
if ((_a3 = this.enabledNextSubscribers) == null ? void 0 : _a3.onConnectorsChanged) {
|
|
97
112
|
this.next.subscriber.onConnectorsChanged(state);
|
|
98
113
|
} else {
|
|
99
114
|
this.subscriber.onConnectorsChanged(state);
|
|
@@ -104,8 +119,8 @@ class SDK {
|
|
|
104
119
|
onPagesChanged: this.subscriber.onPagesChanged,
|
|
105
120
|
onPageSnapshotInvalidated: this.subscriber.onPageSnapshotInvalidated,
|
|
106
121
|
onPageSizeChanged: (state) => {
|
|
107
|
-
var
|
|
108
|
-
if ((
|
|
122
|
+
var _a3;
|
|
123
|
+
if ((_a3 = this.enabledNextSubscribers) == null ? void 0 : _a3.onPageSizeChanged) {
|
|
109
124
|
this.next.subscriber.onPageSizeChanged(state);
|
|
110
125
|
} else {
|
|
111
126
|
this.subscriber.onPageSizeChanged(state);
|
|
@@ -127,48 +142,49 @@ class SDK {
|
|
|
127
142
|
this.config.editorId,
|
|
128
143
|
this.config.studioStyling,
|
|
129
144
|
(error) => {
|
|
130
|
-
var
|
|
131
|
-
(_b = (
|
|
145
|
+
var _a3, _b;
|
|
146
|
+
(_b = (_a3 = this.config).onConnectionError) == null ? void 0 : _b.call(_a3, error);
|
|
132
147
|
}
|
|
133
148
|
);
|
|
134
149
|
this.editorAPI = connection == null ? void 0 : connection.promise.then((editorAPI) => {
|
|
135
150
|
return editorAPI;
|
|
136
151
|
});
|
|
137
|
-
this.action = new ActionController.ActionController(this.editorAPI);
|
|
138
|
-
this.layout = new LayoutController.LayoutController(this.editorAPI);
|
|
139
|
-
this.frame = new FrameController.FrameController(this.editorAPI);
|
|
140
|
-
this.barcode = new BarcodeController.BarcodeController(this.editorAPI);
|
|
141
|
-
this.component = new ComponentController.ComponentController(this.editorAPI);
|
|
142
|
-
this.animation = new AnimationController.AnimationController(this.editorAPI);
|
|
143
|
-
this.document = new DocumentController.DocumentController(this.editorAPI);
|
|
144
|
-
this.configuration = new LocalConfigurationDecorator.LocalConfigurationDecorator(this.editorAPI, this.localConfig);
|
|
145
|
-
this.utils = new UtilsController.UtilsController(this.editorAPI, this.localConfig);
|
|
146
|
-
this.tool = new ToolController.ToolController(this.editorAPI);
|
|
147
|
-
this.page = new PageController.PageController(this.editorAPI);
|
|
148
|
-
this.debug = new DebugController.DebugController(this.editorAPI);
|
|
149
|
-
this.undoManager = new UndoManagerController.UndoManagerController(this.editorAPI, this);
|
|
150
|
-
this.textSelection = new TextStyleController.TextStyleController(this.editorAPI);
|
|
151
|
-
this.colorStyle = new ColorStyleController.ColorStyleController(this.editorAPI);
|
|
152
|
-
this.gradientStyle = new GradientStyleController.GradientStyleController(this.editorAPI);
|
|
153
|
-
this.paragraphStyle = new ParagraphStyleController.ParagraphStyleController(this.editorAPI);
|
|
154
|
-
this.characterStyle = new CharacterStyleController.CharacterStyleController(this.editorAPI);
|
|
155
|
-
this.mediaConnector = new MediaConnectorController.MediaConnectorController(this.editorAPI);
|
|
156
|
-
this.fontConnector = new FontConnectorController.FontConnectorController(this.editorAPI);
|
|
157
|
-
this.componentConnector = new ComponentConnectorController.ComponentConnectorController(this.editorAPI);
|
|
158
|
-
this.dataConnector = new DataConnectorController.DataConnectorController(this.editorAPI, this.dataItemMappingTools);
|
|
159
|
-
this.dataSource = new DataSourceController.DataSourceController(this.editorAPI, this.dataItemMappingTools);
|
|
160
|
-
this.connector = new ConnectorController.ConnectorController(this.editorAPI, this.localConfig);
|
|
161
|
-
this.variable = new VariableController.VariableController(this.editorAPI, this.dataItemMappingTools);
|
|
162
|
-
this.font = new FontController.FontController(this.editorAPI);
|
|
163
|
-
this.experiment = new ExperimentController.ExperimentController(this.editorAPI);
|
|
164
|
-
this.canvas = new CanvasController.CanvasController(this.editorAPI);
|
|
165
|
-
this.shape = new ShapeController.ShapeController(this.editorAPI);
|
|
166
|
-
this.colorConversion = new ColorConversionController.ColorConversionController(this.editorAPI);
|
|
167
|
-
this.info = new InfoController.InfoController();
|
|
168
|
-
this.clipboard = new ClipboardController.ClipboardController(this.editorAPI);
|
|
169
|
-
this.brandKit = new BrandKitController.BrandKitController(this.editorAPI, this);
|
|
170
|
-
this.componentGrid = new ComponentGridController.ComponentGridController(this.editorAPI);
|
|
152
|
+
this.action = this.toInstrumented(new ActionController.ActionController(this.editorAPI));
|
|
153
|
+
this.layout = this.toInstrumented(new LayoutController.LayoutController(this.editorAPI));
|
|
154
|
+
this.frame = this.toInstrumented(new FrameController.FrameController(this.editorAPI));
|
|
155
|
+
this.barcode = this.toInstrumented(new BarcodeController.BarcodeController(this.editorAPI));
|
|
156
|
+
this.component = this.toInstrumented(new ComponentController.ComponentController(this.editorAPI));
|
|
157
|
+
this.animation = this.toInstrumented(new AnimationController.AnimationController(this.editorAPI));
|
|
158
|
+
this.document = this.toInstrumented(new DocumentController.DocumentController(this.editorAPI));
|
|
159
|
+
this.configuration = this.toInstrumented(new LocalConfigurationDecorator.LocalConfigurationDecorator(this.editorAPI, this.localConfig));
|
|
160
|
+
this.utils = this.toInstrumented(new UtilsController.UtilsController(this.editorAPI, this.localConfig));
|
|
161
|
+
this.tool = this.toInstrumented(new ToolController.ToolController(this.editorAPI));
|
|
162
|
+
this.page = this.toInstrumented(new PageController.PageController(this.editorAPI));
|
|
163
|
+
this.debug = this.toInstrumented(new DebugController.DebugController(this.editorAPI));
|
|
164
|
+
this.undoManager = this.toInstrumented(new UndoManagerController.UndoManagerController(this.editorAPI, this));
|
|
165
|
+
this.textSelection = this.toInstrumented(new TextStyleController.TextStyleController(this.editorAPI));
|
|
166
|
+
this.colorStyle = this.toInstrumented(new ColorStyleController.ColorStyleController(this.editorAPI));
|
|
167
|
+
this.gradientStyle = this.toInstrumented(new GradientStyleController.GradientStyleController(this.editorAPI));
|
|
168
|
+
this.paragraphStyle = this.toInstrumented(new ParagraphStyleController.ParagraphStyleController(this.editorAPI));
|
|
169
|
+
this.characterStyle = this.toInstrumented(new CharacterStyleController.CharacterStyleController(this.editorAPI));
|
|
170
|
+
this.mediaConnector = this.toInstrumented(new MediaConnectorController.MediaConnectorController(this.editorAPI));
|
|
171
|
+
this.fontConnector = this.toInstrumented(new FontConnectorController.FontConnectorController(this.editorAPI));
|
|
172
|
+
this.componentConnector = this.toInstrumented(new ComponentConnectorController.ComponentConnectorController(this.editorAPI));
|
|
173
|
+
this.dataConnector = this.toInstrumented(new DataConnectorController.DataConnectorController(this.editorAPI, this.dataItemMappingTools));
|
|
174
|
+
this.dataSource = this.toInstrumented(new DataSourceController.DataSourceController(this.editorAPI, this.dataItemMappingTools));
|
|
175
|
+
this.connector = this.toInstrumented(new ConnectorController.ConnectorController(this.editorAPI, this.localConfig));
|
|
176
|
+
this.variable = this.toInstrumented(new VariableController.VariableController(this.editorAPI, this.dataItemMappingTools));
|
|
177
|
+
this.font = this.toInstrumented(new FontController.FontController(this.editorAPI));
|
|
178
|
+
this.experiment = this.toInstrumented(new ExperimentController.ExperimentController(this.editorAPI));
|
|
179
|
+
this.canvas = this.toInstrumented(new CanvasController.CanvasController(this.editorAPI));
|
|
180
|
+
this.shape = this.toInstrumented(new ShapeController.ShapeController(this.editorAPI));
|
|
181
|
+
this.colorConversion = this.toInstrumented(new ColorConversionController.ColorConversionController(this.editorAPI));
|
|
182
|
+
this.info = this.toInstrumented(new InfoController.InfoController());
|
|
183
|
+
this.clipboard = this.toInstrumented(new ClipboardController.ClipboardController(this.editorAPI));
|
|
184
|
+
this.brandKit = this.toInstrumented(new BrandKitController.BrandKitController(this.editorAPI, this));
|
|
185
|
+
this.componentGrid = this.toInstrumented(new ComponentGridController.ComponentGridController(this.editorAPI));
|
|
171
186
|
this.next = new NextInitiator.NextInitiator(this.config, this.connection, this.editorAPI);
|
|
187
|
+
this.applyMethodInstrumentation();
|
|
172
188
|
this.configuration.setValue(ConfigurationTypes.WellKnownConfigurationKeys.GraFxStudioSdkVersion, _package.default.version);
|
|
173
189
|
this.configuration.setValue(
|
|
174
190
|
ConfigurationTypes.WellKnownConfigurationKeys.GraFxStudioDocumentType,
|
|
@@ -177,54 +193,76 @@ class SDK {
|
|
|
177
193
|
this.configuration.updateStudioOptions(this.config.studioOptions || ConfigurationTypes.defaultStudioOptions);
|
|
178
194
|
this.configuration.setValue(
|
|
179
195
|
ConfigurationTypes.WellKnownConfigurationKeys.QueryCallCacheEnabled,
|
|
180
|
-
((
|
|
196
|
+
((_a2 = this.config.enableQueryCallCache) == null ? void 0 : _a2.toString()) || "false"
|
|
181
197
|
);
|
|
182
198
|
};
|
|
183
199
|
this.setConnection = (newConnection) => {
|
|
184
200
|
connection = newConnection;
|
|
185
201
|
};
|
|
202
|
+
this.toInstrumented = (controller) => {
|
|
203
|
+
markForInstrumentation(controller);
|
|
204
|
+
return controller;
|
|
205
|
+
};
|
|
206
|
+
this.applyMethodInstrumentation = () => {
|
|
207
|
+
var _a2;
|
|
208
|
+
const sdkProperties = this;
|
|
209
|
+
for (const propertyName of Object.keys(sdkProperties)) {
|
|
210
|
+
const value = sdkProperties[propertyName];
|
|
211
|
+
if (isPendingInstrumentation(value)) {
|
|
212
|
+
sdkProperties[propertyName] = MethodInstrumentation.wrapWithInvocationObserver(
|
|
213
|
+
value,
|
|
214
|
+
propertyName,
|
|
215
|
+
this.methodListeners,
|
|
216
|
+
this.sdkEvents,
|
|
217
|
+
(_a2 = this.config.logging) == null ? void 0 : _a2.logger
|
|
218
|
+
);
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
};
|
|
186
222
|
this.config = ConfigHelper.ConfigHelper.createRuntimeConfig(config);
|
|
223
|
+
this.sdkEvents = new SdkEvents.SdkEvents((_a = this.config.logging) == null ? void 0 : _a.logger);
|
|
187
224
|
this.connection = connection;
|
|
188
225
|
this.editorAPI = connection == null ? void 0 : connection.promise.then((child) => {
|
|
189
226
|
return child;
|
|
190
227
|
});
|
|
191
|
-
this.action = new ActionController.ActionController(this.editorAPI);
|
|
192
|
-
this.layout = new LayoutController.LayoutController(this.editorAPI);
|
|
193
|
-
this.frame = new FrameController.FrameController(this.editorAPI);
|
|
194
|
-
this.shape = new ShapeController.ShapeController(this.editorAPI);
|
|
195
|
-
this.barcode = new BarcodeController.BarcodeController(this.editorAPI);
|
|
196
|
-
this.component = new ComponentController.ComponentController(this.editorAPI);
|
|
197
|
-
this.undoManager = new UndoManagerController.UndoManagerController(this.editorAPI, this);
|
|
198
|
-
this.connector = new ConnectorController.ConnectorController(this.editorAPI, this.localConfig);
|
|
199
|
-
this.mediaConnector = new MediaConnectorController.MediaConnectorController(this.editorAPI);
|
|
200
|
-
this.fontConnector = new FontConnectorController.FontConnectorController(this.editorAPI);
|
|
201
|
-
this.componentConnector = new ComponentConnectorController.ComponentConnectorController(this.editorAPI);
|
|
202
|
-
this.dataConnector = new DataConnectorController.DataConnectorController(this.editorAPI, this.dataItemMappingTools);
|
|
203
|
-
this.dataSource = new DataSourceController.DataSourceController(this.editorAPI, this.dataItemMappingTools);
|
|
204
|
-
this.animation = new AnimationController.AnimationController(this.editorAPI);
|
|
205
|
-
this.document = new DocumentController.DocumentController(this.editorAPI);
|
|
206
|
-
this.configuration = new LocalConfigurationDecorator.LocalConfigurationDecorator(this.editorAPI, this.localConfig);
|
|
207
|
-
this.variable = new VariableController.VariableController(this.editorAPI, this.dataItemMappingTools);
|
|
208
|
-
this.utils = new UtilsController.UtilsController(this.editorAPI, this.localConfig);
|
|
228
|
+
this.action = this.toInstrumented(new ActionController.ActionController(this.editorAPI));
|
|
229
|
+
this.layout = this.toInstrumented(new LayoutController.LayoutController(this.editorAPI));
|
|
230
|
+
this.frame = this.toInstrumented(new FrameController.FrameController(this.editorAPI));
|
|
231
|
+
this.shape = this.toInstrumented(new ShapeController.ShapeController(this.editorAPI));
|
|
232
|
+
this.barcode = this.toInstrumented(new BarcodeController.BarcodeController(this.editorAPI));
|
|
233
|
+
this.component = this.toInstrumented(new ComponentController.ComponentController(this.editorAPI));
|
|
234
|
+
this.undoManager = this.toInstrumented(new UndoManagerController.UndoManagerController(this.editorAPI, this));
|
|
235
|
+
this.connector = this.toInstrumented(new ConnectorController.ConnectorController(this.editorAPI, this.localConfig));
|
|
236
|
+
this.mediaConnector = this.toInstrumented(new MediaConnectorController.MediaConnectorController(this.editorAPI));
|
|
237
|
+
this.fontConnector = this.toInstrumented(new FontConnectorController.FontConnectorController(this.editorAPI));
|
|
238
|
+
this.componentConnector = this.toInstrumented(new ComponentConnectorController.ComponentConnectorController(this.editorAPI));
|
|
239
|
+
this.dataConnector = this.toInstrumented(new DataConnectorController.DataConnectorController(this.editorAPI, this.dataItemMappingTools));
|
|
240
|
+
this.dataSource = this.toInstrumented(new DataSourceController.DataSourceController(this.editorAPI, this.dataItemMappingTools));
|
|
241
|
+
this.animation = this.toInstrumented(new AnimationController.AnimationController(this.editorAPI));
|
|
242
|
+
this.document = this.toInstrumented(new DocumentController.DocumentController(this.editorAPI));
|
|
243
|
+
this.configuration = this.toInstrumented(new LocalConfigurationDecorator.LocalConfigurationDecorator(this.editorAPI, this.localConfig));
|
|
244
|
+
this.variable = this.toInstrumented(new VariableController.VariableController(this.editorAPI, this.dataItemMappingTools));
|
|
245
|
+
this.utils = this.toInstrumented(new UtilsController.UtilsController(this.editorAPI, this.localConfig));
|
|
209
246
|
this.subscriber = new SubscriberController.SubscriberController(this.config, this.localConfig);
|
|
210
|
-
this.tool = new ToolController.ToolController(this.editorAPI);
|
|
211
|
-
this.page = new PageController.PageController(this.editorAPI);
|
|
212
|
-
this.debug = new DebugController.DebugController(this.editorAPI);
|
|
213
|
-
this.textSelection = new TextStyleController.TextStyleController(this.editorAPI);
|
|
214
|
-
this.colorStyle = new ColorStyleController.ColorStyleController(this.editorAPI);
|
|
215
|
-
this.gradientStyle = new GradientStyleController.GradientStyleController(this.editorAPI);
|
|
216
|
-
this.paragraphStyle = new ParagraphStyleController.ParagraphStyleController(this.editorAPI);
|
|
217
|
-
this.characterStyle = new CharacterStyleController.CharacterStyleController(this.editorAPI);
|
|
218
|
-
this.font = new FontController.FontController(this.editorAPI);
|
|
219
|
-
this.experiment = new ExperimentController.ExperimentController(this.editorAPI);
|
|
220
|
-
this.canvas = new CanvasController.CanvasController(this.editorAPI);
|
|
221
|
-
this.colorConversion = new ColorConversionController.ColorConversionController(this.editorAPI);
|
|
222
|
-
this.info = new InfoController.InfoController();
|
|
223
|
-
this.clipboard = new ClipboardController.ClipboardController(this.editorAPI);
|
|
247
|
+
this.tool = this.toInstrumented(new ToolController.ToolController(this.editorAPI));
|
|
248
|
+
this.page = this.toInstrumented(new PageController.PageController(this.editorAPI));
|
|
249
|
+
this.debug = this.toInstrumented(new DebugController.DebugController(this.editorAPI));
|
|
250
|
+
this.textSelection = this.toInstrumented(new TextStyleController.TextStyleController(this.editorAPI));
|
|
251
|
+
this.colorStyle = this.toInstrumented(new ColorStyleController.ColorStyleController(this.editorAPI));
|
|
252
|
+
this.gradientStyle = this.toInstrumented(new GradientStyleController.GradientStyleController(this.editorAPI));
|
|
253
|
+
this.paragraphStyle = this.toInstrumented(new ParagraphStyleController.ParagraphStyleController(this.editorAPI));
|
|
254
|
+
this.characterStyle = this.toInstrumented(new CharacterStyleController.CharacterStyleController(this.editorAPI));
|
|
255
|
+
this.font = this.toInstrumented(new FontController.FontController(this.editorAPI));
|
|
256
|
+
this.experiment = this.toInstrumented(new ExperimentController.ExperimentController(this.editorAPI));
|
|
257
|
+
this.canvas = this.toInstrumented(new CanvasController.CanvasController(this.editorAPI));
|
|
258
|
+
this.colorConversion = this.toInstrumented(new ColorConversionController.ColorConversionController(this.editorAPI));
|
|
259
|
+
this.info = this.toInstrumented(new InfoController.InfoController());
|
|
260
|
+
this.clipboard = this.toInstrumented(new ClipboardController.ClipboardController(this.editorAPI));
|
|
224
261
|
this.next = new NextInitiator.NextInitiator(this.config, this.connection, this.editorAPI);
|
|
225
262
|
this.enabledNextSubscribers = this.config.enableNextSubscribers;
|
|
226
|
-
this.brandKit = new BrandKitController.BrandKitController(this.editorAPI, this);
|
|
227
|
-
this.componentGrid = new ComponentGridController.ComponentGridController(this.editorAPI);
|
|
263
|
+
this.brandKit = this.toInstrumented(new BrandKitController.BrandKitController(this.editorAPI, this));
|
|
264
|
+
this.componentGrid = this.toInstrumented(new ComponentGridController.ComponentGridController(this.editorAPI));
|
|
265
|
+
this.applyMethodInstrumentation();
|
|
228
266
|
}
|
|
229
267
|
}
|
|
230
268
|
exports.SDK = SDK;
|
package/lib/src/sdk.cjs.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sdk.cjs.js","sources":["../../src/sdk.ts"],"sourcesContent":["import { Connection } from 'penpal';\nimport engineInfo from '../editor-engine.json';\nimport packageInfo from '../package.json';\nimport Connect from './interactions/Connector';\nimport { defaultStudioOptions, WellKnownConfigurationKeys } from './types/ConfigurationTypes';\n\nimport type { ConfigType, EditorAPI, RuntimeConfigType } from './types/CommonTypes';\nimport { DocumentType } from './types/DocumentTypes';\n\nimport { ActionController } from './controllers/ActionController';\nimport { AnimationController } from './controllers/AnimationController';\nimport { BarcodeController } from './controllers/BarcodeController';\nimport { BrandKitController } from './controllers/BrandKitController';\nimport { CanvasController } from './controllers/CanvasController';\nimport { CharacterStyleController } from './controllers/CharacterStyleController';\nimport { ClipboardController } from './controllers/ClipboardController';\nimport { ColorConversionController } from './controllers/ColorConversionController';\nimport { ColorStyleController } from './controllers/ColorStyleController';\nimport { ConfigurationController } from './controllers/ConfigurationController';\nimport { ConnectorController } from './controllers/ConnectorController';\nimport { DataConnectorController } from './controllers/DataConnectorController';\nimport { DataSourceController } from './controllers/DataSourceController';\nimport { DebugController } from './controllers/DebugController';\nimport { DocumentController } from './controllers/DocumentController';\nimport { ExperimentController } from './controllers/ExperimentController';\nimport { FontConnectorController } from './controllers/FontConnectorController';\nimport { FontController } from './controllers/FontController';\nimport { FrameController } from './controllers/FrameController';\nimport { InfoController } from './controllers/InfoController';\nimport { LayoutController } from './controllers/LayoutController';\nimport { MediaConnectorController } from './controllers/MediaConnectorController';\nimport { PageController } from './controllers/PageController';\nimport { ParagraphStyleController } from './controllers/ParagraphStyleController';\nimport { ShapeController } from './controllers/ShapeController';\nimport { SubscriberController } from './controllers/SubscriberController';\nimport { TextStyleController } from './controllers/TextStyleController';\nimport { ToolController } from './controllers/ToolController';\nimport { UndoManagerController } from './controllers/UndoManagerController';\nimport { UtilsController } from './controllers/UtilsController';\nimport { VariableController } from './controllers/VariableController';\nimport { NextSubscribers } from './next';\nimport { NextInitiator } from './next/NextInitiator';\nimport { ConfigHelper } from './utils/ConfigHelper';\nimport { DataItemMappingTools } from './utils/DataItemMappingTools';\nimport { LocalConfigurationDecorator } from './utils/LocalConfigurationDecorator';\nimport { GradientStyleController } from './controllers/GradientStyleController';\nimport { ComponentConnectorController } from './controllers/ComponentConnectorController';\nimport { ComponentController } from './controllers/ComponentController';\nimport { ComponentGridController } from './controllers/ComponentGridController';\n\ndeclare const __ENGINE_DOMAIN__: string;\nconst ENGINE_DOMAIN = typeof __ENGINE_DOMAIN__ !== 'undefined' ? __ENGINE_DOMAIN__ : 'studio-cdn.chiligrafx.com';\nconst FIXED_EDITOR_LINK = `https://${ENGINE_DOMAIN}/editor/${engineInfo.current}/web`;\n\nlet connection: Connection;\n\nexport class SDK {\n config: RuntimeConfigType;\n connection: Connection;\n\n /**\n * @ignore\n */\n editorAPI: EditorAPI;\n\n action: ActionController;\n layout: LayoutController;\n frame: FrameController;\n shape: ShapeController;\n barcode: BarcodeController;\n /** @experimental */\n component: ComponentController;\n connector: ConnectorController;\n mediaConnector: MediaConnectorController;\n fontConnector: FontConnectorController;\n /**\n * @experimental This controller is still experimental and might change in future releases.\n */\n componentConnector: ComponentConnectorController;\n dataConnector: DataConnectorController;\n dataSource: DataSourceController;\n animation: AnimationController;\n document: DocumentController;\n configuration: ConfigurationController;\n variable: VariableController;\n utils: UtilsController;\n tool: ToolController;\n page: PageController;\n debug: DebugController;\n undoManager: UndoManagerController;\n textSelection: TextStyleController;\n paragraphStyle: ParagraphStyleController;\n characterStyle: CharacterStyleController;\n colorStyle: ColorStyleController;\n gradientStyle: GradientStyleController;\n font: FontController;\n experiment: ExperimentController;\n canvas: CanvasController;\n colorConversion: ColorConversionController;\n info: InfoController;\n clipboard: ClipboardController;\n brandKit: BrandKitController;\n componentGrid: ComponentGridController;\n next: NextInitiator;\n\n private subscriber: SubscriberController;\n private enabledNextSubscribers: NextSubscribers | undefined;\n private localConfig = new Map<string, string>();\n private dataItemMappingTools = new DataItemMappingTools();\n\n /**\n * The SDK should be configured clientside and it exposes all controllers to work with in other applications\n * @param config The configuration object where the SDK and editor can get configured\n */\n constructor(config: ConfigType) {\n this.config = ConfigHelper.createRuntimeConfig(config);\n\n this.connection = connection;\n this.editorAPI = connection?.promise.then((child) => {\n return child;\n }) as unknown as EditorAPI;\n\n this.action = new ActionController(this.editorAPI);\n this.layout = new LayoutController(this.editorAPI);\n this.frame = new FrameController(this.editorAPI);\n this.shape = new ShapeController(this.editorAPI);\n this.barcode = new BarcodeController(this.editorAPI);\n this.component = new ComponentController(this.editorAPI);\n this.undoManager = new UndoManagerController(this.editorAPI, this);\n this.connector = new ConnectorController(this.editorAPI, this.localConfig);\n this.mediaConnector = new MediaConnectorController(this.editorAPI);\n this.fontConnector = new FontConnectorController(this.editorAPI);\n this.componentConnector = new ComponentConnectorController(this.editorAPI);\n this.dataConnector = new DataConnectorController(this.editorAPI, this.dataItemMappingTools);\n this.dataSource = new DataSourceController(this.editorAPI, this.dataItemMappingTools);\n this.animation = new AnimationController(this.editorAPI);\n this.document = new DocumentController(this.editorAPI);\n\n this.configuration = new LocalConfigurationDecorator(this.editorAPI, this.localConfig);\n this.variable = new VariableController(this.editorAPI, this.dataItemMappingTools);\n this.utils = new UtilsController(this.editorAPI, this.localConfig);\n this.subscriber = new SubscriberController(this.config, this.localConfig);\n this.tool = new ToolController(this.editorAPI);\n this.page = new PageController(this.editorAPI);\n this.debug = new DebugController(this.editorAPI);\n // To be renamed textSelection > textStyle\n this.textSelection = new TextStyleController(this.editorAPI);\n this.colorStyle = new ColorStyleController(this.editorAPI);\n this.gradientStyle = new GradientStyleController(this.editorAPI);\n this.paragraphStyle = new ParagraphStyleController(this.editorAPI);\n this.characterStyle = new CharacterStyleController(this.editorAPI);\n this.font = new FontController(this.editorAPI);\n this.experiment = new ExperimentController(this.editorAPI);\n this.canvas = new CanvasController(this.editorAPI);\n this.colorConversion = new ColorConversionController(this.editorAPI);\n this.info = new InfoController();\n this.clipboard = new ClipboardController(this.editorAPI);\n this.next = new NextInitiator(this.config, this.connection, this.editorAPI);\n this.enabledNextSubscribers = this.config.enableNextSubscribers;\n this.brandKit = new BrandKitController(this.editorAPI, this);\n this.componentGrid = new ComponentGridController(this.editorAPI);\n }\n\n /**\n * This method will initiate the editor, running this will result in the editor restarting\n * It will generate an iframe in the document\n */\n loadEditor = () => {\n Connect(\n this.config.editorLink || FIXED_EDITOR_LINK,\n {\n onActionsChanged: this.subscriber.onActionsChanged,\n onStateChanged: this.subscriber.onStateChanged,\n onAuthExpired: this.subscriber.onAuthExpired,\n onViewportRequested: this.subscriber.onViewportRequested,\n onDocumentLoaded: this.subscriber.onDocumentLoaded,\n onSelectedFramesContentChanged: this.subscriber.onSelectedFramesContentChanged,\n onSelectedFramesLayoutChanged: this.subscriber.onSelectedFramesLayoutChanged,\n onFramesLayoutChanged: this.subscriber.onFramesLayoutChanged,\n onSelectedLayoutPropertiesChanged: this.subscriber.onSelectedLayoutPropertiesChanged,\n onSelectedLayoutUnitChanged: this.subscriber.onSelectedLayoutUnitChanged,\n onPageSelectionChanged: this.subscriber.onPageSelectionChanged,\n onScrubberPositionChanged: this.subscriber.onAnimationPlaybackChanged,\n onFrameAnimationsChanged: this.subscriber.onAnimationChanged,\n onVariableListChanged: (state) => {\n if (this.enabledNextSubscribers?.onVariableListChanged) {\n this.next.subscriber.onVariableListChanged(state);\n } else {\n this.subscriber.onVariableListChanged(state);\n }\n },\n onSelectedToolChanged: this.subscriber.onSelectedToolChanged,\n onUndoStateChanged: this.subscriber.onUndoStateChanged,\n onSelectedLayoutFramesChanged: this.subscriber.onSelectedLayoutFramesChanged,\n onSelectedTextStyleChanged: this.subscriber.onSelectedTextStyleChanged,\n onColorsChanged: this.subscriber.onColorsChanged,\n onParagraphStylesChanged: this.subscriber.onParagraphStylesChanged,\n onCharacterStylesChanged: this.subscriber.onCharacterStylesChanged,\n onFontFamiliesChanged: this.subscriber.onFontFamiliesChanged,\n onSelectedLayoutIdChanged: this.subscriber.onSelectedLayoutIdChanged,\n onLayoutsChanged: this.subscriber.onLayoutsChanged,\n onConnectorEvent: this.subscriber.onConnectorEvent,\n onConnectorsChanged: (state) => {\n if (this.enabledNextSubscribers?.onConnectorsChanged) {\n this.next.subscriber.onConnectorsChanged(state);\n } else {\n this.subscriber.onConnectorsChanged(state);\n }\n },\n onZoomChanged: this.subscriber.onZoomChanged,\n onSelectedPageIdChanged: this.subscriber.onSelectedPageIdChanged,\n onPagesChanged: this.subscriber.onPagesChanged,\n onPageSnapshotInvalidated: this.subscriber.onPageSnapshotInvalidated,\n onPageSizeChanged: (state) => {\n if (this.enabledNextSubscribers?.onPageSizeChanged) {\n this.next.subscriber.onPageSizeChanged(state);\n } else {\n this.subscriber.onPageSizeChanged(state);\n }\n },\n onShapeCornerRadiusChanged: this.subscriber.onShapeCornerRadiusChanged,\n onCropActiveFrameIdChanged: this.subscriber.onCropActiveFrameIdChanged,\n onAsyncError: this.subscriber.onAsyncError,\n onViewModeChanged: this.subscriber.onViewModeChanged,\n onBarcodeValidationChanged: this.subscriber.onBarcodeValidationChanged,\n onDataSourceIdChanged: this.subscriber.onDataSourceIdChanged,\n onInjectedDataChanged: this.subscriber.onInjectedDataChanged,\n onDocumentIssueListChanged: this.subscriber.onDocumentIssueListChanged,\n onCustomUndoDataChanged: this.subscriber.onCustomUndoDataChanged,\n onEngineEditModeChanged: this.subscriber.onEngineEditModeChanged,\n onBrandKitMediaChanged: this.subscriber.onBrandKitMediaChanged,\n },\n this.setConnection,\n this.config.editorId,\n this.config.studioStyling,\n (error) => {\n this.config.onConnectionError?.(error);\n },\n );\n this.editorAPI = connection?.promise.then((editorAPI) => {\n return editorAPI;\n }) as unknown as EditorAPI;\n\n this.action = new ActionController(this.editorAPI);\n this.layout = new LayoutController(this.editorAPI);\n this.frame = new FrameController(this.editorAPI);\n this.barcode = new BarcodeController(this.editorAPI);\n this.component = new ComponentController(this.editorAPI);\n this.animation = new AnimationController(this.editorAPI);\n this.document = new DocumentController(this.editorAPI);\n this.configuration = new LocalConfigurationDecorator(this.editorAPI, this.localConfig);\n this.utils = new UtilsController(this.editorAPI, this.localConfig);\n this.tool = new ToolController(this.editorAPI);\n this.page = new PageController(this.editorAPI);\n this.debug = new DebugController(this.editorAPI);\n this.undoManager = new UndoManagerController(this.editorAPI, this);\n this.textSelection = new TextStyleController(this.editorAPI);\n this.colorStyle = new ColorStyleController(this.editorAPI);\n this.gradientStyle = new GradientStyleController(this.editorAPI);\n this.paragraphStyle = new ParagraphStyleController(this.editorAPI);\n this.characterStyle = new CharacterStyleController(this.editorAPI);\n this.mediaConnector = new MediaConnectorController(this.editorAPI);\n this.fontConnector = new FontConnectorController(this.editorAPI);\n this.componentConnector = new ComponentConnectorController(this.editorAPI);\n this.dataConnector = new DataConnectorController(this.editorAPI, this.dataItemMappingTools);\n this.dataSource = new DataSourceController(this.editorAPI, this.dataItemMappingTools);\n this.connector = new ConnectorController(this.editorAPI, this.localConfig);\n this.variable = new VariableController(this.editorAPI, this.dataItemMappingTools);\n this.font = new FontController(this.editorAPI);\n this.experiment = new ExperimentController(this.editorAPI);\n this.canvas = new CanvasController(this.editorAPI);\n this.shape = new ShapeController(this.editorAPI);\n this.colorConversion = new ColorConversionController(this.editorAPI);\n this.info = new InfoController();\n this.clipboard = new ClipboardController(this.editorAPI);\n this.brandKit = new BrandKitController(this.editorAPI, this);\n this.componentGrid = new ComponentGridController(this.editorAPI);\n this.next = new NextInitiator(this.config, this.connection, this.editorAPI);\n\n // as soon as the editor loads, provide it with the SDK version\n // used to make it start. This enables engine compatibility checks\n // on the Flutter side\n this.configuration.setValue(WellKnownConfigurationKeys.GraFxStudioSdkVersion, packageInfo.version);\n\n // Makes the engine aware which document type it should render, if this call\n // isn't made, the engine will fall back to the type specified in the document.\n //\n // Loading a template JSON and setting the engine to `project` will cause\n // the document JSON structure to be converted to a project on save.\n // Using `getCurrentDocumentState` will also output the converted document.\n this.configuration.setValue(\n WellKnownConfigurationKeys.GraFxStudioDocumentType,\n this.config.documentType || DocumentType.template,\n );\n\n // Update the engine with the specified options from the config or fall back to the defaults.\n this.configuration.updateStudioOptions(this.config.studioOptions || defaultStudioOptions);\n\n // Whether the engine should cache query calls. This is disabled by default.\n this.configuration.setValue(\n WellKnownConfigurationKeys.QueryCallCacheEnabled,\n this.config.enableQueryCallCache?.toString() || 'false',\n );\n };\n\n setConnection = (newConnection: Connection) => {\n connection = newConnection;\n };\n}\n\nexport default SDK;\n"],"names":["engineInfo","DataItemMappingTools","Connect","_a","ActionController","LayoutController","FrameController","BarcodeController","ComponentController","AnimationController","DocumentController","LocalConfigurationDecorator","UtilsController","ToolController","PageController","DebugController","UndoManagerController","TextStyleController","ColorStyleController","GradientStyleController","ParagraphStyleController","CharacterStyleController","MediaConnectorController","FontConnectorController","ComponentConnectorController","DataConnectorController","DataSourceController","ConnectorController","VariableController","FontController","ExperimentController","CanvasController","ShapeController","ColorConversionController","InfoController","ClipboardController","BrandKitController","ComponentGridController","NextInitiator","WellKnownConfigurationKeys","packageInfo","DocumentType","defaultStudioOptions","ConfigHelper","SubscriberController"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAmDA,MAAM,gBAA2D;AACjE,MAAM,oBAAoB,WAAW,aAAa,WAAWA,aAAAA,QAAW,OAAO;AAE/E,IAAI;AAEG,MAAM,IAAI;AAAA;AAAA;AAAA;AAAA;AAAA,EA0Db,YAAY,QAAoB;AAPhC,SAAQ,kCAAkB,IAAA;AAC1B,SAAQ,uBAAuB,IAAIC,0CAAA;AA2DnC,SAAA,aAAa,MAAM;;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S;AACjD,SAAK,kBAAkB,IAAIE,oDAA0B,KAAK,SAAS;AACnE,SAAK,OAAO,IAAIC,8BAAA;AAChB,SAAK,YAAY,IAAIC,wCAAoB,KAAK,SAAS;AACvD,SAAK,OAAO,IAAIG,cAAAA,cAAc,KAAK,QAAQ,KAAK,YAAY,KAAK,SAAS;AAC1E,SAAK,yBAAyB,KAAK,OAAO;AAC1C,SAAK,WAAW,IAAIF,mBAAAA,mBAAmB,KAAK,WAAW,IAAI;AAC3D,SAAK,gBAAgB,IAAIC,gDAAwB,KAAK,SAAS;AAAA,EACnE;AAmJJ;;"}
|
|
1
|
+
{"version":3,"file":"sdk.cjs.js","sources":["../../src/sdk.ts"],"sourcesContent":["import { Connection } from 'penpal';\nimport engineInfo from '../editor-engine.json';\nimport packageInfo from '../package.json';\nimport Connect from './interactions/Connector';\nimport { defaultStudioOptions, WellKnownConfigurationKeys } from './types/ConfigurationTypes';\n\nimport type { ConfigType, EditorAPI, RuntimeConfigType } from './types/CommonTypes';\nimport { Instrumented } from './types/MethodInvocationTypes';\nimport { DocumentType } from './types/DocumentTypes';\n\nimport { ActionController } from './controllers/ActionController';\nimport { AnimationController } from './controllers/AnimationController';\nimport { BarcodeController } from './controllers/BarcodeController';\nimport { BrandKitController } from './controllers/BrandKitController';\nimport { CanvasController } from './controllers/CanvasController';\nimport { CharacterStyleController } from './controllers/CharacterStyleController';\nimport { ClipboardController } from './controllers/ClipboardController';\nimport { ColorConversionController } from './controllers/ColorConversionController';\nimport { ColorStyleController } from './controllers/ColorStyleController';\nimport { ConfigurationController } from './controllers/ConfigurationController';\nimport { ConnectorController } from './controllers/ConnectorController';\nimport { DataConnectorController } from './controllers/DataConnectorController';\nimport { DataSourceController } from './controllers/DataSourceController';\nimport { DebugController } from './controllers/DebugController';\nimport { DocumentController } from './controllers/DocumentController';\nimport { ExperimentController } from './controllers/ExperimentController';\nimport { FontConnectorController } from './controllers/FontConnectorController';\nimport { FontController } from './controllers/FontController';\nimport { FrameController } from './controllers/FrameController';\nimport { InfoController } from './controllers/InfoController';\nimport { LayoutController } from './controllers/LayoutController';\nimport { MediaConnectorController } from './controllers/MediaConnectorController';\nimport { PageController } from './controllers/PageController';\nimport { ParagraphStyleController } from './controllers/ParagraphStyleController';\nimport { ShapeController } from './controllers/ShapeController';\nimport { SubscriberController } from './controllers/SubscriberController';\nimport { TextStyleController } from './controllers/TextStyleController';\nimport { ToolController } from './controllers/ToolController';\nimport { UndoManagerController } from './controllers/UndoManagerController';\nimport { UtilsController } from './controllers/UtilsController';\nimport { VariableController } from './controllers/VariableController';\nimport { NextSubscribers } from './next';\nimport { NextInitiator } from './next/NextInitiator';\nimport { ConfigHelper } from './utils/ConfigHelper';\nimport { DataItemMappingTools } from './utils/DataItemMappingTools';\nimport { LocalConfigurationDecorator } from './utils/LocalConfigurationDecorator';\nimport { GradientStyleController } from './controllers/GradientStyleController';\nimport { ComponentConnectorController } from './controllers/ComponentConnectorController';\nimport { ComponentController } from './controllers/ComponentController';\nimport { ComponentGridController } from './controllers/ComponentGridController';\nimport { MethodListenerRegistry, wrapWithInvocationObserver } from './utils/MethodInstrumentation';\nimport { SdkEvents } from './utils/SdkEvents';\n\ndeclare const __ENGINE_DOMAIN__: string;\nconst ENGINE_DOMAIN = typeof __ENGINE_DOMAIN__ !== 'undefined' ? __ENGINE_DOMAIN__ : 'studio-cdn.chiligrafx.com';\nconst FIXED_EDITOR_LINK = `https://${ENGINE_DOMAIN}/editor/${engineInfo.current}/web`;\n\nlet connection: Connection;\n\n// Marks a freshly created controller as \"needs instrumentation\" without requiring\n// its property name to be tracked anywhere. `applyMethodInstrumentation` later scans\n// the SDK instance for properties carrying this marker and wraps them automatically,\n// so a controller can never be silently skipped just because a list wasn't updated.\nconst PENDING_INSTRUMENTATION = Symbol('pendingInstrumentation');\n\nconst markForInstrumentation = (controller: object): void => {\n Object.defineProperty(controller, PENDING_INSTRUMENTATION, {\n value: true,\n enumerable: false,\n configurable: true,\n });\n};\n\nconst isPendingInstrumentation = (value: unknown): value is object => {\n return typeof value === 'object' && value !== null && (value as Record<symbol, unknown>)[PENDING_INSTRUMENTATION] === true;\n};\n\nexport class SDK {\n config: RuntimeConfigType;\n connection: Connection;\n\n /**\n * @ignore\n */\n editorAPI: EditorAPI;\n /**\n * SDK method invocation events.\n *\n * Use this to observe which SDK controller method was called and with which parameters/result.\n * These are SDK-level events (SDK -> consumer), separate from engine subscriber events (`config.events`).\n */\n sdkEvents: SdkEvents;\n\n action: Instrumented<ActionController>;\n layout: Instrumented<LayoutController>;\n frame: Instrumented<FrameController>;\n shape: Instrumented<ShapeController>;\n barcode: Instrumented<BarcodeController>;\n /** @experimental */\n component: Instrumented<ComponentController>;\n connector: Instrumented<ConnectorController>;\n mediaConnector: Instrumented<MediaConnectorController>;\n fontConnector: Instrumented<FontConnectorController>;\n /**\n * @experimental This controller is still experimental and might change in future releases.\n */\n componentConnector: Instrumented<ComponentConnectorController>;\n dataConnector: Instrumented<DataConnectorController>;\n dataSource: Instrumented<DataSourceController>;\n animation: Instrumented<AnimationController>;\n document: Instrumented<DocumentController>;\n configuration: Instrumented<ConfigurationController>;\n variable: Instrumented<VariableController>;\n utils: Instrumented<UtilsController>;\n tool: Instrumented<ToolController>;\n page: Instrumented<PageController>;\n debug: Instrumented<DebugController>;\n undoManager: Instrumented<UndoManagerController>;\n textSelection: Instrumented<TextStyleController>;\n paragraphStyle: Instrumented<ParagraphStyleController>;\n characterStyle: Instrumented<CharacterStyleController>;\n colorStyle: Instrumented<ColorStyleController>;\n gradientStyle: Instrumented<GradientStyleController>;\n font: Instrumented<FontController>;\n experiment: Instrumented<ExperimentController>;\n canvas: Instrumented<CanvasController>;\n colorConversion: Instrumented<ColorConversionController>;\n info: Instrumented<InfoController>;\n clipboard: Instrumented<ClipboardController>;\n brandKit: Instrumented<BrandKitController>;\n componentGrid: Instrumented<ComponentGridController>;\n\n next: NextInitiator;\n\n private subscriber: SubscriberController;\n private enabledNextSubscribers: NextSubscribers | undefined;\n private localConfig = new Map<string, string>();\n private dataItemMappingTools = new DataItemMappingTools();\n private methodListeners = new MethodListenerRegistry();\n\n /**\n * The SDK should be configured clientside and it exposes all controllers to work with in other applications\n * @param config The configuration object where the SDK and editor can get configured\n */\n constructor(config: ConfigType) {\n this.config = ConfigHelper.createRuntimeConfig(config);\n this.sdkEvents = new SdkEvents(this.config.logging?.logger);\n\n this.connection = connection;\n this.editorAPI = connection?.promise.then((child: unknown) => {\n return child;\n }) as unknown as EditorAPI;\n\n this.action = this.toInstrumented(new ActionController(this.editorAPI));\n this.layout = this.toInstrumented(new LayoutController(this.editorAPI));\n this.frame = this.toInstrumented(new FrameController(this.editorAPI));\n this.shape = this.toInstrumented(new ShapeController(this.editorAPI));\n this.barcode = this.toInstrumented(new BarcodeController(this.editorAPI));\n this.component = this.toInstrumented(new ComponentController(this.editorAPI));\n this.undoManager = this.toInstrumented(new UndoManagerController(this.editorAPI, this));\n this.connector = this.toInstrumented(new ConnectorController(this.editorAPI, this.localConfig));\n this.mediaConnector = this.toInstrumented(new MediaConnectorController(this.editorAPI));\n this.fontConnector = this.toInstrumented(new FontConnectorController(this.editorAPI));\n this.componentConnector = this.toInstrumented(new ComponentConnectorController(this.editorAPI));\n this.dataConnector = this.toInstrumented(new DataConnectorController(this.editorAPI, this.dataItemMappingTools));\n this.dataSource = this.toInstrumented(new DataSourceController(this.editorAPI, this.dataItemMappingTools));\n this.animation = this.toInstrumented(new AnimationController(this.editorAPI));\n this.document = this.toInstrumented(new DocumentController(this.editorAPI));\n\n this.configuration = this.toInstrumented(new LocalConfigurationDecorator(this.editorAPI, this.localConfig));\n this.variable = this.toInstrumented(new VariableController(this.editorAPI, this.dataItemMappingTools));\n this.utils = this.toInstrumented(new UtilsController(this.editorAPI, this.localConfig));\n this.subscriber = new SubscriberController(this.config, this.localConfig);\n this.tool = this.toInstrumented(new ToolController(this.editorAPI));\n this.page = this.toInstrumented(new PageController(this.editorAPI));\n this.debug = this.toInstrumented(new DebugController(this.editorAPI));\n // To be renamed textSelection > textStyle\n this.textSelection = this.toInstrumented(new TextStyleController(this.editorAPI));\n this.colorStyle = this.toInstrumented(new ColorStyleController(this.editorAPI));\n this.gradientStyle = this.toInstrumented(new GradientStyleController(this.editorAPI));\n this.paragraphStyle = this.toInstrumented(new ParagraphStyleController(this.editorAPI));\n this.characterStyle = this.toInstrumented(new CharacterStyleController(this.editorAPI));\n this.font = this.toInstrumented(new FontController(this.editorAPI));\n this.experiment = this.toInstrumented(new ExperimentController(this.editorAPI));\n this.canvas = this.toInstrumented(new CanvasController(this.editorAPI));\n this.colorConversion = this.toInstrumented(new ColorConversionController(this.editorAPI));\n this.info = this.toInstrumented(new InfoController());\n this.clipboard = this.toInstrumented(new ClipboardController(this.editorAPI));\n this.next = new NextInitiator(this.config, this.connection, this.editorAPI);\n this.enabledNextSubscribers = this.config.enableNextSubscribers;\n this.brandKit = this.toInstrumented(new BrandKitController(this.editorAPI, this));\n this.componentGrid = this.toInstrumented(new ComponentGridController(this.editorAPI));\n\n this.applyMethodInstrumentation();\n }\n\n /**\n * This method will initiate the editor, running this will result in the editor restarting\n * It will generate an iframe in the document\n */\n loadEditor = () => {\n Connect(\n this.config.editorLink || FIXED_EDITOR_LINK,\n {\n onActionsChanged: this.subscriber.onActionsChanged,\n onStateChanged: this.subscriber.onStateChanged,\n onAuthExpired: this.subscriber.onAuthExpired,\n onViewportRequested: this.subscriber.onViewportRequested,\n onDocumentLoaded: this.subscriber.onDocumentLoaded,\n onSelectedFramesContentChanged: this.subscriber.onSelectedFramesContentChanged,\n onSelectedFramesLayoutChanged: this.subscriber.onSelectedFramesLayoutChanged,\n onFramesLayoutChanged: this.subscriber.onFramesLayoutChanged,\n onSelectedLayoutPropertiesChanged: this.subscriber.onSelectedLayoutPropertiesChanged,\n onSelectedLayoutUnitChanged: this.subscriber.onSelectedLayoutUnitChanged,\n onPageSelectionChanged: this.subscriber.onPageSelectionChanged,\n onScrubberPositionChanged: this.subscriber.onAnimationPlaybackChanged,\n onFrameAnimationsChanged: this.subscriber.onAnimationChanged,\n onVariableListChanged: (state) => {\n if (this.enabledNextSubscribers?.onVariableListChanged) {\n this.next.subscriber.onVariableListChanged(state);\n } else {\n this.subscriber.onVariableListChanged(state);\n }\n },\n onSelectedToolChanged: this.subscriber.onSelectedToolChanged,\n onUndoStateChanged: this.subscriber.onUndoStateChanged,\n onSelectedLayoutFramesChanged: this.subscriber.onSelectedLayoutFramesChanged,\n onSelectedTextStyleChanged: this.subscriber.onSelectedTextStyleChanged,\n onColorsChanged: this.subscriber.onColorsChanged,\n onParagraphStylesChanged: this.subscriber.onParagraphStylesChanged,\n onCharacterStylesChanged: this.subscriber.onCharacterStylesChanged,\n onFontFamiliesChanged: this.subscriber.onFontFamiliesChanged,\n onSelectedLayoutIdChanged: this.subscriber.onSelectedLayoutIdChanged,\n onLayoutsChanged: this.subscriber.onLayoutsChanged,\n onConnectorEvent: this.subscriber.onConnectorEvent,\n onConnectorsChanged: (state) => {\n if (this.enabledNextSubscribers?.onConnectorsChanged) {\n this.next.subscriber.onConnectorsChanged(state);\n } else {\n this.subscriber.onConnectorsChanged(state);\n }\n },\n onZoomChanged: this.subscriber.onZoomChanged,\n onSelectedPageIdChanged: this.subscriber.onSelectedPageIdChanged,\n onPagesChanged: this.subscriber.onPagesChanged,\n onPageSnapshotInvalidated: this.subscriber.onPageSnapshotInvalidated,\n onPageSizeChanged: (state) => {\n if (this.enabledNextSubscribers?.onPageSizeChanged) {\n this.next.subscriber.onPageSizeChanged(state);\n } else {\n this.subscriber.onPageSizeChanged(state);\n }\n },\n onShapeCornerRadiusChanged: this.subscriber.onShapeCornerRadiusChanged,\n onCropActiveFrameIdChanged: this.subscriber.onCropActiveFrameIdChanged,\n onAsyncError: this.subscriber.onAsyncError,\n onViewModeChanged: this.subscriber.onViewModeChanged,\n onBarcodeValidationChanged: this.subscriber.onBarcodeValidationChanged,\n onDataSourceIdChanged: this.subscriber.onDataSourceIdChanged,\n onInjectedDataChanged: this.subscriber.onInjectedDataChanged,\n onDocumentIssueListChanged: this.subscriber.onDocumentIssueListChanged,\n onCustomUndoDataChanged: this.subscriber.onCustomUndoDataChanged,\n onEngineEditModeChanged: this.subscriber.onEngineEditModeChanged,\n onBrandKitMediaChanged: this.subscriber.onBrandKitMediaChanged,\n },\n this.setConnection,\n this.config.editorId,\n this.config.studioStyling,\n (error) => {\n this.config.onConnectionError?.(error);\n },\n );\n this.editorAPI = connection?.promise.then((editorAPI: unknown) => {\n return editorAPI;\n }) as unknown as EditorAPI;\n\n this.action = this.toInstrumented(new ActionController(this.editorAPI));\n this.layout = this.toInstrumented(new LayoutController(this.editorAPI));\n this.frame = this.toInstrumented(new FrameController(this.editorAPI));\n this.barcode = this.toInstrumented(new BarcodeController(this.editorAPI));\n this.component = this.toInstrumented(new ComponentController(this.editorAPI));\n this.animation = this.toInstrumented(new AnimationController(this.editorAPI));\n this.document = this.toInstrumented(new DocumentController(this.editorAPI));\n this.configuration = this.toInstrumented(new LocalConfigurationDecorator(this.editorAPI, this.localConfig));\n this.utils = this.toInstrumented(new UtilsController(this.editorAPI, this.localConfig));\n this.tool = this.toInstrumented(new ToolController(this.editorAPI));\n this.page = this.toInstrumented(new PageController(this.editorAPI));\n this.debug = this.toInstrumented(new DebugController(this.editorAPI));\n this.undoManager = this.toInstrumented(new UndoManagerController(this.editorAPI, this));\n this.textSelection = this.toInstrumented(new TextStyleController(this.editorAPI));\n this.colorStyle = this.toInstrumented(new ColorStyleController(this.editorAPI));\n this.gradientStyle = this.toInstrumented(new GradientStyleController(this.editorAPI));\n this.paragraphStyle = this.toInstrumented(new ParagraphStyleController(this.editorAPI));\n this.characterStyle = this.toInstrumented(new CharacterStyleController(this.editorAPI));\n this.mediaConnector = this.toInstrumented(new MediaConnectorController(this.editorAPI));\n this.fontConnector = this.toInstrumented(new FontConnectorController(this.editorAPI));\n this.componentConnector = this.toInstrumented(new ComponentConnectorController(this.editorAPI));\n this.dataConnector = this.toInstrumented(new DataConnectorController(this.editorAPI, this.dataItemMappingTools));\n this.dataSource = this.toInstrumented(new DataSourceController(this.editorAPI, this.dataItemMappingTools));\n this.connector = this.toInstrumented(new ConnectorController(this.editorAPI, this.localConfig));\n this.variable = this.toInstrumented(new VariableController(this.editorAPI, this.dataItemMappingTools));\n this.font = this.toInstrumented(new FontController(this.editorAPI));\n this.experiment = this.toInstrumented(new ExperimentController(this.editorAPI));\n this.canvas = this.toInstrumented(new CanvasController(this.editorAPI));\n this.shape = this.toInstrumented(new ShapeController(this.editorAPI));\n this.colorConversion = this.toInstrumented(new ColorConversionController(this.editorAPI));\n this.info = this.toInstrumented(new InfoController());\n this.clipboard = this.toInstrumented(new ClipboardController(this.editorAPI));\n this.brandKit = this.toInstrumented(new BrandKitController(this.editorAPI, this));\n this.componentGrid = this.toInstrumented(new ComponentGridController(this.editorAPI));\n this.next = new NextInitiator(this.config, this.connection, this.editorAPI);\n\n this.applyMethodInstrumentation();\n\n // as soon as the editor loads, provide it with the SDK version\n // used to make it start. This enables engine compatibility checks\n // on the Flutter side\n this.configuration.setValue(WellKnownConfigurationKeys.GraFxStudioSdkVersion, packageInfo.version);\n\n // Makes the engine aware which document type it should render, if this call\n // isn't made, the engine will fall back to the type specified in the document.\n //\n // Loading a template JSON and setting the engine to `project` will cause\n // the document JSON structure to be converted to a project on save.\n // Using `getCurrentDocumentState` will also output the converted document.\n this.configuration.setValue(\n WellKnownConfigurationKeys.GraFxStudioDocumentType,\n this.config.documentType || DocumentType.template,\n );\n\n // Update the engine with the specified options from the config or fall back to the defaults.\n this.configuration.updateStudioOptions(this.config.studioOptions || defaultStudioOptions);\n\n // Whether the engine should cache query calls. This is disabled by default.\n this.configuration.setValue(\n WellKnownConfigurationKeys.QueryCallCacheEnabled,\n this.config.enableQueryCallCache?.toString() || 'false',\n );\n };\n\n setConnection = (newConnection: Connection) => {\n connection = newConnection;\n };\n\n private toInstrumented = <T extends object>(controller: T): Instrumented<T> => {\n markForInstrumentation(controller);\n return controller as unknown as Instrumented<T>;\n };\n\n /**\n * Wraps every controller previously handed to `toInstrumented` with the invocation\n * observer, discovering them by their marker rather than a manually maintained\n * list of property names. Any property assigned via `toInstrumented` is picked up\n * automatically, using its own property key as the controller name.\n */\n private applyMethodInstrumentation = () => {\n const sdkProperties = this as unknown as Record<string, unknown>;\n for (const propertyName of Object.keys(sdkProperties)) {\n const value = sdkProperties[propertyName];\n if (isPendingInstrumentation(value)) {\n sdkProperties[propertyName] = wrapWithInvocationObserver(\n value,\n propertyName,\n this.methodListeners,\n this.sdkEvents,\n this.config.logging?.logger,\n );\n }\n }\n };\n}\n\nexport default SDK;\n"],"names":["engineInfo","DataItemMappingTools","MethodListenerRegistry","Connect","_a","ActionController","LayoutController","FrameController","BarcodeController","ComponentController","AnimationController","DocumentController","LocalConfigurationDecorator","UtilsController","ToolController","PageController","DebugController","UndoManagerController","TextStyleController","ColorStyleController","GradientStyleController","ParagraphStyleController","CharacterStyleController","MediaConnectorController","FontConnectorController","ComponentConnectorController","DataConnectorController","DataSourceController","ConnectorController","VariableController","FontController","ExperimentController","CanvasController","ShapeController","ColorConversionController","InfoController","ClipboardController","BrandKitController","ComponentGridController","NextInitiator","WellKnownConfigurationKeys","packageInfo","DocumentType","defaultStudioOptions","wrapWithInvocationObserver","ConfigHelper","SdkEvents","SubscriberController"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAsDA,MAAM,gBAA2D;AACjE,MAAM,oBAAoB,WAAW,aAAa,WAAWA,aAAAA,QAAW,OAAO;AAE/E,IAAI;AAMJ,MAAM,0BAA0B,OAAO,wBAAwB;AAE/D,MAAM,yBAAyB,CAAC,eAA6B;AACzD,SAAO,eAAe,YAAY,yBAAyB;AAAA,IACvD,OAAO;AAAA,IACP,YAAY;AAAA,IACZ,cAAc;AAAA,EAAA,CACjB;AACL;AAEA,MAAM,2BAA2B,CAAC,UAAoC;AAClE,SAAO,OAAO,UAAU,YAAY,UAAU,QAAS,MAAkC,uBAAuB,MAAM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K,eAAe,IAAIC,gCAAgB,KAAK,SAAS,CAAC;AAEpE,SAAK,gBAAgB,KAAK,eAAe,IAAIE,wCAAoB,KAAK,SAAS,CAAC;AAChF,SAAK,aAAa,KAAK,eAAe,IAAIC,0CAAqB,KAAK,SAAS,CAAC;AAC9E,SAAK,gBAAgB,KAAK,eAAe,IAAIC,gDAAwB,KAAK,SAAS,CAAC;AACpF,SAAK,iBAAiB,KAAK,eAAe,IAAIC,kDAAyB,KAAK,SAAS,CAAC;AACtF,SAAK,iBAAiB,KAAK,eAAe,IAAIC,kDAAyB,KAAK,SAAS,CAAC;AACtF,SAAK,OAAO,KAAK,eAAe,IAAIQ,8BAAe,KAAK,SAAS,CAAC;AAClE,SAAK,aAAa,KAAK,eAAe,IAAIC,0CAAqB,KAAK,SAAS,CAAC;AAC9E,SAAK,SAAS,KAAK,eAAe,IAAIC,kCAAiB,KAAK,SAAS,CAAC;AACtE,SAAK,kBAAkB,KAAK,eAAe,IAAIE,oDAA0B,KAAK,SAAS,CAAC;AACxF,SAAK,OAAO,KAAK,eAAe,IAAIC,eAAAA,gBAAgB;AACpD,SAAK,YAAY,KAAK,eAAe,IAAIC,wCAAoB,KAAK,SAAS,CAAC;AAC5E,SAAK,OAAO,IAAIG,cAAAA,cAAc,KAAK,QAAQ,KAAK,YAAY,KAAK,SAAS;AAC1E,SAAK,yBAAyB,KAAK,OAAO;AAC1C,SAAK,WAAW,KAAK,eAAe,IAAIF,mBAAAA,mBAAmB,KAAK,WAAW,IAAI,CAAC;AAChF,SAAK,gBAAgB,KAAK,eAAe,IAAIC,gDAAwB,KAAK,SAAS,CAAC;AAEpF,SAAK,2BAAA;AAAA,EACT;AAgLJ;;"}
|
package/lib/src/sdk.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { Connection } from 'penpal';
|
|
2
2
|
import { ConfigType, EditorAPI, RuntimeConfigType } from './types/CommonTypes';
|
|
3
|
+
import { Instrumented } from './types/MethodInvocationTypes';
|
|
3
4
|
import { ActionController } from './controllers/ActionController';
|
|
4
5
|
import { AnimationController } from './controllers/AnimationController';
|
|
5
6
|
import { BarcodeController } from './controllers/BarcodeController';
|
|
@@ -35,6 +36,7 @@ import { GradientStyleController } from './controllers/GradientStyleController';
|
|
|
35
36
|
import { ComponentConnectorController } from './controllers/ComponentConnectorController';
|
|
36
37
|
import { ComponentController } from './controllers/ComponentController';
|
|
37
38
|
import { ComponentGridController } from './controllers/ComponentGridController';
|
|
39
|
+
import { SdkEvents } from './utils/SdkEvents';
|
|
38
40
|
export declare class SDK {
|
|
39
41
|
config: RuntimeConfigType;
|
|
40
42
|
connection: Connection;
|
|
@@ -42,49 +44,57 @@ export declare class SDK {
|
|
|
42
44
|
* @ignore
|
|
43
45
|
*/
|
|
44
46
|
editorAPI: EditorAPI;
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
47
|
+
/**
|
|
48
|
+
* SDK method invocation events.
|
|
49
|
+
*
|
|
50
|
+
* Use this to observe which SDK controller method was called and with which parameters/result.
|
|
51
|
+
* These are SDK-level events (SDK -> consumer), separate from engine subscriber events (`config.events`).
|
|
52
|
+
*/
|
|
53
|
+
sdkEvents: SdkEvents;
|
|
54
|
+
action: Instrumented<ActionController>;
|
|
55
|
+
layout: Instrumented<LayoutController>;
|
|
56
|
+
frame: Instrumented<FrameController>;
|
|
57
|
+
shape: Instrumented<ShapeController>;
|
|
58
|
+
barcode: Instrumented<BarcodeController>;
|
|
50
59
|
/** @experimental */
|
|
51
|
-
component: ComponentController
|
|
52
|
-
connector: ConnectorController
|
|
53
|
-
mediaConnector: MediaConnectorController
|
|
54
|
-
fontConnector: FontConnectorController
|
|
60
|
+
component: Instrumented<ComponentController>;
|
|
61
|
+
connector: Instrumented<ConnectorController>;
|
|
62
|
+
mediaConnector: Instrumented<MediaConnectorController>;
|
|
63
|
+
fontConnector: Instrumented<FontConnectorController>;
|
|
55
64
|
/**
|
|
56
65
|
* @experimental This controller is still experimental and might change in future releases.
|
|
57
66
|
*/
|
|
58
|
-
componentConnector: ComponentConnectorController
|
|
59
|
-
dataConnector: DataConnectorController
|
|
60
|
-
dataSource: DataSourceController
|
|
61
|
-
animation: AnimationController
|
|
62
|
-
document: DocumentController
|
|
63
|
-
configuration: ConfigurationController
|
|
64
|
-
variable: VariableController
|
|
65
|
-
utils: UtilsController
|
|
66
|
-
tool: ToolController
|
|
67
|
-
page: PageController
|
|
68
|
-
debug: DebugController
|
|
69
|
-
undoManager: UndoManagerController
|
|
70
|
-
textSelection: TextStyleController
|
|
71
|
-
paragraphStyle: ParagraphStyleController
|
|
72
|
-
characterStyle: CharacterStyleController
|
|
73
|
-
colorStyle: ColorStyleController
|
|
74
|
-
gradientStyle: GradientStyleController
|
|
75
|
-
font: FontController
|
|
76
|
-
experiment: ExperimentController
|
|
77
|
-
canvas: CanvasController
|
|
78
|
-
colorConversion: ColorConversionController
|
|
79
|
-
info: InfoController
|
|
80
|
-
clipboard: ClipboardController
|
|
81
|
-
brandKit: BrandKitController
|
|
82
|
-
componentGrid: ComponentGridController
|
|
67
|
+
componentConnector: Instrumented<ComponentConnectorController>;
|
|
68
|
+
dataConnector: Instrumented<DataConnectorController>;
|
|
69
|
+
dataSource: Instrumented<DataSourceController>;
|
|
70
|
+
animation: Instrumented<AnimationController>;
|
|
71
|
+
document: Instrumented<DocumentController>;
|
|
72
|
+
configuration: Instrumented<ConfigurationController>;
|
|
73
|
+
variable: Instrumented<VariableController>;
|
|
74
|
+
utils: Instrumented<UtilsController>;
|
|
75
|
+
tool: Instrumented<ToolController>;
|
|
76
|
+
page: Instrumented<PageController>;
|
|
77
|
+
debug: Instrumented<DebugController>;
|
|
78
|
+
undoManager: Instrumented<UndoManagerController>;
|
|
79
|
+
textSelection: Instrumented<TextStyleController>;
|
|
80
|
+
paragraphStyle: Instrumented<ParagraphStyleController>;
|
|
81
|
+
characterStyle: Instrumented<CharacterStyleController>;
|
|
82
|
+
colorStyle: Instrumented<ColorStyleController>;
|
|
83
|
+
gradientStyle: Instrumented<GradientStyleController>;
|
|
84
|
+
font: Instrumented<FontController>;
|
|
85
|
+
experiment: Instrumented<ExperimentController>;
|
|
86
|
+
canvas: Instrumented<CanvasController>;
|
|
87
|
+
colorConversion: Instrumented<ColorConversionController>;
|
|
88
|
+
info: Instrumented<InfoController>;
|
|
89
|
+
clipboard: Instrumented<ClipboardController>;
|
|
90
|
+
brandKit: Instrumented<BrandKitController>;
|
|
91
|
+
componentGrid: Instrumented<ComponentGridController>;
|
|
83
92
|
next: NextInitiator;
|
|
84
93
|
private subscriber;
|
|
85
94
|
private enabledNextSubscribers;
|
|
86
95
|
private localConfig;
|
|
87
96
|
private dataItemMappingTools;
|
|
97
|
+
private methodListeners;
|
|
88
98
|
/**
|
|
89
99
|
* The SDK should be configured clientside and it exposes all controllers to work with in other applications
|
|
90
100
|
* @param config The configuration object where the SDK and editor can get configured
|
|
@@ -96,5 +106,13 @@ export declare class SDK {
|
|
|
96
106
|
*/
|
|
97
107
|
loadEditor: () => void;
|
|
98
108
|
setConnection: (newConnection: Connection) => void;
|
|
109
|
+
private toInstrumented;
|
|
110
|
+
/**
|
|
111
|
+
* Wraps every controller previously handed to `toInstrumented` with the invocation
|
|
112
|
+
* observer, discovering them by their marker rather than a manually maintained
|
|
113
|
+
* list of property names. Any property assigned via `toInstrumented` is picked up
|
|
114
|
+
* automatically, using its own property key as the controller name.
|
|
115
|
+
*/
|
|
116
|
+
private applyMethodInstrumentation;
|
|
99
117
|
}
|
|
100
118
|
export default SDK;
|