@elementor/editor-canvas 4.2.0-888 → 4.2.0-894
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/index.d.mts +16 -5
- package/dist/index.d.ts +16 -5
- package/dist/index.js +57 -44
- package/dist/index.mjs +54 -44
- package/package.json +18 -18
- package/src/index.ts +3 -3
- package/src/legacy/create-nested-templated-element-type.ts +3 -3
- package/src/legacy/create-pro-promotion-nested-type.ts +1 -1
- package/src/legacy/types.ts +13 -4
- package/src/mcp/resources/breakpoints-resource.ts +3 -0
- package/src/mcp/resources/widgets-schema-resource.ts +5 -0
package/dist/index.d.mts
CHANGED
|
@@ -8,9 +8,12 @@ import * as React$1 from 'react';
|
|
|
8
8
|
import * as _elementor_utils from '@elementor/utils';
|
|
9
9
|
|
|
10
10
|
declare const BREAKPOINTS_SCHEMA_URI = "elementor://breakpoints/list";
|
|
11
|
+
declare const BREAKPOINTS_SCHEMA_FULL_URI = "editor-canvas_elementor://breakpoints/list";
|
|
11
12
|
|
|
12
13
|
declare const WIDGET_SCHEMA_URI = "elementor://widgets/schema/{widgetType}";
|
|
14
|
+
declare const WIDGET_SCHEMA_FULL_URI = "editor-canvas_elementor://widgets/schema/{widgetType}";
|
|
13
15
|
declare const STYLE_SCHEMA_URI = "elementor://styles/schema/{category}";
|
|
16
|
+
declare const STYLE_SCHEMA_FULL_URI = "editor-canvas_elementor://styles/schema/{category}";
|
|
14
17
|
|
|
15
18
|
declare function init(): void;
|
|
16
19
|
|
|
@@ -24,6 +27,11 @@ type DomRenderer = {
|
|
|
24
27
|
type RenderContext<T = unknown> = Record<string, T>;
|
|
25
28
|
type NamespacedRenderContext<T = RenderContext> = Record<string, T | undefined>;
|
|
26
29
|
type LegacyWindow = Window & {
|
|
30
|
+
elementorCommon?: {
|
|
31
|
+
helpers?: {
|
|
32
|
+
getUniqueId?: () => string;
|
|
33
|
+
};
|
|
34
|
+
};
|
|
27
35
|
jQuery: JQueryStatic;
|
|
28
36
|
elementor: {
|
|
29
37
|
config: {
|
|
@@ -73,9 +81,10 @@ declare class ElementType {
|
|
|
73
81
|
getType(): string;
|
|
74
82
|
getView(): typeof ElementView;
|
|
75
83
|
}
|
|
76
|
-
type MarionetteExtendable<
|
|
77
|
-
extend: <TExtended extends object>(properties: TExtended & ThisType<
|
|
84
|
+
type MarionetteExtendable<TInstance = unknown> = {
|
|
85
|
+
extend: <TExtended extends object>(properties: TExtended & ThisType<TInstance & TExtended>) => typeof ElementView & MarionetteExtendable<TInstance & TExtended>;
|
|
78
86
|
};
|
|
87
|
+
type NestedTemplatedElementViewClass = typeof ElementView & MarionetteExtendable<ElementView>;
|
|
79
88
|
declare class ElementView {
|
|
80
89
|
getChildType(): string[];
|
|
81
90
|
container: V1Element;
|
|
@@ -107,7 +116,7 @@ declare class ElementView {
|
|
|
107
116
|
renderOnChange(): void;
|
|
108
117
|
render(): void;
|
|
109
118
|
_renderTemplate(): void;
|
|
110
|
-
_renderChildren(): void
|
|
119
|
+
_renderChildren(): Promise<void>;
|
|
111
120
|
_beforeRender(): void;
|
|
112
121
|
_afterRender(): void;
|
|
113
122
|
attachBuffer(collectionView: this, buffer: DocumentFragment): void;
|
|
@@ -155,6 +164,8 @@ type BackboneModel<Model extends object> = {
|
|
|
155
164
|
get: <T extends keyof Model>(key: T) => Model[T];
|
|
156
165
|
set: <T extends keyof Model>(key: T, value: Model[T]) => void;
|
|
157
166
|
toJSON: () => ToJSON<Model>;
|
|
167
|
+
on: (event: string, callback: () => void) => void;
|
|
168
|
+
off: (event: string, callback: () => void) => void;
|
|
158
169
|
trigger: (event: string, ...args: unknown[]) => void;
|
|
159
170
|
};
|
|
160
171
|
type BackboneModelConstructor<Model extends object> = {
|
|
@@ -237,7 +248,7 @@ type CreateNestedTemplatedElementTypeOptions = {
|
|
|
237
248
|
declare function canBeNestedTemplated(element: Partial<NestedTemplatedElementConfig>): element is NestedTemplatedElementConfig;
|
|
238
249
|
declare function createNestedTemplatedElementType({ type, renderer, element, modelExtensions, }: CreateNestedTemplatedElementTypeOptions): typeof ElementType;
|
|
239
250
|
type CreateNestedTemplatedElementViewOptions = Omit<CreateNestedTemplatedElementTypeOptions, 'modelExtensions'>;
|
|
240
|
-
declare function createNestedTemplatedElementView({ type, renderer, element, }: CreateNestedTemplatedElementViewOptions):
|
|
251
|
+
declare function createNestedTemplatedElementView({ type, renderer, element, }: CreateNestedTemplatedElementViewOptions): NestedTemplatedElementViewClass;
|
|
241
252
|
|
|
242
253
|
type ElementLegacyType = {
|
|
243
254
|
[key: string]: (options: CreateTemplatedElementTypeOptions) => typeof ElementType;
|
|
@@ -381,4 +392,4 @@ declare function useEscapeOnCanvas(canvasDocument: Document | null | undefined,
|
|
|
381
392
|
|
|
382
393
|
declare function doAfterRender(elementIds: string[], callback: (elementIds: string[]) => void): void;
|
|
383
394
|
|
|
384
|
-
export { type AnyTransformer, BREAKPOINTS_SCHEMA_URI, type BackboneModel, type BackboneModelConstructor, type ContextMenuAction, type ContextMenuEventData, type CreateNestedTemplatedElementTypeOptions, type CreateTemplatedElementTypeOptions, DOCUMENT_STRUCTURE_URI, type ElementModel, ElementType, ElementView, GLOBAL_STYLES_IMPORTED_EVENT, type ImportedGlobalStylesPayload, type LegacyWindow, type NamespacedRenderContext, type NestedTemplatedElementConfig, type PropsResolver, type RenderContext, type ReplacementSettings, STYLE_SCHEMA_URI, SpotlightBackdrop, TemplatedElementView, type TransformerOptions, UnknownStyleStateError, UnknownStyleTypeError, WIDGET_SCHEMA_URI, canBeNestedTemplated, createNestedTemplatedElementType, createNestedTemplatedElementView, createPropsResolver, createTemplatedElementView, createTransformer, createTransformersRegistry, doAfterRender, endDragElementFromPanel, formatGridTrackRepeat, init, isAtomicWidget, isGridTrackProperty, registerElementType, registerModelExtensions, settingsTransformersRegistry, startDragElementFromPanel, styleTransformersRegistry, stylesInheritanceTransformersRegistry, useCanvasDocument, useEscapeOnCanvas, waitForChildrenToComplete };
|
|
395
|
+
export { type AnyTransformer, BREAKPOINTS_SCHEMA_FULL_URI, BREAKPOINTS_SCHEMA_URI, type BackboneModel, type BackboneModelConstructor, type ContextMenuAction, type ContextMenuEventData, type CreateNestedTemplatedElementTypeOptions, type CreateTemplatedElementTypeOptions, DOCUMENT_STRUCTURE_URI, type ElementModel, ElementType, ElementView, GLOBAL_STYLES_IMPORTED_EVENT, type ImportedGlobalStylesPayload, type LegacyWindow, type MarionetteExtendable, type NamespacedRenderContext, type NestedTemplatedElementConfig, type NestedTemplatedElementViewClass, type PropsResolver, type RenderContext, type ReplacementSettings, STYLE_SCHEMA_FULL_URI, STYLE_SCHEMA_URI, SpotlightBackdrop, TemplatedElementView, type TransformerOptions, UnknownStyleStateError, UnknownStyleTypeError, WIDGET_SCHEMA_FULL_URI, WIDGET_SCHEMA_URI, canBeNestedTemplated, createNestedTemplatedElementType, createNestedTemplatedElementView, createPropsResolver, createTemplatedElementView, createTransformer, createTransformersRegistry, doAfterRender, endDragElementFromPanel, formatGridTrackRepeat, init, isAtomicWidget, isGridTrackProperty, registerElementType, registerModelExtensions, settingsTransformersRegistry, startDragElementFromPanel, styleTransformersRegistry, stylesInheritanceTransformersRegistry, useCanvasDocument, useEscapeOnCanvas, waitForChildrenToComplete };
|
package/dist/index.d.ts
CHANGED
|
@@ -8,9 +8,12 @@ import * as React$1 from 'react';
|
|
|
8
8
|
import * as _elementor_utils from '@elementor/utils';
|
|
9
9
|
|
|
10
10
|
declare const BREAKPOINTS_SCHEMA_URI = "elementor://breakpoints/list";
|
|
11
|
+
declare const BREAKPOINTS_SCHEMA_FULL_URI = "editor-canvas_elementor://breakpoints/list";
|
|
11
12
|
|
|
12
13
|
declare const WIDGET_SCHEMA_URI = "elementor://widgets/schema/{widgetType}";
|
|
14
|
+
declare const WIDGET_SCHEMA_FULL_URI = "editor-canvas_elementor://widgets/schema/{widgetType}";
|
|
13
15
|
declare const STYLE_SCHEMA_URI = "elementor://styles/schema/{category}";
|
|
16
|
+
declare const STYLE_SCHEMA_FULL_URI = "editor-canvas_elementor://styles/schema/{category}";
|
|
14
17
|
|
|
15
18
|
declare function init(): void;
|
|
16
19
|
|
|
@@ -24,6 +27,11 @@ type DomRenderer = {
|
|
|
24
27
|
type RenderContext<T = unknown> = Record<string, T>;
|
|
25
28
|
type NamespacedRenderContext<T = RenderContext> = Record<string, T | undefined>;
|
|
26
29
|
type LegacyWindow = Window & {
|
|
30
|
+
elementorCommon?: {
|
|
31
|
+
helpers?: {
|
|
32
|
+
getUniqueId?: () => string;
|
|
33
|
+
};
|
|
34
|
+
};
|
|
27
35
|
jQuery: JQueryStatic;
|
|
28
36
|
elementor: {
|
|
29
37
|
config: {
|
|
@@ -73,9 +81,10 @@ declare class ElementType {
|
|
|
73
81
|
getType(): string;
|
|
74
82
|
getView(): typeof ElementView;
|
|
75
83
|
}
|
|
76
|
-
type MarionetteExtendable<
|
|
77
|
-
extend: <TExtended extends object>(properties: TExtended & ThisType<
|
|
84
|
+
type MarionetteExtendable<TInstance = unknown> = {
|
|
85
|
+
extend: <TExtended extends object>(properties: TExtended & ThisType<TInstance & TExtended>) => typeof ElementView & MarionetteExtendable<TInstance & TExtended>;
|
|
78
86
|
};
|
|
87
|
+
type NestedTemplatedElementViewClass = typeof ElementView & MarionetteExtendable<ElementView>;
|
|
79
88
|
declare class ElementView {
|
|
80
89
|
getChildType(): string[];
|
|
81
90
|
container: V1Element;
|
|
@@ -107,7 +116,7 @@ declare class ElementView {
|
|
|
107
116
|
renderOnChange(): void;
|
|
108
117
|
render(): void;
|
|
109
118
|
_renderTemplate(): void;
|
|
110
|
-
_renderChildren(): void
|
|
119
|
+
_renderChildren(): Promise<void>;
|
|
111
120
|
_beforeRender(): void;
|
|
112
121
|
_afterRender(): void;
|
|
113
122
|
attachBuffer(collectionView: this, buffer: DocumentFragment): void;
|
|
@@ -155,6 +164,8 @@ type BackboneModel<Model extends object> = {
|
|
|
155
164
|
get: <T extends keyof Model>(key: T) => Model[T];
|
|
156
165
|
set: <T extends keyof Model>(key: T, value: Model[T]) => void;
|
|
157
166
|
toJSON: () => ToJSON<Model>;
|
|
167
|
+
on: (event: string, callback: () => void) => void;
|
|
168
|
+
off: (event: string, callback: () => void) => void;
|
|
158
169
|
trigger: (event: string, ...args: unknown[]) => void;
|
|
159
170
|
};
|
|
160
171
|
type BackboneModelConstructor<Model extends object> = {
|
|
@@ -237,7 +248,7 @@ type CreateNestedTemplatedElementTypeOptions = {
|
|
|
237
248
|
declare function canBeNestedTemplated(element: Partial<NestedTemplatedElementConfig>): element is NestedTemplatedElementConfig;
|
|
238
249
|
declare function createNestedTemplatedElementType({ type, renderer, element, modelExtensions, }: CreateNestedTemplatedElementTypeOptions): typeof ElementType;
|
|
239
250
|
type CreateNestedTemplatedElementViewOptions = Omit<CreateNestedTemplatedElementTypeOptions, 'modelExtensions'>;
|
|
240
|
-
declare function createNestedTemplatedElementView({ type, renderer, element, }: CreateNestedTemplatedElementViewOptions):
|
|
251
|
+
declare function createNestedTemplatedElementView({ type, renderer, element, }: CreateNestedTemplatedElementViewOptions): NestedTemplatedElementViewClass;
|
|
241
252
|
|
|
242
253
|
type ElementLegacyType = {
|
|
243
254
|
[key: string]: (options: CreateTemplatedElementTypeOptions) => typeof ElementType;
|
|
@@ -381,4 +392,4 @@ declare function useEscapeOnCanvas(canvasDocument: Document | null | undefined,
|
|
|
381
392
|
|
|
382
393
|
declare function doAfterRender(elementIds: string[], callback: (elementIds: string[]) => void): void;
|
|
383
394
|
|
|
384
|
-
export { type AnyTransformer, BREAKPOINTS_SCHEMA_URI, type BackboneModel, type BackboneModelConstructor, type ContextMenuAction, type ContextMenuEventData, type CreateNestedTemplatedElementTypeOptions, type CreateTemplatedElementTypeOptions, DOCUMENT_STRUCTURE_URI, type ElementModel, ElementType, ElementView, GLOBAL_STYLES_IMPORTED_EVENT, type ImportedGlobalStylesPayload, type LegacyWindow, type NamespacedRenderContext, type NestedTemplatedElementConfig, type PropsResolver, type RenderContext, type ReplacementSettings, STYLE_SCHEMA_URI, SpotlightBackdrop, TemplatedElementView, type TransformerOptions, UnknownStyleStateError, UnknownStyleTypeError, WIDGET_SCHEMA_URI, canBeNestedTemplated, createNestedTemplatedElementType, createNestedTemplatedElementView, createPropsResolver, createTemplatedElementView, createTransformer, createTransformersRegistry, doAfterRender, endDragElementFromPanel, formatGridTrackRepeat, init, isAtomicWidget, isGridTrackProperty, registerElementType, registerModelExtensions, settingsTransformersRegistry, startDragElementFromPanel, styleTransformersRegistry, stylesInheritanceTransformersRegistry, useCanvasDocument, useEscapeOnCanvas, waitForChildrenToComplete };
|
|
395
|
+
export { type AnyTransformer, BREAKPOINTS_SCHEMA_FULL_URI, BREAKPOINTS_SCHEMA_URI, type BackboneModel, type BackboneModelConstructor, type ContextMenuAction, type ContextMenuEventData, type CreateNestedTemplatedElementTypeOptions, type CreateTemplatedElementTypeOptions, DOCUMENT_STRUCTURE_URI, type ElementModel, ElementType, ElementView, GLOBAL_STYLES_IMPORTED_EVENT, type ImportedGlobalStylesPayload, type LegacyWindow, type MarionetteExtendable, type NamespacedRenderContext, type NestedTemplatedElementConfig, type NestedTemplatedElementViewClass, type PropsResolver, type RenderContext, type ReplacementSettings, STYLE_SCHEMA_FULL_URI, STYLE_SCHEMA_URI, SpotlightBackdrop, TemplatedElementView, type TransformerOptions, UnknownStyleStateError, UnknownStyleTypeError, WIDGET_SCHEMA_FULL_URI, WIDGET_SCHEMA_URI, canBeNestedTemplated, createNestedTemplatedElementType, createNestedTemplatedElementView, createPropsResolver, createTemplatedElementView, createTransformer, createTransformersRegistry, doAfterRender, endDragElementFromPanel, formatGridTrackRepeat, init, isAtomicWidget, isGridTrackProperty, registerElementType, registerModelExtensions, settingsTransformersRegistry, startDragElementFromPanel, styleTransformersRegistry, stylesInheritanceTransformersRegistry, useCanvasDocument, useEscapeOnCanvas, waitForChildrenToComplete };
|
package/dist/index.js
CHANGED
|
@@ -30,13 +30,16 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
30
30
|
// src/index.ts
|
|
31
31
|
var index_exports = {};
|
|
32
32
|
__export(index_exports, {
|
|
33
|
+
BREAKPOINTS_SCHEMA_FULL_URI: () => BREAKPOINTS_SCHEMA_FULL_URI,
|
|
33
34
|
BREAKPOINTS_SCHEMA_URI: () => BREAKPOINTS_SCHEMA_URI,
|
|
34
35
|
DOCUMENT_STRUCTURE_URI: () => DOCUMENT_STRUCTURE_URI,
|
|
35
36
|
GLOBAL_STYLES_IMPORTED_EVENT: () => GLOBAL_STYLES_IMPORTED_EVENT,
|
|
37
|
+
STYLE_SCHEMA_FULL_URI: () => STYLE_SCHEMA_FULL_URI,
|
|
36
38
|
STYLE_SCHEMA_URI: () => STYLE_SCHEMA_URI,
|
|
37
39
|
SpotlightBackdrop: () => SpotlightBackdrop,
|
|
38
40
|
UnknownStyleStateError: () => UnknownStyleStateError,
|
|
39
41
|
UnknownStyleTypeError: () => UnknownStyleTypeError,
|
|
42
|
+
WIDGET_SCHEMA_FULL_URI: () => WIDGET_SCHEMA_FULL_URI,
|
|
40
43
|
WIDGET_SCHEMA_URI: () => WIDGET_SCHEMA_URI,
|
|
41
44
|
canBeNestedTemplated: () => canBeNestedTemplated,
|
|
42
45
|
createNestedTemplatedElementType: () => createNestedTemplatedElementType,
|
|
@@ -65,49 +68,6 @@ module.exports = __toCommonJS(index_exports);
|
|
|
65
68
|
|
|
66
69
|
// src/mcp/resources/breakpoints-resource.ts
|
|
67
70
|
var import_editor_v1_adapters = require("@elementor/editor-v1-adapters");
|
|
68
|
-
var BREAKPOINTS_SCHEMA_URI = "elementor://breakpoints/list";
|
|
69
|
-
var initBreakpointsResource = (reg) => {
|
|
70
|
-
const { resource, sendResourceUpdated } = reg;
|
|
71
|
-
const getBreakpointsList = () => {
|
|
72
|
-
const { breakpoints } = window.elementor?.config?.responsive || {};
|
|
73
|
-
if (!breakpoints) {
|
|
74
|
-
return [];
|
|
75
|
-
}
|
|
76
|
-
return Object.values(breakpoints).filter((bp) => bp.is_enabled).map((bp) => {
|
|
77
|
-
const { direction: constraint, label, value } = bp;
|
|
78
|
-
return {
|
|
79
|
-
label,
|
|
80
|
-
constraint,
|
|
81
|
-
value
|
|
82
|
-
};
|
|
83
|
-
});
|
|
84
|
-
};
|
|
85
|
-
const buildResourceResponse = () => ({
|
|
86
|
-
contents: [
|
|
87
|
-
{
|
|
88
|
-
uri: BREAKPOINTS_SCHEMA_URI,
|
|
89
|
-
mimeType: "application/json",
|
|
90
|
-
text: JSON.stringify(getBreakpointsList())
|
|
91
|
-
}
|
|
92
|
-
]
|
|
93
|
-
});
|
|
94
|
-
resource(
|
|
95
|
-
"breakpoints ",
|
|
96
|
-
BREAKPOINTS_SCHEMA_URI,
|
|
97
|
-
{
|
|
98
|
-
description: "Breakpoints list."
|
|
99
|
-
},
|
|
100
|
-
() => {
|
|
101
|
-
return buildResourceResponse();
|
|
102
|
-
}
|
|
103
|
-
);
|
|
104
|
-
window.addEventListener((0, import_editor_v1_adapters.v1ReadyEvent)().name, () => {
|
|
105
|
-
sendResourceUpdated({
|
|
106
|
-
uri: BREAKPOINTS_SCHEMA_URI,
|
|
107
|
-
...buildResourceResponse()
|
|
108
|
-
});
|
|
109
|
-
});
|
|
110
|
-
};
|
|
111
71
|
|
|
112
72
|
// src/mcp/resources/widgets-schema-resource.ts
|
|
113
73
|
var import_editor_elements2 = require("@elementor/editor-elements");
|
|
@@ -198,9 +158,13 @@ function extractV3ControlsMetadata(controls) {
|
|
|
198
158
|
}
|
|
199
159
|
return result;
|
|
200
160
|
}
|
|
161
|
+
var CANVAS_SERVER_NAME = "editor-canvas";
|
|
201
162
|
var WIDGET_SCHEMA_URI = "elementor://widgets/schema/{widgetType}";
|
|
163
|
+
var WIDGET_SCHEMA_FULL_URI = `${CANVAS_SERVER_NAME}_${WIDGET_SCHEMA_URI}`;
|
|
202
164
|
var STYLE_SCHEMA_URI = "elementor://styles/schema/{category}";
|
|
165
|
+
var STYLE_SCHEMA_FULL_URI = `${CANVAS_SERVER_NAME}_${STYLE_SCHEMA_URI}`;
|
|
203
166
|
var BEST_PRACTICES_URI = "elementor://styles/best-practices";
|
|
167
|
+
var BEST_PRACTICES_FULL_URI = `${CANVAS_SERVER_NAME}_${BEST_PRACTICES_URI}`;
|
|
204
168
|
var initWidgetsSchemaResource = (reg) => {
|
|
205
169
|
const { resource } = reg;
|
|
206
170
|
resource(
|
|
@@ -365,6 +329,52 @@ Variables from the user context ARE NOT SUPPORTED AND WILL RESOLVE IN ERROR.
|
|
|
365
329
|
);
|
|
366
330
|
};
|
|
367
331
|
|
|
332
|
+
// src/mcp/resources/breakpoints-resource.ts
|
|
333
|
+
var BREAKPOINTS_SCHEMA_URI = "elementor://breakpoints/list";
|
|
334
|
+
var BREAKPOINTS_SCHEMA_FULL_URI = `${CANVAS_SERVER_NAME}_${BREAKPOINTS_SCHEMA_URI}`;
|
|
335
|
+
var initBreakpointsResource = (reg) => {
|
|
336
|
+
const { resource, sendResourceUpdated } = reg;
|
|
337
|
+
const getBreakpointsList = () => {
|
|
338
|
+
const { breakpoints } = window.elementor?.config?.responsive || {};
|
|
339
|
+
if (!breakpoints) {
|
|
340
|
+
return [];
|
|
341
|
+
}
|
|
342
|
+
return Object.values(breakpoints).filter((bp) => bp.is_enabled).map((bp) => {
|
|
343
|
+
const { direction: constraint, label, value } = bp;
|
|
344
|
+
return {
|
|
345
|
+
label,
|
|
346
|
+
constraint,
|
|
347
|
+
value
|
|
348
|
+
};
|
|
349
|
+
});
|
|
350
|
+
};
|
|
351
|
+
const buildResourceResponse = () => ({
|
|
352
|
+
contents: [
|
|
353
|
+
{
|
|
354
|
+
uri: BREAKPOINTS_SCHEMA_URI,
|
|
355
|
+
mimeType: "application/json",
|
|
356
|
+
text: JSON.stringify(getBreakpointsList())
|
|
357
|
+
}
|
|
358
|
+
]
|
|
359
|
+
});
|
|
360
|
+
resource(
|
|
361
|
+
"breakpoints ",
|
|
362
|
+
BREAKPOINTS_SCHEMA_URI,
|
|
363
|
+
{
|
|
364
|
+
description: "Breakpoints list."
|
|
365
|
+
},
|
|
366
|
+
() => {
|
|
367
|
+
return buildResourceResponse();
|
|
368
|
+
}
|
|
369
|
+
);
|
|
370
|
+
window.addEventListener((0, import_editor_v1_adapters.v1ReadyEvent)().name, () => {
|
|
371
|
+
sendResourceUpdated({
|
|
372
|
+
uri: BREAKPOINTS_SCHEMA_URI,
|
|
373
|
+
...buildResourceResponse()
|
|
374
|
+
});
|
|
375
|
+
});
|
|
376
|
+
};
|
|
377
|
+
|
|
368
378
|
// src/init.tsx
|
|
369
379
|
var import_editor = require("@elementor/editor");
|
|
370
380
|
var import_editor_mcp4 = require("@elementor/editor-mcp");
|
|
@@ -2724,7 +2734,7 @@ function createPromotionView(BaseView) {
|
|
|
2724
2734
|
e.stopPropagation();
|
|
2725
2735
|
});
|
|
2726
2736
|
}
|
|
2727
|
-
_renderChildren() {
|
|
2737
|
+
async _renderChildren() {
|
|
2728
2738
|
}
|
|
2729
2739
|
behaviors() {
|
|
2730
2740
|
const disabledBehaviors = ["InlineEditing", "Draggable", "Resizable"];
|
|
@@ -5828,13 +5838,16 @@ function hasDoAfterRender(view) {
|
|
|
5828
5838
|
}
|
|
5829
5839
|
// Annotate the CommonJS export names for ESM import in node:
|
|
5830
5840
|
0 && (module.exports = {
|
|
5841
|
+
BREAKPOINTS_SCHEMA_FULL_URI,
|
|
5831
5842
|
BREAKPOINTS_SCHEMA_URI,
|
|
5832
5843
|
DOCUMENT_STRUCTURE_URI,
|
|
5833
5844
|
GLOBAL_STYLES_IMPORTED_EVENT,
|
|
5845
|
+
STYLE_SCHEMA_FULL_URI,
|
|
5834
5846
|
STYLE_SCHEMA_URI,
|
|
5835
5847
|
SpotlightBackdrop,
|
|
5836
5848
|
UnknownStyleStateError,
|
|
5837
5849
|
UnknownStyleTypeError,
|
|
5850
|
+
WIDGET_SCHEMA_FULL_URI,
|
|
5838
5851
|
WIDGET_SCHEMA_URI,
|
|
5839
5852
|
canBeNestedTemplated,
|
|
5840
5853
|
createNestedTemplatedElementType,
|
package/dist/index.mjs
CHANGED
|
@@ -1,48 +1,5 @@
|
|
|
1
1
|
// src/mcp/resources/breakpoints-resource.ts
|
|
2
2
|
import { v1ReadyEvent } from "@elementor/editor-v1-adapters";
|
|
3
|
-
var BREAKPOINTS_SCHEMA_URI = "elementor://breakpoints/list";
|
|
4
|
-
var initBreakpointsResource = (reg) => {
|
|
5
|
-
const { resource, sendResourceUpdated } = reg;
|
|
6
|
-
const getBreakpointsList = () => {
|
|
7
|
-
const { breakpoints } = window.elementor?.config?.responsive || {};
|
|
8
|
-
if (!breakpoints) {
|
|
9
|
-
return [];
|
|
10
|
-
}
|
|
11
|
-
return Object.values(breakpoints).filter((bp) => bp.is_enabled).map((bp) => {
|
|
12
|
-
const { direction: constraint, label, value } = bp;
|
|
13
|
-
return {
|
|
14
|
-
label,
|
|
15
|
-
constraint,
|
|
16
|
-
value
|
|
17
|
-
};
|
|
18
|
-
});
|
|
19
|
-
};
|
|
20
|
-
const buildResourceResponse = () => ({
|
|
21
|
-
contents: [
|
|
22
|
-
{
|
|
23
|
-
uri: BREAKPOINTS_SCHEMA_URI,
|
|
24
|
-
mimeType: "application/json",
|
|
25
|
-
text: JSON.stringify(getBreakpointsList())
|
|
26
|
-
}
|
|
27
|
-
]
|
|
28
|
-
});
|
|
29
|
-
resource(
|
|
30
|
-
"breakpoints ",
|
|
31
|
-
BREAKPOINTS_SCHEMA_URI,
|
|
32
|
-
{
|
|
33
|
-
description: "Breakpoints list."
|
|
34
|
-
},
|
|
35
|
-
() => {
|
|
36
|
-
return buildResourceResponse();
|
|
37
|
-
}
|
|
38
|
-
);
|
|
39
|
-
window.addEventListener(v1ReadyEvent().name, () => {
|
|
40
|
-
sendResourceUpdated({
|
|
41
|
-
uri: BREAKPOINTS_SCHEMA_URI,
|
|
42
|
-
...buildResourceResponse()
|
|
43
|
-
});
|
|
44
|
-
});
|
|
45
|
-
};
|
|
46
3
|
|
|
47
4
|
// src/mcp/resources/widgets-schema-resource.ts
|
|
48
5
|
import { getWidgetsCache as getWidgetsCache2 } from "@elementor/editor-elements";
|
|
@@ -135,9 +92,13 @@ function extractV3ControlsMetadata(controls) {
|
|
|
135
92
|
}
|
|
136
93
|
return result;
|
|
137
94
|
}
|
|
95
|
+
var CANVAS_SERVER_NAME = "editor-canvas";
|
|
138
96
|
var WIDGET_SCHEMA_URI = "elementor://widgets/schema/{widgetType}";
|
|
97
|
+
var WIDGET_SCHEMA_FULL_URI = `${CANVAS_SERVER_NAME}_${WIDGET_SCHEMA_URI}`;
|
|
139
98
|
var STYLE_SCHEMA_URI = "elementor://styles/schema/{category}";
|
|
99
|
+
var STYLE_SCHEMA_FULL_URI = `${CANVAS_SERVER_NAME}_${STYLE_SCHEMA_URI}`;
|
|
140
100
|
var BEST_PRACTICES_URI = "elementor://styles/best-practices";
|
|
101
|
+
var BEST_PRACTICES_FULL_URI = `${CANVAS_SERVER_NAME}_${BEST_PRACTICES_URI}`;
|
|
141
102
|
var initWidgetsSchemaResource = (reg) => {
|
|
142
103
|
const { resource } = reg;
|
|
143
104
|
resource(
|
|
@@ -302,6 +263,52 @@ Variables from the user context ARE NOT SUPPORTED AND WILL RESOLVE IN ERROR.
|
|
|
302
263
|
);
|
|
303
264
|
};
|
|
304
265
|
|
|
266
|
+
// src/mcp/resources/breakpoints-resource.ts
|
|
267
|
+
var BREAKPOINTS_SCHEMA_URI = "elementor://breakpoints/list";
|
|
268
|
+
var BREAKPOINTS_SCHEMA_FULL_URI = `${CANVAS_SERVER_NAME}_${BREAKPOINTS_SCHEMA_URI}`;
|
|
269
|
+
var initBreakpointsResource = (reg) => {
|
|
270
|
+
const { resource, sendResourceUpdated } = reg;
|
|
271
|
+
const getBreakpointsList = () => {
|
|
272
|
+
const { breakpoints } = window.elementor?.config?.responsive || {};
|
|
273
|
+
if (!breakpoints) {
|
|
274
|
+
return [];
|
|
275
|
+
}
|
|
276
|
+
return Object.values(breakpoints).filter((bp) => bp.is_enabled).map((bp) => {
|
|
277
|
+
const { direction: constraint, label, value } = bp;
|
|
278
|
+
return {
|
|
279
|
+
label,
|
|
280
|
+
constraint,
|
|
281
|
+
value
|
|
282
|
+
};
|
|
283
|
+
});
|
|
284
|
+
};
|
|
285
|
+
const buildResourceResponse = () => ({
|
|
286
|
+
contents: [
|
|
287
|
+
{
|
|
288
|
+
uri: BREAKPOINTS_SCHEMA_URI,
|
|
289
|
+
mimeType: "application/json",
|
|
290
|
+
text: JSON.stringify(getBreakpointsList())
|
|
291
|
+
}
|
|
292
|
+
]
|
|
293
|
+
});
|
|
294
|
+
resource(
|
|
295
|
+
"breakpoints ",
|
|
296
|
+
BREAKPOINTS_SCHEMA_URI,
|
|
297
|
+
{
|
|
298
|
+
description: "Breakpoints list."
|
|
299
|
+
},
|
|
300
|
+
() => {
|
|
301
|
+
return buildResourceResponse();
|
|
302
|
+
}
|
|
303
|
+
);
|
|
304
|
+
window.addEventListener(v1ReadyEvent().name, () => {
|
|
305
|
+
sendResourceUpdated({
|
|
306
|
+
uri: BREAKPOINTS_SCHEMA_URI,
|
|
307
|
+
...buildResourceResponse()
|
|
308
|
+
});
|
|
309
|
+
});
|
|
310
|
+
};
|
|
311
|
+
|
|
305
312
|
// src/init.tsx
|
|
306
313
|
import { injectIntoLogic, injectIntoTop } from "@elementor/editor";
|
|
307
314
|
import { getMCPByDomain } from "@elementor/editor-mcp";
|
|
@@ -2687,7 +2694,7 @@ function createPromotionView(BaseView) {
|
|
|
2687
2694
|
e.stopPropagation();
|
|
2688
2695
|
});
|
|
2689
2696
|
}
|
|
2690
|
-
_renderChildren() {
|
|
2697
|
+
async _renderChildren() {
|
|
2691
2698
|
}
|
|
2692
2699
|
behaviors() {
|
|
2693
2700
|
const disabledBehaviors = ["InlineEditing", "Draggable", "Resizable"];
|
|
@@ -5837,13 +5844,16 @@ function hasDoAfterRender(view) {
|
|
|
5837
5844
|
return typeof view?._doAfterRender === "function";
|
|
5838
5845
|
}
|
|
5839
5846
|
export {
|
|
5847
|
+
BREAKPOINTS_SCHEMA_FULL_URI,
|
|
5840
5848
|
BREAKPOINTS_SCHEMA_URI,
|
|
5841
5849
|
DOCUMENT_STRUCTURE_URI,
|
|
5842
5850
|
GLOBAL_STYLES_IMPORTED_EVENT,
|
|
5851
|
+
STYLE_SCHEMA_FULL_URI,
|
|
5843
5852
|
STYLE_SCHEMA_URI,
|
|
5844
5853
|
SpotlightBackdrop,
|
|
5845
5854
|
UnknownStyleStateError,
|
|
5846
5855
|
UnknownStyleTypeError,
|
|
5856
|
+
WIDGET_SCHEMA_FULL_URI,
|
|
5847
5857
|
WIDGET_SCHEMA_URI,
|
|
5848
5858
|
canBeNestedTemplated,
|
|
5849
5859
|
createNestedTemplatedElementType,
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@elementor/editor-canvas",
|
|
3
3
|
"description": "Elementor Editor Canvas",
|
|
4
|
-
"version": "4.2.0-
|
|
4
|
+
"version": "4.2.0-894",
|
|
5
5
|
"private": false,
|
|
6
6
|
"author": "Elementor Team",
|
|
7
7
|
"homepage": "https://elementor.com/",
|
|
@@ -37,25 +37,25 @@
|
|
|
37
37
|
"react-dom": "^18.3.1"
|
|
38
38
|
},
|
|
39
39
|
"dependencies": {
|
|
40
|
-
"@elementor/editor": "4.2.0-
|
|
40
|
+
"@elementor/editor": "4.2.0-894",
|
|
41
41
|
"dompurify": "^3.2.6",
|
|
42
|
-
"@elementor/editor-controls": "4.2.0-
|
|
43
|
-
"@elementor/editor-documents": "4.2.0-
|
|
44
|
-
"@elementor/editor-elements": "4.2.0-
|
|
45
|
-
"@elementor/editor-interactions": "4.2.0-
|
|
46
|
-
"@elementor/editor-mcp": "4.2.0-
|
|
47
|
-
"@elementor/editor-notifications": "4.2.0-
|
|
48
|
-
"@elementor/editor-props": "4.2.0-
|
|
49
|
-
"@elementor/editor-responsive": "4.2.0-
|
|
50
|
-
"@elementor/editor-styles": "4.2.0-
|
|
51
|
-
"@elementor/editor-styles-repository": "4.2.0-
|
|
52
|
-
"@elementor/editor-ui": "4.2.0-
|
|
53
|
-
"@elementor/editor-v1-adapters": "4.2.0-
|
|
54
|
-
"@elementor/schema": "4.2.0-
|
|
55
|
-
"@elementor/twing": "4.2.0-
|
|
42
|
+
"@elementor/editor-controls": "4.2.0-894",
|
|
43
|
+
"@elementor/editor-documents": "4.2.0-894",
|
|
44
|
+
"@elementor/editor-elements": "4.2.0-894",
|
|
45
|
+
"@elementor/editor-interactions": "4.2.0-894",
|
|
46
|
+
"@elementor/editor-mcp": "4.2.0-894",
|
|
47
|
+
"@elementor/editor-notifications": "4.2.0-894",
|
|
48
|
+
"@elementor/editor-props": "4.2.0-894",
|
|
49
|
+
"@elementor/editor-responsive": "4.2.0-894",
|
|
50
|
+
"@elementor/editor-styles": "4.2.0-894",
|
|
51
|
+
"@elementor/editor-styles-repository": "4.2.0-894",
|
|
52
|
+
"@elementor/editor-ui": "4.2.0-894",
|
|
53
|
+
"@elementor/editor-v1-adapters": "4.2.0-894",
|
|
54
|
+
"@elementor/schema": "4.2.0-894",
|
|
55
|
+
"@elementor/twing": "4.2.0-894",
|
|
56
56
|
"@elementor/ui": "1.37.5",
|
|
57
|
-
"@elementor/utils": "4.2.0-
|
|
58
|
-
"@elementor/wp-media": "4.2.0-
|
|
57
|
+
"@elementor/utils": "4.2.0-894",
|
|
58
|
+
"@elementor/wp-media": "4.2.0-894",
|
|
59
59
|
"@floating-ui/react": "^0.27.5",
|
|
60
60
|
"@wordpress/i18n": "^5.13.0"
|
|
61
61
|
},
|
package/src/index.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export { BREAKPOINTS_SCHEMA_URI } from './mcp/resources/breakpoints-resource';
|
|
2
|
-
export { STYLE_SCHEMA_URI } from './mcp/resources/widgets-schema-resource';
|
|
1
|
+
export { BREAKPOINTS_SCHEMA_URI, BREAKPOINTS_SCHEMA_FULL_URI } from './mcp/resources/breakpoints-resource';
|
|
2
|
+
export { STYLE_SCHEMA_URI, STYLE_SCHEMA_FULL_URI } from './mcp/resources/widgets-schema-resource';
|
|
3
3
|
|
|
4
4
|
export { init } from './init';
|
|
5
5
|
export { isAtomicWidget } from './utils/command-utils';
|
|
@@ -24,7 +24,7 @@ export { styleTransformersRegistry } from './style-transformers-registry';
|
|
|
24
24
|
export { endDragElementFromPanel, startDragElementFromPanel } from './sync/drag-element-from-panel';
|
|
25
25
|
export { GLOBAL_STYLES_IMPORTED_EVENT, type ImportedGlobalStylesPayload } from './sync/global-styles-imported-event';
|
|
26
26
|
export { DOCUMENT_STRUCTURE_URI } from './mcp/resources/document-structure-resource';
|
|
27
|
-
export { WIDGET_SCHEMA_URI } from './mcp/resources/widgets-schema-resource';
|
|
27
|
+
export { WIDGET_SCHEMA_URI, WIDGET_SCHEMA_FULL_URI } from './mcp/resources/widgets-schema-resource';
|
|
28
28
|
export * from './legacy/types';
|
|
29
29
|
export { SpotlightBackdrop } from './components/spotlight-backdrop';
|
|
30
30
|
export { createTransformer } from './transformers/create-transformer';
|
|
@@ -11,7 +11,7 @@ import {
|
|
|
11
11
|
setupTwigRenderer,
|
|
12
12
|
waitForChildrenToComplete,
|
|
13
13
|
} from './twig-rendering-utils';
|
|
14
|
-
import { type ElementType, type ElementView, type LegacyWindow } from './types';
|
|
14
|
+
import { type ElementType, type ElementView, type LegacyWindow, type NestedTemplatedElementViewClass } from './types';
|
|
15
15
|
|
|
16
16
|
export type NestedTemplatedElementConfig = TemplatedElementConfig & {
|
|
17
17
|
allowed_child_types?: string[];
|
|
@@ -90,7 +90,7 @@ export function createNestedTemplatedElementView( {
|
|
|
90
90
|
type,
|
|
91
91
|
renderer,
|
|
92
92
|
element,
|
|
93
|
-
}: CreateNestedTemplatedElementViewOptions ):
|
|
93
|
+
}: CreateNestedTemplatedElementViewOptions ): NestedTemplatedElementViewClass {
|
|
94
94
|
const legacyWindow = window as unknown as LegacyWindow;
|
|
95
95
|
|
|
96
96
|
const { templateKey, baseStylesDictionary, resolveProps } = setupTwigRenderer( {
|
|
@@ -396,5 +396,5 @@ export function createNestedTemplatedElementView( {
|
|
|
396
396
|
|
|
397
397
|
return originId ?? id;
|
|
398
398
|
},
|
|
399
|
-
} ) as
|
|
399
|
+
} ) as NestedTemplatedElementViewClass;
|
|
400
400
|
}
|
package/src/legacy/types.ts
CHANGED
|
@@ -7,6 +7,11 @@ export type RenderContext< T = unknown > = Record< string, T >;
|
|
|
7
7
|
export type NamespacedRenderContext< T = RenderContext > = Record< string, T | undefined >;
|
|
8
8
|
|
|
9
9
|
export type LegacyWindow = Window & {
|
|
10
|
+
elementorCommon?: {
|
|
11
|
+
helpers?: {
|
|
12
|
+
getUniqueId?: () => string;
|
|
13
|
+
};
|
|
14
|
+
};
|
|
10
15
|
jQuery: JQueryStatic;
|
|
11
16
|
elementor: {
|
|
12
17
|
config: {
|
|
@@ -62,12 +67,14 @@ export declare class ElementType {
|
|
|
62
67
|
getView(): typeof ElementView;
|
|
63
68
|
}
|
|
64
69
|
|
|
65
|
-
type MarionetteExtendable<
|
|
70
|
+
export type MarionetteExtendable< TInstance = unknown > = {
|
|
66
71
|
extend: < TExtended extends object >(
|
|
67
|
-
properties: TExtended & ThisType<
|
|
68
|
-
) =>
|
|
72
|
+
properties: TExtended & ThisType< TInstance & TExtended >
|
|
73
|
+
) => typeof ElementView & MarionetteExtendable< TInstance & TExtended >;
|
|
69
74
|
};
|
|
70
75
|
|
|
76
|
+
export type NestedTemplatedElementViewClass = typeof ElementView & MarionetteExtendable< ElementView >;
|
|
77
|
+
|
|
71
78
|
export declare class ElementView {
|
|
72
79
|
getChildType(): string[];
|
|
73
80
|
|
|
@@ -120,7 +127,7 @@ export declare class ElementView {
|
|
|
120
127
|
|
|
121
128
|
_renderTemplate(): void;
|
|
122
129
|
|
|
123
|
-
_renderChildren(): void
|
|
130
|
+
_renderChildren(): Promise< void >;
|
|
124
131
|
|
|
125
132
|
_beforeRender(): void;
|
|
126
133
|
|
|
@@ -191,6 +198,8 @@ export type BackboneModel< Model extends object > = {
|
|
|
191
198
|
get: < T extends keyof Model >( key: T ) => Model[ T ];
|
|
192
199
|
set: < T extends keyof Model >( key: T, value: Model[ T ] ) => void;
|
|
193
200
|
toJSON: () => ToJSON< Model >;
|
|
201
|
+
on: ( event: string, callback: () => void ) => void;
|
|
202
|
+
off: ( event: string, callback: () => void ) => void;
|
|
194
203
|
trigger: ( event: string, ...args: unknown[] ) => void;
|
|
195
204
|
};
|
|
196
205
|
|
|
@@ -2,7 +2,10 @@ import { type MCPRegistryEntry } from '@elementor/editor-mcp';
|
|
|
2
2
|
import { type ExtendedWindow } from '@elementor/editor-responsive';
|
|
3
3
|
import { v1ReadyEvent } from '@elementor/editor-v1-adapters';
|
|
4
4
|
|
|
5
|
+
import { CANVAS_SERVER_NAME } from './widgets-schema-resource';
|
|
6
|
+
|
|
5
7
|
export const BREAKPOINTS_SCHEMA_URI = 'elementor://breakpoints/list';
|
|
8
|
+
export const BREAKPOINTS_SCHEMA_FULL_URI = `${ CANVAS_SERVER_NAME }_${ BREAKPOINTS_SCHEMA_URI }`;
|
|
6
9
|
|
|
7
10
|
export const initBreakpointsResource = ( reg: MCPRegistryEntry ) => {
|
|
8
11
|
const { resource, sendResourceUpdated } = reg;
|
|
@@ -56,9 +56,14 @@ function extractV3ControlsMetadata( controls: unknown ): Record< string, V3Contr
|
|
|
56
56
|
return result;
|
|
57
57
|
}
|
|
58
58
|
|
|
59
|
+
export const CANVAS_SERVER_NAME = 'editor-canvas';
|
|
60
|
+
|
|
59
61
|
export const WIDGET_SCHEMA_URI = 'elementor://widgets/schema/{widgetType}';
|
|
62
|
+
export const WIDGET_SCHEMA_FULL_URI = `${ CANVAS_SERVER_NAME }_${ WIDGET_SCHEMA_URI }`;
|
|
60
63
|
export const STYLE_SCHEMA_URI = 'elementor://styles/schema/{category}';
|
|
64
|
+
export const STYLE_SCHEMA_FULL_URI = `${ CANVAS_SERVER_NAME }_${ STYLE_SCHEMA_URI }`;
|
|
61
65
|
export const BEST_PRACTICES_URI = 'elementor://styles/best-practices';
|
|
66
|
+
export const BEST_PRACTICES_FULL_URI = `${ CANVAS_SERVER_NAME }_${ BEST_PRACTICES_URI }`;
|
|
62
67
|
|
|
63
68
|
export const initWidgetsSchemaResource = ( reg: MCPRegistryEntry ) => {
|
|
64
69
|
const { resource } = reg;
|