sunrize 2.3.2 → 2.3.4

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": "2.3.2",
4
+ "version": "2.3.4",
5
5
  "description": "Sunrize — A Multi-Platform X3D Editor",
6
6
  "main": "src/main.js",
7
7
  "bin": {
@@ -91,7 +91,7 @@
91
91
  "@electron-forge/maker-zip": "^7.11.2",
92
92
  "@electron-forge/publisher-github": "^7.11.2",
93
93
  "@eslint/js": "^10.0.1",
94
- "eslint": "^10.9.1",
94
+ "eslint": "^10.11.0",
95
95
  "globals": "^17.12.0",
96
96
  "shell-tools": "^1.1.9"
97
97
  },
@@ -99,7 +99,7 @@
99
99
  "@vscode/codicons": "^0.0.45",
100
100
  "capitalize": "^2.0.4",
101
101
  "console": "^0.7.2",
102
- "electron": "^44.2.0",
102
+ "electron": "^44.4.3",
103
103
  "electron-prompt": "^1.7.0",
104
104
  "electron-squirrel-startup": "^1.0.1",
105
105
  "electron-tabs": "^1.0.4",
@@ -108,7 +108,7 @@
108
108
  "jquery-ui-dist": "^1.13.3",
109
109
  "jstree": "^3.3.17",
110
110
  "material-icons": "^1.13.14",
111
- "material-symbols": "^0.47.1",
111
+ "material-symbols": "^0.47.4",
112
112
  "md5": "^2.3.0",
113
113
  "mime-types": "^3.0.2",
114
114
  "monaco-editor": "^0.55.1",
@@ -118,7 +118,7 @@
118
118
  "string-similarity": "^4.0.4",
119
119
  "tweakpane": "^4.0.5",
120
120
  "update-electron-app": "^3.3.0",
121
- "x_ite": "^16.3.0",
121
+ "x_ite": "^16.3.1",
122
122
  "x_ite-off-parser": "^1.3.0",
123
123
  "x_ite-sog-parser": "^2.1.0",
124
124
  "x_ite-spz-parser": "^2.1.0",
@@ -423,31 +423,50 @@ module .exports = class Application
423
423
  {
424
424
  role: "editMenu",
425
425
  submenu: [
426
- { role: "undo" },
427
- { role: "redo" },
426
+ { role: "undo", enabled: this .menuOptions .writableElement },
427
+ { role: "redo", enabled: this .menuOptions .writableElement },
428
428
  { type: "separator" },
429
- { role: "cut" },
429
+ { role: "cut", enabled: this .menuOptions .writableElement },
430
430
  { role: "copy" },
431
- { role: "paste" },
431
+ { role: "paste", enabled: this .menuOptions .writableElement },
432
432
  ... process .platform === "darwin" ?
433
433
  [
434
- { role: "pasteAndMatchStyle" },
435
- { role: "delete" },
436
- { role: "selectAll" },
434
+ { role: "pasteAndMatchStyle", enabled: this .menuOptions .writableElement },
435
+ { role: "delete", enabled: this .menuOptions .writableElement },
436
+ ... this .menuOptions .writableElement
437
+ ? [{ role: "selectAll" }]
438
+ : [{
439
+ label: _("Select All"),
440
+ accelerator: "CmdOrCtrl+A",
441
+ click: () =>
442
+ {
443
+ this .mainWindow .webContents .send ("document", "selectAllTextInActiveElement");
444
+ },
445
+ }],
437
446
  { type: "separator" },
438
447
  {
439
448
  label: _("Speech"),
449
+ enabled: this .menuOptions .writableElement,
440
450
  submenu: [
441
451
  { role: "startSpeaking" },
442
452
  { role: "stopSpeaking" },
443
- ]
453
+ ],
444
454
  },
445
455
  ]
446
456
  :
447
457
  [
448
- { role: "delete" },
458
+ { role: "delete", enabled: this .menuOptions .writableElement },
449
459
  { type: "separator" },
450
- { role: "selectAll" },
460
+ ... this .menuOptions .writableElement
461
+ ? [{ role: "selectAll" }]
462
+ : [{
463
+ label: _("Select All"),
464
+ accelerator: "CmdOrCtrl+A",
465
+ click: () =>
466
+ {
467
+ this .mainWindow .webContents .send ("document", "selectAllTextInActiveElement");
468
+ },
469
+ }],
451
470
  ],
452
471
  ]
