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.
- package/dist/canvasframework.js +2 -0
- package/dist/canvasframework.js.LICENSE.txt +1 -0
- package/package.json +18 -17
- package/components/Accordion.js +0 -265
- package/components/AndroidDatePickerDialog.js +0 -406
- package/components/AppBar.js +0 -398
- package/components/AudioPlayer.js +0 -611
- package/components/Avatar.js +0 -202
- package/components/Banner.js +0 -342
- package/components/BottomNavigationBar.js +0 -433
- package/components/BottomSheet.js +0 -234
- package/components/Button.js +0 -360
- package/components/Camera.js +0 -644
- package/components/Card.js +0 -193
- package/components/Chart.js +0 -700
- package/components/Checkbox.js +0 -166
- package/components/Chip.js +0 -212
- package/components/CircularProgress.js +0 -327
- package/components/ContextMenu.js +0 -116
- package/components/DatePicker.js +0 -298
- package/components/Dialog.js +0 -337
- package/components/Divider.js +0 -125
- package/components/Drawer.js +0 -276
- package/components/FAB.js +0 -270
- package/components/FileUpload.js +0 -315
- package/components/FloatedCamera.js +0 -644
- package/components/IOSDatePickerWheel.js +0 -430
- package/components/ImageCarousel.js +0 -219
- package/components/ImageComponent.js +0 -223
- package/components/Input.js +0 -831
- package/components/InputDatalist.js +0 -723
- package/components/InputTags.js +0 -624
- package/components/List.js +0 -95
- package/components/ListItem.js +0 -269
- package/components/Modal.js +0 -364
- package/components/MorphingFAB.js +0 -428
- package/components/MultiSelectDialog.js +0 -206
- package/components/NumberInput.js +0 -271
- package/components/PasswordInput.js +0 -462
- package/components/ProgressBar.js +0 -88
- package/components/QRCodeReader.js +0 -539
- package/components/RadioButton.js +0 -151
- package/components/SearchInput.js +0 -315
- package/components/SegmentedControl.js +0 -357
- package/components/Select.js +0 -199
- package/components/SelectDialog.js +0 -255
- package/components/Slider.js +0 -113
- package/components/SliverAppBar.js +0 -139
- package/components/Snackbar.js +0 -243
- package/components/SpeedDialFAB.js +0 -397
- package/components/Stepper.js +0 -281
- package/components/SwipeableListItem.js +0 -327
- package/components/Switch.js +0 -147
- package/components/Table.js +0 -492
- package/components/Tabs.js +0 -423
- package/components/Text.js +0 -141
- package/components/TextField.js +0 -151
- package/components/TimePicker.js +0 -934
- package/components/Toast.js +0 -236
- package/components/TreeView.js +0 -420
- package/components/Video.js +0 -397
- package/components/View.js +0 -140
- package/components/VirtualList.js +0 -120
- package/core/CanvasFramework.js +0 -3034
- package/core/Component.js +0 -243
- package/core/ThemeManager.js +0 -358
- package/core/UIBuilder.js +0 -267
- package/core/WebGLCanvasAdapter.js +0 -782
- package/features/Column.js +0 -43
- package/features/Grid.js +0 -47
- package/features/LayoutComponent.js +0 -43
- package/features/OpenStreetMap.js +0 -310
- package/features/Positioned.js +0 -33
- package/features/PullToRefresh.js +0 -328
- package/features/Row.js +0 -40
- package/features/SignaturePad.js +0 -257
- package/features/Skeleton.js +0 -193
- package/features/Stack.js +0 -21
- package/index.js +0 -119
- package/manager/AccessibilityManager.js +0 -107
- package/manager/ErrorHandler.js +0 -59
- package/manager/FeatureFlags.js +0 -60
- package/manager/MemoryManager.js +0 -107
- package/manager/PerformanceMonitor.js +0 -84
- package/manager/SecurityManager.js +0 -54
- package/utils/AnimationEngine.js +0 -734
- package/utils/CryptoManager.js +0 -303
- package/utils/DataStore.js +0 -403
- package/utils/DevTools.js +0 -1618
- package/utils/DevToolsConsole.js +0 -201
- package/utils/EventBus.js +0 -407
- package/utils/FetchClient.js +0 -74
- package/utils/FirebaseAuth.js +0 -653
- package/utils/FirebaseCore.js +0 -246
- package/utils/FirebaseFirestore.js +0 -581
- package/utils/FirebaseFunctions.js +0 -97
- package/utils/FirebaseRealtimeDB.js +0 -498
- package/utils/FirebaseStorage.js +0 -612
- package/utils/FormValidator.js +0 -355
- package/utils/GeoLocationService.js +0 -62
- package/utils/I18n.js +0 -207
- package/utils/IndexedDBManager.js +0 -273
- package/utils/InspectionOverlay.js +0 -308
- package/utils/NotificationManager.js +0 -60
- package/utils/OfflineSyncManager.js +0 -342
- package/utils/PayPalPayment.js +0 -678
- package/utils/QueryBuilder.js +0 -478
- package/utils/SafeArea.js +0 -64
- package/utils/SecureStorage.js +0 -289
- package/utils/StateManager.js +0 -207
- package/utils/StripePayment.js +0 -552
- package/utils/WebSocketClient.js +0 -66
package/features/Skeleton.js
DELETED
|
@@ -1,193 +0,0 @@
|
|
|
1
|
-
import Component from '../core/Component.js';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Composant Skeleton (placeholder animé pendant le chargement)
|
|
5
|
-
* @class
|
|
6
|
-
* @extends Component
|
|
7
|
-
* @param {Framework} framework - Instance du framework
|
|
8
|
-
* @param {Object} [options={}] - Options de configuration
|
|
9
|
-
* @param {string} [options.type='text'] - Type de skeleton ('text', 'circle', 'rectangle')
|
|
10
|
-
* @param {number} [options.animationDuration=1.5] - Durée de l'animation en secondes
|
|
11
|
-
* @example
|
|
12
|
-
* const skeleton = new Skeleton(framework, {
|
|
13
|
-
* type: 'text',
|
|
14
|
-
* width: 200,
|
|
15
|
-
* height: 100
|
|
16
|
-
* });
|
|
17
|
-
*/
|
|
18
|
-
class Skeleton extends Component {
|
|
19
|
-
/**
|
|
20
|
-
* @constructs Skeleton
|
|
21
|
-
*/
|
|
22
|
-
constructor(framework, options = {}) {
|
|
23
|
-
super(framework, options);
|
|
24
|
-
/** @type {string} */
|
|
25
|
-
this.type = options.type || 'text';
|
|
26
|
-
/** @type {number} */
|
|
27
|
-
this.animationDuration = (options.animationDuration || 1.5) * 1000; // en ms
|
|
28
|
-
/** @type {number} */
|
|
29
|
-
this.startTime = Date.now();
|
|
30
|
-
/** @type {number} */
|
|
31
|
-
this.borderRadius = options.borderRadius || 4;
|
|
32
|
-
|
|
33
|
-
this.startAnimation();
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
/**
|
|
37
|
-
* Démarre l'animation du skeleton
|
|
38
|
-
* @private
|
|
39
|
-
*/
|
|
40
|
-
startAnimation() {
|
|
41
|
-
const animate = () => {
|
|
42
|
-
if (!this.visible) {
|
|
43
|
-
requestAnimationFrame(animate);
|
|
44
|
-
return;
|
|
45
|
-
}
|
|
46
|
-
requestAnimationFrame(animate);
|
|
47
|
-
};
|
|
48
|
-
animate();
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
/**
|
|
52
|
-
* Calcule la progression de l'animation (0 à 1)
|
|
53
|
-
* @private
|
|
54
|
-
* @returns {number}
|
|
55
|
-
*/
|
|
56
|
-
getAnimationProgress() {
|
|
57
|
-
const elapsed = Date.now() - this.startTime;
|
|
58
|
-
const progress = (elapsed % this.animationDuration) / this.animationDuration;
|
|
59
|
-
return progress;
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
/**
|
|
63
|
-
* Crée le gradient shimmer diagonal style Ionic/Material
|
|
64
|
-
* @private
|
|
65
|
-
* @param {CanvasRenderingContext2D} ctx
|
|
66
|
-
* @param {number} x
|
|
67
|
-
* @param {number} y
|
|
68
|
-
* @param {number} width
|
|
69
|
-
* @param {number} height
|
|
70
|
-
* @returns {CanvasGradient}
|
|
71
|
-
*/
|
|
72
|
-
createShimmerGradient(ctx, x, y, width, height) {
|
|
73
|
-
const progress = this.getAnimationProgress();
|
|
74
|
-
|
|
75
|
-
// Calculer la diagonale pour l'effet
|
|
76
|
-
const diagonal = Math.sqrt(width * width + height * height);
|
|
77
|
-
|
|
78
|
-
// Position du gradient qui se déplace
|
|
79
|
-
const offset = diagonal * 2;
|
|
80
|
-
const position = -diagonal + (offset * progress);
|
|
81
|
-
|
|
82
|
-
// Angle à 45 degrés (de haut-gauche vers bas-droite)
|
|
83
|
-
const angle = Math.PI / 4;
|
|
84
|
-
const cos = Math.cos(angle);
|
|
85
|
-
const sin = Math.sin(angle);
|
|
86
|
-
|
|
87
|
-
const gradient = ctx.createLinearGradient(
|
|
88
|
-
x + position * cos,
|
|
89
|
-
y + position * sin,
|
|
90
|
-
x + (position + diagonal) * cos,
|
|
91
|
-
y + (position + diagonal) * sin
|
|
92
|
-
);
|
|
93
|
-
|
|
94
|
-
// Gradient blanc avec transparence (style Ionic/Material)
|
|
95
|
-
gradient.addColorStop(0, 'rgba(255, 255, 255, 0)');
|
|
96
|
-
gradient.addColorStop(0.5, 'rgba(255, 255, 255, 0.4)');
|
|
97
|
-
gradient.addColorStop(1, 'rgba(255, 255, 255, 0)');
|
|
98
|
-
|
|
99
|
-
return gradient;
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
/**
|
|
103
|
-
* Dessine un rectangle arrondi
|
|
104
|
-
* @private
|
|
105
|
-
*/
|
|
106
|
-
roundRect(ctx, x, y, width, height, radius) {
|
|
107
|
-
if (width < 2 * radius) radius = width / 2;
|
|
108
|
-
if (height < 2 * radius) radius = height / 2;
|
|
109
|
-
|
|
110
|
-
ctx.beginPath();
|
|
111
|
-
ctx.moveTo(x + radius, y);
|
|
112
|
-
ctx.arcTo(x + width, y, x + width, y + height, radius);
|
|
113
|
-
ctx.arcTo(x + width, y + height, x, y + height, radius);
|
|
114
|
-
ctx.arcTo(x, y + height, x, y, radius);
|
|
115
|
-
ctx.arcTo(x, y, x + width, y, radius);
|
|
116
|
-
ctx.closePath();
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
/**
|
|
120
|
-
* Dessine le skeleton avec l'effet shimmer Ionic/Material
|
|
121
|
-
* @param {CanvasRenderingContext2D} ctx - Contexte de dessin
|
|
122
|
-
*/
|
|
123
|
-
draw(ctx) {
|
|
124
|
-
ctx.save();
|
|
125
|
-
|
|
126
|
-
// Couleur de fond (gris clair Material)
|
|
127
|
-
const backgroundColor = '#e0e0e0';
|
|
128
|
-
|
|
129
|
-
switch(this.type) {
|
|
130
|
-
case 'circle':
|
|
131
|
-
// Dessiner le cercle de base
|
|
132
|
-
ctx.fillStyle = backgroundColor;
|
|
133
|
-
ctx.beginPath();
|
|
134
|
-
ctx.arc(this.x + this.width/2, this.y + this.height/2, this.width/2, 0, Math.PI * 2);
|
|
135
|
-
ctx.fill();
|
|
136
|
-
|
|
137
|
-
// Créer un clipping path pour le shimmer
|
|
138
|
-
ctx.beginPath();
|
|
139
|
-
ctx.arc(this.x + this.width/2, this.y + this.height/2, this.width/2, 0, Math.PI * 2);
|
|
140
|
-
ctx.clip();
|
|
141
|
-
|
|
142
|
-
// Appliquer le shimmer
|
|
143
|
-
ctx.fillStyle = this.createShimmerGradient(ctx, this.x, this.y, this.width, this.height);
|
|
144
|
-
ctx.fillRect(this.x, this.y, this.width, this.height);
|
|
145
|
-
break;
|
|
146
|
-
|
|
147
|
-
case 'text':
|
|
148
|
-
const lineHeight = 16;
|
|
149
|
-
const lineSpacing = 10;
|
|
150
|
-
const totalLineHeight = lineHeight + lineSpacing;
|
|
151
|
-
const lines = Math.floor(this.height / totalLineHeight);
|
|
152
|
-
|
|
153
|
-
for (let i = 0; i < lines; i++) {
|
|
154
|
-
const lineWidth = i === lines - 1 ? this.width * 0.6 : this.width;
|
|
155
|
-
const lineY = this.y + i * totalLineHeight;
|
|
156
|
-
|
|
157
|
-
// Fond de la ligne
|
|
158
|
-
ctx.fillStyle = backgroundColor;
|
|
159
|
-
this.roundRect(ctx, this.x, lineY, lineWidth, lineHeight, this.borderRadius);
|
|
160
|
-
ctx.fill();
|
|
161
|
-
|
|
162
|
-
// Shimmer sur la ligne
|
|
163
|
-
ctx.save();
|
|
164
|
-
this.roundRect(ctx, this.x, lineY, lineWidth, lineHeight, this.borderRadius);
|
|
165
|
-
ctx.clip();
|
|
166
|
-
|
|
167
|
-
ctx.fillStyle = this.createShimmerGradient(ctx, this.x, lineY, lineWidth, lineHeight);
|
|
168
|
-
ctx.fillRect(this.x - 100, lineY - 100, lineWidth + 200, lineHeight + 200);
|
|
169
|
-
ctx.restore();
|
|
170
|
-
}
|
|
171
|
-
break;
|
|
172
|
-
|
|
173
|
-
default:
|
|
174
|
-
// Rectangle de base
|
|
175
|
-
ctx.fillStyle = backgroundColor;
|
|
176
|
-
this.roundRect(ctx, this.x, this.y, this.width, this.height, this.borderRadius);
|
|
177
|
-
ctx.fill();
|
|
178
|
-
|
|
179
|
-
// Shimmer
|
|
180
|
-
ctx.save();
|
|
181
|
-
this.roundRect(ctx, this.x, this.y, this.width, this.height, this.borderRadius);
|
|
182
|
-
ctx.clip();
|
|
183
|
-
|
|
184
|
-
ctx.fillStyle = this.createShimmerGradient(ctx, this.x, this.y, this.width, this.height);
|
|
185
|
-
ctx.fillRect(this.x - 100, this.y - 100, this.width + 200, this.height + 200);
|
|
186
|
-
ctx.restore();
|
|
187
|
-
}
|
|
188
|
-
|
|
189
|
-
ctx.restore();
|
|
190
|
-
}
|
|
191
|
-
}
|
|
192
|
-
|
|
193
|
-
export default Skeleton;
|
package/features/Stack.js
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import LayoutComponent from './LayoutComponent.js';
|
|
2
|
-
|
|
3
|
-
class Stack extends LayoutComponent {
|
|
4
|
-
constructor(framework, options = {}) {
|
|
5
|
-
super(framework, options);
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
layoutRecursive() {
|
|
9
|
-
for (const child of this.children) {
|
|
10
|
-
child.layoutRecursive ? child.layoutRecursive() : child.layout?.();
|
|
11
|
-
}
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
draw(ctx) {
|
|
15
|
-
for (const child of this.children) {
|
|
16
|
-
child.draw(ctx);
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
export default Stack;
|
package/index.js
DELETED
|
@@ -1,119 +0,0 @@
|
|
|
1
|
-
// framework/index.js
|
|
2
|
-
|
|
3
|
-
// Core
|
|
4
|
-
export { default as CanvasFramework } from './core/CanvasFramework.js';
|
|
5
|
-
export { default as Component } from './core/Component.js';
|
|
6
|
-
export { default as ui, createRef } from './core/UIBuilder.js';
|
|
7
|
-
|
|
8
|
-
// Components
|
|
9
|
-
export { default as Button } from './components/Button.js';
|
|
10
|
-
export { default as SegmentedControl } from './components/SegmentedControl.js';
|
|
11
|
-
export { default as Input } from './components/Input.js';
|
|
12
|
-
export { default as Slider } from './components/Slider.js';
|
|
13
|
-
export { default as Text } from './components/Text.js';
|
|
14
|
-
export { default as View } from './components/View.js';
|
|
15
|
-
export { default as Card } from './components/Card.js';
|
|
16
|
-
export { default as FAB } from './components/FAB.js';
|
|
17
|
-
export { default as SpeedDialFAB } from './components/SpeedDialFAB.js';
|
|
18
|
-
export { default as MorphingFAB } from './components/MorphingFAB.js';
|
|
19
|
-
export { default as CircularProgress } from './components/CircularProgress.js';
|
|
20
|
-
export { default as ImageComponent } from './components/ImageComponent.js';
|
|
21
|
-
export { default as DatePicker } from './components/DatePicker.js';
|
|
22
|
-
export { default as IOSDatePickerWheel } from './components/IOSDatePickerWheel.js';
|
|
23
|
-
export { default as AndroidDatePickerDialog } from './components/AndroidDatePickerDialog.js';
|
|
24
|
-
export { default as Avatar } from './components/Avatar.js';
|
|
25
|
-
export { default as Snackbar } from './components/Snackbar.js';
|
|
26
|
-
export { default as BottomNavigationBar } from './components/BottomNavigationBar.js';
|
|
27
|
-
export { default as Video } from './components/Video.js';
|
|
28
|
-
export { default as Modal } from './components/Modal.js';
|
|
29
|
-
export { default as Drawer } from './components/Drawer.js';
|
|
30
|
-
export { default as AppBar } from './components/AppBar.js';
|
|
31
|
-
export { default as Chip } from './components/Chip.js';
|
|
32
|
-
export { default as Stepper } from './components/Stepper.js';
|
|
33
|
-
export { default as Accordion } from './components/Accordion.js';
|
|
34
|
-
export { default as Tabs } from './components/Tabs.js';
|
|
35
|
-
export { default as Switch } from './components/Switch.js';
|
|
36
|
-
export { default as ListItem } from './components/ListItem.js';
|
|
37
|
-
export { default as SwipeableListItem } from './components/SwipeableListItem.js';
|
|
38
|
-
export { default as List } from './components/List.js';
|
|
39
|
-
export { default as VirtualList } from './components/VirtualList.js';
|
|
40
|
-
export { default as BottomSheet } from './components/BottomSheet.js';
|
|
41
|
-
export { default as ProgressBar } from './components/ProgressBar.js';
|
|
42
|
-
export { default as RadioButton } from './components/RadioButton.js';
|
|
43
|
-
export { default as Dialog } from './components/Dialog.js';
|
|
44
|
-
export { default as ContextMenu } from './components/ContextMenu.js';
|
|
45
|
-
export { default as Checkbox } from './components/Checkbox.js';
|
|
46
|
-
export { default as Toast } from './components/Toast.js';
|
|
47
|
-
export { default as NumberInput } from './components/NumberInput.js';
|
|
48
|
-
export { default as TextField } from './components/TextField.js';
|
|
49
|
-
export { default as SelectDialog } from './components/SelectDialog.js';
|
|
50
|
-
export { default as Select } from './components/Select.js';
|
|
51
|
-
export { default as MultiSelectDialog } from './components/MultiSelectDialog.js';
|
|
52
|
-
export { default as Divider } from './components/Divider.js';
|
|
53
|
-
export { default as FileUpload } from './components/FileUpload.js';
|
|
54
|
-
export { default as Table } from './components/Table.js';
|
|
55
|
-
export { default as TreeView } from './components/TreeView.js';
|
|
56
|
-
export { default as SearchInput } from './components/SearchInput.js';
|
|
57
|
-
export { default as ImageCarousel } from './components/ImageCarousel.js';
|
|
58
|
-
export { default as PasswordInput } from './components/PasswordInput.js';
|
|
59
|
-
export { default as InputTags } from './components/InputTags.js';
|
|
60
|
-
export { default as InputDatalist } from './components/InputDatalist.js';
|
|
61
|
-
export { default as Banner } from './components/Banner.js';
|
|
62
|
-
export { default as Chart } from './components/Chart.js';
|
|
63
|
-
export { default as SliverAppBar } from './components/SliverAppBar.js';
|
|
64
|
-
export { default as AudioPlayer } from './components/AudioPlayer.js';
|
|
65
|
-
export { default as Camera } from './components/Camera.js';
|
|
66
|
-
export { default as FloatedCamera } from './components/FloatedCamera.js';
|
|
67
|
-
export { default as TimePicker } from './components/TimePicker.js';
|
|
68
|
-
export { default as QRCodeReader } from './components/QRCodeReader.js';
|
|
69
|
-
|
|
70
|
-
// Utils
|
|
71
|
-
export { default as SafeArea } from './utils/SafeArea.js';
|
|
72
|
-
export { default as StateManager } from './utils/StateManager.js';
|
|
73
|
-
export { default as I18n } from './utils/I18n.js';
|
|
74
|
-
export { default as SecureStorage } from './utils/SecureStorage.js';
|
|
75
|
-
export { default as FormValidator } from './utils/FormValidator.js';
|
|
76
|
-
export { default as DataStore } from './utils/DataStore.js';
|
|
77
|
-
export { default as EventBus } from './utils/EventBus.js';
|
|
78
|
-
export { default as IndexedDBManager } from './utils/IndexedDBManager.js';
|
|
79
|
-
export { default as QueryBuilder } from './utils/QueryBuilder.js';
|
|
80
|
-
export { default as OfflineSyncManager } from './utils/OfflineSyncManager.js';
|
|
81
|
-
export { default as FetchClient } from './utils/FetchClient.js';
|
|
82
|
-
export { default as GeoLocationService } from './utils/GeoLocationService.js';
|
|
83
|
-
export { default as WebSocketClient } from './utils/WebSocketClient.js';
|
|
84
|
-
export { default as AnimationEngine } from './utils/AnimationEngine.js';
|
|
85
|
-
export { default as CryptoManager } from './utils/CryptoManager.js';
|
|
86
|
-
export { default as NotificationManager } from './utils/NotificationManager.js';
|
|
87
|
-
export { default as DevTools } from './utils/DevTools.js';
|
|
88
|
-
export { default as FirebaseStorage } from './utils/FirebaseStorage.js';
|
|
89
|
-
export { default as FirebaseAuth } from './utils/FirebaseAuth.js';
|
|
90
|
-
export { default as FirebaseCore } from './utils/FirebaseCore.js';
|
|
91
|
-
export { default as FirebaseFirestore } from './utils/FirebaseFirestore.js';
|
|
92
|
-
export { default as FirebaseFunctions } from './utils/FirebaseFunctions.js';
|
|
93
|
-
export { default as FirebaseRealtimeDB } from './utils/FirebaseRealtimeDB.js';
|
|
94
|
-
export { default as PayPalPayment } from './utils/PayPalPayment.js';
|
|
95
|
-
export { default as StripePayment } from './utils/StripePayment.js';
|
|
96
|
-
|
|
97
|
-
// Features
|
|
98
|
-
export { default as PullToRefresh } from './features/PullToRefresh.js';
|
|
99
|
-
export { default as Skeleton } from './features/Skeleton.js';
|
|
100
|
-
export { default as SignaturePad } from './features/SignaturePad.js';
|
|
101
|
-
export { default as OpenStreetMap } from './features/OpenStreetMap.js';
|
|
102
|
-
export { default as LayoutComponent } from './features/LayoutComponent.js';
|
|
103
|
-
export { default as Grid } from './features/Grid.js';
|
|
104
|
-
export { default as Row } from './features/Row.js';
|
|
105
|
-
export { default as Column } from './features/Column.js';
|
|
106
|
-
export { default as Positioned } from './features/Positioned.js';
|
|
107
|
-
export { default as Stack } from './features/Stack.js';
|
|
108
|
-
|
|
109
|
-
// Manager
|
|
110
|
-
export { default as ErrorHandler } from './manager/ErrorHandler.js';
|
|
111
|
-
export { default as PerformanceMonitor } from './manager/PerformanceMonitor.js';
|
|
112
|
-
export { default as AccessibilityManager } from './manager/AccessibilityManager.js';
|
|
113
|
-
export { default as MemoryManager } from './manager/MemoryManager.js';
|
|
114
|
-
export { default as SecurityManager } from './manager/SecurityManager.js';
|
|
115
|
-
export { default as FeatureFlags } from './manager/FeatureFlags.js';
|
|
116
|
-
|
|
117
|
-
// Version du framework
|
|
118
|
-
|
|
119
|
-
export const VERSION = '0.5.13';
|
|
@@ -1,107 +0,0 @@
|
|
|
1
|
-
// ==========================================
|
|
2
|
-
// 3. ACCESSIBILITY (A11Y)
|
|
3
|
-
// ==========================================
|
|
4
|
-
|
|
5
|
-
class AccessibilityManager {
|
|
6
|
-
constructor(framework) {
|
|
7
|
-
this.framework = framework;
|
|
8
|
-
this.focusedComponent = null;
|
|
9
|
-
this.ariaLiveRegion = null;
|
|
10
|
-
this.setupAccessibility();
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
setupAccessibility() {
|
|
14
|
-
// Créer une région ARIA live pour les annonces
|
|
15
|
-
this.ariaLiveRegion = document.createElement('div');
|
|
16
|
-
this.ariaLiveRegion.setAttribute('role', 'status');
|
|
17
|
-
this.ariaLiveRegion.setAttribute('aria-live', 'polite');
|
|
18
|
-
this.ariaLiveRegion.setAttribute('aria-atomic', 'true');
|
|
19
|
-
this.ariaLiveRegion.style.position = 'absolute';
|
|
20
|
-
this.ariaLiveRegion.style.left = '-10000px';
|
|
21
|
-
this.ariaLiveRegion.style.width = '1px';
|
|
22
|
-
this.ariaLiveRegion.style.height = '1px';
|
|
23
|
-
this.ariaLiveRegion.style.overflow = 'hidden';
|
|
24
|
-
document.body.appendChild(this.ariaLiveRegion);
|
|
25
|
-
|
|
26
|
-
// Rendre le canvas accessible au clavier
|
|
27
|
-
this.framework.canvas.setAttribute('tabindex', '0');
|
|
28
|
-
this.framework.canvas.setAttribute('role', 'application');
|
|
29
|
-
this.framework.canvas.setAttribute('aria-label', 'Interactive canvas application');
|
|
30
|
-
|
|
31
|
-
// Navigation au clavier
|
|
32
|
-
this.framework.canvas.addEventListener('keydown', this.handleKeyDown.bind(this));
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
announce(message) {
|
|
36
|
-
this.ariaLiveRegion.textContent = message;
|
|
37
|
-
|
|
38
|
-
// Clear après 100ms pour permettre de ré-annoncer le même message
|
|
39
|
-
setTimeout(() => {
|
|
40
|
-
this.ariaLiveRegion.textContent = '';
|
|
41
|
-
}, 100);
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
handleKeyDown(e) {
|
|
45
|
-
const components = this.framework.components.filter(c => c.visible);
|
|
46
|
-
const currentIndex = components.indexOf(this.focusedComponent);
|
|
47
|
-
|
|
48
|
-
switch (e.key) {
|
|
49
|
-
case 'Tab':
|
|
50
|
-
e.preventDefault();
|
|
51
|
-
const nextIndex = e.shiftKey
|
|
52
|
-
? (currentIndex - 1 + components.length) % components.length
|
|
53
|
-
: (currentIndex + 1) % components.length;
|
|
54
|
-
|
|
55
|
-
this.focusComponent(components[nextIndex]);
|
|
56
|
-
break;
|
|
57
|
-
|
|
58
|
-
case 'Enter':
|
|
59
|
-
case ' ':
|
|
60
|
-
e.preventDefault();
|
|
61
|
-
if (this.focusedComponent && this.focusedComponent.onClick) {
|
|
62
|
-
this.focusedComponent.onClick();
|
|
63
|
-
this.announce(`Activated: ${this.getComponentLabel(this.focusedComponent)}`);
|
|
64
|
-
}
|
|
65
|
-
break;
|
|
66
|
-
|
|
67
|
-
case 'Escape':
|
|
68
|
-
e.preventDefault();
|
|
69
|
-
this.blur();
|
|
70
|
-
break;
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
focusComponent(component) {
|
|
75
|
-
if (this.focusedComponent) {
|
|
76
|
-
this.focusedComponent.focused = false;
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
this.focusedComponent = component;
|
|
80
|
-
component.focused = true;
|
|
81
|
-
|
|
82
|
-
// Annoncer le composant focalisé
|
|
83
|
-
this.announce(`Focused: ${this.getComponentLabel(component)}`);
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
blur() {
|
|
87
|
-
if (this.focusedComponent) {
|
|
88
|
-
this.focusedComponent.focused = false;
|
|
89
|
-
this.focusedComponent = null;
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
getComponentLabel(component) {
|
|
94
|
-
return component.text ||
|
|
95
|
-
component.label ||
|
|
96
|
-
component.ariaLabel ||
|
|
97
|
-
component.constructor.name;
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
destroy() {
|
|
101
|
-
if (this.ariaLiveRegion) {
|
|
102
|
-
this.ariaLiveRegion.remove();
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
export default AccessibilityManager;
|
package/manager/ErrorHandler.js
DELETED
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
// ==========================================
|
|
2
|
-
// 1. ERROR HANDLING & LOGGING
|
|
3
|
-
// ==========================================
|
|
4
|
-
|
|
5
|
-
class ErrorHandler {
|
|
6
|
-
constructor(options = {}) {
|
|
7
|
-
this.sentryDsn = options.sentryDsn;
|
|
8
|
-
this.environment = options.environment || 'production';
|
|
9
|
-
this.logLevel = options.logLevel || 'error';
|
|
10
|
-
this.errors = [];
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
captureError(error, context = {}) {
|
|
14
|
-
const errorLog = {
|
|
15
|
-
message: error.message,
|
|
16
|
-
stack: error.stack,
|
|
17
|
-
context,
|
|
18
|
-
timestamp: Date.now(),
|
|
19
|
-
userAgent: navigator.userAgent,
|
|
20
|
-
url: window.location.href
|
|
21
|
-
};
|
|
22
|
-
|
|
23
|
-
this.errors.push(errorLog);
|
|
24
|
-
|
|
25
|
-
// Log to console in dev
|
|
26
|
-
if (this.environment === 'development') {
|
|
27
|
-
console.error('🚨 Error captured:', errorLog);
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
// Send to Sentry in production
|
|
31
|
-
if (this.sentryDsn && this.environment === 'production') {
|
|
32
|
-
this.sendToSentry(errorLog);
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
return errorLog;
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
sendToSentry(errorLog) {
|
|
39
|
-
// Integration avec Sentry
|
|
40
|
-
if (window.Sentry) {
|
|
41
|
-
window.Sentry.captureException(new Error(errorLog.message), {
|
|
42
|
-
extra: errorLog.context
|
|
43
|
-
});
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
wrap(fn, context = '') {
|
|
48
|
-
return (...args) => {
|
|
49
|
-
try {
|
|
50
|
-
return fn(...args);
|
|
51
|
-
} catch (error) {
|
|
52
|
-
this.captureError(error, { context, args });
|
|
53
|
-
throw error;
|
|
54
|
-
}
|
|
55
|
-
};
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
export default ErrorHandler;
|
package/manager/FeatureFlags.js
DELETED
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
// ==========================================
|
|
2
|
-
// 6. FEATURE FLAGS & AB TESTING
|
|
3
|
-
// ==========================================
|
|
4
|
-
|
|
5
|
-
class FeatureFlags {
|
|
6
|
-
constructor(config = {}) {
|
|
7
|
-
this.flags = config.flags || {};
|
|
8
|
-
this.userId = config.userId;
|
|
9
|
-
this.experiments = {};
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
isEnabled(flagName) {
|
|
13
|
-
const flag = this.flags[flagName];
|
|
14
|
-
|
|
15
|
-
if (typeof flag === 'boolean') {
|
|
16
|
-
return flag;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
if (typeof flag === 'object') {
|
|
20
|
-
// Percentage rollout
|
|
21
|
-
if (flag.percentage && this.userId) {
|
|
22
|
-
const hash = this.hashUserId(this.userId);
|
|
23
|
-
return hash < flag.percentage;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
// A/B test
|
|
27
|
-
if (flag.variants) {
|
|
28
|
-
return this.getVariant(flagName, flag.variants);
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
return false;
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
getVariant(experimentName, variants) {
|
|
36
|
-
if (!this.userId) return variants[0];
|
|
37
|
-
|
|
38
|
-
const hash = this.hashUserId(this.userId + experimentName);
|
|
39
|
-
const variantIndex = hash % variants.length;
|
|
40
|
-
|
|
41
|
-
this.experiments[experimentName] = variants[variantIndex];
|
|
42
|
-
return variants[variantIndex];
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
hashUserId(str) {
|
|
46
|
-
let hash = 0;
|
|
47
|
-
for (let i = 0; i < str.length; i++) {
|
|
48
|
-
hash = ((hash << 5) - hash) + str.charCodeAt(i);
|
|
49
|
-
hash = hash & hash;
|
|
50
|
-
}
|
|
51
|
-
return Math.abs(hash) % 100;
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
trackExperiment(experimentName) {
|
|
55
|
-
// Envoyer à analytics
|
|
56
|
-
console.log('Experiment:', experimentName, this.experiments[experimentName]);
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
export default FeatureFlags;
|
package/manager/MemoryManager.js
DELETED
|
@@ -1,107 +0,0 @@
|
|
|
1
|
-
// ==========================================
|
|
2
|
-
// 4. MEMORY MANAGEMENT
|
|
3
|
-
// ==========================================
|
|
4
|
-
|
|
5
|
-
class MemoryManager {
|
|
6
|
-
constructor(framework) {
|
|
7
|
-
this.framework = framework;
|
|
8
|
-
this.imageCache = new Map();
|
|
9
|
-
this.maxCacheSize = 50 * 1024 * 1024; // 50MB
|
|
10
|
-
this.currentCacheSize = 0;
|
|
11
|
-
this.componentRegistry = new WeakMap();
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
cacheImage(url, image) {
|
|
15
|
-
const size = this.estimateImageSize(image);
|
|
16
|
-
|
|
17
|
-
// Éviction si dépassement
|
|
18
|
-
if (this.currentCacheSize + size > this.maxCacheSize) {
|
|
19
|
-
this.evictOldest();
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
this.imageCache.set(url, {
|
|
23
|
-
image,
|
|
24
|
-
size,
|
|
25
|
-
lastAccessed: Date.now(),
|
|
26
|
-
accessCount: 0
|
|
27
|
-
});
|
|
28
|
-
|
|
29
|
-
this.currentCacheSize += size;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
getImage(url) {
|
|
33
|
-
const cached = this.imageCache.get(url);
|
|
34
|
-
if (cached) {
|
|
35
|
-
cached.lastAccessed = Date.now();
|
|
36
|
-
cached.accessCount++;
|
|
37
|
-
return cached.image;
|
|
38
|
-
}
|
|
39
|
-
return null;
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
evictOldest() {
|
|
43
|
-
let oldest = null;
|
|
44
|
-
let oldestTime = Infinity;
|
|
45
|
-
|
|
46
|
-
for (let [url, data] of this.imageCache) {
|
|
47
|
-
if (data.lastAccessed < oldestTime) {
|
|
48
|
-
oldestTime = data.lastAccessed;
|
|
49
|
-
oldest = url;
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
if (oldest) {
|
|
54
|
-
const data = this.imageCache.get(oldest);
|
|
55
|
-
this.currentCacheSize -= data.size;
|
|
56
|
-
this.imageCache.delete(oldest);
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
estimateImageSize(image) {
|
|
61
|
-
// Estimation approximative
|
|
62
|
-
return image.width * image.height * 4; // 4 bytes per pixel (RGBA)
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
registerComponent(component) {
|
|
66
|
-
this.componentRegistry.set(component, {
|
|
67
|
-
created: Date.now(),
|
|
68
|
-
listeners: []
|
|
69
|
-
});
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
unregisterComponent(component) {
|
|
73
|
-
const data = this.componentRegistry.get(component);
|
|
74
|
-
if (data) {
|
|
75
|
-
// Nettoyer tous les event listeners
|
|
76
|
-
data.listeners.forEach(({ element, event, handler }) => {
|
|
77
|
-
element.removeEventListener(event, handler);
|
|
78
|
-
});
|
|
79
|
-
}
|
|
80
|
-
this.componentRegistry.delete(component);
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
trackListener(component, element, event, handler) {
|
|
84
|
-
const data = this.componentRegistry.get(component);
|
|
85
|
-
if (data) {
|
|
86
|
-
data.listeners.push({ element, event, handler });
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
clearAll() {
|
|
91
|
-
this.imageCache.clear();
|
|
92
|
-
this.currentCacheSize = 0;
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
getMemoryReport() {
|
|
96
|
-
return {
|
|
97
|
-
imageCacheSize: `${(this.currentCacheSize / 1024 / 1024).toFixed(2)} MB`,
|
|
98
|
-
imageCacheCount: this.imageCache.size,
|
|
99
|
-
componentCount: this.framework.components.length,
|
|
100
|
-
heapSize: performance.memory
|
|
101
|
-
? `${(performance.memory.usedJSHeapSize / 1024 / 1024).toFixed(2)} MB`
|
|
102
|
-
: 'N/A'
|
|
103
|
-
};
|
|
104
|
-
}
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
export default MemoryManager;
|