sunrize 1.11.4 → 1.11.5

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.11.4",
4
+ "version": "1.11.5",
5
5
  "description": "A Multi-Platform X3D Editor",
6
6
  "main": "src/main.js",
7
7
  "bin": {
@@ -100,7 +100,7 @@
100
100
  "jquery-ui-dist": "^1.13.3",
101
101
  "jstree": "^3.3.17",
102
102
  "material-icons": "^1.13.14",
103
- "material-symbols": "^0.38.0",
103
+ "material-symbols": "^0.39.1",
104
104
  "md5": "^2.3.0",
105
105
  "mime-types": "^3.0.1",
106
106
  "monaco-editor": "^0.54.0",
@@ -110,7 +110,7 @@
110
110
  "string-similarity": "^4.0.4",
111
111
  "tweakpane": "^3.1.10",
112
112
  "update-electron-app": "^3.1.1",
113
- "x_ite": "^12.1.4",
113
+ "x_ite": "^12.1.5",
114
114
  "x3d-traverse": "^1.0.22"
115
115
  }
116
116
  }
@@ -55,8 +55,9 @@ module .exports = class Document extends Interface
55
55
  */
56
56
  async initialize ()
57
57
  {
58
- $("html") .attr ("platform", process .platform);
59
- $("body") .addClass ("modal");
58
+ $("html")
59
+ .attr ("platform", process .platform)
60
+ .addClass ("read-only");
60
61
 
61
62
  // Actions
62
63
 
@@ -192,7 +193,7 @@ module .exports = class Document extends Interface
192
193
  await this .restoreFile ();
193
194
 
194
195
  if (!this .isInitialScene)
195
- $("body") .removeClass ("modal");
196
+ $("html") .removeClass ("read-only");
196
197
  }
197
198
 
198
199
  configure ()
@@ -11,23 +11,12 @@ const
11
11
  module .exports = class Console extends Interface
12
12
  {
13
13
  HISTORY_MAX = 100;
14
- CONSOLE_MAX = 1000;
15
-
16
- logLevels = [
17
- "debug",
18
- "log",
19
- "warn",
20
- "error",
21
- ];
22
-
23
- logClasses = ["", "", "filled", "filled"];
24
14
 
25
15
  constructor (element)
26
16
  {
27
17
  super (`Sunrize.Console.${element .attr ("id")}.`);
28
18
 
29
19
  this .suspendConsole = false;
30
- this .messageTime = 0;
31
20
  this .historyIndex = 0;
32
21
  this .history = [ ];
33
22
  this .addMessageCallback = this .addMessage .bind (this);
@@ -175,6 +164,8 @@ module .exports = class Console extends Interface
175
164
  this .scriptNode .setup ();
176
165
  }
177
166
 
167
+ CONSOLE_MAX = 1000;
168
+
178
169
  // Add strings to exclude here:
179
170
  excludes = [
180
171
  "The vm module of Node.js is unsupported",
@@ -184,41 +175,31 @@ module .exports = class Console extends Interface
184
175
  // "Invalid asm.js: Invalid member of stdlib",
185
176
  ];
186
177
 
178
+ messageTime = 0;
179
+
180
+ logLevels = [
181
+ "debug",
182
+ "log",
183
+ "warn",
184
+ "error",
185
+ ];
186
+
187
187
  addMessage (event, level, sourceId, line, message)
188
188
  {
189
189
  if (this .excludes .some (exclude => message .includes (exclude)))
190
190
  return;
191
191
 
192
- const
193
- classes = [this .logLevels [level] ?? "log", this .logClasses [level]],
194
- title = sourceId ? `${sourceId}:${line}`: "";
195
-
196
- const text = $(message .split ("\n")
197
- .map (line => $("<p></p>")
198
- .addClass (classes)
199
- .attr ("title", title)
200
- .text (line)
201
- .get (0)));
192
+ const text = $("<p></p>")
193
+ .addClass (this .logLevels [level] ?? "log")
194
+ .attr ("title", sourceId ? `${sourceId}:${line}`: "")
195
+ .text (message);
202
196
 
203
- if (this .messageTime && performance .now () - this .messageTime > 1000)
197
+ if (performance .now () - this .messageTime > 1000)
204
198
  this .output .append ($("<p></p>") .addClass ("splitter"));
205
199
 
206
200
  this .messageTime = performance .now ();
207
201
 
208
- const
209
- children = this .output .children (),
210
- last = children .last ();
211
-
212
- if (last .hasClass (this .logLevels [level]))
213
- {
214
- last .css ("margin-bottom", "0");
215
- text .css ("margin-top", "0");
216
- last .css ("border-bottom", "none");
217
- text .css ("border-top", "none");
218
- }
219
-
220
- children .slice (0, Math .max (children .length - this .CONSOLE_MAX, 0)) .remove ();
221
-
202
+ this .output .children (`:not(:nth-last-child(-n+${this .CONSOLE_MAX}))`) .remove ();
222
203
  this .output .append (text);
223
204
  this .output .scrollTop (this .output .prop ("scrollHeight"));
224
205
 
@@ -2,6 +2,7 @@
2
2
 
3
3
  const
4
4
  $ = require ("jquery"),
5
+ electron = require ("electron"),
5
6
  capitalize = require ("capitalize"),
6
7
  Dialog = require ("../Controls/Dialog"),
7
8
  Tabs = require ("../Controls/Tabs"),
@@ -10,7 +11,6 @@ const
10
11
  Editor = require ("../Undo/Editor"),
11
12
  UndoManager = require ("../Undo/UndoManager"),
12
13
  _ = require ("../Application/GetText");
13
- const { height } = require("../Bits/X3DUOM");
14
14
 
15
15
  require ("../Fields");
16
16
 
@@ -472,6 +472,7 @@ module .exports = new class SceneProperties extends Dialog
472
472
  .attr ("placeholder", _("Insert meta key here."))
473
473
  .val (key) .on ("change", (event) => this .changeMetaData (event, key))))
