@foeewni/web-core 3.0.0-alpha.17 → 3.0.0-alpha.19

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": "@foeewni/web-core",
3
- "version": "3.0.0-alpha.17",
3
+ "version": "3.0.0-alpha.19",
4
4
  "description": "Friend of the Earth EWNI Core for frontend projects",
5
5
  "browser": {
6
6
  "foe-core.js": "dist/js/foe.core.min.js",
@@ -110,8 +110,9 @@ Form `type=submit`s, `button`s are by default uncolorized, please use one of the
110
110
  }
111
111
 
112
112
  .btn-sunset {
113
- color: $foe-extradark;
114
113
  @include button-variant($foe-sunset, $foe-sunset);
114
+
115
+ color: $foe-extradark;
115
116
  }
116
117
 
117
118
  .btn-donate {
@@ -27,11 +27,11 @@
27
27
  display: block;
28
28
  }
29
29
 
30
- > .container {
31
- @include media-breakpoint-up(md) {
32
- justify-content: flex-end;
33
- }
30
+ > .container {
31
+ @include media-breakpoint-up(md) {
32
+ justify-content: flex-end;
34
33
  }
34
+ }
35
35
 
36
36
  &.megamenu-search { // Allow the search "megamenu" to persist at smaller breakpoints
37
37
  @include media-breakpoint-up(sm) {
@@ -228,7 +228,7 @@ ul.navbar-nav.menu-main {
228
228
  }
229
229
 
230
230
  > a {
231
- line-height: calc($foe-submenu-tile-height / 4 - 0.4rem);
231
+ line-height: calc($foe-submenu-tile-height / 4 - .4rem);
232
232
  font-weight: 600;
233
233
  color: $foe-extradark;
234
234
  transition: color 400ms ease-in-out;
@@ -85,6 +85,7 @@
85
85
  }
86
86
  }
87
87
 
88
+ /* stylelint-disable no-descending-specificity */
88
89
  > li {
89
90
  > a {
90
91
  background: linear-gradient(90deg, $foe-accent 0%, $foe-accent 50%, transparent 50%, transparent 100%);
@@ -100,6 +101,7 @@
100
101
  }
101
102
  }
102
103
  }
104
+ /* stylelint-enable no-descending-specificity */
103
105
 
104
106
  &.menu-main {
105
107
  display: block;
@@ -172,7 +174,7 @@
172
174
  }
173
175
  }
174
176
  }
