canvasframework 0.3.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.
Files changed (85) hide show
  1. package/README.md +554 -0
  2. package/components/Accordion.js +252 -0
  3. package/components/AndroidDatePickerDialog.js +398 -0
  4. package/components/AppBar.js +225 -0
  5. package/components/Avatar.js +202 -0
  6. package/components/BottomNavigationBar.js +205 -0
  7. package/components/BottomSheet.js +374 -0
  8. package/components/Button.js +225 -0
  9. package/components/Card.js +193 -0
  10. package/components/Checkbox.js +180 -0
  11. package/components/Chip.js +212 -0
  12. package/components/CircularProgress.js +143 -0
  13. package/components/ContextMenu.js +116 -0
  14. package/components/DatePicker.js +257 -0
  15. package/components/Dialog.js +367 -0
  16. package/components/Divider.js +125 -0
  17. package/components/Drawer.js +261 -0
  18. package/components/FAB.js +270 -0
  19. package/components/FileUpload.js +315 -0
  20. package/components/IOSDatePickerWheel.js +268 -0
  21. package/components/ImageCarousel.js +193 -0
  22. package/components/ImageComponent.js +223 -0
  23. package/components/Input.js +309 -0
  24. package/components/List.js +94 -0
  25. package/components/ListItem.js +223 -0
  26. package/components/Modal.js +364 -0
  27. package/components/MultiSelectDialog.js +206 -0
  28. package/components/NumberInput.js +271 -0
  29. package/components/ProgressBar.js +88 -0
  30. package/components/RadioButton.js +142 -0
  31. package/components/SearchInput.js +315 -0
  32. package/components/SegmentedControl.js +202 -0
  33. package/components/Select.js +199 -0
  34. package/components/SelectDialog.js +255 -0
  35. package/components/Slider.js +113 -0
  36. package/components/Snackbar.js +243 -0
  37. package/components/Stepper.js +281 -0
  38. package/components/SwipeableListItem.js +179 -0
  39. package/components/Switch.js +147 -0
  40. package/components/Table.js +492 -0
  41. package/components/Tabs.js +125 -0
  42. package/components/Text.js +141 -0
  43. package/components/TextField.js +331 -0
  44. package/components/Toast.js +236 -0
  45. package/components/TreeView.js +420 -0
  46. package/components/Video.js +397 -0
  47. package/components/View.js +140 -0
  48. package/components/VirtualList.js +120 -0
  49. package/core/CanvasFramework.js +1271 -0
  50. package/core/CanvasWork.js +32 -0
  51. package/core/Component.js +153 -0
  52. package/core/LogicWorker.js +25 -0
  53. package/core/WebGLCanvasAdapter.js +1369 -0
  54. package/features/Column.js +43 -0
  55. package/features/Grid.js +47 -0
  56. package/features/LayoutComponent.js +43 -0
  57. package/features/OpenStreetMap.js +310 -0
  58. package/features/Positioned.js +33 -0
  59. package/features/PullToRefresh.js +328 -0
  60. package/features/Row.js +40 -0
  61. package/features/SignaturePad.js +257 -0
  62. package/features/Skeleton.js +84 -0
  63. package/features/Stack.js +21 -0
  64. package/index.js +101 -0
  65. package/manager/AccessibilityManager.js +107 -0
  66. package/manager/ErrorHandler.js +59 -0
  67. package/manager/FeatureFlags.js +60 -0
  68. package/manager/MemoryManager.js +107 -0
  69. package/manager/PerformanceMonitor.js +84 -0
  70. package/manager/SecurityManager.js +54 -0
  71. package/package.json +28 -0
  72. package/utils/AnimationEngine.js +428 -0
  73. package/utils/DataStore.js +403 -0
  74. package/utils/EventBus.js +407 -0
  75. package/utils/FetchClient.js +74 -0
  76. package/utils/FormValidator.js +355 -0
  77. package/utils/GeoLocationService.js +62 -0
  78. package/utils/I18n.js +207 -0
  79. package/utils/IndexedDBManager.js +273 -0
  80. package/utils/OfflineSyncManager.js +342 -0
  81. package/utils/QueryBuilder.js +478 -0
  82. package/utils/SafeArea.js +64 -0
  83. package/utils/SecureStorage.js +289 -0
  84. package/utils/StateManager.js +207 -0
  85. package/utils/WebSocketClient.js +66 -0
