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,271 +0,0 @@
1
- import Component from '../core/Component.js';
2
- /**
3
- * Champ de saisie numérique avec support multi-plateforme et validation
4
- * @class
5
- * @extends Component
6
- * @param {Framework} framework - Instance du framework
7
- * @param {Object} [options={}] - Options de configuration
8
- * @param {number} [options.value=0] - Valeur initiale
9
- * @param {number} [options.min] - Valeur minimale
10
- * @param {number} [options.max] - Valeur maximale
11
- * @param {number} [options.step=1] - Incrément/décrément
12
- * @param {string} [options.placeholder='0'] - Texte par défaut
13
- * @param {number} [options.fontSize=16] - Taille de police
14
- * @param {Function} [options.onChange] - Callback lors du changement de valeur
15
- * @param {number} [options.height] - Hauteur personnalisée (44 par défaut sur iOS)
16
- * @example
17
- * const numberInput = new NumberInput(framework, {
18
- * value: 10,
19
- * min: 0,
20
- * max: 100,
21
- * step: 5,
22
- * onChange: (value) => console.log('New value:', value)
23
- * });
24
- */
25
- class NumberInput extends Component {
26
- /**
27
- * @constructs NumberInput
28
- */
29
- constructor(framework, options = {}) {
30
- super(framework, options);
31
- /** @type {number|string} */
32
- this.value = options.value || 0;
33
- /** @type {number|undefined} */
34
- this.min = options.min;
35
- /** @type {number|undefined} */
36
- this.max = options.max;
37
- /** @type {number} */
38
- this.step = options.step || 1;
39
- /** @type {string} */
40
- this.placeholder = options.placeholder || '0';
41
- /** @type {string} */
42
- this.platform = framework.platform;
43
- /** @type {boolean} */
44
- this.focused = false;
45
- /** @type {number} */
46
- this.fontSize = options.fontSize || 16;
47
- /** @type {Function|undefined} */
48
- this.onChange = options.onChange;
49
-
50
- // Ajuster la hauteur pour iOS
51
- if (this.platform === 'cupertino') {
52
- this.height = options.height || 44;
53
- }
54
-
55
- this.onFocus = this.handleFocus.bind(this);
56
- this.onBlur = this.handleBlur.bind(this);
57
-
58
- // CRÉER UN INPUT CACHÉ UNIQUE POUR CETTE INSTANCE
59
- /** @type {string} */
60
- this.hiddenInputId = `hidden-number-input-${Math.random().toString(36).substr(2, 9)}`;
61
- this.setupHiddenInput();
62
- }
63
-
64
- /**
65
- * Configure l'input caché dans le DOM pour la saisie clavier
66
- * @private
67
- */
68
- setupHiddenInput() {
69
- // Créer un input caché unique pour cette instance
70
- const hiddenInput = document.createElement('input');
71
- hiddenInput.id = this.hiddenInputId;
72
- hiddenInput.type = 'number';
73
- hiddenInput.style.position = 'absolute';
74
- hiddenInput.style.opacity = '0';
75
- hiddenInput.style.width = '1px';
76
- hiddenInput.style.height = '1px';
77
- hiddenInput.style.left = '-9999px';
78
- hiddenInput.style.top = '0px';
79
- hiddenInput.style.fontSize = '16px'; // Forcer la taille de police
80
-
81
- // Appliquer les contraintes
82
- if (this.min !== undefined) hiddenInput.min = this.min;
83
- if (this.max !== undefined) hiddenInput.max = this.max;
84
- if (this.step) hiddenInput.step = this.step;
85
-
86
- document.body.appendChild(hiddenInput);
87
-
88
- hiddenInput.addEventListener('input', (e) => {
89
- if (this.focused) {
90
- let newValue = parseFloat(e.target.value);
91
-
92
- // Gérer les valeurs vides
93
- if (isNaN(newValue)) {
94
- newValue = '';
95
- } else {
96
- // Appliquer min/max
97
- if (this.min !== undefined) newValue = Math.max(this.min, newValue);
98
- if (this.max !== undefined) newValue = Math.min(this.max, newValue);
99
- }
100
-
101
- this.value = newValue;
102
-
103
- if (this.onChange) this.onChange(this.value);
104
- }
105
- });
106
-
107
- hiddenInput.addEventListener('blur', () => {
108
- this.handleBlur();
109
- });
110
-
111
- hiddenInput.addEventListener('keypress', (e) => {
112
- if (e.key === 'Enter') {
113
- this.handleBlur();
114
- }
115
- });
116
-
117
- /** @type {HTMLInputElement} */
118
- this.hiddenInput = hiddenInput;
119
- }
120
-
121
- /**
122
- * Gère le focus sur le champ
123
- */
124
- handleFocus() {
125
- if (!this.hiddenInput) return;
126
-
127
- this.focused = true;
128
- this.cursorVisible = true;
129
-
130
- // Positionner et configurer l'input
131
- const adjustedY = this.y + this.framework.scrollOffset;
132
-
133
- // Sur mobile, on veut forcer le clavier numérique
134
- this.hiddenInput.type = 'number';
135
- this.hiddenInput.inputMode = 'decimal';
136
- this.hiddenInput.pattern = '[0-9]*';
137
-
138
- // Définir la valeur actuelle
139
- this.hiddenInput.value = this.value !== null && this.value !== undefined ? this.value : '';
140
-
141
- // Forcer le focus avec un délai pour éviter les problèmes de rendu
142
- setTimeout(() => {
143
- this.hiddenInput.focus();
144
- }, 50);
145
- }
146
-
147
- /**
148
- * Gère la perte de focus
149
- */
150
- handleBlur() {
151
- this.focused = false;
152
- this.cursorVisible = false;
153
-
154
- // S'assurer que la valeur est valide
155
- if (this.hiddenInput && this.hiddenInput.value !== '') {
156
- let val = parseFloat(this.hiddenInput.value);
157
- if (!isNaN(val)) {
158
- if (this.min !== undefined) val = Math.max(this.min, val);
159
- if (this.max !== undefined) val = Math.min(this.max, val);
160
- this.value = val;
161
- }
162
- }
163
- }
164
-
165
- /**
166
- * Gère le clic sur le champ
167
- */
168
- onClick() {
169
- this.handleFocus();
170
- }
171
-
172
- /**
173
- * Dessine le champ de saisie
174
- * @param {CanvasRenderingContext2D} ctx - Contexte de dessin
175
- */
176
- draw(ctx) {
177
- ctx.save();
178
-
179
- const displayValue = this.value !== null && this.value !== undefined ?
180
- this.value.toString() : this.placeholder;
181
- const isPlaceholder = this.value === null || this.value === undefined || this.value === '';
182
-
183
- if (this.platform === 'material') {
184
- // Material Design NumberInput
185
- ctx.strokeStyle = this.focused ? '#6200EE' : '#CCCCCC';
186
- ctx.lineWidth = this.focused ? 2 : 1;
187
- ctx.beginPath();
188
- ctx.moveTo(this.x, this.y + this.height);
189
- ctx.lineTo(this.x + this.width, this.y + this.height);
190
- ctx.stroke();
191
-
192
- // Valeur
193
- ctx.fillStyle = isPlaceholder ? '#999999' : '#000000';
194
- ctx.font = `${this.fontSize}px Roboto, sans-serif`;
195
- ctx.textAlign = 'left';
196
- ctx.textBaseline = 'middle';
197
- ctx.fillText(displayValue, this.x + 2, this.y + this.height / 2);
198
-
199
- } else {
200
- // Cupertino NumberInput
201
- ctx.strokeStyle = this.focused ? '#007AFF' : '#C7C7CC';
202
- ctx.lineWidth = 1;
203
- ctx.beginPath();
204
- this.roundRect(ctx, this.x, this.y, this.width, this.height, 8);
205
- ctx.stroke();
206
-
207
- // Valeur
208
- ctx.fillStyle = isPlaceholder ? '#999999' : '#000000';
209
- ctx.font = `${this.fontSize}px -apple-system, sans-serif`;
210
- ctx.textAlign = 'left';
211
- ctx.textBaseline = 'middle';
212
- ctx.fillText(displayValue, this.x + 10, this.y + this.height / 2);
213
- }
214
-
215
- // Curseur
216
- if (this.focused && this.cursorVisible) {
217
- const textWidth = ctx.measureText(displayValue).width;
218
- ctx.fillStyle = this.platform === 'material' ? '#6200EE' : '#007AFF';
219
- ctx.fillRect(this.x + (this.platform === 'material' ? 2 : 10) + textWidth + 2,
220
- this.y + 10, 2, this.height - 20);
221
- }
222
-
223
- ctx.restore();
224
- }
225
-
226
- /**
227
- * Dessine un rectangle avec des coins arrondis
228
- * @param {CanvasRenderingContext2D} ctx - Contexte de dessin
229
- * @param {number} x - Position X
230
- * @param {number} y - Position Y
231
- * @param {number} width - Largeur
232
- * @param {number} height - Hauteur
233
- * @param {number} radius - Rayon des coins
234
- * @private
235
- */
236
- roundRect(ctx, x, y, width, height, radius) {
237
- ctx.beginPath();
238
- ctx.moveTo(x + radius, y);
239
- ctx.lineTo(x + width - radius, y);
240
- ctx.quadraticCurveTo(x + width, y, x + width, y + radius);
241
- ctx.lineTo(x + width, y + height - radius);
242
- ctx.quadraticCurveTo(x + width, y + height, x + width - radius, y + height);
243
- ctx.lineTo(x + radius, y + height);
244
- ctx.quadraticCurveTo(x, y + height, x, y + height - radius);
245
- ctx.lineTo(x, y + radius);
246
- ctx.quadraticCurveTo(x, y, x + radius, y);
247
- ctx.closePath();
248
- }
249
-
250
- /**
251
- * Vérifie si un point est à l'intérieur du composant
252
- * @param {number} x - Position X
253
- * @param {number} y - Position Y
254
- * @returns {boolean} True si le point est à l'intérieur
255
- */
256
- isPointInside(x, y) {
257
- return x >= this.x && x <= this.x + this.width &&
258
- y >= this.y && y <= this.y + this.height;
259
- }
260
-
261
- /**
262
- * Nettoie les ressources (supprime l'input caché du DOM)
263
- */
264
- destroy() {
265
- if (this.hiddenInput && this.hiddenInput.parentNode) {
266
- this.hiddenInput.parentNode.removeChild(this.hiddenInput);
267
- }
268
- }
269
- }
270
-
271
- export default NumberInput;