175
-
177
+
176
178
  div.foe-megamenu-container { /* just for mobile menu */
177
179
  position: relative;
178
180
  background-color: transparent;
@@ -17,7 +17,7 @@ https://www.bennadel.com/blog/4310-detecting-rendered-line-breaks-in-a-text-node
17
17
 
18
18
  (() => {
19
19
  // Config
20
- const ROTATION_MAX_DEGREES = 2; // Degrees. "Normal" is around 2.5
20
+ // const ROTATION_MAX_DEGREES = 2; // Degrees. "Normal" is around 2.5
21
21
  const BACKGROUND_EXTENSION = 0.5; // rem. Normal is around 1
22
22
  const CORNER_JIGGLE_MAX = 1; // rem. Normal is around .2
23
23
  const BREAK_RATIO = 2.5; // ratio for when the variation on the side happens
@@ -57,6 +57,7 @@ https://www.bennadel.com/blog/4310-detecting-rendered-line-breaks-in-a-text-node
57
57
  if (
58
58
  !target.firstChild
59
59
  || target.firstChild.nodeType !== Node.TEXT_NODE
60
+ || !target.textContent.replace(/\s+/g, ' ').trim().length
60
61
  ) {
61
62
  return;
62
63
  }
@@ -71,6 +72,11 @@ https://www.bennadel.com/blog/4310-detecting-rendered-line-breaks-in-a-text-node
71
72
 
72
73
  // Figure out the bounding boxes
73
74
  // Get the bounding boxes
75
+ if (getComputedStyle(target.parentNode).position === 'static') {
76
+ // static parents were resultibngin top drift on the top positioning
77
+ // A lot of the button elements have a parent with relative anyway
78
+ target.parentNode.style.position = 'relative';
79
+ }
74
80
  const targetBox = target.getBoundingClientRect();
75
81
  const parentBox = target.offsetParent ? target.offsetParent.getBoundingClientRect() : targetBox;
76
82
 
@@ -85,27 +91,27 @@ https://www.bennadel.com/blog/4310-detecting-rendered-line-breaks-in-a-text-node
85
91
  canvas.id = target.dataset.backgroundCanvasId;
86
92
  canvas.style.position = 'absolute';
87
93
  canvas.style.zIndex = -1;
88
- canvas.style.top = `${(targetBox.top - parentBox.top) - 2 * extension}px`;
89
- canvas.style.left = `${(targetBox.left - parentBox.left) - 2 * extension}px`;
90
- canvas.style.width = `${targetBox.width + 4 * extension}px`;
91
- canvas.style.height = `${targetBox.height + 4 * extension}px`;
92
- canvas.width = targetBox.width + 4 * extension;
93
- canvas.height = targetBox.height + 4 * extension;
94
+ canvas.style.top = `${(targetBox.top - parentBox.top) - (2 * extension)}px`;
95
+ canvas.style.left = `${(targetBox.left - parentBox.left) - (2 * extension)}px`;
96
+ canvas.style.width = `${targetBox.width + (4 * extension)}px`;
97
+ canvas.style.height = `${targetBox.height + (4 * extension)}px`;
98
+ canvas.width = targetBox.width + (4 * extension);
99
+ canvas.height = targetBox.height + (4 * extension);
94
100
  canvas.style.pointerEvents = 'none';
95
101
  target.parentNode.insertBefore(canvas, target);
96
102
 
97
103
  // Add rotation
98
- if (!target.dataset.jauntRotation) {
99
- const middle = jauntSeed.length / 2 + 1;
100
- let rotationSeed = jauntSeed.substring(1, middle);
101
- rotationSeed = Number(`0x${rotationSeed}`);
102
- rotationSeed /= 10 ** (`${rotationSeed}`).length;
103
- const rotationFactor = ROTATION_MAX_DEGREES * jauntFactor
104
- * (rotationSeed * 2 - 1); // -1 to +1
105
- target.dataset.jauntRotation = rotationFactor;
106
- }
107
- target.style.transform = `rotate(${target.dataset.jauntRotation}deg)`;
108
- canvas.style.transform = `rotate(${target.dataset.jauntRotation}deg)`;
104
+ // if (!target.dataset.jauntRotation) {
105
+ // const middle = jauntSeed.length / 2 + 1;
106
+ // let rotationSeed = jauntSeed.substring(1, middle);
107
+ // rotationSeed = Number(`0x${rotationSeed}`);
108
+ // rotationSeed /= 10 ** (`${rotationSeed}`).length;
109
+ // const rotationFactor = ROTATION_MAX_DEGREES * jauntFactor
110
+ // * (rotationSeed * 2 - 1); // -1 to +1
111
+ // target.dataset.jauntRotation = rotationFactor;
112
+ // }
113
+ // target.style.transform = `rotate(${target.dataset.jauntRotation}deg)`;
114
+ // canvas.style.transform = `rotate(${target.dataset.jauntRotation}deg)`;
109
115
 
110
116
  const context = canvas.getContext('2d');
111
117
 
@@ -120,17 +126,24 @@ https://www.bennadel.com/blog/4310-detecting-rendered-line-breaks-in-a-text-node
120
126
  target.style.backgroundColor = 'transparent';
121
127
  target.style.borderColor = 'transparent';
122
128
 
123
- // Collapse whitespace
124
- target.textContent = target.textContent.replace(/\s+/g, ' ').trim();
125
-
126
- // Get the individual lines as rendered on screen
127
- const { textContent } = target.firstChild;
128
- const range = document.createRange();
129
- range.setStart(target.firstChild, 0);
130
- range.setEnd(target.firstChild, textContent.length);
129
+ const boxes = target.dataset.jauntFull ? [targetBox] : [];
130
+ if (!target.dataset.jauntFull) {
131
+ target.childNodes.forEach((text) => {
132
+ if (text.nodeType === Node.TEXT_NODE) {
133
+ // Collapse whitespace
134
+ text.textContent = text.textContent.replace(/\s+/g, ' ').trim();
135
+ // Get the individual lines as rendered on screen
136
+ const nodeRange = document.createRange();
137
+ nodeRange.setStart(text, 0);
138
+ nodeRange.setEnd(text, text.textContent.length);
139
+ Array.from(nodeRange.getClientRects()).forEach((rect) => {
140
+ boxes.push(rect);
141
+ });
142
+ }
143
+ });
144
+ }
131
145
 
132
146
  // const outerBox = range.getBoundingClientRect();
133
- const boxes = target.dataset.jauntFull ? [targetBox] : Array.from(range.getClientRects());
134
147
  const storedPoints = [];
135
148
 
136
149
  // function to jiggle the points around using a seed
@@ -191,12 +204,15 @@ https://www.bennadel.com/blog/4310-detecting-rendered-line-breaks-in-a-text-node
191
204
  boxes.forEach((lineBox, i) => {
192
205
  const points = [];
193
206
  // dimension constants to use for points
194
- const lineWidth = lineBox.width + (target.dataset.jauntFull ? -extension : (4 * extension));
195
- const lineHeight = lineBox.height + (target.dataset.jauntFull ? -extension : (4 * extension));
196
- const left = lineBox.left - targetBox.left + (target.dataset.jauntFull ? (3 * extension) : 0);
197
- const right = lineBox.left - targetBox.left + (target.dataset.jauntFull ? (3 * extension) : 0) + lineWidth;
198
- const top = lineBox.top - targetBox.top + (target.dataset.jauntFull ? (2 * extension) : 0);
199
- const bottom = lineBox.top - targetBox.top + (target.dataset.jauntFull ? (2 * extension) : 0) + lineHeight;
207
+ const lineWidth = lineBox.width + (target.dataset.jauntFull ? 0 : (4 * extension));
208
+ const lineHeight = lineBox.height + (target.dataset.jauntFull ? 0 : (4 * extension));
209
+ if (!lineWidth || !lineHeight) {
210
+ return;
211
+ }
212
+ const left = lineBox.left - targetBox.left + (target.dataset.jauntFull ? 2 * extension : 0);
213
+ const right = lineBox.left - targetBox.left + lineWidth + (target.dataset.jauntFull ? 2 * extension : 0);
214
+ const top = lineBox.top - targetBox.top + (target.dataset.jauntFull ? 2 * extension : 0);
215
+ const bottom = lineBox.top - targetBox.top + lineHeight + (target.dataset.jauntFull ? 2 * extension : 0);
200
216
  // number of intemidiate points vertically and horizontally
201
217
  const widthPointCount = Math.ceil(lineWidth / (lineHeight * BREAK_RATIO)) - 1;
202
218
  const heightPointCount = Math.ceil(lineHeight / (lineWidth * BREAK_RATIO)) - 1;
@@ -601,9 +601,9 @@ $btn-link-disabled-color: $gray-600;
601
601
  $btn-block-spacing-y: .5rem;
602
602
 
603
603
  // Allows for customizing button radius independently from global border radius
604
- $btn-border-radius: $border-radius;
605
- $btn-border-radius-lg: $border-radius-lg;
606
- $btn-border-radius-sm: $border-radius-sm;
604
+ $btn-border-radius: 0;
605
+ $btn-border-radius-lg: 0;
606
+ $btn-border-radius-sm: 0;
607
607
 
608
608
  $btn-transition: color .15s ease-in-out, background-color .15s ease-in-out, border-color .15s ease-in-out, box-shadow .15s ease-in-out;
609
609