canvasframework 0.5.16 → 0.5.18

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.
Files changed (112) hide show
  1. package/dist/canvasframework.js +2 -0
  2. package/dist/canvasframework.js.LICENSE.txt +1 -0
  3. package/package.json +18 -17
  4. package/components/Accordion.js +0 -265
  5. package/components/AndroidDatePickerDialog.js +0 -406
  6. package/components/AppBar.js +0 -398
  7. package/components/AudioPlayer.js +0 -611
  8. package/components/Avatar.js +0 -202
  9. package/components/Banner.js +0 -342
  10. package/components/BottomNavigationBar.js +0 -433
  11. package/components/BottomSheet.js +0 -234
  12. package/components/Button.js +0 -360
  13. package/components/Camera.js +0 -644
  14. package/components/Card.js +0 -193
  15. package/components/Chart.js +0 -700
  16. package/components/Checkbox.js +0 -166
  17. package/components/Chip.js +0 -212
  18. package/components/CircularProgress.js +0 -327
  19. package/components/ContextMenu.js +0 -116
  20. package/components/DatePicker.js +0 -298
  21. package/components/Dialog.js +0 -337
  22. package/components/Divider.js +0 -125
  23. package/components/Drawer.js +0 -276
  24. package/components/FAB.js +0 -270
  25. package/components/FileUpload.js +0 -315
  26. package/components/FloatedCamera.js +0 -644
  27. package/components/IOSDatePickerWheel.js +0 -430
  28. package/components/ImageCarousel.js +0 -219
  29. package/components/ImageComponent.js +0 -223
  30. package/components/Input.js +0 -831
  31. package/components/InputDatalist.js +0 -723
  32. package/components/InputTags.js +0 -624
  33. package/components/List.js +0 -95
  34. package/components/ListItem.js +0 -269
  35. package/components/Modal.js +0 -364
  36. package/components/MorphingFAB.js +0 -428
  37. package/components/MultiSelectDialog.js +0 -206
  38. package/components/NumberInput.js +0 -271
  39. package/components/PasswordInput.js +0 -462
  40. package/components/ProgressBar.js +0 -88
  41. package/components/QRCodeReader.js +0 -539
  42. package/components/RadioButton.js +0 -151
  43. package/components/SearchInput.js +0 -315
  44. package/components/SegmentedControl.js +0 -357
  45. package/components/Select.js +0 -199
  46. package/components/SelectDialog.js +0 -255
  47. package/components/Slider.js +0 -113
  48. package/components/SliverAppBar.js +0 -139
  49. package/components/Snackbar.js +0 -243
  50. package/components/SpeedDialFAB.js +0 -397
  51. package/components/Stepper.js +0 -281
  52. package/components/SwipeableListItem.js +0 -327
  53. package/components/Switch.js +0 -147
  54. package/components/Table.js +0 -492
  55. package/components/Tabs.js +0 -423
  56. package/components/Text.js +0 -141
  57. package/components/TextField.js +0 -151
  58. package/components/TimePicker.js +0 -934
  59. package/components/Toast.js +0 -236
  60. package/components/TreeView.js +0 -420
  61. package/components/Video.js +0 -397
  62. package/components/View.js +0 -140
  63. package/components/VirtualList.js +0 -120
  64. package/core/CanvasFramework.js +0 -3034
  65. package/core/Component.js +0 -243
  66. package/core/ThemeManager.js +0 -358
  67. package/core/UIBuilder.js +0 -267
  68. package/core/WebGLCanvasAdapter.js +0 -782
  69. package/features/Column.js +0 -43
  70. package/features/Grid.js +0 -47
  71. package/features/LayoutComponent.js +0 -43
  72. package/features/OpenStreetMap.js +0 -310
  73. package/features/Positioned.js +0 -33
  74. package/features/PullToRefresh.js +0 -328
  75. package/features/Row.js +0 -40
  76. package/features/SignaturePad.js +0 -257
  77. package/features/Skeleton.js +0 -193
  78. package/features/Stack.js +0 -21
  79. package/index.js +0 -119
  80. package/manager/AccessibilityManager.js +0 -107
  81. package/manager/ErrorHandler.js +0 -59
  82. package/manager/FeatureFlags.js +0 -60
  83. package/manager/MemoryManager.js +0 -107
  84. package/manager/PerformanceMonitor.js +0 -84
  85. package/manager/SecurityManager.js +0 -54
  86. package/utils/AnimationEngine.js +0 -734
  87. package/utils/CryptoManager.js +0 -303
  88. package/utils/DataStore.js +0 -403
  89. package/utils/DevTools.js +0 -1618
  90. package/utils/DevToolsConsole.js +0 -201
  91. package/utils/EventBus.js +0 -407
  92. package/utils/FetchClient.js +0 -74
  93. package/utils/FirebaseAuth.js +0 -653
  94. package/utils/FirebaseCore.js +0 -246
  95. package/utils/FirebaseFirestore.js +0 -581
  96. package/utils/FirebaseFunctions.js +0 -97
  97. package/utils/FirebaseRealtimeDB.js +0 -498
  98. package/utils/FirebaseStorage.js +0 -612
  99. package/utils/FormValidator.js +0 -355
  100. package/utils/GeoLocationService.js +0 -62
  101. package/utils/I18n.js +0 -207
  102. package/utils/IndexedDBManager.js +0 -273
  103. package/utils/InspectionOverlay.js +0 -308
  104. package/utils/NotificationManager.js +0 -60
  105. package/utils/OfflineSyncManager.js +0 -342
  106. package/utils/PayPalPayment.js +0 -678
  107. package/utils/QueryBuilder.js +0 -478
  108. package/utils/SafeArea.js +0 -64
  109. package/utils/SecureStorage.js +0 -289
  110. package/utils/StateManager.js +0 -207
  111. package/utils/StripePayment.js +0 -552
  112. package/utils/WebSocketClient.js +0 -66
