@fto-consult/expo-ui 7.5.45 → 7.6.2

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 (49) hide show
  1. package/babel.config.alias.js +1 -19
  2. package/bin/index.js +0 -152
  3. package/bin/update-appex-chart.js +1 -1
  4. package/bin/update-pdfmake.js +1 -1
  5. package/bin/utils.js +1 -1
  6. package/copy-env-file.js +3 -6
  7. package/create-transpile-module-transformer.js +1 -1
  8. package/find-licenses.js +1 -1
  9. package/package.json +3 -4
  10. package/src/screens/Help/openLibraries.js +339 -1
  11. package/bin/init.js +0 -95
  12. package/electron/app/desktopCapturer.js +0 -123
  13. package/electron/app/email.js +0 -55
  14. package/electron/app/file.js +0 -501
  15. package/electron/app/index.html +0 -32
  16. package/electron/app/index.js +0 -19
  17. package/electron/app/instance.js +0 -46
  18. package/electron/create-index-file.js +0 -15
  19. package/electron/dependencies.js +0 -13
  20. package/electron/index.js +0 -560
  21. package/electron/init/index.js +0 -0
  22. package/electron/init/main.js +0 -55
  23. package/electron/init/renderer.js +0 -6
  24. package/electron/is-initialized.js +0 -11
  25. package/electron/pload.js +0 -88
  26. package/electron/preload.js +0 -461
  27. package/electron/tools.js +0 -0
  28. package/electron/utils/config.js +0 -30
  29. package/electron/utils/copy.js +0 -20
  30. package/electron/utils/createDir.js +0 -30
  31. package/electron/utils/createDirSync.js +0 -31
  32. package/electron/utils/debounce.js +0 -19
  33. package/electron/utils/dependencies.js +0 -10
  34. package/electron/utils/env.js +0 -80
  35. package/electron/utils/exec.js +0 -81
  36. package/electron/utils/getDirname.js +0 -14
  37. package/electron/utils/getIcon.js +0 -25
  38. package/electron/utils/index.js +0 -24
  39. package/electron/utils/isBase64.js +0 -14
  40. package/electron/utils/isDataURL.js +0 -13
  41. package/electron/utils/isValidUrl.js +0 -4
  42. package/electron/utils/json.js +0 -57
  43. package/electron/utils/parseArgs.js +0 -21
  44. package/electron/utils/paths.js +0 -11
  45. package/electron/utils/postMessage.js +0 -19
  46. package/electron/utils/replaceAll.js +0 -12
  47. package/electron/utils/session.js +0 -5
  48. package/electron/utils/uniqid.js +0 -33
  49. package/electron/utils/writeFile.js +0 -14