474
474
  .append ($("<td></td>")
475
+ .addClass ("meta-value")
475
476
  .append ($("<input></input>")
476
477
  .attr ("index", 1)
477
478
  .attr ("placeholder", _("Insert meta value here."))
@@ -485,6 +486,27 @@ module .exports = new class SceneProperties extends Dialog
485
486
  .text ("delete_forever")
486
487
  .on ("click", (event) => this .removeMetaData (event, key))));
487
488
 
489
+ // Add Open Link in Browser button if it matches a link somewhere in value.
490
+ {
491
+ const
492
+ http = /(https?:\/\/(?:www\.)?[-a-zA-Z0-9@:%._\+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b(?:[-a-zA-Z0-9()@:%_\+.~#?&\/=]*))/,
493
+ match = value .match (http);
494
+
495
+ if (match)
496
+ {
497
+ const column = row .find ("input[index=1]") .parent ();
498
+
499
+ $("<span></span>")
500
+ .addClass ("open-link")
501
+ .attr ("title", _("Open link in web browser."))
502
+ .css ("font-size", "120%")
503
+ .addClass (["material-icons", "button"])
504
+ .text ("open_in_new")
505
+ .appendTo (column)
506
+ .on ("click", () => electron .shell .openExternal (match [1]));
507
+ }
508
+ }
509
+
488
510
  rows .push (row);
489
511
  }
490
512
 
@@ -93,7 +93,7 @@ input[type=checkbox] {
93
93
  color: var(--system-yellow);
94
94
  }
95
95
 
96
- .modal {
96
+ .read-only :is(x3d-canvas, .toolbar, .dialog, .outline-editor) {
97
97
  pointer-events: none;
98
98
  }
99
99
 
@@ -150,6 +150,7 @@ tbody th th {
150
150
  thead tr,
151
151
  tfoot tr {
152
152
  background: var(--tint-color2);
153
+ backdrop-filter: var(--tool-backdrop-filter);
153
154
  }
154
155
 
155
156
  tbody tr:nth-child(odd) {
@@ -786,6 +787,14 @@ body.dark .dialog ::placeholder {
786
787
  color: var(--system-gray2);
787
788
  }
788
789
 
790
+ .scene-properties td.meta-value {
791
+ display: flex;
792
+ }
793
+
794
+ .scene-properties .open-link {
795
+ padding-left: 4px;
796
+ }
797
+
789
798
  /* Library */
790
799
 
791
800
  .ui-widget .library-input {
@@ -1023,7 +1032,7 @@ body.dark .ui-widget .library-list .component {
1023
1032
  overflow: hidden;
1024
1033
  position: absolute;
1025
1034
  box-sizing: border-box;
1026
- left: 0;
1035
+ left: 0px;
1027
1036
  right: var(--toolbar-width);
1028
1037
  height: 100%;
1029
1038
  }
@@ -1032,7 +1041,7 @@ body.dark .ui-widget .library-list .component {
1032
1041
  position: absolute;
1033
1042
  box-sizing: border-box;
1034
1043
  overflow-y: scroll;
1035
- top: 0;
1044
+ top: 0px;
1036
1045
  border-right: 1px solid var(--border-color);
1037
1046
  border-bottom: 1px solid var(--border-color);
1038
1047
  padding: 5px;
@@ -1046,13 +1055,27 @@ body.dark .ui-widget .library-list .component {
1046
1055
  }
1047
1056
 
1048
1057
  .console-output p {
1058
+ box-sizing: border-box;
1059
+ position: relative;
1060
+ z-index: 0;
1049
1061
  margin: 0;
1062
+ padding: 1px 2px;
1063
+ white-space: pre-wrap;
1064
+ overflow-wrap: break-word;
1065
+ font-family: monospace;
1066
+ font-size: 8pt;
1050
1067
  }
1051
1068
 
1052
- .console-output p.splitter {
1053
- margin-top: 5px;
1054
- border-top: 1px solid var(--system-gray3);
1055
- margin-bottom: 5px;
1069
+ .console-output p:where(.warn, .error):before {
1070
+ content: "";
1071
+ box-sizing: border-box;
1072
+ position: absolute;
1073
+ display: block;
1074
+ z-index: -1;
1075
+ top: 0px;
1076
+ left: 0px;
1077
+ width: 100%;
1078
+ height: 100%;
1056
1079
  }
1057
1080
 
1058
1081
  .console-output p.debug {
@@ -1075,40 +1098,49 @@ body.dark .ui-widget .library-list .component {
1075
1098
  color: var(--system-red);
1076
1099
  }
1077
1100
 
1078
- .console-output p.filled {
1079
- position: relative;
1080
- z-index: 0;
1081
- margin-top: 5px;
1082
- margin-bottom: 5px;
1101
+ .console-output p.warn {
1102
+ border-top: 1px solid var(--system-yellow);
1103
+ border-bottom: 1px solid var(--system-yellow);
1083
1104
  color: black;
1084
1105
  }
1085
1106
 
1086
- .console-output p.filled:before {
1087
- content: "";
1088
- position: absolute;
1089
- display: block;
1090
- z-index: -1;
1091
- width: 100%;
1092
- height: 100%;
1093
- filter: brightness(2) opacity(60%);
1107
+ .console-output p.warn:before {
1108
+ background-color: color-mix(in srgb, color-mix(in srgb, var(--system-yellow), white 50%), transparent 30%);
1094
1109
  }
1095
1110
 
1096
- .console-output p.warn.filled {
1097
- border-top: 1px solid var(--system-yellow);
1098
- border-bottom: 1px solid var(--system-yellow);
1111
+ .console-output p.error {
1112
+ border-top: 1px solid var(--system-red);
1113
+ border-bottom: 1px solid var(--system-red);
1114
+ color: black;
1099
1115
  }
1100
1116
 
1101
- .console-output p.warn.filled:before {
1102
- background-color: var(--system-yellow);
1117
+ .console-output p.error:before {
1118
+ background-color: color-mix(in srgb, color-mix(in srgb, var(--system-red), white 50%), transparent 30%);
1103
1119
  }
1104
1120
 
1105
- .console-output p.error.filled {
1106
- border-top: 1px solid var(--system-red);
1107
- border-bottom: 1px solid var(--system-red);
1121
+ .console-output p.warn:has(+ p.warn),
1122
+ .console-output p.error:has(+ p.error) {
1123
+ border-bottom: none;
1124
+ }
1125
+
1126
+ .console-output p.warn + p.warn,
1127
+ .console-output p.error + p.error {
1128
+ border-top: none;
1129
+ }
1130
+
1131
+ .console-output p.warn:not(:has(+ p.warn)),
1132
+ .console-output p.error:not(:has(+ p.error)) {
1133
+ margin-bottom: 2px;
1108
1134
  }
1109
1135
 
1110
- .console-output p.error.filled:before {
1111
- background-color: var(--system-red);
1136
+ .console-output p.splitter {
1137
+ margin: 5px 0px;
1138
+ border-top: 1px solid var(--system-gray3);
1139
+ padding: 0px;
1140
+ }
1141
+
1142
+ .console-output p.splitter:first-child {
1143
+ display: none;
1112
1144
  }
1113
1145
 
1114
1146
  .console-input {