@hortonstudio/main 1.2.18 → 1.2.20

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.
@@ -174,15 +174,26 @@ export async function init() {
174
174
  return;
175
175
  }
176
176
 
177
+ // Check if there's a persistent config stored globally
178
+ const api = window[API_NAME] || {};
179
+ if (api._persistentConfigs?.heroAnimations) {
180
+ // Merge persistent config into current config
181
+ updateConfig(api._persistentConfigs.heroAnimations);
182
+ }
183
+
177
184
  if (prefersReducedMotion()) {
178
185
  // For reduced motion, just show elements without animation
179
186
  showHeroElementsWithoutAnimation();
180
187
 
181
188
  // Still expose the API for consistency
182
- window[API_NAME] = window[API_NAME] || {};
183
- window[API_NAME].heroAnimations = {
189
+ api.heroAnimations = {
184
190
  config: config,
185
- updateConfig: updateConfig,
191
+ updateConfig: (newConfig) => {
192
+ updateConfig(newConfig);
193
+ // Store config in persistent storage for restart persistence
194
+ api._persistentConfigs = api._persistentConfigs || {};
195
+ api._persistentConfigs.heroAnimations = { ...config };
196
+ },
186
197
  start: startHeroAnimations,
187
198
  kill: killHeroAnimations,
188
199
  restart: () => {
@@ -583,10 +594,14 @@ export async function init() {
583
594
  });
584
595
 
585
596
  // API exposure
586
- window[API_NAME] = window[API_NAME] || {};
587
- window[API_NAME].heroAnimations = {
597
+ api.heroAnimations = {
588
598
  config: config,
589
- updateConfig: updateConfig,
599
+ updateConfig: (newConfig) => {
600
+ updateConfig(newConfig);
601
+ // Store config in persistent storage for restart persistence
602
+ api._persistentConfigs = api._persistentConfigs || {};
603
+ api._persistentConfigs.heroAnimations = { ...config };
604
+ },
590
605
  start: startHeroAnimations,
591
606
  kill: killHeroAnimations,
592
607
  restart: () => {
@@ -343,6 +343,13 @@ async function initAnimations() {
343
343
  }
344
344
 
345
345
  export async function init() {
346
+ // Check if there's a persistent config stored globally
347
+ const api = window[API_NAME] || {};
348
+ if (api._persistentConfigs?.textAnimations) {
349
+ // Merge persistent config into current config
350
+ updateConfig(api._persistentConfigs.textAnimations);
351
+ }
352
+
346
353
  if (prefersReducedMotion()) {
347
354
  // For reduced motion, just show elements without animation
348
355
  showElementsWithoutAnimation();
@@ -353,10 +360,14 @@ export async function init() {
353
360
 
354
361
  window.addEventListener('resize', ScrollTrigger.refresh());
355
362
 
356
- const api = window[API_NAME] || {};
357
363
  api.textAnimations = {
358
364
  config: config,
359
- updateConfig: updateConfig,
365
+ updateConfig: (newConfig) => {
366
+ updateConfig(newConfig);
367
+ // Store config in persistent storage for restart persistence
368
+ api._persistentConfigs = api._persistentConfigs || {};
369
+ api._persistentConfigs.textAnimations = { ...config };
370
+ },
360
371
  start: startTextAnimations,
361
372
  kill: killTextAnimations,
362
373
  restart: () => {
package/index.js CHANGED
@@ -113,6 +113,8 @@ const initializeHsMain = async () => {
113
113
  process: new Set(),
114
114
  load: loadModule,
115
115
  loaded: false,
116
+ // Persistent config storage
117
+ _persistentConfigs: {},
116
118
  push(...items) {
117
119
  for (const [moduleName, callback] of items) {
118
120
  if (typeof callback === 'function') {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hortonstudio/main",
3
- "version": "1.2.18",
3
+ "version": "1.2.20",
4
4
  "description": "Animation and utility library for client websites",
5
5
  "main": "index.js",
6
6
  "type": "module",