@madj2k/fe-frontend-kit 2.0.20 → 2.0.22

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@madj2k/fe-frontend-kit",
3
- "version": "2.0.20",
3
+ "version": "2.0.22",
4
4
  "description": "Shared frontend utilities, menus and mixins for projects",
5
5
  "main": "index.js",
6
6
  "style": "index.scss",
@@ -19,11 +19,13 @@
19
19
  /// @group Typography
20
20
  /// @param {Map} $font-formats - A map of font style definitions. Defaults to the global `$font-formats` map.
21
21
  /// @param {String} $font-format - The key name of the format to apply (e.g., 'h1', 'copy-small').
22
+ /// @param {String} $tablet-breakpoint - The breakpoint name for tablet styles (default: lg).
23
+ /// @param {String} $desktop-breakpoint - The breakpoint name for desktop styles (default: xl).
22
24
  ///
23
25
  /// @author Steffen Kroggel <developer@steffenkroggel>
24
26
  /// @license GNU General Public License v3.0 https://www.gnu.org/licenses/gpl-3.0.en.html
25
27
  ///
26
- @mixin font-format($font-formats, $font-format: 'h1') {
28
+ @mixin font-format($font-formats, $font-format: 'h1', $tablet-breakpoint: lg, $desktop-breakpoint: xl) {
27
29
  $format-data: map-get($font-formats, $font-format);
28
30
  $mobile-data: map-get($format-data, 'mobile');
29
31
  $default-data: map-get($format-data, 'default');
@@ -38,7 +40,7 @@
38
40
  }
39
41
 
40
42
  @if map-has-key($format-data, 'tablet') {
41
- @include media-breakpoint-up(lg) {
43
+ @include media-breakpoint-up($tablet-breakpoint) {
42
44
  @each $key in $keys {
43
45
  #{$key}: map-get(map-get($format-data, 'tablet'), $key);
44
46
  }
@@ -46,12 +48,23 @@
46
48
  }
47
49
 
48
50
  @if map-has-key($format-data, 'desktop') {
49
- @include media-breakpoint-up(xl) {
51
+ @include media-breakpoint-up($desktop-breakpoint) {
50
52
  @each $key in $keys {
51
53
  #{$key}: map-get(map-get($format-data, 'desktop'), $key);
52
54
  }
53
55
  }
54
56
  }
57
+
58
+ // dynamic breakpoints (but not mobile, default, tablet, desktop)
59
+ @each $variant, $values in $format-data {
60
+ @if not index(('mobile', 'default', 'tablet', 'desktop'), $variant) {
61
+ @include media-breakpoint-up($variant) {
62
+ @each $key in $keys {
63
+ #{$key}: map-get($values, $key);
64
+ }
65
+ }
66
+ }
67
+ }
55
68
  }
56
69
 
57
70
  /// Enables word breaking and hyphenation for improved long text handling.
@@ -144,7 +144,7 @@
144
144
 
145
145
  /** addition class for usage with position:absolute */
146
146
  #{$wrap-class}-padding {
147
- @include page-padding-only($default-padding);
147
+ @include page-padding-only($padding-x);
148
148
  }
149
149
  }
150
150
 
@@ -17,7 +17,7 @@
17
17
  *
18
18
  * @author Steffen Kroggel <developer@steffenkroggel.de>
19
19
  * @copyright 2025 Steffen Kroggel
20
- * @version 2.0.1
20
+ * @version 2.0.2
21
21
  * @license GNU General Public License v3.0
22
22
  * @see https://www.gnu.org/licenses/gpl-3.0.en.html
23
23
  *
@@ -138,6 +138,7 @@ class Madj2kOwlThumbnail {
138
138
  this._highlightInitialThumb(event);
139
139
  this._equalizeThumbnailHeights();
140
140
  this._repositionThumbNav();
141
+ this._updateArrowNav()
141
142
  },
142
143
  onRefreshed: () => {
143
144
  this._equalizeThumbnailHeights();
@@ -260,7 +261,8 @@ class Madj2kOwlThumbnail {
260
261
  this._log('Centering thumbnails to index:', centerIndex);
261
262
  this.$thumbs.trigger('to.owl.carousel', [centerIndex, 300, true]);
262
263
 
263
- this._repositionThumbNav(index );
264
+ this._repositionThumbNav(index);
265
+ this._updateArrowNav(index)
264
266
  this.syncing = false;
265
267
  }
266
268
 
@@ -299,7 +301,8 @@ class Madj2kOwlThumbnail {
299
301
  if ($(e.currentTarget).hasClass('owl-prev')) {
300
302
  // Previous slide in main carousel
301
303
  newIndex = mainData.relative(mainData.current()) - 1;
302
- if (newIndex < 0) newIndex = 0; // Kein Loop
304
+ if (newIndex < 0) newIndex = 0; // no loop
305
+
303
306
  } else if ($(e.currentTarget).hasClass('owl-next')) {
304
307
  // Next slide in main carousel
305
308
  newIndex = mainData.relative(mainData.current()) + 1;
@@ -310,6 +313,29 @@ class Madj2kOwlThumbnail {
310
313
  });
311
314
  }
312
315
 
316
+ /**
317
+ * Updates the visibility of the navigation arrows based on the current index
318
+ *
319
+ * @param index
320
+ * @private
321
+ */
322
+ _updateArrowNav (index = 0) {
323
+
324
+ const mainData = this.$main.data('owl.carousel');
325
+ if (!mainData) return;
326
+
327
+ this.$thumbs.find('.owl-prev').removeClass('inactive');
328
+ this.$thumbs.find('.owl-next').removeClass('inactive');
329
+
330
+ if (index === 0) {
331
+ this.$thumbs.find('.owl-prev').addClass('inactive');
332
+ }
333
+
334
+ if (index === mainData.items().length -1) {
335
+ this.$thumbs.find('.owl-next').addClass('inactive');
336
+ }
337
+ }
338
+
313
339
  /**
314
340
  * Start thumbnails on the left side of the stage, even if they are centered!
315
341
  * @private
@@ -328,11 +354,11 @@ class Madj2kOwlThumbnail {
328
354
  $thumbStage.css('transform', 'translate3d(0px, 0px, 0px)');
329
355
  this._log('Thumb stage repositioned: left-aligned (index 0)');
330
356
 
331
- // last thumb aligned right
357
+ // last thumb aligned right
332
358
  } else if (currentIndex === lastIndex) {
333
359
  let totalWidth = 0;
334
360
  $thumbItems.each((i, item) => {
335
- totalWidth += $(item).outerWidth(true); // inklusive margin
361
+ totalWidth += $(item).outerWidth(true); // margin included
336
362
  });
337
363
 
338
364
  const containerWidth = this.$thumbs.width();