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
|
@@ -0,0 +1 @@
|
|
|
1
|
+
/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */
|
package/package.json
CHANGED
|
@@ -1,25 +1,19 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "canvasframework",
|
|
3
|
-
"version": "0.5.
|
|
4
|
-
"repository": {
|
|
5
|
-
"type": "git",
|
|
6
|
-
"url": "https://github.com/beyons/CanvasFramework.git"
|
|
7
|
-
},
|
|
3
|
+
"version": "0.5.18",
|
|
8
4
|
"description": "Canvas-based cross-platform UI framework (Material & Cupertino)",
|
|
9
5
|
"type": "module",
|
|
10
|
-
"main": "
|
|
11
|
-
"exports": {
|
|
12
|
-
".": "./index.js"
|
|
13
|
-
},
|
|
6
|
+
"main": "dist/canvasframework.js",
|
|
14
7
|
"files": [
|
|
15
|
-
"
|
|
16
|
-
"components",
|
|
17
|
-
"core",
|
|
18
|
-
"features",
|
|
19
|
-
"manager",
|
|
20
|
-
"layout",
|
|
21
|
-
"utils"
|
|
8
|
+
"dist"
|
|
22
9
|
],
|
|
10
|
+
"scripts": {
|
|
11
|
+
"build": "webpack --config webpack.config.js"
|
|
12
|
+
},
|
|
13
|
+
"repository": {
|
|
14
|
+
"type": "git",
|
|
15
|
+
"url": "https://github.com/beyons/CanvasFramework.git"
|
|
16
|
+
},
|
|
23
17
|
"keywords": [
|
|
24
18
|
"canvas",
|
|
25
19
|
"ui",
|
|
@@ -28,5 +22,12 @@
|
|
|
28
22
|
"cupertino",
|
|
29
23
|
"mobile"
|
|
30
24
|
],
|
|
31
|
-
"license": "MIT"
|
|
25
|
+
"license": "MIT",
|
|
26
|
+
"devDependencies": {
|
|
27
|
+
"webpack": "^5.88.2",
|
|
28
|
+
"webpack-cli": "^5.1.4",
|
|
29
|
+
"babel-loader": "^9.1.3",
|
|
30
|
+
"@babel/core": "^7.23.0",
|
|
31
|
+
"@babel/preset-env": "^7.23.0"
|
|
32
|
+
}
|
|
32
33
|
}
|
package/components/Accordion.js
DELETED
|
@@ -1,265 +0,0 @@
|
|
|
1
|
-
import Component from '../core/Component.js';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Accordion (section extensible) avec styles Material & Cupertino + Ripple centré Android
|
|
5
|
-
* @class
|
|
6
|
-
* @extends Component
|
|
7
|
-
*/
|
|
8
|
-
class Accordion extends Component {
|
|
9
|
-
constructor(framework, options = {}) {
|
|
10
|
-
super(framework, options);
|
|
11
|
-
this.title = options.title || '';
|
|
12
|
-
this.content = options.content || '';
|
|
13
|
-
this.icon = options.icon || null;
|
|
14
|
-
this.expanded = options.expanded || false;
|
|
15
|
-
this.platform = framework.platform;
|
|
16
|
-
this.headerHeight = 56;
|
|
17
|
-
this.contentPadding = 16;
|
|
18
|
-
this.bgColor = options.bgColor || '#FFFFFF';
|
|
19
|
-
this.borderColor = options.borderColor || '#E0E0E0';
|
|
20
|
-
this.onToggle = options.onToggle;
|
|
21
|
-
this.animating = false;
|
|
22
|
-
this.animProgress = this.expanded ? 1 : 0;
|
|
23
|
-
|
|
24
|
-
this.calculateContentHeight();
|
|
25
|
-
this.height = this.headerHeight + (this.expanded ? this.contentHeight : 0);
|
|
26
|
-
|
|
27
|
-
// Pour les ripples Material
|
|
28
|
-
this.ripples = [];
|
|
29
|
-
this.rippleColor = 'rgba(1,0,0,0.2)';
|
|
30
|
-
|
|
31
|
-
// Clic
|
|
32
|
-
this.onClick = () => {
|
|
33
|
-
if (this.animating) return;
|
|
34
|
-
|
|
35
|
-
// Ripple centré Material
|
|
36
|
-
if (this.platform === 'material') {
|
|
37
|
-
this.addRipple();
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
this.toggle();
|
|
41
|
-
};
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
calculateContentHeight() {
|
|
45
|
-
const ctx = this.framework.ctx;
|
|
46
|
-
ctx.save();
|
|
47
|
-
ctx.font = '14px -apple-system, sans-serif';
|
|
48
|
-
const maxWidth = this.width - this.contentPadding * 2;
|
|
49
|
-
const lines = this.wrapText(ctx, this.content, maxWidth);
|
|
50
|
-
ctx.restore();
|
|
51
|
-
const lineHeight = 20;
|
|
52
|
-
this.contentHeight = lines.length * lineHeight + this.contentPadding * 2;
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
wrapText(ctx, text, maxWidth) {
|
|
56
|
-
const words = text.split(' ');
|
|
57
|
-
const lines = [];
|
|
58
|
-
let currentLine = words[0] || '';
|
|
59
|
-
for (let i = 1; i < words.length; i++) {
|
|
60
|
-
const word = words[i];
|
|
61
|
-
const width = ctx.measureText(currentLine + ' ' + word).width;
|
|
62
|
-
if (width < maxWidth) currentLine += ' ' + word;
|
|
63
|
-
else {
|
|
64
|
-
lines.push(currentLine);
|
|
65
|
-
currentLine = word;
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
lines.push(currentLine);
|
|
69
|
-
return lines;
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
toggle() {
|
|
73
|
-
if (this.animating) return;
|
|
74
|
-
this.expanded = !this.expanded;
|
|
75
|
-
if (this.onToggle) this.onToggle(this.expanded);
|
|
76
|
-
this.animate();
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
animate() {
|
|
80
|
-
if (this.animating) return;
|
|
81
|
-
this.animating = true;
|
|
82
|
-
const target = this.expanded ? 1 : 0;
|
|
83
|
-
const step = 0.1;
|
|
84
|
-
|
|
85
|
-
const doAnimate = () => {
|
|
86
|
-
if (Math.abs(this.animProgress - target) < 0.01) {
|
|
87
|
-
this.animProgress = target;
|
|
88
|
-
this.height = this.headerHeight + this.contentHeight * this.animProgress;
|
|
89
|
-
this.animating = false;
|
|
90
|
-
return;
|
|
91
|
-
}
|
|
92
|
-
this.animProgress += this.animProgress < target ? step : -step;
|
|
93
|
-
this.height = this.headerHeight + this.contentHeight * this.animProgress;
|
|
94
|
-
requestAnimationFrame(doAnimate);
|
|
95
|
-
};
|
|
96
|
-
doAnimate();
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
addRipple() {
|
|
100
|
-
const ripple = {
|
|
101
|
-
x: this.width / 2,
|
|
102
|
-
y: this.headerHeight / 2,
|
|
103
|
-
radius: 0,
|
|
104
|
-
maxRadius: Math.max(this.width, this.headerHeight) * 1.5,
|
|
105
|
-
opacity: 0.3
|
|
106
|
-
};
|
|
107
|
-
this.ripples.push(ripple);
|
|
108
|
-
this.animateRipples();
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
animateRipples() {
|
|
112
|
-
const animate = () => {
|
|
113
|
-
let active = false;
|
|
114
|
-
for (let ripple of this.ripples) {
|
|
115
|
-
if (ripple.radius < ripple.maxRadius) {
|
|
116
|
-
ripple.radius += ripple.maxRadius / 15;
|
|
117
|
-
ripple.opacity -= 0.03;
|
|
118
|
-
active = true;
|
|
119
|
-
}
|
|
120
|
-
}
|
|
121
|
-
this.ripples = this.ripples.filter(r => r.opacity > 0);
|
|
122
|
-
if (active) requestAnimationFrame(animate);
|
|
123
|
-
};
|
|
124
|
-
animate();
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
draw(ctx) {
|
|
128
|
-
ctx.save();
|
|
129
|
-
|
|
130
|
-
let headerBg = '#FFFFFF';
|
|
131
|
-
let headerTextColor = '#000000';
|
|
132
|
-
let borderColor = this.borderColor;
|
|
133
|
-
let shadowBlur = 0;
|
|
134
|
-
let chevronWidth = 2;
|
|
135
|
-
|
|
136
|
-
if (this.platform === 'material') {
|
|
137
|
-
headerBg = '#F5F5F5';
|
|
138
|
-
headerTextColor = '#212121';
|
|
139
|
-
shadowBlur = 4;
|
|
140
|
-
chevronWidth = 3;
|
|
141
|
-
} else if (this.platform === 'cupertino') {
|
|
142
|
-
headerBg = '#FFFFFF';
|
|
143
|
-
headerTextColor = '#000000';
|
|
144
|
-
borderColor = '#C7C7CC';
|
|
145
|
-
chevronWidth = 1.5;
|
|
146
|
-
}
|
|
147
|
-
|
|
148
|
-
// Ombre Material
|
|
149
|
-
if (shadowBlur > 0) {
|
|
150
|
-
ctx.shadowColor = 'rgba(0,0,0,0.2)';
|
|
151
|
-
ctx.shadowBlur = shadowBlur;
|
|
152
|
-
ctx.shadowOffsetX = 0;
|
|
153
|
-
ctx.shadowOffsetY = 2;
|
|
154
|
-
}
|
|
155
|
-
|
|
156
|
-
// Background
|
|
157
|
-
ctx.fillStyle = this.bgColor;
|
|
158
|
-
ctx.fillRect(this.x, this.y, this.width, this.height);
|
|
159
|
-
|
|
160
|
-
// Bordure Cupertino
|
|
161
|
-
if (this.platform === 'cupertino') {
|
|
162
|
-
ctx.strokeStyle = borderColor;
|
|
163
|
-
ctx.lineWidth = 1;
|
|
164
|
-
ctx.strokeRect(this.x, this.y, this.width, this.height);
|
|
165
|
-
}
|
|
166
|
-
|
|
167
|
-
// Header
|
|
168
|
-
ctx.fillStyle = headerBg;
|
|
169
|
-
ctx.fillRect(this.x, this.y, this.width, this.headerHeight);
|
|
170
|
-
|
|
171
|
-
// Ripple centré Material
|
|
172
|
-
if (this.platform === 'material' && this.ripples.length) {
|
|
173
|
-
ctx.save();
|
|
174
|
-
ctx.beginPath();
|
|
175
|
-
ctx.rect(this.x, this.y, this.width, this.headerHeight);
|
|
176
|
-
ctx.clip();
|
|
177
|
-
for (let ripple of this.ripples) {
|
|
178
|
-
ctx.globalAlpha = ripple.opacity;
|
|
179
|
-
ctx.fillStyle = this.rippleColor;
|
|
180
|
-
ctx.beginPath();
|
|
181
|
-
ctx.arc(this.x + ripple.x, this.y + ripple.y, ripple.radius, 0, Math.PI * 2);
|
|
182
|
-
ctx.fill();
|
|
183
|
-
}
|
|
184
|
-
ctx.restore();
|
|
185
|
-
ctx.globalAlpha = 1;
|
|
186
|
-
}
|
|
187
|
-
|
|
188
|
-
// Icône
|
|
189
|
-
if (this.icon) {
|
|
190
|
-
ctx.font = '20px sans-serif';
|
|
191
|
-
ctx.fillStyle = '#666666';
|
|
192
|
-
ctx.textAlign = 'left';
|
|
193
|
-
ctx.textBaseline = 'middle';
|
|
194
|
-
ctx.fillText(this.icon, this.x + 16, this.y + this.headerHeight / 2);
|
|
195
|
-
}
|
|
196
|
-
|
|
197
|
-
// Titre
|
|
198
|
-
ctx.fillStyle = headerTextColor;
|
|
199
|
-
ctx.font =
|
|
200
|
-
this.platform === 'material'
|
|
201
|
-
? 'bold 16px Roboto, sans-serif'
|
|
202
|
-
: 'bold 16px -apple-system, sans-serif';
|
|
203
|
-
ctx.textAlign = 'left';
|
|
204
|
-
ctx.textBaseline = 'middle';
|
|
205
|
-
const titleX = this.icon ? this.x + 56 : this.x + 16;
|
|
206
|
-
ctx.fillText(this.title, titleX, this.y + this.headerHeight / 2);
|
|
207
|
-
|
|
208
|
-
// Chevron
|
|
209
|
-
const chevronX = this.x + this.width - 30;
|
|
210
|
-
const chevronY = this.y + this.headerHeight / 2;
|
|
211
|
-
const chevronRotation = this.animProgress * Math.PI;
|
|
212
|
-
ctx.save();
|
|
213
|
-
ctx.translate(chevronX, chevronY);
|
|
214
|
-
ctx.rotate(chevronRotation);
|
|
215
|
-
ctx.strokeStyle = '#666666';
|
|
216
|
-
ctx.lineWidth = chevronWidth;
|
|
217
|
-
ctx.lineCap = 'round';
|
|
218
|
-
ctx.lineJoin = 'round';
|
|
219
|
-
ctx.beginPath();
|
|
220
|
-
ctx.moveTo(-6, -3);
|
|
221
|
-
ctx.lineTo(0, 3);
|
|
222
|
-
ctx.lineTo(6, -3);
|
|
223
|
-
ctx.stroke();
|
|
224
|
-
ctx.restore();
|
|
225
|
-
|
|
226
|
-
// Contenu
|
|
227
|
-
if (this.animProgress > 0) {
|
|
228
|
-
ctx.save();
|
|
229
|
-
ctx.beginPath();
|
|
230
|
-
ctx.rect(this.x, this.y + this.headerHeight, this.width, this.contentHeight * this.animProgress);
|
|
231
|
-
ctx.clip();
|
|
232
|
-
|
|
233
|
-
ctx.strokeStyle = borderColor;
|
|
234
|
-
ctx.lineWidth = 1;
|
|
235
|
-
ctx.beginPath();
|
|
236
|
-
ctx.moveTo(this.x, this.y + this.headerHeight);
|
|
237
|
-
ctx.lineTo(this.x + this.width, this.y + this.headerHeight);
|
|
238
|
-
ctx.stroke();
|
|
239
|
-
|
|
240
|
-
ctx.fillStyle = '#666666';
|
|
241
|
-
ctx.font = '14px -apple-system, sans-serif';
|
|
242
|
-
ctx.textAlign = 'left';
|
|
243
|
-
ctx.textBaseline = 'top';
|
|
244
|
-
const contentX = this.x + this.contentPadding;
|
|
245
|
-
const contentY = this.y + this.headerHeight + this.contentPadding;
|
|
246
|
-
const maxWidth = this.width - this.contentPadding * 2;
|
|
247
|
-
const lines = this.wrapText(ctx, this.content, maxWidth);
|
|
248
|
-
const lineHeight = 20;
|
|
249
|
-
lines.forEach((line, index) => {
|
|
250
|
-
ctx.fillText(line, contentX, contentY + index * lineHeight);
|
|
251
|
-
});
|
|
252
|
-
|
|
253
|
-
ctx.restore();
|
|
254
|
-
}
|
|
255
|
-
|
|
256
|
-
ctx.restore();
|
|
257
|
-
}
|
|
258
|
-
|
|
259
|
-
isPointInside(x, y) {
|
|
260
|
-
return x >= this.x && x <= this.x + this.width &&
|
|
261
|
-
y >= this.y && y <= this.y + this.headerHeight;
|
|
262
|
-
}
|
|
263
|
-
}
|
|
264
|
-
|
|
265
|
-
export default Accordion;
|