@widelab-nc/widelab 1.1.31 → 1.1.33

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": "@widelab-nc/widelab",
3
- "version": "1.1.31",
3
+ "version": "1.1.33",
4
4
  "description": "Widelab starter template based on Finsweet template + add-ons.",
5
5
  "homepage": "https://widelab.co",
6
6
  "license": "ISC",
package/src/index.js CHANGED
@@ -1149,6 +1149,58 @@ window.formatCounter = function() {
1149
1149
  animateValue(88.0, 110.85, 3500);
1150
1150
  }
1151
1151
 
1152
+ // Filtering logic on Client's page - scroll trigger version
1153
+ window.formatCounterOnScroll = function() {
1154
+ function format_number(x) {
1155
+ let parts = x.toFixed(1).split(".");
1156
+ parts[0] = parts[0].replace(/\B(?=(\d{3})+(?!\d))/g, ".");
1157
+ let formattedNumber = parts.join(".");
1158
+ let digits = formattedNumber.split('').map(char => {
1159
+ if (char === '.') {
1160
+ return char;
1161
+ } else {
1162
+ return `<span class="single-number">${char}</span>`;
1163
+ }
1164
+ }).join('');
1165
+ return digits;
1166
+ }
1167
+
1168
+ function easeOutQuad(t) {
1169
+ return t * (2 - t);
1170
+ }
1171
+
1172
+ function animateValue(start, end, duration) {
1173
+ const counter = document.getElementById('counter');
1174
+ let startTimestamp = null;
1175
+ const step = (timestamp) => {
1176
+ if (!startTimestamp) startTimestamp = timestamp;
1177
+ const progress = Math.min((timestamp - startTimestamp) / duration, 1);
1178
+ const easedProgress = easeOutQuad(progress);
1179
+ const currentValue = start + (end - start) * easedProgress;
1180
+ counter.innerHTML = format_number(currentValue);
1181
+ if (progress < 1) {
1182
+ window.requestAnimationFrame(step);
1183
+ }
1184
+ };
1185
+ window.requestAnimationFrame(step);
1186
+ }
1187
+
1188
+ // Scroll trigger
1189
+ const counterEl = document.getElementById('counter');
1190
+ if (!counterEl) return;
1191
+
1192
+ const observer = new IntersectionObserver((entries, observer) => {
1193
+ entries.forEach(entry => {
1194
+ if (entry.isIntersecting) {
1195
+ animateValue(88.0, 110.85, 3500);
1196
+ observer.unobserve(entry.target);
1197
+ }
1198
+ });
1199
+ }, { threshold: 0.5 });
1200
+
1201
+ observer.observe(counterEl);
1202
+ };
1203
+
1152
1204
  // GSAP Counter Up Animation onc Client's Page
1153
1205
  window.counterUpAnimation = function() {
1154
1206
 
@@ -1272,6 +1324,73 @@ window.heroSliders = function(e) {
1272
1324
  }
1273
1325
 
1274
1326
 
1327
+ // Splide without GSAP; pagination inserted as first child INSIDE .splide
1328
+ window.awwwardsSliders = function (el) {
1329
+ if (el.dataset.splideInitialized === '1') return;
1330
+
1331
+ // 1) Find or create Splide root
1332
+ let root = el.classList?.contains('splide') ? el : el.closest?.('.splide');
1333
+ const track = el.querySelector?.('.splide__track') || el.closest?.('.splide__track');
1334
+
1335
+ if (!root && track) {
1336
+ root = document.createElement('div');
1337
+ root.className = 'splide testimonial';
1338
+ track.parentNode.insertBefore(root, track);
1339
+ root.appendChild(track);
1340
+ }
1341
+
1342
+ // 2) Validate structure
1343
+ if (!root || !root.querySelector('.splide__track') || !root.querySelector('.splide__list')) {
1344
+ console.warn('[awwwardsSliders] Missing required Splide structure.');
1345
+ return;
1346
+ }
1347
+
1348
+ // 3) Splide config
1349
+ const config = {
1350
+ type: 'loop',
1351
+ perPage: 1,
1352
+ perMove: 1,
1353
+ gap: '0px',
1354
+ arrows: false,
1355
+ pagination: true,
1356
+ drag: false,
1357
+ speed: 300,
1358
+ easing: 'cubic-bezier(0.83, 0, 0.17, 1)',
1359
+ classes: {
1360
+ pagination: 'splide__pagination awwwards-pagination',
1361
+ page: 'splide__pagination__page awwwards-page',
1362
+ },
1363
+ breakpoints: {
1364
+ 992: { drag: true },
1365
+ },
1366
+ };
1367
+
1368
+ const splide = new Splide(root, config).mount();
1369
+
1370
+ // 4) Move pagination INSIDE .splide as FIRST child
1371
+ splide.on('pagination:mounted', (data) => {
1372
+ const list = data.list;
1373
+ if (list && root.firstChild) {
1374
+ root.insertBefore(list, root.firstChild);
1375
+ }
1376
+ });
1377
+
1378
+ // Fallback if pagination already exists
1379
+ queueMicrotask(() => {
1380
+ const list = root.querySelector('.splide__pagination');
1381
+ const track = root.querySelector('.splide__track');
1382
+ if (list && track && list.nextSibling !== track) {
1383
+ root.insertBefore(list, track);
1384
+ }
1385
+ });
1386
+
1387
+ // 5) Click-to-next on desktop
1388
+ if (window.innerWidth > 992) {
1389
+ root.addEventListener('click', () => splide.go('+1'));
1390
+ }
1391
+
1392
+ el.dataset.splideInitialized = '1';
1393
+ };
1275
1394
 
1276
1395
  // Sliders on Services page
1277
1396
  window.servicesSliders = function(e) {
@@ -1566,6 +1685,8 @@ window.closeInfoBar = function() {
1566
1685
  }
1567
1686
 
1568
1687
 
1688
+
1689
+
1569
1690
  // !!!!!!!!! Keep this Alpine init at the end !!!!!!!!!
1570
1691
  window.Webflow ||= [];
1571
1692
  window.Webflow.push(() => {