x_ite 8.6.0 → 8.6.2

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 (117) hide show
  1. package/.vscode/settings.json +7 -7
  2. package/dist/assets/components/Annotation.js +13 -13
  3. package/dist/assets/components/Annotation.min.js +1 -1
  4. package/dist/assets/components/CADGeometry.js +13 -13
  5. package/dist/assets/components/CADGeometry.min.js +1 -1
  6. package/dist/assets/components/CubeMapTexturing.js +25 -25
  7. package/dist/assets/components/CubeMapTexturing.min.js +1 -1
  8. package/dist/assets/components/DIS.js +13 -13
  9. package/dist/assets/components/DIS.min.js +1 -1
  10. package/dist/assets/components/EventUtilities.js +9 -9
  11. package/dist/assets/components/EventUtilities.min.js +1 -1
  12. package/dist/assets/components/Geometry2D.js +19 -19
  13. package/dist/assets/components/Geometry2D.min.js +1 -1
  14. package/dist/assets/components/Geospatial.js +33 -33
  15. package/dist/assets/components/Geospatial.min.js +1 -1
  16. package/dist/assets/components/HAnim.js +18 -18
  17. package/dist/assets/components/HAnim.min.js +1 -1
  18. package/dist/assets/components/KeyDeviceSensor.js +8 -8
  19. package/dist/assets/components/KeyDeviceSensor.min.js +1 -1
  20. package/dist/assets/components/Layout.js +27 -27
  21. package/dist/assets/components/Layout.min.js +1 -1
  22. package/dist/assets/components/NURBS.js +24 -24
  23. package/dist/assets/components/NURBS.min.js +1 -1
  24. package/dist/assets/components/ParticleSystems.js +23 -23
  25. package/dist/assets/components/ParticleSystems.min.js +1 -1
  26. package/dist/assets/components/Picking.js +19 -19
  27. package/dist/assets/components/Picking.min.js +1 -1
  28. package/dist/assets/components/RigidBodyPhysics.js +18 -18
  29. package/dist/assets/components/RigidBodyPhysics.min.js +1 -1
  30. package/dist/assets/components/Scripting.js +28 -28
  31. package/dist/assets/components/Scripting.min.js +1 -1
  32. package/dist/assets/components/Text.js +39 -48
  33. package/dist/assets/components/Text.min.js +1 -1
  34. package/dist/assets/components/TextureProjector.js +14 -14
  35. package/dist/assets/components/TextureProjector.min.js +1 -1
  36. package/dist/assets/components/Texturing3D.js +32 -32
  37. package/dist/assets/components/Texturing3D.min.js +1 -1
  38. package/dist/assets/components/VolumeRendering.js +19 -19
  39. package/dist/assets/components/VolumeRendering.min.js +1 -1
  40. package/dist/assets/components/X_ITE.js +9 -9
  41. package/dist/assets/components/X_ITE.min.js +1 -1
  42. package/dist/x_ite.css +1 -1
  43. package/dist/x_ite.js +690 -936
  44. package/dist/x_ite.min.js +1 -1
  45. package/dist/x_ite.zip +0 -0
  46. package/docs/_config.yml +2 -2
  47. package/docs/_includes/scripts.html +2 -2
  48. package/docs/_posts/components/CADGeometry/IndexedQuadSet.md +1 -1
  49. package/docs/_posts/components/CADGeometry/QuadSet.md +1 -1
  50. package/docs/_posts/components/Geometry3D/ElevationGrid.md +1 -1
  51. package/docs/_posts/components/Geometry3D/Extrusion.md +1 -1
  52. package/docs/_posts/components/Geometry3D/IndexedFaceSet.md +1 -1
  53. package/docs/_posts/components/Geospatial/GeoElevationGrid.md +1 -1
  54. package/docs/_posts/components/NURBS/NurbsSweptSurface.md +1 -1
  55. package/docs/_posts/components/NURBS/NurbsSwungSurface.md +1 -1
  56. package/docs/_posts/components/Rendering/IndexedTriangleFanSet.md +1 -1
  57. package/docs/_posts/components/Rendering/IndexedTriangleSet.md +1 -1
  58. package/docs/_posts/components/Rendering/IndexedTriangleStripSet.md +1 -1
  59. package/docs/_posts/components/Rendering/TriangleFanSet.md +1 -1
  60. package/docs/_posts/components/Rendering/TriangleSet.md +1 -1
  61. package/docs/_posts/components/Rendering/TriangleStripSet.md +1 -1
  62. package/docs/_posts/components/Shape/Material.md +1 -1
  63. package/docs/_posts/getting-started.md +1 -1
  64. package/docs/_posts/laboratory/x3d-file-converter.md +178 -0
  65. package/docs/_tabs/playground.html +80 -133
  66. package/docs/assets/css/style.scss +2 -42
  67. package/docs/laboratory/3d-l-system-generator.html +1 -1
  68. package/docs/laboratory/gltf-sample-viewer.html +1 -1
  69. package/docs/laboratory/online-dicom-and-nrrd-file-viewer.html +1 -1
  70. package/docs/laboratory/real-time-earth-quake-information.html +1 -1
  71. package/docs/laboratory/x3d-visual-blend-mode-editor.html +1 -1
  72. package/package.json +1 -1
  73. package/src/standard/Math/Algorithms/Bezier.js +133 -182
  74. package/src/standard/Math/Geometry/Box2.js +0 -1
  75. package/src/standard/Math/Geometry/Box3.js +0 -1
  76. package/src/standard/Math/Geometry/Cylinder3.js +1 -1
  77. package/src/standard/Math/Geometry/Line2.js +2 -4
  78. package/src/standard/Math/Geometry/Line3.js +2 -4
  79. package/src/standard/Math/Geometry/Plane3.js +1 -3
  80. package/src/standard/Math/Geometry/Sphere3.js +8 -12
  81. package/src/standard/Math/Geometry/Triangle3.js +8 -0
  82. package/src/standard/Math/Geometry/ViewVolume.js +17 -27
  83. package/src/standard/Math/Numbers/Color3.js +4 -7
  84. package/src/standard/Math/Numbers/Complex.js +8 -9
  85. package/src/standard/Math/Numbers/Matrix2.js +31 -42
  86. package/src/standard/Math/Numbers/Matrix3.js +54 -97
  87. package/src/standard/Math/Numbers/Matrix4.js +49 -160
  88. package/src/standard/Math/Numbers/Quaternion.js +20 -24
  89. package/src/standard/Math/Numbers/Rotation4.js +1 -2
  90. package/src/standard/Math/Numbers/Vector2.js +4 -12
  91. package/src/standard/Math/Numbers/Vector3.js +6 -18
  92. package/src/standard/Math/Numbers/Vector4.js +4 -20
  93. package/src/standard/Time/StopWatch.js +9 -14
  94. package/src/tests.js +11 -0
  95. package/src/x_ite/Browser/Core/BrowserTimings.js +10 -10
  96. package/src/x_ite/Browser/Core/X3DCoreContext.js +4 -6
  97. package/src/x_ite/Browser/Interpolation/CatmullRomSplineInterpolator.js +94 -88
  98. package/src/x_ite/Browser/Interpolation/CatmullRomSplineInterpolator1.js +2 -3
  99. package/src/x_ite/Browser/Interpolation/CatmullRomSplineInterpolatorTemplate.js +17 -14
  100. package/src/x_ite/Browser/Text/PolygonText.js +15 -24
  101. package/src/x_ite/Browser/VERSION.js +1 -1
  102. package/src/x_ite/Components/Core/X3DNode.js +12 -0
  103. package/src/x_ite/Components/Core/X3DPrototypeInstance.js +18 -0
  104. package/src/x_ite/Components/Interpolation/SquadOrientationInterpolator.js +8 -7
  105. package/src/x_ite/Configuration/UnitInfo.js +2 -0
  106. package/src/x_ite/Execution/X3DExportedNode.js +4 -0
  107. package/src/x_ite/Execution/X3DImportedNode.js +14 -0
  108. package/src/x_ite/Execution/X3DScene.js +4 -0
  109. package/src/x_ite/Fields/SFString.js +4 -6
  110. package/src/x_ite/InputOutput/FileLoader.js +1 -1
  111. package/src/x_ite/InputOutput/Generator.js +35 -55
  112. package/src/x_ite/Parser/GLTF2Parser.js +4 -4
  113. package/src/x_ite/Parser/SVGParser.js +24 -47
  114. package/src/x_ite/Parser/X3DParser.js +1 -1
  115. package/src/x_ite/Prototype/X3DExternProtoDeclaration.js +4 -0
  116. package/src/x_ite/Prototype/X3DProtoDeclaration.js +4 -0
  117. package/src/x_ite/Routing/X3DRoute.js +8 -0
