@contentstack/studio-client 3.2.0 → 4.0.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/dist/breakpoints/BreakpointManager.js +7 -5
- package/dist/breakpoints/BreakpointManager.js.map +1 -1
- package/dist/breakpoints/breakpoint.js +3 -2
- package/dist/breakpoints/breakpoint.js.map +1 -1
- package/dist/canvas/canvas.utils.js +13 -1
- package/dist/canvas/canvas.utils.js.map +1 -1
- package/dist/composable-studio/build-scoped-data.js +12 -35
- package/dist/composable-studio/build-scoped-data.js.map +1 -1
- package/dist/composable-studio/sdk.js +1064 -430
- package/dist/composable-studio/sdk.js.map +1 -1
- package/dist/composable-studio/studio-intelligence.manager.js +5 -2
- package/dist/composable-studio/studio-intelligence.manager.js.map +1 -1
- package/dist/config/config.schema.js +45 -8
- package/dist/config/config.schema.js.map +1 -1
- package/dist/config/default-config.js +10 -3
- package/dist/config/default-config.js.map +1 -1
- package/dist/config/process-user-config.js +37 -1
- package/dist/config/process-user-config.js.map +1 -1
- package/dist/config/stack-sdk-wrapper.js +36 -1
- package/dist/config/stack-sdk-wrapper.js.map +1 -1
- package/dist/context-menu/context-menu.js +5 -2
- package/dist/context-menu/context-menu.js.map +1 -1
- package/dist/design/handle-active-style-change.js +3 -2
- package/dist/design/handle-active-style-change.js.map +1 -1
- package/dist/dnd/dnd-event.js +2 -1
- package/dist/dnd/dnd-event.js.map +1 -1
- package/dist/dnd/dnd-manager.js +3 -1
- package/dist/dnd/dnd-manager.js.map +1 -1
- package/dist/editor.d.ts +250 -0
- package/dist/editor.js +11 -0
- package/dist/editor.js.map +1 -0
- package/dist/get-active-node-screenshot/get-node-screenshot-event.js +2 -1
- package/dist/get-active-node-screenshot/get-node-screenshot-event.js.map +1 -1
- package/dist/hidden-element-notification/hidden-element-notification-event.js +2 -1
- package/dist/hidden-element-notification/hidden-element-notification-event.js.map +1 -1
- package/dist/highlight-node/highlight-node-manager.js +225 -15
- package/dist/highlight-node/highlight-node-manager.js.map +1 -1
- package/dist/highlight-node/highlight-node.js +42 -6
- package/dist/highlight-node/highlight-node.js.map +1 -1
- package/dist/highlight-spacing/highlight-spacing-events.js +2 -1
- package/dist/highlight-spacing/highlight-spacing-events.js.map +1 -1
- package/dist/index.d.ts +1006 -436
- package/dist/index.js +12 -13
- package/dist/index.js.map +1 -1
- package/dist/url-change/url-change.js +4 -3
- package/dist/url-change/url-change.js.map +1 -1
- package/dist/url-metadata/build-template-query.js +14 -3
- package/dist/url-metadata/build-template-query.js.map +1 -1
- package/dist/utils/canvas.js +2 -1
- package/dist/utils/canvas.js.map +1 -1
- package/dist/utils/check-bindings.js +233 -0
- package/dist/utils/check-bindings.js.map +1 -0
- package/dist/utils/classify-response-error.js +288 -0
- package/dist/utils/classify-response-error.js.map +1 -0
- package/dist/utils/composable-studio-error.js +36 -20
- package/dist/utils/composable-studio-error.js.map +1 -1
- package/dist/utils/composition-not-found.js +52 -0
- package/dist/utils/composition-not-found.js.map +1 -0
- package/dist/utils/constants.js +21 -2
- package/dist/utils/constants.js.map +1 -1
- package/dist/utils/degraded-finding.js +166 -0
- package/dist/utils/degraded-finding.js.map +1 -0
- package/dist/utils/editor-mode.js +1 -1
- package/dist/utils/http-error.constants.js +12 -46
- package/dist/utils/http-error.constants.js.map +1 -1
- package/dist/utils/include-path-rules.js +40 -1
- package/dist/utils/include-path-rules.js.map +1 -1
- package/dist/utils/is-composition-being-edited.js +1 -1
- package/dist/utils/is-inside-iframe.js +1 -1
- package/dist/utils/is-inside-visual-builder-frame.js +1 -1
- package/dist/utils/parse-ui.js +60 -0
- package/dist/utils/parse-ui.js.map +1 -0
- package/dist/utils/query-param.js +1 -1
- package/dist/utils/query-param.js.map +1 -1
- package/dist/utils/reference-stub.js +75 -0
- package/dist/utils/reference-stub.js.map +1 -0
- package/dist/utils/reference_fetcher.js +44 -3
- package/dist/utils/reference_fetcher.js.map +1 -1
- package/dist/utils/require-stack.js +141 -0
- package/dist/utils/require-stack.js.map +1 -0
- package/dist/utils/served-by.js +33 -0
- package/dist/utils/served-by.js.map +1 -0
- package/dist/utils/studio-error-codes.js +253 -0
- package/dist/utils/studio-error-codes.js.map +1 -0
- package/dist/utils/studio-error.js +122 -0
- package/dist/utils/studio-error.js.map +1 -0
- package/dist/utils/studio-messaging.js +25 -0
- package/dist/utils/studio-messaging.js.map +1 -0
- package/dist/visual-builder/composition-save-event.js +2 -1
- package/dist/visual-builder/composition-save-event.js.map +1 -1
- package/package.json +19 -6
- package/dist/utils/error-messages.default.js +0 -141
- package/dist/utils/error-messages.default.js.map +0 -1
- package/dist/utils/error-messages.js +0 -47
- package/dist/utils/error-messages.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"default-config.js","sources":["../../src/config/default-config.ts"],"sourcesContent":[null],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"default-config.js","sources":["../../src/config/default-config.ts"],"sourcesContent":[null],"names":[],"mappings":"SAEgB,gBAAgB,GAAA;IAC9B,OAAO;AACL,QAAA,cAAc,EAAE,EAAE;AAClB,QAAA,yBAAyB,EAAE,KAAK;AAChC;;;;AAIG;AACH,QAAA,QAAQ,EAAE,SAAS;AACnB,QAAA,MAAM,EAAE,SAAS;AACjB,QAAA,YAAY,EAAE,SAAS;AACvB,QAAA,KAAK,EAAE,KAAK;AACZ,QAAA,IAAI,EAAE;AACJ,YAAA,UAAU,EAAE,KAAK;AAClB,SAAA;AACD,QAAA,kBAAkB,EAAE;AAClB,YAAA,MAAM,EAAE,IAAI;AACZ,YAAA,QAAQ,EAAE,QAAQ;AACnB,SAAA;;;;AAID,QAAA,kBAAkB,EAAE,SAAS;KAC9B;AACH;;;;"}
|
|
@@ -1,9 +1,29 @@
|
|
|
1
|
+
import { isObject } from 'lodash-es';
|
|
1
2
|
import { z } from 'zod';
|
|
2
3
|
import { DEFAULT_COMPOSITION_TYPE_UID } from './config.constant.js';
|
|
3
4
|
import { userConfigSchema } from './config.schema.js';
|
|
4
5
|
import { getDefaultConfig } from './default-config.js';
|
|
5
6
|
import { StackSDK } from './stack-sdk-wrapper.js';
|
|
6
7
|
|
|
8
|
+
/**
|
|
9
|
+
* Whether a value is a Contentstack stack the SDK can query.
|
|
10
|
+
*
|
|
11
|
+
* Three properties rather than one. `livePreviewQuery` alone admits an object
|
|
12
|
+
* the credential accessors then crash on: they read `headers.api_key` on a
|
|
13
|
+
* JavaScript stack and `config.apiKey` on a TypeScript one, so a value carrying
|
|
14
|
+
* neither reintroduces the very `TypeError` this check exists to replace. Every
|
|
15
|
+
* constructed stack of either kind carries one of them.
|
|
16
|
+
*
|
|
17
|
+
* Membership is tested with `in` because these live on the prototype, which is
|
|
18
|
+
* also why the value has to be an object first — `in` throws on anything else.
|
|
19
|
+
*/
|
|
20
|
+
function isContentstackStack(value) {
|
|
21
|
+
if (!isObject(value))
|
|
22
|
+
return false;
|
|
23
|
+
if (!("livePreviewQuery" in value))
|
|
24
|
+
return false;
|
|
25
|
+
return "headers" in value || "config" in value;
|
|
26
|
+
}
|
|
7
27
|
function processUserConfig(userConfig) {
|
|
8
28
|
const config = getDefaultConfig();
|
|
9
29
|
try {
|
|
@@ -18,15 +38,25 @@ function processUserConfig(userConfig) {
|
|
|
18
38
|
issues.join("\n - ") +
|
|
19
39
|
"\n");
|
|
20
40
|
}
|
|
41
|
+
// Anything else is a fault in validation itself. Swallowing it hid the
|
|
42
|
+
// missing-stack case entirely: the check threw a `TypeError`, this branch
|
|
43
|
+
// dropped it, and the defaulted stack then passed every guard downstream.
|
|
44
|
+
throw error;
|
|
21
45
|
}
|
|
46
|
+
config.contentTypeUidWasSupplied = userConfig.contentTypeUid !== undefined;
|
|
22
47
|
config.contentTypeUid =
|
|
23
48
|
userConfig.contentTypeUid ?? DEFAULT_COMPOSITION_TYPE_UID;
|
|
24
|
-
|
|
49
|
+
// A value that is not a stack is left absent rather than wrapped, so the
|
|
50
|
+
// guards downstream see "no stack" instead of a wrapper around nothing.
|
|
51
|
+
if (isContentstackStack(userConfig.stackSdk)) {
|
|
25
52
|
config.stackSdk = new StackSDK(userConfig.stackSdk, userConfig.locale);
|
|
26
53
|
}
|
|
27
54
|
if (userConfig.locale) {
|
|
28
55
|
config.locale = userConfig.locale;
|
|
29
56
|
}
|
|
57
|
+
if (typeof userConfig.debug !== "undefined") {
|
|
58
|
+
config.debug = userConfig.debug;
|
|
59
|
+
}
|
|
30
60
|
if (typeof userConfig.cslp?.appendTags !== "undefined") {
|
|
31
61
|
config.cslp.appendTags = userConfig.cslp.appendTags;
|
|
32
62
|
}
|
|
@@ -45,6 +75,12 @@ function processUserConfig(userConfig) {
|
|
|
45
75
|
if (userConfig.fetchTemplateEntry) {
|
|
46
76
|
config.fetchTemplateEntry = userConfig.fetchTemplateEntry;
|
|
47
77
|
}
|
|
78
|
+
// Checked by type, not truthiness: `false` is the value that matters most here
|
|
79
|
+
// (turn derivation off for an old composition) and a truthiness check would
|
|
80
|
+
// drop it silently, leaving the per-composition default in charge.
|
|
81
|
+
if (typeof userConfig.deriveIncludePaths === "boolean") {
|
|
82
|
+
config.deriveIncludePaths = userConfig.deriveIncludePaths;
|
|
83
|
+
}
|
|
48
84
|
// BYOS state config — passed through as-is so generateSdk can wire the
|
|
49
85
|
// shared state store (getDefaultConfig has no state entry; without this
|
|
50
86
|
// copy the user's getState/setState/variables silently vanish).
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"process-user-config.js","sources":["../../src/config/process-user-config.ts"],"sourcesContent":[null],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"process-user-config.js","sources":["../../src/config/process-user-config.ts"],"sourcesContent":[null],"names":[],"mappings":";;;;;;;AAQA;;;;;;;;;;;AAWG;AACH,SAAS,mBAAmB,CAAC,KAAc,EAAA;AACzC,IAAA,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC;AAAE,QAAA,OAAO,KAAK;AAClC,IAAA,IAAI,EAAE,kBAAkB,IAAI,KAAK,CAAC;AAAE,QAAA,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C;IAEA,IAAI,OAAO,UAAU,CAAC,IAAI,EAAE,UAAU,KAAK,WAAW,EAAE;QACtD,MAAM,CAAC,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC,IAAI,CAAC,UAAU;IACrD;AAEA,IAAA,IAAI,UAAU,CAAC,kBAAkB,EAAE;QACjC,IAAI,OAAO,UAAU,CAAC,kBAAkB,EAAE,MAAM,KAAK,WAAW,EAAE;YAChE,MAAM,CAAC,kBAAkB,CAAC,MAAM,GAAG,UAAU,CAAC,kBAAkB,CAAC,MAAM;QACzE;QACA,IAAI,OAAO,UAAU,CAAC,kBAAkB,EAAE,QAAQ,KAAK,WAAW,EAAE;YAClE,MAAM,CAAC,kBAAkB,CAAC,QAAQ;AAChC,gBAAA,UAAU,CAAC,kBAAkB,CAAC,QAAQ;QAC1C;IACF;AAEA,IAAA,IAAI,UAAU,CAAC,gBAAgB,EAAE;AAC/B,QAAA,MAAM,CAAC,gBAAgB,GAAG,UAAU,CAAC,gBAAgB;IACvD;AACA,IAAA,IAAI,UAAU,CAAC,kBAAkB,EAAE;AACjC,QAAA,MAAM,CAAC,kBAAkB,GAAG,UAAU,CAAC,kBAAkB;IAC3D;;;;AAKA,IAAA,IAAI,OAAO,UAAU,CAAC,kBAAkB,KAAK,SAAS,EAAE;AACtD,QAAA,MAAM,CAAC,kBAAkB,GAAG,UAAU,CAAC,kBAAkB;IAC3D;;;;AAKA,IAAA,IAAI,UAAU,CAAC,KAAK,EAAE;AACpB,QAAA,MAAM,CAAC,KAAK,GAAG,UAAU,CAAC,KAAK;IACjC;AAEA,IAAA,OAAO,MAAM;AACf;;;;"}
|
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
import '@contentstack/studio-messenger';
|
|
2
2
|
import 'lodash-es';
|
|
3
|
+
import '@contentstack/studio-messenger/constants';
|
|
3
4
|
import { onlyParmasGenerator } from '../utils/query-param.js';
|
|
4
5
|
import '@contentstack/studio-registry';
|
|
5
6
|
import '../utils/editor-mode.js';
|
|
7
|
+
import '../utils/studio-error-codes.js';
|
|
8
|
+
import '../utils/composition-not-found.js';
|
|
6
9
|
import '../utils/conditionBlock.js';
|
|
7
10
|
|
|
8
11
|
// Measured against cdn.contentstack.io: 15,092 bytes of request URI comes back
|
|
@@ -217,8 +220,40 @@ class StackSDK {
|
|
|
217
220
|
}
|
|
218
221
|
return this.sdk.config.apiKey;
|
|
219
222
|
}
|
|
223
|
+
get deliveryToken() {
|
|
224
|
+
if (this.isJavaScriptSDK(this.sdk)) {
|
|
225
|
+
// @ts-expect-error the JS SDK keeps credentials on `headers`, untyped
|
|
226
|
+
return this.sdk.headers?.access_token;
|
|
227
|
+
}
|
|
228
|
+
return this.sdk.config.deliveryToken;
|
|
229
|
+
}
|
|
230
|
+
get environment() {
|
|
231
|
+
if (this.isJavaScriptSDK(this.sdk)) {
|
|
232
|
+
return this.sdk.environment;
|
|
233
|
+
}
|
|
234
|
+
return this.sdk.config.environment;
|
|
235
|
+
}
|
|
236
|
+
/**
|
|
237
|
+
* The host the stack will actually call. Always populated on both SDKs — the
|
|
238
|
+
* TS factory overwrites `config.host` with the region's resolved default, and
|
|
239
|
+
* the JS SDK's own defaults carry one. There is deliberately no
|
|
240
|
+
* `hostWasExplicit` companion: by the time a constructed stack reaches us the
|
|
241
|
+
* customer's original value is gone, and recovering it would mean comparing
|
|
242
|
+
* against a table of Contentstack hostnames, which breaks on dev and staging
|
|
243
|
+
* stacks and on custom CDNs.
|
|
244
|
+
*/
|
|
245
|
+
get host() {
|
|
246
|
+
return this.sdk.config?.host;
|
|
247
|
+
}
|
|
220
248
|
get livePreviewConfig() {
|
|
221
|
-
|
|
249
|
+
if (this.isJavaScriptSDK(this.sdk)) {
|
|
250
|
+
// Not a behaviour fix: the JS SDK merges the caller's options into
|
|
251
|
+
// `live_preview` and assigns the same object to `config.live_preview`, so
|
|
252
|
+
// reading either works today. Read the documented one — it is the typed
|
|
253
|
+
// field, it removes the `@ts-expect-error`, and it does not depend on the
|
|
254
|
+
// two staying aliased in a future release.
|
|
255
|
+
return this.sdk.live_preview;
|
|
256
|
+
}
|
|
222
257
|
return this.sdk.config.live_preview;
|
|
223
258
|
}
|
|
224
259
|
get locale() {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"stack-sdk-wrapper.js","sources":["../../src/config/stack-sdk-wrapper.ts"],"sourcesContent":[null],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"stack-sdk-wrapper.js","sources":["../../src/config/stack-sdk-wrapper.ts"],"sourcesContent":[null],"names":[],"mappings":";;;;;;;;;;AAKA;AACA;AACA;AACA;AACA;AACA,MAAM,qBAAqB,GAAG,KAAK;MAKtB,QAAQ,CAAA;AACnB,IAAA,GAAG;AACK,IAAA,OAAO;IAEf,WAAA,CAAY,GAAsB,EAAE,MAAe,EAAA;AACjD,QAAA,IAAI,CAAC,GAAG,GAAG,GAAG;AACd,QAAA,IAAI,CAAC,OAAO,GAAG,MAAM;QAErB,IAAI,CAAC,eAAe,GAAG,IAAI,CAAC,eAAe,CAAC,IAAI,CAAC,IAAI,CAAC;QACtD,IAAI,CAAC,gBAAgB,GAAG,IAAI,CAAC,gBAAgB,CAAC,IAAI,CAAC,IAAI,CAAC;QACxD,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC;QACtC,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC;QAC1C,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC;QAClC,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC;QAC5C,IAAI,CAAC,oBAAoB,GAAG,IAAI,CAAC,oBAAoB,CAAC,IAAI,CAAC,IAAI,CAAC;IAClE;AAEA,IAAA,eAAe,CACb,IAAuD,EAAA;AAEvD,QAAA,OAAO,aAAa,IAAI,IAAI,CAAC,GA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GA,YAAA,IACE,IAAI,CAAC,eAAe,CAAC,IAAI,CAAC,GAAG,CAAC;AAC9B,gBAAA,OAAO,aAAa,CAAC,MAAM,KAAK,UAAU,EAC1C;AACA,gBAAA,aAAa,GAAG,aAAa,CAAC,MAAM,EAAE;YACxC;AAEA,YAAA,OAAO,aAAa;QACtB;QAAE,OAAO,KAAK,EAAE;;AAEd,YAAA,OAAO,CAAC,IAAI,CACV,gEAAgE,EAChE,KAAK,CACN;YAED,IAAI,aAAa,GAAG,KAAK;AACzB,YAAA,KAAK,MAAM,CAAC,WAAW,EAAE,aAAa,CAAC,IAAI,MAAM,CAAC,OAAO,CACvD,mBAAmB,CACpB,EAAE;AACD,gBAAA,MAAM,aAAa,GAAG,CAAA,WAAA,EAAc,WAAW,EAAE;gBACjD,aAAa,GAAG,IAAI,CAAC,KAAK,CAAC,aAAa,EAAE,aAAa,EAAE,aAAa,CAAC;YACzE;AAEA,YAAA,OAAO,aAAa;QACtB;IACF;AACD;;;;"}
|
|
@@ -1,8 +1,11 @@
|
|
|
1
|
-
import { IS_BROWSER,
|
|
1
|
+
import { IS_BROWSER, POST_MESSAGE_EVENTS } from '@contentstack/studio-messenger/constants';
|
|
2
|
+
import { sendStudioEvent } from '../utils/studio-messaging.js';
|
|
2
3
|
import { COMPOSABLE_DATA_ATTRIBUTES } from '../utils/constants.js';
|
|
3
4
|
import 'lodash-es';
|
|
4
5
|
import '@contentstack/studio-registry';
|
|
5
6
|
import '../utils/editor-mode.js';
|
|
7
|
+
import '../utils/studio-error-codes.js';
|
|
8
|
+
import '../utils/composition-not-found.js';
|
|
6
9
|
import '../utils/conditionBlock.js';
|
|
7
10
|
import { getHitboxDetails, serializeEvent } from '../canvas/canvas.utils.js';
|
|
8
11
|
|
|
@@ -12,7 +15,7 @@ const handleContextMenu = (e) => {
|
|
|
12
15
|
const closestNode = target.closest(`[${COMPOSABLE_DATA_ATTRIBUTES.NODE}]`);
|
|
13
16
|
if (!closestNode)
|
|
14
17
|
return;
|
|
15
|
-
|
|
18
|
+
sendStudioEvent(POST_MESSAGE_EVENTS.CONTEXT_MENU, {
|
|
16
19
|
event: serializeEvent(e),
|
|
17
20
|
details: getHitboxDetails(e),
|
|
18
21
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"context-menu.js","sources":["../../src/context-menu/context-menu.ts"],"sourcesContent":[null],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"context-menu.js","sources":["../../src/context-menu/context-menu.ts"],"sourcesContent":[null],"names":[],"mappings":";;;;;;;;;;;AAQA,MAAM,iBAAiB,GAAG,CAAC,CAAa,KAAI;IAC1C,CAAC,CAAC,cAAc,EAAE;AAClB,IAAA,MAAM,MAAM,GAAG,CAAC,CAAC,MAAqB;AACtC,IAAA,MAAM,WAAW,GAAG,MAAM,CAAC,OAAO,CAChC,CAAA,CAAA,EAAI,0BAA0B,CAAC,IAAI,CAAA,CAAA,CAAG,CACxB;AAChB,IAAA,IAAI,CAAC,WAAW;QAAE;AAClB,IAAA,eAAe,CAAC,mBAAmB,CAAC,YAAY,EAAE;AAChD,QAAA,KAAK,EAAE,cAAc,CAAC,CAAC,CAAC;AACxB,QAAA,OAAO,EAAE,gBAAgB,CAAC,CAAC,CAAC;AAC7B,KAAA,CAAC;AACF,IAAA,OAAO,KAAK;AACd,CAAC;SAEe,4BAA4B,GAAA;AAC1C,IAAA,IAAI,CAAC,UAAU;QAAE;IACjB,MAAM,oBAAoB,GAIpB,EAAE;AAER,IAAA,SAAS,sBAAsB,CAC7B,IAAO,EACP,OAA2C,EAC3C,OAA2C,EAAA;QAE3C,MAAM,CAAC,gBAAgB,CAAC,IAAI,EAAE,OAAO,EAAE,OAAO,CAAC;QAC/C,oBAAoB,CAAC,IAAI,CAAC;YACxB,IAAI;AACJ,YAAA,OAAO,EAAE,OAAwB;YACjC,OAAO;AACR,SAAA,CAAC;IACJ;AAEA,IAAA,sBAAsB,CAAC,aAAa,EAAE,iBAAiB,CAAC;IAExD,OAAO;QACL,oBAAoB,EAAE,MAAK;AACzB,YAAA,oBAAoB,CAAC,OAAO,CAAC,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,KAAI;gBAC1D,MAAM,CAAC,mBAAmB,CAAC,IAAI,EAAE,OAAO,EAAE,OAAO,CAAC;AACpD,YAAA,CAAC,CAAC;QACJ,CAAC;KACF;AACH;;;;"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { IS_BROWSER,
|
|
1
|
+
import { IS_BROWSER, POST_MESSAGE_EVENTS } from '@contentstack/studio-messenger/constants';
|
|
2
|
+
import { sendStudioEvent } from '../utils/studio-messaging.js';
|
|
2
3
|
import { highlightNodeManager } from '../highlight-node/highlight-node-manager.js';
|
|
3
4
|
|
|
4
5
|
let onStyleChangeObserver;
|
|
@@ -11,7 +12,7 @@ function getOnStyleChangeObserver() {
|
|
|
11
12
|
mutations.forEach((mutation) => {
|
|
12
13
|
const element = mutation.target;
|
|
13
14
|
const stylesObject = JSON.parse(JSON.stringify(window.getComputedStyle(element)));
|
|
14
|
-
|
|
15
|
+
sendStudioEvent(POST_MESSAGE_EVENTS.CHANGE_STYLE_SECTION, {
|
|
15
16
|
styles: stylesObject,
|
|
16
17
|
styleNodeRect: element.getBoundingClientRect(),
|
|
17
18
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"handle-active-style-change.js","sources":["../../src/design/handle-active-style-change.ts"],"sourcesContent":[null],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"handle-active-style-change.js","sources":["../../src/design/handle-active-style-change.ts"],"sourcesContent":[null],"names":[],"mappings":";;;;AAQA,IAAI,qBAAmD;AACvD,SAAS,wBAAwB,GAAA;AAC/B,IAAA,IAAI,CAAC,UAAU;QAAE;AACjB,IAAA,IAAI,qBAAqB;AAAE,QAAA,OAAO,qBAAqB;AACvD,IAAA,qBAAqB,GAAG,IAAI,gBAAgB,CAAC,CAAC,SAAS,KAAI;AACzD,QAAA,S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GE_EVENTS } from '@contentstack/studio-messenger/constants';
|
|
2
|
+
import { composableStudioEventManager } from '@contentstack/studio-messenger';
|
|
2
3
|
import { dndManager } from './dnd-manager.js';
|
|
3
4
|
|
|
4
5
|
const dndEventListener = () => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dnd-event.js","sources":["../../src/dnd/dnd-event.ts"],"sourcesContent":[null],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"dnd-event.js","sources":["../../src/dnd/dnd-event.ts"],"sourcesContent":[null],"names":[],"mappings":";;;;AAIO,MAAM,gBAAgB,GAAG,MAAK;IACnC,MAAM,oBAAoB,GAAiC,EAAE;AAE7D,IAAA,SAAS,sBAAsB,CAC7B,SAAiB,EACjB,OAAqC,EAAA;QAErC,MAAM,QAAQ,GAAG,4BAA4B,EAAE,EAAE,CAAI,SAAS,EAAE,OAAO,CAAC;QACxE,IAAI,QAAQ,EAAE;AACZ,YAAA,oBAAoB,CAAC,IAAI,CAAC,QAAQ,CAAC;QACrC;IACF;;AAGA,IAAA,sBAAsB,CAAC,mBAAmB,CAAC,iBAAiB,EAAE,MAAK;QACjE,UAAU,CAAC,WAAW,EAAE;AAC1B,IAAA,CAAC,CAAC;AAEF,IAAA,sBAAsB,CAAC,mBAAmB,CAAC,eAAe,EAAE,MAAK;QAC/D,UAAU,CAAC,GAAG,EAAE;AAClB,IAAA,CAAC,CAAC;IAEF,OAAO;QACL,oBAAoB,EAAE,MAAK;YACzB,oBAAoB,CAAC,OAAO,CAAC,CAAC,EAAE,UAAU,EAAE,KAAI;AAC9C,gBAAA,UAAU,EAAE;AACd,YAAA,CAAC,CAAC;QACJ,CAAC;KACF;AACH;;;;"}
|
package/dist/dnd/dnd-manager.js
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
|
-
import { IS_BROWSER } from '@contentstack/studio-messenger';
|
|
1
|
+
import { IS_BROWSER } from '@contentstack/studio-messenger/constants';
|
|
2
2
|
import { COMPOSABLE_DATA_ATTRIBUTES } from '../utils/constants.js';
|
|
3
3
|
import 'lodash-es';
|
|
4
4
|
import '@contentstack/studio-registry';
|
|
5
5
|
import '../utils/editor-mode.js';
|
|
6
|
+
import '../utils/studio-error-codes.js';
|
|
7
|
+
import '../utils/composition-not-found.js';
|
|
6
8
|
import '../utils/conditionBlock.js';
|
|
7
9
|
import { dndEventManager } from '../shared/dnd-events.js';
|
|
8
10
|
import { getScrollableParent, calculateDynamicSpeed } from './scroll-utils.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dnd-manager.js","sources":["../../src/dnd/dnd-manager.ts"],"sourcesContent":[null],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"dnd-manager.js","sources":["../../src/dnd/dnd-manager.ts"],"sourcesContent":[null],"names":[],"mappings":";;;;;;;;;;;AAIA;AAEO,MAAM,gBAAgB,GAAG;AACzB,MAAM,eAAe,GAAG;AACxB,MAAM,YAAY,GAAG;AAC5B,MAAM,cAAc,GAAG,EAAE;AAOzB,MAAM,UAAU,CAAA;IACd,OAAO,GAAY,KAAK;IACxB,QAAQ,GAAY,KAAK;IACzB,eAAe,GAAuB,IAAI;AAC1C,IAAA,cAAc;IACd,aAAa,GAAyB,IAAI;IAC1C,QAAQ,GAAY,KAAK;IACzB,SAAS,GAAY,KAAK;AAE1B,IAAA,WAAA,GAAA;AACE,QAAA,IAAI,CAAC,UAAU;YAAE;AACjB,QAAA,QAAQ,CAAC,gBAAgB,CAAC,WAAW,EAAE,IAAI,CAAC,eAAe,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AACvE,QAAA,QAAQ,CAAC,gBAAgB,CAAC,SAAS,EAAE,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AACnE,QAAA,QAAQ,CAAC,gBAAgB,CAAC,YAAY,EAAE,IAAI,CAAC,gBAAgB,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;;QAGzE,eAAe,CAAC,EAAE,CAAC,WA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@contentstack/studio-message-types/latest';
|
|
3
|
+
export { BaseHighlightEventPayload, ChangeActiveStyleGroupPayload, ComputedStyleSection, DraggerPosition, HighlightActiveNodeEventPayload, HighlightAncestorsEventPayload, HighlightFocusedNodeEventPayload, HighlightNodeEventPayload, HighlightSlotNodeEventPayload, HighlightStyleNodeEventPayload, HitboxDetails, MouseMoveEventPayload, MouseUpEventPayload, RequestHighlightNodeEventPayload, RevealMissKind, RevealNodePayload, RevealResultPayload, SetCursorTypeEventPayload, TARGET_NODE, UpdateStyleEventPayload, handleActiveNodePayload, handleActiveSlotNode, handleFocusedNodePayload } from '@contentstack/studio-message-types/latest';
|
|
4
|
+
|
|
5
|
+
declare const MAX_SCROLL_SPEED = 100;
|
|
6
|
+
declare const SCROLL_INTERVAL = 50;
|
|
7
|
+
declare const EDGE_PADDING = 50;
|
|
8
|
+
interface MousePosition {
|
|
9
|
+
clientX: number;
|
|
10
|
+
clientY: number;
|
|
11
|
+
}
|
|
12
|
+
declare class DNDManager {
|
|
13
|
+
started: boolean;
|
|
14
|
+
dragging: boolean;
|
|
15
|
+
scrollContainer: HTMLElement | null;
|
|
16
|
+
scrollInterval: ReturnType<typeof setInterval> | undefined;
|
|
17
|
+
startPosition: MousePosition | null;
|
|
18
|
+
hasMoved: boolean;
|
|
19
|
+
mouseDown: boolean;
|
|
20
|
+
constructor();
|
|
21
|
+
handleMouseDown(_e: MouseEvent): void;
|
|
22
|
+
handleMouseUp(_e: MouseEvent): void;
|
|
23
|
+
handleMouseLeave(e: MouseEvent): void;
|
|
24
|
+
start(e: MouseEvent): void;
|
|
25
|
+
startParent(): void;
|
|
26
|
+
end(): void;
|
|
27
|
+
mouseMove(e: MouseEvent): void;
|
|
28
|
+
get isStarted(): boolean;
|
|
29
|
+
get isDragging(): boolean;
|
|
30
|
+
hasExceededTolerance(start: MousePosition, end: MousePosition): boolean;
|
|
31
|
+
}
|
|
32
|
+
declare const dndManager: DNDManager;
|
|
33
|
+
|
|
34
|
+
declare const dndEventListener: () => {
|
|
35
|
+
removeEventListeners: () => void;
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
declare const getScrollableParent: (el: HTMLElement) => HTMLElement;
|
|
39
|
+
declare const calculateDynamicSpeed: (distance: number, padding: number, maxSpeed: number) => number;
|
|
40
|
+
|
|
41
|
+
declare function handleOnScroll(): void;
|
|
42
|
+
declare function handleResize(): void;
|
|
43
|
+
declare const isModKey: (e: MouseEvent | KeyboardEvent) => boolean;
|
|
44
|
+
declare function addHighlightNodeEventListeners(): {
|
|
45
|
+
removeEventListeners: () => void;
|
|
46
|
+
} | undefined;
|
|
47
|
+
|
|
48
|
+
type OnStyleChangeCallback = (options: {
|
|
49
|
+
activeNodeUID: string;
|
|
50
|
+
element: HTMLElement;
|
|
51
|
+
componentClassName: string;
|
|
52
|
+
}) => void;
|
|
53
|
+
/** `revealNode`'s answer: the reply payload minus the uid the caller already knows. */
|
|
54
|
+
type RevealOutcome = Omit<RevealResultPayload, "requestedUid">;
|
|
55
|
+
/**
|
|
56
|
+
* The smallest rect covering every given rect. Missing rects, and empty ones
|
|
57
|
+
* (an element with `display: none` measures 0 × 0 at the viewport origin),
|
|
58
|
+
* are skipped so they can't stretch the union to the corner.
|
|
59
|
+
*/
|
|
60
|
+
declare function unionRects(rects: (DOMRect | null | undefined)[]): DOMRect | null;
|
|
61
|
+
declare class HighlightNodeManager {
|
|
62
|
+
activeNodeUID: string | null;
|
|
63
|
+
focusedNodeUID: string | null;
|
|
64
|
+
activeNodePath: Path | null;
|
|
65
|
+
focusedNodePath: Path | null;
|
|
66
|
+
hoveredNodeUID: string | null;
|
|
67
|
+
/** The slot of the hovered node the pointer is on, if any (slot hover). */
|
|
68
|
+
hoveredSlotUID: string | null;
|
|
69
|
+
/**
|
|
70
|
+
* The element the slot hover came from (an empty slot's placeholder), so a
|
|
71
|
+
* slot inside a Repeater is measured where the pointer is, not at its first
|
|
72
|
+
* rendered copy. Null for a hover requested from a Layers slot row.
|
|
73
|
+
*/
|
|
74
|
+
hoveredSlotElement: HTMLElement | null;
|
|
75
|
+
activeSlotUID: string | null;
|
|
76
|
+
styleGroup: string | null;
|
|
77
|
+
onStyleChangeCallbacks: Set<OnStyleChangeCallback>;
|
|
78
|
+
onActiveNodeChangeCallbacks: Set<(uid: string, path: Path) => void>;
|
|
79
|
+
visible: boolean;
|
|
80
|
+
constructor();
|
|
81
|
+
private setActiveNodeUID;
|
|
82
|
+
private setFocusedNodeUID;
|
|
83
|
+
setHoveredNode(uid: string): void;
|
|
84
|
+
setActiveSlotUID(uid: string | null): void;
|
|
85
|
+
resetActiveNode(): void;
|
|
86
|
+
resetFocusedNode(): void;
|
|
87
|
+
/**
|
|
88
|
+
* Subscribe to changes in the active node.
|
|
89
|
+
*
|
|
90
|
+
* @param callback - Function that will be called whenever the active node changes.
|
|
91
|
+
* The callback receives the UID of the newly active node as a parameter.
|
|
92
|
+
* @param options - Configuration options
|
|
93
|
+
* @param options.syncToExistingValue - When true, the callback will be immediately called
|
|
94
|
+
* with the current active node's UID. When false, the callback will only be called on future changes.
|
|
95
|
+
* Defaults to false.
|
|
96
|
+
*
|
|
97
|
+
* @example
|
|
98
|
+
* ```ts
|
|
99
|
+
* highlightNodeManager.onActiveNodeChange((uid) => {
|
|
100
|
+
* console.log('Active node changed to:', uid);
|
|
101
|
+
* }, { syncToExistingValue: true });
|
|
102
|
+
* ```
|
|
103
|
+
*/
|
|
104
|
+
onActiveNodeChange(callback: (uid: string, path: Path) => void, options: {
|
|
105
|
+
syncToExistingValue: boolean;
|
|
106
|
+
}): void;
|
|
107
|
+
/**
|
|
108
|
+
* Unsubscribe from changes in the active node.
|
|
109
|
+
*
|
|
110
|
+
* @param callback - The callback function to unsubscribe.
|
|
111
|
+
*
|
|
112
|
+
* @example
|
|
113
|
+
* ```ts
|
|
114
|
+
* const onHighlight = (uid: string) => {
|
|
115
|
+
* console.log('Active node changed to:', uid);
|
|
116
|
+
* };
|
|
117
|
+
*
|
|
118
|
+
* highlightNodeManager.onActiveNodeChange(onHighlight);
|
|
119
|
+
* highlightNodeManager.unsubscribeFromActiveNodeChange(onHighlight);
|
|
120
|
+
* ```
|
|
121
|
+
*/
|
|
122
|
+
unsubscribeFromActiveNodeChange(callback: (uid: string, path: Path) => void): void;
|
|
123
|
+
private notifyActiveNodeChange;
|
|
124
|
+
removeNodeHighligher(): void;
|
|
125
|
+
hideActiveNode(): void;
|
|
126
|
+
setStyleGroup: (styleGroup: string | null) => void;
|
|
127
|
+
subscribeToOnStyleChange: (callback: OnStyleChangeCallback) => void;
|
|
128
|
+
unsubscribeFromOnStyleChange: (callback: OnStyleChangeCallback) => void;
|
|
129
|
+
resetStyleGroup(): void;
|
|
130
|
+
setAndHighlightActiveNode(uid: string): void;
|
|
131
|
+
/**
|
|
132
|
+
* Scroll to the first node in `chain` that renders something measurable, and
|
|
133
|
+
* report what happened for the node that was actually asked for (`chain[0]`).
|
|
134
|
+
*
|
|
135
|
+
* Falling back to an ancestor is what makes a component with no box of its
|
|
136
|
+
* own reachable at all; the editor turns `miss` into the reason.
|
|
137
|
+
*/
|
|
138
|
+
revealNode(chain: string[]): RevealOutcome;
|
|
139
|
+
/**
|
|
140
|
+
* Where a node is: the FIRST element it rendered that has a box.
|
|
141
|
+
*
|
|
142
|
+
* A node can reach the DOM many times — once per enclosing Repeater item,
|
|
143
|
+
* all copies under the same uid — and the copies that rendered nothing (a
|
|
144
|
+
* Condition Block whose condition is not met for that item) contribute no
|
|
145
|
+
* box. Reading only the first ELEMENT called the whole node absent whenever
|
|
146
|
+
* copy 0 was one of those; reading the first RENDERED one does not.
|
|
147
|
+
*
|
|
148
|
+
* First, and not the nearest to the viewport, because this single answer
|
|
149
|
+
* serves the outline as well as the scroll. If they disagreed the page would
|
|
150
|
+
* travel to a copy the outline is not drawn around, which is worse than the
|
|
151
|
+
* travel itself. Only one copy can be outlined, so only one can be revealed.
|
|
152
|
+
*
|
|
153
|
+
* The three outcomes are kept apart because the editor tells them apart: a
|
|
154
|
+
* node that rendered with no area is a styling result, one that rendered
|
|
155
|
+
* nothing at all is a different story, and conflating them would report
|
|
156
|
+
* `display: none` and "never rendered" as the same thing.
|
|
157
|
+
*/
|
|
158
|
+
private locateNode;
|
|
159
|
+
/**
|
|
160
|
+
* The nearest element at or under `element` that the browser gave a box to.
|
|
161
|
+
*
|
|
162
|
+
* Returns `element` itself unless it is `display: contents`, in which case it
|
|
163
|
+
* has no box of its own and the search continues into what it rendered.
|
|
164
|
+
*/
|
|
165
|
+
private firstBoxElement;
|
|
166
|
+
/**
|
|
167
|
+
* Whether the author can already see the whole node.
|
|
168
|
+
*
|
|
169
|
+
* A node taller than the viewport can never be "fully visible", so it is
|
|
170
|
+
* judged by its top edge instead — the top is what identifies a component,
|
|
171
|
+
* and scrolling a tall hero to chase its bottom edge is disorienting.
|
|
172
|
+
*/
|
|
173
|
+
private isFullyVisible;
|
|
174
|
+
setAndHighlightFocusedNode(uid: string): void;
|
|
175
|
+
/**
|
|
176
|
+
* Hover the node `uid`, or one slot of it when `slotUid` is given. Moving
|
|
177
|
+
* from a container onto its own empty slot keeps the same node uid, so the
|
|
178
|
+
* slot is part of what counts as a change.
|
|
179
|
+
*/
|
|
180
|
+
setAndHighlightHoveredNode(uid: string, slotUid?: string | null, slotElement?: HTMLElement | null): void;
|
|
181
|
+
setAndHighlightStyleNode(styleGroup: string, uid: string): {
|
|
182
|
+
styles: undefined;
|
|
183
|
+
} | {
|
|
184
|
+
styles: Partial<CSSStyleDeclaration>;
|
|
185
|
+
};
|
|
186
|
+
highlightActiveNode(): void;
|
|
187
|
+
highlightFocusedNode(): void;
|
|
188
|
+
highlightNodeOnHover(): void;
|
|
189
|
+
highlightStyleNode(): void;
|
|
190
|
+
sendStylesToClient(): {
|
|
191
|
+
styles: undefined;
|
|
192
|
+
} | {
|
|
193
|
+
styles: Partial<CSSStyleDeclaration>;
|
|
194
|
+
};
|
|
195
|
+
highlightSlotNode(): void;
|
|
196
|
+
private getStylesObject;
|
|
197
|
+
private getHighlightStyleNodePayload;
|
|
198
|
+
/**
|
|
199
|
+
* A slot's box. Only an empty slot renders an element of its own (its "Drop
|
|
200
|
+
* Here" placeholder, tagged with the slot uid). A filled slot renders its
|
|
201
|
+
* children bare, and a filled section slot renders a `display: contents`
|
|
202
|
+
* wrapper with no box — both are measured as the union of their children.
|
|
203
|
+
*/
|
|
204
|
+
private getSlotRect;
|
|
205
|
+
/** The hovered slot's box: where the pointer is, else its first copy. */
|
|
206
|
+
private getHoveredSlotRect;
|
|
207
|
+
private measureSlotElement;
|
|
208
|
+
/**
|
|
209
|
+
* The rendered node whose `slots` holds `slotUid`. While a slot is selected
|
|
210
|
+
* Studio also selects its parent, so the active node is checked first and
|
|
211
|
+
* the page is scanned only when it isn't the owner.
|
|
212
|
+
*/
|
|
213
|
+
private findSlotOwner;
|
|
214
|
+
getBoundingRectOfDisplayContents(element: HTMLElement): DOMRect | null;
|
|
215
|
+
/**
|
|
216
|
+
* The box to draw an outline around — the same copy `revealNode` scrolls to,
|
|
217
|
+
* resolved through the same lookup so the two can never point at different
|
|
218
|
+
* copies of one node.
|
|
219
|
+
*/
|
|
220
|
+
private getNodeRect;
|
|
221
|
+
/**
|
|
222
|
+
* The box one element occupies. Repeater and Condition Block wrappers are
|
|
223
|
+
* `display: contents`, so they have no box of their own and are measured
|
|
224
|
+
* through what they rendered instead.
|
|
225
|
+
*/
|
|
226
|
+
private measureElement;
|
|
227
|
+
private getNodePath;
|
|
228
|
+
getAncestorsElements(currEl: HTMLElement): HTMLElement[];
|
|
229
|
+
}
|
|
230
|
+
declare const highlightNodeManager: HighlightNodeManager;
|
|
231
|
+
|
|
232
|
+
declare function addHighlightSpacingEventListeners(): {
|
|
233
|
+
removeEventListeners: () => void;
|
|
234
|
+
} | undefined;
|
|
235
|
+
|
|
236
|
+
declare function openHiddenElementNotification(uid: string): void;
|
|
237
|
+
declare function closeHiddenElementNotification(uid: string): void;
|
|
238
|
+
declare function hiddenElementNotificationEventEmitter(): {
|
|
239
|
+
unregister: () => void;
|
|
240
|
+
} | undefined;
|
|
241
|
+
|
|
242
|
+
declare function getNodeScreenshotEvent(): {
|
|
243
|
+
unregister: () => void;
|
|
244
|
+
} | undefined;
|
|
245
|
+
|
|
246
|
+
declare const compositionSaveEventListener: () => {
|
|
247
|
+
unregister: () => void;
|
|
248
|
+
} | undefined;
|
|
249
|
+
|
|
250
|
+
export { EDGE_PADDING, MAX_SCROLL_SPEED, SCROLL_INTERVAL, addHighlightNodeEventListeners, addHighlightSpacingEventListeners, calculateDynamicSpeed, closeHiddenElementNotification, compositionSaveEventListener, dndEventListener, dndManager, getNodeScreenshotEvent, getScrollableParent, handleOnScroll, handleResize, hiddenElementNotificationEventEmitter, highlightNodeManager, isModKey, openHiddenElementNotification, unionRects };
|
package/dist/editor.js
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export { EDGE_PADDING, MAX_SCROLL_SPEED, SCROLL_INTERVAL, dndManager } from './dnd/dnd-manager.js';
|
|
2
|
+
export { dndEventListener } from './dnd/dnd-event.js';
|
|
3
|
+
export { calculateDynamicSpeed, getScrollableParent } from './dnd/scroll-utils.js';
|
|
4
|
+
export { addHighlightNodeEventListeners, handleOnScroll, handleResize, isModKey } from './highlight-node/highlight-node.js';
|
|
5
|
+
export { highlightNodeManager, unionRects } from './highlight-node/highlight-node-manager.js';
|
|
6
|
+
export { TARGET_NODE } from '@contentstack/studio-message-types/latest';
|
|
7
|
+
export { addHighlightSpacingEventListeners } from './highlight-spacing/highlight-spacing-events.js';
|
|
8
|
+
export { closeHiddenElementNotification, hiddenElementNotificationEventEmitter, openHiddenElementNotification } from './hidden-element-notification/hidden-element-notification-event.js';
|
|
9
|
+
export { getNodeScreenshotEvent } from './get-active-node-screenshot/get-node-screenshot-event.js';
|
|
10
|
+
export { compositionSaveEventListener } from './visual-builder/composition-save-event.js';
|
|
11
|
+
//# sourceMappingURL=editor.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"editor.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { POST_MESSAGE_EVENTS } from '@contentstack/studio-messenger/constants';
|
|
2
|
+
import { composableStudioEventManager } from '@contentstack/studio-messenger';
|
|
2
3
|
import { getComposableElement, toggleNodeVisible } from '../canvas/canvas.utils.js';
|
|
3
4
|
|
|
4
5
|
function getNodeScreenshotEvent() {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-node-screenshot-event.js","sources":["../../src/get-active-node-screenshot/get-node-screenshot-event.ts"],"sourcesContent":[null],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"get-node-screenshot-event.js","sources":["../../src/get-active-node-screenshot/get-node-screenshot-event.ts"],"sourcesContent":[null],"names":[],"mappings":";;;;SAWgB,sBAAsB,GAAA;AACpC,IAAA,OAAO,4BAA4B,EAAE,EAAE,CAGrC,mBAAmB,CAAC,mBAAmB,EAAE,OAAO,KAAK,KAAI;AACzD,QAAA,MAAM,OAAO,GAAG,KAAK,CAAC,IAAI,CAAC,GAAG;AAC9B,QAAA,MAAM,IAAI,GAAG,oBAAoB,CAAC,OAAO,CAAC;AAC1C,QAAA,iBAAiB,CAAC,IAAI,EAAE,IAAI,CAAC;QAC7B,IAAI,CAAC,IAAI,EAAE;YACT,OAAO;AACL,gBAAA,UAAU,EAAE,EAAE;aACf;QACH;;;;;;;;;;QAUA,MAAM,EAAE,WAAW,EAAE,GAAG,MAAM,OAAO,mBAAmB,CAAC;AACzD,QAAA,MAAM,MAAM,GAAG,MAAM,WAAW,CAAC,IAAmB,EAAE;AACpD,YAAA,KAAK,EAAE,CAAC;AACR,YAAA,eAAe,EAAE,oBAAoB,CAAC,IAAmB,CAAC;AAC3D,SAAA,CAAC,CAAC,OAAO,CAAC,MAAK;AACd,YAAA,iBAAiB,CAAC,IAAI,EAAE,KAAK,CAAC;AAChC,QAAA,CAAC,CAAC;QACF,MAAM,UAAU,GAAG,MAAM,CAAC,SAAS,CAAC,YAAY,CAAC;QAEjD,OAAO;AACL,YAAA,UAAU,EAAE,UAAU;SACvB;AACH,IAAA,CAAC,CAAC;AACJ;AAEA;;;;;;;;;;;;AAYG;AACH,SAAS,oBAAoB,CAAC,IAAiB,EAAA;IAC7C,IAAI,OAAO,GAAuB,IAAI;IACtC,OAAO,OAAO,EAAE;QACd,MAAM,UAAU,GAAG,MAAM,CAAC,gBAAgB,CAAC,OAAO,CAAC,CAAC,eAAe;QACnE,IAAI,aAAa,CAAC,UAAU,CAAC;AAAE,YAAA,OAAO,UAAU;AAChD,QAAA,OAAO,GAAG,OAAO,CAAC,aAAa;IACjC;AACA,IAAA,OAAO,SAAS;AAClB;AAEA;AACA,SAAS,aAAa,CAAC,KAAa,EAAA;AAClC,IAAA,IAAI,CAAC,KAAK,IAAI,KAAK,KAAK,aAAa;AAAE,QAAA,OAAO,KAAK;IACnD,MAAM,QAAQ,GAAG,KAAK,CAAC,KAAK,CAAC,sBAAsB,CAAC;AACpD,IAAA,IAAI,CAAC,QAAQ;AAAE,QAAA,OAAO,IAAI;AAC1B,IAAA,MAAM,KAAK,GAAG,QAAQ,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC;AAC1D,IAAA,OAAO,KAAK,CAAC,MAAM,GAAG,CAAC,IAAI,MAAM,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC;AAC5D;;;;"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { POST_MESSAGE_EVENTS } from '@contentstack/studio-messenger/constants';
|
|
2
|
+
import { composableStudioEventManager } from '@contentstack/studio-messenger';
|
|
2
3
|
import { COMPOSABLE_STUDIO_EMITTED_EVENTS } from '../emitted-events/events.constant.js';
|
|
3
4
|
import { composableStudioEventEmitter } from '../emitted-events/event-emitter.js';
|
|
4
5
|
import { isInsideIframe } from '../utils/is-inside-iframe.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hidden-element-notification-event.js","sources":["../../src/hidden-element-notification/hidden-element-notification-event.ts"],"sourcesContent":[null],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"hidden-element-notification-event.js","sources":["../../src/hidden-element-notification/hidden-element-notification-event.ts"],"sourcesContent":[null],"names":[],"mappings":";;;;;;AAOM,SAAU,6BAA6B,CAAC,GAAW,EAAA;;IAEvD,IAAI,CAAC,cAAc,EAAE;QAAE;AAEvB,IAAA,MAAM,OAAO,GAAuC;AAClD,QAAA,MAAM,EAAE,MAAM;QACd,GAAG;KACJ;IACD,4BAA4B,EAAE,IAAI,CAChC,mBAAmB,CAAC,6BAA6B,EACjD,OAAO,CACR;AACH;AAEM,SAAU,8BAA8B,CAAC,GAAW,EAAA;;IAExD,IAAI,CAAC,cAAc,EAAE;QAAE;AAEvB,IAAA,MAAM,OAAO,GAAuC;AAClD,QAAA,MAAM,EAAE,OAAO;QACf,GAAG;KACJ;IACD,4BAA4B,EAAE,IAAI,CAChC,mBAAmB,CAAC,6BAA6B,EACjD,OAAO,CACR;AACH;SAEgB,qCAAqC,GAAA;IACnD,OAAO,4BAA4B,EAAE,EAAE,CACrC,mBAAmB,CAAC,6BAA6B,EACjD,CAAC,KAAK,KAAI;QACR,4BAA4B,CAAC,IAAI,CAC/B,gCAAgC,CAAC,2BAA2B,EAC5D,KAAK,CAAC,IAAI,CACX;AACH,IAAA,CAAC,CACF;AACH;;;;"}
|