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,337 +0,0 @@
1
- import Component from '../core/Component.js';
2
-
3
- /**
4
- * Dialog Material (Android) & Cupertino (iOS)
5
- */
6
- class Dialog extends Component {
7
- constructor(framework, options = {}) {
8
- super(framework, {
9
- x: 0,
10
- y: 0,
11
- width: framework.width,
12
- height: framework.height,
13
- visible: false
14
- });
15
-
16
- this.platform = framework.platform;
17
-
18
- this.title = options.title || '';
19
- this.message = options.message || '';
20
- this.buttons = options.buttons || ['OK'];
21
- this.onButtonClick = options.onButtonClick;
22
-
23
- this.dialogWidth = Math.min(320, framework.width - 40);
24
- this.dialogHeight = 160;
25
- this.opacity = 0;
26
-
27
- this.isVisible = false;
28
- this.buttonRects = [];
29
-
30
- /* Ripple Android uniquement */
31
- this.ripples = [];
32
- this._animating = false;
33
-
34
- this.onPress = this.handlePress.bind(this);
35
-
36
- this.messageLines = this.wrapText(
37
- this.message,
38
- this.dialogWidth - 48,
39
- '16px -apple-system, Roboto, sans-serif'
40
- );
41
-
42
- if (this.messageLines.length > 2) {
43
- this.dialogHeight += (this.messageLines.length - 2) * 22;
44
- }
45
- }
46
-
47
- /* ---------------- DRAW ---------------- */
48
-
49
- draw(ctx) {
50
- if (!this.isVisible || this.opacity <= 0) return;
51
-
52
- ctx.save();
53
- ctx.globalAlpha = this.opacity;
54
-
55
- // Overlay
56
- ctx.fillStyle = 'rgba(0,0,0,0.5)';
57
- ctx.fillRect(0, 0, this.framework.width, this.framework.height);
58
-
59
- if (this.platform === 'material') {
60
- this.drawMaterial(ctx);
61
- } else {
62
- this.drawCupertino(ctx); // 👈 TON DESIGN INITIAL
63
- }
64
-
65
- ctx.restore();
66
- }
67
-
68
- /* ---------------- MATERIAL (ANDROID) ---------------- */
69
-
70
- drawMaterial(ctx) {
71
- const x = (this.framework.width - this.dialogWidth) / 2;
72
- const y = (this.framework.height - this.dialogHeight) / 2;
73
-
74
- // Card
75
- ctx.fillStyle = '#FFF';
76
- ctx.shadowColor = 'rgba(0,0,0,0.25)';
77
- ctx.shadowBlur = 12;
78
- this.roundRect(ctx, x, y, this.dialogWidth, this.dialogHeight, 6);
79
- ctx.fill();
80
- ctx.shadowColor = 'transparent';
81
-
82
- // Title
83
- ctx.fillStyle = '#000';
84
- ctx.font = '500 20px Roboto, sans-serif';
85
- ctx.textAlign = 'left';
86
- ctx.fillText(this.title, x + 24, y + 36);
87
-
88
- // Message
89
- ctx.fillStyle = '#444';
90
- ctx.font = '16px Roboto, sans-serif';
91
- for (let i = 0; i < this.messageLines.length; i++) {
92
- ctx.fillText(this.messageLines[i], x + 24, y + 70 + i * 22);
93
- }
94
-
95
- // Buttons
96
- this.buttonRects = [];
97
- let btnX = x + this.dialogWidth - 16;
98
- const btnY = y + this.dialogHeight - 28;
99
-
100
- ctx.font = '500 14px Roboto, sans-serif';
101
-
102
- for (let i = this.buttons.length - 1; i >= 0; i--) {
103
- const text = this.buttons[i];
104
- const w = ctx.measureText(text).width + 24;
105
-
106
- btnX -= w;
107
-
108
- const rect = {
109
- x: btnX,
110
- y: btnY - 18,
111
- width: w,
112
- height: 36,
113
- index: i
114
- };
115
- this.buttonRects[i] = rect;
116
-
117
- // Ripple
118
- ctx.save();
119
- ctx.beginPath();
120
- ctx.rect(rect.x, rect.y, rect.width, rect.height);
121
- ctx.clip();
122
-
123
- for (const r of this.ripples) {
124
- if (r.index === i) {
125
- ctx.globalAlpha = r.alpha;
126
- ctx.fillStyle = 'rgba(98,0,238,0.25)';
127
- ctx.beginPath();
128
- ctx.arc(r.x, r.y, r.radius, 0, Math.PI * 2);
129
- ctx.fill();
130
- }
131
- }
132
- ctx.restore();
133
-
134
- ctx.fillStyle = '#6200EE';
135
- ctx.textAlign = 'center';
136
- ctx.fillText(text, btnX + w / 2, btnY);
137
-
138
- btnX -= 8;
139
- }
140
- }
141
-
142
- /* ---------------- CUPERTINO (iOS) — DESIGN ORIGINAL ---------------- */
143
-
144
- drawCupertino(ctx) {
145
- const x = (this.framework.width - this.dialogWidth) / 2;
146
- const y = (this.framework.height - this.dialogHeight) / 2;
147
-
148
- // Dialog
149
- ctx.fillStyle = '#FFF';
150
- ctx.shadowColor = 'rgba(0,0,0,0.3)';
151
- ctx.shadowBlur = 20;
152
- this.roundRect(ctx, x, y, this.dialogWidth, this.dialogHeight, 12);
153
- ctx.fill();
154
- ctx.shadowColor = 'transparent';
155
-
156
- // Title
157
- ctx.fillStyle = '#000';
158
- ctx.font = '600 18px -apple-system, sans-serif';
159
- ctx.textAlign = 'center';
160
- ctx.fillText(this.title, x + this.dialogWidth / 2, y + 38);
161
-
162
- // Message
163
- ctx.fillStyle = '#666';
164
- ctx.font = '16px -apple-system, sans-serif';
165
- for (let i = 0; i < this.messageLines.length; i++) {
166
- ctx.fillText(
167
- this.messageLines[i],
168
- x + this.dialogWidth / 2,
169
- y + 72 + i * 22
170
- );
171
- }
172
-
173
- // Divider
174
- const dividerY = y + this.dialogHeight - 54;
175
- ctx.strokeStyle = '#E5E5EA';
176
- ctx.beginPath();
177
- ctx.moveTo(x, dividerY);
178
- ctx.lineTo(x + this.dialogWidth, dividerY);
179
- ctx.stroke();
180
-
181
- // Buttons
182
- this.buttonRects = [];
183
- const btnW = this.dialogWidth / this.buttons.length;
184
- const btnH = 54;
185
-
186
- for (let i = 0; i < this.buttons.length; i++) {
187
- const bx = x + i * btnW;
188
- const by = dividerY;
189
-
190
- this.buttonRects.push({
191
- x: bx,
192
- y: by,
193
- width: btnW,
194
- height: btnH
195
- });
196
-
197
- ctx.fillStyle =
198
- i === this.buttons.length - 1 ? '#007AFF' : '#8E8E93';
199
-
200
- ctx.font = '600 17px -apple-system, sans-serif';
201
- ctx.textAlign = 'center';
202
- ctx.fillText(this.buttons[i], bx + btnW / 2, by + btnH / 2);
203
-
204
- if (i < this.buttons.length - 1) {
205
- ctx.strokeStyle = '#E5E5EA';
206
- ctx.beginPath();
207
- ctx.moveTo(bx + btnW, by);
208
- ctx.lineTo(bx + btnW, by + btnH);
209
- ctx.stroke();
210
- }
211
- }
212
- }
213
-
214
- /* ---------------- INTERACTION ---------------- */
215
-
216
- handlePress(x, y) {
217
- for (let i = 0; i < this.buttonRects.length; i++) {
218
- const r = this.buttonRects[i];
219
- if (
220
- x >= r.x && x <= r.x + r.width &&
221
- y >= r.y && y <= r.y + r.height
222
- ) {
223
- if (this.platform === 'material') {
224
- const max = Math.max(r.width, r.height) * 1.4;
225
- this.ripples.push({
226
- index: i,
227
- x,
228
- y,
229
- radius: 0,
230
- alpha: 0.35,
231
- max
232
- });
233
- this.animateRipples();
234
- }
235
-
236
- setTimeout(() => {
237
- this.onButtonClick?.(i, this.buttons[i]);
238
- this.hide();
239
- }, 120);
240
- return;
241
- }
242
- }
243
-
244
- this.hide();
245
- }
246
-
247
- animateRipples() {
248
- if (this._animating) return;
249
- this._animating = true;
250
-
251
- const step = () => {
252
- let active = false;
253
-
254
- for (const r of this.ripples) {
255
- r.radius += r.max * 0.12;
256
- r.alpha -= 0.04;
257
- if (r.alpha > 0) active = true;
258
- }
259
-
260
- this.ripples = this.ripples.filter(r => r.alpha > 0);
261
-
262
- if (active) requestAnimationFrame(step);
263
- else this._animating = false;
264
- };
265
-
266
- requestAnimationFrame(step);
267
- }
268
-
269
- /* ---------------- SHOW / HIDE ---------------- */
270
-
271
- show() {
272
- this.isVisible = true;
273
- this.visible = true;
274
- this.opacity = 0;
275
-
276
- const fade = () => {
277
- this.opacity += 0.1;
278
- if (this.opacity < 1) requestAnimationFrame(fade);
279
- };
280
- fade();
281
- }
282
-
283
- hide() {
284
- const fade = () => {
285
- this.opacity -= 0.1;
286
- if (this.opacity > 0) requestAnimationFrame(fade);
287
- else {
288
- this.isVisible = false;
289
- this.visible = false;
290
- this.framework.remove(this);
291
- }
292
- };
293
- fade();
294
- }
295
-
296
- /* ---------------- UTILS ---------------- */
297
-
298
- wrapText(text, maxWidth, font) {
299
- const ctx = this.framework.ctx;
300
- ctx.font = font;
301
-
302
- const words = text.split(' ');
303
- const lines = [];
304
- let line = words[0];
305
-
306
- for (let i = 1; i < words.length; i++) {
307
- const test = line + ' ' + words[i];
308
- if (ctx.measureText(test).width < maxWidth) line = test;
309
- else {
310
- lines.push(line);
311
- line = words[i];
312
- }
313
- }
314
- lines.push(line);
315
- return lines;
316
- }
317
-
318
- roundRect(ctx, x, y, w, h, r) {
319
- ctx.beginPath();
320
- ctx.moveTo(x + r, y);
321
- ctx.lineTo(x + w - r, y);
322
- ctx.quadraticCurveTo(x + w, y, x + w, y + r);
323
- ctx.lineTo(x + w, y + h - r);
324
- ctx.quadraticCurveTo(x + w, y + h, x + w - r, y + h);
325
- ctx.lineTo(x + r, y + h);
326
- ctx.quadraticCurveTo(x, y + h, x, y + h - r);
327
- ctx.lineTo(x, y + r);
328
- ctx.quadraticCurveTo(x, y, x + r, y);
329
- ctx.closePath();
330
- }
331
-
332
- isPointInside() {
333
- return this.isVisible;
334
- }
335
- }
336
-
337
- export default Dialog;
@@ -1,125 +0,0 @@
1
- import Component from '../core/Component.js';
2
-
3
- /**
4
- * Séparateur visuel horizontal ou vertical
5
- * @class
6
- * @extends Component
7
- * @property {string} orientation - 'horizontal' ou 'vertical'
8
- * @property {number} thickness - Épaisseur du divider
9
- * @property {string} color - Couleur du divider
10
- * @property {number} margin - Marge autour du divider
11
- * @property {string} style - 'solid', 'dashed', ou 'dotted'
12
- * @property {boolean} hasInset - Si true, ajoute un inset pour les listes
13
- * @property {number} insetStart - Début de l'inset (px)
14
- * @property {string} variant - 'full', 'inset', 'middle'
15
- */
16
- class Divider extends Component {
17
- /**
18
- * Crée une instance de Divider
19
- * @param {CanvasFramework} framework - Framework parent
20
- * @param {Object} [options={}] - Options de configuration
21
- * @param {string} [options.orientation='horizontal'] - Orientation
22
- * @param {number} [options.thickness] - Épaisseur (auto selon platform)
23
- * @param {string} [options.color] - Couleur (auto selon platform)
24
- * @param {number} [options.margin=0] - Marge
25
- * @param {string} [options.style='solid'] - Style de ligne
26
- * @param {string} [options.variant='full'] - Variante
27
- * @param {number} [options.insetStart=16] - Début de l'inset
28
- */
29
- constructor(framework, options = {}) {
30
- super(framework, options);
31
-
32
- this.orientation = options.orientation || 'horizontal';
33
- this.margin = options.margin || 0;
34
- this.style = options.style || 'solid';
35
- this.variant = options.variant || 'full';
36
- this.insetStart = options.insetStart || 16;
37
-
38
- const platform = framework.platform;
39
-
40
- // Styles selon la plateforme
41
- if (platform === 'material') {
42
- this.thickness = options.thickness || 1;
43
- this.color = options.color || 'rgba(0, 0, 0, 0.12)';
44
- } else {
45
- this.thickness = options.thickness || 0.5;
46
- this.color = options.color || 'rgba(60, 60, 67, 0.29)';
47
- }
48
-
49
- // Ajuster les dimensions selon l'orientation
50
- if (this.orientation === 'horizontal') {
51
- this.height = this.thickness + (this.margin * 2);
52
- } else {
53
- this.width = this.thickness + (this.margin * 2);
54
- }
55
- }
56
-
57
- /**
58
- * Dessine le divider
59
- * @param {CanvasRenderingContext2D} ctx - Contexte de dessin
60
- */
61
- draw(ctx) {
62
- ctx.save();
63
-
64
- let startX = this.x;
65
- let startY = this.y;
66
- let endX = this.x;
67
- let endY = this.y;
68
-
69
- if (this.orientation === 'horizontal') {
70
- startX = this.x;
71
- endX = this.x + this.width;
72
- startY = endY = this.y + this.margin + this.thickness / 2;
73
-
74
- // Variantes
75
- if (this.variant === 'inset') {
76
- startX += this.insetStart;
77
- } else if (this.variant === 'middle') {
78
- const inset = this.width * 0.1;
79
- startX += inset;
80
- endX -= inset;
81
- }
82
- } else {
83
- startY = this.y;
84
- endY = this.y + this.height;
85
- startX = endX = this.x + this.margin + this.thickness / 2;
86
-
87
- // Variantes
88
- if (this.variant === 'inset') {
89
- startY += this.insetStart;
90
- } else if (this.variant === 'middle') {
91
- const inset = this.height * 0.1;
92
- startY += inset;
93
- endY -= inset;
94
- }
95
- }
96
-
97
- ctx.strokeStyle = this.color;
98
- ctx.lineWidth = this.thickness;
99
-
100
- // Styles de ligne
101
- if (this.style === 'dashed') {
102
- ctx.setLineDash([8, 4]);
103
- } else if (this.style === 'dotted') {
104
- ctx.setLineDash([2, 4]);
105
- }
106
-
107
- ctx.beginPath();
108
- ctx.moveTo(startX, startY);
109
- ctx.lineTo(endX, endY);
110
- ctx.stroke();
111
-
112
- ctx.setLineDash([]);
113
- ctx.restore();
114
- }
115
-
116
- /**
117
- * Vérifie si un point est dans les limites (non cliquable)
118
- * @returns {boolean} Toujours false
119
- */
120
- isPointInside() {
121
- return false;
122
- }
123
- }
124
-
125
- export default Divider;