sunrize 1.3.2 → 1.3.3

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/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "sunrize",
3
3
  "productName": "Sunrize X3D Editor",
4
- "version": "1.3.2",
4
+ "version": "1.3.3",
5
5
  "description": "A Multi-Platform X3D Editor",
6
6
  "main": "src/main.js",
7
7
  "bin": {
@@ -14,15 +14,16 @@
14
14
  "scripts": {
15
15
  "start": "electron .",
16
16
  "development": "SUNRISE_ENVIRONMENT=DEVELOPMENT electron .",
17
- "prepackage": "npm i -D electron",
18
- "package": "electron-forge package",
19
- "postpackage": "npm i -P electron",
17
+ "package": "node build/package.js",
20
18
  "premake": "npm i -D electron",
21
19
  "make": "electron-forge make",
22
20
  "postmake": "npm i -P electron",
23
21
  "release": "node build/release.js",
24
22
  "download": "node build/download.js",
25
- "docs": "cd docs && bundle exec jekyll serve --incremental --host=192.168.0.18",
23
+ "predocs": "rm -r docs/_site/",
24
+ "docs": "cd docs && bundle exec jekyll serve --incremental --host=`ipconfig getifaddr en0`",
25
+ "docs-install": "cd docs && bundle install",
26
+ "docs-update": "cd docs && bundle update",
26
27
  "make-x_ite-for-sunrize": "sh build/make-x_ite-for-sunrize.sh"
27
28
  },
28
29
  "repository": {
@@ -69,12 +70,12 @@
69
70
  "@electron-forge/maker-rpm": "^7.2.0",
70
71
  "@electron-forge/maker-squirrel": "^7.2.0",
71
72
  "@electron-forge/maker-zip": "^7.2.0",
72
- "shell-tools": "^1.1.5"
73
+ "shell-tools": "^1.1.7"
73
74
  },
74
75
  "dependencies": {
75
76
  "capitalize": "^2.0.4",
76
77
  "console": "^0.7.2",
77
- "electron": "^27.1.3",
78
+ "electron": "^28.0.0",
78
79
  "electron-prompt": "^1.7.0",
79
80
  "electron-squirrel-startup": "^1.0.0",
80
81
  "electron-tabs": "^1.0.2",
@@ -83,15 +84,15 @@
83
84
  "jquery-ui-dist": "^1.13.2",
84
85
  "jstree": "^3.3.16",
85
86
  "material-icons": "^1.13.12",
86
- "material-symbols": "^0.14.1",
87
+ "material-symbols": "^0.14.2",
87
88
  "md5": "^2.3.0",
88
- "monaco-editor": "^0.44.0",
89
+ "monaco-editor": "^0.45.0",
89
90
  "node-clipboardy": "^1.0.3",
90
91
  "node-localstorage": "^3.0.5",
91
92
  "qtip2": "^3.0.3",
92
93
  "spectrum-colorpicker2": "^2.0.10",
93
94
  "string-similarity": "^4.0.4",
94
- "x_ite": "^9.1.8"
95
+ "x_ite": "^9.1.9"
95
96
  },
96
97
  "config": {
97
98
  "forge": {
@@ -1,12 +1,14 @@
1
+ "use strict";
2
+
1
3
  const
2
4
  fs = require ("fs"),
3
5
  path = require ("path"),
4
- url = require ("url")
6
+ url = require ("url");
5
7
 
6
8
  class Template
7
9
  {
8
- static #templates = new Set ()
9
- static #stats = new Map ()
10
+ static #templates = new Set ();
11
+ static #stats = new Map ();
10
12
 
11
13
  static create (template)
12
14
  {
@@ -15,36 +17,36 @@ class Template
15
17
  dirname = path .dirname (template),
16
18
  stats = fs .statSync (dirname);
17
19
 
18
- this .#templates .add (template)
19
- this .#stats .set (dirname, stats)
20
+ this .#templates .add (template);
21
+ this .#stats .set (dirname, stats);
20
22
 
21
23
  const file = fs .readFileSync (template)
22
24
  .toString ()
23
25
  .replace (/(url\()(.*?)(\))/sg, Template .resolve .bind (null, template))
24
- .replace (/(href=")(.*?)(")/sg, Template .resolve .bind (null, template))
26
+ .replace (/(href=")(.*?)(")/sg, Template .resolve .bind (null, template));
25
27
 
26
- fs .writeFileSync (filename, file)
27
- fs .utimesSync (dirname, stats .atime, stats .mtime)
28
+ fs .writeFileSync (filename, file);
29
+ fs .utimesSync (dirname, stats .atime, stats .mtime);
28
30
 
29
- return filename
31
+ return filename;
30
32
  }
31
33
 
32
34
  static removeAll ()
33
35
  {
34
36
  for (const template of new Set (this .#templates))
35
- this .remove (template)
37
+ this .remove (template);
36
38
  }
37
39
 
38
40
  static remove (template)
39
41
  {
40
42
  const
41
43
  dirname = path .dirname (template),
42
- stats = this .#stats .get (dirname)
44
+ stats = this .#stats .get (dirname);
43
45
 
44
- fs .unlinkSync (this .filename (template))
45
- fs .utimesSync (dirname, stats .atime, stats .mtime)
46
+ fs .unlinkSync (this .filename (template));
47
+ fs .utimesSync (dirname, stats .atime, stats .mtime);
46
48
 
47
- this .#templates .delete (template)
49
+ this .#templates .delete (template);
48
50
  }
49
51
 
50
52
  static filename (template)
@@ -52,25 +54,25 @@ class Template
52
54
  const
53
55
  dirname = path .dirname (template),
54
56
  basename = path .basename (template),
55
- filename = path .resolve (dirname, basename .replace (/-template/, ""))
57
+ filename = path .resolve (dirname, basename .replace (/-template/, ""));
56
58
 
57
- return filename
59
+ return filename;
58
60
  }
59
61
 
60
62
  static resolve (template, all, begin, filename, end)
61
63
  {
62
- const match = filename .match (/^.*?\/node_modules\/(.*?)$/)
64
+ const match = filename .match (/^.*?\/node_modules\/(.*?)$/);
63
65
 
64
66
  if (match)
65
- return begin + url .pathToFileURL (require .resolve (match [1])) + end
67
+ return begin + url .pathToFileURL (require .resolve (match [1])) + end;
66
68
 
67
- const resolved = new URL (filename, url .pathToFileURL (template))
69
+ const resolved = new URL (filename, url .pathToFileURL (template));
68
70
 
69
71
  if (resolved .protocol === "file:")
70
- return begin + resolved + end
72
+ return begin + resolved + end;
71
73
 
72
- return all
74
+ return all;
73
75
  }
74
76
  }
75
77
 
76
- module .exports = Template
78
+ module .exports = Template;
@@ -1,13 +1,15 @@
1
- const Document = require ("./Document")
1
+ "use strict";
2
+
3
+ const Document = require ("./Document");
2
4
 
3
5
  module .exports = new class Window extends Document
4
6
  {
5
7
  constructor ()
6
8
  {
7
- super ()
9
+ super ();
8
10
 
9
11
  // Setup
10
12
 
11
- this .setup ()
13
+ this .setup ();
12
14
  }
13
- }
15
+ };
@@ -1,161 +1,165 @@
1
1
 
2
- "use strict"
2
+ "use strict";
3
3
 
4
4
  const
5
5
  $ = require ("jquery"),
6
6
  electron = require ("electron"),
7
- X3D = require ("../X3D"),
8
7
  Interface = require ("../Application/Interface"),
9
- _ = require ("../Application/GetText")
8
+ _ = require ("../Application/GetText");
10
9
 
11
10
  module .exports = class Console extends Interface
12
11
  {
13
- HISTORY_MAX = 100
12
+ HISTORY_MAX = 100;
13
+ CONSOLE_MAX = 1000;
14
14
 
15
15
  logLevels = [
16
16
  "debug",
17
17
  "log",
18
18
  "warn",
19
19
  "error",
20
- ]
20
+ ];
21
21
 
22
- logClasses = ["", "", "filled", "filled"]
22
+ logClasses = ["", "", "filled", "filled"];
23
23
 
24
24
  constructor (element)
25
25
  {
26
- super (`Sunrize.Console.${element .attr ("id")}.`)
26
+ super (`Sunrize.Console.${element .attr ("id")}.`);
27
27
 
28
- this .suspendConsole = false
29
- this .messageTime = 0
30
- this .historyIndex = 0
31
- this .history = [ ]
32
- this .addMessageCallback = this .addMessage .bind (this)
28
+ this .suspendConsole = false;
29
+ this .messageTime = 0;
30
+ this .historyIndex = 0;
31
+ this .history = [ ];
32
+ this .addMessageCallback = this .addMessage .bind (this);
33
33
 
34
- this .console = element
35
- this .left = $("<div></div>") .addClass ("console-left") .appendTo (this .console)
36
- this .toolbar = $("<div></div>") .addClass (["toolbar", "vertical-toolbar", "console-toolbar"]) .appendTo (this .console)
37
- this .output = $("<div></div>") .addClass (["console-output", "output"]) .attr ("tabindex", 0) .appendTo (this .left)
38
- this .input = $("<div></div>") .addClass ("console-input") .appendTo (this .left)
34
+ this .console = element;
35
+ this .left = $("<div></div>") .addClass ("console-left") .appendTo (this .console);
36
+ this .toolbar = $("<div></div>") .addClass (["toolbar", "vertical-toolbar", "console-toolbar"]) .appendTo (this .console);
37
+ this .output = $("<div></div>") .addClass (["console-output", "output"]) .attr ("tabindex", 0) .appendTo (this .left);
38
+ this .input = $("<div></div>") .addClass ("console-input") .appendTo (this .left);
39
39
 
40
40
  this .suspendButton = $("<span></span>")
41
41
  .addClass ("material-icons")
42
42
  .attr ("title", _ ("Suspend console output."))
43
43
  .text ("cancel")
44
44
  .appendTo (this .toolbar)
45
- .on ("click", () => this .setSuspendConsole (!this .suspendConsole))
45
+ .on ("click", () => this .setSuspendConsole (!this .suspendConsole));
46
46
 
47
47
  this .clearButton = $("<span></span>")
48
48
  .addClass ("material-icons")
49
49
  .attr ("title", _ ("Clear console."))
50
50
  .text ("delete_forever")
51
51
  .appendTo (this .toolbar)
52
- .on ("click", () => this .clearConsole ())
52
+ .on ("click", () => this .clearConsole ());
53
53
 
54
- $("<span></span>") .addClass ("separator") .appendTo (this .toolbar)
54
+ $("<span></span>") .addClass ("separator") .appendTo (this .toolbar);
55
55
 
56
56
  this .textarea = $("<textarea></textarea>")
57
57
  .attr ("placeholder", _ ("Evaluate JavaScript code here."))
58
58
  .attr ("tabindex", 0)
59
59
  .appendTo (this .input)
60
60
  .on ("keydown", event => this .onkeydown (event))
61
- .on ("keyup", event => this .onkeyup (event))
61
+ .on ("keyup", event => this .onkeyup (event));
62
62
 
63
63
  if (this .console .attr ("id") !== "console")
64
64
  {
65
- this .output .html ($("#console .console-output") .html ())
66
- this .output .scrollTop (this .output .prop ("scrollHeight"))
65
+ this .output .html ($("#console .console-output") .html ());
66
+ this .output .scrollTop (this .output .prop ("scrollHeight"));
67
67
  }
68
68
  else
69
69
  {
70
- this .addMessage (null, 1, "", "", this .browser .getWelcomeMessage ())
70
+ this .addMessage (null, 1, "", "", this .browser .getWelcomeMessage ());
71
71
  }
72
72
 
73
- electron .ipcRenderer .on ("console-message", this .addMessageCallback)
73
+ electron .ipcRenderer .on ("console-message", this .addMessageCallback);
74
74
 
75
- this .setup ()
75
+ this .setup ();
76
76
  }
77
77
 
78
78
  configure ()
79
79
  {
80
- super .configure ()
80
+ super .configure ();
81
81
 
82
- this .fileConfig .setDefaultValues ({ history: [ ] })
82
+ this .fileConfig .setDefaultValues ({ history: [ ] });
83
83
 
84
- this .history = this .fileConfig .history .slice (-this .HISTORY_MAX)
85
- this .historyIndex = this .history .length
84
+ this .history = this .fileConfig .history .slice (-this .HISTORY_MAX);
85
+ this .historyIndex = this .history .length;
86
86
  }
87
87
 
88
88
  async browserInitialized (event)
89
89
  {
90
- super .browserInitialized (event)
90
+ super .browserInitialized (event);
91
91
 
92
- await this .browser .loadComponents (this .browser .getComponent ("Scripting"))
92
+ await this .browser .loadComponents (this .browser .getComponent ("Scripting"));
93
93
 
94
- const Script = this .browser .getConcreteNode ("Script")
94
+ const Script = this .browser .getConcreteNode ("Script");
95
95
 
96
- this .scriptNode = new Script (this .browser .currentScene)
96
+ this .scriptNode = new Script (this .browser .currentScene);
97
97
 
98
- this .scriptNode .setup ()
98
+ this .scriptNode .setup ();
99
99
  }
100
100
 
101
101
  excludes = new Set ([
102
102
  "The vm module of Node.js is deprecated in the renderer process and will be removed.",
103
103
  "Invalid asm.js: Invalid member of stdlib",
104
- ])
104
+ ]);
105
105
 
106
106
  addMessage (event, level, sourceId, line, message)
107
107
  {
108
108
  if (this .excludes .has (message))
109
- return
109
+ return;
110
110
 
111
111
  const
112
112
  classes = [this .logLevels [level] ?? "log", this .logClasses [level]],
113
113
  title = sourceId ? `${sourceId}:${line}`: "",
114
- text = $("<p></p>") .addClass (classes) .attr ("title", title) .text (message)
114
+ text = $("<p></p>") .addClass (classes) .attr ("title", title) .text (message);
115
115
 
116
116
  if (this .messageTime && performance .now () - this .messageTime > 1000)
117
- this .output .append ($("<p></p>") .addClass ("splitter"))
117
+ this .output .append ($("<p></p>") .addClass ("splitter"));
118
118
 
119
- this .messageTime = performance .now ()
119
+ this .messageTime = performance .now ();
120
120
 
121
- const last = this .output .children () .last ()
121
+ const
122
+ children = this .output .children (),
123
+ last = children .last ();
122
124
 
123
125
  if (last .hasClass (this .logLevels [level]))
124
126
  {
125
- last .css ("margin-bottom", "0")
126
- text .css ("margin-top", "0")
127
- last .css ("border-bottom", "none")
128
- text .css ("border-top", "none")
127
+ last .css ("margin-bottom", "0");
128
+ text .css ("margin-top", "0");
129
+ last .css ("border-bottom", "none");
130
+ text .css ("border-top", "none");
129
131
  }
130
132
 
131
- this .output .append (text)
132
- this .output .scrollTop (this .output .prop ("scrollHeight"))
133
+ children .slice (0, Math .max (children .length - this .CONSOLE_MAX, 0)) .remove ();
134
+
135
+ this .output .append (text);
136
+ this .output .scrollTop (this .output .prop ("scrollHeight"));
133
137
  }
134
138
 
135
139
  setSuspendConsole (value)
136
140
  {
137
- this .suspendConsole = value
141
+ this .suspendConsole = value;
138
142
 
139
143
  if (value)
140
144
  {
141
- electron .ipcRenderer .off ("console-message", this .addMessageCallback)
142
- this .addMessage (null, "info", __filename, 0, `Console output suspended at ${new Date () .toLocaleTimeString ()}.`)
143
- this .suspendButton .addClass ("active")
145
+ electron .ipcRenderer .off ("console-message", this .addMessageCallback);
146
+ this .addMessage (null, "info", __filename, 0, `Console output suspended at ${new Date () .toLocaleTimeString ()}.`);
147
+ this .suspendButton .addClass ("active");
144
148
  }
145
149
  else
146
150
  {
147
- electron .ipcRenderer .on ("console-message", this .addMessageCallback)
148
- this .addMessage (null, "info", __filename, 0, `Console output enabled at ${new Date () .toLocaleTimeString ()}.`)
149
- this .suspendButton .removeClass ("active")
151
+ electron .ipcRenderer .on ("console-message", this .addMessageCallback);
152
+ this .addMessage (null, "info", __filename, 0, `Console output enabled at ${new Date () .toLocaleTimeString ()}.`);
153
+ this .suspendButton .removeClass ("active");
150
154
  }
151
155
  }
152
156
 
153
157
  clearConsole ()
154
158
  {
155
- this .messageTime = 0
159
+ this .messageTime = 0;
156
160
 
157
- this .output .empty ()
158
- this .addMessage (null, "info", __filename, 0, `Console cleared at ${new Date () .toLocaleTimeString ()}.`)
161
+ this .output .empty ();
162
+ this .addMessage (null, "info", __filename, 0, `Console cleared at ${new Date () .toLocaleTimeString ()}.`);
159
163
  }
160
164
 
161
165
  onkeydown (event)
@@ -164,45 +168,45 @@ module .exports = class Console extends Interface
164
168
  {
165
169
  case "Enter":
166
170
  {
167
- this .evaluateSourceCode (event)
168
- return
171
+ this .evaluateSourceCode (event);
172
+ return;
169
173
  }
170
174
  case "ArrowUp":
171
175
  {
172
176
  if (this .historyIndex === this .history .length)
173
177
  {
174
- const text = this .textarea .val () .trim ()
178
+ const text = this .textarea .val () .trim ();
175
179
 
176
180
  if (text && text !== this .history .at (-1))
177
- this .history .push (text)
181
+ this .history .push (text);
178
182
  }
179
183
 
180
- this .fileConfig .history = this .history
184
+ this .fileConfig .history = this .history;
181
185
 
182
- this .historyIndex = Math .max (this .historyIndex - 1, 0)
186
+ this .historyIndex = Math .max (this .historyIndex - 1, 0);
183
187
 
184
188
  if (this .historyIndex < this .history .length)
185
- this .textarea .val (this .history [this .historyIndex])
189
+ this .textarea .val (this .history [this .historyIndex]);
186
190
 
187
- this .adjustTextAreaHeight ()
188
- return
191
+ this .adjustTextAreaHeight ();
192
+ return;
189
193
  }
190
194
  case "ArrowDown":
191
195
  {
192
- this .historyIndex = Math .min (this .historyIndex + 1, this .history .length - 1)
196
+ this .historyIndex = Math .min (this .historyIndex + 1, this .history .length - 1);
193
197
 
194
198
  if (this .historyIndex < this .history .length)
195
- this .textarea .val (this .history [this .historyIndex])
199
+ this .textarea .val (this .history [this .historyIndex]);
196
200
 
197
- this .adjustTextAreaHeight ()
198
- return
201
+ this .adjustTextAreaHeight ();
202
+ return;
199
203
  }
200
204
  }
201
205
  }