453
472
  }
@@ -524,11 +543,13 @@ module .exports = class Application
524
543
  {
525
544
  label: _("Select All"),
526
545
  accelerator: "CmdOrCtrl+A",
546
+ enabled: !(this .menuOptions .defaultEditMenu || this .menuOptions .monacoEditor),
527
547
  click: () => this .mainWindow .webContents .send ("select-all"),
528
548
  },
529
549
  {
530
550
  label: _("Deselect All"),
531
551
  accelerator: "Shift+CmdOrCtrl+A",
552
+ enabled: !(this .menuOptions .defaultEditMenu || this .menuOptions .monacoEditor),
532
553
  click: () => this .mainWindow .webContents .send ("deselect-all"),
533
554
  },
534
555
  { type: "separator" },
@@ -313,7 +313,7 @@ module .exports = class Document extends Interface
313
313
  {
314
314
  this .activeElement = document .activeElement ? $(document .activeElement) : null;
315
315
 
316
- if (this .activeElement ?.is ("input, textarea"))
316
+ if (this .activeElementIsInputOrOutput ())
317
317
  {
318
318
  this .activeElement
319
319
  .off ("contextmenu.Document")
@@ -330,18 +330,22 @@ module .exports = class Document extends Interface
330
330
  if (this .activeElementIsMonacoEditor ())
331
331
  return;
332
332
 
333
+ const enabled = this .activateElementIsWritable ();
334
+
333
335
  const menu = [
334
- { role: "undo", accelerator: "CmdOrCtrl+Z" },
335
- { role: "redo", accelerator: "Shift+CmdOrCtrl+Z" },
336
+ { role: "undo", accelerator: "CmdOrCtrl+Z", enabled },
337
+ { role: "redo", accelerator: "Shift+CmdOrCtrl+Z", enabled },
336
338
  { type: "separator" },
337
- { role: "cut", accelerator: "CmdOrCtrl+X" },
339
+ { role: "cut", accelerator: "CmdOrCtrl+X", enabled },
338
340
  { role: "copy", accelerator: "CmdOrCtrl+C" },
339
- { role: "paste", accelerator: "CmdOrCtrl+P" },
341
+ { role: "paste", accelerator: "CmdOrCtrl+P", enabled },
340
342
  { type: "separator" },
341
- { role: "selectAll", accelerator: "CmdOrCtrl+A" },
343
+ ... enabled
344
+ ? [{ role: "selectAll", accelerator: "CmdOrCtrl+A", enabled }]
345
+ : [{ label: _("Select All"), accelerator: "CmdOrCtrl+A", args: ["selectAllTextInActiveElement"]}],
342
346
  ];
343
347
 
344
- electron .ipcRenderer .send ("context-menu", "default-context-menu", menu);
348
+ electron .ipcRenderer .send ("context-menu", "document", menu);
345
349
  }
346
350
 
347
351
  updateEditMenu (menu)
@@ -349,6 +353,7 @@ module .exports = class Document extends Interface
349
353
  return Object .assign (menu,
350
354
  {
351
355
  defaultEditMenu: this .activeElementIsInputOrOutput (),
356
+ writableElement: this .activateElementIsWritable (),
352
357
  monacoEditor: this .activeElementIsMonacoEditor (),
353
358
  });
354
359
  }
@@ -374,6 +379,11 @@ module .exports = class Document extends Interface
374
379
  return false;
375
380
  }
376
381
 
382
+ activateElementIsWritable ()
383
+ {
384
+ return !! this .activeElement ?.is (":is(input, textarea):not([readonly]), .input");
385
+ }
386
+
377
387
  activeElementIsMonacoEditor ()
378
388
  {
379
389
  if (!this .activeElement)
@@ -391,6 +401,16 @@ module .exports = class Document extends Interface
391
401
  return true;
392
402
  }
