sunrize 2.4.0 → 2.5.0

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 (50) hide show
  1. package/package.json +7 -7
  2. package/src/Application/Application.js +21 -2
  3. package/src/Application/Dashboard.js +21 -19
  4. package/src/Application/DataStorage.js +10 -37
  5. package/src/Application/Document.js +149 -22
  6. package/src/Application/Footer.js +62 -16
  7. package/src/Application/Hierarchy.js +1 -1
  8. package/src/Application/Interface.js +1 -1
  9. package/src/Application/Sidebar.js +12 -9
  10. package/src/Application/Tabs.js +79 -11
  11. package/src/Controls/Splitter.js +146 -19
  12. package/src/Controls/Tabs.js +17 -12
  13. package/src/Editors/AnimationEditor.js +203 -194
  14. package/src/Editors/AnimationMemberList.js +37 -6
  15. package/src/Editors/BrowserFrame.js +17 -10
  16. package/src/Editors/Console.js +9 -13
  17. package/src/Editors/MediaRecorder.js +27 -0
  18. package/src/Editors/NodeList.js +35 -0
  19. package/src/Editors/OutlineEditor.js +20 -20
  20. package/src/Editors/OutlineView.js +85 -61
  21. package/src/Editors/Panel.js +6 -3
  22. package/src/Editors/RouteGraph.js +72 -102
  23. package/src/Editors/SceneProperties.js +4 -4
  24. package/src/Editors/ScriptEditor.js +37 -23
  25. package/src/Tools/Core/X3DBaseTool.js +11 -10
  26. package/src/Tools/Core/X3DImportedNodeInstanceTool.js +52 -0
  27. package/src/Tools/Core/X3DPrototypeInstanceTool.js +6 -6
  28. package/src/Tools/Grids/GridTool.js +6 -2
  29. package/src/Tools/Grids/X3DGridNodeTool.js +1 -1
  30. package/src/Tools.js +0 -3
  31. package/src/Undo/Editor.js +19 -16
  32. package/src/Undo/UndoManager.js +1 -1
  33. package/src/assets/fonts/Roboto/OFL.txt +93 -0
  34. package/src/assets/fonts/Roboto/README.txt +118 -0
  35. package/src/assets/fonts/Roboto/Roboto-Italic-VariableFont_wdth,wght.ttf +0 -0
  36. package/src/assets/fonts/Roboto/Roboto-VariableFont_wdth,wght.ttf +0 -0
  37. package/src/assets/fonts/Roboto_Mono/OFL.txt +93 -0
  38. package/src/assets/fonts/Roboto_Mono/README.txt +77 -0
  39. package/src/assets/fonts/Roboto_Mono/RobotoMono-Italic-VariableFont_wght.ttf +0 -0
  40. package/src/assets/fonts/Roboto_Mono/RobotoMono-VariableFont_wght.ttf +0 -0
  41. package/src/assets/html/application.html +34 -9
  42. package/src/assets/html/window.html +6 -7
  43. package/src/assets/themes/default.css +133 -156
  44. package/src/assets/themes/{system-colors.css → definitions.css} +50 -7
  45. package/src/assets/themes/media-template.css +3 -2
  46. package/src/assets/themes/media.css +3 -2
  47. package/src/assets/themes/prompt-template.css +4 -1
  48. package/src/assets/themes/prompt.css +4 -1
  49. package/src/assets/html/application-template.html +0 -164
  50. package/src/assets/html/window-template.html +0 -39
@@ -18,6 +18,13 @@ module .exports = class AnimationMembersList extends Interface
18
18
  #animation;
19
19
  #timeSensor;
20
20
 
21
+ get outlineEditor ()
22
+ {
23
+ const document = require ("../Application/Window");
24
+
25
+ return document .sidebar .outlineEditor;
26
+ }
27
+
21
28
  constructor (editor, element)
