@elementor/editor-editing-panel 1.24.0 → 1.28.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +102 -0
- package/dist/index.d.mts +3 -1
- package/dist/index.d.ts +3 -1
- package/dist/index.js +448 -309
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +426 -287
- package/dist/index.mjs.map +1 -1
- package/package.json +11 -10
- package/src/components/css-classes/css-class-item.tsx +8 -10
- package/src/components/css-classes/css-class-menu.tsx +60 -12
- package/src/components/css-classes/css-class-selector.tsx +28 -27
- package/src/components/editing-panel-tabs.tsx +1 -8
- package/src/components/multi-combobox.tsx +3 -0
- package/src/components/style-indicator.tsx +23 -0
- package/src/components/style-sections/border-section/border-radius-field.tsx +4 -5
- package/src/components/style-sections/border-section/border-width-field.tsx +2 -3
- package/src/components/style-sections/layout-section/display-field.tsx +34 -28
- package/src/components/style-sections/layout-section/flex-size-field.tsx +28 -18
- package/src/components/style-sections/layout-section/layout-section.tsx +14 -2
- package/src/components/style-sections/typography-section/text-alignment-field.tsx +5 -6
- package/src/components/style-tab.tsx +2 -19
- package/src/contexts/style-context.tsx +2 -2
- package/src/controls-registry/control-type-container.tsx +2 -2
- package/src/controls-registry/styles-field.tsx +9 -2
- package/src/dynamics/dynamic-transformer.ts +61 -0
- package/src/dynamics/errors.ts +6 -0
- package/src/dynamics/init.ts +6 -0
- package/src/dynamics/types.ts +17 -0
- package/src/hooks/use-active-style-def-id.ts +36 -0
- package/src/hooks/use-styles-fields.ts +7 -7
- package/src/index.ts +1 -3
- package/src/init.ts +1 -1
- package/src/styles-inheritance/create-snapshots-manager.ts +16 -9
- package/src/styles-inheritance/create-styles-inheritance.ts +8 -4
- package/src/styles-inheritance/styles-inheritance-indicator.tsx +13 -31
- package/src/styles-inheritance/types.ts +7 -6
package/dist/index.js
CHANGED
|
@@ -30,6 +30,7 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
30
30
|
// src/index.ts
|
|
31
31
|
var index_exports = {};
|
|
32
32
|
__export(index_exports, {
|
|
33
|
+
init: () => init2,
|
|
33
34
|
injectIntoClassSelectorActions: () => injectIntoClassSelectorActions,
|
|
34
35
|
replaceControl: () => replaceControl,
|
|
35
36
|
useBoundProp: () => import_editor_controls50.useBoundProp,
|
|
@@ -50,7 +51,7 @@ var import_editor_props = require("@elementor/editor-props");
|
|
|
50
51
|
var import_editor_styles_repository4 = require("@elementor/editor-styles-repository");
|
|
51
52
|
var import_icons2 = require("@elementor/icons");
|
|
52
53
|
var import_locations = require("@elementor/locations");
|
|
53
|
-
var
|
|
54
|
+
var import_ui5 = require("@elementor/ui");
|
|
54
55
|
var import_i18n3 = require("@wordpress/i18n");
|
|
55
56
|
|
|
56
57
|
// src/contexts/classes-prop-context.tsx
|
|
@@ -125,7 +126,7 @@ function useStyle() {
|
|
|
125
126
|
}
|
|
126
127
|
function getProviderByStyleId(styleId) {
|
|
127
128
|
const styleProvider = import_editor_styles_repository.stylesRepository.getProviders().find((provider) => {
|
|
128
|
-
return provider.actions.
|
|
129
|
+
return provider.actions.all().find((style) => style.id === styleId);
|
|
129
130
|
});
|
|
130
131
|
return styleProvider ?? null;
|
|
131
132
|
}
|
|
@@ -139,6 +140,7 @@ function MultiCombobox({
|
|
|
139
140
|
selected,
|
|
140
141
|
options: options13,
|
|
141
142
|
onSelect,
|
|
143
|
+
placeholder,
|
|
142
144
|
...props
|
|
143
145
|
}) {
|
|
144
146
|
const filter = useFilterOptions();
|
|
@@ -161,6 +163,7 @@ function MultiCombobox({
|
|
|
161
163
|
import_ui.TextField,
|
|
162
164
|
{
|
|
163
165
|
...params,
|
|
166
|
+
placeholder,
|
|
164
167
|
sx: (theme) => ({
|
|
165
168
|
".MuiAutocomplete-inputRoot.MuiInputBase-adornedStart": {
|
|
166
169
|
paddingLeft: theme.spacing(0.25),
|
|
@@ -260,14 +263,14 @@ var import_react5 = require("react");
|
|
|
260
263
|
var import_editor_styles_repository3 = require("@elementor/editor-styles-repository");
|
|
261
264
|
var import_editor_ui2 = require("@elementor/editor-ui");
|
|
262
265
|
var import_icons = require("@elementor/icons");
|
|
263
|
-
var
|
|
266
|
+
var import_ui4 = require("@elementor/ui");
|
|
264
267
|
var import_i18n2 = require("@wordpress/i18n");
|
|
265
268
|
|
|
266
269
|
// src/components/css-classes/css-class-menu.tsx
|
|
267
270
|
var React5 = __toESM(require("react"));
|
|
268
271
|
var import_editor_styles_repository2 = require("@elementor/editor-styles-repository");
|
|
269
272
|
var import_editor_ui = require("@elementor/editor-ui");
|
|
270
|
-
var
|
|
273
|
+
var import_ui3 = require("@elementor/ui");
|
|
271
274
|
var import_i18n = require("@wordpress/i18n");
|
|
272
275
|
|
|
273
276
|
// src/hooks/use-unapply-class.ts
|
|
@@ -292,17 +295,41 @@ var useUnapplyClass = (classId) => {
|
|
|
292
295
|
};
|
|
293
296
|
};
|
|
294
297
|
|
|
298
|
+
// src/components/style-indicator.tsx
|
|
299
|
+
var import_ui2 = require("@elementor/ui");
|
|
300
|
+
var StyleIndicator = (0, import_ui2.styled)("div", {
|
|
301
|
+
shouldForwardProp: (prop) => prop !== "variant"
|
|
302
|
+
})`
|
|
303
|
+
width: 5px;
|
|
304
|
+
height: 5px;
|
|
305
|
+
border-radius: 50%;
|
|
306
|
+
background-color: ${({ theme, variant }) => {
|
|
307
|
+
switch (variant) {
|
|
308
|
+
case "overridden":
|
|
309
|
+
return theme.palette.warning.light;
|
|
310
|
+
case "global":
|
|
311
|
+
return theme.palette.global.dark;
|
|
312
|
+
case "local":
|
|
313
|
+
return theme.palette.accent.main;
|
|
314
|
+
default:
|
|
315
|
+
return theme.palette.text.disabled;
|
|
316
|
+
}
|
|
317
|
+
}};
|
|
318
|
+
`;
|
|
319
|
+
|
|
295
320
|
// src/components/css-classes/css-class-menu.tsx
|
|
296
321
|
var STATES = ["hover", "focus", "active"];
|
|
297
322
|
function CssClassMenu({ styleId, provider, popupState, handleRename, anchorEl }) {
|
|
323
|
+
const styledStates = useStyledStates(styleId);
|
|
324
|
+
const indicatorVariant = !provider || (0, import_editor_styles_repository2.isElementsStylesProvider)(provider) ? "local" : "global";
|
|
298
325
|
const handleKeyDown = (e) => {
|
|
299
326
|
e.stopPropagation();
|
|
300
327
|
};
|
|
301
328
|
return /* @__PURE__ */ React5.createElement(
|
|
302
|
-
|
|
329
|
+
import_ui3.Menu,
|
|
303
330
|
{
|
|
304
|
-
MenuListProps: { dense: true },
|
|
305
|
-
...(0,
|
|
331
|
+
MenuListProps: { dense: true, sx: { minWidth: "160px" } },
|
|
332
|
+
...(0, import_ui3.bindMenu)(popupState),
|
|
306
333
|
anchorEl,
|
|
307
334
|
anchorOrigin: {
|
|
308
335
|
vertical: "bottom",
|
|
@@ -312,23 +339,51 @@ function CssClassMenu({ styleId, provider, popupState, handleRename, anchorEl })
|
|
|
312
339
|
horizontal: "left",
|
|
313
340
|
vertical: -4
|
|
314
341
|
},
|
|
315
|
-
onKeyDown: handleKeyDown
|
|
342
|
+
onKeyDown: handleKeyDown,
|
|
343
|
+
disableAutoFocusItem: true
|
|
316
344
|
},
|
|
317
345
|
getMenuItemsByProvider({ provider, styleId, handleRename, closeMenu: popupState.close }),
|
|
318
|
-
/* @__PURE__ */ React5.createElement(
|
|
319
|
-
/* @__PURE__ */ React5.createElement(
|
|
346
|
+
/* @__PURE__ */ React5.createElement(import_ui3.MenuSubheader, { sx: { typography: "caption", color: "text.secondary", pb: 0.5, pt: 1 } }, (0, import_i18n.__)("States", "elementor")),
|
|
347
|
+
/* @__PURE__ */ React5.createElement(
|
|
348
|
+
StateMenuItem,
|
|
349
|
+
{
|
|
350
|
+
key: "normal",
|
|
351
|
+
state: null,
|
|
352
|
+
styleId,
|
|
353
|
+
closeMenu: popupState.close,
|
|
354
|
+
isStyled: styledStates.normal,
|
|
355
|
+
indicatorVariant
|
|
356
|
+
}
|
|
357
|
+
),
|
|
320
358
|
STATES.map((state) => {
|
|
321
|
-
return /* @__PURE__ */ React5.createElement(
|
|
359
|
+
return /* @__PURE__ */ React5.createElement(
|
|
360
|
+
StateMenuItem,
|
|
361
|
+
{
|
|
362
|
+
key: state,
|
|
363
|
+
state,
|
|
364
|
+
styleId,
|
|
365
|
+
closeMenu: popupState.close,
|
|
366
|
+
isStyled: styledStates[state],
|
|
367
|
+
indicatorVariant
|
|
368
|
+
}
|
|
369
|
+
);
|
|
322
370
|
})
|
|
323
371
|
);
|
|
324
372
|
}
|
|
373
|
+
function useStyledStates(styleId) {
|
|
374
|
+
const { meta } = useStyle();
|
|
375
|
+
const styleDef = import_editor_styles_repository2.stylesRepository.all().find((style) => style.id === styleId);
|
|
376
|
+
return Object.fromEntries(
|
|
377
|
+
styleDef?.variants.filter((variant) => meta.breakpoint === variant.meta.breakpoint).map((variant) => [variant.meta.state ?? "normal", true]) ?? []
|
|
378
|
+
);
|
|
379
|
+
}
|
|
325
380
|
function getMenuItemsByProvider({
|
|
326
381
|
provider,
|
|
327
382
|
styleId,
|
|
328
383
|
handleRename,
|
|
329
384
|
closeMenu
|
|
330
385
|
}) {
|
|
331
|
-
if (!styleId) {
|
|
386
|
+
if (!styleId || !provider) {
|
|
332
387
|
return [];
|
|
333
388
|
}
|
|
334
389
|
const providerInstance = import_editor_styles_repository2.stylesRepository.getProviderByKey(provider);
|
|
@@ -341,19 +396,26 @@ function getMenuItemsByProvider({
|
|
|
341
396
|
if (actions.length) {
|
|
342
397
|
actions.unshift(
|
|
343
398
|
/* @__PURE__ */ React5.createElement(
|
|
344
|
-
|
|
399
|
+
import_ui3.MenuSubheader,
|
|
345
400
|
{
|
|
346
401
|
key: "provider-label",
|
|
347
|
-
sx: { typography: "caption", color: "text.secondary", pb: 0.5, pt: 1 }
|
|
402
|
+
sx: { typography: "caption", color: "text.secondary", pb: 0.5, pt: 1, textTransform: "capitalize" }
|
|
348
403
|
},
|
|
349
404
|
providerInstance?.labels?.singular
|
|
350
405
|
)
|
|
351
406
|
);
|
|
352
|
-
actions.push(/* @__PURE__ */ React5.createElement(
|
|
407
|
+
actions.push(/* @__PURE__ */ React5.createElement(import_ui3.Divider, { key: "provider-actions-divider" }));
|
|
353
408
|
}
|
|
354
409
|
return actions;
|
|
355
410
|
}
|
|
356
|
-
function StateMenuItem({
|
|
411
|
+
function StateMenuItem({
|
|
412
|
+
state,
|
|
413
|
+
styleId,
|
|
414
|
+
closeMenu,
|
|
415
|
+
isStyled = false,
|
|
416
|
+
indicatorVariant,
|
|
417
|
+
...props
|
|
418
|
+
}) {
|
|
357
419
|
const { id: activeId, setId: setActiveId, setMetaState: setActiveMetaState, meta } = useStyle();
|
|
358
420
|
const { state: activeState } = meta;
|
|
359
421
|
const isActive = styleId === activeId;
|
|
@@ -372,7 +434,7 @@ function StateMenuItem({ state, styleId, closeMenu, ...props }) {
|
|
|
372
434
|
closeMenu();
|
|
373
435
|
}
|
|
374
436
|
},
|
|
375
|
-
|
|
437
|
+
/* @__PURE__ */ React5.createElement(import_ui3.Stack, { gap: 0.75, direction: "row", alignItems: "center" }, isStyled && /* @__PURE__ */ React5.createElement(StyleIndicator, { "aria-label": (0, import_i18n.__)("Has style", "elementor"), variant: indicatorVariant }), state ?? "normal")
|
|
376
438
|
);
|
|
377
439
|
}
|
|
378
440
|
function UnapplyClassMenuItem({ styleId, closeMenu, ...props }) {
|
|
@@ -411,8 +473,8 @@ function RenameClassMenuItem({
|
|
|
411
473
|
var CHIP_SIZE = "tiny";
|
|
412
474
|
function CssClassItem({
|
|
413
475
|
id,
|
|
414
|
-
label,
|
|
415
476
|
provider,
|
|
477
|
+
label,
|
|
416
478
|
isActive,
|
|
417
479
|
color: colorProp,
|
|
418
480
|
icon,
|
|
@@ -421,7 +483,7 @@ function CssClassItem({
|
|
|
421
483
|
renameLabel
|
|
422
484
|
}) {
|
|
423
485
|
const { meta, setMetaState } = useStyle();
|
|
424
|
-
const popupState = (0,
|
|
486
|
+
const popupState = (0, import_ui4.usePopupState)({ variant: "popover" });
|
|
425
487
|
const [chipRef, setChipRef] = (0, import_react5.useState)(null);
|
|
426
488
|
const { onDelete, ...chipGroupProps } = chipProps;
|
|
427
489
|
const {
|
|
@@ -436,11 +498,11 @@ function CssClassItem({
|
|
|
436
498
|
validation: validateLabel
|
|
437
499
|
});
|
|
438
500
|
const color = error ? "error" : colorProp;
|
|
439
|
-
const providerActions = import_editor_styles_repository3.stylesRepository.getProviderByKey(provider)?.actions;
|
|
501
|
+
const providerActions = provider ? import_editor_styles_repository3.stylesRepository.getProviderByKey(provider)?.actions : null;
|
|
440
502
|
const allowRename = Boolean(providerActions?.update);
|
|
441
503
|
const isShowingState = isActive && meta.state;
|
|
442
504
|
return /* @__PURE__ */ React6.createElement(React6.Fragment, null, /* @__PURE__ */ React6.createElement(
|
|
443
|
-
|
|
505
|
+
import_ui4.UnstableChipGroup,
|
|
444
506
|
{
|
|
445
507
|
ref: setChipRef,
|
|
446
508
|
...chipGroupProps,
|
|
@@ -451,7 +513,7 @@ function CssClassItem({
|
|
|
451
513
|
})
|
|
452
514
|
},
|
|
453
515
|
/* @__PURE__ */ React6.createElement(
|
|
454
|
-
|
|
516
|
+
import_ui4.Chip,
|
|
455
517
|
{
|
|
456
518
|
size: CHIP_SIZE,
|
|
457
519
|
label: isEditing ? /* @__PURE__ */ React6.createElement(import_editor_ui2.EditableField, { ref, error, ...getEditableProps() }) : /* @__PURE__ */ React6.createElement(import_editor_ui2.EllipsisWithTooltip, { maxWidth: "10ch", title: label, as: "div" }),
|
|
@@ -481,15 +543,15 @@ function CssClassItem({
|
|
|
481
543
|
}
|
|
482
544
|
),
|
|
483
545
|
!isEditing && /* @__PURE__ */ React6.createElement(
|
|
484
|
-
|
|
546
|
+
import_ui4.Chip,
|
|
485
547
|
{
|
|
486
548
|
icon: isShowingState ? void 0 : /* @__PURE__ */ React6.createElement(import_icons.DotsVerticalIcon, { fontSize: "tiny" }),
|
|
487
549
|
size: CHIP_SIZE,
|
|
488
|
-
label: isShowingState ? /* @__PURE__ */ React6.createElement(
|
|
550
|
+
label: isShowingState ? /* @__PURE__ */ React6.createElement(import_ui4.Stack, { direction: "row", gap: 0.5, alignItems: "center" }, /* @__PURE__ */ React6.createElement(import_ui4.Typography, { variant: "inherit" }, meta.state), /* @__PURE__ */ React6.createElement(import_icons.DotsVerticalIcon, { fontSize: "tiny" })) : void 0,
|
|
489
551
|
variant: "filled",
|
|
490
552
|
shape: "rounded",
|
|
491
553
|
color,
|
|
492
|
-
...(0,
|
|
554
|
+
...(0, import_ui4.bindTrigger)(popupState),
|
|
493
555
|
"aria-label": (0, import_i18n2.__)("Open CSS Class Menu", "elementor"),
|
|
494
556
|
sx: (theme) => ({
|
|
495
557
|
borderRadius: `${theme.shape.borderRadius * 0.75}px`,
|
|
@@ -511,13 +573,11 @@ function CssClassItem({
|
|
|
511
573
|
));
|
|
512
574
|
}
|
|
513
575
|
var validateLabel = (newLabel) => {
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
if (import_editor_styles_repository3.stylesRepository.isLabelExist(newLabel)) {
|
|
518
|
-
return (0, import_i18n2.__)("Existing name", "elementor");
|
|
576
|
+
const result = (0, import_editor_styles_repository3.validateStyleLabel)(newLabel);
|
|
577
|
+
if (result.isValid) {
|
|
578
|
+
return null;
|
|
519
579
|
}
|
|
520
|
-
return
|
|
580
|
+
return result.error;
|
|
521
581
|
};
|
|
522
582
|
|
|
523
583
|
// src/components/css-classes/css-class-selector.tsx
|
|
@@ -529,7 +589,7 @@ var EMPTY_OPTION = {
|
|
|
529
589
|
fixed: true,
|
|
530
590
|
color: "accent",
|
|
531
591
|
icon: /* @__PURE__ */ React7.createElement(import_icons2.MapPinIcon, null),
|
|
532
|
-
provider:
|
|
592
|
+
provider: null
|
|
533
593
|
};
|
|
534
594
|
var { Slot: ClassSelectorActionsSlot, inject: injectIntoClassSelectorActions } = (0, import_locations.createLocation)();
|
|
535
595
|
function CssClassSelector() {
|
|
@@ -540,17 +600,19 @@ function CssClassSelector() {
|
|
|
540
600
|
const handleApply = useHandleApply(appliedIds, setAppliedIds);
|
|
541
601
|
const applied = useAppliedOptions(options13, appliedIds);
|
|
542
602
|
const active = applied.find((option) => option.value === activeId) ?? EMPTY_OPTION;
|
|
543
|
-
|
|
603
|
+
const showPlaceholder = applied.every(({ fixed }) => fixed);
|
|
604
|
+
return /* @__PURE__ */ React7.createElement(import_ui5.Stack, { p: 2 }, /* @__PURE__ */ React7.createElement(import_ui5.Stack, { direction: "row", gap: 1, alignItems: "center", justifyContent: "space-between" }, /* @__PURE__ */ React7.createElement(import_ui5.FormLabel, { htmlFor: ID, size: "small" }, (0, import_i18n3.__)("Classes", "elementor")), /* @__PURE__ */ React7.createElement(import_ui5.Stack, { direction: "row", gap: 1 }, /* @__PURE__ */ React7.createElement(ClassSelectorActionsSlot, null))), /* @__PURE__ */ React7.createElement(
|
|
544
605
|
MultiCombobox,
|
|
545
606
|
{
|
|
546
607
|
id: ID,
|
|
547
608
|
size: "tiny",
|
|
609
|
+
placeholder: showPlaceholder ? (0, import_i18n3.__)("Type to search/add global classes", "elementor") : void 0,
|
|
548
610
|
options: options13,
|
|
549
611
|
selected: applied,
|
|
550
612
|
onSelect: handleApply,
|
|
551
613
|
limitTags: TAGS_LIMIT,
|
|
552
614
|
actions,
|
|
553
|
-
getLimitTagsText: (more) => /* @__PURE__ */ React7.createElement(
|
|
615
|
+
getLimitTagsText: (more) => /* @__PURE__ */ React7.createElement(import_ui5.Chip, { size: "tiny", variant: "standard", label: `+${more}`, clickable: true }),
|
|
554
616
|
renderTags: (values, getTagProps) => values.map((value, index) => {
|
|
555
617
|
const chipProps = getTagProps({ index });
|
|
556
618
|
const isActive = value.value === active?.value;
|
|
@@ -580,6 +642,9 @@ function CssClassSelector() {
|
|
|
580
642
|
));
|
|
581
643
|
}
|
|
582
644
|
var updateClassByProvider = (provider, data) => {
|
|
645
|
+
if (!provider) {
|
|
646
|
+
return;
|
|
647
|
+
}
|
|
583
648
|
const providerInstance = import_editor_styles_repository4.stylesRepository.getProviderByKey(provider);
|
|
584
649
|
if (!providerInstance) {
|
|
585
650
|
return;
|
|
@@ -590,8 +655,8 @@ function useOptions() {
|
|
|
590
655
|
const { element } = useElement();
|
|
591
656
|
const isProviderEditable = (provider) => !!provider.actions.updateProps;
|
|
592
657
|
return (0, import_editor_styles_repository4.useProviders)().filter(isProviderEditable).flatMap((provider) => {
|
|
593
|
-
const isElements =
|
|
594
|
-
const styleDefs = provider.actions.
|
|
658
|
+
const isElements = (0, import_editor_styles_repository4.isElementsStylesProvider)(provider.getKey());
|
|
659
|
+
const styleDefs = provider.actions.all({ elementId: element.id });
|
|
595
660
|
if (isElements && styleDefs.length === 0) {
|
|
596
661
|
return [EMPTY_OPTION];
|
|
597
662
|
}
|
|
@@ -602,8 +667,9 @@ function useOptions() {
|
|
|
602
667
|
fixed: isElements,
|
|
603
668
|
color: isElements ? "accent" : "global",
|
|
604
669
|
icon: isElements ? /* @__PURE__ */ React7.createElement(import_icons2.MapPinIcon, null) : null,
|
|
605
|
-
provider: provider.
|
|
606
|
-
|
|
670
|
+
provider: provider.getKey(),
|
|
671
|
+
// translators: %s is the plural label of the provider (e.g "Existing classes").
|
|
672
|
+
group: (0, import_i18n3.__)("Existing %s", "elementor").replace("%s", provider.labels?.plural ?? "")
|
|
607
673
|
};
|
|
608
674
|
});
|
|
609
675
|
});
|
|
@@ -615,10 +681,10 @@ function useCreateActions({
|
|
|
615
681
|
return (0, import_editor_styles_repository4.useCreateActionsByProvider)().map(([provider, create]) => {
|
|
616
682
|
return {
|
|
617
683
|
// translators: %s is the label of the new class.
|
|
618
|
-
label: (value) => (0, import_i18n3.__)('Create
|
|
619
|
-
// translators: %s is the singular label of css class provider (e.g "
|
|
620
|
-
group: (0, import_i18n3.__)("Create
|
|
621
|
-
condition: (_, inputValue) =>
|
|
684
|
+
label: (value) => (0, import_i18n3.__)('Create "%s"', "elementor").replace("%s", value),
|
|
685
|
+
// translators: %s is the singular label of css class provider (e.g "CSS Class").
|
|
686
|
+
group: (0, import_i18n3.__)("Create a new %s", "elementor").replace("%s", provider.labels?.singular ?? ""),
|
|
687
|
+
condition: (_, inputValue) => (0, import_editor_styles_repository4.validateStyleLabel)(inputValue).isValid && !hasReachedLimit(provider),
|
|
622
688
|
apply: (label) => {
|
|
623
689
|
const createdId = create(label);
|
|
624
690
|
if (!createdId) {
|
|
@@ -631,18 +697,12 @@ function useCreateActions({
|
|
|
631
697
|
});
|
|
632
698
|
}
|
|
633
699
|
function hasReachedLimit(provider) {
|
|
634
|
-
|
|
635
|
-
return false;
|
|
636
|
-
}
|
|
637
|
-
return provider.actions.get().length >= provider.limit;
|
|
638
|
-
}
|
|
639
|
-
function isLabelValid(newLabel) {
|
|
640
|
-
return import_editor_styles_repository4.stylesRepository.isLabelValid(newLabel) && !import_editor_styles_repository4.stylesRepository.isLabelExist(newLabel);
|
|
700
|
+
return provider.actions.all().length >= provider.limit;
|
|
641
701
|
}
|
|
642
702
|
function useAppliedOptions(options13, appliedIds) {
|
|
643
703
|
const applied = options13.filter((option) => option.value && appliedIds.includes(option.value));
|
|
644
704
|
const hasElementsProviderStyleApplied = applied.some(
|
|
645
|
-
(option) => option.provider
|
|
705
|
+
(option) => option.provider && (0, import_editor_styles_repository4.isElementsStylesProvider)(option.provider)
|
|
646
706
|
);
|
|
647
707
|
if (!hasElementsProviderStyleApplied) {
|
|
648
708
|
applied.unshift(EMPTY_OPTION);
|
|
@@ -713,7 +773,7 @@ var import_menus = require("@elementor/menus");
|
|
|
713
773
|
var React8 = __toESM(require("react"));
|
|
714
774
|
var import_react6 = require("react");
|
|
715
775
|
var import_icons3 = require("@elementor/icons");
|
|
716
|
-
var
|
|
776
|
+
var import_ui6 = require("@elementor/ui");
|
|
717
777
|
var SIZE = "tiny";
|
|
718
778
|
function PopoverAction({
|
|
719
779
|
title,
|
|
@@ -722,15 +782,15 @@ function PopoverAction({
|
|
|
722
782
|
popoverContent: PopoverContent2
|
|
723
783
|
}) {
|
|
724
784
|
const id = (0, import_react6.useId)();
|
|
725
|
-
const popupState = (0,
|
|
785
|
+
const popupState = (0, import_ui6.usePopupState)({
|
|
726
786
|
variant: "popover",
|
|
727
787
|
popupId: `elementor-popover-action-${id}`
|
|
728
788
|
});
|
|
729
789
|
if (!visible) {
|
|
730
790
|
return null;
|
|
731
791
|
}
|
|
732
|
-
return /* @__PURE__ */ React8.createElement(React8.Fragment, null, /* @__PURE__ */ React8.createElement(
|
|
733
|
-
|
|
792
|
+
return /* @__PURE__ */ React8.createElement(React8.Fragment, null, /* @__PURE__ */ React8.createElement(import_ui6.Tooltip, { placement: "top", title }, /* @__PURE__ */ React8.createElement(import_ui6.IconButton, { "aria-label": title, key: id, size: SIZE, ...(0, import_ui6.bindToggle)(popupState) }, /* @__PURE__ */ React8.createElement(Icon, { fontSize: SIZE }))), /* @__PURE__ */ React8.createElement(
|
|
793
|
+
import_ui6.Popover,
|
|
734
794
|
{
|
|
735
795
|
disablePortal: true,
|
|
736
796
|
disableScrollLock: true,
|
|
@@ -738,9 +798,9 @@ function PopoverAction({
|
|
|
738
798
|
vertical: "bottom",
|
|
739
799
|
horizontal: "center"
|
|
740
800
|
},
|
|
741
|
-
...(0,
|
|
801
|
+
...(0, import_ui6.bindPopover)(popupState)
|
|
742
802
|
},
|
|
743
|
-
/* @__PURE__ */ React8.createElement(
|
|
803
|
+
/* @__PURE__ */ React8.createElement(import_ui6.Stack, { direction: "row", alignItems: "center", pl: 1.5, pr: 0.5, py: 1.5 }, /* @__PURE__ */ React8.createElement(Icon, { fontSize: SIZE, sx: { mr: 0.5 } }), /* @__PURE__ */ React8.createElement(import_ui6.Typography, { variant: "subtitle2" }, title), /* @__PURE__ */ React8.createElement(import_ui6.IconButton, { sx: { ml: "auto" }, size: SIZE, onClick: popupState.close }, /* @__PURE__ */ React8.createElement(import_icons3.XIcon, { fontSize: SIZE }))),
|
|
744
804
|
/* @__PURE__ */ React8.createElement(PopoverContent2, { closePopover: popupState.close })
|
|
745
805
|
));
|
|
746
806
|
}
|
|
@@ -754,14 +814,14 @@ var controlActionsMenu = (0, import_menus.createMenu)({
|
|
|
754
814
|
|
|
755
815
|
// src/components/editing-panel-error-fallback.tsx
|
|
756
816
|
var React9 = __toESM(require("react"));
|
|
757
|
-
var
|
|
817
|
+
var import_ui7 = require("@elementor/ui");
|
|
758
818
|
function EditorPanelErrorFallback() {
|
|
759
|
-
return /* @__PURE__ */ React9.createElement(
|
|
819
|
+
return /* @__PURE__ */ React9.createElement(import_ui7.Box, { role: "alert", sx: { minHeight: "100%", p: 2 } }, /* @__PURE__ */ React9.createElement(import_ui7.Alert, { severity: "error", sx: { mb: 2, maxWidth: 400, textAlign: "center" } }, /* @__PURE__ */ React9.createElement("strong", null, "Something went wrong")));
|
|
760
820
|
}
|
|
761
821
|
|
|
762
822
|
// src/components/editing-panel-tabs.tsx
|
|
763
823
|
var React66 = __toESM(require("react"));
|
|
764
|
-
var
|
|
824
|
+
var import_react18 = require("react");
|
|
765
825
|
var import_ui51 = require("@elementor/ui");
|
|
766
826
|
var import_i18n44 = require("@wordpress/i18n");
|
|
767
827
|
|
|
@@ -802,7 +862,7 @@ var Control = ({ props, type }) => {
|
|
|
802
862
|
|
|
803
863
|
// src/controls-registry/control-type-container.tsx
|
|
804
864
|
var React11 = __toESM(require("react"));
|
|
805
|
-
var
|
|
865
|
+
var import_ui8 = require("@elementor/ui");
|
|
806
866
|
var ControlTypeContainer = ({
|
|
807
867
|
controlType,
|
|
808
868
|
children
|
|
@@ -810,7 +870,7 @@ var ControlTypeContainer = ({
|
|
|
810
870
|
const layout = getLayoutByType(controlType);
|
|
811
871
|
return /* @__PURE__ */ React11.createElement(StyledContainer, { layout }, children);
|
|
812
872
|
};
|
|
813
|
-
var StyledContainer = (0,
|
|
873
|
+
var StyledContainer = (0, import_ui8.styled)(import_ui8.Box, {
|
|
814
874
|
shouldForwardProp: (prop) => !["layout"].includes(prop)
|
|
815
875
|
})(({ layout, theme }) => ({
|
|
816
876
|
display: "grid",
|
|
@@ -820,8 +880,8 @@ var StyledContainer = (0, import_ui7.styled)(import_ui7.Box, {
|
|
|
820
880
|
var getGridLayout = (layout) => ({
|
|
821
881
|
justifyContent: "space-between",
|
|
822
882
|
gridTemplateColumns: {
|
|
823
|
-
full: "1fr",
|
|
824
|
-
"two-columns": "repeat(2, 1fr)"
|
|
883
|
+
full: "minmax(0, 1fr)",
|
|
884
|
+
"two-columns": "repeat(2, minmax(0, 1fr))"
|
|
825
885
|
}[layout]
|
|
826
886
|
});
|
|
827
887
|
|
|
@@ -861,12 +921,12 @@ var SettingsField = ({ bind, children }) => {
|
|
|
861
921
|
// src/components/section.tsx
|
|
862
922
|
var React13 = __toESM(require("react"));
|
|
863
923
|
var import_react7 = require("react");
|
|
864
|
-
var
|
|
924
|
+
var import_ui10 = require("@elementor/ui");
|
|
865
925
|
|
|
866
926
|
// src/components/collapse-icon.tsx
|
|
867
927
|
var import_icons4 = require("@elementor/icons");
|
|
868
|
-
var
|
|
869
|
-
var CollapseIcon = (0,
|
|
928
|
+
var import_ui9 = require("@elementor/ui");
|
|
929
|
+
var CollapseIcon = (0, import_ui9.styled)(import_icons4.ChevronDownIcon, {
|
|
870
930
|
shouldForwardProp: (prop) => prop !== "open"
|
|
871
931
|
})(({ theme, open }) => ({
|
|
872
932
|
transform: open ? "rotate(180deg)" : "rotate(0deg)",
|
|
@@ -882,7 +942,7 @@ function Section({ title, children, defaultExpanded = false }) {
|
|
|
882
942
|
const labelId = `label-${id}`;
|
|
883
943
|
const contentId = `content-${id}`;
|
|
884
944
|
return /* @__PURE__ */ React13.createElement(React13.Fragment, null, /* @__PURE__ */ React13.createElement(
|
|
885
|
-
|
|
945
|
+
import_ui10.ListItemButton,
|
|
886
946
|
{
|
|
887
947
|
id: labelId,
|
|
888
948
|
"aria-controls": contentId,
|
|
@@ -890,21 +950,21 @@ function Section({ title, children, defaultExpanded = false }) {
|
|
|
890
950
|
sx: { "&:hover": { backgroundColor: "transparent" } }
|
|
891
951
|
},
|
|
892
952
|
/* @__PURE__ */ React13.createElement(
|
|
893
|
-
|
|
953
|
+
import_ui10.ListItemText,
|
|
894
954
|
{
|
|
895
955
|
secondary: title,
|
|
896
956
|
secondaryTypographyProps: { color: "text.primary", variant: "caption", fontWeight: "bold" }
|
|
897
957
|
}
|
|
898
958
|
),
|
|
899
959
|
/* @__PURE__ */ React13.createElement(CollapseIcon, { open: isOpen, color: "secondary", fontSize: "tiny" })
|
|
900
|
-
), /* @__PURE__ */ React13.createElement(
|
|
960
|
+
), /* @__PURE__ */ React13.createElement(import_ui10.Collapse, { id: contentId, "aria-labelledby": labelId, in: isOpen, timeout: "auto", unmountOnExit: true }, /* @__PURE__ */ React13.createElement(import_ui10.Stack, { gap: 2.5, p: 2 }, children)), /* @__PURE__ */ React13.createElement(import_ui10.Divider, null));
|
|
901
961
|
}
|
|
902
962
|
|
|
903
963
|
// src/components/sections-list.tsx
|
|
904
964
|
var React14 = __toESM(require("react"));
|
|
905
|
-
var
|
|
965
|
+
var import_ui11 = require("@elementor/ui");
|
|
906
966
|
function SectionsList(props) {
|
|
907
|
-
return /* @__PURE__ */ React14.createElement(
|
|
967
|
+
return /* @__PURE__ */ React14.createElement(import_ui11.List, { disablePadding: true, component: "div", ...props });
|
|
908
968
|
}
|
|
909
969
|
|
|
910
970
|
// src/components/settings-tab.tsx
|
|
@@ -934,9 +994,8 @@ var Control2 = ({ control }) => {
|
|
|
934
994
|
|
|
935
995
|
// src/components/style-tab.tsx
|
|
936
996
|
var React65 = __toESM(require("react"));
|
|
937
|
-
var
|
|
938
|
-
var
|
|
939
|
-
var import_editor_props5 = require("@elementor/editor-props");
|
|
997
|
+
var import_react17 = require("react");
|
|
998
|
+
var import_editor_props7 = require("@elementor/editor-props");
|
|
940
999
|
var import_editor_responsive2 = require("@elementor/editor-responsive");
|
|
941
1000
|
var import_session3 = require("@elementor/session");
|
|
942
1001
|
var import_ui50 = require("@elementor/ui");
|
|
@@ -946,7 +1005,7 @@ var import_i18n43 = require("@wordpress/i18n");
|
|
|
946
1005
|
var React16 = __toESM(require("react"));
|
|
947
1006
|
var import_react9 = require("react");
|
|
948
1007
|
var import_editor_elements4 = require("@elementor/editor-elements");
|
|
949
|
-
var
|
|
1008
|
+
var import_editor_props3 = require("@elementor/editor-props");
|
|
950
1009
|
var import_editor_responsive = require("@elementor/editor-responsive");
|
|
951
1010
|
var import_editor_styles_repository5 = require("@elementor/editor-styles-repository");
|
|
952
1011
|
|
|
@@ -958,6 +1017,9 @@ var useStylesRerender = () => {
|
|
|
958
1017
|
(0, import_react8.useEffect)(() => provider?.subscribe(reRender), [provider]);
|
|
959
1018
|
};
|
|
960
1019
|
|
|
1020
|
+
// src/styles-inheritance/create-snapshots-manager.ts
|
|
1021
|
+
var import_editor_props2 = require("@elementor/editor-props");
|
|
1022
|
+
|
|
961
1023
|
// src/styles-inheritance/utils.ts
|
|
962
1024
|
var DEFAULT_STATE = "normal";
|
|
963
1025
|
var DEFAULT_BREAKPOINT = "desktop";
|
|
@@ -1043,17 +1105,21 @@ function buildStateSnapshotSlot(styles, parentBreakpoint, currentBreakpoint, sta
|
|
|
1043
1105
|
}
|
|
1044
1106
|
function buildInitialSnapshotFromStyles(styles) {
|
|
1045
1107
|
const snapshot = {};
|
|
1046
|
-
styles.forEach((
|
|
1108
|
+
styles.forEach((styleData) => {
|
|
1047
1109
|
const {
|
|
1048
|
-
|
|
1049
|
-
} =
|
|
1110
|
+
variant: { props }
|
|
1111
|
+
} = styleData;
|
|
1050
1112
|
Object.entries(props).forEach(([key, value]) => {
|
|
1113
|
+
const filteredValue = (0, import_editor_props2.filterEmptyValues)(value);
|
|
1114
|
+
if (filteredValue === null) {
|
|
1115
|
+
return;
|
|
1116
|
+
}
|
|
1051
1117
|
if (!snapshot[key]) {
|
|
1052
1118
|
snapshot[key] = [];
|
|
1053
1119
|
}
|
|
1054
1120
|
const snapshotPropValue = {
|
|
1055
|
-
...
|
|
1056
|
-
value
|
|
1121
|
+
...styleData,
|
|
1122
|
+
value: filteredValue
|
|
1057
1123
|
};
|
|
1058
1124
|
snapshot[key].push(snapshotPropValue);
|
|
1059
1125
|
});
|
|
@@ -1085,8 +1151,9 @@ function createStylesInheritance(styleDefs, breakpointsRoot) {
|
|
|
1085
1151
|
function buildStyleVariantsByMetaMapping(styleDefs) {
|
|
1086
1152
|
const breakpointStateSlots = {};
|
|
1087
1153
|
styleDefs.forEach((styleDef) => {
|
|
1088
|
-
styleDef.
|
|
1089
|
-
|
|
1154
|
+
const provider = getProviderByStyleId(styleDef.id)?.getKey() ?? null;
|
|
1155
|
+
styleDef.variants.forEach((variant) => {
|
|
1156
|
+
const { meta } = variant;
|
|
1090
1157
|
const { state, breakpoint } = meta;
|
|
1091
1158
|
const breakpointKey = getBreakpointKey(breakpoint);
|
|
1092
1159
|
const stateKey = getStateKey(state);
|
|
@@ -1098,8 +1165,9 @@ function buildStyleVariantsByMetaMapping(styleDefs) {
|
|
|
1098
1165
|
breakpointNode[stateKey] = [];
|
|
1099
1166
|
}
|
|
1100
1167
|
breakpointNode[stateKey].push({
|
|
1101
|
-
|
|
1102
|
-
|
|
1168
|
+
style: styleDef,
|
|
1169
|
+
variant,
|
|
1170
|
+
provider
|
|
1103
1171
|
});
|
|
1104
1172
|
});
|
|
1105
1173
|
});
|
|
@@ -1138,7 +1206,7 @@ var useAppliedStyles = () => {
|
|
|
1138
1206
|
const baseStyles = useBaseStyles();
|
|
1139
1207
|
useStylesRerender();
|
|
1140
1208
|
const classesProp = (0, import_editor_elements4.useElementSetting)(element.id, currentClassesProp);
|
|
1141
|
-
const appliedStyles =
|
|
1209
|
+
const appliedStyles = import_editor_props3.classesPropTypeUtil.extract(classesProp);
|
|
1142
1210
|
return import_editor_styles_repository5.stylesRepository.all().filter((style) => appliedStyles?.includes(style.id)).concat(baseStyles);
|
|
1143
1211
|
};
|
|
1144
1212
|
var useBaseStyles = () => {
|
|
@@ -1148,6 +1216,30 @@ var useBaseStyles = () => {
|
|
|
1148
1216
|
return Object.values(widgetCache?.base_styles ?? {});
|
|
1149
1217
|
};
|
|
1150
1218
|
|
|
1219
|
+
// src/hooks/use-active-style-def-id.ts
|
|
1220
|
+
var import_react10 = require("react");
|
|
1221
|
+
var import_editor_elements5 = require("@elementor/editor-elements");
|
|
1222
|
+
function useActiveStyleDefId(classProp) {
|
|
1223
|
+
const [activeStyledDefId, setActiveStyledDefId] = (0, import_react10.useState)(null);
|
|
1224
|
+
const appliedClassesIds = useAppliedClassesIds2(classProp)?.value || [];
|
|
1225
|
+
const fallback = useFirstAppliedClass(appliedClassesIds);
|
|
1226
|
+
const activeAndAppliedClassId = useActiveAndAppliedClassId(activeStyledDefId, appliedClassesIds);
|
|
1227
|
+
return [activeAndAppliedClassId || fallback?.id || null, setActiveStyledDefId];
|
|
1228
|
+
}
|
|
1229
|
+
function useFirstAppliedClass(appliedClassesIds) {
|
|
1230
|
+
const { element } = useElement();
|
|
1231
|
+
const stylesDefs = (0, import_editor_elements5.getElementStyles)(element.id) ?? {};
|
|
1232
|
+
return Object.values(stylesDefs).find((styleDef) => appliedClassesIds.includes(styleDef.id));
|
|
1233
|
+
}
|
|
1234
|
+
function useAppliedClassesIds2(classProp) {
|
|
1235
|
+
const { element } = useElement();
|
|
1236
|
+
return (0, import_editor_elements5.useElementSetting)(element.id, classProp);
|
|
1237
|
+
}
|
|
1238
|
+
function useActiveAndAppliedClassId(id, appliedClassesIds) {
|
|
1239
|
+
const isClassApplied = !!id && appliedClassesIds.includes(id);
|
|
1240
|
+
return isClassApplied ? id : null;
|
|
1241
|
+
}
|
|
1242
|
+
|
|
1151
1243
|
// src/components/style-sections/background-section/background-section.tsx
|
|
1152
1244
|
var React19 = __toESM(require("react"));
|
|
1153
1245
|
var import_editor_controls7 = require("@elementor/editor-controls");
|
|
@@ -1158,8 +1250,8 @@ var import_editor_controls6 = require("@elementor/editor-controls");
|
|
|
1158
1250
|
var import_editor_styles2 = require("@elementor/editor-styles");
|
|
1159
1251
|
|
|
1160
1252
|
// src/hooks/use-styles-fields.ts
|
|
1161
|
-
var
|
|
1162
|
-
var
|
|
1253
|
+
var import_react11 = require("react");
|
|
1254
|
+
var import_editor_elements6 = require("@elementor/editor-elements");
|
|
1163
1255
|
var import_editor_styles = require("@elementor/editor-styles");
|
|
1164
1256
|
var import_editor_styles_repository6 = require("@elementor/editor-styles-repository");
|
|
1165
1257
|
var import_editor_v1_adapters = require("@elementor/editor-v1-adapters");
|
|
@@ -1202,9 +1294,9 @@ function getProps({ styleId, elementId, provider, meta, propNames }) {
|
|
|
1202
1294
|
if (!provider || !styleId) {
|
|
1203
1295
|
return null;
|
|
1204
1296
|
}
|
|
1205
|
-
const style = provider.actions.
|
|
1297
|
+
const style = provider.actions.get(styleId, { elementId });
|
|
1206
1298
|
if (!style) {
|
|
1207
|
-
throw new StyleNotFoundUnderProviderError({ context: { styleId, providerKey: provider.
|
|
1299
|
+
throw new StyleNotFoundUnderProviderError({ context: { styleId, providerKey: provider.getKey() } });
|
|
1208
1300
|
}
|
|
1209
1301
|
const variant = (0, import_editor_styles.getVariantByMeta)(style, meta);
|
|
1210
1302
|
return Object.fromEntries(
|
|
@@ -1212,44 +1304,44 @@ function getProps({ styleId, elementId, provider, meta, propNames }) {
|
|
|
1212
1304
|
);
|
|
1213
1305
|
}
|
|
1214
1306
|
function useUndoableCreateElementStyle() {
|
|
1215
|
-
return (0,
|
|
1307
|
+
return (0, import_react11.useMemo)(() => {
|
|
1216
1308
|
return (0, import_editor_v1_adapters.undoable)(
|
|
1217
1309
|
{
|
|
1218
1310
|
do: (payload) => {
|
|
1219
|
-
return (0,
|
|
1311
|
+
return (0, import_editor_elements6.createElementStyle)({
|
|
1220
1312
|
...payload,
|
|
1221
|
-
label: import_editor_styles_repository6.
|
|
1313
|
+
label: import_editor_styles_repository6.ELEMENTS_STYLES_RESERVED_LABEL
|
|
1222
1314
|
});
|
|
1223
1315
|
},
|
|
1224
1316
|
undo: ({ elementId }, styleId) => {
|
|
1225
|
-
(0,
|
|
1317
|
+
(0, import_editor_elements6.deleteElementStyle)(elementId, styleId);
|
|
1226
1318
|
},
|
|
1227
1319
|
redo: (payload, styleId) => {
|
|
1228
|
-
return (0,
|
|
1320
|
+
return (0, import_editor_elements6.createElementStyle)({
|
|
1229
1321
|
...payload,
|
|
1230
1322
|
styleId,
|
|
1231
|
-
label: import_editor_styles_repository6.
|
|
1323
|
+
label: import_editor_styles_repository6.ELEMENTS_STYLES_RESERVED_LABEL
|
|
1232
1324
|
});
|
|
1233
1325
|
}
|
|
1234
1326
|
},
|
|
1235
1327
|
{
|
|
1236
|
-
title: ({ elementId }) => (0,
|
|
1328
|
+
title: ({ elementId }) => (0, import_editor_elements6.getElementLabel)(elementId),
|
|
1237
1329
|
subtitle: (0, import_i18n4.__)("Style edited", "elementor")
|
|
1238
1330
|
}
|
|
1239
1331
|
);
|
|
1240
1332
|
}, []);
|
|
1241
1333
|
}
|
|
1242
1334
|
function useUndoableUpdateStyle() {
|
|
1243
|
-
return (0,
|
|
1335
|
+
return (0, import_react11.useMemo)(() => {
|
|
1244
1336
|
return (0, import_editor_v1_adapters.undoable)(
|
|
1245
1337
|
{
|
|
1246
1338
|
do: ({ elementId, styleId, provider, meta, props }) => {
|
|
1247
1339
|
if (!provider.actions.updateProps) {
|
|
1248
1340
|
throw new StylesProviderCannotUpdatePropsError({
|
|
1249
|
-
context: { providerKey: provider.
|
|
1341
|
+
context: { providerKey: provider.getKey() }
|
|
1250
1342
|
});
|
|
1251
1343
|
}
|
|
1252
|
-
const style = provider.actions.
|
|
1344
|
+
const style = provider.actions.get(styleId, { elementId });
|
|
1253
1345
|
const prevProps = getCurrentProps(style, meta);
|
|
1254
1346
|
provider.actions.updateProps(
|
|
1255
1347
|
{
|
|
@@ -1266,7 +1358,7 @@ function useUndoableUpdateStyle() {
|
|
|
1266
1358
|
}
|
|
1267
1359
|
},
|
|
1268
1360
|
{
|
|
1269
|
-
title: ({ elementId }) => (0,
|
|
1361
|
+
title: ({ elementId }) => (0, import_editor_elements6.getElementLabel)(elementId),
|
|
1270
1362
|
subtitle: (0, import_i18n4.__)("Style edited", "elementor")
|
|
1271
1363
|
}
|
|
1272
1364
|
);
|
|
@@ -1297,27 +1389,7 @@ function useStylesField(propName) {
|
|
|
1297
1389
|
var React17 = __toESM(require("react"));
|
|
1298
1390
|
var import_editor_controls5 = require("@elementor/editor-controls");
|
|
1299
1391
|
var import_editor_styles_repository7 = require("@elementor/editor-styles-repository");
|
|
1300
|
-
var import_ui11 = require("@elementor/ui");
|
|
1301
1392
|
var import_i18n5 = require("@wordpress/i18n");
|
|
1302
|
-
var Circle = (0, import_ui11.styled)("div", {
|
|
1303
|
-
shouldForwardProp: (prop) => prop !== "variant"
|
|
1304
|
-
})`
|
|
1305
|
-
width: 5px;
|
|
1306
|
-
height: 5px;
|
|
1307
|
-
border-radius: 50%;
|
|
1308
|
-
background-color: ${({ theme, variant }) => {
|
|
1309
|
-
switch (variant) {
|
|
1310
|
-
case "overridden":
|
|
1311
|
-
return theme.palette.warning.light;
|
|
1312
|
-
case "global-affects":
|
|
1313
|
-
return theme.palette.global.dark;
|
|
1314
|
-
case "local-affects":
|
|
1315
|
-
return theme.palette.primary.main;
|
|
1316
|
-
default:
|
|
1317
|
-
return theme.palette.text.disabled;
|
|
1318
|
-
}
|
|
1319
|
-
}};
|
|
1320
|
-
`;
|
|
1321
1393
|
var StylesInheritanceIndicator = () => {
|
|
1322
1394
|
const { value, path } = (0, import_editor_controls5.useBoundProp)();
|
|
1323
1395
|
const { id: currentStyleId, provider: currentStyleProvider, meta: currentStyleMeta } = useStyle();
|
|
@@ -1326,35 +1398,39 @@ var StylesInheritanceIndicator = () => {
|
|
|
1326
1398
|
if (!inheritanceChain.length) {
|
|
1327
1399
|
return null;
|
|
1328
1400
|
}
|
|
1329
|
-
const [{
|
|
1330
|
-
|
|
1331
|
-
|
|
1401
|
+
const [{ style, variant, provider }] = inheritanceChain;
|
|
1402
|
+
if (provider === import_editor_styles_repository7.ELEMENTS_BASE_STYLES_PROVIDER_KEY) {
|
|
1403
|
+
return null;
|
|
1404
|
+
}
|
|
1405
|
+
const { breakpoint, state } = variant.meta;
|
|
1406
|
+
if (style.id === currentStyleId && breakpoint === currentStyleMeta.breakpoint && state === currentStyleMeta.state) {
|
|
1332
1407
|
return /* @__PURE__ */ React17.createElement(
|
|
1333
|
-
|
|
1408
|
+
StyleIndicator,
|
|
1334
1409
|
{
|
|
1335
1410
|
"aria-label": (0, import_i18n5.__)("This is the final value", "elementor"),
|
|
1336
|
-
variant:
|
|
1411
|
+
variant: (0, import_editor_styles_repository7.isElementsStylesProvider)(currentStyleProvider?.getKey()) ? "local" : "global"
|
|
1337
1412
|
}
|
|
1338
1413
|
);
|
|
1339
1414
|
}
|
|
1340
1415
|
if (value !== null && value !== void 0) {
|
|
1341
1416
|
return /* @__PURE__ */ React17.createElement(
|
|
1342
|
-
|
|
1417
|
+
StyleIndicator,
|
|
1343
1418
|
{
|
|
1344
1419
|
"aria-label": (0, import_i18n5.__)("This value is overridden by another style", "elementor"),
|
|
1345
1420
|
variant: "overridden"
|
|
1346
1421
|
}
|
|
1347
1422
|
);
|
|
1348
1423
|
}
|
|
1349
|
-
return /* @__PURE__ */ React17.createElement(
|
|
1424
|
+
return /* @__PURE__ */ React17.createElement(StyleIndicator, { "aria-label": (0, import_i18n5.__)("This has value from another style", "elementor") });
|
|
1350
1425
|
};
|
|
1351
1426
|
|
|
1352
1427
|
// src/controls-registry/styles-field.tsx
|
|
1353
|
-
var StylesField = ({ bind, children }) => {
|
|
1428
|
+
var StylesField = ({ bind, placeholder, children }) => {
|
|
1354
1429
|
const [value, setValue] = useStylesField(bind);
|
|
1355
1430
|
const stylesSchema = (0, import_editor_styles2.getStylesSchema)();
|
|
1356
1431
|
const propType = createTopLevelOjectType({ schema: stylesSchema });
|
|
1357
1432
|
const values = { [bind]: value };
|
|
1433
|
+
const placeholderValues = { [bind]: placeholder };
|
|
1358
1434
|
const setValues = (newValue) => {
|
|
1359
1435
|
setValue(newValue[bind]);
|
|
1360
1436
|
};
|
|
@@ -1368,7 +1444,16 @@ var StylesField = ({ bind, children }) => {
|
|
|
1368
1444
|
}
|
|
1369
1445
|
]
|
|
1370
1446
|
},
|
|
1371
|
-
/* @__PURE__ */ React18.createElement(
|
|
1447
|
+
/* @__PURE__ */ React18.createElement(
|
|
1448
|
+
import_editor_controls6.PropProvider,
|
|
1449
|
+
{
|
|
1450
|
+
propType,
|
|
1451
|
+
value: values,
|
|
1452
|
+
setValue: setValues,
|
|
1453
|
+
placeholder: placeholderValues
|
|
1454
|
+
},
|
|
1455
|
+
/* @__PURE__ */ React18.createElement(import_editor_controls6.PropKeyProvider, { bind }, children)
|
|
1456
|
+
)
|
|
1372
1457
|
);
|
|
1373
1458
|
};
|
|
1374
1459
|
|
|
@@ -1378,7 +1463,7 @@ var BackgroundSection = () => {
|
|
|
1378
1463
|
};
|
|
1379
1464
|
|
|
1380
1465
|
// src/components/style-sections/border-section/border-section.tsx
|
|
1381
|
-
var
|
|
1466
|
+
var React29 = __toESM(require("react"));
|
|
1382
1467
|
|
|
1383
1468
|
// src/components/panel-divider.tsx
|
|
1384
1469
|
var React20 = __toESM(require("react"));
|
|
@@ -1391,7 +1476,7 @@ var import_ui13 = require("@elementor/ui");
|
|
|
1391
1476
|
var SectionContent = ({ gap = 2, sx, children }) => /* @__PURE__ */ React21.createElement(import_ui13.Stack, { gap, sx: { ...sx } }, children);
|
|
1392
1477
|
|
|
1393
1478
|
// src/components/style-sections/border-section/border-field.tsx
|
|
1394
|
-
var
|
|
1479
|
+
var React27 = __toESM(require("react"));
|
|
1395
1480
|
var import_i18n9 = require("@wordpress/i18n");
|
|
1396
1481
|
|
|
1397
1482
|
// src/components/add-or-remove-content.tsx
|
|
@@ -1454,11 +1539,11 @@ var BorderStyleField = () => {
|
|
|
1454
1539
|
};
|
|
1455
1540
|
|
|
1456
1541
|
// src/components/style-sections/border-section/border-width-field.tsx
|
|
1457
|
-
var
|
|
1542
|
+
var React26 = __toESM(require("react"));
|
|
1458
1543
|
var import_editor_controls11 = require("@elementor/editor-controls");
|
|
1459
|
-
var
|
|
1544
|
+
var import_editor_props4 = require("@elementor/editor-props");
|
|
1460
1545
|
var import_icons6 = require("@elementor/icons");
|
|
1461
|
-
var
|
|
1546
|
+
var import_ui19 = require("@elementor/ui");
|
|
1462
1547
|
var import_i18n8 = require("@wordpress/i18n");
|
|
1463
1548
|
|
|
1464
1549
|
// src/hooks/use-direction.ts
|
|
@@ -1469,84 +1554,41 @@ function useDirection() {
|
|
|
1469
1554
|
return { isSiteRtl, isUiRtl };
|
|
1470
1555
|
}
|
|
1471
1556
|
|
|
1472
|
-
// src/components/style-sections/layout-section/utils/rotated-icon.tsx
|
|
1473
|
-
var React26 = __toESM(require("react"));
|
|
1474
|
-
var import_react11 = require("react");
|
|
1475
|
-
var import_ui19 = require("@elementor/ui");
|
|
1476
|
-
var CLOCKWISE_ANGLES = {
|
|
1477
|
-
row: 0,
|
|
1478
|
-
column: 90,
|
|
1479
|
-
"row-reverse": 180,
|
|
1480
|
-
"column-reverse": 270
|
|
1481
|
-
};
|
|
1482
|
-
var COUNTER_CLOCKWISE_ANGLES = {
|
|
1483
|
-
row: 0,
|
|
1484
|
-
column: -90,
|
|
1485
|
-
"row-reverse": -180,
|
|
1486
|
-
"column-reverse": -270
|
|
1487
|
-
};
|
|
1488
|
-
var RotatedIcon = ({
|
|
1489
|
-
icon: Icon,
|
|
1490
|
-
size,
|
|
1491
|
-
isClockwise = true,
|
|
1492
|
-
offset = 0,
|
|
1493
|
-
disableRotationForReversed = false
|
|
1494
|
-
}) => {
|
|
1495
|
-
const rotate = (0, import_react11.useRef)(useGetTargetAngle(isClockwise, offset, disableRotationForReversed));
|
|
1496
|
-
rotate.current = useGetTargetAngle(isClockwise, offset, disableRotationForReversed, rotate);
|
|
1497
|
-
return /* @__PURE__ */ React26.createElement(Icon, { fontSize: size, sx: { transition: ".3s", rotate: `${rotate.current}deg` } });
|
|
1498
|
-
};
|
|
1499
|
-
var useGetTargetAngle = (isClockwise, offset, disableRotationForReversed, existingRef) => {
|
|
1500
|
-
const [direction] = useStylesField("flex-direction");
|
|
1501
|
-
const isRtl = "rtl" === (0, import_ui19.useTheme)().direction;
|
|
1502
|
-
const rotationMultiplier = isRtl ? -1 : 1;
|
|
1503
|
-
const angleMap = isClockwise ? CLOCKWISE_ANGLES : COUNTER_CLOCKWISE_ANGLES;
|
|
1504
|
-
const currentDirection = direction?.value || "row";
|
|
1505
|
-
const currentAngle = existingRef ? existingRef.current * rotationMultiplier : angleMap[currentDirection] + offset;
|
|
1506
|
-
const targetAngle = angleMap[currentDirection] + offset;
|
|
1507
|
-
const diffToTargetAngle = (targetAngle - currentAngle + 360) % 360;
|
|
1508
|
-
const formattedDiff = (diffToTargetAngle + 180) % 360 - 180;
|
|
1509
|
-
if (disableRotationForReversed && ["row-reverse", "column-reverse"].includes(currentDirection)) {
|
|
1510
|
-
return 0;
|
|
1511
|
-
}
|
|
1512
|
-
return (currentAngle + formattedDiff) * rotationMultiplier;
|
|
1513
|
-
};
|
|
1514
|
-
|
|
1515
1557
|
// src/components/style-sections/border-section/border-width-field.tsx
|
|
1516
|
-
var InlineStartIcon = (0,
|
|
1517
|
-
var InlineEndIcon = (0,
|
|
1558
|
+
var InlineStartIcon = (0, import_ui19.withDirection)(import_icons6.SideRightIcon);
|
|
1559
|
+
var InlineEndIcon = (0, import_ui19.withDirection)(import_icons6.SideLeftIcon);
|
|
1518
1560
|
var getEdges = (isSiteRtl) => [
|
|
1519
1561
|
{
|
|
1520
1562
|
label: (0, import_i18n8.__)("Top", "elementor"),
|
|
1521
|
-
icon: /* @__PURE__ */
|
|
1563
|
+
icon: /* @__PURE__ */ React26.createElement(import_icons6.SideTopIcon, { fontSize: "tiny" }),
|
|
1522
1564
|
bind: "block-start"
|
|
1523
1565
|
},
|
|
1524
1566
|
{
|
|
1525
1567
|
label: isSiteRtl ? (0, import_i18n8.__)("Left", "elementor") : (0, import_i18n8.__)("Right", "elementor"),
|
|
1526
|
-
icon: /* @__PURE__ */
|
|
1568
|
+
icon: /* @__PURE__ */ React26.createElement(InlineStartIcon, { fontSize: "tiny" }),
|
|
1527
1569
|
bind: "inline-end"
|
|
1528
1570
|
},
|
|
1529
1571
|
{
|
|
1530
1572
|
label: (0, import_i18n8.__)("Bottom", "elementor"),
|
|
1531
|
-
icon: /* @__PURE__ */
|
|
1573
|
+
icon: /* @__PURE__ */ React26.createElement(import_icons6.SideBottomIcon, { fontSize: "tiny" }),
|
|
1532
1574
|
bind: "block-end"
|
|
1533
1575
|
},
|
|
1534
1576
|
{
|
|
1535
1577
|
label: isSiteRtl ? (0, import_i18n8.__)("Right", "elementor") : (0, import_i18n8.__)("Left", "elementor"),
|
|
1536
|
-
icon: /* @__PURE__ */
|
|
1578
|
+
icon: /* @__PURE__ */ React26.createElement(InlineEndIcon, { fontSize: "tiny" }),
|
|
1537
1579
|
bind: "inline-start"
|
|
1538
1580
|
}
|
|
1539
1581
|
];
|
|
1540
1582
|
var BorderWidthField = () => {
|
|
1541
1583
|
const { isSiteRtl } = useDirection();
|
|
1542
|
-
return /* @__PURE__ */
|
|
1584
|
+
return /* @__PURE__ */ React26.createElement(StylesField, { bind: "border-width" }, /* @__PURE__ */ React26.createElement(
|
|
1543
1585
|
import_editor_controls11.EqualUnequalSizesControl,
|
|
1544
1586
|
{
|
|
1545
1587
|
items: getEdges(isSiteRtl),
|
|
1546
1588
|
label: (0, import_i18n8.__)("Border width", "elementor"),
|
|
1547
|
-
icon: /* @__PURE__ */
|
|
1589
|
+
icon: /* @__PURE__ */ React26.createElement(import_icons6.SideAllIcon, { fontSize: "tiny" }),
|
|
1548
1590
|
tooltipLabel: (0, import_i18n8.__)("Adjust borders", "elementor"),
|
|
1549
|
-
multiSizePropTypeUtil:
|
|
1591
|
+
multiSizePropTypeUtil: import_editor_props4.borderWidthPropTypeUtil
|
|
1550
1592
|
}
|
|
1551
1593
|
));
|
|
1552
1594
|
};
|
|
@@ -1570,7 +1612,7 @@ var BorderField = () => {
|
|
|
1570
1612
|
});
|
|
1571
1613
|
};
|
|
1572
1614
|
const hasBorder = Object.values(border ?? {}).some(Boolean);
|
|
1573
|
-
return /* @__PURE__ */
|
|
1615
|
+
return /* @__PURE__ */ React27.createElement(
|
|
1574
1616
|
AddOrRemoveContent,
|
|
1575
1617
|
{
|
|
1576
1618
|
label: (0, import_i18n9.__)("Border", "elementor"),
|
|
@@ -1578,23 +1620,23 @@ var BorderField = () => {
|
|
|
1578
1620
|
onAdd: addBorder,
|
|
1579
1621
|
onRemove: removeBorder
|
|
1580
1622
|
},
|
|
1581
|
-
/* @__PURE__ */
|
|
1582
|
-
/* @__PURE__ */
|
|
1583
|
-
/* @__PURE__ */
|
|
1623
|
+
/* @__PURE__ */ React27.createElement(BorderWidthField, null),
|
|
1624
|
+
/* @__PURE__ */ React27.createElement(BorderColorField, null),
|
|
1625
|
+
/* @__PURE__ */ React27.createElement(BorderStyleField, null)
|
|
1584
1626
|
);
|
|
1585
1627
|
};
|
|
1586
1628
|
|
|
1587
1629
|
// src/components/style-sections/border-section/border-radius-field.tsx
|
|
1588
|
-
var
|
|
1630
|
+
var React28 = __toESM(require("react"));
|
|
1589
1631
|
var import_editor_controls12 = require("@elementor/editor-controls");
|
|
1590
|
-
var
|
|
1632
|
+
var import_editor_props5 = require("@elementor/editor-props");
|
|
1591
1633
|
var import_icons7 = require("@elementor/icons");
|
|
1592
|
-
var
|
|
1634
|
+
var import_ui20 = require("@elementor/ui");
|
|
1593
1635
|
var import_i18n10 = require("@wordpress/i18n");
|
|
1594
|
-
var StartStartIcon = (0,
|
|
1595
|
-
var StartEndIcon = (0,
|
|
1596
|
-
var EndStartIcon = (0,
|
|
1597
|
-
var EndEndIcon = (0,
|
|
1636
|
+
var StartStartIcon = (0, import_ui20.withDirection)(import_icons7.RadiusTopLeftIcon);
|
|
1637
|
+
var StartEndIcon = (0, import_ui20.withDirection)(import_icons7.RadiusTopRightIcon);
|
|
1638
|
+
var EndStartIcon = (0, import_ui20.withDirection)(import_icons7.RadiusBottomLeftIcon);
|
|
1639
|
+
var EndEndIcon = (0, import_ui20.withDirection)(import_icons7.RadiusBottomRightIcon);
|
|
1598
1640
|
var getStartStartLabel = (isSiteRtl) => isSiteRtl ? (0, import_i18n10.__)("Top right", "elementor") : (0, import_i18n10.__)("Top left", "elementor");
|
|
1599
1641
|
var getStartEndLabel = (isSiteRtl) => isSiteRtl ? (0, import_i18n10.__)("Top left", "elementor") : (0, import_i18n10.__)("Top right", "elementor");
|
|
1600
1642
|
var getEndStartLabel = (isSiteRtl) => isSiteRtl ? (0, import_i18n10.__)("Bottom right", "elementor") : (0, import_i18n10.__)("Bottom left", "elementor");
|
|
@@ -1602,53 +1644,53 @@ var getEndEndLabel = (isSiteRtl) => isSiteRtl ? (0, import_i18n10.__)("Bottom le
|
|
|
1602
1644
|
var getCorners = (isSiteRtl) => [
|
|
1603
1645
|
{
|
|
1604
1646
|
label: getStartStartLabel(isSiteRtl),
|
|
1605
|
-
icon: /* @__PURE__ */
|
|
1647
|
+
icon: /* @__PURE__ */ React28.createElement(StartStartIcon, { fontSize: "tiny" }),
|
|
1606
1648
|
bind: "start-start"
|
|
1607
1649
|
},
|
|
1608
1650
|
{
|
|
1609
1651
|
label: getStartEndLabel(isSiteRtl),
|
|
1610
|
-
icon: /* @__PURE__ */
|
|
1652
|
+
icon: /* @__PURE__ */ React28.createElement(StartEndIcon, { fontSize: "tiny" }),
|
|
1611
1653
|
bind: "start-end"
|
|
1612
1654
|
},
|
|
1613
1655
|
{
|
|
1614
1656
|
label: getEndStartLabel(isSiteRtl),
|
|
1615
|
-
icon: /* @__PURE__ */
|
|
1657
|
+
icon: /* @__PURE__ */ React28.createElement(EndStartIcon, { fontSize: "tiny" }),
|
|
1616
1658
|
bind: "end-start"
|
|
1617
1659
|
},
|
|
1618
1660
|
{
|
|
1619
1661
|
label: getEndEndLabel(isSiteRtl),
|
|
1620
|
-
icon: /* @__PURE__ */
|
|
1662
|
+
icon: /* @__PURE__ */ React28.createElement(EndEndIcon, { fontSize: "tiny" }),
|
|
1621
1663
|
bind: "end-end"
|
|
1622
1664
|
}
|
|
1623
1665
|
];
|
|
1624
1666
|
var BorderRadiusField = () => {
|
|
1625
1667
|
const { isSiteRtl } = useDirection();
|
|
1626
|
-
return /* @__PURE__ */
|
|
1668
|
+
return /* @__PURE__ */ React28.createElement(StylesField, { bind: "border-radius" }, /* @__PURE__ */ React28.createElement(
|
|
1627
1669
|
import_editor_controls12.EqualUnequalSizesControl,
|
|
1628
1670
|
{
|
|
1629
1671
|
items: getCorners(isSiteRtl),
|
|
1630
1672
|
label: (0, import_i18n10.__)("Border radius", "elementor"),
|
|
1631
|
-
icon: /* @__PURE__ */
|
|
1673
|
+
icon: /* @__PURE__ */ React28.createElement(import_icons7.BorderCornersIcon, { fontSize: "tiny" }),
|
|
1632
1674
|
tooltipLabel: (0, import_i18n10.__)("Adjust corners", "elementor"),
|
|
1633
|
-
multiSizePropTypeUtil:
|
|
1675
|
+
multiSizePropTypeUtil: import_editor_props5.borderRadiusPropTypeUtil
|
|
1634
1676
|
}
|
|
1635
1677
|
));
|
|
1636
1678
|
};
|
|
1637
1679
|
|
|
1638
1680
|
// src/components/style-sections/border-section/border-section.tsx
|
|
1639
|
-
var BorderSection = () => /* @__PURE__ */
|
|
1681
|
+
var BorderSection = () => /* @__PURE__ */ React29.createElement(SectionContent, null, /* @__PURE__ */ React29.createElement(BorderRadiusField, null), /* @__PURE__ */ React29.createElement(PanelDivider, null), /* @__PURE__ */ React29.createElement(BorderField, null));
|
|
1640
1682
|
|
|
1641
1683
|
// src/components/style-sections/effects-section/effects-section.tsx
|
|
1642
|
-
var
|
|
1684
|
+
var React30 = __toESM(require("react"));
|
|
1643
1685
|
var import_editor_controls13 = require("@elementor/editor-controls");
|
|
1644
1686
|
var EffectsSection = () => {
|
|
1645
|
-
return /* @__PURE__ */
|
|
1687
|
+
return /* @__PURE__ */ React30.createElement(SectionContent, null, /* @__PURE__ */ React30.createElement(StylesField, { bind: "box-shadow" }, /* @__PURE__ */ React30.createElement(import_editor_controls13.BoxShadowRepeaterControl, null)));
|
|
1646
1688
|
};
|
|
1647
1689
|
|
|
1648
1690
|
// src/components/style-sections/layout-section/layout-section.tsx
|
|
1649
1691
|
var React42 = __toESM(require("react"));
|
|
1650
1692
|
var import_editor_controls24 = require("@elementor/editor-controls");
|
|
1651
|
-
var
|
|
1693
|
+
var import_editor_elements7 = require("@elementor/editor-elements");
|
|
1652
1694
|
var import_i18n21 = require("@wordpress/i18n");
|
|
1653
1695
|
|
|
1654
1696
|
// src/hooks/use-computed-style.ts
|
|
@@ -1682,6 +1724,51 @@ var import_editor_controls14 = require("@elementor/editor-controls");
|
|
|
1682
1724
|
var import_icons8 = require("@elementor/icons");
|
|
1683
1725
|
var import_ui22 = require("@elementor/ui");
|
|
1684
1726
|
var import_i18n11 = require("@wordpress/i18n");
|
|
1727
|
+
|
|
1728
|
+
// src/components/style-sections/layout-section/utils/rotated-icon.tsx
|
|
1729
|
+
var React31 = __toESM(require("react"));
|
|
1730
|
+
var import_react12 = require("react");
|
|
1731
|
+
var import_ui21 = require("@elementor/ui");
|
|
1732
|
+
var CLOCKWISE_ANGLES = {
|
|
1733
|
+
row: 0,
|
|
1734
|
+
column: 90,
|
|
1735
|
+
"row-reverse": 180,
|
|
1736
|
+
"column-reverse": 270
|
|
1737
|
+
};
|
|
1738
|
+
var COUNTER_CLOCKWISE_ANGLES = {
|
|
1739
|
+
row: 0,
|
|
1740
|
+
column: -90,
|
|
1741
|
+
"row-reverse": -180,
|
|
1742
|
+
"column-reverse": -270
|
|
1743
|
+
};
|
|
1744
|
+
var RotatedIcon = ({
|
|
1745
|
+
icon: Icon,
|
|
1746
|
+
size,
|
|
1747
|
+
isClockwise = true,
|
|
1748
|
+
offset = 0,
|
|
1749
|
+
disableRotationForReversed = false
|
|
1750
|
+
}) => {
|
|
1751
|
+
const rotate = (0, import_react12.useRef)(useGetTargetAngle(isClockwise, offset, disableRotationForReversed));
|
|
1752
|
+
rotate.current = useGetTargetAngle(isClockwise, offset, disableRotationForReversed, rotate);
|
|
1753
|
+
return /* @__PURE__ */ React31.createElement(Icon, { fontSize: size, sx: { transition: ".3s", rotate: `${rotate.current}deg` } });
|
|
1754
|
+
};
|
|
1755
|
+
var useGetTargetAngle = (isClockwise, offset, disableRotationForReversed, existingRef) => {
|
|
1756
|
+
const [direction] = useStylesField("flex-direction");
|
|
1757
|
+
const isRtl = "rtl" === (0, import_ui21.useTheme)().direction;
|
|
1758
|
+
const rotationMultiplier = isRtl ? -1 : 1;
|
|
1759
|
+
const angleMap = isClockwise ? CLOCKWISE_ANGLES : COUNTER_CLOCKWISE_ANGLES;
|
|
1760
|
+
const currentDirection = direction?.value || "row";
|
|
1761
|
+
const currentAngle = existingRef ? existingRef.current * rotationMultiplier : angleMap[currentDirection] + offset;
|
|
1762
|
+
const targetAngle = angleMap[currentDirection] + offset;
|
|
1763
|
+
const diffToTargetAngle = (targetAngle - currentAngle + 360) % 360;
|
|
1764
|
+
const formattedDiff = (diffToTargetAngle + 180) % 360 - 180;
|
|
1765
|
+
if (disableRotationForReversed && ["row-reverse", "column-reverse"].includes(currentDirection)) {
|
|
1766
|
+
return 0;
|
|
1767
|
+
}
|
|
1768
|
+
return (currentAngle + formattedDiff) * rotationMultiplier;
|
|
1769
|
+
};
|
|
1770
|
+
|
|
1771
|
+
// src/components/style-sections/layout-section/align-content-field.tsx
|
|
1685
1772
|
var StartIcon = (0, import_ui22.withDirection)(import_icons8.JustifyTopIcon);
|
|
1686
1773
|
var EndIcon = (0, import_ui22.withDirection)(import_icons8.JustifyBottomIcon);
|
|
1687
1774
|
var iconProps = {
|
|
@@ -1823,35 +1910,37 @@ var React35 = __toESM(require("react"));
|
|
|
1823
1910
|
var import_editor_controls17 = require("@elementor/editor-controls");
|
|
1824
1911
|
var import_ui25 = require("@elementor/ui");
|
|
1825
1912
|
var import_i18n14 = require("@wordpress/i18n");
|
|
1913
|
+
var displayFieldOptions = [
|
|
1914
|
+
{
|
|
1915
|
+
value: "block",
|
|
1916
|
+
renderContent: () => (0, import_i18n14.__)("Block", "elementor"),
|
|
1917
|
+
label: (0, import_i18n14.__)("Block", "elementor"),
|
|
1918
|
+
showTooltip: true
|
|
1919
|
+
},
|
|
1920
|
+
{
|
|
1921
|
+
value: "flex",
|
|
1922
|
+
renderContent: () => (0, import_i18n14.__)("Flex", "elementor"),
|
|
1923
|
+
label: (0, import_i18n14.__)("Flex", "elementor"),
|
|
1924
|
+
showTooltip: true
|
|
1925
|
+
},
|
|
1926
|
+
{
|
|
1927
|
+
value: "inline-block",
|
|
1928
|
+
renderContent: () => (0, import_i18n14.__)("In-blk", "elementor"),
|
|
1929
|
+
label: (0, import_i18n14.__)("Inline-block", "elementor"),
|
|
1930
|
+
showTooltip: true
|
|
1931
|
+
},
|
|
1932
|
+
{
|
|
1933
|
+
value: "inline-flex",
|
|
1934
|
+
renderContent: () => (0, import_i18n14.__)("In-flx", "elementor"),
|
|
1935
|
+
label: (0, import_i18n14.__)("Inline-flex", "elementor"),
|
|
1936
|
+
showTooltip: true
|
|
1937
|
+
}
|
|
1938
|
+
];
|
|
1826
1939
|
var DisplayField = () => {
|
|
1827
|
-
const
|
|
1828
|
-
|
|
1829
|
-
value: "block",
|
|
1830
|
-
renderContent: () => (0, import_i18n14.__)("Block", "elementor"),
|
|
1831
|
-
label: (0, import_i18n14.__)("Block", "elementor"),
|
|
1832
|
-
showTooltip: true
|
|
1833
|
-
},
|
|
1834
|
-
{
|
|
1835
|
-
value: "flex",
|
|
1836
|
-
renderContent: () => (0, import_i18n14.__)("Flex", "elementor"),
|
|
1837
|
-
label: (0, import_i18n14.__)("Flex", "elementor"),
|
|
1838
|
-
showTooltip: true
|
|
1839
|
-
},
|
|
1840
|
-
{
|
|
1841
|
-
value: "inline-block",
|
|
1842
|
-
renderContent: () => (0, import_i18n14.__)("In-blk", "elementor"),
|
|
1843
|
-
label: (0, import_i18n14.__)("Inline-block", "elementor"),
|
|
1844
|
-
showTooltip: true
|
|
1845
|
-
},
|
|
1846
|
-
{
|
|
1847
|
-
value: "inline-flex",
|
|
1848
|
-
renderContent: () => (0, import_i18n14.__)("In-flx", "elementor"),
|
|
1849
|
-
label: (0, import_i18n14.__)("Inline-flex", "elementor"),
|
|
1850
|
-
showTooltip: true
|
|
1851
|
-
}
|
|
1852
|
-
];
|
|
1853
|
-
return /* @__PURE__ */ React35.createElement(StylesField, { bind: "display" }, /* @__PURE__ */ React35.createElement(import_ui25.Stack, { gap: 0.75 }, /* @__PURE__ */ React35.createElement(ControlLabel, null, (0, import_i18n14.__)("Display", "elementor")), /* @__PURE__ */ React35.createElement(import_editor_controls17.ToggleControl, { options: options13, fullWidth: true })));
|
|
1940
|
+
const placeholder = useDisplayPlaceholderValue();
|
|
1941
|
+
return /* @__PURE__ */ React35.createElement(StylesField, { bind: "display", placeholder }, /* @__PURE__ */ React35.createElement(import_ui25.Stack, { gap: 0.75 }, /* @__PURE__ */ React35.createElement(ControlLabel, null, (0, import_i18n14.__)("Display", "elementor")), /* @__PURE__ */ React35.createElement(import_editor_controls17.ToggleControl, { options: displayFieldOptions, fullWidth: true })));
|
|
1854
1942
|
};
|
|
1943
|
+
var useDisplayPlaceholderValue = () => useStylesInheritanceField("display")[0]?.value ?? void 0;
|
|
1855
1944
|
|
|
1856
1945
|
// src/components/style-sections/layout-section/flex-direction-field.tsx
|
|
1857
1946
|
var React36 = __toESM(require("react"));
|
|
@@ -1864,8 +1953,8 @@ var options4 = [
|
|
|
1864
1953
|
value: "row",
|
|
1865
1954
|
label: (0, import_i18n15.__)("Row", "elementor"),
|
|
1866
1955
|
renderContent: ({ size }) => {
|
|
1867
|
-
const
|
|
1868
|
-
return /* @__PURE__ */ React36.createElement(
|
|
1956
|
+
const StartIcon5 = (0, import_ui26.withDirection)(import_icons11.ArrowRightIcon);
|
|
1957
|
+
return /* @__PURE__ */ React36.createElement(StartIcon5, { fontSize: size });
|
|
1869
1958
|
},
|
|
1870
1959
|
showTooltip: true
|
|
1871
1960
|
},
|
|
@@ -1879,8 +1968,8 @@ var options4 = [
|
|
|
1879
1968
|
value: "row-reverse",
|
|
1880
1969
|
label: (0, import_i18n15.__)("Reversed row", "elementor"),
|
|
1881
1970
|
renderContent: ({ size }) => {
|
|
1882
|
-
const
|
|
1883
|
-
return /* @__PURE__ */ React36.createElement(
|
|
1971
|
+
const EndIcon5 = (0, import_ui26.withDirection)(import_icons11.ArrowLeftIcon);
|
|
1972
|
+
return /* @__PURE__ */ React36.createElement(EndIcon5, { fontSize: size });
|
|
1884
1973
|
},
|
|
1885
1974
|
showTooltip: true
|
|
1886
1975
|
},
|
|
@@ -1898,7 +1987,7 @@ var FlexDirectionField = () => {
|
|
|
1898
1987
|
|
|
1899
1988
|
// src/components/style-sections/layout-section/flex-order-field.tsx
|
|
1900
1989
|
var React37 = __toESM(require("react"));
|
|
1901
|
-
var
|
|
1990
|
+
var import_react13 = require("react");
|
|
1902
1991
|
var import_editor_controls19 = require("@elementor/editor-controls");
|
|
1903
1992
|
var import_icons12 = require("@elementor/icons");
|
|
1904
1993
|
var import_ui27 = require("@elementor/ui");
|
|
@@ -1934,7 +2023,7 @@ var items = [
|
|
|
1934
2023
|
];
|
|
1935
2024
|
var FlexOrderField = () => {
|
|
1936
2025
|
const { isSiteRtl } = useDirection(), [order, setOrder] = useStylesField("order");
|
|
1937
|
-
const [groupControlValue, setGroupControlValue] = (0,
|
|
2026
|
+
const [groupControlValue, setGroupControlValue] = (0, import_react13.useState)(getGroupControlValue(order?.value || null));
|
|
1938
2027
|
const handleToggleButtonChange = (group) => {
|
|
1939
2028
|
setGroupControlValue(group);
|
|
1940
2029
|
if (!group || group === CUSTOM) {
|
|
@@ -1972,8 +2061,9 @@ var getGroupControlValue = (order) => {
|
|
|
1972
2061
|
|
|
1973
2062
|
// src/components/style-sections/layout-section/flex-size-field.tsx
|
|
1974
2063
|
var React38 = __toESM(require("react"));
|
|
1975
|
-
var
|
|
2064
|
+
var import_react14 = require("react");
|
|
1976
2065
|
var import_editor_controls20 = require("@elementor/editor-controls");
|
|
2066
|
+
var import_editor_props6 = require("@elementor/editor-props");
|
|
1977
2067
|
var import_icons13 = require("@elementor/icons");
|
|
1978
2068
|
var import_ui28 = require("@elementor/ui");
|
|
1979
2069
|
var import_i18n17 = require("@wordpress/i18n");
|
|
@@ -1999,26 +2089,37 @@ var items2 = [
|
|
|
1999
2089
|
}
|
|
2000
2090
|
];
|
|
2001
2091
|
var FlexSizeField = () => {
|
|
2002
|
-
const { isSiteRtl } = useDirection()
|
|
2003
|
-
const
|
|
2004
|
-
const
|
|
2092
|
+
const { isSiteRtl } = useDirection();
|
|
2093
|
+
const [fields, setFields] = useStylesFields(["flex-grow", "flex-shrink", "flex-basis"]);
|
|
2094
|
+
const grow = fields?.["flex-grow"]?.value || null;
|
|
2095
|
+
const shrink = fields?.["flex-shrink"]?.value || null;
|
|
2096
|
+
const basis = fields?.["flex-basis"]?.value || null;
|
|
2097
|
+
const currentGroup = (0, import_react14.useMemo)(() => getActiveGroup({ grow, shrink, basis }), [grow, shrink, basis]), [activeGroup, setActiveGroup] = (0, import_react14.useState)(currentGroup);
|
|
2005
2098
|
const onChangeGroup = (group = null) => {
|
|
2006
2099
|
setActiveGroup(group);
|
|
2007
|
-
setBasisField(null);
|
|
2008
2100
|
if (!group || group === "custom") {
|
|
2009
|
-
|
|
2010
|
-
|
|
2101
|
+
setFields({
|
|
2102
|
+
"flex-basis": null,
|
|
2103
|
+
"flex-grow": null,
|
|
2104
|
+
"flex-shrink": null
|
|
2105
|
+
});
|
|
2011
2106
|
return;
|
|
2012
2107
|
}
|
|
2013
2108
|
if (group === "flex-grow") {
|
|
2014
|
-
|
|
2015
|
-
|
|
2109
|
+
setFields({
|
|
2110
|
+
"flex-basis": null,
|
|
2111
|
+
"flex-grow": import_editor_props6.numberPropTypeUtil.create(DEFAULT),
|
|
2112
|
+
"flex-shrink": null
|
|
2113
|
+
});
|
|
2016
2114
|
return;
|
|
2017
2115
|
}
|
|
2018
|
-
|
|
2019
|
-
|
|
2116
|
+
setFields({
|
|
2117
|
+
"flex-basis": null,
|
|
2118
|
+
"flex-grow": null,
|
|
2119
|
+
"flex-shrink": import_editor_props6.numberPropTypeUtil.create(DEFAULT)
|
|
2120
|
+
});
|
|
2020
2121
|
};
|
|
2021
|
-
return /* @__PURE__ */ React38.createElement(import_ui28.DirectionProvider, { rtl: isSiteRtl }, /* @__PURE__ */ React38.createElement(import_ui28.ThemeProvider, null, /* @__PURE__ */ React38.createElement(SectionContent, null, /* @__PURE__ */ React38.createElement(import_ui28.
|
|
2122
|
+
return /* @__PURE__ */ React38.createElement(import_ui28.DirectionProvider, { rtl: isSiteRtl }, /* @__PURE__ */ React38.createElement(import_ui28.ThemeProvider, null, /* @__PURE__ */ React38.createElement(SectionContent, null, /* @__PURE__ */ React38.createElement(import_ui28.Grid, { container: true, gap: 2, alignItems: "center", flexWrap: "nowrap" }, /* @__PURE__ */ React38.createElement(import_ui28.Grid, { item: true, xs: 6 }, /* @__PURE__ */ React38.createElement(StylesField, { bind: activeGroup ?? "" }, /* @__PURE__ */ React38.createElement(ControlLabel, null, (0, import_i18n17.__)("Size", "elementor")))), /* @__PURE__ */ React38.createElement(import_ui28.Grid, { item: true, xs: 6, sx: { display: "flex", justifyContent: "end" } }, /* @__PURE__ */ React38.createElement(
|
|
2022
2123
|
import_editor_controls20.ControlToggleButtonGroup,
|
|
2023
2124
|
{
|
|
2024
2125
|
value: activeGroup,
|
|
@@ -2147,16 +2248,25 @@ var WrapField = () => {
|
|
|
2147
2248
|
// src/components/style-sections/layout-section/layout-section.tsx
|
|
2148
2249
|
var LayoutSection = () => {
|
|
2149
2250
|
const [display] = useStylesField("display");
|
|
2251
|
+
const displayPlaceholder = useDisplayPlaceholderValue();
|
|
2252
|
+
const isDisplayFlex = shouldDisplayFlexFields(display, displayPlaceholder);
|
|
2150
2253
|
const { element } = useElement();
|
|
2151
|
-
const parent = (0,
|
|
2254
|
+
const parent = (0, import_editor_elements7.useParentElement)(element.id);
|
|
2152
2255
|
const parentStyle = useComputedStyle(parent?.id || null);
|
|
2153
|
-
return /* @__PURE__ */ React42.createElement(SectionContent, null, /* @__PURE__ */ React42.createElement(DisplayField, null),
|
|
2256
|
+
return /* @__PURE__ */ React42.createElement(SectionContent, null, /* @__PURE__ */ React42.createElement(DisplayField, null), isDisplayFlex && /* @__PURE__ */ React42.createElement(FlexFields, null), "flex" === parentStyle?.display && /* @__PURE__ */ React42.createElement(FlexChildFields, null));
|
|
2154
2257
|
};
|
|
2155
2258
|
var FlexFields = () => {
|
|
2156
2259
|
const [flexWrap] = useStylesField("flex-wrap");
|
|
2157
2260
|
return /* @__PURE__ */ React42.createElement(React42.Fragment, null, /* @__PURE__ */ React42.createElement(FlexDirectionField, null), /* @__PURE__ */ React42.createElement(JustifyContentField, null), /* @__PURE__ */ React42.createElement(AlignItemsField, null), /* @__PURE__ */ React42.createElement(PanelDivider, null), /* @__PURE__ */ React42.createElement(GapControlField, null), /* @__PURE__ */ React42.createElement(WrapField, null), ["wrap", "wrap-reverse"].includes(flexWrap?.value) && /* @__PURE__ */ React42.createElement(AlignContentField, null));
|
|
2158
2261
|
};
|
|
2159
2262
|
var FlexChildFields = () => /* @__PURE__ */ React42.createElement(React42.Fragment, null, /* @__PURE__ */ React42.createElement(PanelDivider, null), /* @__PURE__ */ React42.createElement(import_editor_controls24.ControlFormLabel, null, (0, import_i18n21.__)("Flex child", "elementor")), /* @__PURE__ */ React42.createElement(AlignSelfChild, null), /* @__PURE__ */ React42.createElement(FlexOrderField, null), /* @__PURE__ */ React42.createElement(FlexSizeField, null));
|
|
2263
|
+
var shouldDisplayFlexFields = (display, local) => {
|
|
2264
|
+
const value = display?.value ?? local?.value;
|
|
2265
|
+
if (!value) {
|
|
2266
|
+
return false;
|
|
2267
|
+
}
|
|
2268
|
+
return "flex" === value || "inline-flex" === value;
|
|
2269
|
+
};
|
|
2160
2270
|
|
|
2161
2271
|
// src/components/style-sections/position-section/position-section.tsx
|
|
2162
2272
|
var React46 = __toESM(require("react"));
|
|
@@ -2328,11 +2438,11 @@ var React64 = __toESM(require("react"));
|
|
|
2328
2438
|
|
|
2329
2439
|
// src/components/collapsible-content.tsx
|
|
2330
2440
|
var React50 = __toESM(require("react"));
|
|
2331
|
-
var
|
|
2441
|
+
var import_react15 = require("react");
|
|
2332
2442
|
var import_ui37 = require("@elementor/ui");
|
|
2333
2443
|
var import_i18n28 = require("@wordpress/i18n");
|
|
2334
2444
|
var CollapsibleContent = ({ children, defaultOpen = false }) => {
|
|
2335
|
-
const [open, setOpen] = (0,
|
|
2445
|
+
const [open, setOpen] = (0, import_react15.useState)(defaultOpen);
|
|
2336
2446
|
const handleToggle = () => {
|
|
2337
2447
|
setOpen((prevOpen) => !prevOpen);
|
|
2338
2448
|
};
|
|
@@ -2358,7 +2468,7 @@ var import_ui38 = require("@elementor/ui");
|
|
|
2358
2468
|
var import_i18n30 = require("@wordpress/i18n");
|
|
2359
2469
|
|
|
2360
2470
|
// src/components/style-sections/typography-section/hooks/use-font-families.ts
|
|
2361
|
-
var
|
|
2471
|
+
var import_react16 = require("react");
|
|
2362
2472
|
var import_i18n29 = require("@wordpress/i18n");
|
|
2363
2473
|
|
|
2364
2474
|
// src/sync/get-elementor-config.ts
|
|
@@ -2383,7 +2493,7 @@ var getFontFamilies = () => {
|
|
|
2383
2493
|
};
|
|
2384
2494
|
var useFontFamilies = () => {
|
|
2385
2495
|
const fontFamilies = getFontFamilies();
|
|
2386
|
-
return (0,
|
|
2496
|
+
return (0, import_react16.useMemo)(() => {
|
|
2387
2497
|
const categoriesOrder = ["system", "custom", "googlefonts"];
|
|
2388
2498
|
return Object.entries(fontFamilies || {}).reduce((acc, [font, category]) => {
|
|
2389
2499
|
if (!supportedCategories[category]) {
|
|
@@ -2486,13 +2596,13 @@ var import_editor_controls37 = require("@elementor/editor-controls");
|
|
|
2486
2596
|
var import_icons19 = require("@elementor/icons");
|
|
2487
2597
|
var import_ui44 = require("@elementor/ui");
|
|
2488
2598
|
var import_i18n36 = require("@wordpress/i18n");
|
|
2489
|
-
var
|
|
2490
|
-
var
|
|
2599
|
+
var AlignStartIcon = (0, import_ui44.withDirection)(import_icons19.AlignLeftIcon);
|
|
2600
|
+
var AlignEndIcon = (0, import_ui44.withDirection)(import_icons19.AlignRightIcon);
|
|
2491
2601
|
var options9 = [
|
|
2492
2602
|
{
|
|
2493
2603
|
value: "start",
|
|
2494
2604
|
label: (0, import_i18n36.__)("Start", "elementor"),
|
|
2495
|
-
renderContent: () => /* @__PURE__ */ React57.createElement(
|
|
2605
|
+
renderContent: ({ size }) => /* @__PURE__ */ React57.createElement(AlignStartIcon, { fontSize: size }),
|
|
2496
2606
|
showTooltip: true
|
|
2497
2607
|
},
|
|
2498
2608
|
{
|
|
@@ -2504,7 +2614,7 @@ var options9 = [
|
|
|
2504
2614
|
{
|
|
2505
2615
|
value: "end",
|
|
2506
2616
|
label: (0, import_i18n36.__)("End", "elementor"),
|
|
2507
|
-
renderContent: () => /* @__PURE__ */ React57.createElement(
|
|
2617
|
+
renderContent: ({ size }) => /* @__PURE__ */ React57.createElement(AlignEndIcon, { fontSize: size }),
|
|
2508
2618
|
showTooltip: true
|
|
2509
2619
|
},
|
|
2510
2620
|
{
|
|
@@ -2515,7 +2625,7 @@ var options9 = [
|
|
|
2515
2625
|
}
|
|
2516
2626
|
];
|
|
2517
2627
|
var TextAlignmentField = () => {
|
|
2518
|
-
return /* @__PURE__ */ React57.createElement(StylesField, { bind: "text-align" }, /* @__PURE__ */ React57.createElement(import_ui44.Grid, { container: true, gap: 2, alignItems: "center", flexWrap: "nowrap" }, /* @__PURE__ */ React57.createElement(import_ui44.Grid, { item: true, xs: 6 }, /* @__PURE__ */ React57.createElement(ControlLabel, null, (0, import_i18n36.__)("
|
|
2628
|
+
return /* @__PURE__ */ React57.createElement(StylesField, { bind: "text-align" }, /* @__PURE__ */ React57.createElement(import_ui44.Grid, { container: true, gap: 2, alignItems: "center", flexWrap: "nowrap" }, /* @__PURE__ */ React57.createElement(import_ui44.Grid, { item: true, xs: 6 }, /* @__PURE__ */ React57.createElement(ControlLabel, null, (0, import_i18n36.__)("Text align", "elementor"))), /* @__PURE__ */ React57.createElement(import_ui44.Grid, { item: true, xs: 6, display: "flex", justifyContent: "end" }, /* @__PURE__ */ React57.createElement(import_editor_controls37.ToggleControl, { options: options9 }))));
|
|
2519
2629
|
};
|
|
2520
2630
|
|
|
2521
2631
|
// src/components/style-sections/typography-section/text-color-field.tsx
|
|
@@ -2679,7 +2789,7 @@ var TypographySection = () => {
|
|
|
2679
2789
|
var StyleTab = () => {
|
|
2680
2790
|
const currentClassesProp = useCurrentClassesProp();
|
|
2681
2791
|
const [activeStyleDefId, setActiveStyleDefId] = useActiveStyleDefId(currentClassesProp);
|
|
2682
|
-
const [activeStyleState, setActiveStyleState] = (0,
|
|
2792
|
+
const [activeStyleState, setActiveStyleState] = (0, import_react17.useState)(null);
|
|
2683
2793
|
const breakpoint = (0, import_editor_responsive2.useActiveBreakpoint)();
|
|
2684
2794
|
return /* @__PURE__ */ React65.createElement(ClassesPropProvider, { prop: currentClassesProp }, /* @__PURE__ */ React65.createElement(
|
|
2685
2795
|
StyleProvider,
|
|
@@ -2695,21 +2805,10 @@ var StyleTab = () => {
|
|
|
2695
2805
|
/* @__PURE__ */ React65.createElement(import_session3.SessionStorageProvider, { prefix: activeStyleDefId ?? "" }, /* @__PURE__ */ React65.createElement(StyleInheritanceProvider, null, /* @__PURE__ */ React65.createElement(CssClassSelector, null), /* @__PURE__ */ React65.createElement(import_ui50.Divider, null), /* @__PURE__ */ React65.createElement(SectionsList, null, /* @__PURE__ */ React65.createElement(Section, { title: (0, import_i18n43.__)("Layout", "elementor") }, /* @__PURE__ */ React65.createElement(LayoutSection, null)), /* @__PURE__ */ React65.createElement(Section, { title: (0, import_i18n43.__)("Spacing", "elementor") }, /* @__PURE__ */ React65.createElement(SpacingSection, null)), /* @__PURE__ */ React65.createElement(Section, { title: (0, import_i18n43.__)("Size", "elementor") }, /* @__PURE__ */ React65.createElement(SizeSection, null)), /* @__PURE__ */ React65.createElement(Section, { title: (0, import_i18n43.__)("Position", "elementor") }, /* @__PURE__ */ React65.createElement(PositionSection, null)), /* @__PURE__ */ React65.createElement(Section, { title: (0, import_i18n43.__)("Typography", "elementor") }, /* @__PURE__ */ React65.createElement(TypographySection, null)), /* @__PURE__ */ React65.createElement(Section, { title: (0, import_i18n43.__)("Background", "elementor") }, /* @__PURE__ */ React65.createElement(BackgroundSection, null)), /* @__PURE__ */ React65.createElement(Section, { title: (0, import_i18n43.__)("Border", "elementor") }, /* @__PURE__ */ React65.createElement(BorderSection, null)), /* @__PURE__ */ React65.createElement(Section, { title: (0, import_i18n43.__)("Effects", "elementor") }, /* @__PURE__ */ React65.createElement(EffectsSection, null)))))
|
|
2696
2806
|
));
|
|
2697
2807
|
};
|
|
2698
|
-
function useActiveStyleDefId(currentClassesProp) {
|
|
2699
|
-
const [activeStyledDefId, setActiveStyledDefId] = (0, import_react16.useState)(null);
|
|
2700
|
-
const fallback = useFirstElementStyleDef(currentClassesProp);
|
|
2701
|
-
return [activeStyledDefId || fallback?.id || null, setActiveStyledDefId];
|
|
2702
|
-
}
|
|
2703
|
-
function useFirstElementStyleDef(currentClassesProp) {
|
|
2704
|
-
const { element } = useElement();
|
|
2705
|
-
const classesIds = (0, import_editor_elements7.useElementSetting)(element.id, currentClassesProp)?.value || [];
|
|
2706
|
-
const stylesDefs = (0, import_editor_elements7.getElementStyles)(element.id) ?? {};
|
|
2707
|
-
return Object.values(stylesDefs).find((styleDef) => classesIds.includes(styleDef.id));
|
|
2708
|
-
}
|
|
2709
2808
|
function useCurrentClassesProp() {
|
|
2710
2809
|
const { elementType } = useElement();
|
|
2711
2810
|
const prop = Object.entries(elementType.propsSchema).find(
|
|
2712
|
-
([, propType]) => propType.kind === "plain" && propType.key ===
|
|
2811
|
+
([, propType]) => propType.kind === "plain" && propType.key === import_editor_props7.CLASSES_PROP_KEY
|
|
2713
2812
|
);
|
|
2714
2813
|
if (!prop) {
|
|
2715
2814
|
throw new Error("Element does not have a classes prop");
|
|
@@ -2724,19 +2823,7 @@ var EditingPanelTabs = () => {
|
|
|
2724
2823
|
return (
|
|
2725
2824
|
// When switching between elements, the local states should be reset. We are using key to rerender the tabs.
|
|
2726
2825
|
// Reference: https://react.dev/learn/preserving-and-resetting-state#resetting-a-form-with-a-key
|
|
2727
|
-
/* @__PURE__ */ React66.createElement(
|
|
2728
|
-
import_ui51.Tabs,
|
|
2729
|
-
{
|
|
2730
|
-
variant: "fullWidth",
|
|
2731
|
-
indicatorColor: "secondary",
|
|
2732
|
-
textColor: "inherit",
|
|
2733
|
-
size: "small",
|
|
2734
|
-
sx: { mt: 0.5 },
|
|
2735
|
-
...getTabsProps()
|
|
2736
|
-
},
|
|
2737
|
-
/* @__PURE__ */ React66.createElement(import_ui51.Tab, { label: (0, import_i18n44.__)("General", "elementor"), ...getTabProps("settings") }),
|
|
2738
|
-
/* @__PURE__ */ React66.createElement(import_ui51.Tab, { label: (0, import_i18n44.__)("Style", "elementor"), ...getTabProps("style") })
|
|
2739
|
-
), /* @__PURE__ */ React66.createElement(import_ui51.Divider, null), /* @__PURE__ */ React66.createElement(import_ui51.TabPanel, { ...getTabPanelProps("settings"), disablePadding: true }, /* @__PURE__ */ React66.createElement(SettingsTab, null)), /* @__PURE__ */ React66.createElement(import_ui51.TabPanel, { ...getTabPanelProps("style"), disablePadding: true }, /* @__PURE__ */ React66.createElement(StyleTab, null))))
|
|
2826
|
+
/* @__PURE__ */ React66.createElement(import_react18.Fragment, { key: element.id }, /* @__PURE__ */ React66.createElement(import_ui51.Stack, { direction: "column", sx: { width: "100%" } }, /* @__PURE__ */ React66.createElement(import_ui51.Tabs, { variant: "fullWidth", size: "small", sx: { mt: 0.5 }, ...getTabsProps() }, /* @__PURE__ */ React66.createElement(import_ui51.Tab, { label: (0, import_i18n44.__)("General", "elementor"), ...getTabProps("settings") }), /* @__PURE__ */ React66.createElement(import_ui51.Tab, { label: (0, import_i18n44.__)("Style", "elementor"), ...getTabProps("style") })), /* @__PURE__ */ React66.createElement(import_ui51.Divider, null), /* @__PURE__ */ React66.createElement(import_ui51.TabPanel, { ...getTabPanelProps("settings"), disablePadding: true }, /* @__PURE__ */ React66.createElement(SettingsTab, null)), /* @__PURE__ */ React66.createElement(import_ui51.TabPanel, { ...getTabPanelProps("style"), disablePadding: true }, /* @__PURE__ */ React66.createElement(StyleTab, null))))
|
|
2740
2827
|
);
|
|
2741
2828
|
};
|
|
2742
2829
|
|
|
@@ -2766,7 +2853,7 @@ var import_editor_panels3 = require("@elementor/editor-panels");
|
|
|
2766
2853
|
var import_editor_v1_adapters4 = require("@elementor/editor-v1-adapters");
|
|
2767
2854
|
|
|
2768
2855
|
// src/hooks/use-open-editor-panel.ts
|
|
2769
|
-
var
|
|
2856
|
+
var import_react19 = require("react");
|
|
2770
2857
|
var import_editor_v1_adapters3 = require("@elementor/editor-v1-adapters");
|
|
2771
2858
|
|
|
2772
2859
|
// src/sync/is-atomic-widget-selected.ts
|
|
@@ -2783,7 +2870,7 @@ var isAtomicWidgetSelected = () => {
|
|
|
2783
2870
|
// src/hooks/use-open-editor-panel.ts
|
|
2784
2871
|
var useOpenEditorPanel = () => {
|
|
2785
2872
|
const { open } = usePanelActions();
|
|
2786
|
-
(0,
|
|
2873
|
+
(0, import_react19.useEffect)(() => {
|
|
2787
2874
|
return (0, import_editor_v1_adapters3.__privateListenTo)((0, import_editor_v1_adapters3.commandStartEvent)("panel/editor/open"), () => {
|
|
2788
2875
|
if (isAtomicWidgetSelected()) {
|
|
2789
2876
|
open();
|
|
@@ -2798,9 +2885,12 @@ var EditingPanelHooks = () => {
|
|
|
2798
2885
|
return null;
|
|
2799
2886
|
};
|
|
2800
2887
|
|
|
2888
|
+
// src/dynamics/init.ts
|
|
2889
|
+
var import_editor_canvas2 = require("@elementor/editor-canvas");
|
|
2890
|
+
|
|
2801
2891
|
// src/dynamics/components/dynamic-selection-control.tsx
|
|
2802
2892
|
var React71 = __toESM(require("react"));
|
|
2803
|
-
var
|
|
2893
|
+
var import_react23 = require("react");
|
|
2804
2894
|
var import_editor_controls48 = require("@elementor/editor-controls");
|
|
2805
2895
|
var import_icons25 = require("@elementor/icons");
|
|
2806
2896
|
var import_ui55 = require("@elementor/ui");
|
|
@@ -2824,10 +2914,10 @@ var React69 = __toESM(require("react"));
|
|
|
2824
2914
|
var import_editor_controls46 = require("@elementor/editor-controls");
|
|
2825
2915
|
|
|
2826
2916
|
// src/dynamics/hooks/use-dynamic-tag.ts
|
|
2827
|
-
var
|
|
2917
|
+
var import_react21 = require("react");
|
|
2828
2918
|
|
|
2829
2919
|
// src/dynamics/hooks/use-prop-dynamic-tags.ts
|
|
2830
|
-
var
|
|
2920
|
+
var import_react20 = require("react");
|
|
2831
2921
|
var import_editor_controls45 = require("@elementor/editor-controls");
|
|
2832
2922
|
|
|
2833
2923
|
// src/dynamics/sync/get-elementor-config.ts
|
|
@@ -2849,7 +2939,7 @@ var getAtomicDynamicTags = () => {
|
|
|
2849
2939
|
};
|
|
2850
2940
|
|
|
2851
2941
|
// src/dynamics/utils.ts
|
|
2852
|
-
var
|
|
2942
|
+
var import_editor_props8 = require("@elementor/editor-props");
|
|
2853
2943
|
var import_schema = require("@elementor/schema");
|
|
2854
2944
|
var DYNAMIC_PROP_TYPE_KEY = "dynamic";
|
|
2855
2945
|
var isDynamicPropType = (prop) => prop.key === DYNAMIC_PROP_TYPE_KEY;
|
|
@@ -2858,12 +2948,12 @@ var getDynamicPropType = (propType) => {
|
|
|
2858
2948
|
return dynamicPropType && isDynamicPropType(dynamicPropType) ? dynamicPropType : null;
|
|
2859
2949
|
};
|
|
2860
2950
|
var isDynamicPropValue = (prop) => {
|
|
2861
|
-
return (0,
|
|
2951
|
+
return (0, import_editor_props8.isTransformable)(prop) && prop.$$type === DYNAMIC_PROP_TYPE_KEY;
|
|
2862
2952
|
};
|
|
2863
2953
|
var supportsDynamic = (propType) => {
|
|
2864
2954
|
return !!getDynamicPropType(propType);
|
|
2865
2955
|
};
|
|
2866
|
-
var dynamicPropTypeUtil = (0,
|
|
2956
|
+
var dynamicPropTypeUtil = (0, import_editor_props8.createPropUtils)(
|
|
2867
2957
|
DYNAMIC_PROP_TYPE_KEY,
|
|
2868
2958
|
import_schema.z.strictObject({
|
|
2869
2959
|
name: import_schema.z.string(),
|
|
@@ -2879,7 +2969,7 @@ var usePropDynamicTags = () => {
|
|
|
2879
2969
|
const propDynamicType = getDynamicPropType(propType);
|
|
2880
2970
|
categories = propDynamicType?.settings.categories || [];
|
|
2881
2971
|
}
|
|
2882
|
-
return (0,
|
|
2972
|
+
return (0, import_react20.useMemo)(() => getDynamicTagsByCategories(categories), [categories.join()]);
|
|
2883
2973
|
};
|
|
2884
2974
|
var getDynamicTagsByCategories = (categories) => {
|
|
2885
2975
|
const dynamicTags = getAtomicDynamicTags();
|
|
@@ -2895,7 +2985,7 @@ var getDynamicTagsByCategories = (categories) => {
|
|
|
2895
2985
|
// src/dynamics/hooks/use-dynamic-tag.ts
|
|
2896
2986
|
var useDynamicTag = (tagName) => {
|
|
2897
2987
|
const dynamicTags = usePropDynamicTags();
|
|
2898
|
-
return (0,
|
|
2988
|
+
return (0, import_react21.useMemo)(() => dynamicTags.find((tag) => tag.name === tagName) ?? null, [dynamicTags, tagName]);
|
|
2899
2989
|
};
|
|
2900
2990
|
|
|
2901
2991
|
// src/dynamics/dynamic-control.tsx
|
|
@@ -2924,14 +3014,14 @@ var DynamicControl = ({ bind, children }) => {
|
|
|
2924
3014
|
|
|
2925
3015
|
// src/dynamics/components/dynamic-selection.tsx
|
|
2926
3016
|
var React70 = __toESM(require("react"));
|
|
2927
|
-
var
|
|
3017
|
+
var import_react22 = require("react");
|
|
2928
3018
|
var import_editor_controls47 = require("@elementor/editor-controls");
|
|
2929
3019
|
var import_icons24 = require("@elementor/icons");
|
|
2930
3020
|
var import_ui54 = require("@elementor/ui");
|
|
2931
3021
|
var import_i18n46 = require("@wordpress/i18n");
|
|
2932
3022
|
var SIZE3 = "tiny";
|
|
2933
3023
|
var DynamicSelection = ({ onSelect }) => {
|
|
2934
|
-
const [searchValue, setSearchValue] = (0,
|
|
3024
|
+
const [searchValue, setSearchValue] = (0, import_react22.useState)("");
|
|
2935
3025
|
const { groups: dynamicGroups } = getAtomicDynamicTags() || {};
|
|
2936
3026
|
const { value: anyValue } = (0, import_editor_controls47.useBoundProp)();
|
|
2937
3027
|
const { bind, value: dynamicValue, setValue } = (0, import_editor_controls47.useBoundProp)(dynamicPropTypeUtil);
|
|
@@ -2949,7 +3039,7 @@ var DynamicSelection = ({ onSelect }) => {
|
|
|
2949
3039
|
setValue({ name: value, settings: { label } });
|
|
2950
3040
|
onSelect?.();
|
|
2951
3041
|
};
|
|
2952
|
-
return /* @__PURE__ */ React70.createElement(import_ui54.Stack, null, hasNoDynamicTags ? /* @__PURE__ */ React70.createElement(NoDynamicTags, null) : /* @__PURE__ */ React70.createElement(
|
|
3042
|
+
return /* @__PURE__ */ React70.createElement(import_ui54.Stack, null, hasNoDynamicTags ? /* @__PURE__ */ React70.createElement(NoDynamicTags, null) : /* @__PURE__ */ React70.createElement(import_react22.Fragment, null, /* @__PURE__ */ React70.createElement(import_ui54.Box, { px: 1.5, pb: 1 }, /* @__PURE__ */ React70.createElement(
|
|
2953
3043
|
import_ui54.TextField,
|
|
2954
3044
|
{
|
|
2955
3045
|
fullWidth: true,
|
|
@@ -2961,7 +3051,7 @@ var DynamicSelection = ({ onSelect }) => {
|
|
|
2961
3051
|
startAdornment: /* @__PURE__ */ React70.createElement(import_ui54.InputAdornment, { position: "start" }, /* @__PURE__ */ React70.createElement(import_icons24.SearchIcon, { fontSize: SIZE3 }))
|
|
2962
3052
|
}
|
|
2963
3053
|
}
|
|
2964
|
-
)), /* @__PURE__ */ React70.createElement(import_ui54.Divider, null), /* @__PURE__ */ React70.createElement(import_ui54.Box, { sx: { overflowY: "auto", height: 260, width: 220 } }, options13.length > 0 ? /* @__PURE__ */ React70.createElement(import_ui54.MenuList, { role: "listbox", tabIndex: 0 }, options13.map(([category, items3], index) => /* @__PURE__ */ React70.createElement(
|
|
3054
|
+
)), /* @__PURE__ */ React70.createElement(import_ui54.Divider, null), /* @__PURE__ */ React70.createElement(import_ui54.Box, { sx: { overflowY: "auto", height: 260, width: 220 } }, options13.length > 0 ? /* @__PURE__ */ React70.createElement(import_ui54.MenuList, { role: "listbox", tabIndex: 0 }, options13.map(([category, items3], index) => /* @__PURE__ */ React70.createElement(import_react22.Fragment, { key: index }, /* @__PURE__ */ React70.createElement(
|
|
2965
3055
|
import_ui54.MenuSubheader,
|
|
2966
3056
|
{
|
|
2967
3057
|
sx: { px: 1.5, typography: "caption", color: "text.tertiary" }
|
|
@@ -3035,7 +3125,7 @@ var DynamicSelectionControl = () => {
|
|
|
3035
3125
|
const { bind, value } = (0, import_editor_controls48.useBoundProp)(dynamicPropTypeUtil);
|
|
3036
3126
|
const [propValueFromHistory] = usePersistDynamicValue(bind);
|
|
3037
3127
|
const { name: tagName = "" } = value;
|
|
3038
|
-
const selectionPopoverId = (0,
|
|
3128
|
+
const selectionPopoverId = (0, import_react23.useId)();
|
|
3039
3129
|
const selectionPopoverState = (0, import_ui55.usePopupState)({ variant: "popover", popupId: selectionPopoverId });
|
|
3040
3130
|
const dynamicTag = useDynamicTag(tagName);
|
|
3041
3131
|
const removeDynamicTag = () => {
|
|
@@ -3074,7 +3164,7 @@ var DynamicSelectionControl = () => {
|
|
|
3074
3164
|
));
|
|
3075
3165
|
};
|
|
3076
3166
|
var DynamicSettingsPopover = ({ dynamicTag }) => {
|
|
3077
|
-
const popupId = (0,
|
|
3167
|
+
const popupId = (0, import_react23.useId)();
|
|
3078
3168
|
const settingsPopupState = (0, import_ui55.usePopupState)({ variant: "popover", popupId });
|
|
3079
3169
|
const hasDynamicSettings = !!dynamicTag.atomic_controls.length;
|
|
3080
3170
|
if (!hasDynamicSettings) {
|
|
@@ -3120,6 +3210,55 @@ var Control3 = ({ control }) => {
|
|
|
3120
3210
|
return /* @__PURE__ */ React71.createElement(DynamicControl, { bind: control.bind }, /* @__PURE__ */ React71.createElement(import_ui55.Grid, { container: true, gap: 0.75 }, control.label ? /* @__PURE__ */ React71.createElement(import_ui55.Grid, { item: true, xs: 12 }, /* @__PURE__ */ React71.createElement(import_editor_controls48.ControlFormLabel, null, control.label)) : null, /* @__PURE__ */ React71.createElement(import_ui55.Grid, { item: true, xs: 12 }, /* @__PURE__ */ React71.createElement(Control, { type: control.type, props: control.props }))));
|
|
3121
3211
|
};
|
|
3122
3212
|
|
|
3213
|
+
// src/dynamics/dynamic-transformer.ts
|
|
3214
|
+
var import_editor_canvas = require("@elementor/editor-canvas");
|
|
3215
|
+
var import_editor_props9 = require("@elementor/editor-props");
|
|
3216
|
+
|
|
3217
|
+
// src/dynamics/errors.ts
|
|
3218
|
+
var import_utils8 = require("@elementor/utils");
|
|
3219
|
+
var DynamicTagsManagerNotFoundError = (0, import_utils8.createError)({
|
|
3220
|
+
code: "dynamic_tags_manager_not_found",
|
|
3221
|
+
message: "Dynamic tags manager not found"
|
|
3222
|
+
});
|
|
3223
|
+
|
|
3224
|
+
// src/dynamics/dynamic-transformer.ts
|
|
3225
|
+
var dynamicTransformer = (0, import_editor_canvas.createTransformer)((value) => {
|
|
3226
|
+
if (!value.name) {
|
|
3227
|
+
return null;
|
|
3228
|
+
}
|
|
3229
|
+
return getDynamicValue(value.name, simpleTransform(value.settings ?? {}));
|
|
3230
|
+
});
|
|
3231
|
+
function simpleTransform(props) {
|
|
3232
|
+
const transformed = Object.entries(props).map(([settingKey, settingValue]) => {
|
|
3233
|
+
const value = (0, import_editor_props9.isTransformable)(settingValue) ? settingValue.value : settingValue;
|
|
3234
|
+
return [settingKey, value];
|
|
3235
|
+
});
|
|
3236
|
+
return Object.fromEntries(transformed);
|
|
3237
|
+
}
|
|
3238
|
+
function getDynamicValue(name, settings) {
|
|
3239
|
+
const extendedWindow = window;
|
|
3240
|
+
const { dynamicTags } = extendedWindow.elementor ?? {};
|
|
3241
|
+
if (!dynamicTags) {
|
|
3242
|
+
throw new DynamicTagsManagerNotFoundError();
|
|
3243
|
+
}
|
|
3244
|
+
const getTagValue = () => {
|
|
3245
|
+
const tag = dynamicTags.createTag("v4-dynamic-tag", name, settings);
|
|
3246
|
+
if (!tag) {
|
|
3247
|
+
return null;
|
|
3248
|
+
}
|
|
3249
|
+
return dynamicTags.loadTagDataFromCache(tag) ?? null;
|
|
3250
|
+
};
|
|
3251
|
+
const tagValue = getTagValue();
|
|
3252
|
+
if (tagValue !== null) {
|
|
3253
|
+
return tagValue;
|
|
3254
|
+
}
|
|
3255
|
+
return new Promise((resolve) => {
|
|
3256
|
+
dynamicTags.refreshCacheFromServer(() => {
|
|
3257
|
+
resolve(getTagValue());
|
|
3258
|
+
});
|
|
3259
|
+
});
|
|
3260
|
+
}
|
|
3261
|
+
|
|
3123
3262
|
// src/dynamics/hooks/use-prop-dynamic-action.tsx
|
|
3124
3263
|
var React72 = __toESM(require("react"));
|
|
3125
3264
|
var import_editor_controls49 = require("@elementor/editor-controls");
|
|
@@ -3147,6 +3286,8 @@ var init = () => {
|
|
|
3147
3286
|
id: "dynamic-tags",
|
|
3148
3287
|
useProps: usePropDynamicAction
|
|
3149
3288
|
});
|
|
3289
|
+
import_editor_canvas2.styleTransformersRegistry.register("dynamic", dynamicTransformer);
|
|
3290
|
+
import_editor_canvas2.settingsTransformersRegistry.register("dynamic", dynamicTransformer);
|
|
3150
3291
|
};
|
|
3151
3292
|
|
|
3152
3293
|
// src/init.ts
|
|
@@ -3169,11 +3310,9 @@ var blockV1Panel = () => {
|
|
|
3169
3310
|
condition: isAtomicWidgetSelected
|
|
3170
3311
|
});
|
|
3171
3312
|
};
|
|
3172
|
-
|
|
3173
|
-
// src/index.ts
|
|
3174
|
-
init2();
|
|
3175
3313
|
// Annotate the CommonJS export names for ESM import in node:
|
|
3176
3314
|
0 && (module.exports = {
|
|
3315
|
+
init,
|
|
3177
3316
|
injectIntoClassSelectorActions,
|
|
3178
3317
|
replaceControl,
|
|
3179
3318
|
useBoundProp,
|