package/dist/x_ite.zip CHANGED
Binary file
package/docs/_config.yml CHANGED
@@ -20,7 +20,7 @@ timezone:
20
20
  # ↓ --------------------------
21
21
 
22
22
  title: X_ITE X3D Browser # the main title
23
- version: 8.6.0 # x_ite latest version
23
+ version: 8.6.2 # x_ite latest version
24
24
  size: 287 # size in kb
25
25
  x3d_latest_version: 4.0 # x3d latest version
26
26
 
@@ -180,7 +180,7 @@ compress_html:
180
180
  profile: false
181
181
  blanklines: false
182
182
  ignore:
183
- envs: [x-development]
183
+ envs: [development]
184
184
 
185
185
  exclude:
186
186
  - "*.gem"
@@ -1,4 +1,4 @@
1
1
  {% if content contains '<x3d-canvas' or page.x_ite %}
2
- <script src="https://create3000.github.io/code/x_ite/alpha/x_ite.min.js"></script>
3
- <script src="/x_ite/assets/js/autoupdate.js"></script>
2
+ <script defer src="https://create3000.github.io/code/x_ite/alpha/x_ite.min.js"></script>
3
+ <script defer src="/x_ite/assets/js/autoupdate.js"></script>
4
4
  {% endif %}
@@ -58,7 +58,7 @@ Setting solid true means draw only one side of polygons (backface culling on), s
58
58
 
