sunrize 1.0.75 → 1.0.77

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 CHANGED
@@ -16,7 +16,7 @@ You can run Sunrize without installing it using **npx**:
16
16
  $ npx sunrize [files]
17
17
  ```
18
18
 
19
- Note: The first time, it may take a while for Sunrize to start.
19
+ **Note:** The first time, it may take a while for Sunrize to start.
20
20
 
21
21
  ## License
22
22
 
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "sunrize",
3
3
  "productName": "Sunrize X3D Editor",
4
- "version": "1.0.75",
4
+ "version": "1.0.77",
5
5
  "description": "A Multi Platform X3D Editor",
6
6
  "homepage": "https://create3000.github.io/sunrize/",
7
7
  "author": "Holger Seelig",
@@ -6,7 +6,7 @@ const
6
6
  path = require ("path"),
7
7
  fs = require ("fs"),
8
8
  util = require ("util"),
9
- template = require ("./Template"),
9
+ Template = require ("./Template"),
10
10
  LocalStorage = require ("node-localstorage") .LocalStorage,
11
11
  DataStorage = require ("../Application/DataStorage"),
12
12
  _ = require ("../Application/GetText")
@@ -55,9 +55,9 @@ module .exports = class Application
55
55
  timings: false,
56
56
  })
57
57
 
58
- template (path .join (__dirname, "../../html/application-template.html"))
59
- template (path .join (__dirname, "../../html/document-template.html"))
60
- template (path .join (__dirname, "../../themes/default-template.css"))
58
+ Template .create (path .join (__dirname, "../../html/application-template.html"))
59
+ Template .create (path .join (__dirname, "../../html/document-template.html"))
60
+ Template .create (path .join (__dirname, "../../themes/default-template.css"))
61
61
 
62
62
  this .setup ()
63
63
  }
@@ -717,9 +717,13 @@ module .exports = class Application
717
717
 
718
718
  quit ()
719
719
  {
720
- if (! this .applicationShouldQuitAfterLastWindowClosed)
720
+ if (!this .applicationShouldQuitAfterLastWindowClosed)
721
721
  return
722
722
 
723
+ Template .remove (path .join (__dirname, "../../html/application-template.html"))
724
+ Template .remove (path .join (__dirname, "../../html/document-template.html"))
725
+ Template .remove (path .join (__dirname, "../../themes/default-template.css"))
726
+
723
727
  electron .app .quit ()
724
728
  }
725
729
  }
@@ -3,31 +3,59 @@ const
3
3
  path = require ("path"),
4
4
  url = require ("url")
5
5
 
6
- function template (template)
6
+ class Template
7
7
  {
8
- const
9
- dirname = path .dirname (template),
10
- basename = path .basename (template),
11
- filename = path .resolve (dirname, basename .replace (/-template/, ""))
8
+ static #stats = new Map ()
12
9
 
13
- const file = fs .readFileSync (template)
14
- .toString ()
15
- .replace (/(url\()(.*?)(\))/sg, resolve)
16
- .replace (/(href=")(.*?)(")/sg, resolve)
10
+ static create (template)
11
+ {
12
+ const
13
+ filename = this .filename (template),
14
+ dirname = path .dirname (template),
15
+ stats = fs .statSync (dirname);
17
16
 
18
- fs .writeFileSync (filename, file)
17
+ this .#stats .set (dirname, stats)
19
18
 
20
- return filename
21
- }
19
+ const file = fs .readFileSync (template)
20
+ .toString ()
21
+ .replace (/(url\()(.*?)(\))/sg, Template .resolve)
22
+ .replace (/(href=")(.*?)(")/sg, Template .resolve)
22
23
 
23
- function resolve (all, begin, filename, end)
24
- {
25
- const match = filename .match (/^.*?\/node_modules\/(.*?)$/)
24
+ fs .writeFileSync (filename, file)
25
+ fs .utimesSync (dirname, stats .atime, stats .mtime)
26
+
27
+ return filename
28
+ }
29
+
30
+ static remove (template)
31
+ {
32
+ const
33
+ dirname = path .dirname (template),
34
+ stats = this .#stats .get (dirname)
35
+
36
+ fs .unlinkSync (this .filename (template))
37
+ fs .utimesSync (dirname, stats .atime, stats .mtime)
38
+ }
39
+
40
+ static filename (template)
41
+ {
42
+ const
43
+ dirname = path .dirname (template),
44
+ basename = path .basename (template),
45
+ filename = path .resolve (dirname, basename .replace (/-template/, ""))
46
+
47
+ return filename
48
+ }
49
+
50
+ static resolve (all, begin, filename, end)
51
+ {
52
+ const match = filename .match (/^.*?\/node_modules\/(.*?)$/)
26
53
 
27
- if (!match)
28
- return all
54
+ if (!match)
55
+ return all
29
56
 
30
- return begin + url .pathToFileURL (require .resolve (match [1])) + end
57
+ return begin + url .pathToFileURL (require .resolve (match [1])) + end
58
+ }
31
59
  }
32
60
 
33
- module .exports = template
61
+ module .exports = Template
@@ -1,71 +0,0 @@
1
- <html>
2
- <head>
3
- <meta charset="utf-8"/>
4
- <!-- Theme -->
5
- <link rel="stylesheet" type="text/css" href="../themes/default.css"/>
6
- </head>
7
- <body>
8
- <tab-group sortable="true">
9
- <style>
10
- .etabs .nav {
11
- height: var(--window-tabs-height);
12
- background: var(--background-color);
13
- box-shadow: none;
14
- border: none;
15
- }
16
-
17
- .etabs .tab {
18
- background: var(--window-tabs-background-color);
19
- border-color: var(--border-color) !important;
20
- padding: 4px 3px;
21
- color: var(--window-tabs-text-color);
22
- font-family: var(--sans-serif);
23
- box-shadow: none;
24
- }
25
-
26
- .etabs .tab.active {
27
- z-index: 1100;
28
- background: var(--background-color);
29
- color: var(--window-tabs-highlight-color);
30
- }
31
-
32
- .etabs::before {
33
- z-index: 1000;
34
- content: "";
35
- position: relative;
36
- display: block;
37
- height: 1px;
38
- width: 100%;
39
- box-shadow: var(--tabs-shadow);
40
- }
41
-
42
- .etabs .buttons {
43
- border-color: var(--border-color);
44
- }
45
-
46
- .etabs .buttons:hover button,
47
- .etabs .tab-close button:hover {
48
- background: none;
49
- }
50
-
51
- .etabs .buttons button:hover,
52
- .etabs .tab-close:hover button {
53
- color: var(--system-gray0);
54
- }
55
-
56
- .etabs .tab-close button {
57
- visibility: hidden;
58
- }
59
-
60
- .etabs .tab.active .tab-close button,
61
- .etabs .tab:hover .tab-close button {
62
- visibility: visible;
63
- }
64
-
65
- .etabs .tab-close {
66
- margin-left: 4px;
67
- }
68
- </style>
69
- </tab-group>
70
- </body>
71
- </html>
@@ -1,36 +0,0 @@
1
- <html>
2
- <head>
3
- <meta charset="utf-8"/>
4
- <link rel="stylesheet" type="text/css" href="file:///Users/holger/Desktop/X_ITE/sunrize/node_modules/jquery-ui-dist/jquery-ui.min.css"/>
5
- <link rel="stylesheet" type="text/css" href="file:///Users/holger/Desktop/X_ITE/sunrize/node_modules/qtip2/dist/jquery.qtip.min.css"/>
6
- <link rel="stylesheet" type="text/css" href="../themes/default.css"/>
7
- <link rel="stylesheet" data-name="vs/editor/editor.main" href="file:///Users/holger/Desktop/X_ITE/sunrize/node_modules/monaco-editor/min/vs/editor/editor.main.css">
8
- </head>
9
- <body>
10
- <div id="vertical-splitter" class="vertical-splitter">
11
- <div class="vertical-splitter-left">
12
- <div id="horizontal-splitter" class="horizontal-splitter">
13
- <div class="horizontal-splitter-top">
14
- <div id="browser-pane">
15
- <div id="browser-frame">
16
- <x3d-canvas
17
- id="browser"
18
- preserveDrawingBuffer="true"
19
- splashScreen="false"
20
- contextMenu="false"
21
- debug="false"></x3d-canvas>
22
- </div>
23
- <div id="secondary-toolbar" class="toolbar vertical-toolbar large-toolbar secondary-toolbar"></div>
24
- </div>
25
- </div>
26
- <div class="horizontal-splitter-bottom">
27
- <div id="footer"></div>
28
- </div>
29
- </div>
30
- </div>
31
- <div class="vertical-splitter-right">
32
- <div id="sidebar" class="sidebar"></div>
33
- </div>
34
- </div>
35
- </body>
36
- </html>