x3d-tidy 1.0.22 → 1.0.24
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/Makefile +2 -0
- package/README.md +1 -0
- package/package.json +4 -4
- package/src/convert.js +36 -0
- package/src/traverse.js +1 -1
- package/tests/test.html +59 -0
package/Makefile
ADDED
package/README.md
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "x3d-tidy",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.24",
|
|
4
4
|
"description": "X3D Converter, Beautifier and Minimizer",
|
|
5
5
|
"bin": {
|
|
6
6
|
"x3d-tidy": "bin/x3d-tidy.js"
|
|
@@ -39,8 +39,8 @@
|
|
|
39
39
|
},
|
|
40
40
|
"homepage": "https://www.npmjs.com/package/x3d-tidy",
|
|
41
41
|
"dependencies": {
|
|
42
|
-
"electron": "^24.
|
|
43
|
-
"x_ite": "^8.6.
|
|
44
|
-
"yargs": "^17.7.
|
|
42
|
+
"electron": "^24.2.0",
|
|
43
|
+
"x_ite": "^8.6.22",
|
|
44
|
+
"yargs": "^17.7.2"
|
|
45
45
|
}
|
|
46
46
|
}
|
package/src/convert.js
CHANGED
|
@@ -7,6 +7,7 @@ const
|
|
|
7
7
|
metadata = require ("./metadata"),
|
|
8
8
|
electron = require ("electron"),
|
|
9
9
|
yargs = require ("yargs"),
|
|
10
|
+
url = require ("url"),
|
|
10
11
|
path = require ("path"),
|
|
11
12
|
fs = require ("fs"),
|
|
12
13
|
zlib = require ("zlib"),
|
|
@@ -160,9 +161,44 @@ function getContents ({ scene, type, style, precision, doublePrecision })
|
|
|
160
161
|
return scene .toJSONString ({ style: style || "TIDY", precision: precision, doublePrecision: doublePrecision })
|
|
161
162
|
case ".x3djz":
|
|
162
163
|
return zlib .gzipSync (scene .toJSONString ({ style: style || "CLEAN", precision: precision, doublePrecision: doublePrecision }))
|
|
164
|
+
case ".html":
|
|
165
|
+
return getHTML (scene);
|
|
163
166
|
}
|
|
164
167
|
}
|
|
165
168
|
|
|
169
|
+
function getHTML (scene)
|
|
170
|
+
{
|
|
171
|
+
return `<!DOCTYPE html>
|
|
172
|
+
<html>
|
|
173
|
+
<head>
|
|
174
|
+
<meta charset="utf-8">
|
|
175
|
+
<script src="https://create3000.github.io/code/x_ite/latest/x_ite.min.js"></script>
|
|
176
|
+
<style>
|
|
177
|
+
body {
|
|
178
|
+
background-color: rgb(21, 22, 24);
|
|
179
|
+
color: rgb(108, 110, 113);
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
a {
|
|
183
|
+
color: rgb(106, 140, 191);
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
x3d-canvas {
|
|
187
|
+
width: 768px;
|
|
188
|
+
height: 432px;
|
|
189
|
+
}
|
|
190
|
+
</style>
|
|
191
|
+
</head>
|
|
192
|
+
<body>
|
|
193
|
+
<h1>${path .basename (url .fileURLToPath (scene .worldURL))}</h1>
|
|
194
|
+
<x3d-canvas>
|
|
195
|
+
${scene .toXMLString ({ html: true, indent: " " .repeat (6) })}
|
|
196
|
+
</x3d-canvas>
|
|
197
|
+
<p>Made with <a href="https://www.npmjs.com/package/x3d-tidy" target="_blank">x3d-tidy.</a></p>
|
|
198
|
+
</body>
|
|
199
|
+
</html>`
|
|
200
|
+
}
|
|
201
|
+
|
|
166
202
|
function output (stdout, ... args)
|
|
167
203
|
{
|
|
168
204
|
stdout .write (args .join (" ") + "\n")
|
package/src/traverse.js
CHANGED
package/tests/test.html
ADDED
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html>
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="utf-8">
|
|
5
|
+
<script src="https://create3000.github.io/code/x_ite/latest/x_ite.min.js"></script>
|
|
6
|
+
<style>
|
|
7
|
+
body {
|
|
8
|
+
background-color: rgb(21, 22, 24);
|
|
9
|
+
color: rgb(108, 110, 113);
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
a {
|
|
13
|
+
color: rgb(106, 140, 191);
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
x3d-canvas {
|
|
17
|
+
width: 768px;
|
|
18
|
+
height: 432px;
|
|
19
|
+
}
|
|
20
|
+
</style>
|
|
21
|
+
</head>
|
|
22
|
+
<body>
|
|
23
|
+
<h1>test.x3d</h1>
|
|
24
|
+
<x3d-canvas>
|
|
25
|
+
<X3D profile='Interactive' version='4.0' xmlns:xsd='http://www.w3.org/2001/XMLSchema-instance' xsd:noNamespaceSchemaLocation='http://www.web3d.org/specifications/x3d-4.0.xsd'>
|
|
26
|
+
<head>
|
|
27
|
+
<meta name='converter' content='x3d-tidy V1.0.23, https://www.npmjs.com/package/x3d-tidy'></meta>
|
|
28
|
+
<meta name='converted' content='Sun, 07 May 2023 09:56:51 GMT'></meta>
|
|
29
|
+
</head>
|
|
30
|
+
<Scene>
|
|
31
|
+
<Background
|
|
32
|
+
skyColor='0.2 0.2 0.2'></Background>
|
|
33
|
+
<Viewpoint
|
|
34
|
+
position='4.75079 5.5764 6.80689'
|
|
35
|
+
orientation='-0.67979594907481 0.70155548858341 0.2137694179717 0.842769006819'></Viewpoint>
|
|
36
|
+
<TouchSensor
|
|
37
|
+
description='Box Geometry'></TouchSensor>
|
|
38
|
+
<Shape>
|
|
39
|
+
<Appearance>
|
|
40
|
+
<Material
|
|
41
|
+
diffuseColor='0 0.5 1'>
|
|
42
|
+
<PixelTexture containerField='diffuseTexture'
|
|
43
|
+
image='2 2 1
|
|
44
|
+
0xff 0x0
|
|
45
|
+
0x0 0xff'>
|
|
46
|
+
<TextureProperties
|
|
47
|
+
boundaryModeS='CLAMP_TO_EDGE'
|
|
48
|
+
boundaryModeT='CLAMP_TO_EDGE'></TextureProperties>
|
|
49
|
+
</PixelTexture>
|
|
50
|
+
</Material>
|
|
51
|
+
</Appearance>
|
|
52
|
+
<Box></Box>
|
|
53
|
+
</Shape>
|
|
54
|
+
</Scene>
|
|
55
|
+
</X3D>
|
|
56
|
+
</x3d-canvas>
|
|
57
|
+
<p>Made with <a href="https://www.npmjs.com/package/x3d-tidy" target="_blank">x3d-tidy.</a></p>
|
|
58
|
+
</body>
|
|
59
|
+
</html>
|