@hortonstudio/main 1.2.25 → 1.2.27

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.
@@ -35,7 +35,8 @@
35
35
  "Bash(git remote remove:*)",
36
36
  "Bash(tree:*)",
37
37
  "Bash(grep:*)",
38
- "Bash(git reset:*)"
38
+ "Bash(git reset:*)",
39
+ "Bash(git checkout:*)"
39
40
  ],
40
41
  "deny": []
41
42
  }
@@ -468,7 +468,9 @@ export async function init() {
468
468
  ease: config.headingSplit.ease,
469
469
  onComplete: () => {
470
470
  if (split && split.revert) {
471
-
471
+ setTimeout(() => {
472
+ split.revert();
473
+ }, 100);
472
474
  }
473
475
  }
474
476
  },
@@ -487,7 +489,9 @@ export async function init() {
487
489
  ease: config.subheadingSplit.ease,
488
490
  onComplete: () => {
489
491
  if (split && split.revert) {
490
-
492
+ setTimeout(() => {
493
+ split.revert();
494
+ }, 100);
491
495
  }
492
496
  }
493
497
  },
@@ -595,5 +599,19 @@ export async function init() {
595
599
  }
596
600
  };
597
601
 
602
+ // Add resize listener for responsive line splits
603
+ let heroResizeTimeout;
604
+ let lastWidth = window.innerWidth;
605
+ window.addEventListener('resize', () => {
606
+ const currentWidth = window.innerWidth;
607
+ if (currentWidth !== lastWidth) {
608
+ lastWidth = currentWidth;
609
+ clearTimeout(heroResizeTimeout);
610
+ heroResizeTimeout = setTimeout(() => {
611
+ ScrollTrigger.refresh();
612
+ }, 300);
613
+ }
614
+ });
615
+
598
616
  return { result: 'anim-hero initialized' };
599
617
  }
@@ -115,7 +115,7 @@ const CharSplitAnimations = {
115
115
 
116
116
  elements.forEach((textElement) => {
117
117
  const split = SplitText.create(textElement, {
118
- type: "chars",
118
+ type: "words,chars",
119
119
  mask: "chars",
120
120
  charsClass: "char",
121
121
  });
@@ -141,10 +141,13 @@ const CharSplitAnimations = {
141
141
  scrollTrigger: {
142
142
  trigger: textElement,
143
143
  start: config.charSplit.start,
144
- invalidateOnRefresh: true,
144
+ invalidateOnRefresh: false,
145
145
  },
146
146
  onComplete: () => {
147
-
147
+ if (textElement.splitTextInstance) {
148
+ textElement.splitTextInstance.revert();
149
+ delete textElement.splitTextInstance;
150
+ }
148
151
  }
149
152
  });
150
153
 
@@ -198,10 +201,13 @@ const WordSplitAnimations = {
198
201
  scrollTrigger: {
199
202
  trigger: textElement,
200
203
  start: config.wordSplit.start,
201
- invalidateOnRefresh: true,
204
+ invalidateOnRefresh: false,
202
205
  },
203
206
  onComplete: () => {
204
-
207
+ if (textElement.splitTextInstance) {
208
+ textElement.splitTextInstance.revert();
209
+ delete textElement.splitTextInstance;
210
+ }
205
211
  }
206
212
  });
207
213
 
@@ -255,10 +261,13 @@ const LineSplitAnimations = {
255
261
  scrollTrigger: {
256
262
  trigger: textElement,
257
263
  start: config.lineSplit.start,
258
- invalidateOnRefresh: true,
264
+ invalidateOnRefresh: false,
259
265
  },
260
266
  onComplete: () => {
261
-
267
+ if (textElement.splitTextInstance) {
268
+ textElement.splitTextInstance.revert();
269
+ delete textElement.splitTextInstance;
270
+ }
262
271
  }
263
272
  });
264
273
 
@@ -303,7 +312,7 @@ const AppearAnimations = {
303
312
  scrollTrigger: {
304
313
  trigger: element,
305
314
  start: config.appear.start,
306
- invalidateOnRefresh: true,
315
+ invalidateOnRefresh: false,
307
316
  }
308
317
  });
309
318
 
@@ -351,7 +360,18 @@ export async function init() {
351
360
  initAnimations();
352
361
  }
353
362
 
354
- window.addEventListener('resize', ScrollTrigger.refresh());
363
+ let resizeTimeout;
364
+ let lastWidth = window.innerWidth;
365
+ window.addEventListener('resize', () => {
366
+ const currentWidth = window.innerWidth;
367
+ if (currentWidth !== lastWidth) {
368
+ lastWidth = currentWidth;
369
+ clearTimeout(resizeTimeout);
370
+ resizeTimeout = setTimeout(() => {
371
+ ScrollTrigger.refresh();
372
+ }, 300);
373
+ }
374
+ });
355
375
 
356
376
  const api = window[API_NAME] || {};
357
377
  api.textAnimations = {
@@ -21,18 +21,28 @@ function initTransitions() {
21
21
 
22
22
  // On Page Load
23
23
  if (transitionTrigger.length > 0) {
24
- if (window.Webflow && window.Webflow.push) {
25
- Webflow.push(function () {
26
- transitionTrigger.click();
27
- });
24
+
25
+ function triggerTransition() {
26
+ if (window.Webflow && window.Webflow.push) {
27
+ Webflow.push(function () {
28
+ transitionTrigger.click();
29
+ });
30
+ } else {
31
+ // Non-Webflow initialization
32
+ setTimeout(() => {
33
+ transitionTrigger.click();
34
+ }, 100);
35
+ }
36
+ $("body").addClass("no-scroll-transition");
37
+ setTimeout(() => {$("body").removeClass("no-scroll-transition");}, introDurationMS);
38
+ }
39
+
40
+ // Wait for full page load (images, fonts, etc.) for Safari
41
+ if (document.readyState === 'complete') {
42
+ triggerTransition();
28
43
  } else {
29
- // Non-Webflow initialization
30
- setTimeout(() => {
31
- transitionTrigger.click();
32
- }, 100);
44
+ window.addEventListener('load', triggerTransition, { once: true });
33
45
  }
34
- $("body").addClass("no-scroll-transition");
35
- setTimeout(() => {$("body").removeClass("no-scroll-transition");}, introDurationMS);
36
46
  }
37
47
 
38
48
  // On Link Click
package/index.js CHANGED
@@ -1,4 +1,4 @@
1
- // Version:1.2.25
1
+ // Version:1.2.27
2
2
 
3
3
  const API_NAME = 'hsmain';
4
4
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hortonstudio/main",
3
- "version": "1.2.25",
3
+ "version": "1.2.27",
4
4
  "description": "Animation and utility library for client websites",
5
5
  "main": "index.js",
6
6
  "type": "module",