@schukai/monster 3.112.4 → 3.113.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 +13 -0
- package/package.json +1 -1
- package/source/components/layout/slider.mjs +93 -14
- package/source/components/time/day.mjs +318 -302
- package/source/components/time/stylesheet/day.mjs +13 -6
- package/source/monster.mjs +1 -0
- package/source/types/version.mjs +1 -1
- package/test/cases/monster.mjs +1 -1
- package/test/web/test.html +2 -2
- package/test/web/tests.js +7 -6
package/CHANGELOG.md
CHANGED
@@ -2,6 +2,19 @@
|
|
2
2
|
|
3
3
|
|
4
4
|
|
5
|
+
## [3.113.0] - 2025-03-20
|
6
|
+
|
7
|
+
### Add Features
|
8
|
+
|
9
|
+
- new resizeobserver for slider [#301](https://gitlab.schukai.com/oss/libraries/javascript/monster/issues/301)
|
10
|
+
- [#301](https://gitlab.schukai.com/oss/libraries/javascript/monster/issues/301) Dateien für issue angelegt
|
11
|
+
- [#301](https://gitlab.schukai.com/oss/libraries/javascript/monster/issues/301) breakpoints monster-slider
|
12
|
+
### Changes
|
13
|
+
|
14
|
+
- update project
|
15
|
+
|
16
|
+
|
17
|
+
|
5
18
|
## [3.112.4] - 2025-03-12
|
6
19
|
|
7
20
|
### Bug Fixes
|
package/package.json
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"author":"schukai GmbH","dependencies":{"@floating-ui/dom":"^1.6.13","@popperjs/core":"^2.11.8","buffer":"^6.0.3"},"description":"Monster is a simple library for creating fast, robust and lightweight websites.","homepage":"https://monsterjs.org/","keywords":["framework","web","dom","css","sass","mobile-first","app","front-end","templates","schukai","core","shopcloud","alvine","monster","buildmap","stack","observer","observable","uuid","node","nodelist","css-in-js","logger","log","theme"],"license":"AGPL 3.0","main":"source/monster.mjs","module":"source/monster.mjs","name":"@schukai/monster","repository":{"type":"git","url":"https://gitlab.schukai.com/oss/libraries/javascript/monster.git"},"type":"module","version":"3.
|
1
|
+
{"author":"schukai GmbH","dependencies":{"@floating-ui/dom":"^1.6.13","@popperjs/core":"^2.11.8","buffer":"^6.0.3"},"description":"Monster is a simple library for creating fast, robust and lightweight websites.","homepage":"https://monsterjs.org/","keywords":["framework","web","dom","css","sass","mobile-first","app","front-end","templates","schukai","core","shopcloud","alvine","monster","buildmap","stack","observer","observable","uuid","node","nodelist","css-in-js","logger","log","theme"],"license":"AGPL 3.0","main":"source/monster.mjs","module":"source/monster.mjs","name":"@schukai/monster","repository":{"type":"git","url":"https://gitlab.schukai.com/oss/libraries/javascript/monster.git"},"type":"module","version":"3.113.0"}
|
@@ -73,6 +73,8 @@ const configSymbol = Symbol("config");
|
|
73
73
|
* @since 3.74.0
|
74
74
|
* @copyright schukai GmbH
|
75
75
|
* @summary A beautiful Slider that can make your life easier and also looks good.
|
76
|
+
* @fires monster-slider-resized
|
77
|
+
* @fires monster-slider-moved
|
76
78
|
*/
|
77
79
|
class Slider extends CustomElement {
|
78
80
|
/**
|
@@ -97,12 +99,21 @@ class Slider extends CustomElement {
|
|
97
99
|
draggingPos: 0,
|
98
100
|
startPos: 0,
|
99
101
|
autoPlayInterval: null,
|
102
|
+
|
103
|
+
eventHandler: {
|
104
|
+
mouseOverPause: null,
|
105
|
+
mouseout: null,
|
106
|
+
touchstart : null,
|
107
|
+
touchend: null
|
108
|
+
}
|
109
|
+
|
100
110
|
};
|
101
111
|
|
102
112
|
// set --monster-slides-width
|
103
113
|
const slides = this.shadowRoot.querySelector(
|
104
114
|
`[${ATTRIBUTE_ROLE}="slider"]`,
|
105
115
|
);
|
116
|
+
|
106
117
|
const slidesVisible = getVisibleSlidesFromContainerWidth.call(this);
|
107
118
|
slides.style.setProperty(
|
108
119
|
"--monster-slides-width",
|
@@ -283,6 +294,11 @@ function initThumbnails() {
|
|
283
294
|
"[data-monster-role='thumbnails']",
|
284
295
|
);
|
285
296
|
|
297
|
+
// remove all thumbnails
|
298
|
+
while (thumbnails.firstChild) {
|
299
|
+
thumbnails.removeChild(thumbnails.firstChild);
|
300
|
+
}
|
301
|
+
|
286
302
|
const { originSlides } = getSlidesAndTotal.call(this);
|
287
303
|
|
288
304
|
originSlides.forEach((x, index) => {
|
@@ -354,26 +370,49 @@ function initAutoPlay() {
|
|
354
370
|
}, startDelay);
|
355
371
|
|
356
372
|
if (autoPlay.mouseOverPause) {
|
357
|
-
this.addEventListener("mouseover", () => {
|
358
|
-
clearInterval(this[configSymbol].autoPlayInterval);
|
359
|
-
});
|
360
373
|
|
361
|
-
this.
|
362
|
-
|
363
|
-
|
374
|
+
if(this[configSymbol].eventHandler.mouseOverPause===null) {
|
375
|
+
this[configSymbol].eventHandler.mouseOverPause = () => {
|
376
|
+
clearInterval(this[configSymbol].autoPlayInterval);
|
364
377
|
}
|
365
|
-
|
366
|
-
|
378
|
+
|
379
|
+
this.addEventListener("mouseover",this[configSymbol].eventHandler.mouseOverPause);
|
380
|
+
}
|
381
|
+
|
382
|
+
if(this[configSymbol].eventHandler.mouseout===null) {
|
383
|
+
|
384
|
+
this[configSymbol].eventHandler.mouseout = () => {
|
385
|
+
if (this[configSymbol].isDragging) {
|
386
|
+
return;
|
387
|
+
}
|
388
|
+
start();
|
389
|
+
}
|
390
|
+
|
391
|
+
this.addEventListener("mouseout", this[configSymbol].eventHandler.mouseout);
|
392
|
+
}
|
393
|
+
|
367
394
|
}
|
368
395
|
|
369
396
|
if (autoPlay.touchPause) {
|
370
|
-
this.
|
371
|
-
|
372
|
-
|
397
|
+
if(this[configSymbol].eventHandler.touchstart===null) {
|
398
|
+
this[configSymbol].eventHandler.touchstart = () => {
|
399
|
+
clearInterval(this[configSymbol].autoPlayInterval);
|
400
|
+
}
|
373
401
|
|
374
|
-
|
375
|
-
|
376
|
-
|
402
|
+
this.addEventListener("touchstart",this[configSymbol].eventHandler.touchstart);
|
403
|
+
}
|
404
|
+
|
405
|
+
if(this[configSymbol].eventHandler.touchend===null) {
|
406
|
+
|
407
|
+
this[configSymbol].eventHandler.touchend = () => {
|
408
|
+
if (this[configSymbol].isDragging) {
|
409
|
+
return;
|
410
|
+
}
|
411
|
+
start();
|
412
|
+
}
|
413
|
+
|
414
|
+
this.addEventListener("touchend", this[configSymbol].eventHandler.touchend);
|
415
|
+
}
|
377
416
|
}
|
378
417
|
}
|
379
418
|
|
@@ -602,6 +641,7 @@ function moveTo(index, animation) {
|
|
602
641
|
/**
|
603
642
|
* @private
|
604
643
|
* @return {initEventHandler}
|
644
|
+
* @fires monster-slider-resized
|
605
645
|
*/
|
606
646
|
function initEventHandler() {
|
607
647
|
const self = this;
|
@@ -632,6 +672,44 @@ function initEventHandler() {
|
|
632
672
|
);
|
633
673
|
}
|
634
674
|
|
675
|
+
|
676
|
+
const initialSize = {
|
677
|
+
width: this[sliderElementSymbol]?.offsetWidth || 0,
|
678
|
+
height: this[sliderElementSymbol]?.offsetHeight || 0
|
679
|
+
};
|
680
|
+
|
681
|
+
const resizeObserver = new ResizeObserver(entries => {
|
682
|
+
for (let entry of entries) {
|
683
|
+
const {width, height} = entry.contentRect;
|
684
|
+
if (width !== initialSize.width || height !== initialSize.height) {
|
685
|
+
|
686
|
+
self.stopAutoPlay();
|
687
|
+
|
688
|
+
if (this.getOption("features.thumbnails")) {
|
689
|
+
initThumbnails.call(this);
|
690
|
+
}
|
691
|
+
|
692
|
+
const slidesVisible = getVisibleSlidesFromContainerWidth.call(this);
|
693
|
+
this[sliderElementSymbol].style.setProperty(
|
694
|
+
"--monster-slides-width",
|
695
|
+
`${100 / slidesVisible}%`,
|
696
|
+
);
|
697
|
+
|
698
|
+
moveTo.call(self,0,false)
|
699
|
+
self.startAutoPlay();
|
700
|
+
|
701
|
+
fireCustomEvent(self, "monster-slider-resized", {
|
702
|
+
width: width,
|
703
|
+
height: height
|
704
|
+
});
|
705
|
+
}
|
706
|
+
}
|
707
|
+
});
|
708
|
+
|
709
|
+
resizeObserver.observe(this[sliderElementSymbol]);
|
710
|
+
|
711
|
+
|
712
|
+
|
635
713
|
return this;
|
636
714
|
}
|
637
715
|
|
@@ -729,6 +807,7 @@ function initControlReferences() {
|
|
729
807
|
this[thumbnailElementSymbol] = this.shadowRoot.querySelector(
|
730
808
|
`[${ATTRIBUTE_ROLE}="thumbnails"]`,
|
731
809
|
);
|
810
|
+
|
732
811
|
}
|
733
812
|
|
734
813
|
/**
|