sunrize 1.11.7 → 1.11.9

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.7",
4
+ "version": "1.11.9",
5
5
  "description": "A Multi-Platform X3D Editor",
6
6
  "main": "src/main.js",
7
7
  "bin": {
@@ -91,7 +91,7 @@
91
91
  "@vscode/codicons": "^0.0.42",
92
92
  "capitalize": "^2.0.4",
93
93
  "console": "^0.7.2",
94
- "electron": "^39.1.2",
94
+ "electron": "^39.2.2",
95
95
  "electron-prompt": "^1.7.0",
96
96
  "electron-squirrel-startup": "^1.0.1",
97
97
  "electron-tabs": "^1.0.4",
@@ -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.39.2",
103
+ "material-symbols": "^0.39.4",
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.7",
113
+ "x_ite": "^12.1.9",
114
114
  "x3d-traverse": "^1.0.22"
115
115
  }
116
116
  }
@@ -80,6 +80,8 @@ module .exports = class Document extends Interface
80
80
  electron .ipcRenderer .on ("scene-properties", (event) => require ("../Editors/SceneProperties") .open ());
81
81
  electron .ipcRenderer .on ("close", (event) => this .close ());
82
82
 
83
+ $(window) .on ("beforeunload", () => this .close ());
84
+
83
85
  // Edit Menu
84
86
 
85
87
  electron .ipcRenderer .on ("undo", () => this .undo ());