393
403
 
404
+ selectAllTextInActiveElement ()
405
+ {
406
+ const range = document .createRange ();
407
+
408
+ range .selectNode (this .activeElement .get (0));
409
+
410
+ window .getSelection () .removeAllRanges ();
411
+ window .getSelection () .addRange (range);
412
+ }
413
+
394
414
  // Menu Accelerators Fix for Windows.
395
415
 
396
416
  onkeydown (event)
@@ -3,6 +3,7 @@
3
3
  const
4
4
  Tabs = require ("../Controls/Tabs"),
5
5
  Console = require ("../Editors/Console"),
6
+ $ = require ("jquery"),
6
7
  _ = require ("./GetText");
7
8
 
8
9
  module .exports = class Footer extends Tabs
@@ -25,6 +26,10 @@ module .exports = class Footer extends Tabs
25
26
  this .addIconTextTab ("animation-editor","animation", _("Animation Editor"))
26
27
  .find (".material-icons") .css ("color", "hsl(246, 40%, 48%)");
27
28
 
29
+ $("<div></div>")
30
+ .addClass (["toolbar", "vertical-toolbar"])
31
+ .appendTo (this .element);
32
+
28
33
  this .console = new Console (this .getPanel ("console"));
29
34
  }
30
35
 
@@ -15,4 +15,7 @@ X3DUOM .find ("ConcreteNodes") .append (X_ITE .find ("ConcreteNode"));
15
15
  X3DUOM .find ("AbstractNodeType[name=X3DOneSidedMaterialNode]")
16
16
  .append (X3DUOM .find ("field[name=emissiveColor]") .first () .clone ());
17
17
 
18
+ // detune fix
19
+ X3DUOM .find ("field[name=detune]") .removeAttr ("minInclusive");
20
+
18
21
  module .exports = X3DUOM;
@@ -96,7 +96,7 @@ module .exports = class MaterialsLibrary extends LibraryPane
96
96
  {
97
97
  const material = this .#scene .getNamedNode (name);
98
98
 
99
- this .importX3D (material .getNodeName (), material .toXMLString ());
99
+ this .importX3D (material .getNodeName (), `<X3D><Scene>${material .toXMLString ()}</Scene></X3D>`);
100
100
  }
101
101
 
102
102
  async onChangeMaterials ()
@@ -1198,7 +1198,7 @@ module .exports = class OutlineView extends Interface
1198
1198
  .addClass (node ._isActive .getValue () ? "on" : "off")
1199
1199
  .text ("stop"));
1200
1200
 