59
59
  #### Hint
60
60
 
61
- - Ccw false can reverse solid (backface culling) and normal-vector orientation.
61
+ - *ccw* false can reverse solid (backface culling) and normal-vector orientation.
62
62
 
63
63
  ### SFBool [ ] **colorPerVertex** TRUE
64
64
 
@@ -50,7 +50,7 @@ Setting solid true means draw only one side of polygons (backface culling on), s
50
50
 
51
51
  #### Hint
52
52
 
53
- - Ccw false can reverse solid (backface culling) and normal-vector orientation.
53
+ - *ccw* false can reverse solid (backface culling) and normal-vector orientation.
54
54
 
55
55
  ### SFBool [ ] **colorPerVertex** TRUE
56
56
 
@@ -81,7 +81,7 @@ Setting solid true means draw only one side of polygons (backface culling on), s
81
81
 
82
82
  #### Hint
83
83
 
84
- - Ccw false can reverse solid (backface culling) and normal-vector orientation.
84
+ - *ccw* false can reverse solid (backface culling) and normal-vector orientation.
85
85
 
86
86
  ### SFFloat [ ] **creaseAngle** 0 <small>[0,∞)</small>
87
87
 
@@ -101,7 +101,7 @@ Setting solid true means draw only one side of polygons (backface culling on), s
101
101
 
102
102
  #### Hint
103
103
 
104
- - Ccw false can reverse solid (backface culling) and normal-vector orientation.
104
+ - *ccw* false can reverse solid (backface culling) and normal-vector orientation.
105
105
 
106
106
  ### SFBool [ ] **convex** TRUE
107
107
 
@@ -89,7 +89,7 @@ Setting solid true means draw only one side of polygons (backface culling on), s
89
89
 
90
90
  #### Hint
91
91
 
92
- - Ccw false can reverse solid (backface culling) and normal-vector orientation.
92
+ - *ccw* false can reverse solid (backface culling) and normal-vector orientation.
93
93
 
