@madj2k/fe-frontend-kit 2.0.0 → 2.0.2

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.0",
3
+ "version": "2.0.2",
4
4
  "description": "Shared frontend utilities, menus and mixins for projects",
5
5
  "main": "index.js",
6
6
  "style": "index.scss",
@@ -3,6 +3,16 @@
3
3
  * ================================================== */
4
4
  @use 'sass:math';
5
5
 
6
+ $spacer : 1rem !default;
7
+ $spacers: (
8
+ 0: 0,
9
+ 1: $spacer * .25,
10
+ 2: $spacer * .5,
11
+ 3: $spacer,
12
+ 4: $spacer * 1.5,
13
+ 5: $spacer * 3,
14
+ ) !default;
15
+
6
16
  $page-padding: (
7
17
  xs: $spacer,
8
18
  sm: $spacer, // mobile
@@ -10,7 +20,6 @@ $page-padding: (
10
20
  lg: $spacer, // tablet
11
21
  xl: $spacer,
12
22
  xxl: $spacer,
13
- xxxl: $spacer
14
23
  ) !default;
15
24
 
16
25
  $content-spacers-blocks: (
@@ -21,31 +30,27 @@ $content-spacers-blocks: (
21
30
 
22
31
  $content-spacers: (
23
32
  'xs': (
24
- 'section': map-get($spacers, 6), // space between different sections
33
+ 'section': map-get($spacers, 5), // space between different sections
25
34
  'block': map-get($spacers, 3), // space between content blocks
26
35
  ),
27
36
  'sm': (
28
- 'section': map-get($spacers, 6), // space between different sections
37
+ 'section': map-get($spacers, 5), // space between different sections
29
38
  'block': map-get($spacers, 3), // space between content blocks
30
39
  ),
31
40
  'md': (
32
- 'section': map-get($spacers, 6), // space between different sections
41
+ 'section': map-get($spacers, 5), // space between different sections
33
42
  'block': map-get($spacers, 3), // space between content blocks
34
43
  ),
35
44
  'lg': (
36
- 'section': map-get($spacers, 7), // space between different sections
37
- 'block': map-get($spacers, 6), // space between content blocks
45
+ 'section': map-get($spacers, 5), // space between different sections
46
+ 'block': map-get($spacers, 3), // space between content blocks
38
47
  ),
39
48
  'xl': (
40
- 'section': map-get($spacers, 7), // space between different sections
41
- 'block': map-get($spacers, 6), // space between content blocks
49
+ 'section': map-get($spacers, 5), // space between different sections
50
+ 'block': map-get($spacers, 3), // space between content blocks
42
51
  ),
43
52
  'xxl': (
44
- 'section': map-get($spacers, 7), // space between different sections
45
- 'block': map-get($spacers, 6), // space between content blocks
53
+ 'section': map-get($spacers, 5), // space between different sections
54
+ 'block': map-get($spacers, 3), // space between content blocks
46
55
  ),
47
- 'xxxl': (
48
- 'section': map-get($spacers, 7), // space between different sections
49
- 'block': map-get($spacers, 6), // space between content blocks
50
- )
51
56
  ) !default;
@@ -1,20 +1,16 @@
1
- @use "bootstrap/scss/functions";
2
- @use "bootstrap/scss/variables";
3
- @use "bootstrap/scss/mixins";
1
+ @import '00_variables/colors';
2
+ @import '00_variables/font';
3
+ @import '00_variables/maps';
4
4
 
5
- @forward '00_mixins/accessibility';
6
- @forward '00_mixins/colors';
7
- @forward '00_mixins/effects';
8
- @forward '00_mixins/flex-box';
9
- @forward '00_mixins/form';
10
- @forward '00_mixins/format';
11
- @forward '00_mixins/icons';
12
- @forward '00_mixins/nav';
13
- @forward '00_mixins/page';
14
- @forward '00_mixins/section';
15
- @forward '00_mixins/toggle-list';
16
- @forward '00_mixins/unit';
17
-
18
- @forward '10_config/colors';
19
- @forward '10_config/font';
20
- @forward '10_config/maps';
5
+ @import '10_mixins/accessibility';
6
+ @import '10_mixins/colors';
7
+ @import '10_mixins/effects';
8
+ @import '10_mixins/flex-box';
9
+ @import '10_mixins/form';
10
+ @import '10_mixins/format';
11
+ @import '10_mixins/icons';
12
+ @import '10_mixins/nav';
13
+ @import '10_mixins/page';
14
+ @import '10_mixins/section';
15
+ @import '10_mixins/toggle-list';
16
+ @import '10_mixins/unit';
@@ -0,0 +1,172 @@
1
+ /**
2
+ * Overlay (Vanilla JS)
3
+ *
4
+ * A lightweight class to show a full-page overlay (banner, popup, hint or cookie layer),
5
+ * with opening and closing animation and optional cookie persistence.
6
+ *
7
+ * Usage example: cookie notices, teaser banners, welcome layers.
8
+ *
9
+ * The overlay is only shown if no cookie with the given name is set.
10
+ * When the user closes the overlay, a cookie is written to remember this state.
11
+ *
12
+ * Includes customizable CSS classes for transitions and state (active/opening/open/closing).
13
+ *
14
+ * Works without dependencies — ideal for CMS environments (TYPO3, WordPress, etc.).
15
+ *
16
+ * @author Steffen Kroggel <developer@steffenkroggel.de>
17
+ * @copyright 2025 Steffen Kroggel
18
+ * @version 2.0.0
19
+ * @license GNU General Public License v3.0
20
+ * @see https://www.gnu.org/licenses/gpl-3.0.en.html
21
+ *
22
+ *
23
+ * Basic HTML structure:
24
+ *
25
+ * <div id="my-banner" class="my-banner">
26
+ * <div class="my-banner-content">
27
+ * <button id="my-banner-close" class="my-banner-close">Close</button>
28
+ * <p>Your overlay content here ...</p>
29
+ * </div>
30
+ * </div>
31
+ *
32
+ *
33
+ * Example CSS:
34
+ *
35
+ * .my-banner {
36
+ * position: fixed;
37
+ * top: 0;
38
+ * left: 0;
39
+ * width: 100%;
40
+ * height: 100%;
41
+ * background: rgba(0, 0, 0, 0.8);
42
+ * opacity: 0;
43
+ * visibility: hidden;
44
+ * transition: opacity 0.5s ease, visibility 0.5s ease;
45
+ * z-index: 9999;
46
+ * }
47
+ *
48
+ * .my-banner.active {
49
+ * visibility: visible;
50
+ * }
51
+ *
52
+ * .my-banner.open {
53
+ * opacity: 1;
54
+ * }
55
+ *
56
+ * .my-banner.closing {
57
+ * opacity: 0;
58
+ * }
59
+ *
60
+ *
61
+ * Basic usage:
62
+ *
63
+ * const banner = new Madj2kBanner();
64
+ *
65
+ *
66
+ * Advanced usage with config:
67
+ *
68
+ * const overlay = new Madj2kBanner({
69
+ * overlayId: 'my-banner',
70
+ * overlayCloseId: 'my-banner-close',
71
+ * activeClass: 'active',
72
+ * openClass: 'open',
73
+ * closingClass: 'closing',
74
+ * openingClass: 'opening',
75
+ * timeout: 1000,
76
+ * cookieName: 'myOverlayCookie',
77
+ * cookieDays: 30
78
+ * });
79
+ *
80
+ */
81
+ class Madj2kBanner {
82
+
83
+ config = {
84
+ 'overlayId' : 'overlay',
85
+ 'overlayCloseId' : 'overlay-close',
86
+ 'activeClass': 'active',
87
+ 'openClass': 'open',
88
+ 'closingClass': 'closing',
89
+ 'openingClass': 'opening',
90
+ 'timeout': '1000',
91
+ 'cookieName': 'overlay',
92
+ 'cookieDays': '365'
93
+
94
+ };
95
+
96
+ /**
97
+ * Constructor
98
+ * @param config
99
+ */
100
+ constructor(config) {
101
+ this.config = {...this.config, ...config }
102
+ this.initOverlay();
103
+ }
104
+
105
+ /**
106
+ * Init overlay if no cookie is set!
107
+ */
108
+ initOverlay () {
109
+ const overlay = document.getElementById(this.config.overlayId);
110
+ const self = this;
111
+
112
+ if (overlay && ! this.getCookie()) {
113
+
114
+ overlay.classList.add(self.config.activeClass);
115
+ setTimeout(function(){
116
+ overlay.classList.add(self.config.openingClass);
117
+ setTimeout(function(){
118
+ overlay.classList.add(self.config.openClass);
119
+ overlay.classList.remove(self.config.openingClass);
120
+ }, self.config.timeout);
121
+ }, 1 ); // minimum timeout for transitions!
122
+
123
+ const overlayClose = document.getElementById(this.config.overlayCloseId);
124
+ if (overlayClose) {
125
+ overlayClose.addEventListener('click', (ee) => {
126
+
127
+ this.setCookie();
128
+
129
+ overlay.classList.add(self.config.closingClass);
130
+ overlay.classList.remove(self.config.openClass);
131
+ setTimeout(function(){
132
+ overlay.classList.remove(self.config.closingClass);
133
+ overlay.classList.remove(self.config.activeClass);
134
+ }, self.config.timeout);
135
+ });
136
+ }
137
+ }
138
+ }
139
+
140
+
141
+ /**
142
+ * Sets cookie
143
+ */
144
+ setCookie() {
145
+ let d = new Date();
146
+ d.setTime(d.getTime() + (this.config.cookieDays * 24 * 60 * 60 * 1000));
147
+ let expires = "expires=" + d.toUTCString();
148
+ document.cookie = (this.config.cookieName + '=1;' + expires + ';path=/' + '; SameSite=Strict');
149
+ }
150
+
151
+
152
+ /**
153
+ * Gets cookie values
154
+ * @returns {string}
155
+ */
156
+ getCookie() {
157
+ let name = this.config.cookieName + "=";
158
+ let ca = document.cookie.split(';');
159
+
160
+ for (let i = 0; i < ca.length; i++) {
161
+ let c = ca[i];
162
+ while (c.charAt(0) === ' ') {
163
+ c = c.substring(1);
164
+ }
165
+ if (c.indexOf(name) === 0) {
166
+ return c.substring(name.length, c.length);
167
+ }
168
+ }
169
+
170
+ return '';
171
+ }
172
+ }
@@ -0,0 +1,25 @@
1
+ .my-banner {
2
+ position: fixed;
3
+ top: 0;
4
+ left: 0;
5
+ width: 100%;
6
+ height: 100%;
7
+ background: rgba(0, 0, 0, 0.8);
8
+ opacity: 0;
9
+ visibility: hidden;
10
+ transition: opacity 0.5s ease, visibility 0.5s ease;
11
+ z-index: 9999;
12
+
13
+ &.active {
14
+ visibility: visible;
15
+ }
16
+
17
+ &.open {
18
+ opacity: 1;
19
+ }
20
+
21
+ &.closing {
22
+ opacity: 0;
23
+ }
24
+ }
25
+
@@ -0,0 +1,2 @@
1
+ import Madj2kBanner from './banner-2.0.0.js';
2
+ export { Madj2kBanner };
@@ -0,0 +1 @@
1
+ @forward './banner-2.0.0';