202
206
 
203
207
  onkeyup (event)
204
208
  {
205
- this .adjustTextAreaHeight ()
209
+ this .adjustTextAreaHeight ();
206
210
  }
207
211
 
208
212
  adjustTextAreaHeight ()
@@ -214,41 +218,41 @@ module .exports = class Console extends Interface
214
218
  "word-wrap": "break-word",
215
219
  })
216
220
  .text (this .textarea .val ())
217
- .appendTo ($("body"))
221
+ .appendTo ($("body"));
218
222
 
219
- this .input .css ("height", `${div .height () + 5}px`)
220
- this .output .css ("height", `calc(100% - ${this .input .height ()}px)`)
223
+ this .input .css ("height", `${div .height () + 5}px`);
224
+ this .output .css ("height", `calc(100% - ${this .input .height ()}px)`);
221
225
 
222
- div .remove ()
226
+ div .remove ();
223
227
  }
224
228
 
225
229
  evaluateSourceCode (event)
226
230
  {
227
- event .preventDefault ()
231
+ event .preventDefault ();
228
232
 
229
- const text = this .textarea .val () .trim ()
233
+ const text = this .textarea .val () .trim ();
230
234
 
231
235
  if (!text)
232
- return
236
+ return;
233
237
 
234
238
  if (text !== this .history .at (-1))
235
- this .history .push (text)
239
+ this .history .push (text);
236
240
 
237
- this .fileConfig .history = this .history
241
+ this .fileConfig .history = this .history;
238
242
 
239
- this .historyIndex = this .history .length
243
+ this .historyIndex = this .history .length;
240
244
 
241
- console .info (text)
245
+ console .info (text);
242
246
 
243
247
  try
244
248
  {
245
- console .debug (String (this .scriptNode .evaluate (text)))
249
+ console .debug (String (this .scriptNode .evaluate (text)));
246
250
  }
247
251
  catch (error)
248
252
  {
249
- console .error (`${error .name}: ${error .message}`)
253
+ console .error (`${error .name}: ${error .message}`);
250
254
  }
251
255
 
252
- this .textarea .val ("")
256
+ this .textarea .val ("");
253
257
  }
254
- }
258
+ };
package/src/X3D.js CHANGED
@@ -1,8 +1,5 @@
1
1
  "use strict";
2
2
 
3
- /**
4
- * @type {{ SFBool: SFBool, SFColor: SFColor, }}
5
- */
6
3
  const X3D = process .env .SUNRISE_ENVIRONMENT === "DEVELOPMENT" ? require ("../x_ite/x_ite.js") : require ("x_ite");
7
4
 
8
5
  module .exports = X3D;
@@ -1,6 +1,6 @@
1
- "use strict"
1
+ "use strict";
2
2
 
3
3
  window .addEventListener ("DOMContentLoaded", () =>
4
4
  {
5
- require ("../../Application/Tabs")
6
- })
5
+ require ("../../Application/Tabs");
6
+ });
@@ -1,8 +1,8 @@
1
- "use strict"
1
+ "use strict";
2
2
 
3
3
  window .addEventListener ("DOMContentLoaded", () =>
4
4
  {
5
- const electron = require ("electron")
5
+ const electron = require ("electron");
6
6
 
7
- electron .ipcRenderer .on ("activate", () => require ("../../Application/Window"))
8
- })
7
+ electron .ipcRenderer .on ("activate", () => require ("../../Application/Window"));
8
+ });