gclass-anims 1.0.0-beta.16 → 1.0.0-beta.17
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/AnimToggle.js +14 -1
- package/CHANGELOG.md +3 -0
- package/package.json +1 -1
package/AnimToggle.js
CHANGED
|
@@ -116,6 +116,7 @@ let cleanup = null
|
|
|
116
116
|
let bootCleanup = null
|
|
117
117
|
let bootTimeout = null
|
|
118
118
|
let bootStyle = null
|
|
119
|
+
let hasBooted = false // true after first hard-load boot, skips boot on SPA path changes (remains false until first boot, resets on hard reload)
|
|
119
120
|
|
|
120
121
|
const readBootTime = (els, fallback) => {
|
|
121
122
|
let max = null
|
|
@@ -137,9 +138,13 @@ const readBootTime = (els, fallback) => {
|
|
|
137
138
|
// Boot stops all DOM rendering for defaults.bootTime (overwritten by boot-time-N class).
|
|
138
139
|
export function initAnimations() {
|
|
139
140
|
if (typeof window === 'undefined' || !getEnabled()) return
|
|
141
|
+
// boot already in progress (first mount in StrictMode) - ignore second mount
|
|
142
|
+
if (bootTimeout) {
|
|
143
|
+
console.log(`[initAnimations] boot already in progress - ignoring duplicate call`)
|
|
144
|
+
return
|
|
145
|
+
}
|
|
140
146
|
if (cleanup) { cleanup(); cleanup = null }
|
|
141
147
|
if (bootCleanup) { bootCleanup(); bootCleanup = null }
|
|
142
|
-
if (bootTimeout) { clearTimeout(bootTimeout); bootTimeout = null }
|
|
143
148
|
if (bootStyle) { bootStyle.remove(); bootStyle = null; document.documentElement.classList.remove('gclass-booting') }
|
|
144
149
|
|
|
145
150
|
const bootEls = typeof document !== 'undefined' ? document.querySelectorAll(".boot-up") : []
|
|
@@ -148,7 +153,14 @@ export function initAnimations() {
|
|
|
148
153
|
} else if (bootEls.length > 1) {
|
|
149
154
|
console.error(`[initAnimations] Multiple .boot-up elements detected (${bootEls.length}) - skipping all boot animations`, bootEls)
|
|
150
155
|
bootEls.forEach(el => el.remove())
|
|
156
|
+
hasBooted = true
|
|
151
157
|
// fall through to normal initListeners without pausing DOM
|
|
158
|
+
} else if (hasBooted && !bootTimeout) {
|
|
159
|
+
// path change after already booted (SPA navigation) - skip boot, hard reload resets hasBooted
|
|
160
|
+
console.log(`[initAnimations] skipping boot on path change (already booted)`, bootEls)
|
|
161
|
+
bootEls.forEach(el => el.remove())
|
|
162
|
+
hasBooted = true
|
|
163
|
+
// fall through
|
|
152
164
|
} else {
|
|
153
165
|
const bootEl = bootEls[0]
|
|
154
166
|
const hasBootEnd = [...bootEl.classList].some(c => c.startsWith('boot-end-'))
|
|
@@ -160,6 +172,7 @@ export function initAnimations() {
|
|
|
160
172
|
}
|
|
161
173
|
const bootTime = readBootTime(bootEls, defaults.bootTime ?? 2)
|
|
162
174
|
console.log(`[initAnimations] .boot-up found: ${bootEls.length} - pausing DOM for ${bootTime}s`, bootEls)
|
|
175
|
+
hasBooted = true
|
|
163
176
|
// stop all DOM rendering except .boot-up
|
|
164
177
|
bootStyle = document.createElement('style')
|
|
165
178
|
bootStyle.id = 'gclass-boot-style'
|
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,9 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to `gclass-anims` will be documented in this file.
|
|
4
4
|
|
|
5
|
+
## [1.0.0-beta.17] - 2026-9-1
|
|
6
|
+
- Fixed the `.boot-up` class firing on every path change
|
|
7
|
+
|
|
5
8
|
## [1.0.0-beta.16] - 2026-09-1
|
|
6
9
|
- Added a new `.boot-up` class for boot up animations
|
|
7
10
|
- Fixed text animations not taking formatting into account
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "gclass-anims",
|
|
3
|
-
"version": "1.0.0-beta.
|
|
3
|
+
"version": "1.0.0-beta.17",
|
|
4
4
|
"description": "A Tailwind-style utility layer on top of GSAP. Framework-agnostic - works in vanilla JS, React, Vue, Svelte, or any bundler.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "index.js",
|