package/electron/index.js DELETED
@@ -1,560 +0,0 @@
1
- const { program } = require('commander');
2
- const path = require("path");
3
- const fs = require("fs");
4
- const isValidUrl = require("./utils/isValidUrl");
5
-
6
- const debounce = require("./utils/debounce");
7
- const {app, BrowserWindow,Tray,Menu,MenuItem,globalShortcut,systemPreferences,powerMonitor,ipcMain,dialog, nativeTheme} = require('electron')
8
- const session = require("./utils/session");
9
- const {isJSON} = require("./utils/json");
10
-
11
- const isObj = x => x && typeof x =='object';
12
-
13
- let appIsReady = false;
14
-
15
- const iconName = process.platform =="win32" ? "icon.ico" : process.platform =='darwin' ? "icon.incs" : "icon.png";
16
-
17
- program
18
- .option('-u, --url <url>', 'L\'adresse url à ouvrir au lancement de l\'application')
19
- //.option('-r, --root <projectRoot>', 'le chemin du project root de l\'application')
20
- .option('-l, --icon [iconPath]', 'le chemin vers le dossier des icones de l\'application : (Dans ce dossier, doit contenir une image icon.ico pour window, icon.incs pour mac et icon.png pour linux)')
21
- .parse();
22
-
23
- const programOptions = program.opts();
24
- const {url:pUrl,root:mainProjectRoot,icon} = programOptions;
25
-
26
- const distPath = path.join("dist",'index.html');
27
- const processCWD = process.cwd();
28
- const appPath = app.getAppPath();
29
- const isAsar = appPath.indexOf('app.asar') !== -1;
30
- const packageJSONPath = fs.existsSync(path.resolve(appPath,"package.app.json")) ? path.resolve(appPath,"package.app.json") : fs.existsSync(processCWD,"package.json")? path.resolve(processCWD,"package.json") : path.resolve(appPath,"package.json") ;
31
- const packageJSON = fs.existsSync(packageJSONPath) ? Object.assign({},require(`${packageJSONPath}`)) : {};
32
- const appName = typeof packageJSON.name =="string" && packageJSON.name || "";
33
-
34
- let iconPath = icon && typeof icon =="string" && fs.existsSync(path.resolve(icon)) && path.resolve(icon) || undefined;
35
- if(!iconPath && packageJSON.icon && typeof packageJSON.icon ==="string" && fs.existsSync(packageJSON.icon)){
36
- iconPath = packageJSON.icon;
37
- }
38
- if(iconPath && fs.existsSync(path.resolve(iconPath,iconName))){
39
- iconPath = path.resolve(iconPath,iconName);
40
- }
41
-
42
- // fermee automatiquement quand l'objet JavaScript sera garbage collected.
43
- let mainWindow = undefined;
44
-
45
- Menu.setApplicationMenu(null);
46
-
47
- const indexFilePath = path.resolve(path.join(appPath,distPath));
48
- const mainProcessPath = path.resolve('processes',"main","index.js");
49
- const mainProcessIndex = fs.existsSync(path.resolve(appPath,mainProcessPath)) && path.resolve(appPath,mainProcessPath);
50
- const mainProcessRequired = mainProcessIndex && require(`${mainProcessIndex}`);
51
- //pour étendre les fonctionnalités au niveau du main proceess, bien vouloir écrire dans le fichier ../electron/main/index.js
52
- const mainProcess = mainProcessRequired && typeof mainProcessRequired =='object'? mainProcessRequired : {};
53
- const execPath = app.getPath ('exe') || process.execPath;
54
-
55
- // Gardez une reference globale de l'objet window, si vous ne le faites pas, la fenetre sera
56
- if(!isValidUrl(pUrl) && !fs.existsSync(indexFilePath)){
57
- throw {message:`Unable to start the application: index file located at [${indexFilePath}] does not exists : appPath = [${appPath}], exec path is ${execPath}`}
58
- }
59
-
60
- const quit = ()=>{
61
- try {
62
- app.quit();
63
- } catch(e){
64
- console.log(e," triing kit app")
65
- }
66
- }
67
-
68
- //app.disableHardwareAcceleration();
69
-
70
- function createBrowserWindow (options){
71
- const {isMainWindow} = options;
72
- options = Object.assign({},options);
73
- const menu = options.menu;
74
- options.webPreferences = isObj(options.webPreferences)? options.webPreferences : {};
75
- options.webPreferences = {
76
- sandbox: false,
77
- webSecurity : true,
78
- plugin:false,
79
- autoHideMenuBar: true,
80
- contextIsolation: true,
81
- contentSecurityPolicy: `
82
- default-src 'none';
83
- script-src 'self';
84
- img-src 'self' data:;
85
- style-src 'self';
86
- font-src 'self';
87
- `,
88
- ...options.webPreferences,
89
- devTools: typeof options.webPreferences.devTools === 'boolean'? options.webPreferences.devTools : false,
90
- allowRunningInsecureContent: false,
91
- nodeIntegration: false,
92
- preload: options.preload ? options.preload : null,
93
- }
94
- if(options.modal && !options.parent && mainWindow){
95
- options.parent = mainWindow;
96
- }
97
- if(typeof options.show ==='undefined'){
98
- options.show = false;
99
- }
100
- let showOnLoad = options.showOnLoad ===true ? true : undefined;
101
- if(showOnLoad){
102
- options.show = false;
103
- }
104
- if(typeof mainProcess?.beforeCreateWindow =='function'){
105
- const opts = Object.assign({},mainProcess.beforeCreateWindow(options));
106
- options = {...options,...opts};
107
- }
108
- options.icon = options.icon || iconPath;
109
- let window = new BrowserWindow(options);
110
- if(!menu){
111
- window.setMenu(null);
112
- window.removeMenu();
113
- window.setMenuBarVisibility(false)
114
- window.setAutoHideMenuBar(true)
115
- }
116
- if(showOnLoad){
117
- window.once('ready-to-show', () => {
118
- window.show();
119
- window.webContents.send("window-ready-to-show",JSON.stringify(options.readyToShowOptions));
120
- });
121
- }
122
- window.on('closed', function() {
123
- if(isMainWindow && typeof mainProcess?.onMainWindowClosed == "function"){
124
- mainProcess.onMainWindowClosed(window);
125
- }
126
- window = null;
127
- });
128
- window.webContents.on('context-menu',clipboadContextMenu);
129
- const url = isValidUrl(options.loadURL) || typeof options.loadURL ==='string' && options.loadURL.trim().startsWith("file://") ? options.loadURL : undefined;
130
- if(url){
131
- window.loadURL(url);
132
- } else if(options.file && fs.existsSync(path.resolve(options.file))){
133
- window.loadFile(path.resolve(options.file));
134
- }
135
- return window;
136
- }
137
-
138
- app.whenReady().then(() => {
139
- createWindow();
140
- const readOpts = {toggleDevTools,browserWindow:mainWindow,mainWindow:mainWindow};
141
- if(typeof mainProcess.whenAppReady =='function'){
142
- mainProcess.whenAppReady(readOpts);
143
- }
144
- globalShortcut.register('CommandOrControl+F12', () => {
145
- return toggleDevTools();
146
- });
147
- app.on('activate', function () {
148
- if (mainWindow == null || (BrowserWindow.getAllWindows().length === 0)) createWindow()
149
- });
150
- appIsReady = true;
151
- });
152
-
153
- function createWindow () {
154
- // Créer le browser window
155
- mainWindow = createBrowserWindow({
156
- showOnLoad : false,
157
- loadURL : undefined,
158
- isMainWindow : true,
159
- registerDevToolsCommand : false,
160
- file : indexFilePath,
161
- url : pUrl,
162
- preload : path.resolve(__dirname,'preload.js'),
163
- webPreferences : {
164
- devTools : true,
165
- }
166
- });
167
- const sOptions = {width: 500, height: 400, transparent: true, frame: false, alwaysOnTop: true};
168
- const splash = typeof mainProcess.splashScreen ==='function'&& mainProcess.splashScreen(sOptions)
169
- || typeof mainProcess.splash ==='function' && mainProcess.splash(sOptions)
170
- || (mainProcess.splash instanceof BrowserWindow) && mainProcess.splash
171
- || (mainProcess.splashScreen instanceof BrowserWindow) && mainProcess.splashScreen;
172
- null;
173
- let hasInitWindows = false;
174
- mainWindow.on('show', () => {
175
- //mainWindow.blur();
176
- setTimeout(() => {
177
- mainWindow.focus();
178
- mainWindow.moveTop();
179
- mainWindow.webContents.focus();
180
- if(!hasInitWindows){
181
- hasInitWindows = true;
182
- mainWindow.webContents.send('appReady');
183
- }
184
- }, 200);
185
- });
186
-
187
- mainWindow.on("focus",()=>{
188
- if(mainWindow && hasInitWindows){
189
- mainWindow.webContents.send("main-window-focus");
190
- }
191
- });
192
- mainWindow.on("blur",()=>{
193
- if(mainWindow && hasInitWindows){
194
- mainWindow.webContents.send("main-window-blur");
195
- }
196
- });
197
- mainWindow.once("ready-to-show",function(){
198
- if(typeof mainProcess.onMainWindowReadyToShow ==='function'){
199
- mainProcess.onMainWindowReadyToShow(mainWindow);
200
- }
201
- mainWindow.minimize()
202
- try {
203
- if(splash && splash instanceof BrowserWindow){
204
- splash.destroy();
205
- }
206
- } catch{ }
207
- mainWindow.restore();
208
- mainWindow.show();
209
- })
210
-
211
- mainWindow.on('close', (e) => {
212
- if (mainWindow) {
213
- if(typeof mainProcess.onMainWindowClose == "function"){
214
- mainProcess.onMainWindowClose(mainWindow);
215
- }
216
- e.preventDefault();
217
- mainWindow.webContents.send('before-app-exit');
218
- }
219
- });
220
-
221
- mainWindow.on('unresponsive', async () => {
222
- const { response } = await dialog.showMessageBox({
223
- title: "L'application a cessé de répondre",
224
- message : 'Voulez vous relancer l\'application?',
225
- buttons: ['Relancer', 'Arrêter'],
226
- cancelId: 1
227
- });
228
- if (response === 0) {
229
- mainWindow.forcefullyCrashRenderer()
230
- mainWindow.reload()
231
- } else {
232
- mainWindow.forcefullyCrashRenderer()
233
- app.exit();
234
- }
235
- });
236
-
237
- // Émit lorsque la fenêtre est fermée.
238
- mainWindow.on('closed', () => {
239
- mainWindow = null
240
- })
241
- mainWindow.setMenu(null);
242
-
243
- /*** les dimenssions de la fenêtre principale */
244
- let mWindowSessinName = "mainWindowSizes";
245
- let mWindowPositionSName = mWindowSessinName+"-positions";
246
- let sizeW = session.get(mWindowSessinName);
247
- if(!sizeW || typeof sizeW !== 'object'){
248
- sizeW = {};
249
- }
250
- let sPositions = session.get(mWindowPositionSName);
251
- if(!sPositions || typeof sPositions !=='object'){
252
- sPositions = {};
253
- }
254
- let isNumber = x => typeof x =="number";
255
- if(isNumber(sizeW.width) && isNumber(sizeW.height)){
256
- mainWindow.setSize(sizeW.width,sizeW.height);
257
- if(isNumber(sPositions.x) && isNumber(sPositions.y)){
258
- mainWindow.setPosition(sPositions.x,sPositions.y);
259
- }
260
- }
261
- const onWinResizeEv = debounce(function () {
262
- if(mainWindow){
263
- let wSize = mainWindow.getSize();
264
- if(Array.isArray(wSize) && wSize.length == 2){
265
- let [width,height] = wSize;
266
- if(width && height){
267
- session.set(mWindowSessinName,{width,height});
268
- }
269
- let [x,y] = mainWindow.getPosition();
270
- session.set(mWindowPositionSName,{x,y});
271
- }
272
- }
273
- }, 100);
274
- mainWindow.off('resize',onWinResizeEv);
275
- mainWindow.on('resize',onWinResizeEv);
276
- mainWindow.off('move',onWinResizeEv);
277
- mainWindow.on('move',onWinResizeEv);
278
- if(typeof mainProcess.onCreateMainWindow =='function'){
279
- mainProcess.onCreateMainWindow(mainWindow);
280
- }
281
- return mainWindow;
282
- }
283
-
284
- const toggleDevTools = (value)=>{
285
- if(mainWindow !==null && mainWindow.webContents){
286
- const isOpen= mainWindow.webContents.isDevToolsOpened();
287
- value = value === undefined ? !isOpen : value;
288
- if(value && !isOpen){
289
- mainWindow.webContents.openDevTools();
290
- return mainWindow.webContents.isDevToolsOpened();
291
- } else {
292
- if(isOpen) mainWindow.webContents.closeDevTools();
293
- }
294
- return mainWindow.webContents.isDevToolsOpened();
295
- }
296
- return false;
297
- }
298
- ipcMain.on("toggle-dev-tools",function(event,value) {
299
- return toggleDevTools(value);
300
- });
301
-
302
- ipcMain.handle("create-browser-windows",function(event,options){
303
- if(typeof options =='string'){
304
- try {
305
- const t = JSON.parse(options);
306
- options = t;
307
- } catch{}
308
- }
309
- options = Object.assign({},options);
310
- createBrowserWindow(options);
311
- });
312
-
313
- ipcMain.on("restart-app",x =>{
314
- app.relaunch();
315
- });
316
- let tray = null;
317
- ipcMain.on("update-system-tray",(event,opts)=>{
318
- opts = opts && typeof opts == 'object'? opts : {};
319
- let {contextMenu,tooltip} = opts;
320
- if(tray){
321
- } else {
322
- tray = new Tray();
323
- }
324
- if(!tooltip || typeof tooltip !=="string"){
325
- tooltip = ""
326
- }
327
- tray.setToolTip(tooltip);
328
- if(isJSON(contextMenu)){
329
- contextMenu = JSON.parse(contextMenu);
330
- }
331
- if(Array.isArray(contextMenu) && contextMenu.length) {
332
- let tpl = []
333
- contextMenu.map((m,index)=>{
334
- if(!m || typeof m !=='object') return;
335
- m.click = (e)=>{
336
- if(mainWindow && mainWindow.webContents) mainWindow.webContents.send("click-on-system-tray-menu-item",{
337
- action : m.action && typeof m.action =='string'? m.action : undefined,
338
- index,
339
- menuItem : JSON.stringify(m),
340
- })
341
- }
342
- tpl.push(m);
343
- })
344
- contextMenu = Menu.buildFromTemplate(tpl);
345
- } else contextMenu = null;
346
- tray.setContextMenu(contextMenu)
347
- });
348
-
349
- ipcMain.on("get-path",(event,pathName)=>{
350
- const p = app.getPath(pathName);
351
- event.returnValue = p;
352
- return p;
353
- });
354
- ipcMain.on("get-app-path",(event,pathName)=>{
355
- event.returnValue = appPath;
356
- return appPath;
357
- });
358
- ipcMain.on("get-project-root",(event)=>{
359
- event.returnValue = appPath;
360
- return event.returnValue;
361
- });
362
-
363
- ipcMain.on("get-process-cwd",(event)=>{
364
- event.returnValue = processCWD;
365
- return event.returnValue ;
366
- });
367
-
368
- ipcMain.on("get-package.json",(event)=>{
369
- event.returnValue = JSON.stringify(packageJSON);
370
- return event.returnValue ;
371
- });
372
-
373
- ipcMain.on("get-app-name",(event)=>{
374
- event.returnValue = appName;
375
- return event.returnValue ;
376
- });
377
-
378
- ipcMain.on("get-media-access-status",(event,mediaType)=>{
379
- let p = systemPreferences.getMediaAccessStatus(mediaType);
380
- event.returnValue = p;
381
- return p;
382
- });
383
-
384
- ipcMain.on("ask-for-media-access",(event,mediaType)=>{
385
- systemPreferences.askForMediaAccess(mediaType);
386
- });
387
-
388
- ipcMain.on("get-app-icon",(event)=>{
389
- event.returnValue = mainWindow != mainWindow && mainWindow.getIcon && mainWindow.getIcon();
390
- });
391
- ipcMain.on("set-app-icon",(event,iconPath)=>{
392
- if(iconPath && mainWindow != null){
393
- mainWindow.setIcon(iconPath);
394
- event.returnValue = iconPath;
395
- } else {
396
- event.returnValue = null;
397
- }
398
- });
399
-
400
- ipcMain.on('minimize-main-window', () => {
401
- if(mainWindow !== null && mainWindow){
402
- mainWindow.blur();
403
- mainWindow.minimize();
404
- }
405
- })
406
- ipcMain.on('restore-main-window', () => {
407
- if(mainWindow && mainWindow !== null){
408
- mainWindow.restore()
409
- mainWindow.blur();
410
- setTimeout(() => {
411
- mainWindow.focus();
412
- mainWindow.moveTop();
413
- mainWindow.webContents.focus();
414
- }, 200);
415
- }
416
- })
417
- ipcMain.on('close-main-render-process', _ => {
418
- if(mainWindow){
419
- mainWindow.destroy();
420
- }
421
- mainWindow = null;
422
- if(typeof gc =="function"){
423
- gc();
424
- }
425
- quit();
426
- });
427
-
428
- const powerMonitorCallbackEvent = (action)=>{
429
- if(!mainWindow || !mainWindow.webContents) return;
430
- if(action =="suspend" || action =="lock-screen"){
431
- mainWindow.webContents.send("main-app-suspended",action);
432
- return;
433
- }
434
- mainWindow.webContents.send("main-app-restaured",action);
435
- mainWindow.webContents.focus();
436
- return null;
437
- }
438
- if(powerMonitor){
439
- ["suspend","resume","lock-screen","unlock-screen"].map((action)=>{
440
- powerMonitor.on(action,(event)=>{
441
- powerMonitorCallbackEvent(action,event);
442
- })
443
- })
444
- }
445
- ipcMain.on("set-main-window-title",(event,title)=>{
446
- if(mainWindow !== null){
447
- mainWindow.setTitle(title);
448
- }
449
- });
450
-
451
- ipcMain.handle("show-open-dialog",function(event,options){
452
- if(typeof options =="string"){
453
- try {
454
- const t = JSON.parse(options);
455
- options = t;
456
- } catch{}
457
- }
458
- if(!isObj(options)){
459
- options = {};
460
- }
461
- return dialog.showOpenDialog(mainWindow,options)
462
- })
463
-
464
- ipcMain.handle("show-save-dialog",function(event,options){
465
- if(!isObj(options)){
466
- options = {};
467
- }
468
- return dialog.showSaveDialog(mainWindow,options)
469
- });
470
-
471
- ipcMain.on("is-dev-tools-open",function(event,value) {
472
- if(mainWindow !==null && mainWindow.webContents){
473
- return mainWindow.webContents.isDevToolsOpened();
474
- }
475
- return false;
476
- });
477
-
478
- ipcMain.on("window-set-progressbar",(event,interval)=>{
479
- if(typeof interval !="number" || interval <0) interval = 0;
480
- interval = Math.floor(interval);
481
- if(mainWindow){
482
- mainWindow.setProgressBar(interval);
483
- }
484
- });
485
-
486
- /**** customisation des thèmes de l'application */
487
- ipcMain.handle('set-system-theme:toggle', (event,theme) => {
488
- theme = theme && typeof theme == "string"? theme : "light";
489
- theme = theme.toLowerCase().trim();
490
- if(theme !== 'system' && theme !=='dark'){
491
- theme = "light";
492
- }
493
- nativeTheme.themeSource = theme;
494
- session.set("os-theme",theme);
495
- return nativeTheme.shouldUseDarkColors
496
- });
497
-
498
- ipcMain.handle('set-system-theme:dark-mode', (event) => {
499
- nativeTheme.themeSource = 'dark';
500
- return nativeTheme.shouldUseDarkColors;
501
- });
502
- ipcMain.handle('set-system-theme:light-mode', (event) => {
503
- nativeTheme.themeSource = 'light';
504
- return nativeTheme.shouldUseDarkColors;
505
- });
506
-
507
-
508
- ipcMain.handle('dark-mode:toggle', () => {
509
- if (nativeTheme.shouldUseDarkColors) {
510
- nativeTheme.themeSource = 'light'
511
- } else {
512
- nativeTheme.themeSource = 'dark'
513
- }
514
- return nativeTheme.shouldUseDarkColors
515
- })
516
-
517
- ipcMain.handle('dark-mode:system', () => {
518
- nativeTheme.themeSource = 'system'
519
- });
520
-
521
- const clipboadContextMenu = (_, props) => {
522
- if (props.isEditable || props.selectionText) {
523
- const menu = new Menu();
524
- if(props.selectionText){
525
- menu.append(new MenuItem({ label: 'Copier', role: 'copy' }));
526
- if(props.isEditable){
527
- menu.append(new MenuItem({ label: 'Couper', role: 'cut' }));
528
- }
529
- }
530
- if(props.isEditable){
531
- menu.append(new MenuItem({ label: 'Coller', role: 'paste' }));
532
- }
533
- menu.popup();
534
- }
535
- };
536
-
537
- // Quitte l'application quand toutes les fenêtres sont fermées.
538
- app.on('window-all-closed', () => {
539
- // Sur macOS, il est commun pour une application et leur barre de menu
540
- // de rester active tant que l'utilisateur ne quitte pas explicitement avec Cmd + Q
541
- if (process.platform !== 'darwin') {
542
- quit();
543
- }
544
- });
545
-
546
- if(mainProcess.enableSingleInstance !== false){
547
- const gotTheLock = app.requestSingleInstanceLock()
548
- if (appIsReady && !gotTheLock) {
549
- quit();
550
- } else {
551
- app.on('second-instance', (event, commandLine, workingDirectory) => {
552
- // Someone tried to run a second instance, we should focus our window.
553
- //pour plus tard il sera possible d'afficher la gestion multi fenêtre en environnement electron
554
- if (mainWindow) {
555
- if (mainWindow.isMinimized()) mainWindow.restore()
556
- mainWindow.focus()
557
- }
558
- })
559
- }
560
- }
File without changes
@@ -1,55 +0,0 @@
1
- /**** auto generated file
2
- * in this file, you can add all main process code you want for your electron application
3
- * @export||@return {object}, with properties like this :
4
- * {
5
- * splash || splashScreen {function|| instanceOf(BrowserWindow)}, if function, must return an instanceOf BrowserWindow wich will use as application splashcreen
6
- * whenReady || appOnReady {function}, function called when electron app is ready
7
- * }
8
- */
9
-
10
- module.exports = {
11
- enableSingleInstance: true, // si l'application n'autorise qu'une seule instance active. ça sous entend qu'à l'instant t, une seule instance de l'application ne peut être exécutée sur le profil de l'utilisateur lambda
12
- /**** cette fonction est appelée à chaque fois que l'on désire créer une instance du BrowserWindow
13
- @param {object} BrowserWindowOptions
14
- Lors de la création de la fenêtre principal, BrowserWindowOptions continent la propriété isMainWindow à true
15
- la prop isMainWindow {boolean} spécifie s'il s'agit de la fenêtre principale
16
- la prop isPDFWindow {boolean}, spécifie s'il s'agit de la fenêtre destinée à l'affichage d'un fichier pdf
17
- l'objet retourné est utilisé pour étendre les options à utiliser pour la création du BrowserWidow
18
- @return {object};
19
- */
20
- beforeCreateWindow : function({isMainWindow,isPDFWindow,...BrowserWindowOptions}){
21
- return {};
22
- },
23
- /*** exécutée lorsque l'évènement ready-to-show de la fenêtre principale BrowserWindow est appelée
24
- @param {Instance of BrowserWindow} mainBrowserWindow
25
- */
26
- onMainWindowReadyToShow : function(mainBrowserWindow){},
27
- /**** exécutée lorsque l'évènement close de la fenêtre principale est appelée
28
- @param {Instance of BrowserWindow} mainBrowserWindow
29
- */
30
- onMainWindowClose : function(mainBrowserWindow){},
31
- /**** exécutée lorsque l'évènement closed de la fenêtre principale est appélée
32
- @param {InstanceOf BrowserWindow} mainBrowserWindow
33
- */
34
- onMainWindowClosed : function(mainBrowserWindow){},
35
- /*****
36
- must return an Instance of Browser window
37
- width: 500, height: 400, transparent: true, frame: false, alwaysOnTop: true
38
- @param {width{number|500},{height{number|400}},transparent{boolean|true}, frame{boolean|false}, alwaysOnTop{boolean|true}}
39
- @return {InstanceOf(BrowserWindow)}
40
- */
41
- splashScreen : function({width, height, transparent, frame, alwaysOnTop}){
42
- return null;
43
- },
44
- /*** this function is called when app is ready
45
- toggleDevTools : {function},la fonction permettant de toggle les outils de developements
46
- browserWindow|mainWindow : {BrowserWindow}, le browser window principal de l'application
47
- */
48
- whenAppReady : function({toggleDevTools,browserWindow,mainWindow}){},
49
- /*** exécutée une fois que la fonction createWindow est appelée pour créer le main Browser window de l'application
50
- @param {InstanceOf BrowserWindow} mainBrowserWindow
51
- */
52
- onCreateMainWindow : function(mainBrowserWindow){
53
-
54
- }
55
- }
@@ -1,6 +0,0 @@
1
- /**** auto generated file
2
- * in this file, you can add renderer process code you want for your electron application
3
- * @param ELECTRON {object}, electron object that will be expose on renderer script with contextBridge
4
- */
5
-
6
- module.exports = (ELECTRON)=>{}
@@ -1,11 +0,0 @@
1
- const fs = require("fs");
2
- const path = require("path");
3
- /*** check if electron is initialized at project root */
4
- module.exports = (projectRoot)=>{
5
- projectRoot = typeof projectRoot =='string' && projectRoot && fs.existsSync(projectRoot) && projectRoot || process.cwd();
6
- return fs.existsSync(path.resolve(projectRoot,"node_modules")) && fs.existsSync(path.resolve(projectRoot,"index.js"))
7
- && fs.existsSync(path.resolve(projectRoot,"package.json"))
8
- && fs.existsSync(path.resolve(projectRoot,'processes',"main","index.js"))
9
- && fs.existsSync(path.resolve(projectRoot,'processes',"renderer","index.js"))
10
- && true || false;
11
- }