22
29
  {
23
30
  super ("Sunrize.AnimationMembersList.");
@@ -105,13 +112,13 @@ module .exports = class AnimationMembersList extends Interface
105
112
  .appendTo (this .#list);
106
113
 
107
114
  const applyButton = $("<span></span>")
108
- .addClass (["apply", "material-icons", "button", "off", "disabled"])
115
+ .addClass (["apply", "material-symbols-outlined", "button", "off", "disabled"])
109
116
  .attr ("title", _("Add keyframe(s)."))
110
117
  .text ("check_box")
111
118
  .on ("click", () => this .addKeyframesToMain ());
112
119
 
113
120
  const removeButton = $("<span></span>")
114
- .addClass (["material-icons-outlined", "button"])
121
+ .addClass (["material-symbols-outlined", "button"])
115
122
  .attr ("title", _("Close animation."))
116
123
  .text ("cancel")
117
124
  .on ("click", () => this .#editor .closeAnimation ());
@@ -126,6 +133,7 @@ module .exports = class AnimationMembersList extends Interface
126
133
  .append (applyButton)
127
134
  .append (document .createTextNode (" "))
128
135
  .append (removeButton)
136
+ .on ("contextmenu", () => this .contextMenuForAnimation (this .#animation))
129
137
  .appendTo (listItem);
130
138
 
131
139
  item
@@ -159,7 +167,7 @@ module .exports = class AnimationMembersList extends Interface
159
167
  .appendTo (this .#list);
160
168
 
161
169
  const applyButton = $("<span></span>")
162
- .addClass (["apply", "material-icons", "button", "off", "disabled"])
170
+ .addClass (["apply", "material-symbols-outlined", "button", "off", "disabled"])
163
171
  .attr ("title", _("Add keyframe(s)."))
164
172
  .text ("check_box")
165
173
  .on ("click", () => this .addKeyframesToNode (node));
@@ -170,7 +178,7 @@ module .exports = class AnimationMembersList extends Interface
170
178
  node .setUserData (this .#animation [_expanded], expanded);
171
179
 
172
180
  const expandButton = $("<span></span>")
173
- .addClass (["material-icons-outlined", "button"])
181
+ .addClass (["material-symbols-outlined", "button"])
174
182
  .addClass (expanded ? "on" : "off")
175
183
  .attr ("title", _("Show all fields."))
176
184
  .text ("expand_circle_down")
@@ -255,7 +263,7 @@ module .exports = class AnimationMembersList extends Interface
255
263
  .text (field .getName ());
256
264
 
257
265
  const applyButton = $("<span></span>")
258
- .addClass (["apply", "material-icons", "button", "off"])
266
+ .addClass (["apply", "material-symbols-outlined", "button", "off"])
259
267
  .attr ("title", _("Add keyframe."))
260
268
  .text ("check_box")
261
269
  .on ("click", () => this .addKeyframeToField (node, field));
@@ -356,13 +364,31 @@ module .exports = class AnimationMembersList extends Interface
356
364
  return offsets;
357
365
  }
358
366
 
367
+ contextMenuForAnimation (node)
368
+ {
369
+ this .#node = node;
370
+
371
+ const menu = [
372
+ {
373
+ label: _("Find Node"),
374
+ args: ["findNode"],
375
+ },
376
+ ];
377
+
378
+ electron .ipcRenderer .send ("context-menu", "animation-members-list", menu);
379
+ }
380
+
359
381
  contextMenuForNode (node)
360
382
  {
361
383
  this .#node = node;
362
384
 
363
385
  const menu = [
364
386
  {
365
- label: _("Remove Member from Animation"),
387
+ label: _("Find Node"),
388
+ args: ["findNode"],
389
+ },
390
+ {
391
+ label: _("Remove Node from Animation"),
366
392
  args: ["removeMember"],
367
393
  },
368
394
  ];
@@ -370,6 +396,11 @@ module .exports = class AnimationMembersList extends Interface
370
396
  electron .ipcRenderer .send ("context-menu", "animation-members-list", menu);
371
397
  }
372
398
 
399
+ findNode ()
400
+ {
401
+ this .outlineEditor .findNode (this .#node);
402
+ }
403
+
373
404
  removeMember ()
374
405
  {
375
406
  this .#editor .removeMembers ([this .#node]);
@@ -105,7 +105,7 @@ module .exports = new class BrowserFrame extends Dialog
105
105
 
106
106
  this .backgroundColor = $("<input></input>")
107
107
  .attr ("title", _("A background color which is applied to the <x3d-canvas> element."))
108
- .attr ("placeholder", "Enter any CSS color here.")
108
+ .attr ("placeholder", "Enter a CSS color here.")
109
109
  .on ("change", () => this .onchange ());
110
110
 
111
111
  $("<tr></tr>")
@@ -113,8 +113,8 @@ module .exports = new class BrowserFrame extends Dialog
113
113
  .append ($("<td></td>") .append (this .backgroundColor))
114
114
  .appendTo (this .table .body);
115
115
 
116
- this .paneObserver = new ResizeObserver (() => this .updateSize ());
117
- this .paneObserver .observe ($("#browser-pane") [0]);
116
+ this .panelObserver = new ResizeObserver (() => this .updateSize ());
117
+ this .panelObserver .observe ($("#browser-panel") [0]);
118
118
 
119
119
  this .frameObserver = new ResizeObserver (() => this .onresize ());
120
120
  this .frameObserver .observe ($("#browser-frame") [0]);
@@ -154,8 +154,10 @@ module .exports = new class BrowserFrame extends Dialog
154
154
 
155
155
  updateSize ()
156
156
  {
157
- this .width .val ($("#browser-pane") .width ());
158
- this .height .val ($("#browser-pane") .height ());
157
+ const frame = $("#browser-frame");
158
+
159
+ this .width .val (frame .innerWidth ());
160
+ this .height .val (frame .innerHeight ());
159
161
  }
160
162
 
161
163
  onchange ()
@@ -189,7 +191,7 @@ module .exports = new class BrowserFrame extends Dialog
189
191
  [numerator = 1, denominator = 1] = configNode ?.getMetaData ("Sunrize/BrowserFrame/aspectRatio") ?? [ ],
190
192
  [backgroundColor = ""] = configNode ?.getMetaData ("Sunrize/BrowserFrame/backgroundColor") ?? [ ],
191
193
  aspectRatio = numerator / denominator,
192
- frameAspectRatio = $("#browser-frame") .width () / $("#browser-frame") .height (),
194
+ frameAspectRatio = $("#browser-frame") .innerWidth () / $("#browser-frame") .innerHeight (),
193
195
  element = $(this .browser .element);
194
196
 
195
197
  if (fixedSize && aspectRatio)
@@ -211,9 +213,14 @@ module .exports = new class BrowserFrame extends Dialog
211
213
 
212
214
  onsize ()
213
215
  {
214
- const document = require ("../Application/Window");
215
-
216
- document .verticalSplitter .position = this .width .val () / $("body") .width ();
217
- document .horizontalSplitter .position = this .height .val () / $("body") .height ();
216
+ const
217
+ document = require ("../Application/Window"),
218
+ xOffset = $("#browser-panel") .outerWidth () - $("#browser-frame") .innerWidth (),
219
+ yOffset = $("#browser-panel") .outerHeight () - $("#browser-frame") .innerHeight (),
220
+ width = parseInt (this .width .val ()),
221
+ height = parseInt (this .height .val ());
222
+
223
+ document .verticalSplitter .position = (width + xOffset) / $("body") .width ();
224
+ document .horizontalSplitter .position = (height + yOffset) / $("body") .height ();
218
225
  }
219
226
  };
@@ -24,10 +24,6 @@ module .exports = class Console extends Interface
24
24
  this .console = element;
25
25
  this .left = $("<div></div>") .addClass ("console-left") .appendTo (this .console);
26
26
 
27
- this .toolbar = $("<div></div>")
28
- .addClass (["toolbar", "vertical-toolbar", "secondary-toolbar", "console-toolbar"])
29
- .appendTo (this .console);
30
-
31
27
  this .output = $("<div></div>")
32
28
  .addClass (["console-output", "output"])
33
29
  .attr ("tabindex", 0)
@@ -87,9 +83,12 @@ module .exports = class Console extends Interface
87
83
 
88
84
  // Toolbar
89
85
 
86
+ this .toolbar = $("<div></div>")
87
+ .addClass (["toolbar", "vertical-toolbar", "secondary-toolbar", "console-toolbar"])
88
+ .appendTo (this .console);
89
+
90
90
  this .searchButton = $("<span></span>")
91
- .addClass ("material-icons")
92
- .css ("transform", "scale(1.2)")
91
+ .addClass ("material-symbols-outlined")
93
92
  .attr ("title", _("Show search widget."))
94
93
  .text ("search")
95
94
  .on ("click", () => this .toggleSearch (!this .config .file .search))
@@ -98,21 +97,21 @@ module .exports = class Console extends Interface
98
97
  $("<span></span>") .addClass ("separator") .appendTo (this .toolbar);
99
98
 
100
99
  this .suspendButton = $("<span></span>")
101
- .addClass ("material-icons")
100
+ .addClass ("material-symbols-outlined")
101
+ .css ("scale", "0.8")
102
102
  .attr ("title", _("Suspend console output."))
103
103
  .text ("pause_circle")
104
104
  .on ("click", () => this .setSuspendConsole (!this .suspendConsole))
105
105
  .appendTo (this .toolbar);
106
106
 
107
107
  this .clearButton = $("<span></span>")
108
- .addClass ("material-icons")
108
+ .addClass ("material-symbols-outlined")
109
+ .css ("scale", "0.8")
109
110
  .attr ("title", _("Clear console."))
110
111
  .text ("delete_forever")
111
112
  .on ("click", () => this .clearConsole ())
112
113
  .appendTo (this .toolbar);
113
114
 
114
- $("<span></span>") .addClass ("separator") .appendTo (this .toolbar);
115
-
116
115
  // Input
117
116
 
118
117
  this .textarea = $("<textarea></textarea>")
@@ -437,10 +436,7 @@ module .exports = class Console extends Interface
437
436
  element .addClass ("selected");
438
437
 
439
438
  if (scroll)
440
- {
441
439
  element .get (0) .scrollIntoView ({ block: "center", inline: "start", behavior: "smooth" });
442
- $(window) .scrollTop (0);
443
- }
444
440
 
445
441
  this .searchStatus .text (util .format (_("%d of %d"), this .currentElement + 1, this .foundElements .length));
446
442
  this .searchPreviousButton .removeClass ("disabled");
@@ -0,0 +1,27 @@
1
+
2
+ "use strict";
3
+
4
+ const
5
+ $ = require ("jquery"),
6
+ electron = require ("electron"),
7
+ Interface = require ("../Application/Interface"),
8
+ util = require ("util"),
9
+ _ = require ("../Application/GetText");
10
+
11
+ module .exports = class MediaRecorder extends Interface
12
+ {
13
+ constructor (element)
14
+ {
15
+ super (`Sunrize.MediaRecorder.${element .attr ("id")}.`);
16
+
17
+ this .recorder = element;
18
+
19
+ // Toolbar
20
+
21
+ this .toolbar = $("<div></div>")
22
+ .addClass (["toolbar", "vertical-toolbar", "secondary-toolbar", "media-recorder-toolbar"])
23
+ .appendTo (this .recorder);
24
+
25
+ this .setup ();
26
+ }
27
+ };
@@ -2,6 +2,7 @@
2
2
 
3
3
  const
4
4
  $ = require ("jquery"),
5
+ electron = require ("electron"),
5
6
  X3D = require ("../X3D"),
6
7
  Interface = require ("../Application/Interface"),
7
8
  Traverse = require ("x3d-traverse"),
@@ -9,6 +10,13 @@ const
9
10
 
10
11
  module .exports = class NodeList extends Interface
11
12
  {
13
+ get outlineEditor ()
14
+ {
15
+ const document = require ("../Application/Window");
16
+
17
+ return document .sidebar .outlineEditor;
18
+ }
19
+
12
20
  constructor (element, { filter = () => true, callback = Function .prototype })
13
21
  {
14
22
  super ("Sunrize.NodeList.");
@@ -21,6 +29,8 @@ module .exports = class NodeList extends Interface
21
29
  this .node = null;
22
30
  this .nodes = [ ];
23
31
 
32
+ electron .ipcRenderer .on ("node-list", (event, key, ... args) => this [key] (... args));
33
+
24
34
  this .setup ();
25
35
  }
26
36
 
@@ -72,6 +82,7 @@ module .exports = class NodeList extends Interface
72
82
  .append (document .createTextNode (" "))
73
83
  .append (nameElement)
74
84
  .on ("click", () => this .setNode (node))
85
+ .on ("contextmenu", () => this .showContextMenu (node))
75
86
  .appendTo (listItem);
76
87
 
77
88
  node .typeName_changed .addInterest ("set_typeName", this, typeNameElement, node);
@@ -124,4 +135,28 @@ module .exports = class NodeList extends Interface
124
135
  {
125
136
  element .text (this .getName (node));
126
137
  }
138
+
139
+ #node;
140
+
141
+ showContextMenu (node)
142
+ {
143
+ this .#node = node;
144
+
145
+ const menu = [
146
+ {
147
+ label: _("Find Node"),
148
+ args: ["findNode", this .id],
149
+ },
150
+ ];
151
+
152
+ electron .ipcRenderer .send ("context-menu", "node-list", menu);
153
+ }
154
+
155
+ findNode (id)
156
+ {
157
+ if (id !== this .id)
158
+ return;
159
+
160
+ this .outlineEditor .findNode (this .#node);
161
+ }
127
162
  };
@@ -530,31 +530,31 @@ module .exports = class OutlineEditor extends OutlineRouteGraph
530
530
  {
531
531
  label: _("Add Instance"),
532
532
  visible: local,
533
- args: ["addImportedNodeClone", element .attr ("id")],
533
+ args: ["addImportedNodeInstance", element .attr ("id")],
534
534
  },
535
535
  { type: "separator" },
536
536
  {
537
537
  label: _("Cut"),
538
- visible: local && element .hasClass ("proxy"),
538
+ visible: local && element .hasClass ("instance"),
539
539
  accelerator: "CmdOrCtrl+X",
540
540
  args: ["cutNodes"],
541
541
  },
542
542
  {
543
543
  label: _("Copy"),
544
- visible: local && element .hasClass ("proxy"),
544
+ visible: local && element .hasClass ("instance"),
545
545
  accelerator: "CmdOrCtrl+C",
546
546
  args: ["copyNodes"],
547
547
  },
548
548
  {
549
549
  label: _("Delete"),
550
- visible: local && element .hasClass ("proxy"),
550
+ visible: local && element .hasClass ("instance"),
551
551
  accelerator: "CmdOrCtrl+Backspace",
552
552
  args: ["deleteNodes"],
553
553
  },
554
554
  { type: "separator" },
555
555
  ];
556
556
 
557
- if (local && element .hasClass ("proxy") && innerNode .getType () .includes (X3D .X3DConstants .X3DChildNode))
557
+ if (local && element .hasClass ("instance") && innerNode .getType () .includes (X3D .X3DConstants .X3DChildNode))
558
558
  this .addChildNodeMenu (menu, element, parentNodeElement, executionContext, node);
559
559
  }
560
560
 
@@ -654,10 +654,6 @@ module .exports = class OutlineEditor extends OutlineRouteGraph
654
654
  menu .push ({
655
655
  label: _("Add Parent Group"),
656
656
  submenu: [
657
- {
658
- label: "Transform",
659
- args: ["addParentGroup", element .attr ("id"), executionContext .getId (), node .getId (), "Grouping", "Transform", "children"],
660
- },
661
657
  {
662
658
  label: "Group",
663
659
  args: ["addParentGroup", element .attr ("id"), executionContext .getId (), node .getId (), "Grouping", "Group", "children"],
@@ -670,6 +666,10 @@ module .exports = class OutlineEditor extends OutlineRouteGraph
670
666
  label: "Switch",
671
667
  args: ["addParentGroup", element .attr ("id"), executionContext .getId (), node .getId (), "Grouping", "Switch", "children"],
672
668
  },
669
+ {
670
+ label: "Transform",
671
+ args: ["addParentGroup", element .attr ("id"), executionContext .getId (), node .getId (), "Grouping", "Transform", "children"],
672
+ },
673
673
  { type: "separator" },
674
674
  {
675
675
  label: "Billboard",
@@ -932,16 +932,16 @@ module .exports = class OutlineEditor extends OutlineRouteGraph
932
932
  Editor .removeImportedNode (importedNode .getExecutionContext (), importedNode .getImportedName ());
933
933
  }
934
934
 
935
- addImportedNodeClone (id)
935
+ addImportedNodeInstance (id)
936
936
  {
937
937
  const
938
938
  element = $(`#${id}`),
939
939
  importedNode = this .objects .get (parseInt (element .attr ("imported-node-id"))),
940
940
  executionContext = importedNode .getExecutionContext ();
941
941
 
942
- UndoManager .shared .beginUndo (_("Add Clone of Imported Node »%s«"), importedNode .getImportedName ());
942
+ UndoManager .shared .beginUndo (_("Add Instance of Imported Node »%s«"), importedNode .getImportedName ());
943
943
 
944
- Editor .appendValueToArray (executionContext, executionContext, executionContext .rootNodes, importedNode .getExportedNode ());
944
+ Editor .appendValueToArray (executionContext, executionContext, executionContext .rootNodes, importedNode .getInstance ());
945
945
 
946
946
  UndoManager .shared .endUndo ();
947
947
  }
@@ -967,8 +967,8 @@ module .exports = class OutlineEditor extends OutlineRouteGraph
967
967
  async copyNodes ()
968
968
  {
969
969
  const
970
- primary = $(":is(.node, .proto, .externproto, .imported-node.proxy).primary"),
971
- selected = this .sceneGraph .find (":is(.node, .proto, .externproto, .imported-node.proxy).manually"),
970
+ primary = $(":is(.node, .proto, .externproto, .imported-node.instance).primary"),
971
+ selected = this .sceneGraph .find (":is(.node, .proto, .externproto, .imported-node.instance).manually"),
972
972
  selection = selected .filter (primary) .length ? selected : primary,
973
973
  ids = selection .map (function () { return this .id; }) .get (),
974
974
  elements = ids .map (id => $(`#${id}`)),
@@ -1119,8 +1119,8 @@ module .exports = class OutlineEditor extends OutlineRouteGraph
1119
1119
  deleteNodes ()
1120
1120
  {
1121
1121
  const
1122
- primary = $(".node.primary, .imported-node.proxy.primary"),
1123
- selected = this .sceneGraph .find (".node.manually, .imported-node.proxy.manually"),
1122
+ primary = $(".node.primary, .imported-node.instance.primary"),
1123
+ selected = this .sceneGraph .find (".node.manually, .imported-node.instance.manually"),
1124
1124
  selection = !primary .length || selected .filter (primary) .length ? selected : primary,
1125
1125
  ids = selection .map (function () { return this .id; }) .get ();
1126
1126
 
@@ -1252,8 +1252,8 @@ module .exports = class OutlineEditor extends OutlineRouteGraph
1252
1252
  if (field .getType () === X3D .X3DConstants .MFNode)
1253
1253
  {
1254
1254
  const
1255
- selectedNodes = Array .from (this .sceneGraph .find (":is(.node, .imported-node.proxy):is(.manually,.primary)"), e => this .getNode ($(e))),
1256
- selectedElements = Array .from (this .sceneGraph .find (":is(.node, .imported-node.proxy).manually"), e => $(e)),
1255
+ selectedNodes = Array .from (this .sceneGraph .find (":is(.node, .imported-node.instance):is(.manually,.primary)"), e => this .getNode ($(e))),
1256
+ selectedElements = Array .from (this .sceneGraph .find (":is(.node, .imported-node.instance).manually"), e => $(e)),
1257
1257
  destinationModelMatrix = this .getModelMatrix (parentNodeElement);
1258
1258
 
1259
1259
  // Add other selected nodes.
@@ -3255,7 +3255,7 @@ module .exports = class OutlineEditor extends OutlineRouteGraph
3255
3255
  {
3256
3256
  destinationElement .addClass ("drag-into");
3257
3257
  }
3258
- else if (destinationElement .is (".node, .imported-node.proxy"))
3258
+ else if (destinationElement .is (".node, .imported-node.instance"))
3259
3259
  {
3260
3260
  const
3261
3261
  item = destinationElement .find ("> .item"),
@@ -3669,7 +3669,7 @@ module .exports = class OutlineEditor extends OutlineRouteGraph
3669
3669
 
3670
3670
  if (destinationElement .data ("dropEffect") ?.match (/copy|move/))
3671
3671
  {
3672
- if (!(sourceNode instanceof X3D .X3DImportedNodeProxy))
3672
+ if (!(sourceNode instanceof X3D .X3DImportedNodeInstance))
3673
3673
  {
3674
3674
  if (sourceNode ?.getType () .some (type => this .transformLikeNodes .has (type)))
3675
3675
  {