94
94
  ### SFBool [ ] **convex** TRUE
95
95
 
@@ -107,7 +107,7 @@ Setting solid true means draw only one side of polygons (backface culling on), s
107
107
 
108
108
  #### Hint
109
109
 
110
- - Ccw false can reverse solid (backface culling) and normal-vector orientation.
110
+ - *ccw* false can reverse solid (backface culling) and normal-vector orientation.
111
111
 
112
112
  ### SFDouble [ ] **creaseAngle** <small>[0,∞)</small>
113
113
 
@@ -50,7 +50,7 @@ Setting solid true means draw only one side of polygons (backface culling on), s
50
50
 
51
51
  #### Hint
52
52
 
53
- - Ccw false can reverse solid (backface culling) and normal-vector orientation.
53
+ - *ccw* false can reverse solid (backface culling) and normal-vector orientation.
54
54
 
55
55
  ### SFNode [in, out] **crossSectionCurve** NULL <small>[X3DNurbsControlCurveNode]</small>
56
56
 
@@ -50,7 +50,7 @@ Setting solid true means draw only one side of polygons (backface culling on), s
50
50
 
51
51
  #### Hint
52
52
 
53
- - Ccw false can reverse solid (backface culling) and normal-vector orientation.
53
+ - *ccw* false can reverse solid (backface culling) and normal-vector orientation.
54
54
 
55
55
  ### SFNode [in, out] **profileCurve** NULL <small>[X3DNurbsControlCurveNode]</small>
56
56
 
@@ -58,7 +58,7 @@ Setting solid true means draw only one side of polygons (backface culling on), s
58
58
 
59
59
  #### Hint
60
60
 
61
- - Ccw false can reverse solid (backface culling) and normal-vector orientation.
61
+ - *ccw* false can reverse solid (backface culling) and normal-vector orientation.
62
62
 
63
63
  ### SFBool [ ] **colorPerVertex** TRUE
64
64
 
@@ -58,7 +58,7 @@ Setting solid true means draw only one side of polygons (backface culling on), s
58
58
 
59
59
  #### Hint
60
60
 
61
- - Ccw false can reverse solid (backface culling) and normal-vector orientation.
61
+ - *ccw* false can reverse solid (backface culling) and normal-vector orientation.
62
62
 
63
63
  ### SFBool [ ] **colorPerVertex** TRUE
64
64
 
@@ -54,7 +54,7 @@ Setting solid true means draw only one side of polygons (backface culling on), s
54
54
 
55
55
  #### Hint
56
56
 
57
- - Ccw false can reverse solid (backface culling) and normal-vector orientation.
57
+ - *ccw* false can reverse solid (backface culling) and normal-vector orientation.
58
58
 
59
59
  ### SFBool [ ] **colorPerVertex** TRUE
60
60
 
@@ -50,7 +50,7 @@ Setting solid true means draw only one side of polygons (backface culling on), s
50
50
 
51
51
  #### Hint
52
52
 
53
- - Ccw false can reverse solid (backface culling) and normal-vector orientation.
53
+ - *ccw* false can reverse solid (backface culling) and normal-vector orientation.
54
54
 
55
55
  ### SFBool [ ] **colorPerVertex** TRUE
56
56
 
@@ -50,7 +50,7 @@ Setting solid true means draw only one side of polygons (backface culling on), s
50
50
 
51
51
  #### Hint
52
52
 
53
- - Ccw false can reverse solid (backface culling) and normal-vector orientation.
53
+ - *ccw* false can reverse solid (backface culling) and normal-vector orientation.
54
54
 
55
55
  ### SFBool [ ] **colorPerVertex** TRUE
56
56
 
@@ -50,7 +50,7 @@ Setting solid true means draw only one side of polygons (backface culling on), s
50
50
 
51
51
  #### Hint
52
52
 
53
- - Ccw false can reverse solid (backface culling) and normal-vector orientation.
53
+ - *ccw* false can reverse solid (backface culling) and normal-vector orientation.
54
54
 
55
55
  ### SFBool [ ] **colorPerVertex** TRUE