@@ -1,342 +0,0 @@
1
- /**
2
- * Gestionnaire de synchronisation hors ligne
3
- * Queue les opérations offline et les sync quand online
4
- * @class
5
- * @property {Array} queue - File d'attente des opérations
6
- * @property {boolean} isOnline - État de connexion
7
- * @property {Map} syncHandlers - Handlers de sync par type
8
- */
9
- class OfflineSyncManager {
10
- /**
11
- * Crée une instance de OfflineSyncManager
12
- * @param {Object} [options={}] - Options
13
- * @param {string} [options.storageKey='offline_queue'] - Clé de stockage
14
- * @param {number} [options.retryDelay=5000] - Délai entre tentatives (ms)
15
- * @param {number} [options.maxRetries=3] - Tentatives max
16
- */
17
- constructor(options = {}) {
18
- this.storageKey = options.storageKey || 'offline_queue';
19
- this.retryDelay = options.retryDelay || 5000;
20
- this.maxRetries = options.maxRetries || 3;
21
-
22
- this.queue = [];
23
- this.isOnline = navigator.onLine;
24
- this.syncHandlers = new Map();
25
- this.isSyncing = false;
26
-
27
- // Charger la queue sauvegardée
28
- this.loadQueue();
29
-
30
- // Écouter les changements de connexion
31
- this.setupConnectionListeners();
32
- }
33
-
34
- /**
35
- * Configure les listeners de connexion
36
- * @private
37
- */
38
- setupConnectionListeners() {
39
- window.addEventListener('online', () => {
40
- console.log('🟢 Connection restored');
41
- this.isOnline = true;
42
- this.syncAll();
43
- });
44
-
45
- window.addEventListener('offline', () => {
46
- console.log('🔴 Connection lost');
47
- this.isOnline = false;
48
- });
49
- }
50
-
51
- /**
52
- * Enregistre un handler de sync
53
- * @param {string} type - Type d'opération
54
- * @param {Function} handler - Handler async (operation) => Promise
55
- */
56
- registerSyncHandler(type, handler) {
57
- this.syncHandlers.set(type, handler);
58
- }
59
-
60
- /**
61
- * Ajoute une opération à la queue
62
- * @param {string} type - Type d'opération
63
- * @param {Object} data - Données
64
- * @param {Object} [options={}] - Options
65
- * @returns {Promise<*>} Résultat
66
- */
67
- async queue(type, data, options = {}) {
68
- const operation = {
69
- id: this.generateId(),
70
- type,
71
- data,
72
- timestamp: Date.now(),
73
- retries: 0,
74
- status: 'pending',
75
- ...options
76
- };
77
-
78
- // Si online, essayer d'exécuter directement
79
- if (this.isOnline && !options.forceQueue) {
80
- try {
81
- const result = await this.executeOperation(operation);
82
- return result;
83
- } catch (error) {
84
- console.warn('Failed to execute immediately, queuing...', error);
85
- // Continuer pour ajouter à la queue
86
- }
87
- }
88
-
89
- // Ajouter à la queue
90
- this.queue.push(operation);
91
- this.saveQueue();
92
-
93
- console.log(`📋 Operation queued: ${type}`, operation.id);
94
-
95
- // Essayer de sync immédiatement si online
96
- if (this.isOnline) {
97
- this.syncAll();
98
- }
99
-
100
- return operation;
101
- }
102
-
103
- /**
104
- * Exécute une opération
105
- * @param {Object} operation - Opération
106
- * @returns {Promise<*>} Résultat
107
- * @private
108
- */
109
- async executeOperation(operation) {
110
- const handler = this.syncHandlers.get(operation.type);
111
-
112
- if (!handler) {
113
- throw new Error(`No sync handler for type: ${operation.type}`);
114
- }
115
-
116
- return await handler(operation.data);
117
- }
118
-
119
- /**
120
- * Synchronise toutes les opérations en attente
121
- * @returns {Promise<Object>} Résultats
122
- */
123
- async syncAll() {
124
- if (this.isSyncing || !this.isOnline) return;
125
-
126
- this.isSyncing = true;
127
- console.log('🔄 Starting sync...', this.queue.length, 'operations');
128
-
129
- const results = {
130
- success: [],
131
- failed: [],
132
- skipped: []
133
- };
134
-
135
- // Trier par timestamp (FIFO)
136
- this.queue.sort((a, b) => a.timestamp - b.timestamp);
137
-
138
- for (let i = 0; i < this.queue.length; i++) {
139
- const operation = this.queue[i];
140
-
141
- if (operation.status === 'success') {
142
- results.skipped.push(operation);
143
- continue;
144
- }
145
-
146
- try {
147
- console.log(`⏳ Syncing: ${operation.type}`, operation.id);
148
-
149
- const result = await this.executeOperation(operation);
150
-
151
- operation.status = 'success';
152
- operation.result = result;
153
- operation.syncedAt = Date.now();
154
-
155
- results.success.push(operation);
156
- console.log(`✅ Synced: ${operation.type}`, operation.id);
157
-
158
- } catch (error) {
159
- operation.retries++;
160
- operation.lastError = error.message;
161
-
162
- if (operation.retries >= this.maxRetries) {
163
- operation.status = 'failed';
164
- results.failed.push(operation);
165
- console.error(`❌ Failed permanently: ${operation.type}`, operation.id);
166
- } else {
167
- operation.status = 'pending';
168
- console.warn(`⚠️ Retry ${operation.retries}/${this.maxRetries}:`, operation.type);
169
- }
170
- }
171
- }
172
-
173
- // Supprimer les opérations réussies de la queue
174
- this.queue = this.queue.filter(op => op.status !== 'success');
175
- this.saveQueue();
176
-
177
- this.isSyncing = false;
178
-
179
- console.log('✅ Sync complete:', results);
180
-
181
- // Réessayer les échecs après un délai
182
- if (results.failed.length > 0 || this.queue.length > 0) {
183
- setTimeout(() => this.syncAll(), this.retryDelay);
184
- }
185
-
186
- return results;
187
- }
188
-
189
- /**
190
- * Synchronise un type spécifique
191
- * @param {string} type - Type d'opération
192
- * @returns {Promise<Object>} Résultats
193
- */
194
- async syncType(type) {
195
- const operations = this.queue.filter(op => op.type === type && op.status !== 'success');
196
-
197
- const results = {
198
- success: [],
199
- failed: []
200
- };
201
-
202
- for (let operation of operations) {
203
- try {
204
- const result = await this.executeOperation(operation);
205
- operation.status = 'success';
206
- operation.result = result;
207
- results.success.push(operation);
208
- } catch (error) {
209
- operation.retries++;
210
- operation.lastError = error.message;
211
-
212
- if (operation.retries >= this.maxRetries) {
213
- operation.status = 'failed';
214
- results.failed.push(operation);
215
- }
216
- }
217
- }
218
-
219
- this.queue = this.queue.filter(op => op.status !== 'success');
220
- this.saveQueue();
221
-
222
- return results;
223
- }
224
-
225
- /**
226
- * Obtient les opérations en attente
227
- * @param {string} [type] - Filtrer par type
228
- * @returns {Array} Opérations
229
- */
230
- getPending(type) {
231
- if (type) {
232
- return this.queue.filter(op => op.type === type && op.status === 'pending');
233
- }
234
- return this.queue.filter(op => op.status === 'pending');
235
- }
236
-
237
- /**
238
- * Obtient les opérations échouées
239
- * @returns {Array} Opérations
240
- */
241
- getFailed() {
242
- return this.queue.filter(op => op.status === 'failed');
243
- }
244
-
245
- /**
246
- * Supprime une opération
247
- * @param {string} id - ID de l'opération
248
- * @returns {boolean} True si supprimé
249
- */
250
- remove(id) {
251
- const index = this.queue.findIndex(op => op.id === id);
252
-
253
- if (index > -1) {
254
- this.queue.splice(index, 1);
255
- this.saveQueue();
256
- return true;
257
- }
258
-
259
- return false;
260
- }
261
-
262
- /**
263
- * Réinitialise une opération échouée
264
- * @param {string} id - ID de l'opération
265
- */
266
- retry(id) {
267
- const operation = this.queue.find(op => op.id === id);
268
-
269
- if (operation) {
270
- operation.status = 'pending';
271
- operation.retries = 0;
272
- operation.lastError = null;
273
- this.saveQueue();
274
-
275
- if (this.isOnline) {
276
- this.syncAll();
277
- }
278
- }
279
- }
280
-
281
- /**
282
- * Vide la queue
283
- */
284
- clear() {
285
- this.queue = [];
286
- this.saveQueue();
287
- }
288
-
289
- /**
290
- * Sauvegarde la queue
291
- * @private
292
- */
293
- saveQueue() {
294
- try {
295
- localStorage.setItem(this.storageKey, JSON.stringify(this.queue));
296
- } catch (error) {
297
- console.error('Failed to save queue:', error);
298
- }
299
- }
300
-
301
- /**
302
- * Charge la queue
303
- * @private
304
- */
305
- loadQueue() {
306
- try {
307
- const saved = localStorage.getItem(this.storageKey);
308
- if (saved) {
309
- this.queue = JSON.parse(saved);
310
- console.log('📋 Loaded queue:', this.queue.length, 'operations');
311
- }
312
- } catch (error) {
313
- console.error('Failed to load queue:', error);
314
- this.queue = [];
315
- }
316
- }
317
-
318
- /**
319
- * Génère un ID unique
320
- * @returns {string} ID
321
- * @private
322
- */
323
- generateId() {
324
- return `${Date.now()}-${Math.random().toString(36).substr(2, 9)}`;
325
- }
326
-
327
- /**
328
- * Obtient les statistiques
329
- * @returns {Object} Stats
330
- */
331
- getStats() {
332
- return {
333
- total: this.queue.length,
334
- pending: this.queue.filter(op => op.status === 'pending').length,
335
- failed: this.queue.filter(op => op.status === 'failed').length,
336
- isOnline: this.isOnline,
337
- isSyncing: this.isSyncing
338
- };
339
- }
340
- }
341
-
342
- export default OfflineSyncManager;