canvasframework 0.4.4 → 0.4.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/components/QRCodeReader.js +2 -2
- package/components/TimePicker.js +2 -2
- package/core/CanvasFramework.js +61 -11
- package/index.js +10 -1
- package/package.json +1 -1
- package/utils/FirebaseAuth.js +653 -0
- package/utils/FirebaseCore.js +246 -0
- package/utils/FirebaseFirestore.js +581 -0
- package/utils/FirebaseFunctions.js +97 -0
- package/utils/FirebaseRealtimeDB.js +498 -0
- package/utils/FirebaseStorage.js +612 -0
- package/utils/PayPalPayment.js +678 -0
- package/utils/StripePayment.js +552 -0
|
@@ -134,8 +134,8 @@ class QRCodeReader extends Component {
|
|
|
134
134
|
this.stream = await navigator.mediaDevices.getUserMedia({
|
|
135
135
|
video: {
|
|
136
136
|
facingMode: this.facingMode,
|
|
137
|
-
width: { ideal:
|
|
138
|
-
height: { ideal:
|
|
137
|
+
width: { ideal: 320 },
|
|
138
|
+
height: { ideal: 240 },
|
|
139
139
|
frameRate: { ideal: 30 }
|
|
140
140
|
}
|
|
141
141
|
});
|
package/components/TimePicker.js
CHANGED
|
@@ -193,12 +193,12 @@ class TimePicker extends Component {
|
|
|
193
193
|
ctx.fillStyle = labelColor;
|
|
194
194
|
ctx.font = '14px Roboto, sans-serif';
|
|
195
195
|
ctx.textAlign = 'left';
|
|
196
|
-
ctx.fillText(this.label, this.x +
|
|
196
|
+
ctx.fillText(this.label, this.x + 48, this.y + 18);
|
|
197
197
|
|
|
198
198
|
// Valeur (heure)
|
|
199
199
|
ctx.fillStyle = textColor;
|
|
200
200
|
ctx.font = `${fontSize}px Roboto, sans-serif`;
|
|
201
|
-
ctx.fillText(timeStr, this.x +
|
|
201
|
+
ctx.fillText(timeStr, this.x + 48, this.y + this.height - 10);
|
|
202
202
|
}
|
|
203
203
|
|
|
204
204
|
ctx.restore();
|
package/core/CanvasFramework.js
CHANGED
|
@@ -687,6 +687,9 @@ class CanvasFramework {
|
|
|
687
687
|
beforeEnter: options.beforeEnter,
|
|
688
688
|
afterEnter: options.afterEnter,
|
|
689
689
|
beforeLeave: options.beforeLeave,
|
|
690
|
+
afterLeave: options.afterLeave, // ✅ NOUVEAU
|
|
691
|
+
onEnter: options.onEnter, // ✅ NOUVEAU (alias de afterEnter)
|
|
692
|
+
onLeave: options.onLeave, // ✅ NOUVEAU (alias de beforeLeave)
|
|
690
693
|
transition: options.transition || 'slide'
|
|
691
694
|
};
|
|
692
695
|
|
|
@@ -783,28 +786,55 @@ class CanvasFramework {
|
|
|
783
786
|
|
|
784
787
|
const { route, params, query, pathname } = match;
|
|
785
788
|
|
|
786
|
-
//
|
|
789
|
+
// ===== LIFECYCLE: AVANT DE QUITTER L'ANCIENNE ROUTE =====
|
|
790
|
+
|
|
791
|
+
// Hook beforeLeave de la route actuelle (peut bloquer la navigation)
|
|
787
792
|
const currentRouteData = this.routes.get(this.currentRoute);
|
|
788
793
|
if (currentRouteData?.beforeLeave) {
|
|
789
794
|
const canLeave = await currentRouteData.beforeLeave(this.currentParams, this.currentQuery);
|
|
790
|
-
if (canLeave === false)
|
|
795
|
+
if (canLeave === false) {
|
|
796
|
+
console.log('Navigation cancelled by beforeLeave hook');
|
|
797
|
+
return;
|
|
798
|
+
}
|
|
799
|
+
}
|
|
800
|
+
|
|
801
|
+
// ✅ NOUVEAU : Hook onLeave (alias plus intuitif de beforeLeave, mais ne bloque pas)
|
|
802
|
+
if (currentRouteData?.onLeave) {
|
|
803
|
+
await currentRouteData.onLeave(this.currentParams, this.currentQuery);
|
|
791
804
|
}
|
|
792
805
|
|
|
793
|
-
//
|
|
806
|
+
// ===== LIFECYCLE: AVANT D'ENTRER DANS LA NOUVELLE ROUTE =====
|
|
807
|
+
|
|
808
|
+
// Hook beforeEnter de la nouvelle route (peut bloquer la navigation)
|
|
794
809
|
if (route.beforeEnter) {
|
|
795
810
|
const canEnter = await route.beforeEnter(params, query);
|
|
796
|
-
if (canEnter === false)
|
|
811
|
+
if (canEnter === false) {
|
|
812
|
+
console.log('Navigation cancelled by beforeEnter hook');
|
|
813
|
+
return;
|
|
814
|
+
}
|
|
815
|
+
}
|
|
816
|
+
|
|
817
|
+
// ✅ NOUVEAU : Hook onEnter (appelé juste avant de créer les composants)
|
|
818
|
+
if (route.onEnter) {
|
|
819
|
+
await route.onEnter(params, query);
|
|
797
820
|
}
|
|
798
821
|
|
|
799
|
-
//
|
|
822
|
+
// ===== SAUVEGARDER L'ÉTAT ACTUEL =====
|
|
823
|
+
|
|
824
|
+
// Sauvegarder l'ancienne route pour l'animation et les hooks
|
|
800
825
|
const oldComponents = [...this.components];
|
|
826
|
+
const oldRoute = this.currentRoute;
|
|
827
|
+
const oldParams = { ...this.currentParams };
|
|
828
|
+
const oldQuery = { ...this.currentQuery };
|
|
801
829
|
|
|
802
|
-
//
|
|
830
|
+
// ===== METTRE À JOUR L'ÉTAT =====
|
|
831
|
+
|
|
803
832
|
this.currentRoute = pathname;
|
|
804
833
|
this.currentParams = params;
|
|
805
834
|
this.currentQuery = query;
|
|
806
835
|
|
|
807
|
-
//
|
|
836
|
+
// ===== GÉRER L'HISTORIQUE =====
|
|
837
|
+
|
|
808
838
|
if (!replace) {
|
|
809
839
|
this.historyIndex++;
|
|
810
840
|
this.history = this.history.slice(0, this.historyIndex);
|
|
@@ -819,28 +849,48 @@ class CanvasFramework {
|
|
|
819
849
|
} else {
|
|
820
850
|
this.history[this.historyIndex] = { path, params, query, state };
|
|
821
851
|
window.history.replaceState(
|
|
822
|
-
|
|
852
|
+
{ route: path, params, query, state },
|
|
823
853
|
'',
|
|
824
854
|
path
|
|
825
855
|
);
|
|
826
856
|
}
|
|
827
857
|
|
|
828
|
-
//
|
|
858
|
+
// ===== CRÉER LES NOUVEAUX COMPOSANTS =====
|
|
859
|
+
|
|
829
860
|
this.components = [];
|
|
830
861
|
if (typeof route.component === 'function') {
|
|
831
862
|
route.component(this, params, query);
|
|
832
863
|
}
|
|
833
864
|
|
|
834
|
-
//
|
|
865
|
+
// ===== LANCER L'ANIMATION DE TRANSITION =====
|
|
866
|
+
|
|
835
867
|
if (animate && !this.transitionState.isTransitioning) {
|
|
836
868
|
const transitionType = transition || route.transition || 'slide';
|
|
837
869
|
this.startTransition(oldComponents, this.components, transitionType, direction);
|
|
838
870
|
}
|
|
839
871
|
|
|
840
|
-
//
|
|
872
|
+
// ===== LIFECYCLE: APRÈS ÊTRE ENTRÉ DANS LA NOUVELLE ROUTE =====
|
|
873
|
+
|
|
874
|
+
// Hook afterEnter (appelé immédiatement après la création des composants)
|
|
841
875
|
if (route.afterEnter) {
|
|
842
876
|
route.afterEnter(params, query);
|
|
843
877
|
}
|
|
878
|
+
|
|
879
|
+
// ✅ NOUVEAU : Hook afterLeave de l'ancienne route (après transition complète)
|
|
880
|
+
if (currentRouteData?.afterLeave) {
|
|
881
|
+
// Si animation, attendre la fin de la transition
|
|
882
|
+
if (animate && this.transitionState.isTransitioning) {
|
|
883
|
+
setTimeout(() => {
|
|
884
|
+
currentRouteData.afterLeave(oldParams, oldQuery);
|
|
885
|
+
}, this.transitionState.duration || 300);
|
|
886
|
+
} else {
|
|
887
|
+
// Pas d'animation, appeler immédiatement
|
|
888
|
+
currentRouteData.afterLeave(oldParams, oldQuery);
|
|
889
|
+
}
|
|
890
|
+
}
|
|
891
|
+
|
|
892
|
+
// ✅ OPTIONNEL : Marquer les composants comme "dirty" pour forcer le rendu
|
|
893
|
+
this._maxScrollDirty = true;
|
|
844
894
|
}
|
|
845
895
|
|
|
846
896
|
/**
|
package/index.js
CHANGED
|
@@ -84,6 +84,15 @@ export { default as AnimationEngine } from './utils/AnimationEngine.js';
|
|
|
84
84
|
export { default as CryptoManager } from './utils/CryptoManager.js';
|
|
85
85
|
export { default as NotificationManager } from './utils/NotificationManager.js';
|
|
86
86
|
export { default as DevTools } from './utils/DevTools.js';
|
|
87
|
+
export { default as FirebaseStorage } from './utils/FirebaseStorage.js';
|
|
88
|
+
export { default as FirebaseAuth } from './utils/FirebaseAuth.js';
|
|
89
|
+
export { default as FirebaseCore } from './utils/FirebaseCore.js';
|
|
90
|
+
export { default as FirebaseFirestore } from './utils/FirebaseFirestore.js';
|
|
91
|
+
export { default as FirebaseFunctions } from './utils/FirebaseFunctions.js';
|
|
92
|
+
export { default as FirebaseRealtimeDB } from './utils/FirebaseRealtimeDB.js';
|
|
93
|
+
export { default as PayPalPayment } from './utils/PayPalPayment.js';
|
|
94
|
+
export { default as StripePayment } from './utils/StripePayment.js';
|
|
95
|
+
|
|
87
96
|
|
|
88
97
|
// Features
|
|
89
98
|
export { default as PullToRefresh } from './features/PullToRefresh.js';
|
|
@@ -107,7 +116,7 @@ export { default as FeatureFlags } from './manager/FeatureFlags.js';
|
|
|
107
116
|
|
|
108
117
|
// Version du framework
|
|
109
118
|
|
|
110
|
-
export const VERSION = '0.
|
|
119
|
+
export const VERSION = '0.4.4';
|
|
111
120
|
|
|
112
121
|
|
|
113
122
|
|