56
56
 
@@ -129,7 +129,7 @@ Lower shininess values provide soft specular glows, while higher values result i
129
129
 
130
130
  The mapping label identifies which texture coordinates and transformations are used to compute texture effects from corresponding geometry on a given material.
131
131
 
132
- ### SFNode [in, out] *shininessTexture** NULL <small>[X3DSingleTextureNode]</small>
132
+ ### SFNode [in, out] **shininessTexture** NULL <small>[X3DSingleTextureNode]</small>
133
133
 
134
134
  When applying shininess for this material node, the contained texture provides Physically Based Rendering (PBR) modulation for each pixel.
135
135
 
@@ -588,7 +588,7 @@ You can always replace »latest« by the version number you prefer.
588
588
 
589
589
  #### For Production
590
590
 
591
- If you are on production and everything works fine, then use a numbered version.
591
+ If you are in production and everything is working fine, then use a numbered version.
592
592
 
593
593
  ```html
594
594
  <script src="https://cdn.jsdelivr.net/gh/create3000/x_ite@{{ site.version }}/dist/x_ite.min.js"></script>
@@ -0,0 +1,178 @@
1
+ ---
2
+ title: Free Online X3D File Format Converter
3
+ date: 2023-02-21
4
+ categories: [Laboratory]
5
+ tags: [X3D, File, Format, Converter]
6
+ x_ite: true
7
+ ---
8
+ <style>
9
+ #drop-zone {
10
+ box-sizing: border-box;
11
+ border: 8px dashed lightskyblue;
12
+ }
13
+
14
+ #drop-zone .center {
15
+ padding: 3rem;
16
+ text-align: center;
17
+ font-size: 200%;
18
+ font-weight: bold;
19
+ margin: 0;
20
+ background: aliceblue;
21
+ }
22
+
23
+ #convert-files,
24
+ #converting-files {
25
+ display: none;
26
+ }
27
+
28
+ #drop-zone x3d-canvas,
29
+ #drop-zone input[type=file] {
30
+ display: none;
31
+ }
32
+
33
+ #drop-zone a {
34
+ border: none;
35
+ }
36
+
37
+ #drop-zone select {
38
+ color: unset;
39
+ position: relative;
40
+ top: -8px;
41
+ }
42
+ </style>
43
+
44
+ <script defer="" src="https://create3000.github.io/media/laboratory/l-system/FileSaver.js-2.0.0/dist/FileSaver.min.js"></script>
45
+
46
+ <script defer="">
47
+ $(() =>
48
+ {
49
+ $("#drop-zone") .on ("dragover", event =>
50
+ {
51
+ event .stopPropagation ();
52
+ event .preventDefault ();
53
+
54
+ event .originalEvent .dataTransfer .dropEffect = "copy";
55
+ });
56
+
57
+ $("#drop-zone") .on ("drop", event =>
58
+ {
59
+ event .stopPropagation ();
60
+ event .preventDefault ();
61
+
62
+ read (event .originalEvent .dataTransfer .files);
63
+ });
64
+
65
+ $("#open-files a") .on ("click", event =>
66
+ {
67
+ const input = $("<input></input>")
68
+ .attr ("type", "file")
69
+ .appendTo ($("#open-files"));
70
+
71
+ input .on ("change", event =>
72
+ {
73
+ read (event .target .files);
74
+ input .remove ();
75
+ });
76
+
77
+ input .trigger ("click");
78
+ return false;
79
+ });
80
+
81
+ function read (files)
82
+ {
83
+ read .files = [... files];
84
+
85
+ $("#open-files") .hide ();
86
+ $("#convert-files") .show ();
87
+ }
88
+
89
+ $("#convert-files a") .on ("click", event =>
90
+ {
91
+ $("#convert-files") .hide ();
92
+ $("#converting-files") .show ();
93
+
94
+ convert ($("#drop-zone select") .val (), read .files);
95
+
96
+ return false;
97
+ });
98
+
99
+ const formats = {
100
+ "XML": ["model/x3d+xml", ".x3d", "toXMLString"],
101
+ "VRML": ["model/x3d+vrml", ".x3dv", "toVRMLString"],
102
+ "JSON": ["model/x3d+json", ".x3dj", "toJSONString"],
103
+ };
104
+
105
+ async function convert (encoding, files)
106
+ {
107
+ const [mimeType, extension, toString] = formats [encoding];
108
+
109
+ for (const file of files)
110
+ {
111
+ try
112
+ {
113
+ const
114
+ Browser = X3D .createBrowser () .browser,
115
+ url = URL .createObjectURL (file);
116
+
117
+ Browser .endUpdate ();
118
+
119
+ await Browser .loadURL (new X3D .MFString (url));
120
+
121
+ link (mimeType, file .name + extension, Browser .currentScene [toString] ());
122
+ }
123
+ catch (error)
124
+ {
125
+ console .error (error);
126
+ }
127
+ }
128
+
129
+ $("#converting-files") .hide ();
130
+ $("#open-files") .show ();
131
+ }
132
+
133
+ function link (mimeType, name, x3dSyntax)
134
+ {
135
+ const a = $("<a></a>")
136
+ .text (name)
137
+ .attr ("href", "#")
138
+ .on ("click", download .bind (null, mimeType, name, x3dSyntax));
139
+
140
+ $("<li></li>") .append (a) .appendTo ($("#download-links"));
141
+ }
142
+
143
+ function download (mimeType, name, x3dSyntax)
144
+ {
145
+ const blob = new Blob ([x3dSyntax], { type: `${mimeType};charset=utf-8` });
146
+
147
+ saveAs (blob, name);
148
+
149
+ return false;
150
+ }
151
+ });
152
+ </script>
153
+
154
+ <p>Convert X3D, VRML, glTF, GLB, OBJ, STL, and SVG to a X3D format.</p>
155
+
156
+ <div id="drop-zone">
157
+ <p id="open-files" class="center">
158
+ <a href="#">Choose a file</a> or drag it here.
159
+ <input type="file" />
160
+ </p>
161
+ <p id="convert-files" class="center">
162
+ <a href="#">Convert file to ...</a>
163
+ <select>
164
+ <option value="XML" selected>X3D XML Encoding</option>
165
+ <option value="VRML">X3D VRML Encoding</option>
166
+ <option value="JSON">X3D JSON Encoding</option>
167
+ </select>
168
+ </p>
169
+ <p id="converting-files" class="center">
170
+ Converting files ...
171
+ </p>
172
+ </div>
173
+
174
+ ## Converted Files
175
+
176
+ Your converted files will appear here.
177
+
178
+ <ul id="download-links"></ul>
@@ -16,23 +16,22 @@ icon: fas fa-rocket
16
16
  /* Table */
17
17
 
18
18
  .viewer-row {
19
- display: flex;
20
- height: calc(100vh - 180px);
19
+ display: flex;
20
+ height: calc(100vh - 180px);
21
21
  }
22
22
 
23
23
  .viewer-column {
24
- flex: 50%;
25
- width: 50%;
26
- height: 100%;
24
+ flex: 50%;
25
+ width: 50%;
26
+ height: 100%;
27
27
  }
28
28
 
29
29
  /* Editor */
30
30
 
31
31
  #editor, .console {
32
32
  outline: none;
33
- border: none;
34
- padding: 0.5rem;
35
33
  background: var(--playground-editor-background);
34
+ border: none;
36
35
  width: 100%;
37
36
  height: 100%;
38
37
  resize: none;
@@ -42,85 +41,25 @@ icon: fas fa-rocket
42
41
  white-space: pre;
43
42
  }
44
43
 
44
+ .monaco-editor,
45
+ .monaco-editor .margin,
46
+ .monaco-editor-background,
47
+ canvas.minimap-decorations-layer {
48
+ background-color: var(--playground-editor-background);
49
+ }
50
+
45
51
  .console {
52
+ padding: 0.5rem;
46
53
  height: 50%;
47
54
  }
48
55
 
49
- .post x3d-canvas {
56
+ .post x3d-canvas, x3d-canvas {
50
57
  display: block;
51
58
  width: 100%;
52
59
  height: 50%;
53
60
  aspect-ratio: unset;
54
61
  }
55
62
 
56
- .ace_gutter {
57
- background: var(--playground-editor-gutter) !important;
58
- }
59
-
60
- .ace_gutter-active-line,
61
- .ace_active-line {
62
- background: var(--playground-editor-active-line) !important;
63
- }
64
-
65
- .ace_selected-word,
66
- .ace_selection {
67
- border: none !important;
68
- background: var(--playground-editor-selected-word) !important;
69
- }
70
-
71
- /* XML */
72
-
73
- .ace_tag-open, .ace_tag-close, .ace_end-tag-open {
74
- color: var(--playground-xml-tag) !important;
75
- }
76
-
77
- .ace_tag-name {
78
- color: var(--playground-xml-tag-name) !important;
79
- }
80
-
81
- .ace_attribute-name {
82
- color: var(--playground-xml-attribute-name) !important;
83
- }
84
-
85
- .ace_attribute-equals {
86
- color: var(--playground-xml-attribute-equals) !important;
87
- }
88
-
89
- .ace_attribute-value {
90
- color: var(--playground-xml-attribute-value) !important;
91
- }
92
-
93
- /* JSON */
94
-
95
- .ace_paren {
96
- color: var(--playground-json-parenthesis) !important;
97
- }
98
-
99
- .ace_identifier {
100
- color: var(--playground-json-identifier) !important;
101
- }
102
-
103
- .ace_variable {
104
- color: var(--playground-json-variable) !important;
105
- }
106
-
107
- .ace_numeric,
108
- .ace_keyword.ace_operator {
109
- color: var(--playground-json-numeric) !important;
110
- }
111
-
112
- .ace_string {
113
- color: var(--playground-json-string) !important;
114
- }
115
-
116
- .ace_boolean {
117
- color: var(--playground-json-boolean) !important;
118
- }
119
-
120
- .ace_punctuation.ace_operator {
121
- color: var(--playground-json-punctuation) !important;
122
- }
123
-
124
63
  /* Console */
125
64
 
126
65
  .console {
@@ -142,57 +81,10 @@ span.error {
142
81
 
143
82
  <pre style="display:none">
144
83
  Online X3D and VRML viewer.
145
- <script src="https://cdnjs.cloudflare.com/ajax/libs/ace/1.13.1/ace.min.js"></script>
146
- <script>
84
+ <script defer src="https://cdn.jsdelivr.net/npm/monaco-editor@latest/min/vs/loader.js"></script>
85
+ <script defer>
147
86
  $(function ()
148
87
  {
149
- ace .config .set ("basePath", "https://cdnjs.cloudflare.com/ajax/libs/ace/1.13.1/");
150
-
151
- const editor = ace .edit ("editor");
152
-
153
- editor .setTheme ("ace/theme/monokai");
154
- editor .session .setOptions ({ tabSize: 2, useSoftTabs: true });
155
-
156
- editor .getSession () .on ("change", async function ()
157
- {
158
- const
159
- Browser = X3D .getBrowser (),
160
- text = editor .getSession () .getValue (),
161
- url = "data:," + text;
162
-
163
- if (text .match (/<\w+/))
164
- {
165
- editor .session .setMode ("ace/mode/xml");
166
- editor .getSession () .setUseWorker (true);
167
- }
168
- else if (text .match (/\w+\s*\{/))
169
- {
170
- editor .session .setMode ("ace/mode/javascript");
171
- editor .getSession () .setUseWorker (false);
172
- }
173
- else if (text .match (/"\w+"\s*:\s*\{/))
174
- {
175
- editor .session .setMode ("ace/mode/json");
176
- editor .getSession () .setUseWorker (true);
177
- }
178
-
179
- if (Browser .getActiveViewpoint ())
180
- {
181
- const
182
- positionOffset = Browser .getActiveViewpoint () ._positionOffset .copy (),
183
- orientationOffset = Browser .getActiveViewpoint () ._orientationOffset .copy ();
184
-
185
- await Browser .loadURL (new X3D .MFString (url)) .catch (Function .prototype);
186
-
187
- Browser .getActiveViewpoint () ._positionOffset = positionOffset;
188
- Browser .getActiveViewpoint () ._orientationOffset = orientationOffset;
189
- }
190
- else
191
- {
192
- await Browser .loadURL (new X3D .MFString (url)) .catch (Function .prototype);
193
- }
194
- });
195
-
196
88
  const box = `<X3D profile='Full' version='4.0'>
