@elementor/editor-components 3.35.0-379 → 3.35.0-381
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 +1419 -564
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1365 -494
- package/dist/index.mjs.map +1 -1
- package/package.json +22 -22
- package/src/components/component-panel-header/component-badge.tsx +8 -3
- package/src/components/component-panel-header/component-panel-header.tsx +5 -1
- package/src/components/component-properties-panel/component-properties-panel-content.tsx +165 -0
- package/src/components/component-properties-panel/component-properties-panel.tsx +51 -0
- package/src/components/component-properties-panel/properties-empty-state.tsx +44 -0
- package/src/components/component-properties-panel/properties-group.tsx +191 -0
- package/src/components/component-properties-panel/property-item.tsx +121 -0
- package/src/components/component-properties-panel/sortable.tsx +92 -0
- package/src/components/component-properties-panel/use-current-editable-item.ts +74 -0
- package/src/components/component-properties-panel/utils/generate-unique-label.ts +21 -0
- package/src/components/component-properties-panel/utils/validate-group-label.ts +24 -0
- package/src/components/instance-editing-panel/instance-editing-panel.tsx +1 -1
- package/src/components/overridable-props/overridable-prop-form.tsx +7 -4
- package/src/init.ts +3 -0
- package/src/store/actions/add-overridable-group.ts +47 -0
- package/src/store/actions/delete-overridable-group.ts +38 -0
- package/src/store/actions/delete-overridable-prop.ts +56 -0
- package/src/store/actions/rename-overridable-group.ts +39 -0
- package/src/store/actions/reorder-group-props.ts +43 -0
- package/src/store/actions/reorder-overridable-groups.ts +30 -0
- package/src/store/actions/set-overridable-prop.ts +21 -126
- package/src/store/actions/update-overridable-prop.ts +58 -0
- package/src/store/utils/groups-transformers.ts +185 -0
package/dist/index.js
CHANGED
|
@@ -37,13 +37,14 @@ module.exports = __toCommonJS(index_exports);
|
|
|
37
37
|
// src/init.ts
|
|
38
38
|
var import_editor = require("@elementor/editor");
|
|
39
39
|
var import_editor_canvas8 = require("@elementor/editor-canvas");
|
|
40
|
-
var
|
|
41
|
-
var
|
|
40
|
+
var import_editor_documents12 = require("@elementor/editor-documents");
|
|
41
|
+
var import_editor_editing_panel6 = require("@elementor/editor-editing-panel");
|
|
42
42
|
var import_editor_elements_panel = require("@elementor/editor-elements-panel");
|
|
43
|
+
var import_editor_panels4 = require("@elementor/editor-panels");
|
|
43
44
|
var import_editor_styles_repository2 = require("@elementor/editor-styles-repository");
|
|
44
45
|
var import_editor_v1_adapters6 = require("@elementor/editor-v1-adapters");
|
|
45
|
-
var
|
|
46
|
-
var
|
|
46
|
+
var import_store64 = require("@elementor/store");
|
|
47
|
+
var import_i18n24 = require("@wordpress/i18n");
|
|
47
48
|
|
|
48
49
|
// src/component-instance-transformer.ts
|
|
49
50
|
var import_editor_canvas = require("@elementor/editor-canvas");
|
|
@@ -59,10 +60,10 @@ var import_store = require("@elementor/store");
|
|
|
59
60
|
var import_editor_v1_adapters = require("@elementor/editor-v1-adapters");
|
|
60
61
|
var import_http_client = require("@elementor/http-client");
|
|
61
62
|
var BASE_URL = "elementor/v1/components";
|
|
62
|
-
var getParams = (
|
|
63
|
+
var getParams = (id2) => ({
|
|
63
64
|
action: "get_document_config",
|
|
64
|
-
unique_id: `document-config-${
|
|
65
|
-
data: { id }
|
|
65
|
+
unique_id: `document-config-${id2}`,
|
|
66
|
+
data: { id: id2 }
|
|
66
67
|
});
|
|
67
68
|
var apiClient = {
|
|
68
69
|
get: () => (0, import_http_client.httpService)().get(`${BASE_URL}`).then((res) => res.data.data),
|
|
@@ -71,8 +72,8 @@ var apiClient = {
|
|
|
71
72
|
ids,
|
|
72
73
|
status
|
|
73
74
|
}),
|
|
74
|
-
getComponentConfig: (
|
|
75
|
-
invalidateComponentConfigCache: (
|
|
75
|
+
getComponentConfig: (id2) => import_editor_v1_adapters.ajax.load(getParams(id2)),
|
|
76
|
+
invalidateComponentConfigCache: (id2) => import_editor_v1_adapters.ajax.invalidateCache(getParams(id2)),
|
|
76
77
|
getComponentLockStatus: async (componentId) => await (0, import_http_client.httpService)().get(`${BASE_URL}/lock-status`, {
|
|
77
78
|
params: {
|
|
78
79
|
componentId
|
|
@@ -255,17 +256,17 @@ var selectArchivedComponents = (0, import_store2.__createSelector)(
|
|
|
255
256
|
|
|
256
257
|
// src/utils/component-document-data.ts
|
|
257
258
|
var import_editor_documents = require("@elementor/editor-documents");
|
|
258
|
-
var getComponentDocumentData = async (
|
|
259
|
+
var getComponentDocumentData = async (id2) => {
|
|
259
260
|
const documentManager = (0, import_editor_documents.getV1DocumentsManager)();
|
|
260
261
|
try {
|
|
261
|
-
return await documentManager.request(
|
|
262
|
+
return await documentManager.request(id2);
|
|
262
263
|
} catch {
|
|
263
264
|
return null;
|
|
264
265
|
}
|
|
265
266
|
};
|
|
266
|
-
var invalidateComponentDocumentData = (
|
|
267
|
+
var invalidateComponentDocumentData = (id2) => {
|
|
267
268
|
const documentManager = (0, import_editor_documents.getV1DocumentsManager)();
|
|
268
|
-
documentManager.invalidateCache(
|
|
269
|
+
documentManager.invalidateCache(id2);
|
|
269
270
|
};
|
|
270
271
|
|
|
271
272
|
// src/component-instance-transformer.ts
|
|
@@ -274,11 +275,11 @@ var componentInstanceContext = new import_editor_canvas.RenderContext("component
|
|
|
274
275
|
});
|
|
275
276
|
var componentInstanceTransformer = (0, import_editor_canvas.createTransformer)(
|
|
276
277
|
async ({
|
|
277
|
-
component_id:
|
|
278
|
+
component_id: id2,
|
|
278
279
|
overrides: overridesValue
|
|
279
280
|
}) => {
|
|
280
281
|
const unpublishedComponents = selectUnpublishedComponents((0, import_store3.__getState)());
|
|
281
|
-
const unpublishedComponent = unpublishedComponents.find(({ uid }) => uid ===
|
|
282
|
+
const unpublishedComponent = unpublishedComponents.find(({ uid }) => uid === id2);
|
|
282
283
|
const overrides = overridesValue?.reduce((acc, override) => ({ ...acc, ...override }), {});
|
|
283
284
|
if (unpublishedComponent) {
|
|
284
285
|
return {
|
|
@@ -286,10 +287,10 @@ var componentInstanceTransformer = (0, import_editor_canvas.createTransformer)(
|
|
|
286
287
|
overrides
|
|
287
288
|
};
|
|
288
289
|
}
|
|
289
|
-
if (typeof
|
|
290
|
-
throw new Error(`Component ID "${
|
|
290
|
+
if (typeof id2 !== "number") {
|
|
291
|
+
throw new Error(`Component ID "${id2}" not valid.`);
|
|
291
292
|
}
|
|
292
|
-
const data = await getComponentDocumentData(
|
|
293
|
+
const data = await getComponentDocumentData(id2);
|
|
293
294
|
return {
|
|
294
295
|
elements: data?.elements ?? [],
|
|
295
296
|
overrides
|
|
@@ -339,12 +340,12 @@ var componentOverrideTransformer = (0, import_editor_canvas3.createTransformer)(
|
|
|
339
340
|
});
|
|
340
341
|
|
|
341
342
|
// src/components/component-panel-header/component-panel-header.tsx
|
|
342
|
-
var
|
|
343
|
+
var React10 = __toESM(require("react"));
|
|
343
344
|
var import_editor_current_user = require("@elementor/editor-current-user");
|
|
344
|
-
var
|
|
345
|
-
var
|
|
346
|
-
var
|
|
347
|
-
var
|
|
345
|
+
var import_editor_documents5 = require("@elementor/editor-documents");
|
|
346
|
+
var import_icons7 = require("@elementor/icons");
|
|
347
|
+
var import_ui10 = require("@elementor/ui");
|
|
348
|
+
var import_i18n11 = require("@wordpress/i18n");
|
|
348
349
|
|
|
349
350
|
// src/hooks/use-navigate-back.ts
|
|
350
351
|
var import_react = require("react");
|
|
@@ -377,12 +378,1003 @@ function useNavigateBack() {
|
|
|
377
378
|
}, [path, documentsManager]);
|
|
378
379
|
}
|
|
379
380
|
|
|
380
|
-
// src/components/
|
|
381
|
+
// src/components/component-properties-panel/component-properties-panel.tsx
|
|
382
|
+
var React7 = __toESM(require("react"));
|
|
383
|
+
var import_editor_editing_panel = require("@elementor/editor-editing-panel");
|
|
384
|
+
var import_editor_elements3 = require("@elementor/editor-elements");
|
|
385
|
+
var import_editor_panels2 = require("@elementor/editor-panels");
|
|
386
|
+
var import_editor_ui4 = require("@elementor/editor-ui");
|
|
387
|
+
var import_ui7 = require("@elementor/ui");
|
|
388
|
+
var import_i18n8 = require("@wordpress/i18n");
|
|
389
|
+
|
|
390
|
+
// src/components/component-properties-panel/component-properties-panel-content.tsx
|
|
391
|
+
var React6 = __toESM(require("react"));
|
|
392
|
+
var import_react4 = require("react");
|
|
393
|
+
var import_editor_documents4 = require("@elementor/editor-documents");
|
|
394
|
+
var import_editor_panels = require("@elementor/editor-panels");
|
|
395
|
+
var import_icons5 = require("@elementor/icons");
|
|
396
|
+
var import_ui6 = require("@elementor/ui");
|
|
397
|
+
var import_utils2 = require("@elementor/utils");
|
|
398
|
+
var import_i18n7 = require("@wordpress/i18n");
|
|
399
|
+
|
|
400
|
+
// src/store/actions/add-overridable-group.ts
|
|
401
|
+
var import_store7 = require("@elementor/store");
|
|
402
|
+
function addOverridableGroup({
|
|
403
|
+
componentId,
|
|
404
|
+
groupId,
|
|
405
|
+
label
|
|
406
|
+
}) {
|
|
407
|
+
const overridableProps = selectOverridableProps((0, import_store7.__getState)(), componentId);
|
|
408
|
+
if (!overridableProps) {
|
|
409
|
+
return;
|
|
410
|
+
}
|
|
411
|
+
const newGroup = {
|
|
412
|
+
id: groupId,
|
|
413
|
+
label,
|
|
414
|
+
props: []
|
|
415
|
+
};
|
|
416
|
+
(0, import_store7.__dispatch)(
|
|
417
|
+
slice.actions.setOverridableProps({
|
|
418
|
+
componentId,
|
|
419
|
+
overridableProps: {
|
|
420
|
+
...overridableProps,
|
|
421
|
+
groups: {
|
|
422
|
+
...overridableProps.groups,
|
|
423
|
+
items: {
|
|
424
|
+
...overridableProps.groups.items,
|
|
425
|
+
[groupId]: newGroup
|
|
426
|
+
},
|
|
427
|
+
order: [groupId, ...overridableProps.groups.order]
|
|
428
|
+
}
|
|
429
|
+
}
|
|
430
|
+
})
|
|
431
|
+
);
|
|
432
|
+
return newGroup;
|
|
433
|
+
}
|
|
434
|
+
|
|
435
|
+
// src/store/actions/delete-overridable-group.ts
|
|
436
|
+
var import_store9 = require("@elementor/store");
|
|
437
|
+
|
|
438
|
+
// src/store/utils/groups-transformers.ts
|
|
439
|
+
var import_utils = require("@elementor/utils");
|
|
440
|
+
var import_i18n = require("@wordpress/i18n");
|
|
441
|
+
function removePropFromAllGroups(groups, propKey) {
|
|
442
|
+
return {
|
|
443
|
+
...groups,
|
|
444
|
+
items: Object.fromEntries(
|
|
445
|
+
Object.entries(groups.items).map(([groupId, group]) => [
|
|
446
|
+
groupId,
|
|
447
|
+
{
|
|
448
|
+
...group,
|
|
449
|
+
props: group.props.filter((p) => p !== propKey)
|
|
450
|
+
}
|
|
451
|
+
])
|
|
452
|
+
)
|
|
453
|
+
};
|
|
454
|
+
}
|
|
455
|
+
function addPropToGroup(groups, groupId, propKey) {
|
|
456
|
+
const group = groups.items[groupId];
|
|
457
|
+
if (!group) {
|
|
458
|
+
return groups;
|
|
459
|
+
}
|
|
460
|
+
if (group.props.includes(propKey)) {
|
|
461
|
+
return groups;
|
|
462
|
+
}
|
|
463
|
+
return {
|
|
464
|
+
...groups,
|
|
465
|
+
items: {
|
|
466
|
+
...groups.items,
|
|
467
|
+
[groupId]: {
|
|
468
|
+
...group,
|
|
469
|
+
props: [...group.props, propKey]
|
|
470
|
+
}
|
|
471
|
+
}
|
|
472
|
+
};
|
|
473
|
+
}
|
|
474
|
+
function movePropBetweenGroups(groups, propKey, fromGroupId, toGroupId) {
|
|
475
|
+
if (fromGroupId === toGroupId) {
|
|
476
|
+
return groups;
|
|
477
|
+
}
|
|
478
|
+
const withoutProp = removePropFromGroup(groups, fromGroupId, propKey);
|
|
479
|
+
return addPropToGroup(withoutProp, toGroupId, propKey);
|
|
480
|
+
}
|
|
481
|
+
function removePropFromGroup(groups, groupId, propKey) {
|
|
482
|
+
const group = groups.items[groupId];
|
|
483
|
+
if (!group) {
|
|
484
|
+
return groups;
|
|
485
|
+
}
|
|
486
|
+
return {
|
|
487
|
+
...groups,
|
|
488
|
+
items: {
|
|
489
|
+
...groups.items,
|
|
490
|
+
[groupId]: {
|
|
491
|
+
...group,
|
|
492
|
+
props: group.props.filter((p) => p !== propKey)
|
|
493
|
+
}
|
|
494
|
+
}
|
|
495
|
+
};
|
|
496
|
+
}
|
|
497
|
+
function resolveOrCreateGroup(groups, requestedGroupId) {
|
|
498
|
+
if (requestedGroupId && groups.items[requestedGroupId]) {
|
|
499
|
+
return { groups, groupId: requestedGroupId };
|
|
500
|
+
}
|
|
501
|
+
if (!requestedGroupId && groups.order.length > 0) {
|
|
502
|
+
return { groups, groupId: groups.order[0] };
|
|
503
|
+
}
|
|
504
|
+
return createGroup(groups, requestedGroupId);
|
|
505
|
+
}
|
|
506
|
+
function createGroup(groups, groupId, label) {
|
|
507
|
+
const newGroupId = groupId || (0, import_utils.generateUniqueId)("group");
|
|
508
|
+
const newLabel = label || (0, import_i18n.__)("Default", "elementor");
|
|
509
|
+
return {
|
|
510
|
+
groups: {
|
|
511
|
+
...groups,
|
|
512
|
+
items: {
|
|
513
|
+
...groups.items,
|
|
514
|
+
[newGroupId]: {
|
|
515
|
+
id: newGroupId,
|
|
516
|
+
label: newLabel,
|
|
517
|
+
props: []
|
|
518
|
+
}
|
|
519
|
+
},
|
|
520
|
+
order: [...groups.order, newGroupId]
|
|
521
|
+
},
|
|
522
|
+
groupId: newGroupId
|
|
523
|
+
};
|
|
524
|
+
}
|
|
525
|
+
function removePropsFromState(overridableProps, propsToRemove) {
|
|
526
|
+
const overrideKeysToRemove = propsToRemove.map((prop) => prop.overrideKey);
|
|
527
|
+
const remainingProps = Object.fromEntries(
|
|
528
|
+
Object.entries(overridableProps.props).filter(([, prop]) => !propsToRemove.includes(prop))
|
|
529
|
+
);
|
|
530
|
+
const updatedGroupItems = Object.fromEntries(
|
|
531
|
+
Object.entries(overridableProps.groups.items).map(
|
|
532
|
+
([groupId, group]) => [
|
|
533
|
+
groupId,
|
|
534
|
+
{
|
|
535
|
+
...group,
|
|
536
|
+
props: group.props.filter((prop) => !overrideKeysToRemove.includes(prop))
|
|
537
|
+
}
|
|
538
|
+
]
|
|
539
|
+
)
|
|
540
|
+
);
|
|
541
|
+
return {
|
|
542
|
+
props: remainingProps,
|
|
543
|
+
groups: {
|
|
544
|
+
items: updatedGroupItems,
|
|
545
|
+
order: overridableProps.groups.order.filter((groupId) => !overrideKeysToRemove.includes(groupId))
|
|
546
|
+
}
|
|
547
|
+
};
|
|
548
|
+
}
|
|
549
|
+
function ensureGroupInOrder(groups, groupId) {
|
|
550
|
+
if (groups.order.includes(groupId)) {
|
|
551
|
+
return groups;
|
|
552
|
+
}
|
|
553
|
+
return {
|
|
554
|
+
...groups,
|
|
555
|
+
order: [...groups.order, groupId]
|
|
556
|
+
};
|
|
557
|
+
}
|
|
558
|
+
function deleteGroup(groups, groupId) {
|
|
559
|
+
const { [groupId]: removed, ...remainingItems } = groups.items;
|
|
560
|
+
return {
|
|
561
|
+
items: remainingItems,
|
|
562
|
+
order: groups.order.filter((id2) => id2 !== groupId)
|
|
563
|
+
};
|
|
564
|
+
}
|
|
565
|
+
function renameGroup(groups, groupId, newLabel) {
|
|
566
|
+
const group = groups.items[groupId];
|
|
567
|
+
if (!group) {
|
|
568
|
+
return groups;
|
|
569
|
+
}
|
|
570
|
+
return {
|
|
571
|
+
...groups,
|
|
572
|
+
items: {
|
|
573
|
+
...groups.items,
|
|
574
|
+
[groupId]: {
|
|
575
|
+
...group,
|
|
576
|
+
label: newLabel
|
|
577
|
+
}
|
|
578
|
+
}
|
|
579
|
+
};
|
|
580
|
+
}
|
|
581
|
+
|
|
582
|
+
// src/store/actions/delete-overridable-group.ts
|
|
583
|
+
function deleteOverridableGroup({ componentId, groupId }) {
|
|
584
|
+
const overridableProps = selectOverridableProps((0, import_store9.__getState)(), componentId);
|
|
585
|
+
if (!overridableProps) {
|
|
586
|
+
return false;
|
|
587
|
+
}
|
|
588
|
+
const group = overridableProps.groups.items[groupId];
|
|
589
|
+
if (!group || group.props.length > 0) {
|
|
590
|
+
return false;
|
|
591
|
+
}
|
|
592
|
+
const updatedGroups = deleteGroup(overridableProps.groups, groupId);
|
|
593
|
+
(0, import_store9.__dispatch)(
|
|
594
|
+
slice.actions.setOverridableProps({
|
|
595
|
+
componentId,
|
|
596
|
+
overridableProps: {
|
|
597
|
+
...overridableProps,
|
|
598
|
+
groups: updatedGroups
|
|
599
|
+
}
|
|
600
|
+
})
|
|
601
|
+
);
|
|
602
|
+
return true;
|
|
603
|
+
}
|
|
604
|
+
|
|
605
|
+
// src/store/actions/delete-overridable-prop.ts
|
|
606
|
+
var import_editor_elements = require("@elementor/editor-elements");
|
|
607
|
+
var import_store11 = require("@elementor/store");
|
|
608
|
+
function deleteOverridableProp({ componentId, propKey }) {
|
|
609
|
+
const overridableProps = selectOverridableProps((0, import_store11.__getState)(), componentId);
|
|
610
|
+
if (!overridableProps) {
|
|
611
|
+
return;
|
|
612
|
+
}
|
|
613
|
+
const prop = overridableProps.props[propKey];
|
|
614
|
+
if (!prop) {
|
|
615
|
+
return;
|
|
616
|
+
}
|
|
617
|
+
revertElementSetting(prop.elementId, prop.propKey, prop.originValue);
|
|
618
|
+
const { [propKey]: removedProp, ...remainingProps } = overridableProps.props;
|
|
619
|
+
const updatedGroups = removePropFromAllGroups(overridableProps.groups, propKey);
|
|
620
|
+
(0, import_store11.__dispatch)(
|
|
621
|
+
slice.actions.setOverridableProps({
|
|
622
|
+
componentId,
|
|
623
|
+
overridableProps: {
|
|
624
|
+
...overridableProps,
|
|
625
|
+
props: remainingProps,
|
|
626
|
+
groups: updatedGroups
|
|
627
|
+
}
|
|
628
|
+
})
|
|
629
|
+
);
|
|
630
|
+
}
|
|
631
|
+
function revertElementSetting(elementId, settingKey, originValue) {
|
|
632
|
+
const container = (0, import_editor_elements.getContainer)(elementId);
|
|
633
|
+
if (!container) {
|
|
634
|
+
return;
|
|
635
|
+
}
|
|
636
|
+
(0, import_editor_elements.updateElementSettings)({
|
|
637
|
+
id: elementId,
|
|
638
|
+
props: { [settingKey]: originValue ?? null },
|
|
639
|
+
withHistory: false
|
|
640
|
+
});
|
|
641
|
+
}
|
|
642
|
+
|
|
643
|
+
// src/store/actions/reorder-group-props.ts
|
|
644
|
+
var import_store13 = require("@elementor/store");
|
|
645
|
+
function reorderGroupProps({ componentId, groupId, newPropsOrder }) {
|
|
646
|
+
const overridableProps = selectOverridableProps((0, import_store13.__getState)(), componentId);
|
|
647
|
+
if (!overridableProps) {
|
|
648
|
+
return;
|
|
649
|
+
}
|
|
650
|
+
const group = overridableProps.groups.items[groupId];
|
|
651
|
+
if (!group) {
|
|
652
|
+
return;
|
|
653
|
+
}
|
|
654
|
+
(0, import_store13.__dispatch)(
|
|
655
|
+
slice.actions.setOverridableProps({
|
|
656
|
+
componentId,
|
|
657
|
+
overridableProps: {
|
|
658
|
+
...overridableProps,
|
|
659
|
+
groups: {
|
|
660
|
+
...overridableProps.groups,
|
|
661
|
+
items: {
|
|
662
|
+
...overridableProps.groups.items,
|
|
663
|
+
[groupId]: {
|
|
664
|
+
...group,
|
|
665
|
+
props: newPropsOrder
|
|
666
|
+
}
|
|
667
|
+
}
|
|
668
|
+
}
|
|
669
|
+
}
|
|
670
|
+
})
|
|
671
|
+
);
|
|
672
|
+
}
|
|
673
|
+
|
|
674
|
+
// src/store/actions/reorder-overridable-groups.ts
|
|
675
|
+
var import_store15 = require("@elementor/store");
|
|
676
|
+
function reorderOverridableGroups({ componentId, newOrder }) {
|
|
677
|
+
const overridableProps = selectOverridableProps((0, import_store15.__getState)(), componentId);
|
|
678
|
+
if (!overridableProps) {
|
|
679
|
+
return;
|
|
680
|
+
}
|
|
681
|
+
(0, import_store15.__dispatch)(
|
|
682
|
+
slice.actions.setOverridableProps({
|
|
683
|
+
componentId,
|
|
684
|
+
overridableProps: {
|
|
685
|
+
...overridableProps,
|
|
686
|
+
groups: {
|
|
687
|
+
...overridableProps.groups,
|
|
688
|
+
order: newOrder
|
|
689
|
+
}
|
|
690
|
+
}
|
|
691
|
+
})
|
|
692
|
+
);
|
|
693
|
+
}
|
|
694
|
+
|
|
695
|
+
// src/store/actions/update-overridable-prop.ts
|
|
696
|
+
var import_store17 = require("@elementor/store");
|
|
697
|
+
function updateOverridableProp({
|
|
698
|
+
componentId,
|
|
699
|
+
propKey,
|
|
700
|
+
label,
|
|
701
|
+
groupId
|
|
702
|
+
}) {
|
|
703
|
+
const overridableProps = selectOverridableProps((0, import_store17.__getState)(), componentId);
|
|
704
|
+
if (!overridableProps) {
|
|
705
|
+
return;
|
|
706
|
+
}
|
|
707
|
+
const prop = overridableProps.props[propKey];
|
|
708
|
+
if (!prop) {
|
|
709
|
+
return;
|
|
710
|
+
}
|
|
711
|
+
const oldGroupId = prop.groupId;
|
|
712
|
+
const newGroupId = groupId ?? oldGroupId;
|
|
713
|
+
const updatedProp = {
|
|
714
|
+
...prop,
|
|
715
|
+
label,
|
|
716
|
+
groupId: newGroupId
|
|
717
|
+
};
|
|
718
|
+
const updatedGroups = movePropBetweenGroups(overridableProps.groups, propKey, oldGroupId, newGroupId);
|
|
719
|
+
(0, import_store17.__dispatch)(
|
|
720
|
+
slice.actions.setOverridableProps({
|
|
721
|
+
componentId,
|
|
722
|
+
overridableProps: {
|
|
723
|
+
...overridableProps,
|
|
724
|
+
props: {
|
|
725
|
+
...overridableProps.props,
|
|
726
|
+
[propKey]: updatedProp
|
|
727
|
+
},
|
|
728
|
+
groups: updatedGroups
|
|
729
|
+
}
|
|
730
|
+
})
|
|
731
|
+
);
|
|
732
|
+
return updatedProp;
|
|
733
|
+
}
|
|
734
|
+
|
|
735
|
+
// src/components/component-panel-header/use-overridable-props.ts
|
|
736
|
+
var import_store19 = require("@elementor/store");
|
|
737
|
+
function useOverridableProps(componentId) {
|
|
738
|
+
return (0, import_store19.__useSelector)((state) => {
|
|
739
|
+
if (!componentId) {
|
|
740
|
+
return void 0;
|
|
741
|
+
}
|
|
742
|
+
return selectOverridableProps(state, componentId);
|
|
743
|
+
});
|
|
744
|
+
}
|
|
745
|
+
|
|
746
|
+
// src/components/component-properties-panel/properties-empty-state.tsx
|
|
381
747
|
var React = __toESM(require("react"));
|
|
382
|
-
var
|
|
383
|
-
var import_editor_ui = require("@elementor/editor-ui");
|
|
748
|
+
var import_icons = require("@elementor/icons");
|
|
384
749
|
var import_ui = require("@elementor/ui");
|
|
385
|
-
var
|
|
750
|
+
var import_i18n2 = require("@wordpress/i18n");
|
|
751
|
+
var LEARN_MORE_URL = "https://go.elementor.com/tbd/";
|
|
752
|
+
function PropertiesEmptyState() {
|
|
753
|
+
return /* @__PURE__ */ React.createElement(
|
|
754
|
+
import_ui.Stack,
|
|
755
|
+
{
|
|
756
|
+
alignItems: "center",
|
|
757
|
+
justifyContent: "flex-start",
|
|
758
|
+
height: "100%",
|
|
759
|
+
color: "text.secondary",
|
|
760
|
+
sx: { px: 2.5, pt: 10, pb: 5.5 },
|
|
761
|
+
gap: 1
|
|
762
|
+
},
|
|
763
|
+
/* @__PURE__ */ React.createElement(import_icons.ComponentPropListIcon, { fontSize: "large" }),
|
|
764
|
+
/* @__PURE__ */ React.createElement(import_ui.Typography, { align: "center", variant: "subtitle2" }, (0, import_i18n2.__)("Add your first property", "elementor")),
|
|
765
|
+
/* @__PURE__ */ React.createElement(import_ui.Typography, { align: "center", variant: "caption" }, (0, import_i18n2.__)("Make instances flexible while keeping design synced.", "elementor")),
|
|
766
|
+
/* @__PURE__ */ React.createElement(import_ui.Typography, { align: "center", variant: "caption" }, (0, import_i18n2.__)("Select any element, then click + next to a setting to expose it.", "elementor")),
|
|
767
|
+
/* @__PURE__ */ React.createElement(
|
|
768
|
+
import_ui.Link,
|
|
769
|
+
{
|
|
770
|
+
variant: "caption",
|
|
771
|
+
color: "secondary",
|
|
772
|
+
href: LEARN_MORE_URL,
|
|
773
|
+
target: "_blank",
|
|
774
|
+
rel: "noopener noreferrer",
|
|
775
|
+
sx: { textDecorationLine: "underline" }
|
|
776
|
+
},
|
|
777
|
+
(0, import_i18n2.__)("Learn more", "elementor")
|
|
778
|
+
)
|
|
779
|
+
);
|
|
780
|
+
}
|
|
781
|
+
|
|
782
|
+
// src/components/component-properties-panel/properties-group.tsx
|
|
783
|
+
var React5 = __toESM(require("react"));
|
|
784
|
+
var import_editor_ui2 = require("@elementor/editor-ui");
|
|
785
|
+
var import_icons4 = require("@elementor/icons");
|
|
786
|
+
var import_ui5 = require("@elementor/ui");
|
|
787
|
+
var import_i18n4 = require("@wordpress/i18n");
|
|
788
|
+
|
|
789
|
+
// src/components/component-properties-panel/property-item.tsx
|
|
790
|
+
var React4 = __toESM(require("react"));
|
|
791
|
+
var import_editor_elements2 = require("@elementor/editor-elements");
|
|
792
|
+
var import_icons3 = require("@elementor/icons");
|
|
793
|
+
var import_ui4 = require("@elementor/ui");
|
|
794
|
+
|
|
795
|
+
// src/components/overridable-props/overridable-prop-form.tsx
|
|
796
|
+
var React2 = __toESM(require("react"));
|
|
797
|
+
var import_react2 = require("react");
|
|
798
|
+
var import_editor_ui = require("@elementor/editor-ui");
|
|
799
|
+
var import_ui2 = require("@elementor/ui");
|
|
800
|
+
var import_i18n3 = require("@wordpress/i18n");
|
|
801
|
+
var SIZE = "tiny";
|
|
802
|
+
var DEFAULT_GROUP = { value: null, label: (0, import_i18n3.__)("Default", "elementor") };
|
|
803
|
+
function OverridablePropForm({ onSubmit, groups, currentValue, sx }) {
|
|
804
|
+
const [propLabel, setPropLabel] = (0, import_react2.useState)(currentValue?.label ?? null);
|
|
805
|
+
const [group, setGroup] = (0, import_react2.useState)(currentValue?.groupId ?? groups?.[0]?.value ?? null);
|
|
806
|
+
const name = (0, import_i18n3.__)("Name", "elementor");
|
|
807
|
+
const groupName = (0, import_i18n3.__)("Group Name", "elementor");
|
|
808
|
+
const isCreate = currentValue === void 0;
|
|
809
|
+
const title = isCreate ? (0, import_i18n3.__)("Create new property", "elementor") : (0, import_i18n3.__)("Update property", "elementor");
|
|
810
|
+
const ctaLabel = isCreate ? (0, import_i18n3.__)("Create", "elementor") : (0, import_i18n3.__)("Update", "elementor");
|
|
811
|
+
return /* @__PURE__ */ React2.createElement(import_editor_ui.Form, { onSubmit: () => onSubmit({ label: propLabel ?? "", group }) }, /* @__PURE__ */ React2.createElement(import_ui2.Stack, { alignItems: "start", sx: { width: "268px", ...sx } }, /* @__PURE__ */ React2.createElement(
|
|
812
|
+
import_ui2.Stack,
|
|
813
|
+
{
|
|
814
|
+
direction: "row",
|
|
815
|
+
alignItems: "center",
|
|
816
|
+
py: 1,
|
|
817
|
+
px: 1.5,
|
|
818
|
+
sx: { columnGap: 0.5, borderBottom: "1px solid", borderColor: "divider", width: "100%", mb: 1.5 }
|
|
819
|
+
},
|
|
820
|
+
/* @__PURE__ */ React2.createElement(import_ui2.Typography, { variant: "caption", sx: { color: "text.primary", fontWeight: "500", lineHeight: 1 } }, title)
|
|
821
|
+
), /* @__PURE__ */ React2.createElement(import_ui2.Grid, { container: true, gap: 0.75, alignItems: "start", px: 1.5, mb: 1.5 }, /* @__PURE__ */ React2.createElement(import_ui2.Grid, { item: true, xs: 12 }, /* @__PURE__ */ React2.createElement(import_ui2.FormLabel, { size: "tiny" }, name)), /* @__PURE__ */ React2.createElement(import_ui2.Grid, { item: true, xs: 12 }, /* @__PURE__ */ React2.createElement(
|
|
822
|
+
import_ui2.TextField,
|
|
823
|
+
{
|
|
824
|
+
name,
|
|
825
|
+
size: SIZE,
|
|
826
|
+
fullWidth: true,
|
|
827
|
+
placeholder: (0, import_i18n3.__)("Enter value", "elementor"),
|
|
828
|
+
value: propLabel ?? "",
|
|
829
|
+
onChange: (e) => setPropLabel(e.target.value)
|
|
830
|
+
}
|
|
831
|
+
))), /* @__PURE__ */ React2.createElement(import_ui2.Grid, { container: true, gap: 0.75, alignItems: "start", px: 1.5, mb: 1.5 }, /* @__PURE__ */ React2.createElement(import_ui2.Grid, { item: true, xs: 12 }, /* @__PURE__ */ React2.createElement(import_ui2.FormLabel, { size: "tiny" }, groupName)), /* @__PURE__ */ React2.createElement(import_ui2.Grid, { item: true, xs: 12 }, /* @__PURE__ */ React2.createElement(
|
|
832
|
+
import_ui2.Select,
|
|
833
|
+
{
|
|
834
|
+
name: groupName,
|
|
835
|
+
size: SIZE,
|
|
836
|
+
fullWidth: true,
|
|
837
|
+
value: group ?? null,
|
|
838
|
+
onChange: (e) => setGroup(e.target.value),
|
|
839
|
+
displayEmpty: true,
|
|
840
|
+
renderValue: (selectedValue) => {
|
|
841
|
+
if (!selectedValue || selectedValue === "") {
|
|
842
|
+
const [firstGroup = DEFAULT_GROUP] = groups ?? [];
|
|
843
|
+
return firstGroup.label;
|
|
844
|
+
}
|
|
845
|
+
return groups?.find(({ value }) => value === selectedValue)?.label ?? selectedValue;
|
|
846
|
+
}
|
|
847
|
+
},
|
|
848
|
+
(groups ?? [DEFAULT_GROUP]).map(({ label: groupLabel, ...props }) => /* @__PURE__ */ React2.createElement(import_editor_ui.MenuListItem, { key: props.value, ...props, value: props.value ?? "" }, groupLabel))
|
|
849
|
+
))), /* @__PURE__ */ React2.createElement(import_ui2.Stack, { direction: "row", justifyContent: "flex-end", alignSelf: "end", mt: 1.5, py: 1, px: 1.5 }, /* @__PURE__ */ React2.createElement(import_ui2.Button, { type: "submit", disabled: !propLabel, variant: "contained", color: "primary", size: "small" }, ctaLabel))));
|
|
850
|
+
}
|
|
851
|
+
|
|
852
|
+
// src/components/component-properties-panel/sortable.tsx
|
|
853
|
+
var React3 = __toESM(require("react"));
|
|
854
|
+
var import_icons2 = require("@elementor/icons");
|
|
855
|
+
var import_ui3 = require("@elementor/ui");
|
|
856
|
+
var SortableProvider = (props) => /* @__PURE__ */ React3.createElement(import_ui3.UnstableSortableProvider, { restrictAxis: true, variant: "static", dragPlaceholderStyle: { opacity: "1" }, ...props });
|
|
857
|
+
var SortableTrigger = ({ triggerClassName, ...props }) => /* @__PURE__ */ React3.createElement(
|
|
858
|
+
StyledSortableTrigger,
|
|
859
|
+
{
|
|
860
|
+
...props,
|
|
861
|
+
role: "button",
|
|
862
|
+
className: `sortable-trigger ${triggerClassName ?? ""}`.trim(),
|
|
863
|
+
"aria-label": "sort"
|
|
864
|
+
},
|
|
865
|
+
/* @__PURE__ */ React3.createElement(import_icons2.GripVerticalIcon, { fontSize: "tiny" })
|
|
866
|
+
);
|
|
867
|
+
var SortableItem = ({ children, id: id2 }) => /* @__PURE__ */ React3.createElement(
|
|
868
|
+
import_ui3.UnstableSortableItem,
|
|
869
|
+
{
|
|
870
|
+
id: id2,
|
|
871
|
+
render: ({
|
|
872
|
+
itemProps,
|
|
873
|
+
isDragged,
|
|
874
|
+
triggerProps,
|
|
875
|
+
itemStyle,
|
|
876
|
+
triggerStyle,
|
|
877
|
+
dropIndicationStyle,
|
|
878
|
+
showDropIndication,
|
|
879
|
+
isDragOverlay,
|
|
880
|
+
isDragPlaceholder
|
|
881
|
+
}) => /* @__PURE__ */ React3.createElement(
|
|
882
|
+
import_ui3.Box,
|
|
883
|
+
{
|
|
884
|
+
...itemProps,
|
|
885
|
+
style: itemStyle,
|
|
886
|
+
component: "div",
|
|
887
|
+
role: "listitem",
|
|
888
|
+
sx: {
|
|
889
|
+
backgroundColor: isDragOverlay ? "background.paper" : void 0
|
|
890
|
+
}
|
|
891
|
+
},
|
|
892
|
+
children({
|
|
893
|
+
isDragged,
|
|
894
|
+
isDragPlaceholder,
|
|
895
|
+
triggerProps,
|
|
896
|
+
triggerStyle
|
|
897
|
+
}),
|
|
898
|
+
showDropIndication && /* @__PURE__ */ React3.createElement(SortableItemIndicator, { style: dropIndicationStyle })
|
|
899
|
+
)
|
|
900
|
+
}
|
|
901
|
+
);
|
|
902
|
+
var StyledSortableTrigger = (0, import_ui3.styled)("div")(({ theme }) => ({
|
|
903
|
+
position: "absolute",
|
|
904
|
+
left: 0,
|
|
905
|
+
top: "50%",
|
|
906
|
+
transform: `translate( -${theme.spacing(1.5)}, -50% )`,
|
|
907
|
+
color: theme.palette.action.active,
|
|
908
|
+
cursor: "grab"
|
|
909
|
+
}));
|
|
910
|
+
var SortableItemIndicator = (0, import_ui3.styled)(import_ui3.Box)`
|
|
911
|
+
width: 100%;
|
|
912
|
+
height: 1px;
|
|
913
|
+
background-color: ${({ theme }) => theme.palette.text.primary};
|
|
914
|
+
`;
|
|
915
|
+
|
|
916
|
+
// src/components/component-properties-panel/property-item.tsx
|
|
917
|
+
function PropertyItem({
|
|
918
|
+
prop,
|
|
919
|
+
sortableTriggerProps,
|
|
920
|
+
isDragPlaceholder,
|
|
921
|
+
groups,
|
|
922
|
+
onDelete,
|
|
923
|
+
onUpdate
|
|
924
|
+
}) {
|
|
925
|
+
const popoverState = (0, import_ui4.usePopupState)({
|
|
926
|
+
variant: "popover"
|
|
927
|
+
});
|
|
928
|
+
const icon = getElementIcon(prop);
|
|
929
|
+
const popoverProps = (0, import_ui4.bindPopover)(popoverState);
|
|
930
|
+
const handleSubmit = (data) => {
|
|
931
|
+
onUpdate(data);
|
|
932
|
+
popoverState.close();
|
|
933
|
+
};
|
|
934
|
+
const handleDelete = (event) => {
|
|
935
|
+
event.stopPropagation();
|
|
936
|
+
onDelete(prop.overrideKey);
|
|
937
|
+
};
|
|
938
|
+
return /* @__PURE__ */ React4.createElement(React4.Fragment, null, /* @__PURE__ */ React4.createElement(
|
|
939
|
+
import_ui4.Box,
|
|
940
|
+
{
|
|
941
|
+
...(0, import_ui4.bindTrigger)(popoverState),
|
|
942
|
+
sx: {
|
|
943
|
+
position: "relative",
|
|
944
|
+
pl: 0.5,
|
|
945
|
+
pr: 1,
|
|
946
|
+
py: 0.25,
|
|
947
|
+
minHeight: 28,
|
|
948
|
+
borderRadius: 1,
|
|
949
|
+
border: "1px solid",
|
|
950
|
+
borderColor: "divider",
|
|
951
|
+
display: "flex",
|
|
952
|
+
alignItems: "center",
|
|
953
|
+
gap: 0.5,
|
|
954
|
+
opacity: isDragPlaceholder ? 0.5 : 1,
|
|
955
|
+
cursor: "pointer",
|
|
956
|
+
"&:hover": {
|
|
957
|
+
backgroundColor: "action.hover"
|
|
958
|
+
},
|
|
959
|
+
"&:hover .sortable-trigger": {
|
|
960
|
+
visibility: "visible"
|
|
961
|
+
},
|
|
962
|
+
"& .sortable-trigger": {
|
|
963
|
+
visibility: "hidden"
|
|
964
|
+
},
|
|
965
|
+
"&:hover .delete-button": {
|
|
966
|
+
visibility: "visible"
|
|
967
|
+
},
|
|
968
|
+
"& .delete-button": {
|
|
969
|
+
visibility: "hidden"
|
|
970
|
+
}
|
|
971
|
+
}
|
|
972
|
+
},
|
|
973
|
+
/* @__PURE__ */ React4.createElement(SortableTrigger, { ...sortableTriggerProps }),
|
|
974
|
+
/* @__PURE__ */ React4.createElement(
|
|
975
|
+
import_ui4.Box,
|
|
976
|
+
{
|
|
977
|
+
sx: { display: "flex", alignItems: "center", color: "text.primary", fontSize: 12, padding: 0.25 }
|
|
978
|
+
},
|
|
979
|
+
/* @__PURE__ */ React4.createElement("i", { className: icon })
|
|
980
|
+
),
|
|
981
|
+
/* @__PURE__ */ React4.createElement(import_ui4.Typography, { variant: "caption", sx: { color: "text.primary", flexGrow: 1, fontSize: 10 } }, prop.label),
|
|
982
|
+
/* @__PURE__ */ React4.createElement(import_ui4.IconButton, { size: "tiny", onClick: handleDelete, "aria-label": "Delete property", sx: { p: 0.25 } }, /* @__PURE__ */ React4.createElement(import_icons3.XIcon, { fontSize: "tiny" }))
|
|
983
|
+
), /* @__PURE__ */ React4.createElement(
|
|
984
|
+
import_ui4.Popover,
|
|
985
|
+
{
|
|
986
|
+
...popoverProps,
|
|
987
|
+
anchorOrigin: { vertical: "bottom", horizontal: "left" },
|
|
988
|
+
transformOrigin: { vertical: "top", horizontal: "left" },
|
|
989
|
+
PaperProps: { sx: { width: popoverState.anchorEl?.getBoundingClientRect().width } }
|
|
990
|
+
},
|
|
991
|
+
/* @__PURE__ */ React4.createElement(
|
|
992
|
+
OverridablePropForm,
|
|
993
|
+
{
|
|
994
|
+
onSubmit: handleSubmit,
|
|
995
|
+
currentValue: prop,
|
|
996
|
+
groups,
|
|
997
|
+
sx: { width: "100%" }
|
|
998
|
+
}
|
|
999
|
+
)
|
|
1000
|
+
));
|
|
1001
|
+
}
|
|
1002
|
+
function getElementIcon(prop) {
|
|
1003
|
+
const elType = prop.elType === "widget" ? prop.widgetType : prop.elType;
|
|
1004
|
+
const widgetsCache = (0, import_editor_elements2.getWidgetsCache)();
|
|
1005
|
+
if (!widgetsCache) {
|
|
1006
|
+
return "eicon-apps";
|
|
1007
|
+
}
|
|
1008
|
+
const widgetConfig = widgetsCache[elType];
|
|
1009
|
+
return widgetConfig?.icon || "eicon-apps";
|
|
1010
|
+
}
|
|
1011
|
+
|
|
1012
|
+
// src/components/component-properties-panel/properties-group.tsx
|
|
1013
|
+
function PropertiesGroup({
|
|
1014
|
+
group,
|
|
1015
|
+
props,
|
|
1016
|
+
allGroups,
|
|
1017
|
+
sortableTriggerProps,
|
|
1018
|
+
isDragPlaceholder,
|
|
1019
|
+
onPropsReorder,
|
|
1020
|
+
onPropertyDelete,
|
|
1021
|
+
onPropertyUpdate,
|
|
1022
|
+
onGroupDelete,
|
|
1023
|
+
editableLabelProps
|
|
1024
|
+
}) {
|
|
1025
|
+
const groupProps = group.props.map((propId) => props[propId]).filter((prop) => Boolean(prop));
|
|
1026
|
+
const popupState = (0, import_ui5.usePopupState)({
|
|
1027
|
+
variant: "popover",
|
|
1028
|
+
disableAutoFocus: true
|
|
1029
|
+
});
|
|
1030
|
+
const { editableRef, isEditing, error, getEditableProps, setEditingGroupId, editingGroupId } = editableLabelProps;
|
|
1031
|
+
const hasProperties = group.props.length > 0;
|
|
1032
|
+
const isThisGroupEditing = isEditing && editingGroupId === group.id;
|
|
1033
|
+
const handleRenameClick = () => {
|
|
1034
|
+
popupState.close();
|
|
1035
|
+
setEditingGroupId(group.id);
|
|
1036
|
+
};
|
|
1037
|
+
const handleDeleteClick = () => {
|
|
1038
|
+
popupState.close();
|
|
1039
|
+
onGroupDelete(group.id);
|
|
1040
|
+
};
|
|
1041
|
+
return /* @__PURE__ */ React5.createElement(
|
|
1042
|
+
import_ui5.Box,
|
|
1043
|
+
{
|
|
1044
|
+
sx: {
|
|
1045
|
+
opacity: isDragPlaceholder ? 0.5 : 1
|
|
1046
|
+
}
|
|
1047
|
+
},
|
|
1048
|
+
/* @__PURE__ */ React5.createElement(import_ui5.Stack, { gap: 1 }, /* @__PURE__ */ React5.createElement(
|
|
1049
|
+
import_ui5.Box,
|
|
1050
|
+
{
|
|
1051
|
+
className: "group-header",
|
|
1052
|
+
sx: {
|
|
1053
|
+
position: "relative",
|
|
1054
|
+
"&:hover .group-sortable-trigger": {
|
|
1055
|
+
visibility: "visible"
|
|
1056
|
+
},
|
|
1057
|
+
"& .group-sortable-trigger": {
|
|
1058
|
+
visibility: "hidden"
|
|
1059
|
+
},
|
|
1060
|
+
"&:hover .group-menu": {
|
|
1061
|
+
visibility: "visible"
|
|
1062
|
+
},
|
|
1063
|
+
"& .group-menu": {
|
|
1064
|
+
visibility: "hidden"
|
|
1065
|
+
}
|
|
1066
|
+
}
|
|
1067
|
+
},
|
|
1068
|
+
/* @__PURE__ */ React5.createElement(SortableTrigger, { triggerClassName: "group-sortable-trigger", ...sortableTriggerProps }),
|
|
1069
|
+
/* @__PURE__ */ React5.createElement(import_ui5.Stack, { direction: "row", alignItems: "center", justifyContent: "space-between", gap: 2 }, isThisGroupEditing ? /* @__PURE__ */ React5.createElement(
|
|
1070
|
+
import_ui5.Box,
|
|
1071
|
+
{
|
|
1072
|
+
sx: {
|
|
1073
|
+
flex: 1,
|
|
1074
|
+
height: 28,
|
|
1075
|
+
display: "flex",
|
|
1076
|
+
alignItems: "center",
|
|
1077
|
+
border: 2,
|
|
1078
|
+
borderColor: "text.secondary",
|
|
1079
|
+
borderRadius: 1,
|
|
1080
|
+
pl: 0.5
|
|
1081
|
+
}
|
|
1082
|
+
},
|
|
1083
|
+
/* @__PURE__ */ React5.createElement(
|
|
1084
|
+
import_editor_ui2.EditableField,
|
|
1085
|
+
{
|
|
1086
|
+
ref: editableRef,
|
|
1087
|
+
as: import_ui5.Typography,
|
|
1088
|
+
variant: "caption",
|
|
1089
|
+
error: error ?? void 0,
|
|
1090
|
+
sx: { color: "text.primary", fontWeight: 400, lineHeight: 1.66 },
|
|
1091
|
+
...getEditableProps()
|
|
1092
|
+
}
|
|
1093
|
+
)
|
|
1094
|
+
) : /* @__PURE__ */ React5.createElement(
|
|
1095
|
+
import_ui5.Typography,
|
|
1096
|
+
{
|
|
1097
|
+
variant: "caption",
|
|
1098
|
+
sx: { color: "text.primary", fontWeight: 400, lineHeight: 1.66 }
|
|
1099
|
+
},
|
|
1100
|
+
group.label
|
|
1101
|
+
), /* @__PURE__ */ React5.createElement(
|
|
1102
|
+
import_ui5.IconButton,
|
|
1103
|
+
{
|
|
1104
|
+
className: "group-menu",
|
|
1105
|
+
size: "tiny",
|
|
1106
|
+
sx: { p: 0.25, visibility: isThisGroupEditing ? "visible" : void 0 },
|
|
1107
|
+
"aria-label": (0, import_i18n4.__)("Group actions", "elementor"),
|
|
1108
|
+
...(0, import_ui5.bindTrigger)(popupState)
|
|
1109
|
+
},
|
|
1110
|
+
/* @__PURE__ */ React5.createElement(import_icons4.DotsVerticalIcon, { fontSize: "tiny" })
|
|
1111
|
+
))
|
|
1112
|
+
), /* @__PURE__ */ React5.createElement(import_ui5.List, { sx: { p: 0, display: "flex", flexDirection: "column", gap: 1 } }, /* @__PURE__ */ React5.createElement(SortableProvider, { value: group.props, onChange: onPropsReorder }, groupProps.map((prop) => /* @__PURE__ */ React5.createElement(SortableItem, { key: prop.overrideKey, id: prop.overrideKey }, ({ triggerProps, triggerStyle, isDragPlaceholder: isItemDragPlaceholder }) => /* @__PURE__ */ React5.createElement(
|
|
1113
|
+
PropertyItem,
|
|
1114
|
+
{
|
|
1115
|
+
prop,
|
|
1116
|
+
sortableTriggerProps: { ...triggerProps, style: triggerStyle },
|
|
1117
|
+
isDragPlaceholder: isItemDragPlaceholder,
|
|
1118
|
+
groups: allGroups,
|
|
1119
|
+
onDelete: onPropertyDelete,
|
|
1120
|
+
onUpdate: (data) => onPropertyUpdate(prop.overrideKey, data)
|
|
1121
|
+
}
|
|
1122
|
+
)))))),
|
|
1123
|
+
/* @__PURE__ */ React5.createElement(
|
|
1124
|
+
import_ui5.Menu,
|
|
1125
|
+
{
|
|
1126
|
+
...(0, import_ui5.bindMenu)(popupState),
|
|
1127
|
+
anchorOrigin: { vertical: "bottom", horizontal: "right" },
|
|
1128
|
+
transformOrigin: { vertical: "top", horizontal: "right" }
|
|
1129
|
+
},
|
|
1130
|
+
/* @__PURE__ */ React5.createElement(import_editor_ui2.MenuListItem, { sx: { minWidth: "160px" }, onClick: handleRenameClick }, /* @__PURE__ */ React5.createElement(import_ui5.Typography, { variant: "caption", sx: { color: "text.primary" } }, (0, import_i18n4.__)("Rename", "elementor"))),
|
|
1131
|
+
/* @__PURE__ */ React5.createElement(
|
|
1132
|
+
import_ui5.Tooltip,
|
|
1133
|
+
{
|
|
1134
|
+
title: hasProperties ? (0, import_i18n4.__)("To delete the group, first remove all the properties", "elementor") : "",
|
|
1135
|
+
placement: "right"
|
|
1136
|
+
},
|
|
1137
|
+
/* @__PURE__ */ React5.createElement("span", null, /* @__PURE__ */ React5.createElement(import_editor_ui2.MenuListItem, { onClick: handleDeleteClick, disabled: hasProperties }, /* @__PURE__ */ React5.createElement(
|
|
1138
|
+
import_ui5.Typography,
|
|
1139
|
+
{
|
|
1140
|
+
variant: "caption",
|
|
1141
|
+
sx: { color: hasProperties ? "text.disabled" : "error.light" }
|
|
1142
|
+
},
|
|
1143
|
+
(0, import_i18n4.__)("Delete", "elementor")
|
|
1144
|
+
)))
|
|
1145
|
+
)
|
|
1146
|
+
)
|
|
1147
|
+
);
|
|
1148
|
+
}
|
|
1149
|
+
|
|
1150
|
+
// src/components/component-properties-panel/use-current-editable-item.ts
|
|
1151
|
+
var import_react3 = require("react");
|
|
1152
|
+
var import_editor_documents3 = require("@elementor/editor-documents");
|
|
1153
|
+
var import_editor_ui3 = require("@elementor/editor-ui");
|
|
1154
|
+
var import_i18n6 = require("@wordpress/i18n");
|
|
1155
|
+
|
|
1156
|
+
// src/store/actions/rename-overridable-group.ts
|
|
1157
|
+
var import_store21 = require("@elementor/store");
|
|
1158
|
+
function renameOverridableGroup({ componentId, groupId, label }) {
|
|
1159
|
+
const overridableProps = selectOverridableProps((0, import_store21.__getState)(), componentId);
|
|
1160
|
+
if (!overridableProps) {
|
|
1161
|
+
return false;
|
|
1162
|
+
}
|
|
1163
|
+
const group = overridableProps.groups.items[groupId];
|
|
1164
|
+
if (!group) {
|
|
1165
|
+
return false;
|
|
1166
|
+
}
|
|
1167
|
+
const updatedGroups = renameGroup(overridableProps.groups, groupId, label);
|
|
1168
|
+
(0, import_store21.__dispatch)(
|
|
1169
|
+
slice.actions.setOverridableProps({
|
|
1170
|
+
componentId,
|
|
1171
|
+
overridableProps: {
|
|
1172
|
+
...overridableProps,
|
|
1173
|
+
groups: updatedGroups
|
|
1174
|
+
}
|
|
1175
|
+
})
|
|
1176
|
+
);
|
|
1177
|
+
return true;
|
|
1178
|
+
}
|
|
1179
|
+
|
|
1180
|
+
// src/components/component-properties-panel/utils/validate-group-label.ts
|
|
1181
|
+
var import_i18n5 = require("@wordpress/i18n");
|
|
1182
|
+
var ERROR_MESSAGES = {
|
|
1183
|
+
EMPTY_NAME: (0, import_i18n5.__)("Group name is required", "elementor"),
|
|
1184
|
+
DUPLICATE_NAME: (0, import_i18n5.__)("Group name already exists", "elementor")
|
|
1185
|
+
};
|
|
1186
|
+
function validateGroupLabel(label, existingGroups) {
|
|
1187
|
+
const trimmedLabel = label.trim();
|
|
1188
|
+
if (!trimmedLabel) {
|
|
1189
|
+
return ERROR_MESSAGES.EMPTY_NAME;
|
|
1190
|
+
}
|
|
1191
|
+
const isDuplicate = Object.values(existingGroups).some((group) => group.label === trimmedLabel);
|
|
1192
|
+
if (isDuplicate) {
|
|
1193
|
+
return ERROR_MESSAGES.DUPLICATE_NAME;
|
|
1194
|
+
}
|
|
1195
|
+
return "";
|
|
1196
|
+
}
|
|
1197
|
+
|
|
1198
|
+
// src/components/component-properties-panel/use-current-editable-item.ts
|
|
1199
|
+
function useCurrentEditableItem() {
|
|
1200
|
+
const [editingGroupId, setEditingGroupId] = (0, import_react3.useState)(null);
|
|
1201
|
+
const currentComponentId = useCurrentComponentId();
|
|
1202
|
+
const overridableProps = useOverridableProps(currentComponentId);
|
|
1203
|
+
const allGroupsRecord = overridableProps?.groups?.items ?? {};
|
|
1204
|
+
const currentGroup = editingGroupId ? allGroupsRecord[editingGroupId] : null;
|
|
1205
|
+
const validateLabel = (newLabel) => {
|
|
1206
|
+
const otherGroups = Object.fromEntries(
|
|
1207
|
+
Object.entries(allGroupsRecord).filter(([id2]) => id2 !== editingGroupId)
|
|
1208
|
+
);
|
|
1209
|
+
return validateGroupLabel(newLabel, otherGroups) || null;
|
|
1210
|
+
};
|
|
1211
|
+
const handleSubmit = (newLabel) => {
|
|
1212
|
+
if (!editingGroupId || !currentComponentId) {
|
|
1213
|
+
throw new Error((0, import_i18n6.__)("Group ID or component ID is missing", "elementor"));
|
|
1214
|
+
}
|
|
1215
|
+
renameOverridableGroup({
|
|
1216
|
+
componentId: currentComponentId,
|
|
1217
|
+
groupId: editingGroupId,
|
|
1218
|
+
label: newLabel
|
|
1219
|
+
});
|
|
1220
|
+
(0, import_editor_documents3.setDocumentModifiedStatus)(true);
|
|
1221
|
+
};
|
|
1222
|
+
const {
|
|
1223
|
+
ref: editableRef,
|
|
1224
|
+
openEditMode,
|
|
1225
|
+
isEditing,
|
|
1226
|
+
error,
|
|
1227
|
+
getProps: getEditableProps
|
|
1228
|
+
} = (0, import_editor_ui3.useEditable)({
|
|
1229
|
+
value: currentGroup?.label ?? "",
|
|
1230
|
+
onSubmit: handleSubmit,
|
|
1231
|
+
validation: validateLabel
|
|
1232
|
+
});
|
|
1233
|
+
return {
|
|
1234
|
+
editableRef,
|
|
1235
|
+
isEditing,
|
|
1236
|
+
error,
|
|
1237
|
+
getEditableProps,
|
|
1238
|
+
setEditingGroupId: (groupId) => {
|
|
1239
|
+
setEditingGroupId(groupId);
|
|
1240
|
+
openEditMode();
|
|
1241
|
+
},
|
|
1242
|
+
editingGroupId
|
|
1243
|
+
};
|
|
1244
|
+
}
|
|
1245
|
+
|
|
1246
|
+
// src/components/component-properties-panel/utils/generate-unique-label.ts
|
|
1247
|
+
var DEFAULT_NEW_GROUP_LABEL = "New group";
|
|
1248
|
+
function generateUniqueLabel(groups) {
|
|
1249
|
+
const existingLabels = new Set(groups.map((group) => group.label));
|
|
1250
|
+
if (!existingLabels.has(DEFAULT_NEW_GROUP_LABEL)) {
|
|
1251
|
+
return DEFAULT_NEW_GROUP_LABEL;
|
|
1252
|
+
}
|
|
1253
|
+
let index = 1;
|
|
1254
|
+
let newLabel = `${DEFAULT_NEW_GROUP_LABEL}-${index}`;
|
|
1255
|
+
while (existingLabels.has(newLabel)) {
|
|
1256
|
+
index++;
|
|
1257
|
+
newLabel = `${DEFAULT_NEW_GROUP_LABEL}-${index}`;
|
|
1258
|
+
}
|
|
1259
|
+
return newLabel;
|
|
1260
|
+
}
|
|
1261
|
+
|
|
1262
|
+
// src/components/component-properties-panel/component-properties-panel-content.tsx
|
|
1263
|
+
function ComponentPropertiesPanelContent({ onClose }) {
|
|
1264
|
+
const currentComponentId = useCurrentComponentId();
|
|
1265
|
+
const overridableProps = useOverridableProps(currentComponentId);
|
|
1266
|
+
const [isAddingGroup, setIsAddingGroup] = (0, import_react4.useState)(false);
|
|
1267
|
+
const groupLabelEditable = useCurrentEditableItem();
|
|
1268
|
+
const groups = (0, import_react4.useMemo)(() => {
|
|
1269
|
+
if (!overridableProps) {
|
|
1270
|
+
return [];
|
|
1271
|
+
}
|
|
1272
|
+
return overridableProps.groups.order.map((groupId) => overridableProps.groups.items[groupId] ?? null).filter(Boolean);
|
|
1273
|
+
}, [overridableProps]);
|
|
1274
|
+
const allGroupsForSelect = (0, import_react4.useMemo)(
|
|
1275
|
+
() => groups.map((group) => ({ value: group.id, label: group.label })),
|
|
1276
|
+
[groups]
|
|
1277
|
+
);
|
|
1278
|
+
if (!currentComponentId || !overridableProps) {
|
|
1279
|
+
return null;
|
|
1280
|
+
}
|
|
1281
|
+
const hasGroups = groups.length > 0;
|
|
1282
|
+
const showEmptyState = !hasGroups && !isAddingGroup;
|
|
1283
|
+
const groupIds = overridableProps.groups.order;
|
|
1284
|
+
const handleAddGroupClick = () => {
|
|
1285
|
+
if (isAddingGroup) {
|
|
1286
|
+
return;
|
|
1287
|
+
}
|
|
1288
|
+
const newGroupId = (0, import_utils2.generateUniqueId)("group");
|
|
1289
|
+
const newLabel = generateUniqueLabel(groups);
|
|
1290
|
+
addOverridableGroup({ componentId: currentComponentId, groupId: newGroupId, label: newLabel });
|
|
1291
|
+
(0, import_editor_documents4.setDocumentModifiedStatus)(true);
|
|
1292
|
+
setIsAddingGroup(false);
|
|
1293
|
+
groupLabelEditable.setEditingGroupId(newGroupId);
|
|
1294
|
+
};
|
|
1295
|
+
const handleGroupsReorder = (newOrder) => {
|
|
1296
|
+
reorderOverridableGroups({ componentId: currentComponentId, newOrder });
|
|
1297
|
+
(0, import_editor_documents4.setDocumentModifiedStatus)(true);
|
|
1298
|
+
};
|
|
1299
|
+
const handlePropsReorder = (groupId, newPropsOrder) => {
|
|
1300
|
+
reorderGroupProps({ componentId: currentComponentId, groupId, newPropsOrder });
|
|
1301
|
+
(0, import_editor_documents4.setDocumentModifiedStatus)(true);
|
|
1302
|
+
};
|
|
1303
|
+
const handlePropertyDelete = (propKey) => {
|
|
1304
|
+
deleteOverridableProp({ componentId: currentComponentId, propKey });
|
|
1305
|
+
(0, import_editor_documents4.setDocumentModifiedStatus)(true);
|
|
1306
|
+
};
|
|
1307
|
+
const handlePropertyUpdate = (propKey, data) => {
|
|
1308
|
+
updateOverridableProp({
|
|
1309
|
+
componentId: currentComponentId,
|
|
1310
|
+
propKey,
|
|
1311
|
+
label: data.label,
|
|
1312
|
+
groupId: data.group
|
|
1313
|
+
});
|
|
1314
|
+
(0, import_editor_documents4.setDocumentModifiedStatus)(true);
|
|
1315
|
+
};
|
|
1316
|
+
const handleGroupDelete = (groupId) => {
|
|
1317
|
+
deleteOverridableGroup({ componentId: currentComponentId, groupId });
|
|
1318
|
+
(0, import_editor_documents4.setDocumentModifiedStatus)(true);
|
|
1319
|
+
};
|
|
1320
|
+
return /* @__PURE__ */ React6.createElement(React6.Fragment, null, /* @__PURE__ */ React6.createElement(import_editor_panels.PanelHeader, { sx: { justifyContent: "start", pl: 1.5, pr: 1, py: 1 } }, /* @__PURE__ */ React6.createElement(import_ui6.Stack, { direction: "row", alignItems: "center", gap: 0.5, flexGrow: 1 }, /* @__PURE__ */ React6.createElement(import_icons5.ComponentPropListIcon, { fontSize: "tiny" }), /* @__PURE__ */ React6.createElement(import_editor_panels.PanelHeaderTitle, { variant: "subtitle2" }, (0, import_i18n7.__)("Component properties", "elementor"))), !showEmptyState && /* @__PURE__ */ React6.createElement(import_ui6.Tooltip, { title: (0, import_i18n7.__)("Add new group", "elementor") }, /* @__PURE__ */ React6.createElement(
|
|
1321
|
+
import_ui6.IconButton,
|
|
1322
|
+
{
|
|
1323
|
+
size: "tiny",
|
|
1324
|
+
"aria-label": (0, import_i18n7.__)("Add new group", "elementor"),
|
|
1325
|
+
onClick: handleAddGroupClick
|
|
1326
|
+
},
|
|
1327
|
+
/* @__PURE__ */ React6.createElement(import_icons5.FolderPlusIcon, { fontSize: "tiny" })
|
|
1328
|
+
)), /* @__PURE__ */ React6.createElement(import_ui6.Tooltip, { title: (0, import_i18n7.__)("Close panel", "elementor") }, /* @__PURE__ */ React6.createElement(import_ui6.IconButton, { size: "tiny", "aria-label": (0, import_i18n7.__)("Close panel", "elementor"), onClick: onClose }, /* @__PURE__ */ React6.createElement(import_icons5.XIcon, { fontSize: "tiny" })))), /* @__PURE__ */ React6.createElement(import_ui6.Divider, null), /* @__PURE__ */ React6.createElement(import_editor_panels.PanelBody, null, showEmptyState ? /* @__PURE__ */ React6.createElement(PropertiesEmptyState, null) : /* @__PURE__ */ React6.createElement(import_ui6.List, { sx: { p: 2, display: "flex", flexDirection: "column", gap: 2 } }, /* @__PURE__ */ React6.createElement(SortableProvider, { value: groupIds, onChange: handleGroupsReorder }, groups.map((group) => /* @__PURE__ */ React6.createElement(SortableItem, { key: group.id, id: group.id }, ({ triggerProps, triggerStyle, isDragPlaceholder }) => /* @__PURE__ */ React6.createElement(
|
|
1329
|
+
PropertiesGroup,
|
|
1330
|
+
{
|
|
1331
|
+
group,
|
|
1332
|
+
props: overridableProps.props,
|
|
1333
|
+
allGroups: allGroupsForSelect,
|
|
1334
|
+
allGroupsRecord: overridableProps.groups.items,
|
|
1335
|
+
sortableTriggerProps: { ...triggerProps, style: triggerStyle },
|
|
1336
|
+
isDragPlaceholder,
|
|
1337
|
+
setIsAddingGroup,
|
|
1338
|
+
onPropsReorder: (newOrder) => handlePropsReorder(group.id, newOrder),
|
|
1339
|
+
onPropertyDelete: handlePropertyDelete,
|
|
1340
|
+
onPropertyUpdate: handlePropertyUpdate,
|
|
1341
|
+
editableLabelProps: groupLabelEditable,
|
|
1342
|
+
onGroupDelete: handleGroupDelete
|
|
1343
|
+
}
|
|
1344
|
+
)))))));
|
|
1345
|
+
}
|
|
1346
|
+
|
|
1347
|
+
// src/components/component-properties-panel/component-properties-panel.tsx
|
|
1348
|
+
var id = "component-properties-panel";
|
|
1349
|
+
var { panel, usePanelActions } = (0, import_editor_panels2.__createPanel)({
|
|
1350
|
+
id,
|
|
1351
|
+
component: ComponentPropertiesPanel
|
|
1352
|
+
});
|
|
1353
|
+
function ComponentPropertiesPanel() {
|
|
1354
|
+
const { element, elementType } = (0, import_editor_elements3.useSelectedElement)();
|
|
1355
|
+
const { close: closePanel } = usePanelActions();
|
|
1356
|
+
const { open: openEditingPanel } = (0, import_editor_editing_panel.usePanelActions)();
|
|
1357
|
+
if (!element || !elementType) {
|
|
1358
|
+
return null;
|
|
1359
|
+
}
|
|
1360
|
+
return /* @__PURE__ */ React7.createElement(import_editor_ui4.ThemeProvider, null, /* @__PURE__ */ React7.createElement(import_ui7.ErrorBoundary, { fallback: /* @__PURE__ */ React7.createElement(ErrorBoundaryFallback, null) }, /* @__PURE__ */ React7.createElement(import_editor_editing_panel.ElementProvider, { element, elementType }, /* @__PURE__ */ React7.createElement(import_editor_panels2.Panel, null, /* @__PURE__ */ React7.createElement(
|
|
1361
|
+
ComponentPropertiesPanelContent,
|
|
1362
|
+
{
|
|
1363
|
+
onClose: () => {
|
|
1364
|
+
closePanel();
|
|
1365
|
+
openEditingPanel();
|
|
1366
|
+
}
|
|
1367
|
+
}
|
|
1368
|
+
)))));
|
|
1369
|
+
}
|
|
1370
|
+
var ErrorBoundaryFallback = () => /* @__PURE__ */ React7.createElement(import_ui7.Box, { role: "alert", sx: { minHeight: "100%", p: 2 } }, /* @__PURE__ */ React7.createElement(import_ui7.Alert, { severity: "error", sx: { mb: 2, maxWidth: 400, textAlign: "center" } }, /* @__PURE__ */ React7.createElement("strong", null, (0, import_i18n8.__)("Something went wrong", "elementor"))));
|
|
1371
|
+
|
|
1372
|
+
// src/components/components-tab/component-introduction.tsx
|
|
1373
|
+
var React8 = __toESM(require("react"));
|
|
1374
|
+
var import_editor_controls = require("@elementor/editor-controls");
|
|
1375
|
+
var import_editor_ui5 = require("@elementor/editor-ui");
|
|
1376
|
+
var import_ui8 = require("@elementor/ui");
|
|
1377
|
+
var import_i18n9 = require("@wordpress/i18n");
|
|
386
1378
|
var ComponentIntroduction = ({
|
|
387
1379
|
anchorRef,
|
|
388
1380
|
shouldShowIntroduction,
|
|
@@ -391,8 +1383,8 @@ var ComponentIntroduction = ({
|
|
|
391
1383
|
if (!anchorRef.current || !shouldShowIntroduction) {
|
|
392
1384
|
return null;
|
|
393
1385
|
}
|
|
394
|
-
return /* @__PURE__ */
|
|
395
|
-
|
|
1386
|
+
return /* @__PURE__ */ React8.createElement(
|
|
1387
|
+
import_ui8.Popover,
|
|
396
1388
|
{
|
|
397
1389
|
anchorEl: anchorRef.current,
|
|
398
1390
|
open: shouldShowIntroduction,
|
|
@@ -406,34 +1398,34 @@ var ComponentIntroduction = ({
|
|
|
406
1398
|
},
|
|
407
1399
|
onClose
|
|
408
1400
|
},
|
|
409
|
-
/* @__PURE__ */
|
|
410
|
-
|
|
1401
|
+
/* @__PURE__ */ React8.createElement(import_ui8.Box, { sx: { width: "296px" } }, /* @__PURE__ */ React8.createElement(import_editor_ui5.PopoverHeader, { title: (0, import_i18n9.__)("Add your first property", "elementor"), onClose }), /* @__PURE__ */ React8.createElement(
|
|
1402
|
+
import_ui8.Image,
|
|
411
1403
|
{
|
|
412
1404
|
sx: { width: "296px", height: "160px" },
|
|
413
1405
|
src: "https://assets.elementor.com/packages/v1/images/components-properties-intro.png",
|
|
414
1406
|
alt: ""
|
|
415
1407
|
}
|
|
416
|
-
), /* @__PURE__ */
|
|
1408
|
+
), /* @__PURE__ */ React8.createElement(import_editor_controls.PopoverContent, null, /* @__PURE__ */ React8.createElement(import_ui8.Stack, { gap: 1, sx: { p: 2 } }, /* @__PURE__ */ React8.createElement(import_ui8.Typography, { variant: "body2" }, (0, import_i18n9.__)("Properties make instances flexible.", "elementor")), /* @__PURE__ */ React8.createElement(import_ui8.Typography, { variant: "body2" }, (0, import_i18n9.__)(
|
|
417
1409
|
"Click next to any setting you want users to customize - like text, images, or links.",
|
|
418
1410
|
"elementor"
|
|
419
|
-
)), /* @__PURE__ */
|
|
1411
|
+
)), /* @__PURE__ */ React8.createElement(import_ui8.Typography, { variant: "body2" }, (0, import_i18n9.__)(
|
|
420
1412
|
"Your properties will appear in the Properties panel, where you can organize and manage them anytime.",
|
|
421
1413
|
"elementor"
|
|
422
|
-
)), /* @__PURE__ */
|
|
1414
|
+
)), /* @__PURE__ */ React8.createElement(import_ui8.Stack, { direction: "row", alignItems: "center", justifyContent: "flex-end" }, /* @__PURE__ */ React8.createElement(import_ui8.Button, { size: "medium", variant: "contained", onClick: onClose }, (0, import_i18n9.__)("Got it", "elementor"))))))
|
|
423
1415
|
);
|
|
424
1416
|
};
|
|
425
1417
|
|
|
426
1418
|
// src/components/component-panel-header/component-badge.tsx
|
|
427
|
-
var
|
|
428
|
-
var
|
|
429
|
-
var
|
|
430
|
-
var
|
|
431
|
-
var
|
|
432
|
-
var ComponentsBadge =
|
|
433
|
-
({ overridesCount }, ref) => {
|
|
1419
|
+
var React9 = __toESM(require("react"));
|
|
1420
|
+
var import_react5 = require("react");
|
|
1421
|
+
var import_icons6 = require("@elementor/icons");
|
|
1422
|
+
var import_ui9 = require("@elementor/ui");
|
|
1423
|
+
var import_i18n10 = require("@wordpress/i18n");
|
|
1424
|
+
var ComponentsBadge = React9.forwardRef(
|
|
1425
|
+
({ overridesCount, onClick }, ref) => {
|
|
434
1426
|
const prevCount = usePrevious(overridesCount);
|
|
435
1427
|
const isFirstOverride = prevCount === 0 && overridesCount === 1;
|
|
436
|
-
return /* @__PURE__ */
|
|
1428
|
+
return /* @__PURE__ */ React9.createElement(
|
|
437
1429
|
StyledBadge,
|
|
438
1430
|
{
|
|
439
1431
|
ref,
|
|
@@ -442,13 +1434,22 @@ var ComponentsBadge = React2.forwardRef(
|
|
|
442
1434
|
invisible: overridesCount === 0,
|
|
443
1435
|
animate: isFirstOverride,
|
|
444
1436
|
anchorOrigin: { vertical: "top", horizontal: "right" },
|
|
445
|
-
badgeContent: /* @__PURE__ */
|
|
1437
|
+
badgeContent: /* @__PURE__ */ React9.createElement(import_ui9.Box, { sx: { animation: !isFirstOverride ? `${slideUp} 300ms ease-out` : "none" } }, overridesCount)
|
|
446
1438
|
},
|
|
447
|
-
/* @__PURE__ */
|
|
1439
|
+
/* @__PURE__ */ React9.createElement(
|
|
1440
|
+
import_ui9.ToggleButton,
|
|
1441
|
+
{
|
|
1442
|
+
value: "overrides",
|
|
1443
|
+
size: "tiny",
|
|
1444
|
+
onClick,
|
|
1445
|
+
"aria-label": (0, import_i18n10.__)("View overrides", "elementor")
|
|
1446
|
+
},
|
|
1447
|
+
/* @__PURE__ */ React9.createElement(import_icons6.ComponentPropListIcon, { fontSize: "tiny" })
|
|
1448
|
+
)
|
|
448
1449
|
);
|
|
449
1450
|
}
|
|
450
1451
|
);
|
|
451
|
-
var StyledBadge = (0,
|
|
1452
|
+
var StyledBadge = (0, import_ui9.styled)(import_ui9.Badge, { shouldForwardProp: (prop) => prop !== "animate" })(
|
|
452
1453
|
({ theme, animate }) => ({
|
|
453
1454
|
"& .MuiBadge-badge": {
|
|
454
1455
|
minWidth: theme.spacing(2),
|
|
@@ -461,33 +1462,22 @@ var StyledBadge = (0, import_ui2.styled)(import_ui2.Badge, { shouldForwardProp:
|
|
|
461
1462
|
})
|
|
462
1463
|
);
|
|
463
1464
|
function usePrevious(value) {
|
|
464
|
-
const ref = (0,
|
|
465
|
-
(0,
|
|
1465
|
+
const ref = (0, import_react5.useRef)(value);
|
|
1466
|
+
(0, import_react5.useEffect)(() => {
|
|
466
1467
|
ref.current = value;
|
|
467
1468
|
}, [value]);
|
|
468
1469
|
return ref.current;
|
|
469
1470
|
}
|
|
470
|
-
var bounceIn =
|
|
1471
|
+
var bounceIn = import_ui9.keyframes`
|
|
471
1472
|
0% { transform: scale(0) translate(50%, 50%); opacity: 0; }
|
|
472
1473
|
70% { transform: scale(1.1) translate(50%, -50%); opacity: 1; }
|
|
473
1474
|
100% { transform: scale(1) translate(50%, -50%); opacity: 1; }
|
|
474
1475
|
`;
|
|
475
|
-
var slideUp =
|
|
1476
|
+
var slideUp = import_ui9.keyframes`
|
|
476
1477
|
from { transform: translateY(100%); opacity: 0; }
|
|
477
1478
|
to { transform: translateY(0); opacity: 1; }
|
|
478
1479
|
`;
|
|
479
1480
|
|
|
480
|
-
// src/components/component-panel-header/use-overridable-props.ts
|
|
481
|
-
var import_store7 = require("@elementor/store");
|
|
482
|
-
function useOverridableProps(componentId) {
|
|
483
|
-
return (0, import_store7.__useSelector)((state) => {
|
|
484
|
-
if (!componentId) {
|
|
485
|
-
return void 0;
|
|
486
|
-
}
|
|
487
|
-
return selectOverridableProps(state, componentId);
|
|
488
|
-
});
|
|
489
|
-
}
|
|
490
|
-
|
|
491
1481
|
// src/components/component-panel-header/component-panel-header.tsx
|
|
492
1482
|
var MESSAGE_KEY = "components-properties-introduction";
|
|
493
1483
|
var ComponentPanelHeader = () => {
|
|
@@ -496,9 +1486,10 @@ var ComponentPanelHeader = () => {
|
|
|
496
1486
|
const onBack = useNavigateBack();
|
|
497
1487
|
const componentName = getComponentName();
|
|
498
1488
|
const [isMessageSuppressed, suppressMessage] = (0, import_editor_current_user.useSuppressedMessage)(MESSAGE_KEY);
|
|
499
|
-
const [shouldShowIntroduction, setShouldShowIntroduction] =
|
|
1489
|
+
const [shouldShowIntroduction, setShouldShowIntroduction] = React10.useState(!isMessageSuppressed);
|
|
1490
|
+
const { open: openPropertiesPanel } = usePanelActions();
|
|
500
1491
|
const overridesCount = overridableProps ? Object.keys(overridableProps.props).length : 0;
|
|
501
|
-
const anchorRef =
|
|
1492
|
+
const anchorRef = React10.useRef(null);
|
|
502
1493
|
if (!currentComponentId) {
|
|
503
1494
|
return null;
|
|
504
1495
|
}
|
|
@@ -506,17 +1497,17 @@ var ComponentPanelHeader = () => {
|
|
|
506
1497
|
suppressMessage();
|
|
507
1498
|
setShouldShowIntroduction(false);
|
|
508
1499
|
};
|
|
509
|
-
return /* @__PURE__ */
|
|
510
|
-
|
|
1500
|
+
return /* @__PURE__ */ React10.createElement(import_ui10.Box, null, /* @__PURE__ */ React10.createElement(
|
|
1501
|
+
import_ui10.Stack,
|
|
511
1502
|
{
|
|
512
1503
|
direction: "row",
|
|
513
1504
|
alignItems: "center",
|
|
514
1505
|
justifyContent: "space-between",
|
|
515
1506
|
sx: { height: 48, pl: 1.5, pr: 2, py: 1 }
|
|
516
1507
|
},
|
|
517
|
-
/* @__PURE__ */
|
|
518
|
-
/* @__PURE__ */
|
|
519
|
-
), /* @__PURE__ */
|
|
1508
|
+
/* @__PURE__ */ React10.createElement(import_ui10.Stack, { direction: "row", alignItems: "center" }, /* @__PURE__ */ React10.createElement(import_ui10.Tooltip, { title: (0, import_i18n11.__)("Back", "elementor") }, /* @__PURE__ */ React10.createElement(import_ui10.IconButton, { size: "tiny", onClick: onBack, "aria-label": (0, import_i18n11.__)("Back", "elementor") }, /* @__PURE__ */ React10.createElement(import_icons7.ArrowLeftIcon, { fontSize: "tiny" }))), /* @__PURE__ */ React10.createElement(import_ui10.Stack, { direction: "row", alignItems: "center", gap: 0.5 }, /* @__PURE__ */ React10.createElement(import_icons7.ComponentsFilledIcon, { fontSize: "tiny", stroke: "currentColor" }), /* @__PURE__ */ React10.createElement(import_ui10.Typography, { variant: "caption", sx: { fontWeight: 500 } }, componentName))),
|
|
1509
|
+
/* @__PURE__ */ React10.createElement(ComponentsBadge, { overridesCount, ref: anchorRef, onClick: openPropertiesPanel })
|
|
1510
|
+
), /* @__PURE__ */ React10.createElement(import_ui10.Divider, null), /* @__PURE__ */ React10.createElement(
|
|
520
1511
|
ComponentIntroduction,
|
|
521
1512
|
{
|
|
522
1513
|
anchorRef,
|
|
@@ -526,38 +1517,38 @@ var ComponentPanelHeader = () => {
|
|
|
526
1517
|
));
|
|
527
1518
|
};
|
|
528
1519
|
function getComponentName() {
|
|
529
|
-
const documentsManager = (0,
|
|
1520
|
+
const documentsManager = (0, import_editor_documents5.getV1DocumentsManager)();
|
|
530
1521
|
const currentDocument = documentsManager.getCurrent();
|
|
531
1522
|
return currentDocument?.container?.settings?.get("post_title") ?? "";
|
|
532
1523
|
}
|
|
533
1524
|
|
|
534
1525
|
// src/components/components-tab/components.tsx
|
|
535
|
-
var
|
|
536
|
-
var
|
|
1526
|
+
var React16 = __toESM(require("react"));
|
|
1527
|
+
var import_editor_ui7 = require("@elementor/editor-ui");
|
|
537
1528
|
|
|
538
1529
|
// src/components/components-tab/component-search.tsx
|
|
539
|
-
var
|
|
540
|
-
var
|
|
541
|
-
var
|
|
542
|
-
var
|
|
1530
|
+
var React12 = __toESM(require("react"));
|
|
1531
|
+
var import_icons8 = require("@elementor/icons");
|
|
1532
|
+
var import_ui11 = require("@elementor/ui");
|
|
1533
|
+
var import_i18n12 = require("@wordpress/i18n");
|
|
543
1534
|
|
|
544
1535
|
// src/components/components-tab/search-provider.tsx
|
|
545
|
-
var
|
|
546
|
-
var
|
|
547
|
-
var
|
|
548
|
-
var SearchContext = (0,
|
|
1536
|
+
var React11 = __toESM(require("react"));
|
|
1537
|
+
var import_react6 = require("react");
|
|
1538
|
+
var import_utils3 = require("@elementor/utils");
|
|
1539
|
+
var SearchContext = (0, import_react6.createContext)(void 0);
|
|
549
1540
|
var SearchProvider = ({
|
|
550
1541
|
children,
|
|
551
1542
|
localStorageKey
|
|
552
1543
|
}) => {
|
|
553
|
-
const { debouncedValue, handleChange, inputValue } = (0,
|
|
1544
|
+
const { debouncedValue, handleChange, inputValue } = (0, import_utils3.useSearchState)({ localStorageKey });
|
|
554
1545
|
const clearSearch = () => {
|
|
555
1546
|
handleChange("");
|
|
556
1547
|
};
|
|
557
|
-
return /* @__PURE__ */
|
|
1548
|
+
return /* @__PURE__ */ React11.createElement(SearchContext.Provider, { value: { handleChange, clearSearch, searchValue: debouncedValue, inputValue } }, children);
|
|
558
1549
|
};
|
|
559
1550
|
var useSearch = () => {
|
|
560
|
-
const context = (0,
|
|
1551
|
+
const context = (0, import_react6.useContext)(SearchContext);
|
|
561
1552
|
if (!context) {
|
|
562
1553
|
throw new Error("useSearch must be used within a SearchProvider");
|
|
563
1554
|
}
|
|
@@ -567,69 +1558,69 @@ var useSearch = () => {
|
|
|
567
1558
|
// src/components/components-tab/component-search.tsx
|
|
568
1559
|
var ComponentSearch = () => {
|
|
569
1560
|
const { inputValue, handleChange } = useSearch();
|
|
570
|
-
return /* @__PURE__ */
|
|
571
|
-
|
|
1561
|
+
return /* @__PURE__ */ React12.createElement(import_ui11.Stack, { direction: "row", gap: 0.5, sx: { width: "100%", px: 2, py: 1.5 } }, /* @__PURE__ */ React12.createElement(import_ui11.Box, { sx: { flexGrow: 1 } }, /* @__PURE__ */ React12.createElement(
|
|
1562
|
+
import_ui11.TextField,
|
|
572
1563
|
{
|
|
573
1564
|
role: "search",
|
|
574
1565
|
fullWidth: true,
|
|
575
1566
|
size: "tiny",
|
|
576
1567
|
value: inputValue,
|
|
577
|
-
placeholder: (0,
|
|
1568
|
+
placeholder: (0, import_i18n12.__)("Search", "elementor"),
|
|
578
1569
|
onChange: (e) => handleChange(e.target.value),
|
|
579
1570
|
InputProps: {
|
|
580
|
-
startAdornment: /* @__PURE__ */
|
|
1571
|
+
startAdornment: /* @__PURE__ */ React12.createElement(import_ui11.InputAdornment, { position: "start" }, /* @__PURE__ */ React12.createElement(import_icons8.SearchIcon, { fontSize: "tiny" }))
|
|
581
1572
|
}
|
|
582
1573
|
}
|
|
583
1574
|
)));
|
|
584
1575
|
};
|
|
585
1576
|
|
|
586
1577
|
// src/components/components-tab/components-list.tsx
|
|
587
|
-
var
|
|
588
|
-
var
|
|
589
|
-
var
|
|
590
|
-
var
|
|
1578
|
+
var React15 = __toESM(require("react"));
|
|
1579
|
+
var import_icons10 = require("@elementor/icons");
|
|
1580
|
+
var import_ui14 = require("@elementor/ui");
|
|
1581
|
+
var import_i18n15 = require("@wordpress/i18n");
|
|
591
1582
|
|
|
592
1583
|
// src/hooks/use-components.ts
|
|
593
|
-
var
|
|
1584
|
+
var import_store26 = require("@elementor/store");
|
|
594
1585
|
var useComponents = () => {
|
|
595
|
-
const components = (0,
|
|
596
|
-
const isLoading = (0,
|
|
1586
|
+
const components = (0, import_store26.__useSelector)(selectComponents);
|
|
1587
|
+
const isLoading = (0, import_store26.__useSelector)(selectLoadIsPending);
|
|
597
1588
|
return { components, isLoading };
|
|
598
1589
|
};
|
|
599
1590
|
|
|
600
1591
|
// src/components/components-tab/components-item.tsx
|
|
601
|
-
var
|
|
1592
|
+
var React13 = __toESM(require("react"));
|
|
602
1593
|
var import_editor_canvas5 = require("@elementor/editor-canvas");
|
|
603
|
-
var
|
|
604
|
-
var
|
|
605
|
-
var
|
|
606
|
-
var
|
|
607
|
-
var
|
|
1594
|
+
var import_editor_elements6 = require("@elementor/editor-elements");
|
|
1595
|
+
var import_editor_ui6 = require("@elementor/editor-ui");
|
|
1596
|
+
var import_icons9 = require("@elementor/icons");
|
|
1597
|
+
var import_ui12 = require("@elementor/ui");
|
|
1598
|
+
var import_i18n14 = require("@wordpress/i18n");
|
|
608
1599
|
|
|
609
1600
|
// src/store/actions/archive-component.ts
|
|
610
|
-
var
|
|
611
|
-
var
|
|
1601
|
+
var import_editor_documents6 = require("@elementor/editor-documents");
|
|
1602
|
+
var import_store28 = require("@elementor/store");
|
|
612
1603
|
var archiveComponent = (componentId) => {
|
|
613
|
-
const store = (0,
|
|
614
|
-
const
|
|
615
|
-
if (!
|
|
1604
|
+
const store = (0, import_store28.__getStore)();
|
|
1605
|
+
const dispatch16 = store?.dispatch;
|
|
1606
|
+
if (!dispatch16) {
|
|
616
1607
|
return;
|
|
617
1608
|
}
|
|
618
|
-
|
|
619
|
-
(0,
|
|
1609
|
+
dispatch16(slice.actions.archive(componentId));
|
|
1610
|
+
(0, import_editor_documents6.setDocumentModifiedStatus)(true);
|
|
620
1611
|
};
|
|
621
1612
|
|
|
622
1613
|
// src/store/actions/load-components-assets.ts
|
|
623
|
-
var
|
|
1614
|
+
var import_editor_documents8 = require("@elementor/editor-documents");
|
|
624
1615
|
|
|
625
1616
|
// src/create-component-type.ts
|
|
626
1617
|
var import_editor_canvas4 = require("@elementor/editor-canvas");
|
|
627
|
-
var
|
|
628
|
-
var
|
|
1618
|
+
var import_editor_documents7 = require("@elementor/editor-documents");
|
|
1619
|
+
var import_i18n13 = require("@wordpress/i18n");
|
|
629
1620
|
|
|
630
1621
|
// src/utils/tracking.ts
|
|
631
1622
|
var import_mixpanel = require("@elementor/mixpanel");
|
|
632
|
-
var
|
|
1623
|
+
var import_store30 = require("@elementor/store");
|
|
633
1624
|
var trackComponentEvent = ({ action, ...data }) => {
|
|
634
1625
|
const { dispatchEvent, config } = (0, import_mixpanel.getMixpanel)();
|
|
635
1626
|
if (!config?.names?.components?.[action]) {
|
|
@@ -646,7 +1637,7 @@ var onElementDrop = (_args, element) => {
|
|
|
646
1637
|
const componentName = editorSettings?.title;
|
|
647
1638
|
const componentUID = editorSettings?.component_uid;
|
|
648
1639
|
const instanceId = element.id;
|
|
649
|
-
const createdThisSession = selectCreatedThisSession((0,
|
|
1640
|
+
const createdThisSession = selectCreatedThisSession((0, import_store30.__getState)());
|
|
650
1641
|
const isSameSessionReuse = componentUID && createdThisSession.includes(componentUID);
|
|
651
1642
|
const eventsManagerConfig = window.elementorCommon.eventsManager.config;
|
|
652
1643
|
const { locations, secondaryLocations } = eventsManagerConfig;
|
|
@@ -694,7 +1685,7 @@ function createComponentView(options) {
|
|
|
694
1685
|
legacyWindow = window;
|
|
695
1686
|
eventsManagerConfig = this.legacyWindow.elementorCommon.eventsManager.config;
|
|
696
1687
|
isComponentCurrentlyEdited() {
|
|
697
|
-
const currentDocument = (0,
|
|
1688
|
+
const currentDocument = (0, import_editor_documents7.getCurrentDocument)();
|
|
698
1689
|
return currentDocument?.id === this.getComponentId();
|
|
699
1690
|
}
|
|
700
1691
|
afterSettingsResolve(settings) {
|
|
@@ -745,7 +1736,7 @@ function createComponentView(options) {
|
|
|
745
1736
|
action: {
|
|
746
1737
|
name: "edit component",
|
|
747
1738
|
icon: "eicon-edit",
|
|
748
|
-
title: () => (0,
|
|
1739
|
+
title: () => (0, import_i18n13.__)("Edit Component", "elementor"),
|
|
749
1740
|
isEnabled: () => true,
|
|
750
1741
|
callback: (_, eventData) => this.editComponent(eventData)
|
|
751
1742
|
}
|
|
@@ -840,7 +1831,7 @@ var getComponentIds = async (elements) => {
|
|
|
840
1831
|
};
|
|
841
1832
|
|
|
842
1833
|
// src/store/actions/load-components-overridable-props.ts
|
|
843
|
-
var
|
|
1834
|
+
var import_store32 = require("@elementor/store");
|
|
844
1835
|
function loadComponentsOverridableProps(componentIds) {
|
|
845
1836
|
if (!componentIds.length) {
|
|
846
1837
|
return;
|
|
@@ -848,7 +1839,7 @@ function loadComponentsOverridableProps(componentIds) {
|
|
|
848
1839
|
componentIds.forEach(loadComponentOverrides);
|
|
849
1840
|
}
|
|
850
1841
|
async function loadComponentOverrides(componentId) {
|
|
851
|
-
const isOverridablePropsLoaded = selectIsOverridablePropsLoaded((0,
|
|
1842
|
+
const isOverridablePropsLoaded = selectIsOverridablePropsLoaded((0, import_store32.__getState)(), componentId);
|
|
852
1843
|
if (isOverridablePropsLoaded) {
|
|
853
1844
|
return;
|
|
854
1845
|
}
|
|
@@ -856,7 +1847,7 @@ async function loadComponentOverrides(componentId) {
|
|
|
856
1847
|
if (!overridableProps) {
|
|
857
1848
|
return;
|
|
858
1849
|
}
|
|
859
|
-
(0,
|
|
1850
|
+
(0, import_store32.__dispatch)(
|
|
860
1851
|
slice.actions.setOverridableProps({
|
|
861
1852
|
componentId,
|
|
862
1853
|
overridableProps
|
|
@@ -865,13 +1856,13 @@ async function loadComponentOverrides(componentId) {
|
|
|
865
1856
|
}
|
|
866
1857
|
|
|
867
1858
|
// src/store/actions/load-components-styles.ts
|
|
868
|
-
var
|
|
1859
|
+
var import_store34 = require("@elementor/store");
|
|
869
1860
|
async function loadComponentsStyles(componentIds) {
|
|
870
1861
|
if (!componentIds.length) {
|
|
871
1862
|
return;
|
|
872
1863
|
}
|
|
873
|
-
const knownComponents = selectStyles((0,
|
|
874
|
-
const unknownComponentIds = componentIds.filter((
|
|
1864
|
+
const knownComponents = selectStyles((0, import_store34.__getState)());
|
|
1865
|
+
const unknownComponentIds = componentIds.filter((id2) => !knownComponents[id2]);
|
|
875
1866
|
if (!unknownComponentIds.length) {
|
|
876
1867
|
return;
|
|
877
1868
|
}
|
|
@@ -882,13 +1873,13 @@ async function addComponentStyles(ids) {
|
|
|
882
1873
|
addStyles(newComponents);
|
|
883
1874
|
}
|
|
884
1875
|
async function loadStyles(ids) {
|
|
885
|
-
return Promise.all(ids.map(async (
|
|
1876
|
+
return Promise.all(ids.map(async (id2) => [id2, await apiClient.getComponentConfig(id2)]));
|
|
886
1877
|
}
|
|
887
1878
|
function addStyles(data) {
|
|
888
1879
|
const styles = Object.fromEntries(
|
|
889
1880
|
data.map(([componentId, componentData]) => [componentId, extractStyles(componentData)])
|
|
890
1881
|
);
|
|
891
|
-
(0,
|
|
1882
|
+
(0, import_store34.__dispatch)(slice.actions.addStyles(styles));
|
|
892
1883
|
}
|
|
893
1884
|
function extractStyles(element) {
|
|
894
1885
|
return [...Object.values(element.styles ?? {}), ...(element.elements ?? []).flatMap(extractStyles)];
|
|
@@ -907,16 +1898,16 @@ async function updateDocumentState(componentIds) {
|
|
|
907
1898
|
const components = (await Promise.all(componentIds.map(getComponentDocumentData))).filter(
|
|
908
1899
|
(document) => !!document
|
|
909
1900
|
);
|
|
910
|
-
const isDrafted = components.some(
|
|
1901
|
+
const isDrafted = components.some(import_editor_documents8.isDocumentDirty);
|
|
911
1902
|
if (isDrafted) {
|
|
912
|
-
(0,
|
|
1903
|
+
(0, import_editor_documents8.setDocumentModifiedStatus)(true);
|
|
913
1904
|
}
|
|
914
1905
|
}
|
|
915
1906
|
|
|
916
1907
|
// src/utils/get-container-for-new-element.ts
|
|
917
|
-
var
|
|
1908
|
+
var import_editor_elements4 = require("@elementor/editor-elements");
|
|
918
1909
|
var getContainerForNewElement = () => {
|
|
919
|
-
const currentDocumentContainer = (0,
|
|
1910
|
+
const currentDocumentContainer = (0, import_editor_elements4.getCurrentDocumentContainer)();
|
|
920
1911
|
const selectedElement = getSelectedElementContainer();
|
|
921
1912
|
let container, options;
|
|
922
1913
|
if (selectedElement) {
|
|
@@ -942,17 +1933,17 @@ var getContainerForNewElement = () => {
|
|
|
942
1933
|
return { container: container ?? currentDocumentContainer, options };
|
|
943
1934
|
};
|
|
944
1935
|
function getSelectedElementContainer() {
|
|
945
|
-
const selectedElements = (0,
|
|
1936
|
+
const selectedElements = (0, import_editor_elements4.getSelectedElements)();
|
|
946
1937
|
if (selectedElements.length !== 1) {
|
|
947
1938
|
return void 0;
|
|
948
1939
|
}
|
|
949
|
-
return (0,
|
|
1940
|
+
return (0, import_editor_elements4.getContainer)(selectedElements[0].id);
|
|
950
1941
|
}
|
|
951
1942
|
|
|
952
1943
|
// src/components/create-component-form/utils/replace-element-with-component.ts
|
|
953
|
-
var
|
|
1944
|
+
var import_editor_elements5 = require("@elementor/editor-elements");
|
|
954
1945
|
var replaceElementWithComponent = (element, component) => {
|
|
955
|
-
(0,
|
|
1946
|
+
(0, import_editor_elements5.replaceElement)({
|
|
956
1947
|
currentElement: element,
|
|
957
1948
|
newElement: createComponentModel(component),
|
|
958
1949
|
withHistory: false
|
|
@@ -984,7 +1975,7 @@ var createComponentModel = (component) => {
|
|
|
984
1975
|
// src/components/components-tab/components-item.tsx
|
|
985
1976
|
var ComponentItem = ({ component }) => {
|
|
986
1977
|
const componentModel = createComponentModel(component);
|
|
987
|
-
const popupState = (0,
|
|
1978
|
+
const popupState = (0, import_ui12.usePopupState)({
|
|
988
1979
|
variant: "popover",
|
|
989
1980
|
disableAutoFocus: true
|
|
990
1981
|
});
|
|
@@ -1002,8 +1993,8 @@ var ComponentItem = ({ component }) => {
|
|
|
1002
1993
|
}
|
|
1003
1994
|
archiveComponent(component.id);
|
|
1004
1995
|
};
|
|
1005
|
-
return /* @__PURE__ */
|
|
1006
|
-
|
|
1996
|
+
return /* @__PURE__ */ React13.createElement(import_ui12.Stack, null, /* @__PURE__ */ React13.createElement(
|
|
1997
|
+
import_ui12.ListItemButton,
|
|
1007
1998
|
{
|
|
1008
1999
|
draggable: true,
|
|
1009
2000
|
onDragStart: () => (0, import_editor_canvas5.startDragElementFromPanel)(componentModel),
|
|
@@ -1020,8 +2011,8 @@ var ComponentItem = ({ component }) => {
|
|
|
1020
2011
|
gap: 1
|
|
1021
2012
|
}
|
|
1022
2013
|
},
|
|
1023
|
-
/* @__PURE__ */
|
|
1024
|
-
|
|
2014
|
+
/* @__PURE__ */ React13.createElement(
|
|
2015
|
+
import_ui12.Box,
|
|
1025
2016
|
{
|
|
1026
2017
|
onClick: handleClick,
|
|
1027
2018
|
sx: {
|
|
@@ -1032,22 +2023,22 @@ var ComponentItem = ({ component }) => {
|
|
|
1032
2023
|
flexGrow: 1
|
|
1033
2024
|
}
|
|
1034
2025
|
},
|
|
1035
|
-
/* @__PURE__ */
|
|
1036
|
-
/* @__PURE__ */
|
|
1037
|
-
|
|
2026
|
+
/* @__PURE__ */ React13.createElement(import_ui12.ListItemIcon, { size: "tiny" }, /* @__PURE__ */ React13.createElement(import_icons9.ComponentsIcon, { fontSize: "tiny" })),
|
|
2027
|
+
/* @__PURE__ */ React13.createElement(import_ui12.Box, { display: "flex", flex: 1, minWidth: 0, flexGrow: 1 }, /* @__PURE__ */ React13.createElement(
|
|
2028
|
+
import_editor_ui6.EllipsisWithTooltip,
|
|
1038
2029
|
{
|
|
1039
2030
|
title: component.name,
|
|
1040
|
-
as:
|
|
2031
|
+
as: import_ui12.Typography,
|
|
1041
2032
|
variant: "caption",
|
|
1042
2033
|
color: "text.primary"
|
|
1043
2034
|
}
|
|
1044
2035
|
))
|
|
1045
2036
|
),
|
|
1046
|
-
/* @__PURE__ */
|
|
1047
|
-
), /* @__PURE__ */
|
|
1048
|
-
|
|
2037
|
+
/* @__PURE__ */ React13.createElement(import_ui12.IconButton, { size: "tiny", ...(0, import_ui12.bindTrigger)(popupState), "aria-label": "More actions" }, /* @__PURE__ */ React13.createElement(import_icons9.DotsVerticalIcon, { fontSize: "tiny" }))
|
|
2038
|
+
), /* @__PURE__ */ React13.createElement(
|
|
2039
|
+
import_ui12.Menu,
|
|
1049
2040
|
{
|
|
1050
|
-
...(0,
|
|
2041
|
+
...(0, import_ui12.bindMenu)(popupState),
|
|
1051
2042
|
anchorOrigin: {
|
|
1052
2043
|
vertical: "bottom",
|
|
1053
2044
|
horizontal: "right"
|
|
@@ -1057,7 +2048,7 @@ var ComponentItem = ({ component }) => {
|
|
|
1057
2048
|
horizontal: "right"
|
|
1058
2049
|
}
|
|
1059
2050
|
},
|
|
1060
|
-
/* @__PURE__ */
|
|
2051
|
+
/* @__PURE__ */ React13.createElement(import_editor_ui6.MenuListItem, { sx: { minWidth: "160px" }, onClick: handleArchiveClick }, (0, import_i18n14.__)("Archive", "elementor"))
|
|
1061
2052
|
));
|
|
1062
2053
|
};
|
|
1063
2054
|
var addComponentToPage = (model) => {
|
|
@@ -1066,7 +2057,7 @@ var addComponentToPage = (model) => {
|
|
|
1066
2057
|
throw new Error(`Can't find container to drop new component instance at`);
|
|
1067
2058
|
}
|
|
1068
2059
|
loadComponentsAssets([model]);
|
|
1069
|
-
(0,
|
|
2060
|
+
(0, import_editor_elements6.dropElement)({
|
|
1070
2061
|
containerId: container.id,
|
|
1071
2062
|
model,
|
|
1072
2063
|
options: { ...options, useHistory: false, scrollIntoView: true }
|
|
@@ -1074,13 +2065,13 @@ var addComponentToPage = (model) => {
|
|
|
1074
2065
|
};
|
|
1075
2066
|
|
|
1076
2067
|
// src/components/components-tab/loading-components.tsx
|
|
1077
|
-
var
|
|
1078
|
-
var
|
|
2068
|
+
var React14 = __toESM(require("react"));
|
|
2069
|
+
var import_ui13 = require("@elementor/ui");
|
|
1079
2070
|
var ROWS_COUNT = 6;
|
|
1080
2071
|
var rows = Array.from({ length: ROWS_COUNT }, (_, index) => index);
|
|
1081
2072
|
var LoadingComponents = () => {
|
|
1082
|
-
return /* @__PURE__ */
|
|
1083
|
-
|
|
2073
|
+
return /* @__PURE__ */ React14.createElement(
|
|
2074
|
+
import_ui13.Stack,
|
|
1084
2075
|
{
|
|
1085
2076
|
"aria-label": "Loading components",
|
|
1086
2077
|
gap: 1,
|
|
@@ -1101,14 +2092,14 @@ var LoadingComponents = () => {
|
|
|
1101
2092
|
}
|
|
1102
2093
|
}
|
|
1103
2094
|
},
|
|
1104
|
-
rows.map((row) => /* @__PURE__ */
|
|
1105
|
-
|
|
2095
|
+
rows.map((row) => /* @__PURE__ */ React14.createElement(
|
|
2096
|
+
import_ui13.ListItemButton,
|
|
1106
2097
|
{
|
|
1107
2098
|
key: row,
|
|
1108
2099
|
sx: { border: "solid 1px", borderColor: "divider", py: 0.5, px: 1 },
|
|
1109
2100
|
shape: "rounded"
|
|
1110
2101
|
},
|
|
1111
|
-
/* @__PURE__ */
|
|
2102
|
+
/* @__PURE__ */ React14.createElement(import_ui13.Box, { display: "flex", gap: 1, width: "100%" }, /* @__PURE__ */ React14.createElement(import_ui13.Skeleton, { variant: "text", width: "24px", height: "36px" }), /* @__PURE__ */ React14.createElement(import_ui13.Skeleton, { variant: "text", width: "100%", height: "36px" }))
|
|
1112
2103
|
))
|
|
1113
2104
|
);
|
|
1114
2105
|
};
|
|
@@ -1117,20 +2108,20 @@ var LoadingComponents = () => {
|
|
|
1117
2108
|
function ComponentsList() {
|
|
1118
2109
|
const { components, isLoading, searchValue } = useFilteredComponents();
|
|
1119
2110
|
if (isLoading) {
|
|
1120
|
-
return /* @__PURE__ */
|
|
2111
|
+
return /* @__PURE__ */ React15.createElement(LoadingComponents, null);
|
|
1121
2112
|
}
|
|
1122
2113
|
const isEmpty = !components || components.length === 0;
|
|
1123
2114
|
if (isEmpty) {
|
|
1124
2115
|
if (searchValue.length > 0) {
|
|
1125
|
-
return /* @__PURE__ */
|
|
2116
|
+
return /* @__PURE__ */ React15.createElement(EmptySearchResult, null);
|
|
1126
2117
|
}
|
|
1127
|
-
return /* @__PURE__ */
|
|
2118
|
+
return /* @__PURE__ */ React15.createElement(EmptyState, null);
|
|
1128
2119
|
}
|
|
1129
|
-
return /* @__PURE__ */
|
|
2120
|
+
return /* @__PURE__ */ React15.createElement(import_ui14.List, { sx: { display: "flex", flexDirection: "column", gap: 1, px: 2 } }, components.map((component) => /* @__PURE__ */ React15.createElement(ComponentItem, { key: component.uid, component })));
|
|
1130
2121
|
}
|
|
1131
2122
|
var EmptyState = () => {
|
|
1132
|
-
return /* @__PURE__ */
|
|
1133
|
-
|
|
2123
|
+
return /* @__PURE__ */ React15.createElement(
|
|
2124
|
+
import_ui14.Stack,
|
|
1134
2125
|
{
|
|
1135
2126
|
alignItems: "center",
|
|
1136
2127
|
justifyContent: "center",
|
|
@@ -1139,32 +2130,32 @@ var EmptyState = () => {
|
|
|
1139
2130
|
gap: 1.75,
|
|
1140
2131
|
overflow: "hidden"
|
|
1141
2132
|
},
|
|
1142
|
-
/* @__PURE__ */
|
|
1143
|
-
/* @__PURE__ */
|
|
1144
|
-
/* @__PURE__ */
|
|
2133
|
+
/* @__PURE__ */ React15.createElement(import_ui14.Icon, { fontSize: "large" }, /* @__PURE__ */ React15.createElement(import_icons10.EyeIcon, { fontSize: "large" })),
|
|
2134
|
+
/* @__PURE__ */ React15.createElement(import_ui14.Typography, { align: "center", variant: "subtitle2", color: "text.secondary", fontWeight: "bold" }, (0, import_i18n15.__)("Text that explains that there are no Components yet.", "elementor")),
|
|
2135
|
+
/* @__PURE__ */ React15.createElement(import_ui14.Typography, { variant: "caption", align: "center", color: "text.secondary" }, (0, import_i18n15.__)(
|
|
1145
2136
|
"Once you have Components, this is where you can manage them\u2014rearrange, duplicate, rename and delete irrelevant classes.",
|
|
1146
2137
|
"elementor"
|
|
1147
2138
|
)),
|
|
1148
|
-
/* @__PURE__ */
|
|
1149
|
-
/* @__PURE__ */
|
|
1150
|
-
/* @__PURE__ */
|
|
1151
|
-
|
|
2139
|
+
/* @__PURE__ */ React15.createElement(import_ui14.Divider, { sx: { width: "100%" }, color: "text.secondary" }),
|
|
2140
|
+
/* @__PURE__ */ React15.createElement(import_ui14.Typography, { align: "left", variant: "caption", color: "text.secondary" }, (0, import_i18n15.__)("To create a component, first design it, then choose one of three options:", "elementor")),
|
|
2141
|
+
/* @__PURE__ */ React15.createElement(
|
|
2142
|
+
import_ui14.Typography,
|
|
1152
2143
|
{
|
|
1153
2144
|
align: "left",
|
|
1154
2145
|
variant: "caption",
|
|
1155
2146
|
color: "text.secondary",
|
|
1156
2147
|
sx: { display: "flex", flexDirection: "column" }
|
|
1157
2148
|
},
|
|
1158
|
-
/* @__PURE__ */
|
|
1159
|
-
/* @__PURE__ */
|
|
1160
|
-
/* @__PURE__ */
|
|
2149
|
+
/* @__PURE__ */ React15.createElement("span", null, (0, import_i18n15.__)("1. Right-click and select Create Component", "elementor")),
|
|
2150
|
+
/* @__PURE__ */ React15.createElement("span", null, (0, import_i18n15.__)("2. Use the component icon in the Structure panel", "elementor")),
|
|
2151
|
+
/* @__PURE__ */ React15.createElement("span", null, (0, import_i18n15.__)("3. Use the component icon in the Edit panel header", "elementor"))
|
|
1161
2152
|
)
|
|
1162
2153
|
);
|
|
1163
2154
|
};
|
|
1164
2155
|
var EmptySearchResult = () => {
|
|
1165
2156
|
const { searchValue, clearSearch } = useSearch();
|
|
1166
|
-
return /* @__PURE__ */
|
|
1167
|
-
|
|
2157
|
+
return /* @__PURE__ */ React15.createElement(
|
|
2158
|
+
import_ui14.Stack,
|
|
1168
2159
|
{
|
|
1169
2160
|
color: "text.secondary",
|
|
1170
2161
|
pt: 5,
|
|
@@ -1173,17 +2164,17 @@ var EmptySearchResult = () => {
|
|
|
1173
2164
|
overflow: "hidden",
|
|
1174
2165
|
justifySelf: "center"
|
|
1175
2166
|
},
|
|
1176
|
-
/* @__PURE__ */
|
|
1177
|
-
/* @__PURE__ */
|
|
1178
|
-
|
|
2167
|
+
/* @__PURE__ */ React15.createElement(import_icons10.ComponentsIcon, null),
|
|
2168
|
+
/* @__PURE__ */ React15.createElement(
|
|
2169
|
+
import_ui14.Box,
|
|
1179
2170
|
{
|
|
1180
2171
|
sx: {
|
|
1181
2172
|
width: "100%"
|
|
1182
2173
|
}
|
|
1183
2174
|
},
|
|
1184
|
-
/* @__PURE__ */
|
|
1185
|
-
searchValue && /* @__PURE__ */
|
|
1186
|
-
|
|
2175
|
+
/* @__PURE__ */ React15.createElement(import_ui14.Typography, { align: "center", variant: "subtitle2", color: "inherit" }, (0, import_i18n15.__)("Sorry, nothing matched", "elementor")),
|
|
2176
|
+
searchValue && /* @__PURE__ */ React15.createElement(
|
|
2177
|
+
import_ui14.Typography,
|
|
1187
2178
|
{
|
|
1188
2179
|
variant: "subtitle2",
|
|
1189
2180
|
color: "inherit",
|
|
@@ -1193,8 +2184,8 @@ var EmptySearchResult = () => {
|
|
|
1193
2184
|
justifyContent: "center"
|
|
1194
2185
|
}
|
|
1195
2186
|
},
|
|
1196
|
-
/* @__PURE__ */
|
|
1197
|
-
/* @__PURE__ */
|
|
2187
|
+
/* @__PURE__ */ React15.createElement("span", null, "\u201C"),
|
|
2188
|
+
/* @__PURE__ */ React15.createElement(
|
|
1198
2189
|
"span",
|
|
1199
2190
|
{
|
|
1200
2191
|
style: {
|
|
@@ -1205,11 +2196,11 @@ var EmptySearchResult = () => {
|
|
|
1205
2196
|
},
|
|
1206
2197
|
searchValue
|
|
1207
2198
|
),
|
|
1208
|
-
/* @__PURE__ */
|
|
2199
|
+
/* @__PURE__ */ React15.createElement("span", null, "\u201D.")
|
|
1209
2200
|
)
|
|
1210
2201
|
),
|
|
1211
|
-
/* @__PURE__ */
|
|
1212
|
-
/* @__PURE__ */
|
|
2202
|
+
/* @__PURE__ */ React15.createElement(import_ui14.Typography, { align: "center", variant: "caption", color: "inherit" }, (0, import_i18n15.__)("Try something else.", "elementor")),
|
|
2203
|
+
/* @__PURE__ */ React15.createElement(import_ui14.Typography, { align: "center", variant: "caption", color: "inherit" }, /* @__PURE__ */ React15.createElement(import_ui14.Link, { color: "secondary", variant: "caption", component: "button", onClick: clearSearch }, (0, import_i18n15.__)("Clear & try again", "elementor")))
|
|
1213
2204
|
);
|
|
1214
2205
|
};
|
|
1215
2206
|
var useFilteredComponents = () => {
|
|
@@ -1226,35 +2217,35 @@ var useFilteredComponents = () => {
|
|
|
1226
2217
|
|
|
1227
2218
|
// src/components/components-tab/components.tsx
|
|
1228
2219
|
var Components = () => {
|
|
1229
|
-
return /* @__PURE__ */
|
|
2220
|
+
return /* @__PURE__ */ React16.createElement(import_editor_ui7.ThemeProvider, null, /* @__PURE__ */ React16.createElement(SearchProvider, { localStorageKey: "elementor-components-search" }, /* @__PURE__ */ React16.createElement(ComponentSearch, null), /* @__PURE__ */ React16.createElement(ComponentsList, null)));
|
|
1230
2221
|
};
|
|
1231
2222
|
|
|
1232
2223
|
// src/components/consts.ts
|
|
1233
2224
|
var COMPONENT_DOCUMENT_TYPE = "elementor_component";
|
|
1234
2225
|
|
|
1235
2226
|
// src/components/create-component-form/create-component-form.tsx
|
|
1236
|
-
var
|
|
1237
|
-
var
|
|
1238
|
-
var
|
|
1239
|
-
var
|
|
1240
|
-
var
|
|
1241
|
-
var
|
|
1242
|
-
var
|
|
2227
|
+
var React17 = __toESM(require("react"));
|
|
2228
|
+
var import_react8 = require("react");
|
|
2229
|
+
var import_editor_elements7 = require("@elementor/editor-elements");
|
|
2230
|
+
var import_editor_ui8 = require("@elementor/editor-ui");
|
|
2231
|
+
var import_icons11 = require("@elementor/icons");
|
|
2232
|
+
var import_ui15 = require("@elementor/ui");
|
|
2233
|
+
var import_i18n17 = require("@wordpress/i18n");
|
|
1243
2234
|
|
|
1244
2235
|
// src/store/actions/create-unpublished-component.ts
|
|
1245
2236
|
var import_editor_v1_adapters3 = require("@elementor/editor-v1-adapters");
|
|
1246
|
-
var
|
|
1247
|
-
var
|
|
2237
|
+
var import_store36 = require("@elementor/store");
|
|
2238
|
+
var import_utils4 = require("@elementor/utils");
|
|
1248
2239
|
function createUnpublishedComponent(name, element, eventData, overridableProps, uid) {
|
|
1249
|
-
const generatedUid = uid ?? (0,
|
|
2240
|
+
const generatedUid = uid ?? (0, import_utils4.generateUniqueId)("component");
|
|
1250
2241
|
const componentBase = { uid: generatedUid, name, overridableProps };
|
|
1251
|
-
(0,
|
|
2242
|
+
(0, import_store36.__dispatch)(
|
|
1252
2243
|
slice.actions.addUnpublished({
|
|
1253
2244
|
...componentBase,
|
|
1254
2245
|
elements: [element]
|
|
1255
2246
|
})
|
|
1256
2247
|
);
|
|
1257
|
-
(0,
|
|
2248
|
+
(0, import_store36.__dispatch)(slice.actions.addCreatedThisSession(generatedUid));
|
|
1258
2249
|
replaceElementWithComponent(element, componentBase);
|
|
1259
2250
|
trackComponentEvent({
|
|
1260
2251
|
action: "created",
|
|
@@ -1267,11 +2258,11 @@ function createUnpublishedComponent(name, element, eventData, overridableProps,
|
|
|
1267
2258
|
}
|
|
1268
2259
|
|
|
1269
2260
|
// src/components/create-component-form/hooks/use-form.ts
|
|
1270
|
-
var
|
|
2261
|
+
var import_react7 = require("react");
|
|
1271
2262
|
var useForm = (initialValues) => {
|
|
1272
|
-
const [values, setValues] = (0,
|
|
1273
|
-
const [errors, setErrors] = (0,
|
|
1274
|
-
const isValid = (0,
|
|
2263
|
+
const [values, setValues] = (0, import_react7.useState)(initialValues);
|
|
2264
|
+
const [errors, setErrors] = (0, import_react7.useState)({});
|
|
2265
|
+
const isValid = (0, import_react7.useMemo)(() => {
|
|
1275
2266
|
return !Object.values(errors).some((error) => error);
|
|
1276
2267
|
}, [errors]);
|
|
1277
2268
|
const handleChange = (e, field, validationSchema) => {
|
|
@@ -1317,16 +2308,16 @@ var validateForm = (values, schema) => {
|
|
|
1317
2308
|
|
|
1318
2309
|
// src/components/create-component-form/utils/component-form-schema.ts
|
|
1319
2310
|
var import_schema = require("@elementor/schema");
|
|
1320
|
-
var
|
|
2311
|
+
var import_i18n16 = require("@wordpress/i18n");
|
|
1321
2312
|
var MIN_NAME_LENGTH = 2;
|
|
1322
2313
|
var MAX_NAME_LENGTH = 50;
|
|
1323
2314
|
var createBaseComponentSchema = (existingNames) => {
|
|
1324
2315
|
return import_schema.z.object({
|
|
1325
2316
|
componentName: import_schema.z.string().trim().max(
|
|
1326
2317
|
MAX_NAME_LENGTH,
|
|
1327
|
-
(0,
|
|
2318
|
+
(0, import_i18n16.__)("Component name is too long. Please keep it under 50 characters.", "elementor")
|
|
1328
2319
|
).refine((value) => !existingNames.includes(value), {
|
|
1329
|
-
message: (0,
|
|
2320
|
+
message: (0, import_i18n16.__)("Component name already exists", "elementor")
|
|
1330
2321
|
})
|
|
1331
2322
|
});
|
|
1332
2323
|
};
|
|
@@ -1334,9 +2325,9 @@ var createSubmitComponentSchema = (existingNames) => {
|
|
|
1334
2325
|
const baseSchema = createBaseComponentSchema(existingNames);
|
|
1335
2326
|
return baseSchema.extend({
|
|
1336
2327
|
componentName: baseSchema.shape.componentName.refine((value) => value.length > 0, {
|
|
1337
|
-
message: (0,
|
|
2328
|
+
message: (0, import_i18n16.__)("Component name is required.", "elementor")
|
|
1338
2329
|
}).refine((value) => value.length >= MIN_NAME_LENGTH, {
|
|
1339
|
-
message: (0,
|
|
2330
|
+
message: (0, import_i18n16.__)("Component name is too short. Please enter at least 2 characters.", "elementor")
|
|
1340
2331
|
})
|
|
1341
2332
|
});
|
|
1342
2333
|
};
|
|
@@ -1372,14 +2363,14 @@ function countNestedElements(container) {
|
|
|
1372
2363
|
|
|
1373
2364
|
// src/components/create-component-form/create-component-form.tsx
|
|
1374
2365
|
function CreateComponentForm() {
|
|
1375
|
-
const [element, setElement] = (0,
|
|
1376
|
-
const [anchorPosition, setAnchorPosition] = (0,
|
|
1377
|
-
const [resultNotification, setResultNotification] = (0,
|
|
1378
|
-
const eventData = (0,
|
|
1379
|
-
(0,
|
|
2366
|
+
const [element, setElement] = (0, import_react8.useState)(null);
|
|
2367
|
+
const [anchorPosition, setAnchorPosition] = (0, import_react8.useState)();
|
|
2368
|
+
const [resultNotification, setResultNotification] = (0, import_react8.useState)(null);
|
|
2369
|
+
const eventData = (0, import_react8.useRef)(null);
|
|
2370
|
+
(0, import_react8.useEffect)(() => {
|
|
1380
2371
|
const OPEN_SAVE_AS_COMPONENT_FORM_EVENT = "elementor/editor/open-save-as-component-form";
|
|
1381
2372
|
const openPopup = (event) => {
|
|
1382
|
-
setElement({ element: event.detail.element, elementLabel: (0,
|
|
2373
|
+
setElement({ element: event.detail.element, elementLabel: (0, import_editor_elements7.getElementLabel)(event.detail.element.id) });
|
|
1383
2374
|
setAnchorPosition(event.detail.anchorPosition);
|
|
1384
2375
|
eventData.current = getComponentEventData(event.detail.element, event.detail.options);
|
|
1385
2376
|
trackComponentEvent({
|
|
@@ -1401,12 +2392,12 @@ function CreateComponentForm() {
|
|
|
1401
2392
|
setResultNotification({
|
|
1402
2393
|
show: true,
|
|
1403
2394
|
// Translators: %1$s: Component name, %2$s: Component UID
|
|
1404
|
-
message: (0,
|
|
2395
|
+
message: (0, import_i18n17.__)("Component saved successfully as: %1$s (UID: %2$s)", "elementor").replace("%1$s", values.componentName).replace("%2$s", uid),
|
|
1405
2396
|
type: "success"
|
|
1406
2397
|
});
|
|
1407
2398
|
resetAndClosePopup();
|
|
1408
2399
|
} catch {
|
|
1409
|
-
const errorMessage = (0,
|
|
2400
|
+
const errorMessage = (0, import_i18n17.__)("Failed to save component. Please try again.", "elementor");
|
|
1410
2401
|
setResultNotification({
|
|
1411
2402
|
show: true,
|
|
1412
2403
|
message: errorMessage,
|
|
@@ -1425,24 +2416,24 @@ function CreateComponentForm() {
|
|
|
1425
2416
|
...eventData.current
|
|
1426
2417
|
});
|
|
1427
2418
|
};
|
|
1428
|
-
return /* @__PURE__ */
|
|
1429
|
-
|
|
2419
|
+
return /* @__PURE__ */ React17.createElement(import_editor_ui8.ThemeProvider, null, /* @__PURE__ */ React17.createElement(
|
|
2420
|
+
import_ui15.Popover,
|
|
1430
2421
|
{
|
|
1431
2422
|
open: element !== null,
|
|
1432
2423
|
onClose: cancelSave,
|
|
1433
2424
|
anchorReference: "anchorPosition",
|
|
1434
2425
|
anchorPosition
|
|
1435
2426
|
},
|
|
1436
|
-
element !== null && /* @__PURE__ */
|
|
1437
|
-
|
|
2427
|
+
element !== null && /* @__PURE__ */ React17.createElement(
|
|
2428
|
+
Form2,
|
|
1438
2429
|
{
|
|
1439
2430
|
initialValues: { componentName: element.elementLabel },
|
|
1440
2431
|
handleSave,
|
|
1441
2432
|
closePopup: cancelSave
|
|
1442
2433
|
}
|
|
1443
2434
|
)
|
|
1444
|
-
), /* @__PURE__ */
|
|
1445
|
-
|
|
2435
|
+
), /* @__PURE__ */ React17.createElement(import_ui15.Snackbar, { open: resultNotification?.show, onClose: () => setResultNotification(null) }, /* @__PURE__ */ React17.createElement(
|
|
2436
|
+
import_ui15.Alert,
|
|
1446
2437
|
{
|
|
1447
2438
|
onClose: () => setResultNotification(null),
|
|
1448
2439
|
severity: resultNotification?.type,
|
|
@@ -1452,21 +2443,21 @@ function CreateComponentForm() {
|
|
|
1452
2443
|
)));
|
|
1453
2444
|
}
|
|
1454
2445
|
var FONT_SIZE = "tiny";
|
|
1455
|
-
var
|
|
2446
|
+
var Form2 = ({
|
|
1456
2447
|
initialValues,
|
|
1457
2448
|
handleSave,
|
|
1458
2449
|
closePopup
|
|
1459
2450
|
}) => {
|
|
1460
2451
|
const { values, errors, isValid, handleChange, validateForm: validateForm2 } = useForm(initialValues);
|
|
1461
2452
|
const { components } = useComponents();
|
|
1462
|
-
const existingComponentNames = (0,
|
|
2453
|
+
const existingComponentNames = (0, import_react8.useMemo)(() => {
|
|
1463
2454
|
return components?.map((component) => component.name) ?? [];
|
|
1464
2455
|
}, [components]);
|
|
1465
|
-
const changeValidationSchema = (0,
|
|
2456
|
+
const changeValidationSchema = (0, import_react8.useMemo)(
|
|
1466
2457
|
() => createBaseComponentSchema(existingComponentNames),
|
|
1467
2458
|
[existingComponentNames]
|
|
1468
2459
|
);
|
|
1469
|
-
const submitValidationSchema = (0,
|
|
2460
|
+
const submitValidationSchema = (0, import_react8.useMemo)(
|
|
1470
2461
|
() => createSubmitComponentSchema(existingComponentNames),
|
|
1471
2462
|
[existingComponentNames]
|
|
1472
2463
|
);
|
|
@@ -1477,14 +2468,14 @@ var Form = ({
|
|
|
1477
2468
|
}
|
|
1478
2469
|
};
|
|
1479
2470
|
const texts = {
|
|
1480
|
-
heading: (0,
|
|
1481
|
-
name: (0,
|
|
1482
|
-
cancel: (0,
|
|
1483
|
-
create: (0,
|
|
2471
|
+
heading: (0, import_i18n17.__)("Save as a component", "elementor"),
|
|
2472
|
+
name: (0, import_i18n17.__)("Name", "elementor"),
|
|
2473
|
+
cancel: (0, import_i18n17.__)("Cancel", "elementor"),
|
|
2474
|
+
create: (0, import_i18n17.__)("Create", "elementor")
|
|
1484
2475
|
};
|
|
1485
2476
|
const nameInputId = "component-name";
|
|
1486
|
-
return /* @__PURE__ */
|
|
1487
|
-
|
|
2477
|
+
return /* @__PURE__ */ React17.createElement(import_editor_ui8.Form, { onSubmit: handleSubmit }, /* @__PURE__ */ React17.createElement(import_ui15.Stack, { alignItems: "start", width: "268px" }, /* @__PURE__ */ React17.createElement(
|
|
2478
|
+
import_ui15.Stack,
|
|
1488
2479
|
{
|
|
1489
2480
|
direction: "row",
|
|
1490
2481
|
alignItems: "center",
|
|
@@ -1492,10 +2483,10 @@ var Form = ({
|
|
|
1492
2483
|
px: 1.5,
|
|
1493
2484
|
sx: { columnGap: 0.5, borderBottom: "1px solid", borderColor: "divider", width: "100%" }
|
|
1494
2485
|
},
|
|
1495
|
-
/* @__PURE__ */
|
|
1496
|
-
/* @__PURE__ */
|
|
1497
|
-
), /* @__PURE__ */
|
|
1498
|
-
|
|
2486
|
+
/* @__PURE__ */ React17.createElement(import_icons11.StarIcon, { fontSize: FONT_SIZE }),
|
|
2487
|
+
/* @__PURE__ */ React17.createElement(import_ui15.Typography, { variant: "caption", sx: { color: "text.primary", fontWeight: "500", lineHeight: 1 } }, texts.heading)
|
|
2488
|
+
), /* @__PURE__ */ React17.createElement(import_ui15.Grid, { container: true, gap: 0.75, alignItems: "start", p: 1.5 }, /* @__PURE__ */ React17.createElement(import_ui15.Grid, { item: true, xs: 12 }, /* @__PURE__ */ React17.createElement(import_ui15.FormLabel, { htmlFor: nameInputId, size: "tiny" }, texts.name)), /* @__PURE__ */ React17.createElement(import_ui15.Grid, { item: true, xs: 12 }, /* @__PURE__ */ React17.createElement(
|
|
2489
|
+
import_ui15.TextField,
|
|
1499
2490
|
{
|
|
1500
2491
|
id: nameInputId,
|
|
1501
2492
|
size: FONT_SIZE,
|
|
@@ -1506,37 +2497,37 @@ var Form = ({
|
|
|
1506
2497
|
error: Boolean(errors.componentName),
|
|
1507
2498
|
helperText: errors.componentName
|
|
1508
2499
|
}
|
|
1509
|
-
))), /* @__PURE__ */
|
|
2500
|
+
))), /* @__PURE__ */ React17.createElement(import_ui15.Stack, { direction: "row", justifyContent: "flex-end", alignSelf: "end", py: 1, px: 1.5 }, /* @__PURE__ */ React17.createElement(import_ui15.Button, { onClick: closePopup, color: "secondary", variant: "text", size: "small" }, texts.cancel), /* @__PURE__ */ React17.createElement(import_ui15.Button, { type: "submit", disabled: !isValid, variant: "contained", color: "primary", size: "small" }, texts.create))));
|
|
1510
2501
|
};
|
|
1511
2502
|
|
|
1512
2503
|
// src/components/edit-component/edit-component.tsx
|
|
1513
|
-
var
|
|
1514
|
-
var
|
|
1515
|
-
var
|
|
2504
|
+
var React19 = __toESM(require("react"));
|
|
2505
|
+
var import_react11 = require("react");
|
|
2506
|
+
var import_editor_documents10 = require("@elementor/editor-documents");
|
|
1516
2507
|
var import_editor_v1_adapters5 = require("@elementor/editor-v1-adapters");
|
|
1517
|
-
var
|
|
1518
|
-
var
|
|
2508
|
+
var import_store40 = require("@elementor/store");
|
|
2509
|
+
var import_utils6 = require("@elementor/utils");
|
|
1519
2510
|
|
|
1520
2511
|
// src/store/actions/update-current-component.ts
|
|
1521
|
-
var
|
|
1522
|
-
var
|
|
2512
|
+
var import_editor_documents9 = require("@elementor/editor-documents");
|
|
2513
|
+
var import_store38 = require("@elementor/store");
|
|
1523
2514
|
function updateCurrentComponent({
|
|
1524
2515
|
path,
|
|
1525
2516
|
currentComponentId
|
|
1526
2517
|
}) {
|
|
1527
|
-
const
|
|
1528
|
-
if (!
|
|
2518
|
+
const dispatch16 = (0, import_store38.__getStore)()?.dispatch;
|
|
2519
|
+
if (!dispatch16) {
|
|
1529
2520
|
return;
|
|
1530
2521
|
}
|
|
1531
|
-
|
|
1532
|
-
|
|
2522
|
+
dispatch16(slice.actions.setPath(path));
|
|
2523
|
+
dispatch16(slice.actions.setCurrentComponentId(currentComponentId));
|
|
1533
2524
|
}
|
|
1534
2525
|
|
|
1535
2526
|
// src/components/edit-component/component-modal.tsx
|
|
1536
|
-
var
|
|
1537
|
-
var
|
|
2527
|
+
var React18 = __toESM(require("react"));
|
|
2528
|
+
var import_react10 = require("react");
|
|
1538
2529
|
var import_react_dom = require("react-dom");
|
|
1539
|
-
var
|
|
2530
|
+
var import_i18n18 = require("@wordpress/i18n");
|
|
1540
2531
|
|
|
1541
2532
|
// src/hooks/use-canvas-document.ts
|
|
1542
2533
|
var import_editor_canvas6 = require("@elementor/editor-canvas");
|
|
@@ -1546,11 +2537,11 @@ function useCanvasDocument() {
|
|
|
1546
2537
|
}
|
|
1547
2538
|
|
|
1548
2539
|
// src/hooks/use-element-rect.ts
|
|
1549
|
-
var
|
|
1550
|
-
var
|
|
2540
|
+
var import_react9 = require("react");
|
|
2541
|
+
var import_utils5 = require("@elementor/utils");
|
|
1551
2542
|
function useElementRect(element) {
|
|
1552
|
-
const [rect, setRect] = (0,
|
|
1553
|
-
const onChange = (0,
|
|
2543
|
+
const [rect, setRect] = (0, import_react9.useState)(new DOMRect(0, 0, 0, 0));
|
|
2544
|
+
const onChange = (0, import_utils5.throttle)(
|
|
1554
2545
|
() => {
|
|
1555
2546
|
setRect(element?.getBoundingClientRect() ?? new DOMRect(0, 0, 0, 0));
|
|
1556
2547
|
},
|
|
@@ -1560,7 +2551,7 @@ function useElementRect(element) {
|
|
|
1560
2551
|
useScrollListener({ element, onChange });
|
|
1561
2552
|
useResizeListener({ element, onChange });
|
|
1562
2553
|
useMutationsListener({ element, onChange });
|
|
1563
|
-
(0,
|
|
2554
|
+
(0, import_react9.useEffect)(
|
|
1564
2555
|
() => () => {
|
|
1565
2556
|
onChange.cancel();
|
|
1566
2557
|
},
|
|
@@ -1569,7 +2560,7 @@ function useElementRect(element) {
|
|
|
1569
2560
|
return rect;
|
|
1570
2561
|
}
|
|
1571
2562
|
function useScrollListener({ element, onChange }) {
|
|
1572
|
-
(0,
|
|
2563
|
+
(0, import_react9.useEffect)(() => {
|
|
1573
2564
|
if (!element) {
|
|
1574
2565
|
return;
|
|
1575
2566
|
}
|
|
@@ -1581,7 +2572,7 @@ function useScrollListener({ element, onChange }) {
|
|
|
1581
2572
|
}, [element, onChange]);
|
|
1582
2573
|
}
|
|
1583
2574
|
function useResizeListener({ element, onChange }) {
|
|
1584
|
-
(0,
|
|
2575
|
+
(0, import_react9.useEffect)(() => {
|
|
1585
2576
|
if (!element) {
|
|
1586
2577
|
return;
|
|
1587
2578
|
}
|
|
@@ -1596,7 +2587,7 @@ function useResizeListener({ element, onChange }) {
|
|
|
1596
2587
|
}, [element, onChange]);
|
|
1597
2588
|
}
|
|
1598
2589
|
function useMutationsListener({ element, onChange }) {
|
|
1599
|
-
(0,
|
|
2590
|
+
(0, import_react9.useEffect)(() => {
|
|
1600
2591
|
if (!element) {
|
|
1601
2592
|
return;
|
|
1602
2593
|
}
|
|
@@ -1611,7 +2602,7 @@ function useMutationsListener({ element, onChange }) {
|
|
|
1611
2602
|
// src/components/edit-component/component-modal.tsx
|
|
1612
2603
|
function ComponentModal({ element, onClose }) {
|
|
1613
2604
|
const canvasDocument = useCanvasDocument();
|
|
1614
|
-
(0,
|
|
2605
|
+
(0, import_react10.useEffect)(() => {
|
|
1615
2606
|
const handleEsc = (event) => {
|
|
1616
2607
|
if (event.key === "Escape") {
|
|
1617
2608
|
onClose();
|
|
@@ -1626,7 +2617,7 @@ function ComponentModal({ element, onClose }) {
|
|
|
1626
2617
|
return null;
|
|
1627
2618
|
}
|
|
1628
2619
|
return (0, import_react_dom.createPortal)(
|
|
1629
|
-
/* @__PURE__ */
|
|
2620
|
+
/* @__PURE__ */ React18.createElement(React18.Fragment, null, /* @__PURE__ */ React18.createElement(BlockEditPage, null), /* @__PURE__ */ React18.createElement(Backdrop, { canvas: canvasDocument, element, onClose })),
|
|
1630
2621
|
canvasDocument.body
|
|
1631
2622
|
);
|
|
1632
2623
|
}
|
|
@@ -1650,7 +2641,7 @@ function Backdrop({ canvas, element, onClose }) {
|
|
|
1650
2641
|
onClose();
|
|
1651
2642
|
}
|
|
1652
2643
|
};
|
|
1653
|
-
return /* @__PURE__ */
|
|
2644
|
+
return /* @__PURE__ */ React18.createElement(
|
|
1654
2645
|
"div",
|
|
1655
2646
|
{
|
|
1656
2647
|
style: backdropStyle,
|
|
@@ -1658,7 +2649,7 @@ function Backdrop({ canvas, element, onClose }) {
|
|
|
1658
2649
|
onKeyDown: handleKeyDown,
|
|
1659
2650
|
role: "button",
|
|
1660
2651
|
tabIndex: 0,
|
|
1661
|
-
"aria-label": (0,
|
|
2652
|
+
"aria-label": (0, import_i18n18.__)("Exit component editing mode", "elementor")
|
|
1662
2653
|
}
|
|
1663
2654
|
);
|
|
1664
2655
|
}
|
|
@@ -1708,7 +2699,7 @@ function BlockEditPage() {
|
|
|
1708
2699
|
}
|
|
1709
2700
|
}
|
|
1710
2701
|
`;
|
|
1711
|
-
return /* @__PURE__ */
|
|
2702
|
+
return /* @__PURE__ */ React18.createElement("style", { "data-e-style-id": "e-block-v3-document-handles-styles" }, blockV3DocumentHandlesStyles);
|
|
1712
2703
|
}
|
|
1713
2704
|
|
|
1714
2705
|
// src/components/edit-component/edit-component.tsx
|
|
@@ -1716,18 +2707,18 @@ function EditComponent() {
|
|
|
1716
2707
|
const currentComponentId = useCurrentComponentId();
|
|
1717
2708
|
useHandleDocumentSwitches();
|
|
1718
2709
|
const navigateBack = useNavigateBack();
|
|
1719
|
-
const onClose = (0,
|
|
2710
|
+
const onClose = (0, import_utils6.throttle)(navigateBack, 100);
|
|
1720
2711
|
const elementDom = getComponentDOMElement(currentComponentId ?? void 0);
|
|
1721
2712
|
if (!elementDom) {
|
|
1722
2713
|
return null;
|
|
1723
2714
|
}
|
|
1724
|
-
return /* @__PURE__ */
|
|
2715
|
+
return /* @__PURE__ */ React19.createElement(ComponentModal, { element: elementDom, onClose });
|
|
1725
2716
|
}
|
|
1726
2717
|
function useHandleDocumentSwitches() {
|
|
1727
|
-
const documentsManager = (0,
|
|
2718
|
+
const documentsManager = (0, import_editor_documents10.getV1DocumentsManager)();
|
|
1728
2719
|
const currentComponentId = useCurrentComponentId();
|
|
1729
|
-
const path = (0,
|
|
1730
|
-
(0,
|
|
2720
|
+
const path = (0, import_store40.__useSelector)(selectPath);
|
|
2721
|
+
(0, import_react11.useEffect)(() => {
|
|
1731
2722
|
return (0, import_editor_v1_adapters5.__privateListenTo)((0, import_editor_v1_adapters5.commandEndEvent)("editor/documents/open"), () => {
|
|
1732
2723
|
const nextDocument = documentsManager.getCurrent();
|
|
1733
2724
|
if (nextDocument.id === currentComponentId) {
|
|
@@ -1761,12 +2752,12 @@ function getUpdatedComponentPath(path, nextDocument) {
|
|
|
1761
2752
|
}
|
|
1762
2753
|
];
|
|
1763
2754
|
}
|
|
1764
|
-
function getComponentDOMElement(
|
|
1765
|
-
if (!
|
|
2755
|
+
function getComponentDOMElement(id2) {
|
|
2756
|
+
if (!id2) {
|
|
1766
2757
|
return null;
|
|
1767
2758
|
}
|
|
1768
|
-
const documentsManager = (0,
|
|
1769
|
-
const currentComponent = documentsManager.get(
|
|
2759
|
+
const documentsManager = (0, import_editor_documents10.getV1DocumentsManager)();
|
|
2760
|
+
const currentComponent = documentsManager.get(id2);
|
|
1770
2761
|
const widget = currentComponent?.container;
|
|
1771
2762
|
const container = widget?.view?.el?.children?.[0] ?? null;
|
|
1772
2763
|
const elementDom = container?.children[0];
|
|
@@ -1774,33 +2765,33 @@ function getComponentDOMElement(id) {
|
|
|
1774
2765
|
}
|
|
1775
2766
|
|
|
1776
2767
|
// src/components/in-edit-mode.tsx
|
|
1777
|
-
var
|
|
1778
|
-
var
|
|
1779
|
-
var
|
|
1780
|
-
var
|
|
1781
|
-
var
|
|
2768
|
+
var React20 = __toESM(require("react"));
|
|
2769
|
+
var import_editor_ui9 = require("@elementor/editor-ui");
|
|
2770
|
+
var import_icons12 = require("@elementor/icons");
|
|
2771
|
+
var import_ui16 = require("@elementor/ui");
|
|
2772
|
+
var import_i18n19 = require("@wordpress/i18n");
|
|
1782
2773
|
var openEditModeDialog = (lockedBy) => {
|
|
1783
|
-
(0,
|
|
1784
|
-
component: /* @__PURE__ */
|
|
2774
|
+
(0, import_editor_ui9.openDialog)({
|
|
2775
|
+
component: /* @__PURE__ */ React20.createElement(EditModeDialog, { lockedBy })
|
|
1785
2776
|
});
|
|
1786
2777
|
};
|
|
1787
2778
|
var EditModeDialog = ({ lockedBy }) => {
|
|
1788
|
-
const content = (0,
|
|
1789
|
-
return /* @__PURE__ */
|
|
2779
|
+
const content = (0, import_i18n19.__)("%s is currently editing this document", "elementor").replace("%s", lockedBy);
|
|
2780
|
+
return /* @__PURE__ */ React20.createElement(React20.Fragment, null, /* @__PURE__ */ React20.createElement(import_ui16.DialogHeader, { logo: false }, /* @__PURE__ */ React20.createElement(import_ui16.Box, { display: "flex", alignItems: "center", gap: 1 }, /* @__PURE__ */ React20.createElement(import_ui16.Icon, { color: "secondary" }, /* @__PURE__ */ React20.createElement(import_icons12.InfoCircleFilledIcon, { fontSize: "medium" })), /* @__PURE__ */ React20.createElement(import_ui16.Typography, { variant: "subtitle1" }, content))), /* @__PURE__ */ React20.createElement(import_ui16.DialogContent, null, /* @__PURE__ */ React20.createElement(import_ui16.Stack, { spacing: 2, direction: "column" }, /* @__PURE__ */ React20.createElement(import_ui16.Typography, { variant: "body2" }, (0, import_i18n19.__)(
|
|
1790
2781
|
"You can wait for them to finish or reach out to coordinate your changes together.",
|
|
1791
2782
|
"elementor"
|
|
1792
|
-
)), /* @__PURE__ */
|
|
2783
|
+
)), /* @__PURE__ */ React20.createElement(import_ui16.DialogActions, null, /* @__PURE__ */ React20.createElement(import_ui16.Button, { color: "secondary", variant: "contained", onClick: import_editor_ui9.closeDialog }, (0, import_i18n19.__)("Close", "elementor"))))));
|
|
1793
2784
|
};
|
|
1794
2785
|
|
|
1795
2786
|
// src/components/instance-editing-panel/instance-editing-panel.tsx
|
|
1796
|
-
var
|
|
1797
|
-
var
|
|
1798
|
-
var
|
|
1799
|
-
var
|
|
1800
|
-
var
|
|
1801
|
-
var
|
|
1802
|
-
var
|
|
1803
|
-
var
|
|
2787
|
+
var React23 = __toESM(require("react"));
|
|
2788
|
+
var import_editor_editing_panel3 = require("@elementor/editor-editing-panel");
|
|
2789
|
+
var import_editor_elements8 = require("@elementor/editor-elements");
|
|
2790
|
+
var import_editor_panels3 = require("@elementor/editor-panels");
|
|
2791
|
+
var import_icons14 = require("@elementor/icons");
|
|
2792
|
+
var import_store42 = require("@elementor/store");
|
|
2793
|
+
var import_ui19 = require("@elementor/ui");
|
|
2794
|
+
var import_i18n21 = require("@wordpress/i18n");
|
|
1804
2795
|
|
|
1805
2796
|
// src/prop-types/component-instance-prop-type.ts
|
|
1806
2797
|
var import_editor_props3 = require("@elementor/editor-props");
|
|
@@ -1841,13 +2832,13 @@ var componentInstancePropTypeUtil = (0, import_editor_props3.createPropUtils)(
|
|
|
1841
2832
|
);
|
|
1842
2833
|
|
|
1843
2834
|
// src/components/instance-editing-panel/empty-state.tsx
|
|
1844
|
-
var
|
|
1845
|
-
var
|
|
1846
|
-
var
|
|
1847
|
-
var
|
|
2835
|
+
var React21 = __toESM(require("react"));
|
|
2836
|
+
var import_icons13 = require("@elementor/icons");
|
|
2837
|
+
var import_ui17 = require("@elementor/ui");
|
|
2838
|
+
var import_i18n20 = require("@wordpress/i18n");
|
|
1848
2839
|
var EmptyState2 = ({ onEditComponent }) => {
|
|
1849
|
-
return /* @__PURE__ */
|
|
1850
|
-
|
|
2840
|
+
return /* @__PURE__ */ React21.createElement(
|
|
2841
|
+
import_ui17.Stack,
|
|
1851
2842
|
{
|
|
1852
2843
|
alignItems: "center",
|
|
1853
2844
|
justifyContent: "start",
|
|
@@ -1856,33 +2847,33 @@ var EmptyState2 = ({ onEditComponent }) => {
|
|
|
1856
2847
|
sx: { p: 2.5, pt: 8, pb: 5.5, mt: 1 },
|
|
1857
2848
|
gap: 1.5
|
|
1858
2849
|
},
|
|
1859
|
-
/* @__PURE__ */
|
|
1860
|
-
/* @__PURE__ */
|
|
1861
|
-
/* @__PURE__ */
|
|
2850
|
+
/* @__PURE__ */ React21.createElement(import_icons13.ComponentPropListIcon, { fontSize: "large" }),
|
|
2851
|
+
/* @__PURE__ */ React21.createElement(import_ui17.Typography, { align: "center", variant: "subtitle2" }, (0, import_i18n20.__)("No properties yet", "elementor")),
|
|
2852
|
+
/* @__PURE__ */ React21.createElement(import_ui17.Typography, { align: "center", variant: "caption", maxWidth: "170px" }, (0, import_i18n20.__)(
|
|
1862
2853
|
"Edit the component to add properties, manage them or update the design across all instances.",
|
|
1863
2854
|
"elementor"
|
|
1864
2855
|
)),
|
|
1865
|
-
/* @__PURE__ */
|
|
2856
|
+
/* @__PURE__ */ React21.createElement(import_ui17.Button, { variant: "outlined", color: "secondary", size: "small", sx: { mt: 1 }, onClick: onEditComponent }, /* @__PURE__ */ React21.createElement(import_icons13.PencilIcon, { fontSize: "small" }), (0, import_i18n20.__)("Edit component", "elementor"))
|
|
1866
2857
|
);
|
|
1867
2858
|
};
|
|
1868
2859
|
|
|
1869
2860
|
// src/components/instance-editing-panel/override-props-group.tsx
|
|
1870
|
-
var
|
|
1871
|
-
var
|
|
1872
|
-
var
|
|
1873
|
-
var
|
|
1874
|
-
var
|
|
2861
|
+
var React22 = __toESM(require("react"));
|
|
2862
|
+
var import_react12 = require("react");
|
|
2863
|
+
var import_editor_editing_panel2 = require("@elementor/editor-editing-panel");
|
|
2864
|
+
var import_editor_ui10 = require("@elementor/editor-ui");
|
|
2865
|
+
var import_ui18 = require("@elementor/ui");
|
|
1875
2866
|
function OverridePropsGroup({ group, props }) {
|
|
1876
|
-
const [isOpen, setIsOpen] = (0,
|
|
2867
|
+
const [isOpen, setIsOpen] = (0, import_editor_editing_panel2.useStateByElement)(group.id, true);
|
|
1877
2868
|
const handleClick = () => {
|
|
1878
2869
|
setIsOpen(!isOpen);
|
|
1879
2870
|
};
|
|
1880
|
-
const
|
|
1881
|
-
const labelId = `label-${
|
|
1882
|
-
const contentId = `content-${
|
|
2871
|
+
const id2 = (0, import_react12.useId)();
|
|
2872
|
+
const labelId = `label-${id2}`;
|
|
2873
|
+
const contentId = `content-${id2}`;
|
|
1883
2874
|
const title = group.label;
|
|
1884
|
-
return /* @__PURE__ */
|
|
1885
|
-
|
|
2875
|
+
return /* @__PURE__ */ React22.createElement(React22.Fragment, null, /* @__PURE__ */ React22.createElement(
|
|
2876
|
+
import_ui18.ListItemButton,
|
|
1886
2877
|
{
|
|
1887
2878
|
id: labelId,
|
|
1888
2879
|
"aria-controls": contentId,
|
|
@@ -1891,45 +2882,45 @@ function OverridePropsGroup({ group, props }) {
|
|
|
1891
2882
|
p: 0,
|
|
1892
2883
|
sx: { "&:hover": { backgroundColor: "transparent" } }
|
|
1893
2884
|
},
|
|
1894
|
-
/* @__PURE__ */
|
|
1895
|
-
|
|
2885
|
+
/* @__PURE__ */ React22.createElement(import_ui18.Stack, { direction: "row", alignItems: "center", justifyItems: "start", flexGrow: 1, gap: 0.5 }, /* @__PURE__ */ React22.createElement(
|
|
2886
|
+
import_ui18.ListItemText,
|
|
1896
2887
|
{
|
|
1897
2888
|
secondary: title,
|
|
1898
2889
|
secondaryTypographyProps: { color: "text.primary", variant: "caption", fontWeight: "bold" },
|
|
1899
2890
|
sx: { flexGrow: 0, flexShrink: 1, marginInlineEnd: 1 }
|
|
1900
2891
|
}
|
|
1901
2892
|
)),
|
|
1902
|
-
/* @__PURE__ */
|
|
1903
|
-
), /* @__PURE__ */
|
|
2893
|
+
/* @__PURE__ */ React22.createElement(import_editor_ui10.CollapseIcon, { open: isOpen, color: "secondary", fontSize: "tiny" })
|
|
2894
|
+
), /* @__PURE__ */ React22.createElement(import_ui18.Collapse, { id: contentId, "aria-labelledby": labelId, in: isOpen, timeout: "auto" }, /* @__PURE__ */ React22.createElement(import_ui18.Stack, { direction: "column", gap: 1, p: 2 }, group.props.map((propId) => (
|
|
1904
2895
|
// TODO: Render actual controls
|
|
1905
|
-
/* @__PURE__ */
|
|
2896
|
+
/* @__PURE__ */ React22.createElement("pre", { key: propId }, JSON.stringify(props[propId], null, 2))
|
|
1906
2897
|
)))));
|
|
1907
2898
|
}
|
|
1908
2899
|
|
|
1909
2900
|
// src/components/instance-editing-panel/instance-editing-panel.tsx
|
|
1910
2901
|
function InstanceEditingPanel() {
|
|
1911
|
-
const { element } = (0,
|
|
1912
|
-
const settings = (0,
|
|
1913
|
-
const componentId =
|
|
1914
|
-
const component = componentId ? selectComponent((0,
|
|
1915
|
-
const overridableProps = componentId ? selectOverridableProps((0,
|
|
1916
|
-
const componentInstanceId = (0,
|
|
2902
|
+
const { element } = (0, import_editor_editing_panel3.useElement)();
|
|
2903
|
+
const settings = (0, import_editor_elements8.useElementSetting)(element.id, "component_instance");
|
|
2904
|
+
const componentId = componentInstancePropTypeUtil.extract(settings)?.component_id?.value;
|
|
2905
|
+
const component = componentId ? selectComponent((0, import_store42.__getState)(), componentId) : null;
|
|
2906
|
+
const overridableProps = componentId ? selectOverridableProps((0, import_store42.__getState)(), componentId) : null;
|
|
2907
|
+
const componentInstanceId = (0, import_editor_elements8.useSelectedElement)()?.element?.id ?? null;
|
|
1917
2908
|
if (!componentId || !overridableProps || !component) {
|
|
1918
2909
|
return null;
|
|
1919
2910
|
}
|
|
1920
|
-
const panelTitle = (0,
|
|
2911
|
+
const panelTitle = (0, import_i18n21.__)("Edit %s", "elementor").replace("%s", component.name);
|
|
1921
2912
|
const handleEditComponent = () => switchToComponent(componentId, componentInstanceId);
|
|
1922
2913
|
const groups = overridableProps.groups.order.map(
|
|
1923
2914
|
(groupId) => overridableProps.groups.items[groupId] ? overridableProps.groups.items[groupId] : null
|
|
1924
2915
|
).filter(Boolean);
|
|
1925
2916
|
const isEmpty = groups.length === 0 || Object.keys(overridableProps.props).length === 0;
|
|
1926
|
-
return /* @__PURE__ */
|
|
2917
|
+
return /* @__PURE__ */ React23.createElement(React23.Fragment, null, /* @__PURE__ */ React23.createElement(import_editor_panels3.PanelHeader, { sx: { justifyContent: "start", px: 2 } }, /* @__PURE__ */ React23.createElement(import_ui19.Stack, { direction: "row", alignContent: "space-between", flexGrow: 1 }, /* @__PURE__ */ React23.createElement(import_ui19.Stack, { direction: "row", alignItems: "center", justifyContent: "start", gap: 1, flexGrow: 1 }, /* @__PURE__ */ React23.createElement(import_icons14.ComponentsIcon, { fontSize: "small", sx: { color: "text.tertiary" } }), /* @__PURE__ */ React23.createElement(import_editor_panels3.PanelHeaderTitle, null, component.name)), /* @__PURE__ */ React23.createElement(import_ui19.Tooltip, { title: panelTitle }, /* @__PURE__ */ React23.createElement(import_ui19.IconButton, { size: "tiny", onClick: handleEditComponent, "aria-label": panelTitle }, /* @__PURE__ */ React23.createElement(import_icons14.PencilIcon, { fontSize: "tiny" }))))), /* @__PURE__ */ React23.createElement(import_editor_panels3.PanelBody, null, isEmpty ? /* @__PURE__ */ React23.createElement(EmptyState2, { onEditComponent: handleEditComponent }) : /* @__PURE__ */ React23.createElement(import_ui19.Stack, { direction: "column", alignItems: "stretch" }, groups.map((group) => /* @__PURE__ */ React23.createElement(OverridePropsGroup, { key: group.id, group, props: overridableProps.props })))));
|
|
1927
2918
|
}
|
|
1928
2919
|
|
|
1929
2920
|
// src/components/overridable-props/overridable-prop-control.tsx
|
|
1930
|
-
var
|
|
2921
|
+
var React25 = __toESM(require("react"));
|
|
1931
2922
|
var import_editor_controls2 = require("@elementor/editor-controls");
|
|
1932
|
-
var
|
|
2923
|
+
var import_editor_editing_panel4 = require("@elementor/editor-editing-panel");
|
|
1933
2924
|
|
|
1934
2925
|
// src/prop-types/component-overridable-prop-type.ts
|
|
1935
2926
|
var import_editor_props4 = require("@elementor/editor-props");
|
|
@@ -1946,18 +2937,18 @@ var componentOverridablePropTypeUtil = (0, import_editor_props4.createPropUtils)
|
|
|
1946
2937
|
);
|
|
1947
2938
|
|
|
1948
2939
|
// src/provider/overridable-prop-context.tsx
|
|
1949
|
-
var
|
|
1950
|
-
var
|
|
1951
|
-
var OverridablePropContext = (0,
|
|
2940
|
+
var React24 = __toESM(require("react"));
|
|
2941
|
+
var import_react13 = require("react");
|
|
2942
|
+
var OverridablePropContext = (0, import_react13.createContext)(null);
|
|
1952
2943
|
function OverridablePropProvider({ children, ...props }) {
|
|
1953
|
-
return /* @__PURE__ */
|
|
2944
|
+
return /* @__PURE__ */ React24.createElement(OverridablePropContext.Provider, { value: props }, children);
|
|
1954
2945
|
}
|
|
1955
|
-
var useOverridablePropValue = () => (0,
|
|
2946
|
+
var useOverridablePropValue = () => (0, import_react13.useContext)(OverridablePropContext)?.value;
|
|
1956
2947
|
|
|
1957
2948
|
// src/store/actions/update-overridable-prop-origin-value.ts
|
|
1958
|
-
var
|
|
2949
|
+
var import_store44 = require("@elementor/store");
|
|
1959
2950
|
function updateOverridablePropOriginValue(componentId, propValue) {
|
|
1960
|
-
const overridableProps = selectOverridableProps((0,
|
|
2951
|
+
const overridableProps = selectOverridableProps((0, import_store44.__getState)(), componentId);
|
|
1961
2952
|
if (!overridableProps) {
|
|
1962
2953
|
return;
|
|
1963
2954
|
}
|
|
@@ -1975,7 +2966,7 @@ function updateOverridablePropOriginValue(componentId, propValue) {
|
|
|
1975
2966
|
}
|
|
1976
2967
|
}
|
|
1977
2968
|
};
|
|
1978
|
-
(0,
|
|
2969
|
+
(0, import_store44.__dispatch)(
|
|
1979
2970
|
slice.actions.setOverridableProps({
|
|
1980
2971
|
componentId,
|
|
1981
2972
|
overridableProps: newOverridableProps
|
|
@@ -1988,7 +2979,7 @@ function OverridablePropControl({
|
|
|
1988
2979
|
OriginalControl,
|
|
1989
2980
|
...props
|
|
1990
2981
|
}) {
|
|
1991
|
-
const { elementType } = (0,
|
|
2982
|
+
const { elementType } = (0, import_editor_editing_panel4.useElement)();
|
|
1992
2983
|
const { value, bind, setValue, placeholder, ...propContext } = (0, import_editor_controls2.useBoundProp)(componentOverridablePropTypeUtil);
|
|
1993
2984
|
const componentId = useCurrentComponentId();
|
|
1994
2985
|
if (!componentId) {
|
|
@@ -2005,13 +2996,13 @@ function OverridablePropControl({
|
|
|
2005
2996
|
setValue(propValue);
|
|
2006
2997
|
updateOverridablePropOriginValue(componentId, propValue);
|
|
2007
2998
|
};
|
|
2008
|
-
const propType = (0,
|
|
2999
|
+
const propType = (0, import_editor_editing_panel4.createTopLevelObjectType)({
|
|
2009
3000
|
schema: {
|
|
2010
3001
|
[bind]: elementType.propsSchema[bind]
|
|
2011
3002
|
}
|
|
2012
3003
|
});
|
|
2013
3004
|
const objectPlaceholder = placeholder ? { [bind]: placeholder } : void 0;
|
|
2014
|
-
return /* @__PURE__ */
|
|
3005
|
+
return /* @__PURE__ */ React25.createElement(OverridablePropProvider, { value }, /* @__PURE__ */ React25.createElement(
|
|
2015
3006
|
import_editor_controls2.PropProvider,
|
|
2016
3007
|
{
|
|
2017
3008
|
...propContext,
|
|
@@ -2020,23 +3011,22 @@ function OverridablePropControl({
|
|
|
2020
3011
|
value: { [bind]: value.origin_value },
|
|
2021
3012
|
placeholder: objectPlaceholder
|
|
2022
3013
|
},
|
|
2023
|
-
/* @__PURE__ */
|
|
3014
|
+
/* @__PURE__ */ React25.createElement(import_editor_controls2.PropKeyProvider, { bind }, /* @__PURE__ */ React25.createElement(import_editor_controls2.ControlReplacementsProvider, { replacements: [] }, /* @__PURE__ */ React25.createElement(OriginalControl, { ...props })))
|
|
2024
3015
|
));
|
|
2025
3016
|
}
|
|
2026
3017
|
|
|
2027
3018
|
// src/components/overridable-props/overridable-prop-indicator.tsx
|
|
2028
|
-
var
|
|
3019
|
+
var React27 = __toESM(require("react"));
|
|
2029
3020
|
var import_editor_controls3 = require("@elementor/editor-controls");
|
|
2030
|
-
var
|
|
2031
|
-
var
|
|
2032
|
-
var
|
|
2033
|
-
var
|
|
2034
|
-
var
|
|
3021
|
+
var import_editor_editing_panel5 = require("@elementor/editor-editing-panel");
|
|
3022
|
+
var import_editor_elements9 = require("@elementor/editor-elements");
|
|
3023
|
+
var import_store51 = require("@elementor/store");
|
|
3024
|
+
var import_ui21 = require("@elementor/ui");
|
|
3025
|
+
var import_i18n23 = require("@wordpress/i18n");
|
|
2035
3026
|
|
|
2036
3027
|
// src/store/actions/set-overridable-prop.ts
|
|
2037
|
-
var
|
|
2038
|
-
var
|
|
2039
|
-
var import_i18n14 = require("@wordpress/i18n");
|
|
3028
|
+
var import_store47 = require("@elementor/store");
|
|
3029
|
+
var import_utils7 = require("@elementor/utils");
|
|
2040
3030
|
function setOverridableProp({
|
|
2041
3031
|
componentId,
|
|
2042
3032
|
overrideKey,
|
|
@@ -2048,7 +3038,7 @@ function setOverridableProp({
|
|
|
2048
3038
|
widgetType,
|
|
2049
3039
|
originValue
|
|
2050
3040
|
}) {
|
|
2051
|
-
const overridableProps = selectOverridableProps((0,
|
|
3041
|
+
const overridableProps = selectOverridableProps((0, import_store47.__getState)(), componentId);
|
|
2052
3042
|
if (!overridableProps) {
|
|
2053
3043
|
return;
|
|
2054
3044
|
}
|
|
@@ -2056,13 +3046,12 @@ function setOverridableProp({
|
|
|
2056
3046
|
const duplicatedTargetProps = Object.values(overridableProps.props).filter(
|
|
2057
3047
|
(prop) => prop.elementId === elementId && prop.propKey === propKey && prop !== existingOverridableProp
|
|
2058
3048
|
);
|
|
2059
|
-
const {
|
|
2060
|
-
|
|
2061
|
-
|
|
2062
|
-
groupId || existingOverridableProp?.groupId
|
|
3049
|
+
const { groups: groupsAfterResolve, groupId: currentGroupId } = resolveOrCreateGroup(
|
|
3050
|
+
overridableProps.groups,
|
|
3051
|
+
groupId || existingOverridableProp?.groupId || void 0
|
|
2063
3052
|
);
|
|
2064
3053
|
const overridableProp = {
|
|
2065
|
-
overrideKey: existingOverridableProp?.overrideKey || (0,
|
|
3054
|
+
overrideKey: existingOverridableProp?.overrideKey || (0, import_utils7.generateUniqueId)("prop"),
|
|
2066
3055
|
label,
|
|
2067
3056
|
elementId,
|
|
2068
3057
|
propKey,
|
|
@@ -2071,31 +3060,21 @@ function setOverridableProp({
|
|
|
2071
3060
|
originValue,
|
|
2072
3061
|
groupId: currentGroupId
|
|
2073
3062
|
};
|
|
2074
|
-
const
|
|
2075
|
-
|
|
2076
|
-
|
|
2077
|
-
|
|
2078
|
-
});
|
|
3063
|
+
const stateAfterRemovingDuplicates = removePropsFromState(
|
|
3064
|
+
{ ...overridableProps, groups: groupsAfterResolve },
|
|
3065
|
+
duplicatedTargetProps
|
|
3066
|
+
);
|
|
2079
3067
|
const props = {
|
|
2080
|
-
...
|
|
3068
|
+
...stateAfterRemovingDuplicates.props,
|
|
2081
3069
|
[overridableProp.overrideKey]: overridableProp
|
|
2082
3070
|
};
|
|
2083
|
-
|
|
2084
|
-
|
|
2085
|
-
...groupsWithoutDuplicates.items,
|
|
2086
|
-
[currentGroupId]: getGroupWithProp(groupsWithoutDuplicates, currentGroupId, overridableProp)
|
|
2087
|
-
},
|
|
2088
|
-
order: groupsWithoutDuplicates.order.includes(currentGroupId) ? groupsWithoutDuplicates.order : [...groupsWithoutDuplicates.order, currentGroupId]
|
|
2089
|
-
};
|
|
3071
|
+
let groups = addPropToGroup(stateAfterRemovingDuplicates.groups, currentGroupId, overridableProp.overrideKey);
|
|
3072
|
+
groups = ensureGroupInOrder(groups, currentGroupId);
|
|
2090
3073
|
const isChangingGroups = existingOverridableProp && existingOverridableProp.groupId !== currentGroupId;
|
|
2091
3074
|
if (isChangingGroups) {
|
|
2092
|
-
groups
|
|
2093
|
-
groupsWithoutDuplicates,
|
|
2094
|
-
existingOverridableProp.groupId,
|
|
2095
|
-
overridableProp
|
|
2096
|
-
);
|
|
3075
|
+
groups = removePropFromGroup(groups, existingOverridableProp.groupId, overridableProp.overrideKey);
|
|
2097
3076
|
}
|
|
2098
|
-
(0,
|
|
3077
|
+
(0, import_store47.__dispatch)(
|
|
2099
3078
|
slice.actions.setOverridableProps({
|
|
2100
3079
|
componentId,
|
|
2101
3080
|
overridableProps: {
|
|
@@ -2106,83 +3085,15 @@ function setOverridableProp({
|
|
|
2106
3085
|
);
|
|
2107
3086
|
return overridableProp;
|
|
2108
3087
|
}
|
|
2109
|
-
function getUpdatedGroups(groups, groupId) {
|
|
2110
|
-
if (!groupId) {
|
|
2111
|
-
if (groups.order.length > 0) {
|
|
2112
|
-
return { groups, currentGroupId: groups.order[0] };
|
|
2113
|
-
}
|
|
2114
|
-
return addNewGroup(groups);
|
|
2115
|
-
}
|
|
2116
|
-
if (!groups.items[groupId]) {
|
|
2117
|
-
return addNewGroup(groups, groupId);
|
|
2118
|
-
}
|
|
2119
|
-
return { groups, currentGroupId: groupId };
|
|
2120
|
-
}
|
|
2121
|
-
function addNewGroup(groups, groupId) {
|
|
2122
|
-
const currentGroupId = groupId || (0, import_utils5.generateUniqueId)("group");
|
|
2123
|
-
const updatedGroups = {
|
|
2124
|
-
...groups,
|
|
2125
|
-
items: {
|
|
2126
|
-
...groups.items,
|
|
2127
|
-
[currentGroupId]: {
|
|
2128
|
-
id: currentGroupId,
|
|
2129
|
-
label: (0, import_i18n14.__)("Default", "elementor"),
|
|
2130
|
-
props: []
|
|
2131
|
-
}
|
|
2132
|
-
},
|
|
2133
|
-
order: [...groups.order, currentGroupId]
|
|
2134
|
-
};
|
|
2135
|
-
return { groups: updatedGroups, currentGroupId };
|
|
2136
|
-
}
|
|
2137
|
-
function getGroupWithProp(groups, groupId, overridableProp) {
|
|
2138
|
-
const group = { ...groups.items[groupId] };
|
|
2139
|
-
if (!group.props.includes(overridableProp.overrideKey)) {
|
|
2140
|
-
group.props = [...group.props, overridableProp.overrideKey];
|
|
2141
|
-
}
|
|
2142
|
-
return group;
|
|
2143
|
-
}
|
|
2144
|
-
function getGroupWithoutProp(groups, groupId, overridableProp) {
|
|
2145
|
-
const group = { ...groups.items[groupId] };
|
|
2146
|
-
if (group) {
|
|
2147
|
-
group.props = group.props.filter((key) => key !== overridableProp.overrideKey);
|
|
2148
|
-
}
|
|
2149
|
-
return group;
|
|
2150
|
-
}
|
|
2151
|
-
function removeProps({
|
|
2152
|
-
props,
|
|
2153
|
-
groups,
|
|
2154
|
-
propsToRemove
|
|
2155
|
-
}) {
|
|
2156
|
-
const allProps = Object.fromEntries(
|
|
2157
|
-
Object.entries(props).filter(([, prop]) => !propsToRemove.includes(prop))
|
|
2158
|
-
);
|
|
2159
|
-
const overrideKeysToRemove = propsToRemove.map((prop) => prop.overrideKey);
|
|
2160
|
-
const allGroupItems = Object.fromEntries(
|
|
2161
|
-
Object.entries(groups.items).map(([groupId, group]) => [
|
|
2162
|
-
groupId,
|
|
2163
|
-
{
|
|
2164
|
-
...group,
|
|
2165
|
-
props: group.props.filter((prop) => !overrideKeysToRemove.includes(prop))
|
|
2166
|
-
}
|
|
2167
|
-
])
|
|
2168
|
-
);
|
|
2169
|
-
return {
|
|
2170
|
-
props: allProps,
|
|
2171
|
-
groups: {
|
|
2172
|
-
items: allGroupItems,
|
|
2173
|
-
order: groups.order.filter((groupId) => !overrideKeysToRemove.includes(groupId))
|
|
2174
|
-
}
|
|
2175
|
-
};
|
|
2176
|
-
}
|
|
2177
3088
|
|
|
2178
3089
|
// src/components/overridable-props/indicator.tsx
|
|
2179
|
-
var
|
|
2180
|
-
var
|
|
2181
|
-
var
|
|
2182
|
-
var
|
|
2183
|
-
var
|
|
2184
|
-
var
|
|
2185
|
-
var IconContainer = (0,
|
|
3090
|
+
var React26 = __toESM(require("react"));
|
|
3091
|
+
var import_react14 = require("react");
|
|
3092
|
+
var import_icons15 = require("@elementor/icons");
|
|
3093
|
+
var import_ui20 = require("@elementor/ui");
|
|
3094
|
+
var import_i18n22 = require("@wordpress/i18n");
|
|
3095
|
+
var SIZE2 = "tiny";
|
|
3096
|
+
var IconContainer = (0, import_ui20.styled)(import_ui20.Box)`
|
|
2186
3097
|
pointer-events: none;
|
|
2187
3098
|
opacity: 0;
|
|
2188
3099
|
transition: opacity 0.2s ease-in-out;
|
|
@@ -2199,7 +3110,7 @@ var IconContainer = (0, import_ui13.styled)(import_ui13.Box)`
|
|
|
2199
3110
|
stroke-width: 2px;
|
|
2200
3111
|
}
|
|
2201
3112
|
`;
|
|
2202
|
-
var Content = (0,
|
|
3113
|
+
var Content = (0, import_ui20.styled)(import_ui20.Box)`
|
|
2203
3114
|
position: relative;
|
|
2204
3115
|
display: flex;
|
|
2205
3116
|
align-items: center;
|
|
@@ -2236,79 +3147,22 @@ var Content = (0, import_ui13.styled)(import_ui13.Box)`
|
|
|
2236
3147
|
}
|
|
2237
3148
|
}
|
|
2238
3149
|
`;
|
|
2239
|
-
var Indicator = (0,
|
|
3150
|
+
var Indicator = (0, import_react14.forwardRef)(({ isOpen, isOverridable, ...props }, ref) => /* @__PURE__ */ React26.createElement(Content, { ref, ...props, className: isOpen || isOverridable ? "enlarged" : "" }, /* @__PURE__ */ React26.createElement(
|
|
2240
3151
|
IconContainer,
|
|
2241
3152
|
{
|
|
2242
3153
|
className: "icon",
|
|
2243
|
-
"aria-label": isOverridable ? (0,
|
|
3154
|
+
"aria-label": isOverridable ? (0, import_i18n22.__)("Overridable property", "elementor") : (0, import_i18n22.__)("Make prop overridable", "elementor")
|
|
2244
3155
|
},
|
|
2245
|
-
isOverridable ? /* @__PURE__ */
|
|
3156
|
+
isOverridable ? /* @__PURE__ */ React26.createElement(import_icons15.CheckIcon, { fontSize: SIZE2 }) : /* @__PURE__ */ React26.createElement(import_icons15.PlusIcon, { fontSize: SIZE2 })
|
|
2246
3157
|
)));
|
|
2247
3158
|
|
|
2248
|
-
// src/components/overridable-props/overridable-prop-form.tsx
|
|
2249
|
-
var React20 = __toESM(require("react"));
|
|
2250
|
-
var import_react12 = require("react");
|
|
2251
|
-
var import_editor_ui7 = require("@elementor/editor-ui");
|
|
2252
|
-
var import_ui14 = require("@elementor/ui");
|
|
2253
|
-
var import_i18n16 = require("@wordpress/i18n");
|
|
2254
|
-
var SIZE2 = "tiny";
|
|
2255
|
-
var DEFAULT_GROUP = { value: null, label: (0, import_i18n16.__)("Default", "elementor") };
|
|
2256
|
-
function OverridablePropForm({ onSubmit, groups, currentValue }) {
|
|
2257
|
-
const [propLabel, setPropLabel] = (0, import_react12.useState)(currentValue?.label ?? null);
|
|
2258
|
-
const [group, setGroup] = (0, import_react12.useState)(currentValue?.groupId ?? groups?.[0]?.value ?? null);
|
|
2259
|
-
const name = (0, import_i18n16.__)("Name", "elementor");
|
|
2260
|
-
const groupName = (0, import_i18n16.__)("Group Name", "elementor");
|
|
2261
|
-
const isCreate = currentValue === void 0;
|
|
2262
|
-
const title = isCreate ? (0, import_i18n16.__)("Create new property", "elementor") : (0, import_i18n16.__)("Update property", "elementor");
|
|
2263
|
-
const ctaLabel = isCreate ? (0, import_i18n16.__)("Create", "elementor") : (0, import_i18n16.__)("Update", "elementor");
|
|
2264
|
-
return /* @__PURE__ */ React20.createElement(import_editor_ui7.Form, { onSubmit: () => onSubmit({ label: propLabel ?? "", group }) }, /* @__PURE__ */ React20.createElement(import_ui14.Stack, { alignItems: "start", width: "268px" }, /* @__PURE__ */ React20.createElement(
|
|
2265
|
-
import_ui14.Stack,
|
|
2266
|
-
{
|
|
2267
|
-
direction: "row",
|
|
2268
|
-
alignItems: "center",
|
|
2269
|
-
py: 1,
|
|
2270
|
-
px: 1.5,
|
|
2271
|
-
sx: { columnGap: 0.5, borderBottom: "1px solid", borderColor: "divider", width: "100%", mb: 1.5 }
|
|
2272
|
-
},
|
|
2273
|
-
/* @__PURE__ */ React20.createElement(import_ui14.Typography, { variant: "caption", sx: { color: "text.primary", fontWeight: "500", lineHeight: 1 } }, title)
|
|
2274
|
-
), /* @__PURE__ */ React20.createElement(import_ui14.Grid, { container: true, gap: 0.75, alignItems: "start", px: 1.5, mb: 1.5 }, /* @__PURE__ */ React20.createElement(import_ui14.Grid, { item: true, xs: 12 }, /* @__PURE__ */ React20.createElement(import_ui14.FormLabel, { size: "tiny" }, name)), /* @__PURE__ */ React20.createElement(import_ui14.Grid, { item: true, xs: 12 }, /* @__PURE__ */ React20.createElement(
|
|
2275
|
-
import_ui14.TextField,
|
|
2276
|
-
{
|
|
2277
|
-
name,
|
|
2278
|
-
size: SIZE2,
|
|
2279
|
-
fullWidth: true,
|
|
2280
|
-
placeholder: (0, import_i18n16.__)("Enter value", "elementor"),
|
|
2281
|
-
value: propLabel ?? "",
|
|
2282
|
-
onChange: (e) => setPropLabel(e.target.value)
|
|
2283
|
-
}
|
|
2284
|
-
))), /* @__PURE__ */ React20.createElement(import_ui14.Grid, { container: true, gap: 0.75, alignItems: "start", px: 1.5, mb: 1.5 }, /* @__PURE__ */ React20.createElement(import_ui14.Grid, { item: true, xs: 12 }, /* @__PURE__ */ React20.createElement(import_ui14.FormLabel, { size: "tiny" }, groupName)), /* @__PURE__ */ React20.createElement(import_ui14.Grid, { item: true, xs: 12 }, /* @__PURE__ */ React20.createElement(
|
|
2285
|
-
import_ui14.Select,
|
|
2286
|
-
{
|
|
2287
|
-
name: groupName,
|
|
2288
|
-
size: SIZE2,
|
|
2289
|
-
fullWidth: true,
|
|
2290
|
-
value: group ?? null,
|
|
2291
|
-
onChange: setGroup,
|
|
2292
|
-
displayEmpty: true,
|
|
2293
|
-
renderValue: (selectedValue) => {
|
|
2294
|
-
if (!selectedValue || selectedValue === "") {
|
|
2295
|
-
const [firstGroup = DEFAULT_GROUP] = groups ?? [];
|
|
2296
|
-
return firstGroup.label;
|
|
2297
|
-
}
|
|
2298
|
-
return groups?.find(({ value }) => value === selectedValue)?.label ?? selectedValue;
|
|
2299
|
-
}
|
|
2300
|
-
},
|
|
2301
|
-
(groups ?? [DEFAULT_GROUP]).map(({ label: groupLabel, ...props }) => /* @__PURE__ */ React20.createElement(import_editor_ui7.MenuListItem, { key: props.value, ...props, value: props.value ?? "" }, groupLabel))
|
|
2302
|
-
))), /* @__PURE__ */ React20.createElement(import_ui14.Stack, { direction: "row", justifyContent: "flex-end", alignSelf: "end", mt: 1.5, py: 1, px: 1.5 }, /* @__PURE__ */ React20.createElement(import_ui14.Button, { type: "submit", disabled: !propLabel, variant: "contained", color: "primary", size: "small" }, ctaLabel))));
|
|
2303
|
-
}
|
|
2304
|
-
|
|
2305
3159
|
// src/components/overridable-props/utils/get-overridable-prop.ts
|
|
2306
|
-
var
|
|
3160
|
+
var import_store49 = require("@elementor/store");
|
|
2307
3161
|
function getOverridableProp({
|
|
2308
3162
|
componentId,
|
|
2309
3163
|
overrideKey
|
|
2310
3164
|
}) {
|
|
2311
|
-
const overridableProps = selectOverridableProps((0,
|
|
3165
|
+
const overridableProps = selectOverridableProps((0, import_store49.__getState)(), componentId);
|
|
2312
3166
|
if (!overridableProps) {
|
|
2313
3167
|
return void 0;
|
|
2314
3168
|
}
|
|
@@ -2323,26 +3177,26 @@ function OverridablePropIndicator() {
|
|
|
2323
3177
|
if (!isPropAllowed(bind) || !componentId) {
|
|
2324
3178
|
return null;
|
|
2325
3179
|
}
|
|
2326
|
-
const overridableProps = selectOverridableProps((0,
|
|
2327
|
-
return /* @__PURE__ */
|
|
3180
|
+
const overridableProps = selectOverridableProps((0, import_store51.__getState)(), componentId);
|
|
3181
|
+
return /* @__PURE__ */ React27.createElement(Content2, { componentId, overridableProps });
|
|
2328
3182
|
}
|
|
2329
3183
|
function Content2({ componentId, overridableProps }) {
|
|
2330
3184
|
const {
|
|
2331
3185
|
element: { id: elementId },
|
|
2332
3186
|
elementType
|
|
2333
|
-
} = (0,
|
|
3187
|
+
} = (0, import_editor_editing_panel5.useElement)();
|
|
2334
3188
|
const { value, bind, propType } = (0, import_editor_controls3.useBoundProp)();
|
|
2335
3189
|
const contextOverridableValue = useOverridablePropValue();
|
|
2336
3190
|
const { value: boundPropOverridableValue, setValue: setOverridableValue } = (0, import_editor_controls3.useBoundProp)(
|
|
2337
3191
|
componentOverridablePropTypeUtil
|
|
2338
3192
|
);
|
|
2339
3193
|
const overridableValue = boundPropOverridableValue ?? contextOverridableValue;
|
|
2340
|
-
const popupState = (0,
|
|
3194
|
+
const popupState = (0, import_ui21.usePopupState)({
|
|
2341
3195
|
variant: "popover"
|
|
2342
3196
|
});
|
|
2343
|
-
const triggerProps = (0,
|
|
2344
|
-
const popoverProps = (0,
|
|
2345
|
-
const { elType } = (0,
|
|
3197
|
+
const triggerProps = (0, import_ui21.bindTrigger)(popupState);
|
|
3198
|
+
const popoverProps = (0, import_ui21.bindPopover)(popupState);
|
|
3199
|
+
const { elType } = (0, import_editor_elements9.getWidgetsCache)()?.[elementType.key] ?? { elType: "widget" };
|
|
2346
3200
|
const handleSubmit = ({ label, group }) => {
|
|
2347
3201
|
const originValue = !overridableValue ? value ?? propType.default : overridableValue?.origin_value ?? {};
|
|
2348
3202
|
const overridablePropConfig = setOverridableProp({
|
|
@@ -2365,8 +3219,8 @@ function Content2({ componentId, overridableProps }) {
|
|
|
2365
3219
|
popupState.close();
|
|
2366
3220
|
};
|
|
2367
3221
|
const overridableConfig = overridableValue ? getOverridableProp({ componentId, overrideKey: overridableValue.override_key }) : void 0;
|
|
2368
|
-
return /* @__PURE__ */
|
|
2369
|
-
|
|
3222
|
+
return /* @__PURE__ */ React27.createElement(React27.Fragment, null, /* @__PURE__ */ React27.createElement(import_ui21.Tooltip, { placement: "top", title: (0, import_i18n23.__)("Override Property", "elementor") }, /* @__PURE__ */ React27.createElement(Indicator, { ...triggerProps, isOpen: !!popoverProps.open, isOverridable: !!overridableValue })), /* @__PURE__ */ React27.createElement(
|
|
3223
|
+
import_ui21.Popover,
|
|
2370
3224
|
{
|
|
2371
3225
|
disableScrollLock: true,
|
|
2372
3226
|
anchorOrigin: {
|
|
@@ -2382,7 +3236,7 @@ function Content2({ componentId, overridableProps }) {
|
|
|
2382
3236
|
},
|
|
2383
3237
|
...popoverProps
|
|
2384
3238
|
},
|
|
2385
|
-
/* @__PURE__ */
|
|
3239
|
+
/* @__PURE__ */ React27.createElement(
|
|
2386
3240
|
OverridablePropForm,
|
|
2387
3241
|
{
|
|
2388
3242
|
onSubmit: handleSubmit,
|
|
@@ -2404,11 +3258,11 @@ var import_editor_mcp2 = require("@elementor/editor-mcp");
|
|
|
2404
3258
|
|
|
2405
3259
|
// src/mcp/save-as-component-tool.ts
|
|
2406
3260
|
var import_editor_canvas7 = require("@elementor/editor-canvas");
|
|
2407
|
-
var
|
|
3261
|
+
var import_editor_elements10 = require("@elementor/editor-elements");
|
|
2408
3262
|
var import_editor_mcp = require("@elementor/editor-mcp");
|
|
2409
3263
|
var import_http_client2 = require("@elementor/http-client");
|
|
2410
3264
|
var import_schema6 = require("@elementor/schema");
|
|
2411
|
-
var
|
|
3265
|
+
var import_utils8 = require("@elementor/utils");
|
|
2412
3266
|
var InputSchema = {
|
|
2413
3267
|
element_id: import_schema6.z.string().describe(
|
|
2414
3268
|
'The unique identifier of the element to save as a component. Use the "list-elements" tool to find available element IDs in the current document.'
|
|
@@ -2431,7 +3285,7 @@ var OutputSchema = {
|
|
|
2431
3285
|
message: import_schema6.z.string().optional().describe("Additional information about the operation result"),
|
|
2432
3286
|
component_uid: import_schema6.z.string().optional().describe("The unique identifier of the newly created component (only present on success)")
|
|
2433
3287
|
};
|
|
2434
|
-
var
|
|
3288
|
+
var ERROR_MESSAGES2 = {
|
|
2435
3289
|
ELEMENT_NOT_FOUND: "Element not found. Use 'list-elements' to get valid element IDs.",
|
|
2436
3290
|
ELEMENT_NOT_ONE_OF_TYPES: (validTypes) => `Element is not one of the following types: ${validTypes.join(", ")}`,
|
|
2437
3291
|
ELEMENT_IS_LOCKED: "Cannot save a locked element as a component."
|
|
@@ -2439,23 +3293,23 @@ var ERROR_MESSAGES = {
|
|
|
2439
3293
|
var handleSaveAsComponent = async (params) => {
|
|
2440
3294
|
const { element_id: elementId, component_name: componentName, overridable_props: overridablePropsInput } = params;
|
|
2441
3295
|
const validElementTypes = getValidElementTypes();
|
|
2442
|
-
const container = (0,
|
|
3296
|
+
const container = (0, import_editor_elements10.getContainer)(elementId);
|
|
2443
3297
|
if (!container) {
|
|
2444
|
-
throw new Error(
|
|
3298
|
+
throw new Error(ERROR_MESSAGES2.ELEMENT_NOT_FOUND);
|
|
2445
3299
|
}
|
|
2446
3300
|
const elType = container.model.get("elType");
|
|
2447
3301
|
if (!validElementTypes.includes(elType)) {
|
|
2448
|
-
throw new Error(
|
|
3302
|
+
throw new Error(ERROR_MESSAGES2.ELEMENT_NOT_ONE_OF_TYPES(validElementTypes));
|
|
2449
3303
|
}
|
|
2450
3304
|
const element = container.model.toJSON({ remove: ["default"] });
|
|
2451
3305
|
if (element?.isLocked) {
|
|
2452
|
-
throw new Error(
|
|
3306
|
+
throw new Error(ERROR_MESSAGES2.ELEMENT_IS_LOCKED);
|
|
2453
3307
|
}
|
|
2454
3308
|
const overridableProps = overridablePropsInput ? enrichOverridableProps(overridablePropsInput, element) : void 0;
|
|
2455
3309
|
if (overridableProps) {
|
|
2456
3310
|
updateElementDataWithOverridableProps(element, overridableProps);
|
|
2457
3311
|
}
|
|
2458
|
-
const uid = (0,
|
|
3312
|
+
const uid = (0, import_utils8.generateUniqueId)("component");
|
|
2459
3313
|
try {
|
|
2460
3314
|
await apiClient.validate({
|
|
2461
3315
|
items: [
|
|
@@ -2477,7 +3331,7 @@ var handleSaveAsComponent = async (params) => {
|
|
|
2477
3331
|
};
|
|
2478
3332
|
function enrichOverridableProps(input, rootElement) {
|
|
2479
3333
|
const enrichedProps = {};
|
|
2480
|
-
const defaultGroupId = (0,
|
|
3334
|
+
const defaultGroupId = (0, import_utils8.generateUniqueId)("group");
|
|
2481
3335
|
Object.entries(input.props).forEach(([, prop]) => {
|
|
2482
3336
|
const { elementId, propKey } = prop;
|
|
2483
3337
|
const element = findElementById(rootElement, elementId);
|
|
@@ -2486,7 +3340,7 @@ function enrichOverridableProps(input, rootElement) {
|
|
|
2486
3340
|
}
|
|
2487
3341
|
const elType = element.elType;
|
|
2488
3342
|
const widgetType = element.widgetType || element.elType;
|
|
2489
|
-
const elementType = (0,
|
|
3343
|
+
const elementType = (0, import_editor_elements10.getElementType)(widgetType);
|
|
2490
3344
|
if (!elementType) {
|
|
2491
3345
|
throw new Error(
|
|
2492
3346
|
`Element type "${widgetType}" is not atomic or does not have a settings schema. Cannot expose property "${propKey}" for element "${elementId}".`
|
|
@@ -2498,7 +3352,7 @@ function enrichOverridableProps(input, rootElement) {
|
|
|
2498
3352
|
`Property "${propKey}" does not exist in element "${elementId}" (type: ${widgetType}). Available properties: ${availableProps}`
|
|
2499
3353
|
);
|
|
2500
3354
|
}
|
|
2501
|
-
const overrideKey = (0,
|
|
3355
|
+
const overrideKey = (0, import_utils8.generateUniqueId)("prop");
|
|
2502
3356
|
const originValue = element.settings?.[propKey] ? element.settings[propKey] : elementType.propsSchema[propKey].default ?? null;
|
|
2503
3357
|
const label = generateLabel(propKey);
|
|
2504
3358
|
enrichedProps[overrideKey] = {
|
|
@@ -2556,11 +3410,11 @@ function findElementById(root, targetId) {
|
|
|
2556
3410
|
return null;
|
|
2557
3411
|
}
|
|
2558
3412
|
function generateLabel(propKey) {
|
|
2559
|
-
const uniqueId = (0,
|
|
3413
|
+
const uniqueId = (0, import_utils8.generateUniqueId)("prop");
|
|
2560
3414
|
return `${uniqueId} - ${propKey}`;
|
|
2561
3415
|
}
|
|
2562
3416
|
function getValidElementTypes() {
|
|
2563
|
-
const types = (0,
|
|
3417
|
+
const types = (0, import_editor_elements10.getWidgetsCache)();
|
|
2564
3418
|
if (!types) {
|
|
2565
3419
|
return [];
|
|
2566
3420
|
}
|
|
@@ -2732,29 +3586,29 @@ function initMcp() {
|
|
|
2732
3586
|
}
|
|
2733
3587
|
|
|
2734
3588
|
// src/populate-store.ts
|
|
2735
|
-
var
|
|
2736
|
-
var
|
|
3589
|
+
var import_react15 = require("react");
|
|
3590
|
+
var import_store53 = require("@elementor/store");
|
|
2737
3591
|
function PopulateStore() {
|
|
2738
|
-
(0,
|
|
2739
|
-
(0,
|
|
3592
|
+
(0, import_react15.useEffect)(() => {
|
|
3593
|
+
(0, import_store53.__dispatch)(loadComponents());
|
|
2740
3594
|
}, []);
|
|
2741
3595
|
return null;
|
|
2742
3596
|
}
|
|
2743
3597
|
|
|
2744
3598
|
// src/store/actions/remove-component-styles.ts
|
|
2745
|
-
var
|
|
2746
|
-
function removeComponentStyles(
|
|
2747
|
-
apiClient.invalidateComponentConfigCache(
|
|
2748
|
-
(0,
|
|
3599
|
+
var import_store54 = require("@elementor/store");
|
|
3600
|
+
function removeComponentStyles(id2) {
|
|
3601
|
+
apiClient.invalidateComponentConfigCache(id2);
|
|
3602
|
+
(0, import_store54.__dispatch)(slice.actions.removeStyles({ id: id2 }));
|
|
2749
3603
|
}
|
|
2750
3604
|
|
|
2751
3605
|
// src/store/components-styles-provider.ts
|
|
2752
3606
|
var import_editor_styles_repository = require("@elementor/editor-styles-repository");
|
|
2753
|
-
var
|
|
3607
|
+
var import_store56 = require("@elementor/store");
|
|
2754
3608
|
var componentsStylesProvider = (0, import_editor_styles_repository.createStylesProvider)({
|
|
2755
3609
|
key: "components-styles",
|
|
2756
3610
|
priority: 100,
|
|
2757
|
-
subscribe: (cb) => (0,
|
|
3611
|
+
subscribe: (cb) => (0, import_store56.__subscribeWithSelector)(
|
|
2758
3612
|
(state) => state[SLICE_NAME],
|
|
2759
3613
|
() => {
|
|
2760
3614
|
cb();
|
|
@@ -2762,29 +3616,29 @@ var componentsStylesProvider = (0, import_editor_styles_repository.createStylesP
|
|
|
2762
3616
|
),
|
|
2763
3617
|
actions: {
|
|
2764
3618
|
all: () => {
|
|
2765
|
-
return selectFlatStyles((0,
|
|
3619
|
+
return selectFlatStyles((0, import_store56.__getState)());
|
|
2766
3620
|
},
|
|
2767
|
-
get: (
|
|
2768
|
-
return selectFlatStyles((0,
|
|
3621
|
+
get: (id2) => {
|
|
3622
|
+
return selectFlatStyles((0, import_store56.__getState)()).find((style) => style.id === id2) ?? null;
|
|
2769
3623
|
}
|
|
2770
3624
|
}
|
|
2771
3625
|
});
|
|
2772
3626
|
|
|
2773
3627
|
// src/sync/create-components-before-save.ts
|
|
2774
|
-
var
|
|
2775
|
-
var
|
|
3628
|
+
var import_editor_elements11 = require("@elementor/editor-elements");
|
|
3629
|
+
var import_store58 = require("@elementor/store");
|
|
2776
3630
|
async function createComponentsBeforeSave({
|
|
2777
3631
|
elements,
|
|
2778
3632
|
status
|
|
2779
3633
|
}) {
|
|
2780
|
-
const unpublishedComponents = selectUnpublishedComponents((0,
|
|
3634
|
+
const unpublishedComponents = selectUnpublishedComponents((0, import_store58.__getState)());
|
|
2781
3635
|
if (!unpublishedComponents.length) {
|
|
2782
3636
|
return;
|
|
2783
3637
|
}
|
|
2784
3638
|
try {
|
|
2785
3639
|
const uidToComponentId = await createComponents(unpublishedComponents, status);
|
|
2786
3640
|
updateComponentInstances(elements, uidToComponentId);
|
|
2787
|
-
(0,
|
|
3641
|
+
(0, import_store58.__dispatch)(
|
|
2788
3642
|
slice.actions.add(
|
|
2789
3643
|
unpublishedComponents.map((component) => ({
|
|
2790
3644
|
id: uidToComponentId.get(component.uid),
|
|
@@ -2794,7 +3648,7 @@ async function createComponentsBeforeSave({
|
|
|
2794
3648
|
}))
|
|
2795
3649
|
)
|
|
2796
3650
|
);
|
|
2797
|
-
(0,
|
|
3651
|
+
(0, import_store58.__dispatch)(slice.actions.resetUnpublished());
|
|
2798
3652
|
} catch (error) {
|
|
2799
3653
|
throw new Error(`Failed to publish components and update component instances: ${error}`);
|
|
2800
3654
|
}
|
|
@@ -2836,7 +3690,7 @@ function shouldUpdateElement(element, uidToComponentId) {
|
|
|
2836
3690
|
return { shouldUpdate: false, newComponentId: null };
|
|
2837
3691
|
}
|
|
2838
3692
|
function updateElementComponentId(elementId, componentId) {
|
|
2839
|
-
(0,
|
|
3693
|
+
(0, import_editor_elements11.updateElementSettings)({
|
|
2840
3694
|
id: elementId,
|
|
2841
3695
|
props: {
|
|
2842
3696
|
component_instance: {
|
|
@@ -2851,7 +3705,7 @@ function updateElementComponentId(elementId, componentId) {
|
|
|
2851
3705
|
}
|
|
2852
3706
|
|
|
2853
3707
|
// src/sync/set-component-overridable-props-settings-before-save.ts
|
|
2854
|
-
var
|
|
3708
|
+
var import_store60 = require("@elementor/store");
|
|
2855
3709
|
var setComponentOverridablePropsSettingsBeforeSave = ({
|
|
2856
3710
|
container
|
|
2857
3711
|
}) => {
|
|
@@ -2859,7 +3713,7 @@ var setComponentOverridablePropsSettingsBeforeSave = ({
|
|
|
2859
3713
|
if (!currentDocument || currentDocument.config.type !== COMPONENT_DOCUMENT_TYPE) {
|
|
2860
3714
|
return;
|
|
2861
3715
|
}
|
|
2862
|
-
const overridableProps = selectOverridableProps((0,
|
|
3716
|
+
const overridableProps = selectOverridableProps((0, import_store60.__getState)(), currentDocument.id);
|
|
2863
3717
|
if (overridableProps) {
|
|
2864
3718
|
container.settings.set("overridable_props", overridableProps);
|
|
2865
3719
|
}
|
|
@@ -2867,7 +3721,7 @@ var setComponentOverridablePropsSettingsBeforeSave = ({
|
|
|
2867
3721
|
|
|
2868
3722
|
// src/sync/update-archived-component-before-save.ts
|
|
2869
3723
|
var import_editor_notifications = require("@elementor/editor-notifications");
|
|
2870
|
-
var
|
|
3724
|
+
var import_store62 = require("@elementor/store");
|
|
2871
3725
|
var failedNotification = (message) => ({
|
|
2872
3726
|
type: "error",
|
|
2873
3727
|
message: `Failed to archive components: ${message}`,
|
|
@@ -2880,7 +3734,7 @@ var successNotification = (message) => ({
|
|
|
2880
3734
|
});
|
|
2881
3735
|
var updateArchivedComponentBeforeSave = async () => {
|
|
2882
3736
|
try {
|
|
2883
|
-
const archivedComponents = selectArchivedComponents((0,
|
|
3737
|
+
const archivedComponents = selectArchivedComponents((0, import_store62.__getState)());
|
|
2884
3738
|
if (!archivedComponents.length) {
|
|
2885
3739
|
return;
|
|
2886
3740
|
}
|
|
@@ -2901,19 +3755,19 @@ var updateArchivedComponentBeforeSave = async () => {
|
|
|
2901
3755
|
};
|
|
2902
3756
|
|
|
2903
3757
|
// src/sync/update-components-before-save.ts
|
|
2904
|
-
var
|
|
3758
|
+
var import_editor_documents11 = require("@elementor/editor-documents");
|
|
2905
3759
|
async function updateComponentsBeforeSave({ status, elements }) {
|
|
2906
3760
|
if (status !== "publish") {
|
|
2907
3761
|
return;
|
|
2908
3762
|
}
|
|
2909
3763
|
const componentIds = await getComponentIds(elements);
|
|
2910
3764
|
const componentDocumentData = await Promise.all(componentIds.map(getComponentDocumentData));
|
|
2911
|
-
const draftIds = componentDocumentData.filter((document) => !!document).filter(
|
|
3765
|
+
const draftIds = componentDocumentData.filter((document) => !!document).filter(import_editor_documents11.isDocumentDirty).map((document) => document.id);
|
|
2912
3766
|
if (draftIds.length === 0) {
|
|
2913
3767
|
return;
|
|
2914
3768
|
}
|
|
2915
3769
|
await apiClient.updateStatuses(draftIds, "publish");
|
|
2916
|
-
draftIds.forEach((
|
|
3770
|
+
draftIds.forEach((id2) => invalidateComponentDocumentData(id2));
|
|
2917
3771
|
}
|
|
2918
3772
|
|
|
2919
3773
|
// src/sync/before-save.ts
|
|
@@ -2930,13 +3784,14 @@ var beforeSave = ({ container, status }) => {
|
|
|
2930
3784
|
// src/init.ts
|
|
2931
3785
|
function init() {
|
|
2932
3786
|
import_editor_styles_repository2.stylesRepository.register(componentsStylesProvider);
|
|
2933
|
-
(0,
|
|
3787
|
+
(0, import_store64.__registerSlice)(slice);
|
|
3788
|
+
(0, import_editor_panels4.__registerPanel)(panel);
|
|
2934
3789
|
(0, import_editor_canvas8.registerElementType)(
|
|
2935
3790
|
TYPE,
|
|
2936
3791
|
(options) => createComponentType({ ...options, showLockedByModal: openEditModeDialog })
|
|
2937
3792
|
);
|
|
2938
3793
|
(0, import_editor_v1_adapters6.registerDataHook)("dependency", "editor/documents/close", (args) => {
|
|
2939
|
-
const document = (0,
|
|
3794
|
+
const document = (0, import_editor_documents12.getV1CurrentDocument)();
|
|
2940
3795
|
if (document.config.type === COMPONENT_DOCUMENT_TYPE) {
|
|
2941
3796
|
args.mode = "autosave";
|
|
2942
3797
|
}
|
|
@@ -2946,7 +3801,7 @@ function init() {
|
|
|
2946
3801
|
window.elementorCommon.__beforeSave = beforeSave;
|
|
2947
3802
|
(0, import_editor_elements_panel.injectTab)({
|
|
2948
3803
|
id: "components",
|
|
2949
|
-
label: (0,
|
|
3804
|
+
label: (0, import_i18n24.__)("Components", "elementor"),
|
|
2950
3805
|
component: Components
|
|
2951
3806
|
});
|
|
2952
3807
|
(0, import_editor.injectIntoTop)({
|
|
@@ -2961,28 +3816,28 @@ function init() {
|
|
|
2961
3816
|
id: "edit-component",
|
|
2962
3817
|
component: EditComponent
|
|
2963
3818
|
});
|
|
2964
|
-
(0,
|
|
3819
|
+
(0, import_editor_editing_panel6.injectIntoPanelHeaderTop)({
|
|
2965
3820
|
id: "component-panel-header",
|
|
2966
3821
|
component: ComponentPanelHeader
|
|
2967
3822
|
});
|
|
2968
3823
|
(0, import_editor_v1_adapters6.registerDataHook)("after", "editor/documents/attach-preview", async () => {
|
|
2969
|
-
const { id, config } = (0,
|
|
2970
|
-
if (
|
|
2971
|
-
removeComponentStyles(
|
|
3824
|
+
const { id: id2, config } = (0, import_editor_documents12.getV1CurrentDocument)();
|
|
3825
|
+
if (id2) {
|
|
3826
|
+
removeComponentStyles(id2);
|
|
2972
3827
|
}
|
|
2973
3828
|
await loadComponentsAssets(config?.elements ?? []);
|
|
2974
3829
|
});
|
|
2975
|
-
(0,
|
|
2976
|
-
fieldType:
|
|
3830
|
+
(0, import_editor_editing_panel6.registerFieldIndicator)({
|
|
3831
|
+
fieldType: import_editor_editing_panel6.FIELD_TYPE.SETTINGS,
|
|
2977
3832
|
id: "component-overridable-prop",
|
|
2978
3833
|
priority: 1,
|
|
2979
3834
|
indicator: OverridablePropIndicator
|
|
2980
3835
|
});
|
|
2981
|
-
(0,
|
|
3836
|
+
(0, import_editor_editing_panel6.registerControlReplacement)({
|
|
2982
3837
|
component: OverridablePropControl,
|
|
2983
3838
|
condition: ({ value }) => componentOverridablePropTypeUtil.isValid(value)
|
|
2984
3839
|
});
|
|
2985
|
-
(0,
|
|
3840
|
+
(0, import_editor_editing_panel6.registerEditingPanelReplacement)({
|
|
2986
3841
|
id: "component-instance-edit-panel",
|
|
2987
3842
|
condition: (_, elementType) => elementType.key === "e-component",
|
|
2988
3843
|
component: InstanceEditingPanel
|