@@ -0,0 +1,32 @@
1
+ // CanvasWorker.js
2
+ let components = [];
3
+
4
+ self.onmessage = (e) => {
5
+ const { type, payload } = e.data;
6
+
7
+ switch(type) {
8
+ case 'INIT':
9
+ components = payload.components;
10
+ self.postMessage({ type: 'READY' });
11
+ break;
12
+
13
+ case 'UPDATE_LAYOUT':
14
+ // Recalculer la hauteur des composants dynamiques
15
+ const updated = components.map(comp => {
16
+ if (comp.dynamicHeight && comp.calculateHeight) {
17
+ comp.height = comp.calculateHeight();
18
+ }
19
+ return { id: comp.id, height: comp.height };
20
+ });
21
+ self.postMessage({ type: 'LAYOUT_DONE', payload: updated });
22
+ break;
23
+
24
+ case 'SCROLL_INERTIA':
25
+ let { offset, velocity, friction, maxScroll } = payload;
26
+ offset += velocity;
27
+ offset = Math.max(Math.min(offset, 0), -maxScroll);
28
+ velocity *= friction;
29
+ self.postMessage({ type: 'SCROLL_UPDATED', payload: { offset, velocity } });
30
+ break;
31
+ }
32
+ };
@@ -0,0 +1,153 @@
1
+ /**
2
+ * Classe de base pour tous les composants
3
+ * @class
4
+ * @abstract
5
+ * @property {CanvasFramework} framework - Référence au framework parent
6
+ * @property {number} x - Position X
7
+ * @property {number} y - Position Y
8
+ * @property {number} width - Largeur
9
+ * @property {number} height - Hauteur
10
+ * @property {boolean} visible - Visibilité du composant
11
+ * @property {boolean} pressed - État pressé
12
+ * @property {boolean} hovered - État survolé
13
+ * @property {Function} onClick - Callback au clic
14
+ * @property {Function} onPress - Callback à la pression
15
+ */
16
+ class Component {
17
+ /**
18
+ * Crée une instance de Component
19
+ * @param {CanvasFramework} framework - Framework parent
20
+ * @param {Object} [options={}] - Options de configuration
21
+ * @param {number} [options.x=0] - Position X
22
+ * @param {number} [options.y=0] - Position Y
23
+ * @param {number} [options.width=100] - Largeur
24
+ * @param {number} [options.height=50] - Hauteur
25
+ * @param {boolean} [options.visible=true] - Visibilité
26
+ * @param {Function} [options.onClick] - Callback au clic
27
+ * @param {Function} [options.onPress] - Callback à la pression
28
+ */
29
+ constructor(framework, options = {}) {
30
+ this.framework = framework;
31
+ this.x = options.x || 0;
32
+ this.y = options.y || 0;
33
+ this.width = options.width || 100;
34
+ this.height = options.height || 50;
35
+ this.visible = options.visible !== false;
36
+ this.pressed = false;
37
+ this.hovered = false;
38
+ this.onClick = options.onClick;
39
+ this.onPress = options.onPress;
40
+
41
+ // Système dirty simple (optionnel)
42
+ this._dirty = true;
43
+
44
+ // Lifecycle
45
+ this._mounted = false;
46
+
47
+ // Pour détecter les updates
48
+ this._prevProps = { ...options };
49
+ }
50
+
51
+ /* =======================
52
+ LIFECYCLE HOOKS
53
+ ======================= */
54
+
55
+ onMount() {}
56
+ onUnmount() {}
57
+ onUpdate(prevProps) {}
58
+ onResize(width, height) {}
59
+
60
+ /* ======================= */
61
+
62
+ _mount() {
63
+ if (!this._mounted) {
64
+ this._mounted = true;
65
+ this.onMount();
66
+ }
67
+ }
68
+
69
+ _unmount() {
70
+ if (this._mounted) {
71
+ this.onUnmount();
72
+ this._mounted = false;
73
+ }
74
+ }
75
+
76
+ _update(newProps) {
77
+ this.onUpdate(this._prevProps);
78
+ this._prevProps = { ...newProps };
79
+ this.markDirty();
80
+ }
81
+
82
+ _resize(width, height) {
83
+ this.onResize(width, height);
84
+ this.markDirty();
85
+ }
86
+
87
+ setProps(newProps = {}) {
88
+ const changed = Object.keys(newProps).some(
89
+ key => this[key] !== newProps[key]
90
+ );
91
+
92
+ if (!changed) return;
93
+
94
+ Object.assign(this, newProps);
95
+ this._update(newProps);
96
+ }
97
+
98
+ measure(constraints) {
99
+ return {
100
+ width: this.width,
101
+ height: this.height
102
+ };
103
+ }
104
+
105
+ /**
106
+ * Marque le composant pour redessin
107
+ * Appelez cette méthode après avoir modifié une propriété
108
+ */
109
+ markDirty() {
110
+ this._dirty = true;
111
+ if (this.framework && this.framework.markComponentDirty) {
112
+ this.framework.markComponentDirty(this);
113
+ }
114
+ }
115
+
116
+ /**
117
+ * Marque le composant comme propre (appelé automatiquement après draw)
118
+ */
119
+ markClean() {
120
+ this._dirty = false;
121
+ }
122
+
123
+ /**
124
+ * Vérifie si le composant est dirty
125
+ */
126
+ isDirty() {
127
+ return this._dirty;
128
+ }
129
+
130
+ /**
131
+ * Vérifie si un point est dans les limites du composant
132
+ */
133
+ isPointInside(x, y) {
134
+ return x >= this.x && x <= this.x + this.width &&
135
+ y >= this.y && y <= this.y + this.height;
136
+ }
137
+
138
+ /**
139
+ * Méthode de dessin (à implémenter par les sous-classes)
140
+ */
141
+ draw(ctx) {
142
+ // À implémenter par les sous-classes
143
+ }
144
+ }
145
+
146
+
147
+ export default Component;
148
+
149
+
150
+
151
+
152
+
153
+
@@ -0,0 +1,25 @@
1
+ // LogicWorker.js
2
+ let state = {};
3
+
4
+ self.onmessage = async (e) => {
5
+ const { type, payload } = e.data;
6
+
7
+ switch(type) {
8
+ case 'SET_STATE':
9
+ state = payload;
10
+ self.postMessage({ type: 'STATE_UPDATED', payload: state });
11
+ break;
12
+
13
+ case 'EXECUTE':
14
+ // payload: { fnString: string, args: array }
15
+ // Attention : on envoie la fonction en string et on l'exécute ici
16
+ try {
17
+ const fn = new Function('state', 'args', payload.fnString);
18
+ const result = await fn(state, payload.args);
19
+ self.postMessage({ type: 'EXECUTION_RESULT', payload: result });
20
+ } catch (err) {
21
+ self.postMessage({ type: 'EXECUTION_ERROR', payload: err.message });
22
+ }
23
+ break;
24
+ }
25
+ };