1201
- if (node .getFieldDefinition ("loop"))
1201
+ if (node .getFieldDefinitions () .get ("loop"))
1202
1202
  {
1203
1203
  buttons .push ($("<span></span>")
1204
1204
  .attr ("order", "7")
@@ -1938,19 +1938,39 @@ module .exports = class OutlineView extends Interface
1938
1938
  let title = "";
1939
1939
 
1940
1940
  if (description)
1941
+ {
1941
1942
  title += `Description:\n\n${description}`;
1943
+ }
1944
+ else
1945
+ {
1946
+ for (const type of node .getType () .toReversed ())
1947
+ {
1948
+ switch (type)
1949
+ {
1950
+ case X3D .X3DConstants .X3DPrototypeInstance:
1951
+ title += `X3DPrototypeInstance ${node .getTypeName ()}`;
1952
+ break;
1953
+ default:
1954
+ continue;
1955
+ }
1942
1956
 
1943
- for (const type of node .getType () .toReversed ())
1957
+ break;
1958
+ }
1959
+ }
1960
+
1961
+ const innerNode = $.try (() => node .getInnerNode ()) ?? node;
1962
+
1963
+ for (const type of innerNode .getType () .toReversed ())
1944
1964
  {
1945
1965
  switch (type)
1946
1966
  {
1947
1967
  case X3D .X3DConstants .X3DGeometryNode:
1948
1968
  {
1949
- const numVertices = node .getVertices () .length / 4;
1969
+ const numVertices = innerNode .getVertices () .length / 4;
1950
1970
 
1951
1971
  title += "\n\n";
1952
1972
 
1953
- switch (node .getGeometryType ())
1973
+ switch (innerNode .getGeometryType ())
1954
1974
  {
1955
1975
  case 0:
1956
1976
  title += `Number of Points: ${(numVertices) .toLocaleString (_.locale)}`;
@@ -19,14 +19,15 @@ module .exports = new class Panel extends Interface
19
19
  this .container = $(this .pane .element) .parent ();
20
20
  this .selection = require ("../Application/Selection");
21
21
 
22
- this .container .hide () .appendTo ($("#browser-frame"));
22
+ this .container .hide () .appendTo ($("#browser-pane"));
23
23
 
24
24
  this .container .css ({
25
25
  "z-index": "3000",
26
26
  "overflow": "unset",
27
27
  "width": "fit-content",
28
- "bottom": this .container .css ("top"),
29
28
  "top": "unset",
29
+ "right": "calc(var(--toolbar-width) + 8px)",
30
+ "bottom": this .container .css ("top"),
30
31
  });
31
32
 
32
33
  this .container .get (0) .addEventListener ("mousedown", event => this .onmousedown (event), true);
@@ -50,10 +50,12 @@
50
50
 
51
51
  .etabs .tab:not(.active, :hover, :focus, :first-child)::before {
52
52
  content: "•";
53
+ display: block;
53
54
  position: absolute;
54
- top: 9px;
55
+ transform: translateY(1px);
55
56
  left: -3px;
56
57
  color: var(--text-disabled);
58
+ line-height: 0;
57
59
  }
58
60
 
59
61
  .etabs .tab:is(.active, :hover, :focus) + .tab::before {
@@ -50,10 +50,12 @@
50
50
 
51
51
  .etabs .tab:not(.active, :hover, :focus, :first-child)::before {
52
52
  content: "•";
53
+ display: block;
53
54
  position: absolute;
54
- top: 9px;
55
+ transform: translateY(1px);
55
56
  left: -3px;
56
57
  color: var(--text-disabled);
58
+ line-height: 0;
57
59
  }
58
60
 
59
61
  .etabs .tab:is(.active, :hover, :focus) + .tab::before {
@@ -4,5 +4,5 @@ window .addEventListener ("DOMContentLoaded", () =>
4
4
  {
5
5
  const electron = require ("electron");
6
6
 
7
- electron .ipcRenderer .on ("activate", () => require ("../../Application/Window"));
7
+ electron .ipcRenderer .once ("activate", () => require ("../../Application/Window"));
8
8
  });
@@ -526,7 +526,6 @@ html[platform=darwin] .horizontal-toolbar .select {
526
526
  height: var(--tabs-height);
527
527
  width: 100%;
528
528
  background: inherit;
529
- z-index: 200;
530
529
  }
531
530
 
532
531
  .ui-tabs.top > .ui-tabs-nav {
@@ -1048,20 +1047,24 @@ body.dark .ui-widget .library-list .component {
1048
1047
  height: 100%;
1049
1048
  }
1050
1049
 
1051
- #footer::after {
1050
+ #footer > .vertical-toolbar {
1051
+ box-sizing: content-box;
1052
+ height: calc(var(--tabs-height) - 1px);
1053
+ bottom: 0px;
1054
+ background-color: var(--secondary-toolbar-color);
1055
+ border-left: 1px solid var(--border-color);
1056
+ }
1057
+
1058
+ #footer:empty::after {
1052
1059
  content: "";
1053
1060
  position: absolute;
1054
1061
  width: var(--toolbar-width);
1055
1062
  right: 0px;
1056
- height: var(--tabs-height);
1063
+ height: 100%;
1057
1064
  border-left: 1px solid var(--border-color);
1058
1065
  background: var(--secondary-toolbar-color);
1059
1066
  }
1060
1067
 
1061
- #footer:empty::after {
1062
- height: 100%;
1063
- }
1064
-
1065
1068
  #footer > .ui-tabs-nav li {
1066
1069
  position: relative;
1067
1070
  border: 1px solid transparent;