@elementor/editor-components 3.35.0-417 → 3.35.0-419
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.js +29 -4
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +30 -5
- package/dist/index.mjs.map +1 -1
- package/package.json +22 -22
- package/src/component-instance-transformer.ts +1 -9
- package/src/component-overridable-transformer.ts +4 -5
- package/src/create-component-type.ts +38 -1
- package/src/types.ts +5 -0
package/dist/index.js
CHANGED
|
@@ -306,9 +306,6 @@ var invalidateComponentDocumentData = (id2) => {
|
|
|
306
306
|
};
|
|
307
307
|
|
|
308
308
|
// src/component-instance-transformer.ts
|
|
309
|
-
var componentInstanceContext = new import_editor_canvas.RenderContext("component-instance", {
|
|
310
|
-
overrides: {}
|
|
311
|
-
});
|
|
312
309
|
var componentInstanceTransformer = (0, import_editor_canvas.createTransformer)(
|
|
313
310
|
async ({
|
|
314
311
|
component_id: id2,
|
|
@@ -338,7 +335,7 @@ var componentInstanceTransformer = (0, import_editor_canvas.createTransformer)(
|
|
|
338
335
|
var import_editor_canvas2 = require("@elementor/editor-canvas");
|
|
339
336
|
var componentOverridableTransformer = (0, import_editor_canvas2.createTransformer)(
|
|
340
337
|
(value, options) => {
|
|
341
|
-
const { overrides } =
|
|
338
|
+
const { overrides } = options.renderContext ?? {};
|
|
342
339
|
const overrideValue = overrides?.[value.override_key];
|
|
343
340
|
if (overrideValue) {
|
|
344
341
|
const isOverride = isOriginValueOverride(value.origin_value);
|
|
@@ -1811,13 +1808,41 @@ function createComponentView(options) {
|
|
|
1811
1808
|
return class extends (0, import_editor_canvas4.createTemplatedElementView)(options) {
|
|
1812
1809
|
legacyWindow = window;
|
|
1813
1810
|
eventsManagerConfig = this.legacyWindow.elementorCommon.eventsManager.config;
|
|
1811
|
+
#componentRenderContext;
|
|
1814
1812
|
isComponentCurrentlyEdited() {
|
|
1815
1813
|
const currentDocument = (0, import_editor_documents7.getCurrentDocument)();
|
|
1816
1814
|
return currentDocument?.id === this.getComponentId();
|
|
1817
1815
|
}
|
|
1816
|
+
getRenderContext() {
|
|
1817
|
+
const namespaceKey = this.getNamespaceKey();
|
|
1818
|
+
const parentContext = this._parent?.getRenderContext?.();
|
|
1819
|
+
const parentComponentContext = parentContext?.[namespaceKey];
|
|
1820
|
+
if (!this.#componentRenderContext) {
|
|
1821
|
+
return parentContext;
|
|
1822
|
+
}
|
|
1823
|
+
const ownOverrides = this.#componentRenderContext.overrides ?? {};
|
|
1824
|
+
const parentOverrides = parentComponentContext?.overrides ?? {};
|
|
1825
|
+
return {
|
|
1826
|
+
...parentContext,
|
|
1827
|
+
[namespaceKey]: {
|
|
1828
|
+
overrides: {
|
|
1829
|
+
...parentOverrides,
|
|
1830
|
+
...ownOverrides
|
|
1831
|
+
}
|
|
1832
|
+
}
|
|
1833
|
+
};
|
|
1834
|
+
}
|
|
1835
|
+
getResolverRenderContext() {
|
|
1836
|
+
const namespaceKey = this.getNamespaceKey();
|
|
1837
|
+
const context = this.getRenderContext();
|
|
1838
|
+
return context?.[namespaceKey];
|
|
1839
|
+
}
|
|
1818
1840
|
afterSettingsResolve(settings) {
|
|
1819
1841
|
const componentInstance = settings.component_instance;
|
|
1820
1842
|
if (componentInstance) {
|
|
1843
|
+
this.#componentRenderContext = {
|
|
1844
|
+
overrides: componentInstance.overrides ?? {}
|
|
1845
|
+
};
|
|
1821
1846
|
this.collection = this.legacyWindow.elementor.createBackboneElementsCollection(
|
|
1822
1847
|
componentInstance.elements
|
|
1823
1848
|
);
|