@elementor/editor-interactions 4.0.0-650 → 4.0.0-659
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.mts +14 -4
- package/dist/index.d.ts +14 -4
- package/dist/index.js +46 -0
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +46 -0
- package/dist/index.mjs.map +1 -1
- package/package.json +11 -11
- package/src/components/interaction-details.tsx +53 -1
- package/src/interactions-controls-registry.ts +14 -2
- package/src/types.ts +2 -0
- package/src/utils/prop-value-utils.ts +29 -10
package/dist/index.mjs
CHANGED
|
@@ -211,6 +211,8 @@ var createConfig = ({
|
|
|
211
211
|
replay,
|
|
212
212
|
easing = "easeIn",
|
|
213
213
|
relativeTo = "",
|
|
214
|
+
repeat = "",
|
|
215
|
+
times = 1,
|
|
214
216
|
start = 85,
|
|
215
217
|
end = 15
|
|
216
218
|
}) => ({
|
|
@@ -219,6 +221,8 @@ var createConfig = ({
|
|
|
219
221
|
replay: createBoolean(replay),
|
|
220
222
|
easing: createString(easing),
|
|
221
223
|
relativeTo: createString(relativeTo),
|
|
224
|
+
repeat: createString(repeat),
|
|
225
|
+
times: createNumber(times),
|
|
222
226
|
start: createSize(start, "%"),
|
|
223
227
|
end: createSize(end, "%")
|
|
224
228
|
}
|
|
@@ -254,6 +258,8 @@ var createAnimationPreset = ({
|
|
|
254
258
|
replay = false,
|
|
255
259
|
easing = "easeIn",
|
|
256
260
|
relativeTo,
|
|
261
|
+
repeat,
|
|
262
|
+
times,
|
|
257
263
|
start,
|
|
258
264
|
end,
|
|
259
265
|
customEffects
|
|
@@ -269,6 +275,8 @@ var createAnimationPreset = ({
|
|
|
269
275
|
replay,
|
|
270
276
|
easing,
|
|
271
277
|
relativeTo,
|
|
278
|
+
repeat,
|
|
279
|
+
times,
|
|
272
280
|
start,
|
|
273
281
|
end
|
|
274
282
|
})
|
|
@@ -285,6 +293,8 @@ var createInteractionItem = ({
|
|
|
285
293
|
replay = false,
|
|
286
294
|
easing = "easeIn",
|
|
287
295
|
relativeTo,
|
|
296
|
+
repeat,
|
|
297
|
+
times,
|
|
288
298
|
start,
|
|
289
299
|
end,
|
|
290
300
|
excludedBreakpoints,
|
|
@@ -303,6 +313,8 @@ var createInteractionItem = ({
|
|
|
303
313
|
replay,
|
|
304
314
|
easing,
|
|
305
315
|
relativeTo,
|
|
316
|
+
repeat,
|
|
317
|
+
times,
|
|
306
318
|
start,
|
|
307
319
|
end,
|
|
308
320
|
customEffects
|
|
@@ -475,6 +487,8 @@ var DEFAULT_VALUES = {
|
|
|
475
487
|
replay: false,
|
|
476
488
|
easing: "easeIn",
|
|
477
489
|
relativeTo: "viewport",
|
|
490
|
+
repeat: "",
|
|
491
|
+
times: 1,
|
|
478
492
|
start: 85,
|
|
479
493
|
end: 15
|
|
480
494
|
};
|
|
@@ -487,6 +501,8 @@ var controlVisibilityConfig = {
|
|
|
487
501
|
relativeTo: (values) => values.trigger === "scrollOn",
|
|
488
502
|
start: (values) => values.trigger === "scrollOn",
|
|
489
503
|
end: (values) => values.trigger === "scrollOn",
|
|
504
|
+
repeat: (values) => values.trigger !== "scrollOn",
|
|
505
|
+
times: (values) => values.trigger !== "scrollOn" && values.repeat === "times",
|
|
490
506
|
duration: (values) => {
|
|
491
507
|
const isRelativeToVisible = values.trigger === "scrollOn";
|
|
492
508
|
return !isRelativeToVisible;
|
|
@@ -496,6 +512,13 @@ var controlVisibilityConfig = {
|
|
|
496
512
|
return !isRelativeToVisible;
|
|
497
513
|
}
|
|
498
514
|
};
|
|
515
|
+
function normalizeTimesValue(value, fallback) {
|
|
516
|
+
const numericValue = Number(value);
|
|
517
|
+
if (!Number.isFinite(numericValue)) {
|
|
518
|
+
return fallback;
|
|
519
|
+
}
|
|
520
|
+
return Math.max(1, Math.floor(numericValue));
|
|
521
|
+
}
|
|
499
522
|
function useControlComponent(controlName, isVisible = true) {
|
|
500
523
|
return useMemo(() => {
|
|
501
524
|
if (!isVisible) {
|
|
@@ -515,6 +538,9 @@ var InteractionDetails = ({ interaction, onChange, onPlayInteraction }) => {
|
|
|
515
538
|
const replay = extractBoolean(interaction.animation.value.config?.value.replay, DEFAULT_VALUES.replay);
|
|
516
539
|
const easing = extractString(interaction.animation.value.config?.value.easing, DEFAULT_VALUES.easing);
|
|
517
540
|
const relativeTo = extractString(interaction.animation.value.config?.value.relativeTo, DEFAULT_VALUES.relativeTo);
|
|
541
|
+
const configValue = interaction.animation.value.config?.value;
|
|
542
|
+
const repeat = extractString(configValue?.repeat, DEFAULT_VALUES.repeat);
|
|
543
|
+
const times = normalizeTimesValue(configValue?.times?.value, DEFAULT_VALUES.times);
|
|
518
544
|
const start = extractSize(interaction.animation.value.config?.value.start, DEFAULT_VALUES.start);
|
|
519
545
|
const end = extractSize(interaction.animation.value.config?.value.end, DEFAULT_VALUES.end);
|
|
520
546
|
const interactionValues = {
|
|
@@ -527,6 +553,8 @@ var InteractionDetails = ({ interaction, onChange, onPlayInteraction }) => {
|
|
|
527
553
|
easing,
|
|
528
554
|
replay,
|
|
529
555
|
relativeTo,
|
|
556
|
+
repeat,
|
|
557
|
+
times,
|
|
530
558
|
start,
|
|
531
559
|
end,
|
|
532
560
|
customEffects
|
|
@@ -549,6 +577,14 @@ var InteractionDetails = ({ interaction, onChange, onPlayInteraction }) => {
|
|
|
549
577
|
controlVisibilityConfig.effectType(interactionValues)
|
|
550
578
|
);
|
|
551
579
|
const DirectionControl = useControlComponent("direction", controlVisibilityConfig.direction(interactionValues));
|
|
580
|
+
const RepeatControl = useControlComponent(
|
|
581
|
+
"repeat",
|
|
582
|
+
controlVisibilityConfig.repeat(interactionValues)
|
|
583
|
+
);
|
|
584
|
+
const TimesControl = useControlComponent(
|
|
585
|
+
"times",
|
|
586
|
+
controlVisibilityConfig.times(interactionValues)
|
|
587
|
+
);
|
|
552
588
|
const EasingControl = useControlComponent("easing");
|
|
553
589
|
const containerRef = useRef2(null);
|
|
554
590
|
const updateInteraction = (updates) => {
|
|
@@ -572,6 +608,8 @@ var InteractionDetails = ({ interaction, onChange, onPlayInteraction }) => {
|
|
|
572
608
|
replay: updates.replay ?? replay,
|
|
573
609
|
easing: updates.easing ?? easing,
|
|
574
610
|
relativeTo: updates.relativeTo ?? relativeTo,
|
|
611
|
+
repeat: updates.repeat ?? repeat,
|
|
612
|
+
times: updates.times ?? times,
|
|
575
613
|
start: updates.start ?? start,
|
|
576
614
|
end: updates.end ?? end,
|
|
577
615
|
customEffects: updates.customEffects ?? customEffects
|
|
@@ -610,6 +648,14 @@ var InteractionDetails = ({ interaction, onChange, onPlayInteraction }) => {
|
|
|
610
648
|
onChange: (v) => updateInteraction({ direction: v }),
|
|
611
649
|
interactionType: type
|
|
612
650
|
}
|
|
651
|
+
)), RepeatControl && /* @__PURE__ */ React7.createElement(Field, { label: __2("Repeat", "elementor") }, /* @__PURE__ */ React7.createElement(RepeatControl, { value: repeat, onChange: (v) => updateInteraction({ repeat: v }) })), TimesControl && /* @__PURE__ */ React7.createElement(Field, { label: __2("Times", "elementor") }, /* @__PURE__ */ React7.createElement(
|
|
652
|
+
TimesControl,
|
|
653
|
+
{
|
|
654
|
+
value: times,
|
|
655
|
+
onChange: (v) => updateInteraction({
|
|
656
|
+
times: normalizeTimesValue(v, DEFAULT_VALUES.times)
|
|
657
|
+
})
|
|
658
|
+
}
|
|
613
659
|
)), controlVisibilityConfig.duration(interactionValues) && /* @__PURE__ */ React7.createElement(Field, { label: __2("Duration", "elementor") }, /* @__PURE__ */ React7.createElement(
|
|
614
660
|
TimeFrameIndicator,
|
|
615
661
|
{
|