@@ -577,6 +579,8 @@ Viewpoint {
577
579
 
578
580
  close ()
579
581
  {
582
+ this .footer .scriptEditor ?.apply ();
583
+
580
584
  if (UndoManager .shared .saveNeeded)
581
585
  this .saveFile ();
582
586
 
@@ -189,19 +189,23 @@ module .exports = class ScriptEditor extends Interface
189
189
  };
190
190
 
191
191
  const keywords = [
192
- 'const', 'uniform', 'break', 'continue',
193
- 'do', 'for', 'while', 'if', 'else', 'switch', 'case', 'in', 'out', 'inout', 'true', 'false',
194
- 'invariant', 'discard', 'return', 'sampler2D', 'samplerCube', 'sampler3D', 'struct',
195
- 'radians', 'degrees', 'sin', 'cos', 'tan', 'asin', 'acos', 'atan', 'pow', 'sinh', 'cosh', 'tanh', 'asinh', 'acosh', 'atanh',
196
- 'exp', 'log', 'exp2', 'log2', 'sqrt', 'inversesqrt', 'abs', 'sign', 'floor', 'ceil', 'round', 'roundEven', 'trunc', 'fract', 'mod', 'modf',
197
- 'min', 'max', 'clamp', 'mix', 'step', 'smoothstep', 'length', 'distance', 'dot', 'cross ',
198
- 'determinant', 'inverse', 'normalize', 'faceforward', 'reflect', 'refract', 'matrixCompMult', 'outerProduct', 'transpose', 'lessThan ',
199
- 'lessThanEqual', 'greaterThan', 'greaterThanEqual', 'equal', 'notEqual', 'any', 'all', 'not', 'packUnorm2x16', 'unpackUnorm2x16', 'packSnorm2x16', 'unpackSnorm2x16', 'packHalf2x16', 'unpackHalf2x16',
200
- 'dFdx', 'dFdy', 'fwidth', 'textureSize', 'texture', 'textureProj', 'textureLod', 'textureGrad', 'texelFetch', 'texelFetchOffset',
201
- 'textureProjLod', 'textureLodOffset', 'textureGradOffset', 'textureProjLodOffset', 'textureProjGrad', 'intBitsToFloat', 'uintBitsToFloat', 'floatBitsToInt', 'floatBitsToUint', 'isnan', 'isinf',
202
- 'vec2', 'vec3', 'vec4', 'ivec2', 'ivec3', 'ivec4', 'uvec2', 'uvec3', 'uvec4', 'bvec2', 'bvec3', 'bvec4',
203
- 'mat2', 'mat3', 'mat2x2', 'mat2x3', 'mat2x4', 'mat3x2', 'mat3x3', 'mat3x4', 'mat4x2', 'mat4x3', 'mat4x4', 'mat4',
204
- 'float', 'int', 'uint', 'void', 'bool',
192
+ 'break', 'case', 'const', 'continue', 'discard', 'do', 'else', 'flat', 'for', 'highp', 'if', 'in', 'inout', 'invariant', 'lowp', 'mediump', 'out', 'precision', 'return', 'smooth', 'struct', 'switch', 'uniform', 'while',
193
+ ];
194
+
195
+ const types = [
196
+ 'bool', 'bvec2', 'bvec3', 'bvec4', 'float', 'int', 'ivec2', 'ivec3', 'ivec4', 'mat2', 'mat2x2', 'mat2x3', 'mat2x4', 'mat3', 'mat3x2', 'mat3x3', 'mat3x4', 'mat4', 'mat4x2', 'mat4x3', 'mat4x4', 'sampler2D', 'sampler3D', 'samplerCube', 'uint', 'uvec2', 'uvec3', 'uvec4', 'vec2', 'vec3', 'vec4', 'void',
197
+ ];
198
+
199
+ const functions = [
200
+ 'abs', 'acos', 'acosh', 'all', 'any', 'asin', 'asinh', 'atan', 'atanh', 'ceil', 'clamp', 'cos', 'cosh', 'cross ', 'degrees', 'determinant', 'dFdx', 'dFdy', 'distance', 'dot', 'equal', 'exp', 'exp2', 'faceforward', 'floatBitsToInt', 'floatBitsToUint', 'floor', 'fract', 'fwidth', 'greaterThan', 'greaterThanEqual', 'intBitsToFloat', 'inverse', 'inversesqrt', 'isinf', 'isnan', 'length', 'lessThan ', 'lessThanEqual', 'log', 'log2', 'main', 'matrixCompMult', 'max', 'min', 'mix', 'mod', 'modf', 'normalize', 'not', 'notEqual', 'outerProduct', 'packUnorm2x16', 'pow', 'radians', 'reflect', 'refract', 'round', 'roundEven', 'sign', 'sin', 'sinh', 'smoothstep', 'sqrt', 'step', 'tan', 'tanh', 'texelFetch', 'texelFetchOffset', 'texture', 'textureGrad', 'textureGradOffset', 'textureLod', 'textureLodOffset', 'textureProj', 'textureProjGrad', 'textureProjLod', 'textureProjLodOffset', 'textureSize', 'transpose', 'trunc', 'uintBitsToFloat',
201
+ ];
202
+
203
+ const constants = [
204
+ 'false', 'true',
205
+ ];
206
+
207
+ const builtins = [
208
+ 'gl_ClipDistance', 'gl_CullDistance', 'gl_FragCoord', 'gl_FragDepth', 'gl_FrontFacing', 'gl_GlobalInvocationID', 'gl_HelperInvocation', 'gl_InstanceID', 'gl_InvocationID', 'gl_Layer', 'gl_LocalInvocationID', 'gl_LocalInvocationIndex', 'gl_NumSamples', 'gl_NumWorkGroups', 'gl_PatchVerticesIn', 'gl_PointCoord', 'gl_PointSize', 'gl_Position', 'gl_PrimitiveID', 'gl_PrimitiveIDIn', 'gl_SampleID', 'gl_SampleMask', 'gl_SampleMaskIn', 'gl_SamplePosition', 'gl_TessCoord', 'gl_TessLevelInner', 'gl_TessLevelOuter', 'gl_VertexID', 'gl_ViewportIndex', 'gl_WorkGroupID', 'gl_WorkGroupSize',
205
209
  ];
206
210
 
207
211
  const language = {
@@ -209,6 +213,10 @@ module .exports = class ScriptEditor extends Interface
209
213
  // Set defaultToken to invalid to see what you do not tokenize yet
210
214
  defaultToken: 'invalid',
211
215
  keywords,
216
+ types,
217
+ functions,
218
+ constants,
219
+ builtins,
212
220
  operators: [
213
221
  '=',
214
222
  '>',
@@ -256,33 +264,43 @@ module .exports = class ScriptEditor extends Interface
256
264
 
257
265
  tokenizer: {
258
266
  root: [
267
+ // data:mime-type,
268
+ [/data:x-shader\/x-(?:vertex|fragment),/, 'string'],
269
+
270
+ // x3d_SpecialVariable
271
+ [/x3d_\w+/, 'keyword'],
272
+
259
273
  // identifiers and keywords
260
- [
261
- /[a-zA-Z_]\w*/,
274
+
275
+ [/[a-zA-Z_]\w*/,
262
276
  {
263
277
  cases: {
264
278
  '@keywords': { token: 'keyword.$0' },
265
- '@default': 'identifier'
279
+ '@types': { token: 'type.identifier' },
280
+ '@functions': { token: 'attribute.name' },
281
+ '@constants': { token: 'constant' },
282
+ '@builtins': { token: 'regexp' },
283
+ '@default': 'identifier',
266
284
  }
267
- }
268
- ],
269
-
270
- // Preprocessor directive (#define)
271
- [/^\s*#\s*\w+/, 'keyword.directive'],
285
+ }],
272
286
 
273
287
  // Version
274
288
  [/#version\s+\d+\s+es/, 'keyword.directive'],
275
289
 
290
+ // Preprocessor directive (#define)
291
+ [/^\s*#\s*\w+/, 'keyword.directive'],
292
+
276
293
  // whitespace
277
294
  { include: '@whitespace' },
278
295
 
279
296
  // delimiters and operators
280
297
  [/[{}()\[\]]/, '@brackets'],
281
- [/@symbols/, {
282
- cases: {
283
- '@operators': 'operator',
284
- '@default': ''
285
- }
298
+ [/@symbols/,
299
+ {
300
+ cases: {
301
+ '@operators': 'operator',
302
+ '@default': ''
303
+ }
286
304
  }],
287
305
 
288
306
  // numbers
@@ -305,18 +323,6 @@ module .exports = class ScriptEditor extends Interface
305
323
  [/[\/*]/, 'comment']
306
324
  ],
307
325
 
308
- // Does it have strings?
309
- string: [
310
- [/[^\\"]+/, 'string'],
311
- [/@escapes/, 'string.escape'],
312
- [/\\./, 'string.escape.invalid'],
313
- [/"/, {
314
- token: 'string.quote',
315
- bracket: '@close',
316
- next: '@pop'
317
- }]
318
- ],
319
-
320
326
  whitespace: [
321
327
  [/[ \t\r\n]+/, 'white'],
322
328
  [/\/\*/, 'comment', '@comment'],
@@ -463,20 +463,67 @@ module .exports = class Editor
463
463
  <html>
464
464
  <head>
465
465
  <meta charset="utf-8">
466
- <script src="https://cdn.jsdelivr.net/npm/x_ite@latest/dist/x_ite.min.js"></script>
466
+ <script defer src="https://cdn.jsdelivr.net/npm/x_ite@latest/dist/x_ite.min.js"></script>
467
467
  <style>
468
+ @import url("https://fonts.googleapis.com/css2?family=Lato:ital,wght@0,400&family=Source+Sans+3:ital,wght@0,400&display=swap");
469
+
470
+ @media (prefers-color-scheme: light) {
471
+ :root {
472
+ --text-color: rgb(42, 42, 42);
473
+ --background-color: white;
474
+ --link-color: rgb(0, 86, 178);
475
+ --link-hover-color: rgb(210, 96, 58);
476
+ }
477
+ }
478
+
479
+ @media (prefers-color-scheme: dark) {
480
+ :root {
481
+ --text-color: rgb(175, 176, 177);
482
+ --background-color: rgb(27, 27, 30);
483
+ --link-color: rgb(82, 108, 150);
484
+ --link-hover-color: rgb(210, 96, 58);
485
+ }
486
+ }
487
+
468
488
  body {
469
- background-color: rgb(21, 22, 24);
470
- color: rgb(108, 110, 113);
489
+ color-scheme: light dark;
490
+ box-sizing: border-box;
491
+ display: flex;
492
+ flex-direction: column;
493
+ margin: 0px;
494
+ padding: 0px;
495
+ height: 100vh;
496
+ background-color: var(--background-color);
497
+ color: var(--text-color);
498
+ font-family: "Source Sans 3", sans-serif;
499
+ font-size: 1.08rem;
471
500
  }
472
501
 
473
- a {
474
- color: rgb(106, 140, 191);
502
+ body > * {
503
+ flex: 0 0 auto;
504
+ padding: 0px 1rem;
505
+ }
506
+
507
+ h1 {
508
+ font-family: Lato, sans-serif;
475
509
  }
476
510
 
477
511
  x3d-canvas {
478
- width: 768px;
479
- height: 432px;
512
+ flex: 1 1 auto;
513
+ box-sizing: border-box;
514
+ border-top: 1px solid color-mix(in srgb, var(--text-color), transparent 90%);
515
+ border-bottom: 1px solid color-mix(in srgb, var(--text-color), transparent 90%);
516
+ padding: 0px;
517
+ width: 100%;
518
+ height: 100%;
519
+ }
520
+
521
+ a {
522
+ color: var(--link-color);
523
+ }
524
+
525
+ a:hover {
526
+ color: var(--link-hover-color);
480
527
  }
481
528
  </style>
482
529
  </head>
@@ -485,7 +532,7 @@ x3d-canvas {
485
532
  <x3d-canvas>
486
533
  ${scene .toXMLString ({ html: true, indent: " " .repeat (6) }) .trimEnd () }
487
534
  </x3d-canvas>
488
- <p>Made with <a href="https://create3000.github.io/sunrize/" target="_blank">Sunrize X3D Editor.</a></p>
535
+ <p>Made with <a href="https://create3000.github.io/sunrize/" target="_blank">Sunrize X3D Editor</a>. If local files are not loaded <a href="https://create3000.github.io/x_ite/setup-a-localhost-server">consider setup a localhost server</a> or use <a href="https://create3000.github.io/x_ite/dom-integration">DOM integration methods</a>.</p>
489
536
  </body>
490
537
  </html>`
491
538
  }
@@ -4,6 +4,7 @@
4
4
  @import url(system-colors.css);
5
5
 
6
6
  html {
7
+ color-scheme: light dark;
7
8
  overflow: hidden;
8
9
  height: 100%;
9
10
  }
@@ -2,8 +2,6 @@
2
2
 
3
3
  @media (prefers-color-scheme: light) {
4
4
  :root {
5
- color-scheme: light;
6
-
7
5
  /* Colors */
8
6
 
9
7
  --system-red: rgb(255, 56, 60);
@@ -43,8 +41,8 @@
43
41
  /* Special Colors */
44
42
 
45
43
  --sidebar-background-color: rgb(208, 219, 231);
46
- --tint-color1: rgba(255, 255, 255, 0.5);
47
- --tint-color2: rgba(255, 255, 255, 1);
44
+ --tint-color1: rgba(255, 255, 255, 0.4);
45
+ --tint-color2: rgba(255, 255, 255, 0.6);
48
46
 
49
47
  /* TweakPanel colors */
50
48
 
@@ -79,8 +77,6 @@
79
77
 
80
78
  @media (prefers-color-scheme: dark) {
81
79
  :root {
82
- color-scheme: dark;
83
-
84
80
  /* Colors */
85
81
 
86
82
  --system-red: rgb(255, 66, 69);