canvasframework 0.5.18 → 0.5.20
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/README.md +30 -0
- package/components/Accordion.js +265 -0
- package/components/AndroidDatePickerDialog.js +406 -0
- package/components/AppBar.js +398 -0
- package/components/AudioPlayer.js +611 -0
- package/components/Avatar.js +202 -0
- package/components/Banner.js +342 -0
- package/components/BottomNavigationBar.js +433 -0
- package/components/BottomSheet.js +234 -0
- package/components/Button.js +358 -0
- package/components/Camera.js +644 -0
- package/components/Card.js +193 -0
- package/components/Chart.js +700 -0
- package/components/Checkbox.js +166 -0
- package/components/Chip.js +212 -0
- package/components/CircularProgress.js +327 -0
- package/components/ContextMenu.js +116 -0
- package/components/DatePicker.js +298 -0
- package/components/Dialog.js +337 -0
- package/components/Divider.js +125 -0
- package/components/Drawer.js +276 -0
- package/components/FAB.js +270 -0
- package/components/FileUpload.js +315 -0
- package/components/FloatedCamera.js +644 -0
- package/components/IOSDatePickerWheel.js +430 -0
- package/components/ImageCarousel.js +219 -0
- package/components/ImageComponent.js +223 -0
- package/components/Input.js +831 -0
- package/components/InputDatalist.js +723 -0
- package/components/InputTags.js +624 -0
- package/components/List.js +95 -0
- package/components/ListItem.js +269 -0
- package/components/Modal.js +364 -0
- package/components/MorphingFAB.js +428 -0
- package/components/MultiSelectDialog.js +206 -0
- package/components/NumberInput.js +271 -0
- package/components/PasswordInput.js +462 -0
- package/components/ProgressBar.js +88 -0
- package/components/QRCodeReader.js +539 -0
- package/components/RadioButton.js +151 -0
- package/components/SearchInput.js +315 -0
- package/components/SegmentedControl.js +357 -0
- package/components/Select.js +199 -0
- package/components/SelectDialog.js +255 -0
- package/components/Slider.js +113 -0
- package/components/SliverAppBar.js +139 -0
- package/components/Snackbar.js +243 -0
- package/components/SpeedDialFAB.js +397 -0
- package/components/Stepper.js +281 -0
- package/components/SwipeableListItem.js +327 -0
- package/components/Switch.js +147 -0
- package/components/Table.js +492 -0
- package/components/Tabs.js +423 -0
- package/components/Text.js +141 -0
- package/components/TextField.js +151 -0
- package/components/TimePicker.js +934 -0
- package/components/Toast.js +236 -0
- package/components/TreeView.js +420 -0
- package/components/Video.js +397 -0
- package/components/View.js +140 -0
- package/components/VirtualList.js +120 -0
- package/core/CanvasFramework.js +3045 -0
- package/core/Component.js +243 -0
- package/core/ThemeManager.js +358 -0
- package/core/UIBuilder.js +267 -0
- package/core/WebGLCanvasAdapter.js +782 -0
- package/features/Column.js +43 -0
- package/features/Grid.js +47 -0
- package/features/LayoutComponent.js +43 -0
- package/features/OpenStreetMap.js +310 -0
- package/features/Positioned.js +33 -0
- package/features/PullToRefresh.js +328 -0
- package/features/Row.js +40 -0
- package/features/SignaturePad.js +257 -0
- package/features/Skeleton.js +193 -0
- package/features/Stack.js +21 -0
- package/index.js +119 -0
- package/manager/AccessibilityManager.js +107 -0
- package/manager/ErrorHandler.js +59 -0
- package/manager/FeatureFlags.js +60 -0
- package/manager/MemoryManager.js +107 -0
- package/manager/PerformanceMonitor.js +84 -0
- package/manager/SecurityManager.js +54 -0
- package/package.json +22 -16
- package/utils/AnimationEngine.js +734 -0
- package/utils/CryptoManager.js +303 -0
- package/utils/DataStore.js +403 -0
- package/utils/DevTools.js +1618 -0
- package/utils/DevToolsConsole.js +201 -0
- package/utils/EventBus.js +407 -0
- package/utils/FetchClient.js +74 -0
- package/utils/FirebaseAuth.js +653 -0
- package/utils/FirebaseCore.js +246 -0
- package/utils/FirebaseFirestore.js +581 -0
- package/utils/FirebaseFunctions.js +97 -0
- package/utils/FirebaseRealtimeDB.js +498 -0
- package/utils/FirebaseStorage.js +612 -0
- package/utils/FormValidator.js +355 -0
- package/utils/GeoLocationService.js +62 -0
- package/utils/I18n.js +207 -0
- package/utils/IndexedDBManager.js +273 -0
- package/utils/InspectionOverlay.js +308 -0
- package/utils/NotificationManager.js +60 -0
- package/utils/OfflineSyncManager.js +342 -0
- package/utils/PayPalPayment.js +678 -0
- package/utils/QueryBuilder.js +478 -0
- package/utils/SafeArea.js +64 -0
- package/utils/SecureStorage.js +289 -0
- package/utils/StateManager.js +207 -0
- package/utils/StripePayment.js +552 -0
- package/utils/WebSocketClient.js +66 -0
- package/dist/canvasframework.js +0 -2
- package/dist/canvasframework.js.LICENSE.txt +0 -1
|
@@ -0,0 +1,267 @@
|
|
|
1
|
+
// Import ALL components explicitly
|
|
2
|
+
import Button from '../components/Button.js';
|
|
3
|
+
import SegmentedControl from '../components/SegmentedControl.js';
|
|
4
|
+
import Input from '../components/Input.js';
|
|
5
|
+
import Slider from '../components/Slider.js';
|
|
6
|
+
import Text from '../components/Text.js';
|
|
7
|
+
import View from '../components/View.js';
|
|
8
|
+
import Card from '../components/Card.js';
|
|
9
|
+
import FAB from '../components/FAB.js';
|
|
10
|
+
import SpeedDialFAB from '../components/SpeedDialFAB.js';
|
|
11
|
+
import MorphingFAB from '../components/MorphingFAB.js';
|
|
12
|
+
import CircularProgress from '../components/CircularProgress.js';
|
|
13
|
+
import ImageComponent from '../components/ImageComponent.js';
|
|
14
|
+
import DatePicker from '../components/DatePicker.js';
|
|
15
|
+
import IOSDatePickerWheel from '../components/IOSDatePickerWheel.js';
|
|
16
|
+
import AndroidDatePickerDialog from '../components/AndroidDatePickerDialog.js';
|
|
17
|
+
import Avatar from '../components/Avatar.js';
|
|
18
|
+
import Snackbar from '../components/Snackbar.js';
|
|
19
|
+
import BottomNavigationBar from '../components/BottomNavigationBar.js';
|
|
20
|
+
import Video from '../components/Video.js';
|
|
21
|
+
import Modal from '../components/Modal.js';
|
|
22
|
+
import Drawer from '../components/Drawer.js';
|
|
23
|
+
import AppBar from '../components/AppBar.js';
|
|
24
|
+
import Chip from '../components/Chip.js';
|
|
25
|
+
import Stepper from '../components/Stepper.js';
|
|
26
|
+
import Accordion from '../components/Accordion.js';
|
|
27
|
+
import Tabs from '../components/Tabs.js';
|
|
28
|
+
import Switch from '../components/Switch.js';
|
|
29
|
+
import SwipeableListItem from '../components/SwipeableListItem.js';
|
|
30
|
+
import ListItem from '../components/ListItem.js';
|
|
31
|
+
import List from '../components/List.js';
|
|
32
|
+
import VirtualList from '../components/VirtualList.js';
|
|
33
|
+
import BottomSheet from '../components/BottomSheet.js';
|
|
34
|
+
import ProgressBar from '../components/ProgressBar.js';
|
|
35
|
+
import RadioButton from '../components/RadioButton.js';
|
|
36
|
+
import Dialog from '../components/Dialog.js';
|
|
37
|
+
import ContextMenu from '../components/ContextMenu.js';
|
|
38
|
+
import Checkbox from '../components/Checkbox.js';
|
|
39
|
+
import Toast from '../components/Toast.js';
|
|
40
|
+
import NumberInput from '../components/NumberInput.js';
|
|
41
|
+
import TextField from '../components/TextField.js';
|
|
42
|
+
import SelectDialog from '../components/SelectDialog.js';
|
|
43
|
+
import Select from '../components/Select.js';
|
|
44
|
+
import MultiSelectDialog from '../components/MultiSelectDialog.js';
|
|
45
|
+
import Divider from '../components/Divider.js';
|
|
46
|
+
import FileUpload from '../components/FileUpload.js';
|
|
47
|
+
import Table from '../components/Table.js';
|
|
48
|
+
import TreeView from '../components/TreeView.js';
|
|
49
|
+
import SearchInput from '../components/SearchInput.js';
|
|
50
|
+
import ImageCarousel from '../components/ImageCarousel.js';
|
|
51
|
+
import PasswordInput from '../components/PasswordInput.js';
|
|
52
|
+
import InputTags from '../components/InputTags.js';
|
|
53
|
+
import InputDatalist from '../components/InputDatalist.js';
|
|
54
|
+
import Banner from '../components/Banner.js';
|
|
55
|
+
import Chart from '../components/Chart.js';
|
|
56
|
+
import SliverAppBar from '../components/SliverAppBar.js';
|
|
57
|
+
import AudioPlayer from '../components/AudioPlayer.js';
|
|
58
|
+
import Camera from '../components/Camera.js';
|
|
59
|
+
import FloatedCamera from '../components/FloatedCamera.js';
|
|
60
|
+
import TimePicker from '../components/TimePicker.js';
|
|
61
|
+
import QRCodeReader from '../components/QRCodeReader.js';
|
|
62
|
+
|
|
63
|
+
// Features
|
|
64
|
+
import PullToRefresh from '../features/PullToRefresh.js';
|
|
65
|
+
import Skeleton from '../features/Skeleton.js';
|
|
66
|
+
import SignaturePad from '../features/SignaturePad.js';
|
|
67
|
+
import OpenStreetMap from '../features/OpenStreetMap.js';
|
|
68
|
+
import LayoutComponent from '../features/LayoutComponent.js';
|
|
69
|
+
import Grid from '../features/Grid.js';
|
|
70
|
+
import Row from '../features/Row.js';
|
|
71
|
+
import Column from '../features/Column.js';
|
|
72
|
+
import Positioned from '../features/Positioned.js';
|
|
73
|
+
import Stack from '../features/Stack.js';
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
* Map of all available components
|
|
77
|
+
*/
|
|
78
|
+
const Components = {
|
|
79
|
+
Button,
|
|
80
|
+
SegmentedControl,
|
|
81
|
+
Input,
|
|
82
|
+
Slider,
|
|
83
|
+
Text,
|
|
84
|
+
View,
|
|
85
|
+
Card,
|
|
86
|
+
FAB,
|
|
87
|
+
SpeedDialFAB,
|
|
88
|
+
MorphingFAB,
|
|
89
|
+
CircularProgress,
|
|
90
|
+
ImageComponent,
|
|
91
|
+
DatePicker,
|
|
92
|
+
IOSDatePickerWheel,
|
|
93
|
+
AndroidDatePickerDialog,
|
|
94
|
+
Avatar,
|
|
95
|
+
Snackbar,
|
|
96
|
+
BottomNavigationBar,
|
|
97
|
+
Video,
|
|
98
|
+
Modal,
|
|
99
|
+
Drawer,
|
|
100
|
+
AppBar,
|
|
101
|
+
SliverAppBar,
|
|
102
|
+
Chip,
|
|
103
|
+
Camera,
|
|
104
|
+
Stepper,
|
|
105
|
+
Accordion,
|
|
106
|
+
Tabs,
|
|
107
|
+
Switch,
|
|
108
|
+
SwipeableListItem,
|
|
109
|
+
ListItem,
|
|
110
|
+
List,
|
|
111
|
+
QRCodeReader,
|
|
112
|
+
VirtualList,
|
|
113
|
+
BottomSheet,
|
|
114
|
+
ProgressBar,
|
|
115
|
+
RadioButton,
|
|
116
|
+
Dialog,
|
|
117
|
+
TimePicker,
|
|
118
|
+
ContextMenu,
|
|
119
|
+
Checkbox,
|
|
120
|
+
Toast,
|
|
121
|
+
FloatedCamera,
|
|
122
|
+
NumberInput,
|
|
123
|
+
TextField,
|
|
124
|
+
SelectDialog,
|
|
125
|
+
Select,
|
|
126
|
+
MultiSelectDialog,
|
|
127
|
+
Divider,
|
|
128
|
+
FileUpload,
|
|
129
|
+
Table,
|
|
130
|
+
AudioPlayer,
|
|
131
|
+
TreeView,
|
|
132
|
+
SearchInput,
|
|
133
|
+
ImageCarousel,
|
|
134
|
+
PasswordInput,
|
|
135
|
+
InputTags,
|
|
136
|
+
InputDatalist,
|
|
137
|
+
PullToRefresh,
|
|
138
|
+
Skeleton,
|
|
139
|
+
SignaturePad,
|
|
140
|
+
OpenStreetMap,
|
|
141
|
+
LayoutComponent,
|
|
142
|
+
Grid,
|
|
143
|
+
Row,
|
|
144
|
+
Column,
|
|
145
|
+
Positioned,
|
|
146
|
+
Banner,
|
|
147
|
+
Chart,
|
|
148
|
+
Stack
|
|
149
|
+
};
|
|
150
|
+
|
|
151
|
+
/**
|
|
152
|
+
* Crée un objet ref pour stocker une référence
|
|
153
|
+
*/
|
|
154
|
+
export function createRef() {
|
|
155
|
+
return { current: null };
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
/**
|
|
159
|
+
* DSL déclaratif pour CanvasFramework
|
|
160
|
+
*/
|
|
161
|
+
class UIBuilder {
|
|
162
|
+
constructor() {
|
|
163
|
+
this._tree = null;
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
/* ============================
|
|
167
|
+
BASE
|
|
168
|
+
============================ */
|
|
169
|
+
|
|
170
|
+
_create(type, props = {}, children = []) {
|
|
171
|
+
return { type, props, children };
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
mount(framework) {
|
|
175
|
+
if (!this._tree) return;
|
|
176
|
+
this._mountNode(framework, this._tree, null);
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
_mountNode(framework, node, parent = null) {
|
|
180
|
+
if (!node) return null;
|
|
181
|
+
|
|
182
|
+
const ComponentClass = Components[node.type];
|
|
183
|
+
if (!ComponentClass) {
|
|
184
|
+
console.warn(`UIBuilder: composant inconnu "${node.type}"`);
|
|
185
|
+
return null;
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
// Extraire la ref des props si elle existe
|
|
189
|
+
const { ref, ...componentProps } = node.props;
|
|
190
|
+
|
|
191
|
+
const instance = new ComponentClass(framework, componentProps);
|
|
192
|
+
|
|
193
|
+
// ✅ Si une ref est fournie, y stocker l'instance
|
|
194
|
+
if (ref && typeof ref === 'object' && 'current' in ref) {
|
|
195
|
+
ref.current = instance;
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
// ✅ Ajouter au framework UNIQUEMENT si ce n'est pas un enfant de Card
|
|
199
|
+
const isChildOfCard = parent && parent.constructor?.name === 'Card';
|
|
200
|
+
if (!isChildOfCard) {
|
|
201
|
+
framework.add(instance);
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
// ✅ Ajouter au parent si parent existe et supporte add
|
|
205
|
+
if (parent && typeof parent.add === 'function') {
|
|
206
|
+
parent.add(instance);
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
// Monter les enfants
|
|
210
|
+
if (node.children && node.children.length > 0) {
|
|
211
|
+
node.children.forEach(child =>
|
|
212
|
+
this._mountNode(framework, child, instance)
|
|
213
|
+
);
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
return instance;
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
/* ============================
|
|
220
|
+
ROOT
|
|
221
|
+
============================ */
|
|
222
|
+
|
|
223
|
+
app(node) {
|
|
224
|
+
this._tree = node;
|
|
225
|
+
return this;
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
/* ============================
|
|
230
|
+
FACTORIES AUTOMATIQUES
|
|
231
|
+
============================ */
|
|
232
|
+
|
|
233
|
+
const ui = new UIBuilder();
|
|
234
|
+
|
|
235
|
+
// Génération automatique pour TOUS les composants
|
|
236
|
+
Object.keys(Components).forEach((name) => {
|
|
237
|
+
const factoryName = name.charAt(0).toLowerCase() + name.slice(1);
|
|
238
|
+
|
|
239
|
+
const factory = (props = {}, children = []) => {
|
|
240
|
+
// Ensure children is always an array
|
|
241
|
+
const childArray = Array.isArray(children) ? children : (children ? [children] : []);
|
|
242
|
+
return ui._create(name, props, childArray);
|
|
243
|
+
};
|
|
244
|
+
|
|
245
|
+
// Add both lowercase and uppercase versions
|
|
246
|
+
ui[factoryName] = factory; // e.g., ui.text
|
|
247
|
+
ui[name] = factory; // e.g., ui.Text
|
|
248
|
+
});
|
|
249
|
+
|
|
250
|
+
/* ============================
|
|
251
|
+
ALIAS SUPPLÉMENTAIRES
|
|
252
|
+
============================ */
|
|
253
|
+
|
|
254
|
+
// Ensure these exist even if they were auto-generated
|
|
255
|
+
ui.column = ui.column || ((props = {}, children = []) =>
|
|
256
|
+
ui._create('Column', props, Array.isArray(children) ? children : [children]));
|
|
257
|
+
|
|
258
|
+
ui.row = ui.row || ((props = {}, children = []) =>
|
|
259
|
+
ui._create('Row', props, Array.isArray(children) ? children : [children]));
|
|
260
|
+
|
|
261
|
+
ui.stack = ui.stack || ((props = {}, children = []) =>
|
|
262
|
+
ui._create('Stack', props, Array.isArray(children) ? children : [children]));
|
|
263
|
+
|
|
264
|
+
ui.grid = ui.grid || ((props = {}, children = []) =>
|
|
265
|
+
ui._create('Grid', props, Array.isArray(children) ? children : [children]));
|
|
266
|
+
|
|
267
|
+
export default ui;
|