canvasframework 0.5.4 → 0.5.6
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/core/CanvasFramework.js +7 -7
- package/package.json +1 -1
package/core/CanvasFramework.js
CHANGED
|
@@ -1806,7 +1806,7 @@ class CanvasFramework {
|
|
|
1806
1806
|
// Hook beforeLeave de la route actuelle (peut bloquer la navigation)
|
|
1807
1807
|
const currentRouteData = this.routes.get(this.currentRoute);
|
|
1808
1808
|
if (currentRouteData?.beforeLeave) {
|
|
1809
|
-
const canLeave = await currentRouteData.beforeLeave(this.currentParams, this.currentQuery);
|
|
1809
|
+
const canLeave = await currentRouteData.beforeLeave(this.currentParams, this.currentQuery, this);
|
|
1810
1810
|
if (canLeave === false) {
|
|
1811
1811
|
console.log('Navigation cancelled by beforeLeave hook');
|
|
1812
1812
|
return;
|
|
@@ -1815,14 +1815,14 @@ class CanvasFramework {
|
|
|
1815
1815
|
|
|
1816
1816
|
// ✅ NOUVEAU : Hook onLeave (alias plus intuitif de beforeLeave, mais ne bloque pas)
|
|
1817
1817
|
if (currentRouteData?.onLeave) {
|
|
1818
|
-
await currentRouteData.onLeave(this.currentParams, this.currentQuery);
|
|
1818
|
+
await currentRouteData.onLeave(this.currentParams, this.currentQuery, this);
|
|
1819
1819
|
}
|
|
1820
1820
|
|
|
1821
1821
|
// ===== LIFECYCLE: AVANT D'ENTRER DANS LA NOUVELLE ROUTE =====
|
|
1822
1822
|
|
|
1823
1823
|
// Hook beforeEnter de la nouvelle route (peut bloquer la navigation)
|
|
1824
1824
|
if (route.beforeEnter) {
|
|
1825
|
-
const canEnter = await route.beforeEnter(params, query);
|
|
1825
|
+
const canEnter = await route.beforeEnter(params, query, this);
|
|
1826
1826
|
if (canEnter === false) {
|
|
1827
1827
|
console.log('Navigation cancelled by beforeEnter hook');
|
|
1828
1828
|
return;
|
|
@@ -1831,7 +1831,7 @@ class CanvasFramework {
|
|
|
1831
1831
|
|
|
1832
1832
|
// ✅ NOUVEAU : Hook onEnter (appelé juste avant de créer les composants)
|
|
1833
1833
|
if (route.onEnter) {
|
|
1834
|
-
await route.onEnter(params, query);
|
|
1834
|
+
await route.onEnter(params, query, this);
|
|
1835
1835
|
}
|
|
1836
1836
|
|
|
1837
1837
|
// ===== SAUVEGARDER L'ÉTAT ACTUEL =====
|
|
@@ -1910,7 +1910,7 @@ class CanvasFramework {
|
|
|
1910
1910
|
|
|
1911
1911
|
// Hook afterEnter (appelé immédiatement après la création des composants)
|
|
1912
1912
|
if (route.afterEnter) {
|
|
1913
|
-
route.afterEnter(params, query);
|
|
1913
|
+
route.afterEnter(params, query, this);
|
|
1914
1914
|
}
|
|
1915
1915
|
|
|
1916
1916
|
// ✅ NOUVEAU : Hook afterLeave de l'ancienne route (après transition complète)
|
|
@@ -1918,11 +1918,11 @@ class CanvasFramework {
|
|
|
1918
1918
|
// Si animation, attendre la fin de la transition
|
|
1919
1919
|
if (animate && this.transitionState.isTransitioning) {
|
|
1920
1920
|
setTimeout(() => {
|
|
1921
|
-
currentRouteData.afterLeave(oldParams, oldQuery);
|
|
1921
|
+
currentRouteData.afterLeave(oldParams, oldQuery, this);
|
|
1922
1922
|
}, this.transitionState.duration || 300);
|
|
1923
1923
|
} else {
|
|
1924
1924
|
// Pas d'animation, appeler immédiatement
|
|
1925
|
-
currentRouteData.afterLeave(oldParams, oldQuery);
|
|
1925
|
+
currentRouteData.afterLeave(oldParams, oldQuery, this);
|
|
1926
1926
|
}
|
|
1927
1927
|
}
|
|
1928
1928
|
|