197
89
  <Scene>
198
90
  <Shape>
@@ -206,9 +98,66 @@ $(function ()
206
98
  </X3D>
207
99
  `;
208
100
 
209
- editor .setValue (box .replace (/ {3}/g, " "), -1);
210
- editor .getSession () .setUndoManager (new ace .UndoManager ());
211
- });
101
+ require .config ({ paths: { "vs": "https://cdn.jsdelivr.net/npm/monaco-editor@latest/min/vs" }});
102
+ require (["vs/editor/editor.main"], () =>
103
+ {
104
+ const darkMode = (window .matchMedia && window .matchMedia ("(prefers-color-scheme: dark)") .matches || $("html") .attr ("data-mode") === "dark") && ($("html") .attr ("data-mode") !== "light");
105
+
106
+ const editor = monaco .editor .create (document .getElementById ("editor"),
107
+ {
108
+ language: "xml",
109
+ theme: darkMode ? "vs-dark" : "vs-light",
110
+ contextmenu: true,
111
+ automaticLayout: true,
112
+ tabSize: 2,
113
+ wordWrap: "on",
114
+ wrappingIndent: "indent",
115
+ minimap: { enabled: false },
116
+ });
117
+
118
+ editor .getModel () .onDidChangeContent (async (event) =>
119
+ {
120
+ const
121
+ Browser = X3D .getBrowser (),
122
+ text = editor .getValue (),
123
+ url = "data:," + text;
124
+
125
+ if (text .match (/<\w+/))
126
+ {
127
+ monaco .editor .setModelLanguage (editor .getModel (), "xml");
128
+ }
129
+ else if (text .match (/"\w+"\s*:\s*\{/))
130
+ {
131
+ monaco .editor .setModelLanguage (editor .getModel (), "json");
132
+ }
133
+ else if (text .match (/\w+\s*\{/))
134
+ {
135
+ monaco .editor .setModelLanguage (editor .getModel (), "vrml");
136
+ }
137
+
138
+ if (Browser .getActiveViewpoint ())
139
+ {
140
+ const
141
+ positionOffset = Browser .getActiveViewpoint () ._positionOffset .copy (),
142
+ orientationOffset = Browser .getActiveViewpoint () ._orientationOffset .copy ();
143
+
144
+ await Browser .loadURL (new X3D .MFString (url)) .catch (Function .prototype);
145
+
146
+ if (Browser .getActiveViewpoint ())
147
+ {
148
+ Browser .getActiveViewpoint () ._positionOffset = positionOffset;
149
+ Browser .getActiveViewpoint () ._orientationOffset = orientationOffset;
150
+ }
151
+ }
152
+ else
153
+ {
154
+ await Browser .loadURL (new X3D .MFString (url)) .catch (Function .prototype);
155
+ }
156
+ });
157
+
158
+ editor .setValue (box .replace (/ {3}/g, " "));
159
+ });
160
+ })
212
161
  </script>
213
162
  </pre>
214
163
 
@@ -217,17 +166,15 @@ $(function ()
217
166
  {
218
167
  function output (log, classes)
219
168
  {
220
- return function ()
169
+ return function (... args)
221
170
  {
222
- const args = arguments;
223
-
224
171
  $(function ()
225
172
  {
226
173
  const
227
- text = Array .prototype .slice .call (args) .join ("") + "\n",
174
+ text = args .join ("") + "\n",
228
175
  element = $("<span></span>") .addClass (classes) .text (text);
229
176
 
230
- if (text .includes ("No suitable"))
177
+ if (text .match (/No suitable/))
231
178
  return;
232
179
 
233
180
  log .apply (this, args);